@tresjs/core 4.2.7 → 4.2.9

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,18 +1,18 @@
1
1
  /**
2
2
  * name: @tresjs/core
3
- * version: v4.2.7
3
+ * version: v4.2.9
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.7", 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.9", 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
16
  type: "git",
17
17
  url: "git+https://github.com/Tresjs/tres.git"
18
18
  }, vn = [
@@ -40,15 +40,15 @@ const cn = "@tresjs/core", un = "module", fn = "4.2.7", dn = "pnpm@9.1.4", pn =
40
40
  types: "./dist/src/utils/index.d.ts"
41
41
  },
42
42
  "./*": "./*"
43
- }, wn = "./dist/tres.js", bn = "./dist/tres.js", Pn = "./dist/index.d.ts", Cn = [
43
+ }, wn = "./dist/tres.js", bn = "./dist/tres.js", Cn = "./dist/index.d.ts", Mn = [
44
44
  "*.d.ts",
45
45
  "dist"
46
- ], Mn = {
46
+ ], Pn = {
47
47
  access: "public"
48
48
  }, En = {
49
- dev: "cd playground && npm run dev",
49
+ dev: "cd playground/vue && npm run dev",
50
+ "dev:nuxt": "cd playground/nuxt && npm run dev",
50
51
  build: "vite build",
51
- playground: "cd playground && npm run dev",
52
52
  test: "vitest",
53
53
  "test:ci": "vitest run",
54
54
  "test:ui": "vitest --ui --coverage.enabled=true",
@@ -124,9 +124,9 @@ const cn = "@tresjs/core", un = "module", fn = "4.2.7", dn = "pnpm@9.1.4", pn =
124
124
  exports: _n,
125
125
  main: wn,
126
126
  module: bn,
127
- types: Pn,
128
- files: Cn,
129
- publishConfig: Mn,
127
+ types: Cn,
128
+ files: Mn,
129
+ publishConfig: Pn,
130
130
  scripts: En,
131
131
  peerDependencies: Tn,
132
132
  dependencies: Sn,
@@ -228,14 +228,14 @@ Ae.on(() => {
228
228
  ue = ee.getDelta(), fe = ee.getElapsedTime();
229
229
  });
230
230
  let ze = !1;
231
- const Fr = () => (ze || (ze = !0, Ne()), {
231
+ const Ur = () => (ze || (ze = !0, Ne()), {
232
232
  onBeforeLoop: lt.on,
233
233
  onLoop: ct.on,
234
234
  onAfterLoop: Ae.on,
235
235
  pause: $n,
236
236
  resume: Ne,
237
237
  isActive: Un
238
- }), Wr = !0, se = "[TresJS ▲ ■ ●] ";
238
+ }), Fr = !0, se = "[TresJS ▲ ■ ●] ";
239
239
  function Y() {
240
240
  function e(...r) {
241
241
  typeof r[0] == "string" ? r[0] = se + r[0] : r.unshift(se), console.error(...r);
@@ -251,7 +251,7 @@ function Y() {
251
251
  logMessage: n
252
252
  };
253
253
  }
254
- function Nr(e) {
254
+ function Wr(e) {
255
255
  return typeof e == "number" ? [e, e, e] : e instanceof Se ? [e.x, e.y, e.z] : e;
256
256
  }
257
257
  function Fn(e) {
@@ -387,7 +387,7 @@ function tr(e, t) {
387
387
  t(e[r], r) && (e[n] = e[r], n++);
388
388
  return e.length = n, e;
389
389
  }
390
- function Pe(e, t) {
390
+ function Ce(e, t) {
391
391
  let n = e;
392
392
  if (t.includes("-")) {
393
393
  const r = t.split("-");
@@ -405,7 +405,7 @@ const Je = /-\d+$/;
405
405
  function nr(e, t, n) {
406
406
  if (at(n)) {
407
407
  if (Je.test(n)) {
408
- 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);
409
409
  if (!Array.isArray(i[a])) {
410
410
  const c = i[a], o = [];
411
411
  o.__tresDetach = () => {
@@ -413,7 +413,7 @@ function nr(e, t, n) {
413
413
  }, i[a] = o;
414
414
  }
415
415
  }
416
- const { target: r, key: s } = Pe(e, n);
416
+ const { target: r, key: s } = Ce(e, n);
417
417
  t.__tres.previousAttach = r[s], r[s] = Q(t);
418
418
  } else
419
419
  t.__tres.previousAttach = n(e, t);
@@ -421,7 +421,7 @@ function nr(e, t, n) {
421
421
  function rr(e, t, n) {
422
422
  var r, s, l;
423
423
  if (at(n)) {
424
- 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;
425
425
  c === void 0 ? delete i[a] : i[a] = c, "__tresDetach" in i && i.__tresDetach();
426
426
  } else
427
427
  (s = (r = t.__tres) == null ? void 0 : r.previousAttach) == null || s.call(r, e, t);
@@ -534,37 +534,37 @@ function ar({
534
534
  }, {
535
535
  immediate: !0
536
536
  }), ce(() => t.clearColor, c);
537
- const { pixelRatio: o } = en(), { logError: u } = Y(), f = (() => {
538
- const g = new he(), b = {
537
+ const { pixelRatio: o } = en(), { logError: u } = Y(), d = (() => {
538
+ const h = new he(), b = {
539
539
  shadowMap: {
540
- enabled: g.shadowMap.enabled,
541
- type: g.shadowMap.type
540
+ enabled: h.shadowMap.enabled,
541
+ type: h.shadowMap.type
542
542
  },
543
- toneMapping: g.toneMapping,
544
- toneMappingExposure: g.toneMappingExposure,
545
- outputColorSpace: g.outputColorSpace
543
+ toneMapping: h.toneMapping,
544
+ toneMappingExposure: h.toneMappingExposure,
545
+ outputColorSpace: h.outputColorSpace
546
546
  };
547
- return g.dispose(), b;
548
- })(), h = k(t.renderMode);
549
- 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(() => {
550
550
  l();
551
551
  }, 100), Te(() => {
552
- const g = k(t.preset);
553
- g && (g in ae || u(`Renderer Preset must be one of these: ${Object.keys(ae).join(", ")}`), ut(a.value, ae[g])), or(a.value, o.value, k(t.dpr)), h === "always" && (r.frames.value = Math.max(1, r.frames.value));
554
- const b = (C, M) => {
555
- const P = k(C), E = () => {
556
- if (g)
557
- 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);
558
558
  };
559
- if (P !== void 0)
560
- return P;
559
+ if (C !== void 0)
560
+ return C;
561
561
  const S = E();
562
- return S !== void 0 ? S : Ve(f, M);
563
- }, y = (C, M) => qn(a.value, M, b(C, M));
562
+ return S !== void 0 ? S : Ve(d, P);
563
+ }, y = (M, P) => qn(a.value, P, b(M, P));
564
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 d = b(t.clearColor, "clearColor");
566
- d && a.value.setClearColor(
567
- d ? Fn(d) : new Z(0)
565
+ const f = b(t.clearColor, "clearColor");
566
+ f && a.value.setClearColor(
567
+ f ? Fn(f) : new Z(0)
568
568
  // default clear color is not easily/efficiently retrievable from three
569
569
  );
570
570
  }), K(() => {
@@ -573,32 +573,29 @@ function ar({
573
573
  renderer: a
574
574
  };
575
575
  }
576
- const lr = (e) => !!e && e.constructor === Array;
577
- function cr(e) {
576
+ function lr(e) {
578
577
  const t = { nodes: {}, materials: {} };
579
578
  return e && e.traverse((n) => {
580
579
  n.name && (t.nodes[n.name] = n), n.material && !t.materials[n.material.name] && (t.materials[n.material.name] = n.material);
581
580
  }), t;
582
581
  }
583
- async function zr(e, t, n, r, s) {
582
+ async function Nr(e, t, n, r, s) {
584
583
  const { logError: l } = Y(), i = new e();
585
- s && s(i), n && n(i);
586
- const c = (Array.isArray(t) ? t : [t]).map(
587
- (o) => new Promise((u, v) => {
588
- i.load(
589
- o,
590
- (f) => {
591
- const h = f;
592
- h.scene && Object.assign(h, cr(h.scene)), u(h);
593
- },
594
- r,
595
- (f) => v(l("[useLoader] - Failed to load resource", f))
596
- );
597
- })
598
- );
599
- return lr(t) ? await Promise.all(c) : await c[0];
584
+ return s && s(i), n && n(i), await new Promise((a, c) => {
585
+ i.load(
586
+ t,
587
+ (o) => {
588
+ const u = o;
589
+ u.scene && Object.assign(u, lr(u.scene)), a(u);
590
+ },
591
+ r,
592
+ (o) => {
593
+ l("[useLoader] - Failed to load resource", o), c(o);
594
+ }
595
+ );
596
+ });
600
597
  }
601
- async function Gr(e, t) {
598
+ async function zr(e, t) {
602
599
  const n = new Ut(t), r = (s) => new Promise((l, i) => {
603
600
  n.load(
604
601
  s,
@@ -635,7 +632,7 @@ async function Gr(e, t) {
635
632
  };
636
633
  }
637
634
  }
638
- const ur = (e, t) => {
635
+ const cr = (e, t) => {
639
636
  const n = V(() => t.renderer.value.domElement), r = $([]), { x: s, y: l } = tn({ target: n });
640
637
  let i = 0;
641
638
  const { width: a, height: c, top: o, left: u } = nn(n), v = ({ x: m, y: T }) => {
@@ -644,16 +641,16 @@ const ur = (e, t) => {
644
641
  x: (m - u.value) / a.value * 2 - 1,
645
642
  y: -((T - o.value) / c.value) * 2 + 1
646
643
  };
647
- }, f = ({ x: m, y: T }) => {
644
+ }, d = ({ x: m, y: T }) => {
648
645
  if (t.camera.value)
649
646
  return t.raycaster.value.setFromCamera(new ge(m, T), t.camera.value), r.value = t.raycaster.value.intersectObjects(e.value, !0), r.value;
650
- }, h = (m) => {
647
+ }, g = (m) => {
651
648
  const T = v({
652
649
  x: (m == null ? void 0 : m.clientX) ?? s.value,
653
650
  y: (m == null ? void 0 : m.clientY) ?? l.value
654
651
  });
655
- return T ? f(T) || [] : [];
656
- }, g = j(), b = j(), y = j(), d = j(), C = j(), M = j(), P = j(), E = j();
652
+ return T ? d(T) || [] : [];
653
+ }, h = j(), b = j(), y = j(), f = j(), M = j(), P = j(), C = j(), E = j();
657
654
  function S(m) {
658
655
  const T = {};
659
656
  for (const F in m)
@@ -677,7 +674,7 @@ const ur = (e, t) => {
677
674
  };
678
675
  let A;
679
676
  const L = (m) => {
680
- h(m), _(y, m), A = m;
677
+ g(m), _(y, m), A = m;
681
678
  }, p = () => {
682
679
  A && L(A);
683
680
  };
@@ -687,15 +684,15 @@ const ur = (e, t) => {
687
684
  w = (T = r.value[0]) == null ? void 0 : T.object, i = 0, x = new ge(
688
685
  (m == null ? void 0 : m.clientX) ?? s.value,
689
686
  (m == null ? void 0 : m.clientY) ?? l.value
690
- ), _(C, m);
687
+ ), _(M, m);
691
688
  };
692
689
  let B, R = !1;
693
690
  const ne = (m) => {
694
691
  var T, F, re;
695
- m instanceof PointerEvent && (r.value.length === 0 && _(M, m), w === ((T = r.value[0]) == null ? void 0 : T.object) && (D = new ge(
692
+ m instanceof PointerEvent && (r.value.length === 0 && _(P, m), w === ((T = r.value[0]) == null ? void 0 : T.object) && (D = new ge(
696
693
  (m == null ? void 0 : m.clientX) ?? s.value,
697
694
  (m == null ? void 0 : m.clientY) ?? l.value
698
- ), 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));
695
+ ), 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));
699
696
  }, ke = (m) => {
700
697
  R && (_(b, m), B = void 0, R = !1);
701
698
  }, Le = (m) => _(y, m), Re = (m) => _(E, m);
@@ -703,18 +700,18 @@ const ur = (e, t) => {
703
700
  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));
704
701
  }), {
705
702
  intersects: r,
706
- onClick: (m) => g.on(m).off,
703
+ onClick: (m) => h.on(m).off,
707
704
  onDblClick: (m) => b.on(m).off,
708
- onContextMenu: (m) => P.on(m).off,
705
+ onContextMenu: (m) => C.on(m).off,
709
706
  onPointerMove: (m) => y.on(m).off,
710
- onPointerUp: (m) => d.on(m).off,
711
- onPointerDown: (m) => C.on(m).off,
712
- onPointerMissed: (m) => M.on(m).off,
707
+ onPointerUp: (m) => f.on(m).off,
708
+ onPointerDown: (m) => M.on(m).off,
709
+ onPointerMissed: (m) => P.on(m).off,
713
710
  onWheel: (m) => E.on(m).off,
714
711
  forceUpdate: p
715
712
  };
716
713
  };
717
- function Vr() {
714
+ function Gr() {
718
715
  const { logWarning: e } = Y();
719
716
  function t(l, i, a) {
720
717
  let c = null;
@@ -750,11 +747,11 @@ function xe(e) {
750
747
  }
751
748
  }), t;
752
749
  }
753
- function fr(e) {
750
+ function ur(e) {
754
751
  return (e / 1024).toFixed(2);
755
752
  }
756
- const Ce = H({}), Me = (e) => Object.assign(Ce.value, e);
757
- function dr(e, t, n) {
753
+ const Me = H({}), Pe = (e) => Object.assign(Me.value, e);
754
+ function fr(e, t, n) {
758
755
  var L;
759
756
  const r = $(), s = $();
760
757
  e && (r.value = e), t && (s.value = t);
@@ -790,28 +787,28 @@ function dr(e, t, n) {
790
787
  const {
791
788
  onClick: u,
792
789
  onDblClick: v,
793
- onContextMenu: f,
794
- onPointerMove: h,
795
- onPointerDown: g,
790
+ onContextMenu: d,
791
+ onPointerMove: g,
792
+ onPointerDown: h,
796
793
  onPointerUp: b,
797
794
  onPointerMissed: y,
798
- onWheel: d,
799
- forceUpdate: C
800
- } = ur(a, t);
801
- 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));
802
- let M = [];
803
- h((p) => {
795
+ onWheel: f,
796
+ forceUpdate: M
797
+ } = cr(a, t);
798
+ 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));
799
+ let P = [];
800
+ g((p) => {
804
801
  const w = p.intersections.map(({ object: D }) => D), x = p.intersections;
805
- M.forEach(({ object: D }) => {
806
- w.includes(D) || (p.intersections = M, o("onPointerLeave", p), o("onPointerOut", p));
802
+ P.forEach(({ object: D }) => {
803
+ w.includes(D) || (p.intersections = P, o("onPointerLeave", p), o("onPointerOut", p));
807
804
  }), p.intersections = x, p.intersections.forEach(({ object: D }) => {
808
- M.includes(D) || (o("onPointerEnter", p), o("onPointerOver", p));
809
- }), o("onPointerMove", p), M = p.intersections;
805
+ P.includes(D) || (o("onPointerEnter", p), o("onPointerOver", p));
806
+ }), o("onPointerMove", p), P = p.intersections;
810
807
  });
811
- const P = [];
808
+ const C = [];
812
809
  y((p) => {
813
810
  const w = () => p.stopPropagating = !0;
814
- p.stopPropagation = w, P.forEach((x) => {
811
+ p.stopPropagation = w, C.forEach((x) => {
815
812
  p.stopPropagating || (p.eventObject = x, c(x.onPointerMissed, p));
816
813
  }), n("pointer-missed", { event: p });
817
814
  });
@@ -825,29 +822,29 @@ function dr(e, t, n) {
825
822
  }
826
823
  }
827
824
  function _(p) {
828
- oe(p) && N(p) && p.onPointerMissed && P.push(p);
825
+ oe(p) && N(p) && p.onPointerMissed && C.push(p);
829
826
  }
830
827
  function A(p) {
831
828
  if (oe(p) && N(p)) {
832
- const w = P.indexOf(p);
833
- w > -1 && P.splice(w, 1);
829
+ const w = C.indexOf(p);
830
+ w > -1 && C.splice(w, 1);
834
831
  }
835
832
  }
836
833
  return t.eventManager = {
837
- forceUpdate: C,
834
+ forceUpdate: M,
838
835
  registerObject: E,
839
836
  deregisterObject: S,
840
837
  registerPointerMissedObject: _,
841
838
  deregisterPointerMissedObject: A
842
839
  }, {
843
- forceUpdate: C,
840
+ forceUpdate: M,
844
841
  registerObject: E,
845
842
  deregisterObject: S,
846
843
  registerPointerMissedObject: _,
847
844
  deregisterPointerMissedObject: A
848
845
  };
849
846
  }
850
- function pr(e, t, n = 10) {
847
+ function dr(e, t, n = 10) {
851
848
  const r = k(e) ? rn() : on(V(() => k(t).parentElement)), s = ye(Fe(r.width, n)), l = ye(Fe(r.height, n)), i = V(() => s.value / l.value);
852
849
  return {
853
850
  height: l,
@@ -860,8 +857,8 @@ function ve() {
860
857
  let n = 0, r = !1;
861
858
  const s = () => {
862
859
  const o = Array.from(e.entries()).sort((u, v) => {
863
- const f = u[1].priority - v[1].priority;
864
- return f === 0 ? u[1].addI - v[1].addI : f;
860
+ const d = u[1].priority - v[1].priority;
861
+ return d === 0 ? u[1].addI - v[1].addI : d;
865
862
  });
866
863
  t.clear(), o.forEach((u) => t.add(u[0]));
867
864
  }, l = (o) => {
@@ -881,7 +878,7 @@ function ve() {
881
878
  return e.size;
882
879
  } };
883
880
  }
884
- function mr() {
881
+ function pr() {
885
882
  let e = !0, t = !0, n = !1;
886
883
  const r = new tt(!1), s = H(r.running), l = H(!1);
887
884
  let i;
@@ -889,11 +886,11 @@ function mr() {
889
886
  let c = null;
890
887
  const o = ve(), u = ve(), v = ve();
891
888
  S();
892
- let f = {};
893
- function h(_) {
894
- f = _;
889
+ let d = {};
890
+ function g(_) {
891
+ d = _;
895
892
  }
896
- function g(_, A, L = 0) {
893
+ function h(_, A, L = 0) {
897
894
  switch (A) {
898
895
  case "before":
899
896
  return o.on(_, L);
@@ -909,16 +906,16 @@ function mr() {
909
906
  function y() {
910
907
  t = !0, S(), cancelAnimationFrame(i);
911
908
  }
912
- function d() {
909
+ function f() {
913
910
  n = !1, S();
914
911
  }
915
- function C() {
912
+ function M() {
916
913
  n = !0, S();
917
914
  }
918
- function M() {
915
+ function P() {
919
916
  l.value = !0;
920
917
  }
921
- function P() {
918
+ function C() {
922
919
  l.value = !1;
923
920
  }
924
921
  function E() {
@@ -927,13 +924,13 @@ function mr() {
927
924
  return;
928
925
  }
929
926
  const _ = r.getDelta(), A = r.getElapsedTime(), L = {
930
- camera: J(f.camera),
931
- scene: J(f.scene),
932
- renderer: J(f.renderer),
933
- raycaster: J(f.raycaster),
934
- controls: J(f.controls),
935
- invalidate: f.invalidate,
936
- advance: f.advance
927
+ camera: J(d.camera),
928
+ scene: J(d.scene),
929
+ renderer: J(d.renderer),
930
+ raycaster: J(d.raycaster),
931
+ controls: J(d.controls),
932
+ invalidate: d.invalidate,
933
+ advance: d.advance
937
934
  }, p = { delta: _, elapsed: A, clock: r, ...L };
938
935
  s.value && o.trigger(p), l.value || (u.count ? u.trigger(p) : c && c(p)), s.value && v.trigger(p), i = requestAnimationFrame(E);
939
936
  }
@@ -943,41 +940,41 @@ function mr() {
943
940
  }
944
941
  return {
945
942
  loopId: a,
946
- register: (_, A, L) => g(_, A, L),
943
+ register: (_, A, L) => h(_, A, L),
947
944
  start: b,
948
945
  stop: y,
949
- pause: C,
950
- resume: d,
951
- pauseRender: M,
952
- resumeRender: P,
946
+ pause: M,
947
+ resume: f,
948
+ pauseRender: P,
949
+ resumeRender: C,
953
950
  isRenderPaused: l,
954
951
  isActive: s,
955
- setContext: h,
952
+ setContext: g,
956
953
  setReady: (_) => e = _
957
954
  };
958
955
  }
959
- function hr(e, t, n = 100) {
956
+ function mr(e, t, n = 100) {
960
957
  n = n <= 0 ? 100 : n;
961
958
  const r = j(), s = /* @__PURE__ */ new Set();
962
959
  let l = !1, i = !1, a = null;
963
960
  function c() {
964
- a && clearTimeout(a), !i && !l && e() ? (r.trigger(t), s.forEach((f) => f()), s.clear(), l = !0) : !i && !l && (a = setTimeout(c, n));
961
+ a && clearTimeout(a), !i && !l && e() ? (r.trigger(t), s.forEach((d) => d()), s.clear(), l = !0) : !i && !l && (a = setTimeout(c, n));
965
962
  }
966
963
  function o() {
967
964
  i = !0, a && clearTimeout(a);
968
965
  }
969
966
  c();
970
- const u = (f, ...h) => {
971
- f(...h);
967
+ const u = (d, ...g) => {
968
+ d(...g);
972
969
  };
973
970
  return {
974
- on: (f) => {
971
+ on: (d) => {
975
972
  if (l)
976
- return u(f, t), { off: () => {
973
+ return u(d, t), { off: () => {
977
974
  } };
978
975
  {
979
- const h = r.on(f);
980
- return s.add(h.off), r.on(f);
976
+ const g = r.on(d);
977
+ return s.add(g.off), r.on(d);
981
978
  }
982
979
  },
983
980
  off: r.off,
@@ -989,7 +986,7 @@ const te = /* @__PURE__ */ new WeakMap();
989
986
  function gt(e) {
990
987
  if (e = e || pe(), te.has(e))
991
988
  return te.get(e);
992
- const t = 100, n = Date.now(), l = hr(() => {
989
+ const t = 100, n = Date.now(), l = mr(() => {
993
990
  if (Date.now() - n >= t)
994
991
  return !0;
995
992
  {
@@ -999,12 +996,12 @@ function gt(e) {
999
996
  }, e);
1000
997
  return te.set(e, l), l;
1001
998
  }
1002
- function Yr(e) {
999
+ function Vr(e) {
1003
1000
  const t = pe();
1004
1001
  if (t)
1005
1002
  return te.has(t) ? te.get(t).on(e) : gt(t).on(e);
1006
1003
  }
1007
- function gr({
1004
+ function hr({
1008
1005
  scene: e,
1009
1006
  canvas: t,
1010
1007
  windowSize: n,
@@ -1012,24 +1009,24 @@ function gr({
1012
1009
  rendererOptions: s,
1013
1010
  emit: l
1014
1011
  }) {
1015
- const i = $(e), a = pr(n, t), {
1012
+ const i = $(e), a = dr(n, t), {
1016
1013
  camera: c,
1017
1014
  cameras: o,
1018
1015
  registerCamera: u,
1019
1016
  deregisterCamera: v,
1020
- setCameraActive: f
1021
- } = In({ sizes: a, scene: e }), h = {
1017
+ setCameraActive: d
1018
+ } = In({ sizes: a, scene: e }), g = {
1022
1019
  mode: H(s.renderMode || "always"),
1023
1020
  priority: H(0),
1024
1021
  frames: H(0),
1025
1022
  maxFrames: 60,
1026
- canBeInvalidated: V(() => h.mode.value === "on-demand" && h.frames.value === 0)
1023
+ canBeInvalidated: V(() => g.mode.value === "on-demand" && g.frames.value === 0)
1027
1024
  };
1028
- function g(O = 1) {
1029
- s.renderMode === "on-demand" && (h.frames.value = Math.min(h.maxFrames, h.frames.value + O));
1025
+ function h(O = 1) {
1026
+ s.renderMode === "on-demand" && (g.frames.value = Math.min(g.maxFrames, g.frames.value + O));
1030
1027
  }
1031
1028
  function b() {
1032
- s.renderMode === "manual" && (h.frames.value = 1);
1029
+ s.renderMode === "manual" && (g.frames.value = 1);
1033
1030
  }
1034
1031
  const { renderer: y } = ar(
1035
1032
  {
@@ -1038,10 +1035,10 @@ function gr({
1038
1035
  options: s,
1039
1036
  emit: l,
1040
1037
  // TODO: replace contextParts with full ctx at https://github.com/Tresjs/tres/issues/516
1041
- contextParts: { sizes: a, camera: c, render: h, invalidate: g, advance: b },
1038
+ contextParts: { sizes: a, camera: c, render: g, invalidate: h, advance: b },
1042
1039
  disableRender: r
1043
1040
  }
1044
- ), d = {
1041
+ ), f = {
1045
1042
  sizes: a,
1046
1043
  scene: i,
1047
1044
  camera: c,
@@ -1061,47 +1058,47 @@ function gr({
1061
1058
  accumulator: []
1062
1059
  }
1063
1060
  },
1064
- render: h,
1061
+ render: g,
1065
1062
  advance: b,
1066
- extend: Me,
1067
- invalidate: g,
1063
+ extend: Pe,
1064
+ invalidate: h,
1068
1065
  registerCamera: u,
1069
- setCameraActive: f,
1066
+ setCameraActive: d,
1070
1067
  deregisterCamera: v,
1071
- loop: mr()
1068
+ loop: pr()
1072
1069
  };
1073
- _e("useTres", d), d.scene.value.__tres = {
1074
- root: d
1075
- }, d.loop.register(() => {
1076
- 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);
1070
+ _e("useTres", f), f.scene.value.__tres = {
1071
+ root: f
1072
+ }, f.loop.register(() => {
1073
+ 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);
1077
1074
  }, "render");
1078
- const { on: C, cancel: M } = gt(d);
1079
- d.loop.setReady(!1), d.loop.start(), C(() => {
1080
- l("ready", d), d.loop.setReady(!0), dr(e, d, l);
1075
+ const { on: M, cancel: P } = gt(f);
1076
+ f.loop.setReady(!1), f.loop.start(), M(() => {
1077
+ l("ready", f), f.loop.setReady(!0), fr(e, f, l);
1081
1078
  }), K(() => {
1082
- M(), d.loop.stop();
1079
+ P(), f.loop.stop();
1083
1080
  });
1084
- const P = 100, E = an({ every: P }), { isSupported: S, memory: _ } = ln({ interval: P }), A = 160;
1081
+ const C = 100, E = an({ every: C }), { isSupported: S, memory: _ } = ln({ interval: C }), A = 160;
1085
1082
  let L = performance.now();
1086
1083
  const p = ({ timestamp: O }) => {
1087
- 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));
1084
+ 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));
1088
1085
  };
1089
1086
  let w = 0;
1090
1087
  const x = 1, { pause: D } = it(({ delta: O }) => {
1091
- window.__TRES__DEVTOOLS__ && (p({ timestamp: performance.now() }), w += O, w >= x && (window.__TRES__DEVTOOLS__.cb(d), w = 0));
1088
+ window.__TRES__DEVTOOLS__ && (p({ timestamp: performance.now() }), w += O, w >= x && (window.__TRES__DEVTOOLS__.cb(f), w = 0));
1092
1089
  }, { immediate: !0 });
1093
1090
  return K(() => {
1094
1091
  D();
1095
- }), d;
1092
+ }), f;
1096
1093
  }
1097
1094
  function pe() {
1098
- const e = Ct("useTres");
1095
+ const e = Mt("useTres");
1099
1096
  if (!e)
1100
1097
  throw new Error("useTresContext must be used together with useTresContextProvider");
1101
1098
  return e;
1102
1099
  }
1103
- const qr = pe;
1104
- function Jr() {
1100
+ const Yr = pe;
1101
+ function qr() {
1105
1102
  const {
1106
1103
  camera: e,
1107
1104
  scene: t,
@@ -1121,14 +1118,14 @@ function Jr() {
1121
1118
  invalidate: i,
1122
1119
  advance: a
1123
1120
  });
1124
- function c(v, f = 0) {
1125
- return r.register(v, "before", f);
1121
+ function c(v, d = 0) {
1122
+ return r.register(v, "before", d);
1126
1123
  }
1127
1124
  function o(v) {
1128
1125
  return r.register(v, "render");
1129
1126
  }
1130
- function u(v, f = 0) {
1131
- return r.register(v, "after", f);
1127
+ function u(v, d = 0) {
1128
+ return r.register(v, "after", d);
1132
1129
  }
1133
1130
  return {
1134
1131
  pause: r.pause,
@@ -1141,7 +1138,7 @@ function Jr() {
1141
1138
  onAfterRender: u
1142
1139
  };
1143
1140
  }
1144
- function vr(e, t = {}, n = {}) {
1141
+ function gr(e, t = {}, n = {}) {
1145
1142
  let r = e;
1146
1143
  const s = (a) => {
1147
1144
  r = a;
@@ -1175,65 +1172,65 @@ const { logError: Ke } = Y(), Qe = [
1175
1172
  "onPointerMissed",
1176
1173
  "onLostPointerCapture",
1177
1174
  "onWheel"
1178
- ], yr = (e) => {
1175
+ ], vr = (e) => {
1179
1176
  const t = e.scene.value;
1180
- function n(o, u, v, f) {
1181
- if (f || (f = {}), f.args || (f.args = []), o === "template" || zn(o))
1177
+ function n(o, u, v, d) {
1178
+ if (d || (d = {}), d.args || (d.args = []), o === "template" || zn(o))
1182
1179
  return null;
1183
- let h = o.replace("Tres", ""), g;
1180
+ let g = o.replace("Tres", ""), h;
1184
1181
  if (o === "primitive") {
1185
- (!U(f.object) || Mt(f.object)) && Ke(
1182
+ (!U(d.object) || Pt(d.object)) && Ke(
1186
1183
  "Tres primitives need an 'object' prop, whose value is an object or shallowRef<object>"
1187
- ), h = f.object.type;
1184
+ ), g = d.object.type;
1188
1185
  const b = {};
1189
- g = vr(
1190
- f.object,
1186
+ h = gr(
1187
+ d.object,
1191
1188
  {
1192
- object: (d) => d,
1189
+ object: (f) => f,
1193
1190
  isPrimitive: () => !0,
1194
1191
  __tres: () => b
1195
1192
  },
1196
1193
  {
1197
- object: (d, C, M, P) => {
1198
- sr(d, M, P, { patchProp: l, remove: s, insert: r }, e);
1194
+ object: (f, M, P, C) => {
1195
+ sr(f, P, C, { patchProp: l, remove: s, insert: r }, e);
1199
1196
  },
1200
- __tres: (d) => {
1201
- Object.assign(b, d);
1197
+ __tres: (f) => {
1198
+ Object.assign(b, f);
1202
1199
  }
1203
1200
  }
1204
1201
  );
1205
1202
  } else {
1206
- const b = Ce.value[h];
1203
+ const b = Me.value[g];
1207
1204
  b || Ke(
1208
- `${h} is not defined on the THREE namespace. Use extend to add it to the catalog.`
1209
- ), g = new b(...f.args);
1205
+ `${g} is not defined on the THREE namespace. Use extend to add it to the catalog.`
1206
+ ), h = new b(...d.args);
1210
1207
  }
1211
- 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, {
1212
- ...g.__tres,
1213
- type: h,
1214
- memoizedProps: f,
1208
+ 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, {
1209
+ ...h.__tres,
1210
+ type: g,
1211
+ memoizedProps: d,
1215
1212
  eventCount: 0,
1216
1213
  primitive: o === "primitive",
1217
- attach: f.attach
1218
- }, e), g) : null;
1214
+ attach: d.attach
1215
+ }, e), h) : null;
1219
1216
  }
1220
1217
  function r(o, u) {
1221
- var h, g, b;
1218
+ var g, h, b;
1222
1219
  if (!o)
1223
1220
  return;
1224
1221
  u = u || t;
1225
- const v = o.__tres ? o : z(o, {}, e), f = u.__tres ? u : z(u, {}, e);
1226
- 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 ? nr(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);
1222
+ const v = o.__tres ? o : z(o, {}, e), d = u.__tres ? u : z(u, {}, e);
1223
+ 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);
1227
1224
  }
1228
1225
  function s(o, u) {
1229
- var g, b, y, d;
1226
+ var h, b, y, f;
1230
1227
  if (!o)
1231
1228
  return;
1232
- 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;
1229
+ 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;
1233
1230
  const v = (y = o.__tres) == null ? void 0 : y.dispose;
1234
1231
  be(v) || (v === null ? u = !1 : u = v);
1235
- const f = (d = o.__tres) == null ? void 0 : d.primitive, h = u === "default" ? !f : !!u;
1236
- 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 && !jn(o)) {
1232
+ const d = (f = o.__tres) == null ? void 0 : f.primitive, g = u === "default" ? !d : !!u;
1233
+ 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)) {
1237
1234
  if (G(u))
1238
1235
  u(o);
1239
1236
  else if (G(o.dispose))
@@ -1244,53 +1241,53 @@ const { logError: Ke } = Y(), Qe = [
1244
1241
  }
1245
1242
  "__tres" in o && delete o.__tres;
1246
1243
  }
1247
- function l(o, u, v, f) {
1248
- var C, M;
1244
+ function l(o, u, v, d) {
1245
+ var M, P;
1249
1246
  if (!o)
1250
1247
  return;
1251
- let h = o, g = u;
1252
- if (o.__tres && (o.__tres.memoizedProps[u] = f), u === "attach") {
1253
- const P = ((C = o.__tres) == null ? void 0 : C.parent) || o.parent;
1254
- s(o), z(o, { attach: f }, e), P && r(o, P);
1248
+ let g = o, h = u;
1249
+ if (o.__tres && (o.__tres.memoizedProps[u] = d), u === "attach") {
1250
+ const C = ((M = o.__tres) == null ? void 0 : M.parent) || o.parent;
1251
+ s(o), z(o, { attach: d }, e), C && r(o, C);
1255
1252
  return;
1256
1253
  }
1257
1254
  if (u === "dispose") {
1258
- o.__tres || (o = z(o, {}, e)), o.__tres.dispose = f;
1255
+ o.__tres || (o = z(o, {}, e)), o.__tres.dispose = d;
1259
1256
  return;
1260
1257
  }
1261
- if (N(o) && g === "blocks-pointer-events") {
1262
- f || f === "" ? o[g] = f : delete o[g];
1258
+ if (N(o) && h === "blocks-pointer-events") {
1259
+ d || d === "" ? o[h] = d : delete o[h];
1263
1260
  return;
1264
1261
  }
1265
1262
  Qe.includes(u) && o.__tres && (o.__tres.eventCount += 1);
1266
- let b = ie(g), y = h == null ? void 0 : h[b];
1267
- if (g === "args") {
1268
- const P = o, E = v ?? [], S = f ?? [], _ = ((M = o.__tres) == null ? void 0 : M.type) || o.type;
1269
- _ && E.length && !Jn(E, S) && (h = Object.assign(
1270
- P,
1271
- new Ce.value[_](...f)
1263
+ let b = ie(h), y = g == null ? void 0 : g[b];
1264
+ if (h === "args") {
1265
+ const C = o, E = v ?? [], S = d ?? [], _ = ((P = o.__tres) == null ? void 0 : P.type) || o.type;
1266
+ _ && E.length && !Jn(E, S) && (g = Object.assign(
1267
+ C,
1268
+ new Me.value[_](...d)
1272
1269
  ));
1273
1270
  return;
1274
1271
  }
1275
- if (h.type === "BufferGeometry") {
1276
- if (g === "args")
1272
+ if (g.type === "BufferGeometry") {
1273
+ if (h === "args")
1277
1274
  return;
1278
- h.setAttribute(
1279
- ie(g),
1280
- new Wt(...f)
1275
+ g.setAttribute(
1276
+ ie(h),
1277
+ new Wt(...d)
1281
1278
  );
1282
1279
  return;
1283
1280
  }
1284
- if (g.includes("-") && y === void 0) {
1285
- const P = g.split("-");
1286
- 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));
1281
+ if (h.includes("-") && y === void 0) {
1282
+ const C = h.split("-");
1283
+ 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));
1287
1284
  }
1288
- let d = f;
1289
- if (d === "" && (d = !0), G(y)) {
1290
- Qe.includes(u) || (de(d) ? o[b](...d) : o[b](d)), b.startsWith("on") && G(d) && (h[b] = d);
1285
+ let f = d;
1286
+ if (f === "" && (f = !0), G(y)) {
1287
+ Qe.includes(u) || (de(f) ? o[b](...f) : o[b](f)), b.startsWith("on") && G(f) && (g[b] = f);
1291
1288
  return;
1292
1289
  }
1293
- !(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);
1290
+ !(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);
1294
1291
  }
1295
1292
  function i(o) {
1296
1293
  var u;
@@ -1301,9 +1298,9 @@ const { logError: Ke } = Y(), Qe = [
1301
1298
  return u.name = o, u;
1302
1299
  }
1303
1300
  function c(o) {
1304
- var h;
1305
- const u = i(o), v = ((h = u == null ? void 0 : u.__tres) == null ? void 0 : h.objects) || [], f = v.indexOf(o);
1306
- return f < 0 || f >= v.length - 1 ? null : v[f + 1];
1301
+ var g;
1302
+ const u = i(o), v = ((g = u == null ? void 0 : u.__tres) == null ? void 0 : g.objects) || [], d = v.indexOf(o);
1303
+ return d < 0 || d >= v.length - 1 ? null : v[d + 1];
1307
1304
  }
1308
1305
  return {
1309
1306
  insert: r,
@@ -1322,13 +1319,13 @@ const { logError: Ke } = Y(), Qe = [
1322
1319
  insertStaticContent: () => void 0
1323
1320
  };
1324
1321
  };
1325
- function _r() {
1322
+ function yr() {
1326
1323
  return vt().__VUE_DEVTOOLS_GLOBAL_HOOK__;
1327
1324
  }
1328
1325
  function vt() {
1329
1326
  return typeof navigator < "u" && typeof window < "u" ? window : typeof globalThis < "u" ? globalThis : {};
1330
1327
  }
1331
- const wr = typeof Proxy == "function", br = "devtools-plugin:setup", Pr = "plugin:settings:set";
1328
+ const _r = typeof Proxy == "function", wr = "devtools-plugin:setup", br = "plugin:settings:set";
1332
1329
  let q, Ee;
1333
1330
  function Cr() {
1334
1331
  var e;
@@ -1337,7 +1334,7 @@ function Cr() {
1337
1334
  function Mr() {
1338
1335
  return Cr() ? Ee.now() : Date.now();
1339
1336
  }
1340
- class Er {
1337
+ class Pr {
1341
1338
  constructor(t, n) {
1342
1339
  this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin = t, this.hook = n;
1343
1340
  const r = {};
@@ -1367,7 +1364,7 @@ class Er {
1367
1364
  now() {
1368
1365
  return Mr();
1369
1366
  }
1370
- }, n && n.on(Pr, (i, a) => {
1367
+ }, n && n.on(br, (i, a) => {
1371
1368
  i === this.plugin.id && this.fallbacks.setSettings(a);
1372
1369
  }), this.proxiedOn = new Proxy({}, {
1373
1370
  get: (i, a) => this.target ? this.target.on[a] : (...c) => {
@@ -1399,12 +1396,12 @@ class Er {
1399
1396
  n.resolve(await this.target[n.method](...n.args));
1400
1397
  }
1401
1398
  }
1402
- function Tr(e, t) {
1403
- const n = e, r = vt(), s = _r(), l = wr && n.enableEarlyProxy;
1399
+ function Er(e, t) {
1400
+ const n = e, r = vt(), s = yr(), l = _r && n.enableEarlyProxy;
1404
1401
  if (s && (r.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !l))
1405
- s.emit(br, e, t);
1402
+ s.emit(wr, e, t);
1406
1403
  else {
1407
- const i = l ? new Er(n, s) : null;
1404
+ const i = l ? new Pr(n, s) : null;
1408
1405
  (r.__VUE_DEVTOOLS_PLUGINS__ = r.__VUE_DEVTOOLS_PLUGINS__ || []).push({
1409
1406
  pluginDescriptor: n,
1410
1407
  setupFn: t,
@@ -1412,7 +1409,7 @@ function Tr(e, t) {
1412
1409
  }), i && t(i.proxiedTarget);
1413
1410
  }
1414
1411
  }
1415
- function Sr(e, t) {
1412
+ function Tr(e, t) {
1416
1413
  const n = `▲ ■ ●${e}`;
1417
1414
  typeof Xe == "function" ? Xe(n, t) : console.log(n);
1418
1415
  }
@@ -1433,7 +1430,7 @@ const yt = (e) => {
1433
1430
  });
1434
1431
  const n = xe(e);
1435
1432
  return n > 0 && t.tags.push({
1436
- label: `${fr(n)} KB`,
1433
+ label: `${ur(n)} KB`,
1437
1434
  textColor: 15707189,
1438
1435
  backgroundColor: 16775644,
1439
1436
  tooltip: "Memory usage"
@@ -1467,22 +1464,22 @@ function _t(e, t, n = "") {
1467
1464
  t.children.push(s), _t(r, s, n);
1468
1465
  });
1469
1466
  }
1470
- const Ar = [], X = "tres:inspector", xr = Et({
1467
+ const Sr = [], X = "tres:inspector", Ar = Et({
1471
1468
  sceneGraph: null
1472
1469
  });
1473
- function kr(e, t) {
1474
- Tr(
1470
+ function xr(e, t) {
1471
+ Er(
1475
1472
  {
1476
1473
  id: "dev.esm.tres",
1477
1474
  label: "TresJS 🪐",
1478
1475
  logo: "https://raw.githubusercontent.com/Tresjs/tres/main/public/favicon.svg",
1479
1476
  packageName: "tresjs",
1480
1477
  homepage: "https://tresjs.org",
1481
- componentStateTypes: Ar,
1478
+ componentStateTypes: Sr,
1482
1479
  app: e
1483
1480
  },
1484
1481
  (n) => {
1485
- typeof n.now != "function" && Sr(
1482
+ typeof n.now != "function" && Tr(
1486
1483
  "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."
1487
1484
  ), n.addInspector({
1488
1485
  id: X,
@@ -1496,7 +1493,7 @@ function kr(e, t) {
1496
1493
  }, 5e3), n.on.getInspectorTree((l) => {
1497
1494
  if (l.inspectorId === X) {
1498
1495
  const i = yt(t.scene.value);
1499
- _t(t.scene.value, i, l.filter), xr.sceneGraph = i, l.rootNodes = [i];
1496
+ _t(t.scene.value, i, l.filter), Ar.sceneGraph = i, l.rootNodes = [i];
1500
1497
  }
1501
1498
  });
1502
1499
  let r = null, s = null;
@@ -1535,7 +1532,7 @@ function kr(e, t) {
1535
1532
  }
1536
1533
  );
1537
1534
  }
1538
- const Lr = ["data-scene", "data-tres"], Rr = /* @__PURE__ */ Be({
1535
+ const kr = ["data-scene", "data-tres"], Lr = /* @__PURE__ */ Be({
1539
1536
  __name: "TresCanvas",
1540
1537
  props: {
1541
1538
  shadows: { type: Boolean, default: void 0 },
@@ -1582,37 +1579,37 @@ const Lr = ["data-scene", "data-tres"], Rr = /* @__PURE__ */ Be({
1582
1579
  setup(e, { expose: t, emit: n }) {
1583
1580
  var y;
1584
1581
  const r = e, s = n, l = Tt(), { logWarning: i } = Y(), a = H(), c = $(new nt()), o = (y = Ie()) == null ? void 0 : y.appContext.app;
1585
- Me(et);
1586
- const u = (d, C = !1) => Be({
1582
+ Pe(et);
1583
+ const u = (f, M = !1) => Be({
1587
1584
  setup() {
1588
- var P;
1589
- const M = (P = Ie()) == null ? void 0 : P.appContext;
1590
- return M && (M.app = o), _e("useTres", d), _e("extend", Me), typeof window < "u" && kr(M == null ? void 0 : M.app, d), () => He(Ot, null, C ? [] : l.default());
1585
+ var C;
1586
+ const P = (C = Ie()) == null ? void 0 : C.appContext;
1587
+ 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());
1591
1588
  }
1592
- }), v = (d, C = !1) => {
1593
- const M = u(d, C), { render: P } = Rt(yr(d));
1594
- P(He(M), c.value);
1595
- }, f = (d, C = !1) => {
1596
- dt(d.scene.value), C && (d.renderer.value.dispose(), d.renderer.value.renderLists.dispose(), d.renderer.value.forceContextLoss()), c.value.__tres = {
1597
- root: d
1589
+ }), v = (f, M = !1) => {
1590
+ const P = u(f, M), { render: C } = Rt(vr(f));
1591
+ C(He(P), c.value);
1592
+ }, d = (f, M = !1) => {
1593
+ dt(f.scene.value), M && (f.renderer.value.dispose(), f.renderer.value.renderLists.dispose(), f.renderer.value.forceContextLoss()), c.value.__tres = {
1594
+ root: f
1598
1595
  };
1599
- }, h = V(() => r.disableRender), g = $(null);
1600
- t({ context: g, dispose: () => f(g.value, !0) });
1596
+ }, g = V(() => r.disableRender), h = $(null);
1597
+ t({ context: h, dispose: () => d(h.value, !0) });
1601
1598
  const b = () => {
1602
- f(g.value), v(g.value, !0);
1599
+ d(h.value), v(h.value, !0);
1603
1600
  };
1604
1601
  return St(() => {
1605
- const d = a;
1606
- g.value = gr({
1602
+ const f = a;
1603
+ h.value = hr({
1607
1604
  scene: c.value,
1608
- canvas: d,
1605
+ canvas: f,
1609
1606
  windowSize: r.windowSize ?? !1,
1610
- disableRender: h.value ?? !1,
1607
+ disableRender: g.value ?? !1,
1611
1608
  rendererOptions: r,
1612
1609
  emit: s
1613
1610
  });
1614
- const { registerCamera: C, camera: M, cameras: P, deregisterCamera: E } = g.value;
1615
- v(g.value);
1611
+ const { registerCamera: M, camera: P, cameras: C, deregisterCamera: E } = h.value;
1612
+ v(h.value);
1616
1613
  const S = () => {
1617
1614
  const _ = new we(
1618
1615
  45,
@@ -1620,52 +1617,52 @@ const Lr = ["data-scene", "data-tres"], Rr = /* @__PURE__ */ Be({
1620
1617
  0.1,
1621
1618
  1e3
1622
1619
  );
1623
- _.position.set(3, 3, 3), _.lookAt(0, 0, 0), C(_);
1620
+ _.position.set(3, 3, 3), _.lookAt(0, 0, 0), M(_);
1624
1621
  const A = Te(() => {
1625
- P.value.length >= 2 && (_.removeFromParent(), E(_), A == null || A());
1622
+ C.value.length >= 2 && (_.removeFromParent(), E(_), A == null || A());
1626
1623
  });
1627
1624
  };
1628
1625
  ce(
1629
1626
  () => r.camera,
1630
1627
  (_, A) => {
1631
- _ && C(_), A && (A.removeFromParent(), E(A));
1628
+ _ && M(_), A && (A.removeFromParent(), E(A));
1632
1629
  },
1633
1630
  {
1634
1631
  immediate: !0
1635
1632
  }
1636
- ), M.value || (i(
1633
+ ), P.value || (i(
1637
1634
  "No camera found. Creating a default perspective camera. To have full control over a camera, please add one to the scene."
1638
1635
  ), S());
1639
- }), K(b), (d, C) => (At(), xt("canvas", {
1636
+ }), K(b), (f, M) => (At(), xt("canvas", {
1640
1637
  ref_key: "canvas",
1641
1638
  ref: a,
1642
1639
  "data-scene": c.value.uuid,
1643
- class: kt(d.$attrs.class),
1640
+ class: kt(f.$attrs.class),
1644
1641
  "data-tres": `tresjs ${J(xn).version}`,
1645
1642
  style: Lt({
1646
1643
  display: "block",
1647
1644
  width: "100%",
1648
1645
  height: "100%",
1649
- position: d.windowSize ? "fixed" : "relative",
1646
+ position: f.windowSize ? "fixed" : "relative",
1650
1647
  top: 0,
1651
1648
  left: 0,
1652
1649
  pointerEvents: "auto",
1653
1650
  touchAction: "none",
1654
- ...d.$attrs.style
1651
+ ...f.$attrs.style
1655
1652
  })
1656
- }, null, 14, Lr));
1653
+ }, null, 14, kr));
1657
1654
  }
1658
- }), Or = [
1655
+ }), Rr = [
1659
1656
  "TresCanvas",
1660
1657
  "TresLeches",
1661
1658
  "TresScene"
1662
- ], Dr = {
1659
+ ], Or = {
1663
1660
  template: {
1664
1661
  compilerOptions: {
1665
- isCustomElement: (e) => e.startsWith("Tres") && !Or.includes(e) || e === "primitive"
1662
+ isCustomElement: (e) => e.startsWith("Tres") && !Rr.includes(e) || e === "primitive"
1666
1663
  }
1667
1664
  }
1668
- }, Kr = Dr, Qr = {
1665
+ }, Jr = Or, Kr = {
1669
1666
  mounted: (e, t) => {
1670
1667
  if (t.arg) {
1671
1668
  console.log(`v-log:${t.arg}`, e[t.arg]);
@@ -1699,19 +1696,19 @@ class wt extends zt {
1699
1696
  }
1700
1697
  const { logWarning: Ze } = Y();
1701
1698
  let le, W;
1702
- const jr = {
1699
+ const Dr = {
1703
1700
  DirectionalLight: qt,
1704
1701
  PointLight: Jt,
1705
1702
  SpotLight: Kt,
1706
1703
  HemisphereLight: Qt,
1707
1704
  RectAreaLight: wt
1708
- }, Xr = {
1705
+ }, Qr = {
1709
1706
  mounted: (e) => {
1710
1707
  if (!e.isLight) {
1711
1708
  Ze(`${e.type} is not a light`);
1712
1709
  return;
1713
1710
  }
1714
- le = jr[e.type], e.parent.add(new le(e, 1, e.color.getHex()));
1711
+ le = Dr[e.type], e.parent.add(new le(e, 1, e.color.getHex()));
1715
1712
  },
1716
1713
  updated: (e) => {
1717
1714
  W = e.parent.children.find((t) => t instanceof le), !(W instanceof wt) && W.update();
@@ -1723,14 +1720,14 @@ const jr = {
1723
1720
  }
1724
1721
  W = e.parent.children.find((t) => t instanceof le), W && W.dispose && W.dispose(), e.parent.remove(W);
1725
1722
  }
1726
- }, { logWarning: Br } = Y();
1723
+ }, { logWarning: jr } = Y();
1727
1724
  let I = null;
1728
- const Zr = {
1725
+ const Xr = {
1729
1726
  updated: (e, t) => {
1730
1727
  var s;
1731
1728
  const n = Zn(t);
1732
1729
  if (!n) {
1733
- Br(`v-distance-to: problem with binding value: ${t.value}`);
1730
+ jr(`v-distance-to: problem with binding value: ${t.value}`);
1734
1731
  return;
1735
1732
  }
1736
1733
  I && (I.dispose(), e.parent.remove(I));
@@ -1746,38 +1743,38 @@ const Zr = {
1746
1743
  unmounted: (e) => {
1747
1744
  I == null || I.dispose(), e.parent.remove(I);
1748
1745
  }
1749
- }, eo = {
1746
+ }, Zr = {
1750
1747
  install(e) {
1751
- e.component("TresCanvas", Rr);
1748
+ e.component("TresCanvas", Lr);
1752
1749
  }
1753
1750
  };
1754
1751
  export {
1755
- Rr as TresCanvas,
1756
- Ce as catalogue,
1757
- mr as createRenderLoop,
1758
- eo as default,
1752
+ Lr as TresCanvas,
1753
+ Me as catalogue,
1754
+ pr as createRenderLoop,
1755
+ Zr as default,
1759
1756
  dt as dispose,
1760
- Me as extend,
1761
- Wr as isProd,
1757
+ Pe as extend,
1758
+ Fr as isProd,
1762
1759
  Fn as normalizeColor,
1763
- Nr as normalizeVectorFlexibleParam,
1764
- Yr as onTresReady,
1765
- Kr as templateCompilerOptions,
1766
- cr as trasverseObjects,
1760
+ Wr as normalizeVectorFlexibleParam,
1761
+ Vr as onTresReady,
1762
+ Jr as templateCompilerOptions,
1763
+ lr as trasverseObjects,
1767
1764
  In as useCamera,
1768
- zr as useLoader,
1765
+ Nr as useLoader,
1769
1766
  Y as useLogger,
1770
- Jr as useLoop,
1771
- ur as useRaycaster,
1772
- Fr as useRenderLoop,
1767
+ qr as useLoop,
1768
+ cr as useRaycaster,
1769
+ Ur as useRenderLoop,
1773
1770
  ar as useRenderer,
1774
- Vr as useSeek,
1775
- Gr as useTexture,
1776
- qr as useTres,
1771
+ Gr as useSeek,
1772
+ zr as useTexture,
1773
+ Yr as useTres,
1777
1774
  pe as useTresContext,
1778
- gr as useTresContextProvider,
1779
- dr as useTresEventManager,
1780
- Zr as vDistanceTo,
1781
- Xr as vLightHelper,
1782
- Qr as vLog
1775
+ hr as useTresContextProvider,
1776
+ fr as useTresEventManager,
1777
+ Xr as vDistanceTo,
1778
+ Qr as vLightHelper,
1779
+ Kr as vLog
1783
1780
  };