@tresjs/core 4.0.0-rc.1 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/tres.js CHANGED
@@ -1,24 +1,24 @@
1
1
  /**
2
2
  * name: @tresjs/core
3
- * version: v4.0.0-rc.1
3
+ * version: v4.0.0
4
4
  * (c) 2024
5
5
  * description: Declarative ThreeJS using Vue Components
6
6
  * author: Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)
7
7
  */
8
- var nt = Object.defineProperty;
9
- var ot = (e, t, n) => t in e ? nt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
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";
12
- import * as Fe from "three";
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
- 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 = [
8
+ var st = Object.defineProperty;
9
+ var it = (e, t, n) => t in e ? st(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
10
+ var se = (e, t, n) => (it(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 We, readonly as ue, unref as W, provide as ce, inject as at, defineComponent as Se, useSlots as lt, getCurrentInstance as xe, onMounted as ut, openBlock as ct, createElementBlock as ft, normalizeClass as dt, normalizeStyle as pt, createRenderer as mt, h as Te, Fragment as vt } from "vue";
12
+ import * as Ne from "three";
13
+ import { PerspectiveCamera as fe, Camera as gt, Clock as ze, Vector3 as ge, Color as re, Scene as Ge, MeshBasicMaterial as Ve, DoubleSide as ht, REVISION as yt, SRGBColorSpace as bt, ACESFilmicToneMapping as qe, PCFSoftShadowMap as wt, NoToneMapping as Mt, WebGLRenderer as ie, TextureLoader as Pt, Vector2 as ae, MathUtils as Ct, Raycaster as _t, BufferAttribute as Et, Line as kt, BufferGeometry as Ae, Float32BufferAttribute as Oe, LineBasicMaterial as St, Mesh as xt, BackSide as Tt, DirectionalLightHelper as At, PointLightHelper as Ot, SpotLightHelper as Lt, HemisphereLightHelper as Dt, ArrowHelper as Bt } from "three";
14
+ import { createEventHook as x, useRafFn as Ye, toValue as k, unrefElement as Rt, useDevicePixelRatio as jt, usePointer as It, useElementBounding as Ht, useWindowSize as Ut, useElementSize as $t, refDebounced as Le, tryOnScopeDispose as Ft, useFps as Wt, useMemory as Nt } from "@vueuse/core";
15
+ const zt = "@tresjs/core", Gt = "module", Vt = "4.0.0", qt = "pnpm@8.15.6", Yt = "Declarative ThreeJS using Vue Components", Jt = "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)", Qt = "MIT", Kt = [
16
16
  "vue",
17
17
  "3d",
18
18
  "threejs",
19
19
  "three",
20
20
  "threejs-vue"
21
- ], Qt = !1, Kt = {
21
+ ], Xt = !1, Zt = {
22
22
  ".": {
23
23
  types: "./dist/index.d.ts",
24
24
  import: "./dist/tres.js",
@@ -37,12 +37,12 @@ const Wt = "@tresjs/core", Nt = "module", zt = "4.0.0-rc.1", Gt = "pnpm@8.15.6",
37
37
  types: "./dist/src/utils/index.d.ts"
38
38
  },
39
39
  "./*": "./*"
40
- }, Xt = "./dist/tres.js", Zt = "./dist/tres.js", er = "./dist/index.d.ts", tr = [
40
+ }, er = "./dist/tres.js", tr = "./dist/tres.js", rr = "./dist/index.d.ts", nr = [
41
41
  "*.d.ts",
42
42
  "dist"
43
- ], rr = {
43
+ ], or = {
44
44
  access: "public"
45
- }, nr = {
45
+ }, sr = {
46
46
  dev: "cd playground && npm run dev",
47
47
  build: "vite build",
48
48
  playground: "cd playground && npm run dev",
@@ -59,90 +59,90 @@ const Wt = "@tresjs/core", Nt = "module", zt = "4.0.0-rc.1", Gt = "pnpm@8.15.6",
59
59
  "docs:preview": "vitepress preview docs",
60
60
  "docs:contributors": "esno scripts/update-contributors.ts",
61
61
  prepare: "node .husky/install.mjs"
62
- }, or = {
62
+ }, ir = {
63
63
  three: ">=0.133",
64
64
  vue: ">=3.4"
65
- }, sr = {
65
+ }, ar = {
66
66
  "@alvarosabu/utils": "^3.2.0",
67
67
  "@vue/devtools-api": "^6.6.1",
68
- "@vueuse/core": "^10.9.0"
69
- }, ir = {
68
+ "@vueuse/core": "^10.10.0"
69
+ }, lr = {
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.11.0",
76
+ "@typescript-eslint/parser": "^7.11.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",
86
86
  husky: "^9.0.11",
87
- jsdom: "^24.0.0",
87
+ jsdom: "^24.1.0",
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
- vite: "^5.2.11",
99
+ vite: "^5.2.12",
100
100
  "vite-plugin-banner": "^0.7.1",
101
101
  "vite-plugin-dts": "3.9.1",
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"
109
- }, ar = {
110
- name: Wt,
111
- type: Nt,
112
- version: zt,
113
- packageManager: Gt,
114
- description: Vt,
115
- author: qt,
116
- license: Yt,
117
- keywords: Jt,
118
- sideEffects: Qt,
119
- exports: Kt,
120
- main: Xt,
121
- module: Zt,
122
- types: er,
123
- files: tr,
124
- publishConfig: rr,
125
- scripts: nr,
126
- peerDependencies: or,
127
- dependencies: sr,
128
- devDependencies: ir
129
- }, lr = ({ sizes: e }) => {
109
+ }, ur = {
110
+ name: zt,
111
+ type: Gt,
112
+ version: Vt,
113
+ packageManager: qt,
114
+ description: Yt,
115
+ author: Jt,
116
+ license: Qt,
117
+ keywords: Kt,
118
+ sideEffects: Xt,
119
+ exports: Zt,
120
+ main: er,
121
+ module: tr,
122
+ types: rr,
123
+ files: nr,
124
+ publishConfig: or,
125
+ scripts: sr,
126
+ peerDependencies: ir,
127
+ dependencies: ar,
128
+ devDependencies: lr
129
+ }, cr = ({ sizes: e }) => {
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 gt ? 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(() => {
144
144
  e.aspectRatio.value && t.value.forEach((r) => {
145
- !r.manual && (r instanceof fe || ur(r)) && (r instanceof fe ? r.aspect = e.aspectRatio.value : (r.left = e.width.value * -0.5, r.right = e.width.value * 0.5, r.top = e.height.value * 0.5, r.bottom = e.height.value * -0.5), r.updateProjectionMatrix());
145
+ !r.manual && (r instanceof fe || fr(r)) && (r instanceof fe ? r.aspect = e.aspectRatio.value : (r.left = e.width.value * -0.5, r.right = e.width.value * 0.5, r.top = e.height.value * 0.5, r.bottom = e.height.value * -0.5), r.updateProjectionMatrix());
146
146
  });
147
147
  }), N(() => {
148
148
  t.value = [];
@@ -150,32 +150,33 @@ 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
  };
157
- function ur(e) {
157
+ function fr(e) {
158
158
  return e.hasOwnProperty("isOrthographicCamera") && e.isOrthographicCamera;
159
159
  }
160
- const qe = x(), Ye = x(), he = x(), q = new We();
160
+ const Je = x(), Qe = x(), he = x(), q = new ze();
161
161
  let ne = 0, oe = 0;
162
- const { pause: cr, resume: fr, isActive: dr } = Ve(
162
+ const { pause: dr, resume: De, isActive: pr } = Ye(
163
163
  () => {
164
- qe.trigger({ delta: ne, elapsed: oe, clock: q }), Ye.trigger({ delta: ne, elapsed: oe, clock: q }), he.trigger({ delta: ne, elapsed: oe, clock: q });
164
+ Je.trigger({ delta: ne, elapsed: oe, clock: q }), Qe.trigger({ delta: ne, elapsed: oe, clock: q }), he.trigger({ delta: ne, elapsed: oe, clock: q });
165
165
  },
166
166
  { immediate: !1 }
167
167
  );
168
168
  he.on(() => {
169
169
  ne = q.getDelta(), oe = q.getElapsedTime();
170
170
  });
171
- const ln = () => ({
172
- onBeforeLoop: qe.on,
173
- onLoop: Ye.on,
171
+ let Be = !1;
172
+ const un = () => (Be || (Be = !0, De()), {
173
+ onBeforeLoop: Je.on,
174
+ onLoop: Qe.on,
174
175
  onAfterLoop: he.on,
175
- pause: cr,
176
- resume: fr,
177
- isActive: dr
178
- }), un = !0, K = "[TresJS ▲ ■ ●] ";
176
+ pause: dr,
177
+ resume: De,
178
+ isActive: pr
179
+ }), cn = !0, K = "[TresJS ▲ ■ ●] ";
179
180
  function $() {
180
181
  function e(...o) {
181
182
  typeof o[0] == "string" ? o[0] = K + o[0] : o.unshift(K), console.error(...o);
@@ -191,13 +192,13 @@ function $() {
191
192
  logMessage: n
192
193
  };
193
194
  }
194
- function cn(e) {
195
+ function fn(e) {
195
196
  return typeof e == "number" ? [e, e, e] : e instanceof ge ? [e.x, e.y, e.z] : e;
196
197
  }
197
- function pr(e) {
198
+ function mr(e) {
198
199
  return e instanceof re ? e : Array.isArray(e) ? new re(...e) : new re(e);
199
200
  }
200
- class mr extends Fe.Mesh {
201
+ class vr extends Ne.Mesh {
201
202
  constructor(...n) {
202
203
  super(...n);
203
204
  se(this, "type", "HightlightMesh");
@@ -209,47 +210,47 @@ class mr extends Fe.Mesh {
209
210
  this.scale.set(r, r, r);
210
211
  }
211
212
  }
212
- const Je = (e, t) => {
213
+ const Ke = (e, t) => {
213
214
  for (const n of Object.keys(t))
214
- t[n] instanceof Object && Object.assign(t[n], Je(e[n], t[n]));
215
+ t[n] instanceof Object && Object.assign(t[n], Ke(e[n], t[n]));
215
216
  return Object.assign(e || {}, t), e;
216
- }, vr = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot", gr = /* @__PURE__ */ br(vr);
217
- function De(e) {
217
+ }, gr = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot", hr = /* @__PURE__ */ wr(gr);
218
+ function Re(e) {
218
219
  return e && e.nodeType === 1;
219
220
  }
220
221
  function X(e) {
221
222
  return e.replace(/-([a-z])/g, (t, n) => n.toUpperCase());
222
223
  }
223
- const hr = /\B([A-Z])/g;
224
- function yr(e) {
225
- return e.replace(hr, "-$1").toLowerCase();
224
+ const yr = /\B([A-Z])/g;
225
+ function br(e) {
226
+ return e.replace(yr, "-$1").toLowerCase();
226
227
  }
227
- function br(e, t) {
228
+ function wr(e, t) {
228
229
  const n = /* @__PURE__ */ Object.create(null), o = e.split(",");
229
230
  for (let i = 0; i < o.length; i++)
230
231
  n[o[i]] = !0;
231
232
  return (i) => !!n[i];
232
233
  }
233
- const wr = (e, t) => {
234
+ const Mr = (e, t) => {
234
235
  const n = /* @__PURE__ */ new Set(), o = [];
235
236
  for (const i of e) {
236
- const a = t(i);
237
- n.has(a) || (n.add(a), o.push(i));
237
+ const l = t(i);
238
+ n.has(l) || (n.add(l), o.push(i));
238
239
  }
239
240
  return o;
240
- }, Be = (e, t) => {
241
+ }, je = (e, t) => {
241
242
  if (!t)
242
243
  return;
243
244
  const n = Array.isArray(t) ? t : t.match(/([^[.\]])+/g);
244
245
  return n == null ? void 0 : n.reduce((o, i) => o && o[i], e);
245
- }, Mr = (e, t, n) => {
246
+ }, Pr = (e, t, n) => {
246
247
  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);
248
+ o && o.reduce((i, l, r) => (i[l] === void 0 && (i[l] = {}), r === o.length - 1 && (i[l] = n), i[l]), e);
248
249
  };
249
- function Qe(e, t) {
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);
250
+ function Xe(e, t) {
251
+ if (Re(e) && Re(t)) {
252
+ const i = e.attributes, l = t.attributes;
253
+ return i.length !== l.length ? !1 : Array.from(i).every(({ name: r, value: s }) => t.getAttribute(r) === s);
253
254
  }
254
255
  if (e === t)
255
256
  return !0;
@@ -259,34 +260,34 @@ function Qe(e, t) {
259
260
  if (n.length !== o.length)
260
261
  return !1;
261
262
  for (const i of n)
262
- if (!o.includes(i) || !Qe(e[i], t[i]))
263
+ if (!o.includes(i) || !Xe(e[i], t[i]))
263
264
  return !1;
264
265
  return !0;
265
266
  }
266
- function Pr(e, t) {
267
+ function Cr(e, t) {
267
268
  if (!Array.isArray(e) || !Array.isArray(t) || e.length !== t.length)
268
269
  return !1;
269
270
  for (let n = 0; n < e.length; n++)
270
- if (!Qe(e[n], t[n]))
271
+ if (!Xe(e[n], t[n]))
271
272
  return !1;
272
273
  return !0;
273
274
  }
274
- const Cr = Array.isArray;
275
- function _r(e, t, n, o) {
275
+ const _r = Array.isArray;
276
+ function Er(e, t, n, o) {
276
277
  const i = (u) => {
277
278
  if (u.uuid === t)
278
279
  return u;
279
- for (const l of u.children) {
280
- const y = i(l);
280
+ for (const a of u.children) {
281
+ const y = i(a);
281
282
  if (y)
282
283
  return y;
283
284
  }
284
- }, a = i(e);
285
- if (!a) {
285
+ }, l = i(e);
286
+ if (!l) {
286
287
  console.warn("Object with UUID not found in the scene.");
287
288
  return;
288
289
  }
289
- let r = a;
290
+ let r = l;
290
291
  for (let u = 0; u < n.length - 1; u++)
291
292
  if (r[n[u]] !== void 0)
292
293
  r = r[n[u]];
@@ -297,63 +298,63 @@ function _r(e, t, n, o) {
297
298
  const s = n[n.length - 1];
298
299
  r[s] !== void 0 ? r[s] = o : console.warn(`Property path is not valid: ${n.join(".")}`);
299
300
  }
300
- function Er(e) {
301
- const t = new ze({
301
+ function kr(e) {
302
+ const t = new Ve({
302
303
  color: 11003607,
303
304
  // Highlight color, e.g., yellow
304
305
  transparent: !0,
305
306
  opacity: 0.2,
306
307
  depthTest: !1,
307
308
  // So the highlight is always visible
308
- side: vt
309
+ side: ht
309
310
  // To e
310
311
  });
311
- return new mr(e.geometry.clone(), t);
312
+ return new vr(e.geometry.clone(), t);
312
313
  }
313
- function kr(e) {
314
+ function Sr(e) {
314
315
  var n;
315
316
  let t = e.value;
316
317
  return e.value && ((n = e.value) != null && n.isMesh) && (t = e.value.position), Array.isArray(e.value) && (t = new ge(...t)), t;
317
318
  }
318
- function Sr(e) {
319
+ function xr(e) {
319
320
  return "map" in e;
320
321
  }
321
- function Re(e) {
322
- Sr(e) && e.map && e.map.dispose(), e.dispose();
322
+ function Ie(e) {
323
+ xr(e) && e.map && e.map.dispose(), e.dispose();
323
324
  }
324
325
  function ye(e) {
325
326
  var n, o;
326
- if (e.parent && ((n = e.removeFromParent) == null || n.call(e)), delete e.__tres, [...e.children].forEach((i) => ye(i)), !(e instanceof Ne)) {
327
+ if (e.parent && ((n = e.removeFromParent) == null || n.call(e)), delete e.__tres, [...e.children].forEach((i) => ye(i)), !(e instanceof Ge)) {
327
328
  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);
329
+ e && ((o = e.dispose) == null || o.call(e)), i.geometry && (i.geometry.dispose(), delete i.geometry), Array.isArray(i.material) ? (i.material.forEach((l) => Ie(l)), delete i.material) : i.material && (Ie(i.material), delete i.material);
329
330
  }
330
331
  }
331
- const xr = Number.parseInt(gt.replace("dev", "")), Z = {
332
+ const Tr = Number.parseInt(yt.replace("dev", "")), Z = {
332
333
  realistic: {
333
334
  shadows: !0,
334
335
  physicallyCorrectLights: !0,
335
- outputColorSpace: ht,
336
- toneMapping: Ge,
336
+ outputColorSpace: bt,
337
+ toneMapping: qe,
337
338
  toneMappingExposure: 3,
338
339
  shadowMap: {
339
340
  enabled: !0,
340
- type: yt
341
+ type: wt
341
342
  }
342
343
  },
343
344
  flat: {
344
- toneMapping: bt,
345
+ toneMapping: Mt,
345
346
  toneMappingExposure: 1
346
347
  }
347
348
  };
348
- function Tr({
349
+ function Ar({
349
350
  canvas: e,
350
351
  options: t,
351
- contextParts: { sizes: n, render: o, invalidate: i, advance: a }
352
+ contextParts: { sizes: n, render: o, invalidate: i, advance: l }
352
353
  }) {
353
354
  const r = B(() => ({
354
355
  alpha: k(t.alpha) ?? !0,
355
356
  depth: k(t.depth),
356
- canvas: Dt(e),
357
+ canvas: Rt(e),
357
358
  context: k(t.context),
358
359
  stencil: k(t.stencil),
359
360
  antialias: k(t.antialias) ?? !0,
@@ -374,9 +375,9 @@ function Tr({
374
375
  }, {
375
376
  immediate: !0
376
377
  }), V(() => t.clearColor, u);
377
- const { pixelRatio: l } = Bt();
378
- V(l, () => {
379
- s.value.setPixelRatio(l.value);
378
+ const { pixelRatio: a } = jt();
379
+ V(a, () => {
380
+ s.value.setPixelRatio(a.value);
380
381
  });
381
382
  const { logError: y } = $(), p = (() => {
382
383
  const f = new ie(), b = {
@@ -389,26 +390,26 @@ function Tr({
389
390
  outputColorSpace: f.outputColorSpace
390
391
  };
391
392
  return f.dispose(), b;
392
- })(), M = k(t.renderMode);
393
- return M === "on-demand" && i(), M === "manual" && setTimeout(() => {
394
- a();
395
- }, 1), ve(() => {
393
+ })(), P = k(t.renderMode);
394
+ return P === "on-demand" && i(), P === "manual" && setTimeout(() => {
395
+ l();
396
+ }, 100), ve(() => {
396
397
  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));
398
+ f && (f in Z || y(`Renderer Preset must be one of these: ${Object.keys(Z).join(", ")}`), Ke(s.value, Z[f])), P === "always" && (o.frames.value = Math.max(1, o.frames.value));
398
399
  const b = (v, h) => {
399
400
  const _ = k(v), g = () => {
400
401
  if (f)
401
- return Be(Z[f], h);
402
+ return je(Z[f], h);
402
403
  };
403
404
  if (_ !== void 0)
404
405
  return _;
405
- const P = g();
406
- return P !== void 0 ? P : Be(p, h);
407
- }, m = (v, h) => Mr(s.value, h, b(v, h));
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");
406
+ const M = g();
407
+ return M !== void 0 ? M : je(p, h);
408
+ }, m = (v, h) => Pr(s.value, h, b(v, h));
409
+ m(t.shadows, "shadowMap.enabled"), m(t.toneMapping ?? qe, "toneMapping"), m(t.shadowMapType, "shadowMap.type"), Tr < 150 && m(!t.useLegacyLights, "physicallyCorrectLights"), m(t.outputColorSpace, "outputColorSpace"), m(t.toneMappingExposure, "toneMappingExposure");
409
410
  const w = b(t.clearColor, "clearColor");
410
411
  w && s.value.setClearColor(
411
- w ? pr(w) : new re(0)
412
+ w ? mr(w) : new re(0)
412
413
  // default clear color is not easily/efficiently retrievable from three
413
414
  );
414
415
  }), N(() => {
@@ -417,87 +418,87 @@ function Tr({
417
418
  renderer: s
418
419
  };
419
420
  }
420
- const ee = (e) => typeof e == "function", Ar = (e) => !!e && e.constructor === Array;
421
- function Or(e) {
421
+ const ee = (e) => typeof e == "function", Or = (e) => !!e && e.constructor === Array;
422
+ function Lr(e) {
422
423
  const t = { nodes: {}, materials: {} };
423
424
  return e && e.traverse((n) => {
424
425
  n.name && (t.nodes[n.name] = n), n.material && !t.materials[n.material.name] && (t.materials[n.material.name] = n.material);
425
426
  }), t;
426
427
  }
427
- async function fn(e, t, n, o, i) {
428
- const { logError: a } = $(), r = new e();
428
+ async function dn(e, t, n, o, i) {
429
+ const { logError: l } = $(), r = new e();
429
430
  i && i(r), n && n(r);
430
431
  const u = (Array.isArray(t) ? t : [t]).map(
431
- (l) => new Promise((y, c) => {
432
+ (a) => new Promise((y, c) => {
432
433
  r.load(
433
- l,
434
+ a,
434
435
  (p) => {
435
- p.scene && Object.assign(p, Or(p.scene)), y(p);
436
+ p.scene && Object.assign(p, Lr(p.scene)), y(p);
436
437
  },
437
438
  o,
438
- (p) => c(a("[useLoader] - Failed to load resource", p))
439
+ (p) => c(l("[useLoader] - Failed to load resource", p))
439
440
  );
440
441
  })
441
442
  );
442
- return Ar(t) ? await Promise.all(u) : await u[0];
443
+ return Or(t) ? await Promise.all(u) : await u[0];
443
444
  }
444
- async function dn(e, t) {
445
- const n = new wt(t), o = (i) => new Promise((a, r) => {
445
+ async function pn(e, t) {
446
+ const n = new Pt(t), o = (i) => new Promise((l, r) => {
446
447
  n.load(
447
448
  i,
448
- (s) => a(s),
449
+ (s) => l(s),
449
450
  () => null,
450
451
  () => {
451
452
  r(new Error("[useTextures] - Failed to load texture"));
452
453
  }
453
454
  );
454
455
  });
455
- if (Cr(e)) {
456
- const i = await Promise.all(e.map((a) => o(a)));
456
+ if (_r(e)) {
457
+ const i = await Promise.all(e.map((l) => o(l)));
457
458
  return e.length > 1 ? i : i[0];
458
459
  } else {
459
460
  const {
460
461
  map: i,
461
- displacementMap: a,
462
+ displacementMap: l,
462
463
  normalMap: r,
463
464
  roughnessMap: s,
464
465
  metalnessMap: u,
465
- aoMap: l,
466
+ aoMap: a,
466
467
  alphaMap: y,
467
468
  matcap: c
468
469
  } = e;
469
470
  return {
470
471
  map: i ? await o(i) : null,
471
- displacementMap: a ? await o(a) : null,
472
+ displacementMap: l ? await o(l) : null,
472
473
  normalMap: r ? await o(r) : null,
473
474
  roughnessMap: s ? await o(s) : null,
474
475
  metalnessMap: u ? await o(u) : null,
475
- aoMap: l ? await o(l) : null,
476
+ aoMap: a ? await o(a) : null,
476
477
  alphaMap: y ? await o(y) : null,
477
478
  matcap: c ? await o(c) : null
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 Ze = (e, t) => {
483
+ const n = B(() => t.renderer.value.domElement), o = U([]), { x: i, y: l } = It({ target: n });
483
484
  let r = 0;
484
- const { width: s, height: u, top: l, left: y } = jt(n), c = ({ x: d, y: E }) => {
485
+ const { width: s, height: u, top: a, left: y } = Ht(n), c = ({ x: d, y: E }) => {
485
486
  if (n.value)
486
487
  return {
487
488
  x: (d - y.value) / s.value * 2 - 1,
488
- y: -((E - l.value) / u.value) * 2 + 1
489
+ y: -((E - a.value) / u.value) * 2 + 1
489
490
  };
490
491
  }, p = ({ x: d, y: E }) => {
491
492
  if (t.camera.value)
492
493
  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) => {
494
+ }, P = (d) => {
494
495
  const E = c({
495
496
  x: (d == null ? void 0 : d.clientX) ?? i.value,
496
- y: (d == null ? void 0 : d.clientY) ?? a.value
497
+ y: (d == null ? void 0 : d.clientY) ?? l.value
497
498
  });
498
499
  return E ? p(E) || [] : [];
499
500
  }, f = x(), b = x(), m = x(), w = x(), v = x(), h = x(), _ = x(), g = x();
500
- function P(d) {
501
+ function M(d) {
501
502
  const E = {};
502
503
  for (const I in d)
503
504
  typeof I != "function" && (E[I] = d[I]);
@@ -505,7 +506,7 @@ const Ke = (e, t) => {
505
506
  }
506
507
  const C = (d, E) => {
507
508
  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);
509
+ 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
510
  d.trigger({
510
511
  ...I,
511
512
  intersections: o.value,
@@ -520,7 +521,7 @@ const Ke = (e, t) => {
520
521
  };
521
522
  let R;
522
523
  const O = (d) => {
523
- M(d), C(m, d), R = d;
524
+ P(d), C(m, d), R = d;
524
525
  }, T = () => {
525
526
  R && O(R);
526
527
  };
@@ -529,7 +530,7 @@ const Ke = (e, t) => {
529
530
  var E;
530
531
  S = (E = o.value[0]) == null ? void 0 : E.object, r = 0, j = new ae(
531
532
  (d == null ? void 0 : d.clientX) ?? i.value,
532
- (d == null ? void 0 : d.clientY) ?? a.value
533
+ (d == null ? void 0 : d.clientY) ?? l.value
533
534
  ), C(v, d);
534
535
  };
535
536
  let z, J = !1;
@@ -537,7 +538,7 @@ const Ke = (e, t) => {
537
538
  var E, I, Q;
538
539
  d instanceof PointerEvent && (o.value.length === 0 && C(h, d), S === ((E = o.value[0]) == null ? void 0 : E.object) && (L = new ae(
539
540
  (d == null ? void 0 : d.clientX) ?? i.value,
540
- (d == null ? void 0 : d.clientY) ?? a.value
541
+ (d == null ? void 0 : d.clientY) ?? l.value
541
542
  ), 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
543
  }, Me = (d) => {
543
544
  J && (C(b, d), z = void 0, J = !1);
@@ -557,25 +558,25 @@ const Ke = (e, t) => {
557
558
  forceUpdate: T
558
559
  };
559
560
  };
560
- function pn() {
561
+ function mn() {
561
562
  const { logWarning: e } = $();
562
- function t(a, r, s) {
563
+ function t(l, r, s) {
563
564
  let u = null;
564
- return a.traverse((l) => {
565
- l[r] === s && (u = l);
565
+ return l.traverse((a) => {
566
+ a[r] === s && (u = a);
566
567
  }), u || e(`Child with ${r} '${s}' not found.`), u;
567
568
  }
568
- function n(a, r, s) {
569
+ function n(l, r, s) {
569
570
  const u = [];
570
- return a.traverse((l) => {
571
- l[r].includes(s) && u.push(l);
571
+ return l.traverse((a) => {
572
+ a[r].includes(s) && u.push(a);
572
573
  }), u.length || e(`Children with ${r} '${s}' not found.`), u;
573
574
  }
574
- function o(a, r) {
575
- return t(a, "name", r);
575
+ function o(l, r) {
576
+ return t(l, "name", r);
576
577
  }
577
- function i(a, r) {
578
- return n(a, "name", r);
578
+ function i(l, r) {
579
+ return n(l, "name", r);
579
580
  }
580
581
  return {
581
582
  seek: t,
@@ -584,8 +585,8 @@ function pn() {
584
585
  seekAllByName: i
585
586
  };
586
587
  }
587
- const mn = (e) => {
588
- const t = $e({
588
+ const vn = (e) => {
589
+ const t = We({
589
590
  click: /* @__PURE__ */ new Map(),
590
591
  pointerMove: /* @__PURE__ */ new Map(),
591
592
  pointerEnter: /* @__PURE__ */ new Map(),
@@ -594,13 +595,13 @@ const mn = (e) => {
594
595
  n.value.add(c);
595
596
  }, i = (c) => {
596
597
  n.value.delete(c);
597
- }, a = (c) => {
598
+ }, l = (c) => {
598
599
  Object.values(t).forEach((p) => p.delete(c)), i(c);
599
600
  }, 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);
601
+ const { onClick: p, onPointerMove: P, onPointerEnter: f, onPointerLeave: b } = c;
602
+ 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
603
  }, s = B(
603
- () => wr(
604
+ () => Mr(
604
605
  [
605
606
  ...Array.from(n.value),
606
607
  ...Object.values(t).map((c) => Array.from(c.keys())).flat()
@@ -608,20 +609,20 @@ const mn = (e) => {
608
609
  ({ uuid: c }) => c
609
610
  )
610
611
  );
611
- e.registerObjectAtPointerEventHandler = r, e.deregisterObjectAtPointerEventHandler = a, e.registerBlockingObjectAtPointerEventHandler = o, e.deregisterBlockingObjectAtPointerEventHandler = i;
612
- const { onClick: u, onPointerMove: l } = Ke(s, e);
612
+ e.registerObjectAtPointerEventHandler = r, e.deregisterObjectAtPointerEventHandler = l, e.registerBlockingObjectAtPointerEventHandler = o, e.deregisterBlockingObjectAtPointerEventHandler = i;
613
+ const { onClick: u, onPointerMove: a } = Ze(s, e);
613
614
  u(({ intersects: c, event: p }) => {
614
- var M;
615
- c.length && ((M = t.click.get(c[0].object)) == null || M(c[0], p));
615
+ var P;
616
+ c.length && ((P = t.click.get(c[0].object)) == null || P(c[0], p));
616
617
  });
617
618
  let y;
618
- return l(({ intersects: c, event: p }) => {
619
+ return a(({ intersects: c, event: p }) => {
619
620
  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;
621
+ const P = (w = c == null ? void 0 : c[0]) == null ? void 0 : w.object, { pointerLeave: f, pointerEnter: b, pointerMove: m } = t;
622
+ 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
623
  }), {
623
624
  registerObject: r,
624
- deregisterObject: a,
625
+ deregisterObject: l,
625
626
  registerBlockingObject: o,
626
627
  deregisterBlockingObject: i
627
628
  };
@@ -630,19 +631,19 @@ function be(e) {
630
631
  let t = 0;
631
632
  return e.traverse((n) => {
632
633
  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;
634
+ 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
635
  t += u;
635
636
  }
636
637
  }), t;
637
638
  }
638
- function Lr(e) {
639
+ function Dr(e) {
639
640
  return (e / 1024).toFixed(2);
640
641
  }
641
642
  const de = A({}), pe = (e) => Object.assign(de.value, e);
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
+ function Br(e, t, n = 10) {
644
+ const o = k(e) ? Ut() : $t(B(() => k(t).parentElement)), i = ue(Le(o.width, n)), l = ue(Le(o.height, n)), r = B(() => i.value / l.value);
644
645
  return {
645
- height: a,
646
+ height: l,
646
647
  width: i,
647
648
  aspectRatio: r
648
649
  };
@@ -651,44 +652,44 @@ function le() {
651
652
  const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set();
652
653
  let n = 0, o = !1;
653
654
  const i = () => {
654
- const l = Array.from(e.entries()).sort((y, c) => {
655
+ const a = Array.from(e.entries()).sort((y, c) => {
655
656
  const p = y[1].priority - c[1].priority;
656
657
  return p === 0 ? y[1].addI - c[1].addI : p;
657
658
  });
658
- t.clear(), l.forEach((y) => t.add(y[0]));
659
- }, a = (l) => {
660
- e.delete(l), t.delete(l);
659
+ t.clear(), a.forEach((y) => t.add(y[0]));
660
+ }, l = (a) => {
661
+ e.delete(a), t.delete(a);
661
662
  };
662
- return { on: (l, y = 0) => {
663
- e.set(l, { priority: y, addI: n++ });
664
- const c = () => a(l);
665
- return Ut(c), o = !0, {
663
+ return { on: (a, y = 0) => {
664
+ e.set(a, { priority: y, addI: n++ });
665
+ const c = () => l(a);
666
+ return Ft(c), o = !0, {
666
667
  off: c
667
668
  };
668
- }, off: a, trigger: (...l) => {
669
- o && (i(), o = !1), t.forEach((y) => y(...l));
669
+ }, off: l, trigger: (...a) => {
670
+ o && (i(), o = !1), t.forEach((y) => y(...a));
670
671
  }, dispose: () => {
671
672
  e.clear(), t.clear();
672
673
  }, get count() {
673
674
  return e.size;
674
675
  } };
675
676
  }
676
- function Br() {
677
- const e = new We(!1), t = A(!1), n = A(!1);
677
+ function Rr() {
678
+ const e = new ze(!1), t = A(!1), n = A(!1);
678
679
  let o;
679
- const i = Mt.generateUUID();
680
- let a = null;
680
+ const i = Ct.generateUUID();
681
+ let l = null;
681
682
  const r = le(), s = le(), u = le();
682
- let l = {};
683
+ let a = {};
683
684
  function y(h) {
684
- l = h;
685
+ a = h;
685
686
  }
686
687
  function c(h, _, g = 0) {
687
688
  switch (_) {
688
689
  case "before":
689
690
  return r.on(h, g);
690
691
  case "render":
691
- return a || (a = h), s.dispose(), s.on(h);
692
+ return l || (l = h), s.dispose(), s.on(h);
692
693
  case "after":
693
694
  return u.on(h, g);
694
695
  }
@@ -696,7 +697,7 @@ function Br() {
696
697
  function p() {
697
698
  t.value || (e.start(), t.value = !0, v());
698
699
  }
699
- function M() {
700
+ function P() {
700
701
  t.value && (e.stop(), cancelAnimationFrame(o), t.value = !1);
701
702
  }
702
703
  function f() {
@@ -712,14 +713,22 @@ function Br() {
712
713
  n.value = !1;
713
714
  }
714
715
  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);
716
+ const h = e.getDelta(), _ = e.getElapsedTime(), g = {
717
+ camera: W(a.camera),
718
+ scene: W(a.scene),
719
+ renderer: W(a.renderer),
720
+ raycaster: W(a.raycaster),
721
+ controls: W(a.controls),
722
+ invalidate: a.invalidate,
723
+ advance: a.advance
724
+ }, M = { delta: h, elapsed: _, clock: e, ...g };
725
+ t.value && r.trigger(M), n.value || (s.count ? s.trigger(M) : l && l(M)), t.value && u.trigger(M), o = requestAnimationFrame(v);
717
726
  }
718
727
  return {
719
728
  loopId: i,
720
729
  register: (h, _, g) => c(h, _, g),
721
730
  start: p,
722
- stop: M,
731
+ stop: P,
723
732
  pause: f,
724
733
  resume: b,
725
734
  pauseRender: m,
@@ -729,21 +738,21 @@ function Br() {
729
738
  setContext: y
730
739
  };
731
740
  }
732
- function Rr({
741
+ function jr({
733
742
  scene: e,
734
743
  canvas: t,
735
744
  windowSize: n,
736
745
  disableRender: o,
737
746
  rendererOptions: i,
738
- emit: a
747
+ emit: l
739
748
  }) {
740
- const { logWarning: r } = $(), s = U(e), u = Dr(n, t), {
741
- camera: l,
749
+ const { logWarning: r } = $(), s = U(e), u = Br(n, t), {
750
+ camera: a,
742
751
  cameras: y,
743
752
  registerCamera: c,
744
753
  deregisterCamera: p,
745
- setCameraActive: M
746
- } = lr({ sizes: u, scene: e }), f = {
754
+ setCameraActive: P
755
+ } = cr({ sizes: u, scene: e }), f = {
747
756
  mode: A(i.renderMode || "always"),
748
757
  priority: A(0),
749
758
  frames: A(0),
@@ -756,23 +765,23 @@ function Rr({
756
765
  function m() {
757
766
  i.renderMode === "manual" ? f.frames.value = 1 : r("`advance` can only be used when `renderMode` is set to `manual`");
758
767
  }
759
- const { renderer: w } = Tr(
768
+ const { renderer: w } = Ar(
760
769
  {
761
770
  scene: e,
762
771
  canvas: t,
763
772
  options: i,
764
- emit: a,
773
+ emit: l,
765
774
  // 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 },
775
+ contextParts: { sizes: u, camera: a, render: f, invalidate: b, advance: m },
767
776
  disableRender: o
768
777
  }
769
778
  ), v = {
770
779
  sizes: u,
771
780
  scene: s,
772
- camera: l,
781
+ camera: a,
773
782
  cameras: ue(y),
774
783
  renderer: w,
775
- raycaster: U(new Pt()),
784
+ raycaster: U(new _t()),
776
785
  controls: A(null),
777
786
  perf: {
778
787
  maxFrames: 160,
@@ -791,61 +800,61 @@ function Rr({
791
800
  extend: pe,
792
801
  invalidate: b,
793
802
  registerCamera: c,
794
- setCameraActive: M,
803
+ setCameraActive: P,
795
804
  deregisterCamera: p,
796
- loop: Br()
805
+ loop: Rr()
797
806
  };
798
807
  ce("useTres", v), v.scene.value.__tres = {
799
808
  root: v
800
809
  }, 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);
810
+ 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
811
  }, "render"), v.loop.start(), N(() => {
803
812
  v.loop.stop();
804
813
  });
805
- const h = 100, _ = $t({ every: h }), { isSupported: g, memory: P } = Ft({ interval: h }), C = 160;
814
+ const h = 100, _ = Wt({ every: h }), { isSupported: g, memory: M } = Nt({ interval: h }), C = 160;
806
815
  let R = performance.now();
807
816
  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));
817
+ 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
818
  };
810
819
  let T = 0;
811
- const S = 1, { pause: j } = Ve(({ delta: L }) => {
820
+ const S = 1, { pause: j } = Ye(({ delta: L }) => {
812
821
  window.__TRES__DEVTOOLS__ && (O({ timestamp: performance.now() }), T += L, T >= S && (window.__TRES__DEVTOOLS__.cb(v), T = 0));
813
822
  }, { immediate: !0 });
814
823
  return N(() => {
815
824
  j();
816
825
  }), v;
817
826
  }
818
- function Xe() {
819
- const e = st("useTres");
827
+ function et() {
828
+ const e = at("useTres");
820
829
  if (!e)
821
830
  throw new Error("useTresContext must be used together with useTresContextProvider");
822
831
  return e;
823
832
  }
824
- const vn = Xe;
825
- function gn() {
833
+ const gn = et;
834
+ function hn() {
826
835
  const {
827
836
  camera: e,
828
837
  scene: t,
829
838
  renderer: n,
830
839
  loop: o,
831
840
  raycaster: i,
832
- controls: a,
841
+ controls: l,
833
842
  invalidate: r,
834
843
  advance: s
835
- } = Xe();
844
+ } = et();
836
845
  o.setContext({
837
- camera: W(e),
838
- scene: W(t),
839
- renderer: W(n),
840
- raycaster: W(i),
841
- controls: W(a),
846
+ camera: e,
847
+ scene: t,
848
+ renderer: n,
849
+ raycaster: i,
850
+ controls: l,
842
851
  invalidate: r,
843
852
  advance: s
844
853
  });
845
854
  function u(c, p = 0) {
846
855
  return o.register(c, "before", p);
847
856
  }
848
- function l(c) {
857
+ function a(c) {
849
858
  return o.register(c, "render");
850
859
  }
851
860
  function y(c, p = 0) {
@@ -858,63 +867,63 @@ function gn() {
858
867
  resumeRender: o.resumeRender,
859
868
  isActive: o.isActive,
860
869
  onBeforeRender: u,
861
- render: l,
870
+ render: a,
862
871
  onAfterRender: y
863
872
  };
864
873
  }
865
- function jr(e, t, n) {
874
+ function Ir(e, t, n) {
866
875
  const o = U(), i = U();
867
876
  e && (o.value = e), t && (i.value = t);
868
- const a = B(
877
+ const l = B(
869
878
  () => o.value ? o.value.children : []
870
879
  );
871
- function r(g, P) {
880
+ function r(g, M) {
872
881
  if (Array.isArray(g))
873
882
  for (const C of g)
874
- C(P);
875
- typeof g == "function" && g(P);
883
+ C(M);
884
+ typeof g == "function" && g(M);
876
885
  }
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)
886
+ function s(g, M) {
887
+ const C = [], R = () => M.stopPropagating = !0;
888
+ M.stopPropagation = R;
889
+ for (const O of M == null ? void 0 : M.intersections) {
890
+ if (M.stopPropagating)
882
891
  return;
883
- P = { ...P, ...O };
892
+ M = { ...M, ...O };
884
893
  const { object: T } = O;
885
- P.eventObject = T, r(T[g], P), C.push(T);
894
+ M.eventObject = T, r(T[g], M), C.push(T);
886
895
  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;
889
- const j = yr(g.slice(2));
890
- n(j, { intersection: O, event: P });
896
+ for (; S !== null && !M.stopPropagating && !C.includes(S); )
897
+ M.eventObject = S, r(S[g], M), C.push(S), S = S.parent;
898
+ const j = br(g.slice(2));
899
+ n(j, { intersection: O, event: M });
891
900
  }
892
901
  }
893
902
  const {
894
903
  onClick: u,
895
- onDblClick: l,
904
+ onDblClick: a,
896
905
  onContextMenu: y,
897
906
  onPointerMove: c,
898
907
  onPointerDown: p,
899
- onPointerUp: M,
908
+ onPointerUp: P,
900
909
  onPointerMissed: f,
901
910
  onWheel: b,
902
911
  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));
912
+ } = Ze(l, t);
913
+ 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
914
  let w = [];
906
915
  c((g) => {
907
- const P = g.intersections.map(({ object: C }) => C);
916
+ const M = g.intersections.map(({ object: C }) => C);
908
917
  w.forEach((C) => {
909
- P.includes(C) || (s("onPointerLeave", g), s("onPointerOut", g));
918
+ M.includes(C) || (s("onPointerLeave", g), s("onPointerOut", g));
910
919
  }), g.intersections.forEach(({ object: C }) => {
911
920
  w.includes(C) || (s("onPointerEnter", g), s("onPointerOver", g));
912
- }), s("onPointerMove", g), w = P;
921
+ }), s("onPointerMove", g), w = M;
913
922
  });
914
923
  const v = [];
915
924
  f((g) => {
916
- const P = () => g.stopPropagating = !0;
917
- g.stopPropagation = P, v.forEach((C) => {
925
+ const M = () => g.stopPropagating = !0;
926
+ g.stopPropagation = M, v.forEach((C) => {
918
927
  g.stopPropagating || (g.eventObject = C, r(C.onPointerMissed, g));
919
928
  }), n("pointer-missed", { event: g });
920
929
  });
@@ -922,8 +931,8 @@ function jr(e, t, n) {
922
931
  v.push(g);
923
932
  }
924
933
  function _(g) {
925
- const P = v.indexOf(g);
926
- P > -1 && v.splice(P, 1);
934
+ const M = v.indexOf(g);
935
+ M > -1 && v.splice(M, 1);
927
936
  }
928
937
  return t.eventManager = {
929
938
  forceUpdate: m,
@@ -931,7 +940,7 @@ function jr(e, t, n) {
931
940
  deregisterPointerMissedObject: _
932
941
  }, { forceUpdate: m, registerPointerMissedObject: h, deregisterPointerMissedObject: _ };
933
942
  }
934
- const { logError: je } = $(), Ir = [
943
+ const { logError: He } = $(), Hr = [
935
944
  "onClick",
936
945
  "onContextMenu",
937
946
  "onPointerMove",
@@ -947,50 +956,50 @@ const { logError: je } = $(), Ir = [
947
956
  "onLostPointerCapture",
948
957
  "onWheel"
949
958
  ];
950
- function Ie(e) {
959
+ function Ue(e) {
951
960
  var n;
952
961
  const t = (n = e == null ? void 0 : e.__tres) == null ? void 0 : n.root;
953
962
  t && t.render && t.render.canBeInvalidated.value && t.invalidate();
954
963
  }
955
- const Hr = () => {
964
+ const Ur = () => {
956
965
  let e = null;
957
- function t(r, s, u, l) {
958
- if (l || (l = {}), l.args || (l.args = []), r === "template" || gr(r))
966
+ function t(r, s, u, a) {
967
+ if (a || (a = {}), a.args || (a.args = []), r === "template" || hr(r))
959
968
  return null;
960
969
  let y = r.replace("Tres", ""), c;
961
970
  if (r === "primitive") {
962
- (l == null ? void 0 : l.object) === void 0 && je("Tres primitives need a prop 'object'");
963
- const p = l.object;
971
+ (a == null ? void 0 : a.object) === void 0 && He("Tres primitives need a prop 'object'");
972
+ const p = a.object;
964
973
  y = p.type, c = Object.assign(p.clone(), { type: y });
965
974
  } else {
966
975
  const p = de.value[y];
967
- p || je(
976
+ p || He(
968
977
  `${y} is not defined on the THREE namespace. Use extend to add it to the catalog.`
969
- ), c = new p(...l.args);
978
+ ), c = new p(...a.args);
970
979
  }
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 = {
980
+ 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
981
  ...c.__tres,
973
982
  type: y,
974
- memoizedProps: l,
983
+ memoizedProps: a,
975
984
  eventCount: 0,
976
985
  disposable: !0,
977
986
  primitive: r === "primitive"
978
- }, c.isObject3D && c.__tres && (l != null && l.material || l != null && l.geometry) && (c.__tres.disposable = !1), c) : null;
987
+ }, c.isObject3D && c.__tres && (a != null && a.material || a != null && a.geometry) && (c.__tres.disposable = !1), c) : null;
979
988
  }
980
989
  function n(r, s) {
981
- var l, y, c, p, M;
990
+ var a, y, c, p, P;
982
991
  if (!r)
983
992
  return;
984
993
  s && s.isScene && (e = s), e && r.__tres && (r.__tres.root = e.__tres.root);
985
994
  const u = s || e;
986
995
  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));
996
+ const { registerCamera: f } = (a = r == null ? void 0 : r.__tres) == null ? void 0 : a.root;
997
+ 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
998
  }
990
999
  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
1000
  }
992
1001
  function o(r) {
993
- var u, l, y, c;
1002
+ var u, a, y, c;
994
1003
  if (!r)
995
1004
  return;
996
1005
  const s = r.__tres;
@@ -1003,16 +1012,16 @@ const Hr = () => {
1003
1012
  (u = r.removeFromParent) == null || u.call(r), r.traverse((f) => {
1004
1013
  var b, m;
1005
1014
  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);
1015
+ }), p(r), Ue(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
1016
  }
1008
1017
  }
1009
- function i(r, s, u, l) {
1018
+ function i(r, s, u, a) {
1010
1019
  var y, c;
1011
1020
  if (r) {
1012
- let p = r, M = s;
1013
- if ((y = r == null ? void 0 : r.__tres) != null && y.primitive && M === "object" && u !== null) {
1021
+ let p = r, P = s;
1022
+ if ((y = r == null ? void 0 : r.__tres) != null && y.primitive && P === "object" && u !== null) {
1014
1023
  const w = t("primitive", void 0, void 0, {
1015
- object: l
1024
+ object: a
1016
1025
  });
1017
1026
  for (const v in w) {
1018
1027
  if (v === "uuid")
@@ -1022,41 +1031,41 @@ const Hr = () => {
1022
1031
  }
1023
1032
  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
1033
  }
1025
- if (r != null && r.isObject3D && M === "blocks-pointer-events") {
1026
- l || l === "" ? r[M] = l : delete r[M];
1034
+ if (r != null && r.isObject3D && P === "blocks-pointer-events") {
1035
+ a || a === "" ? r[P] = a : delete r[P];
1027
1036
  return;
1028
1037
  }
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;
1032
- _ && v.length && !Pr(v, h) && (p = Object.assign(
1038
+ let f = X(P), b = p == null ? void 0 : p[f];
1039
+ if (P === "args") {
1040
+ const w = r, v = u ?? [], h = a ?? [], _ = ((c = r == null ? void 0 : r.__tres) == null ? void 0 : c.type) || r.type;
1041
+ _ && v.length && !Cr(v, h) && (p = Object.assign(
1033
1042
  w,
1034
- new de.value[_](...l)
1043
+ new de.value[_](...a)
1035
1044
  ));
1036
1045
  return;
1037
1046
  }
1038
1047
  if (p.type === "BufferGeometry") {
1039
- if (M === "args")
1048
+ if (P === "args")
1040
1049
  return;
1041
1050
  p.setAttribute(
1042
- X(M),
1043
- new Ct(...l)
1051
+ X(P),
1052
+ new Et(...a)
1044
1053
  );
1045
1054
  return;
1046
1055
  }
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));
1056
+ if (P.includes("-") && b === void 0) {
1057
+ const w = P.split("-");
1058
+ 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
1059
  }
1051
- let m = l;
1060
+ let m = a;
1052
1061
  if (m === "" && (m = !0), ee(b)) {
1053
- Ir.includes(s) || (Array.isArray(m) ? r[f](...m) : r[f](m)), f.startsWith("on") && ee(m) && (p[f] = m);
1062
+ Hr.includes(s) || (Array.isArray(m) ? r[f](...m) : r[f](m)), f.startsWith("on") && ee(m) && (p[f] = m);
1054
1063
  return;
1055
1064
  }
1056
- !(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);
1065
+ !(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), Ue(r);
1057
1066
  }
1058
1067
  }
1059
- function a(r) {
1068
+ function l(r) {
1060
1069
  return (r == null ? void 0 : r.parent) || null;
1061
1070
  }
1062
1071
  return {
@@ -1064,7 +1073,7 @@ const Hr = () => {
1064
1073
  remove: o,
1065
1074
  createElement: t,
1066
1075
  patchProp: i,
1067
- parentNode: a,
1076
+ parentNode: l,
1068
1077
  createText: () => void 0,
1069
1078
  createComment: () => void 0,
1070
1079
  setText: () => void 0,
@@ -1076,22 +1085,22 @@ const Hr = () => {
1076
1085
  insertStaticContent: () => void 0
1077
1086
  };
1078
1087
  };
1079
- function Ur() {
1080
- return Ze().__VUE_DEVTOOLS_GLOBAL_HOOK__;
1088
+ function $r() {
1089
+ return tt().__VUE_DEVTOOLS_GLOBAL_HOOK__;
1081
1090
  }
1082
- function Ze() {
1091
+ function tt() {
1083
1092
  return typeof navigator < "u" && typeof window < "u" ? window : typeof globalThis < "u" ? globalThis : {};
1084
1093
  }
1085
- const $r = typeof Proxy == "function", Fr = "devtools-plugin:setup", Wr = "plugin:settings:set";
1094
+ const Fr = typeof Proxy == "function", Wr = "devtools-plugin:setup", Nr = "plugin:settings:set";
1086
1095
  let F, me;
1087
- function Nr() {
1096
+ function zr() {
1088
1097
  var e;
1089
1098
  return F !== void 0 || (typeof window < "u" && window.performance ? (F = !0, me = window.performance) : typeof globalThis < "u" && (!((e = globalThis.perf_hooks) === null || e === void 0) && e.performance) ? (F = !0, me = globalThis.perf_hooks.performance) : F = !1), F;
1090
1099
  }
1091
- function zr() {
1092
- return Nr() ? me.now() : Date.now();
1100
+ function Gr() {
1101
+ return zr() ? me.now() : Date.now();
1093
1102
  }
1094
- class Gr {
1103
+ class Vr {
1095
1104
  constructor(t, n) {
1096
1105
  this.target = null, this.targetQueue = [], this.onQueue = [], this.plugin = t, this.hook = n;
1097
1106
  const o = {};
@@ -1101,27 +1110,27 @@ class Gr {
1101
1110
  o[r] = s.defaultValue;
1102
1111
  }
1103
1112
  const i = `__vue-devtools-plugin-settings__${t.id}`;
1104
- let a = Object.assign({}, o);
1113
+ let l = Object.assign({}, o);
1105
1114
  try {
1106
1115
  const r = localStorage.getItem(i), s = JSON.parse(r);
1107
- Object.assign(a, s);
1116
+ Object.assign(l, s);
1108
1117
  } catch {
1109
1118
  }
1110
1119
  this.fallbacks = {
1111
1120
  getSettings() {
1112
- return a;
1121
+ return l;
1113
1122
  },
1114
1123
  setSettings(r) {
1115
1124
  try {
1116
1125
  localStorage.setItem(i, JSON.stringify(r));
1117
1126
  } catch {
1118
1127
  }
1119
- a = r;
1128
+ l = r;
1120
1129
  },
1121
1130
  now() {
1122
- return zr();
1131
+ return Gr();
1123
1132
  }
1124
- }, n && n.on(Wr, (r, s) => {
1133
+ }, n && n.on(Nr, (r, s) => {
1125
1134
  r === this.plugin.id && this.fallbacks.setSettings(s);
1126
1135
  }), this.proxiedOn = new Proxy({}, {
1127
1136
  get: (r, s) => this.target ? this.target.on[s] : (...u) => {
@@ -1136,11 +1145,11 @@ class Gr {
1136
1145
  args: u,
1137
1146
  resolve: () => {
1138
1147
  }
1139
- }), this.fallbacks[s](...u)) : (...u) => new Promise((l) => {
1148
+ }), this.fallbacks[s](...u)) : (...u) => new Promise((a) => {
1140
1149
  this.targetQueue.push({
1141
1150
  method: s,
1142
1151
  args: u,
1143
- resolve: l
1152
+ resolve: a
1144
1153
  });
1145
1154
  })
1146
1155
  });
@@ -1153,12 +1162,12 @@ class Gr {
1153
1162
  n.resolve(await this.target[n.method](...n.args));
1154
1163
  }
1155
1164
  }
1156
- 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))
1159
- i.emit(Fr, e, t);
1165
+ function qr(e, t) {
1166
+ const n = e, o = tt(), i = $r(), l = Fr && n.enableEarlyProxy;
1167
+ if (i && (o.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !l))
1168
+ i.emit(Wr, e, t);
1160
1169
  else {
1161
- const r = a ? new Gr(n, i) : null;
1170
+ const r = l ? new Vr(n, i) : null;
1162
1171
  (o.__VUE_DEVTOOLS_PLUGINS__ = o.__VUE_DEVTOOLS_PLUGINS__ || []).push({
1163
1172
  pluginDescriptor: n,
1164
1173
  setupFn: t,
@@ -1166,14 +1175,14 @@ function Vr(e, t) {
1166
1175
  }), r && t(r.proxiedTarget);
1167
1176
  }
1168
1177
  }
1169
- function qr(e, t) {
1178
+ function Yr(e, t) {
1170
1179
  const n = `▲ ■ ●${e}`;
1171
- typeof He == "function" ? He(n, t) : console.log(n);
1180
+ typeof $e == "function" ? $e(n, t) : console.log(n);
1172
1181
  }
1173
- function He(e, t) {
1182
+ function $e(e, t) {
1174
1183
  throw new Error(e + t);
1175
1184
  }
1176
- const et = (e) => {
1185
+ const rt = (e) => {
1177
1186
  const t = {
1178
1187
  id: e.uuid,
1179
1188
  label: e.type,
@@ -1187,7 +1196,7 @@ const et = (e) => {
1187
1196
  });
1188
1197
  const n = be(e);
1189
1198
  return n > 0 && t.tags.push({
1190
- label: `${Lr(n)} KB`,
1199
+ label: `${Dr(n)} KB`,
1191
1200
  textColor: 15707189,
1192
1201
  backgroundColor: 16775644,
1193
1202
  tooltip: "Memory usage"
@@ -1213,30 +1222,30 @@ const et = (e) => {
1213
1222
  tooltip: "Position"
1214
1223
  })), t;
1215
1224
  };
1216
- function tt(e, t, n = "") {
1225
+ function nt(e, t, n = "") {
1217
1226
  e.children.forEach((o) => {
1218
1227
  if (o.type === "HightlightMesh" || n && !o.type.includes(n) && !o.name.includes(n))
1219
1228
  return;
1220
- const i = et(o);
1221
- t.children.push(i), tt(o, i, n);
1229
+ const i = rt(o);
1230
+ t.children.push(i), nt(o, i, n);
1222
1231
  });
1223
1232
  }
1224
- const Yr = [], G = "tres:inspector", Jr = $e({
1233
+ const Jr = [], G = "tres:inspector", Qr = We({
1225
1234
  sceneGraph: null
1226
1235
  });
1227
- function Qr(e, t) {
1228
- Vr(
1236
+ function Kr(e, t) {
1237
+ qr(
1229
1238
  {
1230
1239
  id: "dev.esm.tres",
1231
1240
  label: "TresJS 🪐",
1232
1241
  logo: "https://raw.githubusercontent.com/Tresjs/tres/main/public/favicon.svg",
1233
1242
  packageName: "tresjs",
1234
1243
  homepage: "https://tresjs.org",
1235
- componentStateTypes: Yr,
1244
+ componentStateTypes: Jr,
1236
1245
  app: e
1237
1246
  },
1238
1247
  (n) => {
1239
- typeof n.now != "function" && qr(
1248
+ typeof n.now != "function" && Yr(
1240
1249
  "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."
1241
1250
  ), n.addInspector({
1242
1251
  id: G,
@@ -1247,24 +1256,24 @@ function Qr(e, t) {
1247
1256
  n.sendInspectorTree(G);
1248
1257
  }, 1e3), setInterval(() => {
1249
1258
  n.notifyComponentUpdate();
1250
- }, 5e3), n.on.getInspectorTree((a) => {
1251
- if (a.inspectorId === G) {
1252
- const r = et(t.scene.value);
1253
- tt(t.scene.value, r, a.filter), Jr.sceneGraph = r, a.rootNodes = [r];
1259
+ }, 5e3), n.on.getInspectorTree((l) => {
1260
+ if (l.inspectorId === G) {
1261
+ const r = rt(t.scene.value);
1262
+ nt(t.scene.value, r, l.filter), Qr.sceneGraph = r, l.rootNodes = [r];
1254
1263
  }
1255
1264
  });
1256
1265
  let o = null, i = null;
1257
- n.on.getInspectorState((a) => {
1266
+ n.on.getInspectorState((l) => {
1258
1267
  var r;
1259
- if (a.inspectorId === G) {
1260
- const [s] = t.scene.value.getObjectsByProperty("uuid", a.nodeId);
1268
+ if (l.inspectorId === G) {
1269
+ const [s] = t.scene.value.getObjectsByProperty("uuid", l.nodeId);
1261
1270
  if (!s)
1262
1271
  return;
1263
1272
  if (i && o && o.parent && i.remove(o), s.isMesh) {
1264
- const u = Er(s);
1273
+ const u = kr(s);
1265
1274
  s.add(u), o = u, i = s;
1266
1275
  }
1267
- a.state = {
1276
+ l.state = {
1268
1277
  object: [
1269
1278
  {
1270
1279
  key: "uuid",
@@ -1349,14 +1358,14 @@ function Qr(e, t) {
1349
1358
  value: s.visible
1350
1359
  }
1351
1360
  ]
1352
- }, s.isScene && (a.state.info = {
1361
+ }, s.isScene && (l.state.info = {
1353
1362
  memory: be(s),
1354
1363
  objects: s.children.length,
1355
1364
  calls: t.renderer.value.info.render.calls,
1356
1365
  triangles: t.renderer.value.info.render.triangles,
1357
1366
  points: t.renderer.value.info.render.points,
1358
1367
  lines: t.renderer.value.info.render.lines
1359
- }, a.state.programs = ((r = t.renderer.value.info.programs) == null ? void 0 : r.map((u) => ({
1368
+ }, l.state.programs = ((r = t.renderer.value.info.programs) == null ? void 0 : r.map((u) => ({
1360
1369
  key: u.name,
1361
1370
  value: {
1362
1371
  ...u,
@@ -1366,13 +1375,13 @@ function Qr(e, t) {
1366
1375
  }
1367
1376
  }))) || []);
1368
1377
  }
1369
- }), n.on.editInspectorState((a) => {
1370
- a.inspectorId === G && _r(t.scene.value, a.nodeId, a.path, a.state.value);
1378
+ }), n.on.editInspectorState((l) => {
1379
+ l.inspectorId === G && Er(t.scene.value, l.nodeId, l.path, l.state.value);
1371
1380
  });
1372
1381
  }
1373
1382
  );
1374
1383
  }
1375
- const Kr = ["data-scene", "data-tres"], Xr = /* @__PURE__ */ Se({
1384
+ const Xr = ["data-scene", "data-tres"], Zr = /* @__PURE__ */ Se({
1376
1385
  __name: "TresCanvas",
1377
1386
  props: {
1378
1387
  shadows: { type: Boolean, default: void 0 },
@@ -1416,50 +1425,50 @@ const Kr = ["data-scene", "data-tres"], Xr = /* @__PURE__ */ Se({
1416
1425
  ],
1417
1426
  setup(e, { expose: t, emit: n }) {
1418
1427
  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;
1420
- pe(Fe);
1428
+ const o = e, i = n, l = lt(), { logWarning: r } = $(), s = A(), u = U(new Ge()), a = (b = xe()) == null ? void 0 : b.appContext.app;
1429
+ pe(Ne);
1421
1430
  const y = (m) => Se({
1422
1431
  setup() {
1423
1432
  var v;
1424
1433
  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() : []);
1434
+ return w && (w.app = a), ce("useTres", m), ce("extend", pe), typeof window < "u" && Kr(w == null ? void 0 : w.app, m), () => Te(vt, null, l != null && l.default ? l.default() : []);
1426
1435
  }
1427
1436
  }), c = (m) => {
1428
- const w = y(m), { render: v } = dt(Hr());
1437
+ const w = y(m), { render: v } = mt(Ur());
1429
1438
  v(Te(w), u.value);
1430
1439
  }, p = (m, w = !1) => {
1431
1440
  ye(m.scene.value), w && (m.renderer.value.dispose(), m.renderer.value.renderLists.dispose(), m.renderer.value.forceContextLoss()), u.value.__tres = {
1432
1441
  root: m
1433
1442
  }, c(m);
1434
- }, M = B(() => o.disableRender), f = U(null);
1435
- return t({ context: f, dispose: () => p(f.value, !0) }), at(() => {
1443
+ }, P = B(() => o.disableRender), f = U(null);
1444
+ return t({ context: f, dispose: () => p(f.value, !0) }), ut(() => {
1436
1445
  const m = s;
1437
- f.value = Rr({
1446
+ f.value = jr({
1438
1447
  scene: u.value,
1439
1448
  canvas: m,
1440
1449
  windowSize: o.windowSize ?? !1,
1441
- disableRender: M.value ?? !1,
1450
+ disableRender: P.value ?? !1,
1442
1451
  rendererOptions: o,
1443
1452
  emit: i
1444
- }), jr(u.value, f.value, i);
1453
+ }), Ir(u.value, f.value, i);
1445
1454
  const { registerCamera: w, camera: v, cameras: h, deregisterCamera: _ } = f.value;
1446
1455
  c(f.value);
1447
1456
  const g = () => {
1448
- const P = new fe(
1457
+ const M = new fe(
1449
1458
  45,
1450
1459
  window.innerWidth / window.innerHeight,
1451
1460
  0.1,
1452
1461
  1e3
1453
1462
  );
1454
- P.position.set(3, 3, 3), P.lookAt(0, 0, 0), w(P);
1463
+ M.position.set(3, 3, 3), M.lookAt(0, 0, 0), w(M);
1455
1464
  const C = ve(() => {
1456
- h.value.length >= 2 && (P.removeFromParent(), _(P), C == null || C());
1465
+ h.value.length >= 2 && (M.removeFromParent(), _(M), C == null || C());
1457
1466
  });
1458
1467
  };
1459
1468
  V(
1460
1469
  () => o.camera,
1461
- (P, C) => {
1462
- P && w(P), C && (C.removeFromParent(), _(C));
1470
+ (M, C) => {
1471
+ M && w(M), C && (C.removeFromParent(), _(C));
1463
1472
  },
1464
1473
  {
1465
1474
  immediate: !0
@@ -1469,13 +1478,13 @@ const Kr = ["data-scene", "data-tres"], Xr = /* @__PURE__ */ Se({
1469
1478
  ), g());
1470
1479
  }), N(() => {
1471
1480
  p(f.value);
1472
- }), (m, w) => (lt(), ut("canvas", {
1481
+ }), (m, w) => (ct(), ft("canvas", {
1473
1482
  ref_key: "canvas",
1474
1483
  ref: s,
1475
1484
  "data-scene": u.value.uuid,
1476
- class: ct(m.$attrs.class),
1477
- "data-tres": `tresjs ${W(ar).version}`,
1478
- style: ft({
1485
+ class: dt(m.$attrs.class),
1486
+ "data-tres": `tresjs ${W(ur).version}`,
1487
+ style: pt({
1479
1488
  display: "block",
1480
1489
  width: "100%",
1481
1490
  height: "100%",
@@ -1486,19 +1495,19 @@ const Kr = ["data-scene", "data-tres"], Xr = /* @__PURE__ */ Se({
1486
1495
  touchAction: "none",
1487
1496
  ...m.$attrs.style
1488
1497
  })
1489
- }, null, 14, Kr));
1498
+ }, null, 14, Xr));
1490
1499
  }
1491
- }), Zr = [
1500
+ }), en = [
1492
1501
  "TresCanvas",
1493
1502
  "TresLeches",
1494
1503
  "TresScene"
1495
- ], en = {
1504
+ ], tn = {
1496
1505
  template: {
1497
1506
  compilerOptions: {
1498
- isCustomElement: (e) => e.startsWith("Tres") && !Zr.includes(e) || e === "primitive"
1507
+ isCustomElement: (e) => e.startsWith("Tres") && !en.includes(e) || e === "primitive"
1499
1508
  }
1500
1509
  }
1501
- }, hn = en, yn = {
1510
+ }, yn = tn, bn = {
1502
1511
  mounted: (e, t) => {
1503
1512
  if (t.arg) {
1504
1513
  console.log(`v-log:${t.arg}`, e[t.arg]);
@@ -1507,14 +1516,14 @@ const Kr = ["data-scene", "data-tres"], Xr = /* @__PURE__ */ Se({
1507
1516
  console.log("v-log", e);
1508
1517
  }
1509
1518
  };
1510
- class rt extends _t {
1519
+ class ot extends kt {
1511
1520
  constructor(t, n) {
1512
1521
  const o = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0], i = new Ae();
1513
1522
  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";
1523
+ const l = new St({ fog: !1 });
1524
+ super(i, l), this.light = t, this.color = n, this.type = "RectAreaLightHelper";
1516
1525
  const r = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0], s = new Ae();
1517
- s.setAttribute("position", new Oe(r, 3)), s.computeBoundingSphere(), this.add(new kt(s, new ze({ side: St, fog: !1 })));
1526
+ s.setAttribute("position", new Oe(r, 3)), s.computeBoundingSphere(), this.add(new xt(s, new Ve({ side: Tt, fog: !1 })));
1518
1527
  }
1519
1528
  updateMatrixWorld() {
1520
1529
  if (this.scale.set(0.5 * this.light.width, 0.5 * this.light.height, 1), this.color !== void 0)
@@ -1530,45 +1539,45 @@ class rt extends _t {
1530
1539
  this.geometry.dispose(), this.material.dispose(), this.children[0].geometry.dispose(), this.children[0].material.dispose();
1531
1540
  }
1532
1541
  }
1533
- const { logWarning: Ue } = $();
1542
+ const { logWarning: Fe } = $();
1534
1543
  let te, H;
1535
- const tn = {
1536
- DirectionalLight: xt,
1537
- PointLight: Tt,
1538
- SpotLight: At,
1539
- HemisphereLight: Ot,
1540
- RectAreaLight: rt
1541
- }, bn = {
1544
+ const rn = {
1545
+ DirectionalLight: At,
1546
+ PointLight: Ot,
1547
+ SpotLight: Lt,
1548
+ HemisphereLight: Dt,
1549
+ RectAreaLight: ot
1550
+ }, wn = {
1542
1551
  mounted: (e) => {
1543
1552
  if (!e.isLight) {
1544
- Ue(`${e.type} is not a light`);
1553
+ Fe(`${e.type} is not a light`);
1545
1554
  return;
1546
1555
  }
1547
- te = tn[e.type], e.parent.add(new te(e, 1, e.color.getHex()));
1556
+ te = rn[e.type], e.parent.add(new te(e, 1, e.color.getHex()));
1548
1557
  },
1549
1558
  updated: (e) => {
1550
- H = e.parent.children.find((t) => t instanceof te), !(H instanceof rt) && H.update();
1559
+ H = e.parent.children.find((t) => t instanceof te), !(H instanceof ot) && H.update();
1551
1560
  },
1552
1561
  unmounted: (e) => {
1553
1562
  if (!e.isLight) {
1554
- Ue(`${e.type} is not a light`);
1563
+ Fe(`${e.type} is not a light`);
1555
1564
  return;
1556
1565
  }
1557
1566
  H = e.parent.children.find((t) => t instanceof te), H && H.dispose && H.dispose(), e.parent.remove(H);
1558
1567
  }
1559
- }, { logWarning: rn } = $();
1568
+ }, { logWarning: nn } = $();
1560
1569
  let D = null;
1561
- const wn = {
1570
+ const Mn = {
1562
1571
  updated: (e, t) => {
1563
1572
  var i;
1564
- const n = kr(t);
1573
+ const n = Sr(t);
1565
1574
  if (!n) {
1566
- rn(`v-distance-to: problem with binding value: ${t.value}`);
1575
+ nn(`v-distance-to: problem with binding value: ${t.value}`);
1567
1576
  return;
1568
1577
  }
1569
1578
  D && (D.dispose(), e.parent.remove(D));
1570
1579
  const o = n.clone().sub(e.position);
1571
- o.normalize(), D = new Lt(o, e.position, e.position.distanceTo(n), 16776960), e.parent.add(D), console.table(
1580
+ o.normalize(), D = new Bt(o, e.position, e.position.distanceTo(n), 16776960), e.parent.add(D), console.table(
1572
1581
  [
1573
1582
  ["Distance:", e.position.distanceTo(n)],
1574
1583
  [`origin: ${e.name || e.type}`, `x:${e.position.x}, y:${e.position.y}, z:${(i = e.position) == null ? void 0 : i.z}`],
@@ -1579,37 +1588,38 @@ const wn = {
1579
1588
  unmounted: (e) => {
1580
1589
  D == null || D.dispose(), e.parent.remove(D);
1581
1590
  }
1582
- }, Mn = {
1591
+ }, Pn = {
1583
1592
  install(e) {
1584
- e.component("TresCanvas", Xr);
1593
+ e.component("TresCanvas", Zr);
1585
1594
  }
1586
1595
  };
1587
1596
  export {
1588
- Xr as TresCanvas,
1597
+ Zr as TresCanvas,
1589
1598
  de as catalogue,
1590
- Mn as default,
1599
+ Rr as createRenderLoop,
1600
+ Pn as default,
1591
1601
  ye as dispose,
1592
1602
  pe as extend,
1593
- un as isProd,
1594
- pr as normalizeColor,
1595
- cn as normalizeVectorFlexibleParam,
1596
- hn as templateCompilerOptions,
1597
- Or as trasverseObjects,
1598
- lr as useCamera,
1599
- fn as useLoader,
1603
+ cn as isProd,
1604
+ mr as normalizeColor,
1605
+ fn as normalizeVectorFlexibleParam,
1606
+ yn as templateCompilerOptions,
1607
+ Lr as trasverseObjects,
1608
+ cr as useCamera,
1609
+ dn as useLoader,
1600
1610
  $ as useLogger,
1601
- gn as useLoop,
1602
- mn as usePointerEventHandler,
1603
- Ke as useRaycaster,
1604
- ln as useRenderLoop,
1605
- Tr as useRenderer,
1606
- pn as useSeek,
1607
- dn as useTexture,
1608
- vn as useTres,
1609
- Xe as useTresContext,
1610
- Rr as useTresContextProvider,
1611
- jr as useTresEventManager,
1612
- wn as vDistanceTo,
1613
- bn as vLightHelper,
1614
- yn as vLog
1611
+ hn as useLoop,
1612
+ vn as usePointerEventHandler,
1613
+ Ze as useRaycaster,
1614
+ un as useRenderLoop,
1615
+ Ar as useRenderer,
1616
+ mn as useSeek,
1617
+ pn as useTexture,
1618
+ gn as useTres,
1619
+ et as useTresContext,
1620
+ jr as useTresContextProvider,
1621
+ Ir as useTresEventManager,
1622
+ Mn as vDistanceTo,
1623
+ wn as vLightHelper,
1624
+ bn as vLog
1615
1625
  };