react-two.js 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +331 -64
- package/dist/ArcSegment.d.ts +5 -5
- package/dist/Circle.d.ts +5 -5
- package/dist/Ellipse.d.ts +4 -4
- package/dist/Group.d.ts +5 -5
- package/dist/Image.d.ts +49 -0
- package/dist/ImageSequence.d.ts +6 -6
- package/dist/Line.d.ts +5 -5
- package/dist/LinearGradient.d.ts +5 -5
- package/dist/Path.d.ts +7 -5
- package/dist/Points.d.ts +7 -4
- package/dist/Polygon.d.ts +5 -5
- package/dist/RadialGradient.d.ts +4 -4
- package/dist/Rectangle.d.ts +7 -5
- package/dist/RoundedRectangle.d.ts +6 -6
- package/dist/Sprite.d.ts +6 -6
- package/dist/Star.d.ts +5 -5
- package/dist/Text.d.ts +8 -8
- package/dist/Texture.d.ts +4 -4
- package/dist/main.d.ts +1 -0
- package/dist/react-two-main.es.js +372 -430
- package/package.json +21 -6
|
@@ -1,508 +1,450 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
const
|
|
5
|
-
const { two:
|
|
1
|
+
import { jsx as g, Fragment as R } from "react/jsx-runtime";
|
|
2
|
+
import w, { createContext as G, useContext as L, useRef as I, useEffect as l, useState as b, useImperativeHandle as y, useLayoutEffect as S, useMemo as P } from "react";
|
|
3
|
+
import m from "two.js";
|
|
4
|
+
const C = G({ two: null, parent: null, width: 0, height: 0 }), h = () => L(C), j = (r, o = []) => {
|
|
5
|
+
const { two: i } = h(), a = I(r);
|
|
6
6
|
l(() => {
|
|
7
|
-
|
|
8
|
-
}, [
|
|
9
|
-
if (!
|
|
7
|
+
a.current = r;
|
|
8
|
+
}, [r, ...o]), l(() => {
|
|
9
|
+
if (!i)
|
|
10
10
|
return;
|
|
11
|
-
let
|
|
12
|
-
return
|
|
13
|
-
function
|
|
11
|
+
let c = 0;
|
|
12
|
+
return i.bind("update", s), () => i.unbind("update", s);
|
|
13
|
+
function s(n, t) {
|
|
14
14
|
var e;
|
|
15
|
-
|
|
15
|
+
c += t / 1e3, (e = a.current) == null || e.call(a, c, t);
|
|
16
16
|
}
|
|
17
|
-
}, [
|
|
18
|
-
}, H = (
|
|
19
|
-
const { two:
|
|
20
|
-
two:
|
|
21
|
-
parent:
|
|
17
|
+
}, [i, ...o]);
|
|
18
|
+
}, H = (r) => {
|
|
19
|
+
const { two: o, parent: i } = h(), a = I(null), [c, s] = b({
|
|
20
|
+
two: o,
|
|
21
|
+
parent: i,
|
|
22
22
|
width: 0,
|
|
23
23
|
height: 0
|
|
24
24
|
});
|
|
25
|
-
l(
|
|
26
|
-
function
|
|
27
|
-
let
|
|
25
|
+
l(n, [r]);
|
|
26
|
+
function n() {
|
|
27
|
+
let t = () => {
|
|
28
28
|
};
|
|
29
|
-
if (!
|
|
30
|
-
let
|
|
31
|
-
const
|
|
32
|
-
|
|
29
|
+
if (!o) {
|
|
30
|
+
let f = function() {
|
|
31
|
+
const p = d.width !== v, k = !1;
|
|
32
|
+
p && (v = d.width), (p || k) && s((T) => ({ ...T, width: v, height: E }));
|
|
33
33
|
};
|
|
34
|
-
const
|
|
35
|
-
delete
|
|
36
|
-
const
|
|
37
|
-
let
|
|
38
|
-
|
|
39
|
-
var
|
|
40
|
-
(
|
|
41
|
-
|
|
42
|
-
),
|
|
43
|
-
const
|
|
44
|
-
|
|
34
|
+
const u = { ...r };
|
|
35
|
+
delete u.children;
|
|
36
|
+
const d = new m(u).appendTo(a.current);
|
|
37
|
+
let v = d.width, E = d.height;
|
|
38
|
+
s({ two: d, parent: d.scene, width: v, height: E }), d.bind("update", f), t = () => {
|
|
39
|
+
var k;
|
|
40
|
+
(k = d.renderer.domElement.parentElement) == null || k.removeChild(
|
|
41
|
+
d.renderer.domElement
|
|
42
|
+
), d.unbind("update", f);
|
|
43
|
+
const p = m.Instances.indexOf(d);
|
|
44
|
+
m.Instances.splice(p, 1), d.pause();
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
-
return
|
|
47
|
+
return t;
|
|
48
48
|
}
|
|
49
|
-
return /* @__PURE__ */
|
|
50
|
-
},
|
|
51
|
-
({ x:
|
|
52
|
-
const { two:
|
|
53
|
-
l(() => {
|
|
54
|
-
if (
|
|
55
|
-
const
|
|
56
|
-
return
|
|
57
|
-
|
|
49
|
+
return /* @__PURE__ */ g(C.Provider, { value: c, children: /* @__PURE__ */ g("div", { ref: a, children: r.children }) });
|
|
50
|
+
}, M = w.forwardRef(
|
|
51
|
+
({ x: r, y: o, ...i }, a) => {
|
|
52
|
+
const { two: c, parent: s, width: n, height: t } = h(), [e, f] = b(null);
|
|
53
|
+
return l(() => {
|
|
54
|
+
if (c) {
|
|
55
|
+
const u = new m.Group();
|
|
56
|
+
return f(u), () => {
|
|
57
|
+
f(null);
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
-
}, [
|
|
61
|
-
const
|
|
62
|
-
if (
|
|
63
|
-
return
|
|
64
|
-
|
|
60
|
+
}, [c]), l(() => {
|
|
61
|
+
const u = e;
|
|
62
|
+
if (s && u)
|
|
63
|
+
return s.add(u), () => {
|
|
64
|
+
s.remove(u);
|
|
65
65
|
};
|
|
66
|
-
}, [e,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
return R(r, () => e, [e]), /* @__PURE__ */ v(E.Provider, { value: { two: i, parent: e, width: t, height: n }, children: u.children });
|
|
66
|
+
}, [e, s]), l(() => {
|
|
67
|
+
if (e) {
|
|
68
|
+
const u = e;
|
|
69
|
+
typeof r == "number" && (u.translation.x = r), typeof o == "number" && (u.translation.y = o);
|
|
70
|
+
const d = { ...i };
|
|
71
|
+
delete d.children;
|
|
72
|
+
for (const v in d)
|
|
73
|
+
v in u && (u[v] = d[v]);
|
|
74
|
+
}
|
|
75
|
+
}, [e, r, o, i]), y(a, () => e, [e]), /* @__PURE__ */ g(C.Provider, { value: { two: c, parent: e, width: n, height: t }, children: i.children });
|
|
79
76
|
}
|
|
80
|
-
),
|
|
81
|
-
({ manual: o, ...a },
|
|
82
|
-
const { two:
|
|
83
|
-
l(() => {
|
|
84
|
-
const
|
|
85
|
-
return
|
|
86
|
-
|
|
77
|
+
), O = w.forwardRef(
|
|
78
|
+
({ manual: r, x: o, y: i, ...a }, c) => {
|
|
79
|
+
const { two: s, parent: n } = h(), [t, e] = b(null);
|
|
80
|
+
return l(() => {
|
|
81
|
+
const f = new m.Path();
|
|
82
|
+
return e(f), () => {
|
|
83
|
+
e(null);
|
|
87
84
|
};
|
|
88
|
-
}, [
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
i.remove(n);
|
|
85
|
+
}, [s]), l(() => {
|
|
86
|
+
if (n && t)
|
|
87
|
+
return n.add(t), () => {
|
|
88
|
+
n.remove(t);
|
|
93
89
|
};
|
|
94
|
-
}, [
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
for (const
|
|
99
|
-
|
|
90
|
+
}, [n, t]), l(() => {
|
|
91
|
+
if (t) {
|
|
92
|
+
const f = t;
|
|
93
|
+
typeof o == "number" && (f.translation.x = o), typeof i == "number" && (f.translation.y = i), typeof r < "u" && (f.automatic = !r);
|
|
94
|
+
for (const u in a)
|
|
95
|
+
u in f && (f[u] = a[u]);
|
|
100
96
|
}
|
|
101
|
-
}
|
|
102
|
-
return R(u, () => f.current), /* @__PURE__ */ v(y, {});
|
|
97
|
+
}, [a, t, o, i, r]), y(c, () => t, [t]), /* @__PURE__ */ g(R, {});
|
|
103
98
|
}
|
|
104
|
-
),
|
|
105
|
-
(o, a) => {
|
|
106
|
-
const { two:
|
|
107
|
-
l(() => {
|
|
108
|
-
const
|
|
109
|
-
return
|
|
110
|
-
|
|
99
|
+
), _ = w.forwardRef(
|
|
100
|
+
({ x: r, y: o, ...i }, a) => {
|
|
101
|
+
const { two: c, parent: s } = h(), [n, t] = b(null);
|
|
102
|
+
return l(() => {
|
|
103
|
+
const e = new m.Points();
|
|
104
|
+
return t(e), () => {
|
|
105
|
+
t(null);
|
|
111
106
|
};
|
|
112
|
-
}, [
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
r.remove(t);
|
|
107
|
+
}, [c, r, o]), l(() => {
|
|
108
|
+
if (s && n)
|
|
109
|
+
return s.add(n), () => {
|
|
110
|
+
s.remove(n);
|
|
117
111
|
};
|
|
118
|
-
}, [
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
for (const
|
|
123
|
-
|
|
112
|
+
}, [s, n]), l(() => {
|
|
113
|
+
if (n) {
|
|
114
|
+
const e = n;
|
|
115
|
+
typeof r == "number" && (e.translation.x = r), typeof o == "number" && (e.translation.y = o);
|
|
116
|
+
for (const f in i)
|
|
117
|
+
f in e && (e[f] = i[f]);
|
|
124
118
|
}
|
|
125
|
-
}
|
|
126
|
-
return R(a, () => i.current), /* @__PURE__ */ v(y, {});
|
|
119
|
+
}, [i, n, r, o]), y(a, () => n, [n]), /* @__PURE__ */ g(R, {});
|
|
127
120
|
}
|
|
128
|
-
),
|
|
129
|
-
({ x:
|
|
130
|
-
const { two:
|
|
131
|
-
l(() => {
|
|
132
|
-
const e = new
|
|
133
|
-
return t
|
|
134
|
-
t
|
|
121
|
+
), z = w.forwardRef(
|
|
122
|
+
({ x: r, y: o, ...i }, a) => {
|
|
123
|
+
const { two: c, parent: s } = h(), [n, t] = b(null);
|
|
124
|
+
return l(() => {
|
|
125
|
+
const e = new m.Text();
|
|
126
|
+
return t(e), () => {
|
|
127
|
+
t(null);
|
|
135
128
|
};
|
|
136
|
-
}, [
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
f.remove(e);
|
|
129
|
+
}, [c]), l(() => {
|
|
130
|
+
if (s && n)
|
|
131
|
+
return s.add(n), () => {
|
|
132
|
+
s.remove(n);
|
|
141
133
|
};
|
|
142
|
-
}, [
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
for (const
|
|
147
|
-
|
|
134
|
+
}, [s, n]), l(() => {
|
|
135
|
+
if (n) {
|
|
136
|
+
const e = n;
|
|
137
|
+
typeof r == "number" && (e.translation.x = r), typeof o == "number" && (e.translation.y = o);
|
|
138
|
+
for (const f in i)
|
|
139
|
+
f in e && (e[f] = i[f]);
|
|
148
140
|
}
|
|
149
|
-
}
|
|
150
|
-
return R(r, () => t.current), /* @__PURE__ */ v(y, {});
|
|
141
|
+
}, [i, n, r, o]), y(a, () => n, [n]), /* @__PURE__ */ g(R, {});
|
|
151
142
|
}
|
|
152
|
-
),
|
|
153
|
-
({ x:
|
|
154
|
-
const { two:
|
|
155
|
-
l(() => {
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
r.innerRadius,
|
|
160
|
-
r.outerRadius,
|
|
161
|
-
r.startAngle,
|
|
162
|
-
r.endAngle,
|
|
163
|
-
u
|
|
164
|
-
);
|
|
165
|
-
return n.current = c, () => {
|
|
166
|
-
n.current = null;
|
|
143
|
+
), B = w.forwardRef(
|
|
144
|
+
({ x: r, y: o, resolution: i, ...a }, c) => {
|
|
145
|
+
const { two: s, parent: n } = h(), [t, e] = b(null);
|
|
146
|
+
return l(() => {
|
|
147
|
+
const f = new m.ArcSegment(0, 0, 0, 0, 0, 0, i);
|
|
148
|
+
return e(f), () => {
|
|
149
|
+
e(null);
|
|
167
150
|
};
|
|
168
|
-
}, [
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
t.remove(c);
|
|
151
|
+
}, [i, s]), l(() => {
|
|
152
|
+
if (n && t)
|
|
153
|
+
return n.add(t), () => {
|
|
154
|
+
n.remove(t);
|
|
173
155
|
};
|
|
174
|
-
}, [t]), l(
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
for (const
|
|
179
|
-
|
|
156
|
+
}, [n, t]), l(() => {
|
|
157
|
+
if (t) {
|
|
158
|
+
const f = t;
|
|
159
|
+
typeof r == "number" && (f.translation.x = r), typeof o == "number" && (f.translation.y = o);
|
|
160
|
+
for (const u in a)
|
|
161
|
+
u in f && (f[u] = a[u]);
|
|
180
162
|
}
|
|
181
|
-
}
|
|
182
|
-
|
|
163
|
+
}, [a, t, r, o]), y(c, () => t, [t]), /* @__PURE__ */ g(R, {});
|
|
164
|
+
}
|
|
165
|
+
), J = w.forwardRef(
|
|
166
|
+
({ x: r, y: o, resolution: i, ...a }, c) => {
|
|
167
|
+
const { two: s, parent: n } = h(), [t, e] = b(null);
|
|
168
|
+
return l(() => {
|
|
169
|
+
const f = new m.Circle(0, 0, 0, i);
|
|
170
|
+
return e(f), () => {
|
|
171
|
+
e(null);
|
|
172
|
+
};
|
|
173
|
+
}, [i, s]), l(() => {
|
|
174
|
+
if (t) {
|
|
175
|
+
const f = t;
|
|
176
|
+
typeof r == "number" && (f.translation.x = r), typeof o == "number" && (f.translation.y = o);
|
|
177
|
+
for (const u in a)
|
|
178
|
+
u in f && (f[u] = a[u]);
|
|
179
|
+
}
|
|
180
|
+
}, [t, a, r, o]), l(() => {
|
|
181
|
+
if (n && t)
|
|
182
|
+
return n.add(t), () => {
|
|
183
|
+
n.remove(t);
|
|
184
|
+
};
|
|
185
|
+
}, [n, t]), y(c, () => t, [t]), /* @__PURE__ */ g(R, {});
|
|
183
186
|
}
|
|
184
|
-
), K =
|
|
185
|
-
({ x:
|
|
186
|
-
const { two:
|
|
187
|
-
l(() => {
|
|
188
|
-
const
|
|
189
|
-
return
|
|
190
|
-
|
|
187
|
+
), K = w.forwardRef(
|
|
188
|
+
({ x: r, y: o, resolution: i, ...a }, c) => {
|
|
189
|
+
const { two: s, parent: n } = h(), [t, e] = b(null);
|
|
190
|
+
return l(() => {
|
|
191
|
+
const f = new m.Ellipse(0, 0, 0, 0, i);
|
|
192
|
+
return e(f), () => {
|
|
193
|
+
e(null);
|
|
191
194
|
};
|
|
192
|
-
}, [
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
t.remove(c);
|
|
195
|
+
}, [i, s]), l(() => {
|
|
196
|
+
if (n && t)
|
|
197
|
+
return n.add(t), () => {
|
|
198
|
+
n.remove(t);
|
|
197
199
|
};
|
|
198
|
-
}, [
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
for (const
|
|
203
|
-
|
|
200
|
+
}, [n]), l(() => {
|
|
201
|
+
if (t) {
|
|
202
|
+
const f = t;
|
|
203
|
+
typeof r == "number" && (f.translation.x = r), typeof o == "number" && (f.translation.y = o);
|
|
204
|
+
for (const u in a)
|
|
205
|
+
u in f && (f[u] = a[u]);
|
|
204
206
|
}
|
|
205
|
-
}
|
|
206
|
-
return R(i, () => n.current), /* @__PURE__ */ v(y, {});
|
|
207
|
+
}, [t, r, o, a]), y(c, () => t, [t]), /* @__PURE__ */ g(R, {});
|
|
207
208
|
}
|
|
208
|
-
),
|
|
209
|
-
({
|
|
210
|
-
const { two:
|
|
211
|
-
|
|
212
|
-
const
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
typeof r.width == "number" ? r.width / 2 : void 0,
|
|
216
|
-
typeof r.height == "number" ? r.height / 2 : void 0,
|
|
217
|
-
u
|
|
218
|
-
);
|
|
219
|
-
return n.current = c, () => {
|
|
220
|
-
n.current = null;
|
|
209
|
+
), N = w.forwardRef(
|
|
210
|
+
({ mode: r, texture: o, x: i, y: a, ...c }, s) => {
|
|
211
|
+
const { two: n, parent: t } = h(), [e, f] = b(null);
|
|
212
|
+
return S(() => {
|
|
213
|
+
const u = new m.Image();
|
|
214
|
+
return f(u), () => {
|
|
215
|
+
f(null);
|
|
221
216
|
};
|
|
222
|
-
}, [
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
t.remove(c);
|
|
217
|
+
}, [n]), l(() => {
|
|
218
|
+
if (t && e)
|
|
219
|
+
return t.add(e), () => {
|
|
220
|
+
t.remove(e);
|
|
227
221
|
};
|
|
228
|
-
}, [t]), l(
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
for (const d in
|
|
233
|
-
d in
|
|
222
|
+
}, [t, e]), l(() => {
|
|
223
|
+
if (e) {
|
|
224
|
+
const u = e;
|
|
225
|
+
typeof r < "u" && (u.mode = r), typeof o < "u" && (u.texture = o), typeof i == "number" && (u.translation.x = i), typeof a == "number" && (u.translation.y = a);
|
|
226
|
+
for (const d in c)
|
|
227
|
+
d in u && (u[d] = c[d]);
|
|
234
228
|
}
|
|
235
|
-
}
|
|
236
|
-
return R(i, () => n.current), /* @__PURE__ */ v(y, {});
|
|
229
|
+
}, [e, c, r, o, i, a]), y(s, () => e, [e]), /* @__PURE__ */ g(R, {});
|
|
237
230
|
}
|
|
238
|
-
),
|
|
239
|
-
({ paths:
|
|
240
|
-
const { two:
|
|
241
|
-
|
|
242
|
-
const
|
|
243
|
-
return
|
|
244
|
-
|
|
231
|
+
), Q = w.forwardRef(
|
|
232
|
+
({ paths: r, x: o, y: i, autoPlay: a, ...c }, s) => {
|
|
233
|
+
const { two: n, parent: t } = h(), [e, f] = b(null);
|
|
234
|
+
return S(() => {
|
|
235
|
+
const u = new m.ImageSequence(r);
|
|
236
|
+
return f(u), () => {
|
|
237
|
+
f(null);
|
|
245
238
|
};
|
|
246
|
-
}, [
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
n.remove(d);
|
|
239
|
+
}, [n, r]), l(() => {
|
|
240
|
+
if (t && e)
|
|
241
|
+
return t.add(e), () => {
|
|
242
|
+
t.remove(e);
|
|
251
243
|
};
|
|
252
|
-
}, [
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
const d = e.current;
|
|
259
|
-
for (const s in i)
|
|
260
|
-
s in d && (d[s] = i[s]);
|
|
244
|
+
}, [t, e]), l(() => {
|
|
245
|
+
if (e) {
|
|
246
|
+
const u = e;
|
|
247
|
+
a ? u.play() : u.pause(), typeof o == "number" && (u.translation.x = o), typeof i == "number" && (u.translation.y = i);
|
|
248
|
+
for (const d in c)
|
|
249
|
+
d in u && (u[d] = c[d]);
|
|
261
250
|
}
|
|
262
|
-
}
|
|
263
|
-
return R(f, () => e.current), /* @__PURE__ */ v(y, {});
|
|
251
|
+
}, [c, e, r, o, i, a]), y(s, () => e, [e]), /* @__PURE__ */ g(R, {});
|
|
264
252
|
}
|
|
265
|
-
),
|
|
266
|
-
({ x1:
|
|
267
|
-
const { two:
|
|
268
|
-
l(() => {
|
|
269
|
-
const
|
|
270
|
-
return
|
|
271
|
-
|
|
253
|
+
), U = w.forwardRef(
|
|
254
|
+
({ x1: r, y1: o, x2: i, y2: a, ...c }, s) => {
|
|
255
|
+
const { two: n, parent: t } = h(), [e, f] = b(null);
|
|
256
|
+
return l(() => {
|
|
257
|
+
const u = new m.Line();
|
|
258
|
+
return f(u), () => {
|
|
259
|
+
f(null);
|
|
272
260
|
};
|
|
273
|
-
}, [
|
|
274
|
-
const
|
|
275
|
-
if (
|
|
276
|
-
return
|
|
277
|
-
|
|
261
|
+
}, [n]), l(() => {
|
|
262
|
+
const u = e;
|
|
263
|
+
if (t && u)
|
|
264
|
+
return t.add(u), () => {
|
|
265
|
+
t.remove(u);
|
|
278
266
|
};
|
|
279
|
-
}, [
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
for (const
|
|
284
|
-
|
|
267
|
+
}, [t, e]), l(() => {
|
|
268
|
+
if (e) {
|
|
269
|
+
const u = e;
|
|
270
|
+
typeof r == "number" && (u.left.x = r), typeof o == "number" && (u.left.y = o), typeof i == "number" && (u.right.x = i), typeof a == "number" && (u.right.y = a);
|
|
271
|
+
for (const d in c)
|
|
272
|
+
d in u && (u[d] = c[d]);
|
|
285
273
|
}
|
|
286
|
-
}
|
|
287
|
-
return R(f, () => e.current), /* @__PURE__ */ v(y, {});
|
|
274
|
+
}, [c, e, r, o, i, a]), y(s, () => e, [e]), /* @__PURE__ */ g(R, {});
|
|
288
275
|
}
|
|
289
|
-
),
|
|
290
|
-
({ x:
|
|
291
|
-
const { two:
|
|
292
|
-
l(() => {
|
|
293
|
-
const
|
|
294
|
-
return
|
|
295
|
-
|
|
276
|
+
), V = w.forwardRef(
|
|
277
|
+
({ x: r, y: o, ...i }, a) => {
|
|
278
|
+
const { two: c, parent: s } = h(), [n, t] = b(null);
|
|
279
|
+
return l(() => {
|
|
280
|
+
const e = new m.Polygon();
|
|
281
|
+
return t(e), () => {
|
|
282
|
+
t(null);
|
|
296
283
|
};
|
|
297
|
-
}, [
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
t.remove(c);
|
|
284
|
+
}, [c]), l(() => {
|
|
285
|
+
if (s && n)
|
|
286
|
+
return s.add(n), () => {
|
|
287
|
+
s.remove(n);
|
|
302
288
|
};
|
|
303
|
-
}, [
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
for (const
|
|
308
|
-
|
|
289
|
+
}, [s, n]), l(() => {
|
|
290
|
+
if (n) {
|
|
291
|
+
const e = n;
|
|
292
|
+
typeof r == "number" && (e.translation.x = r), typeof o == "number" && (e.translation.y = o);
|
|
293
|
+
for (const f in i)
|
|
294
|
+
f in e && (e[f] = i[f]);
|
|
309
295
|
}
|
|
310
|
-
}
|
|
311
|
-
return R(i, () => n.current), /* @__PURE__ */ v(y, {});
|
|
296
|
+
}, [i, n, r, o]), y(a, () => n, [n]), /* @__PURE__ */ g(R, {});
|
|
312
297
|
}
|
|
313
|
-
),
|
|
314
|
-
({ x:
|
|
315
|
-
const { two:
|
|
316
|
-
l(() => {
|
|
317
|
-
const e = new
|
|
318
|
-
return t
|
|
319
|
-
t
|
|
298
|
+
), W = w.forwardRef(
|
|
299
|
+
({ x: r, y: o, ...i }, a) => {
|
|
300
|
+
const { two: c, parent: s } = h(), [n, t] = b(null);
|
|
301
|
+
return l(() => {
|
|
302
|
+
const e = new m.Rectangle();
|
|
303
|
+
return t(e), () => {
|
|
304
|
+
t(null);
|
|
320
305
|
};
|
|
321
|
-
}, [
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
f.remove(e);
|
|
306
|
+
}, [c]), l(() => {
|
|
307
|
+
if (s && n)
|
|
308
|
+
return s.add(n), () => {
|
|
309
|
+
s.remove(n);
|
|
326
310
|
};
|
|
327
|
-
}, [
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
for (const
|
|
332
|
-
|
|
311
|
+
}, [s, n]), l(() => {
|
|
312
|
+
if (n) {
|
|
313
|
+
const e = n;
|
|
314
|
+
typeof r == "number" && (e.translation.x = r), typeof o == "number" && (e.translation.y = o);
|
|
315
|
+
for (const f in i)
|
|
316
|
+
f in e && (e[f] = i[f]);
|
|
333
317
|
}
|
|
334
|
-
}
|
|
335
|
-
return R(r, () => t.current), /* @__PURE__ */ v(y, {});
|
|
318
|
+
}, [i, n, r, o]), y(a, () => n, [n]), /* @__PURE__ */ g(R, {});
|
|
336
319
|
}
|
|
337
|
-
),
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
u.height,
|
|
345
|
-
u.radius
|
|
346
|
-
);
|
|
347
|
-
return t.current = e, () => {
|
|
348
|
-
t.current = null;
|
|
349
|
-
};
|
|
350
|
-
}, [o, a, i]), l(() => {
|
|
351
|
-
const e = t.current;
|
|
352
|
-
if (f && e)
|
|
353
|
-
return f.add(e), n(), () => {
|
|
354
|
-
f.remove(e);
|
|
320
|
+
), Z = w.forwardRef(
|
|
321
|
+
({ x: r, y: o, ...i }, a) => {
|
|
322
|
+
const { two: c, parent: s } = h(), [n, t] = b(null);
|
|
323
|
+
return l(() => {
|
|
324
|
+
const e = new m.RoundedRectangle();
|
|
325
|
+
return t(e), () => {
|
|
326
|
+
t(null);
|
|
355
327
|
};
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
328
|
+
}, [c]), l(() => {
|
|
329
|
+
if (s && n)
|
|
330
|
+
return s.add(n), () => {
|
|
331
|
+
s.remove(n);
|
|
332
|
+
};
|
|
333
|
+
}, [s, n]), l(() => {
|
|
334
|
+
if (n) {
|
|
335
|
+
const e = n;
|
|
336
|
+
typeof r == "number" && (e.translation.x = r), typeof o == "number" && (e.translation.y = o);
|
|
337
|
+
for (const f in i)
|
|
338
|
+
f in e && (e[f] = i[f]);
|
|
339
|
+
}
|
|
340
|
+
}, [i, n, r, o]), y(a, () => n, [n]), /* @__PURE__ */ g(R, {});
|
|
363
341
|
}
|
|
364
|
-
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
a,
|
|
372
|
-
u,
|
|
373
|
-
i.columns,
|
|
374
|
-
i.rows,
|
|
375
|
-
i.frameRate
|
|
376
|
-
);
|
|
377
|
-
return e.current = d, r && e.current.play(), () => {
|
|
378
|
-
e.current = null;
|
|
342
|
+
), $ = w.forwardRef(
|
|
343
|
+
({ path: r, x: o, y: i, autoPlay: a, ...c }, s) => {
|
|
344
|
+
const { two: n, parent: t } = h(), [e, f] = b(null);
|
|
345
|
+
return S(() => {
|
|
346
|
+
const u = new m.Sprite(r);
|
|
347
|
+
return f(u), () => {
|
|
348
|
+
f(null);
|
|
379
349
|
};
|
|
380
|
-
}, [
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
n.remove(d);
|
|
350
|
+
}, [r, n]), l(() => {
|
|
351
|
+
if (t && e)
|
|
352
|
+
return t.add(e), () => {
|
|
353
|
+
t.remove(e);
|
|
385
354
|
};
|
|
386
|
-
}, [
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
const d = e.current;
|
|
393
|
-
for (const s in i)
|
|
394
|
-
s in d && (d[s] = i[s]);
|
|
355
|
+
}, [t]), l(() => {
|
|
356
|
+
if (e) {
|
|
357
|
+
const u = e;
|
|
358
|
+
typeof o == "number" && (u.translation.x = o), typeof i == "number" && (u.translation.y = i), a ? u.play() : u.pause();
|
|
359
|
+
for (const d in c)
|
|
360
|
+
d in u && (u[d] = c[d]);
|
|
395
361
|
}
|
|
396
|
-
}
|
|
397
|
-
return R(f, () => e.current), /* @__PURE__ */ v(y, {});
|
|
362
|
+
}, [c, e, o, i, a]), y(s, () => e, [e]), /* @__PURE__ */ g(R, {});
|
|
398
363
|
}
|
|
399
|
-
),
|
|
400
|
-
({ x:
|
|
401
|
-
const { two:
|
|
402
|
-
l(() => {
|
|
403
|
-
const e = new
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
u.innerRadius,
|
|
407
|
-
u.outerRadius,
|
|
408
|
-
u.sides
|
|
409
|
-
);
|
|
410
|
-
return t.current = e, () => {
|
|
411
|
-
t.current = null;
|
|
364
|
+
), D = w.forwardRef(
|
|
365
|
+
({ x: r, y: o, ...i }, a) => {
|
|
366
|
+
const { two: c, parent: s } = h(), [n, t] = b(null);
|
|
367
|
+
return l(() => {
|
|
368
|
+
const e = new m.Star();
|
|
369
|
+
return t(e), () => {
|
|
370
|
+
t(null);
|
|
412
371
|
};
|
|
413
|
-
}, [
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
f.remove(e);
|
|
372
|
+
}, [c]), l(() => {
|
|
373
|
+
if (s && n)
|
|
374
|
+
return s.add(n), () => {
|
|
375
|
+
s.remove(n);
|
|
418
376
|
};
|
|
419
|
-
}, [
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
for (const
|
|
424
|
-
|
|
377
|
+
}, [s, n]), l(() => {
|
|
378
|
+
if (n) {
|
|
379
|
+
const e = n;
|
|
380
|
+
typeof r == "number" && (e.translation.x = r), typeof o == "number" && (e.translation.y = o);
|
|
381
|
+
for (const f in i)
|
|
382
|
+
f in e && (e[f] = i[f]);
|
|
425
383
|
}
|
|
426
|
-
}
|
|
427
|
-
return R(r, () => t.current), /* @__PURE__ */ v(y, {});
|
|
384
|
+
}, [i, n, r, o]), y(a, () => n, [n]), /* @__PURE__ */ g(R, {});
|
|
428
385
|
}
|
|
429
|
-
),
|
|
430
|
-
({ x1:
|
|
431
|
-
const
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
for (const d in i)
|
|
439
|
-
d in c && (c[d] = i[d]);
|
|
386
|
+
), X = w.forwardRef(
|
|
387
|
+
({ x1: r, y1: o, x2: i, y2: a, ...c }, s) => {
|
|
388
|
+
const n = P(() => new m.LinearGradient(), []);
|
|
389
|
+
return l(() => {
|
|
390
|
+
if (n) {
|
|
391
|
+
const t = n;
|
|
392
|
+
typeof r == "number" && (t.left.x = r), typeof o == "number" && (t.left.y = o), typeof i == "number" && (t.right.x = i), typeof a == "number" && (t.right.y = a);
|
|
393
|
+
for (const e in c)
|
|
394
|
+
e in t && (t[e] = c[e]);
|
|
440
395
|
}
|
|
441
|
-
}
|
|
442
|
-
return R(f, () => n.current), null;
|
|
396
|
+
}, [n, r, o, i, a, c]), y(s, () => n, [n]), null;
|
|
443
397
|
}
|
|
444
|
-
),
|
|
445
|
-
({ x:
|
|
446
|
-
const
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
r
|
|
454
|
-
)), l(() => {
|
|
455
|
-
n.current && (typeof o == "number" && (n.current.center.x = o), typeof a == "number" && (n.current.center.y = a));
|
|
456
|
-
}, [o, a]), l(() => {
|
|
457
|
-
n.current && (typeof u == "number" && (n.current.focal.x = u), typeof r == "number" && (n.current.focal.y = r));
|
|
458
|
-
}, [u, r]), l(e, [i]);
|
|
459
|
-
function e() {
|
|
460
|
-
if (n.current) {
|
|
461
|
-
const c = n.current;
|
|
462
|
-
for (const d in i)
|
|
463
|
-
d in c && (c[d] = i[d]);
|
|
398
|
+
), Y = w.forwardRef(
|
|
399
|
+
({ x: r, y: o, focalX: i, focalY: a, ...c }, s) => {
|
|
400
|
+
const n = P(() => new m.RadialGradient(), []);
|
|
401
|
+
return l(() => {
|
|
402
|
+
if (n) {
|
|
403
|
+
const t = n;
|
|
404
|
+
typeof r == "number" && (n.center.x = r), typeof o == "number" && (n.center.y = o), typeof i == "number" && (n.focal.x = i), typeof a == "number" && (n.focal.y = a);
|
|
405
|
+
for (const e in c)
|
|
406
|
+
e in t && (t[e] = c[e]);
|
|
464
407
|
}
|
|
465
|
-
}
|
|
466
|
-
return R(f, () => n.current), null;
|
|
408
|
+
}, [c, n, r, o, i, a]), y(s, () => n, [n]), null;
|
|
467
409
|
}
|
|
468
|
-
),
|
|
469
|
-
({ source:
|
|
470
|
-
const
|
|
471
|
-
l(() => {
|
|
472
|
-
const
|
|
473
|
-
return
|
|
410
|
+
), x = w.forwardRef(
|
|
411
|
+
({ source: r, ...o }, i) => {
|
|
412
|
+
const [a, c] = b(null);
|
|
413
|
+
return l(() => {
|
|
414
|
+
const s = new m.Texture(r);
|
|
415
|
+
return c(s), () => {
|
|
416
|
+
c(null);
|
|
474
417
|
};
|
|
475
|
-
}, [
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
const
|
|
479
|
-
|
|
480
|
-
t in f && (f[t] = a[t]);
|
|
418
|
+
}, [r]), l(() => {
|
|
419
|
+
if (a) {
|
|
420
|
+
const s = a;
|
|
421
|
+
for (const n in o)
|
|
422
|
+
n in s && (s[n] = o[n]);
|
|
481
423
|
}
|
|
482
|
-
}
|
|
483
|
-
return R(u, () => r.current), null;
|
|
424
|
+
}, [o, a]), y(i, () => a, [a]), null;
|
|
484
425
|
}
|
|
485
426
|
);
|
|
486
427
|
export {
|
|
487
|
-
|
|
428
|
+
B as ArcSegment,
|
|
488
429
|
H as Canvas,
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
N as
|
|
494
|
-
Q as
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
W as
|
|
502
|
-
Z as
|
|
503
|
-
$ as
|
|
504
|
-
|
|
505
|
-
|
|
430
|
+
J as Circle,
|
|
431
|
+
C as Context,
|
|
432
|
+
K as Ellipse,
|
|
433
|
+
M as Group,
|
|
434
|
+
N as Image,
|
|
435
|
+
Q as ImageSequence,
|
|
436
|
+
U as Line,
|
|
437
|
+
X as LinearGradient,
|
|
438
|
+
O as Path,
|
|
439
|
+
_ as Points,
|
|
440
|
+
V as Polygon,
|
|
441
|
+
Y as RadialGradient,
|
|
442
|
+
W as Rectangle,
|
|
443
|
+
Z as RoundedRectangle,
|
|
444
|
+
$ as Sprite,
|
|
445
|
+
D as Star,
|
|
446
|
+
z as Text,
|
|
447
|
+
x as Texture,
|
|
506
448
|
j as useFrame,
|
|
507
|
-
|
|
449
|
+
h as useTwo
|
|
508
450
|
};
|