@tresjs/core 3.1.0-next.2 → 3.1.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,523 +1,513 @@
1
1
  /**
2
2
  * name: @tresjs/core
3
- * version: v3.1.0-next.2
3
+ * version: v3.1.0
4
4
  * (c) 2023
5
5
  * description: Declarative ThreeJS using Vue Components
6
6
  * author: Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)
7
7
  */
8
- import { computed as M, ref as H, watchEffect as O, triggerRef as z, shallowRef as N, watch as V, onUnmounted as ue, watchPostEffect as le, reactive as ce, readonly as fe, provide as ee, inject as me, createRenderer as pe, defineComponent as q, useSlots as ve, h as U, Fragment as ge, openBlock as de, createElementBlock as ye, normalizeStyle as we } from "vue";
9
- import * as Ce from "three";
10
- import { PerspectiveCamera as W, OrthographicCamera as Pe, Camera as Me, Clock as _e, SRGBColorSpace as Ee, ACESFilmicToneMapping as Le, PCFSoftShadowMap as xe, Vector3 as Ae, Color as B, WebGLRenderer as j, LoadingManager as he, TextureLoader as De, Vector2 as ke, Raycaster as Te, BufferAttribute as be, Scene as Se } from "three";
11
- import { createEventHook as D, useRafFn as Oe, toValue as d, unrefElement as Be, useDevicePixelRatio as Re, usePointer as Fe, useElementBounding as ze, useWindowSize as He, useElementSize as je } from "@vueuse/core";
12
- const Ge = ({ sizes: e, scene: n }) => {
13
- var i, l;
14
- const r = M(() => n.value.children.filter((u) => u.isCamera)), a = H(((l = (i = r.value) == null ? void 0 : i[0]) == null ? void 0 : l.uuid) ?? ""), t = M(
15
- () => r.value.find((u) => u.uuid === a.value) ?? r.value.at(0)
16
- ), s = (u, c = !1) => {
17
- r.value.some(({ uuid: p }) => p === u.uuid) || (n.value.add(u), z(n), c && o(u));
18
- }, f = (u) => {
19
- n.value.remove(u), z(n);
20
- }, o = (u) => {
21
- const c = u instanceof Me ? u.uuid : u;
22
- c && (a.value = c);
8
+ import { ref as H, computed as _, watchEffect as L, onUnmounted as N, shallowRef as z, watch as ee, reactive as ie, readonly as ue, provide as I, inject as le, createRenderer as ce, defineComponent as U, useSlots as fe, onMounted as me, openBlock as pe, createElementBlock as ve, normalizeStyle as de, h as J, Fragment as ge } from "vue";
9
+ import * as ye from "three";
10
+ import { PerspectiveCamera as V, OrthographicCamera as we, Camera as Ce, Clock as Pe, SRGBColorSpace as Me, ACESFilmicToneMapping as _e, PCFSoftShadowMap as Ee, Vector3 as xe, Color as B, REVISION as Ae, WebGLRenderer as j, LoadingManager as De, TextureLoader as Le, Vector2 as he, Raycaster as ke, BufferAttribute as Te, Scene as be } from "three";
11
+ import { createEventHook as k, useRafFn as Se, toValue as w, unrefElement as Oe, useDevicePixelRatio as Be, usePointer as Re, useElementBounding as Fe, useWindowSize as ze, useElementSize as He } from "@vueuse/core";
12
+ const je = ({ sizes: e, scene: n }) => {
13
+ const t = H([]), a = _(
14
+ () => t.value[0]
15
+ ), r = (o, s = !1) => {
16
+ t.value.some(({ uuid: u }) => u === o.uuid) || (s ? l(o) : t.value.push(o));
17
+ }, i = (o) => {
18
+ t.value = t.value.filter(({ uuid: s }) => s !== o.uuid);
19
+ }, l = (o) => {
20
+ const s = o instanceof Ce ? o : t.value.find((c) => c.uuid === o);
21
+ if (!s)
22
+ return;
23
+ const u = t.value.filter(({ uuid: c }) => c !== s.uuid);
24
+ t.value = [s, ...u];
23
25
  };
24
- return O(() => {
25
- e.aspectRatio.value && r.value.forEach((u) => {
26
- u instanceof W && (u.aspect = e.aspectRatio.value), (u instanceof W || u instanceof Pe) && u.updateProjectionMatrix();
26
+ return L(() => {
27
+ e.aspectRatio.value && t.value.forEach((o) => {
28
+ o instanceof V && (o.aspect = e.aspectRatio.value), (o instanceof V || o instanceof we) && o.updateProjectionMatrix();
27
29
  });
28
- }), n.value.userData.tres__registerCamera = s, n.value.userData.tres__deregisterCamera = f, {
29
- camera: t,
30
- cameras: r,
31
- addCamera: s,
32
- removeCamera: f,
33
- setCameraActive: o
30
+ }), n.userData.tres__registerCamera = r, n.userData.tres__deregisterCamera = i, N(() => {
31
+ t.value = [];
32
+ }), {
33
+ camera: a,
34
+ cameras: t,
35
+ addCamera: r,
36
+ removeCamera: i,
37
+ setCameraActive: l
34
38
  };
35
- }, te = D(), re = D(), I = D(), h = new _e();
39
+ }, te = k(), re = k(), $ = k(), h = new Pe();
36
40
  let R = 0, F = 0;
37
- const { pause: Ve, resume: We, isActive: $e } = Oe(
41
+ const { pause: Ge, resume: Ie, isActive: Ve } = Se(
38
42
  () => {
39
- te.trigger({ delta: R, elapsed: F, clock: h }), re.trigger({ delta: R, elapsed: F, clock: h }), I.trigger({ delta: R, elapsed: F, clock: h });
43
+ te.trigger({ delta: R, elapsed: F, clock: h }), re.trigger({ delta: R, elapsed: F, clock: h }), $.trigger({ delta: R, elapsed: F, clock: h });
40
44
  },
41
45
  { immediate: !1 }
42
46
  );
43
- I.on(() => {
47
+ $.on(() => {
44
48
  R = h.getDelta(), F = h.getElapsedTime();
45
49
  });
46
50
  const ne = () => ({
47
51
  onBeforeLoop: te.on,
48
52
  onLoop: re.on,
49
- onAfterLoop: I.on,
50
- pause: Ve,
51
- resume: We,
52
- isActive: $e
53
- }), b = {
53
+ onAfterLoop: $.on,
54
+ pause: Ge,
55
+ resume: Ie,
56
+ isActive: Ve
57
+ }), S = {
54
58
  realistic: {
55
- outputColorSpace: Ee,
56
- toneMapping: Le,
59
+ outputColorSpace: Me,
60
+ toneMapping: _e,
57
61
  toneMappingExposure: 3,
58
62
  shadowMap: {
59
63
  enabled: !0,
60
- type: xe
64
+ type: Ee
61
65
  }
62
66
  }
63
67
  }, ae = (e, n) => {
64
- for (const r of Object.keys(n))
65
- n[r] instanceof Object && Object.assign(n[r], ae(e[r], n[r]));
68
+ for (const t of Object.keys(n))
69
+ n[t] instanceof Object && Object.assign(n[t], ae(e[t], n[t]));
66
70
  return Object.assign(e || {}, n), e;
67
- }, Ne = "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", Ie = /* @__PURE__ */ qe(Ne);
68
- function J(e) {
71
+ }, We = "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", Ne = /* @__PURE__ */ $e(We);
72
+ function K(e) {
69
73
  return e && e.nodeType === 1;
70
74
  }
71
- function S(e) {
72
- return e.replace(/-([a-z])/g, (n, r) => r.toUpperCase());
75
+ function O(e) {
76
+ return e.replace(/-([a-z])/g, (n, t) => t.toUpperCase());
73
77
  }
74
- function qe(e, n) {
75
- const r = /* @__PURE__ */ Object.create(null), a = e.split(",");
76
- for (let t = 0; t < a.length; t++)
77
- r[a[t]] = !0;
78
- return n ? (t) => !!r[t.toLowerCase()] : (t) => !!r[t];
78
+ function $e(e, n) {
79
+ const t = /* @__PURE__ */ Object.create(null), a = e.split(",");
80
+ for (let r = 0; r < a.length; r++)
81
+ t[a[r]] = !0;
82
+ return n ? (r) => !!t[r.toLowerCase()] : (r) => !!t[r];
79
83
  }
80
- const Ue = (e, n) => {
81
- const r = /* @__PURE__ */ new Set(), a = [];
82
- for (const t of e) {
83
- const s = n(t);
84
- r.has(s) || (r.add(s), a.push(t));
84
+ const qe = (e, n) => {
85
+ const t = /* @__PURE__ */ new Set(), a = [];
86
+ for (const r of e) {
87
+ const i = n(r);
88
+ t.has(i) || (t.add(i), a.push(r));
85
89
  }
86
90
  return a;
87
- }, K = (e, n) => {
91
+ }, X = (e, n) => {
88
92
  if (!n)
89
93
  return;
90
- const r = Array.isArray(n) ? n : n.match(/([^[.\]])+/g);
91
- return r == null ? void 0 : r.reduce((a, t) => a && a[t], e);
92
- }, Je = (e, n, r) => {
94
+ const t = Array.isArray(n) ? n : n.match(/([^[.\]])+/g);
95
+ return t == null ? void 0 : t.reduce((a, r) => a && a[r], e);
96
+ }, Ue = (e, n, t) => {
93
97
  const a = Array.isArray(n) ? n : n.match(/([^[.\]])+/g);
94
- a && a.reduce((t, s, f) => (t[s] === void 0 && (t[s] = {}), f === a.length - 1 && (t[s] = r), t[s]), e);
98
+ a && a.reduce((r, i, l) => (r[i] === void 0 && (r[i] = {}), l === a.length - 1 && (r[i] = t), r[i]), e);
95
99
  };
96
100
  function oe(e, n) {
97
- if (J(e) && J(n)) {
98
- const t = e.attributes, s = n.attributes;
99
- if (t.length !== s.length)
100
- return !1;
101
- for (let f = 0; f < t.length; f++) {
102
- const { name: o, value: i } = t[f];
103
- if (n.getAttribute(o) !== i)
104
- return !1;
105
- }
106
- return !0;
101
+ if (K(e) && K(n)) {
102
+ const r = e.attributes, i = n.attributes;
103
+ return r.length !== i.length ? !1 : Array.from(r).every(({ name: l, value: o }) => n.getAttribute(l) === o);
107
104
  }
108
105
  if (e === n)
109
106
  return !0;
110
107
  if (e === null || typeof e != "object" || n === null || typeof n != "object")
111
108
  return !1;
112
- const r = Object.keys(e), a = Object.keys(n);
113
- if (r.length !== a.length)
109
+ const t = Object.keys(e), a = Object.keys(n);
110
+ if (t.length !== a.length)
114
111
  return !1;
115
- for (const t of r)
116
- if (!a.includes(t) || !oe(e[t], n[t]))
112
+ for (const r of t)
113
+ if (!a.includes(r) || !oe(e[r], n[r]))
117
114
  return !1;
118
115
  return !0;
119
116
  }
120
- function X(e, n) {
117
+ function Je(e, n) {
121
118
  if (!Array.isArray(e) || !Array.isArray(n) || e.length !== n.length)
122
119
  return !1;
123
- for (let r = 0; r < e.length; r++)
124
- if (!oe(e[r], n[r]))
120
+ for (let t = 0; t < e.length; t++)
121
+ if (!oe(e[t], n[t]))
125
122
  return !1;
126
123
  return !0;
127
124
  }
128
- const ft = !0, Y = "[TresJS ▲ ■ ●] ";
129
- function k() {
130
- function e(a, t) {
131
- console.error(`${Y} ${a}`, t || "");
125
+ const mt = !0, Y = "[TresJS ▲ ■ ●] ";
126
+ function T() {
127
+ function e(a, r) {
128
+ console.error(`${Y} ${a}`, r || "");
132
129
  }
133
130
  function n(a) {
134
131
  console.warn(`${Y} ${a}`);
135
132
  }
136
- function r(a, t) {
133
+ function t(a, r) {
137
134
  }
138
135
  return {
139
136
  logError: e,
140
137
  logWarning: n,
141
- logMessage: r
138
+ logMessage: t
142
139
  };
143
140
  }
144
- function mt(e) {
145
- return typeof e == "number" ? [e, e, e] : e instanceof Ae ? [e.x, e.y, e.z] : e;
141
+ function pt(e) {
142
+ return typeof e == "number" ? [e, e, e] : e instanceof xe ? [e.x, e.y, e.z] : e;
146
143
  }
147
144
  function Ke(e) {
148
145
  return e instanceof B ? e : Array.isArray(e) ? new B(...e) : new B(e);
149
146
  }
150
- function Xe({
147
+ const Xe = Number.parseInt(Ae.replace("dev", ""));
148
+ function Ye({
151
149
  scene: e,
152
150
  canvas: n,
153
- options: r,
151
+ options: t,
154
152
  disableRender: a,
155
- contextParts: { sizes: t, camera: s }
153
+ contextParts: { sizes: r, camera: i }
156
154
  }) {
157
- const f = M(() => ({
158
- alpha: d(r.alpha),
159
- depth: d(r.depth),
160
- canvas: Be(n),
161
- context: d(r.context),
162
- stencil: d(r.stencil),
163
- antialias: d(r.antialias) === void 0 ? (
155
+ const l = _(() => ({
156
+ alpha: w(t.alpha),
157
+ depth: w(t.depth),
158
+ canvas: Oe(n),
159
+ context: w(t.context),
160
+ stencil: w(t.stencil),
161
+ antialias: w(t.antialias) === void 0 ? (
164
162
  // an opinionated default of tres
165
163
  !0
166
- ) : d(r.antialias),
167
- precision: d(r.precision),
168
- powerPreference: d(r.powerPreference),
169
- premultipliedAlpha: d(r.premultipliedAlpha),
170
- preserveDrawingBuffer: d(r.preserveDrawingBuffer),
171
- logarithmicDepthBuffer: d(r.logarithmicDepthBuffer),
172
- failIfMajorPerformanceCaveat: d(r.failIfMajorPerformanceCaveat)
173
- })), o = N(new j(f.value));
174
- V(f, () => {
175
- o.value.dispose(), o.value = new j(f.value), z(o);
176
- }), O(() => {
177
- o.value.setSize(t.width.value, t.height.value);
164
+ ) : w(t.antialias),
165
+ precision: w(t.precision),
166
+ powerPreference: w(t.powerPreference),
167
+ premultipliedAlpha: w(t.premultipliedAlpha),
168
+ preserveDrawingBuffer: w(t.preserveDrawingBuffer),
169
+ logarithmicDepthBuffer: w(t.logarithmicDepthBuffer),
170
+ failIfMajorPerformanceCaveat: w(t.failIfMajorPerformanceCaveat)
171
+ })), o = z(new j(l.value));
172
+ ee(l, () => {
173
+ o.value.dispose(), o.value = new j(l.value);
174
+ }), L(() => {
175
+ o.value.setSize(r.width.value, r.height.value);
178
176
  });
179
- const { pixelRatio: i } = Re();
180
- O(() => {
181
- o.value.setPixelRatio(i.value);
177
+ const { pixelRatio: s } = Be();
178
+ L(() => {
179
+ o.value.setPixelRatio(s.value);
182
180
  });
183
- const { logError: l } = k(), c = (() => {
184
- const v = new j(), C = {
181
+ const { logError: u } = T(), f = (() => {
182
+ const d = new j(), g = {
185
183
  shadowMap: {
186
- enabled: v.shadowMap.enabled,
187
- type: v.shadowMap.type
184
+ enabled: d.shadowMap.enabled,
185
+ type: d.shadowMap.type
188
186
  },
189
- toneMapping: v.toneMapping,
190
- toneMappingExposure: v.toneMappingExposure,
191
- outputColorSpace: v.outputColorSpace,
192
- useLegacyLights: v.useLegacyLights
187
+ toneMapping: d.toneMapping,
188
+ toneMappingExposure: d.toneMappingExposure,
189
+ outputColorSpace: d.outputColorSpace
193
190
  };
194
- return v.dispose(), C;
191
+ return d.dispose(), g;
195
192
  })();
196
- O(() => {
197
- const v = d(r.preset);
198
- v && (v in b || l("Renderer Preset must be one of these: " + Object.keys(b).join(", ")), ae(o.value, b[v]));
199
- const C = (x, E) => {
200
- const A = d(x), T = () => {
201
- if (v)
202
- return K(b[v], E);
193
+ L(() => {
194
+ const d = w(t.preset);
195
+ d && (d in S || u("Renderer Preset must be one of these: " + Object.keys(S).join(", ")), ae(o.value, S[d]));
196
+ const g = (A, x) => {
197
+ const D = w(A), b = () => {
198
+ if (d)
199
+ return X(S[d], x);
203
200
  };
204
- if (A !== void 0)
205
- return A;
206
- const m = T();
207
- return m !== void 0 ? m : K(c, E);
208
- }, y = (x, E) => Je(o.value, E, C(x, E));
209
- y(r.shadows, "shadowMap.enabled"), y(r.toneMapping, "toneMapping"), y(r.shadowMapType, "shadowMap.type"), y(r.useLegacyLights, "useLegacyLights"), y(r.outputColorSpace, "outputColorSpace"), y(r.toneMappingExposure, "toneMappingExposure");
210
- const _ = C(r.clearColor, "clearColor");
211
- _ && o.value.setClearColor(
212
- _ ? Ke(_) : new B(0)
201
+ if (D !== void 0)
202
+ return D;
203
+ const m = b();
204
+ return m !== void 0 ? m : X(f, x);
205
+ }, p = (A, x) => Ue(o.value, x, g(A, x));
206
+ p(t.shadows, "shadowMap.enabled"), p(t.toneMapping, "toneMapping"), p(t.shadowMapType, "shadowMap.type"), Xe < 150 && p(!t.useLegacyLights, "physicallyCorrectLights"), p(t.outputColorSpace, "outputColorSpace"), p(t.toneMappingExposure, "toneMappingExposure");
207
+ const E = g(t.clearColor, "clearColor");
208
+ E && o.value.setClearColor(
209
+ E ? Ke(E) : new B(0)
213
210
  // default clear color is not easily/efficiently retrievable from three
214
211
  );
215
212
  });
216
- const { pause: p, resume: P, onLoop: L } = ne();
217
- return L(() => {
218
- s.value && !d(a) && o.value.render(e.value, s.value);
219
- }), P(), ue(() => {
220
- p(), o.value.dispose(), o.value.forceContextLoss();
213
+ const { pause: v, resume: C, onLoop: M } = ne();
214
+ return M(() => {
215
+ i.value && !w(a) && o.value.render(e, i.value);
216
+ }), C(), N(() => {
217
+ v(), o.value.dispose(), o.value.forceContextLoss();
221
218
  }), {
222
219
  renderer: o
223
220
  };
224
221
  }
225
222
  const Q = (e) => typeof e == "function", se = (e) => !!e && e.constructor === Array;
226
- function Ye(e) {
223
+ function Qe(e) {
227
224
  const n = { nodes: {}, materials: {} };
228
- return e && e.traverse((r) => {
229
- r.name && (n.nodes[r.name] = r), r.material && !n.materials[r.material.name] && (n.materials[r.material.name] = r.material);
225
+ return e && e.traverse((t) => {
226
+ t.name && (n.nodes[t.name] = t), t.material && !n.materials[t.material.name] && (n.materials[t.material.name] = t.material);
230
227
  }), n;
231
228
  }
232
- async function pt(e, n, r, a, t) {
233
- const { logError: s } = k(), f = new e();
234
- t && t(f), r && r(f);
235
- const i = (Array.isArray(n) ? n : [n]).map(
236
- (l) => new Promise((u, c) => {
237
- f.load(
238
- l,
239
- (p) => {
240
- p.scene && Object.assign(p, Ye(p.scene)), u(p);
229
+ async function vt(e, n, t, a, r) {
230
+ const { logError: i } = T(), l = new e();
231
+ r && r(l), t && t(l);
232
+ const s = (Array.isArray(n) ? n : [n]).map(
233
+ (u) => new Promise((c, f) => {
234
+ l.load(
235
+ u,
236
+ (v) => {
237
+ v.scene && Object.assign(v, Qe(v.scene)), c(v);
241
238
  },
242
239
  a,
243
- (p) => c(s("[useLoader] - Failed to load resource", p))
240
+ (v) => f(i("[useLoader] - Failed to load resource", v))
244
241
  );
245
242
  })
246
243
  );
247
- return se(n) ? await Promise.all(i) : await i[0];
244
+ return se(n) ? await Promise.all(s) : await s[0];
248
245
  }
249
- async function vt(e) {
250
- const n = new he(), r = new De(n), a = (t) => new Promise((s, f) => {
251
- r.load(
252
- t,
253
- (o) => s(o),
246
+ async function dt(e) {
247
+ const n = new De(), t = new Le(n), a = (r) => new Promise((i, l) => {
248
+ t.load(
249
+ r,
250
+ (o) => i(o),
254
251
  () => null,
255
252
  () => {
256
- f(new Error("[useTextures] - Failed to load texture"));
253
+ l(new Error("[useTextures] - Failed to load texture"));
257
254
  }
258
255
  );
259
256
  });
260
257
  if (se(e)) {
261
- const t = await Promise.all(e.map((s) => a(s)));
262
- return e.length > 1 ? t : t[0];
258
+ const r = await Promise.all(e.map((i) => a(i)));
259
+ return e.length > 1 ? r : r[0];
263
260
  } else {
264
261
  const {
265
- map: t,
266
- displacementMap: s,
267
- normalMap: f,
262
+ map: r,
263
+ displacementMap: i,
264
+ normalMap: l,
268
265
  roughnessMap: o,
269
- metalnessMap: i,
270
- aoMap: l,
271
- alphaMap: u,
272
- matcap: c
266
+ metalnessMap: s,
267
+ aoMap: u,
268
+ alphaMap: c,
269
+ matcap: f
273
270
  } = e;
274
271
  return {
275
- map: t ? await a(t) : null,
276
- displacementMap: s ? await a(s) : null,
277
- normalMap: f ? await a(f) : null,
272
+ map: r ? await a(r) : null,
273
+ displacementMap: i ? await a(i) : null,
274
+ normalMap: l ? await a(l) : null,
278
275
  roughnessMap: o ? await a(o) : null,
279
- metalnessMap: i ? await a(i) : null,
280
- aoMap: l ? await a(l) : null,
281
- alphaMap: u ? await a(u) : null,
282
- matcap: c ? await a(c) : null
276
+ metalnessMap: s ? await a(s) : null,
277
+ aoMap: u ? await a(u) : null,
278
+ alphaMap: c ? await a(c) : null,
279
+ matcap: f ? await a(f) : null
283
280
  };
284
281
  }
285
282
  }
286
- const Qe = (e, { renderer: n, camera: r, raycaster: a }) => {
287
- const t = M(() => n.value.domElement), { x: s, y: f } = Fe({ target: t }), { width: o, height: i, top: l, left: u } = ze(t), c = ({ x: m, y: w }) => {
288
- if (t.value)
283
+ const Ze = (e, { renderer: n, camera: t, raycaster: a }) => {
284
+ const r = _(() => n.value.domElement), { x: i, y: l } = Re({ target: r }), { width: o, height: s, top: u, left: c } = Fe(r), f = ({ x: m, y: P }) => {
285
+ if (r.value)
289
286
  return {
290
- x: (m - u.value) / o.value * 2 - 1,
291
- y: -((w - l.value) / i.value) * 2 + 1
287
+ x: (m - c.value) / o.value * 2 - 1,
288
+ y: -((P - u.value) / s.value) * 2 + 1
292
289
  };
293
- }, p = ({ x: m, y: w }) => {
294
- if (r.value)
295
- return a.value.setFromCamera(new ke(m, w), r.value), a.value.intersectObjects(e.value, !1);
296
- }, P = (m) => {
297
- const w = c({
298
- x: (m == null ? void 0 : m.clientX) ?? s.value,
299
- y: (m == null ? void 0 : m.clientY) ?? f.value
290
+ }, v = ({ x: m, y: P }) => {
291
+ if (t.value)
292
+ return a.value.setFromCamera(new he(m, P), t.value), a.value.intersectObjects(e.value, !1);
293
+ }, C = (m) => {
294
+ const P = f({
295
+ x: (m == null ? void 0 : m.clientX) ?? i.value,
296
+ y: (m == null ? void 0 : m.clientY) ?? l.value
300
297
  });
301
- return w ? p(w) || [] : [];
302
- }, L = M(() => P()), v = D(), C = D(), y = (m, w) => {
303
- m.trigger({ event: w, intersects: P(w) });
304
- }, _ = (m) => {
305
- y(C, m);
298
+ return P ? v(P) || [] : [];
299
+ }, M = _(() => C()), d = k(), g = k(), p = (m, P) => {
300
+ m.trigger({ event: P, intersects: C(P) });
301
+ }, E = (m) => {
302
+ p(g, m);
306
303
  };
307
- let x;
308
- const E = (m) => {
309
- var w;
310
- x = (w = P(m)[0]) == null ? void 0 : w.object;
311
- }, A = (m) => {
312
- var w;
313
- m instanceof PointerEvent && x === ((w = P(m)[0]) == null ? void 0 : w.object) && y(v, m);
314
- }, T = (m) => C.trigger({ event: m, intersects: [] });
315
- return le((m) => {
316
- t.value && (t.value.addEventListener("pointerup", A), t.value.addEventListener("pointerdown", E), t.value.addEventListener("pointermove", _), t.value.addEventListener("pointerleave", T), m(() => {
317
- t != null && t.value && (t.value.removeEventListener("pointerup", A), t.value.removeEventListener("pointerdown", E), t.value.removeEventListener("pointermove", _), t.value.removeEventListener("pointerleave", T));
318
- }));
304
+ let A;
305
+ const x = (m) => {
306
+ var P;
307
+ A = (P = C(m)[0]) == null ? void 0 : P.object;
308
+ }, D = (m) => {
309
+ var P;
310
+ m instanceof PointerEvent && A === ((P = C(m)[0]) == null ? void 0 : P.object) && p(d, m);
311
+ }, b = (m) => g.trigger({ event: m, intersects: [] });
312
+ return r.value.addEventListener("pointerup", D), r.value.addEventListener("pointerdown", x), r.value.addEventListener("pointermove", E), r.value.addEventListener("pointerleave", b), N(() => {
313
+ r != null && r.value && (r.value.removeEventListener("pointerup", D), r.value.removeEventListener("pointerdown", x), r.value.removeEventListener("pointermove", E), r.value.removeEventListener("pointerleave", b));
319
314
  }), {
320
- intersects: L,
321
- onClick: (m) => v.on(m).off,
322
- onPointerMove: (m) => C.on(m).off
315
+ intersects: M,
316
+ onClick: (m) => d.on(m).off,
317
+ onPointerMove: (m) => g.on(m).off
323
318
  };
324
319
  };
325
320
  function gt() {
326
- const { logWarning: e } = k();
327
- function n(a, t, s) {
328
- let f = null;
321
+ const { logWarning: e } = T();
322
+ function n(a, r, i) {
323
+ let l = null;
329
324
  return a.traverse((o) => {
330
- o[t] === s && (f = o);
331
- }), f || e(`Child with ${t} '${s}' not found.`), f;
325
+ o[r] === i && (l = o);
326
+ }), l || e(`Child with ${r} '${i}' not found.`), l;
332
327
  }
333
- function r(a, t) {
334
- return n(a, "name", t);
328
+ function t(a, r) {
329
+ return n(a, "name", r);
335
330
  }
336
331
  return {
337
332
  seek: n,
338
- seekByName: r
333
+ seekByName: t
339
334
  };
340
335
  }
341
- const Ze = ({ scene: e, contextParts: n }) => {
342
- const r = ce({
336
+ const et = ({ scene: e, contextParts: n }) => {
337
+ const t = ie({
343
338
  click: /* @__PURE__ */ new Map(),
344
339
  pointerMove: /* @__PURE__ */ new Map(),
345
340
  pointerEnter: /* @__PURE__ */ new Map(),
346
341
  pointerLeave: /* @__PURE__ */ new Map()
347
- }), a = (l) => {
348
- Object.values(r).forEach((u) => u.delete(l));
349
- }, t = (l) => {
350
- const { onClick: u, onPointerMove: c, onPointerEnter: p, onPointerLeave: P } = l;
351
- u && r.click.set(l, u), c && r.pointerMove.set(l, c), p && r.pointerEnter.set(l, p), P && r.pointerLeave.set(l, P);
342
+ }), a = (u) => {
343
+ Object.values(t).forEach((c) => c.delete(u));
344
+ }, r = (u) => {
345
+ const { onClick: c, onPointerMove: f, onPointerEnter: v, onPointerLeave: C } = u;
346
+ c && t.click.set(u, c), f && t.pointerMove.set(u, f), v && t.pointerEnter.set(u, v), C && t.pointerLeave.set(u, C);
352
347
  };
353
- e.userData.tres__registerAtPointerEventHandler = t, e.userData.tres__deregisterAtPointerEventHandler = a;
354
- const s = M(
355
- () => Ue(
356
- Object.values(r).map((l) => Array.from(l.keys())).flat(),
357
- ({ uuid: l }) => l
348
+ e.userData.tres__registerAtPointerEventHandler = r, e.userData.tres__deregisterAtPointerEventHandler = a;
349
+ const i = _(
350
+ () => qe(
351
+ Object.values(t).map((u) => Array.from(u.keys())).flat(),
352
+ ({ uuid: u }) => u
358
353
  )
359
- ), { onClick: f, onPointerMove: o } = Qe(s, n);
360
- f(({ intersects: l, event: u }) => {
361
- var c;
362
- l.length && ((c = r.click.get(l[0].object)) == null || c(l[0], u));
354
+ ), { onClick: l, onPointerMove: o } = Ze(i, n);
355
+ l(({ intersects: u, event: c }) => {
356
+ var f;
357
+ u.length && ((f = t.click.get(u[0].object)) == null || f(u[0], c));
363
358
  });
364
- let i;
365
- return o(({ intersects: l, event: u }) => {
366
- var v, C, y, _;
367
- const c = (v = l == null ? void 0 : l[0]) == null ? void 0 : v.object, { pointerLeave: p, pointerEnter: P, pointerMove: L } = r;
368
- i && i !== c && ((C = p.get(i)) == null || C(i, u)), c && (i !== c && ((y = P.get(c)) == null || y(l[0], u)), (_ = L.get(c)) == null || _(l[0], u)), i = c || null;
359
+ let s;
360
+ return o(({ intersects: u, event: c }) => {
361
+ var d, g, p, E;
362
+ const f = (d = u == null ? void 0 : u[0]) == null ? void 0 : d.object, { pointerLeave: v, pointerEnter: C, pointerMove: M } = t;
363
+ s && s !== f && ((g = v.get(s)) == null || g(s, c)), f && (s !== f && ((p = C.get(f)) == null || p(u[0], c)), (E = M.get(f)) == null || E(u[0], c)), s = f || null;
369
364
  }), {
370
- registerObject: t,
365
+ registerObject: r,
371
366
  deregisterObject: a
372
367
  };
373
- }, $ = H({}), ie = (e) => void Object.assign($.value, e);
374
- function et({
368
+ }, W = H({}), q = (e) => void Object.assign(W.value, e);
369
+ function tt({
375
370
  scene: e,
376
371
  canvas: n,
377
- windowSize: r,
372
+ windowSize: t,
378
373
  disableRender: a,
379
- rendererOptions: t
374
+ rendererOptions: r
380
375
  }) {
381
- const s = M(
382
- () => {
383
- var y;
384
- return d(r) ? He() : je((y = d(n)) == null ? void 0 : y.parentElement);
385
- }
386
- ), f = M(() => s.value.width.value), o = M(() => s.value.height.value), i = M(() => f.value / o.value), l = {
376
+ const i = _(
377
+ () => w(t) ? ze() : He(w(n).parentElement)
378
+ ), l = _(() => i.value.width.value), o = _(() => i.value.height.value), s = _(() => l.value / o.value), u = {
387
379
  height: o,
388
- width: f,
389
- aspectRatio: i
390
- }, {
391
- camera: u,
392
- cameras: c,
393
- addCamera: p,
394
- removeCamera: P,
395
- setCameraActive: L
396
- } = Ge({ sizes: l, scene: e }), { renderer: v } = Xe(
380
+ width: l,
381
+ aspectRatio: s
382
+ }, c = z(e), {
383
+ camera: f,
384
+ cameras: v,
385
+ addCamera: C,
386
+ removeCamera: M,
387
+ setCameraActive: d
388
+ } = je({ sizes: u, scene: e }), { renderer: g } = Ye(
397
389
  {
398
390
  scene: e,
399
391
  canvas: n,
400
- options: t,
401
- contextParts: { sizes: l, camera: u },
392
+ options: r,
393
+ contextParts: { sizes: u, camera: f },
402
394
  disableRender: a
403
395
  }
404
- ), C = {
405
- sizes: l,
406
- scene: e,
407
- camera: u,
408
- cameras: fe(c),
409
- renderer: v,
410
- raycaster: N(new Te()),
396
+ ), p = {
397
+ sizes: u,
398
+ scene: c,
399
+ camera: f,
400
+ cameras: ue(v),
401
+ renderer: g,
402
+ raycaster: z(new ke()),
411
403
  controls: H(null),
412
- extend: ie,
413
- addCamera: p,
414
- removeCamera: P,
415
- setCameraActive: L
404
+ extend: q,
405
+ addCamera: C,
406
+ removeCamera: M,
407
+ setCameraActive: d
416
408
  };
417
- return ee("useTres", C), C;
409
+ return I("useTres", p), p;
418
410
  }
419
- function tt() {
420
- const e = me("useTres");
411
+ function rt() {
412
+ const e = le("useTres");
421
413
  if (!e)
422
414
  throw new Error("useTresContext must be used together with useTresContextProvider");
423
415
  return e;
424
416
  }
425
- const dt = tt;
426
- let G = null, g = null;
427
- const { logError: Z } = k(), rt = {
428
- createElement(e, n, r, a) {
429
- var f, o;
430
- if (a || (a = {}), a.args || (a.args = []), e === "template" || Ie(e))
417
+ const yt = rt;
418
+ let G = null, y = null;
419
+ const { logError: Z } = T(), nt = {
420
+ createElement(e, n, t, a) {
421
+ var l, o;
422
+ if (a || (a = {}), a.args || (a.args = []), e === "template" || Ne(e))
431
423
  return null;
432
- let t = e.replace("Tres", ""), s;
424
+ let r = e.replace("Tres", ""), i;
433
425
  if (e === "primitive") {
434
426
  (a == null ? void 0 : a.object) === void 0 && Z("Tres primitives need a prop 'object'");
435
- const i = a.object;
436
- t = i.type, s = Object.assign(i, { type: t, attach: a.attach, primitive: !0 });
427
+ const s = a.object;
428
+ r = s.type, i = Object.assign(s, { type: r, attach: a.attach, primitive: !0 });
437
429
  } else {
438
- const i = $.value[t];
439
- i || Z(`${t} is not defined on the THREE namespace. Use extend to add it to the catalog.`), s = new i(...a.args);
430
+ const s = W.value[r];
431
+ s || Z(`${r} is not defined on the THREE namespace. Use extend to add it to the catalog.`), i = new s(...a.args);
440
432
  }
441
- return s.isCamera && (a != null && a.position || s.position.set(3, 3, 3), a != null && a.lookAt || s.lookAt(0, 0, 0)), (a == null ? void 0 : a.attach) === void 0 && (s.isMaterial ? s.attach = "material" : s.isBufferGeometry && (s.attach = "geometry")), s.isObject3D && ((f = a == null ? void 0 : a.material) != null && f.isMaterial && (s.userData.tres__materialViaProp = !0), (o = a == null ? void 0 : a.geometry) != null && o.isBufferGeometry && (s.userData.tres__geometryViaProp = !0)), s.userData || (s.userData = {}), s.userData.tres__name = t, s;
433
+ return i.isCamera && (a != null && a.position || i.position.set(3, 3, 3), a != null && a.lookAt || i.lookAt(0, 0, 0)), (a == null ? void 0 : a.attach) === void 0 && (i.isMaterial ? i.attach = "material" : i.isBufferGeometry && (i.attach = "geometry")), i.isObject3D && ((l = a == null ? void 0 : a.material) != null && l.isMaterial && (i.userData.tres__materialViaProp = !0), (o = a == null ? void 0 : a.geometry) != null && o.isBufferGeometry && (i.userData.tres__geometryViaProp = !0)), i.userData = {
434
+ ...i.userData,
435
+ tres__name: r
436
+ }, i;
442
437
  },
443
438
  insert(e, n) {
444
- var r, a, t, s, f, o, i, l, u;
445
- if (n && n.isScene && (g = n), (((r = e == null ? void 0 : e.__vnode) == null ? void 0 : r.type) === "TresGroup" || ((a = e == null ? void 0 : e.__vnode) == null ? void 0 : a.type) === "TresObject3D") && n === null && !((s = (t = e == null ? void 0 : e.__vnode) == null ? void 0 : t.ctx) != null && s.asyncResolved)) {
439
+ var t, a, r, i, l, o, s, u, c;
440
+ if (n && n.isScene && (y = n), (((t = e == null ? void 0 : e.__vnode) == null ? void 0 : t.type) === "TresGroup" || ((a = e == null ? void 0 : e.__vnode) == null ? void 0 : a.type) === "TresObject3D") && n === null && !((i = (r = e == null ? void 0 : e.__vnode) == null ? void 0 : r.ctx) != null && i.asyncResolved)) {
446
441
  G = e;
447
442
  return;
448
443
  } else
449
- (f = e == null ? void 0 : e.__vnode) != null && f.type.includes("Controls") && n === null && (G = g);
444
+ (l = e == null ? void 0 : e.__vnode) != null && l.type.includes("Controls") && n === null && (G = y);
450
445
  if (n || (n = G), e != null && e.isObject3D) {
451
446
  if (e != null && e.isCamera) {
452
- if (!(g != null && g.userData.tres__registerCamera))
447
+ if (!(y != null && y.userData.tres__registerCamera))
453
448
  throw "could not find tres__registerCamera on scene's userData";
454
- (i = g == null ? void 0 : (o = g.userData).tres__registerCamera) == null || i.call(o, e);
449
+ (s = y == null ? void 0 : (o = y.userData).tres__registerCamera) == null || s.call(o, e);
455
450
  }
456
451
  if (e != null && e.onClick || e != null && e.onPointerMove || e != null && e.onPointerEnter || e != null && e.onPointerLeave) {
457
- if (!(g != null && g.userData.tres__registerAtPointerEventHandler))
452
+ if (!(y != null && y.userData.tres__registerAtPointerEventHandler))
458
453
  throw "could not find tres__registerAtPointerEventHandler on scene's userData";
459
- (u = g == null ? void 0 : (l = g.userData).tres__registerAtPointerEventHandler) == null || u.call(l, e);
454
+ (c = y == null ? void 0 : (u = y.userData).tres__registerAtPointerEventHandler) == null || c.call(u, e);
460
455
  }
461
456
  }
462
457
  e != null && e.isObject3D && (n != null && n.isObject3D) ? (n.add(e), e.dispatchEvent({ type: "added" })) : e != null && e.isFog ? n.fog = e : typeof (e == null ? void 0 : e.attach) == "string" && (e.__previousAttach = e[n == null ? void 0 : n.attach], n && (n[e.attach] = e));
463
458
  },
464
459
  remove(e) {
465
- var n, r;
460
+ var n, t;
466
461
  if (e) {
467
462
  if (e.isObject3D) {
468
- const a = e, t = (i) => {
469
- var u, c;
470
- const l = i;
471
- i.userData.tres__materialViaProp || (u = l.material) == null || u.dispose(), i.userData.tres__geometryViaProp || (c = l.geometry) == null || c.dispose();
472
- }, s = g == null ? void 0 : g.userData.tres__deregisterAtPointerEventHandler, f = (i) => {
473
- if (!s)
463
+ const a = e, r = (s) => {
464
+ var c, f;
465
+ const u = s;
466
+ s.userData.tres__materialViaProp || (c = u.material) == null || c.dispose(), s.userData.tres__geometryViaProp || (f = u.geometry) == null || f.dispose();
467
+ }, i = y == null ? void 0 : y.userData.tres__deregisterAtPointerEventHandler, l = (s) => {
468
+ if (!i)
474
469
  throw "could not find tres__deregisterAtPointerEventHandler on scene's userData";
475
- (i != null && i.onClick || i != null && i.onPointerMove || i != null && i.onPointerEnter || i != null && i.onPointerLeave) && (s == null || s(i));
476
- }, o = (i) => {
477
- const l = g == null ? void 0 : g.userData.tres__deregisterCamera;
478
- if (!l)
470
+ (s != null && s.onClick || s != null && s.onPointerMove || s != null && s.onPointerEnter || s != null && s.onPointerLeave) && (i == null || i(s));
471
+ }, o = (s) => {
472
+ const u = y == null ? void 0 : y.userData.tres__deregisterCamera;
473
+ if (!u)
479
474
  throw "could not find tres__deregisterCamera on scene's userData";
480
- i.isCamera && (l == null || l(i));
475
+ s.isCamera && (u == null || u(s));
481
476
  };
482
- a.traverse((i) => {
483
- t(i), o(i), f == null || f(i);
484
- }), t(a), o(a), f == null || f(a);
477
+ a.traverse((s) => {
478
+ r(s), o(s), l == null || l(s);
479
+ }), r(a), o(a), l == null || l(a);
485
480
  }
486
- (n = e.removeFromParent) == null || n.call(e), (r = e.dispose) == null || r.call(e);
481
+ (n = e.removeFromParent) == null || n.call(e), (t = e.dispose) == null || t.call(e);
487
482
  }
488
483
  },
489
- patchProp(e, n, r, a) {
484
+ patchProp(e, n, t, a) {
490
485
  if (e) {
491
- let t = e, s = n, f = S(s), o = t == null ? void 0 : t[f];
492
- if (s === "args") {
493
- const l = e, u = r ?? [], c = a ?? [], p = e.userData.tres__name || e.type;
494
- console.log("replacing", {
495
- instanceName: p,
496
- args: c,
497
- prevArgs: u,
498
- diff: !X(u, c)
499
- }), p && !X(u, c) && (t = Object.assign(l, new $.value[p](...a)));
486
+ let r = e, i = n, l = O(i), o = r == null ? void 0 : r[l];
487
+ if (i === "args") {
488
+ const u = e, c = t ?? [], f = a ?? [], v = e.userData.tres__name || e.type;
489
+ v && c.length && !Je(c, f) && (r = Object.assign(u, new W.value[v](...a)));
500
490
  return;
501
491
  }
502
- if (t.type === "BufferGeometry") {
503
- if (s === "args")
492
+ if (r.type === "BufferGeometry") {
493
+ if (i === "args")
504
494
  return;
505
- t.setAttribute(
506
- S(s),
507
- new be(...a)
495
+ r.setAttribute(
496
+ O(i),
497
+ new Te(...a)
508
498
  );
509
499
  return;
510
500
  }
511
- if (s.includes("-") && o === void 0) {
512
- const l = s.split("-");
513
- o = l.reduce((u, c) => u[S(c)], t), s = l.pop(), f = s.toLowerCase(), o != null && o.set || (t = l.reduce((u, c) => u[S(c)], t));
501
+ if (i.includes("-") && o === void 0) {
502
+ const u = i.split("-");
503
+ o = u.reduce((c, f) => c[O(f)], r), i = u.pop(), l = i.toLowerCase(), o != null && o.set || (r = u.reduce((c, f) => c[O(f)], r));
514
504
  }
515
- let i = a;
516
- if (i === "" && (i = !0), Q(o)) {
517
- Array.isArray(i) ? e[f](...i) : e[f](i);
505
+ let s = a;
506
+ if (s === "" && (s = !0), Q(o)) {
507
+ Array.isArray(s) ? e[l](...s) : e[l](s);
518
508
  return;
519
509
  }
520
- !(o != null && o.set) && !Q(o) ? t[f] = i : o.constructor === i.constructor && (o != null && o.copy) ? o == null || o.copy(i) : Array.isArray(i) ? o.set(...i) : !o.isColor && o.setScalar ? o.setScalar(i) : o.set(i);
510
+ !(o != null && o.set) && !Q(o) ? r[l] = s : o.constructor === s.constructor && (o != null && o.copy) ? o == null || o.copy(s) : Array.isArray(s) ? o.set(...s) : !o.isColor && o.setScalar ? o.setScalar(s) : o.set(s);
521
511
  }
522
512
  },
523
513
  parentNode(e) {
@@ -532,9 +522,9 @@ const { logError: Z } = k(), rt = {
532
522
  setScopeId: () => void 0,
533
523
  cloneNode: () => void 0,
534
524
  insertStaticContent: () => void 0
535
- }, { render: nt } = pe(rt);
536
- ie(Ce);
537
- const at = ["data-scene"], ot = /* @__PURE__ */ q({
525
+ }, { render: at } = ce(nt);
526
+ q(ye);
527
+ const ot = ["data-scene"], st = /* @__PURE__ */ U({
538
528
  __name: "TresCanvas",
539
529
  props: {
540
530
  shadows: { type: Boolean },
@@ -561,89 +551,95 @@ const at = ["data-scene"], ot = /* @__PURE__ */ q({
561
551
  failIfMajorPerformanceCaveat: { type: Boolean }
562
552
  },
563
553
  setup(e) {
564
- const n = e, { logWarning: r } = k(), a = H(), t = N(new Se());
554
+ const n = e, { logWarning: t } = T(), a = H(), r = z(new be());
565
555
  ne();
566
- const s = ve(), f = M(() => n.disableRender), o = et({
567
- scene: t,
568
- canvas: a,
569
- windowSize: M(() => n.windowSize),
570
- disableRender: f,
571
- rendererOptions: n
572
- });
573
- Ze({ scene: t.value, contextParts: o });
574
- const i = q({
556
+ const i = fe(), l = (u) => U({
575
557
  setup() {
576
- return ee("useTres", o), () => U(ge, null, s && s.default ? s.default() : []);
558
+ return I("useTres", u), I("extend", q), () => J(ge, null, i != null && i.default ? i.default() : []);
577
559
  }
578
- }), l = () => {
579
- const c = t.value;
580
- nt(U(i), c), z(t);
581
- };
582
- V(a, (c) => {
583
- c && (l(), !o.camera.value && !n.camera && (r(
560
+ }), o = (u) => {
561
+ const c = l(u);
562
+ at(J(c), r.value);
563
+ }, s = _(() => n.disableRender);
564
+ return me(() => {
565
+ const u = a, c = tt({
566
+ scene: r.value,
567
+ canvas: u,
568
+ windowSize: n.windowSize,
569
+ disableRender: s,
570
+ rendererOptions: n
571
+ });
572
+ et({ scene: r.value, contextParts: c });
573
+ const { addCamera: f, camera: v, cameras: C, removeCamera: M } = c;
574
+ o(c);
575
+ const d = () => {
576
+ const g = new V(45, window.innerWidth / window.innerHeight, 0.1, 1e3);
577
+ g.position.set(3, 3, 3), g.lookAt(0, 0, 0), f(g);
578
+ const p = L(
579
+ () => {
580
+ C.value.length >= 2 && (g.removeFromParent(), M(g), p == null || p());
581
+ }
582
+ );
583
+ };
584
+ ee(() => n.camera, (g, p) => {
585
+ g ? f(g) : p && (p.removeFromParent(), M(p));
586
+ }, {
587
+ immediate: !0
588
+ }), v.value || (t(
584
589
  "No camera found. Creating a default perspective camera. To have full control over a camera, please add one to the scene."
585
- ), u()));
586
- }), V(() => n.camera, (c, p) => {
587
- c ? o.addCamera(c, !0) : p && (p.removeFromParent(), o.removeCamera(p));
588
- }, {
589
- immediate: !0
590
- });
591
- const u = () => {
592
- const c = new W(45, window.innerWidth / window.innerHeight, 0.1, 1e3);
593
- c.position.set(3, 3, 3), c.lookAt(0, 0, 0), o.addCamera(c), o.cameras.value.length >= 2 && (c.removeFromParent(), o.removeCamera(c));
594
- };
595
- return (c, p) => (de(), ye("canvas", {
590
+ ), d());
591
+ }), (u, c) => (pe(), ve("canvas", {
596
592
  ref_key: "canvas",
597
593
  ref: a,
598
- "data-scene": t.value.uuid,
599
- style: we({
594
+ "data-scene": r.value.uuid,
595
+ style: de({
600
596
  display: "block",
601
597
  width: "100%",
602
598
  height: "100%",
603
- position: c.windowSize ? "fixed" : "relative",
599
+ position: u.windowSize ? "fixed" : "relative",
604
600
  top: 0,
605
601
  left: 0,
606
602
  pointerEvents: "auto",
607
603
  touchAction: "none",
608
604
  zIndex: 1
609
605
  })
610
- }, null, 12, at));
606
+ }, null, 12, ot));
611
607
  }
612
- }), st = [
608
+ }), it = [
613
609
  "TresCanvas",
614
610
  "TresLeches",
615
611
  "TresScene"
616
- ], it = {
612
+ ], ut = {
617
613
  template: {
618
614
  compilerOptions: {
619
- isCustomElement: (e) => e.startsWith("Tres") && !st.includes(e) || e === "primitive"
615
+ isCustomElement: (e) => e.startsWith("Tres") && !it.includes(e) || e === "primitive"
620
616
  }
621
617
  }
622
- }, yt = it, wt = {
618
+ }, wt = ut, Ct = {
623
619
  install(e) {
624
- e.component("TresCanvas", ot);
620
+ e.component("TresCanvas", st);
625
621
  }
626
622
  };
627
623
  export {
628
- ot as TresCanvas,
629
- $ as catalogue,
630
- wt as default,
631
- ie as extend,
632
- ft as isProd,
624
+ st as TresCanvas,
625
+ W as catalogue,
626
+ Ct as default,
627
+ q as extend,
628
+ mt as isProd,
633
629
  Ke as normalizeColor,
634
- mt as normalizeVectorFlexibleParam,
635
- yt as templateCompilerOptions,
636
- Ye as trasverseObjects,
637
- Ge as useCamera,
638
- pt as useLoader,
639
- k as useLogger,
640
- Ze as usePointerEventHandler,
641
- Qe as useRaycaster,
630
+ pt as normalizeVectorFlexibleParam,
631
+ wt as templateCompilerOptions,
632
+ Qe as trasverseObjects,
633
+ je as useCamera,
634
+ vt as useLoader,
635
+ T as useLogger,
636
+ et as usePointerEventHandler,
637
+ Ze as useRaycaster,
642
638
  ne as useRenderLoop,
643
- Xe as useRenderer,
639
+ Ye as useRenderer,
644
640
  gt as useSeek,
645
- vt as useTexture,
646
- dt as useTres,
647
- tt as useTresContext,
648
- et as useTresContextProvider
641
+ dt as useTexture,
642
+ yt as useTres,
643
+ rt as useTresContext,
644
+ tt as useTresContextProvider
649
645
  };