exodeui 6.3.29 → 6.3.31
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 +26 -26
- package/dist/index.mjs +996 -993
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -40,15 +40,15 @@ function us(g) {
|
|
|
40
40
|
lineHeight: n = 1.2,
|
|
41
41
|
width: a = 200,
|
|
42
42
|
letterSpacing: r = 0,
|
|
43
|
-
paragraphSpacing:
|
|
44
|
-
paragraphIndent:
|
|
43
|
+
paragraphSpacing: c = 0,
|
|
44
|
+
paragraphIndent: l = 0,
|
|
45
45
|
textCase: f = "none",
|
|
46
46
|
segments: u = [],
|
|
47
47
|
enableSegments: h = !1
|
|
48
48
|
} = g;
|
|
49
49
|
let d = String(t || "");
|
|
50
50
|
f === "uppercase" ? d = d.toUpperCase() : f === "lowercase" ? d = d.toLowerCase() : f === "capitalize" && (d = d.replace(/\b\w/g, (k) => k.toUpperCase())), g.hyphenation === !0 && (d = Ts(d));
|
|
51
|
-
const p = `${s} ${e} ${o}px "${i}", sans-serif`, y = `${d}|${p}|${r}|${
|
|
51
|
+
const p = `${s} ${e} ${o}px "${i}", sans-serif`, y = `${d}|${p}|${r}|${c}|${l}|${h}|${JSON.stringify(u)}|hyp:${!!g.hyphenation}|comp:${g.composer}|bal:${!!g.balanceRaggedLines}`;
|
|
52
52
|
let m = Ye.get(y);
|
|
53
53
|
const b = typeof CanvasRenderingContext2D < "u" ? CanvasRenderingContext2D.prototype.measureText : null, v = function(k) {
|
|
54
54
|
if (!b) return { width: 0, fontBoundingBoxAscent: 0, fontBoundingBoxDescent: 0 };
|
|
@@ -62,19 +62,19 @@ function us(g) {
|
|
|
62
62
|
try {
|
|
63
63
|
if (r !== 0 && typeof CanvasRenderingContext2D < "u" && (CanvasRenderingContext2D.prototype.measureText = v), h && u && u.length > 0) {
|
|
64
64
|
const k = u.map((T) => {
|
|
65
|
-
let
|
|
65
|
+
let x = T.text || "";
|
|
66
66
|
const P = T.textCase || f || "none";
|
|
67
|
-
return P === "uppercase" ?
|
|
67
|
+
return P === "uppercase" ? x.toUpperCase() : P === "lowercase" ? x.toLowerCase() : P === "capitalize" ? x.replace(/\b\w/g, (E) => E.toUpperCase()) : x;
|
|
68
68
|
}).join("");
|
|
69
69
|
if (m = Qe(k, p), m) {
|
|
70
|
-
let T = 0,
|
|
70
|
+
let T = 0, x = o;
|
|
71
71
|
for (const P of u) {
|
|
72
72
|
let E = P.text || "";
|
|
73
73
|
if (!E) continue;
|
|
74
|
-
const
|
|
75
|
-
|
|
74
|
+
const R = P.textCase || f || "none";
|
|
75
|
+
R === "uppercase" ? E = E.toUpperCase() : R === "lowercase" ? E = E.toLowerCase() : R === "capitalize" && (E = E.replace(/\b\w/g, ($) => $.toUpperCase()));
|
|
76
76
|
const O = P.fontSize || o;
|
|
77
|
-
O >
|
|
77
|
+
O > x && (x = O);
|
|
78
78
|
const W = `${P.fontStyle || s} ${P.fontWeight || e} ${O}px "${P.fontFamily || i}", sans-serif`, B = Qe(E, W);
|
|
79
79
|
if (B && B.widths)
|
|
80
80
|
for (let $ = 0; $ < B.widths.length; $++) {
|
|
@@ -92,7 +92,7 @@ function us(g) {
|
|
|
92
92
|
}
|
|
93
93
|
T += E.length;
|
|
94
94
|
}
|
|
95
|
-
m.fullText = k, m.maxFontSize =
|
|
95
|
+
m.fullText = k, m.maxFontSize = x;
|
|
96
96
|
}
|
|
97
97
|
} else
|
|
98
98
|
m = Qe(d, p);
|
|
@@ -107,12 +107,12 @@ function us(g) {
|
|
|
107
107
|
k && Ye.delete(k);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
if (
|
|
110
|
+
if (l > 0 && m && m.widths && !m.indentApplied) {
|
|
111
111
|
const k = [...m.widths], T = m.fullText || d;
|
|
112
|
-
let
|
|
112
|
+
let x = !0;
|
|
113
113
|
for (let P = 0; P < T.length; P++)
|
|
114
|
-
|
|
115
|
-
` || T[P] === "\r") && (
|
|
114
|
+
x && k[P] !== void 0 && (k[P] += l, x = !1), (T[P] === `
|
|
115
|
+
` || T[P] === "\r") && (x = !0, T[P] === "\r" && T[P + 1] === `
|
|
116
116
|
` && P++);
|
|
117
117
|
m = { ...m, widths: k, indentApplied: !0 };
|
|
118
118
|
}
|
|
@@ -125,7 +125,7 @@ function us(g) {
|
|
|
125
125
|
if (a >= 1e5) {
|
|
126
126
|
const T = d.split(/\r\n|\r|\n/);
|
|
127
127
|
C = {
|
|
128
|
-
lines: T.map((
|
|
128
|
+
lines: T.map((x) => ({ text: x, width: 0 })),
|
|
129
129
|
// Width will be measured below
|
|
130
130
|
height: T.length * (S * k),
|
|
131
131
|
lineCount: T.length
|
|
@@ -136,12 +136,12 @@ function us(g) {
|
|
|
136
136
|
r !== 0 && b && (CanvasRenderingContext2D.prototype.measureText = b);
|
|
137
137
|
}
|
|
138
138
|
let w = (C == null ? void 0 : C.height) !== void 0 && C.height > 0 ? C.height : (((M = C == null ? void 0 : C.lines) == null ? void 0 : M.length) || 0) * S * o;
|
|
139
|
-
if (
|
|
139
|
+
if (c > 0 && C && C.lines && C.lines.length > 1) {
|
|
140
140
|
let k = 0;
|
|
141
141
|
const T = m.fullText || t;
|
|
142
|
-
for (let
|
|
143
|
-
k += C.lines[
|
|
144
|
-
` || T[k] === "\r") && (w +=
|
|
142
|
+
for (let x = 0; x < C.lines.length - 1; x++)
|
|
143
|
+
k += C.lines[x].text.length, (T[k] === `
|
|
144
|
+
` || T[k] === "\r") && (w += c, k++, T[k - 1] === "\r" && T[k] === `
|
|
145
145
|
` && k++);
|
|
146
146
|
}
|
|
147
147
|
let I = (C == null ? void 0 : C.lines) || [];
|
|
@@ -160,15 +160,15 @@ function es(g, t, i) {
|
|
|
160
160
|
}
|
|
161
161
|
const e = o.split(/\s+/).filter(Boolean), s = new Array(e.length).fill(0);
|
|
162
162
|
let n = t - (e.length - 1) * i, a = 0;
|
|
163
|
-
if (e.forEach((r,
|
|
163
|
+
if (e.forEach((r, c) => {
|
|
164
164
|
if (r.endsWith("px")) {
|
|
165
|
-
const
|
|
166
|
-
s[
|
|
167
|
-
} else r.endsWith("fr") ? a += parseFloat(r) : r === "auto" && (s[
|
|
165
|
+
const l = parseFloat(r);
|
|
166
|
+
s[c] = l, n -= l;
|
|
167
|
+
} else r.endsWith("fr") ? a += parseFloat(r) : r === "auto" && (s[c] = 100, n -= 100);
|
|
168
168
|
}), a > 0 && n > 0) {
|
|
169
169
|
const r = n / a;
|
|
170
|
-
e.forEach((
|
|
171
|
-
|
|
170
|
+
e.forEach((c, l) => {
|
|
171
|
+
c.endsWith("fr") && (s[l] = r * parseFloat(c));
|
|
172
172
|
});
|
|
173
173
|
}
|
|
174
174
|
return s;
|
|
@@ -182,8 +182,8 @@ function ss(g, t, i) {
|
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
function Es(g, t, i) {
|
|
185
|
-
var E,
|
|
186
|
-
const o = g.autoLayout, { direction: e, spacing: s, padding: n, align: a, wrap: r } = o,
|
|
185
|
+
var E, R;
|
|
186
|
+
const o = g.autoLayout, { direction: e, spacing: s, padding: n, align: a, wrap: r } = o, c = e === "vertical", l = t.map((O) => {
|
|
187
187
|
const W = i(O.id), B = O.geometry;
|
|
188
188
|
let $ = (W == null ? void 0 : W.width) ?? B.width ?? 100, Y = (W == null ? void 0 : W.height) ?? B.height ?? 100;
|
|
189
189
|
if (B.type === "Ellipse" || B.type === "Polygon" || B.type === "Star") {
|
|
@@ -210,46 +210,46 @@ function Es(g, t, i) {
|
|
|
210
210
|
return $ *= O.transform.scale_x || 1, Y *= O.transform.scale_y || 1, { id: O.id, w: $, h: Y, original: O };
|
|
211
211
|
});
|
|
212
212
|
let f = g.width, u = g.height;
|
|
213
|
-
const h = ((E = g.layoutProps) == null ? void 0 : E.width) === "hug", d = ((
|
|
213
|
+
const h = ((E = g.layoutProps) == null ? void 0 : E.width) === "hug", d = ((R = g.layoutProps) == null ? void 0 : R.height) === "hug", p = [];
|
|
214
214
|
let y = [], m = 0, b = 0;
|
|
215
215
|
const v = f - n.left - n.right, S = u - n.top - n.bottom;
|
|
216
|
-
|
|
217
|
-
r && y.length > 0 && (
|
|
218
|
-
}), y.length > 0 && p.push({ children: y, width: m, height: b }), h && !
|
|
216
|
+
l.forEach((O) => {
|
|
217
|
+
r && y.length > 0 && (c ? b + s + O.h > S : m + s + O.w > v) ? (p.push({ children: y, width: m, height: b }), y = [O], m = O.w, b = O.h) : (y.push(O), c ? (m = Math.max(m, O.w), b += (y.length > 1 ? s : 0) + O.h) : (m += (y.length > 1 ? s : 0) + O.w, b = Math.max(b, O.h)));
|
|
218
|
+
}), y.length > 0 && p.push({ children: y, width: m, height: b }), h && !c && (f = Math.max(...p.map((O) => O.width), 0) + n.left + n.right), d && c && (u = Math.max(...p.map((O) => O.height), 0) + n.top + n.bottom);
|
|
219
219
|
const C = [];
|
|
220
220
|
let w = n.left, I = n.top;
|
|
221
|
-
const M = a.toLowerCase(), k = M === "center" || M.endsWith("-center"), T = M.endsWith("-right"),
|
|
221
|
+
const M = a.toLowerCase(), k = M === "center" || M.endsWith("-center"), T = M.endsWith("-right"), x = M === "center" || M.startsWith("center-"), P = M.startsWith("bottom-");
|
|
222
222
|
return p.forEach((O) => {
|
|
223
223
|
let W = w, B = I;
|
|
224
|
-
|
|
224
|
+
c ? x ? B = n.top + (u - n.top - n.bottom - O.height) / 2 : P && (B = u - n.bottom - O.height) : k ? W = n.left + (f - n.left - n.right - O.width) / 2 : T && (W = f - n.right - O.width), O.children.forEach(($) => {
|
|
225
225
|
var _, L;
|
|
226
226
|
let Y = W, H = B;
|
|
227
|
-
|
|
227
|
+
c ? k ? Y += (O.width - $.w) / 2 : T && (Y += O.width - $.w) : x ? H += (O.height - $.h) / 2 : P && (H += O.height - $.h);
|
|
228
228
|
const K = ((_ = $.original.layoutProps) == null ? void 0 : _.width) === "fill", A = ((L = $.original.layoutProps) == null ? void 0 : L.height) === "fill";
|
|
229
229
|
C.push({
|
|
230
230
|
id: $.id,
|
|
231
231
|
x: Y + $.w / 2 - f / 2,
|
|
232
232
|
y: H + $.h / 2 - u / 2,
|
|
233
|
-
width: K &&
|
|
234
|
-
height: A ?
|
|
235
|
-
}),
|
|
236
|
-
}),
|
|
233
|
+
width: K && c ? O.width : void 0,
|
|
234
|
+
height: A ? c ? void 0 : O.height : void 0
|
|
235
|
+
}), c ? B += $.h + s : W += $.w + s;
|
|
236
|
+
}), c ? w += O.width + s : I += O.height + s;
|
|
237
237
|
}), { frameWidth: h ? f : void 0, frameHeight: d ? u : void 0, childUpdates: C };
|
|
238
238
|
}
|
|
239
239
|
function As(g, t, i) {
|
|
240
240
|
const o = g.autoLayout;
|
|
241
241
|
if (!o) return { childUpdates: [] };
|
|
242
|
-
const { gridColumns: e, gridRows: s, columnGap: n = 0, rowGap: a = 0, padding: r, align:
|
|
243
|
-
let
|
|
244
|
-
const u =
|
|
242
|
+
const { gridColumns: e, gridRows: s, columnGap: n = 0, rowGap: a = 0, padding: r, align: c } = o;
|
|
243
|
+
let l = g.width, f = g.height;
|
|
244
|
+
const u = l - r.left - r.right, h = f - r.top - r.bottom, d = es(e || "1fr", u, n), p = es(s || "auto", h, a), y = d.length > 0 ? d.reduce((T, x) => T + x, 0) + (d.length - 1) * n : 0, m = p.length > 0 ? p.reduce((T, x) => T + x, 0) + (p.length - 1) * a : 0, b = c.toLowerCase(), v = b === "center" || b.endsWith("-center"), S = b.endsWith("-right"), C = b === "center" || b.startsWith("center-"), w = b.startsWith("bottom-");
|
|
245
245
|
let I = 0, M = 0;
|
|
246
246
|
v ? I = (u - y) / 2 : S && (I = u - y), C ? M = (h - m) / 2 : w && (M = h - m);
|
|
247
247
|
const k = [];
|
|
248
|
-
return t.forEach((T,
|
|
248
|
+
return t.forEach((T, x) => {
|
|
249
249
|
var L, X;
|
|
250
|
-
const P =
|
|
250
|
+
const P = x % d.length || 0, E = Math.floor(x / d.length) || 0;
|
|
251
251
|
E >= p.length && p.push(100);
|
|
252
|
-
const
|
|
252
|
+
const R = d[P], O = p[E];
|
|
253
253
|
let W = r.left + I + d.slice(0, P).reduce((V, it) => V + it + n, 0), B = r.top + M + p.slice(0, E).reduce((V, it) => V + it + a, 0);
|
|
254
254
|
const $ = i(T.id), Y = T.geometry;
|
|
255
255
|
let H = ($ == null ? void 0 : $.width) ?? Y.width ?? 100, K = ($ == null ? void 0 : $.height) ?? Y.height ?? 100;
|
|
@@ -259,11 +259,11 @@ function As(g, t, i) {
|
|
|
259
259
|
}
|
|
260
260
|
H *= T.transform.scale_x || 1, K *= T.transform.scale_y || 1;
|
|
261
261
|
let A = W, _ = B;
|
|
262
|
-
v ? A += (
|
|
262
|
+
v ? A += (R - H) / 2 : S && (A += R - H), C ? _ += (O - K) / 2 : w && (_ += O - K), k.push({
|
|
263
263
|
id: T.id,
|
|
264
|
-
x: A + H / 2 -
|
|
264
|
+
x: A + H / 2 - l / 2,
|
|
265
265
|
y: _ + K / 2 - f / 2,
|
|
266
|
-
width: ((L = T.layoutProps) == null ? void 0 : L.width) === "fill" ?
|
|
266
|
+
width: ((L = T.layoutProps) == null ? void 0 : L.width) === "fill" ? R : void 0,
|
|
267
267
|
height: ((X = T.layoutProps) == null ? void 0 : X.height) === "fill" ? O : void 0
|
|
268
268
|
});
|
|
269
269
|
}), { childUpdates: k };
|
|
@@ -404,8 +404,8 @@ class Os {
|
|
|
404
404
|
const e = new Jt.Vector2(t.anchorA.x, t.anchorA.y), s = new Jt.Vector2(t.anchorB.x, t.anchorB.y);
|
|
405
405
|
let n;
|
|
406
406
|
if (t.type === "Distance") {
|
|
407
|
-
const a = t.length ?? 100, r = t.stiffness ?? 100,
|
|
408
|
-
n = Jt.JointData.spring(a, r,
|
|
407
|
+
const a = t.length ?? 100, r = t.stiffness ?? 100, c = t.damping ?? 10;
|
|
408
|
+
n = Jt.JointData.spring(a, r, c, e, s);
|
|
409
409
|
} else
|
|
410
410
|
n = Jt.JointData.revolute(e, s);
|
|
411
411
|
try {
|
|
@@ -427,21 +427,21 @@ class Os {
|
|
|
427
427
|
}
|
|
428
428
|
}
|
|
429
429
|
}
|
|
430
|
-
const ps = (g) => g,
|
|
430
|
+
const ps = (g) => g, xs = (g) => g > 0 ? 1 : 0, Rs = (g) => g < 1 ? 0 : 1, is = (g) => g * g, ns = (g) => g * (2 - g), os = (g) => g < 0.5 ? 2 * g * g : -1 + (4 - 2 * g) * g, Ls = (g) => g * g * g, Fs = (g) => --g * g * g + 1, $s = (g) => g < 0.5 ? 4 * g * g * g : (g - 1) * (2 * g - 2) * (2 * g - 2) + 1, Ws = (g) => g * g * g * g, Bs = (g) => 1 - --g * g * g * g, Ys = (g) => g < 0.5 ? 8 * g * g * g * g : 1 - 8 * --g * g * g * g, Xs = (g) => g * g * g * g * g, Gs = (g) => 1 + --g * g * g * g * g, Ds = (g) => g < 0.5 ? 16 * g * g * g * g * g : 1 + 16 * --g * g * g * g * g, zs = (g) => 1 - Math.cos(g * Math.PI / 2), Vs = (g) => Math.sin(g * Math.PI / 2), Ns = (g) => -(Math.cos(Math.PI * g) - 1) / 2, Hs = (g) => g === 0 ? 0 : Math.pow(2, 10 * (g - 1)), Us = (g) => g === 1 ? 1 : 1 - Math.pow(2, -10 * g), qs = (g) => g === 0 ? 0 : g === 1 ? 1 : g < 0.5 ? Math.pow(2, 20 * g - 10) / 2 : (2 - Math.pow(2, -20 * g + 10)) / 2, Js = (g) => 1 - Math.sqrt(1 - g * g), Qs = (g) => Math.sqrt(1 - --g * g), Ks = (g) => g < 0.5 ? (1 - Math.sqrt(1 - 4 * g * g)) / 2 : (Math.sqrt(1 - (-2 * g + 2) * (-2 * g + 2)) + 1) / 2, Je = 1.70158, He = Je * 1.525, gs = Je + 1, Zs = (g) => gs * g * g * g - Je * g * g, js = (g) => 1 + gs * Math.pow(g - 1, 3) + Je * Math.pow(g - 1, 2), ti = (g) => g < 0.5 ? Math.pow(2 * g, 2) * ((He + 1) * 2 * g - He) / 2 : (Math.pow(2 * g - 2, 2) * ((He + 1) * (g * 2 - 2) + He) + 2) / 2, ms = 2 * Math.PI / 3, as = 2 * Math.PI / 4.5, ei = (g) => g === 0 ? 0 : g === 1 ? 1 : -Math.pow(2, 10 * g - 10) * Math.sin((g * 10 - 10.75) * ms), si = (g) => g === 0 ? 0 : g === 1 ? 1 : Math.pow(2, -10 * g) * Math.sin((g * 10 - 0.75) * ms) + 1, ii = (g) => g === 0 ? 0 : g === 1 ? 1 : g < 0.5 ? -(Math.pow(2, 20 * g - 10) * Math.sin((20 * g - 11.125) * as)) / 2 : Math.pow(2, -20 * g + 10) * Math.sin((20 * g - 11.125) * as) / 2 + 1, qe = (g) => g < 1 / 2.75 ? 7.5625 * g * g : g < 2 / 2.75 ? 7.5625 * (g -= 1.5 / 2.75) * g + 0.75 : g < 2.5 / 2.75 ? 7.5625 * (g -= 2.25 / 2.75) * g + 0.9375 : 7.5625 * (g -= 2.625 / 2.75) * g + 0.984375, ni = (g) => 1 - qe(1 - g), oi = qe, ai = (g) => g < 0.5 ? (1 - qe(1 - 2 * g)) / 2 : (1 + qe(2 * g - 1)) / 2, Ke = /* @__PURE__ */ new Map(), Xe = (g, t, i, o) => {
|
|
431
431
|
const e = `${g},${t},${i},${o}`;
|
|
432
432
|
if (Ke.has(e)) return Ke.get(e);
|
|
433
|
-
const s = (
|
|
434
|
-
let f =
|
|
433
|
+
const s = (l) => (1 - 3 * i + 3 * g) * l * l * l + (3 * i - 6 * g) * l * l + 3 * g * l, n = (l) => (1 - 3 * o + 3 * t) * l * l * l + (3 * o - 6 * t) * l * l + 3 * t * l, a = (l) => 3 * (1 - 3 * i + 3 * g) * l * l + 2 * (3 * i - 6 * g) * l + 3 * g, r = (l) => {
|
|
434
|
+
let f = l;
|
|
435
435
|
for (let u = 0; u < 8; u++) {
|
|
436
|
-
const h = s(f) -
|
|
436
|
+
const h = s(f) - l;
|
|
437
437
|
if (Math.abs(h) < 1e-6) return f;
|
|
438
438
|
const d = a(f);
|
|
439
439
|
if (Math.abs(d) < 1e-6) break;
|
|
440
440
|
f = f - h / d;
|
|
441
441
|
}
|
|
442
442
|
return f;
|
|
443
|
-
},
|
|
444
|
-
return Ke.set(e,
|
|
443
|
+
}, c = (l) => l === 0 ? 0 : l === 1 ? 1 : n(r(l));
|
|
444
|
+
return Ke.set(e, c), c;
|
|
445
445
|
}, rs = (g) => {
|
|
446
446
|
const t = g.match(/cubic-bezier\s*\(\s*([-?\d.]+)\s*,\s*([-?\d.]+)\s*,\s*([-?\d.]+)\s*,\s*([-?\d.]+)\s*\)/);
|
|
447
447
|
if (!t) return null;
|
|
@@ -500,8 +500,8 @@ const ps = (g) => g, Rs = (g) => g > 0 ? 1 : 0, xs = (g) => g < 1 ? 0 : 1, is =
|
|
|
500
500
|
EaseOut: ns,
|
|
501
501
|
EaseInOut: os,
|
|
502
502
|
// Discrete
|
|
503
|
-
StepStart:
|
|
504
|
-
StepEnd:
|
|
503
|
+
StepStart: xs,
|
|
504
|
+
StepEnd: Rs
|
|
505
505
|
}, ri = (g) => {
|
|
506
506
|
const t = g.trim(), i = t.toLowerCase();
|
|
507
507
|
if (Ue[t]) return Ue[t];
|
|
@@ -572,10 +572,10 @@ const ps = (g) => g, Rs = (g) => g > 0 ? 1 : 0, xs = (g) => g < 1 ? 0 : 1, is =
|
|
|
572
572
|
}
|
|
573
573
|
}, li = (g, t, i, o, e) => {
|
|
574
574
|
if (!g || !t || !i) return g;
|
|
575
|
-
const s = o.scale_x ?? 1, n = o.scale_y ?? 1, a = (r,
|
|
575
|
+
const s = o.scale_x ?? 1, n = o.scale_y ?? 1, a = (r, c, l) => {
|
|
576
576
|
let f = 0, u = 0;
|
|
577
|
-
const h = o.rotation * Math.PI / 180, d = Math.cos(h), p = Math.sin(h), y = r * s * d -
|
|
578
|
-
|
|
577
|
+
const h = o.rotation * Math.PI / 180, d = Math.cos(h), p = Math.sin(h), y = r * s * d - c * n * p + o.x, m = r * s * p + c * n * d + o.y;
|
|
578
|
+
l.forEach((M) => {
|
|
579
579
|
const k = e(M.boneId);
|
|
580
580
|
if (!k) return;
|
|
581
581
|
const T = {
|
|
@@ -584,30 +584,30 @@ const ps = (g) => g, Rs = (g) => g > 0 ? 1 : 0, xs = (g) => g < 1 ? 0 : 1, is =
|
|
|
584
584
|
rotation: k.rotation,
|
|
585
585
|
scaleX: k.scale_x ?? 1,
|
|
586
586
|
scaleY: k.scale_y ?? 1
|
|
587
|
-
},
|
|
587
|
+
}, x = i[M.boneId] || [1, 0, 0, 1, 0, 0], P = y * x[0] + m * x[2] + x[4], E = y * x[1] + m * x[3] + x[5], R = T.rotation * Math.PI / 180, O = Math.cos(R), W = Math.sin(R), B = P * T.scaleX * O - E * T.scaleY * W + T.x, $ = P * T.scaleX * W + E * T.scaleY * O + T.y;
|
|
588
588
|
f += B * M.amount, u += $ * M.amount;
|
|
589
589
|
});
|
|
590
|
-
const b = [...
|
|
590
|
+
const b = [...l].sort((M, k) => k.amount - M.amount);
|
|
591
591
|
if (b.length >= 2 && b[0].amount > 0 && b[1].amount > 0) {
|
|
592
592
|
const M = e(b[0].boneId), k = e(b[1].boneId);
|
|
593
593
|
if (M && k && M.length !== void 0 && k.length !== void 0) {
|
|
594
|
-
const T = M.length * (M.scale_y ?? 1),
|
|
594
|
+
const T = M.length * (M.scale_y ?? 1), x = M.rotation * Math.PI / 180, P = M.x - T * Math.sin(x), E = M.y + T * Math.cos(x), R = k.length * (k.scale_y ?? 1), O = k.rotation * Math.PI / 180, W = k.x - R * Math.sin(O), B = k.y + R * Math.cos(O);
|
|
595
595
|
let $ = null, Y = null, H = !1;
|
|
596
596
|
const K = 1;
|
|
597
597
|
if (Math.hypot(M.x - k.x, M.y - k.y) < K || Math.hypot(M.x - W, M.y - B) < K ? ($ = M.x, Y = M.y) : (Math.hypot(P - k.x, E - k.y) < K || Math.hypot(P - W, E - B) < K) && ($ = P, Y = E, H = !0), $ !== null && Y !== null) {
|
|
598
598
|
const A = i[b[0].boneId] || [1, 0, 0, 1, 0, 0], _ = A[0] * A[3] - A[1] * A[2];
|
|
599
599
|
let L = 0, X = 0;
|
|
600
600
|
if (_ !== 0) {
|
|
601
|
-
const V = (A[2] * A[5] - A[3] * A[4]) / _, it = (A[1] * A[4] - A[0] * A[5]) / _,
|
|
601
|
+
const V = (A[2] * A[5] - A[3] * A[4]) / _, it = (A[1] * A[4] - A[0] * A[5]) / _, lt = Math.atan2(-A[1], A[3]);
|
|
602
602
|
if (!H)
|
|
603
603
|
L = V, X = it;
|
|
604
604
|
else {
|
|
605
|
-
const
|
|
606
|
-
L = V - It * Math.sin(
|
|
605
|
+
const ht = -A[2] / _, wt = A[0] / _, Mt = Math.hypot(ht, wt), It = M.length * Mt;
|
|
606
|
+
L = V - It * Math.sin(lt), X = it + It * Math.cos(lt);
|
|
607
607
|
}
|
|
608
|
-
const nt = Math.hypot(y - L, m - X),
|
|
609
|
-
if (
|
|
610
|
-
const
|
|
608
|
+
const nt = Math.hypot(y - L, m - X), bt = Math.hypot(f - $, u - Y);
|
|
609
|
+
if (bt > 0 && nt > 0) {
|
|
610
|
+
const ht = Math.max(bt, 0.01), wt = Math.min(nt / ht, 3), Mt = $ + (f - $) * wt, It = Y + (u - Y) * wt, Ot = b[0].amount, At = b[1].amount, Tt = Math.min(Ot, At) * 2, zt = 1 - Math.pow(1 - Tt, 4);
|
|
611
611
|
f = f * (1 - zt) + Mt * zt, u = u * (1 - zt) + It * zt;
|
|
612
612
|
}
|
|
613
613
|
}
|
|
@@ -620,16 +620,16 @@ const ps = (g) => g, Rs = (g) => g > 0 ? 1 : 0, xs = (g) => g < 1 ? 0 : 1, is =
|
|
|
620
620
|
y: (-w * C + I * S) / n
|
|
621
621
|
};
|
|
622
622
|
};
|
|
623
|
-
return g.map((r,
|
|
624
|
-
const
|
|
625
|
-
if (!
|
|
626
|
-
const f = { ...r, ...a(r.x, r.y,
|
|
623
|
+
return g.map((r, c) => {
|
|
624
|
+
const l = t[c];
|
|
625
|
+
if (!l || l.length === 0) return { ...r };
|
|
626
|
+
const f = { ...r, ...a(r.x, r.y, l) };
|
|
627
627
|
if (r.in_x !== void 0 && r.in_y !== void 0) {
|
|
628
|
-
const u = a(r.in_x, r.in_y,
|
|
628
|
+
const u = a(r.in_x, r.in_y, l);
|
|
629
629
|
f.in_x = u.x, f.in_y = u.y;
|
|
630
630
|
}
|
|
631
631
|
if (r.out_x !== void 0 && r.out_y !== void 0) {
|
|
632
|
-
const u = a(r.out_x, r.out_y,
|
|
632
|
+
const u = a(r.out_x, r.out_y, l);
|
|
633
633
|
f.out_x = u.x, f.out_y = u.y;
|
|
634
634
|
}
|
|
635
635
|
return f;
|
|
@@ -905,7 +905,7 @@ class ci {
|
|
|
905
905
|
}
|
|
906
906
|
svgPathToPoints(t) {
|
|
907
907
|
const i = /([MLHVCSQTAZmlhvcsqtaz])([^MLHVCSQTAZmlhvcsqtaz]*)/g, o = /[-+]?(?:\d*\.\d+|\d+)(?:[eE][-+]?\d+)?/g, e = [];
|
|
908
|
-
let s = !1, n = 0, a = 0, r = 0,
|
|
908
|
+
let s = !1, n = 0, a = 0, r = 0, c = 0, l = 0, f = 0, u;
|
|
909
909
|
for (; (u = i.exec(t)) !== null; ) {
|
|
910
910
|
const h = u[1], d = (u[2].match(o) || []).map(parseFloat), p = h === h.toLowerCase(), y = h.toUpperCase();
|
|
911
911
|
let m = 0;
|
|
@@ -916,7 +916,7 @@ class ci {
|
|
|
916
916
|
switch (y) {
|
|
917
917
|
case "M": {
|
|
918
918
|
const S = v();
|
|
919
|
-
for (
|
|
919
|
+
for (l = n = S.x, f = a = S.y, e.push({ x: n, y: a, in_x: n, in_y: a, out_x: n, out_y: a, moveTo: !0 }); m < d.length; ) {
|
|
920
920
|
const C = v();
|
|
921
921
|
n = C.x, a = C.y, e.push({ x: n, y: a, in_x: n, in_y: a, out_x: n, out_y: a });
|
|
922
922
|
}
|
|
@@ -943,17 +943,17 @@ class ci {
|
|
|
943
943
|
const I = e[e.length - 1];
|
|
944
944
|
I.out_x = S.x, I.out_y = S.y;
|
|
945
945
|
}
|
|
946
|
-
n = w.x, a = w.y, e.push({ x: n, y: a, in_x: C.x, in_y: C.y, out_x: n, out_y: a }), r = C.x,
|
|
946
|
+
n = w.x, a = w.y, e.push({ x: n, y: a, in_x: C.x, in_y: C.y, out_x: n, out_y: a }), r = C.x, c = C.y;
|
|
947
947
|
}
|
|
948
948
|
break;
|
|
949
949
|
case "S":
|
|
950
950
|
for (; m < d.length; ) {
|
|
951
|
-
const S = { x: 2 * n - r, y: 2 * a -
|
|
951
|
+
const S = { x: 2 * n - r, y: 2 * a - c }, C = v(), w = v();
|
|
952
952
|
if (e.length > 0) {
|
|
953
953
|
const I = e[e.length - 1];
|
|
954
954
|
I.out_x = S.x, I.out_y = S.y;
|
|
955
955
|
}
|
|
956
|
-
n = w.x, a = w.y, e.push({ x: n, y: a, in_x: C.x, in_y: C.y, out_x: n, out_y: a }), r = C.x,
|
|
956
|
+
n = w.x, a = w.y, e.push({ x: n, y: a, in_x: C.x, in_y: C.y, out_x: n, out_y: a }), r = C.x, c = C.y;
|
|
957
957
|
}
|
|
958
958
|
break;
|
|
959
959
|
case "Q":
|
|
@@ -963,17 +963,17 @@ class ci {
|
|
|
963
963
|
const w = e[e.length - 1];
|
|
964
964
|
w.out_x = w.x + 2 / 3 * (S.x - w.x), w.out_y = w.y + 2 / 3 * (S.y - w.y);
|
|
965
965
|
}
|
|
966
|
-
n = C.x, a = C.y, e.push({ x: n, y: a, in_x: n + 2 / 3 * (S.x - n), in_y: a + 2 / 3 * (S.y - a), out_x: n, out_y: a }), r = S.x,
|
|
966
|
+
n = C.x, a = C.y, e.push({ x: n, y: a, in_x: n + 2 / 3 * (S.x - n), in_y: a + 2 / 3 * (S.y - a), out_x: n, out_y: a }), r = S.x, c = S.y;
|
|
967
967
|
}
|
|
968
968
|
break;
|
|
969
969
|
case "T":
|
|
970
970
|
for (; m < d.length; ) {
|
|
971
|
-
const S = { x: 2 * n - r, y: 2 * a -
|
|
971
|
+
const S = { x: 2 * n - r, y: 2 * a - c }, C = v();
|
|
972
972
|
if (e.length > 0) {
|
|
973
973
|
const w = e[e.length - 1];
|
|
974
974
|
w.out_x = w.x + 2 / 3 * (S.x - w.x), w.out_y = w.y + 2 / 3 * (S.y - w.y);
|
|
975
975
|
}
|
|
976
|
-
n = C.x, a = C.y, e.push({ x: n, y: a, in_x: n + 2 / 3 * (S.x - n), in_y: a + 2 / 3 * (S.y - a), out_x: n, out_y: a }), r = S.x,
|
|
976
|
+
n = C.x, a = C.y, e.push({ x: n, y: a, in_x: n + 2 / 3 * (S.x - n), in_y: a + 2 / 3 * (S.y - a), out_x: n, out_y: a }), r = S.x, c = S.y;
|
|
977
977
|
}
|
|
978
978
|
break;
|
|
979
979
|
case "Z":
|
|
@@ -983,7 +983,7 @@ class ci {
|
|
|
983
983
|
const C = [...e].reverse().find((w) => w.moveTo) || e[0];
|
|
984
984
|
C && Math.hypot(C.x - S.x, C.y - S.y) < 0.1 && (C.in_x = S.in_x, C.in_y = S.in_y, e.pop(), e.length > 0 && (e[e.length - 1].closePath = !0));
|
|
985
985
|
}
|
|
986
|
-
n =
|
|
986
|
+
n = l, a = f;
|
|
987
987
|
break;
|
|
988
988
|
default:
|
|
989
989
|
if (d.length >= 2) {
|
|
@@ -1060,20 +1060,20 @@ class ci {
|
|
|
1060
1060
|
if (!t) return;
|
|
1061
1061
|
let i = this.decompressStrings(t);
|
|
1062
1062
|
const o = [], e = /* @__PURE__ */ new Set(), s = (r) => {
|
|
1063
|
-
r && r.forEach((
|
|
1064
|
-
if (e.has(
|
|
1065
|
-
const
|
|
1066
|
-
e.add(
|
|
1063
|
+
r && r.forEach((c) => {
|
|
1064
|
+
if (e.has(c.id)) return;
|
|
1065
|
+
const l = { ...c }, f = l.childrenObjects || [];
|
|
1066
|
+
e.add(l.id), o.push(l), s(f);
|
|
1067
1067
|
});
|
|
1068
1068
|
};
|
|
1069
1069
|
if (s(i.objects || []), o.length > (i.objects || []).length && this.log(`[Engine] Flattened artboard from ${(i.objects || []).length} to ${o.length} objects.`), i.objects = o, this.artboard = i, this.currentTime = 0, this.objectStates.clear(), this.log(`[ExodeUIEngine] Loading artboard: "${(n = this.artboard) == null ? void 0 : n.name}" with ${(a = this.artboard) == null ? void 0 : a.objects.length} objects`), this.artboard && this.artboard.objects) {
|
|
1070
1070
|
const r = /* @__PURE__ */ new Map();
|
|
1071
|
-
this.artboard.objects.forEach((
|
|
1072
|
-
r.set(
|
|
1073
|
-
}), this.artboard.objects.forEach((
|
|
1074
|
-
if (
|
|
1075
|
-
const
|
|
1076
|
-
|
|
1071
|
+
this.artboard.objects.forEach((c) => {
|
|
1072
|
+
r.set(c.id, c), c.children || (c.children = []);
|
|
1073
|
+
}), this.artboard.objects.forEach((c) => {
|
|
1074
|
+
if (c.parentId) {
|
|
1075
|
+
const l = r.get(c.parentId);
|
|
1076
|
+
l && (l.children || (l.children = []), l.children.includes(c.id) || l.children.push(c.id));
|
|
1077
1077
|
}
|
|
1078
1078
|
});
|
|
1079
1079
|
}
|
|
@@ -1123,11 +1123,11 @@ class ci {
|
|
|
1123
1123
|
reset() {
|
|
1124
1124
|
if (!this.artboard) return;
|
|
1125
1125
|
if (this.objectStates.clear(), this.objectVelocities.clear(), this.currentTime = 0, this.inputs.clear(), this.inputNameMap.clear(), this.layerStates.clear(), this.logicNodeValues.clear(), this.justFiredTriggers.clear(), this.inputs.set("mouseX", 0), this.inputs.set("mouseY", 0), this.inputs.set("scrollX", 0), this.inputs.set("scrollY", 0), this.inputs.set("isMouseDown", !1), this.physicsEngine && (this.physicsEngine.destroy(), this.physicsEngine = null), this._layoutAnimCache.clear(), this._springChainState.clear(), this._emitterPools.clear(), this.artboard.objects.forEach((i) => {
|
|
1126
|
-
var n, a, r,
|
|
1127
|
-
const o = i.width ?? ((n = i.geometry) == null ? void 0 : n.width) ?? 0, e = i.height ?? ((a = i.geometry) == null ? void 0 : a.height) ?? 0, s = i.cornerRadius ?? i.corner_radius ?? ((r = i.geometry) == null ? void 0 : r.corner_radius) ?? ((
|
|
1126
|
+
var n, a, r, c, l, f, u;
|
|
1127
|
+
const o = i.width ?? ((n = i.geometry) == null ? void 0 : n.width) ?? 0, e = i.height ?? ((a = i.geometry) == null ? void 0 : a.height) ?? 0, s = i.cornerRadius ?? i.corner_radius ?? ((r = i.geometry) == null ? void 0 : r.corner_radius) ?? ((c = i.geometry) == null ? void 0 : c.cornerRadius) ?? 0;
|
|
1128
1128
|
this.objectStates.set(i.id, {
|
|
1129
1129
|
...i.transform || {},
|
|
1130
|
-
x: ((
|
|
1130
|
+
x: ((l = i.transform) == null ? void 0 : l.x) ?? i.x ?? 0,
|
|
1131
1131
|
y: ((f = i.transform) == null ? void 0 : f.y) ?? i.y ?? 0,
|
|
1132
1132
|
width: o,
|
|
1133
1133
|
height: e,
|
|
@@ -1164,14 +1164,14 @@ class ci {
|
|
|
1164
1164
|
if ((s = e.physics) != null && s.enabled && e.type === "Shape") {
|
|
1165
1165
|
const a = this.objectStates.get(e.id);
|
|
1166
1166
|
if (!a) return;
|
|
1167
|
-
const r = e.geometry.width || 100,
|
|
1167
|
+
const r = e.geometry.width || 100, c = e.geometry.height || 100;
|
|
1168
1168
|
this.physicsEngine.createBody({
|
|
1169
1169
|
id: e.id,
|
|
1170
1170
|
type: ((n = e.geometry) == null ? void 0 : n.type) || "Rectangle",
|
|
1171
1171
|
x: a.x,
|
|
1172
1172
|
y: a.y,
|
|
1173
1173
|
width: r,
|
|
1174
|
-
height:
|
|
1174
|
+
height: c,
|
|
1175
1175
|
rotation: a.rotation * (Math.PI / 180),
|
|
1176
1176
|
// Convert deg to rad
|
|
1177
1177
|
isStatic: e.physics.bodyType === "Static",
|
|
@@ -1208,8 +1208,8 @@ class ci {
|
|
|
1208
1208
|
n.forEach((a) => {
|
|
1209
1209
|
const r = this.objectStates.get(a.id);
|
|
1210
1210
|
if (r) {
|
|
1211
|
-
const
|
|
1212
|
-
!t && (
|
|
1211
|
+
const c = Math.abs(r.x - a.x), l = Math.abs(r.y - a.y);
|
|
1212
|
+
!t && (c > 20 || l > 20) ? (r.x += (a.x - r.x) * o, r.y += (a.y - r.y) * o) : (r.x = a.x, r.y = a.y), a.width !== void 0 && (r.width = a.width), a.height !== void 0 && (r.height = a.height);
|
|
1213
1213
|
}
|
|
1214
1214
|
});
|
|
1215
1215
|
};
|
|
@@ -1220,10 +1220,10 @@ class ci {
|
|
|
1220
1220
|
this.artboard.objects.forEach((n) => {
|
|
1221
1221
|
var a;
|
|
1222
1222
|
if (n.type === "Frame" && ((a = n.autoLayout) != null && a.enabled) && n.children && n.children.length > 0) {
|
|
1223
|
-
const r = n.children.map((f) => i.get(f)).filter((f) => !!f),
|
|
1224
|
-
if (!
|
|
1225
|
-
const
|
|
1226
|
-
|
|
1223
|
+
const r = n.children.map((f) => i.get(f)).filter((f) => !!f), c = this.objectStates.get(n.id);
|
|
1224
|
+
if (!c) return;
|
|
1225
|
+
const l = ss(c, r, (f) => this.objectStates.get(f));
|
|
1226
|
+
l.frameWidth !== void 0 && (c.width = l.frameWidth), l.frameHeight !== void 0 && (c.height = l.frameHeight), e(l.childUpdates);
|
|
1227
1227
|
}
|
|
1228
1228
|
});
|
|
1229
1229
|
}
|
|
@@ -1274,21 +1274,21 @@ class ci {
|
|
|
1274
1274
|
const a = this.activeStateMachine.layers.find((r) => r.name === t);
|
|
1275
1275
|
if (a)
|
|
1276
1276
|
for (const r of i) {
|
|
1277
|
-
const
|
|
1278
|
-
if (
|
|
1279
|
-
if (
|
|
1280
|
-
e.push({ animation: null, state:
|
|
1281
|
-
const f = this.artboard.animations.find((u) => u.id ===
|
|
1277
|
+
const c = a.states.find((l) => l.id === r);
|
|
1278
|
+
if (c)
|
|
1279
|
+
if (c.isBlendState && c.blendAnimations && c.blendAnimations.length > 0)
|
|
1280
|
+
e.push({ animation: null, state: c }), c.blendAnimations.forEach((l) => {
|
|
1281
|
+
const f = this.artboard.animations.find((u) => u.id === l.animationId);
|
|
1282
1282
|
f && (s = Math.max(s, f.duration));
|
|
1283
1283
|
});
|
|
1284
1284
|
else {
|
|
1285
|
-
let
|
|
1286
|
-
|
|
1285
|
+
let l = null;
|
|
1286
|
+
c.animationId && (l = this.artboard.animations.find((f) => f.id === c.animationId) || null), l || (l = this.artboard.animations.find(
|
|
1287
1287
|
(f) => {
|
|
1288
1288
|
var u, h;
|
|
1289
|
-
return f.name ===
|
|
1289
|
+
return f.name === c.name || f.id === c.name || (c.name === "Entry" || c.id === "entry") && (((u = f.name) == null ? void 0 : u.toLowerCase()) === "onload" || ((h = f.name) == null ? void 0 : h.toLowerCase()) === "intro");
|
|
1290
1290
|
}
|
|
1291
|
-
) || null),
|
|
1291
|
+
) || null), l && ((n = this.artboard.animationFlow) != null && n.some((u) => (u.trigger === "on_load" || u.trigger === "after_delay") && u.targetAnimationId === (l == null ? void 0 : l.id)) || (e.push({ animation: l, state: c }), s = Math.max(s, l.duration)));
|
|
1292
1292
|
}
|
|
1293
1293
|
}
|
|
1294
1294
|
}
|
|
@@ -1334,22 +1334,22 @@ class ci {
|
|
|
1334
1334
|
var n, a, r;
|
|
1335
1335
|
let o;
|
|
1336
1336
|
if (this.inputs.has(t)) {
|
|
1337
|
-
const
|
|
1338
|
-
|
|
1337
|
+
const c = (n = this.activeStateMachine) == null ? void 0 : n.inputs.find((l) => l.id === t);
|
|
1338
|
+
c && typeof c.value == "object" && (o = c.value.type);
|
|
1339
1339
|
} else {
|
|
1340
|
-
const
|
|
1341
|
-
if (
|
|
1342
|
-
const
|
|
1343
|
-
|
|
1340
|
+
const c = this.inputNameMap.get(t);
|
|
1341
|
+
if (c && c.length > 0) {
|
|
1342
|
+
const l = (a = this.activeStateMachine) == null ? void 0 : a.inputs.find((f) => f.id === c[0]);
|
|
1343
|
+
l && typeof l.value == "object" && (o = l.value.type);
|
|
1344
1344
|
}
|
|
1345
1345
|
}
|
|
1346
1346
|
let e = i;
|
|
1347
1347
|
o === "Trigger" && (i === 1 ? e = !0 : i === 0 && (e = !1)), this.inputs.has(t) && this.setInternalInput(t, e);
|
|
1348
1348
|
const s = this.inputNameMap.get(t);
|
|
1349
|
-
s && s.forEach((
|
|
1350
|
-
if (
|
|
1351
|
-
const
|
|
1352
|
-
|
|
1349
|
+
s && s.forEach((c) => this.setInternalInput(c, e)), o === "Trigger" && e === !0 && (this.justFiredTriggers.add(t), s && s.forEach((c) => this.justFiredTriggers.add(c))), Array.isArray(e) && ((r = this.artboard) == null || r.objects.forEach((c) => {
|
|
1350
|
+
if (c.inputId === t || c.name === t) {
|
|
1351
|
+
const l = this.objectStates.get(c.id);
|
|
1352
|
+
l && l.options && (c.type === "ListView" || c.variant === "listview" ? l.options.items = e : (c.type === "Dropdown" || c.variant === "dropdown") && (l.options.optionsList = e));
|
|
1353
1353
|
}
|
|
1354
1354
|
})), this.evaluateTransitions(), this.evaluateVariableTriggers(t, e);
|
|
1355
1355
|
}
|
|
@@ -1359,42 +1359,42 @@ class ci {
|
|
|
1359
1359
|
o.forEach((s) => {
|
|
1360
1360
|
if (s.trigger === "variable" && s.conditionVariableId && s.targetAnimationId && (s.conditionVariableId === t || e && e.includes(s.conditionVariableId))) {
|
|
1361
1361
|
const a = s.conditionOperator || "IsTrue", r = s.conditionValue;
|
|
1362
|
-
let
|
|
1362
|
+
let c = !1;
|
|
1363
1363
|
switch (a) {
|
|
1364
1364
|
case "Equal":
|
|
1365
1365
|
case "==":
|
|
1366
|
-
|
|
1366
|
+
c = i == r;
|
|
1367
1367
|
break;
|
|
1368
1368
|
case "NotEqual":
|
|
1369
1369
|
case "!=":
|
|
1370
|
-
|
|
1370
|
+
c = i != r;
|
|
1371
1371
|
break;
|
|
1372
1372
|
case "GreaterThan":
|
|
1373
1373
|
case ">":
|
|
1374
|
-
|
|
1374
|
+
c = i > r;
|
|
1375
1375
|
break;
|
|
1376
1376
|
case "LessThan":
|
|
1377
1377
|
case "<":
|
|
1378
|
-
|
|
1378
|
+
c = i < r;
|
|
1379
1379
|
break;
|
|
1380
1380
|
case "GreaterEqual":
|
|
1381
1381
|
case ">=":
|
|
1382
|
-
|
|
1382
|
+
c = i >= r;
|
|
1383
1383
|
break;
|
|
1384
1384
|
case "LessEqual":
|
|
1385
1385
|
case "<=":
|
|
1386
|
-
|
|
1386
|
+
c = i <= r;
|
|
1387
1387
|
break;
|
|
1388
1388
|
case "IsTrue":
|
|
1389
|
-
|
|
1389
|
+
c = !!i;
|
|
1390
1390
|
break;
|
|
1391
1391
|
case "IsFalse":
|
|
1392
|
-
|
|
1392
|
+
c = !i;
|
|
1393
1393
|
break;
|
|
1394
1394
|
}
|
|
1395
|
-
if (
|
|
1396
|
-
const
|
|
1397
|
-
|
|
1395
|
+
if (c) {
|
|
1396
|
+
const l = s.delay || 0;
|
|
1397
|
+
l <= 0 ? this.triggerGlobalAnimation(s.targetAnimationId, s.subAnimationIds, s.loop, s.id) : setTimeout(() => this.triggerGlobalAnimation(s.targetAnimationId, s.subAnimationIds, s.loop, s.id), l);
|
|
1398
1398
|
}
|
|
1399
1399
|
}
|
|
1400
1400
|
});
|
|
@@ -1417,7 +1417,7 @@ class ci {
|
|
|
1417
1417
|
const s = this.findGlobalTransition(t, i.currentStateIds);
|
|
1418
1418
|
s && (o.length = 0, o.push(s.targetStateId), e = !0, s.conditions && (s.conditions || []).forEach((n) => {
|
|
1419
1419
|
var r;
|
|
1420
|
-
const a = (r = this.activeStateMachine) == null ? void 0 : r.inputs.find((
|
|
1420
|
+
const a = (r = this.activeStateMachine) == null ? void 0 : r.inputs.find((c) => c.id === n.inputId);
|
|
1421
1421
|
a && typeof a.value == "object" && a.value.type === "Trigger" && this.setInternalInput(n.inputId, !1);
|
|
1422
1422
|
}));
|
|
1423
1423
|
}
|
|
@@ -1494,7 +1494,7 @@ class ci {
|
|
|
1494
1494
|
});
|
|
1495
1495
|
}
|
|
1496
1496
|
evaluateLogicTree(t, i = null, o = /* @__PURE__ */ new Set()) {
|
|
1497
|
-
var a, r,
|
|
1497
|
+
var a, r, c, l, f, u;
|
|
1498
1498
|
if (o.has(t))
|
|
1499
1499
|
return this.inputs.get(t) ?? this.logicNodeValues.get(t) ?? 0;
|
|
1500
1500
|
o.add(t);
|
|
@@ -1704,7 +1704,7 @@ class ci {
|
|
|
1704
1704
|
}
|
|
1705
1705
|
case St.SPRING_PULL: {
|
|
1706
1706
|
const p = h("objectId", ""), y = h("forceX", 0), m = h("forceY", 0);
|
|
1707
|
-
p && ((
|
|
1707
|
+
p && ((c = this.artboard) == null || c.objects.forEach((b) => {
|
|
1708
1708
|
b.behaviors && b.behaviors.forEach((v) => {
|
|
1709
1709
|
var S;
|
|
1710
1710
|
if (v.type === N.SpringChain && ((S = v.settings) != null && S.connections) && (v.settings.connections.some((w) => w.targetId === p) || b.id === p)) {
|
|
@@ -1741,7 +1741,7 @@ class ci {
|
|
|
1741
1741
|
}
|
|
1742
1742
|
case St.EMIT: {
|
|
1743
1743
|
const p = h("objectId", ""), y = h("count", 20);
|
|
1744
|
-
p && ((
|
|
1744
|
+
p && ((l = this.artboard) == null || l.objects.forEach((m) => {
|
|
1745
1745
|
m.behaviors && m.behaviors.forEach((b) => {
|
|
1746
1746
|
b.type === N.ParticleEmitter && m.id === p && (b._pendingBurst = (b._pendingBurst || 0) + y);
|
|
1747
1747
|
});
|
|
@@ -1837,11 +1837,11 @@ class ci {
|
|
|
1837
1837
|
}), i.forEach((o) => {
|
|
1838
1838
|
this.layerStates.delete(o), this.debugLog(`[Engine] Cleaned up completed global layer: ${o}`);
|
|
1839
1839
|
}), this.solveConstraints(t), this.solveBehaviors(t), this.activeTriggers.forEach((o, e) => {
|
|
1840
|
-
var s, n, a, r,
|
|
1840
|
+
var s, n, a, r, c, l, f;
|
|
1841
1841
|
if (o.phase === "entry")
|
|
1842
1842
|
o.time += t, o.time >= o.animation.duration && ((a = (n = (s = this.artboard) == null ? void 0 : s.objects.find((u) => u.id === e)) == null ? void 0 : n.triggers) == null || a.find((u) => u.id === o.triggerId), o.phase = "hold", o.elapsedHold = 0, o.time = o.animation.duration), this.applyAnimation(o.animation, o.time, o.filterObjectIds || o.filterObjectId || void 0);
|
|
1843
1843
|
else if (o.phase === "hold") {
|
|
1844
|
-
const u = (
|
|
1844
|
+
const u = (l = (c = (r = this.artboard) == null ? void 0 : r.objects.find((p) => p.id === e)) == null ? void 0 : c.triggers) == null ? void 0 : l.find((p) => p.id === o.triggerId), h = (u == null ? void 0 : u.duration) || 0;
|
|
1845
1845
|
o.elapsedHold += t * 1e3;
|
|
1846
1846
|
let d = o.elapsedHold >= h;
|
|
1847
1847
|
if ((u == null ? void 0 : u.eventType) === "hover" && !this.activeHoverIds.has(e) && (d = !0), ((u == null ? void 0 : u.eventType) === "onHold" || (u == null ? void 0 : u.eventType) === "pointerDown") && !this.isMouseDown && (d = !0), d)
|
|
@@ -1860,7 +1860,7 @@ class ci {
|
|
|
1860
1860
|
if (o && o.isEnabled && o.triggerType === "visible") {
|
|
1861
1861
|
const a = this.objectStates.get(i.id);
|
|
1862
1862
|
if (a && a.visible !== !1) {
|
|
1863
|
-
const r = this.getGlobalTransform(i.id),
|
|
1863
|
+
const r = this.getGlobalTransform(i.id), c = (((s = i.geometry) == null ? void 0 : s.width) || 100) * (r.scale_x || 1), l = (((n = i.geometry) == null ? void 0 : n.height) || 100) * (r.scale_y || 1), f = 50, u = r.x + c / 2 >= -this.canvasWidth / 2 - f && r.x - c / 2 <= this.canvasWidth / 2 + f && r.y + l / 2 >= -this.canvasHeight / 2 - f && r.y - l / 2 <= this.canvasHeight / 2 + f, h = `analytics_${i.id}`, d = this.wasInView.has(h);
|
|
1864
1864
|
u && !d && this.fireAnalyticsEvent(i.id, "visible"), u ? this.wasInView.add(h) : this.wasInView.delete(h);
|
|
1865
1865
|
}
|
|
1866
1866
|
}
|
|
@@ -1869,7 +1869,7 @@ class ci {
|
|
|
1869
1869
|
o.length !== 0 && o.forEach((e) => {
|
|
1870
1870
|
const s = e.triggers || [e.event || e.trigger];
|
|
1871
1871
|
s && s.forEach((n) => {
|
|
1872
|
-
var r,
|
|
1872
|
+
var r, c, l;
|
|
1873
1873
|
const a = n.toLowerCase();
|
|
1874
1874
|
if (a === "on interval" || a === "oninterval") {
|
|
1875
1875
|
const f = e.intervalValue || 2e3, u = this.periodicTriggerTimes.get(e.id) || 0;
|
|
@@ -1882,12 +1882,12 @@ class ci {
|
|
|
1882
1882
|
if (a === "scroll into view" || a === "scrollintoview") {
|
|
1883
1883
|
const f = this.objectStates.get(i.id);
|
|
1884
1884
|
if (f && f.visible !== !1) {
|
|
1885
|
-
const u = this.getGlobalTransform(i.id), h = (((r = i.geometry) == null ? void 0 : r.width) || 100) * (u.scale_x || 1), d = (((
|
|
1885
|
+
const u = this.getGlobalTransform(i.id), h = (((r = i.geometry) == null ? void 0 : r.width) || 100) * (u.scale_x || 1), d = (((c = i.geometry) == null ? void 0 : c.height) || 100) * (u.scale_y || 1), p = 50, y = u.x + h / 2 >= -this.canvasWidth / 2 - p && u.x - h / 2 <= this.canvasWidth / 2 + p && u.y + d / 2 >= -this.canvasHeight / 2 - p && u.y - d / 2 <= this.canvasHeight / 2 + p, m = this.wasInView.has(i.id);
|
|
1886
1886
|
y && !m && (!e.conditions || this.checkConditions(e.conditions)) && this.fireEventForObject(i.id, "Scroll Into View"), y ? this.wasInView.add(i.id) : this.wasInView.delete(i.id);
|
|
1887
1887
|
}
|
|
1888
1888
|
}
|
|
1889
1889
|
if (a === "scroll progress" || a === "scrollprogress") {
|
|
1890
|
-
const f = Math.abs(this.scrollOffset.y) / (((
|
|
1890
|
+
const f = Math.abs(this.scrollOffset.y) / (((l = this.artboard) == null ? void 0 : l.height) || 1e3), u = this.scrollProgressLastValue.get(e.id) || 0;
|
|
1891
1891
|
Math.abs(f - u) > 1e-3 && (this.scrollProgressLastValue.set(e.id, f), (e.action === "Set Input" || e.action === "setInput") && this.updateInput(e.targetInputId, f));
|
|
1892
1892
|
}
|
|
1893
1893
|
});
|
|
@@ -1901,17 +1901,17 @@ class ci {
|
|
|
1901
1901
|
if (!o) return;
|
|
1902
1902
|
const e = this.getGlobalTransform(i.id);
|
|
1903
1903
|
if (i.constraints.forEach((s, n) => {
|
|
1904
|
-
var
|
|
1905
|
-
const a = ((
|
|
1904
|
+
var l, f, u, h, d, p, y, m, b;
|
|
1905
|
+
const a = ((l = o.constraints) == null ? void 0 : l[n]) || {}, r = { ...s, ...a }, c = r.strength ?? 1;
|
|
1906
1906
|
if (r.type === "Translation") {
|
|
1907
1907
|
const v = this.getGlobalTransform(r.targetId);
|
|
1908
1908
|
if (v) {
|
|
1909
1909
|
const S = r.offsetX || 0, C = r.offsetY || 0, w = v.x + S, I = v.y + C, M = r.useSpring;
|
|
1910
1910
|
if (M) {
|
|
1911
|
-
const T = this.objectVelocities.get(i.id) || { vx: 0, vy: 0 }, { x
|
|
1912
|
-
r.copyX && (e.x = e.x + (
|
|
1911
|
+
const T = this.objectVelocities.get(i.id) || { vx: 0, vy: 0 }, { x, y: P, vx: E, vy: R } = this.computeSpring(e.x, e.y, T.vx, T.vy, w, I, r, t);
|
|
1912
|
+
r.copyX && (e.x = e.x + (x - e.x) * c), r.copyY && (e.y = e.y + (P - e.y) * c), this.objectVelocities.set(i.id, { vx: E, vy: R });
|
|
1913
1913
|
} else
|
|
1914
|
-
r.copyX && (e.x = e.x + (w - e.x) *
|
|
1914
|
+
r.copyX && (e.x = e.x + (w - e.x) * c), r.copyY && (e.y = e.y + (I - e.y) * c);
|
|
1915
1915
|
let k = !1;
|
|
1916
1916
|
if ((f = r.limitX) != null && f.enabled) {
|
|
1917
1917
|
const T = e.x;
|
|
@@ -1927,25 +1927,25 @@ class ci {
|
|
|
1927
1927
|
const v = this.getGlobalTransform(r.targetId);
|
|
1928
1928
|
if (v) {
|
|
1929
1929
|
let C = (v.rotation + (r.offset || 0) - e.rotation) % 360;
|
|
1930
|
-
C > 180 && (C -= 360), C < -180 && (C += 360), e.rotation = e.rotation + C *
|
|
1930
|
+
C > 180 && (C -= 360), C < -180 && (C += 360), e.rotation = e.rotation + C * c;
|
|
1931
1931
|
}
|
|
1932
1932
|
} else if (r.type === "Scale") {
|
|
1933
1933
|
const v = this.getGlobalTransform(r.targetId);
|
|
1934
|
-
v && (r.copyX && (e.scale_x = e.scale_x + (v.scale_x - e.scale_x) *
|
|
1934
|
+
v && (r.copyX && (e.scale_x = e.scale_x + (v.scale_x - e.scale_x) * c), r.copyY && (e.scale_y = e.scale_y + (v.scale_y - e.scale_y) * c));
|
|
1935
1935
|
} else if (r.type === "Transform") {
|
|
1936
1936
|
const v = this.getGlobalTransform(r.targetId);
|
|
1937
1937
|
if (v) {
|
|
1938
|
-
e.x = e.x + (v.x - e.x) *
|
|
1938
|
+
e.x = e.x + (v.x - e.x) * c, e.y = e.y + (v.y - e.y) * c;
|
|
1939
1939
|
let S = (v.rotation - e.rotation) % 360;
|
|
1940
|
-
S > 180 && (S -= 360), S < -180 && (S += 360), e.rotation = e.rotation + S *
|
|
1940
|
+
S > 180 && (S -= 360), S < -180 && (S += 360), e.rotation = e.rotation + S * c, e.scale_x = e.scale_x + (v.scale_x - e.scale_x) * c, e.scale_y = e.scale_y + (v.scale_y - e.scale_y) * c;
|
|
1941
1941
|
}
|
|
1942
1942
|
} else if (r.type === "FollowPointer") {
|
|
1943
1943
|
const v = ((h = this._lastPointerPos) == null ? void 0 : h.x) ?? e.x, S = ((d = this._lastPointerPos) == null ? void 0 : d.y) ?? e.y, C = r.useSpring;
|
|
1944
1944
|
if (C) {
|
|
1945
|
-
const I = this.objectVelocities.get(i.id) || { vx: 0, vy: 0 }, { x: M, y: k, vx: T, vy:
|
|
1946
|
-
e.x = M, e.y = k, this.objectVelocities.set(i.id, { vx: T, vy:
|
|
1945
|
+
const I = this.objectVelocities.get(i.id) || { vx: 0, vy: 0 }, { x: M, y: k, vx: T, vy: x } = this.computeSpring(e.x, e.y, I.vx, I.vy, v, S, r, t);
|
|
1946
|
+
e.x = M, e.y = k, this.objectVelocities.set(i.id, { vx: T, vy: x });
|
|
1947
1947
|
} else
|
|
1948
|
-
e.x = e.x + (v - e.x) *
|
|
1948
|
+
e.x = e.x + (v - e.x) * c, e.y = e.y + (S - e.y) * c;
|
|
1949
1949
|
let w = !1;
|
|
1950
1950
|
if ((p = r.limitX) != null && p.enabled) {
|
|
1951
1951
|
const I = e.x;
|
|
@@ -1977,7 +1977,7 @@ class ci {
|
|
|
1977
1977
|
}
|
|
1978
1978
|
if (w > 0) {
|
|
1979
1979
|
const k = e.x === v.x && e.y === v.y ? 1 : M / w;
|
|
1980
|
-
e.x = e.x + (v.x + S * k - e.x) *
|
|
1980
|
+
e.x = e.x + (v.x + S * k - e.x) * c, e.y = e.y + (v.y + C * k - e.y) * c;
|
|
1981
1981
|
}
|
|
1982
1982
|
}
|
|
1983
1983
|
} else if (r.type === "FollowPath") {
|
|
@@ -1993,22 +1993,22 @@ class ci {
|
|
|
1993
1993
|
_ && (C = _.geometry);
|
|
1994
1994
|
}
|
|
1995
1995
|
if (!C) return;
|
|
1996
|
-
const w = (r.distance || 0) / 100, I = S.width || C.width || 0, M = S.height || C.height || 0, k = this.getPointOnPath(C, I, M, w), T = S.rotation * Math.PI / 180,
|
|
1996
|
+
const w = (r.distance || 0) / 100, I = S.width || C.width || 0, M = S.height || C.height || 0, k = this.getPointOnPath(C, I, M, w), T = S.rotation * Math.PI / 180, x = Math.cos(T), P = Math.sin(T), E = k.x * S.scale_x * x - k.y * S.scale_y * P, R = k.x * S.scale_x * P + k.y * S.scale_y * x;
|
|
1997
1997
|
let O = S.rotation + (r.offsetRotation || 0);
|
|
1998
1998
|
if (r.orient) {
|
|
1999
|
-
const _ = Math.cos(k.angle), L = Math.sin(k.angle), X = _ * S.scale_x *
|
|
1999
|
+
const _ = Math.cos(k.angle), L = Math.sin(k.angle), X = _ * S.scale_x * x - L * S.scale_y * P, V = _ * S.scale_x * P + L * S.scale_y * x;
|
|
2000
2000
|
O = Math.atan2(V, X) * 180 / Math.PI + (r.offsetRotation || 0);
|
|
2001
2001
|
}
|
|
2002
|
-
const W = O * Math.PI / 180, B = Math.cos(W), $ = Math.sin(W), Y = (r.offsetX || 0) * B - (r.offsetY || 0) * $, H = (r.offsetX || 0) * $ + (r.offsetY || 0) * B, K = S.x + E + Y, A = S.y +
|
|
2003
|
-
if (e.x = e.x + (K - e.x) *
|
|
2002
|
+
const W = O * Math.PI / 180, B = Math.cos(W), $ = Math.sin(W), Y = (r.offsetX || 0) * B - (r.offsetY || 0) * $, H = (r.offsetX || 0) * $ + (r.offsetY || 0) * B, K = S.x + E + Y, A = S.y + R + H;
|
|
2003
|
+
if (e.x = e.x + (K - e.x) * c, e.y = e.y + (A - e.y) * c, r.orient) {
|
|
2004
2004
|
let _ = (O - e.rotation) % 360;
|
|
2005
|
-
_ > 180 && (_ -= 360), _ < -180 && (_ += 360), e.rotation = e.rotation + _ *
|
|
2005
|
+
_ > 180 && (_ -= 360), _ < -180 && (_ += 360), e.rotation = e.rotation + _ * c;
|
|
2006
2006
|
}
|
|
2007
2007
|
}
|
|
2008
2008
|
}
|
|
2009
2009
|
} else if (r.type === "IK") {
|
|
2010
2010
|
const v = this.getGlobalTransform(r.targetId);
|
|
2011
|
-
v && this.solveIK(i, v, r.boneCount || 2,
|
|
2011
|
+
v && this.solveIK(i, v, r.boneCount || 2, c);
|
|
2012
2012
|
}
|
|
2013
2013
|
}), i.constraints.some((s) => s.type !== "IK")) {
|
|
2014
2014
|
const s = this.globalToLocal(i.parentId, e);
|
|
@@ -2030,10 +2030,10 @@ class ci {
|
|
|
2030
2030
|
scale_y: (i.scale_y ?? 1) * (i.flip_y ? -1 : 1),
|
|
2031
2031
|
length: e
|
|
2032
2032
|
};
|
|
2033
|
-
const s = this.getGlobalTransform(o.parentId), n = s.rotation * Math.PI / 180, a = Math.cos(n), r = Math.sin(n),
|
|
2033
|
+
const s = this.getGlobalTransform(o.parentId), n = s.rotation * Math.PI / 180, a = Math.cos(n), r = Math.sin(n), c = s.x + (i.x * s.scale_x * a - i.y * s.scale_y * r), l = s.y + (i.x * s.scale_x * r + i.y * s.scale_y * a);
|
|
2034
2034
|
return {
|
|
2035
|
-
x:
|
|
2036
|
-
y:
|
|
2035
|
+
x: c,
|
|
2036
|
+
y: l,
|
|
2037
2037
|
rotation: s.rotation + i.rotation,
|
|
2038
2038
|
scale_x: s.scale_x * (i.scale_x ?? 1) * (i.flip_x ? -1 : 1),
|
|
2039
2039
|
scale_y: s.scale_y * (i.scale_y ?? 1) * (i.flip_y ? -1 : 1),
|
|
@@ -2042,7 +2042,7 @@ class ci {
|
|
|
2042
2042
|
}
|
|
2043
2043
|
globalToLocal(t, i) {
|
|
2044
2044
|
if (!t) return i;
|
|
2045
|
-
const o = this.getGlobalTransform(t), e = o.scale_x === 0 ? 0 : 1 / o.scale_x, s = o.scale_y === 0 ? 0 : 1 / o.scale_y, n = -o.rotation * Math.PI / 180, a = Math.cos(n), r = Math.sin(n),
|
|
2045
|
+
const o = this.getGlobalTransform(t), e = o.scale_x === 0 ? 0 : 1 / o.scale_x, s = o.scale_y === 0 ? 0 : 1 / o.scale_y, n = -o.rotation * Math.PI / 180, a = Math.cos(n), r = Math.sin(n), c = i.x - o.x, l = i.y - o.y, f = (c * a - l * r) * e, u = (c * r + l * a) * s;
|
|
2046
2046
|
return {
|
|
2047
2047
|
x: f,
|
|
2048
2048
|
y: u,
|
|
@@ -2052,11 +2052,11 @@ class ci {
|
|
|
2052
2052
|
};
|
|
2053
2053
|
}
|
|
2054
2054
|
solveIK(t, i, o, e) {
|
|
2055
|
-
var
|
|
2055
|
+
var c;
|
|
2056
2056
|
const s = [];
|
|
2057
2057
|
let n = t.id;
|
|
2058
|
-
for (let
|
|
2059
|
-
const f = (
|
|
2058
|
+
for (let l = 0; l < o && n; l++) {
|
|
2059
|
+
const f = (c = this.artboard) == null ? void 0 : c.objects.find((u) => u.id === n);
|
|
2060
2060
|
if (!f) break;
|
|
2061
2061
|
s.push({
|
|
2062
2062
|
id: n,
|
|
@@ -2066,7 +2066,7 @@ class ci {
|
|
|
2066
2066
|
}
|
|
2067
2067
|
if (s.length < 2) return;
|
|
2068
2068
|
const a = s.reverse(), r = 5;
|
|
2069
|
-
for (let
|
|
2069
|
+
for (let l = 0; l < r; l++) {
|
|
2070
2070
|
const f = this.getGlobalTransform(t.id);
|
|
2071
2071
|
for (let u = a.length - 2; u >= 0; u--) {
|
|
2072
2072
|
const h = a[u], d = this.getGlobalTransform(h.id), p = f.x - d.x, y = f.y - d.y, m = i.x - d.x, b = i.y - d.y, v = Math.sqrt(p * p + y * y), S = Math.sqrt(m * m + b * b);
|
|
@@ -2081,7 +2081,7 @@ class ci {
|
|
|
2081
2081
|
}
|
|
2082
2082
|
}
|
|
2083
2083
|
computeSpring(t, i, o, e, s, n, a, r) {
|
|
2084
|
-
const
|
|
2084
|
+
const c = a.stiffness ?? 100, l = a.damping ?? 10, f = a.mass ?? 1, u = -c * (t - s), h = -c * (i - n), d = -l * o, p = -l * e, y = (u + d) / f, m = (h + p) / f, b = o + y * r, v = e + m * r, S = t + b * r, C = i + v * r;
|
|
2085
2085
|
return { x: S, y: C, vx: b, vy: v };
|
|
2086
2086
|
}
|
|
2087
2087
|
handlePointerInput(t, i, o, e, s) {
|
|
@@ -2105,7 +2105,7 @@ class ci {
|
|
|
2105
2105
|
this._totalScroll.x += t, this._totalScroll.y += i, this.scrollOffset = { x: this._totalScroll.x, y: this._totalScroll.y }, this.updateInput("scrollX", this._totalScroll.x), this.updateInput("scrollY", this._totalScroll.y);
|
|
2106
2106
|
}
|
|
2107
2107
|
handlePointerEvent(t, i, o) {
|
|
2108
|
-
var r,
|
|
2108
|
+
var r, c, l, f, u;
|
|
2109
2109
|
if (!this.artboard) return;
|
|
2110
2110
|
t === "down" ? (this.isMouseDown = !0, this.updateInput("isMouseDown", !0)) : (t === "up" || t === "blur") && (this.isMouseDown = !1, this.updateInput("isMouseDown", !1));
|
|
2111
2111
|
let e = null;
|
|
@@ -2152,9 +2152,9 @@ class ci {
|
|
|
2152
2152
|
})) : t === "blur" && this.activeHoverIds.clear(), this.activeDropdownId && t === "down") {
|
|
2153
2153
|
const h = this.artboard.objects.find((d) => d.id === this.activeDropdownId);
|
|
2154
2154
|
if (h && (h.type === "Dropdown" || h.variant === "dropdown")) {
|
|
2155
|
-
const d = this.objectStates.get(h.id), p = (d == null ? void 0 : d.options) || h.options || {}, y = h.geometry || {}, m = y.width ?? h.width ?? 200, b = y.height ?? h.height ?? 40, v = p.optionsList || [], S = p.itemHeight || 32, C = p.listPadding ?? 4, w = v.length * S + C * 2, I = this.getWorldTransform(h.id), M = m * Math.abs(I.scaleX), k = b * Math.abs(I.scaleY), T = I.y + k / 2 + 4,
|
|
2156
|
-
if (
|
|
2157
|
-
const E = Math.abs(I.scaleY),
|
|
2155
|
+
const d = this.objectStates.get(h.id), p = (d == null ? void 0 : d.options) || h.options || {}, y = h.geometry || {}, m = y.width ?? h.width ?? 200, b = y.height ?? h.height ?? 40, v = p.optionsList || [], S = p.itemHeight || 32, C = p.listPadding ?? 4, w = v.length * S + C * 2, I = this.getWorldTransform(h.id), M = m * Math.abs(I.scaleX), k = b * Math.abs(I.scaleY), T = I.y + k / 2 + 4, x = Math.abs(i - I.x) <= M / 2, P = o >= T && o <= T + w * Math.abs(I.scaleY);
|
|
2156
|
+
if (x && P) {
|
|
2157
|
+
const E = Math.abs(I.scaleY), R = o - (T + C * E), O = Math.floor(R / (S * E));
|
|
2158
2158
|
if (O >= 0 && O < v.length) {
|
|
2159
2159
|
const W = v[O];
|
|
2160
2160
|
p.selectedOption = W, p.isOpen = !1, this.activeDropdownId = null, h.inputId && this.setInternalInput(h.inputId, W), this.onComponentChange && this.onComponentChange({
|
|
@@ -2273,24 +2273,24 @@ class ci {
|
|
|
2273
2273
|
const y = h.geometry, m = (y == null ? void 0 : y.datasets) || [], b = this.objectStates.get(h.id), v = (b == null ? void 0 : b.width) || (y == null ? void 0 : y.width) || 200, S = (b == null ? void 0 : b.height) || (y == null ? void 0 : y.height) || 150, C = this.getWorldTransform(h.id), w = 30, I = 20, M = v - w, k = S - I;
|
|
2274
2274
|
let T = 1;
|
|
2275
2275
|
m.forEach((E) => {
|
|
2276
|
-
const
|
|
2277
|
-
|
|
2276
|
+
const R = Math.max(...E.data || [0]);
|
|
2277
|
+
R > T && (T = R);
|
|
2278
2278
|
});
|
|
2279
|
-
let
|
|
2280
|
-
m.forEach((E,
|
|
2279
|
+
let x = 1 / 0, P = null;
|
|
2280
|
+
m.forEach((E, R) => {
|
|
2281
2281
|
const O = E.data || [], W = M / Math.max(O.length - 1, 1);
|
|
2282
2282
|
O.forEach((B, $) => {
|
|
2283
2283
|
const Y = C.x - v / 2 + w + $ * W, H = C.y + S / 2 - I - B / T * k, K = Math.sqrt((i - Y) ** 2 + (o - H) ** 2);
|
|
2284
|
-
K <
|
|
2284
|
+
K < x && (x = K, P = { dIdx: R, pIdx: $, val: B, label: E.label || `Dataset ${R + 1}` });
|
|
2285
2285
|
});
|
|
2286
|
-
}), P &&
|
|
2286
|
+
}), P && x < 20 && this.onGraphPointClick && this.onGraphPointClick({ objectId: h.id, componentName: h.name, datasetIndex: P.dIdx, pointIndex: P.pIdx, value: P.val, label: P.label }), this.onComponentChange && this.onComponentChange({ objectId: h.id, componentName: h.name, variant: "linegraph", property: "click", value: (P == null ? void 0 : P.val) ?? null });
|
|
2287
2287
|
}
|
|
2288
2288
|
if (t === "click") {
|
|
2289
|
-
const y = (
|
|
2289
|
+
const y = (c = this.artboard) == null ? void 0 : c.objects.find((v) => v.id === e.id), m = this.focusedId, b = (y == null ? void 0 : y.type) === "InputBox" || (y == null ? void 0 : y.type) === "Component" && y.variant === "inputbox";
|
|
2290
2290
|
if (y && b) {
|
|
2291
2291
|
if (this.focusedId = e.id, this.log(`[Engine] Focus set to: ${e.id}`), m !== this.focusedId) {
|
|
2292
2292
|
if (m) {
|
|
2293
|
-
const v = (
|
|
2293
|
+
const v = (l = this.artboard) == null ? void 0 : l.objects.find((S) => S.id === m);
|
|
2294
2294
|
v && this.onInputBlur && this.onInputBlur(v.name);
|
|
2295
2295
|
}
|
|
2296
2296
|
this.onInputFocus && this.onInputFocus(y.name);
|
|
@@ -2342,8 +2342,8 @@ class ci {
|
|
|
2342
2342
|
this.artboard && (this.activeKeys.delete(t.key.toLowerCase()), this.activeKeys.delete(t.code));
|
|
2343
2343
|
}
|
|
2344
2344
|
fireEventForObject(t, i) {
|
|
2345
|
-
var
|
|
2346
|
-
const o = (
|
|
2345
|
+
var l, f, u, h, d;
|
|
2346
|
+
const o = (l = this.artboard) == null ? void 0 : l.objects.find((p) => p.id === t);
|
|
2347
2347
|
if (!o) return;
|
|
2348
2348
|
const e = /* @__PURE__ */ new Set([i, i.toLowerCase()]), s = i.toLowerCase();
|
|
2349
2349
|
s === "onclick" || s === "click" || s === "onpointerdown" || s === "pointerdown" ? this.fireAnalyticsEvent(t, "click") : (s === "onpointerenter" || s === "hover" || s === "move") && this.fireAnalyticsEvent(t, "hover"), s === "onclick" || s === "click" ? (e.add("click"), e.add("onclick")) : s === "onpointerdown" || s === "pointerdown" ? (e.add("pointerdown"), e.add("onpointerdown")) : s === "onpointerup" || s === "pointerup" ? (e.add("pointerup"), e.add("onpointerup")) : s === "onpointerenter" || s === "hover" || s === "move" ? (e.add("hover"), e.add("onpointerenter")) : s === "onpointerleave" || s === "blur" ? (e.add("onpointerleave"), e.add("blur")) : s === "drag" || s === "ondrag" ? (e.add("drag"), e.add("ondrag")) : s === "toggle" || s === "ontoggle" ? (e.add("toggle"), e.add("ontoggle")) : s === "toggle true" || s === "toggle_true" || s === "toggletrue" ? (e.add("toggle true"), e.add("toggle_true"), e.add("toggletrue")) : (s === "toggle false" || s === "toggle_false" || s === "togglefalse") && (e.add("toggle false"), e.add("toggle_false"), e.add("togglefalse"));
|
|
@@ -2390,51 +2390,51 @@ class ci {
|
|
|
2390
2390
|
}
|
|
2391
2391
|
this.onTrigger && this.onTrigger(i, a.action);
|
|
2392
2392
|
}
|
|
2393
|
-
const
|
|
2393
|
+
const c = (o.triggers || []).find((p) => {
|
|
2394
2394
|
const y = p.eventType.toLowerCase();
|
|
2395
2395
|
let m = !1;
|
|
2396
2396
|
return (e.has(y) || y === "click" && e.has("onclick") || y === "hover" && (e.has("onpointerenter") || e.has("hover")) || y === "pointerdown" && e.has("onpointerdown") || y === "pointerup" && e.has("onpointerup")) && (m = !0), m && p.conditions && p.conditions.length > 0 ? this.checkConditions(p.conditions) : m;
|
|
2397
2397
|
});
|
|
2398
|
-
if (
|
|
2399
|
-
this.log(`[Engine] Trigger matched: ${i} (as ${
|
|
2400
|
-
const p = (d = (h = this.artboard) == null ? void 0 : h.animations) == null ? void 0 : d.find((y) => y.id ===
|
|
2398
|
+
if (c && c.entryAnimationId) {
|
|
2399
|
+
this.log(`[Engine] Trigger matched: ${i} (as ${c.eventType}) -> Animation ${c.entryAnimationId}`);
|
|
2400
|
+
const p = (d = (h = this.artboard) == null ? void 0 : h.animations) == null ? void 0 : d.find((y) => y.id === c.entryAnimationId);
|
|
2401
2401
|
p && (this.activeTriggers.set(o.id, {
|
|
2402
|
-
triggerId:
|
|
2402
|
+
triggerId: c.id,
|
|
2403
2403
|
animation: p,
|
|
2404
2404
|
time: 0,
|
|
2405
2405
|
phase: "entry",
|
|
2406
2406
|
elapsedHold: 0,
|
|
2407
|
-
filterObjectId:
|
|
2408
|
-
}), this.onTrigger && this.onTrigger(
|
|
2407
|
+
filterObjectId: c.targetObjectId
|
|
2408
|
+
}), this.onTrigger && this.onTrigger(c.name, p.name));
|
|
2409
2409
|
}
|
|
2410
2410
|
}
|
|
2411
2411
|
fireAnalyticsEvent(t, i) {
|
|
2412
|
-
var r,
|
|
2413
|
-
const o = (r = this.artboard) == null ? void 0 : r.objects.find((
|
|
2412
|
+
var r, c;
|
|
2413
|
+
const o = (r = this.artboard) == null ? void 0 : r.objects.find((l) => l.id === t);
|
|
2414
2414
|
if (!o) return;
|
|
2415
|
-
const e = (
|
|
2415
|
+
const e = (c = o.style) == null ? void 0 : c.analytics;
|
|
2416
2416
|
if (!e || !e.isEnabled || e.triggerType !== i) return;
|
|
2417
2417
|
const s = e.eventName || `${o.name.toLowerCase().replace(/\s+/g, "_")}_interacted`, n = {};
|
|
2418
|
-
e.parameters && Array.isArray(e.parameters) && e.parameters.forEach((
|
|
2419
|
-
if (
|
|
2420
|
-
n[
|
|
2421
|
-
else if (
|
|
2422
|
-
const f = this.inputs.get(
|
|
2423
|
-
n[
|
|
2418
|
+
e.parameters && Array.isArray(e.parameters) && e.parameters.forEach((l) => {
|
|
2419
|
+
if (l.type === "literal")
|
|
2420
|
+
n[l.key] = l.value;
|
|
2421
|
+
else if (l.type === "variable") {
|
|
2422
|
+
const f = this.inputs.get(l.value);
|
|
2423
|
+
n[l.key] = f !== void 0 ? f : "";
|
|
2424
2424
|
}
|
|
2425
2425
|
}), this.log(`[ExodeUI Analytics] Dispatching event "${s}" via ${i} trigger:`, n);
|
|
2426
2426
|
const a = e.platforms || { ga4: !0, meta: !0, mixpanel: !1 };
|
|
2427
2427
|
if (a.ga4) {
|
|
2428
|
-
const
|
|
2429
|
-
typeof
|
|
2428
|
+
const l = window;
|
|
2429
|
+
typeof l.gtag == "function" ? (l.gtag("event", s, n), this.log(`[ExodeUI Analytics] GA4: Event "${s}" sent successfully.`)) : this.warn(`[ExodeUI Analytics] GA4: window.gtag is not a function. Event "${s}" skipped.`);
|
|
2430
2430
|
}
|
|
2431
2431
|
if (a.meta) {
|
|
2432
|
-
const
|
|
2433
|
-
typeof
|
|
2432
|
+
const l = window;
|
|
2433
|
+
typeof l.fbq == "function" ? (l.fbq("track", s, n), this.log(`[ExodeUI Analytics] Meta Pixel: Event "${s}" sent successfully.`)) : this.warn(`[ExodeUI Analytics] Meta Pixel: window.fbq is not a function. Event "${s}" skipped.`);
|
|
2434
2434
|
}
|
|
2435
2435
|
if (a.mixpanel) {
|
|
2436
|
-
const
|
|
2437
|
-
|
|
2436
|
+
const l = window;
|
|
2437
|
+
l.mixpanel && typeof l.mixpanel.track == "function" ? (l.mixpanel.track(s, n), this.log(`[ExodeUI Analytics] Mixpanel: Event "${s}" sent successfully.`)) : this.warn(`[ExodeUI Analytics] Mixpanel: window.mixpanel.track is not a function. Event "${s}" skipped.`);
|
|
2438
2438
|
}
|
|
2439
2439
|
}
|
|
2440
2440
|
initGlobalAnimationTriggers() {
|
|
@@ -2484,9 +2484,9 @@ class ci {
|
|
|
2484
2484
|
scaleY: i.scale_y ?? 1,
|
|
2485
2485
|
rotation: i.rotation ?? 0
|
|
2486
2486
|
};
|
|
2487
|
-
const e = this.getWorldTransform(o.parentId), s = e.rotation * (Math.PI / 180), n = Math.cos(s), a = Math.sin(s), r = i.x * e.scaleX,
|
|
2487
|
+
const e = this.getWorldTransform(o.parentId), s = e.rotation * (Math.PI / 180), n = Math.cos(s), a = Math.sin(s), r = i.x * e.scaleX, c = i.y * e.scaleY, l = e.x + (r * n - c * a), f = e.y + (r * a + c * n);
|
|
2488
2488
|
return {
|
|
2489
|
-
x:
|
|
2489
|
+
x: l,
|
|
2490
2490
|
y: f,
|
|
2491
2491
|
scaleX: (i.scale_x ?? 1) * e.scaleX,
|
|
2492
2492
|
scaleY: (i.scale_y ?? 1) * e.scaleY,
|
|
@@ -2496,14 +2496,14 @@ class ci {
|
|
|
2496
2496
|
hitTest(t, i, o) {
|
|
2497
2497
|
var v, S;
|
|
2498
2498
|
if (!this.objectStates.get(t.id)) return !1;
|
|
2499
|
-
const s = ((v = t.geometry) == null ? void 0 : v.width) ?? t.width ?? 100, n = ((S = t.geometry) == null ? void 0 : S.height) ?? t.height ?? 100, a = this.getWorldTransform(t.id), r = i - a.x,
|
|
2499
|
+
const s = ((v = t.geometry) == null ? void 0 : v.width) ?? t.width ?? 100, n = ((S = t.geometry) == null ? void 0 : S.height) ?? t.height ?? 100, a = this.getWorldTransform(t.id), r = i - a.x, c = o - a.y, l = -a.rotation * (Math.PI / 180), f = Math.cos(l), u = Math.sin(l), h = r * f - c * u, d = r * u + c * f, p = a.scaleX, y = a.scaleY, m = s * Math.abs(p), b = n * Math.abs(y);
|
|
2500
2500
|
return Math.abs(h) <= m / 2 && Math.abs(d) <= b / 2;
|
|
2501
2501
|
}
|
|
2502
2502
|
updateSliderValueFromPointer(t, i, o) {
|
|
2503
2503
|
var I;
|
|
2504
2504
|
const e = this.objectStates.get(t.id);
|
|
2505
2505
|
if (!e) return;
|
|
2506
|
-
const s = t.options || {}, n = ((I = t.geometry) == null ? void 0 : I.width) ?? t.width ?? 200, a = this.getWorldTransform(t.id), r = i - a.x,
|
|
2506
|
+
const s = t.options || {}, n = ((I = t.geometry) == null ? void 0 : I.width) ?? t.width ?? 200, a = this.getWorldTransform(t.id), r = i - a.x, c = o - a.y, l = -a.rotation * (Math.PI / 180), f = Math.cos(l), u = Math.sin(l), h = r * f - c * u, d = s.thumbWidth ?? 16, p = n - d;
|
|
2507
2507
|
let m = (h + p / 2) / p;
|
|
2508
2508
|
m = Math.max(0, Math.min(1, m));
|
|
2509
2509
|
const b = s.min ?? 0, v = s.max ?? 100, S = s.step || 1;
|
|
@@ -2522,8 +2522,8 @@ class ci {
|
|
|
2522
2522
|
var I, M;
|
|
2523
2523
|
const e = this.objectStates.get(t.id);
|
|
2524
2524
|
if (!e) return;
|
|
2525
|
-
const s = (e == null ? void 0 : e.width) !== void 0 ? e.width : ((I = t.geometry) == null ? void 0 : I.width) ?? t.width ?? 100, n = (e == null ? void 0 : e.height) !== void 0 ? e.height : ((M = t.geometry) == null ? void 0 : M.height) ?? t.height ?? 100, a = this.getWorldTransform(t.id), r = i - a.x,
|
|
2526
|
-
let h = (r * f -
|
|
2525
|
+
const s = (e == null ? void 0 : e.width) !== void 0 ? e.width : ((I = t.geometry) == null ? void 0 : I.width) ?? t.width ?? 100, n = (e == null ? void 0 : e.height) !== void 0 ? e.height : ((M = t.geometry) == null ? void 0 : M.height) ?? t.height ?? 100, a = this.getWorldTransform(t.id), r = i - a.x, c = o - a.y, l = -a.rotation * (Math.PI / 180), f = Math.cos(l), u = Math.sin(l);
|
|
2526
|
+
let h = (r * f - c * u) / Math.max(1e-3, Math.abs(a.scaleX || 1)), d = (r * u + c * f) / Math.max(1e-3, Math.abs(a.scaleY || 1));
|
|
2527
2527
|
t.handleOrigin === "top-left" ? (h -= s / 2, d -= n / 2) : t.handleOrigin === "bottom-right" && (h += s / 2, d += n / 2);
|
|
2528
2528
|
const p = Math.min(s, n) * 0.45, y = Math.min(s, n) * 0.15, m = p - y;
|
|
2529
2529
|
let b = h / m, v = d / m;
|
|
@@ -2541,39 +2541,39 @@ class ci {
|
|
|
2541
2541
|
let s = e.handleX ?? o.handleX ?? 0, n = e.handleY ?? o.handleY ?? 0;
|
|
2542
2542
|
if (((a = o.inputBinding) == null ? void 0 : a.type) === "keyboard" && o.inputBinding.keyboardConfig) {
|
|
2543
2543
|
const r = o.inputBinding.keyboardConfig;
|
|
2544
|
-
let
|
|
2544
|
+
let c = s, l = n;
|
|
2545
2545
|
const u = (r.speed || 5) * t;
|
|
2546
2546
|
let h = !1;
|
|
2547
|
-
this.activeKeys.has(r.upKey.toLowerCase()) && (
|
|
2548
|
-
const d = Math.sqrt(
|
|
2549
|
-
d > 1 && (
|
|
2547
|
+
this.activeKeys.has(r.upKey.toLowerCase()) && (l -= u, h = !0), this.activeKeys.has(r.downKey.toLowerCase()) && (l += u, h = !0), this.activeKeys.has(r.leftKey.toLowerCase()) && (c -= u, h = !0), this.activeKeys.has(r.rightKey.toLowerCase()) && (c += u, h = !0), o.joystickType === "1D_X" && (l = 0), o.joystickType === "1D_Y" && (c = 0);
|
|
2548
|
+
const d = Math.sqrt(c * c + l * l);
|
|
2549
|
+
d > 1 && (c /= d, l /= d), !h && o.isSpringReturn !== !1 && (c += (0 - c) * (10 * t), l += (0 - l) * (10 * t), Math.abs(c) < 0.01 && (c = 0), Math.abs(l) < 0.01 && (l = 0)), s = c, n = l;
|
|
2550
2550
|
}
|
|
2551
2551
|
if (e.handleX = s, e.handleY = n, o.handleX = s, o.handleY = n, o.bindings && o.bindings.length > 0) {
|
|
2552
2552
|
const r = Math.sqrt(s * s + n * n);
|
|
2553
|
-
let
|
|
2554
|
-
|
|
2553
|
+
let c = Math.atan2(n, s) * (180 / Math.PI);
|
|
2554
|
+
c < 0 && (c += 360), o.bindings.forEach((l) => {
|
|
2555
2555
|
var h, d;
|
|
2556
2556
|
let f = 0;
|
|
2557
|
-
|
|
2558
|
-
const u = (h = this.artboard) == null ? void 0 : h.objects.find((p) => p.id ===
|
|
2557
|
+
l.sourceAxis === "x" ? f = o.invertX ? -s : s : l.sourceAxis === "y" ? f = o.invertY ? -n : n : l.sourceAxis === "distance" ? f = r : l.sourceAxis === "angle" && (f = c);
|
|
2558
|
+
const u = (h = this.artboard) == null ? void 0 : h.objects.find((p) => p.id === l.targetObjectId);
|
|
2559
2559
|
if (u) {
|
|
2560
|
-
if (
|
|
2561
|
-
const p =
|
|
2560
|
+
if (l.actionType === "bind" && l.targetProperty && l.isContinuous !== !1) {
|
|
2561
|
+
const p = l.sourceMin ?? -1, y = l.sourceMax ?? 1, m = l.targetMin ?? 0, b = l.targetMax ?? 100, v = (f - p) / (y - p), S = Math.max(0, Math.min(1, v));
|
|
2562
2562
|
let C = m + S * (b - m);
|
|
2563
|
-
|
|
2563
|
+
l.step && l.step > 0 && (C = Math.round(C / l.step) * l.step);
|
|
2564
2564
|
const w = this.objectStates.get(u.id);
|
|
2565
2565
|
if (w) {
|
|
2566
|
-
const I =
|
|
2567
|
-
|
|
2566
|
+
const I = l.isRelative !== !1, M = I ? u.x ?? 0 : 0, k = I ? u.y ?? 0 : 0, T = I ? u.rotation ?? 0 : 0, x = I ? u.scale_x ?? 1 : 0, P = I ? u.scale_y ?? 1 : 0, E = I ? u.opacity ?? 100 : 0;
|
|
2567
|
+
l.targetProperty === "x" || l.targetProperty === "transform.x" ? w.x = M + C : l.targetProperty === "y" || l.targetProperty === "transform.y" ? w.y = k + C : l.targetProperty === "rotation" || l.targetProperty === "r" || l.targetProperty === "transform.rotation" ? w.rotation = T + C : l.targetProperty === "scaleX" || l.targetProperty === "transform.scale_x" ? w.scale_x = x + C : l.targetProperty === "scaleY" || l.targetProperty === "transform.scale_y" ? w.scale_y = P + C : (l.targetProperty === "opacity" || l.targetProperty === "transform.opacity") && (w.opacity = E + C);
|
|
2568
2568
|
}
|
|
2569
|
-
(d = u.physics) != null && d.enabled && this.physicsEngine && (
|
|
2570
|
-
} else if (
|
|
2569
|
+
(d = u.physics) != null && d.enabled && this.physicsEngine && (l.targetProperty === "x" || l.targetProperty === "transform.x" || l.targetProperty === "y" || l.targetProperty === "transform.y") && (l.targetProperty === "x" || l.targetProperty === "transform.x" ? this.physicsEngine.applyForce(u.id, (C - ((w == null ? void 0 : w.x) || 0)) * 10, 0) : (l.targetProperty === "y" || l.targetProperty === "transform.y") && this.physicsEngine.applyForce(u.id, 0, (C - ((w == null ? void 0 : w.y) || 0)) * 10));
|
|
2570
|
+
} else if (l.actionType === "playAnimation" || l.actionType === "stopAnimation" || l.actionType === "pauseAnimation") {
|
|
2571
2571
|
let p = !1;
|
|
2572
|
-
const y =
|
|
2573
|
-
|
|
2574
|
-
const m = e[`_prev_src_${
|
|
2572
|
+
const y = l.threshold ?? 0;
|
|
2573
|
+
l.condition === "always" ? p = !0 : l.condition === ">" ? p = f > y : l.condition === "<" ? p = f < y : l.condition === "==" && (p = Math.abs(f - y) < 0.01);
|
|
2574
|
+
const m = e[`_prev_src_${l.id}`] ?? f;
|
|
2575
2575
|
let b = !1;
|
|
2576
|
-
|
|
2576
|
+
l.condition === "always" ? b = !0 : l.condition === ">" ? b = m > y : l.condition === "<" ? b = m < y : l.condition === "==" && (b = Math.abs(m - y) < 0.01), e[`_prev_src_${l.id}`] = f, p && !b && l.targetAnimationId && (l.actionType === "playAnimation" || l.actionType);
|
|
2577
2577
|
}
|
|
2578
2578
|
}
|
|
2579
2579
|
});
|
|
@@ -2581,7 +2581,7 @@ class ci {
|
|
|
2581
2581
|
});
|
|
2582
2582
|
}
|
|
2583
2583
|
applyBlendState(t, i) {
|
|
2584
|
-
var
|
|
2584
|
+
var c, l, f, u, h, d, p, y;
|
|
2585
2585
|
if (!t.blendAnimations || t.blendAnimations.length === 0) return;
|
|
2586
2586
|
let o = 0, e = 0;
|
|
2587
2587
|
t.blendInputX && (o = this.inputs.get(t.blendInputX) ?? 0), t.blendInputY && (e = this.inputs.get(t.blendInputY) ?? 0);
|
|
@@ -2590,7 +2590,7 @@ class ci {
|
|
|
2590
2590
|
if (t.blendType === "1D") {
|
|
2591
2591
|
const m = [...t.blendAnimations].sort((b, v) => b.position[0] - v.position[0]);
|
|
2592
2592
|
if (m.length === 1) {
|
|
2593
|
-
const b = (
|
|
2593
|
+
const b = (l = (c = this.artboard) == null ? void 0 : c.animations) == null ? void 0 : l.find((v) => v.id === m[0].animationId);
|
|
2594
2594
|
b && (s.push({ anim: b, weight: 1 }), n = 1);
|
|
2595
2595
|
} else {
|
|
2596
2596
|
let b = 0;
|
|
@@ -2628,8 +2628,8 @@ class ci {
|
|
|
2628
2628
|
};
|
|
2629
2629
|
s.forEach(({ anim: m, weight: b }) => {
|
|
2630
2630
|
m.tracks && m.tracks.forEach((v) => {
|
|
2631
|
-
var
|
|
2632
|
-
const S = v.object_id || v.objectId, C = v.property, w = (
|
|
2631
|
+
var x, P;
|
|
2632
|
+
const S = v.object_id || v.objectId, C = v.property, w = (x = this.artboard) == null ? void 0 : x.objects.find((E) => E.id === S);
|
|
2633
2633
|
if (((P = w == null ? void 0 : w.physics) == null ? void 0 : P.enabled) && w.physics.bodyType !== "Static" && (C === "x" || C === "y" || C === "rotation")) return;
|
|
2634
2634
|
const M = this.interpolate(v.keyframes, i);
|
|
2635
2635
|
if (M === void 0) return;
|
|
@@ -2658,24 +2658,24 @@ class ci {
|
|
|
2658
2658
|
!v || !S || m.forEach((w, I) => {
|
|
2659
2659
|
let M = w.value;
|
|
2660
2660
|
if (w.type === "color" && w.colorAcc) {
|
|
2661
|
-
const k = Math.round(w.colorAcc.r).toString(16).padStart(2, "0"), T = Math.round(w.colorAcc.g).toString(16).padStart(2, "0"),
|
|
2662
|
-
M = `#${k}${T}${
|
|
2661
|
+
const k = Math.round(w.colorAcc.r).toString(16).padStart(2, "0"), T = Math.round(w.colorAcc.g).toString(16).padStart(2, "0"), x = Math.round(w.colorAcc.b).toString(16).padStart(2, "0");
|
|
2662
|
+
M = `#${k}${T}${x}`;
|
|
2663
2663
|
}
|
|
2664
2664
|
if (I.includes(".")) {
|
|
2665
2665
|
const k = (I || "").split(".");
|
|
2666
2666
|
let T = v;
|
|
2667
|
-
for (let
|
|
2668
|
-
if (typeof T[k[
|
|
2667
|
+
for (let x = 0; x < k.length - 1; x++) {
|
|
2668
|
+
if (typeof T[k[x]] != "object" || T[k[x]] === null) {
|
|
2669
2669
|
let P = S;
|
|
2670
|
-
for (let E = 0; E <=
|
|
2670
|
+
for (let E = 0; E <= x; E++)
|
|
2671
2671
|
P = P ? P[k[E]] : null;
|
|
2672
|
-
if (k[
|
|
2673
|
-
const E = typeof T[k[
|
|
2674
|
-
T[k[
|
|
2672
|
+
if (k[x] === "corner_radius" || k[x] === "cornerRadius") {
|
|
2673
|
+
const E = typeof T[k[x]] == "number" ? T[k[x]] : typeof P == "number" ? P : 0;
|
|
2674
|
+
T[k[x]] = { tl: E, tr: E, bl: E, br: E };
|
|
2675
2675
|
} else
|
|
2676
|
-
T[k[
|
|
2676
|
+
T[k[x]] = P ? JSON.parse(JSON.stringify(P)) : {};
|
|
2677
2677
|
}
|
|
2678
|
-
T = T[k[
|
|
2678
|
+
T = T[k[x]];
|
|
2679
2679
|
}
|
|
2680
2680
|
T[k[k.length - 1]] = M, k[k.length - 1] === "color" && (k[k.length - 2] === "fill" || k[k.length - 2] === "stroke") && (T.type = "Solid");
|
|
2681
2681
|
} else
|
|
@@ -2697,20 +2697,20 @@ class ci {
|
|
|
2697
2697
|
let r = e.property;
|
|
2698
2698
|
if (a && (r === "x" || r === "y" || r === "rotation"))
|
|
2699
2699
|
return;
|
|
2700
|
-
const
|
|
2701
|
-
if (!
|
|
2700
|
+
const c = this.objectStates.get(s);
|
|
2701
|
+
if (!c) {
|
|
2702
2702
|
this.frameCount % 600 === 0 && this.debugLog(`Skipping track: Object ${s} not found in state`);
|
|
2703
2703
|
return;
|
|
2704
2704
|
}
|
|
2705
|
-
const
|
|
2706
|
-
if (
|
|
2705
|
+
const l = this.interpolate(e.keyframes, i);
|
|
2706
|
+
if (l !== void 0) {
|
|
2707
2707
|
if (this.frameCount % 240 === 0) {
|
|
2708
|
-
const d = (n == null ? void 0 : n.name) || s, p = typeof
|
|
2708
|
+
const d = (n == null ? void 0 : n.name) || s, p = typeof l == "object" ? JSON.stringify(l).slice(0, 50) : l;
|
|
2709
2709
|
this.debugLog(`[Anim] Applying ${r} = ${p} to ${d}`);
|
|
2710
2710
|
}
|
|
2711
2711
|
if (r.includes(".")) {
|
|
2712
2712
|
const d = (r || "").split(".");
|
|
2713
|
-
let p =
|
|
2713
|
+
let p = c;
|
|
2714
2714
|
for (let y = 0; y < d.length - 1; y++) {
|
|
2715
2715
|
if (typeof p[d[y]] != "object" || p[d[y]] === null) {
|
|
2716
2716
|
let m = n;
|
|
@@ -2724,17 +2724,17 @@ class ci {
|
|
|
2724
2724
|
}
|
|
2725
2725
|
p = p[d[y]];
|
|
2726
2726
|
}
|
|
2727
|
-
p[d[d.length - 1]] =
|
|
2727
|
+
p[d[d.length - 1]] = l, d[d.length - 1] === "color" && (d[d.length - 2] === "fill" || d[d.length - 2] === "stroke") && (p.type = "Solid");
|
|
2728
2728
|
} else
|
|
2729
|
-
r === "fill" ? (
|
|
2729
|
+
r === "fill" ? (c.style || (c.style = {}), c.style.fill = l) : r === "stroke" ? (c.style || (c.style = {}), c.style.stroke = l) : c[r] = l;
|
|
2730
2730
|
if (this.physicsEngine && ((h = n == null ? void 0 : n.physics) != null && h.enabled) && n.physics.bodyType === "Static")
|
|
2731
2731
|
if (r === "x") {
|
|
2732
2732
|
const d = this.physicsEngine.getPosition(s);
|
|
2733
|
-
d && this.physicsEngine.setPosition(s,
|
|
2733
|
+
d && this.physicsEngine.setPosition(s, l, d.y);
|
|
2734
2734
|
} else if (r === "y") {
|
|
2735
2735
|
const d = this.physicsEngine.getPosition(s);
|
|
2736
|
-
d && this.physicsEngine.setPosition(s, d.x,
|
|
2737
|
-
} else r === "rotation" && this.physicsEngine.setRotation(s,
|
|
2736
|
+
d && this.physicsEngine.setPosition(s, d.x, l);
|
|
2737
|
+
} else r === "rotation" && this.physicsEngine.setRotation(s, l * (Math.PI / 180));
|
|
2738
2738
|
}
|
|
2739
2739
|
});
|
|
2740
2740
|
}
|
|
@@ -2758,8 +2758,8 @@ class ci {
|
|
|
2758
2758
|
}
|
|
2759
2759
|
if (Array.isArray(o.value) && Array.isArray(e.value))
|
|
2760
2760
|
return o.value.length === e.value.length ? o.value.map((a, r) => {
|
|
2761
|
-
const
|
|
2762
|
-
return typeof a == "number" && typeof
|
|
2761
|
+
const c = e.value[r];
|
|
2762
|
+
return typeof a == "number" && typeof c == "number" ? a + (c - a) * n : n < 0.5 ? a : c;
|
|
2763
2763
|
}) : n < 0.5 ? o.value : e.value;
|
|
2764
2764
|
if (typeof o.value == "object" && typeof e.value == "object" && o.value !== null && e.value !== null) {
|
|
2765
2765
|
if (o.value.width !== void 0 && o.value.color !== void 0)
|
|
@@ -2767,9 +2767,9 @@ class ci {
|
|
|
2767
2767
|
if (o.value.type && e.value.type)
|
|
2768
2768
|
return this.interpolateFill(o.value, e.value, n);
|
|
2769
2769
|
const a = {};
|
|
2770
|
-
return (/* @__PURE__ */ new Set([...Object.keys(o.value), ...Object.keys(e.value)])).forEach((
|
|
2771
|
-
const
|
|
2772
|
-
typeof
|
|
2770
|
+
return (/* @__PURE__ */ new Set([...Object.keys(o.value), ...Object.keys(e.value)])).forEach((c) => {
|
|
2771
|
+
const l = o.value[c], f = e.value[c];
|
|
2772
|
+
typeof l == "number" && typeof f == "number" ? a[c] = l + (f - l) * n : l === void 0 ? a[c] = f : f === void 0 ? a[c] = l : a[c] = n < 0.5 ? l : f;
|
|
2773
2773
|
}), a;
|
|
2774
2774
|
}
|
|
2775
2775
|
return typeof o.value == "number" && typeof e.value == "number" ? o.value + (e.value - o.value) * n : n < 0.5 ? o.value : e.value;
|
|
@@ -2788,11 +2788,11 @@ class ci {
|
|
|
2788
2788
|
g: parseInt(m.substring(2, 4), 16),
|
|
2789
2789
|
b: parseInt(m.substring(4, 6), 16)
|
|
2790
2790
|
};
|
|
2791
|
-
}, r = a(s),
|
|
2791
|
+
}, r = a(s), c = a(n), l = Math.round(r.r + (c.r - r.r) * o), f = Math.round(r.g + (c.g - r.g) * o), u = Math.round(r.b + (c.b - r.b) * o), h = (y) => {
|
|
2792
2792
|
const m = Math.max(0, Math.min(255, y)).toString(16);
|
|
2793
2793
|
return m.length === 1 ? "0" + m : m;
|
|
2794
2794
|
};
|
|
2795
|
-
return `#${h(
|
|
2795
|
+
return `#${h(l)}${h(f)}${h(u)}`;
|
|
2796
2796
|
}
|
|
2797
2797
|
interpolateStops(t, i, o) {
|
|
2798
2798
|
return !t || !i || t.length !== i.length ? o < 0.5 ? t : i : t.map((e, s) => {
|
|
@@ -2849,46 +2849,46 @@ class ci {
|
|
|
2849
2849
|
}
|
|
2850
2850
|
}
|
|
2851
2851
|
(this.artboard.clipContent === !0 || this.artboard.clip_content === !0) && (t.beginPath(), t.rect(0, 0, s, n), t.clip());
|
|
2852
|
-
const
|
|
2853
|
-
this.artboard.objects.forEach((u) =>
|
|
2852
|
+
const c = /* @__PURE__ */ new Map();
|
|
2853
|
+
this.artboard.objects.forEach((u) => c.set(u.id, u)), this.artboard.objects.filter((u) => !u.parentId).map((u, h) => {
|
|
2854
2854
|
const d = this.objectStates.get(u.id), p = (d == null ? void 0 : d.zIndex) ?? h;
|
|
2855
2855
|
return { obj: u, zIndex: p };
|
|
2856
2856
|
}).sort((u, h) => u.zIndex - h.zIndex).forEach(({ obj: u }) => {
|
|
2857
|
-
this.renderObject(t, u,
|
|
2857
|
+
this.renderObject(t, u, c);
|
|
2858
2858
|
}), this._emitterPools.forEach((u, h) => {
|
|
2859
|
-
if (!(u.length === 0 || !
|
|
2859
|
+
if (!(u.length === 0 || !c.get(h)))
|
|
2860
2860
|
for (const p of u)
|
|
2861
2861
|
t.save(), t.globalAlpha = p.opacity, t.fillStyle = p.color, t.beginPath(), t.arc(p.x, p.y, Math.max(1, p.size * p.opacity), 0, Math.PI * 2), t.fill(), t.restore();
|
|
2862
2862
|
}), this.lastRenderTime = performance.now() - e, this.debugMode && this.frameCount % 60 === 0 && this.log(`[Engine Debug] Rendered ${this.debug_objectsRendered}/${this.debug_objectsTotal} objects in ${this.lastRenderTime.toFixed(2)}ms`), t.restore();
|
|
2863
2863
|
}
|
|
2864
2864
|
isObjectInView(t, i, o, e, s, n = 0) {
|
|
2865
|
-
const a = t.getTransform(), r = i * a.a + o * a.c + a.e,
|
|
2866
|
-
return r + u >= 0 && r - u <= this.canvasWidth &&
|
|
2865
|
+
const a = t.getTransform(), r = i * a.a + o * a.c + a.e, c = i * a.b + o * a.d + a.f, l = Math.sqrt(a.a * a.a + a.b * a.b), f = Math.sqrt(a.c * a.c + a.d * a.d), u = (e / 2 + n) * l, h = (s / 2 + n) * f;
|
|
2866
|
+
return r + u >= 0 && r - u <= this.canvasWidth && c + h >= 0 && c - h <= this.canvasHeight;
|
|
2867
2867
|
}
|
|
2868
2868
|
calculateTransform(t, i, o, e, s, n) {
|
|
2869
|
-
let a = 1, r = 1,
|
|
2870
|
-
const
|
|
2869
|
+
let a = 1, r = 1, c = 1;
|
|
2870
|
+
const l = o / e, f = t / i;
|
|
2871
2871
|
switch (s) {
|
|
2872
2872
|
case "Contain":
|
|
2873
|
-
f >
|
|
2873
|
+
f > l ? c = i / e : c = t / o, a = r = c;
|
|
2874
2874
|
break;
|
|
2875
2875
|
case "Cover":
|
|
2876
|
-
f >
|
|
2876
|
+
f > l ? c = t / o : c = i / e, a = r = c;
|
|
2877
2877
|
break;
|
|
2878
2878
|
case "Fill":
|
|
2879
2879
|
a = t / o, r = i / e;
|
|
2880
2880
|
break;
|
|
2881
2881
|
case "FitWidth":
|
|
2882
|
-
|
|
2882
|
+
c = t / o, a = r = c;
|
|
2883
2883
|
break;
|
|
2884
2884
|
case "FitHeight":
|
|
2885
|
-
|
|
2885
|
+
c = i / e, a = r = c;
|
|
2886
2886
|
break;
|
|
2887
2887
|
case "None":
|
|
2888
2888
|
a = r = 1;
|
|
2889
2889
|
break;
|
|
2890
2890
|
case "ScaleDown":
|
|
2891
|
-
|
|
2891
|
+
c = Math.min(t / o, i / e), c > 1 && (c = 1), a = r = c;
|
|
2892
2892
|
break;
|
|
2893
2893
|
default:
|
|
2894
2894
|
a = r = 1;
|
|
@@ -2918,27 +2918,27 @@ class ci {
|
|
|
2918
2918
|
}
|
|
2919
2919
|
*/
|
|
2920
2920
|
renderObject(t, i, o) {
|
|
2921
|
-
var p, y, m, b, v, S, C, w, I, M, k, T,
|
|
2921
|
+
var p, y, m, b, v, S, C, w, I, M, k, T, x, P, E, R, O, W, B, $, Y, H, K, A, _;
|
|
2922
2922
|
const e = this.objectStates.get(i.id);
|
|
2923
2923
|
if (!e) {
|
|
2924
2924
|
this.warn("No state for object:", i.id);
|
|
2925
2925
|
return;
|
|
2926
2926
|
}
|
|
2927
|
-
this.frameCount % 60, t.roundRect || (t.roundRect = (L, X, V, it,
|
|
2927
|
+
this.frameCount % 60, t.roundRect || (t.roundRect = (L, X, V, it, lt) => (this.drawRoundRect(t, L, X, V, it, lt), t));
|
|
2928
2928
|
const s = e.geometry ? this.deepMerge(i.geometry, e.geometry) : i.geometry, n = e.style ? this.deepMerge(i.style, e.style) : i.style;
|
|
2929
2929
|
let a = (s == null ? void 0 : s.width) || ((p = i.geometry) == null ? void 0 : p.width) || i.width || 0, r = (s == null ? void 0 : s.height) || ((y = i.geometry) == null ? void 0 : y.height) || i.height || 0;
|
|
2930
2930
|
if ((a === 0 || r === 0) && (s != null && s.points) && Array.isArray(s.points) && s.points.length > 0) {
|
|
2931
2931
|
let L = 1 / 0, X = -1 / 0, V = 1 / 0, it = -1 / 0;
|
|
2932
|
-
s.points.forEach((
|
|
2933
|
-
L = Math.min(L,
|
|
2932
|
+
s.points.forEach((lt) => {
|
|
2933
|
+
L = Math.min(L, lt.x), X = Math.max(X, lt.x), V = Math.min(V, lt.y), it = Math.max(it, lt.y);
|
|
2934
2934
|
}), a === 0 && (a = X - L), r === 0 && (r = it - V);
|
|
2935
2935
|
}
|
|
2936
|
-
const
|
|
2936
|
+
const c = (L) => {
|
|
2937
2937
|
if (L)
|
|
2938
2938
|
return L.corner_radius ?? L.cornerRadius;
|
|
2939
|
-
},
|
|
2939
|
+
}, l = c(e) ?? c(n) ?? c(s) ?? c(i.style) ?? c(i.geometry) ?? 0;
|
|
2940
2940
|
let f = { ...s, width: a, height: r };
|
|
2941
|
-
if (delete f.cornerRadius, f.corner_radius =
|
|
2941
|
+
if (delete f.cornerRadius, f.corner_radius = l, f.type === "Path" && i.weights && i.bindMatrices && f.points) {
|
|
2942
2942
|
const L = this.getGlobalTransform(i.id);
|
|
2943
2943
|
if (L) {
|
|
2944
2944
|
const X = li(
|
|
@@ -2955,29 +2955,29 @@ class ci {
|
|
|
2955
2955
|
return;
|
|
2956
2956
|
const u = i.repeaterConfig, h = u && u.isEnabled && u.count > 1, d = h ? u.count : 1;
|
|
2957
2957
|
for (let L = 0; L < d; L++) {
|
|
2958
|
-
let X = e.x !== void 0 ? e.x : ((m = e.transform) == null ? void 0 : m.x) ?? 0, V = e.y !== void 0 ? e.y : ((b = e.transform) == null ? void 0 : b.y) ?? 0, it = e.rotation !== void 0 ? e.rotation : ((v = e.transform) == null ? void 0 : v.rotation) ?? 0,
|
|
2958
|
+
let X = e.x !== void 0 ? e.x : ((m = e.transform) == null ? void 0 : m.x) ?? 0, V = e.y !== void 0 ? e.y : ((b = e.transform) == null ? void 0 : b.y) ?? 0, it = e.rotation !== void 0 ? e.rotation : ((v = e.transform) == null ? void 0 : v.rotation) ?? 0, lt = e.scale_x !== void 0 ? e.scale_x : ((S = e.transform) == null ? void 0 : S.scale_x) ?? 1, nt = e.scale_y !== void 0 ? e.scale_y : ((C = e.transform) == null ? void 0 : C.scale_y) ?? 1;
|
|
2959
2959
|
if (h && L > 0) {
|
|
2960
2960
|
if (u.type === "Linear") {
|
|
2961
|
-
const
|
|
2962
|
-
X += L *
|
|
2961
|
+
const at = u.offsetX || 0, gt = u.offsetY || 0, j = u.rotation || 0, z = u.scale !== void 0 ? u.scale : 1;
|
|
2962
|
+
X += L * at, V += L * gt, it += L * j, lt *= Math.pow(z, L), nt *= Math.pow(z, L);
|
|
2963
2963
|
} else if (u.type === "Grid") {
|
|
2964
|
-
const
|
|
2965
|
-
X += D * et, V += z *
|
|
2964
|
+
const at = u.cols || Math.ceil(Math.sqrt(u.count)), gt = u.gapX || 0, j = u.gapY || 0, z = Math.floor(L / at), D = L % at, et = a + gt, mt = r + j;
|
|
2965
|
+
X += D * et, V += z * mt;
|
|
2966
2966
|
} else if (u.type === "Radial") {
|
|
2967
|
-
const
|
|
2968
|
-
X = e.x +
|
|
2967
|
+
const at = u.radius || 100, gt = u.startAngle || 0, z = (u.endAngle || 360) - gt, D = u.count > 1 ? z / (z === 360 ? u.count : u.count - 1) : 0, et = gt + L * D, mt = et * Math.PI / 180;
|
|
2968
|
+
X = e.x + at * Math.cos(mt), V = e.y + at * Math.sin(mt), it += et;
|
|
2969
2969
|
}
|
|
2970
2970
|
}
|
|
2971
|
-
const
|
|
2972
|
-
if (!
|
|
2973
|
-
const
|
|
2974
|
-
if (!this.isObjectInView(t, X, V, a, r,
|
|
2971
|
+
const bt = i.type === "Group" || i.type === "Frame" || i.type === "Component", ht = a > 0 && r > 0;
|
|
2972
|
+
if (!bt && ht) {
|
|
2973
|
+
const at = (((w = n.shadow) == null ? void 0 : w.isEnabled) !== !1 ? (((I = n.shadow) == null ? void 0 : I.blur) || 0) + 10 : 0) + (((M = n.blur) == null ? void 0 : M.isEnabled) !== !1 && ((k = n.blur) == null ? void 0 : k.radius) || 0) + 20;
|
|
2974
|
+
if (!this.isObjectInView(t, X, V, a, r, at))
|
|
2975
2975
|
continue;
|
|
2976
2976
|
}
|
|
2977
2977
|
this.debug_objectsRendered++, t.save();
|
|
2978
2978
|
const wt = [], Mt = n.blur || ((T = i.style) == null ? void 0 : T.blur);
|
|
2979
2979
|
Mt && Mt.amount > 0 && wt.push(`blur(${Mt.amount}px)`);
|
|
2980
|
-
const It = n.effect || ((
|
|
2980
|
+
const It = n.effect || ((x = i.style) == null ? void 0 : x.effect), Ot = (It == null ? void 0 : It.isEnabled) === !0, At = It == null ? void 0 : It.type, Tt = (It == null ? void 0 : It.radius) ?? 10;
|
|
2981
2981
|
Ot && At === "LayerBlur" && wt.push(`blur(${Tt}px)`);
|
|
2982
2982
|
const zt = ((P = s == null ? void 0 : s.type) == null ? void 0 : P.toLowerCase().includes("image")) || ((E = i.type) == null ? void 0 : E.toLowerCase().includes("image")), Z = n.adjustments && Object.keys(n.adjustments).length > 0 ? n.adjustments : null, pt = s != null && s.adjustments && Object.keys(s.adjustments).length > 0 ? s.adjustments : null, Et = zt ? pt || Z : Z || pt, ut = zt && !Et ? {
|
|
2983
2983
|
exposure: 0,
|
|
@@ -2992,33 +2992,33 @@ class ci {
|
|
|
2992
2992
|
hue: 0
|
|
2993
2993
|
} : Et;
|
|
2994
2994
|
if (e && ut && (e.geometry = e.geometry || {}, e.geometry.adjustments = { ...ut }), ut) {
|
|
2995
|
-
const
|
|
2995
|
+
const at = (ut.exposure || 0) / 100, gt = ut.contrast || 0, j = 1 + (ut.saturation || 0) / 100, z = (ut.temperature || 0) / 200, D = (ut.tint || 0) / 200, et = (ut.highlights || 0) / 500, mt = (ut.shadows || 0) / 500;
|
|
2996
2996
|
let Pt = "", Ct = "SourceGraphic";
|
|
2997
|
-
if (
|
|
2997
|
+
if (at !== 0 && (Pt += `
|
|
2998
2998
|
<feComponentTransfer in="${Ct}" result="exposure">
|
|
2999
|
-
<feFuncR type="linear" slope="1" intercept="${
|
|
3000
|
-
<feFuncG type="linear" slope="1" intercept="${
|
|
3001
|
-
<feFuncB type="linear" slope="1" intercept="${
|
|
3002
|
-
</feComponentTransfer>`, Ct = "exposure"),
|
|
3003
|
-
const
|
|
2999
|
+
<feFuncR type="linear" slope="1" intercept="${at}"/>
|
|
3000
|
+
<feFuncG type="linear" slope="1" intercept="${at}"/>
|
|
3001
|
+
<feFuncB type="linear" slope="1" intercept="${at}"/>
|
|
3002
|
+
</feComponentTransfer>`, Ct = "exposure"), gt !== 0) {
|
|
3003
|
+
const yt = (gt + 100) / 100, F = 0.5 * (1 - yt);
|
|
3004
3004
|
Pt += `
|
|
3005
3005
|
<feComponentTransfer in="${Ct}" result="contrast">
|
|
3006
|
-
<feFuncR type="linear" slope="${
|
|
3007
|
-
<feFuncG type="linear" slope="${
|
|
3008
|
-
<feFuncB type="linear" slope="${
|
|
3006
|
+
<feFuncR type="linear" slope="${yt}" intercept="${F}"/>
|
|
3007
|
+
<feFuncG type="linear" slope="${yt}" intercept="${F}"/>
|
|
3008
|
+
<feFuncB type="linear" slope="${yt}" intercept="${F}"/>
|
|
3009
3009
|
</feComponentTransfer>`, Ct = "contrast";
|
|
3010
3010
|
}
|
|
3011
3011
|
if (j !== 1 && (Pt += `<feColorMatrix in="${Ct}" type="saturate" values="${j}" result="saturate"/>`, Ct = "saturate"), ut.hue && (Pt += `<feColorMatrix in="${Ct}" type="hueRotate" values="${ut.hue}" result="hue"/>`, Ct = "hue"), ut.negative) {
|
|
3012
|
-
const
|
|
3012
|
+
const yt = 1 - ut.negative / 50;
|
|
3013
3013
|
Pt += `
|
|
3014
3014
|
<feColorMatrix in="${Ct}" type="matrix" result="invert"
|
|
3015
|
-
values="${
|
|
3016
|
-
0 ${
|
|
3017
|
-
0 0 ${
|
|
3015
|
+
values="${yt} 0 0 0 ${1 - yt}
|
|
3016
|
+
0 ${yt} 0 0 ${1 - yt}
|
|
3017
|
+
0 0 ${yt} 0 ${1 - yt}
|
|
3018
3018
|
0 0 0 1 0"/>`, Ct = "invert";
|
|
3019
3019
|
}
|
|
3020
|
-
if (z !== 0 || D !== 0 || et !== 0 ||
|
|
3021
|
-
const
|
|
3020
|
+
if (z !== 0 || D !== 0 || et !== 0 || mt !== 0) {
|
|
3021
|
+
const yt = 1 + et + mt, F = yt * (1 + z - D / 2), Lt = yt * (1 + D), jt = yt * (1 - z - D / 2), Vt = ut.shadows * 0.1 / 255, ce = [
|
|
3022
3022
|
F,
|
|
3023
3023
|
0,
|
|
3024
3024
|
0,
|
|
@@ -3043,16 +3043,16 @@ class ci {
|
|
|
3043
3043
|
Pt += `<feColorMatrix in="${Ct}" type="matrix" values="${ce}" result="advanced"/>`, Ct = "advanced";
|
|
3044
3044
|
}
|
|
3045
3045
|
if (ut.blur && (Pt += `<feGaussianBlur in="${Ct}" stdDeviation="${ut.blur}" result="blur"/>`, Ct = "blur"), Pt) {
|
|
3046
|
-
const
|
|
3046
|
+
const yt = `<svg xmlns="http://www.w3.org/2000/svg"><filter id="f" color-interpolation-filters="sRGB">${Pt}</filter></svg>`, F = btoa(yt);
|
|
3047
3047
|
wt.push(`url('data:image/svg+xml;base64,${F}#f')`);
|
|
3048
3048
|
}
|
|
3049
3049
|
}
|
|
3050
3050
|
wt.length > 0 ? t.filter = wt.join(" ") : t.filter = "none", t.imageSmoothingEnabled = !0, t.imageSmoothingQuality = "high";
|
|
3051
|
-
const vt = t.globalAlpha,
|
|
3052
|
-
t.globalAlpha = vt *
|
|
3051
|
+
const vt = t.globalAlpha, Rt = this.normalizeOpacity(e.opacity !== void 0 ? e.opacity : 100);
|
|
3052
|
+
t.globalAlpha = vt * Rt;
|
|
3053
3053
|
const Xt = e.compositeOperation || e.blendMode;
|
|
3054
3054
|
if (Xt && Xt !== "Normal") {
|
|
3055
|
-
const
|
|
3055
|
+
const at = Xt.toLowerCase();
|
|
3056
3056
|
[
|
|
3057
3057
|
"multiply",
|
|
3058
3058
|
"screen",
|
|
@@ -3082,7 +3082,7 @@ class ci {
|
|
|
3082
3082
|
"xor",
|
|
3083
3083
|
"multiply",
|
|
3084
3084
|
"screen"
|
|
3085
|
-
].includes(
|
|
3085
|
+
].includes(at) && (t.globalCompositeOperation = at);
|
|
3086
3086
|
}
|
|
3087
3087
|
const Bt = t, Dt = e.masks || (i.maskedBy ? [{
|
|
3088
3088
|
maskId: i.maskedBy,
|
|
@@ -3093,69 +3093,72 @@ class ci {
|
|
|
3093
3093
|
isVisible: !0
|
|
3094
3094
|
}] : []);
|
|
3095
3095
|
let Ht = !1;
|
|
3096
|
-
const te = Dt.filter((
|
|
3096
|
+
const te = Dt.filter((at) => at.isVisible !== !1 && o.has(at.maskId));
|
|
3097
3097
|
if (te.length > 0) {
|
|
3098
|
-
const
|
|
3098
|
+
const at = te[0], gt = o.get(at.maskId), j = this.objectStates.get(gt.id);
|
|
3099
3099
|
j && j.visible !== !1 && (Ht = !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), i.parentId && this.applyAbsoluteTransform(this.maskCtx, i.parentId, o), this.maskCtx.save(), this.maskCtx.globalAlpha = 1, t = this.maskCtx, t.filter = Bt.filter);
|
|
3100
3100
|
}
|
|
3101
3101
|
t.translate(Math.round(X), Math.round(V)), t.rotate(it * Math.PI / 180);
|
|
3102
3102
|
const ue = e.skew_x || 0, pe = e.skew_y || 0;
|
|
3103
|
-
(ue !== 0 || pe !== 0)
|
|
3104
|
-
|
|
3103
|
+
if (ue !== 0 || pe !== 0) {
|
|
3104
|
+
const at = Math.tan(ue * Math.PI / 180), gt = Math.tan(pe * Math.PI / 180);
|
|
3105
|
+
t.transform(1 + at * gt, gt, at, 1, 0, 0);
|
|
3106
|
+
}
|
|
3107
|
+
const Qt = e.rotate_x !== void 0 ? e.rotate_x : ((R = e.transform) == null ? void 0 : R.rotate_x) ?? 0, me = e.rotate_y !== void 0 ? e.rotate_y : ((O = e.transform) == null ? void 0 : O.rotate_y) ?? 0, ye = 1 + (e.translate_z !== void 0 ? e.translate_z : ((W = e.transform) == null ? void 0 : W.translate_z) ?? 0) / 1e3, Se = (e.flip_x === !0 ? -1 : 1) * Math.cos(me * Math.PI / 180) * ye, Pe = (e.flip_y === !0 ? -1 : 1) * Math.cos(Qt * Math.PI / 180) * ye;
|
|
3105
3108
|
t.scale(
|
|
3106
|
-
|
|
3109
|
+
lt * Se,
|
|
3107
3110
|
nt * Pe
|
|
3108
3111
|
), n.shadow && n.shadow.isEnabled !== !0 && ((n.shadow.blur || 0) > 0 || Math.abs(n.shadow.offsetX || 0) > 0 || Math.abs(n.shadow.offsetY || 0) > 0) && (n.shadow.isEnabled = !0);
|
|
3109
3112
|
const ae = n.shadow;
|
|
3110
3113
|
if (ae && ae.isEnabled !== !1) {
|
|
3111
|
-
let
|
|
3112
|
-
($ = (B = this.artboard) == null ? void 0 : B.tokens) != null && $.colors && this.artboard.tokens.colors[
|
|
3113
|
-
const
|
|
3114
|
-
let et =
|
|
3115
|
-
if (
|
|
3116
|
-
const Ct =
|
|
3117
|
-
et = `rgba(${Wt}, ${
|
|
3118
|
-
} else if (
|
|
3119
|
-
const Ct =
|
|
3114
|
+
let at = ae.color || "#000000";
|
|
3115
|
+
($ = (B = this.artboard) == null ? void 0 : B.tokens) != null && $.colors && this.artboard.tokens.colors[at] && (at = this.artboard.tokens.colors[at]);
|
|
3116
|
+
const gt = this.normalizeOpacity(ae.opacity ?? 100), j = ae.spread || 0, D = (ae.blur || 0) + j * 1.5;
|
|
3117
|
+
let et = at;
|
|
3118
|
+
if (at.startsWith("#")) {
|
|
3119
|
+
const Ct = at.replace("#", ""), Wt = parseInt(Ct.substring(0, 2), 16), yt = parseInt(Ct.substring(2, 4), 16), F = parseInt(Ct.substring(4, 6), 16);
|
|
3120
|
+
et = `rgba(${Wt}, ${yt}, ${F}, ${gt})`;
|
|
3121
|
+
} else if (at.startsWith("rgba")) {
|
|
3122
|
+
const Ct = at.match(/[\d.]+/g);
|
|
3120
3123
|
if (Ct && Ct.length >= 4) {
|
|
3121
|
-
const Wt = Ct[0],
|
|
3122
|
-
et = `rgba(${Wt}, ${
|
|
3124
|
+
const Wt = Ct[0], yt = Ct[1], F = Ct[2], Lt = Ct[3];
|
|
3125
|
+
et = `rgba(${Wt}, ${yt}, ${F}, ${parseFloat(Lt) * gt})`;
|
|
3123
3126
|
}
|
|
3124
3127
|
}
|
|
3125
|
-
const
|
|
3128
|
+
const mt = t.getTransform(), Pt = Math.sqrt(mt.a * mt.a + mt.b * mt.b) || 1;
|
|
3126
3129
|
t.shadowColor = et, t.shadowBlur = D * Pt, t.shadowOffsetX = (ae.offsetX || 0) * Pt, t.shadowOffsetY = (ae.offsetY || 0) * Pt;
|
|
3127
3130
|
}
|
|
3128
3131
|
const ee = i.liquidFill || ((Y = i.style) == null ? void 0 : Y.liquidFill);
|
|
3129
3132
|
if (ee && ee.enabled) {
|
|
3130
3133
|
t.save();
|
|
3131
|
-
const
|
|
3134
|
+
const at = ee.fillLevel ?? 0.5;
|
|
3132
3135
|
t.beginPath();
|
|
3133
|
-
const
|
|
3134
|
-
t.rect(-a / 2,
|
|
3136
|
+
const gt = r / 2 - r * at;
|
|
3137
|
+
t.rect(-a / 2, gt, a, r * at), t.clip(), t.fillStyle = ee.color || "#3b82f6", t.globalAlpha = t.globalAlpha * (ee.opacity ?? 1);
|
|
3135
3138
|
}
|
|
3136
3139
|
if ((s == null ? void 0 : s.type) === "Text")
|
|
3137
3140
|
this._renderText(t, i, f, n, e, a, r);
|
|
3138
3141
|
else if ((s == null ? void 0 : s.type) === "Image") {
|
|
3139
|
-
const
|
|
3140
|
-
if (
|
|
3141
|
-
let
|
|
3142
|
-
|
|
3143
|
-
this.log(`[ExodeUI] Image loaded successfully, size: ${
|
|
3144
|
-
},
|
|
3145
|
-
console.error("[ExodeUI] Image load failed:", D, `Src preview: ${
|
|
3146
|
-
},
|
|
3142
|
+
const at = s.originalSrc || s.src;
|
|
3143
|
+
if (at) {
|
|
3144
|
+
let gt = this.imageCache.get(at);
|
|
3145
|
+
gt || (gt = new Image(), gt.onload = () => {
|
|
3146
|
+
this.log(`[ExodeUI] Image loaded successfully, size: ${gt.naturalWidth}x${gt.naturalHeight}`);
|
|
3147
|
+
}, gt.onerror = (D) => {
|
|
3148
|
+
console.error("[ExodeUI] Image load failed:", D, `Src preview: ${at.substring(0, 100)}...`);
|
|
3149
|
+
}, gt.src = at, this.imageCache.set(at, gt));
|
|
3147
3150
|
const j = n.stroke && n.stroke.width > 0 && n.stroke.isEnabled !== !1, z = (((H = n.stroke) == null ? void 0 : H.alignment) || "center").toLowerCase();
|
|
3148
|
-
if (j && (z === "outside" || z === "center") && this.applyStrokeAlignment(t, n, f, a, r,
|
|
3151
|
+
if (j && (z === "outside" || z === "center") && this.applyStrokeAlignment(t, n, f, a, r, l), n.fill && n.fill.type !== "None") {
|
|
3149
3152
|
t.save();
|
|
3150
3153
|
const D = t.globalAlpha, et = this.createCanvasFill(t, n.fill, a, r);
|
|
3151
|
-
t.fillStyle = et || n.fill.color || "transparent", t.globalAlpha = D * this.normalizeOpacity(n.fill.opacity ?? 100),
|
|
3154
|
+
t.fillStyle = et || n.fill.color || "transparent", t.globalAlpha = D * this.normalizeOpacity(n.fill.opacity ?? 100), l !== 0 ? (this.drawRoundRect(t, -a / 2, -r / 2, a, r, l), t.fill()) : t.fillRect(-a / 2, -r / 2, a, r), t.globalAlpha = D, t.restore();
|
|
3152
3155
|
}
|
|
3153
|
-
|
|
3156
|
+
gt.complete && gt.naturalWidth > 0 ? (l !== 0 ? (t.save(), this.drawRoundRect(t, -a / 2, -r / 2, a, r, l), t.clip(), t.drawImage(gt, -a / 2, -r / 2, a, r), t.restore()) : t.drawImage(gt, -a / 2, -r / 2, a, r), j && z === "inside" && this.applyStrokeAlignment(t, n, f, a, r, l)) : j && z === "inside" && this.applyStrokeAlignment(t, n, f, a, r, l);
|
|
3154
3157
|
}
|
|
3155
3158
|
} else if (s.type === "SVG") {
|
|
3156
|
-
const
|
|
3157
|
-
if (
|
|
3158
|
-
const
|
|
3159
|
+
const at = s.svgContent;
|
|
3160
|
+
if (at) {
|
|
3161
|
+
const gt = n.palette || [], j = n.fill, z = n.stroke, D = j ? this.normalizeOpacity(j.opacity ?? 100) : 1, et = (j == null ? void 0 : j.type) === "Solid" && (!z || z.isEnabled === !1 || z.type === "Solid" && z.color === j.color), mt = j && j.type !== "None" ? et ? "monochrome" : j.type === "Solid" ? (j.color || "") + "|opacity:" + D : JSON.stringify(j.stops || []) + "|opacity:" + D : "", Pt = z && z.isEnabled !== !1 && (z.width || 0) > 0 ? et ? [
|
|
3159
3162
|
"monochrome",
|
|
3160
3163
|
z.width || 0,
|
|
3161
3164
|
z.trimStart ?? 0,
|
|
@@ -3176,8 +3179,8 @@ class ci {
|
|
|
3176
3179
|
z.dashOffset ?? 0
|
|
3177
3180
|
].join("|") : "nostroke", Ct = [
|
|
3178
3181
|
i.id,
|
|
3179
|
-
|
|
3180
|
-
|
|
3182
|
+
gt.join("_"),
|
|
3183
|
+
mt,
|
|
3181
3184
|
Pt,
|
|
3182
3185
|
e.opacity ?? 100,
|
|
3183
3186
|
e.visible !== !1 ? "v" : "h"
|
|
@@ -3185,17 +3188,17 @@ class ci {
|
|
|
3185
3188
|
let Wt = this.imageCache.get(Ct);
|
|
3186
3189
|
if (!Wt) {
|
|
3187
3190
|
Wt = new Image(), Wt.crossOrigin = "anonymous";
|
|
3188
|
-
let F =
|
|
3191
|
+
let F = at;
|
|
3189
3192
|
F.match(/xmlns=["']http:\/\/www\.w3\.org\/2000\/svg["']/i) || (F = F.replace(/<svg([^>]*)>/i, (tt, dt) => `<svg xmlns="http://www.w3.org/2000/svg"${dt}>`));
|
|
3190
3193
|
let Lt = s.width || a || 100, jt = s.height || r || 100;
|
|
3191
3194
|
const Vt = F.match(/viewBox=["']\s*0\s+0\s+([\d.]+)\s+([\d.]+)\s*["']/i);
|
|
3192
3195
|
if (Vt && (Lt = parseFloat(Vt[1]), jt = parseFloat(Vt[2])), F = F.replace(/<svg([^>]*)>/i, (tt, dt) => {
|
|
3193
3196
|
let G = dt.replace(/\b(?:width|height)=["'][^"']*["']/gi, " ");
|
|
3194
3197
|
return G.match(/\bviewBox=/i) || (G += ` viewBox="0 0 ${Lt} ${jt}"`), G.match(/\bpreserveAspectRatio=/i) || (G += ' preserveAspectRatio="none"'), G += ' width="100%" height="100%"', `<svg${G}>`;
|
|
3195
|
-
}), s.colors && s.colors.length > 0 &&
|
|
3196
|
-
if (
|
|
3198
|
+
}), s.colors && s.colors.length > 0 && gt.length > 0 && s.colors.forEach((tt, dt) => {
|
|
3199
|
+
if (gt[dt]) {
|
|
3197
3200
|
const G = tt.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"), st = new RegExp(G, "gi");
|
|
3198
|
-
F = F.replace(st,
|
|
3201
|
+
F = F.replace(st, gt[dt]);
|
|
3199
3202
|
}
|
|
3200
3203
|
}), j && j.type && j.type !== "None") {
|
|
3201
3204
|
if (j.type === "Solid" && j.color) {
|
|
@@ -3228,7 +3231,7 @@ class ci {
|
|
|
3228
3231
|
}
|
|
3229
3232
|
const Ft = J(tt.center, 0, 0.5) * 100, Ut = J(tt.center, 1, 0.5) * 100, se = (tt.radius ?? 0.5) * 100;
|
|
3230
3233
|
return `<radialGradient id="${dt}" cx="${Ft}%" cy="${Ut}%" r="${se}%" gradientUnits="objectBoundingBox">${st}</radialGradient>`;
|
|
3231
|
-
},
|
|
3234
|
+
}, xt = (tt, dt) => /<defs>/i.test(tt) ? tt.replace(/<defs>/i, `<defs>${dt}`) : tt.replace(/(<svg[^>]*>)/i, `$1<defs>${dt}</defs>`);
|
|
3232
3235
|
if (z && z.isEnabled !== !1 && (z.width || 0) > 0) {
|
|
3233
3236
|
const tt = et ? 1 : this.normalizeOpacity(z.opacity ?? 100), dt = et ? "#FFFFFF" : z.color || (j == null ? void 0 : j.color) || "#000000";
|
|
3234
3237
|
let G = "";
|
|
@@ -3238,7 +3241,7 @@ class ci {
|
|
|
3238
3241
|
G = st.color || z.color || "#000000";
|
|
3239
3242
|
else if (st.type === "LinearGradient" || st.type === "RadialGradient" || st.type === "Linear" || st.type === "Radial") {
|
|
3240
3243
|
const Gt = "exode-stroke";
|
|
3241
|
-
F =
|
|
3244
|
+
F = xt(F, ce(st, Gt, tt)), G = `url(#${Gt})`;
|
|
3242
3245
|
}
|
|
3243
3246
|
}
|
|
3244
3247
|
G || (G = dt), F.match(/\bstroke\s*=\s*["']/i) ? F = F.replace(
|
|
@@ -3249,7 +3252,7 @@ class ci {
|
|
|
3249
3252
|
`stroke:${G}`
|
|
3250
3253
|
);
|
|
3251
3254
|
let J = s.width || a || 100, Ft = s.height || r || 100;
|
|
3252
|
-
const Ut =
|
|
3255
|
+
const Ut = at.match(/viewBox=["']\s*0\s+0\s+([\d.]+)\s+([\d.]+)\s*["']/i);
|
|
3253
3256
|
if (Ut) {
|
|
3254
3257
|
const Gt = parseFloat(Ut[1]), ie = parseFloat(Ut[2]);
|
|
3255
3258
|
!isNaN(Gt) && !isNaN(ie) && (J = Gt, Ft = ie);
|
|
@@ -3260,11 +3263,11 @@ class ci {
|
|
|
3260
3263
|
F.match(/\bstroke-linecap\s*=\s*["']/i) ? F = F.replace(/\bstroke-linecap\s*=\s*["'][^"']*["']/gi, `stroke-linecap="${Ce}"`) : F = F.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-linecap="${Ce}"`), F = F.replace(/stroke-linecap\s*:\s*[^;"')]+/gi, `stroke-linecap:${Ce}`);
|
|
3261
3264
|
const Ee = z.lineJoin || "round";
|
|
3262
3265
|
F.match(/\bstroke-linejoin\s*=\s*["']/i) ? F = F.replace(/\bstroke-linejoin\s*=\s*["'][^"']*["']/gi, `stroke-linejoin="${Ee}"`) : F = F.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-linejoin="${Ee}"`), F = F.replace(/stroke-linejoin\s*:\s*[^;"')]+/gi, `stroke-linejoin:${Ee}`);
|
|
3263
|
-
const Ae = z.trimStart ?? 0, Oe = z.trimEnd ?? 1,
|
|
3266
|
+
const Ae = z.trimStart ?? 0, Oe = z.trimEnd ?? 1, xe = z.trimOffset ?? 0, Re = z.dashOffset ?? 0, $e = Ae !== 0 || Oe !== 1 || xe !== 0 || Re !== 0;
|
|
3264
3267
|
if ($e) {
|
|
3265
3268
|
const Gt = Math.max(0, Math.min(1, Ae)), ie = Math.max(0, Math.min(1, Oe));
|
|
3266
3269
|
this.frameCount % 600 === 0 && this.debugLog(`SVG Trim - Object: ${i.name || i.id}, Start: ${Gt}, End: ${ie}`);
|
|
3267
|
-
const be = (J + Ft) * 2, Le = (
|
|
3270
|
+
const be = (J + Ft) * 2, Le = (xe % 1 + 1) % 1, Fe = (Re % 1 + 1) % 1;
|
|
3268
3271
|
let he = "", re = 0;
|
|
3269
3272
|
if (Gt >= ie)
|
|
3270
3273
|
he = `0 ${be}`, re = 0;
|
|
@@ -3277,10 +3280,10 @@ class ci {
|
|
|
3277
3280
|
const Gt = z.dashArray.join(" ");
|
|
3278
3281
|
F = F.replace(/\bstroke-dasharray\s*=\s*["'][^"']*["']/gi, `stroke-dasharray="${Gt}"`), F = F.replace(/stroke-dasharray\s*:\s*[^;"')]+/gi, `stroke-dasharray:${Gt}`), z.dashOffset && (F = F.replace(/\bstroke-dashoffset\s*=\s*["'][^"']*["']/gi, `stroke-dashoffset="${z.dashOffset}"`), F = F.replace(/stroke-dashoffset\s*:\s*[^;"')]+/gi, `stroke-dashoffset:${z.dashOffset}`));
|
|
3279
3282
|
}
|
|
3280
|
-
if (!/\bstroke\s*=\s*["']/i.test(
|
|
3283
|
+
if (!/\bstroke\s*=\s*["']/i.test(at) && !new RegExp("(?<![a-z-])stroke\\s*:", "i").test(at)) {
|
|
3281
3284
|
let Gt = "", ie = "";
|
|
3282
3285
|
if ($e) {
|
|
3283
|
-
const he = s.width || a || 100, re = s.height || r || 100, le = (he + re) * 2, we = Math.max(0, Math.min(1, Ae)), We = Math.max(0, Math.min(1, Oe)), Ge = (
|
|
3286
|
+
const he = s.width || a || 100, re = s.height || r || 100, le = (he + re) * 2, we = Math.max(0, Math.min(1, Ae)), We = Math.max(0, Math.min(1, Oe)), Ge = (xe % 1 + 1) % 1, De = (Re % 1 + 1) % 1;
|
|
3284
3287
|
if (we >= We)
|
|
3285
3288
|
Gt = ` stroke-dasharray="0 ${le}"`, ie = ' stroke-dashoffset="0"';
|
|
3286
3289
|
else {
|
|
@@ -3295,70 +3298,70 @@ class ci {
|
|
|
3295
3298
|
), F = F.replace(/<\/svg>/i, "</g></svg>");
|
|
3296
3299
|
}
|
|
3297
3300
|
} else z && z.isEnabled === !1 && (F = F.replace(/\bstroke\s*=\s*["'][^"']*["']/gi, 'stroke="none"'), F = F.replace(new RegExp(`(?<![a-z-])stroke\\s*:\\s*(?!none|transparent)[^;"')]+`, "gi"), "stroke:none"));
|
|
3298
|
-
const ft = new Blob([F], { type: "image/svg+xml" }),
|
|
3301
|
+
const ft = new Blob([F], { type: "image/svg+xml" }), ct = URL.createObjectURL(ft);
|
|
3299
3302
|
Wt.onload = () => {
|
|
3300
|
-
if (URL.revokeObjectURL(
|
|
3303
|
+
if (URL.revokeObjectURL(ct), this.frameCount % 900 === 0) {
|
|
3301
3304
|
const tt = this.imageCache.get(Ct);
|
|
3302
3305
|
tt && this.debugLog(`SVG Payload Ready: ${i.name || i.id} (${tt.naturalWidth}x${tt.naturalHeight})`);
|
|
3303
3306
|
}
|
|
3304
3307
|
}, Wt.onerror = () => {
|
|
3305
|
-
URL.revokeObjectURL(
|
|
3306
|
-
}, Wt.src =
|
|
3308
|
+
URL.revokeObjectURL(ct), this.debugLog(`SVG Error: Failed to load payload for ${i.name || i.id}`);
|
|
3309
|
+
}, Wt.src = ct, this.imageCache.set(Ct, Wt);
|
|
3307
3310
|
}
|
|
3308
|
-
let
|
|
3309
|
-
if (Wt.complete && Wt.naturalWidth > 0 ? (
|
|
3311
|
+
let yt = null;
|
|
3312
|
+
if (Wt.complete && Wt.naturalWidth > 0 ? (yt = Wt, this.lastValidSvgImgMap.set(i.id, Wt)) : yt = this.lastValidSvgImgMap.get(i.id) || null, yt && yt.complete && yt.naturalWidth > 0) {
|
|
3310
3313
|
const F = Math.max(1, a), Lt = Math.max(1, r);
|
|
3311
3314
|
if (et && (j == null ? void 0 : j.type) === "Solid") {
|
|
3312
|
-
this.maskBuffer || (this.maskBuffer = document.createElement("canvas"), this.maskCtx = this.maskBuffer.getContext("2d")), this.maskBuffer.width = F, this.maskBuffer.height = Lt, 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, F, Lt), this.maskCtx.drawImage(
|
|
3315
|
+
this.maskBuffer || (this.maskBuffer = document.createElement("canvas"), this.maskCtx = this.maskBuffer.getContext("2d")), this.maskBuffer.width = F, this.maskBuffer.height = Lt, 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, F, Lt), this.maskCtx.drawImage(yt, 0, 0, F, Lt), this.maskCtx.globalCompositeOperation = "source-in";
|
|
3313
3316
|
const jt = j.color || "#000000", Vt = this.normalizeOpacity(j.opacity ?? 100);
|
|
3314
3317
|
this.maskCtx.fillStyle = jt, this.maskCtx.globalAlpha = Vt, this.maskCtx.fillRect(0, 0, F, Lt), t.drawImage(this.maskBuffer, -F / 2, -Lt / 2, F, Lt);
|
|
3315
|
-
} else
|
|
3318
|
+
} else l !== 0 ? (t.save(), this.drawRoundRect(t, -F / 2, -Lt / 2, F, Lt, l), t.clip(), t.drawImage(yt, -F / 2, -Lt / 2, F, Lt), t.restore()) : t.drawImage(yt, -F / 2, -Lt / 2, F, Lt);
|
|
3316
3319
|
}
|
|
3317
3320
|
}
|
|
3318
3321
|
} else if (f.type === "LineGraph")
|
|
3319
3322
|
this.renderLineGraph(t, f, a, r);
|
|
3320
3323
|
else if (i.type === "Shape") {
|
|
3321
|
-
if (this.applyPath(t, f, a, r,
|
|
3322
|
-
const
|
|
3324
|
+
if (this.applyPath(t, f, a, r, l), t.save(), n.blur && n.blur.amount > 0 && (t.filter = `blur(${n.blur.amount}px)`), n.fill) {
|
|
3325
|
+
const at = t.globalAlpha;
|
|
3323
3326
|
if (((A = n.fill) == null ? void 0 : A.type) === "Image" && (n.fill.originalSrc || n.fill.src)) {
|
|
3324
|
-
const
|
|
3325
|
-
let j = this.imageCache.get(
|
|
3326
|
-
j || (j = new Image(), j.src =
|
|
3327
|
+
const gt = n.fill.originalSrc || n.fill.src;
|
|
3328
|
+
let j = this.imageCache.get(gt);
|
|
3329
|
+
j || (j = new Image(), j.src = gt, this.imageCache.set(gt, j)), j.complete && j.naturalWidth > 0 && (t.save(), this.applyPath(t, f, a, r, l), t.clip(), this.renderFittedImage(t, j, -a / 2, -r / 2, a, r, n.fill.fillMode), t.restore());
|
|
3327
3330
|
} else {
|
|
3328
|
-
const
|
|
3329
|
-
t.fillStyle =
|
|
3331
|
+
const gt = this.createCanvasFill(t, n.fill, a, r);
|
|
3332
|
+
t.fillStyle = gt || (typeof n.fill == "string" ? n.fill : n.fill.color || "transparent"), t.globalAlpha = at * this.normalizeOpacity(n.fill.opacity ?? 100), this.applyPath(t, f, a, r, l), t.fill();
|
|
3330
3333
|
}
|
|
3331
|
-
t.globalAlpha =
|
|
3334
|
+
t.globalAlpha = at;
|
|
3332
3335
|
}
|
|
3333
|
-
t.restore(), n.stroke && n.stroke.width > 0 && this.applyStrokeAlignment(t, n, f, a, r,
|
|
3336
|
+
t.restore(), n.stroke && n.stroke.width > 0 && this.applyStrokeAlignment(t, n, f, a, r, l);
|
|
3334
3337
|
} else if (i.type === "Frame" || i.type === "Group" && !i.isStructuralGroup) {
|
|
3335
|
-
const
|
|
3336
|
-
if (t.save(), t.beginPath(), this.drawRoundRect(t, -
|
|
3337
|
-
const z = t.globalAlpha, D = this.createCanvasFill(t, n.fill,
|
|
3338
|
+
const at = e.width ?? s.width ?? i.width ?? a, gt = e.height ?? s.height ?? i.height ?? r, j = l;
|
|
3339
|
+
if (t.save(), t.beginPath(), this.drawRoundRect(t, -at / 2, -gt / 2, at, gt, j), n.fill && n.fill.type !== "None") {
|
|
3340
|
+
const z = t.globalAlpha, D = this.createCanvasFill(t, n.fill, at, gt);
|
|
3338
3341
|
t.fillStyle = D || n.fill.color || "transparent", t.globalAlpha = z * this.normalizeOpacity(n.fill.opacity ?? 100), t.fill(), t.globalAlpha = z;
|
|
3339
3342
|
}
|
|
3340
3343
|
if (t.restore(), n.stroke && n.stroke.width > 0 && n.stroke.isEnabled !== !1) {
|
|
3341
3344
|
const z = { type: "Rectangle" };
|
|
3342
|
-
this.applyStrokeAlignment(t, n, z,
|
|
3345
|
+
this.applyStrokeAlignment(t, n, z, at, gt, j);
|
|
3343
3346
|
}
|
|
3344
3347
|
} else i.type === "Group" && i.isStructuralGroup || (i.type === "Component" && i.variant === "inputbox" ? this.renderInputBox(t, i) : i.type === "Component" && i.variant === "button" ? this.renderButton(t, i) : i.type === "Component" && i.variant === "toggle_button" ? this.renderToggleButton(t, i) : i.type === "Toggle" || i.type === "Component" && i.variant === "toggle" ? this.renderToggle(t, i) : i.type === "Slider" || i.type === "Component" && i.variant === "slider" ? this.renderSlider(t, i) : i.type === "Dropdown" || i.type === "Component" && i.variant === "dropdown" ? this.renderDropdown(t, i) : i.type === "ListView" || i.type === "Component" && i.variant === "listview" ? this.renderListView(t, i) : i.type === "Checkbox" || i.type === "Component" && i.variant === "checkbox" ? this.renderCheckbox(t, i) : i.type === "RadioGroup" || i.type === "Component" && i.variant === "radiogroup" ? this.renderRadioGroup(t, i) : i.type === "BarChart" || i.type === "Component" && i.variant === "barchart" ? this.renderBarChart(t, i) : i.type === "PieChart" || i.type === "Component" && i.variant === "piechart" ? this.renderPieChart(t, i) : i.type === "Joystick" || i.type === "Component" && i.variant === "joystick" ? this.renderJoystick(t, i) : this.frameCount % 300 === 0 && this.warn("[Engine] Unhandled object type in renderObject:", i.type, "Geo:", (_ = i.geometry) == null ? void 0 : _.type));
|
|
3345
|
-
if (this.applyArtEffectOverlay(t, i, f, a, r,
|
|
3346
|
-
const
|
|
3348
|
+
if (this.applyArtEffectOverlay(t, i, f, a, r, l), Ot && At === "BackgroundBlur" && this.applyBackgroundBlurGlass(t, f, a, r, l, It), ee && ee.enabled && t.restore(), i.children && i.children.length > 0) {
|
|
3349
|
+
const gt = i.type === "Frame", j = i.clipsContent !== void 0 ? i.clipsContent : i.clipContent !== void 0 ? i.clipContent : gt;
|
|
3347
3350
|
if (t.save(), j) {
|
|
3348
3351
|
t.beginPath();
|
|
3349
|
-
const D = e.width ?? (s == null ? void 0 : s.width) ?? i.width ?? 0, et = e.height ?? (s == null ? void 0 : s.height) ?? i.height ?? 0,
|
|
3350
|
-
this.drawRoundRect(t, -D / 2, -et / 2, D, et,
|
|
3352
|
+
const D = e.width ?? (s == null ? void 0 : s.width) ?? i.width ?? 0, et = e.height ?? (s == null ? void 0 : s.height) ?? i.height ?? 0, mt = e.cornerRadius ?? (s == null ? void 0 : s.corner_radius) ?? i.cornerRadius ?? 0;
|
|
3353
|
+
this.drawRoundRect(t, -D / 2, -et / 2, D, et, mt), t.clip();
|
|
3351
3354
|
}
|
|
3352
3355
|
let z = 0;
|
|
3353
3356
|
for (i.children.forEach((D) => {
|
|
3354
3357
|
const et = o.get(D);
|
|
3355
3358
|
if (!et) return;
|
|
3356
|
-
const
|
|
3357
|
-
if (Pt && Pt.isMask && (
|
|
3359
|
+
const mt = this.objectStates.get(D), Pt = (mt == null ? void 0 : mt.geometry) || et.geometry;
|
|
3360
|
+
if (Pt && Pt.isMask && (mt == null ? void 0 : mt.visible) !== !1) {
|
|
3358
3361
|
const Ct = Pt.width || 0, Wt = Pt.height || 0;
|
|
3359
3362
|
this.applyObjectTransform(t, D);
|
|
3360
|
-
const
|
|
3361
|
-
this.applyPath(t, Pt, Ct, Wt,
|
|
3363
|
+
const yt = (mt == null ? void 0 : mt.corner_radius) ?? (Pt == null ? void 0 : Pt.corner_radius) ?? 0;
|
|
3364
|
+
this.applyPath(t, Pt, Ct, Wt, yt), t.clip(), z++;
|
|
3362
3365
|
} else
|
|
3363
3366
|
this.renderObject(t, et, o);
|
|
3364
3367
|
}); z > 0; )
|
|
@@ -3374,19 +3377,19 @@ class ci {
|
|
|
3374
3377
|
feather: i.maskFeather || 0,
|
|
3375
3378
|
isVisible: !0
|
|
3376
3379
|
}] : [])).filter((z) => z.isVisible !== !1 && o.has(z.maskId)).forEach((z) => {
|
|
3377
|
-
var
|
|
3378
|
-
const D = o.get(z.maskId), et = this.objectStates.get(D.id),
|
|
3380
|
+
var yt, F, Lt, jt, Vt, ce;
|
|
3381
|
+
const D = o.get(z.maskId), et = this.objectStates.get(D.id), mt = z.feather || 0, Pt = z.inverted === !0, Ct = z.opacity !== void 0 ? typeof z.opacity == "number" ? z.opacity : z.opacity / 100 : 1;
|
|
3379
3382
|
if ((z.type || "alpha") === "luma") {
|
|
3380
|
-
(!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, D.id, o),
|
|
3381
|
-
const
|
|
3382
|
-
if (((
|
|
3383
|
+
(!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, D.id, o), mt > 0 && (this.lumaCtx.filter = `blur(${mt}px)`), this.lumaCtx.globalAlpha = Ct;
|
|
3384
|
+
const xt = (et == null ? void 0 : et.width) || D.geometry.width || 0, ft = (et == null ? void 0 : et.height) || D.geometry.height || 0, ct = (et == null ? void 0 : et.corner_radius) ?? D.corner_radius ?? 0;
|
|
3385
|
+
if (((yt = D.geometry) == null ? void 0 : yt.type) === "Text") {
|
|
3383
3386
|
const st = et != null && et.geometry ? this.deepMerge(D.geometry, et.geometry) : D.geometry, J = et != null && et.style ? this.deepMerge(D.style, et.style) : D.style;
|
|
3384
|
-
this._renderText(this.lumaCtx, D, { ...st, width:
|
|
3387
|
+
this._renderText(this.lumaCtx, D, { ...st, width: xt, height: ft, corner_radius: ct }, J, et, xt, ft, !0);
|
|
3385
3388
|
} else if (((F = D.geometry) == null ? void 0 : F.type) === "Image") {
|
|
3386
3389
|
const st = D.geometry.src;
|
|
3387
3390
|
if (st) {
|
|
3388
3391
|
let J = this.imageCache.get(st);
|
|
3389
|
-
J || (J = new Image(), J.src = st, this.imageCache.set(st, J)), J.complete && J.naturalWidth > 0 ? this.lumaCtx.drawImage(J, -
|
|
3392
|
+
J || (J = new Image(), J.src = st, this.imageCache.set(st, J)), J.complete && J.naturalWidth > 0 ? this.lumaCtx.drawImage(J, -xt / 2, -ft / 2, xt, ft) : (this.applyPath(this.lumaCtx, D.geometry, xt, ft, ct), this.lumaCtx.fillStyle = "#ffffff", this.lumaCtx.fill());
|
|
3390
3393
|
}
|
|
3391
3394
|
} else if (((Lt = D.geometry) == null ? void 0 : Lt.type) === "SVG") {
|
|
3392
3395
|
const st = D.geometry.svgContent;
|
|
@@ -3400,10 +3403,10 @@ class ci {
|
|
|
3400
3403
|
this.artboard && this.reset();
|
|
3401
3404
|
}, this.imageCache.set(J, Ft);
|
|
3402
3405
|
}
|
|
3403
|
-
Ft.complete && Ft.naturalWidth > 0 ? this.lumaCtx.drawImage(Ft, -
|
|
3406
|
+
Ft.complete && Ft.naturalWidth > 0 ? this.lumaCtx.drawImage(Ft, -xt / 2, -ft / 2, xt, ft) : (this.applyPath(this.lumaCtx, D.geometry, xt, ft, ct), this.lumaCtx.fillStyle = "#ffffff", this.lumaCtx.fill());
|
|
3404
3407
|
}
|
|
3405
3408
|
} else
|
|
3406
|
-
this.applyPath(this.lumaCtx, D.geometry,
|
|
3409
|
+
this.applyPath(this.lumaCtx, D.geometry, xt, ft, ct), this.lumaCtx.fillStyle = "#ffffff", this.lumaCtx.fill();
|
|
3407
3410
|
this.lumaCtx.restore();
|
|
3408
3411
|
const tt = this.maskCtx.getImageData(0, 0, this.canvasWidth, this.canvasHeight), dt = this.lumaCtx.getImageData(0, 0, this.canvasWidth, this.canvasHeight).data, G = tt.data;
|
|
3409
3412
|
for (let st = 0; st < G.length; st += 4) {
|
|
@@ -3413,16 +3416,16 @@ class ci {
|
|
|
3413
3416
|
}
|
|
3414
3417
|
this.maskCtx.putImageData(tt, 0, 0);
|
|
3415
3418
|
} else {
|
|
3416
|
-
this.maskCtx.save(), this.rootTransform && this.maskCtx.setTransform(this.rootTransform), this.maskCtx.globalCompositeOperation = Pt ? "destination-out" : "destination-in",
|
|
3417
|
-
const
|
|
3419
|
+
this.maskCtx.save(), this.rootTransform && this.maskCtx.setTransform(this.rootTransform), this.maskCtx.globalCompositeOperation = Pt ? "destination-out" : "destination-in", mt > 0 && (this.maskCtx.filter = `blur(${mt}px)`), this.maskCtx.globalAlpha = Ct, this.applyAbsoluteTransform(this.maskCtx, D.id, o);
|
|
3420
|
+
const xt = (et == null ? void 0 : et.width) || D.geometry.width || 0, ft = (et == null ? void 0 : et.height) || D.geometry.height || 0, ct = (et == null ? void 0 : et.corner_radius) ?? D.corner_radius ?? 0;
|
|
3418
3421
|
if (((jt = D.geometry) == null ? void 0 : jt.type) === "Text") {
|
|
3419
3422
|
const tt = et != null && et.geometry ? this.deepMerge(D.geometry, et.geometry) : D.geometry, dt = et != null && et.style ? this.deepMerge(D.style, et.style) : D.style;
|
|
3420
|
-
this._renderText(this.maskCtx, D, { ...tt, width:
|
|
3423
|
+
this._renderText(this.maskCtx, D, { ...tt, width: xt, height: ft, corner_radius: ct }, dt, et, xt, ft, !0);
|
|
3421
3424
|
} else if (((Vt = D.geometry) == null ? void 0 : Vt.type) === "Image") {
|
|
3422
3425
|
const tt = D.geometry.src;
|
|
3423
3426
|
if (tt) {
|
|
3424
3427
|
let dt = this.imageCache.get(tt);
|
|
3425
|
-
dt || (dt = new Image(), dt.src = tt, this.imageCache.set(tt, dt)), dt.complete && dt.naturalWidth > 0 ? this.maskCtx.drawImage(dt, -
|
|
3428
|
+
dt || (dt = new Image(), dt.src = tt, this.imageCache.set(tt, dt)), dt.complete && dt.naturalWidth > 0 ? this.maskCtx.drawImage(dt, -xt / 2, -ft / 2, xt, ft) : (this.applyPath(this.maskCtx, D.geometry, xt, ft, ct), this.maskCtx.fillStyle = "#ffffff", this.maskCtx.fill());
|
|
3426
3429
|
}
|
|
3427
3430
|
} else if (((ce = D.geometry) == null ? void 0 : ce.type) === "SVG") {
|
|
3428
3431
|
const tt = D.geometry.svgContent;
|
|
@@ -3436,10 +3439,10 @@ class ci {
|
|
|
3436
3439
|
this.artboard && this.reset();
|
|
3437
3440
|
}, this.imageCache.set(dt, G);
|
|
3438
3441
|
}
|
|
3439
|
-
G.complete && G.naturalWidth > 0 ? this.maskCtx.drawImage(G, -
|
|
3442
|
+
G.complete && G.naturalWidth > 0 ? this.maskCtx.drawImage(G, -xt / 2, -ft / 2, xt, ft) : (this.applyPath(this.maskCtx, D.geometry, xt, ft, ct), this.maskCtx.fillStyle = "#ffffff", this.maskCtx.fill());
|
|
3440
3443
|
}
|
|
3441
3444
|
} else
|
|
3442
|
-
this.applyPath(this.maskCtx, D.geometry,
|
|
3445
|
+
this.applyPath(this.maskCtx, D.geometry, xt, ft, ct), this.maskCtx.fillStyle = "#ffffff", this.maskCtx.fill();
|
|
3443
3446
|
this.maskCtx.restore();
|
|
3444
3447
|
}
|
|
3445
3448
|
}), Bt.save(), Bt.setTransform(1, 0, 0, 1, 0, 0);
|
|
@@ -3449,23 +3452,23 @@ class ci {
|
|
|
3449
3452
|
t.restore();
|
|
3450
3453
|
}
|
|
3451
3454
|
}
|
|
3452
|
-
_renderText(t, i, o, e, s, n, a, r = !1,
|
|
3453
|
-
var
|
|
3454
|
-
let
|
|
3455
|
+
_renderText(t, i, o, e, s, n, a, r = !1, c = !1) {
|
|
3456
|
+
var bt, ht, wt, Mt, It, Ot, At, Tt, zt;
|
|
3457
|
+
let l = o.text || "";
|
|
3455
3458
|
if (o.textInputId && !r) {
|
|
3456
3459
|
const Z = this.inputs.get(o.textInputId);
|
|
3457
|
-
Z !== void 0 && (
|
|
3460
|
+
Z !== void 0 && (l = String(Z), s.geometry && s.geometry.type === "Text" && (s.geometry.text = l));
|
|
3458
3461
|
}
|
|
3459
3462
|
if (o.svgPath) {
|
|
3460
3463
|
const Z = o.svgPath;
|
|
3461
3464
|
t.save();
|
|
3462
|
-
const pt = ((
|
|
3465
|
+
const pt = ((bt = e == null ? void 0 : e.fill) == null ? void 0 : bt.color) || "#000000", Et = ((ht = e == null ? void 0 : e.fill) == null ? void 0 : ht.opacity) !== void 0 ? (wt = e == null ? void 0 : e.fill) == null ? void 0 : wt.opacity : 1;
|
|
3463
3466
|
t.fillStyle = pt, t.globalAlpha *= Et;
|
|
3464
3467
|
const ut = new Path2D(Z);
|
|
3465
3468
|
t.fill(ut), t.restore();
|
|
3466
3469
|
return;
|
|
3467
3470
|
}
|
|
3468
|
-
let f =
|
|
3471
|
+
let f = l || "";
|
|
3469
3472
|
o.enableSegments === !0 && o.segments && Array.isArray(o.segments) && (f = o.segments.map((Z) => Z && Z.text ? Z.text : "").join(""));
|
|
3470
3473
|
const u = o.textCase || "none";
|
|
3471
3474
|
u === "uppercase" ? f = f.toUpperCase() : u === "lowercase" ? f = f.toLowerCase() : u === "capitalize" && (f = f.replace(/\b\w/g, (Z) => Z.toUpperCase()));
|
|
@@ -3494,10 +3497,10 @@ class ci {
|
|
|
3494
3497
|
t.letterSpacing !== void 0 && (t.letterSpacing = `${M}px`);
|
|
3495
3498
|
const k = o.kerning || "auto", T = o.kerningValue || 0;
|
|
3496
3499
|
k === "manual" && T !== 0 && (t.letterSpacing = `${M + T}px`);
|
|
3497
|
-
const
|
|
3500
|
+
const x = o.paragraphSpacing || 0;
|
|
3498
3501
|
let P = o.lineHeight ?? 1.2;
|
|
3499
3502
|
typeof P == "string" && (P = parseFloat(P)), P > 5 && y > 0 && (P = P / y);
|
|
3500
|
-
const E = (P || 1.2) * y,
|
|
3503
|
+
const E = (P || 1.2) * y, R = o.isPointText === !0 || !o.width || o.width <= 0, O = ((It = o.padding) == null ? void 0 : It.left) || ((Ot = o.padding) == null ? void 0 : Ot.right) || 0, W = R ? 1e5 : o.width && o.width > 0 ? Math.ceil(o.width) - O * 2 : 1e5;
|
|
3501
3504
|
o.autoHeight;
|
|
3502
3505
|
const B = us({
|
|
3503
3506
|
text: f,
|
|
@@ -3508,7 +3511,7 @@ class ci {
|
|
|
3508
3511
|
lineHeight: P,
|
|
3509
3512
|
width: W,
|
|
3510
3513
|
letterSpacing: M,
|
|
3511
|
-
paragraphSpacing:
|
|
3514
|
+
paragraphSpacing: x,
|
|
3512
3515
|
paragraphIndent: o.paragraphIndent || 0,
|
|
3513
3516
|
segments: o.segments,
|
|
3514
3517
|
enableSegments: o.enableSegments,
|
|
@@ -3522,8 +3525,8 @@ class ci {
|
|
|
3522
3525
|
let Z = 0, pt = 0;
|
|
3523
3526
|
const Et = B.fullText || f;
|
|
3524
3527
|
($ || []).forEach((ut) => {
|
|
3525
|
-
const vt = ut.text || "",
|
|
3526
|
-
|
|
3528
|
+
const vt = ut.text || "", Rt = t.measureText(vt).width + (vt.length > 0 ? (vt.length - 1) * M : 0);
|
|
3529
|
+
Rt > Z && (Z = Rt), pt += vt.length, pt < Et.length && (Et[pt] === `
|
|
3527
3530
|
` || Et[pt] === "\r") && (pt++, Et[pt - 1] === "\r" && Et[pt] === `
|
|
3528
3531
|
` && pt++);
|
|
3529
3532
|
}), (_ === 0 || _ >= 1e5) && (_ = Z), L === 0 && (L = A || 0);
|
|
@@ -3538,12 +3541,12 @@ class ci {
|
|
|
3538
3541
|
V = { geo: Et, obj: Z, w: ut, h: vt }, it = this.getPerimeter(Et, ut, vt);
|
|
3539
3542
|
}
|
|
3540
3543
|
}
|
|
3541
|
-
const
|
|
3544
|
+
const lt = (Z, pt) => {
|
|
3542
3545
|
var ut, vt;
|
|
3543
3546
|
if (M === 0 && (!o.enableSegments || !((ut = o.segments) != null && ut.length))) return t.measureText(Z).width;
|
|
3544
3547
|
let Et = 0;
|
|
3545
|
-
for (let
|
|
3546
|
-
const Xt = pt +
|
|
3548
|
+
for (let Rt = 0; Rt < Z.length; Rt++) {
|
|
3549
|
+
const Xt = pt + Rt;
|
|
3547
3550
|
let Bt = 0;
|
|
3548
3551
|
if (o.enableSegments === !0 && ((vt = o.segments) == null ? void 0 : vt.length) > 0) {
|
|
3549
3552
|
let Dt = 0, Ht = null;
|
|
@@ -3558,24 +3561,24 @@ class ci {
|
|
|
3558
3561
|
t.save();
|
|
3559
3562
|
let te = Ht.fontFamily || o.fontFamily || "Inter";
|
|
3560
3563
|
const ue = this.mapFontWeight((Ht.fontWeight || o.fontWeight || "400").toString()), pe = Ht.fontStyle || d, Qt = Ht.fontSize || y;
|
|
3561
|
-
t.font = `${pe} ${ue} ${Qt}px "${te}", sans-serif`, Bt = t.measureText(Z[
|
|
3564
|
+
t.font = `${pe} ${ue} ${Qt}px "${te}", sans-serif`, Bt = t.measureText(Z[Rt]).width, t.restore();
|
|
3562
3565
|
} else
|
|
3563
|
-
Bt = t.measureText(Z[
|
|
3566
|
+
Bt = t.measureText(Z[Rt]).width;
|
|
3564
3567
|
} else
|
|
3565
|
-
Bt = t.measureText(Z[
|
|
3568
|
+
Bt = t.measureText(Z[Rt]).width;
|
|
3566
3569
|
Et += Bt + M;
|
|
3567
3570
|
}
|
|
3568
3571
|
return Et - (Z.length > 0 ? M : 0);
|
|
3569
3572
|
}, nt = (Z, pt, Et, ut, vt) => {
|
|
3570
3573
|
var ue, pe;
|
|
3571
3574
|
const Xt = (vt === 0 || f[vt - 1] === `
|
|
3572
|
-
` || f[vt - 1] === "\r") && o.paragraphIndent ? o.paragraphIndent : 0, Bt = (!r ||
|
|
3575
|
+
` || f[vt - 1] === "\r") && o.paragraphIndent ? o.paragraphIndent : 0, Bt = (!r || c) && (i.behaviors || []).some(
|
|
3573
3576
|
(Qt) => Qt.enabled && (Qt.type.toString().includes("Text") || ["Typewriter", "Scramble", "Wave", "Bounce", "GlitchText", "Reveal3D", "RevealSlide", "RevealBlur"].includes(Qt.type))
|
|
3574
3577
|
), Dt = !o.pathId && !Bt && (o.enableSegments !== !0 || !o.segments || o.segments.length === 0), Ht = o.baselineShift || 0, te = Et + Ht;
|
|
3575
3578
|
if (Dt)
|
|
3576
3579
|
t.font = C, ut ? t.strokeText(Z, pt + Xt, te) : t.fillText(Z, pt + Xt, te);
|
|
3577
3580
|
else {
|
|
3578
|
-
const Qt =
|
|
3581
|
+
const Qt = lt(Z, vt);
|
|
3579
3582
|
let me = pt + Xt;
|
|
3580
3583
|
I === "center" ? me -= Qt / 2 : I === "right" && (me -= Qt);
|
|
3581
3584
|
const _e = vt + Z.length >= f.length || f[vt + Z.length] === `
|
|
@@ -3583,19 +3586,19 @@ class ci {
|
|
|
3583
3586
|
let ye = 0, Se = 0;
|
|
3584
3587
|
const Pe = o.justifyMinWordSpacing, ae = o.justifyMaxWordSpacing;
|
|
3585
3588
|
if (I === "justify" && !_e && Qt > 0 && !o.pathId) {
|
|
3586
|
-
const j =
|
|
3589
|
+
const j = R ? Qt : W - O * 2 + 0, z = Math.max(0, j - Qt);
|
|
3587
3590
|
for (let D = 0; D < Z.length; D++)
|
|
3588
3591
|
Z[D] === " " && Se++;
|
|
3589
3592
|
if (Se > 0) {
|
|
3590
3593
|
const D = t.measureText(" ").width;
|
|
3591
|
-
let et = Pe || D * 0.5,
|
|
3592
|
-
ye = Math.max(0, Math.min(z / Se,
|
|
3594
|
+
let et = Pe || D * 0.5, mt = ae || D * 2.5;
|
|
3595
|
+
ye = Math.max(0, Math.min(z / Se, mt - et));
|
|
3593
3596
|
}
|
|
3594
3597
|
}
|
|
3595
3598
|
let ee = o.pathOffset || 0;
|
|
3596
3599
|
o.pathId && it > 0 && V && (I === "center" ? ee += it / 2 - Qt / 2 : I === "right" && (ee += it - Qt));
|
|
3597
|
-
let
|
|
3598
|
-
const
|
|
3600
|
+
let at = me;
|
|
3601
|
+
const gt = r && !c ? [] : ((ue = i.behaviors) == null ? void 0 : ue.filter(
|
|
3599
3602
|
(j) => [
|
|
3600
3603
|
N.Typewriter,
|
|
3601
3604
|
N.Scramble,
|
|
@@ -3631,145 +3634,145 @@ class ci {
|
|
|
3631
3634
|
for (let j = 0; j < Z.length; j++) {
|
|
3632
3635
|
let z = Z[j];
|
|
3633
3636
|
const D = vt + j;
|
|
3634
|
-
let et = 0,
|
|
3635
|
-
|
|
3636
|
-
const
|
|
3637
|
+
let et = 0, mt = 0, Pt = 1, Ct = 1, Wt = 0, yt = 1, F = z;
|
|
3638
|
+
gt.forEach((ft) => {
|
|
3639
|
+
const ct = ft.settings || {}, tt = ct.strength || 1, dt = Date.now();
|
|
3637
3640
|
if (ft.type === N.Typewriter)
|
|
3638
|
-
this.currentTime * (
|
|
3641
|
+
this.currentTime * (ct.speed || 1) - D * (ct.stagger || 0.05) < 0 && (yt = 0);
|
|
3639
3642
|
else if (ft.type === N.Scramble)
|
|
3640
|
-
Math.max(0, Math.min(1, this.currentTime / (
|
|
3643
|
+
Math.max(0, Math.min(1, this.currentTime / (ct.duration || 1.5)) - D * 0.02) < 1 && Math.random() < 0.3 && (F = "$%#@!*&"[Math.floor(Math.random() * 7)]);
|
|
3641
3644
|
else if (ft.type === N.Wave)
|
|
3642
|
-
|
|
3645
|
+
mt += Math.sin(this.currentTime * 5 * (ct.speed || 1) + D * (ct.frequency || 1)) * (ct.amplitude || 20) * tt;
|
|
3643
3646
|
else if (ft.type === N.Bounce) {
|
|
3644
|
-
const G = Math.max(0, this.currentTime % 2 - D * (
|
|
3645
|
-
G < 1 && (
|
|
3647
|
+
const G = Math.max(0, this.currentTime % 2 - D * (ct.stagger || 0.1));
|
|
3648
|
+
G < 1 && (mt -= Math.abs(Math.sin(G * Math.PI)) * (ct.height || 50) * tt);
|
|
3646
3649
|
} else if (ft.type === N.TextTrail) {
|
|
3647
|
-
const G = this.pointerHistory[Math.max(0, this.pointerHistory.length - 1 - D * (
|
|
3648
|
-
G && (et += (G.x - (s.x +
|
|
3650
|
+
const G = this.pointerHistory[Math.max(0, this.pointerHistory.length - 1 - D * (ct.delay || 5))];
|
|
3651
|
+
G && (et += (G.x - (s.x + at)) * tt * 0.2, mt += (G.y - (s.y + Et + mt)) * tt * 0.2);
|
|
3649
3652
|
} else if (ft.type === N.Reveal3D) {
|
|
3650
|
-
const G = Math.max(0, Math.min(1, this.currentTime * (
|
|
3651
|
-
Pt *= G, Ct *= G,
|
|
3653
|
+
const G = Math.max(0, Math.min(1, this.currentTime * (ct.speed || 1) - D * (ct.stagger || 0.1)));
|
|
3654
|
+
Pt *= G, Ct *= G, yt = G;
|
|
3652
3655
|
} else if (ft.type === N.RevealSlide) {
|
|
3653
|
-
const G = Math.max(0, Math.min(1, this.currentTime * 1.5 - D * 0.05)), st = (1 - G) * (
|
|
3654
|
-
J === "up" ?
|
|
3656
|
+
const G = Math.max(0, Math.min(1, this.currentTime * 1.5 - D * 0.05)), st = (1 - G) * (ct.distance || 40) * tt, J = ct.direction || "up";
|
|
3657
|
+
J === "up" ? mt -= st : J === "down" ? mt += st : J === "left" ? et -= st : J === "right" && (et += st), yt = G;
|
|
3655
3658
|
} else if (ft.type === N.RevealBlur) {
|
|
3656
3659
|
const G = Math.max(0, Math.min(1, this.currentTime * 1.2 - D * 0.1));
|
|
3657
|
-
|
|
3660
|
+
yt = G, et += (1 - G) * 5;
|
|
3658
3661
|
} else if (ft.type === N.TextLiquid) {
|
|
3659
|
-
const G = Math.max(0, Math.sin(dt * 1e-3 * (
|
|
3660
|
-
|
|
3662
|
+
const G = Math.max(0, Math.sin(dt * 1e-3 * (ct.speed || 1) + D * 0.5));
|
|
3663
|
+
mt += G * (ct.amplitude || 10) * tt, Ct *= 1 + G * 0.2;
|
|
3661
3664
|
} else if (ft.type === N.TextVortex) {
|
|
3662
|
-
const G = dt * 2e-3 * (
|
|
3663
|
-
et += Math.cos(G) * st * tt,
|
|
3665
|
+
const G = dt * 2e-3 * (ct.speed || 1) + D * 0.2, st = (1 - (Math.sin(dt * 1e-3) * 0.5 + 0.5)) * (ct.radius || 50);
|
|
3666
|
+
et += Math.cos(G) * st * tt, mt += Math.sin(G) * st * tt;
|
|
3664
3667
|
} else if (ft.type === N.TextExplosion) {
|
|
3665
|
-
const G =
|
|
3668
|
+
const G = ct.force || 1, st = this.currentTime % 2;
|
|
3666
3669
|
if (st < 1) {
|
|
3667
3670
|
const J = (D / Z.length - 0.5) * Math.PI * 2, Ft = st * 100 * G;
|
|
3668
|
-
et += Math.cos(J) * Ft * tt,
|
|
3671
|
+
et += Math.cos(J) * Ft * tt, mt += Math.sin(J) * Ft * tt, yt = 1 - st;
|
|
3669
3672
|
}
|
|
3670
3673
|
} else if (ft.type === N.TextRain) {
|
|
3671
|
-
const G =
|
|
3672
|
-
|
|
3674
|
+
const G = ct.speed || 1, st = ct.height || 100, J = (dt * 1e-3 * G + D * 0.1) % 1;
|
|
3675
|
+
mt -= (1 - J) * st * tt, yt = J > 0.1 ? 1 : J * 10;
|
|
3673
3676
|
} else if (ft.type === N.TextGravity) {
|
|
3674
|
-
const G =
|
|
3675
|
-
J < 100 ?
|
|
3677
|
+
const G = ct.gravity || 9.8, st = this.currentTime % 3 / 3, J = 0.5 * G * Math.pow(st * 10, 2);
|
|
3678
|
+
J < 100 ? mt += J * tt : mt += 100 * tt;
|
|
3676
3679
|
} else if (ft.type === N.TextMatrix) {
|
|
3677
|
-
const G =
|
|
3680
|
+
const G = ct.speed || 1;
|
|
3678
3681
|
if (Math.random() < 0.1 * G) {
|
|
3679
3682
|
const J = "0123456789ABCDEF!@#$%^&*";
|
|
3680
3683
|
F = J[Math.floor(Math.random() * J.length)];
|
|
3681
3684
|
}
|
|
3682
|
-
|
|
3685
|
+
yt = 0.3 + (Math.sin(dt * 0.01 * G + D) + 1) / 2 * 0.7;
|
|
3683
3686
|
} else if (ft.type === N.TextNeon) {
|
|
3684
3687
|
const G = Math.random() > 0.95 ? 0.5 : 1;
|
|
3685
|
-
|
|
3688
|
+
yt = (0.7 + (Math.sin(dt * 5e-3) + 1) / 2 * 0.3) * G;
|
|
3686
3689
|
} else if (ft.type === N.TextDissolve)
|
|
3687
|
-
Math.sin(D * 1.5 + dt * 2e-3 * (
|
|
3690
|
+
Math.sin(D * 1.5 + dt * 2e-3 * (ct.speed || 1)) > 0.5 && (yt = 0);
|
|
3688
3691
|
else if (ft.type === N.TextOrganic) {
|
|
3689
|
-
const G =
|
|
3690
|
-
et += Math.sin(dt * 2e-3 * G + D) * st * tt,
|
|
3692
|
+
const G = ct.speed || 1, st = ct.amplitude || 10;
|
|
3693
|
+
et += Math.sin(dt * 2e-3 * G + D) * st * tt, mt += Math.cos(dt * 15e-4 * G + D * 0.7) * st * tt;
|
|
3691
3694
|
} else if (ft.type === N.TextBreathe) {
|
|
3692
3695
|
const st = 1 + (Math.sin(dt * 3e-3 + D * 0.2) + 1) / 2 * 0.2 * tt;
|
|
3693
3696
|
Pt *= st, Ct *= st;
|
|
3694
3697
|
} else if (ft.type === N.TextSpin) {
|
|
3695
|
-
const G =
|
|
3698
|
+
const G = ct.speed || 1;
|
|
3696
3699
|
Wt += dt * 0.01 * G + D;
|
|
3697
3700
|
} else if (ft.type === N.TextMagnet) {
|
|
3698
3701
|
const G = this.pointerHistory[this.pointerHistory.length - 1];
|
|
3699
3702
|
if (G) {
|
|
3700
|
-
const st = G.x - (s.x +
|
|
3703
|
+
const st = G.x - (s.x + at), J = G.y - (s.y + Et);
|
|
3701
3704
|
Wt = Math.atan2(J, st);
|
|
3702
3705
|
}
|
|
3703
3706
|
} else if (ft.type === N.TextPerspective) {
|
|
3704
3707
|
const G = Z.length / 2, st = (D - G) / G, J = 1 - Math.abs(st) * 0.3 * tt;
|
|
3705
3708
|
Pt *= J, Ct *= J, et += st * 20 * tt;
|
|
3706
3709
|
} else if (ft.type === N.TextMirror)
|
|
3707
|
-
|
|
3710
|
+
yt *= 0.8;
|
|
3708
3711
|
else if (ft.type === N.TextFloral) {
|
|
3709
|
-
const G =
|
|
3712
|
+
const G = ct.speed || 1, st = ct.stagger || 0.1, J = (dt * 1e-3 * G + D * st) % 2;
|
|
3710
3713
|
J < 1 && (Pt *= J, Ct *= J, Wt += J * Math.PI);
|
|
3711
3714
|
} else if (ft.type === N.TextSmoke) {
|
|
3712
|
-
const G =
|
|
3713
|
-
|
|
3715
|
+
const G = ct.speed || 1, st = ct.height || 50, J = (dt * 5e-4 * G + D * 0.2) % 1;
|
|
3716
|
+
mt -= J * st * tt, et += Math.sin(dt * 2e-3 + D) * 5 * tt, yt = 1 - J;
|
|
3714
3717
|
} else if (ft.type === N.TextVariable) {
|
|
3715
|
-
const G =
|
|
3718
|
+
const G = ct.speed || 1, st = ct.intensity || 1.5, J = (Math.sin(dt * 4e-3 * G + D * 0.3) + 1) / 2;
|
|
3716
3719
|
Pt *= 1 + J * (st - 1) * tt;
|
|
3717
3720
|
} else if (ft.type === N.TextZing) {
|
|
3718
|
-
const G =
|
|
3719
|
-
et += (1 - J) * st * tt,
|
|
3721
|
+
const G = ct.speed || 2, st = ct.distance || 100, J = (dt * 2e-3 * G + D * 0.05) % 1;
|
|
3722
|
+
et += (1 - J) * st * tt, yt = J;
|
|
3720
3723
|
} else if (ft.type === N.TextElastic) {
|
|
3721
|
-
const G =
|
|
3724
|
+
const G = ct.stiffness || 0.2, st = ct.damping || 0.1, J = Math.sin(dt * 0.01) * Math.exp(-dt * 1e-3 * st);
|
|
3722
3725
|
Ct *= 1 + J * G * tt;
|
|
3723
3726
|
} else if (ft.type === N.TextGlitch3D) {
|
|
3724
|
-
const G =
|
|
3725
|
-
Math.random() < 0.2 && (et += (Math.random() - 0.5) * G,
|
|
3727
|
+
const G = ct.intensity || 5;
|
|
3728
|
+
Math.random() < 0.2 && (et += (Math.random() - 0.5) * G, mt += (Math.random() - 0.5) * G, yt = 0.8);
|
|
3726
3729
|
} else if (ft.type === N.GlitchText) {
|
|
3727
|
-
const G =
|
|
3728
|
-
Math.random() < 0.1 && (et += (Math.random() - 0.5) * G,
|
|
3730
|
+
const G = ct.intensity || 5;
|
|
3731
|
+
Math.random() < 0.1 && (et += (Math.random() - 0.5) * G, mt += (Math.random() - 0.5) * G, Math.random() < 0.05 && (yt = 0.5));
|
|
3729
3732
|
}
|
|
3730
3733
|
});
|
|
3731
3734
|
let Lt = null, jt = o.textDecoration || "none", Vt = y;
|
|
3732
3735
|
if (o.enableSegments === !0 && ((pe = o.segments) == null ? void 0 : pe.length) > 0) {
|
|
3733
|
-
let ft = 0,
|
|
3736
|
+
let ft = 0, ct = null;
|
|
3734
3737
|
for (const tt of o.segments) {
|
|
3735
3738
|
if (D < ft + (tt.text || "").length) {
|
|
3736
|
-
|
|
3739
|
+
ct = tt;
|
|
3737
3740
|
break;
|
|
3738
3741
|
}
|
|
3739
3742
|
ft += (tt.text || "").length;
|
|
3740
3743
|
}
|
|
3741
|
-
if (
|
|
3742
|
-
let tt =
|
|
3744
|
+
if (ct) {
|
|
3745
|
+
let tt = ct.fontFamily || o.fontFamily || "Inter";
|
|
3743
3746
|
b.forEach((st) => {
|
|
3744
3747
|
const J = new RegExp(`[\\s-]${st}$`, "i");
|
|
3745
3748
|
J.test(tt) && (tt = tt.replace(J, "").trim());
|
|
3746
3749
|
});
|
|
3747
|
-
const dt = this.mapFontWeight((
|
|
3748
|
-
Vt =
|
|
3750
|
+
const dt = this.mapFontWeight((ct.fontWeight || o.fontWeight || "400").toString()), G = ct.fontStyle || d;
|
|
3751
|
+
Vt = ct.fontSize || y, t.font = `${G} ${dt} ${Vt}px "${tt}", sans-serif`, ct.fill && (Lt = ct.fill), ct.textDecoration && (jt = ct.textDecoration), Vt < Y && (mt += (Y - Vt) * 0.85);
|
|
3749
3752
|
}
|
|
3750
3753
|
} else
|
|
3751
3754
|
t.font = C;
|
|
3752
3755
|
const ce = t.globalAlpha;
|
|
3753
|
-
t.globalAlpha *=
|
|
3754
|
-
const
|
|
3756
|
+
t.globalAlpha *= yt, t.save();
|
|
3757
|
+
const xt = t.measureText(F).width;
|
|
3755
3758
|
if (V && it > 0) {
|
|
3756
|
-
const ft =
|
|
3759
|
+
const ft = at - me + xt / 2, tt = (ee + ft) / it, dt = this.getPointOnPath(V.geo, V.w, V.h, Math.abs(tt % 1)), G = dt.angle, st = Et + mt + (o.pathOffsetY || 0), J = o.pathSide === "right" ? -1 : 1, Ft = Math.cos(G + Math.PI / 2) * st * J, Ut = Math.sin(G + Math.PI / 2) * st * J;
|
|
3757
3760
|
t.translate(dt.x + Ft + et, dt.y + Ut), t.rotate(G + Wt + (J === -1 ? Math.PI : 0));
|
|
3758
3761
|
} else
|
|
3759
|
-
t.translate(
|
|
3760
|
-
if (t.scale(Pt, Ct), Lt && !r && !
|
|
3762
|
+
t.translate(at + et + xt / 2, Et + mt), Wt !== 0 && t.rotate(Wt);
|
|
3763
|
+
if (t.scale(Pt, Ct), Lt && !r && !c) {
|
|
3761
3764
|
const ft = this.createCanvasFill(t, Lt, _, L);
|
|
3762
3765
|
t.fillStyle = ft || Lt.color || "#000000";
|
|
3763
|
-
} else if (!r && !
|
|
3766
|
+
} else if (!r && !c) {
|
|
3764
3767
|
const ft = this.createCanvasFill(t, e.fill, _, L);
|
|
3765
3768
|
t.fillStyle = ft || e.fill.color || "#000000";
|
|
3766
3769
|
}
|
|
3767
|
-
if (
|
|
3768
|
-
if (r ||
|
|
3769
|
-
const ft =
|
|
3770
|
-
t.fillStyle = ft || e.fill.color || "#ffffff", t.fillText(F, -
|
|
3771
|
-
} else ut ? t.strokeText(F, -
|
|
3772
|
-
jt !== "none" && !r && this.drawTextDecoration(t, jt, 0, 0,
|
|
3770
|
+
if (yt > 0)
|
|
3771
|
+
if (r || c) {
|
|
3772
|
+
const ft = c ? "#000000" : this.createCanvasFill(t, e.fill, _, L);
|
|
3773
|
+
t.fillStyle = ft || e.fill.color || "#ffffff", t.fillText(F, -xt / 2, 0);
|
|
3774
|
+
} else ut ? t.strokeText(F, -xt / 2, 0) : t.fillText(F, -xt / 2, 0);
|
|
3775
|
+
jt !== "none" && !r && this.drawTextDecoration(t, jt, 0, 0, xt, Vt), t.restore(), t.globalAlpha = ce, I === "justify" && ye > 0 && F === " " && !_e ? at += xt + M + ye : at += xt + M;
|
|
3773
3776
|
}
|
|
3774
3777
|
}
|
|
3775
3778
|
};
|
|
@@ -3778,10 +3781,10 @@ class ci {
|
|
|
3778
3781
|
($ || []).forEach((Et) => {
|
|
3779
3782
|
const ut = Et.text || "", vt = f.indexOf(ut, Z);
|
|
3780
3783
|
vt !== -1 && (Z = vt);
|
|
3781
|
-
let
|
|
3782
|
-
I === "center" ?
|
|
3784
|
+
let Rt = -_ / 2;
|
|
3785
|
+
I === "center" ? Rt = 0 : I === "right" && (Rt = _ / 2), nt(ut, Rt, pt, !1, Z), Z += ut.length, pt += E;
|
|
3783
3786
|
});
|
|
3784
|
-
} else if (
|
|
3787
|
+
} else if (c) {
|
|
3785
3788
|
let Z = 0, pt = X;
|
|
3786
3789
|
($ || []).forEach((Et) => {
|
|
3787
3790
|
const ut = Et.text || "";
|
|
@@ -3799,12 +3802,12 @@ class ci {
|
|
|
3799
3802
|
const Dt = Xt.textCase || o.textCase || "none";
|
|
3800
3803
|
return Dt === "uppercase" ? Bt.toUpperCase() : Dt === "lowercase" ? Bt.toLowerCase() : Dt === "capitalize" ? Bt.replace(/\b\w/g, (Ht) => Ht.toUpperCase()) : Bt;
|
|
3801
3804
|
}).join("") : f);
|
|
3802
|
-
let vt = 0,
|
|
3805
|
+
let vt = 0, Rt = X;
|
|
3803
3806
|
($ || []).forEach((Xt) => {
|
|
3804
3807
|
const Bt = Xt.text || "";
|
|
3805
3808
|
let Dt = -_ / 2;
|
|
3806
|
-
I === "center" ? Dt = 0 : I === "right" && (Dt = _ / 2), nt(Bt, Dt,
|
|
3807
|
-
` || ut[vt] === "\r") && (
|
|
3809
|
+
I === "center" ? Dt = 0 : I === "right" && (Dt = _ / 2), nt(Bt, Dt, Rt, !1, vt), vt += Bt.length, Rt += E, vt < ut.length && (ut[vt] === `
|
|
3810
|
+
` || ut[vt] === "\r") && (x > 0 && (Rt += x), vt++, ut[vt - 1] === "\r" && ut[vt] === `
|
|
3808
3811
|
` && vt++);
|
|
3809
3812
|
}), t.globalAlpha = pt;
|
|
3810
3813
|
}
|
|
@@ -3813,9 +3816,9 @@ class ci {
|
|
|
3813
3816
|
let pt = 0;
|
|
3814
3817
|
($ || []).forEach((Et, ut) => {
|
|
3815
3818
|
var Xt, Bt;
|
|
3816
|
-
const
|
|
3819
|
+
const Rt = pt === 0 || pt < f.length && (f[pt] === `
|
|
3817
3820
|
` || f[pt] === "\r");
|
|
3818
|
-
if (
|
|
3821
|
+
if (Rt && ut > 0 && pt++, Rt) {
|
|
3819
3822
|
if (((Xt = Z.top) == null ? void 0 : Xt.width) > 0) {
|
|
3820
3823
|
const Dt = X + ut * E - Z.top.offset;
|
|
3821
3824
|
t.strokeStyle = Z.top.color || "#000000", t.lineWidth = Z.top.width, t.beginPath();
|
|
@@ -3836,10 +3839,10 @@ class ci {
|
|
|
3836
3839
|
const pt = t.globalAlpha;
|
|
3837
3840
|
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 = pt * this.normalizeOpacity(e.stroke.opacity ?? 100);
|
|
3838
3841
|
let ut = 0, vt = X;
|
|
3839
|
-
($ || []).forEach((
|
|
3842
|
+
($ || []).forEach((Rt) => {
|
|
3840
3843
|
let Xt = -_ / 2;
|
|
3841
|
-
I === "center" ? Xt = 0 : I === "right" && (Xt = _ / 2), nt(
|
|
3842
|
-
` || f[ut] === "\r") && (
|
|
3844
|
+
I === "center" ? Xt = 0 : I === "right" && (Xt = _ / 2), nt(Rt.text, Xt, vt, !0, ut), ut += (Rt.text || "").length, vt += E, ut < f.length && (f[ut] === `
|
|
3845
|
+
` || f[ut] === "\r") && (x > 0 && (vt += x), ut++, f[ut - 1] === "\r" && f[ut] === `
|
|
3843
3846
|
` && ut++);
|
|
3844
3847
|
}), t.globalAlpha = pt;
|
|
3845
3848
|
}
|
|
@@ -3847,7 +3850,7 @@ class ci {
|
|
|
3847
3850
|
}
|
|
3848
3851
|
applyStrokeAlignment(t, i, o, e, s, n) {
|
|
3849
3852
|
if (!i.stroke || i.stroke.width <= 0 || i.stroke.isEnabled === !1) return;
|
|
3850
|
-
const a = i.stroke, r = a.width,
|
|
3853
|
+
const a = i.stroke, r = a.width, c = (a.alignment || "center").toLowerCase();
|
|
3851
3854
|
if (t.save(), i.fill && i.fill.type !== "None" && i.fill.isEnabled !== !1 && i.fill.opacity !== 0 && i.fill.color !== "transparent" && i.fill.color !== "rgba(0,0,0,0)" && (t.shadowColor = "transparent", t.shadowBlur = 0, t.shadowOffsetX = 0, t.shadowOffsetY = 0), a.fill) {
|
|
3852
3855
|
const m = this.createCanvasFill(t, a.fill, e, s);
|
|
3853
3856
|
m ? t.strokeStyle = m : t.strokeStyle = a.color || "#000000";
|
|
@@ -3871,7 +3874,7 @@ class ci {
|
|
|
3871
3874
|
}
|
|
3872
3875
|
}
|
|
3873
3876
|
} else y.length > 0 && (t.setLineDash(y), t.lineDashOffset = p);
|
|
3874
|
-
(o == null ? void 0 : o.type) === "Line" || e === 0 || s === 0 ? (this.applyPath(t, o, e, s, n), t.stroke()) :
|
|
3877
|
+
(o == null ? void 0 : o.type) === "Line" || e === 0 || s === 0 ? (this.applyPath(t, o, e, s, n), t.stroke()) : c === "inside" ? (t.lineWidth = r * 2, t.save(), this.applyPath(t, o, e, s, n), t.clip(), t.stroke(), t.restore()) : c === "outside" ? (t.lineWidth = r * 2, this.applyPath(t, o, e, s, n), t.stroke(), t.save(), t.globalCompositeOperation = "destination-out", this.applyPath(t, o, e, s, n), t.fill(), t.restore()) : (t.lineWidth = r, this.applyPath(t, o, e, s, n), t.stroke()), t.restore();
|
|
3875
3878
|
}
|
|
3876
3879
|
getPerimeter(t, i, o) {
|
|
3877
3880
|
switch (this.ensurePathPoints(t), t == null ? void 0 : t.type) {
|
|
@@ -3880,12 +3883,12 @@ class ci {
|
|
|
3880
3883
|
case "Ellipse": {
|
|
3881
3884
|
const e = Math.abs(i) / 2, s = Math.abs(o) / 2, n = Math.abs(t.sweepAngle ?? 360), a = t.ratio || 0, r = Math.PI * (3 * (e + s) - Math.sqrt((3 * e + s) * (e + 3 * s)));
|
|
3882
3885
|
if (n >= 360 && a <= 0) return r;
|
|
3883
|
-
let
|
|
3886
|
+
let c = n / 360 * r;
|
|
3884
3887
|
if (a > 0) {
|
|
3885
|
-
const
|
|
3886
|
-
|
|
3887
|
-
} else n < 360 && (
|
|
3888
|
-
return isNaN(
|
|
3888
|
+
const l = Math.PI * (3 * (e * a + s * a) - Math.sqrt((3 * e * a + s * a) * (e * a + 3 * s * a)));
|
|
3889
|
+
c += n / 360 * l, n < 360 && (c += 2 * Math.sqrt((e - e * a) ** 2 + (s - s * a) ** 2));
|
|
3890
|
+
} else n < 360 && (c += 2 * Math.max(e, s));
|
|
3891
|
+
return isNaN(c) ? 0 : c;
|
|
3889
3892
|
}
|
|
3890
3893
|
case "Line":
|
|
3891
3894
|
return t.length || Math.sqrt(i * i + o * o);
|
|
@@ -3904,22 +3907,22 @@ class ci {
|
|
|
3904
3907
|
if (e.length < 2) return t.length || 0;
|
|
3905
3908
|
let s = 0, n = e[0].x, a = e[0].y;
|
|
3906
3909
|
for (let r = 1; r < e.length; r++) {
|
|
3907
|
-
const
|
|
3908
|
-
if (
|
|
3909
|
-
n =
|
|
3910
|
+
const c = e[r];
|
|
3911
|
+
if (c.moveTo) {
|
|
3912
|
+
n = c.x, a = c.y;
|
|
3910
3913
|
continue;
|
|
3911
3914
|
}
|
|
3912
|
-
const
|
|
3913
|
-
if (u !== void 0 ||
|
|
3914
|
-
|
|
3915
|
+
const l = n, f = a, u = e[r - 1].out_x, h = e[r - 1].out_y;
|
|
3916
|
+
if (u !== void 0 || c.in_x !== void 0 ? s += this.getBezierLength(
|
|
3917
|
+
l,
|
|
3915
3918
|
f,
|
|
3916
|
-
u ??
|
|
3919
|
+
u ?? l,
|
|
3917
3920
|
h ?? f,
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
) : s += Math.sqrt((
|
|
3921
|
+
c.in_x ?? c.x,
|
|
3922
|
+
c.in_y ?? c.y,
|
|
3923
|
+
c.x,
|
|
3924
|
+
c.y
|
|
3925
|
+
) : s += Math.sqrt((c.x - l) ** 2 + (c.y - f) ** 2), n = c.x, a = c.y, c.closePath || r === e.length - 1 && (t.is_closed || t.isClosed)) {
|
|
3923
3926
|
const d = n, p = a, y = [...e.slice(0, r + 1)].reverse().find((I) => I.moveTo) || e[0], m = y.x, b = y.y, v = e[r].out_x, S = e[r].out_y, C = y.in_x, w = y.in_y;
|
|
3924
3927
|
v !== void 0 || C !== void 0 ? s += this.getBezierLength(
|
|
3925
3928
|
d,
|
|
@@ -3939,22 +3942,22 @@ class ci {
|
|
|
3939
3942
|
return (i + o) * 2;
|
|
3940
3943
|
}
|
|
3941
3944
|
}
|
|
3942
|
-
getBezierLength(t, i, o, e, s, n, a, r,
|
|
3943
|
-
let
|
|
3944
|
-
for (let h = 1; h <=
|
|
3945
|
-
const d = h /
|
|
3946
|
-
|
|
3945
|
+
getBezierLength(t, i, o, e, s, n, a, r, c = 10) {
|
|
3946
|
+
let l = 0, f = t, u = i;
|
|
3947
|
+
for (let h = 1; h <= c; h++) {
|
|
3948
|
+
const d = h / c, p = 1 - d, y = d * d, m = p * p, b = m * p, v = y * d, S = b * t + 3 * m * d * o + 3 * p * y * s + v * a, C = b * i + 3 * m * d * e + 3 * p * y * n + v * r, w = S - f, I = C - u;
|
|
3949
|
+
l += Math.sqrt(w * w + I * I), f = S, u = C;
|
|
3947
3950
|
}
|
|
3948
|
-
return
|
|
3951
|
+
return l;
|
|
3949
3952
|
}
|
|
3950
|
-
getBezierTAtLength(t, i, o, e, s, n, a, r,
|
|
3953
|
+
getBezierTAtLength(t, i, o, e, s, n, a, r, c, l = 20) {
|
|
3951
3954
|
if (t <= 0) return 0;
|
|
3952
3955
|
let f = 0, u = i, h = o;
|
|
3953
|
-
for (let d = 1; d <=
|
|
3954
|
-
const p = d /
|
|
3956
|
+
for (let d = 1; d <= l; d++) {
|
|
3957
|
+
const p = d / l, y = 1 - p, m = p * p, b = y * y, v = b * y, S = m * p, C = v * i + 3 * b * p * e + 3 * y * m * n + S * r, w = v * o + 3 * b * p * s + 3 * y * m * a + S * c, I = C - u, M = w - h, k = Math.sqrt(I * I + M * M);
|
|
3955
3958
|
if (f + k >= t) {
|
|
3956
|
-
const T = t - f,
|
|
3957
|
-
return (d - 1 +
|
|
3959
|
+
const T = t - f, x = k === 0 ? 0 : T / k;
|
|
3960
|
+
return (d - 1 + x) / l;
|
|
3958
3961
|
}
|
|
3959
3962
|
f += k, u = C, h = w;
|
|
3960
3963
|
}
|
|
@@ -3964,11 +3967,11 @@ class ci {
|
|
|
3964
3967
|
if (this.ensurePathPoints(t), (t == null ? void 0 : t.type) === "Path") {
|
|
3965
3968
|
const s = t.points || [];
|
|
3966
3969
|
if (s.length < 2) return { x: 0, y: 0, angle: 0 };
|
|
3967
|
-
let n = 1 / 0, a = -1 / 0, r = 1 / 0,
|
|
3970
|
+
let n = 1 / 0, a = -1 / 0, r = 1 / 0, c = -1 / 0;
|
|
3968
3971
|
s.forEach((b) => {
|
|
3969
|
-
typeof b.x == "number" && typeof b.y == "number" && (n = Math.min(n, b.x), a = Math.max(a, b.x), r = Math.min(r, b.y),
|
|
3972
|
+
typeof b.x == "number" && typeof b.y == "number" && (n = Math.min(n, b.x), a = Math.max(a, b.x), r = Math.min(r, b.y), c = Math.max(c, b.y), b.out_x !== void 0 && (n = Math.min(n, b.out_x), a = Math.max(a, b.out_x)), b.out_y !== void 0 && (r = Math.min(r, b.out_y), c = Math.max(c, b.out_y)), b.in_x !== void 0 && (n = Math.min(n, b.in_x), a = Math.max(a, b.in_x)), b.in_y !== void 0 && (r = Math.min(r, b.in_y), c = Math.max(c, b.in_y)));
|
|
3970
3973
|
});
|
|
3971
|
-
const
|
|
3974
|
+
const l = (n + a) / 2, f = (r + c) / 2, h = this.getPerimeter(t, i, o) * e;
|
|
3972
3975
|
let d = 0;
|
|
3973
3976
|
const p = [];
|
|
3974
3977
|
let y = s[0], m = s[0];
|
|
@@ -3987,27 +3990,27 @@ class ci {
|
|
|
3987
3990
|
if (w ? C = this.getBezierLength(v.x, v.y, v.out_x ?? v.x, v.out_y ?? v.y, S.in_x ?? S.x, S.in_y ?? S.y, S.x, S.y) : C = Math.sqrt((S.x - v.x) ** 2 + (S.y - v.y) ** 2), d + C >= h || b === p[p.length - 1]) {
|
|
3988
3991
|
let I = 0;
|
|
3989
3992
|
if (w)
|
|
3990
|
-
return I = this.getBezierTAtLength(h - d, v.x, v.y, v.out_x ?? v.x, v.out_y ?? v.y, S.in_x ?? S.x, S.in_y ?? S.y, S.x, S.y, 20), this.getBezierPointAndAngle(I, v, S,
|
|
3993
|
+
return I = this.getBezierTAtLength(h - d, v.x, v.y, v.out_x ?? v.x, v.out_y ?? v.y, S.in_x ?? S.x, S.in_y ?? S.y, S.x, S.y, 20), this.getBezierPointAndAngle(I, v, S, l, f);
|
|
3991
3994
|
{
|
|
3992
3995
|
I = C === 0 ? 0 : (h - d) / C;
|
|
3993
|
-
const M = v.x + (S.x - v.x) * I -
|
|
3996
|
+
const M = v.x + (S.x - v.x) * I - l, k = v.y + (S.y - v.y) * I - f, T = Math.atan2(S.y - v.y, S.x - v.x);
|
|
3994
3997
|
return { x: M, y: k, angle: T };
|
|
3995
3998
|
}
|
|
3996
3999
|
}
|
|
3997
4000
|
d += C;
|
|
3998
4001
|
}
|
|
3999
4002
|
} else if (t.type === "Ellipse") {
|
|
4000
|
-
const s = Math.abs(i) / 2, n = Math.abs(o) / 2, a = t.sweepAngle ?? 360,
|
|
4001
|
-
return { x:
|
|
4003
|
+
const s = Math.abs(i) / 2, n = Math.abs(o) / 2, a = t.sweepAngle ?? 360, c = ((t.startAngle ?? 0) + a * e) * Math.PI / 180, l = s * Math.cos(c), f = n * Math.sin(c), u = -s * Math.sin(c), h = n * Math.cos(c), d = Math.atan2(h, u);
|
|
4004
|
+
return { x: l, y: f, angle: d };
|
|
4002
4005
|
} else if ((t == null ? void 0 : t.type) === "Rectangle") {
|
|
4003
4006
|
const s = Math.abs(i), n = Math.abs(o), r = (s + n) * 2 * e;
|
|
4004
|
-
let
|
|
4005
|
-
return r < s ? (
|
|
4007
|
+
let c = 0, l = 0, f = 0;
|
|
4008
|
+
return r < s ? (c = -s / 2 + r, l = -n / 2, f = 0) : r < s + n ? (c = s / 2, l = -n / 2 + (r - s), f = Math.PI / 2) : r < 2 * s + n ? (c = s / 2 - (r - (s + n)), l = n / 2, f = Math.PI) : (c = -s / 2, l = n / 2 - (r - (2 * s + n)), f = -Math.PI / 2), { x: c, y: l, angle: f };
|
|
4006
4009
|
}
|
|
4007
4010
|
return { x: 0, y: 0, angle: 0 };
|
|
4008
4011
|
}
|
|
4009
4012
|
getBezierPointAndAngle(t, i, o, e, s) {
|
|
4010
|
-
const n = i.x, a = i.y, r = i.out_x ?? i.x,
|
|
4013
|
+
const n = i.x, a = i.y, r = i.out_x ?? i.x, c = i.out_y ?? i.y, l = o.in_x ?? o.x, f = o.in_y ?? o.y, u = o.x, h = o.y, d = 1 - t, p = t * t, y = d * d, m = y * d, b = p * t, v = m * n + 3 * y * t * r + 3 * d * p * l + b * u - e, S = m * a + 3 * y * t * c + 3 * d * p * f + b * h - s, C = 3 * y * (r - n) + 6 * d * t * (l - r) + 3 * p * (u - l), w = 3 * y * (c - a) + 6 * d * t * (f - c) + 3 * p * (h - f), I = Math.atan2(w, C);
|
|
4011
4014
|
return { x: v, y: S, angle: I };
|
|
4012
4015
|
}
|
|
4013
4016
|
applyAbsoluteTransform(t, i, o) {
|
|
@@ -4034,50 +4037,50 @@ class ci {
|
|
|
4034
4037
|
var h, d, p, y, m;
|
|
4035
4038
|
const a = this.objectStates.get(i.id), r = ((h = a == null ? void 0 : a.style) == null ? void 0 : h.artEffect) || i.artEffect || ((d = i.style) == null ? void 0 : d.artEffect);
|
|
4036
4039
|
if (!r || !r.enabled) return;
|
|
4037
|
-
const
|
|
4038
|
-
if (
|
|
4039
|
-
if (t.save(), this.applyPath(t, o, e, s, n), t.clip(),
|
|
4040
|
+
const c = r.type, l = r.intensity ?? 0.5, f = r.speed ?? 1, u = r.scale ?? 10;
|
|
4041
|
+
if (c === "acid_gradient" || c === "acid_rave" || c === "shimmer" || c === "glint_overlay" || c === "halftone" || c === "noise" || c === "scanlines" || c === "chromatic_aberration" || c === "pixelate" || c === "glitch" || c === "fold_overlay" || c === "crumple_overlay") {
|
|
4042
|
+
if (t.save(), this.applyPath(t, o, e, s, n), t.clip(), c === "shimmer") {
|
|
4040
4043
|
const v = this.currentTime * f % 2 / 2, S = t.createLinearGradient(-e, -s, e, s);
|
|
4041
|
-
S.addColorStop(Math.max(0, v - 0.2), "rgba(255,255,255,0)"), S.addColorStop(v, `rgba(255,255,255,${
|
|
4042
|
-
} else if (
|
|
4044
|
+
S.addColorStop(Math.max(0, v - 0.2), "rgba(255,255,255,0)"), S.addColorStop(v, `rgba(255,255,255,${l * 0.8})`), S.addColorStop(Math.min(1, v + 0.2), "rgba(255,255,255,0)"), t.fillStyle = S, t.globalCompositeOperation = "screen", t.fillRect(-e / 2, -s / 2, e, s), t.globalCompositeOperation = "source-over";
|
|
4045
|
+
} else if (c === "glint_overlay") {
|
|
4043
4046
|
let S = ((this._lastPointerPos || { x: 0 }).x - (((p = i.transform) == null ? void 0 : p.x) ?? 0) + 300) / 600;
|
|
4044
4047
|
S = Math.max(-0.2, Math.min(1.2, S));
|
|
4045
4048
|
const C = t.createLinearGradient(-e, -s, e, s);
|
|
4046
|
-
C.addColorStop(Math.max(0, S - 0.15), "rgba(255,255,255,0)"), C.addColorStop(Math.max(0, Math.min(1, S)), `rgba(255,255,255,${
|
|
4047
|
-
} else if (
|
|
4049
|
+
C.addColorStop(Math.max(0, S - 0.15), "rgba(255,255,255,0)"), C.addColorStop(Math.max(0, Math.min(1, S)), `rgba(255,255,255,${l})`), C.addColorStop(Math.min(1, S + 0.15), "rgba(255,255,255,0)"), t.fillStyle = C, t.globalCompositeOperation = "screen", t.fillRect(-e / 2, -s / 2, e, s), t.globalCompositeOperation = "source-over";
|
|
4050
|
+
} else if (c === "fold_overlay") {
|
|
4048
4051
|
const b = this._lastPointerPos || { x: 0, y: 0 }, v = b.x - (((y = i.transform) == null ? void 0 : y.x) ?? 0), S = b.y - (((m = i.transform) == null ? void 0 : m.y) ?? 0), C = t.createLinearGradient(v > 0 ? -e / 2 : e / 2, S > 0 ? -s / 2 : s / 2, v > 0 ? e / 2 : -e / 2, S > 0 ? s / 2 : -s / 2);
|
|
4049
|
-
C.addColorStop(0, `rgba(0,0,0,${
|
|
4050
|
-
} else if (
|
|
4052
|
+
C.addColorStop(0, `rgba(0,0,0,${l * 0.6})`), C.addColorStop(0.4, "rgba(0,0,0,0)"), C.addColorStop(0.5, `rgba(255,255,255,${l * 0.4})`), C.addColorStop(1, `rgba(0,0,0,${l * 0.2})`), t.fillStyle = C, t.globalCompositeOperation = "overlay", t.fillRect(-e / 2, -s / 2, e, s), t.globalCompositeOperation = "source-over", t.beginPath(), v > 0 && S > 0 ? (t.moveTo(e / 2 - 40, s / 2), t.lineTo(e / 2, s / 2 - 40), t.lineTo(e / 2 - 40, s / 2 - 40)) : v < 0 && S > 0 ? (t.moveTo(-e / 2 + 40, s / 2), t.lineTo(-e / 2, s / 2 - 40), t.lineTo(-e / 2 + 40, s / 2 - 40)) : v > 0 && S < 0 ? (t.moveTo(e / 2 - 40, -s / 2), t.lineTo(e / 2, -s / 2 + 40), t.lineTo(e / 2 - 40, -s / 2 + 40)) : (t.moveTo(-e / 2 + 40, -s / 2), t.lineTo(-e / 2, -s / 2 + 40), t.lineTo(-e / 2 + 40, -s / 2 + 40)), t.closePath(), t.fillStyle = "#ffffff", t.shadowColor = "rgba(0,0,0,0.5)", t.shadowBlur = 10, t.shadowOffsetX = v > 0 ? -2 : 2, t.shadowOffsetY = S > 0 ? -2 : 2, t.fill();
|
|
4053
|
+
} else if (c === "crumple_overlay") {
|
|
4051
4054
|
const b = Math.floor(e / u), v = document.createElement("canvas");
|
|
4052
4055
|
v.width = b, v.height = Math.floor(s / u);
|
|
4053
4056
|
const S = v.getContext("2d"), C = S.createImageData(v.width, v.height);
|
|
4054
4057
|
for (let w = 0; w < C.data.length; w += 4) {
|
|
4055
4058
|
const I = Math.random() > 0.95 ? 150 : 255;
|
|
4056
|
-
C.data[w] = I, C.data[w + 1] = I, C.data[w + 2] = I, C.data[w + 3] = 255 *
|
|
4059
|
+
C.data[w] = I, C.data[w + 1] = I, C.data[w + 2] = I, C.data[w + 3] = 255 * l;
|
|
4057
4060
|
}
|
|
4058
4061
|
S.putImageData(C, 0, 0), t.globalCompositeOperation = "multiply", t.imageSmoothingEnabled = !1, t.drawImage(v, -e / 2, -s / 2, e, s);
|
|
4059
|
-
} else if (
|
|
4062
|
+
} else if (c === "acid_gradient" || c === "acid_rave") {
|
|
4060
4063
|
const b = this.currentTime * f, v = r.color1, S = r.color2, C = t.createLinearGradient(-e / 2, -s / 2, e / 2, s / 2);
|
|
4061
4064
|
if (v && S) {
|
|
4062
4065
|
const w = b * 60 % 360;
|
|
4063
|
-
C.addColorStop(0, this._shiftHue(v, w,
|
|
4066
|
+
C.addColorStop(0, this._shiftHue(v, w, l * 0.7)), C.addColorStop(1, this._shiftHue(S, (w + 180) % 360, l * 0.7));
|
|
4064
4067
|
} else {
|
|
4065
4068
|
const w = b * 100 % 360, I = (w + 180) % 360;
|
|
4066
|
-
C.addColorStop(0, `hsla(${w}, 80%, 50%, ${
|
|
4069
|
+
C.addColorStop(0, `hsla(${w}, 80%, 50%, ${l * 0.5})`), C.addColorStop(1, `hsla(${I}, 80%, 50%, ${l * 0.5})`);
|
|
4067
4070
|
}
|
|
4068
4071
|
t.fillStyle = C, t.globalCompositeOperation = "screen", t.fillRect(-e / 2, -s / 2, e, s);
|
|
4069
|
-
} else if (
|
|
4070
|
-
const b = Math.max(2, u * (1 -
|
|
4072
|
+
} else if (c === "halftone") {
|
|
4073
|
+
const b = Math.max(2, u * (1 - l * 0.8)), v = document.createElement("canvas");
|
|
4071
4074
|
v.width = b, v.height = b;
|
|
4072
4075
|
const S = v.getContext("2d");
|
|
4073
4076
|
if (S) {
|
|
4074
|
-
S.fillStyle = "black", S.beginPath(), S.arc(b / 2, b / 2, b / 2 *
|
|
4077
|
+
S.fillStyle = "black", S.beginPath(), S.arc(b / 2, b / 2, b / 2 * l, 0, Math.PI * 2), S.fill();
|
|
4075
4078
|
const C = t.createPattern(v, "repeat");
|
|
4076
|
-
C && (t.globalAlpha = 0.3 *
|
|
4079
|
+
C && (t.globalAlpha = 0.3 * l, t.fillStyle = C, t.fillRect(-e / 2, -s / 2, e, s));
|
|
4077
4080
|
}
|
|
4078
|
-
} else if (
|
|
4079
|
-
const b = Math.floor(e * s *
|
|
4080
|
-
t.globalAlpha = 0.4 *
|
|
4081
|
+
} else if (c === "noise") {
|
|
4082
|
+
const b = Math.floor(e * s * l * 0.02);
|
|
4083
|
+
t.globalAlpha = 0.4 * l;
|
|
4081
4084
|
for (let v = 0; v < b; v++) {
|
|
4082
4085
|
const S = Math.random() > 0.5 ? 255 : 0;
|
|
4083
4086
|
t.fillStyle = `rgba(${S}, ${S}, ${S}, ${0.5 + Math.random() * 0.5})`, t.fillRect(
|
|
@@ -4087,15 +4090,15 @@ class ci {
|
|
|
4087
4090
|
2
|
|
4088
4091
|
);
|
|
4089
4092
|
}
|
|
4090
|
-
} else if (
|
|
4091
|
-
t.globalAlpha = 0.2 *
|
|
4093
|
+
} else if (c === "scanlines") {
|
|
4094
|
+
t.globalAlpha = 0.2 * l, t.strokeStyle = "rgba(0,0,0,0.5)", t.lineWidth = 1;
|
|
4092
4095
|
for (let b = -s / 2; b < s / 2; b += 4)
|
|
4093
4096
|
t.beginPath(), t.moveTo(-e / 2, b), t.lineTo(e / 2, b), t.stroke();
|
|
4094
|
-
} else if (
|
|
4095
|
-
const b = 5 *
|
|
4097
|
+
} else if (c === "chromatic_aberration") {
|
|
4098
|
+
const b = 5 * l;
|
|
4096
4099
|
t.globalCompositeOperation = "screen", t.globalAlpha = 0.5, t.fillStyle = "cyan", t.fillRect(-e / 2 - b, -s / 2, e, s), t.fillStyle = "magenta", t.fillRect(-e / 2 + b, -s / 2, e, s);
|
|
4097
|
-
} else if (
|
|
4098
|
-
const b = Math.max(2, Math.round(u * (1 -
|
|
4100
|
+
} else if (c === "pixelate") {
|
|
4101
|
+
const b = Math.max(2, Math.round(u * (1 - l * 0.5))), v = document.createElement("canvas"), S = Math.max(1, Math.ceil(e / b)), C = Math.max(1, Math.ceil(s / b));
|
|
4099
4102
|
v.width = S, v.height = C;
|
|
4100
4103
|
const w = v.getContext("2d");
|
|
4101
4104
|
if (w) {
|
|
@@ -4103,17 +4106,17 @@ class ci {
|
|
|
4103
4106
|
const I = t.getTransform(), M = I.e - e / 2, k = I.f - s / 2;
|
|
4104
4107
|
w.drawImage(t.canvas, M, k, e, s, 0, 0, S, C), t.imageSmoothingEnabled = !1, t.drawImage(v, 0, 0, S, C, -e / 2, -s / 2, e, s), t.imageSmoothingEnabled = !0;
|
|
4105
4108
|
}
|
|
4106
|
-
} else if (
|
|
4107
|
-
const b = this.currentTime * f, v = r.chaosAmount ?? 0.2, S = Math.max(3, Math.floor(8 *
|
|
4108
|
-
t.globalCompositeOperation = "screen", t.globalAlpha =
|
|
4109
|
+
} else if (c === "glitch") {
|
|
4110
|
+
const b = this.currentTime * f, v = r.chaosAmount ?? 0.2, S = Math.max(3, Math.floor(8 * l)), C = l * e * 0.15;
|
|
4111
|
+
t.globalCompositeOperation = "screen", t.globalAlpha = l * 0.4;
|
|
4109
4112
|
const w = C * 0.3;
|
|
4110
4113
|
t.fillStyle = "rgba(255, 0, 0, 0.4)", t.fillRect(-e / 2 + w, -s / 2, e, s), t.fillStyle = "rgba(0, 255, 255, 0.4)", t.fillRect(-e / 2 - w, -s / 2, e, s), t.globalCompositeOperation = "source-over", t.globalAlpha = 1;
|
|
4111
4114
|
const I = s / S;
|
|
4112
4115
|
for (let M = 0; M < S; M++) {
|
|
4113
4116
|
const k = Math.sin(M * 127.1 + b * 311.7 * f) * 43758.5, T = k - Math.floor(k);
|
|
4114
4117
|
if (T > 1 - v) {
|
|
4115
|
-
const
|
|
4116
|
-
t.save(), t.beginPath(), t.rect(-e / 2, P, e, I), t.clip(), t.globalAlpha = 0.8, t.drawImage(t.canvas,
|
|
4118
|
+
const x = (T - (1 - v)) / v * C * (Math.random() > 0.5 ? 1 : -1), P = -s / 2 + M * I, E = t.getTransform(), R = E.e - e / 2 + x, O = E.f + P;
|
|
4119
|
+
t.save(), t.beginPath(), t.rect(-e / 2, P, e, I), t.clip(), t.globalAlpha = 0.8, t.drawImage(t.canvas, R, O, e, I, -e / 2 + x, P, e, I), t.restore();
|
|
4117
4120
|
}
|
|
4118
4121
|
}
|
|
4119
4122
|
}
|
|
@@ -4128,22 +4131,22 @@ class ci {
|
|
|
4128
4131
|
e = parseInt(h.substring(0, 2), 16) / 255, s = parseInt(h.substring(2, 4), 16) / 255, n = parseInt(h.substring(4, 6), 16) / 255;
|
|
4129
4132
|
}
|
|
4130
4133
|
const a = Math.max(e, s, n), r = Math.min(e, s, n);
|
|
4131
|
-
let
|
|
4134
|
+
let c = 0, l = 0, f = (a + r) / 2;
|
|
4132
4135
|
if (a !== r) {
|
|
4133
4136
|
const h = a - r;
|
|
4134
|
-
switch (
|
|
4137
|
+
switch (l = f > 0.5 ? h / (2 - a - r) : h / (a + r), a) {
|
|
4135
4138
|
case e:
|
|
4136
|
-
|
|
4139
|
+
c = ((s - n) / h + (s < n ? 6 : 0)) / 6;
|
|
4137
4140
|
break;
|
|
4138
4141
|
case s:
|
|
4139
|
-
|
|
4142
|
+
c = ((n - e) / h + 2) / 6;
|
|
4140
4143
|
break;
|
|
4141
4144
|
case n:
|
|
4142
|
-
|
|
4145
|
+
c = ((e - s) / h + 4) / 6;
|
|
4143
4146
|
break;
|
|
4144
4147
|
}
|
|
4145
4148
|
}
|
|
4146
|
-
return `hsla(${(((
|
|
4149
|
+
return `hsla(${(((c * 360 + i) % 360 + 360) % 360).toFixed(0)}, ${(l * 100).toFixed(0)}%, ${(f * 100).toFixed(0)}%, ${o})`;
|
|
4147
4150
|
}
|
|
4148
4151
|
/**
|
|
4149
4152
|
* Simulate CSS `backdrop-filter: blur()` + glass overlay on Canvas2D.
|
|
@@ -4154,7 +4157,7 @@ class ci {
|
|
|
4154
4157
|
* 4. Apply the overlay color tint, sheen highlight, noise grain, and glass border
|
|
4155
4158
|
*/
|
|
4156
4159
|
applyBackgroundBlurGlass(t, i, o, e, s, n) {
|
|
4157
|
-
const a = n.radius ?? 10, r = n.color ?? "rgba(255,255,255,0.2)",
|
|
4160
|
+
const a = n.radius ?? 10, r = n.color ?? "rgba(255,255,255,0.2)", c = n.opacity ?? 0.5, l = n.noise ?? 0;
|
|
4158
4161
|
t.save(), this.applyPath(t, i, o, e, s), t.clip();
|
|
4159
4162
|
const f = t.getTransform(), u = f.e - o / 2, h = f.f - e / 2;
|
|
4160
4163
|
try {
|
|
@@ -4170,10 +4173,10 @@ class ci {
|
|
|
4170
4173
|
}
|
|
4171
4174
|
} catch {
|
|
4172
4175
|
}
|
|
4173
|
-
t.globalCompositeOperation = "source-over", t.globalAlpha =
|
|
4176
|
+
t.globalCompositeOperation = "source-over", t.globalAlpha = c, t.fillStyle = r, t.fillRect(-o / 2, -e / 2, o, e), t.globalAlpha = 1, t.globalCompositeOperation = "source-atop";
|
|
4174
4177
|
const d = t.createLinearGradient(-o / 2, -e / 2, o / 2, e / 2);
|
|
4175
|
-
if (d.addColorStop(0, "rgba(255,255,255,0.12)"), d.addColorStop(0.3, "rgba(255,255,255,0.04)"), d.addColorStop(0.5, "rgba(255,255,255,0.0)"), d.addColorStop(1, "rgba(255,255,255,0.0)"), t.fillStyle = d, t.fillRect(-o / 2, -e / 2, o, e),
|
|
4176
|
-
if (t.globalAlpha =
|
|
4178
|
+
if (d.addColorStop(0, "rgba(255,255,255,0.12)"), d.addColorStop(0.3, "rgba(255,255,255,0.04)"), d.addColorStop(0.5, "rgba(255,255,255,0.0)"), d.addColorStop(1, "rgba(255,255,255,0.0)"), t.fillStyle = d, t.fillRect(-o / 2, -e / 2, o, e), l > 0) {
|
|
4179
|
+
if (t.globalAlpha = l / 100, !this._noiseTileCanvas) {
|
|
4177
4180
|
const y = document.createElement("canvas");
|
|
4178
4181
|
y.width = 64, y.height = 64;
|
|
4179
4182
|
const m = y.getContext("2d"), b = m.createImageData(64, 64), v = b.data;
|
|
@@ -4199,76 +4202,76 @@ class ci {
|
|
|
4199
4202
|
} else if (i.type === "Line")
|
|
4200
4203
|
t.moveTo(-o / 2, 0), t.lineTo(o / 2, 0);
|
|
4201
4204
|
else if (i.type === "Ellipse") {
|
|
4202
|
-
const { startAngle: n = 0, sweepAngle: a = 360, ratio: r = 0 } = i,
|
|
4203
|
-
a >= 360 && r <= 0 ? t.ellipse(0, 0,
|
|
4205
|
+
const { startAngle: n = 0, sweepAngle: a = 360, ratio: r = 0 } = i, c = o / 2, l = e / 2, f = n * Math.PI / 180, u = a * Math.PI / 180, h = f + u;
|
|
4206
|
+
a >= 360 && r <= 0 ? t.ellipse(0, 0, c, l, 0, 0, Math.PI * 2) : (t.ellipse(0, 0, c, l, 0, f, h, !1), r > 0 ? t.ellipse(0, 0, c * r, l * r, 0, h, f, !0) : t.lineTo(0, 0), t.closePath());
|
|
4204
4207
|
} else if (i.type === "Triangle")
|
|
4205
4208
|
t.moveTo(0, -e / 2), t.lineTo(o / 2, e / 2), t.lineTo(-o / 2, e / 2), t.closePath();
|
|
4206
4209
|
else if (i.type === "Polygon") {
|
|
4207
4210
|
const n = i.sides || 3, a = i.radius || Math.min(o, e) / 2;
|
|
4208
4211
|
for (let r = 0; r < n; r++) {
|
|
4209
|
-
const
|
|
4210
|
-
r === 0 ? t.moveTo(
|
|
4212
|
+
const c = r * 2 * Math.PI / n - Math.PI / 2, l = a * Math.cos(c), f = a * Math.sin(c);
|
|
4213
|
+
r === 0 ? t.moveTo(l, f) : t.lineTo(l, f);
|
|
4211
4214
|
}
|
|
4212
4215
|
t.closePath();
|
|
4213
4216
|
} else if (i.type === "Star") {
|
|
4214
4217
|
const n = i.points || 5, a = i.outer_radius || Math.min(o, e) / 2;
|
|
4215
4218
|
let r = i.inner_radius;
|
|
4216
4219
|
r == null ? r = a * 0.382 : r <= 1 && (r = a * r);
|
|
4217
|
-
for (let
|
|
4218
|
-
const
|
|
4219
|
-
|
|
4220
|
+
for (let c = 0; c < n * 2; c++) {
|
|
4221
|
+
const l = c * Math.PI / n - Math.PI / 2, f = c % 2 === 0 ? a : r, u = f * Math.cos(l), h = f * Math.sin(l);
|
|
4222
|
+
c === 0 ? t.moveTo(u, h) : t.lineTo(u, h);
|
|
4220
4223
|
}
|
|
4221
4224
|
t.closePath();
|
|
4222
4225
|
} else if (((i == null ? void 0 : i.type) === "Path" || i.type === "Subtract" || i.type === "Union" || i.type === "Intersect" || i.type === "Exclude" || i.type === "BooleanOperation") && i.points) {
|
|
4223
4226
|
this.frameCount % 300 === 0 && this.log("[Engine] Tracing Path:", i.points.length, "points");
|
|
4224
|
-
let n = 1 / 0, a = -1 / 0, r = 1 / 0,
|
|
4227
|
+
let n = 1 / 0, a = -1 / 0, r = 1 / 0, c = -1 / 0;
|
|
4225
4228
|
if (i.points.forEach((u) => {
|
|
4226
|
-
typeof u.x == "number" && typeof u.y == "number" && (n = Math.min(n, u.x), a = Math.max(a, u.x), r = Math.min(r, u.y),
|
|
4229
|
+
typeof u.x == "number" && typeof u.y == "number" && (n = Math.min(n, u.x), a = Math.max(a, u.x), r = Math.min(r, u.y), c = Math.max(c, u.y), u.out_x !== void 0 && (n = Math.min(n, u.out_x), a = Math.max(a, u.out_x)), u.out_y !== void 0 && (r = Math.min(r, u.out_y), c = Math.max(c, u.out_y)), u.in_x !== void 0 && (n = Math.min(n, u.in_x), a = Math.max(a, u.in_x)), u.in_y !== void 0 && (r = Math.min(r, u.in_y), c = Math.max(c, u.in_y)));
|
|
4227
4230
|
}), n === 1 / 0) return;
|
|
4228
|
-
const
|
|
4229
|
-
if (isNaN(
|
|
4230
|
-
this.warn("[Engine] Invalid path center:",
|
|
4231
|
+
const l = (n + a) / 2, f = (r + c) / 2;
|
|
4232
|
+
if (isNaN(l) || isNaN(f)) {
|
|
4233
|
+
this.warn("[Engine] Invalid path center:", l, f);
|
|
4231
4234
|
return;
|
|
4232
4235
|
}
|
|
4233
4236
|
i.points.forEach((u, h) => {
|
|
4234
4237
|
if (h === 0 || u.moveTo)
|
|
4235
|
-
t.moveTo(u.x -
|
|
4238
|
+
t.moveTo(u.x - l, u.y - f);
|
|
4236
4239
|
else {
|
|
4237
4240
|
const d = i.points[h - 1];
|
|
4238
4241
|
if (!d) return;
|
|
4239
|
-
const p = (d.out_x ?? d.x) -
|
|
4240
|
-
isNaN(p) || isNaN(m) || isNaN(u.x) ? t.lineTo(u.x -
|
|
4242
|
+
const p = (d.out_x ?? d.x) - l, y = (d.out_y ?? d.y) - f, m = (u.in_x ?? u.x) - l, b = (u.in_y ?? u.y) - f;
|
|
4243
|
+
isNaN(p) || isNaN(m) || isNaN(u.x) ? t.lineTo(u.x - l, u.y - f) : t.bezierCurveTo(p, y, m, b, u.x - l, u.y - f);
|
|
4241
4244
|
}
|
|
4242
4245
|
if (u.closePath || h === i.points.length - 1 && (i.is_closed || i.isClosed)) {
|
|
4243
4246
|
const d = [...i.points.slice(0, h + 1)].reverse().find((p) => p.moveTo) || i.points[0];
|
|
4244
4247
|
d && (u.out_x !== void 0 || d.in_x !== void 0) && t.bezierCurveTo(
|
|
4245
|
-
(u.out_x ?? u.x) -
|
|
4248
|
+
(u.out_x ?? u.x) - l,
|
|
4246
4249
|
(u.out_y ?? u.y) - f,
|
|
4247
|
-
(d.in_x ?? d.x) -
|
|
4250
|
+
(d.in_x ?? d.x) - l,
|
|
4248
4251
|
(d.in_y ?? d.y) - f,
|
|
4249
|
-
d.x -
|
|
4252
|
+
d.x - l,
|
|
4250
4253
|
d.y - f
|
|
4251
4254
|
), t.closePath();
|
|
4252
4255
|
}
|
|
4253
4256
|
});
|
|
4254
4257
|
} else if (i.points && Array.isArray(i.points)) {
|
|
4255
|
-
let n = 1 / 0, a = -1 / 0, r = 1 / 0,
|
|
4258
|
+
let n = 1 / 0, a = -1 / 0, r = 1 / 0, c = -1 / 0;
|
|
4256
4259
|
i.points.forEach((u) => {
|
|
4257
|
-
n = Math.min(n, u.x), a = Math.max(a, u.x), r = Math.min(r, u.y),
|
|
4260
|
+
n = Math.min(n, u.x), a = Math.max(a, u.x), r = Math.min(r, u.y), c = Math.max(c, u.y);
|
|
4258
4261
|
});
|
|
4259
|
-
const
|
|
4262
|
+
const l = (n + a) / 2, f = (r + c) / 2;
|
|
4260
4263
|
i.points.forEach((u, h) => {
|
|
4261
|
-
if (h === 0) t.moveTo(u.x -
|
|
4264
|
+
if (h === 0) t.moveTo(u.x - l, u.y - f);
|
|
4262
4265
|
else {
|
|
4263
4266
|
const d = i.points[h - 1];
|
|
4264
4267
|
d.out_x !== void 0 || u.in_x !== void 0 ? t.bezierCurveTo(
|
|
4265
|
-
(d.out_x ?? d.x) -
|
|
4268
|
+
(d.out_x ?? d.x) - l,
|
|
4266
4269
|
(d.out_y ?? d.y) - f,
|
|
4267
|
-
(u.in_x ?? u.x) -
|
|
4270
|
+
(u.in_x ?? u.x) - l,
|
|
4268
4271
|
(u.in_y ?? u.y) - f,
|
|
4269
|
-
u.x -
|
|
4272
|
+
u.x - l,
|
|
4270
4273
|
u.y - f
|
|
4271
|
-
) : t.lineTo(u.x -
|
|
4274
|
+
) : t.lineTo(u.x - l, u.y - f);
|
|
4272
4275
|
}
|
|
4273
4276
|
(u.closePath || h === i.points.length - 1 && (i.is_closed || i.isClosed)) && t.closePath();
|
|
4274
4277
|
});
|
|
@@ -4276,76 +4279,76 @@ class ci {
|
|
|
4276
4279
|
}
|
|
4277
4280
|
}
|
|
4278
4281
|
renderInputBox(t, i) {
|
|
4279
|
-
var it,
|
|
4280
|
-
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = ((it = i.geometry) == null ? void 0 : it.width) || 250, n = ((
|
|
4282
|
+
var it, lt;
|
|
4283
|
+
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = ((it = i.geometry) == null ? void 0 : it.width) || 250, n = ((lt = i.geometry) == null ? void 0 : lt.height) || 45, a = this.focusedId === i.id, r = this.lastHoveredObjectId === i.id, c = e.previewState || "default", l = c !== "default" ? c : a ? "focused" : r ? "hovered" : "default", f = e.label || { visible: !0, text: "Label" }, u = e.helperText || { visible: !1, text: "Helper text" }, h = e.leftIcon || { visible: !1 }, d = e.rightIcon || { visible: !1 }, p = e.multiline === !0, y = e.corner_radius ?? 8, m = e.corners || { tl: y, tr: y, bl: y, br: y }, b = [m.tl, m.tr, m.br, m.bl];
|
|
4281
4284
|
let v = e.backgroundColor || "rgba(31, 41, 55, 1)", S = e.borderColor || "rgba(55, 65, 81, 1)", C = e.borderWidth ?? 1.5, w = e.color || "#ffffff", I = e.placeholderColor || "rgba(156, 163, 175, 1)", M = e.fontSize || 14;
|
|
4282
|
-
const k = `${
|
|
4283
|
-
T ? (T.backgroundColor !== void 0 && (v = T.backgroundColor), T.borderColor !== void 0 && (S = T.borderColor), T.borderWidth !== void 0 && (C = T.borderWidth), T.color !== void 0 && (w = T.color), T.placeholderColor !== void 0 && (I = T.placeholderColor), T.fontSize !== void 0 && (M = T.fontSize)) :
|
|
4284
|
-
const
|
|
4285
|
-
if (
|
|
4285
|
+
const k = `${l}Style`, T = e[k];
|
|
4286
|
+
T ? (T.backgroundColor !== void 0 && (v = T.backgroundColor), T.borderColor !== void 0 && (S = T.borderColor), T.borderWidth !== void 0 && (C = T.borderWidth), T.color !== void 0 && (w = T.color), T.placeholderColor !== void 0 && (I = T.placeholderColor), T.fontSize !== void 0 && (M = T.fontSize)) : l === "focused" ? (S = e.focusBorderColor || "rgba(59, 130, 246, 1)", C = Math.max(C, 2)) : l === "hovered" || l === "hover" ? (S = e.hoverBorderColor || S, v = e.hoverBackgroundColor || v) : l === "disabled" ? (v = e.disabledBackgroundColor || "rgba(31, 41, 55, 0.6)", S = e.disabledBorderColor || "rgba(55, 65, 81, 0.4)") : l === "error" && (S = "rgba(239, 68, 68, 1)", C = Math.max(C, 2)), t.beginPath(), this.drawRoundRect(t, -s / 2, -n / 2, s, n, b);
|
|
4287
|
+
const x = this.createCanvasFill(t, v, s, n);
|
|
4288
|
+
if (x && (t.fillStyle = x, t.fill()), C > 0) {
|
|
4286
4289
|
const nt = this.createCanvasFill(t, S, s, n);
|
|
4287
|
-
if (nt && (t.strokeStyle = nt, t.lineWidth = C, t.stroke()),
|
|
4290
|
+
if (nt && (t.strokeStyle = nt, t.lineWidth = C, t.stroke()), l === "focused" || l === "focus") {
|
|
4288
4291
|
t.save(), t.beginPath();
|
|
4289
|
-
const
|
|
4290
|
-
this.drawRoundRect(t, -s / 2 - 2, -n / 2 - 2, s + 4, n + 4,
|
|
4292
|
+
const bt = b.map((ht) => ht + 2);
|
|
4293
|
+
this.drawRoundRect(t, -s / 2 - 2, -n / 2 - 2, s + 4, n + 4, bt), t.strokeStyle = "rgba(59, 130, 246, 0.3)", t.lineWidth = 2, t.stroke(), t.restore();
|
|
4291
4294
|
}
|
|
4292
4295
|
}
|
|
4293
|
-
const P = (nt,
|
|
4296
|
+
const P = (nt, bt) => {
|
|
4294
4297
|
if (!nt.visible || !nt.svgPath) return;
|
|
4295
|
-
const
|
|
4298
|
+
const ht = nt.size || 14, wt = nt.offset ?? 16, Mt = nt.color || "#ffffff", It = bt ? -(s / 2) + wt : s / 2 - wt, Ot = nt.svgPath;
|
|
4296
4299
|
if (t.save(), t.translate(It, 0), !Ot.startsWith("<svg")) {
|
|
4297
|
-
const At = new Path2D(Ot), Tt =
|
|
4300
|
+
const At = new Path2D(Ot), Tt = ht / 24;
|
|
4298
4301
|
t.scale(Tt, Tt), t.translate(-12, -12), t.fillStyle = Mt, t.fill(At);
|
|
4299
4302
|
}
|
|
4300
4303
|
t.restore();
|
|
4301
4304
|
};
|
|
4302
4305
|
P(h, !0), P(d, !1);
|
|
4303
|
-
const E = e.text || "",
|
|
4306
|
+
const E = e.text || "", R = e.placeholder || "Enter text...", O = !E, W = E || R, B = O ? I : w, $ = M, Y = e.fontFamily || "Inter", H = e.fontWeight || 400;
|
|
4304
4307
|
t.font = `${H} ${$}px "${Y}", sans-serif`, t.fillStyle = B, t.textAlign = "left", t.textBaseline = p ? "top" : "middle";
|
|
4305
4308
|
const K = e.inputPadding ?? 16, A = h.visible ? (h.offset ?? 16) + (h.size || 14) / 2 + 8 : K, _ = d.visible ? (d.offset ?? 16) + (d.size || 14) / 2 + 8 : K, L = -(s / 2) + A, X = s - A - _, V = e.inputType === "password" ? "•".repeat(W.length) : W;
|
|
4306
4309
|
if (t.save(), t.beginPath(), t.rect(L - 2, -n / 2 + 4, X + 4, n - 8), t.clip(), p) {
|
|
4307
4310
|
const nt = V.split(`
|
|
4308
4311
|
`);
|
|
4309
|
-
let
|
|
4310
|
-
const
|
|
4312
|
+
let bt = -n / 2 + K;
|
|
4313
|
+
const ht = $ * 1.2;
|
|
4311
4314
|
let wt = 0;
|
|
4312
4315
|
nt.forEach((Mt, It) => {
|
|
4313
4316
|
const Ot = Mt.split(" ");
|
|
4314
4317
|
let At = "";
|
|
4315
4318
|
for (let Tt = 0; Tt < Ot.length; Tt++) {
|
|
4316
4319
|
const zt = At + Ot[Tt] + " ";
|
|
4317
|
-
t.measureText(zt).width > X && Tt > 0 ? (t.fillText(At, L,
|
|
4320
|
+
t.measureText(zt).width > X && Tt > 0 ? (t.fillText(At, L, bt), At = Ot[Tt] + " ", bt += ht) : At = zt;
|
|
4318
4321
|
}
|
|
4319
|
-
t.fillText(At, L,
|
|
4320
|
-
}), a && !O && Math.floor(performance.now() / 500) % 2 === 0 && t.fillRect(L + wt,
|
|
4322
|
+
t.fillText(At, L, bt), wt = t.measureText(At).width, It < nt.length - 1 && (bt += ht, wt = 0);
|
|
4323
|
+
}), a && !O && Math.floor(performance.now() / 500) % 2 === 0 && t.fillRect(L + wt, bt, 1.5, $);
|
|
4321
4324
|
} else {
|
|
4322
|
-
const
|
|
4323
|
-
let
|
|
4324
|
-
if (
|
|
4325
|
-
const Mt = L +
|
|
4325
|
+
const bt = t.measureText(V).width;
|
|
4326
|
+
let ht = 0;
|
|
4327
|
+
if (bt > X && (ht = bt - X), t.fillText(V, L - ht, 0), a && !O && Math.floor(performance.now() / 500) % 2 === 0) {
|
|
4328
|
+
const Mt = L + bt - ht;
|
|
4326
4329
|
t.fillRect(Mt, -($ / 2), 1.5, $);
|
|
4327
4330
|
}
|
|
4328
4331
|
}
|
|
4329
4332
|
if (t.restore(), f.visible !== !1) {
|
|
4330
|
-
const nt = f.text || "Label",
|
|
4331
|
-
t.font = `600 ${
|
|
4333
|
+
const nt = f.text || "Label", bt = f.fontSize || 12, ht = f.color || "rgba(156, 163, 175, 1)", wt = f.offset ?? 8;
|
|
4334
|
+
t.font = `600 ${bt}px "${Y}", sans-serif`, t.fillStyle = ht, t.textAlign = "left", t.textBaseline = "bottom";
|
|
4332
4335
|
const Mt = -(s / 2), It = -(n / 2) - wt;
|
|
4333
4336
|
t.fillText(nt, Mt, It);
|
|
4334
4337
|
}
|
|
4335
4338
|
if (u.visible === !0) {
|
|
4336
|
-
const nt = u.text || "Helper text",
|
|
4337
|
-
t.font = `400 ${
|
|
4339
|
+
const nt = u.text || "Helper text", bt = u.fontSize || 11, ht = l === "error" ? "rgba(239, 68, 68, 1)" : u.color || "rgba(156, 163, 175, 1)", wt = u.offset ?? 6;
|
|
4340
|
+
t.font = `400 ${bt}px "${Y}", sans-serif`, t.fillStyle = ht, t.textAlign = "left", t.textBaseline = "top";
|
|
4338
4341
|
const Mt = -(s / 2), It = n / 2 + wt;
|
|
4339
4342
|
t.fillText(nt, Mt, It);
|
|
4340
4343
|
}
|
|
4341
4344
|
}
|
|
4342
4345
|
renderSlider(t, i) {
|
|
4343
|
-
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.geometry) || i.geometry, s = (o == null ? void 0 : o.options) || i.options || {}, n = e.width || 200, a = s.value ?? 50, r = s.min ?? 0,
|
|
4344
|
-
if ((X === "Custom" || X === "Icon") &&
|
|
4346
|
+
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.geometry) || i.geometry, s = (o == null ? void 0 : o.options) || i.options || {}, n = e.width || 200, a = s.value ?? 50, r = s.min ?? 0, l = (s.max ?? 100) - r, f = l === 0 ? 0 : (a - r) / l, u = s.trackHeight || 4, h = s.trackRoundedness ?? 2, d = s.trackShape ?? "Rectangle", p = s.trackPath || "", y = s.accentColor || "#3b82f6", m = s.inactiveColor || "#374151", b = s.thumbShape || "Ellipse", v = s.thumbWidth ?? 16, S = s.thumbHeight ?? 16, C = s.thumbRoundedness ?? 0, w = s.thumbColor || "#ffffff", I = s.thumbPath || "", M = s.thumbIcon || "", k = s.showValueTooltip ?? !1, T = s.tooltipBgColor || "#333333", x = s.tooltipColor || "#ffffff", P = s.tooltipOffsetX ?? 0, E = s.tooltipOffsetY ?? -25, R = (X, V, it, lt, nt, bt, ht) => {
|
|
4347
|
+
if ((X === "Custom" || X === "Icon") && ht)
|
|
4345
4348
|
try {
|
|
4346
|
-
const wt = new Path2D(
|
|
4349
|
+
const wt = new Path2D(ht);
|
|
4347
4350
|
if (t.save(), t.translate(V, it), X === "Icon") {
|
|
4348
|
-
const Mt = Math.min(
|
|
4351
|
+
const Mt = Math.min(lt, nt) / 24;
|
|
4349
4352
|
t.scale(Mt, Mt), t.translate(-12, -12);
|
|
4350
4353
|
}
|
|
4351
4354
|
t.fill(wt), t.restore();
|
|
@@ -4354,31 +4357,31 @@ class ci {
|
|
|
4354
4357
|
console.error("Error drawing slider shape in engine:", wt);
|
|
4355
4358
|
}
|
|
4356
4359
|
if (t.beginPath(), X === "Ellipse")
|
|
4357
|
-
t.ellipse(V, it,
|
|
4360
|
+
t.ellipse(V, it, lt / 2, nt / 2, 0, 0, Math.PI * 2);
|
|
4358
4361
|
else if (X === "Rectangle")
|
|
4359
|
-
this.drawRoundRect(t, V -
|
|
4362
|
+
this.drawRoundRect(t, V - lt / 2, it - nt / 2, lt, nt, bt);
|
|
4360
4363
|
else if (X === "Triangle")
|
|
4361
|
-
t.moveTo(V, it - nt / 2), t.lineTo(V +
|
|
4364
|
+
t.moveTo(V, it - nt / 2), t.lineTo(V + lt / 2, it + nt / 2), t.lineTo(V - lt / 2, it + nt / 2), t.closePath();
|
|
4362
4365
|
else if (X === "Diamond")
|
|
4363
|
-
t.moveTo(V, it - nt / 2), t.lineTo(V +
|
|
4366
|
+
t.moveTo(V, it - nt / 2), t.lineTo(V + lt / 2, it), t.lineTo(V, it + nt / 2), t.lineTo(V - lt / 2, it), t.closePath();
|
|
4364
4367
|
else if (X === "Polygon") {
|
|
4365
|
-
const wt = i.geometry.sides || 3, Mt = i.geometry.radius || Math.min(
|
|
4368
|
+
const wt = i.geometry.sides || 3, Mt = i.geometry.radius || Math.min(lt, nt) / 2;
|
|
4366
4369
|
for (let It = 0; It < wt; It++) {
|
|
4367
4370
|
const Ot = It * 2 * Math.PI / wt - Math.PI / 2, At = V + Mt * Math.cos(Ot), Tt = it + Mt * Math.sin(Ot);
|
|
4368
4371
|
It === 0 ? t.moveTo(At, Tt) : t.lineTo(At, Tt);
|
|
4369
4372
|
}
|
|
4370
4373
|
t.closePath();
|
|
4371
4374
|
} else if (X === "Star") {
|
|
4372
|
-
const Mt = Math.min(
|
|
4375
|
+
const Mt = Math.min(lt, nt) / 2, It = Mt / 2;
|
|
4373
4376
|
for (let Ot = 0; Ot < 10; Ot++) {
|
|
4374
4377
|
const At = Ot % 2 === 0 ? Mt : It, Tt = Ot * Math.PI / 5 - Math.PI / 2;
|
|
4375
4378
|
t.lineTo(V + At * Math.cos(Tt), it + At * Math.sin(Tt));
|
|
4376
4379
|
}
|
|
4377
4380
|
t.closePath();
|
|
4378
|
-
} else X === "Line" && (t.moveTo(V -
|
|
4381
|
+
} else X === "Line" && (t.moveTo(V - lt / 2, it), t.lineTo(V + lt / 2, it));
|
|
4379
4382
|
t.fill();
|
|
4380
4383
|
}, O = this.createCanvasFill(t, m, n, u);
|
|
4381
|
-
O && (t.fillStyle = O, t.strokeStyle = O), d === "Line" ? (t.lineWidth = u, t.beginPath(), t.moveTo(-n / 2, 0), t.lineTo(n / 2, 0), t.stroke()) :
|
|
4384
|
+
O && (t.fillStyle = O, t.strokeStyle = O), d === "Line" ? (t.lineWidth = u, t.beginPath(), t.moveTo(-n / 2, 0), t.lineTo(n / 2, 0), t.stroke()) : R(d, 0, 0, n, u, h, p);
|
|
4382
4385
|
const W = n - v, B = -n / 2 + v / 2 + f * W, $ = B - -n / 2;
|
|
4383
4386
|
if ($ > 0) {
|
|
4384
4387
|
const X = this.createCanvasFill(t, y, n, u);
|
|
@@ -4388,42 +4391,42 @@ class ci {
|
|
|
4388
4391
|
const Y = t.getTransform(), H = Math.sqrt(Y.a * Y.a + Y.b * Y.b) || 1;
|
|
4389
4392
|
t.shadowColor = "rgba(0,0,0,0.2)", t.shadowBlur = 4 * H, t.shadowOffsetY = 1 * H;
|
|
4390
4393
|
const K = this.createCanvasFill(t, w, v, S);
|
|
4391
|
-
if (K && (t.fillStyle = K),
|
|
4394
|
+
if (K && (t.fillStyle = K), R(b, 0, 0, v, S, C, b === "Icon" ? M : I), t.restore(), k) {
|
|
4392
4395
|
t.save(), t.translate(B + P, E);
|
|
4393
4396
|
const X = Math.round(a).toString();
|
|
4394
4397
|
t.font = "10px Inter, sans-serif";
|
|
4395
|
-
const V = t.measureText(X), it = 6,
|
|
4396
|
-
t.beginPath(), this.drawRoundRect(t, -nt / 2, -
|
|
4398
|
+
const V = t.measureText(X), it = 6, lt = 4, nt = V.width + it * 2, bt = 14 + lt;
|
|
4399
|
+
t.beginPath(), this.drawRoundRect(t, -nt / 2, -bt / 2, nt, bt, 4), t.fillStyle = T, t.fill(), t.fillStyle = x, t.textAlign = "center", t.textBaseline = "middle", t.fillText(X, 0, 0), t.restore();
|
|
4397
4400
|
}
|
|
4398
4401
|
const A = s.label || {}, _ = s.helperText || {}, L = s.fontFamily || "Inter";
|
|
4399
4402
|
if (A.visible !== !1) {
|
|
4400
|
-
const X = A.text || "Label", V = A.fontSize || 12, it = A.color || "rgba(156, 163, 175, 1)",
|
|
4403
|
+
const X = A.text || "Label", V = A.fontSize || 12, it = A.color || "rgba(156, 163, 175, 1)", lt = A.offset ?? 8;
|
|
4401
4404
|
t.font = `600 ${V}px "${L}", sans-serif`, t.fillStyle = it, t.textAlign = "left", t.textBaseline = "bottom";
|
|
4402
|
-
const nt = -(n / 2),
|
|
4403
|
-
t.fillText(X, nt,
|
|
4405
|
+
const nt = -(n / 2), bt = -(u / 2) - lt;
|
|
4406
|
+
t.fillText(X, nt, bt);
|
|
4404
4407
|
}
|
|
4405
4408
|
if (_.visible === !0) {
|
|
4406
|
-
const X = _.text || "Helper text", V = _.fontSize || 11, it = _.color || "rgba(156, 163, 175, 1)",
|
|
4409
|
+
const X = _.text || "Helper text", V = _.fontSize || 11, it = _.color || "rgba(156, 163, 175, 1)", lt = _.offset ?? 6;
|
|
4407
4410
|
t.font = `400 ${V}px "${L}", sans-serif`, t.fillStyle = it, t.textAlign = "left", t.textBaseline = "top";
|
|
4408
|
-
const nt = -(n / 2),
|
|
4409
|
-
t.fillText(X, nt,
|
|
4411
|
+
const nt = -(n / 2), bt = u / 2 + lt;
|
|
4412
|
+
t.fillText(X, nt, bt);
|
|
4410
4413
|
}
|
|
4411
4414
|
}
|
|
4412
4415
|
renderDropdown(t, i) {
|
|
4413
4416
|
var E;
|
|
4414
4417
|
const o = this.objectStates.get(i.id);
|
|
4415
4418
|
if (!o) return;
|
|
4416
|
-
const e = o.options || i.options || {}, s = i.geometry.width || 160, n = i.geometry.height || 40, a = -s / 2, r = -n / 2,
|
|
4419
|
+
const e = o.options || i.options || {}, s = i.geometry.width || 160, n = i.geometry.height || 40, a = -s / 2, r = -n / 2, c = e.corner_radius ?? 6, l = e.disabled || e.previewState === "disabled", f = this.lastHoveredObjectId === i.id || e.previewState === "hover", u = (e.isOpen || e.previewState === "active") && !l;
|
|
4417
4420
|
let h = e.backgroundColor, d = e.borderColor, p = e.color || "#333333";
|
|
4418
|
-
|
|
4421
|
+
l ? (h = e.disabledBackgroundColor || "#f3f4f6", d = e.disabledBorderColor || "#e5e7eb", p = e.disabledColor || "#9ca3af") : u ? (h = e.activeBackgroundColor || h, d = e.activeBorderColor || d, p = e.activeColor || p) : f && (h = e.hoverBackgroundColor || h, d = e.hoverBorderColor || d, p = e.hoverColor || p), h || (h = "#ffffff"), d || (d = "#e5e7eb");
|
|
4419
4422
|
const y = t.globalAlpha;
|
|
4420
|
-
t.globalAlpha = y * (e.opacity ?? 1), this.drawRoundRect(t, a, r, s, n,
|
|
4423
|
+
t.globalAlpha = y * (e.opacity ?? 1), this.drawRoundRect(t, a, r, s, n, c), t.fillStyle = this.createCanvasFill(t, typeof h == "string" ? { type: "Solid", color: h } : h, s, n) || "#ffffff", t.fill();
|
|
4421
4424
|
const m = e.borderWidth ?? 1;
|
|
4422
4425
|
m > 0 && (t.strokeStyle = this.createCanvasFill(t, typeof d == "string" ? { type: "Solid", color: d } : d, s, n) || "#e5e7eb", t.lineWidth = m, t.stroke());
|
|
4423
4426
|
const b = 12, v = e.chevronType || "chevron", S = e.chevronSize || 16, C = (u ? e.openIconColor : e.closedIconColor) || e.chevronColor || "#6b7280";
|
|
4424
4427
|
if (v !== "none") {
|
|
4425
|
-
const
|
|
4426
|
-
t.save(), t.translate(
|
|
4428
|
+
const R = a + s - b - S / 2;
|
|
4429
|
+
t.save(), t.translate(R, 0);
|
|
4427
4430
|
const O = u ? e.openIconAngle ?? 180 : e.closedIconAngle ?? 0;
|
|
4428
4431
|
if (t.rotate(O * Math.PI / 180), t.strokeStyle = C, t.fillStyle = C, t.lineWidth = 1.5, t.lineCap = "round", t.lineJoin = "round", v === "chevron")
|
|
4429
4432
|
t.beginPath(), t.moveTo(-S / 2, -S * 0.2), t.lineTo(0, S * 0.2), t.lineTo(S / 2, -S * 0.2), t.stroke();
|
|
@@ -4440,110 +4443,110 @@ class ci {
|
|
|
4440
4443
|
}
|
|
4441
4444
|
const w = e.selectedOption || e.placeholder || "Select...", I = e.fontSize || 14, M = e.fontWeight || 400, k = e.fontFamily || "Inter, sans-serif";
|
|
4442
4445
|
t.font = `${M} ${I}px ${k}`;
|
|
4443
|
-
const T =
|
|
4446
|
+
const T = l ? e.disabledColor || "#9ca3af" : !e.selectedOption && e.placeholder ? "#9ca3af" : p;
|
|
4444
4447
|
t.fillStyle = this.createCanvasFill(t, typeof T == "string" ? { type: "Solid", color: T } : T, s, n) || "#333333", t.textAlign = "left", t.textBaseline = "middle";
|
|
4445
|
-
const
|
|
4446
|
-
if (t.save(), t.beginPath(), t.rect(a + b, r, P, n), t.clip(), t.fillText(w, a + b, 0), t.restore(), u && !
|
|
4447
|
-
const
|
|
4448
|
+
const x = v === "none" ? 0 : S + 8, P = s - b * 2 - x;
|
|
4449
|
+
if (t.save(), t.beginPath(), t.rect(a + b, r, P, n), t.clip(), t.fillText(w, a + b, 0), t.restore(), u && !l) {
|
|
4450
|
+
const R = r + n + 4, O = e.optionsList || [], W = e.itemHeight || 32, B = e.listPadding ?? 4, $ = O.length * W + B * 2, Y = e.listCornerRadius ?? c;
|
|
4448
4451
|
t.save();
|
|
4449
4452
|
const H = e.listShadow || {}, K = t.getTransform(), A = Math.sqrt(K.a * K.a + K.b * K.b) || 1;
|
|
4450
|
-
t.shadowColor = typeof H.color == "string" ? H.color : ((E = H.color) == null ? void 0 : E.color) || "rgba(0,0,0,0.15)", t.shadowBlur = (H.blur ?? 12) * A, t.shadowOffsetY = (H.offsetY ?? 6) * A, t.shadowOffsetX = (H.offsetX ?? 0) * A, t.beginPath(), this.drawRoundRect(t, a,
|
|
4453
|
+
t.shadowColor = typeof H.color == "string" ? H.color : ((E = H.color) == null ? void 0 : E.color) || "rgba(0,0,0,0.15)", t.shadowBlur = (H.blur ?? 12) * A, t.shadowOffsetY = (H.offsetY ?? 6) * A, t.shadowOffsetX = (H.offsetX ?? 0) * A, t.beginPath(), this.drawRoundRect(t, a, R, s, $, Y), t.fillStyle = this.createCanvasFill(t, typeof e.listBackgroundColor == "string" ? { type: "Solid", color: e.listBackgroundColor } : e.listBackgroundColor || { type: "Solid", color: "#ffffff" }, s, $) || "#ffffff", t.fill();
|
|
4451
4454
|
const _ = e.listBorderWidth ?? 1;
|
|
4452
4455
|
_ > 0 && (t.shadowColor = "transparent", t.strokeStyle = this.createCanvasFill(t, typeof e.listBorderColor == "string" ? { type: "Solid", color: e.listBorderColor } : e.listBorderColor || { type: "Solid", color: d }, s, $) || "#e5e7eb", t.lineWidth = _, t.stroke()), t.restore();
|
|
4453
4456
|
const L = e.itemFontSize || I, X = e.itemFontFamily || k;
|
|
4454
4457
|
t.font = `${M} ${L}px ${X}`, O.forEach((V, it) => {
|
|
4455
|
-
const
|
|
4458
|
+
const lt = R + B + it * W;
|
|
4456
4459
|
if (V === e.selectedOption)
|
|
4457
|
-
t.fillStyle = this.createCanvasFill(t, typeof e.itemSelectedBackgroundColor == "string" ? { type: "Solid", color: e.itemSelectedBackgroundColor } : e.itemSelectedBackgroundColor || { type: "Solid", color: "#f3f4f6" }, s, W) || "#f3f4f6", t.fillRect(a + _,
|
|
4460
|
+
t.fillStyle = this.createCanvasFill(t, typeof e.itemSelectedBackgroundColor == "string" ? { type: "Solid", color: e.itemSelectedBackgroundColor } : e.itemSelectedBackgroundColor || { type: "Solid", color: "#f3f4f6" }, s, W) || "#f3f4f6", t.fillRect(a + _, lt, s - _ * 2, W), t.fillStyle = e.itemSelectedColor || e.accentColor || p || "#374151";
|
|
4458
4461
|
else if (t.fillStyle = e.listTextColor || p || "#333333", this.activeDropdownId === i.id && this._lastPointerPos) {
|
|
4459
|
-
const
|
|
4460
|
-
it ===
|
|
4462
|
+
const bt = this._lastPointerPos.y - (R + B), ht = Math.floor(bt / W);
|
|
4463
|
+
it === ht && (t.fillStyle = this.createCanvasFill(t, typeof e.itemHoverBackgroundColor == "string" ? { type: "Solid", color: e.itemHoverBackgroundColor } : e.itemHoverBackgroundColor || { type: "Solid", color: "#f9fafb" }, s, W) || "#f9fafb", t.fillRect(a + _, lt, s - _ * 2, W), t.fillStyle = e.itemHoverColor || p);
|
|
4461
4464
|
}
|
|
4462
|
-
t.fillText(V, a + b,
|
|
4465
|
+
t.fillText(V, a + b, lt + W / 2);
|
|
4463
4466
|
});
|
|
4464
4467
|
}
|
|
4465
4468
|
t.globalAlpha = y;
|
|
4466
4469
|
}
|
|
4467
4470
|
renderButton(t, i) {
|
|
4468
4471
|
if (i.children && i.children.length > 0) return;
|
|
4469
|
-
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = i.geometry || {}, n = s.width || 120, a = s.height || 40, r = this.lastHoveredObjectId === i.id,
|
|
4470
|
-
let d = e.backgroundColor || "#3b82f6", p =
|
|
4471
|
-
|
|
4472
|
+
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = i.geometry || {}, n = s.width || 120, a = s.height || 40, r = this.lastHoveredObjectId === i.id, c = this.activeObjectId === i.id, l = e.label || {}, f = e.hoverStyle || {}, u = e.activeStyle || {}, h = e.icon || { enabled: !1 };
|
|
4473
|
+
let d = e.backgroundColor || "#3b82f6", p = l.color || "#ffffff", y = l.text || "Button", m = s.cornerRadius ?? 8, b = e.borderColor || "transparent", v = e.borderWidth || 0, S = 1;
|
|
4474
|
+
c && u ? (d = u.backgroundColor || d, p = u.color || p, y = u.text || y, S = u.scale ?? 0.95, m = u.cornerRadius ?? m) : r && f && (d = f.backgroundColor || d, p = f.color || p, y = f.text || y, S = f.scale ?? 1, m = f.cornerRadius ?? m, b = f.borderColor || b);
|
|
4472
4475
|
const C = -n / 2, w = -a / 2;
|
|
4473
4476
|
t.save(), t.scale(S, S), t.beginPath(), this.drawRoundRect(t, C, w, n, a, m);
|
|
4474
4477
|
const I = this.createCanvasFill(t, d, n, a);
|
|
4475
4478
|
I && (t.fillStyle = I, t.fill()), (v > 0 || r && f.borderColor) && (t.strokeStyle = b, t.lineWidth = v || (r ? 1 : 0), t.stroke());
|
|
4476
|
-
const M =
|
|
4479
|
+
const M = l.fontSize || 14, k = l.fontFamily || "Inter", T = l.fontWeight || 600;
|
|
4477
4480
|
t.font = `${T} ${M}px "${k}", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`, t.fillStyle = p, t.textAlign = "center", t.textBaseline = "middle";
|
|
4478
|
-
let
|
|
4481
|
+
let x = 0;
|
|
4479
4482
|
if (h.enabled && h.svgPath) {
|
|
4480
|
-
const P = M * 1.1, E = h.gap || 8,
|
|
4481
|
-
|
|
4483
|
+
const P = M * 1.1, E = h.gap || 8, R = t.measureText(y), W = -(R.width + P + E) / 2, B = h.position === "left" ? W + P / 2 : W + R.width + E + P / 2;
|
|
4484
|
+
x = h.position === "left" ? W + P + E + R.width / 2 : W + R.width / 2, t.save(), t.translate(B, 0);
|
|
4482
4485
|
const $ = new Path2D(h.svgPath), Y = P / 24;
|
|
4483
4486
|
t.scale(Y, Y), t.translate(-12, -12), t.fillStyle = p, t.fill($), t.restore();
|
|
4484
4487
|
}
|
|
4485
|
-
t.fillText(y,
|
|
4488
|
+
t.fillText(y, x, 0), t.restore();
|
|
4486
4489
|
}
|
|
4487
4490
|
renderToggleButton(t, i) {
|
|
4488
4491
|
var y, m;
|
|
4489
|
-
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = e.checked ?? !1, n = ((y = i.geometry) == null ? void 0 : y.width) || 120, a = ((m = i.geometry) == null ? void 0 : m.height) || 40, r = -n / 2,
|
|
4490
|
-
t.save(), t.beginPath(), this.drawRoundRect(t, r,
|
|
4492
|
+
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = e.checked ?? !1, n = ((y = i.geometry) == null ? void 0 : y.width) || 120, a = ((m = i.geometry) == null ? void 0 : m.height) || 40, r = -n / 2, c = -a / 2, l = e.corner_radius ?? 8, f = e.label || {}, u = s ? e.accentColor || "#3b82f6" : e.inactiveColor || "#374151", h = s ? e.activeTextColor || "#ffffff" : e.inactiveTextColor || "#9ca3af";
|
|
4493
|
+
t.save(), t.beginPath(), this.drawRoundRect(t, r, c, n, a, l), t.fillStyle = u, t.fill();
|
|
4491
4494
|
const d = f.fontSize || 14, p = f.fontFamily || "Inter";
|
|
4492
4495
|
t.font = `${f.fontWeight || 600} ${d}px "${p}", sans-serif`, t.fillStyle = h, t.textAlign = "center", t.textBaseline = "middle", t.fillText(f.text || "Toggle", 0, 0), t.restore();
|
|
4493
4496
|
}
|
|
4494
4497
|
renderToggle(t, i) {
|
|
4495
|
-
var Y, H, K, A, _, L, X, V, it,
|
|
4496
|
-
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = ((Y = i.geometry) == null ? void 0 : Y.width) || 52, n = ((H = i.geometry) == null ? void 0 : H.height) || 30, a = -s / 2, r = -n / 2,
|
|
4497
|
-
e.disabled && (t.globalAlpha *= 0.5), t.beginPath(), this.drawRoundRect(t, a, r, s, n,
|
|
4498
|
+
var Y, H, K, A, _, L, X, V, it, lt, nt, bt;
|
|
4499
|
+
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = ((Y = i.geometry) == null ? void 0 : Y.width) || 52, n = ((H = i.geometry) == null ? void 0 : H.height) || 30, a = -s / 2, r = -n / 2, c = e.checked ?? !1, l = e.cornerRadius ?? e.corner_radius ?? n / 2, f = e.toggleStyle || {}, u = f.backgroundColor || e.activeColor || "#10b981", h = f.borderColor || e.borderColor || "transparent", d = f.borderWidth ?? e.borderWidth ?? 0, p = f.knobColor || e.knobColor || "#ffffff", y = c ? u : e.inactiveColor || "#374151", m = c ? h : e.borderColor || "transparent", b = c ? d : e.borderWidth ?? 0, v = c ? p : e.knobColor || "#ffffff";
|
|
4500
|
+
e.disabled && (t.globalAlpha *= 0.5), t.beginPath(), this.drawRoundRect(t, a, r, s, n, l);
|
|
4498
4501
|
const S = this.createCanvasFill(t, y, s, n);
|
|
4499
4502
|
if (S && (t.fillStyle = S, t.fill()), b > 0) {
|
|
4500
4503
|
t.lineWidth = b;
|
|
4501
|
-
const
|
|
4502
|
-
|
|
4504
|
+
const ht = this.createCanvasFill(t, m, s, n);
|
|
4505
|
+
ht && (t.strokeStyle = ht, t.stroke());
|
|
4503
4506
|
}
|
|
4504
|
-
const C = 2, w = n - C * 2, I = w / 2, M = a + C, k = a + s - C - w, T =
|
|
4505
|
-
t.beginPath(), t.arc(T + I,
|
|
4507
|
+
const C = 2, w = n - C * 2, I = w / 2, M = a + C, k = a + s - C - w, T = c ? k : M, x = r + C;
|
|
4508
|
+
t.beginPath(), t.arc(T + I, x + I, I, 0, Math.PI * 2);
|
|
4506
4509
|
const P = this.createCanvasFill(t, v, w, w);
|
|
4507
4510
|
P && (t.fillStyle = P, t.fill()), e.disabled && (t.globalAlpha *= 2);
|
|
4508
|
-
let E = !1,
|
|
4509
|
-
const O = (
|
|
4511
|
+
let E = !1, R = !1;
|
|
4512
|
+
const O = (c ? (K = f.leftLabel) == null ? void 0 : K.text : null) || ((A = e.leftLabel) == null ? void 0 : A.text) || "", W = (c ? (_ = f.leftLabel) == null ? void 0 : _.color : null) || ((L = e.leftLabel) == null ? void 0 : L.color) || "#f3f4f6";
|
|
4510
4513
|
if ((X = e.leftLabel) != null && X.enabled && O) {
|
|
4511
|
-
const
|
|
4512
|
-
t.font = `${
|
|
4514
|
+
const ht = e.leftLabel;
|
|
4515
|
+
t.font = `${ht.fontWeight || 400} ${ht.fontSize || 12}px "${ht.fontFamily || "Inter"}", sans-serif`, t.fillStyle = W, t.textBaseline = "middle", t.textAlign = "right", t.fillText(O, a - (ht.gap || 8), 0), E = !0;
|
|
4513
4516
|
}
|
|
4514
|
-
const B = (
|
|
4515
|
-
if ((
|
|
4516
|
-
const
|
|
4517
|
-
t.font = `${
|
|
4517
|
+
const B = (c ? (V = f.rightLabel) == null ? void 0 : V.text : null) || ((it = e.rightLabel) == null ? void 0 : it.text) || "", $ = (c ? (lt = f.rightLabel) == null ? void 0 : lt.color : null) || ((nt = e.rightLabel) == null ? void 0 : nt.color) || "#f3f4f6";
|
|
4518
|
+
if ((bt = e.rightLabel) != null && bt.enabled && B) {
|
|
4519
|
+
const ht = e.rightLabel;
|
|
4520
|
+
t.font = `${ht.fontWeight || 400} ${ht.fontSize || 12}px "${ht.fontFamily || "Inter"}", sans-serif`, t.fillStyle = $, t.textBaseline = "middle", t.textAlign = "left", t.fillText(B, a + s + (ht.gap || 8), 0), R = !0;
|
|
4518
4521
|
}
|
|
4519
|
-
if (!E && !
|
|
4520
|
-
const
|
|
4521
|
-
t.font = `${Mt} ${wt}px "${It}", sans-serif`, t.fillStyle =
|
|
4522
|
-
const Ot =
|
|
4522
|
+
if (!E && !R && e.label && e.label.text) {
|
|
4523
|
+
const ht = e.label, wt = ht.fontSize || 14, Mt = ht.fontWeight || 400, It = ht.fontFamily || "Inter";
|
|
4524
|
+
t.font = `${Mt} ${wt}px "${It}", sans-serif`, t.fillStyle = ht.color || "#f3f4f6", t.textBaseline = "middle";
|
|
4525
|
+
const Ot = ht.gap || 10;
|
|
4523
4526
|
let At = 0, Tt = 0;
|
|
4524
|
-
|
|
4527
|
+
ht.position === "left" ? (t.textAlign = "right", At = a - Ot, Tt = 0) : ht.position === "right" ? (t.textAlign = "left", At = a + s + Ot, Tt = 0) : ht.position === "top" ? (t.textAlign = "center", At = 0, Tt = r - Ot, t.textBaseline = "bottom") : ht.position === "bottom" ? (t.textAlign = "center", At = 0, Tt = r + n + Ot, t.textBaseline = "top") : (t.textAlign = "left", At = a + s + Ot, Tt = 0), t.fillText(ht.text, At, Tt);
|
|
4525
4528
|
}
|
|
4526
4529
|
}
|
|
4527
4530
|
renderCheckbox(t, i) {
|
|
4528
4531
|
var S, C;
|
|
4529
|
-
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = ((S = i.geometry) == null ? void 0 : S.width) || 20, n = ((C = i.geometry) == null ? void 0 : C.height) || 20, a = -s / 2, r = -n / 2,
|
|
4530
|
-
e.disabled && (t.globalAlpha *= 0.5), t.beginPath(), this.drawRoundRect(t, a, r, s, n,
|
|
4532
|
+
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = ((S = i.geometry) == null ? void 0 : S.width) || 20, n = ((C = i.geometry) == null ? void 0 : C.height) || 20, a = -s / 2, r = -n / 2, c = e.cornerRadius ?? 4, l = e.checked ?? !1, f = e.activeColor || "#3b82f6", u = e.inactiveColor || "transparent", h = e.checkColor || "#ffffff", d = e.borderColor || "#4b5563", p = e.borderWidth ?? 2, y = l ? f : u, m = l ? "transparent" : d, b = l ? 0 : p;
|
|
4533
|
+
e.disabled && (t.globalAlpha *= 0.5), t.beginPath(), this.drawRoundRect(t, a, r, s, n, c);
|
|
4531
4534
|
const v = this.createCanvasFill(t, y, s, n);
|
|
4532
4535
|
if (v && (t.fillStyle = v, t.fill()), b > 0) {
|
|
4533
4536
|
t.lineWidth = b;
|
|
4534
4537
|
const w = this.createCanvasFill(t, m, s, n);
|
|
4535
4538
|
w && (t.strokeStyle = w, t.stroke());
|
|
4536
|
-
} else if (
|
|
4539
|
+
} else if (l) {
|
|
4537
4540
|
t.lineWidth = 1;
|
|
4538
4541
|
const w = this.createCanvasFill(t, f, s, n);
|
|
4539
4542
|
w && (t.strokeStyle = w, t.stroke());
|
|
4540
4543
|
}
|
|
4541
|
-
if (
|
|
4544
|
+
if (l) {
|
|
4542
4545
|
t.save(), t.beginPath();
|
|
4543
4546
|
const w = this.createCanvasFill(t, h, s, n);
|
|
4544
4547
|
t.strokeStyle = w || h, t.lineWidth = Math.max(2, s * 0.12), t.lineCap = "round", t.lineJoin = "round";
|
|
4545
|
-
const I = a + s * 0.25, M = r + n * 0.5, k = a + s * 0.45, T = r + n * 0.7,
|
|
4546
|
-
t.moveTo(I, M), t.lineTo(k, T), t.lineTo(
|
|
4548
|
+
const I = a + s * 0.25, M = r + n * 0.5, k = a + s * 0.45, T = r + n * 0.7, x = a + s * 0.75, P = r + n * 0.25;
|
|
4549
|
+
t.moveTo(I, M), t.lineTo(k, T), t.lineTo(x, P), t.stroke(), t.restore();
|
|
4547
4550
|
}
|
|
4548
4551
|
if (e.disabled && (t.globalAlpha *= 2), e.label && e.label.text) {
|
|
4549
4552
|
const w = e.label;
|
|
@@ -4555,24 +4558,24 @@ class ci {
|
|
|
4555
4558
|
}
|
|
4556
4559
|
renderRadioGroup(t, i) {
|
|
4557
4560
|
var C, w;
|
|
4558
|
-
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = ((C = i.geometry) == null ? void 0 : C.width) || 180, n = ((w = i.geometry) == null ? void 0 : w.height) || 100, a = -s / 2, r = -n / 2,
|
|
4561
|
+
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = ((C = i.geometry) == null ? void 0 : C.width) || 180, n = ((w = i.geometry) == null ? void 0 : w.height) || 100, a = -s / 2, r = -n / 2, c = e.selectedValue, l = e.optionsList || ["Option 1", "Option 2", "Option 3"], f = e.orientation || "vertical", u = e.itemGap !== void 0 ? e.itemGap : 16, h = e.activeColor || "#3b82f6", d = e.inactiveColor || "#4b5563", p = e.textColor || "#ffffff", y = e.fontSize || 14, m = e.fontFamily || "Inter", b = e.fontWeight || 400;
|
|
4559
4562
|
e.disabled && (t.globalAlpha *= 0.5);
|
|
4560
4563
|
const v = 8, S = v * 2;
|
|
4561
4564
|
if (t.save(), t.font = `${b} ${y}px "${m}", sans-serif`, t.textBaseline = "middle", t.textAlign = "left", f === "vertical") {
|
|
4562
4565
|
const I = Math.max(S, y) + u;
|
|
4563
|
-
|
|
4566
|
+
l.forEach((M, k) => {
|
|
4564
4567
|
const T = r + k * I + v;
|
|
4565
4568
|
t.beginPath(), t.arc(a + v, T, v, 0, Math.PI * 2);
|
|
4566
|
-
const
|
|
4567
|
-
|
|
4569
|
+
const x = c === M, P = this.createCanvasFill(t, h, S, S), E = this.createCanvasFill(t, d, S, S);
|
|
4570
|
+
x ? (t.strokeStyle = P || h, t.lineWidth = 2, t.stroke(), t.beginPath(), t.arc(a + v, T, v / 2, 0, Math.PI * 2), t.fillStyle = P || h, t.fill()) : (t.strokeStyle = E || d, t.lineWidth = 1.5, t.stroke()), t.fillStyle = p, t.fillText(M, a + S + 8, T);
|
|
4568
4571
|
});
|
|
4569
4572
|
} else {
|
|
4570
4573
|
let I = a;
|
|
4571
|
-
|
|
4572
|
-
const k =
|
|
4574
|
+
l.forEach((M) => {
|
|
4575
|
+
const k = c === M, T = t.measureText(M).width;
|
|
4573
4576
|
t.beginPath(), t.arc(I + v, 0, v, 0, Math.PI * 2);
|
|
4574
|
-
const
|
|
4575
|
-
k ? (t.strokeStyle =
|
|
4577
|
+
const x = this.createCanvasFill(t, h, S, S), P = this.createCanvasFill(t, d, S, S);
|
|
4578
|
+
k ? (t.strokeStyle = x || h, t.lineWidth = 2, t.stroke(), t.beginPath(), t.arc(I + v, 0, v / 2, 0, Math.PI * 2), t.fillStyle = x || h, t.fill()) : (t.strokeStyle = P || d, t.lineWidth = 1.5, t.stroke()), t.fillStyle = p, t.fillText(M, I + S + 6, 0), I += S + 6 + T + u;
|
|
4576
4579
|
});
|
|
4577
4580
|
}
|
|
4578
4581
|
if (t.restore(), e.disabled && (t.globalAlpha *= 2), e.label && e.label.text) {
|
|
@@ -4584,10 +4587,10 @@ class ci {
|
|
|
4584
4587
|
}
|
|
4585
4588
|
}
|
|
4586
4589
|
renderBarChart(t, i) {
|
|
4587
|
-
var T,
|
|
4590
|
+
var T, x;
|
|
4588
4591
|
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = {
|
|
4589
4592
|
width: ((T = i.geometry) == null ? void 0 : T.width) || 300,
|
|
4590
|
-
height: ((
|
|
4593
|
+
height: ((x = i.geometry) == null ? void 0 : x.height) || 180,
|
|
4591
4594
|
chartType: e.chartType || "grouped",
|
|
4592
4595
|
stylePreset: e.stylePreset || "default",
|
|
4593
4596
|
datasets: e.datasets || [{ id: "ds-1", label: "Revenue", data: [42, 67, 31, 55, 78, 48], color: "#6366f1" }],
|
|
@@ -4632,36 +4635,36 @@ class ci {
|
|
|
4632
4635
|
return hs[this.stylePreset] || hs.default;
|
|
4633
4636
|
},
|
|
4634
4637
|
_resolveColor: function(P, E) {
|
|
4635
|
-
const
|
|
4636
|
-
return ["#6366f1", "#f59e0b", "#10b981", "#3b82f6", "#a855f7"].includes(P) ?
|
|
4638
|
+
const R = this._getPreset();
|
|
4639
|
+
return ["#6366f1", "#f59e0b", "#10b981", "#3b82f6", "#a855f7"].includes(P) ? R.colors[E % R.colors.length] : typeof P == "string" ? P : R.colors[E % R.colors.length];
|
|
4637
4640
|
},
|
|
4638
|
-
_makeGradient: function(P, E,
|
|
4641
|
+
_makeGradient: function(P, E, R, O, W, B) {
|
|
4639
4642
|
if (!this._getPreset().barGradient && !this.barGradient) return E;
|
|
4640
|
-
const Y = P.createLinearGradient(
|
|
4643
|
+
const Y = P.createLinearGradient(R, O, W, B);
|
|
4641
4644
|
return Y.addColorStop(0, E), Y.addColorStop(1, E + "44"), Y;
|
|
4642
4645
|
},
|
|
4643
|
-
_drawRoundedBar: function(P, E,
|
|
4646
|
+
_drawRoundedBar: function(P, E, R, O, W, B, $) {
|
|
4644
4647
|
if (B = Math.min(B, Math.min(Math.abs(O), Math.abs(W)) / 2), B <= 0 || O === 0 || W === 0) {
|
|
4645
|
-
P.rect(E,
|
|
4648
|
+
P.rect(E, R, O, W);
|
|
4646
4649
|
return;
|
|
4647
4650
|
}
|
|
4648
|
-
P.beginPath(), $ ? (P.moveTo(E,
|
|
4651
|
+
P.beginPath(), $ ? (P.moveTo(E, R + W), P.lineTo(E, R + B), P.quadraticCurveTo(E, R, E + B, R), P.lineTo(E + O - B, R), P.quadraticCurveTo(E + O, R, E + O, R + B), P.lineTo(E + O, R + W), P.lineTo(E, R + W)) : (P.moveTo(E, R), P.lineTo(E + O - B, R), P.quadraticCurveTo(E + O, R, E + O, R + B), P.lineTo(E + O, R + W - B), P.quadraticCurveTo(E + O, R + W, E + O - B, R + W), P.lineTo(E, R + W), P.lineTo(E, R)), P.closePath();
|
|
4649
4652
|
}
|
|
4650
|
-
}, n = s.width, a = s.height, r = -n / 2,
|
|
4653
|
+
}, n = s.width, a = s.height, r = -n / 2, c = -a / 2;
|
|
4651
4654
|
if (!s.datasets || s.datasets.length === 0 || s.categories.length === 0) {
|
|
4652
4655
|
t.save(), t.fillStyle = "rgba(99,102,241,0.7)", t.font = "bold 11px Inter, sans-serif", t.textAlign = "center", t.textBaseline = "middle", t.fillText("NO CHART DATA", 0, 0), t.restore();
|
|
4653
4656
|
return;
|
|
4654
4657
|
}
|
|
4655
|
-
const
|
|
4658
|
+
const l = s._getPreset();
|
|
4656
4659
|
let f = -1 / 0, u = 1 / 0;
|
|
4657
4660
|
const h = s.categories.length, d = s.datasets.length;
|
|
4658
4661
|
if (s.chartType === "stacked")
|
|
4659
4662
|
for (let P = 0; P < h; P++) {
|
|
4660
|
-
let E = 0,
|
|
4663
|
+
let E = 0, R = 0;
|
|
4661
4664
|
s.datasets.forEach((O) => {
|
|
4662
4665
|
const W = O.data[P] ?? 0;
|
|
4663
|
-
W >= 0 ? E += W :
|
|
4664
|
-
}), E > f && (f = E),
|
|
4666
|
+
W >= 0 ? E += W : R += W;
|
|
4667
|
+
}), E > f && (f = E), R < u && (u = R);
|
|
4665
4668
|
}
|
|
4666
4669
|
else
|
|
4667
4670
|
s.datasets.forEach((P) => {
|
|
@@ -4672,19 +4675,19 @@ class ci {
|
|
|
4672
4675
|
isFinite(f) || (f = 10), isFinite(u) || (u = 0), f = Math.max(f, 0), u = Math.min(u, 0);
|
|
4673
4676
|
const p = f - u || 10;
|
|
4674
4677
|
t.save(), s.enableShadows && (t.shadowColor = s.shadowColor, t.shadowBlur = s.shadowBlur, t.shadowOffsetY = s.shadowOffsetY), t.font = s.axisLabelFontSize + "px Inter, sans-serif";
|
|
4675
|
-
const y = s.showYLabels ? t.measureText(f.toFixed(0)).width + 14 : 10, m = s.showXLabels ? s.axisLabelFontSize + 12 : 8, v = (s.showLegend && d > 0 ? s.legendFontSize + 10 : 0) + 8, S = 10, C = r + y, w =
|
|
4676
|
-
if (s.enableShadows && (t.shadowColor = "transparent"), t.beginPath(), t.roundRect(r,
|
|
4678
|
+
const y = s.showYLabels ? t.measureText(f.toFixed(0)).width + 14 : 10, m = s.showXLabels ? s.axisLabelFontSize + 12 : 8, v = (s.showLegend && d > 0 ? s.legendFontSize + 10 : 0) + 8, S = 10, C = r + y, w = c + v, I = n - y - S, M = a - v - m;
|
|
4679
|
+
if (s.enableShadows && (t.shadowColor = "transparent"), t.beginPath(), t.roundRect(r, c, n, a, 10), t.fillStyle = l.cardBackground, t.fill(), t.strokeStyle = l.cardBorderColor, t.lineWidth = 1, t.stroke(), s.chartBackground && s.chartBackground !== "transparent" && (t.beginPath(), t.rect(C, w, I, M), t.fillStyle = s.chartBackground, t.fill()), s.showLegend && d > 0) {
|
|
4677
4680
|
t.font = s.legendFontSize + "px Inter, sans-serif", t.textBaseline = "middle";
|
|
4678
|
-
const P =
|
|
4681
|
+
const P = c + 12;
|
|
4679
4682
|
let E = C;
|
|
4680
|
-
s.datasets.forEach((
|
|
4681
|
-
const W = s._resolveColor(
|
|
4682
|
-
t.beginPath(), t.roundRect(E, P - $ / 2, $, $, 2), t.fillStyle = W, t.fill(), t.fillStyle =
|
|
4683
|
+
s.datasets.forEach((R, O) => {
|
|
4684
|
+
const W = s._resolveColor(R.color, O), B = R.label || "Series " + (O + 1), $ = 7;
|
|
4685
|
+
t.beginPath(), t.roundRect(E, P - $ / 2, $, $, 2), t.fillStyle = W, t.fill(), t.fillStyle = l.legendColor, t.textAlign = "left", t.fillText(B, E + $ + 4, P), E += t.measureText(B).width + $ + 16;
|
|
4683
4686
|
});
|
|
4684
4687
|
}
|
|
4685
4688
|
const k = 4;
|
|
4686
4689
|
if (s.showGridLines) {
|
|
4687
|
-
t.setLineDash(s.gridLineDash || []), t.lineWidth = s.gridLineWidth || 1, t.strokeStyle =
|
|
4690
|
+
t.setLineDash(s.gridLineDash || []), t.lineWidth = s.gridLineWidth || 1, t.strokeStyle = l.gridColor;
|
|
4688
4691
|
for (let P = 0; P <= k; P++)
|
|
4689
4692
|
if (s.orientation === "horizontal") {
|
|
4690
4693
|
const E = C + P / k * I;
|
|
@@ -4696,27 +4699,27 @@ class ci {
|
|
|
4696
4699
|
t.setLineDash([]);
|
|
4697
4700
|
}
|
|
4698
4701
|
if (s.showYLabels) {
|
|
4699
|
-
t.font = s.axisLabelFontSize + "px Inter, sans-serif", t.textAlign = "right", t.textBaseline = "middle", t.fillStyle =
|
|
4702
|
+
t.font = s.axisLabelFontSize + "px Inter, sans-serif", t.textAlign = "right", t.textBaseline = "middle", t.fillStyle = l.axisLabelColor;
|
|
4700
4703
|
for (let P = 0; P <= k; P++)
|
|
4701
4704
|
if (s.orientation === "horizontal") {
|
|
4702
|
-
const E = u + P / k * p,
|
|
4703
|
-
t.textAlign = "center", t.fillText(E.toFixed(0),
|
|
4705
|
+
const E = u + P / k * p, R = C + P / k * I;
|
|
4706
|
+
t.textAlign = "center", t.fillText(E.toFixed(0), R, w + M + s.axisLabelFontSize);
|
|
4704
4707
|
} else {
|
|
4705
|
-
const E = f - P / k * p,
|
|
4706
|
-
t.textAlign = "right", t.fillText(E.toFixed(0), C - 6,
|
|
4708
|
+
const E = f - P / k * p, R = w + P / k * M;
|
|
4709
|
+
t.textAlign = "right", t.fillText(E.toFixed(0), C - 6, R);
|
|
4707
4710
|
}
|
|
4708
4711
|
}
|
|
4709
4712
|
if (t.setLineDash([]), s.showXAxis && (t.lineWidth = s.xAxisLineWidth || 1, t.strokeStyle = s.xAxisColor, t.beginPath(), t.moveTo(C, w + M), t.lineTo(C + I, w + M), t.stroke()), s.showYAxis && (t.lineWidth = s.yAxisLineWidth || 1, t.strokeStyle = s.yAxisColor, t.beginPath(), t.moveTo(C, w), t.lineTo(C, w + M), t.stroke()), s.enableShadows && (t.shadowColor = s.shadowColor), s.chartType === "stacked")
|
|
4710
4713
|
if (s.orientation === "horizontal") {
|
|
4711
4714
|
const P = M / h;
|
|
4712
4715
|
for (let E = 0; E < h; E++) {
|
|
4713
|
-
const
|
|
4714
|
-
s.showXLabels && (t.font = s.axisLabelFontSize + "px Inter, sans-serif", t.textAlign = "right", t.textBaseline = "middle", t.fillStyle =
|
|
4716
|
+
const R = w + E * P + P / 2;
|
|
4717
|
+
s.showXLabels && (t.font = s.axisLabelFontSize + "px Inter, sans-serif", t.textAlign = "right", t.textBaseline = "middle", t.fillStyle = l.axisLabelColor, t.shadowColor = "transparent", t.fillText(s.categories[E] || "", C - 5, R), s.enableShadows && (t.shadowColor = s.shadowColor));
|
|
4715
4718
|
let O = C;
|
|
4716
4719
|
s.datasets.forEach((W, B) => {
|
|
4717
4720
|
const $ = W.data[E] ?? 0;
|
|
4718
4721
|
if ($ === 0) return;
|
|
4719
|
-
const Y = $ / p * I, H = Math.min(s.barWidth * d + s.barGap, P - 8), K =
|
|
4722
|
+
const Y = $ / p * I, H = Math.min(s.barWidth * d + s.barGap, P - 8), K = R - H / 2, A = O;
|
|
4720
4723
|
O += Y;
|
|
4721
4724
|
const _ = s._resolveColor(W.color, B);
|
|
4722
4725
|
t.beginPath(), t.fillStyle = s._makeGradient(t, _, A, K, A + Y, K), s._drawRoundedBar(t, A, K, Y, H, B === d - 1 ? s.barCornerRadius : 0, !1), s.barStyle === "outline" || s.barStyle === "dashed" ? (t.fillStyle = "transparent", t.strokeStyle = s.barBorderColor === "auto" ? _ : s.barBorderColor, t.lineWidth = s.barBorderWidth, s.barStyle === "dashed" && t.setLineDash([4, 4]), t.stroke(), t.setLineDash([])) : t.fill();
|
|
@@ -4725,13 +4728,13 @@ class ci {
|
|
|
4725
4728
|
} else {
|
|
4726
4729
|
const P = I / h;
|
|
4727
4730
|
for (let E = 0; E < h; E++) {
|
|
4728
|
-
const
|
|
4729
|
-
s.showXLabels && (t.font = s.axisLabelFontSize + "px Inter, sans-serif", t.textAlign = "center", t.textBaseline = "top", t.fillStyle =
|
|
4731
|
+
const R = C + E * P + P / 2;
|
|
4732
|
+
s.showXLabels && (t.font = s.axisLabelFontSize + "px Inter, sans-serif", t.textAlign = "center", t.textBaseline = "top", t.fillStyle = l.axisLabelColor, t.shadowColor = "transparent", t.fillText(s.categories[E] || "", R, w + M + 5), s.enableShadows && (t.shadowColor = s.shadowColor));
|
|
4730
4733
|
let O = w + M;
|
|
4731
4734
|
s.datasets.forEach((W, B) => {
|
|
4732
4735
|
const $ = W.data[E] ?? 0;
|
|
4733
4736
|
if ($ === 0) return;
|
|
4734
|
-
const Y = $ / p * M, H = Math.min(s.barWidth * d + s.barGap, P - 8), K =
|
|
4737
|
+
const Y = $ / p * M, H = Math.min(s.barWidth * d + s.barGap, P - 8), K = R - H / 2, A = O - Y;
|
|
4735
4738
|
O -= Y;
|
|
4736
4739
|
const _ = s._resolveColor(W.color, B);
|
|
4737
4740
|
t.beginPath(), t.fillStyle = s._makeGradient(t, _, K, A, K, A + Y), s._drawRoundedBar(t, K, A, H, Y, B === d - 1 ? s.barCornerRadius : 0, !0), s.barStyle === "outline" || s.barStyle === "dashed" ? (t.fillStyle = "transparent", t.strokeStyle = s.barBorderColor === "auto" ? _ : s.barBorderColor, t.lineWidth = s.barBorderWidth, s.barStyle === "dashed" && t.setLineDash([4, 4]), t.stroke(), t.setLineDash([])) : t.fill();
|
|
@@ -4739,28 +4742,28 @@ class ci {
|
|
|
4739
4742
|
}
|
|
4740
4743
|
}
|
|
4741
4744
|
else if (s.orientation === "horizontal") {
|
|
4742
|
-
const P = M / h, E = d * s.barWidth + Math.max(0, (d - 1) * s.barGap),
|
|
4745
|
+
const P = M / h, E = d * s.barWidth + Math.max(0, (d - 1) * s.barGap), R = C + (0 - u) / p * I;
|
|
4743
4746
|
for (let O = 0; O < h; O++) {
|
|
4744
4747
|
const W = w + O * P + P / 2;
|
|
4745
|
-
s.showXLabels && (t.font = s.axisLabelFontSize + "px Inter, sans-serif", t.textAlign = "right", t.textBaseline = "middle", t.fillStyle =
|
|
4748
|
+
s.showXLabels && (t.font = s.axisLabelFontSize + "px Inter, sans-serif", t.textAlign = "right", t.textBaseline = "middle", t.fillStyle = l.axisLabelColor, t.shadowColor = "transparent", t.fillText(s.categories[O] || "", C - 5, W), s.enableShadows && (t.shadowColor = s.shadowColor));
|
|
4746
4749
|
const B = W - E / 2;
|
|
4747
4750
|
s.datasets.forEach(($, Y) => {
|
|
4748
4751
|
const H = $.data[O] ?? 0, K = Math.abs(H / p * I);
|
|
4749
4752
|
if (K < 1) return;
|
|
4750
|
-
const A = B + Y * (s.barWidth + s.barGap), _ = H >= 0 ?
|
|
4753
|
+
const A = B + Y * (s.barWidth + s.barGap), _ = H >= 0 ? R : R - K, L = s._resolveColor($.color, Y);
|
|
4751
4754
|
t.beginPath(), t.fillStyle = s._makeGradient(t, L, _, A, _ + K, A), s._drawRoundedBar(t, _, A, K, s.barWidth, s.barCornerRadius, !1), s.barStyle === "outline" || s.barStyle === "dashed" ? (t.fillStyle = "transparent", t.strokeStyle = s.barBorderColor === "auto" ? L : s.barBorderColor, t.lineWidth = s.barBorderWidth, s.barStyle === "dashed" && t.setLineDash([4, 4]), t.stroke(), t.setLineDash([])) : t.fill(), s.showValueOnTop && H !== 0 && (t.font = (s.valueFontWeight || "bold") + " " + (s.valueFontSize || 10) + "px Inter, sans-serif", t.textAlign = H >= 0 ? "left" : "right", t.textBaseline = "middle", t.fillStyle = s.valueColor === "auto" ? L : s.valueColor || "#fff", t.shadowColor = "transparent", t.fillText(H.toString(), H >= 0 ? _ + K + 4 : _ - 4, A + s.barWidth / 2), s.enableShadows && (t.shadowColor = s.shadowColor));
|
|
4752
4755
|
});
|
|
4753
4756
|
}
|
|
4754
4757
|
} else {
|
|
4755
|
-
const P = I / h, E = d * s.barWidth + Math.max(0, (d - 1) * s.barGap),
|
|
4758
|
+
const P = I / h, E = d * s.barWidth + Math.max(0, (d - 1) * s.barGap), R = w + M - (0 - u) / p * M;
|
|
4756
4759
|
for (let O = 0; O < h; O++) {
|
|
4757
4760
|
const W = C + O * P + P / 2;
|
|
4758
|
-
s.showXLabels && (t.font = s.axisLabelFontSize + "px Inter, sans-serif", t.textAlign = "center", t.textBaseline = "top", t.fillStyle =
|
|
4761
|
+
s.showXLabels && (t.font = s.axisLabelFontSize + "px Inter, sans-serif", t.textAlign = "center", t.textBaseline = "top", t.fillStyle = l.axisLabelColor, t.shadowColor = "transparent", t.fillText(s.categories[O] || "", W, w + M + 5), s.enableShadows && (t.shadowColor = s.shadowColor));
|
|
4759
4762
|
const B = W - E / 2;
|
|
4760
4763
|
s.datasets.forEach(($, Y) => {
|
|
4761
4764
|
const H = $.data[O] ?? 0, K = Math.abs(H / p * M);
|
|
4762
4765
|
if (K < 1) return;
|
|
4763
|
-
const A = B + Y * (s.barWidth + s.barGap), _ = H >= 0 ?
|
|
4766
|
+
const A = B + Y * (s.barWidth + s.barGap), _ = H >= 0 ? R - K : R, L = s._resolveColor($.color, Y);
|
|
4764
4767
|
t.beginPath(), t.fillStyle = s._makeGradient(t, L, A, _, A, _ + K), s._drawRoundedBar(t, A, _, s.barWidth, K, s.barCornerRadius, !0), s.barStyle === "outline" || s.barStyle === "dashed" ? (t.fillStyle = "transparent", t.strokeStyle = s.barBorderColor === "auto" ? L : s.barBorderColor, t.lineWidth = s.barBorderWidth, s.barStyle === "dashed" && t.setLineDash([4, 4]), t.stroke(), t.setLineDash([])) : t.fill(), s.showValueOnTop && H !== 0 && (t.font = (s.valueFontWeight || "bold") + " " + (s.valueFontSize || 10) + "px Inter, sans-serif", t.textAlign = "center", t.textBaseline = H >= 0 ? "bottom" : "top", t.fillStyle = s.valueColor === "auto" ? L : s.valueColor || "#fff", t.shadowColor = "transparent", t.fillText(H.toString(), A + s.barWidth / 2, H >= 0 ? _ - 4 : _ + K + 4), s.enableShadows && (t.shadowColor = s.shadowColor));
|
|
4765
4768
|
});
|
|
4766
4769
|
}
|
|
@@ -4804,18 +4807,18 @@ class ci {
|
|
|
4804
4807
|
t.save(), t.fillStyle = "rgba(99,102,241,0.8)", t.font = "bold 11px Inter, sans-serif", t.textAlign = "center", t.textBaseline = "middle", t.fillText("EMPTY DATA", 0, 0), t.restore();
|
|
4805
4808
|
return;
|
|
4806
4809
|
}
|
|
4807
|
-
const
|
|
4808
|
-
t.save(), t.beginPath(), t.roundRect(-n / 2, -a / 2, n, a, 10), t.fillStyle =
|
|
4809
|
-
const
|
|
4810
|
+
const c = s._getPreset();
|
|
4811
|
+
t.save(), t.beginPath(), t.roundRect(-n / 2, -a / 2, n, a, 10), t.fillStyle = c.cardBackground, t.fill(), t.strokeStyle = c.cardBorderColor, t.lineWidth = 1, t.stroke();
|
|
4812
|
+
const l = s.showLegend ? Math.ceil(s.slices.length / 2) : 0, f = l > 0 ? l * (s.legendFontSize + 8) + 10 : 0, u = a - f - 16, h = Math.min(n - 24, u) / 2, d = 0, p = -f / 2;
|
|
4810
4813
|
if (s.chartType === "rose") {
|
|
4811
4814
|
const b = Math.max(...s.slices.map((C) => C.value || 0)), v = Math.PI * 2 / s.slices.length, S = h > 0 ? s.sliceGap / h : 0;
|
|
4812
4815
|
s.slices.forEach((C, w) => {
|
|
4813
4816
|
const I = C.value || 0;
|
|
4814
4817
|
if (I === 0) return;
|
|
4815
|
-
const M = I / b * h, k = -Math.PI / 2 + w * v + S / 2, T = k + v - S,
|
|
4816
|
-
if (t.beginPath(), t.moveTo(d, p), t.arc(d, p, M, k, T), t.closePath(), t.fillStyle =
|
|
4817
|
-
const P = k + (T - k) / 2, E = d + M * 0.65 * Math.cos(P),
|
|
4818
|
-
t.save(), t.font = `bold ${s.labelFontSize}px Inter, sans-serif`, t.fillStyle =
|
|
4818
|
+
const M = I / b * h, k = -Math.PI / 2 + w * v + S / 2, T = k + v - S, x = s._resolveSliceColor(C, w);
|
|
4819
|
+
if (t.beginPath(), t.moveTo(d, p), t.arc(d, p, M, k, T), t.closePath(), t.fillStyle = x + "cc", t.fill(), t.strokeStyle = x, t.lineWidth = 1.5, t.stroke(), s.showLabels) {
|
|
4820
|
+
const P = k + (T - k) / 2, E = d + M * 0.65 * Math.cos(P), R = p + M * 0.65 * Math.sin(P), O = Math.round(I / r * 100);
|
|
4821
|
+
t.save(), t.font = `bold ${s.labelFontSize}px Inter, sans-serif`, t.fillStyle = c.labelColor, t.textAlign = "center", t.textBaseline = "middle", t.fillText(`${O}%`, E, R), t.restore();
|
|
4819
4822
|
}
|
|
4820
4823
|
});
|
|
4821
4824
|
} else {
|
|
@@ -4827,33 +4830,33 @@ class ci {
|
|
|
4827
4830
|
C += M / r * Math.PI * 2;
|
|
4828
4831
|
return;
|
|
4829
4832
|
}
|
|
4830
|
-
const k = M / r * Math.PI * 2, T = C + S / 2,
|
|
4831
|
-
if (
|
|
4833
|
+
const k = M / r * Math.PI * 2, T = C + S / 2, x = C + k - S / 2;
|
|
4834
|
+
if (x <= T) {
|
|
4832
4835
|
C += k;
|
|
4833
4836
|
return;
|
|
4834
4837
|
}
|
|
4835
4838
|
const P = s._resolveSliceColor(w, I);
|
|
4836
|
-
if (t.beginPath(), t.fillStyle = P, v <= 0 ? (t.moveTo(d, p), t.arc(d, p, h, T,
|
|
4837
|
-
const E = T + (
|
|
4838
|
-
t.save(), t.font = `bold ${s.labelFontSize}px Inter, sans-serif`, t.fillStyle =
|
|
4839
|
+
if (t.beginPath(), t.fillStyle = P, v <= 0 ? (t.moveTo(d, p), t.arc(d, p, h, T, x), t.lineTo(d, p)) : (t.moveTo(d + h * Math.cos(T), p + h * Math.sin(T)), t.arc(d, p, h, T, x), t.arc(d, p, v, x, T, !0), t.closePath()), t.fill(), s.showLabels) {
|
|
4840
|
+
const E = T + (x - T) / 2, R = v + (h - v) / 2, O = d + R * Math.cos(E), W = p + R * Math.sin(E), B = Math.round(M / r * 100);
|
|
4841
|
+
t.save(), t.font = `bold ${s.labelFontSize}px Inter, sans-serif`, t.fillStyle = c.labelColor, t.textAlign = "center", t.textBaseline = "middle", t.fillText(`${B}%`, O, W), t.restore();
|
|
4839
4842
|
}
|
|
4840
4843
|
C += k;
|
|
4841
4844
|
}), s.chartType === "donut" && s.showCenterText && v > 14) {
|
|
4842
4845
|
const w = Math.round(r), I = Math.min(Math.floor(v * 0.52), 20), M = Math.min(Math.floor(v * 0.26), 10);
|
|
4843
|
-
t.textAlign = "center", t.textBaseline = "middle", t.font = `bold ${I}px Inter, sans-serif`, t.fillStyle =
|
|
4846
|
+
t.textAlign = "center", t.textBaseline = "middle", t.font = `bold ${I}px Inter, sans-serif`, t.fillStyle = c.centerTextColor, t.fillText(w.toString(), d, p - M * 0.5), s.centerLabel && (t.font = `${M}px Inter, sans-serif`, t.fillStyle = c.centerLabelColor, t.fillText(s.centerLabel, d, p + I * 0.6));
|
|
4844
4847
|
}
|
|
4845
4848
|
}
|
|
4846
4849
|
if (s.showLegend && s.slices.length > 0) {
|
|
4847
4850
|
t.font = `${s.legendFontSize}px Inter, sans-serif`;
|
|
4848
4851
|
const b = 2, v = n / b, S = s.legendFontSize + 8, C = a / 2 - f + 10, w = -n / 2 + 10;
|
|
4849
4852
|
s.slices.forEach((I, M) => {
|
|
4850
|
-
const k = M % b, T = Math.floor(M / b),
|
|
4851
|
-
t.beginPath(), t.roundRect(
|
|
4852
|
-
const O = Math.round((I.value || 0) / r * 100), W = `${I.label || "Item"} ${O}%`, B = v -
|
|
4853
|
+
const k = M % b, T = Math.floor(M / b), x = w + k * v, P = C + T * S, E = s._resolveSliceColor(I, M), R = 7;
|
|
4854
|
+
t.beginPath(), t.roundRect(x, P - R / 2, R, R, 2), t.fillStyle = E, t.fill(), t.textAlign = "left", t.textBaseline = "middle", t.fillStyle = c.legendColor;
|
|
4855
|
+
const O = Math.round((I.value || 0) / r * 100), W = `${I.label || "Item"} ${O}%`, B = v - R - 20;
|
|
4853
4856
|
let $ = W;
|
|
4854
4857
|
for (; t.measureText($).width > B && $.length > 4; )
|
|
4855
4858
|
$ = $.slice(0, -4) + "…";
|
|
4856
|
-
t.fillText($,
|
|
4859
|
+
t.fillText($, x + R + 4, P);
|
|
4857
4860
|
});
|
|
4858
4861
|
}
|
|
4859
4862
|
t.restore();
|
|
@@ -4861,33 +4864,33 @@ class ci {
|
|
|
4861
4864
|
renderJoystick(t, i) {
|
|
4862
4865
|
var p, y, m, b, v;
|
|
4863
4866
|
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.width) !== void 0 ? o.width : ((p = i.geometry) == null ? void 0 : p.width) ?? i.width ?? 100, s = (o == null ? void 0 : o.height) !== void 0 ? o.height : ((y = i.geometry) == null ? void 0 : y.height) ?? i.height ?? 100, n = Math.min(e, s) * 0.45, a = Math.min(e, s) * 0.15;
|
|
4864
|
-
let r = i.handleX || 0,
|
|
4865
|
-
o && o.handleX !== void 0 && (r = o.handleX), o && o.handleY !== void 0 && (
|
|
4866
|
-
let
|
|
4867
|
-
i.handleOrigin === "top-left" ? (
|
|
4867
|
+
let r = i.handleX || 0, c = i.handleY || 0;
|
|
4868
|
+
o && o.handleX !== void 0 && (r = o.handleX), o && o.handleY !== void 0 && (c = o.handleY), t.save();
|
|
4869
|
+
let l = 0, f = 0;
|
|
4870
|
+
i.handleOrigin === "top-left" ? (l = e / 2, f = s / 2) : i.handleOrigin === "bottom-right" && (l = -e / 2, f = -s / 2), t.translate(l, f), t.beginPath(), i.boundsShape === "square" ? t.rect(-n, -n, n * 2, n * 2) : t.arc(0, 0, n, 0, Math.PI * 2), t.fillStyle = "rgba(0,0,0,0.2)", (m = i.style) != null && m.fill && typeof i.style.fill == "string" ? t.fillStyle = i.style.fill : (b = i.style) != null && b.fill && i.style.fill.type === "solid" && (t.fillStyle = i.style.fill.color), t.fill(), (v = i.style) != null && v.stroke && i.style.stroke.isEnabled !== !1 && (t.lineWidth = i.style.stroke.width || 1, t.strokeStyle = i.style.stroke.color || "#000", t.stroke());
|
|
4868
4871
|
const u = n - a;
|
|
4869
4872
|
let h = 0, d = 0;
|
|
4870
|
-
i.joystickType === "2D" ? (h = r * u, d =
|
|
4873
|
+
i.joystickType === "2D" ? (h = r * u, d = c * u) : i.joystickType === "1D_X" ? (h = r * u, d = 0) : i.joystickType === "1D_Y" && (h = 0, d = c * u), t.beginPath(), t.arc(h, d, a, 0, Math.PI * 2), t.fillStyle = "#fff", t.fill(), t.strokeStyle = "rgba(0,0,0,0.5)", t.lineWidth = 1, t.stroke(), t.restore();
|
|
4871
4874
|
}
|
|
4872
4875
|
getRadioGroupItemIndexAtPointer(t, i, o) {
|
|
4873
4876
|
var M, k;
|
|
4874
4877
|
const e = t.options || {}, s = this.objectStates.get(t.id) || {}, n = e.optionsList || [];
|
|
4875
4878
|
if (n.length === 0) return null;
|
|
4876
|
-
const a = s.width !== void 0 ? s.width : ((M = t.geometry) == null ? void 0 : M.width) || 180, r = s.height !== void 0 ? s.height : ((k = t.geometry) == null ? void 0 : k.height) || 100,
|
|
4877
|
-
if (
|
|
4878
|
-
const T = Math.max(C, f) +
|
|
4879
|
-
for (let
|
|
4880
|
-
const P = I +
|
|
4879
|
+
const a = s.width !== void 0 ? s.width : ((M = t.geometry) == null ? void 0 : M.width) || 180, r = s.height !== void 0 ? s.height : ((k = t.geometry) == null ? void 0 : k.height) || 100, c = e.orientation || "vertical", l = e.itemGap !== void 0 ? e.itemGap : 16, f = e.fontSize || 14, u = this.getWorldTransform(t.id), h = i - u.x, d = o - u.y, p = -u.rotation * (Math.PI / 180), y = Math.cos(p), m = Math.sin(p), b = h * y - d * m, v = h * m + d * y, C = 8 * 2, w = -a / 2, I = -r / 2;
|
|
4880
|
+
if (c === "vertical") {
|
|
4881
|
+
const T = Math.max(C, f) + l;
|
|
4882
|
+
for (let x = 0; x < n.length; x++) {
|
|
4883
|
+
const P = I + x * T;
|
|
4881
4884
|
if (b >= w && b <= w + a && v >= P && v <= P + T)
|
|
4882
|
-
return
|
|
4885
|
+
return x;
|
|
4883
4886
|
}
|
|
4884
4887
|
} else {
|
|
4885
4888
|
let T = w;
|
|
4886
|
-
for (let
|
|
4887
|
-
const E = n[
|
|
4888
|
-
if (b >= T && b <= T +
|
|
4889
|
-
return
|
|
4890
|
-
T +=
|
|
4889
|
+
for (let x = 0; x < n.length; x++) {
|
|
4890
|
+
const E = n[x].length * 8, R = C + 6 + E + l;
|
|
4891
|
+
if (b >= T && b <= T + R && v >= I && v <= I + r)
|
|
4892
|
+
return x;
|
|
4893
|
+
T += R;
|
|
4891
4894
|
}
|
|
4892
4895
|
}
|
|
4893
4896
|
return null;
|
|
@@ -4929,10 +4932,10 @@ class ci {
|
|
|
4929
4932
|
}
|
|
4930
4933
|
p._resolvedData = y;
|
|
4931
4934
|
}), r < 2) return;
|
|
4932
|
-
const
|
|
4933
|
-
const y =
|
|
4935
|
+
const c = a - n, l = o / (r - 1), f = (p) => {
|
|
4936
|
+
const y = c === 0 ? 0.5 : (p - n) / c;
|
|
4934
4937
|
return e / 2 - y * e;
|
|
4935
|
-
}, u = (p) => p *
|
|
4938
|
+
}, u = (p) => p * l - o / 2, h = i.axisColor || "#333333";
|
|
4936
4939
|
if (i.showXAxis && (t.beginPath(), t.strokeStyle = i.xAxisColor || h, t.lineWidth = 1, t.moveTo(-o / 2, e / 2), t.lineTo(o / 2, e / 2), t.stroke()), i.showYAxis && (t.beginPath(), t.strokeStyle = i.yAxisColor || h, t.lineWidth = 1, t.moveTo(-o / 2, -e / 2), t.lineTo(-o / 2, e / 2), t.stroke()), t.fillStyle = i.axisLabelColor || "#333333", t.font = `${i.axisLabelFontSize || 10}px Inter, sans-serif`, i.showXLabels) {
|
|
4937
4940
|
t.textAlign = "center", t.textBaseline = "top";
|
|
4938
4941
|
for (let p = 0; p < r; p++) {
|
|
@@ -4992,8 +4995,8 @@ class ci {
|
|
|
4992
4995
|
}
|
|
4993
4996
|
}
|
|
4994
4997
|
_catmullRom(t, i, o, e, s) {
|
|
4995
|
-
const n = (o - t) * 0.5, a = (e - i) * 0.5, r = s * s,
|
|
4996
|
-
return (2 * i - 2 * o + n + a) *
|
|
4998
|
+
const n = (o - t) * 0.5, a = (e - i) * 0.5, r = s * s, c = s * r;
|
|
4999
|
+
return (2 * i - 2 * o + n + a) * c + (-3 * i + 3 * o - 2 * n - a) * r + n * s + i;
|
|
4997
5000
|
}
|
|
4998
5001
|
normalizeOpacity(t) {
|
|
4999
5002
|
const i = typeof t == "number" ? t : parseFloat(String(t));
|
|
@@ -5004,19 +5007,19 @@ class ci {
|
|
|
5004
5007
|
if (!i || i.type === "None") return null;
|
|
5005
5008
|
if (typeof i == "string") return i;
|
|
5006
5009
|
if (i.type === "Solid" && i.color) {
|
|
5007
|
-
const r = i.color,
|
|
5008
|
-
return t.fillStyle =
|
|
5010
|
+
const r = i.color, l = (((n = (s = this.artboard) == null ? void 0 : s.tokens) == null ? void 0 : n.colors) || {})[r] || r;
|
|
5011
|
+
return t.fillStyle = l, l;
|
|
5009
5012
|
}
|
|
5010
5013
|
if ((i.type === "LinearGradient" || i.type === "RadialGradient" || i.type === "AngularGradient" || i.type === "DiamondGradient") && i.stops) {
|
|
5011
|
-
const r = (
|
|
5014
|
+
const r = (c, l = 100) => {
|
|
5012
5015
|
var S, C;
|
|
5013
|
-
const u = (((C = (S = this.artboard) == null ? void 0 : S.tokens) == null ? void 0 : C.colors) || {})[
|
|
5016
|
+
const u = (((C = (S = this.artboard) == null ? void 0 : S.tokens) == null ? void 0 : C.colors) || {})[c] || c, h = this.normalizeOpacity(i.opacity ?? 100), p = this.normalizeOpacity(l) * h;
|
|
5014
5017
|
if (p >= 1 && u.startsWith("#")) return u;
|
|
5015
5018
|
const y = u.startsWith("#") ? u.replace("#", "") : "ffffff", m = parseInt(y.substring(0, 2), 16), b = parseInt(y.substring(2, 4), 16), v = parseInt(y.substring(4, 6), 16);
|
|
5016
5019
|
return `rgba(${m}, ${b}, ${v}, ${p})`;
|
|
5017
5020
|
};
|
|
5018
5021
|
if (i.type === "LinearGradient") {
|
|
5019
|
-
const
|
|
5022
|
+
const c = (p, y, m) => Array.isArray(p) ? p[y] ?? (y === 0 ? 0 : 1) : p && typeof p == "object" ? p[m] ?? (y === 0 ? 0 : 1) : y === 0 ? 0 : 1, l = c(i.start, 0, "x") * o - o / 2, f = c(i.start, 1, "y") * e - e / 2, u = c(i.end, 0, "x") * o - o / 2, h = c(i.end, 1, "y") * e - e / 2, d = t.createLinearGradient(l, f, u, h);
|
|
5020
5023
|
if (i.stops.forEach((p) => {
|
|
5021
5024
|
const y = p.offset !== void 0 ? p.offset : p.pos !== void 0 ? p.pos : p.position !== void 0 ? p.position : 0, m = r(p.color || "#000000", p.opacity ?? 100);
|
|
5022
5025
|
d.addColorStop(Math.max(0, Math.min(1, y)), m);
|
|
@@ -5026,7 +5029,7 @@ class ci {
|
|
|
5026
5029
|
}
|
|
5027
5030
|
return d;
|
|
5028
5031
|
} else if (i.type === "RadialGradient") {
|
|
5029
|
-
const
|
|
5032
|
+
const c = (d, p, y) => Array.isArray(d) ? d[p] ?? 0.5 : d && typeof d == "object" ? d[y] ?? 0.5 : 0.5, l = c(i.center, 0, "x") * o - o / 2, f = c(i.center, 1, "y") * e - e / 2, u = (i.radius ?? 0.5) * Math.max(o, e), h = t.createRadialGradient(l, f, 0, l, f, u);
|
|
5030
5033
|
if (i.stops.forEach((d) => {
|
|
5031
5034
|
const p = d.offset !== void 0 ? d.offset : d.pos !== void 0 ? d.pos : d.position !== void 0 ? d.position : 0, y = r(d.color || "#000000", d.opacity ?? 100);
|
|
5032
5035
|
h.addColorStop(Math.max(0, Math.min(1, p)), y);
|
|
@@ -5036,7 +5039,7 @@ class ci {
|
|
|
5036
5039
|
}
|
|
5037
5040
|
return h;
|
|
5038
5041
|
} else if (i.type === "AngularGradient") {
|
|
5039
|
-
const
|
|
5042
|
+
const c = (d, p, y) => Array.isArray(d) ? d[p] ?? 0.5 : d && typeof d == "object" ? d[y] ?? 0.5 : 0.5, l = c(i.center || [0.5, 0.5], 0, "x") * o - o / 2, f = c(i.center || [0.5, 0.5], 1, "y") * e - e / 2, u = (i.degree || i.angle || 0) * (Math.PI / 180), h = (a = t.createConicGradient) == null ? void 0 : a.call(t, u, l, f);
|
|
5040
5043
|
if (h) {
|
|
5041
5044
|
if (i.stops.forEach((d) => {
|
|
5042
5045
|
const p = d.offset !== void 0 ? d.offset : d.pos !== void 0 ? d.pos : d.position !== void 0 ? d.position : 0, y = r(d.color || "#000000", d.opacity ?? 100);
|
|
@@ -5048,8 +5051,8 @@ class ci {
|
|
|
5048
5051
|
return h;
|
|
5049
5052
|
}
|
|
5050
5053
|
} else if (i.type === "DiamondGradient") {
|
|
5051
|
-
const
|
|
5052
|
-
t.save(), t.translate(
|
|
5054
|
+
const c = (d, p, y) => Array.isArray(d) ? d[p] ?? 0.5 : d && typeof d == "object" ? d[y] ?? 0.5 : 0.5, l = c(i.center || [0.5, 0.5], 0, "x") * o - o / 2, f = c(i.center || [0.5, 0.5], 1, "y") * e - e / 2, u = (i.radius ?? 0.5) * Math.max(o, e);
|
|
5055
|
+
t.save(), t.translate(l, f), t.rotate(Math.PI / 4);
|
|
5053
5056
|
const h = t.createRadialGradient(0, 0, 0, 0, 0, u);
|
|
5054
5057
|
if (i.stops.forEach((d) => {
|
|
5055
5058
|
const p = d.offset !== void 0 ? d.offset : d.pos !== void 0 ? d.pos : d.position !== void 0 ? d.position : 0, y = r(d.color || "#000000", d.opacity ?? 100);
|
|
@@ -5064,12 +5067,12 @@ class ci {
|
|
|
5064
5067
|
if (i.type === "Pattern" && i.url) {
|
|
5065
5068
|
let r = this.imageCache.get(i.url);
|
|
5066
5069
|
if (r || (r = new Image(), r.src = i.url, this.imageCache.set(i.url, r)), r.complete && r.naturalWidth > 0) {
|
|
5067
|
-
const
|
|
5068
|
-
if (
|
|
5069
|
-
const
|
|
5070
|
-
|
|
5070
|
+
const c = t.createPattern(r, "repeat");
|
|
5071
|
+
if (c && (i.scaleX !== void 0 || i.offsetX !== void 0)) {
|
|
5072
|
+
const l = new DOMMatrix(), f = i.scaleX ?? 1, u = i.scaleY ?? 1, h = i.offsetX ?? 0, d = i.offsetY ?? 0, p = i.rotation ?? 0;
|
|
5073
|
+
l.translateSelf(h, d), l.rotateSelf(p), l.scaleSelf(f, u), c.setTransform(l);
|
|
5071
5074
|
}
|
|
5072
|
-
return
|
|
5075
|
+
return c;
|
|
5073
5076
|
}
|
|
5074
5077
|
}
|
|
5075
5078
|
return i.color || null;
|
|
@@ -5086,45 +5089,45 @@ class ci {
|
|
|
5086
5089
|
} catch {
|
|
5087
5090
|
a = parseFloat(a) || 0;
|
|
5088
5091
|
}
|
|
5089
|
-
let r = 0,
|
|
5090
|
-
typeof a == "number" ? r =
|
|
5092
|
+
let r = 0, c = 0, l = 0, f = 0;
|
|
5093
|
+
typeof a == "number" ? r = c = l = f = a : Array.isArray(a) ? a.length === 1 ? r = c = l = f = a[0] : a.length === 2 ? (r = l = a[0], c = f = a[1]) : a.length === 3 ? (r = a[0], c = f = a[1], l = a[2]) : a.length >= 4 && (r = a[0], c = a[1], l = a[2], f = a[3]) : a && typeof a == "object" && (r = a.tl ?? a.corner_radius ?? a.cornerRadius ?? 0, c = a.tr ?? a.corner_radius ?? a.cornerRadius ?? 0, l = a.br ?? a.corner_radius ?? a.cornerRadius ?? 0, f = a.bl ?? a.corner_radius ?? a.cornerRadius ?? 0);
|
|
5091
5094
|
const u = Math.min(Math.abs(e) / 2, Math.abs(s) / 2);
|
|
5092
|
-
if (r = Math.min(Math.max(0, r), u),
|
|
5093
|
-
t.roundRect(i, o, e, s, [r,
|
|
5095
|
+
if (r = Math.min(Math.max(0, r), u), c = Math.min(Math.max(0, c), u), l = Math.min(Math.max(0, l), u), f = Math.min(Math.max(0, f), u), t.roundRect) {
|
|
5096
|
+
t.roundRect(i, o, e, s, [r, c, l, f]);
|
|
5094
5097
|
return;
|
|
5095
5098
|
}
|
|
5096
|
-
t.moveTo(i + r, o), t.lineTo(i + e -
|
|
5099
|
+
t.moveTo(i + r, o), t.lineTo(i + e - c, o), t.arcTo(i + e, o, i + e, o + c, c), t.lineTo(i + e, o + s - l), t.arcTo(i + e, o + s, i + e - l, o + s, l), t.lineTo(i + f, o + s), t.arcTo(i, o + s, i, o + s - f, f), t.lineTo(i, o + r), t.arcTo(i, o, i + r, o, r), t.closePath();
|
|
5097
5100
|
}
|
|
5098
5101
|
renderListView(t, i) {
|
|
5099
5102
|
var O, W, B, $;
|
|
5100
|
-
const o = this.objectStates.get(i.id) || {}, e = o.options || i.options || {}, s = o.width !== void 0 ? o.width : ((O = i.geometry) == null ? void 0 : O.width) || 200, n = o.height !== void 0 ? o.height : ((W = i.geometry) == null ? void 0 : W.height) || 300, a = -s / 2, r = -n / 2,
|
|
5103
|
+
const o = this.objectStates.get(i.id) || {}, e = o.options || i.options || {}, s = o.width !== void 0 ? o.width : ((O = i.geometry) == null ? void 0 : O.width) || 200, n = o.height !== void 0 ? o.height : ((W = i.geometry) == null ? void 0 : W.height) || 300, a = -s / 2, r = -n / 2, c = o.corner_radius !== void 0 ? o.corner_radius : e.corner_radius ?? 0, l = e.orientation || "vertical", f = e.items || [], u = e.itemGap ?? 10, h = e.itemHeight ?? 50, d = e.itemWidth ?? 200, p = e.scrollOffset ?? 0, y = e.padding ?? 0, m = e.glassEffect !== !1, b = e.accentColor || "#3b82f6", v = e.itemTextColor || "#333333", S = e.itemBackgroundColor || "#ffffff", C = e.hoveredIndex ?? null, w = e.activeItemIndex ?? null, I = e.glowIntensity ?? 0, M = e.glowColor || "#3b82f6", k = typeof M == "string" ? M : M.color || (($ = (B = M.stops) == null ? void 0 : B[0]) == null ? void 0 : $.color) || "#3b82f6", T = e.opacity !== void 0 ? e.opacity : i.opacity !== void 0 ? i.opacity : 1;
|
|
5101
5104
|
if (t.save(), t.globalAlpha *= T, I > 0) {
|
|
5102
5105
|
const Y = t.getTransform(), H = Math.sqrt(Y.a * Y.a + Y.b * Y.b) || 1;
|
|
5103
5106
|
t.shadowColor = k, t.shadowBlur = I * 2 * H, t.shadowOffsetX = 0, t.shadowOffsetY = 0;
|
|
5104
5107
|
}
|
|
5105
5108
|
if (m) {
|
|
5106
5109
|
const Y = e.listBackgroundColor || "rgba(31, 41, 55, 0.4)", H = this.createCanvasFill(t, Y, s, n);
|
|
5107
|
-
t.fillStyle = H || "rgba(31, 41, 55, 0.4)", t.beginPath(), this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n,
|
|
5110
|
+
t.fillStyle = H || "rgba(31, 41, 55, 0.4)", t.beginPath(), this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n, c) || t.fill();
|
|
5108
5111
|
const A = t.createLinearGradient(a, r, a + s, r + n);
|
|
5109
|
-
A.addColorStop(0, "rgba(255, 255, 255, 0.15)"), A.addColorStop(0.5, "rgba(255, 255, 255, 0.08)"), A.addColorStop(1, "rgba(255, 255, 255, 0.03)"), t.fillStyle = A, t.beginPath(), this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n,
|
|
5112
|
+
A.addColorStop(0, "rgba(255, 255, 255, 0.15)"), A.addColorStop(0.5, "rgba(255, 255, 255, 0.08)"), A.addColorStop(1, "rgba(255, 255, 255, 0.03)"), t.fillStyle = A, t.beginPath(), this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n, c) || t.fill(), t.strokeStyle = "rgba(255, 255, 255, 0.25)", t.lineWidth = 1, t.beginPath(), this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n, c) || t.stroke();
|
|
5110
5113
|
} else {
|
|
5111
5114
|
const Y = e.backgroundColor || e.listBackgroundColor || "transparent", H = this.createCanvasFill(t, Y, s, n);
|
|
5112
5115
|
if (H) {
|
|
5113
5116
|
t.fillStyle = H, t.beginPath();
|
|
5114
|
-
const A = this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n,
|
|
5117
|
+
const A = this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n, c);
|
|
5115
5118
|
t.fill();
|
|
5116
5119
|
}
|
|
5117
5120
|
const K = e.borderWidth ?? 0;
|
|
5118
5121
|
if (K > 0) {
|
|
5119
5122
|
t.strokeStyle = e.borderColor || "#cccccc", t.lineWidth = K, t.beginPath();
|
|
5120
|
-
const A = this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n,
|
|
5123
|
+
const A = this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n, c);
|
|
5121
5124
|
t.stroke();
|
|
5122
5125
|
}
|
|
5123
5126
|
}
|
|
5124
5127
|
t.shadowBlur = 0, t.save(), t.beginPath();
|
|
5125
|
-
const
|
|
5128
|
+
const x = this.drawCustomShape(t, e.containerShape || "rectangle", e.containerPath || "", a, r, s, n, c);
|
|
5126
5129
|
if (e.listLayout !== "circular")
|
|
5127
|
-
if (
|
|
5130
|
+
if (x && e.containerShape === "custom")
|
|
5128
5131
|
try {
|
|
5129
5132
|
const Y = new Path2D(e.containerPath);
|
|
5130
5133
|
t.translate(a, r), t.scale(s / 100, n / 100), t.clip(Y), t.scale(100 / s, 100 / n), t.translate(-a, -r);
|
|
@@ -5132,55 +5135,55 @@ class ci {
|
|
|
5132
5135
|
}
|
|
5133
5136
|
else
|
|
5134
5137
|
t.clip();
|
|
5135
|
-
const P = typeof y == "number" ? y :
|
|
5136
|
-
let E = (
|
|
5138
|
+
const P = typeof y == "number" ? y : l === "vertical" ? y[0] : y[3];
|
|
5139
|
+
let E = (l === "vertical" ? r : a) + p + P;
|
|
5137
5140
|
if (t.textBaseline = "middle", f.forEach((Y, H) => {
|
|
5138
|
-
const K = e.listLayout || "linear", A = K === "circular" ? d :
|
|
5141
|
+
const K = e.listLayout || "linear", A = K === "circular" ? d : l === "vertical" ? s : d, _ = K === "circular" || l === "vertical" ? h : n;
|
|
5139
5142
|
let L = 0, X = 0, V = 0;
|
|
5140
5143
|
if (K === "circular") {
|
|
5141
|
-
const Tt = f.length || 1, zt = Math.PI * 2 / Tt, Z = e.circularStartAngle || 0, pt = e.circularRadius || 100, Et = p * 0.01 + Z * Math.PI / 180, ut = H * zt + Et, vt = a + s / 2,
|
|
5142
|
-
L = vt + Math.cos(ut) * pt - A / 2, X =
|
|
5144
|
+
const Tt = f.length || 1, zt = Math.PI * 2 / Tt, Z = e.circularStartAngle || 0, pt = e.circularRadius || 100, Et = p * 0.01 + Z * Math.PI / 180, ut = H * zt + Et, vt = a + s / 2, Rt = r + n / 2;
|
|
5145
|
+
L = vt + Math.cos(ut) * pt - A / 2, X = Rt + Math.sin(ut) * pt - _ / 2, V = ut + (e.itemRotation || 0) * Math.PI / 180;
|
|
5143
5146
|
} else
|
|
5144
|
-
L =
|
|
5145
|
-
const it = C === H,
|
|
5146
|
-
if (t.save(), V !== 0 && (t.translate(L + A / 2, X + _ / 2), t.rotate(V), t.translate(-(L + A / 2), -(X + _ / 2))),
|
|
5147
|
+
L = l === "vertical" ? a : E, X = l === "vertical" ? E : r, V = (e.itemRotation || 0) * Math.PI / 180;
|
|
5148
|
+
const it = C === H, lt = w === H, nt = lt && e.activeItemShape ? e.activeItemShape : e.itemShape || "rectangle", bt = lt && e.activeItemShape ? e.activeItemPath : e.itemPath || "", ht = e.itemCornerRadius || 0;
|
|
5149
|
+
if (t.save(), V !== 0 && (t.translate(L + A / 2, X + _ / 2), t.rotate(V), t.translate(-(L + A / 2), -(X + _ / 2))), lt) {
|
|
5147
5150
|
const Tt = this.createCanvasFill(t, b, A, _);
|
|
5148
5151
|
t.fillStyle = Tt || b;
|
|
5149
5152
|
const zt = t.globalAlpha;
|
|
5150
|
-
t.globalAlpha = zt * 0.8, t.beginPath(), this.drawCustomShape(t, nt,
|
|
5153
|
+
t.globalAlpha = zt * 0.8, t.beginPath(), this.drawCustomShape(t, nt, bt, L, X, A, _, ht) || (t.rect(L, X, A, _), t.fill()), t.globalAlpha = zt;
|
|
5151
5154
|
} else if (it)
|
|
5152
|
-
t.fillStyle = m ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.05)", t.beginPath(), this.drawCustomShape(t, nt,
|
|
5155
|
+
t.fillStyle = m ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.05)", t.beginPath(), this.drawCustomShape(t, nt, bt, L, X, A, _, ht) || (t.rect(L, X, A, _), t.fill());
|
|
5153
5156
|
else if (S !== "transparent") {
|
|
5154
5157
|
const Tt = this.createCanvasFill(t, S, A, _);
|
|
5155
|
-
t.fillStyle = Tt || S, t.beginPath(), this.drawCustomShape(t, nt,
|
|
5158
|
+
t.fillStyle = Tt || S, t.beginPath(), this.drawCustomShape(t, nt, bt, L, X, A, _, ht) || (t.rect(L, X, A, _), t.fill());
|
|
5156
5159
|
}
|
|
5157
|
-
if (
|
|
5158
|
-
const Tt = this.createCanvasFill(t, b,
|
|
5159
|
-
t.fillStyle = Tt || b,
|
|
5160
|
+
if (lt || it) {
|
|
5161
|
+
const Tt = this.createCanvasFill(t, b, l === "vertical" ? 3 : A, l === "vertical" ? _ : 3);
|
|
5162
|
+
t.fillStyle = Tt || b, l === "vertical" ? t.fillRect(L, X, 3, _) : t.fillRect(L, X + _ - 3, A, 3);
|
|
5160
5163
|
}
|
|
5161
|
-
const wt =
|
|
5162
|
-
t.fillStyle = wt, t.font =
|
|
5163
|
-
const Mt = typeof Y == "string" ? Y : (Y == null ? void 0 : Y.label) || `Item ${H + 1}`, It = L + (
|
|
5164
|
-
|
|
5164
|
+
const wt = lt ? "#ffffff" : m ? "rgba(255, 255, 255, 0.9)" : v;
|
|
5165
|
+
t.fillStyle = wt, t.font = lt || it ? "600 14px Inter, sans-serif" : "400 14px Inter, sans-serif";
|
|
5166
|
+
const Mt = typeof Y == "string" ? Y : (Y == null ? void 0 : Y.label) || `Item ${H + 1}`, It = L + (l === "vertical" ? 16 : A / 2), Ot = X + _ / 2;
|
|
5167
|
+
l === "horizontal" || K === "circular" ? t.textAlign = "center" : t.textAlign = "left";
|
|
5165
5168
|
const At = K === "circular" ? L + A / 2 : It;
|
|
5166
|
-
t.fillText(Mt, At, Ot), t.restore(), E += (
|
|
5169
|
+
t.fillText(Mt, At, Ot), t.restore(), E += (l === "vertical" ? h : d) + u;
|
|
5167
5170
|
}), t.restore(), e.showScrollbar !== !1) {
|
|
5168
|
-
const Y = (f.length || 0) * (
|
|
5171
|
+
const Y = (f.length || 0) * (l === "vertical" ? h : d) + ((f.length || 0) - 1) * u, H = l === "vertical" ? n : s, K = e.listLayout || "linear", A = e.containerShape === "circle" || K === "circular";
|
|
5169
5172
|
if (Y > H || K === "circular" && f.length > 0) {
|
|
5170
5173
|
const _ = e.scrollbarColor || "rgba(255,255,255,0.3)", L = e.scrollbarWidth || 4;
|
|
5171
5174
|
if (A) {
|
|
5172
5175
|
const X = Math.min(s, n) / 2 - L / 2 - 2, V = a + s / 2, it = r + n / 2;
|
|
5173
5176
|
if (t.strokeStyle = _, t.lineWidth = L, t.lineCap = "round", t.beginPath(), K === "circular") {
|
|
5174
|
-
const
|
|
5175
|
-
t.arc(V, it, X, nt, nt +
|
|
5177
|
+
const lt = Math.PI / 4, nt = -(p * 0.01) - Math.PI / 2;
|
|
5178
|
+
t.arc(V, it, X, nt, nt + lt);
|
|
5176
5179
|
} else {
|
|
5177
|
-
const
|
|
5178
|
-
t.arc(V, it, X, Mt, Mt +
|
|
5180
|
+
const lt = Math.PI / 2, nt = H / Y, bt = lt * nt, ht = -p / Y * lt, Mt = -Math.PI / 4 + ht;
|
|
5181
|
+
t.arc(V, it, X, Mt, Mt + bt);
|
|
5179
5182
|
}
|
|
5180
5183
|
t.stroke();
|
|
5181
5184
|
} else {
|
|
5182
5185
|
const X = H / Y, V = H * X, it = -p / Y * H;
|
|
5183
|
-
t.fillStyle = _,
|
|
5186
|
+
t.fillStyle = _, l === "vertical" ? t.fillRect(a + s - L - 2, r + it, L, V) : t.fillRect(a + it, r + n - L - 2, V, L);
|
|
5184
5187
|
}
|
|
5185
5188
|
}
|
|
5186
5189
|
}
|
|
@@ -5188,15 +5191,15 @@ class ci {
|
|
|
5188
5191
|
}
|
|
5189
5192
|
drawCustomShape(t, i, o, e, s, n, a, r) {
|
|
5190
5193
|
if (i === "circle") {
|
|
5191
|
-
const
|
|
5192
|
-
return t.arc(e + n / 2, s + a / 2,
|
|
5194
|
+
const c = Math.min(n, a) / 2;
|
|
5195
|
+
return t.arc(e + n / 2, s + a / 2, c, 0, Math.PI * 2), !1;
|
|
5193
5196
|
} else if (i === "pill") {
|
|
5194
|
-
const
|
|
5195
|
-
return this.drawListViewRect(t, e, s, n, a,
|
|
5197
|
+
const c = Math.min(n, a) / 2;
|
|
5198
|
+
return this.drawListViewRect(t, e, s, n, a, c), !1;
|
|
5196
5199
|
} else if (i === "custom" && o)
|
|
5197
5200
|
try {
|
|
5198
|
-
const
|
|
5199
|
-
return t.save(), t.translate(e, s), t.scale(n / 100, a / 100), t.fill(
|
|
5201
|
+
const c = new Path2D(o);
|
|
5202
|
+
return t.save(), t.translate(e, s), t.scale(n / 100, a / 100), t.fill(c), t.restore(), !0;
|
|
5200
5203
|
} catch {
|
|
5201
5204
|
return this.drawListViewRect(t, e, s, n, a, r), !1;
|
|
5202
5205
|
}
|
|
@@ -5207,10 +5210,10 @@ class ci {
|
|
|
5207
5210
|
if (!this._lastPointerPos || !this._prevPointerPos) return;
|
|
5208
5211
|
const i = t.options || {}, o = i.orientation || "vertical", e = this._lastPointerPos.x - this._prevPointerPos.x, s = this._lastPointerPos.y - this._prevPointerPos.y;
|
|
5209
5212
|
o === "vertical" ? i.scrollOffset = (i.scrollOffset || 0) + s : i.scrollOffset = (i.scrollOffset || 0) + e;
|
|
5210
|
-
const n = i.listLayout || "linear", a = this.objectStates.get(t.id) || {}, r = i.items || [],
|
|
5213
|
+
const n = i.listLayout || "linear", a = this.objectStates.get(t.id) || {}, r = i.items || [], c = i.itemGap ?? 10, l = i.itemHeight ?? 50, f = i.itemWidth ?? 200, u = a.width !== void 0 ? a.width : ((m = t.geometry) == null ? void 0 : m.width) || 200, h = a.height !== void 0 ? a.height : ((b = t.geometry) == null ? void 0 : b.height) || 300;
|
|
5211
5214
|
if (n === "circular")
|
|
5212
5215
|
return;
|
|
5213
|
-
const d = (r.length || 0) * (o === "vertical" ?
|
|
5216
|
+
const d = (r.length || 0) * (o === "vertical" ? l : f) + ((r.length || 0) - 1) * c, y = Math.max(0, d - (o === "vertical" ? h : u) + (i.padding * 2 || 0));
|
|
5214
5217
|
i.scrollOffset > 0 && (i.scrollOffset = 0), i.scrollOffset < -y && (i.scrollOffset = -y);
|
|
5215
5218
|
}
|
|
5216
5219
|
updateListViewHoverFromPointer(t, i, o) {
|
|
@@ -5221,24 +5224,24 @@ class ci {
|
|
|
5221
5224
|
var B, $;
|
|
5222
5225
|
const e = t.options || {}, s = this.objectStates.get(t.id) || {}, n = e.items || [];
|
|
5223
5226
|
if (n.length === 0) return null;
|
|
5224
|
-
const a = s.width !== void 0 ? s.width : ((B = t.geometry) == null ? void 0 : B.width) || 200, r = s.height !== void 0 ? s.height : (($ = t.geometry) == null ? void 0 : $.height) || 300,
|
|
5225
|
-
let T = (
|
|
5226
|
-
const
|
|
5227
|
+
const a = s.width !== void 0 ? s.width : ((B = t.geometry) == null ? void 0 : B.width) || 200, r = s.height !== void 0 ? s.height : (($ = t.geometry) == null ? void 0 : $.height) || 300, c = e.orientation || "vertical", l = e.itemGap ?? 10, f = e.itemHeight ?? 50, u = e.itemWidth ?? 200, h = e.scrollOffset ?? 0, d = e.padding ?? 0, p = this.getWorldTransform(t.id), y = i - p.x, m = o - p.y, b = -p.rotation * (Math.PI / 180), v = Math.cos(b), S = Math.sin(b), C = y * v - m * S, w = y * S + m * v, I = -a / 2, M = -r / 2, k = typeof d == "number" ? d : c === "vertical" ? d[0] : d[3];
|
|
5228
|
+
let T = (c === "vertical" ? M : I) + h + k;
|
|
5229
|
+
const x = e.listLayout || "linear", P = n.length || 1, E = Math.PI * 2 / P, R = e.circularStartAngle || 0, O = e.circularRadius || 100, W = h * 0.01 + R * Math.PI / 180;
|
|
5227
5230
|
for (let Y = 0; Y < n.length; Y++) {
|
|
5228
|
-
const H =
|
|
5231
|
+
const H = x === "circular" ? u : c === "vertical" ? a : u, K = x === "circular" || c === "vertical" ? f : r;
|
|
5229
5232
|
let A = 0, _ = 0, L = 0;
|
|
5230
|
-
if (
|
|
5233
|
+
if (x === "circular") {
|
|
5231
5234
|
const X = Y * E + W, V = I + a / 2, it = M + r / 2;
|
|
5232
5235
|
A = V + Math.cos(X) * O - H / 2, _ = it + Math.sin(X) * O - K / 2, L = X + (e.itemRotation || 0) * Math.PI / 180;
|
|
5233
5236
|
} else
|
|
5234
|
-
A =
|
|
5237
|
+
A = c === "vertical" ? I : T, _ = c === "vertical" ? T : M, L = (e.itemRotation || 0) * Math.PI / 180;
|
|
5235
5238
|
if (L !== 0) {
|
|
5236
|
-
const X = A + H / 2, V = _ + K / 2, it = C - X,
|
|
5237
|
-
if (
|
|
5239
|
+
const X = A + H / 2, V = _ + K / 2, it = C - X, lt = w - V, nt = -L, bt = it * Math.cos(nt) - lt * Math.sin(nt) + X, ht = it * Math.sin(nt) + lt * Math.cos(nt) + V;
|
|
5240
|
+
if (bt >= A && bt <= A + H && ht >= _ && ht <= _ + K)
|
|
5238
5241
|
return Y;
|
|
5239
5242
|
} else if (C >= A && C <= A + H && w >= _ && w <= _ + K)
|
|
5240
5243
|
return Y;
|
|
5241
|
-
T += (
|
|
5244
|
+
T += (c === "vertical" ? f : u) + l;
|
|
5242
5245
|
}
|
|
5243
5246
|
return null;
|
|
5244
5247
|
}
|
|
@@ -5256,28 +5259,28 @@ class ci {
|
|
|
5256
5259
|
if (!e.behaviors || e.behaviors.length === 0) return;
|
|
5257
5260
|
const s = this.objectStates.get(e.id);
|
|
5258
5261
|
s && e.behaviors.forEach((n) => {
|
|
5259
|
-
var u, h, d, p, y, m, b, v, S, C, w, I, M, k, T,
|
|
5262
|
+
var u, h, d, p, y, m, b, v, S, C, w, I, M, k, T, x, P, E, R, O, W, B, $, Y, H, K, A, _, L, X, V, it, lt, nt, bt, ht, wt, Mt, It, Ot, At, Tt, zt, Z, pt, Et, ut, vt, Rt, Xt, Bt, Dt, Ht, te, ue, pe, Qt, me, _e, ye, Se, Pe, ae, ee, at, gt, j, z, D, et, mt, Pt, Ct, Wt, yt, F, Lt, jt, Vt, ce, xt, ft, ct, tt, dt, G, st, J, Ft, Ut, se, Yt, qt, Nt, Ce, Ee, Ae, Oe, xe, Re, $e, Gt, ie, be, Le, Fe, he, re, le, we, We, Ge, De, Be, ze, Ve, Ze, je;
|
|
5260
5263
|
if (!n.enabled) return;
|
|
5261
5264
|
const a = n.startTime || 0, r = n.endTime || 1 / 0;
|
|
5262
5265
|
if (this.currentTime < a || this.currentTime > r) return;
|
|
5263
|
-
const
|
|
5266
|
+
const c = s.x - i, l = s.y - o, f = Math.sqrt(c * c + l * l);
|
|
5264
5267
|
if (this.frameCount % 240 === 0 && Math.random() < 0.1 && this.log(`[ExodeUI] Executing ${n.type} on ${e.name}`), n.type === N.Proximity) {
|
|
5265
5268
|
const U = ((u = n.settings) == null ? void 0 : u.radius) || 300, Q = ((h = n.settings) == null ? void 0 : h.falloff) || "smooth";
|
|
5266
5269
|
let q = 0;
|
|
5267
|
-
f < U && (Q === "linear" ? q = 1 - f / U : q = Math.pow(1 - f / U, 2)), n.sensors.forEach((
|
|
5268
|
-
this.applyBehaviorSensor(s,
|
|
5270
|
+
f < U && (Q === "linear" ? q = 1 - f / U : q = Math.pow(1 - f / U, 2)), n.sensors.forEach((rt) => {
|
|
5271
|
+
this.applyBehaviorSensor(s, rt, q, t, n.settings, e, c, l, f);
|
|
5269
5272
|
});
|
|
5270
5273
|
} else if (n.type === N.Magnetic) {
|
|
5271
5274
|
const U = ((d = n.settings) == null ? void 0 : d.radius) || 400, Q = ((p = n.settings) == null ? void 0 : p.strength) || 0.5;
|
|
5272
5275
|
if (f < U && f > 5) {
|
|
5273
|
-
const q = 1 - f / U,
|
|
5274
|
-
s.x -=
|
|
5276
|
+
const q = 1 - f / U, rt = c * q * Q, kt = l * q * Q;
|
|
5277
|
+
s.x -= rt * t * 10, s.y -= kt * t * 10;
|
|
5275
5278
|
}
|
|
5276
5279
|
} else if (n.type === N.Repel) {
|
|
5277
5280
|
const U = ((y = n.settings) == null ? void 0 : y.radius) || 300, Q = ((m = n.settings) == null ? void 0 : m.strength) || 1;
|
|
5278
5281
|
if (f < U) {
|
|
5279
5282
|
const q = Math.pow(1 - f / U, 2);
|
|
5280
|
-
s.x +=
|
|
5283
|
+
s.x += c / (f || 1) * q * 60 * Q * t * 5, s.y += l / (f || 1) * q * 60 * Q * t * 5;
|
|
5281
5284
|
}
|
|
5282
5285
|
} else if (n.type === N.Orbit) {
|
|
5283
5286
|
const U = ((b = n.settings) == null ? void 0 : b.speed) || 1, Q = ((v = n.settings) == null ? void 0 : v.radius) || 30, q = this.currentTime * U * Math.PI * 2;
|
|
@@ -5285,14 +5288,14 @@ class ci {
|
|
|
5285
5288
|
} else if (n.type === N.Vortex) {
|
|
5286
5289
|
const U = ((S = n.settings) == null ? void 0 : S.radius) || 400, Q = ((C = n.settings) == null ? void 0 : C.speed) || 2, q = ((w = n.settings) == null ? void 0 : w.strength) || 1;
|
|
5287
5290
|
if (f < U) {
|
|
5288
|
-
const
|
|
5289
|
-
s.x += _t *
|
|
5291
|
+
const rt = Math.pow(1 - f / U, 1.5), kt = this.currentTime * Q * Math.PI * 2, _t = Math.cos(kt) * 30 - c * 0.4, $t = Math.sin(kt) * 30 - l * 0.4;
|
|
5292
|
+
s.x += _t * rt * q * t * 5, s.y += $t * rt * q * t * 5, s.rotation += 5 * rt * q * t * 5, s.scale_x *= 1 - rt * 0.1 * q * t, s.scale_y *= 1 - rt * 0.1 * q * t;
|
|
5290
5293
|
}
|
|
5291
5294
|
} else if (n.type === N.Fluid) {
|
|
5292
5295
|
const U = ((I = n.settings) == null ? void 0 : I.radius) || 300, Q = ((M = n.settings) == null ? void 0 : M.strength) || 1;
|
|
5293
5296
|
if (f < U) {
|
|
5294
|
-
const q = Math.pow(1 - f / U, 1.2),
|
|
5295
|
-
s.x +=
|
|
5297
|
+
const q = Math.pow(1 - f / U, 1.2), rt = c / (f || 1) * q * 1.2 * Q, kt = l / (f || 1) * q * 1.2 * Q;
|
|
5298
|
+
s.x += rt * 10 * t * 5, s.y += kt * 10 * t * 5, s.scale_x *= 1 + q * 0.3 * Q * t, s.scale_y *= 1 + q * 0.3 * Q * t;
|
|
5296
5299
|
}
|
|
5297
5300
|
} else if (n.type === N.Elastic) {
|
|
5298
5301
|
const U = ((k = n.settings) == null ? void 0 : k.radius) || 300, Q = ((T = n.settings) == null ? void 0 : T.strength) || 1;
|
|
@@ -5301,43 +5304,43 @@ class ci {
|
|
|
5301
5304
|
s.scale_x *= 1 + q * 0.4 * Q * t, s.scale_y *= 1 + q * 0.4 * Q * t;
|
|
5302
5305
|
}
|
|
5303
5306
|
} else if (n.type === N.Holographic) {
|
|
5304
|
-
const U = s.x - this.canvasWidth / 2, Q = s.y - this.canvasHeight / 2, q = ((
|
|
5307
|
+
const U = s.x - this.canvasWidth / 2, Q = s.y - this.canvasHeight / 2, q = ((x = n.settings) == null ? void 0 : x.factor) || 25;
|
|
5305
5308
|
if (s.x -= U / 1e3 * q * t * 5, s.y -= Q / 1e3 * q * t * 5, s.style) {
|
|
5306
|
-
const
|
|
5307
|
-
s.style.exposure = (s.style.exposure || 1) +
|
|
5309
|
+
const rt = 1 - Math.min(1, f / 400);
|
|
5310
|
+
s.style.exposure = (s.style.exposure || 1) + rt * 0.5 * t;
|
|
5308
5311
|
}
|
|
5309
5312
|
} else if (n.type === N.Sticky) {
|
|
5310
5313
|
const U = ((P = n.settings) == null ? void 0 : P.radius) || 80, Q = ((E = n.settings) == null ? void 0 : E.strength) || 1;
|
|
5311
5314
|
if (f < U) {
|
|
5312
5315
|
const q = Math.pow(1 - f / U, 2);
|
|
5313
|
-
s.x -=
|
|
5316
|
+
s.x -= c * q * Q * t * 10, s.y -= l * q * Q * t * 10, s.scale_x *= 1 - q * 0.1 * Q * t, s.scale_y *= 1 - q * 0.1 * Q * t;
|
|
5314
5317
|
}
|
|
5315
5318
|
} else if (n.type === N.Dilation) {
|
|
5316
|
-
const U = ((
|
|
5319
|
+
const U = ((R = n.settings) == null ? void 0 : R.size) || 120, Q = ((O = n.settings) == null ? void 0 : O.strength) || 1;
|
|
5317
5320
|
if (f < U) {
|
|
5318
5321
|
const q = 1 - f / U;
|
|
5319
5322
|
s.scale_x *= 1 + q * 0.5 * Q * t, s.scale_y *= 1 + q * 0.5 * Q * t;
|
|
5320
5323
|
}
|
|
5321
5324
|
} else if (n.type === N.Parallax) {
|
|
5322
|
-
const U = ((W = n.settings) == null ? void 0 : W.factor) || 15, Q = ((B = n.settings) == null ? void 0 : B.strength) || 1, q = this.canvasWidth / 2,
|
|
5325
|
+
const U = ((W = n.settings) == null ? void 0 : W.factor) || 15, Q = ((B = n.settings) == null ? void 0 : B.strength) || 1, q = this.canvasWidth / 2, rt = this.canvasHeight / 2, kt = this._lastPointerPos || { x: q, y: rt }, _t = (kt.x - q) / q, $t = (kt.y - rt) / rt, Zt = ((($ = e.transform) == null ? void 0 : $.x) ?? 0) + _t * U * Q, fe = (((Y = e.transform) == null ? void 0 : Y.y) ?? 0) + $t * U * Q, Ie = (((H = e.transform) == null ? void 0 : H.rotate_x) ?? 0) - $t * U * 1.5 * Q, ne = (((K = e.transform) == null ? void 0 : K.rotate_y) ?? 0) + _t * U * 1.5 * Q, ge = Math.min(1, 10 * t);
|
|
5323
5326
|
s.x = this.lerp(s.x ?? ((A = e.transform) == null ? void 0 : A.x) ?? 0, Zt, ge), s.y = this.lerp(s.y ?? ((_ = e.transform) == null ? void 0 : _.y) ?? 0, fe, ge), s.rotate_x = this.lerp(s.rotate_x ?? ((L = e.transform) == null ? void 0 : L.rotate_x) ?? 0, Ie, ge), s.rotate_y = this.lerp(s.rotate_y ?? ((X = e.transform) == null ? void 0 : X.rotate_y) ?? 0, ne, ge);
|
|
5324
5327
|
} else if (n.type === N.Fold) {
|
|
5325
5328
|
if (f < 300) {
|
|
5326
|
-
const U = 1 - f / 300, Q = (
|
|
5327
|
-
s.skew_x = this.lerp(s.skew_x ?? ((V = e.transform) == null ? void 0 : V.skew_x) ?? 0, Q, _t), s.scale_y = this.lerp(s.scale_y ?? ((it = e.transform) == null ? void 0 : it.scale_y) ?? 1, (((
|
|
5329
|
+
const U = 1 - f / 300, Q = (c > 0 ? -1 : 1) * U * 10, q = 1 - U * 0.1, rt = l / 300 * U * 20, kt = -(c / 300) * U * 20, _t = Math.min(1, 10 * t);
|
|
5330
|
+
s.skew_x = this.lerp(s.skew_x ?? ((V = e.transform) == null ? void 0 : V.skew_x) ?? 0, Q, _t), s.scale_y = this.lerp(s.scale_y ?? ((it = e.transform) == null ? void 0 : it.scale_y) ?? 1, (((lt = e.transform) == null ? void 0 : lt.scale_y) ?? 1) * q, _t), s.rotate_x = this.lerp(s.rotate_x ?? ((nt = e.transform) == null ? void 0 : nt.rotate_x) ?? 0, rt, _t), s.rotate_y = this.lerp(s.rotate_y ?? ((bt = e.transform) == null ? void 0 : bt.rotate_y) ?? 0, kt, _t), s.style = s.style || { ...e.style }, s.style.artEffect = { enabled: !0, type: "fold_overlay", intensity: ((ht = n.settings) == null ? void 0 : ht.opacity) ?? 0.5 };
|
|
5328
5331
|
}
|
|
5329
5332
|
} else if (n.type === N.Crumple) {
|
|
5330
5333
|
if (f < 300) {
|
|
5331
|
-
const U = 1 - f / 300, Q = U * (Math.random() - 0.5) * 5, q = U * (Math.random() - 0.5) * 0.05,
|
|
5332
|
-
s.skew_x = this.lerp(s.skew_x ?? ((wt = e.transform) == null ? void 0 : wt.skew_x) ?? 0, Q,
|
|
5334
|
+
const U = 1 - f / 300, Q = U * (Math.random() - 0.5) * 5, q = U * (Math.random() - 0.5) * 0.05, rt = Math.min(1, 15 * t);
|
|
5335
|
+
s.skew_x = this.lerp(s.skew_x ?? ((wt = e.transform) == null ? void 0 : wt.skew_x) ?? 0, Q, rt), s.scale_x = this.lerp(s.scale_x ?? ((Mt = e.transform) == null ? void 0 : Mt.scale_x) ?? 1, (((It = e.transform) == null ? void 0 : It.scale_x) ?? 1) * (1 + q), rt), s.scale_y = this.lerp(s.scale_y ?? ((Ot = e.transform) == null ? void 0 : Ot.scale_y) ?? 1, (((At = e.transform) == null ? void 0 : At.scale_y) ?? 1) * (1 + q), rt), s.style = s.style || { ...e.style }, s.style.artEffect = { enabled: !0, type: "crumple_overlay", intensity: ((Tt = n.settings) == null ? void 0 : Tt.intensity) ?? 1, scale: ((zt = n.settings) == null ? void 0 : zt.scale) ?? 2 };
|
|
5333
5336
|
}
|
|
5334
5337
|
} else if (n.type === N.Squash) {
|
|
5335
5338
|
const U = ((Z = n.settings) == null ? void 0 : Z.strength) || 0.8;
|
|
5336
5339
|
f < (e.width || 100) && this.isMouseDown ? (s.scale_y = this.lerp(s.scale_y ?? 1, (((pt = e.transform) == null ? void 0 : pt.scale_y) ?? 1) * U, 0.3), s.scale_x = this.lerp(s.scale_x ?? 1, (((Et = e.transform) == null ? void 0 : Et.scale_x) ?? 1) * (1 + (1 - U) * 0.4), 0.3)) : (s.scale_y = this.lerp(s.scale_y ?? 1, ((ut = e.transform) == null ? void 0 : ut.scale_y) ?? 1, 0.2), s.scale_x = this.lerp(s.scale_x ?? 1, ((vt = e.transform) == null ? void 0 : vt.scale_x) ?? 1, 0.2));
|
|
5337
5340
|
} else if (n.type === N.TextCounter) {
|
|
5338
|
-
const U = ((
|
|
5341
|
+
const U = ((Rt = n.settings) == null ? void 0 : Rt.duration) || 2, Q = ((Xt = n.settings) == null ? void 0 : Xt.from) || 0, q = ((Bt = n.settings) == null ? void 0 : Bt.to) || 100;
|
|
5339
5342
|
n._runtimeStart === void 0 && (n._runtimeStart = this.currentTime);
|
|
5340
|
-
const
|
|
5343
|
+
const rt = this.currentTime - n._runtimeStart, kt = Math.min(1, rt / U), _t = Math.floor(Q + (q - Q) * kt);
|
|
5341
5344
|
if (((Dt = e.geometry) == null ? void 0 : Dt.type) === "Text") {
|
|
5342
5345
|
const $t = ((Ht = n.settings) == null ? void 0 : Ht.prefix) || "", Zt = ((te = n.settings) == null ? void 0 : te.suffix) || "";
|
|
5343
5346
|
s.geometry || (s.geometry = { ...e.geometry }), s.geometry.text = `${$t}${_t}${Zt}`;
|
|
@@ -5350,22 +5353,22 @@ class ci {
|
|
|
5350
5353
|
} else
|
|
5351
5354
|
(ye = s.style) != null && ye.adjustments && (s.style.adjustments.exposure = this.lerp(s.style.adjustments.exposure || 0, ((Pe = (Se = e.style) == null ? void 0 : Se.adjustments) == null ? void 0 : Pe.exposure) || 0, 0.1));
|
|
5352
5355
|
} else if (n.type === N.Noise || n.type === N.Float) {
|
|
5353
|
-
const U = (((ae = n.settings) == null ? void 0 : ae.frequency) || ((ee = n.settings) == null ? void 0 : ee.speed) || 1) * 2e-3, Q = (((
|
|
5356
|
+
const U = (((ae = n.settings) == null ? void 0 : ae.frequency) || ((ee = n.settings) == null ? void 0 : ee.speed) || 1) * 2e-3, Q = (((at = n.settings) == null ? void 0 : at.amplitude) || ((gt = n.settings) == null ? void 0 : gt.range) || 50) * (((j = n.settings) == null ? void 0 : j.strength) || 1), q = Date.now();
|
|
5354
5357
|
s.x += Math.sin(q * U) * Q * t, s.y += Math.cos(q * U * 0.8) * Q * t, s.rotation += Math.sin(q * U * 0.5) * 5 * t;
|
|
5355
5358
|
} else if (n.type === N.Pulse) {
|
|
5356
|
-
const U = (((z = n.settings) == null ? void 0 : z.speed) || 1) * 5e-3, Q = (((D = n.settings) == null ? void 0 : D.scale) || 1.2) - 1, q = Math.sin(Date.now() * U),
|
|
5357
|
-
s.scale_x *= 1 + q * Q *
|
|
5359
|
+
const U = (((z = n.settings) == null ? void 0 : z.speed) || 1) * 5e-3, Q = (((D = n.settings) == null ? void 0 : D.scale) || 1.2) - 1, q = Math.sin(Date.now() * U), rt = ((et = n.settings) == null ? void 0 : et.strength) || 1;
|
|
5360
|
+
s.scale_x *= 1 + q * Q * rt * t, s.scale_y *= 1 + q * Q * rt * t, s.style && (s.style.exposure = (s.style.exposure || 1) + Math.max(0, q) * 0.1 * rt * t);
|
|
5358
5361
|
} else if (n.type === N.Draggable) {
|
|
5359
|
-
const U = ((
|
|
5362
|
+
const U = ((mt = n.settings) == null ? void 0 : mt.radius) || 150, Q = this.draggingBehaviors.has(e.id);
|
|
5360
5363
|
if (f < U || Q) {
|
|
5361
|
-
const q = ((Pt = n.settings) == null ? void 0 : Pt.strength) || 1,
|
|
5362
|
-
this.applyBehaviorSensor(s, Kt.PositionX,
|
|
5364
|
+
const q = ((Pt = n.settings) == null ? void 0 : Pt.strength) || 1, rt = Q ? 1 : Math.max(0, 1 - f / U);
|
|
5365
|
+
this.applyBehaviorSensor(s, Kt.PositionX, rt * q, t, n.settings), this.applyBehaviorSensor(s, Kt.PositionY, rt * q, t, n.settings);
|
|
5363
5366
|
}
|
|
5364
5367
|
} else if (n.type === N.Scroll) {
|
|
5365
|
-
const U = ((Ct = n.settings) == null ? void 0 : Ct.axis) || "vertical", Q = ((Wt = n.settings) == null ? void 0 : Wt.factor) || 0.5, q = ((
|
|
5366
|
-
(U === "vertical" || U === "both") && (s.y += this.scrollOffset.y * Q * q * t), (U === "horizontal" || U === "both") && (s.x += this.scrollOffset.x * Q * q * t),
|
|
5368
|
+
const U = ((Ct = n.settings) == null ? void 0 : Ct.axis) || "vertical", Q = ((Wt = n.settings) == null ? void 0 : Wt.factor) || 0.5, q = ((yt = n.settings) == null ? void 0 : yt.strength) || 1, rt = ((F = n.settings) == null ? void 0 : F.scaleFactor) || 0;
|
|
5369
|
+
(U === "vertical" || U === "both") && (s.y += this.scrollOffset.y * Q * q * t), (U === "horizontal" || U === "both") && (s.x += this.scrollOffset.x * Q * q * t), rt !== 0 && (s.scale_x *= 1 + this.scrollOffset.y * rt * t, s.scale_y *= 1 + this.scrollOffset.y * rt * t);
|
|
5367
5370
|
} else if (n.type === N.LookAt) {
|
|
5368
|
-
const U = ((Lt = n.settings) == null ? void 0 : Lt.factor) || 1, Q = ((jt = n.settings) == null ? void 0 : jt.strength) || 1, q = Math.atan2(-
|
|
5371
|
+
const U = ((Lt = n.settings) == null ? void 0 : Lt.factor) || 1, Q = ((jt = n.settings) == null ? void 0 : jt.strength) || 1, q = Math.atan2(-l, -c) * (180 / Math.PI), rt = s.rotation, kt = (q - rt + 180) % 360 - 180;
|
|
5369
5372
|
s.rotation += kt * U * Q * t * 10;
|
|
5370
5373
|
} else if (n.type === N.Scan) {
|
|
5371
5374
|
const U = (((Vt = n.settings) == null ? void 0 : Vt.speed) || 1) * 4e-3, Q = ((ce = n.settings) == null ? void 0 : ce.strength) || 1, q = (Math.sin(Date.now() * U) + 1) / 2;
|
|
@@ -5374,10 +5377,10 @@ class ci {
|
|
|
5374
5377
|
s.style = s.style || { ...e.style }, s.style.artEffect = {
|
|
5375
5378
|
enabled: !0,
|
|
5376
5379
|
type: "glint_overlay",
|
|
5377
|
-
intensity: ((
|
|
5380
|
+
intensity: ((xt = n.settings) == null ? void 0 : xt.strength) ?? 0.8
|
|
5378
5381
|
};
|
|
5379
5382
|
else if (n.type === N.Ratchet) {
|
|
5380
|
-
const U = ((ft = n.settings) == null ? void 0 : ft.steps) || 12, Q = (((
|
|
5383
|
+
const U = ((ft = n.settings) == null ? void 0 : ft.steps) || 12, Q = (((ct = n.settings) == null ? void 0 : ct.speed) || 1) * 30, q = Math.floor(s.rotation / (360 / U)) * (360 / U);
|
|
5381
5384
|
s.rotation = this.lerp(s.rotation, q + Q * t, 0.1);
|
|
5382
5385
|
} else if (n.type === N.Jitter && f < 300) {
|
|
5383
5386
|
const U = ((tt = n.settings) == null ? void 0 : tt.strength) || 1, Q = (((dt = n.settings) == null ? void 0 : dt.intensity) || 5) * U;
|
|
@@ -5387,8 +5390,8 @@ class ci {
|
|
|
5387
5390
|
if (U) {
|
|
5388
5391
|
const Q = this.objectStates.get(U);
|
|
5389
5392
|
if (Q) {
|
|
5390
|
-
const q = ((st = n.settings) == null ? void 0 : st.stiffness) || 0.1,
|
|
5391
|
-
s.x +=
|
|
5393
|
+
const q = ((st = n.settings) == null ? void 0 : st.stiffness) || 0.1, rt = Q.x - s.x, kt = Q.y - s.y;
|
|
5394
|
+
s.x += rt * q * t * 60, s.y += kt * q * t * 60;
|
|
5392
5395
|
}
|
|
5393
5396
|
}
|
|
5394
5397
|
} else if (n.type === N.Wrap)
|
|
@@ -5412,35 +5415,35 @@ class ci {
|
|
|
5412
5415
|
const q = Math.pow(1 - f / U, 2);
|
|
5413
5416
|
s.scale_x = this.lerp(s.scale_x ?? 1, (((Ae = e.transform) == null ? void 0 : Ae.scale_x) ?? 1) * (1 + q * Q), 0.2), s.scale_y = this.lerp(s.scale_y ?? 1, (((Oe = e.transform) == null ? void 0 : Oe.scale_y) ?? 1) * (1 + q * Q), 0.2);
|
|
5414
5417
|
} else
|
|
5415
|
-
s.scale_x = this.lerp(s.scale_x ?? 1, ((
|
|
5418
|
+
s.scale_x = this.lerp(s.scale_x ?? 1, ((xe = e.transform) == null ? void 0 : xe.scale_x) ?? 1, 0.1), s.scale_y = this.lerp(s.scale_y ?? 1, ((Re = e.transform) == null ? void 0 : Re.scale_y) ?? 1, 0.1);
|
|
5416
5419
|
} else if (n.type === N.LayoutAnimation) {
|
|
5417
5420
|
const U = (($e = n.settings) == null ? void 0 : $e.watchProperties) || ["x", "y", "scale_x", "scale_y", "opacity", "rotation"], Q = ((Gt = n.settings) == null ? void 0 : Gt.duration) || 0.3;
|
|
5418
5421
|
this._layoutAnimCache.has(e.id) || this._layoutAnimCache.set(e.id, /* @__PURE__ */ new Map());
|
|
5419
5422
|
const q = this._layoutAnimCache.get(e.id);
|
|
5420
|
-
for (const
|
|
5421
|
-
const kt = this.getObjectProperty(s, e,
|
|
5423
|
+
for (const rt of U) {
|
|
5424
|
+
const kt = this.getObjectProperty(s, e, rt);
|
|
5422
5425
|
if (kt === void 0) continue;
|
|
5423
|
-
const _t = q.get(
|
|
5426
|
+
const _t = q.get(rt);
|
|
5424
5427
|
if (!_t)
|
|
5425
|
-
q.set(
|
|
5428
|
+
q.set(rt, {
|
|
5426
5429
|
from: kt,
|
|
5427
5430
|
to: kt,
|
|
5428
5431
|
startTime: this.currentTime,
|
|
5429
5432
|
duration: 0
|
|
5430
5433
|
});
|
|
5431
5434
|
else if (_t.to !== kt) {
|
|
5432
|
-
const Zt = this.getObjectProperty(s, e,
|
|
5433
|
-
q.set(
|
|
5435
|
+
const Zt = this.getObjectProperty(s, e, rt);
|
|
5436
|
+
q.set(rt, {
|
|
5434
5437
|
from: Zt ?? _t.from,
|
|
5435
5438
|
to: kt,
|
|
5436
5439
|
startTime: this.currentTime,
|
|
5437
5440
|
duration: ((ie = n.settings) == null ? void 0 : ie.duration) ?? Q
|
|
5438
5441
|
});
|
|
5439
5442
|
}
|
|
5440
|
-
const $t = q.get(
|
|
5443
|
+
const $t = q.get(rt);
|
|
5441
5444
|
if ($t.duration > 0 && $t.from !== $t.to) {
|
|
5442
5445
|
const Zt = this.currentTime - $t.startTime, fe = Math.min(1, Zt / $t.duration), Ie = this.applyEasing(fe, ((be = n.settings) == null ? void 0 : be.easing) || "easeOutCubic"), ne = $t.from + ($t.to - $t.from) * Ie;
|
|
5443
|
-
this.setObjectProperty(s, e,
|
|
5446
|
+
this.setObjectProperty(s, e, rt, ne);
|
|
5444
5447
|
}
|
|
5445
5448
|
}
|
|
5446
5449
|
} else if (n.type === N.StateReactive) {
|
|
@@ -5460,30 +5463,30 @@ class ci {
|
|
|
5460
5463
|
"style.shadow.offsetX",
|
|
5461
5464
|
"style.shadow.offsetY"
|
|
5462
5465
|
];
|
|
5463
|
-
for (const
|
|
5464
|
-
const kt = this.getObjectProperty(s, e,
|
|
5466
|
+
for (const rt of q) {
|
|
5467
|
+
const kt = this.getObjectProperty(s, e, rt);
|
|
5465
5468
|
if (kt === void 0 || typeof kt != "number") continue;
|
|
5466
|
-
const _t = U.get(
|
|
5469
|
+
const _t = U.get(rt);
|
|
5467
5470
|
if (!_t)
|
|
5468
|
-
U.set(
|
|
5471
|
+
U.set(rt, {
|
|
5469
5472
|
from: kt,
|
|
5470
5473
|
to: kt,
|
|
5471
5474
|
startTime: this.currentTime,
|
|
5472
5475
|
duration: 0
|
|
5473
5476
|
});
|
|
5474
5477
|
else if (_t.to !== kt) {
|
|
5475
|
-
const Zt = this.getObjectProperty(s, e,
|
|
5476
|
-
U.set(
|
|
5478
|
+
const Zt = this.getObjectProperty(s, e, rt);
|
|
5479
|
+
U.set(rt, {
|
|
5477
5480
|
from: Zt ?? _t.from,
|
|
5478
5481
|
to: kt,
|
|
5479
5482
|
startTime: this.currentTime,
|
|
5480
5483
|
duration: Q
|
|
5481
5484
|
});
|
|
5482
5485
|
}
|
|
5483
|
-
const $t = U.get(
|
|
5486
|
+
const $t = U.get(rt);
|
|
5484
5487
|
if ($t.duration > 0 && $t.from !== $t.to) {
|
|
5485
5488
|
const Zt = this.currentTime - $t.startTime, fe = Math.min(1, Zt / $t.duration), Ie = this.applyEasing(fe, ((Fe = n.settings) == null ? void 0 : Fe.defaultEasing) || "easeOutCubic"), ne = $t.from + ($t.to - $t.from) * Ie;
|
|
5486
|
-
this.setObjectProperty(s, e,
|
|
5489
|
+
this.setObjectProperty(s, e, rt, ne);
|
|
5487
5490
|
}
|
|
5488
5491
|
}
|
|
5489
5492
|
} else if (n.type === N.SpringChain) {
|
|
@@ -5502,21 +5505,21 @@ class ci {
|
|
|
5502
5505
|
}
|
|
5503
5506
|
q.has(e.id) || q.set(e.id, { x: s.x, y: s.y, vx: 0, vy: 0 });
|
|
5504
5507
|
}
|
|
5505
|
-
const
|
|
5506
|
-
if (
|
|
5507
|
-
|
|
5508
|
+
const rt = q.get(e.id);
|
|
5509
|
+
if (rt) {
|
|
5510
|
+
rt.x = s.x, rt.y = s.y;
|
|
5508
5511
|
for (const kt of U) {
|
|
5509
5512
|
const _t = q.get(kt.targetId);
|
|
5510
5513
|
if (!_t) continue;
|
|
5511
|
-
const $t = _t.x -
|
|
5512
|
-
|
|
5514
|
+
const $t = _t.x - rt.x, Zt = _t.y - rt.y, fe = Math.sqrt($t * $t + Zt * Zt) || 1e-3, ne = (fe - (kt.restLength || 50)) * (kt.stiffness || 0.8), ge = $t / fe * ne, Ne = Zt / fe * ne;
|
|
5515
|
+
rt.vx += ge * t * 10, rt.vy += Ne * t * 10, _t.vx -= ge * t * 10, _t.vy -= Ne * t * 10, rt.vx *= 1 - Q * t * 10, rt.vy *= 1 - Q * t * 10, _t.vx *= 1 - Q * t * 10, _t.vy *= 1 - Q * t * 10;
|
|
5513
5516
|
const de = this.objectStates.get(kt.targetId);
|
|
5514
5517
|
de && (de.x += _t.vx * t, de.y += _t.vy * t);
|
|
5515
5518
|
}
|
|
5516
|
-
s.x +=
|
|
5519
|
+
s.x += rt.vx * t, s.y += rt.vy * t;
|
|
5517
5520
|
}
|
|
5518
5521
|
} else if (n.type === N.ParticleEmitter) {
|
|
5519
|
-
const U = ((le = n.settings) == null ? void 0 : le.rate) || 10, Q = ((we = n.settings) == null ? void 0 : we.speed) || 100, q = ((We = n.settings) == null ? void 0 : We.size) || 5,
|
|
5522
|
+
const U = ((le = n.settings) == null ? void 0 : le.rate) || 10, Q = ((we = n.settings) == null ? void 0 : we.speed) || 100, q = ((We = n.settings) == null ? void 0 : We.size) || 5, rt = ((Ge = n.settings) == null ? void 0 : Ge.lifetime) || 2, kt = ((De = n.settings) == null ? void 0 : De.gravity) || 0, _t = ((Be = n.settings) == null ? void 0 : Be.color) || "#ffffff", $t = ((ze = n.settings) == null ? void 0 : ze.maxParticles) || 200, Zt = (Ve = n.settings) != null && Ve.rateInputId ? this.inputs.get(n.settings.rateInputId) ?? U : U, fe = (Ze = n.settings) != null && Ze.gravityInputId ? this.inputs.get(n.settings.gravityInputId) ?? kt : kt, Ie = (je = n.settings) != null && je.speedInputId ? this.inputs.get(n.settings.speedInputId) ?? Q : Q;
|
|
5520
5523
|
this._emitterPools.has(e.id) || this._emitterPools.set(e.id, []);
|
|
5521
5524
|
const ne = this._emitterPools.get(e.id);
|
|
5522
5525
|
let ge = 0;
|
|
@@ -5530,7 +5533,7 @@ class ci {
|
|
|
5530
5533
|
vx: Math.cos(oe) * ts,
|
|
5531
5534
|
vy: Math.sin(oe) * ts,
|
|
5532
5535
|
life: 0,
|
|
5533
|
-
maxLife:
|
|
5536
|
+
maxLife: rt * (0.5 + Math.random() * 0.5),
|
|
5534
5537
|
size: q * (0.5 + Math.random()),
|
|
5535
5538
|
color: _t,
|
|
5536
5539
|
opacity: 1
|
|
@@ -5544,88 +5547,88 @@ class ci {
|
|
|
5544
5547
|
});
|
|
5545
5548
|
});
|
|
5546
5549
|
}
|
|
5547
|
-
applyBehaviorSensor(t, i, o, e, s, n, a = 0, r = 0,
|
|
5548
|
-
var d, p, y, m, b, v, S, C, w, I, M, k, T,
|
|
5549
|
-
const
|
|
5550
|
+
applyBehaviorSensor(t, i, o, e, s, n, a = 0, r = 0, c = 1) {
|
|
5551
|
+
var d, p, y, m, b, v, S, C, w, I, M, k, T, x, P, E, R, O, W, B, $, Y, H, K;
|
|
5552
|
+
const l = (s == null ? void 0 : s.intensity) || (s == null ? void 0 : s.strength) || 1, f = Math.min(1, 15 * e), u = c > 0 ? a / c : 0, h = c > 0 ? r / c : 0;
|
|
5550
5553
|
switch (i) {
|
|
5551
5554
|
case Kt.Scale: {
|
|
5552
|
-
const A = ((d = n == null ? void 0 : n.transform) == null ? void 0 : d.scale_x) ?? 1, _ = ((p = n == null ? void 0 : n.transform) == null ? void 0 : p.scale_y) ?? 1, L = A * (1 + o *
|
|
5555
|
+
const A = ((d = n == null ? void 0 : n.transform) == null ? void 0 : d.scale_x) ?? 1, _ = ((p = n == null ? void 0 : n.transform) == null ? void 0 : p.scale_y) ?? 1, L = A * (1 + o * l * 0.4), X = _ * (1 + o * l * 0.4);
|
|
5553
5556
|
t.scale_x = (t.scale_x ?? A) * (1 - f) + L * f, t.scale_y = (t.scale_y ?? _) * (1 - f) + X * f;
|
|
5554
5557
|
break;
|
|
5555
5558
|
}
|
|
5556
5559
|
case Kt.Opacity: {
|
|
5557
|
-
const A = ((y = n == null ? void 0 : n.transform) == null ? void 0 : y.opacity) ?? 100, _ = Math.max(0, Math.min(100, A - o *
|
|
5560
|
+
const A = ((y = n == null ? void 0 : n.transform) == null ? void 0 : y.opacity) ?? 100, _ = Math.max(0, Math.min(100, A - o * l * 100));
|
|
5558
5561
|
t.opacity = (t.opacity ?? A) * (1 - f) + _ * f;
|
|
5559
5562
|
break;
|
|
5560
5563
|
}
|
|
5561
5564
|
case Kt.RotateZ: {
|
|
5562
|
-
const A = ((m = n == null ? void 0 : n.transform) == null ? void 0 : m.rotation) ?? 0, _ = A + o *
|
|
5565
|
+
const A = ((m = n == null ? void 0 : n.transform) == null ? void 0 : m.rotation) ?? 0, _ = A + o * l * 45;
|
|
5563
5566
|
t.rotation = (t.rotation ?? A) * (1 - f) + _ * f;
|
|
5564
5567
|
break;
|
|
5565
5568
|
}
|
|
5566
5569
|
case Kt.RotateX: {
|
|
5567
|
-
const A = ((b = n == null ? void 0 : n.transform) == null ? void 0 : b.rotate_x) ?? 0, _ = A - h * o *
|
|
5570
|
+
const A = ((b = n == null ? void 0 : n.transform) == null ? void 0 : b.rotate_x) ?? 0, _ = A - h * o * l * 60;
|
|
5568
5571
|
t.rotate_x = (t.rotate_x ?? A) * (1 - f) + _ * f;
|
|
5569
5572
|
break;
|
|
5570
5573
|
}
|
|
5571
5574
|
case Kt.RotateY: {
|
|
5572
|
-
const A = ((v = n == null ? void 0 : n.transform) == null ? void 0 : v.rotate_y) ?? 0, _ = A + u * o *
|
|
5575
|
+
const A = ((v = n == null ? void 0 : n.transform) == null ? void 0 : v.rotate_y) ?? 0, _ = A + u * o * l * 60;
|
|
5573
5576
|
t.rotate_y = (t.rotate_y ?? A) * (1 - f) + _ * f;
|
|
5574
5577
|
break;
|
|
5575
5578
|
}
|
|
5576
5579
|
case Kt.PositionX: {
|
|
5577
|
-
const A = ((S = n == null ? void 0 : n.transform) == null ? void 0 : S.x) ?? 0, _ = A - u * o *
|
|
5580
|
+
const A = ((S = n == null ? void 0 : n.transform) == null ? void 0 : S.x) ?? 0, _ = A - u * o * l * 40;
|
|
5578
5581
|
t.x = (t.x ?? A) * (1 - f) + _ * f;
|
|
5579
5582
|
break;
|
|
5580
5583
|
}
|
|
5581
5584
|
case Kt.PositionY: {
|
|
5582
|
-
const A = ((C = n == null ? void 0 : n.transform) == null ? void 0 : C.y) ?? 0, _ = A - h * o *
|
|
5585
|
+
const A = ((C = n == null ? void 0 : n.transform) == null ? void 0 : C.y) ?? 0, _ = A - h * o * l * 40;
|
|
5583
5586
|
t.y = (t.y ?? A) * (1 - f) + _ * f;
|
|
5584
5587
|
break;
|
|
5585
5588
|
}
|
|
5586
5589
|
case Kt.SkewX: {
|
|
5587
|
-
const A = ((w = n == null ? void 0 : n.transform) == null ? void 0 : w.skew_x) ?? 0, _ = A + u * o *
|
|
5590
|
+
const A = ((w = n == null ? void 0 : n.transform) == null ? void 0 : w.skew_x) ?? 0, _ = A + u * o * l * 45;
|
|
5588
5591
|
t.skew_x = (t.skew_x ?? A) * (1 - f) + _ * f, t.skew_x > 85 && (t.skew_x = 85), t.skew_x < -85 && (t.skew_x = -85);
|
|
5589
5592
|
break;
|
|
5590
5593
|
}
|
|
5591
5594
|
case Kt.Blur: {
|
|
5592
5595
|
t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.blur || (t.style.blur = { ...(I = n == null ? void 0 : n.style) == null ? void 0 : I.blur });
|
|
5593
|
-
const A = ((k = (M = n == null ? void 0 : n.style) == null ? void 0 : M.blur) == null ? void 0 : k.amount) || 0, _ = A + o * ((s == null ? void 0 : s.blur) || 20) *
|
|
5596
|
+
const A = ((k = (M = n == null ? void 0 : n.style) == null ? void 0 : M.blur) == null ? void 0 : k.amount) || 0, _ = A + o * ((s == null ? void 0 : s.blur) || 20) * l;
|
|
5594
5597
|
t.style.blur.amount = (t.style.blur.amount ?? A) * (1 - f) + _ * f;
|
|
5595
5598
|
break;
|
|
5596
5599
|
}
|
|
5597
5600
|
case Kt.Exposure: {
|
|
5598
5601
|
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 });
|
|
5599
|
-
const A = ((P = (
|
|
5602
|
+
const A = ((P = (x = n == null ? void 0 : n.style) == null ? void 0 : x.adjustments) == null ? void 0 : P.exposure) || 0, _ = A + o * ((s == null ? void 0 : s.exposure) || 50) * l;
|
|
5600
5603
|
t.style.adjustments.exposure = (t.style.adjustments.exposure ?? A) * (1 - f) + _ * f;
|
|
5601
5604
|
break;
|
|
5602
5605
|
}
|
|
5603
5606
|
case Kt.HueShift: {
|
|
5604
5607
|
t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.adjustments || (t.style.adjustments = { ...(E = n == null ? void 0 : n.style) == null ? void 0 : E.adjustments });
|
|
5605
|
-
const A = ((O = (
|
|
5608
|
+
const A = ((O = (R = n == null ? void 0 : n.style) == null ? void 0 : R.adjustments) == null ? void 0 : O.hue) || 0, _ = A + o * ((s == null ? void 0 : s.hue) || 180) * l;
|
|
5606
5609
|
t.style.adjustments.hue = (t.style.adjustments.hue ?? A) * (1 - f) + _ * f;
|
|
5607
5610
|
break;
|
|
5608
5611
|
}
|
|
5609
5612
|
case Kt.Negative: {
|
|
5610
5613
|
t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.adjustments || (t.style.adjustments = { ...(W = n == null ? void 0 : n.style) == null ? void 0 : W.adjustments });
|
|
5611
|
-
const A = (($ = (B = n == null ? void 0 : n.style) == null ? void 0 : B.adjustments) == null ? void 0 : $.negative) || 0, _ = A + o * ((s == null ? void 0 : s.negative) || 100) *
|
|
5614
|
+
const A = (($ = (B = n == null ? void 0 : n.style) == null ? void 0 : B.adjustments) == null ? void 0 : $.negative) || 0, _ = A + o * ((s == null ? void 0 : s.negative) || 100) * l;
|
|
5612
5615
|
t.style.adjustments.negative = (t.style.adjustments.negative ?? A) * (1 - f) + _ * f;
|
|
5613
5616
|
break;
|
|
5614
5617
|
}
|
|
5615
5618
|
case Kt.CornerRadius: {
|
|
5616
|
-
const A = ((Y = n == null ? void 0 : n.transform) == null ? void 0 : Y.corner_radius) || 0, _ = A + o *
|
|
5619
|
+
const A = ((Y = n == null ? void 0 : n.transform) == null ? void 0 : Y.corner_radius) || 0, _ = A + o * l * 50;
|
|
5617
5620
|
t.corner_radius = (t.corner_radius ?? A) * (1 - f) + _ * f;
|
|
5618
5621
|
break;
|
|
5619
5622
|
}
|
|
5620
5623
|
case Kt.StrokeWidth: {
|
|
5621
5624
|
t.style || (t.style = { ...n == null ? void 0 : n.style });
|
|
5622
|
-
const A = ((H = n == null ? void 0 : n.style) == null ? void 0 : H.borderWidth) || 0, _ = A + o *
|
|
5625
|
+
const A = ((H = n == null ? void 0 : n.style) == null ? void 0 : H.borderWidth) || 0, _ = A + o * l * 10;
|
|
5623
5626
|
t.style.borderWidth = (t.style.borderWidth ?? A) * (1 - f) + _ * f;
|
|
5624
5627
|
break;
|
|
5625
5628
|
}
|
|
5626
5629
|
case Kt.LetterSpacing: {
|
|
5627
5630
|
t.geometry || (t.geometry = {});
|
|
5628
|
-
const A = ((K = n == null ? void 0 : n.geometry) == null ? void 0 : K.letterSpacing) || 0, _ = A + o *
|
|
5631
|
+
const A = ((K = n == null ? void 0 : n.geometry) == null ? void 0 : K.letterSpacing) || 0, _ = A + o * l * 10;
|
|
5629
5632
|
t.geometry.letterSpacing = (t.geometry.letterSpacing ?? A) * (1 - f) + _ * f;
|
|
5630
5633
|
break;
|
|
5631
5634
|
}
|
|
@@ -5648,12 +5651,12 @@ class ci {
|
|
|
5648
5651
|
const s = o.split(".");
|
|
5649
5652
|
let n = t;
|
|
5650
5653
|
for (let r = 0; r < s.length - 1; r++) {
|
|
5651
|
-
const
|
|
5652
|
-
if (n[
|
|
5653
|
-
const
|
|
5654
|
-
n[
|
|
5654
|
+
const c = s[r];
|
|
5655
|
+
if (n[c] === void 0 || n[c] === null) {
|
|
5656
|
+
const l = i, f = s.slice(0, r + 1).reduce((u, h) => u == null ? void 0 : u[h], l);
|
|
5657
|
+
n[c] = f !== void 0 ? { ...f } : {};
|
|
5655
5658
|
}
|
|
5656
|
-
n = n[
|
|
5659
|
+
n = n[c];
|
|
5657
5660
|
}
|
|
5658
5661
|
const a = s[s.length - 1];
|
|
5659
5662
|
n != null && (n[a] = e);
|
|
@@ -5701,9 +5704,9 @@ class ci {
|
|
|
5701
5704
|
return o;
|
|
5702
5705
|
}
|
|
5703
5706
|
renderFittedImage(t, i, o, e, s, n, a = "cover") {
|
|
5704
|
-
const r = i.naturalWidth,
|
|
5707
|
+
const r = i.naturalWidth, c = i.naturalHeight, l = r / c, f = s / n;
|
|
5705
5708
|
let u = s, h = n, d = o, p = e;
|
|
5706
|
-
a === "cover" ?
|
|
5709
|
+
a === "cover" ? l > f ? (u = n * l, d = o - (u - s) / 2) : (h = s / l, p = e - (h - n) / 2) : a === "contain" && (l > f ? (h = s / l, p = e + (n - h) / 2) : (u = n * l, d = o + (s - u) / 2)), t.drawImage(i, d, p, u, h);
|
|
5707
5710
|
}
|
|
5708
5711
|
}
|
|
5709
5712
|
const yi = Ss(({
|
|
@@ -5716,8 +5719,8 @@ const yi = Ss(({
|
|
|
5716
5719
|
onReady: n,
|
|
5717
5720
|
onTrigger: a,
|
|
5718
5721
|
onInputUpdate: r,
|
|
5719
|
-
onComponentChange:
|
|
5720
|
-
onToggle:
|
|
5722
|
+
onComponentChange: c,
|
|
5723
|
+
onToggle: l,
|
|
5721
5724
|
onInputChange: f,
|
|
5722
5725
|
onInputFocus: u,
|
|
5723
5726
|
onInputBlur: h,
|
|
@@ -5734,19 +5737,19 @@ const yi = Ss(({
|
|
|
5734
5737
|
isMouseDown: M,
|
|
5735
5738
|
inputs: k,
|
|
5736
5739
|
interactive: T = !0,
|
|
5737
|
-
onNavigation:
|
|
5740
|
+
onNavigation: x
|
|
5738
5741
|
}, P) => {
|
|
5739
|
-
const E = Me(null),
|
|
5740
|
-
|
|
5742
|
+
const E = Me(null), R = Me(null);
|
|
5743
|
+
R.current || (R.current = new ci());
|
|
5741
5744
|
const O = Me(void 0), W = Me(0), B = Me(null), $ = Me(v), Y = Me(null), [, H] = ds(g || null), K = Me(!0);
|
|
5742
5745
|
Cs(P, () => E.current), Te(() => (K.current = !0, () => {
|
|
5743
5746
|
K.current = !1, O.current && cancelAnimationFrame(O.current);
|
|
5744
5747
|
}), []), Te(() => {
|
|
5745
|
-
|
|
5748
|
+
R.current.setLayout(e, s);
|
|
5746
5749
|
}, [e, s]), Te(() => {
|
|
5747
|
-
const _ =
|
|
5748
|
-
a && _.setTriggerCallback(a), r && _.setInputUpdateCallback((L, X) => r({ [L]: X })),
|
|
5749
|
-
}, [a, r,
|
|
5750
|
+
const _ = R.current;
|
|
5751
|
+
a && _.setTriggerCallback(a), r && _.setInputUpdateCallback((L, X) => r({ [L]: X })), c && _.setComponentChangeCallback((L) => c(L)), l && _.setToggleCallback(l), f && _.setInputChangeCallback(f), u && _.setInputFocusCallback(u), h && _.setInputBlurCallback(h), d && _.setOnLogCallback((L) => d(L, "info")), p && _.setLogicUpdateCallback(p), y && _.setButtonClickCallback(y), m && _.setGraphPointClickCallback((L) => m(L.objectId, L)), x && _.setNavigationCallback(x);
|
|
5752
|
+
}, [a, r, c, l, f, u, h, d, p, y, m, x]), Te(() => {
|
|
5750
5753
|
(async () => {
|
|
5751
5754
|
let L = g;
|
|
5752
5755
|
if (t && !g)
|
|
@@ -5756,22 +5759,22 @@ const yi = Ss(({
|
|
|
5756
5759
|
console.error("[ExodeUI] Failed to load src:", X);
|
|
5757
5760
|
}
|
|
5758
5761
|
if (L) {
|
|
5759
|
-
const X =
|
|
5762
|
+
const X = R.current, V = L.id || L.name || "default";
|
|
5760
5763
|
(B.current !== V || $.current !== v || Y.current !== L) && (X.load(L), B.current = V, $.current = v, Y.current = L, H(L), W.current = 0, X.advance(0)), n && n(X);
|
|
5761
5764
|
}
|
|
5762
5765
|
})();
|
|
5763
5766
|
}, [g, t, v]), Te(() => {
|
|
5764
5767
|
const _ = (L) => {
|
|
5765
|
-
if (!
|
|
5766
|
-
const X =
|
|
5768
|
+
if (!R.current || !K.current) return;
|
|
5769
|
+
const X = R.current, V = E.current;
|
|
5767
5770
|
if (!V) return;
|
|
5768
5771
|
const it = V.getContext("2d");
|
|
5769
5772
|
if (!it) return;
|
|
5770
|
-
const
|
|
5771
|
-
W.current === 0 && (W.current =
|
|
5772
|
-
let nt =
|
|
5773
|
-
nt > 0.1 && (nt = 0.1), W.current =
|
|
5774
|
-
const
|
|
5773
|
+
const lt = L / 1e3;
|
|
5774
|
+
W.current === 0 && (W.current = lt);
|
|
5775
|
+
let nt = lt - W.current;
|
|
5776
|
+
nt > 0.1 && (nt = 0.1), W.current = lt;
|
|
5777
|
+
const bt = V.getBoundingClientRect(), ht = window.devicePixelRatio || 1, wt = Math.round(bt.width * ht), Mt = Math.round(bt.height * ht);
|
|
5775
5778
|
(V.width !== wt || V.height !== Mt) && (V.width = wt, V.height = Mt);
|
|
5776
5779
|
try {
|
|
5777
5780
|
o ? X.advance(nt) : b !== void 0 && X.seek(b), X.render(it, V.width, V.height);
|
|
@@ -5784,14 +5787,14 @@ const yi = Ss(({
|
|
|
5784
5787
|
O.current && cancelAnimationFrame(O.current);
|
|
5785
5788
|
};
|
|
5786
5789
|
}, [o, b]), Te(() => {
|
|
5787
|
-
const _ =
|
|
5790
|
+
const _ = R.current;
|
|
5788
5791
|
S !== void 0 && _.updateInput("scrollY", S), C !== void 0 && _.updateInput("scrollX", C), w !== void 0 && _.updateInput("mouseX", w), I !== void 0 && _.updateInput("mouseY", I), M !== void 0 && _.updateInput("isMouseDown", M), k && Object.entries(k).forEach(([L, X]) => _.updateInput(L, X));
|
|
5789
5792
|
}, [S, C, w, I, M, k]);
|
|
5790
5793
|
const A = (_, L) => {
|
|
5791
5794
|
if (!T || !E.current) return;
|
|
5792
5795
|
_.stopPropagation(), "nativeEvent" in _ && _.nativeEvent && typeof _.nativeEvent.stopImmediatePropagation == "function" ? _.nativeEvent.stopImmediatePropagation() : typeof _.stopImmediatePropagation == "function" && _.stopImmediatePropagation();
|
|
5793
|
-
const X = E.current, V = X.getBoundingClientRect(), it = _.clientX - V.left,
|
|
5794
|
-
(L === "click" || L === "down" || L === "up") && d && d(`[Canvas] Pointer ${L} at rect(${Math.round(it)},${Math.round(
|
|
5796
|
+
const X = E.current, V = X.getBoundingClientRect(), it = _.clientX - V.left, lt = _.clientY - V.top, nt = window.devicePixelRatio || 1;
|
|
5797
|
+
(L === "click" || L === "down" || L === "up") && d && d(`[Canvas] Pointer ${L} at rect(${Math.round(it)},${Math.round(lt)}) mapped to buffer(${Math.round(it * nt)},${Math.round(lt * nt)})`, "info"), R.current.handlePointerInput(L, it * nt, lt * nt, X.width, X.height);
|
|
5795
5798
|
};
|
|
5796
5799
|
return /* @__PURE__ */ ke(
|
|
5797
5800
|
"canvas",
|
|
@@ -5806,9 +5809,9 @@ const yi = Ss(({
|
|
|
5806
5809
|
onPointerCancel: (_) => A(_, "up"),
|
|
5807
5810
|
onClick: (_) => A(_, "click"),
|
|
5808
5811
|
onWheel: (_) => {
|
|
5809
|
-
|
|
5812
|
+
R.current.handleWheel(_.deltaX, _.deltaY);
|
|
5810
5813
|
},
|
|
5811
|
-
onKeyDown: (_) =>
|
|
5814
|
+
onKeyDown: (_) => R.current.handleKeyDown(_.nativeEvent),
|
|
5812
5815
|
onContextMenu: (_) => _.preventDefault(),
|
|
5813
5816
|
tabIndex: 0,
|
|
5814
5817
|
style: {
|
|
@@ -5838,9 +5841,9 @@ function bi() {
|
|
|
5838
5841
|
g == null || g.setInputStringArray(f, u);
|
|
5839
5842
|
}, [g]), r = ve((f, u) => {
|
|
5840
5843
|
g == null || g.updateObjectOptions(f, u);
|
|
5841
|
-
}, [g]),
|
|
5844
|
+
}, [g]), c = ve((f, u, h) => {
|
|
5842
5845
|
g == null || g.updateConstraint(f, u, h);
|
|
5843
|
-
}, [g]),
|
|
5846
|
+
}, [g]), l = ve((f, u) => {
|
|
5844
5847
|
g == null || g.updateGraphData(f, u);
|
|
5845
5848
|
}, [g]);
|
|
5846
5849
|
return {
|
|
@@ -5853,8 +5856,8 @@ function bi() {
|
|
|
5853
5856
|
setInputText: s,
|
|
5854
5857
|
setInputNumberArray: n,
|
|
5855
5858
|
setInputStringArray: a,
|
|
5856
|
-
updateConstraint:
|
|
5857
|
-
updateGraphData:
|
|
5859
|
+
updateConstraint: c,
|
|
5860
|
+
updateGraphData: l,
|
|
5858
5861
|
updateObjectOptions: r
|
|
5859
5862
|
};
|
|
5860
5863
|
}
|
|
@@ -5877,24 +5880,24 @@ const vi = ({ artboard: g, config: t }) => {
|
|
|
5877
5880
|
f.length > 0 && (r = f[0].geometry.text);
|
|
5878
5881
|
}
|
|
5879
5882
|
r && (e("name", "description", r), e("property", "og:description", r)), i.keywords && i.keywords.length > 0 && e("name", "keywords", i.keywords.join(", "));
|
|
5880
|
-
const
|
|
5881
|
-
|
|
5883
|
+
const c = i.ogImage || g.backgroundImage;
|
|
5884
|
+
c && e("property", "og:image", c), a && e("property", "og:title", a), e("property", "og:type", "website");
|
|
5882
5885
|
}, [i, g, o]);
|
|
5883
|
-
const e = (a, r,
|
|
5884
|
-
let
|
|
5885
|
-
|
|
5886
|
+
const e = (a, r, c) => {
|
|
5887
|
+
let l = document.querySelector(`meta[${a}="${r}"]`);
|
|
5888
|
+
l || (l = document.createElement("meta"), l.setAttribute(a, r), document.head.appendChild(l)), l.setAttribute("content", c);
|
|
5886
5889
|
}, s = () => {
|
|
5887
5890
|
const a = [];
|
|
5888
|
-
return a.push(/* @__PURE__ */ ke("h1", { children: i.title || g.name }, "artboard-title")), g.objects.forEach((
|
|
5891
|
+
return a.push(/* @__PURE__ */ ke("h1", { children: i.title || g.name }, "artboard-title")), g.objects.forEach((c, l) => {
|
|
5889
5892
|
var f, u;
|
|
5890
|
-
if (!(
|
|
5891
|
-
if (((f =
|
|
5892
|
-
const h =
|
|
5893
|
-
h && (
|
|
5894
|
-
} else if (((u =
|
|
5895
|
-
const h =
|
|
5896
|
-
a.push(/* @__PURE__ */ ke("img", { src: h, alt: d },
|
|
5897
|
-
} else
|
|
5893
|
+
if (!(c.visible === !1 || c.isVisible === !1))
|
|
5894
|
+
if (((f = c.geometry) == null ? void 0 : f.type) === "Text") {
|
|
5895
|
+
const h = c.geometry.text;
|
|
5896
|
+
h && (c.geometry.fontSize > 24 ? a.push(/* @__PURE__ */ ke("h2", { children: h }, c.id || l)) : a.push(/* @__PURE__ */ ke("p", { children: h }, c.id || l)));
|
|
5897
|
+
} else if (((u = c.geometry) == null ? void 0 : u.type) === "Image") {
|
|
5898
|
+
const h = c.geometry.src, d = c.altText || c.name || "Illustration";
|
|
5899
|
+
a.push(/* @__PURE__ */ ke("img", { src: h, alt: d }, c.id || l));
|
|
5900
|
+
} else c.type === "Button" && a.push(/* @__PURE__ */ ke("button", { children: c.name || "Button" }, c.id || l));
|
|
5898
5901
|
}), a;
|
|
5899
5902
|
}, n = i.jsonLd || {
|
|
5900
5903
|
"@context": "https://schema.org",
|
|
@@ -5927,7 +5930,7 @@ const vi = ({ artboard: g, config: t }) => {
|
|
|
5927
5930
|
]
|
|
5928
5931
|
}
|
|
5929
5932
|
);
|
|
5930
|
-
}, hi = "6.3.
|
|
5933
|
+
}, hi = "6.3.31", fi = {
|
|
5931
5934
|
version: hi
|
|
5932
5935
|
}, Si = fi.version;
|
|
5933
5936
|
export {
|