@tresjs/core 3.7.0 → 3.8.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.
Files changed (36) hide show
  1. package/README.md +1 -0
  2. package/components.d.ts +1 -1
  3. package/composables.d.ts +1 -1
  4. package/dist/src/components/TresCanvas.vue.d.ts +7 -6
  5. package/dist/src/components/index.d.ts +2 -1
  6. package/dist/src/composables/useCamera/index.d.ts +472 -433
  7. package/dist/src/composables/useLoader/index.d.ts +3 -2
  8. package/dist/src/composables/useLogger.d.ts +5 -2
  9. package/dist/src/composables/usePointerEventHandler/index.d.ts +4 -3
  10. package/dist/src/composables/useRaycaster/index.d.ts +7 -6
  11. package/dist/src/composables/useRenderLoop/index.d.ts +3 -2
  12. package/dist/src/composables/useRenderer/index.d.ts +8 -8
  13. package/dist/src/composables/useSeek/index.d.ts +6 -4
  14. package/dist/src/composables/useSizes/index.d.ts +12 -0
  15. package/dist/src/composables/useTexture/index.d.ts +2 -1
  16. package/dist/src/composables/useTresContextProvider/index.d.ts +6 -9
  17. package/dist/src/core/catalogue.d.ts +3 -2
  18. package/dist/src/core/nodeOps.d.ts +3 -2
  19. package/dist/src/core/renderer.d.ts +1 -1
  20. package/dist/src/devtools/plugin.d.ts +3 -2
  21. package/dist/src/directives/index.d.ts +4 -3
  22. package/dist/src/directives/vAlwaysLookAt.d.ts +4 -3
  23. package/dist/src/directives/vDistanceTo.d.ts +3 -2
  24. package/dist/src/directives/vLightHelper.d.ts +2 -1
  25. package/dist/src/directives/vLog.d.ts +2 -1
  26. package/dist/src/index.d.ts +3 -2
  27. package/dist/src/types/index.d.ts +3 -2
  28. package/dist/src/utils/index.d.ts +2 -2
  29. package/dist/src/utils/normalize.d.ts +2 -2
  30. package/dist/src/utils/perf.d.ts +3 -2
  31. package/dist/src/utils/test-utils.d.ts +1 -1
  32. package/dist/tres.js +573 -578
  33. package/dist/tres.umd.cjs +2 -2
  34. package/package.json +18 -17
  35. package/types.d.ts +1 -1
  36. package/utils.d.ts +1 -1
package/dist/tres.js CHANGED
@@ -1,48 +1,48 @@
1
1
  /**
2
2
  * name: @tresjs/core
3
- * version: v3.7.0
3
+ * version: v3.8.1
4
4
  * (c) 2024
5
5
  * description: Declarative ThreeJS using Vue Components
6
6
  * author: Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)
7
7
  */
8
- var je = Object.defineProperty;
9
- var He = (e, r, t) => r in e ? je(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
10
- var J = (e, r, t) => (He(e, typeof r != "symbol" ? r + "" : r, t), t);
11
- import { ref as R, computed as P, watchEffect as O, onUnmounted as F, shallowRef as D, watch as me, reactive as ge, readonly as Re, provide as q, inject as $e, createRenderer as Ie, defineComponent as ne, useSlots as ze, getCurrentInstance as oe, onMounted as Ne, openBlock as Ve, createElementBlock as We, normalizeClass as Ue, unref as Fe, normalizeStyle as Ge, h as se, Fragment as Je } from "vue";
12
- import * as ve from "three";
13
- import { PerspectiveCamera as K, OrthographicCamera as Qe, Camera as Ye, Clock as qe, Vector3 as he, Color as V, MeshBasicMaterial as ye, DoubleSide as Ke, REVISION as Xe, SRGBColorSpace as Ze, ACESFilmicToneMapping as et, PCFSoftShadowMap as tt, WebGLRenderer as Q, LoadingManager as rt, TextureLoader as nt, Vector2 as ot, Raycaster as st, BufferAttribute as it, Scene as at, Line as lt, BufferGeometry as ie, Float32BufferAttribute as ae, LineBasicMaterial as ut, Mesh as ct, BackSide as dt, DirectionalLightHelper as ft, PointLightHelper as pt, SpotLightHelper as mt, HemisphereLightHelper as gt, ArrowHelper as vt } from "three";
14
- import { createEventHook as H, useRafFn as we, toValue as M, unrefElement as ht, useDevicePixelRatio as yt, usePointer as wt, useElementBounding as bt, useWindowSize as _t, useElementSize as Et, refDebounced as Mt, useFps as Ct, useMemory as St } from "@vueuse/core";
15
- const xt = "@tresjs/core", Pt = "module", kt = "3.7.0", At = "pnpm@8.10.2", Tt = "Declarative ThreeJS using Vue Components", Lt = "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)", Ot = "MIT", Dt = [
8
+ var De = Object.defineProperty;
9
+ var Be = (e, r, t) => r in e ? De(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
10
+ var J = (e, r, t) => (Be(e, typeof r != "symbol" ? r + "" : r, t), t);
11
+ import { ref as R, computed as T, watchEffect as D, onUnmounted as G, shallowRef as j, watch as ge, reactive as ve, readonly as q, provide as K, inject as je, createRenderer as He, defineComponent as ne, useSlots as Re, getCurrentInstance as se, onMounted as Ie, openBlock as $e, createElementBlock as Ne, normalizeClass as Ve, unref as ze, normalizeStyle as We, h as ie, Fragment as Ue } from "vue";
12
+ import * as he from "three";
13
+ import { PerspectiveCamera as X, OrthographicCamera as Fe, Camera as Ge, Clock as Je, Vector3 as ye, Color as W, MeshBasicMaterial as we, DoubleSide as Qe, REVISION as Ye, SRGBColorSpace as qe, ACESFilmicToneMapping as Ke, PCFSoftShadowMap as Xe, WebGLRenderer as Q, TextureLoader as Ze, Vector2 as et, Raycaster as tt, BufferAttribute as rt, Scene as ot, Line as nt, BufferGeometry as ae, Float32BufferAttribute as le, LineBasicMaterial as st, Mesh as it, BackSide as at, DirectionalLightHelper as lt, PointLightHelper as ut, SpotLightHelper as ct, HemisphereLightHelper as dt, ArrowHelper as ft } from "three";
14
+ import { createEventHook as H, useRafFn as be, toValue as _, unrefElement as pt, useDevicePixelRatio as mt, usePointer as gt, useElementBounding as vt, useWindowSize as ht, useElementSize as yt, refDebounced as ue, useFps as wt, useMemory as bt } from "@vueuse/core";
15
+ const _t = "@tresjs/core", Et = "module", Ct = "3.8.1", Mt = "pnpm@8.15.6", xt = "Declarative ThreeJS using Vue Components", St = "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)", Pt = "MIT", kt = [
16
16
  "vue",
17
17
  "3d",
18
18
  "threejs",
19
19
  "three",
20
20
  "threejs-vue"
21
- ], Bt = !1, jt = {
21
+ ], Tt = !1, At = {
22
22
  ".": {
23
23
  types: "./dist/index.d.ts",
24
24
  require: "./dist/tres.umd.cjs",
25
25
  import: "./dist/tres.js"
26
26
  },
27
27
  "./components": {
28
- types: "./dist/components/index.d.ts"
28
+ types: "./dist/src/components/index.d.ts"
29
29
  },
30
30
  "./composables": {
31
- types: "./dist/composables/index.d.ts"
31
+ types: "./dist/src/composables/index.d.ts"
32
32
  },
33
33
  "./types": {
34
- types: "./dist/types/index.d.ts"
34
+ types: "./dist/src/types/index.d.ts"
35
35
  },
36
36
  "./utils": {
37
- types: "./dist/utils/index.d.ts"
37
+ types: "./dist/src/utils/index.d.ts"
38
38
  },
39
39
  "./*": "./*"
40
- }, Ht = "./dist/tres.js", Rt = "./dist/tres.js", $t = "./dist/index.d.ts", It = [
40
+ }, Lt = "./dist/tres.js", Ot = "./dist/tres.js", Dt = "./dist/index.d.ts", Bt = [
41
41
  "dist",
42
42
  "*.d.ts"
43
- ], zt = {
43
+ ], jt = {
44
44
  access: "public"
45
- }, Nt = {
45
+ }, Ht = {
46
46
  dev: "cd playground && npm run dev",
47
47
  build: "vite build",
48
48
  playground: "cd playground && npm run dev",
@@ -57,21 +57,22 @@ const xt = "@tresjs/core", Pt = "module", kt = "3.7.0", At = "pnpm@8.10.2", Tt =
57
57
  "docs:serve": "vitepress serve docs",
58
58
  "docs:preview": "vitepress preview docs",
59
59
  "docs:contributors": "esno scripts/update-contributors.ts"
60
- }, Vt = {
60
+ }, Rt = {
61
61
  three: ">=0.133",
62
62
  vue: ">=3.3"
63
- }, Wt = {
63
+ }, It = {
64
64
  "@alvarosabu/utils": "^3.1.1",
65
+ "@vue/devtools-api": "^6.6.1",
65
66
  "@vueuse/core": "^10.7.0"
66
- }, Ut = {
67
+ }, $t = {
67
68
  "@release-it/conventional-changelog": "^8.0.1",
68
69
  "@stackblitz/sdk": "^1.9.0",
69
- "@tresjs/cientos": "3.6.0",
70
+ "@tresjs/cientos": "3.8.0",
70
71
  "@tresjs/eslint-config-vue": "^0.2.1",
71
- "@types/three": "^0.159.0",
72
- "@typescript-eslint/eslint-plugin": "^6.14.0",
73
- "@typescript-eslint/parser": "^6.14.0",
74
- "@vitejs/plugin-vue": "^4.5.2",
72
+ "@types/three": "^0.163.0",
73
+ "@typescript-eslint/eslint-plugin": "^7.5.0",
74
+ "@typescript-eslint/parser": "^7.5.0",
75
+ "@vitejs/plugin-vue": "^5.0.4",
75
76
  "@vitest/coverage-c8": "^0.33.0",
76
77
  "@vitest/ui": "^1.0.4",
77
78
  "@vue/test-utils": "^2.4.3",
@@ -79,7 +80,7 @@ const xt = "@tresjs/core", Pt = "module", kt = "3.7.0", At = "pnpm@8.10.2", Tt =
79
80
  "eslint-plugin-vue": "^9.19.2",
80
81
  esno: "^4.0.0",
81
82
  gsap: "^3.12.3",
82
- jsdom: "^23.0.1",
83
+ jsdom: "^24.0.0",
83
84
  kolorist: "^1.8.0",
84
85
  ohmyfetch: "^0.4.21",
85
86
  pathe: "^1.1.1",
@@ -87,94 +88,94 @@ const xt = "@tresjs/core", Pt = "module", kt = "3.7.0", At = "pnpm@8.10.2", Tt =
87
88
  "rollup-plugin-analyzer": "^4.0.0",
88
89
  "rollup-plugin-copy": "^3.5.0",
89
90
  "rollup-plugin-visualizer": "^5.11.0",
90
- three: "^0.159.0",
91
+ three: "^0.163.0",
91
92
  unocss: "^0.58.0",
92
- unplugin: "^1.5.1",
93
+ unplugin: "^1.10.1",
93
94
  "unplugin-vue-components": "^0.26.0",
94
- vite: "^5.0.8",
95
+ vite: "^5.2.7",
95
96
  "vite-plugin-banner": "^0.7.1",
96
- "vite-plugin-dts": "3.6.4",
97
+ "vite-plugin-dts": "3.8.1",
97
98
  "vite-plugin-inspect": "^0.8.1",
98
99
  "vite-plugin-require-transform": "^1.0.21",
99
100
  "vite-svg-loader": "^5.1.0",
100
- vitepress: "1.0.0-rc.31",
101
+ vitepress: "1.0.2",
101
102
  vitest: "^1.0.4",
102
103
  vue: "^3.3.11",
103
104
  "vue-demi": "^0.14.6"
104
- }, Ft = {
105
- name: xt,
106
- type: Pt,
107
- version: kt,
108
- packageManager: At,
109
- description: Tt,
110
- author: Lt,
111
- license: Ot,
112
- keywords: Dt,
113
- sideEffects: Bt,
114
- exports: jt,
115
- main: Ht,
116
- module: Rt,
117
- types: $t,
118
- files: It,
119
- publishConfig: zt,
120
- scripts: Nt,
121
- peerDependencies: Vt,
122
- dependencies: Wt,
123
- devDependencies: Ut
124
- }, Gt = ({ sizes: e, scene: r }) => {
125
- const t = R([]), n = P(
105
+ }, Nt = {
106
+ name: _t,
107
+ type: Et,
108
+ version: Ct,
109
+ packageManager: Mt,
110
+ description: xt,
111
+ author: St,
112
+ license: Pt,
113
+ keywords: kt,
114
+ sideEffects: Tt,
115
+ exports: At,
116
+ main: Lt,
117
+ module: Ot,
118
+ types: Dt,
119
+ files: Bt,
120
+ publishConfig: jt,
121
+ scripts: Ht,
122
+ peerDependencies: Rt,
123
+ dependencies: It,
124
+ devDependencies: $t
125
+ }, Vt = ({ sizes: e, scene: r }) => {
126
+ const t = R([]), o = T(
126
127
  () => t.value[0]
127
- ), s = (i, l = !1) => {
128
- t.value.some(({ uuid: c }) => c === i.uuid) || (l ? o(i) : t.value.push(i));
129
- }, a = (i) => {
130
- t.value = t.value.filter(({ uuid: l }) => l !== i.uuid);
131
- }, o = (i) => {
132
- const l = i instanceof Ye ? i : t.value.find((p) => p.uuid === i);
128
+ ), s = (a, l = !1) => {
129
+ t.value.some(({ uuid: c }) => c === a.uuid) || (l ? n(a) : t.value.push(a));
130
+ }, i = (a) => {
131
+ t.value = t.value.filter(({ uuid: l }) => l !== a.uuid);
132
+ }, n = (a) => {
133
+ const l = a instanceof Ge ? a : t.value.find((m) => m.uuid === a);
133
134
  if (!l)
134
135
  return;
135
- const c = t.value.filter(({ uuid: p }) => p !== l.uuid);
136
+ const c = t.value.filter(({ uuid: m }) => m !== l.uuid);
136
137
  t.value = [l, ...c];
137
138
  };
138
- return O(() => {
139
- e.aspectRatio.value && t.value.forEach((i) => {
140
- i instanceof K && (i.aspect = e.aspectRatio.value), (i instanceof K || i instanceof Qe) && i.updateProjectionMatrix();
139
+ return D(() => {
140
+ e.aspectRatio.value && t.value.forEach((a) => {
141
+ a instanceof X && (a.aspect = e.aspectRatio.value), (a instanceof X || a instanceof Fe) && a.updateProjectionMatrix();
141
142
  });
142
- }), r.userData.tres__registerCamera = s, r.userData.tres__deregisterCamera = a, F(() => {
143
+ }), r.userData.tres__registerCamera = s, r.userData.tres__deregisterCamera = i, G(() => {
143
144
  t.value = [];
144
145
  }), {
145
- camera: n,
146
+ camera: o,
146
147
  cameras: t,
147
148
  registerCamera: s,
148
- deregisterCamera: a,
149
- setCameraActive: o
149
+ deregisterCamera: i,
150
+ setCameraActive: n
150
151
  };
151
- }, be = H(), _e = H(), ee = H(), j = new qe();
152
- let W = 0, U = 0;
153
- const { pause: Jt, resume: Qt, isActive: Yt } = we(
152
+ }, _e = H(), Ee = H(), te = H(), B = new Je();
153
+ let U = 0, F = 0;
154
+ const { pause: zt, resume: Wt, isActive: Ut } = be(
154
155
  () => {
155
- be.trigger({ delta: W, elapsed: U, clock: j }), _e.trigger({ delta: W, elapsed: U, clock: j }), ee.trigger({ delta: W, elapsed: U, clock: j });
156
+ _e.trigger({ delta: U, elapsed: F, clock: B }), Ee.trigger({ delta: U, elapsed: F, clock: B }), te.trigger({ delta: U, elapsed: F, clock: B });
156
157
  },
157
158
  { immediate: !1 }
158
159
  );
159
- ee.on(() => {
160
- W = j.getDelta(), U = j.getElapsedTime();
160
+ te.on(() => {
161
+ U = B.getDelta(), F = B.getElapsedTime();
161
162
  });
162
- const te = () => ({
163
- onBeforeLoop: be.on,
164
- onLoop: _e.on,
165
- onAfterLoop: ee.on,
166
- pause: Jt,
167
- resume: Qt,
168
- isActive: Yt
169
- }), Vr = !0, le = "[TresJS ▲ ■ ●] ";
170
- function T() {
171
- function e(n, s) {
172
- console.error(`${le} ${n}`, s || "");
163
+ const re = () => ({
164
+ onBeforeLoop: _e.on,
165
+ onLoop: Ee.on,
166
+ onAfterLoop: te.on,
167
+ pause: zt,
168
+ resume: Wt,
169
+ isActive: Ut
170
+ }), Rr = !0, $ = "[TresJS ▲ ■ ●] ";
171
+ function A() {
172
+ function e(...o) {
173
+ typeof o[0] == "string" ? o[0] = $ + o[0] : o.unshift($), console.error(...o);
173
174
  }
174
- function r(n) {
175
- console.warn(`${le} ${n}`);
175
+ function r(...o) {
176
+ typeof o[0] == "string" ? o[0] = $ + o[0] : o.unshift($), console.warn(...o);
176
177
  }
177
- function t(n, s) {
178
+ function t(o, s) {
178
179
  }
179
180
  return {
180
181
  logError: e,
@@ -182,13 +183,13 @@ function T() {
182
183
  logMessage: t
183
184
  };
184
185
  }
185
- function Wr(e) {
186
- return typeof e == "number" ? [e, e, e] : e instanceof he ? [e.x, e.y, e.z] : e;
186
+ function Ir(e) {
187
+ return typeof e == "number" ? [e, e, e] : e instanceof ye ? [e.x, e.y, e.z] : e;
187
188
  }
188
- function qt(e) {
189
- return e instanceof V ? e : Array.isArray(e) ? new V(...e) : new V(e);
189
+ function Ft(e) {
190
+ return e instanceof W ? e : Array.isArray(e) ? new W(...e) : new W(e);
190
191
  }
191
- class Kt extends ve.Mesh {
192
+ class Gt extends he.Mesh {
192
193
  constructor(...t) {
193
194
  super(...t);
194
195
  J(this, "type", "HightlightMesh");
@@ -196,61 +197,61 @@ class Kt extends ve.Mesh {
196
197
  this.createTime = Date.now();
197
198
  }
198
199
  onBeforeRender() {
199
- const n = (Date.now() - this.createTime) / 1e3, o = 1 + 0.07 * Math.sin(2.5 * n);
200
- this.scale.set(o, o, o);
200
+ const o = (Date.now() - this.createTime) / 1e3, n = 1 + 0.07 * Math.sin(2.5 * o);
201
+ this.scale.set(n, n, n);
201
202
  }
202
203
  }
203
- const Ee = (e, r) => {
204
+ const Ce = (e, r) => {
204
205
  for (const t of Object.keys(r))
205
- r[t] instanceof Object && Object.assign(r[t], Ee(e[t], r[t]));
206
+ r[t] instanceof Object && Object.assign(r[t], Ce(e[t], r[t]));
206
207
  return Object.assign(e || {}, r), e;
207
- }, Xt = "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", Zt = /* @__PURE__ */ er(Xt);
208
- function ue(e) {
208
+ }, Jt = "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", Qt = /* @__PURE__ */ Yt(Jt);
209
+ function ce(e) {
209
210
  return e && e.nodeType === 1;
210
211
  }
211
- function I(e) {
212
+ function N(e) {
212
213
  return e.replace(/-([a-z])/g, (r, t) => t.toUpperCase());
213
214
  }
214
- function er(e, r) {
215
- const t = /* @__PURE__ */ Object.create(null), n = e.split(",");
216
- for (let s = 0; s < n.length; s++)
217
- t[n[s]] = !0;
215
+ function Yt(e, r) {
216
+ const t = /* @__PURE__ */ Object.create(null), o = e.split(",");
217
+ for (let s = 0; s < o.length; s++)
218
+ t[o[s]] = !0;
218
219
  return r ? (s) => !!t[s.toLowerCase()] : (s) => !!t[s];
219
220
  }
220
- const tr = (e, r) => {
221
- const t = /* @__PURE__ */ new Set(), n = [];
221
+ const qt = (e, r) => {
222
+ const t = /* @__PURE__ */ new Set(), o = [];
222
223
  for (const s of e) {
223
- const a = r(s);
224
- t.has(a) || (t.add(a), n.push(s));
224
+ const i = r(s);
225
+ t.has(i) || (t.add(i), o.push(s));
225
226
  }
226
- return n;
227
- }, ce = (e, r) => {
227
+ return o;
228
+ }, de = (e, r) => {
228
229
  if (!r)
229
230
  return;
230
231
  const t = Array.isArray(r) ? r : r.match(/([^[.\]])+/g);
231
- return t == null ? void 0 : t.reduce((n, s) => n && n[s], e);
232
- }, rr = (e, r, t) => {
233
- const n = Array.isArray(r) ? r : r.match(/([^[.\]])+/g);
234
- n && n.reduce((s, a, o) => (s[a] === void 0 && (s[a] = {}), o === n.length - 1 && (s[a] = t), s[a]), e);
232
+ return t == null ? void 0 : t.reduce((o, s) => o && o[s], e);
233
+ }, Kt = (e, r, t) => {
234
+ const o = Array.isArray(r) ? r : r.match(/([^[.\]])+/g);
235
+ o && o.reduce((s, i, n) => (s[i] === void 0 && (s[i] = {}), n === o.length - 1 && (s[i] = t), s[i]), e);
235
236
  };
236
237
  function Me(e, r) {
237
- if (ue(e) && ue(r)) {
238
- const s = e.attributes, a = r.attributes;
239
- return s.length !== a.length ? !1 : Array.from(s).every(({ name: o, value: i }) => r.getAttribute(o) === i);
238
+ if (ce(e) && ce(r)) {
239
+ const s = e.attributes, i = r.attributes;
240
+ return s.length !== i.length ? !1 : Array.from(s).every(({ name: n, value: a }) => r.getAttribute(n) === a);
240
241
  }
241
242
  if (e === r)
242
243
  return !0;
243
244
  if (e === null || typeof e != "object" || r === null || typeof r != "object")
244
245
  return !1;
245
- const t = Object.keys(e), n = Object.keys(r);
246
- if (t.length !== n.length)
246
+ const t = Object.keys(e), o = Object.keys(r);
247
+ if (t.length !== o.length)
247
248
  return !1;
248
249
  for (const s of t)
249
- if (!n.includes(s) || !Me(e[s], r[s]))
250
+ if (!o.includes(s) || !Me(e[s], r[s]))
250
251
  return !1;
251
252
  return !0;
252
253
  }
253
- function nr(e, r) {
254
+ function Xt(e, r) {
254
255
  if (!Array.isArray(e) || !Array.isArray(r) || e.length !== r.length)
255
256
  return !1;
256
257
  for (let t = 0; t < e.length; t++)
@@ -258,354 +259,348 @@ function nr(e, r) {
258
259
  return !1;
259
260
  return !0;
260
261
  }
261
- const or = Array.isArray;
262
- function sr(e, r, t, n) {
262
+ const Zt = Array.isArray;
263
+ function er(e, r, t, o) {
263
264
  const s = (l) => {
264
265
  if (l.uuid === r)
265
266
  return l;
266
267
  for (const c of l.children) {
267
- const p = s(c);
268
- if (p)
269
- return p;
268
+ const m = s(c);
269
+ if (m)
270
+ return m;
270
271
  }
271
- }, a = s(e);
272
- if (!a) {
272
+ }, i = s(e);
273
+ if (!i) {
273
274
  console.warn("Object with UUID not found in the scene.");
274
275
  return;
275
276
  }
276
- let o = a;
277
+ let n = i;
277
278
  for (let l = 0; l < t.length - 1; l++)
278
- if (o[t[l]] !== void 0)
279
- o = o[t[l]];
279
+ if (n[t[l]] !== void 0)
280
+ n = n[t[l]];
280
281
  else {
281
282
  console.warn(`Property path is not valid: ${t.join(".")}`);
282
283
  return;
283
284
  }
284
- const i = t[t.length - 1];
285
- o[i] !== void 0 ? o[i] = n : console.warn(`Property path is not valid: ${t.join(".")}`);
285
+ const a = t[t.length - 1];
286
+ n[a] !== void 0 ? n[a] = o : console.warn(`Property path is not valid: ${t.join(".")}`);
286
287
  }
287
- function ir(e) {
288
- const r = new ye({
288
+ function tr(e) {
289
+ const r = new we({
289
290
  color: 11003607,
290
291
  // Highlight color, e.g., yellow
291
292
  transparent: !0,
292
293
  opacity: 0.2,
293
294
  depthTest: !1,
294
295
  // So the highlight is always visible
295
- side: Ke
296
+ side: Qe
296
297
  // To e
297
298
  });
298
- return new Kt(e.geometry.clone(), r);
299
+ return new Gt(e.geometry.clone(), r);
299
300
  }
300
- function Ce(e) {
301
+ function xe(e) {
301
302
  var t;
302
303
  let r = e.value;
303
- return e.value && ((t = e.value) != null && t.isMesh) && (r = e.value.position), Array.isArray(e.value) && (r = new he(...r)), r;
304
+ return e.value && ((t = e.value) != null && t.isMesh) && (r = e.value.position), Array.isArray(e.value) && (r = new ye(...r)), r;
304
305
  }
305
- const ar = Number.parseInt(Xe.replace("dev", "")), z = {
306
+ const rr = Number.parseInt(Ye.replace("dev", "")), V = {
306
307
  realistic: {
307
308
  shadows: !0,
308
309
  physicallyCorrectLights: !0,
309
- outputColorSpace: Ze,
310
- toneMapping: et,
310
+ outputColorSpace: qe,
311
+ toneMapping: Ke,
311
312
  toneMappingExposure: 3,
312
313
  shadowMap: {
313
314
  enabled: !0,
314
- type: tt
315
+ type: Xe
315
316
  }
316
317
  }
317
318
  };
318
- function lr({
319
+ function or({
319
320
  scene: e,
320
321
  canvas: r,
321
322
  options: t,
322
- disableRender: n,
323
- contextParts: { sizes: s, camera: a }
323
+ disableRender: o,
324
+ contextParts: { sizes: s, camera: i }
324
325
  }) {
325
- const o = P(() => ({
326
- alpha: M(t.alpha),
327
- depth: M(t.depth),
328
- canvas: ht(r),
329
- context: M(t.context),
330
- stencil: M(t.stencil),
331
- antialias: M(t.antialias) === void 0 ? !0 : M(t.antialias),
332
- precision: M(t.precision),
333
- powerPreference: M(t.powerPreference),
334
- premultipliedAlpha: M(t.premultipliedAlpha),
335
- preserveDrawingBuffer: M(t.preserveDrawingBuffer),
336
- logarithmicDepthBuffer: M(t.logarithmicDepthBuffer),
337
- failIfMajorPerformanceCaveat: M(t.failIfMajorPerformanceCaveat)
338
- })), i = D(new Q(o.value));
339
- me(o, () => {
340
- i.value.dispose(), i.value = new Q(o.value);
341
- }), O(() => {
342
- i.value.setSize(s.width.value, s.height.value);
326
+ const n = T(() => ({
327
+ alpha: _(t.alpha),
328
+ depth: _(t.depth),
329
+ canvas: pt(r),
330
+ context: _(t.context),
331
+ stencil: _(t.stencil),
332
+ antialias: _(t.antialias) === void 0 ? !0 : _(t.antialias),
333
+ precision: _(t.precision),
334
+ powerPreference: _(t.powerPreference),
335
+ premultipliedAlpha: _(t.premultipliedAlpha),
336
+ preserveDrawingBuffer: _(t.preserveDrawingBuffer),
337
+ logarithmicDepthBuffer: _(t.logarithmicDepthBuffer),
338
+ failIfMajorPerformanceCaveat: _(t.failIfMajorPerformanceCaveat)
339
+ })), a = j(new Q(n.value));
340
+ ge(n, () => {
341
+ a.value.dispose(), a.value = new Q(n.value);
342
+ }), D(() => {
343
+ a.value.setSize(s.width.value, s.height.value);
343
344
  });
344
- const { pixelRatio: l } = yt();
345
- O(() => {
346
- i.value.setPixelRatio(l.value);
345
+ const { pixelRatio: l } = mt();
346
+ D(() => {
347
+ a.value.setPixelRatio(l.value);
347
348
  });
348
- const { logError: c } = T(), d = (() => {
349
- const f = new Q(), h = {
349
+ const { logError: c } = A(), d = (() => {
350
+ const p = new Q(), y = {
350
351
  shadowMap: {
351
- enabled: f.shadowMap.enabled,
352
- type: f.shadowMap.type
352
+ enabled: p.shadowMap.enabled,
353
+ type: p.shadowMap.type
353
354
  },
354
- toneMapping: f.toneMapping,
355
- toneMappingExposure: f.toneMappingExposure,
356
- outputColorSpace: f.outputColorSpace
355
+ toneMapping: p.toneMapping,
356
+ toneMappingExposure: p.toneMappingExposure,
357
+ outputColorSpace: p.outputColorSpace
357
358
  };
358
- return f.dispose(), h;
359
+ return p.dispose(), y;
359
360
  })();
360
- O(() => {
361
- const f = M(t.preset);
362
- f && (f in z || c(`Renderer Preset must be one of these: ${Object.keys(z).join(", ")}`), Ee(i.value, z[f]));
363
- const h = (C, S) => {
364
- const b = M(C), x = () => {
365
- if (f)
366
- return ce(z[f], S);
361
+ D(() => {
362
+ const p = _(t.preset);
363
+ p && (p in V || c(`Renderer Preset must be one of these: ${Object.keys(V).join(", ")}`), Ce(a.value, V[p]));
364
+ const y = (C, M) => {
365
+ const w = _(C), S = () => {
366
+ if (p)
367
+ return de(V[p], M);
367
368
  };
368
- if (b !== void 0)
369
- return b;
370
- const g = x();
371
- return g !== void 0 ? g : ce(d, S);
372
- }, _ = (C, S) => rr(i.value, S, h(C, S));
373
- _(t.shadows, "shadowMap.enabled"), _(t.toneMapping, "toneMapping"), _(t.shadowMapType, "shadowMap.type"), ar < 150 && _(!t.useLegacyLights, "physicallyCorrectLights"), _(t.outputColorSpace, "outputColorSpace"), _(t.toneMappingExposure, "toneMappingExposure");
374
- const w = h(t.clearColor, "clearColor");
375
- w && i.value.setClearColor(
376
- w ? qt(w) : new V(0)
369
+ if (w !== void 0)
370
+ return w;
371
+ const v = S();
372
+ return v !== void 0 ? v : de(d, M);
373
+ }, b = (C, M) => Kt(a.value, M, y(C, M));
374
+ b(t.shadows, "shadowMap.enabled"), b(t.toneMapping, "toneMapping"), b(t.shadowMapType, "shadowMap.type"), rr < 150 && b(!t.useLegacyLights, "physicallyCorrectLights"), b(t.outputColorSpace, "outputColorSpace"), b(t.toneMappingExposure, "toneMappingExposure");
375
+ const x = y(t.clearColor, "clearColor");
376
+ x && a.value.setClearColor(
377
+ x ? Ft(x) : new W(0)
377
378
  // default clear color is not easily/efficiently retrievable from three
378
379
  );
379
380
  });
380
- const { pause: u, resume: m, onLoop: y } = te();
381
- return y(() => {
382
- a.value && !M(n) && i.value.render(e, a.value);
383
- }), m(), F(() => {
384
- u(), i.value.dispose(), i.value.forceContextLoss();
381
+ const { pause: u, resume: f, onLoop: h } = re();
382
+ return h(() => {
383
+ i.value && !_(o) && a.value.render(e, i.value);
384
+ }), f(), G(() => {
385
+ u(), a.value.dispose(), a.value.forceContextLoss();
385
386
  }), {
386
- renderer: i
387
+ renderer: a
387
388
  };
388
389
  }
389
- const de = (e) => typeof e == "function", ur = (e) => !!e && e.constructor === Array;
390
- function cr(e) {
390
+ const fe = (e) => typeof e == "function", nr = (e) => !!e && e.constructor === Array;
391
+ function sr(e) {
391
392
  const r = { nodes: {}, materials: {} };
392
393
  return e && e.traverse((t) => {
393
394
  t.name && (r.nodes[t.name] = t), t.material && !r.materials[t.material.name] && (r.materials[t.material.name] = t.material);
394
395
  }), r;
395
396
  }
396
- async function Ur(e, r, t, n, s) {
397
- const { logError: a } = T(), o = new e();
398
- s && s(o), t && t(o);
397
+ async function $r(e, r, t, o, s) {
398
+ const { logError: i } = A(), n = new e();
399
+ s && s(n), t && t(n);
399
400
  const l = (Array.isArray(r) ? r : [r]).map(
400
- (c) => new Promise((p, d) => {
401
- o.load(
401
+ (c) => new Promise((m, d) => {
402
+ n.load(
402
403
  c,
403
404
  (u) => {
404
- u.scene && Object.assign(u, cr(u.scene)), p(u);
405
+ u.scene && Object.assign(u, sr(u.scene)), m(u);
405
406
  },
406
- n,
407
- (u) => d(a("[useLoader] - Failed to load resource", u))
407
+ o,
408
+ (u) => d(i("[useLoader] - Failed to load resource", u))
408
409
  );
409
410
  })
410
411
  );
411
- return ur(r) ? await Promise.all(l) : await l[0];
412
+ return nr(r) ? await Promise.all(l) : await l[0];
412
413
  }
413
- async function Fr(e) {
414
- const r = new rt(), t = new nt(r), n = (s) => new Promise((a, o) => {
414
+ async function Nr(e, r) {
415
+ const t = new Ze(r), o = (s) => new Promise((i, n) => {
415
416
  t.load(
416
417
  s,
417
- (i) => a(i),
418
+ (a) => i(a),
418
419
  () => null,
419
420
  () => {
420
- o(new Error("[useTextures] - Failed to load texture"));
421
+ n(new Error("[useTextures] - Failed to load texture"));
421
422
  }
422
423
  );
423
424
  });
424
- if (or(e)) {
425
- const s = await Promise.all(e.map((a) => n(a)));
425
+ if (Zt(e)) {
426
+ const s = await Promise.all(e.map((i) => o(i)));
426
427
  return e.length > 1 ? s : s[0];
427
428
  } else {
428
429
  const {
429
430
  map: s,
430
- displacementMap: a,
431
- normalMap: o,
432
- roughnessMap: i,
431
+ displacementMap: i,
432
+ normalMap: n,
433
+ roughnessMap: a,
433
434
  metalnessMap: l,
434
435
  aoMap: c,
435
- alphaMap: p,
436
+ alphaMap: m,
436
437
  matcap: d
437
438
  } = e;
438
439
  return {
439
- map: s ? await n(s) : null,
440
- displacementMap: a ? await n(a) : null,
441
- normalMap: o ? await n(o) : null,
442
- roughnessMap: i ? await n(i) : null,
443
- metalnessMap: l ? await n(l) : null,
444
- aoMap: c ? await n(c) : null,
445
- alphaMap: p ? await n(p) : null,
446
- matcap: d ? await n(d) : null
440
+ map: s ? await o(s) : null,
441
+ displacementMap: i ? await o(i) : null,
442
+ normalMap: n ? await o(n) : null,
443
+ roughnessMap: a ? await o(a) : null,
444
+ metalnessMap: l ? await o(l) : null,
445
+ aoMap: c ? await o(c) : null,
446
+ alphaMap: m ? await o(m) : null,
447
+ matcap: d ? await o(d) : null
447
448
  };
448
449
  }
449
450
  }
450
- const dr = (e, { renderer: r, camera: t, raycaster: n }) => {
451
- const s = P(() => r.value.domElement), { x: a, y: o } = wt({ target: s }), { width: i, height: l, top: c, left: p } = bt(s), d = ({ x: g, y: E }) => {
451
+ const ir = (e, { renderer: r, camera: t, raycaster: o }) => {
452
+ const s = T(() => r.value.domElement), { x: i, y: n } = gt({ target: s }), { width: a, height: l, top: c, left: m } = vt(s), d = ({ x: v, y: E }) => {
452
453
  if (s.value)
453
454
  return {
454
- x: (g - p.value) / i.value * 2 - 1,
455
+ x: (v - m.value) / a.value * 2 - 1,
455
456
  y: -((E - c.value) / l.value) * 2 + 1
456
457
  };
457
- }, u = ({ x: g, y: E }) => {
458
+ }, u = ({ x: v, y: E }) => {
458
459
  if (t.value)
459
- return n.value.setFromCamera(new ot(g, E), t.value), n.value.intersectObjects(e.value, !1);
460
- }, m = (g) => {
460
+ return o.value.setFromCamera(new et(v, E), t.value), o.value.intersectObjects(e.value, !1);
461
+ }, f = (v) => {
461
462
  const E = d({
462
- x: (g == null ? void 0 : g.clientX) ?? a.value,
463
- y: (g == null ? void 0 : g.clientY) ?? o.value
463
+ x: (v == null ? void 0 : v.clientX) ?? i.value,
464
+ y: (v == null ? void 0 : v.clientY) ?? n.value
464
465
  });
465
466
  return E ? u(E) || [] : [];
466
- }, y = P(() => m()), f = H(), h = H(), _ = (g, E) => {
467
- g.trigger({ event: E, intersects: m(E) });
468
- }, w = (g) => {
469
- _(h, g);
467
+ }, h = T(() => f()), p = H(), y = H(), b = (v, E) => {
468
+ v.trigger({ event: E, intersects: f(E) });
469
+ }, x = (v) => {
470
+ b(y, v);
470
471
  };
471
472
  let C;
472
- const S = (g) => {
473
+ const M = (v) => {
473
474
  var E;
474
- C = (E = m(g)[0]) == null ? void 0 : E.object;
475
- }, b = (g) => {
475
+ C = (E = f(v)[0]) == null ? void 0 : E.object;
476
+ }, w = (v) => {
476
477
  var E;
477
- g instanceof PointerEvent && C === ((E = m(g)[0]) == null ? void 0 : E.object) && _(f, g);
478
- }, x = (g) => h.trigger({ event: g, intersects: [] });
479
- return s.value.addEventListener("pointerup", b), s.value.addEventListener("pointerdown", S), s.value.addEventListener("pointermove", w), s.value.addEventListener("pointerleave", x), F(() => {
480
- s != null && s.value && (s.value.removeEventListener("pointerup", b), s.value.removeEventListener("pointerdown", S), s.value.removeEventListener("pointermove", w), s.value.removeEventListener("pointerleave", x));
478
+ v instanceof PointerEvent && C === ((E = f(v)[0]) == null ? void 0 : E.object) && b(p, v);
479
+ }, S = (v) => y.trigger({ event: v, intersects: [] });
480
+ return s.value.addEventListener("pointerup", w), s.value.addEventListener("pointerdown", M), s.value.addEventListener("pointermove", x), s.value.addEventListener("pointerleave", S), G(() => {
481
+ s != null && s.value && (s.value.removeEventListener("pointerup", w), s.value.removeEventListener("pointerdown", M), s.value.removeEventListener("pointermove", x), s.value.removeEventListener("pointerleave", S));
481
482
  }), {
482
- intersects: y,
483
- onClick: (g) => f.on(g).off,
484
- onPointerMove: (g) => h.on(g).off
483
+ intersects: h,
484
+ onClick: (v) => p.on(v).off,
485
+ onPointerMove: (v) => y.on(v).off
485
486
  };
486
487
  };
487
- function Gr() {
488
- const { logWarning: e } = T();
489
- function r(a, o, i) {
488
+ function Vr() {
489
+ const { logWarning: e } = A();
490
+ function r(i, n, a) {
490
491
  let l = null;
491
- return a.traverse((c) => {
492
- c[o] === i && (l = c);
493
- }), l || e(`Child with ${o} '${i}' not found.`), l;
492
+ return i.traverse((c) => {
493
+ c[n] === a && (l = c);
494
+ }), l || e(`Child with ${n} '${a}' not found.`), l;
494
495
  }
495
- function t(a, o, i) {
496
+ function t(i, n, a) {
496
497
  const l = [];
497
- return a.traverse((c) => {
498
- c[o].includes(i) && l.push(c);
499
- }), l.length || e(`Children with ${o} '${i}' not found.`), l;
498
+ return i.traverse((c) => {
499
+ c[n].includes(a) && l.push(c);
500
+ }), l.length || e(`Children with ${n} '${a}' not found.`), l;
500
501
  }
501
- function n(a, o) {
502
- return r(a, "name", o);
502
+ function o(i, n) {
503
+ return r(i, "name", n);
503
504
  }
504
- function s(a, o) {
505
- return t(a, "name", o);
505
+ function s(i, n) {
506
+ return t(i, "name", n);
506
507
  }
507
508
  return {
508
509
  seek: r,
509
- seekByName: n,
510
+ seekByName: o,
510
511
  seekAll: t,
511
512
  seekAllByName: s
512
513
  };
513
514
  }
514
- const fr = ({ scene: e, contextParts: r }) => {
515
- const t = ge({
515
+ const ar = ({ scene: e, contextParts: r }) => {
516
+ const t = ve({
516
517
  click: /* @__PURE__ */ new Map(),
517
518
  pointerMove: /* @__PURE__ */ new Map(),
518
519
  pointerEnter: /* @__PURE__ */ new Map(),
519
520
  pointerLeave: /* @__PURE__ */ new Map()
520
- }), n = R(/* @__PURE__ */ new Set()), s = (u) => {
521
- n.value.add(u);
522
- }, a = (u) => {
523
- n.value.delete(u);
524
- }, o = (u) => {
525
- Object.values(t).forEach((m) => m.delete(u)), a(u);
521
+ }), o = R(/* @__PURE__ */ new Set()), s = (u) => {
522
+ o.value.add(u);
526
523
  }, i = (u) => {
527
- const { onClick: m, onPointerMove: y, onPointerEnter: f, onPointerLeave: h } = u;
528
- m && t.click.set(u, m), y && t.pointerMove.set(u, y), f && t.pointerEnter.set(u, f), h && t.pointerLeave.set(u, h);
524
+ o.value.delete(u);
525
+ }, n = (u) => {
526
+ Object.values(t).forEach((f) => f.delete(u)), i(u);
527
+ }, a = (u) => {
528
+ const { onClick: f, onPointerMove: h, onPointerEnter: p, onPointerLeave: y } = u;
529
+ f && t.click.set(u, f), h && t.pointerMove.set(u, h), p && t.pointerEnter.set(u, p), y && t.pointerLeave.set(u, y);
529
530
  };
530
- e.userData.tres__registerAtPointerEventHandler = i, e.userData.tres__deregisterAtPointerEventHandler = o, e.userData.tres__registerBlockingObjectAtPointerEventHandler = s, e.userData.tres__deregisterBlockingObjectAtPointerEventHandler = a;
531
- const l = P(
532
- () => tr(
531
+ e.userData.tres__registerAtPointerEventHandler = a, e.userData.tres__deregisterAtPointerEventHandler = n, e.userData.tres__registerBlockingObjectAtPointerEventHandler = s, e.userData.tres__deregisterBlockingObjectAtPointerEventHandler = i;
532
+ const l = T(
533
+ () => qt(
533
534
  [
534
- ...Array.from(n.value),
535
+ ...Array.from(o.value),
535
536
  ...Object.values(t).map((u) => Array.from(u.keys())).flat()
536
537
  ],
537
538
  ({ uuid: u }) => u
538
539
  )
539
- ), { onClick: c, onPointerMove: p } = dr(l, r);
540
- c(({ intersects: u, event: m }) => {
541
- var y;
542
- u.length && ((y = t.click.get(u[0].object)) == null || y(u[0], m));
540
+ ), { onClick: c, onPointerMove: m } = ir(l, r);
541
+ c(({ intersects: u, event: f }) => {
542
+ var h;
543
+ u.length && ((h = t.click.get(u[0].object)) == null || h(u[0], f));
543
544
  });
544
545
  let d;
545
- return p(({ intersects: u, event: m }) => {
546
- var w, C, S, b;
547
- const y = (w = u == null ? void 0 : u[0]) == null ? void 0 : w.object, { pointerLeave: f, pointerEnter: h, pointerMove: _ } = t;
548
- d && d !== y && ((C = f.get(d)) == null || C(d, m)), y && (d !== y && ((S = h.get(y)) == null || S(u[0], m)), (b = _.get(y)) == null || b(u[0], m)), d = y || null;
546
+ return m(({ intersects: u, event: f }) => {
547
+ var x, C, M, w;
548
+ const h = (x = u == null ? void 0 : u[0]) == null ? void 0 : x.object, { pointerLeave: p, pointerEnter: y, pointerMove: b } = t;
549
+ d && d !== h && ((C = p.get(d)) == null || C(d, f)), h && (d !== h && ((M = y.get(h)) == null || M(u[0], f)), (w = b.get(h)) == null || w(u[0], f)), d = h || null;
549
550
  }), {
550
- registerObject: i,
551
- deregisterObject: o
551
+ registerObject: a,
552
+ deregisterObject: n
552
553
  };
553
554
  };
554
555
  function Se(e) {
555
556
  let r = 0;
556
557
  return e.traverse((t) => {
557
558
  if (t.isMesh && t.geometry) {
558
- const n = t.geometry, s = n.attributes.position.count * 3 * Float32Array.BYTES_PER_ELEMENT, a = n.index ? n.index.count * Uint32Array.BYTES_PER_ELEMENT : 0, o = n.attributes.normal ? n.attributes.normal.count * 3 * Float32Array.BYTES_PER_ELEMENT : 0, i = n.attributes.uv ? n.attributes.uv.count * 2 * Float32Array.BYTES_PER_ELEMENT : 0, l = s + a + o + i;
559
+ const o = t.geometry, s = o.attributes.position.count * 3 * Float32Array.BYTES_PER_ELEMENT, i = o.index ? o.index.count * Uint32Array.BYTES_PER_ELEMENT : 0, n = o.attributes.normal ? o.attributes.normal.count * 3 * Float32Array.BYTES_PER_ELEMENT : 0, a = o.attributes.uv ? o.attributes.uv.count * 2 * Float32Array.BYTES_PER_ELEMENT : 0, l = s + i + n + a;
559
560
  r += l;
560
561
  }
561
562
  }), r;
562
563
  }
563
- function pr(e) {
564
+ function lr(e) {
564
565
  return (e / 1024).toFixed(2);
565
566
  }
566
- const X = R({}), re = (e) => Object.assign(X.value, e);
567
- function mr({
567
+ const Z = R({}), oe = (e) => Object.assign(Z.value, e);
568
+ function ur(e, r, t = 10) {
569
+ const o = _(e) ? ht() : yt(T(() => _(r).parentElement)), s = q(ue(o.width, t)), i = q(ue(o.height, t)), n = T(() => s.value / i.value);
570
+ return {
571
+ height: i,
572
+ width: s,
573
+ aspectRatio: n
574
+ };
575
+ }
576
+ function cr({
568
577
  scene: e,
569
578
  canvas: r,
570
579
  windowSize: t,
571
- disableRender: n,
580
+ disableRender: o,
572
581
  rendererOptions: s
573
582
  }) {
574
- const a = P(
575
- () => M(t) ? _t() : Et(M(r).parentElement)
576
- ), o = D({
577
- width: 0,
578
- height: 0
579
- }), i = Mt(o, 10), l = O(() => {
580
- o.value = {
581
- width: a.value.width.value,
582
- height: a.value.height.value
583
- };
584
- }), c = P(() => i.value.width / i.value.height), p = {
585
- height: P(() => i.value.height),
586
- width: P(() => i.value.width),
587
- aspectRatio: c
588
- }, d = D(e), {
589
- camera: u,
590
- cameras: m,
591
- registerCamera: y,
592
- deregisterCamera: f,
593
- setCameraActive: h
594
- } = Gt({ sizes: p, scene: e }), { renderer: _ } = lr(
583
+ const i = ur(t, r), n = j(e), {
584
+ camera: a,
585
+ cameras: l,
586
+ registerCamera: c,
587
+ deregisterCamera: m,
588
+ setCameraActive: d
589
+ } = Vt({ sizes: i, scene: e }), { renderer: u } = or(
595
590
  {
596
591
  scene: e,
597
592
  canvas: r,
598
593
  options: s,
599
- contextParts: { sizes: p, camera: u },
600
- disableRender: n
594
+ contextParts: { sizes: i, camera: a },
595
+ disableRender: o
601
596
  }
602
- ), w = {
603
- sizes: p,
604
- scene: d,
605
- camera: u,
606
- cameras: Re(m),
607
- renderer: _,
608
- raycaster: D(new st()),
597
+ ), f = {
598
+ sizes: i,
599
+ scene: n,
600
+ camera: a,
601
+ cameras: q(l),
602
+ renderer: u,
603
+ raycaster: j(new tt()),
609
604
  controls: R(null),
610
605
  perf: {
611
606
  maxFrames: 160,
@@ -619,71 +614,71 @@ function mr({
619
614
  accumulator: []
620
615
  }
621
616
  },
622
- extend: re,
623
- registerCamera: y,
624
- setCameraActive: h,
625
- deregisterCamera: f
617
+ extend: oe,
618
+ registerCamera: c,
619
+ setCameraActive: d,
620
+ deregisterCamera: m
626
621
  };
627
- q("useTres", w);
628
- const C = 100, S = Ct({ every: C }), { isSupported: b, memory: x } = St({ interval: C }), g = 160;
629
- let E = performance.now();
630
- const Te = ({ timestamp: $ }) => {
631
- w.scene.value && (w.perf.memory.allocatedMem = Se(w.scene.value)), $ - E >= C && (E = $, w.perf.fps.accumulator.push(S.value), w.perf.fps.accumulator.length > g && w.perf.fps.accumulator.shift(), w.perf.fps.value = S.value, b.value && x.value && (w.perf.memory.accumulator.push(x.value.usedJSHeapSize / 1024 / 1024), w.perf.memory.accumulator.length > g && w.perf.memory.accumulator.shift(), w.perf.memory.currentMem = w.perf.memory.accumulator.reduce((De, Be) => De + Be, 0) / w.perf.memory.accumulator.length));
622
+ K("useTres", f);
623
+ const h = 100, p = wt({ every: h }), { isSupported: y, memory: b } = bt({ interval: h }), x = 160;
624
+ let C = performance.now();
625
+ const M = ({ timestamp: I }) => {
626
+ f.scene.value && (f.perf.memory.allocatedMem = Se(f.scene.value)), I - C >= h && (C = I, f.perf.fps.accumulator.push(p.value), f.perf.fps.accumulator.length > x && f.perf.fps.accumulator.shift(), f.perf.fps.value = p.value, y.value && b.value && (f.perf.memory.accumulator.push(b.value.usedJSHeapSize / 1024 / 1024), f.perf.memory.accumulator.length > x && f.perf.memory.accumulator.shift(), f.perf.memory.currentMem = f.perf.memory.accumulator.reduce((Le, Oe) => Le + Oe, 0) / f.perf.memory.accumulator.length));
632
627
  };
633
- let G = 0;
634
- const Le = 1, { pause: Oe, resume: Rr } = we(({ delta: $ }) => {
635
- window.__TRES__DEVTOOLS__ && (Te({ timestamp: performance.now() }), G += $, G >= Le && (window.__TRES__DEVTOOLS__.cb(w), G = 0));
628
+ let w = 0;
629
+ const S = 1, { pause: v, resume: E } = be(({ delta: I }) => {
630
+ window.__TRES__DEVTOOLS__ && (M({ timestamp: performance.now() }), w += I, w >= S && (window.__TRES__DEVTOOLS__.cb(f), w = 0));
636
631
  }, { immediate: !0 });
637
- return F(() => {
638
- l(), Oe();
639
- }), w;
632
+ return G(() => {
633
+ v();
634
+ }), f;
640
635
  }
641
- function gr() {
642
- const e = $e("useTres");
636
+ function dr() {
637
+ const e = je("useTres");
643
638
  if (!e)
644
639
  throw new Error("useTresContext must be used together with useTresContextProvider");
645
640
  return e;
646
641
  }
647
- const Jr = gr;
648
- let v = null;
649
- const { logError: fe } = T(), Y = [
642
+ const zr = dr;
643
+ let g = null;
644
+ const { logError: pe } = A(), Y = [
650
645
  "onClick",
651
646
  "onPointerMove",
652
647
  "onPointerEnter",
653
648
  "onPointerLeave"
654
- ], vr = {
655
- createElement(e, r, t, n) {
656
- var o, i;
657
- if (n || (n = {}), n.args || (n.args = []), e === "template" || Zt(e))
649
+ ], fr = {
650
+ createElement(e, r, t, o) {
651
+ var n, a;
652
+ if (o || (o = {}), o.args || (o.args = []), e === "template" || Qt(e))
658
653
  return null;
659
- let s = e.replace("Tres", ""), a;
654
+ let s = e.replace("Tres", ""), i;
660
655
  if (e === "primitive") {
661
- (n == null ? void 0 : n.object) === void 0 && fe("Tres primitives need a prop 'object'");
662
- const l = n.object;
663
- s = l.type, a = Object.assign(l, { type: s, attach: n.attach, primitive: !0 });
656
+ (o == null ? void 0 : o.object) === void 0 && pe("Tres primitives need a prop 'object'");
657
+ const l = o.object;
658
+ s = l.type, i = Object.assign(l, { type: s, attach: o.attach, primitive: !0 });
664
659
  } else {
665
- const l = X.value[s];
666
- l || fe(`${s} is not defined on the THREE namespace. Use extend to add it to the catalog.`), a = new l(...n.args);
660
+ const l = Z.value[s];
661
+ l || pe(`${s} is not defined on the THREE namespace. Use extend to add it to the catalog.`), i = new l(...o.args);
667
662
  }
668
- return a.isCamera && (n != null && n.position || a.position.set(3, 3, 3), n != null && n.lookAt || a.lookAt(0, 0, 0)), (n == null ? void 0 : n.attach) === void 0 && (a.isMaterial ? a.attach = "material" : a.isBufferGeometry && (a.attach = "geometry")), a.isObject3D && ((o = n == null ? void 0 : n.material) != null && o.isMaterial && (a.userData.tres__materialViaProp = !0), (i = n == null ? void 0 : n.geometry) != null && i.isBufferGeometry && (a.userData.tres__geometryViaProp = !0)), a.userData = {
669
- ...a.userData,
663
+ return i.isCamera && (o != null && o.position || i.position.set(3, 3, 3), o != null && o.lookAt || i.lookAt(0, 0, 0)), (o == null ? void 0 : o.attach) === void 0 && (i.isMaterial ? i.attach = "material" : i.isBufferGeometry && (i.attach = "geometry")), i.isObject3D && ((n = o == null ? void 0 : o.material) != null && n.isMaterial && (i.userData.tres__materialViaProp = !0), (a = o == null ? void 0 : o.geometry) != null && a.isBufferGeometry && (i.userData.tres__geometryViaProp = !0)), i.userData = {
664
+ ...i.userData,
670
665
  tres__name: s
671
- }, a;
666
+ }, i;
672
667
  },
673
668
  insert(e, r) {
674
- var n, s, a, o;
675
- r && r.isScene && (v = r);
676
- const t = r || v;
669
+ var o, s, i, n;
670
+ r && r.isScene && (g = r);
671
+ const t = r || g;
677
672
  if (e != null && e.isObject3D) {
678
673
  if (e != null && e.isCamera) {
679
- if (!(v != null && v.userData.tres__registerCamera))
674
+ if (!(g != null && g.userData.tres__registerCamera))
680
675
  throw "could not find tres__registerCamera on scene's userData";
681
- (s = v == null ? void 0 : (n = v.userData).tres__registerCamera) == null || s.call(n, e);
676
+ (s = g == null ? void 0 : (o = g.userData).tres__registerCamera) == null || s.call(o, e);
682
677
  }
683
- if (e && Y.some((i) => e[i])) {
684
- if (!(v != null && v.userData.tres__registerAtPointerEventHandler))
678
+ if (e && Y.some((a) => e[a])) {
679
+ if (!(g != null && g.userData.tres__registerAtPointerEventHandler))
685
680
  throw "could not find tres__registerAtPointerEventHandler on scene's userData";
686
- (o = v == null ? void 0 : (a = v.userData).tres__registerAtPointerEventHandler) == null || o.call(a, e);
681
+ (n = g == null ? void 0 : (i = g.userData).tres__registerAtPointerEventHandler) == null || n.call(i, e);
687
682
  }
688
683
  }
689
684
  e != null && e.isObject3D && (t != null && t.isObject3D) ? (t.add(e), e.dispatchEvent({ type: "added" })) : e != null && e.isFog ? t.fog = e : typeof (e == null ? void 0 : e.attach) == "string" && (e.__previousAttach = e[t == null ? void 0 : t.attach], t && (t[e.attach] = e));
@@ -692,63 +687,63 @@ const { logError: fe } = T(), Y = [
692
687
  var r, t;
693
688
  if (e) {
694
689
  if (e.isObject3D) {
695
- const n = e, s = (c) => {
690
+ const o = e, s = (c) => {
696
691
  var d, u;
697
- const p = c;
698
- c.userData.tres__materialViaProp || ((d = p.material) == null || d.dispose(), p.material = void 0), c.userData.tres__geometryViaProp || ((u = p.geometry) == null || u.dispose(), p.geometry = void 0);
699
- }, a = v == null ? void 0 : v.userData.tres__deregisterAtPointerEventHandler, o = v == null ? void 0 : v.userData.tres__deregisterBlockingObjectAtPointerEventHandler, i = (c) => {
700
- var p, d;
701
- if (!o)
692
+ const m = c;
693
+ c.userData.tres__materialViaProp || ((d = m.material) == null || d.dispose(), m.material = void 0), c.userData.tres__geometryViaProp || ((u = m.geometry) == null || u.dispose(), m.geometry = void 0);
694
+ }, i = g == null ? void 0 : g.userData.tres__deregisterAtPointerEventHandler, n = g == null ? void 0 : g.userData.tres__deregisterBlockingObjectAtPointerEventHandler, a = (c) => {
695
+ var m, d;
696
+ if (!n)
702
697
  throw "could not find tres__deregisterBlockingObjectAtPointerEventHandler on scene's userData";
703
- if ((d = v == null ? void 0 : (p = v.userData).tres__deregisterBlockingObjectAtPointerEventHandler) == null || d.call(p, c), !a)
698
+ if ((d = g == null ? void 0 : (m = g.userData).tres__deregisterBlockingObjectAtPointerEventHandler) == null || d.call(m, c), !i)
704
699
  throw "could not find tres__deregisterAtPointerEventHandler on scene's userData";
705
- c && Y.some((u) => c[u]) && (a == null || a(c));
700
+ c && Y.some((u) => c[u]) && (i == null || i(c));
706
701
  }, l = (c) => {
707
- const p = v == null ? void 0 : v.userData.tres__deregisterCamera;
708
- if (!p)
702
+ const m = g == null ? void 0 : g.userData.tres__deregisterCamera;
703
+ if (!m)
709
704
  throw "could not find tres__deregisterCamera on scene's userData";
710
- c.isCamera && (p == null || p(c));
705
+ c.isCamera && (m == null || m(c));
711
706
  };
712
- (r = e.removeFromParent) == null || r.call(e), n.traverse((c) => {
713
- s(c), l(c), i == null || i(c);
714
- }), s(n), l(n), i == null || i(n);
707
+ (r = e.removeFromParent) == null || r.call(e), o.traverse((c) => {
708
+ s(c), l(c), a == null || a(c);
709
+ }), s(o), l(o), a == null || a(o);
715
710
  }
716
711
  (t = e.dispose) == null || t.call(e);
717
712
  }
718
713
  },
719
- patchProp(e, r, t, n) {
720
- var s, a, o, i;
714
+ patchProp(e, r, t, o) {
715
+ var s, i, n, a;
721
716
  if (e) {
722
717
  let l = e, c = r;
723
718
  if (e.isObject3D && c === "blocks-pointer-events") {
724
- n || n === "" ? (a = v == null ? void 0 : (s = v.userData).tres__registerBlockingObjectAtPointerEventHandler) == null || a.call(s, e) : (i = v == null ? void 0 : (o = v.userData).tres__deregisterBlockingObjectAtPointerEventHandler) == null || i.call(o, e);
719
+ o || o === "" ? (i = g == null ? void 0 : (s = g.userData).tres__registerBlockingObjectAtPointerEventHandler) == null || i.call(s, e) : (a = g == null ? void 0 : (n = g.userData).tres__deregisterBlockingObjectAtPointerEventHandler) == null || a.call(n, e);
725
720
  return;
726
721
  }
727
- let p = I(c), d = l == null ? void 0 : l[p];
722
+ let m = N(c), d = l == null ? void 0 : l[m];
728
723
  if (c === "args") {
729
- const m = e, y = t ?? [], f = n ?? [], h = e.userData.tres__name || e.type;
730
- h && y.length && !nr(y, f) && (l = Object.assign(m, new X.value[h](...n)));
724
+ const f = e, h = t ?? [], p = o ?? [], y = e.userData.tres__name || e.type;
725
+ y && h.length && !Xt(h, p) && (l = Object.assign(f, new Z.value[y](...o)));
731
726
  return;
732
727
  }
733
728
  if (l.type === "BufferGeometry") {
734
729
  if (c === "args")
735
730
  return;
736
731
  l.setAttribute(
737
- I(c),
738
- new it(...n)
732
+ N(c),
733
+ new rt(...o)
739
734
  );
740
735
  return;
741
736
  }
742
737
  if (c.includes("-") && d === void 0) {
743
- const m = c.split("-");
744
- d = m.reduce((y, f) => y[I(f)], l), c = m.pop(), p = c.toLowerCase(), d != null && d.set || (l = m.reduce((y, f) => y[I(f)], l));
738
+ const f = c.split("-");
739
+ d = f.reduce((h, p) => h[N(p)], l), c = f.pop(), m = c.toLowerCase(), d != null && d.set || (l = f.reduce((h, p) => h[N(p)], l));
745
740
  }
746
- let u = n;
747
- if (u === "" && (u = !0), de(d)) {
748
- Y.includes(r) || (Array.isArray(u) ? e[p](...u) : e[p](u));
741
+ let u = o;
742
+ if (u === "" && (u = !0), fe(d)) {
743
+ Y.includes(r) || (Array.isArray(u) ? e[m](...u) : e[m](u));
749
744
  return;
750
745
  }
751
- !(d != null && d.set) && !de(d) ? l[p] = u : d.constructor === u.constructor && (d != null && d.copy) ? d == null || d.copy(u) : Array.isArray(u) ? d.set(...u) : !d.isColor && d.setScalar ? d.setScalar(u) : d.set(u);
746
+ !(d != null && d.set) && !fe(d) ? l[m] = u : d.constructor === u.constructor && (d != null && d.copy) ? d == null || d.copy(u) : Array.isArray(u) ? d.set(...u) : !d.isColor && d.setScalar ? d.setScalar(u) : d.set(u);
752
747
  }
753
748
  },
754
749
  parentNode(e) {
@@ -763,71 +758,71 @@ const { logError: fe } = T(), Y = [
763
758
  setScopeId: () => void 0,
764
759
  cloneNode: () => void 0,
765
760
  insertStaticContent: () => void 0
766
- }, { render: hr } = Ie(vr);
767
- re(ve);
768
- function yr() {
769
- return xe().__VUE_DEVTOOLS_GLOBAL_HOOK__;
761
+ }, { render: pr } = He(fr);
762
+ oe(he);
763
+ function mr() {
764
+ return Pe().__VUE_DEVTOOLS_GLOBAL_HOOK__;
770
765
  }
771
- function xe() {
772
- return typeof navigator < "u" && typeof window < "u" ? window : typeof global < "u" ? global : {};
766
+ function Pe() {
767
+ return typeof navigator < "u" && typeof window < "u" ? window : typeof globalThis < "u" ? globalThis : {};
773
768
  }
774
- const wr = typeof Proxy == "function", br = "devtools-plugin:setup", _r = "plugin:settings:set";
775
- let L, Z;
776
- function Er() {
769
+ const gr = typeof Proxy == "function", vr = "devtools-plugin:setup", hr = "plugin:settings:set";
770
+ let L, ee;
771
+ function yr() {
777
772
  var e;
778
- return L !== void 0 || (typeof window < "u" && window.performance ? (L = !0, Z = window.performance) : typeof global < "u" && (!((e = global.perf_hooks) === null || e === void 0) && e.performance) ? (L = !0, Z = global.perf_hooks.performance) : L = !1), L;
773
+ return L !== void 0 || (typeof window < "u" && window.performance ? (L = !0, ee = window.performance) : typeof globalThis < "u" && (!((e = globalThis.perf_hooks) === null || e === void 0) && e.performance) ? (L = !0, ee = globalThis.perf_hooks.performance) : L = !1), L;
779
774
  }
780
- function Mr() {
781
- return Er() ? Z.now() : Date.now();
775
+ function wr() {
776
+ return yr() ? ee.now() : Date.now();
782
777
  }
783
- class Cr {
778
+ class br {
784
779
  constructor(r, t) {
785
780
  this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin = r, this.hook = t;
786
- const n = {};
781
+ const o = {};
787
782
  if (r.settings)
788
- for (const o in r.settings) {
789
- const i = r.settings[o];
790
- n[o] = i.defaultValue;
783
+ for (const n in r.settings) {
784
+ const a = r.settings[n];
785
+ o[n] = a.defaultValue;
791
786
  }
792
787
  const s = `__vue-devtools-plugin-settings__${r.id}`;
793
- let a = Object.assign({}, n);
788
+ let i = Object.assign({}, o);
794
789
  try {
795
- const o = localStorage.getItem(s), i = JSON.parse(o);
796
- Object.assign(a, i);
790
+ const n = localStorage.getItem(s), a = JSON.parse(n);
791
+ Object.assign(i, a);
797
792
  } catch {
798
793
  }
799
794
  this.fallbacks = {
800
795
  getSettings() {
801
- return a;
796
+ return i;
802
797
  },
803
- setSettings(o) {
798
+ setSettings(n) {
804
799
  try {
805
- localStorage.setItem(s, JSON.stringify(o));
800
+ localStorage.setItem(s, JSON.stringify(n));
806
801
  } catch {
807
802
  }
808
- a = o;
803
+ i = n;
809
804
  },
810
805
  now() {
811
- return Mr();
806
+ return wr();
812
807
  }
813
- }, t && t.on(_r, (o, i) => {
814
- o === this.plugin.id && this.fallbacks.setSettings(i);
808
+ }, t && t.on(hr, (n, a) => {
809
+ n === this.plugin.id && this.fallbacks.setSettings(a);
815
810
  }), this.proxiedOn = new Proxy({}, {
816
- get: (o, i) => this.target ? this.target.on[i] : (...l) => {
811
+ get: (n, a) => this.target ? this.target.on[a] : (...l) => {
817
812
  this.onQueue.push({
818
- method: i,
813
+ method: a,
819
814
  args: l
820
815
  });
821
816
  }
822
817
  }), this.proxiedTarget = new Proxy({}, {
823
- get: (o, i) => this.target ? this.target[i] : i === "on" ? this.proxiedOn : Object.keys(this.fallbacks).includes(i) ? (...l) => (this.targetQueue.push({
824
- method: i,
818
+ get: (n, a) => this.target ? this.target[a] : a === "on" ? this.proxiedOn : Object.keys(this.fallbacks).includes(a) ? (...l) => (this.targetQueue.push({
819
+ method: a,
825
820
  args: l,
826
821
  resolve: () => {
827
822
  }
828
- }), this.fallbacks[i](...l)) : (...l) => new Promise((c) => {
823
+ }), this.fallbacks[a](...l)) : (...l) => new Promise((c) => {
829
824
  this.targetQueue.push({
830
- method: i,
825
+ method: a,
831
826
  args: l,
832
827
  resolve: c
833
828
  });
@@ -842,24 +837,24 @@ class Cr {
842
837
  t.resolve(await this.target[t.method](...t.args));
843
838
  }
844
839
  }
845
- function Sr(e, r) {
846
- const t = e, n = xe(), s = yr(), a = wr && t.enableEarlyProxy;
847
- if (s && (n.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !a))
848
- s.emit(br, e, r);
840
+ function _r(e, r) {
841
+ const t = e, o = Pe(), s = mr(), i = gr && t.enableEarlyProxy;
842
+ if (s && (o.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !i))
843
+ s.emit(vr, e, r);
849
844
  else {
850
- const o = a ? new Cr(t, s) : null;
851
- (n.__VUE_DEVTOOLS_PLUGINS__ = n.__VUE_DEVTOOLS_PLUGINS__ || []).push({
845
+ const n = i ? new br(t, s) : null;
846
+ (o.__VUE_DEVTOOLS_PLUGINS__ = o.__VUE_DEVTOOLS_PLUGINS__ || []).push({
852
847
  pluginDescriptor: t,
853
848
  setupFn: r,
854
- proxy: o
855
- }), o && r(o.proxiedTarget);
849
+ proxy: n
850
+ }), n && r(n.proxiedTarget);
856
851
  }
857
852
  }
858
- function xr(e, r) {
853
+ function Er(e, r) {
859
854
  const t = `▲ ■ ●${e}`;
860
855
  typeof __VUE_DEVTOOLS_TOAST__ == "function" ? __VUE_DEVTOOLS_TOAST__(t, r) : r === "error" ? console.error(t) : r === "warn" ? console.warn(t) : console.log(t);
861
856
  }
862
- const Pe = (e) => {
857
+ const ke = (e) => {
863
858
  const r = {
864
859
  id: e.uuid,
865
860
  label: e.type,
@@ -873,7 +868,7 @@ const Pe = (e) => {
873
868
  });
874
869
  const t = Se(e);
875
870
  return t > 0 && r.tags.push({
876
- label: `${pr(t)} KB`,
871
+ label: `${lr(t)} KB`,
877
872
  textColor: 15707189,
878
873
  backgroundColor: 16775644,
879
874
  tooltip: "Memory usage"
@@ -900,151 +895,151 @@ const Pe = (e) => {
900
895
  tooltip: "Position"
901
896
  })), r;
902
897
  };
903
- function ke(e, r) {
898
+ function Te(e, r) {
904
899
  e.children.forEach((t) => {
905
900
  if (t.type === "HightlightMesh")
906
901
  return;
907
- const n = Pe(t);
908
- r.children.push(n), ke(t, n);
902
+ const o = ke(t);
903
+ r.children.push(o), Te(t, o);
909
904
  });
910
905
  }
911
- const Pr = [], B = "tres:inspector", kr = ge({
906
+ const Cr = [], O = "tres:inspector", Mr = ve({
912
907
  sceneGraph: null
913
908
  });
914
- function Ar(e, r) {
915
- Sr(
909
+ function xr(e, r) {
910
+ _r(
916
911
  {
917
912
  id: "dev.esm.tres",
918
913
  label: "TresJS 🪐",
919
914
  logo: "https://raw.githubusercontent.com/Tresjs/tres/main/public/favicon.svg",
920
915
  packageName: "tresjs",
921
916
  homepage: "https://tresjs.org",
922
- componentStateTypes: Pr,
917
+ componentStateTypes: Cr,
923
918
  app: e
924
919
  },
925
920
  (t) => {
926
- typeof t.now != "function" && xr(
921
+ typeof t.now != "function" && Er(
927
922
  // eslint-disable-next-line max-len
928
923
  "You seem to be using an outdated version of Vue Devtools. Are you still using the Beta release instead of the stable one? You can find the links at https://devtools.vuejs.org/guide/installation.html."
929
924
  ), t.addInspector({
930
- id: B,
925
+ id: O,
931
926
  label: "TresJS 🪐",
932
927
  icon: "account_tree",
933
928
  treeFilterPlaceholder: "Search instances"
934
929
  }), setInterval(() => {
935
- t.sendInspectorTree(B);
930
+ t.sendInspectorTree(O);
936
931
  }, 1e3), setInterval(() => {
937
932
  t.notifyComponentUpdate();
938
- }, 5e3), t.on.getInspectorTree((a) => {
939
- if (a.inspectorId === B) {
940
- const o = Pe(r.scene.value);
941
- ke(r.scene.value, o), kr.sceneGraph = o, a.rootNodes = [o];
933
+ }, 5e3), t.on.getInspectorTree((i) => {
934
+ if (i.inspectorId === O) {
935
+ const n = ke(r.scene.value);
936
+ Te(r.scene.value, n), Mr.sceneGraph = n, i.rootNodes = [n];
942
937
  }
943
938
  });
944
- let n = null, s = null;
945
- t.on.getInspectorState((a) => {
946
- if (a.inspectorId === B) {
947
- const [o] = r.scene.value.getObjectsByProperty("uuid", a.nodeId);
948
- if (!o)
939
+ let o = null, s = null;
940
+ t.on.getInspectorState((i) => {
941
+ if (i.inspectorId === O) {
942
+ const [n] = r.scene.value.getObjectsByProperty("uuid", i.nodeId);
943
+ if (!n)
949
944
  return;
950
- if (s && n && n.parent && s.remove(n), o.isMesh) {
951
- const i = ir(o);
952
- o.add(i), n = i, s = o;
945
+ if (s && o && o.parent && s.remove(o), n.isMesh) {
946
+ const a = tr(n);
947
+ n.add(a), o = a, s = n;
953
948
  }
954
- a.state = {
949
+ i.state = {
955
950
  object: [
956
951
  {
957
952
  key: "uuid",
958
953
  editable: !0,
959
- value: o.uuid
954
+ value: n.uuid
960
955
  },
961
956
  {
962
957
  key: "name",
963
958
  editable: !0,
964
- value: o.name
959
+ value: n.name
965
960
  },
966
961
  {
967
962
  key: "type",
968
963
  editable: !0,
969
- value: o.type
964
+ value: n.type
970
965
  },
971
966
  {
972
967
  key: "position",
973
968
  editable: !0,
974
- value: o.position
969
+ value: n.position
975
970
  },
976
971
  {
977
972
  key: "rotation",
978
973
  editable: !0,
979
- value: o.rotation
974
+ value: n.rotation
980
975
  },
981
976
  {
982
977
  key: "scale",
983
978
  editable: !0,
984
- value: o.scale
979
+ value: n.scale
985
980
  },
986
981
  {
987
982
  key: "geometry",
988
- value: o.geometry
983
+ value: n.geometry
989
984
  },
990
985
  {
991
986
  key: "material",
992
- value: o.material
987
+ value: n.material
993
988
  },
994
989
  {
995
990
  key: "color",
996
991
  editable: !0,
997
- value: o.color
992
+ value: n.color
998
993
  },
999
994
  {
1000
995
  key: "intensity",
1001
996
  editable: !0,
1002
- value: o.intensity
997
+ value: n.intensity
1003
998
  },
1004
999
  {
1005
1000
  key: "castShadow",
1006
1001
  editable: !0,
1007
- value: o.castShadow
1002
+ value: n.castShadow
1008
1003
  },
1009
1004
  {
1010
1005
  key: "receiveShadow",
1011
1006
  editable: !0,
1012
- value: o.receiveShadow
1007
+ value: n.receiveShadow
1013
1008
  },
1014
1009
  {
1015
1010
  key: "frustumCulled",
1016
1011
  editable: !0,
1017
- value: o.frustumCulled
1012
+ value: n.frustumCulled
1018
1013
  },
1019
1014
  {
1020
1015
  key: "matrixAutoUpdate",
1021
1016
  editable: !0,
1022
- value: o.matrixAutoUpdate
1017
+ value: n.matrixAutoUpdate
1023
1018
  },
1024
1019
  {
1025
1020
  key: "matrixWorldNeedsUpdate",
1026
1021
  editable: !0,
1027
- value: o.matrixWorldNeedsUpdate
1022
+ value: n.matrixWorldNeedsUpdate
1028
1023
  },
1029
1024
  {
1030
1025
  key: "matrixWorld",
1031
- value: o.matrixWorld
1026
+ value: n.matrixWorld
1032
1027
  },
1033
1028
  {
1034
1029
  key: "visible",
1035
1030
  editable: !0,
1036
- value: o.visible
1031
+ value: n.visible
1037
1032
  }
1038
1033
  ]
1039
1034
  };
1040
1035
  }
1041
- }), t.on.editInspectorState((a) => {
1042
- a.inspectorId === B && sr(r.scene.value, a.nodeId, a.path, a.state.value);
1036
+ }), t.on.editInspectorState((i) => {
1037
+ i.inspectorId === O && er(r.scene.value, i.nodeId, i.path, i.state.value);
1043
1038
  });
1044
1039
  }
1045
1040
  );
1046
1041
  }
1047
- const Tr = ["data-scene", "data-tres"], Lr = /* @__PURE__ */ ne({
1042
+ const Sr = ["data-scene", "data-tres"], Pr = /* @__PURE__ */ ne({
1048
1043
  __name: "TresCanvas",
1049
1044
  props: {
1050
1045
  shadows: { type: Boolean, default: void 0 },
@@ -1071,83 +1066,83 @@ const Tr = ["data-scene", "data-tres"], Lr = /* @__PURE__ */ ne({
1071
1066
  failIfMajorPerformanceCaveat: { type: Boolean, default: void 0 }
1072
1067
  },
1073
1068
  setup(e, { expose: r }) {
1074
- var y;
1075
- const t = e, { logWarning: n } = T(), s = R(), a = D(new at()), { resume: o } = te(), i = ze(), l = (y = oe()) == null ? void 0 : y.appContext.app, c = (f) => ne({
1069
+ var h;
1070
+ const t = e, { logWarning: o } = A(), s = R(), i = j(new ot()), { resume: n } = re(), a = Re(), l = (h = se()) == null ? void 0 : h.appContext.app, c = (p) => ne({
1076
1071
  setup() {
1077
- var _;
1078
- const h = (_ = oe()) == null ? void 0 : _.appContext;
1079
- return h && (h.app = l), q("useTres", f), q("extend", re), typeof window < "u" && Ar(h.app, f), () => se(Je, null, i != null && i.default ? i.default() : []);
1072
+ var b;
1073
+ const y = (b = se()) == null ? void 0 : b.appContext;
1074
+ return y && (y.app = l), K("useTres", p), K("extend", oe), typeof window < "u" && xr(y.app, p), () => ie(Ue, null, a != null && a.default ? a.default() : []);
1080
1075
  }
1081
- }), p = (f) => {
1082
- const h = c(f);
1083
- hr(se(h), a.value);
1084
- }, d = (f, h = !1) => {
1085
- a.value.children = [], h && (f.renderer.value.dispose(), f.renderer.value.renderLists.dispose(), f.renderer.value.forceContextLoss()), p(f), o();
1086
- }, u = P(() => t.disableRender), m = D(null);
1087
- return r({ context: m, dispose: () => d(m.value, !0) }), Ne(() => {
1088
- const f = s;
1089
- m.value = mr({
1090
- scene: a.value,
1091
- canvas: f,
1076
+ }), m = (p) => {
1077
+ const y = c(p);
1078
+ pr(ie(y), i.value);
1079
+ }, d = (p, y = !1) => {
1080
+ i.value.children = [], y && (p.renderer.value.dispose(), p.renderer.value.renderLists.dispose(), p.renderer.value.forceContextLoss()), m(p), n();
1081
+ }, u = T(() => t.disableRender), f = j(null);
1082
+ return r({ context: f, dispose: () => d(f.value, !0) }), Ie(() => {
1083
+ const p = s;
1084
+ f.value = cr({
1085
+ scene: i.value,
1086
+ canvas: p,
1092
1087
  windowSize: t.windowSize,
1093
1088
  disableRender: u,
1094
1089
  rendererOptions: t
1095
- }), fr({ scene: a.value, contextParts: m.value });
1096
- const { registerCamera: h, camera: _, cameras: w, deregisterCamera: C } = m.value;
1097
- p(m.value);
1098
- const S = () => {
1099
- const b = new K(
1090
+ }), ar({ scene: i.value, contextParts: f.value });
1091
+ const { registerCamera: y, camera: b, cameras: x, deregisterCamera: C } = f.value;
1092
+ m(f.value);
1093
+ const M = () => {
1094
+ const w = new X(
1100
1095
  45,
1101
1096
  window.innerWidth / window.innerHeight,
1102
1097
  0.1,
1103
1098
  1e3
1104
1099
  );
1105
- b.position.set(3, 3, 3), b.lookAt(0, 0, 0), h(b);
1106
- const x = O(() => {
1107
- w.value.length >= 2 && (b.removeFromParent(), C(b), x == null || x());
1100
+ w.position.set(3, 3, 3), w.lookAt(0, 0, 0), y(w);
1101
+ const S = D(() => {
1102
+ x.value.length >= 2 && (w.removeFromParent(), C(w), S == null || S());
1108
1103
  });
1109
1104
  };
1110
- me(
1105
+ ge(
1111
1106
  () => t.camera,
1112
- (b, x) => {
1113
- b && h(b), x && (x.removeFromParent(), C(x));
1107
+ (w, S) => {
1108
+ w && y(w), S && (S.removeFromParent(), C(S));
1114
1109
  },
1115
1110
  {
1116
1111
  immediate: !0
1117
1112
  }
1118
- ), _.value || (n(
1113
+ ), b.value || (o(
1119
1114
  "No camera found. Creating a default perspective camera. To have full control over a camera, please add one to the scene."
1120
- ), S());
1121
- }), (f, h) => (Ve(), We("canvas", {
1115
+ ), M());
1116
+ }), (p, y) => ($e(), Ne("canvas", {
1122
1117
  ref_key: "canvas",
1123
1118
  ref: s,
1124
- "data-scene": a.value.uuid,
1125
- class: Ue(f.$attrs.class),
1126
- "data-tres": `tresjs ${Fe(Ft).version}`,
1127
- style: Ge({
1119
+ "data-scene": i.value.uuid,
1120
+ class: Ve(p.$attrs.class),
1121
+ "data-tres": `tresjs ${ze(Nt).version}`,
1122
+ style: We({
1128
1123
  display: "block",
1129
1124
  width: "100%",
1130
1125
  height: "100%",
1131
- position: f.windowSize ? "fixed" : "relative",
1126
+ position: p.windowSize ? "fixed" : "relative",
1132
1127
  top: 0,
1133
1128
  left: 0,
1134
1129
  pointerEvents: "auto",
1135
1130
  touchAction: "none",
1136
- ...f.$attrs.style
1131
+ ...p.$attrs.style
1137
1132
  })
1138
- }, null, 14, Tr));
1133
+ }, null, 14, Sr));
1139
1134
  }
1140
- }), Or = [
1135
+ }), kr = [
1141
1136
  "TresCanvas",
1142
1137
  "TresLeches",
1143
1138
  "TresScene"
1144
- ], Dr = {
1139
+ ], Tr = {
1145
1140
  template: {
1146
1141
  compilerOptions: {
1147
- isCustomElement: (e) => e.startsWith("Tres") && !Or.includes(e) || e === "primitive"
1142
+ isCustomElement: (e) => e.startsWith("Tres") && !kr.includes(e) || e === "primitive"
1148
1143
  }
1149
1144
  }
1150
- }, Qr = Dr, Yr = {
1145
+ }, Wr = Tr, Ur = {
1151
1146
  mounted: (e, r) => {
1152
1147
  if (r.arg) {
1153
1148
  console.log(`v-log:${r.arg}`, e[r.arg]);
@@ -1156,14 +1151,14 @@ const Tr = ["data-scene", "data-tres"], Lr = /* @__PURE__ */ ne({
1156
1151
  console.log("v-log", e);
1157
1152
  }
1158
1153
  };
1159
- class Ae extends lt {
1154
+ class Ae extends nt {
1160
1155
  constructor(r, t) {
1161
- const n = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0], s = new ie();
1162
- s.setAttribute("position", new ae(n, 3)), s.computeBoundingSphere();
1163
- const a = new ut({ fog: !1 });
1164
- super(s, a), this.light = r, this.color = t, this.type = "RectAreaLightHelper";
1165
- const o = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0], i = new ie();
1166
- i.setAttribute("position", new ae(o, 3)), i.computeBoundingSphere(), this.add(new ct(i, new ye({ side: dt, fog: !1 })));
1156
+ const o = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0], s = new ae();
1157
+ s.setAttribute("position", new le(o, 3)), s.computeBoundingSphere();
1158
+ const i = new st({ fog: !1 });
1159
+ super(s, i), this.light = r, this.color = t, this.type = "RectAreaLightHelper";
1160
+ const n = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0], a = new ae();
1161
+ a.setAttribute("position", new le(n, 3)), a.computeBoundingSphere(), this.add(new it(a, new we({ side: at, fog: !1 })));
1167
1162
  }
1168
1163
  updateMatrixWorld() {
1169
1164
  if (this.scale.set(0.5 * this.light.width, 0.5 * this.light.height, 1), this.color !== void 0)
@@ -1179,55 +1174,55 @@ class Ae extends lt {
1179
1174
  this.geometry.dispose(), this.material.dispose(), this.children[0].geometry.dispose(), this.children[0].material.dispose();
1180
1175
  }
1181
1176
  }
1182
- const { logWarning: pe } = T();
1183
- let N, A;
1184
- const Br = {
1185
- DirectionalLight: ft,
1186
- PointLight: pt,
1187
- SpotLight: mt,
1188
- HemisphereLight: gt,
1177
+ const { logWarning: me } = A();
1178
+ let z, k;
1179
+ const Ar = {
1180
+ DirectionalLight: lt,
1181
+ PointLight: ut,
1182
+ SpotLight: ct,
1183
+ HemisphereLight: dt,
1189
1184
  RectAreaLight: Ae
1190
- }, qr = {
1185
+ }, Fr = {
1191
1186
  mounted: (e) => {
1192
1187
  if (!e.isLight) {
1193
- pe(`${e.type} is not a light`);
1188
+ me(`${e.type} is not a light`);
1194
1189
  return;
1195
1190
  }
1196
- N = Br[e.type], e.parent.add(new N(e, 1, e.color.getHex()));
1191
+ z = Ar[e.type], e.parent.add(new z(e, 1, e.color.getHex()));
1197
1192
  },
1198
1193
  updated: (e) => {
1199
- A = e.parent.children.find((r) => r instanceof N), !(A instanceof Ae) && A.update();
1194
+ k = e.parent.children.find((r) => r instanceof z), !(k instanceof Ae) && k.update();
1200
1195
  },
1201
1196
  unmounted: (e) => {
1202
1197
  if (!e.isLight) {
1203
- pe(`${e.type} is not a light`);
1198
+ me(`${e.type} is not a light`);
1204
1199
  return;
1205
1200
  }
1206
- A = e.parent.children.find((r) => r instanceof N), A && A.dispose && A.dispose(), e.parent.remove(A);
1201
+ k = e.parent.children.find((r) => r instanceof z), k && k.dispose && k.dispose(), e.parent.remove(k);
1207
1202
  }
1208
- }, { logWarning: jr } = T(), Kr = {
1203
+ }, { logWarning: Lr } = A(), Gr = {
1209
1204
  updated: (e, r) => {
1210
- const t = Ce(r);
1205
+ const t = xe(r);
1211
1206
  if (!t) {
1212
- jr(`v-always-look-at: problem with binding value: ${r.value}`);
1207
+ Lr(`v-always-look-at: problem with binding value: ${r.value}`);
1213
1208
  return;
1214
1209
  }
1215
- const { onLoop: n } = te();
1216
- n(() => {
1210
+ const { onLoop: o } = re();
1211
+ o(() => {
1217
1212
  e.lookAt(t);
1218
1213
  });
1219
1214
  }
1220
- }, { logWarning: Hr } = T(), Xr = {
1215
+ }, { logWarning: Or } = A(), Jr = {
1221
1216
  updated: (e, r) => {
1222
1217
  var s;
1223
- const t = Ce(r);
1218
+ const t = xe(r);
1224
1219
  if (!t) {
1225
- Hr(`v-distance-to: problem with binding value: ${r.value}`);
1220
+ Or(`v-distance-to: problem with binding value: ${r.value}`);
1226
1221
  return;
1227
1222
  }
1228
- k && (k.dispose(), e.parent.remove(k));
1229
- const n = t.clone().sub(e.position);
1230
- n.normalize(), k = new vt(n, e.position, e.position.distanceTo(t), 16776960), e.parent.add(k), console.table(
1223
+ P && (P.dispose(), e.parent.remove(P));
1224
+ const o = t.clone().sub(e.position);
1225
+ o.normalize(), P = new ft(o, e.position, e.position.distanceTo(t), 16776960), e.parent.add(P), console.table(
1231
1226
  [
1232
1227
  ["Distance:", e.position.distanceTo(t)],
1233
1228
  [`origin: ${e.name || e.type}`, `x:${e.position.x}, y:${e.position.y}, z:${(s = e.position) == null ? void 0 : s.z}`],
@@ -1236,39 +1231,39 @@ const Br = {
1236
1231
  );
1237
1232
  },
1238
1233
  unmounted: (e) => {
1239
- k == null || k.dispose(), e.parent.remove(k);
1234
+ P == null || P.dispose(), e.parent.remove(P);
1240
1235
  }
1241
1236
  };
1242
- let k = null;
1243
- const Zr = {
1237
+ let P = null;
1238
+ const Qr = {
1244
1239
  install(e) {
1245
- e.component("TresCanvas", Lr);
1240
+ e.component("TresCanvas", Pr);
1246
1241
  }
1247
1242
  };
1248
1243
  export {
1249
- Lr as TresCanvas,
1250
- X as catalogue,
1251
- Zr as default,
1252
- re as extend,
1253
- Vr as isProd,
1254
- qt as normalizeColor,
1255
- Wr as normalizeVectorFlexibleParam,
1256
- Qr as templateCompilerOptions,
1257
- cr as trasverseObjects,
1258
- Gt as useCamera,
1259
- Ur as useLoader,
1260
- T as useLogger,
1261
- fr as usePointerEventHandler,
1262
- dr as useRaycaster,
1263
- te as useRenderLoop,
1264
- lr as useRenderer,
1265
- Gr as useSeek,
1266
- Fr as useTexture,
1267
- Jr as useTres,
1268
- gr as useTresContext,
1269
- mr as useTresContextProvider,
1270
- Kr as vAlwaysLookAt,
1271
- Xr as vDistanceTo,
1272
- qr as vLightHelper,
1273
- Yr as vLog
1244
+ Pr as TresCanvas,
1245
+ Z as catalogue,
1246
+ Qr as default,
1247
+ oe as extend,
1248
+ Rr as isProd,
1249
+ Ft as normalizeColor,
1250
+ Ir as normalizeVectorFlexibleParam,
1251
+ Wr as templateCompilerOptions,
1252
+ sr as trasverseObjects,
1253
+ Vt as useCamera,
1254
+ $r as useLoader,
1255
+ A as useLogger,
1256
+ ar as usePointerEventHandler,
1257
+ ir as useRaycaster,
1258
+ re as useRenderLoop,
1259
+ or as useRenderer,
1260
+ Vr as useSeek,
1261
+ Nr as useTexture,
1262
+ zr as useTres,
1263
+ dr as useTresContext,
1264
+ cr as useTresContextProvider,
1265
+ Gr as vAlwaysLookAt,
1266
+ Jr as vDistanceTo,
1267
+ Fr as vLightHelper,
1268
+ Ur as vLog
1274
1269
  };