@tresjs/core 2.0.0-beta.9 → 2.0.0-rc.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
@@ -1,13 +1,30 @@
1
- # @tresjs/core ▲ ■ ●
1
+ ![repo-banner](/public/repo-banner.png)
2
+
3
+ <p align="center">
4
+ <a href="https://www.npmjs.com/package/@tresjs/core"><img src="https://img.shields.io/npm/v/@tresjs/core/beta?color=%2382DBCA" alt="npm package"></a>
5
+ <a href="https://discord.gg/tfY9aSNT"><img src="https://img.shields.io/badge/chat-discord-purple?style=flat&logo=discord" alt="discord chat"></a>
6
+ </p>
7
+
8
+ # TresJS `@tresjs/core`
2
9
 
3
10
  > Declarative ThreeJS using Vue Components
4
11
 
5
12
  - 💡 Build 3D scene as they were Vue components
6
13
  - ⚡️ Powered by Vite
7
- - 🥰 It brings all the updated features of ThreeJS right awayregardless the version
14
+ - 🥰 It brings all the updated features of ThreeJS right away regardless the version
8
15
  - 🦾 Fully Typed
9
16
 
10
- Tres (Spanish word for "three", pronounced `/tres/` ) is a way of creating ThreeJS scenes with Vue components in a declarative fashion. Think of it as a [React-three-fiber](https://docs.pmnd.rs/react-three-fiber) or [Lunchbox](https://github.com/breakfast-studio/lunchboxjs) but without the need of a [custom Vue3 Renderer](https://vuejs.org/api/custom-renderer.html).
17
+ Tres (Spanish word for "three", pronounced `/tres/` ) is a way of creating ThreeJS scenes with Vue components in a declarative fashion.
18
+
19
+ It's build on-top of a [Vue Custom Renderer](https://vuejs.org/api/custom-renderer.html#createrenderer) and it's powered by Vite.
20
+
21
+ The goal is to provide the Vue's community an easy way of building 3D scenes with Vue, always up to date with the latest ThreeJS features and with 0-to-none mantainance.
22
+
23
+ ## Installation
24
+
25
+ ```bash
26
+ pnpm install @tresjs/core@beta three
27
+ ```
11
28
 
12
29
  ## Docs
13
30
 
@@ -19,10 +36,10 @@ Checkout the [docs](https://tresjs.org)
19
36
 
20
37
  ## Ecosystem
21
38
 
22
- | Package | Version |
23
- | --------------------------- | :------------------------------------------------------------------------------------------------ |
24
- | [Tres](packages/tres) | ![tres version](https://img.shields.io/npm/v/@tresjs/core/alpha.svg?label=%20&color=%2382DBCA) |
25
- | [Cientos](packages/cientos) | ![tres version](https://img.shields.io/npm/v/@tresjs/cientos/alpha.svg?label=%20&color=%23f19b00) |
39
+ | Package | Version |
40
+ | --------------------------- | :----------------------------------------------------------------------------------------------- |
41
+ | [Tres](packages/tres) | ![tres version](https://img.shields.io/npm/v/@tresjs/core/beta.svg?label=%20&color=%2382DBCA) |
42
+ | [Cientos](packages/cientos) | ![tres version](https://img.shields.io/npm/v/@tresjs/cientos/beta.svg?label=%20&color=%23f19b00) |
26
43
 
27
44
  ## Contribution
28
45
 
@@ -1,4 +1,5 @@
1
1
  import { ShadowMapType, TextureEncoding, ToneMapping } from 'three';
2
+ import { CameraType } from '../composables';
2
3
  import { RendererPresetsType } from '../composables/useRenderer/const';
3
4
  export interface TresCanvasProps {
4
5
  shadows?: boolean;
@@ -15,6 +16,7 @@ export interface TresCanvasProps {
15
16
  windowSize?: boolean;
16
17
  preset?: RendererPresetsType;
17
18
  disableRender?: boolean;
19
+ camera?: CameraType;
18
20
  }
19
21
  /**
20
22
  * Vue component for rendering a Tres component.
@@ -1,4 +1,5 @@
1
1
  import { ShadowMapType, TextureEncoding, ToneMapping } from 'three';
2
+ import { CameraType } from '../composables';
2
3
  import { RendererPresetsType } from '../composables/useRenderer/const';
3
4
  export interface TresSceneProps {
4
5
  shadows?: boolean;
@@ -15,6 +16,7 @@ export interface TresSceneProps {
15
16
  windowSize?: boolean;
16
17
  preset?: RendererPresetsType;
17
18
  disableRender?: boolean;
19
+ camera?: CameraType;
18
20
  }
19
21
  export declare const TresScene: import("vue").DefineComponent<TresSceneProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<TresSceneProps>, {}>;
20
22
  export default TresScene;
@@ -1,4 +1,4 @@
1
- import { MaybeComputedRef } from '@vueuse/core';
1
+ import { MaybeRefOrGetter } from '@vueuse/core';
2
2
  import { WebGLRendererParameters, WebGLRenderer, ShadowMapType } from 'three';
3
3
  import type { TextureEncoding, ToneMapping } from 'three';
4
4
  import { TresColor } from '../../types';
@@ -9,7 +9,7 @@ export interface UseRendererOptions extends WebGLRendererParameters {
9
9
  *
10
10
  * @default false
11
11
  */
12
- shadows?: MaybeComputedRef<boolean>;
12
+ shadows?: MaybeRefOrGetter<boolean>;
13
13
  /**
14
14
  * Set the shadow map type
15
15
  * Can be PCFShadowMap, PCFSoftShadowMap, BasicShadowMap, VSMShadowMap
@@ -17,7 +17,7 @@ export interface UseRendererOptions extends WebGLRendererParameters {
17
17
  *
18
18
  * @default PCFSoftShadowMap
19
19
  */
20
- shadowMapType?: MaybeComputedRef<ShadowMapType>;
20
+ shadowMapType?: MaybeRefOrGetter<ShadowMapType>;
21
21
  /**
22
22
  * Whether to use physically correct lighting mode.
23
23
  * See the [lights / physical example](https://threejs.org/examples/#webgl_lights_physical).
@@ -25,34 +25,34 @@ export interface UseRendererOptions extends WebGLRendererParameters {
25
25
  * @default false
26
26
  * @deprecated Use {@link WebGLRenderer.useLegacyLights useLegacyLights} instead.
27
27
  */
28
- physicallyCorrectLights?: MaybeComputedRef<boolean>;
28
+ physicallyCorrectLights?: MaybeRefOrGetter<boolean>;
29
29
  /**
30
30
  * Whether to use legacy lighting mode.
31
31
  *
32
- * @type {MaybeComputedRef<boolean>}
32
+ * @type {MaybeRefOrGetter<boolean>}
33
33
  * @memberof UseRendererOptions
34
34
  */
35
- useLegacyLights?: MaybeComputedRef<boolean>;
35
+ useLegacyLights?: MaybeRefOrGetter<boolean>;
36
36
  /**
37
37
  * Defines the output encoding of the renderer.
38
38
  * Can be LinearEncoding, sRGBEncoding
39
39
  *
40
40
  * @default LinearEncoding
41
41
  */
42
- outputEncoding?: MaybeComputedRef<TextureEncoding>;
42
+ outputEncoding?: MaybeRefOrGetter<TextureEncoding>;
43
43
  /**
44
44
  * Defines the tone mapping used by the renderer.
45
45
  * Can be NoToneMapping, LinearToneMapping, ReinhardToneMapping, Uncharted2ToneMapping, CineonToneMapping, ACESFilmicToneMapping, CustomToneMapping
46
46
  *
47
47
  * @default NoToneMapping
48
48
  */
49
- toneMapping?: MaybeComputedRef<ToneMapping>;
49
+ toneMapping?: MaybeRefOrGetter<ToneMapping>;
50
50
  /**
51
51
  * Defines the tone mapping exposure used by the renderer.
52
52
  *
53
53
  * @default 1
54
54
  */
55
- toneMappingExposure?: MaybeComputedRef<number>;
55
+ toneMappingExposure?: MaybeRefOrGetter<number>;
56
56
  /**
57
57
  * The context used by the renderer.
58
58
  *
@@ -77,8 +77,8 @@ export interface UseRendererOptions extends WebGLRendererParameters {
77
77
  *
78
78
  * @default 0x000000
79
79
  */
80
- clearColor?: MaybeComputedRef<TresColor>;
81
- windowSize?: MaybeComputedRef<boolean | string>;
80
+ clearColor?: MaybeRefOrGetter<TresColor>;
81
+ windowSize?: MaybeRefOrGetter<boolean | string>;
82
82
  preset?: RendererPresetsType;
83
83
  }
84
84
  /**
@@ -95,6 +95,7 @@ export type UseTresReturn = {
95
95
  setState: (key: string, value: any) => void;
96
96
  aspectRatio: ComputedRef<number>;
97
97
  };
98
+ export declare const TRES_CONTEXT_KEY: unique symbol;
98
99
  /**
99
100
  * The Tres state.
100
101
  *
package/dist/tres.js CHANGED
@@ -1,31 +1,31 @@
1
1
  /**
2
2
  * name: @tresjs/core
3
- * version: v2.0.0-beta.9
3
+ * version: v2.0.0-rc.1
4
4
  * (c) 2023
5
5
  * description: Declarative ThreeJS using Vue Components
6
6
  * author: Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)
7
7
  */
8
- import { ref as P, watchEffect as ue, toRef as Se, shallowRef as fe, toRefs as le, computed as de, watch as W, shallowReactive as pe, provide as Oe, inject as ke, onUnmounted as me, createRenderer as je, defineComponent as ve, onMounted as De, h as O } from "vue";
9
- import * as ge from "three";
10
- import { MathUtils as Ie, PerspectiveCamera as H, OrthographicCamera as Be, Clock as he, Color as Y, sRGBEncoding as ze, ACESFilmicToneMapping as Fe, PCFSoftShadowMap as Ge, PCFShadowMap as Ve, LinearEncoding as te, NoToneMapping as ae, WebGLRenderer as Ue, LoadingManager as We, TextureLoader as He, Raycaster as Ye, Vector2 as $e, BufferAttribute as Ne } from "three";
11
- import { createEventHook as q, useRafFn as qe, resolveUnref as f, useWindowSize as Ke, useElementSize as Je, useDevicePixelRatio as Xe, unrefElement as $, isFunction as ne, useEventListener as Qe } from "@vueuse/core";
12
- const we = P({ uuid: Ie.generateUUID() }), be = (e) => void Object.assign(we.value, e);
13
- var Ze = /* @__PURE__ */ ((e) => (e.Perspective = "Perspective", e.Orthographic = "Orthographic", e))(Ze || {});
14
- const et = 45;
8
+ import { ref as R, watchEffect as le, toRef as _e, shallowRef as de, toRefs as me, computed as pe, watch as F, shallowReactive as ve, provide as Se, inject as Oe, onUnmounted as ge, createRenderer as ke, defineComponent as he, onMounted as je, h as k } from "vue";
9
+ import * as we from "three";
10
+ import { MathUtils as De, PerspectiveCamera as $, OrthographicCamera as Ie, Clock as be, Color as N, sRGBEncoding as Be, ACESFilmicToneMapping as ze, PCFSoftShadowMap as Ge, PCFShadowMap as Ve, LinearEncoding as ne, NoToneMapping as re, WebGLRenderer as Fe, LoadingManager as We, TextureLoader as He, Raycaster as Ue, Vector2 as Ye, BufferAttribute as $e } from "three";
11
+ import { createEventHook as J, useRafFn as Ne, toValue as l, useWindowSize as qe, useElementSize as Ke, useDevicePixelRatio as Je, unrefElement as q, useEventListener as Xe } from "@vueuse/core";
12
+ const ye = R({ uuid: De.generateUUID() }), Me = (e) => void Object.assign(ye.value, e);
13
+ var Qe = /* @__PURE__ */ ((e) => (e.Perspective = "Perspective", e.Orthographic = "Orthographic", e))(Qe || {});
14
+ const Ze = 45;
15
15
  let _;
16
- function ye() {
17
- const { state: e, setState: t, aspectRatio: o } = j();
16
+ function xe() {
17
+ const { state: e, setState: t, aspectRatio: o } = S();
18
18
  function a(i = "Perspective", s) {
19
- var l, u, p;
19
+ var u, f, m;
20
20
  if (i === "Perspective") {
21
- const { near: d, far: w, fov: M } = s || {
21
+ const { near: v, far: h, fov: M } = s || {
22
22
  near: 0.1,
23
23
  far: 1e3,
24
- fov: et
24
+ fov: Ze
25
25
  };
26
- _ = new H(M, ((l = e.aspectRatio) == null ? void 0 : l.value) || window.innerWidth / window.innerHeight, d, w), (u = e.cameras) == null || u.push(_);
26
+ _ = new $(M, ((u = e.aspectRatio) == null ? void 0 : u.value) || window.innerWidth / window.innerHeight, v, h), (f = e.cameras) == null || f.push(_);
27
27
  } else {
28
- const { left: d, right: w, top: M, bottom: x, near: L, far: b } = s || {
28
+ const { left: v, right: h, top: M, bottom: w, near: P, far: x } = s || {
29
29
  left: -100,
30
30
  right: 100,
31
31
  top: 100,
@@ -33,177 +33,176 @@ function ye() {
33
33
  near: 0.1,
34
34
  far: 1e3
35
35
  };
36
- _ = new Be(d, w, M, x, L, b), (p = e.cameras) == null || p.push(_);
36
+ _ = new Ie(v, h, M, w, P, x), (m = e.cameras) == null || m.push(_);
37
37
  }
38
38
  return e.camera = _, t("camera", e.camera), _;
39
39
  }
40
40
  function n() {
41
41
  var i;
42
- e.camera instanceof H && e.aspectRatio && (e.camera.aspect = e.aspectRatio.value), (i = e.camera) == null || i.updateProjectionMatrix();
42
+ e.camera instanceof $ && e.aspectRatio && (e.camera.aspect = e.aspectRatio.value), (i = e.camera) == null || i.updateProjectionMatrix();
43
43
  }
44
44
  function r(i) {
45
45
  var s;
46
- (s = e.cameras) == null || s.push(i), i instanceof H && e.aspectRatio && (i.aspect = e.aspectRatio.value), i.updateProjectionMatrix(), t("camera", i);
46
+ (s = e.cameras) == null || s.push(i), i instanceof $ && e.aspectRatio && (i.aspect = e.aspectRatio.value), i.updateProjectionMatrix(), t("camera", i);
47
47
  }
48
48
  function c() {
49
49
  e.cameras = [];
50
50
  }
51
- return ue(() => {
51
+ return le(() => {
52
52
  o != null && o.value && n();
53
53
  }), {
54
- activeCamera: Se(e, "camera"),
54
+ activeCamera: _e(e, "camera"),
55
55
  createCamera: a,
56
56
  updateCamera: n,
57
57
  pushCamera: r,
58
58
  clearCameras: c
59
59
  };
60
60
  }
61
- const Me = q(), xe = q(), K = q(), k = new he();
62
- let G = 0, V = 0;
63
- const { pause: tt, resume: at, isActive: nt } = qe(
61
+ const Ee = J(), Ce = J(), X = J(), j = new be();
62
+ let W = 0, H = 0;
63
+ const { pause: et, resume: tt, isActive: at } = Ne(
64
64
  () => {
65
- Me.trigger({ delta: G, elapsed: V, clock: k }), xe.trigger({ delta: G, elapsed: V, clock: k }), K.trigger({ delta: G, elapsed: V, clock: k });
65
+ Ee.trigger({ delta: W, elapsed: H, clock: j }), Ce.trigger({ delta: W, elapsed: H, clock: j }), X.trigger({ delta: W, elapsed: H, clock: j });
66
66
  },
67
67
  { immediate: !1 }
68
68
  );
69
- K.on(() => {
70
- G = k.getDelta(), V = k.getElapsedTime();
69
+ X.on(() => {
70
+ W = j.getDelta(), H = j.getElapsedTime();
71
71
  });
72
- function Ee() {
72
+ function Re() {
73
73
  return {
74
- onBeforeLoop: Me.on,
75
- onLoop: xe.on,
76
- onAfterLoop: K.on,
77
- pause: tt,
78
- resume: at,
79
- isActive: nt
74
+ onBeforeLoop: Ee.on,
75
+ onLoop: Ce.on,
76
+ onAfterLoop: X.on,
77
+ pause: et,
78
+ resume: tt,
79
+ isActive: at
80
80
  };
81
81
  }
82
- function rt(e) {
83
- return e instanceof Y ? e : Array.isArray(e) ? new Y(...e) : new Y(e);
82
+ function nt(e) {
83
+ return e instanceof N ? e : Array.isArray(e) ? new N(...e) : new N(e);
84
84
  }
85
- const N = {
85
+ const K = {
86
86
  realistic: {
87
- outputEncoding: ze,
88
- toneMapping: Fe,
87
+ outputEncoding: Be,
88
+ toneMapping: ze,
89
89
  toneMappingExposure: 3,
90
90
  shadowMap: {
91
91
  enabled: !0,
92
92
  type: Ge
93
93
  }
94
94
  }
95
- }, Ce = (e, t) => {
95
+ }, Pe = (e, t) => {
96
96
  for (const o of Object.keys(t))
97
- t[o] instanceof Object && Object.assign(t[o], Ce(e[o], t[o]));
97
+ t[o] instanceof Object && Object.assign(t[o], Pe(e[o], t[o]));
98
98
  return Object.assign(e || {}, t), e;
99
- }, ot = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot", it = /* @__PURE__ */ st(ot);
100
- function F(e) {
99
+ }, rt = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot", ot = /* @__PURE__ */ it(rt);
100
+ function V(e) {
101
101
  return e.replace(/-([a-z])/g, (t, o) => o.toUpperCase());
102
102
  }
103
- function st(e, t) {
103
+ function it(e, t) {
104
104
  const o = /* @__PURE__ */ Object.create(null), a = e.split(",");
105
105
  for (let n = 0; n < a.length; n++)
106
106
  o[a[n]] = !0;
107
107
  return t ? (n) => !!o[n.toLowerCase()] : (n) => !!o[n];
108
108
  }
109
- function ct(e) {
110
- var Z, ee;
111
- const t = fe(), o = P(!1), {
109
+ function st(e) {
110
+ var te, ae;
111
+ const t = de(), o = R(!1), {
112
112
  alpha: a = !0,
113
113
  antialias: n = !0,
114
114
  depth: r,
115
115
  logarithmicDepthBuffer: c,
116
116
  failIfMajorPerformanceCaveat: i,
117
117
  precision: s,
118
- premultipliedAlpha: l,
119
- stencil: u,
120
- shadows: p = !1,
121
- shadowMapType: d = Ve,
122
- physicallyCorrectLights: w = !1,
123
- useLegacyLights: M = !1,
124
- outputEncoding: x = te,
125
- toneMapping: L = ae,
126
- toneMappingExposure: b = 1,
127
- context: v = void 0,
128
- powerPreference: E = "default",
129
- preserveDrawingBuffer: y = !1,
130
- clearColor: g,
131
- windowSize: C = !1,
132
- preset: I = void 0
133
- } = le(e), { state: h, setState: T } = j(), { width: S, height: R } = f(C) == !0 || f(C) === "" || f(C) === "true" ? Ke() : Je(h.container), { logError: B, logWarning: z } = D(), { pixelRatio: J } = Xe(), { pause: Le, resume: Te } = Ee(), U = de(() => S.value / R.value);
134
- !f(C) && ((ee = (Z = h.container) == null ? void 0 : Z.value) == null ? void 0 : ee.offsetHeight) === 0 && z(`Oops... Seems like your canvas height is currently 0px, by default it takes the height of it's parent, so make sure it has some height with CSS.
118
+ premultipliedAlpha: u,
119
+ stencil: f,
120
+ shadows: m = !1,
121
+ shadowMapType: v = Ve,
122
+ useLegacyLights: h = !1,
123
+ outputEncoding: M = ne,
124
+ toneMapping: w = re,
125
+ toneMappingExposure: P = 1,
126
+ context: x = void 0,
127
+ powerPreference: U = "default",
128
+ preserveDrawingBuffer: T = !1,
129
+ clearColor: d,
130
+ windowSize: b = !1,
131
+ preset: y = void 0
132
+ } = me(e), { state: g, setState: L } = S(), { width: O, height: E } = l(b) == !0 || l(b) === "" || l(b) === "true" ? qe() : Ke(g.container), { logError: I, logWarning: B } = D(), { pixelRatio: C } = Je(), { pause: z, resume: G } = Re(), Y = pe(() => O.value / E.value);
133
+ !l(b) && ((ae = (te = g.container) == null ? void 0 : te.value) == null ? void 0 : ae.offsetHeight) === 0 && B(`Oops... Seems like your canvas height is currently 0px, by default it takes the height of it's parent, so make sure it has some height with CSS.
135
134
  You could set windowSize=true to force the canvas to be the size of the window.`);
136
- const X = () => {
137
- t.value && (t.value.setSize(S.value, R.value), t.value.setPixelRatio(Math.min(J.value, 2)));
138
- }, Q = () => {
135
+ const Z = () => {
136
+ t.value && (t.value.setSize(O.value, E.value), t.value.setPixelRatio(Math.min(C.value, 2)));
137
+ }, ee = () => {
139
138
  if (!t.value)
140
139
  return;
141
- const A = f(I);
140
+ const A = l(y);
142
141
  if (A) {
143
- A in N || B("Renderer Preset must be one of these: " + Object.keys(N).join(", ")), Ce(t.value, N[A]);
142
+ A in K || I("Renderer Preset must be one of these: " + Object.keys(K).join(", ")), Pe(t.value, K[A]);
144
143
  return;
145
144
  }
146
- t.value.shadowMap.enabled = f(p), t.value.shadowMap.type = f(d), t.value.toneMapping = f(L) || ae, t.value.toneMappingExposure = f(b), t.value.outputEncoding = f(x) || te, g != null && g.value && t.value.setClearColor(rt(f(g))), t.value.useLegacyLights = f(M);
147
- }, Ae = () => {
148
- const A = $(h.canvas);
149
- A && (t.value = new Ue({
145
+ t.value.shadowMap.enabled = l(m), t.value.shadowMap.type = l(v), t.value.toneMapping = l(w) || re, t.value.toneMappingExposure = l(P), t.value.outputEncoding = l(M) || ne, d != null && d.value && t.value.setClearColor(nt(l(d))), t.value.useLegacyLights = l(h);
146
+ }, Le = () => {
147
+ const A = q(g.canvas);
148
+ A && (t.value = new Fe({
150
149
  canvas: A,
151
- alpha: f(a),
152
- antialias: f(n),
153
- context: f(v),
154
- depth: f(r),
155
- failIfMajorPerformanceCaveat: f(i),
156
- logarithmicDepthBuffer: f(c),
157
- powerPreference: f(E),
158
- precision: f(s),
159
- stencil: f(u),
160
- preserveDrawingBuffer: f(y),
161
- premultipliedAlpha: f(l)
162
- }), T("renderer", t.value), T("clock", new he()), T("aspectRatio", U), Q(), X(), Te(), o.value = !0);
163
- }, _e = () => {
164
- t.value && (t.value.dispose(), t.value = void 0, o.value = !1, Le());
150
+ alpha: l(a),
151
+ antialias: l(n),
152
+ context: l(x),
153
+ depth: l(r),
154
+ failIfMajorPerformanceCaveat: l(i),
155
+ logarithmicDepthBuffer: l(c),
156
+ powerPreference: l(U),
157
+ precision: l(s),
158
+ stencil: l(f),
159
+ preserveDrawingBuffer: l(T),
160
+ premultipliedAlpha: l(u)
161
+ }), L("renderer", t.value), L("clock", new be()), L("aspectRatio", Y), ee(), Z(), G(), o.value = !0);
162
+ }, Ae = () => {
163
+ t.value && (t.value.dispose(), t.value = void 0, o.value = !1, z());
165
164
  };
166
- return W([U, J], X), W(
167
- [p, d, x, M, L, b, g],
168
- Q
169
- ), W(
170
- () => [h.canvas, h.container],
165
+ return F([Y, C], Z), F(
166
+ [m, v, M, h, w, P, d],
167
+ ee
168
+ ), F(
169
+ () => [g.canvas, g.container],
171
170
  () => {
172
- $(h.canvas) && $(h.container) && Ae();
171
+ q(g.canvas) && q(g.container) && Le();
173
172
  },
174
173
  { immediate: !0, deep: !0 }
175
174
  ), {
176
175
  renderer: t,
177
176
  isReady: o,
178
- dispose: _e,
179
- aspectRatio: U
177
+ dispose: Ae,
178
+ aspectRatio: Y
180
179
  };
181
180
  }
182
- const ut = (e) => typeof e == "string", Re = (e) => !!e && e.constructor === Array;
183
- function ft(e) {
181
+ const oe = (e) => typeof e == "function", ct = (e) => typeof e == "string", Te = (e) => !!e && e.constructor === Array;
182
+ function ut(e) {
184
183
  const t = { nodes: {}, materials: {} };
185
184
  return e && e.traverse((o) => {
186
185
  o.name && (t.nodes[o.name] = o), o.material && !t.materials[o.material.name] && (t.materials[o.material.name] = o.material);
187
186
  }), t;
188
187
  }
189
- async function Ct(e, t, o, a, n) {
188
+ async function Et(e, t, o, a, n) {
190
189
  const { logError: r } = D(), c = new e();
191
190
  n && n(c), o && o(c);
192
191
  const s = (Array.isArray(t) ? t : [t]).map(
193
- (l) => new Promise((u, p) => {
192
+ (u) => new Promise((f, m) => {
194
193
  c.load(
195
- l,
196
- (d) => {
197
- d.scene && Object.assign(d, ft(d.scene)), u(d);
194
+ u,
195
+ (v) => {
196
+ v.scene && Object.assign(v, ut(v.scene)), f(v);
198
197
  },
199
198
  a,
200
- (d) => p(r("[useLoader] - Failed to load resource", d))
199
+ (v) => m(r("[useLoader] - Failed to load resource", v))
201
200
  );
202
201
  })
203
202
  );
204
- return Re(t) ? await Promise.all(s) : await s[0];
203
+ return Te(t) ? await Promise.all(s) : await s[0];
205
204
  }
206
- async function Rt(e) {
205
+ async function Ct(e) {
207
206
  const t = new We(), o = new He(t), a = (n) => new Promise((r, c) => {
208
207
  o.load(
209
208
  n,
@@ -214,7 +213,7 @@ async function Rt(e) {
214
213
  }
215
214
  );
216
215
  });
217
- if (Re(e)) {
216
+ if (Te(e)) {
218
217
  const n = await Promise.all(e.map((r) => a(r)));
219
218
  return e.length > 1 ? n : n[0];
220
219
  } else {
@@ -224,9 +223,9 @@ async function Rt(e) {
224
223
  normalMap: c,
225
224
  roughnessMap: i,
226
225
  metalnessMap: s,
227
- aoMap: l,
228
- alphaMap: u,
229
- matcap: p
226
+ aoMap: u,
227
+ alphaMap: f,
228
+ matcap: m
230
229
  } = e;
231
230
  return {
232
231
  map: n ? await a(n) : null,
@@ -234,26 +233,26 @@ async function Rt(e) {
234
233
  normalMap: c ? await a(c) : null,
235
234
  roughnessMap: i ? await a(i) : null,
236
235
  metalnessMap: s ? await a(s) : null,
237
- aoMap: l ? await a(l) : null,
238
- alphaMap: u ? await a(u) : null,
239
- matcap: p ? await a(p) : null
236
+ aoMap: u ? await a(u) : null,
237
+ alphaMap: f ? await a(f) : null,
238
+ matcap: m ? await a(m) : null
240
239
  };
241
240
  }
242
241
  }
243
- const m = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "0a", "0b", "0c", "0d", "0e", "0f", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1a", "1b", "1c", "1d", "1e", "1f", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "2a", "2b", "2c", "2d", "2e", "2f", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "3a", "3b", "3c", "3d", "3e", "3f", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "4a", "4b", "4c", "4d", "4e", "4f", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "5a", "5b", "5c", "5d", "5e", "5f", "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "6a", "6b", "6c", "6d", "6e", "6f", "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "7a", "7b", "7c", "7d", "7e", "7f", "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "8a", "8b", "8c", "8d", "8e", "8f", "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", "9a", "9b", "9c", "9d", "9e", "9f", "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "aa", "ab", "ac", "ad", "ae", "af", "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8", "b9", "ba", "bb", "bc", "bd", "be", "bf", "c0", "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "ca", "cb", "cc", "cd", "ce", "cf", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "da", "db", "dc", "dd", "de", "df", "e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7", "e8", "e9", "ea", "eb", "ec", "ed", "ee", "ef", "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "fa", "fb", "fc", "fd", "fe", "ff"];
244
- function lt() {
242
+ const p = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "0a", "0b", "0c", "0d", "0e", "0f", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1a", "1b", "1c", "1d", "1e", "1f", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "2a", "2b", "2c", "2d", "2e", "2f", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "3a", "3b", "3c", "3d", "3e", "3f", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "4a", "4b", "4c", "4d", "4e", "4f", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "5a", "5b", "5c", "5d", "5e", "5f", "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "6a", "6b", "6c", "6d", "6e", "6f", "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "7a", "7b", "7c", "7d", "7e", "7f", "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "8a", "8b", "8c", "8d", "8e", "8f", "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", "9a", "9b", "9c", "9d", "9e", "9f", "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "aa", "ab", "ac", "ad", "ae", "af", "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8", "b9", "ba", "bb", "bc", "bd", "be", "bf", "c0", "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "ca", "cb", "cc", "cd", "ce", "cf", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "da", "db", "dc", "dd", "de", "df", "e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7", "e8", "e9", "ea", "eb", "ec", "ed", "ee", "ef", "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "fa", "fb", "fc", "fd", "fe", "ff"];
243
+ function ft() {
245
244
  const e = Math.random() * 4294967295 | 0, t = Math.random() * 4294967295 | 0, o = Math.random() * 4294967295 | 0, a = Math.random() * 4294967295 | 0;
246
- return (m[e & 255] + m[e >> 8 & 255] + m[e >> 16 & 255] + m[e >> 24 & 255] + "-" + m[t & 255] + m[t >> 8 & 255] + "-" + m[t >> 16 & 15 | 64] + m[t >> 24 & 255] + "-" + m[o & 63 | 128] + m[o >> 8 & 255] + "-" + m[o >> 16 & 255] + m[o >> 24 & 255] + m[a & 255] + m[a >> 8 & 255] + m[a >> 16 & 255] + m[a >> 24 & 255]).toLowerCase();
245
+ return (p[e & 255] + p[e >> 8 & 255] + p[e >> 16 & 255] + p[e >> 24 & 255] + "-" + p[t & 255] + p[t >> 8 & 255] + "-" + p[t >> 16 & 15 | 64] + p[t >> 24 & 255] + "-" + p[o & 63 | 128] + p[o >> 8 & 255] + "-" + p[o >> 16 & 255] + p[o >> 24 & 255] + p[a & 255] + p[a >> 8 & 255] + p[a >> 16 & 255] + p[a >> 24 & 255]).toLowerCase();
247
246
  }
248
- const Pe = Symbol();
249
- function dt() {
250
- const e = pe({
251
- uuid: lt(),
247
+ const Q = Symbol();
248
+ function lt() {
249
+ const e = ve({
250
+ uuid: ft(),
252
251
  camera: void 0,
253
252
  cameras: [],
254
253
  scene: void 0,
255
254
  renderer: void 0,
256
- aspectRatio: de(() => window.innerWidth / window.innerHeight)
255
+ aspectRatio: pe(() => window.innerWidth / window.innerHeight)
257
256
  });
258
257
  function t(n) {
259
258
  return e[n];
@@ -263,28 +262,28 @@ function dt() {
263
262
  }
264
263
  const a = {
265
264
  state: e,
266
- ...le(e),
265
+ ...me(e),
267
266
  getState: t,
268
267
  setState: o
269
268
  };
270
- return Oe(Pe, a), a;
269
+ return Se(Q, a), a;
271
270
  }
272
- const j = () => ke(Pe, {
273
- state: pe({
271
+ const S = () => Oe(Q, {
272
+ state: ve({
274
273
  camera: void 0,
275
274
  cameras: [],
276
275
  scene: void 0,
277
276
  renderer: void 0
278
277
  })
279
278
  });
280
- function pt() {
279
+ function dt() {
281
280
  var c;
282
- const e = fe(new Ye()), t = P(new $e()), o = P(null), { setState: a, state: n } = j();
281
+ const e = de(new Ue()), t = R(new Ye()), o = R(null), { setState: a, state: n } = S();
283
282
  a("raycaster", e.value), a("pointer", t), a("currentInstance", o);
284
283
  function r(i) {
285
284
  t.value.x = i.clientX / window.innerWidth * 2 - 1, t.value.y = -(i.clientY / window.innerHeight) * 2 + 1;
286
285
  }
287
- return (c = n == null ? void 0 : n.renderer) == null || c.domElement.addEventListener("pointermove", r), me(() => {
286
+ return (c = n == null ? void 0 : n.renderer) == null || c.domElement.addEventListener("pointermove", r), ge(() => {
288
287
  var i;
289
288
  (i = n == null ? void 0 : n.renderer) == null || i.domElement.removeEventListener("pointermove", r);
290
289
  }), {
@@ -292,13 +291,13 @@ function pt() {
292
291
  pointer: t
293
292
  };
294
293
  }
295
- const Pt = !0, re = "[TresJS ▲ ■ ●] ";
294
+ const Rt = !0, ie = "[TresJS ▲ ■ ●] ";
296
295
  function D() {
297
296
  function e(a, n) {
298
- console.error(`${re} ${a}`, n || "");
297
+ console.error(`${ie} ${a}`, n || "");
299
298
  }
300
299
  function t(a) {
301
- console.warn(`${re} ${a}`);
300
+ console.warn(`${ie} ${a}`);
302
301
  }
303
302
  function o(a, n) {
304
303
  }
@@ -308,7 +307,7 @@ function D() {
308
307
  logMessage: o
309
308
  };
310
309
  }
311
- function Lt() {
310
+ function Pt() {
312
311
  const { logWarning: e } = D();
313
312
  function t(a, n, r) {
314
313
  let c = null;
@@ -324,50 +323,50 @@ function Lt() {
324
323
  seekByName: o
325
324
  };
326
325
  }
327
- const mt = /^on[^a-z]/, vt = (e) => mt.test(e);
328
- let oe = null;
329
- const ie = {
326
+ const mt = /^on[^a-z]/, pt = (e) => mt.test(e);
327
+ let se = null;
328
+ const ce = {
330
329
  GEOMETRY_VIA_PROP: "tres__geometryViaProp",
331
330
  MATERIAL_VIA_PROP: "tres__materialViaProp"
332
- }, { logError: se } = D(), gt = {
331
+ }, { logError: ue } = D(), vt = {
333
332
  createElement(e, t, o, a) {
334
- var s, l;
335
- if (a || (a = {}), a.args || (a.args = []), e === "template" || it(e))
333
+ var s, u;
334
+ if (a || (a = {}), a.args || (a.args = []), e === "template" || ot(e))
336
335
  return null;
337
336
  let n = e.replace("Tres", ""), r;
338
337
  if (e === "primitive") {
339
- (a == null ? void 0 : a.object) === void 0 && se("Tres primitives need a prop 'object'");
340
- const u = a.object;
341
- n = u.type, r = Object.assign(u, { type: n, attach: a.attach, primitive: !0 });
338
+ (a == null ? void 0 : a.object) === void 0 && ue("Tres primitives need a prop 'object'");
339
+ const f = a.object;
340
+ n = f.type, r = Object.assign(f, { type: n, attach: a.attach, primitive: !0 });
342
341
  } else {
343
- const u = we.value[n];
344
- u || se(`${n} is not defined on the THREE namespace. Use extend to add it to the catalog.`), r = new u(...a.args);
342
+ const f = ye.value[n];
343
+ f || ue(`${n} is not defined on the THREE namespace. Use extend to add it to the catalog.`), r = new f(...a.args);
345
344
  }
346
345
  if (r.isCamera) {
347
346
  a != null && a.position || r.position.set(3, 3, 3), a != null && a.lookAt || r.lookAt(0, 0, 0);
348
- const { pushCamera: u } = ye();
349
- u(r);
347
+ const { pushCamera: f } = xe();
348
+ f(r);
350
349
  }
351
350
  (a == null ? void 0 : a.attach) === void 0 && (r.isMaterial ? r.attach = "material" : r.isBufferGeometry && (r.attach = "geometry"));
352
- const { GEOMETRY_VIA_PROP: c, MATERIAL_VIA_PROP: i } = ie;
353
- return r.isObject3D && ((s = a == null ? void 0 : a.material) != null && s.isMaterial && (r.userData[i] = !0), (l = a == null ? void 0 : a.geometry) != null && l.isBufferGeometry && (r.userData[c] = !0)), r.events = {}, r;
351
+ const { GEOMETRY_VIA_PROP: c, MATERIAL_VIA_PROP: i } = ce;
352
+ return r.isObject3D && ((s = a == null ? void 0 : a.material) != null && s.isMaterial && (r.userData[i] = !0), (u = a == null ? void 0 : a.geometry) != null && u.isBufferGeometry && (r.userData[c] = !0)), r.events = {}, r;
354
353
  },
355
354
  insert(e, t) {
356
- var o, a;
357
- if (((e == null ? void 0 : e.__vnode.type) === "TresGroup" || (e == null ? void 0 : e.__vnode.type) === "TresObject3D") && t === null && !((a = (o = e == null ? void 0 : e.__vnode) == null ? void 0 : o.ctx) != null && a.asyncResolved)) {
358
- oe = e;
355
+ var o, a, n, r;
356
+ if ((((o = e == null ? void 0 : e.__vnode) == null ? void 0 : o.type) === "TresGroup" || ((a = e == null ? void 0 : e.__vnode) == null ? void 0 : a.type) === "TresObject3D") && t === null && !((r = (n = e == null ? void 0 : e.__vnode) == null ? void 0 : n.ctx) != null && r.asyncResolved)) {
357
+ se = e;
359
358
  return;
360
359
  }
361
- t || (t = oe), e != null && e.isObject3D && (t != null && t.isObject3D) ? (t.add(e), e.dispatchEvent({ type: "added" })) : typeof (e == null ? void 0 : e.attach) == "string" && (e.__previousAttach = e[t == null ? void 0 : t.attach], t && (t[e.attach] = e));
360
+ t || (t = se), e != null && e.isObject3D && (t != null && t.isObject3D) ? (t.add(e), e.dispatchEvent({ type: "added" })) : typeof (e == null ? void 0 : e.attach) == "string" && (e.__previousAttach = e[t == null ? void 0 : t.attach], t && (t[e.attach] = e));
362
361
  },
363
362
  remove(e) {
364
363
  var t, o;
365
364
  if (e) {
366
365
  if (e.isObject3D) {
367
366
  const a = e, n = (r) => {
368
- var s, l;
369
- const { GEOMETRY_VIA_PROP: c, MATERIAL_VIA_PROP: i } = ie;
370
- r.userData[i] || (s = r.material) == null || s.dispose(), r.userData[c] || (l = r.geometry) == null || l.dispose();
367
+ var s, u;
368
+ const { GEOMETRY_VIA_PROP: c, MATERIAL_VIA_PROP: i } = ce;
369
+ r.userData[i] || (s = r.material) == null || s.dispose(), r.userData[c] || (u = r.geometry) == null || u.dispose();
371
370
  };
372
371
  a.traverse((r) => n(r)), n(a);
373
372
  }
@@ -376,25 +375,27 @@ const ie = {
376
375
  },
377
376
  patchProp(e, t, o, a) {
378
377
  if (e) {
379
- let n = e, r = t, c = F(r), i = n == null ? void 0 : n[c];
378
+ let n = e, r = t, c = V(r), i = n == null ? void 0 : n[c];
380
379
  if (n.type === "BufferGeometry") {
380
+ if (r === "args")
381
+ return;
381
382
  n.setAttribute(
382
- F(r),
383
- new Ne(...a)
383
+ V(r),
384
+ new $e(...a)
384
385
  );
385
386
  return;
386
387
  }
387
388
  if (r.includes("-") && i === void 0) {
388
- const l = r.split("-");
389
- i = l.reduce((u, p) => u[F(p)], n), r = l.pop(), c = r.toLowerCase(), i != null && i.set || (n = l.reduce((u, p) => u[F(p)], n));
389
+ const u = r.split("-");
390
+ i = u.reduce((f, m) => f[V(m)], n), r = u.pop(), c = r.toLowerCase(), i != null && i.set || (n = u.reduce((f, m) => f[V(m)], n));
390
391
  }
391
- vt(r) && (e.events[r] = a);
392
+ pt(r) && (e.events[r] = a);
392
393
  let s = a;
393
- if (s === "" && (s = !0), ne(i)) {
394
+ if (s === "" && (s = !0), oe(i)) {
394
395
  Array.isArray(s) ? e[c](...s) : e[c](s);
395
396
  return;
396
397
  }
397
- !(i != null && i.set) && !ne(i) ? n[c] = s : i.constructor === s.constructor && (i != null && i.copy) ? i == null || i.copy(s) : Array.isArray(s) ? i.set(...s) : !i.isColor && i.setScalar ? i.setScalar(s) : i.set(s);
398
+ !(i != null && i.set) && !oe(i) ? n[c] = s : i.constructor === s.constructor && (i != null && i.copy) ? i == null || i.copy(s) : Array.isArray(s) ? i.set(...s) : !i.isColor && i.setScalar ? i.setScalar(s) : i.set(s);
398
399
  }
399
400
  },
400
401
  parentNode(e) {
@@ -409,15 +410,15 @@ const ie = {
409
410
  setScopeId: () => void 0,
410
411
  cloneNode: () => void 0,
411
412
  insertStaticContent: () => void 0
412
- }, { createApp: ht } = je(gt), wt = (e) => {
413
- const t = ht(o);
413
+ }, { createApp: gt } = ke(vt), ht = (e) => {
414
+ const t = gt(o);
414
415
  function o() {
415
416
  return e && e.default ? e.default() : [];
416
417
  }
417
418
  return t;
418
419
  };
419
- be(ge);
420
- const { logWarning: ce } = D(), bt = ve({
420
+ Me(we);
421
+ const { logWarning: fe } = D(), wt = he({
421
422
  name: "TresScene",
422
423
  props: [
423
424
  "shadows",
@@ -433,42 +434,51 @@ const { logWarning: ce } = D(), bt = ve({
433
434
  "clearColor",
434
435
  "windowSize",
435
436
  "preset",
436
- "disableRender"
437
+ "disableRender",
438
+ "camera"
437
439
  ],
438
440
  setup(e, { slots: t, expose: o }) {
439
- e.physicallyCorrectLights === !0 && ce("physicallyCorrectLights is deprecated, useLegacyLights is now false by default");
440
- const a = P(), n = P(), r = new ge.Scene(), { setState: c } = j();
441
+ e.physicallyCorrectLights === !0 && fe("physicallyCorrectLights is deprecated, useLegacyLights is now false by default");
442
+ const a = R(), n = R(), r = new we.Scene(), { setState: c } = S();
441
443
  c("scene", r), c("canvas", n), c("container", a);
442
- const i = P(), s = t && t.default && t.default();
443
- (s == null ? void 0 : s.length) > 0 && (i.value = s.some((d) => ut(d.type) && d.type.includes("Camera")), i.value || ce("No camera found in the scene, please add one!")), De(() => {
444
- l();
445
- }), me(() => {
444
+ const i = R(), s = t && t.default && t.default();
445
+ s && (s == null ? void 0 : s.length) > 0 && (i.value = s.some((w) => ct(w.type) && w.type.includes("Camera")) || e.camera, i.value || fe("No camera found in the scene, please add one!")), je(() => {
446
+ v();
447
+ }), ge(() => {
446
448
  c("renderer", null);
447
449
  });
448
- function l() {
449
- const { renderer: d } = ct(e), { activeCamera: w } = ye(), { onLoop: M } = Ee(), { raycaster: x, pointer: L } = pt();
450
- let b = null, v = null;
451
- ue(() => {
452
- w.value && x.value.setFromCamera(L.value, w.value);
453
- }), M(() => {
454
- var E, y, g, C, I, h, T, S, R, B;
455
- if (w.value && e.disableRender !== !0 && e.disableRender !== "" && ((E = d.value) == null || E.render(r, w.value)), x.value) {
456
- const z = x.value.intersectObjects(r.children);
457
- z.length > 0 ? (v = z[0], b === null && ((C = (g = (y = v.object) == null ? void 0 : y.events) == null ? void 0 : g.onPointerEnter) == null || C.call(g, v)), (T = (h = (I = v.object) == null ? void 0 : I.events) == null ? void 0 : h.onPointerMove) == null || T.call(h, v)) : b !== null && ((B = (R = (S = v == null ? void 0 : v.object) == null ? void 0 : S.events) == null ? void 0 : R.onPointerLeave) == null || B.call(R, b), v = null), b = v;
450
+ const { activeCamera: u, pushCamera: f, clearCameras: m } = xe();
451
+ function v() {
452
+ const { renderer: w } = st(e);
453
+ e.camera && f(e.camera);
454
+ const { onLoop: P } = Re(), { raycaster: x, pointer: U } = dt();
455
+ let T = null, d = null;
456
+ le(() => {
457
+ u.value && x.value.setFromCamera(U.value, u.value);
458
+ }), P(() => {
459
+ var b, y, g, L, O, E, I, B, C, z;
460
+ if (u.value && e.disableRender !== !0 && e.disableRender !== "" && ((b = w.value) == null || b.render(r, u.value)), x.value) {
461
+ const G = x.value.intersectObjects(r.children);
462
+ G.length > 0 ? (d = G[0], T === null && ((L = (g = (y = d.object) == null ? void 0 : y.events) == null ? void 0 : g.onPointerEnter) == null || L.call(g, d)), (I = (E = (O = d.object) == null ? void 0 : O.events) == null ? void 0 : E.onPointerMove) == null || I.call(E, d)) : T !== null && ((z = (C = (B = d == null ? void 0 : d.object) == null ? void 0 : B.events) == null ? void 0 : C.onPointerLeave) == null || z.call(C, T), d = null), T = d;
458
463
  }
459
- }), Qe(n.value, "click", () => {
460
- var E, y, g;
461
- v !== null && ((g = (y = (E = v.object) == null ? void 0 : E.events) == null ? void 0 : y.onClick) == null || g.call(y, v));
464
+ }), Xe(n.value, "click", () => {
465
+ var b, y, g;
466
+ d !== null && ((g = (y = (b = d.object) == null ? void 0 : b.events) == null ? void 0 : y.onClick) == null || g.call(y, d));
462
467
  });
463
468
  }
464
- let u;
465
- function p() {
466
- u = wt(t), u.provide("useTres", j()), u.provide("extend", be), u.mount(r);
469
+ let h;
470
+ function M() {
471
+ h = ht(t), h.provide("useTres", S()), h.provide(Q, S()), h.provide("extend", Me), h.mount(r);
467
472
  }
468
- return p(), o({
473
+ return M(), o({
469
474
  scene: r
470
- }), () => O(
471
- O(
475
+ }), F(
476
+ () => e.camera,
477
+ (w) => {
478
+ w && (m(), f(w));
479
+ }
480
+ ), () => k(
481
+ k(
472
482
  "div",
473
483
  {
474
484
  ref: a,
@@ -483,7 +493,7 @@ const { logWarning: ce } = D(), bt = ve({
483
493
  }
484
494
  },
485
495
  [
486
- O(
496
+ k(
487
497
  "div",
488
498
  {
489
499
  style: {
@@ -492,7 +502,7 @@ const { logWarning: ce } = D(), bt = ve({
492
502
  }
493
503
  },
494
504
  [
495
- O("canvas", {
505
+ k("canvas", {
496
506
  ref: n,
497
507
  "data-scene": r.uuid,
498
508
  style: {
@@ -510,7 +520,7 @@ const { logWarning: ce } = D(), bt = ve({
510
520
  )
511
521
  );
512
522
  }
513
- }), yt = ve({
523
+ }), bt = he({
514
524
  name: "TresCanvas",
515
525
  props: [
516
526
  "shadows",
@@ -526,33 +536,35 @@ const { logWarning: ce } = D(), bt = ve({
526
536
  "clearColor",
527
537
  "windowSize",
528
538
  "preset",
529
- "disableRender"
539
+ "disableRender",
540
+ "camera"
530
541
  ],
531
542
  setup(e, { slots: t, expose: o }) {
532
- const a = dt();
533
- return o(a), () => O(bt, e, t);
543
+ const a = lt();
544
+ return o(a), () => k(wt, e, t);
534
545
  }
535
546
  }), Tt = {
536
547
  install(e) {
537
- e.component("TresCanvas", yt);
548
+ e.component("TresCanvas", bt);
538
549
  }
539
550
  };
540
551
  export {
541
- Ze as CameraType,
542
- yt as TresCanvas,
543
- we as catalogue,
552
+ Qe as CameraType,
553
+ Q as TRES_CONTEXT_KEY,
554
+ bt as TresCanvas,
555
+ ye as catalogue,
544
556
  Tt as default,
545
- be as extend,
546
- Pt as isProd,
547
- ft as trasverseObjects,
548
- ye as useCamera,
549
- Ct as useLoader,
557
+ Me as extend,
558
+ Rt as isProd,
559
+ ut as trasverseObjects,
560
+ xe as useCamera,
561
+ Et as useLoader,
550
562
  D as useLogger,
551
- pt as useRaycaster,
552
- Ee as useRenderLoop,
553
- ct as useRenderer,
554
- Lt as useSeek,
555
- Rt as useTexture,
556
- j as useTres,
557
- dt as useTresProvider
563
+ dt as useRaycaster,
564
+ Re as useRenderLoop,
565
+ st as useRenderer,
566
+ Pt as useSeek,
567
+ Ct as useTexture,
568
+ S as useTres,
569
+ lt as useTresProvider
558
570
  };
package/dist/tres.umd.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * name: @tresjs/core
3
- * version: v2.0.0-beta.9
3
+ * version: v2.0.0-rc.1
4
4
  * (c) 2023
5
5
  * description: Declarative ThreeJS using Vue Components
6
6
  * author: Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)
7
7
  */
8
- (function(d,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("vue"),require("three"),require("@vueuse/core")):typeof define=="function"&&define.amd?define(["exports","vue","three","@vueuse/core"],s):(d=typeof globalThis<"u"?globalThis:d||self,s(d.tres={},d.Vue,d.Three,d.VueUseCore))})(this,function(d,s,m,f){"use strict";function be(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const X=be(m),W=s.ref({uuid:m.MathUtils.generateUUID()}),N=e=>void Object.assign(W.value,e);var Q=(e=>(e.Perspective="Perspective",e.Orthographic="Orthographic",e))(Q||{});const we=45;let O;function Y(){const{state:e,setState:t,aspectRatio:r}=T();function n(i="Perspective",c){var p,u,h;if(i==="Perspective"){const{near:v,far:M,fov:L}=c||{near:.1,far:1e3,fov:we};O=new m.PerspectiveCamera(L,((p=e.aspectRatio)==null?void 0:p.value)||window.innerWidth/window.innerHeight,v,M),(u=e.cameras)==null||u.push(O)}else{const{left:v,right:M,top:L,bottom:_,near:k,far:C}=c||{left:-100,right:100,top:100,bottom:-100,near:.1,far:1e3};O=new m.OrthographicCamera(v,M,L,_,k,C),(h=e.cameras)==null||h.push(O)}return e.camera=O,t("camera",e.camera),O}function a(){var i;e.camera instanceof m.PerspectiveCamera&&e.aspectRatio&&(e.camera.aspect=e.aspectRatio.value),(i=e.camera)==null||i.updateProjectionMatrix()}function o(i){var c;(c=e.cameras)==null||c.push(i),i instanceof m.PerspectiveCamera&&e.aspectRatio&&(i.aspect=e.aspectRatio.value),i.updateProjectionMatrix(),t("camera",i)}function l(){e.cameras=[]}return s.watchEffect(()=>{r!=null&&r.value&&a()}),{activeCamera:s.toRef(e,"camera"),createCamera:n,updateCamera:a,pushCamera:o,clearCameras:l}}const Z=f.createEventHook(),H=f.createEventHook(),$=f.createEventHook(),D=new m.Clock;let B=0,z=0;const{pause:ye,resume:Me,isActive:Ce}=f.useRafFn(()=>{Z.trigger({delta:B,elapsed:z,clock:D}),H.trigger({delta:B,elapsed:z,clock:D}),$.trigger({delta:B,elapsed:z,clock:D})},{immediate:!1});$.on(()=>{B=D.getDelta(),z=D.getElapsedTime()});function q(){return{onBeforeLoop:Z.on,onLoop:H.on,onAfterLoop:$.on,pause:ye,resume:Me,isActive:Ce}}function Pe(e){return e instanceof m.Color?e:Array.isArray(e)?new m.Color(...e):new m.Color(e)}const K={realistic:{outputEncoding:m.sRGBEncoding,toneMapping:m.ACESFilmicToneMapping,toneMappingExposure:3,shadowMap:{enabled:!0,type:m.PCFSoftShadowMap}}},ee=(e,t)=>{for(const r of Object.keys(t))t[r]instanceof Object&&Object.assign(t[r],ee(e[r],t[r]));return Object.assign(e||{},t),e},Le=_e("html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot");function E(e){return e.replace(/-([a-z])/g,(t,r)=>r.toUpperCase())}function _e(e,t){const r=Object.create(null),n=e.split(",");for(let a=0;a<n.length;a++)r[n[a]]=!0;return t?a=>!!r[a.toLowerCase()]:a=>!!r[a]}function te(e){var ge,he;const t=s.shallowRef(),r=s.ref(!1),{alpha:n=!0,antialias:a=!0,depth:o,logarithmicDepthBuffer:l,failIfMajorPerformanceCaveat:i,precision:c,premultipliedAlpha:p,stencil:u,shadows:h=!1,shadowMapType:v=m.PCFShadowMap,physicallyCorrectLights:M=!1,useLegacyLights:L=!1,outputEncoding:_=m.LinearEncoding,toneMapping:k=m.NoToneMapping,toneMappingExposure:C=1,context:b=void 0,powerPreference:S="default",preserveDrawingBuffer:P=!1,clearColor:w,windowSize:x=!1,preset:F=void 0}=s.toRefs(e),{state:y,setState:R}=T(),{width:I,height:A}=f.resolveUnref(x)==!0||f.resolveUnref(x)===""||f.resolveUnref(x)==="true"?f.useWindowSize():f.useElementSize(y.container),{logError:G,logWarning:V}=U(),{pixelRatio:me}=f.useDevicePixelRatio(),{pause:Ee,resume:Fe}=q(),J=s.computed(()=>I.value/A.value);!f.resolveUnref(x)&&((he=(ge=y.container)==null?void 0:ge.value)==null?void 0:he.offsetHeight)===0&&V(`Oops... Seems like your canvas height is currently 0px, by default it takes the height of it's parent, so make sure it has some height with CSS.
9
- You could set windowSize=true to force the canvas to be the size of the window.`);const pe=()=>{t.value&&(t.value.setSize(I.value,A.value),t.value.setPixelRatio(Math.min(me.value,2)))},ve=()=>{if(!t.value)return;const j=f.resolveUnref(F);if(j){j in K||G("Renderer Preset must be one of these: "+Object.keys(K).join(", ")),ee(t.value,K[j]);return}t.value.shadowMap.enabled=f.resolveUnref(h),t.value.shadowMap.type=f.resolveUnref(v),t.value.toneMapping=f.resolveUnref(k)||m.NoToneMapping,t.value.toneMappingExposure=f.resolveUnref(C),t.value.outputEncoding=f.resolveUnref(_)||m.LinearEncoding,w!=null&&w.value&&t.value.setClearColor(Pe(f.resolveUnref(w))),t.value.useLegacyLights=f.resolveUnref(L)},Ge=()=>{const j=f.unrefElement(y.canvas);j&&(t.value=new m.WebGLRenderer({canvas:j,alpha:f.resolveUnref(n),antialias:f.resolveUnref(a),context:f.resolveUnref(b),depth:f.resolveUnref(o),failIfMajorPerformanceCaveat:f.resolveUnref(i),logarithmicDepthBuffer:f.resolveUnref(l),powerPreference:f.resolveUnref(S),precision:f.resolveUnref(c),stencil:f.resolveUnref(u),preserveDrawingBuffer:f.resolveUnref(P),premultipliedAlpha:f.resolveUnref(p)}),R("renderer",t.value),R("clock",new m.Clock),R("aspectRatio",J),ve(),pe(),Fe(),r.value=!0)},Ve=()=>{t.value&&(t.value.dispose(),t.value=void 0,r.value=!1,Ee())};return s.watch([J,me],pe),s.watch([h,v,_,L,k,C,w],ve),s.watch(()=>[y.canvas,y.container],()=>{f.unrefElement(y.canvas)&&f.unrefElement(y.container)&&Ge()},{immediate:!0,deep:!0}),{renderer:t,isReady:r,dispose:Ve,aspectRatio:J}}const Se=e=>typeof e=="string",ne=e=>!!e&&e.constructor===Array;function ae(e){const t={nodes:{},materials:{}};return e&&e.traverse(r=>{r.name&&(t.nodes[r.name]=r),r.material&&!t.materials[r.material.name]&&(t.materials[r.material.name]=r.material)}),t}async function xe(e,t,r,n,a){const{logError:o}=U(),l=new e;a&&a(l),r&&r(l);const c=(Array.isArray(t)?t:[t]).map(p=>new Promise((u,h)=>{l.load(p,v=>{v.scene&&Object.assign(v,ae(v.scene)),u(v)},n,v=>h(o("[useLoader] - Failed to load resource",v)))}));return ne(t)?await Promise.all(c):await c[0]}async function Ae(e){const t=new m.LoadingManager,r=new m.TextureLoader(t),n=a=>new Promise((o,l)=>{r.load(a,i=>o(i),()=>null,()=>{l(new Error("[useTextures] - Failed to load texture"))})});if(ne(e)){const a=await Promise.all(e.map(o=>n(o)));return e.length>1?a:a[0]}else{const{map:a,displacementMap:o,normalMap:l,roughnessMap:i,metalnessMap:c,aoMap:p,alphaMap:u,matcap:h}=e;return{map:a?await n(a):null,displacementMap:o?await n(o):null,normalMap:l?await n(l):null,roughnessMap:i?await n(i):null,metalnessMap:c?await n(c):null,aoMap:p?await n(p):null,alphaMap:u?await n(u):null,matcap:h?await n(h):null}}}const g=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];function Oe(){const e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,r=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(g[e&255]+g[e>>8&255]+g[e>>16&255]+g[e>>24&255]+"-"+g[t&255]+g[t>>8&255]+"-"+g[t>>16&15|64]+g[t>>24&255]+"-"+g[r&63|128]+g[r>>8&255]+"-"+g[r>>16&255]+g[r>>24&255]+g[n&255]+g[n>>8&255]+g[n>>16&255]+g[n>>24&255]).toLowerCase()}const re=Symbol();function oe(){const e=s.shallowReactive({uuid:Oe(),camera:void 0,cameras:[],scene:void 0,renderer:void 0,aspectRatio:s.computed(()=>window.innerWidth/window.innerHeight)});function t(a){return e[a]}function r(a,o){e[a]=o}const n={state:e,...s.toRefs(e),getState:t,setState:r};return s.provide(re,n),n}const T=()=>s.inject(re,{state:s.shallowReactive({camera:void 0,cameras:[],scene:void 0,renderer:void 0})});function ie(){var l;const e=s.shallowRef(new m.Raycaster),t=s.ref(new m.Vector2),r=s.ref(null),{setState:n,state:a}=T();n("raycaster",e.value),n("pointer",t),n("currentInstance",r);function o(i){t.value.x=i.clientX/window.innerWidth*2-1,t.value.y=-(i.clientY/window.innerHeight)*2+1}return(l=a==null?void 0:a.renderer)==null||l.domElement.addEventListener("pointermove",o),s.onUnmounted(()=>{var i;(i=a==null?void 0:a.renderer)==null||i.domElement.removeEventListener("pointermove",o)}),{raycaster:e,pointer:t}}const Te=!0,se="[TresJS ▲ ■ ●] ";function U(){function e(n,a){console.error(`${se} ${n}`,a||"")}function t(n){console.warn(`${se} ${n}`)}function r(n,a){}return{logError:e,logWarning:t,logMessage:r}}function Ue(){const{logWarning:e}=U();function t(n,a,o){let l=null;return n.traverse(i=>{i[a]===o&&(l=i)}),l||e(`Child with ${a} '${o}' not found.`),l}function r(n,a){return t(n,"name",a)}return{seek:t,seekByName:r}}const ke=/^on[^a-z]/,Re=e=>ke.test(e);function Ne(e){}let ce=null;const fe={GEOMETRY_VIA_PROP:"tres__geometryViaProp",MATERIAL_VIA_PROP:"tres__materialViaProp"},{logError:le}=U(),je={createElement(e,t,r,n){var c,p;if(n||(n={}),n.args||(n.args=[]),e==="template"||Le(e))return null;let a=e.replace("Tres",""),o;if(e==="primitive"){(n==null?void 0:n.object)===void 0&&le("Tres primitives need a prop 'object'");const u=n.object;a=u.type,o=Object.assign(u,{type:a,attach:n.attach,primitive:!0})}else{const u=W.value[a];u||le(`${a} is not defined on the THREE namespace. Use extend to add it to the catalog.`),o=new u(...n.args)}if(o.isCamera){n!=null&&n.position||o.position.set(3,3,3),n!=null&&n.lookAt||o.lookAt(0,0,0);const{pushCamera:u}=Y();u(o)}(n==null?void 0:n.attach)===void 0&&(o.isMaterial?o.attach="material":o.isBufferGeometry&&(o.attach="geometry"));const{GEOMETRY_VIA_PROP:l,MATERIAL_VIA_PROP:i}=fe;return o.isObject3D&&((c=n==null?void 0:n.material)!=null&&c.isMaterial&&(o.userData[i]=!0),(p=n==null?void 0:n.geometry)!=null&&p.isBufferGeometry&&(o.userData[l]=!0)),o.events={},o},insert(e,t){var r,n;if(((e==null?void 0:e.__vnode.type)==="TresGroup"||(e==null?void 0:e.__vnode.type)==="TresObject3D")&&t===null&&!((n=(r=e==null?void 0:e.__vnode)==null?void 0:r.ctx)!=null&&n.asyncResolved)){ce=e;return}t||(t=ce),e!=null&&e.isObject3D&&(t!=null&&t.isObject3D)?(t.add(e),e.dispatchEvent({type:"added"})):typeof(e==null?void 0:e.attach)=="string"&&(e.__previousAttach=e[t==null?void 0:t.attach],t&&(t[e.attach]=e))},remove(e){var t,r;if(e){if(e.isObject3D){const n=e,a=o=>{var c,p;const{GEOMETRY_VIA_PROP:l,MATERIAL_VIA_PROP:i}=fe;o.userData[i]||(c=o.material)==null||c.dispose(),o.userData[l]||(p=o.geometry)==null||p.dispose()};n.traverse(o=>a(o)),a(n)}(t=e.removeFromParent)==null||t.call(e),(r=e.dispose)==null||r.call(e)}},patchProp(e,t,r,n){if(e){let a=e,o=t,l=E(o),i=a==null?void 0:a[l];if(a.type==="BufferGeometry"){a.setAttribute(E(o),new m.BufferAttribute(...n));return}if(o.includes("-")&&i===void 0){const p=o.split("-");i=p.reduce((u,h)=>u[E(h)],a),o=p.pop(),l=o.toLowerCase(),i!=null&&i.set||(a=p.reduce((u,h)=>u[E(h)],a))}Re(o)&&(e.events[o]=n);let c=n;if(c===""&&(c=!0),f.isFunction(i)){Array.isArray(c)?e[l](...c):e[l](c);return}!(i!=null&&i.set)&&!f.isFunction(i)?a[l]=c:i.constructor===c.constructor&&(i!=null&&i.copy)?i==null||i.copy(c):Array.isArray(c)?i.set(...c):!i.isColor&&i.setScalar?i.setScalar(c):i.set(c)}},parentNode(e){return(e==null?void 0:e.parent)||null},createText:()=>void 0,createComment:()=>void 0,setText:()=>void 0,setElementText:()=>void 0,nextSibling:()=>void 0,querySelector:()=>void 0,setScopeId:()=>void 0,cloneNode:()=>void 0,insertStaticContent:()=>void 0},{createApp:De}=s.createRenderer(je),Ie=e=>{const t=De(r);function r(){return e&&e.default?e.default():[]}return t};N(X);const{logWarning:ue}=U(),Be=s.defineComponent({name:"TresScene",props:["shadows","shadowMapType","physicallyCorrectLights","useLegacyLights","outputEncoding","toneMapping","toneMappingExposure","context","powerPreference","preserveDrawingBuffer","clearColor","windowSize","preset","disableRender"],setup(e,{slots:t,expose:r}){e.physicallyCorrectLights===!0&&ue("physicallyCorrectLights is deprecated, useLegacyLights is now false by default");const n=s.ref(),a=s.ref(),o=new X.Scene,{setState:l}=T();l("scene",o),l("canvas",a),l("container",n);const i=s.ref(),c=t&&t.default&&t.default();(c==null?void 0:c.length)>0&&(i.value=c.some(v=>Se(v.type)&&v.type.includes("Camera")),i.value||ue("No camera found in the scene, please add one!")),s.onMounted(()=>{p()}),s.onUnmounted(()=>{l("renderer",null)});function p(){const{renderer:v}=te(e),{activeCamera:M}=Y(),{onLoop:L}=q(),{raycaster:_,pointer:k}=ie();let C=null,b=null;s.watchEffect(()=>{M.value&&_.value.setFromCamera(k.value,M.value)}),L(()=>{var S,P,w,x,F,y,R,I,A,G;if(M.value&&e.disableRender!==!0&&e.disableRender!==""&&((S=v.value)==null||S.render(o,M.value)),_.value){const V=_.value.intersectObjects(o.children);V.length>0?(b=V[0],C===null&&((x=(w=(P=b.object)==null?void 0:P.events)==null?void 0:w.onPointerEnter)==null||x.call(w,b)),(R=(y=(F=b.object)==null?void 0:F.events)==null?void 0:y.onPointerMove)==null||R.call(y,b)):C!==null&&((G=(A=(I=b==null?void 0:b.object)==null?void 0:I.events)==null?void 0:A.onPointerLeave)==null||G.call(A,C),b=null),C=b}}),f.useEventListener(a.value,"click",()=>{var S,P,w;b!==null&&((w=(P=(S=b.object)==null?void 0:S.events)==null?void 0:P.onClick)==null||w.call(P,b))})}let u;function h(){u=Ie(t),u.provide("useTres",T()),u.provide("extend",N),u.mount(o)}return h(),r({scene:o}),()=>s.h(s.h("div",{ref:n,"data-scene":o.uuid,key:o.uuid,style:{position:"relative",width:"100%",height:"100%",pointerEvents:"auto",touchAction:"none"}},[s.h("div",{style:{width:"100%",height:"100%"}},[s.h("canvas",{ref:a,"data-scene":o.uuid,style:{display:"block",width:"100%",height:"100%",position:e.windowSize?"fixed":"absolute",top:0,left:0}})])]))}}),de=s.defineComponent({name:"TresCanvas",props:["shadows","shadowMapType","physicallyCorrectLights","useLegacyLights","outputEncoding","toneMapping","toneMappingExposure","context","powerPreference","preserveDrawingBuffer","clearColor","windowSize","preset","disableRender"],setup(e,{slots:t,expose:r}){const n=oe();return r(n),()=>s.h(Be,e,t)}}),ze={install(e){e.component("TresCanvas",de)}};d.CameraType=Q,d.TresCanvas=de,d.catalogue=W,d.default=ze,d.extend=N,d.isProd=Te,d.trasverseObjects=ae,d.useCamera=Y,d.useLoader=xe,d.useLogger=U,d.useRaycaster=ie,d.useRenderLoop=q,d.useRenderer=te,d.useSeek=Ue,d.useTexture=Ae,d.useTres=T,d.useTresProvider=oe,Object.defineProperties(d,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
8
+ (function(l,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("vue"),require("three"),require("@vueuse/core")):typeof define=="function"&&define.amd?define(["exports","vue","three","@vueuse/core"],s):(l=typeof globalThis<"u"?globalThis:l||self,s(l.tres={},l.Vue,l.Three,l.VueUseCore))})(this,function(l,s,d,u){"use strict";function ye(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const i in e)if(i!=="default"){const a=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,a.get?a:{enumerable:!0,get:()=>e[i]})}}return t.default=e,Object.freeze(t)}const H=ye(d),Y=s.ref({uuid:d.MathUtils.generateUUID()}),$=e=>void Object.assign(Y.value,e);var ee=(e=>(e.Perspective="Perspective",e.Orthographic="Orthographic",e))(ee||{});const Me=45;let A;function q(){const{state:e,setState:t,aspectRatio:i}=_();function a(o="Perspective",c){var m,p,h;if(o==="Perspective"){const{near:w,far:y,fov:L}=c||{near:.1,far:1e3,fov:Me};A=new d.PerspectiveCamera(L,((m=e.aspectRatio)==null?void 0:m.value)||window.innerWidth/window.innerHeight,w,y),(p=e.cameras)==null||p.push(A)}else{const{left:w,right:y,top:L,bottom:M,near:V,far:S}=c||{left:-100,right:100,top:100,bottom:-100,near:.1,far:1e3};A=new d.OrthographicCamera(w,y,L,M,V,S),(h=e.cameras)==null||h.push(A)}return e.camera=A,t("camera",e.camera),A}function n(){var o;e.camera instanceof d.PerspectiveCamera&&e.aspectRatio&&(e.camera.aspect=e.aspectRatio.value),(o=e.camera)==null||o.updateProjectionMatrix()}function r(o){var c;(c=e.cameras)==null||c.push(o),o instanceof d.PerspectiveCamera&&e.aspectRatio&&(o.aspect=e.aspectRatio.value),o.updateProjectionMatrix(),t("camera",o)}function f(){e.cameras=[]}return s.watchEffect(()=>{i!=null&&i.value&&n()}),{activeCamera:s.toRef(e,"camera"),createCamera:a,updateCamera:n,pushCamera:r,clearCameras:f}}const te=u.createEventHook(),ae=u.createEventHook(),K=u.createEventHook(),D=new d.Clock;let E=0,B=0;const{pause:Ce,resume:Pe,isActive:Le}=u.useRafFn(()=>{te.trigger({delta:E,elapsed:B,clock:D}),ae.trigger({delta:E,elapsed:B,clock:D}),K.trigger({delta:E,elapsed:B,clock:D})},{immediate:!1});K.on(()=>{E=D.getDelta(),B=D.getElapsedTime()});function X(){return{onBeforeLoop:te.on,onLoop:ae.on,onAfterLoop:K.on,pause:Ce,resume:Pe,isActive:Le}}function _e(e){return e instanceof d.Color?e:Array.isArray(e)?new d.Color(...e):new d.Color(e)}const J={realistic:{outputEncoding:d.sRGBEncoding,toneMapping:d.ACESFilmicToneMapping,toneMappingExposure:3,shadowMap:{enabled:!0,type:d.PCFSoftShadowMap}}},ne=(e,t)=>{for(const i of Object.keys(t))t[i]instanceof Object&&Object.assign(t[i],ne(e[i],t[i]));return Object.assign(e||{},t),e},Se=Oe("html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot");function z(e){return e.replace(/-([a-z])/g,(t,i)=>i.toUpperCase())}function Oe(e,t){const i=Object.create(null),a=e.split(",");for(let n=0;n<a.length;n++)i[a[n]]=!0;return t?n=>!!i[n.toLowerCase()]:n=>!!i[n]}function re(e){var we,be;const t=s.shallowRef(),i=s.ref(!1),{alpha:a=!0,antialias:n=!0,depth:r,logarithmicDepthBuffer:f,failIfMajorPerformanceCaveat:o,precision:c,premultipliedAlpha:m,stencil:p,shadows:h=!1,shadowMapType:w=d.PCFShadowMap,useLegacyLights:y=!1,outputEncoding:L=d.LinearEncoding,toneMapping:M=d.NoToneMapping,toneMappingExposure:V=1,context:S=void 0,powerPreference:Q="default",preserveDrawingBuffer:k=!1,clearColor:g,windowSize:C=!1,preset:P=void 0}=s.toRefs(e),{state:b,setState:R}=_(),{width:I,height:O}=u.toValue(C)==!0||u.toValue(C)===""||u.toValue(C)==="true"?u.useWindowSize():u.useElementSize(b.container),{logError:F,logWarning:U}=T(),{pixelRatio:x}=u.useDevicePixelRatio(),{pause:W,resume:N}=X(),Z=s.computed(()=>I.value/O.value);!u.toValue(C)&&((be=(we=b.container)==null?void 0:we.value)==null?void 0:be.offsetHeight)===0&&U(`Oops... Seems like your canvas height is currently 0px, by default it takes the height of it's parent, so make sure it has some height with CSS.
9
+ You could set windowSize=true to force the canvas to be the size of the window.`);const ve=()=>{t.value&&(t.value.setSize(I.value,O.value),t.value.setPixelRatio(Math.min(x.value,2)))},he=()=>{if(!t.value)return;const j=u.toValue(P);if(j){j in J||F("Renderer Preset must be one of these: "+Object.keys(J).join(", ")),ne(t.value,J[j]);return}t.value.shadowMap.enabled=u.toValue(h),t.value.shadowMap.type=u.toValue(w),t.value.toneMapping=u.toValue(M)||d.NoToneMapping,t.value.toneMappingExposure=u.toValue(V),t.value.outputEncoding=u.toValue(L)||d.LinearEncoding,g!=null&&g.value&&t.value.setClearColor(_e(u.toValue(g))),t.value.useLegacyLights=u.toValue(y)},Fe=()=>{const j=u.unrefElement(b.canvas);j&&(t.value=new d.WebGLRenderer({canvas:j,alpha:u.toValue(a),antialias:u.toValue(n),context:u.toValue(S),depth:u.toValue(r),failIfMajorPerformanceCaveat:u.toValue(o),logarithmicDepthBuffer:u.toValue(f),powerPreference:u.toValue(Q),precision:u.toValue(c),stencil:u.toValue(p),preserveDrawingBuffer:u.toValue(k),premultipliedAlpha:u.toValue(m)}),R("renderer",t.value),R("clock",new d.Clock),R("aspectRatio",Z),he(),ve(),N(),i.value=!0)},Ue=()=>{t.value&&(t.value.dispose(),t.value=void 0,i.value=!1,W())};return s.watch([Z,x],ve),s.watch([h,w,L,y,M,V,g],he),s.watch(()=>[b.canvas,b.container],()=>{u.unrefElement(b.canvas)&&u.unrefElement(b.container)&&Fe()},{immediate:!0,deep:!0}),{renderer:t,isReady:i,dispose:Ue,aspectRatio:Z}}const ie=e=>typeof e=="function",xe=e=>typeof e=="string",oe=e=>!!e&&e.constructor===Array;function se(e){const t={nodes:{},materials:{}};return e&&e.traverse(i=>{i.name&&(t.nodes[i.name]=i),i.material&&!t.materials[i.material.name]&&(t.materials[i.material.name]=i.material)}),t}async function Ae(e,t,i,a,n){const{logError:r}=T(),f=new e;n&&n(f),i&&i(f);const c=(Array.isArray(t)?t:[t]).map(m=>new Promise((p,h)=>{f.load(m,w=>{w.scene&&Object.assign(w,se(w.scene)),p(w)},a,w=>h(r("[useLoader] - Failed to load resource",w)))}));return oe(t)?await Promise.all(c):await c[0]}async function Te(e){const t=new d.LoadingManager,i=new d.TextureLoader(t),a=n=>new Promise((r,f)=>{i.load(n,o=>r(o),()=>null,()=>{f(new Error("[useTextures] - Failed to load texture"))})});if(oe(e)){const n=await Promise.all(e.map(r=>a(r)));return e.length>1?n:n[0]}else{const{map:n,displacementMap:r,normalMap:f,roughnessMap:o,metalnessMap:c,aoMap:m,alphaMap:p,matcap:h}=e;return{map:n?await a(n):null,displacementMap:r?await a(r):null,normalMap:f?await a(f):null,roughnessMap:o?await a(o):null,metalnessMap:c?await a(c):null,aoMap:m?await a(m):null,alphaMap:p?await a(p):null,matcap:h?await a(h):null}}}const v=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];function Ve(){const e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0,a=Math.random()*4294967295|0;return(v[e&255]+v[e>>8&255]+v[e>>16&255]+v[e>>24&255]+"-"+v[t&255]+v[t>>8&255]+"-"+v[t>>16&15|64]+v[t>>24&255]+"-"+v[i&63|128]+v[i>>8&255]+"-"+v[i>>16&255]+v[i>>24&255]+v[a&255]+v[a>>8&255]+v[a>>16&255]+v[a>>24&255]).toLowerCase()}const G=Symbol();function ce(){const e=s.shallowReactive({uuid:Ve(),camera:void 0,cameras:[],scene:void 0,renderer:void 0,aspectRatio:s.computed(()=>window.innerWidth/window.innerHeight)});function t(n){return e[n]}function i(n,r){e[n]=r}const a={state:e,...s.toRefs(e),getState:t,setState:i};return s.provide(G,a),a}const _=()=>s.inject(G,{state:s.shallowReactive({camera:void 0,cameras:[],scene:void 0,renderer:void 0})});function ue(){var f;const e=s.shallowRef(new d.Raycaster),t=s.ref(new d.Vector2),i=s.ref(null),{setState:a,state:n}=_();a("raycaster",e.value),a("pointer",t),a("currentInstance",i);function r(o){t.value.x=o.clientX/window.innerWidth*2-1,t.value.y=-(o.clientY/window.innerHeight)*2+1}return(f=n==null?void 0:n.renderer)==null||f.domElement.addEventListener("pointermove",r),s.onUnmounted(()=>{var o;(o=n==null?void 0:n.renderer)==null||o.domElement.removeEventListener("pointermove",r)}),{raycaster:e,pointer:t}}const ke=!0,fe="[TresJS ▲ ■ ●] ";function T(){function e(a,n){console.error(`${fe} ${a}`,n||"")}function t(a){console.warn(`${fe} ${a}`)}function i(a,n){}return{logError:e,logWarning:t,logMessage:i}}function Re(){const{logWarning:e}=T();function t(a,n,r){let f=null;return a.traverse(o=>{o[n]===r&&(f=o)}),f||e(`Child with ${n} '${r}' not found.`),f}function i(a,n){return t(a,"name",n)}return{seek:t,seekByName:i}}const je=/^on[^a-z]/,De=e=>je.test(e);function Ne(e){}let le=null;const de={GEOMETRY_VIA_PROP:"tres__geometryViaProp",MATERIAL_VIA_PROP:"tres__materialViaProp"},{logError:me}=T(),Ie={createElement(e,t,i,a){var c,m;if(a||(a={}),a.args||(a.args=[]),e==="template"||Se(e))return null;let n=e.replace("Tres",""),r;if(e==="primitive"){(a==null?void 0:a.object)===void 0&&me("Tres primitives need a prop 'object'");const p=a.object;n=p.type,r=Object.assign(p,{type:n,attach:a.attach,primitive:!0})}else{const p=Y.value[n];p||me(`${n} is not defined on the THREE namespace. Use extend to add it to the catalog.`),r=new p(...a.args)}if(r.isCamera){a!=null&&a.position||r.position.set(3,3,3),a!=null&&a.lookAt||r.lookAt(0,0,0);const{pushCamera:p}=q();p(r)}(a==null?void 0:a.attach)===void 0&&(r.isMaterial?r.attach="material":r.isBufferGeometry&&(r.attach="geometry"));const{GEOMETRY_VIA_PROP:f,MATERIAL_VIA_PROP:o}=de;return r.isObject3D&&((c=a==null?void 0:a.material)!=null&&c.isMaterial&&(r.userData[o]=!0),(m=a==null?void 0:a.geometry)!=null&&m.isBufferGeometry&&(r.userData[f]=!0)),r.events={},r},insert(e,t){var i,a,n,r;if((((i=e==null?void 0:e.__vnode)==null?void 0:i.type)==="TresGroup"||((a=e==null?void 0:e.__vnode)==null?void 0:a.type)==="TresObject3D")&&t===null&&!((r=(n=e==null?void 0:e.__vnode)==null?void 0:n.ctx)!=null&&r.asyncResolved)){le=e;return}t||(t=le),e!=null&&e.isObject3D&&(t!=null&&t.isObject3D)?(t.add(e),e.dispatchEvent({type:"added"})):typeof(e==null?void 0:e.attach)=="string"&&(e.__previousAttach=e[t==null?void 0:t.attach],t&&(t[e.attach]=e))},remove(e){var t,i;if(e){if(e.isObject3D){const a=e,n=r=>{var c,m;const{GEOMETRY_VIA_PROP:f,MATERIAL_VIA_PROP:o}=de;r.userData[o]||(c=r.material)==null||c.dispose(),r.userData[f]||(m=r.geometry)==null||m.dispose()};a.traverse(r=>n(r)),n(a)}(t=e.removeFromParent)==null||t.call(e),(i=e.dispose)==null||i.call(e)}},patchProp(e,t,i,a){if(e){let n=e,r=t,f=z(r),o=n==null?void 0:n[f];if(n.type==="BufferGeometry"){if(r==="args")return;n.setAttribute(z(r),new d.BufferAttribute(...a));return}if(r.includes("-")&&o===void 0){const m=r.split("-");o=m.reduce((p,h)=>p[z(h)],n),r=m.pop(),f=r.toLowerCase(),o!=null&&o.set||(n=m.reduce((p,h)=>p[z(h)],n))}De(r)&&(e.events[r]=a);let c=a;if(c===""&&(c=!0),ie(o)){Array.isArray(c)?e[f](...c):e[f](c);return}!(o!=null&&o.set)&&!ie(o)?n[f]=c:o.constructor===c.constructor&&(o!=null&&o.copy)?o==null||o.copy(c):Array.isArray(c)?o.set(...c):!o.isColor&&o.setScalar?o.setScalar(c):o.set(c)}},parentNode(e){return(e==null?void 0:e.parent)||null},createText:()=>void 0,createComment:()=>void 0,setText:()=>void 0,setElementText:()=>void 0,nextSibling:()=>void 0,querySelector:()=>void 0,setScopeId:()=>void 0,cloneNode:()=>void 0,insertStaticContent:()=>void 0},{createApp:Ee}=s.createRenderer(Ie),Be=e=>{const t=Ee(i);function i(){return e&&e.default?e.default():[]}return t};$(H);const{logWarning:pe}=T(),ze=s.defineComponent({name:"TresScene",props:["shadows","shadowMapType","physicallyCorrectLights","useLegacyLights","outputEncoding","toneMapping","toneMappingExposure","context","powerPreference","preserveDrawingBuffer","clearColor","windowSize","preset","disableRender","camera"],setup(e,{slots:t,expose:i}){e.physicallyCorrectLights===!0&&pe("physicallyCorrectLights is deprecated, useLegacyLights is now false by default");const a=s.ref(),n=s.ref(),r=new H.Scene,{setState:f}=_();f("scene",r),f("canvas",n),f("container",a);const o=s.ref(),c=t&&t.default&&t.default();c&&(c==null?void 0:c.length)>0&&(o.value=c.some(M=>xe(M.type)&&M.type.includes("Camera"))||e.camera,o.value||pe("No camera found in the scene, please add one!")),s.onMounted(()=>{w()}),s.onUnmounted(()=>{f("renderer",null)});const{activeCamera:m,pushCamera:p,clearCameras:h}=q();function w(){const{renderer:M}=re(e);e.camera&&p(e.camera);const{onLoop:V}=X(),{raycaster:S,pointer:Q}=ue();let k=null,g=null;s.watchEffect(()=>{m.value&&S.value.setFromCamera(Q.value,m.value)}),V(()=>{var C,P,b,R,I,O,F,U,x,W;if(m.value&&e.disableRender!==!0&&e.disableRender!==""&&((C=M.value)==null||C.render(r,m.value)),S.value){const N=S.value.intersectObjects(r.children);N.length>0?(g=N[0],k===null&&((R=(b=(P=g.object)==null?void 0:P.events)==null?void 0:b.onPointerEnter)==null||R.call(b,g)),(F=(O=(I=g.object)==null?void 0:I.events)==null?void 0:O.onPointerMove)==null||F.call(O,g)):k!==null&&((W=(x=(U=g==null?void 0:g.object)==null?void 0:U.events)==null?void 0:x.onPointerLeave)==null||W.call(x,k),g=null),k=g}}),u.useEventListener(n.value,"click",()=>{var C,P,b;g!==null&&((b=(P=(C=g.object)==null?void 0:C.events)==null?void 0:P.onClick)==null||b.call(P,g))})}let y;function L(){y=Be(t),y.provide("useTres",_()),y.provide(G,_()),y.provide("extend",$),y.mount(r)}return L(),i({scene:r}),s.watch(()=>e.camera,M=>{M&&(h(),p(M))}),()=>s.h(s.h("div",{ref:a,"data-scene":r.uuid,key:r.uuid,style:{position:"relative",width:"100%",height:"100%",pointerEvents:"auto",touchAction:"none"}},[s.h("div",{style:{width:"100%",height:"100%"}},[s.h("canvas",{ref:n,"data-scene":r.uuid,style:{display:"block",width:"100%",height:"100%",position:e.windowSize?"fixed":"absolute",top:0,left:0}})])]))}}),ge=s.defineComponent({name:"TresCanvas",props:["shadows","shadowMapType","physicallyCorrectLights","useLegacyLights","outputEncoding","toneMapping","toneMappingExposure","context","powerPreference","preserveDrawingBuffer","clearColor","windowSize","preset","disableRender","camera"],setup(e,{slots:t,expose:i}){const a=ce();return i(a),()=>s.h(ze,e,t)}}),Ge={install(e){e.component("TresCanvas",ge)}};l.CameraType=ee,l.TRES_CONTEXT_KEY=G,l.TresCanvas=ge,l.catalogue=Y,l.default=Ge,l.extend=$,l.isProd=ke,l.trasverseObjects=se,l.useCamera=q,l.useLoader=Ae,l.useLogger=T,l.useRaycaster=ue,l.useRenderLoop=X,l.useRenderer=re,l.useSeek=Re,l.useTexture=Te,l.useTres=_,l.useTresProvider=ce,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -55,9 +55,12 @@ export type TresAttributes = Record<string, any> & {
55
55
  export type TresVectorProp = Vector2 | Vector3 | number[] | number;
56
56
  export type TresColor = string | number | Color | number[];
57
57
  export interface TresEvent extends Intersection<Object3D<Event>> {
58
- object: Object3D;
58
+ object: Object3D & {
59
+ events?: Record<string, any>;
60
+ };
59
61
  distance: number;
60
62
  faceIndex?: number | undefined;
61
63
  point: Vector3;
62
64
  uv?: Vector2;
65
+ events?: Record<string, any>;
63
66
  }
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@tresjs/core",
3
3
  "description": "Declarative ThreeJS using Vue Components",
4
- "version": "2.0.0-beta.9",
4
+ "version": "2.0.0-rc.1",
5
5
  "type": "module",
6
+ "packageManager": "pnpm@8.3.1",
6
7
  "author": "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)",
7
8
  "files": [
8
9
  "dist"
@@ -57,46 +58,46 @@
57
58
  },
58
59
  "dependencies": {
59
60
  "@alvarosabu/utils": "^2.3.0",
60
- "@vueuse/core": "^9.13.0"
61
+ "@vueuse/core": "^10.1.2"
61
62
  },
62
63
  "devDependencies": {
63
- "@tresjs/core": "2.0.0-beta.5",
64
64
  "@alvarosabu/prettier-config": "^1.3.0",
65
65
  "@huntersofbook/plausible-vue": "^1.0.0",
66
66
  "@release-it/conventional-changelog": "^5.1.1",
67
67
  "@stackblitz/sdk": "^1.9.0",
68
- "@tresjs/cientos": "2.0.0-beta.1",
69
- "@types/three": "latest",
70
- "@typescript-eslint/eslint-plugin": "^5.58.0",
71
- "@typescript-eslint/parser": "^5.58.0",
72
- "@vitejs/plugin-vue": "^4.1.0",
68
+ "@tresjs/cientos": "2.0.0-beta.6",
69
+ "@tresjs/core": "2.0.0-beta.11",
70
+ "@types/three": "^0.151.0",
71
+ "@typescript-eslint/eslint-plugin": "^5.59.2",
72
+ "@typescript-eslint/parser": "^5.59.2",
73
+ "@vitejs/plugin-vue": "^4.2.1",
73
74
  "@vitest/coverage-c8": "^0.30.1",
74
- "@vitest/ui": "^0.29.2",
75
+ "@vitest/ui": "^0.30.1",
75
76
  "@vue/test-utils": "^2.3.2",
76
- "eslint": "^8.38.0",
77
+ "eslint": "^8.39.0",
77
78
  "eslint-config-prettier": "^8.8.0",
78
79
  "eslint-plugin-vue": "^9.11.0",
79
80
  "gsap": "^3.11.5",
80
- "happy-dom": "^9.6.1",
81
- "jsdom": "^21.1.1",
82
- "kolorist": "^1.7.0",
81
+ "happy-dom": "^9.10.7",
82
+ "jsdom": "^22.0.0",
83
+ "kolorist": "^1.8.0",
83
84
  "pathe": "^1.1.0",
84
- "prettier": "^2.8.7",
85
- "release-it": "^15.10.1",
85
+ "prettier": "^2.8.8",
86
+ "release-it": "^15.10.3",
86
87
  "rollup-plugin-analyzer": "^4.0.0",
87
88
  "rollup-plugin-copy": "^3.4.0",
88
89
  "rollup-plugin-visualizer": "^5.9.0",
89
- "three": "^0.150.1",
90
- "unocss": "^0.51.4",
90
+ "three": "^0.152.2",
91
+ "unocss": "^0.51.8",
91
92
  "unplugin": "^1.3.1",
92
93
  "unplugin-vue-components": "^0.24.1",
93
- "vite": "^4.2.1",
94
+ "vite": "^4.3.4",
94
95
  "vite-plugin-banner": "^0.7.0",
95
- "vite-plugin-dts": "2.2.0",
96
- "vite-plugin-inspect": "^0.7.22",
96
+ "vite-plugin-dts": "2.3.0",
97
+ "vite-plugin-inspect": "^0.7.24",
97
98
  "vite-plugin-require-transform": "^1.0.12",
98
99
  "vite-svg-loader": "^4.0.0",
99
- "vitepress": "1.0.0-alpha.65",
100
+ "vitepress": "1.0.0-alpha.75",
100
101
  "vitest": "^0.30.1",
101
102
  "vue-demi": "^0.14.0"
102
103
  }