@tresjs/nuxt 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -39,8 +39,8 @@ npm install @tresjs/nuxt
39
39
 
40
40
  ```js
41
41
  export default defineNuxtConfig({
42
- modules: ["@tresjs/nuxt"],
43
- });
42
+ modules: ['@tresjs/nuxt'],
43
+ })
44
44
  ```
45
45
 
46
46
  That's it! You can now use `@tresjs/nuxt` in your Nuxt app ✨
package/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@tresjs/nuxt",
3
3
  "configKey": "tres",
4
- "version": "1.1.0"
4
+ "version": "1.1.2"
5
5
  }
package/dist/module.mjs CHANGED
@@ -1,8 +1,9 @@
1
+ import { readFile } from 'fs/promises';
1
2
  import { defineNuxtModule, createResolver, addComponent, addImports, resolvePath } from '@nuxt/kit';
2
3
  import * as core from '@tresjs/core';
4
+ import { templateCompilerOptions } from '@tresjs/core';
3
5
  import { readPackageJSON } from 'pkg-types';
4
6
  import { findExportNames } from 'mlly';
5
- import { readFile } from 'fs/promises';
6
7
 
7
8
  const module = defineNuxtModule({
8
9
  meta: {
@@ -42,10 +43,7 @@ const module = defineNuxtModule({
42
43
  nuxt.hook("prepare:types", ({ references }) => {
43
44
  references.push({ types: "@tresjs/core" });
44
45
  });
45
- const isCustomElement = nuxt.options.vue.compilerOptions.isCustomElement;
46
- nuxt.options.vue.compilerOptions.isCustomElement = (tag) => {
47
- return tag.startsWith("Tres") && tag !== "TresCanvas" || tag === "primitive" || isCustomElement?.(tag);
48
- };
46
+ nuxt.options.vue.compilerOptions.isCustomElement = templateCompilerOptions.template.compilerOptions.isCustomElement;
49
47
  const pkg = await readPackageJSON(nuxt.options.rootDir);
50
48
  const coreDeps = Object.keys({ ...pkg.dependencies, ...pkg.devDependencies }).filter((d) => d.startsWith("@tresjs/"));
51
49
  for (const mod of /* @__PURE__ */ new Set([...options.modules, ...coreDeps])) {
@@ -1,10 +1,11 @@
1
1
  <script setup lang="ts">
2
- import { ref } from "vue";
3
- import { TresCanvas as TC } from "@tresjs/core";
4
- import type { TresCamera } from "@tresjs/core";
5
- import { ColorSpace, ShadowMapType, ToneMapping } from "three";
2
+ import { ref } from 'vue'
3
+ import { TresCanvas as TC } from '@tresjs/core'
4
+ import type { TresCamera } from '@tresjs/core'
5
+ import { ACESFilmicToneMapping, PCFSoftShadowMap, SRGBColorSpace } from 'three'
6
+ import type { ColorSpace, ShadowMapType, ToneMapping, WebGLRendererParameters } from 'three'
6
7
 
7
- import { ACESFilmicToneMapping, PCFSoftShadowMap, SRGBColorSpace } from "three";
8
+ defineProps<TresCanvasProps>()
8
9
 
9
10
  const rendererPresets = {
10
11
  realistic: {
@@ -16,39 +17,39 @@ const rendererPresets = {
16
17
  type: PCFSoftShadowMap,
17
18
  },
18
19
  },
19
- };
20
+ }
20
21
 
21
- type RendererPresetsType = keyof typeof rendererPresets;
22
+ type RendererPresetsType = keyof typeof rendererPresets
22
23
 
23
- interface TresCanvasProps {
24
- shadows?: boolean;
25
- shadowMapType?: ShadowMapType;
26
- physicallyCorrectLights?: boolean;
27
- useLegacyLights?: boolean;
28
- outputColorSpace?: ColorSpace;
29
- toneMapping?: ToneMapping;
30
- toneMappingExposure?: number;
31
- context?: WebGLRenderingContext;
32
- powerPreference?: "high-performance" | "low-power" | "default";
33
- preserveDrawingBuffer?: boolean;
34
- clearColor?: string;
35
- windowSize?: boolean;
36
- preset?: RendererPresetsType;
37
- disableRender?: boolean;
38
- camera?: TresCamera;
39
- }
40
- defineProps<TresCanvasProps>();
24
+ interface TresCanvasProps extends Omit<WebGLRendererParameters, 'canvas'> {
25
+ // required by for useRenderer
26
+ shadows?: boolean
27
+ clearColor?: string
28
+ toneMapping?: ToneMapping
29
+ shadowMapType?: ShadowMapType
30
+ useLegacyLights?: boolean
31
+ outputColorSpace?: ColorSpace
32
+ toneMappingExposure?: number
41
33
 
42
- const stateRef = ref();
34
+ // required by useTresContextProvider
35
+ windowSize?: boolean
36
+ preset?: RendererPresetsType
37
+ disableRender?: boolean
38
+ camera?: TresCamera
39
+ }
40
+ const stateRef = ref()
43
41
 
44
42
  defineExpose({
45
43
  state: stateRef,
46
- });
44
+ })
47
45
  </script>
48
46
 
49
47
  <template>
50
48
  <ClientOnly>
51
- <TC ref="stateRef" v-bind="$props">
49
+ <TC
50
+ ref="stateRef"
51
+ v-bind="$props"
52
+ >
52
53
  <slot />
53
54
  </TC>
54
55
  </ClientOnly>
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@tresjs/nuxt",
3
3
  "type": "module",
4
+ "version": "1.1.2",
4
5
  "packageManager": "pnpm@8.6.2",
5
- "version": "1.1.0",
6
6
  "description": "TresJS integration for Nuxt.",
7
- "repository": "@tresjs/nuxt",
8
7
  "author": "Daniel Roe (https://github.com/danielroe/)",
8
+ "license": "MIT",
9
+ "repository": "@tresjs/nuxt",
9
10
  "publishConfig": {
10
11
  "access": "public"
11
12
  },
12
- "license": "MIT",
13
13
  "exports": {
14
14
  ".": {
15
15
  "types": "./dist/types.d.ts",
16
- "import": "./dist/module.mjs",
17
- "require": "./dist/module.cjs"
16
+ "require": "./dist/module.cjs",
17
+ "import": "./dist/module.mjs"
18
18
  }
19
19
  },
20
20
  "main": "./dist/module.cjs",