@tresjs/core 2.3.0 → 2.4.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/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export * from './core/catalogue';
4
4
  export * from './components';
5
5
  export * from './types';
6
6
  import { normalizeColor, normalizeVectorFlexibleParam } from './utils/normalize';
7
+ import templateCompilerOptions from './utils/template-compiler-options';
7
8
  export interface TresOptions {
8
9
  extends?: Record<string, unknown>;
9
10
  }
@@ -13,4 +14,4 @@ export interface TresPlugin {
13
14
  }
14
15
  declare const plugin: TresPlugin;
15
16
  export default plugin;
16
- export { normalizeColor, normalizeVectorFlexibleParam };
17
+ export { normalizeColor, normalizeVectorFlexibleParam, templateCompilerOptions };
package/dist/tres.js CHANGED
@@ -1,15 +1,15 @@
1
1
  /**
2
2
  * name: @tresjs/core
3
- * version: v2.3.0
3
+ * version: v2.4.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 { ref as V, shallowReactive as ce, toRefs as ue, provide as Te, inject as Le, watchEffect as fe, toRef as _e, shallowRef as Ae, computed as G, watch as D, onUnmounted as le, reactive as Se, createRenderer as Oe, defineComponent as de, onMounted as ke, h as L } from "vue";
8
+ import { ref as G, shallowReactive as ce, toRefs as ue, provide as xe, inject as Le, watchEffect as fe, toRef as _e, shallowRef as Se, computed as A, watch as I, onUnmounted as le, reactive as Ae, createRenderer as Oe, defineComponent as de, onMounted as ke, h as _ } from "vue";
9
9
  import * as q from "three";
10
- import { PerspectiveCamera as z, OrthographicCamera as je, Clock as pe, Vector3 as De, Color as W, SRGBColorSpace as Ie, ACESFilmicToneMapping as Be, PCFSoftShadowMap as He, PCFShadowMap as Ve, LinearSRGBColorSpace as ae, NoToneMapping as ne, WebGLRenderer as Ge, LoadingManager as Fe, TextureLoader as Ne, Raycaster as ze, Vector2 as We, BufferAttribute as Ue } from "three";
11
- import { createEventHook as A, useRafFn as Ye, toValue as m, useWindowSize as $e, useElementSize as qe, useDevicePixelRatio as Ke, unrefElement as U, usePointer as Je, useElementBounding as Xe } from "@vueuse/core";
12
- const me = V({}), ve = (e) => void Object.assign(me.value, e), re = (e) => typeof e == "function", ge = (e) => !!e && e.constructor === Array, b = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "0a", "0b", "0c", "0d", "0e", "0f", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1a", "1b", "1c", "1d", "1e", "1f", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "2a", "2b", "2c", "2d", "2e", "2f", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "3a", "3b", "3c", "3d", "3e", "3f", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "4a", "4b", "4c", "4d", "4e", "4f", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "5a", "5b", "5c", "5d", "5e", "5f", "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "6a", "6b", "6c", "6d", "6e", "6f", "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "7a", "7b", "7c", "7d", "7e", "7f", "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "8a", "8b", "8c", "8d", "8e", "8f", "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", "9a", "9b", "9c", "9d", "9e", "9f", "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "aa", "ab", "ac", "ad", "ae", "af", "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8", "b9", "ba", "bb", "bc", "bd", "be", "bf", "c0", "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "ca", "cb", "cc", "cd", "ce", "cf", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "da", "db", "dc", "dd", "de", "df", "e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7", "e8", "e9", "ea", "eb", "ec", "ed", "ee", "ef", "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "fa", "fb", "fc", "fd", "fe", "ff"];
10
+ import { PerspectiveCamera as z, OrthographicCamera as De, Clock as pe, Vector3 as je, Color as W, SRGBColorSpace as Ie, ACESFilmicToneMapping as Be, PCFSoftShadowMap as He, PCFShadowMap as Ve, LinearSRGBColorSpace as ae, NoToneMapping as ne, WebGLRenderer as Ge, LoadingManager as Fe, TextureLoader as Ne, Raycaster as ze, Vector2 as We, BufferAttribute as $e } from "three";
11
+ import { createEventHook as O, useRafFn as Ue, toValue as m, useWindowSize as Ye, useElementSize as qe, useDevicePixelRatio as Ke, unrefElement as $, usePointer as Je, useElementBounding as Xe } from "@vueuse/core";
12
+ const me = G({}), ve = (e) => void Object.assign(me.value, e), re = (e) => typeof e == "function", ge = (e) => !!e && e.constructor === Array, b = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "0a", "0b", "0c", "0d", "0e", "0f", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1a", "1b", "1c", "1d", "1e", "1f", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "2a", "2b", "2c", "2d", "2e", "2f", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "3a", "3b", "3c", "3d", "3e", "3f", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "4a", "4b", "4c", "4d", "4e", "4f", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "5a", "5b", "5c", "5d", "5e", "5f", "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "6a", "6b", "6c", "6d", "6e", "6f", "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "7a", "7b", "7c", "7d", "7e", "7f", "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "8a", "8b", "8c", "8d", "8e", "8f", "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", "9a", "9b", "9c", "9d", "9e", "9f", "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "aa", "ab", "ac", "ad", "ae", "af", "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8", "b9", "ba", "bb", "bc", "bd", "be", "bf", "c0", "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "ca", "cb", "cc", "cd", "ce", "cf", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "da", "db", "dc", "dd", "de", "df", "e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7", "e8", "e9", "ea", "eb", "ec", "ed", "ee", "ef", "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "fa", "fb", "fc", "fd", "fe", "ff"];
13
13
  function Qe() {
14
14
  const e = Math.random() * 4294967295 | 0, t = Math.random() * 4294967295 | 0, n = Math.random() * 4294967295 | 0, a = Math.random() * 4294967295 | 0;
15
15
  return (b[e & 255] + b[e >> 8 & 255] + b[e >> 16 & 255] + b[e >> 24 & 255] + "-" + b[t & 255] + b[t >> 8 & 255] + "-" + b[t >> 16 & 15 | 64] + b[t >> 24 & 255] + "-" + b[n & 63 | 128] + b[n >> 8 & 255] + "-" + b[n >> 16 & 255] + b[n >> 24 & 255] + b[a & 255] + b[a >> 8 & 255] + b[a >> 16 & 255] + b[a >> 24 & 255]).toLowerCase();
@@ -29,8 +29,8 @@ function Ze() {
29
29
  function t(o) {
30
30
  return e[o];
31
31
  }
32
- function n(o, i) {
33
- e[o] = i;
32
+ function n(o, s) {
33
+ e[o] = s;
34
34
  }
35
35
  const a = {
36
36
  state: e,
@@ -38,9 +38,9 @@ function Ze() {
38
38
  getState: t,
39
39
  setState: n
40
40
  };
41
- return Te(K, a), a;
41
+ return xe(K, a), a;
42
42
  }
43
- const S = () => Le(K, {
43
+ const k = () => Le(K, {
44
44
  state: ce({
45
45
  camera: void 0,
46
46
  cameras: [],
@@ -52,20 +52,20 @@ const S = () => Le(K, {
52
52
  });
53
53
  var et = /* @__PURE__ */ ((e) => (e.Perspective = "Perspective", e.Orthographic = "Orthographic", e))(et || {});
54
54
  const tt = 45;
55
- let R;
55
+ let x;
56
56
  function at() {
57
- const { state: e, setState: t, aspectRatio: n } = S();
58
- function a(s = "Perspective", c) {
59
- var l, d, p;
60
- if (s === "Perspective") {
61
- const { near: y, far: h, fov: v } = c || {
57
+ const { state: e, setState: t, aspectRatio: n } = k();
58
+ function a(i = "Perspective", u) {
59
+ var l, p, d;
60
+ if (i === "Perspective") {
61
+ const { near: E, far: y, fov: h } = u || {
62
62
  near: 0.1,
63
63
  far: 1e3,
64
64
  fov: tt
65
65
  };
66
- R = new z(v, ((l = e.aspectRatio) == null ? void 0 : l.value) || window.innerWidth / window.innerHeight, y, h), (d = e.cameras) == null || d.push(R);
66
+ x = new z(h, ((l = e.aspectRatio) == null ? void 0 : l.value) || window.innerWidth / window.innerHeight, E, y), (p = e.cameras) == null || p.push(x);
67
67
  } else {
68
- const { left: y, right: h, top: v, bottom: M, near: w, far: E } = c || {
68
+ const { left: E, right: y, top: h, bottom: w, near: C, far: g } = u || {
69
69
  left: -100,
70
70
  right: 100,
71
71
  top: 100,
@@ -73,21 +73,21 @@ function at() {
73
73
  near: 0.1,
74
74
  far: 1e3
75
75
  };
76
- R = new je(y, h, v, M, w, E), (p = e.cameras) == null || p.push(R);
76
+ x = new De(E, y, h, w, C, g), (d = e.cameras) == null || d.push(x);
77
77
  }
78
- return e.camera = R, t("camera", e.camera), R;
78
+ return e.camera = x, t("camera", e.camera), x;
79
79
  }
80
80
  function o() {
81
- var s;
82
- e.camera instanceof z && e.aspectRatio && (e.camera.aspect = e.aspectRatio.value), (s = e.camera) == null || s.updateProjectionMatrix();
81
+ var i;
82
+ e.camera instanceof z && e.aspectRatio && (e.camera.aspect = e.aspectRatio.value), (i = e.camera) == null || i.updateProjectionMatrix();
83
83
  }
84
- function i(s) {
85
- var c;
86
- (c = e.cameras) == null || c.push(s), s instanceof z && e.aspectRatio && (s.aspect = e.aspectRatio.value), s.updateProjectionMatrix(), t("camera", s);
84
+ function s(i) {
85
+ var u;
86
+ (u = e.cameras) == null || u.push(i), i instanceof z && e.aspectRatio && (i.aspect = e.aspectRatio.value), i.updateProjectionMatrix(), t("camera", i);
87
87
  }
88
- function u(s) {
89
- var c;
90
- ((c = e.cameras) == null ? void 0 : c.length) === 0 && i(s);
88
+ function c(i) {
89
+ var u;
90
+ ((u = e.cameras) == null ? void 0 : u.length) === 0 && s(i);
91
91
  }
92
92
  function r() {
93
93
  e.cameras = [];
@@ -98,21 +98,21 @@ function at() {
98
98
  activeCamera: _e(e, "camera"),
99
99
  createCamera: a,
100
100
  updateCamera: o,
101
- pushCamera: i,
101
+ pushCamera: s,
102
102
  clearCameras: r,
103
- setFirstCamera: u
103
+ setFirstCamera: c
104
104
  };
105
105
  }
106
- const we = A(), be = A(), J = A(), _ = new pe();
107
- let I = 0, B = 0;
108
- const { pause: nt, resume: rt, isActive: ot } = Ye(
106
+ const we = O(), be = O(), J = O(), S = new pe();
107
+ let B = 0, H = 0;
108
+ const { pause: nt, resume: rt, isActive: ot } = Ue(
109
109
  () => {
110
- we.trigger({ delta: I, elapsed: B, clock: _ }), be.trigger({ delta: I, elapsed: B, clock: _ }), J.trigger({ delta: I, elapsed: B, clock: _ });
110
+ we.trigger({ delta: B, elapsed: H, clock: S }), be.trigger({ delta: B, elapsed: H, clock: S }), J.trigger({ delta: B, elapsed: H, clock: S });
111
111
  },
112
112
  { immediate: !1 }
113
113
  );
114
114
  J.on(() => {
115
- I = _.getDelta(), B = _.getElapsedTime();
115
+ B = S.getDelta(), H = S.getElapsedTime();
116
116
  });
117
117
  function he() {
118
118
  return {
@@ -124,13 +124,13 @@ function he() {
124
124
  isActive: ot
125
125
  };
126
126
  }
127
- function Pt(e) {
128
- return typeof e == "number" ? [e, e, e] : e instanceof De ? [e.x, e.y, e.z] : e;
127
+ function Rt(e) {
128
+ return typeof e == "number" ? [e, e, e] : e instanceof je ? [e.x, e.y, e.z] : e;
129
129
  }
130
130
  function it(e) {
131
131
  return e instanceof W ? e : Array.isArray(e) ? new W(...e) : new W(e);
132
132
  }
133
- const Y = {
133
+ const U = {
134
134
  realistic: {
135
135
  outputColorSpace: Ie,
136
136
  toneMapping: Be,
@@ -157,12 +157,12 @@ function ut(e, t) {
157
157
  const ft = (e, t) => {
158
158
  const n = /* @__PURE__ */ new Set(), a = [];
159
159
  for (const o of e) {
160
- const i = t(o);
161
- n.has(i) || (n.add(i), a.push(o));
160
+ const s = t(o);
161
+ n.has(s) || (n.add(s), a.push(o));
162
162
  }
163
163
  return a;
164
- }, xt = !0, oe = "[TresJS ▲ ■ ●] ";
165
- function O() {
164
+ }, Tt = !0, oe = "[TresJS ▲ ■ ●] ";
165
+ function D() {
166
166
  function e(a, o) {
167
167
  console.error(`${oe} ${a}`, o || "");
168
168
  }
@@ -178,31 +178,31 @@ function O() {
178
178
  };
179
179
  }
180
180
  function lt(e) {
181
- const t = Ae(), n = V(!1), {
181
+ const t = Se(), n = G(!1), {
182
182
  alpha: a = !0,
183
183
  antialias: o = !0,
184
- depth: i,
185
- logarithmicDepthBuffer: u,
184
+ depth: s,
185
+ logarithmicDepthBuffer: c,
186
186
  failIfMajorPerformanceCaveat: r,
187
- precision: s,
188
- premultipliedAlpha: c,
187
+ precision: i,
188
+ premultipliedAlpha: u,
189
189
  stencil: l,
190
- shadows: d = !1,
191
- shadowMapType: p = Ve,
192
- useLegacyLights: y = !1,
193
- outputColorSpace: h = ae,
194
- toneMapping: v = ne,
195
- toneMappingExposure: M = 1,
196
- context: w = void 0,
197
- powerPreference: E = "default",
198
- preserveDrawingBuffer: k = !1,
199
- clearColor: x,
200
- windowSize: C = !1,
190
+ shadows: p = !1,
191
+ shadowMapType: d = Ve,
192
+ useLegacyLights: E = !1,
193
+ outputColorSpace: y = ae,
194
+ toneMapping: h = ne,
195
+ toneMappingExposure: w = 1,
196
+ context: C = void 0,
197
+ powerPreference: g = "default",
198
+ preserveDrawingBuffer: M = !1,
199
+ clearColor: R,
200
+ windowSize: T = !1,
201
201
  preset: F = void 0
202
- } = ue(e), { state: f, setState: g } = S(), { width: X, height: Q } = m(C) == !0 || m(C) === "" || m(C) === "true" ? $e() : qe(f.container), { logError: Ee, logWarning: Me } = O(), { pixelRatio: Z } = Ke(), { pause: Pe, resume: xe } = he(), N = G(() => X.value / Q.value);
202
+ } = ue(e), { state: f, setState: v } = k(), { width: X, height: Q } = m(T) == !0 || m(T) === "" || m(T) === "true" ? Ye() : qe(f.container), { logError: Ee, logWarning: Me } = D(), { pixelRatio: Z } = Ke(), { pause: Pe, resume: Ce } = he(), N = A(() => X.value / Q.value);
203
203
  setTimeout(() => {
204
204
  var P;
205
- !m(C) && !((P = f.canvas) != null && P.value.offsetHeight) && Me(`Oops... Seems like your canvas height is currently 0px, it's posible that you couldn't watch your scene.
205
+ !m(T) && !((P = f.canvas) != null && P.value.offsetHeight) && Me(`Oops... Seems like your canvas height is currently 0px, it's posible that you couldn't watch your scene.
206
206
  You could set windowSize=true to force the canvas to be the size of the window.`);
207
207
  }, 1e3);
208
208
  const ee = () => {
@@ -212,42 +212,42 @@ function lt(e) {
212
212
  return;
213
213
  const P = m(F);
214
214
  if (P) {
215
- P in Y || Ee("Renderer Preset must be one of these: " + Object.keys(Y).join(", ")), ye(t.value, Y[P]);
215
+ P in U || Ee("Renderer Preset must be one of these: " + Object.keys(U).join(", ")), ye(t.value, U[P]);
216
216
  return;
217
217
  }
218
- t.value.shadowMap.enabled = m(d), t.value.shadowMap.type = m(p), t.value.toneMapping = m(v) || ne, t.value.toneMappingExposure = m(M), t.value.outputColorSpace = m(h) || ae, x != null && x.value && t.value.setClearColor(it(m(x))), t.value.useLegacyLights = m(y);
219
- }, Ce = () => {
220
- const P = U(f.canvas);
218
+ t.value.shadowMap.enabled = m(p), t.value.shadowMap.type = m(d), t.value.toneMapping = m(h) || ne, t.value.toneMappingExposure = m(w), t.value.outputColorSpace = m(y) || ae, R != null && R.value && t.value.setClearColor(it(m(R))), t.value.useLegacyLights = m(E);
219
+ }, Re = () => {
220
+ const P = $(f.canvas);
221
221
  P && (t.value = new Ge({
222
222
  canvas: P,
223
223
  alpha: m(a),
224
224
  antialias: m(o),
225
- context: m(w),
226
- depth: m(i),
225
+ context: m(C),
226
+ depth: m(s),
227
227
  failIfMajorPerformanceCaveat: m(r),
228
- logarithmicDepthBuffer: m(u),
229
- powerPreference: m(E),
230
- precision: m(s),
228
+ logarithmicDepthBuffer: m(c),
229
+ powerPreference: m(g),
230
+ precision: m(i),
231
231
  stencil: m(l),
232
- preserveDrawingBuffer: m(k),
233
- premultipliedAlpha: m(c)
234
- }), g("renderer", t.value), g("clock", new pe()), g("aspectRatio", N), te(), ee(), xe(), n.value = !0);
235
- }, Re = () => {
232
+ preserveDrawingBuffer: m(M),
233
+ premultipliedAlpha: m(u)
234
+ }), v("renderer", t.value), v("clock", new pe()), v("aspectRatio", N), te(), ee(), Ce(), n.value = !0);
235
+ }, Te = () => {
236
236
  t.value && (t.value.dispose(), t.value = void 0, n.value = !1, Pe());
237
237
  };
238
- return D([N, Z], ee), D(
239
- [d, p, h, y, v, M, x],
238
+ return I([N, Z], ee), I(
239
+ [p, d, y, E, h, w, R],
240
240
  te
241
- ), D(
241
+ ), I(
242
242
  () => [f.canvas, f.container],
243
243
  () => {
244
- U(f.canvas) && U(f.container) && Ce();
244
+ $(f.canvas) && $(f.container) && Re();
245
245
  },
246
246
  { immediate: !0, deep: !0 }
247
247
  ), {
248
248
  renderer: t,
249
249
  isReady: n,
250
- dispose: Re,
250
+ dispose: Te,
251
251
  aspectRatio: N
252
252
  };
253
253
  }
@@ -257,109 +257,109 @@ function dt(e) {
257
257
  n.name && (t.nodes[n.name] = n), n.material && !t.materials[n.material.name] && (t.materials[n.material.name] = n.material);
258
258
  }), t;
259
259
  }
260
- async function Ct(e, t, n, a, o) {
261
- const { logError: i } = O(), u = new e();
262
- o && o(u), n && n(u);
263
- const s = (Array.isArray(t) ? t : [t]).map(
264
- (c) => new Promise((l, d) => {
265
- u.load(
266
- c,
267
- (p) => {
268
- p.scene && Object.assign(p, dt(p.scene)), l(p);
260
+ async function xt(e, t, n, a, o) {
261
+ const { logError: s } = D(), c = new e();
262
+ o && o(c), n && n(c);
263
+ const i = (Array.isArray(t) ? t : [t]).map(
264
+ (u) => new Promise((l, p) => {
265
+ c.load(
266
+ u,
267
+ (d) => {
268
+ d.scene && Object.assign(d, dt(d.scene)), l(d);
269
269
  },
270
270
  a,
271
- (p) => d(i("[useLoader] - Failed to load resource", p))
271
+ (d) => p(s("[useLoader] - Failed to load resource", d))
272
272
  );
273
273
  })
274
274
  );
275
- return ge(t) ? await Promise.all(s) : await s[0];
275
+ return ge(t) ? await Promise.all(i) : await i[0];
276
276
  }
277
- async function Rt(e) {
278
- const t = new Fe(), n = new Ne(t), a = (o) => new Promise((i, u) => {
277
+ async function Lt(e) {
278
+ const t = new Fe(), n = new Ne(t), a = (o) => new Promise((s, c) => {
279
279
  n.load(
280
280
  o,
281
- (r) => i(r),
281
+ (r) => s(r),
282
282
  () => null,
283
283
  () => {
284
- u(new Error("[useTextures] - Failed to load texture"));
284
+ c(new Error("[useTextures] - Failed to load texture"));
285
285
  }
286
286
  );
287
287
  });
288
288
  if (ge(e)) {
289
- const o = await Promise.all(e.map((i) => a(i)));
289
+ const o = await Promise.all(e.map((s) => a(s)));
290
290
  return e.length > 1 ? o : o[0];
291
291
  } else {
292
292
  const {
293
293
  map: o,
294
- displacementMap: i,
295
- normalMap: u,
294
+ displacementMap: s,
295
+ normalMap: c,
296
296
  roughnessMap: r,
297
- metalnessMap: s,
298
- aoMap: c,
297
+ metalnessMap: i,
298
+ aoMap: u,
299
299
  alphaMap: l,
300
- matcap: d
300
+ matcap: p
301
301
  } = e;
302
302
  return {
303
303
  map: o ? await a(o) : null,
304
- displacementMap: i ? await a(i) : null,
305
- normalMap: u ? await a(u) : null,
304
+ displacementMap: s ? await a(s) : null,
305
+ normalMap: c ? await a(c) : null,
306
306
  roughnessMap: r ? await a(r) : null,
307
- metalnessMap: s ? await a(s) : null,
308
- aoMap: c ? await a(c) : null,
307
+ metalnessMap: i ? await a(i) : null,
308
+ aoMap: u ? await a(u) : null,
309
309
  alphaMap: l ? await a(l) : null,
310
- matcap: d ? await a(d) : null
310
+ matcap: p ? await a(p) : null
311
311
  };
312
312
  }
313
313
  }
314
314
  const pt = (e) => {
315
- const { state: t } = S(), n = G(() => {
315
+ const { state: t } = k(), n = A(() => {
316
316
  var f;
317
317
  return (f = t.canvas) == null ? void 0 : f.value;
318
- }), { x: a, y: o } = Je({ target: n }), { width: i, height: u, top: r, left: s } = Xe(n), c = new ze(), l = ({ x: f, y: g }) => {
318
+ }), { x: a, y: o } = Je({ target: n }), { width: s, height: c, top: r, left: i } = Xe(n), u = new ze(), l = ({ x: f, y: v }) => {
319
319
  if (n.value)
320
320
  return {
321
- x: (f - s.value) / i.value * 2 - 1,
322
- y: -((g - r.value) / u.value) * 2 + 1
321
+ x: (f - i.value) / s.value * 2 - 1,
322
+ y: -((v - r.value) / c.value) * 2 + 1
323
323
  };
324
- }, d = ({ x: f, y: g }) => {
324
+ }, p = ({ x: f, y: v }) => {
325
325
  if (t.camera)
326
- return c.setFromCamera(new We(f, g), t.camera), c.intersectObjects(e.value, !1);
327
- }, p = (f) => {
328
- const g = l({
326
+ return u.setFromCamera(new We(f, v), t.camera), u.intersectObjects(e.value, !1);
327
+ }, d = (f) => {
328
+ const v = l({
329
329
  x: (f == null ? void 0 : f.clientX) ?? a.value,
330
330
  y: (f == null ? void 0 : f.clientY) ?? o.value
331
331
  });
332
- return g ? d(g) || [] : [];
333
- }, y = G(() => p()), h = A(), v = A(), M = (f, g) => {
334
- f.trigger({ event: g, intersects: p(g) });
335
- }, w = (f) => {
336
- M(v, f);
332
+ return v ? p(v) || [] : [];
333
+ }, E = A(() => d()), y = O(), h = O(), w = (f, v) => {
334
+ f.trigger({ event: v, intersects: d(v) });
335
+ }, C = (f) => {
336
+ w(h, f);
337
337
  };
338
- let E;
339
- const k = (f) => {
340
- var g;
341
- E = (g = p(f)[0]) == null ? void 0 : g.object;
342
- }, x = (f) => {
343
- var g;
344
- f instanceof PointerEvent && E === ((g = p(f)[0]) == null ? void 0 : g.object) && M(h, f);
345
- }, C = (f) => v.trigger({ event: f, intersects: [] }), F = fe(() => {
346
- n != null && n.value && (n.value.addEventListener("pointerup", x), n.value.addEventListener("pointerdown", k), n.value.addEventListener("pointermove", w), n.value.addEventListener("pointerleave", C), F());
338
+ let g;
339
+ const M = (f) => {
340
+ var v;
341
+ g = (v = d(f)[0]) == null ? void 0 : v.object;
342
+ }, R = (f) => {
343
+ var v;
344
+ f instanceof PointerEvent && g === ((v = d(f)[0]) == null ? void 0 : v.object) && w(y, f);
345
+ }, T = (f) => h.trigger({ event: f, intersects: [] }), F = fe(() => {
346
+ n != null && n.value && (n.value.addEventListener("pointerup", R), n.value.addEventListener("pointerdown", M), n.value.addEventListener("pointermove", C), n.value.addEventListener("pointerleave", T), F());
347
347
  });
348
348
  return le(() => {
349
- n != null && n.value && (n.value.removeEventListener("pointerup", x), n.value.removeEventListener("pointerdown", k), n.value.removeEventListener("pointermove", w), n.value.removeEventListener("pointerleave", C));
349
+ n != null && n.value && (n.value.removeEventListener("pointerup", R), n.value.removeEventListener("pointerdown", M), n.value.removeEventListener("pointermove", C), n.value.removeEventListener("pointerleave", T));
350
350
  }), {
351
- intersects: y,
352
- onClick: (f) => h.on(f).off,
353
- onPointerMove: (f) => v.on(f).off
351
+ intersects: E,
352
+ onClick: (f) => y.on(f).off,
353
+ onPointerMove: (f) => h.on(f).off
354
354
  };
355
355
  };
356
- function Tt() {
357
- const { logWarning: e } = O();
358
- function t(a, o, i) {
359
- let u = null;
356
+ function _t() {
357
+ const { logWarning: e } = D();
358
+ function t(a, o, s) {
359
+ let c = null;
360
360
  return a.traverse((r) => {
361
- r[o] === i && (u = r);
362
- }), u || e(`Child with ${o} '${i}' not found.`), u;
361
+ r[o] === s && (c = r);
362
+ }), c || e(`Child with ${o} '${s}' not found.`), c;
363
363
  }
364
364
  function n(a, o) {
365
365
  return t(a, "name", o);
@@ -370,83 +370,83 @@ function Tt() {
370
370
  };
371
371
  }
372
372
  const mt = () => {
373
- const e = Se({
373
+ const e = Ae({
374
374
  click: /* @__PURE__ */ new Map(),
375
375
  pointerMove: /* @__PURE__ */ new Map(),
376
376
  pointerEnter: /* @__PURE__ */ new Map(),
377
377
  pointerLeave: /* @__PURE__ */ new Map()
378
378
  }), t = (r) => {
379
- Object.values(e).forEach((s) => s.delete(r));
379
+ Object.values(e).forEach((i) => i.delete(r));
380
380
  }, n = (r) => {
381
- const { onClick: s, onPointerMove: c, onPointerEnter: l, onPointerLeave: d } = r;
382
- s && e.click.set(r, s), c && e.pointerMove.set(r, c), l && e.pointerEnter.set(r, l), d && e.pointerLeave.set(r, d), r.addEventListener("removed", () => {
383
- r.traverse((p) => {
384
- t(p);
381
+ const { onClick: i, onPointerMove: u, onPointerEnter: l, onPointerLeave: p } = r;
382
+ i && e.click.set(r, i), u && e.pointerMove.set(r, u), l && e.pointerEnter.set(r, l), p && e.pointerLeave.set(r, p), r.addEventListener("removed", () => {
383
+ r.traverse((d) => {
384
+ t(d);
385
385
  }), t(r);
386
386
  });
387
- }, a = G(
387
+ }, a = A(
388
388
  () => ft(
389
389
  Object.values(e).map((r) => Array.from(r.keys())).flat(),
390
390
  ({ uuid: r }) => r
391
391
  )
392
- ), { onClick: o, onPointerMove: i } = pt(a);
393
- o(({ intersects: r, event: s }) => {
394
- var c;
395
- r.length && ((c = e.click.get(r[0].object)) == null || c(r[0], s));
392
+ ), { onClick: o, onPointerMove: s } = pt(a);
393
+ o(({ intersects: r, event: i }) => {
394
+ var u;
395
+ r.length && ((u = e.click.get(r[0].object)) == null || u(r[0], i));
396
396
  });
397
- let u;
398
- return i(({ intersects: r, event: s }) => {
399
- var y, h, v, M;
400
- const c = (y = r == null ? void 0 : r[0]) == null ? void 0 : y.object, { pointerLeave: l, pointerEnter: d, pointerMove: p } = e;
401
- u && u !== c && ((h = l.get(u)) == null || h(u, s)), c && (u !== c && ((v = d.get(c)) == null || v(r[0], s)), (M = p.get(c)) == null || M(r[0], s)), u = c || null;
397
+ let c;
398
+ return s(({ intersects: r, event: i }) => {
399
+ var E, y, h, w;
400
+ const u = (E = r == null ? void 0 : r[0]) == null ? void 0 : E.object, { pointerLeave: l, pointerEnter: p, pointerMove: d } = e;
401
+ c && c !== u && ((y = l.get(c)) == null || y(c, i)), u && (c !== u && ((h = p.get(u)) == null || h(r[0], i)), (w = d.get(u)) == null || w(r[0], i)), c = u || null;
402
402
  }), {
403
403
  registerObject: n,
404
404
  deregisterObject: t
405
405
  };
406
- }, H = {
406
+ }, V = {
407
407
  GEOMETRY_VIA_PROP: "tres__geometryViaProp",
408
408
  MATERIAL_VIA_PROP: "tres__materialViaProp",
409
409
  REGISTER_AT_POINTER_EVENT_HANDLER: "tres__registerAtPointerEventHandler"
410
410
  };
411
- let $ = null, T = null;
412
- const { logError: ie } = O(), vt = {
411
+ let Y = null, L = null;
412
+ const { logError: ie } = D(), vt = {
413
413
  createElement(e, t, n, a) {
414
- var s, c;
414
+ var i, u;
415
415
  if (a || (a = {}), a.args || (a.args = []), e === "template" || ct(e))
416
416
  return null;
417
- let o = e.replace("Tres", ""), i;
417
+ let o = e.replace("Tres", ""), s;
418
418
  if (e === "primitive") {
419
419
  (a == null ? void 0 : a.object) === void 0 && ie("Tres primitives need a prop 'object'");
420
420
  const l = a.object;
421
- o = l.type, i = Object.assign(l, { type: o, attach: a.attach, primitive: !0 });
421
+ o = l.type, s = Object.assign(l, { type: o, attach: a.attach, primitive: !0 });
422
422
  } else {
423
423
  const l = me.value[o];
424
- l || ie(`${o} is not defined on the THREE namespace. Use extend to add it to the catalog.`), i = new l(...a.args);
424
+ l || ie(`${o} is not defined on the THREE namespace. Use extend to add it to the catalog.`), s = new l(...a.args);
425
425
  }
426
- 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"));
427
- const { GEOMETRY_VIA_PROP: u, MATERIAL_VIA_PROP: r } = H;
428
- return i.isObject3D && ((s = a == null ? void 0 : a.material) != null && s.isMaterial && (i.userData[r] = !0), (c = a == null ? void 0 : a.geometry) != null && c.isBufferGeometry && (i.userData[u] = !0)), i;
426
+ 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"));
427
+ const { GEOMETRY_VIA_PROP: c, MATERIAL_VIA_PROP: r } = V;
428
+ return s.isObject3D && ((i = a == null ? void 0 : a.material) != null && i.isMaterial && (s.userData[r] = !0), (u = a == null ? void 0 : a.geometry) != null && u.isBufferGeometry && (s.userData[c] = !0)), s;
429
429
  },
430
430
  insert(e, t) {
431
- var n, a, o, i, u, r, s;
432
- if (t && t.isScene && (T = t), (((n = e == null ? void 0 : e.__vnode) == null ? void 0 : n.type) === "TresGroup" || ((a = e == null ? void 0 : e.__vnode) == null ? void 0 : a.type) === "TresObject3D") && t === null && !((i = (o = e == null ? void 0 : e.__vnode) == null ? void 0 : o.ctx) != null && i.asyncResolved)) {
433
- $ = e;
431
+ var n, a, o, s, c, r, i;
432
+ if (t && t.isScene && (L = t), (((n = e == null ? void 0 : e.__vnode) == null ? void 0 : n.type) === "TresGroup" || ((a = e == null ? void 0 : e.__vnode) == null ? void 0 : a.type) === "TresObject3D") && t === null && !((s = (o = e == null ? void 0 : e.__vnode) == null ? void 0 : o.ctx) != null && s.asyncResolved)) {
433
+ Y = e;
434
434
  return;
435
435
  } else
436
- (u = e == null ? void 0 : e.__vnode) != null && u.type.includes("Controls") && t === null && ($ = T);
437
- t || (t = $), e != null && e.isObject3D && (t != null && t.isObject3D) ? (t.add(e), e.dispatchEvent({ type: "added" }), (s = (r = T == null ? void 0 : T.userData) == null ? void 0 : r[H.REGISTER_AT_POINTER_EVENT_HANDLER]) == null || s.call(r, e)) : e != null && e.isFog ? t.fog = e : typeof (e == null ? void 0 : e.attach) == "string" && (e.__previousAttach = e[t == null ? void 0 : t.attach], t && (t[e.attach] = e));
436
+ (c = e == null ? void 0 : e.__vnode) != null && c.type.includes("Controls") && t === null && (Y = L);
437
+ t || (t = Y), e != null && e.isObject3D && (t != null && t.isObject3D) ? (t.add(e), e.dispatchEvent({ type: "added" }), (i = (r = L == null ? void 0 : L.userData) == null ? void 0 : r[V.REGISTER_AT_POINTER_EVENT_HANDLER]) == null || i.call(r, e)) : e != null && e.isFog ? t.fog = e : typeof (e == null ? void 0 : e.attach) == "string" && (e.__previousAttach = e[t == null ? void 0 : t.attach], t && (t[e.attach] = e));
438
438
  },
439
439
  remove(e) {
440
440
  var t, n;
441
441
  if (e) {
442
442
  if (e.isObject3D) {
443
- const a = e, o = (i) => {
444
- var s, c;
445
- const { GEOMETRY_VIA_PROP: u, MATERIAL_VIA_PROP: r } = H;
446
- i.userData[r] || (s = i.material) == null || s.dispose(), i.userData[u] || (c = i.geometry) == null || c.dispose();
443
+ const a = e, o = (s) => {
444
+ var i, u;
445
+ const { GEOMETRY_VIA_PROP: c, MATERIAL_VIA_PROP: r } = V;
446
+ s.userData[r] || (i = s.material) == null || i.dispose(), s.userData[c] || (u = s.geometry) == null || u.dispose();
447
447
  };
448
- a.traverse((i) => {
449
- o(i);
448
+ a.traverse((s) => {
449
+ o(s);
450
450
  }), o(a);
451
451
  }
452
452
  (t = e.removeFromParent) == null || t.call(e), (n = e.dispose) == null || n.call(e);
@@ -454,26 +454,26 @@ const { logError: ie } = O(), vt = {
454
454
  },
455
455
  patchProp(e, t, n, a) {
456
456
  if (e) {
457
- let o = e, i = t, u = j(i), r = o == null ? void 0 : o[u];
457
+ let o = e, s = t, c = j(s), r = o == null ? void 0 : o[c];
458
458
  if (o.type === "BufferGeometry") {
459
- if (i === "args")
459
+ if (s === "args")
460
460
  return;
461
461
  o.setAttribute(
462
- j(i),
463
- new Ue(...a)
462
+ j(s),
463
+ new $e(...a)
464
464
  );
465
465
  return;
466
466
  }
467
- if (i.includes("-") && r === void 0) {
468
- const c = i.split("-");
469
- r = c.reduce((l, d) => l[j(d)], o), i = c.pop(), u = i.toLowerCase(), r != null && r.set || (o = c.reduce((l, d) => l[j(d)], o));
467
+ if (s.includes("-") && r === void 0) {
468
+ const u = s.split("-");
469
+ r = u.reduce((l, p) => l[j(p)], o), s = u.pop(), c = s.toLowerCase(), r != null && r.set || (o = u.reduce((l, p) => l[j(p)], o));
470
470
  }
471
- let s = a;
472
- if (s === "" && (s = !0), re(r)) {
473
- Array.isArray(s) ? e[u](...s) : e[u](s);
471
+ let i = a;
472
+ if (i === "" && (i = !0), re(r)) {
473
+ Array.isArray(i) ? e[c](...i) : e[c](i);
474
474
  return;
475
475
  }
476
- !(r != null && r.set) && !re(r) ? o[u] = s : r.constructor === s.constructor && (r != null && r.copy) ? r == null || r.copy(s) : Array.isArray(s) ? r.set(...s) : !r.isColor && r.setScalar ? r.setScalar(s) : r.set(s);
476
+ !(r != null && r.set) && !re(r) ? o[c] = i : r.constructor === i.constructor && (r != null && r.copy) ? r == null || r.copy(i) : Array.isArray(i) ? r.set(...i) : !r.isColor && r.setScalar ? r.setScalar(i) : r.set(i);
477
477
  }
478
478
  },
479
479
  parentNode(e) {
@@ -496,7 +496,7 @@ const { logError: ie } = O(), vt = {
496
496
  return t;
497
497
  };
498
498
  ve(q);
499
- const { logWarning: se } = O(), bt = de({
499
+ const { logWarning: se } = D(), bt = de({
500
500
  name: "TresScene",
501
501
  props: [
502
502
  "shadows",
@@ -517,52 +517,52 @@ const { logWarning: se } = O(), bt = de({
517
517
  ],
518
518
  setup(e, { slots: t, expose: n }) {
519
519
  e.physicallyCorrectLights === !0 && se("physicallyCorrectLights is deprecated, useLegacyLights is now false by default");
520
- const a = V(), o = V(), i = new q.Scene(), u = mt(), { setState: r } = S();
521
- i.userData[H.REGISTER_AT_POINTER_EVENT_HANDLER] = u.registerObject, r("scene", i), r("canvas", o), r("container", a), r("pointerEventHandler", u);
522
- const { onLoop: s, resume: c } = he();
520
+ const a = A(() => e.disableRender !== !1 && e.disableRender !== void 0), o = G(), s = G(), c = new q.Scene(), r = mt(), { setState: i } = k();
521
+ c.userData[V.REGISTER_AT_POINTER_EVENT_HANDLER] = r.registerObject, i("scene", c), i("canvas", s), i("container", o), i("pointerEventHandler", r);
522
+ const { onLoop: u, resume: l } = he();
523
523
  ke(() => {
524
524
  h();
525
525
  }), le(() => {
526
- r("renderer", null);
526
+ i("renderer", null);
527
527
  });
528
- const { activeCamera: l, pushCamera: d, clearCameras: p } = at();
528
+ const { activeCamera: p, pushCamera: d, clearCameras: E } = at();
529
529
  function y() {
530
- const w = i.getObjectByProperty("isCamera", !0);
531
- if (w)
532
- d(w);
530
+ const g = c.getObjectByProperty("isCamera", !0);
531
+ if (g)
532
+ d(g);
533
533
  else {
534
534
  se("No camera found. Creating a default perspective camera. To have full control over a camera, please add one to the scene.");
535
- const E = new q.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 1e3);
536
- E.position.set(3, 3, 3), E.lookAt(0, 0, 0), d(E);
535
+ const M = new q.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 1e3);
536
+ M.position.set(3, 3, 3), M.lookAt(0, 0, 0), d(M);
537
537
  }
538
538
  }
539
539
  function h() {
540
- const { renderer: w } = lt(e);
541
- e.camera && d(e.camera), s(() => {
542
- var E;
543
- l.value && e.disableRender !== !0 && ((E = w.value) == null || E.render(i, l.value));
540
+ const { renderer: g } = lt(e);
541
+ e.camera && d(e.camera), u(() => {
542
+ var M;
543
+ p.value && !a.value && ((M = g.value) == null || M.render(c, p.value));
544
544
  });
545
545
  }
546
- let v;
547
- function M() {
548
- v = wt(t);
549
- const w = S();
550
- v.provide("useTres", w), v.provide(K, w), v.provide("extend", ve), v.mount(i), y();
546
+ let w;
547
+ function C() {
548
+ w = wt(t);
549
+ const g = k();
550
+ w.provide("useTres", g), w.provide(K, g), w.provide("extend", ve), w.mount(c), y();
551
551
  }
552
- return M(), n({
553
- scene: i
554
- }), D(
552
+ return C(), n({
553
+ scene: c
554
+ }), I(
555
555
  () => e.camera,
556
- (w) => {
557
- w && (p(), d(w));
556
+ (g) => {
557
+ g && (E(), d(g));
558
558
  }
559
- ), () => L(
560
- L(
559
+ ), () => _(
560
+ _(
561
561
  "div",
562
562
  {
563
- ref: a,
564
- "data-scene": i.uuid,
565
- key: i.uuid,
563
+ ref: o,
564
+ "data-scene": c.uuid,
565
+ key: c.uuid,
566
566
  style: {
567
567
  position: "relative",
568
568
  width: "100%",
@@ -572,7 +572,7 @@ const { logWarning: se } = O(), bt = de({
572
572
  }
573
573
  },
574
574
  [
575
- L(
575
+ _(
576
576
  "div",
577
577
  {
578
578
  style: {
@@ -581,9 +581,9 @@ const { logWarning: se } = O(), bt = de({
581
581
  }
582
582
  },
583
583
  [
584
- L("canvas", {
585
- ref: o,
586
- "data-scene": i.uuid,
584
+ _("canvas", {
585
+ ref: s,
586
+ "data-scene": c.uuid,
587
587
  style: {
588
588
  display: "block",
589
589
  width: "100%",
@@ -620,9 +620,19 @@ const { logWarning: se } = O(), bt = de({
620
620
  ],
621
621
  setup(e, { slots: t, expose: n }) {
622
622
  const a = Ze();
623
- return n(a), () => L(bt, e, t);
623
+ return n(a), () => _(bt, e, t);
624
+ }
625
+ }), yt = [
626
+ "TresCanvas",
627
+ "TresLeches",
628
+ "TresScene"
629
+ ], Et = {
630
+ template: {
631
+ compilerOptions: {
632
+ isCustomElement: (e) => e.startsWith("Tres") && !yt.includes(e) || e === "primitive"
633
+ }
624
634
  }
625
- }), Lt = {
635
+ }, St = Et, At = {
626
636
  install(e) {
627
637
  e.component("TresCanvas", ht);
628
638
  }
@@ -632,21 +642,22 @@ export {
632
642
  K as TRES_CONTEXT_KEY,
633
643
  ht as TresCanvas,
634
644
  me as catalogue,
635
- Lt as default,
645
+ At as default,
636
646
  ve as extend,
637
- xt as isProd,
647
+ Tt as isProd,
638
648
  it as normalizeColor,
639
- Pt as normalizeVectorFlexibleParam,
649
+ Rt as normalizeVectorFlexibleParam,
650
+ St as templateCompilerOptions,
640
651
  dt as trasverseObjects,
641
652
  at as useCamera,
642
- Ct as useLoader,
643
- O as useLogger,
653
+ xt as useLoader,
654
+ D as useLogger,
644
655
  mt as usePointerEventHandler,
645
656
  pt as useRaycaster,
646
657
  he as useRenderLoop,
647
658
  lt as useRenderer,
648
- Tt as useSeek,
649
- Rt as useTexture,
650
- S as useTres,
659
+ _t as useSeek,
660
+ Lt as useTexture,
661
+ k as useTres,
651
662
  Ze as useTresProvider
652
663
  };
package/dist/tres.umd.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * name: @tresjs/core
3
- * version: v2.3.0
3
+ * version: v2.4.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
- (function(m,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("vue"),require("three"),require("@vueuse/core")):typeof define=="function"&&define.amd?define(["exports","vue","three","@vueuse/core"],f):(m=typeof globalThis<"u"?globalThis:m||self,f(m.tres={},m.Vue,m.Three,m.VueUseCore))})(this,function(m,f,g,l){"use strict";function he(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const N=he(g),z=f.ref({}),F=e=>void Object.assign(z.value,e),X=e=>typeof e=="function",H=e=>!!e&&e.constructor===Array,P=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];function we(){const e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0,a=Math.random()*4294967295|0;return(P[e&255]+P[e>>8&255]+P[e>>16&255]+P[e>>24&255]+"-"+P[t&255]+P[t>>8&255]+"-"+P[t>>16&15|64]+P[t>>24&255]+"-"+P[n&63|128]+P[n>>8&255]+"-"+P[n>>16&255]+P[n>>24&255]+P[a&255]+P[a>>8&255]+P[a>>16&255]+P[a>>24&255]).toLowerCase()}const V=Symbol();function J(){const e=f.shallowReactive({uuid:we(),camera:void 0,cameras:[],canvas:void 0,scene:void 0,renderer:void 0,aspectRatio:void 0,pointerEventHandler:void 0});function t(o){return e[o]}function n(o,i){e[o]=i}const a={state:e,...f.toRefs(e),getState:t,setState:n};return f.provide(V,a),a}const A=()=>f.inject(V,{state:f.shallowReactive({camera:void 0,cameras:[],canvas:void 0,scene:void 0,renderer:void 0,pointerEventHandler:void 0})});var Q=(e=>(e.Perspective="Perspective",e.Orthographic="Orthographic",e))(Q||{});const be=45;let x;function Z(){const{state:e,setState:t,aspectRatio:n}=A();function a(s="Perspective",c){var p,v,h;if(s==="Perspective"){const{near:M,far:C,fov:w}=c||{near:.1,far:1e3,fov:be};x=new g.PerspectiveCamera(w,((p=e.aspectRatio)==null?void 0:p.value)||window.innerWidth/window.innerHeight,M,C),(v=e.cameras)==null||v.push(x)}else{const{left:M,right:C,top:w,bottom:L,near:y,far:_}=c||{left:-100,right:100,top:100,bottom:-100,near:.1,far:1e3};x=new g.OrthographicCamera(M,C,w,L,y,_),(h=e.cameras)==null||h.push(x)}return e.camera=x,t("camera",e.camera),x}function o(){var s;e.camera instanceof g.PerspectiveCamera&&e.aspectRatio&&(e.camera.aspect=e.aspectRatio.value),(s=e.camera)==null||s.updateProjectionMatrix()}function i(s){var c;(c=e.cameras)==null||c.push(s),s instanceof g.PerspectiveCamera&&e.aspectRatio&&(s.aspect=e.aspectRatio.value),s.updateProjectionMatrix(),t("camera",s)}function u(s){var c;((c=e.cameras)==null?void 0:c.length)===0&&i(s)}function r(){e.cameras=[]}return f.watchEffect(()=>{n!=null&&n.value&&o()}),{activeCamera:f.toRef(e,"camera"),createCamera:a,updateCamera:o,pushCamera:i,clearCameras:r,setFirstCamera:u}}const ee=l.createEventHook(),te=l.createEventHook(),W=l.createEventHook(),R=new g.Clock;let j=0,D=0;const{pause:ye,resume:Pe,isActive:Ce}=l.useRafFn(()=>{ee.trigger({delta:j,elapsed:D,clock:R}),te.trigger({delta:j,elapsed:D,clock:R}),W.trigger({delta:j,elapsed:D,clock:R})},{immediate:!1});W.on(()=>{j=R.getDelta(),D=R.getElapsedTime()});function U(){return{onBeforeLoop:ee.on,onLoop:te.on,onAfterLoop:W.on,pause:ye,resume:Pe,isActive:Ce}}function Me(e){return typeof e=="number"?[e,e,e]:e instanceof g.Vector3?[e.x,e.y,e.z]:e}function ae(e){return e instanceof g.Color?e:Array.isArray(e)?new g.Color(...e):new g.Color(e)}const Y={realistic:{outputColorSpace:g.SRGBColorSpace,toneMapping:g.ACESFilmicToneMapping,toneMappingExposure:3,shadowMap:{enabled:!0,type:g.PCFSoftShadowMap}}},ne=(e,t)=>{for(const n of Object.keys(t))t[n]instanceof Object&&Object.assign(t[n],ne(e[n],t[n]));return Object.assign(e||{},t),e},_e=Le("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");function I(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function Le(e,t){const n=Object.create(null),a=e.split(",");for(let o=0;o<a.length;o++)n[a[o]]=!0;return t?o=>!!n[o.toLowerCase()]:o=>!!n[o]}const Se=(e,t)=>{const n=new Set,a=[];for(const o of e){const i=t(o);n.has(i)||(n.add(i),a.push(o))}return a},Oe=!0,re="[TresJS ▲ ■ ●] ";function E(){function e(a,o){console.error(`${re} ${a}`,o||"")}function t(a){console.warn(`${re} ${a}`)}function n(a,o){}return{logError:e,logWarning:t,logMessage:n}}function oe(e){const t=f.shallowRef(),n=f.ref(!1),{alpha:a=!0,antialias:o=!0,depth:i,logarithmicDepthBuffer:u,failIfMajorPerformanceCaveat:r,precision:s,premultipliedAlpha:c,stencil:p,shadows:v=!1,shadowMapType:h=g.PCFShadowMap,useLegacyLights:M=!1,outputColorSpace:C=g.LinearSRGBColorSpace,toneMapping:w=g.NoToneMapping,toneMappingExposure:L=1,context:y=void 0,powerPreference:_="default",preserveDrawingBuffer:G=!1,clearColor:O,windowSize:T=!1,preset:$=void 0}=f.toRefs(e),{state:d,setState:b}=A(),{width:de,height:me}=l.toValue(T)==!0||l.toValue(T)===""||l.toValue(T)==="true"?l.useWindowSize():l.useElementSize(d.container),{logError:De,logWarning:Ie}=E(),{pixelRatio:pe}=l.useDevicePixelRatio(),{pause:Be,resume:Ge}=U(),K=f.computed(()=>de.value/me.value);setTimeout(()=>{var S;!l.toValue(T)&&!((S=d.canvas)!=null&&S.value.offsetHeight)&&Ie(`Oops... Seems like your canvas height is currently 0px, it's posible that you couldn't watch your scene.
9
- You could set windowSize=true to force the canvas to be the size of the window.`)},1e3);const ve=()=>{t.value&&(t.value.setSize(de.value,me.value),t.value.setPixelRatio(Math.min(pe.value,2)))},ge=()=>{if(!t.value)return;const S=l.toValue($);if(S){S in Y||De("Renderer Preset must be one of these: "+Object.keys(Y).join(", ")),ne(t.value,Y[S]);return}t.value.shadowMap.enabled=l.toValue(v),t.value.shadowMap.type=l.toValue(h),t.value.toneMapping=l.toValue(w)||g.NoToneMapping,t.value.toneMappingExposure=l.toValue(L),t.value.outputColorSpace=l.toValue(C)||g.LinearSRGBColorSpace,O!=null&&O.value&&t.value.setClearColor(ae(l.toValue(O))),t.value.useLegacyLights=l.toValue(M)},Ne=()=>{const S=l.unrefElement(d.canvas);S&&(t.value=new g.WebGLRenderer({canvas:S,alpha:l.toValue(a),antialias:l.toValue(o),context:l.toValue(y),depth:l.toValue(i),failIfMajorPerformanceCaveat:l.toValue(r),logarithmicDepthBuffer:l.toValue(u),powerPreference:l.toValue(_),precision:l.toValue(s),stencil:l.toValue(p),preserveDrawingBuffer:l.toValue(G),premultipliedAlpha:l.toValue(c)}),b("renderer",t.value),b("clock",new g.Clock),b("aspectRatio",K),ge(),ve(),Ge(),n.value=!0)},ze=()=>{t.value&&(t.value.dispose(),t.value=void 0,n.value=!1,Be())};return f.watch([K,pe],ve),f.watch([v,h,C,M,w,L,O],ge),f.watch(()=>[d.canvas,d.container],()=>{l.unrefElement(d.canvas)&&l.unrefElement(d.container)&&Ne()},{immediate:!0,deep:!0}),{renderer:t,isReady:n,dispose:ze,aspectRatio:K}}function ie(e){const t={nodes:{},materials:{}};return e&&e.traverse(n=>{n.name&&(t.nodes[n.name]=n),n.material&&!t.materials[n.material.name]&&(t.materials[n.material.name]=n.material)}),t}async function Te(e,t,n,a,o){const{logError:i}=E(),u=new e;o&&o(u),n&&n(u);const s=(Array.isArray(t)?t:[t]).map(c=>new Promise((p,v)=>{u.load(c,h=>{h.scene&&Object.assign(h,ie(h.scene)),p(h)},a,h=>v(i("[useLoader] - Failed to load resource",h)))}));return H(t)?await Promise.all(s):await s[0]}async function Ae(e){const t=new g.LoadingManager,n=new g.TextureLoader(t),a=o=>new Promise((i,u)=>{n.load(o,r=>i(r),()=>null,()=>{u(new Error("[useTextures] - Failed to load texture"))})});if(H(e)){const o=await Promise.all(e.map(i=>a(i)));return e.length>1?o:o[0]}else{const{map:o,displacementMap:i,normalMap:u,roughnessMap:r,metalnessMap:s,aoMap:c,alphaMap:p,matcap:v}=e;return{map:o?await a(o):null,displacementMap:i?await a(i):null,normalMap:u?await a(u):null,roughnessMap:r?await a(r):null,metalnessMap:s?await a(s):null,aoMap:c?await a(c):null,alphaMap:p?await a(p):null,matcap:v?await a(v):null}}}const se=e=>{const{state:t}=A(),n=f.computed(()=>{var d;return(d=t.canvas)==null?void 0:d.value}),{x:a,y:o}=l.usePointer({target:n}),{width:i,height:u,top:r,left:s}=l.useElementBounding(n),c=new g.Raycaster,p=({x:d,y:b})=>{if(n.value)return{x:(d-s.value)/i.value*2-1,y:-((b-r.value)/u.value)*2+1}},v=({x:d,y:b})=>{if(t.camera)return c.setFromCamera(new g.Vector2(d,b),t.camera),c.intersectObjects(e.value,!1)},h=d=>{const b=p({x:(d==null?void 0:d.clientX)??a.value,y:(d==null?void 0:d.clientY)??o.value});return b?v(b)||[]:[]},M=f.computed(()=>h()),C=l.createEventHook(),w=l.createEventHook(),L=(d,b)=>{d.trigger({event:b,intersects:h(b)})},y=d=>{L(w,d)};let _;const G=d=>{var b;_=(b=h(d)[0])==null?void 0:b.object},O=d=>{var b;d instanceof PointerEvent&&_===((b=h(d)[0])==null?void 0:b.object)&&L(C,d)},T=d=>w.trigger({event:d,intersects:[]}),$=f.watchEffect(()=>{n!=null&&n.value&&(n.value.addEventListener("pointerup",O),n.value.addEventListener("pointerdown",G),n.value.addEventListener("pointermove",y),n.value.addEventListener("pointerleave",T),$())});return f.onUnmounted(()=>{n!=null&&n.value&&(n.value.removeEventListener("pointerup",O),n.value.removeEventListener("pointerdown",G),n.value.removeEventListener("pointermove",y),n.value.removeEventListener("pointerleave",T))}),{intersects:M,onClick:d=>C.on(d).off,onPointerMove:d=>w.on(d).off}};function xe(){const{logWarning:e}=E();function t(a,o,i){let u=null;return a.traverse(r=>{r[o]===i&&(u=r)}),u||e(`Child with ${o} '${i}' not found.`),u}function n(a,o){return t(a,"name",o)}return{seek:t,seekByName:n}}const ce=()=>{const e=f.reactive({click:new Map,pointerMove:new Map,pointerEnter:new Map,pointerLeave:new Map}),t=r=>{Object.values(e).forEach(s=>s.delete(r))},n=r=>{const{onClick:s,onPointerMove:c,onPointerEnter:p,onPointerLeave:v}=r;s&&e.click.set(r,s),c&&e.pointerMove.set(r,c),p&&e.pointerEnter.set(r,p),v&&e.pointerLeave.set(r,v),r.addEventListener("removed",()=>{r.traverse(h=>{t(h)}),t(r)})},a=f.computed(()=>Se(Object.values(e).map(r=>Array.from(r.keys())).flat(),({uuid:r})=>r)),{onClick:o,onPointerMove:i}=se(a);o(({intersects:r,event:s})=>{var c;r.length&&((c=e.click.get(r[0].object))==null||c(r[0],s))});let u;return i(({intersects:r,event:s})=>{var M,C,w,L;const c=(M=r==null?void 0:r[0])==null?void 0:M.object,{pointerLeave:p,pointerEnter:v,pointerMove:h}=e;u&&u!==c&&((C=p.get(u))==null||C(u,s)),c&&(u!==c&&((w=v.get(c))==null||w(r[0],s)),(L=h.get(c))==null||L(r[0],s)),u=c||null}),{registerObject:n,deregisterObject:t}},B={GEOMETRY_VIA_PROP:"tres__geometryViaProp",MATERIAL_VIA_PROP:"tres__materialViaProp",REGISTER_AT_POINTER_EVENT_HANDLER:"tres__registerAtPointerEventHandler"};function We(e){}let q=null,k=null;const{logError:ue}=E(),Ee={createElement(e,t,n,a){var s,c;if(a||(a={}),a.args||(a.args=[]),e==="template"||_e(e))return null;let o=e.replace("Tres",""),i;if(e==="primitive"){(a==null?void 0:a.object)===void 0&&ue("Tres primitives need a prop 'object'");const p=a.object;o=p.type,i=Object.assign(p,{type:o,attach:a.attach,primitive:!0})}else{const p=z.value[o];p||ue(`${o} is not defined on the THREE namespace. Use extend to add it to the catalog.`),i=new p(...a.args)}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"));const{GEOMETRY_VIA_PROP:u,MATERIAL_VIA_PROP:r}=B;return i.isObject3D&&((s=a==null?void 0:a.material)!=null&&s.isMaterial&&(i.userData[r]=!0),(c=a==null?void 0:a.geometry)!=null&&c.isBufferGeometry&&(i.userData[u]=!0)),i},insert(e,t){var n,a,o,i,u,r,s;if(t&&t.isScene&&(k=t),(((n=e==null?void 0:e.__vnode)==null?void 0:n.type)==="TresGroup"||((a=e==null?void 0:e.__vnode)==null?void 0:a.type)==="TresObject3D")&&t===null&&!((i=(o=e==null?void 0:e.__vnode)==null?void 0:o.ctx)!=null&&i.asyncResolved)){q=e;return}else(u=e==null?void 0:e.__vnode)!=null&&u.type.includes("Controls")&&t===null&&(q=k);t||(t=q),e!=null&&e.isObject3D&&(t!=null&&t.isObject3D)?(t.add(e),e.dispatchEvent({type:"added"}),(s=(r=k==null?void 0:k.userData)==null?void 0:r[B.REGISTER_AT_POINTER_EVENT_HANDLER])==null||s.call(r,e)):e!=null&&e.isFog?t.fog=e:typeof(e==null?void 0:e.attach)=="string"&&(e.__previousAttach=e[t==null?void 0:t.attach],t&&(t[e.attach]=e))},remove(e){var t,n;if(e){if(e.isObject3D){const a=e,o=i=>{var s,c;const{GEOMETRY_VIA_PROP:u,MATERIAL_VIA_PROP:r}=B;i.userData[r]||(s=i.material)==null||s.dispose(),i.userData[u]||(c=i.geometry)==null||c.dispose()};a.traverse(i=>{o(i)}),o(a)}(t=e.removeFromParent)==null||t.call(e),(n=e.dispose)==null||n.call(e)}},patchProp(e,t,n,a){if(e){let o=e,i=t,u=I(i),r=o==null?void 0:o[u];if(o.type==="BufferGeometry"){if(i==="args")return;o.setAttribute(I(i),new g.BufferAttribute(...a));return}if(i.includes("-")&&r===void 0){const c=i.split("-");r=c.reduce((p,v)=>p[I(v)],o),i=c.pop(),u=i.toLowerCase(),r!=null&&r.set||(o=c.reduce((p,v)=>p[I(v)],o))}let s=a;if(s===""&&(s=!0),X(r)){Array.isArray(s)?e[u](...s):e[u](s);return}!(r!=null&&r.set)&&!X(r)?o[u]=s:r.constructor===s.constructor&&(r!=null&&r.copy)?r==null||r.copy(s):Array.isArray(s)?r.set(...s):!r.isColor&&r.setScalar?r.setScalar(s):r.set(s)}},parentNode(e){return(e==null?void 0:e.parent)||null},createText:()=>void 0,createComment:()=>void 0,setText:()=>void 0,setElementText:()=>void 0,nextSibling:()=>void 0,querySelector:()=>void 0,setScopeId:()=>void 0,cloneNode:()=>void 0,insertStaticContent:()=>void 0},{createApp:Re}=f.createRenderer(Ee),ke=e=>{const t=Re(n);function n(){return e&&e.default?e.default():[]}return t};F(N);const{logWarning:fe}=E(),Ve=f.defineComponent({name:"TresScene",props:["shadows","shadowMapType","physicallyCorrectLights","useLegacyLights","outputColorSpace","toneMapping","toneMappingExposure","context","powerPreference","preserveDrawingBuffer","clearColor","windowSize","preset","disableRender","camera"],setup(e,{slots:t,expose:n}){e.physicallyCorrectLights===!0&&fe("physicallyCorrectLights is deprecated, useLegacyLights is now false by default");const a=f.ref(),o=f.ref(),i=new N.Scene,u=ce(),{setState:r}=A();i.userData[B.REGISTER_AT_POINTER_EVENT_HANDLER]=u.registerObject,r("scene",i),r("canvas",o),r("container",a),r("pointerEventHandler",u);const{onLoop:s,resume:c}=U();f.onMounted(()=>{C()}),f.onUnmounted(()=>{r("renderer",null)});const{activeCamera:p,pushCamera:v,clearCameras:h}=Z();function M(){const y=i.getObjectByProperty("isCamera",!0);if(y)v(y);else{fe("No camera found. Creating a default perspective camera. To have full control over a camera, please add one to the scene.");const _=new N.PerspectiveCamera(45,window.innerWidth/window.innerHeight,.1,1e3);_.position.set(3,3,3),_.lookAt(0,0,0),v(_)}}function C(){const{renderer:y}=oe(e);e.camera&&v(e.camera),s(()=>{var _;p.value&&e.disableRender!==!0&&((_=y.value)==null||_.render(i,p.value))})}let w;function L(){w=ke(t);const y=A();w.provide("useTres",y),w.provide(V,y),w.provide("extend",F),w.mount(i),M()}return L(),n({scene:i}),f.watch(()=>e.camera,y=>{y&&(h(),v(y))}),()=>f.h(f.h("div",{ref:a,"data-scene":i.uuid,key:i.uuid,style:{position:"relative",width:"100%",height:"100%",pointerEvents:"auto",touchAction:"none"}},[f.h("div",{style:{width:"100%",height:"100%"}},[f.h("canvas",{ref:o,"data-scene":i.uuid,style:{display:"block",width:"100%",height:"100%",position:e.windowSize?"fixed":"absolute",top:0,left:0}})])]))}}),le=f.defineComponent({name:"TresCanvas",props:["shadows","shadowMapType","physicallyCorrectLights","useLegacyLights","outputColorSpace","toneMapping","toneMappingExposure","context","powerPreference","preserveDrawingBuffer","clearColor","windowSize","preset","disableRender","camera"],setup(e,{slots:t,expose:n}){const a=J();return n(a),()=>f.h(Ve,e,t)}}),je={install(e){e.component("TresCanvas",le)}};m.CameraType=Q,m.TRES_CONTEXT_KEY=V,m.TresCanvas=le,m.catalogue=z,m.default=je,m.extend=F,m.isProd=Oe,m.normalizeColor=ae,m.normalizeVectorFlexibleParam=Me,m.trasverseObjects=ie,m.useCamera=Z,m.useLoader=Te,m.useLogger=E,m.usePointerEventHandler=ce,m.useRaycaster=se,m.useRenderLoop=U,m.useRenderer=oe,m.useSeek=xe,m.useTexture=Ae,m.useTres=A,m.useTresProvider=J,Object.defineProperties(m,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
8
+ (function(m,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("vue"),require("three"),require("@vueuse/core")):typeof define=="function"&&define.amd?define(["exports","vue","three","@vueuse/core"],l):(m=typeof globalThis<"u"?globalThis:m||self,l(m.tres={},m.Vue,m.Three,m.VueUseCore))})(this,function(m,l,g,f){"use strict";function he(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const n=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,n.get?n:{enumerable:!0,get:()=>e[a]})}}return t.default=e,Object.freeze(t)}const N=he(g),z=l.ref({}),F=e=>void Object.assign(z.value,e),X=e=>typeof e=="function",H=e=>!!e&&e.constructor===Array,y=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];function we(){const e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,a=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(y[e&255]+y[e>>8&255]+y[e>>16&255]+y[e>>24&255]+"-"+y[t&255]+y[t>>8&255]+"-"+y[t>>16&15|64]+y[t>>24&255]+"-"+y[a&63|128]+y[a>>8&255]+"-"+y[a>>16&255]+y[a>>24&255]+y[n&255]+y[n>>8&255]+y[n>>16&255]+y[n>>24&255]).toLowerCase()}const j=Symbol();function J(){const e=l.shallowReactive({uuid:we(),camera:void 0,cameras:[],canvas:void 0,scene:void 0,renderer:void 0,aspectRatio:void 0,pointerEventHandler:void 0});function t(o){return e[o]}function a(o,s){e[o]=s}const n={state:e,...l.toRefs(e),getState:t,setState:a};return l.provide(j,n),n}const E=()=>l.inject(j,{state:l.shallowReactive({camera:void 0,cameras:[],canvas:void 0,scene:void 0,renderer:void 0,pointerEventHandler:void 0})});var Q=(e=>(e.Perspective="Perspective",e.Orthographic="Orthographic",e))(Q||{});const be=45;let R;function Z(){const{state:e,setState:t,aspectRatio:a}=E();function n(i="Perspective",u){var p,h,v;if(i==="Perspective"){const{near:L,far:M,fov:P}=u||{near:.1,far:1e3,fov:be};R=new g.PerspectiveCamera(P,((p=e.aspectRatio)==null?void 0:p.value)||window.innerWidth/window.innerHeight,L,M),(h=e.cameras)==null||h.push(R)}else{const{left:L,right:M,top:P,bottom:C,near:O,far:b}=u||{left:-100,right:100,top:100,bottom:-100,near:.1,far:1e3};R=new g.OrthographicCamera(L,M,P,C,O,b),(v=e.cameras)==null||v.push(R)}return e.camera=R,t("camera",e.camera),R}function o(){var i;e.camera instanceof g.PerspectiveCamera&&e.aspectRatio&&(e.camera.aspect=e.aspectRatio.value),(i=e.camera)==null||i.updateProjectionMatrix()}function s(i){var u;(u=e.cameras)==null||u.push(i),i instanceof g.PerspectiveCamera&&e.aspectRatio&&(i.aspect=e.aspectRatio.value),i.updateProjectionMatrix(),t("camera",i)}function c(i){var u;((u=e.cameras)==null?void 0:u.length)===0&&s(i)}function r(){e.cameras=[]}return l.watchEffect(()=>{a!=null&&a.value&&o()}),{activeCamera:l.toRef(e,"camera"),createCamera:n,updateCamera:o,pushCamera:s,clearCameras:r,setFirstCamera:c}}const ee=f.createEventHook(),te=f.createEventHook(),W=f.createEventHook(),k=new g.Clock;let D=0,I=0;const{pause:ye,resume:Ce,isActive:Pe}=f.useRafFn(()=>{ee.trigger({delta:D,elapsed:I,clock:k}),te.trigger({delta:D,elapsed:I,clock:k}),W.trigger({delta:D,elapsed:I,clock:k})},{immediate:!1});W.on(()=>{D=k.getDelta(),I=k.getElapsedTime()});function U(){return{onBeforeLoop:ee.on,onLoop:te.on,onAfterLoop:W.on,pause:ye,resume:Ce,isActive:Pe}}function Me(e){return typeof e=="number"?[e,e,e]:e instanceof g.Vector3?[e.x,e.y,e.z]:e}function ae(e){return e instanceof g.Color?e:Array.isArray(e)?new g.Color(...e):new g.Color(e)}const Y={realistic:{outputColorSpace:g.SRGBColorSpace,toneMapping:g.ACESFilmicToneMapping,toneMappingExposure:3,shadowMap:{enabled:!0,type:g.PCFSoftShadowMap}}},ne=(e,t)=>{for(const a of Object.keys(t))t[a]instanceof Object&&Object.assign(t[a],ne(e[a],t[a]));return Object.assign(e||{},t),e},Le=_e("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");function B(e){return e.replace(/-([a-z])/g,(t,a)=>a.toUpperCase())}function _e(e,t){const a=Object.create(null),n=e.split(",");for(let o=0;o<n.length;o++)a[n[o]]=!0;return t?o=>!!a[o.toLowerCase()]:o=>!!a[o]}const Se=(e,t)=>{const a=new Set,n=[];for(const o of e){const s=t(o);a.has(s)||(a.add(s),n.push(o))}return n},Oe=!0,re="[TresJS ▲ ■ ●] ";function x(){function e(n,o){console.error(`${re} ${n}`,o||"")}function t(n){console.warn(`${re} ${n}`)}function a(n,o){}return{logError:e,logWarning:t,logMessage:a}}function oe(e){const t=l.shallowRef(),a=l.ref(!1),{alpha:n=!0,antialias:o=!0,depth:s,logarithmicDepthBuffer:c,failIfMajorPerformanceCaveat:r,precision:i,premultipliedAlpha:u,stencil:p,shadows:h=!1,shadowMapType:v=g.PCFShadowMap,useLegacyLights:L=!1,outputColorSpace:M=g.LinearSRGBColorSpace,toneMapping:P=g.NoToneMapping,toneMappingExposure:C=1,context:O=void 0,powerPreference:b="default",preserveDrawingBuffer:_=!1,clearColor:T,windowSize:A=!1,preset:q=void 0}=l.toRefs(e),{state:d,setState:w}=E(),{width:de,height:me}=f.toValue(A)==!0||f.toValue(A)===""||f.toValue(A)==="true"?f.useWindowSize():f.useElementSize(d.container),{logError:Be,logWarning:Ge}=x(),{pixelRatio:pe}=f.useDevicePixelRatio(),{pause:Ne,resume:ze}=U(),K=l.computed(()=>de.value/me.value);setTimeout(()=>{var S;!f.toValue(A)&&!((S=d.canvas)!=null&&S.value.offsetHeight)&&Ge(`Oops... Seems like your canvas height is currently 0px, it's posible that you couldn't watch your scene.
9
+ You could set windowSize=true to force the canvas to be the size of the window.`)},1e3);const ve=()=>{t.value&&(t.value.setSize(de.value,me.value),t.value.setPixelRatio(Math.min(pe.value,2)))},ge=()=>{if(!t.value)return;const S=f.toValue(q);if(S){S in Y||Be("Renderer Preset must be one of these: "+Object.keys(Y).join(", ")),ne(t.value,Y[S]);return}t.value.shadowMap.enabled=f.toValue(h),t.value.shadowMap.type=f.toValue(v),t.value.toneMapping=f.toValue(P)||g.NoToneMapping,t.value.toneMappingExposure=f.toValue(C),t.value.outputColorSpace=f.toValue(M)||g.LinearSRGBColorSpace,T!=null&&T.value&&t.value.setClearColor(ae(f.toValue(T))),t.value.useLegacyLights=f.toValue(L)},Fe=()=>{const S=f.unrefElement(d.canvas);S&&(t.value=new g.WebGLRenderer({canvas:S,alpha:f.toValue(n),antialias:f.toValue(o),context:f.toValue(O),depth:f.toValue(s),failIfMajorPerformanceCaveat:f.toValue(r),logarithmicDepthBuffer:f.toValue(c),powerPreference:f.toValue(b),precision:f.toValue(i),stencil:f.toValue(p),preserveDrawingBuffer:f.toValue(_),premultipliedAlpha:f.toValue(u)}),w("renderer",t.value),w("clock",new g.Clock),w("aspectRatio",K),ge(),ve(),ze(),a.value=!0)},We=()=>{t.value&&(t.value.dispose(),t.value=void 0,a.value=!1,Ne())};return l.watch([K,pe],ve),l.watch([h,v,M,L,P,C,T],ge),l.watch(()=>[d.canvas,d.container],()=>{f.unrefElement(d.canvas)&&f.unrefElement(d.container)&&Fe()},{immediate:!0,deep:!0}),{renderer:t,isReady:a,dispose:We,aspectRatio:K}}function ie(e){const t={nodes:{},materials:{}};return e&&e.traverse(a=>{a.name&&(t.nodes[a.name]=a),a.material&&!t.materials[a.material.name]&&(t.materials[a.material.name]=a.material)}),t}async function Te(e,t,a,n,o){const{logError:s}=x(),c=new e;o&&o(c),a&&a(c);const i=(Array.isArray(t)?t:[t]).map(u=>new Promise((p,h)=>{c.load(u,v=>{v.scene&&Object.assign(v,ie(v.scene)),p(v)},n,v=>h(s("[useLoader] - Failed to load resource",v)))}));return H(t)?await Promise.all(i):await i[0]}async function Ae(e){const t=new g.LoadingManager,a=new g.TextureLoader(t),n=o=>new Promise((s,c)=>{a.load(o,r=>s(r),()=>null,()=>{c(new Error("[useTextures] - Failed to load texture"))})});if(H(e)){const o=await Promise.all(e.map(s=>n(s)));return e.length>1?o:o[0]}else{const{map:o,displacementMap:s,normalMap:c,roughnessMap:r,metalnessMap:i,aoMap:u,alphaMap:p,matcap:h}=e;return{map:o?await n(o):null,displacementMap:s?await n(s):null,normalMap:c?await n(c):null,roughnessMap:r?await n(r):null,metalnessMap:i?await n(i):null,aoMap:u?await n(u):null,alphaMap:p?await n(p):null,matcap:h?await n(h):null}}}const se=e=>{const{state:t}=E(),a=l.computed(()=>{var d;return(d=t.canvas)==null?void 0:d.value}),{x:n,y:o}=f.usePointer({target:a}),{width:s,height:c,top:r,left:i}=f.useElementBounding(a),u=new g.Raycaster,p=({x:d,y:w})=>{if(a.value)return{x:(d-i.value)/s.value*2-1,y:-((w-r.value)/c.value)*2+1}},h=({x:d,y:w})=>{if(t.camera)return u.setFromCamera(new g.Vector2(d,w),t.camera),u.intersectObjects(e.value,!1)},v=d=>{const w=p({x:(d==null?void 0:d.clientX)??n.value,y:(d==null?void 0:d.clientY)??o.value});return w?h(w)||[]:[]},L=l.computed(()=>v()),M=f.createEventHook(),P=f.createEventHook(),C=(d,w)=>{d.trigger({event:w,intersects:v(w)})},O=d=>{C(P,d)};let b;const _=d=>{var w;b=(w=v(d)[0])==null?void 0:w.object},T=d=>{var w;d instanceof PointerEvent&&b===((w=v(d)[0])==null?void 0:w.object)&&C(M,d)},A=d=>P.trigger({event:d,intersects:[]}),q=l.watchEffect(()=>{a!=null&&a.value&&(a.value.addEventListener("pointerup",T),a.value.addEventListener("pointerdown",_),a.value.addEventListener("pointermove",O),a.value.addEventListener("pointerleave",A),q())});return l.onUnmounted(()=>{a!=null&&a.value&&(a.value.removeEventListener("pointerup",T),a.value.removeEventListener("pointerdown",_),a.value.removeEventListener("pointermove",O),a.value.removeEventListener("pointerleave",A))}),{intersects:L,onClick:d=>M.on(d).off,onPointerMove:d=>P.on(d).off}};function Ee(){const{logWarning:e}=x();function t(n,o,s){let c=null;return n.traverse(r=>{r[o]===s&&(c=r)}),c||e(`Child with ${o} '${s}' not found.`),c}function a(n,o){return t(n,"name",o)}return{seek:t,seekByName:a}}const ce=()=>{const e=l.reactive({click:new Map,pointerMove:new Map,pointerEnter:new Map,pointerLeave:new Map}),t=r=>{Object.values(e).forEach(i=>i.delete(r))},a=r=>{const{onClick:i,onPointerMove:u,onPointerEnter:p,onPointerLeave:h}=r;i&&e.click.set(r,i),u&&e.pointerMove.set(r,u),p&&e.pointerEnter.set(r,p),h&&e.pointerLeave.set(r,h),r.addEventListener("removed",()=>{r.traverse(v=>{t(v)}),t(r)})},n=l.computed(()=>Se(Object.values(e).map(r=>Array.from(r.keys())).flat(),({uuid:r})=>r)),{onClick:o,onPointerMove:s}=se(n);o(({intersects:r,event:i})=>{var u;r.length&&((u=e.click.get(r[0].object))==null||u(r[0],i))});let c;return s(({intersects:r,event:i})=>{var L,M,P,C;const u=(L=r==null?void 0:r[0])==null?void 0:L.object,{pointerLeave:p,pointerEnter:h,pointerMove:v}=e;c&&c!==u&&((M=p.get(c))==null||M(c,i)),u&&(c!==u&&((P=h.get(u))==null||P(r[0],i)),(C=v.get(u))==null||C(r[0],i)),c=u||null}),{registerObject:a,deregisterObject:t}},G={GEOMETRY_VIA_PROP:"tres__geometryViaProp",MATERIAL_VIA_PROP:"tres__materialViaProp",REGISTER_AT_POINTER_EVENT_HANDLER:"tres__registerAtPointerEventHandler"};function Ye(e){}let $=null,V=null;const{logError:ue}=x(),Re={createElement(e,t,a,n){var i,u;if(n||(n={}),n.args||(n.args=[]),e==="template"||Le(e))return null;let o=e.replace("Tres",""),s;if(e==="primitive"){(n==null?void 0:n.object)===void 0&&ue("Tres primitives need a prop 'object'");const p=n.object;o=p.type,s=Object.assign(p,{type:o,attach:n.attach,primitive:!0})}else{const p=z.value[o];p||ue(`${o} is not defined on the THREE namespace. Use extend to add it to the catalog.`),s=new p(...n.args)}s.isCamera&&(n!=null&&n.position||s.position.set(3,3,3),n!=null&&n.lookAt||s.lookAt(0,0,0)),(n==null?void 0:n.attach)===void 0&&(s.isMaterial?s.attach="material":s.isBufferGeometry&&(s.attach="geometry"));const{GEOMETRY_VIA_PROP:c,MATERIAL_VIA_PROP:r}=G;return s.isObject3D&&((i=n==null?void 0:n.material)!=null&&i.isMaterial&&(s.userData[r]=!0),(u=n==null?void 0:n.geometry)!=null&&u.isBufferGeometry&&(s.userData[c]=!0)),s},insert(e,t){var a,n,o,s,c,r,i;if(t&&t.isScene&&(V=t),(((a=e==null?void 0:e.__vnode)==null?void 0:a.type)==="TresGroup"||((n=e==null?void 0:e.__vnode)==null?void 0:n.type)==="TresObject3D")&&t===null&&!((s=(o=e==null?void 0:e.__vnode)==null?void 0:o.ctx)!=null&&s.asyncResolved)){$=e;return}else(c=e==null?void 0:e.__vnode)!=null&&c.type.includes("Controls")&&t===null&&($=V);t||(t=$),e!=null&&e.isObject3D&&(t!=null&&t.isObject3D)?(t.add(e),e.dispatchEvent({type:"added"}),(i=(r=V==null?void 0:V.userData)==null?void 0:r[G.REGISTER_AT_POINTER_EVENT_HANDLER])==null||i.call(r,e)):e!=null&&e.isFog?t.fog=e:typeof(e==null?void 0:e.attach)=="string"&&(e.__previousAttach=e[t==null?void 0:t.attach],t&&(t[e.attach]=e))},remove(e){var t,a;if(e){if(e.isObject3D){const n=e,o=s=>{var i,u;const{GEOMETRY_VIA_PROP:c,MATERIAL_VIA_PROP:r}=G;s.userData[r]||(i=s.material)==null||i.dispose(),s.userData[c]||(u=s.geometry)==null||u.dispose()};n.traverse(s=>{o(s)}),o(n)}(t=e.removeFromParent)==null||t.call(e),(a=e.dispose)==null||a.call(e)}},patchProp(e,t,a,n){if(e){let o=e,s=t,c=B(s),r=o==null?void 0:o[c];if(o.type==="BufferGeometry"){if(s==="args")return;o.setAttribute(B(s),new g.BufferAttribute(...n));return}if(s.includes("-")&&r===void 0){const u=s.split("-");r=u.reduce((p,h)=>p[B(h)],o),s=u.pop(),c=s.toLowerCase(),r!=null&&r.set||(o=u.reduce((p,h)=>p[B(h)],o))}let i=n;if(i===""&&(i=!0),X(r)){Array.isArray(i)?e[c](...i):e[c](i);return}!(r!=null&&r.set)&&!X(r)?o[c]=i:r.constructor===i.constructor&&(r!=null&&r.copy)?r==null||r.copy(i):Array.isArray(i)?r.set(...i):!r.isColor&&r.setScalar?r.setScalar(i):r.set(i)}},parentNode(e){return(e==null?void 0:e.parent)||null},createText:()=>void 0,createComment:()=>void 0,setText:()=>void 0,setElementText:()=>void 0,nextSibling:()=>void 0,querySelector:()=>void 0,setScopeId:()=>void 0,cloneNode:()=>void 0,insertStaticContent:()=>void 0},{createApp:xe}=l.createRenderer(Re),ke=e=>{const t=xe(a);function a(){return e&&e.default?e.default():[]}return t};F(N);const{logWarning:le}=x(),Ve=l.defineComponent({name:"TresScene",props:["shadows","shadowMapType","physicallyCorrectLights","useLegacyLights","outputColorSpace","toneMapping","toneMappingExposure","context","powerPreference","preserveDrawingBuffer","clearColor","windowSize","preset","disableRender","camera"],setup(e,{slots:t,expose:a}){e.physicallyCorrectLights===!0&&le("physicallyCorrectLights is deprecated, useLegacyLights is now false by default");const n=l.computed(()=>e.disableRender!==!1&&e.disableRender!==void 0),o=l.ref(),s=l.ref(),c=new N.Scene,r=ce(),{setState:i}=E();c.userData[G.REGISTER_AT_POINTER_EVENT_HANDLER]=r.registerObject,i("scene",c),i("canvas",s),i("container",o),i("pointerEventHandler",r);const{onLoop:u,resume:p}=U();l.onMounted(()=>{P()}),l.onUnmounted(()=>{i("renderer",null)});const{activeCamera:h,pushCamera:v,clearCameras:L}=Z();function M(){const b=c.getObjectByProperty("isCamera",!0);if(b)v(b);else{le("No camera found. Creating a default perspective camera. To have full control over a camera, please add one to the scene.");const _=new N.PerspectiveCamera(45,window.innerWidth/window.innerHeight,.1,1e3);_.position.set(3,3,3),_.lookAt(0,0,0),v(_)}}function P(){const{renderer:b}=oe(e);e.camera&&v(e.camera),u(()=>{var _;h.value&&!n.value&&((_=b.value)==null||_.render(c,h.value))})}let C;function O(){C=ke(t);const b=E();C.provide("useTres",b),C.provide(j,b),C.provide("extend",F),C.mount(c),M()}return O(),a({scene:c}),l.watch(()=>e.camera,b=>{b&&(L(),v(b))}),()=>l.h(l.h("div",{ref:o,"data-scene":c.uuid,key:c.uuid,style:{position:"relative",width:"100%",height:"100%",pointerEvents:"auto",touchAction:"none"}},[l.h("div",{style:{width:"100%",height:"100%"}},[l.h("canvas",{ref:s,"data-scene":c.uuid,style:{display:"block",width:"100%",height:"100%",position:e.windowSize?"fixed":"absolute",top:0,left:0}})])]))}}),fe=l.defineComponent({name:"TresCanvas",props:["shadows","shadowMapType","physicallyCorrectLights","useLegacyLights","outputColorSpace","toneMapping","toneMappingExposure","context","powerPreference","preserveDrawingBuffer","clearColor","windowSize","preset","disableRender","camera"],setup(e,{slots:t,expose:a}){const n=J();return a(n),()=>l.h(Ve,e,t)}}),je=["TresCanvas","TresLeches","TresScene"],De={template:{compilerOptions:{isCustomElement:e=>e.startsWith("Tres")&&!je.includes(e)||e==="primitive"}}},Ie={install(e){e.component("TresCanvas",fe)}};m.CameraType=Q,m.TRES_CONTEXT_KEY=j,m.TresCanvas=fe,m.catalogue=z,m.default=Ie,m.extend=F,m.isProd=Oe,m.normalizeColor=ae,m.normalizeVectorFlexibleParam=Me,m.templateCompilerOptions=De,m.trasverseObjects=ie,m.useCamera=Z,m.useLoader=Te,m.useLogger=x,m.usePointerEventHandler=ce,m.useRaycaster=se,m.useRenderLoop=U,m.useRenderer=oe,m.useSeek=Ee,m.useTexture=Ae,m.useTres=E,m.useTresProvider=J,Object.defineProperties(m,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -0,0 +1,8 @@
1
+ declare const templateCompilerOptions: {
2
+ template: {
3
+ compilerOptions: {
4
+ isCustomElement: (tag: string) => boolean;
5
+ };
6
+ };
7
+ };
8
+ export default templateCompilerOptions;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tresjs/core",
3
3
  "description": "Declarative ThreeJS using Vue Components",
4
- "version": "2.3.0",
4
+ "version": "2.4.0",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@8.3.1",
7
7
  "author": "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)",
@@ -54,7 +54,8 @@
54
54
  "lint": "eslint . --ext .js,.jsx,.ts,.tsx,.vue",
55
55
  "docs:dev": "vitepress dev docs",
56
56
  "docs:build": "vitepress build docs",
57
- "docs:serve": "vitepress serve docs"
57
+ "docs:serve": "vitepress serve docs",
58
+ "docs:contributors": "esno scripts/update-contributors.ts"
58
59
  },
59
60
  "peerDependencies": {
60
61
  "three": ">=0.133",
@@ -62,9 +63,7 @@
62
63
  },
63
64
  "dependencies": {
64
65
  "@alvarosabu/utils": "^3.1.1",
65
- "@vueuse/core": "^10.1.2",
66
- "vue-zustand": "^0.5.0",
67
- "zustand": "^4.3.8"
66
+ "@vueuse/core": "^10.2.0"
68
67
  },
69
68
  "devDependencies": {
70
69
  "@alvarosabu/prettier-config": "^1.3.0",
@@ -73,18 +72,20 @@
73
72
  "@stackblitz/sdk": "^1.9.0",
74
73
  "@tresjs/cientos": "2.1.4",
75
74
  "@types/three": "^0.152.1",
76
- "@typescript-eslint/eslint-plugin": "^5.59.11",
77
- "@typescript-eslint/parser": "^5.59.11",
75
+ "@typescript-eslint/eslint-plugin": "^5.60.0",
76
+ "@typescript-eslint/parser": "^5.60.0",
78
77
  "@vitejs/plugin-vue": "^4.2.3",
79
- "@vitest/coverage-c8": "^0.32.0",
80
- "@vitest/ui": "^0.32.0",
81
- "@vue/test-utils": "^2.3.2",
82
- "eslint": "^8.42.0",
78
+ "@vitest/coverage-c8": "^0.32.2",
79
+ "@vitest/ui": "^0.32.2",
80
+ "@vue/test-utils": "^2.4.0",
81
+ "eslint": "^8.43.0",
83
82
  "eslint-config-prettier": "^8.8.0",
84
- "eslint-plugin-vue": "^9.14.1",
83
+ "eslint-plugin-vue": "^9.15.1",
84
+ "esno": "^0.16.3",
85
85
  "gsap": "^3.12.1",
86
86
  "jsdom": "^22.1.0",
87
87
  "kolorist": "^1.8.0",
88
+ "ohmyfetch": "^0.4.21",
88
89
  "pathe": "^1.1.1",
89
90
  "prettier": "^2.8.8",
90
91
  "release-it": "^15.11.0",
@@ -92,17 +93,17 @@
92
93
  "rollup-plugin-copy": "^3.4.0",
93
94
  "rollup-plugin-visualizer": "^5.9.2",
94
95
  "three": "^0.153.0",
95
- "unocss": "^0.53.1",
96
+ "unocss": "^0.53.3",
96
97
  "unplugin": "^1.3.1",
97
98
  "unplugin-vue-components": "^0.25.1",
98
99
  "vite": "^4.3.9",
99
100
  "vite-plugin-banner": "^0.7.0",
100
101
  "vite-plugin-dts": "2.3.0",
101
- "vite-plugin-inspect": "^0.7.28",
102
+ "vite-plugin-inspect": "^0.7.29",
102
103
  "vite-plugin-require-transform": "^1.0.17",
103
104
  "vite-svg-loader": "^4.0.0",
104
- "vitepress": "1.0.0-beta.2",
105
- "vitest": "^0.32.0",
105
+ "vitepress": "1.0.0-beta.3",
106
+ "vitest": "^0.32.2",
106
107
  "vue": "^3.3.4",
107
108
  "vue-demi": "^0.14.5"
108
109
  }