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