@tresjs/nuxt 1.2.0-next.2 → 1.2.0-next.3
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/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { readFile } from 'fs/promises';
|
|
2
|
-
import {
|
|
2
|
+
import { createResolver, defineNuxtModule, addComponent, addImports, resolvePath } from '@nuxt/kit';
|
|
3
3
|
import * as core from '@tresjs/core';
|
|
4
4
|
import { templateCompilerOptions } from '@tresjs/core';
|
|
5
5
|
import { readPackageJSON } from 'pkg-types';
|
|
6
6
|
import { findExportNames } from 'mlly';
|
|
7
7
|
import { defu } from 'defu';
|
|
8
8
|
|
|
9
|
+
const resolver = createResolver(import.meta.url);
|
|
9
10
|
const module = defineNuxtModule({
|
|
10
11
|
meta: {
|
|
11
12
|
name: "@tresjs/nuxt",
|
|
@@ -15,10 +16,17 @@ const module = defineNuxtModule({
|
|
|
15
16
|
modules: []
|
|
16
17
|
},
|
|
17
18
|
async setup(options, nuxt) {
|
|
18
|
-
const resolver = createResolver(import.meta.url);
|
|
19
19
|
addComponent({
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
name: "TresCanvas",
|
|
21
|
+
filePath: "@tresjs/core",
|
|
22
|
+
export: "TresCanvas",
|
|
23
|
+
mode: "client",
|
|
24
|
+
_raw: true
|
|
25
|
+
});
|
|
26
|
+
addComponent({
|
|
27
|
+
name: "TresCanvas",
|
|
28
|
+
filePath: resolver.resolve("./runtime/ServerTresCanvas.vue"),
|
|
29
|
+
mode: "server"
|
|
22
30
|
});
|
|
23
31
|
nuxt.options.build.transpile.push(/@tresjs/);
|
|
24
32
|
for (const name in core) {
|
|
@@ -72,6 +80,9 @@ const module = defineNuxtModule({
|
|
|
72
80
|
nuxt.options.vite.resolve = defu(nuxt.options.vite.resolve, {
|
|
73
81
|
dedupe: ["three"]
|
|
74
82
|
});
|
|
83
|
+
nuxt.options.vite.optimizeDeps = defu(nuxt.options.vite.optimizeDeps, {
|
|
84
|
+
include: ["three"]
|
|
85
|
+
});
|
|
75
86
|
}
|
|
76
87
|
});
|
|
77
88
|
|
package/package.json
CHANGED
|
@@ -1,62 +0,0 @@
|
|
|
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 { ACESFilmicToneMapping, PCFSoftShadowMap, SRGBColorSpace } from 'three'
|
|
6
|
-
import type { ColorSpace, ShadowMapType, ToneMapping, WebGLRendererParameters } from 'three'
|
|
7
|
-
|
|
8
|
-
withDefaults(defineProps<TresCanvasProps>(), {
|
|
9
|
-
alpha: false,
|
|
10
|
-
antialias: true,
|
|
11
|
-
depth: true,
|
|
12
|
-
stencil: true,
|
|
13
|
-
preserveDrawingBuffer: false,
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
const rendererPresets = {
|
|
17
|
-
realistic: {
|
|
18
|
-
outputColorSpace: SRGBColorSpace,
|
|
19
|
-
toneMapping: ACESFilmicToneMapping,
|
|
20
|
-
toneMappingExposure: 3,
|
|
21
|
-
shadowMap: {
|
|
22
|
-
enabled: true,
|
|
23
|
-
type: PCFSoftShadowMap,
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
type RendererPresetsType = keyof typeof rendererPresets
|
|
29
|
-
|
|
30
|
-
interface TresCanvasProps extends Omit<WebGLRendererParameters, 'canvas'> {
|
|
31
|
-
// required by for useRenderer
|
|
32
|
-
shadows?: boolean
|
|
33
|
-
clearColor?: string
|
|
34
|
-
toneMapping?: ToneMapping
|
|
35
|
-
shadowMapType?: ShadowMapType
|
|
36
|
-
useLegacyLights?: boolean
|
|
37
|
-
outputColorSpace?: ColorSpace
|
|
38
|
-
toneMappingExposure?: number
|
|
39
|
-
|
|
40
|
-
// required by useTresContextProvider
|
|
41
|
-
windowSize?: boolean
|
|
42
|
-
preset?: RendererPresetsType
|
|
43
|
-
disableRender?: boolean
|
|
44
|
-
camera?: TresCamera
|
|
45
|
-
}
|
|
46
|
-
const stateRef = ref()
|
|
47
|
-
|
|
48
|
-
defineExpose({
|
|
49
|
-
state: stateRef,
|
|
50
|
-
})
|
|
51
|
-
</script>
|
|
52
|
-
|
|
53
|
-
<template>
|
|
54
|
-
<ClientOnly>
|
|
55
|
-
<TC
|
|
56
|
-
ref="stateRef"
|
|
57
|
-
v-bind="$props"
|
|
58
|
-
>
|
|
59
|
-
<slot />
|
|
60
|
-
</TC>
|
|
61
|
-
</ClientOnly>
|
|
62
|
-
</template>
|