@tresjs/core 4.0.0-rc.1 → 4.0.0-rc.2

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,6 +1,6 @@
1
1
  /**
2
2
  * name: @tresjs/core
3
- * version: v4.0.0-rc.1
3
+ * version: v4.0.0-rc.2
4
4
  * (c) 2024
5
5
  * description: Declarative ThreeJS using Vue Components
6
6
  * author: Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)
@@ -8,11 +8,11 @@
8
8
  var nt = Object.defineProperty;
9
9
  var ot = (e, t, n) => t in e ? nt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
10
10
  var se = (e, t, n) => (ot(e, typeof t != "symbol" ? t + "" : t, n), n);
11
- import { ref as A, computed as B, watchEffect as ve, onUnmounted as N, shallowRef as U, watch as V, reactive as $e, readonly as ue, provide as ce, inject as st, unref as W, defineComponent as Se, useSlots as it, getCurrentInstance as xe, onMounted as at, openBlock as lt, createElementBlock as ut, normalizeClass as ct, normalizeStyle as ft, createRenderer as dt, h as Te, Fragment as pt } from "vue";
11
+ import { ref as A, computed as B, watchEffect as ve, onUnmounted as N, shallowRef as U, watch as V, reactive as $e, readonly as ue, unref as W, provide as ce, inject as st, defineComponent as Se, useSlots as it, getCurrentInstance as xe, onMounted as at, openBlock as lt, createElementBlock as ut, normalizeClass as ct, normalizeStyle as ft, createRenderer as dt, h as Te, Fragment as pt } from "vue";
12
12
  import * as Fe from "three";
13
13
  import { PerspectiveCamera as fe, Camera as mt, Clock as We, Vector3 as ge, Color as re, Scene as Ne, MeshBasicMaterial as ze, DoubleSide as vt, REVISION as gt, SRGBColorSpace as ht, ACESFilmicToneMapping as Ge, PCFSoftShadowMap as yt, NoToneMapping as bt, WebGLRenderer as ie, TextureLoader as wt, Vector2 as ae, MathUtils as Mt, Raycaster as Pt, BufferAttribute as Ct, Line as _t, BufferGeometry as Ae, Float32BufferAttribute as Oe, LineBasicMaterial as Et, Mesh as kt, BackSide as St, DirectionalLightHelper as xt, PointLightHelper as Tt, SpotLightHelper as At, HemisphereLightHelper as Ot, ArrowHelper as Lt } from "three";
14
14
  import { createEventHook as x, useRafFn as Ve, toValue as k, unrefElement as Dt, useDevicePixelRatio as Bt, usePointer as Rt, useElementBounding as jt, useWindowSize as It, useElementSize as Ht, refDebounced as Le, tryOnScopeDispose as Ut, useFps as $t, useMemory as Ft } from "@vueuse/core";
15
- const Wt = "@tresjs/core", Nt = "module", zt = "4.0.0-rc.1", Gt = "pnpm@8.15.6", Vt = "Declarative ThreeJS using Vue Components", qt = "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)", Yt = "MIT", Jt = [
15
+ const Wt = "@tresjs/core", Nt = "module", zt = "4.0.0-rc.2", Gt = "pnpm@8.15.6", Vt = "Declarative ThreeJS using Vue Components", qt = "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)", Yt = "MIT", Jt = [
16
16
  "vue",
17
17
  "3d",
18
18
  "threejs",
@@ -70,16 +70,16 @@ const Wt = "@tresjs/core", Nt = "module", zt = "4.0.0-rc.1", Gt = "pnpm@8.15.6",
70
70
  "@release-it/conventional-changelog": "^8.0.1",
71
71
  "@stackblitz/sdk": "^1.10.0",
72
72
  "@tresjs/cientos": "3.9.0",
73
- "@tresjs/eslint-config": "^1.0.0",
74
- "@types/three": "^0.164.0",
75
- "@typescript-eslint/eslint-plugin": "^7.9.0",
76
- "@typescript-eslint/parser": "^7.9.0",
73
+ "@tresjs/eslint-config": "^1.1.0",
74
+ "@types/three": "^0.164.1",
75
+ "@typescript-eslint/eslint-plugin": "^7.10.0",
76
+ "@typescript-eslint/parser": "^7.10.0",
77
77
  "@vitejs/plugin-vue": "^5.0.4",
78
78
  "@vitest/coverage-c8": "^0.33.0",
79
79
  "@vitest/coverage-v8": "^1.6.0",
80
80
  "@vitest/ui": "^1.6.0",
81
81
  "@vue/test-utils": "^2.4.6",
82
- eslint: "^9.2.0",
82
+ eslint: "^9.3.0",
83
83
  "eslint-plugin-vue": "^9.26.0",
84
84
  esno: "^4.7.0",
85
85
  gsap: "^3.12.5",
@@ -88,12 +88,12 @@ const Wt = "@tresjs/core", Nt = "module", zt = "4.0.0-rc.1", Gt = "pnpm@8.15.6",
88
88
  kolorist: "^1.8.0",
89
89
  ohmyfetch: "^0.4.21",
90
90
  pathe: "^1.1.2",
91
- "release-it": "^17.2.1",
91
+ "release-it": "^17.3.0",
92
92
  "rollup-plugin-analyzer": "^4.0.0",
93
93
  "rollup-plugin-copy": "^3.5.0",
94
94
  "rollup-plugin-visualizer": "^5.12.0",
95
95
  three: "^0.164.1",
96
- unocss: "^0.60.2",
96
+ unocss: "^0.60.3",
97
97
  unplugin: "^1.10.1",
98
98
  "unplugin-vue-components": "^0.27.0",
99
99
  vite: "^5.2.11",
@@ -102,7 +102,7 @@ const Wt = "@tresjs/core", Nt = "module", zt = "4.0.0-rc.1", Gt = "pnpm@8.15.6",
102
102
  "vite-plugin-inspect": "^0.8.4",
103
103
  "vite-plugin-require-transform": "^1.0.21",
104
104
  "vite-svg-loader": "^5.1.0",
105
- vitepress: "1.1.4",
105
+ vitepress: "1.2.2",
106
106
  vitest: "^1.6.0",
107
107
  vue: "^3.4.27",
108
108
  "vue-demi": "^0.14.7"
@@ -130,14 +130,14 @@ const Wt = "@tresjs/core", Nt = "module", zt = "4.0.0-rc.1", Gt = "pnpm@8.15.6",
130
130
  const t = A([]), n = B(
131
131
  () => t.value[0]
132
132
  ), o = (r) => {
133
- const s = r instanceof mt ? r : t.value.find((l) => l.uuid === r);
133
+ const s = r instanceof mt ? r : t.value.find((a) => a.uuid === r);
134
134
  if (!s)
135
135
  return;
136
- const u = t.value.filter(({ uuid: l }) => l !== s.uuid);
136
+ const u = t.value.filter(({ uuid: a }) => a !== s.uuid);
137
137
  t.value = [s, ...u];
138
138
  }, i = (r, s = !1) => {
139
139
  t.value.some(({ uuid: u }) => u === r.uuid) || (s ? o(r) : t.value.push(r));
140
- }, a = (r) => {
140
+ }, l = (r) => {
141
141
  t.value = t.value.filter(({ uuid: s }) => s !== r.uuid);
142
142
  };
143
143
  return ve(() => {
@@ -150,7 +150,7 @@ const Wt = "@tresjs/core", Nt = "module", zt = "4.0.0-rc.1", Gt = "pnpm@8.15.6",
150
150
  camera: n,
151
151
  cameras: t,
152
152
  registerCamera: i,
153
- deregisterCamera: a,
153
+ deregisterCamera: l,
154
154
  setCameraActive: o
155
155
  };
156
156
  };
@@ -233,8 +233,8 @@ function br(e, t) {
233
233
  const wr = (e, t) => {
234
234
  const n = /* @__PURE__ */ new Set(), o = [];
235
235
  for (const i of e) {
236
- const a = t(i);
237
- n.has(a) || (n.add(a), o.push(i));
236
+ const l = t(i);
237
+ n.has(l) || (n.add(l), o.push(i));
238
238
  }
239
239
  return o;
240
240
  }, Be = (e, t) => {
@@ -244,12 +244,12 @@ const wr = (e, t) => {
244
244
  return n == null ? void 0 : n.reduce((o, i) => o && o[i], e);
245
245
  }, Mr = (e, t, n) => {
246
246
  const o = Array.isArray(t) ? t : t.match(/([^[.\]])+/g);
247
- o && o.reduce((i, a, r) => (i[a] === void 0 && (i[a] = {}), r === o.length - 1 && (i[a] = n), i[a]), e);
247
+ o && o.reduce((i, l, r) => (i[l] === void 0 && (i[l] = {}), r === o.length - 1 && (i[l] = n), i[l]), e);
248
248
  };
249
249
  function Qe(e, t) {
250
250
  if (De(e) && De(t)) {
251
- const i = e.attributes, a = t.attributes;
252
- return i.length !== a.length ? !1 : Array.from(i).every(({ name: r, value: s }) => t.getAttribute(r) === s);
251
+ const i = e.attributes, l = t.attributes;
252
+ return i.length !== l.length ? !1 : Array.from(i).every(({ name: r, value: s }) => t.getAttribute(r) === s);
253
253
  }
254
254
  if (e === t)
255
255
  return !0;
@@ -276,17 +276,17 @@ function _r(e, t, n, o) {
276
276
  const i = (u) => {
277
277
  if (u.uuid === t)
278
278
  return u;
279
- for (const l of u.children) {
280
- const y = i(l);
279
+ for (const a of u.children) {
280
+ const y = i(a);
281
281
  if (y)
282
282
  return y;
283
283
  }
284
- }, a = i(e);
285
- if (!a) {
284
+ }, l = i(e);
285
+ if (!l) {
286
286
  console.warn("Object with UUID not found in the scene.");
287
287
  return;
288
288
  }
289
- let r = a;
289
+ let r = l;
290
290
  for (let u = 0; u < n.length - 1; u++)
291
291
  if (r[n[u]] !== void 0)
292
292
  r = r[n[u]];
@@ -325,7 +325,7 @@ function ye(e) {
325
325
  var n, o;
326
326
  if (e.parent && ((n = e.removeFromParent) == null || n.call(e)), delete e.__tres, [...e.children].forEach((i) => ye(i)), !(e instanceof Ne)) {
327
327
  const i = e;
328
- e && ((o = e.dispose) == null || o.call(e)), i.geometry && (i.geometry.dispose(), delete i.geometry), Array.isArray(i.material) ? (i.material.forEach((a) => Re(a)), delete i.material) : i.material && (Re(i.material), delete i.material);
328
+ e && ((o = e.dispose) == null || o.call(e)), i.geometry && (i.geometry.dispose(), delete i.geometry), Array.isArray(i.material) ? (i.material.forEach((l) => Re(l)), delete i.material) : i.material && (Re(i.material), delete i.material);
329
329
  }
330
330
  }
331
331
  const xr = Number.parseInt(gt.replace("dev", "")), Z = {
@@ -348,7 +348,7 @@ const xr = Number.parseInt(gt.replace("dev", "")), Z = {
348
348
  function Tr({
349
349
  canvas: e,
350
350
  options: t,
351
- contextParts: { sizes: n, render: o, invalidate: i, advance: a }
351
+ contextParts: { sizes: n, render: o, invalidate: i, advance: l }
352
352
  }) {
353
353
  const r = B(() => ({
354
354
  alpha: k(t.alpha) ?? !0,
@@ -374,9 +374,9 @@ function Tr({
374
374
  }, {
375
375
  immediate: !0
376
376
  }), V(() => t.clearColor, u);
377
- const { pixelRatio: l } = Bt();
378
- V(l, () => {
379
- s.value.setPixelRatio(l.value);
377
+ const { pixelRatio: a } = Bt();
378
+ V(a, () => {
379
+ s.value.setPixelRatio(a.value);
380
380
  });
381
381
  const { logError: y } = $(), p = (() => {
382
382
  const f = new ie(), b = {
@@ -389,12 +389,12 @@ function Tr({
389
389
  outputColorSpace: f.outputColorSpace
390
390
  };
391
391
  return f.dispose(), b;
392
- })(), M = k(t.renderMode);
393
- return M === "on-demand" && i(), M === "manual" && setTimeout(() => {
394
- a();
395
- }, 1), ve(() => {
392
+ })(), P = k(t.renderMode);
393
+ return P === "on-demand" && i(), P === "manual" && setTimeout(() => {
394
+ l();
395
+ }, 100), ve(() => {
396
396
  const f = k(t.preset);
397
- f && (f in Z || y(`Renderer Preset must be one of these: ${Object.keys(Z).join(", ")}`), Je(s.value, Z[f])), M === "always" && (o.frames.value = Math.max(1, o.frames.value));
397
+ f && (f in Z || y(`Renderer Preset must be one of these: ${Object.keys(Z).join(", ")}`), Je(s.value, Z[f])), P === "always" && (o.frames.value = Math.max(1, o.frames.value));
398
398
  const b = (v, h) => {
399
399
  const _ = k(v), g = () => {
400
400
  if (f)
@@ -402,8 +402,8 @@ function Tr({
402
402
  };
403
403
  if (_ !== void 0)
404
404
  return _;
405
- const P = g();
406
- return P !== void 0 ? P : Be(p, h);
405
+ const M = g();
406
+ return M !== void 0 ? M : Be(p, h);
407
407
  }, m = (v, h) => Mr(s.value, h, b(v, h));
408
408
  m(t.shadows, "shadowMap.enabled"), m(t.toneMapping ?? Ge, "toneMapping"), m(t.shadowMapType, "shadowMap.type"), xr < 150 && m(!t.useLegacyLights, "physicallyCorrectLights"), m(t.outputColorSpace, "outputColorSpace"), m(t.toneMappingExposure, "toneMappingExposure");
409
409
  const w = b(t.clearColor, "clearColor");
@@ -425,27 +425,27 @@ function Or(e) {
425
425
  }), t;
426
426
  }
427
427
  async function fn(e, t, n, o, i) {
428
- const { logError: a } = $(), r = new e();
428
+ const { logError: l } = $(), r = new e();
429
429
  i && i(r), n && n(r);
430
430
  const u = (Array.isArray(t) ? t : [t]).map(
431
- (l) => new Promise((y, c) => {
431
+ (a) => new Promise((y, c) => {
432
432
  r.load(
433
- l,
433
+ a,
434
434
  (p) => {
435
435
  p.scene && Object.assign(p, Or(p.scene)), y(p);
436
436
  },
437
437
  o,
438
- (p) => c(a("[useLoader] - Failed to load resource", p))
438
+ (p) => c(l("[useLoader] - Failed to load resource", p))
439
439
  );
440
440
  })
441
441
  );
442
442
  return Ar(t) ? await Promise.all(u) : await u[0];
443
443
  }
444
444
  async function dn(e, t) {
445
- const n = new wt(t), o = (i) => new Promise((a, r) => {
445
+ const n = new wt(t), o = (i) => new Promise((l, r) => {
446
446
  n.load(
447
447
  i,
448
- (s) => a(s),
448
+ (s) => l(s),
449
449
  () => null,
450
450
  () => {
451
451
  r(new Error("[useTextures] - Failed to load texture"));
@@ -453,51 +453,51 @@ async function dn(e, t) {
453
453
  );
454
454
  });
455
455
  if (Cr(e)) {
456
- const i = await Promise.all(e.map((a) => o(a)));
456
+ const i = await Promise.all(e.map((l) => o(l)));
457
457
  return e.length > 1 ? i : i[0];
458
458
  } else {
459
459
  const {
460
460
  map: i,
461
- displacementMap: a,
461
+ displacementMap: l,
462
462
  normalMap: r,
463
463
  roughnessMap: s,
464
464
  metalnessMap: u,
465
- aoMap: l,
465
+ aoMap: a,
466
466
  alphaMap: y,
467
467
  matcap: c
468
468
  } = e;
469
469
  return {
470
470
  map: i ? await o(i) : null,
471
- displacementMap: a ? await o(a) : null,
471
+ displacementMap: l ? await o(l) : null,
472
472
  normalMap: r ? await o(r) : null,
473
473
  roughnessMap: s ? await o(s) : null,
474
474
  metalnessMap: u ? await o(u) : null,
475
- aoMap: l ? await o(l) : null,
475
+ aoMap: a ? await o(a) : null,
476
476
  alphaMap: y ? await o(y) : null,
477
477
  matcap: c ? await o(c) : null
478
478
  };
479
479
  }
480
480
  }
481
481
  const Ke = (e, t) => {
482
- const n = B(() => t.renderer.value.domElement), o = U([]), { x: i, y: a } = Rt({ target: n });
482
+ const n = B(() => t.renderer.value.domElement), o = U([]), { x: i, y: l } = Rt({ target: n });
483
483
  let r = 0;
484
- const { width: s, height: u, top: l, left: y } = jt(n), c = ({ x: d, y: E }) => {
484
+ const { width: s, height: u, top: a, left: y } = jt(n), c = ({ x: d, y: E }) => {
485
485
  if (n.value)
486
486
  return {
487
487
  x: (d - y.value) / s.value * 2 - 1,
488
- y: -((E - l.value) / u.value) * 2 + 1
488
+ y: -((E - a.value) / u.value) * 2 + 1
489
489
  };
490
490
  }, p = ({ x: d, y: E }) => {
491
491
  if (t.camera.value)
492
492
  return t.raycaster.value.setFromCamera(new ae(d, E), t.camera.value), o.value = t.raycaster.value.intersectObjects(e.value, !0), o.value;
493
- }, M = (d) => {
493
+ }, P = (d) => {
494
494
  const E = c({
495
495
  x: (d == null ? void 0 : d.clientX) ?? i.value,
496
- y: (d == null ? void 0 : d.clientY) ?? a.value
496
+ y: (d == null ? void 0 : d.clientY) ?? l.value
497
497
  });
498
498
  return E ? p(E) || [] : [];
499
499
  }, f = x(), b = x(), m = x(), w = x(), v = x(), h = x(), _ = x(), g = x();
500
- function P(d) {
500
+ function M(d) {
501
501
  const E = {};
502
502
  for (const I in d)
503
503
  typeof I != "function" && (E[I] = d[I]);
@@ -505,7 +505,7 @@ const Ke = (e, t) => {
505
505
  }
506
506
  const C = (d, E) => {
507
507
  var _e, Ee, ke;
508
- const I = P(E), Q = new ge(E == null ? void 0 : E.clientX, E == null ? void 0 : E.clientY, 0).unproject((_e = t.camera) == null ? void 0 : _e.value);
508
+ const I = M(E), Q = new ge(E == null ? void 0 : E.clientX, E == null ? void 0 : E.clientY, 0).unproject((_e = t.camera) == null ? void 0 : _e.value);
509
509
  d.trigger({
510
510
  ...I,
511
511
  intersections: o.value,
@@ -520,7 +520,7 @@ const Ke = (e, t) => {
520
520
  };
521
521
  let R;
522
522
  const O = (d) => {
523
- M(d), C(m, d), R = d;
523
+ P(d), C(m, d), R = d;
524
524
  }, T = () => {
525
525
  R && O(R);
526
526
  };
@@ -529,7 +529,7 @@ const Ke = (e, t) => {
529
529
  var E;
530
530
  S = (E = o.value[0]) == null ? void 0 : E.object, r = 0, j = new ae(
531
531
  (d == null ? void 0 : d.clientX) ?? i.value,
532
- (d == null ? void 0 : d.clientY) ?? a.value
532
+ (d == null ? void 0 : d.clientY) ?? l.value
533
533
  ), C(v, d);
534
534
  };
535
535
  let z, J = !1;
@@ -537,7 +537,7 @@ const Ke = (e, t) => {
537
537
  var E, I, Q;
538
538
  d instanceof PointerEvent && (o.value.length === 0 && C(h, d), S === ((E = o.value[0]) == null ? void 0 : E.object) && (L = new ae(
539
539
  (d == null ? void 0 : d.clientX) ?? i.value,
540
- (d == null ? void 0 : d.clientY) ?? a.value
540
+ (d == null ? void 0 : d.clientY) ?? l.value
541
541
  ), r = j == null ? void 0 : j.distanceTo(L), d.button === 0 ? (C(f, d), z === ((I = o.value[0]) == null ? void 0 : I.object) ? J = !0 : (z = (Q = o.value[0]) == null ? void 0 : Q.object, J = !1)) : d.button === 2 && C(_, d)), C(w, d));
542
542
  }, Me = (d) => {
543
543
  J && (C(b, d), z = void 0, J = !1);
@@ -559,23 +559,23 @@ const Ke = (e, t) => {
559
559
  };
560
560
  function pn() {
561
561
  const { logWarning: e } = $();
562
- function t(a, r, s) {
562
+ function t(l, r, s) {
563
563
  let u = null;
564
- return a.traverse((l) => {
565
- l[r] === s && (u = l);
564
+ return l.traverse((a) => {
565
+ a[r] === s && (u = a);
566
566
  }), u || e(`Child with ${r} '${s}' not found.`), u;
567
567
  }
568
- function n(a, r, s) {
568
+ function n(l, r, s) {
569
569
  const u = [];
570
- return a.traverse((l) => {
571
- l[r].includes(s) && u.push(l);
570
+ return l.traverse((a) => {
571
+ a[r].includes(s) && u.push(a);
572
572
  }), u.length || e(`Children with ${r} '${s}' not found.`), u;
573
573
  }
574
- function o(a, r) {
575
- return t(a, "name", r);
574
+ function o(l, r) {
575
+ return t(l, "name", r);
576
576
  }
577
- function i(a, r) {
578
- return n(a, "name", r);
577
+ function i(l, r) {
578
+ return n(l, "name", r);
579
579
  }
580
580
  return {
581
581
  seek: t,
@@ -594,11 +594,11 @@ const mn = (e) => {
594
594
  n.value.add(c);
595
595
  }, i = (c) => {
596
596
  n.value.delete(c);
597
- }, a = (c) => {
597
+ }, l = (c) => {
598
598
  Object.values(t).forEach((p) => p.delete(c)), i(c);
599
599
  }, r = (c) => {
600
- const { onClick: p, onPointerMove: M, onPointerEnter: f, onPointerLeave: b } = c;
601
- p && t.click.set(c, p), M && t.pointerMove.set(c, M), f && t.pointerEnter.set(c, f), b && t.pointerLeave.set(c, b);
600
+ const { onClick: p, onPointerMove: P, onPointerEnter: f, onPointerLeave: b } = c;
601
+ p && t.click.set(c, p), P && t.pointerMove.set(c, P), f && t.pointerEnter.set(c, f), b && t.pointerLeave.set(c, b);
602
602
  }, s = B(
603
603
  () => wr(
604
604
  [
@@ -608,20 +608,20 @@ const mn = (e) => {
608
608
  ({ uuid: c }) => c
609
609
  )
610
610
  );
611
- e.registerObjectAtPointerEventHandler = r, e.deregisterObjectAtPointerEventHandler = a, e.registerBlockingObjectAtPointerEventHandler = o, e.deregisterBlockingObjectAtPointerEventHandler = i;
612
- const { onClick: u, onPointerMove: l } = Ke(s, e);
611
+ e.registerObjectAtPointerEventHandler = r, e.deregisterObjectAtPointerEventHandler = l, e.registerBlockingObjectAtPointerEventHandler = o, e.deregisterBlockingObjectAtPointerEventHandler = i;
612
+ const { onClick: u, onPointerMove: a } = Ke(s, e);
613
613
  u(({ intersects: c, event: p }) => {
614
- var M;
615
- c.length && ((M = t.click.get(c[0].object)) == null || M(c[0], p));
614
+ var P;
615
+ c.length && ((P = t.click.get(c[0].object)) == null || P(c[0], p));
616
616
  });
617
617
  let y;
618
- return l(({ intersects: c, event: p }) => {
618
+ return a(({ intersects: c, event: p }) => {
619
619
  var w, v, h, _;
620
- const M = (w = c == null ? void 0 : c[0]) == null ? void 0 : w.object, { pointerLeave: f, pointerEnter: b, pointerMove: m } = t;
621
- y && y !== M && ((v = f.get(y)) == null || v(y, p)), M && (y !== M && ((h = b.get(M)) == null || h(c[0], p)), (_ = m.get(M)) == null || _(c[0], p)), y = M || null;
620
+ const P = (w = c == null ? void 0 : c[0]) == null ? void 0 : w.object, { pointerLeave: f, pointerEnter: b, pointerMove: m } = t;
621
+ y && y !== P && ((v = f.get(y)) == null || v(y, p)), P && (y !== P && ((h = b.get(P)) == null || h(c[0], p)), (_ = m.get(P)) == null || _(c[0], p)), y = P || null;
622
622
  }), {
623
623
  registerObject: r,
624
- deregisterObject: a,
624
+ deregisterObject: l,
625
625
  registerBlockingObject: o,
626
626
  deregisterBlockingObject: i
627
627
  };
@@ -630,7 +630,7 @@ function be(e) {
630
630
  let t = 0;
631
631
  return e.traverse((n) => {
632
632
  if (n.isMesh && n.geometry) {
633
- const o = n.geometry, i = o.attributes.position.count * 3 * Float32Array.BYTES_PER_ELEMENT, a = o.index ? o.index.count * Uint32Array.BYTES_PER_ELEMENT : 0, r = o.attributes.normal ? o.attributes.normal.count * 3 * Float32Array.BYTES_PER_ELEMENT : 0, s = o.attributes.uv ? o.attributes.uv.count * 2 * Float32Array.BYTES_PER_ELEMENT : 0, u = i + a + r + s;
633
+ const o = n.geometry, i = o.attributes.position.count * 3 * Float32Array.BYTES_PER_ELEMENT, l = o.index ? o.index.count * Uint32Array.BYTES_PER_ELEMENT : 0, r = o.attributes.normal ? o.attributes.normal.count * 3 * Float32Array.BYTES_PER_ELEMENT : 0, s = o.attributes.uv ? o.attributes.uv.count * 2 * Float32Array.BYTES_PER_ELEMENT : 0, u = i + l + r + s;
634
634
  t += u;
635
635
  }
636
636
  }), t;
@@ -640,9 +640,9 @@ function Lr(e) {
640
640
  }
641
641
  const de = A({}), pe = (e) => Object.assign(de.value, e);
642
642
  function Dr(e, t, n = 10) {
643
- const o = k(e) ? It() : Ht(B(() => k(t).parentElement)), i = ue(Le(o.width, n)), a = ue(Le(o.height, n)), r = B(() => i.value / a.value);
643
+ const o = k(e) ? It() : Ht(B(() => k(t).parentElement)), i = ue(Le(o.width, n)), l = ue(Le(o.height, n)), r = B(() => i.value / l.value);
644
644
  return {
645
- height: a,
645
+ height: l,
646
646
  width: i,
647
647
  aspectRatio: r
648
648
  };
@@ -651,22 +651,22 @@ function le() {
651
651
  const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set();
652
652
  let n = 0, o = !1;
653
653
  const i = () => {
654
- const l = Array.from(e.entries()).sort((y, c) => {
654
+ const a = Array.from(e.entries()).sort((y, c) => {
655
655
  const p = y[1].priority - c[1].priority;
656
656
  return p === 0 ? y[1].addI - c[1].addI : p;
657
657
  });
658
- t.clear(), l.forEach((y) => t.add(y[0]));
659
- }, a = (l) => {
660
- e.delete(l), t.delete(l);
658
+ t.clear(), a.forEach((y) => t.add(y[0]));
659
+ }, l = (a) => {
660
+ e.delete(a), t.delete(a);
661
661
  };
662
- return { on: (l, y = 0) => {
663
- e.set(l, { priority: y, addI: n++ });
664
- const c = () => a(l);
662
+ return { on: (a, y = 0) => {
663
+ e.set(a, { priority: y, addI: n++ });
664
+ const c = () => l(a);
665
665
  return Ut(c), o = !0, {
666
666
  off: c
667
667
  };
668
- }, off: a, trigger: (...l) => {
669
- o && (i(), o = !1), t.forEach((y) => y(...l));
668
+ }, off: l, trigger: (...a) => {
669
+ o && (i(), o = !1), t.forEach((y) => y(...a));
670
670
  }, dispose: () => {
671
671
  e.clear(), t.clear();
672
672
  }, get count() {
@@ -677,18 +677,18 @@ function Br() {
677
677
  const e = new We(!1), t = A(!1), n = A(!1);
678
678
  let o;
679
679
  const i = Mt.generateUUID();
680
- let a = null;
680
+ let l = null;
681
681
  const r = le(), s = le(), u = le();
682
- let l = {};
682
+ let a = {};
683
683
  function y(h) {
684
- l = h;
684
+ a = h;
685
685
  }
686
686
  function c(h, _, g = 0) {
687
687
  switch (_) {
688
688
  case "before":
689
689
  return r.on(h, g);
690
690
  case "render":
691
- return a || (a = h), s.dispose(), s.on(h);
691
+ return l || (l = h), s.dispose(), s.on(h);
692
692
  case "after":
693
693
  return u.on(h, g);
694
694
  }
@@ -696,7 +696,7 @@ function Br() {
696
696
  function p() {
697
697
  t.value || (e.start(), t.value = !0, v());
698
698
  }
699
- function M() {
699
+ function P() {
700
700
  t.value && (e.stop(), cancelAnimationFrame(o), t.value = !1);
701
701
  }
702
702
  function f() {
@@ -712,14 +712,22 @@ function Br() {
712
712
  n.value = !1;
713
713
  }
714
714
  function v() {
715
- const h = e.getDelta(), _ = e.getElapsedTime(), g = { delta: h, elapsed: _, clock: e, ...l };
716
- t.value && r.trigger(g), n.value || (s.count ? s.trigger(g) : a && a(g)), t.value && u.trigger(g), o = requestAnimationFrame(v);
715
+ const h = e.getDelta(), _ = e.getElapsedTime(), g = {
716
+ camera: W(a.camera),
717
+ scene: W(a.scene),
718
+ renderer: W(a.renderer),
719
+ raycaster: W(a.raycaster),
720
+ controls: W(a.controls),
721
+ invalidate: a.invalidate,
722
+ advance: a.advance
723
+ }, M = { delta: h, elapsed: _, clock: e, ...g };
724
+ t.value && r.trigger(M), n.value || (s.count ? s.trigger(M) : l && l(M)), t.value && u.trigger(M), o = requestAnimationFrame(v);
717
725
  }
718
726
  return {
719
727
  loopId: i,
720
728
  register: (h, _, g) => c(h, _, g),
721
729
  start: p,
722
- stop: M,
730
+ stop: P,
723
731
  pause: f,
724
732
  resume: b,
725
733
  pauseRender: m,
@@ -735,14 +743,14 @@ function Rr({
735
743
  windowSize: n,
736
744
  disableRender: o,
737
745
  rendererOptions: i,
738
- emit: a
746
+ emit: l
739
747
  }) {
740
748
  const { logWarning: r } = $(), s = U(e), u = Dr(n, t), {
741
- camera: l,
749
+ camera: a,
742
750
  cameras: y,
743
751
  registerCamera: c,
744
752
  deregisterCamera: p,
745
- setCameraActive: M
753
+ setCameraActive: P
746
754
  } = lr({ sizes: u, scene: e }), f = {
747
755
  mode: A(i.renderMode || "always"),
748
756
  priority: A(0),
@@ -761,15 +769,15 @@ function Rr({
761
769
  scene: e,
762
770
  canvas: t,
763
771
  options: i,
764
- emit: a,
772
+ emit: l,
765
773
  // TODO: replace contextParts with full ctx at https://github.com/Tresjs/tres/issues/516
766
- contextParts: { sizes: u, camera: l, render: f, invalidate: b, advance: m },
774
+ contextParts: { sizes: u, camera: a, render: f, invalidate: b, advance: m },
767
775
  disableRender: o
768
776
  }
769
777
  ), v = {
770
778
  sizes: u,
771
779
  scene: s,
772
- camera: l,
780
+ camera: a,
773
781
  cameras: ue(y),
774
782
  renderer: w,
775
783
  raycaster: U(new Pt()),
@@ -791,21 +799,21 @@ function Rr({
791
799
  extend: pe,
792
800
  invalidate: b,
793
801
  registerCamera: c,
794
- setCameraActive: M,
802
+ setCameraActive: P,
795
803
  deregisterCamera: p,
796
804
  loop: Br()
797
805
  };
798
806
  ce("useTres", v), v.scene.value.__tres = {
799
807
  root: v
800
808
  }, v.loop.register(() => {
801
- l.value && f.frames.value > 0 && (w.value.render(e, l.value), a("render", v.renderer.value)), f.priority.value = 0, f.mode.value === "always" ? f.frames.value = 1 : f.frames.value = Math.max(0, f.frames.value - 1);
809
+ a.value && f.frames.value > 0 && (w.value.render(e, a.value), l("render", v.renderer.value)), f.priority.value = 0, f.mode.value === "always" ? f.frames.value = 1 : f.frames.value = Math.max(0, f.frames.value - 1);
802
810
  }, "render"), v.loop.start(), N(() => {
803
811
  v.loop.stop();
804
812
  });
805
- const h = 100, _ = $t({ every: h }), { isSupported: g, memory: P } = Ft({ interval: h }), C = 160;
813
+ const h = 100, _ = $t({ every: h }), { isSupported: g, memory: M } = Ft({ interval: h }), C = 160;
806
814
  let R = performance.now();
807
815
  const O = ({ timestamp: L }) => {
808
- v.scene.value && (v.perf.memory.allocatedMem = be(v.scene.value)), L - R >= h && (R = L, v.perf.fps.accumulator.push(_.value), v.perf.fps.accumulator.length > C && v.perf.fps.accumulator.shift(), v.perf.fps.value = _.value, g.value && P.value && (v.perf.memory.accumulator.push(P.value.usedJSHeapSize / 1024 / 1024), v.perf.memory.accumulator.length > C && v.perf.memory.accumulator.shift(), v.perf.memory.currentMem = v.perf.memory.accumulator.reduce((Y, z) => Y + z, 0) / v.perf.memory.accumulator.length));
816
+ v.scene.value && (v.perf.memory.allocatedMem = be(v.scene.value)), L - R >= h && (R = L, v.perf.fps.accumulator.push(_.value), v.perf.fps.accumulator.length > C && v.perf.fps.accumulator.shift(), v.perf.fps.value = _.value, g.value && M.value && (v.perf.memory.accumulator.push(M.value.usedJSHeapSize / 1024 / 1024), v.perf.memory.accumulator.length > C && v.perf.memory.accumulator.shift(), v.perf.memory.currentMem = v.perf.memory.accumulator.reduce((Y, z) => Y + z, 0) / v.perf.memory.accumulator.length));
809
817
  };
810
818
  let T = 0;
811
819
  const S = 1, { pause: j } = Ve(({ delta: L }) => {
@@ -829,23 +837,23 @@ function gn() {
829
837
  renderer: n,
830
838
  loop: o,
831
839
  raycaster: i,
832
- controls: a,
840
+ controls: l,
833
841
  invalidate: r,
834
842
  advance: s
835
843
  } = Xe();
836
844
  o.setContext({
837
- camera: W(e),
838
- scene: W(t),
839
- renderer: W(n),
840
- raycaster: W(i),
841
- controls: W(a),
845
+ camera: e,
846
+ scene: t,
847
+ renderer: n,
848
+ raycaster: i,
849
+ controls: l,
842
850
  invalidate: r,
843
851
  advance: s
844
852
  });
845
853
  function u(c, p = 0) {
846
854
  return o.register(c, "before", p);
847
855
  }
848
- function l(c) {
856
+ function a(c) {
849
857
  return o.register(c, "render");
850
858
  }
851
859
  function y(c, p = 0) {
@@ -858,63 +866,63 @@ function gn() {
858
866
  resumeRender: o.resumeRender,
859
867
  isActive: o.isActive,
860
868
  onBeforeRender: u,
861
- render: l,
869
+ render: a,
862
870
  onAfterRender: y
863
871
  };
864
872
  }
865
873
  function jr(e, t, n) {
866
874
  const o = U(), i = U();
867
875
  e && (o.value = e), t && (i.value = t);
868
- const a = B(
876
+ const l = B(
869
877
  () => o.value ? o.value.children : []
870
878
  );
871
- function r(g, P) {
879
+ function r(g, M) {
872
880
  if (Array.isArray(g))
873
881
  for (const C of g)
874
- C(P);
875
- typeof g == "function" && g(P);
882
+ C(M);
883
+ typeof g == "function" && g(M);
876
884
  }
877
- function s(g, P) {
878
- const C = [], R = () => P.stopPropagating = !0;
879
- P.stopPropagation = R;
880
- for (const O of P == null ? void 0 : P.intersections) {
881
- if (P.stopPropagating)
885
+ function s(g, M) {
886
+ const C = [], R = () => M.stopPropagating = !0;
887
+ M.stopPropagation = R;
888
+ for (const O of M == null ? void 0 : M.intersections) {
889
+ if (M.stopPropagating)
882
890
  return;
883
- P = { ...P, ...O };
891
+ M = { ...M, ...O };
884
892
  const { object: T } = O;
885
- P.eventObject = T, r(T[g], P), C.push(T);
893
+ M.eventObject = T, r(T[g], M), C.push(T);
886
894
  let S = T.parent;
887
- for (; S !== null && !P.stopPropagating && !C.includes(S); )
888
- P.eventObject = S, r(S[g], P), C.push(S), S = S.parent;
895
+ for (; S !== null && !M.stopPropagating && !C.includes(S); )
896
+ M.eventObject = S, r(S[g], M), C.push(S), S = S.parent;
889
897
  const j = yr(g.slice(2));
890
- n(j, { intersection: O, event: P });
898
+ n(j, { intersection: O, event: M });
891
899
  }
892
900
  }
893
901
  const {
894
902
  onClick: u,
895
- onDblClick: l,
903
+ onDblClick: a,
896
904
  onContextMenu: y,
897
905
  onPointerMove: c,
898
906
  onPointerDown: p,
899
- onPointerUp: M,
907
+ onPointerUp: P,
900
908
  onPointerMissed: f,
901
909
  onWheel: b,
902
910
  forceUpdate: m
903
- } = Ke(a, t);
904
- M((g) => s("onPointerUp", g)), p((g) => s("onPointerDown", g)), u((g) => s("onClick", g)), l((g) => s("onDoubleClick", g)), y((g) => s("onContextMenu", g)), b((g) => s("onWheel", g));
911
+ } = Ke(l, t);
912
+ P((g) => s("onPointerUp", g)), p((g) => s("onPointerDown", g)), u((g) => s("onClick", g)), a((g) => s("onDoubleClick", g)), y((g) => s("onContextMenu", g)), b((g) => s("onWheel", g));
905
913
  let w = [];
906
914
  c((g) => {
907
- const P = g.intersections.map(({ object: C }) => C);
915
+ const M = g.intersections.map(({ object: C }) => C);
908
916
  w.forEach((C) => {
909
- P.includes(C) || (s("onPointerLeave", g), s("onPointerOut", g));
917
+ M.includes(C) || (s("onPointerLeave", g), s("onPointerOut", g));
910
918
  }), g.intersections.forEach(({ object: C }) => {
911
919
  w.includes(C) || (s("onPointerEnter", g), s("onPointerOver", g));
912
- }), s("onPointerMove", g), w = P;
920
+ }), s("onPointerMove", g), w = M;
913
921
  });
914
922
  const v = [];
915
923
  f((g) => {
916
- const P = () => g.stopPropagating = !0;
917
- g.stopPropagation = P, v.forEach((C) => {
924
+ const M = () => g.stopPropagating = !0;
925
+ g.stopPropagation = M, v.forEach((C) => {
918
926
  g.stopPropagating || (g.eventObject = C, r(C.onPointerMissed, g));
919
927
  }), n("pointer-missed", { event: g });
920
928
  });
@@ -922,8 +930,8 @@ function jr(e, t, n) {
922
930
  v.push(g);
923
931
  }
924
932
  function _(g) {
925
- const P = v.indexOf(g);
926
- P > -1 && v.splice(P, 1);
933
+ const M = v.indexOf(g);
934
+ M > -1 && v.splice(M, 1);
927
935
  }
928
936
  return t.eventManager = {
929
937
  forceUpdate: m,
@@ -954,43 +962,43 @@ function Ie(e) {
954
962
  }
955
963
  const Hr = () => {
956
964
  let e = null;
957
- function t(r, s, u, l) {
958
- if (l || (l = {}), l.args || (l.args = []), r === "template" || gr(r))
965
+ function t(r, s, u, a) {
966
+ if (a || (a = {}), a.args || (a.args = []), r === "template" || gr(r))
959
967
  return null;
960
968
  let y = r.replace("Tres", ""), c;
961
969
  if (r === "primitive") {
962
- (l == null ? void 0 : l.object) === void 0 && je("Tres primitives need a prop 'object'");
963
- const p = l.object;
970
+ (a == null ? void 0 : a.object) === void 0 && je("Tres primitives need a prop 'object'");
971
+ const p = a.object;
964
972
  y = p.type, c = Object.assign(p.clone(), { type: y });
965
973
  } else {
966
974
  const p = de.value[y];
967
975
  p || je(
968
976
  `${y} is not defined on the THREE namespace. Use extend to add it to the catalog.`
969
- ), c = new p(...l.args);
977
+ ), c = new p(...a.args);
970
978
  }
971
- return c ? (c.isCamera && (l != null && l.position || c.position.set(3, 3, 3), l != null && l.lookAt || c.lookAt(0, 0, 0)), (l == null ? void 0 : l.attach) === void 0 && (c.isMaterial ? c.attach = "material" : c.isBufferGeometry && (c.attach = "geometry")), c.__tres = {
979
+ return c ? (c.isCamera && (a != null && a.position || c.position.set(3, 3, 3), a != null && a.lookAt || c.lookAt(0, 0, 0)), (a == null ? void 0 : a.attach) === void 0 && (c.isMaterial ? c.attach = "material" : c.isBufferGeometry && (c.attach = "geometry")), c.__tres = {
972
980
  ...c.__tres,
973
981
  type: y,
974
- memoizedProps: l,
982
+ memoizedProps: a,
975
983
  eventCount: 0,
976
984
  disposable: !0,
977
985
  primitive: r === "primitive"
978
- }, c.isObject3D && c.__tres && (l != null && l.material || l != null && l.geometry) && (c.__tres.disposable = !1), c) : null;
986
+ }, c.isObject3D && c.__tres && (a != null && a.material || a != null && a.geometry) && (c.__tres.disposable = !1), c) : null;
979
987
  }
980
988
  function n(r, s) {
981
- var l, y, c, p, M;
989
+ var a, y, c, p, P;
982
990
  if (!r)
983
991
  return;
984
992
  s && s.isScene && (e = s), e && r.__tres && (r.__tres.root = e.__tres.root);
985
993
  const u = s || e;
986
994
  if (r != null && r.isObject3D) {
987
- const { registerCamera: f } = (l = r == null ? void 0 : r.__tres) == null ? void 0 : l.root;
988
- r != null && r.isCamera && f(r), r.onPointerMissed && ((y = r == null ? void 0 : r.__tres) != null && y.root) && ((M = (p = (c = r == null ? void 0 : r.__tres) == null ? void 0 : c.root) == null ? void 0 : p.eventManager) == null || M.registerPointerMissedObject(r));
995
+ const { registerCamera: f } = (a = r == null ? void 0 : r.__tres) == null ? void 0 : a.root;
996
+ r != null && r.isCamera && f(r), r.onPointerMissed && ((y = r == null ? void 0 : r.__tres) != null && y.root) && ((P = (p = (c = r == null ? void 0 : r.__tres) == null ? void 0 : c.root) == null ? void 0 : p.eventManager) == null || P.registerPointerMissedObject(r));
989
997
  }
990
998
  r != null && r.isObject3D && (u != null && u.isObject3D) ? (u.add(r), r.dispatchEvent({ type: "added" })) : r != null && r.isFog ? u.fog = r : typeof (r == null ? void 0 : r.attach) == "string" && (r.__previousAttach = r[u == null ? void 0 : u.attach], u && (u[r.attach] = r));
991
999
  }
992
1000
  function o(r) {
993
- var u, l, y, c;
1001
+ var u, a, y, c;
994
1002
  if (!r)
995
1003
  return;
996
1004
  const s = r.__tres;
@@ -1003,16 +1011,16 @@ const Hr = () => {
1003
1011
  (u = r.removeFromParent) == null || u.call(r), r.traverse((f) => {
1004
1012
  var b, m;
1005
1013
  p(f), f.onPointerMissed && ((m = (b = s == null ? void 0 : s.root) == null ? void 0 : b.eventManager) == null || m.deregisterPointerMissedObject(f));
1006
- }), p(r), Ie(r), !((l = r.__tres) == null ? void 0 : l.primitive) && ((y = r.__tres) != null && y.disposable) && ye(r), (c = r.dispose) == null || c.call(r);
1014
+ }), p(r), Ie(r), !((a = r.__tres) == null ? void 0 : a.primitive) && ((y = r.__tres) != null && y.disposable) && ye(r), (c = r.dispose) == null || c.call(r);
1007
1015
  }
1008
1016
  }
1009
- function i(r, s, u, l) {
1017
+ function i(r, s, u, a) {
1010
1018
  var y, c;
1011
1019
  if (r) {
1012
- let p = r, M = s;
1013
- if ((y = r == null ? void 0 : r.__tres) != null && y.primitive && M === "object" && u !== null) {
1020
+ let p = r, P = s;
1021
+ if ((y = r == null ? void 0 : r.__tres) != null && y.primitive && P === "object" && u !== null) {
1014
1022
  const w = t("primitive", void 0, void 0, {
1015
- object: l
1023
+ object: a
1016
1024
  });
1017
1025
  for (const v in w) {
1018
1026
  if (v === "uuid")
@@ -1022,33 +1030,33 @@ const Hr = () => {
1022
1030
  }
1023
1031
  w != null && w.__tres && (w.__tres.root = e == null ? void 0 : e.__tres.root), w != null && w.isGroup ? (r.geometry = void 0, r.material = void 0) : delete r.isGroup;
1024
1032
  }
1025
- if (r != null && r.isObject3D && M === "blocks-pointer-events") {
1026
- l || l === "" ? r[M] = l : delete r[M];
1033
+ if (r != null && r.isObject3D && P === "blocks-pointer-events") {
1034
+ a || a === "" ? r[P] = a : delete r[P];
1027
1035
  return;
1028
1036
  }
1029
- let f = X(M), b = p == null ? void 0 : p[f];
1030
- if (M === "args") {
1031
- const w = r, v = u ?? [], h = l ?? [], _ = ((c = r == null ? void 0 : r.__tres) == null ? void 0 : c.type) || r.type;
1037
+ let f = X(P), b = p == null ? void 0 : p[f];
1038
+ if (P === "args") {
1039
+ const w = r, v = u ?? [], h = a ?? [], _ = ((c = r == null ? void 0 : r.__tres) == null ? void 0 : c.type) || r.type;
1032
1040
  _ && v.length && !Pr(v, h) && (p = Object.assign(
1033
1041
  w,
1034
- new de.value[_](...l)
1042
+ new de.value[_](...a)
1035
1043
  ));
1036
1044
  return;
1037
1045
  }
1038
1046
  if (p.type === "BufferGeometry") {
1039
- if (M === "args")
1047
+ if (P === "args")
1040
1048
  return;
1041
1049
  p.setAttribute(
1042
- X(M),
1043
- new Ct(...l)
1050
+ X(P),
1051
+ new Ct(...a)
1044
1052
  );
1045
1053
  return;
1046
1054
  }
1047
- if (M.includes("-") && b === void 0) {
1048
- const w = M.split("-");
1049
- b = w.reduce((v, h) => v[X(h)], p), M = w.pop(), f = M, b != null && b.set || (p = w.reduce((v, h) => v[X(h)], p));
1055
+ if (P.includes("-") && b === void 0) {
1056
+ const w = P.split("-");
1057
+ b = w.reduce((v, h) => v[X(h)], p), P = w.pop(), f = P, b != null && b.set || (p = w.reduce((v, h) => v[X(h)], p));
1050
1058
  }
1051
- let m = l;
1059
+ let m = a;
1052
1060
  if (m === "" && (m = !0), ee(b)) {
1053
1061
  Ir.includes(s) || (Array.isArray(m) ? r[f](...m) : r[f](m)), f.startsWith("on") && ee(m) && (p[f] = m);
1054
1062
  return;
@@ -1056,7 +1064,7 @@ const Hr = () => {
1056
1064
  !(b != null && b.set) && !ee(b) ? p[f] = m : b.constructor === m.constructor && (b != null && b.copy) ? b == null || b.copy(m) : Array.isArray(m) ? b.set(...m) : !b.isColor && b.setScalar ? b.setScalar(m) : b.set(m), Ie(r);
1057
1065
  }
1058
1066
  }
1059
- function a(r) {
1067
+ function l(r) {
1060
1068
  return (r == null ? void 0 : r.parent) || null;
1061
1069
  }
1062
1070
  return {
@@ -1064,7 +1072,7 @@ const Hr = () => {
1064
1072
  remove: o,
1065
1073
  createElement: t,
1066
1074
  patchProp: i,
1067
- parentNode: a,
1075
+ parentNode: l,
1068
1076
  createText: () => void 0,
1069
1077
  createComment: () => void 0,
1070
1078
  setText: () => void 0,
@@ -1101,22 +1109,22 @@ class Gr {
1101
1109
  o[r] = s.defaultValue;
1102
1110
  }
1103
1111
  const i = `__vue-devtools-plugin-settings__${t.id}`;
1104
- let a = Object.assign({}, o);
1112
+ let l = Object.assign({}, o);
1105
1113
  try {
1106
1114
  const r = localStorage.getItem(i), s = JSON.parse(r);
1107
- Object.assign(a, s);
1115
+ Object.assign(l, s);
1108
1116
  } catch {
1109
1117
  }
1110
1118
  this.fallbacks = {
1111
1119
  getSettings() {
1112
- return a;
1120
+ return l;
1113
1121
  },
1114
1122
  setSettings(r) {
1115
1123
  try {
1116
1124
  localStorage.setItem(i, JSON.stringify(r));
1117
1125
  } catch {
1118
1126
  }
1119
- a = r;
1127
+ l = r;
1120
1128
  },
1121
1129
  now() {
1122
1130
  return zr();
@@ -1136,11 +1144,11 @@ class Gr {
1136
1144
  args: u,
1137
1145
  resolve: () => {
1138
1146
  }
1139
- }), this.fallbacks[s](...u)) : (...u) => new Promise((l) => {
1147
+ }), this.fallbacks[s](...u)) : (...u) => new Promise((a) => {
1140
1148
  this.targetQueue.push({
1141
1149
  method: s,
1142
1150
  args: u,
1143
- resolve: l
1151
+ resolve: a
1144
1152
  });
1145
1153
  })
1146
1154
  });
@@ -1154,11 +1162,11 @@ class Gr {
1154
1162
  }
1155
1163
  }
1156
1164
  function Vr(e, t) {
1157
- const n = e, o = Ze(), i = Ur(), a = $r && n.enableEarlyProxy;
1158
- if (i && (o.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !a))
1165
+ const n = e, o = Ze(), i = Ur(), l = $r && n.enableEarlyProxy;
1166
+ if (i && (o.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !l))
1159
1167
  i.emit(Fr, e, t);
1160
1168
  else {
1161
- const r = a ? new Gr(n, i) : null;
1169
+ const r = l ? new Gr(n, i) : null;
1162
1170
  (o.__VUE_DEVTOOLS_PLUGINS__ = o.__VUE_DEVTOOLS_PLUGINS__ || []).push({
1163
1171
  pluginDescriptor: n,
1164
1172
  setupFn: t,
@@ -1247,24 +1255,24 @@ function Qr(e, t) {
1247
1255
  n.sendInspectorTree(G);
1248
1256
  }, 1e3), setInterval(() => {
1249
1257
  n.notifyComponentUpdate();
1250
- }, 5e3), n.on.getInspectorTree((a) => {
1251
- if (a.inspectorId === G) {
1258
+ }, 5e3), n.on.getInspectorTree((l) => {
1259
+ if (l.inspectorId === G) {
1252
1260
  const r = et(t.scene.value);
1253
- tt(t.scene.value, r, a.filter), Jr.sceneGraph = r, a.rootNodes = [r];
1261
+ tt(t.scene.value, r, l.filter), Jr.sceneGraph = r, l.rootNodes = [r];
1254
1262
  }
1255
1263
  });
1256
1264
  let o = null, i = null;
1257
- n.on.getInspectorState((a) => {
1265
+ n.on.getInspectorState((l) => {
1258
1266
  var r;
1259
- if (a.inspectorId === G) {
1260
- const [s] = t.scene.value.getObjectsByProperty("uuid", a.nodeId);
1267
+ if (l.inspectorId === G) {
1268
+ const [s] = t.scene.value.getObjectsByProperty("uuid", l.nodeId);
1261
1269
  if (!s)
1262
1270
  return;
1263
1271
  if (i && o && o.parent && i.remove(o), s.isMesh) {
1264
1272
  const u = Er(s);
1265
1273
  s.add(u), o = u, i = s;
1266
1274
  }
1267
- a.state = {
1275
+ l.state = {
1268
1276
  object: [
1269
1277
  {
1270
1278
  key: "uuid",
@@ -1349,14 +1357,14 @@ function Qr(e, t) {
1349
1357
  value: s.visible
1350
1358
  }
1351
1359
  ]
1352
- }, s.isScene && (a.state.info = {
1360
+ }, s.isScene && (l.state.info = {
1353
1361
  memory: be(s),
1354
1362
  objects: s.children.length,
1355
1363
  calls: t.renderer.value.info.render.calls,
1356
1364
  triangles: t.renderer.value.info.render.triangles,
1357
1365
  points: t.renderer.value.info.render.points,
1358
1366
  lines: t.renderer.value.info.render.lines
1359
- }, a.state.programs = ((r = t.renderer.value.info.programs) == null ? void 0 : r.map((u) => ({
1367
+ }, l.state.programs = ((r = t.renderer.value.info.programs) == null ? void 0 : r.map((u) => ({
1360
1368
  key: u.name,
1361
1369
  value: {
1362
1370
  ...u,
@@ -1366,8 +1374,8 @@ function Qr(e, t) {
1366
1374
  }
1367
1375
  }))) || []);
1368
1376
  }
1369
- }), n.on.editInspectorState((a) => {
1370
- a.inspectorId === G && _r(t.scene.value, a.nodeId, a.path, a.state.value);
1377
+ }), n.on.editInspectorState((l) => {
1378
+ l.inspectorId === G && _r(t.scene.value, l.nodeId, l.path, l.state.value);
1371
1379
  });
1372
1380
  }
1373
1381
  );
@@ -1416,13 +1424,13 @@ const Kr = ["data-scene", "data-tres"], Xr = /* @__PURE__ */ Se({
1416
1424
  ],
1417
1425
  setup(e, { expose: t, emit: n }) {
1418
1426
  var b;
1419
- const o = e, i = n, a = it(), { logWarning: r } = $(), s = A(), u = U(new Ne()), l = (b = xe()) == null ? void 0 : b.appContext.app;
1427
+ const o = e, i = n, l = it(), { logWarning: r } = $(), s = A(), u = U(new Ne()), a = (b = xe()) == null ? void 0 : b.appContext.app;
1420
1428
  pe(Fe);
1421
1429
  const y = (m) => Se({
1422
1430
  setup() {
1423
1431
  var v;
1424
1432
  const w = (v = xe()) == null ? void 0 : v.appContext;
1425
- return w && (w.app = l), ce("useTres", m), ce("extend", pe), typeof window < "u" && Qr(w == null ? void 0 : w.app, m), () => Te(pt, null, a != null && a.default ? a.default() : []);
1433
+ return w && (w.app = a), ce("useTres", m), ce("extend", pe), typeof window < "u" && Qr(w == null ? void 0 : w.app, m), () => Te(pt, null, l != null && l.default ? l.default() : []);
1426
1434
  }
1427
1435
  }), c = (m) => {
1428
1436
  const w = y(m), { render: v } = dt(Hr());
@@ -1431,35 +1439,35 @@ const Kr = ["data-scene", "data-tres"], Xr = /* @__PURE__ */ Se({
1431
1439
  ye(m.scene.value), w && (m.renderer.value.dispose(), m.renderer.value.renderLists.dispose(), m.renderer.value.forceContextLoss()), u.value.__tres = {
1432
1440
  root: m
1433
1441
  }, c(m);
1434
- }, M = B(() => o.disableRender), f = U(null);
1442
+ }, P = B(() => o.disableRender), f = U(null);
1435
1443
  return t({ context: f, dispose: () => p(f.value, !0) }), at(() => {
1436
1444
  const m = s;
1437
1445
  f.value = Rr({
1438
1446
  scene: u.value,
1439
1447
  canvas: m,
1440
1448
  windowSize: o.windowSize ?? !1,
1441
- disableRender: M.value ?? !1,
1449
+ disableRender: P.value ?? !1,
1442
1450
  rendererOptions: o,
1443
1451
  emit: i
1444
1452
  }), jr(u.value, f.value, i);
1445
1453
  const { registerCamera: w, camera: v, cameras: h, deregisterCamera: _ } = f.value;
1446
1454
  c(f.value);
1447
1455
  const g = () => {
1448
- const P = new fe(
1456
+ const M = new fe(
1449
1457
  45,
1450
1458
  window.innerWidth / window.innerHeight,
1451
1459
  0.1,
1452
1460
  1e3
1453
1461
  );
1454
- P.position.set(3, 3, 3), P.lookAt(0, 0, 0), w(P);
1462
+ M.position.set(3, 3, 3), M.lookAt(0, 0, 0), w(M);
1455
1463
  const C = ve(() => {
1456
- h.value.length >= 2 && (P.removeFromParent(), _(P), C == null || C());
1464
+ h.value.length >= 2 && (M.removeFromParent(), _(M), C == null || C());
1457
1465
  });
1458
1466
  };
1459
1467
  V(
1460
1468
  () => o.camera,
1461
- (P, C) => {
1462
- P && w(P), C && (C.removeFromParent(), _(C));
1469
+ (M, C) => {
1470
+ M && w(M), C && (C.removeFromParent(), _(C));
1463
1471
  },
1464
1472
  {
1465
1473
  immediate: !0
@@ -1511,8 +1519,8 @@ class rt extends _t {
1511
1519
  constructor(t, n) {
1512
1520
  const o = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0], i = new Ae();
1513
1521
  i.setAttribute("position", new Oe(o, 3)), i.computeBoundingSphere();
1514
- const a = new Et({ fog: !1 });
1515
- super(i, a), this.light = t, this.color = n, this.type = "RectAreaLightHelper";
1522
+ const l = new Et({ fog: !1 });
1523
+ super(i, l), this.light = t, this.color = n, this.type = "RectAreaLightHelper";
1516
1524
  const r = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0], s = new Ae();
1517
1525
  s.setAttribute("position", new Oe(r, 3)), s.computeBoundingSphere(), this.add(new kt(s, new ze({ side: St, fog: !1 })));
1518
1526
  }
@@ -1587,6 +1595,7 @@ const wn = {
1587
1595
  export {
1588
1596
  Xr as TresCanvas,
1589
1597
  de as catalogue,
1598
+ Br as createRenderLoop,
1590
1599
  Mn as default,
1591
1600
  ye as dispose,
1592
1601
  pe as extend,