@tresjs/nuxt 1.1.0 → 1.1.1

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.1"
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 } 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,40 @@ 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
24
  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;
25
+ shadows?: boolean
26
+ shadowMapType?: ShadowMapType
27
+ physicallyCorrectLights?: boolean
28
+ useLegacyLights?: boolean
29
+ outputColorSpace?: ColorSpace
30
+ toneMapping?: ToneMapping
31
+ toneMappingExposure?: number
32
+ context?: WebGLRenderingContext
33
+ powerPreference?: 'high-performance' | 'low-power' | 'default'
34
+ preserveDrawingBuffer?: boolean
35
+ clearColor?: string
36
+ windowSize?: boolean
37
+ preset?: RendererPresetsType
38
+ disableRender?: boolean
39
+ camera?: TresCamera
39
40
  }
40
- defineProps<TresCanvasProps>();
41
-
42
- const stateRef = ref();
41
+ const stateRef = ref()
43
42
 
44
43
  defineExpose({
45
44
  state: stateRef,
46
- });
45
+ })
47
46
  </script>
48
47
 
49
48
  <template>
50
49
  <ClientOnly>
51
- <TC ref="stateRef" v-bind="$props">
50
+ <TC
51
+ ref="stateRef"
52
+ v-bind="$props"
53
+ >
52
54
  <slot />
53
55
  </TC>
54
56
  </ClientOnly>
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@tresjs/nuxt",
3
3
  "type": "module",
4
+ "version": "1.1.1",
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",