@tresjs/core 4.2.6 → 4.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/tres.js CHANGED
@@ -1,24 +1,27 @@
1
1
  /**
2
2
  * name: @tresjs/core
3
- * version: v4.2.6
3
+ * version: v4.2.8
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
8
  var bt = Object.defineProperty;
9
- var Pt = (e, t, n) => t in e ? bt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
10
- var me = (e, t, n) => Pt(e, typeof t != "symbol" ? t + "" : t, n);
11
- import { ref as H, computed as V, watchEffect as Te, onUnmounted as K, shallowRef as $, watch as ce, readonly as ye, unref as J, provide as _e, inject as Ct, isRef as Mt, reactive as Et, defineComponent as Be, useSlots as Tt, getCurrentInstance as Ie, onMounted as St, openBlock as At, createElementBlock as xt, normalizeClass as kt, normalizeStyle as Lt, createRenderer as Rt, h as He, Fragment as Ot } from "vue";
9
+ var Ct = (e, t, n) => t in e ? bt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
10
+ var me = (e, t, n) => Ct(e, typeof t != "symbol" ? t + "" : t, n);
11
+ import { ref as H, computed as V, watchEffect as Te, onUnmounted as K, shallowRef as $, watch as ce, readonly as ye, unref as J, provide as _e, inject as Mt, isRef as Pt, reactive as Et, defineComponent as Be, useSlots as Tt, getCurrentInstance as Ie, onMounted as St, openBlock as At, createElementBlock as xt, normalizeClass as kt, normalizeStyle as Lt, createRenderer as Rt, h as He, Fragment as Ot } from "vue";
12
12
  import * as et from "three";
13
13
  import { PerspectiveCamera as we, Camera as Dt, Clock as tt, Vector3 as Se, Color as Z, Scene as nt, MathUtils as rt, MeshBasicMaterial as ot, DoubleSide as jt, REVISION as Bt, SRGBColorSpace as It, ACESFilmicToneMapping as st, PCFSoftShadowMap as Ht, NoToneMapping as $t, WebGLRenderer as he, TextureLoader as Ut, Vector2 as ge, Raycaster as Ft, BufferAttribute as Wt, Object3D as Nt, Line as zt, BufferGeometry as $e, Float32BufferAttribute as Ue, LineBasicMaterial as Gt, Mesh as Vt, BackSide as Yt, DirectionalLightHelper as qt, PointLightHelper as Jt, SpotLightHelper as Kt, HemisphereLightHelper as Qt, ArrowHelper as Xt } from "three";
14
14
  import { createEventHook as j, useRafFn as it, toValue as k, unrefElement as Zt, useDevicePixelRatio as en, usePointer as tn, useElementBounding as nn, useWindowSize as rn, useElementSize as on, refDebounced as Fe, tryOnScopeDispose as sn, useFps as an, useMemory as ln } from "@vueuse/core";
15
- const cn = "@tresjs/core", un = "module", fn = "4.2.6", dn = "pnpm@9.1.4", pn = "Declarative ThreeJS using Vue Components", mn = "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)", hn = "MIT", gn = [
15
+ const cn = "@tresjs/core", un = "module", fn = "4.2.8", dn = "pnpm@9.1.4", pn = "Declarative ThreeJS using Vue Components", mn = "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)", hn = "MIT", gn = {
16
+ type: "git",
17
+ url: "git+https://github.com/Tresjs/tres.git"
18
+ }, vn = [
16
19
  "vue",
17
20
  "3d",
18
21
  "threejs",
19
22
  "three",
20
23
  "threejs-vue"
21
- ], vn = !1, yn = {
24
+ ], yn = !1, _n = {
22
25
  ".": {
23
26
  types: "./dist/index.d.ts",
24
27
  import: "./dist/tres.js",
@@ -37,15 +40,15 @@ const cn = "@tresjs/core", un = "module", fn = "4.2.6", dn = "pnpm@9.1.4", pn =
37
40
  types: "./dist/src/utils/index.d.ts"
38
41
  },
39
42
  "./*": "./*"
40
- }, _n = "./dist/tres.js", wn = "./dist/tres.js", bn = "./dist/index.d.ts", Pn = [
43
+ }, wn = "./dist/tres.js", bn = "./dist/tres.js", Cn = "./dist/index.d.ts", Mn = [
41
44
  "*.d.ts",
42
45
  "dist"
43
- ], Cn = {
46
+ ], Pn = {
44
47
  access: "public"
45
- }, Mn = {
46
- dev: "cd playground && npm run dev",
48
+ }, En = {
49
+ dev: "cd playground/vue && npm run dev",
50
+ "dev:nuxt": "cd playground/nuxt && npm run dev",
47
51
  build: "vite build",
48
- playground: "cd playground && npm run dev",
49
52
  test: "vitest",
50
53
  "test:ci": "vitest run",
51
54
  "test:ui": "vitest --ui --coverage.enabled=true",
@@ -59,14 +62,14 @@ const cn = "@tresjs/core", un = "module", fn = "4.2.6", dn = "pnpm@9.1.4", pn =
59
62
  "docs:preview": "vitepress preview docs",
60
63
  "docs:contributors": "esno scripts/update-contributors.ts",
61
64
  prepare: "node .husky/install.mjs"
62
- }, En = {
65
+ }, Tn = {
63
66
  three: ">=0.133",
64
67
  vue: ">=3.4"
65
- }, Tn = {
68
+ }, Sn = {
66
69
  "@alvarosabu/utils": "^3.2.0",
67
70
  "@vue/devtools-api": "^6.6.3",
68
71
  "@vueuse/core": "^10.11.0"
69
- }, Sn = {
72
+ }, An = {
70
73
  "@release-it/conventional-changelog": "^8.0.1",
71
74
  "@stackblitz/sdk": "^1.11.0",
72
75
  "@tresjs/cientos": "3.9.0",
@@ -107,7 +110,7 @@ const cn = "@tresjs/core", un = "module", fn = "4.2.6", dn = "pnpm@9.1.4", pn =
107
110
  vitest: "^2.0.2",
108
111
  vue: "^3.4.31",
109
112
  "vue-demi": "^0.14.8"
110
- }, An = {
113
+ }, xn = {
111
114
  name: cn,
112
115
  type: un,
113
116
  version: fn,
@@ -115,18 +118,19 @@ const cn = "@tresjs/core", un = "module", fn = "4.2.6", dn = "pnpm@9.1.4", pn =
115
118
  description: pn,
116
119
  author: mn,
117
120
  license: hn,
118
- keywords: gn,
119
- sideEffects: vn,
120
- exports: yn,
121
- main: _n,
122
- module: wn,
123
- types: bn,
124
- files: Pn,
125
- publishConfig: Cn,
126
- scripts: Mn,
127
- peerDependencies: En,
128
- dependencies: Tn,
129
- devDependencies: Sn
121
+ repository: gn,
122
+ keywords: vn,
123
+ sideEffects: yn,
124
+ exports: _n,
125
+ main: wn,
126
+ module: bn,
127
+ types: Cn,
128
+ files: Mn,
129
+ publishConfig: Pn,
130
+ scripts: En,
131
+ peerDependencies: Tn,
132
+ dependencies: Sn,
133
+ devDependencies: An
130
134
  };
131
135
  function be(e) {
132
136
  return typeof e > "u";
@@ -134,7 +138,7 @@ function be(e) {
134
138
  function de(e) {
135
139
  return Array.isArray(e);
136
140
  }
137
- function xn(e) {
141
+ function kn(e) {
138
142
  return typeof e == "number";
139
143
  }
140
144
  function at(e) {
@@ -152,28 +156,28 @@ function N(e) {
152
156
  function We(e) {
153
157
  return U(e) && "isCamera" in e && !!e.isCamera;
154
158
  }
155
- function kn(e) {
159
+ function Ln(e) {
156
160
  return U(e) && "isBufferGeometry" in e && !!e.isBufferGeometry;
157
161
  }
158
- function Ln(e) {
162
+ function Rn(e) {
159
163
  return U(e) && "isMaterial" in e && !!e.isMaterial;
160
164
  }
161
- function Rn(e) {
165
+ function On(e) {
162
166
  return U(e) && "isLight" in e && !!e.isLight;
163
167
  }
164
- function On(e) {
168
+ function Dn(e) {
165
169
  return U(e) && "isFog" in e && !!e.isFog;
166
170
  }
167
- function Dn(e) {
171
+ function jn(e) {
168
172
  return U(e) && "isScene" in e && !!e.isScene;
169
173
  }
170
174
  function oe(e) {
171
- return N(e) || kn(e) || Ln(e) || On(e);
175
+ return N(e) || Ln(e) || Rn(e) || Dn(e);
172
176
  }
173
- function jn(e) {
177
+ function Bn(e) {
174
178
  return U(e) && !!e.isPrimitive;
175
179
  }
176
- const Bn = ({ sizes: e }) => {
180
+ const In = ({ sizes: e }) => {
177
181
  const t = H([]), n = V(
178
182
  () => t.value[0]
179
183
  ), r = (i) => {
@@ -197,7 +201,7 @@ const Bn = ({ sizes: e }) => {
197
201
  };
198
202
  return Te(() => {
199
203
  e.aspectRatio.value && t.value.forEach((i) => {
200
- !i.manual && (i instanceof we || In(i)) && (i instanceof we ? i.aspect = e.aspectRatio.value : (i.left = e.width.value * -0.5, i.right = e.width.value * 0.5, i.top = e.height.value * 0.5, i.bottom = e.height.value * -0.5), i.updateProjectionMatrix());
204
+ !i.manual && (i instanceof we || Hn(i)) && (i instanceof we ? i.aspect = e.aspectRatio.value : (i.left = e.width.value * -0.5, i.right = e.width.value * 0.5, i.top = e.height.value * 0.5, i.bottom = e.height.value * -0.5), i.updateProjectionMatrix());
201
205
  });
202
206
  }), K(() => {
203
207
  t.value = [];
@@ -209,12 +213,12 @@ const Bn = ({ sizes: e }) => {
209
213
  setCameraActive: r
210
214
  };
211
215
  };
212
- function In(e) {
216
+ function Hn(e) {
213
217
  return e.hasOwnProperty("isOrthographicCamera") && e.isOrthographicCamera;
214
218
  }
215
219
  const lt = j(), ct = j(), Ae = j(), ee = new tt();
216
220
  let ue = 0, fe = 0;
217
- const { pause: Hn, resume: Ne, isActive: $n } = it(
221
+ const { pause: $n, resume: Ne, isActive: Un } = it(
218
222
  () => {
219
223
  lt.trigger({ delta: ue, elapsed: fe, clock: ee }), ct.trigger({ delta: ue, elapsed: fe, clock: ee }), Ae.trigger({ delta: ue, elapsed: fe, clock: ee });
220
224
  },
@@ -228,9 +232,9 @@ const Ur = () => (ze || (ze = !0, Ne()), {
228
232
  onBeforeLoop: lt.on,
229
233
  onLoop: ct.on,
230
234
  onAfterLoop: Ae.on,
231
- pause: Hn,
235
+ pause: $n,
232
236
  resume: Ne,
233
- isActive: $n
237
+ isActive: Un
234
238
  }), Fr = !0, se = "[TresJS ▲ ■ ●] ";
235
239
  function Y() {
236
240
  function e(...r) {
@@ -250,10 +254,10 @@ function Y() {
250
254
  function Wr(e) {
251
255
  return typeof e == "number" ? [e, e, e] : e instanceof Se ? [e.x, e.y, e.z] : e;
252
256
  }
253
- function Un(e) {
257
+ function Fn(e) {
254
258
  return e instanceof Z ? e : Array.isArray(e) ? new Z(...e) : new Z(e);
255
259
  }
256
- class Fn extends et.Mesh {
260
+ class Wn extends et.Mesh {
257
261
  constructor(...n) {
258
262
  super(...n);
259
263
  me(this, "type", "HightlightMesh");
@@ -269,18 +273,18 @@ const ut = (e, t) => {
269
273
  for (const n of Object.keys(t))
270
274
  t[n] instanceof Object && Object.assign(t[n], ut(e[n], t[n]));
271
275
  return Object.assign(e || {}, t), e;
272
- }, Wn = "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", Nn = /* @__PURE__ */ Vn(Wn);
276
+ }, Nn = "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", zn = /* @__PURE__ */ Yn(Nn);
273
277
  function Ge(e) {
274
278
  return e && e.nodeType === 1;
275
279
  }
276
280
  function ie(e) {
277
281
  return e.replace(/-([a-z])/g, (t, n) => n.toUpperCase());
278
282
  }
279
- const zn = /\B([A-Z])/g;
280
- function Gn(e) {
281
- return e.replace(zn, "-$1").toLowerCase();
283
+ const Gn = /\B([A-Z])/g;
284
+ function Vn(e) {
285
+ return e.replace(Gn, "-$1").toLowerCase();
282
286
  }
283
- function Vn(e, t) {
287
+ function Yn(e, t) {
284
288
  const n = /* @__PURE__ */ Object.create(null), r = e.split(",");
285
289
  for (let s = 0; s < r.length; s++)
286
290
  n[r[s]] = !0;
@@ -291,7 +295,7 @@ const Ve = (e, t) => {
291
295
  return;
292
296
  const n = Array.isArray(t) ? t : t.match(/([^[.\]])+/g);
293
297
  return n == null ? void 0 : n.reduce((r, s) => r && r[s], e);
294
- }, Yn = (e, t, n) => {
298
+ }, qn = (e, t, n) => {
295
299
  const r = Array.isArray(t) ? t : t.match(/([^[.\]])+/g);
296
300
  r && r.reduce((s, l, i) => (s[l] === void 0 && (s[l] = {}), i === r.length - 1 && (s[l] = n), s[l]), e);
297
301
  };
@@ -312,7 +316,7 @@ function ft(e, t) {
312
316
  return !1;
313
317
  return !0;
314
318
  }
315
- function qn(e, t) {
319
+ function Jn(e, t) {
316
320
  if (!Array.isArray(e) || !Array.isArray(t) || e.length !== t.length)
317
321
  return !1;
318
322
  for (let n = 0; n < e.length; n++)
@@ -320,8 +324,8 @@ function qn(e, t) {
320
324
  return !1;
321
325
  return !0;
322
326
  }
323
- const Jn = Array.isArray;
324
- function Kn(e, t, n, r) {
327
+ const Kn = Array.isArray;
328
+ function Qn(e, t, n, r) {
325
329
  const s = (c) => {
326
330
  if (c.uuid === t)
327
331
  return c;
@@ -346,7 +350,7 @@ function Kn(e, t, n, r) {
346
350
  const a = n[n.length - 1];
347
351
  i[a] !== void 0 ? i[a] = r : console.warn(`Property path is not valid: ${n.join(".")}`);
348
352
  }
349
- function Qn(e) {
353
+ function Xn(e) {
350
354
  const t = new ot({
351
355
  color: 11003607,
352
356
  // Highlight color, e.g., yellow
@@ -357,18 +361,18 @@ function Qn(e) {
357
361
  side: jt
358
362
  // To e
359
363
  });
360
- return new Fn(e.geometry.clone(), t);
364
+ return new Wn(e.geometry.clone(), t);
361
365
  }
362
- function Xn(e) {
366
+ function Zn(e) {
363
367
  var n;
364
368
  let t = e.value;
365
369
  return e.value && ((n = e.value) != null && n.isMesh) && (t = e.value.position), Array.isArray(e.value) && (t = new Se(...t)), t;
366
370
  }
367
- function Zn(e) {
371
+ function er(e) {
368
372
  return "map" in e;
369
373
  }
370
374
  function Ye(e) {
371
- Zn(e) && e.map && e.map.dispose(), e.dispose();
375
+ er(e) && e.map && e.map.dispose(), e.dispose();
372
376
  }
373
377
  function dt(e) {
374
378
  var n, r;
@@ -377,13 +381,13 @@ function dt(e) {
377
381
  e && ((r = e.dispose) == null || r.call(e)), s.geometry && (s.geometry.dispose(), delete s.geometry), Array.isArray(s.material) ? (s.material.forEach((l) => Ye(l)), delete s.material) : s.material && (Ye(s.material), delete s.material);
378
382
  }
379
383
  }
380
- function er(e, t) {
384
+ function tr(e, t) {
381
385
  let n = 0;
382
386
  for (let r = 0; r < e.length; r++)
383
387
  t(e[r], r) && (e[n] = e[r], n++);
384
388
  return e.length = n, e;
385
389
  }
386
- function Pe(e, t) {
390
+ function Ce(e, t) {
387
391
  let n = e;
388
392
  if (t.includes("-")) {
389
393
  const r = t.split("-");
@@ -398,10 +402,10 @@ function qe(...e) {
398
402
  return e.map((t, n) => n === 0 ? t : t.charAt(0).toUpperCase() + t.slice(1)).join("");
399
403
  }
400
404
  const Je = /-\d+$/;
401
- function tr(e, t, n) {
405
+ function nr(e, t, n) {
402
406
  if (at(n)) {
403
407
  if (Je.test(n)) {
404
- const l = n.replace(Je, ""), { target: i, key: a } = Pe(e, l);
408
+ const l = n.replace(Je, ""), { target: i, key: a } = Ce(e, l);
405
409
  if (!Array.isArray(i[a])) {
406
410
  const c = i[a], o = [];
407
411
  o.__tresDetach = () => {
@@ -409,15 +413,15 @@ function tr(e, t, n) {
409
413
  }, i[a] = o;
410
414
  }
411
415
  }
412
- const { target: r, key: s } = Pe(e, n);
416
+ const { target: r, key: s } = Ce(e, n);
413
417
  t.__tres.previousAttach = r[s], r[s] = Q(t);
414
418
  } else
415
419
  t.__tres.previousAttach = n(e, t);
416
420
  }
417
- function nr(e, t, n) {
421
+ function rr(e, t, n) {
418
422
  var r, s, l;
419
423
  if (at(n)) {
420
- const { target: i, key: a } = Pe(e, n), c = t.__tres.previousAttach;
424
+ const { target: i, key: a } = Ce(e, n), c = t.__tres.previousAttach;
421
425
  c === void 0 ? delete i[a] : i[a] = c, "__tresDetach" in i && i.__tresDetach();
422
426
  } else
423
427
  (s = (r = t.__tres) == null ? void 0 : r.previousAttach) == null || s.call(r, e, t);
@@ -442,7 +446,7 @@ function pt(e) {
442
446
  const t = (n = e == null ? void 0 : e.__tres) == null ? void 0 : n.root;
443
447
  t && t.render && t.render.canBeInvalidated.value && t.invalidate();
444
448
  }
445
- function rr(e, t, n) {
449
+ function or(e, t, n) {
446
450
  var s;
447
451
  if (!G(e.setPixelRatio))
448
452
  return;
@@ -450,10 +454,10 @@ function rr(e, t, n) {
450
454
  if (de(n) && n.length >= 2) {
451
455
  const [l, i] = n;
452
456
  r = rt.clamp(t, l, i);
453
- } else xn(n) ? r = n : r = t;
457
+ } else kn(n) ? r = n : r = t;
454
458
  r !== ((s = e.getPixelRatio) == null ? void 0 : s.call(e)) && e.setPixelRatio(r);
455
459
  }
456
- function or(e, t, n, r, s) {
460
+ function sr(e, t, n, r, s) {
457
461
  const l = [...t.__tres.objects], i = Q(t);
458
462
  if (e = Q(e), i === e)
459
463
  return !0;
@@ -470,12 +474,12 @@ function or(e, t, n, r, s) {
470
474
  return !0;
471
475
  }
472
476
  function Q(e) {
473
- return jn(e) ? (e.object.__tres = e.__tres, e.object) : e;
477
+ return Bn(e) ? (e.object.__tres = e.__tres, e.object) : e;
474
478
  }
475
479
  function mt(e, t) {
476
480
  var r, s, l, i;
477
481
  const n = ((r = e.__tres) == null ? void 0 : r.parent) || t.scene.value;
478
- e.__tres && (e.__tres.parent = null), n && n.__tres && "objects" in n.__tres && er(n.__tres.objects, (a) => a !== e), (s = e.__tres) != null && s.attach ? nr(n, e, e.__tres.attach) : ((i = (l = e.parent) == null ? void 0 : l.remove) == null || i.call(l, Q(e)), e.parent = null);
482
+ e.__tres && (e.__tres.parent = null), n && n.__tres && "objects" in n.__tres && tr(n.__tres.objects, (a) => a !== e), (s = e.__tres) != null && s.attach ? rr(n, e, e.__tres.attach) : ((i = (l = e.parent) == null ? void 0 : l.remove) == null || i.call(l, Q(e)), e.parent = null);
479
483
  }
480
484
  function ht(e, t) {
481
485
  var n;
@@ -484,7 +488,7 @@ function ht(e, t) {
484
488
  t.deregisterCamera(r), (s = t.eventManager) == null || s.deregisterPointerMissedObject(r);
485
489
  }), t.deregisterCamera(e), pt(e);
486
490
  }
487
- const sr = Number.parseInt(Bt.replace("dev", "")), ae = {
491
+ const ir = Number.parseInt(Bt.replace("dev", "")), ae = {
488
492
  realistic: {
489
493
  shadows: !0,
490
494
  physicallyCorrectLights: !0,
@@ -501,7 +505,7 @@ const sr = Number.parseInt(Bt.replace("dev", "")), ae = {
501
505
  toneMappingExposure: 1
502
506
  }
503
507
  };
504
- function ir({
508
+ function ar({
505
509
  canvas: e,
506
510
  options: t,
507
511
  contextParts: { sizes: n, render: r, invalidate: s, advance: l }
@@ -530,37 +534,37 @@ function ir({
530
534
  }, {
531
535
  immediate: !0
532
536
  }), ce(() => t.clearColor, c);
533
- const { pixelRatio: o } = en(), { logError: u } = Y(), f = (() => {
534
- const g = new he(), b = {
537
+ const { pixelRatio: o } = en(), { logError: u } = Y(), d = (() => {
538
+ const h = new he(), b = {
535
539
  shadowMap: {
536
- enabled: g.shadowMap.enabled,
537
- type: g.shadowMap.type
540
+ enabled: h.shadowMap.enabled,
541
+ type: h.shadowMap.type
538
542
  },
539
- toneMapping: g.toneMapping,
540
- toneMappingExposure: g.toneMappingExposure,
541
- outputColorSpace: g.outputColorSpace
543
+ toneMapping: h.toneMapping,
544
+ toneMappingExposure: h.toneMappingExposure,
545
+ outputColorSpace: h.outputColorSpace
542
546
  };
543
- return g.dispose(), b;
544
- })(), h = k(t.renderMode);
545
- return h === "on-demand" && s(), h === "manual" && setTimeout(() => {
547
+ return h.dispose(), b;
548
+ })(), g = k(t.renderMode);
549
+ return g === "on-demand" && s(), g === "manual" && setTimeout(() => {
546
550
  l();
547
551
  }, 100), Te(() => {
548
- const g = k(t.preset);
549
- g && (g in ae || u(`Renderer Preset must be one of these: ${Object.keys(ae).join(", ")}`), ut(a.value, ae[g])), rr(a.value, o.value, k(t.dpr)), h === "always" && (r.frames.value = Math.max(1, r.frames.value));
550
- const b = (C, M) => {
551
- const P = k(C), E = () => {
552
- if (g)
553
- return Ve(ae[g], M);
552
+ const h = k(t.preset);
553
+ h && (h in ae || u(`Renderer Preset must be one of these: ${Object.keys(ae).join(", ")}`), ut(a.value, ae[h])), or(a.value, o.value, k(t.dpr)), g === "always" && (r.frames.value = Math.max(1, r.frames.value));
554
+ const b = (M, P) => {
555
+ const C = k(M), E = () => {
556
+ if (h)
557
+ return Ve(ae[h], P);
554
558
  };
555
- if (P !== void 0)
556
- return P;
559
+ if (C !== void 0)
560
+ return C;
557
561
  const S = E();
558
- return S !== void 0 ? S : Ve(f, M);
559
- }, y = (C, M) => Yn(a.value, M, b(C, M));
560
- y(t.shadows, "shadowMap.enabled"), y(t.toneMapping ?? st, "toneMapping"), y(t.shadowMapType, "shadowMap.type"), sr < 150 && y(!t.useLegacyLights, "physicallyCorrectLights"), y(t.outputColorSpace, "outputColorSpace"), y(t.toneMappingExposure, "toneMappingExposure");
561
- const d = b(t.clearColor, "clearColor");
562
- d && a.value.setClearColor(
563
- d ? Un(d) : new Z(0)
562
+ return S !== void 0 ? S : Ve(d, P);
563
+ }, y = (M, P) => qn(a.value, P, b(M, P));
564
+ y(t.shadows, "shadowMap.enabled"), y(t.toneMapping ?? st, "toneMapping"), y(t.shadowMapType, "shadowMap.type"), ir < 150 && y(!t.useLegacyLights, "physicallyCorrectLights"), y(t.outputColorSpace, "outputColorSpace"), y(t.toneMappingExposure, "toneMappingExposure");
565
+ const f = b(t.clearColor, "clearColor");
566
+ f && a.value.setClearColor(
567
+ f ? Fn(f) : new Z(0)
564
568
  // default clear color is not easily/efficiently retrievable from three
565
569
  );
566
570
  }), K(() => {
@@ -569,7 +573,6 @@ function ir({
569
573
  renderer: a
570
574
  };
571
575
  }
572
- const ar = (e) => !!e && e.constructor === Array;
573
576
  function lr(e) {
574
577
  const t = { nodes: {}, materials: {} };
575
578
  return e && e.traverse((n) => {
@@ -579,20 +582,20 @@ function lr(e) {
579
582
  async function Nr(e, t, n, r, s) {
580
583
  const { logError: l } = Y(), i = new e();
581
584
  s && s(i), n && n(i);
582
- const c = (Array.isArray(t) ? t : [t]).map(
583
- (o) => new Promise((u, v) => {
584
- i.load(
585
- o,
586
- (f) => {
587
- const h = f;
588
- h.scene && Object.assign(h, lr(h.scene)), u(h);
589
- },
590
- r,
591
- (f) => v(l("[useLoader] - Failed to load resource", f))
592
- );
593
- })
594
- );
595
- return ar(t) ? await Promise.all(c) : await c[0];
585
+ const a = Array.isArray(t) ? t : [t];
586
+ return await new Promise((c, o) => {
587
+ i.load(
588
+ a,
589
+ (u) => {
590
+ const v = u;
591
+ v.scene && Object.assign(v, lr(v.scene)), c(v);
592
+ },
593
+ r,
594
+ (u) => {
595
+ l("[useLoader] - Failed to load resource", u), o(u);
596
+ }
597
+ );
598
+ });
596
599
  }
597
600
  async function zr(e, t) {
598
601
  const n = new Ut(t), r = (s) => new Promise((l, i) => {
@@ -605,7 +608,7 @@ async function zr(e, t) {
605
608
  }
606
609
  );
607
610
  });
608
- if (Jn(e)) {
611
+ if (Kn(e)) {
609
612
  const s = await Promise.all(e.map((l) => r(l)));
610
613
  return e.length > 1 ? s : s[0];
611
614
  } else {
@@ -640,16 +643,16 @@ const cr = (e, t) => {
640
643
  x: (m - u.value) / a.value * 2 - 1,
641
644
  y: -((T - o.value) / c.value) * 2 + 1
642
645
  };
643
- }, f = ({ x: m, y: T }) => {
646
+ }, d = ({ x: m, y: T }) => {
644
647
  if (t.camera.value)
645
648
  return t.raycaster.value.setFromCamera(new ge(m, T), t.camera.value), r.value = t.raycaster.value.intersectObjects(e.value, !0), r.value;
646
- }, h = (m) => {
649
+ }, g = (m) => {
647
650
  const T = v({
648
651
  x: (m == null ? void 0 : m.clientX) ?? s.value,
649
652
  y: (m == null ? void 0 : m.clientY) ?? l.value
650
653
  });
651
- return T ? f(T) || [] : [];
652
- }, g = j(), b = j(), y = j(), d = j(), C = j(), M = j(), P = j(), E = j();
654
+ return T ? d(T) || [] : [];
655
+ }, h = j(), b = j(), y = j(), f = j(), M = j(), P = j(), C = j(), E = j();
653
656
  function S(m) {
654
657
  const T = {};
655
658
  for (const F in m)
@@ -673,7 +676,7 @@ const cr = (e, t) => {
673
676
  };
674
677
  let A;
675
678
  const L = (m) => {
676
- h(m), _(y, m), A = m;
679
+ g(m), _(y, m), A = m;
677
680
  }, p = () => {
678
681
  A && L(A);
679
682
  };
@@ -683,15 +686,15 @@ const cr = (e, t) => {
683
686
  w = (T = r.value[0]) == null ? void 0 : T.object, i = 0, x = new ge(
684
687
  (m == null ? void 0 : m.clientX) ?? s.value,
685
688
  (m == null ? void 0 : m.clientY) ?? l.value
686
- ), _(C, m);
689
+ ), _(M, m);
687
690
  };
688
691
  let B, R = !1;
689
692
  const ne = (m) => {
690
693
  var T, F, re;
691
- m instanceof PointerEvent && (r.value.length === 0 && _(M, m), w === ((T = r.value[0]) == null ? void 0 : T.object) && (D = new ge(
694
+ m instanceof PointerEvent && (r.value.length === 0 && _(P, m), w === ((T = r.value[0]) == null ? void 0 : T.object) && (D = new ge(
692
695
  (m == null ? void 0 : m.clientX) ?? s.value,
693
696
  (m == null ? void 0 : m.clientY) ?? l.value
694
- ), i = x == null ? void 0 : x.distanceTo(D), m.button === 0 ? (_(g, m), B === ((F = r.value[0]) == null ? void 0 : F.object) ? R = !0 : (B = (re = r.value[0]) == null ? void 0 : re.object, R = !1)) : m.button === 2 && _(P, m)), _(d, m));
697
+ ), i = x == null ? void 0 : x.distanceTo(D), m.button === 0 ? (_(h, m), B === ((F = r.value[0]) == null ? void 0 : F.object) ? R = !0 : (B = (re = r.value[0]) == null ? void 0 : re.object, R = !1)) : m.button === 2 && _(C, m)), _(f, m));
695
698
  }, ke = (m) => {
696
699
  R && (_(b, m), B = void 0, R = !1);
697
700
  }, Le = (m) => _(y, m), Re = (m) => _(E, m);
@@ -699,13 +702,13 @@ const cr = (e, t) => {
699
702
  n != null && n.value && (n.value.removeEventListener("pointerup", ne), n.value.removeEventListener("pointerdown", O), n.value.removeEventListener("pointermove", L), n.value.removeEventListener("pointerleave", Le), n.value.removeEventListener("dblclick", ke), n.value.removeEventListener("wheel", Re));
700
703
  }), {
701
704
  intersects: r,
702
- onClick: (m) => g.on(m).off,
705
+ onClick: (m) => h.on(m).off,
703
706
  onDblClick: (m) => b.on(m).off,
704
- onContextMenu: (m) => P.on(m).off,
707
+ onContextMenu: (m) => C.on(m).off,
705
708
  onPointerMove: (m) => y.on(m).off,
706
- onPointerUp: (m) => d.on(m).off,
707
- onPointerDown: (m) => C.on(m).off,
708
- onPointerMissed: (m) => M.on(m).off,
709
+ onPointerUp: (m) => f.on(m).off,
710
+ onPointerDown: (m) => M.on(m).off,
711
+ onPointerMissed: (m) => P.on(m).off,
709
712
  onWheel: (m) => E.on(m).off,
710
713
  forceUpdate: p
711
714
  };
@@ -749,7 +752,7 @@ function xe(e) {
749
752
  function ur(e) {
750
753
  return (e / 1024).toFixed(2);
751
754
  }
752
- const Ce = H({}), Me = (e) => Object.assign(Ce.value, e);
755
+ const Me = H({}), Pe = (e) => Object.assign(Me.value, e);
753
756
  function fr(e, t, n) {
754
757
  var L;
755
758
  const r = $(), s = $();
@@ -779,35 +782,35 @@ function fr(e, t, n) {
779
782
  let R = B.parent;
780
783
  for (; R !== null && !w.stopPropagating && !x.includes(R); )
781
784
  w.eventObject = R, c(R[p], w), x.push(R), R = R.parent;
782
- const ne = Gn(p.slice(2));
785
+ const ne = Vn(p.slice(2));
783
786
  n(ne, { intersection: O, event: w });
784
787
  }
785
788
  }
786
789
  const {
787
790
  onClick: u,
788
791
  onDblClick: v,
789
- onContextMenu: f,
790
- onPointerMove: h,
791
- onPointerDown: g,
792
+ onContextMenu: d,
793
+ onPointerMove: g,
794
+ onPointerDown: h,
792
795
  onPointerUp: b,
793
796
  onPointerMissed: y,
794
- onWheel: d,
795
- forceUpdate: C
797
+ onWheel: f,
798
+ forceUpdate: M
796
799
  } = cr(a, t);
797
- b((p) => o("onPointerUp", p)), g((p) => o("onPointerDown", p)), u((p) => o("onClick", p)), v((p) => o("onDoubleClick", p)), f((p) => o("onContextMenu", p)), d((p) => o("onWheel", p));
798
- let M = [];
799
- h((p) => {
800
+ b((p) => o("onPointerUp", p)), h((p) => o("onPointerDown", p)), u((p) => o("onClick", p)), v((p) => o("onDoubleClick", p)), d((p) => o("onContextMenu", p)), f((p) => o("onWheel", p));
801
+ let P = [];
802
+ g((p) => {
800
803
  const w = p.intersections.map(({ object: D }) => D), x = p.intersections;
801
- M.forEach(({ object: D }) => {
802
- w.includes(D) || (p.intersections = M, o("onPointerLeave", p), o("onPointerOut", p));
804
+ P.forEach(({ object: D }) => {
805
+ w.includes(D) || (p.intersections = P, o("onPointerLeave", p), o("onPointerOut", p));
803
806
  }), p.intersections = x, p.intersections.forEach(({ object: D }) => {
804
- M.includes(D) || (o("onPointerEnter", p), o("onPointerOver", p));
805
- }), o("onPointerMove", p), M = p.intersections;
807
+ P.includes(D) || (o("onPointerEnter", p), o("onPointerOver", p));
808
+ }), o("onPointerMove", p), P = p.intersections;
806
809
  });
807
- const P = [];
810
+ const C = [];
808
811
  y((p) => {
809
812
  const w = () => p.stopPropagating = !0;
810
- p.stopPropagation = w, P.forEach((x) => {
813
+ p.stopPropagation = w, C.forEach((x) => {
811
814
  p.stopPropagating || (p.eventObject = x, c(x.onPointerMissed, p));
812
815
  }), n("pointer-missed", { event: p });
813
816
  });
@@ -821,22 +824,22 @@ function fr(e, t, n) {
821
824
  }
822
825
  }
823
826
  function _(p) {
824
- oe(p) && N(p) && p.onPointerMissed && P.push(p);
827
+ oe(p) && N(p) && p.onPointerMissed && C.push(p);
825
828
  }
826
829
  function A(p) {
827
830
  if (oe(p) && N(p)) {
828
- const w = P.indexOf(p);
829
- w > -1 && P.splice(w, 1);
831
+ const w = C.indexOf(p);
832
+ w > -1 && C.splice(w, 1);
830
833
  }
831
834
  }
832
835
  return t.eventManager = {
833
- forceUpdate: C,
836
+ forceUpdate: M,
834
837
  registerObject: E,
835
838
  deregisterObject: S,
836
839
  registerPointerMissedObject: _,
837
840
  deregisterPointerMissedObject: A
838
841
  }, {
839
- forceUpdate: C,
842
+ forceUpdate: M,
840
843
  registerObject: E,
841
844
  deregisterObject: S,
842
845
  registerPointerMissedObject: _,
@@ -856,8 +859,8 @@ function ve() {
856
859
  let n = 0, r = !1;
857
860
  const s = () => {
858
861
  const o = Array.from(e.entries()).sort((u, v) => {
859
- const f = u[1].priority - v[1].priority;
860
- return f === 0 ? u[1].addI - v[1].addI : f;
862
+ const d = u[1].priority - v[1].priority;
863
+ return d === 0 ? u[1].addI - v[1].addI : d;
861
864
  });
862
865
  t.clear(), o.forEach((u) => t.add(u[0]));
863
866
  }, l = (o) => {
@@ -885,11 +888,11 @@ function pr() {
885
888
  let c = null;
886
889
  const o = ve(), u = ve(), v = ve();
887
890
  S();
888
- let f = {};
889
- function h(_) {
890
- f = _;
891
+ let d = {};
892
+ function g(_) {
893
+ d = _;
891
894
  }
892
- function g(_, A, L = 0) {
895
+ function h(_, A, L = 0) {
893
896
  switch (A) {
894
897
  case "before":
895
898
  return o.on(_, L);
@@ -905,16 +908,16 @@ function pr() {
905
908
  function y() {
906
909
  t = !0, S(), cancelAnimationFrame(i);
907
910
  }
908
- function d() {
911
+ function f() {
909
912
  n = !1, S();
910
913
  }
911
- function C() {
914
+ function M() {
912
915
  n = !0, S();
913
916
  }
914
- function M() {
917
+ function P() {
915
918
  l.value = !0;
916
919
  }
917
- function P() {
920
+ function C() {
918
921
  l.value = !1;
919
922
  }
920
923
  function E() {
@@ -923,13 +926,13 @@ function pr() {
923
926
  return;
924
927
  }
925
928
  const _ = r.getDelta(), A = r.getElapsedTime(), L = {
926
- camera: J(f.camera),
927
- scene: J(f.scene),
928
- renderer: J(f.renderer),
929
- raycaster: J(f.raycaster),
930
- controls: J(f.controls),
931
- invalidate: f.invalidate,
932
- advance: f.advance
929
+ camera: J(d.camera),
930
+ scene: J(d.scene),
931
+ renderer: J(d.renderer),
932
+ raycaster: J(d.raycaster),
933
+ controls: J(d.controls),
934
+ invalidate: d.invalidate,
935
+ advance: d.advance
933
936
  }, p = { delta: _, elapsed: A, clock: r, ...L };
934
937
  s.value && o.trigger(p), l.value || (u.count ? u.trigger(p) : c && c(p)), s.value && v.trigger(p), i = requestAnimationFrame(E);
935
938
  }
@@ -939,16 +942,16 @@ function pr() {
939
942
  }
940
943
  return {
941
944
  loopId: a,
942
- register: (_, A, L) => g(_, A, L),
945
+ register: (_, A, L) => h(_, A, L),
943
946
  start: b,
944
947
  stop: y,
945
- pause: C,
946
- resume: d,
947
- pauseRender: M,
948
- resumeRender: P,
948
+ pause: M,
949
+ resume: f,
950
+ pauseRender: P,
951
+ resumeRender: C,
949
952
  isRenderPaused: l,
950
953
  isActive: s,
951
- setContext: h,
954
+ setContext: g,
952
955
  setReady: (_) => e = _
953
956
  };
954
957
  }
@@ -957,23 +960,23 @@ function mr(e, t, n = 100) {
957
960
  const r = j(), s = /* @__PURE__ */ new Set();
958
961
  let l = !1, i = !1, a = null;
959
962
  function c() {
960
- a && clearTimeout(a), !i && !l && e() ? (r.trigger(t), s.forEach((f) => f()), s.clear(), l = !0) : !i && !l && (a = setTimeout(c, n));
963
+ a && clearTimeout(a), !i && !l && e() ? (r.trigger(t), s.forEach((d) => d()), s.clear(), l = !0) : !i && !l && (a = setTimeout(c, n));
961
964
  }
962
965
  function o() {
963
966
  i = !0, a && clearTimeout(a);
964
967
  }
965
968
  c();
966
- const u = (f, ...h) => {
967
- f(...h);
969
+ const u = (d, ...g) => {
970
+ d(...g);
968
971
  };
969
972
  return {
970
- on: (f) => {
973
+ on: (d) => {
971
974
  if (l)
972
- return u(f, t), { off: () => {
975
+ return u(d, t), { off: () => {
973
976
  } };
974
977
  {
975
- const h = r.on(f);
976
- return s.add(h.off), r.on(f);
978
+ const g = r.on(d);
979
+ return s.add(g.off), r.on(d);
977
980
  }
978
981
  },
979
982
  off: r.off,
@@ -1013,31 +1016,31 @@ function hr({
1013
1016
  cameras: o,
1014
1017
  registerCamera: u,
1015
1018
  deregisterCamera: v,
1016
- setCameraActive: f
1017
- } = Bn({ sizes: a, scene: e }), h = {
1019
+ setCameraActive: d
1020
+ } = In({ sizes: a, scene: e }), g = {
1018
1021
  mode: H(s.renderMode || "always"),
1019
1022
  priority: H(0),
1020
1023
  frames: H(0),
1021
1024
  maxFrames: 60,
1022
- canBeInvalidated: V(() => h.mode.value === "on-demand" && h.frames.value === 0)
1025
+ canBeInvalidated: V(() => g.mode.value === "on-demand" && g.frames.value === 0)
1023
1026
  };
1024
- function g(O = 1) {
1025
- s.renderMode === "on-demand" && (h.frames.value = Math.min(h.maxFrames, h.frames.value + O));
1027
+ function h(O = 1) {
1028
+ s.renderMode === "on-demand" && (g.frames.value = Math.min(g.maxFrames, g.frames.value + O));
1026
1029
  }
1027
1030
  function b() {
1028
- s.renderMode === "manual" && (h.frames.value = 1);
1031
+ s.renderMode === "manual" && (g.frames.value = 1);
1029
1032
  }
1030
- const { renderer: y } = ir(
1033
+ const { renderer: y } = ar(
1031
1034
  {
1032
1035
  scene: e,
1033
1036
  canvas: t,
1034
1037
  options: s,
1035
1038
  emit: l,
1036
1039
  // TODO: replace contextParts with full ctx at https://github.com/Tresjs/tres/issues/516
1037
- contextParts: { sizes: a, camera: c, render: h, invalidate: g, advance: b },
1040
+ contextParts: { sizes: a, camera: c, render: g, invalidate: h, advance: b },
1038
1041
  disableRender: r
1039
1042
  }
1040
- ), d = {
1043
+ ), f = {
1041
1044
  sizes: a,
1042
1045
  scene: i,
1043
1046
  camera: c,
@@ -1057,41 +1060,41 @@ function hr({
1057
1060
  accumulator: []
1058
1061
  }
1059
1062
  },
1060
- render: h,
1063
+ render: g,
1061
1064
  advance: b,
1062
- extend: Me,
1063
- invalidate: g,
1065
+ extend: Pe,
1066
+ invalidate: h,
1064
1067
  registerCamera: u,
1065
- setCameraActive: f,
1068
+ setCameraActive: d,
1066
1069
  deregisterCamera: v,
1067
1070
  loop: pr()
1068
1071
  };
1069
- _e("useTres", d), d.scene.value.__tres = {
1070
- root: d
1071
- }, d.loop.register(() => {
1072
- c.value && h.frames.value > 0 && (y.value.render(e, c.value), l("render", d.renderer.value)), h.priority.value = 0, h.mode.value === "always" ? h.frames.value = 1 : h.frames.value = Math.max(0, h.frames.value - 1);
1072
+ _e("useTres", f), f.scene.value.__tres = {
1073
+ root: f
1074
+ }, f.loop.register(() => {
1075
+ c.value && g.frames.value > 0 && (y.value.render(e, c.value), l("render", f.renderer.value)), g.priority.value = 0, g.mode.value === "always" ? g.frames.value = 1 : g.frames.value = Math.max(0, g.frames.value - 1);
1073
1076
  }, "render");
1074
- const { on: C, cancel: M } = gt(d);
1075
- d.loop.setReady(!1), d.loop.start(), C(() => {
1076
- l("ready", d), d.loop.setReady(!0), fr(e, d, l);
1077
+ const { on: M, cancel: P } = gt(f);
1078
+ f.loop.setReady(!1), f.loop.start(), M(() => {
1079
+ l("ready", f), f.loop.setReady(!0), fr(e, f, l);
1077
1080
  }), K(() => {
1078
- M(), d.loop.stop();
1081
+ P(), f.loop.stop();
1079
1082
  });
1080
- const P = 100, E = an({ every: P }), { isSupported: S, memory: _ } = ln({ interval: P }), A = 160;
1083
+ const C = 100, E = an({ every: C }), { isSupported: S, memory: _ } = ln({ interval: C }), A = 160;
1081
1084
  let L = performance.now();
1082
1085
  const p = ({ timestamp: O }) => {
1083
- d.scene.value && (d.perf.memory.allocatedMem = xe(d.scene.value)), O - L >= P && (L = O, d.perf.fps.accumulator.push(E.value), d.perf.fps.accumulator.length > A && d.perf.fps.accumulator.shift(), d.perf.fps.value = E.value, S.value && _.value && (d.perf.memory.accumulator.push(_.value.usedJSHeapSize / 1024 / 1024), d.perf.memory.accumulator.length > A && d.perf.memory.accumulator.shift(), d.perf.memory.currentMem = d.perf.memory.accumulator.reduce((B, R) => B + R, 0) / d.perf.memory.accumulator.length));
1086
+ f.scene.value && (f.perf.memory.allocatedMem = xe(f.scene.value)), O - L >= C && (L = O, f.perf.fps.accumulator.push(E.value), f.perf.fps.accumulator.length > A && f.perf.fps.accumulator.shift(), f.perf.fps.value = E.value, S.value && _.value && (f.perf.memory.accumulator.push(_.value.usedJSHeapSize / 1024 / 1024), f.perf.memory.accumulator.length > A && f.perf.memory.accumulator.shift(), f.perf.memory.currentMem = f.perf.memory.accumulator.reduce((B, R) => B + R, 0) / f.perf.memory.accumulator.length));
1084
1087
  };
1085
1088
  let w = 0;
1086
1089
  const x = 1, { pause: D } = it(({ delta: O }) => {
1087
- window.__TRES__DEVTOOLS__ && (p({ timestamp: performance.now() }), w += O, w >= x && (window.__TRES__DEVTOOLS__.cb(d), w = 0));
1090
+ window.__TRES__DEVTOOLS__ && (p({ timestamp: performance.now() }), w += O, w >= x && (window.__TRES__DEVTOOLS__.cb(f), w = 0));
1088
1091
  }, { immediate: !0 });
1089
1092
  return K(() => {
1090
1093
  D();
1091
- }), d;
1094
+ }), f;
1092
1095
  }
1093
1096
  function pe() {
1094
- const e = Ct("useTres");
1097
+ const e = Mt("useTres");
1095
1098
  if (!e)
1096
1099
  throw new Error("useTresContext must be used together with useTresContextProvider");
1097
1100
  return e;
@@ -1117,14 +1120,14 @@ function qr() {
1117
1120
  invalidate: i,
1118
1121
  advance: a
1119
1122
  });
1120
- function c(v, f = 0) {
1121
- return r.register(v, "before", f);
1123
+ function c(v, d = 0) {
1124
+ return r.register(v, "before", d);
1122
1125
  }
1123
1126
  function o(v) {
1124
1127
  return r.register(v, "render");
1125
1128
  }
1126
- function u(v, f = 0) {
1127
- return r.register(v, "after", f);
1129
+ function u(v, d = 0) {
1130
+ return r.register(v, "after", d);
1128
1131
  }
1129
1132
  return {
1130
1133
  pause: r.pause,
@@ -1173,63 +1176,63 @@ const { logError: Ke } = Y(), Qe = [
1173
1176
  "onWheel"
1174
1177
  ], vr = (e) => {
1175
1178
  const t = e.scene.value;
1176
- function n(o, u, v, f) {
1177
- if (f || (f = {}), f.args || (f.args = []), o === "template" || Nn(o))
1179
+ function n(o, u, v, d) {
1180
+ if (d || (d = {}), d.args || (d.args = []), o === "template" || zn(o))
1178
1181
  return null;
1179
- let h = o.replace("Tres", ""), g;
1182
+ let g = o.replace("Tres", ""), h;
1180
1183
  if (o === "primitive") {
1181
- (!U(f.object) || Mt(f.object)) && Ke(
1184
+ (!U(d.object) || Pt(d.object)) && Ke(
1182
1185
  "Tres primitives need an 'object' prop, whose value is an object or shallowRef<object>"
1183
- ), h = f.object.type;
1186
+ ), g = d.object.type;
1184
1187
  const b = {};
1185
- g = gr(
1186
- f.object,
1188
+ h = gr(
1189
+ d.object,
1187
1190
  {
1188
- object: (d) => d,
1191
+ object: (f) => f,
1189
1192
  isPrimitive: () => !0,
1190
1193
  __tres: () => b
1191
1194
  },
1192
1195
  {
1193
- object: (d, C, M, P) => {
1194
- or(d, M, P, { patchProp: l, remove: s, insert: r }, e);
1196
+ object: (f, M, P, C) => {
1197
+ sr(f, P, C, { patchProp: l, remove: s, insert: r }, e);
1195
1198
  },
1196
- __tres: (d) => {
1197
- Object.assign(b, d);
1199
+ __tres: (f) => {
1200
+ Object.assign(b, f);
1198
1201
  }
1199
1202
  }
1200
1203
  );
1201
1204
  } else {
1202
- const b = Ce.value[h];
1205
+ const b = Me.value[g];
1203
1206
  b || Ke(
1204
- `${h} is not defined on the THREE namespace. Use extend to add it to the catalog.`
1205
- ), g = new b(...f.args);
1207
+ `${g} is not defined on the THREE namespace. Use extend to add it to the catalog.`
1208
+ ), h = new b(...d.args);
1206
1209
  }
1207
- return g ? (g.isCamera && (f != null && f.position || g.position.set(3, 3, 3), f != null && f.lookAt || g.lookAt(0, 0, 0)), g = z(g, {
1208
- ...g.__tres,
1209
- type: h,
1210
- memoizedProps: f,
1210
+ return h ? (h.isCamera && (d != null && d.position || h.position.set(3, 3, 3), d != null && d.lookAt || h.lookAt(0, 0, 0)), h = z(h, {
1211
+ ...h.__tres,
1212
+ type: g,
1213
+ memoizedProps: d,
1211
1214
  eventCount: 0,
1212
1215
  primitive: o === "primitive",
1213
- attach: f.attach
1214
- }, e), g) : null;
1216
+ attach: d.attach
1217
+ }, e), h) : null;
1215
1218
  }
1216
1219
  function r(o, u) {
1217
- var h, g, b;
1220
+ var g, h, b;
1218
1221
  if (!o)
1219
1222
  return;
1220
1223
  u = u || t;
1221
- const v = o.__tres ? o : z(o, {}, e), f = u.__tres ? u : z(u, {}, e);
1222
- o = Q(v), u = Q(f), o.__tres && ((h = o.__tres) == null ? void 0 : h.eventCount) > 0 && ((g = e.eventManager) == null || g.registerObject(o)), e.registerCamera(o), (b = e.eventManager) == null || b.registerPointerMissedObject(o), v.__tres.attach ? tr(f, v, v.__tres.attach) : N(o) && N(f) && (f.add(o), o.dispatchEvent({ type: "added" })), v.__tres.parent = f, f.__tres.objects && !f.__tres.objects.includes(v) && f.__tres.objects.push(v);
1224
+ const v = o.__tres ? o : z(o, {}, e), d = u.__tres ? u : z(u, {}, e);
1225
+ o = Q(v), u = Q(d), o.__tres && ((g = o.__tres) == null ? void 0 : g.eventCount) > 0 && ((h = e.eventManager) == null || h.registerObject(o)), e.registerCamera(o), (b = e.eventManager) == null || b.registerPointerMissedObject(o), v.__tres.attach ? nr(d, v, v.__tres.attach) : N(o) && N(d) && (d.add(o), o.dispatchEvent({ type: "added" })), v.__tres.parent = d, d.__tres.objects && !d.__tres.objects.includes(v) && d.__tres.objects.push(v);
1223
1226
  }
1224
1227
  function s(o, u) {
1225
- var g, b, y, d;
1228
+ var h, b, y, f;
1226
1229
  if (!o)
1227
1230
  return;
1228
- o != null && o.__tres && ((g = o.__tres) == null ? void 0 : g.eventCount) > 0 && ((b = e.eventManager) == null || b.deregisterObject(o)), u = be(u) ? "default" : u;
1231
+ o != null && o.__tres && ((h = o.__tres) == null ? void 0 : h.eventCount) > 0 && ((b = e.eventManager) == null || b.deregisterObject(o)), u = be(u) ? "default" : u;
1229
1232
  const v = (y = o.__tres) == null ? void 0 : y.dispose;
1230
1233
  be(v) || (v === null ? u = !1 : u = v);
1231
- const f = (d = o.__tres) == null ? void 0 : d.primitive, h = u === "default" ? !f : !!u;
1232
- if (o.__tres && "objects" in o.__tres && [...o.__tres.objects].forEach((C) => s(C, u)), h && o.children && [...o.children].forEach((C) => s(C, u)), mt(o, e), ht(o, e), h && !Dn(o)) {
1234
+ const d = (f = o.__tres) == null ? void 0 : f.primitive, g = u === "default" ? !d : !!u;
1235
+ if (o.__tres && "objects" in o.__tres && [...o.__tres.objects].forEach((M) => s(M, u)), g && o.children && [...o.children].forEach((M) => s(M, u)), mt(o, e), ht(o, e), g && !jn(o)) {
1233
1236
  if (G(u))
1234
1237
  u(o);
1235
1238
  else if (G(o.dispose))
@@ -1240,53 +1243,53 @@ const { logError: Ke } = Y(), Qe = [
1240
1243
  }
1241
1244
  "__tres" in o && delete o.__tres;
1242
1245
  }
1243
- function l(o, u, v, f) {
1244
- var C, M;
1246
+ function l(o, u, v, d) {
1247
+ var M, P;
1245
1248
  if (!o)
1246
1249
  return;
1247
- let h = o, g = u;
1248
- if (o.__tres && (o.__tres.memoizedProps[u] = f), u === "attach") {
1249
- const P = ((C = o.__tres) == null ? void 0 : C.parent) || o.parent;
1250
- s(o), z(o, { attach: f }, e), P && r(o, P);
1250
+ let g = o, h = u;
1251
+ if (o.__tres && (o.__tres.memoizedProps[u] = d), u === "attach") {
1252
+ const C = ((M = o.__tres) == null ? void 0 : M.parent) || o.parent;
1253
+ s(o), z(o, { attach: d }, e), C && r(o, C);
1251
1254
  return;
1252
1255
  }
1253
1256
  if (u === "dispose") {
1254
- o.__tres || (o = z(o, {}, e)), o.__tres.dispose = f;
1257
+ o.__tres || (o = z(o, {}, e)), o.__tres.dispose = d;
1255
1258
  return;
1256
1259
  }
1257
- if (N(o) && g === "blocks-pointer-events") {
1258
- f || f === "" ? o[g] = f : delete o[g];
1260
+ if (N(o) && h === "blocks-pointer-events") {
1261
+ d || d === "" ? o[h] = d : delete o[h];
1259
1262
  return;
1260
1263
  }
1261
1264
  Qe.includes(u) && o.__tres && (o.__tres.eventCount += 1);
1262
- let b = ie(g), y = h == null ? void 0 : h[b];
1263
- if (g === "args") {
1264
- const P = o, E = v ?? [], S = f ?? [], _ = ((M = o.__tres) == null ? void 0 : M.type) || o.type;
1265
- _ && E.length && !qn(E, S) && (h = Object.assign(
1266
- P,
1267
- new Ce.value[_](...f)
1265
+ let b = ie(h), y = g == null ? void 0 : g[b];
1266
+ if (h === "args") {
1267
+ const C = o, E = v ?? [], S = d ?? [], _ = ((P = o.__tres) == null ? void 0 : P.type) || o.type;
1268
+ _ && E.length && !Jn(E, S) && (g = Object.assign(
1269
+ C,
1270
+ new Me.value[_](...d)
1268
1271
  ));
1269
1272
  return;
1270
1273
  }
1271
- if (h.type === "BufferGeometry") {
1272
- if (g === "args")
1274
+ if (g.type === "BufferGeometry") {
1275
+ if (h === "args")
1273
1276
  return;
1274
- h.setAttribute(
1275
- ie(g),
1276
- new Wt(...f)
1277
+ g.setAttribute(
1278
+ ie(h),
1279
+ new Wt(...d)
1277
1280
  );
1278
1281
  return;
1279
1282
  }
1280
- if (g.includes("-") && y === void 0) {
1281
- const P = g.split("-");
1282
- y = P.reduce((E, S) => E[ie(S)], h), g = P.pop(), b = g, y != null && y.set || (h = P.reduce((E, S) => E[ie(S)], h));
1283
+ if (h.includes("-") && y === void 0) {
1284
+ const C = h.split("-");
1285
+ y = C.reduce((E, S) => E[ie(S)], g), h = C.pop(), b = h, y != null && y.set || (g = C.reduce((E, S) => E[ie(S)], g));
1283
1286
  }
1284
- let d = f;
1285
- if (d === "" && (d = !0), G(y)) {
1286
- Qe.includes(u) || (de(d) ? o[b](...d) : o[b](d)), b.startsWith("on") && G(d) && (h[b] = d);
1287
+ let f = d;
1288
+ if (f === "" && (f = !0), G(y)) {
1289
+ Qe.includes(u) || (de(f) ? o[b](...f) : o[b](f)), b.startsWith("on") && G(f) && (g[b] = f);
1287
1290
  return;
1288
1291
  }
1289
- !(y != null && y.set) && !G(y) ? h[b] = d : y.constructor === d.constructor && (y != null && y.copy) ? y == null || y.copy(d) : de(d) ? y.set(...d) : !y.isColor && y.setScalar ? y.setScalar(d) : y.set(d), pt(o);
1292
+ !(y != null && y.set) && !G(y) ? g[b] = f : y.constructor === f.constructor && (y != null && y.copy) ? y == null || y.copy(f) : de(f) ? y.set(...f) : !y.isColor && y.setScalar ? y.setScalar(f) : y.set(f), pt(o);
1290
1293
  }
1291
1294
  function i(o) {
1292
1295
  var u;
@@ -1297,9 +1300,9 @@ const { logError: Ke } = Y(), Qe = [
1297
1300
  return u.name = o, u;
1298
1301
  }
1299
1302
  function c(o) {
1300
- var h;
1301
- const u = i(o), v = ((h = u == null ? void 0 : u.__tres) == null ? void 0 : h.objects) || [], f = v.indexOf(o);
1302
- return f < 0 || f >= v.length - 1 ? null : v[f + 1];
1303
+ var g;
1304
+ const u = i(o), v = ((g = u == null ? void 0 : u.__tres) == null ? void 0 : g.objects) || [], d = v.indexOf(o);
1305
+ return d < 0 || d >= v.length - 1 ? null : v[d + 1];
1303
1306
  }
1304
1307
  return {
1305
1308
  insert: r,
@@ -1326,14 +1329,14 @@ function vt() {
1326
1329
  }
1327
1330
  const _r = typeof Proxy == "function", wr = "devtools-plugin:setup", br = "plugin:settings:set";
1328
1331
  let q, Ee;
1329
- function Pr() {
1332
+ function Cr() {
1330
1333
  var e;
1331
1334
  return q !== void 0 || (typeof window < "u" && window.performance ? (q = !0, Ee = window.performance) : typeof globalThis < "u" && (!((e = globalThis.perf_hooks) === null || e === void 0) && e.performance) ? (q = !0, Ee = globalThis.perf_hooks.performance) : q = !1), q;
1332
1335
  }
1333
- function Cr() {
1334
- return Pr() ? Ee.now() : Date.now();
1336
+ function Mr() {
1337
+ return Cr() ? Ee.now() : Date.now();
1335
1338
  }
1336
- class Mr {
1339
+ class Pr {
1337
1340
  constructor(t, n) {
1338
1341
  this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin = t, this.hook = n;
1339
1342
  const r = {};
@@ -1361,7 +1364,7 @@ class Mr {
1361
1364
  l = i;
1362
1365
  },
1363
1366
  now() {
1364
- return Cr();
1367
+ return Mr();
1365
1368
  }
1366
1369
  }, n && n.on(br, (i, a) => {
1367
1370
  i === this.plugin.id && this.fallbacks.setSettings(a);
@@ -1400,7 +1403,7 @@ function Er(e, t) {
1400
1403
  if (s && (r.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !l))
1401
1404
  s.emit(wr, e, t);
1402
1405
  else {
1403
- const i = l ? new Mr(n, s) : null;
1406
+ const i = l ? new Pr(n, s) : null;
1404
1407
  (r.__VUE_DEVTOOLS_PLUGINS__ = r.__VUE_DEVTOOLS_PLUGINS__ || []).push({
1405
1408
  pluginDescriptor: n,
1406
1409
  setupFn: t,
@@ -1433,7 +1436,7 @@ const yt = (e) => {
1433
1436
  textColor: 15707189,
1434
1437
  backgroundColor: 16775644,
1435
1438
  tooltip: "Memory usage"
1436
- }), e.type.includes("Light") && (Rn(e) && t.tags.push({
1439
+ }), e.type.includes("Light") && (On(e) && t.tags.push({
1437
1440
  label: `${e.intensity}`,
1438
1441
  textColor: 9738662,
1439
1442
  backgroundColor: 16316922,
@@ -1503,7 +1506,7 @@ function xr(e, t) {
1503
1506
  if (!a)
1504
1507
  return;
1505
1508
  if (s && r && r.parent && s.remove(r), a.isMesh) {
1506
- const c = Qn(a);
1509
+ const c = Xn(a);
1507
1510
  a.add(c), r = c, s = a;
1508
1511
  }
1509
1512
  l.state = {
@@ -1526,7 +1529,7 @@ function xr(e, t) {
1526
1529
  }))) || []);
1527
1530
  }
1528
1531
  }), n.on.editInspectorState((l) => {
1529
- l.inspectorId === X && Kn(t.scene.value, l.nodeId, l.path, l.state.value);
1532
+ l.inspectorId === X && Qn(t.scene.value, l.nodeId, l.path, l.state.value);
1530
1533
  });
1531
1534
  }
1532
1535
  );
@@ -1578,37 +1581,37 @@ const kr = ["data-scene", "data-tres"], Lr = /* @__PURE__ */ Be({
1578
1581
  setup(e, { expose: t, emit: n }) {
1579
1582
  var y;
1580
1583
  const r = e, s = n, l = Tt(), { logWarning: i } = Y(), a = H(), c = $(new nt()), o = (y = Ie()) == null ? void 0 : y.appContext.app;
1581
- Me(et);
1582
- const u = (d, C = !1) => Be({
1584
+ Pe(et);
1585
+ const u = (f, M = !1) => Be({
1583
1586
  setup() {
1584
- var P;
1585
- const M = (P = Ie()) == null ? void 0 : P.appContext;
1586
- return M && (M.app = o), _e("useTres", d), _e("extend", Me), typeof window < "u" && xr(M == null ? void 0 : M.app, d), () => He(Ot, null, C ? [] : l.default());
1587
+ var C;
1588
+ const P = (C = Ie()) == null ? void 0 : C.appContext;
1589
+ return P && (P.app = o), _e("useTres", f), _e("extend", Pe), typeof window < "u" && xr(P == null ? void 0 : P.app, f), () => He(Ot, null, M ? [] : l.default());
1587
1590
  }
1588
- }), v = (d, C = !1) => {
1589
- const M = u(d, C), { render: P } = Rt(vr(d));
1590
- P(He(M), c.value);
1591
- }, f = (d, C = !1) => {
1592
- dt(d.scene.value), C && (d.renderer.value.dispose(), d.renderer.value.renderLists.dispose(), d.renderer.value.forceContextLoss()), c.value.__tres = {
1593
- root: d
1591
+ }), v = (f, M = !1) => {
1592
+ const P = u(f, M), { render: C } = Rt(vr(f));
1593
+ C(He(P), c.value);
1594
+ }, d = (f, M = !1) => {
1595
+ dt(f.scene.value), M && (f.renderer.value.dispose(), f.renderer.value.renderLists.dispose(), f.renderer.value.forceContextLoss()), c.value.__tres = {
1596
+ root: f
1594
1597
  };
1595
- }, h = V(() => r.disableRender), g = $(null);
1596
- t({ context: g, dispose: () => f(g.value, !0) });
1598
+ }, g = V(() => r.disableRender), h = $(null);
1599
+ t({ context: h, dispose: () => d(h.value, !0) });
1597
1600
  const b = () => {
1598
- f(g.value), v(g.value, !0);
1601
+ d(h.value), v(h.value, !0);
1599
1602
  };
1600
1603
  return St(() => {
1601
- const d = a;
1602
- g.value = hr({
1604
+ const f = a;
1605
+ h.value = hr({
1603
1606
  scene: c.value,
1604
- canvas: d,
1607
+ canvas: f,
1605
1608
  windowSize: r.windowSize ?? !1,
1606
- disableRender: h.value ?? !1,
1609
+ disableRender: g.value ?? !1,
1607
1610
  rendererOptions: r,
1608
1611
  emit: s
1609
1612
  });
1610
- const { registerCamera: C, camera: M, cameras: P, deregisterCamera: E } = g.value;
1611
- v(g.value);
1613
+ const { registerCamera: M, camera: P, cameras: C, deregisterCamera: E } = h.value;
1614
+ v(h.value);
1612
1615
  const S = () => {
1613
1616
  const _ = new we(
1614
1617
  45,
@@ -1616,38 +1619,38 @@ const kr = ["data-scene", "data-tres"], Lr = /* @__PURE__ */ Be({
1616
1619
  0.1,
1617
1620
  1e3
1618
1621
  );
1619
- _.position.set(3, 3, 3), _.lookAt(0, 0, 0), C(_);
1622
+ _.position.set(3, 3, 3), _.lookAt(0, 0, 0), M(_);
1620
1623
  const A = Te(() => {
1621
- P.value.length >= 2 && (_.removeFromParent(), E(_), A == null || A());
1624
+ C.value.length >= 2 && (_.removeFromParent(), E(_), A == null || A());
1622
1625
  });
1623
1626
  };
1624
1627
  ce(
1625
1628
  () => r.camera,
1626
1629
  (_, A) => {
1627
- _ && C(_), A && (A.removeFromParent(), E(A));
1630
+ _ && M(_), A && (A.removeFromParent(), E(A));
1628
1631
  },
1629
1632
  {
1630
1633
  immediate: !0
1631
1634
  }
1632
- ), M.value || (i(
1635
+ ), P.value || (i(
1633
1636
  "No camera found. Creating a default perspective camera. To have full control over a camera, please add one to the scene."
1634
1637
  ), S());
1635
- }), K(b), (d, C) => (At(), xt("canvas", {
1638
+ }), K(b), (f, M) => (At(), xt("canvas", {
1636
1639
  ref_key: "canvas",
1637
1640
  ref: a,
1638
1641
  "data-scene": c.value.uuid,
1639
- class: kt(d.$attrs.class),
1640
- "data-tres": `tresjs ${J(An).version}`,
1642
+ class: kt(f.$attrs.class),
1643
+ "data-tres": `tresjs ${J(xn).version}`,
1641
1644
  style: Lt({
1642
1645
  display: "block",
1643
1646
  width: "100%",
1644
1647
  height: "100%",
1645
- position: d.windowSize ? "fixed" : "relative",
1648
+ position: f.windowSize ? "fixed" : "relative",
1646
1649
  top: 0,
1647
1650
  left: 0,
1648
1651
  pointerEvents: "auto",
1649
1652
  touchAction: "none",
1650
- ...d.$attrs.style
1653
+ ...f.$attrs.style
1651
1654
  })
1652
1655
  }, null, 14, kr));
1653
1656
  }
@@ -1724,7 +1727,7 @@ let I = null;
1724
1727
  const Xr = {
1725
1728
  updated: (e, t) => {
1726
1729
  var s;
1727
- const n = Xn(t);
1730
+ const n = Zn(t);
1728
1731
  if (!n) {
1729
1732
  jr(`v-distance-to: problem with binding value: ${t.value}`);
1730
1733
  return;
@@ -1749,24 +1752,24 @@ const Xr = {
1749
1752
  };
1750
1753
  export {
1751
1754
  Lr as TresCanvas,
1752
- Ce as catalogue,
1755
+ Me as catalogue,
1753
1756
  pr as createRenderLoop,
1754
1757
  Zr as default,
1755
1758
  dt as dispose,
1756
- Me as extend,
1759
+ Pe as extend,
1757
1760
  Fr as isProd,
1758
- Un as normalizeColor,
1761
+ Fn as normalizeColor,
1759
1762
  Wr as normalizeVectorFlexibleParam,
1760
1763
  Vr as onTresReady,
1761
1764
  Jr as templateCompilerOptions,
1762
1765
  lr as trasverseObjects,
1763
- Bn as useCamera,
1766
+ In as useCamera,
1764
1767
  Nr as useLoader,
1765
1768
  Y as useLogger,
1766
1769
  qr as useLoop,
1767
1770
  cr as useRaycaster,
1768
1771
  Ur as useRenderLoop,
1769
- ir as useRenderer,
1772
+ ar as useRenderer,
1770
1773
  Gr as useSeek,
1771
1774
  zr as useTexture,
1772
1775
  Yr as useTres,