exodeui 6.3.18 → 6.3.19
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 +15 -15
- package/dist/index.mjs +900 -849
- package/dist/src/types.d.ts +48 -0
- package/dist/src/utils/skinningUtils.d.ts +27 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -30,7 +30,7 @@ function Ps(p, t, s) {
|
|
|
30
30
|
}
|
|
31
31
|
const Ee = /* @__PURE__ */ new Map();
|
|
32
32
|
function ps(p) {
|
|
33
|
-
var
|
|
33
|
+
var M;
|
|
34
34
|
const {
|
|
35
35
|
text: t,
|
|
36
36
|
fontFamily: s = "Inter",
|
|
@@ -41,41 +41,41 @@ function ps(p) {
|
|
|
41
41
|
width: a = 200,
|
|
42
42
|
letterSpacing: r = 0,
|
|
43
43
|
paragraphSpacing: l = 0,
|
|
44
|
-
paragraphIndent:
|
|
44
|
+
paragraphIndent: f = 0,
|
|
45
45
|
textCase: c = "none",
|
|
46
46
|
segments: g = [],
|
|
47
|
-
enableSegments:
|
|
47
|
+
enableSegments: h = !1
|
|
48
48
|
} = p;
|
|
49
49
|
let d = String(t || "");
|
|
50
|
-
c === "uppercase" ? d = d.toUpperCase() : c === "lowercase" ? d = d.toLowerCase() : c === "capitalize" && (d = d.replace(/\b\w/g, (
|
|
51
|
-
const u = `${i} ${e} ${o}px "${s}", sans-serif`, m = `${d}|${u}|${r}|${l}|${
|
|
50
|
+
c === "uppercase" ? d = d.toUpperCase() : c === "lowercase" ? d = d.toLowerCase() : c === "capitalize" && (d = d.replace(/\b\w/g, (P) => P.toUpperCase())), p.hyphenation === !0 && (d = Ts(d));
|
|
51
|
+
const u = `${i} ${e} ${o}px "${s}", sans-serif`, m = `${d}|${u}|${r}|${l}|${f}|${h}|${JSON.stringify(g)}|hyp:${!!p.hyphenation}|comp:${p.composer}|bal:${!!p.balanceRaggedLines}`;
|
|
52
52
|
let y = Ee.get(m);
|
|
53
|
-
const v = typeof CanvasRenderingContext2D < "u" ? CanvasRenderingContext2D.prototype.measureText : null, b = function(
|
|
53
|
+
const v = typeof CanvasRenderingContext2D < "u" ? CanvasRenderingContext2D.prototype.measureText : null, b = function(P) {
|
|
54
54
|
if (!v) return { width: 0, fontBoundingBoxAscent: 0, fontBoundingBoxDescent: 0 };
|
|
55
|
-
const T = v.call(this,
|
|
56
|
-
return r !== 0 &&
|
|
55
|
+
const T = v.call(this, P);
|
|
56
|
+
return r !== 0 && P && P.length > 0 ? {
|
|
57
57
|
...T,
|
|
58
|
-
width: T.width + (
|
|
58
|
+
width: T.width + (P.length - 1) * r
|
|
59
59
|
} : T;
|
|
60
60
|
};
|
|
61
61
|
if (!y) {
|
|
62
62
|
try {
|
|
63
|
-
if (r !== 0 && typeof CanvasRenderingContext2D < "u" && (CanvasRenderingContext2D.prototype.measureText = b),
|
|
64
|
-
const
|
|
63
|
+
if (r !== 0 && typeof CanvasRenderingContext2D < "u" && (CanvasRenderingContext2D.prototype.measureText = b), h && g && g.length > 0) {
|
|
64
|
+
const P = g.map((T) => {
|
|
65
65
|
let W = T.text || "";
|
|
66
|
-
const
|
|
67
|
-
return
|
|
66
|
+
const k = T.textCase || c || "none";
|
|
67
|
+
return k === "uppercase" ? W.toUpperCase() : k === "lowercase" ? W.toLowerCase() : k === "capitalize" ? W.replace(/\b\w/g, (_) => _.toUpperCase()) : W;
|
|
68
68
|
}).join("");
|
|
69
|
-
if (y = Ye(
|
|
69
|
+
if (y = Ye(P, u), y) {
|
|
70
70
|
let T = 0, W = o;
|
|
71
|
-
for (const
|
|
72
|
-
let _ =
|
|
71
|
+
for (const k of g) {
|
|
72
|
+
let _ = k.text || "";
|
|
73
73
|
if (!_) continue;
|
|
74
|
-
const L =
|
|
74
|
+
const L = k.textCase || c || "none";
|
|
75
75
|
L === "uppercase" ? _ = _.toUpperCase() : L === "lowercase" ? _ = _.toLowerCase() : L === "capitalize" && (_ = _.replace(/\b\w/g, (O) => O.toUpperCase()));
|
|
76
|
-
const x =
|
|
76
|
+
const x = k.fontSize || o;
|
|
77
77
|
x > W && (W = x);
|
|
78
|
-
const
|
|
78
|
+
const A = `${k.fontStyle || i} ${k.fontWeight || e} ${x}px "${k.fontFamily || s}", sans-serif`, $ = Ye(_, A);
|
|
79
79
|
if ($ && $.widths)
|
|
80
80
|
for (let O = 0; O < $.widths.length; O++) {
|
|
81
81
|
const V = T + O;
|
|
@@ -92,57 +92,57 @@ function ps(p) {
|
|
|
92
92
|
}
|
|
93
93
|
T += _.length;
|
|
94
94
|
}
|
|
95
|
-
y.fullText =
|
|
95
|
+
y.fullText = P, y.maxFontSize = W;
|
|
96
96
|
}
|
|
97
97
|
} else
|
|
98
98
|
y = Ye(d, u);
|
|
99
99
|
y && Ee.set(m, y);
|
|
100
|
-
} catch (
|
|
101
|
-
return console.error("[ExodeUI] Pretext prepare failed:",
|
|
100
|
+
} catch (P) {
|
|
101
|
+
return console.error("[ExodeUI] Pretext prepare failed:", P), { width: a, height: 0, lineCount: 0, lines: [] };
|
|
102
102
|
} finally {
|
|
103
103
|
r !== 0 && typeof CanvasRenderingContext2D < "u" && v && (CanvasRenderingContext2D.prototype.measureText = v);
|
|
104
104
|
}
|
|
105
105
|
if (Ee.size > 500) {
|
|
106
|
-
const
|
|
107
|
-
|
|
106
|
+
const P = Ee.keys().next().value;
|
|
107
|
+
P && Ee.delete(P);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
if (
|
|
111
|
-
const
|
|
110
|
+
if (f > 0 && y && y.widths && !y.indentApplied) {
|
|
111
|
+
const P = [...y.widths], T = y.fullText || d;
|
|
112
112
|
let W = !0;
|
|
113
|
-
for (let
|
|
114
|
-
W &&
|
|
115
|
-
` || T[
|
|
116
|
-
` &&
|
|
117
|
-
y = { ...y, widths:
|
|
113
|
+
for (let k = 0; k < T.length; k++)
|
|
114
|
+
W && P[k] !== void 0 && (P[k] += f, W = !1), (T[k] === `
|
|
115
|
+
` || T[k] === "\r") && (W = !0, T[k] === "\r" && T[k + 1] === `
|
|
116
|
+
` && k++);
|
|
117
|
+
y = { ...y, widths: P, indentApplied: !0 };
|
|
118
118
|
}
|
|
119
119
|
if (!y) return { width: a, height: 0, lineCount: 0, lines: [] };
|
|
120
120
|
let C = n;
|
|
121
121
|
typeof C == "string" && (C = parseFloat(C)), C > 5 && o > 0 && (C = C / o), r !== 0 && (CanvasRenderingContext2D.prototype.measureText = b);
|
|
122
122
|
let S;
|
|
123
123
|
try {
|
|
124
|
-
const
|
|
124
|
+
const P = y.maxFontSize || o;
|
|
125
125
|
if (a >= 1e5) {
|
|
126
126
|
const T = d.split(/\r\n|\r|\n/);
|
|
127
127
|
S = {
|
|
128
128
|
lines: T.map((W) => ({ text: W, width: 0 })),
|
|
129
129
|
// Width will be measured below
|
|
130
|
-
height: T.length * (C *
|
|
130
|
+
height: T.length * (C * P),
|
|
131
131
|
lineCount: T.length
|
|
132
132
|
};
|
|
133
133
|
} else
|
|
134
|
-
S = Is(y, a, C *
|
|
134
|
+
S = Is(y, a, C * P);
|
|
135
135
|
} finally {
|
|
136
136
|
r !== 0 && v && (CanvasRenderingContext2D.prototype.measureText = v);
|
|
137
137
|
}
|
|
138
|
-
let I = (S == null ? void 0 : S.height) !== void 0 && S.height > 0 ? S.height : (((
|
|
138
|
+
let I = (S == null ? void 0 : S.height) !== void 0 && S.height > 0 ? S.height : (((M = S == null ? void 0 : S.lines) == null ? void 0 : M.length) || 0) * C * o;
|
|
139
139
|
if (l > 0 && S && S.lines && S.lines.length > 1) {
|
|
140
|
-
let
|
|
140
|
+
let P = 0;
|
|
141
141
|
const T = y.fullText || t;
|
|
142
142
|
for (let W = 0; W < S.lines.length - 1; W++)
|
|
143
|
-
|
|
144
|
-
` || T[
|
|
145
|
-
` &&
|
|
143
|
+
P += S.lines[W].text.length, (T[P] === `
|
|
144
|
+
` || T[P] === "\r") && (I += l, P++, T[P - 1] === "\r" && T[P] === `
|
|
145
|
+
` && P++);
|
|
146
146
|
}
|
|
147
147
|
let w = (S == null ? void 0 : S.lines) || [];
|
|
148
148
|
return p.composer === "every-line" && w.length > 1 && (w = _s(w)), p.balanceRaggedLines === !0 && w.length > 1 && (w = Ps(w)), {
|
|
@@ -162,13 +162,13 @@ function es(p, t, s) {
|
|
|
162
162
|
let n = t - (e.length - 1) * s, a = 0;
|
|
163
163
|
if (e.forEach((r, l) => {
|
|
164
164
|
if (r.endsWith("px")) {
|
|
165
|
-
const
|
|
166
|
-
i[l] =
|
|
165
|
+
const f = parseFloat(r);
|
|
166
|
+
i[l] = f, n -= f;
|
|
167
167
|
} else r.endsWith("fr") ? a += parseFloat(r) : r === "auto" && (i[l] = 100, n -= 100);
|
|
168
168
|
}), a > 0 && n > 0) {
|
|
169
169
|
const r = n / a;
|
|
170
|
-
e.forEach((l,
|
|
171
|
-
l.endsWith("fr") && (i[
|
|
170
|
+
e.forEach((l, f) => {
|
|
171
|
+
l.endsWith("fr") && (i[f] = r * parseFloat(l));
|
|
172
172
|
});
|
|
173
173
|
}
|
|
174
174
|
return i;
|
|
@@ -183,15 +183,15 @@ function ss(p, t, s) {
|
|
|
183
183
|
}
|
|
184
184
|
function Es(p, t, s) {
|
|
185
185
|
var _, L;
|
|
186
|
-
const o = p.autoLayout, { direction: e, spacing: i, padding: n, align: a, wrap: r } = o, l = e === "vertical",
|
|
187
|
-
const
|
|
188
|
-
let O = (
|
|
186
|
+
const o = p.autoLayout, { direction: e, spacing: i, padding: n, align: a, wrap: r } = o, l = e === "vertical", f = t.map((x) => {
|
|
187
|
+
const A = s(x.id), $ = x.geometry;
|
|
188
|
+
let O = (A == null ? void 0 : A.width) ?? $.width ?? 100, V = (A == null ? void 0 : A.height) ?? $.height ?? 100;
|
|
189
189
|
if ($.type === "Ellipse" || $.type === "Polygon" || $.type === "Star") {
|
|
190
|
-
const H = (
|
|
190
|
+
const H = (A == null ? void 0 : A.radius) ?? $.radius ?? (A == null ? void 0 : A.outer_radius) ?? $.outer_radius ?? 50;
|
|
191
191
|
O = H * 2, V = H * 2;
|
|
192
192
|
} else if ($.type === "Text") {
|
|
193
193
|
const H = ps({
|
|
194
|
-
text: (
|
|
194
|
+
text: (A == null ? void 0 : A.text) ?? $.text ?? "",
|
|
195
195
|
fontFamily: $.fontFamily,
|
|
196
196
|
fontSize: $.fontSize,
|
|
197
197
|
fontWeight: $.fontWeight,
|
|
@@ -210,47 +210,47 @@ function Es(p, t, s) {
|
|
|
210
210
|
return O *= x.transform.scale_x || 1, V *= x.transform.scale_y || 1, { id: x.id, w: O, h: V, original: x };
|
|
211
211
|
});
|
|
212
212
|
let c = p.width, g = p.height;
|
|
213
|
-
const
|
|
213
|
+
const h = ((_ = p.layoutProps) == null ? void 0 : _.width) === "hug", d = ((L = p.layoutProps) == null ? void 0 : L.height) === "hug", u = [];
|
|
214
214
|
let m = [], y = 0, v = 0;
|
|
215
215
|
const b = c - n.left - n.right, C = g - n.top - n.bottom;
|
|
216
|
-
|
|
216
|
+
f.forEach((x) => {
|
|
217
217
|
r && m.length > 0 && (l ? v + i + x.h > C : y + i + x.w > b) ? (u.push({ children: m, width: y, height: v }), m = [x], y = x.w, v = x.h) : (m.push(x), l ? (y = Math.max(y, x.w), v += (m.length > 1 ? i : 0) + x.h) : (y += (m.length > 1 ? i : 0) + x.w, v = Math.max(v, x.h)));
|
|
218
|
-
}), m.length > 0 && u.push({ children: m, width: y, height: v }),
|
|
218
|
+
}), m.length > 0 && u.push({ children: m, width: y, height: v }), h && !l && (c = Math.max(...u.map((x) => x.width), 0) + n.left + n.right), d && l && (g = Math.max(...u.map((x) => x.height), 0) + n.top + n.bottom);
|
|
219
219
|
const S = [];
|
|
220
220
|
let I = n.left, w = n.top;
|
|
221
|
-
const
|
|
221
|
+
const M = a.toLowerCase(), P = M === "center" || M.endsWith("-center"), T = M.endsWith("-right"), W = M === "center" || M.startsWith("center-"), k = M.startsWith("bottom-");
|
|
222
222
|
return u.forEach((x) => {
|
|
223
|
-
let
|
|
224
|
-
l ? W ? $ = n.top + (g - n.top - n.bottom - x.height) / 2 :
|
|
223
|
+
let A = I, $ = w;
|
|
224
|
+
l ? W ? $ = n.top + (g - n.top - n.bottom - x.height) / 2 : k && ($ = g - n.bottom - x.height) : P ? A = n.left + (c - n.left - n.right - x.width) / 2 : T && (A = c - n.right - x.width), x.children.forEach((O) => {
|
|
225
225
|
var F, q;
|
|
226
|
-
let V =
|
|
227
|
-
l ?
|
|
228
|
-
const et = ((F = O.original.layoutProps) == null ? void 0 : F.width) === "fill",
|
|
226
|
+
let V = A, H = $;
|
|
227
|
+
l ? P ? V += (x.width - O.w) / 2 : T && (V += x.width - O.w) : W ? H += (x.height - O.h) / 2 : k && (H += x.height - O.h);
|
|
228
|
+
const et = ((F = O.original.layoutProps) == null ? void 0 : F.width) === "fill", E = ((q = O.original.layoutProps) == null ? void 0 : q.height) === "fill";
|
|
229
229
|
S.push({
|
|
230
230
|
id: O.id,
|
|
231
231
|
x: V + O.w / 2 - c / 2,
|
|
232
232
|
y: H + O.h / 2 - g / 2,
|
|
233
233
|
width: et && l ? x.width : void 0,
|
|
234
|
-
height:
|
|
235
|
-
}), l ? $ += O.h + i :
|
|
234
|
+
height: E ? l ? void 0 : x.height : void 0
|
|
235
|
+
}), l ? $ += O.h + i : A += O.w + i;
|
|
236
236
|
}), l ? I += x.width + i : w += x.height + i;
|
|
237
|
-
}), { frameWidth:
|
|
237
|
+
}), { frameWidth: h ? c : void 0, frameHeight: d ? g : void 0, childUpdates: S };
|
|
238
238
|
}
|
|
239
239
|
function xs(p, t, s) {
|
|
240
240
|
const o = p.autoLayout;
|
|
241
241
|
if (!o) return { childUpdates: [] };
|
|
242
242
|
const { gridColumns: e, gridRows: i, columnGap: n = 0, rowGap: a = 0, padding: r, align: l } = o;
|
|
243
|
-
let
|
|
244
|
-
const g =
|
|
245
|
-
let w = 0,
|
|
246
|
-
b ? w = (g - m) / 2 : C && (w = g - m), S ?
|
|
247
|
-
const
|
|
243
|
+
let f = p.width, c = p.height;
|
|
244
|
+
const g = f - r.left - r.right, h = c - r.top - r.bottom, d = es(e || "1fr", g, n), u = es(i || "auto", h, a), m = d.length > 0 ? d.reduce((T, W) => T + W, 0) + (d.length - 1) * n : 0, y = u.length > 0 ? u.reduce((T, W) => T + W, 0) + (u.length - 1) * a : 0, v = l.toLowerCase(), b = v === "center" || v.endsWith("-center"), C = v.endsWith("-right"), S = v === "center" || v.startsWith("center-"), I = v.startsWith("bottom-");
|
|
245
|
+
let w = 0, M = 0;
|
|
246
|
+
b ? w = (g - m) / 2 : C && (w = g - m), S ? M = (h - y) / 2 : I && (M = h - y);
|
|
247
|
+
const P = [];
|
|
248
248
|
return t.forEach((T, W) => {
|
|
249
249
|
var q, Q;
|
|
250
|
-
const
|
|
250
|
+
const k = W % d.length || 0, _ = Math.floor(W / d.length) || 0;
|
|
251
251
|
_ >= u.length && u.push(100);
|
|
252
|
-
const L = d[
|
|
253
|
-
let
|
|
252
|
+
const L = d[k], x = u[_];
|
|
253
|
+
let A = r.left + w + d.slice(0, k).reduce((it, dt) => it + dt + n, 0), $ = r.top + M + u.slice(0, _).reduce((it, dt) => it + dt + a, 0);
|
|
254
254
|
const O = s(T.id), V = T.geometry;
|
|
255
255
|
let H = (O == null ? void 0 : O.width) ?? V.width ?? 100, et = (O == null ? void 0 : O.height) ?? V.height ?? 100;
|
|
256
256
|
if (V.type === "Ellipse" || V.type === "Polygon" || V.type === "Star") {
|
|
@@ -258,15 +258,15 @@ function xs(p, t, s) {
|
|
|
258
258
|
H = it * 2, et = it * 2;
|
|
259
259
|
}
|
|
260
260
|
H *= T.transform.scale_x || 1, et *= T.transform.scale_y || 1;
|
|
261
|
-
let
|
|
262
|
-
b ?
|
|
261
|
+
let E = A, F = $;
|
|
262
|
+
b ? E += (L - H) / 2 : C && (E += L - H), S ? F += (x - et) / 2 : I && (F += x - et), P.push({
|
|
263
263
|
id: T.id,
|
|
264
|
-
x:
|
|
264
|
+
x: E + H / 2 - f / 2,
|
|
265
265
|
y: F + et / 2 - c / 2,
|
|
266
266
|
width: ((q = T.layoutProps) == null ? void 0 : q.width) === "fill" ? L : void 0,
|
|
267
267
|
height: ((Q = T.layoutProps) == null ? void 0 : Q.height) === "fill" ? x : void 0
|
|
268
268
|
});
|
|
269
|
-
}), { childUpdates:
|
|
269
|
+
}), { childUpdates: P };
|
|
270
270
|
}
|
|
271
271
|
class As {
|
|
272
272
|
constructor() {
|
|
@@ -374,17 +374,17 @@ class As {
|
|
|
374
374
|
const us = (p) => p, Os = (p) => p > 0 ? 1 : 0, Rs = (p) => p < 1 ? 0 : 1, is = (p) => p * p, ns = (p) => p * (2 - p), os = (p) => p < 0.5 ? 2 * p * p : -1 + (4 - 2 * p) * p, Ls = (p) => p * p * p, Fs = (p) => --p * p * p + 1, $s = (p) => p < 0.5 ? 4 * p * p * p : (p - 1) * (2 * p - 2) * (2 * p - 2) + 1, Ws = (p) => p * p * p * p, Bs = (p) => 1 - --p * p * p * p, Gs = (p) => p < 0.5 ? 8 * p * p * p * p : 1 - 8 * --p * p * p * p, Ys = (p) => p * p * p * p * p, Xs = (p) => 1 + --p * p * p * p * p, Ds = (p) => p < 0.5 ? 16 * p * p * p * p * p : 1 + 16 * --p * p * p * p * p, zs = (p) => 1 - Math.cos(p * Math.PI / 2), Vs = (p) => Math.sin(p * Math.PI / 2), Ns = (p) => -(Math.cos(Math.PI * p) - 1) / 2, Hs = (p) => p === 0 ? 0 : Math.pow(2, 10 * (p - 1)), Us = (p) => p === 1 ? 1 : 1 - Math.pow(2, -10 * p), qs = (p) => p === 0 ? 0 : p === 1 ? 1 : p < 0.5 ? Math.pow(2, 20 * p - 10) / 2 : (2 - Math.pow(2, -20 * p + 10)) / 2, Js = (p) => 1 - Math.sqrt(1 - p * p), Qs = (p) => Math.sqrt(1 - --p * p), Ks = (p) => p < 0.5 ? (1 - Math.sqrt(1 - 4 * p * p)) / 2 : (Math.sqrt(1 - (-2 * p + 2) * (-2 * p + 2)) + 1) / 2, Ge = 1.70158, $e = Ge * 1.525, gs = Ge + 1, Zs = (p) => gs * p * p * p - Ge * p * p, js = (p) => 1 + gs * Math.pow(p - 1, 3) + Ge * Math.pow(p - 1, 2), ti = (p) => p < 0.5 ? Math.pow(2 * p, 2) * (($e + 1) * 2 * p - $e) / 2 : (Math.pow(2 * p - 2, 2) * (($e + 1) * (p * 2 - 2) + $e) + 2) / 2, ms = 2 * Math.PI / 3, as = 2 * Math.PI / 4.5, ei = (p) => p === 0 ? 0 : p === 1 ? 1 : -Math.pow(2, 10 * p - 10) * Math.sin((p * 10 - 10.75) * ms), si = (p) => p === 0 ? 0 : p === 1 ? 1 : Math.pow(2, -10 * p) * Math.sin((p * 10 - 0.75) * ms) + 1, ii = (p) => p === 0 ? 0 : p === 1 ? 1 : p < 0.5 ? -(Math.pow(2, 20 * p - 10) * Math.sin((20 * p - 11.125) * as)) / 2 : Math.pow(2, -20 * p + 10) * Math.sin((20 * p - 11.125) * as) / 2 + 1, Be = (p) => p < 1 / 2.75 ? 7.5625 * p * p : p < 2 / 2.75 ? 7.5625 * (p -= 1.5 / 2.75) * p + 0.75 : p < 2.5 / 2.75 ? 7.5625 * (p -= 2.25 / 2.75) * p + 0.9375 : 7.5625 * (p -= 2.625 / 2.75) * p + 0.984375, ni = (p) => 1 - Be(1 - p), oi = Be, ai = (p) => p < 0.5 ? (1 - Be(1 - 2 * p)) / 2 : (1 + Be(2 * p - 1)) / 2, Xe = /* @__PURE__ */ new Map(), xe = (p, t, s, o) => {
|
|
375
375
|
const e = `${p},${t},${s},${o}`;
|
|
376
376
|
if (Xe.has(e)) return Xe.get(e);
|
|
377
|
-
const i = (
|
|
378
|
-
let c =
|
|
377
|
+
const i = (f) => (1 - 3 * s + 3 * p) * f * f * f + (3 * s - 6 * p) * f * f + 3 * p * f, n = (f) => (1 - 3 * o + 3 * t) * f * f * f + (3 * o - 6 * t) * f * f + 3 * t * f, a = (f) => 3 * (1 - 3 * s + 3 * p) * f * f + 2 * (3 * s - 6 * p) * f + 3 * p, r = (f) => {
|
|
378
|
+
let c = f;
|
|
379
379
|
for (let g = 0; g < 8; g++) {
|
|
380
|
-
const
|
|
381
|
-
if (Math.abs(
|
|
380
|
+
const h = i(c) - f;
|
|
381
|
+
if (Math.abs(h) < 1e-6) return c;
|
|
382
382
|
const d = a(c);
|
|
383
383
|
if (Math.abs(d) < 1e-6) break;
|
|
384
|
-
c = c -
|
|
384
|
+
c = c - h / d;
|
|
385
385
|
}
|
|
386
386
|
return c;
|
|
387
|
-
}, l = (
|
|
387
|
+
}, l = (f) => f === 0 ? 0 : f === 1 ? 1 : n(r(f));
|
|
388
388
|
return Xe.set(e, l), l;
|
|
389
389
|
}, rs = (p) => {
|
|
390
390
|
const t = p.match(/cubic-bezier\s*\(\s*([-?\d.]+)\s*,\s*([-?\d.]+)\s*,\s*([-?\d.]+)\s*,\s*([-?\d.]+)\s*\)/);
|
|
@@ -514,6 +514,43 @@ const us = (p) => p, Os = (p) => p > 0 ? 1 : 0, Rs = (p) => p < 1 ? 0 : 1, is =
|
|
|
514
514
|
description: "Slow start, massive impact.",
|
|
515
515
|
value: "cubic-bezier(0.6, 0, 1, 1)"
|
|
516
516
|
}
|
|
517
|
+
}, li = (p, t, s, o, e) => {
|
|
518
|
+
if (!p || !t || !s) return p;
|
|
519
|
+
const i = o.scale_x ?? 1, n = o.scale_y ?? 1, a = (r, l, f) => {
|
|
520
|
+
let c = 0, g = 0;
|
|
521
|
+
const h = o.rotation * Math.PI / 180, d = Math.cos(h), u = Math.sin(h), m = r * i * d - l * n * u + o.x, y = r * i * u + l * n * d + o.y;
|
|
522
|
+
f.forEach((w) => {
|
|
523
|
+
const M = e(w.boneId);
|
|
524
|
+
if (!M) return;
|
|
525
|
+
const P = {
|
|
526
|
+
x: M.x,
|
|
527
|
+
y: M.y,
|
|
528
|
+
rotation: M.rotation,
|
|
529
|
+
scaleX: M.scale_x ?? 1,
|
|
530
|
+
scaleY: M.scale_y ?? 1
|
|
531
|
+
}, T = s[w.boneId] || [1, 0, 0, 1, 0, 0], W = m * T[0] + y * T[2] + T[4], k = m * T[1] + y * T[3] + T[5], _ = P.rotation * Math.PI / 180, L = Math.cos(_), x = Math.sin(_), A = W * P.scaleX * L - k * P.scaleY * x + P.x, $ = W * P.scaleX * x + k * P.scaleY * L + P.y;
|
|
532
|
+
c += A * w.amount, g += $ * w.amount;
|
|
533
|
+
});
|
|
534
|
+
const v = o.rotation * Math.PI / 180, b = Math.cos(v), C = Math.sin(v), S = c - o.x, I = g - o.y;
|
|
535
|
+
return {
|
|
536
|
+
x: (S * b + I * C) / i,
|
|
537
|
+
y: (-S * C + I * b) / n
|
|
538
|
+
};
|
|
539
|
+
};
|
|
540
|
+
return p.map((r, l) => {
|
|
541
|
+
const f = t[l];
|
|
542
|
+
if (!f || f.length === 0) return { ...r };
|
|
543
|
+
const c = { ...r, ...a(r.x, r.y, f) };
|
|
544
|
+
if (r.in_x !== void 0 && r.in_y !== void 0) {
|
|
545
|
+
const g = a(r.in_x, r.in_y, f);
|
|
546
|
+
c.in_x = g.x, c.in_y = g.y;
|
|
547
|
+
}
|
|
548
|
+
if (r.out_x !== void 0 && r.out_y !== void 0) {
|
|
549
|
+
const g = a(r.out_x, r.out_y, f);
|
|
550
|
+
c.out_x = g.x, c.out_y = g.y;
|
|
551
|
+
}
|
|
552
|
+
return c;
|
|
553
|
+
});
|
|
517
554
|
}, fs = {
|
|
518
555
|
default: {
|
|
519
556
|
label: "Default",
|
|
@@ -643,7 +680,7 @@ const us = (p) => p, Os = (p) => p > 0 ? 1 : 0, Rs = (p) => p < 1 ? 0 : 1, is =
|
|
|
643
680
|
centerLabelColor: "rgba(255,255,255,0.4)"
|
|
644
681
|
}
|
|
645
682
|
};
|
|
646
|
-
class
|
|
683
|
+
class ci {
|
|
647
684
|
constructor() {
|
|
648
685
|
tt(this, "artboard", null);
|
|
649
686
|
tt(this, "objectStates", /* @__PURE__ */ new Map());
|
|
@@ -783,9 +820,9 @@ class li {
|
|
|
783
820
|
}
|
|
784
821
|
svgPathToPoints(t) {
|
|
785
822
|
const s = /([MLHVCSQTAZmlhvcsqtaz])([^MLHVCSQTAZmlhvcsqtaz]*)/g, o = /[-+]?(?:\d*\.\d+|\d+)(?:[eE][-+]?\d+)?/g, e = [];
|
|
786
|
-
let i = !1, n = 0, a = 0, r = 0, l = 0,
|
|
823
|
+
let i = !1, n = 0, a = 0, r = 0, l = 0, f = 0, c = 0, g;
|
|
787
824
|
for (; (g = s.exec(t)) !== null; ) {
|
|
788
|
-
const
|
|
825
|
+
const h = g[1], d = (g[2].match(o) || []).map(parseFloat), u = h === h.toLowerCase(), m = h.toUpperCase();
|
|
789
826
|
let y = 0;
|
|
790
827
|
const v = (C) => {
|
|
791
828
|
let S = d[y++];
|
|
@@ -794,7 +831,7 @@ class li {
|
|
|
794
831
|
switch (m) {
|
|
795
832
|
case "M": {
|
|
796
833
|
const C = b();
|
|
797
|
-
for (
|
|
834
|
+
for (f = n = C.x, c = a = C.y, e.push({ x: n, y: a, in_x: n, in_y: a, out_x: n, out_y: a, moveTo: !0 }); y < d.length; ) {
|
|
798
835
|
const S = b();
|
|
799
836
|
n = S.x, a = S.y, e.push({ x: n, y: a, in_x: n, in_y: a, out_x: n, out_y: a });
|
|
800
837
|
}
|
|
@@ -861,7 +898,7 @@ class li {
|
|
|
861
898
|
const S = [...e].reverse().find((I) => I.moveTo) || e[0];
|
|
862
899
|
S && Math.hypot(S.x - C.x, S.y - C.y) < 0.1 && (S.in_x = C.in_x, S.in_y = C.in_y, e.pop(), e.length > 0 && (e[e.length - 1].closePath = !0));
|
|
863
900
|
}
|
|
864
|
-
n =
|
|
901
|
+
n = f, a = c;
|
|
865
902
|
break;
|
|
866
903
|
default:
|
|
867
904
|
if (d.length >= 2) {
|
|
@@ -934,8 +971,8 @@ class li {
|
|
|
934
971
|
const o = [], e = /* @__PURE__ */ new Set(), i = (r) => {
|
|
935
972
|
r && r.forEach((l) => {
|
|
936
973
|
if (e.has(l.id)) return;
|
|
937
|
-
const
|
|
938
|
-
e.add(
|
|
974
|
+
const f = { ...l }, c = f.childrenObjects || [];
|
|
975
|
+
e.add(f.id), o.push(f), i(c);
|
|
939
976
|
});
|
|
940
977
|
};
|
|
941
978
|
if (i(s.objects || []), o.length > (s.objects || []).length && console.log(`[Engine] Flattened artboard from ${(s.objects || []).length} to ${o.length} objects.`), s.objects = o, this.artboard = s, this.currentTime = 0, this.objectStates.clear(), console.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) {
|
|
@@ -944,8 +981,8 @@ class li {
|
|
|
944
981
|
r.set(l.id, l), l.children || (l.children = []);
|
|
945
982
|
}), this.artboard.objects.forEach((l) => {
|
|
946
983
|
if (l.parentId) {
|
|
947
|
-
const
|
|
948
|
-
|
|
984
|
+
const f = r.get(l.parentId);
|
|
985
|
+
f && (f.children || (f.children = []), f.children.includes(l.id) || f.children.push(l.id));
|
|
949
986
|
}
|
|
950
987
|
});
|
|
951
988
|
}
|
|
@@ -995,11 +1032,11 @@ class li {
|
|
|
995
1032
|
reset() {
|
|
996
1033
|
if (!this.artboard) return;
|
|
997
1034
|
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((s) => {
|
|
998
|
-
var n, a, r, l,
|
|
1035
|
+
var n, a, r, l, f, c, g;
|
|
999
1036
|
const o = s.width ?? ((n = s.geometry) == null ? void 0 : n.width) ?? 0, e = s.height ?? ((a = s.geometry) == null ? void 0 : a.height) ?? 0, i = s.cornerRadius ?? s.corner_radius ?? ((r = s.geometry) == null ? void 0 : r.corner_radius) ?? ((l = s.geometry) == null ? void 0 : l.cornerRadius) ?? 0;
|
|
1000
1037
|
this.objectStates.set(s.id, {
|
|
1001
1038
|
...s.transform || {},
|
|
1002
|
-
x: ((
|
|
1039
|
+
x: ((f = s.transform) == null ? void 0 : f.x) ?? s.x ?? 0,
|
|
1003
1040
|
y: ((c = s.transform) == null ? void 0 : c.y) ?? s.y ?? 0,
|
|
1004
1041
|
width: o,
|
|
1005
1042
|
height: e,
|
|
@@ -1080,8 +1117,8 @@ class li {
|
|
|
1080
1117
|
n.forEach((a) => {
|
|
1081
1118
|
const r = this.objectStates.get(a.id);
|
|
1082
1119
|
if (r) {
|
|
1083
|
-
const l = Math.abs(r.x - a.x),
|
|
1084
|
-
!t && (l > 20 ||
|
|
1120
|
+
const l = Math.abs(r.x - a.x), f = Math.abs(r.y - a.y);
|
|
1121
|
+
!t && (l > 20 || f > 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);
|
|
1085
1122
|
}
|
|
1086
1123
|
});
|
|
1087
1124
|
};
|
|
@@ -1094,8 +1131,8 @@ class li {
|
|
|
1094
1131
|
if (n.type === "Frame" && ((a = n.autoLayout) != null && a.enabled) && n.children && n.children.length > 0) {
|
|
1095
1132
|
const r = n.children.map((c) => s.get(c)).filter((c) => !!c), l = this.objectStates.get(n.id);
|
|
1096
1133
|
if (!l) return;
|
|
1097
|
-
const
|
|
1098
|
-
|
|
1134
|
+
const f = ss(l, r, (c) => this.objectStates.get(c));
|
|
1135
|
+
f.frameWidth !== void 0 && (l.width = f.frameWidth), f.frameHeight !== void 0 && (l.height = f.frameHeight), e(f.childUpdates);
|
|
1099
1136
|
}
|
|
1100
1137
|
});
|
|
1101
1138
|
}
|
|
@@ -1146,15 +1183,15 @@ class li {
|
|
|
1146
1183
|
const a = this.activeStateMachine.layers.find((r) => r.name === t);
|
|
1147
1184
|
if (a)
|
|
1148
1185
|
for (const r of s) {
|
|
1149
|
-
const l = a.states.find((
|
|
1186
|
+
const l = a.states.find((f) => f.id === r);
|
|
1150
1187
|
if (l) {
|
|
1151
|
-
let
|
|
1152
|
-
l.animationId && (
|
|
1188
|
+
let f = null;
|
|
1189
|
+
l.animationId && (f = this.artboard.animations.find((c) => c.id === l.animationId) || null), f || (f = this.artboard.animations.find(
|
|
1153
1190
|
(c) => {
|
|
1154
|
-
var g,
|
|
1155
|
-
return c.name === l.name || c.id === l.name || (l.name === "Entry" || l.id === "entry") && (((g = c.name) == null ? void 0 : g.toLowerCase()) === "onload" || ((
|
|
1191
|
+
var g, h;
|
|
1192
|
+
return c.name === l.name || c.id === l.name || (l.name === "Entry" || l.id === "entry") && (((g = c.name) == null ? void 0 : g.toLowerCase()) === "onload" || ((h = c.name) == null ? void 0 : h.toLowerCase()) === "intro");
|
|
1156
1193
|
}
|
|
1157
|
-
) || null),
|
|
1194
|
+
) || null), f && ((n = this.artboard.animationFlow) != null && n.some((g) => (g.trigger === "on_load" || g.trigger === "after_delay") && g.targetAnimationId === (f == null ? void 0 : f.id)) || (e.push({ animation: f, state: l }), i = Math.max(i, f.duration)));
|
|
1158
1195
|
}
|
|
1159
1196
|
}
|
|
1160
1197
|
}
|
|
@@ -1200,13 +1237,13 @@ class li {
|
|
|
1200
1237
|
var n, a, r;
|
|
1201
1238
|
let o;
|
|
1202
1239
|
if (this.inputs.has(t)) {
|
|
1203
|
-
const l = (n = this.activeStateMachine) == null ? void 0 : n.inputs.find((
|
|
1240
|
+
const l = (n = this.activeStateMachine) == null ? void 0 : n.inputs.find((f) => f.id === t);
|
|
1204
1241
|
l && typeof l.value == "object" && (o = l.value.type);
|
|
1205
1242
|
} else {
|
|
1206
1243
|
const l = this.inputNameMap.get(t);
|
|
1207
1244
|
if (l && l.length > 0) {
|
|
1208
|
-
const
|
|
1209
|
-
|
|
1245
|
+
const f = (a = this.activeStateMachine) == null ? void 0 : a.inputs.find((c) => c.id === l[0]);
|
|
1246
|
+
f && typeof f.value == "object" && (o = f.value.type);
|
|
1210
1247
|
}
|
|
1211
1248
|
}
|
|
1212
1249
|
let e = s;
|
|
@@ -1214,8 +1251,8 @@ class li {
|
|
|
1214
1251
|
const i = this.inputNameMap.get(t);
|
|
1215
1252
|
i && i.forEach((l) => this.setInternalInput(l, e)), o === "Trigger" && e === !0 && (this.justFiredTriggers.add(t), i && i.forEach((l) => this.justFiredTriggers.add(l))), Array.isArray(e) && ((r = this.artboard) == null || r.objects.forEach((l) => {
|
|
1216
1253
|
if (l.inputId === t || l.name === t) {
|
|
1217
|
-
const
|
|
1218
|
-
|
|
1254
|
+
const f = this.objectStates.get(l.id);
|
|
1255
|
+
f && f.options && (l.type === "ListView" || l.variant === "listview" ? f.options.items = e : (l.type === "Dropdown" || l.variant === "dropdown") && (f.options.optionsList = e));
|
|
1219
1256
|
}
|
|
1220
1257
|
})), this.evaluateTransitions(), this.evaluateVariableTriggers(t, e);
|
|
1221
1258
|
}
|
|
@@ -1259,8 +1296,8 @@ class li {
|
|
|
1259
1296
|
break;
|
|
1260
1297
|
}
|
|
1261
1298
|
if (l) {
|
|
1262
|
-
const
|
|
1263
|
-
|
|
1299
|
+
const f = i.delay || 0;
|
|
1300
|
+
f <= 0 ? this.triggerGlobalAnimation(i.targetAnimationId, i.subAnimationIds, i.loop, i.id) : setTimeout(() => this.triggerGlobalAnimation(i.targetAnimationId, i.subAnimationIds, i.loop, i.id), f);
|
|
1264
1301
|
}
|
|
1265
1302
|
}
|
|
1266
1303
|
});
|
|
@@ -1360,36 +1397,36 @@ class li {
|
|
|
1360
1397
|
});
|
|
1361
1398
|
}
|
|
1362
1399
|
evaluateLogicTree(t, s = null, o = /* @__PURE__ */ new Set()) {
|
|
1363
|
-
var a, r, l,
|
|
1400
|
+
var a, r, l, f, c, g;
|
|
1364
1401
|
if (o.has(t))
|
|
1365
1402
|
return this.inputs.get(t) ?? this.logicNodeValues.get(t) ?? 0;
|
|
1366
1403
|
o.add(t);
|
|
1367
|
-
const e = (r = (a = this.activeStateMachine) == null ? void 0 : a.logicNodes) == null ? void 0 : r.find((
|
|
1404
|
+
const e = (r = (a = this.activeStateMachine) == null ? void 0 : a.logicNodes) == null ? void 0 : r.find((h) => h.id === t);
|
|
1368
1405
|
if (e) {
|
|
1369
|
-
const
|
|
1406
|
+
const h = (u, m) => {
|
|
1370
1407
|
const y = e.inputs.find((v) => v.id === u);
|
|
1371
1408
|
return y ? y.sourceId ? this.evaluateLogicTree(y.sourceId, y.sourceHandleId, o) : y.value !== void 0 ? y.value : m : m;
|
|
1372
1409
|
};
|
|
1373
1410
|
let d = 0;
|
|
1374
1411
|
switch (e.op) {
|
|
1375
1412
|
case Ct.AND:
|
|
1376
|
-
d =
|
|
1413
|
+
d = h("a", !1) && h("b", !1);
|
|
1377
1414
|
break;
|
|
1378
1415
|
case Ct.OR:
|
|
1379
|
-
d =
|
|
1416
|
+
d = h("a", !1) || h("b", !1);
|
|
1380
1417
|
break;
|
|
1381
1418
|
case Ct.NOT:
|
|
1382
|
-
d = !
|
|
1419
|
+
d = !h("in", !1);
|
|
1383
1420
|
break;
|
|
1384
1421
|
case Ct.XOR:
|
|
1385
|
-
d = !!
|
|
1422
|
+
d = !!h("a", !1) != !!h("b", !1);
|
|
1386
1423
|
break;
|
|
1387
1424
|
case Ct.OBJECT:
|
|
1388
1425
|
d = e.name;
|
|
1389
1426
|
break;
|
|
1390
1427
|
case Ct.PROPERTY:
|
|
1391
1428
|
case Ct.GET_PROPERTY: {
|
|
1392
|
-
const u =
|
|
1429
|
+
const u = h("id", "");
|
|
1393
1430
|
if (!u) {
|
|
1394
1431
|
d = 0;
|
|
1395
1432
|
break;
|
|
@@ -1408,7 +1445,7 @@ class li {
|
|
|
1408
1445
|
break;
|
|
1409
1446
|
}
|
|
1410
1447
|
case Ct.SET_PROPERTY: {
|
|
1411
|
-
const u =
|
|
1448
|
+
const u = h("id", ""), m = h("value", void 0);
|
|
1412
1449
|
if (!u || m === void 0) {
|
|
1413
1450
|
d = 0;
|
|
1414
1451
|
break;
|
|
@@ -1429,8 +1466,8 @@ class li {
|
|
|
1429
1466
|
const C = y.split(".");
|
|
1430
1467
|
let S = v;
|
|
1431
1468
|
for (let w = 0; w < C.length - 1; w++) {
|
|
1432
|
-
const
|
|
1433
|
-
S[
|
|
1469
|
+
const M = C[w];
|
|
1470
|
+
S[M] === void 0 && (S[M] = {}), S = S[M];
|
|
1434
1471
|
}
|
|
1435
1472
|
const I = C[C.length - 1];
|
|
1436
1473
|
S[I] = m, d = m;
|
|
@@ -1438,76 +1475,76 @@ class li {
|
|
|
1438
1475
|
break;
|
|
1439
1476
|
}
|
|
1440
1477
|
case Ct.ADD:
|
|
1441
|
-
d =
|
|
1478
|
+
d = h("a", 0) + h("b", 0);
|
|
1442
1479
|
break;
|
|
1443
1480
|
case Ct.SUB:
|
|
1444
|
-
d =
|
|
1481
|
+
d = h("a", 0) - h("b", 0);
|
|
1445
1482
|
break;
|
|
1446
1483
|
case Ct.MUL:
|
|
1447
|
-
d =
|
|
1484
|
+
d = h("a", 0) * h("b", 0);
|
|
1448
1485
|
break;
|
|
1449
1486
|
case Ct.DIV: {
|
|
1450
|
-
const u =
|
|
1451
|
-
d = u === 0 ? 0 :
|
|
1487
|
+
const u = h("b", 1);
|
|
1488
|
+
d = u === 0 ? 0 : h("a", 0) / u;
|
|
1452
1489
|
break;
|
|
1453
1490
|
}
|
|
1454
1491
|
case Ct.MOD:
|
|
1455
|
-
d =
|
|
1492
|
+
d = h("a", 0) % h("b", 1);
|
|
1456
1493
|
break;
|
|
1457
1494
|
case Ct.POW:
|
|
1458
|
-
d = Math.pow(
|
|
1495
|
+
d = Math.pow(h("a", 0), h("b", 1));
|
|
1459
1496
|
break;
|
|
1460
1497
|
case Ct.ABS:
|
|
1461
|
-
d = Math.abs(
|
|
1498
|
+
d = Math.abs(h("in", 0));
|
|
1462
1499
|
break;
|
|
1463
1500
|
case Ct.ROUND:
|
|
1464
|
-
d = Math.round(
|
|
1501
|
+
d = Math.round(h("in", 0));
|
|
1465
1502
|
break;
|
|
1466
1503
|
case Ct.FLOOR:
|
|
1467
|
-
d = Math.floor(
|
|
1504
|
+
d = Math.floor(h("in", 0));
|
|
1468
1505
|
break;
|
|
1469
1506
|
case Ct.CEIL:
|
|
1470
|
-
d = Math.ceil(
|
|
1507
|
+
d = Math.ceil(h("in", 0));
|
|
1471
1508
|
break;
|
|
1472
1509
|
case Ct.SIN:
|
|
1473
|
-
d = Math.sin(
|
|
1510
|
+
d = Math.sin(h("in", 0));
|
|
1474
1511
|
break;
|
|
1475
1512
|
case Ct.COS:
|
|
1476
|
-
d = Math.cos(
|
|
1513
|
+
d = Math.cos(h("in", 0));
|
|
1477
1514
|
break;
|
|
1478
1515
|
case Ct.TAN:
|
|
1479
|
-
d = Math.tan(
|
|
1516
|
+
d = Math.tan(h("in", 0));
|
|
1480
1517
|
break;
|
|
1481
1518
|
case Ct.CLAMP: {
|
|
1482
|
-
const u =
|
|
1519
|
+
const u = h("in", 0), m = h("min", 0), y = h("max", 1);
|
|
1483
1520
|
d = Math.max(m, Math.min(y, u));
|
|
1484
1521
|
break;
|
|
1485
1522
|
}
|
|
1486
1523
|
case Ct.REMAP: {
|
|
1487
|
-
const u =
|
|
1524
|
+
const u = h("in", 0), m = h("inMin", 0), y = h("inMax", 100), v = h("outMin", 0), b = h("outMax", 1);
|
|
1488
1525
|
d = y === m ? v : v + (u - m) * (b - v) / (y - m);
|
|
1489
1526
|
break;
|
|
1490
1527
|
}
|
|
1491
1528
|
case Ct.EQ:
|
|
1492
|
-
d =
|
|
1529
|
+
d = h("a", 0) == h("b", 0);
|
|
1493
1530
|
break;
|
|
1494
1531
|
case Ct.NEQ:
|
|
1495
|
-
d =
|
|
1532
|
+
d = h("a", 0) != h("b", 0);
|
|
1496
1533
|
break;
|
|
1497
1534
|
case Ct.GT:
|
|
1498
|
-
d =
|
|
1535
|
+
d = h("a", 0) > h("b", 0);
|
|
1499
1536
|
break;
|
|
1500
1537
|
case Ct.LT:
|
|
1501
|
-
d =
|
|
1538
|
+
d = h("a", 0) < h("b", 0);
|
|
1502
1539
|
break;
|
|
1503
1540
|
case Ct.GTE:
|
|
1504
|
-
d =
|
|
1541
|
+
d = h("a", 0) >= h("b", 0);
|
|
1505
1542
|
break;
|
|
1506
1543
|
case Ct.LTE:
|
|
1507
|
-
d =
|
|
1544
|
+
d = h("a", 0) <= h("b", 0);
|
|
1508
1545
|
break;
|
|
1509
1546
|
case Ct.IF_ELSE:
|
|
1510
|
-
d =
|
|
1547
|
+
d = h("cond", !1) ? h("then", 0) : h("else", 0);
|
|
1511
1548
|
break;
|
|
1512
1549
|
case Ct.VALUE:
|
|
1513
1550
|
d = e.value !== void 0 ? e.value : 0;
|
|
@@ -1516,7 +1553,7 @@ class li {
|
|
|
1516
1553
|
d = this.inputs.get(e.name) ?? 0;
|
|
1517
1554
|
break;
|
|
1518
1555
|
case Ct.LOG: {
|
|
1519
|
-
const u =
|
|
1556
|
+
const u = h("in", "");
|
|
1520
1557
|
this.debugLog(`[User Logic] ${u}`), d = u;
|
|
1521
1558
|
break;
|
|
1522
1559
|
}
|
|
@@ -1536,7 +1573,7 @@ class li {
|
|
|
1536
1573
|
d = this.inputs.get("isMouseDown") ?? !1;
|
|
1537
1574
|
break;
|
|
1538
1575
|
case Ct.EFFECTOR: {
|
|
1539
|
-
const u =
|
|
1576
|
+
const u = h("id", ""), m = h("intensity", 1), y = h("trigger", !0);
|
|
1540
1577
|
if (!u || !y) {
|
|
1541
1578
|
d = 0;
|
|
1542
1579
|
break;
|
|
@@ -1561,11 +1598,11 @@ class li {
|
|
|
1561
1598
|
break;
|
|
1562
1599
|
}
|
|
1563
1600
|
case Ct.MONITOR: {
|
|
1564
|
-
d =
|
|
1601
|
+
d = h("in", 0);
|
|
1565
1602
|
break;
|
|
1566
1603
|
}
|
|
1567
1604
|
case Ct.SPRING_PULL: {
|
|
1568
|
-
const u =
|
|
1605
|
+
const u = h("objectId", ""), m = h("forceX", 0), y = h("forceY", 0);
|
|
1569
1606
|
u && ((l = this.artboard) == null || l.objects.forEach((v) => {
|
|
1570
1607
|
v.behaviors && v.behaviors.forEach((b) => {
|
|
1571
1608
|
var C;
|
|
@@ -1573,10 +1610,10 @@ class li {
|
|
|
1573
1610
|
this._springChainState.has(v.id) || this._springChainState.set(v.id, /* @__PURE__ */ new Map());
|
|
1574
1611
|
const I = this._springChainState.get(v.id);
|
|
1575
1612
|
if (!I.has(u)) {
|
|
1576
|
-
const
|
|
1613
|
+
const M = this.objectStates.get(u);
|
|
1577
1614
|
I.set(u, {
|
|
1578
|
-
x: (
|
|
1579
|
-
y: (
|
|
1615
|
+
x: (M == null ? void 0 : M.x) ?? 0,
|
|
1616
|
+
y: (M == null ? void 0 : M.y) ?? 0,
|
|
1580
1617
|
vx: 0,
|
|
1581
1618
|
vy: 0
|
|
1582
1619
|
});
|
|
@@ -1589,10 +1626,10 @@ class li {
|
|
|
1589
1626
|
break;
|
|
1590
1627
|
}
|
|
1591
1628
|
case Ct.SPRING_SETTLE: {
|
|
1592
|
-
const u =
|
|
1629
|
+
const u = h("objectId", "");
|
|
1593
1630
|
let m = !0;
|
|
1594
1631
|
if (u) {
|
|
1595
|
-
const y =
|
|
1632
|
+
const y = h("threshold", 1);
|
|
1596
1633
|
this._springChainState.forEach((v) => {
|
|
1597
1634
|
const b = v.get(u);
|
|
1598
1635
|
b && (Math.abs(b.vx) > y || Math.abs(b.vy) > y) && (m = !1);
|
|
@@ -1602,8 +1639,8 @@ class li {
|
|
|
1602
1639
|
break;
|
|
1603
1640
|
}
|
|
1604
1641
|
case Ct.EMIT: {
|
|
1605
|
-
const u =
|
|
1606
|
-
u && ((
|
|
1642
|
+
const u = h("objectId", ""), m = h("count", 20);
|
|
1643
|
+
u && ((f = this.artboard) == null || f.objects.forEach((y) => {
|
|
1607
1644
|
y.behaviors && y.behaviors.forEach((v) => {
|
|
1608
1645
|
v.type === Y.ParticleEmitter && y.id === u && (v._pendingBurst = (v._pendingBurst || 0) + m);
|
|
1609
1646
|
});
|
|
@@ -1615,7 +1652,7 @@ class li {
|
|
|
1615
1652
|
break;
|
|
1616
1653
|
}
|
|
1617
1654
|
if (this.logicNodeValues.set(t, d), e.op === Ct.DELAY) {
|
|
1618
|
-
const u =
|
|
1655
|
+
const u = h("delay", 0), m = h("in", 0);
|
|
1619
1656
|
let y = this.logicNodeState.get(t);
|
|
1620
1657
|
for (y || (y = { queue: [] }, this.logicNodeState.set(t, y)), y.queue.push({ time: this.currentTime + u, value: m }); y.queue.length > 0 && y.queue[0].time <= this.currentTime; )
|
|
1621
1658
|
y.lastValue = y.queue.shift().value;
|
|
@@ -1623,16 +1660,16 @@ class li {
|
|
|
1623
1660
|
}
|
|
1624
1661
|
return d;
|
|
1625
1662
|
}
|
|
1626
|
-
const i = (c = this.activeStateMachine) == null ? void 0 : c.inputs.find((
|
|
1663
|
+
const i = (c = this.activeStateMachine) == null ? void 0 : c.inputs.find((h) => h.id === t || h.name === t);
|
|
1627
1664
|
if (i && i.sourceId && !o.has(i.sourceId)) {
|
|
1628
|
-
const
|
|
1629
|
-
return this.inputs.set(i.id,
|
|
1665
|
+
const h = this.evaluateLogicTree(i.sourceId, i.sourceHandleId, o);
|
|
1666
|
+
return this.inputs.set(i.id, h), h;
|
|
1630
1667
|
}
|
|
1631
1668
|
let n = this.inputs.get(t) ?? (i ? this.inputs.get(i.id) : void 0);
|
|
1632
1669
|
if ((this.justFiredTriggers.has(t) || i && this.justFiredTriggers.has(i.id)) && (n = !0), s && n !== void 0) {
|
|
1633
|
-
const
|
|
1634
|
-
if (
|
|
1635
|
-
const d =
|
|
1670
|
+
const h = (g = this.activeStateMachine) == null ? void 0 : g.inputs.find((d) => d.id === t);
|
|
1671
|
+
if (h && h.value.type === "Number" && typeof n == "number") {
|
|
1672
|
+
const d = h.value.defaultValue ?? h.value.value;
|
|
1636
1673
|
if (s === "source-greater") return n > d;
|
|
1637
1674
|
if (s === "source-less") return n < d;
|
|
1638
1675
|
if (s === "source-equal") return n === d;
|
|
@@ -1698,13 +1735,13 @@ class li {
|
|
|
1698
1735
|
}), s.forEach((o) => {
|
|
1699
1736
|
this.layerStates.delete(o), this.debugLog(`[Engine] Cleaned up completed global layer: ${o}`);
|
|
1700
1737
|
}), this.solveConstraints(t), this.solveBehaviors(t), this.activeTriggers.forEach((o, e) => {
|
|
1701
|
-
var i, n, a, r, l,
|
|
1738
|
+
var i, n, a, r, l, f, c;
|
|
1702
1739
|
if (o.phase === "entry")
|
|
1703
1740
|
o.time += t, o.time >= o.animation.duration && ((a = (n = (i = this.artboard) == null ? void 0 : i.objects.find((g) => g.id === e)) == null ? void 0 : n.triggers) == null || a.find((g) => g.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);
|
|
1704
1741
|
else if (o.phase === "hold") {
|
|
1705
|
-
const g = (
|
|
1742
|
+
const g = (f = (l = (r = this.artboard) == null ? void 0 : r.objects.find((u) => u.id === e)) == null ? void 0 : l.triggers) == null ? void 0 : f.find((u) => u.id === o.triggerId), h = (g == null ? void 0 : g.duration) || 0;
|
|
1706
1743
|
o.elapsedHold += t * 1e3;
|
|
1707
|
-
let d = o.elapsedHold >=
|
|
1744
|
+
let d = o.elapsedHold >= h;
|
|
1708
1745
|
if ((g == null ? void 0 : g.eventType) === "hover" && !this.activeHoverIds.has(e) && (d = !0), ((g == null ? void 0 : g.eventType) === "onHold" || (g == null ? void 0 : g.eventType) === "pointerDown") && !this.isMouseDown && (d = !0), d)
|
|
1709
1746
|
if (g != null && g.exitAnimationId) {
|
|
1710
1747
|
const u = (c = this.artboard) == null ? void 0 : c.animations.find((m) => m.id === g.exitAnimationId);
|
|
@@ -1721,8 +1758,8 @@ class li {
|
|
|
1721
1758
|
if (o && o.isEnabled && o.triggerType === "visible") {
|
|
1722
1759
|
const a = this.objectStates.get(s.id);
|
|
1723
1760
|
if (a && a.visible !== !1) {
|
|
1724
|
-
const r = this.getGlobalTransform(s.id), l = (((i = s.geometry) == null ? void 0 : i.width) || 100) * (r.scale_x || 1),
|
|
1725
|
-
g && !d && this.fireAnalyticsEvent(s.id, "visible"), g ? this.wasInView.add(
|
|
1761
|
+
const r = this.getGlobalTransform(s.id), l = (((i = s.geometry) == null ? void 0 : i.width) || 100) * (r.scale_x || 1), f = (((n = s.geometry) == null ? void 0 : n.height) || 100) * (r.scale_y || 1), c = 50, g = r.x + l / 2 >= -this.canvasWidth / 2 - c && r.x - l / 2 <= this.canvasWidth / 2 + c && r.y + f / 2 >= -this.canvasHeight / 2 - c && r.y - f / 2 <= this.canvasHeight / 2 + c, h = `analytics_${s.id}`, d = this.wasInView.has(h);
|
|
1762
|
+
g && !d && this.fireAnalyticsEvent(s.id, "visible"), g ? this.wasInView.add(h) : this.wasInView.delete(h);
|
|
1726
1763
|
}
|
|
1727
1764
|
}
|
|
1728
1765
|
}), this.artboard.objects.forEach((s) => {
|
|
@@ -1730,7 +1767,7 @@ class li {
|
|
|
1730
1767
|
o.length !== 0 && o.forEach((e) => {
|
|
1731
1768
|
const i = e.triggers || [e.event || e.trigger];
|
|
1732
1769
|
i && i.forEach((n) => {
|
|
1733
|
-
var r, l,
|
|
1770
|
+
var r, l, f;
|
|
1734
1771
|
const a = n.toLowerCase();
|
|
1735
1772
|
if (a === "on interval" || a === "oninterval") {
|
|
1736
1773
|
const c = e.intervalValue || 2e3, g = this.periodicTriggerTimes.get(e.id) || 0;
|
|
@@ -1743,12 +1780,12 @@ class li {
|
|
|
1743
1780
|
if (a === "scroll into view" || a === "scrollintoview") {
|
|
1744
1781
|
const c = this.objectStates.get(s.id);
|
|
1745
1782
|
if (c && c.visible !== !1) {
|
|
1746
|
-
const g = this.getGlobalTransform(s.id),
|
|
1783
|
+
const g = this.getGlobalTransform(s.id), h = (((r = s.geometry) == null ? void 0 : r.width) || 100) * (g.scale_x || 1), d = (((l = s.geometry) == null ? void 0 : l.height) || 100) * (g.scale_y || 1), u = 50, m = g.x + h / 2 >= -this.canvasWidth / 2 - u && g.x - h / 2 <= this.canvasWidth / 2 + u && g.y + d / 2 >= -this.canvasHeight / 2 - u && g.y - d / 2 <= this.canvasHeight / 2 + u, y = this.wasInView.has(s.id);
|
|
1747
1784
|
m && !y && (!e.conditions || this.checkConditions(e.conditions)) && this.fireEventForObject(s.id, "Scroll Into View"), m ? this.wasInView.add(s.id) : this.wasInView.delete(s.id);
|
|
1748
1785
|
}
|
|
1749
1786
|
}
|
|
1750
1787
|
if (a === "scroll progress" || a === "scrollprogress") {
|
|
1751
|
-
const c = Math.abs(this.scrollOffset.y) / (((
|
|
1788
|
+
const c = Math.abs(this.scrollOffset.y) / (((f = this.artboard) == null ? void 0 : f.height) || 1e3), g = this.scrollProgressLastValue.get(e.id) || 0;
|
|
1752
1789
|
Math.abs(c - g) > 1e-3 && (this.scrollProgressLastValue.set(e.id, c), (e.action === "Set Input" || e.action === "setInput") && this.updateInput(e.targetInputId, c));
|
|
1753
1790
|
}
|
|
1754
1791
|
});
|
|
@@ -1762,27 +1799,27 @@ class li {
|
|
|
1762
1799
|
if (!o) return;
|
|
1763
1800
|
const e = this.getGlobalTransform(s.id);
|
|
1764
1801
|
if (s.constraints.forEach((i, n) => {
|
|
1765
|
-
var
|
|
1766
|
-
const a = ((
|
|
1802
|
+
var f, c, g, h, d, u, m, y, v;
|
|
1803
|
+
const a = ((f = o.constraints) == null ? void 0 : f[n]) || {}, r = { ...i, ...a }, l = r.strength ?? 1;
|
|
1767
1804
|
if (r.type === "Translation") {
|
|
1768
1805
|
const b = this.getGlobalTransform(r.targetId);
|
|
1769
1806
|
if (b) {
|
|
1770
|
-
const C = r.offsetX || 0, S = r.offsetY || 0, I = b.x + C, w = b.y + S,
|
|
1771
|
-
if (
|
|
1772
|
-
const T = this.objectVelocities.get(s.id) || { vx: 0, vy: 0 }, { x: W, y:
|
|
1773
|
-
r.copyX && (e.x = e.x + (W - e.x) * l), r.copyY && (e.y = e.y + (
|
|
1807
|
+
const C = r.offsetX || 0, S = r.offsetY || 0, I = b.x + C, w = b.y + S, M = r.useSpring;
|
|
1808
|
+
if (M) {
|
|
1809
|
+
const T = this.objectVelocities.get(s.id) || { vx: 0, vy: 0 }, { x: W, y: k, vx: _, vy: L } = this.computeSpring(e.x, e.y, T.vx, T.vy, I, w, r, t);
|
|
1810
|
+
r.copyX && (e.x = e.x + (W - e.x) * l), r.copyY && (e.y = e.y + (k - e.y) * l), this.objectVelocities.set(s.id, { vx: _, vy: L });
|
|
1774
1811
|
} else
|
|
1775
1812
|
r.copyX && (e.x = e.x + (I - e.x) * l), r.copyY && (e.y = e.y + (w - e.y) * l);
|
|
1776
|
-
let
|
|
1813
|
+
let P = !1;
|
|
1777
1814
|
if ((c = r.limitX) != null && c.enabled) {
|
|
1778
1815
|
const T = e.x;
|
|
1779
|
-
e.x = Math.max(r.limitX.min, Math.min(r.limitX.max, e.x)), e.x !== T && (
|
|
1816
|
+
e.x = Math.max(r.limitX.min, Math.min(r.limitX.max, e.x)), e.x !== T && (P = !0);
|
|
1780
1817
|
}
|
|
1781
1818
|
if ((g = r.limitY) != null && g.enabled) {
|
|
1782
1819
|
const T = e.y;
|
|
1783
|
-
e.y = Math.max(r.limitY.min, Math.min(r.limitY.max, e.y)), e.y !== T && (
|
|
1820
|
+
e.y = Math.max(r.limitY.min, Math.min(r.limitY.max, e.y)), e.y !== T && (P = !0);
|
|
1784
1821
|
}
|
|
1785
|
-
|
|
1822
|
+
P && M && this.objectVelocities.set(s.id, { vx: 0, vy: 0 });
|
|
1786
1823
|
}
|
|
1787
1824
|
} else if (r.type === "Rotation") {
|
|
1788
1825
|
const b = this.getGlobalTransform(r.targetId);
|
|
@@ -1801,10 +1838,10 @@ class li {
|
|
|
1801
1838
|
C > 180 && (C -= 360), C < -180 && (C += 360), e.rotation = e.rotation + C * l, e.scale_x = e.scale_x + (b.scale_x - e.scale_x) * l, e.scale_y = e.scale_y + (b.scale_y - e.scale_y) * l;
|
|
1802
1839
|
}
|
|
1803
1840
|
} else if (r.type === "FollowPointer") {
|
|
1804
|
-
const b = ((
|
|
1841
|
+
const b = ((h = this._lastPointerPos) == null ? void 0 : h.x) ?? e.x, C = ((d = this._lastPointerPos) == null ? void 0 : d.y) ?? e.y, S = r.useSpring;
|
|
1805
1842
|
if (S) {
|
|
1806
|
-
const w = this.objectVelocities.get(s.id) || { vx: 0, vy: 0 }, { x:
|
|
1807
|
-
e.x =
|
|
1843
|
+
const w = this.objectVelocities.get(s.id) || { vx: 0, vy: 0 }, { x: M, y: P, vx: T, vy: W } = this.computeSpring(e.x, e.y, w.vx, w.vy, b, C, r, t);
|
|
1844
|
+
e.x = M, e.y = P, this.objectVelocities.set(s.id, { vx: T, vy: W });
|
|
1808
1845
|
} else
|
|
1809
1846
|
e.x = e.x + (b - e.x) * l, e.y = e.y + (C - e.y) * l;
|
|
1810
1847
|
let I = !1;
|
|
@@ -1821,24 +1858,24 @@ class li {
|
|
|
1821
1858
|
const b = this.getGlobalTransform(r.targetId);
|
|
1822
1859
|
if (b) {
|
|
1823
1860
|
const C = e.x - b.x, S = e.y - b.y, I = Math.sqrt(C * C + S * S), w = r.distance || 0;
|
|
1824
|
-
let
|
|
1861
|
+
let M = I;
|
|
1825
1862
|
switch (r.mode) {
|
|
1826
1863
|
case "exact":
|
|
1827
|
-
|
|
1864
|
+
M = w;
|
|
1828
1865
|
break;
|
|
1829
1866
|
case "minimum":
|
|
1830
|
-
|
|
1867
|
+
M = Math.max(w, I);
|
|
1831
1868
|
break;
|
|
1832
1869
|
case "maximum":
|
|
1833
|
-
|
|
1870
|
+
M = Math.min(w, I);
|
|
1834
1871
|
break;
|
|
1835
1872
|
case "clamped":
|
|
1836
|
-
|
|
1873
|
+
M = Math.max(0, Math.min(w, I));
|
|
1837
1874
|
break;
|
|
1838
1875
|
}
|
|
1839
1876
|
if (I > 0) {
|
|
1840
|
-
const
|
|
1841
|
-
e.x = e.x + (b.x + C *
|
|
1877
|
+
const P = e.x === b.x && e.y === b.y ? 1 : M / I;
|
|
1878
|
+
e.x = e.x + (b.x + C * P - e.x) * l, e.y = e.y + (b.y + S * P - e.y) * l;
|
|
1842
1879
|
}
|
|
1843
1880
|
}
|
|
1844
1881
|
} else if (r.type === "FollowPath") {
|
|
@@ -1854,14 +1891,14 @@ class li {
|
|
|
1854
1891
|
F && (S = F.geometry);
|
|
1855
1892
|
}
|
|
1856
1893
|
if (!S) return;
|
|
1857
|
-
const I = (r.distance || 0) / 100, w = C.width || S.width || 0,
|
|
1894
|
+
const I = (r.distance || 0) / 100, w = C.width || S.width || 0, M = C.height || S.height || 0, P = this.getPointOnPath(S, w, M, I), T = C.rotation * Math.PI / 180, W = Math.cos(T), k = Math.sin(T), _ = P.x * C.scale_x * W - P.y * C.scale_y * k, L = P.x * C.scale_x * k + P.y * C.scale_y * W;
|
|
1858
1895
|
let x = C.rotation + (r.offsetRotation || 0);
|
|
1859
1896
|
if (r.orient) {
|
|
1860
|
-
const F = Math.cos(
|
|
1897
|
+
const F = Math.cos(P.angle), q = Math.sin(P.angle), Q = F * C.scale_x * W - q * C.scale_y * k, it = F * C.scale_x * k + q * C.scale_y * W;
|
|
1861
1898
|
x = Math.atan2(it, Q) * 180 / Math.PI + (r.offsetRotation || 0);
|
|
1862
1899
|
}
|
|
1863
|
-
const
|
|
1864
|
-
if (e.x = e.x + (et - e.x) * l, e.y = e.y + (
|
|
1900
|
+
const A = x * Math.PI / 180, $ = Math.cos(A), O = Math.sin(A), V = (r.offsetX || 0) * $ - (r.offsetY || 0) * O, H = (r.offsetX || 0) * O + (r.offsetY || 0) * $, et = C.x + _ + V, E = C.y + L + H;
|
|
1901
|
+
if (e.x = e.x + (et - e.x) * l, e.y = e.y + (E - e.y) * l, r.orient) {
|
|
1865
1902
|
let F = (x - e.rotation) % 360;
|
|
1866
1903
|
F > 180 && (F -= 360), F < -180 && (F += 360), e.rotation = e.rotation + F * l;
|
|
1867
1904
|
}
|
|
@@ -1878,10 +1915,10 @@ class li {
|
|
|
1878
1915
|
});
|
|
1879
1916
|
}
|
|
1880
1917
|
getGlobalTransform(t) {
|
|
1881
|
-
var
|
|
1918
|
+
var f;
|
|
1882
1919
|
const s = this.objectStates.get(t);
|
|
1883
1920
|
if (!s) return { x: 0, y: 0, rotation: 0, scale_x: 1, scale_y: 1 };
|
|
1884
|
-
const o = (
|
|
1921
|
+
const o = (f = this.artboard) == null ? void 0 : f.objects.find((c) => c.id === t);
|
|
1885
1922
|
if (!o || !o.parentId)
|
|
1886
1923
|
return {
|
|
1887
1924
|
x: s.x,
|
|
@@ -1901,7 +1938,7 @@ class li {
|
|
|
1901
1938
|
}
|
|
1902
1939
|
globalToLocal(t, s) {
|
|
1903
1940
|
if (!t) return s;
|
|
1904
|
-
const o = this.getGlobalTransform(t), e = o.scale_x === 0 ? 0 : 1 / o.scale_x, i = o.scale_y === 0 ? 0 : 1 / o.scale_y, n = -o.rotation * Math.PI / 180, a = Math.cos(n), r = Math.sin(n), l = s.x - o.x,
|
|
1941
|
+
const o = this.getGlobalTransform(t), e = o.scale_x === 0 ? 0 : 1 / o.scale_x, i = o.scale_y === 0 ? 0 : 1 / o.scale_y, n = -o.rotation * Math.PI / 180, a = Math.cos(n), r = Math.sin(n), l = s.x - o.x, f = s.y - o.y, c = (l * a - f * r) * e, g = (l * r + f * a) * i;
|
|
1905
1942
|
return {
|
|
1906
1943
|
x: c,
|
|
1907
1944
|
y: g,
|
|
@@ -1914,7 +1951,7 @@ class li {
|
|
|
1914
1951
|
var l;
|
|
1915
1952
|
const i = [];
|
|
1916
1953
|
let n = t.id;
|
|
1917
|
-
for (let
|
|
1954
|
+
for (let f = 0; f < o && n; f++) {
|
|
1918
1955
|
const c = (l = this.artboard) == null ? void 0 : l.objects.find((g) => g.id === n);
|
|
1919
1956
|
if (!c) break;
|
|
1920
1957
|
i.push({
|
|
@@ -1925,22 +1962,22 @@ class li {
|
|
|
1925
1962
|
}
|
|
1926
1963
|
if (i.length < 2) return;
|
|
1927
1964
|
const a = i.reverse(), r = 5;
|
|
1928
|
-
for (let
|
|
1965
|
+
for (let f = 0; f < r; f++) {
|
|
1929
1966
|
const c = this.getGlobalTransform(t.id);
|
|
1930
1967
|
for (let g = a.length - 2; g >= 0; g--) {
|
|
1931
|
-
const
|
|
1968
|
+
const h = a[g], d = this.getGlobalTransform(h.id), u = c.x - d.x, m = c.y - d.y, y = s.x - d.x, v = s.y - d.y, b = Math.sqrt(u * u + m * m), C = Math.sqrt(y * y + v * v);
|
|
1932
1969
|
if (b > 1e-3 && C > 1e-3) {
|
|
1933
1970
|
const S = Math.atan2(m, u);
|
|
1934
1971
|
let w = (Math.atan2(v, y) - S) * 180 / Math.PI;
|
|
1935
1972
|
w *= e;
|
|
1936
|
-
const
|
|
1937
|
-
|
|
1973
|
+
const M = this.objectStates.get(h.id);
|
|
1974
|
+
M && (M.rotation += w);
|
|
1938
1975
|
}
|
|
1939
1976
|
}
|
|
1940
1977
|
}
|
|
1941
1978
|
}
|
|
1942
1979
|
computeSpring(t, s, o, e, i, n, a, r) {
|
|
1943
|
-
const l = a.stiffness ?? 100,
|
|
1980
|
+
const l = a.stiffness ?? 100, f = a.damping ?? 10, c = a.mass ?? 1, g = -l * (t - i), h = -l * (s - n), d = -f * o, u = -f * e, m = (g + d) / c, y = (h + u) / c, v = o + m * r, b = e + y * r, C = t + v * r, S = s + b * r;
|
|
1944
1981
|
return { x: C, y: S, vx: v, vy: b };
|
|
1945
1982
|
}
|
|
1946
1983
|
handlePointerInput(t, s, o, e, i) {
|
|
@@ -1964,22 +2001,22 @@ class li {
|
|
|
1964
2001
|
this._totalScroll.x += t, this._totalScroll.y += s, this.scrollOffset = { x: this._totalScroll.x, y: this._totalScroll.y }, this.updateInput("scrollX", this._totalScroll.x), this.updateInput("scrollY", this._totalScroll.y);
|
|
1965
2002
|
}
|
|
1966
2003
|
handlePointerEvent(t, s, o) {
|
|
1967
|
-
var r, l,
|
|
2004
|
+
var r, l, f, c, g;
|
|
1968
2005
|
if (!this.artboard) return;
|
|
1969
2006
|
t === "down" ? (this.isMouseDown = !0, this.updateInput("isMouseDown", !0)) : (t === "up" || t === "blur") && (this.isMouseDown = !1, this.updateInput("isMouseDown", !1));
|
|
1970
2007
|
let e = null;
|
|
1971
|
-
const i = (
|
|
2008
|
+
const i = (h, d) => {
|
|
1972
2009
|
var C;
|
|
1973
2010
|
let u = d;
|
|
1974
2011
|
d === "click" ? u = "onClick" : d === "down" ? u = "onPointerDown" : d === "up" ? u = "onPointerUp" : d === "blur" && (u = "onPointerLeave");
|
|
1975
2012
|
const m = /* @__PURE__ */ new Set([u]);
|
|
1976
2013
|
d === "move" && m.add("onPointerEnter").add("hover").add("onPointerLeave").add("blur"), u === "onClick" && m.add("click"), u === "onPointerDown" && m.add("pointerDown"), u === "onPointerUp" && m.add("pointerUp");
|
|
1977
2014
|
const y = ["button", "toggle", "toggle_button", "dropdown", "listview", "inputbox", "slider", "checkbox", "radiogroup"];
|
|
1978
|
-
return !!(
|
|
2015
|
+
return !!(h.type === "Component" && y.includes(h.variant) || y.includes((C = h.type) == null ? void 0 : C.toLowerCase()) || (h.interactions || []).some((S) => m.has(S.event)) || (h.triggers || []).some((S) => m.has(S.eventType)));
|
|
1979
2016
|
};
|
|
1980
2017
|
let n = null;
|
|
1981
|
-
for (let
|
|
1982
|
-
const d = this.artboard.objects[
|
|
2018
|
+
for (let h = this.artboard.objects.length - 1; h >= 0; h--) {
|
|
2019
|
+
const d = this.artboard.objects[h], u = this.objectStates.get(d.id);
|
|
1983
2020
|
if (u && u.visible !== !1 && u.opacity > 0 && this.hitTest(d, s, o) && (n || (n = d), i(d, t))) {
|
|
1984
2021
|
e = d;
|
|
1985
2022
|
break;
|
|
@@ -1989,34 +2026,34 @@ class li {
|
|
|
1989
2026
|
const a = (e == null ? void 0 : e.id) || null;
|
|
1990
2027
|
if (t === "move") {
|
|
1991
2028
|
if (this.draggingSliderId) {
|
|
1992
|
-
const
|
|
1993
|
-
|
|
2029
|
+
const h = this.artboard.objects.find((d) => d.id === this.draggingSliderId);
|
|
2030
|
+
h && this.updateSliderValueFromPointer(h, s, o);
|
|
1994
2031
|
return;
|
|
1995
2032
|
}
|
|
1996
2033
|
if (this.draggingListViewId) {
|
|
1997
|
-
const
|
|
1998
|
-
|
|
2034
|
+
const h = this.artboard.objects.find((d) => d.id === this.draggingListViewId);
|
|
2035
|
+
h && this.updateListViewScrollFromPointer(h);
|
|
1999
2036
|
return;
|
|
2000
2037
|
}
|
|
2001
2038
|
e && e.type === "Component" && e.variant === "listview" && this.updateListViewHoverFromPointer(e, s, o), this.isMouseDown && a && this.fireEventForObject(a, "Drag"), a !== this.lastHoveredObjectId && (console.log(`[Engine] HOVER CHANGE: ${this.lastHoveredObjectId} -> ${a}`), this.lastHoveredObjectId && this.fireEventForObject(this.lastHoveredObjectId, "onPointerLeave"), a && this.fireEventForObject(a, "onPointerEnter"), this.lastHoveredObjectId = a);
|
|
2002
2039
|
return;
|
|
2003
2040
|
}
|
|
2004
|
-
if ((t === "up" || t === "blur") && (this.draggingSliderId = null, this.draggingListViewId = null, this.draggingBehaviors.clear(), this.pointerDownTimes.delete(a), this.activeObjectId = null), t === "down" && (this.pointerDownTimes.set(a, this.currentTime), this.activeObjectId = a, e && ((r = e.behaviors) != null && r.some((
|
|
2005
|
-
|
|
2041
|
+
if ((t === "up" || t === "blur") && (this.draggingSliderId = null, this.draggingListViewId = null, this.draggingBehaviors.clear(), this.pointerDownTimes.delete(a), this.activeObjectId = null), t === "down" && (this.pointerDownTimes.set(a, this.currentTime), this.activeObjectId = a, e && ((r = e.behaviors) != null && r.some((h) => h.type === Y.Draggable)) && this.draggingBehaviors.add(a)), t === "move" ? (a && !this.activeHoverIds.has(a) && this.activeHoverIds.add(a), this.activeHoverIds.forEach((h) => {
|
|
2042
|
+
h !== a && this.activeHoverIds.delete(h);
|
|
2006
2043
|
})) : t === "blur" && this.activeHoverIds.clear(), this.activeDropdownId && t === "down") {
|
|
2007
|
-
const
|
|
2008
|
-
if (
|
|
2009
|
-
const d = this.objectStates.get(
|
|
2010
|
-
if (W &&
|
|
2044
|
+
const h = this.artboard.objects.find((d) => d.id === this.activeDropdownId);
|
|
2045
|
+
if (h && (h.type === "Dropdown" || h.variant === "dropdown")) {
|
|
2046
|
+
const d = this.objectStates.get(h.id), u = (d == null ? void 0 : d.options) || h.options || {}, m = h.geometry || {}, y = m.width ?? h.width ?? 200, v = m.height ?? h.height ?? 40, b = u.optionsList || [], C = u.itemHeight || 32, S = u.listPadding ?? 4, I = b.length * C + S * 2, w = this.getWorldTransform(h.id), M = y * Math.abs(w.scaleX), P = v * Math.abs(w.scaleY), T = w.y + P / 2 + 4, W = Math.abs(s - w.x) <= M / 2, k = o >= T && o <= T + I * Math.abs(w.scaleY);
|
|
2047
|
+
if (W && k) {
|
|
2011
2048
|
const _ = Math.abs(w.scaleY), L = o - (T + S * _), x = Math.floor(L / (C * _));
|
|
2012
2049
|
if (x >= 0 && x < b.length) {
|
|
2013
|
-
const
|
|
2014
|
-
u.selectedOption =
|
|
2015
|
-
objectId:
|
|
2016
|
-
componentName:
|
|
2050
|
+
const A = b[x];
|
|
2051
|
+
u.selectedOption = A, u.isOpen = !1, this.activeDropdownId = null, h.inputId && this.setInternalInput(h.inputId, A), this.onComponentChange && this.onComponentChange({
|
|
2052
|
+
objectId: h.id,
|
|
2053
|
+
componentName: h.name,
|
|
2017
2054
|
variant: "dropdown",
|
|
2018
2055
|
property: "selectedOption",
|
|
2019
|
-
value:
|
|
2056
|
+
value: A
|
|
2020
2057
|
});
|
|
2021
2058
|
}
|
|
2022
2059
|
return;
|
|
@@ -2024,119 +2061,119 @@ class li {
|
|
|
2024
2061
|
}
|
|
2025
2062
|
}
|
|
2026
2063
|
if (e) {
|
|
2027
|
-
let
|
|
2064
|
+
let h = e, d = e;
|
|
2028
2065
|
for (; d && d.parentId; ) {
|
|
2029
2066
|
const m = this.artboard.objects.find((y) => y.id === d.parentId);
|
|
2030
2067
|
if (m && m.type === "Component") {
|
|
2031
|
-
|
|
2068
|
+
h = m;
|
|
2032
2069
|
break;
|
|
2033
2070
|
}
|
|
2034
2071
|
d = m;
|
|
2035
2072
|
}
|
|
2036
2073
|
let u = t;
|
|
2037
|
-
if (t === "click" ? u = "onClick" : t === "down" ? u = "onPointerDown" : t === "up" ? u = "onPointerUp" : t === "blur" && (u = "onPointerLeave"), this.fireEventForObject(e.id, u),
|
|
2038
|
-
const m = this.objectStates.get(
|
|
2039
|
-
y.checked = !y.checked,
|
|
2040
|
-
objectId:
|
|
2041
|
-
componentName:
|
|
2074
|
+
if (t === "click" ? u = "onClick" : t === "down" ? u = "onPointerDown" : t === "up" ? u = "onPointerUp" : t === "blur" && (u = "onPointerLeave"), this.fireEventForObject(e.id, u), h !== e && this.fireEventForObject(h.id, u), h.type === "Component" && h.variant === "toggle_button" && t === "down") {
|
|
2075
|
+
const m = this.objectStates.get(h.id), y = (m == null ? void 0 : m.options) || h.options || {};
|
|
2076
|
+
y.checked = !y.checked, h.inputId && this.setInternalInput(h.inputId, y.checked), this.onComponentChange && this.onComponentChange({
|
|
2077
|
+
objectId: h.id,
|
|
2078
|
+
componentName: h.name,
|
|
2042
2079
|
variant: "toggle_button",
|
|
2043
2080
|
property: "checked",
|
|
2044
2081
|
value: y.checked
|
|
2045
|
-
}), this.fireEventForObject(
|
|
2082
|
+
}), this.fireEventForObject(h.id, "Toggle"), this.fireEventForObject(h.id, y.checked ? "Toggle True" : "Toggle False");
|
|
2046
2083
|
}
|
|
2047
|
-
if (
|
|
2048
|
-
const m = this.objectStates.get(
|
|
2049
|
-
y.checked = !y.checked,
|
|
2050
|
-
objectId:
|
|
2051
|
-
componentName:
|
|
2084
|
+
if (h.type === "Component" && h.variant === "toggle" && t === "down") {
|
|
2085
|
+
const m = this.objectStates.get(h.id), y = (m == null ? void 0 : m.options) || h.options || {};
|
|
2086
|
+
y.checked = !y.checked, h.inputId && this.setInternalInput(h.inputId, y.checked), this.onComponentChange && this.onComponentChange({
|
|
2087
|
+
objectId: h.id,
|
|
2088
|
+
componentName: h.name,
|
|
2052
2089
|
variant: "toggle",
|
|
2053
2090
|
property: "checked",
|
|
2054
2091
|
value: y.checked
|
|
2055
|
-
}), this.onToggle && this.onToggle(
|
|
2092
|
+
}), this.onToggle && this.onToggle(h.name, y.checked), this.fireEventForObject(h.id, "Toggle"), this.fireEventForObject(h.id, y.checked ? "Toggle True" : "Toggle False");
|
|
2056
2093
|
}
|
|
2057
|
-
if (
|
|
2058
|
-
const m = this.objectStates.get(
|
|
2059
|
-
if (v && this.activeDropdownId && this.activeDropdownId !==
|
|
2094
|
+
if (h.type === "Component" && h.variant === "dropdown" && t === "down") {
|
|
2095
|
+
const m = this.objectStates.get(h.id), y = (m == null ? void 0 : m.options) || h.options || {}, v = !y.isOpen;
|
|
2096
|
+
if (v && this.activeDropdownId && this.activeDropdownId !== h.id) {
|
|
2060
2097
|
const b = this.artboard.objects.find((C) => C.id === this.activeDropdownId);
|
|
2061
2098
|
b && b.options && (b.options.isOpen = !1);
|
|
2062
2099
|
}
|
|
2063
|
-
y.isOpen = v, this.activeDropdownId = v ?
|
|
2100
|
+
y.isOpen = v, this.activeDropdownId = v ? h.id : null;
|
|
2064
2101
|
}
|
|
2065
|
-
if (
|
|
2066
|
-
objectId:
|
|
2067
|
-
componentName:
|
|
2102
|
+
if (h.type === "Component" && h.variant === "button" && t === "down" && (this.onButtonClick && this.onButtonClick(h.name, h.id), this.onComponentChange && this.onComponentChange({
|
|
2103
|
+
objectId: h.id,
|
|
2104
|
+
componentName: h.name,
|
|
2068
2105
|
variant: "button",
|
|
2069
2106
|
property: "click",
|
|
2070
2107
|
value: !0
|
|
2071
|
-
})),
|
|
2072
|
-
this.draggingListViewId =
|
|
2073
|
-
const m = this.getListViewItemIndexAtPointer(
|
|
2108
|
+
})), h.type === "Component" && h.variant === "listview" && t === "down") {
|
|
2109
|
+
this.draggingListViewId = h.id;
|
|
2110
|
+
const m = this.getListViewItemIndexAtPointer(h, s, o);
|
|
2074
2111
|
if (m !== null) {
|
|
2075
|
-
const y =
|
|
2112
|
+
const y = h.options || {};
|
|
2076
2113
|
y.activeItemIndex = m;
|
|
2077
|
-
const v = this.objectStates.get(
|
|
2114
|
+
const v = this.objectStates.get(h.id);
|
|
2078
2115
|
v && v.options && (v.options.activeItemIndex = m);
|
|
2079
2116
|
const b = (y.items || [])[m], C = typeof b == "string" ? b : b.label || b.value || m;
|
|
2080
|
-
v && v.options && (v.options.selectedValue = C),
|
|
2081
|
-
objectId:
|
|
2082
|
-
componentName:
|
|
2117
|
+
v && v.options && (v.options.selectedValue = C), h.inputId && this.setInternalInput(h.inputId, C), this.onComponentChange && (this.onComponentChange({
|
|
2118
|
+
objectId: h.id,
|
|
2119
|
+
componentName: h.name,
|
|
2083
2120
|
variant: "listview",
|
|
2084
2121
|
property: "activeItemIndex",
|
|
2085
2122
|
value: m
|
|
2086
2123
|
}), this.onComponentChange({
|
|
2087
|
-
objectId:
|
|
2088
|
-
componentName:
|
|
2124
|
+
objectId: h.id,
|
|
2125
|
+
componentName: h.name,
|
|
2089
2126
|
variant: "listview",
|
|
2090
2127
|
property: "selected",
|
|
2091
2128
|
value: C
|
|
2092
2129
|
}));
|
|
2093
2130
|
}
|
|
2094
2131
|
}
|
|
2095
|
-
if (
|
|
2096
|
-
const m = this.objectStates.get(
|
|
2097
|
-
y.checked = !y.checked,
|
|
2098
|
-
objectId:
|
|
2099
|
-
componentName:
|
|
2132
|
+
if (h.type === "Component" && h.variant === "slider" && t === "down" && (this.draggingSliderId = h.id, this.updateSliderValueFromPointer(h, s, o)), h.type === "Component" && h.variant === "checkbox" && t === "down") {
|
|
2133
|
+
const m = this.objectStates.get(h.id), y = (m == null ? void 0 : m.options) || h.options || {};
|
|
2134
|
+
y.checked = !y.checked, h.inputId && this.setInternalInput(h.inputId, y.checked), this.onComponentChange && this.onComponentChange({
|
|
2135
|
+
objectId: h.id,
|
|
2136
|
+
componentName: h.name,
|
|
2100
2137
|
variant: "checkbox",
|
|
2101
2138
|
property: "checked",
|
|
2102
2139
|
value: y.checked
|
|
2103
|
-
}), this.fireEventForObject(
|
|
2140
|
+
}), this.fireEventForObject(h.id, "Click"), this.fireEventForObject(h.id, y.checked ? "Checked" : "Unchecked");
|
|
2104
2141
|
}
|
|
2105
|
-
if (
|
|
2106
|
-
const m = this.objectStates.get(
|
|
2142
|
+
if (h.type === "Component" && h.variant === "radiogroup" && t === "down") {
|
|
2143
|
+
const m = this.objectStates.get(h.id), y = (m == null ? void 0 : m.options) || h.options || {}, v = y.optionsList || [], b = this.getRadioGroupItemIndexAtPointer(h, s, o);
|
|
2107
2144
|
if (b !== null && b >= 0 && b < v.length) {
|
|
2108
2145
|
const C = v[b];
|
|
2109
|
-
y.selectedValue = C,
|
|
2110
|
-
objectId:
|
|
2111
|
-
componentName:
|
|
2146
|
+
y.selectedValue = C, h.inputId && this.setInternalInput(h.inputId, C), this.onComponentChange && this.onComponentChange({
|
|
2147
|
+
objectId: h.id,
|
|
2148
|
+
componentName: h.name,
|
|
2112
2149
|
variant: "radiogroup",
|
|
2113
2150
|
property: "selectedValue",
|
|
2114
2151
|
value: C
|
|
2115
|
-
}), this.fireEventForObject(
|
|
2152
|
+
}), this.fireEventForObject(h.id, "Click"), this.fireEventForObject(h.id, `Selected: ${C}`);
|
|
2116
2153
|
}
|
|
2117
2154
|
}
|
|
2118
|
-
if (
|
|
2119
|
-
const m =
|
|
2155
|
+
if (h.type === "LineGraph" && (t === "down" || t === "click")) {
|
|
2156
|
+
const m = h.geometry, y = (m == null ? void 0 : m.datasets) || [], v = this.objectStates.get(h.id), b = (v == null ? void 0 : v.width) || (m == null ? void 0 : m.width) || 200, C = (v == null ? void 0 : v.height) || (m == null ? void 0 : m.height) || 150, S = this.getWorldTransform(h.id), I = 30, w = 20, M = b - I, P = C - w;
|
|
2120
2157
|
let T = 1;
|
|
2121
2158
|
y.forEach((_) => {
|
|
2122
2159
|
const L = Math.max(..._.data || [0]);
|
|
2123
2160
|
L > T && (T = L);
|
|
2124
2161
|
});
|
|
2125
|
-
let W = 1 / 0,
|
|
2162
|
+
let W = 1 / 0, k = null;
|
|
2126
2163
|
y.forEach((_, L) => {
|
|
2127
|
-
const x = _.data || [],
|
|
2164
|
+
const x = _.data || [], A = M / Math.max(x.length - 1, 1);
|
|
2128
2165
|
x.forEach(($, O) => {
|
|
2129
|
-
const V = S.x - b / 2 + I + O *
|
|
2130
|
-
et < W && (W = et,
|
|
2166
|
+
const V = S.x - b / 2 + I + O * A, H = S.y + C / 2 - w - $ / T * P, et = Math.sqrt((s - V) ** 2 + (o - H) ** 2);
|
|
2167
|
+
et < W && (W = et, k = { dIdx: L, pIdx: O, val: $, label: _.label || `Dataset ${L + 1}` });
|
|
2131
2168
|
});
|
|
2132
|
-
}),
|
|
2169
|
+
}), k && W < 20 && this.onGraphPointClick && this.onGraphPointClick({ objectId: h.id, componentName: h.name, datasetIndex: k.dIdx, pointIndex: k.pIdx, value: k.val, label: k.label }), this.onComponentChange && this.onComponentChange({ objectId: h.id, componentName: h.name, variant: "linegraph", property: "click", value: (k == null ? void 0 : k.val) ?? null });
|
|
2133
2170
|
}
|
|
2134
2171
|
if (t === "click") {
|
|
2135
2172
|
const m = (l = this.artboard) == null ? void 0 : l.objects.find((b) => b.id === e.id), y = this.focusedId, v = (m == null ? void 0 : m.type) === "InputBox" || (m == null ? void 0 : m.type) === "Component" && m.variant === "inputbox";
|
|
2136
2173
|
if (m && v) {
|
|
2137
2174
|
if (this.focusedId = e.id, console.log(`[Engine] Focus set to: ${e.id}`), y !== this.focusedId) {
|
|
2138
2175
|
if (y) {
|
|
2139
|
-
const b = (
|
|
2176
|
+
const b = (f = this.artboard) == null ? void 0 : f.objects.find((C) => C.id === y);
|
|
2140
2177
|
b && this.onInputBlur && this.onInputBlur(b.name);
|
|
2141
2178
|
}
|
|
2142
2179
|
this.onInputFocus && this.onInputFocus(m.name);
|
|
@@ -2147,9 +2184,9 @@ class li {
|
|
|
2147
2184
|
}
|
|
2148
2185
|
}
|
|
2149
2186
|
} else if (t === "click") {
|
|
2150
|
-
const
|
|
2151
|
-
if (this.focusedId = null,
|
|
2152
|
-
const d = (g = this.artboard) == null ? void 0 : g.objects.find((u) => u.id ===
|
|
2187
|
+
const h = this.focusedId;
|
|
2188
|
+
if (this.focusedId = null, h) {
|
|
2189
|
+
const d = (g = this.artboard) == null ? void 0 : g.objects.find((u) => u.id === h);
|
|
2153
2190
|
d && this.onInputBlur && this.onInputBlur(d.name);
|
|
2154
2191
|
}
|
|
2155
2192
|
}
|
|
@@ -2185,8 +2222,8 @@ class li {
|
|
|
2185
2222
|
}), this.onInputChange && this.onInputChange(s.name, i), this.onInputUpdate && this.onInputUpdate(this.focusedId, i);
|
|
2186
2223
|
}
|
|
2187
2224
|
fireEventForObject(t, s) {
|
|
2188
|
-
var
|
|
2189
|
-
const o = (
|
|
2225
|
+
var f, c, g, h, d;
|
|
2226
|
+
const o = (f = this.artboard) == null ? void 0 : f.objects.find((u) => u.id === t);
|
|
2190
2227
|
if (!o) return;
|
|
2191
2228
|
const e = /* @__PURE__ */ new Set([s, s.toLowerCase()]), i = s.toLowerCase();
|
|
2192
2229
|
i === "onclick" || i === "click" || i === "onpointerdown" || i === "pointerdown" ? this.fireAnalyticsEvent(t, "click") : (i === "onpointerenter" || i === "hover" || i === "move") && this.fireAnalyticsEvent(t, "hover"), i === "onclick" || i === "click" ? (e.add("click"), e.add("onclick")) : i === "onpointerdown" || i === "pointerdown" ? (e.add("pointerdown"), e.add("onpointerdown")) : i === "onpointerup" || i === "pointerup" ? (e.add("pointerup"), e.add("onpointerup")) : i === "onpointerenter" || i === "hover" || i === "move" ? (e.add("hover"), e.add("onpointerenter")) : i === "onpointerleave" || i === "blur" ? (e.add("onpointerleave"), e.add("blur")) : i === "drag" || i === "ondrag" ? (e.add("drag"), e.add("ondrag")) : i === "toggle" || i === "ontoggle" ? (e.add("toggle"), e.add("ontoggle")) : i === "toggle true" || i === "toggle_true" || i === "toggletrue" ? (e.add("toggle true"), e.add("toggle_true"), e.add("toggletrue")) : (i === "toggle false" || i === "toggle_false" || i === "togglefalse") && (e.add("toggle false"), e.add("toggle_false"), e.add("togglefalse"));
|
|
@@ -2240,7 +2277,7 @@ class li {
|
|
|
2240
2277
|
});
|
|
2241
2278
|
if (l && l.entryAnimationId) {
|
|
2242
2279
|
console.log(`[Engine] Trigger matched: ${s} (as ${l.eventType}) -> Animation ${l.entryAnimationId}`);
|
|
2243
|
-
const u = (d = (
|
|
2280
|
+
const u = (d = (h = this.artboard) == null ? void 0 : h.animations) == null ? void 0 : d.find((m) => m.id === l.entryAnimationId);
|
|
2244
2281
|
u && (this.activeTriggers.set(o.id, {
|
|
2245
2282
|
triggerId: l.id,
|
|
2246
2283
|
animation: u,
|
|
@@ -2253,31 +2290,31 @@ class li {
|
|
|
2253
2290
|
}
|
|
2254
2291
|
fireAnalyticsEvent(t, s) {
|
|
2255
2292
|
var r, l;
|
|
2256
|
-
const o = (r = this.artboard) == null ? void 0 : r.objects.find((
|
|
2293
|
+
const o = (r = this.artboard) == null ? void 0 : r.objects.find((f) => f.id === t);
|
|
2257
2294
|
if (!o) return;
|
|
2258
2295
|
const e = (l = o.style) == null ? void 0 : l.analytics;
|
|
2259
2296
|
if (!e || !e.isEnabled || e.triggerType !== s) return;
|
|
2260
2297
|
const i = e.eventName || `${o.name.toLowerCase().replace(/\s+/g, "_")}_interacted`, n = {};
|
|
2261
|
-
e.parameters && Array.isArray(e.parameters) && e.parameters.forEach((
|
|
2262
|
-
if (
|
|
2263
|
-
n[
|
|
2264
|
-
else if (
|
|
2265
|
-
const c = this.inputs.get(
|
|
2266
|
-
n[
|
|
2298
|
+
e.parameters && Array.isArray(e.parameters) && e.parameters.forEach((f) => {
|
|
2299
|
+
if (f.type === "literal")
|
|
2300
|
+
n[f.key] = f.value;
|
|
2301
|
+
else if (f.type === "variable") {
|
|
2302
|
+
const c = this.inputs.get(f.value);
|
|
2303
|
+
n[f.key] = c !== void 0 ? c : "";
|
|
2267
2304
|
}
|
|
2268
2305
|
}), console.log(`[ExodeUI Analytics] Dispatching event "${i}" via ${s} trigger:`, n);
|
|
2269
2306
|
const a = e.platforms || { ga4: !0, meta: !0, mixpanel: !1 };
|
|
2270
2307
|
if (a.ga4) {
|
|
2271
|
-
const
|
|
2272
|
-
typeof
|
|
2308
|
+
const f = window;
|
|
2309
|
+
typeof f.gtag == "function" ? (f.gtag("event", i, n), console.log(`[ExodeUI Analytics] GA4: Event "${i}" sent successfully.`)) : console.warn(`[ExodeUI Analytics] GA4: window.gtag is not a function. Event "${i}" skipped.`);
|
|
2273
2310
|
}
|
|
2274
2311
|
if (a.meta) {
|
|
2275
|
-
const
|
|
2276
|
-
typeof
|
|
2312
|
+
const f = window;
|
|
2313
|
+
typeof f.fbq == "function" ? (f.fbq("track", i, n), console.log(`[ExodeUI Analytics] Meta Pixel: Event "${i}" sent successfully.`)) : console.warn(`[ExodeUI Analytics] Meta Pixel: window.fbq is not a function. Event "${i}" skipped.`);
|
|
2277
2314
|
}
|
|
2278
2315
|
if (a.mixpanel) {
|
|
2279
|
-
const
|
|
2280
|
-
|
|
2316
|
+
const f = window;
|
|
2317
|
+
f.mixpanel && typeof f.mixpanel.track == "function" ? (f.mixpanel.track(i, n), console.log(`[ExodeUI Analytics] Mixpanel: Event "${i}" sent successfully.`)) : console.warn(`[ExodeUI Analytics] Mixpanel: window.mixpanel.track is not a function. Event "${i}" skipped.`);
|
|
2281
2318
|
}
|
|
2282
2319
|
}
|
|
2283
2320
|
initGlobalAnimationTriggers() {
|
|
@@ -2318,7 +2355,7 @@ class li {
|
|
|
2318
2355
|
var g;
|
|
2319
2356
|
const s = this.objectStates.get(t);
|
|
2320
2357
|
if (!s) return { x: 0, y: 0, scaleX: 1, scaleY: 1, rotation: 0 };
|
|
2321
|
-
const o = (g = this.artboard) == null ? void 0 : g.objects.find((
|
|
2358
|
+
const o = (g = this.artboard) == null ? void 0 : g.objects.find((h) => h.id === t);
|
|
2322
2359
|
if (!o || !o.parentId)
|
|
2323
2360
|
return {
|
|
2324
2361
|
x: s.x,
|
|
@@ -2327,9 +2364,9 @@ class li {
|
|
|
2327
2364
|
scaleY: s.scale_y ?? 1,
|
|
2328
2365
|
rotation: s.rotation ?? 0
|
|
2329
2366
|
};
|
|
2330
|
-
const e = this.getWorldTransform(o.parentId), i = e.rotation * (Math.PI / 180), n = Math.cos(i), a = Math.sin(i), r = s.x * e.scaleX, l = s.y * e.scaleY,
|
|
2367
|
+
const e = this.getWorldTransform(o.parentId), i = e.rotation * (Math.PI / 180), n = Math.cos(i), a = Math.sin(i), r = s.x * e.scaleX, l = s.y * e.scaleY, f = e.x + (r * n - l * a), c = e.y + (r * a + l * n);
|
|
2331
2368
|
return {
|
|
2332
|
-
x:
|
|
2369
|
+
x: f,
|
|
2333
2370
|
y: c,
|
|
2334
2371
|
scaleX: (s.scale_x ?? 1) * e.scaleX,
|
|
2335
2372
|
scaleY: (s.scale_y ?? 1) * e.scaleY,
|
|
@@ -2339,15 +2376,15 @@ class li {
|
|
|
2339
2376
|
hitTest(t, s, o) {
|
|
2340
2377
|
var b, C;
|
|
2341
2378
|
if (!this.objectStates.get(t.id)) return !1;
|
|
2342
|
-
const i = ((b = t.geometry) == null ? void 0 : b.width) ?? t.width ?? 100, n = ((C = t.geometry) == null ? void 0 : C.height) ?? t.height ?? 100, a = this.getWorldTransform(t.id), r = s - a.x, l = o - a.y,
|
|
2343
|
-
return Math.abs(
|
|
2379
|
+
const i = ((b = t.geometry) == null ? void 0 : b.width) ?? t.width ?? 100, n = ((C = t.geometry) == null ? void 0 : C.height) ?? t.height ?? 100, a = this.getWorldTransform(t.id), r = s - a.x, l = o - a.y, f = -a.rotation * (Math.PI / 180), c = Math.cos(f), g = Math.sin(f), h = r * c - l * g, d = r * g + l * c, u = a.scaleX, m = a.scaleY, y = i * Math.abs(u), v = n * Math.abs(m);
|
|
2380
|
+
return Math.abs(h) <= y / 2 && Math.abs(d) <= v / 2;
|
|
2344
2381
|
}
|
|
2345
2382
|
updateSliderValueFromPointer(t, s, o) {
|
|
2346
2383
|
var w;
|
|
2347
2384
|
const e = this.objectStates.get(t.id);
|
|
2348
2385
|
if (!e) return;
|
|
2349
|
-
const i = t.options || {}, n = ((w = t.geometry) == null ? void 0 : w.width) ?? t.width ?? 200, a = this.getWorldTransform(t.id), r = s - a.x, l = o - a.y,
|
|
2350
|
-
let y = (
|
|
2386
|
+
const i = t.options || {}, n = ((w = t.geometry) == null ? void 0 : w.width) ?? t.width ?? 200, a = this.getWorldTransform(t.id), r = s - a.x, l = o - a.y, f = -a.rotation * (Math.PI / 180), c = Math.cos(f), g = Math.sin(f), h = r * c - l * g, d = i.thumbWidth ?? 16, u = n - d;
|
|
2387
|
+
let y = (h + u / 2) / u;
|
|
2351
2388
|
y = Math.max(0, Math.min(1, y));
|
|
2352
2389
|
const v = i.min ?? 0, b = i.max ?? 100, C = i.step || 1;
|
|
2353
2390
|
let S = v + y * (b - v);
|
|
@@ -2363,7 +2400,7 @@ class li {
|
|
|
2363
2400
|
}
|
|
2364
2401
|
applyAnimation(t, s, o) {
|
|
2365
2402
|
!t || !t.tracks || t.tracks.forEach((e) => {
|
|
2366
|
-
var c, g,
|
|
2403
|
+
var c, g, h;
|
|
2367
2404
|
const i = e.object_id || e.objectId;
|
|
2368
2405
|
if (o) {
|
|
2369
2406
|
if (Array.isArray(o)) {
|
|
@@ -2380,10 +2417,10 @@ class li {
|
|
|
2380
2417
|
this.frameCount % 600 === 0 && this.debugLog(`Skipping track: Object ${i} not found in state`);
|
|
2381
2418
|
return;
|
|
2382
2419
|
}
|
|
2383
|
-
const
|
|
2384
|
-
if (
|
|
2420
|
+
const f = this.interpolate(e.keyframes, s);
|
|
2421
|
+
if (f !== void 0) {
|
|
2385
2422
|
if (this.frameCount % 240 === 0) {
|
|
2386
|
-
const d = (n == null ? void 0 : n.name) || i, u = typeof
|
|
2423
|
+
const d = (n == null ? void 0 : n.name) || i, u = typeof f == "object" ? JSON.stringify(f).slice(0, 50) : f;
|
|
2387
2424
|
this.debugLog(`[Anim] Applying ${r} = ${u} to ${d}`);
|
|
2388
2425
|
}
|
|
2389
2426
|
if (r.includes(".")) {
|
|
@@ -2402,17 +2439,17 @@ class li {
|
|
|
2402
2439
|
}
|
|
2403
2440
|
u = u[d[m]];
|
|
2404
2441
|
}
|
|
2405
|
-
u[d[d.length - 1]] =
|
|
2442
|
+
u[d[d.length - 1]] = f, d[d.length - 1] === "color" && (d[d.length - 2] === "fill" || d[d.length - 2] === "stroke") && (u.type = "Solid");
|
|
2406
2443
|
} else
|
|
2407
|
-
r === "fill" ? (l.style || (l.style = {}), l.style.fill =
|
|
2408
|
-
if (this.physicsEngine && ((
|
|
2444
|
+
r === "fill" ? (l.style || (l.style = {}), l.style.fill = f) : r === "stroke" ? (l.style || (l.style = {}), l.style.stroke = f) : l[r] = f;
|
|
2445
|
+
if (this.physicsEngine && ((h = n == null ? void 0 : n.physics) != null && h.enabled) && n.physics.bodyType === "Static")
|
|
2409
2446
|
if (r === "x") {
|
|
2410
2447
|
const d = this.physicsEngine.getPosition(i);
|
|
2411
|
-
d && this.physicsEngine.setPosition(i,
|
|
2448
|
+
d && this.physicsEngine.setPosition(i, f, d.y);
|
|
2412
2449
|
} else if (r === "y") {
|
|
2413
2450
|
const d = this.physicsEngine.getPosition(i);
|
|
2414
|
-
d && this.physicsEngine.setPosition(i, d.x,
|
|
2415
|
-
} else r === "rotation" && this.physicsEngine.setRotation(i,
|
|
2451
|
+
d && this.physicsEngine.setPosition(i, d.x, f);
|
|
2452
|
+
} else r === "rotation" && this.physicsEngine.setRotation(i, f * (Math.PI / 180));
|
|
2416
2453
|
}
|
|
2417
2454
|
});
|
|
2418
2455
|
}
|
|
@@ -2446,8 +2483,8 @@ class li {
|
|
|
2446
2483
|
return this.interpolateFill(o.value, e.value, n);
|
|
2447
2484
|
const a = {};
|
|
2448
2485
|
return (/* @__PURE__ */ new Set([...Object.keys(o.value), ...Object.keys(e.value)])).forEach((l) => {
|
|
2449
|
-
const
|
|
2450
|
-
typeof
|
|
2486
|
+
const f = o.value[l], c = e.value[l];
|
|
2487
|
+
typeof f == "number" && typeof c == "number" ? a[l] = f + (c - f) * n : f === void 0 ? a[l] = c : c === void 0 ? a[l] = f : a[l] = n < 0.5 ? f : c;
|
|
2451
2488
|
}), a;
|
|
2452
2489
|
}
|
|
2453
2490
|
return typeof o.value == "number" && typeof e.value == "number" ? o.value + (e.value - o.value) * n : n < 0.5 ? o.value : e.value;
|
|
@@ -2466,11 +2503,11 @@ class li {
|
|
|
2466
2503
|
g: parseInt(y.substring(2, 4), 16),
|
|
2467
2504
|
b: parseInt(y.substring(4, 6), 16)
|
|
2468
2505
|
};
|
|
2469
|
-
}, r = a(i), l = a(n),
|
|
2506
|
+
}, r = a(i), l = a(n), f = Math.round(r.r + (l.r - r.r) * o), c = Math.round(r.g + (l.g - r.g) * o), g = Math.round(r.b + (l.b - r.b) * o), h = (m) => {
|
|
2470
2507
|
const y = Math.max(0, Math.min(255, m)).toString(16);
|
|
2471
2508
|
return y.length === 1 ? "0" + y : y;
|
|
2472
2509
|
};
|
|
2473
|
-
return `#${f
|
|
2510
|
+
return `#${h(f)}${h(c)}${h(g)}`;
|
|
2474
2511
|
}
|
|
2475
2512
|
interpolateStops(t, s, o) {
|
|
2476
2513
|
return !t || !s || t.length !== s.length ? o < 0.5 ? t : s : t.map((e, i) => {
|
|
@@ -2502,8 +2539,8 @@ class li {
|
|
|
2502
2539
|
return e.width = (t.width ?? 0) + ((s.width ?? 0) - (t.width ?? 0)) * o, e.opacity = (t.opacity ?? 1) + ((s.opacity ?? 1) - (t.opacity ?? 1)) * o, t.fill && s.fill ? e.fill = this.interpolateFill(t.fill, s.fill, o) : t.color && s.color && t.color.startsWith("#") && s.color.startsWith("#") && (e.color = this.interpolateColor(t.color, s.color, o)), e.trimStart = (t.trimStart ?? 0) + ((s.trimStart ?? 0) - (t.trimStart ?? 0)) * o, e.trimEnd = (t.trimEnd ?? 1) + ((s.trimEnd ?? 1) - (t.trimEnd ?? 1)) * o, e.trimOffset = (t.trimOffset ?? 0) + ((s.trimOffset ?? 0) - (t.trimOffset ?? 0)) * o, e.dashOffset = (t.dashOffset ?? 0) + ((s.dashOffset ?? 0) - (t.dashOffset ?? 0)) * o, e;
|
|
2503
2540
|
}
|
|
2504
2541
|
render(t, s, o) {
|
|
2505
|
-
var
|
|
2506
|
-
this.debug_objectsTotal = ((
|
|
2542
|
+
var f;
|
|
2543
|
+
this.debug_objectsTotal = ((f = this.artboard) == null ? void 0 : f.objects.length) || 0, this.debug_objectsRendered = 0;
|
|
2507
2544
|
const e = performance.now();
|
|
2508
2545
|
if (this.canvasWidth = s, this.canvasHeight = o, !this.artboard)
|
|
2509
2546
|
return;
|
|
@@ -2521,15 +2558,15 @@ class li {
|
|
|
2521
2558
|
let g = this.imageCache.get(c);
|
|
2522
2559
|
if (g || (g = new Image(), g.src = c, this.imageCache.set(c, g)), g.complete && g.naturalWidth > 0) {
|
|
2523
2560
|
t.save(), t.globalAlpha = this.normalizeOpacity(this.artboard.backgroundOpacity ?? 100);
|
|
2524
|
-
const
|
|
2561
|
+
const h = g.naturalWidth / g.naturalHeight, d = i / n;
|
|
2525
2562
|
let u, m, y, v;
|
|
2526
|
-
d >
|
|
2563
|
+
d > h ? (u = i, m = i / h) : (m = n, u = n * h), y = -u / 2, v = -m / 2, t.drawImage(g, y, v, u, m), t.restore();
|
|
2527
2564
|
}
|
|
2528
2565
|
}
|
|
2529
2566
|
t.beginPath(), t.rect(-i / 2, -n / 2, i, n), t.clip();
|
|
2530
2567
|
const r = /* @__PURE__ */ new Map();
|
|
2531
2568
|
this.artboard.objects.forEach((c) => r.set(c.id, c)), this.artboard.objects.filter((c) => !c.parentId).map((c, g) => {
|
|
2532
|
-
const
|
|
2569
|
+
const h = this.objectStates.get(c.id), d = (h == null ? void 0 : h.zIndex) ?? g;
|
|
2533
2570
|
return { obj: c, zIndex: d };
|
|
2534
2571
|
}).sort((c, g) => c.zIndex - g.zIndex).forEach(({ obj: c }) => {
|
|
2535
2572
|
this.renderObject(t, c, r);
|
|
@@ -2540,18 +2577,18 @@ class li {
|
|
|
2540
2577
|
}), this.lastRenderTime = performance.now() - e, this.debugMode && this.frameCount % 60 === 0 && console.log(`[Engine Debug] Rendered ${this.debug_objectsRendered}/${this.debug_objectsTotal} objects in ${this.lastRenderTime.toFixed(2)}ms`), t.restore();
|
|
2541
2578
|
}
|
|
2542
2579
|
isObjectInView(t, s, o, e, i, n = 0) {
|
|
2543
|
-
const a = t.getTransform(), r = s * a.a + o * a.c + a.e, l = s * a.b + o * a.d + a.f,
|
|
2544
|
-
return r + g >= 0 && r - g <= this.canvasWidth && l +
|
|
2580
|
+
const a = t.getTransform(), r = s * a.a + o * a.c + a.e, l = s * a.b + o * a.d + a.f, f = Math.sqrt(a.a * a.a + a.b * a.b), c = Math.sqrt(a.c * a.c + a.d * a.d), g = (e / 2 + n) * f, h = (i / 2 + n) * c;
|
|
2581
|
+
return r + g >= 0 && r - g <= this.canvasWidth && l + h >= 0 && l - h <= this.canvasHeight;
|
|
2545
2582
|
}
|
|
2546
2583
|
calculateTransform(t, s, o, e, i, n) {
|
|
2547
2584
|
let a = 1, r = 1, l = 1;
|
|
2548
|
-
const
|
|
2585
|
+
const f = o / e, c = t / s;
|
|
2549
2586
|
switch (i) {
|
|
2550
2587
|
case "Contain":
|
|
2551
|
-
c >
|
|
2588
|
+
c > f ? l = s / e : l = t / o, a = r = l;
|
|
2552
2589
|
break;
|
|
2553
2590
|
case "Cover":
|
|
2554
|
-
c >
|
|
2591
|
+
c > f ? l = t / o : l = s / e, a = r = l;
|
|
2555
2592
|
break;
|
|
2556
2593
|
case "Fill":
|
|
2557
2594
|
a = t / o, r = s / e;
|
|
@@ -2572,9 +2609,9 @@ class li {
|
|
|
2572
2609
|
a = r = 1;
|
|
2573
2610
|
break;
|
|
2574
2611
|
}
|
|
2575
|
-
const g = o * a,
|
|
2612
|
+
const g = o * a, h = e * r;
|
|
2576
2613
|
let d = 0, u = 0;
|
|
2577
|
-
return n.includes("Left") ? d = 0 : n.includes("Right") ? d = t - g : d = (t - g) / 2, n.includes("Top") ? u = 0 : n.includes("Bottom") ? u = s -
|
|
2614
|
+
return n.includes("Left") ? d = 0 : n.includes("Right") ? d = t - g : d = (t - g) / 2, n.includes("Top") ? u = 0 : n.includes("Bottom") ? u = s - h : u = (s - h) / 2, { scaleX: a, scaleY: r, tx: d, ty: u };
|
|
2578
2615
|
}
|
|
2579
2616
|
mapFontWeight(t) {
|
|
2580
2617
|
const s = t.toLowerCase();
|
|
@@ -2596,44 +2633,58 @@ class li {
|
|
|
2596
2633
|
}
|
|
2597
2634
|
*/
|
|
2598
2635
|
renderObject(t, s, o) {
|
|
2599
|
-
var u, m, y, v, b, C, S, I, w,
|
|
2636
|
+
var u, m, y, v, b, C, S, I, w, M, P, T, W, k, _, L, x;
|
|
2600
2637
|
const e = this.objectStates.get(s.id);
|
|
2601
2638
|
if (!e) {
|
|
2602
2639
|
console.warn("No state for object:", s.id);
|
|
2603
2640
|
return;
|
|
2604
2641
|
}
|
|
2605
|
-
this.frameCount % 60, t.roundRect || (t.roundRect = (
|
|
2642
|
+
this.frameCount % 60, t.roundRect || (t.roundRect = (A, $, O, V, H) => (this.drawRoundRect(t, A, $, O, V, H), t));
|
|
2606
2643
|
const i = e.geometry ? this.deepMerge(s.geometry, e.geometry) : s.geometry, n = e.style ? this.deepMerge(s.style, e.style) : s.style;
|
|
2607
2644
|
let a = (i == null ? void 0 : i.width) || ((u = s.geometry) == null ? void 0 : u.width) || s.width || 0, r = (i == null ? void 0 : i.height) || ((m = s.geometry) == null ? void 0 : m.height) || s.height || 0;
|
|
2608
2645
|
if ((a === 0 || r === 0) && (i != null && i.points) && Array.isArray(i.points) && i.points.length > 0) {
|
|
2609
|
-
let
|
|
2646
|
+
let A = 1 / 0, $ = -1 / 0, O = 1 / 0, V = -1 / 0;
|
|
2610
2647
|
i.points.forEach((H) => {
|
|
2611
|
-
|
|
2612
|
-
}), a === 0 && (a = $ -
|
|
2648
|
+
A = Math.min(A, H.x), $ = Math.max($, H.x), O = Math.min(O, H.y), V = Math.max(V, H.y);
|
|
2649
|
+
}), a === 0 && (a = $ - A), r === 0 && (r = V - O);
|
|
2650
|
+
}
|
|
2651
|
+
const l = (A) => {
|
|
2652
|
+
if (A)
|
|
2653
|
+
return A.corner_radius ?? A.cornerRadius;
|
|
2654
|
+
}, f = l(e) ?? l(n) ?? l(i) ?? l(s.style) ?? l(s.geometry) ?? 0;
|
|
2655
|
+
let c = { ...i, width: a, height: r };
|
|
2656
|
+
if (delete c.cornerRadius, c.corner_radius = f, c.type === "Path" && s.weights && s.bindMatrices && c.points) {
|
|
2657
|
+
const A = this.getGlobalTransform(s.id);
|
|
2658
|
+
if (A) {
|
|
2659
|
+
const $ = li(
|
|
2660
|
+
c.points,
|
|
2661
|
+
s.weights,
|
|
2662
|
+
s.bindMatrices,
|
|
2663
|
+
A,
|
|
2664
|
+
(O) => this.getGlobalTransform(O)
|
|
2665
|
+
);
|
|
2666
|
+
c = { ...c, points: $ };
|
|
2667
|
+
}
|
|
2613
2668
|
}
|
|
2614
|
-
|
|
2615
|
-
if (R)
|
|
2616
|
-
return R.corner_radius ?? R.cornerRadius;
|
|
2617
|
-
}, h = l(e) ?? l(n) ?? l(i) ?? l(s.style) ?? l(s.geometry) ?? 0, c = { ...i, width: a, height: r };
|
|
2618
|
-
if (delete c.cornerRadius, c.corner_radius = h, e.visible === !1)
|
|
2669
|
+
if (e.visible === !1)
|
|
2619
2670
|
return;
|
|
2620
|
-
const g = s.repeaterConfig,
|
|
2621
|
-
for (let
|
|
2671
|
+
const g = s.repeaterConfig, h = g && g.isEnabled && g.count > 1, d = h ? g.count : 1;
|
|
2672
|
+
for (let A = 0; A < d; A++) {
|
|
2622
2673
|
let $ = e.x, O = e.y, V = e.rotation, H = e.scale_x ?? 1, et = e.scale_y ?? 1;
|
|
2623
|
-
if (
|
|
2674
|
+
if (h && A > 0) {
|
|
2624
2675
|
if (g.type === "Linear") {
|
|
2625
2676
|
const J = g.offsetX || 0, ft = g.offsetY || 0, U = g.rotation || 0, G = g.scale !== void 0 ? g.scale : 1;
|
|
2626
|
-
$ +=
|
|
2677
|
+
$ += A * J, O += A * ft, V += A * U, H *= Math.pow(G, A), et *= Math.pow(G, A);
|
|
2627
2678
|
} else if (g.type === "Grid") {
|
|
2628
|
-
const J = g.cols || Math.ceil(Math.sqrt(g.count)), ft = g.gapX || 0, U = g.gapY || 0, G = Math.floor(
|
|
2679
|
+
const J = g.cols || Math.ceil(Math.sqrt(g.count)), ft = g.gapX || 0, U = g.gapY || 0, G = Math.floor(A / J), K = A % J, Z = a + ft, At = r + U;
|
|
2629
2680
|
$ += K * Z, O += G * At;
|
|
2630
2681
|
} else if (g.type === "Radial") {
|
|
2631
|
-
const J = g.radius || 100, ft = g.startAngle || 0, G = (g.endAngle || 360) - ft, K = g.count > 1 ? G / (G === 360 ? g.count : g.count - 1) : 0, Z = ft +
|
|
2682
|
+
const J = g.radius || 100, ft = g.startAngle || 0, G = (g.endAngle || 360) - ft, K = g.count > 1 ? G / (G === 360 ? g.count : g.count - 1) : 0, Z = ft + A * K, At = Z * Math.PI / 180;
|
|
2632
2683
|
$ = e.x + J * Math.cos(At), O = e.y + J * Math.sin(At), V += Z;
|
|
2633
2684
|
}
|
|
2634
2685
|
}
|
|
2635
|
-
const
|
|
2636
|
-
if (!
|
|
2686
|
+
const E = s.type === "Group" || s.type === "Frame" || s.type === "Component", F = a > 0 && r > 0;
|
|
2687
|
+
if (!E && F) {
|
|
2637
2688
|
const J = (((y = n.shadow) == null ? void 0 : y.isEnabled) !== !1 ? (((v = n.shadow) == null ? void 0 : v.blur) || 0) + 10 : 0) + (((b = n.blur) == null ? void 0 : b.isEnabled) !== !1 && ((C = n.blur) == null ? void 0 : C.radius) || 0) + 20;
|
|
2638
2689
|
if (!this.isObjectInView(t, $, O, a, r, J))
|
|
2639
2690
|
continue;
|
|
@@ -2643,7 +2694,7 @@ class li {
|
|
|
2643
2694
|
Q && Q.amount > 0 && q.push(`blur(${Q.amount}px)`);
|
|
2644
2695
|
const it = n.effect || ((I = s.style) == null ? void 0 : I.effect), dt = (it == null ? void 0 : it.isEnabled) === !0, St = it == null ? void 0 : it.type, ht = (it == null ? void 0 : it.radius) ?? 10;
|
|
2645
2696
|
dt && St === "LayerBlur" && q.push(`blur(${ht}px)`);
|
|
2646
|
-
const mt = ((w = i == null ? void 0 : i.type) == null ? void 0 : w.toLowerCase().includes("image")) || ((
|
|
2697
|
+
const mt = ((w = i == null ? void 0 : i.type) == null ? void 0 : w.toLowerCase().includes("image")) || ((M = s.type) == null ? void 0 : M.toLowerCase().includes("image")), rt = n.adjustments && Object.keys(n.adjustments).length > 0 ? n.adjustments : null, Lt = i != null && i.adjustments && Object.keys(i.adjustments).length > 0 ? i.adjustments : null, Gt = mt ? Lt || rt : rt || Lt, Pt = mt && !Gt ? {
|
|
2647
2698
|
exposure: 0,
|
|
2648
2699
|
contrast: 0,
|
|
2649
2700
|
saturation: 100,
|
|
@@ -2664,12 +2715,12 @@ class li {
|
|
|
2664
2715
|
<feFuncG type="linear" slope="1" intercept="${J}"/>
|
|
2665
2716
|
<feFuncB type="linear" slope="1" intercept="${J}"/>
|
|
2666
2717
|
</feComponentTransfer>`, kt = "exposure"), ft !== 0) {
|
|
2667
|
-
const yt = (ft + 100) / 100,
|
|
2718
|
+
const yt = (ft + 100) / 100, R = 0.5 * (1 - yt);
|
|
2668
2719
|
Ot += `
|
|
2669
2720
|
<feComponentTransfer in="${kt}" result="contrast">
|
|
2670
|
-
<feFuncR type="linear" slope="${yt}" intercept="${
|
|
2671
|
-
<feFuncG type="linear" slope="${yt}" intercept="${
|
|
2672
|
-
<feFuncB type="linear" slope="${yt}" intercept="${
|
|
2721
|
+
<feFuncR type="linear" slope="${yt}" intercept="${R}"/>
|
|
2722
|
+
<feFuncG type="linear" slope="${yt}" intercept="${R}"/>
|
|
2723
|
+
<feFuncB type="linear" slope="${yt}" intercept="${R}"/>
|
|
2673
2724
|
</feComponentTransfer>`, kt = "contrast";
|
|
2674
2725
|
}
|
|
2675
2726
|
if (U !== 1 && (Ot += `<feColorMatrix in="${kt}" type="saturate" values="${U}" result="saturate"/>`, kt = "saturate"), Pt.hue && (Ot += `<feColorMatrix in="${kt}" type="hueRotate" values="${Pt.hue}" result="hue"/>`, kt = "hue"), Pt.negative) {
|
|
@@ -2682,8 +2733,8 @@ class li {
|
|
|
2682
2733
|
0 0 0 1 0"/>`, kt = "invert";
|
|
2683
2734
|
}
|
|
2684
2735
|
if (G !== 0 || K !== 0 || Z !== 0 || At !== 0) {
|
|
2685
|
-
const yt = 1 + Z + At,
|
|
2686
|
-
|
|
2736
|
+
const yt = 1 + Z + At, R = yt * (1 + G - K / 2), ct = yt * (1 + K), Xt = yt * (1 - G - K / 2), xt = Pt.shadows * 0.1 / 255, te = [
|
|
2737
|
+
R,
|
|
2687
2738
|
0,
|
|
2688
2739
|
0,
|
|
2689
2740
|
0,
|
|
@@ -2707,8 +2758,8 @@ class li {
|
|
|
2707
2758
|
Ot += `<feColorMatrix in="${kt}" type="matrix" values="${te}" result="advanced"/>`, kt = "advanced";
|
|
2708
2759
|
}
|
|
2709
2760
|
if (Pt.blur && (Ot += `<feGaussianBlur in="${kt}" stdDeviation="${Pt.blur}" result="blur"/>`, kt = "blur"), Ot) {
|
|
2710
|
-
const yt = `<svg xmlns="http://www.w3.org/2000/svg"><filter id="f" color-interpolation-filters="sRGB">${Ot}</filter></svg>`,
|
|
2711
|
-
q.push(`url('data:image/svg+xml;base64,${
|
|
2761
|
+
const yt = `<svg xmlns="http://www.w3.org/2000/svg"><filter id="f" color-interpolation-filters="sRGB">${Ot}</filter></svg>`, R = btoa(yt);
|
|
2762
|
+
q.push(`url('data:image/svg+xml;base64,${R}#f')`);
|
|
2712
2763
|
}
|
|
2713
2764
|
}
|
|
2714
2765
|
q.length > 0 ? t.filter = q.join(" ") : t.filter = "none", t.imageSmoothingEnabled = !0, t.imageSmoothingQuality = "high";
|
|
@@ -2773,17 +2824,17 @@ class li {
|
|
|
2773
2824
|
const jt = n.shadow;
|
|
2774
2825
|
if (jt && jt.isEnabled !== !1) {
|
|
2775
2826
|
let J = jt.color || "#000000";
|
|
2776
|
-
(T = (
|
|
2827
|
+
(T = (P = this.artboard) == null ? void 0 : P.tokens) != null && T.colors && this.artboard.tokens.colors[J] && (J = this.artboard.tokens.colors[J]);
|
|
2777
2828
|
const ft = this.normalizeOpacity(jt.opacity ?? 100), U = jt.spread || 0, K = (jt.blur || 0) + U * 1.5;
|
|
2778
2829
|
let Z = J;
|
|
2779
2830
|
if (J.startsWith("#")) {
|
|
2780
|
-
const kt = J.replace("#", ""), Nt = parseInt(kt.substring(0, 2), 16), yt = parseInt(kt.substring(2, 4), 16),
|
|
2781
|
-
Z = `rgba(${Nt}, ${yt}, ${
|
|
2831
|
+
const kt = J.replace("#", ""), Nt = parseInt(kt.substring(0, 2), 16), yt = parseInt(kt.substring(2, 4), 16), R = parseInt(kt.substring(4, 6), 16);
|
|
2832
|
+
Z = `rgba(${Nt}, ${yt}, ${R}, ${ft})`;
|
|
2782
2833
|
} else if (J.startsWith("rgba")) {
|
|
2783
2834
|
const kt = J.match(/[\d.]+/g);
|
|
2784
2835
|
if (kt && kt.length >= 4) {
|
|
2785
|
-
const Nt = kt[0], yt = kt[1],
|
|
2786
|
-
Z = `rgba(${Nt}, ${yt}, ${
|
|
2836
|
+
const Nt = kt[0], yt = kt[1], R = kt[2], ct = kt[3];
|
|
2837
|
+
Z = `rgba(${Nt}, ${yt}, ${R}, ${parseFloat(ct) * ft})`;
|
|
2787
2838
|
}
|
|
2788
2839
|
}
|
|
2789
2840
|
const At = t.getTransform(), Ot = Math.sqrt(At.a * At.a + At.b * At.b) || 1;
|
|
@@ -2808,13 +2859,13 @@ class li {
|
|
|
2808
2859
|
}, ft.onerror = (K) => {
|
|
2809
2860
|
console.error("[ExodeUI] Image load failed:", K, `Src preview: ${J.substring(0, 100)}...`);
|
|
2810
2861
|
}, ft.src = J, this.imageCache.set(J, ft));
|
|
2811
|
-
const U = n.stroke && n.stroke.width > 0 && n.stroke.isEnabled !== !1, G = (((
|
|
2812
|
-
if (U && (G === "outside" || G === "center") && this.applyStrokeAlignment(t, n, c, a, r,
|
|
2862
|
+
const U = n.stroke && n.stroke.width > 0 && n.stroke.isEnabled !== !1, G = (((k = n.stroke) == null ? void 0 : k.alignment) || "center").toLowerCase();
|
|
2863
|
+
if (U && (G === "outside" || G === "center") && this.applyStrokeAlignment(t, n, c, a, r, f), n.fill && n.fill.type !== "None") {
|
|
2813
2864
|
t.save();
|
|
2814
2865
|
const K = t.globalAlpha, Z = this.createCanvasFill(t, n.fill, a, r);
|
|
2815
|
-
t.fillStyle = Z || n.fill.color || "transparent", t.globalAlpha = K * this.normalizeOpacity(n.fill.opacity ?? 100),
|
|
2866
|
+
t.fillStyle = Z || n.fill.color || "transparent", t.globalAlpha = K * this.normalizeOpacity(n.fill.opacity ?? 100), f !== 0 ? (this.drawRoundRect(t, -a / 2, -r / 2, a, r, f), t.fill()) : t.fillRect(-a / 2, -r / 2, a, r), t.globalAlpha = K, t.restore();
|
|
2816
2867
|
}
|
|
2817
|
-
ft.complete && ft.naturalWidth > 0 ? (
|
|
2868
|
+
ft.complete && ft.naturalWidth > 0 ? (f !== 0 ? (t.save(), this.drawRoundRect(t, -a / 2, -r / 2, a, r, f), t.clip(), t.drawImage(ft, -a / 2, -r / 2, a, r), t.restore()) : t.drawImage(ft, -a / 2, -r / 2, a, r), U && G === "inside" && this.applyStrokeAlignment(t, n, c, a, r, f)) : U && G === "inside" && this.applyStrokeAlignment(t, n, c, a, r, f);
|
|
2818
2869
|
}
|
|
2819
2870
|
} else if (i.type === "SVG") {
|
|
2820
2871
|
const J = i.svgContent;
|
|
@@ -2849,22 +2900,22 @@ class li {
|
|
|
2849
2900
|
let Nt = this.imageCache.get(kt);
|
|
2850
2901
|
if (!Nt) {
|
|
2851
2902
|
Nt = new Image(), Nt.crossOrigin = "anonymous";
|
|
2852
|
-
let
|
|
2853
|
-
|
|
2903
|
+
let R = J;
|
|
2904
|
+
R.match(/xmlns=["']http:\/\/www\.w3\.org\/2000\/svg["']/i) || (R = R.replace(/<svg([^>]*)>/i, (ot, It) => `<svg xmlns="http://www.w3.org/2000/svg"${It}>`));
|
|
2854
2905
|
let ct = i.width || a || 100, Xt = i.height || r || 100;
|
|
2855
|
-
const xt =
|
|
2856
|
-
if (xt && (ct = parseFloat(xt[1]), Xt = parseFloat(xt[2])),
|
|
2906
|
+
const xt = R.match(/viewBox=["']\s*0\s+0\s+([\d.]+)\s+([\d.]+)\s*["']/i);
|
|
2907
|
+
if (xt && (ct = parseFloat(xt[1]), Xt = parseFloat(xt[2])), R = R.replace(/<svg([^>]*)>/i, (ot, It) => {
|
|
2857
2908
|
let bt = It.replace(/\b(?:width|height)=["'][^"']*["']/gi, " ");
|
|
2858
2909
|
return bt.match(/\bviewBox=/i) || (bt += ` viewBox="0 0 ${ct} ${Xt}"`), bt.match(/\bpreserveAspectRatio=/i) || (bt += ' preserveAspectRatio="none"'), bt += ' width="100%" height="100%"', `<svg${bt}>`;
|
|
2859
2910
|
}), i.colors && i.colors.length > 0 && ft.length > 0 && i.colors.forEach((ot, It) => {
|
|
2860
2911
|
if (ft[It]) {
|
|
2861
2912
|
const bt = ot.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"), vt = new RegExp(bt, "gi");
|
|
2862
|
-
|
|
2913
|
+
R = R.replace(vt, ft[It]);
|
|
2863
2914
|
}
|
|
2864
2915
|
}), U && U.type && U.type !== "None") {
|
|
2865
2916
|
if (U.type === "Solid" && U.color) {
|
|
2866
2917
|
const ot = Z ? "#FFFFFF" : U.color, It = Z ? 1 : this.normalizeOpacity(U.opacity ?? 100);
|
|
2867
|
-
|
|
2918
|
+
R = R.replace(/\bfill\s*=\s*["'][^"']*["']/gi, (bt) => /fill\s*=\s*["']\s*(none|transparent)\s*["']/i.test(bt) ? bt : `fill="${ot}"`), R = R.replace(/fill\s*:\s*[^;"')]+/gi, (bt) => /fill\s*:\s*(none|transparent)/i.test(bt) ? bt : `fill:${ot}`), It < 1 && (R = R.replace(/\bfill-opacity\s*=\s*["'][^"']*["']/gi, `fill-opacity="${It}"`), R = R.replace(/fill-opacity\s*:\s*[^;"')]+/gi, `fill-opacity:${It}`), R.match(/\bfill-opacity\s*=/i) || (R = R.replace(/(<svg[^>]*>)/i, `$1<g fill-opacity="${It}">`), R = R.replace(/<\/svg>/i, "</g></svg>")));
|
|
2868
2919
|
} else if (U.type === "LinearGradient" || U.type === "RadialGradient" || U.type === "Linear" || U.type === "Radial") {
|
|
2869
2920
|
const ot = "exode-fill", It = this.normalizeOpacity(U.opacity ?? 100), bt = (U.stops || []).map((gt) => {
|
|
2870
2921
|
const Rt = gt.offset !== void 0 ? gt.offset : gt.pos ?? 0, at = this.normalizeOpacity(gt.opacity ?? 100) * It;
|
|
@@ -2878,7 +2929,7 @@ class li {
|
|
|
2878
2929
|
const gt = (nt, wt) => Array.isArray(nt) ? nt[wt] ?? 0.5 : nt && typeof nt == "object" ? nt[wt === 0 ? "x" : "y"] ?? 0.5 : 0.5, Rt = gt(U.center, 0) * 100, at = gt(U.center, 1) * 100, st = (U.radius ?? 0.5) * 100;
|
|
2879
2930
|
vt = `<radialGradient id="${ot}" cx="${Rt}%" cy="${at}%" r="${st}%" gradientUnits="objectBoundingBox">${bt}</radialGradient>`;
|
|
2880
2931
|
}
|
|
2881
|
-
/<defs>/i.test(
|
|
2932
|
+
/<defs>/i.test(R) ? R = R.replace(/<defs>/i, `<defs>${vt}`) : R = R.replace(/<svg([^>]*)>/i, `<svg$1><defs>${vt}</defs>`), R = R.replace(/\bfill\s*=\s*["'][^"']*["']/gi, (gt) => /fill\s*=\s*["']\s*(none|transparent)\s*["']/i.test(gt) ? gt : `fill="url(#${ot})"`), R = R.replace(/fill\s*:\s*[^;"')]+/gi, (gt) => /fill\s*:\s*(none|transparent)/i.test(gt) ? gt : `fill:url(#${ot})`);
|
|
2882
2933
|
}
|
|
2883
2934
|
}
|
|
2884
2935
|
const te = (ot, It, bt = 1) => {
|
|
@@ -2902,13 +2953,13 @@ class li {
|
|
|
2902
2953
|
bt = vt.color || G.color || "#000000";
|
|
2903
2954
|
else if (vt.type === "LinearGradient" || vt.type === "RadialGradient" || vt.type === "Linear" || vt.type === "Radial") {
|
|
2904
2955
|
const Ht = "exode-stroke";
|
|
2905
|
-
|
|
2956
|
+
R = $t(R, te(vt, Ht, ot)), bt = `url(#${Ht})`;
|
|
2906
2957
|
}
|
|
2907
2958
|
}
|
|
2908
|
-
bt || (bt = It),
|
|
2959
|
+
bt || (bt = It), R.match(/\bstroke\s*=\s*["']/i) ? R = R.replace(
|
|
2909
2960
|
/\bstroke\s*=\s*["'][^"']*["']/gi,
|
|
2910
2961
|
(Ht) => /stroke\s*=\s*["']\s*(none|transparent)\s*["']/i.test(Ht) ? Ht : `stroke="${bt}"`
|
|
2911
|
-
) :
|
|
2962
|
+
) : R = R.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke="${bt}"`), R = R.replace(
|
|
2912
2963
|
new RegExp(`(?<![a-z-])stroke\\s*:\\s*(?!none|transparent)[^;"')]+`, "gi"),
|
|
2913
2964
|
`stroke:${bt}`
|
|
2914
2965
|
);
|
|
@@ -2919,11 +2970,11 @@ class li {
|
|
|
2919
2970
|
!isNaN(Ht) && !isNaN(se) && (gt = Ht, Rt = se);
|
|
2920
2971
|
}
|
|
2921
2972
|
const st = Math.max(1e-3, a / gt), nt = Math.max(1e-3, r / Rt), wt = (st + nt) / 2, z = (G.width || 1) / wt;
|
|
2922
|
-
|
|
2973
|
+
R.match(/\bstroke-width\s*=\s*["']/i) ? R = R.replace(/\bstroke-width\s*=\s*["'][^"']*["']/gi, `stroke-width="${z}"`) : R = R.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-width="${z}"`), R = R.replace(/stroke-width\s*:\s*[^;"')]+/gi, `stroke-width:${z}`), R.match(/\bstroke-opacity\s*=\s*["']/i) ? R = R.replace(/\bstroke-opacity\s*=\s*["'][^"']*["']/gi, `stroke-opacity="${ot}"`) : R = R.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-opacity="${ot}"`), R = R.replace(/stroke-opacity\s*:\s*[^;"')]+/gi, `stroke-opacity:${ot}`);
|
|
2923
2974
|
const pt = G.lineCap || "round";
|
|
2924
|
-
|
|
2975
|
+
R.match(/\bstroke-linecap\s*=\s*["']/i) ? R = R.replace(/\bstroke-linecap\s*=\s*["'][^"']*["']/gi, `stroke-linecap="${pt}"`) : R = R.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-linecap="${pt}"`), R = R.replace(/stroke-linecap\s*:\s*[^;"')]+/gi, `stroke-linecap:${pt}`);
|
|
2925
2976
|
const ut = G.lineJoin || "round";
|
|
2926
|
-
|
|
2977
|
+
R.match(/\bstroke-linejoin\s*=\s*["']/i) ? R = R.replace(/\bstroke-linejoin\s*=\s*["'][^"']*["']/gi, `stroke-linejoin="${ut}"`) : R = R.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-linejoin="${ut}"`), R = R.replace(/stroke-linejoin\s*:\s*[^;"')]+/gi, `stroke-linejoin:${ut}`);
|
|
2927
2978
|
const ce = G.trimStart ?? 0, me = G.trimEnd ?? 1, Ie = G.trimOffset ?? 0, we = G.dashOffset ?? 0, Te = ce !== 0 || me !== 1 || Ie !== 0 || we !== 0;
|
|
2928
2979
|
if (Te) {
|
|
2929
2980
|
const Ht = Math.max(0, Math.min(1, ce)), se = Math.max(0, Math.min(1, me));
|
|
@@ -2936,10 +2987,10 @@ class li {
|
|
|
2936
2987
|
const le = ue * (se - Ht), ye = ue - le;
|
|
2937
2988
|
re = -(ue * (Ht + Me + ke)), fe = `${le} ${ye}`;
|
|
2938
2989
|
}
|
|
2939
|
-
|
|
2990
|
+
R.match(/\bstroke-dasharray\s*=/i) ? R = R.replace(/\bstroke-dasharray\s*=\s*["'][^"']*["']/gi, `stroke-dasharray="${fe}"`) : R = R.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-dasharray="${fe}"`), R = R.replace(/stroke-dasharray\s*:\s*[^;"')]+/gi, `stroke-dasharray:${fe}`), R.match(/\bstroke-dashoffset\s*=/i) ? R = R.replace(/\bstroke-dashoffset\s*=\s*["'][^"']*["']/gi, `stroke-dashoffset="${re}"`) : R = R.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-dashoffset="${re}"`), R = R.replace(/stroke-dashoffset\s*:\s*[^;"')]+/gi, `stroke-dashoffset:${re}`);
|
|
2940
2991
|
} else if (G.dashArray && G.dashArray.length > 0) {
|
|
2941
2992
|
const Ht = G.dashArray.join(" ");
|
|
2942
|
-
|
|
2993
|
+
R = R.replace(/\bstroke-dasharray\s*=\s*["'][^"']*["']/gi, `stroke-dasharray="${Ht}"`), R = R.replace(/stroke-dasharray\s*:\s*[^;"')]+/gi, `stroke-dasharray:${Ht}`), G.dashOffset && (R = R.replace(/\bstroke-dashoffset\s*=\s*["'][^"']*["']/gi, `stroke-dashoffset="${G.dashOffset}"`), R = R.replace(/stroke-dashoffset\s*:\s*[^;"')]+/gi, `stroke-dashoffset:${G.dashOffset}`));
|
|
2943
2994
|
}
|
|
2944
2995
|
if (!/\bstroke\s*=\s*["']/i.test(J) && !new RegExp("(?<![a-z-])stroke\\s*:", "i").test(J)) {
|
|
2945
2996
|
let Ht = "", se = "";
|
|
@@ -2953,13 +3004,13 @@ class li {
|
|
|
2953
3004
|
}
|
|
2954
3005
|
} else (_ = G.dashArray) != null && _.length && (Ht = ` stroke-dasharray="${G.dashArray.join(" ")}"`, G.dashOffset && (se = ` stroke-dashoffset="${G.dashOffset}"`));
|
|
2955
3006
|
const ue = ` stroke-linecap="${G.lineCap || "round"}"`, Me = ` stroke-linejoin="${G.lineJoin || "round"}"`, ke = `stroke="${bt}" stroke-width="${z}" stroke-opacity="${ot}"${ue}${Me}${Ht}${se}`;
|
|
2956
|
-
|
|
3007
|
+
R = R.replace(
|
|
2957
3008
|
/(<svg[^>]*>)(\s*(?:<defs>[\s\S]*?<\/defs>)?)/i,
|
|
2958
3009
|
(fe, re, le) => `${re}${le}<g ${ke}>`
|
|
2959
|
-
),
|
|
3010
|
+
), R = R.replace(/<\/svg>/i, "</g></svg>");
|
|
2960
3011
|
}
|
|
2961
|
-
} else G && G.isEnabled === !1 && (
|
|
2962
|
-
const Wt = new Blob([
|
|
3012
|
+
} else G && G.isEnabled === !1 && (R = R.replace(/\bstroke\s*=\s*["'][^"']*["']/gi, 'stroke="none"'), R = R.replace(new RegExp(`(?<![a-z-])stroke\\s*:\\s*(?!none|transparent)[^;"')]+`, "gi"), "stroke:none"));
|
|
3013
|
+
const Wt = new Blob([R], { type: "image/svg+xml" }), Ft = URL.createObjectURL(Wt);
|
|
2963
3014
|
Nt.onload = () => {
|
|
2964
3015
|
if (URL.revokeObjectURL(Ft), this.frameCount % 900 === 0) {
|
|
2965
3016
|
const ot = this.imageCache.get(kt);
|
|
@@ -2971,32 +3022,32 @@ class li {
|
|
|
2971
3022
|
}
|
|
2972
3023
|
let yt = null;
|
|
2973
3024
|
if (Nt.complete && Nt.naturalWidth > 0 ? (yt = Nt, this.lastValidSvgImgMap.set(s.id, Nt)) : yt = this.lastValidSvgImgMap.get(s.id) || null, yt && yt.complete && yt.naturalWidth > 0) {
|
|
2974
|
-
const
|
|
3025
|
+
const R = Math.max(1, a), ct = Math.max(1, r);
|
|
2975
3026
|
if (Z && (U == null ? void 0 : U.type) === "Solid") {
|
|
2976
|
-
this.maskBuffer || (this.maskBuffer = document.createElement("canvas"), this.maskCtx = this.maskBuffer.getContext("2d")), this.maskBuffer.width =
|
|
3027
|
+
this.maskBuffer || (this.maskBuffer = document.createElement("canvas"), this.maskCtx = this.maskBuffer.getContext("2d")), this.maskBuffer.width = R, this.maskBuffer.height = ct, this.maskCtx.setTransform(1, 0, 0, 1, 0, 0), this.maskCtx.globalCompositeOperation = "source-over", this.maskCtx.globalAlpha = 1, this.maskCtx.filter = "none", this.maskCtx.clearRect(0, 0, R, ct), this.maskCtx.drawImage(yt, 0, 0, R, ct), this.maskCtx.globalCompositeOperation = "source-in";
|
|
2977
3028
|
const Xt = U.color || "#000000", xt = this.normalizeOpacity(U.opacity ?? 100);
|
|
2978
|
-
this.maskCtx.fillStyle = Xt, this.maskCtx.globalAlpha = xt, this.maskCtx.fillRect(0, 0,
|
|
2979
|
-
} else
|
|
3029
|
+
this.maskCtx.fillStyle = Xt, this.maskCtx.globalAlpha = xt, this.maskCtx.fillRect(0, 0, R, ct), t.drawImage(this.maskBuffer, -R / 2, -ct / 2, R, ct);
|
|
3030
|
+
} else f !== 0 ? (t.save(), this.drawRoundRect(t, -R / 2, -ct / 2, R, ct, f), t.clip(), t.drawImage(yt, -R / 2, -ct / 2, R, ct), t.restore()) : t.drawImage(yt, -R / 2, -ct / 2, R, ct);
|
|
2980
3031
|
}
|
|
2981
3032
|
}
|
|
2982
3033
|
} else if (c.type === "LineGraph")
|
|
2983
3034
|
this.renderLineGraph(t, c, a, r);
|
|
2984
3035
|
else if (s.type === "Shape") {
|
|
2985
|
-
if (this.applyPath(t, c, a, r,
|
|
3036
|
+
if (this.applyPath(t, c, a, r, f), t.save(), n.blur && n.blur.amount > 0 && (t.filter = `blur(${n.blur.amount}px)`), n.fill) {
|
|
2986
3037
|
const J = t.globalAlpha;
|
|
2987
3038
|
if (((L = n.fill) == null ? void 0 : L.type) === "Image" && (n.fill.originalSrc || n.fill.src)) {
|
|
2988
3039
|
const ft = n.fill.originalSrc || n.fill.src;
|
|
2989
3040
|
let U = this.imageCache.get(ft);
|
|
2990
|
-
U || (U = new Image(), U.src = ft, this.imageCache.set(ft, U)), U.complete && U.naturalWidth > 0 && (t.save(), this.applyPath(t, c, a, r,
|
|
3041
|
+
U || (U = new Image(), U.src = ft, this.imageCache.set(ft, U)), U.complete && U.naturalWidth > 0 && (t.save(), this.applyPath(t, c, a, r, f), t.clip(), this.renderFittedImage(t, U, -a / 2, -r / 2, a, r, n.fill.fillMode), t.restore());
|
|
2991
3042
|
} else {
|
|
2992
3043
|
const ft = this.createCanvasFill(t, n.fill, a, r);
|
|
2993
|
-
t.fillStyle = ft || (typeof n.fill == "string" ? n.fill : n.fill.color || "transparent"), t.globalAlpha = J * this.normalizeOpacity(n.fill.opacity ?? 100), this.applyPath(t, c, a, r,
|
|
3044
|
+
t.fillStyle = ft || (typeof n.fill == "string" ? n.fill : n.fill.color || "transparent"), t.globalAlpha = J * this.normalizeOpacity(n.fill.opacity ?? 100), this.applyPath(t, c, a, r, f), t.fill();
|
|
2994
3045
|
}
|
|
2995
3046
|
t.globalAlpha = J;
|
|
2996
3047
|
}
|
|
2997
|
-
t.restore(), n.stroke && n.stroke.width > 0 && this.applyStrokeAlignment(t, n, c, a, r,
|
|
3048
|
+
t.restore(), n.stroke && n.stroke.width > 0 && this.applyStrokeAlignment(t, n, c, a, r, f);
|
|
2998
3049
|
} else if (s.type === "Frame" || s.type === "Group" && !s.isStructuralGroup) {
|
|
2999
|
-
const J = e.width ?? i.width ?? s.width ?? a, ft = e.height ?? i.height ?? s.height ?? r, U =
|
|
3050
|
+
const J = e.width ?? i.width ?? s.width ?? a, ft = e.height ?? i.height ?? s.height ?? r, U = f;
|
|
3000
3051
|
if (t.save(), t.beginPath(), this.drawRoundRect(t, -J / 2, -ft / 2, J, ft, U), n.fill && n.fill.type !== "None") {
|
|
3001
3052
|
const G = t.globalAlpha, K = this.createCanvasFill(t, n.fill, J, ft);
|
|
3002
3053
|
t.fillStyle = K || n.fill.color || "transparent", t.globalAlpha = G * this.normalizeOpacity(n.fill.opacity ?? 100), t.fill(), t.globalAlpha = G;
|
|
@@ -3006,7 +3057,7 @@ class li {
|
|
|
3006
3057
|
this.applyStrokeAlignment(t, n, G, J, ft, U);
|
|
3007
3058
|
}
|
|
3008
3059
|
} else s.type === "Group" && s.isStructuralGroup || (s.type === "Component" && s.variant === "inputbox" ? this.renderInputBox(t, s) : s.type === "Component" && s.variant === "button" ? this.renderButton(t, s) : s.type === "Component" && s.variant === "toggle_button" ? this.renderToggleButton(t, s) : s.type === "Toggle" || s.type === "Component" && s.variant === "toggle" ? this.renderToggle(t, s) : s.type === "Slider" || s.type === "Component" && s.variant === "slider" ? this.renderSlider(t, s) : s.type === "Dropdown" || s.type === "Component" && s.variant === "dropdown" ? this.renderDropdown(t, s) : s.type === "ListView" || s.type === "Component" && s.variant === "listview" ? this.renderListView(t, s) : s.type === "Checkbox" || s.type === "Component" && s.variant === "checkbox" ? this.renderCheckbox(t, s) : s.type === "RadioGroup" || s.type === "Component" && s.variant === "radiogroup" ? this.renderRadioGroup(t, s) : s.type === "BarChart" || s.type === "Component" && s.variant === "barchart" ? this.renderBarChart(t, s) : s.type === "PieChart" || s.type === "Component" && s.variant === "piechart" ? this.renderPieChart(t, s) : this.frameCount % 60 === 0 && console.warn("[Engine] Unhandled object type in renderObject:", s.type, "Geo:", (x = s.geometry) == null ? void 0 : x.type));
|
|
3009
|
-
if (this.applyArtEffectOverlay(t, s, c, a, r,
|
|
3060
|
+
if (this.applyArtEffectOverlay(t, s, c, a, r, f), dt && St === "BackgroundBlur" && this.applyBackgroundBlurGlass(t, c, a, r, f, it), ee && ee.enabled && t.restore(), s.children && s.children.length > 0) {
|
|
3010
3061
|
const ft = s.type === "Frame", U = s.clipsContent !== void 0 ? s.clipsContent : s.clipContent !== void 0 ? s.clipContent : ft;
|
|
3011
3062
|
if (t.save(), U) {
|
|
3012
3063
|
t.beginPath();
|
|
@@ -3038,7 +3089,7 @@ class li {
|
|
|
3038
3089
|
feather: s.maskFeather || 0,
|
|
3039
3090
|
isVisible: !0
|
|
3040
3091
|
}] : [])).filter((G) => G.isVisible !== !1 && o.has(G.maskId)).forEach((G) => {
|
|
3041
|
-
var yt,
|
|
3092
|
+
var yt, R, ct, Xt, xt, te;
|
|
3042
3093
|
const K = o.get(G.maskId), Z = this.objectStates.get(K.id), At = G.feather || 0, Ot = G.inverted === !0, kt = G.opacity !== void 0 ? typeof G.opacity == "number" ? G.opacity : G.opacity / 100 : 1;
|
|
3043
3094
|
if ((G.type || "alpha") === "luma") {
|
|
3044
3095
|
(!this.lumaBuffer || this.lumaBuffer.width !== this.maskBuffer.width || this.lumaBuffer.height !== this.maskBuffer.height) && (this.lumaBuffer = document.createElement("canvas"), this.lumaBuffer.width = this.maskBuffer.width, this.lumaBuffer.height = this.maskBuffer.height, this.lumaCtx = this.lumaBuffer.getContext("2d", { willReadFrequently: !0 }), this.lumaCtx && (this.lumaCtx.imageSmoothingEnabled = !0, this.lumaCtx.imageSmoothingQuality = "high")), this.lumaCtx.setTransform(1, 0, 0, 1, 0, 0), this.lumaCtx.globalCompositeOperation = "source-over", this.lumaCtx.globalAlpha = 1, this.lumaCtx.filter = "none", this.lumaCtx.clearRect(0, 0, this.lumaBuffer.width, this.lumaBuffer.height), this.lumaCtx.save(), this.rootTransform && this.lumaCtx.setTransform(this.rootTransform), this.applyAbsoluteTransform(this.lumaCtx, K.id, o), At > 0 && (this.lumaCtx.filter = `blur(${At}px)`), this.lumaCtx.globalAlpha = kt;
|
|
@@ -3046,7 +3097,7 @@ class li {
|
|
|
3046
3097
|
if (((yt = K.geometry) == null ? void 0 : yt.type) === "Text") {
|
|
3047
3098
|
const vt = Z != null && Z.geometry ? this.deepMerge(K.geometry, Z.geometry) : K.geometry, gt = Z != null && Z.style ? this.deepMerge(K.style, Z.style) : K.style;
|
|
3048
3099
|
this._renderText(this.lumaCtx, K, { ...vt, width: $t, height: Wt, corner_radius: Ft }, gt, Z, $t, Wt, !0);
|
|
3049
|
-
} else if (((
|
|
3100
|
+
} else if (((R = K.geometry) == null ? void 0 : R.type) === "Image") {
|
|
3050
3101
|
const vt = K.geometry.src;
|
|
3051
3102
|
if (vt) {
|
|
3052
3103
|
let gt = this.imageCache.get(vt);
|
|
@@ -3115,10 +3166,10 @@ class li {
|
|
|
3115
3166
|
}
|
|
3116
3167
|
_renderText(t, s, o, e, i, n, a, r = !1, l = !1) {
|
|
3117
3168
|
var St, ht, mt, rt, Lt, Gt, Pt, Dt, Yt;
|
|
3118
|
-
let
|
|
3169
|
+
let f = o.text || "";
|
|
3119
3170
|
if (o.textInputId && !r) {
|
|
3120
3171
|
const B = this.inputs.get(o.textInputId);
|
|
3121
|
-
B !== void 0 && (
|
|
3172
|
+
B !== void 0 && (f = String(B), i.geometry && i.geometry.type === "Text" && (i.geometry.text = f));
|
|
3122
3173
|
}
|
|
3123
3174
|
if (o.svgPath) {
|
|
3124
3175
|
const B = o.svgPath;
|
|
@@ -3129,13 +3180,13 @@ class li {
|
|
|
3129
3180
|
t.fill(Mt), t.restore();
|
|
3130
3181
|
return;
|
|
3131
3182
|
}
|
|
3132
|
-
let c =
|
|
3183
|
+
let c = f || "";
|
|
3133
3184
|
o.enableSegments === !0 && o.segments && Array.isArray(o.segments) && (c = o.segments.map((B) => B && B.text ? B.text : "").join(""));
|
|
3134
3185
|
const g = o.textCase || "none";
|
|
3135
3186
|
g === "uppercase" ? c = c.toUpperCase() : g === "lowercase" ? c = c.toLowerCase() : g === "capitalize" && (c = c.replace(/\b\w/g, (B) => B.toUpperCase()));
|
|
3136
|
-
let
|
|
3137
|
-
|
|
3138
|
-
const u = this.mapFontWeight(
|
|
3187
|
+
let h = ((rt = o.fontWeight) == null ? void 0 : rt.toString()) || "400", d = o.fontStyle || "normal";
|
|
3188
|
+
h.toLowerCase().includes("italic") && (d = "italic", h = h.replace(/italic/gi, "").trim() || "400");
|
|
3189
|
+
const u = this.mapFontWeight(h), m = Math.max(1, o.fontSize || 32);
|
|
3139
3190
|
let y = o.fontFamily || "Inter";
|
|
3140
3191
|
const v = ["Bold", "SemiBold", "Medium", "Regular", "Light", "Thin", "ExtraBold", "Black", "Italic"];
|
|
3141
3192
|
v.forEach((B) => {
|
|
@@ -3148,20 +3199,20 @@ class li {
|
|
|
3148
3199
|
t.textBaseline = "top";
|
|
3149
3200
|
const w = o.textAlign || "left";
|
|
3150
3201
|
t.textAlign = w;
|
|
3151
|
-
let
|
|
3202
|
+
let M = 0;
|
|
3152
3203
|
if (typeof o.letterSpacing == "number")
|
|
3153
|
-
|
|
3204
|
+
M = o.letterSpacing;
|
|
3154
3205
|
else if (typeof o.letterSpacing == "object" && o.letterSpacing.value !== void 0) {
|
|
3155
3206
|
const B = o.letterSpacing;
|
|
3156
|
-
|
|
3207
|
+
M = B.unit === "PERCENT" ? B.value / 100 * m : B.value;
|
|
3157
3208
|
}
|
|
3158
|
-
t.letterSpacing !== void 0 && (t.letterSpacing = `${
|
|
3159
|
-
const
|
|
3160
|
-
|
|
3209
|
+
t.letterSpacing !== void 0 && (t.letterSpacing = `${M}px`);
|
|
3210
|
+
const P = o.kerning || "auto", T = o.kerningValue || 0;
|
|
3211
|
+
P === "manual" && T !== 0 && (t.letterSpacing = `${M + T}px`);
|
|
3161
3212
|
const W = o.paragraphSpacing || 0;
|
|
3162
|
-
let
|
|
3163
|
-
typeof
|
|
3164
|
-
const _ = (
|
|
3213
|
+
let k = o.lineHeight ?? 1.2;
|
|
3214
|
+
typeof k == "string" && (k = parseFloat(k)), k > 5 && m > 0 && (k = k / m);
|
|
3215
|
+
const _ = (k || 1.2) * m, L = o.isPointText === !0 || !o.width || o.width <= 0, x = ((Lt = o.padding) == null ? void 0 : Lt.left) || ((Gt = o.padding) == null ? void 0 : Gt.right) || 0, A = L ? 1e5 : o.width && o.width > 0 ? Math.ceil(o.width) - x * 2 : 1e5;
|
|
3165
3216
|
o.autoHeight;
|
|
3166
3217
|
const $ = ps({
|
|
3167
3218
|
text: c,
|
|
@@ -3169,9 +3220,9 @@ class li {
|
|
|
3169
3220
|
fontSize: m,
|
|
3170
3221
|
fontWeight: u,
|
|
3171
3222
|
fontStyle: d,
|
|
3172
|
-
lineHeight:
|
|
3173
|
-
width:
|
|
3174
|
-
letterSpacing:
|
|
3223
|
+
lineHeight: k,
|
|
3224
|
+
width: A,
|
|
3225
|
+
letterSpacing: M,
|
|
3175
3226
|
paragraphSpacing: W,
|
|
3176
3227
|
paragraphIndent: o.paragraphIndent || 0,
|
|
3177
3228
|
segments: o.segments,
|
|
@@ -3181,8 +3232,8 @@ class li {
|
|
|
3181
3232
|
composer: o.composer,
|
|
3182
3233
|
balanceRaggedLines: o.balanceRaggedLines
|
|
3183
3234
|
}), O = $.lines || [], V = $.maxFontSize || m, H = this.fontLeadingFactors[y] ?? 0.5, et = (_ - m) * H;
|
|
3184
|
-
let
|
|
3185
|
-
a > 0 && a >
|
|
3235
|
+
let E = $.height, F = -E / 2;
|
|
3236
|
+
a > 0 && a > E && (I === "top" ? F = -a / 2 : I === "middle" || I === "center" ? F = -E / 2 : I === "bottom" && (F = a / 2 - E)), F += et;
|
|
3186
3237
|
let q = null, Q = 0;
|
|
3187
3238
|
if (o.pathId && this.artboard) {
|
|
3188
3239
|
const B = this.artboard.objects.find((lt) => lt.id === o.pathId);
|
|
@@ -3193,7 +3244,7 @@ class li {
|
|
|
3193
3244
|
}
|
|
3194
3245
|
const it = (B, lt) => {
|
|
3195
3246
|
var Mt, Tt;
|
|
3196
|
-
if (
|
|
3247
|
+
if (M === 0 && (!o.enableSegments || !((Mt = o.segments) != null && Mt.length))) return t.measureText(B).width;
|
|
3197
3248
|
let zt = 0;
|
|
3198
3249
|
for (let Vt = 0; Vt < B.length; Vt++) {
|
|
3199
3250
|
const Ut = lt + Vt;
|
|
@@ -3216,9 +3267,9 @@ class li {
|
|
|
3216
3267
|
Jt = t.measureText(B[Vt]).width;
|
|
3217
3268
|
} else
|
|
3218
3269
|
Jt = t.measureText(B[Vt]).width;
|
|
3219
|
-
zt += Jt +
|
|
3270
|
+
zt += Jt + M;
|
|
3220
3271
|
}
|
|
3221
|
-
return zt - (B.length > 0 ?
|
|
3272
|
+
return zt - (B.length > 0 ? M : 0);
|
|
3222
3273
|
}, dt = (B, lt, zt, Mt, Tt) => {
|
|
3223
3274
|
var jt, ee;
|
|
3224
3275
|
const Ut = (Tt === 0 || c[Tt - 1] === `
|
|
@@ -3236,13 +3287,13 @@ class li {
|
|
|
3236
3287
|
let G = 0, K = 0;
|
|
3237
3288
|
const Z = o.justifyMinWordSpacing, At = o.justifyMaxWordSpacing;
|
|
3238
3289
|
if (w === "justify" && !U && J > 0 && !o.pathId) {
|
|
3239
|
-
const yt = L ? J :
|
|
3290
|
+
const yt = L ? J : A - x * 2 + 0, R = Math.max(0, yt - J);
|
|
3240
3291
|
for (let ct = 0; ct < B.length; ct++)
|
|
3241
3292
|
B[ct] === " " && K++;
|
|
3242
3293
|
if (K > 0) {
|
|
3243
3294
|
const ct = t.measureText(" ").width;
|
|
3244
3295
|
let Xt = Z || ct * 0.5, xt = At || ct * 2.5;
|
|
3245
|
-
G = Math.max(0, Math.min(
|
|
3296
|
+
G = Math.max(0, Math.min(R / K, xt - Xt));
|
|
3246
3297
|
}
|
|
3247
3298
|
}
|
|
3248
3299
|
let Ot = o.pathOffset || 0;
|
|
@@ -3282,9 +3333,9 @@ class li {
|
|
|
3282
3333
|
].includes(yt.type) && yt.enabled
|
|
3283
3334
|
)) || [];
|
|
3284
3335
|
for (let yt = 0; yt < B.length; yt++) {
|
|
3285
|
-
let
|
|
3336
|
+
let R = B[yt];
|
|
3286
3337
|
const ct = Tt + yt;
|
|
3287
|
-
let Xt = 0, xt = 0, te = 1, $t = 1, Wt = 0, Ft = 1, ot =
|
|
3338
|
+
let Xt = 0, xt = 0, te = 1, $t = 1, Wt = 0, Ft = 1, ot = R;
|
|
3288
3339
|
Nt.forEach((at) => {
|
|
3289
3340
|
const st = at.settings || {}, nt = st.strength || 1, wt = Date.now();
|
|
3290
3341
|
if (at.type === Y.Typewriter)
|
|
@@ -3422,7 +3473,7 @@ class li {
|
|
|
3422
3473
|
const at = l ? "#000000" : this.createCanvasFill(t, e.fill, n, a);
|
|
3423
3474
|
t.fillStyle = at || e.fill.color || "#ffffff", t.fillText(ot, -Rt / 2, 0);
|
|
3424
3475
|
} else Mt ? t.strokeText(ot, -Rt / 2, 0) : t.fillText(ot, -Rt / 2, 0);
|
|
3425
|
-
bt !== "none" && !r && this.drawTextDecoration(t, bt, 0, 0, Rt, vt), t.restore(), t.globalAlpha = gt, w === "justify" && G > 0 && ot === " " && !U ? kt += Rt +
|
|
3476
|
+
bt !== "none" && !r && this.drawTextDecoration(t, bt, 0, 0, Rt, vt), t.restore(), t.globalAlpha = gt, w === "justify" && G > 0 && ot === " " && !U ? kt += Rt + M + G : kt += Rt + M;
|
|
3426
3477
|
}
|
|
3427
3478
|
}
|
|
3428
3479
|
};
|
|
@@ -3508,11 +3559,11 @@ class li {
|
|
|
3508
3559
|
t.strokeStyle = a.color || "#000000";
|
|
3509
3560
|
const c = t.globalAlpha;
|
|
3510
3561
|
t.globalAlpha = c * this.normalizeOpacity(a.opacity ?? 100), t.lineWidth = r, t.lineCap = a.lineCap || "round", t.lineJoin = a.lineJoin || "round", a.miterLimit !== void 0 && (t.miterLimit = a.miterLimit);
|
|
3511
|
-
const g = a.trimStart ?? 0,
|
|
3512
|
-
if (g !== 0 ||
|
|
3562
|
+
const g = a.trimStart ?? 0, h = a.trimEnd ?? 1, d = a.trimOffset ?? 0, u = a.dashOffset ?? 0, m = a.dashArray || [];
|
|
3563
|
+
if (g !== 0 || h !== 1 || d !== 0) {
|
|
3513
3564
|
const y = this.getPerimeter(o, e, i);
|
|
3514
3565
|
if (y > 0) {
|
|
3515
|
-
const v = Math.max(0, Math.min(1, g)), b = Math.max(0, Math.min(1,
|
|
3566
|
+
const v = Math.max(0, Math.min(1, g)), b = Math.max(0, Math.min(1, h));
|
|
3516
3567
|
if (v < b) {
|
|
3517
3568
|
const C = y * (b - v), S = y - C, I = -(y * (v + d % 1));
|
|
3518
3569
|
t.setLineDash([C, S]), t.lineDashOffset = I + u * y;
|
|
@@ -3535,8 +3586,8 @@ class li {
|
|
|
3535
3586
|
if (n >= 360 && a <= 0) return r;
|
|
3536
3587
|
let l = n / 360 * r;
|
|
3537
3588
|
if (a > 0) {
|
|
3538
|
-
const
|
|
3539
|
-
l += n / 360 *
|
|
3589
|
+
const f = Math.PI * (3 * (e * a + i * a) - Math.sqrt((3 * e * a + i * a) * (e * a + 3 * i * a)));
|
|
3590
|
+
l += n / 360 * f, n < 360 && (l += 2 * Math.sqrt((e - e * a) ** 2 + (i - i * a) ** 2));
|
|
3540
3591
|
} else n < 360 && (l += 2 * Math.max(e, i));
|
|
3541
3592
|
return isNaN(l) ? 0 : l;
|
|
3542
3593
|
}
|
|
@@ -3562,17 +3613,17 @@ class li {
|
|
|
3562
3613
|
n = l.x, a = l.y;
|
|
3563
3614
|
continue;
|
|
3564
3615
|
}
|
|
3565
|
-
const
|
|
3616
|
+
const f = n, c = a, g = e[r - 1].out_x, h = e[r - 1].out_y;
|
|
3566
3617
|
if (g !== void 0 || l.in_x !== void 0 ? i += this.getBezierLength(
|
|
3567
|
-
|
|
3618
|
+
f,
|
|
3568
3619
|
c,
|
|
3569
|
-
g ??
|
|
3570
|
-
|
|
3620
|
+
g ?? f,
|
|
3621
|
+
h ?? c,
|
|
3571
3622
|
l.in_x ?? l.x,
|
|
3572
3623
|
l.in_y ?? l.y,
|
|
3573
3624
|
l.x,
|
|
3574
3625
|
l.y
|
|
3575
|
-
) : i += Math.sqrt((l.x -
|
|
3626
|
+
) : i += Math.sqrt((l.x - f) ** 2 + (l.y - c) ** 2), n = l.x, a = l.y, l.closePath || r === e.length - 1 && (t.is_closed || t.isClosed)) {
|
|
3576
3627
|
const d = n, u = a, m = [...e.slice(0, r + 1)].reverse().find((w) => w.moveTo) || e[0], y = m.x, v = m.y, b = e[r].out_x, C = e[r].out_y, S = m.in_x, I = m.in_y;
|
|
3577
3628
|
b !== void 0 || S !== void 0 ? i += this.getBezierLength(
|
|
3578
3629
|
d,
|
|
@@ -3593,23 +3644,23 @@ class li {
|
|
|
3593
3644
|
}
|
|
3594
3645
|
}
|
|
3595
3646
|
getBezierLength(t, s, o, e, i, n, a, r, l = 10) {
|
|
3596
|
-
let
|
|
3597
|
-
for (let
|
|
3598
|
-
const d =
|
|
3599
|
-
|
|
3647
|
+
let f = 0, c = t, g = s;
|
|
3648
|
+
for (let h = 1; h <= l; h++) {
|
|
3649
|
+
const d = h / l, u = 1 - d, m = d * d, y = u * u, v = y * u, b = m * d, C = v * t + 3 * y * d * o + 3 * u * m * i + b * a, S = v * s + 3 * y * d * e + 3 * u * m * n + b * r, I = C - c, w = S - g;
|
|
3650
|
+
f += Math.sqrt(I * I + w * w), c = C, g = S;
|
|
3600
3651
|
}
|
|
3601
|
-
return
|
|
3652
|
+
return f;
|
|
3602
3653
|
}
|
|
3603
|
-
getBezierTAtLength(t, s, o, e, i, n, a, r, l,
|
|
3654
|
+
getBezierTAtLength(t, s, o, e, i, n, a, r, l, f = 20) {
|
|
3604
3655
|
if (t <= 0) return 0;
|
|
3605
|
-
let c = 0, g = s,
|
|
3606
|
-
for (let d = 1; d <=
|
|
3607
|
-
const u = d /
|
|
3608
|
-
if (c +
|
|
3609
|
-
const T = t - c, W =
|
|
3610
|
-
return (d - 1 + W) /
|
|
3656
|
+
let c = 0, g = s, h = o;
|
|
3657
|
+
for (let d = 1; d <= f; d++) {
|
|
3658
|
+
const u = d / f, m = 1 - u, y = u * u, v = m * m, b = v * m, C = y * u, S = b * s + 3 * v * u * e + 3 * m * y * n + C * r, I = b * o + 3 * v * u * i + 3 * m * y * a + C * l, w = S - g, M = I - h, P = Math.sqrt(w * w + M * M);
|
|
3659
|
+
if (c + P >= t) {
|
|
3660
|
+
const T = t - c, W = P === 0 ? 0 : T / P;
|
|
3661
|
+
return (d - 1 + W) / f;
|
|
3611
3662
|
}
|
|
3612
|
-
c +=
|
|
3663
|
+
c += P, g = S, h = I;
|
|
3613
3664
|
}
|
|
3614
3665
|
return 1;
|
|
3615
3666
|
}
|
|
@@ -3621,7 +3672,7 @@ class li {
|
|
|
3621
3672
|
i.forEach((v) => {
|
|
3622
3673
|
typeof v.x == "number" && typeof v.y == "number" && (n = Math.min(n, v.x), a = Math.max(a, v.x), r = Math.min(r, v.y), l = Math.max(l, v.y), v.out_x !== void 0 && (n = Math.min(n, v.out_x), a = Math.max(a, v.out_x)), v.out_y !== void 0 && (r = Math.min(r, v.out_y), l = Math.max(l, v.out_y)), v.in_x !== void 0 && (n = Math.min(n, v.in_x), a = Math.max(a, v.in_x)), v.in_y !== void 0 && (r = Math.min(r, v.in_y), l = Math.max(l, v.in_y)));
|
|
3623
3674
|
});
|
|
3624
|
-
const
|
|
3675
|
+
const f = (n + a) / 2, c = (r + l) / 2, h = this.getPerimeter(t, s, o) * e;
|
|
3625
3676
|
let d = 0;
|
|
3626
3677
|
const u = [];
|
|
3627
3678
|
let m = i[0], y = i[0];
|
|
@@ -3637,30 +3688,30 @@ class li {
|
|
|
3637
3688
|
const b = v.p0, C = v.p1;
|
|
3638
3689
|
let S = 0;
|
|
3639
3690
|
const I = b.out_x !== void 0 || C.in_x !== void 0;
|
|
3640
|
-
if (I ? S = this.getBezierLength(b.x, b.y, b.out_x ?? b.x, b.out_y ?? b.y, C.in_x ?? C.x, C.in_y ?? C.y, C.x, C.y) : S = Math.sqrt((C.x - b.x) ** 2 + (C.y - b.y) ** 2), d + S >=
|
|
3691
|
+
if (I ? S = this.getBezierLength(b.x, b.y, b.out_x ?? b.x, b.out_y ?? b.y, C.in_x ?? C.x, C.in_y ?? C.y, C.x, C.y) : S = Math.sqrt((C.x - b.x) ** 2 + (C.y - b.y) ** 2), d + S >= h || v === u[u.length - 1]) {
|
|
3641
3692
|
let w = 0;
|
|
3642
3693
|
if (I)
|
|
3643
|
-
return w = this.getBezierTAtLength(
|
|
3694
|
+
return w = this.getBezierTAtLength(h - d, b.x, b.y, b.out_x ?? b.x, b.out_y ?? b.y, C.in_x ?? C.x, C.in_y ?? C.y, C.x, C.y, 20), this.getBezierPointAndAngle(w, b, C, f, c);
|
|
3644
3695
|
{
|
|
3645
|
-
w = S === 0 ? 0 : (
|
|
3646
|
-
const
|
|
3647
|
-
return { x:
|
|
3696
|
+
w = S === 0 ? 0 : (h - d) / S;
|
|
3697
|
+
const M = b.x + (C.x - b.x) * w - f, P = b.y + (C.y - b.y) * w - c, T = Math.atan2(C.y - b.y, C.x - b.x);
|
|
3698
|
+
return { x: M, y: P, angle: T };
|
|
3648
3699
|
}
|
|
3649
3700
|
}
|
|
3650
3701
|
d += S;
|
|
3651
3702
|
}
|
|
3652
3703
|
} else if (t.type === "Ellipse") {
|
|
3653
|
-
const i = Math.abs(s) / 2, n = Math.abs(o) / 2, a = t.sweepAngle ?? 360, l = ((t.startAngle ?? 0) + a * e) * Math.PI / 180,
|
|
3654
|
-
return { x:
|
|
3704
|
+
const i = Math.abs(s) / 2, n = Math.abs(o) / 2, a = t.sweepAngle ?? 360, l = ((t.startAngle ?? 0) + a * e) * Math.PI / 180, f = i * Math.cos(l), c = n * Math.sin(l), g = -i * Math.sin(l), h = n * Math.cos(l), d = Math.atan2(h, g);
|
|
3705
|
+
return { x: f, y: c, angle: d };
|
|
3655
3706
|
} else if ((t == null ? void 0 : t.type) === "Rectangle") {
|
|
3656
3707
|
const i = Math.abs(s), n = Math.abs(o), r = (i + n) * 2 * e;
|
|
3657
|
-
let l = 0,
|
|
3658
|
-
return r < i ? (l = -i / 2 + r,
|
|
3708
|
+
let l = 0, f = 0, c = 0;
|
|
3709
|
+
return r < i ? (l = -i / 2 + r, f = -n / 2, c = 0) : r < i + n ? (l = i / 2, f = -n / 2 + (r - i), c = Math.PI / 2) : r < 2 * i + n ? (l = i / 2 - (r - (i + n)), f = n / 2, c = Math.PI) : (l = -i / 2, f = n / 2 - (r - (2 * i + n)), c = -Math.PI / 2), { x: l, y: f, angle: c };
|
|
3659
3710
|
}
|
|
3660
3711
|
return { x: 0, y: 0, angle: 0 };
|
|
3661
3712
|
}
|
|
3662
3713
|
getBezierPointAndAngle(t, s, o, e, i) {
|
|
3663
|
-
const n = s.x, a = s.y, r = s.out_x ?? s.x, l = s.out_y ?? s.y,
|
|
3714
|
+
const n = s.x, a = s.y, r = s.out_x ?? s.x, l = s.out_y ?? s.y, f = o.in_x ?? o.x, c = o.in_y ?? o.y, g = o.x, h = o.y, d = 1 - t, u = t * t, m = d * d, y = m * d, v = u * t, b = y * n + 3 * m * t * r + 3 * d * u * f + v * g - e, C = y * a + 3 * m * t * l + 3 * d * u * c + v * h - i, S = 3 * m * (r - n) + 6 * d * t * (f - r) + 3 * u * (g - f), I = 3 * m * (l - a) + 6 * d * t * (c - l) + 3 * u * (h - c), w = Math.atan2(I, S);
|
|
3664
3715
|
return { x: b, y: C, angle: w };
|
|
3665
3716
|
}
|
|
3666
3717
|
applyAbsoluteTransform(t, s, o) {
|
|
@@ -3684,53 +3735,53 @@ class li {
|
|
|
3684
3735
|
t.scale(e, i);
|
|
3685
3736
|
}
|
|
3686
3737
|
applyArtEffectOverlay(t, s, o, e, i, n) {
|
|
3687
|
-
var
|
|
3688
|
-
const a = this.objectStates.get(s.id), r = ((
|
|
3738
|
+
var h, d, u, m, y;
|
|
3739
|
+
const a = this.objectStates.get(s.id), r = ((h = a == null ? void 0 : a.style) == null ? void 0 : h.artEffect) || s.artEffect || ((d = s.style) == null ? void 0 : d.artEffect);
|
|
3689
3740
|
if (!r || !r.enabled) return;
|
|
3690
|
-
const l = r.type,
|
|
3741
|
+
const l = r.type, f = r.intensity ?? 0.5, c = r.speed ?? 1, g = r.scale ?? 10;
|
|
3691
3742
|
if (l === "acid_gradient" || l === "acid_rave" || l === "shimmer" || l === "glint_overlay" || l === "halftone" || l === "noise" || l === "scanlines" || l === "chromatic_aberration" || l === "pixelate" || l === "glitch" || l === "fold_overlay" || l === "crumple_overlay") {
|
|
3692
3743
|
if (t.save(), this.applyPath(t, o, e, i, n), t.clip(), l === "shimmer") {
|
|
3693
3744
|
const b = this.currentTime * c % 2 / 2, C = t.createLinearGradient(-e, -i, e, i);
|
|
3694
|
-
C.addColorStop(Math.max(0, b - 0.2), "rgba(255,255,255,0)"), C.addColorStop(b, `rgba(255,255,255,${
|
|
3745
|
+
C.addColorStop(Math.max(0, b - 0.2), "rgba(255,255,255,0)"), C.addColorStop(b, `rgba(255,255,255,${f * 0.8})`), C.addColorStop(Math.min(1, b + 0.2), "rgba(255,255,255,0)"), t.fillStyle = C, t.globalCompositeOperation = "screen", t.fillRect(-e / 2, -i / 2, e, i), t.globalCompositeOperation = "source-over";
|
|
3695
3746
|
} else if (l === "glint_overlay") {
|
|
3696
3747
|
let C = ((this._lastPointerPos || { x: 0 }).x - (((u = s.transform) == null ? void 0 : u.x) ?? 0) + 300) / 600;
|
|
3697
3748
|
C = Math.max(-0.2, Math.min(1.2, C));
|
|
3698
3749
|
const S = t.createLinearGradient(-e, -i, e, i);
|
|
3699
|
-
S.addColorStop(Math.max(0, C - 0.15), "rgba(255,255,255,0)"), S.addColorStop(Math.max(0, Math.min(1, C)), `rgba(255,255,255,${
|
|
3750
|
+
S.addColorStop(Math.max(0, C - 0.15), "rgba(255,255,255,0)"), S.addColorStop(Math.max(0, Math.min(1, C)), `rgba(255,255,255,${f})`), S.addColorStop(Math.min(1, C + 0.15), "rgba(255,255,255,0)"), t.fillStyle = S, t.globalCompositeOperation = "screen", t.fillRect(-e / 2, -i / 2, e, i), t.globalCompositeOperation = "source-over";
|
|
3700
3751
|
} else if (l === "fold_overlay") {
|
|
3701
3752
|
const v = this._lastPointerPos || { x: 0, y: 0 }, b = v.x - (((m = s.transform) == null ? void 0 : m.x) ?? 0), C = v.y - (((y = s.transform) == null ? void 0 : y.y) ?? 0), S = t.createLinearGradient(b > 0 ? -e / 2 : e / 2, C > 0 ? -i / 2 : i / 2, b > 0 ? e / 2 : -e / 2, C > 0 ? i / 2 : -i / 2);
|
|
3702
|
-
S.addColorStop(0, `rgba(0,0,0,${
|
|
3753
|
+
S.addColorStop(0, `rgba(0,0,0,${f * 0.6})`), S.addColorStop(0.4, "rgba(0,0,0,0)"), S.addColorStop(0.5, `rgba(255,255,255,${f * 0.4})`), S.addColorStop(1, `rgba(0,0,0,${f * 0.2})`), t.fillStyle = S, t.globalCompositeOperation = "overlay", t.fillRect(-e / 2, -i / 2, e, i), t.globalCompositeOperation = "source-over", t.beginPath(), b > 0 && C > 0 ? (t.moveTo(e / 2 - 40, i / 2), t.lineTo(e / 2, i / 2 - 40), t.lineTo(e / 2 - 40, i / 2 - 40)) : b < 0 && C > 0 ? (t.moveTo(-e / 2 + 40, i / 2), t.lineTo(-e / 2, i / 2 - 40), t.lineTo(-e / 2 + 40, i / 2 - 40)) : b > 0 && C < 0 ? (t.moveTo(e / 2 - 40, -i / 2), t.lineTo(e / 2, -i / 2 + 40), t.lineTo(e / 2 - 40, -i / 2 + 40)) : (t.moveTo(-e / 2 + 40, -i / 2), t.lineTo(-e / 2, -i / 2 + 40), t.lineTo(-e / 2 + 40, -i / 2 + 40)), t.closePath(), t.fillStyle = "#ffffff", t.shadowColor = "rgba(0,0,0,0.5)", t.shadowBlur = 10, t.shadowOffsetX = b > 0 ? -2 : 2, t.shadowOffsetY = C > 0 ? -2 : 2, t.fill();
|
|
3703
3754
|
} else if (l === "crumple_overlay") {
|
|
3704
3755
|
const v = Math.floor(e / g), b = document.createElement("canvas");
|
|
3705
3756
|
b.width = v, b.height = Math.floor(i / g);
|
|
3706
3757
|
const C = b.getContext("2d"), S = C.createImageData(b.width, b.height);
|
|
3707
3758
|
for (let I = 0; I < S.data.length; I += 4) {
|
|
3708
3759
|
const w = Math.random() > 0.95 ? 150 : 255;
|
|
3709
|
-
S.data[I] = w, S.data[I + 1] = w, S.data[I + 2] = w, S.data[I + 3] = 255 *
|
|
3760
|
+
S.data[I] = w, S.data[I + 1] = w, S.data[I + 2] = w, S.data[I + 3] = 255 * f;
|
|
3710
3761
|
}
|
|
3711
3762
|
C.putImageData(S, 0, 0), t.globalCompositeOperation = "multiply", t.imageSmoothingEnabled = !1, t.drawImage(b, -e / 2, -i / 2, e, i);
|
|
3712
3763
|
} else if (l === "acid_gradient" || l === "acid_rave") {
|
|
3713
3764
|
const v = this.currentTime * c, b = r.color1, C = r.color2, S = t.createLinearGradient(-e / 2, -i / 2, e / 2, i / 2);
|
|
3714
3765
|
if (b && C) {
|
|
3715
3766
|
const I = v * 60 % 360;
|
|
3716
|
-
S.addColorStop(0, this._shiftHue(b, I,
|
|
3767
|
+
S.addColorStop(0, this._shiftHue(b, I, f * 0.7)), S.addColorStop(1, this._shiftHue(C, (I + 180) % 360, f * 0.7));
|
|
3717
3768
|
} else {
|
|
3718
3769
|
const I = v * 100 % 360, w = (I + 180) % 360;
|
|
3719
|
-
S.addColorStop(0, `hsla(${I}, 80%, 50%, ${
|
|
3770
|
+
S.addColorStop(0, `hsla(${I}, 80%, 50%, ${f * 0.5})`), S.addColorStop(1, `hsla(${w}, 80%, 50%, ${f * 0.5})`);
|
|
3720
3771
|
}
|
|
3721
3772
|
t.fillStyle = S, t.globalCompositeOperation = "screen", t.fillRect(-e / 2, -i / 2, e, i);
|
|
3722
3773
|
} else if (l === "halftone") {
|
|
3723
|
-
const v = Math.max(2, g * (1 -
|
|
3774
|
+
const v = Math.max(2, g * (1 - f * 0.8)), b = document.createElement("canvas");
|
|
3724
3775
|
b.width = v, b.height = v;
|
|
3725
3776
|
const C = b.getContext("2d");
|
|
3726
3777
|
if (C) {
|
|
3727
|
-
C.fillStyle = "black", C.beginPath(), C.arc(v / 2, v / 2, v / 2 *
|
|
3778
|
+
C.fillStyle = "black", C.beginPath(), C.arc(v / 2, v / 2, v / 2 * f, 0, Math.PI * 2), C.fill();
|
|
3728
3779
|
const S = t.createPattern(b, "repeat");
|
|
3729
|
-
S && (t.globalAlpha = 0.3 *
|
|
3780
|
+
S && (t.globalAlpha = 0.3 * f, t.fillStyle = S, t.fillRect(-e / 2, -i / 2, e, i));
|
|
3730
3781
|
}
|
|
3731
3782
|
} else if (l === "noise") {
|
|
3732
|
-
const v = Math.floor(e * i *
|
|
3733
|
-
t.globalAlpha = 0.4 *
|
|
3783
|
+
const v = Math.floor(e * i * f * 0.02);
|
|
3784
|
+
t.globalAlpha = 0.4 * f;
|
|
3734
3785
|
for (let b = 0; b < v; b++) {
|
|
3735
3786
|
const C = Math.random() > 0.5 ? 255 : 0;
|
|
3736
3787
|
t.fillStyle = `rgba(${C}, ${C}, ${C}, ${0.5 + Math.random() * 0.5})`, t.fillRect(
|
|
@@ -3741,32 +3792,32 @@ class li {
|
|
|
3741
3792
|
);
|
|
3742
3793
|
}
|
|
3743
3794
|
} else if (l === "scanlines") {
|
|
3744
|
-
t.globalAlpha = 0.2 *
|
|
3795
|
+
t.globalAlpha = 0.2 * f, t.strokeStyle = "rgba(0,0,0,0.5)", t.lineWidth = 1;
|
|
3745
3796
|
for (let v = -i / 2; v < i / 2; v += 4)
|
|
3746
3797
|
t.beginPath(), t.moveTo(-e / 2, v), t.lineTo(e / 2, v), t.stroke();
|
|
3747
3798
|
} else if (l === "chromatic_aberration") {
|
|
3748
|
-
const v = 5 *
|
|
3799
|
+
const v = 5 * f;
|
|
3749
3800
|
t.globalCompositeOperation = "screen", t.globalAlpha = 0.5, t.fillStyle = "cyan", t.fillRect(-e / 2 - v, -i / 2, e, i), t.fillStyle = "magenta", t.fillRect(-e / 2 + v, -i / 2, e, i);
|
|
3750
3801
|
} else if (l === "pixelate") {
|
|
3751
|
-
const v = Math.max(2, Math.round(g * (1 -
|
|
3802
|
+
const v = Math.max(2, Math.round(g * (1 - f * 0.5))), b = document.createElement("canvas"), C = Math.max(1, Math.ceil(e / v)), S = Math.max(1, Math.ceil(i / v));
|
|
3752
3803
|
b.width = C, b.height = S;
|
|
3753
3804
|
const I = b.getContext("2d");
|
|
3754
3805
|
if (I) {
|
|
3755
3806
|
I.imageSmoothingEnabled = !1;
|
|
3756
|
-
const w = t.getTransform(),
|
|
3757
|
-
I.drawImage(t.canvas,
|
|
3807
|
+
const w = t.getTransform(), M = w.e - e / 2, P = w.f - i / 2;
|
|
3808
|
+
I.drawImage(t.canvas, M, P, e, i, 0, 0, C, S), t.imageSmoothingEnabled = !1, t.drawImage(b, 0, 0, C, S, -e / 2, -i / 2, e, i), t.imageSmoothingEnabled = !0;
|
|
3758
3809
|
}
|
|
3759
3810
|
} else if (l === "glitch") {
|
|
3760
|
-
const v = this.currentTime * c, b = r.chaosAmount ?? 0.2, C = Math.max(3, Math.floor(8 *
|
|
3761
|
-
t.globalCompositeOperation = "screen", t.globalAlpha =
|
|
3811
|
+
const v = this.currentTime * c, b = r.chaosAmount ?? 0.2, C = Math.max(3, Math.floor(8 * f)), S = f * e * 0.15;
|
|
3812
|
+
t.globalCompositeOperation = "screen", t.globalAlpha = f * 0.4;
|
|
3762
3813
|
const I = S * 0.3;
|
|
3763
3814
|
t.fillStyle = "rgba(255, 0, 0, 0.4)", t.fillRect(-e / 2 + I, -i / 2, e, i), t.fillStyle = "rgba(0, 255, 255, 0.4)", t.fillRect(-e / 2 - I, -i / 2, e, i), t.globalCompositeOperation = "source-over", t.globalAlpha = 1;
|
|
3764
3815
|
const w = i / C;
|
|
3765
|
-
for (let
|
|
3766
|
-
const
|
|
3816
|
+
for (let M = 0; M < C; M++) {
|
|
3817
|
+
const P = Math.sin(M * 127.1 + v * 311.7 * c) * 43758.5, T = P - Math.floor(P);
|
|
3767
3818
|
if (T > 1 - b) {
|
|
3768
|
-
const W = (T - (1 - b)) / b * S * (Math.random() > 0.5 ? 1 : -1),
|
|
3769
|
-
t.save(), t.beginPath(), t.rect(-e / 2,
|
|
3819
|
+
const W = (T - (1 - b)) / b * S * (Math.random() > 0.5 ? 1 : -1), k = -i / 2 + M * w, _ = t.getTransform(), L = _.e - e / 2 + W, x = _.f + k;
|
|
3820
|
+
t.save(), t.beginPath(), t.rect(-e / 2, k, e, w), t.clip(), t.globalAlpha = 0.8, t.drawImage(t.canvas, L, x, e, w, -e / 2 + W, k, e, w), t.restore();
|
|
3770
3821
|
}
|
|
3771
3822
|
}
|
|
3772
3823
|
}
|
|
@@ -3777,26 +3828,26 @@ class li {
|
|
|
3777
3828
|
_shiftHue(t, s, o) {
|
|
3778
3829
|
let e = 0, i = 0, n = 0;
|
|
3779
3830
|
if (t.startsWith("#")) {
|
|
3780
|
-
const
|
|
3781
|
-
e = parseInt(
|
|
3831
|
+
const h = t.replace("#", "");
|
|
3832
|
+
e = parseInt(h.substring(0, 2), 16) / 255, i = parseInt(h.substring(2, 4), 16) / 255, n = parseInt(h.substring(4, 6), 16) / 255;
|
|
3782
3833
|
}
|
|
3783
3834
|
const a = Math.max(e, i, n), r = Math.min(e, i, n);
|
|
3784
|
-
let l = 0,
|
|
3835
|
+
let l = 0, f = 0, c = (a + r) / 2;
|
|
3785
3836
|
if (a !== r) {
|
|
3786
|
-
const
|
|
3787
|
-
switch (
|
|
3837
|
+
const h = a - r;
|
|
3838
|
+
switch (f = c > 0.5 ? h / (2 - a - r) : h / (a + r), a) {
|
|
3788
3839
|
case e:
|
|
3789
|
-
l = ((i - n) /
|
|
3840
|
+
l = ((i - n) / h + (i < n ? 6 : 0)) / 6;
|
|
3790
3841
|
break;
|
|
3791
3842
|
case i:
|
|
3792
|
-
l = ((n - e) /
|
|
3843
|
+
l = ((n - e) / h + 2) / 6;
|
|
3793
3844
|
break;
|
|
3794
3845
|
case n:
|
|
3795
|
-
l = ((e - i) /
|
|
3846
|
+
l = ((e - i) / h + 4) / 6;
|
|
3796
3847
|
break;
|
|
3797
3848
|
}
|
|
3798
3849
|
}
|
|
3799
|
-
return `hsla(${(((l * 360 + s) % 360 + 360) % 360).toFixed(0)}, ${(
|
|
3850
|
+
return `hsla(${(((l * 360 + s) % 360 + 360) % 360).toFixed(0)}, ${(f * 100).toFixed(0)}%, ${(c * 100).toFixed(0)}%, ${o})`;
|
|
3800
3851
|
}
|
|
3801
3852
|
/**
|
|
3802
3853
|
* Simulate CSS `backdrop-filter: blur()` + glass overlay on Canvas2D.
|
|
@@ -3807,15 +3858,15 @@ class li {
|
|
|
3807
3858
|
* 4. Apply the overlay color tint, sheen highlight, noise grain, and glass border
|
|
3808
3859
|
*/
|
|
3809
3860
|
applyBackgroundBlurGlass(t, s, o, e, i, n) {
|
|
3810
|
-
const a = n.radius ?? 10, r = n.color ?? "rgba(255,255,255,0.2)", l = n.opacity ?? 0.5,
|
|
3861
|
+
const a = n.radius ?? 10, r = n.color ?? "rgba(255,255,255,0.2)", l = n.opacity ?? 0.5, f = n.noise ?? 0;
|
|
3811
3862
|
t.save(), this.applyPath(t, s, o, e, i), t.clip();
|
|
3812
|
-
const c = t.getTransform(), g = c.e - o / 2,
|
|
3863
|
+
const c = t.getTransform(), g = c.e - o / 2, h = c.f - e / 2;
|
|
3813
3864
|
try {
|
|
3814
3865
|
const u = document.createElement("canvas");
|
|
3815
3866
|
u.width = Math.max(1, Math.ceil(o)), u.height = Math.max(1, Math.ceil(e));
|
|
3816
3867
|
const m = u.getContext("2d");
|
|
3817
3868
|
if (m) {
|
|
3818
|
-
m.drawImage(t.canvas, g,
|
|
3869
|
+
m.drawImage(t.canvas, g, h, o, e, 0, 0, o, e), m.filter = `blur(${a}px)`;
|
|
3819
3870
|
const y = document.createElement("canvas");
|
|
3820
3871
|
y.width = u.width, y.height = u.height;
|
|
3821
3872
|
const v = y.getContext("2d");
|
|
@@ -3825,8 +3876,8 @@ class li {
|
|
|
3825
3876
|
}
|
|
3826
3877
|
t.globalCompositeOperation = "source-over", t.globalAlpha = l, t.fillStyle = r, t.fillRect(-o / 2, -e / 2, o, e), t.globalAlpha = 1, t.globalCompositeOperation = "source-atop";
|
|
3827
3878
|
const d = t.createLinearGradient(-o / 2, -e / 2, o / 2, e / 2);
|
|
3828
|
-
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),
|
|
3829
|
-
if (t.globalAlpha =
|
|
3879
|
+
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), f > 0) {
|
|
3880
|
+
if (t.globalAlpha = f / 100, !this._noiseTileCanvas) {
|
|
3830
3881
|
const m = document.createElement("canvas");
|
|
3831
3882
|
m.width = 64, m.height = 64;
|
|
3832
3883
|
const y = m.getContext("2d"), v = y.createImageData(64, 64), b = v.data;
|
|
@@ -3852,15 +3903,15 @@ class li {
|
|
|
3852
3903
|
} else if (s.type === "Line")
|
|
3853
3904
|
t.moveTo(-o / 2, 0), t.lineTo(o / 2, 0);
|
|
3854
3905
|
else if (s.type === "Ellipse") {
|
|
3855
|
-
const { startAngle: n = 0, sweepAngle: a = 360, ratio: r = 0 } = s, l = o / 2,
|
|
3856
|
-
a >= 360 && r <= 0 ? t.ellipse(0, 0, l,
|
|
3906
|
+
const { startAngle: n = 0, sweepAngle: a = 360, ratio: r = 0 } = s, l = o / 2, f = e / 2, c = n * Math.PI / 180, g = a * Math.PI / 180, h = c + g;
|
|
3907
|
+
a >= 360 && r <= 0 ? t.ellipse(0, 0, l, f, 0, 0, Math.PI * 2) : (t.ellipse(0, 0, l, f, 0, c, h, !1), r > 0 ? t.ellipse(0, 0, l * r, f * r, 0, h, c, !0) : t.lineTo(0, 0), t.closePath());
|
|
3857
3908
|
} else if (s.type === "Triangle")
|
|
3858
3909
|
t.moveTo(0, -e / 2), t.lineTo(o / 2, e / 2), t.lineTo(-o / 2, e / 2), t.closePath();
|
|
3859
3910
|
else if (s.type === "Polygon") {
|
|
3860
3911
|
const n = s.sides || 3, a = s.radius || Math.min(o, e) / 2;
|
|
3861
3912
|
for (let r = 0; r < n; r++) {
|
|
3862
|
-
const l = r * 2 * Math.PI / n - Math.PI / 2,
|
|
3863
|
-
r === 0 ? t.moveTo(
|
|
3913
|
+
const l = r * 2 * Math.PI / n - Math.PI / 2, f = a * Math.cos(l), c = a * Math.sin(l);
|
|
3914
|
+
r === 0 ? t.moveTo(f, c) : t.lineTo(f, c);
|
|
3864
3915
|
}
|
|
3865
3916
|
t.closePath();
|
|
3866
3917
|
} else if (s.type === "Star") {
|
|
@@ -3868,8 +3919,8 @@ class li {
|
|
|
3868
3919
|
let r = s.inner_radius;
|
|
3869
3920
|
r == null ? r = a * 0.382 : r <= 1 && (r = a * r);
|
|
3870
3921
|
for (let l = 0; l < n * 2; l++) {
|
|
3871
|
-
const
|
|
3872
|
-
l === 0 ? t.moveTo(g,
|
|
3922
|
+
const f = l * Math.PI / n - Math.PI / 2, c = l % 2 === 0 ? a : r, g = c * Math.cos(f), h = c * Math.sin(f);
|
|
3923
|
+
l === 0 ? t.moveTo(g, h) : t.lineTo(g, h);
|
|
3873
3924
|
}
|
|
3874
3925
|
t.closePath();
|
|
3875
3926
|
} else if (((s == null ? void 0 : s.type) === "Path" || s.type === "Subtract" || s.type === "Union" || s.type === "Intersect" || s.type === "Exclude" || s.type === "BooleanOperation") && s.points) {
|
|
@@ -3878,28 +3929,28 @@ class li {
|
|
|
3878
3929
|
if (s.points.forEach((g) => {
|
|
3879
3930
|
typeof g.x == "number" && typeof g.y == "number" && (n = Math.min(n, g.x), a = Math.max(a, g.x), r = Math.min(r, g.y), l = Math.max(l, g.y), g.out_x !== void 0 && (n = Math.min(n, g.out_x), a = Math.max(a, g.out_x)), g.out_y !== void 0 && (r = Math.min(r, g.out_y), l = Math.max(l, g.out_y)), g.in_x !== void 0 && (n = Math.min(n, g.in_x), a = Math.max(a, g.in_x)), g.in_y !== void 0 && (r = Math.min(r, g.in_y), l = Math.max(l, g.in_y)));
|
|
3880
3931
|
}), n === 1 / 0) return;
|
|
3881
|
-
const
|
|
3882
|
-
if (isNaN(
|
|
3883
|
-
console.warn("[Engine] Invalid path center:",
|
|
3932
|
+
const f = (n + a) / 2, c = (r + l) / 2;
|
|
3933
|
+
if (isNaN(f) || isNaN(c)) {
|
|
3934
|
+
console.warn("[Engine] Invalid path center:", f, c);
|
|
3884
3935
|
return;
|
|
3885
3936
|
}
|
|
3886
|
-
s.points.forEach((g,
|
|
3887
|
-
if (
|
|
3888
|
-
t.moveTo(g.x -
|
|
3937
|
+
s.points.forEach((g, h) => {
|
|
3938
|
+
if (h === 0 || g.moveTo)
|
|
3939
|
+
t.moveTo(g.x - f, g.y - c);
|
|
3889
3940
|
else {
|
|
3890
|
-
const d = s.points[
|
|
3941
|
+
const d = s.points[h - 1];
|
|
3891
3942
|
if (!d) return;
|
|
3892
|
-
const u = (d.out_x ?? d.x) -
|
|
3893
|
-
isNaN(u) || isNaN(y) || isNaN(g.x) ? t.lineTo(g.x -
|
|
3943
|
+
const u = (d.out_x ?? d.x) - f, m = (d.out_y ?? d.y) - c, y = (g.in_x ?? g.x) - f, v = (g.in_y ?? g.y) - c;
|
|
3944
|
+
isNaN(u) || isNaN(y) || isNaN(g.x) ? t.lineTo(g.x - f, g.y - c) : t.bezierCurveTo(u, m, y, v, g.x - f, g.y - c);
|
|
3894
3945
|
}
|
|
3895
|
-
if (g.closePath ||
|
|
3896
|
-
const d = [...s.points.slice(0,
|
|
3946
|
+
if (g.closePath || h === s.points.length - 1 && (s.is_closed || s.isClosed)) {
|
|
3947
|
+
const d = [...s.points.slice(0, h + 1)].reverse().find((u) => u.moveTo) || s.points[0];
|
|
3897
3948
|
d && (g.out_x !== void 0 || d.in_x !== void 0) && t.bezierCurveTo(
|
|
3898
|
-
(g.out_x ?? g.x) -
|
|
3949
|
+
(g.out_x ?? g.x) - f,
|
|
3899
3950
|
(g.out_y ?? g.y) - c,
|
|
3900
|
-
(d.in_x ?? d.x) -
|
|
3951
|
+
(d.in_x ?? d.x) - f,
|
|
3901
3952
|
(d.in_y ?? d.y) - c,
|
|
3902
|
-
d.x -
|
|
3953
|
+
d.x - f,
|
|
3903
3954
|
d.y - c
|
|
3904
3955
|
), t.closePath();
|
|
3905
3956
|
}
|
|
@@ -3909,41 +3960,41 @@ class li {
|
|
|
3909
3960
|
s.points.forEach((g) => {
|
|
3910
3961
|
n = Math.min(n, g.x), a = Math.max(a, g.x), r = Math.min(r, g.y), l = Math.max(l, g.y);
|
|
3911
3962
|
});
|
|
3912
|
-
const
|
|
3913
|
-
s.points.forEach((g,
|
|
3914
|
-
if (
|
|
3963
|
+
const f = (n + a) / 2, c = (r + l) / 2;
|
|
3964
|
+
s.points.forEach((g, h) => {
|
|
3965
|
+
if (h === 0) t.moveTo(g.x - f, g.y - c);
|
|
3915
3966
|
else {
|
|
3916
|
-
const d = s.points[
|
|
3967
|
+
const d = s.points[h - 1];
|
|
3917
3968
|
d.out_x !== void 0 || g.in_x !== void 0 ? t.bezierCurveTo(
|
|
3918
|
-
(d.out_x ?? d.x) -
|
|
3969
|
+
(d.out_x ?? d.x) - f,
|
|
3919
3970
|
(d.out_y ?? d.y) - c,
|
|
3920
|
-
(g.in_x ?? g.x) -
|
|
3971
|
+
(g.in_x ?? g.x) - f,
|
|
3921
3972
|
(g.in_y ?? g.y) - c,
|
|
3922
|
-
g.x -
|
|
3973
|
+
g.x - f,
|
|
3923
3974
|
g.y - c
|
|
3924
|
-
) : t.lineTo(g.x -
|
|
3975
|
+
) : t.lineTo(g.x - f, g.y - c);
|
|
3925
3976
|
}
|
|
3926
|
-
(g.closePath ||
|
|
3977
|
+
(g.closePath || h === s.points.length - 1 && (s.is_closed || s.isClosed)) && t.closePath();
|
|
3927
3978
|
});
|
|
3928
3979
|
}
|
|
3929
3980
|
}
|
|
3930
3981
|
}
|
|
3931
3982
|
renderInputBox(t, s) {
|
|
3932
3983
|
var dt, St;
|
|
3933
|
-
const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.options) || s.options || {}, i = ((dt = s.geometry) == null ? void 0 : dt.width) || 250, n = ((St = s.geometry) == null ? void 0 : St.height) || 45, a = this.focusedId === s.id, r = this.lastHoveredObjectId === s.id, l = e.previewState || "default",
|
|
3934
|
-
let b = e.backgroundColor || "rgba(31, 41, 55, 1)", C = e.borderColor || "rgba(55, 65, 81, 1)", S = e.borderWidth ?? 1.5, I = e.color || "#ffffff", w = e.placeholderColor || "rgba(156, 163, 175, 1)",
|
|
3935
|
-
const
|
|
3936
|
-
T ? (T.backgroundColor !== void 0 && (b = T.backgroundColor), T.borderColor !== void 0 && (C = T.borderColor), T.borderWidth !== void 0 && (S = T.borderWidth), T.color !== void 0 && (I = T.color), T.placeholderColor !== void 0 && (w = T.placeholderColor), T.fontSize !== void 0 && (
|
|
3984
|
+
const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.options) || s.options || {}, i = ((dt = s.geometry) == null ? void 0 : dt.width) || 250, n = ((St = s.geometry) == null ? void 0 : St.height) || 45, a = this.focusedId === s.id, r = this.lastHoveredObjectId === s.id, l = e.previewState || "default", f = l !== "default" ? l : a ? "focused" : r ? "hovered" : "default", c = e.label || { visible: !0, text: "Label" }, g = e.helperText || { visible: !1, text: "Helper text" }, h = e.leftIcon || { visible: !1 }, d = e.rightIcon || { visible: !1 }, u = e.multiline === !0, m = e.corner_radius ?? 8, y = e.corners || { tl: m, tr: m, bl: m, br: m }, v = [y.tl, y.tr, y.br, y.bl];
|
|
3985
|
+
let b = e.backgroundColor || "rgba(31, 41, 55, 1)", C = e.borderColor || "rgba(55, 65, 81, 1)", S = e.borderWidth ?? 1.5, I = e.color || "#ffffff", w = e.placeholderColor || "rgba(156, 163, 175, 1)", M = e.fontSize || 14;
|
|
3986
|
+
const P = `${f}Style`, T = e[P];
|
|
3987
|
+
T ? (T.backgroundColor !== void 0 && (b = T.backgroundColor), T.borderColor !== void 0 && (C = T.borderColor), T.borderWidth !== void 0 && (S = T.borderWidth), T.color !== void 0 && (I = T.color), T.placeholderColor !== void 0 && (w = T.placeholderColor), T.fontSize !== void 0 && (M = T.fontSize)) : f === "focused" ? (C = e.focusBorderColor || "rgba(59, 130, 246, 1)", S = Math.max(S, 2)) : f === "hovered" || f === "hover" ? (C = e.hoverBorderColor || C, b = e.hoverBackgroundColor || b) : f === "disabled" ? (b = e.disabledBackgroundColor || "rgba(31, 41, 55, 0.6)", C = e.disabledBorderColor || "rgba(55, 65, 81, 0.4)") : f === "error" && (C = "rgba(239, 68, 68, 1)", S = Math.max(S, 2)), t.beginPath(), this.drawRoundRect(t, -i / 2, -n / 2, i, n, v);
|
|
3937
3988
|
const W = this.createCanvasFill(t, b, i, n);
|
|
3938
3989
|
if (W && (t.fillStyle = W, t.fill()), S > 0) {
|
|
3939
3990
|
const ht = this.createCanvasFill(t, C, i, n);
|
|
3940
|
-
if (ht && (t.strokeStyle = ht, t.lineWidth = S, t.stroke()),
|
|
3991
|
+
if (ht && (t.strokeStyle = ht, t.lineWidth = S, t.stroke()), f === "focused" || f === "focus") {
|
|
3941
3992
|
t.save(), t.beginPath();
|
|
3942
3993
|
const mt = v.map((rt) => rt + 2);
|
|
3943
3994
|
this.drawRoundRect(t, -i / 2 - 2, -n / 2 - 2, i + 4, n + 4, mt), t.strokeStyle = "rgba(59, 130, 246, 0.3)", t.lineWidth = 2, t.stroke(), t.restore();
|
|
3944
3995
|
}
|
|
3945
3996
|
}
|
|
3946
|
-
const
|
|
3997
|
+
const k = (ht, mt) => {
|
|
3947
3998
|
if (!ht.visible || !ht.svgPath) return;
|
|
3948
3999
|
const rt = ht.size || 14, Lt = ht.offset ?? 16, Gt = ht.color || "#ffffff", Pt = mt ? -(i / 2) + Lt : i / 2 - Lt, Dt = ht.svgPath;
|
|
3949
4000
|
if (t.save(), t.translate(Pt, 0), !Dt.startsWith("<svg")) {
|
|
@@ -3952,10 +4003,10 @@ class li {
|
|
|
3952
4003
|
}
|
|
3953
4004
|
t.restore();
|
|
3954
4005
|
};
|
|
3955
|
-
|
|
3956
|
-
const _ = e.text || "", L = e.placeholder || "Enter text...", x = !_,
|
|
4006
|
+
k(h, !0), k(d, !1);
|
|
4007
|
+
const _ = e.text || "", L = e.placeholder || "Enter text...", x = !_, A = _ || L, $ = x ? w : I, O = M, V = e.fontFamily || "Inter", H = e.fontWeight || 400;
|
|
3957
4008
|
t.font = `${H} ${O}px "${V}", sans-serif`, t.fillStyle = $, t.textAlign = "left", t.textBaseline = u ? "top" : "middle";
|
|
3958
|
-
const et = e.inputPadding ?? 16,
|
|
4009
|
+
const et = e.inputPadding ?? 16, E = h.visible ? (h.offset ?? 16) + (h.size || 14) / 2 + 8 : et, F = d.visible ? (d.offset ?? 16) + (d.size || 14) / 2 + 8 : et, q = -(i / 2) + E, Q = i - E - F, it = e.inputType === "password" ? "•".repeat(A.length) : A;
|
|
3959
4010
|
if (t.save(), t.beginPath(), t.rect(q - 2, -n / 2 + 4, Q + 4, n - 8), t.clip(), u) {
|
|
3960
4011
|
const ht = it.split(`
|
|
3961
4012
|
`);
|
|
@@ -3986,14 +4037,14 @@ class li {
|
|
|
3986
4037
|
t.fillText(ht, Gt, Pt);
|
|
3987
4038
|
}
|
|
3988
4039
|
if (g.visible === !0) {
|
|
3989
|
-
const ht = g.text || "Helper text", mt = g.fontSize || 11, rt =
|
|
4040
|
+
const ht = g.text || "Helper text", mt = g.fontSize || 11, rt = f === "error" ? "rgba(239, 68, 68, 1)" : g.color || "rgba(156, 163, 175, 1)", Lt = g.offset ?? 6;
|
|
3990
4041
|
t.font = `400 ${mt}px "${V}", sans-serif`, t.fillStyle = rt, t.textAlign = "left", t.textBaseline = "top";
|
|
3991
4042
|
const Gt = -(i / 2), Pt = n / 2 + Lt;
|
|
3992
4043
|
t.fillText(ht, Gt, Pt);
|
|
3993
4044
|
}
|
|
3994
4045
|
}
|
|
3995
4046
|
renderSlider(t, s) {
|
|
3996
|
-
const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.geometry) || s.geometry, i = (o == null ? void 0 : o.options) || s.options || {}, n = e.width || 200, a = i.value ?? 50, r = i.min ?? 0,
|
|
4047
|
+
const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.geometry) || s.geometry, i = (o == null ? void 0 : o.options) || s.options || {}, n = e.width || 200, a = i.value ?? 50, r = i.min ?? 0, f = (i.max ?? 100) - r, c = f === 0 ? 0 : (a - r) / f, g = i.trackHeight || 4, h = i.trackRoundedness ?? 2, d = i.trackShape ?? "Rectangle", u = i.trackPath || "", m = i.accentColor || "#3b82f6", y = i.inactiveColor || "#374151", v = i.thumbShape || "Ellipse", b = i.thumbWidth ?? 16, C = i.thumbHeight ?? 16, S = i.thumbRoundedness ?? 0, I = i.thumbColor || "#ffffff", w = i.thumbPath || "", M = i.thumbIcon || "", P = i.showValueTooltip ?? !1, T = i.tooltipBgColor || "#333333", W = i.tooltipColor || "#ffffff", k = i.tooltipOffsetX ?? 0, _ = i.tooltipOffsetY ?? -25, L = (Q, it, dt, St, ht, mt, rt) => {
|
|
3997
4048
|
if ((Q === "Custom" || Q === "Icon") && rt)
|
|
3998
4049
|
try {
|
|
3999
4050
|
const Lt = new Path2D(rt);
|
|
@@ -4031,26 +4082,26 @@ class li {
|
|
|
4031
4082
|
} else Q === "Line" && (t.moveTo(it - St / 2, dt), t.lineTo(it + St / 2, dt));
|
|
4032
4083
|
t.fill();
|
|
4033
4084
|
}, x = this.createCanvasFill(t, y, n, g);
|
|
4034
|
-
x && (t.fillStyle = x, t.strokeStyle = x), d === "Line" ? (t.lineWidth = g, t.beginPath(), t.moveTo(-n / 2, 0), t.lineTo(n / 2, 0), t.stroke()) : L(d, 0, 0, n, g,
|
|
4035
|
-
const
|
|
4085
|
+
x && (t.fillStyle = x, t.strokeStyle = x), d === "Line" ? (t.lineWidth = g, t.beginPath(), t.moveTo(-n / 2, 0), t.lineTo(n / 2, 0), t.stroke()) : L(d, 0, 0, n, g, h, u);
|
|
4086
|
+
const A = n - b, $ = -n / 2 + b / 2 + c * A, O = $ - -n / 2;
|
|
4036
4087
|
if (O > 0) {
|
|
4037
4088
|
const Q = this.createCanvasFill(t, m, n, g);
|
|
4038
|
-
Q && (t.fillStyle = Q, t.strokeStyle = Q), d === "Line" ? (t.lineWidth = g, t.beginPath(), t.moveTo(-n / 2, 0), t.lineTo($, 0), t.stroke()) : d === "Rectangle" && (t.beginPath(), this.drawRoundRect(t, -n / 2, -g / 2, O, g,
|
|
4089
|
+
Q && (t.fillStyle = Q, t.strokeStyle = Q), d === "Line" ? (t.lineWidth = g, t.beginPath(), t.moveTo(-n / 2, 0), t.lineTo($, 0), t.stroke()) : d === "Rectangle" && (t.beginPath(), this.drawRoundRect(t, -n / 2, -g / 2, O, g, h), t.fill());
|
|
4039
4090
|
}
|
|
4040
4091
|
t.save(), t.translate($, 0);
|
|
4041
4092
|
const V = t.getTransform(), H = Math.sqrt(V.a * V.a + V.b * V.b) || 1;
|
|
4042
4093
|
t.shadowColor = "rgba(0,0,0,0.2)", t.shadowBlur = 4 * H, t.shadowOffsetY = 1 * H;
|
|
4043
4094
|
const et = this.createCanvasFill(t, I, b, C);
|
|
4044
|
-
if (et && (t.fillStyle = et), L(v, 0, 0, b, C, S, v === "Icon" ?
|
|
4045
|
-
t.save(), t.translate($ +
|
|
4095
|
+
if (et && (t.fillStyle = et), L(v, 0, 0, b, C, S, v === "Icon" ? M : w), t.restore(), P) {
|
|
4096
|
+
t.save(), t.translate($ + k, _);
|
|
4046
4097
|
const Q = Math.round(a).toString();
|
|
4047
4098
|
t.font = "10px Inter, sans-serif";
|
|
4048
4099
|
const it = t.measureText(Q), dt = 6, St = 4, ht = it.width + dt * 2, mt = 14 + St;
|
|
4049
4100
|
t.beginPath(), this.drawRoundRect(t, -ht / 2, -mt / 2, ht, mt, 4), t.fillStyle = T, t.fill(), t.fillStyle = W, t.textAlign = "center", t.textBaseline = "middle", t.fillText(Q, 0, 0), t.restore();
|
|
4050
4101
|
}
|
|
4051
|
-
const
|
|
4052
|
-
if (
|
|
4053
|
-
const Q =
|
|
4102
|
+
const E = i.label || {}, F = i.helperText || {}, q = i.fontFamily || "Inter";
|
|
4103
|
+
if (E.visible !== !1) {
|
|
4104
|
+
const Q = E.text || "Label", it = E.fontSize || 12, dt = E.color || "rgba(156, 163, 175, 1)", St = E.offset ?? 8;
|
|
4054
4105
|
t.font = `600 ${it}px "${q}", sans-serif`, t.fillStyle = dt, t.textAlign = "left", t.textBaseline = "bottom";
|
|
4055
4106
|
const ht = -(n / 2), mt = -(g / 2) - St;
|
|
4056
4107
|
t.fillText(Q, ht, mt);
|
|
@@ -4066,11 +4117,11 @@ class li {
|
|
|
4066
4117
|
var _;
|
|
4067
4118
|
const o = this.objectStates.get(s.id);
|
|
4068
4119
|
if (!o) return;
|
|
4069
|
-
const e = o.options || s.options || {}, i = s.geometry.width || 160, n = s.geometry.height || 40, a = -i / 2, r = -n / 2, l = e.corner_radius ?? 6,
|
|
4070
|
-
let
|
|
4071
|
-
|
|
4120
|
+
const e = o.options || s.options || {}, i = s.geometry.width || 160, n = s.geometry.height || 40, a = -i / 2, r = -n / 2, l = e.corner_radius ?? 6, f = e.disabled || e.previewState === "disabled", c = this.lastHoveredObjectId === s.id || e.previewState === "hover", g = (e.isOpen || e.previewState === "active") && !f;
|
|
4121
|
+
let h = e.backgroundColor, d = e.borderColor, u = e.color || "#333333";
|
|
4122
|
+
f ? (h = e.disabledBackgroundColor || "#f3f4f6", d = e.disabledBorderColor || "#e5e7eb", u = e.disabledColor || "#9ca3af") : g ? (h = e.activeBackgroundColor || h, d = e.activeBorderColor || d, u = e.activeColor || u) : c && (h = e.hoverBackgroundColor || h, d = e.hoverBorderColor || d, u = e.hoverColor || u), h || (h = "#ffffff"), d || (d = "#e5e7eb");
|
|
4072
4123
|
const m = t.globalAlpha;
|
|
4073
|
-
t.globalAlpha = m * (e.opacity ?? 1), this.drawRoundRect(t, a, r, i, n, l), t.fillStyle = this.createCanvasFill(t, typeof
|
|
4124
|
+
t.globalAlpha = m * (e.opacity ?? 1), this.drawRoundRect(t, a, r, i, n, l), t.fillStyle = this.createCanvasFill(t, typeof h == "string" ? { type: "Solid", color: h } : h, i, n) || "#ffffff", t.fill();
|
|
4074
4125
|
const y = e.borderWidth ?? 1;
|
|
4075
4126
|
y > 0 && (t.strokeStyle = this.createCanvasFill(t, typeof d == "string" ? { type: "Solid", color: d } : d, i, n) || "#e5e7eb", t.lineWidth = y, t.stroke());
|
|
4076
4127
|
const v = 12, b = e.chevronType || "chevron", C = e.chevronSize || 16, S = (g ? e.openIconColor : e.closedIconColor) || e.chevronColor || "#6b7280";
|
|
@@ -4081,9 +4132,9 @@ class li {
|
|
|
4081
4132
|
if (t.rotate(x * Math.PI / 180), t.strokeStyle = S, t.fillStyle = S, t.lineWidth = 1.5, t.lineCap = "round", t.lineJoin = "round", b === "chevron")
|
|
4082
4133
|
t.beginPath(), t.moveTo(-C / 2, -C * 0.2), t.lineTo(0, C * 0.2), t.lineTo(C / 2, -C * 0.2), t.stroke();
|
|
4083
4134
|
else if (b === "custom" || b === "path") {
|
|
4084
|
-
const
|
|
4085
|
-
if (
|
|
4086
|
-
const $ = new Path2D(
|
|
4135
|
+
const A = g && e.openIconPath || e.closedIconPath;
|
|
4136
|
+
if (A) {
|
|
4137
|
+
const $ = new Path2D(A);
|
|
4087
4138
|
t.save();
|
|
4088
4139
|
const O = C / 24;
|
|
4089
4140
|
t.scale(O, O), t.translate(-12, -12), t.fill($), t.restore();
|
|
@@ -4091,78 +4142,78 @@ class li {
|
|
|
4091
4142
|
}
|
|
4092
4143
|
t.restore();
|
|
4093
4144
|
}
|
|
4094
|
-
const I = e.selectedOption || e.placeholder || "Select...", w = e.fontSize || 14,
|
|
4095
|
-
t.font = `${
|
|
4096
|
-
const T =
|
|
4145
|
+
const I = e.selectedOption || e.placeholder || "Select...", w = e.fontSize || 14, M = e.fontWeight || 400, P = e.fontFamily || "Inter, sans-serif";
|
|
4146
|
+
t.font = `${M} ${w}px ${P}`;
|
|
4147
|
+
const T = f ? e.disabledColor || "#9ca3af" : !e.selectedOption && e.placeholder ? "#9ca3af" : u;
|
|
4097
4148
|
t.fillStyle = this.createCanvasFill(t, typeof T == "string" ? { type: "Solid", color: T } : T, i, n) || "#333333", t.textAlign = "left", t.textBaseline = "middle";
|
|
4098
|
-
const W = b === "none" ? 0 : C + 8,
|
|
4099
|
-
if (t.save(), t.beginPath(), t.rect(a + v, r,
|
|
4100
|
-
const L = r + n + 4, x = e.optionsList || [],
|
|
4149
|
+
const W = b === "none" ? 0 : C + 8, k = i - v * 2 - W;
|
|
4150
|
+
if (t.save(), t.beginPath(), t.rect(a + v, r, k, n), t.clip(), t.fillText(I, a + v, 0), t.restore(), g && !f) {
|
|
4151
|
+
const L = r + n + 4, x = e.optionsList || [], A = e.itemHeight || 32, $ = e.listPadding ?? 4, O = x.length * A + $ * 2, V = e.listCornerRadius ?? l;
|
|
4101
4152
|
t.save();
|
|
4102
|
-
const H = e.listShadow || {}, et = t.getTransform(),
|
|
4103
|
-
t.shadowColor = typeof H.color == "string" ? H.color : ((_ = H.color) == null ? void 0 : _.color) || "rgba(0,0,0,0.15)", t.shadowBlur = (H.blur ?? 12) *
|
|
4153
|
+
const H = e.listShadow || {}, et = t.getTransform(), E = Math.sqrt(et.a * et.a + et.b * et.b) || 1;
|
|
4154
|
+
t.shadowColor = typeof H.color == "string" ? H.color : ((_ = H.color) == null ? void 0 : _.color) || "rgba(0,0,0,0.15)", t.shadowBlur = (H.blur ?? 12) * E, t.shadowOffsetY = (H.offsetY ?? 6) * E, t.shadowOffsetX = (H.offsetX ?? 0) * E, t.beginPath(), this.drawRoundRect(t, a, L, i, O, V), t.fillStyle = this.createCanvasFill(t, typeof e.listBackgroundColor == "string" ? { type: "Solid", color: e.listBackgroundColor } : e.listBackgroundColor || { type: "Solid", color: "#ffffff" }, i, O) || "#ffffff", t.fill();
|
|
4104
4155
|
const F = e.listBorderWidth ?? 1;
|
|
4105
4156
|
F > 0 && (t.shadowColor = "transparent", t.strokeStyle = this.createCanvasFill(t, typeof e.listBorderColor == "string" ? { type: "Solid", color: e.listBorderColor } : e.listBorderColor || { type: "Solid", color: d }, i, O) || "#e5e7eb", t.lineWidth = F, t.stroke()), t.restore();
|
|
4106
|
-
const q = e.itemFontSize || w, Q = e.itemFontFamily ||
|
|
4107
|
-
t.font = `${
|
|
4108
|
-
const St = L + $ + dt *
|
|
4157
|
+
const q = e.itemFontSize || w, Q = e.itemFontFamily || P;
|
|
4158
|
+
t.font = `${M} ${q}px ${Q}`, x.forEach((it, dt) => {
|
|
4159
|
+
const St = L + $ + dt * A;
|
|
4109
4160
|
if (it === e.selectedOption)
|
|
4110
|
-
t.fillStyle = this.createCanvasFill(t, typeof e.itemSelectedBackgroundColor == "string" ? { type: "Solid", color: e.itemSelectedBackgroundColor } : e.itemSelectedBackgroundColor || { type: "Solid", color: "#f3f4f6" }, i,
|
|
4161
|
+
t.fillStyle = this.createCanvasFill(t, typeof e.itemSelectedBackgroundColor == "string" ? { type: "Solid", color: e.itemSelectedBackgroundColor } : e.itemSelectedBackgroundColor || { type: "Solid", color: "#f3f4f6" }, i, A) || "#f3f4f6", t.fillRect(a + F, St, i - F * 2, A), t.fillStyle = e.itemSelectedColor || e.accentColor || u || "#374151";
|
|
4111
4162
|
else if (t.fillStyle = e.listTextColor || u || "#333333", this.activeDropdownId === s.id && this._lastPointerPos) {
|
|
4112
|
-
const mt = this._lastPointerPos.y - (L + $), rt = Math.floor(mt /
|
|
4113
|
-
dt === rt && (t.fillStyle = this.createCanvasFill(t, typeof e.itemHoverBackgroundColor == "string" ? { type: "Solid", color: e.itemHoverBackgroundColor } : e.itemHoverBackgroundColor || { type: "Solid", color: "#f9fafb" }, i,
|
|
4163
|
+
const mt = this._lastPointerPos.y - (L + $), rt = Math.floor(mt / A);
|
|
4164
|
+
dt === rt && (t.fillStyle = this.createCanvasFill(t, typeof e.itemHoverBackgroundColor == "string" ? { type: "Solid", color: e.itemHoverBackgroundColor } : e.itemHoverBackgroundColor || { type: "Solid", color: "#f9fafb" }, i, A) || "#f9fafb", t.fillRect(a + F, St, i - F * 2, A), t.fillStyle = e.itemHoverColor || u);
|
|
4114
4165
|
}
|
|
4115
|
-
t.fillText(it, a + v, St +
|
|
4166
|
+
t.fillText(it, a + v, St + A / 2);
|
|
4116
4167
|
});
|
|
4117
4168
|
}
|
|
4118
4169
|
t.globalAlpha = m;
|
|
4119
4170
|
}
|
|
4120
4171
|
renderButton(t, s) {
|
|
4121
4172
|
if (s.children && s.children.length > 0) return;
|
|
4122
|
-
const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.options) || s.options || {}, i = s.geometry || {}, n = i.width || 120, a = i.height || 40, r = this.lastHoveredObjectId === s.id, l = this.activeObjectId === s.id,
|
|
4123
|
-
let d = e.backgroundColor || "#3b82f6", u =
|
|
4173
|
+
const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.options) || s.options || {}, i = s.geometry || {}, n = i.width || 120, a = i.height || 40, r = this.lastHoveredObjectId === s.id, l = this.activeObjectId === s.id, f = e.label || {}, c = e.hoverStyle || {}, g = e.activeStyle || {}, h = e.icon || { enabled: !1 };
|
|
4174
|
+
let d = e.backgroundColor || "#3b82f6", u = f.color || "#ffffff", m = f.text || "Button", y = i.cornerRadius ?? 8, v = e.borderColor || "transparent", b = e.borderWidth || 0, C = 1;
|
|
4124
4175
|
l && g ? (d = g.backgroundColor || d, u = g.color || u, m = g.text || m, C = g.scale ?? 0.95, y = g.cornerRadius ?? y) : r && c && (d = c.backgroundColor || d, u = c.color || u, m = c.text || m, C = c.scale ?? 1, y = c.cornerRadius ?? y, v = c.borderColor || v);
|
|
4125
4176
|
const S = -n / 2, I = -a / 2;
|
|
4126
4177
|
t.save(), t.scale(C, C), t.beginPath(), this.drawRoundRect(t, S, I, n, a, y);
|
|
4127
4178
|
const w = this.createCanvasFill(t, d, n, a);
|
|
4128
4179
|
w && (t.fillStyle = w, t.fill()), (b > 0 || r && c.borderColor) && (t.strokeStyle = v, t.lineWidth = b || (r ? 1 : 0), t.stroke());
|
|
4129
|
-
const
|
|
4130
|
-
t.font = `${T} ${
|
|
4180
|
+
const M = f.fontSize || 14, P = f.fontFamily || "Inter", T = f.fontWeight || 600;
|
|
4181
|
+
t.font = `${T} ${M}px "${P}", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`, t.fillStyle = u, t.textAlign = "center", t.textBaseline = "middle";
|
|
4131
4182
|
let W = 0;
|
|
4132
|
-
if (
|
|
4133
|
-
const
|
|
4134
|
-
W =
|
|
4135
|
-
const O = new Path2D(
|
|
4183
|
+
if (h.enabled && h.svgPath) {
|
|
4184
|
+
const k = M * 1.1, _ = h.gap || 8, L = t.measureText(m), A = -(L.width + k + _) / 2, $ = h.position === "left" ? A + k / 2 : A + L.width + _ + k / 2;
|
|
4185
|
+
W = h.position === "left" ? A + k + _ + L.width / 2 : A + L.width / 2, t.save(), t.translate($, 0);
|
|
4186
|
+
const O = new Path2D(h.svgPath), V = k / 24;
|
|
4136
4187
|
t.scale(V, V), t.translate(-12, -12), t.fillStyle = u, t.fill(O), t.restore();
|
|
4137
4188
|
}
|
|
4138
4189
|
t.fillText(m, W, 0), t.restore();
|
|
4139
4190
|
}
|
|
4140
4191
|
renderToggleButton(t, s) {
|
|
4141
4192
|
var m, y;
|
|
4142
|
-
const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.options) || s.options || {}, i = e.checked ?? !1, n = ((m = s.geometry) == null ? void 0 : m.width) || 120, a = ((y = s.geometry) == null ? void 0 : y.height) || 40, r = -n / 2, l = -a / 2,
|
|
4143
|
-
t.save(), t.beginPath(), this.drawRoundRect(t, r, l, n, a,
|
|
4193
|
+
const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.options) || s.options || {}, i = e.checked ?? !1, n = ((m = s.geometry) == null ? void 0 : m.width) || 120, a = ((y = s.geometry) == null ? void 0 : y.height) || 40, r = -n / 2, l = -a / 2, f = e.corner_radius ?? 8, c = e.label || {}, g = i ? e.accentColor || "#3b82f6" : e.inactiveColor || "#374151", h = i ? e.activeTextColor || "#ffffff" : e.inactiveTextColor || "#9ca3af";
|
|
4194
|
+
t.save(), t.beginPath(), this.drawRoundRect(t, r, l, n, a, f), t.fillStyle = g, t.fill();
|
|
4144
4195
|
const d = c.fontSize || 14, u = c.fontFamily || "Inter";
|
|
4145
|
-
t.font = `${c.fontWeight || 600} ${d}px "${u}", sans-serif`, t.fillStyle =
|
|
4196
|
+
t.font = `${c.fontWeight || 600} ${d}px "${u}", sans-serif`, t.fillStyle = h, t.textAlign = "center", t.textBaseline = "middle", t.fillText(c.text || "Toggle", 0, 0), t.restore();
|
|
4146
4197
|
}
|
|
4147
4198
|
renderToggle(t, s) {
|
|
4148
|
-
var V, H, et,
|
|
4149
|
-
const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.options) || s.options || {}, i = ((V = s.geometry) == null ? void 0 : V.width) || 52, n = ((H = s.geometry) == null ? void 0 : H.height) || 30, a = -i / 2, r = -n / 2, l = e.checked ?? !1,
|
|
4150
|
-
e.disabled && (t.globalAlpha *= 0.5), t.beginPath(), this.drawRoundRect(t, a, r, i, n,
|
|
4199
|
+
var V, H, et, E, F, q, Q, it, dt, St, ht, mt;
|
|
4200
|
+
const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.options) || s.options || {}, i = ((V = s.geometry) == null ? void 0 : V.width) || 52, n = ((H = s.geometry) == null ? void 0 : H.height) || 30, a = -i / 2, r = -n / 2, l = e.checked ?? !1, f = e.cornerRadius ?? e.corner_radius ?? n / 2, c = e.toggleStyle || {}, g = c.backgroundColor || e.activeColor || "#10b981", h = c.borderColor || e.borderColor || "transparent", d = c.borderWidth ?? e.borderWidth ?? 0, u = c.knobColor || e.knobColor || "#ffffff", m = l ? g : e.inactiveColor || "#374151", y = l ? h : e.borderColor || "transparent", v = l ? d : e.borderWidth ?? 0, b = l ? u : e.knobColor || "#ffffff";
|
|
4201
|
+
e.disabled && (t.globalAlpha *= 0.5), t.beginPath(), this.drawRoundRect(t, a, r, i, n, f);
|
|
4151
4202
|
const C = this.createCanvasFill(t, m, i, n);
|
|
4152
4203
|
if (C && (t.fillStyle = C, t.fill()), v > 0) {
|
|
4153
4204
|
t.lineWidth = v;
|
|
4154
4205
|
const rt = this.createCanvasFill(t, y, i, n);
|
|
4155
4206
|
rt && (t.strokeStyle = rt, t.stroke());
|
|
4156
4207
|
}
|
|
4157
|
-
const S = 2, I = n - S * 2, w = I / 2,
|
|
4208
|
+
const S = 2, I = n - S * 2, w = I / 2, M = a + S, P = a + i - S - I, T = l ? P : M, W = r + S;
|
|
4158
4209
|
t.beginPath(), t.arc(T + w, W + w, w, 0, Math.PI * 2);
|
|
4159
|
-
const
|
|
4160
|
-
|
|
4210
|
+
const k = this.createCanvasFill(t, b, I, I);
|
|
4211
|
+
k && (t.fillStyle = k, t.fill()), e.disabled && (t.globalAlpha *= 2);
|
|
4161
4212
|
let _ = !1, L = !1;
|
|
4162
|
-
const x = (l ? (et = c.leftLabel) == null ? void 0 : et.text : null) || ((
|
|
4213
|
+
const x = (l ? (et = c.leftLabel) == null ? void 0 : et.text : null) || ((E = e.leftLabel) == null ? void 0 : E.text) || "", A = (l ? (F = c.leftLabel) == null ? void 0 : F.color : null) || ((q = e.leftLabel) == null ? void 0 : q.color) || "#f3f4f6";
|
|
4163
4214
|
if ((Q = e.leftLabel) != null && Q.enabled && x) {
|
|
4164
4215
|
const rt = e.leftLabel;
|
|
4165
|
-
t.font = `${rt.fontWeight || 400} ${rt.fontSize || 12}px "${rt.fontFamily || "Inter"}", sans-serif`, t.fillStyle =
|
|
4216
|
+
t.font = `${rt.fontWeight || 400} ${rt.fontSize || 12}px "${rt.fontFamily || "Inter"}", sans-serif`, t.fillStyle = A, t.textBaseline = "middle", t.textAlign = "right", t.fillText(x, a - (rt.gap || 8), 0), _ = !0;
|
|
4166
4217
|
}
|
|
4167
4218
|
const $ = (l ? (it = c.rightLabel) == null ? void 0 : it.text : null) || ((dt = e.rightLabel) == null ? void 0 : dt.text) || "", O = (l ? (St = c.rightLabel) == null ? void 0 : St.color : null) || ((ht = e.rightLabel) == null ? void 0 : ht.color) || "#f3f4f6";
|
|
4168
4219
|
if ((mt = e.rightLabel) != null && mt.enabled && $) {
|
|
@@ -4179,61 +4230,61 @@ class li {
|
|
|
4179
4230
|
}
|
|
4180
4231
|
renderCheckbox(t, s) {
|
|
4181
4232
|
var C, S;
|
|
4182
|
-
const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.options) || s.options || {}, i = ((C = s.geometry) == null ? void 0 : C.width) || 20, n = ((S = s.geometry) == null ? void 0 : S.height) || 20, a = -i / 2, r = -n / 2, l = e.cornerRadius ?? 4,
|
|
4233
|
+
const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.options) || s.options || {}, i = ((C = s.geometry) == null ? void 0 : C.width) || 20, n = ((S = s.geometry) == null ? void 0 : S.height) || 20, a = -i / 2, r = -n / 2, l = e.cornerRadius ?? 4, f = e.checked ?? !1, c = e.activeColor || "#3b82f6", g = e.inactiveColor || "transparent", h = e.checkColor || "#ffffff", d = e.borderColor || "#4b5563", u = e.borderWidth ?? 2, m = f ? c : g, y = f ? "transparent" : d, v = f ? 0 : u;
|
|
4183
4234
|
e.disabled && (t.globalAlpha *= 0.5), t.beginPath(), this.drawRoundRect(t, a, r, i, n, l);
|
|
4184
4235
|
const b = this.createCanvasFill(t, m, i, n);
|
|
4185
4236
|
if (b && (t.fillStyle = b, t.fill()), v > 0) {
|
|
4186
4237
|
t.lineWidth = v;
|
|
4187
4238
|
const I = this.createCanvasFill(t, y, i, n);
|
|
4188
4239
|
I && (t.strokeStyle = I, t.stroke());
|
|
4189
|
-
} else if (
|
|
4240
|
+
} else if (f) {
|
|
4190
4241
|
t.lineWidth = 1;
|
|
4191
4242
|
const I = this.createCanvasFill(t, c, i, n);
|
|
4192
4243
|
I && (t.strokeStyle = I, t.stroke());
|
|
4193
4244
|
}
|
|
4194
|
-
if (
|
|
4245
|
+
if (f) {
|
|
4195
4246
|
t.save(), t.beginPath();
|
|
4196
|
-
const I = this.createCanvasFill(t,
|
|
4197
|
-
t.strokeStyle = I ||
|
|
4198
|
-
const w = a + i * 0.25,
|
|
4199
|
-
t.moveTo(w,
|
|
4247
|
+
const I = this.createCanvasFill(t, h, i, n);
|
|
4248
|
+
t.strokeStyle = I || h, t.lineWidth = Math.max(2, i * 0.12), t.lineCap = "round", t.lineJoin = "round";
|
|
4249
|
+
const w = a + i * 0.25, M = r + n * 0.5, P = a + i * 0.45, T = r + n * 0.7, W = a + i * 0.75, k = r + n * 0.25;
|
|
4250
|
+
t.moveTo(w, M), t.lineTo(P, T), t.lineTo(W, k), t.stroke(), t.restore();
|
|
4200
4251
|
}
|
|
4201
4252
|
if (e.disabled && (t.globalAlpha *= 2), e.label && e.label.text) {
|
|
4202
4253
|
const I = e.label;
|
|
4203
4254
|
t.save(), t.font = `${I.fontWeight || 400} ${I.fontSize || 14}px "${I.fontFamily || "Inter"}", sans-serif`, t.fillStyle = I.color || "#f3f4f6", t.textBaseline = "middle";
|
|
4204
4255
|
const w = I.gap || 8;
|
|
4205
|
-
let
|
|
4206
|
-
I.position === "left" ? (t.textAlign = "right",
|
|
4256
|
+
let M = 0, P = 0;
|
|
4257
|
+
I.position === "left" ? (t.textAlign = "right", M = a - w, P = 0) : I.position === "right" ? (t.textAlign = "left", M = a + i + w, P = 0) : I.position === "top" ? (t.textAlign = "center", M = 0, P = r - w, t.textBaseline = "bottom") : I.position === "bottom" && (t.textAlign = "center", M = 0, P = r + n + w, t.textBaseline = "top"), t.fillText(I.text, M, P), t.restore();
|
|
4207
4258
|
}
|
|
4208
4259
|
}
|
|
4209
4260
|
renderRadioGroup(t, s) {
|
|
4210
4261
|
var S, I;
|
|
4211
|
-
const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.options) || s.options || {}, i = ((S = s.geometry) == null ? void 0 : S.width) || 180, n = ((I = s.geometry) == null ? void 0 : I.height) || 100, a = -i / 2, r = -n / 2, l = e.selectedValue,
|
|
4262
|
+
const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.options) || s.options || {}, i = ((S = s.geometry) == null ? void 0 : S.width) || 180, n = ((I = s.geometry) == null ? void 0 : I.height) || 100, a = -i / 2, r = -n / 2, l = e.selectedValue, f = e.optionsList || ["Option 1", "Option 2", "Option 3"], c = e.orientation || "vertical", g = e.itemGap !== void 0 ? e.itemGap : 16, h = e.activeColor || "#3b82f6", d = e.inactiveColor || "#4b5563", u = e.textColor || "#ffffff", m = e.fontSize || 14, y = e.fontFamily || "Inter", v = e.fontWeight || 400;
|
|
4212
4263
|
e.disabled && (t.globalAlpha *= 0.5);
|
|
4213
4264
|
const b = 8, C = b * 2;
|
|
4214
4265
|
if (t.save(), t.font = `${v} ${m}px "${y}", sans-serif`, t.textBaseline = "middle", t.textAlign = "left", c === "vertical") {
|
|
4215
4266
|
const w = Math.max(C, m) + g;
|
|
4216
|
-
|
|
4217
|
-
const T = r +
|
|
4267
|
+
f.forEach((M, P) => {
|
|
4268
|
+
const T = r + P * w + b;
|
|
4218
4269
|
t.beginPath(), t.arc(a + b, T, b, 0, Math.PI * 2);
|
|
4219
|
-
const W = l ===
|
|
4220
|
-
W ? (t.strokeStyle =
|
|
4270
|
+
const W = l === M, k = this.createCanvasFill(t, h, C, C), _ = this.createCanvasFill(t, d, C, C);
|
|
4271
|
+
W ? (t.strokeStyle = k || h, t.lineWidth = 2, t.stroke(), t.beginPath(), t.arc(a + b, T, b / 2, 0, Math.PI * 2), t.fillStyle = k || h, t.fill()) : (t.strokeStyle = _ || d, t.lineWidth = 1.5, t.stroke()), t.fillStyle = u, t.fillText(M, a + C + 8, T);
|
|
4221
4272
|
});
|
|
4222
4273
|
} else {
|
|
4223
4274
|
let w = a;
|
|
4224
|
-
|
|
4225
|
-
const
|
|
4275
|
+
f.forEach((M) => {
|
|
4276
|
+
const P = l === M, T = t.measureText(M).width;
|
|
4226
4277
|
t.beginPath(), t.arc(w + b, 0, b, 0, Math.PI * 2);
|
|
4227
|
-
const W = this.createCanvasFill(t,
|
|
4228
|
-
|
|
4278
|
+
const W = this.createCanvasFill(t, h, C, C), k = this.createCanvasFill(t, d, C, C);
|
|
4279
|
+
P ? (t.strokeStyle = W || h, t.lineWidth = 2, t.stroke(), t.beginPath(), t.arc(w + b, 0, b / 2, 0, Math.PI * 2), t.fillStyle = W || h, t.fill()) : (t.strokeStyle = k || d, t.lineWidth = 1.5, t.stroke()), t.fillStyle = u, t.fillText(M, w + C + 6, 0), w += C + 6 + T + g;
|
|
4229
4280
|
});
|
|
4230
4281
|
}
|
|
4231
4282
|
if (t.restore(), e.disabled && (t.globalAlpha *= 2), e.label && e.label.text) {
|
|
4232
4283
|
const w = e.label;
|
|
4233
4284
|
t.save(), t.font = `${w.fontWeight || 400} ${w.fontSize || 14}px "${w.fontFamily || "Inter"}", sans-serif`, t.fillStyle = w.color || "#9ca3af", t.textBaseline = "middle";
|
|
4234
|
-
const
|
|
4235
|
-
let
|
|
4236
|
-
w.position === "left" ? (t.textAlign = "right",
|
|
4285
|
+
const M = w.gap || 8;
|
|
4286
|
+
let P = 0, T = 0;
|
|
4287
|
+
w.position === "left" ? (t.textAlign = "right", P = a - M, T = 0) : w.position === "right" ? (t.textAlign = "left", P = a + i + M, T = 0) : w.position === "top" ? (t.textAlign = "center", P = 0, T = r - M, t.textBaseline = "bottom") : w.position === "bottom" && (t.textAlign = "center", P = 0, T = r + n + M, t.textBaseline = "top"), t.fillText(w.text, P, T), t.restore();
|
|
4237
4288
|
}
|
|
4238
4289
|
}
|
|
4239
4290
|
renderBarChart(t, s) {
|
|
@@ -4269,99 +4320,99 @@ class li {
|
|
|
4269
4320
|
_getPreset: function() {
|
|
4270
4321
|
return fs[this.stylePreset] || fs.default;
|
|
4271
4322
|
},
|
|
4272
|
-
_resolveColor: function(
|
|
4323
|
+
_resolveColor: function(k, _) {
|
|
4273
4324
|
const L = this._getPreset();
|
|
4274
|
-
return ["#6366f1", "#f59e0b", "#10b981", "#3b82f6", "#a855f7"].includes(
|
|
4325
|
+
return ["#6366f1", "#f59e0b", "#10b981", "#3b82f6", "#a855f7"].includes(k) ? L.colors[_ % L.colors.length] : typeof k == "string" ? k : L.colors[_ % L.colors.length];
|
|
4275
4326
|
},
|
|
4276
|
-
_makeGradient: function(
|
|
4327
|
+
_makeGradient: function(k, _, L, x, A, $) {
|
|
4277
4328
|
if (!this._getPreset().barGradient && !this.barGradient) return _;
|
|
4278
|
-
const V =
|
|
4329
|
+
const V = k.createLinearGradient(L, x, A, $);
|
|
4279
4330
|
return V.addColorStop(0, _), V.addColorStop(1, _ + "44"), V;
|
|
4280
4331
|
},
|
|
4281
|
-
_drawRoundedBar: function(
|
|
4282
|
-
if ($ = Math.min($, Math.min(Math.abs(x), Math.abs(
|
|
4283
|
-
|
|
4332
|
+
_drawRoundedBar: function(k, _, L, x, A, $, O) {
|
|
4333
|
+
if ($ = Math.min($, Math.min(Math.abs(x), Math.abs(A)) / 2), $ <= 0 || x === 0 || A === 0) {
|
|
4334
|
+
k.rect(_, L, x, A);
|
|
4284
4335
|
return;
|
|
4285
4336
|
}
|
|
4286
|
-
|
|
4337
|
+
k.beginPath(), O ? (k.moveTo(_, L + A), k.lineTo(_, L + $), k.quadraticCurveTo(_, L, _ + $, L), k.lineTo(_ + x - $, L), k.quadraticCurveTo(_ + x, L, _ + x, L + $), k.lineTo(_ + x, L + A), k.lineTo(_, L + A)) : (k.moveTo(_, L), k.lineTo(_ + x - $, L), k.quadraticCurveTo(_ + x, L, _ + x, L + $), k.lineTo(_ + x, L + A - $), k.quadraticCurveTo(_ + x, L + A, _ + x - $, L + A), k.lineTo(_, L + A), k.lineTo(_, L)), k.closePath();
|
|
4287
4338
|
}
|
|
4288
4339
|
}, n = i.width, a = i.height, r = -n / 2, l = -a / 2;
|
|
4289
4340
|
if (!i.datasets || i.datasets.length === 0 || i.categories.length === 0) {
|
|
4290
4341
|
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();
|
|
4291
4342
|
return;
|
|
4292
4343
|
}
|
|
4293
|
-
const
|
|
4344
|
+
const f = i._getPreset();
|
|
4294
4345
|
let c = -1 / 0, g = 1 / 0;
|
|
4295
|
-
const
|
|
4346
|
+
const h = i.categories.length, d = i.datasets.length;
|
|
4296
4347
|
if (i.chartType === "stacked")
|
|
4297
|
-
for (let
|
|
4348
|
+
for (let k = 0; k < h; k++) {
|
|
4298
4349
|
let _ = 0, L = 0;
|
|
4299
4350
|
i.datasets.forEach((x) => {
|
|
4300
|
-
const
|
|
4301
|
-
|
|
4351
|
+
const A = x.data[k] ?? 0;
|
|
4352
|
+
A >= 0 ? _ += A : L += A;
|
|
4302
4353
|
}), _ > c && (c = _), L < g && (g = L);
|
|
4303
4354
|
}
|
|
4304
4355
|
else
|
|
4305
|
-
i.datasets.forEach((
|
|
4306
|
-
|
|
4356
|
+
i.datasets.forEach((k) => {
|
|
4357
|
+
k.data && k.data.forEach((_) => {
|
|
4307
4358
|
_ > c && (c = _), _ < g && (g = _);
|
|
4308
4359
|
});
|
|
4309
4360
|
});
|
|
4310
4361
|
isFinite(c) || (c = 10), isFinite(g) || (g = 0), c = Math.max(c, 0), g = Math.min(g, 0);
|
|
4311
4362
|
const u = c - g || 10;
|
|
4312
4363
|
t.save(), t.font = `${i.axisLabelFontSize}px Inter, sans-serif`;
|
|
4313
|
-
const m = i.showYLabels ? t.measureText(c.toFixed(0)).width + 14 : 10, y = i.showXLabels ? i.axisLabelFontSize + 12 : 8, b = (i.showLegend && d > 0 ? i.legendFontSize + 10 : 0) + 8, C = 10, S = r + m, I = l + b, w = n - m - C,
|
|
4314
|
-
if (t.beginPath(), t.roundRect(r, l, n, a, 10), t.fillStyle =
|
|
4364
|
+
const m = i.showYLabels ? t.measureText(c.toFixed(0)).width + 14 : 10, y = i.showXLabels ? i.axisLabelFontSize + 12 : 8, b = (i.showLegend && d > 0 ? i.legendFontSize + 10 : 0) + 8, C = 10, S = r + m, I = l + b, w = n - m - C, M = a - b - y;
|
|
4365
|
+
if (t.beginPath(), t.roundRect(r, l, n, a, 10), t.fillStyle = f.cardBackground, t.fill(), t.strokeStyle = f.cardBorderColor, t.lineWidth = 1, t.stroke(), i.showLegend && d > 0) {
|
|
4315
4366
|
t.font = `${i.legendFontSize}px Inter, sans-serif`, t.textBaseline = "middle";
|
|
4316
|
-
const
|
|
4367
|
+
const k = l + 12;
|
|
4317
4368
|
let _ = S;
|
|
4318
4369
|
i.datasets.forEach((L, x) => {
|
|
4319
|
-
const
|
|
4320
|
-
t.beginPath(), t.roundRect(_,
|
|
4370
|
+
const A = i._resolveColor(L.color, x), $ = L.label || `Series ${x + 1}`, O = 7;
|
|
4371
|
+
t.beginPath(), t.roundRect(_, k - O / 2, O, O, 2), t.fillStyle = A, t.fill(), t.fillStyle = f.legendColor, t.textAlign = "left", t.fillText($, _ + O + 4, k), _ += t.measureText($).width + O + 16;
|
|
4321
4372
|
});
|
|
4322
4373
|
}
|
|
4323
|
-
const
|
|
4374
|
+
const P = 4;
|
|
4324
4375
|
if (i.showGridLines) {
|
|
4325
|
-
t.setLineDash([3, 4]), t.lineWidth = 1, t.strokeStyle =
|
|
4326
|
-
for (let
|
|
4327
|
-
const _ = I +
|
|
4376
|
+
t.setLineDash([3, 4]), t.lineWidth = 1, t.strokeStyle = f.gridColor;
|
|
4377
|
+
for (let k = 0; k <= P; k++) {
|
|
4378
|
+
const _ = I + k / P * M;
|
|
4328
4379
|
t.beginPath(), t.moveTo(S, _), t.lineTo(S + w, _), t.stroke();
|
|
4329
4380
|
}
|
|
4330
4381
|
t.setLineDash([]);
|
|
4331
4382
|
}
|
|
4332
4383
|
if (i.showYLabels) {
|
|
4333
|
-
t.font = `${i.axisLabelFontSize}px Inter, sans-serif`, t.textAlign = "right", t.textBaseline = "middle", t.fillStyle =
|
|
4334
|
-
for (let
|
|
4335
|
-
const _ = c -
|
|
4384
|
+
t.font = `${i.axisLabelFontSize}px Inter, sans-serif`, t.textAlign = "right", t.textBaseline = "middle", t.fillStyle = f.axisLabelColor;
|
|
4385
|
+
for (let k = 0; k <= P; k++) {
|
|
4386
|
+
const _ = c - k / P * u, L = I + k / P * M;
|
|
4336
4387
|
t.fillText(_.toFixed(0), S - 6, L);
|
|
4337
4388
|
}
|
|
4338
4389
|
}
|
|
4339
|
-
if (t.lineWidth = 1, t.setLineDash([]), i.showXAxis && (t.strokeStyle = i.xAxisColor, t.beginPath(), t.moveTo(S, I +
|
|
4340
|
-
const
|
|
4341
|
-
for (let _ = 0; _ <
|
|
4342
|
-
const L = S + _ *
|
|
4343
|
-
i.showXLabels && (t.font = `${i.axisLabelFontSize}px Inter, sans-serif`, t.textAlign = "center", t.textBaseline = "top", t.fillStyle =
|
|
4344
|
-
let x = I +
|
|
4345
|
-
i.datasets.forEach((
|
|
4346
|
-
const O =
|
|
4390
|
+
if (t.lineWidth = 1, t.setLineDash([]), i.showXAxis && (t.strokeStyle = i.xAxisColor, t.beginPath(), t.moveTo(S, I + M), t.lineTo(S + w, I + M), t.stroke()), i.showYAxis && (t.strokeStyle = i.yAxisColor, t.beginPath(), t.moveTo(S, I), t.lineTo(S, I + M), t.stroke()), i.chartType === "stacked") {
|
|
4391
|
+
const k = w / h;
|
|
4392
|
+
for (let _ = 0; _ < h; _++) {
|
|
4393
|
+
const L = S + _ * k + k / 2;
|
|
4394
|
+
i.showXLabels && (t.font = `${i.axisLabelFontSize}px Inter, sans-serif`, t.textAlign = "center", t.textBaseline = "top", t.fillStyle = f.axisLabelColor, t.fillText(i.categories[_] || "", L, I + M + 5));
|
|
4395
|
+
let x = I + M;
|
|
4396
|
+
i.datasets.forEach((A, $) => {
|
|
4397
|
+
const O = A.data[_] ?? 0;
|
|
4347
4398
|
if (O === 0) return;
|
|
4348
|
-
const V = O / u *
|
|
4399
|
+
const V = O / u * M, H = Math.min(i.barWidth * d + i.barGap, k - 8), et = L - H / 2, E = x - V;
|
|
4349
4400
|
x -= V;
|
|
4350
|
-
const F = i._resolveColor(
|
|
4351
|
-
t.beginPath(), t.fillStyle = i._makeGradient(t, F, et,
|
|
4401
|
+
const F = i._resolveColor(A.color, $);
|
|
4402
|
+
t.beginPath(), t.fillStyle = i._makeGradient(t, F, et, E, et, E + V), i._drawRoundedBar(t, et, E, H, V, $ === d - 1 ? i.barCornerRadius : 0, !0), t.fill();
|
|
4352
4403
|
});
|
|
4353
4404
|
}
|
|
4354
4405
|
} else {
|
|
4355
|
-
const
|
|
4356
|
-
for (let x = 0; x <
|
|
4357
|
-
const
|
|
4358
|
-
i.showXLabels && (t.font = `${i.axisLabelFontSize}px Inter, sans-serif`, t.textAlign = "center", t.textBaseline = "top", t.fillStyle =
|
|
4359
|
-
const $ =
|
|
4406
|
+
const k = w / h, _ = d * i.barWidth + Math.max(0, (d - 1) * i.barGap), L = I + M - (0 - g) / u * M;
|
|
4407
|
+
for (let x = 0; x < h; x++) {
|
|
4408
|
+
const A = S + x * k + k / 2;
|
|
4409
|
+
i.showXLabels && (t.font = `${i.axisLabelFontSize}px Inter, sans-serif`, t.textAlign = "center", t.textBaseline = "top", t.fillStyle = f.axisLabelColor, t.fillText(i.categories[x] || "", A, I + M + 5));
|
|
4410
|
+
const $ = A - _ / 2;
|
|
4360
4411
|
i.datasets.forEach((O, V) => {
|
|
4361
|
-
const H = O.data[x] ?? 0, et = Math.abs(H / u *
|
|
4412
|
+
const H = O.data[x] ?? 0, et = Math.abs(H / u * M);
|
|
4362
4413
|
if (et < 1) return;
|
|
4363
|
-
const
|
|
4364
|
-
t.beginPath(), t.fillStyle = i._makeGradient(t, q,
|
|
4414
|
+
const E = $ + V * (i.barWidth + i.barGap), F = H >= 0 ? L - et : L, q = i._resolveColor(O.color, V);
|
|
4415
|
+
t.beginPath(), t.fillStyle = i._makeGradient(t, q, E, F, E, F + et), i._drawRoundedBar(t, E, F, i.barWidth, et, i.barCornerRadius, !0), t.fill(), i.showValueOnTop && H !== 0 && (t.font = `bold ${i.axisLabelFontSize}px Inter, sans-serif`, t.textAlign = "center", t.textBaseline = "bottom", t.fillStyle = q, t.fillText(H.toString(), E + i.barWidth / 2, F - 2));
|
|
4365
4416
|
});
|
|
4366
4417
|
}
|
|
4367
4418
|
}
|
|
@@ -4406,74 +4457,74 @@ class li {
|
|
|
4406
4457
|
}
|
|
4407
4458
|
const l = i._getPreset();
|
|
4408
4459
|
t.save(), t.beginPath(), t.roundRect(-n / 2, -a / 2, n, a, 10), t.fillStyle = l.cardBackground, t.fill(), t.strokeStyle = l.cardBorderColor, t.lineWidth = 1, t.stroke();
|
|
4409
|
-
const
|
|
4460
|
+
const f = i.showLegend ? Math.ceil(i.slices.length / 2) : 0, c = f > 0 ? f * (i.legendFontSize + 8) + 10 : 0, g = a - c - 16, h = Math.min(n - 24, g) / 2, d = 0, u = -c / 2;
|
|
4410
4461
|
if (i.chartType === "rose") {
|
|
4411
|
-
const v = Math.max(...i.slices.map((S) => S.value || 0)), b = Math.PI * 2 / i.slices.length, C =
|
|
4462
|
+
const v = Math.max(...i.slices.map((S) => S.value || 0)), b = Math.PI * 2 / i.slices.length, C = h > 0 ? i.sliceGap / h : 0;
|
|
4412
4463
|
i.slices.forEach((S, I) => {
|
|
4413
4464
|
const w = S.value || 0;
|
|
4414
4465
|
if (w === 0) return;
|
|
4415
|
-
const
|
|
4416
|
-
if (t.beginPath(), t.moveTo(d, u), t.arc(d, u,
|
|
4417
|
-
const
|
|
4466
|
+
const M = w / v * h, P = -Math.PI / 2 + I * b + C / 2, T = P + b - C, W = i._resolveSliceColor(S, I);
|
|
4467
|
+
if (t.beginPath(), t.moveTo(d, u), t.arc(d, u, M, P, T), t.closePath(), t.fillStyle = W + "cc", t.fill(), t.strokeStyle = W, t.lineWidth = 1.5, t.stroke(), i.showLabels) {
|
|
4468
|
+
const k = P + (T - P) / 2, _ = d + M * 0.65 * Math.cos(k), L = u + M * 0.65 * Math.sin(k), x = Math.round(w / r * 100);
|
|
4418
4469
|
t.save(), t.font = `bold ${i.labelFontSize}px Inter, sans-serif`, t.fillStyle = l.labelColor, t.textAlign = "center", t.textBaseline = "middle", t.fillText(`${x}%`, _, L), t.restore();
|
|
4419
4470
|
}
|
|
4420
4471
|
});
|
|
4421
4472
|
} else {
|
|
4422
|
-
const v = i.chartType === "pie" ? 0 : i.innerRadius, b =
|
|
4473
|
+
const v = i.chartType === "pie" ? 0 : i.innerRadius, b = h * Math.max(0, v), C = h > 0 ? i.sliceGap / h : 0;
|
|
4423
4474
|
let S = -Math.PI / 2;
|
|
4424
4475
|
if (i.slices.forEach((I, w) => {
|
|
4425
|
-
const
|
|
4426
|
-
if (
|
|
4427
|
-
S +=
|
|
4476
|
+
const M = I.value || 0;
|
|
4477
|
+
if (M === 0) {
|
|
4478
|
+
S += M / r * Math.PI * 2;
|
|
4428
4479
|
return;
|
|
4429
4480
|
}
|
|
4430
|
-
const
|
|
4481
|
+
const P = M / r * Math.PI * 2, T = S + C / 2, W = S + P - C / 2;
|
|
4431
4482
|
if (W <= T) {
|
|
4432
|
-
S +=
|
|
4483
|
+
S += P;
|
|
4433
4484
|
return;
|
|
4434
4485
|
}
|
|
4435
|
-
const
|
|
4436
|
-
if (t.beginPath(), t.fillStyle =
|
|
4437
|
-
const _ = T + (W - T) / 2, L = b + (
|
|
4438
|
-
t.save(), t.font = `bold ${i.labelFontSize}px Inter, sans-serif`, t.fillStyle = l.labelColor, t.textAlign = "center", t.textBaseline = "middle", t.fillText(`${$}%`, x,
|
|
4486
|
+
const k = i._resolveSliceColor(I, w);
|
|
4487
|
+
if (t.beginPath(), t.fillStyle = k, b <= 0 ? (t.moveTo(d, u), t.arc(d, u, h, T, W), t.lineTo(d, u)) : (t.moveTo(d + h * Math.cos(T), u + h * Math.sin(T)), t.arc(d, u, h, T, W), t.arc(d, u, b, W, T, !0), t.closePath()), t.fill(), i.showLabels) {
|
|
4488
|
+
const _ = T + (W - T) / 2, L = b + (h - b) / 2, x = d + L * Math.cos(_), A = u + L * Math.sin(_), $ = Math.round(M / r * 100);
|
|
4489
|
+
t.save(), t.font = `bold ${i.labelFontSize}px Inter, sans-serif`, t.fillStyle = l.labelColor, t.textAlign = "center", t.textBaseline = "middle", t.fillText(`${$}%`, x, A), t.restore();
|
|
4439
4490
|
}
|
|
4440
|
-
S +=
|
|
4491
|
+
S += P;
|
|
4441
4492
|
}), i.chartType === "donut" && i.showCenterText && b > 14) {
|
|
4442
|
-
const I = Math.round(r), w = Math.min(Math.floor(b * 0.52), 20),
|
|
4443
|
-
t.textAlign = "center", t.textBaseline = "middle", t.font = `bold ${w}px Inter, sans-serif`, t.fillStyle = l.centerTextColor, t.fillText(I.toString(), d, u -
|
|
4493
|
+
const I = Math.round(r), w = Math.min(Math.floor(b * 0.52), 20), M = Math.min(Math.floor(b * 0.26), 10);
|
|
4494
|
+
t.textAlign = "center", t.textBaseline = "middle", t.font = `bold ${w}px Inter, sans-serif`, t.fillStyle = l.centerTextColor, t.fillText(I.toString(), d, u - M * 0.5), i.centerLabel && (t.font = `${M}px Inter, sans-serif`, t.fillStyle = l.centerLabelColor, t.fillText(i.centerLabel, d, u + w * 0.6));
|
|
4444
4495
|
}
|
|
4445
4496
|
}
|
|
4446
4497
|
if (i.showLegend && i.slices.length > 0) {
|
|
4447
4498
|
t.font = `${i.legendFontSize}px Inter, sans-serif`;
|
|
4448
4499
|
const v = 2, b = n / v, C = i.legendFontSize + 8, S = a / 2 - c + 10, I = -n / 2 + 10;
|
|
4449
|
-
i.slices.forEach((w,
|
|
4450
|
-
const
|
|
4451
|
-
t.beginPath(), t.roundRect(W,
|
|
4452
|
-
const x = Math.round((w.value || 0) / r * 100),
|
|
4453
|
-
let O =
|
|
4500
|
+
i.slices.forEach((w, M) => {
|
|
4501
|
+
const P = M % v, T = Math.floor(M / v), W = I + P * b, k = S + T * C, _ = i._resolveSliceColor(w, M), L = 7;
|
|
4502
|
+
t.beginPath(), t.roundRect(W, k - L / 2, L, L, 2), t.fillStyle = _, t.fill(), t.textAlign = "left", t.textBaseline = "middle", t.fillStyle = l.legendColor;
|
|
4503
|
+
const x = Math.round((w.value || 0) / r * 100), A = `${w.label || "Item"} ${x}%`, $ = b - L - 20;
|
|
4504
|
+
let O = A;
|
|
4454
4505
|
for (; t.measureText(O).width > $ && O.length > 4; )
|
|
4455
4506
|
O = O.slice(0, -4) + "…";
|
|
4456
|
-
t.fillText(O, W + L + 4,
|
|
4507
|
+
t.fillText(O, W + L + 4, k);
|
|
4457
4508
|
});
|
|
4458
4509
|
}
|
|
4459
4510
|
t.restore();
|
|
4460
4511
|
}
|
|
4461
4512
|
getRadioGroupItemIndexAtPointer(t, s, o) {
|
|
4462
|
-
var
|
|
4513
|
+
var M, P;
|
|
4463
4514
|
const e = t.options || {}, i = this.objectStates.get(t.id) || {}, n = e.optionsList || [];
|
|
4464
4515
|
if (n.length === 0) return null;
|
|
4465
|
-
const a = i.width !== void 0 ? i.width : ((
|
|
4516
|
+
const a = i.width !== void 0 ? i.width : ((M = t.geometry) == null ? void 0 : M.width) || 180, r = i.height !== void 0 ? i.height : ((P = t.geometry) == null ? void 0 : P.height) || 100, l = e.orientation || "vertical", f = e.itemGap !== void 0 ? e.itemGap : 16, c = e.fontSize || 14, g = this.getWorldTransform(t.id), h = s - g.x, d = o - g.y, u = -g.rotation * (Math.PI / 180), m = Math.cos(u), y = Math.sin(u), v = h * m - d * y, b = h * y + d * m, S = 8 * 2, I = -a / 2, w = -r / 2;
|
|
4466
4517
|
if (l === "vertical") {
|
|
4467
|
-
const T = Math.max(S, c) +
|
|
4518
|
+
const T = Math.max(S, c) + f;
|
|
4468
4519
|
for (let W = 0; W < n.length; W++) {
|
|
4469
|
-
const
|
|
4470
|
-
if (v >= I && v <= I + a && b >=
|
|
4520
|
+
const k = w + W * T;
|
|
4521
|
+
if (v >= I && v <= I + a && b >= k && b <= k + T)
|
|
4471
4522
|
return W;
|
|
4472
4523
|
}
|
|
4473
4524
|
} else {
|
|
4474
4525
|
let T = I;
|
|
4475
4526
|
for (let W = 0; W < n.length; W++) {
|
|
4476
|
-
const _ = n[W].length * 8, L = S + 6 + _ +
|
|
4527
|
+
const _ = n[W].length * 8, L = S + 6 + _ + f;
|
|
4477
4528
|
if (v >= T && v <= T + L && b >= w && b <= w + r)
|
|
4478
4529
|
return W;
|
|
4479
4530
|
T += L;
|
|
@@ -4518,11 +4569,11 @@ class li {
|
|
|
4518
4569
|
}
|
|
4519
4570
|
u._resolvedData = m;
|
|
4520
4571
|
}), r < 2) return;
|
|
4521
|
-
const l = a - n,
|
|
4572
|
+
const l = a - n, f = o / (r - 1), c = (u) => {
|
|
4522
4573
|
const m = l === 0 ? 0.5 : (u - n) / l;
|
|
4523
4574
|
return e / 2 - m * e;
|
|
4524
|
-
}, g = (u) => u *
|
|
4525
|
-
if (s.showXAxis && (t.beginPath(), t.strokeStyle = s.xAxisColor ||
|
|
4575
|
+
}, g = (u) => u * f - o / 2, h = s.axisColor || "#333333";
|
|
4576
|
+
if (s.showXAxis && (t.beginPath(), t.strokeStyle = s.xAxisColor || h, t.lineWidth = 1, t.moveTo(-o / 2, e / 2), t.lineTo(o / 2, e / 2), t.stroke()), s.showYAxis && (t.beginPath(), t.strokeStyle = s.yAxisColor || h, t.lineWidth = 1, t.moveTo(-o / 2, -e / 2), t.lineTo(-o / 2, e / 2), t.stroke()), t.fillStyle = s.axisLabelColor || "#333333", t.font = `${s.axisLabelFontSize || 10}px Inter, sans-serif`, s.showXLabels) {
|
|
4526
4577
|
t.textAlign = "center", t.textBaseline = "top";
|
|
4527
4578
|
for (let u = 0; u < r; u++) {
|
|
4528
4579
|
const m = g(u);
|
|
@@ -4543,8 +4594,8 @@ class li {
|
|
|
4543
4594
|
for (let v = 0; v < m.length - 1; v++) {
|
|
4544
4595
|
const b = m[v === 0 ? v : v - 1], C = m[v], S = m[v + 1], I = m[v + 1 === m.length - 1 ? v + 1 : v + 2];
|
|
4545
4596
|
for (let w = 1; w <= d; w++) {
|
|
4546
|
-
const
|
|
4547
|
-
t.lineTo(g(v +
|
|
4597
|
+
const M = w / d, P = this._catmullRom(b, C, S, I, M);
|
|
4598
|
+
t.lineTo(g(v + M), c(P));
|
|
4548
4599
|
}
|
|
4549
4600
|
}
|
|
4550
4601
|
else
|
|
@@ -4558,8 +4609,8 @@ class li {
|
|
|
4558
4609
|
for (let y = 0; y < m.length - 1; y++) {
|
|
4559
4610
|
const v = m[y === 0 ? y : y - 1], b = m[y], C = m[y + 1], S = m[y + 1 === m.length - 1 ? y + 1 : y + 2];
|
|
4560
4611
|
for (let I = 1; I <= d; I++) {
|
|
4561
|
-
const w = I / d,
|
|
4562
|
-
t.lineTo(g(y + w), c(
|
|
4612
|
+
const w = I / d, M = this._catmullRom(v, b, C, S, w);
|
|
4613
|
+
t.lineTo(g(y + w), c(M));
|
|
4563
4614
|
}
|
|
4564
4615
|
}
|
|
4565
4616
|
else
|
|
@@ -4593,19 +4644,19 @@ class li {
|
|
|
4593
4644
|
if (!s || s.type === "None") return null;
|
|
4594
4645
|
if (typeof s == "string") return s;
|
|
4595
4646
|
if (s.type === "Solid" && s.color) {
|
|
4596
|
-
const r = s.color,
|
|
4597
|
-
return t.fillStyle =
|
|
4647
|
+
const r = s.color, f = (((n = (i = this.artboard) == null ? void 0 : i.tokens) == null ? void 0 : n.colors) || {})[r] || r;
|
|
4648
|
+
return t.fillStyle = f, f;
|
|
4598
4649
|
}
|
|
4599
4650
|
if ((s.type === "LinearGradient" || s.type === "RadialGradient" || s.type === "AngularGradient" || s.type === "DiamondGradient") && s.stops) {
|
|
4600
|
-
const r = (l,
|
|
4651
|
+
const r = (l, f = 100) => {
|
|
4601
4652
|
var C, S;
|
|
4602
|
-
const g = (((S = (C = this.artboard) == null ? void 0 : C.tokens) == null ? void 0 : S.colors) || {})[l] || l,
|
|
4653
|
+
const g = (((S = (C = this.artboard) == null ? void 0 : C.tokens) == null ? void 0 : S.colors) || {})[l] || l, h = this.normalizeOpacity(s.opacity ?? 100), u = this.normalizeOpacity(f) * h;
|
|
4603
4654
|
if (u >= 1 && g.startsWith("#")) return g;
|
|
4604
4655
|
const m = g.startsWith("#") ? g.replace("#", "") : "ffffff", y = parseInt(m.substring(0, 2), 16), v = parseInt(m.substring(2, 4), 16), b = parseInt(m.substring(4, 6), 16);
|
|
4605
4656
|
return `rgba(${y}, ${v}, ${b}, ${u})`;
|
|
4606
4657
|
};
|
|
4607
4658
|
if (s.type === "LinearGradient") {
|
|
4608
|
-
const l = (u, m, y) => Array.isArray(u) ? u[m] ?? (m === 0 ? 0 : 1) : u && typeof u == "object" ? u[y] ?? (m === 0 ? 0 : 1) : m === 0 ? 0 : 1,
|
|
4659
|
+
const l = (u, m, y) => Array.isArray(u) ? u[m] ?? (m === 0 ? 0 : 1) : u && typeof u == "object" ? u[y] ?? (m === 0 ? 0 : 1) : m === 0 ? 0 : 1, f = l(s.start, 0, "x") * o - o / 2, c = l(s.start, 1, "y") * e - e / 2, g = l(s.end, 0, "x") * o - o / 2, h = l(s.end, 1, "y") * e - e / 2, d = t.createLinearGradient(f, c, g, h);
|
|
4609
4660
|
if (s.stops.forEach((u) => {
|
|
4610
4661
|
const m = u.offset !== void 0 ? u.offset : u.pos !== void 0 ? u.pos : u.position !== void 0 ? u.position : 0, y = r(u.color || "#000000", u.opacity ?? 100);
|
|
4611
4662
|
d.addColorStop(Math.max(0, Math.min(1, m)), y);
|
|
@@ -4615,39 +4666,39 @@ class li {
|
|
|
4615
4666
|
}
|
|
4616
4667
|
return d;
|
|
4617
4668
|
} else if (s.type === "RadialGradient") {
|
|
4618
|
-
const l = (d, u, m) => Array.isArray(d) ? d[u] ?? 0.5 : d && typeof d == "object" ? d[m] ?? 0.5 : 0.5,
|
|
4669
|
+
const l = (d, u, m) => Array.isArray(d) ? d[u] ?? 0.5 : d && typeof d == "object" ? d[m] ?? 0.5 : 0.5, f = l(s.center, 0, "x") * o - o / 2, c = l(s.center, 1, "y") * e - e / 2, g = (s.radius ?? 0.5) * Math.max(o, e), h = t.createRadialGradient(f, c, 0, f, c, g);
|
|
4619
4670
|
if (s.stops.forEach((d) => {
|
|
4620
4671
|
const u = d.offset !== void 0 ? d.offset : d.pos !== void 0 ? d.pos : d.position !== void 0 ? d.position : 0, m = r(d.color || "#000000", d.opacity ?? 100);
|
|
4621
|
-
|
|
4622
|
-
}), s.gradientTransform &&
|
|
4672
|
+
h.addColorStop(Math.max(0, Math.min(1, u)), m);
|
|
4673
|
+
}), s.gradientTransform && h.setTransform) {
|
|
4623
4674
|
const [d, u, m, y, v, b] = s.gradientTransform;
|
|
4624
|
-
|
|
4675
|
+
h.setTransform({ a: d, b: u, c: m, d: y, e: v, f: b });
|
|
4625
4676
|
}
|
|
4626
|
-
return
|
|
4677
|
+
return h;
|
|
4627
4678
|
} else if (s.type === "AngularGradient") {
|
|
4628
|
-
const l = (d, u, m) => Array.isArray(d) ? d[u] ?? 0.5 : d && typeof d == "object" ? d[m] ?? 0.5 : 0.5,
|
|
4629
|
-
if (
|
|
4679
|
+
const l = (d, u, m) => Array.isArray(d) ? d[u] ?? 0.5 : d && typeof d == "object" ? d[m] ?? 0.5 : 0.5, f = l(s.center || [0.5, 0.5], 0, "x") * o - o / 2, c = l(s.center || [0.5, 0.5], 1, "y") * e - e / 2, g = (s.degree || s.angle || 0) * (Math.PI / 180), h = (a = t.createConicGradient) == null ? void 0 : a.call(t, g, f, c);
|
|
4680
|
+
if (h) {
|
|
4630
4681
|
if (s.stops.forEach((d) => {
|
|
4631
4682
|
const u = d.offset !== void 0 ? d.offset : d.pos !== void 0 ? d.pos : d.position !== void 0 ? d.position : 0, m = r(d.color || "#000000", d.opacity ?? 100);
|
|
4632
|
-
|
|
4633
|
-
}), s.gradientTransform &&
|
|
4683
|
+
h.addColorStop(Math.max(0, Math.min(1, u)), m);
|
|
4684
|
+
}), s.gradientTransform && h.setTransform) {
|
|
4634
4685
|
const [d, u, m, y, v, b] = s.gradientTransform;
|
|
4635
|
-
|
|
4686
|
+
h.setTransform({ a: d, b: u, c: m, d: y, e: v, f: b });
|
|
4636
4687
|
}
|
|
4637
|
-
return
|
|
4688
|
+
return h;
|
|
4638
4689
|
}
|
|
4639
4690
|
} else if (s.type === "DiamondGradient") {
|
|
4640
|
-
const l = (d, u, m) => Array.isArray(d) ? d[u] ?? 0.5 : d && typeof d == "object" ? d[m] ?? 0.5 : 0.5,
|
|
4641
|
-
t.save(), t.translate(
|
|
4642
|
-
const
|
|
4691
|
+
const l = (d, u, m) => Array.isArray(d) ? d[u] ?? 0.5 : d && typeof d == "object" ? d[m] ?? 0.5 : 0.5, f = l(s.center || [0.5, 0.5], 0, "x") * o - o / 2, c = l(s.center || [0.5, 0.5], 1, "y") * e - e / 2, g = (s.radius ?? 0.5) * Math.max(o, e);
|
|
4692
|
+
t.save(), t.translate(f, c), t.rotate(Math.PI / 4);
|
|
4693
|
+
const h = t.createRadialGradient(0, 0, 0, 0, 0, g);
|
|
4643
4694
|
if (s.stops.forEach((d) => {
|
|
4644
4695
|
const u = d.offset !== void 0 ? d.offset : d.pos !== void 0 ? d.pos : d.position !== void 0 ? d.position : 0, m = r(d.color || "#000000", d.opacity ?? 100);
|
|
4645
|
-
|
|
4646
|
-
}), s.gradientTransform &&
|
|
4696
|
+
h.addColorStop(Math.max(0, Math.min(1, u)), m);
|
|
4697
|
+
}), s.gradientTransform && h.setTransform) {
|
|
4647
4698
|
const [d, u, m, y, v, b] = s.gradientTransform;
|
|
4648
|
-
|
|
4699
|
+
h.setTransform({ a: d, b: u, c: m, d: y, e: v, f: b });
|
|
4649
4700
|
}
|
|
4650
|
-
return t.scale(1 / Math.SQRT2, 1 / Math.SQRT2), t.fillStyle =
|
|
4701
|
+
return t.scale(1 / Math.SQRT2, 1 / Math.SQRT2), t.fillStyle = h, t.restore(), h;
|
|
4651
4702
|
}
|
|
4652
4703
|
}
|
|
4653
4704
|
if (s.type === "Pattern" && s.url) {
|
|
@@ -4655,8 +4706,8 @@ class li {
|
|
|
4655
4706
|
if (r || (r = new Image(), r.src = s.url, this.imageCache.set(s.url, r)), r.complete && r.naturalWidth > 0) {
|
|
4656
4707
|
const l = t.createPattern(r, "repeat");
|
|
4657
4708
|
if (l && (s.scaleX !== void 0 || s.offsetX !== void 0)) {
|
|
4658
|
-
const
|
|
4659
|
-
|
|
4709
|
+
const f = new DOMMatrix(), c = s.scaleX ?? 1, g = s.scaleY ?? 1, h = s.offsetX ?? 0, d = s.offsetY ?? 0, u = s.rotation ?? 0;
|
|
4710
|
+
f.translateSelf(h, d), f.rotateSelf(u), f.scaleSelf(c, g), l.setTransform(f);
|
|
4660
4711
|
}
|
|
4661
4712
|
return l;
|
|
4662
4713
|
}
|
|
@@ -4675,21 +4726,21 @@ class li {
|
|
|
4675
4726
|
} catch {
|
|
4676
4727
|
a = parseFloat(a) || 0;
|
|
4677
4728
|
}
|
|
4678
|
-
let r = 0, l = 0,
|
|
4679
|
-
typeof a == "number" ? r = l =
|
|
4729
|
+
let r = 0, l = 0, f = 0, c = 0;
|
|
4730
|
+
typeof a == "number" ? r = l = f = c = a : Array.isArray(a) ? a.length === 1 ? r = l = f = c = a[0] : a.length === 2 ? (r = f = a[0], l = c = a[1]) : a.length === 3 ? (r = a[0], l = c = a[1], f = a[2]) : a.length >= 4 && (r = a[0], l = a[1], f = a[2], c = a[3]) : a && typeof a == "object" && (r = a.tl ?? a.corner_radius ?? a.cornerRadius ?? 0, l = a.tr ?? a.corner_radius ?? a.cornerRadius ?? 0, f = a.br ?? a.corner_radius ?? a.cornerRadius ?? 0, c = a.bl ?? a.corner_radius ?? a.cornerRadius ?? 0);
|
|
4680
4731
|
const g = Math.min(Math.abs(e) / 2, Math.abs(i) / 2);
|
|
4681
|
-
if (r = Math.min(Math.max(0, r), g), l = Math.min(Math.max(0, l), g),
|
|
4682
|
-
t.roundRect(s, o, e, i, [r, l,
|
|
4732
|
+
if (r = Math.min(Math.max(0, r), g), l = Math.min(Math.max(0, l), g), f = Math.min(Math.max(0, f), g), c = Math.min(Math.max(0, c), g), t.roundRect) {
|
|
4733
|
+
t.roundRect(s, o, e, i, [r, l, f, c]);
|
|
4683
4734
|
return;
|
|
4684
4735
|
}
|
|
4685
|
-
t.moveTo(s + r, o), t.lineTo(s + e - l, o), t.arcTo(s + e, o, s + e, o + l, l), t.lineTo(s + e, o + i -
|
|
4736
|
+
t.moveTo(s + r, o), t.lineTo(s + e - l, o), t.arcTo(s + e, o, s + e, o + l, l), t.lineTo(s + e, o + i - f), t.arcTo(s + e, o + i, s + e - f, o + i, f), t.lineTo(s + c, o + i), t.arcTo(s, o + i, s, o + i - c, c), t.lineTo(s, o + r), t.arcTo(s, o, s + r, o, r), t.closePath();
|
|
4686
4737
|
}
|
|
4687
4738
|
renderListView(t, s) {
|
|
4688
|
-
var L, x,
|
|
4689
|
-
const o = this.objectStates.get(s.id) || {}, e = o.options || s.options || {}, i = o.width !== void 0 ? o.width : ((L = s.geometry) == null ? void 0 : L.width) || 200, n = o.height !== void 0 ? o.height : ((x = s.geometry) == null ? void 0 : x.height) || 300, a = -i / 2, r = -n / 2, l = o.corner_radius !== void 0 ? o.corner_radius : e.corner_radius ?? 0,
|
|
4739
|
+
var L, x, A, $;
|
|
4740
|
+
const o = this.objectStates.get(s.id) || {}, e = o.options || s.options || {}, i = o.width !== void 0 ? o.width : ((L = s.geometry) == null ? void 0 : L.width) || 200, n = o.height !== void 0 ? o.height : ((x = s.geometry) == null ? void 0 : x.height) || 300, a = -i / 2, r = -n / 2, l = o.corner_radius !== void 0 ? o.corner_radius : e.corner_radius ?? 0, f = e.orientation || "vertical", c = e.items || [], g = e.itemGap ?? 10, h = e.itemHeight ?? 50, d = e.itemWidth ?? 200, u = e.scrollOffset ?? 0, m = e.padding ?? 0, y = e.glassEffect !== !1, v = e.accentColor || "#3b82f6", b = e.itemTextColor || "#333333", C = e.itemBackgroundColor || "#ffffff", S = e.hoveredIndex ?? null, I = e.activeItemIndex ?? null, w = e.glowIntensity ?? 0, M = e.glowColor || "#3b82f6", P = typeof M == "string" ? M : M.color || (($ = (A = M.stops) == null ? void 0 : A[0]) == null ? void 0 : $.color) || "#3b82f6", T = e.opacity !== void 0 ? e.opacity : s.opacity !== void 0 ? s.opacity : 1;
|
|
4690
4741
|
if (t.save(), t.globalAlpha *= T, w > 0) {
|
|
4691
4742
|
const O = t.getTransform(), V = Math.sqrt(O.a * O.a + O.b * O.b) || 1;
|
|
4692
|
-
t.shadowColor =
|
|
4743
|
+
t.shadowColor = P, t.shadowBlur = w * 2 * V, t.shadowOffsetX = 0, t.shadowOffsetY = 0;
|
|
4693
4744
|
}
|
|
4694
4745
|
if (y) {
|
|
4695
4746
|
const O = e.listBackgroundColor || "rgba(31, 41, 55, 0.4)", V = this.createCanvasFill(t, O, i, n);
|
|
@@ -4703,34 +4754,34 @@ class li {
|
|
|
4703
4754
|
H > 0 && (t.strokeStyle = e.borderColor || "#cccccc", t.lineWidth = H, this.drawListViewRect(t, a, r, i, n, l), t.stroke());
|
|
4704
4755
|
}
|
|
4705
4756
|
t.shadowBlur = 0, t.save(), this.drawListViewRect(t, a, r, i, n, l), t.clip();
|
|
4706
|
-
const W = typeof m == "number" ? m :
|
|
4707
|
-
let
|
|
4757
|
+
const W = typeof m == "number" ? m : f === "vertical" ? m[0] : m[3];
|
|
4758
|
+
let k = (f === "vertical" ? r : a) + u + W;
|
|
4708
4759
|
if (t.textBaseline = "middle", c.forEach((O, V) => {
|
|
4709
|
-
const H =
|
|
4760
|
+
const H = f === "vertical" ? i : d, et = f === "vertical" ? h : n, E = f === "vertical" ? a : k, F = f === "vertical" ? k : r, q = S === V, Q = I === V;
|
|
4710
4761
|
if (Q) {
|
|
4711
4762
|
const mt = this.createCanvasFill(t, v, H, et);
|
|
4712
4763
|
t.fillStyle = mt || v;
|
|
4713
4764
|
const rt = t.globalAlpha;
|
|
4714
|
-
t.globalAlpha = rt * 0.8, t.fillRect(
|
|
4765
|
+
t.globalAlpha = rt * 0.8, t.fillRect(E, F, H, et), t.globalAlpha = rt;
|
|
4715
4766
|
} else if (q)
|
|
4716
|
-
t.fillStyle = y ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.05)", t.fillRect(
|
|
4767
|
+
t.fillStyle = y ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.05)", t.fillRect(E, F, H, et);
|
|
4717
4768
|
else if (C !== "transparent") {
|
|
4718
4769
|
const mt = this.createCanvasFill(t, C, H, et);
|
|
4719
|
-
t.fillStyle = mt || C, t.fillRect(
|
|
4770
|
+
t.fillStyle = mt || C, t.fillRect(E, F, H, et);
|
|
4720
4771
|
}
|
|
4721
4772
|
if (Q || q) {
|
|
4722
|
-
const mt = this.createCanvasFill(t, v,
|
|
4723
|
-
t.fillStyle = mt || v,
|
|
4773
|
+
const mt = this.createCanvasFill(t, v, f === "vertical" ? 3 : H, f === "vertical" ? et : 3);
|
|
4774
|
+
t.fillStyle = mt || v, f === "vertical" ? t.fillRect(E, F, 3, et) : t.fillRect(E, F + et - 3, H, 3);
|
|
4724
4775
|
}
|
|
4725
4776
|
const it = Q ? "#ffffff" : y ? "rgba(255, 255, 255, 0.9)" : b;
|
|
4726
4777
|
t.fillStyle = it, t.font = Q || q ? "600 14px Inter, sans-serif" : "400 14px Inter, sans-serif";
|
|
4727
|
-
const dt = typeof O == "string" ? O : (O == null ? void 0 : O.label) || `Item ${V + 1}`, St =
|
|
4728
|
-
|
|
4778
|
+
const dt = typeof O == "string" ? O : (O == null ? void 0 : O.label) || `Item ${V + 1}`, St = E + (f === "vertical" ? 16 : H / 2), ht = F + et / 2;
|
|
4779
|
+
f === "horizontal" ? t.textAlign = "center" : t.textAlign = "left", t.fillText(dt, St, ht), k += (f === "vertical" ? h : d) + g;
|
|
4729
4780
|
}), t.restore(), e.showScrollbar !== !1) {
|
|
4730
|
-
const O = (c.length || 0) * (
|
|
4781
|
+
const O = (c.length || 0) * (f === "vertical" ? h : d) + ((c.length || 0) - 1) * g, V = f === "vertical" ? n : i;
|
|
4731
4782
|
if (O > V) {
|
|
4732
|
-
const H = V / O, et = V * H,
|
|
4733
|
-
t.fillStyle = F,
|
|
4783
|
+
const H = V / O, et = V * H, E = -u / O * V, F = e.scrollbarColor || "rgba(255,255,255,0.3)", q = e.scrollbarWidth || 4;
|
|
4784
|
+
t.fillStyle = F, f === "vertical" ? t.fillRect(a + i - q - 2, r + E, q, et) : t.fillRect(a + E, r + n - q - 2, et, q);
|
|
4734
4785
|
}
|
|
4735
4786
|
}
|
|
4736
4787
|
t.restore();
|
|
@@ -4740,7 +4791,7 @@ class li {
|
|
|
4740
4791
|
if (!this._lastPointerPos || !this._prevPointerPos) return;
|
|
4741
4792
|
const s = t.options || {}, o = s.orientation || "vertical", e = this._lastPointerPos.x - this._prevPointerPos.x, i = this._lastPointerPos.y - this._prevPointerPos.y;
|
|
4742
4793
|
o === "vertical" ? s.scrollOffset = (s.scrollOffset || 0) + i : s.scrollOffset = (s.scrollOffset || 0) + e;
|
|
4743
|
-
const n = this.objectStates.get(t.id) || {}, a = s.items || [], r = s.itemGap ?? 10, l = s.itemHeight ?? 50,
|
|
4794
|
+
const n = this.objectStates.get(t.id) || {}, a = s.items || [], r = s.itemGap ?? 10, l = s.itemHeight ?? 50, f = s.itemWidth ?? 200, c = n.width !== void 0 ? n.width : ((m = t.geometry) == null ? void 0 : m.width) || 200, g = n.height !== void 0 ? n.height : ((y = t.geometry) == null ? void 0 : y.height) || 300, h = (a.length || 0) * (o === "vertical" ? l : f) + ((a.length || 0) - 1) * r, u = Math.max(0, h - (o === "vertical" ? g : c) + (s.padding * 2 || 0));
|
|
4744
4795
|
s.scrollOffset > 0 && (s.scrollOffset = 0), s.scrollOffset < -u && (s.scrollOffset = -u);
|
|
4745
4796
|
}
|
|
4746
4797
|
updateListViewHoverFromPointer(t, s, o) {
|
|
@@ -4748,16 +4799,16 @@ class li {
|
|
|
4748
4799
|
i.hoveredIndex !== e && (i.hoveredIndex = e);
|
|
4749
4800
|
}
|
|
4750
4801
|
getListViewItemIndexAtPointer(t, s, o) {
|
|
4751
|
-
var W,
|
|
4802
|
+
var W, k;
|
|
4752
4803
|
const e = t.options || {}, i = this.objectStates.get(t.id) || {}, n = e.items || [];
|
|
4753
4804
|
if (n.length === 0) return null;
|
|
4754
|
-
const a = i.width !== void 0 ? i.width : ((W = t.geometry) == null ? void 0 : W.width) || 200, r = i.height !== void 0 ? i.height : ((
|
|
4755
|
-
let T = (l === "vertical" ?
|
|
4805
|
+
const a = i.width !== void 0 ? i.width : ((W = t.geometry) == null ? void 0 : W.width) || 200, r = i.height !== void 0 ? i.height : ((k = t.geometry) == null ? void 0 : k.height) || 300, l = e.orientation || "vertical", f = e.itemGap ?? 10, c = e.itemHeight ?? 50, g = e.itemWidth ?? 200, h = e.scrollOffset ?? 0, d = e.padding ?? 0, u = this.getWorldTransform(t.id), m = s - u.x, y = o - u.y, v = -u.rotation * (Math.PI / 180), b = Math.cos(v), C = Math.sin(v), S = m * b - y * C, I = m * C + y * b, w = -a / 2, M = -r / 2, P = typeof d == "number" ? d : l === "vertical" ? d[0] : d[3];
|
|
4806
|
+
let T = (l === "vertical" ? M : w) + h + P;
|
|
4756
4807
|
for (let _ = 0; _ < n.length; _++) {
|
|
4757
|
-
const L = l === "vertical" ? a : g, x = l === "vertical" ? c : r,
|
|
4758
|
-
if (S >=
|
|
4808
|
+
const L = l === "vertical" ? a : g, x = l === "vertical" ? c : r, A = l === "vertical" ? w : T, $ = l === "vertical" ? T : M;
|
|
4809
|
+
if (S >= A && S <= A + L && I >= $ && I <= $ + x)
|
|
4759
4810
|
return _;
|
|
4760
|
-
T += (l === "vertical" ? c : g) +
|
|
4811
|
+
T += (l === "vertical" ? c : g) + f;
|
|
4761
4812
|
}
|
|
4762
4813
|
return null;
|
|
4763
4814
|
}
|
|
@@ -4775,28 +4826,28 @@ class li {
|
|
|
4775
4826
|
if (!e.behaviors || e.behaviors.length === 0) return;
|
|
4776
4827
|
const i = this.objectStates.get(e.id);
|
|
4777
4828
|
i && e.behaviors.forEach((n) => {
|
|
4778
|
-
var g,
|
|
4829
|
+
var g, h, d, u, m, y, v, b, C, S, I, w, M, P, T, W, k, _, L, x, A, $, O, V, H, et, E, F, q, Q, it, dt, St, ht, mt, rt, Lt, Gt, Pt, Dt, Yt, B, lt, zt, Mt, Tt, Vt, Ut, Jt, qt, Qt, oe, jt, ee, J, ft, U, G, K, Z, At, Ot, kt, Nt, yt, R, ct, Xt, xt, te, $t, Wt, Ft, ot, It, bt, vt, gt, Rt, at, st, nt, wt, z, pt, ut, ce, me, Ie, we, Te, Ht, se, ue, Me, ke, fe, re, le, ye, _e, Ae, Oe, Pe, Re, Le, De, ze, Ve, Ne, He, Ue, qe, Je, Qe, Ke, Ze, je;
|
|
4779
4830
|
if (!n.enabled) return;
|
|
4780
4831
|
const a = n.startTime || 0, r = n.endTime || 1 / 0;
|
|
4781
4832
|
if (this.currentTime < a || this.currentTime > r) return;
|
|
4782
|
-
const l = i.x - s,
|
|
4833
|
+
const l = i.x - s, f = i.y - o, c = Math.sqrt(l * l + f * f);
|
|
4783
4834
|
if (this.frameCount % 240 === 0 && Math.random() < 0.1 && console.log(`[ExodeUI] Executing ${n.type} on ${e.name}`), n.type === Y.Proximity) {
|
|
4784
|
-
const X = ((g = n.settings) == null ? void 0 : g.radius) || 300, N = ((
|
|
4835
|
+
const X = ((g = n.settings) == null ? void 0 : g.radius) || 300, N = ((h = n.settings) == null ? void 0 : h.falloff) || "smooth";
|
|
4785
4836
|
let D = 0;
|
|
4786
4837
|
c < X && (N === "linear" ? D = 1 - c / X : D = Math.pow(1 - c / X, 2)), n.sensors.forEach((j) => {
|
|
4787
|
-
this.applyBehaviorSensor(i, j, D, t, n.settings, e, l,
|
|
4838
|
+
this.applyBehaviorSensor(i, j, D, t, n.settings, e, l, f, c);
|
|
4788
4839
|
});
|
|
4789
4840
|
} else if (n.type === Y.Magnetic) {
|
|
4790
4841
|
const X = ((d = n.settings) == null ? void 0 : d.radius) || 400, N = ((u = n.settings) == null ? void 0 : u.strength) || 0.5;
|
|
4791
4842
|
if (c < X && c > 5) {
|
|
4792
|
-
const D = 1 - c / X, j = l * D * N, _t =
|
|
4843
|
+
const D = 1 - c / X, j = l * D * N, _t = f * D * N;
|
|
4793
4844
|
i.x -= j * t * 10, i.y -= _t * t * 10;
|
|
4794
4845
|
}
|
|
4795
4846
|
} else if (n.type === Y.Repel) {
|
|
4796
4847
|
const X = ((m = n.settings) == null ? void 0 : m.radius) || 300, N = ((y = n.settings) == null ? void 0 : y.strength) || 1;
|
|
4797
4848
|
if (c < X) {
|
|
4798
4849
|
const D = Math.pow(1 - c / X, 2);
|
|
4799
|
-
i.x += l / (c || 1) * D * 60 * N * t * 5, i.y +=
|
|
4850
|
+
i.x += l / (c || 1) * D * 60 * N * t * 5, i.y += f / (c || 1) * D * 60 * N * t * 5;
|
|
4800
4851
|
}
|
|
4801
4852
|
} else if (n.type === Y.Orbit) {
|
|
4802
4853
|
const X = ((v = n.settings) == null ? void 0 : v.speed) || 1, N = ((b = n.settings) == null ? void 0 : b.radius) || 30, D = this.currentTime * X * Math.PI * 2;
|
|
@@ -4804,17 +4855,17 @@ class li {
|
|
|
4804
4855
|
} else if (n.type === Y.Vortex) {
|
|
4805
4856
|
const X = ((C = n.settings) == null ? void 0 : C.radius) || 400, N = ((S = n.settings) == null ? void 0 : S.speed) || 2, D = ((I = n.settings) == null ? void 0 : I.strength) || 1;
|
|
4806
4857
|
if (c < X) {
|
|
4807
|
-
const j = Math.pow(1 - c / X, 1.5), _t = this.currentTime * N * Math.PI * 2, Et = Math.cos(_t) * 30 - l * 0.4, Bt = Math.sin(_t) * 30 -
|
|
4858
|
+
const j = Math.pow(1 - c / X, 1.5), _t = this.currentTime * N * Math.PI * 2, Et = Math.cos(_t) * 30 - l * 0.4, Bt = Math.sin(_t) * 30 - f * 0.4;
|
|
4808
4859
|
i.x += Et * j * D * t * 5, i.y += Bt * j * D * t * 5, i.rotation += 5 * j * D * t * 5, i.scale_x *= 1 - j * 0.1 * D * t, i.scale_y *= 1 - j * 0.1 * D * t;
|
|
4809
4860
|
}
|
|
4810
4861
|
} else if (n.type === Y.Fluid) {
|
|
4811
|
-
const X = ((w = n.settings) == null ? void 0 : w.radius) || 300, N = ((
|
|
4862
|
+
const X = ((w = n.settings) == null ? void 0 : w.radius) || 300, N = ((M = n.settings) == null ? void 0 : M.strength) || 1;
|
|
4812
4863
|
if (c < X) {
|
|
4813
|
-
const D = Math.pow(1 - c / X, 1.2), j = l / (c || 1) * D * 1.2 * N, _t =
|
|
4864
|
+
const D = Math.pow(1 - c / X, 1.2), j = l / (c || 1) * D * 1.2 * N, _t = f / (c || 1) * D * 1.2 * N;
|
|
4814
4865
|
i.x += j * 10 * t * 5, i.y += _t * 10 * t * 5, i.scale_x *= 1 + D * 0.3 * N * t, i.scale_y *= 1 + D * 0.3 * N * t;
|
|
4815
4866
|
}
|
|
4816
4867
|
} else if (n.type === Y.Elastic) {
|
|
4817
|
-
const X = ((
|
|
4868
|
+
const X = ((P = n.settings) == null ? void 0 : P.radius) || 300, N = ((T = n.settings) == null ? void 0 : T.strength) || 1;
|
|
4818
4869
|
if (c < X) {
|
|
4819
4870
|
const D = 1 - c / X;
|
|
4820
4871
|
i.scale_x *= 1 + D * 0.4 * N * t, i.scale_y *= 1 + D * 0.4 * N * t;
|
|
@@ -4826,10 +4877,10 @@ class li {
|
|
|
4826
4877
|
i.style.exposure = (i.style.exposure || 1) + j * 0.5 * t;
|
|
4827
4878
|
}
|
|
4828
4879
|
} else if (n.type === Y.Sticky) {
|
|
4829
|
-
const X = ((
|
|
4880
|
+
const X = ((k = n.settings) == null ? void 0 : k.radius) || 80, N = ((_ = n.settings) == null ? void 0 : _.strength) || 1;
|
|
4830
4881
|
if (c < X) {
|
|
4831
4882
|
const D = Math.pow(1 - c / X, 2);
|
|
4832
|
-
i.x -= l * D * N * t * 10, i.y -=
|
|
4883
|
+
i.x -= l * D * N * t * 10, i.y -= f * D * N * t * 10, i.scale_x *= 1 - D * 0.1 * N * t, i.scale_y *= 1 - D * 0.1 * N * t;
|
|
4833
4884
|
}
|
|
4834
4885
|
} else if (n.type === Y.Dilation) {
|
|
4835
4886
|
const X = ((L = n.settings) == null ? void 0 : L.size) || 120, N = ((x = n.settings) == null ? void 0 : x.strength) || 1;
|
|
@@ -4838,11 +4889,11 @@ class li {
|
|
|
4838
4889
|
i.scale_x *= 1 + D * 0.5 * N * t, i.scale_y *= 1 + D * 0.5 * N * t;
|
|
4839
4890
|
}
|
|
4840
4891
|
} else if (n.type === Y.Parallax) {
|
|
4841
|
-
const X = ((
|
|
4842
|
-
i.x = this.lerp(i.x ?? ((
|
|
4892
|
+
const X = ((A = n.settings) == null ? void 0 : A.factor) || 15, N = (($ = n.settings) == null ? void 0 : $.strength) || 1, D = this.canvasWidth / 2, j = this.canvasHeight / 2, _t = this._lastPointerPos || { x: D, y: j }, Et = (_t.x - D) / D, Bt = (_t.y - j) / j, Zt = (((O = e.transform) == null ? void 0 : O.x) ?? 0) + Et * X * N, he = (((V = e.transform) == null ? void 0 : V.y) ?? 0) + Bt * X * N, be = (((H = e.transform) == null ? void 0 : H.rotate_x) ?? 0) - Bt * X * 1.5 * N, ie = (((et = e.transform) == null ? void 0 : et.rotate_y) ?? 0) + Et * X * 1.5 * N, pe = Math.min(1, 10 * t);
|
|
4893
|
+
i.x = this.lerp(i.x ?? ((E = e.transform) == null ? void 0 : E.x) ?? 0, Zt, pe), i.y = this.lerp(i.y ?? ((F = e.transform) == null ? void 0 : F.y) ?? 0, he, pe), i.rotate_x = this.lerp(i.rotate_x ?? ((q = e.transform) == null ? void 0 : q.rotate_x) ?? 0, be, pe), i.rotate_y = this.lerp(i.rotate_y ?? ((Q = e.transform) == null ? void 0 : Q.rotate_y) ?? 0, ie, pe);
|
|
4843
4894
|
} else if (n.type === Y.Fold) {
|
|
4844
4895
|
if (c < 300) {
|
|
4845
|
-
const X = 1 - c / 300, N = (l > 0 ? -1 : 1) * X * 10, D = 1 - X * 0.1, j =
|
|
4896
|
+
const X = 1 - c / 300, N = (l > 0 ? -1 : 1) * X * 10, D = 1 - X * 0.1, j = f / 300 * X * 20, _t = -(l / 300) * X * 20, Et = Math.min(1, 10 * t);
|
|
4846
4897
|
i.skew_x = this.lerp(i.skew_x ?? ((it = e.transform) == null ? void 0 : it.skew_x) ?? 0, N, Et), i.scale_y = this.lerp(i.scale_y ?? ((dt = e.transform) == null ? void 0 : dt.scale_y) ?? 1, (((St = e.transform) == null ? void 0 : St.scale_y) ?? 1) * D, Et), i.rotate_x = this.lerp(i.rotate_x ?? ((ht = e.transform) == null ? void 0 : ht.rotate_x) ?? 0, j, Et), i.rotate_y = this.lerp(i.rotate_y ?? ((mt = e.transform) == null ? void 0 : mt.rotate_y) ?? 0, _t, Et), i.style = i.style || { ...e.style }, i.style.artEffect = { enabled: !0, type: "fold_overlay", intensity: ((rt = n.settings) == null ? void 0 : rt.opacity) ?? 0.5 };
|
|
4847
4898
|
}
|
|
4848
4899
|
} else if (n.type === Y.Crumple) {
|
|
@@ -4869,7 +4920,7 @@ class li {
|
|
|
4869
4920
|
} else
|
|
4870
4921
|
(Z = i.style) != null && Z.adjustments && (i.style.adjustments.exposure = this.lerp(i.style.adjustments.exposure || 0, ((Ot = (At = e.style) == null ? void 0 : At.adjustments) == null ? void 0 : Ot.exposure) || 0, 0.1));
|
|
4871
4922
|
} else if (n.type === Y.Noise || n.type === Y.Float) {
|
|
4872
|
-
const X = (((kt = n.settings) == null ? void 0 : kt.frequency) || ((Nt = n.settings) == null ? void 0 : Nt.speed) || 1) * 2e-3, N = (((yt = n.settings) == null ? void 0 : yt.amplitude) || ((
|
|
4923
|
+
const X = (((kt = n.settings) == null ? void 0 : kt.frequency) || ((Nt = n.settings) == null ? void 0 : Nt.speed) || 1) * 2e-3, N = (((yt = n.settings) == null ? void 0 : yt.amplitude) || ((R = n.settings) == null ? void 0 : R.range) || 50) * (((ct = n.settings) == null ? void 0 : ct.strength) || 1), D = Date.now();
|
|
4873
4924
|
i.x += Math.sin(D * X) * N * t, i.y += Math.cos(D * X * 0.8) * N * t, i.rotation += Math.sin(D * X * 0.5) * 5 * t;
|
|
4874
4925
|
} else if (n.type === Y.Pulse) {
|
|
4875
4926
|
const X = (((Xt = n.settings) == null ? void 0 : Xt.speed) || 1) * 5e-3, N = (((xt = n.settings) == null ? void 0 : xt.scale) || 1.2) - 1, D = Math.sin(Date.now() * X), j = ((te = n.settings) == null ? void 0 : te.strength) || 1;
|
|
@@ -4884,7 +4935,7 @@ class li {
|
|
|
4884
4935
|
const X = ((Ft = n.settings) == null ? void 0 : Ft.axis) || "vertical", N = ((ot = n.settings) == null ? void 0 : ot.factor) || 0.5, D = ((It = n.settings) == null ? void 0 : It.strength) || 1, j = ((bt = n.settings) == null ? void 0 : bt.scaleFactor) || 0;
|
|
4885
4936
|
(X === "vertical" || X === "both") && (i.y += this.scrollOffset.y * N * D * t), (X === "horizontal" || X === "both") && (i.x += this.scrollOffset.x * N * D * t), j !== 0 && (i.scale_x *= 1 + this.scrollOffset.y * j * t, i.scale_y *= 1 + this.scrollOffset.y * j * t);
|
|
4886
4937
|
} else if (n.type === Y.LookAt) {
|
|
4887
|
-
const X = ((vt = n.settings) == null ? void 0 : vt.factor) || 1, N = ((gt = n.settings) == null ? void 0 : gt.strength) || 1, D = Math.atan2(-
|
|
4938
|
+
const X = ((vt = n.settings) == null ? void 0 : vt.factor) || 1, N = ((gt = n.settings) == null ? void 0 : gt.strength) || 1, D = Math.atan2(-f, -l) * (180 / Math.PI), j = i.rotation, _t = (D - j + 180) % 360 - 180;
|
|
4888
4939
|
i.rotation += _t * X * N * t * 10;
|
|
4889
4940
|
} else if (n.type === Y.Scan) {
|
|
4890
4941
|
const X = (((Rt = n.settings) == null ? void 0 : Rt.speed) || 1) * 4e-3, N = ((at = n.settings) == null ? void 0 : at.strength) || 1, D = (Math.sin(Date.now() * X) + 1) / 2;
|
|
@@ -5064,88 +5115,88 @@ class li {
|
|
|
5064
5115
|
});
|
|
5065
5116
|
}
|
|
5066
5117
|
applyBehaviorSensor(t, s, o, e, i, n, a = 0, r = 0, l = 1) {
|
|
5067
|
-
var d, u, m, y, v, b, C, S, I, w,
|
|
5068
|
-
const
|
|
5118
|
+
var d, u, m, y, v, b, C, S, I, w, M, P, T, W, k, _, L, x, A, $, O, V, H, et;
|
|
5119
|
+
const f = (i == null ? void 0 : i.intensity) || (i == null ? void 0 : i.strength) || 1, c = Math.min(1, 15 * e), g = l > 0 ? a / l : 0, h = l > 0 ? r / l : 0;
|
|
5069
5120
|
switch (s) {
|
|
5070
5121
|
case Kt.Scale: {
|
|
5071
|
-
const
|
|
5072
|
-
t.scale_x = (t.scale_x ??
|
|
5122
|
+
const E = ((d = n == null ? void 0 : n.transform) == null ? void 0 : d.scale_x) ?? 1, F = ((u = n == null ? void 0 : n.transform) == null ? void 0 : u.scale_y) ?? 1, q = E * (1 + o * f * 0.4), Q = F * (1 + o * f * 0.4);
|
|
5123
|
+
t.scale_x = (t.scale_x ?? E) * (1 - c) + q * c, t.scale_y = (t.scale_y ?? F) * (1 - c) + Q * c;
|
|
5073
5124
|
break;
|
|
5074
5125
|
}
|
|
5075
5126
|
case Kt.Opacity: {
|
|
5076
|
-
const
|
|
5077
|
-
t.opacity = (t.opacity ??
|
|
5127
|
+
const E = ((m = n == null ? void 0 : n.transform) == null ? void 0 : m.opacity) ?? 100, F = Math.max(0, Math.min(100, E - o * f * 100));
|
|
5128
|
+
t.opacity = (t.opacity ?? E) * (1 - c) + F * c;
|
|
5078
5129
|
break;
|
|
5079
5130
|
}
|
|
5080
5131
|
case Kt.RotateZ: {
|
|
5081
|
-
const
|
|
5082
|
-
t.rotation = (t.rotation ??
|
|
5132
|
+
const E = ((y = n == null ? void 0 : n.transform) == null ? void 0 : y.rotation) ?? 0, F = E + o * f * 45;
|
|
5133
|
+
t.rotation = (t.rotation ?? E) * (1 - c) + F * c;
|
|
5083
5134
|
break;
|
|
5084
5135
|
}
|
|
5085
5136
|
case Kt.RotateX: {
|
|
5086
|
-
const
|
|
5087
|
-
t.rotate_x = (t.rotate_x ??
|
|
5137
|
+
const E = ((v = n == null ? void 0 : n.transform) == null ? void 0 : v.rotate_x) ?? 0, F = E - h * o * f * 60;
|
|
5138
|
+
t.rotate_x = (t.rotate_x ?? E) * (1 - c) + F * c;
|
|
5088
5139
|
break;
|
|
5089
5140
|
}
|
|
5090
5141
|
case Kt.RotateY: {
|
|
5091
|
-
const
|
|
5092
|
-
t.rotate_y = (t.rotate_y ??
|
|
5142
|
+
const E = ((b = n == null ? void 0 : n.transform) == null ? void 0 : b.rotate_y) ?? 0, F = E + g * o * f * 60;
|
|
5143
|
+
t.rotate_y = (t.rotate_y ?? E) * (1 - c) + F * c;
|
|
5093
5144
|
break;
|
|
5094
5145
|
}
|
|
5095
5146
|
case Kt.PositionX: {
|
|
5096
|
-
const
|
|
5097
|
-
t.x = (t.x ??
|
|
5147
|
+
const E = ((C = n == null ? void 0 : n.transform) == null ? void 0 : C.x) ?? 0, F = E - g * o * f * 40;
|
|
5148
|
+
t.x = (t.x ?? E) * (1 - c) + F * c;
|
|
5098
5149
|
break;
|
|
5099
5150
|
}
|
|
5100
5151
|
case Kt.PositionY: {
|
|
5101
|
-
const
|
|
5102
|
-
t.y = (t.y ??
|
|
5152
|
+
const E = ((S = n == null ? void 0 : n.transform) == null ? void 0 : S.y) ?? 0, F = E - h * o * f * 40;
|
|
5153
|
+
t.y = (t.y ?? E) * (1 - c) + F * c;
|
|
5103
5154
|
break;
|
|
5104
5155
|
}
|
|
5105
5156
|
case Kt.SkewX: {
|
|
5106
|
-
const
|
|
5107
|
-
t.skew_x = (t.skew_x ??
|
|
5157
|
+
const E = ((I = n == null ? void 0 : n.transform) == null ? void 0 : I.skew_x) ?? 0, F = E + g * o * f * 45;
|
|
5158
|
+
t.skew_x = (t.skew_x ?? E) * (1 - c) + F * c, t.skew_x > 85 && (t.skew_x = 85), t.skew_x < -85 && (t.skew_x = -85);
|
|
5108
5159
|
break;
|
|
5109
5160
|
}
|
|
5110
5161
|
case Kt.Blur: {
|
|
5111
5162
|
t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.blur || (t.style.blur = { ...(w = n == null ? void 0 : n.style) == null ? void 0 : w.blur });
|
|
5112
|
-
const
|
|
5113
|
-
t.style.blur.amount = (t.style.blur.amount ??
|
|
5163
|
+
const E = ((P = (M = n == null ? void 0 : n.style) == null ? void 0 : M.blur) == null ? void 0 : P.amount) || 0, F = E + o * ((i == null ? void 0 : i.blur) || 20) * f;
|
|
5164
|
+
t.style.blur.amount = (t.style.blur.amount ?? E) * (1 - c) + F * c;
|
|
5114
5165
|
break;
|
|
5115
5166
|
}
|
|
5116
5167
|
case Kt.Exposure: {
|
|
5117
5168
|
t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.adjustments || (t.style.adjustments = { ...(T = n == null ? void 0 : n.style) == null ? void 0 : T.adjustments });
|
|
5118
|
-
const
|
|
5119
|
-
t.style.adjustments.exposure = (t.style.adjustments.exposure ??
|
|
5169
|
+
const E = ((k = (W = n == null ? void 0 : n.style) == null ? void 0 : W.adjustments) == null ? void 0 : k.exposure) || 0, F = E + o * ((i == null ? void 0 : i.exposure) || 50) * f;
|
|
5170
|
+
t.style.adjustments.exposure = (t.style.adjustments.exposure ?? E) * (1 - c) + F * c;
|
|
5120
5171
|
break;
|
|
5121
5172
|
}
|
|
5122
5173
|
case Kt.HueShift: {
|
|
5123
5174
|
t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.adjustments || (t.style.adjustments = { ...(_ = n == null ? void 0 : n.style) == null ? void 0 : _.adjustments });
|
|
5124
|
-
const
|
|
5125
|
-
t.style.adjustments.hue = (t.style.adjustments.hue ??
|
|
5175
|
+
const E = ((x = (L = n == null ? void 0 : n.style) == null ? void 0 : L.adjustments) == null ? void 0 : x.hue) || 0, F = E + o * ((i == null ? void 0 : i.hue) || 180) * f;
|
|
5176
|
+
t.style.adjustments.hue = (t.style.adjustments.hue ?? E) * (1 - c) + F * c;
|
|
5126
5177
|
break;
|
|
5127
5178
|
}
|
|
5128
5179
|
case Kt.Negative: {
|
|
5129
|
-
t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.adjustments || (t.style.adjustments = { ...(
|
|
5130
|
-
const
|
|
5131
|
-
t.style.adjustments.negative = (t.style.adjustments.negative ??
|
|
5180
|
+
t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.adjustments || (t.style.adjustments = { ...(A = n == null ? void 0 : n.style) == null ? void 0 : A.adjustments });
|
|
5181
|
+
const E = ((O = ($ = n == null ? void 0 : n.style) == null ? void 0 : $.adjustments) == null ? void 0 : O.negative) || 0, F = E + o * ((i == null ? void 0 : i.negative) || 100) * f;
|
|
5182
|
+
t.style.adjustments.negative = (t.style.adjustments.negative ?? E) * (1 - c) + F * c;
|
|
5132
5183
|
break;
|
|
5133
5184
|
}
|
|
5134
5185
|
case Kt.CornerRadius: {
|
|
5135
|
-
const
|
|
5136
|
-
t.corner_radius = (t.corner_radius ??
|
|
5186
|
+
const E = ((V = n == null ? void 0 : n.transform) == null ? void 0 : V.corner_radius) || 0, F = E + o * f * 50;
|
|
5187
|
+
t.corner_radius = (t.corner_radius ?? E) * (1 - c) + F * c;
|
|
5137
5188
|
break;
|
|
5138
5189
|
}
|
|
5139
5190
|
case Kt.StrokeWidth: {
|
|
5140
5191
|
t.style || (t.style = { ...n == null ? void 0 : n.style });
|
|
5141
|
-
const
|
|
5142
|
-
t.style.borderWidth = (t.style.borderWidth ??
|
|
5192
|
+
const E = ((H = n == null ? void 0 : n.style) == null ? void 0 : H.borderWidth) || 0, F = E + o * f * 10;
|
|
5193
|
+
t.style.borderWidth = (t.style.borderWidth ?? E) * (1 - c) + F * c;
|
|
5143
5194
|
break;
|
|
5144
5195
|
}
|
|
5145
5196
|
case Kt.LetterSpacing: {
|
|
5146
5197
|
t.geometry || (t.geometry = {});
|
|
5147
|
-
const
|
|
5148
|
-
t.geometry.letterSpacing = (t.geometry.letterSpacing ??
|
|
5198
|
+
const E = ((et = n == null ? void 0 : n.geometry) == null ? void 0 : et.letterSpacing) || 0, F = E + o * f * 10;
|
|
5199
|
+
t.geometry.letterSpacing = (t.geometry.letterSpacing ?? E) * (1 - c) + F * c;
|
|
5149
5200
|
break;
|
|
5150
5201
|
}
|
|
5151
5202
|
}
|
|
@@ -5169,7 +5220,7 @@ class li {
|
|
|
5169
5220
|
for (let r = 0; r < i.length - 1; r++) {
|
|
5170
5221
|
const l = i[r];
|
|
5171
5222
|
if (n[l] === void 0 || n[l] === null) {
|
|
5172
|
-
const
|
|
5223
|
+
const f = s, c = i.slice(0, r + 1).reduce((g, h) => g == null ? void 0 : g[h], f);
|
|
5173
5224
|
n[l] = c !== void 0 ? { ...c } : {};
|
|
5174
5225
|
}
|
|
5175
5226
|
n = n[l];
|
|
@@ -5220,12 +5271,12 @@ class li {
|
|
|
5220
5271
|
return o;
|
|
5221
5272
|
}
|
|
5222
5273
|
renderFittedImage(t, s, o, e, i, n, a = "cover") {
|
|
5223
|
-
const r = s.naturalWidth, l = s.naturalHeight,
|
|
5224
|
-
let g = i,
|
|
5225
|
-
a === "cover" ?
|
|
5274
|
+
const r = s.naturalWidth, l = s.naturalHeight, f = r / l, c = i / n;
|
|
5275
|
+
let g = i, h = n, d = o, u = e;
|
|
5276
|
+
a === "cover" ? f > c ? (g = n * f, d = o - (g - i) / 2) : (h = i / f, u = e - (h - n) / 2) : a === "contain" && (f > c ? (h = i / f, u = e + (n - h) / 2) : (g = n * f, d = o + (i - g) / 2)), t.drawImage(s, d, u, g, h);
|
|
5226
5277
|
}
|
|
5227
5278
|
}
|
|
5228
|
-
const
|
|
5279
|
+
const yi = Cs(({
|
|
5229
5280
|
artboard: p,
|
|
5230
5281
|
src: t,
|
|
5231
5282
|
style: s,
|
|
@@ -5236,10 +5287,10 @@ const mi = Cs(({
|
|
|
5236
5287
|
onTrigger: a,
|
|
5237
5288
|
onInputUpdate: r,
|
|
5238
5289
|
onComponentChange: l,
|
|
5239
|
-
onToggle:
|
|
5290
|
+
onToggle: f,
|
|
5240
5291
|
onInputChange: c,
|
|
5241
5292
|
onInputFocus: g,
|
|
5242
|
-
onInputBlur:
|
|
5293
|
+
onInputBlur: h,
|
|
5243
5294
|
onLog: d,
|
|
5244
5295
|
onLogicUpdate: u,
|
|
5245
5296
|
onButtonClick: m,
|
|
@@ -5250,20 +5301,20 @@ const mi = Cs(({
|
|
|
5250
5301
|
scrollX: S,
|
|
5251
5302
|
mouseX: I,
|
|
5252
5303
|
mouseY: w,
|
|
5253
|
-
isMouseDown:
|
|
5254
|
-
inputs:
|
|
5304
|
+
isMouseDown: M,
|
|
5305
|
+
inputs: P,
|
|
5255
5306
|
interactive: T = !0,
|
|
5256
5307
|
onNavigation: W
|
|
5257
|
-
},
|
|
5258
|
-
const _ = ve(null), L = ve(new
|
|
5259
|
-
Ss(
|
|
5308
|
+
}, k) => {
|
|
5309
|
+
const _ = ve(null), L = ve(new ci()), x = ve(void 0), A = ve(0), $ = ve(null), O = ve(b), [, V] = ds(p || null), H = ve(!0);
|
|
5310
|
+
Ss(k, () => _.current), Se(() => (H.current = !0, () => {
|
|
5260
5311
|
H.current = !1, x.current && cancelAnimationFrame(x.current);
|
|
5261
5312
|
}), []), Se(() => {
|
|
5262
5313
|
L.current.setLayout(e, i);
|
|
5263
5314
|
}, [e, i]), Se(() => {
|
|
5264
|
-
const
|
|
5265
|
-
a &&
|
|
5266
|
-
}, [a, r, l,
|
|
5315
|
+
const E = L.current;
|
|
5316
|
+
a && E.setTriggerCallback(a), r && E.setInputUpdateCallback((F, q) => r({ [F]: q })), l && E.setComponentChangeCallback((F) => l(F)), f && E.setToggleCallback(f), c && E.setInputChangeCallback(c), g && E.setInputFocusCallback(g), h && E.setInputBlurCallback(h), d && E.setOnLogCallback((F) => d(F, "info")), u && E.setLogicUpdateCallback(u), m && E.setButtonClickCallback(m), y && E.setGraphPointClickCallback((F) => y(F.objectId, F)), W && E.setNavigationCallback(W);
|
|
5317
|
+
}, [a, r, l, f, c, g, h, d, u, m, y, W]), Se(() => {
|
|
5267
5318
|
(async () => {
|
|
5268
5319
|
let F = p;
|
|
5269
5320
|
if (t && !p)
|
|
@@ -5274,52 +5325,52 @@ const mi = Cs(({
|
|
|
5274
5325
|
}
|
|
5275
5326
|
if (F) {
|
|
5276
5327
|
const q = L.current, Q = F.id || F.name || "default";
|
|
5277
|
-
($.current !== Q || O.current !== b) && (q.load(F), $.current = Q, O.current = b, V(F),
|
|
5328
|
+
($.current !== Q || O.current !== b) && (q.load(F), $.current = Q, O.current = b, V(F), A.current = 0, q.advance(0)), n && n(q);
|
|
5278
5329
|
}
|
|
5279
5330
|
})();
|
|
5280
5331
|
}, [p == null ? void 0 : p.id, t, b]), Se(() => {
|
|
5281
|
-
const
|
|
5332
|
+
const E = (F) => {
|
|
5282
5333
|
if (!L.current || !H.current) return;
|
|
5283
5334
|
const q = L.current, Q = _.current;
|
|
5284
5335
|
if (!Q) return;
|
|
5285
5336
|
const it = Q.getContext("2d");
|
|
5286
5337
|
if (!it) return;
|
|
5287
5338
|
const dt = F / 1e3;
|
|
5288
|
-
|
|
5289
|
-
let St = dt -
|
|
5290
|
-
St > 0.1 && (St = 0.1),
|
|
5339
|
+
A.current === 0 && (A.current = dt);
|
|
5340
|
+
let St = dt - A.current;
|
|
5341
|
+
St > 0.1 && (St = 0.1), A.current = dt;
|
|
5291
5342
|
const ht = Q.getBoundingClientRect(), mt = window.devicePixelRatio || 1, rt = Math.round(ht.width * mt), Lt = Math.round(ht.height * mt);
|
|
5292
|
-
(Q.width !== rt || Q.height !== Lt) && (Q.width = rt, Q.height = Lt), o ? q.advance(St) : v !== void 0 && q.seek(v), q.render(it, Q.width, Q.height), x.current = requestAnimationFrame(
|
|
5343
|
+
(Q.width !== rt || Q.height !== Lt) && (Q.width = rt, Q.height = Lt), o ? q.advance(St) : v !== void 0 && q.seek(v), q.render(it, Q.width, Q.height), x.current = requestAnimationFrame(E);
|
|
5293
5344
|
};
|
|
5294
|
-
return x.current = requestAnimationFrame(
|
|
5345
|
+
return x.current = requestAnimationFrame(E), () => {
|
|
5295
5346
|
x.current && cancelAnimationFrame(x.current);
|
|
5296
5347
|
};
|
|
5297
5348
|
}, [o, v]), Se(() => {
|
|
5298
|
-
const
|
|
5299
|
-
C !== void 0 &&
|
|
5300
|
-
}, [C, S, I, w,
|
|
5301
|
-
const et = (
|
|
5349
|
+
const E = L.current;
|
|
5350
|
+
C !== void 0 && E.updateInput("scrollY", C), S !== void 0 && E.updateInput("scrollX", S), I !== void 0 && E.updateInput("mouseX", I), w !== void 0 && E.updateInput("mouseY", w), M !== void 0 && E.updateInput("isMouseDown", M), P && Object.entries(P).forEach(([F, q]) => E.updateInput(F, q));
|
|
5351
|
+
}, [C, S, I, w, M, P]);
|
|
5352
|
+
const et = (E, F) => {
|
|
5302
5353
|
if (!T || !_.current) return;
|
|
5303
|
-
const q = _.current, Q = q.getBoundingClientRect(), it =
|
|
5354
|
+
const q = _.current, Q = q.getBoundingClientRect(), it = E.clientX - Q.left, dt = E.clientY - Q.top, St = window.devicePixelRatio || 1;
|
|
5304
5355
|
L.current.handlePointerInput(F, it * St, dt * St, q.width, q.height);
|
|
5305
5356
|
};
|
|
5306
5357
|
return /* @__PURE__ */ Ce(
|
|
5307
5358
|
"canvas",
|
|
5308
5359
|
{
|
|
5309
5360
|
ref: _,
|
|
5310
|
-
onPointerDown: (
|
|
5361
|
+
onPointerDown: (E) => {
|
|
5311
5362
|
var F;
|
|
5312
|
-
et(
|
|
5363
|
+
et(E, "down"), (F = _.current) == null || F.focus();
|
|
5313
5364
|
},
|
|
5314
|
-
onPointerMove: (
|
|
5315
|
-
onPointerUp: (
|
|
5316
|
-
onPointerCancel: (
|
|
5317
|
-
onClick: (
|
|
5318
|
-
onWheel: (
|
|
5319
|
-
L.current.handleWheel(
|
|
5365
|
+
onPointerMove: (E) => et(E, "move"),
|
|
5366
|
+
onPointerUp: (E) => et(E, "up"),
|
|
5367
|
+
onPointerCancel: (E) => et(E, "up"),
|
|
5368
|
+
onClick: (E) => et(E, "click"),
|
|
5369
|
+
onWheel: (E) => {
|
|
5370
|
+
L.current.handleWheel(E.deltaX, E.deltaY);
|
|
5320
5371
|
},
|
|
5321
|
-
onKeyDown: (
|
|
5322
|
-
onContextMenu: (
|
|
5372
|
+
onKeyDown: (E) => L.current.handleKeyDown(E.nativeEvent),
|
|
5373
|
+
onContextMenu: (E) => E.preventDefault(),
|
|
5323
5374
|
tabIndex: 0,
|
|
5324
5375
|
style: {
|
|
5325
5376
|
...s,
|
|
@@ -5333,7 +5384,7 @@ const mi = Cs(({
|
|
|
5333
5384
|
}
|
|
5334
5385
|
);
|
|
5335
5386
|
});
|
|
5336
|
-
function
|
|
5387
|
+
function bi() {
|
|
5337
5388
|
const [p, t] = ds(null), s = ge((c, g) => {
|
|
5338
5389
|
p == null || p.setInputBool(c, g);
|
|
5339
5390
|
}, [p]), o = ge((c, g) => {
|
|
@@ -5348,9 +5399,9 @@ function yi() {
|
|
|
5348
5399
|
p == null || p.setInputStringArray(c, g);
|
|
5349
5400
|
}, [p]), r = ge((c, g) => {
|
|
5350
5401
|
p == null || p.updateObjectOptions(c, g);
|
|
5351
|
-
}, [p]), l = ge((c, g,
|
|
5352
|
-
p == null || p.updateConstraint(c, g,
|
|
5353
|
-
}, [p]),
|
|
5402
|
+
}, [p]), l = ge((c, g, h) => {
|
|
5403
|
+
p == null || p.updateConstraint(c, g, h);
|
|
5404
|
+
}, [p]), f = ge((c, g) => {
|
|
5354
5405
|
p == null || p.updateGraphData(c, g);
|
|
5355
5406
|
}, [p]);
|
|
5356
5407
|
return {
|
|
@@ -5364,11 +5415,11 @@ function yi() {
|
|
|
5364
5415
|
setInputNumberArray: n,
|
|
5365
5416
|
setInputStringArray: a,
|
|
5366
5417
|
updateConstraint: l,
|
|
5367
|
-
updateGraphData:
|
|
5418
|
+
updateGraphData: f,
|
|
5368
5419
|
updateObjectOptions: r
|
|
5369
5420
|
};
|
|
5370
5421
|
}
|
|
5371
|
-
const
|
|
5422
|
+
const vi = ({ artboard: p, config: t }) => {
|
|
5372
5423
|
const s = { ...p.seo, ...t }, o = s.enableSmartExtraction !== !1;
|
|
5373
5424
|
Se(() => {
|
|
5374
5425
|
const a = s.title || p.name;
|
|
@@ -5376,12 +5427,12 @@ const bi = ({ artboard: p, config: t }) => {
|
|
|
5376
5427
|
let r = s.description;
|
|
5377
5428
|
if (!r && o) {
|
|
5378
5429
|
const c = p.objects.filter((g) => {
|
|
5379
|
-
var
|
|
5380
|
-
return ((
|
|
5430
|
+
var h;
|
|
5431
|
+
return ((h = g.geometry) == null ? void 0 : h.type) === "Text";
|
|
5381
5432
|
}).sort(
|
|
5382
|
-
(g,
|
|
5433
|
+
(g, h) => {
|
|
5383
5434
|
var d, u;
|
|
5384
|
-
return (((d =
|
|
5435
|
+
return (((d = h.geometry.text) == null ? void 0 : d.length) || 0) - (((u = g.geometry.text) == null ? void 0 : u.length) || 0);
|
|
5385
5436
|
}
|
|
5386
5437
|
);
|
|
5387
5438
|
c.length > 0 && (r = c[0].geometry.text);
|
|
@@ -5391,20 +5442,20 @@ const bi = ({ artboard: p, config: t }) => {
|
|
|
5391
5442
|
l && e("property", "og:image", l), a && e("property", "og:title", a), e("property", "og:type", "website");
|
|
5392
5443
|
}, [s, p, o]);
|
|
5393
5444
|
const e = (a, r, l) => {
|
|
5394
|
-
let
|
|
5395
|
-
|
|
5445
|
+
let f = document.querySelector(`meta[${a}="${r}"]`);
|
|
5446
|
+
f || (f = document.createElement("meta"), f.setAttribute(a, r), document.head.appendChild(f)), f.setAttribute("content", l);
|
|
5396
5447
|
}, i = () => {
|
|
5397
5448
|
const a = [];
|
|
5398
|
-
return a.push(/* @__PURE__ */ Ce("h1", { children: s.title || p.name }, "artboard-title")), p.objects.forEach((l,
|
|
5449
|
+
return a.push(/* @__PURE__ */ Ce("h1", { children: s.title || p.name }, "artboard-title")), p.objects.forEach((l, f) => {
|
|
5399
5450
|
var c, g;
|
|
5400
5451
|
if (!(l.visible === !1 || l.isVisible === !1))
|
|
5401
5452
|
if (((c = l.geometry) == null ? void 0 : c.type) === "Text") {
|
|
5402
|
-
const
|
|
5403
|
-
|
|
5453
|
+
const h = l.geometry.text;
|
|
5454
|
+
h && (l.geometry.fontSize > 24 ? a.push(/* @__PURE__ */ Ce("h2", { children: h }, l.id || f)) : a.push(/* @__PURE__ */ Ce("p", { children: h }, l.id || f)));
|
|
5404
5455
|
} else if (((g = l.geometry) == null ? void 0 : g.type) === "Image") {
|
|
5405
|
-
const
|
|
5406
|
-
a.push(/* @__PURE__ */ Ce("img", { src:
|
|
5407
|
-
} else l.type === "Button" && a.push(/* @__PURE__ */ Ce("button", { children: l.name || "Button" }, l.id ||
|
|
5456
|
+
const h = l.geometry.src, d = l.altText || l.name || "Illustration";
|
|
5457
|
+
a.push(/* @__PURE__ */ Ce("img", { src: h, alt: d }, l.id || f));
|
|
5458
|
+
} else l.type === "Button" && a.push(/* @__PURE__ */ Ce("button", { children: l.name || "Button" }, l.id || f));
|
|
5408
5459
|
}), a;
|
|
5409
5460
|
}, n = s.jsonLd || {
|
|
5410
5461
|
"@context": "https://schema.org",
|
|
@@ -5437,17 +5488,17 @@ const bi = ({ artboard: p, config: t }) => {
|
|
|
5437
5488
|
]
|
|
5438
5489
|
}
|
|
5439
5490
|
);
|
|
5440
|
-
},
|
|
5441
|
-
version:
|
|
5442
|
-
},
|
|
5491
|
+
}, fi = "6.3.18", hi = {
|
|
5492
|
+
version: fi
|
|
5493
|
+
}, Ci = hi.version;
|
|
5443
5494
|
export {
|
|
5444
5495
|
Kt as BehaviorSensor,
|
|
5445
5496
|
Y as BehaviorType,
|
|
5446
5497
|
Ms as ConditionOp,
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
|
|
5498
|
+
vi as ExodeSEO,
|
|
5499
|
+
yi as ExodeUICanvas,
|
|
5500
|
+
ci as ExodeUIEngine,
|
|
5450
5501
|
Ct as LogicOp,
|
|
5451
|
-
|
|
5452
|
-
|
|
5502
|
+
Ci as VERSION,
|
|
5503
|
+
bi as useExodeUI
|
|
5453
5504
|
};
|