react-two.js 0.8.22-r.5 → 0.8.23-r.1

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.
@@ -4,6 +4,8 @@ type TwoConstructorProps = ConstructorParameters<typeof Two>[0];
4
4
  type TwoConstructorPropsKeys = NonNullable<TwoConstructorProps>;
5
5
  type ComponentProps = React.PropsWithChildren<TwoConstructorPropsKeys & {
6
6
  onPointerMissed?: (event: PointerEvent) => void;
7
+ } & {
8
+ container?: React.ComponentProps<'div'>;
7
9
  }>;
8
10
  export declare const Provider: React.FC<ComponentProps>;
9
11
  export {};
package/dist/Text.d.ts CHANGED
@@ -4,6 +4,7 @@ import { type EventHandlers } from './Properties';
4
4
  export type RefText = Instance;
5
5
  export declare const Text: React.ForwardRefExoticComponent<{
6
6
  visible?: boolean | undefined;
7
+ value?: string | undefined;
7
8
  renderer?: {
8
9
  type: "element" | "group" | "path" | "text" | "points" | string;
9
10
  elem?: SVGGElement | SVGPathElement | SVGTextElement | SVGPatternElement | SVGDefsElement | SVGGradientElement | SVGLinearGradientElement | SVGRadialGradientElement | SVGImageElement | SVGClipPathElement | SVGStopElement | SVGPatternElement;
@@ -26,12 +27,11 @@ export declare const Text: React.ForwardRefExoticComponent<{
26
27
  dashes?: (number[] & {
27
28
  offset?: number;
28
29
  }) | undefined;
29
- value?: string | undefined;
30
30
  size?: number | undefined;
31
+ style?: import("two.js/src/text").StyleProperties | undefined;
31
32
  family?: string | undefined;
32
33
  leading?: number | undefined;
33
34
  alignment?: import("two.js/src/text").AlignmentProperties | undefined;
34
- style?: import("two.js/src/text").StyleProperties | undefined;
35
35
  weight?: string | number | undefined;
36
36
  decoration?: import("two.js/src/text").DecorationProperties | undefined;
37
37
  direction?: import("two.js/src/text").DirectionProperties | undefined;
package/dist/Texture.d.ts CHANGED
@@ -14,9 +14,9 @@ export declare const Texture: React.ForwardRefExoticComponent<{
14
14
  className?: string | undefined;
15
15
  repeat?: import("two.js/src/effects/texture").RepeatProperties | undefined;
16
16
  src?: string | undefined;
17
+ image?: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | undefined;
17
18
  loaded?: boolean | undefined;
18
19
  offset?: import("two.js/src/vector").Vector | undefined;
19
- image?: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | undefined;
20
20
  } & {
21
21
  src?: string | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement;
22
22
  } & {
@@ -1,5 +1,5 @@
1
- import { jsx as E, Fragment as T } from "react/jsx-runtime";
2
- import k, { createContext as Z, useContext as X, useRef as A, useEffect as h, useState as $, useCallback as oe, useMemo as g, useImperativeHandle as R } from "react";
1
+ import { jsx as b, Fragment as O } from "react/jsx-runtime";
2
+ import k, { createContext as Z, useContext as X, useRef as N, useEffect as h, useState as $, useCallback as oe, useMemo as g, useImperativeHandle as R } from "react";
3
3
  import H from "two.js";
4
4
  const ee = Z({
5
5
  two: null,
@@ -13,13 +13,13 @@ const ee = Z({
13
13
  width: 0,
14
14
  height: 0
15
15
  }), ce = ee, C = () => {
16
- const t = X(ee), s = X(J), r = X(Q);
17
- return { ...t, ...s, ...r };
18
- }, ve = (t, s = []) => {
19
- const { two: r } = C(), l = A(t);
16
+ const t = X(ee), i = X(J), r = X(Q);
17
+ return { ...t, ...i, ...r };
18
+ }, ve = (t, i = []) => {
19
+ const { two: r } = C(), l = N(t);
20
20
  h(() => {
21
21
  l.current = t;
22
- }, [t, ...s]), h(() => {
22
+ }, [t, ...i]), h(() => {
23
23
  if (!r)
24
24
  return;
25
25
  let n = 0;
@@ -27,8 +27,8 @@ const ee = Z({
27
27
  function u(a, e) {
28
28
  n += e / 1e3, l.current?.(n, e);
29
29
  }
30
- }, [r, ...s]);
31
- }, O = [
30
+ }, [r, ...i]);
31
+ }, L = [
32
32
  "onClick",
33
33
  "onContextMenu",
34
34
  "onDoubleClick",
@@ -42,19 +42,19 @@ const ee = Z({
42
42
  "onPointerMove",
43
43
  "onPointerCancel"
44
44
  ];
45
- function ie(t, s, r) {
46
- const l = s.getBoundingClientRect(), n = t.clientX - l.left - r.width / 2, u = t.clientY - l.top - r.height / 2;
45
+ function se(t, i, r) {
46
+ const l = i.getBoundingClientRect(), n = t.clientX - l.left - r.width / 2, u = t.clientY - l.top - r.height / 2;
47
47
  return { x: n, y: u };
48
48
  }
49
- function U(t, s) {
50
- const r = s.getBoundingClientRect(), l = t.clientX - r.left, n = t.clientY - r.top;
49
+ function A(t, i) {
50
+ const r = i.getBoundingClientRect(), l = t.clientX - r.left, n = t.clientY - r.top;
51
51
  return { x: l, y: n };
52
52
  }
53
- function se(t, s, r, l) {
53
+ function ie(t, i, r, l) {
54
54
  let n = !1;
55
55
  return {
56
56
  nativeEvent: t,
57
- target: s,
57
+ target: i,
58
58
  currentTarget: r,
59
59
  point: l,
60
60
  stopPropagation: () => {
@@ -65,29 +65,29 @@ function se(t, s, r, l) {
65
65
  }
66
66
  };
67
67
  }
68
- function ae(t, s, r) {
69
- return "visible" in t && !t.visible ? !1 : typeof t.contains == "function" ? t.contains(s, r) : !1;
68
+ function ae(t, i, r) {
69
+ return "visible" in t && !t.visible ? !1 : typeof t.contains == "function" ? t.contains(i, r) : !1;
70
70
  }
71
- function q(t, s, r) {
71
+ function U(t, i, r) {
72
72
  const l = [];
73
73
  for (const [n] of t)
74
- ae(n, s, r) && l.push(n);
74
+ ae(n, i, r) && l.push(n);
75
75
  return l;
76
76
  }
77
- function le(t, s) {
78
- const r = [t], l = s.get(t);
77
+ function le(t, i) {
78
+ const r = [t], l = i.get(t);
79
79
  if (l?.parent) {
80
80
  let n = l.parent;
81
81
  for (; n; )
82
- r.push(n), n = s.get(n)?.parent;
82
+ r.push(n), n = i.get(n)?.parent;
83
83
  }
84
84
  return r;
85
85
  }
86
86
  function Y(t) {
87
- process.env.NODE_ENV !== "production" && k.Children.forEach(t, (s) => {
88
- if (!k.isValidElement(s))
87
+ process.env.NODE_ENV !== "production" && k.Children.forEach(t, (i) => {
88
+ if (!k.isValidElement(i))
89
89
  return;
90
- const r = s.type;
90
+ const r = i.type;
91
91
  if (typeof r == "string") {
92
92
  console.warn(
93
93
  `[react-two.js] <${r}> is not compatible with Canvas.
@@ -99,64 +99,62 @@ See: https://github.com/jonobr1/react-two.js#usage`
99
99
  }
100
100
  if (r === k.Fragment) {
101
101
  Y(
102
- s.props.children
102
+ i.props.children
103
103
  );
104
104
  return;
105
105
  }
106
- typeof r == "function" && s.props.children && Y(
107
- s.props.children
106
+ typeof r == "function" && i.props.children && Y(
107
+ i.props.children
108
108
  );
109
109
  });
110
110
  }
111
111
  const pe = (t) => {
112
- const { two: s, parent: r } = C(), l = A(null), n = A(/* @__PURE__ */ new Map()), u = A(/* @__PURE__ */ new Set()), a = A(null), [e, o] = $(s), [c, i] = $(r), [d, f] = $(0), [v, p] = $(0), j = oe(
113
- (m, S, b) => {
114
- n.current.set(m, { shape: m, handlers: S, parent: b });
112
+ const { two: i, parent: r } = C(), l = N(null), n = N(/* @__PURE__ */ new Map()), u = N(/* @__PURE__ */ new Set()), a = N(null), [e, o] = $(i), [c, s] = $(r), [d, f] = $(0), [v, p] = $(0), j = oe(
113
+ (m, S, E) => {
114
+ n.current.set(m, { shape: m, handlers: S, parent: E });
115
115
  },
116
116
  []
117
- ), M = oe((m) => {
117
+ ), V = oe((m) => {
118
118
  n.current.delete(m), u.current.delete(m), a.current === m && (a.current = null);
119
119
  }, []);
120
120
  h(() => {
121
- if (!s) {
121
+ if (!i) {
122
122
  const S = { ...t };
123
123
  delete S.children;
124
- const b = new H(S).appendTo(l.current);
125
- return o(b), i(b.scene), f(b.width), p(b.height), () => {
126
- b.renderer.domElement.parentElement?.removeChild(
127
- b.renderer.domElement
128
- ), b.pause(), b.unbind(), b.release();
129
- const I = H.Instances.indexOf(b);
130
- I >= 0 && H.Instances.splice(I, 1), b.clear();
124
+ const E = new H(S).appendTo(l.current);
125
+ return o(E), s(E.scene), f(E.width), p(E.height), () => {
126
+ E.renderer.domElement.parentElement?.removeChild(
127
+ E.renderer.domElement
128
+ ), E.pause(), E.unbind(), E.release();
129
+ const q = H.Instances.indexOf(E);
130
+ q >= 0 && H.Instances.splice(q, 1), E.clear();
131
131
  };
132
132
  }
133
133
  }, []), h(() => {
134
- !s && (typeof t.width == "number" && (e && (e.width = t.width), f(t.width)), typeof t.height == "number" && (e && (e.height = t.height), p(t.height)));
135
- }, [s, e, t.width, t.height]), h(() => {
136
- if (!s && e) {
134
+ !i && (typeof t.width == "number" && (e && (e.width = t.width), f(t.width)), typeof t.height == "number" && (e && (e.height = t.height), p(t.height)));
135
+ }, [i, e, t.width, t.height]), h(() => {
136
+ if (!i && e) {
137
137
  let S = function() {
138
- const V = b.width !== I, G = b.height !== L;
139
- V && (I = b.width), G && (L = b.height), (V || G) && (f(I), p(L));
138
+ f(E.width), p(E.height);
140
139
  };
141
- const b = e;
142
- let I = b.width, L = b.height;
143
- return (t.fullscreen || t.fitted) && b.bind("update", S), () => {
144
- b.unbind("update", S);
140
+ const E = e;
141
+ return E.renderer.bind("resize", S), () => {
142
+ E.renderer.unbind("resize", S);
145
143
  };
146
144
  }
147
- }, [s, e, t.fullscreen, t.fitted]), h(() => {
145
+ }, [i, e]), h(() => {
148
146
  process.env.NODE_ENV !== "production" && Y(t.children);
149
147
  }, [t.children]), h(() => {
150
148
  if (!e) return;
151
- const m = e.renderer.domElement, S = (y, w, P) => {
149
+ const m = e.renderer.domElement, S = (y, P, w) => {
152
150
  if (y.length === 0) return;
153
- const N = y[0], B = ie(P, m, e), F = le(N, n.current);
154
- for (const ne of F) {
155
- const te = n.current.get(ne)?.handlers[w];
151
+ const I = y[0], B = se(w, m, e), z = le(I, n.current);
152
+ for (const ne of z) {
153
+ const te = n.current.get(ne)?.handlers[P];
156
154
  if (te) {
157
- const re = se(
158
- P,
159
- N,
155
+ const re = ie(
156
+ w,
157
+ I,
160
158
  ne,
161
159
  B
162
160
  );
@@ -164,104 +162,100 @@ const pe = (t) => {
164
162
  break;
165
163
  }
166
164
  }
167
- }, b = (y) => {
168
- const w = U(y, m), P = q(
165
+ }, E = (y) => {
166
+ const P = A(y, m), w = U(
169
167
  n.current,
170
- w.x,
171
- w.y
168
+ P.x,
169
+ P.y
172
170
  );
173
- P.length > 0 && S(P, "onClick", y);
174
- }, I = (y) => {
175
- const w = U(y, m), P = q(
171
+ w.length > 0 && S(w, "onClick", y);
172
+ }, q = (y) => {
173
+ const P = A(y, m), w = U(
176
174
  n.current,
177
- w.x,
178
- w.y
175
+ P.x,
176
+ P.y
179
177
  );
180
- P.length > 0 && S(P, "onContextMenu", y);
181
- }, L = (y) => {
182
- const w = U(y, m), P = q(
178
+ w.length > 0 && S(w, "onContextMenu", y);
179
+ }, G = (y) => {
180
+ const P = A(y, m), w = U(
183
181
  n.current,
184
- w.x,
185
- w.y
182
+ P.x,
183
+ P.y
186
184
  );
187
- P.length > 0 && S(P, "onDoubleClick", y);
188
- }, V = (y) => {
189
- const w = U(y, m), P = q(
185
+ w.length > 0 && S(w, "onDoubleClick", y);
186
+ }, T = (y) => {
187
+ const P = A(y, m), w = U(
190
188
  n.current,
191
- w.x,
192
- w.y
189
+ P.x,
190
+ P.y
193
191
  );
194
- P.length > 0 && S(P, "onWheel", y);
195
- }, G = (y) => {
196
- const w = U(y, m), P = q(
192
+ w.length > 0 && S(w, "onWheel", y);
193
+ }, D = (y) => {
194
+ const P = A(y, m), w = U(
197
195
  n.current,
198
- w.x,
199
- w.y
196
+ P.x,
197
+ P.y
200
198
  );
201
- P.length > 0 && (S(P, "onPointerDown", y), y.target instanceof Element && y.target.hasPointerCapture?.(y.pointerId) && (a.current = P[0]));
199
+ w.length > 0 && (S(w, "onPointerDown", y), y.target instanceof Element && y.target.hasPointerCapture?.(y.pointerId) && (a.current = w[0]));
202
200
  }, _ = (y) => {
203
201
  if (a.current) {
204
- const N = n.current.get(a.current);
205
- if (N?.handlers.onPointerUp) {
206
- const B = ie(y, m, e), F = se(
202
+ const I = n.current.get(a.current);
203
+ if (I?.handlers.onPointerUp) {
204
+ const B = se(y, m, e), z = ie(
207
205
  y,
208
206
  a.current,
209
207
  a.current,
210
208
  B
211
209
  );
212
- N.handlers.onPointerUp(F);
210
+ I.handlers.onPointerUp(z);
213
211
  }
214
212
  a.current = null;
215
213
  return;
216
214
  }
217
- const w = U(y, m), P = q(
215
+ const P = A(y, m), w = U(
218
216
  n.current,
219
- w.x,
220
- w.y
217
+ P.x,
218
+ P.y
221
219
  );
222
- P.length > 0 ? S(P, "onPointerUp", y) : t.onPointerMissed && t.onPointerMissed(y);
223
- }, z = (y) => {
224
- const w = U(y, m), P = q(
220
+ w.length > 0 ? S(w, "onPointerUp", y) : t.onPointerMissed && t.onPointerMissed(y);
221
+ }, F = (y) => {
222
+ const P = A(y, m), w = U(
225
223
  n.current,
226
- w.x,
227
- w.y
228
- ), N = new Set(P);
229
- P.length > 0 && S(P, "onPointerMove", y);
224
+ P.x,
225
+ P.y
226
+ ), I = new Set(w);
227
+ w.length > 0 && S(w, "onPointerMove", y);
230
228
  const B = u.current;
231
- for (const F of N)
232
- B.has(F) || (S([F], "onPointerEnter", y), S([F], "onPointerOver", y));
233
- for (const F of B)
234
- N.has(F) || (S([F], "onPointerLeave", y), S([F], "onPointerOut", y));
235
- u.current = N;
229
+ for (const z of I)
230
+ B.has(z) || (S([z], "onPointerEnter", y), S([z], "onPointerOver", y));
231
+ for (const z of B)
232
+ I.has(z) || (S([z], "onPointerLeave", y), S([z], "onPointerOut", y));
233
+ u.current = I;
236
234
  }, W = (y) => {
237
- const w = U(y, m), P = q(
235
+ const P = A(y, m), w = U(
238
236
  n.current,
239
- w.x,
240
- w.y
237
+ P.x,
238
+ P.y
241
239
  );
242
- P.length > 0 && S(P, "onPointerCancel", y), a.current = null;
240
+ w.length > 0 && S(w, "onPointerCancel", y), a.current = null;
243
241
  };
244
- return m.addEventListener("click", b), m.addEventListener("contextmenu", I), m.addEventListener("dblclick", L), m.addEventListener("wheel", V), m.addEventListener("pointerdown", G), m.addEventListener("pointerup", _), m.addEventListener("pointermove", z), m.addEventListener("pointercancel", W), () => {
245
- m.removeEventListener("click", b), m.removeEventListener("contextmenu", I), m.removeEventListener("dblclick", L), m.removeEventListener("wheel", V), m.removeEventListener("pointerdown", G), m.removeEventListener("pointerup", _), m.removeEventListener("pointermove", z), m.removeEventListener("pointercancel", W);
242
+ return m.addEventListener("click", E), m.addEventListener("contextmenu", q), m.addEventListener("dblclick", G), m.addEventListener("wheel", T), m.addEventListener("pointerdown", D), m.addEventListener("pointerup", _), m.addEventListener("pointermove", F), m.addEventListener("pointercancel", W), () => {
243
+ m.removeEventListener("click", E), m.removeEventListener("contextmenu", q), m.removeEventListener("dblclick", G), m.removeEventListener("wheel", T), m.removeEventListener("pointerdown", D), m.removeEventListener("pointerup", _), m.removeEventListener("pointermove", F), m.removeEventListener("pointercancel", W);
246
244
  };
247
245
  }, [
248
246
  e,
249
247
  t.onPointerMissed,
250
248
  j,
251
- M
249
+ V
252
250
  ]);
253
- const x = g(
251
+ const M = g(
254
252
  () => ({
255
253
  two: e,
256
254
  registerEventShape: j,
257
- unregisterEventShape: M
255
+ unregisterEventShape: V
258
256
  }),
259
- [
260
- e,
261
- j,
262
- M
263
- ]
264
- ), D = g(
257
+ [e, j, V]
258
+ ), x = g(
265
259
  () => ({
266
260
  parent: c
267
261
  }),
@@ -273,9 +267,9 @@ const pe = (t) => {
273
267
  }),
274
268
  [d, v]
275
269
  );
276
- return /* @__PURE__ */ E(ee.Provider, { value: x, children: /* @__PURE__ */ E(J.Provider, { value: D, children: /* @__PURE__ */ E(Q.Provider, { value: K, children: /* @__PURE__ */ E("div", { ref: l, children: t.children }) }) }) });
270
+ return /* @__PURE__ */ b(ee.Provider, { value: M, children: /* @__PURE__ */ b(J.Provider, { value: x, children: /* @__PURE__ */ b(Q.Provider, { value: K, children: /* @__PURE__ */ b("div", { ref: l, ...t.container, children: t.children }) }) }) });
277
271
  }, ge = k.forwardRef(
278
- ({ x: t, y: s, ...r }, l) => {
272
+ ({ x: t, y: i, ...r }, l) => {
279
273
  const {
280
274
  two: n,
281
275
  parent: u,
@@ -283,38 +277,38 @@ const pe = (t) => {
283
277
  height: e,
284
278
  registerEventShape: o,
285
279
  unregisterEventShape: c
286
- } = C(), i = g(() => new H.Group(), []), { eventHandlers: d, shapeProps: f } = g(() => {
287
- const M = {}, x = {};
288
- for (const D in r)
289
- O.includes(D) ? M[D] = r[
290
- D
280
+ } = C(), s = g(() => new H.Group(), []), { eventHandlers: d, shapeProps: f } = g(() => {
281
+ const V = {}, M = {};
282
+ for (const x in r)
283
+ L.includes(x) ? V[x] = r[
284
+ x
291
285
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
292
- ] : x[D] = r[D];
293
- return { eventHandlers: M, shapeProps: x };
286
+ ] : M[x] = r[x];
287
+ return { eventHandlers: V, shapeProps: M };
294
288
  }, [r]);
295
289
  h(() => {
296
290
  if (u)
297
- return u.add(i), () => {
298
- u.remove(i);
299
- };
300
- }, [u, i]), h(() => {
301
- typeof t == "number" && (i.translation.x = t), typeof s == "number" && (i.translation.y = s);
302
- const M = { ...f };
303
- delete M.children;
304
- for (const x in M)
305
- x in i && (i[x] = M[x]);
306
- }, [i, t, s, f]), h(() => {
291
+ return u.add(s), () => {
292
+ u.remove(s);
293
+ };
294
+ }, [u, s]), h(() => {
295
+ typeof t == "number" && (s.translation.x = t), typeof i == "number" && (s.translation.y = i);
296
+ const V = { ...f };
297
+ delete V.children;
298
+ for (const M in V)
299
+ M in s && (s[M] = V[M]);
300
+ }, [s, t, i, f]), h(() => {
307
301
  if (Object.keys(d).length > 0)
308
- return o(i, d, u ?? void 0), () => {
309
- c(i);
302
+ return o(s, d, u ?? void 0), () => {
303
+ c(s);
310
304
  };
311
305
  }, [
312
- i,
306
+ s,
313
307
  o,
314
308
  c,
315
309
  u,
316
310
  d
317
- ]), R(l, () => i, [i]);
311
+ ]), R(l, () => s, [s]);
318
312
  const v = g(
319
313
  () => ({
320
314
  two: n,
@@ -324,9 +318,9 @@ const pe = (t) => {
324
318
  [n, o, c]
325
319
  ), p = g(
326
320
  () => ({
327
- parent: i
321
+ parent: s
328
322
  }),
329
- [i]
323
+ [s]
330
324
  ), j = g(
331
325
  () => ({
332
326
  width: a,
@@ -334,31 +328,31 @@ const pe = (t) => {
334
328
  }),
335
329
  [a, e]
336
330
  );
337
- return /* @__PURE__ */ E(ce.Provider, { value: v, children: /* @__PURE__ */ E(J.Provider, { value: p, children: /* @__PURE__ */ E(Q.Provider, { value: j, children: r.children }) }) });
331
+ return /* @__PURE__ */ b(ce.Provider, { value: v, children: /* @__PURE__ */ b(J.Provider, { value: p, children: /* @__PURE__ */ b(Q.Provider, { value: j, children: r.children }) }) });
338
332
  }
339
333
  ), ye = k.forwardRef(
340
- ({ x: t, y: s, src: r, content: l, onLoad: n, onError: u, ...a }, e) => {
334
+ ({ x: t, y: i, src: r, content: l, onLoad: n, onError: u, ...a }, e) => {
341
335
  const {
342
336
  two: o,
343
337
  parent: c,
344
- width: i,
338
+ width: s,
345
339
  height: d,
346
340
  registerEventShape: f,
347
341
  unregisterEventShape: v
348
- } = C(), p = g(() => new H.Group(), []), j = A(null), M = A(n), x = A(u), D = A({ two: null, key: null });
342
+ } = C(), p = g(() => new H.Group(), []), j = N(null), V = N(n), M = N(u), x = N({ two: null, key: null });
349
343
  h(() => {
350
- M.current = n;
344
+ V.current = n;
351
345
  }, [n]), h(() => {
352
- x.current = u;
346
+ M.current = u;
353
347
  }, [u]);
354
348
  const { eventHandlers: K, shapeProps: m } = g(() => {
355
- const L = {}, V = {};
356
- for (const G in a)
357
- O.includes(G) ? L[G] = a[
358
- G
349
+ const G = {}, T = {};
350
+ for (const D in a)
351
+ L.includes(D) ? G[D] = a[
352
+ D
359
353
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
360
- ] : V[G] = a[G];
361
- return { eventHandlers: L, shapeProps: V };
354
+ ] : T[D] = a[D];
355
+ return { eventHandlers: G, shapeProps: T };
362
356
  }, [a]);
363
357
  h(() => {
364
358
  j.current = p;
@@ -375,56 +369,56 @@ const pe = (t) => {
375
369
  );
376
370
  }, [r, l]), h(() => {
377
371
  if (!o) return;
378
- const L = r || l;
379
- if (!L) return;
380
- const V = L, G = D.current;
381
- if (G.two === o && G.key === V)
372
+ const G = r || l;
373
+ if (!G) return;
374
+ const T = G, D = x.current;
375
+ if (D.two === o && D.key === T)
382
376
  return;
383
377
  let _ = !0;
384
- D.current = { two: o, key: V };
378
+ x.current = { two: o, key: T };
385
379
  try {
386
380
  o.load(
387
- L,
388
- (z, W) => {
381
+ G,
382
+ (F, W) => {
389
383
  if (!_) return;
390
- j.current?.add(z.children);
391
- const y = M.current;
384
+ j.current?.add(F.children);
385
+ const y = V.current;
392
386
  if (y)
393
387
  try {
394
388
  requestAnimationFrame(() => y(j.current, W));
395
- } catch (w) {
389
+ } catch (P) {
396
390
  console.error(
397
391
  "[react-two.js] Error in SVG onLoad callback:",
398
- w
392
+ P
399
393
  );
400
394
  }
401
395
  }
402
396
  );
403
- } catch (z) {
397
+ } catch (F) {
404
398
  if (!_) return;
405
- const W = z instanceof Error ? z : new Error("Failed to load SVG"), y = x.current;
399
+ const W = F instanceof Error ? F : new Error("Failed to load SVG"), y = M.current;
406
400
  if (y)
407
401
  try {
408
402
  y(W);
409
- } catch (w) {
403
+ } catch (P) {
410
404
  console.error(
411
405
  "[react-two.js] Error in SVG onError callback:",
412
- w
406
+ P
413
407
  );
414
408
  }
415
409
  else
416
410
  console.error("[react-two.js] SVG loading error:", W);
417
411
  }
418
412
  return () => {
419
- _ = !1, D.current = { two: null, key: null }, j.current?.remove(j.current.children);
413
+ _ = !1, x.current = { two: null, key: null }, j.current?.remove(j.current.children);
420
414
  };
421
415
  }, [o, r, l]), h(() => {
422
- typeof t == "number" && (p.translation.x = t), typeof s == "number" && (p.translation.y = s);
423
- const L = { ...m };
424
- delete L.children;
425
- for (const V in L)
426
- V in p && (p[V] = L[V]);
427
- }, [p, t, s, m]), h(() => {
416
+ typeof t == "number" && (p.translation.x = t), typeof i == "number" && (p.translation.y = i);
417
+ const G = { ...m };
418
+ delete G.children;
419
+ for (const T in G)
420
+ T in p && (p[T] = G[T]);
421
+ }, [p, t, i, m]), h(() => {
428
422
  if (Object.keys(K).length > 0)
429
423
  return f(p, K, c ?? void 0), () => {
430
424
  v(p);
@@ -437,26 +431,26 @@ const pe = (t) => {
437
431
  unregisterEventShape: v
438
432
  }),
439
433
  [o, f, v]
440
- ), b = g(
434
+ ), E = g(
441
435
  () => ({
442
436
  parent: p
443
437
  }),
444
438
  [p]
445
- ), I = g(
439
+ ), q = g(
446
440
  () => ({
447
- width: i,
441
+ width: s,
448
442
  height: d
449
443
  }),
450
- [i, d]
444
+ [s, d]
451
445
  );
452
- return /* @__PURE__ */ E(ce.Provider, { value: S, children: /* @__PURE__ */ E(J.Provider, { value: b, children: /* @__PURE__ */ E(Q.Provider, { value: I, children: a.children }) }) });
446
+ return /* @__PURE__ */ b(ce.Provider, { value: S, children: /* @__PURE__ */ b(J.Provider, { value: E, children: /* @__PURE__ */ b(Q.Provider, { value: q, children: a.children }) }) });
453
447
  }
454
448
  ), me = k.forwardRef(
455
- ({ manual: t, x: s, y: r, ...l }, n) => {
456
- const { parent: u, registerEventShape: a, unregisterEventShape: e } = C(), o = g(() => new H.Path(), []), { eventHandlers: c, shapeProps: i } = g(() => {
449
+ ({ manual: t, x: i, y: r, ...l }, n) => {
450
+ const { parent: u, registerEventShape: a, unregisterEventShape: e } = C(), o = g(() => new H.Path(), []), { eventHandlers: c, shapeProps: s } = g(() => {
457
451
  const d = {}, f = {};
458
452
  for (const v in l)
459
- O.includes(v) ? d[v] = l[
453
+ L.includes(v) ? d[v] = l[
460
454
  v
461
455
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
462
456
  ] : f[v] = l[v];
@@ -473,21 +467,21 @@ const pe = (t) => {
473
467
  e(o);
474
468
  };
475
469
  }, [o, a, e, u, c]), h(() => {
476
- typeof s == "number" && (o.translation.x = s), typeof r == "number" && (o.translation.y = r), typeof t < "u" && (o.automatic = !t);
477
- for (const d in i)
478
- d in o && (o[d] = i[d]);
479
- }, [i, o, s, r, t]), R(n, () => o, [o]), /* @__PURE__ */ E(T, {});
470
+ typeof i == "number" && (o.translation.x = i), typeof r == "number" && (o.translation.y = r), typeof t < "u" && (o.automatic = !t);
471
+ for (const d in s)
472
+ d in o && (o[d] = s[d]);
473
+ }, [s, o, i, r, t]), R(n, () => o, [o]), /* @__PURE__ */ b(O, {});
480
474
  }
481
- ), we = k.forwardRef(
482
- ({ x: t, y: s, ...r }, l) => {
475
+ ), Pe = k.forwardRef(
476
+ ({ x: t, y: i, ...r }, l) => {
483
477
  const { parent: n, registerEventShape: u, unregisterEventShape: a } = C(), e = g(() => new H.Points(), []), { eventHandlers: o, shapeProps: c } = g(() => {
484
- const i = {}, d = {};
478
+ const s = {}, d = {};
485
479
  for (const f in r)
486
- O.includes(f) ? i[f] = r[
480
+ L.includes(f) ? s[f] = r[
487
481
  f
488
482
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
489
483
  ] : d[f] = r[f];
490
- return { eventHandlers: i, shapeProps: d };
484
+ return { eventHandlers: s, shapeProps: d };
491
485
  }, [r]);
492
486
  return h(() => {
493
487
  if (n)
@@ -495,10 +489,10 @@ const pe = (t) => {
495
489
  n.remove(e);
496
490
  };
497
491
  }, [n, e]), h(() => {
498
- typeof t == "number" && (e.translation.x = t), typeof s == "number" && (e.translation.y = s);
499
- for (const i in c)
500
- i in e && (e[i] = c[i]);
501
- }, [c, e, t, s]), h(() => {
492
+ typeof t == "number" && (e.translation.x = t), typeof i == "number" && (e.translation.y = i);
493
+ for (const s in c)
494
+ s in e && (e[s] = c[s]);
495
+ }, [c, e, t, i]), h(() => {
502
496
  if (Object.keys(o).length > 0)
503
497
  return u(e, o, n ?? void 0), () => {
504
498
  a(e);
@@ -509,18 +503,18 @@ const pe = (t) => {
509
503
  a,
510
504
  n,
511
505
  o
512
- ]), R(l, () => e, [e]), /* @__PURE__ */ E(T, {});
506
+ ]), R(l, () => e, [e]), /* @__PURE__ */ b(O, {});
513
507
  }
514
- ), Pe = k.forwardRef(
515
- ({ x: t, y: s, ...r }, l) => {
508
+ ), we = k.forwardRef(
509
+ ({ x: t, y: i, ...r }, l) => {
516
510
  const { parent: n, registerEventShape: u, unregisterEventShape: a } = C(), e = g(() => new H.Text(), []), { eventHandlers: o, shapeProps: c } = g(() => {
517
- const i = {}, d = {};
511
+ const s = {}, d = {};
518
512
  for (const f in r)
519
- O.includes(f) ? i[f] = r[
513
+ L.includes(f) ? s[f] = r[
520
514
  f
521
515
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
522
516
  ] : d[f] = r[f];
523
- return { eventHandlers: i, shapeProps: d };
517
+ return { eventHandlers: s, shapeProps: d };
524
518
  }, [r]);
525
519
  return h(() => {
526
520
  if (n)
@@ -528,25 +522,25 @@ const pe = (t) => {
528
522
  n.remove(e);
529
523
  };
530
524
  }, [n, e]), h(() => {
531
- typeof t == "number" && (e.translation.x = t), typeof s == "number" && (e.translation.y = s);
532
- for (const i in c)
533
- i in e && (e[i] = c[i]);
534
- }, [c, e, t, s]), h(() => {
525
+ typeof t == "number" && (e.translation.x = t), typeof i == "number" && (e.translation.y = i);
526
+ for (const s in c)
527
+ s in e && (e[s] = c[s]);
528
+ }, [c, e, t, i]), h(() => {
535
529
  if (Object.keys(o).length > 0)
536
530
  return u(e, o, n ?? void 0), () => {
537
531
  a(e);
538
532
  };
539
- }, [e, u, a, n, o]), R(l, () => e, [e]), /* @__PURE__ */ E(T, {});
533
+ }, [e, u, a, n, o]), R(l, () => e, [e]), /* @__PURE__ */ b(O, {});
540
534
  }
541
535
  ), be = k.forwardRef(
542
- ({ x: t, y: s, resolution: r, ...l }, n) => {
536
+ ({ x: t, y: i, resolution: r, ...l }, n) => {
543
537
  const { parent: u, registerEventShape: a, unregisterEventShape: e } = C(), o = g(
544
538
  () => new H.ArcSegment(0, 0, 0, 0, 0, 0, r),
545
539
  [r]
546
- ), { eventHandlers: c, shapeProps: i } = g(() => {
540
+ ), { eventHandlers: c, shapeProps: s } = g(() => {
547
541
  const d = {}, f = {};
548
542
  for (const v in l)
549
- O.includes(v) ? d[v] = l[
543
+ L.includes(v) ? d[v] = l[
550
544
  v
551
545
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
552
546
  ] : f[v] = l[v];
@@ -558,10 +552,10 @@ const pe = (t) => {
558
552
  u.remove(o);
559
553
  };
560
554
  }, [u, o]), h(() => {
561
- typeof t == "number" && (o.translation.x = t), typeof s == "number" && (o.translation.y = s);
562
- for (const d in i)
563
- d in o && (o[d] = i[d]);
564
- }, [i, o, t, s]), h(() => {
555
+ typeof t == "number" && (o.translation.x = t), typeof i == "number" && (o.translation.y = i);
556
+ for (const d in s)
557
+ d in o && (o[d] = s[d]);
558
+ }, [s, o, t, i]), h(() => {
565
559
  if (Object.keys(c).length > 0)
566
560
  return a(o, c, u ?? void 0), () => {
567
561
  e(o);
@@ -572,27 +566,27 @@ const pe = (t) => {
572
566
  e,
573
567
  u,
574
568
  c
575
- ]), R(n, () => o, [o]), /* @__PURE__ */ E(T, {});
569
+ ]), R(n, () => o, [o]), /* @__PURE__ */ b(O, {});
576
570
  }
577
571
  ), Ee = k.forwardRef(
578
- ({ x: t, y: s, resolution: r, ...l }, n) => {
572
+ ({ x: t, y: i, resolution: r, ...l }, n) => {
579
573
  const { parent: u, registerEventShape: a, unregisterEventShape: e } = C(), o = g(
580
574
  () => new H.Circle(0, 0, 0, r),
581
575
  [r]
582
- ), { eventHandlers: c, shapeProps: i } = g(() => {
576
+ ), { eventHandlers: c, shapeProps: s } = g(() => {
583
577
  const d = {}, f = {};
584
578
  for (const v in l)
585
- O.includes(v) ? d[v] = l[
579
+ L.includes(v) ? d[v] = l[
586
580
  v
587
581
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
588
582
  ] : f[v] = l[v];
589
583
  return { eventHandlers: d, shapeProps: f };
590
584
  }, [l]);
591
585
  return h(() => {
592
- typeof t == "number" && (o.translation.x = t), typeof s == "number" && (o.translation.y = s);
593
- for (const d in i)
594
- d in o && (o[d] = i[d]);
595
- }, [o, i, t, s]), h(() => {
586
+ typeof t == "number" && (o.translation.x = t), typeof i == "number" && (o.translation.y = i);
587
+ for (const d in s)
588
+ d in o && (o[d] = s[d]);
589
+ }, [o, s, t, i]), h(() => {
596
590
  if (u)
597
591
  return u.add(o), () => {
598
592
  u.remove(o);
@@ -608,17 +602,17 @@ const pe = (t) => {
608
602
  e,
609
603
  u,
610
604
  c
611
- ]), R(n, () => o, [o]), /* @__PURE__ */ E(T, {});
605
+ ]), R(n, () => o, [o]), /* @__PURE__ */ b(O, {});
612
606
  }
613
607
  ), Se = k.forwardRef(
614
- ({ x: t, y: s, resolution: r, ...l }, n) => {
608
+ ({ x: t, y: i, resolution: r, ...l }, n) => {
615
609
  const { parent: u, registerEventShape: a, unregisterEventShape: e } = C(), o = g(
616
610
  () => new H.Ellipse(0, 0, 0, 0, r),
617
611
  [r]
618
- ), { eventHandlers: c, shapeProps: i } = g(() => {
612
+ ), { eventHandlers: c, shapeProps: s } = g(() => {
619
613
  const d = {}, f = {};
620
614
  for (const v in l)
621
- O.includes(v) ? d[v] = l[
615
+ L.includes(v) ? d[v] = l[
622
616
  v
623
617
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
624
618
  ] : f[v] = l[v];
@@ -630,10 +624,10 @@ const pe = (t) => {
630
624
  u.remove(o);
631
625
  };
632
626
  }, [u, o]), h(() => {
633
- typeof t == "number" && (o.translation.x = t), typeof s == "number" && (o.translation.y = s);
634
- for (const d in i)
635
- d in o && (o[d] = i[d]);
636
- }, [o, t, s, i]), h(() => {
627
+ typeof t == "number" && (o.translation.x = t), typeof i == "number" && (o.translation.y = i);
628
+ for (const d in s)
629
+ d in o && (o[d] = s[d]);
630
+ }, [o, t, i, s]), h(() => {
637
631
  if (Object.keys(c).length > 0)
638
632
  return a(o, c, u ?? void 0), () => {
639
633
  e(o);
@@ -644,14 +638,14 @@ const pe = (t) => {
644
638
  e,
645
639
  u,
646
640
  c
647
- ]), R(n, () => o, [o]), /* @__PURE__ */ E(T, {});
641
+ ]), R(n, () => o, [o]), /* @__PURE__ */ b(O, {});
648
642
  }
649
643
  ), ke = k.forwardRef(
650
- ({ mode: t, src: s, texture: r, x: l, y: n, ...u }, a) => {
651
- const { parent: e, registerEventShape: o, unregisterEventShape: c } = C(), i = g(() => new H.Image(s), [s]), { eventHandlers: d, shapeProps: f } = g(() => {
644
+ ({ mode: t, src: i, texture: r, x: l, y: n, ...u }, a) => {
645
+ const { parent: e, registerEventShape: o, unregisterEventShape: c } = C(), s = g(() => new H.Image(i), [i]), { eventHandlers: d, shapeProps: f } = g(() => {
652
646
  const v = {}, p = {};
653
647
  for (const j in u)
654
- O.includes(j) ? v[j] = u[
648
+ L.includes(j) ? v[j] = u[
655
649
  j
656
650
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
657
651
  ] : p[j] = u[j];
@@ -659,32 +653,32 @@ const pe = (t) => {
659
653
  }, [u]);
660
654
  return h(() => {
661
655
  if (e)
662
- return e.add(i), () => {
663
- e.remove(i);
656
+ return e.add(s), () => {
657
+ e.remove(s);
664
658
  };
665
- }, [e, i]), h(() => {
666
- typeof t < "u" && (i.mode = t), typeof r < "u" && (i.texture = r), typeof l == "number" && (i.translation.x = l), typeof n == "number" && (i.translation.y = n);
659
+ }, [e, s]), h(() => {
660
+ typeof t < "u" && (s.mode = t), typeof r < "u" && (s.texture = r), typeof l == "number" && (s.translation.x = l), typeof n == "number" && (s.translation.y = n);
667
661
  for (const v in f)
668
- v in i && (i[v] = f[v]);
669
- }, [i, f, t, r, l, n]), h(() => {
662
+ v in s && (s[v] = f[v]);
663
+ }, [s, f, t, r, l, n]), h(() => {
670
664
  if (Object.keys(d).length > 0)
671
- return o(i, d, e ?? void 0), () => {
672
- c(i);
665
+ return o(s, d, e ?? void 0), () => {
666
+ c(s);
673
667
  };
674
668
  }, [
675
- i,
669
+ s,
676
670
  o,
677
671
  c,
678
672
  e,
679
673
  d
680
- ]), R(a, () => i, [i]), /* @__PURE__ */ E(T, {});
674
+ ]), R(a, () => s, [s]), /* @__PURE__ */ b(O, {});
681
675
  }
682
676
  ), He = k.forwardRef(
683
- ({ src: t, x: s, y: r, autoPlay: l, ...n }, u) => {
684
- const { parent: a, registerEventShape: e, unregisterEventShape: o } = C(), c = g(() => new H.ImageSequence(t), [t]), { eventHandlers: i, shapeProps: d } = g(() => {
677
+ ({ src: t, x: i, y: r, autoPlay: l, ...n }, u) => {
678
+ const { parent: a, registerEventShape: e, unregisterEventShape: o } = C(), c = g(() => new H.ImageSequence(t), [t]), { eventHandlers: s, shapeProps: d } = g(() => {
685
679
  const f = {}, v = {};
686
680
  for (const p in n)
687
- O.includes(p) ? f[p] = n[
681
+ L.includes(p) ? f[p] = n[
688
682
  p
689
683
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
690
684
  ] : v[p] = n[p];
@@ -696,12 +690,12 @@ const pe = (t) => {
696
690
  a.remove(c);
697
691
  };
698
692
  }, [a, c]), h(() => {
699
- l ? c.play() : c.pause(), typeof s == "number" && (c.translation.x = s), typeof r == "number" && (c.translation.y = r);
693
+ l ? c.play() : c.pause(), typeof i == "number" && (c.translation.x = i), typeof r == "number" && (c.translation.y = r);
700
694
  for (const f in d)
701
695
  f in c && (c[f] = d[f]);
702
- }, [d, c, s, r, l]), h(() => {
703
- if (Object.keys(i).length > 0)
704
- return e(c, i, a ?? void 0), () => {
696
+ }, [d, c, i, r, l]), h(() => {
697
+ if (Object.keys(s).length > 0)
698
+ return e(c, s, a ?? void 0), () => {
705
699
  o(c);
706
700
  };
707
701
  }, [
@@ -709,15 +703,15 @@ const pe = (t) => {
709
703
  e,
710
704
  o,
711
705
  a,
712
- i
713
- ]), R(u, () => c, [c]), /* @__PURE__ */ E(T, {});
706
+ s
707
+ ]), R(u, () => c, [c]), /* @__PURE__ */ b(O, {});
714
708
  }
715
709
  ), Re = k.forwardRef(
716
- ({ x1: t, y1: s, x2: r, y2: l, ...n }, u) => {
717
- const { parent: a, registerEventShape: e, unregisterEventShape: o } = C(), c = g(() => new H.Line(), []), { eventHandlers: i, shapeProps: d } = g(() => {
710
+ ({ x1: t, y1: i, x2: r, y2: l, ...n }, u) => {
711
+ const { parent: a, registerEventShape: e, unregisterEventShape: o } = C(), c = g(() => new H.Line(), []), { eventHandlers: s, shapeProps: d } = g(() => {
718
712
  const f = {}, v = {};
719
713
  for (const p in n)
720
- O.includes(p) ? f[p] = n[
714
+ L.includes(p) ? f[p] = n[
721
715
  p
722
716
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
723
717
  ] : v[p] = n[p];
@@ -729,26 +723,26 @@ const pe = (t) => {
729
723
  a.remove(c);
730
724
  };
731
725
  }, [a, c]), h(() => {
732
- typeof t == "number" && (c.left.x = t), typeof s == "number" && (c.left.y = s), typeof r == "number" && (c.right.x = r), typeof l == "number" && (c.right.y = l);
726
+ typeof t == "number" && (c.left.x = t), typeof i == "number" && (c.left.y = i), typeof r == "number" && (c.right.x = r), typeof l == "number" && (c.right.y = l);
733
727
  for (const f in d)
734
728
  f in c && (c[f] = d[f]);
735
- }, [d, c, t, s, r, l]), h(() => {
736
- if (Object.keys(i).length > 0)
737
- return e(c, i, a ?? void 0), () => {
729
+ }, [d, c, t, i, r, l]), h(() => {
730
+ if (Object.keys(s).length > 0)
731
+ return e(c, s, a ?? void 0), () => {
738
732
  o(c);
739
733
  };
740
- }, [c, e, o, a, i]), R(u, () => c, [c]), /* @__PURE__ */ E(T, {});
734
+ }, [c, e, o, a, s]), R(u, () => c, [c]), /* @__PURE__ */ b(O, {});
741
735
  }
742
736
  ), Ce = k.forwardRef(
743
- ({ x: t, y: s, ...r }, l) => {
737
+ ({ x: t, y: i, ...r }, l) => {
744
738
  const { parent: n, registerEventShape: u, unregisterEventShape: a } = C(), e = g(() => new H.Polygon(), []), { eventHandlers: o, shapeProps: c } = g(() => {
745
- const i = {}, d = {};
739
+ const s = {}, d = {};
746
740
  for (const f in r)
747
- O.includes(f) ? i[f] = r[
741
+ L.includes(f) ? s[f] = r[
748
742
  f
749
743
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
750
744
  ] : d[f] = r[f];
751
- return { eventHandlers: i, shapeProps: d };
745
+ return { eventHandlers: s, shapeProps: d };
752
746
  }, [r]);
753
747
  return h(() => {
754
748
  if (n)
@@ -756,10 +750,10 @@ const pe = (t) => {
756
750
  n.remove(e);
757
751
  };
758
752
  }, [n, e]), h(() => {
759
- typeof t == "number" && (e.translation.x = t), typeof s == "number" && (e.translation.y = s);
760
- for (const i in c)
761
- i in e && (e[i] = c[i]);
762
- }, [c, e, t, s]), h(() => {
753
+ typeof t == "number" && (e.translation.x = t), typeof i == "number" && (e.translation.y = i);
754
+ for (const s in c)
755
+ s in e && (e[s] = c[s]);
756
+ }, [c, e, t, i]), h(() => {
763
757
  if (Object.keys(o).length > 0)
764
758
  return u(e, o, n ?? void 0), () => {
765
759
  a(e);
@@ -770,18 +764,18 @@ const pe = (t) => {
770
764
  a,
771
765
  n,
772
766
  o
773
- ]), R(l, () => e, [e]), /* @__PURE__ */ E(T, {});
767
+ ]), R(l, () => e, [e]), /* @__PURE__ */ b(O, {});
774
768
  }
775
769
  ), je = k.forwardRef(
776
- ({ x: t, y: s, ...r }, l) => {
770
+ ({ x: t, y: i, ...r }, l) => {
777
771
  const { parent: n, registerEventShape: u, unregisterEventShape: a } = C(), e = g(() => new H.Rectangle(), []), { eventHandlers: o, shapeProps: c } = g(() => {
778
- const i = {}, d = {};
772
+ const s = {}, d = {};
779
773
  for (const f in r)
780
- O.includes(f) ? i[f] = r[
774
+ L.includes(f) ? s[f] = r[
781
775
  f
782
776
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
783
777
  ] : d[f] = r[f];
784
- return { eventHandlers: i, shapeProps: d };
778
+ return { eventHandlers: s, shapeProps: d };
785
779
  }, [r]);
786
780
  return h(() => {
787
781
  if (n)
@@ -789,10 +783,10 @@ const pe = (t) => {
789
783
  n.remove(e);
790
784
  };
791
785
  }, [n, e]), h(() => {
792
- typeof t == "number" && (e.translation.x = t), typeof s == "number" && (e.translation.y = s);
793
- for (const i in c)
794
- i in e && (e[i] = c[i]);
795
- }, [c, e, t, s]), h(() => {
786
+ typeof t == "number" && (e.translation.x = t), typeof i == "number" && (e.translation.y = i);
787
+ for (const s in c)
788
+ s in e && (e[s] = c[s]);
789
+ }, [c, e, t, i]), h(() => {
796
790
  if (Object.keys(o).length > 0)
797
791
  return u(e, o, n ?? void 0), () => {
798
792
  a(e);
@@ -803,18 +797,18 @@ const pe = (t) => {
803
797
  a,
804
798
  n,
805
799
  o
806
- ]), R(l, () => e, [e]), /* @__PURE__ */ E(T, {});
800
+ ]), R(l, () => e, [e]), /* @__PURE__ */ b(O, {});
807
801
  }
808
802
  ), Le = k.forwardRef(
809
- ({ x: t, y: s, ...r }, l) => {
803
+ ({ x: t, y: i, ...r }, l) => {
810
804
  const { parent: n, registerEventShape: u, unregisterEventShape: a } = C(), e = g(() => new H.RoundedRectangle(), []), { eventHandlers: o, shapeProps: c } = g(() => {
811
- const i = {}, d = {};
805
+ const s = {}, d = {};
812
806
  for (const f in r)
813
- O.includes(f) ? i[f] = r[
807
+ L.includes(f) ? s[f] = r[
814
808
  f
815
809
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
816
810
  ] : d[f] = r[f];
817
- return { eventHandlers: i, shapeProps: d };
811
+ return { eventHandlers: s, shapeProps: d };
818
812
  }, [r]);
819
813
  return h(() => {
820
814
  if (n)
@@ -822,10 +816,10 @@ const pe = (t) => {
822
816
  n.remove(e);
823
817
  };
824
818
  }, [n, e]), h(() => {
825
- typeof t == "number" && (e.translation.x = t), typeof s == "number" && (e.translation.y = s);
826
- for (const i in c)
827
- i in e && (e[i] = c[i]);
828
- }, [c, e, t, s]), h(() => {
819
+ typeof t == "number" && (e.translation.x = t), typeof i == "number" && (e.translation.y = i);
820
+ for (const s in c)
821
+ s in e && (e[s] = c[s]);
822
+ }, [c, e, t, i]), h(() => {
829
823
  if (Object.keys(o).length > 0)
830
824
  return u(
831
825
  e,
@@ -842,14 +836,14 @@ const pe = (t) => {
842
836
  o
843
837
  ]), R(l, () => e, [
844
838
  e
845
- ]), /* @__PURE__ */ E(T, {});
839
+ ]), /* @__PURE__ */ b(O, {});
846
840
  }
847
841
  ), Oe = k.forwardRef(
848
- ({ src: t, x: s, y: r, autoPlay: l, ...n }, u) => {
849
- const { parent: a, registerEventShape: e, unregisterEventShape: o } = C(), c = g(() => new H.Sprite(t), [t]), { eventHandlers: i, shapeProps: d } = g(() => {
842
+ ({ src: t, x: i, y: r, autoPlay: l, ...n }, u) => {
843
+ const { parent: a, registerEventShape: e, unregisterEventShape: o } = C(), c = g(() => new H.Sprite(t), [t]), { eventHandlers: s, shapeProps: d } = g(() => {
850
844
  const f = {}, v = {};
851
845
  for (const p in n)
852
- O.includes(p) ? f[p] = n[
846
+ L.includes(p) ? f[p] = n[
853
847
  p
854
848
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
855
849
  ] : v[p] = n[p];
@@ -861,12 +855,12 @@ const pe = (t) => {
861
855
  a.remove(c);
862
856
  };
863
857
  }, [a, c]), h(() => {
864
- typeof s == "number" && (c.translation.x = s), typeof r == "number" && (c.translation.y = r), l ? c.play() : c.pause();
858
+ typeof i == "number" && (c.translation.x = i), typeof r == "number" && (c.translation.y = r), l ? c.play() : c.pause();
865
859
  for (const f in d)
866
860
  f in c && (c[f] = d[f]);
867
- }, [d, c, s, r, l]), h(() => {
868
- if (Object.keys(i).length > 0)
869
- return e(c, i, a ?? void 0), () => {
861
+ }, [d, c, i, r, l]), h(() => {
862
+ if (Object.keys(s).length > 0)
863
+ return e(c, s, a ?? void 0), () => {
870
864
  o(c);
871
865
  };
872
866
  }, [
@@ -874,19 +868,19 @@ const pe = (t) => {
874
868
  e,
875
869
  o,
876
870
  a,
877
- i
878
- ]), R(u, () => c, [c]), /* @__PURE__ */ E(T, {});
871
+ s
872
+ ]), R(u, () => c, [c]), /* @__PURE__ */ b(O, {});
879
873
  }
880
874
  ), Ve = k.forwardRef(
881
- ({ x: t, y: s, ...r }, l) => {
875
+ ({ x: t, y: i, ...r }, l) => {
882
876
  const { parent: n, registerEventShape: u, unregisterEventShape: a } = C(), e = g(() => new H.Star(), []), { eventHandlers: o, shapeProps: c } = g(() => {
883
- const i = {}, d = {};
877
+ const s = {}, d = {};
884
878
  for (const f in r)
885
- O.includes(f) ? i[f] = r[
879
+ L.includes(f) ? s[f] = r[
886
880
  f
887
881
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
888
882
  ] : d[f] = r[f];
889
- return { eventHandlers: i, shapeProps: d };
883
+ return { eventHandlers: s, shapeProps: d };
890
884
  }, [r]);
891
885
  return h(() => {
892
886
  if (n)
@@ -894,41 +888,41 @@ const pe = (t) => {
894
888
  n.remove(e);
895
889
  };
896
890
  }, [n, e]), h(() => {
897
- typeof t == "number" && (e.translation.x = t), typeof s == "number" && (e.translation.y = s);
898
- for (const i in c)
899
- i in e && (e[i] = c[i]);
900
- }, [c, e, t, s]), h(() => {
891
+ typeof t == "number" && (e.translation.x = t), typeof i == "number" && (e.translation.y = i);
892
+ for (const s in c)
893
+ s in e && (e[s] = c[s]);
894
+ }, [c, e, t, i]), h(() => {
901
895
  if (Object.keys(o).length > 0)
902
896
  return u(e, o, n ?? void 0), () => {
903
897
  a(e);
904
898
  };
905
- }, [e, u, a, n, o]), R(l, () => e, [e]), /* @__PURE__ */ E(T, {});
899
+ }, [e, u, a, n, o]), R(l, () => e, [e]), /* @__PURE__ */ b(O, {});
906
900
  }
907
901
  ), Ge = k.forwardRef(
908
- ({ x1: t, y1: s, x2: r, y2: l, ...n }, u) => {
902
+ ({ x1: t, y1: i, x2: r, y2: l, ...n }, u) => {
909
903
  const a = g(() => new H.LinearGradient(), []);
910
904
  return h(() => {
911
- typeof t == "number" && (a.left.x = t), typeof s == "number" && (a.left.y = s), typeof r == "number" && (a.right.x = r), typeof l == "number" && (a.right.y = l);
905
+ typeof t == "number" && (a.left.x = t), typeof i == "number" && (a.left.y = i), typeof r == "number" && (a.right.x = r), typeof l == "number" && (a.right.y = l);
912
906
  for (const e in n)
913
907
  e in a && (a[e] = n[e]);
914
- }, [a, t, s, r, l, n]), R(u, () => a, [a]), null;
908
+ }, [a, t, i, r, l, n]), R(u, () => a, [a]), null;
915
909
  }
916
910
  ), Te = k.forwardRef(
917
- ({ x: t, y: s, focalX: r, focalY: l, ...n }, u) => {
911
+ ({ x: t, y: i, focalX: r, focalY: l, ...n }, u) => {
918
912
  const a = g(() => new H.RadialGradient(), []);
919
913
  return h(() => {
920
- typeof t == "number" && (a.center.x = t), typeof s == "number" && (a.center.y = s), typeof r == "number" && (a.focal.x = r), typeof l == "number" && (a.focal.y = l);
914
+ typeof t == "number" && (a.center.x = t), typeof i == "number" && (a.center.y = i), typeof r == "number" && (a.focal.x = r), typeof l == "number" && (a.focal.y = l);
921
915
  for (const e in n)
922
916
  e in a && (a[e] = n[e]);
923
- }, [n, a, t, s, r, l]), R(u, () => a, [a]), null;
917
+ }, [n, a, t, i, r, l]), R(u, () => a, [a]), null;
924
918
  }
925
919
  ), Me = k.forwardRef(
926
- ({ src: t, ...s }, r) => {
920
+ ({ src: t, ...i }, r) => {
927
921
  const l = g(() => new H.Texture(t), [t]);
928
922
  return h(() => {
929
- for (const n in s)
930
- n in l && (l[n] = s[n]);
931
- }, [s, l]), R(r, () => l, [l]), null;
923
+ for (const n in i)
924
+ n in l && (l[n] = i[n]);
925
+ }, [i, l]), R(r, () => l, [l]), null;
932
926
  }
933
927
  );
934
928
  export {
@@ -943,7 +937,7 @@ export {
943
937
  Re as Line,
944
938
  Ge as LinearGradient,
945
939
  me as Path,
946
- we as Points,
940
+ Pe as Points,
947
941
  Ce as Polygon,
948
942
  Te as RadialGradient,
949
943
  je as Rectangle,
@@ -951,7 +945,7 @@ export {
951
945
  ye as SVG,
952
946
  Oe as Sprite,
953
947
  Ve as Star,
954
- Pe as Text,
948
+ we as Text,
955
949
  Me as Texture,
956
950
  ve as useFrame,
957
951
  C as useTwo
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-two.js",
3
- "version": "0.8.22-r.5",
3
+ "version": "0.8.23-r.1",
4
4
  "type": "module",
5
5
  "description": "A React virtual DOM for Two.js — a renderer agnostic two-dimensional drawing API for the web",
6
6
  "main": "./dist/react-two-main.es.js",
@@ -63,6 +63,7 @@
63
63
  "@types/react-dom": "^18.3.1",
64
64
  "@vitejs/plugin-react": "^4.3.3",
65
65
  "@vitest/ui": "^3.2.4",
66
+ "baseline-browser-mapping": "^2.9.14",
66
67
  "clsx": "^2.1.1",
67
68
  "eslint": "^9.13.0",
68
69
  "eslint-plugin-react-hooks": "^5.0.0",
@@ -80,6 +81,6 @@
80
81
  "peerDependencies": {
81
82
  "react": ">=19",
82
83
  "react-dom": ">=19",
83
- "two.js": ">=v0.8.22"
84
+ "two.js": ">=v0.8.23"
84
85
  }
85
86
  }