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

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
  } & {
@@ -13,19 +13,19 @@ 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 n = X(ee), s = X(J), r = X(Q);
17
+ return { ...n, ...s, ...r };
18
+ }, ve = (n, s = []) => {
19
+ const { two: r } = C(), l = A(n);
20
20
  h(() => {
21
- l.current = t;
22
- }, [t, ...s]), h(() => {
21
+ l.current = n;
22
+ }, [n, ...s]), h(() => {
23
23
  if (!r)
24
24
  return;
25
- let n = 0;
25
+ let t = 0;
26
26
  return r.bind("update", u), () => r.unbind("update", u);
27
27
  function u(a, e) {
28
- n += e / 1e3, l.current?.(n, e);
28
+ t += e / 1e3, l.current?.(t, e);
29
29
  }
30
30
  }, [r, ...s]);
31
31
  }, O = [
@@ -42,49 +42,49 @@ 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;
47
- return { x: n, y: u };
45
+ function ie(n, s, r) {
46
+ const l = s.getBoundingClientRect(), t = n.clientX - l.left - r.width / 2, u = n.clientY - l.top - r.height / 2;
47
+ return { x: t, y: u };
48
48
  }
49
- function U(t, s) {
50
- const r = s.getBoundingClientRect(), l = t.clientX - r.left, n = t.clientY - r.top;
51
- return { x: l, y: n };
49
+ function U(n, s) {
50
+ const r = s.getBoundingClientRect(), l = n.clientX - r.left, t = n.clientY - r.top;
51
+ return { x: l, y: t };
52
52
  }
53
- function se(t, s, r, l) {
54
- let n = !1;
53
+ function se(n, s, r, l) {
54
+ let t = !1;
55
55
  return {
56
- nativeEvent: t,
56
+ nativeEvent: n,
57
57
  target: s,
58
58
  currentTarget: r,
59
59
  point: l,
60
60
  stopPropagation: () => {
61
- n = !0;
61
+ t = !0;
62
62
  },
63
63
  get stopped() {
64
- return n;
64
+ return t;
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(n, s, r) {
69
+ return "visible" in n && !n.visible ? !1 : typeof n.contains == "function" ? n.contains(s, r) : !1;
70
70
  }
71
- function q(t, s, r) {
71
+ function q(n, s, r) {
72
72
  const l = [];
73
- for (const [n] of t)
74
- ae(n, s, r) && l.push(n);
73
+ for (const [t] of n)
74
+ ae(t, s, r) && l.push(t);
75
75
  return l;
76
76
  }
77
- function le(t, s) {
78
- const r = [t], l = s.get(t);
77
+ function le(n, s) {
78
+ const r = [n], l = s.get(n);
79
79
  if (l?.parent) {
80
- let n = l.parent;
81
- for (; n; )
82
- r.push(n), n = s.get(n)?.parent;
80
+ let t = l.parent;
81
+ for (; t; )
82
+ r.push(t), t = s.get(t)?.parent;
83
83
  }
84
84
  return r;
85
85
  }
86
- function Y(t) {
87
- process.env.NODE_ENV !== "production" && k.Children.forEach(t, (s) => {
86
+ function Y(n) {
87
+ process.env.NODE_ENV !== "production" && k.Children.forEach(n, (s) => {
88
88
  if (!k.isValidElement(s))
89
89
  return;
90
90
  const r = s.type;
@@ -108,18 +108,18 @@ See: https://github.com/jonobr1/react-two.js#usage`
108
108
  );
109
109
  });
110
110
  }
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(
111
+ const pe = (n) => {
112
+ const { two: s, parent: r } = C(), l = A(null), t = 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
113
  (m, S, b) => {
114
- n.current.set(m, { shape: m, handlers: S, parent: b });
114
+ t.current.set(m, { shape: m, handlers: S, parent: b });
115
115
  },
116
116
  []
117
117
  ), M = oe((m) => {
118
- n.current.delete(m), u.current.delete(m), a.current === m && (a.current = null);
118
+ t.current.delete(m), u.current.delete(m), a.current === m && (a.current = null);
119
119
  }, []);
120
120
  h(() => {
121
121
  if (!s) {
122
- const S = { ...t };
122
+ const S = { ...n };
123
123
  delete S.children;
124
124
  const b = new H(S).appendTo(l.current);
125
125
  return o(b), i(b.scene), f(b.width), p(b.height), () => {
@@ -131,8 +131,8 @@ const pe = (t) => {
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(() => {
134
+ !s && (typeof n.width == "number" && (e && (e.width = n.width), f(n.width)), typeof n.height == "number" && (e && (e.height = n.height), p(n.height)));
135
+ }, [s, e, n.width, n.height]), h(() => {
136
136
  if (!s && e) {
137
137
  let S = function() {
138
138
  const V = b.width !== I, G = b.height !== L;
@@ -140,19 +140,19 @@ const pe = (t) => {
140
140
  };
141
141
  const b = e;
142
142
  let I = b.width, L = b.height;
143
- return (t.fullscreen || t.fitted) && b.bind("update", S), () => {
143
+ return (n.fullscreen || n.fitted) && b.bind("update", S), () => {
144
144
  b.unbind("update", S);
145
145
  };
146
146
  }
147
- }, [s, e, t.fullscreen, t.fitted]), h(() => {
148
- process.env.NODE_ENV !== "production" && Y(t.children);
149
- }, [t.children]), h(() => {
147
+ }, [s, e, n.fullscreen, n.fitted]), h(() => {
148
+ process.env.NODE_ENV !== "production" && Y(n.children);
149
+ }, [n.children]), h(() => {
150
150
  if (!e) return;
151
151
  const m = e.renderer.domElement, S = (y, w, P) => {
152
152
  if (y.length === 0) return;
153
- const N = y[0], B = ie(P, m, e), F = le(N, n.current);
153
+ const N = y[0], B = ie(P, m, e), F = le(N, t.current);
154
154
  for (const ne of F) {
155
- const te = n.current.get(ne)?.handlers[w];
155
+ const te = t.current.get(ne)?.handlers[w];
156
156
  if (te) {
157
157
  const re = se(
158
158
  P,
@@ -166,42 +166,42 @@ const pe = (t) => {
166
166
  }
167
167
  }, b = (y) => {
168
168
  const w = U(y, m), P = q(
169
- n.current,
169
+ t.current,
170
170
  w.x,
171
171
  w.y
172
172
  );
173
173
  P.length > 0 && S(P, "onClick", y);
174
174
  }, I = (y) => {
175
175
  const w = U(y, m), P = q(
176
- n.current,
176
+ t.current,
177
177
  w.x,
178
178
  w.y
179
179
  );
180
180
  P.length > 0 && S(P, "onContextMenu", y);
181
181
  }, L = (y) => {
182
182
  const w = U(y, m), P = q(
183
- n.current,
183
+ t.current,
184
184
  w.x,
185
185
  w.y
186
186
  );
187
187
  P.length > 0 && S(P, "onDoubleClick", y);
188
188
  }, V = (y) => {
189
189
  const w = U(y, m), P = q(
190
- n.current,
190
+ t.current,
191
191
  w.x,
192
192
  w.y
193
193
  );
194
194
  P.length > 0 && S(P, "onWheel", y);
195
195
  }, G = (y) => {
196
196
  const w = U(y, m), P = q(
197
- n.current,
197
+ t.current,
198
198
  w.x,
199
199
  w.y
200
200
  );
201
201
  P.length > 0 && (S(P, "onPointerDown", y), y.target instanceof Element && y.target.hasPointerCapture?.(y.pointerId) && (a.current = P[0]));
202
202
  }, _ = (y) => {
203
203
  if (a.current) {
204
- const N = n.current.get(a.current);
204
+ const N = t.current.get(a.current);
205
205
  if (N?.handlers.onPointerUp) {
206
206
  const B = ie(y, m, e), F = se(
207
207
  y,
@@ -215,14 +215,14 @@ const pe = (t) => {
215
215
  return;
216
216
  }
217
217
  const w = U(y, m), P = q(
218
- n.current,
218
+ t.current,
219
219
  w.x,
220
220
  w.y
221
221
  );
222
- P.length > 0 ? S(P, "onPointerUp", y) : t.onPointerMissed && t.onPointerMissed(y);
222
+ P.length > 0 ? S(P, "onPointerUp", y) : n.onPointerMissed && n.onPointerMissed(y);
223
223
  }, z = (y) => {
224
224
  const w = U(y, m), P = q(
225
- n.current,
225
+ t.current,
226
226
  w.x,
227
227
  w.y
228
228
  ), N = new Set(P);
@@ -235,7 +235,7 @@ const pe = (t) => {
235
235
  u.current = N;
236
236
  }, W = (y) => {
237
237
  const w = U(y, m), P = q(
238
- n.current,
238
+ t.current,
239
239
  w.x,
240
240
  w.y
241
241
  );
@@ -246,7 +246,7 @@ const pe = (t) => {
246
246
  };
247
247
  }, [
248
248
  e,
249
- t.onPointerMissed,
249
+ n.onPointerMissed,
250
250
  j,
251
251
  M
252
252
  ]);
@@ -256,11 +256,7 @@ const pe = (t) => {
256
256
  registerEventShape: j,
257
257
  unregisterEventShape: M
258
258
  }),
259
- [
260
- e,
261
- j,
262
- M
263
- ]
259
+ [e, j, M]
264
260
  ), D = g(
265
261
  () => ({
266
262
  parent: c
@@ -273,11 +269,11 @@ const pe = (t) => {
273
269
  }),
274
270
  [d, v]
275
271
  );
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 }) }) }) });
272
+ 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, ...n.container, children: n.children }) }) }) });
277
273
  }, ge = k.forwardRef(
278
- ({ x: t, y: s, ...r }, l) => {
274
+ ({ x: n, y: s, ...r }, l) => {
279
275
  const {
280
- two: n,
276
+ two: t,
281
277
  parent: u,
282
278
  width: a,
283
279
  height: e,
@@ -298,12 +294,12 @@ const pe = (t) => {
298
294
  u.remove(i);
299
295
  };
300
296
  }, [u, i]), h(() => {
301
- typeof t == "number" && (i.translation.x = t), typeof s == "number" && (i.translation.y = s);
297
+ typeof n == "number" && (i.translation.x = n), typeof s == "number" && (i.translation.y = s);
302
298
  const M = { ...f };
303
299
  delete M.children;
304
300
  for (const x in M)
305
301
  x in i && (i[x] = M[x]);
306
- }, [i, t, s, f]), h(() => {
302
+ }, [i, n, s, f]), h(() => {
307
303
  if (Object.keys(d).length > 0)
308
304
  return o(i, d, u ?? void 0), () => {
309
305
  c(i);
@@ -317,11 +313,11 @@ const pe = (t) => {
317
313
  ]), R(l, () => i, [i]);
318
314
  const v = g(
319
315
  () => ({
320
- two: n,
316
+ two: t,
321
317
  registerEventShape: o,
322
318
  unregisterEventShape: c
323
319
  }),
324
- [n, o, c]
320
+ [t, o, c]
325
321
  ), p = g(
326
322
  () => ({
327
323
  parent: i
@@ -337,7 +333,7 @@ const pe = (t) => {
337
333
  return /* @__PURE__ */ E(ce.Provider, { value: v, children: /* @__PURE__ */ E(J.Provider, { value: p, children: /* @__PURE__ */ E(Q.Provider, { value: j, children: r.children }) }) });
338
334
  }
339
335
  ), ye = k.forwardRef(
340
- ({ x: t, y: s, src: r, content: l, onLoad: n, onError: u, ...a }, e) => {
336
+ ({ x: n, y: s, src: r, content: l, onLoad: t, onError: u, ...a }, e) => {
341
337
  const {
342
338
  two: o,
343
339
  parent: c,
@@ -345,10 +341,10 @@ const pe = (t) => {
345
341
  height: d,
346
342
  registerEventShape: f,
347
343
  unregisterEventShape: v
348
- } = C(), p = g(() => new H.Group(), []), j = A(null), M = A(n), x = A(u), D = A({ two: null, key: null });
344
+ } = C(), p = g(() => new H.Group(), []), j = A(null), M = A(t), x = A(u), D = A({ two: null, key: null });
349
345
  h(() => {
350
- M.current = n;
351
- }, [n]), h(() => {
346
+ M.current = t;
347
+ }, [t]), h(() => {
352
348
  x.current = u;
353
349
  }, [u]);
354
350
  const { eventHandlers: K, shapeProps: m } = g(() => {
@@ -419,12 +415,12 @@ const pe = (t) => {
419
415
  _ = !1, D.current = { two: null, key: null }, j.current?.remove(j.current.children);
420
416
  };
421
417
  }, [o, r, l]), h(() => {
422
- typeof t == "number" && (p.translation.x = t), typeof s == "number" && (p.translation.y = s);
418
+ typeof n == "number" && (p.translation.x = n), typeof s == "number" && (p.translation.y = s);
423
419
  const L = { ...m };
424
420
  delete L.children;
425
421
  for (const V in L)
426
422
  V in p && (p[V] = L[V]);
427
- }, [p, t, s, m]), h(() => {
423
+ }, [p, n, s, m]), h(() => {
428
424
  if (Object.keys(K).length > 0)
429
425
  return f(p, K, c ?? void 0), () => {
430
426
  v(p);
@@ -452,7 +448,7 @@ const pe = (t) => {
452
448
  return /* @__PURE__ */ E(ce.Provider, { value: S, children: /* @__PURE__ */ E(J.Provider, { value: b, children: /* @__PURE__ */ E(Q.Provider, { value: I, children: a.children }) }) });
453
449
  }
454
450
  ), me = k.forwardRef(
455
- ({ manual: t, x: s, y: r, ...l }, n) => {
451
+ ({ manual: n, x: s, y: r, ...l }, t) => {
456
452
  const { parent: u, registerEventShape: a, unregisterEventShape: e } = C(), o = g(() => new H.Path(), []), { eventHandlers: c, shapeProps: i } = g(() => {
457
453
  const d = {}, f = {};
458
454
  for (const v in l)
@@ -473,14 +469,14 @@ const pe = (t) => {
473
469
  e(o);
474
470
  };
475
471
  }, [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);
472
+ typeof s == "number" && (o.translation.x = s), typeof r == "number" && (o.translation.y = r), typeof n < "u" && (o.automatic = !n);
477
473
  for (const d in i)
478
474
  d in o && (o[d] = i[d]);
479
- }, [i, o, s, r, t]), R(n, () => o, [o]), /* @__PURE__ */ E(T, {});
475
+ }, [i, o, s, r, n]), R(t, () => o, [o]), /* @__PURE__ */ E(T, {});
480
476
  }
481
477
  ), we = k.forwardRef(
482
- ({ x: t, y: s, ...r }, l) => {
483
- const { parent: n, registerEventShape: u, unregisterEventShape: a } = C(), e = g(() => new H.Points(), []), { eventHandlers: o, shapeProps: c } = g(() => {
478
+ ({ x: n, y: s, ...r }, l) => {
479
+ const { parent: t, registerEventShape: u, unregisterEventShape: a } = C(), e = g(() => new H.Points(), []), { eventHandlers: o, shapeProps: c } = g(() => {
484
480
  const i = {}, d = {};
485
481
  for (const f in r)
486
482
  O.includes(f) ? i[f] = r[
@@ -490,30 +486,30 @@ const pe = (t) => {
490
486
  return { eventHandlers: i, shapeProps: d };
491
487
  }, [r]);
492
488
  return h(() => {
493
- if (n)
494
- return n.add(e), () => {
495
- n.remove(e);
489
+ if (t)
490
+ return t.add(e), () => {
491
+ t.remove(e);
496
492
  };
497
- }, [n, e]), h(() => {
498
- typeof t == "number" && (e.translation.x = t), typeof s == "number" && (e.translation.y = s);
493
+ }, [t, e]), h(() => {
494
+ typeof n == "number" && (e.translation.x = n), typeof s == "number" && (e.translation.y = s);
499
495
  for (const i in c)
500
496
  i in e && (e[i] = c[i]);
501
- }, [c, e, t, s]), h(() => {
497
+ }, [c, e, n, s]), h(() => {
502
498
  if (Object.keys(o).length > 0)
503
- return u(e, o, n ?? void 0), () => {
499
+ return u(e, o, t ?? void 0), () => {
504
500
  a(e);
505
501
  };
506
502
  }, [
507
503
  e,
508
504
  u,
509
505
  a,
510
- n,
506
+ t,
511
507
  o
512
508
  ]), R(l, () => e, [e]), /* @__PURE__ */ E(T, {});
513
509
  }
514
510
  ), Pe = k.forwardRef(
515
- ({ x: t, y: s, ...r }, l) => {
516
- const { parent: n, registerEventShape: u, unregisterEventShape: a } = C(), e = g(() => new H.Text(), []), { eventHandlers: o, shapeProps: c } = g(() => {
511
+ ({ x: n, y: s, ...r }, l) => {
512
+ const { parent: t, registerEventShape: u, unregisterEventShape: a } = C(), e = g(() => new H.Text(), []), { eventHandlers: o, shapeProps: c } = g(() => {
517
513
  const i = {}, d = {};
518
514
  for (const f in r)
519
515
  O.includes(f) ? i[f] = r[
@@ -523,23 +519,23 @@ const pe = (t) => {
523
519
  return { eventHandlers: i, shapeProps: d };
524
520
  }, [r]);
525
521
  return h(() => {
526
- if (n)
527
- return n.add(e), () => {
528
- n.remove(e);
522
+ if (t)
523
+ return t.add(e), () => {
524
+ t.remove(e);
529
525
  };
530
- }, [n, e]), h(() => {
531
- typeof t == "number" && (e.translation.x = t), typeof s == "number" && (e.translation.y = s);
526
+ }, [t, e]), h(() => {
527
+ typeof n == "number" && (e.translation.x = n), typeof s == "number" && (e.translation.y = s);
532
528
  for (const i in c)
533
529
  i in e && (e[i] = c[i]);
534
- }, [c, e, t, s]), h(() => {
530
+ }, [c, e, n, s]), h(() => {
535
531
  if (Object.keys(o).length > 0)
536
- return u(e, o, n ?? void 0), () => {
532
+ return u(e, o, t ?? void 0), () => {
537
533
  a(e);
538
534
  };
539
- }, [e, u, a, n, o]), R(l, () => e, [e]), /* @__PURE__ */ E(T, {});
535
+ }, [e, u, a, t, o]), R(l, () => e, [e]), /* @__PURE__ */ E(T, {});
540
536
  }
541
537
  ), be = k.forwardRef(
542
- ({ x: t, y: s, resolution: r, ...l }, n) => {
538
+ ({ x: n, y: s, resolution: r, ...l }, t) => {
543
539
  const { parent: u, registerEventShape: a, unregisterEventShape: e } = C(), o = g(
544
540
  () => new H.ArcSegment(0, 0, 0, 0, 0, 0, r),
545
541
  [r]
@@ -558,10 +554,10 @@ const pe = (t) => {
558
554
  u.remove(o);
559
555
  };
560
556
  }, [u, o]), h(() => {
561
- typeof t == "number" && (o.translation.x = t), typeof s == "number" && (o.translation.y = s);
557
+ typeof n == "number" && (o.translation.x = n), typeof s == "number" && (o.translation.y = s);
562
558
  for (const d in i)
563
559
  d in o && (o[d] = i[d]);
564
- }, [i, o, t, s]), h(() => {
560
+ }, [i, o, n, s]), h(() => {
565
561
  if (Object.keys(c).length > 0)
566
562
  return a(o, c, u ?? void 0), () => {
567
563
  e(o);
@@ -572,10 +568,10 @@ const pe = (t) => {
572
568
  e,
573
569
  u,
574
570
  c
575
- ]), R(n, () => o, [o]), /* @__PURE__ */ E(T, {});
571
+ ]), R(t, () => o, [o]), /* @__PURE__ */ E(T, {});
576
572
  }
577
573
  ), Ee = k.forwardRef(
578
- ({ x: t, y: s, resolution: r, ...l }, n) => {
574
+ ({ x: n, y: s, resolution: r, ...l }, t) => {
579
575
  const { parent: u, registerEventShape: a, unregisterEventShape: e } = C(), o = g(
580
576
  () => new H.Circle(0, 0, 0, r),
581
577
  [r]
@@ -589,10 +585,10 @@ const pe = (t) => {
589
585
  return { eventHandlers: d, shapeProps: f };
590
586
  }, [l]);
591
587
  return h(() => {
592
- typeof t == "number" && (o.translation.x = t), typeof s == "number" && (o.translation.y = s);
588
+ typeof n == "number" && (o.translation.x = n), typeof s == "number" && (o.translation.y = s);
593
589
  for (const d in i)
594
590
  d in o && (o[d] = i[d]);
595
- }, [o, i, t, s]), h(() => {
591
+ }, [o, i, n, s]), h(() => {
596
592
  if (u)
597
593
  return u.add(o), () => {
598
594
  u.remove(o);
@@ -608,10 +604,10 @@ const pe = (t) => {
608
604
  e,
609
605
  u,
610
606
  c
611
- ]), R(n, () => o, [o]), /* @__PURE__ */ E(T, {});
607
+ ]), R(t, () => o, [o]), /* @__PURE__ */ E(T, {});
612
608
  }
613
609
  ), Se = k.forwardRef(
614
- ({ x: t, y: s, resolution: r, ...l }, n) => {
610
+ ({ x: n, y: s, resolution: r, ...l }, t) => {
615
611
  const { parent: u, registerEventShape: a, unregisterEventShape: e } = C(), o = g(
616
612
  () => new H.Ellipse(0, 0, 0, 0, r),
617
613
  [r]
@@ -630,10 +626,10 @@ const pe = (t) => {
630
626
  u.remove(o);
631
627
  };
632
628
  }, [u, o]), h(() => {
633
- typeof t == "number" && (o.translation.x = t), typeof s == "number" && (o.translation.y = s);
629
+ typeof n == "number" && (o.translation.x = n), typeof s == "number" && (o.translation.y = s);
634
630
  for (const d in i)
635
631
  d in o && (o[d] = i[d]);
636
- }, [o, t, s, i]), h(() => {
632
+ }, [o, n, s, i]), h(() => {
637
633
  if (Object.keys(c).length > 0)
638
634
  return a(o, c, u ?? void 0), () => {
639
635
  e(o);
@@ -644,10 +640,10 @@ const pe = (t) => {
644
640
  e,
645
641
  u,
646
642
  c
647
- ]), R(n, () => o, [o]), /* @__PURE__ */ E(T, {});
643
+ ]), R(t, () => o, [o]), /* @__PURE__ */ E(T, {});
648
644
  }
649
645
  ), ke = k.forwardRef(
650
- ({ mode: t, src: s, texture: r, x: l, y: n, ...u }, a) => {
646
+ ({ mode: n, src: s, texture: r, x: l, y: t, ...u }, a) => {
651
647
  const { parent: e, registerEventShape: o, unregisterEventShape: c } = C(), i = g(() => new H.Image(s), [s]), { eventHandlers: d, shapeProps: f } = g(() => {
652
648
  const v = {}, p = {};
653
649
  for (const j in u)
@@ -663,10 +659,10 @@ const pe = (t) => {
663
659
  e.remove(i);
664
660
  };
665
661
  }, [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);
662
+ typeof n < "u" && (i.mode = n), typeof r < "u" && (i.texture = r), typeof l == "number" && (i.translation.x = l), typeof t == "number" && (i.translation.y = t);
667
663
  for (const v in f)
668
664
  v in i && (i[v] = f[v]);
669
- }, [i, f, t, r, l, n]), h(() => {
665
+ }, [i, f, n, r, l, t]), h(() => {
670
666
  if (Object.keys(d).length > 0)
671
667
  return o(i, d, e ?? void 0), () => {
672
668
  c(i);
@@ -680,16 +676,16 @@ const pe = (t) => {
680
676
  ]), R(a, () => i, [i]), /* @__PURE__ */ E(T, {});
681
677
  }
682
678
  ), 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(() => {
679
+ ({ src: n, x: s, y: r, autoPlay: l, ...t }, u) => {
680
+ const { parent: a, registerEventShape: e, unregisterEventShape: o } = C(), c = g(() => new H.ImageSequence(n), [n]), { eventHandlers: i, shapeProps: d } = g(() => {
685
681
  const f = {}, v = {};
686
- for (const p in n)
687
- O.includes(p) ? f[p] = n[
682
+ for (const p in t)
683
+ O.includes(p) ? f[p] = t[
688
684
  p
689
685
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
690
- ] : v[p] = n[p];
686
+ ] : v[p] = t[p];
691
687
  return { eventHandlers: f, shapeProps: v };
692
- }, [n]);
688
+ }, [t]);
693
689
  return h(() => {
694
690
  if (a)
695
691
  return a.add(c), () => {
@@ -713,26 +709,26 @@ const pe = (t) => {
713
709
  ]), R(u, () => c, [c]), /* @__PURE__ */ E(T, {});
714
710
  }
715
711
  ), Re = k.forwardRef(
716
- ({ x1: t, y1: s, x2: r, y2: l, ...n }, u) => {
712
+ ({ x1: n, y1: s, x2: r, y2: l, ...t }, u) => {
717
713
  const { parent: a, registerEventShape: e, unregisterEventShape: o } = C(), c = g(() => new H.Line(), []), { eventHandlers: i, shapeProps: d } = g(() => {
718
714
  const f = {}, v = {};
719
- for (const p in n)
720
- O.includes(p) ? f[p] = n[
715
+ for (const p in t)
716
+ O.includes(p) ? f[p] = t[
721
717
  p
722
718
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
723
- ] : v[p] = n[p];
719
+ ] : v[p] = t[p];
724
720
  return { eventHandlers: f, shapeProps: v };
725
- }, [n]);
721
+ }, [t]);
726
722
  return h(() => {
727
723
  if (a)
728
724
  return a.add(c), () => {
729
725
  a.remove(c);
730
726
  };
731
727
  }, [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);
728
+ typeof n == "number" && (c.left.x = n), typeof s == "number" && (c.left.y = s), typeof r == "number" && (c.right.x = r), typeof l == "number" && (c.right.y = l);
733
729
  for (const f in d)
734
730
  f in c && (c[f] = d[f]);
735
- }, [d, c, t, s, r, l]), h(() => {
731
+ }, [d, c, n, s, r, l]), h(() => {
736
732
  if (Object.keys(i).length > 0)
737
733
  return e(c, i, a ?? void 0), () => {
738
734
  o(c);
@@ -740,8 +736,8 @@ const pe = (t) => {
740
736
  }, [c, e, o, a, i]), R(u, () => c, [c]), /* @__PURE__ */ E(T, {});
741
737
  }
742
738
  ), Ce = k.forwardRef(
743
- ({ x: t, y: s, ...r }, l) => {
744
- const { parent: n, registerEventShape: u, unregisterEventShape: a } = C(), e = g(() => new H.Polygon(), []), { eventHandlers: o, shapeProps: c } = g(() => {
739
+ ({ x: n, y: s, ...r }, l) => {
740
+ const { parent: t, registerEventShape: u, unregisterEventShape: a } = C(), e = g(() => new H.Polygon(), []), { eventHandlers: o, shapeProps: c } = g(() => {
745
741
  const i = {}, d = {};
746
742
  for (const f in r)
747
743
  O.includes(f) ? i[f] = r[
@@ -751,30 +747,30 @@ const pe = (t) => {
751
747
  return { eventHandlers: i, shapeProps: d };
752
748
  }, [r]);
753
749
  return h(() => {
754
- if (n)
755
- return n.add(e), () => {
756
- n.remove(e);
750
+ if (t)
751
+ return t.add(e), () => {
752
+ t.remove(e);
757
753
  };
758
- }, [n, e]), h(() => {
759
- typeof t == "number" && (e.translation.x = t), typeof s == "number" && (e.translation.y = s);
754
+ }, [t, e]), h(() => {
755
+ typeof n == "number" && (e.translation.x = n), typeof s == "number" && (e.translation.y = s);
760
756
  for (const i in c)
761
757
  i in e && (e[i] = c[i]);
762
- }, [c, e, t, s]), h(() => {
758
+ }, [c, e, n, s]), h(() => {
763
759
  if (Object.keys(o).length > 0)
764
- return u(e, o, n ?? void 0), () => {
760
+ return u(e, o, t ?? void 0), () => {
765
761
  a(e);
766
762
  };
767
763
  }, [
768
764
  e,
769
765
  u,
770
766
  a,
771
- n,
767
+ t,
772
768
  o
773
769
  ]), R(l, () => e, [e]), /* @__PURE__ */ E(T, {});
774
770
  }
775
771
  ), je = k.forwardRef(
776
- ({ x: t, y: s, ...r }, l) => {
777
- const { parent: n, registerEventShape: u, unregisterEventShape: a } = C(), e = g(() => new H.Rectangle(), []), { eventHandlers: o, shapeProps: c } = g(() => {
772
+ ({ x: n, y: s, ...r }, l) => {
773
+ const { parent: t, registerEventShape: u, unregisterEventShape: a } = C(), e = g(() => new H.Rectangle(), []), { eventHandlers: o, shapeProps: c } = g(() => {
778
774
  const i = {}, d = {};
779
775
  for (const f in r)
780
776
  O.includes(f) ? i[f] = r[
@@ -784,30 +780,30 @@ const pe = (t) => {
784
780
  return { eventHandlers: i, shapeProps: d };
785
781
  }, [r]);
786
782
  return h(() => {
787
- if (n)
788
- return n.add(e), () => {
789
- n.remove(e);
783
+ if (t)
784
+ return t.add(e), () => {
785
+ t.remove(e);
790
786
  };
791
- }, [n, e]), h(() => {
792
- typeof t == "number" && (e.translation.x = t), typeof s == "number" && (e.translation.y = s);
787
+ }, [t, e]), h(() => {
788
+ typeof n == "number" && (e.translation.x = n), typeof s == "number" && (e.translation.y = s);
793
789
  for (const i in c)
794
790
  i in e && (e[i] = c[i]);
795
- }, [c, e, t, s]), h(() => {
791
+ }, [c, e, n, s]), h(() => {
796
792
  if (Object.keys(o).length > 0)
797
- return u(e, o, n ?? void 0), () => {
793
+ return u(e, o, t ?? void 0), () => {
798
794
  a(e);
799
795
  };
800
796
  }, [
801
797
  e,
802
798
  u,
803
799
  a,
804
- n,
800
+ t,
805
801
  o
806
802
  ]), R(l, () => e, [e]), /* @__PURE__ */ E(T, {});
807
803
  }
808
804
  ), Le = k.forwardRef(
809
- ({ x: t, y: s, ...r }, l) => {
810
- const { parent: n, registerEventShape: u, unregisterEventShape: a } = C(), e = g(() => new H.RoundedRectangle(), []), { eventHandlers: o, shapeProps: c } = g(() => {
805
+ ({ x: n, y: s, ...r }, l) => {
806
+ const { parent: t, registerEventShape: u, unregisterEventShape: a } = C(), e = g(() => new H.RoundedRectangle(), []), { eventHandlers: o, shapeProps: c } = g(() => {
811
807
  const i = {}, d = {};
812
808
  for (const f in r)
813
809
  O.includes(f) ? i[f] = r[
@@ -817,20 +813,20 @@ const pe = (t) => {
817
813
  return { eventHandlers: i, shapeProps: d };
818
814
  }, [r]);
819
815
  return h(() => {
820
- if (n)
821
- return n.add(e), () => {
822
- n.remove(e);
816
+ if (t)
817
+ return t.add(e), () => {
818
+ t.remove(e);
823
819
  };
824
- }, [n, e]), h(() => {
825
- typeof t == "number" && (e.translation.x = t), typeof s == "number" && (e.translation.y = s);
820
+ }, [t, e]), h(() => {
821
+ typeof n == "number" && (e.translation.x = n), typeof s == "number" && (e.translation.y = s);
826
822
  for (const i in c)
827
823
  i in e && (e[i] = c[i]);
828
- }, [c, e, t, s]), h(() => {
824
+ }, [c, e, n, s]), h(() => {
829
825
  if (Object.keys(o).length > 0)
830
826
  return u(
831
827
  e,
832
828
  o,
833
- n ?? void 0
829
+ t ?? void 0
834
830
  ), () => {
835
831
  a(e);
836
832
  };
@@ -838,23 +834,23 @@ const pe = (t) => {
838
834
  e,
839
835
  u,
840
836
  a,
841
- n,
837
+ t,
842
838
  o
843
839
  ]), R(l, () => e, [
844
840
  e
845
841
  ]), /* @__PURE__ */ E(T, {});
846
842
  }
847
843
  ), 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(() => {
844
+ ({ src: n, x: s, y: r, autoPlay: l, ...t }, u) => {
845
+ const { parent: a, registerEventShape: e, unregisterEventShape: o } = C(), c = g(() => new H.Sprite(n), [n]), { eventHandlers: i, shapeProps: d } = g(() => {
850
846
  const f = {}, v = {};
851
- for (const p in n)
852
- O.includes(p) ? f[p] = n[
847
+ for (const p in t)
848
+ O.includes(p) ? f[p] = t[
853
849
  p
854
850
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
855
- ] : v[p] = n[p];
851
+ ] : v[p] = t[p];
856
852
  return { eventHandlers: f, shapeProps: v };
857
- }, [n]);
853
+ }, [t]);
858
854
  return h(() => {
859
855
  if (a)
860
856
  return a.add(c), () => {
@@ -878,8 +874,8 @@ const pe = (t) => {
878
874
  ]), R(u, () => c, [c]), /* @__PURE__ */ E(T, {});
879
875
  }
880
876
  ), Ve = k.forwardRef(
881
- ({ x: t, y: s, ...r }, l) => {
882
- const { parent: n, registerEventShape: u, unregisterEventShape: a } = C(), e = g(() => new H.Star(), []), { eventHandlers: o, shapeProps: c } = g(() => {
877
+ ({ x: n, y: s, ...r }, l) => {
878
+ const { parent: t, registerEventShape: u, unregisterEventShape: a } = C(), e = g(() => new H.Star(), []), { eventHandlers: o, shapeProps: c } = g(() => {
883
879
  const i = {}, d = {};
884
880
  for (const f in r)
885
881
  O.includes(f) ? i[f] = r[
@@ -889,45 +885,45 @@ const pe = (t) => {
889
885
  return { eventHandlers: i, shapeProps: d };
890
886
  }, [r]);
891
887
  return h(() => {
892
- if (n)
893
- return n.add(e), () => {
894
- n.remove(e);
888
+ if (t)
889
+ return t.add(e), () => {
890
+ t.remove(e);
895
891
  };
896
- }, [n, e]), h(() => {
897
- typeof t == "number" && (e.translation.x = t), typeof s == "number" && (e.translation.y = s);
892
+ }, [t, e]), h(() => {
893
+ typeof n == "number" && (e.translation.x = n), typeof s == "number" && (e.translation.y = s);
898
894
  for (const i in c)
899
895
  i in e && (e[i] = c[i]);
900
- }, [c, e, t, s]), h(() => {
896
+ }, [c, e, n, s]), h(() => {
901
897
  if (Object.keys(o).length > 0)
902
- return u(e, o, n ?? void 0), () => {
898
+ return u(e, o, t ?? void 0), () => {
903
899
  a(e);
904
900
  };
905
- }, [e, u, a, n, o]), R(l, () => e, [e]), /* @__PURE__ */ E(T, {});
901
+ }, [e, u, a, t, o]), R(l, () => e, [e]), /* @__PURE__ */ E(T, {});
906
902
  }
907
903
  ), Ge = k.forwardRef(
908
- ({ x1: t, y1: s, x2: r, y2: l, ...n }, u) => {
904
+ ({ x1: n, y1: s, x2: r, y2: l, ...t }, u) => {
909
905
  const a = g(() => new H.LinearGradient(), []);
910
906
  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);
912
- for (const e in n)
913
- e in a && (a[e] = n[e]);
914
- }, [a, t, s, r, l, n]), R(u, () => a, [a]), null;
907
+ typeof n == "number" && (a.left.x = n), typeof s == "number" && (a.left.y = s), typeof r == "number" && (a.right.x = r), typeof l == "number" && (a.right.y = l);
908
+ for (const e in t)
909
+ e in a && (a[e] = t[e]);
910
+ }, [a, n, s, r, l, t]), R(u, () => a, [a]), null;
915
911
  }
916
912
  ), Te = k.forwardRef(
917
- ({ x: t, y: s, focalX: r, focalY: l, ...n }, u) => {
913
+ ({ x: n, y: s, focalX: r, focalY: l, ...t }, u) => {
918
914
  const a = g(() => new H.RadialGradient(), []);
919
915
  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);
921
- for (const e in n)
922
- e in a && (a[e] = n[e]);
923
- }, [n, a, t, s, r, l]), R(u, () => a, [a]), null;
916
+ typeof n == "number" && (a.center.x = n), typeof s == "number" && (a.center.y = s), typeof r == "number" && (a.focal.x = r), typeof l == "number" && (a.focal.y = l);
917
+ for (const e in t)
918
+ e in a && (a[e] = t[e]);
919
+ }, [t, a, n, s, r, l]), R(u, () => a, [a]), null;
924
920
  }
925
921
  ), Me = k.forwardRef(
926
- ({ src: t, ...s }, r) => {
927
- const l = g(() => new H.Texture(t), [t]);
922
+ ({ src: n, ...s }, r) => {
923
+ const l = g(() => new H.Texture(n), [n]);
928
924
  return h(() => {
929
- for (const n in s)
930
- n in l && (l[n] = s[n]);
925
+ for (const t in s)
926
+ t in l && (l[t] = s[t]);
931
927
  }, [s, l]), R(r, () => l, [l]), null;
932
928
  }
933
929
  );
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",
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",
@@ -80,6 +80,6 @@
80
80
  "peerDependencies": {
81
81
  "react": ">=19",
82
82
  "react-dom": ">=19",
83
- "two.js": ">=v0.8.22"
83
+ "two.js": ">=v0.8.23"
84
84
  }
85
85
  }