From 09584be48705d24a4eaf89655ac78138fc95108d Mon Sep 17 00:00:00 2001 From: Alvaro Saburido Date: Sun, 5 Jan 2025 19:11:12 +0100 Subject: [PATCH] fix: typescript build issues (#578) * chore(tsconfig): update module resolution and linting options - Changed moduleResolution from "node" to "bundler" for improved compatibility with bundlers. - Added allowImportingTsExtensions to enable importing TypeScript files with extensions. - Updated linting options: enabled noFallthroughCasesInSwitch, noUnusedParameters, and isolatedModules. - Removed declaration, sourceMap, and esModuleInterop options for cleaner configuration. * fix(Edges): ensure parent is a Mesh instance before accessing geometry * refactor(Lensflare): migrate Lensflare import to three-stdlib for improved typescript compatibility * fix(Outline): enhance OutlineMaterial type definition and improve material instantiation for better TypeScript support * fix(PositionalAudio): migrate PositionalAudioHelper import to three-stdlib for improved TypeScript compatibility * refactor(PointerLockControls): enhance TypeScript support by extending PointerLockControls with event types and enabling shallow references * fix(SVGLoader): implement TresSVGLoader class to enhance compatibility with TresJS loader interface and streamline SVG loading process * fix(GLTFLoader): implement TresGLTFLoader class for enhanced compatibility with TresJS loader system and improve GLTF loading functionality * refactor(meshGlassMaterial): consolidate imports for improved readability and maintainability * refactor(Line2): consolidate Line2 imports from three-stdlib for improved compatibility and maintainability * refactor(ShaderData): replace mapLinear and clamp imports with MathUtils methods for improved consistency and maintainability * fix(Precipitation): enhance texture handling by adding support for texture URLs and updating prop types for better flexibility * refactor(FBXLoader): implement TresFBXLoader class to enhance compatibility with TresJS loader system and improve FBX loading functionality * chore(playground): improved demos for gltf and fbx * refactor(useEnvironment): simplify loader logic and improve type handling for environment map loading * chore(FBXModelDemo): add OrbitControls and adjust FBXModel position and shadow casting * chore(Jeep): adjust truck position, enable shadow casting for mesh components * chore: adding shadows and correct spacial parameters to model playgrounds * refactor(PointerLockControls): revert wrong change on extend PointerLockControls * chore: fix lint * refactor(useFBX): improve type handling for useFBX function to support generic path types similar to useGLTF * refactor(Precipitation): update prop type documentation to correctly reference PrecipitationProps instead of StarsProps and ContactShadowsProps * refactor(useEnvironment): simplify loader callback by removing unnecessary type annotation * refactor(Edges): improve type checks for parent geometry in Edges component * refactor(Precipitation): enhance prop type definitions and improve texture handling logic * refactor(Edges): reorder import statements for better readability --- playground/vue/components.d.ts | 4 +- playground/vue/src/components/AkuAku.vue | 14 --- playground/vue/src/components/ModelsDemo.vue | 78 ---------------- playground/vue/src/components/fbx/Jeep.vue | 27 ++++++ .../vue/src/components/gltf/BlenderCube.vue | 28 ++++++ playground/vue/src/components/gltf/index.vue | 63 ------------- .../vue/src/pages/loaders/FBXModelDemo.vue | 44 +++++++++ .../vue/src/pages/loaders/GLTFModelDemo.vue | 41 +++++++++ .../vue/src/pages/loaders/UseFBXDemo.vue | 39 ++++++++ .../vue/src/pages/loaders/UseGLTFDemo.vue | 15 ++-- playground/vue/src/router/routes/loaders.ts | 15 ++++ src/core/abstractions/Edges.vue | 6 +- src/core/abstractions/Lensflare/component.vue | 4 +- src/core/abstractions/Outline/component.vue | 13 ++- src/core/abstractions/PositionalAudio.vue | 2 +- src/core/controls/PointerLockControls.vue | 39 ++++---- src/core/loaders/SVG/component.vue | 24 +++-- src/core/loaders/useFBX/index.ts | 59 ++++++++++-- src/core/loaders/useGLTF/index.ts | 89 +++++++++++++++---- .../materials/meshGlassMaterial/material.ts | 7 +- src/core/shapes/Line2.vue | 4 +- src/core/staging/Precipitation.vue | 71 +++++++++++---- src/core/staging/Sparkles/ShaderData.ts | 4 +- src/core/staging/useEnvironment/index.ts | 32 ++++--- tsconfig.json | 16 ++-- 25 files changed, 469 insertions(+), 269 deletions(-) delete mode 100644 playground/vue/src/components/AkuAku.vue delete mode 100644 playground/vue/src/components/ModelsDemo.vue create mode 100644 playground/vue/src/components/fbx/Jeep.vue create mode 100644 playground/vue/src/components/gltf/BlenderCube.vue delete mode 100644 playground/vue/src/components/gltf/index.vue create mode 100644 playground/vue/src/pages/loaders/FBXModelDemo.vue create mode 100644 playground/vue/src/pages/loaders/GLTFModelDemo.vue create mode 100644 playground/vue/src/pages/loaders/UseFBXDemo.vue diff --git a/playground/vue/components.d.ts b/playground/vue/components.d.ts index 40a84940e..06f78b111 100644 --- a/playground/vue/components.d.ts +++ b/playground/vue/components.d.ts @@ -7,10 +7,12 @@ export {} /* prettier-ignore */ declare module 'vue' { export interface GlobalComponents { - AkuAku: typeof import('./src/components/AkuAku.vue')['default'] + AkuAku: typeof import('./src/components/gltf/BlenderCube.vue')['default'] + BlenderCube: typeof import('./src/components/gltf/BlenderCube.vue')['default'] FboCube: typeof import('./src/components/FboCube.vue')['default'] Gltf: typeof import('./src/components/gltf/index.vue')['default'] GraphPane: typeof import('./src/components/GraphPane.vue')['default'] + Jeep: typeof import('./src/components/fbx/Jeep.vue')['default'] ModelsDemo: typeof import('./src/components/ModelsDemo.vue')['default'] OverlayInfo: typeof import('./src/components/OverlayInfo.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] diff --git a/playground/vue/src/components/AkuAku.vue b/playground/vue/src/components/AkuAku.vue deleted file mode 100644 index 26583332b..000000000 --- a/playground/vue/src/components/AkuAku.vue +++ /dev/null @@ -1,14 +0,0 @@ - - - diff --git a/playground/vue/src/components/ModelsDemo.vue b/playground/vue/src/components/ModelsDemo.vue deleted file mode 100644 index f6a02c635..000000000 --- a/playground/vue/src/components/ModelsDemo.vue +++ /dev/null @@ -1,78 +0,0 @@ - - - diff --git a/playground/vue/src/components/fbx/Jeep.vue b/playground/vue/src/components/fbx/Jeep.vue new file mode 100644 index 000000000..7f71f07e9 --- /dev/null +++ b/playground/vue/src/components/fbx/Jeep.vue @@ -0,0 +1,27 @@ + + + diff --git a/playground/vue/src/components/gltf/BlenderCube.vue b/playground/vue/src/components/gltf/BlenderCube.vue new file mode 100644 index 000000000..8d3e7d117 --- /dev/null +++ b/playground/vue/src/components/gltf/BlenderCube.vue @@ -0,0 +1,28 @@ + + + diff --git a/playground/vue/src/components/gltf/index.vue b/playground/vue/src/components/gltf/index.vue deleted file mode 100644 index b75a306d6..000000000 --- a/playground/vue/src/components/gltf/index.vue +++ /dev/null @@ -1,63 +0,0 @@ - - - diff --git a/playground/vue/src/pages/loaders/FBXModelDemo.vue b/playground/vue/src/pages/loaders/FBXModelDemo.vue new file mode 100644 index 000000000..82f454ef4 --- /dev/null +++ b/playground/vue/src/pages/loaders/FBXModelDemo.vue @@ -0,0 +1,44 @@ + + + diff --git a/playground/vue/src/pages/loaders/GLTFModelDemo.vue b/playground/vue/src/pages/loaders/GLTFModelDemo.vue new file mode 100644 index 000000000..c3c606bb3 --- /dev/null +++ b/playground/vue/src/pages/loaders/GLTFModelDemo.vue @@ -0,0 +1,41 @@ + + + diff --git a/playground/vue/src/pages/loaders/UseFBXDemo.vue b/playground/vue/src/pages/loaders/UseFBXDemo.vue new file mode 100644 index 000000000..d8e092b06 --- /dev/null +++ b/playground/vue/src/pages/loaders/UseFBXDemo.vue @@ -0,0 +1,39 @@ + + + diff --git a/playground/vue/src/pages/loaders/UseGLTFDemo.vue b/playground/vue/src/pages/loaders/UseGLTFDemo.vue index 087d64056..e4bf80ced 100644 --- a/playground/vue/src/pages/loaders/UseGLTFDemo.vue +++ b/playground/vue/src/pages/loaders/UseGLTFDemo.vue @@ -1,8 +1,8 @@