exodeui 6.3.13 → 6.3.14
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 +18 -18
- package/dist/index.mjs +901 -862
- package/dist/src/engine.d.ts +1 -0
- package/dist/src/types.d.ts +17 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ var ot = (h, t, s) => ke(h, typeof t != "symbol" ? t + "" : t, s);
|
|
|
4
4
|
import { jsx as Qt, jsxs as Me } from "react/jsx-runtime";
|
|
5
5
|
import { forwardRef as Te, useRef as Jt, useState as me, useImperativeHandle as xe, useEffect as Kt, useCallback as zt } from "react";
|
|
6
6
|
import { prepareWithSegments as ne, layoutWithLines as _e } from "@chenglou/pretext";
|
|
7
|
-
import
|
|
7
|
+
import Nt from "@dimforge/rapier2d-compat";
|
|
8
8
|
import * as Ee from "lz-string";
|
|
9
9
|
var D = /* @__PURE__ */ ((h) => (h.Proximity = "Proximity", h.Magnetic = "Magnetic", h.Repel = "Repel", h.Orbit = "Orbit", h.Vortex = "Vortex", h.Fluid = "Fluid", h.Elastic = "Elastic", h.Holographic = "Holographic", h.Sticky = "Sticky", h.Dilation = "Dilation", h.Parallax = "Parallax", h.Noise = "Noise", h.Float = "Float", h.Pulse = "Pulse", h.Draggable = "Draggable", h.Scroll = "Scroll", h.LookAt = "LookAt", h.Glint = "Glint", h.Scan = "Scan", h.Ratchet = "Ratchet", h.Jitter = "Jitter", h.Follower = "Follower", h.Wrap = "Wrap", h.Typewriter = "Typewriter", h.Scramble = "Scramble", h.Wave = "Wave", h.Bounce = "Bounce", h.TextTrail = "TextTrail", h.Reveal3D = "Reveal3D", h.RevealSlide = "RevealSlide", h.RevealBlur = "RevealBlur", h.TextLiquid = "TextLiquid", h.TextVortex = "TextVortex", h.TextExplosion = "TextExplosion", h.TextRain = "TextRain", h.TextGravity = "TextGravity", h.TextMatrix = "TextMatrix", h.TextNeon = "TextNeon", h.TextDissolve = "TextDissolve", h.TextOrganic = "TextOrganic", h.TextBreathe = "TextBreathe", h.TextSpin = "TextSpin", h.TextMagnet = "TextMagnet", h.TextPerspective = "TextPerspective", h.TextMirror = "TextMirror", h.TextFloral = "TextFloral", h.TextSmoke = "TextSmoke", h.TextVariable = "TextVariable", h.TextZing = "TextZing", h.TextElastic = "TextElastic", h.TextGlitch3D = "TextGlitch3D", h.GlitchText = "GlitchText", h.TextCounter = "TextCounter", h.Squash = "Squash", h.Spotlight = "Spotlight", h.Lens = "Lens", h.Gravity = "Gravity", h.Velocity = "Velocity", h.Shear = "Shear", h))(D || {}), Wt = /* @__PURE__ */ ((h) => (h.Scale = "Scale", h.Opacity = "Opacity", h.RotateZ = "RotateZ", h.RotateX = "RotateX", h.RotateY = "RotateY", h.PositionX = "PositionX", h.PositionY = "PositionY", h.SkewX = "SkewX", h.Blur = "Blur", h.Exposure = "Exposure", h.HueShift = "HueShift", h.Negative = "Negative", h.CornerRadius = "CornerRadius", h.StrokeWidth = "StrokeWidth", h.BoxShadow = "BoxShadow", h.FontSize = "FontSize", h.LetterSpacing = "LetterSpacing", h))(Wt || {}), Pe = /* @__PURE__ */ ((h) => (h.Equal = "Equal", h.NotEqual = "NotEqual", h.GreaterThan = "GreaterThan", h.LessThan = "LessThan", h.GreaterEqual = "GreaterEqual", h.LessEqual = "LessEqual", h.IsTrue = "IsTrue", h.IsFalse = "IsFalse", h))(Pe || {}), gt = /* @__PURE__ */ ((h) => (h.AND = "AND", h.OR = "OR", h.NOT = "NOT", h.XOR = "XOR", h.OBJECT = "OBJECT", h.PROPERTY = "PROPERTY", h.GET_PROPERTY = "GET_PROPERTY", h.SET_PROPERTY = "SET_PROPERTY", h.ADD = "ADD", h.SUB = "SUB", h.MUL = "MUL", h.DIV = "DIV", h.MOD = "MOD", h.POW = "POW", h.ABS = "ABS", h.ROUND = "ROUND", h.FLOOR = "FLOOR", h.CEIL = "CEIL", h.SIN = "SIN", h.COS = "COS", h.TAN = "TAN", h.CLAMP = "CLAMP", h.REMAP = "REMAP", h.EQ = "EQ", h.NEQ = "NEQ", h.GT = "GT", h.LT = "LT", h.GTE = "GTE", h.LTE = "LTE", h.IF_ELSE = "IF_ELSE", h.VALUE = "VALUE", h.INPUT = "INPUT", h.LOG = "LOG", h.SCROLL_X = "SCROLL_X", h.SCROLL_Y = "SCROLL_Y", h.MOUSE_X = "MOUSE_X", h.MOUSE_Y = "MOUSE_Y", h.IS_MOUSE_DOWN = "IS_MOUSE_DOWN", h.EFFECTOR = "EFFECTOR", h.MONITOR = "MONITOR", h.DELAY = "DELAY", h))(gt || {});
|
|
10
10
|
const Zt = /* @__PURE__ */ new Map();
|
|
@@ -20,14 +20,14 @@ function ye(h) {
|
|
|
20
20
|
width: a = 200,
|
|
21
21
|
letterSpacing: r = 0,
|
|
22
22
|
paragraphSpacing: c = 0,
|
|
23
|
-
paragraphIndent:
|
|
23
|
+
paragraphIndent: d = 0,
|
|
24
24
|
textCase: l = "none",
|
|
25
25
|
segments: f = [],
|
|
26
26
|
enableSegments: g = !1
|
|
27
27
|
} = h;
|
|
28
|
-
let
|
|
29
|
-
l === "uppercase" ?
|
|
30
|
-
const
|
|
28
|
+
let u = String(t || "");
|
|
29
|
+
l === "uppercase" ? u = u.toUpperCase() : l === "lowercase" ? u = u.toLowerCase() : l === "capitalize" && (u = u.replace(/\b\w/g, (x) => x.toUpperCase()));
|
|
30
|
+
const p = `${i} ${e} ${o}px "${s}", sans-serif`, m = `${u}|${p}|${r}|${c}|${d}|${g}|${JSON.stringify(f)}`;
|
|
31
31
|
let y = Zt.get(m);
|
|
32
32
|
const S = CanvasRenderingContext2D.prototype.measureText, b = function(x) {
|
|
33
33
|
const B = S.call(this, x);
|
|
@@ -44,7 +44,7 @@ function ye(h) {
|
|
|
44
44
|
const K = B.textCase || l || "none";
|
|
45
45
|
return K === "uppercase" ? F.toUpperCase() : K === "lowercase" ? F.toLowerCase() : K === "capitalize" ? F.replace(/\b\w/g, (tt) => tt.toUpperCase()) : F;
|
|
46
46
|
}).join("");
|
|
47
|
-
if (y = ne(x,
|
|
47
|
+
if (y = ne(x, p), y) {
|
|
48
48
|
let B = 0, F = o;
|
|
49
49
|
for (const K of f) {
|
|
50
50
|
let tt = K.text || "";
|
|
@@ -53,7 +53,7 @@ function ye(h) {
|
|
|
53
53
|
rt === "uppercase" ? tt = tt.toUpperCase() : rt === "lowercase" ? tt = tt.toLowerCase() : rt === "capitalize" && (tt = tt.replace(/\b\w/g, ($) => $.toUpperCase()));
|
|
54
54
|
const at = K.fontSize || o;
|
|
55
55
|
at > F && (F = at);
|
|
56
|
-
const
|
|
56
|
+
const V = `${K.fontStyle || i} ${K.fontWeight || e} ${at}px "${K.fontFamily || s}", sans-serif`, O = ne(tt, V);
|
|
57
57
|
if (O && O.widths)
|
|
58
58
|
for (let $ = 0; $ < O.widths.length; $++) {
|
|
59
59
|
const P = B + $;
|
|
@@ -73,7 +73,7 @@ function ye(h) {
|
|
|
73
73
|
y.fullText = x, y.maxFontSize = F;
|
|
74
74
|
}
|
|
75
75
|
} else
|
|
76
|
-
y = ne(
|
|
76
|
+
y = ne(u, p);
|
|
77
77
|
y && Zt.set(m, y);
|
|
78
78
|
} catch (x) {
|
|
79
79
|
return console.error("[ExodeUI] Pretext prepare failed:", x), { width: a, height: 0, lineCount: 0, lines: [] };
|
|
@@ -85,11 +85,11 @@ function ye(h) {
|
|
|
85
85
|
x && Zt.delete(x);
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
if (
|
|
89
|
-
const x = [...y.widths], B = y.fullText ||
|
|
88
|
+
if (d > 0 && y && y.widths && !y.indentApplied) {
|
|
89
|
+
const x = [...y.widths], B = y.fullText || u;
|
|
90
90
|
let F = !0;
|
|
91
91
|
for (let K = 0; K < B.length; K++)
|
|
92
|
-
F && x[K] !== void 0 && (x[K] +=
|
|
92
|
+
F && x[K] !== void 0 && (x[K] += d, F = !1), (B[K] === `
|
|
93
93
|
` || B[K] === "\r") && (F = !0, B[K] === "\r" && B[K + 1] === `
|
|
94
94
|
` && K++);
|
|
95
95
|
y = { ...y, widths: x, indentApplied: !0 };
|
|
@@ -97,36 +97,36 @@ function ye(h) {
|
|
|
97
97
|
if (!y) return { width: a, height: 0, lineCount: 0, lines: [] };
|
|
98
98
|
let v = n;
|
|
99
99
|
typeof v == "string" && (v = parseFloat(v)), v > 5 && o > 0 && (v = v / o), r !== 0 && (CanvasRenderingContext2D.prototype.measureText = b);
|
|
100
|
-
let
|
|
100
|
+
let w;
|
|
101
101
|
try {
|
|
102
102
|
const x = y.maxFontSize || o;
|
|
103
103
|
if (a >= 1e5) {
|
|
104
|
-
const B =
|
|
105
|
-
|
|
104
|
+
const B = u.split(/\r\n|\r|\n/);
|
|
105
|
+
w = {
|
|
106
106
|
lines: B.map((F) => ({ text: F, width: 0 })),
|
|
107
107
|
// Width will be measured below
|
|
108
108
|
height: B.length * (v * x),
|
|
109
109
|
lineCount: B.length
|
|
110
110
|
};
|
|
111
111
|
} else
|
|
112
|
-
|
|
112
|
+
w = _e(y, a, v * x);
|
|
113
113
|
} finally {
|
|
114
114
|
r !== 0 && (CanvasRenderingContext2D.prototype.measureText = S);
|
|
115
115
|
}
|
|
116
|
-
let k = (
|
|
117
|
-
if (c > 0 &&
|
|
116
|
+
let k = (w == null ? void 0 : w.height) !== void 0 && w.height > 0 ? w.height : (((A = w == null ? void 0 : w.lines) == null ? void 0 : A.length) || 0) * v * o;
|
|
117
|
+
if (c > 0 && w && w.lines && w.lines.length > 1) {
|
|
118
118
|
let x = 0;
|
|
119
119
|
const B = y.fullText || t;
|
|
120
|
-
for (let F = 0; F <
|
|
121
|
-
x +=
|
|
120
|
+
for (let F = 0; F < w.lines.length - 1; F++)
|
|
121
|
+
x += w.lines[F].text.length, (B[x] === `
|
|
122
122
|
` || B[x] === "\r") && (k += c, x++, B[x - 1] === "\r" && B[x] === `
|
|
123
123
|
` && x++);
|
|
124
124
|
}
|
|
125
125
|
return {
|
|
126
126
|
width: a,
|
|
127
127
|
height: k,
|
|
128
|
-
lineCount: (
|
|
129
|
-
lines: (
|
|
128
|
+
lineCount: (w == null ? void 0 : w.lineCount) || 0,
|
|
129
|
+
lines: (w == null ? void 0 : w.lines) || []
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
132
|
function re(h, t, s) {
|
|
@@ -139,13 +139,13 @@ function re(h, t, s) {
|
|
|
139
139
|
let n = t - (e.length - 1) * s, a = 0;
|
|
140
140
|
if (e.forEach((r, c) => {
|
|
141
141
|
if (r.endsWith("px")) {
|
|
142
|
-
const
|
|
143
|
-
i[c] =
|
|
142
|
+
const d = parseFloat(r);
|
|
143
|
+
i[c] = d, n -= d;
|
|
144
144
|
} else r.endsWith("fr") ? a += parseFloat(r) : r === "auto" && (i[c] = 100, n -= 100);
|
|
145
145
|
}), a > 0 && n > 0) {
|
|
146
146
|
const r = n / a;
|
|
147
|
-
e.forEach((c,
|
|
148
|
-
c.endsWith("fr") && (i[
|
|
147
|
+
e.forEach((c, d) => {
|
|
148
|
+
c.endsWith("fr") && (i[d] = r * parseFloat(c));
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
151
|
return i;
|
|
@@ -160,8 +160,8 @@ function le(h, t, s) {
|
|
|
160
160
|
}
|
|
161
161
|
function Oe(h, t, s) {
|
|
162
162
|
var rt, at;
|
|
163
|
-
const o = h.autoLayout, { direction: e, spacing: i, padding: n, align: a, wrap: r } = o, c = e === "vertical",
|
|
164
|
-
const O = s(
|
|
163
|
+
const o = h.autoLayout, { direction: e, spacing: i, padding: n, align: a, wrap: r } = o, c = e === "vertical", d = t.map((V) => {
|
|
164
|
+
const O = s(V.id), $ = V.geometry;
|
|
165
165
|
let P = (O == null ? void 0 : O.width) ?? $.width ?? 100, J = (O == null ? void 0 : O.height) ?? $.height ?? 100;
|
|
166
166
|
if ($.type === "Ellipse" || $.type === "Polygon" || $.type === "Star") {
|
|
167
167
|
const Z = (O == null ? void 0 : O.radius) ?? $.radius ?? (O == null ? void 0 : O.outer_radius) ?? $.outer_radius ?? 50;
|
|
@@ -182,50 +182,50 @@ function Oe(h, t, s) {
|
|
|
182
182
|
});
|
|
183
183
|
J = Z.height, $.width || (P = Z.width);
|
|
184
184
|
}
|
|
185
|
-
return P *=
|
|
185
|
+
return P *= V.transform.scale_x || 1, J *= V.transform.scale_y || 1, { id: V.id, w: P, h: J, original: V };
|
|
186
186
|
});
|
|
187
187
|
let l = h.width, f = h.height;
|
|
188
|
-
const g = ((rt = h.layoutProps) == null ? void 0 : rt.width) === "hug",
|
|
188
|
+
const g = ((rt = h.layoutProps) == null ? void 0 : rt.width) === "hug", u = ((at = h.layoutProps) == null ? void 0 : at.height) === "hug", p = [];
|
|
189
189
|
let m = [], y = 0, S = 0;
|
|
190
190
|
const b = l - n.left - n.right, v = f - n.top - n.bottom;
|
|
191
|
-
|
|
192
|
-
r && m.length > 0 && (c ? S + i +
|
|
193
|
-
}), m.length > 0 &&
|
|
194
|
-
const
|
|
191
|
+
d.forEach((V) => {
|
|
192
|
+
r && m.length > 0 && (c ? S + i + V.h > v : y + i + V.w > b) ? (p.push({ children: m, width: y, height: S }), m = [V], y = V.w, S = V.h) : (m.push(V), c ? (y = Math.max(y, V.w), S += (m.length > 1 ? i : 0) + V.h) : (y += (m.length > 1 ? i : 0) + V.w, S = Math.max(S, V.h)));
|
|
193
|
+
}), m.length > 0 && p.push({ children: m, width: y, height: S }), g && !c && (l = Math.max(...p.map((V) => V.width), 0) + n.left + n.right), u && c && (f = Math.max(...p.map((V) => V.height), 0) + n.top + n.bottom);
|
|
194
|
+
const w = [];
|
|
195
195
|
let k = n.left, A = n.top;
|
|
196
196
|
const x = a.toLowerCase(), B = x === "center" || x.endsWith("-center"), F = x.endsWith("-right"), K = x === "center" || x.startsWith("center-"), tt = x.startsWith("bottom-");
|
|
197
|
-
return
|
|
197
|
+
return p.forEach((V) => {
|
|
198
198
|
let O = k, $ = A;
|
|
199
|
-
c ? K ? $ = n.top + (f - n.top - n.bottom -
|
|
199
|
+
c ? K ? $ = n.top + (f - n.top - n.bottom - V.height) / 2 : tt && ($ = f - n.bottom - V.height) : B ? O = n.left + (l - n.left - n.right - V.width) / 2 : F && (O = l - n.right - V.width), V.children.forEach((P) => {
|
|
200
200
|
var H, it;
|
|
201
201
|
let J = O, Z = $;
|
|
202
|
-
c ? B ? J += (
|
|
203
|
-
const lt = ((H = P.original.layoutProps) == null ? void 0 : H.width) === "fill",
|
|
204
|
-
|
|
202
|
+
c ? B ? J += (V.width - P.w) / 2 : F && (J += V.width - P.w) : K ? Z += (V.height - P.h) / 2 : tt && (Z += V.height - P.h);
|
|
203
|
+
const lt = ((H = P.original.layoutProps) == null ? void 0 : H.width) === "fill", Y = ((it = P.original.layoutProps) == null ? void 0 : it.height) === "fill";
|
|
204
|
+
w.push({
|
|
205
205
|
id: P.id,
|
|
206
206
|
x: J + P.w / 2 - l / 2,
|
|
207
207
|
y: Z + P.h / 2 - f / 2,
|
|
208
|
-
width: lt && c ?
|
|
209
|
-
height:
|
|
208
|
+
width: lt && c ? V.width : void 0,
|
|
209
|
+
height: Y ? c ? void 0 : V.height : void 0
|
|
210
210
|
}), c ? $ += P.h + i : O += P.w + i;
|
|
211
|
-
}), c ? k +=
|
|
212
|
-
}), { frameWidth: g ? l : void 0, frameHeight:
|
|
211
|
+
}), c ? k += V.width + i : A += V.height + i;
|
|
212
|
+
}), { frameWidth: g ? l : void 0, frameHeight: u ? f : void 0, childUpdates: w };
|
|
213
213
|
}
|
|
214
214
|
function Ae(h, t, s) {
|
|
215
215
|
const o = h.autoLayout;
|
|
216
216
|
if (!o) return { childUpdates: [] };
|
|
217
217
|
const { gridColumns: e, gridRows: i, columnGap: n = 0, rowGap: a = 0, padding: r, align: c } = o;
|
|
218
|
-
let
|
|
219
|
-
const f =
|
|
218
|
+
let d = h.width, l = h.height;
|
|
219
|
+
const f = d - r.left - r.right, g = l - r.top - r.bottom, u = re(e || "1fr", f, n), p = re(i || "auto", g, a), m = u.length > 0 ? u.reduce((F, K) => F + K, 0) + (u.length - 1) * n : 0, y = p.length > 0 ? p.reduce((F, K) => F + K, 0) + (p.length - 1) * a : 0, S = c.toLowerCase(), b = S === "center" || S.endsWith("-center"), v = S.endsWith("-right"), w = S === "center" || S.startsWith("center-"), k = S.startsWith("bottom-");
|
|
220
220
|
let A = 0, x = 0;
|
|
221
|
-
b ? A = (f - m) / 2 : v && (A = f - m),
|
|
221
|
+
b ? A = (f - m) / 2 : v && (A = f - m), w ? x = (g - y) / 2 : k && (x = g - y);
|
|
222
222
|
const B = [];
|
|
223
223
|
return t.forEach((F, K) => {
|
|
224
224
|
var it, nt;
|
|
225
|
-
const tt = K %
|
|
226
|
-
rt >=
|
|
227
|
-
const at =
|
|
228
|
-
let O = r.left + A +
|
|
225
|
+
const tt = K % u.length || 0, rt = Math.floor(K / u.length) || 0;
|
|
226
|
+
rt >= p.length && p.push(100);
|
|
227
|
+
const at = u[tt], V = p[rt];
|
|
228
|
+
let O = r.left + A + u.slice(0, tt).reduce((ft, M) => ft + M + n, 0), $ = r.top + x + p.slice(0, rt).reduce((ft, M) => ft + M + a, 0);
|
|
229
229
|
const P = s(F.id), J = F.geometry;
|
|
230
230
|
let Z = (P == null ? void 0 : P.width) ?? J.width ?? 100, lt = (P == null ? void 0 : P.height) ?? J.height ?? 100;
|
|
231
231
|
if (J.type === "Ellipse" || J.type === "Polygon" || J.type === "Star") {
|
|
@@ -233,13 +233,13 @@ function Ae(h, t, s) {
|
|
|
233
233
|
Z = ft * 2, lt = ft * 2;
|
|
234
234
|
}
|
|
235
235
|
Z *= F.transform.scale_x || 1, lt *= F.transform.scale_y || 1;
|
|
236
|
-
let
|
|
237
|
-
b ?
|
|
236
|
+
let Y = O, H = $;
|
|
237
|
+
b ? Y += (at - Z) / 2 : v && (Y += at - Z), w ? H += (V - lt) / 2 : k && (H += V - lt), B.push({
|
|
238
238
|
id: F.id,
|
|
239
|
-
x:
|
|
239
|
+
x: Y + Z / 2 - d / 2,
|
|
240
240
|
y: H + lt / 2 - l / 2,
|
|
241
241
|
width: ((it = F.layoutProps) == null ? void 0 : it.width) === "fill" ? at : void 0,
|
|
242
|
-
height: ((nt = F.layoutProps) == null ? void 0 : nt.height) === "fill" ?
|
|
242
|
+
height: ((nt = F.layoutProps) == null ? void 0 : nt.height) === "fill" ? V : void 0
|
|
243
243
|
});
|
|
244
244
|
}), { childUpdates: B };
|
|
245
245
|
}
|
|
@@ -251,7 +251,7 @@ class Re {
|
|
|
251
251
|
ot(this, "initialized", !1);
|
|
252
252
|
}
|
|
253
253
|
async init(t) {
|
|
254
|
-
this.initialized || (await
|
|
254
|
+
this.initialized || (await Nt.init(), this.world = new Nt.World(new Nt.Vector2(t.x, t.y)), this.initialized = !0);
|
|
255
255
|
}
|
|
256
256
|
destroy() {
|
|
257
257
|
this.bodies.clear(), this.colliders.clear(), this.world && (this.world.free(), this.world = null), this.initialized = !1;
|
|
@@ -262,32 +262,32 @@ class Re {
|
|
|
262
262
|
return;
|
|
263
263
|
}
|
|
264
264
|
this.bodies.has(t.id) && this.removeBody(t.id);
|
|
265
|
-
const s = t.isStatic ?
|
|
265
|
+
const s = t.isStatic ? Nt.RigidBodyDesc.fixed() : Nt.RigidBodyDesc.dynamic();
|
|
266
266
|
s.setTranslation(t.x, t.y), t.rotation !== void 0 && s.setRotation(t.rotation);
|
|
267
267
|
const o = this.world.createRigidBody(s);
|
|
268
268
|
let e;
|
|
269
269
|
switch (t.type) {
|
|
270
270
|
case "Rectangle":
|
|
271
|
-
e =
|
|
271
|
+
e = Nt.ColliderDesc.cuboid(
|
|
272
272
|
t.width / 2,
|
|
273
273
|
t.height / 2
|
|
274
274
|
);
|
|
275
275
|
break;
|
|
276
276
|
case "Ellipse":
|
|
277
|
-
e =
|
|
277
|
+
e = Nt.ColliderDesc.ball(
|
|
278
278
|
Math.max(t.width, t.height) / 2
|
|
279
279
|
);
|
|
280
280
|
break;
|
|
281
281
|
case "Triangle":
|
|
282
282
|
case "Star":
|
|
283
283
|
case "Polygon":
|
|
284
|
-
e =
|
|
284
|
+
e = Nt.ColliderDesc.cuboid(
|
|
285
285
|
t.width / 2,
|
|
286
286
|
t.height / 2
|
|
287
287
|
);
|
|
288
288
|
break;
|
|
289
289
|
default:
|
|
290
|
-
e =
|
|
290
|
+
e = Nt.ColliderDesc.cuboid(
|
|
291
291
|
t.width / 2,
|
|
292
292
|
t.height / 2
|
|
293
293
|
);
|
|
@@ -327,7 +327,7 @@ class Re {
|
|
|
327
327
|
}
|
|
328
328
|
setPosition(t, s, o) {
|
|
329
329
|
const e = this.bodies.get(t);
|
|
330
|
-
e && e.setTranslation(new
|
|
330
|
+
e && e.setTranslation(new Nt.Vector2(s, o), !0);
|
|
331
331
|
}
|
|
332
332
|
setRotation(t, s) {
|
|
333
333
|
const o = this.bodies.get(t);
|
|
@@ -335,31 +335,31 @@ class Re {
|
|
|
335
335
|
}
|
|
336
336
|
setVelocity(t, s, o) {
|
|
337
337
|
const e = this.bodies.get(t);
|
|
338
|
-
e && e.setLinvel(new
|
|
338
|
+
e && e.setLinvel(new Nt.Vector2(s, o), !0);
|
|
339
339
|
}
|
|
340
340
|
applyForce(t, s, o) {
|
|
341
341
|
const e = this.bodies.get(t);
|
|
342
|
-
e && e.addForce(new
|
|
342
|
+
e && e.addForce(new Nt.Vector2(s, o), !0);
|
|
343
343
|
}
|
|
344
344
|
applyImpulse(t, s, o) {
|
|
345
345
|
const e = this.bodies.get(t);
|
|
346
|
-
e && e.applyImpulse(new
|
|
346
|
+
e && e.applyImpulse(new Nt.Vector2(s, o), !0);
|
|
347
347
|
}
|
|
348
348
|
}
|
|
349
|
-
const be = (h) => h, Fe = (h) => h > 0 ? 1 : 0, $e = (h) => h < 1 ? 0 : 1, ce = (h) => h * h, fe = (h) => h * (2 - h), he = (h) => h < 0.5 ? 2 * h * h : -1 + (4 - 2 * h) * h, Le = (h) => h * h * h, We = (h) => --h * h * h + 1, De = (h) => h < 0.5 ? 4 * h * h * h : (h - 1) * (2 * h - 2) * (2 * h - 2) + 1, Be = (h) => h * h * h * h,
|
|
349
|
+
const be = (h) => h, Fe = (h) => h > 0 ? 1 : 0, $e = (h) => h < 1 ? 0 : 1, ce = (h) => h * h, fe = (h) => h * (2 - h), he = (h) => h < 0.5 ? 2 * h * h : -1 + (4 - 2 * h) * h, Le = (h) => h * h * h, We = (h) => --h * h * h + 1, De = (h) => h < 0.5 ? 4 * h * h * h : (h - 1) * (2 * h - 2) * (2 * h - 2) + 1, Be = (h) => h * h * h * h, Ve = (h) => 1 - --h * h * h * h, Ne = (h) => h < 0.5 ? 8 * h * h * h * h : 1 - 8 * --h * h * h * h, Ye = (h) => h * h * h * h * h, Ge = (h) => 1 + --h * h * h * h * h, Xe = (h) => h < 0.5 ? 16 * h * h * h * h * h : 1 + 16 * --h * h * h * h * h, ze = (h) => 1 - Math.cos(h * Math.PI / 2), He = (h) => Math.sin(h * Math.PI / 2), Ue = (h) => -(Math.cos(Math.PI * h) - 1) / 2, qe = (h) => h === 0 ? 0 : Math.pow(2, 10 * (h - 1)), Je = (h) => h === 1 ? 1 : 1 - Math.pow(2, -10 * h), Qe = (h) => h === 0 ? 0 : h === 1 ? 1 : h < 0.5 ? Math.pow(2, 20 * h - 10) / 2 : (2 - Math.pow(2, -20 * h + 10)) / 2, Ke = (h) => 1 - Math.sqrt(1 - h * h), Ze = (h) => Math.sqrt(1 - --h * h), je = (h) => h < 0.5 ? (1 - Math.sqrt(1 - 4 * h * h)) / 2 : (Math.sqrt(1 - (-2 * h + 2) * (-2 * h + 2)) + 1) / 2, ie = 1.70158, te = ie * 1.525, ve = ie + 1, ts = (h) => ve * h * h * h - ie * h * h, es = (h) => 1 + ve * Math.pow(h - 1, 3) + ie * Math.pow(h - 1, 2), ss = (h) => h < 0.5 ? Math.pow(2 * h, 2) * ((te + 1) * 2 * h - te) / 2 : (Math.pow(2 * h - 2, 2) * ((te + 1) * (h * 2 - 2) + te) + 2) / 2, Se = 2 * Math.PI / 3, de = 2 * Math.PI / 4.5, is = (h) => h === 0 ? 0 : h === 1 ? 1 : -Math.pow(2, 10 * h - 10) * Math.sin((h * 10 - 10.75) * Se), ns = (h) => h === 0 ? 0 : h === 1 ? 1 : Math.pow(2, -10 * h) * Math.sin((h * 10 - 0.75) * Se) + 1, os = (h) => h === 0 ? 0 : h === 1 ? 1 : h < 0.5 ? -(Math.pow(2, 20 * h - 10) * Math.sin((20 * h - 11.125) * de)) / 2 : Math.pow(2, -20 * h + 10) * Math.sin((20 * h - 11.125) * de) / 2 + 1, se = (h) => h < 1 / 2.75 ? 7.5625 * h * h : h < 2 / 2.75 ? 7.5625 * (h -= 1.5 / 2.75) * h + 0.75 : h < 2.5 / 2.75 ? 7.5625 * (h -= 2.25 / 2.75) * h + 0.9375 : 7.5625 * (h -= 2.625 / 2.75) * h + 0.984375, as = (h) => 1 - se(1 - h), rs = se, ls = (h) => h < 0.5 ? (1 - se(1 - 2 * h)) / 2 : (1 + se(2 * h - 1)) / 2, oe = /* @__PURE__ */ new Map(), jt = (h, t, s, o) => {
|
|
350
350
|
const e = `${h},${t},${s},${o}`;
|
|
351
351
|
if (oe.has(e)) return oe.get(e);
|
|
352
|
-
const i = (
|
|
353
|
-
let l =
|
|
352
|
+
const i = (d) => (1 - 3 * s + 3 * h) * d * d * d + (3 * s - 6 * h) * d * d + 3 * h * d, n = (d) => (1 - 3 * o + 3 * t) * d * d * d + (3 * o - 6 * t) * d * d + 3 * t * d, a = (d) => 3 * (1 - 3 * s + 3 * h) * d * d + 2 * (3 * s - 6 * h) * d + 3 * h, r = (d) => {
|
|
353
|
+
let l = d;
|
|
354
354
|
for (let f = 0; f < 8; f++) {
|
|
355
|
-
const g = i(l) -
|
|
355
|
+
const g = i(l) - d;
|
|
356
356
|
if (Math.abs(g) < 1e-6) return l;
|
|
357
|
-
const
|
|
358
|
-
if (Math.abs(
|
|
359
|
-
l = l - g /
|
|
357
|
+
const u = a(l);
|
|
358
|
+
if (Math.abs(u) < 1e-6) break;
|
|
359
|
+
l = l - g / u;
|
|
360
360
|
}
|
|
361
361
|
return l;
|
|
362
|
-
}, c = (
|
|
362
|
+
}, c = (d) => d === 0 ? 0 : d === 1 ? 1 : n(r(d));
|
|
363
363
|
return oe.set(e, c), c;
|
|
364
364
|
}, ue = (h) => {
|
|
365
365
|
const t = h.match(/cubic-bezier\s*\(\s*([-?\d.]+)\s*,\s*([-?\d.]+)\s*,\s*([-?\d.]+)\s*,\s*([-?\d.]+)\s*\)/);
|
|
@@ -384,12 +384,12 @@ const be = (h) => h, Fe = (h) => h > 0 ? 1 : 0, $e = (h) => h < 1 ? 0 : 1, ce =
|
|
|
384
384
|
EaseInOutCubic: De,
|
|
385
385
|
// Quartic
|
|
386
386
|
EaseInQuart: Be,
|
|
387
|
-
EaseOutQuart:
|
|
388
|
-
EaseInOutQuart:
|
|
387
|
+
EaseOutQuart: Ve,
|
|
388
|
+
EaseInOutQuart: Ne,
|
|
389
389
|
// Quintic
|
|
390
|
-
EaseInQuint:
|
|
391
|
-
EaseOutQuint:
|
|
392
|
-
EaseInOutQuint:
|
|
390
|
+
EaseInQuint: Ye,
|
|
391
|
+
EaseOutQuint: Ge,
|
|
392
|
+
EaseInOutQuint: Xe,
|
|
393
393
|
// Sinusoidal
|
|
394
394
|
EaseInSine: ze,
|
|
395
395
|
EaseOutSine: He,
|
|
@@ -623,88 +623,88 @@ class fs {
|
|
|
623
623
|
}
|
|
624
624
|
svgPathToPoints(t) {
|
|
625
625
|
const s = /([MLHVCSQTAZmlhvcsqtaz])([^MLHVCSQTAZmlhvcsqtaz]*)/g, o = /[-+]?(?:\d*\.\d+|\d+)(?:[eE][-+]?\d+)?/g, e = [];
|
|
626
|
-
let i = !1, n = 0, a = 0, r = 0, c = 0,
|
|
626
|
+
let i = !1, n = 0, a = 0, r = 0, c = 0, d = 0, l = 0, f;
|
|
627
627
|
for (; (f = s.exec(t)) !== null; ) {
|
|
628
|
-
const g = f[1],
|
|
628
|
+
const g = f[1], u = (f[2].match(o) || []).map(parseFloat), p = g === g.toLowerCase(), m = g.toUpperCase();
|
|
629
629
|
let y = 0;
|
|
630
630
|
const S = (v) => {
|
|
631
|
-
let
|
|
632
|
-
return
|
|
631
|
+
let w = u[y++];
|
|
632
|
+
return p && (w += v ? n : a), w;
|
|
633
633
|
}, b = () => ({ x: S(!0), y: S(!1) });
|
|
634
634
|
switch (m) {
|
|
635
635
|
case "M": {
|
|
636
636
|
const v = b();
|
|
637
|
-
for (
|
|
638
|
-
const
|
|
639
|
-
n =
|
|
637
|
+
for (d = n = v.x, l = a = v.y, e.push({ x: n, y: a, in_x: n, in_y: a, out_x: n, out_y: a, moveTo: !0 }); y < u.length; ) {
|
|
638
|
+
const w = b();
|
|
639
|
+
n = w.x, a = w.y, e.push({ x: n, y: a, in_x: n, in_y: a, out_x: n, out_y: a });
|
|
640
640
|
}
|
|
641
641
|
break;
|
|
642
642
|
}
|
|
643
643
|
case "L":
|
|
644
|
-
for (; y <
|
|
644
|
+
for (; y < u.length; ) {
|
|
645
645
|
const v = b();
|
|
646
646
|
n = v.x, a = v.y, e.push({ x: n, y: a, in_x: n, in_y: a, out_x: n, out_y: a });
|
|
647
647
|
}
|
|
648
648
|
break;
|
|
649
649
|
case "H":
|
|
650
|
-
for (; y <
|
|
650
|
+
for (; y < u.length; )
|
|
651
651
|
n = S(!0), e.push({ x: n, y: a, in_x: n, in_y: a, out_x: n, out_y: a });
|
|
652
652
|
break;
|
|
653
653
|
case "V":
|
|
654
|
-
for (; y <
|
|
654
|
+
for (; y < u.length; )
|
|
655
655
|
a = S(!1), e.push({ x: n, y: a, in_x: n, in_y: a, out_x: n, out_y: a });
|
|
656
656
|
break;
|
|
657
657
|
case "C":
|
|
658
|
-
for (; y <
|
|
659
|
-
const v = b(),
|
|
658
|
+
for (; y < u.length; ) {
|
|
659
|
+
const v = b(), w = b(), k = b();
|
|
660
660
|
if (e.length > 0) {
|
|
661
661
|
const A = e[e.length - 1];
|
|
662
662
|
A.out_x = v.x, A.out_y = v.y;
|
|
663
663
|
}
|
|
664
|
-
n = k.x, a = k.y, e.push({ x: n, y: a, in_x:
|
|
664
|
+
n = k.x, a = k.y, e.push({ x: n, y: a, in_x: w.x, in_y: w.y, out_x: n, out_y: a }), r = w.x, c = w.y;
|
|
665
665
|
}
|
|
666
666
|
break;
|
|
667
667
|
case "S":
|
|
668
|
-
for (; y <
|
|
669
|
-
const v = { x: 2 * n - r, y: 2 * a - c },
|
|
668
|
+
for (; y < u.length; ) {
|
|
669
|
+
const v = { x: 2 * n - r, y: 2 * a - c }, w = b(), k = b();
|
|
670
670
|
if (e.length > 0) {
|
|
671
671
|
const A = e[e.length - 1];
|
|
672
672
|
A.out_x = v.x, A.out_y = v.y;
|
|
673
673
|
}
|
|
674
|
-
n = k.x, a = k.y, e.push({ x: n, y: a, in_x:
|
|
674
|
+
n = k.x, a = k.y, e.push({ x: n, y: a, in_x: w.x, in_y: w.y, out_x: n, out_y: a }), r = w.x, c = w.y;
|
|
675
675
|
}
|
|
676
676
|
break;
|
|
677
677
|
case "Q":
|
|
678
|
-
for (; y <
|
|
679
|
-
const v = b(),
|
|
678
|
+
for (; y < u.length; ) {
|
|
679
|
+
const v = b(), w = b();
|
|
680
680
|
if (e.length > 0) {
|
|
681
681
|
const k = e[e.length - 1];
|
|
682
682
|
k.out_x = k.x + 2 / 3 * (v.x - k.x), k.out_y = k.y + 2 / 3 * (v.y - k.y);
|
|
683
683
|
}
|
|
684
|
-
n =
|
|
684
|
+
n = w.x, a = w.y, e.push({ x: n, y: a, in_x: n + 2 / 3 * (v.x - n), in_y: a + 2 / 3 * (v.y - a), out_x: n, out_y: a }), r = v.x, c = v.y;
|
|
685
685
|
}
|
|
686
686
|
break;
|
|
687
687
|
case "T":
|
|
688
|
-
for (; y <
|
|
689
|
-
const v = { x: 2 * n - r, y: 2 * a - c },
|
|
688
|
+
for (; y < u.length; ) {
|
|
689
|
+
const v = { x: 2 * n - r, y: 2 * a - c }, w = b();
|
|
690
690
|
if (e.length > 0) {
|
|
691
691
|
const k = e[e.length - 1];
|
|
692
692
|
k.out_x = k.x + 2 / 3 * (v.x - k.x), k.out_y = k.y + 2 / 3 * (v.y - k.y);
|
|
693
693
|
}
|
|
694
|
-
n =
|
|
694
|
+
n = w.x, a = w.y, e.push({ x: n, y: a, in_x: n + 2 / 3 * (v.x - n), in_y: a + 2 / 3 * (v.y - a), out_x: n, out_y: a }), r = v.x, c = v.y;
|
|
695
695
|
}
|
|
696
696
|
break;
|
|
697
697
|
case "Z":
|
|
698
698
|
if (i = !0, e.length > 0) {
|
|
699
699
|
const v = e[e.length - 1];
|
|
700
700
|
v.closePath = !0;
|
|
701
|
-
const
|
|
702
|
-
|
|
701
|
+
const w = [...e].reverse().find((k) => k.moveTo) || e[0];
|
|
702
|
+
w && Math.hypot(w.x - v.x, w.y - v.y) < 0.1 && (w.in_x = v.in_x, w.in_y = v.in_y, e.pop(), e.length > 0 && (e[e.length - 1].closePath = !0));
|
|
703
703
|
}
|
|
704
|
-
n =
|
|
704
|
+
n = d, a = l;
|
|
705
705
|
break;
|
|
706
706
|
default:
|
|
707
|
-
if (
|
|
707
|
+
if (u.length >= 2) {
|
|
708
708
|
const v = b();
|
|
709
709
|
n = v.x, a = v.y, e.push({ x: n, y: a, in_x: n, in_y: a, out_x: n, out_y: a });
|
|
710
710
|
}
|
|
@@ -774,8 +774,8 @@ class fs {
|
|
|
774
774
|
const o = [], e = /* @__PURE__ */ new Set(), i = (r) => {
|
|
775
775
|
r && r.forEach((c) => {
|
|
776
776
|
if (e.has(c.id)) return;
|
|
777
|
-
const
|
|
778
|
-
e.add(
|
|
777
|
+
const d = { ...c }, l = d.childrenObjects || [];
|
|
778
|
+
e.add(d.id), o.push(d), i(l);
|
|
779
779
|
});
|
|
780
780
|
};
|
|
781
781
|
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) {
|
|
@@ -784,8 +784,8 @@ class fs {
|
|
|
784
784
|
r.set(c.id, c), c.children || (c.children = []);
|
|
785
785
|
}), this.artboard.objects.forEach((c) => {
|
|
786
786
|
if (c.parentId) {
|
|
787
|
-
const
|
|
788
|
-
|
|
787
|
+
const d = r.get(c.parentId);
|
|
788
|
+
d && (d.children || (d.children = []), d.children.includes(c.id) || d.children.push(c.id));
|
|
789
789
|
}
|
|
790
790
|
});
|
|
791
791
|
}
|
|
@@ -835,11 +835,11 @@ class fs {
|
|
|
835
835
|
reset() {
|
|
836
836
|
if (!this.artboard) return;
|
|
837
837
|
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.artboard.objects.forEach((s) => {
|
|
838
|
-
var n, a, r, c,
|
|
838
|
+
var n, a, r, c, d, l, f;
|
|
839
839
|
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) ?? ((c = s.geometry) == null ? void 0 : c.cornerRadius) ?? 0;
|
|
840
840
|
this.objectStates.set(s.id, {
|
|
841
841
|
...s.transform || {},
|
|
842
|
-
x: ((
|
|
842
|
+
x: ((d = s.transform) == null ? void 0 : d.x) ?? s.x ?? 0,
|
|
843
843
|
y: ((l = s.transform) == null ? void 0 : l.y) ?? s.y ?? 0,
|
|
844
844
|
width: o,
|
|
845
845
|
height: e,
|
|
@@ -932,9 +932,9 @@ class fs {
|
|
|
932
932
|
this.artboard.objects.forEach((i) => {
|
|
933
933
|
var n;
|
|
934
934
|
if (i.type === "Frame" && ((n = i.autoLayout) != null && n.enabled) && i.children && i.children.length > 0) {
|
|
935
|
-
const a = i.children.map((
|
|
935
|
+
const a = i.children.map((d) => t.get(d)).filter((d) => !!d), r = this.objectStates.get(i.id);
|
|
936
936
|
if (!r) return;
|
|
937
|
-
const c = le(r, a, (
|
|
937
|
+
const c = le(r, a, (d) => this.objectStates.get(d));
|
|
938
938
|
c.frameWidth !== void 0 && (r.width = c.frameWidth), c.frameHeight !== void 0 && (r.height = c.frameHeight), o(c.childUpdates);
|
|
939
939
|
}
|
|
940
940
|
});
|
|
@@ -986,15 +986,15 @@ class fs {
|
|
|
986
986
|
const a = this.activeStateMachine.layers.find((r) => r.name === t);
|
|
987
987
|
if (a)
|
|
988
988
|
for (const r of s) {
|
|
989
|
-
const c = a.states.find((
|
|
989
|
+
const c = a.states.find((d) => d.id === r);
|
|
990
990
|
if (c) {
|
|
991
|
-
let
|
|
992
|
-
c.animationId && (
|
|
991
|
+
let d = null;
|
|
992
|
+
c.animationId && (d = this.artboard.animations.find((l) => l.id === c.animationId) || null), d || (d = this.artboard.animations.find(
|
|
993
993
|
(l) => {
|
|
994
994
|
var f, g;
|
|
995
995
|
return l.name === c.name || l.id === c.name || (c.name === "Entry" || c.id === "entry") && (((f = l.name) == null ? void 0 : f.toLowerCase()) === "onload" || ((g = l.name) == null ? void 0 : g.toLowerCase()) === "intro");
|
|
996
996
|
}
|
|
997
|
-
) || null),
|
|
997
|
+
) || null), d && ((n = this.artboard.animationFlow) != null && n.some((f) => (f.trigger === "on_load" || f.trigger === "after_delay") && f.targetAnimationId === (d == null ? void 0 : d.id)) || (e.push({ animation: d, state: c }), i = Math.max(i, d.duration)));
|
|
998
998
|
}
|
|
999
999
|
}
|
|
1000
1000
|
}
|
|
@@ -1040,13 +1040,13 @@ class fs {
|
|
|
1040
1040
|
var n, a, r;
|
|
1041
1041
|
let o;
|
|
1042
1042
|
if (this.inputs.has(t)) {
|
|
1043
|
-
const c = (n = this.activeStateMachine) == null ? void 0 : n.inputs.find((
|
|
1043
|
+
const c = (n = this.activeStateMachine) == null ? void 0 : n.inputs.find((d) => d.id === t);
|
|
1044
1044
|
c && typeof c.value == "object" && (o = c.value.type);
|
|
1045
1045
|
} else {
|
|
1046
1046
|
const c = this.inputNameMap.get(t);
|
|
1047
1047
|
if (c && c.length > 0) {
|
|
1048
|
-
const
|
|
1049
|
-
|
|
1048
|
+
const d = (a = this.activeStateMachine) == null ? void 0 : a.inputs.find((l) => l.id === c[0]);
|
|
1049
|
+
d && typeof d.value == "object" && (o = d.value.type);
|
|
1050
1050
|
}
|
|
1051
1051
|
}
|
|
1052
1052
|
let e = s;
|
|
@@ -1054,8 +1054,8 @@ class fs {
|
|
|
1054
1054
|
const i = this.inputNameMap.get(t);
|
|
1055
1055
|
i && i.forEach((c) => this.setInternalInput(c, e)), o === "Trigger" && e === !0 && (this.justFiredTriggers.add(t), i && i.forEach((c) => this.justFiredTriggers.add(c))), Array.isArray(e) && ((r = this.artboard) == null || r.objects.forEach((c) => {
|
|
1056
1056
|
if (c.inputId === t || c.name === t) {
|
|
1057
|
-
const
|
|
1058
|
-
|
|
1057
|
+
const d = this.objectStates.get(c.id);
|
|
1058
|
+
d && d.options && (c.type === "ListView" || c.variant === "listview" ? d.options.items = e : (c.type === "Dropdown" || c.variant === "dropdown") && (d.options.optionsList = e));
|
|
1059
1059
|
}
|
|
1060
1060
|
})), this.evaluateTransitions(), this.evaluateVariableTriggers(t, e);
|
|
1061
1061
|
}
|
|
@@ -1099,8 +1099,8 @@ class fs {
|
|
|
1099
1099
|
break;
|
|
1100
1100
|
}
|
|
1101
1101
|
if (c) {
|
|
1102
|
-
const
|
|
1103
|
-
|
|
1102
|
+
const d = i.delay || 0;
|
|
1103
|
+
d <= 0 ? this.triggerGlobalAnimation(i.targetAnimationId, i.subAnimationIds, i.loop, i.id) : setTimeout(() => this.triggerGlobalAnimation(i.targetAnimationId, i.subAnimationIds, i.loop, i.id), d);
|
|
1104
1104
|
}
|
|
1105
1105
|
}
|
|
1106
1106
|
});
|
|
@@ -1200,15 +1200,15 @@ class fs {
|
|
|
1200
1200
|
});
|
|
1201
1201
|
}
|
|
1202
1202
|
evaluateLogicTree(t, s = null, o = /* @__PURE__ */ new Set()) {
|
|
1203
|
-
var a, r, c,
|
|
1203
|
+
var a, r, c, d;
|
|
1204
1204
|
if (o.has(t))
|
|
1205
1205
|
return this.inputs.get(t) ?? this.logicNodeValues.get(t) ?? 0;
|
|
1206
1206
|
o.add(t);
|
|
1207
1207
|
const e = (r = (a = this.activeStateMachine) == null ? void 0 : a.logicNodes) == null ? void 0 : r.find((l) => l.id === t);
|
|
1208
1208
|
if (e) {
|
|
1209
|
-
const l = (g,
|
|
1210
|
-
const
|
|
1211
|
-
return
|
|
1209
|
+
const l = (g, u) => {
|
|
1210
|
+
const p = e.inputs.find((m) => m.id === g);
|
|
1211
|
+
return p ? p.sourceId ? this.evaluateLogicTree(p.sourceId, p.sourceHandleId, o) : p.value !== void 0 ? p.value : u : u;
|
|
1212
1212
|
};
|
|
1213
1213
|
let f = 0;
|
|
1214
1214
|
switch (e.op) {
|
|
@@ -1234,27 +1234,27 @@ class fs {
|
|
|
1234
1234
|
f = 0;
|
|
1235
1235
|
break;
|
|
1236
1236
|
}
|
|
1237
|
-
const
|
|
1238
|
-
if (!
|
|
1237
|
+
const u = e.name;
|
|
1238
|
+
if (!u || u === "GET_PROPERTY" || u === "PROPERTY") {
|
|
1239
1239
|
f = 0;
|
|
1240
1240
|
break;
|
|
1241
1241
|
}
|
|
1242
|
-
const
|
|
1243
|
-
if (!
|
|
1242
|
+
const p = this.objectStates.get(g);
|
|
1243
|
+
if (!p) {
|
|
1244
1244
|
f = 0;
|
|
1245
1245
|
break;
|
|
1246
1246
|
}
|
|
1247
|
-
|
|
1247
|
+
u in p ? f = p[u] : f = this.resolvePath(p, u);
|
|
1248
1248
|
break;
|
|
1249
1249
|
}
|
|
1250
1250
|
case gt.SET_PROPERTY: {
|
|
1251
|
-
const g = l("id", ""),
|
|
1252
|
-
if (!g ||
|
|
1251
|
+
const g = l("id", ""), u = l("value", void 0);
|
|
1252
|
+
if (!g || u === void 0) {
|
|
1253
1253
|
f = 0;
|
|
1254
1254
|
break;
|
|
1255
1255
|
}
|
|
1256
|
-
const
|
|
1257
|
-
if (!
|
|
1256
|
+
const p = e.name;
|
|
1257
|
+
if (!p || p === "SET_PROPERTY") {
|
|
1258
1258
|
f = 0;
|
|
1259
1259
|
break;
|
|
1260
1260
|
}
|
|
@@ -1263,17 +1263,17 @@ class fs {
|
|
|
1263
1263
|
f = 0;
|
|
1264
1264
|
break;
|
|
1265
1265
|
}
|
|
1266
|
-
if (["x", "y", "rotation", "scale_x", "scale_y", "opacity", "width", "height", "cornerRadius", "visible", "zIndex"].includes(
|
|
1267
|
-
m[
|
|
1266
|
+
if (["x", "y", "rotation", "scale_x", "scale_y", "opacity", "width", "height", "cornerRadius", "visible", "zIndex"].includes(p))
|
|
1267
|
+
m[p] = u, f = u;
|
|
1268
1268
|
else {
|
|
1269
|
-
const S =
|
|
1269
|
+
const S = p.split(".");
|
|
1270
1270
|
let b = m;
|
|
1271
|
-
for (let
|
|
1272
|
-
const k = S[
|
|
1271
|
+
for (let w = 0; w < S.length - 1; w++) {
|
|
1272
|
+
const k = S[w];
|
|
1273
1273
|
b[k] === void 0 && (b[k] = {}), b = b[k];
|
|
1274
1274
|
}
|
|
1275
1275
|
const v = S[S.length - 1];
|
|
1276
|
-
b[v] =
|
|
1276
|
+
b[v] = u, f = u;
|
|
1277
1277
|
}
|
|
1278
1278
|
break;
|
|
1279
1279
|
}
|
|
@@ -1319,13 +1319,13 @@ class fs {
|
|
|
1319
1319
|
f = Math.tan(l("in", 0));
|
|
1320
1320
|
break;
|
|
1321
1321
|
case gt.CLAMP: {
|
|
1322
|
-
const g = l("in", 0),
|
|
1323
|
-
f = Math.max(
|
|
1322
|
+
const g = l("in", 0), u = l("min", 0), p = l("max", 1);
|
|
1323
|
+
f = Math.max(u, Math.min(p, g));
|
|
1324
1324
|
break;
|
|
1325
1325
|
}
|
|
1326
1326
|
case gt.REMAP: {
|
|
1327
|
-
const g = l("in", 0),
|
|
1328
|
-
f =
|
|
1327
|
+
const g = l("in", 0), u = l("inMin", 0), p = l("inMax", 100), m = l("outMin", 0), y = l("outMax", 1);
|
|
1328
|
+
f = p === u ? m : m + (g - u) * (y - m) / (p - u);
|
|
1329
1329
|
break;
|
|
1330
1330
|
}
|
|
1331
1331
|
case gt.EQ:
|
|
@@ -1376,8 +1376,8 @@ class fs {
|
|
|
1376
1376
|
f = this.inputs.get("isMouseDown") ?? !1;
|
|
1377
1377
|
break;
|
|
1378
1378
|
case gt.EFFECTOR: {
|
|
1379
|
-
const g = l("id", ""),
|
|
1380
|
-
if (!g || !
|
|
1379
|
+
const g = l("id", ""), u = l("intensity", 1), p = l("trigger", !0);
|
|
1380
|
+
if (!g || !p) {
|
|
1381
1381
|
f = 0;
|
|
1382
1382
|
break;
|
|
1383
1383
|
}
|
|
@@ -1392,11 +1392,11 @@ class fs {
|
|
|
1392
1392
|
break;
|
|
1393
1393
|
}
|
|
1394
1394
|
if (["glitch", "halftone", "pixelate", "noise", "acid_gradient", "acid_rave", "shimmer"].includes(m))
|
|
1395
|
-
y.style || (y.style = {}), y.style.artEffect = { enabled: !0, type: m, intensity:
|
|
1395
|
+
y.style || (y.style = {}), y.style.artEffect = { enabled: !0, type: m, intensity: u }, f = 1;
|
|
1396
1396
|
else {
|
|
1397
1397
|
y.behaviors || (y.behaviors = []);
|
|
1398
1398
|
let b = y.behaviors.find((v) => v.type === m);
|
|
1399
|
-
b ? (b.enabled = !0, b.settings || (b.settings = {}), b.settings.intensity =
|
|
1399
|
+
b ? (b.enabled = !0, b.settings || (b.settings = {}), b.settings.intensity = u) : (b = { id: `eff_${Date.now()}_${m}`, type: m, enabled: !0, sensors: [], settings: { intensity: u } }, y.behaviors.push(b)), f = 1;
|
|
1400
1400
|
}
|
|
1401
1401
|
break;
|
|
1402
1402
|
}
|
|
@@ -1409,11 +1409,11 @@ class fs {
|
|
|
1409
1409
|
break;
|
|
1410
1410
|
}
|
|
1411
1411
|
if (this.logicNodeValues.set(t, f), e.op === gt.DELAY) {
|
|
1412
|
-
const g = l("delay", 0),
|
|
1413
|
-
let
|
|
1414
|
-
for (
|
|
1415
|
-
|
|
1416
|
-
f =
|
|
1412
|
+
const g = l("delay", 0), u = l("in", 0);
|
|
1413
|
+
let p = this.logicNodeState.get(t);
|
|
1414
|
+
for (p || (p = { queue: [] }, this.logicNodeState.set(t, p)), p.queue.push({ time: this.currentTime + g, value: u }); p.queue.length > 0 && p.queue[0].time <= this.currentTime; )
|
|
1415
|
+
p.lastValue = p.queue.shift().value;
|
|
1416
|
+
f = p.lastValue ?? 0;
|
|
1417
1417
|
}
|
|
1418
1418
|
return f;
|
|
1419
1419
|
}
|
|
@@ -1424,7 +1424,7 @@ class fs {
|
|
|
1424
1424
|
}
|
|
1425
1425
|
let n = this.inputs.get(t) ?? (i ? this.inputs.get(i.id) : void 0);
|
|
1426
1426
|
if ((this.justFiredTriggers.has(t) || i && this.justFiredTriggers.has(i.id)) && (n = !0), s && n !== void 0) {
|
|
1427
|
-
const l = (
|
|
1427
|
+
const l = (d = this.activeStateMachine) == null ? void 0 : d.inputs.find((f) => f.id === t);
|
|
1428
1428
|
if (l && l.value.type === "Number" && typeof n == "number") {
|
|
1429
1429
|
const f = l.value.defaultValue ?? l.value.value;
|
|
1430
1430
|
if (s === "source-greater") return n > f;
|
|
@@ -1492,29 +1492,39 @@ class fs {
|
|
|
1492
1492
|
}), s.forEach((o) => {
|
|
1493
1493
|
this.layerStates.delete(o), this.debugLog(`[Engine] Cleaned up completed global layer: ${o}`);
|
|
1494
1494
|
}), this.solveConstraints(t), this.solveBehaviors(t), this.activeTriggers.forEach((o, e) => {
|
|
1495
|
-
var i, n, a, r, c,
|
|
1495
|
+
var i, n, a, r, c, d, l;
|
|
1496
1496
|
if (o.phase === "entry")
|
|
1497
1497
|
o.time += t, o.time >= o.animation.duration && ((a = (n = (i = this.artboard) == null ? void 0 : i.objects.find((f) => f.id === e)) == null ? void 0 : n.triggers) == null || a.find((f) => f.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);
|
|
1498
1498
|
else if (o.phase === "hold") {
|
|
1499
|
-
const f = (
|
|
1499
|
+
const f = (d = (c = (r = this.artboard) == null ? void 0 : r.objects.find((p) => p.id === e)) == null ? void 0 : c.triggers) == null ? void 0 : d.find((p) => p.id === o.triggerId), g = (f == null ? void 0 : f.duration) || 0;
|
|
1500
1500
|
o.elapsedHold += t * 1e3;
|
|
1501
|
-
let
|
|
1502
|
-
if ((f == null ? void 0 : f.eventType) === "hover" && !this.activeHoverIds.has(e) && (
|
|
1501
|
+
let u = o.elapsedHold >= g;
|
|
1502
|
+
if ((f == null ? void 0 : f.eventType) === "hover" && !this.activeHoverIds.has(e) && (u = !0), ((f == null ? void 0 : f.eventType) === "onHold" || (f == null ? void 0 : f.eventType) === "pointerDown") && !this.isMouseDown && (u = !0), u)
|
|
1503
1503
|
if (f != null && f.exitAnimationId) {
|
|
1504
|
-
const
|
|
1505
|
-
|
|
1504
|
+
const p = (l = this.artboard) == null ? void 0 : l.animations.find((m) => m.id === f.exitAnimationId);
|
|
1505
|
+
p ? (o.phase = "exit", o.animation = p, o.time = 0) : this.activeTriggers.delete(e);
|
|
1506
1506
|
} else
|
|
1507
1507
|
this.activeTriggers.delete(e);
|
|
1508
1508
|
} else o.phase === "exit" && (o.time += t, o.time >= o.animation.duration ? this.activeTriggers.delete(e) : this.applyAnimation(o.animation, o.time, o.filterObjectIds || o.filterObjectId || void 0));
|
|
1509
1509
|
}), this.evaluateContinuousInteractions(t);
|
|
1510
1510
|
}
|
|
1511
1511
|
evaluateContinuousInteractions(t) {
|
|
1512
|
-
this.artboard && this.artboard.objects.forEach((s) => {
|
|
1512
|
+
this.artboard && (this.artboard.objects.forEach((s) => {
|
|
1513
|
+
var e, i, n;
|
|
1514
|
+
const o = (e = s.style) == null ? void 0 : e.analytics;
|
|
1515
|
+
if (o && o.isEnabled && o.triggerType === "visible") {
|
|
1516
|
+
const a = this.objectStates.get(s.id);
|
|
1517
|
+
if (a && a.visible !== !1) {
|
|
1518
|
+
const r = this.getGlobalTransform(s.id), c = (((i = s.geometry) == null ? void 0 : i.width) || 100) * (r.scale_x || 1), d = (((n = s.geometry) == null ? void 0 : n.height) || 100) * (r.scale_y || 1), l = 50, f = r.x + c / 2 >= -this.canvasWidth / 2 - l && r.x - c / 2 <= this.canvasWidth / 2 + l && r.y + d / 2 >= -this.canvasHeight / 2 - l && r.y - d / 2 <= this.canvasHeight / 2 + l, g = `analytics_${s.id}`, u = this.wasInView.has(g);
|
|
1519
|
+
f && !u && this.fireAnalyticsEvent(s.id, "visible"), f ? this.wasInView.add(g) : this.wasInView.delete(g);
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
}), this.artboard.objects.forEach((s) => {
|
|
1513
1523
|
const o = s.interactions || [];
|
|
1514
1524
|
o.length !== 0 && o.forEach((e) => {
|
|
1515
1525
|
const i = e.triggers || [e.event || e.trigger];
|
|
1516
1526
|
i && i.forEach((n) => {
|
|
1517
|
-
var r, c,
|
|
1527
|
+
var r, c, d;
|
|
1518
1528
|
const a = n.toLowerCase();
|
|
1519
1529
|
if (a === "on interval" || a === "oninterval") {
|
|
1520
1530
|
const l = e.intervalValue || 2e3, f = this.periodicTriggerTimes.get(e.id) || 0;
|
|
@@ -1527,17 +1537,17 @@ class fs {
|
|
|
1527
1537
|
if (a === "scroll into view" || a === "scrollintoview") {
|
|
1528
1538
|
const l = this.objectStates.get(s.id);
|
|
1529
1539
|
if (l && l.visible !== !1) {
|
|
1530
|
-
const f = this.getGlobalTransform(s.id), g = (((r = s.geometry) == null ? void 0 : r.width) || 100) * (f.scale_x || 1),
|
|
1540
|
+
const f = this.getGlobalTransform(s.id), g = (((r = s.geometry) == null ? void 0 : r.width) || 100) * (f.scale_x || 1), u = (((c = s.geometry) == null ? void 0 : c.height) || 100) * (f.scale_y || 1), p = 50, m = f.x + g / 2 >= -this.canvasWidth / 2 - p && f.x - g / 2 <= this.canvasWidth / 2 + p && f.y + u / 2 >= -this.canvasHeight / 2 - p && f.y - u / 2 <= this.canvasHeight / 2 + p, y = this.wasInView.has(s.id);
|
|
1531
1541
|
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);
|
|
1532
1542
|
}
|
|
1533
1543
|
}
|
|
1534
1544
|
if (a === "scroll progress" || a === "scrollprogress") {
|
|
1535
|
-
const l = Math.abs(this.scrollOffset.y) / (((
|
|
1545
|
+
const l = Math.abs(this.scrollOffset.y) / (((d = this.artboard) == null ? void 0 : d.height) || 1e3), f = this.scrollProgressLastValue.get(e.id) || 0;
|
|
1536
1546
|
Math.abs(l - f) > 1e-3 && (this.scrollProgressLastValue.set(e.id, l), (e.action === "Set Input" || e.action === "setInput") && this.updateInput(e.targetInputId, l));
|
|
1537
1547
|
}
|
|
1538
1548
|
});
|
|
1539
1549
|
});
|
|
1540
|
-
});
|
|
1550
|
+
}));
|
|
1541
1551
|
}
|
|
1542
1552
|
solveConstraints(t) {
|
|
1543
1553
|
this.artboard && this.artboard.objects.forEach((s) => {
|
|
@@ -1546,12 +1556,12 @@ class fs {
|
|
|
1546
1556
|
if (!o) return;
|
|
1547
1557
|
const e = this.getGlobalTransform(s.id);
|
|
1548
1558
|
if (s.constraints.forEach((i, n) => {
|
|
1549
|
-
var
|
|
1550
|
-
const a = ((
|
|
1559
|
+
var d, l, f, g, u, p, m, y, S;
|
|
1560
|
+
const a = ((d = o.constraints) == null ? void 0 : d[n]) || {}, r = { ...i, ...a }, c = r.strength ?? 1;
|
|
1551
1561
|
if (r.type === "Translation") {
|
|
1552
1562
|
const b = this.getGlobalTransform(r.targetId);
|
|
1553
1563
|
if (b) {
|
|
1554
|
-
const v = r.offsetX || 0,
|
|
1564
|
+
const v = r.offsetX || 0, w = r.offsetY || 0, k = b.x + v, A = b.y + w;
|
|
1555
1565
|
if (r.useSpring) {
|
|
1556
1566
|
const B = this.objectVelocities.get(s.id) || { vx: 0, vy: 0 }, { x: F, y: K, vx: tt, vy: rt } = this.computeSpring(e.x, e.y, B.vx, B.vy, k, A, r, t);
|
|
1557
1567
|
r.copyX && (e.x = e.x + (F - e.x) * c), r.copyY && (e.y = e.y + (K - e.y) * c), this.objectVelocities.set(s.id, { vx: tt, vy: rt });
|
|
@@ -1562,8 +1572,8 @@ class fs {
|
|
|
1562
1572
|
} else if (r.type === "Rotation") {
|
|
1563
1573
|
const b = this.getGlobalTransform(r.targetId);
|
|
1564
1574
|
if (b) {
|
|
1565
|
-
let
|
|
1566
|
-
|
|
1575
|
+
let w = (b.rotation + (r.offset || 0) - e.rotation) % 360;
|
|
1576
|
+
w > 180 && (w -= 360), w < -180 && (w += 360), e.rotation = e.rotation + w * c;
|
|
1567
1577
|
}
|
|
1568
1578
|
} else if (r.type === "Scale") {
|
|
1569
1579
|
const b = this.getGlobalTransform(r.targetId);
|
|
@@ -1576,17 +1586,17 @@ class fs {
|
|
|
1576
1586
|
v > 180 && (v -= 360), v < -180 && (v += 360), e.rotation = e.rotation + v * c, e.scale_x = e.scale_x + (b.scale_x - e.scale_x) * c, e.scale_y = e.scale_y + (b.scale_y - e.scale_y) * c;
|
|
1577
1587
|
}
|
|
1578
1588
|
} else if (r.type === "FollowPointer") {
|
|
1579
|
-
const b = ((g = this._lastPointerPos) == null ? void 0 : g.x) ?? e.x, v = ((
|
|
1589
|
+
const b = ((g = this._lastPointerPos) == null ? void 0 : g.x) ?? e.x, v = ((u = this._lastPointerPos) == null ? void 0 : u.y) ?? e.y;
|
|
1580
1590
|
if (r.useSpring) {
|
|
1581
1591
|
const k = this.objectVelocities.get(s.id) || { vx: 0, vy: 0 }, { x: A, y: x, vx: B, vy: F } = this.computeSpring(e.x, e.y, k.vx, k.vy, b, v, r, t);
|
|
1582
1592
|
e.x = A, e.y = x, this.objectVelocities.set(s.id, { vx: B, vy: F });
|
|
1583
1593
|
} else
|
|
1584
1594
|
e.x = e.x + (b - e.x) * c, e.y = e.y + (v - e.y) * c;
|
|
1585
|
-
(
|
|
1595
|
+
(p = r.limitX) != null && p.enabled && (e.x = Math.max(r.limitX.min, Math.min(r.limitX.max, e.x))), (m = r.limitY) != null && m.enabled && (e.y = Math.max(r.limitY.min, Math.min(r.limitY.max, e.y)));
|
|
1586
1596
|
} else if (r.type === "Distance") {
|
|
1587
1597
|
const b = this.getGlobalTransform(r.targetId);
|
|
1588
1598
|
if (b) {
|
|
1589
|
-
const v = e.x - b.x,
|
|
1599
|
+
const v = e.x - b.x, w = e.y - b.y, k = Math.sqrt(v * v + w * w), A = r.distance || 0;
|
|
1590
1600
|
let x = k;
|
|
1591
1601
|
switch (r.mode) {
|
|
1592
1602
|
case "exact":
|
|
@@ -1604,7 +1614,7 @@ class fs {
|
|
|
1604
1614
|
}
|
|
1605
1615
|
if (k > 0) {
|
|
1606
1616
|
const B = e.x === b.x && e.y === b.y ? 1 : x / k;
|
|
1607
|
-
e.x = e.x + (b.x + v * B - e.x) * c, e.y = e.y + (b.y +
|
|
1617
|
+
e.x = e.x + (b.x + v * B - e.x) * c, e.y = e.y + (b.y + w * B - e.y) * c;
|
|
1608
1618
|
}
|
|
1609
1619
|
}
|
|
1610
1620
|
} else if (r.type === "FollowPath") {
|
|
@@ -1612,23 +1622,23 @@ class fs {
|
|
|
1612
1622
|
if (b) {
|
|
1613
1623
|
const v = this.getGlobalTransform(b.id);
|
|
1614
1624
|
if (v) {
|
|
1615
|
-
let
|
|
1616
|
-
if (b.type === "Frame" || b.type === "Group" || !
|
|
1625
|
+
let w = b.geometry;
|
|
1626
|
+
if (b.type === "Frame" || b.type === "Group" || !w || w.type !== "Path" && w.type !== "Ellipse" && w.type !== "Rectangle") {
|
|
1617
1627
|
const H = (S = this.artboard) == null ? void 0 : S.objects.find(
|
|
1618
1628
|
(it) => it.parentId === b.id && it.type === "Shape" && it.geometry && (it.geometry.type === "Path" || it.geometry.type === "Ellipse" || it.geometry.type === "Rectangle")
|
|
1619
1629
|
);
|
|
1620
|
-
H && (
|
|
1630
|
+
H && (w = H.geometry);
|
|
1621
1631
|
}
|
|
1622
|
-
if (!
|
|
1623
|
-
const k = (r.distance || 0) / 100, A = v.width ||
|
|
1624
|
-
let
|
|
1632
|
+
if (!w) return;
|
|
1633
|
+
const k = (r.distance || 0) / 100, A = v.width || w.width || 0, x = v.height || w.height || 0, B = this.getPointOnPath(w, A, x, k), F = v.rotation * Math.PI / 180, K = Math.cos(F), tt = Math.sin(F), rt = B.x * v.scale_x * K - B.y * v.scale_y * tt, at = B.x * v.scale_x * tt + B.y * v.scale_y * K;
|
|
1634
|
+
let V = v.rotation + (r.offsetRotation || 0);
|
|
1625
1635
|
if (r.orient) {
|
|
1626
1636
|
const H = Math.cos(B.angle), it = Math.sin(B.angle), nt = H * v.scale_x * K - it * v.scale_y * tt, ft = H * v.scale_x * tt + it * v.scale_y * K;
|
|
1627
|
-
|
|
1637
|
+
V = Math.atan2(ft, nt) * 180 / Math.PI + (r.offsetRotation || 0);
|
|
1628
1638
|
}
|
|
1629
|
-
const O =
|
|
1630
|
-
if (e.x = e.x + (lt - e.x) * c, e.y = e.y + (
|
|
1631
|
-
let H = (
|
|
1639
|
+
const O = V * Math.PI / 180, $ = Math.cos(O), P = Math.sin(O), J = (r.offsetX || 0) * $ - (r.offsetY || 0) * P, Z = (r.offsetX || 0) * P + (r.offsetY || 0) * $, lt = v.x + rt + J, Y = v.y + at + Z;
|
|
1640
|
+
if (e.x = e.x + (lt - e.x) * c, e.y = e.y + (Y - e.y) * c, r.orient) {
|
|
1641
|
+
let H = (V - e.rotation) % 360;
|
|
1632
1642
|
H > 180 && (H -= 360), H < -180 && (H += 360), e.rotation = e.rotation + H * c;
|
|
1633
1643
|
}
|
|
1634
1644
|
}
|
|
@@ -1644,10 +1654,10 @@ class fs {
|
|
|
1644
1654
|
});
|
|
1645
1655
|
}
|
|
1646
1656
|
getGlobalTransform(t) {
|
|
1647
|
-
var
|
|
1657
|
+
var d;
|
|
1648
1658
|
const s = this.objectStates.get(t);
|
|
1649
1659
|
if (!s) return { x: 0, y: 0, rotation: 0, scale_x: 1, scale_y: 1 };
|
|
1650
|
-
const o = (
|
|
1660
|
+
const o = (d = this.artboard) == null ? void 0 : d.objects.find((l) => l.id === t);
|
|
1651
1661
|
if (!o || !o.parentId)
|
|
1652
1662
|
return {
|
|
1653
1663
|
x: s.x,
|
|
@@ -1667,7 +1677,7 @@ class fs {
|
|
|
1667
1677
|
}
|
|
1668
1678
|
globalToLocal(t, s) {
|
|
1669
1679
|
if (!t) return s;
|
|
1670
|
-
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), c = s.x - o.x,
|
|
1680
|
+
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), c = s.x - o.x, d = s.y - o.y, l = (c * a - d * r) * e, f = (c * r + d * a) * i;
|
|
1671
1681
|
return {
|
|
1672
1682
|
x: l,
|
|
1673
1683
|
y: f,
|
|
@@ -1680,7 +1690,7 @@ class fs {
|
|
|
1680
1690
|
var c;
|
|
1681
1691
|
const i = [];
|
|
1682
1692
|
let n = t.id;
|
|
1683
|
-
for (let
|
|
1693
|
+
for (let d = 0; d < o && n; d++) {
|
|
1684
1694
|
const l = (c = this.artboard) == null ? void 0 : c.objects.find((f) => f.id === n);
|
|
1685
1695
|
if (!l) break;
|
|
1686
1696
|
i.push({
|
|
@@ -1691,13 +1701,13 @@ class fs {
|
|
|
1691
1701
|
}
|
|
1692
1702
|
if (i.length < 2) return;
|
|
1693
1703
|
const a = i.reverse(), r = 5;
|
|
1694
|
-
for (let
|
|
1704
|
+
for (let d = 0; d < r; d++) {
|
|
1695
1705
|
const l = this.getGlobalTransform(t.id);
|
|
1696
1706
|
for (let f = a.length - 2; f >= 0; f--) {
|
|
1697
|
-
const g = a[f],
|
|
1707
|
+
const g = a[f], u = this.getGlobalTransform(g.id), p = l.x - u.x, m = l.y - u.y, y = s.x - u.x, S = s.y - u.y, b = Math.sqrt(p * p + m * m), v = Math.sqrt(y * y + S * S);
|
|
1698
1708
|
if (b > 1e-3 && v > 1e-3) {
|
|
1699
|
-
const
|
|
1700
|
-
let A = (Math.atan2(S, y) -
|
|
1709
|
+
const w = Math.atan2(m, p);
|
|
1710
|
+
let A = (Math.atan2(S, y) - w) * 180 / Math.PI;
|
|
1701
1711
|
A *= e;
|
|
1702
1712
|
const x = this.objectStates.get(g.id);
|
|
1703
1713
|
x && (x.rotation += A);
|
|
@@ -1706,8 +1716,8 @@ class fs {
|
|
|
1706
1716
|
}
|
|
1707
1717
|
}
|
|
1708
1718
|
computeSpring(t, s, o, e, i, n, a, r) {
|
|
1709
|
-
const c = a.stiffness ?? 100,
|
|
1710
|
-
return { x: v, y:
|
|
1719
|
+
const c = a.stiffness ?? 100, d = a.damping ?? 10, l = a.mass ?? 1, f = -c * (t - i), g = -c * (s - n), u = -d * o, p = -d * e, m = (f + u) / l, y = (g + p) / l, S = o + m * r, b = e + y * r, v = t + S * r, w = s + b * r;
|
|
1720
|
+
return { x: v, y: w, vx: S, vy: b };
|
|
1711
1721
|
}
|
|
1712
1722
|
handlePointerInput(t, s, o, e, i) {
|
|
1713
1723
|
if (!this.artboard) return;
|
|
@@ -1730,24 +1740,24 @@ class fs {
|
|
|
1730
1740
|
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);
|
|
1731
1741
|
}
|
|
1732
1742
|
handlePointerEvent(t, s, o) {
|
|
1733
|
-
var r, c,
|
|
1743
|
+
var r, c, d, l, f;
|
|
1734
1744
|
if (!this.artboard) return;
|
|
1735
1745
|
t === "down" ? (this.isMouseDown = !0, this.updateInput("isMouseDown", !0)) : (t === "up" || t === "blur") && (this.isMouseDown = !1, this.updateInput("isMouseDown", !1));
|
|
1736
1746
|
let e = null;
|
|
1737
|
-
const i = (g,
|
|
1747
|
+
const i = (g, u) => {
|
|
1738
1748
|
var v;
|
|
1739
|
-
let
|
|
1740
|
-
|
|
1741
|
-
const m = /* @__PURE__ */ new Set([
|
|
1742
|
-
|
|
1749
|
+
let p = u;
|
|
1750
|
+
u === "click" ? p = "onClick" : u === "down" ? p = "onPointerDown" : u === "up" ? p = "onPointerUp" : u === "blur" && (p = "onPointerLeave");
|
|
1751
|
+
const m = /* @__PURE__ */ new Set([p]);
|
|
1752
|
+
u === "move" && m.add("onPointerEnter").add("hover").add("onPointerLeave").add("blur"), p === "onClick" && m.add("click"), p === "onPointerDown" && m.add("pointerDown"), p === "onPointerUp" && m.add("pointerUp");
|
|
1743
1753
|
const y = ["button", "toggle", "toggle_button", "dropdown", "listview", "inputbox", "slider"];
|
|
1744
|
-
return !!(g.type === "Component" && y.includes(g.variant) || y.includes((v = g.type) == null ? void 0 : v.toLowerCase()) || (g.interactions || []).some((
|
|
1754
|
+
return !!(g.type === "Component" && y.includes(g.variant) || y.includes((v = g.type) == null ? void 0 : v.toLowerCase()) || (g.interactions || []).some((w) => m.has(w.event)) || (g.triggers || []).some((w) => m.has(w.eventType)));
|
|
1745
1755
|
};
|
|
1746
1756
|
let n = null;
|
|
1747
1757
|
for (let g = this.artboard.objects.length - 1; g >= 0; g--) {
|
|
1748
|
-
const
|
|
1749
|
-
if (
|
|
1750
|
-
e =
|
|
1758
|
+
const u = this.artboard.objects[g], p = this.objectStates.get(u.id);
|
|
1759
|
+
if (p && p.visible !== !1 && p.opacity > 0 && this.hitTest(u, s, o) && (n || (n = u), i(u, t))) {
|
|
1760
|
+
e = u;
|
|
1751
1761
|
break;
|
|
1752
1762
|
}
|
|
1753
1763
|
}
|
|
@@ -1755,12 +1765,12 @@ class fs {
|
|
|
1755
1765
|
const a = (e == null ? void 0 : e.id) || null;
|
|
1756
1766
|
if (t === "move") {
|
|
1757
1767
|
if (this.draggingSliderId) {
|
|
1758
|
-
const g = this.artboard.objects.find((
|
|
1768
|
+
const g = this.artboard.objects.find((u) => u.id === this.draggingSliderId);
|
|
1759
1769
|
g && this.updateSliderValueFromPointer(g, s, o);
|
|
1760
1770
|
return;
|
|
1761
1771
|
}
|
|
1762
1772
|
if (this.draggingListViewId) {
|
|
1763
|
-
const g = this.artboard.objects.find((
|
|
1773
|
+
const g = this.artboard.objects.find((u) => u.id === this.draggingListViewId);
|
|
1764
1774
|
g && this.updateListViewScrollFromPointer(g);
|
|
1765
1775
|
return;
|
|
1766
1776
|
}
|
|
@@ -1770,14 +1780,14 @@ class fs {
|
|
|
1770
1780
|
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((g) => g.type === D.Draggable)) && this.draggingBehaviors.add(a)), t === "move" ? (a && !this.activeHoverIds.has(a) && this.activeHoverIds.add(a), this.activeHoverIds.forEach((g) => {
|
|
1771
1781
|
g !== a && this.activeHoverIds.delete(g);
|
|
1772
1782
|
})) : t === "blur" && this.activeHoverIds.clear(), this.activeDropdownId && t === "down") {
|
|
1773
|
-
const g = this.artboard.objects.find((
|
|
1783
|
+
const g = this.artboard.objects.find((u) => u.id === this.activeDropdownId);
|
|
1774
1784
|
if (g && (g.type === "Dropdown" || g.variant === "dropdown")) {
|
|
1775
|
-
const
|
|
1785
|
+
const u = this.objectStates.get(g.id), p = (u == null ? void 0 : u.options) || g.options || {}, m = g.geometry || {}, y = m.width ?? g.width ?? 200, S = m.height ?? g.height ?? 40, b = p.optionsList || [], v = p.itemHeight || 32, w = p.listPadding ?? 4, k = b.length * v + w * 2, A = this.getWorldTransform(g.id), x = y * Math.abs(A.scaleX), B = S * Math.abs(A.scaleY), F = A.y + B / 2 + 4, K = Math.abs(s - A.x) <= x / 2, tt = o >= F && o <= F + k * Math.abs(A.scaleY);
|
|
1776
1786
|
if (K && tt) {
|
|
1777
|
-
const rt = Math.abs(A.scaleY), at = o - (F +
|
|
1778
|
-
if (
|
|
1779
|
-
const O = b[
|
|
1780
|
-
|
|
1787
|
+
const rt = Math.abs(A.scaleY), at = o - (F + w * rt), V = Math.floor(at / (v * rt));
|
|
1788
|
+
if (V >= 0 && V < b.length) {
|
|
1789
|
+
const O = b[V];
|
|
1790
|
+
p.selectedOption = O, p.isOpen = !1, this.activeDropdownId = null, g.inputId && this.setInternalInput(g.inputId, O), this.onComponentChange && this.onComponentChange({
|
|
1781
1791
|
objectId: g.id,
|
|
1782
1792
|
componentName: g.name,
|
|
1783
1793
|
variant: "dropdown",
|
|
@@ -1786,21 +1796,21 @@ class fs {
|
|
|
1786
1796
|
});
|
|
1787
1797
|
}
|
|
1788
1798
|
return;
|
|
1789
|
-
} else a !== this.activeDropdownId && (
|
|
1799
|
+
} else a !== this.activeDropdownId && (p.isOpen = !1, this.activeDropdownId = null);
|
|
1790
1800
|
}
|
|
1791
1801
|
}
|
|
1792
1802
|
if (e) {
|
|
1793
|
-
let g = e,
|
|
1794
|
-
for (;
|
|
1795
|
-
const m = this.artboard.objects.find((y) => y.id ===
|
|
1803
|
+
let g = e, u = e;
|
|
1804
|
+
for (; u && u.parentId; ) {
|
|
1805
|
+
const m = this.artboard.objects.find((y) => y.id === u.parentId);
|
|
1796
1806
|
if (m && m.type === "Component") {
|
|
1797
1807
|
g = m;
|
|
1798
1808
|
break;
|
|
1799
1809
|
}
|
|
1800
|
-
|
|
1810
|
+
u = m;
|
|
1801
1811
|
}
|
|
1802
|
-
let
|
|
1803
|
-
if (t === "click" ?
|
|
1812
|
+
let p = t;
|
|
1813
|
+
if (t === "click" ? p = "onClick" : t === "down" ? p = "onPointerDown" : t === "up" ? p = "onPointerUp" : t === "blur" && (p = "onPointerLeave"), this.fireEventForObject(e.id, p), g !== e && this.fireEventForObject(g.id, p), g.type === "Component" && g.variant === "toggle_button" && t === "down") {
|
|
1804
1814
|
const m = this.objectStates.get(g.id), y = (m == null ? void 0 : m.options) || g.options || {};
|
|
1805
1815
|
y.checked = !y.checked, g.inputId && this.setInternalInput(g.inputId, y.checked), this.onComponentChange && this.onComponentChange({
|
|
1806
1816
|
objectId: g.id,
|
|
@@ -1859,7 +1869,7 @@ class fs {
|
|
|
1859
1869
|
}
|
|
1860
1870
|
}
|
|
1861
1871
|
if (g.type === "Component" && g.variant === "slider" && t === "down" && (this.draggingSliderId = g.id, this.updateSliderValueFromPointer(g, s, o)), g.type === "LineGraph" && (t === "down" || t === "click")) {
|
|
1862
|
-
const m = g.geometry, y = (m == null ? void 0 : m.datasets) || [], S = this.objectStates.get(g.id), b = (S == null ? void 0 : S.width) || (m == null ? void 0 : m.width) || 200, v = (S == null ? void 0 : S.height) || (m == null ? void 0 : m.height) || 150,
|
|
1872
|
+
const m = g.geometry, y = (m == null ? void 0 : m.datasets) || [], S = this.objectStates.get(g.id), b = (S == null ? void 0 : S.width) || (m == null ? void 0 : m.width) || 200, v = (S == null ? void 0 : S.height) || (m == null ? void 0 : m.height) || 150, w = this.getWorldTransform(g.id), k = 30, A = 20, x = b - k, B = v - A;
|
|
1863
1873
|
let F = 1;
|
|
1864
1874
|
y.forEach((rt) => {
|
|
1865
1875
|
const at = Math.max(...rt.data || [0]);
|
|
@@ -1867,9 +1877,9 @@ class fs {
|
|
|
1867
1877
|
});
|
|
1868
1878
|
let K = 1 / 0, tt = null;
|
|
1869
1879
|
y.forEach((rt, at) => {
|
|
1870
|
-
const
|
|
1871
|
-
|
|
1872
|
-
const J =
|
|
1880
|
+
const V = rt.data || [], O = x / Math.max(V.length - 1, 1);
|
|
1881
|
+
V.forEach(($, P) => {
|
|
1882
|
+
const J = w.x - b / 2 + k + P * O, Z = w.y + v / 2 - A - $ / F * B, lt = Math.sqrt((s - J) ** 2 + (o - Z) ** 2);
|
|
1873
1883
|
lt < K && (K = lt, tt = { dIdx: at, pIdx: P, val: $, label: rt.label || `Dataset ${at + 1}` });
|
|
1874
1884
|
});
|
|
1875
1885
|
}), tt && K < 20 && this.onGraphPointClick && this.onGraphPointClick({ objectId: g.id, componentName: g.name, datasetIndex: tt.dIdx, pointIndex: tt.pIdx, value: tt.val, label: tt.label }), this.onComponentChange && this.onComponentChange({ objectId: g.id, componentName: g.name, variant: "linegraph", property: "click", value: (tt == null ? void 0 : tt.val) ?? null });
|
|
@@ -1879,7 +1889,7 @@ class fs {
|
|
|
1879
1889
|
if (m && S) {
|
|
1880
1890
|
if (this.focusedId = e.id, console.log(`[Engine] Focus set to: ${e.id}`), y !== this.focusedId) {
|
|
1881
1891
|
if (y) {
|
|
1882
|
-
const b = (
|
|
1892
|
+
const b = (d = this.artboard) == null ? void 0 : d.objects.find((v) => v.id === y);
|
|
1883
1893
|
b && this.onInputBlur && this.onInputBlur(b.name);
|
|
1884
1894
|
}
|
|
1885
1895
|
this.onInputFocus && this.onInputFocus(m.name);
|
|
@@ -1892,8 +1902,8 @@ class fs {
|
|
|
1892
1902
|
} else if (t === "click") {
|
|
1893
1903
|
const g = this.focusedId;
|
|
1894
1904
|
if (this.focusedId = null, g) {
|
|
1895
|
-
const
|
|
1896
|
-
|
|
1905
|
+
const u = (f = this.artboard) == null ? void 0 : f.objects.find((p) => p.id === g);
|
|
1906
|
+
u && this.onInputBlur && this.onInputBlur(u.name);
|
|
1897
1907
|
}
|
|
1898
1908
|
}
|
|
1899
1909
|
}
|
|
@@ -1928,70 +1938,99 @@ class fs {
|
|
|
1928
1938
|
}), this.onInputChange && this.onInputChange(s.name, i), this.onInputUpdate && this.onInputUpdate(this.focusedId, i);
|
|
1929
1939
|
}
|
|
1930
1940
|
fireEventForObject(t, s) {
|
|
1931
|
-
var
|
|
1932
|
-
const o = (
|
|
1941
|
+
var d, l, f, g, u;
|
|
1942
|
+
const o = (d = this.artboard) == null ? void 0 : d.objects.find((p) => p.id === t);
|
|
1933
1943
|
if (!o) return;
|
|
1934
1944
|
const e = /* @__PURE__ */ new Set([s, s.toLowerCase()]), i = s.toLowerCase();
|
|
1935
|
-
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"));
|
|
1936
|
-
const a = (o.interactions || []).find((
|
|
1937
|
-
const m =
|
|
1938
|
-
return ((
|
|
1945
|
+
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"));
|
|
1946
|
+
const a = (o.interactions || []).find((p) => {
|
|
1947
|
+
const m = p.triggers || [p.event || p.trigger || "click"];
|
|
1948
|
+
return ((p.triggerLogic || "OR") === "AND" ? m.every((b) => e.has(b.toLowerCase())) : m.some((b) => e.has(b.toLowerCase()))) ? p.conditions && p.conditions.length > 0 ? this.checkConditions(p.conditions) : !0 : !1;
|
|
1939
1949
|
});
|
|
1940
1950
|
if (a) {
|
|
1941
1951
|
if (console.log(`[Engine] Interaction matched: ${s} -> Action: ${a.action}`), a.action === "setInput" || a.action === "Set Input") {
|
|
1942
|
-
let
|
|
1943
|
-
|
|
1952
|
+
let p = a.value || a.inputValue;
|
|
1953
|
+
p === "toggle" && (p = !this.inputs.get(a.targetInputId)), this.updateInput(a.targetInputId, p);
|
|
1944
1954
|
} else if (a.action === "Toggle Boolean") {
|
|
1945
|
-
const
|
|
1946
|
-
this.updateInput(a.targetInputId, !
|
|
1955
|
+
const p = this.inputs.get(a.targetInputId);
|
|
1956
|
+
this.updateInput(a.targetInputId, !p);
|
|
1947
1957
|
} else if (a.action === "fireTrigger")
|
|
1948
1958
|
this.updateInput(a.targetInputId, !0);
|
|
1949
1959
|
else if (a.action === "setProperty") {
|
|
1950
|
-
const
|
|
1951
|
-
m && this.updateObjectProperty(
|
|
1960
|
+
const p = a.targetObjectId || o.id, m = a.targetProperty;
|
|
1961
|
+
m && this.updateObjectProperty(p, m, a.value);
|
|
1952
1962
|
} else if (a.action === "Navigate Artboard" || a.action === "navigate")
|
|
1953
1963
|
this.onNavigation && this.onNavigation({ type: "artboard", value: a.targetArtboard || a.value });
|
|
1954
1964
|
else if (a.action === "Navigate URL")
|
|
1955
1965
|
this.onNavigation && this.onNavigation({ type: "url", value: a.navigateUrl });
|
|
1956
1966
|
else if (a.action === "Play Animation") {
|
|
1957
|
-
const
|
|
1958
|
-
|
|
1967
|
+
const p = a.targetAnimationId;
|
|
1968
|
+
p === "__all__" ? (f = (l = this.artboard) == null ? void 0 : l.animations) == null || f.forEach((m) => {
|
|
1959
1969
|
this.triggerGlobalAnimation(m.id, a.subAnimationIds);
|
|
1960
|
-
}) :
|
|
1970
|
+
}) : p && this.triggerGlobalAnimation(p, a.subAnimationIds);
|
|
1961
1971
|
} else if (a.action === "setState" || a.action === "Set State") {
|
|
1962
|
-
const
|
|
1963
|
-
this.objectStates.set(
|
|
1972
|
+
const p = a.targetObjectId || o.id, y = { ...this.objectStates.get(p) || {}, ...a.value || {} };
|
|
1973
|
+
this.objectStates.set(p, y), console.log(`[Engine] State updated for ${p}:`, y);
|
|
1964
1974
|
} else if (a.action === "Stop Animation" || a.action === "Pause Animation") {
|
|
1965
|
-
const
|
|
1966
|
-
|
|
1975
|
+
const p = a.targetAnimationId;
|
|
1976
|
+
p === "__all__" ? this.layerStates.forEach((m, y) => {
|
|
1967
1977
|
y.startsWith("global_") && this.layerStates.delete(y);
|
|
1968
|
-
}) :
|
|
1969
|
-
y.startsWith(`global_${
|
|
1978
|
+
}) : p && this.layerStates.forEach((m, y) => {
|
|
1979
|
+
y.startsWith(`global_${p}_`) && this.layerStates.delete(y);
|
|
1970
1980
|
});
|
|
1971
1981
|
} else if (a.action === "Switch to State" && this.activeStateMachine) {
|
|
1972
|
-
const
|
|
1973
|
-
(y) => y.states.some((S) => S.id ===
|
|
1982
|
+
const p = a.targetState, m = this.activeStateMachine.layers.find(
|
|
1983
|
+
(y) => y.states.some((S) => S.id === p || S.name === p)
|
|
1974
1984
|
);
|
|
1975
|
-
m && (console.log(`[Engine] Switching Layer ${m.name} to State ${
|
|
1985
|
+
m && (console.log(`[Engine] Switching Layer ${m.name} to State ${p}`), this.enterStates(m.name, [p]));
|
|
1976
1986
|
}
|
|
1977
1987
|
this.onTrigger && this.onTrigger(s, a.action);
|
|
1978
1988
|
}
|
|
1979
|
-
const c = (o.triggers || []).find((
|
|
1980
|
-
const m =
|
|
1989
|
+
const c = (o.triggers || []).find((p) => {
|
|
1990
|
+
const m = p.eventType.toLowerCase();
|
|
1981
1991
|
let y = !1;
|
|
1982
|
-
return (e.has(m) || m === "click" && e.has("onclick") || m === "hover" && (e.has("onpointerenter") || e.has("hover")) || m === "pointerdown" && e.has("onpointerdown") || m === "pointerup" && e.has("onpointerup")) && (y = !0), y &&
|
|
1992
|
+
return (e.has(m) || m === "click" && e.has("onclick") || m === "hover" && (e.has("onpointerenter") || e.has("hover")) || m === "pointerdown" && e.has("onpointerdown") || m === "pointerup" && e.has("onpointerup")) && (y = !0), y && p.conditions && p.conditions.length > 0 ? this.checkConditions(p.conditions) : y;
|
|
1983
1993
|
});
|
|
1984
1994
|
if (c && c.entryAnimationId) {
|
|
1985
1995
|
console.log(`[Engine] Trigger matched: ${s} (as ${c.eventType}) -> Animation ${c.entryAnimationId}`);
|
|
1986
|
-
const
|
|
1987
|
-
|
|
1996
|
+
const p = (u = (g = this.artboard) == null ? void 0 : g.animations) == null ? void 0 : u.find((m) => m.id === c.entryAnimationId);
|
|
1997
|
+
p && (this.activeTriggers.set(o.id, {
|
|
1988
1998
|
triggerId: c.id,
|
|
1989
|
-
animation:
|
|
1999
|
+
animation: p,
|
|
1990
2000
|
time: 0,
|
|
1991
2001
|
phase: "entry",
|
|
1992
2002
|
elapsedHold: 0,
|
|
1993
2003
|
filterObjectId: c.targetObjectId
|
|
1994
|
-
}), this.onTrigger && this.onTrigger(c.name,
|
|
2004
|
+
}), this.onTrigger && this.onTrigger(c.name, p.name));
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
fireAnalyticsEvent(t, s) {
|
|
2008
|
+
var r, c;
|
|
2009
|
+
const o = (r = this.artboard) == null ? void 0 : r.objects.find((d) => d.id === t);
|
|
2010
|
+
if (!o) return;
|
|
2011
|
+
const e = (c = o.style) == null ? void 0 : c.analytics;
|
|
2012
|
+
if (!e || !e.isEnabled || e.triggerType !== s) return;
|
|
2013
|
+
const i = e.eventName || `${o.name.toLowerCase().replace(/\s+/g, "_")}_interacted`, n = {};
|
|
2014
|
+
e.parameters && Array.isArray(e.parameters) && e.parameters.forEach((d) => {
|
|
2015
|
+
if (d.type === "literal")
|
|
2016
|
+
n[d.key] = d.value;
|
|
2017
|
+
else if (d.type === "variable") {
|
|
2018
|
+
const l = this.inputs.get(d.value);
|
|
2019
|
+
n[d.key] = l !== void 0 ? l : "";
|
|
2020
|
+
}
|
|
2021
|
+
}), console.log(`[ExodeUI Analytics] Dispatching event "${i}" via ${s} trigger:`, n);
|
|
2022
|
+
const a = e.platforms || { ga4: !0, meta: !0, mixpanel: !1 };
|
|
2023
|
+
if (a.ga4) {
|
|
2024
|
+
const d = window;
|
|
2025
|
+
typeof d.gtag == "function" ? (d.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.`);
|
|
2026
|
+
}
|
|
2027
|
+
if (a.meta) {
|
|
2028
|
+
const d = window;
|
|
2029
|
+
typeof d.fbq == "function" ? (d.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.`);
|
|
2030
|
+
}
|
|
2031
|
+
if (a.mixpanel) {
|
|
2032
|
+
const d = window;
|
|
2033
|
+
d.mixpanel && typeof d.mixpanel.track == "function" ? (d.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.`);
|
|
1995
2034
|
}
|
|
1996
2035
|
}
|
|
1997
2036
|
initGlobalAnimationTriggers() {
|
|
@@ -2041,9 +2080,9 @@ class fs {
|
|
|
2041
2080
|
scaleY: s.scale_y ?? 1,
|
|
2042
2081
|
rotation: s.rotation ?? 0
|
|
2043
2082
|
};
|
|
2044
|
-
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, c = s.y * e.scaleY,
|
|
2083
|
+
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, c = s.y * e.scaleY, d = e.x + (r * n - c * a), l = e.y + (r * a + c * n);
|
|
2045
2084
|
return {
|
|
2046
|
-
x:
|
|
2085
|
+
x: d,
|
|
2047
2086
|
y: l,
|
|
2048
2087
|
scaleX: (s.scale_x ?? 1) * e.scaleX,
|
|
2049
2088
|
scaleY: (s.scale_y ?? 1) * e.scaleY,
|
|
@@ -2053,26 +2092,26 @@ class fs {
|
|
|
2053
2092
|
hitTest(t, s, o) {
|
|
2054
2093
|
var b, v;
|
|
2055
2094
|
if (!this.objectStates.get(t.id)) return !1;
|
|
2056
|
-
const i = ((b = t.geometry) == null ? void 0 : b.width) ?? t.width ?? 100, n = ((v = t.geometry) == null ? void 0 : v.height) ?? t.height ?? 100, a = this.getWorldTransform(t.id), r = s - a.x, c = o - a.y,
|
|
2057
|
-
return Math.abs(g) <= y / 2 && Math.abs(
|
|
2095
|
+
const i = ((b = t.geometry) == null ? void 0 : b.width) ?? t.width ?? 100, n = ((v = t.geometry) == null ? void 0 : v.height) ?? t.height ?? 100, a = this.getWorldTransform(t.id), r = s - a.x, c = o - a.y, d = -a.rotation * (Math.PI / 180), l = Math.cos(d), f = Math.sin(d), g = r * l - c * f, u = r * f + c * l, p = a.scaleX, m = a.scaleY, y = i * Math.abs(p), S = n * Math.abs(m);
|
|
2096
|
+
return Math.abs(g) <= y / 2 && Math.abs(u) <= S / 2;
|
|
2058
2097
|
}
|
|
2059
2098
|
updateSliderValueFromPointer(t, s, o) {
|
|
2060
2099
|
var A;
|
|
2061
2100
|
const e = this.objectStates.get(t.id);
|
|
2062
2101
|
if (!e) return;
|
|
2063
|
-
const i = t.options || {}, n = ((A = t.geometry) == null ? void 0 : A.width) ?? t.width ?? 200, a = this.getWorldTransform(t.id), r = s - a.x, c = o - a.y,
|
|
2064
|
-
let y = (g +
|
|
2102
|
+
const i = t.options || {}, n = ((A = t.geometry) == null ? void 0 : A.width) ?? t.width ?? 200, a = this.getWorldTransform(t.id), r = s - a.x, c = o - a.y, d = -a.rotation * (Math.PI / 180), l = Math.cos(d), f = Math.sin(d), g = r * l - c * f, u = i.thumbWidth ?? 16, p = n - u;
|
|
2103
|
+
let y = (g + p / 2) / p;
|
|
2065
2104
|
y = Math.max(0, Math.min(1, y));
|
|
2066
2105
|
const S = i.min ?? 0, b = i.max ?? 100, v = i.step || 1;
|
|
2067
|
-
let
|
|
2068
|
-
v > 0 && (
|
|
2106
|
+
let w = S + y * (b - S);
|
|
2107
|
+
v > 0 && (w = Math.round(w / v) * v), w = Math.max(S, Math.min(b, w));
|
|
2069
2108
|
const k = e.options || {};
|
|
2070
|
-
k.value !==
|
|
2109
|
+
k.value !== w && (e.options = { ...k, value: w }, t.inputId && this.setInternalInput(t.inputId, w), this.onComponentChange && this.onComponentChange({
|
|
2071
2110
|
objectId: t.id,
|
|
2072
2111
|
componentName: t.name,
|
|
2073
2112
|
variant: "slider",
|
|
2074
2113
|
property: "value",
|
|
2075
|
-
value:
|
|
2114
|
+
value: w
|
|
2076
2115
|
}));
|
|
2077
2116
|
}
|
|
2078
2117
|
applyAnimation(t, s, o) {
|
|
@@ -2085,7 +2124,7 @@ class fs {
|
|
|
2085
2124
|
} else if (i !== o)
|
|
2086
2125
|
return;
|
|
2087
2126
|
}
|
|
2088
|
-
const n = (l = this.artboard) == null ? void 0 : l.objects.find((
|
|
2127
|
+
const n = (l = this.artboard) == null ? void 0 : l.objects.find((u) => u.id === i), a = ((f = n == null ? void 0 : n.physics) == null ? void 0 : f.enabled) && n.physics.bodyType !== "Static";
|
|
2089
2128
|
let r = e.property;
|
|
2090
2129
|
if (a && (r === "x" || r === "y" || r === "rotation"))
|
|
2091
2130
|
return;
|
|
@@ -2094,39 +2133,39 @@ class fs {
|
|
|
2094
2133
|
this.frameCount % 600 === 0 && this.debugLog(`Skipping track: Object ${i} not found in state`);
|
|
2095
2134
|
return;
|
|
2096
2135
|
}
|
|
2097
|
-
const
|
|
2098
|
-
if (
|
|
2136
|
+
const d = this.interpolate(e.keyframes, s);
|
|
2137
|
+
if (d !== void 0) {
|
|
2099
2138
|
if (this.frameCount % 240 === 0) {
|
|
2100
|
-
const
|
|
2101
|
-
this.debugLog(`[Anim] Applying ${r} = ${
|
|
2139
|
+
const u = (n == null ? void 0 : n.name) || i, p = typeof d == "object" ? JSON.stringify(d).slice(0, 50) : d;
|
|
2140
|
+
this.debugLog(`[Anim] Applying ${r} = ${p} to ${u}`);
|
|
2102
2141
|
}
|
|
2103
2142
|
if (r.includes(".")) {
|
|
2104
|
-
const
|
|
2105
|
-
let
|
|
2106
|
-
for (let m = 0; m <
|
|
2107
|
-
if (typeof u[
|
|
2143
|
+
const u = (r || "").split(".");
|
|
2144
|
+
let p = c;
|
|
2145
|
+
for (let m = 0; m < u.length - 1; m++) {
|
|
2146
|
+
if (typeof p[u[m]] != "object" || p[u[m]] === null) {
|
|
2108
2147
|
let y = n;
|
|
2109
2148
|
for (let S = 0; S <= m; S++)
|
|
2110
|
-
y = y ? y[
|
|
2111
|
-
if (
|
|
2112
|
-
const S = typeof u[
|
|
2113
|
-
u[
|
|
2149
|
+
y = y ? y[u[S]] : null;
|
|
2150
|
+
if (u[m] === "corner_radius" || u[m] === "cornerRadius") {
|
|
2151
|
+
const S = typeof p[u[m]] == "number" ? p[u[m]] : typeof y == "number" ? y : 0;
|
|
2152
|
+
p[u[m]] = { tl: S, tr: S, bl: S, br: S };
|
|
2114
2153
|
} else
|
|
2115
|
-
u[
|
|
2154
|
+
p[u[m]] = y ? JSON.parse(JSON.stringify(y)) : {};
|
|
2116
2155
|
}
|
|
2117
|
-
|
|
2156
|
+
p = p[u[m]];
|
|
2118
2157
|
}
|
|
2119
|
-
u[
|
|
2158
|
+
p[u[u.length - 1]] = d, u[u.length - 1] === "color" && (u[u.length - 2] === "fill" || u[u.length - 2] === "stroke") && (p.type = "Solid");
|
|
2120
2159
|
} else
|
|
2121
|
-
r === "fill" ? (c.style || (c.style = {}), c.style.fill =
|
|
2160
|
+
r === "fill" ? (c.style || (c.style = {}), c.style.fill = d) : r === "stroke" ? (c.style || (c.style = {}), c.style.stroke = d) : c[r] = d;
|
|
2122
2161
|
if (this.physicsEngine && ((g = n == null ? void 0 : n.physics) != null && g.enabled) && n.physics.bodyType === "Static")
|
|
2123
2162
|
if (r === "x") {
|
|
2124
|
-
const
|
|
2125
|
-
|
|
2163
|
+
const u = this.physicsEngine.getPosition(i);
|
|
2164
|
+
u && this.physicsEngine.setPosition(i, d, u.y);
|
|
2126
2165
|
} else if (r === "y") {
|
|
2127
|
-
const
|
|
2128
|
-
|
|
2129
|
-
} else r === "rotation" && this.physicsEngine.setRotation(i,
|
|
2166
|
+
const u = this.physicsEngine.getPosition(i);
|
|
2167
|
+
u && this.physicsEngine.setPosition(i, u.x, d);
|
|
2168
|
+
} else r === "rotation" && this.physicsEngine.setRotation(i, d * (Math.PI / 180));
|
|
2130
2169
|
}
|
|
2131
2170
|
});
|
|
2132
2171
|
}
|
|
@@ -2160,15 +2199,15 @@ class fs {
|
|
|
2160
2199
|
return this.interpolateFill(o.value, e.value, n);
|
|
2161
2200
|
const a = {};
|
|
2162
2201
|
return (/* @__PURE__ */ new Set([...Object.keys(o.value), ...Object.keys(e.value)])).forEach((c) => {
|
|
2163
|
-
const
|
|
2164
|
-
typeof
|
|
2202
|
+
const d = o.value[c], l = e.value[c];
|
|
2203
|
+
typeof d == "number" && typeof l == "number" ? a[c] = d + (l - d) * n : d === void 0 ? a[c] = l : l === void 0 ? a[c] = d : a[c] = n < 0.5 ? d : l;
|
|
2165
2204
|
}), a;
|
|
2166
2205
|
}
|
|
2167
2206
|
return typeof o.value == "number" && typeof e.value == "number" ? o.value + (e.value - o.value) * n : n < 0.5 ? o.value : e.value;
|
|
2168
2207
|
}
|
|
2169
2208
|
interpolateColor(t, s, o) {
|
|
2170
|
-
var
|
|
2171
|
-
const e = ((
|
|
2209
|
+
var u, p;
|
|
2210
|
+
const e = ((p = (u = this.artboard) == null ? void 0 : u.tokens) == null ? void 0 : p.colors) || {}, i = e[t] || t, n = e[s] || s, a = (m) => {
|
|
2172
2211
|
if (!m) return { r: 0, g: 0, b: 0 };
|
|
2173
2212
|
const y = m.startsWith("#") ? m.replace("#", "") : "000000";
|
|
2174
2213
|
return y.length === 3 ? {
|
|
@@ -2180,11 +2219,11 @@ class fs {
|
|
|
2180
2219
|
g: parseInt(y.substring(2, 4), 16),
|
|
2181
2220
|
b: parseInt(y.substring(4, 6), 16)
|
|
2182
2221
|
};
|
|
2183
|
-
}, r = a(i), c = a(n),
|
|
2222
|
+
}, r = a(i), c = a(n), d = Math.round(r.r + (c.r - r.r) * o), l = Math.round(r.g + (c.g - r.g) * o), f = Math.round(r.b + (c.b - r.b) * o), g = (m) => {
|
|
2184
2223
|
const y = Math.max(0, Math.min(255, m)).toString(16);
|
|
2185
2224
|
return y.length === 1 ? "0" + y : y;
|
|
2186
2225
|
};
|
|
2187
|
-
return `#${g(
|
|
2226
|
+
return `#${g(d)}${g(l)}${g(f)}`;
|
|
2188
2227
|
}
|
|
2189
2228
|
interpolateStops(t, s, o) {
|
|
2190
2229
|
return !t || !s || t.length !== s.length ? o < 0.5 ? t : s : t.map((e, i) => {
|
|
@@ -2216,8 +2255,8 @@ class fs {
|
|
|
2216
2255
|
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;
|
|
2217
2256
|
}
|
|
2218
2257
|
render(t, s, o) {
|
|
2219
|
-
var
|
|
2220
|
-
this.debug_objectsTotal = ((
|
|
2258
|
+
var d;
|
|
2259
|
+
this.debug_objectsTotal = ((d = this.artboard) == null ? void 0 : d.objects.length) || 0, this.debug_objectsRendered = 0;
|
|
2221
2260
|
const e = performance.now();
|
|
2222
2261
|
if (this.canvasWidth = s, this.canvasHeight = o, !this.artboard)
|
|
2223
2262
|
return;
|
|
@@ -2235,33 +2274,33 @@ class fs {
|
|
|
2235
2274
|
let f = this.imageCache.get(l);
|
|
2236
2275
|
if (f || (f = new Image(), f.src = l, this.imageCache.set(l, f)), f.complete && f.naturalWidth > 0) {
|
|
2237
2276
|
t.save(), t.globalAlpha = this.normalizeOpacity(this.artboard.backgroundOpacity ?? 100);
|
|
2238
|
-
const g = f.naturalWidth / f.naturalHeight,
|
|
2239
|
-
let
|
|
2240
|
-
|
|
2277
|
+
const g = f.naturalWidth / f.naturalHeight, u = i / n;
|
|
2278
|
+
let p, m, y, S;
|
|
2279
|
+
u > g ? (p = i, m = i / g) : (m = n, p = n * g), y = -p / 2, S = -m / 2, t.drawImage(f, y, S, p, m), t.restore();
|
|
2241
2280
|
}
|
|
2242
2281
|
}
|
|
2243
2282
|
t.beginPath(), t.rect(-i / 2, -n / 2, i, n), t.clip();
|
|
2244
2283
|
const r = /* @__PURE__ */ new Map();
|
|
2245
2284
|
this.artboard.objects.forEach((l) => r.set(l.id, l)), this.artboard.objects.filter((l) => !l.parentId).map((l, f) => {
|
|
2246
|
-
const g = this.objectStates.get(l.id),
|
|
2247
|
-
return { obj: l, zIndex:
|
|
2285
|
+
const g = this.objectStates.get(l.id), u = (g == null ? void 0 : g.zIndex) ?? f;
|
|
2286
|
+
return { obj: l, zIndex: u };
|
|
2248
2287
|
}).sort((l, f) => l.zIndex - f.zIndex).forEach(({ obj: l }) => {
|
|
2249
2288
|
this.renderObject(t, l, r);
|
|
2250
2289
|
}), 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();
|
|
2251
2290
|
}
|
|
2252
2291
|
isObjectInView(t, s, o, e, i, n = 0) {
|
|
2253
|
-
const a = t.getTransform(), r = s * a.a + o * a.c + a.e, c = s * a.b + o * a.d + a.f,
|
|
2292
|
+
const a = t.getTransform(), r = s * a.a + o * a.c + a.e, c = s * a.b + o * a.d + a.f, d = Math.sqrt(a.a * a.a + a.b * a.b), l = Math.sqrt(a.c * a.c + a.d * a.d), f = (e / 2 + n) * d, g = (i / 2 + n) * l;
|
|
2254
2293
|
return r + f >= 0 && r - f <= this.canvasWidth && c + g >= 0 && c - g <= this.canvasHeight;
|
|
2255
2294
|
}
|
|
2256
2295
|
calculateTransform(t, s, o, e, i, n) {
|
|
2257
2296
|
let a = 1, r = 1, c = 1;
|
|
2258
|
-
const
|
|
2297
|
+
const d = o / e, l = t / s;
|
|
2259
2298
|
switch (i) {
|
|
2260
2299
|
case "Contain":
|
|
2261
|
-
l >
|
|
2300
|
+
l > d ? c = s / e : c = t / o, a = r = c;
|
|
2262
2301
|
break;
|
|
2263
2302
|
case "Cover":
|
|
2264
|
-
l >
|
|
2303
|
+
l > d ? c = t / o : c = s / e, a = r = c;
|
|
2265
2304
|
break;
|
|
2266
2305
|
case "Fill":
|
|
2267
2306
|
a = t / o, r = s / e;
|
|
@@ -2283,8 +2322,8 @@ class fs {
|
|
|
2283
2322
|
break;
|
|
2284
2323
|
}
|
|
2285
2324
|
const f = o * a, g = e * r;
|
|
2286
|
-
let
|
|
2287
|
-
return n.includes("Left") ?
|
|
2325
|
+
let u = 0, p = 0;
|
|
2326
|
+
return n.includes("Left") ? u = 0 : n.includes("Right") ? u = t - f : u = (t - f) / 2, n.includes("Top") ? p = 0 : n.includes("Bottom") ? p = s - g : p = (s - g) / 2, { scaleX: a, scaleY: r, tx: u, ty: p };
|
|
2288
2327
|
}
|
|
2289
2328
|
mapFontWeight(t) {
|
|
2290
2329
|
const s = t.toLowerCase();
|
|
@@ -2306,7 +2345,7 @@ class fs {
|
|
|
2306
2345
|
}
|
|
2307
2346
|
*/
|
|
2308
2347
|
renderObject(t, s, o) {
|
|
2309
|
-
var
|
|
2348
|
+
var p, m, y, S, b, v, w, k, A, x, B, F, K, tt, rt, at, V;
|
|
2310
2349
|
const e = this.objectStates.get(s.id);
|
|
2311
2350
|
if (!e) {
|
|
2312
2351
|
console.warn("No state for object:", s.id);
|
|
@@ -2314,7 +2353,7 @@ class fs {
|
|
|
2314
2353
|
}
|
|
2315
2354
|
this.frameCount % 60, t.roundRect || (t.roundRect = (O, $, P, J, Z) => (this.drawRoundRect(t, O, $, P, J, Z), t));
|
|
2316
2355
|
const i = e.geometry ? this.deepMerge(s.geometry, e.geometry) : s.geometry, n = e.style ? this.deepMerge(s.style, e.style) : s.style;
|
|
2317
|
-
let a = (i == null ? void 0 : i.width) || ((
|
|
2356
|
+
let a = (i == null ? void 0 : i.width) || ((p = s.geometry) == null ? void 0 : p.width) || s.width || 0, r = (i == null ? void 0 : i.height) || ((m = s.geometry) == null ? void 0 : m.height) || s.height || 0;
|
|
2318
2357
|
if ((a === 0 || r === 0) && (i != null && i.points) && Array.isArray(i.points) && i.points.length > 0) {
|
|
2319
2358
|
let O = 1 / 0, $ = -1 / 0, P = 1 / 0, J = -1 / 0;
|
|
2320
2359
|
i.points.forEach((Z) => {
|
|
@@ -2324,11 +2363,11 @@ class fs {
|
|
|
2324
2363
|
const c = (O) => {
|
|
2325
2364
|
if (O)
|
|
2326
2365
|
return O.corner_radius ?? O.cornerRadius;
|
|
2327
|
-
},
|
|
2328
|
-
if (delete l.cornerRadius, l.corner_radius =
|
|
2366
|
+
}, d = c(e) ?? c(n) ?? c(i) ?? c(s.style) ?? c(s.geometry) ?? 0, l = { ...i, width: a, height: r };
|
|
2367
|
+
if (delete l.cornerRadius, l.corner_radius = d, e.visible === !1)
|
|
2329
2368
|
return;
|
|
2330
|
-
const f = s.repeaterConfig, g = f && f.isEnabled && f.count > 1,
|
|
2331
|
-
for (let O = 0; O <
|
|
2369
|
+
const f = s.repeaterConfig, g = f && f.isEnabled && f.count > 1, u = g ? f.count : 1;
|
|
2370
|
+
for (let O = 0; O < u; O++) {
|
|
2332
2371
|
let $ = e.x, P = e.y, J = e.rotation, Z = e.scale_x ?? 1, lt = e.scale_y ?? 1;
|
|
2333
2372
|
if (g && O > 0) {
|
|
2334
2373
|
if (f.type === "Linear") {
|
|
@@ -2342,16 +2381,16 @@ class fs {
|
|
|
2342
2381
|
$ = e.x + st * Math.cos(bt), P = e.y + st * Math.sin(bt), J += j;
|
|
2343
2382
|
}
|
|
2344
2383
|
}
|
|
2345
|
-
const
|
|
2346
|
-
if (!
|
|
2384
|
+
const Y = s.type === "Group" || s.type === "Frame" || s.type === "Component", H = a > 0 && r > 0;
|
|
2385
|
+
if (!Y && H) {
|
|
2347
2386
|
const st = (((y = n.shadow) == null ? void 0 : y.isEnabled) !== !1 ? (((S = n.shadow) == null ? void 0 : S.blur) || 0) + 10 : 0) + (((b = n.blur) == null ? void 0 : b.isEnabled) !== !1 && ((v = n.blur) == null ? void 0 : v.radius) || 0) + 20;
|
|
2348
2387
|
if (!this.isObjectInView(t, $, P, a, r, st))
|
|
2349
2388
|
continue;
|
|
2350
2389
|
}
|
|
2351
2390
|
this.debug_objectsRendered++, t.save();
|
|
2352
|
-
const it = [], nt = n.blur || ((
|
|
2391
|
+
const it = [], nt = n.blur || ((w = s.style) == null ? void 0 : w.blur);
|
|
2353
2392
|
nt && nt.amount > 0 && it.push(`blur(${nt.amount}px)`);
|
|
2354
|
-
const ft = ((k = i == null ? void 0 : i.type) == null ? void 0 : k.toLowerCase().includes("image")) || ((A = s.type) == null ? void 0 : A.toLowerCase().includes("image")), M = n.adjustments && Object.keys(n.adjustments).length > 0 ? n.adjustments : null, Q = i != null && i.adjustments && Object.keys(i.adjustments).length > 0 ? i.adjustments : null,
|
|
2393
|
+
const ft = ((k = i == null ? void 0 : i.type) == null ? void 0 : k.toLowerCase().includes("image")) || ((A = s.type) == null ? void 0 : A.toLowerCase().includes("image")), M = n.adjustments && Object.keys(n.adjustments).length > 0 ? n.adjustments : null, Q = i != null && i.adjustments && Object.keys(i.adjustments).length > 0 ? i.adjustments : null, N = ft ? Q || M : M || Q, L = ft && !N ? {
|
|
2355
2394
|
exposure: 0,
|
|
2356
2395
|
contrast: 0,
|
|
2357
2396
|
saturation: 100,
|
|
@@ -2362,7 +2401,7 @@ class fs {
|
|
|
2362
2401
|
blur: 0,
|
|
2363
2402
|
negative: 0,
|
|
2364
2403
|
hue: 0
|
|
2365
|
-
} :
|
|
2404
|
+
} : N;
|
|
2366
2405
|
if (e && L && (e.geometry = e.geometry || {}, e.geometry.adjustments = { ...L }), L) {
|
|
2367
2406
|
const st = (L.exposure || 0) / 100, ct = L.contrast || 0, _ = 1 + (L.saturation || 0) / 100, C = (L.temperature || 0) / 200, W = (L.tint || 0) / 200, j = (L.highlights || 0) / 500, bt = (L.shadows || 0) / 500;
|
|
2368
2407
|
let Mt = "", ht = "SourceGraphic";
|
|
@@ -2372,12 +2411,12 @@ class fs {
|
|
|
2372
2411
|
<feFuncG type="linear" slope="1" intercept="${st}"/>
|
|
2373
2412
|
<feFuncB type="linear" slope="1" intercept="${st}"/>
|
|
2374
2413
|
</feComponentTransfer>`, ht = "exposure"), ct !== 0) {
|
|
2375
|
-
const mt = (ct + 100) / 100,
|
|
2414
|
+
const mt = (ct + 100) / 100, I = 0.5 * (1 - mt);
|
|
2376
2415
|
Mt += `
|
|
2377
2416
|
<feComponentTransfer in="${ht}" result="contrast">
|
|
2378
|
-
<feFuncR type="linear" slope="${mt}" intercept="${
|
|
2379
|
-
<feFuncG type="linear" slope="${mt}" intercept="${
|
|
2380
|
-
<feFuncB type="linear" slope="${mt}" intercept="${
|
|
2417
|
+
<feFuncR type="linear" slope="${mt}" intercept="${I}"/>
|
|
2418
|
+
<feFuncG type="linear" slope="${mt}" intercept="${I}"/>
|
|
2419
|
+
<feFuncB type="linear" slope="${mt}" intercept="${I}"/>
|
|
2381
2420
|
</feComponentTransfer>`, ht = "contrast";
|
|
2382
2421
|
}
|
|
2383
2422
|
if (_ !== 1 && (Mt += `<feColorMatrix in="${ht}" type="saturate" values="${_}" result="saturate"/>`, ht = "saturate"), L.hue && (Mt += `<feColorMatrix in="${ht}" type="hueRotate" values="${L.hue}" result="hue"/>`, ht = "hue"), L.negative) {
|
|
@@ -2390,8 +2429,8 @@ class fs {
|
|
|
2390
2429
|
0 0 0 1 0"/>`, ht = "invert";
|
|
2391
2430
|
}
|
|
2392
2431
|
if (C !== 0 || W !== 0 || j !== 0 || bt !== 0) {
|
|
2393
|
-
const mt = 1 + j + bt,
|
|
2394
|
-
|
|
2432
|
+
const mt = 1 + j + bt, I = mt * (1 + C - W / 2), _t = mt * (1 + W), Bt = mt * (1 - C - W / 2), Rt = L.shadows * 0.1 / 255, dt = [
|
|
2433
|
+
I,
|
|
2395
2434
|
0,
|
|
2396
2435
|
0,
|
|
2397
2436
|
0,
|
|
@@ -2415,8 +2454,8 @@ class fs {
|
|
|
2415
2454
|
Mt += `<feColorMatrix in="${ht}" type="matrix" values="${dt}" result="advanced"/>`, ht = "advanced";
|
|
2416
2455
|
}
|
|
2417
2456
|
if (L.blur && (Mt += `<feGaussianBlur in="${ht}" stdDeviation="${L.blur}" result="blur"/>`, ht = "blur"), Mt) {
|
|
2418
|
-
const mt = `<svg xmlns="http://www.w3.org/2000/svg"><filter id="f" color-interpolation-filters="sRGB">${Mt}</filter></svg>`,
|
|
2419
|
-
it.push(`url('data:image/svg+xml;base64,${
|
|
2457
|
+
const mt = `<svg xmlns="http://www.w3.org/2000/svg"><filter id="f" color-interpolation-filters="sRGB">${Mt}</filter></svg>`, I = btoa(mt);
|
|
2458
|
+
it.push(`url('data:image/svg+xml;base64,${I}#f')`);
|
|
2420
2459
|
}
|
|
2421
2460
|
}
|
|
2422
2461
|
it.length > 0 ? t.filter = it.join(" ") : t.filter = "none", t.imageSmoothingEnabled = !0, t.imageSmoothingQuality = "high";
|
|
@@ -2483,19 +2522,19 @@ class fs {
|
|
|
2483
2522
|
const ct = this.normalizeOpacity($t.opacity ?? 100), _ = $t.spread || 0, W = ($t.blur || 0) + _ * 1.5;
|
|
2484
2523
|
let j = st;
|
|
2485
2524
|
if (st.startsWith("#")) {
|
|
2486
|
-
const ht = st.replace("#", ""), Et = parseInt(ht.substring(0, 2), 16), mt = parseInt(ht.substring(2, 4), 16),
|
|
2487
|
-
j = `rgba(${Et}, ${mt}, ${
|
|
2525
|
+
const ht = st.replace("#", ""), Et = parseInt(ht.substring(0, 2), 16), mt = parseInt(ht.substring(2, 4), 16), I = parseInt(ht.substring(4, 6), 16);
|
|
2526
|
+
j = `rgba(${Et}, ${mt}, ${I}, ${ct})`;
|
|
2488
2527
|
} else if (st.startsWith("rgba")) {
|
|
2489
2528
|
const ht = st.match(/[\d.]+/g);
|
|
2490
2529
|
if (ht && ht.length >= 4) {
|
|
2491
|
-
const Et = ht[0], mt = ht[1],
|
|
2492
|
-
j = `rgba(${Et}, ${mt}, ${
|
|
2530
|
+
const Et = ht[0], mt = ht[1], I = ht[2], _t = ht[3];
|
|
2531
|
+
j = `rgba(${Et}, ${mt}, ${I}, ${parseFloat(_t) * ct})`;
|
|
2493
2532
|
}
|
|
2494
2533
|
}
|
|
2495
2534
|
const bt = t.getTransform(), Mt = Math.sqrt(bt.a * bt.a + bt.b * bt.b) || 1;
|
|
2496
2535
|
t.shadowColor = j, t.shadowBlur = W * Mt, t.shadowOffsetX = ($t.offsetX || 0) * Mt, t.shadowOffsetY = ($t.offsetY || 0) * Mt;
|
|
2497
2536
|
}
|
|
2498
|
-
const Lt = s.liquidFill || ((F = s.style) == null ? void 0 : F.liquidFill),
|
|
2537
|
+
const Lt = s.liquidFill || ((F = s.style) == null ? void 0 : F.liquidFill), Yt = s.artEffect || ((K = s.style) == null ? void 0 : K.artEffect);
|
|
2499
2538
|
if (Lt && Lt.enabled) {
|
|
2500
2539
|
t.save();
|
|
2501
2540
|
const st = Lt.fillLevel ?? 0.5;
|
|
@@ -2503,8 +2542,8 @@ class fs {
|
|
|
2503
2542
|
const ct = r / 2 - r * st;
|
|
2504
2543
|
t.rect(-a / 2, ct, a, r * st), t.clip(), t.fillStyle = Lt.color || "#3b82f6", t.globalAlpha = t.globalAlpha * (Lt.opacity ?? 1);
|
|
2505
2544
|
}
|
|
2506
|
-
if (
|
|
2507
|
-
const st =
|
|
2545
|
+
if (Yt && Yt.enabled) {
|
|
2546
|
+
const st = Yt.type, ct = Yt.intensity ?? 0.5;
|
|
2508
2547
|
if (st === "glitch") {
|
|
2509
2548
|
t.save();
|
|
2510
2549
|
const _ = ct * 10, C = t.getTransform(), W = Math.sqrt(C.a * C.a + C.b * C.b) || 1;
|
|
@@ -2523,12 +2562,12 @@ class fs {
|
|
|
2523
2562
|
console.error("[ExodeUI] Image load failed:", W, `Src preview: ${st.substring(0, 100)}...`);
|
|
2524
2563
|
}, ct.src = st, this.imageCache.set(st, ct));
|
|
2525
2564
|
const _ = n.stroke && n.stroke.width > 0 && n.stroke.isEnabled !== !1, C = (((tt = n.stroke) == null ? void 0 : tt.alignment) || "center").toLowerCase();
|
|
2526
|
-
if (_ && (C === "outside" || C === "center") && this.applyStrokeAlignment(t, n, l, a, r,
|
|
2565
|
+
if (_ && (C === "outside" || C === "center") && this.applyStrokeAlignment(t, n, l, a, r, d), n.fill && n.fill.type !== "None") {
|
|
2527
2566
|
t.save();
|
|
2528
2567
|
const W = t.globalAlpha, j = this.createCanvasFill(t, n.fill, a, r);
|
|
2529
|
-
t.fillStyle = j || n.fill.color || "transparent", t.globalAlpha = W * this.normalizeOpacity(n.fill.opacity ?? 100),
|
|
2568
|
+
t.fillStyle = j || n.fill.color || "transparent", t.globalAlpha = W * this.normalizeOpacity(n.fill.opacity ?? 100), d !== 0 ? (this.drawRoundRect(t, -a / 2, -r / 2, a, r, d), t.fill()) : t.fillRect(-a / 2, -r / 2, a, r), t.globalAlpha = W, t.restore();
|
|
2530
2569
|
}
|
|
2531
|
-
ct.complete && ct.naturalWidth > 0 ? (
|
|
2570
|
+
ct.complete && ct.naturalWidth > 0 ? (d !== 0 ? (t.save(), this.drawRoundRect(t, -a / 2, -r / 2, a, r, d), t.clip(), t.drawImage(ct, -a / 2, -r / 2, a, r), t.restore()) : t.drawImage(ct, -a / 2, -r / 2, a, r), _ && C === "inside" && this.applyStrokeAlignment(t, n, l, a, r, d)) : _ && C === "inside" && this.applyStrokeAlignment(t, n, l, a, r, d);
|
|
2532
2571
|
}
|
|
2533
2572
|
} else if (i.type === "SVG") {
|
|
2534
2573
|
const st = i.svgContent;
|
|
@@ -2563,105 +2602,105 @@ class fs {
|
|
|
2563
2602
|
let Et = this.imageCache.get(ht);
|
|
2564
2603
|
if (!Et) {
|
|
2565
2604
|
Et = new Image(), Et.crossOrigin = "anonymous";
|
|
2566
|
-
let
|
|
2567
|
-
if (
|
|
2568
|
-
if (ct[
|
|
2605
|
+
let I = st;
|
|
2606
|
+
if (I.match(/xmlns\s*=\s*["']http:\/\/www\.w3\.org\/2000\/svg["']/i) || (I = I.replace(/<svg([^>]*)>/i, (T, G) => G.includes("xmlns=") ? T : `<svg xmlns="http://www.w3.org/2000/svg"${G}>`)), i.colors && i.colors.length > 0 && ct.length > 0 && i.colors.forEach((T, G) => {
|
|
2607
|
+
if (ct[G]) {
|
|
2569
2608
|
const ut = T.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"), E = new RegExp(ut, "gi");
|
|
2570
|
-
|
|
2609
|
+
I = I.replace(E, ct[G]);
|
|
2571
2610
|
}
|
|
2572
2611
|
}), _ && _.type && _.type !== "None") {
|
|
2573
2612
|
if (_.type === "Solid" && _.color) {
|
|
2574
|
-
const T = j ? "#FFFFFF" : _.color,
|
|
2575
|
-
|
|
2613
|
+
const T = j ? "#FFFFFF" : _.color, G = j ? 1 : this.normalizeOpacity(_.opacity ?? 100);
|
|
2614
|
+
I = I.replace(/\bfill\s*=\s*["'][^"']*["']/gi, (ut) => /fill\s*=\s*["']\s*(none|transparent)\s*["']/i.test(ut) ? ut : `fill="${T}"`), I = I.replace(/fill\s*:\s*[^;"')]+/gi, (ut) => /fill\s*:\s*(none|transparent)/i.test(ut) ? ut : `fill:${T}`), G < 1 && (I = I.replace(/\bfill-opacity\s*=\s*["'][^"']*["']/gi, `fill-opacity="${G}"`), I = I.replace(/fill-opacity\s*:\s*[^;"')]+/gi, `fill-opacity:${G}`), I.match(/\bfill-opacity\s*=/i) || (I = I.replace(/(<svg[^>]*>)/i, `$1<g fill-opacity="${G}">`), I = I.replace(/<\/svg>/i, "</g></svg>")));
|
|
2576
2615
|
} else if (_.type === "LinearGradient" || _.type === "RadialGradient" || _.type === "Linear" || _.type === "Radial") {
|
|
2577
|
-
const T = "exode-fill",
|
|
2578
|
-
const et = R.offset !== void 0 ? R.offset : R.pos ?? 0, Ct = this.normalizeOpacity(R.opacity ?? 100) *
|
|
2616
|
+
const T = "exode-fill", G = this.normalizeOpacity(_.opacity ?? 100), ut = (_.stops || []).map((R) => {
|
|
2617
|
+
const et = R.offset !== void 0 ? R.offset : R.pos ?? 0, Ct = this.normalizeOpacity(R.opacity ?? 100) * G;
|
|
2579
2618
|
return `<stop offset="${et * 100}%" stop-color="${R.color || "#000"}" stop-opacity="${Ct}"/>`;
|
|
2580
2619
|
}).join("");
|
|
2581
2620
|
let E = "";
|
|
2582
2621
|
if (_.type === "LinearGradient" || _.type === "Linear") {
|
|
2583
|
-
const R = (Ot,
|
|
2622
|
+
const R = (Ot, wt) => Array.isArray(Ot) ? Ot[wt] ?? (wt === 0 ? 0 : 1) : Ot && typeof Ot == "object" ? Ot[wt === 0 ? "x" : "y"] ?? (wt === 0 ? 0 : 1) : wt === 0 ? 0 : 1, et = R(_.start, 0) * 100, Ct = R(_.start, 1) * 100, Pt = R(_.end, 0) * 100, St = R(_.end, 1) * 100;
|
|
2584
2623
|
E = `<linearGradient id="${T}" x1="${et}%" y1="${Ct}%" x2="${Pt}%" y2="${St}%" gradientUnits="objectBoundingBox">${ut}</linearGradient>`;
|
|
2585
2624
|
} else {
|
|
2586
2625
|
const R = (St, Ot) => Array.isArray(St) ? St[Ot] ?? 0.5 : St && typeof St == "object" ? St[Ot === 0 ? "x" : "y"] ?? 0.5 : 0.5, et = R(_.center, 0) * 100, Ct = R(_.center, 1) * 100, Pt = (_.radius ?? 0.5) * 100;
|
|
2587
2626
|
E = `<radialGradient id="${T}" cx="${et}%" cy="${Ct}%" r="${Pt}%" gradientUnits="objectBoundingBox">${ut}</radialGradient>`;
|
|
2588
2627
|
}
|
|
2589
|
-
/<defs>/i.test(
|
|
2628
|
+
/<defs>/i.test(I) ? I = I.replace(/<defs>/i, `<defs>${E}`) : I = I.replace(/<svg([^>]*)>/i, `<svg$1><defs>${E}</defs>`), I = I.replace(/\bfill\s*=\s*["'][^"']*["']/gi, (R) => /fill\s*=\s*["']\s*(none|transparent)\s*["']/i.test(R) ? R : `fill="url(#${T})"`), I = I.replace(/fill\s*:\s*[^;"')]+/gi, (R) => /fill\s*:\s*(none|transparent)/i.test(R) ? R : `fill:url(#${T})`);
|
|
2590
2629
|
}
|
|
2591
2630
|
}
|
|
2592
|
-
const _t = (T,
|
|
2631
|
+
const _t = (T, G, ut = 1) => {
|
|
2593
2632
|
const E = (T.stops || []).map((St) => {
|
|
2594
|
-
const Ot = St.offset !== void 0 ? St.offset : St.pos ?? 0,
|
|
2595
|
-
return `<stop offset="${Ot * 100}%" stop-color="${St.color || "#000"}" stop-opacity="${
|
|
2596
|
-
}).join(""), R = (St, Ot,
|
|
2633
|
+
const Ot = St.offset !== void 0 ? St.offset : St.pos ?? 0, wt = this.normalizeOpacity(St.opacity ?? 100) * ut;
|
|
2634
|
+
return `<stop offset="${Ot * 100}%" stop-color="${St.color || "#000"}" stop-opacity="${wt}"/>`;
|
|
2635
|
+
}).join(""), R = (St, Ot, wt = 0.5) => Array.isArray(St) ? St[Ot] ?? wt : St && typeof St == "object" ? St[Ot === 0 ? "x" : "y"] ?? wt : wt;
|
|
2597
2636
|
if (T.type === "LinearGradient" || T.type === "Linear") {
|
|
2598
|
-
const St = R(T.start, 0, 0) * 100, Ot = R(T.start, 1, 0) * 100,
|
|
2599
|
-
return `<linearGradient id="${
|
|
2637
|
+
const St = R(T.start, 0, 0) * 100, Ot = R(T.start, 1, 0) * 100, wt = R(T.end, 0, 1) * 100, Vt = R(T.end, 1, 1) * 100;
|
|
2638
|
+
return `<linearGradient id="${G}" x1="${St}%" y1="${Ot}%" x2="${wt}%" y2="${Vt}%" gradientUnits="objectBoundingBox">${E}</linearGradient>`;
|
|
2600
2639
|
}
|
|
2601
2640
|
const et = R(T.center, 0, 0.5) * 100, Ct = R(T.center, 1, 0.5) * 100, Pt = (T.radius ?? 0.5) * 100;
|
|
2602
|
-
return `<radialGradient id="${
|
|
2603
|
-
}, Bt = (T,
|
|
2641
|
+
return `<radialGradient id="${G}" cx="${et}%" cy="${Ct}%" r="${Pt}%" gradientUnits="objectBoundingBox">${E}</radialGradient>`;
|
|
2642
|
+
}, Bt = (T, G) => /<defs>/i.test(T) ? T.replace(/<defs>/i, `<defs>${G}`) : T.replace(/(<svg[^>]*>)/i, `$1<defs>${G}</defs>`);
|
|
2604
2643
|
if (C && C.isEnabled !== !1 && (C.width || 0) > 0) {
|
|
2605
|
-
const T = C.width || 1,
|
|
2644
|
+
const T = C.width || 1, G = j ? 1 : this.normalizeOpacity(C.opacity ?? 100), ut = j ? "#FFFFFF" : C.color || (_ == null ? void 0 : _.color) || "#000000";
|
|
2606
2645
|
let E = "";
|
|
2607
2646
|
const R = C.fill;
|
|
2608
2647
|
if (R && R.type) {
|
|
2609
2648
|
if (R.type === "Solid")
|
|
2610
2649
|
E = R.color || C.color || "#000000";
|
|
2611
2650
|
else if (R.type === "LinearGradient" || R.type === "RadialGradient" || R.type === "Linear" || R.type === "Radial") {
|
|
2612
|
-
const
|
|
2613
|
-
|
|
2651
|
+
const wt = "exode-stroke";
|
|
2652
|
+
I = Bt(I, _t(R, wt, G)), E = `url(#${wt})`;
|
|
2614
2653
|
}
|
|
2615
2654
|
}
|
|
2616
|
-
E || (E = ut),
|
|
2655
|
+
E || (E = ut), I.match(/\bstroke\s*=\s*["']/i) ? I = I.replace(
|
|
2617
2656
|
/\bstroke\s*=\s*["'][^"']*["']/gi,
|
|
2618
|
-
(
|
|
2619
|
-
) :
|
|
2657
|
+
(wt) => /stroke\s*=\s*["']\s*(none|transparent)\s*["']/i.test(wt) ? wt : `stroke="${E}"`
|
|
2658
|
+
) : I = I.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke="${E}"`), I = I.replace(
|
|
2620
2659
|
new RegExp(`(?<![a-z-])stroke\\s*:\\s*(?!none|transparent)[^;"')]+`, "gi"),
|
|
2621
2660
|
`stroke:${E}`
|
|
2622
|
-
),
|
|
2661
|
+
), I.match(/\bstroke-width\s*=\s*["']/i) ? I = I.replace(/\bstroke-width\s*=\s*["'][^"']*["']/gi, `stroke-width="${T}"`) : I = I.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-width="${T}"`), I = I.replace(/stroke-width\s*:\s*[^;"')]+/gi, `stroke-width:${T}`), I.match(/\bstroke-opacity\s*=\s*["']/i) ? I = I.replace(/\bstroke-opacity\s*=\s*["'][^"']*["']/gi, `stroke-opacity="${G}"`) : I = I.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-opacity="${G}"`), I = I.replace(/stroke-opacity\s*:\s*[^;"')]+/gi, `stroke-opacity:${G}`), C.lineCap && (I = I.replace(/\bstroke-linecap\s*=\s*["'][^"']*["']/gi, `stroke-linecap="${C.lineCap}"`), I = I.replace(/stroke-linecap\s*:\s*[^;"')]+/gi, `stroke-linecap:${C.lineCap}`)), C.lineJoin && (I = I.replace(/\bstroke-linejoin\s*=\s*["'][^"']*["']/gi, `stroke-linejoin="${C.lineJoin}"`), I = I.replace(/stroke-linejoin\s*:\s*[^;"')]+/gi, `stroke-linejoin:${C.lineJoin}`));
|
|
2623
2662
|
const et = C.trimStart ?? 0, Ct = C.trimEnd ?? 1, Pt = C.trimOffset ?? 0, St = C.dashOffset ?? 0, Ot = et !== 0 || Ct !== 1 || Pt !== 0 || St !== 0;
|
|
2624
2663
|
if (Ot) {
|
|
2625
|
-
const
|
|
2626
|
-
this.frameCount % 600 === 0 && this.debugLog(`SVG Trim - Object: ${s.name || s.id}, Start: ${
|
|
2664
|
+
const wt = Math.max(0, Math.min(1, et)), Vt = Math.max(0, Math.min(1, Ct));
|
|
2665
|
+
this.frameCount % 600 === 0 && this.debugLog(`SVG Trim - Object: ${s.name || s.id}, Start: ${wt}, End: ${Vt}`);
|
|
2627
2666
|
let Ut = i.width || a || 100, qt = i.height || r || 100;
|
|
2628
2667
|
const U = st.match(/viewBox=["']\s*0\s+0\s+([\d.]+)\s+([\d.]+)\s*["']/i);
|
|
2629
2668
|
if (U) {
|
|
2630
|
-
const
|
|
2631
|
-
!isNaN(
|
|
2669
|
+
const Xt = parseFloat(U[1]), Ht = parseFloat(U[2]);
|
|
2670
|
+
!isNaN(Xt) && !isNaN(Ht) && (Ut = Xt, qt = Ht);
|
|
2632
2671
|
}
|
|
2633
|
-
const
|
|
2634
|
-
let At = "",
|
|
2635
|
-
if (
|
|
2636
|
-
At = `0 ${
|
|
2672
|
+
const X = (Ut + qt) * 2, q = (Pt % 1 + 1) % 1, It = (St % 1 + 1) % 1;
|
|
2673
|
+
let At = "", Gt = 0;
|
|
2674
|
+
if (wt >= Vt)
|
|
2675
|
+
At = `0 ${X}`, Gt = 0;
|
|
2637
2676
|
else {
|
|
2638
|
-
const
|
|
2639
|
-
|
|
2677
|
+
const Xt = X * (Vt - wt), Ht = X - Xt;
|
|
2678
|
+
Gt = -(X * (wt + q + It)), At = `${Xt} ${Ht}`;
|
|
2640
2679
|
}
|
|
2641
|
-
|
|
2680
|
+
I.match(/\bstroke-dasharray\s*=/i) ? I = I.replace(/\bstroke-dasharray\s*=\s*["'][^"']*["']/gi, `stroke-dasharray="${At}"`) : I = I.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-dasharray="${At}"`), I = I.replace(/stroke-dasharray\s*:\s*[^;"')]+/gi, `stroke-dasharray:${At}`), I.match(/\bstroke-dashoffset\s*=/i) ? I = I.replace(/\bstroke-dashoffset\s*=\s*["'][^"']*["']/gi, `stroke-dashoffset="${Gt}"`) : I = I.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-dashoffset="${Gt}"`), I = I.replace(/stroke-dashoffset\s*:\s*[^;"')]+/gi, `stroke-dashoffset:${Gt}`);
|
|
2642
2681
|
} else if (C.dashArray && C.dashArray.length > 0) {
|
|
2643
|
-
const
|
|
2644
|
-
|
|
2682
|
+
const wt = C.dashArray.join(" ");
|
|
2683
|
+
I = I.replace(/\bstroke-dasharray\s*=\s*["'][^"']*["']/gi, `stroke-dasharray="${wt}"`), I = I.replace(/stroke-dasharray\s*:\s*[^;"')]+/gi, `stroke-dasharray:${wt}`), C.dashOffset && (I = I.replace(/\bstroke-dashoffset\s*=\s*["'][^"']*["']/gi, `stroke-dashoffset="${C.dashOffset}"`), I = I.replace(/stroke-dashoffset\s*:\s*[^;"')]+/gi, `stroke-dashoffset:${C.dashOffset}`));
|
|
2645
2684
|
}
|
|
2646
2685
|
if (!/\bstroke\s*=\s*["']/i.test(st) && !new RegExp("(?<![a-z-])stroke\\s*:", "i").test(st)) {
|
|
2647
|
-
let
|
|
2686
|
+
let wt = "", Vt = "";
|
|
2648
2687
|
if (Ot) {
|
|
2649
|
-
const
|
|
2650
|
-
if (At >=
|
|
2651
|
-
|
|
2688
|
+
const X = i.width || a || 100, q = i.height || r || 100, It = (X + q) * 2, At = Math.max(0, Math.min(1, et)), Gt = Math.max(0, Math.min(1, Ct)), Xt = (Pt % 1 + 1) % 1, Ht = (St % 1 + 1) % 1;
|
|
2689
|
+
if (At >= Gt)
|
|
2690
|
+
wt = ` stroke-dasharray="0 ${It}"`, Vt = ' stroke-dashoffset="0"';
|
|
2652
2691
|
else {
|
|
2653
|
-
const ae =
|
|
2654
|
-
|
|
2692
|
+
const ae = It * (Gt - At), we = It - ae, Ie = -(It * (At + Xt + Ht));
|
|
2693
|
+
wt = ` stroke-dasharray="${ae} ${we}"`, Vt = ` stroke-dashoffset="${Ie}"`;
|
|
2655
2694
|
}
|
|
2656
|
-
} else (rt = C.dashArray) != null && rt.length && (
|
|
2657
|
-
const Ut = C.lineCap ? ` stroke-linecap="${C.lineCap}"` : "", qt = C.lineJoin ? ` stroke-linejoin="${C.lineJoin}"` : "", U = `stroke="${E}" stroke-width="${T}" stroke-opacity="${
|
|
2658
|
-
|
|
2695
|
+
} else (rt = C.dashArray) != null && rt.length && (wt = ` stroke-dasharray="${C.dashArray.join(" ")}"`, C.dashOffset && (Vt = ` stroke-dashoffset="${C.dashOffset}"`));
|
|
2696
|
+
const Ut = C.lineCap ? ` stroke-linecap="${C.lineCap}"` : "", qt = C.lineJoin ? ` stroke-linejoin="${C.lineJoin}"` : "", U = `stroke="${E}" stroke-width="${T}" stroke-opacity="${G}"${Ut}${qt}${wt}${Vt}`;
|
|
2697
|
+
I = I.replace(
|
|
2659
2698
|
/(<svg[^>]*>)(\s*(?:<defs>[\s\S]*?<\/defs>)?)/i,
|
|
2660
|
-
(
|
|
2661
|
-
),
|
|
2699
|
+
(X, q, It) => `${q}${It}<g ${U}>`
|
|
2700
|
+
), I = I.replace(/<\/svg>/i, "</g></svg>");
|
|
2662
2701
|
}
|
|
2663
|
-
} else C && C.isEnabled === !1 && (
|
|
2664
|
-
const Rt = new Blob([
|
|
2702
|
+
} else C && C.isEnabled === !1 && (I = I.replace(/\bstroke\s*=\s*["'][^"']*["']/gi, 'stroke="none"'), I = I.replace(new RegExp(`(?<![a-z-])stroke\\s*:\\s*(?!none|transparent)[^;"')]+`, "gi"), "stroke:none"));
|
|
2703
|
+
const Rt = new Blob([I], { type: "image/svg+xml" }), dt = URL.createObjectURL(Rt);
|
|
2665
2704
|
Et.onload = () => {
|
|
2666
2705
|
if (URL.revokeObjectURL(dt), this.frameCount % 900 === 0) {
|
|
2667
2706
|
const T = this.imageCache.get(ht);
|
|
@@ -2673,32 +2712,32 @@ class fs {
|
|
|
2673
2712
|
}
|
|
2674
2713
|
let mt = null;
|
|
2675
2714
|
if (Et.complete && Et.naturalWidth > 0 ? (mt = Et, this.lastValidSvgImgMap.set(s.id, Et)) : mt = this.lastValidSvgImgMap.get(s.id) || null, mt && mt.complete && mt.naturalWidth > 0) {
|
|
2676
|
-
const
|
|
2715
|
+
const I = Math.max(1, a), _t = Math.max(1, r);
|
|
2677
2716
|
if (j && (_ == null ? void 0 : _.type) === "Solid") {
|
|
2678
|
-
this.maskBuffer || (this.maskBuffer = document.createElement("canvas"), this.maskCtx = this.maskBuffer.getContext("2d")), this.maskBuffer.width =
|
|
2717
|
+
this.maskBuffer || (this.maskBuffer = document.createElement("canvas"), this.maskCtx = this.maskBuffer.getContext("2d")), this.maskBuffer.width = I, this.maskBuffer.height = _t, 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, I, _t), this.maskCtx.drawImage(mt, 0, 0, I, _t), this.maskCtx.globalCompositeOperation = "source-in";
|
|
2679
2718
|
const Bt = _.color || "#000000", Rt = this.normalizeOpacity(_.opacity ?? 100);
|
|
2680
|
-
this.maskCtx.fillStyle = Bt, this.maskCtx.globalAlpha = Rt, this.maskCtx.fillRect(0, 0,
|
|
2681
|
-
} else
|
|
2719
|
+
this.maskCtx.fillStyle = Bt, this.maskCtx.globalAlpha = Rt, this.maskCtx.fillRect(0, 0, I, _t), t.drawImage(this.maskBuffer, -I / 2, -_t / 2, I, _t);
|
|
2720
|
+
} else d !== 0 ? (t.save(), this.drawRoundRect(t, -I / 2, -_t / 2, I, _t, d), t.clip(), t.drawImage(mt, -I / 2, -_t / 2, I, _t), t.restore()) : t.drawImage(mt, -I / 2, -_t / 2, I, _t);
|
|
2682
2721
|
}
|
|
2683
2722
|
}
|
|
2684
2723
|
} else if (l.type === "LineGraph")
|
|
2685
2724
|
this.renderLineGraph(t, l, a, r);
|
|
2686
2725
|
else if (s.type === "Shape") {
|
|
2687
|
-
if (this.applyPath(t, l, a, r,
|
|
2726
|
+
if (this.applyPath(t, l, a, r, d), t.save(), n.blur && n.blur.amount > 0 && (t.filter = `blur(${n.blur.amount}px)`), n.fill) {
|
|
2688
2727
|
const st = t.globalAlpha;
|
|
2689
2728
|
if (((at = n.fill) == null ? void 0 : at.type) === "Image" && (n.fill.originalSrc || n.fill.src)) {
|
|
2690
2729
|
const ct = n.fill.originalSrc || n.fill.src;
|
|
2691
2730
|
let _ = this.imageCache.get(ct);
|
|
2692
|
-
_ || (_ = new Image(), _.src = ct, this.imageCache.set(ct, _)), _.complete && _.naturalWidth > 0 && (t.save(), this.applyPath(t, l, a, r,
|
|
2731
|
+
_ || (_ = new Image(), _.src = ct, this.imageCache.set(ct, _)), _.complete && _.naturalWidth > 0 && (t.save(), this.applyPath(t, l, a, r, d), t.clip(), this.renderFittedImage(t, _, -a / 2, -r / 2, a, r, n.fill.fillMode), t.restore());
|
|
2693
2732
|
} else {
|
|
2694
2733
|
const ct = this.createCanvasFill(t, n.fill, a, r);
|
|
2695
|
-
t.fillStyle = ct || (typeof n.fill == "string" ? n.fill : n.fill.color || "transparent"), t.globalAlpha = st * this.normalizeOpacity(n.fill.opacity ?? 100), this.applyPath(t, l, a, r,
|
|
2734
|
+
t.fillStyle = ct || (typeof n.fill == "string" ? n.fill : n.fill.color || "transparent"), t.globalAlpha = st * this.normalizeOpacity(n.fill.opacity ?? 100), this.applyPath(t, l, a, r, d), t.fill();
|
|
2696
2735
|
}
|
|
2697
2736
|
t.globalAlpha = st;
|
|
2698
2737
|
}
|
|
2699
|
-
t.restore(), n.stroke && n.stroke.width > 0 && this.applyStrokeAlignment(t, n, l, a, r,
|
|
2738
|
+
t.restore(), n.stroke && n.stroke.width > 0 && this.applyStrokeAlignment(t, n, l, a, r, d);
|
|
2700
2739
|
} else if (s.type === "Frame" || s.type === "Group" && !s.isStructuralGroup) {
|
|
2701
|
-
const st = e.width ?? i.width ?? s.width ?? a, ct = e.height ?? i.height ?? s.height ?? r, _ =
|
|
2740
|
+
const st = e.width ?? i.width ?? s.width ?? a, ct = e.height ?? i.height ?? s.height ?? r, _ = d;
|
|
2702
2741
|
if (t.save(), t.beginPath(), this.drawRoundRect(t, -st / 2, -ct / 2, st, ct, _), n.fill && n.fill.type !== "None") {
|
|
2703
2742
|
const C = t.globalAlpha, W = this.createCanvasFill(t, n.fill, st, ct);
|
|
2704
2743
|
t.fillStyle = W || n.fill.color || "transparent", t.globalAlpha = C * this.normalizeOpacity(n.fill.opacity ?? 100), t.fill(), t.globalAlpha = C;
|
|
@@ -2707,8 +2746,8 @@ class fs {
|
|
|
2707
2746
|
const C = { type: "Rectangle" };
|
|
2708
2747
|
this.applyStrokeAlignment(t, n, C, st, ct, _);
|
|
2709
2748
|
}
|
|
2710
|
-
} 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) : this.frameCount % 60 === 0 && console.warn("[Engine] Unhandled object type in renderObject:", s.type, "Geo:", (
|
|
2711
|
-
if (this.applyArtEffectOverlay(t, s, l, a, r,
|
|
2749
|
+
} 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) : this.frameCount % 60 === 0 && console.warn("[Engine] Unhandled object type in renderObject:", s.type, "Geo:", (V = s.geometry) == null ? void 0 : V.type));
|
|
2750
|
+
if (this.applyArtEffectOverlay(t, s, l, a, r, d), Yt && Yt.enabled && Yt.type === "glitch" && t.restore(), Lt && Lt.enabled && t.restore(), s.children && s.children.length > 0) {
|
|
2712
2751
|
const ct = s.type === "Frame", _ = s.clipsContent !== void 0 ? s.clipsContent : s.clipContent !== void 0 ? s.clipContent : ct;
|
|
2713
2752
|
if (t.save(), _) {
|
|
2714
2753
|
t.beginPath();
|
|
@@ -2740,19 +2779,19 @@ class fs {
|
|
|
2740
2779
|
feather: s.maskFeather || 0,
|
|
2741
2780
|
isVisible: !0
|
|
2742
2781
|
}] : [])).filter((C) => C.isVisible !== !1 && o.has(C.maskId)).forEach((C) => {
|
|
2743
|
-
var mt,
|
|
2782
|
+
var mt, I, _t, Bt, Rt, dt;
|
|
2744
2783
|
const W = o.get(C.maskId), j = this.objectStates.get(W.id), bt = C.feather || 0, Mt = C.inverted === !0, ht = C.opacity !== void 0 ? typeof C.opacity == "number" ? C.opacity : C.opacity / 100 : 1;
|
|
2745
2784
|
if ((C.type || "alpha") === "luma") {
|
|
2746
2785
|
(!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, W.id, o), bt > 0 && (this.lumaCtx.filter = `blur(${bt}px)`), this.lumaCtx.globalAlpha = ht;
|
|
2747
|
-
const T = (j == null ? void 0 : j.width) || W.geometry.width || 0,
|
|
2786
|
+
const T = (j == null ? void 0 : j.width) || W.geometry.width || 0, G = (j == null ? void 0 : j.height) || W.geometry.height || 0, ut = (j == null ? void 0 : j.corner_radius) ?? W.corner_radius ?? 0;
|
|
2748
2787
|
if (((mt = W.geometry) == null ? void 0 : mt.type) === "Text") {
|
|
2749
2788
|
const Ct = j != null && j.geometry ? this.deepMerge(W.geometry, j.geometry) : W.geometry, Pt = j != null && j.style ? this.deepMerge(W.style, j.style) : W.style;
|
|
2750
|
-
this._renderText(this.lumaCtx, W, { ...Ct, width: T, height:
|
|
2751
|
-
} else if (((
|
|
2789
|
+
this._renderText(this.lumaCtx, W, { ...Ct, width: T, height: G, corner_radius: ut }, Pt, j, T, G, !0);
|
|
2790
|
+
} else if (((I = W.geometry) == null ? void 0 : I.type) === "Image") {
|
|
2752
2791
|
const Ct = W.geometry.src;
|
|
2753
2792
|
if (Ct) {
|
|
2754
2793
|
let Pt = this.imageCache.get(Ct);
|
|
2755
|
-
Pt || (Pt = new Image(), Pt.src = Ct, this.imageCache.set(Ct, Pt)), Pt.complete && Pt.naturalWidth > 0 ? this.lumaCtx.drawImage(Pt, -T / 2, -
|
|
2794
|
+
Pt || (Pt = new Image(), Pt.src = Ct, this.imageCache.set(Ct, Pt)), Pt.complete && Pt.naturalWidth > 0 ? this.lumaCtx.drawImage(Pt, -T / 2, -G / 2, T, G) : (this.applyPath(this.lumaCtx, W.geometry, T, G, ut), this.lumaCtx.fillStyle = "#ffffff", this.lumaCtx.fill());
|
|
2756
2795
|
}
|
|
2757
2796
|
} else if (((_t = W.geometry) == null ? void 0 : _t.type) === "SVG") {
|
|
2758
2797
|
const Ct = W.geometry.svgContent;
|
|
@@ -2766,29 +2805,29 @@ class fs {
|
|
|
2766
2805
|
this.artboard && this.reset();
|
|
2767
2806
|
}, this.imageCache.set(Pt, St);
|
|
2768
2807
|
}
|
|
2769
|
-
St.complete && St.naturalWidth > 0 ? this.lumaCtx.drawImage(St, -T / 2, -
|
|
2808
|
+
St.complete && St.naturalWidth > 0 ? this.lumaCtx.drawImage(St, -T / 2, -G / 2, T, G) : (this.applyPath(this.lumaCtx, W.geometry, T, G, ut), this.lumaCtx.fillStyle = "#ffffff", this.lumaCtx.fill());
|
|
2770
2809
|
}
|
|
2771
2810
|
} else
|
|
2772
|
-
this.applyPath(this.lumaCtx, W.geometry, T,
|
|
2811
|
+
this.applyPath(this.lumaCtx, W.geometry, T, G, ut), this.lumaCtx.fillStyle = "#ffffff", this.lumaCtx.fill();
|
|
2773
2812
|
this.lumaCtx.restore();
|
|
2774
2813
|
const E = this.maskCtx.getImageData(0, 0, this.canvasWidth, this.canvasHeight), R = this.lumaCtx.getImageData(0, 0, this.canvasWidth, this.canvasHeight).data, et = E.data;
|
|
2775
2814
|
for (let Ct = 0; Ct < et.length; Ct += 4) {
|
|
2776
2815
|
const Pt = R[Ct], St = R[Ct + 1], Ot = R[Ct + 2];
|
|
2777
|
-
let
|
|
2778
|
-
Mt && (
|
|
2816
|
+
let wt = (0.299 * Pt + 0.587 * St + 0.114 * Ot) / 255;
|
|
2817
|
+
Mt && (wt = 1 - wt), et[Ct + 3] *= wt;
|
|
2779
2818
|
}
|
|
2780
2819
|
this.maskCtx.putImageData(E, 0, 0);
|
|
2781
2820
|
} else {
|
|
2782
2821
|
this.maskCtx.save(), this.rootTransform && this.maskCtx.setTransform(this.rootTransform), this.maskCtx.globalCompositeOperation = Mt ? "destination-out" : "destination-in", bt > 0 && (this.maskCtx.filter = `blur(${bt}px)`), this.maskCtx.globalAlpha = ht, this.applyAbsoluteTransform(this.maskCtx, W.id, o);
|
|
2783
|
-
const T = (j == null ? void 0 : j.width) || W.geometry.width || 0,
|
|
2822
|
+
const T = (j == null ? void 0 : j.width) || W.geometry.width || 0, G = (j == null ? void 0 : j.height) || W.geometry.height || 0, ut = (j == null ? void 0 : j.corner_radius) ?? W.corner_radius ?? 0;
|
|
2784
2823
|
if (((Bt = W.geometry) == null ? void 0 : Bt.type) === "Text") {
|
|
2785
2824
|
const E = j != null && j.geometry ? this.deepMerge(W.geometry, j.geometry) : W.geometry, R = j != null && j.style ? this.deepMerge(W.style, j.style) : W.style;
|
|
2786
|
-
this._renderText(this.maskCtx, W, { ...E, width: T, height:
|
|
2825
|
+
this._renderText(this.maskCtx, W, { ...E, width: T, height: G, corner_radius: ut }, R, j, T, G, !0);
|
|
2787
2826
|
} else if (((Rt = W.geometry) == null ? void 0 : Rt.type) === "Image") {
|
|
2788
2827
|
const E = W.geometry.src;
|
|
2789
2828
|
if (E) {
|
|
2790
2829
|
let R = this.imageCache.get(E);
|
|
2791
|
-
R || (R = new Image(), R.src = E, this.imageCache.set(E, R)), R.complete && R.naturalWidth > 0 ? this.maskCtx.drawImage(R, -T / 2, -
|
|
2830
|
+
R || (R = new Image(), R.src = E, this.imageCache.set(E, R)), R.complete && R.naturalWidth > 0 ? this.maskCtx.drawImage(R, -T / 2, -G / 2, T, G) : (this.applyPath(this.maskCtx, W.geometry, T, G, ut), this.maskCtx.fillStyle = "#ffffff", this.maskCtx.fill());
|
|
2792
2831
|
}
|
|
2793
2832
|
} else if (((dt = W.geometry) == null ? void 0 : dt.type) === "SVG") {
|
|
2794
2833
|
const E = W.geometry.svgContent;
|
|
@@ -2802,10 +2841,10 @@ class fs {
|
|
|
2802
2841
|
this.artboard && this.reset();
|
|
2803
2842
|
}, this.imageCache.set(R, et);
|
|
2804
2843
|
}
|
|
2805
|
-
et.complete && et.naturalWidth > 0 ? this.maskCtx.drawImage(et, -T / 2, -
|
|
2844
|
+
et.complete && et.naturalWidth > 0 ? this.maskCtx.drawImage(et, -T / 2, -G / 2, T, G) : (this.applyPath(this.maskCtx, W.geometry, T, G, ut), this.maskCtx.fillStyle = "#ffffff", this.maskCtx.fill());
|
|
2806
2845
|
}
|
|
2807
2846
|
} else
|
|
2808
|
-
this.applyPath(this.maskCtx, W.geometry, T,
|
|
2847
|
+
this.applyPath(this.maskCtx, W.geometry, T, G, ut), this.maskCtx.fillStyle = "#ffffff", this.maskCtx.fill();
|
|
2809
2848
|
this.maskCtx.restore();
|
|
2810
2849
|
}
|
|
2811
2850
|
}), yt.save(), yt.setTransform(1, 0, 0, 1, 0, 0);
|
|
@@ -2816,40 +2855,40 @@ class fs {
|
|
|
2816
2855
|
}
|
|
2817
2856
|
}
|
|
2818
2857
|
_renderText(t, s, o, e, i, n, a, r = !1, c = !1) {
|
|
2819
|
-
var
|
|
2820
|
-
let
|
|
2858
|
+
var Y, H, it, nt, ft;
|
|
2859
|
+
let d = o.text || "";
|
|
2821
2860
|
if (o.textInputId && !r) {
|
|
2822
2861
|
const M = this.inputs.get(o.textInputId);
|
|
2823
|
-
M !== void 0 && (
|
|
2862
|
+
M !== void 0 && (d = String(M), i.geometry && i.geometry.type === "Text" && (i.geometry.text = d));
|
|
2824
2863
|
}
|
|
2825
2864
|
if (o.svgPath) {
|
|
2826
2865
|
const M = o.svgPath;
|
|
2827
2866
|
t.save();
|
|
2828
|
-
const Q = ((
|
|
2829
|
-
t.fillStyle = Q, t.globalAlpha *=
|
|
2867
|
+
const Q = ((Y = e == null ? void 0 : e.fill) == null ? void 0 : Y.color) || "#000000", N = ((H = e == null ? void 0 : e.fill) == null ? void 0 : H.opacity) !== void 0 ? (it = e == null ? void 0 : e.fill) == null ? void 0 : it.opacity : 1;
|
|
2868
|
+
t.fillStyle = Q, t.globalAlpha *= N;
|
|
2830
2869
|
const L = new Path2D(M);
|
|
2831
2870
|
t.fill(L), t.restore();
|
|
2832
2871
|
return;
|
|
2833
2872
|
}
|
|
2834
|
-
let l =
|
|
2873
|
+
let l = d || "";
|
|
2835
2874
|
o.enableSegments === !0 && o.segments && Array.isArray(o.segments) && (l = o.segments.map((M) => M && M.text ? M.text : "").join(""));
|
|
2836
2875
|
const f = o.textCase || "none";
|
|
2837
2876
|
f === "uppercase" ? l = l.toUpperCase() : f === "lowercase" ? l = l.toLowerCase() : f === "capitalize" && (l = l.replace(/\b\w/g, (M) => M.toUpperCase()));
|
|
2838
|
-
let g = ((nt = o.fontWeight) == null ? void 0 : nt.toString()) || "400",
|
|
2839
|
-
g.toLowerCase().includes("italic") && (
|
|
2840
|
-
const
|
|
2877
|
+
let g = ((nt = o.fontWeight) == null ? void 0 : nt.toString()) || "400", u = o.fontStyle || "normal";
|
|
2878
|
+
g.toLowerCase().includes("italic") && (u = "italic", g = g.replace(/italic/gi, "").trim() || "400");
|
|
2879
|
+
const p = this.mapFontWeight(g), m = Math.max(1, o.fontSize || 32);
|
|
2841
2880
|
let y = o.fontFamily || "Inter";
|
|
2842
2881
|
const S = ["Bold", "SemiBold", "Medium", "Regular", "Light", "Thin", "ExtraBold", "Black", "Italic"];
|
|
2843
2882
|
S.forEach((M) => {
|
|
2844
2883
|
const Q = new RegExp(`[\\s-]${M}$`, "i");
|
|
2845
2884
|
Q.test(y) && (y = y.replace(Q, "").trim());
|
|
2846
2885
|
});
|
|
2847
|
-
const b = `${
|
|
2886
|
+
const b = `${u} ${p} ${m}px "${y}", sans-serif`;
|
|
2848
2887
|
t.font = b;
|
|
2849
2888
|
const v = o.textVerticalAlign || "top";
|
|
2850
2889
|
t.textBaseline = "top";
|
|
2851
|
-
const
|
|
2852
|
-
t.textAlign =
|
|
2890
|
+
const w = o.textAlign || "left";
|
|
2891
|
+
t.textAlign = w;
|
|
2853
2892
|
let k = 0;
|
|
2854
2893
|
if (typeof o.letterSpacing == "number")
|
|
2855
2894
|
k = o.letterSpacing;
|
|
@@ -2865,8 +2904,8 @@ class fs {
|
|
|
2865
2904
|
text: l,
|
|
2866
2905
|
fontFamily: y,
|
|
2867
2906
|
fontSize: m,
|
|
2868
|
-
fontWeight:
|
|
2869
|
-
fontStyle:
|
|
2907
|
+
fontWeight: p,
|
|
2908
|
+
fontStyle: u,
|
|
2870
2909
|
lineHeight: x,
|
|
2871
2910
|
width: F,
|
|
2872
2911
|
letterSpacing: k,
|
|
@@ -2874,21 +2913,21 @@ class fs {
|
|
|
2874
2913
|
segments: o.segments,
|
|
2875
2914
|
enableSegments: o.enableSegments,
|
|
2876
2915
|
textCase: f
|
|
2877
|
-
}), tt = K.lines || [], rt = K.maxFontSize || m, at = this.fontLeadingFactors[y] ?? 0.5,
|
|
2916
|
+
}), tt = K.lines || [], rt = K.maxFontSize || m, at = this.fontLeadingFactors[y] ?? 0.5, V = (B - m) * at;
|
|
2878
2917
|
let O = K.height, $ = -O / 2;
|
|
2879
|
-
a > 0 && a > O && (v === "top" ? $ = -a / 2 : v === "middle" || v === "center" ? $ = -O / 2 : v === "bottom" && ($ = a / 2 - O)), $ +=
|
|
2918
|
+
a > 0 && a > O && (v === "top" ? $ = -a / 2 : v === "middle" || v === "center" ? $ = -O / 2 : v === "bottom" && ($ = a / 2 - O)), $ += V;
|
|
2880
2919
|
let P = null, J = 0;
|
|
2881
2920
|
if (o.pathId && this.artboard) {
|
|
2882
2921
|
const M = this.artboard.objects.find((Q) => Q.id === o.pathId);
|
|
2883
2922
|
if (M && M.type === "Shape" && ((ft = M.geometry) == null ? void 0 : ft.type) === "Path") {
|
|
2884
|
-
const Q = this.objectStates.get(M.id),
|
|
2885
|
-
P = { geo:
|
|
2923
|
+
const Q = this.objectStates.get(M.id), N = Q != null && Q.geometry ? this.deepMerge(M.geometry, Q.geometry) : M.geometry, L = (Q == null ? void 0 : Q.scale_x) !== void 0 ? (M.width || 0) * Q.scale_x : M.width || 0, z = (Q == null ? void 0 : Q.scale_y) !== void 0 ? (M.height || 0) * Q.scale_y : M.height || 0;
|
|
2924
|
+
P = { geo: N, obj: M, w: L, h: z }, J = this.getPerimeter(N, L, z);
|
|
2886
2925
|
}
|
|
2887
2926
|
}
|
|
2888
2927
|
const Z = (M, Q) => {
|
|
2889
2928
|
var L, z;
|
|
2890
2929
|
if (k === 0 && (!o.enableSegments || !((L = o.segments) != null && L.length))) return t.measureText(M).width;
|
|
2891
|
-
let
|
|
2930
|
+
let N = 0;
|
|
2892
2931
|
for (let pt = 0; pt < M.length; pt++) {
|
|
2893
2932
|
const vt = Q + pt;
|
|
2894
2933
|
let yt = 0;
|
|
@@ -2904,31 +2943,31 @@ class fs {
|
|
|
2904
2943
|
if (kt) {
|
|
2905
2944
|
t.save();
|
|
2906
2945
|
let Tt = kt.fontFamily || o.fontFamily || "Inter";
|
|
2907
|
-
const Ft = this.mapFontWeight((kt.fontWeight || o.fontWeight || "400").toString()), Dt = kt.fontStyle ||
|
|
2946
|
+
const Ft = this.mapFontWeight((kt.fontWeight || o.fontWeight || "400").toString()), Dt = kt.fontStyle || u, $t = kt.fontSize || m;
|
|
2908
2947
|
t.font = `${Dt} ${Ft} ${$t}px "${Tt}", sans-serif`, yt = t.measureText(M[pt]).width, t.restore();
|
|
2909
2948
|
} else
|
|
2910
2949
|
yt = t.measureText(M[pt]).width;
|
|
2911
2950
|
} else
|
|
2912
2951
|
yt = t.measureText(M[pt]).width;
|
|
2913
|
-
|
|
2952
|
+
N += yt + k;
|
|
2914
2953
|
}
|
|
2915
|
-
return
|
|
2916
|
-
}, lt = (M, Q,
|
|
2954
|
+
return N - (M.length > 0 ? k : 0);
|
|
2955
|
+
}, lt = (M, Q, N, L, z) => {
|
|
2917
2956
|
var kt, Tt;
|
|
2918
2957
|
const vt = (z === 0 || l[z - 1] === `
|
|
2919
2958
|
` || l[z - 1] === "\r") && o.paragraphIndent ? o.paragraphIndent : 0, yt = (!r || c) && (s.behaviors || []).some(
|
|
2920
2959
|
(Ft) => Ft.enabled && (Ft.type.toString().includes("Text") || ["Typewriter", "Scramble", "Wave", "Bounce", "GlitchText", "Reveal3D", "RevealSlide", "RevealBlur"].includes(Ft.type))
|
|
2921
2960
|
);
|
|
2922
2961
|
if (!o.pathId && !yt && (o.enableSegments !== !0 || !o.segments || o.segments.length === 0))
|
|
2923
|
-
t.font = b, L ? t.strokeText(M, Q + vt,
|
|
2962
|
+
t.font = b, L ? t.strokeText(M, Q + vt, N) : t.fillText(M, Q + vt, N);
|
|
2924
2963
|
else {
|
|
2925
2964
|
const Ft = Z(M, z);
|
|
2926
2965
|
let Dt = Q + vt;
|
|
2927
|
-
|
|
2966
|
+
w === "center" ? Dt -= Ft / 2 : w === "right" && (Dt -= Ft);
|
|
2928
2967
|
let $t = o.pathOffset || 0;
|
|
2929
|
-
o.pathId && J > 0 && P && (
|
|
2968
|
+
o.pathId && J > 0 && P && (w === "center" ? $t += J / 2 - Ft / 2 : w === "right" && ($t += J - Ft));
|
|
2930
2969
|
let Lt = Dt;
|
|
2931
|
-
const
|
|
2970
|
+
const Yt = r && !c ? [] : ((kt = s.behaviors) == null ? void 0 : kt.filter(
|
|
2932
2971
|
(st) => [
|
|
2933
2972
|
D.Typewriter,
|
|
2934
2973
|
D.Scramble,
|
|
@@ -2965,47 +3004,47 @@ class fs {
|
|
|
2965
3004
|
let ct = M[st];
|
|
2966
3005
|
const _ = z + st;
|
|
2967
3006
|
let C = 0, W = 0, j = 1, bt = 1, Mt = 0, ht = 1, Et = ct;
|
|
2968
|
-
|
|
2969
|
-
const T = dt.settings || {},
|
|
3007
|
+
Yt.forEach((dt) => {
|
|
3008
|
+
const T = dt.settings || {}, G = T.strength || 1, ut = Date.now();
|
|
2970
3009
|
if (dt.type === D.Typewriter)
|
|
2971
3010
|
this.currentTime * (T.speed || 1) - _ * (T.stagger || 0.05) < 0 && (ht = 0);
|
|
2972
3011
|
else if (dt.type === D.Scramble)
|
|
2973
3012
|
Math.max(0, Math.min(1, this.currentTime / (T.duration || 1.5)) - _ * 0.02) < 1 && Math.random() < 0.3 && (Et = "$%#@!*&"[Math.floor(Math.random() * 7)]);
|
|
2974
3013
|
else if (dt.type === D.Wave)
|
|
2975
|
-
W += Math.sin(this.currentTime * 5 * (T.speed || 1) + _ * (T.frequency || 1)) * (T.amplitude || 20) *
|
|
3014
|
+
W += Math.sin(this.currentTime * 5 * (T.speed || 1) + _ * (T.frequency || 1)) * (T.amplitude || 20) * G;
|
|
2976
3015
|
else if (dt.type === D.Bounce) {
|
|
2977
3016
|
const E = Math.max(0, this.currentTime % 2 - _ * (T.stagger || 0.1));
|
|
2978
|
-
E < 1 && (W -= Math.abs(Math.sin(E * Math.PI)) * (T.height || 50) *
|
|
3017
|
+
E < 1 && (W -= Math.abs(Math.sin(E * Math.PI)) * (T.height || 50) * G);
|
|
2979
3018
|
} else if (dt.type === D.TextTrail) {
|
|
2980
3019
|
const E = this.pointerHistory[Math.max(0, this.pointerHistory.length - 1 - _ * (T.delay || 5))];
|
|
2981
|
-
E && (C += (E.x - (i.x + Lt)) *
|
|
3020
|
+
E && (C += (E.x - (i.x + Lt)) * G * 0.2, W += (E.y - (i.y + N + W)) * G * 0.2);
|
|
2982
3021
|
} else if (dt.type === D.Reveal3D) {
|
|
2983
3022
|
const E = Math.max(0, Math.min(1, this.currentTime * (T.speed || 1) - _ * (T.stagger || 0.1)));
|
|
2984
3023
|
j *= E, bt *= E, ht = E;
|
|
2985
3024
|
} else if (dt.type === D.RevealSlide) {
|
|
2986
|
-
const E = Math.max(0, Math.min(1, this.currentTime * 1.5 - _ * 0.05)), R = (1 - E) * (T.distance || 40) *
|
|
3025
|
+
const E = Math.max(0, Math.min(1, this.currentTime * 1.5 - _ * 0.05)), R = (1 - E) * (T.distance || 40) * G, et = T.direction || "up";
|
|
2987
3026
|
et === "up" ? W -= R : et === "down" ? W += R : et === "left" ? C -= R : et === "right" && (C += R), ht = E;
|
|
2988
3027
|
} else if (dt.type === D.RevealBlur) {
|
|
2989
3028
|
const E = Math.max(0, Math.min(1, this.currentTime * 1.2 - _ * 0.1));
|
|
2990
3029
|
ht = E, C += (1 - E) * 5;
|
|
2991
3030
|
} else if (dt.type === D.TextLiquid) {
|
|
2992
3031
|
const E = Math.max(0, Math.sin(ut * 1e-3 * (T.speed || 1) + _ * 0.5));
|
|
2993
|
-
W += E * (T.amplitude || 10) *
|
|
3032
|
+
W += E * (T.amplitude || 10) * G, bt *= 1 + E * 0.2;
|
|
2994
3033
|
} else if (dt.type === D.TextVortex) {
|
|
2995
3034
|
const E = ut * 2e-3 * (T.speed || 1) + _ * 0.2, R = (1 - (Math.sin(ut * 1e-3) * 0.5 + 0.5)) * (T.radius || 50);
|
|
2996
|
-
C += Math.cos(E) * R *
|
|
3035
|
+
C += Math.cos(E) * R * G, W += Math.sin(E) * R * G;
|
|
2997
3036
|
} else if (dt.type === D.TextExplosion) {
|
|
2998
3037
|
const E = T.force || 1, R = this.currentTime % 2;
|
|
2999
3038
|
if (R < 1) {
|
|
3000
3039
|
const et = (_ / M.length - 0.5) * Math.PI * 2, Ct = R * 100 * E;
|
|
3001
|
-
C += Math.cos(et) * Ct *
|
|
3040
|
+
C += Math.cos(et) * Ct * G, W += Math.sin(et) * Ct * G, ht = 1 - R;
|
|
3002
3041
|
}
|
|
3003
3042
|
} else if (dt.type === D.TextRain) {
|
|
3004
3043
|
const E = T.speed || 1, R = T.height || 100, et = (ut * 1e-3 * E + _ * 0.1) % 1;
|
|
3005
|
-
W -= (1 - et) * R *
|
|
3044
|
+
W -= (1 - et) * R * G, ht = et > 0.1 ? 1 : et * 10;
|
|
3006
3045
|
} else if (dt.type === D.TextGravity) {
|
|
3007
3046
|
const E = T.gravity || 9.8, R = this.currentTime % 3 / 3, et = 0.5 * E * Math.pow(R * 10, 2);
|
|
3008
|
-
et < 100 ? W += et *
|
|
3047
|
+
et < 100 ? W += et * G : W += 100 * G;
|
|
3009
3048
|
} else if (dt.type === D.TextMatrix) {
|
|
3010
3049
|
const E = T.speed || 1;
|
|
3011
3050
|
if (Math.random() < 0.1 * E) {
|
|
@@ -3020,9 +3059,9 @@ class fs {
|
|
|
3020
3059
|
Math.sin(_ * 1.5 + ut * 2e-3 * (T.speed || 1)) > 0.5 && (ht = 0);
|
|
3021
3060
|
else if (dt.type === D.TextOrganic) {
|
|
3022
3061
|
const E = T.speed || 1, R = T.amplitude || 10;
|
|
3023
|
-
C += Math.sin(ut * 2e-3 * E + _) * R *
|
|
3062
|
+
C += Math.sin(ut * 2e-3 * E + _) * R * G, W += Math.cos(ut * 15e-4 * E + _ * 0.7) * R * G;
|
|
3024
3063
|
} else if (dt.type === D.TextBreathe) {
|
|
3025
|
-
const R = 1 + (Math.sin(ut * 3e-3 + _ * 0.2) + 1) / 2 * 0.2 *
|
|
3064
|
+
const R = 1 + (Math.sin(ut * 3e-3 + _ * 0.2) + 1) / 2 * 0.2 * G;
|
|
3026
3065
|
j *= R, bt *= R;
|
|
3027
3066
|
} else if (dt.type === D.TextSpin) {
|
|
3028
3067
|
const E = T.speed || 1;
|
|
@@ -3030,12 +3069,12 @@ class fs {
|
|
|
3030
3069
|
} else if (dt.type === D.TextMagnet) {
|
|
3031
3070
|
const E = this.pointerHistory[this.pointerHistory.length - 1];
|
|
3032
3071
|
if (E) {
|
|
3033
|
-
const R = E.x - (i.x + Lt), et = E.y - (i.y +
|
|
3072
|
+
const R = E.x - (i.x + Lt), et = E.y - (i.y + N);
|
|
3034
3073
|
Mt = Math.atan2(et, R);
|
|
3035
3074
|
}
|
|
3036
3075
|
} else if (dt.type === D.TextPerspective) {
|
|
3037
|
-
const E = M.length / 2, R = (_ - E) / E, et = 1 - Math.abs(R) * 0.3 *
|
|
3038
|
-
j *= et, bt *= et, C += R * 20 *
|
|
3076
|
+
const E = M.length / 2, R = (_ - E) / E, et = 1 - Math.abs(R) * 0.3 * G;
|
|
3077
|
+
j *= et, bt *= et, C += R * 20 * G;
|
|
3039
3078
|
} else if (dt.type === D.TextMirror)
|
|
3040
3079
|
ht *= 0.8;
|
|
3041
3080
|
else if (dt.type === D.TextFloral) {
|
|
@@ -3043,16 +3082,16 @@ class fs {
|
|
|
3043
3082
|
et < 1 && (j *= et, bt *= et, Mt += et * Math.PI);
|
|
3044
3083
|
} else if (dt.type === D.TextSmoke) {
|
|
3045
3084
|
const E = T.speed || 1, R = T.height || 50, et = (ut * 5e-4 * E + _ * 0.2) % 1;
|
|
3046
|
-
W -= et * R *
|
|
3085
|
+
W -= et * R * G, C += Math.sin(ut * 2e-3 + _) * 5 * G, ht = 1 - et;
|
|
3047
3086
|
} else if (dt.type === D.TextVariable) {
|
|
3048
3087
|
const E = T.speed || 1, R = T.intensity || 1.5, et = (Math.sin(ut * 4e-3 * E + _ * 0.3) + 1) / 2;
|
|
3049
|
-
j *= 1 + et * (R - 1) *
|
|
3088
|
+
j *= 1 + et * (R - 1) * G;
|
|
3050
3089
|
} else if (dt.type === D.TextZing) {
|
|
3051
3090
|
const E = T.speed || 2, R = T.distance || 100, et = (ut * 2e-3 * E + _ * 0.05) % 1;
|
|
3052
|
-
C += (1 - et) * R *
|
|
3091
|
+
C += (1 - et) * R * G, ht = et;
|
|
3053
3092
|
} else if (dt.type === D.TextElastic) {
|
|
3054
3093
|
const E = T.stiffness || 0.2, R = T.damping || 0.1, et = Math.sin(ut * 0.01) * Math.exp(-ut * 1e-3 * R);
|
|
3055
|
-
bt *= 1 + et * E *
|
|
3094
|
+
bt *= 1 + et * E * G;
|
|
3056
3095
|
} else if (dt.type === D.TextGlitch3D) {
|
|
3057
3096
|
const E = T.intensity || 5;
|
|
3058
3097
|
Math.random() < 0.2 && (C += (Math.random() - 0.5) * E, W += (Math.random() - 0.5) * E, ht = 0.8);
|
|
@@ -3061,24 +3100,24 @@ class fs {
|
|
|
3061
3100
|
Math.random() < 0.1 && (C += (Math.random() - 0.5) * E, W += (Math.random() - 0.5) * E, Math.random() < 0.05 && (ht = 0.5));
|
|
3062
3101
|
}
|
|
3063
3102
|
});
|
|
3064
|
-
let mt = null,
|
|
3103
|
+
let mt = null, I = o.textDecoration || "none", _t = m;
|
|
3065
3104
|
if (o.enableSegments === !0 && ((Tt = o.segments) == null ? void 0 : Tt.length) > 0) {
|
|
3066
3105
|
let dt = 0, T = null;
|
|
3067
|
-
for (const
|
|
3068
|
-
if (_ < dt + (
|
|
3069
|
-
T =
|
|
3106
|
+
for (const G of o.segments) {
|
|
3107
|
+
if (_ < dt + (G.text || "").length) {
|
|
3108
|
+
T = G;
|
|
3070
3109
|
break;
|
|
3071
3110
|
}
|
|
3072
|
-
dt += (
|
|
3111
|
+
dt += (G.text || "").length;
|
|
3073
3112
|
}
|
|
3074
3113
|
if (T) {
|
|
3075
|
-
let
|
|
3114
|
+
let G = T.fontFamily || o.fontFamily || "Inter";
|
|
3076
3115
|
S.forEach((R) => {
|
|
3077
3116
|
const et = new RegExp(`[\\s-]${R}$`, "i");
|
|
3078
|
-
et.test(
|
|
3117
|
+
et.test(G) && (G = G.replace(et, "").trim());
|
|
3079
3118
|
});
|
|
3080
|
-
const ut = this.mapFontWeight((T.fontWeight || o.fontWeight || "400").toString()), E = T.fontStyle ||
|
|
3081
|
-
_t = T.fontSize || m, t.font = `${E} ${ut} ${_t}px "${
|
|
3119
|
+
const ut = this.mapFontWeight((T.fontWeight || o.fontWeight || "400").toString()), E = T.fontStyle || u;
|
|
3120
|
+
_t = T.fontSize || m, t.font = `${E} ${ut} ${_t}px "${G}", sans-serif`, T.fill && (mt = T.fill), T.textDecoration && (I = T.textDecoration), _t < rt && (W += (rt - _t) * 0.85);
|
|
3082
3121
|
}
|
|
3083
3122
|
} else
|
|
3084
3123
|
t.font = b;
|
|
@@ -3086,10 +3125,10 @@ class fs {
|
|
|
3086
3125
|
t.globalAlpha *= ht, t.save();
|
|
3087
3126
|
const Rt = t.measureText(Et).width;
|
|
3088
3127
|
if (P && J > 0) {
|
|
3089
|
-
const dt = Lt - Dt + Rt / 2,
|
|
3128
|
+
const dt = Lt - Dt + Rt / 2, G = ($t + dt) / J, ut = this.getPointOnPath(P.geo, P.w, P.h, Math.abs(G % 1)), E = ut.angle, R = N + W + (o.pathOffsetY || 0), et = o.pathSide === "right" ? -1 : 1, Ct = Math.cos(E + Math.PI / 2) * R * et, Pt = Math.sin(E + Math.PI / 2) * R * et;
|
|
3090
3129
|
t.translate(ut.x + Ct + C, ut.y + Pt), t.rotate(E + Mt + (et === -1 ? Math.PI : 0));
|
|
3091
3130
|
} else
|
|
3092
|
-
t.translate(Lt + C + Rt / 2,
|
|
3131
|
+
t.translate(Lt + C + Rt / 2, N + W), Mt !== 0 && t.rotate(Mt);
|
|
3093
3132
|
if (t.scale(j, bt), mt && !r && !c) {
|
|
3094
3133
|
const dt = this.createCanvasFill(t, mt, n, a);
|
|
3095
3134
|
t.fillStyle = dt || mt.color || "#000000";
|
|
@@ -3102,24 +3141,24 @@ class fs {
|
|
|
3102
3141
|
const dt = c ? "#000000" : this.createCanvasFill(t, e.fill, n, a);
|
|
3103
3142
|
t.fillStyle = dt || e.fill.color || "#ffffff", t.fillText(Et, -Rt / 2, 0);
|
|
3104
3143
|
} else L ? t.strokeText(Et, -Rt / 2, 0) : t.fillText(Et, -Rt / 2, 0);
|
|
3105
|
-
|
|
3144
|
+
I !== "none" && !r && this.drawTextDecoration(t, I, 0, 0, Rt, _t), t.restore(), t.globalAlpha = Bt, Lt += Rt + k;
|
|
3106
3145
|
}
|
|
3107
3146
|
}
|
|
3108
3147
|
};
|
|
3109
3148
|
if (r) {
|
|
3110
3149
|
let M = 0, Q = $;
|
|
3111
|
-
(tt || []).forEach((
|
|
3112
|
-
const L =
|
|
3150
|
+
(tt || []).forEach((N) => {
|
|
3151
|
+
const L = N.text || "", z = l.indexOf(L, M);
|
|
3113
3152
|
z !== -1 && (M = z);
|
|
3114
3153
|
let pt = -n / 2;
|
|
3115
|
-
|
|
3154
|
+
w === "center" ? pt = 0 : w === "right" && (pt = n / 2), lt(L, pt, Q, !1, M), M += L.length, Q += B;
|
|
3116
3155
|
});
|
|
3117
3156
|
} else if (c) {
|
|
3118
3157
|
let M = 0, Q = $;
|
|
3119
|
-
(tt || []).forEach((
|
|
3120
|
-
const L =
|
|
3158
|
+
(tt || []).forEach((N) => {
|
|
3159
|
+
const L = N.text || "";
|
|
3121
3160
|
let z = -n / 2;
|
|
3122
|
-
|
|
3161
|
+
w === "center" ? z = 0 : w === "right" && (z = n / 2), lt(L, z, Q, !1, M), M += L.length, M < l.length && (l[M] === `
|
|
3123
3162
|
` || l[M] === "\r") && (M++, l[M - 1] === "\r" && l[M] === `
|
|
3124
3163
|
` && M++), Q += B;
|
|
3125
3164
|
});
|
|
@@ -3127,7 +3166,7 @@ class fs {
|
|
|
3127
3166
|
if (e.fill) {
|
|
3128
3167
|
const M = t.globalAlpha, Q = this.createCanvasFill(t, e.fill, n, a);
|
|
3129
3168
|
t.fillStyle = Q || e.fill.color || "#000000", t.globalAlpha = M * this.normalizeOpacity(e.fill.opacity ?? 100);
|
|
3130
|
-
const
|
|
3169
|
+
const N = K.fullText || (o.enableSegments ? (o.segments || []).map((pt) => {
|
|
3131
3170
|
let vt = pt.text || "";
|
|
3132
3171
|
const yt = pt.textCase || o.textCase || "none";
|
|
3133
3172
|
return yt === "uppercase" ? vt.toUpperCase() : yt === "lowercase" ? vt.toLowerCase() : yt === "capitalize" ? vt.replace(/\b\w/g, (xt) => xt.toUpperCase()) : vt;
|
|
@@ -3136,20 +3175,20 @@ class fs {
|
|
|
3136
3175
|
(tt || []).forEach((pt) => {
|
|
3137
3176
|
const vt = pt.text || "";
|
|
3138
3177
|
let yt = -n / 2;
|
|
3139
|
-
|
|
3140
|
-
` ||
|
|
3178
|
+
w === "center" ? yt = 0 : w === "right" && (yt = n / 2), lt(vt, yt, z, !1, L), L += vt.length, z += B, L < N.length && (N[L] === `
|
|
3179
|
+
` || N[L] === "\r") && (A > 0 && (z += A), L++, N[L - 1] === "\r" && N[L] === `
|
|
3141
3180
|
` && L++);
|
|
3142
3181
|
}), t.globalAlpha = M;
|
|
3143
3182
|
}
|
|
3144
3183
|
if (e.stroke && e.stroke.width > 0) {
|
|
3145
3184
|
const M = t.globalAlpha;
|
|
3146
3185
|
e.fill && e.fill.type !== "None" && e.fill.isEnabled !== !1 && e.fill.opacity !== 0 && e.fill.color !== "transparent" && e.fill.color !== "rgba(0,0,0,0)" && (t.shadowColor = "transparent", t.shadowBlur = 0, t.shadowOffsetX = 0, t.shadowOffsetY = 0), t.strokeStyle = e.stroke.color, t.lineWidth = e.stroke.width, t.globalAlpha = M * this.normalizeOpacity(e.stroke.opacity ?? 100);
|
|
3147
|
-
let
|
|
3186
|
+
let N = 0, L = $;
|
|
3148
3187
|
(tt || []).forEach((z) => {
|
|
3149
3188
|
let pt = -n / 2;
|
|
3150
|
-
|
|
3151
|
-
` || l[
|
|
3152
|
-
` &&
|
|
3189
|
+
w === "center" ? pt = 0 : w === "right" && (pt = n / 2), lt(z.text, pt, L, !0, N), N += (z.text || "").length, L += B, N < l.length && (l[N] === `
|
|
3190
|
+
` || l[N] === "\r") && (A > 0 && (L += A), N++, l[N - 1] === "\r" && l[N] === `
|
|
3191
|
+
` && N++);
|
|
3153
3192
|
}), t.globalAlpha = M;
|
|
3154
3193
|
}
|
|
3155
3194
|
}
|
|
@@ -3164,22 +3203,22 @@ class fs {
|
|
|
3164
3203
|
t.strokeStyle = a.color || "#000000";
|
|
3165
3204
|
const l = t.globalAlpha;
|
|
3166
3205
|
t.globalAlpha = l * 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);
|
|
3167
|
-
const f = a.trimStart ?? 0, g = a.trimEnd ?? 1,
|
|
3168
|
-
if (f !== 0 || g !== 1 ||
|
|
3206
|
+
const f = a.trimStart ?? 0, g = a.trimEnd ?? 1, u = a.trimOffset ?? 0, p = a.dashOffset ?? 0, m = a.dashArray || [];
|
|
3207
|
+
if (f !== 0 || g !== 1 || u !== 0) {
|
|
3169
3208
|
const y = this.getPerimeter(o, e, i);
|
|
3170
3209
|
if (y > 0) {
|
|
3171
3210
|
const S = Math.max(0, Math.min(1, f)), b = Math.max(0, Math.min(1, g));
|
|
3172
3211
|
if (S < b) {
|
|
3173
|
-
const v = y * (b - S),
|
|
3174
|
-
t.setLineDash([v,
|
|
3212
|
+
const v = y * (b - S), w = y - v, k = -(y * (S + u % 1));
|
|
3213
|
+
t.setLineDash([v, w]), t.lineDashOffset = k + p * y;
|
|
3175
3214
|
} else if (S === b)
|
|
3176
3215
|
t.setLineDash([0, y]);
|
|
3177
3216
|
else {
|
|
3178
|
-
const v = y * (1 - S + b),
|
|
3179
|
-
t.setLineDash([v,
|
|
3217
|
+
const v = y * (1 - S + b), w = y - v, k = -(y * S);
|
|
3218
|
+
t.setLineDash([v, w]), t.lineDashOffset = k + p * y;
|
|
3180
3219
|
}
|
|
3181
3220
|
}
|
|
3182
|
-
} else m.length > 0 && (t.setLineDash(m), t.lineDashOffset =
|
|
3221
|
+
} else m.length > 0 && (t.setLineDash(m), t.lineDashOffset = p);
|
|
3183
3222
|
(o == null ? void 0 : o.type) === "Line" || e === 0 || i === 0 ? (this.applyPath(t, o, e, i, n), t.stroke()) : c === "inside" ? (t.lineWidth = r * 2, t.save(), this.applyPath(t, o, e, i, n), t.clip(), t.stroke(), t.restore()) : c === "outside" ? (t.lineWidth = r * 2, this.applyPath(t, o, e, i, n), t.stroke(), t.save(), t.globalCompositeOperation = "destination-out", this.applyPath(t, o, e, i, n), t.fill(), t.restore()) : (t.lineWidth = r, this.applyPath(t, o, e, i, n), t.stroke()), t.restore();
|
|
3184
3223
|
}
|
|
3185
3224
|
getPerimeter(t, s, o) {
|
|
@@ -3191,8 +3230,8 @@ class fs {
|
|
|
3191
3230
|
if (n >= 360 && a <= 0) return r;
|
|
3192
3231
|
let c = n / 360 * r;
|
|
3193
3232
|
if (a > 0) {
|
|
3194
|
-
const
|
|
3195
|
-
c += n / 360 *
|
|
3233
|
+
const d = Math.PI * (3 * (e * a + i * a) - Math.sqrt((3 * e * a + i * a) * (e * a + 3 * i * a)));
|
|
3234
|
+
c += n / 360 * d, n < 360 && (c += 2 * Math.sqrt((e - e * a) ** 2 + (i - i * a) ** 2));
|
|
3196
3235
|
} else n < 360 && (c += 2 * Math.max(e, i));
|
|
3197
3236
|
return isNaN(c) ? 0 : c;
|
|
3198
3237
|
}
|
|
@@ -3218,28 +3257,28 @@ class fs {
|
|
|
3218
3257
|
n = c.x, a = c.y;
|
|
3219
3258
|
continue;
|
|
3220
3259
|
}
|
|
3221
|
-
const
|
|
3260
|
+
const d = n, l = a, f = e[r - 1].out_x, g = e[r - 1].out_y;
|
|
3222
3261
|
if (f !== void 0 || c.in_x !== void 0 ? i += this.getBezierLength(
|
|
3223
|
-
|
|
3262
|
+
d,
|
|
3224
3263
|
l,
|
|
3225
|
-
f ??
|
|
3264
|
+
f ?? d,
|
|
3226
3265
|
g ?? l,
|
|
3227
3266
|
c.in_x ?? c.x,
|
|
3228
3267
|
c.in_y ?? c.y,
|
|
3229
3268
|
c.x,
|
|
3230
3269
|
c.y
|
|
3231
|
-
) : i += Math.sqrt((c.x -
|
|
3232
|
-
const
|
|
3233
|
-
b !== void 0 ||
|
|
3234
|
-
d,
|
|
3270
|
+
) : i += Math.sqrt((c.x - d) ** 2 + (c.y - l) ** 2), n = c.x, a = c.y, c.closePath || r === e.length - 1 && (t.is_closed || t.isClosed)) {
|
|
3271
|
+
const u = n, p = a, m = [...e.slice(0, r + 1)].reverse().find((A) => A.moveTo) || e[0], y = m.x, S = m.y, b = e[r].out_x, v = e[r].out_y, w = m.in_x, k = m.in_y;
|
|
3272
|
+
b !== void 0 || w !== void 0 ? i += this.getBezierLength(
|
|
3235
3273
|
u,
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3274
|
+
p,
|
|
3275
|
+
b ?? u,
|
|
3276
|
+
v ?? p,
|
|
3277
|
+
w ?? y,
|
|
3239
3278
|
k ?? S,
|
|
3240
3279
|
y,
|
|
3241
3280
|
S
|
|
3242
|
-
) : i += Math.sqrt((y -
|
|
3281
|
+
) : i += Math.sqrt((y - u) ** 2 + (S - p) ** 2);
|
|
3243
3282
|
}
|
|
3244
3283
|
}
|
|
3245
3284
|
return i;
|
|
@@ -3249,23 +3288,23 @@ class fs {
|
|
|
3249
3288
|
}
|
|
3250
3289
|
}
|
|
3251
3290
|
getBezierLength(t, s, o, e, i, n, a, r, c = 10) {
|
|
3252
|
-
let
|
|
3291
|
+
let d = 0, l = t, f = s;
|
|
3253
3292
|
for (let g = 1; g <= c; g++) {
|
|
3254
|
-
const
|
|
3255
|
-
|
|
3293
|
+
const u = g / c, p = 1 - u, m = u * u, y = p * p, S = y * p, b = m * u, v = S * t + 3 * y * u * o + 3 * p * m * i + b * a, w = S * s + 3 * y * u * e + 3 * p * m * n + b * r, k = v - l, A = w - f;
|
|
3294
|
+
d += Math.sqrt(k * k + A * A), l = v, f = w;
|
|
3256
3295
|
}
|
|
3257
|
-
return
|
|
3296
|
+
return d;
|
|
3258
3297
|
}
|
|
3259
|
-
getBezierTAtLength(t, s, o, e, i, n, a, r, c,
|
|
3298
|
+
getBezierTAtLength(t, s, o, e, i, n, a, r, c, d = 20) {
|
|
3260
3299
|
if (t <= 0) return 0;
|
|
3261
3300
|
let l = 0, f = s, g = o;
|
|
3262
|
-
for (let
|
|
3263
|
-
const
|
|
3301
|
+
for (let u = 1; u <= d; u++) {
|
|
3302
|
+
const p = u / d, m = 1 - p, y = p * p, S = m * m, b = S * m, v = y * p, w = b * s + 3 * S * p * e + 3 * m * y * n + v * r, k = b * o + 3 * S * p * i + 3 * m * y * a + v * c, A = w - f, x = k - g, B = Math.sqrt(A * A + x * x);
|
|
3264
3303
|
if (l + B >= t) {
|
|
3265
3304
|
const F = t - l, K = B === 0 ? 0 : F / B;
|
|
3266
|
-
return (
|
|
3305
|
+
return (u - 1 + K) / d;
|
|
3267
3306
|
}
|
|
3268
|
-
l += B, f =
|
|
3307
|
+
l += B, f = w, g = k;
|
|
3269
3308
|
}
|
|
3270
3309
|
return 1;
|
|
3271
3310
|
}
|
|
@@ -3277,9 +3316,9 @@ class fs {
|
|
|
3277
3316
|
i.forEach((S) => {
|
|
3278
3317
|
typeof S.x == "number" && typeof S.y == "number" && (n = Math.min(n, S.x), a = Math.max(a, S.x), r = Math.min(r, S.y), c = Math.max(c, S.y), S.out_x !== void 0 && (n = Math.min(n, S.out_x), a = Math.max(a, S.out_x)), S.out_y !== void 0 && (r = Math.min(r, S.out_y), c = Math.max(c, S.out_y)), S.in_x !== void 0 && (n = Math.min(n, S.in_x), a = Math.max(a, S.in_x)), S.in_y !== void 0 && (r = Math.min(r, S.in_y), c = Math.max(c, S.in_y)));
|
|
3279
3318
|
});
|
|
3280
|
-
const
|
|
3281
|
-
let
|
|
3282
|
-
const
|
|
3319
|
+
const d = (n + a) / 2, l = (r + c) / 2, g = this.getPerimeter(t, s, o) * e;
|
|
3320
|
+
let u = 0;
|
|
3321
|
+
const p = [];
|
|
3283
3322
|
let m = i[0], y = i[0];
|
|
3284
3323
|
for (let S = 1; S < i.length; S++) {
|
|
3285
3324
|
const b = i[S];
|
|
@@ -3287,36 +3326,36 @@ class fs {
|
|
|
3287
3326
|
m = b, y = b;
|
|
3288
3327
|
continue;
|
|
3289
3328
|
}
|
|
3290
|
-
|
|
3329
|
+
p.push({ p0: m, p1: b }), (b.closePath || S === i.length - 1 && (t.is_closed || t.isClosed)) && p.push({ p0: b, p1: y }), m = b;
|
|
3291
3330
|
}
|
|
3292
|
-
for (const S of
|
|
3331
|
+
for (const S of p) {
|
|
3293
3332
|
const b = S.p0, v = S.p1;
|
|
3294
|
-
let
|
|
3333
|
+
let w = 0;
|
|
3295
3334
|
const k = b.out_x !== void 0 || v.in_x !== void 0;
|
|
3296
|
-
if (k ?
|
|
3335
|
+
if (k ? w = this.getBezierLength(b.x, b.y, b.out_x ?? b.x, b.out_y ?? b.y, v.in_x ?? v.x, v.in_y ?? v.y, v.x, v.y) : w = Math.sqrt((v.x - b.x) ** 2 + (v.y - b.y) ** 2), u + w >= g || S === p[p.length - 1]) {
|
|
3297
3336
|
let A = 0;
|
|
3298
3337
|
if (k)
|
|
3299
|
-
return A = this.getBezierTAtLength(g -
|
|
3338
|
+
return A = this.getBezierTAtLength(g - u, b.x, b.y, b.out_x ?? b.x, b.out_y ?? b.y, v.in_x ?? v.x, v.in_y ?? v.y, v.x, v.y, 20), this.getBezierPointAndAngle(A, b, v, d, l);
|
|
3300
3339
|
{
|
|
3301
|
-
A =
|
|
3302
|
-
const x = b.x + (v.x - b.x) * A -
|
|
3340
|
+
A = w === 0 ? 0 : (g - u) / w;
|
|
3341
|
+
const x = b.x + (v.x - b.x) * A - d, B = b.y + (v.y - b.y) * A - l, F = Math.atan2(v.y - b.y, v.x - b.x);
|
|
3303
3342
|
return { x, y: B, angle: F };
|
|
3304
3343
|
}
|
|
3305
3344
|
}
|
|
3306
|
-
|
|
3345
|
+
u += w;
|
|
3307
3346
|
}
|
|
3308
3347
|
} else if (t.type === "Ellipse") {
|
|
3309
|
-
const i = Math.abs(s) / 2, n = Math.abs(o) / 2, a = t.sweepAngle ?? 360, c = ((t.startAngle ?? 0) + a * e) * Math.PI / 180,
|
|
3310
|
-
return { x:
|
|
3348
|
+
const i = Math.abs(s) / 2, n = Math.abs(o) / 2, a = t.sweepAngle ?? 360, c = ((t.startAngle ?? 0) + a * e) * Math.PI / 180, d = i * Math.cos(c), l = n * Math.sin(c), f = -i * Math.sin(c), g = n * Math.cos(c), u = Math.atan2(g, f);
|
|
3349
|
+
return { x: d, y: l, angle: u };
|
|
3311
3350
|
} else if ((t == null ? void 0 : t.type) === "Rectangle") {
|
|
3312
3351
|
const i = Math.abs(s), n = Math.abs(o), r = (i + n) * 2 * e;
|
|
3313
|
-
let c = 0,
|
|
3314
|
-
return r < i ? (c = -i / 2 + r,
|
|
3352
|
+
let c = 0, d = 0, l = 0;
|
|
3353
|
+
return r < i ? (c = -i / 2 + r, d = -n / 2, l = 0) : r < i + n ? (c = i / 2, d = -n / 2 + (r - i), l = Math.PI / 2) : r < 2 * i + n ? (c = i / 2 - (r - (i + n)), d = n / 2, l = Math.PI) : (c = -i / 2, d = n / 2 - (r - (2 * i + n)), l = -Math.PI / 2), { x: c, y: d, angle: l };
|
|
3315
3354
|
}
|
|
3316
3355
|
return { x: 0, y: 0, angle: 0 };
|
|
3317
3356
|
}
|
|
3318
3357
|
getBezierPointAndAngle(t, s, o, e, i) {
|
|
3319
|
-
const n = s.x, a = s.y, r = s.out_x ?? s.x, c = s.out_y ?? s.y,
|
|
3358
|
+
const n = s.x, a = s.y, r = s.out_x ?? s.x, c = s.out_y ?? s.y, d = o.in_x ?? o.x, l = o.in_y ?? o.y, f = o.x, g = o.y, u = 1 - t, p = t * t, m = u * u, y = m * u, S = p * t, b = y * n + 3 * m * t * r + 3 * u * p * d + S * f - e, v = y * a + 3 * m * t * c + 3 * u * p * l + S * g - i, w = 3 * m * (r - n) + 6 * u * t * (d - r) + 3 * p * (f - d), k = 3 * m * (c - a) + 6 * u * t * (l - c) + 3 * p * (g - l), A = Math.atan2(k, w);
|
|
3320
3359
|
return { x: b, y: v, angle: A };
|
|
3321
3360
|
}
|
|
3322
3361
|
applyAbsoluteTransform(t, s, o) {
|
|
@@ -3343,22 +3382,22 @@ class fs {
|
|
|
3343
3382
|
var l;
|
|
3344
3383
|
const a = s.artEffect || ((l = s.style) == null ? void 0 : l.artEffect);
|
|
3345
3384
|
if (!a || !a.enabled) return;
|
|
3346
|
-
const r = a.type, c = a.intensity ?? 0.5,
|
|
3385
|
+
const r = a.type, c = a.intensity ?? 0.5, d = a.speed ?? 1;
|
|
3347
3386
|
if (r === "acid_gradient" || r === "acid_rave" || r === "shimmer" || r === "halftone" || r === "noise" || r === "scanlines" || r === "chromatic_aberration") {
|
|
3348
3387
|
if (t.save(), this.applyPath(t, o, e, i, n), t.clip(), r === "shimmer") {
|
|
3349
|
-
const g = this.currentTime *
|
|
3350
|
-
|
|
3388
|
+
const g = this.currentTime * d % 2 / 2, u = t.createLinearGradient(-e, -i, e, i);
|
|
3389
|
+
u.addColorStop(Math.max(0, g - 0.2), "rgba(255,255,255,0)"), u.addColorStop(g, `rgba(255,255,255,${c * 0.8})`), u.addColorStop(Math.min(1, g + 0.2), "rgba(255,255,255,0)"), t.fillStyle = u, t.globalCompositeOperation = "screen", t.fillRect(-e / 2, -i / 2, e, i);
|
|
3351
3390
|
} else if (r === "acid_gradient" || r === "acid_rave") {
|
|
3352
|
-
const f = this.currentTime *
|
|
3353
|
-
g.addColorStop(0, `hsla(${
|
|
3391
|
+
const f = this.currentTime * d, g = t.createLinearGradient(-e / 2, -i / 2, e / 2, i / 2), u = f * 100 % 360, p = (u + 180) % 360;
|
|
3392
|
+
g.addColorStop(0, `hsla(${u}, 80%, 50%, ${c * 0.5})`), g.addColorStop(1, `hsla(${p}, 80%, 50%, ${c * 0.5})`), t.fillStyle = g, t.globalCompositeOperation = "screen", t.fillRect(-e / 2, -i / 2, e, i);
|
|
3354
3393
|
} else if (r === "halftone") {
|
|
3355
3394
|
const f = Math.max(2, 20 * (1 - c)), g = document.createElement("canvas");
|
|
3356
3395
|
g.width = f, g.height = f;
|
|
3357
|
-
const
|
|
3358
|
-
if (
|
|
3359
|
-
|
|
3360
|
-
const
|
|
3361
|
-
|
|
3396
|
+
const u = g.getContext("2d");
|
|
3397
|
+
if (u) {
|
|
3398
|
+
u.fillStyle = "black", u.beginPath(), u.arc(f / 2, f / 2, f / 2 * c, 0, Math.PI * 2), u.fill();
|
|
3399
|
+
const p = t.createPattern(g, "repeat");
|
|
3400
|
+
p && (t.globalAlpha = 0.3 * c, t.fillStyle = p, t.fillRect(-e / 2, -i / 2, e, i));
|
|
3362
3401
|
}
|
|
3363
3402
|
} else if (r === "noise") {
|
|
3364
3403
|
t.globalAlpha = 0.1 * c;
|
|
@@ -3391,21 +3430,21 @@ class fs {
|
|
|
3391
3430
|
} else if (s.type === "Line")
|
|
3392
3431
|
t.moveTo(-o / 2, 0), t.lineTo(o / 2, 0);
|
|
3393
3432
|
else if (s.type === "Ellipse") {
|
|
3394
|
-
const { startAngle: n = 0, sweepAngle: a = 360, ratio: r = 0 } = s, c = o / 2,
|
|
3395
|
-
a >= 360 && r <= 0 ? t.ellipse(0, 0, c,
|
|
3433
|
+
const { startAngle: n = 0, sweepAngle: a = 360, ratio: r = 0 } = s, c = o / 2, d = e / 2, l = n * Math.PI / 180, f = a * Math.PI / 180, g = l + f;
|
|
3434
|
+
a >= 360 && r <= 0 ? t.ellipse(0, 0, c, d, 0, 0, Math.PI * 2) : (t.ellipse(0, 0, c, d, 0, l, g, !1), r > 0 ? t.ellipse(0, 0, c * r, d * r, 0, g, l, !0) : t.lineTo(0, 0), t.closePath());
|
|
3396
3435
|
} else if (s.type === "Triangle")
|
|
3397
3436
|
t.moveTo(0, -e / 2), t.lineTo(o / 2, e / 2), t.lineTo(-o / 2, e / 2), t.closePath();
|
|
3398
3437
|
else if (s.type === "Polygon") {
|
|
3399
3438
|
const n = s.sides || 3, a = s.radius || Math.min(o, e) / 2;
|
|
3400
3439
|
for (let r = 0; r < n; r++) {
|
|
3401
|
-
const c = r * 2 * Math.PI / n - Math.PI / 2,
|
|
3402
|
-
r === 0 ? t.moveTo(
|
|
3440
|
+
const c = r * 2 * Math.PI / n - Math.PI / 2, d = a * Math.cos(c), l = a * Math.sin(c);
|
|
3441
|
+
r === 0 ? t.moveTo(d, l) : t.lineTo(d, l);
|
|
3403
3442
|
}
|
|
3404
3443
|
t.closePath();
|
|
3405
3444
|
} else if (s.type === "Star") {
|
|
3406
3445
|
const n = s.inner_radius || 20, a = s.outer_radius || 50, r = s.points || 5;
|
|
3407
3446
|
for (let c = 0; c < r * 2; c++) {
|
|
3408
|
-
const
|
|
3447
|
+
const d = c * Math.PI / r - Math.PI / 2, l = c % 2 === 0 ? a : n, f = l * Math.cos(d), g = l * Math.sin(d);
|
|
3409
3448
|
c === 0 ? t.moveTo(f, g) : t.lineTo(f, g);
|
|
3410
3449
|
}
|
|
3411
3450
|
t.closePath();
|
|
@@ -3415,29 +3454,29 @@ class fs {
|
|
|
3415
3454
|
if (s.points.forEach((f) => {
|
|
3416
3455
|
typeof f.x == "number" && typeof f.y == "number" && (n = Math.min(n, f.x), a = Math.max(a, f.x), r = Math.min(r, f.y), c = Math.max(c, f.y), f.out_x !== void 0 && (n = Math.min(n, f.out_x), a = Math.max(a, f.out_x)), f.out_y !== void 0 && (r = Math.min(r, f.out_y), c = Math.max(c, f.out_y)), f.in_x !== void 0 && (n = Math.min(n, f.in_x), a = Math.max(a, f.in_x)), f.in_y !== void 0 && (r = Math.min(r, f.in_y), c = Math.max(c, f.in_y)));
|
|
3417
3456
|
}), n === 1 / 0) return;
|
|
3418
|
-
const
|
|
3419
|
-
if (isNaN(
|
|
3420
|
-
console.warn("[Engine] Invalid path center:",
|
|
3457
|
+
const d = (n + a) / 2, l = (r + c) / 2;
|
|
3458
|
+
if (isNaN(d) || isNaN(l)) {
|
|
3459
|
+
console.warn("[Engine] Invalid path center:", d, l);
|
|
3421
3460
|
return;
|
|
3422
3461
|
}
|
|
3423
3462
|
s.points.forEach((f, g) => {
|
|
3424
3463
|
if (g === 0 || f.moveTo)
|
|
3425
|
-
t.moveTo(f.x -
|
|
3464
|
+
t.moveTo(f.x - d, f.y - l);
|
|
3426
3465
|
else {
|
|
3427
|
-
const
|
|
3428
|
-
if (!
|
|
3429
|
-
const
|
|
3430
|
-
isNaN(
|
|
3466
|
+
const u = s.points[g - 1];
|
|
3467
|
+
if (!u) return;
|
|
3468
|
+
const p = (u.out_x ?? u.x) - d, m = (u.out_y ?? u.y) - l, y = (f.in_x ?? f.x) - d, S = (f.in_y ?? f.y) - l;
|
|
3469
|
+
isNaN(p) || isNaN(y) || isNaN(f.x) ? t.lineTo(f.x - d, f.y - l) : t.bezierCurveTo(p, m, y, S, f.x - d, f.y - l);
|
|
3431
3470
|
}
|
|
3432
3471
|
if (f.closePath || g === s.points.length - 1 && (s.is_closed || s.isClosed)) {
|
|
3433
|
-
const
|
|
3434
|
-
|
|
3435
|
-
(f.out_x ?? f.x) -
|
|
3472
|
+
const u = [...s.points.slice(0, g + 1)].reverse().find((p) => p.moveTo) || s.points[0];
|
|
3473
|
+
u && (f.out_x !== void 0 || u.in_x !== void 0) && t.bezierCurveTo(
|
|
3474
|
+
(f.out_x ?? f.x) - d,
|
|
3436
3475
|
(f.out_y ?? f.y) - l,
|
|
3437
|
-
(
|
|
3438
|
-
(
|
|
3439
|
-
|
|
3440
|
-
|
|
3476
|
+
(u.in_x ?? u.x) - d,
|
|
3477
|
+
(u.in_y ?? u.y) - l,
|
|
3478
|
+
u.x - d,
|
|
3479
|
+
u.y - l
|
|
3441
3480
|
), t.closePath();
|
|
3442
3481
|
}
|
|
3443
3482
|
});
|
|
@@ -3446,19 +3485,19 @@ class fs {
|
|
|
3446
3485
|
s.points.forEach((f) => {
|
|
3447
3486
|
n = Math.min(n, f.x), a = Math.max(a, f.x), r = Math.min(r, f.y), c = Math.max(c, f.y);
|
|
3448
3487
|
});
|
|
3449
|
-
const
|
|
3488
|
+
const d = (n + a) / 2, l = (r + c) / 2;
|
|
3450
3489
|
s.points.forEach((f, g) => {
|
|
3451
|
-
if (g === 0) t.moveTo(f.x -
|
|
3490
|
+
if (g === 0) t.moveTo(f.x - d, f.y - l);
|
|
3452
3491
|
else {
|
|
3453
|
-
const
|
|
3454
|
-
|
|
3455
|
-
(
|
|
3456
|
-
(
|
|
3457
|
-
(f.in_x ?? f.x) -
|
|
3492
|
+
const u = s.points[g - 1];
|
|
3493
|
+
u.out_x !== void 0 || f.in_x !== void 0 ? t.bezierCurveTo(
|
|
3494
|
+
(u.out_x ?? u.x) - d,
|
|
3495
|
+
(u.out_y ?? u.y) - l,
|
|
3496
|
+
(f.in_x ?? f.x) - d,
|
|
3458
3497
|
(f.in_y ?? f.y) - l,
|
|
3459
|
-
f.x -
|
|
3498
|
+
f.x - d,
|
|
3460
3499
|
f.y - l
|
|
3461
|
-
) : t.lineTo(f.x -
|
|
3500
|
+
) : t.lineTo(f.x - d, f.y - l);
|
|
3462
3501
|
}
|
|
3463
3502
|
(f.closePath || g === s.points.length - 1 && (s.is_closed || s.isClosed)) && t.closePath();
|
|
3464
3503
|
});
|
|
@@ -3467,75 +3506,75 @@ class fs {
|
|
|
3467
3506
|
}
|
|
3468
3507
|
renderInputBox(t, s) {
|
|
3469
3508
|
var M, Q;
|
|
3470
|
-
const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.options) || s.options || {}, i = ((M = s.geometry) == null ? void 0 : M.width) || 250, n = ((Q = s.geometry) == null ? void 0 : Q.height) || 45, a = this.focusedId === s.id, r = this.lastHoveredObjectId === s.id, c = e.previewState || "default",
|
|
3471
|
-
let b = e.backgroundColor || "rgba(31, 41, 55, 1)", v = e.borderColor || "rgba(55, 65, 81, 1)",
|
|
3472
|
-
const B = `${
|
|
3473
|
-
F ? (F.backgroundColor !== void 0 && (b = F.backgroundColor), F.borderColor !== void 0 && (v = F.borderColor), F.borderWidth !== void 0 && (
|
|
3509
|
+
const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.options) || s.options || {}, i = ((M = s.geometry) == null ? void 0 : M.width) || 250, n = ((Q = s.geometry) == null ? void 0 : Q.height) || 45, a = this.focusedId === s.id, r = this.lastHoveredObjectId === s.id, c = e.previewState || "default", d = c !== "default" ? c : a ? "focused" : r ? "hovered" : "default", l = e.label || { visible: !0, text: "Label" }, f = e.helperText || { visible: !1, text: "Helper text" }, g = e.leftIcon || { visible: !1 }, u = e.rightIcon || { visible: !1 }, p = e.multiline === !0, m = e.corner_radius ?? 8, y = e.corners || { tl: m, tr: m, bl: m, br: m }, S = [y.tl, y.tr, y.br, y.bl];
|
|
3510
|
+
let b = e.backgroundColor || "rgba(31, 41, 55, 1)", v = e.borderColor || "rgba(55, 65, 81, 1)", w = e.borderWidth ?? 1.5, k = e.color || "#ffffff", A = e.placeholderColor || "rgba(156, 163, 175, 1)", x = e.fontSize || 14;
|
|
3511
|
+
const B = `${d}Style`, F = e[B];
|
|
3512
|
+
F ? (F.backgroundColor !== void 0 && (b = F.backgroundColor), F.borderColor !== void 0 && (v = F.borderColor), F.borderWidth !== void 0 && (w = F.borderWidth), F.color !== void 0 && (k = F.color), F.placeholderColor !== void 0 && (A = F.placeholderColor), F.fontSize !== void 0 && (x = F.fontSize)) : d === "focused" ? (v = e.focusBorderColor || "rgba(59, 130, 246, 1)", w = Math.max(w, 2)) : d === "hovered" || d === "hover" ? (v = e.hoverBorderColor || v, b = e.hoverBackgroundColor || b) : d === "disabled" ? (b = e.disabledBackgroundColor || "rgba(31, 41, 55, 0.6)", v = e.disabledBorderColor || "rgba(55, 65, 81, 0.4)") : d === "error" && (v = "rgba(239, 68, 68, 1)", w = Math.max(w, 2)), t.beginPath(), this.drawRoundRect(t, -i / 2, -n / 2, i, n, S);
|
|
3474
3513
|
const K = this.createCanvasFill(t, b, i, n);
|
|
3475
|
-
if (K && (t.fillStyle = K, t.fill()),
|
|
3476
|
-
const
|
|
3477
|
-
if (
|
|
3514
|
+
if (K && (t.fillStyle = K, t.fill()), w > 0) {
|
|
3515
|
+
const N = this.createCanvasFill(t, v, i, n);
|
|
3516
|
+
if (N && (t.strokeStyle = N, t.lineWidth = w, t.stroke()), d === "focused" || d === "focus") {
|
|
3478
3517
|
t.save(), t.beginPath();
|
|
3479
3518
|
const L = S.map((z) => z + 2);
|
|
3480
3519
|
this.drawRoundRect(t, -i / 2 - 2, -n / 2 - 2, i + 4, n + 4, L), t.strokeStyle = "rgba(59, 130, 246, 0.3)", t.lineWidth = 2, t.stroke(), t.restore();
|
|
3481
3520
|
}
|
|
3482
3521
|
}
|
|
3483
|
-
const tt = (
|
|
3484
|
-
if (!
|
|
3485
|
-
const z =
|
|
3522
|
+
const tt = (N, L) => {
|
|
3523
|
+
if (!N.visible || !N.svgPath) return;
|
|
3524
|
+
const z = N.size || 14, pt = N.offset ?? 16, vt = N.color || "#ffffff", yt = L ? -(i / 2) + pt : i / 2 - pt, xt = N.svgPath;
|
|
3486
3525
|
if (t.save(), t.translate(yt, 0), !xt.startsWith("<svg")) {
|
|
3487
3526
|
const kt = new Path2D(xt), Tt = z / 24;
|
|
3488
3527
|
t.scale(Tt, Tt), t.translate(-12, -12), t.fillStyle = vt, t.fill(kt);
|
|
3489
3528
|
}
|
|
3490
3529
|
t.restore();
|
|
3491
3530
|
};
|
|
3492
|
-
tt(g, !0), tt(
|
|
3493
|
-
const rt = e.text || "", at = e.placeholder || "Enter text...",
|
|
3494
|
-
t.font = `${Z} ${P}px "${J}", sans-serif`, t.fillStyle = $, t.textAlign = "left", t.textBaseline =
|
|
3495
|
-
const lt = e.inputPadding ?? 16,
|
|
3496
|
-
if (t.save(), t.beginPath(), t.rect(it - 2, -n / 2 + 4, nt + 4, n - 8), t.clip(),
|
|
3497
|
-
const
|
|
3531
|
+
tt(g, !0), tt(u, !1);
|
|
3532
|
+
const rt = e.text || "", at = e.placeholder || "Enter text...", V = !rt, O = rt || at, $ = V ? A : k, P = x, J = e.fontFamily || "Inter", Z = e.fontWeight || 400;
|
|
3533
|
+
t.font = `${Z} ${P}px "${J}", sans-serif`, t.fillStyle = $, t.textAlign = "left", t.textBaseline = p ? "top" : "middle";
|
|
3534
|
+
const lt = e.inputPadding ?? 16, Y = g.visible ? (g.offset ?? 16) + (g.size || 14) / 2 + 8 : lt, H = u.visible ? (u.offset ?? 16) + (u.size || 14) / 2 + 8 : lt, it = -(i / 2) + Y, nt = i - Y - H, ft = e.inputType === "password" ? "•".repeat(O.length) : O;
|
|
3535
|
+
if (t.save(), t.beginPath(), t.rect(it - 2, -n / 2 + 4, nt + 4, n - 8), t.clip(), p) {
|
|
3536
|
+
const N = ft.split(`
|
|
3498
3537
|
`);
|
|
3499
3538
|
let L = -n / 2 + lt;
|
|
3500
3539
|
const z = P * 1.2;
|
|
3501
3540
|
let pt = 0;
|
|
3502
|
-
|
|
3541
|
+
N.forEach((vt, yt) => {
|
|
3503
3542
|
const xt = vt.split(" ");
|
|
3504
3543
|
let kt = "";
|
|
3505
3544
|
for (let Tt = 0; Tt < xt.length; Tt++) {
|
|
3506
3545
|
const Ft = kt + xt[Tt] + " ";
|
|
3507
3546
|
t.measureText(Ft).width > nt && Tt > 0 ? (t.fillText(kt, it, L), kt = xt[Tt] + " ", L += z) : kt = Ft;
|
|
3508
3547
|
}
|
|
3509
|
-
t.fillText(kt, it, L), pt = t.measureText(kt).width, yt <
|
|
3510
|
-
}), a && !
|
|
3548
|
+
t.fillText(kt, it, L), pt = t.measureText(kt).width, yt < N.length - 1 && (L += z, pt = 0);
|
|
3549
|
+
}), a && !V && Math.floor(performance.now() / 500) % 2 === 0 && t.fillRect(it + pt, L, 1.5, P);
|
|
3511
3550
|
} else {
|
|
3512
3551
|
const L = t.measureText(ft).width;
|
|
3513
3552
|
let z = 0;
|
|
3514
|
-
if (L > nt && (z = L - nt), t.fillText(ft, it - z, 0), a && !
|
|
3553
|
+
if (L > nt && (z = L - nt), t.fillText(ft, it - z, 0), a && !V && Math.floor(performance.now() / 500) % 2 === 0) {
|
|
3515
3554
|
const vt = it + L - z;
|
|
3516
3555
|
t.fillRect(vt, -(P / 2), 1.5, P);
|
|
3517
3556
|
}
|
|
3518
3557
|
}
|
|
3519
3558
|
if (t.restore(), l.visible !== !1) {
|
|
3520
|
-
const
|
|
3559
|
+
const N = l.text || "Label", L = l.fontSize || 12, z = l.color || "rgba(156, 163, 175, 1)", pt = l.offset ?? 8;
|
|
3521
3560
|
t.font = `600 ${L}px "${J}", sans-serif`, t.fillStyle = z, t.textAlign = "left", t.textBaseline = "bottom";
|
|
3522
3561
|
const vt = -(i / 2), yt = -(n / 2) - pt;
|
|
3523
|
-
t.fillText(
|
|
3562
|
+
t.fillText(N, vt, yt);
|
|
3524
3563
|
}
|
|
3525
3564
|
if (f.visible === !0) {
|
|
3526
|
-
const
|
|
3565
|
+
const N = f.text || "Helper text", L = f.fontSize || 11, z = d === "error" ? "rgba(239, 68, 68, 1)" : f.color || "rgba(156, 163, 175, 1)", pt = f.offset ?? 6;
|
|
3527
3566
|
t.font = `400 ${L}px "${J}", sans-serif`, t.fillStyle = z, t.textAlign = "left", t.textBaseline = "top";
|
|
3528
3567
|
const vt = -(i / 2), yt = n / 2 + pt;
|
|
3529
|
-
t.fillText(
|
|
3568
|
+
t.fillText(N, vt, yt);
|
|
3530
3569
|
}
|
|
3531
3570
|
}
|
|
3532
3571
|
renderSlider(t, s) {
|
|
3533
|
-
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,
|
|
3572
|
+
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, d = (i.max ?? 100) - r, l = d === 0 ? 0 : (a - r) / d, f = i.trackHeight || 4, g = i.trackRoundedness ?? 2, u = i.trackShape ?? "Rectangle", p = i.trackPath || "", m = i.accentColor || "#3b82f6", y = i.inactiveColor || "#374151", S = i.thumbShape || "Ellipse", b = i.thumbWidth ?? 16, v = i.thumbHeight ?? 16, w = i.thumbRoundedness ?? 0, k = i.thumbColor || "#ffffff", A = i.thumbPath || "", x = i.thumbIcon || "", B = i.showValueTooltip ?? !1, F = i.tooltipBgColor || "#333333", K = i.tooltipColor || "#ffffff", tt = i.tooltipOffsetX ?? 0, rt = i.tooltipOffsetY ?? -25, at = (nt, ft, M, Q, N, L, z) => {
|
|
3534
3573
|
if ((nt === "Custom" || nt === "Icon") && z)
|
|
3535
3574
|
try {
|
|
3536
3575
|
const pt = new Path2D(z);
|
|
3537
3576
|
if (t.save(), t.translate(ft, M), nt === "Icon") {
|
|
3538
|
-
const vt = Math.min(Q,
|
|
3577
|
+
const vt = Math.min(Q, N) / 24;
|
|
3539
3578
|
t.scale(vt, vt), t.translate(-12, -12);
|
|
3540
3579
|
}
|
|
3541
3580
|
t.fill(pt), t.restore();
|
|
@@ -3544,22 +3583,22 @@ class fs {
|
|
|
3544
3583
|
console.error("Error drawing slider shape in engine:", pt);
|
|
3545
3584
|
}
|
|
3546
3585
|
if (t.beginPath(), nt === "Ellipse")
|
|
3547
|
-
t.ellipse(ft, M, Q / 2,
|
|
3586
|
+
t.ellipse(ft, M, Q / 2, N / 2, 0, 0, Math.PI * 2);
|
|
3548
3587
|
else if (nt === "Rectangle")
|
|
3549
|
-
this.drawRoundRect(t, ft - Q / 2, M -
|
|
3588
|
+
this.drawRoundRect(t, ft - Q / 2, M - N / 2, Q, N, L);
|
|
3550
3589
|
else if (nt === "Triangle")
|
|
3551
|
-
t.moveTo(ft, M -
|
|
3590
|
+
t.moveTo(ft, M - N / 2), t.lineTo(ft + Q / 2, M + N / 2), t.lineTo(ft - Q / 2, M + N / 2), t.closePath();
|
|
3552
3591
|
else if (nt === "Diamond")
|
|
3553
|
-
t.moveTo(ft, M -
|
|
3592
|
+
t.moveTo(ft, M - N / 2), t.lineTo(ft + Q / 2, M), t.lineTo(ft, M + N / 2), t.lineTo(ft - Q / 2, M), t.closePath();
|
|
3554
3593
|
else if (nt === "Polygon") {
|
|
3555
|
-
const pt = s.geometry.sides || 3, vt = s.geometry.radius || Math.min(Q,
|
|
3594
|
+
const pt = s.geometry.sides || 3, vt = s.geometry.radius || Math.min(Q, N) / 2;
|
|
3556
3595
|
for (let yt = 0; yt < pt; yt++) {
|
|
3557
3596
|
const xt = yt * 2 * Math.PI / pt - Math.PI / 2, kt = ft + vt * Math.cos(xt), Tt = M + vt * Math.sin(xt);
|
|
3558
3597
|
yt === 0 ? t.moveTo(kt, Tt) : t.lineTo(kt, Tt);
|
|
3559
3598
|
}
|
|
3560
3599
|
t.closePath();
|
|
3561
3600
|
} else if (nt === "Star") {
|
|
3562
|
-
const vt = Math.min(Q,
|
|
3601
|
+
const vt = Math.min(Q, N) / 2, yt = vt / 2;
|
|
3563
3602
|
for (let xt = 0; xt < 5 * 2; xt++) {
|
|
3564
3603
|
const kt = xt % 2 === 0 ? vt : yt, Tt = xt * Math.PI / 5 - Math.PI / 2;
|
|
3565
3604
|
t.lineTo(ft + kt * Math.cos(Tt), M + kt * Math.sin(Tt));
|
|
@@ -3567,55 +3606,55 @@ class fs {
|
|
|
3567
3606
|
t.closePath();
|
|
3568
3607
|
} else nt === "Line" && (t.moveTo(ft - Q / 2, M), t.lineTo(ft + Q / 2, M));
|
|
3569
3608
|
t.fill();
|
|
3570
|
-
},
|
|
3571
|
-
|
|
3609
|
+
}, V = this.createCanvasFill(t, y, n, f);
|
|
3610
|
+
V && (t.fillStyle = V, t.strokeStyle = V), u === "Line" ? (t.lineWidth = f, t.beginPath(), t.moveTo(-n / 2, 0), t.lineTo(n / 2, 0), t.stroke()) : at(u, 0, 0, n, f, g, p);
|
|
3572
3611
|
const O = n - b, $ = -n / 2 + b / 2 + l * O, P = $ - -n / 2;
|
|
3573
3612
|
if (P > 0) {
|
|
3574
3613
|
const nt = this.createCanvasFill(t, m, n, f);
|
|
3575
|
-
nt && (t.fillStyle = nt, t.strokeStyle = nt),
|
|
3614
|
+
nt && (t.fillStyle = nt, t.strokeStyle = nt), u === "Line" ? (t.lineWidth = f, t.beginPath(), t.moveTo(-n / 2, 0), t.lineTo($, 0), t.stroke()) : u === "Rectangle" && (t.beginPath(), this.drawRoundRect(t, -n / 2, -f / 2, P, f, g), t.fill());
|
|
3576
3615
|
}
|
|
3577
3616
|
t.save(), t.translate($, 0);
|
|
3578
3617
|
const J = t.getTransform(), Z = Math.sqrt(J.a * J.a + J.b * J.b) || 1;
|
|
3579
3618
|
t.shadowColor = "rgba(0,0,0,0.2)", t.shadowBlur = 4 * Z, t.shadowOffsetY = 1 * Z;
|
|
3580
3619
|
const lt = this.createCanvasFill(t, k, b, v);
|
|
3581
|
-
if (lt && (t.fillStyle = lt), at(S, 0, 0, b, v,
|
|
3620
|
+
if (lt && (t.fillStyle = lt), at(S, 0, 0, b, v, w, S === "Icon" ? x : A), t.restore(), B) {
|
|
3582
3621
|
t.save(), t.translate($ + tt, rt);
|
|
3583
3622
|
const nt = Math.round(a).toString();
|
|
3584
3623
|
t.font = "10px Inter, sans-serif";
|
|
3585
|
-
const ft = t.measureText(nt), M = 6, Q = 4,
|
|
3586
|
-
t.beginPath(), this.drawRoundRect(t, -
|
|
3624
|
+
const ft = t.measureText(nt), M = 6, Q = 4, N = ft.width + M * 2, L = 14 + Q;
|
|
3625
|
+
t.beginPath(), this.drawRoundRect(t, -N / 2, -L / 2, N, L, 4), t.fillStyle = F, t.fill(), t.fillStyle = K, t.textAlign = "center", t.textBaseline = "middle", t.fillText(nt, 0, 0), t.restore();
|
|
3587
3626
|
}
|
|
3588
|
-
const
|
|
3589
|
-
if (
|
|
3590
|
-
const nt =
|
|
3627
|
+
const Y = i.label || {}, H = i.helperText || {}, it = i.fontFamily || "Inter";
|
|
3628
|
+
if (Y.visible !== !1) {
|
|
3629
|
+
const nt = Y.text || "Label", ft = Y.fontSize || 12, M = Y.color || "rgba(156, 163, 175, 1)", Q = Y.offset ?? 8;
|
|
3591
3630
|
t.font = `600 ${ft}px "${it}", sans-serif`, t.fillStyle = M, t.textAlign = "left", t.textBaseline = "bottom";
|
|
3592
|
-
const
|
|
3593
|
-
t.fillText(nt,
|
|
3631
|
+
const N = -(n / 2), L = -(f / 2) - Q;
|
|
3632
|
+
t.fillText(nt, N, L);
|
|
3594
3633
|
}
|
|
3595
3634
|
if (H.visible === !0) {
|
|
3596
3635
|
const nt = H.text || "Helper text", ft = H.fontSize || 11, M = H.color || "rgba(156, 163, 175, 1)", Q = H.offset ?? 6;
|
|
3597
3636
|
t.font = `400 ${ft}px "${it}", sans-serif`, t.fillStyle = M, t.textAlign = "left", t.textBaseline = "top";
|
|
3598
|
-
const
|
|
3599
|
-
t.fillText(nt,
|
|
3637
|
+
const N = -(n / 2), L = f / 2 + Q;
|
|
3638
|
+
t.fillText(nt, N, L);
|
|
3600
3639
|
}
|
|
3601
3640
|
}
|
|
3602
3641
|
renderDropdown(t, s) {
|
|
3603
3642
|
var rt;
|
|
3604
3643
|
const o = this.objectStates.get(s.id);
|
|
3605
3644
|
if (!o) return;
|
|
3606
|
-
const e = o.options || s.options || {}, i = s.geometry.width || 160, n = s.geometry.height || 40, a = -i / 2, r = -n / 2, c = e.corner_radius ?? 6,
|
|
3607
|
-
let g = e.backgroundColor,
|
|
3608
|
-
|
|
3645
|
+
const e = o.options || s.options || {}, i = s.geometry.width || 160, n = s.geometry.height || 40, a = -i / 2, r = -n / 2, c = e.corner_radius ?? 6, d = e.disabled || e.previewState === "disabled", l = this.lastHoveredObjectId === s.id || e.previewState === "hover", f = (e.isOpen || e.previewState === "active") && !d;
|
|
3646
|
+
let g = e.backgroundColor, u = e.borderColor, p = e.color || "#333333";
|
|
3647
|
+
d ? (g = e.disabledBackgroundColor || "#f3f4f6", u = e.disabledBorderColor || "#e5e7eb", p = e.disabledColor || "#9ca3af") : f ? (g = e.activeBackgroundColor || g, u = e.activeBorderColor || u, p = e.activeColor || p) : l && (g = e.hoverBackgroundColor || g, u = e.hoverBorderColor || u, p = e.hoverColor || p), g || (g = "#ffffff"), u || (u = "#e5e7eb");
|
|
3609
3648
|
const m = t.globalAlpha;
|
|
3610
3649
|
t.globalAlpha = m * (e.opacity ?? 1), this.drawRoundRect(t, a, r, i, n, c), t.fillStyle = this.createCanvasFill(t, typeof g == "string" ? { type: "Solid", color: g } : g, i, n) || "#ffffff", t.fill();
|
|
3611
3650
|
const y = e.borderWidth ?? 1;
|
|
3612
|
-
y > 0 && (t.strokeStyle = this.createCanvasFill(t, typeof
|
|
3613
|
-
const S = 12, b = e.chevronType || "chevron", v = e.chevronSize || 16,
|
|
3651
|
+
y > 0 && (t.strokeStyle = this.createCanvasFill(t, typeof u == "string" ? { type: "Solid", color: u } : u, i, n) || "#e5e7eb", t.lineWidth = y, t.stroke());
|
|
3652
|
+
const S = 12, b = e.chevronType || "chevron", v = e.chevronSize || 16, w = (f ? e.openIconColor : e.closedIconColor) || e.chevronColor || "#6b7280";
|
|
3614
3653
|
if (b !== "none") {
|
|
3615
3654
|
const at = a + i - S - v / 2;
|
|
3616
3655
|
t.save(), t.translate(at, 0);
|
|
3617
|
-
const
|
|
3618
|
-
if (t.rotate(
|
|
3656
|
+
const V = f ? e.openIconAngle ?? 180 : e.closedIconAngle ?? 0;
|
|
3657
|
+
if (t.rotate(V * Math.PI / 180), t.strokeStyle = w, t.fillStyle = w, t.lineWidth = 1.5, t.lineCap = "round", t.lineJoin = "round", b === "chevron")
|
|
3619
3658
|
t.beginPath(), t.moveTo(-v / 2, -v * 0.2), t.lineTo(0, v * 0.2), t.lineTo(v / 2, -v * 0.2), t.stroke();
|
|
3620
3659
|
else if (b === "custom" || b === "path") {
|
|
3621
3660
|
const O = f && e.openIconPath || e.closedIconPath;
|
|
@@ -3630,24 +3669,24 @@ class fs {
|
|
|
3630
3669
|
}
|
|
3631
3670
|
const k = e.selectedOption || e.placeholder || "Select...", A = e.fontSize || 14, x = e.fontWeight || 400, B = e.fontFamily || "Inter, sans-serif";
|
|
3632
3671
|
t.font = `${x} ${A}px ${B}`;
|
|
3633
|
-
const F =
|
|
3672
|
+
const F = d ? e.disabledColor || "#9ca3af" : !e.selectedOption && e.placeholder ? "#9ca3af" : p;
|
|
3634
3673
|
t.fillStyle = this.createCanvasFill(t, typeof F == "string" ? { type: "Solid", color: F } : F, i, n) || "#333333", t.textAlign = "left", t.textBaseline = "middle";
|
|
3635
3674
|
const K = b === "none" ? 0 : v + 8, tt = i - S * 2 - K;
|
|
3636
|
-
if (t.save(), t.beginPath(), t.rect(a + S, r, tt, n), t.clip(), t.fillText(k, a + S, 0), t.restore(), f && !
|
|
3637
|
-
const at = r + n + 4,
|
|
3675
|
+
if (t.save(), t.beginPath(), t.rect(a + S, r, tt, n), t.clip(), t.fillText(k, a + S, 0), t.restore(), f && !d) {
|
|
3676
|
+
const at = r + n + 4, V = e.optionsList || [], O = e.itemHeight || 32, $ = e.listPadding ?? 4, P = V.length * O + $ * 2, J = e.listCornerRadius ?? c;
|
|
3638
3677
|
t.save();
|
|
3639
|
-
const Z = e.listShadow || {}, lt = t.getTransform(),
|
|
3640
|
-
t.shadowColor = typeof Z.color == "string" ? Z.color : ((rt = Z.color) == null ? void 0 : rt.color) || "rgba(0,0,0,0.15)", t.shadowBlur = (Z.blur ?? 12) *
|
|
3678
|
+
const Z = e.listShadow || {}, lt = t.getTransform(), Y = Math.sqrt(lt.a * lt.a + lt.b * lt.b) || 1;
|
|
3679
|
+
t.shadowColor = typeof Z.color == "string" ? Z.color : ((rt = Z.color) == null ? void 0 : rt.color) || "rgba(0,0,0,0.15)", t.shadowBlur = (Z.blur ?? 12) * Y, t.shadowOffsetY = (Z.offsetY ?? 6) * Y, t.shadowOffsetX = (Z.offsetX ?? 0) * Y, t.beginPath(), this.drawRoundRect(t, a, at, i, P, J), t.fillStyle = this.createCanvasFill(t, typeof e.listBackgroundColor == "string" ? { type: "Solid", color: e.listBackgroundColor } : e.listBackgroundColor || { type: "Solid", color: "#ffffff" }, i, P) || "#ffffff", t.fill();
|
|
3641
3680
|
const H = e.listBorderWidth ?? 1;
|
|
3642
|
-
H > 0 && (t.shadowColor = "transparent", t.strokeStyle = this.createCanvasFill(t, typeof e.listBorderColor == "string" ? { type: "Solid", color: e.listBorderColor } : e.listBorderColor || { type: "Solid", color:
|
|
3681
|
+
H > 0 && (t.shadowColor = "transparent", t.strokeStyle = this.createCanvasFill(t, typeof e.listBorderColor == "string" ? { type: "Solid", color: e.listBorderColor } : e.listBorderColor || { type: "Solid", color: u }, i, P) || "#e5e7eb", t.lineWidth = H, t.stroke()), t.restore();
|
|
3643
3682
|
const it = e.itemFontSize || A, nt = e.itemFontFamily || B;
|
|
3644
|
-
t.font = `${x} ${it}px ${nt}`,
|
|
3683
|
+
t.font = `${x} ${it}px ${nt}`, V.forEach((ft, M) => {
|
|
3645
3684
|
const Q = at + $ + M * O;
|
|
3646
3685
|
if (ft === e.selectedOption)
|
|
3647
|
-
t.fillStyle = this.createCanvasFill(t, typeof e.itemSelectedBackgroundColor == "string" ? { type: "Solid", color: e.itemSelectedBackgroundColor } : e.itemSelectedBackgroundColor || { type: "Solid", color: "#f3f4f6" }, i, O) || "#f3f4f6", t.fillRect(a + H, Q, i - H * 2, O), t.fillStyle = e.itemSelectedColor || e.accentColor ||
|
|
3648
|
-
else if (t.fillStyle = e.listTextColor ||
|
|
3686
|
+
t.fillStyle = this.createCanvasFill(t, typeof e.itemSelectedBackgroundColor == "string" ? { type: "Solid", color: e.itemSelectedBackgroundColor } : e.itemSelectedBackgroundColor || { type: "Solid", color: "#f3f4f6" }, i, O) || "#f3f4f6", t.fillRect(a + H, Q, i - H * 2, O), t.fillStyle = e.itemSelectedColor || e.accentColor || p || "#374151";
|
|
3687
|
+
else if (t.fillStyle = e.listTextColor || p || "#333333", this.activeDropdownId === s.id && this._lastPointerPos) {
|
|
3649
3688
|
const L = this._lastPointerPos.y - (at + $), z = Math.floor(L / O);
|
|
3650
|
-
M === z && (t.fillStyle = this.createCanvasFill(t, typeof e.itemHoverBackgroundColor == "string" ? { type: "Solid", color: e.itemHoverBackgroundColor } : e.itemHoverBackgroundColor || { type: "Solid", color: "#f9fafb" }, i, O) || "#f9fafb", t.fillRect(a + H, Q, i - H * 2, O), t.fillStyle = e.itemHoverColor ||
|
|
3689
|
+
M === z && (t.fillStyle = this.createCanvasFill(t, typeof e.itemHoverBackgroundColor == "string" ? { type: "Solid", color: e.itemHoverBackgroundColor } : e.itemHoverBackgroundColor || { type: "Solid", color: "#f9fafb" }, i, O) || "#f9fafb", t.fillRect(a + H, Q, i - H * 2, O), t.fillStyle = e.itemHoverColor || p);
|
|
3651
3690
|
}
|
|
3652
3691
|
t.fillText(ft, a + S, Q + O / 2);
|
|
3653
3692
|
});
|
|
@@ -3656,52 +3695,52 @@ class fs {
|
|
|
3656
3695
|
}
|
|
3657
3696
|
renderButton(t, s) {
|
|
3658
3697
|
if (s.children && s.children.length > 0) return;
|
|
3659
|
-
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, c = this.activeObjectId === s.id,
|
|
3660
|
-
let
|
|
3661
|
-
c && f ? (
|
|
3662
|
-
const
|
|
3663
|
-
t.save(), t.scale(v, v), t.beginPath(), this.drawRoundRect(t,
|
|
3664
|
-
const A = this.createCanvasFill(t,
|
|
3698
|
+
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, c = this.activeObjectId === s.id, d = e.label || {}, l = e.hoverStyle || {}, f = e.activeStyle || {}, g = e.icon || { enabled: !1 };
|
|
3699
|
+
let u = e.backgroundColor || "#3b82f6", p = d.color || "#ffffff", m = d.text || "Button", y = i.cornerRadius ?? 8, S = e.borderColor || "transparent", b = e.borderWidth || 0, v = 1;
|
|
3700
|
+
c && f ? (u = f.backgroundColor || u, p = f.color || p, m = f.text || m, v = f.scale ?? 0.95, y = f.cornerRadius ?? y) : r && l && (u = l.backgroundColor || u, p = l.color || p, m = l.text || m, v = l.scale ?? 1, y = l.cornerRadius ?? y, S = l.borderColor || S);
|
|
3701
|
+
const w = -n / 2, k = -a / 2;
|
|
3702
|
+
t.save(), t.scale(v, v), t.beginPath(), this.drawRoundRect(t, w, k, n, a, y);
|
|
3703
|
+
const A = this.createCanvasFill(t, u, n, a);
|
|
3665
3704
|
A && (t.fillStyle = A, t.fill()), (b > 0 || r && l.borderColor) && (t.strokeStyle = S, t.lineWidth = b || (r ? 1 : 0), t.stroke());
|
|
3666
|
-
const x =
|
|
3667
|
-
t.font = `${F} ${x}px "${B}", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`, t.fillStyle =
|
|
3705
|
+
const x = d.fontSize || 14, B = d.fontFamily || "Inter", F = d.fontWeight || 600;
|
|
3706
|
+
t.font = `${F} ${x}px "${B}", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`, t.fillStyle = p, t.textAlign = "center", t.textBaseline = "middle";
|
|
3668
3707
|
let K = 0;
|
|
3669
3708
|
if (g.enabled && g.svgPath) {
|
|
3670
3709
|
const tt = x * 1.1, rt = g.gap || 8, at = t.measureText(m), O = -(at.width + tt + rt) / 2, $ = g.position === "left" ? O + tt / 2 : O + at.width + rt + tt / 2;
|
|
3671
3710
|
K = g.position === "left" ? O + tt + rt + at.width / 2 : O + at.width / 2, t.save(), t.translate($, 0);
|
|
3672
3711
|
const P = new Path2D(g.svgPath), J = tt / 24;
|
|
3673
|
-
t.scale(J, J), t.translate(-12, -12), t.fillStyle =
|
|
3712
|
+
t.scale(J, J), t.translate(-12, -12), t.fillStyle = p, t.fill(P), t.restore();
|
|
3674
3713
|
}
|
|
3675
3714
|
t.fillText(m, K, 0), t.restore();
|
|
3676
3715
|
}
|
|
3677
3716
|
renderToggleButton(t, s) {
|
|
3678
3717
|
var m, y;
|
|
3679
|
-
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, c = -a / 2,
|
|
3680
|
-
t.save(), t.beginPath(), this.drawRoundRect(t, r, c, n, a,
|
|
3681
|
-
const
|
|
3682
|
-
t.font = `${l.fontWeight || 600} ${
|
|
3718
|
+
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, c = -a / 2, d = e.corner_radius ?? 8, l = e.label || {}, f = i ? e.accentColor || "#3b82f6" : e.inactiveColor || "#374151", g = i ? e.activeTextColor || "#ffffff" : e.inactiveTextColor || "#9ca3af";
|
|
3719
|
+
t.save(), t.beginPath(), this.drawRoundRect(t, r, c, n, a, d), t.fillStyle = f, t.fill();
|
|
3720
|
+
const u = l.fontSize || 14, p = l.fontFamily || "Inter";
|
|
3721
|
+
t.font = `${l.fontWeight || 600} ${u}px "${p}", sans-serif`, t.fillStyle = g, t.textAlign = "center", t.textBaseline = "middle", t.fillText(l.text || "Toggle", 0, 0), t.restore();
|
|
3683
3722
|
}
|
|
3684
3723
|
renderToggle(t, s) {
|
|
3685
|
-
var J, Z, lt,
|
|
3686
|
-
const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.options) || s.options || {}, i = ((J = s.geometry) == null ? void 0 : J.width) || 52, n = ((Z = s.geometry) == null ? void 0 : Z.height) || 30, a = -i / 2, r = -n / 2, c = e.checked ?? !1,
|
|
3687
|
-
e.disabled && (t.globalAlpha *= 0.5), t.beginPath(), this.drawRoundRect(t, a, r, i, n,
|
|
3724
|
+
var J, Z, lt, Y, H, it, nt, ft, M, Q, N, L;
|
|
3725
|
+
const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.options) || s.options || {}, i = ((J = s.geometry) == null ? void 0 : J.width) || 52, n = ((Z = s.geometry) == null ? void 0 : Z.height) || 30, a = -i / 2, r = -n / 2, c = e.checked ?? !1, d = e.cornerRadius ?? e.corner_radius ?? n / 2, l = e.toggleStyle || {}, f = l.backgroundColor || e.activeColor || "#10b981", g = l.borderColor || e.borderColor || "transparent", u = l.borderWidth ?? e.borderWidth ?? 0, p = l.knobColor || e.knobColor || "#ffffff", m = c ? f : e.inactiveColor || "#374151", y = c ? g : e.borderColor || "transparent", S = c ? u : e.borderWidth ?? 0, b = c ? p : e.knobColor || "#ffffff";
|
|
3726
|
+
e.disabled && (t.globalAlpha *= 0.5), t.beginPath(), this.drawRoundRect(t, a, r, i, n, d);
|
|
3688
3727
|
const v = this.createCanvasFill(t, m, i, n);
|
|
3689
3728
|
if (v && (t.fillStyle = v, t.fill()), S > 0) {
|
|
3690
3729
|
t.lineWidth = S;
|
|
3691
3730
|
const z = this.createCanvasFill(t, y, i, n);
|
|
3692
3731
|
z && (t.strokeStyle = z, t.stroke());
|
|
3693
3732
|
}
|
|
3694
|
-
const
|
|
3733
|
+
const w = 2, k = n - w * 2, A = k / 2, x = a + w, B = a + i - w - k, F = c ? B : x, K = r + w;
|
|
3695
3734
|
t.beginPath(), t.arc(F + A, K + A, A, 0, Math.PI * 2);
|
|
3696
3735
|
const tt = this.createCanvasFill(t, b, k, k);
|
|
3697
3736
|
tt && (t.fillStyle = tt, t.fill()), e.disabled && (t.globalAlpha *= 2);
|
|
3698
3737
|
let rt = !1, at = !1;
|
|
3699
|
-
const
|
|
3700
|
-
if ((nt = e.leftLabel) != null && nt.enabled &&
|
|
3738
|
+
const V = (c ? (lt = l.leftLabel) == null ? void 0 : lt.text : null) || ((Y = e.leftLabel) == null ? void 0 : Y.text) || "", O = (c ? (H = l.leftLabel) == null ? void 0 : H.color : null) || ((it = e.leftLabel) == null ? void 0 : it.color) || "#f3f4f6";
|
|
3739
|
+
if ((nt = e.leftLabel) != null && nt.enabled && V) {
|
|
3701
3740
|
const z = e.leftLabel;
|
|
3702
|
-
t.font = `${z.fontWeight || 400} ${z.fontSize || 12}px "${z.fontFamily || "Inter"}", sans-serif`, t.fillStyle = O, t.textBaseline = "middle", t.textAlign = "right", t.fillText(
|
|
3741
|
+
t.font = `${z.fontWeight || 400} ${z.fontSize || 12}px "${z.fontFamily || "Inter"}", sans-serif`, t.fillStyle = O, t.textBaseline = "middle", t.textAlign = "right", t.fillText(V, a - (z.gap || 8), 0), rt = !0;
|
|
3703
3742
|
}
|
|
3704
|
-
const $ = (c ? (ft = l.rightLabel) == null ? void 0 : ft.text : null) || ((M = e.rightLabel) == null ? void 0 : M.text) || "", P = (c ? (Q = l.rightLabel) == null ? void 0 : Q.color : null) || ((
|
|
3743
|
+
const $ = (c ? (ft = l.rightLabel) == null ? void 0 : ft.text : null) || ((M = e.rightLabel) == null ? void 0 : M.text) || "", P = (c ? (Q = l.rightLabel) == null ? void 0 : Q.color : null) || ((N = e.rightLabel) == null ? void 0 : N.color) || "#f3f4f6";
|
|
3705
3744
|
if ((L = e.rightLabel) != null && L.enabled && $) {
|
|
3706
3745
|
const z = e.rightLabel;
|
|
3707
3746
|
t.font = `${z.fontWeight || 400} ${z.fontSize || 12}px "${z.fontFamily || "Inter"}", sans-serif`, t.fillStyle = P, t.textBaseline = "middle", t.textAlign = "left", t.fillText($, a + i + (z.gap || 8), 0), at = !0;
|
|
@@ -3730,17 +3769,17 @@ class fs {
|
|
|
3730
3769
|
pointFill: s.pointFill || "#ffffff",
|
|
3731
3770
|
pointStrokeColor: s.pointStrokeColor || s.lineColor || "#3b82f6",
|
|
3732
3771
|
pointStrokeWidth: s.pointStrokeWidth || 2
|
|
3733
|
-
}]), !i || i.length === 0 || !i.some((
|
|
3772
|
+
}]), !i || i.length === 0 || !i.some((p) => p.data && p.data.length >= 2)) {
|
|
3734
3773
|
t.save(), t.fillStyle = "#6366f1", t.font = "12px Inter, system-ui, sans-serif", t.textAlign = "center", t.textBaseline = "middle", t.fillText("NO DATA", 0, 0), t.restore();
|
|
3735
3774
|
return;
|
|
3736
3775
|
}
|
|
3737
3776
|
let n = 1 / 0, a = -1 / 0, r = 0;
|
|
3738
|
-
if (i.forEach((
|
|
3739
|
-
let m =
|
|
3740
|
-
if (
|
|
3741
|
-
let y = this.inputs.get(
|
|
3777
|
+
if (i.forEach((p) => {
|
|
3778
|
+
let m = p.data;
|
|
3779
|
+
if (p.isVarEnabled && p.inputId) {
|
|
3780
|
+
let y = this.inputs.get(p.inputId);
|
|
3742
3781
|
if (y === void 0) {
|
|
3743
|
-
const S = this.inputNameMap.get(
|
|
3782
|
+
const S = this.inputNameMap.get(p.inputId);
|
|
3744
3783
|
S && S.length > 0 && (y = this.inputs.get(S[0]));
|
|
3745
3784
|
}
|
|
3746
3785
|
y && Array.isArray(y) && (m = y);
|
|
@@ -3749,34 +3788,34 @@ class fs {
|
|
|
3749
3788
|
const y = m.filter((S) => typeof S == "number" && !isNaN(S));
|
|
3750
3789
|
y.length > 0 && (n = Math.min(n, ...y), a = Math.max(a, ...y), r = Math.max(r, m.length));
|
|
3751
3790
|
}
|
|
3752
|
-
|
|
3791
|
+
p._resolvedData = m;
|
|
3753
3792
|
}), r < 2) return;
|
|
3754
|
-
const c = a - n,
|
|
3755
|
-
const m = c === 0 ? 0.5 : (
|
|
3793
|
+
const c = a - n, d = o / (r - 1), l = (p) => {
|
|
3794
|
+
const m = c === 0 ? 0.5 : (p - n) / c;
|
|
3756
3795
|
return e / 2 - m * e;
|
|
3757
|
-
}, f = (
|
|
3796
|
+
}, f = (p) => p * d - o / 2, g = s.axisColor || "#333333";
|
|
3758
3797
|
if (s.showXAxis && (t.beginPath(), t.strokeStyle = s.xAxisColor || g, 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 || g, 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) {
|
|
3759
3798
|
t.textAlign = "center", t.textBaseline = "top";
|
|
3760
|
-
for (let
|
|
3761
|
-
const m = f(
|
|
3762
|
-
t.fillText(`${
|
|
3799
|
+
for (let p = 0; p < r; p++) {
|
|
3800
|
+
const m = f(p);
|
|
3801
|
+
t.fillText(`${p + 1}`, m, e / 2 + 5);
|
|
3763
3802
|
}
|
|
3764
3803
|
}
|
|
3765
3804
|
if (s.showYLabels) {
|
|
3766
3805
|
t.textAlign = "right", t.textBaseline = "middle";
|
|
3767
|
-
const
|
|
3768
|
-
t.fillText(a.toFixed(1),
|
|
3806
|
+
const p = -o / 2 - 5, m = (a + n) / 2;
|
|
3807
|
+
t.fillText(a.toFixed(1), p, l(a)), t.fillText(m.toFixed(1), p, l(m)), t.fillText(n.toFixed(1), p, l(n));
|
|
3769
3808
|
}
|
|
3770
|
-
const
|
|
3771
|
-
if (i.forEach((
|
|
3772
|
-
const m =
|
|
3809
|
+
const u = 10;
|
|
3810
|
+
if (i.forEach((p) => {
|
|
3811
|
+
const m = p._resolvedData;
|
|
3773
3812
|
if (!(!m || m.length < 2)) {
|
|
3774
|
-
if (
|
|
3775
|
-
if (t.beginPath(), t.moveTo(f(0), e / 2), t.lineTo(f(0), l(m[0])),
|
|
3813
|
+
if (p.showArea) {
|
|
3814
|
+
if (t.beginPath(), t.moveTo(f(0), e / 2), t.lineTo(f(0), l(m[0])), p.smoothing && m.length > 2)
|
|
3776
3815
|
for (let S = 0; S < m.length - 1; S++) {
|
|
3777
|
-
const b = m[S === 0 ? S : S - 1], v = m[S],
|
|
3778
|
-
for (let A = 1; A <=
|
|
3779
|
-
const x = A /
|
|
3816
|
+
const b = m[S === 0 ? S : S - 1], v = m[S], w = m[S + 1], k = m[S + 1 === m.length - 1 ? S + 1 : S + 2];
|
|
3817
|
+
for (let A = 1; A <= u; A++) {
|
|
3818
|
+
const x = A / u, B = this._catmullRom(b, v, w, k, x);
|
|
3780
3819
|
t.lineTo(f(S + x), l(B));
|
|
3781
3820
|
}
|
|
3782
3821
|
}
|
|
@@ -3785,31 +3824,31 @@ class fs {
|
|
|
3785
3824
|
t.lineTo(f(S), l(m[S]));
|
|
3786
3825
|
t.lineTo(f(m.length - 1), e / 2), t.closePath();
|
|
3787
3826
|
const y = t.globalAlpha;
|
|
3788
|
-
t.globalAlpha = y * (s.areaOpacity ?? 0.3), t.fillStyle =
|
|
3827
|
+
t.globalAlpha = y * (s.areaOpacity ?? 0.3), t.fillStyle = p.areaColor || "rgba(139, 92, 246, 0.2)", t.fill(), t.globalAlpha = y;
|
|
3789
3828
|
}
|
|
3790
|
-
if (t.beginPath(), t.strokeStyle =
|
|
3829
|
+
if (t.beginPath(), t.strokeStyle = p.lineColor || "#3b82f6", t.lineWidth = p.lineWidth || 2, t.lineJoin = "round", t.lineCap = "round", t.moveTo(f(0), l(m[0])), p.smoothing && m.length > 2)
|
|
3791
3830
|
for (let y = 0; y < m.length - 1; y++) {
|
|
3792
|
-
const S = m[y === 0 ? y : y - 1], b = m[y], v = m[y + 1],
|
|
3793
|
-
for (let k = 1; k <=
|
|
3794
|
-
const A = k /
|
|
3831
|
+
const S = m[y === 0 ? y : y - 1], b = m[y], v = m[y + 1], w = m[y + 1 === m.length - 1 ? y + 1 : y + 2];
|
|
3832
|
+
for (let k = 1; k <= u; k++) {
|
|
3833
|
+
const A = k / u, x = this._catmullRom(S, b, v, w, A);
|
|
3795
3834
|
t.lineTo(f(y + A), l(x));
|
|
3796
3835
|
}
|
|
3797
3836
|
}
|
|
3798
3837
|
else
|
|
3799
3838
|
for (let y = 1; y < m.length; y++)
|
|
3800
3839
|
t.lineTo(f(y), l(m[y]));
|
|
3801
|
-
t.stroke(),
|
|
3840
|
+
t.stroke(), p.showPoints && m.forEach((y, S) => {
|
|
3802
3841
|
const b = f(S), v = l(y);
|
|
3803
|
-
t.beginPath(), t.arc(b, v, (
|
|
3842
|
+
t.beginPath(), t.arc(b, v, (p.pointSize || 6) / 2, 0, Math.PI * 2), t.fillStyle = p.pointFill || "#ffffff", t.fill(), t.strokeStyle = p.pointStrokeColor || p.lineColor || "#3b82f6", t.lineWidth = p.pointStrokeWidth || 1, t.stroke();
|
|
3804
3843
|
});
|
|
3805
3844
|
}
|
|
3806
3845
|
}), s.showLegend && i.length > 0) {
|
|
3807
|
-
const
|
|
3846
|
+
const p = o / 2 - 10;
|
|
3808
3847
|
let m = -e / 2 + 15;
|
|
3809
3848
|
const y = s.legendFontSize || 10, S = y + 5;
|
|
3810
3849
|
t.font = `${y}px Inter, sans-serif`, t.textAlign = "right", t.textBaseline = "alphabetic", i.forEach((b) => {
|
|
3811
|
-
const
|
|
3812
|
-
t.beginPath(), t.rect(
|
|
3850
|
+
const w = b.label || "Series", k = t.measureText(w).width;
|
|
3851
|
+
t.beginPath(), t.rect(p - k - 8 - 5, m - (8 / 2 + 2), 8, 8), t.fillStyle = b.lineColor || "#3b82f6", t.fill(), t.fillStyle = s.legendColor || "#333333", t.fillText(w, p, m), m += S;
|
|
3813
3852
|
});
|
|
3814
3853
|
}
|
|
3815
3854
|
}
|
|
@@ -3826,59 +3865,59 @@ class fs {
|
|
|
3826
3865
|
if (!s || s.type === "None") return null;
|
|
3827
3866
|
if (typeof s == "string") return s;
|
|
3828
3867
|
if (s.type === "Solid" && s.color) {
|
|
3829
|
-
const r = s.color,
|
|
3830
|
-
return t.fillStyle =
|
|
3868
|
+
const r = s.color, d = (((n = (i = this.artboard) == null ? void 0 : i.tokens) == null ? void 0 : n.colors) || {})[r] || r;
|
|
3869
|
+
return t.fillStyle = d, d;
|
|
3831
3870
|
}
|
|
3832
3871
|
if ((s.type === "LinearGradient" || s.type === "RadialGradient" || s.type === "AngularGradient" || s.type === "DiamondGradient") && s.stops) {
|
|
3833
|
-
const r = (c,
|
|
3834
|
-
var v,
|
|
3835
|
-
const f = (((
|
|
3836
|
-
if (
|
|
3872
|
+
const r = (c, d = 100) => {
|
|
3873
|
+
var v, w;
|
|
3874
|
+
const f = (((w = (v = this.artboard) == null ? void 0 : v.tokens) == null ? void 0 : w.colors) || {})[c] || c, g = this.normalizeOpacity(s.opacity ?? 100), p = this.normalizeOpacity(d) * g;
|
|
3875
|
+
if (p >= 1 && f.startsWith("#")) return f;
|
|
3837
3876
|
const m = f.startsWith("#") ? f.replace("#", "") : "ffffff", y = parseInt(m.substring(0, 2), 16), S = parseInt(m.substring(2, 4), 16), b = parseInt(m.substring(4, 6), 16);
|
|
3838
|
-
return `rgba(${y}, ${S}, ${b}, ${
|
|
3877
|
+
return `rgba(${y}, ${S}, ${b}, ${p})`;
|
|
3839
3878
|
};
|
|
3840
3879
|
if (s.type === "LinearGradient") {
|
|
3841
|
-
const c = (
|
|
3842
|
-
if (s.stops.forEach((
|
|
3843
|
-
const m =
|
|
3844
|
-
|
|
3845
|
-
}), s.gradientTransform &&
|
|
3846
|
-
const [
|
|
3847
|
-
|
|
3880
|
+
const c = (p, m, y) => Array.isArray(p) ? p[m] ?? (m === 0 ? 0 : 1) : p && typeof p == "object" ? p[y] ?? (m === 0 ? 0 : 1) : m === 0 ? 0 : 1, d = c(s.start, 0, "x") * o - o / 2, l = c(s.start, 1, "y") * e - e / 2, f = c(s.end, 0, "x") * o - o / 2, g = c(s.end, 1, "y") * e - e / 2, u = t.createLinearGradient(d, l, f, g);
|
|
3881
|
+
if (s.stops.forEach((p) => {
|
|
3882
|
+
const m = p.offset !== void 0 ? p.offset : p.pos !== void 0 ? p.pos : p.position !== void 0 ? p.position : 0, y = r(p.color || "#000000", p.opacity ?? 100);
|
|
3883
|
+
u.addColorStop(Math.max(0, Math.min(1, m)), y);
|
|
3884
|
+
}), s.gradientTransform && u.setTransform) {
|
|
3885
|
+
const [p, m, y, S, b, v] = s.gradientTransform;
|
|
3886
|
+
u.setTransform({ a: p, b: m, c: y, d: S, e: b, f: v });
|
|
3848
3887
|
}
|
|
3849
|
-
return
|
|
3888
|
+
return u;
|
|
3850
3889
|
} else if (s.type === "RadialGradient") {
|
|
3851
|
-
const c = (
|
|
3852
|
-
if (s.stops.forEach((
|
|
3853
|
-
const
|
|
3854
|
-
g.addColorStop(Math.max(0, Math.min(1,
|
|
3890
|
+
const c = (u, p, m) => Array.isArray(u) ? u[p] ?? 0.5 : u && typeof u == "object" ? u[m] ?? 0.5 : 0.5, d = c(s.center, 0, "x") * o - o / 2, l = c(s.center, 1, "y") * e - e / 2, f = (s.radius ?? 0.5) * Math.max(o, e), g = t.createRadialGradient(d, l, 0, d, l, f);
|
|
3891
|
+
if (s.stops.forEach((u) => {
|
|
3892
|
+
const p = u.offset !== void 0 ? u.offset : u.pos !== void 0 ? u.pos : u.position !== void 0 ? u.position : 0, m = r(u.color || "#000000", u.opacity ?? 100);
|
|
3893
|
+
g.addColorStop(Math.max(0, Math.min(1, p)), m);
|
|
3855
3894
|
}), s.gradientTransform && g.setTransform) {
|
|
3856
|
-
const [
|
|
3857
|
-
g.setTransform({ a:
|
|
3895
|
+
const [u, p, m, y, S, b] = s.gradientTransform;
|
|
3896
|
+
g.setTransform({ a: u, b: p, c: m, d: y, e: S, f: b });
|
|
3858
3897
|
}
|
|
3859
3898
|
return g;
|
|
3860
3899
|
} else if (s.type === "AngularGradient") {
|
|
3861
|
-
const c = (
|
|
3900
|
+
const c = (u, p, m) => Array.isArray(u) ? u[p] ?? 0.5 : u && typeof u == "object" ? u[m] ?? 0.5 : 0.5, d = c(s.center || [0.5, 0.5], 0, "x") * o - o / 2, l = c(s.center || [0.5, 0.5], 1, "y") * e - e / 2, f = (s.degree || s.angle || 0) * (Math.PI / 180), g = (a = t.createConicGradient) == null ? void 0 : a.call(t, f, d, l);
|
|
3862
3901
|
if (g) {
|
|
3863
|
-
if (s.stops.forEach((
|
|
3864
|
-
const
|
|
3865
|
-
g.addColorStop(Math.max(0, Math.min(1,
|
|
3902
|
+
if (s.stops.forEach((u) => {
|
|
3903
|
+
const p = u.offset !== void 0 ? u.offset : u.pos !== void 0 ? u.pos : u.position !== void 0 ? u.position : 0, m = r(u.color || "#000000", u.opacity ?? 100);
|
|
3904
|
+
g.addColorStop(Math.max(0, Math.min(1, p)), m);
|
|
3866
3905
|
}), s.gradientTransform && g.setTransform) {
|
|
3867
|
-
const [
|
|
3868
|
-
g.setTransform({ a:
|
|
3906
|
+
const [u, p, m, y, S, b] = s.gradientTransform;
|
|
3907
|
+
g.setTransform({ a: u, b: p, c: m, d: y, e: S, f: b });
|
|
3869
3908
|
}
|
|
3870
3909
|
return g;
|
|
3871
3910
|
}
|
|
3872
3911
|
} else if (s.type === "DiamondGradient") {
|
|
3873
|
-
const c = (
|
|
3874
|
-
t.save(), t.translate(
|
|
3912
|
+
const c = (u, p, m) => Array.isArray(u) ? u[p] ?? 0.5 : u && typeof u == "object" ? u[m] ?? 0.5 : 0.5, d = c(s.center || [0.5, 0.5], 0, "x") * o - o / 2, l = c(s.center || [0.5, 0.5], 1, "y") * e - e / 2, f = (s.radius ?? 0.5) * Math.max(o, e);
|
|
3913
|
+
t.save(), t.translate(d, l), t.rotate(Math.PI / 4);
|
|
3875
3914
|
const g = t.createRadialGradient(0, 0, 0, 0, 0, f);
|
|
3876
|
-
if (s.stops.forEach((
|
|
3877
|
-
const
|
|
3878
|
-
g.addColorStop(Math.max(0, Math.min(1,
|
|
3915
|
+
if (s.stops.forEach((u) => {
|
|
3916
|
+
const p = u.offset !== void 0 ? u.offset : u.pos !== void 0 ? u.pos : u.position !== void 0 ? u.position : 0, m = r(u.color || "#000000", u.opacity ?? 100);
|
|
3917
|
+
g.addColorStop(Math.max(0, Math.min(1, p)), m);
|
|
3879
3918
|
}), s.gradientTransform && g.setTransform) {
|
|
3880
|
-
const [
|
|
3881
|
-
g.setTransform({ a:
|
|
3919
|
+
const [u, p, m, y, S, b] = s.gradientTransform;
|
|
3920
|
+
g.setTransform({ a: u, b: p, c: m, d: y, e: S, f: b });
|
|
3882
3921
|
}
|
|
3883
3922
|
return t.scale(1 / Math.SQRT2, 1 / Math.SQRT2), t.fillStyle = g, t.restore(), g;
|
|
3884
3923
|
}
|
|
@@ -3888,8 +3927,8 @@ class fs {
|
|
|
3888
3927
|
if (r || (r = new Image(), r.src = s.url, this.imageCache.set(s.url, r)), r.complete && r.naturalWidth > 0) {
|
|
3889
3928
|
const c = t.createPattern(r, "repeat");
|
|
3890
3929
|
if (c && (s.scaleX !== void 0 || s.offsetX !== void 0)) {
|
|
3891
|
-
const
|
|
3892
|
-
|
|
3930
|
+
const d = new DOMMatrix(), l = s.scaleX ?? 1, f = s.scaleY ?? 1, g = s.offsetX ?? 0, u = s.offsetY ?? 0, p = s.rotation ?? 0;
|
|
3931
|
+
d.translateSelf(g, u), d.rotateSelf(p), d.scaleSelf(l, f), c.setTransform(d);
|
|
3893
3932
|
}
|
|
3894
3933
|
return c;
|
|
3895
3934
|
}
|
|
@@ -3908,18 +3947,18 @@ class fs {
|
|
|
3908
3947
|
} catch {
|
|
3909
3948
|
a = parseFloat(a) || 0;
|
|
3910
3949
|
}
|
|
3911
|
-
let r = 0, c = 0,
|
|
3912
|
-
typeof a == "number" ? r = c =
|
|
3950
|
+
let r = 0, c = 0, d = 0, l = 0;
|
|
3951
|
+
typeof a == "number" ? r = c = d = l = a : Array.isArray(a) ? a.length === 1 ? r = c = d = l = a[0] : a.length === 2 ? (r = d = a[0], c = l = a[1]) : a.length === 3 ? (r = a[0], c = l = a[1], d = a[2]) : a.length >= 4 && (r = a[0], c = a[1], d = a[2], l = a[3]) : a && typeof a == "object" && (r = a.tl ?? a.corner_radius ?? a.cornerRadius ?? 0, c = a.tr ?? a.corner_radius ?? a.cornerRadius ?? 0, d = a.br ?? a.corner_radius ?? a.cornerRadius ?? 0, l = a.bl ?? a.corner_radius ?? a.cornerRadius ?? 0);
|
|
3913
3952
|
const f = Math.min(Math.abs(e) / 2, Math.abs(i) / 2);
|
|
3914
|
-
if (r = Math.min(Math.max(0, r), f), c = Math.min(Math.max(0, c), f),
|
|
3915
|
-
t.roundRect(s, o, e, i, [r, c,
|
|
3953
|
+
if (r = Math.min(Math.max(0, r), f), c = Math.min(Math.max(0, c), f), d = Math.min(Math.max(0, d), f), l = Math.min(Math.max(0, l), f), t.roundRect) {
|
|
3954
|
+
t.roundRect(s, o, e, i, [r, c, d, l]);
|
|
3916
3955
|
return;
|
|
3917
3956
|
}
|
|
3918
|
-
t.moveTo(s + r, o), t.lineTo(s + e - c, o), t.arcTo(s + e, o, s + e, o + c, c), t.lineTo(s + e, o + i -
|
|
3957
|
+
t.moveTo(s + r, o), t.lineTo(s + e - c, o), t.arcTo(s + e, o, s + e, o + c, c), t.lineTo(s + e, o + i - d), t.arcTo(s + e, o + i, s + e - d, o + i, d), t.lineTo(s + l, o + i), t.arcTo(s, o + i, s, o + i - l, l), t.lineTo(s, o + r), t.arcTo(s, o, s + r, o, r), t.closePath();
|
|
3919
3958
|
}
|
|
3920
3959
|
renderListView(t, s) {
|
|
3921
|
-
var at,
|
|
3922
|
-
const o = this.objectStates.get(s.id) || {}, e = o.options || s.options || {}, i = o.width !== void 0 ? o.width : ((at = s.geometry) == null ? void 0 : at.width) || 200, n = o.height !== void 0 ? o.height : ((
|
|
3960
|
+
var at, V, O, $;
|
|
3961
|
+
const o = this.objectStates.get(s.id) || {}, e = o.options || s.options || {}, i = o.width !== void 0 ? o.width : ((at = s.geometry) == null ? void 0 : at.width) || 200, n = o.height !== void 0 ? o.height : ((V = s.geometry) == null ? void 0 : V.height) || 300, a = -i / 2, r = -n / 2, c = o.corner_radius !== void 0 ? o.corner_radius : e.corner_radius ?? 0, d = e.orientation || "vertical", l = e.items || [], f = e.itemGap ?? 10, g = e.itemHeight ?? 50, u = e.itemWidth ?? 200, p = e.scrollOffset ?? 0, m = e.padding ?? 0, y = e.glassEffect !== !1, S = e.accentColor || "#3b82f6", b = e.itemTextColor || "#333333", v = e.itemBackgroundColor || "#ffffff", w = e.hoveredIndex ?? null, k = e.activeItemIndex ?? null, A = e.glowIntensity ?? 0, x = e.glowColor || "#3b82f6", B = typeof x == "string" ? x : x.color || (($ = (O = x.stops) == null ? void 0 : O[0]) == null ? void 0 : $.color) || "#3b82f6", F = e.opacity !== void 0 ? e.opacity : s.opacity !== void 0 ? s.opacity : 1;
|
|
3923
3962
|
if (t.save(), t.globalAlpha *= F, A > 0) {
|
|
3924
3963
|
const P = t.getTransform(), J = Math.sqrt(P.a * P.a + P.b * P.b) || 1;
|
|
3925
3964
|
t.shadowColor = B, t.shadowBlur = A * 2 * J, t.shadowOffsetX = 0, t.shadowOffsetY = 0;
|
|
@@ -3936,34 +3975,34 @@ class fs {
|
|
|
3936
3975
|
Z > 0 && (t.strokeStyle = e.borderColor || "#cccccc", t.lineWidth = Z, this.drawListViewRect(t, a, r, i, n, c), t.stroke());
|
|
3937
3976
|
}
|
|
3938
3977
|
t.shadowBlur = 0, t.save(), this.drawListViewRect(t, a, r, i, n, c), t.clip();
|
|
3939
|
-
const K = typeof m == "number" ? m :
|
|
3940
|
-
let tt = (
|
|
3978
|
+
const K = typeof m == "number" ? m : d === "vertical" ? m[0] : m[3];
|
|
3979
|
+
let tt = (d === "vertical" ? r : a) + p + K;
|
|
3941
3980
|
if (t.textBaseline = "middle", l.forEach((P, J) => {
|
|
3942
|
-
const Z =
|
|
3981
|
+
const Z = d === "vertical" ? i : u, lt = d === "vertical" ? g : n, Y = d === "vertical" ? a : tt, H = d === "vertical" ? tt : r, it = w === J, nt = k === J;
|
|
3943
3982
|
if (nt) {
|
|
3944
3983
|
const L = this.createCanvasFill(t, S, Z, lt);
|
|
3945
3984
|
t.fillStyle = L || S;
|
|
3946
3985
|
const z = t.globalAlpha;
|
|
3947
|
-
t.globalAlpha = z * 0.8, t.fillRect(
|
|
3986
|
+
t.globalAlpha = z * 0.8, t.fillRect(Y, H, Z, lt), t.globalAlpha = z;
|
|
3948
3987
|
} else if (it)
|
|
3949
|
-
t.fillStyle = y ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.05)", t.fillRect(
|
|
3988
|
+
t.fillStyle = y ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.05)", t.fillRect(Y, H, Z, lt);
|
|
3950
3989
|
else if (v !== "transparent") {
|
|
3951
3990
|
const L = this.createCanvasFill(t, v, Z, lt);
|
|
3952
|
-
t.fillStyle = L || v, t.fillRect(
|
|
3991
|
+
t.fillStyle = L || v, t.fillRect(Y, H, Z, lt);
|
|
3953
3992
|
}
|
|
3954
3993
|
if (nt || it) {
|
|
3955
|
-
const L = this.createCanvasFill(t, S,
|
|
3956
|
-
t.fillStyle = L || S,
|
|
3994
|
+
const L = this.createCanvasFill(t, S, d === "vertical" ? 3 : Z, d === "vertical" ? lt : 3);
|
|
3995
|
+
t.fillStyle = L || S, d === "vertical" ? t.fillRect(Y, H, 3, lt) : t.fillRect(Y, H + lt - 3, Z, 3);
|
|
3957
3996
|
}
|
|
3958
3997
|
const ft = nt ? "#ffffff" : y ? "rgba(255, 255, 255, 0.9)" : b;
|
|
3959
3998
|
t.fillStyle = ft, t.font = nt || it ? "600 14px Inter, sans-serif" : "400 14px Inter, sans-serif";
|
|
3960
|
-
const M = typeof P == "string" ? P : (P == null ? void 0 : P.label) || `Item ${J + 1}`, Q =
|
|
3961
|
-
|
|
3999
|
+
const M = typeof P == "string" ? P : (P == null ? void 0 : P.label) || `Item ${J + 1}`, Q = Y + (d === "vertical" ? 16 : Z / 2), N = H + lt / 2;
|
|
4000
|
+
d === "horizontal" ? t.textAlign = "center" : t.textAlign = "left", t.fillText(M, Q, N), tt += (d === "vertical" ? g : u) + f;
|
|
3962
4001
|
}), t.restore(), e.showScrollbar !== !1) {
|
|
3963
|
-
const P = (l.length || 0) * (
|
|
4002
|
+
const P = (l.length || 0) * (d === "vertical" ? g : u) + ((l.length || 0) - 1) * f, J = d === "vertical" ? n : i;
|
|
3964
4003
|
if (P > J) {
|
|
3965
|
-
const Z = J / P, lt = J * Z,
|
|
3966
|
-
t.fillStyle = H,
|
|
4004
|
+
const Z = J / P, lt = J * Z, Y = -p / P * J, H = e.scrollbarColor || "rgba(255,255,255,0.3)", it = e.scrollbarWidth || 4;
|
|
4005
|
+
t.fillStyle = H, d === "vertical" ? t.fillRect(a + i - it - 2, r + Y, it, lt) : t.fillRect(a + Y, r + n - it - 2, lt, it);
|
|
3967
4006
|
}
|
|
3968
4007
|
}
|
|
3969
4008
|
t.restore();
|
|
@@ -3973,8 +4012,8 @@ class fs {
|
|
|
3973
4012
|
if (!this._lastPointerPos || !this._prevPointerPos) return;
|
|
3974
4013
|
const s = t.options || {}, o = s.orientation || "vertical", e = this._lastPointerPos.x - this._prevPointerPos.x, i = this._lastPointerPos.y - this._prevPointerPos.y;
|
|
3975
4014
|
o === "vertical" ? s.scrollOffset = (s.scrollOffset || 0) + i : s.scrollOffset = (s.scrollOffset || 0) + e;
|
|
3976
|
-
const n = this.objectStates.get(t.id) || {}, a = s.items || [], r = s.itemGap ?? 10, c = s.itemHeight ?? 50,
|
|
3977
|
-
s.scrollOffset > 0 && (s.scrollOffset = 0), s.scrollOffset < -
|
|
4015
|
+
const n = this.objectStates.get(t.id) || {}, a = s.items || [], r = s.itemGap ?? 10, c = s.itemHeight ?? 50, d = s.itemWidth ?? 200, l = n.width !== void 0 ? n.width : ((m = t.geometry) == null ? void 0 : m.width) || 200, f = n.height !== void 0 ? n.height : ((y = t.geometry) == null ? void 0 : y.height) || 300, g = (a.length || 0) * (o === "vertical" ? c : d) + ((a.length || 0) - 1) * r, p = Math.max(0, g - (o === "vertical" ? f : l) + (s.padding * 2 || 0));
|
|
4016
|
+
s.scrollOffset > 0 && (s.scrollOffset = 0), s.scrollOffset < -p && (s.scrollOffset = -p);
|
|
3978
4017
|
}
|
|
3979
4018
|
updateListViewHoverFromPointer(t, s, o) {
|
|
3980
4019
|
const e = this.getListViewItemIndexAtPointer(t, s, o), i = t.options || {};
|
|
@@ -3984,13 +4023,13 @@ class fs {
|
|
|
3984
4023
|
var K, tt;
|
|
3985
4024
|
const e = t.options || {}, i = this.objectStates.get(t.id) || {}, n = e.items || [];
|
|
3986
4025
|
if (n.length === 0) return null;
|
|
3987
|
-
const a = i.width !== void 0 ? i.width : ((K = t.geometry) == null ? void 0 : K.width) || 200, r = i.height !== void 0 ? i.height : ((tt = t.geometry) == null ? void 0 : tt.height) || 300, c = e.orientation || "vertical",
|
|
4026
|
+
const a = i.width !== void 0 ? i.width : ((K = t.geometry) == null ? void 0 : K.width) || 200, r = i.height !== void 0 ? i.height : ((tt = t.geometry) == null ? void 0 : tt.height) || 300, c = e.orientation || "vertical", d = e.itemGap ?? 10, l = e.itemHeight ?? 50, f = e.itemWidth ?? 200, g = e.scrollOffset ?? 0, u = e.padding ?? 0, p = this.getWorldTransform(t.id), m = s - p.x, y = o - p.y, S = -p.rotation * (Math.PI / 180), b = Math.cos(S), v = Math.sin(S), w = m * b - y * v, k = m * v + y * b, A = -a / 2, x = -r / 2, B = typeof u == "number" ? u : c === "vertical" ? u[0] : u[3];
|
|
3988
4027
|
let F = (c === "vertical" ? x : A) + g + B;
|
|
3989
4028
|
for (let rt = 0; rt < n.length; rt++) {
|
|
3990
|
-
const at = c === "vertical" ? a : f,
|
|
3991
|
-
if (
|
|
4029
|
+
const at = c === "vertical" ? a : f, V = c === "vertical" ? l : r, O = c === "vertical" ? A : F, $ = c === "vertical" ? F : x;
|
|
4030
|
+
if (w >= O && w <= O + at && k >= $ && k <= $ + V)
|
|
3992
4031
|
return rt;
|
|
3993
|
-
F += (c === "vertical" ? l : f) +
|
|
4032
|
+
F += (c === "vertical" ? l : f) + d;
|
|
3994
4033
|
}
|
|
3995
4034
|
return null;
|
|
3996
4035
|
}
|
|
@@ -4008,145 +4047,145 @@ class fs {
|
|
|
4008
4047
|
if (!e.behaviors || e.behaviors.length === 0) return;
|
|
4009
4048
|
const i = this.objectStates.get(e.id);
|
|
4010
4049
|
i && e.behaviors.forEach((n) => {
|
|
4011
|
-
var f, g,
|
|
4050
|
+
var f, g, u, p, m, y, S, b, v, w, k, A, x, B, F, K, tt, rt, at, V, O, $, P, J, Z, lt, Y, H, it, nt, ft, M, Q, N, L, z, pt, vt, yt, xt, kt, Tt, Ft, Dt, $t, Lt, Yt, st, ct, _, C, W, j, bt, Mt, ht, Et, mt, I, _t, Bt, Rt, dt, T, G, ut, E, R, et, Ct, Pt, St, Ot, wt, Vt, Ut, qt;
|
|
4012
4051
|
if (!n.enabled) return;
|
|
4013
4052
|
const a = n.startTime || 0, r = n.endTime || 1 / 0;
|
|
4014
4053
|
if (this.currentTime < a || this.currentTime > r) return;
|
|
4015
|
-
const c = i.x - s,
|
|
4054
|
+
const c = i.x - s, d = i.y - o, l = Math.sqrt(c * c + d * d);
|
|
4016
4055
|
if (this.frameCount % 240 === 0 && Math.random() < 0.1 && console.log(`[ExodeUI] Executing ${n.type} on ${e.name}`), n.type === D.Proximity) {
|
|
4017
|
-
const U = ((f = n.settings) == null ? void 0 : f.radius) || 300,
|
|
4056
|
+
const U = ((f = n.settings) == null ? void 0 : f.radius) || 300, X = ((g = n.settings) == null ? void 0 : g.falloff) || "smooth";
|
|
4018
4057
|
let q = 0;
|
|
4019
|
-
l < U && (
|
|
4020
|
-
this.applyBehaviorSensor(i,
|
|
4058
|
+
l < U && (X === "linear" ? q = 1 - l / U : q = Math.pow(1 - l / U, 2)), q > 0 && n.sensors.forEach((It) => {
|
|
4059
|
+
this.applyBehaviorSensor(i, It, q, t, n.settings, e);
|
|
4021
4060
|
});
|
|
4022
4061
|
} else if (n.type === D.Magnetic) {
|
|
4023
|
-
const U = ((
|
|
4062
|
+
const U = ((u = n.settings) == null ? void 0 : u.radius) || 400, X = ((p = n.settings) == null ? void 0 : p.strength) || 0.5;
|
|
4024
4063
|
if (l < U && l > 5) {
|
|
4025
|
-
const q = 1 - l / U,
|
|
4026
|
-
i.x -=
|
|
4064
|
+
const q = 1 - l / U, It = c * q * X, At = d * q * X;
|
|
4065
|
+
i.x -= It * t * 10, i.y -= At * t * 10;
|
|
4027
4066
|
}
|
|
4028
4067
|
} else if (n.type === D.Repel) {
|
|
4029
|
-
const U = ((m = n.settings) == null ? void 0 : m.radius) || 300,
|
|
4068
|
+
const U = ((m = n.settings) == null ? void 0 : m.radius) || 300, X = ((y = n.settings) == null ? void 0 : y.strength) || 1;
|
|
4030
4069
|
if (l < U) {
|
|
4031
4070
|
const q = Math.pow(1 - l / U, 2);
|
|
4032
|
-
i.x += c / (l || 1) * q * 60 *
|
|
4071
|
+
i.x += c / (l || 1) * q * 60 * X * t * 5, i.y += d / (l || 1) * q * 60 * X * t * 5;
|
|
4033
4072
|
}
|
|
4034
4073
|
} else if (n.type === D.Orbit) {
|
|
4035
|
-
const U = ((S = n.settings) == null ? void 0 : S.speed) || 1,
|
|
4036
|
-
i.x += Math.cos(q) *
|
|
4074
|
+
const U = ((S = n.settings) == null ? void 0 : S.speed) || 1, X = ((b = n.settings) == null ? void 0 : b.radius) || 30, q = this.currentTime * U * Math.PI * 2;
|
|
4075
|
+
i.x += Math.cos(q) * X * t * 5, i.y += Math.sin(q) * X * t * 5, i.rotation += 2 * t * 5;
|
|
4037
4076
|
} else if (n.type === D.Vortex) {
|
|
4038
|
-
const U = ((v = n.settings) == null ? void 0 : v.radius) || 400,
|
|
4077
|
+
const U = ((v = n.settings) == null ? void 0 : v.radius) || 400, X = ((w = n.settings) == null ? void 0 : w.speed) || 2, q = ((k = n.settings) == null ? void 0 : k.strength) || 1;
|
|
4039
4078
|
if (l < U) {
|
|
4040
|
-
const
|
|
4041
|
-
i.x +=
|
|
4079
|
+
const It = Math.pow(1 - l / U, 1.5), At = this.currentTime * X * Math.PI * 2, Gt = Math.cos(At) * 30 - c * 0.4, Xt = Math.sin(At) * 30 - d * 0.4;
|
|
4080
|
+
i.x += Gt * It * q * t * 5, i.y += Xt * It * q * t * 5, i.rotation += 5 * It * q * t * 5, i.scale_x *= 1 - It * 0.1 * q * t, i.scale_y *= 1 - It * 0.1 * q * t;
|
|
4042
4081
|
}
|
|
4043
4082
|
} else if (n.type === D.Fluid) {
|
|
4044
|
-
const U = ((A = n.settings) == null ? void 0 : A.radius) || 300,
|
|
4083
|
+
const U = ((A = n.settings) == null ? void 0 : A.radius) || 300, X = ((x = n.settings) == null ? void 0 : x.strength) || 1;
|
|
4045
4084
|
if (l < U) {
|
|
4046
|
-
const q = Math.pow(1 - l / U, 1.2),
|
|
4047
|
-
i.x +=
|
|
4085
|
+
const q = Math.pow(1 - l / U, 1.2), It = c / (l || 1) * q * 1.2 * X, At = d / (l || 1) * q * 1.2 * X;
|
|
4086
|
+
i.x += It * 10 * t * 5, i.y += At * 10 * t * 5, i.scale_x *= 1 + q * 0.3 * X * t, i.scale_y *= 1 + q * 0.3 * X * t;
|
|
4048
4087
|
}
|
|
4049
4088
|
} else if (n.type === D.Elastic) {
|
|
4050
|
-
const U = ((B = n.settings) == null ? void 0 : B.radius) || 300,
|
|
4089
|
+
const U = ((B = n.settings) == null ? void 0 : B.radius) || 300, X = ((F = n.settings) == null ? void 0 : F.strength) || 1;
|
|
4051
4090
|
if (l < U) {
|
|
4052
4091
|
const q = 1 - l / U;
|
|
4053
|
-
i.scale_x *= 1 + q * 0.4 *
|
|
4092
|
+
i.scale_x *= 1 + q * 0.4 * X * t, i.scale_y *= 1 + q * 0.4 * X * t;
|
|
4054
4093
|
}
|
|
4055
4094
|
} else if (n.type === D.Holographic) {
|
|
4056
|
-
const U = i.x - this.canvasWidth / 2,
|
|
4057
|
-
if (i.x -= U / 1e3 * q * t * 5, i.y -=
|
|
4058
|
-
const
|
|
4059
|
-
i.style.exposure = (i.style.exposure || 1) +
|
|
4095
|
+
const U = i.x - this.canvasWidth / 2, X = i.y - this.canvasHeight / 2, q = ((K = n.settings) == null ? void 0 : K.factor) || 25;
|
|
4096
|
+
if (i.x -= U / 1e3 * q * t * 5, i.y -= X / 1e3 * q * t * 5, i.style) {
|
|
4097
|
+
const It = 1 - Math.min(1, l / 400);
|
|
4098
|
+
i.style.exposure = (i.style.exposure || 1) + It * 0.5 * t;
|
|
4060
4099
|
}
|
|
4061
4100
|
} else if (n.type === D.Sticky) {
|
|
4062
|
-
const U = ((tt = n.settings) == null ? void 0 : tt.radius) || 80,
|
|
4101
|
+
const U = ((tt = n.settings) == null ? void 0 : tt.radius) || 80, X = ((rt = n.settings) == null ? void 0 : rt.strength) || 1;
|
|
4063
4102
|
if (l < U) {
|
|
4064
4103
|
const q = Math.pow(1 - l / U, 2);
|
|
4065
|
-
i.x -= c * q *
|
|
4104
|
+
i.x -= c * q * X * t * 10, i.y -= d * q * X * t * 10, i.scale_x *= 1 - q * 0.1 * X * t, i.scale_y *= 1 - q * 0.1 * X * t;
|
|
4066
4105
|
}
|
|
4067
4106
|
} else if (n.type === D.Dilation) {
|
|
4068
|
-
const U = ((at = n.settings) == null ? void 0 : at.size) || 120,
|
|
4107
|
+
const U = ((at = n.settings) == null ? void 0 : at.size) || 120, X = ((V = n.settings) == null ? void 0 : V.strength) || 1;
|
|
4069
4108
|
if (l < U) {
|
|
4070
4109
|
const q = 1 - l / U;
|
|
4071
|
-
i.scale_x *= 1 + q * 0.5 *
|
|
4110
|
+
i.scale_x *= 1 + q * 0.5 * X * t, i.scale_y *= 1 + q * 0.5 * X * t;
|
|
4072
4111
|
}
|
|
4073
4112
|
} else if (n.type === D.Parallax) {
|
|
4074
|
-
const U = ((O = n.settings) == null ? void 0 : O.factor) || 0.05,
|
|
4113
|
+
const U = ((O = n.settings) == null ? void 0 : O.factor) || 0.05, X = this.canvasHeight / 2, q = (this._lastPointerPos.y - X) * U;
|
|
4075
4114
|
i.y += q * t * 10;
|
|
4076
4115
|
} else if (n.type === D.Squash) {
|
|
4077
4116
|
const U = (($ = n.settings) == null ? void 0 : $.strength) || 0.8;
|
|
4078
4117
|
l < (e.width || 100) && this.isMouseDown ? (i.scale_y = this.lerp(i.scale_y ?? 1, (((P = e.transform) == null ? void 0 : P.scale_y) ?? 1) * U, 0.3), i.scale_x = this.lerp(i.scale_x ?? 1, (((J = e.transform) == null ? void 0 : J.scale_x) ?? 1) * (1 + (1 - U) * 0.4), 0.3)) : (i.scale_y = this.lerp(i.scale_y ?? 1, ((Z = e.transform) == null ? void 0 : Z.scale_y) ?? 1, 0.2), i.scale_x = this.lerp(i.scale_x ?? 1, ((lt = e.transform) == null ? void 0 : lt.scale_x) ?? 1, 0.2));
|
|
4079
4118
|
} else if (n.type === D.TextCounter) {
|
|
4080
|
-
const U = ((
|
|
4119
|
+
const U = ((Y = n.settings) == null ? void 0 : Y.duration) || 2, X = ((H = n.settings) == null ? void 0 : H.from) || 0, q = ((it = n.settings) == null ? void 0 : it.to) || 100;
|
|
4081
4120
|
n._runtimeStart === void 0 && (n._runtimeStart = this.currentTime);
|
|
4082
|
-
const
|
|
4121
|
+
const It = this.currentTime - n._runtimeStart, At = Math.min(1, It / U), Gt = Math.floor(X + (q - X) * At);
|
|
4083
4122
|
if (((nt = e.geometry) == null ? void 0 : nt.type) === "Text") {
|
|
4084
|
-
const
|
|
4085
|
-
i.geometry || (i.geometry = { ...e.geometry }), i.geometry.text = `${
|
|
4123
|
+
const Xt = ((ft = n.settings) == null ? void 0 : ft.prefix) || "", Ht = ((M = n.settings) == null ? void 0 : M.suffix) || "";
|
|
4124
|
+
i.geometry || (i.geometry = { ...e.geometry }), i.geometry.text = `${Xt}${Gt}${Ht}`;
|
|
4086
4125
|
}
|
|
4087
4126
|
} else if (n.type === D.Spotlight) {
|
|
4088
|
-
const U = ((Q = n.settings) == null ? void 0 : Q.radius) || 250,
|
|
4127
|
+
const U = ((Q = n.settings) == null ? void 0 : Q.radius) || 250, X = ((N = n.settings) == null ? void 0 : N.strength) || 1.5;
|
|
4089
4128
|
if (l < U) {
|
|
4090
4129
|
const q = Math.pow(1 - l / U, 2);
|
|
4091
|
-
i.style || (i.style = { ...e.style }), i.style.adjustments || (i.style.adjustments = { ...(L = e.style) == null ? void 0 : L.adjustments }), i.style.adjustments.exposure = (((pt = (z = e.style) == null ? void 0 : z.adjustments) == null ? void 0 : pt.exposure) || 0) + q *
|
|
4130
|
+
i.style || (i.style = { ...e.style }), i.style.adjustments || (i.style.adjustments = { ...(L = e.style) == null ? void 0 : L.adjustments }), i.style.adjustments.exposure = (((pt = (z = e.style) == null ? void 0 : z.adjustments) == null ? void 0 : pt.exposure) || 0) + q * X * 50;
|
|
4092
4131
|
} else
|
|
4093
4132
|
(vt = i.style) != null && vt.adjustments && (i.style.adjustments.exposure = this.lerp(i.style.adjustments.exposure || 0, ((xt = (yt = e.style) == null ? void 0 : yt.adjustments) == null ? void 0 : xt.exposure) || 0, 0.1));
|
|
4094
4133
|
} else if (n.type === D.Noise || n.type === D.Float) {
|
|
4095
|
-
const U = (((kt = n.settings) == null ? void 0 : kt.frequency) || ((Tt = n.settings) == null ? void 0 : Tt.speed) || 1) * 2e-3,
|
|
4096
|
-
i.x += Math.sin(q * U) *
|
|
4134
|
+
const U = (((kt = n.settings) == null ? void 0 : kt.frequency) || ((Tt = n.settings) == null ? void 0 : Tt.speed) || 1) * 2e-3, X = (((Ft = n.settings) == null ? void 0 : Ft.amplitude) || ((Dt = n.settings) == null ? void 0 : Dt.range) || 50) * ((($t = n.settings) == null ? void 0 : $t.strength) || 1), q = Date.now();
|
|
4135
|
+
i.x += Math.sin(q * U) * X * t, i.y += Math.cos(q * U * 0.8) * X * t, i.rotation += Math.sin(q * U * 0.5) * 5 * t;
|
|
4097
4136
|
} else if (n.type === D.Pulse) {
|
|
4098
|
-
const U = (((Lt = n.settings) == null ? void 0 : Lt.speed) || 1) * 5e-3,
|
|
4099
|
-
i.scale_x *= 1 + q *
|
|
4137
|
+
const U = (((Lt = n.settings) == null ? void 0 : Lt.speed) || 1) * 5e-3, X = (((Yt = n.settings) == null ? void 0 : Yt.scale) || 1.2) - 1, q = Math.sin(Date.now() * U), It = ((st = n.settings) == null ? void 0 : st.strength) || 1;
|
|
4138
|
+
i.scale_x *= 1 + q * X * It * t, i.scale_y *= 1 + q * X * It * t, i.style && (i.style.exposure = (i.style.exposure || 1) + Math.max(0, q) * 0.1 * It * t);
|
|
4100
4139
|
} else if (n.type === D.Draggable) {
|
|
4101
|
-
const U = ((ct = n.settings) == null ? void 0 : ct.radius) || 150,
|
|
4102
|
-
if (l < U ||
|
|
4103
|
-
const q = ((_ = n.settings) == null ? void 0 : _.strength) || 1,
|
|
4104
|
-
this.applyBehaviorSensor(i, Wt.PositionX,
|
|
4140
|
+
const U = ((ct = n.settings) == null ? void 0 : ct.radius) || 150, X = this.draggingBehaviors.has(e.id);
|
|
4141
|
+
if (l < U || X) {
|
|
4142
|
+
const q = ((_ = n.settings) == null ? void 0 : _.strength) || 1, It = X ? 1 : Math.max(0, 1 - l / U);
|
|
4143
|
+
this.applyBehaviorSensor(i, Wt.PositionX, It * q, t, n.settings), this.applyBehaviorSensor(i, Wt.PositionY, It * q, t, n.settings);
|
|
4105
4144
|
}
|
|
4106
4145
|
} else if (n.type === D.Scroll) {
|
|
4107
|
-
const U = ((C = n.settings) == null ? void 0 : C.axis) || "vertical",
|
|
4108
|
-
(U === "vertical" || U === "both") && (i.y += this.scrollOffset.y *
|
|
4146
|
+
const U = ((C = n.settings) == null ? void 0 : C.axis) || "vertical", X = ((W = n.settings) == null ? void 0 : W.factor) || 0.5, q = ((j = n.settings) == null ? void 0 : j.strength) || 1, It = ((bt = n.settings) == null ? void 0 : bt.scaleFactor) || 0;
|
|
4147
|
+
(U === "vertical" || U === "both") && (i.y += this.scrollOffset.y * X * q * t), (U === "horizontal" || U === "both") && (i.x += this.scrollOffset.x * X * q * t), It !== 0 && (i.scale_x *= 1 + this.scrollOffset.y * It * t, i.scale_y *= 1 + this.scrollOffset.y * It * t);
|
|
4109
4148
|
} else if (n.type === D.LookAt) {
|
|
4110
|
-
const U = ((Mt = n.settings) == null ? void 0 : Mt.factor) || 1,
|
|
4111
|
-
i.rotation += At * U *
|
|
4149
|
+
const U = ((Mt = n.settings) == null ? void 0 : Mt.factor) || 1, X = ((ht = n.settings) == null ? void 0 : ht.strength) || 1, q = Math.atan2(-d, -c) * (180 / Math.PI), It = i.rotation, At = (q - It + 180) % 360 - 180;
|
|
4150
|
+
i.rotation += At * U * X * t * 10;
|
|
4112
4151
|
} else if (n.type === D.Glint || n.type === D.Scan) {
|
|
4113
|
-
const U = (((Et = n.settings) == null ? void 0 : Et.speed) || 1) * 4e-3,
|
|
4114
|
-
i.style && (i.style.exposure = (i.style.exposure || 1) + q *
|
|
4152
|
+
const U = (((Et = n.settings) == null ? void 0 : Et.speed) || 1) * 4e-3, X = ((mt = n.settings) == null ? void 0 : mt.strength) || 1, q = (Math.sin(Date.now() * U) + 1) / 2;
|
|
4153
|
+
i.style && (i.style.exposure = (i.style.exposure || 1) + q * X * t * 5), i.x += (q - 0.5) * 20 * X * t;
|
|
4115
4154
|
} else if (n.type === D.Ratchet) {
|
|
4116
|
-
const U = ((
|
|
4117
|
-
i.rotation = this.lerp(i.rotation, q +
|
|
4155
|
+
const U = ((I = n.settings) == null ? void 0 : I.steps) || 12, X = (((_t = n.settings) == null ? void 0 : _t.speed) || 1) * 30, q = Math.floor(i.rotation / (360 / U)) * (360 / U);
|
|
4156
|
+
i.rotation = this.lerp(i.rotation, q + X * t, 0.1);
|
|
4118
4157
|
} else if (n.type === D.Jitter && l < 300) {
|
|
4119
|
-
const U = ((Bt = n.settings) == null ? void 0 : Bt.strength) || 1,
|
|
4120
|
-
i.x += (Math.random() - 0.5) *
|
|
4158
|
+
const U = ((Bt = n.settings) == null ? void 0 : Bt.strength) || 1, X = (((Rt = n.settings) == null ? void 0 : Rt.intensity) || 5) * U;
|
|
4159
|
+
i.x += (Math.random() - 0.5) * X * t * 60, i.y += (Math.random() - 0.5) * X * t * 60, i.rotation += (Math.random() - 0.5) * X * t * 120;
|
|
4121
4160
|
} else if (n.type === D.Follower) {
|
|
4122
4161
|
const U = (dt = n.settings) == null ? void 0 : dt.targetId;
|
|
4123
4162
|
if (U) {
|
|
4124
|
-
const
|
|
4125
|
-
if (
|
|
4126
|
-
const q = ((T = n.settings) == null ? void 0 : T.stiffness) || 0.1,
|
|
4127
|
-
i.x +=
|
|
4163
|
+
const X = this.objectStates.get(U);
|
|
4164
|
+
if (X) {
|
|
4165
|
+
const q = ((T = n.settings) == null ? void 0 : T.stiffness) || 0.1, It = X.x - i.x, At = X.y - i.y;
|
|
4166
|
+
i.x += It * q * t * 60, i.y += At * q * t * 60;
|
|
4128
4167
|
}
|
|
4129
4168
|
}
|
|
4130
4169
|
} else if (n.type === D.Wrap)
|
|
4131
4170
|
i.x < 0 ? i.x = this.canvasWidth : i.x > this.canvasWidth && (i.x = 0), i.y < 0 ? i.y = this.canvasHeight : i.y > this.canvasHeight && (i.y = 0);
|
|
4132
4171
|
else if (n.type === D.Gravity) {
|
|
4133
|
-
const U = ((
|
|
4172
|
+
const U = ((G = n.settings) == null ? void 0 : G.strength) || 9.8;
|
|
4134
4173
|
i.y += U * t * 10;
|
|
4135
4174
|
} else if (n.type === D.Velocity) {
|
|
4136
|
-
const U = ((ut = n.settings) == null ? void 0 : ut.vx) || 0,
|
|
4137
|
-
i.x += U * t * 10, i.y +=
|
|
4175
|
+
const U = ((ut = n.settings) == null ? void 0 : ut.vx) || 0, X = ((E = n.settings) == null ? void 0 : E.vy) || 0;
|
|
4176
|
+
i.x += U * t * 10, i.y += X * t * 10;
|
|
4138
4177
|
} else if (n.type === D.Shear) {
|
|
4139
|
-
const U = ((R = n.settings) == null ? void 0 : R.strength) || 1,
|
|
4140
|
-
if (l <
|
|
4141
|
-
const q = 1 - l /
|
|
4178
|
+
const U = ((R = n.settings) == null ? void 0 : R.strength) || 1, X = ((et = n.settings) == null ? void 0 : et.radius) || 300;
|
|
4179
|
+
if (l < X) {
|
|
4180
|
+
const q = 1 - l / X;
|
|
4142
4181
|
i.skew_x = this.lerp(i.skew_x || 0, (((Ct = e.transform) == null ? void 0 : Ct.skew_x) || 0) + q * U * 30, 0.1);
|
|
4143
4182
|
} else
|
|
4144
4183
|
i.skew_x = this.lerp(i.skew_x || 0, ((Pt = e.transform) == null ? void 0 : Pt.skew_x) || 0, 0.05);
|
|
4145
4184
|
} else if (n.type === D.Lens) {
|
|
4146
|
-
const U = ((St = n.settings) == null ? void 0 : St.radius) || 200,
|
|
4185
|
+
const U = ((St = n.settings) == null ? void 0 : St.radius) || 200, X = ((Ot = n.settings) == null ? void 0 : Ot.strength) || 0.5;
|
|
4147
4186
|
if (l < U) {
|
|
4148
4187
|
const q = Math.pow(1 - l / U, 2);
|
|
4149
|
-
i.scale_x = this.lerp(i.scale_x ?? 1, (((
|
|
4188
|
+
i.scale_x = this.lerp(i.scale_x ?? 1, (((wt = e.transform) == null ? void 0 : wt.scale_x) ?? 1) * (1 + q * X), 0.2), i.scale_y = this.lerp(i.scale_y ?? 1, (((Vt = e.transform) == null ? void 0 : Vt.scale_y) ?? 1) * (1 + q * X), 0.2);
|
|
4150
4189
|
} else
|
|
4151
4190
|
i.scale_x = this.lerp(i.scale_x ?? 1, ((Ut = e.transform) == null ? void 0 : Ut.scale_x) ?? 1, 0.1), i.scale_y = this.lerp(i.scale_y ?? 1, ((qt = e.transform) == null ? void 0 : qt.scale_y) ?? 1, 0.1);
|
|
4152
4191
|
}
|
|
@@ -4154,7 +4193,7 @@ class fs {
|
|
|
4154
4193
|
});
|
|
4155
4194
|
}
|
|
4156
4195
|
applyBehaviorSensor(t, s, o, e, i, n) {
|
|
4157
|
-
var c,
|
|
4196
|
+
var c, d, l, f, g, u, p, m, y;
|
|
4158
4197
|
const a = (i == null ? void 0 : i.intensity) || (i == null ? void 0 : i.strength) || 1, r = o * a * e;
|
|
4159
4198
|
switch (s) {
|
|
4160
4199
|
case Wt.Scale:
|
|
@@ -4182,13 +4221,13 @@ class fs {
|
|
|
4182
4221
|
t.skew_x = (t.skew_x || 0) + r * 45;
|
|
4183
4222
|
break;
|
|
4184
4223
|
case Wt.Blur:
|
|
4185
|
-
t.style || (t.style = { ...n.style }), t.style.blur || (t.style.blur = { ...(c = n.style) == null ? void 0 : c.blur }), t.style.blur.amount = (((l = (
|
|
4224
|
+
t.style || (t.style = { ...n.style }), t.style.blur || (t.style.blur = { ...(c = n.style) == null ? void 0 : c.blur }), t.style.blur.amount = (((l = (d = n.style) == null ? void 0 : d.blur) == null ? void 0 : l.amount) || 0) + o * ((i == null ? void 0 : i.blur) || 50) * a;
|
|
4186
4225
|
break;
|
|
4187
4226
|
case Wt.Exposure:
|
|
4188
|
-
t.style || (t.style = { ...n.style }), t.style.adjustments || (t.style.adjustments = { ...(f = n.style) == null ? void 0 : f.adjustments }), t.style.adjustments.exposure = (((
|
|
4227
|
+
t.style || (t.style = { ...n.style }), t.style.adjustments || (t.style.adjustments = { ...(f = n.style) == null ? void 0 : f.adjustments }), t.style.adjustments.exposure = (((u = (g = n.style) == null ? void 0 : g.adjustments) == null ? void 0 : u.exposure) || 0) + o * ((i == null ? void 0 : i.exposure) || 50) * a;
|
|
4189
4228
|
break;
|
|
4190
4229
|
case Wt.HueShift:
|
|
4191
|
-
t.style || (t.style = { ...n.style }), t.style.adjustments || (t.style.adjustments = { ...(
|
|
4230
|
+
t.style || (t.style = { ...n.style }), t.style.adjustments || (t.style.adjustments = { ...(p = n.style) == null ? void 0 : p.adjustments }), t.style.adjustments.hue = (((y = (m = n.style) == null ? void 0 : m.adjustments) == null ? void 0 : y.hue) || 0) + o * ((i == null ? void 0 : i.hue) || 180) * a;
|
|
4192
4231
|
break;
|
|
4193
4232
|
case Wt.CornerRadius:
|
|
4194
4233
|
t.corner_radius = Math.min(200, (t.corner_radius || 0) + r * 100);
|
|
@@ -4211,9 +4250,9 @@ class fs {
|
|
|
4211
4250
|
return o;
|
|
4212
4251
|
}
|
|
4213
4252
|
renderFittedImage(t, s, o, e, i, n, a = "cover") {
|
|
4214
|
-
const r = s.naturalWidth, c = s.naturalHeight,
|
|
4215
|
-
let f = i, g = n,
|
|
4216
|
-
a === "cover" ?
|
|
4253
|
+
const r = s.naturalWidth, c = s.naturalHeight, d = r / c, l = i / n;
|
|
4254
|
+
let f = i, g = n, u = o, p = e;
|
|
4255
|
+
a === "cover" ? d > l ? (f = n * d, u = o - (f - i) / 2) : (g = i / d, p = e - (g - n) / 2) : a === "contain" && (d > l ? (g = i / d, p = e + (n - g) / 2) : (f = n * d, u = o + (i - f) / 2)), t.drawImage(s, u, p, f, g);
|
|
4217
4256
|
}
|
|
4218
4257
|
}
|
|
4219
4258
|
const bs = Te(({
|
|
@@ -4227,18 +4266,18 @@ const bs = Te(({
|
|
|
4227
4266
|
onTrigger: a,
|
|
4228
4267
|
onInputUpdate: r,
|
|
4229
4268
|
onComponentChange: c,
|
|
4230
|
-
onToggle:
|
|
4269
|
+
onToggle: d,
|
|
4231
4270
|
onInputChange: l,
|
|
4232
4271
|
onInputFocus: f,
|
|
4233
4272
|
onInputBlur: g,
|
|
4234
|
-
onLog:
|
|
4235
|
-
onLogicUpdate:
|
|
4273
|
+
onLog: u,
|
|
4274
|
+
onLogicUpdate: p,
|
|
4236
4275
|
onButtonClick: m,
|
|
4237
4276
|
onGraphPointClick: y,
|
|
4238
4277
|
currentTime: S,
|
|
4239
4278
|
revision: b = 0,
|
|
4240
4279
|
scrollY: v,
|
|
4241
|
-
scrollX:
|
|
4280
|
+
scrollX: w,
|
|
4242
4281
|
mouseX: k,
|
|
4243
4282
|
mouseY: A,
|
|
4244
4283
|
isMouseDown: x,
|
|
@@ -4246,15 +4285,15 @@ const bs = Te(({
|
|
|
4246
4285
|
interactive: F = !0,
|
|
4247
4286
|
onNavigation: K
|
|
4248
4287
|
}, tt) => {
|
|
4249
|
-
const rt = Jt(null), at = Jt(new fs()),
|
|
4288
|
+
const rt = Jt(null), at = Jt(new fs()), V = Jt(void 0), O = Jt(0), $ = Jt(null), P = Jt(b), [, J] = me(h || null), Z = Jt(!0);
|
|
4250
4289
|
xe(tt, () => rt.current), Kt(() => (Z.current = !0, () => {
|
|
4251
|
-
Z.current = !1,
|
|
4290
|
+
Z.current = !1, V.current && cancelAnimationFrame(V.current);
|
|
4252
4291
|
}), []), Kt(() => {
|
|
4253
4292
|
at.current.setLayout(e, i);
|
|
4254
4293
|
}, [e, i]), Kt(() => {
|
|
4255
|
-
const
|
|
4256
|
-
a &&
|
|
4257
|
-
}, [a, r, c,
|
|
4294
|
+
const Y = at.current;
|
|
4295
|
+
a && Y.setTriggerCallback(a), r && Y.setInputUpdateCallback((H, it) => r({ [H]: it })), c && Y.setComponentChangeCallback((H) => c(H)), d && Y.setToggleCallback(d), l && Y.setInputChangeCallback(l), f && Y.setInputFocusCallback(f), g && Y.setInputBlurCallback(g), u && Y.setOnLogCallback((H) => u(H, "info")), p && Y.setLogicUpdateCallback(p), m && Y.setButtonClickCallback(m), y && Y.setGraphPointClickCallback((H) => y(H.objectId, H)), K && Y.setNavigationCallback(K);
|
|
4296
|
+
}, [a, r, c, d, l, f, g, u, p, m, y, K]), Kt(() => {
|
|
4258
4297
|
(async () => {
|
|
4259
4298
|
let H = h;
|
|
4260
4299
|
if (t && !h)
|
|
@@ -4269,7 +4308,7 @@ const bs = Te(({
|
|
|
4269
4308
|
}
|
|
4270
4309
|
})();
|
|
4271
4310
|
}, [h == null ? void 0 : h.id, t, b]), Kt(() => {
|
|
4272
|
-
const
|
|
4311
|
+
const Y = (H) => {
|
|
4273
4312
|
if (!at.current || !Z.current) return;
|
|
4274
4313
|
const it = at.current, nt = rt.current;
|
|
4275
4314
|
if (!nt) return;
|
|
@@ -4279,38 +4318,38 @@ const bs = Te(({
|
|
|
4279
4318
|
O.current === 0 && (O.current = M);
|
|
4280
4319
|
let Q = M - O.current;
|
|
4281
4320
|
Q > 0.1 && (Q = 0.1), O.current = M;
|
|
4282
|
-
const
|
|
4283
|
-
(nt.width !== z || nt.height !== pt) && (nt.width = z, nt.height = pt), o ? it.advance(Q) : S !== void 0 && it.seek(S), it.render(ft, nt.width, nt.height),
|
|
4321
|
+
const N = nt.getBoundingClientRect(), L = window.devicePixelRatio || 1, z = Math.round(N.width * L), pt = Math.round(N.height * L);
|
|
4322
|
+
(nt.width !== z || nt.height !== pt) && (nt.width = z, nt.height = pt), o ? it.advance(Q) : S !== void 0 && it.seek(S), it.render(ft, nt.width, nt.height), V.current = requestAnimationFrame(Y);
|
|
4284
4323
|
};
|
|
4285
|
-
return
|
|
4286
|
-
|
|
4324
|
+
return V.current = requestAnimationFrame(Y), () => {
|
|
4325
|
+
V.current && cancelAnimationFrame(V.current);
|
|
4287
4326
|
};
|
|
4288
4327
|
}, [o, S]), Kt(() => {
|
|
4289
|
-
const
|
|
4290
|
-
v !== void 0 &&
|
|
4291
|
-
}, [v,
|
|
4292
|
-
const lt = (
|
|
4328
|
+
const Y = at.current;
|
|
4329
|
+
v !== void 0 && Y.updateInput("scrollY", v), w !== void 0 && Y.updateInput("scrollX", w), k !== void 0 && Y.updateInput("mouseX", k), A !== void 0 && Y.updateInput("mouseY", A), x !== void 0 && Y.updateInput("isMouseDown", x), B && Object.entries(B).forEach(([H, it]) => Y.updateInput(H, it));
|
|
4330
|
+
}, [v, w, k, A, x, B]);
|
|
4331
|
+
const lt = (Y, H) => {
|
|
4293
4332
|
if (!F || !rt.current) return;
|
|
4294
|
-
const it = rt.current, nt = it.getBoundingClientRect(), ft =
|
|
4333
|
+
const it = rt.current, nt = it.getBoundingClientRect(), ft = Y.clientX - nt.left, M = Y.clientY - nt.top, Q = window.devicePixelRatio || 1;
|
|
4295
4334
|
at.current.handlePointerInput(H, ft * Q, M * Q, it.width, it.height);
|
|
4296
4335
|
};
|
|
4297
4336
|
return /* @__PURE__ */ Qt(
|
|
4298
4337
|
"canvas",
|
|
4299
4338
|
{
|
|
4300
4339
|
ref: rt,
|
|
4301
|
-
onPointerDown: (
|
|
4340
|
+
onPointerDown: (Y) => {
|
|
4302
4341
|
var H;
|
|
4303
|
-
lt(
|
|
4342
|
+
lt(Y, "down"), (H = rt.current) == null || H.focus();
|
|
4304
4343
|
},
|
|
4305
|
-
onPointerMove: (
|
|
4306
|
-
onPointerUp: (
|
|
4307
|
-
onPointerCancel: (
|
|
4308
|
-
onClick: (
|
|
4309
|
-
onWheel: (
|
|
4310
|
-
at.current.handleWheel(
|
|
4344
|
+
onPointerMove: (Y) => lt(Y, "move"),
|
|
4345
|
+
onPointerUp: (Y) => lt(Y, "up"),
|
|
4346
|
+
onPointerCancel: (Y) => lt(Y, "up"),
|
|
4347
|
+
onClick: (Y) => lt(Y, "click"),
|
|
4348
|
+
onWheel: (Y) => {
|
|
4349
|
+
at.current.handleWheel(Y.deltaX, Y.deltaY);
|
|
4311
4350
|
},
|
|
4312
|
-
onKeyDown: (
|
|
4313
|
-
onContextMenu: (
|
|
4351
|
+
onKeyDown: (Y) => at.current.handleKeyDown(Y.nativeEvent),
|
|
4352
|
+
onContextMenu: (Y) => Y.preventDefault(),
|
|
4314
4353
|
tabIndex: 0,
|
|
4315
4354
|
style: {
|
|
4316
4355
|
...s,
|
|
@@ -4341,7 +4380,7 @@ function vs() {
|
|
|
4341
4380
|
h == null || h.updateObjectOptions(l, f);
|
|
4342
4381
|
}, [h]), c = zt((l, f, g) => {
|
|
4343
4382
|
h == null || h.updateConstraint(l, f, g);
|
|
4344
|
-
}, [h]),
|
|
4383
|
+
}, [h]), d = zt((l, f) => {
|
|
4345
4384
|
h == null || h.updateGraphData(l, f);
|
|
4346
4385
|
}, [h]);
|
|
4347
4386
|
return {
|
|
@@ -4355,7 +4394,7 @@ function vs() {
|
|
|
4355
4394
|
setInputNumberArray: n,
|
|
4356
4395
|
setInputStringArray: a,
|
|
4357
4396
|
updateConstraint: c,
|
|
4358
|
-
updateGraphData:
|
|
4397
|
+
updateGraphData: d,
|
|
4359
4398
|
updateObjectOptions: r
|
|
4360
4399
|
};
|
|
4361
4400
|
}
|
|
@@ -4371,8 +4410,8 @@ const Ss = ({ artboard: h, config: t }) => {
|
|
|
4371
4410
|
return ((g = f.geometry) == null ? void 0 : g.type) === "Text";
|
|
4372
4411
|
}).sort(
|
|
4373
4412
|
(f, g) => {
|
|
4374
|
-
var
|
|
4375
|
-
return (((
|
|
4413
|
+
var u, p;
|
|
4414
|
+
return (((u = g.geometry.text) == null ? void 0 : u.length) || 0) - (((p = f.geometry.text) == null ? void 0 : p.length) || 0);
|
|
4376
4415
|
}
|
|
4377
4416
|
);
|
|
4378
4417
|
l.length > 0 && (r = l[0].geometry.text);
|
|
@@ -4382,20 +4421,20 @@ const Ss = ({ artboard: h, config: t }) => {
|
|
|
4382
4421
|
c && e("property", "og:image", c), a && e("property", "og:title", a), e("property", "og:type", "website");
|
|
4383
4422
|
}, [s, h, o]);
|
|
4384
4423
|
const e = (a, r, c) => {
|
|
4385
|
-
let
|
|
4386
|
-
|
|
4424
|
+
let d = document.querySelector(`meta[${a}="${r}"]`);
|
|
4425
|
+
d || (d = document.createElement("meta"), d.setAttribute(a, r), document.head.appendChild(d)), d.setAttribute("content", c);
|
|
4387
4426
|
}, i = () => {
|
|
4388
4427
|
const a = [];
|
|
4389
|
-
return a.push(/* @__PURE__ */ Qt("h1", { children: s.title || h.name }, "artboard-title")), h.objects.forEach((c,
|
|
4428
|
+
return a.push(/* @__PURE__ */ Qt("h1", { children: s.title || h.name }, "artboard-title")), h.objects.forEach((c, d) => {
|
|
4390
4429
|
var l, f;
|
|
4391
4430
|
if (!(!c.visible && c.isVisible !== !0))
|
|
4392
4431
|
if (((l = c.geometry) == null ? void 0 : l.type) === "Text") {
|
|
4393
4432
|
const g = c.geometry.text;
|
|
4394
|
-
g && (c.geometry.fontSize > 24 ? a.push(/* @__PURE__ */ Qt("h2", { children: g }, c.id ||
|
|
4433
|
+
g && (c.geometry.fontSize > 24 ? a.push(/* @__PURE__ */ Qt("h2", { children: g }, c.id || d)) : a.push(/* @__PURE__ */ Qt("p", { children: g }, c.id || d)));
|
|
4395
4434
|
} else if (((f = c.geometry) == null ? void 0 : f.type) === "Image") {
|
|
4396
|
-
const g = c.geometry.src,
|
|
4397
|
-
a.push(/* @__PURE__ */ Qt("img", { src: g, alt:
|
|
4398
|
-
} else c.type === "Button" && a.push(/* @__PURE__ */ Qt("button", { children: c.name || "Button" }, c.id ||
|
|
4435
|
+
const g = c.geometry.src, u = c.altText || c.name || "Illustration";
|
|
4436
|
+
a.push(/* @__PURE__ */ Qt("img", { src: g, alt: u }, c.id || d));
|
|
4437
|
+
} else c.type === "Button" && a.push(/* @__PURE__ */ Qt("button", { children: c.name || "Button" }, c.id || d));
|
|
4399
4438
|
}), a;
|
|
4400
4439
|
}, n = s.jsonLd || {
|
|
4401
4440
|
"@context": "https://schema.org",
|
|
@@ -4428,9 +4467,9 @@ const Ss = ({ artboard: h, config: t }) => {
|
|
|
4428
4467
|
]
|
|
4429
4468
|
}
|
|
4430
4469
|
);
|
|
4431
|
-
}, hs = "6.3.
|
|
4470
|
+
}, hs = "6.3.14", ds = {
|
|
4432
4471
|
version: hs
|
|
4433
|
-
},
|
|
4472
|
+
}, ws = ds.version;
|
|
4434
4473
|
export {
|
|
4435
4474
|
Wt as BehaviorSensor,
|
|
4436
4475
|
D as BehaviorType,
|
|
@@ -4439,6 +4478,6 @@ export {
|
|
|
4439
4478
|
bs as ExodeUICanvas,
|
|
4440
4479
|
fs as ExodeUIEngine,
|
|
4441
4480
|
gt as LogicOp,
|
|
4442
|
-
|
|
4481
|
+
ws as VERSION,
|
|
4443
4482
|
vs as useExodeUI
|
|
4444
4483
|
};
|