Skip to content

Commit

Permalink
chore: fix package.json + remove /@ alias + add docs as workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
userquin committed May 18, 2023
1 parent 7106cf9 commit 5b1f222
Show file tree
Hide file tree
Showing 55 changed files with 248 additions and 314 deletions.
24 changes: 20 additions & 4 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import Unocss from 'unocss/vite'
import svgLoader from 'vite-svg-loader'
import { defineConfig } from 'vitepress'
import { resolve } from 'pathe'

Expand All @@ -12,6 +10,9 @@ export default defineConfig({
],
themeConfig: {
logo: '/logo.svg',
search: {
provider: 'local',
},
sidebar: [
{
text: 'Guide',
Expand Down Expand Up @@ -96,11 +97,26 @@ export default defineConfig({
],
},
vite: {
plugins: [svgLoader(), Unocss()],
optimizeDeps: {
exclude: ['vitepress'],
include: ['three'],
},
server: {
hmr: {
overlay: false,
},
},
resolve: {
alias: {
'@tresjs/core': resolve(__dirname, '../../dist/tres.js'),
'/@': resolve(__dirname, '../../dist'),
},
dedupe: ['@tresjs/cientos', 'three'],
},
},
vue: {
template: {
compilerOptions: {
isCustomElement: tag => tag.startsWith('Tres') && tag !== 'TresCanvas',
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion docs/.vitepress/theme/components/DonutExample.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { TresCanvas } from '/@/tres'
import { TresCanvas } from '@tresjs/core'
import { BasicShadowMap, SRGBColorSpace, NoToneMapping } from 'three'
import { OrbitControls } from '@tresjs/cientos'
Expand Down
2 changes: 1 addition & 1 deletion docs/.vitepress/theme/components/ExtendExample.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { useTres } from '/@/'
import { useTres } from '@tresjs/core'
const styles = {
width: '100%',
Expand Down
2 changes: 1 addition & 1 deletion docs/.vitepress/theme/components/FirstScene.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { ref, onMounted } from 'vue'
import { BasicShadowMap, SRGBColorSpace, NoToneMapping } from 'three'
import { TresCanvas } from '/@/tres'
import { TresCanvas } from '@tresjs/core'
import { OrbitControls } from '@tresjs/cientos'
const LightRef = ref()
Expand Down
2 changes: 1 addition & 1 deletion docs/.vitepress/theme/components/FirstSceneLightToon.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { TresCanvas } from '/@/tres'
import { TresCanvas } from '@tresjs/core'
import { OrbitControls } from '@tresjs/cientos'
const styles = {
Expand Down
16 changes: 16 additions & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "docs",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vitepress dev",
"build": "vitepress build",
"preview": "vitepress preview"
},
"devDependencies": {
"unocss": "^0.51.13",
"vite-svg-loader": "^4.0.0",
"vitepress": "1.0.0-alpha.75"
}
}
20 changes: 20 additions & 0 deletions docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"module": "esnext",
"target": "esnext",
"lib": ["DOM", "ESNext"],
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"jsx": "preserve",
"noUnusedLocals": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"forceConsistentCasingInFileNames": true,
"types": ["vite/client"]
},
"exclude": [
"dist",
"node_modules"
]
}
7 changes: 7 additions & 0 deletions docs/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineConfig } from 'vite'
import Unocss from 'unocss/vite'
import svgLoader from 'vite-svg-loader'

export default defineConfig({
plugins: [svgLoader(), Unocss()],
})
11 changes: 4 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,19 @@
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
"import": "./dist/tres.js"
},
"./components": {
"types": "./dist/components/index.d.ts",
"import": "./dist/components/index.js"
"types": "./dist/components/index.d.ts"
},
"./composables": {
"types": "./dist/composables/index.d.ts",
"import": "./dist/composables/index.js"
"types": "./dist/composables/index.d.ts"
},
"./types": {
"types": "./dist/types/index.d.ts"
},
"./utils": {
"types": "./dist/utils/index.d.ts",
"import": "./dist/utils/index.js"
"types": "./dist/utils/index.d.ts"
},
"./*": "./*"
},
Expand Down
3 changes: 2 additions & 1 deletion playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
},
"devDependencies": {
"unplugin-auto-import": "^0.16.0",
"vite-plugin-glsl": "^1.1.2"
"vite-plugin-glsl": "^1.1.2",
"vue-tsc": "^1.6.5"
}
}
2 changes: 1 addition & 1 deletion playground/src/components/AnimatedModel.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { Color, SRGBColorSpace } from 'three'
import { TresCanvas } from '/@/'
import { TresCanvas } from '@tresjs/core'
import { OrbitControls, useTweakPane, useGLTF, useAnimations } from '@tresjs/cientos'
const bgColor = new Color('#F78B3D')
Expand Down
2 changes: 1 addition & 1 deletion playground/src/components/Cameras.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { TresCanvas } from '/@'
import { TresCanvas } from '@tresjs/core'
import { BasicShadowMap, SRGBColorSpace, NoToneMapping, PerspectiveCamera, OrthographicCamera } from 'three'
import { Box, useTweakPane } from '@tresjs/cientos'
Expand Down
2 changes: 1 addition & 1 deletion playground/src/components/FBXModels.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { Color, SRGBColorSpace } from 'three'
import { TresCanvas } from '/@/'
import { TresCanvas } from '@tresjs/core'
import { OrbitControls, useTweakPane, FBXModel, useFBX } from '@tresjs/cientos'
const bgColor = new Color('#F78B3D')
Expand Down
2 changes: 1 addition & 1 deletion playground/src/components/MultipleCanvas.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { BasicShadowMap, NoToneMapping, SRGBColorSpace } from 'three'
import { TresCanvas } from '/@/components/TresCanvas'
import { TresCanvas } from '@tresjs/core'
import { GLTFModel, OrbitControls } from '@tresjs/cientos'
const state = reactive({
Expand Down
3 changes: 1 addition & 2 deletions playground/src/components/TestSphere.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<!-- eslint-disable max-len -->
<script setup lang="ts">
import { useRenderLoop, useTexture } from '/@/'
import { TresInstance } from '../types'
import { type TresInstance, useRenderLoop, useTexture } from '@tresjs/core'

const sphereRef: Ref<TresInstance | null> = ref(null)

Expand Down
3 changes: 1 addition & 2 deletions playground/src/components/Text3D.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<script setup lang="ts">
import { TextGeometry } from 'three/examples/jsm/geometries/TextGeometry'
import { FontLoader } from 'three/examples/jsm/loaders/FontLoader'
import { extend } from '../core/catalogue'
import { useTexture } from '/@/composables'
import { extend, useTexture } from '@tresjs/core'
extend({ TextGeometry })
Expand Down
3 changes: 1 addition & 2 deletions playground/src/components/TheBasic.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<script setup lang="ts">
import { SRGBColorSpace, BasicShadowMap, NoToneMapping } from 'three'
import { reactive, ref } from 'vue'
import { TresCanvas } from '/@/components/TresCanvas'
import { TresCanvas, useRenderLoop } from '@tresjs/core'
import { OrbitControls, TransformControls } from '@tresjs/cientos'
import { useRenderLoop } from '/@/'
const state = reactive({
clearColor: '#201919',
Expand Down
2 changes: 1 addition & 1 deletion playground/src/components/TheConditional.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { BasicShadowMap, MeshPhongMaterial, NoToneMapping, SRGBColorSpace } from 'three'
import { reactive } from 'vue'
import { OrbitControls, useTweakPane } from '@tresjs/cientos'
import { TresCanvas } from '/@/'
import { TresCanvas } from '@tresjs/core'
const state = reactive({
clearColor: '#201919',
Expand Down
2 changes: 1 addition & 1 deletion playground/src/components/TheEnvironment.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { ref, shallowRef, watch } from 'vue'
import { Environment, Box, PamCameraMouse } from '@tresjs/cientos'
import { TresCanvas } from '../core/useRenderer/component'
import { TresCanvas } from '@tresjs/core'
/* import { OrbitControls, GLTFModel } from '@tresjs/cientos' */
const sphereRef = ref()
Expand Down
2 changes: 1 addition & 1 deletion playground/src/components/TheEvents.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { BasicShadowMap, NoToneMapping, SRGBColorSpace } from 'three'
import { reactive } from 'vue'
import { OrbitControls } from '@tresjs/cientos'
import { TresCanvas } from '/@/'
import { TresCanvas } from '@tresjs/core'
const state = reactive({
clearColor: '#201919',
Expand Down
2 changes: 1 addition & 1 deletion playground/src/components/TheFirstScene.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { TresCanvas } from '/@/'
import { TresCanvas } from '@tresjs/core'
</script>

<template>
Expand Down
2 changes: 1 addition & 1 deletion playground/src/components/TheGizmos.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { BasicShadowMap, SRGBColorSpace, NoToneMapping } from 'three'
import { TresCanvas } from '/@/'
import { TresCanvas } from '@tresjs/core'
import { OrbitControls, TransformControls, useTweakPane } from '@tresjs/cientos'
const state = shallowReactive({
Expand Down
3 changes: 1 addition & 2 deletions playground/src/components/TheGroups.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script setup lang="ts">
import { TresCanvas } from '/@/'
import { useRenderLoop } from '/@/composables/useRenderLoop'
import { TresCanvas, useRenderLoop } from '@tresjs/core'
import { ref } from 'vue'
import { OrbitControls } from '@tresjs/cientos/'
Expand Down
16 changes: 8 additions & 8 deletions playground/src/components/TheParticles.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { OrbitControls } from '@tresjs/cientos'
import { TresCanvas, useRenderLoop } from '/@/'
import { TresCanvas, useRenderLoop } from '@tresjs/core'
import { AdditiveBlending } from 'three'
/* import { OrbitControls, GLTFModel } from '@tresjs/cientos' */
Expand Down Expand Up @@ -70,12 +70,12 @@ onLoop(({ elapsed }) => {
<template>
<TresCanvas v-bind="gl">
<TresPerspectiveCamera :position="[5, 5, 5]" :fov="45" :near="0.1" :far="1000" :look-at="[-8, 3, -3]" />
<OrbitControls />
<TresAmbientLight :intensity="0.5" />
<TresPoints>
<TresBufferGeometry :position="[positionArray, 3]" :a-scale="[scaleArray, 1]" />
<TresShaderMaterial v-bind="shader" />
</TresPoints>
<TresDirectionalLight :position="[0, 2, 4]" :intensity="1" cast-shadow />
<OrbitControls />
<TresAmbientLight :intensity="0.5" />
<TresPoints>
<TresBufferGeometry :position="[positionArray, 3]" :a-scale="[scaleArray, 1]" />
<TresShaderMaterial v-bind="shader" />
</TresPoints>
<TresDirectionalLight :position="[0, 2, 4]" :intensity="1" cast-shadow />
</TresCanvas>
</template>
2 changes: 1 addition & 1 deletion playground/src/components/TheSmallExperience.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { TresCanvas } from '/@/'
import { TresCanvas } from '@tresjs/core'
import { OrbitControls } from '@tresjs/cientos/'
</script>
<template>
Expand Down
2 changes: 1 addition & 1 deletion playground/src/components/TheSphere.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { useTres } from '/@/'
import { useTres } from '@tresjs/core'
import { watchEffect } from 'vue'
const { state } = useTres()
Expand Down
2 changes: 1 addition & 1 deletion playground/src/components/VectorSetProps.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { SRGBColorSpace, BasicShadowMap, NoToneMapping } from 'three'
import { TresCanvas } from '/@/'
import { TresCanvas } from '@tresjs/core'
import { OrbitControls } from '@tresjs/cientos'
// import { useRenderLoop } from '..'
/* import { OrbitControls, GLTFModel } from '@tresjs/cientos' */
Expand Down
2 changes: 1 addition & 1 deletion playground/src/components/gltf/index.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { SRGBColorSpace, BasicShadowMap, NoToneMapping } from 'three'
import { TresCanvas } from '/@/'
import { TresCanvas } from '@tresjs/core'
import { OrbitControls } from '@tresjs/cientos'
const state = reactive({
Expand Down
2 changes: 1 addition & 1 deletion playground/src/components/meshWobbleMaterial/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { useRenderLoop, extend } from '/@/'
import { useRenderLoop, extend } from '@tresjs/core'
import { WobbleMaterialImpl as MeshWobbleMaterial } from './material'
import { shallowRef, watchEffect } from 'vue'
Expand Down
2 changes: 1 addition & 1 deletion playground/src/components/portal-journey/TheFireFlies.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { useRenderLoop } from '/@/'
import { useRenderLoop } from '@tresjs/core'
import { AdditiveBlending } from 'three'
import FirefliesVertex from './shaders/fireflies/vertex.glsl'
import FirefliesFragment from './shaders/fireflies/fragment.glsl'
Expand Down
2 changes: 1 addition & 1 deletion playground/src/components/portal-journey/ThePortal.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { SRGBColorSpace, DoubleSide, MeshBasicMaterial, ShaderMaterial, Color, Mesh } from 'three'
import { useRenderLoop, useTexture } from '/@/'
import { useRenderLoop, useTexture } from '@tresjs/core'
import { useGLTF, useTweakPane } from '@tresjs/cientos'
import PortalVertex from './shaders/portal/vertex.glsl'
Expand Down
2 changes: 1 addition & 1 deletion playground/src/components/portal-journey/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { TresCanvas } from '/@/'
import { TresCanvas } from '@tresjs/core'
import { OrbitControls } from '@tresjs/cientos'
import ThePortal from './ThePortal.vue'
import TheFireFlies from './TheFireFlies.vue'
Expand Down
2 changes: 1 addition & 1 deletion playground/src/components/shaders-experiment/index.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { BasicShadowMap, SRGBColorSpace, NoToneMapping, Vector2 } from 'three'
import { TresCanvas, TresInstance, useRenderLoop } from '/@/'
import { TresCanvas, TresInstance, useRenderLoop } from '@tresjs/core'
import { OrbitControls } from '@tresjs/cientos'
import vertexShader from './shaders/vertex.glsl'
import fragmentShader from './shaders/fragment.glsl'
Expand Down
2 changes: 1 addition & 1 deletion playground/src/pages/shapes.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { BasicShadowMap, CubicBezierCurve3, DoubleSide, NoToneMapping, SRGBColorSpace, Vector3 } from 'three'
import { TresCanvas } from '/@/'
import { TresCanvas } from '@tresjs/core'
import {
Plane,
Tube,
Expand Down
1 change: 0 additions & 1 deletion playground/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export default defineConfig({
resolve: {
alias: {
'@tresjs/core': resolve(__dirname, '../src/index.ts'),
'/@': resolve(__dirname, '../src'),
},
dedupe: ['three'],
},
Expand Down
Loading

0 comments on commit 5b1f222

Please sign in to comment.