exodeui 6.3.18 → 6.3.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +19 -19
- package/dist/index.mjs +602 -551
- package/dist/src/types.d.ts +48 -0
- package/dist/src/utils/skinningUtils.d.ts +27 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -30,7 +30,7 @@ function Ps(p, t, s) {
|
|
|
30
30
|
}
|
|
31
31
|
const Ee = /* @__PURE__ */ new Map();
|
|
32
32
|
function ps(p) {
|
|
33
|
-
var
|
|
33
|
+
var M;
|
|
34
34
|
const {
|
|
35
35
|
text: t,
|
|
36
36
|
fontFamily: s = "Inter",
|
|
@@ -47,102 +47,102 @@ function ps(p) {
|
|
|
47
47
|
enableSegments: f = !1
|
|
48
48
|
} = p;
|
|
49
49
|
let d = String(t || "");
|
|
50
|
-
c === "uppercase" ? d = d.toUpperCase() : c === "lowercase" ? d = d.toLowerCase() : c === "capitalize" && (d = d.replace(/\b\w/g, (
|
|
50
|
+
c === "uppercase" ? d = d.toUpperCase() : c === "lowercase" ? d = d.toLowerCase() : c === "capitalize" && (d = d.replace(/\b\w/g, (P) => P.toUpperCase())), p.hyphenation === !0 && (d = Ts(d));
|
|
51
51
|
const u = `${i} ${e} ${o}px "${s}", sans-serif`, m = `${d}|${u}|${r}|${l}|${h}|${f}|${JSON.stringify(g)}|hyp:${!!p.hyphenation}|comp:${p.composer}|bal:${!!p.balanceRaggedLines}`;
|
|
52
52
|
let y = Ee.get(m);
|
|
53
|
-
const v = typeof CanvasRenderingContext2D < "u" ? CanvasRenderingContext2D.prototype.measureText : null, b = function(
|
|
53
|
+
const v = typeof CanvasRenderingContext2D < "u" ? CanvasRenderingContext2D.prototype.measureText : null, b = function(P) {
|
|
54
54
|
if (!v) return { width: 0, fontBoundingBoxAscent: 0, fontBoundingBoxDescent: 0 };
|
|
55
|
-
const T = v.call(this,
|
|
56
|
-
return r !== 0 &&
|
|
55
|
+
const T = v.call(this, P);
|
|
56
|
+
return r !== 0 && P && P.length > 0 ? {
|
|
57
57
|
...T,
|
|
58
|
-
width: T.width + (
|
|
58
|
+
width: T.width + (P.length - 1) * r
|
|
59
59
|
} : T;
|
|
60
60
|
};
|
|
61
61
|
if (!y) {
|
|
62
62
|
try {
|
|
63
63
|
if (r !== 0 && typeof CanvasRenderingContext2D < "u" && (CanvasRenderingContext2D.prototype.measureText = b), f && g && g.length > 0) {
|
|
64
|
-
const
|
|
64
|
+
const P = g.map((T) => {
|
|
65
65
|
let W = T.text || "";
|
|
66
|
-
const
|
|
67
|
-
return
|
|
66
|
+
const k = T.textCase || c || "none";
|
|
67
|
+
return k === "uppercase" ? W.toUpperCase() : k === "lowercase" ? W.toLowerCase() : k === "capitalize" ? W.replace(/\b\w/g, (_) => _.toUpperCase()) : W;
|
|
68
68
|
}).join("");
|
|
69
|
-
if (y = Ye(
|
|
69
|
+
if (y = Ye(P, u), y) {
|
|
70
70
|
let T = 0, W = o;
|
|
71
|
-
for (const
|
|
72
|
-
let _ =
|
|
71
|
+
for (const k of g) {
|
|
72
|
+
let _ = k.text || "";
|
|
73
73
|
if (!_) continue;
|
|
74
|
-
const L =
|
|
74
|
+
const L = k.textCase || c || "none";
|
|
75
75
|
L === "uppercase" ? _ = _.toUpperCase() : L === "lowercase" ? _ = _.toLowerCase() : L === "capitalize" && (_ = _.replace(/\b\w/g, (O) => O.toUpperCase()));
|
|
76
|
-
const x =
|
|
76
|
+
const x = k.fontSize || o;
|
|
77
77
|
x > W && (W = x);
|
|
78
|
-
const
|
|
78
|
+
const A = `${k.fontStyle || i} ${k.fontWeight || e} ${x}px "${k.fontFamily || s}", sans-serif`, $ = Ye(_, A);
|
|
79
79
|
if ($ && $.widths)
|
|
80
80
|
for (let O = 0; O < $.widths.length; O++) {
|
|
81
|
-
const
|
|
82
|
-
if (
|
|
83
|
-
y.widths[
|
|
81
|
+
const z = T + O;
|
|
82
|
+
if (z < y.widths.length) {
|
|
83
|
+
y.widths[z] = $.widths[O];
|
|
84
84
|
const H = $.kinds[O];
|
|
85
85
|
if (H === 2) {
|
|
86
86
|
const et = _[O];
|
|
87
87
|
et === `
|
|
88
|
-
` || et === "\r" ? y.kinds[
|
|
88
|
+
` || et === "\r" ? y.kinds[z] = 2 : y.kinds[z] = 0;
|
|
89
89
|
} else
|
|
90
|
-
y.kinds[
|
|
90
|
+
y.kinds[z] = H;
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
T += _.length;
|
|
94
94
|
}
|
|
95
|
-
y.fullText =
|
|
95
|
+
y.fullText = P, y.maxFontSize = W;
|
|
96
96
|
}
|
|
97
97
|
} else
|
|
98
98
|
y = Ye(d, u);
|
|
99
99
|
y && Ee.set(m, y);
|
|
100
|
-
} catch (
|
|
101
|
-
return console.error("[ExodeUI] Pretext prepare failed:",
|
|
100
|
+
} catch (P) {
|
|
101
|
+
return console.error("[ExodeUI] Pretext prepare failed:", P), { width: a, height: 0, lineCount: 0, lines: [] };
|
|
102
102
|
} finally {
|
|
103
103
|
r !== 0 && typeof CanvasRenderingContext2D < "u" && v && (CanvasRenderingContext2D.prototype.measureText = v);
|
|
104
104
|
}
|
|
105
105
|
if (Ee.size > 500) {
|
|
106
|
-
const
|
|
107
|
-
|
|
106
|
+
const P = Ee.keys().next().value;
|
|
107
|
+
P && Ee.delete(P);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
if (h > 0 && y && y.widths && !y.indentApplied) {
|
|
111
|
-
const
|
|
111
|
+
const P = [...y.widths], T = y.fullText || d;
|
|
112
112
|
let W = !0;
|
|
113
|
-
for (let
|
|
114
|
-
W &&
|
|
115
|
-
` || T[
|
|
116
|
-
` &&
|
|
117
|
-
y = { ...y, widths:
|
|
113
|
+
for (let k = 0; k < T.length; k++)
|
|
114
|
+
W && P[k] !== void 0 && (P[k] += h, W = !1), (T[k] === `
|
|
115
|
+
` || T[k] === "\r") && (W = !0, T[k] === "\r" && T[k + 1] === `
|
|
116
|
+
` && k++);
|
|
117
|
+
y = { ...y, widths: P, indentApplied: !0 };
|
|
118
118
|
}
|
|
119
119
|
if (!y) return { width: a, height: 0, lineCount: 0, lines: [] };
|
|
120
120
|
let C = n;
|
|
121
121
|
typeof C == "string" && (C = parseFloat(C)), C > 5 && o > 0 && (C = C / o), r !== 0 && (CanvasRenderingContext2D.prototype.measureText = b);
|
|
122
122
|
let S;
|
|
123
123
|
try {
|
|
124
|
-
const
|
|
124
|
+
const P = y.maxFontSize || o;
|
|
125
125
|
if (a >= 1e5) {
|
|
126
126
|
const T = d.split(/\r\n|\r|\n/);
|
|
127
127
|
S = {
|
|
128
128
|
lines: T.map((W) => ({ text: W, width: 0 })),
|
|
129
129
|
// Width will be measured below
|
|
130
|
-
height: T.length * (C *
|
|
130
|
+
height: T.length * (C * P),
|
|
131
131
|
lineCount: T.length
|
|
132
132
|
};
|
|
133
133
|
} else
|
|
134
|
-
S = Is(y, a, C *
|
|
134
|
+
S = Is(y, a, C * P);
|
|
135
135
|
} finally {
|
|
136
136
|
r !== 0 && v && (CanvasRenderingContext2D.prototype.measureText = v);
|
|
137
137
|
}
|
|
138
|
-
let I = (S == null ? void 0 : S.height) !== void 0 && S.height > 0 ? S.height : (((
|
|
138
|
+
let I = (S == null ? void 0 : S.height) !== void 0 && S.height > 0 ? S.height : (((M = S == null ? void 0 : S.lines) == null ? void 0 : M.length) || 0) * C * o;
|
|
139
139
|
if (l > 0 && S && S.lines && S.lines.length > 1) {
|
|
140
|
-
let
|
|
140
|
+
let P = 0;
|
|
141
141
|
const T = y.fullText || t;
|
|
142
142
|
for (let W = 0; W < S.lines.length - 1; W++)
|
|
143
|
-
|
|
144
|
-
` || T[
|
|
145
|
-
` &&
|
|
143
|
+
P += S.lines[W].text.length, (T[P] === `
|
|
144
|
+
` || T[P] === "\r") && (I += l, P++, T[P - 1] === "\r" && T[P] === `
|
|
145
|
+
` && P++);
|
|
146
146
|
}
|
|
147
147
|
let w = (S == null ? void 0 : S.lines) || [];
|
|
148
148
|
return p.composer === "every-line" && w.length > 1 && (w = _s(w)), p.balanceRaggedLines === !0 && w.length > 1 && (w = Ps(w)), {
|
|
@@ -184,14 +184,14 @@ function ss(p, t, s) {
|
|
|
184
184
|
function Es(p, t, s) {
|
|
185
185
|
var _, L;
|
|
186
186
|
const o = p.autoLayout, { direction: e, spacing: i, padding: n, align: a, wrap: r } = o, l = e === "vertical", h = t.map((x) => {
|
|
187
|
-
const
|
|
188
|
-
let O = (
|
|
187
|
+
const A = s(x.id), $ = x.geometry;
|
|
188
|
+
let O = (A == null ? void 0 : A.width) ?? $.width ?? 100, z = (A == null ? void 0 : A.height) ?? $.height ?? 100;
|
|
189
189
|
if ($.type === "Ellipse" || $.type === "Polygon" || $.type === "Star") {
|
|
190
|
-
const H = (
|
|
191
|
-
O = H * 2,
|
|
190
|
+
const H = (A == null ? void 0 : A.radius) ?? $.radius ?? (A == null ? void 0 : A.outer_radius) ?? $.outer_radius ?? 50;
|
|
191
|
+
O = H * 2, z = H * 2;
|
|
192
192
|
} else if ($.type === "Text") {
|
|
193
193
|
const H = ps({
|
|
194
|
-
text: (
|
|
194
|
+
text: (A == null ? void 0 : A.text) ?? $.text ?? "",
|
|
195
195
|
fontFamily: $.fontFamily,
|
|
196
196
|
fontSize: $.fontSize,
|
|
197
197
|
fontWeight: $.fontWeight,
|
|
@@ -205,9 +205,9 @@ function Es(p, t, s) {
|
|
|
205
205
|
segments: $.segments,
|
|
206
206
|
enableSegments: $.enableSegments
|
|
207
207
|
});
|
|
208
|
-
|
|
208
|
+
z = H.height, $.width || (O = H.width);
|
|
209
209
|
}
|
|
210
|
-
return O *= x.transform.scale_x || 1,
|
|
210
|
+
return O *= x.transform.scale_x || 1, z *= x.transform.scale_y || 1, { id: x.id, w: O, h: z, original: x };
|
|
211
211
|
});
|
|
212
212
|
let c = p.width, g = p.height;
|
|
213
213
|
const f = ((_ = p.layoutProps) == null ? void 0 : _.width) === "hug", d = ((L = p.layoutProps) == null ? void 0 : L.height) === "hug", u = [];
|
|
@@ -218,21 +218,21 @@ function Es(p, t, s) {
|
|
|
218
218
|
}), m.length > 0 && u.push({ children: m, width: y, height: v }), f && !l && (c = Math.max(...u.map((x) => x.width), 0) + n.left + n.right), d && l && (g = Math.max(...u.map((x) => x.height), 0) + n.top + n.bottom);
|
|
219
219
|
const S = [];
|
|
220
220
|
let I = n.left, w = n.top;
|
|
221
|
-
const
|
|
221
|
+
const M = a.toLowerCase(), P = M === "center" || M.endsWith("-center"), T = M.endsWith("-right"), W = M === "center" || M.startsWith("center-"), k = M.startsWith("bottom-");
|
|
222
222
|
return u.forEach((x) => {
|
|
223
|
-
let
|
|
224
|
-
l ? W ? $ = n.top + (g - n.top - n.bottom - x.height) / 2 :
|
|
223
|
+
let A = I, $ = w;
|
|
224
|
+
l ? W ? $ = n.top + (g - n.top - n.bottom - x.height) / 2 : k && ($ = g - n.bottom - x.height) : P ? A = n.left + (c - n.left - n.right - x.width) / 2 : T && (A = c - n.right - x.width), x.children.forEach((O) => {
|
|
225
225
|
var F, q;
|
|
226
|
-
let
|
|
227
|
-
l ?
|
|
228
|
-
const et = ((F = O.original.layoutProps) == null ? void 0 : F.width) === "fill",
|
|
226
|
+
let z = A, H = $;
|
|
227
|
+
l ? P ? z += (x.width - O.w) / 2 : T && (z += x.width - O.w) : W ? H += (x.height - O.h) / 2 : k && (H += x.height - O.h);
|
|
228
|
+
const et = ((F = O.original.layoutProps) == null ? void 0 : F.width) === "fill", E = ((q = O.original.layoutProps) == null ? void 0 : q.height) === "fill";
|
|
229
229
|
S.push({
|
|
230
230
|
id: O.id,
|
|
231
|
-
x:
|
|
231
|
+
x: z + O.w / 2 - c / 2,
|
|
232
232
|
y: H + O.h / 2 - g / 2,
|
|
233
233
|
width: et && l ? x.width : void 0,
|
|
234
|
-
height:
|
|
235
|
-
}), l ? $ += O.h + i :
|
|
234
|
+
height: E ? l ? void 0 : x.height : void 0
|
|
235
|
+
}), l ? $ += O.h + i : A += O.w + i;
|
|
236
236
|
}), l ? I += x.width + i : w += x.height + i;
|
|
237
237
|
}), { frameWidth: f ? c : void 0, frameHeight: d ? g : void 0, childUpdates: S };
|
|
238
238
|
}
|
|
@@ -242,31 +242,31 @@ function xs(p, t, s) {
|
|
|
242
242
|
const { gridColumns: e, gridRows: i, columnGap: n = 0, rowGap: a = 0, padding: r, align: l } = o;
|
|
243
243
|
let h = p.width, c = p.height;
|
|
244
244
|
const g = h - r.left - r.right, f = c - r.top - r.bottom, d = es(e || "1fr", g, n), u = es(i || "auto", f, a), m = d.length > 0 ? d.reduce((T, W) => T + W, 0) + (d.length - 1) * n : 0, y = u.length > 0 ? u.reduce((T, W) => T + W, 0) + (u.length - 1) * a : 0, v = l.toLowerCase(), b = v === "center" || v.endsWith("-center"), C = v.endsWith("-right"), S = v === "center" || v.startsWith("center-"), I = v.startsWith("bottom-");
|
|
245
|
-
let w = 0,
|
|
246
|
-
b ? w = (g - m) / 2 : C && (w = g - m), S ?
|
|
247
|
-
const
|
|
245
|
+
let w = 0, M = 0;
|
|
246
|
+
b ? w = (g - m) / 2 : C && (w = g - m), S ? M = (f - y) / 2 : I && (M = f - y);
|
|
247
|
+
const P = [];
|
|
248
248
|
return t.forEach((T, W) => {
|
|
249
249
|
var q, Q;
|
|
250
|
-
const
|
|
250
|
+
const k = W % d.length || 0, _ = Math.floor(W / d.length) || 0;
|
|
251
251
|
_ >= u.length && u.push(100);
|
|
252
|
-
const L = d[
|
|
253
|
-
let
|
|
254
|
-
const O = s(T.id),
|
|
255
|
-
let H = (O == null ? void 0 : O.width) ??
|
|
256
|
-
if (
|
|
257
|
-
const it = (O == null ? void 0 : O.radius) ??
|
|
252
|
+
const L = d[k], x = u[_];
|
|
253
|
+
let A = r.left + w + d.slice(0, k).reduce((it, dt) => it + dt + n, 0), $ = r.top + M + u.slice(0, _).reduce((it, dt) => it + dt + a, 0);
|
|
254
|
+
const O = s(T.id), z = T.geometry;
|
|
255
|
+
let H = (O == null ? void 0 : O.width) ?? z.width ?? 100, et = (O == null ? void 0 : O.height) ?? z.height ?? 100;
|
|
256
|
+
if (z.type === "Ellipse" || z.type === "Polygon" || z.type === "Star") {
|
|
257
|
+
const it = (O == null ? void 0 : O.radius) ?? z.radius ?? (O == null ? void 0 : O.outer_radius) ?? z.outer_radius ?? 50;
|
|
258
258
|
H = it * 2, et = it * 2;
|
|
259
259
|
}
|
|
260
260
|
H *= T.transform.scale_x || 1, et *= T.transform.scale_y || 1;
|
|
261
|
-
let
|
|
262
|
-
b ?
|
|
261
|
+
let E = A, F = $;
|
|
262
|
+
b ? E += (L - H) / 2 : C && (E += L - H), S ? F += (x - et) / 2 : I && (F += x - et), P.push({
|
|
263
263
|
id: T.id,
|
|
264
|
-
x:
|
|
264
|
+
x: E + H / 2 - h / 2,
|
|
265
265
|
y: F + et / 2 - c / 2,
|
|
266
266
|
width: ((q = T.layoutProps) == null ? void 0 : q.width) === "fill" ? L : void 0,
|
|
267
267
|
height: ((Q = T.layoutProps) == null ? void 0 : Q.height) === "fill" ? x : void 0
|
|
268
268
|
});
|
|
269
|
-
}), { childUpdates:
|
|
269
|
+
}), { childUpdates: P };
|
|
270
270
|
}
|
|
271
271
|
class As {
|
|
272
272
|
constructor() {
|
|
@@ -371,7 +371,7 @@ class As {
|
|
|
371
371
|
e && e.applyImpulse(new ae.Vector2(s, o), !0);
|
|
372
372
|
}
|
|
373
373
|
}
|
|
374
|
-
const us = (p) => p, Os = (p) => p > 0 ? 1 : 0, Rs = (p) => p < 1 ? 0 : 1, is = (p) => p * p, ns = (p) => p * (2 - p), os = (p) => p < 0.5 ? 2 * p * p : -1 + (4 - 2 * p) * p, Ls = (p) => p * p * p, Fs = (p) => --p * p * p + 1, $s = (p) => p < 0.5 ? 4 * p * p * p : (p - 1) * (2 * p - 2) * (2 * p - 2) + 1, Ws = (p) => p * p * p * p, Bs = (p) => 1 - --p * p * p * p, Gs = (p) => p < 0.5 ? 8 * p * p * p * p : 1 - 8 * --p * p * p * p, Ys = (p) => p * p * p * p * p, Xs = (p) => 1 + --p * p * p * p * p, Ds = (p) => p < 0.5 ? 16 * p * p * p * p * p : 1 + 16 * --p * p * p * p * p,
|
|
374
|
+
const us = (p) => p, Os = (p) => p > 0 ? 1 : 0, Rs = (p) => p < 1 ? 0 : 1, is = (p) => p * p, ns = (p) => p * (2 - p), os = (p) => p < 0.5 ? 2 * p * p : -1 + (4 - 2 * p) * p, Ls = (p) => p * p * p, Fs = (p) => --p * p * p + 1, $s = (p) => p < 0.5 ? 4 * p * p * p : (p - 1) * (2 * p - 2) * (2 * p - 2) + 1, Ws = (p) => p * p * p * p, Bs = (p) => 1 - --p * p * p * p, Gs = (p) => p < 0.5 ? 8 * p * p * p * p : 1 - 8 * --p * p * p * p, Ys = (p) => p * p * p * p * p, Xs = (p) => 1 + --p * p * p * p * p, Ds = (p) => p < 0.5 ? 16 * p * p * p * p * p : 1 + 16 * --p * p * p * p * p, Vs = (p) => 1 - Math.cos(p * Math.PI / 2), zs = (p) => Math.sin(p * Math.PI / 2), Ns = (p) => -(Math.cos(Math.PI * p) - 1) / 2, Hs = (p) => p === 0 ? 0 : Math.pow(2, 10 * (p - 1)), Us = (p) => p === 1 ? 1 : 1 - Math.pow(2, -10 * p), qs = (p) => p === 0 ? 0 : p === 1 ? 1 : p < 0.5 ? Math.pow(2, 20 * p - 10) / 2 : (2 - Math.pow(2, -20 * p + 10)) / 2, Js = (p) => 1 - Math.sqrt(1 - p * p), Qs = (p) => Math.sqrt(1 - --p * p), Ks = (p) => p < 0.5 ? (1 - Math.sqrt(1 - 4 * p * p)) / 2 : (Math.sqrt(1 - (-2 * p + 2) * (-2 * p + 2)) + 1) / 2, Ge = 1.70158, $e = Ge * 1.525, gs = Ge + 1, Zs = (p) => gs * p * p * p - Ge * p * p, js = (p) => 1 + gs * Math.pow(p - 1, 3) + Ge * Math.pow(p - 1, 2), ti = (p) => p < 0.5 ? Math.pow(2 * p, 2) * (($e + 1) * 2 * p - $e) / 2 : (Math.pow(2 * p - 2, 2) * (($e + 1) * (p * 2 - 2) + $e) + 2) / 2, ms = 2 * Math.PI / 3, as = 2 * Math.PI / 4.5, ei = (p) => p === 0 ? 0 : p === 1 ? 1 : -Math.pow(2, 10 * p - 10) * Math.sin((p * 10 - 10.75) * ms), si = (p) => p === 0 ? 0 : p === 1 ? 1 : Math.pow(2, -10 * p) * Math.sin((p * 10 - 0.75) * ms) + 1, ii = (p) => p === 0 ? 0 : p === 1 ? 1 : p < 0.5 ? -(Math.pow(2, 20 * p - 10) * Math.sin((20 * p - 11.125) * as)) / 2 : Math.pow(2, -20 * p + 10) * Math.sin((20 * p - 11.125) * as) / 2 + 1, Be = (p) => p < 1 / 2.75 ? 7.5625 * p * p : p < 2 / 2.75 ? 7.5625 * (p -= 1.5 / 2.75) * p + 0.75 : p < 2.5 / 2.75 ? 7.5625 * (p -= 2.25 / 2.75) * p + 0.9375 : 7.5625 * (p -= 2.625 / 2.75) * p + 0.984375, ni = (p) => 1 - Be(1 - p), oi = Be, ai = (p) => p < 0.5 ? (1 - Be(1 - 2 * p)) / 2 : (1 + Be(2 * p - 1)) / 2, Xe = /* @__PURE__ */ new Map(), xe = (p, t, s, o) => {
|
|
375
375
|
const e = `${p},${t},${s},${o}`;
|
|
376
376
|
if (Xe.has(e)) return Xe.get(e);
|
|
377
377
|
const i = (h) => (1 - 3 * s + 3 * p) * h * h * h + (3 * s - 6 * p) * h * h + 3 * p * h, n = (h) => (1 - 3 * o + 3 * t) * h * h * h + (3 * o - 6 * t) * h * h + 3 * t * h, a = (h) => 3 * (1 - 3 * s + 3 * p) * h * h + 2 * (3 * s - 6 * p) * h + 3 * p, r = (h) => {
|
|
@@ -416,8 +416,8 @@ const us = (p) => p, Os = (p) => p > 0 ? 1 : 0, Rs = (p) => p < 1 ? 0 : 1, is =
|
|
|
416
416
|
EaseOutQuint: Xs,
|
|
417
417
|
EaseInOutQuint: Ds,
|
|
418
418
|
// Sinusoidal
|
|
419
|
-
EaseInSine:
|
|
420
|
-
EaseOutSine:
|
|
419
|
+
EaseInSine: Vs,
|
|
420
|
+
EaseOutSine: zs,
|
|
421
421
|
EaseInOutSine: Ns,
|
|
422
422
|
// Exponential
|
|
423
423
|
EaseInExpo: Hs,
|
|
@@ -514,6 +514,43 @@ const us = (p) => p, Os = (p) => p > 0 ? 1 : 0, Rs = (p) => p < 1 ? 0 : 1, is =
|
|
|
514
514
|
description: "Slow start, massive impact.",
|
|
515
515
|
value: "cubic-bezier(0.6, 0, 1, 1)"
|
|
516
516
|
}
|
|
517
|
+
}, li = (p, t, s, o, e) => {
|
|
518
|
+
if (!p || !t || !s) return p;
|
|
519
|
+
const i = o.scale_x ?? 1, n = o.scale_y ?? 1, a = (r, l, h) => {
|
|
520
|
+
let c = 0, g = 0;
|
|
521
|
+
const f = o.rotation * Math.PI / 180, d = Math.cos(f), u = Math.sin(f), m = r * i * d - l * n * u + o.x, y = r * i * u + l * n * d + o.y;
|
|
522
|
+
h.forEach((w) => {
|
|
523
|
+
const M = e(w.boneId);
|
|
524
|
+
if (!M) return;
|
|
525
|
+
const P = {
|
|
526
|
+
x: M.x,
|
|
527
|
+
y: M.y,
|
|
528
|
+
rotation: M.rotation,
|
|
529
|
+
scaleX: M.scale_x ?? 1,
|
|
530
|
+
scaleY: M.scale_y ?? 1
|
|
531
|
+
}, T = s[w.boneId] || [1, 0, 0, 1, 0, 0], W = m * T[0] + y * T[2] + T[4], k = m * T[1] + y * T[3] + T[5], _ = P.rotation * Math.PI / 180, L = Math.cos(_), x = Math.sin(_), A = W * P.scaleX * L - k * P.scaleY * x + P.x, $ = W * P.scaleX * x + k * P.scaleY * L + P.y;
|
|
532
|
+
c += A * w.amount, g += $ * w.amount;
|
|
533
|
+
});
|
|
534
|
+
const v = o.rotation * Math.PI / 180, b = Math.cos(v), C = Math.sin(v), S = c - o.x, I = g - o.y;
|
|
535
|
+
return {
|
|
536
|
+
x: (S * b + I * C) / i,
|
|
537
|
+
y: (-S * C + I * b) / n
|
|
538
|
+
};
|
|
539
|
+
};
|
|
540
|
+
return p.map((r, l) => {
|
|
541
|
+
const h = t[l];
|
|
542
|
+
if (!h || h.length === 0) return { ...r };
|
|
543
|
+
const c = { ...r, ...a(r.x, r.y, h) };
|
|
544
|
+
if (r.in_x !== void 0 && r.in_y !== void 0) {
|
|
545
|
+
const g = a(r.in_x, r.in_y, h);
|
|
546
|
+
c.in_x = g.x, c.in_y = g.y;
|
|
547
|
+
}
|
|
548
|
+
if (r.out_x !== void 0 && r.out_y !== void 0) {
|
|
549
|
+
const g = a(r.out_x, r.out_y, h);
|
|
550
|
+
c.out_x = g.x, c.out_y = g.y;
|
|
551
|
+
}
|
|
552
|
+
return c;
|
|
553
|
+
});
|
|
517
554
|
}, fs = {
|
|
518
555
|
default: {
|
|
519
556
|
label: "Default",
|
|
@@ -643,7 +680,7 @@ const us = (p) => p, Os = (p) => p > 0 ? 1 : 0, Rs = (p) => p < 1 ? 0 : 1, is =
|
|
|
643
680
|
centerLabelColor: "rgba(255,255,255,0.4)"
|
|
644
681
|
}
|
|
645
682
|
};
|
|
646
|
-
class
|
|
683
|
+
class ci {
|
|
647
684
|
constructor() {
|
|
648
685
|
tt(this, "artboard", null);
|
|
649
686
|
tt(this, "objectStates", /* @__PURE__ */ new Map());
|
|
@@ -1429,8 +1466,8 @@ class li {
|
|
|
1429
1466
|
const C = y.split(".");
|
|
1430
1467
|
let S = v;
|
|
1431
1468
|
for (let w = 0; w < C.length - 1; w++) {
|
|
1432
|
-
const
|
|
1433
|
-
S[
|
|
1469
|
+
const M = C[w];
|
|
1470
|
+
S[M] === void 0 && (S[M] = {}), S = S[M];
|
|
1434
1471
|
}
|
|
1435
1472
|
const I = C[C.length - 1];
|
|
1436
1473
|
S[I] = m, d = m;
|
|
@@ -1573,10 +1610,10 @@ class li {
|
|
|
1573
1610
|
this._springChainState.has(v.id) || this._springChainState.set(v.id, /* @__PURE__ */ new Map());
|
|
1574
1611
|
const I = this._springChainState.get(v.id);
|
|
1575
1612
|
if (!I.has(u)) {
|
|
1576
|
-
const
|
|
1613
|
+
const M = this.objectStates.get(u);
|
|
1577
1614
|
I.set(u, {
|
|
1578
|
-
x: (
|
|
1579
|
-
y: (
|
|
1615
|
+
x: (M == null ? void 0 : M.x) ?? 0,
|
|
1616
|
+
y: (M == null ? void 0 : M.y) ?? 0,
|
|
1580
1617
|
vx: 0,
|
|
1581
1618
|
vy: 0
|
|
1582
1619
|
});
|
|
@@ -1767,22 +1804,22 @@ class li {
|
|
|
1767
1804
|
if (r.type === "Translation") {
|
|
1768
1805
|
const b = this.getGlobalTransform(r.targetId);
|
|
1769
1806
|
if (b) {
|
|
1770
|
-
const C = r.offsetX || 0, S = r.offsetY || 0, I = b.x + C, w = b.y + S,
|
|
1771
|
-
if (
|
|
1772
|
-
const T = this.objectVelocities.get(s.id) || { vx: 0, vy: 0 }, { x: W, y:
|
|
1773
|
-
r.copyX && (e.x = e.x + (W - e.x) * l), r.copyY && (e.y = e.y + (
|
|
1807
|
+
const C = r.offsetX || 0, S = r.offsetY || 0, I = b.x + C, w = b.y + S, M = r.useSpring;
|
|
1808
|
+
if (M) {
|
|
1809
|
+
const T = this.objectVelocities.get(s.id) || { vx: 0, vy: 0 }, { x: W, y: k, vx: _, vy: L } = this.computeSpring(e.x, e.y, T.vx, T.vy, I, w, r, t);
|
|
1810
|
+
r.copyX && (e.x = e.x + (W - e.x) * l), r.copyY && (e.y = e.y + (k - e.y) * l), this.objectVelocities.set(s.id, { vx: _, vy: L });
|
|
1774
1811
|
} else
|
|
1775
1812
|
r.copyX && (e.x = e.x + (I - e.x) * l), r.copyY && (e.y = e.y + (w - e.y) * l);
|
|
1776
|
-
let
|
|
1813
|
+
let P = !1;
|
|
1777
1814
|
if ((c = r.limitX) != null && c.enabled) {
|
|
1778
1815
|
const T = e.x;
|
|
1779
|
-
e.x = Math.max(r.limitX.min, Math.min(r.limitX.max, e.x)), e.x !== T && (
|
|
1816
|
+
e.x = Math.max(r.limitX.min, Math.min(r.limitX.max, e.x)), e.x !== T && (P = !0);
|
|
1780
1817
|
}
|
|
1781
1818
|
if ((g = r.limitY) != null && g.enabled) {
|
|
1782
1819
|
const T = e.y;
|
|
1783
|
-
e.y = Math.max(r.limitY.min, Math.min(r.limitY.max, e.y)), e.y !== T && (
|
|
1820
|
+
e.y = Math.max(r.limitY.min, Math.min(r.limitY.max, e.y)), e.y !== T && (P = !0);
|
|
1784
1821
|
}
|
|
1785
|
-
|
|
1822
|
+
P && M && this.objectVelocities.set(s.id, { vx: 0, vy: 0 });
|
|
1786
1823
|
}
|
|
1787
1824
|
} else if (r.type === "Rotation") {
|
|
1788
1825
|
const b = this.getGlobalTransform(r.targetId);
|
|
@@ -1803,8 +1840,8 @@ class li {
|
|
|
1803
1840
|
} else if (r.type === "FollowPointer") {
|
|
1804
1841
|
const b = ((f = this._lastPointerPos) == null ? void 0 : f.x) ?? e.x, C = ((d = this._lastPointerPos) == null ? void 0 : d.y) ?? e.y, S = r.useSpring;
|
|
1805
1842
|
if (S) {
|
|
1806
|
-
const w = this.objectVelocities.get(s.id) || { vx: 0, vy: 0 }, { x:
|
|
1807
|
-
e.x =
|
|
1843
|
+
const w = this.objectVelocities.get(s.id) || { vx: 0, vy: 0 }, { x: M, y: P, vx: T, vy: W } = this.computeSpring(e.x, e.y, w.vx, w.vy, b, C, r, t);
|
|
1844
|
+
e.x = M, e.y = P, this.objectVelocities.set(s.id, { vx: T, vy: W });
|
|
1808
1845
|
} else
|
|
1809
1846
|
e.x = e.x + (b - e.x) * l, e.y = e.y + (C - e.y) * l;
|
|
1810
1847
|
let I = !1;
|
|
@@ -1821,24 +1858,24 @@ class li {
|
|
|
1821
1858
|
const b = this.getGlobalTransform(r.targetId);
|
|
1822
1859
|
if (b) {
|
|
1823
1860
|
const C = e.x - b.x, S = e.y - b.y, I = Math.sqrt(C * C + S * S), w = r.distance || 0;
|
|
1824
|
-
let
|
|
1861
|
+
let M = I;
|
|
1825
1862
|
switch (r.mode) {
|
|
1826
1863
|
case "exact":
|
|
1827
|
-
|
|
1864
|
+
M = w;
|
|
1828
1865
|
break;
|
|
1829
1866
|
case "minimum":
|
|
1830
|
-
|
|
1867
|
+
M = Math.max(w, I);
|
|
1831
1868
|
break;
|
|
1832
1869
|
case "maximum":
|
|
1833
|
-
|
|
1870
|
+
M = Math.min(w, I);
|
|
1834
1871
|
break;
|
|
1835
1872
|
case "clamped":
|
|
1836
|
-
|
|
1873
|
+
M = Math.max(0, Math.min(w, I));
|
|
1837
1874
|
break;
|
|
1838
1875
|
}
|
|
1839
1876
|
if (I > 0) {
|
|
1840
|
-
const
|
|
1841
|
-
e.x = e.x + (b.x + C *
|
|
1877
|
+
const P = e.x === b.x && e.y === b.y ? 1 : M / I;
|
|
1878
|
+
e.x = e.x + (b.x + C * P - e.x) * l, e.y = e.y + (b.y + S * P - e.y) * l;
|
|
1842
1879
|
}
|
|
1843
1880
|
}
|
|
1844
1881
|
} else if (r.type === "FollowPath") {
|
|
@@ -1854,14 +1891,14 @@ class li {
|
|
|
1854
1891
|
F && (S = F.geometry);
|
|
1855
1892
|
}
|
|
1856
1893
|
if (!S) return;
|
|
1857
|
-
const I = (r.distance || 0) / 100, w = C.width || S.width || 0,
|
|
1894
|
+
const I = (r.distance || 0) / 100, w = C.width || S.width || 0, M = C.height || S.height || 0, P = this.getPointOnPath(S, w, M, I), T = C.rotation * Math.PI / 180, W = Math.cos(T), k = Math.sin(T), _ = P.x * C.scale_x * W - P.y * C.scale_y * k, L = P.x * C.scale_x * k + P.y * C.scale_y * W;
|
|
1858
1895
|
let x = C.rotation + (r.offsetRotation || 0);
|
|
1859
1896
|
if (r.orient) {
|
|
1860
|
-
const F = Math.cos(
|
|
1897
|
+
const F = Math.cos(P.angle), q = Math.sin(P.angle), Q = F * C.scale_x * W - q * C.scale_y * k, it = F * C.scale_x * k + q * C.scale_y * W;
|
|
1861
1898
|
x = Math.atan2(it, Q) * 180 / Math.PI + (r.offsetRotation || 0);
|
|
1862
1899
|
}
|
|
1863
|
-
const
|
|
1864
|
-
if (e.x = e.x + (et - e.x) * l, e.y = e.y + (
|
|
1900
|
+
const A = x * Math.PI / 180, $ = Math.cos(A), O = Math.sin(A), z = (r.offsetX || 0) * $ - (r.offsetY || 0) * O, H = (r.offsetX || 0) * O + (r.offsetY || 0) * $, et = C.x + _ + z, E = C.y + L + H;
|
|
1901
|
+
if (e.x = e.x + (et - e.x) * l, e.y = e.y + (E - e.y) * l, r.orient) {
|
|
1865
1902
|
let F = (x - e.rotation) % 360;
|
|
1866
1903
|
F > 180 && (F -= 360), F < -180 && (F += 360), e.rotation = e.rotation + F * l;
|
|
1867
1904
|
}
|
|
@@ -1878,25 +1915,25 @@ class li {
|
|
|
1878
1915
|
});
|
|
1879
1916
|
}
|
|
1880
1917
|
getGlobalTransform(t) {
|
|
1881
|
-
var
|
|
1918
|
+
var u;
|
|
1882
1919
|
const s = this.objectStates.get(t);
|
|
1883
1920
|
if (!s) return { x: 0, y: 0, rotation: 0, scale_x: 1, scale_y: 1 };
|
|
1884
|
-
const o = (
|
|
1921
|
+
const o = (u = this.artboard) == null ? void 0 : u.objects.find((m) => m.id === t), e = this.getAnimatedValue(t, "x", s.x), i = this.getAnimatedValue(t, "y", s.y), n = this.getAnimatedValue(t, "rotation", s.rotation), a = this.getAnimatedValue(t, "scale_x", s.scale_x ?? 1) * (s.flip_x ? -1 : 1), r = this.getAnimatedValue(t, "scale_y", s.scale_y ?? 1) * (s.flip_y ? -1 : 1);
|
|
1885
1922
|
if (!o || !o.parentId)
|
|
1886
1923
|
return {
|
|
1887
|
-
x:
|
|
1888
|
-
y:
|
|
1889
|
-
rotation:
|
|
1890
|
-
scale_x:
|
|
1891
|
-
scale_y:
|
|
1924
|
+
x: e,
|
|
1925
|
+
y: i,
|
|
1926
|
+
rotation: n,
|
|
1927
|
+
scale_x: a,
|
|
1928
|
+
scale_y: r
|
|
1892
1929
|
};
|
|
1893
|
-
const
|
|
1930
|
+
const l = this.getGlobalTransform(o.parentId), h = l.rotation * Math.PI / 180, c = Math.cos(h), g = Math.sin(h), f = l.x + (e * l.scale_x * c - i * l.scale_y * g), d = l.y + (e * l.scale_x * g + i * l.scale_y * c);
|
|
1894
1931
|
return {
|
|
1895
|
-
x:
|
|
1896
|
-
y:
|
|
1897
|
-
rotation:
|
|
1898
|
-
scale_x:
|
|
1899
|
-
scale_y:
|
|
1932
|
+
x: f,
|
|
1933
|
+
y: d,
|
|
1934
|
+
rotation: l.rotation + n,
|
|
1935
|
+
scale_x: l.scale_x * a,
|
|
1936
|
+
scale_y: l.scale_y * r
|
|
1900
1937
|
};
|
|
1901
1938
|
}
|
|
1902
1939
|
globalToLocal(t, s) {
|
|
@@ -1933,8 +1970,8 @@ class li {
|
|
|
1933
1970
|
const S = Math.atan2(m, u);
|
|
1934
1971
|
let w = (Math.atan2(v, y) - S) * 180 / Math.PI;
|
|
1935
1972
|
w *= e;
|
|
1936
|
-
const
|
|
1937
|
-
|
|
1973
|
+
const M = this.objectStates.get(f.id);
|
|
1974
|
+
M && (M.rotation += w);
|
|
1938
1975
|
}
|
|
1939
1976
|
}
|
|
1940
1977
|
}
|
|
@@ -2006,17 +2043,17 @@ class li {
|
|
|
2006
2043
|
})) : t === "blur" && this.activeHoverIds.clear(), this.activeDropdownId && t === "down") {
|
|
2007
2044
|
const f = this.artboard.objects.find((d) => d.id === this.activeDropdownId);
|
|
2008
2045
|
if (f && (f.type === "Dropdown" || f.variant === "dropdown")) {
|
|
2009
|
-
const d = this.objectStates.get(f.id), u = (d == null ? void 0 : d.options) || f.options || {}, m = f.geometry || {}, y = m.width ?? f.width ?? 200, v = m.height ?? f.height ?? 40, b = u.optionsList || [], C = u.itemHeight || 32, S = u.listPadding ?? 4, I = b.length * C + S * 2, w = this.getWorldTransform(f.id),
|
|
2010
|
-
if (W &&
|
|
2046
|
+
const d = this.objectStates.get(f.id), u = (d == null ? void 0 : d.options) || f.options || {}, m = f.geometry || {}, y = m.width ?? f.width ?? 200, v = m.height ?? f.height ?? 40, b = u.optionsList || [], C = u.itemHeight || 32, S = u.listPadding ?? 4, I = b.length * C + S * 2, w = this.getWorldTransform(f.id), M = y * Math.abs(w.scaleX), P = v * Math.abs(w.scaleY), T = w.y + P / 2 + 4, W = Math.abs(s - w.x) <= M / 2, k = o >= T && o <= T + I * Math.abs(w.scaleY);
|
|
2047
|
+
if (W && k) {
|
|
2011
2048
|
const _ = Math.abs(w.scaleY), L = o - (T + S * _), x = Math.floor(L / (C * _));
|
|
2012
2049
|
if (x >= 0 && x < b.length) {
|
|
2013
|
-
const
|
|
2014
|
-
u.selectedOption =
|
|
2050
|
+
const A = b[x];
|
|
2051
|
+
u.selectedOption = A, u.isOpen = !1, this.activeDropdownId = null, f.inputId && this.setInternalInput(f.inputId, A), this.onComponentChange && this.onComponentChange({
|
|
2015
2052
|
objectId: f.id,
|
|
2016
2053
|
componentName: f.name,
|
|
2017
2054
|
variant: "dropdown",
|
|
2018
2055
|
property: "selectedOption",
|
|
2019
|
-
value:
|
|
2056
|
+
value: A
|
|
2020
2057
|
});
|
|
2021
2058
|
}
|
|
2022
2059
|
return;
|
|
@@ -2116,20 +2153,20 @@ class li {
|
|
|
2116
2153
|
}
|
|
2117
2154
|
}
|
|
2118
2155
|
if (f.type === "LineGraph" && (t === "down" || t === "click")) {
|
|
2119
|
-
const m = f.geometry, y = (m == null ? void 0 : m.datasets) || [], v = this.objectStates.get(f.id), b = (v == null ? void 0 : v.width) || (m == null ? void 0 : m.width) || 200, C = (v == null ? void 0 : v.height) || (m == null ? void 0 : m.height) || 150, S = this.getWorldTransform(f.id), I = 30, w = 20,
|
|
2156
|
+
const m = f.geometry, y = (m == null ? void 0 : m.datasets) || [], v = this.objectStates.get(f.id), b = (v == null ? void 0 : v.width) || (m == null ? void 0 : m.width) || 200, C = (v == null ? void 0 : v.height) || (m == null ? void 0 : m.height) || 150, S = this.getWorldTransform(f.id), I = 30, w = 20, M = b - I, P = C - w;
|
|
2120
2157
|
let T = 1;
|
|
2121
2158
|
y.forEach((_) => {
|
|
2122
2159
|
const L = Math.max(..._.data || [0]);
|
|
2123
2160
|
L > T && (T = L);
|
|
2124
2161
|
});
|
|
2125
|
-
let W = 1 / 0,
|
|
2162
|
+
let W = 1 / 0, k = null;
|
|
2126
2163
|
y.forEach((_, L) => {
|
|
2127
|
-
const x = _.data || [],
|
|
2164
|
+
const x = _.data || [], A = M / Math.max(x.length - 1, 1);
|
|
2128
2165
|
x.forEach(($, O) => {
|
|
2129
|
-
const
|
|
2130
|
-
et < W && (W = et,
|
|
2166
|
+
const z = S.x - b / 2 + I + O * A, H = S.y + C / 2 - w - $ / T * P, et = Math.sqrt((s - z) ** 2 + (o - H) ** 2);
|
|
2167
|
+
et < W && (W = et, k = { dIdx: L, pIdx: O, val: $, label: _.label || `Dataset ${L + 1}` });
|
|
2131
2168
|
});
|
|
2132
|
-
}),
|
|
2169
|
+
}), k && W < 20 && this.onGraphPointClick && this.onGraphPointClick({ objectId: f.id, componentName: f.name, datasetIndex: k.dIdx, pointIndex: k.pIdx, value: k.val, label: k.label }), this.onComponentChange && this.onComponentChange({ objectId: f.id, componentName: f.name, variant: "linegraph", property: "click", value: (k == null ? void 0 : k.val) ?? null });
|
|
2133
2170
|
}
|
|
2134
2171
|
if (t === "click") {
|
|
2135
2172
|
const m = (l = this.artboard) == null ? void 0 : l.objects.find((b) => b.id === e.id), y = this.focusedId, v = (m == null ? void 0 : m.type) === "InputBox" || (m == null ? void 0 : m.type) === "Component" && m.variant === "inputbox";
|
|
@@ -2596,44 +2633,58 @@ class li {
|
|
|
2596
2633
|
}
|
|
2597
2634
|
*/
|
|
2598
2635
|
renderObject(t, s, o) {
|
|
2599
|
-
var u, m, y, v, b, C, S, I, w,
|
|
2636
|
+
var u, m, y, v, b, C, S, I, w, M, P, T, W, k, _, L, x;
|
|
2600
2637
|
const e = this.objectStates.get(s.id);
|
|
2601
2638
|
if (!e) {
|
|
2602
2639
|
console.warn("No state for object:", s.id);
|
|
2603
2640
|
return;
|
|
2604
2641
|
}
|
|
2605
|
-
this.frameCount % 60, t.roundRect || (t.roundRect = (
|
|
2642
|
+
this.frameCount % 60, t.roundRect || (t.roundRect = (A, $, O, z, H) => (this.drawRoundRect(t, A, $, O, z, H), t));
|
|
2606
2643
|
const i = e.geometry ? this.deepMerge(s.geometry, e.geometry) : s.geometry, n = e.style ? this.deepMerge(s.style, e.style) : s.style;
|
|
2607
2644
|
let a = (i == null ? void 0 : i.width) || ((u = s.geometry) == null ? void 0 : u.width) || s.width || 0, r = (i == null ? void 0 : i.height) || ((m = s.geometry) == null ? void 0 : m.height) || s.height || 0;
|
|
2608
2645
|
if ((a === 0 || r === 0) && (i != null && i.points) && Array.isArray(i.points) && i.points.length > 0) {
|
|
2609
|
-
let
|
|
2646
|
+
let A = 1 / 0, $ = -1 / 0, O = 1 / 0, z = -1 / 0;
|
|
2610
2647
|
i.points.forEach((H) => {
|
|
2611
|
-
|
|
2612
|
-
}), a === 0 && (a = $ -
|
|
2648
|
+
A = Math.min(A, H.x), $ = Math.max($, H.x), O = Math.min(O, H.y), z = Math.max(z, H.y);
|
|
2649
|
+
}), a === 0 && (a = $ - A), r === 0 && (r = z - O);
|
|
2650
|
+
}
|
|
2651
|
+
const l = (A) => {
|
|
2652
|
+
if (A)
|
|
2653
|
+
return A.corner_radius ?? A.cornerRadius;
|
|
2654
|
+
}, h = l(e) ?? l(n) ?? l(i) ?? l(s.style) ?? l(s.geometry) ?? 0;
|
|
2655
|
+
let c = { ...i, width: a, height: r };
|
|
2656
|
+
if (delete c.cornerRadius, c.corner_radius = h, c.type === "Path" && s.weights && s.bindMatrices && c.points) {
|
|
2657
|
+
const A = this.getGlobalTransform(s.id);
|
|
2658
|
+
if (A) {
|
|
2659
|
+
const $ = li(
|
|
2660
|
+
c.points,
|
|
2661
|
+
s.weights,
|
|
2662
|
+
s.bindMatrices,
|
|
2663
|
+
A,
|
|
2664
|
+
(O) => this.getGlobalTransform(O)
|
|
2665
|
+
);
|
|
2666
|
+
c = { ...c, points: $ };
|
|
2667
|
+
}
|
|
2613
2668
|
}
|
|
2614
|
-
|
|
2615
|
-
if (R)
|
|
2616
|
-
return R.corner_radius ?? R.cornerRadius;
|
|
2617
|
-
}, h = l(e) ?? l(n) ?? l(i) ?? l(s.style) ?? l(s.geometry) ?? 0, c = { ...i, width: a, height: r };
|
|
2618
|
-
if (delete c.cornerRadius, c.corner_radius = h, e.visible === !1)
|
|
2669
|
+
if (e.visible === !1)
|
|
2619
2670
|
return;
|
|
2620
2671
|
const g = s.repeaterConfig, f = g && g.isEnabled && g.count > 1, d = f ? g.count : 1;
|
|
2621
|
-
for (let
|
|
2622
|
-
let $ = e.x, O = e.y,
|
|
2623
|
-
if (f &&
|
|
2672
|
+
for (let A = 0; A < d; A++) {
|
|
2673
|
+
let $ = e.x, O = e.y, z = e.rotation, H = e.scale_x ?? 1, et = e.scale_y ?? 1;
|
|
2674
|
+
if (f && A > 0) {
|
|
2624
2675
|
if (g.type === "Linear") {
|
|
2625
2676
|
const J = g.offsetX || 0, ft = g.offsetY || 0, U = g.rotation || 0, G = g.scale !== void 0 ? g.scale : 1;
|
|
2626
|
-
$ +=
|
|
2677
|
+
$ += A * J, O += A * ft, z += A * U, H *= Math.pow(G, A), et *= Math.pow(G, A);
|
|
2627
2678
|
} else if (g.type === "Grid") {
|
|
2628
|
-
const J = g.cols || Math.ceil(Math.sqrt(g.count)), ft = g.gapX || 0, U = g.gapY || 0, G = Math.floor(
|
|
2679
|
+
const J = g.cols || Math.ceil(Math.sqrt(g.count)), ft = g.gapX || 0, U = g.gapY || 0, G = Math.floor(A / J), K = A % J, Z = a + ft, At = r + U;
|
|
2629
2680
|
$ += K * Z, O += G * At;
|
|
2630
2681
|
} else if (g.type === "Radial") {
|
|
2631
|
-
const J = g.radius || 100, ft = g.startAngle || 0, G = (g.endAngle || 360) - ft, K = g.count > 1 ? G / (G === 360 ? g.count : g.count - 1) : 0, Z = ft +
|
|
2632
|
-
$ = e.x + J * Math.cos(At), O = e.y + J * Math.sin(At),
|
|
2682
|
+
const J = g.radius || 100, ft = g.startAngle || 0, G = (g.endAngle || 360) - ft, K = g.count > 1 ? G / (G === 360 ? g.count : g.count - 1) : 0, Z = ft + A * K, At = Z * Math.PI / 180;
|
|
2683
|
+
$ = e.x + J * Math.cos(At), O = e.y + J * Math.sin(At), z += Z;
|
|
2633
2684
|
}
|
|
2634
2685
|
}
|
|
2635
|
-
const
|
|
2636
|
-
if (!
|
|
2686
|
+
const E = s.type === "Group" || s.type === "Frame" || s.type === "Component", F = a > 0 && r > 0;
|
|
2687
|
+
if (!E && F) {
|
|
2637
2688
|
const J = (((y = n.shadow) == null ? void 0 : y.isEnabled) !== !1 ? (((v = n.shadow) == null ? void 0 : v.blur) || 0) + 10 : 0) + (((b = n.blur) == null ? void 0 : b.isEnabled) !== !1 && ((C = n.blur) == null ? void 0 : C.radius) || 0) + 20;
|
|
2638
2689
|
if (!this.isObjectInView(t, $, O, a, r, J))
|
|
2639
2690
|
continue;
|
|
@@ -2643,7 +2694,7 @@ class li {
|
|
|
2643
2694
|
Q && Q.amount > 0 && q.push(`blur(${Q.amount}px)`);
|
|
2644
2695
|
const it = n.effect || ((I = s.style) == null ? void 0 : I.effect), dt = (it == null ? void 0 : it.isEnabled) === !0, St = it == null ? void 0 : it.type, ht = (it == null ? void 0 : it.radius) ?? 10;
|
|
2645
2696
|
dt && St === "LayerBlur" && q.push(`blur(${ht}px)`);
|
|
2646
|
-
const mt = ((w = i == null ? void 0 : i.type) == null ? void 0 : w.toLowerCase().includes("image")) || ((
|
|
2697
|
+
const mt = ((w = i == null ? void 0 : i.type) == null ? void 0 : w.toLowerCase().includes("image")) || ((M = s.type) == null ? void 0 : M.toLowerCase().includes("image")), rt = n.adjustments && Object.keys(n.adjustments).length > 0 ? n.adjustments : null, Lt = i != null && i.adjustments && Object.keys(i.adjustments).length > 0 ? i.adjustments : null, Gt = mt ? Lt || rt : rt || Lt, Pt = mt && !Gt ? {
|
|
2647
2698
|
exposure: 0,
|
|
2648
2699
|
contrast: 0,
|
|
2649
2700
|
saturation: 100,
|
|
@@ -2664,12 +2715,12 @@ class li {
|
|
|
2664
2715
|
<feFuncG type="linear" slope="1" intercept="${J}"/>
|
|
2665
2716
|
<feFuncB type="linear" slope="1" intercept="${J}"/>
|
|
2666
2717
|
</feComponentTransfer>`, kt = "exposure"), ft !== 0) {
|
|
2667
|
-
const yt = (ft + 100) / 100,
|
|
2718
|
+
const yt = (ft + 100) / 100, R = 0.5 * (1 - yt);
|
|
2668
2719
|
Ot += `
|
|
2669
2720
|
<feComponentTransfer in="${kt}" result="contrast">
|
|
2670
|
-
<feFuncR type="linear" slope="${yt}" intercept="${
|
|
2671
|
-
<feFuncG type="linear" slope="${yt}" intercept="${
|
|
2672
|
-
<feFuncB type="linear" slope="${yt}" intercept="${
|
|
2721
|
+
<feFuncR type="linear" slope="${yt}" intercept="${R}"/>
|
|
2722
|
+
<feFuncG type="linear" slope="${yt}" intercept="${R}"/>
|
|
2723
|
+
<feFuncB type="linear" slope="${yt}" intercept="${R}"/>
|
|
2673
2724
|
</feComponentTransfer>`, kt = "contrast";
|
|
2674
2725
|
}
|
|
2675
2726
|
if (U !== 1 && (Ot += `<feColorMatrix in="${kt}" type="saturate" values="${U}" result="saturate"/>`, kt = "saturate"), Pt.hue && (Ot += `<feColorMatrix in="${kt}" type="hueRotate" values="${Pt.hue}" result="hue"/>`, kt = "hue"), Pt.negative) {
|
|
@@ -2682,8 +2733,8 @@ class li {
|
|
|
2682
2733
|
0 0 0 1 0"/>`, kt = "invert";
|
|
2683
2734
|
}
|
|
2684
2735
|
if (G !== 0 || K !== 0 || Z !== 0 || At !== 0) {
|
|
2685
|
-
const yt = 1 + Z + At,
|
|
2686
|
-
|
|
2736
|
+
const yt = 1 + Z + At, R = yt * (1 + G - K / 2), ct = yt * (1 + K), Xt = yt * (1 - G - K / 2), xt = Pt.shadows * 0.1 / 255, te = [
|
|
2737
|
+
R,
|
|
2687
2738
|
0,
|
|
2688
2739
|
0,
|
|
2689
2740
|
0,
|
|
@@ -2707,8 +2758,8 @@ class li {
|
|
|
2707
2758
|
Ot += `<feColorMatrix in="${kt}" type="matrix" values="${te}" result="advanced"/>`, kt = "advanced";
|
|
2708
2759
|
}
|
|
2709
2760
|
if (Pt.blur && (Ot += `<feGaussianBlur in="${kt}" stdDeviation="${Pt.blur}" result="blur"/>`, kt = "blur"), Ot) {
|
|
2710
|
-
const yt = `<svg xmlns="http://www.w3.org/2000/svg"><filter id="f" color-interpolation-filters="sRGB">${Ot}</filter></svg>`,
|
|
2711
|
-
q.push(`url('data:image/svg+xml;base64,${
|
|
2761
|
+
const yt = `<svg xmlns="http://www.w3.org/2000/svg"><filter id="f" color-interpolation-filters="sRGB">${Ot}</filter></svg>`, R = btoa(yt);
|
|
2762
|
+
q.push(`url('data:image/svg+xml;base64,${R}#f')`);
|
|
2712
2763
|
}
|
|
2713
2764
|
}
|
|
2714
2765
|
q.length > 0 ? t.filter = q.join(" ") : t.filter = "none", t.imageSmoothingEnabled = !0, t.imageSmoothingQuality = "high";
|
|
@@ -2748,7 +2799,7 @@ class li {
|
|
|
2748
2799
|
"screen"
|
|
2749
2800
|
].includes(J) && (t.globalCompositeOperation = J);
|
|
2750
2801
|
}
|
|
2751
|
-
const lt = t,
|
|
2802
|
+
const lt = t, Vt = e.masks || (s.maskedBy ? [{
|
|
2752
2803
|
maskId: s.maskedBy,
|
|
2753
2804
|
inverted: s.maskInverted === !0,
|
|
2754
2805
|
type: s.maskType || "alpha",
|
|
@@ -2757,14 +2808,14 @@ class li {
|
|
|
2757
2808
|
isVisible: !0
|
|
2758
2809
|
}] : []);
|
|
2759
2810
|
let Mt = !1;
|
|
2760
|
-
const Tt =
|
|
2811
|
+
const Tt = Vt.filter((J) => J.isVisible !== !1 && o.has(J.maskId));
|
|
2761
2812
|
if (Tt.length > 0) {
|
|
2762
2813
|
const J = Tt[0], ft = o.get(J.maskId), U = this.objectStates.get(ft.id);
|
|
2763
2814
|
U && U.visible !== !1 && (Mt = !0, (!this.maskBuffer || this.maskBuffer.width !== this.canvasWidth || this.maskBuffer.height !== this.canvasHeight) && (this.maskBuffer = document.createElement("canvas"), this.maskBuffer.width = this.canvasWidth, this.maskBuffer.height = this.canvasHeight, this.maskCtx = this.maskBuffer.getContext("2d", { willReadFrequently: !0 }), this.maskCtx && (this.maskCtx.imageSmoothingEnabled = !0, this.maskCtx.imageSmoothingQuality = "high")), this.maskCtx.setTransform(1, 0, 0, 1, 0, 0), this.maskCtx.globalCompositeOperation = "source-over", this.maskCtx.globalAlpha = 1, this.maskCtx.filter = "none", this.maskCtx.clearRect(0, 0, this.maskBuffer.width, this.maskBuffer.height), this.rootTransform && this.maskCtx.setTransform(this.rootTransform), s.parentId && this.applyAbsoluteTransform(this.maskCtx, s.parentId, o), this.maskCtx.save(), this.maskCtx.globalAlpha = 1, t = this.maskCtx, t.filter = lt.filter);
|
|
2764
2815
|
}
|
|
2765
|
-
t.translate(Math.round($), Math.round(O)), t.rotate(
|
|
2766
|
-
const
|
|
2767
|
-
(
|
|
2816
|
+
t.translate(Math.round($), Math.round(O)), t.rotate(z * Math.PI / 180);
|
|
2817
|
+
const zt = e.skew_x || 0, Ut = e.skew_y || 0;
|
|
2818
|
+
(zt !== 0 || Ut !== 0) && t.transform(1, Math.tan(Ut * Math.PI / 180), Math.tan(zt * Math.PI / 180), 1, 0, 0);
|
|
2768
2819
|
const Jt = e.rotate_x || 0, qt = e.rotate_y || 0, Qt = (e.flip_x === !0 ? -1 : 1) * Math.cos(qt * Math.PI / 180), oe = (e.flip_y === !0 ? -1 : 1) * Math.cos(Jt * Math.PI / 180);
|
|
2769
2820
|
t.scale(
|
|
2770
2821
|
H * Qt,
|
|
@@ -2773,17 +2824,17 @@ class li {
|
|
|
2773
2824
|
const jt = n.shadow;
|
|
2774
2825
|
if (jt && jt.isEnabled !== !1) {
|
|
2775
2826
|
let J = jt.color || "#000000";
|
|
2776
|
-
(T = (
|
|
2827
|
+
(T = (P = this.artboard) == null ? void 0 : P.tokens) != null && T.colors && this.artboard.tokens.colors[J] && (J = this.artboard.tokens.colors[J]);
|
|
2777
2828
|
const ft = this.normalizeOpacity(jt.opacity ?? 100), U = jt.spread || 0, K = (jt.blur || 0) + U * 1.5;
|
|
2778
2829
|
let Z = J;
|
|
2779
2830
|
if (J.startsWith("#")) {
|
|
2780
|
-
const kt = J.replace("#", ""), Nt = parseInt(kt.substring(0, 2), 16), yt = parseInt(kt.substring(2, 4), 16),
|
|
2781
|
-
Z = `rgba(${Nt}, ${yt}, ${
|
|
2831
|
+
const kt = J.replace("#", ""), Nt = parseInt(kt.substring(0, 2), 16), yt = parseInt(kt.substring(2, 4), 16), R = parseInt(kt.substring(4, 6), 16);
|
|
2832
|
+
Z = `rgba(${Nt}, ${yt}, ${R}, ${ft})`;
|
|
2782
2833
|
} else if (J.startsWith("rgba")) {
|
|
2783
2834
|
const kt = J.match(/[\d.]+/g);
|
|
2784
2835
|
if (kt && kt.length >= 4) {
|
|
2785
|
-
const Nt = kt[0], yt = kt[1],
|
|
2786
|
-
Z = `rgba(${Nt}, ${yt}, ${
|
|
2836
|
+
const Nt = kt[0], yt = kt[1], R = kt[2], ct = kt[3];
|
|
2837
|
+
Z = `rgba(${Nt}, ${yt}, ${R}, ${parseFloat(ct) * ft})`;
|
|
2787
2838
|
}
|
|
2788
2839
|
}
|
|
2789
2840
|
const At = t.getTransform(), Ot = Math.sqrt(At.a * At.a + At.b * At.b) || 1;
|
|
@@ -2808,7 +2859,7 @@ class li {
|
|
|
2808
2859
|
}, ft.onerror = (K) => {
|
|
2809
2860
|
console.error("[ExodeUI] Image load failed:", K, `Src preview: ${J.substring(0, 100)}...`);
|
|
2810
2861
|
}, ft.src = J, this.imageCache.set(J, ft));
|
|
2811
|
-
const U = n.stroke && n.stroke.width > 0 && n.stroke.isEnabled !== !1, G = (((
|
|
2862
|
+
const U = n.stroke && n.stroke.width > 0 && n.stroke.isEnabled !== !1, G = (((k = n.stroke) == null ? void 0 : k.alignment) || "center").toLowerCase();
|
|
2812
2863
|
if (U && (G === "outside" || G === "center") && this.applyStrokeAlignment(t, n, c, a, r, h), n.fill && n.fill.type !== "None") {
|
|
2813
2864
|
t.save();
|
|
2814
2865
|
const K = t.globalAlpha, Z = this.createCanvasFill(t, n.fill, a, r);
|
|
@@ -2849,22 +2900,22 @@ class li {
|
|
|
2849
2900
|
let Nt = this.imageCache.get(kt);
|
|
2850
2901
|
if (!Nt) {
|
|
2851
2902
|
Nt = new Image(), Nt.crossOrigin = "anonymous";
|
|
2852
|
-
let
|
|
2853
|
-
|
|
2903
|
+
let R = J;
|
|
2904
|
+
R.match(/xmlns=["']http:\/\/www\.w3\.org\/2000\/svg["']/i) || (R = R.replace(/<svg([^>]*)>/i, (ot, It) => `<svg xmlns="http://www.w3.org/2000/svg"${It}>`));
|
|
2854
2905
|
let ct = i.width || a || 100, Xt = i.height || r || 100;
|
|
2855
|
-
const xt =
|
|
2856
|
-
if (xt && (ct = parseFloat(xt[1]), Xt = parseFloat(xt[2])),
|
|
2906
|
+
const xt = R.match(/viewBox=["']\s*0\s+0\s+([\d.]+)\s+([\d.]+)\s*["']/i);
|
|
2907
|
+
if (xt && (ct = parseFloat(xt[1]), Xt = parseFloat(xt[2])), R = R.replace(/<svg([^>]*)>/i, (ot, It) => {
|
|
2857
2908
|
let bt = It.replace(/\b(?:width|height)=["'][^"']*["']/gi, " ");
|
|
2858
2909
|
return bt.match(/\bviewBox=/i) || (bt += ` viewBox="0 0 ${ct} ${Xt}"`), bt.match(/\bpreserveAspectRatio=/i) || (bt += ' preserveAspectRatio="none"'), bt += ' width="100%" height="100%"', `<svg${bt}>`;
|
|
2859
2910
|
}), i.colors && i.colors.length > 0 && ft.length > 0 && i.colors.forEach((ot, It) => {
|
|
2860
2911
|
if (ft[It]) {
|
|
2861
2912
|
const bt = ot.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"), vt = new RegExp(bt, "gi");
|
|
2862
|
-
|
|
2913
|
+
R = R.replace(vt, ft[It]);
|
|
2863
2914
|
}
|
|
2864
2915
|
}), U && U.type && U.type !== "None") {
|
|
2865
2916
|
if (U.type === "Solid" && U.color) {
|
|
2866
2917
|
const ot = Z ? "#FFFFFF" : U.color, It = Z ? 1 : this.normalizeOpacity(U.opacity ?? 100);
|
|
2867
|
-
|
|
2918
|
+
R = R.replace(/\bfill\s*=\s*["'][^"']*["']/gi, (bt) => /fill\s*=\s*["']\s*(none|transparent)\s*["']/i.test(bt) ? bt : `fill="${ot}"`), R = R.replace(/fill\s*:\s*[^;"')]+/gi, (bt) => /fill\s*:\s*(none|transparent)/i.test(bt) ? bt : `fill:${ot}`), It < 1 && (R = R.replace(/\bfill-opacity\s*=\s*["'][^"']*["']/gi, `fill-opacity="${It}"`), R = R.replace(/fill-opacity\s*:\s*[^;"')]+/gi, `fill-opacity:${It}`), R.match(/\bfill-opacity\s*=/i) || (R = R.replace(/(<svg[^>]*>)/i, `$1<g fill-opacity="${It}">`), R = R.replace(/<\/svg>/i, "</g></svg>")));
|
|
2868
2919
|
} else if (U.type === "LinearGradient" || U.type === "RadialGradient" || U.type === "Linear" || U.type === "Radial") {
|
|
2869
2920
|
const ot = "exode-fill", It = this.normalizeOpacity(U.opacity ?? 100), bt = (U.stops || []).map((gt) => {
|
|
2870
2921
|
const Rt = gt.offset !== void 0 ? gt.offset : gt.pos ?? 0, at = this.normalizeOpacity(gt.opacity ?? 100) * It;
|
|
@@ -2872,23 +2923,23 @@ class li {
|
|
|
2872
2923
|
}).join("");
|
|
2873
2924
|
let vt = "";
|
|
2874
2925
|
if (U.type === "LinearGradient" || U.type === "Linear") {
|
|
2875
|
-
const gt = (wt,
|
|
2926
|
+
const gt = (wt, V) => Array.isArray(wt) ? wt[V] ?? (V === 0 ? 0 : 1) : wt && typeof wt == "object" ? wt[V === 0 ? "x" : "y"] ?? (V === 0 ? 0 : 1) : V === 0 ? 0 : 1, Rt = gt(U.start, 0) * 100, at = gt(U.start, 1) * 100, st = gt(U.end, 0) * 100, nt = gt(U.end, 1) * 100;
|
|
2876
2927
|
vt = `<linearGradient id="${ot}" x1="${Rt}%" y1="${at}%" x2="${st}%" y2="${nt}%" gradientUnits="objectBoundingBox">${bt}</linearGradient>`;
|
|
2877
2928
|
} else {
|
|
2878
2929
|
const gt = (nt, wt) => Array.isArray(nt) ? nt[wt] ?? 0.5 : nt && typeof nt == "object" ? nt[wt === 0 ? "x" : "y"] ?? 0.5 : 0.5, Rt = gt(U.center, 0) * 100, at = gt(U.center, 1) * 100, st = (U.radius ?? 0.5) * 100;
|
|
2879
2930
|
vt = `<radialGradient id="${ot}" cx="${Rt}%" cy="${at}%" r="${st}%" gradientUnits="objectBoundingBox">${bt}</radialGradient>`;
|
|
2880
2931
|
}
|
|
2881
|
-
/<defs>/i.test(
|
|
2932
|
+
/<defs>/i.test(R) ? R = R.replace(/<defs>/i, `<defs>${vt}`) : R = R.replace(/<svg([^>]*)>/i, `<svg$1><defs>${vt}</defs>`), R = R.replace(/\bfill\s*=\s*["'][^"']*["']/gi, (gt) => /fill\s*=\s*["']\s*(none|transparent)\s*["']/i.test(gt) ? gt : `fill="url(#${ot})"`), R = R.replace(/fill\s*:\s*[^;"')]+/gi, (gt) => /fill\s*:\s*(none|transparent)/i.test(gt) ? gt : `fill:url(#${ot})`);
|
|
2882
2933
|
}
|
|
2883
2934
|
}
|
|
2884
2935
|
const te = (ot, It, bt = 1) => {
|
|
2885
2936
|
const vt = (ot.stops || []).map((nt) => {
|
|
2886
|
-
const wt = nt.offset !== void 0 ? nt.offset : nt.pos ?? 0,
|
|
2887
|
-
return `<stop offset="${wt * 100}%" stop-color="${nt.color || "#000"}" stop-opacity="${
|
|
2888
|
-
}).join(""), gt = (nt, wt,
|
|
2937
|
+
const wt = nt.offset !== void 0 ? nt.offset : nt.pos ?? 0, V = this.normalizeOpacity(nt.opacity ?? 100) * bt;
|
|
2938
|
+
return `<stop offset="${wt * 100}%" stop-color="${nt.color || "#000"}" stop-opacity="${V}"/>`;
|
|
2939
|
+
}).join(""), gt = (nt, wt, V = 0.5) => Array.isArray(nt) ? nt[wt] ?? V : nt && typeof nt == "object" ? nt[wt === 0 ? "x" : "y"] ?? V : V;
|
|
2889
2940
|
if (ot.type === "LinearGradient" || ot.type === "Linear") {
|
|
2890
|
-
const nt = gt(ot.start, 0, 0) * 100, wt = gt(ot.start, 1, 0) * 100,
|
|
2891
|
-
return `<linearGradient id="${It}" x1="${nt}%" y1="${wt}%" x2="${
|
|
2941
|
+
const nt = gt(ot.start, 0, 0) * 100, wt = gt(ot.start, 1, 0) * 100, V = gt(ot.end, 0, 1) * 100, pt = gt(ot.end, 1, 1) * 100;
|
|
2942
|
+
return `<linearGradient id="${It}" x1="${nt}%" y1="${wt}%" x2="${V}%" y2="${pt}%" gradientUnits="objectBoundingBox">${vt}</linearGradient>`;
|
|
2892
2943
|
}
|
|
2893
2944
|
const Rt = gt(ot.center, 0, 0.5) * 100, at = gt(ot.center, 1, 0.5) * 100, st = (ot.radius ?? 0.5) * 100;
|
|
2894
2945
|
return `<radialGradient id="${It}" cx="${Rt}%" cy="${at}%" r="${st}%" gradientUnits="objectBoundingBox">${vt}</radialGradient>`;
|
|
@@ -2902,13 +2953,13 @@ class li {
|
|
|
2902
2953
|
bt = vt.color || G.color || "#000000";
|
|
2903
2954
|
else if (vt.type === "LinearGradient" || vt.type === "RadialGradient" || vt.type === "Linear" || vt.type === "Radial") {
|
|
2904
2955
|
const Ht = "exode-stroke";
|
|
2905
|
-
|
|
2956
|
+
R = $t(R, te(vt, Ht, ot)), bt = `url(#${Ht})`;
|
|
2906
2957
|
}
|
|
2907
2958
|
}
|
|
2908
|
-
bt || (bt = It),
|
|
2959
|
+
bt || (bt = It), R.match(/\bstroke\s*=\s*["']/i) ? R = R.replace(
|
|
2909
2960
|
/\bstroke\s*=\s*["'][^"']*["']/gi,
|
|
2910
2961
|
(Ht) => /stroke\s*=\s*["']\s*(none|transparent)\s*["']/i.test(Ht) ? Ht : `stroke="${bt}"`
|
|
2911
|
-
) :
|
|
2962
|
+
) : R = R.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke="${bt}"`), R = R.replace(
|
|
2912
2963
|
new RegExp(`(?<![a-z-])stroke\\s*:\\s*(?!none|transparent)[^;"')]+`, "gi"),
|
|
2913
2964
|
`stroke:${bt}`
|
|
2914
2965
|
);
|
|
@@ -2918,12 +2969,12 @@ class li {
|
|
|
2918
2969
|
const Ht = parseFloat(at[1]), se = parseFloat(at[2]);
|
|
2919
2970
|
!isNaN(Ht) && !isNaN(se) && (gt = Ht, Rt = se);
|
|
2920
2971
|
}
|
|
2921
|
-
const st = Math.max(1e-3, a / gt), nt = Math.max(1e-3, r / Rt), wt = (st + nt) / 2,
|
|
2922
|
-
|
|
2972
|
+
const st = Math.max(1e-3, a / gt), nt = Math.max(1e-3, r / Rt), wt = (st + nt) / 2, V = (G.width || 1) / wt;
|
|
2973
|
+
R.match(/\bstroke-width\s*=\s*["']/i) ? R = R.replace(/\bstroke-width\s*=\s*["'][^"']*["']/gi, `stroke-width="${V}"`) : R = R.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-width="${V}"`), R = R.replace(/stroke-width\s*:\s*[^;"')]+/gi, `stroke-width:${V}`), R.match(/\bstroke-opacity\s*=\s*["']/i) ? R = R.replace(/\bstroke-opacity\s*=\s*["'][^"']*["']/gi, `stroke-opacity="${ot}"`) : R = R.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-opacity="${ot}"`), R = R.replace(/stroke-opacity\s*:\s*[^;"')]+/gi, `stroke-opacity:${ot}`);
|
|
2923
2974
|
const pt = G.lineCap || "round";
|
|
2924
|
-
|
|
2975
|
+
R.match(/\bstroke-linecap\s*=\s*["']/i) ? R = R.replace(/\bstroke-linecap\s*=\s*["'][^"']*["']/gi, `stroke-linecap="${pt}"`) : R = R.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-linecap="${pt}"`), R = R.replace(/stroke-linecap\s*:\s*[^;"')]+/gi, `stroke-linecap:${pt}`);
|
|
2925
2976
|
const ut = G.lineJoin || "round";
|
|
2926
|
-
|
|
2977
|
+
R.match(/\bstroke-linejoin\s*=\s*["']/i) ? R = R.replace(/\bstroke-linejoin\s*=\s*["'][^"']*["']/gi, `stroke-linejoin="${ut}"`) : R = R.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-linejoin="${ut}"`), R = R.replace(/stroke-linejoin\s*:\s*[^;"')]+/gi, `stroke-linejoin:${ut}`);
|
|
2927
2978
|
const ce = G.trimStart ?? 0, me = G.trimEnd ?? 1, Ie = G.trimOffset ?? 0, we = G.dashOffset ?? 0, Te = ce !== 0 || me !== 1 || Ie !== 0 || we !== 0;
|
|
2928
2979
|
if (Te) {
|
|
2929
2980
|
const Ht = Math.max(0, Math.min(1, ce)), se = Math.max(0, Math.min(1, me));
|
|
@@ -2936,10 +2987,10 @@ class li {
|
|
|
2936
2987
|
const le = ue * (se - Ht), ye = ue - le;
|
|
2937
2988
|
re = -(ue * (Ht + Me + ke)), fe = `${le} ${ye}`;
|
|
2938
2989
|
}
|
|
2939
|
-
|
|
2990
|
+
R.match(/\bstroke-dasharray\s*=/i) ? R = R.replace(/\bstroke-dasharray\s*=\s*["'][^"']*["']/gi, `stroke-dasharray="${fe}"`) : R = R.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-dasharray="${fe}"`), R = R.replace(/stroke-dasharray\s*:\s*[^;"')]+/gi, `stroke-dasharray:${fe}`), R.match(/\bstroke-dashoffset\s*=/i) ? R = R.replace(/\bstroke-dashoffset\s*=\s*["'][^"']*["']/gi, `stroke-dashoffset="${re}"`) : R = R.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-dashoffset="${re}"`), R = R.replace(/stroke-dashoffset\s*:\s*[^;"')]+/gi, `stroke-dashoffset:${re}`);
|
|
2940
2991
|
} else if (G.dashArray && G.dashArray.length > 0) {
|
|
2941
2992
|
const Ht = G.dashArray.join(" ");
|
|
2942
|
-
|
|
2993
|
+
R = R.replace(/\bstroke-dasharray\s*=\s*["'][^"']*["']/gi, `stroke-dasharray="${Ht}"`), R = R.replace(/stroke-dasharray\s*:\s*[^;"')]+/gi, `stroke-dasharray:${Ht}`), G.dashOffset && (R = R.replace(/\bstroke-dashoffset\s*=\s*["'][^"']*["']/gi, `stroke-dashoffset="${G.dashOffset}"`), R = R.replace(/stroke-dashoffset\s*:\s*[^;"')]+/gi, `stroke-dashoffset:${G.dashOffset}`));
|
|
2943
2994
|
}
|
|
2944
2995
|
if (!/\bstroke\s*=\s*["']/i.test(J) && !new RegExp("(?<![a-z-])stroke\\s*:", "i").test(J)) {
|
|
2945
2996
|
let Ht = "", se = "";
|
|
@@ -2952,14 +3003,14 @@ class li {
|
|
|
2952
3003
|
Ht = ` stroke-dasharray="${Pe} ${Re}"`, se = ` stroke-dashoffset="${Le}"`;
|
|
2953
3004
|
}
|
|
2954
3005
|
} else (_ = G.dashArray) != null && _.length && (Ht = ` stroke-dasharray="${G.dashArray.join(" ")}"`, G.dashOffset && (se = ` stroke-dashoffset="${G.dashOffset}"`));
|
|
2955
|
-
const ue = ` stroke-linecap="${G.lineCap || "round"}"`, Me = ` stroke-linejoin="${G.lineJoin || "round"}"`, ke = `stroke="${bt}" stroke-width="${
|
|
2956
|
-
|
|
3006
|
+
const ue = ` stroke-linecap="${G.lineCap || "round"}"`, Me = ` stroke-linejoin="${G.lineJoin || "round"}"`, ke = `stroke="${bt}" stroke-width="${V}" stroke-opacity="${ot}"${ue}${Me}${Ht}${se}`;
|
|
3007
|
+
R = R.replace(
|
|
2957
3008
|
/(<svg[^>]*>)(\s*(?:<defs>[\s\S]*?<\/defs>)?)/i,
|
|
2958
3009
|
(fe, re, le) => `${re}${le}<g ${ke}>`
|
|
2959
|
-
),
|
|
3010
|
+
), R = R.replace(/<\/svg>/i, "</g></svg>");
|
|
2960
3011
|
}
|
|
2961
|
-
} else G && G.isEnabled === !1 && (
|
|
2962
|
-
const Wt = new Blob([
|
|
3012
|
+
} else G && G.isEnabled === !1 && (R = R.replace(/\bstroke\s*=\s*["'][^"']*["']/gi, 'stroke="none"'), R = R.replace(new RegExp(`(?<![a-z-])stroke\\s*:\\s*(?!none|transparent)[^;"')]+`, "gi"), "stroke:none"));
|
|
3013
|
+
const Wt = new Blob([R], { type: "image/svg+xml" }), Ft = URL.createObjectURL(Wt);
|
|
2963
3014
|
Nt.onload = () => {
|
|
2964
3015
|
if (URL.revokeObjectURL(Ft), this.frameCount % 900 === 0) {
|
|
2965
3016
|
const ot = this.imageCache.get(kt);
|
|
@@ -2971,12 +3022,12 @@ class li {
|
|
|
2971
3022
|
}
|
|
2972
3023
|
let yt = null;
|
|
2973
3024
|
if (Nt.complete && Nt.naturalWidth > 0 ? (yt = Nt, this.lastValidSvgImgMap.set(s.id, Nt)) : yt = this.lastValidSvgImgMap.get(s.id) || null, yt && yt.complete && yt.naturalWidth > 0) {
|
|
2974
|
-
const
|
|
3025
|
+
const R = Math.max(1, a), ct = Math.max(1, r);
|
|
2975
3026
|
if (Z && (U == null ? void 0 : U.type) === "Solid") {
|
|
2976
|
-
this.maskBuffer || (this.maskBuffer = document.createElement("canvas"), this.maskCtx = this.maskBuffer.getContext("2d")), this.maskBuffer.width =
|
|
3027
|
+
this.maskBuffer || (this.maskBuffer = document.createElement("canvas"), this.maskCtx = this.maskBuffer.getContext("2d")), this.maskBuffer.width = R, this.maskBuffer.height = ct, this.maskCtx.setTransform(1, 0, 0, 1, 0, 0), this.maskCtx.globalCompositeOperation = "source-over", this.maskCtx.globalAlpha = 1, this.maskCtx.filter = "none", this.maskCtx.clearRect(0, 0, R, ct), this.maskCtx.drawImage(yt, 0, 0, R, ct), this.maskCtx.globalCompositeOperation = "source-in";
|
|
2977
3028
|
const Xt = U.color || "#000000", xt = this.normalizeOpacity(U.opacity ?? 100);
|
|
2978
|
-
this.maskCtx.fillStyle = Xt, this.maskCtx.globalAlpha = xt, this.maskCtx.fillRect(0, 0,
|
|
2979
|
-
} else h !== 0 ? (t.save(), this.drawRoundRect(t, -
|
|
3029
|
+
this.maskCtx.fillStyle = Xt, this.maskCtx.globalAlpha = xt, this.maskCtx.fillRect(0, 0, R, ct), t.drawImage(this.maskBuffer, -R / 2, -ct / 2, R, ct);
|
|
3030
|
+
} else h !== 0 ? (t.save(), this.drawRoundRect(t, -R / 2, -ct / 2, R, ct, h), t.clip(), t.drawImage(yt, -R / 2, -ct / 2, R, ct), t.restore()) : t.drawImage(yt, -R / 2, -ct / 2, R, ct);
|
|
2980
3031
|
}
|
|
2981
3032
|
}
|
|
2982
3033
|
} else if (c.type === "LineGraph")
|
|
@@ -3038,7 +3089,7 @@ class li {
|
|
|
3038
3089
|
feather: s.maskFeather || 0,
|
|
3039
3090
|
isVisible: !0
|
|
3040
3091
|
}] : [])).filter((G) => G.isVisible !== !1 && o.has(G.maskId)).forEach((G) => {
|
|
3041
|
-
var yt,
|
|
3092
|
+
var yt, R, ct, Xt, xt, te;
|
|
3042
3093
|
const K = o.get(G.maskId), Z = this.objectStates.get(K.id), At = G.feather || 0, Ot = G.inverted === !0, kt = G.opacity !== void 0 ? typeof G.opacity == "number" ? G.opacity : G.opacity / 100 : 1;
|
|
3043
3094
|
if ((G.type || "alpha") === "luma") {
|
|
3044
3095
|
(!this.lumaBuffer || this.lumaBuffer.width !== this.maskBuffer.width || this.lumaBuffer.height !== this.maskBuffer.height) && (this.lumaBuffer = document.createElement("canvas"), this.lumaBuffer.width = this.maskBuffer.width, this.lumaBuffer.height = this.maskBuffer.height, this.lumaCtx = this.lumaBuffer.getContext("2d", { willReadFrequently: !0 }), this.lumaCtx && (this.lumaCtx.imageSmoothingEnabled = !0, this.lumaCtx.imageSmoothingQuality = "high")), this.lumaCtx.setTransform(1, 0, 0, 1, 0, 0), this.lumaCtx.globalCompositeOperation = "source-over", this.lumaCtx.globalAlpha = 1, this.lumaCtx.filter = "none", this.lumaCtx.clearRect(0, 0, this.lumaBuffer.width, this.lumaBuffer.height), this.lumaCtx.save(), this.rootTransform && this.lumaCtx.setTransform(this.rootTransform), this.applyAbsoluteTransform(this.lumaCtx, K.id, o), At > 0 && (this.lumaCtx.filter = `blur(${At}px)`), this.lumaCtx.globalAlpha = kt;
|
|
@@ -3046,7 +3097,7 @@ class li {
|
|
|
3046
3097
|
if (((yt = K.geometry) == null ? void 0 : yt.type) === "Text") {
|
|
3047
3098
|
const vt = Z != null && Z.geometry ? this.deepMerge(K.geometry, Z.geometry) : K.geometry, gt = Z != null && Z.style ? this.deepMerge(K.style, Z.style) : K.style;
|
|
3048
3099
|
this._renderText(this.lumaCtx, K, { ...vt, width: $t, height: Wt, corner_radius: Ft }, gt, Z, $t, Wt, !0);
|
|
3049
|
-
} else if (((
|
|
3100
|
+
} else if (((R = K.geometry) == null ? void 0 : R.type) === "Image") {
|
|
3050
3101
|
const vt = K.geometry.src;
|
|
3051
3102
|
if (vt) {
|
|
3052
3103
|
let gt = this.imageCache.get(vt);
|
|
@@ -3123,8 +3174,8 @@ class li {
|
|
|
3123
3174
|
if (o.svgPath) {
|
|
3124
3175
|
const B = o.svgPath;
|
|
3125
3176
|
t.save();
|
|
3126
|
-
const lt = ((St = e == null ? void 0 : e.fill) == null ? void 0 : St.color) || "#000000",
|
|
3127
|
-
t.fillStyle = lt, t.globalAlpha *=
|
|
3177
|
+
const lt = ((St = e == null ? void 0 : e.fill) == null ? void 0 : St.color) || "#000000", Vt = ((ht = e == null ? void 0 : e.fill) == null ? void 0 : ht.opacity) !== void 0 ? (mt = e == null ? void 0 : e.fill) == null ? void 0 : mt.opacity : 1;
|
|
3178
|
+
t.fillStyle = lt, t.globalAlpha *= Vt;
|
|
3128
3179
|
const Mt = new Path2D(B);
|
|
3129
3180
|
t.fill(Mt), t.restore();
|
|
3130
3181
|
return;
|
|
@@ -3148,20 +3199,20 @@ class li {
|
|
|
3148
3199
|
t.textBaseline = "top";
|
|
3149
3200
|
const w = o.textAlign || "left";
|
|
3150
3201
|
t.textAlign = w;
|
|
3151
|
-
let
|
|
3202
|
+
let M = 0;
|
|
3152
3203
|
if (typeof o.letterSpacing == "number")
|
|
3153
|
-
|
|
3204
|
+
M = o.letterSpacing;
|
|
3154
3205
|
else if (typeof o.letterSpacing == "object" && o.letterSpacing.value !== void 0) {
|
|
3155
3206
|
const B = o.letterSpacing;
|
|
3156
|
-
|
|
3207
|
+
M = B.unit === "PERCENT" ? B.value / 100 * m : B.value;
|
|
3157
3208
|
}
|
|
3158
|
-
t.letterSpacing !== void 0 && (t.letterSpacing = `${
|
|
3159
|
-
const
|
|
3160
|
-
|
|
3209
|
+
t.letterSpacing !== void 0 && (t.letterSpacing = `${M}px`);
|
|
3210
|
+
const P = o.kerning || "auto", T = o.kerningValue || 0;
|
|
3211
|
+
P === "manual" && T !== 0 && (t.letterSpacing = `${M + T}px`);
|
|
3161
3212
|
const W = o.paragraphSpacing || 0;
|
|
3162
|
-
let
|
|
3163
|
-
typeof
|
|
3164
|
-
const _ = (
|
|
3213
|
+
let k = o.lineHeight ?? 1.2;
|
|
3214
|
+
typeof k == "string" && (k = parseFloat(k)), k > 5 && m > 0 && (k = k / m);
|
|
3215
|
+
const _ = (k || 1.2) * m, L = o.isPointText === !0 || !o.width || o.width <= 0, x = ((Lt = o.padding) == null ? void 0 : Lt.left) || ((Gt = o.padding) == null ? void 0 : Gt.right) || 0, A = L ? 1e5 : o.width && o.width > 0 ? Math.ceil(o.width) - x * 2 : 1e5;
|
|
3165
3216
|
o.autoHeight;
|
|
3166
3217
|
const $ = ps({
|
|
3167
3218
|
text: c,
|
|
@@ -3169,9 +3220,9 @@ class li {
|
|
|
3169
3220
|
fontSize: m,
|
|
3170
3221
|
fontWeight: u,
|
|
3171
3222
|
fontStyle: d,
|
|
3172
|
-
lineHeight:
|
|
3173
|
-
width:
|
|
3174
|
-
letterSpacing:
|
|
3223
|
+
lineHeight: k,
|
|
3224
|
+
width: A,
|
|
3225
|
+
letterSpacing: M,
|
|
3175
3226
|
paragraphSpacing: W,
|
|
3176
3227
|
paragraphIndent: o.paragraphIndent || 0,
|
|
3177
3228
|
segments: o.segments,
|
|
@@ -3180,23 +3231,23 @@ class li {
|
|
|
3180
3231
|
hyphenation: o.hyphenation,
|
|
3181
3232
|
composer: o.composer,
|
|
3182
3233
|
balanceRaggedLines: o.balanceRaggedLines
|
|
3183
|
-
}), O = $.lines || [],
|
|
3184
|
-
let
|
|
3185
|
-
a > 0 && a >
|
|
3234
|
+
}), O = $.lines || [], z = $.maxFontSize || m, H = this.fontLeadingFactors[y] ?? 0.5, et = (_ - m) * H;
|
|
3235
|
+
let E = $.height, F = -E / 2;
|
|
3236
|
+
a > 0 && a > E && (I === "top" ? F = -a / 2 : I === "middle" || I === "center" ? F = -E / 2 : I === "bottom" && (F = a / 2 - E)), F += et;
|
|
3186
3237
|
let q = null, Q = 0;
|
|
3187
3238
|
if (o.pathId && this.artboard) {
|
|
3188
3239
|
const B = this.artboard.objects.find((lt) => lt.id === o.pathId);
|
|
3189
3240
|
if (B && B.type === "Shape" && ((Pt = B.geometry) == null ? void 0 : Pt.type) === "Path") {
|
|
3190
|
-
const lt = this.objectStates.get(B.id),
|
|
3191
|
-
q = { geo:
|
|
3241
|
+
const lt = this.objectStates.get(B.id), Vt = lt != null && lt.geometry ? this.deepMerge(B.geometry, lt.geometry) : B.geometry, Mt = (lt == null ? void 0 : lt.scale_x) !== void 0 ? (B.width || 0) * lt.scale_x : B.width || 0, Tt = (lt == null ? void 0 : lt.scale_y) !== void 0 ? (B.height || 0) * lt.scale_y : B.height || 0;
|
|
3242
|
+
q = { geo: Vt, obj: B, w: Mt, h: Tt }, Q = this.getPerimeter(Vt, Mt, Tt);
|
|
3192
3243
|
}
|
|
3193
3244
|
}
|
|
3194
3245
|
const it = (B, lt) => {
|
|
3195
3246
|
var Mt, Tt;
|
|
3196
|
-
if (
|
|
3197
|
-
let
|
|
3198
|
-
for (let
|
|
3199
|
-
const Ut = lt +
|
|
3247
|
+
if (M === 0 && (!o.enableSegments || !((Mt = o.segments) != null && Mt.length))) return t.measureText(B).width;
|
|
3248
|
+
let Vt = 0;
|
|
3249
|
+
for (let zt = 0; zt < B.length; zt++) {
|
|
3250
|
+
const Ut = lt + zt;
|
|
3200
3251
|
let Jt = 0;
|
|
3201
3252
|
if (o.enableSegments === !0 && ((Tt = o.segments) == null ? void 0 : Tt.length) > 0) {
|
|
3202
3253
|
let qt = 0, Qt = null;
|
|
@@ -3211,20 +3262,20 @@ class li {
|
|
|
3211
3262
|
t.save();
|
|
3212
3263
|
let oe = Qt.fontFamily || o.fontFamily || "Inter";
|
|
3213
3264
|
const jt = this.mapFontWeight((Qt.fontWeight || o.fontWeight || "400").toString()), ee = Qt.fontStyle || d, J = Qt.fontSize || m;
|
|
3214
|
-
t.font = `${ee} ${jt} ${J}px "${oe}", sans-serif`, Jt = t.measureText(B[
|
|
3265
|
+
t.font = `${ee} ${jt} ${J}px "${oe}", sans-serif`, Jt = t.measureText(B[zt]).width, t.restore();
|
|
3215
3266
|
} else
|
|
3216
|
-
Jt = t.measureText(B[
|
|
3267
|
+
Jt = t.measureText(B[zt]).width;
|
|
3217
3268
|
} else
|
|
3218
|
-
Jt = t.measureText(B[
|
|
3219
|
-
|
|
3269
|
+
Jt = t.measureText(B[zt]).width;
|
|
3270
|
+
Vt += Jt + M;
|
|
3220
3271
|
}
|
|
3221
|
-
return
|
|
3222
|
-
}, dt = (B, lt,
|
|
3272
|
+
return Vt - (B.length > 0 ? M : 0);
|
|
3273
|
+
}, dt = (B, lt, Vt, Mt, Tt) => {
|
|
3223
3274
|
var jt, ee;
|
|
3224
3275
|
const Ut = (Tt === 0 || c[Tt - 1] === `
|
|
3225
3276
|
` || c[Tt - 1] === "\r") && o.paragraphIndent ? o.paragraphIndent : 0, Jt = (!r || l) && (s.behaviors || []).some(
|
|
3226
3277
|
(J) => J.enabled && (J.type.toString().includes("Text") || ["Typewriter", "Scramble", "Wave", "Bounce", "GlitchText", "Reveal3D", "RevealSlide", "RevealBlur"].includes(J.type))
|
|
3227
|
-
), qt = !o.pathId && !Jt && (o.enableSegments !== !0 || !o.segments || o.segments.length === 0), Qt = o.baselineShift || 0, oe =
|
|
3278
|
+
), qt = !o.pathId && !Jt && (o.enableSegments !== !0 || !o.segments || o.segments.length === 0), Qt = o.baselineShift || 0, oe = Vt + Qt;
|
|
3228
3279
|
if (qt)
|
|
3229
3280
|
t.font = S, Mt ? t.strokeText(B, lt + Ut, oe) : t.fillText(B, lt + Ut, oe);
|
|
3230
3281
|
else {
|
|
@@ -3236,13 +3287,13 @@ class li {
|
|
|
3236
3287
|
let G = 0, K = 0;
|
|
3237
3288
|
const Z = o.justifyMinWordSpacing, At = o.justifyMaxWordSpacing;
|
|
3238
3289
|
if (w === "justify" && !U && J > 0 && !o.pathId) {
|
|
3239
|
-
const yt = L ? J :
|
|
3290
|
+
const yt = L ? J : A - x * 2 + 0, R = Math.max(0, yt - J);
|
|
3240
3291
|
for (let ct = 0; ct < B.length; ct++)
|
|
3241
3292
|
B[ct] === " " && K++;
|
|
3242
3293
|
if (K > 0) {
|
|
3243
3294
|
const ct = t.measureText(" ").width;
|
|
3244
3295
|
let Xt = Z || ct * 0.5, xt = At || ct * 2.5;
|
|
3245
|
-
G = Math.max(0, Math.min(
|
|
3296
|
+
G = Math.max(0, Math.min(R / K, xt - Xt));
|
|
3246
3297
|
}
|
|
3247
3298
|
}
|
|
3248
3299
|
let Ot = o.pathOffset || 0;
|
|
@@ -3282,9 +3333,9 @@ class li {
|
|
|
3282
3333
|
].includes(yt.type) && yt.enabled
|
|
3283
3334
|
)) || [];
|
|
3284
3335
|
for (let yt = 0; yt < B.length; yt++) {
|
|
3285
|
-
let
|
|
3336
|
+
let R = B[yt];
|
|
3286
3337
|
const ct = Tt + yt;
|
|
3287
|
-
let Xt = 0, xt = 0, te = 1, $t = 1, Wt = 0, Ft = 1, ot =
|
|
3338
|
+
let Xt = 0, xt = 0, te = 1, $t = 1, Wt = 0, Ft = 1, ot = R;
|
|
3288
3339
|
Nt.forEach((at) => {
|
|
3289
3340
|
const st = at.settings || {}, nt = st.strength || 1, wt = Date.now();
|
|
3290
3341
|
if (at.type === Y.Typewriter)
|
|
@@ -3294,91 +3345,91 @@ class li {
|
|
|
3294
3345
|
else if (at.type === Y.Wave)
|
|
3295
3346
|
xt += Math.sin(this.currentTime * 5 * (st.speed || 1) + ct * (st.frequency || 1)) * (st.amplitude || 20) * nt;
|
|
3296
3347
|
else if (at.type === Y.Bounce) {
|
|
3297
|
-
const
|
|
3298
|
-
|
|
3348
|
+
const V = Math.max(0, this.currentTime % 2 - ct * (st.stagger || 0.1));
|
|
3349
|
+
V < 1 && (xt -= Math.abs(Math.sin(V * Math.PI)) * (st.height || 50) * nt);
|
|
3299
3350
|
} else if (at.type === Y.TextTrail) {
|
|
3300
|
-
const
|
|
3301
|
-
|
|
3351
|
+
const V = this.pointerHistory[Math.max(0, this.pointerHistory.length - 1 - ct * (st.delay || 5))];
|
|
3352
|
+
V && (Xt += (V.x - (i.x + kt)) * nt * 0.2, xt += (V.y - (i.y + Vt + xt)) * nt * 0.2);
|
|
3302
3353
|
} else if (at.type === Y.Reveal3D) {
|
|
3303
|
-
const
|
|
3304
|
-
te *=
|
|
3354
|
+
const V = Math.max(0, Math.min(1, this.currentTime * (st.speed || 1) - ct * (st.stagger || 0.1)));
|
|
3355
|
+
te *= V, $t *= V, Ft = V;
|
|
3305
3356
|
} else if (at.type === Y.RevealSlide) {
|
|
3306
|
-
const
|
|
3307
|
-
ut === "up" ? xt -= pt : ut === "down" ? xt += pt : ut === "left" ? Xt -= pt : ut === "right" && (Xt += pt), Ft =
|
|
3357
|
+
const V = Math.max(0, Math.min(1, this.currentTime * 1.5 - ct * 0.05)), pt = (1 - V) * (st.distance || 40) * nt, ut = st.direction || "up";
|
|
3358
|
+
ut === "up" ? xt -= pt : ut === "down" ? xt += pt : ut === "left" ? Xt -= pt : ut === "right" && (Xt += pt), Ft = V;
|
|
3308
3359
|
} else if (at.type === Y.RevealBlur) {
|
|
3309
|
-
const
|
|
3310
|
-
Ft =
|
|
3360
|
+
const V = Math.max(0, Math.min(1, this.currentTime * 1.2 - ct * 0.1));
|
|
3361
|
+
Ft = V, Xt += (1 - V) * 5;
|
|
3311
3362
|
} else if (at.type === Y.TextLiquid) {
|
|
3312
|
-
const
|
|
3313
|
-
xt +=
|
|
3363
|
+
const V = Math.max(0, Math.sin(wt * 1e-3 * (st.speed || 1) + ct * 0.5));
|
|
3364
|
+
xt += V * (st.amplitude || 10) * nt, $t *= 1 + V * 0.2;
|
|
3314
3365
|
} else if (at.type === Y.TextVortex) {
|
|
3315
|
-
const
|
|
3316
|
-
Xt += Math.cos(
|
|
3366
|
+
const V = wt * 2e-3 * (st.speed || 1) + ct * 0.2, pt = (1 - (Math.sin(wt * 1e-3) * 0.5 + 0.5)) * (st.radius || 50);
|
|
3367
|
+
Xt += Math.cos(V) * pt * nt, xt += Math.sin(V) * pt * nt;
|
|
3317
3368
|
} else if (at.type === Y.TextExplosion) {
|
|
3318
|
-
const
|
|
3369
|
+
const V = st.force || 1, pt = this.currentTime % 2;
|
|
3319
3370
|
if (pt < 1) {
|
|
3320
|
-
const ut = (ct / B.length - 0.5) * Math.PI * 2, ce = pt * 100 *
|
|
3371
|
+
const ut = (ct / B.length - 0.5) * Math.PI * 2, ce = pt * 100 * V;
|
|
3321
3372
|
Xt += Math.cos(ut) * ce * nt, xt += Math.sin(ut) * ce * nt, Ft = 1 - pt;
|
|
3322
3373
|
}
|
|
3323
3374
|
} else if (at.type === Y.TextRain) {
|
|
3324
|
-
const
|
|
3375
|
+
const V = st.speed || 1, pt = st.height || 100, ut = (wt * 1e-3 * V + ct * 0.1) % 1;
|
|
3325
3376
|
xt -= (1 - ut) * pt * nt, Ft = ut > 0.1 ? 1 : ut * 10;
|
|
3326
3377
|
} else if (at.type === Y.TextGravity) {
|
|
3327
|
-
const
|
|
3378
|
+
const V = st.gravity || 9.8, pt = this.currentTime % 3 / 3, ut = 0.5 * V * Math.pow(pt * 10, 2);
|
|
3328
3379
|
ut < 100 ? xt += ut * nt : xt += 100 * nt;
|
|
3329
3380
|
} else if (at.type === Y.TextMatrix) {
|
|
3330
|
-
const
|
|
3331
|
-
if (Math.random() < 0.1 *
|
|
3381
|
+
const V = st.speed || 1;
|
|
3382
|
+
if (Math.random() < 0.1 * V) {
|
|
3332
3383
|
const ut = "0123456789ABCDEF!@#$%^&*";
|
|
3333
3384
|
ot = ut[Math.floor(Math.random() * ut.length)];
|
|
3334
3385
|
}
|
|
3335
|
-
Ft = 0.3 + (Math.sin(wt * 0.01 *
|
|
3386
|
+
Ft = 0.3 + (Math.sin(wt * 0.01 * V + ct) + 1) / 2 * 0.7;
|
|
3336
3387
|
} else if (at.type === Y.TextNeon) {
|
|
3337
|
-
const
|
|
3338
|
-
Ft = (0.7 + (Math.sin(wt * 5e-3) + 1) / 2 * 0.3) *
|
|
3388
|
+
const V = Math.random() > 0.95 ? 0.5 : 1;
|
|
3389
|
+
Ft = (0.7 + (Math.sin(wt * 5e-3) + 1) / 2 * 0.3) * V;
|
|
3339
3390
|
} else if (at.type === Y.TextDissolve)
|
|
3340
3391
|
Math.sin(ct * 1.5 + wt * 2e-3 * (st.speed || 1)) > 0.5 && (Ft = 0);
|
|
3341
3392
|
else if (at.type === Y.TextOrganic) {
|
|
3342
|
-
const
|
|
3343
|
-
Xt += Math.sin(wt * 2e-3 *
|
|
3393
|
+
const V = st.speed || 1, pt = st.amplitude || 10;
|
|
3394
|
+
Xt += Math.sin(wt * 2e-3 * V + ct) * pt * nt, xt += Math.cos(wt * 15e-4 * V + ct * 0.7) * pt * nt;
|
|
3344
3395
|
} else if (at.type === Y.TextBreathe) {
|
|
3345
3396
|
const pt = 1 + (Math.sin(wt * 3e-3 + ct * 0.2) + 1) / 2 * 0.2 * nt;
|
|
3346
3397
|
te *= pt, $t *= pt;
|
|
3347
3398
|
} else if (at.type === Y.TextSpin) {
|
|
3348
|
-
const
|
|
3349
|
-
Wt += wt * 0.01 *
|
|
3399
|
+
const V = st.speed || 1;
|
|
3400
|
+
Wt += wt * 0.01 * V + ct;
|
|
3350
3401
|
} else if (at.type === Y.TextMagnet) {
|
|
3351
|
-
const
|
|
3352
|
-
if (
|
|
3353
|
-
const pt =
|
|
3402
|
+
const V = this.pointerHistory[this.pointerHistory.length - 1];
|
|
3403
|
+
if (V) {
|
|
3404
|
+
const pt = V.x - (i.x + kt), ut = V.y - (i.y + Vt);
|
|
3354
3405
|
Wt = Math.atan2(ut, pt);
|
|
3355
3406
|
}
|
|
3356
3407
|
} else if (at.type === Y.TextPerspective) {
|
|
3357
|
-
const
|
|
3408
|
+
const V = B.length / 2, pt = (ct - V) / V, ut = 1 - Math.abs(pt) * 0.3 * nt;
|
|
3358
3409
|
te *= ut, $t *= ut, Xt += pt * 20 * nt;
|
|
3359
3410
|
} else if (at.type === Y.TextMirror)
|
|
3360
3411
|
Ft *= 0.8;
|
|
3361
3412
|
else if (at.type === Y.TextFloral) {
|
|
3362
|
-
const
|
|
3413
|
+
const V = st.speed || 1, pt = st.stagger || 0.1, ut = (wt * 1e-3 * V + ct * pt) % 2;
|
|
3363
3414
|
ut < 1 && (te *= ut, $t *= ut, Wt += ut * Math.PI);
|
|
3364
3415
|
} else if (at.type === Y.TextSmoke) {
|
|
3365
|
-
const
|
|
3416
|
+
const V = st.speed || 1, pt = st.height || 50, ut = (wt * 5e-4 * V + ct * 0.2) % 1;
|
|
3366
3417
|
xt -= ut * pt * nt, Xt += Math.sin(wt * 2e-3 + ct) * 5 * nt, Ft = 1 - ut;
|
|
3367
3418
|
} else if (at.type === Y.TextVariable) {
|
|
3368
|
-
const
|
|
3419
|
+
const V = st.speed || 1, pt = st.intensity || 1.5, ut = (Math.sin(wt * 4e-3 * V + ct * 0.3) + 1) / 2;
|
|
3369
3420
|
te *= 1 + ut * (pt - 1) * nt;
|
|
3370
3421
|
} else if (at.type === Y.TextZing) {
|
|
3371
|
-
const
|
|
3422
|
+
const V = st.speed || 2, pt = st.distance || 100, ut = (wt * 2e-3 * V + ct * 0.05) % 1;
|
|
3372
3423
|
Xt += (1 - ut) * pt * nt, Ft = ut;
|
|
3373
3424
|
} else if (at.type === Y.TextElastic) {
|
|
3374
|
-
const
|
|
3375
|
-
$t *= 1 + ut *
|
|
3425
|
+
const V = st.stiffness || 0.2, pt = st.damping || 0.1, ut = Math.sin(wt * 0.01) * Math.exp(-wt * 1e-3 * pt);
|
|
3426
|
+
$t *= 1 + ut * V * nt;
|
|
3376
3427
|
} else if (at.type === Y.TextGlitch3D) {
|
|
3377
|
-
const
|
|
3378
|
-
Math.random() < 0.2 && (Xt += (Math.random() - 0.5) *
|
|
3428
|
+
const V = st.intensity || 5;
|
|
3429
|
+
Math.random() < 0.2 && (Xt += (Math.random() - 0.5) * V, xt += (Math.random() - 0.5) * V, Ft = 0.8);
|
|
3379
3430
|
} else if (at.type === Y.GlitchText) {
|
|
3380
|
-
const
|
|
3381
|
-
Math.random() < 0.1 && (Xt += (Math.random() - 0.5) *
|
|
3431
|
+
const V = st.intensity || 5;
|
|
3432
|
+
Math.random() < 0.1 && (Xt += (Math.random() - 0.5) * V, xt += (Math.random() - 0.5) * V, Math.random() < 0.05 && (Ft = 0.5));
|
|
3382
3433
|
}
|
|
3383
3434
|
});
|
|
3384
3435
|
let It = null, bt = o.textDecoration || "none", vt = m;
|
|
@@ -3397,8 +3448,8 @@ class li {
|
|
|
3397
3448
|
const ut = new RegExp(`[\\s-]${pt}$`, "i");
|
|
3398
3449
|
ut.test(nt) && (nt = nt.replace(ut, "").trim());
|
|
3399
3450
|
});
|
|
3400
|
-
const wt = this.mapFontWeight((st.fontWeight || o.fontWeight || "400").toString()),
|
|
3401
|
-
vt = st.fontSize || m, t.font = `${
|
|
3451
|
+
const wt = this.mapFontWeight((st.fontWeight || o.fontWeight || "400").toString()), V = st.fontStyle || d;
|
|
3452
|
+
vt = st.fontSize || m, t.font = `${V} ${wt} ${vt}px "${nt}", sans-serif`, st.fill && (It = st.fill), st.textDecoration && (bt = st.textDecoration), vt < z && (xt += (z - vt) * 0.85);
|
|
3402
3453
|
}
|
|
3403
3454
|
} else
|
|
3404
3455
|
t.font = S;
|
|
@@ -3406,10 +3457,10 @@ class li {
|
|
|
3406
3457
|
t.globalAlpha *= Ft, t.save();
|
|
3407
3458
|
const Rt = t.measureText(ot).width;
|
|
3408
3459
|
if (q && Q > 0) {
|
|
3409
|
-
const at = kt - ft + Rt / 2, nt = (Ot + at) / Q, wt = this.getPointOnPath(q.geo, q.w, q.h, Math.abs(nt % 1)),
|
|
3410
|
-
t.translate(wt.x + ce + Xt, wt.y + me), t.rotate(
|
|
3460
|
+
const at = kt - ft + Rt / 2, nt = (Ot + at) / Q, wt = this.getPointOnPath(q.geo, q.w, q.h, Math.abs(nt % 1)), V = wt.angle, pt = Vt + xt + (o.pathOffsetY || 0), ut = o.pathSide === "right" ? -1 : 1, ce = Math.cos(V + Math.PI / 2) * pt * ut, me = Math.sin(V + Math.PI / 2) * pt * ut;
|
|
3461
|
+
t.translate(wt.x + ce + Xt, wt.y + me), t.rotate(V + Wt + (ut === -1 ? Math.PI : 0));
|
|
3411
3462
|
} else
|
|
3412
|
-
t.translate(kt + Xt + Rt / 2,
|
|
3463
|
+
t.translate(kt + Xt + Rt / 2, Vt + xt), Wt !== 0 && t.rotate(Wt);
|
|
3413
3464
|
if (t.scale(te, $t), It && !r && !l) {
|
|
3414
3465
|
const at = this.createCanvasFill(t, It, n, a);
|
|
3415
3466
|
t.fillStyle = at || It.color || "#000000";
|
|
@@ -3422,22 +3473,22 @@ class li {
|
|
|
3422
3473
|
const at = l ? "#000000" : this.createCanvasFill(t, e.fill, n, a);
|
|
3423
3474
|
t.fillStyle = at || e.fill.color || "#ffffff", t.fillText(ot, -Rt / 2, 0);
|
|
3424
3475
|
} else Mt ? t.strokeText(ot, -Rt / 2, 0) : t.fillText(ot, -Rt / 2, 0);
|
|
3425
|
-
bt !== "none" && !r && this.drawTextDecoration(t, bt, 0, 0, Rt, vt), t.restore(), t.globalAlpha = gt, w === "justify" && G > 0 && ot === " " && !U ? kt += Rt +
|
|
3476
|
+
bt !== "none" && !r && this.drawTextDecoration(t, bt, 0, 0, Rt, vt), t.restore(), t.globalAlpha = gt, w === "justify" && G > 0 && ot === " " && !U ? kt += Rt + M + G : kt += Rt + M;
|
|
3426
3477
|
}
|
|
3427
3478
|
}
|
|
3428
3479
|
};
|
|
3429
3480
|
if (r) {
|
|
3430
3481
|
let B = 0, lt = F;
|
|
3431
|
-
(O || []).forEach((
|
|
3432
|
-
const Mt =
|
|
3482
|
+
(O || []).forEach((Vt) => {
|
|
3483
|
+
const Mt = Vt.text || "", Tt = c.indexOf(Mt, B);
|
|
3433
3484
|
Tt !== -1 && (B = Tt);
|
|
3434
|
-
let
|
|
3435
|
-
w === "center" ?
|
|
3485
|
+
let zt = -n / 2;
|
|
3486
|
+
w === "center" ? zt = 0 : w === "right" && (zt = n / 2), dt(Mt, zt, lt, !1, B), B += Mt.length, lt += _;
|
|
3436
3487
|
});
|
|
3437
3488
|
} else if (l) {
|
|
3438
3489
|
let B = 0, lt = F;
|
|
3439
|
-
(O || []).forEach((
|
|
3440
|
-
const Mt =
|
|
3490
|
+
(O || []).forEach((Vt) => {
|
|
3491
|
+
const Mt = Vt.text || "";
|
|
3441
3492
|
let Tt = -n / 2;
|
|
3442
3493
|
w === "center" ? Tt = 0 : w === "right" && (Tt = n / 2), dt(Mt, Tt, lt, !1, B), B += Mt.length, B < c.length && (c[B] === `
|
|
3443
3494
|
` || c[B] === "\r") && (B++, c[B - 1] === "\r" && c[B] === `
|
|
@@ -3445,30 +3496,30 @@ class li {
|
|
|
3445
3496
|
});
|
|
3446
3497
|
} else {
|
|
3447
3498
|
if (e.fill) {
|
|
3448
|
-
const lt = t.globalAlpha,
|
|
3449
|
-
t.fillStyle =
|
|
3499
|
+
const lt = t.globalAlpha, Vt = this.createCanvasFill(t, e.fill, n, a);
|
|
3500
|
+
t.fillStyle = Vt || e.fill.color || "#000000", t.globalAlpha = lt * this.normalizeOpacity(e.fill.opacity ?? 100);
|
|
3450
3501
|
const Mt = $.fullText || (o.enableSegments ? (o.segments || []).map((Ut) => {
|
|
3451
3502
|
let Jt = Ut.text || "";
|
|
3452
3503
|
const qt = Ut.textCase || o.textCase || "none";
|
|
3453
3504
|
return qt === "uppercase" ? Jt.toUpperCase() : qt === "lowercase" ? Jt.toLowerCase() : qt === "capitalize" ? Jt.replace(/\b\w/g, (Qt) => Qt.toUpperCase()) : Jt;
|
|
3454
3505
|
}).join("") : c);
|
|
3455
|
-
let Tt = 0,
|
|
3506
|
+
let Tt = 0, zt = F;
|
|
3456
3507
|
(O || []).forEach((Ut) => {
|
|
3457
3508
|
const Jt = Ut.text || "";
|
|
3458
3509
|
let qt = -n / 2;
|
|
3459
|
-
w === "center" ? qt = 0 : w === "right" && (qt = n / 2), dt(Jt, qt,
|
|
3460
|
-
` || Mt[Tt] === "\r") && (W > 0 && (
|
|
3510
|
+
w === "center" ? qt = 0 : w === "right" && (qt = n / 2), dt(Jt, qt, zt, !1, Tt), Tt += Jt.length, zt += _, Tt < Mt.length && (Mt[Tt] === `
|
|
3511
|
+
` || Mt[Tt] === "\r") && (W > 0 && (zt += W), Tt++, Mt[Tt - 1] === "\r" && Mt[Tt] === `
|
|
3461
3512
|
` && Tt++);
|
|
3462
3513
|
}), t.globalAlpha = lt;
|
|
3463
3514
|
}
|
|
3464
3515
|
const B = o.paragraphRule;
|
|
3465
3516
|
if (B && (((Dt = B.top) == null ? void 0 : Dt.width) > 0 || ((Yt = B.bottom) == null ? void 0 : Yt.width) > 0)) {
|
|
3466
3517
|
let lt = 0;
|
|
3467
|
-
(O || []).forEach((
|
|
3518
|
+
(O || []).forEach((Vt, Mt) => {
|
|
3468
3519
|
var Ut, Jt;
|
|
3469
|
-
const
|
|
3520
|
+
const zt = lt === 0 || lt < c.length && (c[lt] === `
|
|
3470
3521
|
` || c[lt] === "\r");
|
|
3471
|
-
if (
|
|
3522
|
+
if (zt && Mt > 0 && lt++, zt) {
|
|
3472
3523
|
if (((Ut = B.top) == null ? void 0 : Ut.width) > 0) {
|
|
3473
3524
|
const qt = F + Mt * _ - B.top.offset;
|
|
3474
3525
|
t.strokeStyle = B.top.color || "#000000", t.lineWidth = B.top.width, t.beginPath();
|
|
@@ -3482,16 +3533,16 @@ class li {
|
|
|
3482
3533
|
t.moveTo(Qt, qt), t.lineTo(n / 2 - _ * 0.2, qt), t.stroke();
|
|
3483
3534
|
}
|
|
3484
3535
|
}
|
|
3485
|
-
lt += (
|
|
3536
|
+
lt += (Vt.text || "").length;
|
|
3486
3537
|
});
|
|
3487
3538
|
}
|
|
3488
3539
|
if (e.stroke && e.stroke.width > 0) {
|
|
3489
3540
|
const lt = t.globalAlpha;
|
|
3490
3541
|
e.fill && e.fill.type !== "None" && e.fill.isEnabled !== !1 && e.fill.opacity !== 0 && e.fill.color !== "transparent" && e.fill.color !== "rgba(0,0,0,0)" && (t.shadowColor = "transparent", t.shadowBlur = 0, t.shadowOffsetX = 0, t.shadowOffsetY = 0), t.strokeStyle = e.stroke.color, t.lineWidth = e.stroke.width, t.globalAlpha = lt * this.normalizeOpacity(e.stroke.opacity ?? 100);
|
|
3491
3542
|
let Mt = 0, Tt = F;
|
|
3492
|
-
(O || []).forEach((
|
|
3543
|
+
(O || []).forEach((zt) => {
|
|
3493
3544
|
let Ut = -n / 2;
|
|
3494
|
-
w === "center" ? Ut = 0 : w === "right" && (Ut = n / 2), dt(
|
|
3545
|
+
w === "center" ? Ut = 0 : w === "right" && (Ut = n / 2), dt(zt.text, Ut, Tt, !0, Mt), Mt += (zt.text || "").length, Tt += _, Mt < c.length && (c[Mt] === `
|
|
3495
3546
|
` || c[Mt] === "\r") && (W > 0 && (Tt += W), Mt++, c[Mt - 1] === "\r" && c[Mt] === `
|
|
3496
3547
|
` && Mt++);
|
|
3497
3548
|
}), t.globalAlpha = lt;
|
|
@@ -3604,12 +3655,12 @@ class li {
|
|
|
3604
3655
|
if (t <= 0) return 0;
|
|
3605
3656
|
let c = 0, g = s, f = o;
|
|
3606
3657
|
for (let d = 1; d <= h; d++) {
|
|
3607
|
-
const u = d / h, m = 1 - u, y = u * u, v = m * m, b = v * m, C = y * u, S = b * s + 3 * v * u * e + 3 * m * y * n + C * r, I = b * o + 3 * v * u * i + 3 * m * y * a + C * l, w = S - g,
|
|
3608
|
-
if (c +
|
|
3609
|
-
const T = t - c, W =
|
|
3658
|
+
const u = d / h, m = 1 - u, y = u * u, v = m * m, b = v * m, C = y * u, S = b * s + 3 * v * u * e + 3 * m * y * n + C * r, I = b * o + 3 * v * u * i + 3 * m * y * a + C * l, w = S - g, M = I - f, P = Math.sqrt(w * w + M * M);
|
|
3659
|
+
if (c + P >= t) {
|
|
3660
|
+
const T = t - c, W = P === 0 ? 0 : T / P;
|
|
3610
3661
|
return (d - 1 + W) / h;
|
|
3611
3662
|
}
|
|
3612
|
-
c +=
|
|
3663
|
+
c += P, g = S, f = I;
|
|
3613
3664
|
}
|
|
3614
3665
|
return 1;
|
|
3615
3666
|
}
|
|
@@ -3643,8 +3694,8 @@ class li {
|
|
|
3643
3694
|
return w = this.getBezierTAtLength(f - d, b.x, b.y, b.out_x ?? b.x, b.out_y ?? b.y, C.in_x ?? C.x, C.in_y ?? C.y, C.x, C.y, 20), this.getBezierPointAndAngle(w, b, C, h, c);
|
|
3644
3695
|
{
|
|
3645
3696
|
w = S === 0 ? 0 : (f - d) / S;
|
|
3646
|
-
const
|
|
3647
|
-
return { x:
|
|
3697
|
+
const M = b.x + (C.x - b.x) * w - h, P = b.y + (C.y - b.y) * w - c, T = Math.atan2(C.y - b.y, C.x - b.x);
|
|
3698
|
+
return { x: M, y: P, angle: T };
|
|
3648
3699
|
}
|
|
3649
3700
|
}
|
|
3650
3701
|
d += S;
|
|
@@ -3753,8 +3804,8 @@ class li {
|
|
|
3753
3804
|
const I = b.getContext("2d");
|
|
3754
3805
|
if (I) {
|
|
3755
3806
|
I.imageSmoothingEnabled = !1;
|
|
3756
|
-
const w = t.getTransform(),
|
|
3757
|
-
I.drawImage(t.canvas,
|
|
3807
|
+
const w = t.getTransform(), M = w.e - e / 2, P = w.f - i / 2;
|
|
3808
|
+
I.drawImage(t.canvas, M, P, e, i, 0, 0, C, S), t.imageSmoothingEnabled = !1, t.drawImage(b, 0, 0, C, S, -e / 2, -i / 2, e, i), t.imageSmoothingEnabled = !0;
|
|
3758
3809
|
}
|
|
3759
3810
|
} else if (l === "glitch") {
|
|
3760
3811
|
const v = this.currentTime * c, b = r.chaosAmount ?? 0.2, C = Math.max(3, Math.floor(8 * h)), S = h * e * 0.15;
|
|
@@ -3762,11 +3813,11 @@ class li {
|
|
|
3762
3813
|
const I = S * 0.3;
|
|
3763
3814
|
t.fillStyle = "rgba(255, 0, 0, 0.4)", t.fillRect(-e / 2 + I, -i / 2, e, i), t.fillStyle = "rgba(0, 255, 255, 0.4)", t.fillRect(-e / 2 - I, -i / 2, e, i), t.globalCompositeOperation = "source-over", t.globalAlpha = 1;
|
|
3764
3815
|
const w = i / C;
|
|
3765
|
-
for (let
|
|
3766
|
-
const
|
|
3816
|
+
for (let M = 0; M < C; M++) {
|
|
3817
|
+
const P = Math.sin(M * 127.1 + v * 311.7 * c) * 43758.5, T = P - Math.floor(P);
|
|
3767
3818
|
if (T > 1 - b) {
|
|
3768
|
-
const W = (T - (1 - b)) / b * S * (Math.random() > 0.5 ? 1 : -1),
|
|
3769
|
-
t.save(), t.beginPath(), t.rect(-e / 2,
|
|
3819
|
+
const W = (T - (1 - b)) / b * S * (Math.random() > 0.5 ? 1 : -1), k = -i / 2 + M * w, _ = t.getTransform(), L = _.e - e / 2 + W, x = _.f + k;
|
|
3820
|
+
t.save(), t.beginPath(), t.rect(-e / 2, k, e, w), t.clip(), t.globalAlpha = 0.8, t.drawImage(t.canvas, L, x, e, w, -e / 2 + W, k, e, w), t.restore();
|
|
3770
3821
|
}
|
|
3771
3822
|
}
|
|
3772
3823
|
}
|
|
@@ -3931,9 +3982,9 @@ class li {
|
|
|
3931
3982
|
renderInputBox(t, s) {
|
|
3932
3983
|
var dt, St;
|
|
3933
3984
|
const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.options) || s.options || {}, i = ((dt = s.geometry) == null ? void 0 : dt.width) || 250, n = ((St = s.geometry) == null ? void 0 : St.height) || 45, a = this.focusedId === s.id, r = this.lastHoveredObjectId === s.id, l = e.previewState || "default", h = l !== "default" ? l : a ? "focused" : r ? "hovered" : "default", c = e.label || { visible: !0, text: "Label" }, g = e.helperText || { visible: !1, text: "Helper text" }, f = e.leftIcon || { visible: !1 }, d = e.rightIcon || { visible: !1 }, u = e.multiline === !0, m = e.corner_radius ?? 8, y = e.corners || { tl: m, tr: m, bl: m, br: m }, v = [y.tl, y.tr, y.br, y.bl];
|
|
3934
|
-
let b = e.backgroundColor || "rgba(31, 41, 55, 1)", C = e.borderColor || "rgba(55, 65, 81, 1)", S = e.borderWidth ?? 1.5, I = e.color || "#ffffff", w = e.placeholderColor || "rgba(156, 163, 175, 1)",
|
|
3935
|
-
const
|
|
3936
|
-
T ? (T.backgroundColor !== void 0 && (b = T.backgroundColor), T.borderColor !== void 0 && (C = T.borderColor), T.borderWidth !== void 0 && (S = T.borderWidth), T.color !== void 0 && (I = T.color), T.placeholderColor !== void 0 && (w = T.placeholderColor), T.fontSize !== void 0 && (
|
|
3985
|
+
let b = e.backgroundColor || "rgba(31, 41, 55, 1)", C = e.borderColor || "rgba(55, 65, 81, 1)", S = e.borderWidth ?? 1.5, I = e.color || "#ffffff", w = e.placeholderColor || "rgba(156, 163, 175, 1)", M = e.fontSize || 14;
|
|
3986
|
+
const P = `${h}Style`, T = e[P];
|
|
3987
|
+
T ? (T.backgroundColor !== void 0 && (b = T.backgroundColor), T.borderColor !== void 0 && (C = T.borderColor), T.borderWidth !== void 0 && (S = T.borderWidth), T.color !== void 0 && (I = T.color), T.placeholderColor !== void 0 && (w = T.placeholderColor), T.fontSize !== void 0 && (M = T.fontSize)) : h === "focused" ? (C = e.focusBorderColor || "rgba(59, 130, 246, 1)", S = Math.max(S, 2)) : h === "hovered" || h === "hover" ? (C = e.hoverBorderColor || C, b = e.hoverBackgroundColor || b) : h === "disabled" ? (b = e.disabledBackgroundColor || "rgba(31, 41, 55, 0.6)", C = e.disabledBorderColor || "rgba(55, 65, 81, 0.4)") : h === "error" && (C = "rgba(239, 68, 68, 1)", S = Math.max(S, 2)), t.beginPath(), this.drawRoundRect(t, -i / 2, -n / 2, i, n, v);
|
|
3937
3988
|
const W = this.createCanvasFill(t, b, i, n);
|
|
3938
3989
|
if (W && (t.fillStyle = W, t.fill()), S > 0) {
|
|
3939
3990
|
const ht = this.createCanvasFill(t, C, i, n);
|
|
@@ -3943,7 +3994,7 @@ class li {
|
|
|
3943
3994
|
this.drawRoundRect(t, -i / 2 - 2, -n / 2 - 2, i + 4, n + 4, mt), t.strokeStyle = "rgba(59, 130, 246, 0.3)", t.lineWidth = 2, t.stroke(), t.restore();
|
|
3944
3995
|
}
|
|
3945
3996
|
}
|
|
3946
|
-
const
|
|
3997
|
+
const k = (ht, mt) => {
|
|
3947
3998
|
if (!ht.visible || !ht.svgPath) return;
|
|
3948
3999
|
const rt = ht.size || 14, Lt = ht.offset ?? 16, Gt = ht.color || "#ffffff", Pt = mt ? -(i / 2) + Lt : i / 2 - Lt, Dt = ht.svgPath;
|
|
3949
4000
|
if (t.save(), t.translate(Pt, 0), !Dt.startsWith("<svg")) {
|
|
@@ -3952,10 +4003,10 @@ class li {
|
|
|
3952
4003
|
}
|
|
3953
4004
|
t.restore();
|
|
3954
4005
|
};
|
|
3955
|
-
|
|
3956
|
-
const _ = e.text || "", L = e.placeholder || "Enter text...", x = !_,
|
|
3957
|
-
t.font = `${H} ${O}px "${
|
|
3958
|
-
const et = e.inputPadding ?? 16,
|
|
4006
|
+
k(f, !0), k(d, !1);
|
|
4007
|
+
const _ = e.text || "", L = e.placeholder || "Enter text...", x = !_, A = _ || L, $ = x ? w : I, O = M, z = e.fontFamily || "Inter", H = e.fontWeight || 400;
|
|
4008
|
+
t.font = `${H} ${O}px "${z}", sans-serif`, t.fillStyle = $, t.textAlign = "left", t.textBaseline = u ? "top" : "middle";
|
|
4009
|
+
const et = e.inputPadding ?? 16, E = f.visible ? (f.offset ?? 16) + (f.size || 14) / 2 + 8 : et, F = d.visible ? (d.offset ?? 16) + (d.size || 14) / 2 + 8 : et, q = -(i / 2) + E, Q = i - E - F, it = e.inputType === "password" ? "•".repeat(A.length) : A;
|
|
3959
4010
|
if (t.save(), t.beginPath(), t.rect(q - 2, -n / 2 + 4, Q + 4, n - 8), t.clip(), u) {
|
|
3960
4011
|
const ht = it.split(`
|
|
3961
4012
|
`);
|
|
@@ -3981,19 +4032,19 @@ class li {
|
|
|
3981
4032
|
}
|
|
3982
4033
|
if (t.restore(), c.visible !== !1) {
|
|
3983
4034
|
const ht = c.text || "Label", mt = c.fontSize || 12, rt = c.color || "rgba(156, 163, 175, 1)", Lt = c.offset ?? 8;
|
|
3984
|
-
t.font = `600 ${mt}px "${
|
|
4035
|
+
t.font = `600 ${mt}px "${z}", sans-serif`, t.fillStyle = rt, t.textAlign = "left", t.textBaseline = "bottom";
|
|
3985
4036
|
const Gt = -(i / 2), Pt = -(n / 2) - Lt;
|
|
3986
4037
|
t.fillText(ht, Gt, Pt);
|
|
3987
4038
|
}
|
|
3988
4039
|
if (g.visible === !0) {
|
|
3989
4040
|
const ht = g.text || "Helper text", mt = g.fontSize || 11, rt = h === "error" ? "rgba(239, 68, 68, 1)" : g.color || "rgba(156, 163, 175, 1)", Lt = g.offset ?? 6;
|
|
3990
|
-
t.font = `400 ${mt}px "${
|
|
4041
|
+
t.font = `400 ${mt}px "${z}", sans-serif`, t.fillStyle = rt, t.textAlign = "left", t.textBaseline = "top";
|
|
3991
4042
|
const Gt = -(i / 2), Pt = n / 2 + Lt;
|
|
3992
4043
|
t.fillText(ht, Gt, Pt);
|
|
3993
4044
|
}
|
|
3994
4045
|
}
|
|
3995
4046
|
renderSlider(t, s) {
|
|
3996
|
-
const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.geometry) || s.geometry, i = (o == null ? void 0 : o.options) || s.options || {}, n = e.width || 200, a = i.value ?? 50, r = i.min ?? 0, h = (i.max ?? 100) - r, c = h === 0 ? 0 : (a - r) / h, g = i.trackHeight || 4, f = i.trackRoundedness ?? 2, d = i.trackShape ?? "Rectangle", u = i.trackPath || "", m = i.accentColor || "#3b82f6", y = i.inactiveColor || "#374151", v = i.thumbShape || "Ellipse", b = i.thumbWidth ?? 16, C = i.thumbHeight ?? 16, S = i.thumbRoundedness ?? 0, I = i.thumbColor || "#ffffff", w = i.thumbPath || "",
|
|
4047
|
+
const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.geometry) || s.geometry, i = (o == null ? void 0 : o.options) || s.options || {}, n = e.width || 200, a = i.value ?? 50, r = i.min ?? 0, h = (i.max ?? 100) - r, c = h === 0 ? 0 : (a - r) / h, g = i.trackHeight || 4, f = i.trackRoundedness ?? 2, d = i.trackShape ?? "Rectangle", u = i.trackPath || "", m = i.accentColor || "#3b82f6", y = i.inactiveColor || "#374151", v = i.thumbShape || "Ellipse", b = i.thumbWidth ?? 16, C = i.thumbHeight ?? 16, S = i.thumbRoundedness ?? 0, I = i.thumbColor || "#ffffff", w = i.thumbPath || "", M = i.thumbIcon || "", P = i.showValueTooltip ?? !1, T = i.tooltipBgColor || "#333333", W = i.tooltipColor || "#ffffff", k = i.tooltipOffsetX ?? 0, _ = i.tooltipOffsetY ?? -25, L = (Q, it, dt, St, ht, mt, rt) => {
|
|
3997
4048
|
if ((Q === "Custom" || Q === "Icon") && rt)
|
|
3998
4049
|
try {
|
|
3999
4050
|
const Lt = new Path2D(rt);
|
|
@@ -4032,25 +4083,25 @@ class li {
|
|
|
4032
4083
|
t.fill();
|
|
4033
4084
|
}, x = this.createCanvasFill(t, y, n, g);
|
|
4034
4085
|
x && (t.fillStyle = x, t.strokeStyle = x), d === "Line" ? (t.lineWidth = g, t.beginPath(), t.moveTo(-n / 2, 0), t.lineTo(n / 2, 0), t.stroke()) : L(d, 0, 0, n, g, f, u);
|
|
4035
|
-
const
|
|
4086
|
+
const A = n - b, $ = -n / 2 + b / 2 + c * A, O = $ - -n / 2;
|
|
4036
4087
|
if (O > 0) {
|
|
4037
4088
|
const Q = this.createCanvasFill(t, m, n, g);
|
|
4038
4089
|
Q && (t.fillStyle = Q, t.strokeStyle = Q), d === "Line" ? (t.lineWidth = g, t.beginPath(), t.moveTo(-n / 2, 0), t.lineTo($, 0), t.stroke()) : d === "Rectangle" && (t.beginPath(), this.drawRoundRect(t, -n / 2, -g / 2, O, g, f), t.fill());
|
|
4039
4090
|
}
|
|
4040
4091
|
t.save(), t.translate($, 0);
|
|
4041
|
-
const
|
|
4092
|
+
const z = t.getTransform(), H = Math.sqrt(z.a * z.a + z.b * z.b) || 1;
|
|
4042
4093
|
t.shadowColor = "rgba(0,0,0,0.2)", t.shadowBlur = 4 * H, t.shadowOffsetY = 1 * H;
|
|
4043
4094
|
const et = this.createCanvasFill(t, I, b, C);
|
|
4044
|
-
if (et && (t.fillStyle = et), L(v, 0, 0, b, C, S, v === "Icon" ?
|
|
4045
|
-
t.save(), t.translate($ +
|
|
4095
|
+
if (et && (t.fillStyle = et), L(v, 0, 0, b, C, S, v === "Icon" ? M : w), t.restore(), P) {
|
|
4096
|
+
t.save(), t.translate($ + k, _);
|
|
4046
4097
|
const Q = Math.round(a).toString();
|
|
4047
4098
|
t.font = "10px Inter, sans-serif";
|
|
4048
4099
|
const it = t.measureText(Q), dt = 6, St = 4, ht = it.width + dt * 2, mt = 14 + St;
|
|
4049
4100
|
t.beginPath(), this.drawRoundRect(t, -ht / 2, -mt / 2, ht, mt, 4), t.fillStyle = T, t.fill(), t.fillStyle = W, t.textAlign = "center", t.textBaseline = "middle", t.fillText(Q, 0, 0), t.restore();
|
|
4050
4101
|
}
|
|
4051
|
-
const
|
|
4052
|
-
if (
|
|
4053
|
-
const Q =
|
|
4102
|
+
const E = i.label || {}, F = i.helperText || {}, q = i.fontFamily || "Inter";
|
|
4103
|
+
if (E.visible !== !1) {
|
|
4104
|
+
const Q = E.text || "Label", it = E.fontSize || 12, dt = E.color || "rgba(156, 163, 175, 1)", St = E.offset ?? 8;
|
|
4054
4105
|
t.font = `600 ${it}px "${q}", sans-serif`, t.fillStyle = dt, t.textAlign = "left", t.textBaseline = "bottom";
|
|
4055
4106
|
const ht = -(n / 2), mt = -(g / 2) - St;
|
|
4056
4107
|
t.fillText(Q, ht, mt);
|
|
@@ -4081,9 +4132,9 @@ class li {
|
|
|
4081
4132
|
if (t.rotate(x * Math.PI / 180), t.strokeStyle = S, t.fillStyle = S, t.lineWidth = 1.5, t.lineCap = "round", t.lineJoin = "round", b === "chevron")
|
|
4082
4133
|
t.beginPath(), t.moveTo(-C / 2, -C * 0.2), t.lineTo(0, C * 0.2), t.lineTo(C / 2, -C * 0.2), t.stroke();
|
|
4083
4134
|
else if (b === "custom" || b === "path") {
|
|
4084
|
-
const
|
|
4085
|
-
if (
|
|
4086
|
-
const $ = new Path2D(
|
|
4135
|
+
const A = g && e.openIconPath || e.closedIconPath;
|
|
4136
|
+
if (A) {
|
|
4137
|
+
const $ = new Path2D(A);
|
|
4087
4138
|
t.save();
|
|
4088
4139
|
const O = C / 24;
|
|
4089
4140
|
t.scale(O, O), t.translate(-12, -12), t.fill($), t.restore();
|
|
@@ -4091,28 +4142,28 @@ class li {
|
|
|
4091
4142
|
}
|
|
4092
4143
|
t.restore();
|
|
4093
4144
|
}
|
|
4094
|
-
const I = e.selectedOption || e.placeholder || "Select...", w = e.fontSize || 14,
|
|
4095
|
-
t.font = `${
|
|
4145
|
+
const I = e.selectedOption || e.placeholder || "Select...", w = e.fontSize || 14, M = e.fontWeight || 400, P = e.fontFamily || "Inter, sans-serif";
|
|
4146
|
+
t.font = `${M} ${w}px ${P}`;
|
|
4096
4147
|
const T = h ? e.disabledColor || "#9ca3af" : !e.selectedOption && e.placeholder ? "#9ca3af" : u;
|
|
4097
4148
|
t.fillStyle = this.createCanvasFill(t, typeof T == "string" ? { type: "Solid", color: T } : T, i, n) || "#333333", t.textAlign = "left", t.textBaseline = "middle";
|
|
4098
|
-
const W = b === "none" ? 0 : C + 8,
|
|
4099
|
-
if (t.save(), t.beginPath(), t.rect(a + v, r,
|
|
4100
|
-
const L = r + n + 4, x = e.optionsList || [],
|
|
4149
|
+
const W = b === "none" ? 0 : C + 8, k = i - v * 2 - W;
|
|
4150
|
+
if (t.save(), t.beginPath(), t.rect(a + v, r, k, n), t.clip(), t.fillText(I, a + v, 0), t.restore(), g && !h) {
|
|
4151
|
+
const L = r + n + 4, x = e.optionsList || [], A = e.itemHeight || 32, $ = e.listPadding ?? 4, O = x.length * A + $ * 2, z = e.listCornerRadius ?? l;
|
|
4101
4152
|
t.save();
|
|
4102
|
-
const H = e.listShadow || {}, et = t.getTransform(),
|
|
4103
|
-
t.shadowColor = typeof H.color == "string" ? H.color : ((_ = H.color) == null ? void 0 : _.color) || "rgba(0,0,0,0.15)", t.shadowBlur = (H.blur ?? 12) *
|
|
4153
|
+
const H = e.listShadow || {}, et = t.getTransform(), E = Math.sqrt(et.a * et.a + et.b * et.b) || 1;
|
|
4154
|
+
t.shadowColor = typeof H.color == "string" ? H.color : ((_ = H.color) == null ? void 0 : _.color) || "rgba(0,0,0,0.15)", t.shadowBlur = (H.blur ?? 12) * E, t.shadowOffsetY = (H.offsetY ?? 6) * E, t.shadowOffsetX = (H.offsetX ?? 0) * E, t.beginPath(), this.drawRoundRect(t, a, L, i, O, z), t.fillStyle = this.createCanvasFill(t, typeof e.listBackgroundColor == "string" ? { type: "Solid", color: e.listBackgroundColor } : e.listBackgroundColor || { type: "Solid", color: "#ffffff" }, i, O) || "#ffffff", t.fill();
|
|
4104
4155
|
const F = e.listBorderWidth ?? 1;
|
|
4105
4156
|
F > 0 && (t.shadowColor = "transparent", t.strokeStyle = this.createCanvasFill(t, typeof e.listBorderColor == "string" ? { type: "Solid", color: e.listBorderColor } : e.listBorderColor || { type: "Solid", color: d }, i, O) || "#e5e7eb", t.lineWidth = F, t.stroke()), t.restore();
|
|
4106
|
-
const q = e.itemFontSize || w, Q = e.itemFontFamily ||
|
|
4107
|
-
t.font = `${
|
|
4108
|
-
const St = L + $ + dt *
|
|
4157
|
+
const q = e.itemFontSize || w, Q = e.itemFontFamily || P;
|
|
4158
|
+
t.font = `${M} ${q}px ${Q}`, x.forEach((it, dt) => {
|
|
4159
|
+
const St = L + $ + dt * A;
|
|
4109
4160
|
if (it === e.selectedOption)
|
|
4110
|
-
t.fillStyle = this.createCanvasFill(t, typeof e.itemSelectedBackgroundColor == "string" ? { type: "Solid", color: e.itemSelectedBackgroundColor } : e.itemSelectedBackgroundColor || { type: "Solid", color: "#f3f4f6" }, i,
|
|
4161
|
+
t.fillStyle = this.createCanvasFill(t, typeof e.itemSelectedBackgroundColor == "string" ? { type: "Solid", color: e.itemSelectedBackgroundColor } : e.itemSelectedBackgroundColor || { type: "Solid", color: "#f3f4f6" }, i, A) || "#f3f4f6", t.fillRect(a + F, St, i - F * 2, A), t.fillStyle = e.itemSelectedColor || e.accentColor || u || "#374151";
|
|
4111
4162
|
else if (t.fillStyle = e.listTextColor || u || "#333333", this.activeDropdownId === s.id && this._lastPointerPos) {
|
|
4112
|
-
const mt = this._lastPointerPos.y - (L + $), rt = Math.floor(mt /
|
|
4113
|
-
dt === rt && (t.fillStyle = this.createCanvasFill(t, typeof e.itemHoverBackgroundColor == "string" ? { type: "Solid", color: e.itemHoverBackgroundColor } : e.itemHoverBackgroundColor || { type: "Solid", color: "#f9fafb" }, i,
|
|
4163
|
+
const mt = this._lastPointerPos.y - (L + $), rt = Math.floor(mt / A);
|
|
4164
|
+
dt === rt && (t.fillStyle = this.createCanvasFill(t, typeof e.itemHoverBackgroundColor == "string" ? { type: "Solid", color: e.itemHoverBackgroundColor } : e.itemHoverBackgroundColor || { type: "Solid", color: "#f9fafb" }, i, A) || "#f9fafb", t.fillRect(a + F, St, i - F * 2, A), t.fillStyle = e.itemHoverColor || u);
|
|
4114
4165
|
}
|
|
4115
|
-
t.fillText(it, a + v, St +
|
|
4166
|
+
t.fillText(it, a + v, St + A / 2);
|
|
4116
4167
|
});
|
|
4117
4168
|
}
|
|
4118
4169
|
t.globalAlpha = m;
|
|
@@ -4126,14 +4177,14 @@ class li {
|
|
|
4126
4177
|
t.save(), t.scale(C, C), t.beginPath(), this.drawRoundRect(t, S, I, n, a, y);
|
|
4127
4178
|
const w = this.createCanvasFill(t, d, n, a);
|
|
4128
4179
|
w && (t.fillStyle = w, t.fill()), (b > 0 || r && c.borderColor) && (t.strokeStyle = v, t.lineWidth = b || (r ? 1 : 0), t.stroke());
|
|
4129
|
-
const
|
|
4130
|
-
t.font = `${T} ${
|
|
4180
|
+
const M = h.fontSize || 14, P = h.fontFamily || "Inter", T = h.fontWeight || 600;
|
|
4181
|
+
t.font = `${T} ${M}px "${P}", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`, t.fillStyle = u, t.textAlign = "center", t.textBaseline = "middle";
|
|
4131
4182
|
let W = 0;
|
|
4132
4183
|
if (f.enabled && f.svgPath) {
|
|
4133
|
-
const
|
|
4134
|
-
W = f.position === "left" ?
|
|
4135
|
-
const O = new Path2D(f.svgPath),
|
|
4136
|
-
t.scale(
|
|
4184
|
+
const k = M * 1.1, _ = f.gap || 8, L = t.measureText(m), A = -(L.width + k + _) / 2, $ = f.position === "left" ? A + k / 2 : A + L.width + _ + k / 2;
|
|
4185
|
+
W = f.position === "left" ? A + k + _ + L.width / 2 : A + L.width / 2, t.save(), t.translate($, 0);
|
|
4186
|
+
const O = new Path2D(f.svgPath), z = k / 24;
|
|
4187
|
+
t.scale(z, z), t.translate(-12, -12), t.fillStyle = u, t.fill(O), t.restore();
|
|
4137
4188
|
}
|
|
4138
4189
|
t.fillText(m, W, 0), t.restore();
|
|
4139
4190
|
}
|
|
@@ -4145,8 +4196,8 @@ class li {
|
|
|
4145
4196
|
t.font = `${c.fontWeight || 600} ${d}px "${u}", sans-serif`, t.fillStyle = f, t.textAlign = "center", t.textBaseline = "middle", t.fillText(c.text || "Toggle", 0, 0), t.restore();
|
|
4146
4197
|
}
|
|
4147
4198
|
renderToggle(t, s) {
|
|
4148
|
-
var
|
|
4149
|
-
const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.options) || s.options || {}, i = ((
|
|
4199
|
+
var z, H, et, E, F, q, Q, it, dt, St, ht, mt;
|
|
4200
|
+
const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.options) || s.options || {}, i = ((z = s.geometry) == null ? void 0 : z.width) || 52, n = ((H = s.geometry) == null ? void 0 : H.height) || 30, a = -i / 2, r = -n / 2, l = e.checked ?? !1, h = e.cornerRadius ?? e.corner_radius ?? n / 2, c = e.toggleStyle || {}, g = c.backgroundColor || e.activeColor || "#10b981", f = c.borderColor || e.borderColor || "transparent", d = c.borderWidth ?? e.borderWidth ?? 0, u = c.knobColor || e.knobColor || "#ffffff", m = l ? g : e.inactiveColor || "#374151", y = l ? f : e.borderColor || "transparent", v = l ? d : e.borderWidth ?? 0, b = l ? u : e.knobColor || "#ffffff";
|
|
4150
4201
|
e.disabled && (t.globalAlpha *= 0.5), t.beginPath(), this.drawRoundRect(t, a, r, i, n, h);
|
|
4151
4202
|
const C = this.createCanvasFill(t, m, i, n);
|
|
4152
4203
|
if (C && (t.fillStyle = C, t.fill()), v > 0) {
|
|
@@ -4154,15 +4205,15 @@ class li {
|
|
|
4154
4205
|
const rt = this.createCanvasFill(t, y, i, n);
|
|
4155
4206
|
rt && (t.strokeStyle = rt, t.stroke());
|
|
4156
4207
|
}
|
|
4157
|
-
const S = 2, I = n - S * 2, w = I / 2,
|
|
4208
|
+
const S = 2, I = n - S * 2, w = I / 2, M = a + S, P = a + i - S - I, T = l ? P : M, W = r + S;
|
|
4158
4209
|
t.beginPath(), t.arc(T + w, W + w, w, 0, Math.PI * 2);
|
|
4159
|
-
const
|
|
4160
|
-
|
|
4210
|
+
const k = this.createCanvasFill(t, b, I, I);
|
|
4211
|
+
k && (t.fillStyle = k, t.fill()), e.disabled && (t.globalAlpha *= 2);
|
|
4161
4212
|
let _ = !1, L = !1;
|
|
4162
|
-
const x = (l ? (et = c.leftLabel) == null ? void 0 : et.text : null) || ((
|
|
4213
|
+
const x = (l ? (et = c.leftLabel) == null ? void 0 : et.text : null) || ((E = e.leftLabel) == null ? void 0 : E.text) || "", A = (l ? (F = c.leftLabel) == null ? void 0 : F.color : null) || ((q = e.leftLabel) == null ? void 0 : q.color) || "#f3f4f6";
|
|
4163
4214
|
if ((Q = e.leftLabel) != null && Q.enabled && x) {
|
|
4164
4215
|
const rt = e.leftLabel;
|
|
4165
|
-
t.font = `${rt.fontWeight || 400} ${rt.fontSize || 12}px "${rt.fontFamily || "Inter"}", sans-serif`, t.fillStyle =
|
|
4216
|
+
t.font = `${rt.fontWeight || 400} ${rt.fontSize || 12}px "${rt.fontFamily || "Inter"}", sans-serif`, t.fillStyle = A, t.textBaseline = "middle", t.textAlign = "right", t.fillText(x, a - (rt.gap || 8), 0), _ = !0;
|
|
4166
4217
|
}
|
|
4167
4218
|
const $ = (l ? (it = c.rightLabel) == null ? void 0 : it.text : null) || ((dt = e.rightLabel) == null ? void 0 : dt.text) || "", O = (l ? (St = c.rightLabel) == null ? void 0 : St.color : null) || ((ht = e.rightLabel) == null ? void 0 : ht.color) || "#f3f4f6";
|
|
4168
4219
|
if ((mt = e.rightLabel) != null && mt.enabled && $) {
|
|
@@ -4195,15 +4246,15 @@ class li {
|
|
|
4195
4246
|
t.save(), t.beginPath();
|
|
4196
4247
|
const I = this.createCanvasFill(t, f, i, n);
|
|
4197
4248
|
t.strokeStyle = I || f, t.lineWidth = Math.max(2, i * 0.12), t.lineCap = "round", t.lineJoin = "round";
|
|
4198
|
-
const w = a + i * 0.25,
|
|
4199
|
-
t.moveTo(w,
|
|
4249
|
+
const w = a + i * 0.25, M = r + n * 0.5, P = a + i * 0.45, T = r + n * 0.7, W = a + i * 0.75, k = r + n * 0.25;
|
|
4250
|
+
t.moveTo(w, M), t.lineTo(P, T), t.lineTo(W, k), t.stroke(), t.restore();
|
|
4200
4251
|
}
|
|
4201
4252
|
if (e.disabled && (t.globalAlpha *= 2), e.label && e.label.text) {
|
|
4202
4253
|
const I = e.label;
|
|
4203
4254
|
t.save(), t.font = `${I.fontWeight || 400} ${I.fontSize || 14}px "${I.fontFamily || "Inter"}", sans-serif`, t.fillStyle = I.color || "#f3f4f6", t.textBaseline = "middle";
|
|
4204
4255
|
const w = I.gap || 8;
|
|
4205
|
-
let
|
|
4206
|
-
I.position === "left" ? (t.textAlign = "right",
|
|
4256
|
+
let M = 0, P = 0;
|
|
4257
|
+
I.position === "left" ? (t.textAlign = "right", M = a - w, P = 0) : I.position === "right" ? (t.textAlign = "left", M = a + i + w, P = 0) : I.position === "top" ? (t.textAlign = "center", M = 0, P = r - w, t.textBaseline = "bottom") : I.position === "bottom" && (t.textAlign = "center", M = 0, P = r + n + w, t.textBaseline = "top"), t.fillText(I.text, M, P), t.restore();
|
|
4207
4258
|
}
|
|
4208
4259
|
}
|
|
4209
4260
|
renderRadioGroup(t, s) {
|
|
@@ -4213,27 +4264,27 @@ class li {
|
|
|
4213
4264
|
const b = 8, C = b * 2;
|
|
4214
4265
|
if (t.save(), t.font = `${v} ${m}px "${y}", sans-serif`, t.textBaseline = "middle", t.textAlign = "left", c === "vertical") {
|
|
4215
4266
|
const w = Math.max(C, m) + g;
|
|
4216
|
-
h.forEach((
|
|
4217
|
-
const T = r +
|
|
4267
|
+
h.forEach((M, P) => {
|
|
4268
|
+
const T = r + P * w + b;
|
|
4218
4269
|
t.beginPath(), t.arc(a + b, T, b, 0, Math.PI * 2);
|
|
4219
|
-
const W = l ===
|
|
4220
|
-
W ? (t.strokeStyle =
|
|
4270
|
+
const W = l === M, k = this.createCanvasFill(t, f, C, C), _ = this.createCanvasFill(t, d, C, C);
|
|
4271
|
+
W ? (t.strokeStyle = k || f, t.lineWidth = 2, t.stroke(), t.beginPath(), t.arc(a + b, T, b / 2, 0, Math.PI * 2), t.fillStyle = k || f, t.fill()) : (t.strokeStyle = _ || d, t.lineWidth = 1.5, t.stroke()), t.fillStyle = u, t.fillText(M, a + C + 8, T);
|
|
4221
4272
|
});
|
|
4222
4273
|
} else {
|
|
4223
4274
|
let w = a;
|
|
4224
|
-
h.forEach((
|
|
4225
|
-
const
|
|
4275
|
+
h.forEach((M) => {
|
|
4276
|
+
const P = l === M, T = t.measureText(M).width;
|
|
4226
4277
|
t.beginPath(), t.arc(w + b, 0, b, 0, Math.PI * 2);
|
|
4227
|
-
const W = this.createCanvasFill(t, f, C, C),
|
|
4228
|
-
|
|
4278
|
+
const W = this.createCanvasFill(t, f, C, C), k = this.createCanvasFill(t, d, C, C);
|
|
4279
|
+
P ? (t.strokeStyle = W || f, t.lineWidth = 2, t.stroke(), t.beginPath(), t.arc(w + b, 0, b / 2, 0, Math.PI * 2), t.fillStyle = W || f, t.fill()) : (t.strokeStyle = k || d, t.lineWidth = 1.5, t.stroke()), t.fillStyle = u, t.fillText(M, w + C + 6, 0), w += C + 6 + T + g;
|
|
4229
4280
|
});
|
|
4230
4281
|
}
|
|
4231
4282
|
if (t.restore(), e.disabled && (t.globalAlpha *= 2), e.label && e.label.text) {
|
|
4232
4283
|
const w = e.label;
|
|
4233
4284
|
t.save(), t.font = `${w.fontWeight || 400} ${w.fontSize || 14}px "${w.fontFamily || "Inter"}", sans-serif`, t.fillStyle = w.color || "#9ca3af", t.textBaseline = "middle";
|
|
4234
|
-
const
|
|
4235
|
-
let
|
|
4236
|
-
w.position === "left" ? (t.textAlign = "right",
|
|
4285
|
+
const M = w.gap || 8;
|
|
4286
|
+
let P = 0, T = 0;
|
|
4287
|
+
w.position === "left" ? (t.textAlign = "right", P = a - M, T = 0) : w.position === "right" ? (t.textAlign = "left", P = a + i + M, T = 0) : w.position === "top" ? (t.textAlign = "center", P = 0, T = r - M, t.textBaseline = "bottom") : w.position === "bottom" && (t.textAlign = "center", P = 0, T = r + n + M, t.textBaseline = "top"), t.fillText(w.text, P, T), t.restore();
|
|
4237
4288
|
}
|
|
4238
4289
|
}
|
|
4239
4290
|
renderBarChart(t, s) {
|
|
@@ -4269,21 +4320,21 @@ class li {
|
|
|
4269
4320
|
_getPreset: function() {
|
|
4270
4321
|
return fs[this.stylePreset] || fs.default;
|
|
4271
4322
|
},
|
|
4272
|
-
_resolveColor: function(
|
|
4323
|
+
_resolveColor: function(k, _) {
|
|
4273
4324
|
const L = this._getPreset();
|
|
4274
|
-
return ["#6366f1", "#f59e0b", "#10b981", "#3b82f6", "#a855f7"].includes(
|
|
4325
|
+
return ["#6366f1", "#f59e0b", "#10b981", "#3b82f6", "#a855f7"].includes(k) ? L.colors[_ % L.colors.length] : typeof k == "string" ? k : L.colors[_ % L.colors.length];
|
|
4275
4326
|
},
|
|
4276
|
-
_makeGradient: function(
|
|
4327
|
+
_makeGradient: function(k, _, L, x, A, $) {
|
|
4277
4328
|
if (!this._getPreset().barGradient && !this.barGradient) return _;
|
|
4278
|
-
const
|
|
4279
|
-
return
|
|
4329
|
+
const z = k.createLinearGradient(L, x, A, $);
|
|
4330
|
+
return z.addColorStop(0, _), z.addColorStop(1, _ + "44"), z;
|
|
4280
4331
|
},
|
|
4281
|
-
_drawRoundedBar: function(
|
|
4282
|
-
if ($ = Math.min($, Math.min(Math.abs(x), Math.abs(
|
|
4283
|
-
|
|
4332
|
+
_drawRoundedBar: function(k, _, L, x, A, $, O) {
|
|
4333
|
+
if ($ = Math.min($, Math.min(Math.abs(x), Math.abs(A)) / 2), $ <= 0 || x === 0 || A === 0) {
|
|
4334
|
+
k.rect(_, L, x, A);
|
|
4284
4335
|
return;
|
|
4285
4336
|
}
|
|
4286
|
-
|
|
4337
|
+
k.beginPath(), O ? (k.moveTo(_, L + A), k.lineTo(_, L + $), k.quadraticCurveTo(_, L, _ + $, L), k.lineTo(_ + x - $, L), k.quadraticCurveTo(_ + x, L, _ + x, L + $), k.lineTo(_ + x, L + A), k.lineTo(_, L + A)) : (k.moveTo(_, L), k.lineTo(_ + x - $, L), k.quadraticCurveTo(_ + x, L, _ + x, L + $), k.lineTo(_ + x, L + A - $), k.quadraticCurveTo(_ + x, L + A, _ + x - $, L + A), k.lineTo(_, L + A), k.lineTo(_, L)), k.closePath();
|
|
4287
4338
|
}
|
|
4288
4339
|
}, n = i.width, a = i.height, r = -n / 2, l = -a / 2;
|
|
4289
4340
|
if (!i.datasets || i.datasets.length === 0 || i.categories.length === 0) {
|
|
@@ -4294,74 +4345,74 @@ class li {
|
|
|
4294
4345
|
let c = -1 / 0, g = 1 / 0;
|
|
4295
4346
|
const f = i.categories.length, d = i.datasets.length;
|
|
4296
4347
|
if (i.chartType === "stacked")
|
|
4297
|
-
for (let
|
|
4348
|
+
for (let k = 0; k < f; k++) {
|
|
4298
4349
|
let _ = 0, L = 0;
|
|
4299
4350
|
i.datasets.forEach((x) => {
|
|
4300
|
-
const
|
|
4301
|
-
|
|
4351
|
+
const A = x.data[k] ?? 0;
|
|
4352
|
+
A >= 0 ? _ += A : L += A;
|
|
4302
4353
|
}), _ > c && (c = _), L < g && (g = L);
|
|
4303
4354
|
}
|
|
4304
4355
|
else
|
|
4305
|
-
i.datasets.forEach((
|
|
4306
|
-
|
|
4356
|
+
i.datasets.forEach((k) => {
|
|
4357
|
+
k.data && k.data.forEach((_) => {
|
|
4307
4358
|
_ > c && (c = _), _ < g && (g = _);
|
|
4308
4359
|
});
|
|
4309
4360
|
});
|
|
4310
4361
|
isFinite(c) || (c = 10), isFinite(g) || (g = 0), c = Math.max(c, 0), g = Math.min(g, 0);
|
|
4311
4362
|
const u = c - g || 10;
|
|
4312
4363
|
t.save(), t.font = `${i.axisLabelFontSize}px Inter, sans-serif`;
|
|
4313
|
-
const m = i.showYLabels ? t.measureText(c.toFixed(0)).width + 14 : 10, y = i.showXLabels ? i.axisLabelFontSize + 12 : 8, b = (i.showLegend && d > 0 ? i.legendFontSize + 10 : 0) + 8, C = 10, S = r + m, I = l + b, w = n - m - C,
|
|
4364
|
+
const m = i.showYLabels ? t.measureText(c.toFixed(0)).width + 14 : 10, y = i.showXLabels ? i.axisLabelFontSize + 12 : 8, b = (i.showLegend && d > 0 ? i.legendFontSize + 10 : 0) + 8, C = 10, S = r + m, I = l + b, w = n - m - C, M = a - b - y;
|
|
4314
4365
|
if (t.beginPath(), t.roundRect(r, l, n, a, 10), t.fillStyle = h.cardBackground, t.fill(), t.strokeStyle = h.cardBorderColor, t.lineWidth = 1, t.stroke(), i.showLegend && d > 0) {
|
|
4315
4366
|
t.font = `${i.legendFontSize}px Inter, sans-serif`, t.textBaseline = "middle";
|
|
4316
|
-
const
|
|
4367
|
+
const k = l + 12;
|
|
4317
4368
|
let _ = S;
|
|
4318
4369
|
i.datasets.forEach((L, x) => {
|
|
4319
|
-
const
|
|
4320
|
-
t.beginPath(), t.roundRect(_,
|
|
4370
|
+
const A = i._resolveColor(L.color, x), $ = L.label || `Series ${x + 1}`, O = 7;
|
|
4371
|
+
t.beginPath(), t.roundRect(_, k - O / 2, O, O, 2), t.fillStyle = A, t.fill(), t.fillStyle = h.legendColor, t.textAlign = "left", t.fillText($, _ + O + 4, k), _ += t.measureText($).width + O + 16;
|
|
4321
4372
|
});
|
|
4322
4373
|
}
|
|
4323
|
-
const
|
|
4374
|
+
const P = 4;
|
|
4324
4375
|
if (i.showGridLines) {
|
|
4325
4376
|
t.setLineDash([3, 4]), t.lineWidth = 1, t.strokeStyle = h.gridColor;
|
|
4326
|
-
for (let
|
|
4327
|
-
const _ = I +
|
|
4377
|
+
for (let k = 0; k <= P; k++) {
|
|
4378
|
+
const _ = I + k / P * M;
|
|
4328
4379
|
t.beginPath(), t.moveTo(S, _), t.lineTo(S + w, _), t.stroke();
|
|
4329
4380
|
}
|
|
4330
4381
|
t.setLineDash([]);
|
|
4331
4382
|
}
|
|
4332
4383
|
if (i.showYLabels) {
|
|
4333
4384
|
t.font = `${i.axisLabelFontSize}px Inter, sans-serif`, t.textAlign = "right", t.textBaseline = "middle", t.fillStyle = h.axisLabelColor;
|
|
4334
|
-
for (let
|
|
4335
|
-
const _ = c -
|
|
4385
|
+
for (let k = 0; k <= P; k++) {
|
|
4386
|
+
const _ = c - k / P * u, L = I + k / P * M;
|
|
4336
4387
|
t.fillText(_.toFixed(0), S - 6, L);
|
|
4337
4388
|
}
|
|
4338
4389
|
}
|
|
4339
|
-
if (t.lineWidth = 1, t.setLineDash([]), i.showXAxis && (t.strokeStyle = i.xAxisColor, t.beginPath(), t.moveTo(S, I +
|
|
4340
|
-
const
|
|
4390
|
+
if (t.lineWidth = 1, t.setLineDash([]), i.showXAxis && (t.strokeStyle = i.xAxisColor, t.beginPath(), t.moveTo(S, I + M), t.lineTo(S + w, I + M), t.stroke()), i.showYAxis && (t.strokeStyle = i.yAxisColor, t.beginPath(), t.moveTo(S, I), t.lineTo(S, I + M), t.stroke()), i.chartType === "stacked") {
|
|
4391
|
+
const k = w / f;
|
|
4341
4392
|
for (let _ = 0; _ < f; _++) {
|
|
4342
|
-
const L = S + _ *
|
|
4343
|
-
i.showXLabels && (t.font = `${i.axisLabelFontSize}px Inter, sans-serif`, t.textAlign = "center", t.textBaseline = "top", t.fillStyle = h.axisLabelColor, t.fillText(i.categories[_] || "", L, I +
|
|
4344
|
-
let x = I +
|
|
4345
|
-
i.datasets.forEach((
|
|
4346
|
-
const O =
|
|
4393
|
+
const L = S + _ * k + k / 2;
|
|
4394
|
+
i.showXLabels && (t.font = `${i.axisLabelFontSize}px Inter, sans-serif`, t.textAlign = "center", t.textBaseline = "top", t.fillStyle = h.axisLabelColor, t.fillText(i.categories[_] || "", L, I + M + 5));
|
|
4395
|
+
let x = I + M;
|
|
4396
|
+
i.datasets.forEach((A, $) => {
|
|
4397
|
+
const O = A.data[_] ?? 0;
|
|
4347
4398
|
if (O === 0) return;
|
|
4348
|
-
const
|
|
4349
|
-
x -=
|
|
4350
|
-
const F = i._resolveColor(
|
|
4351
|
-
t.beginPath(), t.fillStyle = i._makeGradient(t, F, et,
|
|
4399
|
+
const z = O / u * M, H = Math.min(i.barWidth * d + i.barGap, k - 8), et = L - H / 2, E = x - z;
|
|
4400
|
+
x -= z;
|
|
4401
|
+
const F = i._resolveColor(A.color, $);
|
|
4402
|
+
t.beginPath(), t.fillStyle = i._makeGradient(t, F, et, E, et, E + z), i._drawRoundedBar(t, et, E, H, z, $ === d - 1 ? i.barCornerRadius : 0, !0), t.fill();
|
|
4352
4403
|
});
|
|
4353
4404
|
}
|
|
4354
4405
|
} else {
|
|
4355
|
-
const
|
|
4406
|
+
const k = w / f, _ = d * i.barWidth + Math.max(0, (d - 1) * i.barGap), L = I + M - (0 - g) / u * M;
|
|
4356
4407
|
for (let x = 0; x < f; x++) {
|
|
4357
|
-
const
|
|
4358
|
-
i.showXLabels && (t.font = `${i.axisLabelFontSize}px Inter, sans-serif`, t.textAlign = "center", t.textBaseline = "top", t.fillStyle = h.axisLabelColor, t.fillText(i.categories[x] || "",
|
|
4359
|
-
const $ =
|
|
4360
|
-
i.datasets.forEach((O,
|
|
4361
|
-
const H = O.data[x] ?? 0, et = Math.abs(H / u *
|
|
4408
|
+
const A = S + x * k + k / 2;
|
|
4409
|
+
i.showXLabels && (t.font = `${i.axisLabelFontSize}px Inter, sans-serif`, t.textAlign = "center", t.textBaseline = "top", t.fillStyle = h.axisLabelColor, t.fillText(i.categories[x] || "", A, I + M + 5));
|
|
4410
|
+
const $ = A - _ / 2;
|
|
4411
|
+
i.datasets.forEach((O, z) => {
|
|
4412
|
+
const H = O.data[x] ?? 0, et = Math.abs(H / u * M);
|
|
4362
4413
|
if (et < 1) return;
|
|
4363
|
-
const
|
|
4364
|
-
t.beginPath(), t.fillStyle = i._makeGradient(t, q,
|
|
4414
|
+
const E = $ + z * (i.barWidth + i.barGap), F = H >= 0 ? L - et : L, q = i._resolveColor(O.color, z);
|
|
4415
|
+
t.beginPath(), t.fillStyle = i._makeGradient(t, q, E, F, E, F + et), i._drawRoundedBar(t, E, F, i.barWidth, et, i.barCornerRadius, !0), t.fill(), i.showValueOnTop && H !== 0 && (t.font = `bold ${i.axisLabelFontSize}px Inter, sans-serif`, t.textAlign = "center", t.textBaseline = "bottom", t.fillStyle = q, t.fillText(H.toString(), E + i.barWidth / 2, F - 2));
|
|
4365
4416
|
});
|
|
4366
4417
|
}
|
|
4367
4418
|
}
|
|
@@ -4412,9 +4463,9 @@ class li {
|
|
|
4412
4463
|
i.slices.forEach((S, I) => {
|
|
4413
4464
|
const w = S.value || 0;
|
|
4414
4465
|
if (w === 0) return;
|
|
4415
|
-
const
|
|
4416
|
-
if (t.beginPath(), t.moveTo(d, u), t.arc(d, u,
|
|
4417
|
-
const
|
|
4466
|
+
const M = w / v * f, P = -Math.PI / 2 + I * b + C / 2, T = P + b - C, W = i._resolveSliceColor(S, I);
|
|
4467
|
+
if (t.beginPath(), t.moveTo(d, u), t.arc(d, u, M, P, T), t.closePath(), t.fillStyle = W + "cc", t.fill(), t.strokeStyle = W, t.lineWidth = 1.5, t.stroke(), i.showLabels) {
|
|
4468
|
+
const k = P + (T - P) / 2, _ = d + M * 0.65 * Math.cos(k), L = u + M * 0.65 * Math.sin(k), x = Math.round(w / r * 100);
|
|
4418
4469
|
t.save(), t.font = `bold ${i.labelFontSize}px Inter, sans-serif`, t.fillStyle = l.labelColor, t.textAlign = "center", t.textBaseline = "middle", t.fillText(`${x}%`, _, L), t.restore();
|
|
4419
4470
|
}
|
|
4420
4471
|
});
|
|
@@ -4422,52 +4473,52 @@ class li {
|
|
|
4422
4473
|
const v = i.chartType === "pie" ? 0 : i.innerRadius, b = f * Math.max(0, v), C = f > 0 ? i.sliceGap / f : 0;
|
|
4423
4474
|
let S = -Math.PI / 2;
|
|
4424
4475
|
if (i.slices.forEach((I, w) => {
|
|
4425
|
-
const
|
|
4426
|
-
if (
|
|
4427
|
-
S +=
|
|
4476
|
+
const M = I.value || 0;
|
|
4477
|
+
if (M === 0) {
|
|
4478
|
+
S += M / r * Math.PI * 2;
|
|
4428
4479
|
return;
|
|
4429
4480
|
}
|
|
4430
|
-
const
|
|
4481
|
+
const P = M / r * Math.PI * 2, T = S + C / 2, W = S + P - C / 2;
|
|
4431
4482
|
if (W <= T) {
|
|
4432
|
-
S +=
|
|
4483
|
+
S += P;
|
|
4433
4484
|
return;
|
|
4434
4485
|
}
|
|
4435
|
-
const
|
|
4436
|
-
if (t.beginPath(), t.fillStyle =
|
|
4437
|
-
const _ = T + (W - T) / 2, L = b + (f - b) / 2, x = d + L * Math.cos(_),
|
|
4438
|
-
t.save(), t.font = `bold ${i.labelFontSize}px Inter, sans-serif`, t.fillStyle = l.labelColor, t.textAlign = "center", t.textBaseline = "middle", t.fillText(`${$}%`, x,
|
|
4486
|
+
const k = i._resolveSliceColor(I, w);
|
|
4487
|
+
if (t.beginPath(), t.fillStyle = k, b <= 0 ? (t.moveTo(d, u), t.arc(d, u, f, T, W), t.lineTo(d, u)) : (t.moveTo(d + f * Math.cos(T), u + f * Math.sin(T)), t.arc(d, u, f, T, W), t.arc(d, u, b, W, T, !0), t.closePath()), t.fill(), i.showLabels) {
|
|
4488
|
+
const _ = T + (W - T) / 2, L = b + (f - b) / 2, x = d + L * Math.cos(_), A = u + L * Math.sin(_), $ = Math.round(M / r * 100);
|
|
4489
|
+
t.save(), t.font = `bold ${i.labelFontSize}px Inter, sans-serif`, t.fillStyle = l.labelColor, t.textAlign = "center", t.textBaseline = "middle", t.fillText(`${$}%`, x, A), t.restore();
|
|
4439
4490
|
}
|
|
4440
|
-
S +=
|
|
4491
|
+
S += P;
|
|
4441
4492
|
}), i.chartType === "donut" && i.showCenterText && b > 14) {
|
|
4442
|
-
const I = Math.round(r), w = Math.min(Math.floor(b * 0.52), 20),
|
|
4443
|
-
t.textAlign = "center", t.textBaseline = "middle", t.font = `bold ${w}px Inter, sans-serif`, t.fillStyle = l.centerTextColor, t.fillText(I.toString(), d, u -
|
|
4493
|
+
const I = Math.round(r), w = Math.min(Math.floor(b * 0.52), 20), M = Math.min(Math.floor(b * 0.26), 10);
|
|
4494
|
+
t.textAlign = "center", t.textBaseline = "middle", t.font = `bold ${w}px Inter, sans-serif`, t.fillStyle = l.centerTextColor, t.fillText(I.toString(), d, u - M * 0.5), i.centerLabel && (t.font = `${M}px Inter, sans-serif`, t.fillStyle = l.centerLabelColor, t.fillText(i.centerLabel, d, u + w * 0.6));
|
|
4444
4495
|
}
|
|
4445
4496
|
}
|
|
4446
4497
|
if (i.showLegend && i.slices.length > 0) {
|
|
4447
4498
|
t.font = `${i.legendFontSize}px Inter, sans-serif`;
|
|
4448
4499
|
const v = 2, b = n / v, C = i.legendFontSize + 8, S = a / 2 - c + 10, I = -n / 2 + 10;
|
|
4449
|
-
i.slices.forEach((w,
|
|
4450
|
-
const
|
|
4451
|
-
t.beginPath(), t.roundRect(W,
|
|
4452
|
-
const x = Math.round((w.value || 0) / r * 100),
|
|
4453
|
-
let O =
|
|
4500
|
+
i.slices.forEach((w, M) => {
|
|
4501
|
+
const P = M % v, T = Math.floor(M / v), W = I + P * b, k = S + T * C, _ = i._resolveSliceColor(w, M), L = 7;
|
|
4502
|
+
t.beginPath(), t.roundRect(W, k - L / 2, L, L, 2), t.fillStyle = _, t.fill(), t.textAlign = "left", t.textBaseline = "middle", t.fillStyle = l.legendColor;
|
|
4503
|
+
const x = Math.round((w.value || 0) / r * 100), A = `${w.label || "Item"} ${x}%`, $ = b - L - 20;
|
|
4504
|
+
let O = A;
|
|
4454
4505
|
for (; t.measureText(O).width > $ && O.length > 4; )
|
|
4455
4506
|
O = O.slice(0, -4) + "…";
|
|
4456
|
-
t.fillText(O, W + L + 4,
|
|
4507
|
+
t.fillText(O, W + L + 4, k);
|
|
4457
4508
|
});
|
|
4458
4509
|
}
|
|
4459
4510
|
t.restore();
|
|
4460
4511
|
}
|
|
4461
4512
|
getRadioGroupItemIndexAtPointer(t, s, o) {
|
|
4462
|
-
var
|
|
4513
|
+
var M, P;
|
|
4463
4514
|
const e = t.options || {}, i = this.objectStates.get(t.id) || {}, n = e.optionsList || [];
|
|
4464
4515
|
if (n.length === 0) return null;
|
|
4465
|
-
const a = i.width !== void 0 ? i.width : ((
|
|
4516
|
+
const a = i.width !== void 0 ? i.width : ((M = t.geometry) == null ? void 0 : M.width) || 180, r = i.height !== void 0 ? i.height : ((P = t.geometry) == null ? void 0 : P.height) || 100, l = e.orientation || "vertical", h = e.itemGap !== void 0 ? e.itemGap : 16, c = e.fontSize || 14, g = this.getWorldTransform(t.id), f = s - g.x, d = o - g.y, u = -g.rotation * (Math.PI / 180), m = Math.cos(u), y = Math.sin(u), v = f * m - d * y, b = f * y + d * m, S = 8 * 2, I = -a / 2, w = -r / 2;
|
|
4466
4517
|
if (l === "vertical") {
|
|
4467
4518
|
const T = Math.max(S, c) + h;
|
|
4468
4519
|
for (let W = 0; W < n.length; W++) {
|
|
4469
|
-
const
|
|
4470
|
-
if (v >= I && v <= I + a && b >=
|
|
4520
|
+
const k = w + W * T;
|
|
4521
|
+
if (v >= I && v <= I + a && b >= k && b <= k + T)
|
|
4471
4522
|
return W;
|
|
4472
4523
|
}
|
|
4473
4524
|
} else {
|
|
@@ -4543,8 +4594,8 @@ class li {
|
|
|
4543
4594
|
for (let v = 0; v < m.length - 1; v++) {
|
|
4544
4595
|
const b = m[v === 0 ? v : v - 1], C = m[v], S = m[v + 1], I = m[v + 1 === m.length - 1 ? v + 1 : v + 2];
|
|
4545
4596
|
for (let w = 1; w <= d; w++) {
|
|
4546
|
-
const
|
|
4547
|
-
t.lineTo(g(v +
|
|
4597
|
+
const M = w / d, P = this._catmullRom(b, C, S, I, M);
|
|
4598
|
+
t.lineTo(g(v + M), c(P));
|
|
4548
4599
|
}
|
|
4549
4600
|
}
|
|
4550
4601
|
else
|
|
@@ -4558,8 +4609,8 @@ class li {
|
|
|
4558
4609
|
for (let y = 0; y < m.length - 1; y++) {
|
|
4559
4610
|
const v = m[y === 0 ? y : y - 1], b = m[y], C = m[y + 1], S = m[y + 1 === m.length - 1 ? y + 1 : y + 2];
|
|
4560
4611
|
for (let I = 1; I <= d; I++) {
|
|
4561
|
-
const w = I / d,
|
|
4562
|
-
t.lineTo(g(y + w), c(
|
|
4612
|
+
const w = I / d, M = this._catmullRom(v, b, C, S, w);
|
|
4613
|
+
t.lineTo(g(y + w), c(M));
|
|
4563
4614
|
}
|
|
4564
4615
|
}
|
|
4565
4616
|
else
|
|
@@ -4685,52 +4736,52 @@ class li {
|
|
|
4685
4736
|
t.moveTo(s + r, o), t.lineTo(s + e - l, o), t.arcTo(s + e, o, s + e, o + l, l), t.lineTo(s + e, o + i - h), t.arcTo(s + e, o + i, s + e - h, o + i, h), t.lineTo(s + c, o + i), t.arcTo(s, o + i, s, o + i - c, c), t.lineTo(s, o + r), t.arcTo(s, o, s + r, o, r), t.closePath();
|
|
4686
4737
|
}
|
|
4687
4738
|
renderListView(t, s) {
|
|
4688
|
-
var L, x,
|
|
4689
|
-
const o = this.objectStates.get(s.id) || {}, e = o.options || s.options || {}, i = o.width !== void 0 ? o.width : ((L = s.geometry) == null ? void 0 : L.width) || 200, n = o.height !== void 0 ? o.height : ((x = s.geometry) == null ? void 0 : x.height) || 300, a = -i / 2, r = -n / 2, l = o.corner_radius !== void 0 ? o.corner_radius : e.corner_radius ?? 0, h = e.orientation || "vertical", c = e.items || [], g = e.itemGap ?? 10, f = e.itemHeight ?? 50, d = e.itemWidth ?? 200, u = e.scrollOffset ?? 0, m = e.padding ?? 0, y = e.glassEffect !== !1, v = e.accentColor || "#3b82f6", b = e.itemTextColor || "#333333", C = e.itemBackgroundColor || "#ffffff", S = e.hoveredIndex ?? null, I = e.activeItemIndex ?? null, w = e.glowIntensity ?? 0,
|
|
4739
|
+
var L, x, A, $;
|
|
4740
|
+
const o = this.objectStates.get(s.id) || {}, e = o.options || s.options || {}, i = o.width !== void 0 ? o.width : ((L = s.geometry) == null ? void 0 : L.width) || 200, n = o.height !== void 0 ? o.height : ((x = s.geometry) == null ? void 0 : x.height) || 300, a = -i / 2, r = -n / 2, l = o.corner_radius !== void 0 ? o.corner_radius : e.corner_radius ?? 0, h = e.orientation || "vertical", c = e.items || [], g = e.itemGap ?? 10, f = e.itemHeight ?? 50, d = e.itemWidth ?? 200, u = e.scrollOffset ?? 0, m = e.padding ?? 0, y = e.glassEffect !== !1, v = e.accentColor || "#3b82f6", b = e.itemTextColor || "#333333", C = e.itemBackgroundColor || "#ffffff", S = e.hoveredIndex ?? null, I = e.activeItemIndex ?? null, w = e.glowIntensity ?? 0, M = e.glowColor || "#3b82f6", P = typeof M == "string" ? M : M.color || (($ = (A = M.stops) == null ? void 0 : A[0]) == null ? void 0 : $.color) || "#3b82f6", T = e.opacity !== void 0 ? e.opacity : s.opacity !== void 0 ? s.opacity : 1;
|
|
4690
4741
|
if (t.save(), t.globalAlpha *= T, w > 0) {
|
|
4691
|
-
const O = t.getTransform(),
|
|
4692
|
-
t.shadowColor =
|
|
4742
|
+
const O = t.getTransform(), z = Math.sqrt(O.a * O.a + O.b * O.b) || 1;
|
|
4743
|
+
t.shadowColor = P, t.shadowBlur = w * 2 * z, t.shadowOffsetX = 0, t.shadowOffsetY = 0;
|
|
4693
4744
|
}
|
|
4694
4745
|
if (y) {
|
|
4695
|
-
const O = e.listBackgroundColor || "rgba(31, 41, 55, 0.4)",
|
|
4696
|
-
t.fillStyle =
|
|
4746
|
+
const O = e.listBackgroundColor || "rgba(31, 41, 55, 0.4)", z = this.createCanvasFill(t, O, i, n);
|
|
4747
|
+
t.fillStyle = z || "rgba(31, 41, 55, 0.4)", this.drawListViewRect(t, a, r, i, n, l), t.fill();
|
|
4697
4748
|
const H = t.createLinearGradient(a, r, a + i, r + n);
|
|
4698
4749
|
H.addColorStop(0, "rgba(255, 255, 255, 0.15)"), H.addColorStop(0.5, "rgba(255, 255, 255, 0.08)"), H.addColorStop(1, "rgba(255, 255, 255, 0.03)"), t.fillStyle = H, this.drawListViewRect(t, a, r, i, n, l), t.fill(), t.strokeStyle = "rgba(255, 255, 255, 0.25)", t.lineWidth = 1, this.drawListViewRect(t, a, r, i, n, l), t.stroke();
|
|
4699
4750
|
} else {
|
|
4700
|
-
const O = e.listBackgroundColor || "transparent",
|
|
4701
|
-
|
|
4751
|
+
const O = e.listBackgroundColor || "transparent", z = this.createCanvasFill(t, O, i, n);
|
|
4752
|
+
z && (t.fillStyle = z, this.drawListViewRect(t, a, r, i, n, l), t.fill());
|
|
4702
4753
|
const H = e.borderWidth ?? 0;
|
|
4703
4754
|
H > 0 && (t.strokeStyle = e.borderColor || "#cccccc", t.lineWidth = H, this.drawListViewRect(t, a, r, i, n, l), t.stroke());
|
|
4704
4755
|
}
|
|
4705
4756
|
t.shadowBlur = 0, t.save(), this.drawListViewRect(t, a, r, i, n, l), t.clip();
|
|
4706
4757
|
const W = typeof m == "number" ? m : h === "vertical" ? m[0] : m[3];
|
|
4707
|
-
let
|
|
4708
|
-
if (t.textBaseline = "middle", c.forEach((O,
|
|
4709
|
-
const H = h === "vertical" ? i : d, et = h === "vertical" ? f : n,
|
|
4758
|
+
let k = (h === "vertical" ? r : a) + u + W;
|
|
4759
|
+
if (t.textBaseline = "middle", c.forEach((O, z) => {
|
|
4760
|
+
const H = h === "vertical" ? i : d, et = h === "vertical" ? f : n, E = h === "vertical" ? a : k, F = h === "vertical" ? k : r, q = S === z, Q = I === z;
|
|
4710
4761
|
if (Q) {
|
|
4711
4762
|
const mt = this.createCanvasFill(t, v, H, et);
|
|
4712
4763
|
t.fillStyle = mt || v;
|
|
4713
4764
|
const rt = t.globalAlpha;
|
|
4714
|
-
t.globalAlpha = rt * 0.8, t.fillRect(
|
|
4765
|
+
t.globalAlpha = rt * 0.8, t.fillRect(E, F, H, et), t.globalAlpha = rt;
|
|
4715
4766
|
} else if (q)
|
|
4716
|
-
t.fillStyle = y ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.05)", t.fillRect(
|
|
4767
|
+
t.fillStyle = y ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.05)", t.fillRect(E, F, H, et);
|
|
4717
4768
|
else if (C !== "transparent") {
|
|
4718
4769
|
const mt = this.createCanvasFill(t, C, H, et);
|
|
4719
|
-
t.fillStyle = mt || C, t.fillRect(
|
|
4770
|
+
t.fillStyle = mt || C, t.fillRect(E, F, H, et);
|
|
4720
4771
|
}
|
|
4721
4772
|
if (Q || q) {
|
|
4722
4773
|
const mt = this.createCanvasFill(t, v, h === "vertical" ? 3 : H, h === "vertical" ? et : 3);
|
|
4723
|
-
t.fillStyle = mt || v, h === "vertical" ? t.fillRect(
|
|
4774
|
+
t.fillStyle = mt || v, h === "vertical" ? t.fillRect(E, F, 3, et) : t.fillRect(E, F + et - 3, H, 3);
|
|
4724
4775
|
}
|
|
4725
4776
|
const it = Q ? "#ffffff" : y ? "rgba(255, 255, 255, 0.9)" : b;
|
|
4726
4777
|
t.fillStyle = it, t.font = Q || q ? "600 14px Inter, sans-serif" : "400 14px Inter, sans-serif";
|
|
4727
|
-
const dt = typeof O == "string" ? O : (O == null ? void 0 : O.label) || `Item ${
|
|
4728
|
-
h === "horizontal" ? t.textAlign = "center" : t.textAlign = "left", t.fillText(dt, St, ht),
|
|
4778
|
+
const dt = typeof O == "string" ? O : (O == null ? void 0 : O.label) || `Item ${z + 1}`, St = E + (h === "vertical" ? 16 : H / 2), ht = F + et / 2;
|
|
4779
|
+
h === "horizontal" ? t.textAlign = "center" : t.textAlign = "left", t.fillText(dt, St, ht), k += (h === "vertical" ? f : d) + g;
|
|
4729
4780
|
}), t.restore(), e.showScrollbar !== !1) {
|
|
4730
|
-
const O = (c.length || 0) * (h === "vertical" ? f : d) + ((c.length || 0) - 1) * g,
|
|
4731
|
-
if (O >
|
|
4732
|
-
const H =
|
|
4733
|
-
t.fillStyle = F, h === "vertical" ? t.fillRect(a + i - q - 2, r +
|
|
4781
|
+
const O = (c.length || 0) * (h === "vertical" ? f : d) + ((c.length || 0) - 1) * g, z = h === "vertical" ? n : i;
|
|
4782
|
+
if (O > z) {
|
|
4783
|
+
const H = z / O, et = z * H, E = -u / O * z, F = e.scrollbarColor || "rgba(255,255,255,0.3)", q = e.scrollbarWidth || 4;
|
|
4784
|
+
t.fillStyle = F, h === "vertical" ? t.fillRect(a + i - q - 2, r + E, q, et) : t.fillRect(a + E, r + n - q - 2, et, q);
|
|
4734
4785
|
}
|
|
4735
4786
|
}
|
|
4736
4787
|
t.restore();
|
|
@@ -4748,14 +4799,14 @@ class li {
|
|
|
4748
4799
|
i.hoveredIndex !== e && (i.hoveredIndex = e);
|
|
4749
4800
|
}
|
|
4750
4801
|
getListViewItemIndexAtPointer(t, s, o) {
|
|
4751
|
-
var W,
|
|
4802
|
+
var W, k;
|
|
4752
4803
|
const e = t.options || {}, i = this.objectStates.get(t.id) || {}, n = e.items || [];
|
|
4753
4804
|
if (n.length === 0) return null;
|
|
4754
|
-
const a = i.width !== void 0 ? i.width : ((W = t.geometry) == null ? void 0 : W.width) || 200, r = i.height !== void 0 ? i.height : ((
|
|
4755
|
-
let T = (l === "vertical" ?
|
|
4805
|
+
const a = i.width !== void 0 ? i.width : ((W = t.geometry) == null ? void 0 : W.width) || 200, r = i.height !== void 0 ? i.height : ((k = t.geometry) == null ? void 0 : k.height) || 300, l = e.orientation || "vertical", h = e.itemGap ?? 10, c = e.itemHeight ?? 50, g = e.itemWidth ?? 200, f = e.scrollOffset ?? 0, d = e.padding ?? 0, u = this.getWorldTransform(t.id), m = s - u.x, y = o - u.y, v = -u.rotation * (Math.PI / 180), b = Math.cos(v), C = Math.sin(v), S = m * b - y * C, I = m * C + y * b, w = -a / 2, M = -r / 2, P = typeof d == "number" ? d : l === "vertical" ? d[0] : d[3];
|
|
4806
|
+
let T = (l === "vertical" ? M : w) + f + P;
|
|
4756
4807
|
for (let _ = 0; _ < n.length; _++) {
|
|
4757
|
-
const L = l === "vertical" ? a : g, x = l === "vertical" ? c : r,
|
|
4758
|
-
if (S >=
|
|
4808
|
+
const L = l === "vertical" ? a : g, x = l === "vertical" ? c : r, A = l === "vertical" ? w : T, $ = l === "vertical" ? T : M;
|
|
4809
|
+
if (S >= A && S <= A + L && I >= $ && I <= $ + x)
|
|
4759
4810
|
return _;
|
|
4760
4811
|
T += (l === "vertical" ? c : g) + h;
|
|
4761
4812
|
}
|
|
@@ -4775,7 +4826,7 @@ class li {
|
|
|
4775
4826
|
if (!e.behaviors || e.behaviors.length === 0) return;
|
|
4776
4827
|
const i = this.objectStates.get(e.id);
|
|
4777
4828
|
i && e.behaviors.forEach((n) => {
|
|
4778
|
-
var g, f, d, u, m, y, v, b, C, S, I, w,
|
|
4829
|
+
var g, f, d, u, m, y, v, b, C, S, I, w, M, P, T, W, k, _, L, x, A, $, O, z, H, et, E, F, q, Q, it, dt, St, ht, mt, rt, Lt, Gt, Pt, Dt, Yt, B, lt, Vt, Mt, Tt, zt, Ut, Jt, qt, Qt, oe, jt, ee, J, ft, U, G, K, Z, At, Ot, kt, Nt, yt, R, ct, Xt, xt, te, $t, Wt, Ft, ot, It, bt, vt, gt, Rt, at, st, nt, wt, V, pt, ut, ce, me, Ie, we, Te, Ht, se, ue, Me, ke, fe, re, le, ye, _e, Ae, Oe, Pe, Re, Le, De, Ve, ze, Ne, He, Ue, qe, Je, Qe, Ke, Ze, je;
|
|
4779
4830
|
if (!n.enabled) return;
|
|
4780
4831
|
const a = n.startTime || 0, r = n.endTime || 1 / 0;
|
|
4781
4832
|
if (this.currentTime < a || this.currentTime > r) return;
|
|
@@ -4808,13 +4859,13 @@ class li {
|
|
|
4808
4859
|
i.x += Et * j * D * t * 5, i.y += Bt * j * D * t * 5, i.rotation += 5 * j * D * t * 5, i.scale_x *= 1 - j * 0.1 * D * t, i.scale_y *= 1 - j * 0.1 * D * t;
|
|
4809
4860
|
}
|
|
4810
4861
|
} else if (n.type === Y.Fluid) {
|
|
4811
|
-
const X = ((w = n.settings) == null ? void 0 : w.radius) || 300, N = ((
|
|
4862
|
+
const X = ((w = n.settings) == null ? void 0 : w.radius) || 300, N = ((M = n.settings) == null ? void 0 : M.strength) || 1;
|
|
4812
4863
|
if (c < X) {
|
|
4813
4864
|
const D = Math.pow(1 - c / X, 1.2), j = l / (c || 1) * D * 1.2 * N, _t = h / (c || 1) * D * 1.2 * N;
|
|
4814
4865
|
i.x += j * 10 * t * 5, i.y += _t * 10 * t * 5, i.scale_x *= 1 + D * 0.3 * N * t, i.scale_y *= 1 + D * 0.3 * N * t;
|
|
4815
4866
|
}
|
|
4816
4867
|
} else if (n.type === Y.Elastic) {
|
|
4817
|
-
const X = ((
|
|
4868
|
+
const X = ((P = n.settings) == null ? void 0 : P.radius) || 300, N = ((T = n.settings) == null ? void 0 : T.strength) || 1;
|
|
4818
4869
|
if (c < X) {
|
|
4819
4870
|
const D = 1 - c / X;
|
|
4820
4871
|
i.scale_x *= 1 + D * 0.4 * N * t, i.scale_y *= 1 + D * 0.4 * N * t;
|
|
@@ -4826,7 +4877,7 @@ class li {
|
|
|
4826
4877
|
i.style.exposure = (i.style.exposure || 1) + j * 0.5 * t;
|
|
4827
4878
|
}
|
|
4828
4879
|
} else if (n.type === Y.Sticky) {
|
|
4829
|
-
const X = ((
|
|
4880
|
+
const X = ((k = n.settings) == null ? void 0 : k.radius) || 80, N = ((_ = n.settings) == null ? void 0 : _.strength) || 1;
|
|
4830
4881
|
if (c < X) {
|
|
4831
4882
|
const D = Math.pow(1 - c / X, 2);
|
|
4832
4883
|
i.x -= l * D * N * t * 10, i.y -= h * D * N * t * 10, i.scale_x *= 1 - D * 0.1 * N * t, i.scale_y *= 1 - D * 0.1 * N * t;
|
|
@@ -4838,8 +4889,8 @@ class li {
|
|
|
4838
4889
|
i.scale_x *= 1 + D * 0.5 * N * t, i.scale_y *= 1 + D * 0.5 * N * t;
|
|
4839
4890
|
}
|
|
4840
4891
|
} else if (n.type === Y.Parallax) {
|
|
4841
|
-
const X = ((
|
|
4842
|
-
i.x = this.lerp(i.x ?? ((
|
|
4892
|
+
const X = ((A = n.settings) == null ? void 0 : A.factor) || 15, N = (($ = n.settings) == null ? void 0 : $.strength) || 1, D = this.canvasWidth / 2, j = this.canvasHeight / 2, _t = this._lastPointerPos || { x: D, y: j }, Et = (_t.x - D) / D, Bt = (_t.y - j) / j, Zt = (((O = e.transform) == null ? void 0 : O.x) ?? 0) + Et * X * N, he = (((z = e.transform) == null ? void 0 : z.y) ?? 0) + Bt * X * N, be = (((H = e.transform) == null ? void 0 : H.rotate_x) ?? 0) - Bt * X * 1.5 * N, ie = (((et = e.transform) == null ? void 0 : et.rotate_y) ?? 0) + Et * X * 1.5 * N, pe = Math.min(1, 10 * t);
|
|
4893
|
+
i.x = this.lerp(i.x ?? ((E = e.transform) == null ? void 0 : E.x) ?? 0, Zt, pe), i.y = this.lerp(i.y ?? ((F = e.transform) == null ? void 0 : F.y) ?? 0, he, pe), i.rotate_x = this.lerp(i.rotate_x ?? ((q = e.transform) == null ? void 0 : q.rotate_x) ?? 0, be, pe), i.rotate_y = this.lerp(i.rotate_y ?? ((Q = e.transform) == null ? void 0 : Q.rotate_y) ?? 0, ie, pe);
|
|
4843
4894
|
} else if (n.type === Y.Fold) {
|
|
4844
4895
|
if (c < 300) {
|
|
4845
4896
|
const X = 1 - c / 300, N = (l > 0 ? -1 : 1) * X * 10, D = 1 - X * 0.1, j = h / 300 * X * 20, _t = -(l / 300) * X * 20, Et = Math.min(1, 10 * t);
|
|
@@ -4851,8 +4902,8 @@ class li {
|
|
|
4851
4902
|
i.skew_x = this.lerp(i.skew_x ?? ((Lt = e.transform) == null ? void 0 : Lt.skew_x) ?? 0, N, j), i.scale_x = this.lerp(i.scale_x ?? ((Gt = e.transform) == null ? void 0 : Gt.scale_x) ?? 1, (((Pt = e.transform) == null ? void 0 : Pt.scale_x) ?? 1) * (1 + D), j), i.scale_y = this.lerp(i.scale_y ?? ((Dt = e.transform) == null ? void 0 : Dt.scale_y) ?? 1, (((Yt = e.transform) == null ? void 0 : Yt.scale_y) ?? 1) * (1 + D), j), i.style = i.style || { ...e.style }, i.style.artEffect = { enabled: !0, type: "crumple_overlay", intensity: ((B = n.settings) == null ? void 0 : B.intensity) ?? 1, scale: ((lt = n.settings) == null ? void 0 : lt.scale) ?? 2 };
|
|
4852
4903
|
}
|
|
4853
4904
|
} else if (n.type === Y.Squash) {
|
|
4854
|
-
const X = ((
|
|
4855
|
-
c < (e.width || 100) && this.isMouseDown ? (i.scale_y = this.lerp(i.scale_y ?? 1, (((Mt = e.transform) == null ? void 0 : Mt.scale_y) ?? 1) * X, 0.3), i.scale_x = this.lerp(i.scale_x ?? 1, (((Tt = e.transform) == null ? void 0 : Tt.scale_x) ?? 1) * (1 + (1 - X) * 0.4), 0.3)) : (i.scale_y = this.lerp(i.scale_y ?? 1, ((
|
|
4905
|
+
const X = ((Vt = n.settings) == null ? void 0 : Vt.strength) || 0.8;
|
|
4906
|
+
c < (e.width || 100) && this.isMouseDown ? (i.scale_y = this.lerp(i.scale_y ?? 1, (((Mt = e.transform) == null ? void 0 : Mt.scale_y) ?? 1) * X, 0.3), i.scale_x = this.lerp(i.scale_x ?? 1, (((Tt = e.transform) == null ? void 0 : Tt.scale_x) ?? 1) * (1 + (1 - X) * 0.4), 0.3)) : (i.scale_y = this.lerp(i.scale_y ?? 1, ((zt = e.transform) == null ? void 0 : zt.scale_y) ?? 1, 0.2), i.scale_x = this.lerp(i.scale_x ?? 1, ((Ut = e.transform) == null ? void 0 : Ut.scale_x) ?? 1, 0.2));
|
|
4856
4907
|
} else if (n.type === Y.TextCounter) {
|
|
4857
4908
|
const X = ((Jt = n.settings) == null ? void 0 : Jt.duration) || 2, N = ((qt = n.settings) == null ? void 0 : qt.from) || 0, D = ((Qt = n.settings) == null ? void 0 : Qt.to) || 100;
|
|
4858
4909
|
n._runtimeStart === void 0 && (n._runtimeStart = this.currentTime);
|
|
@@ -4869,7 +4920,7 @@ class li {
|
|
|
4869
4920
|
} else
|
|
4870
4921
|
(Z = i.style) != null && Z.adjustments && (i.style.adjustments.exposure = this.lerp(i.style.adjustments.exposure || 0, ((Ot = (At = e.style) == null ? void 0 : At.adjustments) == null ? void 0 : Ot.exposure) || 0, 0.1));
|
|
4871
4922
|
} else if (n.type === Y.Noise || n.type === Y.Float) {
|
|
4872
|
-
const X = (((kt = n.settings) == null ? void 0 : kt.frequency) || ((Nt = n.settings) == null ? void 0 : Nt.speed) || 1) * 2e-3, N = (((yt = n.settings) == null ? void 0 : yt.amplitude) || ((
|
|
4923
|
+
const X = (((kt = n.settings) == null ? void 0 : kt.frequency) || ((Nt = n.settings) == null ? void 0 : Nt.speed) || 1) * 2e-3, N = (((yt = n.settings) == null ? void 0 : yt.amplitude) || ((R = n.settings) == null ? void 0 : R.range) || 50) * (((ct = n.settings) == null ? void 0 : ct.strength) || 1), D = Date.now();
|
|
4873
4924
|
i.x += Math.sin(D * X) * N * t, i.y += Math.cos(D * X * 0.8) * N * t, i.rotation += Math.sin(D * X * 0.5) * 5 * t;
|
|
4874
4925
|
} else if (n.type === Y.Pulse) {
|
|
4875
4926
|
const X = (((Xt = n.settings) == null ? void 0 : Xt.speed) || 1) * 5e-3, N = (((xt = n.settings) == null ? void 0 : xt.scale) || 1.2) - 1, D = Math.sin(Date.now() * X), j = ((te = n.settings) == null ? void 0 : te.strength) || 1;
|
|
@@ -4899,7 +4950,7 @@ class li {
|
|
|
4899
4950
|
const X = ((nt = n.settings) == null ? void 0 : nt.steps) || 12, N = (((wt = n.settings) == null ? void 0 : wt.speed) || 1) * 30, D = Math.floor(i.rotation / (360 / X)) * (360 / X);
|
|
4900
4951
|
i.rotation = this.lerp(i.rotation, D + N * t, 0.1);
|
|
4901
4952
|
} else if (n.type === Y.Jitter && c < 300) {
|
|
4902
|
-
const X = ((
|
|
4953
|
+
const X = ((V = n.settings) == null ? void 0 : V.strength) || 1, N = (((pt = n.settings) == null ? void 0 : pt.intensity) || 5) * X;
|
|
4903
4954
|
i.x += (Math.random() - 0.5) * N * t * 60, i.y += (Math.random() - 0.5) * N * t * 60, i.rotation += (Math.random() - 0.5) * N * t * 120;
|
|
4904
4955
|
} else if (n.type === Y.Follower) {
|
|
4905
4956
|
const X = (ut = n.settings) == null ? void 0 : ut.targetId;
|
|
@@ -5006,7 +5057,7 @@ class li {
|
|
|
5006
5057
|
}
|
|
5007
5058
|
}
|
|
5008
5059
|
} else if (n.type === Y.SpringChain) {
|
|
5009
|
-
const X = ((De = n.settings) == null ? void 0 : De.connections) || [], N = ((
|
|
5060
|
+
const X = ((De = n.settings) == null ? void 0 : De.connections) || [], N = ((Ve = n.settings) == null ? void 0 : Ve.globalDamping) || 0.3;
|
|
5010
5061
|
this._springChainState.has(e.id) || this._springChainState.set(e.id, /* @__PURE__ */ new Map());
|
|
5011
5062
|
const D = this._springChainState.get(e.id);
|
|
5012
5063
|
for (const _t of X) {
|
|
@@ -5035,7 +5086,7 @@ class li {
|
|
|
5035
5086
|
i.x += j.vx * t, i.y += j.vy * t;
|
|
5036
5087
|
}
|
|
5037
5088
|
} else if (n.type === Y.ParticleEmitter) {
|
|
5038
|
-
const X = ((
|
|
5089
|
+
const X = ((ze = n.settings) == null ? void 0 : ze.rate) || 10, N = ((Ne = n.settings) == null ? void 0 : Ne.speed) || 100, D = ((He = n.settings) == null ? void 0 : He.size) || 5, j = ((Ue = n.settings) == null ? void 0 : Ue.lifetime) || 2, _t = ((qe = n.settings) == null ? void 0 : qe.gravity) || 0, Et = ((Je = n.settings) == null ? void 0 : Je.color) || "#ffffff", Bt = ((Qe = n.settings) == null ? void 0 : Qe.maxParticles) || 200, Zt = (Ke = n.settings) != null && Ke.rateInputId ? this.inputs.get(n.settings.rateInputId) ?? X : X, he = (Ze = n.settings) != null && Ze.gravityInputId ? this.inputs.get(n.settings.gravityInputId) ?? _t : _t, be = (je = n.settings) != null && je.speedInputId ? this.inputs.get(n.settings.speedInputId) ?? N : N;
|
|
5039
5090
|
this._emitterPools.has(e.id) || this._emitterPools.set(e.id, []);
|
|
5040
5091
|
const ie = this._emitterPools.get(e.id);
|
|
5041
5092
|
let pe = 0;
|
|
@@ -5064,88 +5115,88 @@ class li {
|
|
|
5064
5115
|
});
|
|
5065
5116
|
}
|
|
5066
5117
|
applyBehaviorSensor(t, s, o, e, i, n, a = 0, r = 0, l = 1) {
|
|
5067
|
-
var d, u, m, y, v, b, C, S, I, w,
|
|
5118
|
+
var d, u, m, y, v, b, C, S, I, w, M, P, T, W, k, _, L, x, A, $, O, z, H, et;
|
|
5068
5119
|
const h = (i == null ? void 0 : i.intensity) || (i == null ? void 0 : i.strength) || 1, c = Math.min(1, 15 * e), g = l > 0 ? a / l : 0, f = l > 0 ? r / l : 0;
|
|
5069
5120
|
switch (s) {
|
|
5070
5121
|
case Kt.Scale: {
|
|
5071
|
-
const
|
|
5072
|
-
t.scale_x = (t.scale_x ??
|
|
5122
|
+
const E = ((d = n == null ? void 0 : n.transform) == null ? void 0 : d.scale_x) ?? 1, F = ((u = n == null ? void 0 : n.transform) == null ? void 0 : u.scale_y) ?? 1, q = E * (1 + o * h * 0.4), Q = F * (1 + o * h * 0.4);
|
|
5123
|
+
t.scale_x = (t.scale_x ?? E) * (1 - c) + q * c, t.scale_y = (t.scale_y ?? F) * (1 - c) + Q * c;
|
|
5073
5124
|
break;
|
|
5074
5125
|
}
|
|
5075
5126
|
case Kt.Opacity: {
|
|
5076
|
-
const
|
|
5077
|
-
t.opacity = (t.opacity ??
|
|
5127
|
+
const E = ((m = n == null ? void 0 : n.transform) == null ? void 0 : m.opacity) ?? 100, F = Math.max(0, Math.min(100, E - o * h * 100));
|
|
5128
|
+
t.opacity = (t.opacity ?? E) * (1 - c) + F * c;
|
|
5078
5129
|
break;
|
|
5079
5130
|
}
|
|
5080
5131
|
case Kt.RotateZ: {
|
|
5081
|
-
const
|
|
5082
|
-
t.rotation = (t.rotation ??
|
|
5132
|
+
const E = ((y = n == null ? void 0 : n.transform) == null ? void 0 : y.rotation) ?? 0, F = E + o * h * 45;
|
|
5133
|
+
t.rotation = (t.rotation ?? E) * (1 - c) + F * c;
|
|
5083
5134
|
break;
|
|
5084
5135
|
}
|
|
5085
5136
|
case Kt.RotateX: {
|
|
5086
|
-
const
|
|
5087
|
-
t.rotate_x = (t.rotate_x ??
|
|
5137
|
+
const E = ((v = n == null ? void 0 : n.transform) == null ? void 0 : v.rotate_x) ?? 0, F = E - f * o * h * 60;
|
|
5138
|
+
t.rotate_x = (t.rotate_x ?? E) * (1 - c) + F * c;
|
|
5088
5139
|
break;
|
|
5089
5140
|
}
|
|
5090
5141
|
case Kt.RotateY: {
|
|
5091
|
-
const
|
|
5092
|
-
t.rotate_y = (t.rotate_y ??
|
|
5142
|
+
const E = ((b = n == null ? void 0 : n.transform) == null ? void 0 : b.rotate_y) ?? 0, F = E + g * o * h * 60;
|
|
5143
|
+
t.rotate_y = (t.rotate_y ?? E) * (1 - c) + F * c;
|
|
5093
5144
|
break;
|
|
5094
5145
|
}
|
|
5095
5146
|
case Kt.PositionX: {
|
|
5096
|
-
const
|
|
5097
|
-
t.x = (t.x ??
|
|
5147
|
+
const E = ((C = n == null ? void 0 : n.transform) == null ? void 0 : C.x) ?? 0, F = E - g * o * h * 40;
|
|
5148
|
+
t.x = (t.x ?? E) * (1 - c) + F * c;
|
|
5098
5149
|
break;
|
|
5099
5150
|
}
|
|
5100
5151
|
case Kt.PositionY: {
|
|
5101
|
-
const
|
|
5102
|
-
t.y = (t.y ??
|
|
5152
|
+
const E = ((S = n == null ? void 0 : n.transform) == null ? void 0 : S.y) ?? 0, F = E - f * o * h * 40;
|
|
5153
|
+
t.y = (t.y ?? E) * (1 - c) + F * c;
|
|
5103
5154
|
break;
|
|
5104
5155
|
}
|
|
5105
5156
|
case Kt.SkewX: {
|
|
5106
|
-
const
|
|
5107
|
-
t.skew_x = (t.skew_x ??
|
|
5157
|
+
const E = ((I = n == null ? void 0 : n.transform) == null ? void 0 : I.skew_x) ?? 0, F = E + g * o * h * 45;
|
|
5158
|
+
t.skew_x = (t.skew_x ?? E) * (1 - c) + F * c, t.skew_x > 85 && (t.skew_x = 85), t.skew_x < -85 && (t.skew_x = -85);
|
|
5108
5159
|
break;
|
|
5109
5160
|
}
|
|
5110
5161
|
case Kt.Blur: {
|
|
5111
5162
|
t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.blur || (t.style.blur = { ...(w = n == null ? void 0 : n.style) == null ? void 0 : w.blur });
|
|
5112
|
-
const
|
|
5113
|
-
t.style.blur.amount = (t.style.blur.amount ??
|
|
5163
|
+
const E = ((P = (M = n == null ? void 0 : n.style) == null ? void 0 : M.blur) == null ? void 0 : P.amount) || 0, F = E + o * ((i == null ? void 0 : i.blur) || 20) * h;
|
|
5164
|
+
t.style.blur.amount = (t.style.blur.amount ?? E) * (1 - c) + F * c;
|
|
5114
5165
|
break;
|
|
5115
5166
|
}
|
|
5116
5167
|
case Kt.Exposure: {
|
|
5117
5168
|
t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.adjustments || (t.style.adjustments = { ...(T = n == null ? void 0 : n.style) == null ? void 0 : T.adjustments });
|
|
5118
|
-
const
|
|
5119
|
-
t.style.adjustments.exposure = (t.style.adjustments.exposure ??
|
|
5169
|
+
const E = ((k = (W = n == null ? void 0 : n.style) == null ? void 0 : W.adjustments) == null ? void 0 : k.exposure) || 0, F = E + o * ((i == null ? void 0 : i.exposure) || 50) * h;
|
|
5170
|
+
t.style.adjustments.exposure = (t.style.adjustments.exposure ?? E) * (1 - c) + F * c;
|
|
5120
5171
|
break;
|
|
5121
5172
|
}
|
|
5122
5173
|
case Kt.HueShift: {
|
|
5123
5174
|
t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.adjustments || (t.style.adjustments = { ...(_ = n == null ? void 0 : n.style) == null ? void 0 : _.adjustments });
|
|
5124
|
-
const
|
|
5125
|
-
t.style.adjustments.hue = (t.style.adjustments.hue ??
|
|
5175
|
+
const E = ((x = (L = n == null ? void 0 : n.style) == null ? void 0 : L.adjustments) == null ? void 0 : x.hue) || 0, F = E + o * ((i == null ? void 0 : i.hue) || 180) * h;
|
|
5176
|
+
t.style.adjustments.hue = (t.style.adjustments.hue ?? E) * (1 - c) + F * c;
|
|
5126
5177
|
break;
|
|
5127
5178
|
}
|
|
5128
5179
|
case Kt.Negative: {
|
|
5129
|
-
t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.adjustments || (t.style.adjustments = { ...(
|
|
5130
|
-
const
|
|
5131
|
-
t.style.adjustments.negative = (t.style.adjustments.negative ??
|
|
5180
|
+
t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.adjustments || (t.style.adjustments = { ...(A = n == null ? void 0 : n.style) == null ? void 0 : A.adjustments });
|
|
5181
|
+
const E = ((O = ($ = n == null ? void 0 : n.style) == null ? void 0 : $.adjustments) == null ? void 0 : O.negative) || 0, F = E + o * ((i == null ? void 0 : i.negative) || 100) * h;
|
|
5182
|
+
t.style.adjustments.negative = (t.style.adjustments.negative ?? E) * (1 - c) + F * c;
|
|
5132
5183
|
break;
|
|
5133
5184
|
}
|
|
5134
5185
|
case Kt.CornerRadius: {
|
|
5135
|
-
const
|
|
5136
|
-
t.corner_radius = (t.corner_radius ??
|
|
5186
|
+
const E = ((z = n == null ? void 0 : n.transform) == null ? void 0 : z.corner_radius) || 0, F = E + o * h * 50;
|
|
5187
|
+
t.corner_radius = (t.corner_radius ?? E) * (1 - c) + F * c;
|
|
5137
5188
|
break;
|
|
5138
5189
|
}
|
|
5139
5190
|
case Kt.StrokeWidth: {
|
|
5140
5191
|
t.style || (t.style = { ...n == null ? void 0 : n.style });
|
|
5141
|
-
const
|
|
5142
|
-
t.style.borderWidth = (t.style.borderWidth ??
|
|
5192
|
+
const E = ((H = n == null ? void 0 : n.style) == null ? void 0 : H.borderWidth) || 0, F = E + o * h * 10;
|
|
5193
|
+
t.style.borderWidth = (t.style.borderWidth ?? E) * (1 - c) + F * c;
|
|
5143
5194
|
break;
|
|
5144
5195
|
}
|
|
5145
5196
|
case Kt.LetterSpacing: {
|
|
5146
5197
|
t.geometry || (t.geometry = {});
|
|
5147
|
-
const
|
|
5148
|
-
t.geometry.letterSpacing = (t.geometry.letterSpacing ??
|
|
5198
|
+
const E = ((et = n == null ? void 0 : n.geometry) == null ? void 0 : et.letterSpacing) || 0, F = E + o * h * 10;
|
|
5199
|
+
t.geometry.letterSpacing = (t.geometry.letterSpacing ?? E) * (1 - c) + F * c;
|
|
5149
5200
|
break;
|
|
5150
5201
|
}
|
|
5151
5202
|
}
|
|
@@ -5225,7 +5276,7 @@ class li {
|
|
|
5225
5276
|
a === "cover" ? h > c ? (g = n * h, d = o - (g - i) / 2) : (f = i / h, u = e - (f - n) / 2) : a === "contain" && (h > c ? (f = i / h, u = e + (n - f) / 2) : (g = n * h, d = o + (i - g) / 2)), t.drawImage(s, d, u, g, f);
|
|
5226
5277
|
}
|
|
5227
5278
|
}
|
|
5228
|
-
const
|
|
5279
|
+
const yi = Cs(({
|
|
5229
5280
|
artboard: p,
|
|
5230
5281
|
src: t,
|
|
5231
5282
|
style: s,
|
|
@@ -5250,19 +5301,19 @@ const mi = Cs(({
|
|
|
5250
5301
|
scrollX: S,
|
|
5251
5302
|
mouseX: I,
|
|
5252
5303
|
mouseY: w,
|
|
5253
|
-
isMouseDown:
|
|
5254
|
-
inputs:
|
|
5304
|
+
isMouseDown: M,
|
|
5305
|
+
inputs: P,
|
|
5255
5306
|
interactive: T = !0,
|
|
5256
5307
|
onNavigation: W
|
|
5257
|
-
},
|
|
5258
|
-
const _ = ve(null), L = ve(new
|
|
5259
|
-
Ss(
|
|
5308
|
+
}, k) => {
|
|
5309
|
+
const _ = ve(null), L = ve(new ci()), x = ve(void 0), A = ve(0), $ = ve(null), O = ve(b), [, z] = ds(p || null), H = ve(!0);
|
|
5310
|
+
Ss(k, () => _.current), Se(() => (H.current = !0, () => {
|
|
5260
5311
|
H.current = !1, x.current && cancelAnimationFrame(x.current);
|
|
5261
5312
|
}), []), Se(() => {
|
|
5262
5313
|
L.current.setLayout(e, i);
|
|
5263
5314
|
}, [e, i]), Se(() => {
|
|
5264
|
-
const
|
|
5265
|
-
a &&
|
|
5315
|
+
const E = L.current;
|
|
5316
|
+
a && E.setTriggerCallback(a), r && E.setInputUpdateCallback((F, q) => r({ [F]: q })), l && E.setComponentChangeCallback((F) => l(F)), h && E.setToggleCallback(h), c && E.setInputChangeCallback(c), g && E.setInputFocusCallback(g), f && E.setInputBlurCallback(f), d && E.setOnLogCallback((F) => d(F, "info")), u && E.setLogicUpdateCallback(u), m && E.setButtonClickCallback(m), y && E.setGraphPointClickCallback((F) => y(F.objectId, F)), W && E.setNavigationCallback(W);
|
|
5266
5317
|
}, [a, r, l, h, c, g, f, d, u, m, y, W]), Se(() => {
|
|
5267
5318
|
(async () => {
|
|
5268
5319
|
let F = p;
|
|
@@ -5274,52 +5325,52 @@ const mi = Cs(({
|
|
|
5274
5325
|
}
|
|
5275
5326
|
if (F) {
|
|
5276
5327
|
const q = L.current, Q = F.id || F.name || "default";
|
|
5277
|
-
($.current !== Q || O.current !== b) && (q.load(F), $.current = Q, O.current = b,
|
|
5328
|
+
($.current !== Q || O.current !== b) && (q.load(F), $.current = Q, O.current = b, z(F), A.current = 0, q.advance(0)), n && n(q);
|
|
5278
5329
|
}
|
|
5279
5330
|
})();
|
|
5280
5331
|
}, [p == null ? void 0 : p.id, t, b]), Se(() => {
|
|
5281
|
-
const
|
|
5332
|
+
const E = (F) => {
|
|
5282
5333
|
if (!L.current || !H.current) return;
|
|
5283
5334
|
const q = L.current, Q = _.current;
|
|
5284
5335
|
if (!Q) return;
|
|
5285
5336
|
const it = Q.getContext("2d");
|
|
5286
5337
|
if (!it) return;
|
|
5287
5338
|
const dt = F / 1e3;
|
|
5288
|
-
|
|
5289
|
-
let St = dt -
|
|
5290
|
-
St > 0.1 && (St = 0.1),
|
|
5339
|
+
A.current === 0 && (A.current = dt);
|
|
5340
|
+
let St = dt - A.current;
|
|
5341
|
+
St > 0.1 && (St = 0.1), A.current = dt;
|
|
5291
5342
|
const ht = Q.getBoundingClientRect(), mt = window.devicePixelRatio || 1, rt = Math.round(ht.width * mt), Lt = Math.round(ht.height * mt);
|
|
5292
|
-
(Q.width !== rt || Q.height !== Lt) && (Q.width = rt, Q.height = Lt), o ? q.advance(St) : v !== void 0 && q.seek(v), q.render(it, Q.width, Q.height), x.current = requestAnimationFrame(
|
|
5343
|
+
(Q.width !== rt || Q.height !== Lt) && (Q.width = rt, Q.height = Lt), o ? q.advance(St) : v !== void 0 && q.seek(v), q.render(it, Q.width, Q.height), x.current = requestAnimationFrame(E);
|
|
5293
5344
|
};
|
|
5294
|
-
return x.current = requestAnimationFrame(
|
|
5345
|
+
return x.current = requestAnimationFrame(E), () => {
|
|
5295
5346
|
x.current && cancelAnimationFrame(x.current);
|
|
5296
5347
|
};
|
|
5297
5348
|
}, [o, v]), Se(() => {
|
|
5298
|
-
const
|
|
5299
|
-
C !== void 0 &&
|
|
5300
|
-
}, [C, S, I, w,
|
|
5301
|
-
const et = (
|
|
5349
|
+
const E = L.current;
|
|
5350
|
+
C !== void 0 && E.updateInput("scrollY", C), S !== void 0 && E.updateInput("scrollX", S), I !== void 0 && E.updateInput("mouseX", I), w !== void 0 && E.updateInput("mouseY", w), M !== void 0 && E.updateInput("isMouseDown", M), P && Object.entries(P).forEach(([F, q]) => E.updateInput(F, q));
|
|
5351
|
+
}, [C, S, I, w, M, P]);
|
|
5352
|
+
const et = (E, F) => {
|
|
5302
5353
|
if (!T || !_.current) return;
|
|
5303
|
-
const q = _.current, Q = q.getBoundingClientRect(), it =
|
|
5354
|
+
const q = _.current, Q = q.getBoundingClientRect(), it = E.clientX - Q.left, dt = E.clientY - Q.top, St = window.devicePixelRatio || 1;
|
|
5304
5355
|
L.current.handlePointerInput(F, it * St, dt * St, q.width, q.height);
|
|
5305
5356
|
};
|
|
5306
5357
|
return /* @__PURE__ */ Ce(
|
|
5307
5358
|
"canvas",
|
|
5308
5359
|
{
|
|
5309
5360
|
ref: _,
|
|
5310
|
-
onPointerDown: (
|
|
5361
|
+
onPointerDown: (E) => {
|
|
5311
5362
|
var F;
|
|
5312
|
-
et(
|
|
5363
|
+
et(E, "down"), (F = _.current) == null || F.focus();
|
|
5313
5364
|
},
|
|
5314
|
-
onPointerMove: (
|
|
5315
|
-
onPointerUp: (
|
|
5316
|
-
onPointerCancel: (
|
|
5317
|
-
onClick: (
|
|
5318
|
-
onWheel: (
|
|
5319
|
-
L.current.handleWheel(
|
|
5365
|
+
onPointerMove: (E) => et(E, "move"),
|
|
5366
|
+
onPointerUp: (E) => et(E, "up"),
|
|
5367
|
+
onPointerCancel: (E) => et(E, "up"),
|
|
5368
|
+
onClick: (E) => et(E, "click"),
|
|
5369
|
+
onWheel: (E) => {
|
|
5370
|
+
L.current.handleWheel(E.deltaX, E.deltaY);
|
|
5320
5371
|
},
|
|
5321
|
-
onKeyDown: (
|
|
5322
|
-
onContextMenu: (
|
|
5372
|
+
onKeyDown: (E) => L.current.handleKeyDown(E.nativeEvent),
|
|
5373
|
+
onContextMenu: (E) => E.preventDefault(),
|
|
5323
5374
|
tabIndex: 0,
|
|
5324
5375
|
style: {
|
|
5325
5376
|
...s,
|
|
@@ -5333,7 +5384,7 @@ const mi = Cs(({
|
|
|
5333
5384
|
}
|
|
5334
5385
|
);
|
|
5335
5386
|
});
|
|
5336
|
-
function
|
|
5387
|
+
function bi() {
|
|
5337
5388
|
const [p, t] = ds(null), s = ge((c, g) => {
|
|
5338
5389
|
p == null || p.setInputBool(c, g);
|
|
5339
5390
|
}, [p]), o = ge((c, g) => {
|
|
@@ -5368,7 +5419,7 @@ function yi() {
|
|
|
5368
5419
|
updateObjectOptions: r
|
|
5369
5420
|
};
|
|
5370
5421
|
}
|
|
5371
|
-
const
|
|
5422
|
+
const vi = ({ artboard: p, config: t }) => {
|
|
5372
5423
|
const s = { ...p.seo, ...t }, o = s.enableSmartExtraction !== !1;
|
|
5373
5424
|
Se(() => {
|
|
5374
5425
|
const a = s.title || p.name;
|
|
@@ -5437,17 +5488,17 @@ const bi = ({ artboard: p, config: t }) => {
|
|
|
5437
5488
|
]
|
|
5438
5489
|
}
|
|
5439
5490
|
);
|
|
5440
|
-
},
|
|
5441
|
-
version:
|
|
5442
|
-
},
|
|
5491
|
+
}, fi = "6.3.19", hi = {
|
|
5492
|
+
version: fi
|
|
5493
|
+
}, Ci = hi.version;
|
|
5443
5494
|
export {
|
|
5444
5495
|
Kt as BehaviorSensor,
|
|
5445
5496
|
Y as BehaviorType,
|
|
5446
5497
|
Ms as ConditionOp,
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
|
|
5498
|
+
vi as ExodeSEO,
|
|
5499
|
+
yi as ExodeUICanvas,
|
|
5500
|
+
ci as ExodeUIEngine,
|
|
5450
5501
|
Ct as LogicOp,
|
|
5451
|
-
|
|
5452
|
-
|
|
5502
|
+
Ci as VERSION,
|
|
5503
|
+
bi as useExodeUI
|
|
5453
5504
|
};
|