exodeui 6.3.20 → 6.3.21
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 +31 -31
- package/dist/index.mjs +1438 -1409
- package/dist/src/utils/skinningUtils.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
var ys = Object.defineProperty;
|
|
2
2
|
var bs = (p, t, s) => t in p ? ys(p, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : p[t] = s;
|
|
3
|
-
var
|
|
3
|
+
var et = (p, t, s) => bs(p, typeof t != "symbol" ? t + "" : t, s);
|
|
4
4
|
import { jsx as Ce, jsxs as vs } from "react/jsx-runtime";
|
|
5
5
|
import { forwardRef as Cs, useRef as ve, useState as ds, useImperativeHandle as Ss, useEffect as Se, useCallback as ge } from "react";
|
|
6
|
-
import { prepareWithSegments as
|
|
6
|
+
import { prepareWithSegments as Xe, layoutWithLines as Is } from "@chenglou/pretext";
|
|
7
7
|
import ae from "@dimforge/rapier2d-compat";
|
|
8
8
|
import * as ws from "lz-string";
|
|
9
|
-
var
|
|
9
|
+
var G = /* @__PURE__ */ ((p) => (p.Proximity = "Proximity", p.Magnetic = "Magnetic", p.Repel = "Repel", p.Orbit = "Orbit", p.Vortex = "Vortex", p.Fluid = "Fluid", p.Elastic = "Elastic", p.Holographic = "Holographic", p.Sticky = "Sticky", p.Dilation = "Dilation", p.Parallax = "Parallax", p.Noise = "Noise", p.Float = "Float", p.Pulse = "Pulse", p.Draggable = "Draggable", p.Scroll = "Scroll", p.LookAt = "LookAt", p.Glint = "Glint", p.Scan = "Scan", p.Ratchet = "Ratchet", p.Jitter = "Jitter", p.Follower = "Follower", p.Wrap = "Wrap", p.Typewriter = "Typewriter", p.Scramble = "Scramble", p.Wave = "Wave", p.Bounce = "Bounce", p.TextTrail = "TextTrail", p.Reveal3D = "Reveal3D", p.RevealSlide = "RevealSlide", p.RevealBlur = "RevealBlur", p.TextLiquid = "TextLiquid", p.TextVortex = "TextVortex", p.TextExplosion = "TextExplosion", p.TextRain = "TextRain", p.TextGravity = "TextGravity", p.TextMatrix = "TextMatrix", p.TextNeon = "TextNeon", p.TextDissolve = "TextDissolve", p.TextOrganic = "TextOrganic", p.TextBreathe = "TextBreathe", p.TextSpin = "TextSpin", p.TextMagnet = "TextMagnet", p.TextPerspective = "TextPerspective", p.TextMirror = "TextMirror", p.TextFloral = "TextFloral", p.TextSmoke = "TextSmoke", p.TextVariable = "TextVariable", p.TextZing = "TextZing", p.TextElastic = "TextElastic", p.TextGlitch3D = "TextGlitch3D", p.GlitchText = "GlitchText", p.TextCounter = "TextCounter", p.Squash = "Squash", p.Spotlight = "Spotlight", p.Lens = "Lens", p.Gravity = "Gravity", p.Velocity = "Velocity", p.Shear = "Shear", p.LayoutAnimation = "LayoutAnimation", p.SpringChain = "SpringChain", p.ParticleEmitter = "ParticleEmitter", p.StateReactive = "StateReactive", p.Fold = "Fold", p.Crumple = "Crumple", p))(G || {}), Kt = /* @__PURE__ */ ((p) => (p.Scale = "Scale", p.Opacity = "Opacity", p.RotateZ = "RotateZ", p.RotateX = "RotateX", p.RotateY = "RotateY", p.PositionX = "PositionX", p.PositionY = "PositionY", p.SkewX = "SkewX", p.Blur = "Blur", p.Exposure = "Exposure", p.HueShift = "HueShift", p.Negative = "Negative", p.CornerRadius = "CornerRadius", p.StrokeWidth = "StrokeWidth", p.BoxShadow = "BoxShadow", p.FontSize = "FontSize", p.LetterSpacing = "LetterSpacing", p))(Kt || {}), Ms = /* @__PURE__ */ ((p) => (p.Equal = "Equal", p.NotEqual = "NotEqual", p.GreaterThan = "GreaterThan", p.LessThan = "LessThan", p.GreaterEqual = "GreaterEqual", p.LessEqual = "LessEqual", p.IsTrue = "IsTrue", p.IsFalse = "IsFalse", p))(Ms || {}), St = /* @__PURE__ */ ((p) => (p.AND = "AND", p.OR = "OR", p.NOT = "NOT", p.XOR = "XOR", p.OBJECT = "OBJECT", p.PROPERTY = "PROPERTY", p.GET_PROPERTY = "GET_PROPERTY", p.SET_PROPERTY = "SET_PROPERTY", p.ADD = "ADD", p.SUB = "SUB", p.MUL = "MUL", p.DIV = "DIV", p.MOD = "MOD", p.POW = "POW", p.ABS = "ABS", p.ROUND = "ROUND", p.FLOOR = "FLOOR", p.CEIL = "CEIL", p.SIN = "SIN", p.COS = "COS", p.TAN = "TAN", p.CLAMP = "CLAMP", p.REMAP = "REMAP", p.EQ = "EQ", p.NEQ = "NEQ", p.GT = "GT", p.LT = "LT", p.GTE = "GTE", p.LTE = "LTE", p.IF_ELSE = "IF_ELSE", p.VALUE = "VALUE", p.INPUT = "INPUT", p.LOG = "LOG", p.SCROLL_X = "SCROLL_X", p.SCROLL_Y = "SCROLL_Y", p.MOUSE_X = "MOUSE_X", p.MOUSE_Y = "MOUSE_Y", p.IS_MOUSE_DOWN = "IS_MOUSE_DOWN", p.EFFECTOR = "EFFECTOR", p.MONITOR = "MONITOR", p.DELAY = "DELAY", p.SPRING_PULL = "SPRING_PULL", p.SPRING_SETTLE = "SPRING_SETTLE", p.EMIT = "EMIT", p))(St || {});
|
|
10
10
|
function ks(p) {
|
|
11
11
|
if (p.length < 5) return p;
|
|
12
12
|
const t = new Set("aeiouyAEIOUY".split(""));
|
|
@@ -47,102 +47,102 @@ function ps(p) {
|
|
|
47
47
|
enableSegments: f = !1
|
|
48
48
|
} = p;
|
|
49
49
|
let d = String(t || "");
|
|
50
|
-
c === "uppercase" ? d = d.toUpperCase() : c === "lowercase" ? d = d.toLowerCase() : c === "capitalize" && (d = d.replace(/\b\w/g, (
|
|
50
|
+
c === "uppercase" ? d = d.toUpperCase() : c === "lowercase" ? d = d.toLowerCase() : c === "capitalize" && (d = d.replace(/\b\w/g, (_) => _.toUpperCase())), p.hyphenation === !0 && (d = Ts(d));
|
|
51
51
|
const u = `${i} ${e} ${o}px "${s}", sans-serif`, m = `${d}|${u}|${r}|${l}|${h}|${f}|${JSON.stringify(g)}|hyp:${!!p.hyphenation}|comp:${p.composer}|bal:${!!p.balanceRaggedLines}`;
|
|
52
52
|
let y = Ee.get(m);
|
|
53
|
-
const v = typeof CanvasRenderingContext2D < "u" ? CanvasRenderingContext2D.prototype.measureText : null, b = function(
|
|
53
|
+
const v = typeof CanvasRenderingContext2D < "u" ? CanvasRenderingContext2D.prototype.measureText : null, b = function(_) {
|
|
54
54
|
if (!v) return { width: 0, fontBoundingBoxAscent: 0, fontBoundingBoxDescent: 0 };
|
|
55
|
-
const T = v.call(this,
|
|
56
|
-
return r !== 0 &&
|
|
55
|
+
const T = v.call(this, _);
|
|
56
|
+
return r !== 0 && _ && _.length > 0 ? {
|
|
57
57
|
...T,
|
|
58
|
-
width: T.width + (
|
|
58
|
+
width: T.width + (_.length - 1) * r
|
|
59
59
|
} : T;
|
|
60
60
|
};
|
|
61
61
|
if (!y) {
|
|
62
62
|
try {
|
|
63
63
|
if (r !== 0 && typeof CanvasRenderingContext2D < "u" && (CanvasRenderingContext2D.prototype.measureText = b), f && g && g.length > 0) {
|
|
64
|
-
const
|
|
65
|
-
let
|
|
64
|
+
const _ = g.map((T) => {
|
|
65
|
+
let $ = T.text || "";
|
|
66
66
|
const k = T.textCase || c || "none";
|
|
67
|
-
return k === "uppercase" ?
|
|
67
|
+
return k === "uppercase" ? $.toUpperCase() : k === "lowercase" ? $.toLowerCase() : k === "capitalize" ? $.replace(/\b\w/g, (E) => E.toUpperCase()) : $;
|
|
68
68
|
}).join("");
|
|
69
|
-
if (y =
|
|
70
|
-
let T = 0,
|
|
69
|
+
if (y = Xe(_, u), y) {
|
|
70
|
+
let T = 0, $ = o;
|
|
71
71
|
for (const k of g) {
|
|
72
|
-
let
|
|
73
|
-
if (!
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
const
|
|
79
|
-
if (
|
|
80
|
-
for (let
|
|
81
|
-
const
|
|
82
|
-
if (
|
|
83
|
-
y.widths[
|
|
84
|
-
const H =
|
|
72
|
+
let E = k.text || "";
|
|
73
|
+
if (!E) continue;
|
|
74
|
+
const R = k.textCase || c || "none";
|
|
75
|
+
R === "uppercase" ? E = E.toUpperCase() : R === "lowercase" ? E = E.toLowerCase() : R === "capitalize" && (E = E.replace(/\b\w/g, (x) => x.toUpperCase()));
|
|
76
|
+
const A = k.fontSize || o;
|
|
77
|
+
A > $ && ($ = A);
|
|
78
|
+
const O = `${k.fontStyle || i} ${k.fontWeight || e} ${A}px "${k.fontFamily || s}", sans-serif`, W = Xe(E, O);
|
|
79
|
+
if (W && W.widths)
|
|
80
|
+
for (let x = 0; x < W.widths.length; x++) {
|
|
81
|
+
const Y = T + x;
|
|
82
|
+
if (Y < y.widths.length) {
|
|
83
|
+
y.widths[Y] = W.widths[x];
|
|
84
|
+
const H = W.kinds[x];
|
|
85
85
|
if (H === 2) {
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
` ||
|
|
86
|
+
const Q = E[x];
|
|
87
|
+
Q === `
|
|
88
|
+
` || Q === "\r" ? y.kinds[Y] = 2 : y.kinds[Y] = 0;
|
|
89
89
|
} else
|
|
90
|
-
y.kinds[
|
|
90
|
+
y.kinds[Y] = H;
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
T +=
|
|
93
|
+
T += E.length;
|
|
94
94
|
}
|
|
95
|
-
y.fullText =
|
|
95
|
+
y.fullText = _, y.maxFontSize = $;
|
|
96
96
|
}
|
|
97
97
|
} else
|
|
98
|
-
y =
|
|
98
|
+
y = Xe(d, u);
|
|
99
99
|
y && Ee.set(m, y);
|
|
100
|
-
} catch (
|
|
101
|
-
return console.error("[ExodeUI] Pretext prepare failed:",
|
|
100
|
+
} catch (_) {
|
|
101
|
+
return console.error("[ExodeUI] Pretext prepare failed:", _), { width: a, height: 0, lineCount: 0, lines: [] };
|
|
102
102
|
} finally {
|
|
103
103
|
r !== 0 && typeof CanvasRenderingContext2D < "u" && v && (CanvasRenderingContext2D.prototype.measureText = v);
|
|
104
104
|
}
|
|
105
105
|
if (Ee.size > 500) {
|
|
106
|
-
const
|
|
107
|
-
|
|
106
|
+
const _ = Ee.keys().next().value;
|
|
107
|
+
_ && Ee.delete(_);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
if (h > 0 && y && y.widths && !y.indentApplied) {
|
|
111
|
-
const
|
|
112
|
-
let
|
|
111
|
+
const _ = [...y.widths], T = y.fullText || d;
|
|
112
|
+
let $ = !0;
|
|
113
113
|
for (let k = 0; k < T.length; k++)
|
|
114
|
-
|
|
115
|
-
` || T[k] === "\r") && (
|
|
114
|
+
$ && _[k] !== void 0 && (_[k] += h, $ = !1), (T[k] === `
|
|
115
|
+
` || T[k] === "\r") && ($ = !0, T[k] === "\r" && T[k + 1] === `
|
|
116
116
|
` && k++);
|
|
117
|
-
y = { ...y, widths:
|
|
117
|
+
y = { ...y, widths: _, indentApplied: !0 };
|
|
118
118
|
}
|
|
119
119
|
if (!y) return { width: a, height: 0, lineCount: 0, lines: [] };
|
|
120
120
|
let C = n;
|
|
121
121
|
typeof C == "string" && (C = parseFloat(C)), C > 5 && o > 0 && (C = C / o), r !== 0 && (CanvasRenderingContext2D.prototype.measureText = b);
|
|
122
122
|
let S;
|
|
123
123
|
try {
|
|
124
|
-
const
|
|
124
|
+
const _ = y.maxFontSize || o;
|
|
125
125
|
if (a >= 1e5) {
|
|
126
126
|
const T = d.split(/\r\n|\r|\n/);
|
|
127
127
|
S = {
|
|
128
|
-
lines: T.map((
|
|
128
|
+
lines: T.map(($) => ({ text: $, width: 0 })),
|
|
129
129
|
// Width will be measured below
|
|
130
|
-
height: T.length * (C *
|
|
130
|
+
height: T.length * (C * _),
|
|
131
131
|
lineCount: T.length
|
|
132
132
|
};
|
|
133
133
|
} else
|
|
134
|
-
S = Is(y, a, C *
|
|
134
|
+
S = Is(y, a, C * _);
|
|
135
135
|
} finally {
|
|
136
136
|
r !== 0 && v && (CanvasRenderingContext2D.prototype.measureText = v);
|
|
137
137
|
}
|
|
138
138
|
let I = (S == null ? void 0 : S.height) !== void 0 && S.height > 0 ? S.height : (((M = S == null ? void 0 : S.lines) == null ? void 0 : M.length) || 0) * C * o;
|
|
139
139
|
if (l > 0 && S && S.lines && S.lines.length > 1) {
|
|
140
|
-
let
|
|
140
|
+
let _ = 0;
|
|
141
141
|
const T = y.fullText || t;
|
|
142
|
-
for (let
|
|
143
|
-
|
|
144
|
-
` || T[
|
|
145
|
-
` &&
|
|
142
|
+
for (let $ = 0; $ < S.lines.length - 1; $++)
|
|
143
|
+
_ += S.lines[$].text.length, (T[_] === `
|
|
144
|
+
` || T[_] === "\r") && (I += l, _++, T[_ - 1] === "\r" && T[_] === `
|
|
145
|
+
` && _++);
|
|
146
146
|
}
|
|
147
147
|
let w = (S == null ? void 0 : S.lines) || [];
|
|
148
148
|
return p.composer === "every-line" && w.length > 1 && (w = _s(w)), p.balanceRaggedLines === !0 && w.length > 1 && (w = Ps(w)), {
|
|
@@ -182,58 +182,58 @@ function ss(p, t, s) {
|
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
function Es(p, t, s) {
|
|
185
|
-
var
|
|
186
|
-
const o = p.autoLayout, { direction: e, spacing: i, padding: n, align: a, wrap: r } = o, l = e === "vertical", h = t.map((
|
|
187
|
-
const
|
|
188
|
-
let
|
|
189
|
-
if (
|
|
190
|
-
const H = (
|
|
191
|
-
|
|
192
|
-
} else if (
|
|
185
|
+
var E, R;
|
|
186
|
+
const o = p.autoLayout, { direction: e, spacing: i, padding: n, align: a, wrap: r } = o, l = e === "vertical", h = t.map((A) => {
|
|
187
|
+
const O = s(A.id), W = A.geometry;
|
|
188
|
+
let x = (O == null ? void 0 : O.width) ?? W.width ?? 100, Y = (O == null ? void 0 : O.height) ?? W.height ?? 100;
|
|
189
|
+
if (W.type === "Ellipse" || W.type === "Polygon" || W.type === "Star") {
|
|
190
|
+
const H = (O == null ? void 0 : O.radius) ?? W.radius ?? (O == null ? void 0 : O.outer_radius) ?? W.outer_radius ?? 50;
|
|
191
|
+
x = H * 2, Y = H * 2;
|
|
192
|
+
} else if (W.type === "Text") {
|
|
193
193
|
const H = ps({
|
|
194
|
-
text: (
|
|
195
|
-
fontFamily:
|
|
196
|
-
fontSize:
|
|
197
|
-
fontWeight:
|
|
198
|
-
fontStyle:
|
|
199
|
-
lineHeight:
|
|
200
|
-
width:
|
|
201
|
-
letterSpacing:
|
|
202
|
-
paragraphSpacing:
|
|
203
|
-
paragraphIndent:
|
|
204
|
-
textCase:
|
|
205
|
-
segments:
|
|
206
|
-
enableSegments:
|
|
194
|
+
text: (O == null ? void 0 : O.text) ?? W.text ?? "",
|
|
195
|
+
fontFamily: W.fontFamily,
|
|
196
|
+
fontSize: W.fontSize,
|
|
197
|
+
fontWeight: W.fontWeight,
|
|
198
|
+
fontStyle: W.fontStyle,
|
|
199
|
+
lineHeight: W.lineHeight,
|
|
200
|
+
width: W.width || 200,
|
|
201
|
+
letterSpacing: W.letterSpacing,
|
|
202
|
+
paragraphSpacing: W.paragraphSpacing,
|
|
203
|
+
paragraphIndent: W.paragraphIndent,
|
|
204
|
+
textCase: W.textCase,
|
|
205
|
+
segments: W.segments,
|
|
206
|
+
enableSegments: W.enableSegments
|
|
207
207
|
});
|
|
208
|
-
|
|
208
|
+
Y = H.height, W.width || (x = H.width);
|
|
209
209
|
}
|
|
210
|
-
return
|
|
210
|
+
return x *= A.transform.scale_x || 1, Y *= A.transform.scale_y || 1, { id: A.id, w: x, h: Y, original: A };
|
|
211
211
|
});
|
|
212
212
|
let c = p.width, g = p.height;
|
|
213
|
-
const f = ((
|
|
213
|
+
const f = ((E = p.layoutProps) == null ? void 0 : E.width) === "hug", d = ((R = p.layoutProps) == null ? void 0 : R.height) === "hug", u = [];
|
|
214
214
|
let m = [], y = 0, v = 0;
|
|
215
215
|
const b = c - n.left - n.right, C = g - n.top - n.bottom;
|
|
216
|
-
h.forEach((
|
|
217
|
-
r && m.length > 0 && (l ? v + i +
|
|
218
|
-
}), m.length > 0 && u.push({ children: m, width: y, height: v }), f && !l && (c = Math.max(...u.map((
|
|
216
|
+
h.forEach((A) => {
|
|
217
|
+
r && m.length > 0 && (l ? v + i + A.h > C : y + i + A.w > b) ? (u.push({ children: m, width: y, height: v }), m = [A], y = A.w, v = A.h) : (m.push(A), l ? (y = Math.max(y, A.w), v += (m.length > 1 ? i : 0) + A.h) : (y += (m.length > 1 ? i : 0) + A.w, v = Math.max(v, A.h)));
|
|
218
|
+
}), m.length > 0 && u.push({ children: m, width: y, height: v }), f && !l && (c = Math.max(...u.map((A) => A.width), 0) + n.left + n.right), d && l && (g = Math.max(...u.map((A) => A.height), 0) + n.top + n.bottom);
|
|
219
219
|
const S = [];
|
|
220
220
|
let I = n.left, w = n.top;
|
|
221
|
-
const M = a.toLowerCase(),
|
|
222
|
-
return u.forEach((
|
|
223
|
-
let
|
|
224
|
-
l ?
|
|
225
|
-
var F,
|
|
226
|
-
let
|
|
227
|
-
l ?
|
|
228
|
-
const
|
|
221
|
+
const M = a.toLowerCase(), _ = M === "center" || M.endsWith("-center"), T = M.endsWith("-right"), $ = M === "center" || M.startsWith("center-"), k = M.startsWith("bottom-");
|
|
222
|
+
return u.forEach((A) => {
|
|
223
|
+
let O = I, W = w;
|
|
224
|
+
l ? $ ? W = n.top + (g - n.top - n.bottom - A.height) / 2 : k && (W = g - n.bottom - A.height) : _ ? O = n.left + (c - n.left - n.right - A.width) / 2 : T && (O = c - n.right - A.width), A.children.forEach((x) => {
|
|
225
|
+
var F, U;
|
|
226
|
+
let Y = O, H = W;
|
|
227
|
+
l ? _ ? Y += (A.width - x.w) / 2 : T && (Y += A.width - x.w) : $ ? H += (A.height - x.h) / 2 : k && (H += A.height - x.h);
|
|
228
|
+
const Q = ((F = x.original.layoutProps) == null ? void 0 : F.width) === "fill", P = ((U = x.original.layoutProps) == null ? void 0 : U.height) === "fill";
|
|
229
229
|
S.push({
|
|
230
|
-
id:
|
|
231
|
-
x:
|
|
232
|
-
y: H +
|
|
233
|
-
width:
|
|
234
|
-
height:
|
|
235
|
-
}), l ?
|
|
236
|
-
}), l ? I +=
|
|
230
|
+
id: x.id,
|
|
231
|
+
x: Y + x.w / 2 - c / 2,
|
|
232
|
+
y: H + x.h / 2 - g / 2,
|
|
233
|
+
width: Q && l ? A.width : void 0,
|
|
234
|
+
height: P ? l ? void 0 : A.height : void 0
|
|
235
|
+
}), l ? W += x.h + i : O += x.w + i;
|
|
236
|
+
}), l ? I += A.width + i : w += A.height + i;
|
|
237
237
|
}), { frameWidth: f ? c : void 0, frameHeight: d ? g : void 0, childUpdates: S };
|
|
238
238
|
}
|
|
239
239
|
function xs(p, t, s) {
|
|
@@ -241,39 +241,39 @@ function xs(p, t, s) {
|
|
|
241
241
|
if (!o) return { childUpdates: [] };
|
|
242
242
|
const { gridColumns: e, gridRows: i, columnGap: n = 0, rowGap: a = 0, padding: r, align: l } = o;
|
|
243
243
|
let h = p.width, c = p.height;
|
|
244
|
-
const g = h - r.left - r.right, f = c - r.top - r.bottom, d = es(e || "1fr", g, n), u = es(i || "auto", f, a), m = d.length > 0 ? d.reduce((T,
|
|
244
|
+
const g = h - r.left - r.right, f = c - r.top - r.bottom, d = es(e || "1fr", g, n), u = es(i || "auto", f, a), m = d.length > 0 ? d.reduce((T, $) => T + $, 0) + (d.length - 1) * n : 0, y = u.length > 0 ? u.reduce((T, $) => T + $, 0) + (u.length - 1) * a : 0, v = l.toLowerCase(), b = v === "center" || v.endsWith("-center"), C = v.endsWith("-right"), S = v === "center" || v.startsWith("center-"), I = v.startsWith("bottom-");
|
|
245
245
|
let w = 0, M = 0;
|
|
246
246
|
b ? w = (g - m) / 2 : C && (w = g - m), S ? M = (f - y) / 2 : I && (M = f - y);
|
|
247
|
-
const
|
|
248
|
-
return t.forEach((T,
|
|
249
|
-
var
|
|
250
|
-
const k =
|
|
251
|
-
|
|
252
|
-
const
|
|
253
|
-
let
|
|
254
|
-
const
|
|
255
|
-
let H = (
|
|
256
|
-
if (
|
|
257
|
-
const it = (
|
|
258
|
-
H = it * 2,
|
|
247
|
+
const _ = [];
|
|
248
|
+
return t.forEach((T, $) => {
|
|
249
|
+
var U, J;
|
|
250
|
+
const k = $ % d.length || 0, E = Math.floor($ / d.length) || 0;
|
|
251
|
+
E >= u.length && u.push(100);
|
|
252
|
+
const R = d[k], A = u[E];
|
|
253
|
+
let O = r.left + w + d.slice(0, k).reduce((it, dt) => it + dt + n, 0), W = r.top + M + u.slice(0, E).reduce((it, dt) => it + dt + a, 0);
|
|
254
|
+
const x = s(T.id), Y = T.geometry;
|
|
255
|
+
let H = (x == null ? void 0 : x.width) ?? Y.width ?? 100, Q = (x == null ? void 0 : x.height) ?? Y.height ?? 100;
|
|
256
|
+
if (Y.type === "Ellipse" || Y.type === "Polygon" || Y.type === "Star") {
|
|
257
|
+
const it = (x == null ? void 0 : x.radius) ?? Y.radius ?? (x == null ? void 0 : x.outer_radius) ?? Y.outer_radius ?? 50;
|
|
258
|
+
H = it * 2, Q = it * 2;
|
|
259
259
|
}
|
|
260
|
-
H *= T.transform.scale_x || 1,
|
|
261
|
-
let
|
|
262
|
-
b ?
|
|
260
|
+
H *= T.transform.scale_x || 1, Q *= T.transform.scale_y || 1;
|
|
261
|
+
let P = O, F = W;
|
|
262
|
+
b ? P += (R - H) / 2 : C && (P += R - H), S ? F += (A - Q) / 2 : I && (F += A - Q), _.push({
|
|
263
263
|
id: T.id,
|
|
264
|
-
x:
|
|
265
|
-
y: F +
|
|
266
|
-
width: ((
|
|
267
|
-
height: ((
|
|
264
|
+
x: P + H / 2 - h / 2,
|
|
265
|
+
y: F + Q / 2 - c / 2,
|
|
266
|
+
width: ((U = T.layoutProps) == null ? void 0 : U.width) === "fill" ? R : void 0,
|
|
267
|
+
height: ((J = T.layoutProps) == null ? void 0 : J.height) === "fill" ? A : void 0
|
|
268
268
|
});
|
|
269
|
-
}), { childUpdates:
|
|
269
|
+
}), { childUpdates: _ };
|
|
270
270
|
}
|
|
271
271
|
class As {
|
|
272
272
|
constructor() {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
273
|
+
et(this, "world", null);
|
|
274
|
+
et(this, "bodies", /* @__PURE__ */ new Map());
|
|
275
|
+
et(this, "colliders", /* @__PURE__ */ new Map());
|
|
276
|
+
et(this, "initialized", !1);
|
|
277
277
|
}
|
|
278
278
|
async init(t) {
|
|
279
279
|
this.initialized || (await ae.init(), this.world = new ae.World(new ae.Vector2(t.x, t.y)), this.initialized = !0);
|
|
@@ -371,9 +371,9 @@ class As {
|
|
|
371
371
|
e && e.applyImpulse(new ae.Vector2(s, o), !0);
|
|
372
372
|
}
|
|
373
373
|
}
|
|
374
|
-
const us = (p) => p, Os = (p) => p > 0 ? 1 : 0, Rs = (p) => p < 1 ? 0 : 1, is = (p) => p * p, ns = (p) => p * (2 - p), os = (p) => p < 0.5 ? 2 * p * p : -1 + (4 - 2 * p) * p, Ls = (p) => p * p * p, Fs = (p) => --p * p * p + 1, $s = (p) => p < 0.5 ? 4 * p * p * p : (p - 1) * (2 * p - 2) * (2 * p - 2) + 1, Ws = (p) => p * p * p * p, Bs = (p) => 1 - --p * p * p * p,
|
|
374
|
+
const us = (p) => p, Os = (p) => p > 0 ? 1 : 0, Rs = (p) => p < 1 ? 0 : 1, is = (p) => p * p, ns = (p) => p * (2 - p), os = (p) => p < 0.5 ? 2 * p * p : -1 + (4 - 2 * p) * p, Ls = (p) => p * p * p, Fs = (p) => --p * p * p + 1, $s = (p) => p < 0.5 ? 4 * p * p * p : (p - 1) * (2 * p - 2) * (2 * p - 2) + 1, Ws = (p) => p * p * p * p, Bs = (p) => 1 - --p * p * p * p, Ys = (p) => p < 0.5 ? 8 * p * p * p * p : 1 - 8 * --p * p * p * p, Xs = (p) => p * p * p * p * p, Gs = (p) => 1 + --p * p * p * p * p, Ds = (p) => p < 0.5 ? 16 * p * p * p * p * p : 1 + 16 * --p * p * p * p * p, zs = (p) => 1 - Math.cos(p * Math.PI / 2), Vs = (p) => Math.sin(p * Math.PI / 2), Ns = (p) => -(Math.cos(Math.PI * p) - 1) / 2, Hs = (p) => p === 0 ? 0 : Math.pow(2, 10 * (p - 1)), Us = (p) => p === 1 ? 1 : 1 - Math.pow(2, -10 * p), qs = (p) => p === 0 ? 0 : p === 1 ? 1 : p < 0.5 ? Math.pow(2, 20 * p - 10) / 2 : (2 - Math.pow(2, -20 * p + 10)) / 2, Js = (p) => 1 - Math.sqrt(1 - p * p), Qs = (p) => Math.sqrt(1 - --p * p), Ks = (p) => p < 0.5 ? (1 - Math.sqrt(1 - 4 * p * p)) / 2 : (Math.sqrt(1 - (-2 * p + 2) * (-2 * p + 2)) + 1) / 2, Ye = 1.70158, $e = Ye * 1.525, gs = Ye + 1, Zs = (p) => gs * p * p * p - Ye * p * p, js = (p) => 1 + gs * Math.pow(p - 1, 3) + Ye * Math.pow(p - 1, 2), ti = (p) => p < 0.5 ? Math.pow(2 * p, 2) * (($e + 1) * 2 * p - $e) / 2 : (Math.pow(2 * p - 2, 2) * (($e + 1) * (p * 2 - 2) + $e) + 2) / 2, ms = 2 * Math.PI / 3, as = 2 * Math.PI / 4.5, ei = (p) => p === 0 ? 0 : p === 1 ? 1 : -Math.pow(2, 10 * p - 10) * Math.sin((p * 10 - 10.75) * ms), si = (p) => p === 0 ? 0 : p === 1 ? 1 : Math.pow(2, -10 * p) * Math.sin((p * 10 - 0.75) * ms) + 1, ii = (p) => p === 0 ? 0 : p === 1 ? 1 : p < 0.5 ? -(Math.pow(2, 20 * p - 10) * Math.sin((20 * p - 11.125) * as)) / 2 : Math.pow(2, -20 * p + 10) * Math.sin((20 * p - 11.125) * as) / 2 + 1, Be = (p) => p < 1 / 2.75 ? 7.5625 * p * p : p < 2 / 2.75 ? 7.5625 * (p -= 1.5 / 2.75) * p + 0.75 : p < 2.5 / 2.75 ? 7.5625 * (p -= 2.25 / 2.75) * p + 0.9375 : 7.5625 * (p -= 2.625 / 2.75) * p + 0.984375, ni = (p) => 1 - Be(1 - p), oi = Be, ai = (p) => p < 0.5 ? (1 - Be(1 - 2 * p)) / 2 : (1 + Be(2 * p - 1)) / 2, Ge = /* @__PURE__ */ new Map(), xe = (p, t, s, o) => {
|
|
375
375
|
const e = `${p},${t},${s},${o}`;
|
|
376
|
-
if (
|
|
376
|
+
if (Ge.has(e)) return Ge.get(e);
|
|
377
377
|
const i = (h) => (1 - 3 * s + 3 * p) * h * h * h + (3 * s - 6 * p) * h * h + 3 * p * h, n = (h) => (1 - 3 * o + 3 * t) * h * h * h + (3 * o - 6 * t) * h * h + 3 * t * h, a = (h) => 3 * (1 - 3 * s + 3 * p) * h * h + 2 * (3 * s - 6 * p) * h + 3 * p, r = (h) => {
|
|
378
378
|
let c = h;
|
|
379
379
|
for (let g = 0; g < 8; g++) {
|
|
@@ -385,7 +385,7 @@ const us = (p) => p, Os = (p) => p > 0 ? 1 : 0, Rs = (p) => p < 1 ? 0 : 1, is =
|
|
|
385
385
|
}
|
|
386
386
|
return c;
|
|
387
387
|
}, l = (h) => h === 0 ? 0 : h === 1 ? 1 : n(r(h));
|
|
388
|
-
return
|
|
388
|
+
return Ge.set(e, l), l;
|
|
389
389
|
}, rs = (p) => {
|
|
390
390
|
const t = p.match(/cubic-bezier\s*\(\s*([-?\d.]+)\s*,\s*([-?\d.]+)\s*,\s*([-?\d.]+)\s*,\s*([-?\d.]+)\s*\)/);
|
|
391
391
|
if (!t) return null;
|
|
@@ -410,14 +410,14 @@ const us = (p) => p, Os = (p) => p > 0 ? 1 : 0, Rs = (p) => p < 1 ? 0 : 1, is =
|
|
|
410
410
|
// Quartic
|
|
411
411
|
EaseInQuart: Ws,
|
|
412
412
|
EaseOutQuart: Bs,
|
|
413
|
-
EaseInOutQuart:
|
|
413
|
+
EaseInOutQuart: Ys,
|
|
414
414
|
// Quintic
|
|
415
|
-
EaseInQuint:
|
|
416
|
-
EaseOutQuint:
|
|
415
|
+
EaseInQuint: Xs,
|
|
416
|
+
EaseOutQuint: Gs,
|
|
417
417
|
EaseInOutQuint: Ds,
|
|
418
418
|
// Sinusoidal
|
|
419
|
-
EaseInSine:
|
|
420
|
-
EaseOutSine:
|
|
419
|
+
EaseInSine: zs,
|
|
420
|
+
EaseOutSine: Vs,
|
|
421
421
|
EaseInOutSine: Ns,
|
|
422
422
|
// Exponential
|
|
423
423
|
EaseInExpo: Hs,
|
|
@@ -519,22 +519,49 @@ const us = (p) => p, Os = (p) => p > 0 ? 1 : 0, Rs = (p) => p < 1 ? 0 : 1, is =
|
|
|
519
519
|
const i = o.scale_x ?? 1, n = o.scale_y ?? 1, a = (r, l, h) => {
|
|
520
520
|
let c = 0, g = 0;
|
|
521
521
|
const f = o.rotation * Math.PI / 180, d = Math.cos(f), u = Math.sin(f), m = r * i * d - l * n * u + o.x, y = r * i * u + l * n * d + o.y;
|
|
522
|
-
h.forEach((
|
|
523
|
-
const
|
|
524
|
-
if (!
|
|
525
|
-
const
|
|
526
|
-
x:
|
|
527
|
-
y:
|
|
528
|
-
rotation:
|
|
529
|
-
scaleX:
|
|
530
|
-
scaleY:
|
|
531
|
-
},
|
|
532
|
-
c +=
|
|
522
|
+
h.forEach((M) => {
|
|
523
|
+
const _ = e(M.boneId);
|
|
524
|
+
if (!_) return;
|
|
525
|
+
const T = {
|
|
526
|
+
x: _.x,
|
|
527
|
+
y: _.y,
|
|
528
|
+
rotation: _.rotation,
|
|
529
|
+
scaleX: _.scale_x ?? 1,
|
|
530
|
+
scaleY: _.scale_y ?? 1
|
|
531
|
+
}, $ = s[M.boneId] || [1, 0, 0, 1, 0, 0], k = m * $[0] + y * $[2] + $[4], E = m * $[1] + y * $[3] + $[5], R = T.rotation * Math.PI / 180, A = Math.cos(R), O = Math.sin(R), W = k * T.scaleX * A - E * T.scaleY * O + T.x, x = k * T.scaleX * O + E * T.scaleY * A + T.y;
|
|
532
|
+
c += W * M.amount, g += x * M.amount;
|
|
533
533
|
});
|
|
534
|
-
const v =
|
|
534
|
+
const v = [...h].sort((M, _) => _.amount - M.amount);
|
|
535
|
+
if (v.length >= 2 && v[0].amount > 0 && v[1].amount > 0) {
|
|
536
|
+
const M = e(v[0].boneId), _ = e(v[1].boneId);
|
|
537
|
+
if (M && _ && M.length !== void 0 && _.length !== void 0) {
|
|
538
|
+
const T = M.length * (M.scale_y ?? 1), $ = M.rotation * Math.PI / 180, k = M.x - T * Math.sin($), E = M.y + T * Math.cos($), R = _.length * (_.scale_y ?? 1), A = _.rotation * Math.PI / 180, O = _.x - R * Math.sin(A), W = _.y + R * Math.cos(A);
|
|
539
|
+
let x = null, Y = null, H = !1;
|
|
540
|
+
const Q = 1;
|
|
541
|
+
if (Math.hypot(M.x - _.x, M.y - _.y) < Q || Math.hypot(M.x - O, M.y - W) < Q ? (x = M.x, Y = M.y) : (Math.hypot(k - _.x, E - _.y) < Q || Math.hypot(k - O, E - W) < Q) && (x = k, Y = E, H = !0), x !== null && Y !== null) {
|
|
542
|
+
const P = s[v[0].boneId] || [1, 0, 0, 1, 0, 0], F = P[0] * P[3] - P[1] * P[2];
|
|
543
|
+
let U = 0, J = 0;
|
|
544
|
+
if (F !== 0) {
|
|
545
|
+
const it = (P[2] * P[5] - P[3] * P[4]) / F, dt = (P[1] * P[4] - P[0] * P[5]) / F, yt = Math.atan2(-P[1], P[3]);
|
|
546
|
+
if (!H)
|
|
547
|
+
U = it, J = dt;
|
|
548
|
+
else {
|
|
549
|
+
const ot = -P[2] / F, Et = P[0] / F, Ft = Math.hypot(ot, Et), wt = M.length * Ft;
|
|
550
|
+
U = it - wt * Math.sin(yt), J = dt + wt * Math.cos(yt);
|
|
551
|
+
}
|
|
552
|
+
const ht = Math.hypot(m - U, y - J), pt = Math.hypot(c - x, g - Y);
|
|
553
|
+
if (pt > 0 && ht > 0) {
|
|
554
|
+
const ot = Math.max(pt, 0.01), Et = Math.min(ht / ot, 3), Ft = x + (c - x) * Et, wt = Y + (g - Y) * Et, Xt = v[0].amount, Bt = v[1].amount, B = Math.min(Xt, Bt) * 2, nt = 1 - Math.pow(1 - B, 4);
|
|
555
|
+
c = c * (1 - nt) + Ft * nt, g = g * (1 - nt) + wt * nt;
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
const b = o.rotation * Math.PI / 180, C = Math.cos(b), S = Math.sin(b), I = c - o.x, w = g - o.y;
|
|
535
562
|
return {
|
|
536
|
-
x: (
|
|
537
|
-
y: (-
|
|
563
|
+
x: (I * C + w * S) / i,
|
|
564
|
+
y: (-I * S + w * C) / n
|
|
538
565
|
};
|
|
539
566
|
};
|
|
540
567
|
return p.map((r, l) => {
|
|
@@ -682,69 +709,69 @@ const us = (p) => p, Os = (p) => p > 0 ? 1 : 0, Rs = (p) => p < 1 ? 0 : 1, is =
|
|
|
682
709
|
};
|
|
683
710
|
class ci {
|
|
684
711
|
constructor() {
|
|
685
|
-
|
|
686
|
-
|
|
712
|
+
et(this, "artboard", null);
|
|
713
|
+
et(this, "objectStates", /* @__PURE__ */ new Map());
|
|
687
714
|
// Physics State
|
|
688
|
-
|
|
715
|
+
et(this, "physicsEngine", null);
|
|
689
716
|
// State Machine State
|
|
690
|
-
|
|
691
|
-
|
|
717
|
+
et(this, "activeStateMachine", null);
|
|
718
|
+
et(this, "inputs", /* @__PURE__ */ new Map());
|
|
692
719
|
// id -> value
|
|
693
|
-
|
|
720
|
+
et(this, "inputNameMap", /* @__PURE__ */ new Map());
|
|
694
721
|
// name -> id[] mapping
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
722
|
+
et(this, "layerStates", /* @__PURE__ */ new Map());
|
|
723
|
+
et(this, "pretextCache", /* @__PURE__ */ new Map());
|
|
724
|
+
et(this, "pointerHistory", []);
|
|
725
|
+
et(this, "MAX_HISTORY", 200);
|
|
726
|
+
et(this, "imageCache", /* @__PURE__ */ new Map());
|
|
727
|
+
et(this, "lastValidSvgImgMap", /* @__PURE__ */ new Map());
|
|
728
|
+
et(this, "maskBuffer", null);
|
|
729
|
+
et(this, "maskCtx", null);
|
|
730
|
+
et(this, "lumaBuffer", null);
|
|
731
|
+
et(this, "lumaCtx", null);
|
|
732
|
+
et(this, "_noiseTileCanvas", null);
|
|
733
|
+
et(this, "layout", { fit: "Contain", alignment: "Center" });
|
|
734
|
+
et(this, "onTrigger");
|
|
735
|
+
et(this, "onInputUpdate");
|
|
736
|
+
et(this, "onComponentChange");
|
|
710
737
|
// Specific Component Listeners
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
738
|
+
et(this, "onToggle");
|
|
739
|
+
et(this, "onInputChange");
|
|
740
|
+
et(this, "onInputFocus");
|
|
741
|
+
et(this, "onInputBlur");
|
|
742
|
+
et(this, "onLog");
|
|
743
|
+
et(this, "onButtonClick");
|
|
744
|
+
et(this, "onGraphPointClick");
|
|
718
745
|
// Track triggers that were just fired in the current frame
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
746
|
+
et(this, "justFiredTriggers", /* @__PURE__ */ new Set());
|
|
747
|
+
et(this, "rootTransform", null);
|
|
748
|
+
et(this, "canvasWidth", 0);
|
|
749
|
+
et(this, "canvasHeight", 0);
|
|
723
750
|
// Track currently hovered object for Enter/Leave events
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
751
|
+
et(this, "lastHoveredObjectId", null);
|
|
752
|
+
et(this, "_lastPointerPos", null);
|
|
753
|
+
et(this, "_prevPointerPos", null);
|
|
727
754
|
// Interaction State
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
755
|
+
et(this, "focusedId", null);
|
|
756
|
+
et(this, "draggingSliderId", null);
|
|
757
|
+
et(this, "activeDropdownId", null);
|
|
758
|
+
et(this, "activeObjectId", null);
|
|
759
|
+
et(this, "draggingListViewId", null);
|
|
760
|
+
et(this, "scrollOffset", { x: 0, y: 0 });
|
|
761
|
+
et(this, "_totalScroll", { x: 0, y: 0 });
|
|
762
|
+
et(this, "draggingBehaviors", /* @__PURE__ */ new Set());
|
|
763
|
+
et(this, "isMouseDown", !1);
|
|
737
764
|
// LayoutAnimation & StateReactive: per-object property interpolation cache
|
|
738
|
-
|
|
765
|
+
et(this, "_layoutAnimCache", /* @__PURE__ */ new Map());
|
|
739
766
|
// SpringChain: per-chain physics state
|
|
740
|
-
|
|
767
|
+
et(this, "_springChainState", /* @__PURE__ */ new Map());
|
|
741
768
|
// ParticleEmitter: per-emitter particle pools
|
|
742
|
-
|
|
769
|
+
et(this, "_emitterPools", /* @__PURE__ */ new Map());
|
|
743
770
|
// Physics/Animation State
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
771
|
+
et(this, "objectVelocities", /* @__PURE__ */ new Map());
|
|
772
|
+
et(this, "currentTime", 0);
|
|
773
|
+
et(this, "frameCount", 0);
|
|
774
|
+
et(this, "fontLeadingFactors", {
|
|
748
775
|
Inter: 0.35,
|
|
749
776
|
Roboto: 0.45,
|
|
750
777
|
Montserrat: 0.4,
|
|
@@ -757,24 +784,24 @@ class ci {
|
|
|
757
784
|
"Bebas Neue": 0.45,
|
|
758
785
|
Oswald: 0.4
|
|
759
786
|
});
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
787
|
+
et(this, "onLogicUpdate");
|
|
788
|
+
et(this, "logicNodeValues", /* @__PURE__ */ new Map());
|
|
789
|
+
et(this, "logicNodeState", /* @__PURE__ */ new Map());
|
|
790
|
+
et(this, "pointerDownTimes", /* @__PURE__ */ new Map());
|
|
791
|
+
et(this, "activeHoverIds", /* @__PURE__ */ new Set());
|
|
792
|
+
et(this, "onNavigation");
|
|
766
793
|
// New Interaction State Trackers
|
|
767
|
-
|
|
794
|
+
et(this, "periodicTriggerTimes", /* @__PURE__ */ new Map());
|
|
768
795
|
// interactionId -> lastFiredTime
|
|
769
|
-
|
|
796
|
+
et(this, "wasInView", /* @__PURE__ */ new Set());
|
|
770
797
|
// objectId -> boolean
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
798
|
+
et(this, "scrollProgressLastValue", /* @__PURE__ */ new Map());
|
|
799
|
+
et(this, "debug_objectsRendered", 0);
|
|
800
|
+
et(this, "debug_objectsTotal", 0);
|
|
801
|
+
et(this, "lastRenderTime", 0);
|
|
802
|
+
et(this, "debugMode", !1);
|
|
776
803
|
// Trigger Management
|
|
777
|
-
|
|
804
|
+
et(this, "activeTriggers", /* @__PURE__ */ new Map());
|
|
778
805
|
console.info("%c[ExodeUI Engine] Pixel-Perfect Parity Active (v6.3.10) - SVG Fill & Gradient Parity Active", "color: #3b82f6; font-weight: bold; padding: 2px 4px; border-radius: 4px; background: rgba(59, 130, 246, 0.1)");
|
|
779
806
|
}
|
|
780
807
|
// interactionId -> lastProgress
|
|
@@ -1409,23 +1436,23 @@ class ci {
|
|
|
1409
1436
|
};
|
|
1410
1437
|
let d = 0;
|
|
1411
1438
|
switch (e.op) {
|
|
1412
|
-
case
|
|
1439
|
+
case St.AND:
|
|
1413
1440
|
d = f("a", !1) && f("b", !1);
|
|
1414
1441
|
break;
|
|
1415
|
-
case
|
|
1442
|
+
case St.OR:
|
|
1416
1443
|
d = f("a", !1) || f("b", !1);
|
|
1417
1444
|
break;
|
|
1418
|
-
case
|
|
1445
|
+
case St.NOT:
|
|
1419
1446
|
d = !f("in", !1);
|
|
1420
1447
|
break;
|
|
1421
|
-
case
|
|
1448
|
+
case St.XOR:
|
|
1422
1449
|
d = !!f("a", !1) != !!f("b", !1);
|
|
1423
1450
|
break;
|
|
1424
|
-
case
|
|
1451
|
+
case St.OBJECT:
|
|
1425
1452
|
d = e.name;
|
|
1426
1453
|
break;
|
|
1427
|
-
case
|
|
1428
|
-
case
|
|
1454
|
+
case St.PROPERTY:
|
|
1455
|
+
case St.GET_PROPERTY: {
|
|
1429
1456
|
const u = f("id", "");
|
|
1430
1457
|
if (!u) {
|
|
1431
1458
|
d = 0;
|
|
@@ -1444,7 +1471,7 @@ class ci {
|
|
|
1444
1471
|
m in y ? d = y[m] : d = this.resolvePath(y, m);
|
|
1445
1472
|
break;
|
|
1446
1473
|
}
|
|
1447
|
-
case
|
|
1474
|
+
case St.SET_PROPERTY: {
|
|
1448
1475
|
const u = f("id", ""), m = f("value", void 0);
|
|
1449
1476
|
if (!u || m === void 0) {
|
|
1450
1477
|
d = 0;
|
|
@@ -1474,105 +1501,105 @@ class ci {
|
|
|
1474
1501
|
}
|
|
1475
1502
|
break;
|
|
1476
1503
|
}
|
|
1477
|
-
case
|
|
1504
|
+
case St.ADD:
|
|
1478
1505
|
d = f("a", 0) + f("b", 0);
|
|
1479
1506
|
break;
|
|
1480
|
-
case
|
|
1507
|
+
case St.SUB:
|
|
1481
1508
|
d = f("a", 0) - f("b", 0);
|
|
1482
1509
|
break;
|
|
1483
|
-
case
|
|
1510
|
+
case St.MUL:
|
|
1484
1511
|
d = f("a", 0) * f("b", 0);
|
|
1485
1512
|
break;
|
|
1486
|
-
case
|
|
1513
|
+
case St.DIV: {
|
|
1487
1514
|
const u = f("b", 1);
|
|
1488
1515
|
d = u === 0 ? 0 : f("a", 0) / u;
|
|
1489
1516
|
break;
|
|
1490
1517
|
}
|
|
1491
|
-
case
|
|
1518
|
+
case St.MOD:
|
|
1492
1519
|
d = f("a", 0) % f("b", 1);
|
|
1493
1520
|
break;
|
|
1494
|
-
case
|
|
1521
|
+
case St.POW:
|
|
1495
1522
|
d = Math.pow(f("a", 0), f("b", 1));
|
|
1496
1523
|
break;
|
|
1497
|
-
case
|
|
1524
|
+
case St.ABS:
|
|
1498
1525
|
d = Math.abs(f("in", 0));
|
|
1499
1526
|
break;
|
|
1500
|
-
case
|
|
1527
|
+
case St.ROUND:
|
|
1501
1528
|
d = Math.round(f("in", 0));
|
|
1502
1529
|
break;
|
|
1503
|
-
case
|
|
1530
|
+
case St.FLOOR:
|
|
1504
1531
|
d = Math.floor(f("in", 0));
|
|
1505
1532
|
break;
|
|
1506
|
-
case
|
|
1533
|
+
case St.CEIL:
|
|
1507
1534
|
d = Math.ceil(f("in", 0));
|
|
1508
1535
|
break;
|
|
1509
|
-
case
|
|
1536
|
+
case St.SIN:
|
|
1510
1537
|
d = Math.sin(f("in", 0));
|
|
1511
1538
|
break;
|
|
1512
|
-
case
|
|
1539
|
+
case St.COS:
|
|
1513
1540
|
d = Math.cos(f("in", 0));
|
|
1514
1541
|
break;
|
|
1515
|
-
case
|
|
1542
|
+
case St.TAN:
|
|
1516
1543
|
d = Math.tan(f("in", 0));
|
|
1517
1544
|
break;
|
|
1518
|
-
case
|
|
1545
|
+
case St.CLAMP: {
|
|
1519
1546
|
const u = f("in", 0), m = f("min", 0), y = f("max", 1);
|
|
1520
1547
|
d = Math.max(m, Math.min(y, u));
|
|
1521
1548
|
break;
|
|
1522
1549
|
}
|
|
1523
|
-
case
|
|
1550
|
+
case St.REMAP: {
|
|
1524
1551
|
const u = f("in", 0), m = f("inMin", 0), y = f("inMax", 100), v = f("outMin", 0), b = f("outMax", 1);
|
|
1525
1552
|
d = y === m ? v : v + (u - m) * (b - v) / (y - m);
|
|
1526
1553
|
break;
|
|
1527
1554
|
}
|
|
1528
|
-
case
|
|
1555
|
+
case St.EQ:
|
|
1529
1556
|
d = f("a", 0) == f("b", 0);
|
|
1530
1557
|
break;
|
|
1531
|
-
case
|
|
1558
|
+
case St.NEQ:
|
|
1532
1559
|
d = f("a", 0) != f("b", 0);
|
|
1533
1560
|
break;
|
|
1534
|
-
case
|
|
1561
|
+
case St.GT:
|
|
1535
1562
|
d = f("a", 0) > f("b", 0);
|
|
1536
1563
|
break;
|
|
1537
|
-
case
|
|
1564
|
+
case St.LT:
|
|
1538
1565
|
d = f("a", 0) < f("b", 0);
|
|
1539
1566
|
break;
|
|
1540
|
-
case
|
|
1567
|
+
case St.GTE:
|
|
1541
1568
|
d = f("a", 0) >= f("b", 0);
|
|
1542
1569
|
break;
|
|
1543
|
-
case
|
|
1570
|
+
case St.LTE:
|
|
1544
1571
|
d = f("a", 0) <= f("b", 0);
|
|
1545
1572
|
break;
|
|
1546
|
-
case
|
|
1573
|
+
case St.IF_ELSE:
|
|
1547
1574
|
d = f("cond", !1) ? f("then", 0) : f("else", 0);
|
|
1548
1575
|
break;
|
|
1549
|
-
case
|
|
1576
|
+
case St.VALUE:
|
|
1550
1577
|
d = e.value !== void 0 ? e.value : 0;
|
|
1551
1578
|
break;
|
|
1552
|
-
case
|
|
1579
|
+
case St.INPUT:
|
|
1553
1580
|
d = this.inputs.get(e.name) ?? 0;
|
|
1554
1581
|
break;
|
|
1555
|
-
case
|
|
1582
|
+
case St.LOG: {
|
|
1556
1583
|
const u = f("in", "");
|
|
1557
1584
|
this.debugLog(`[User Logic] ${u}`), d = u;
|
|
1558
1585
|
break;
|
|
1559
1586
|
}
|
|
1560
|
-
case
|
|
1587
|
+
case St.SCROLL_X:
|
|
1561
1588
|
d = this.inputs.get("scrollX") ?? 0;
|
|
1562
1589
|
break;
|
|
1563
|
-
case
|
|
1590
|
+
case St.SCROLL_Y:
|
|
1564
1591
|
d = this.inputs.get("scrollY") ?? 0;
|
|
1565
1592
|
break;
|
|
1566
|
-
case
|
|
1593
|
+
case St.MOUSE_X:
|
|
1567
1594
|
d = this.inputs.get("mouseX") ?? 0;
|
|
1568
1595
|
break;
|
|
1569
|
-
case
|
|
1596
|
+
case St.MOUSE_Y:
|
|
1570
1597
|
d = this.inputs.get("mouseY") ?? 0;
|
|
1571
1598
|
break;
|
|
1572
|
-
case
|
|
1599
|
+
case St.IS_MOUSE_DOWN:
|
|
1573
1600
|
d = this.inputs.get("isMouseDown") ?? !1;
|
|
1574
1601
|
break;
|
|
1575
|
-
case
|
|
1602
|
+
case St.EFFECTOR: {
|
|
1576
1603
|
const u = f("id", ""), m = f("intensity", 1), y = f("trigger", !0);
|
|
1577
1604
|
if (!u || !y) {
|
|
1578
1605
|
d = 0;
|
|
@@ -1597,16 +1624,16 @@ class ci {
|
|
|
1597
1624
|
}
|
|
1598
1625
|
break;
|
|
1599
1626
|
}
|
|
1600
|
-
case
|
|
1627
|
+
case St.MONITOR: {
|
|
1601
1628
|
d = f("in", 0);
|
|
1602
1629
|
break;
|
|
1603
1630
|
}
|
|
1604
|
-
case
|
|
1631
|
+
case St.SPRING_PULL: {
|
|
1605
1632
|
const u = f("objectId", ""), m = f("forceX", 0), y = f("forceY", 0);
|
|
1606
1633
|
u && ((l = this.artboard) == null || l.objects.forEach((v) => {
|
|
1607
1634
|
v.behaviors && v.behaviors.forEach((b) => {
|
|
1608
1635
|
var C;
|
|
1609
|
-
if (b.type ===
|
|
1636
|
+
if (b.type === G.SpringChain && ((C = b.settings) != null && C.connections) && (b.settings.connections.some((I) => I.targetId === u) || v.id === u)) {
|
|
1610
1637
|
this._springChainState.has(v.id) || this._springChainState.set(v.id, /* @__PURE__ */ new Map());
|
|
1611
1638
|
const I = this._springChainState.get(v.id);
|
|
1612
1639
|
if (!I.has(u)) {
|
|
@@ -1625,7 +1652,7 @@ class ci {
|
|
|
1625
1652
|
})), d = 1;
|
|
1626
1653
|
break;
|
|
1627
1654
|
}
|
|
1628
|
-
case
|
|
1655
|
+
case St.SPRING_SETTLE: {
|
|
1629
1656
|
const u = f("objectId", "");
|
|
1630
1657
|
let m = !0;
|
|
1631
1658
|
if (u) {
|
|
@@ -1638,11 +1665,11 @@ class ci {
|
|
|
1638
1665
|
d = m;
|
|
1639
1666
|
break;
|
|
1640
1667
|
}
|
|
1641
|
-
case
|
|
1668
|
+
case St.EMIT: {
|
|
1642
1669
|
const u = f("objectId", ""), m = f("count", 20);
|
|
1643
1670
|
u && ((h = this.artboard) == null || h.objects.forEach((y) => {
|
|
1644
1671
|
y.behaviors && y.behaviors.forEach((v) => {
|
|
1645
|
-
v.type ===
|
|
1672
|
+
v.type === G.ParticleEmitter && y.id === u && (v._pendingBurst = (v._pendingBurst || 0) + m);
|
|
1646
1673
|
});
|
|
1647
1674
|
})), d = 1;
|
|
1648
1675
|
break;
|
|
@@ -1651,7 +1678,7 @@ class ci {
|
|
|
1651
1678
|
d = 0;
|
|
1652
1679
|
break;
|
|
1653
1680
|
}
|
|
1654
|
-
if (this.logicNodeValues.set(t, d), e.op ===
|
|
1681
|
+
if (this.logicNodeValues.set(t, d), e.op === St.DELAY) {
|
|
1655
1682
|
const u = f("delay", 0), m = f("in", 0);
|
|
1656
1683
|
let y = this.logicNodeState.get(t);
|
|
1657
1684
|
for (y || (y = { queue: [] }, this.logicNodeState.set(t, y)), y.queue.push({ time: this.currentTime + u, value: m }); y.queue.length > 0 && y.queue[0].time <= this.currentTime; )
|
|
@@ -1683,7 +1710,7 @@ class ci {
|
|
|
1683
1710
|
}
|
|
1684
1711
|
runLogicNodes() {
|
|
1685
1712
|
!this.activeStateMachine || !this.activeStateMachine.logicNodes || this.activeStateMachine.logicNodes.forEach((t) => {
|
|
1686
|
-
(t.op ===
|
|
1713
|
+
(t.op === St.SET_PROPERTY || t.op === St.EFFECTOR) && this.evaluateLogicTree(t.id);
|
|
1687
1714
|
});
|
|
1688
1715
|
}
|
|
1689
1716
|
resolvePath(t, s) {
|
|
@@ -1806,20 +1833,20 @@ class ci {
|
|
|
1806
1833
|
if (b) {
|
|
1807
1834
|
const C = r.offsetX || 0, S = r.offsetY || 0, I = b.x + C, w = b.y + S, M = r.useSpring;
|
|
1808
1835
|
if (M) {
|
|
1809
|
-
const T = this.objectVelocities.get(s.id) || { vx: 0, vy: 0 }, { x:
|
|
1810
|
-
r.copyX && (e.x = e.x + (
|
|
1836
|
+
const T = this.objectVelocities.get(s.id) || { vx: 0, vy: 0 }, { x: $, y: k, vx: E, vy: R } = this.computeSpring(e.x, e.y, T.vx, T.vy, I, w, r, t);
|
|
1837
|
+
r.copyX && (e.x = e.x + ($ - e.x) * l), r.copyY && (e.y = e.y + (k - e.y) * l), this.objectVelocities.set(s.id, { vx: E, vy: R });
|
|
1811
1838
|
} else
|
|
1812
1839
|
r.copyX && (e.x = e.x + (I - e.x) * l), r.copyY && (e.y = e.y + (w - e.y) * l);
|
|
1813
|
-
let
|
|
1840
|
+
let _ = !1;
|
|
1814
1841
|
if ((c = r.limitX) != null && c.enabled) {
|
|
1815
1842
|
const T = e.x;
|
|
1816
|
-
e.x = Math.max(r.limitX.min, Math.min(r.limitX.max, e.x)), e.x !== T && (
|
|
1843
|
+
e.x = Math.max(r.limitX.min, Math.min(r.limitX.max, e.x)), e.x !== T && (_ = !0);
|
|
1817
1844
|
}
|
|
1818
1845
|
if ((g = r.limitY) != null && g.enabled) {
|
|
1819
1846
|
const T = e.y;
|
|
1820
|
-
e.y = Math.max(r.limitY.min, Math.min(r.limitY.max, e.y)), e.y !== T && (
|
|
1847
|
+
e.y = Math.max(r.limitY.min, Math.min(r.limitY.max, e.y)), e.y !== T && (_ = !0);
|
|
1821
1848
|
}
|
|
1822
|
-
|
|
1849
|
+
_ && M && this.objectVelocities.set(s.id, { vx: 0, vy: 0 });
|
|
1823
1850
|
}
|
|
1824
1851
|
} else if (r.type === "Rotation") {
|
|
1825
1852
|
const b = this.getGlobalTransform(r.targetId);
|
|
@@ -1840,8 +1867,8 @@ class ci {
|
|
|
1840
1867
|
} else if (r.type === "FollowPointer") {
|
|
1841
1868
|
const b = ((f = this._lastPointerPos) == null ? void 0 : f.x) ?? e.x, C = ((d = this._lastPointerPos) == null ? void 0 : d.y) ?? e.y, S = r.useSpring;
|
|
1842
1869
|
if (S) {
|
|
1843
|
-
const w = this.objectVelocities.get(s.id) || { vx: 0, vy: 0 }, { x: M, y:
|
|
1844
|
-
e.x = M, e.y =
|
|
1870
|
+
const w = this.objectVelocities.get(s.id) || { vx: 0, vy: 0 }, { x: M, y: _, vx: T, vy: $ } = this.computeSpring(e.x, e.y, w.vx, w.vy, b, C, r, t);
|
|
1871
|
+
e.x = M, e.y = _, this.objectVelocities.set(s.id, { vx: T, vy: $ });
|
|
1845
1872
|
} else
|
|
1846
1873
|
e.x = e.x + (b - e.x) * l, e.y = e.y + (C - e.y) * l;
|
|
1847
1874
|
let I = !1;
|
|
@@ -1874,8 +1901,8 @@ class ci {
|
|
|
1874
1901
|
break;
|
|
1875
1902
|
}
|
|
1876
1903
|
if (I > 0) {
|
|
1877
|
-
const
|
|
1878
|
-
e.x = e.x + (b.x + C *
|
|
1904
|
+
const _ = e.x === b.x && e.y === b.y ? 1 : M / I;
|
|
1905
|
+
e.x = e.x + (b.x + C * _ - e.x) * l, e.y = e.y + (b.y + S * _ - e.y) * l;
|
|
1879
1906
|
}
|
|
1880
1907
|
}
|
|
1881
1908
|
} else if (r.type === "FollowPath") {
|
|
@@ -1886,20 +1913,20 @@ class ci {
|
|
|
1886
1913
|
let S = b.geometry;
|
|
1887
1914
|
if (b.type === "Frame" || b.type === "Group" || !S || S.type !== "Path" && S.type !== "Ellipse" && S.type !== "Rectangle") {
|
|
1888
1915
|
const F = (v = this.artboard) == null ? void 0 : v.objects.find(
|
|
1889
|
-
(
|
|
1916
|
+
(U) => U.parentId === b.id && U.type === "Shape" && U.geometry && (U.geometry.type === "Path" || U.geometry.type === "Ellipse" || U.geometry.type === "Rectangle")
|
|
1890
1917
|
);
|
|
1891
1918
|
F && (S = F.geometry);
|
|
1892
1919
|
}
|
|
1893
1920
|
if (!S) return;
|
|
1894
|
-
const I = (r.distance || 0) / 100, w = C.width || S.width || 0, M = C.height || S.height || 0,
|
|
1895
|
-
let
|
|
1921
|
+
const I = (r.distance || 0) / 100, w = C.width || S.width || 0, M = C.height || S.height || 0, _ = this.getPointOnPath(S, w, M, I), T = C.rotation * Math.PI / 180, $ = Math.cos(T), k = Math.sin(T), E = _.x * C.scale_x * $ - _.y * C.scale_y * k, R = _.x * C.scale_x * k + _.y * C.scale_y * $;
|
|
1922
|
+
let A = C.rotation + (r.offsetRotation || 0);
|
|
1896
1923
|
if (r.orient) {
|
|
1897
|
-
const F = Math.cos(
|
|
1898
|
-
|
|
1924
|
+
const F = Math.cos(_.angle), U = Math.sin(_.angle), J = F * C.scale_x * $ - U * C.scale_y * k, it = F * C.scale_x * k + U * C.scale_y * $;
|
|
1925
|
+
A = Math.atan2(it, J) * 180 / Math.PI + (r.offsetRotation || 0);
|
|
1899
1926
|
}
|
|
1900
|
-
const
|
|
1901
|
-
if (e.x = e.x + (
|
|
1902
|
-
let F = (
|
|
1927
|
+
const O = A * Math.PI / 180, W = Math.cos(O), x = Math.sin(O), Y = (r.offsetX || 0) * W - (r.offsetY || 0) * x, H = (r.offsetX || 0) * x + (r.offsetY || 0) * W, Q = C.x + E + Y, P = C.y + R + H;
|
|
1928
|
+
if (e.x = e.x + (Q - e.x) * l, e.y = e.y + (P - e.y) * l, r.orient) {
|
|
1929
|
+
let F = (A - e.rotation) % 360;
|
|
1903
1930
|
F > 180 && (F -= 360), F < -180 && (F += 360), e.rotation = e.rotation + F * l;
|
|
1904
1931
|
}
|
|
1905
1932
|
}
|
|
@@ -1915,25 +1942,27 @@ class ci {
|
|
|
1915
1942
|
});
|
|
1916
1943
|
}
|
|
1917
1944
|
getGlobalTransform(t) {
|
|
1918
|
-
var
|
|
1945
|
+
var c, g;
|
|
1919
1946
|
const s = this.objectStates.get(t);
|
|
1920
1947
|
if (!s) return { x: 0, y: 0, rotation: 0, scale_x: 1, scale_y: 1 };
|
|
1921
|
-
const o = (
|
|
1948
|
+
const o = (c = this.artboard) == null ? void 0 : c.objects.find((f) => f.id === t), e = (o == null ? void 0 : o.type) === "Bone" ? (g = o.geometry) == null ? void 0 : g.length : void 0;
|
|
1922
1949
|
if (!o || !o.parentId)
|
|
1923
1950
|
return {
|
|
1924
|
-
x:
|
|
1925
|
-
y:
|
|
1926
|
-
rotation:
|
|
1927
|
-
scale_x:
|
|
1928
|
-
scale_y:
|
|
1951
|
+
x: s.x,
|
|
1952
|
+
y: s.y,
|
|
1953
|
+
rotation: s.rotation,
|
|
1954
|
+
scale_x: (s.scale_x ?? 1) * (s.flip_x ? -1 : 1),
|
|
1955
|
+
scale_y: (s.scale_y ?? 1) * (s.flip_y ? -1 : 1),
|
|
1956
|
+
length: e
|
|
1929
1957
|
};
|
|
1930
|
-
const
|
|
1958
|
+
const i = this.getGlobalTransform(o.parentId), n = i.rotation * Math.PI / 180, a = Math.cos(n), r = Math.sin(n), l = i.x + (s.x * i.scale_x * a - s.y * i.scale_y * r), h = i.y + (s.x * i.scale_x * r + s.y * i.scale_y * a);
|
|
1931
1959
|
return {
|
|
1932
|
-
x:
|
|
1933
|
-
y:
|
|
1934
|
-
rotation:
|
|
1935
|
-
scale_x:
|
|
1936
|
-
scale_y:
|
|
1960
|
+
x: l,
|
|
1961
|
+
y: h,
|
|
1962
|
+
rotation: i.rotation + s.rotation,
|
|
1963
|
+
scale_x: i.scale_x * (s.scale_x ?? 1) * (s.flip_x ? -1 : 1),
|
|
1964
|
+
scale_y: i.scale_y * (s.scale_y ?? 1) * (s.flip_y ? -1 : 1),
|
|
1965
|
+
length: e
|
|
1937
1966
|
};
|
|
1938
1967
|
}
|
|
1939
1968
|
globalToLocal(t, s) {
|
|
@@ -2038,22 +2067,22 @@ class ci {
|
|
|
2038
2067
|
e && e.type === "Component" && e.variant === "listview" && this.updateListViewHoverFromPointer(e, s, o), this.isMouseDown && a && this.fireEventForObject(a, "Drag"), a !== this.lastHoveredObjectId && (console.log(`[Engine] HOVER CHANGE: ${this.lastHoveredObjectId} -> ${a}`), this.lastHoveredObjectId && this.fireEventForObject(this.lastHoveredObjectId, "onPointerLeave"), a && this.fireEventForObject(a, "onPointerEnter"), this.lastHoveredObjectId = a);
|
|
2039
2068
|
return;
|
|
2040
2069
|
}
|
|
2041
|
-
if ((t === "up" || t === "blur") && (this.draggingSliderId = null, this.draggingListViewId = null, this.draggingBehaviors.clear(), this.pointerDownTimes.delete(a), this.activeObjectId = null), t === "down" && (this.pointerDownTimes.set(a, this.currentTime), this.activeObjectId = a, e && ((r = e.behaviors) != null && r.some((f) => f.type ===
|
|
2070
|
+
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((f) => f.type === G.Draggable)) && this.draggingBehaviors.add(a)), t === "move" ? (a && !this.activeHoverIds.has(a) && this.activeHoverIds.add(a), this.activeHoverIds.forEach((f) => {
|
|
2042
2071
|
f !== a && this.activeHoverIds.delete(f);
|
|
2043
2072
|
})) : t === "blur" && this.activeHoverIds.clear(), this.activeDropdownId && t === "down") {
|
|
2044
2073
|
const f = this.artboard.objects.find((d) => d.id === this.activeDropdownId);
|
|
2045
2074
|
if (f && (f.type === "Dropdown" || f.variant === "dropdown")) {
|
|
2046
|
-
const d = this.objectStates.get(f.id), u = (d == null ? void 0 : d.options) || f.options || {}, m = f.geometry || {}, y = m.width ?? f.width ?? 200, v = m.height ?? f.height ?? 40, b = u.optionsList || [], C = u.itemHeight || 32, S = u.listPadding ?? 4, I = b.length * C + S * 2, w = this.getWorldTransform(f.id), M = y * Math.abs(w.scaleX),
|
|
2047
|
-
if (
|
|
2048
|
-
const
|
|
2049
|
-
if (
|
|
2050
|
-
const
|
|
2051
|
-
u.selectedOption =
|
|
2075
|
+
const d = this.objectStates.get(f.id), u = (d == null ? void 0 : d.options) || f.options || {}, m = f.geometry || {}, y = m.width ?? f.width ?? 200, v = m.height ?? f.height ?? 40, b = u.optionsList || [], C = u.itemHeight || 32, S = u.listPadding ?? 4, I = b.length * C + S * 2, w = this.getWorldTransform(f.id), M = y * Math.abs(w.scaleX), _ = v * Math.abs(w.scaleY), T = w.y + _ / 2 + 4, $ = Math.abs(s - w.x) <= M / 2, k = o >= T && o <= T + I * Math.abs(w.scaleY);
|
|
2076
|
+
if ($ && k) {
|
|
2077
|
+
const E = Math.abs(w.scaleY), R = o - (T + S * E), A = Math.floor(R / (C * E));
|
|
2078
|
+
if (A >= 0 && A < b.length) {
|
|
2079
|
+
const O = b[A];
|
|
2080
|
+
u.selectedOption = O, u.isOpen = !1, this.activeDropdownId = null, f.inputId && this.setInternalInput(f.inputId, O), this.onComponentChange && this.onComponentChange({
|
|
2052
2081
|
objectId: f.id,
|
|
2053
2082
|
componentName: f.name,
|
|
2054
2083
|
variant: "dropdown",
|
|
2055
2084
|
property: "selectedOption",
|
|
2056
|
-
value:
|
|
2085
|
+
value: O
|
|
2057
2086
|
});
|
|
2058
2087
|
}
|
|
2059
2088
|
return;
|
|
@@ -2153,20 +2182,20 @@ class ci {
|
|
|
2153
2182
|
}
|
|
2154
2183
|
}
|
|
2155
2184
|
if (f.type === "LineGraph" && (t === "down" || t === "click")) {
|
|
2156
|
-
const m = f.geometry, y = (m == null ? void 0 : m.datasets) || [], v = this.objectStates.get(f.id), b = (v == null ? void 0 : v.width) || (m == null ? void 0 : m.width) || 200, C = (v == null ? void 0 : v.height) || (m == null ? void 0 : m.height) || 150, S = this.getWorldTransform(f.id), I = 30, w = 20, M = b - I,
|
|
2185
|
+
const m = f.geometry, y = (m == null ? void 0 : m.datasets) || [], v = this.objectStates.get(f.id), b = (v == null ? void 0 : v.width) || (m == null ? void 0 : m.width) || 200, C = (v == null ? void 0 : v.height) || (m == null ? void 0 : m.height) || 150, S = this.getWorldTransform(f.id), I = 30, w = 20, M = b - I, _ = C - w;
|
|
2157
2186
|
let T = 1;
|
|
2158
|
-
y.forEach((
|
|
2159
|
-
const
|
|
2160
|
-
|
|
2187
|
+
y.forEach((E) => {
|
|
2188
|
+
const R = Math.max(...E.data || [0]);
|
|
2189
|
+
R > T && (T = R);
|
|
2161
2190
|
});
|
|
2162
|
-
let
|
|
2163
|
-
y.forEach((
|
|
2164
|
-
const
|
|
2165
|
-
|
|
2166
|
-
const
|
|
2167
|
-
|
|
2191
|
+
let $ = 1 / 0, k = null;
|
|
2192
|
+
y.forEach((E, R) => {
|
|
2193
|
+
const A = E.data || [], O = M / Math.max(A.length - 1, 1);
|
|
2194
|
+
A.forEach((W, x) => {
|
|
2195
|
+
const Y = S.x - b / 2 + I + x * O, H = S.y + C / 2 - w - W / T * _, Q = Math.sqrt((s - Y) ** 2 + (o - H) ** 2);
|
|
2196
|
+
Q < $ && ($ = Q, k = { dIdx: R, pIdx: x, val: W, label: E.label || `Dataset ${R + 1}` });
|
|
2168
2197
|
});
|
|
2169
|
-
}), k &&
|
|
2198
|
+
}), k && $ < 20 && this.onGraphPointClick && this.onGraphPointClick({ objectId: f.id, componentName: f.name, datasetIndex: k.dIdx, pointIndex: k.pIdx, value: k.val, label: k.label }), this.onComponentChange && this.onComponentChange({ objectId: f.id, componentName: f.name, variant: "linegraph", property: "click", value: (k == null ? void 0 : k.val) ?? null });
|
|
2170
2199
|
}
|
|
2171
2200
|
if (t === "click") {
|
|
2172
2201
|
const m = (l = this.artboard) == null ? void 0 : l.objects.find((b) => b.id === e.id), y = this.focusedId, v = (m == null ? void 0 : m.type) === "InputBox" || (m == null ? void 0 : m.type) === "Component" && m.variant === "inputbox";
|
|
@@ -2633,68 +2662,68 @@ class ci {
|
|
|
2633
2662
|
}
|
|
2634
2663
|
*/
|
|
2635
2664
|
renderObject(t, s, o) {
|
|
2636
|
-
var u, m, y, v, b, C, S, I, w, M,
|
|
2665
|
+
var u, m, y, v, b, C, S, I, w, M, _, T, $, k, E, R, A;
|
|
2637
2666
|
const e = this.objectStates.get(s.id);
|
|
2638
2667
|
if (!e) {
|
|
2639
2668
|
console.warn("No state for object:", s.id);
|
|
2640
2669
|
return;
|
|
2641
2670
|
}
|
|
2642
|
-
this.frameCount % 60, t.roundRect || (t.roundRect = (
|
|
2671
|
+
this.frameCount % 60, t.roundRect || (t.roundRect = (O, W, x, Y, H) => (this.drawRoundRect(t, O, W, x, Y, H), t));
|
|
2643
2672
|
const i = e.geometry ? this.deepMerge(s.geometry, e.geometry) : s.geometry, n = e.style ? this.deepMerge(s.style, e.style) : s.style;
|
|
2644
2673
|
let a = (i == null ? void 0 : i.width) || ((u = s.geometry) == null ? void 0 : u.width) || s.width || 0, r = (i == null ? void 0 : i.height) || ((m = s.geometry) == null ? void 0 : m.height) || s.height || 0;
|
|
2645
2674
|
if ((a === 0 || r === 0) && (i != null && i.points) && Array.isArray(i.points) && i.points.length > 0) {
|
|
2646
|
-
let
|
|
2675
|
+
let O = 1 / 0, W = -1 / 0, x = 1 / 0, Y = -1 / 0;
|
|
2647
2676
|
i.points.forEach((H) => {
|
|
2648
|
-
|
|
2649
|
-
}), a === 0 && (a =
|
|
2677
|
+
O = Math.min(O, H.x), W = Math.max(W, H.x), x = Math.min(x, H.y), Y = Math.max(Y, H.y);
|
|
2678
|
+
}), a === 0 && (a = W - O), r === 0 && (r = Y - x);
|
|
2650
2679
|
}
|
|
2651
|
-
const l = (
|
|
2652
|
-
if (
|
|
2653
|
-
return
|
|
2680
|
+
const l = (O) => {
|
|
2681
|
+
if (O)
|
|
2682
|
+
return O.corner_radius ?? O.cornerRadius;
|
|
2654
2683
|
}, h = l(e) ?? l(n) ?? l(i) ?? l(s.style) ?? l(s.geometry) ?? 0;
|
|
2655
2684
|
let c = { ...i, width: a, height: r };
|
|
2656
2685
|
if (delete c.cornerRadius, c.corner_radius = h, c.type === "Path" && s.weights && s.bindMatrices && c.points) {
|
|
2657
|
-
const
|
|
2658
|
-
if (
|
|
2659
|
-
const
|
|
2686
|
+
const O = this.getGlobalTransform(s.id);
|
|
2687
|
+
if (O) {
|
|
2688
|
+
const W = li(
|
|
2660
2689
|
c.points,
|
|
2661
2690
|
s.weights,
|
|
2662
2691
|
s.bindMatrices,
|
|
2663
|
-
|
|
2664
|
-
(
|
|
2692
|
+
O,
|
|
2693
|
+
(x) => this.getGlobalTransform(x)
|
|
2665
2694
|
);
|
|
2666
|
-
c = { ...c, points:
|
|
2695
|
+
c = { ...c, points: W };
|
|
2667
2696
|
}
|
|
2668
2697
|
}
|
|
2669
2698
|
if (e.visible === !1)
|
|
2670
2699
|
return;
|
|
2671
2700
|
const g = s.repeaterConfig, f = g && g.isEnabled && g.count > 1, d = f ? g.count : 1;
|
|
2672
|
-
for (let
|
|
2673
|
-
let
|
|
2674
|
-
if (f &&
|
|
2701
|
+
for (let O = 0; O < d; O++) {
|
|
2702
|
+
let W = e.x, x = e.y, Y = e.rotation, H = e.scale_x ?? 1, Q = e.scale_y ?? 1;
|
|
2703
|
+
if (f && O > 0) {
|
|
2675
2704
|
if (g.type === "Linear") {
|
|
2676
|
-
const
|
|
2677
|
-
|
|
2705
|
+
const K = g.offsetX || 0, ft = g.offsetY || 0, q = g.rotation || 0, X = g.scale !== void 0 ? g.scale : 1;
|
|
2706
|
+
W += O * K, x += O * ft, Y += O * q, H *= Math.pow(X, O), Q *= Math.pow(X, O);
|
|
2678
2707
|
} else if (g.type === "Grid") {
|
|
2679
|
-
const
|
|
2680
|
-
|
|
2708
|
+
const K = g.cols || Math.ceil(Math.sqrt(g.count)), ft = g.gapX || 0, q = g.gapY || 0, X = Math.floor(O / K), Z = O % K, j = a + ft, Ot = r + q;
|
|
2709
|
+
W += Z * j, x += X * Ot;
|
|
2681
2710
|
} else if (g.type === "Radial") {
|
|
2682
|
-
const
|
|
2683
|
-
|
|
2711
|
+
const K = g.radius || 100, ft = g.startAngle || 0, X = (g.endAngle || 360) - ft, Z = g.count > 1 ? X / (X === 360 ? g.count : g.count - 1) : 0, j = ft + O * Z, Ot = j * Math.PI / 180;
|
|
2712
|
+
W = e.x + K * Math.cos(Ot), x = e.y + K * Math.sin(Ot), Y += j;
|
|
2684
2713
|
}
|
|
2685
2714
|
}
|
|
2686
|
-
const
|
|
2687
|
-
if (!
|
|
2688
|
-
const
|
|
2689
|
-
if (!this.isObjectInView(t,
|
|
2715
|
+
const P = s.type === "Group" || s.type === "Frame" || s.type === "Component", F = a > 0 && r > 0;
|
|
2716
|
+
if (!P && F) {
|
|
2717
|
+
const K = (((y = n.shadow) == null ? void 0 : y.isEnabled) !== !1 ? (((v = n.shadow) == null ? void 0 : v.blur) || 0) + 10 : 0) + (((b = n.blur) == null ? void 0 : b.isEnabled) !== !1 && ((C = n.blur) == null ? void 0 : C.radius) || 0) + 20;
|
|
2718
|
+
if (!this.isObjectInView(t, W, x, a, r, K))
|
|
2690
2719
|
continue;
|
|
2691
2720
|
}
|
|
2692
2721
|
this.debug_objectsRendered++, t.save();
|
|
2693
|
-
const
|
|
2694
|
-
|
|
2695
|
-
const it = n.effect || ((I = s.style) == null ? void 0 : I.effect), dt = (it == null ? void 0 : it.isEnabled) === !0,
|
|
2696
|
-
dt &&
|
|
2697
|
-
const
|
|
2722
|
+
const U = [], J = n.blur || ((S = s.style) == null ? void 0 : S.blur);
|
|
2723
|
+
J && J.amount > 0 && U.push(`blur(${J.amount}px)`);
|
|
2724
|
+
const it = n.effect || ((I = s.style) == null ? void 0 : I.effect), dt = (it == null ? void 0 : it.isEnabled) === !0, yt = it == null ? void 0 : it.type, ht = (it == null ? void 0 : it.radius) ?? 10;
|
|
2725
|
+
dt && yt === "LayerBlur" && U.push(`blur(${ht}px)`);
|
|
2726
|
+
const pt = ((w = i == null ? void 0 : i.type) == null ? void 0 : w.toLowerCase().includes("image")) || ((M = s.type) == null ? void 0 : M.toLowerCase().includes("image")), ot = n.adjustments && Object.keys(n.adjustments).length > 0 ? n.adjustments : null, Et = i != null && i.adjustments && Object.keys(i.adjustments).length > 0 ? i.adjustments : null, Ft = pt ? Et || ot : ot || Et, wt = pt && !Ft ? {
|
|
2698
2727
|
exposure: 0,
|
|
2699
2728
|
contrast: 0,
|
|
2700
2729
|
saturation: 100,
|
|
@@ -2705,69 +2734,69 @@ class ci {
|
|
|
2705
2734
|
blur: 0,
|
|
2706
2735
|
negative: 0,
|
|
2707
2736
|
hue: 0
|
|
2708
|
-
} :
|
|
2709
|
-
if (e &&
|
|
2710
|
-
const
|
|
2711
|
-
let
|
|
2712
|
-
if (
|
|
2713
|
-
<feComponentTransfer in="${
|
|
2714
|
-
<feFuncR type="linear" slope="1" intercept="${
|
|
2715
|
-
<feFuncG type="linear" slope="1" intercept="${
|
|
2716
|
-
<feFuncB type="linear" slope="1" intercept="${
|
|
2717
|
-
</feComponentTransfer>`,
|
|
2718
|
-
const
|
|
2719
|
-
|
|
2720
|
-
<feComponentTransfer in="${
|
|
2721
|
-
<feFuncR type="linear" slope="${
|
|
2722
|
-
<feFuncG type="linear" slope="${
|
|
2723
|
-
<feFuncB type="linear" slope="${
|
|
2724
|
-
</feComponentTransfer>`,
|
|
2737
|
+
} : Ft;
|
|
2738
|
+
if (e && wt && (e.geometry = e.geometry || {}, e.geometry.adjustments = { ...wt }), wt) {
|
|
2739
|
+
const K = (wt.exposure || 0) / 100, ft = wt.contrast || 0, q = 1 + (wt.saturation || 0) / 100, X = (wt.temperature || 0) / 200, Z = (wt.tint || 0) / 200, j = (wt.highlights || 0) / 500, Ot = (wt.shadows || 0) / 500;
|
|
2740
|
+
let Rt = "", Tt = "SourceGraphic";
|
|
2741
|
+
if (K !== 0 && (Rt += `
|
|
2742
|
+
<feComponentTransfer in="${Tt}" result="exposure">
|
|
2743
|
+
<feFuncR type="linear" slope="1" intercept="${K}"/>
|
|
2744
|
+
<feFuncG type="linear" slope="1" intercept="${K}"/>
|
|
2745
|
+
<feFuncB type="linear" slope="1" intercept="${K}"/>
|
|
2746
|
+
</feComponentTransfer>`, Tt = "exposure"), ft !== 0) {
|
|
2747
|
+
const bt = (ft + 100) / 100, L = 0.5 * (1 - bt);
|
|
2748
|
+
Rt += `
|
|
2749
|
+
<feComponentTransfer in="${Tt}" result="contrast">
|
|
2750
|
+
<feFuncR type="linear" slope="${bt}" intercept="${L}"/>
|
|
2751
|
+
<feFuncG type="linear" slope="${bt}" intercept="${L}"/>
|
|
2752
|
+
<feFuncB type="linear" slope="${bt}" intercept="${L}"/>
|
|
2753
|
+
</feComponentTransfer>`, Tt = "contrast";
|
|
2725
2754
|
}
|
|
2726
|
-
if (
|
|
2727
|
-
const
|
|
2728
|
-
|
|
2729
|
-
<feColorMatrix in="${
|
|
2730
|
-
values="${
|
|
2731
|
-
0 ${
|
|
2732
|
-
0 0 ${
|
|
2733
|
-
0 0 0 1 0"/>`,
|
|
2755
|
+
if (q !== 1 && (Rt += `<feColorMatrix in="${Tt}" type="saturate" values="${q}" result="saturate"/>`, Tt = "saturate"), wt.hue && (Rt += `<feColorMatrix in="${Tt}" type="hueRotate" values="${wt.hue}" result="hue"/>`, Tt = "hue"), wt.negative) {
|
|
2756
|
+
const bt = 1 - wt.negative / 50;
|
|
2757
|
+
Rt += `
|
|
2758
|
+
<feColorMatrix in="${Tt}" type="matrix" result="invert"
|
|
2759
|
+
values="${bt} 0 0 0 ${1 - bt}
|
|
2760
|
+
0 ${bt} 0 0 ${1 - bt}
|
|
2761
|
+
0 0 ${bt} 0 ${1 - bt}
|
|
2762
|
+
0 0 0 1 0"/>`, Tt = "invert";
|
|
2734
2763
|
}
|
|
2735
|
-
if (
|
|
2736
|
-
const
|
|
2737
|
-
|
|
2764
|
+
if (X !== 0 || Z !== 0 || j !== 0 || Ot !== 0) {
|
|
2765
|
+
const bt = 1 + j + Ot, L = bt * (1 + X - Z / 2), ct = bt * (1 + Z), Dt = bt * (1 - X - Z / 2), At = wt.shadows * 0.1 / 255, te = [
|
|
2766
|
+
L,
|
|
2738
2767
|
0,
|
|
2739
2768
|
0,
|
|
2740
2769
|
0,
|
|
2741
|
-
|
|
2770
|
+
At,
|
|
2742
2771
|
0,
|
|
2743
2772
|
ct,
|
|
2744
2773
|
0,
|
|
2745
2774
|
0,
|
|
2746
|
-
|
|
2775
|
+
At,
|
|
2747
2776
|
0,
|
|
2748
2777
|
0,
|
|
2749
|
-
|
|
2778
|
+
Dt,
|
|
2750
2779
|
0,
|
|
2751
|
-
|
|
2780
|
+
At,
|
|
2752
2781
|
0,
|
|
2753
2782
|
0,
|
|
2754
2783
|
0,
|
|
2755
2784
|
1,
|
|
2756
2785
|
0
|
|
2757
2786
|
].join(" ");
|
|
2758
|
-
|
|
2787
|
+
Rt += `<feColorMatrix in="${Tt}" type="matrix" values="${te}" result="advanced"/>`, Tt = "advanced";
|
|
2759
2788
|
}
|
|
2760
|
-
if (
|
|
2761
|
-
const
|
|
2762
|
-
|
|
2789
|
+
if (wt.blur && (Rt += `<feGaussianBlur in="${Tt}" stdDeviation="${wt.blur}" result="blur"/>`, Tt = "blur"), Rt) {
|
|
2790
|
+
const bt = `<svg xmlns="http://www.w3.org/2000/svg"><filter id="f" color-interpolation-filters="sRGB">${Rt}</filter></svg>`, L = btoa(bt);
|
|
2791
|
+
U.push(`url('data:image/svg+xml;base64,${L}#f')`);
|
|
2763
2792
|
}
|
|
2764
2793
|
}
|
|
2765
|
-
|
|
2766
|
-
const
|
|
2767
|
-
t.globalAlpha =
|
|
2794
|
+
U.length > 0 ? t.filter = U.join(" ") : t.filter = "none", t.imageSmoothingEnabled = !0, t.imageSmoothingQuality = "high";
|
|
2795
|
+
const Xt = t.globalAlpha, Bt = this.normalizeOpacity(e.opacity !== void 0 ? e.opacity : 100);
|
|
2796
|
+
t.globalAlpha = Xt * Bt;
|
|
2768
2797
|
const B = e.compositeOperation || e.blendMode;
|
|
2769
2798
|
if (B && B !== "Normal") {
|
|
2770
|
-
const
|
|
2799
|
+
const K = B.toLowerCase();
|
|
2771
2800
|
[
|
|
2772
2801
|
"multiply",
|
|
2773
2802
|
"screen",
|
|
@@ -2797,9 +2826,9 @@ class ci {
|
|
|
2797
2826
|
"xor",
|
|
2798
2827
|
"multiply",
|
|
2799
2828
|
"screen"
|
|
2800
|
-
].includes(
|
|
2829
|
+
].includes(K) && (t.globalCompositeOperation = K);
|
|
2801
2830
|
}
|
|
2802
|
-
const
|
|
2831
|
+
const nt = t, zt = e.masks || (s.maskedBy ? [{
|
|
2803
2832
|
maskId: s.maskedBy,
|
|
2804
2833
|
inverted: s.maskInverted === !0,
|
|
2805
2834
|
type: s.maskType || "alpha",
|
|
@@ -2807,179 +2836,179 @@ class ci {
|
|
|
2807
2836
|
feather: s.maskFeather || 0,
|
|
2808
2837
|
isVisible: !0
|
|
2809
2838
|
}] : []);
|
|
2810
|
-
let
|
|
2811
|
-
const
|
|
2812
|
-
if (
|
|
2813
|
-
const
|
|
2814
|
-
|
|
2839
|
+
let kt = !1;
|
|
2840
|
+
const _t = zt.filter((K) => K.isVisible !== !1 && o.has(K.maskId));
|
|
2841
|
+
if (_t.length > 0) {
|
|
2842
|
+
const K = _t[0], ft = o.get(K.maskId), q = this.objectStates.get(ft.id);
|
|
2843
|
+
q && q.visible !== !1 && (kt = !0, (!this.maskBuffer || this.maskBuffer.width !== this.canvasWidth || this.maskBuffer.height !== this.canvasHeight) && (this.maskBuffer = document.createElement("canvas"), this.maskBuffer.width = this.canvasWidth, this.maskBuffer.height = this.canvasHeight, this.maskCtx = this.maskBuffer.getContext("2d", { willReadFrequently: !0 }), this.maskCtx && (this.maskCtx.imageSmoothingEnabled = !0, this.maskCtx.imageSmoothingQuality = "high")), this.maskCtx.setTransform(1, 0, 0, 1, 0, 0), this.maskCtx.globalCompositeOperation = "source-over", this.maskCtx.globalAlpha = 1, this.maskCtx.filter = "none", this.maskCtx.clearRect(0, 0, this.maskBuffer.width, this.maskBuffer.height), this.rootTransform && this.maskCtx.setTransform(this.rootTransform), s.parentId && this.applyAbsoluteTransform(this.maskCtx, s.parentId, o), this.maskCtx.save(), this.maskCtx.globalAlpha = 1, t = this.maskCtx, t.filter = nt.filter);
|
|
2815
2844
|
}
|
|
2816
|
-
t.translate(Math.round(
|
|
2817
|
-
const
|
|
2818
|
-
(
|
|
2845
|
+
t.translate(Math.round(W), Math.round(x)), t.rotate(Y * Math.PI / 180);
|
|
2846
|
+
const Vt = e.skew_x || 0, Ut = e.skew_y || 0;
|
|
2847
|
+
(Vt !== 0 || Ut !== 0) && t.transform(1, Math.tan(Ut * Math.PI / 180), Math.tan(Vt * Math.PI / 180), 1, 0, 0);
|
|
2819
2848
|
const Jt = e.rotate_x || 0, qt = e.rotate_y || 0, Qt = (e.flip_x === !0 ? -1 : 1) * Math.cos(qt * Math.PI / 180), oe = (e.flip_y === !0 ? -1 : 1) * Math.cos(Jt * Math.PI / 180);
|
|
2820
2849
|
t.scale(
|
|
2821
2850
|
H * Qt,
|
|
2822
|
-
|
|
2851
|
+
Q * oe
|
|
2823
2852
|
), n.shadow && n.shadow.isEnabled !== !0 && ((n.shadow.blur || 0) > 0 || Math.abs(n.shadow.offsetX || 0) > 0 || Math.abs(n.shadow.offsetY || 0) > 0) && (n.shadow.isEnabled = !0);
|
|
2824
2853
|
const jt = n.shadow;
|
|
2825
2854
|
if (jt && jt.isEnabled !== !1) {
|
|
2826
|
-
let
|
|
2827
|
-
(T = (
|
|
2828
|
-
const ft = this.normalizeOpacity(jt.opacity ?? 100),
|
|
2829
|
-
let
|
|
2830
|
-
if (
|
|
2831
|
-
const
|
|
2832
|
-
|
|
2833
|
-
} else if (
|
|
2834
|
-
const
|
|
2835
|
-
if (
|
|
2836
|
-
const Nt =
|
|
2837
|
-
|
|
2855
|
+
let K = jt.color || "#000000";
|
|
2856
|
+
(T = (_ = this.artboard) == null ? void 0 : _.tokens) != null && T.colors && this.artboard.tokens.colors[K] && (K = this.artboard.tokens.colors[K]);
|
|
2857
|
+
const ft = this.normalizeOpacity(jt.opacity ?? 100), q = jt.spread || 0, Z = (jt.blur || 0) + q * 1.5;
|
|
2858
|
+
let j = K;
|
|
2859
|
+
if (K.startsWith("#")) {
|
|
2860
|
+
const Tt = K.replace("#", ""), Nt = parseInt(Tt.substring(0, 2), 16), bt = parseInt(Tt.substring(2, 4), 16), L = parseInt(Tt.substring(4, 6), 16);
|
|
2861
|
+
j = `rgba(${Nt}, ${bt}, ${L}, ${ft})`;
|
|
2862
|
+
} else if (K.startsWith("rgba")) {
|
|
2863
|
+
const Tt = K.match(/[\d.]+/g);
|
|
2864
|
+
if (Tt && Tt.length >= 4) {
|
|
2865
|
+
const Nt = Tt[0], bt = Tt[1], L = Tt[2], ct = Tt[3];
|
|
2866
|
+
j = `rgba(${Nt}, ${bt}, ${L}, ${parseFloat(ct) * ft})`;
|
|
2838
2867
|
}
|
|
2839
2868
|
}
|
|
2840
|
-
const
|
|
2841
|
-
t.shadowColor =
|
|
2869
|
+
const Ot = t.getTransform(), Rt = Math.sqrt(Ot.a * Ot.a + Ot.b * Ot.b) || 1;
|
|
2870
|
+
t.shadowColor = j, t.shadowBlur = Z * Rt, t.shadowOffsetX = (jt.offsetX || 0) * Rt, t.shadowOffsetY = (jt.offsetY || 0) * Rt;
|
|
2842
2871
|
}
|
|
2843
|
-
const ee = s.liquidFill || ((
|
|
2872
|
+
const ee = s.liquidFill || (($ = s.style) == null ? void 0 : $.liquidFill);
|
|
2844
2873
|
if (ee && ee.enabled) {
|
|
2845
2874
|
t.save();
|
|
2846
|
-
const
|
|
2875
|
+
const K = ee.fillLevel ?? 0.5;
|
|
2847
2876
|
t.beginPath();
|
|
2848
|
-
const ft = r / 2 - r *
|
|
2849
|
-
t.rect(-a / 2, ft, a, r *
|
|
2877
|
+
const ft = r / 2 - r * K;
|
|
2878
|
+
t.rect(-a / 2, ft, a, r * K), t.clip(), t.fillStyle = ee.color || "#3b82f6", t.globalAlpha = t.globalAlpha * (ee.opacity ?? 1);
|
|
2850
2879
|
}
|
|
2851
2880
|
if ((i == null ? void 0 : i.type) === "Text")
|
|
2852
2881
|
this._renderText(t, s, c, n, e, a, r);
|
|
2853
2882
|
else if ((i == null ? void 0 : i.type) === "Image") {
|
|
2854
|
-
const
|
|
2855
|
-
if (
|
|
2856
|
-
let ft = this.imageCache.get(
|
|
2883
|
+
const K = i.originalSrc || i.src;
|
|
2884
|
+
if (K) {
|
|
2885
|
+
let ft = this.imageCache.get(K);
|
|
2857
2886
|
ft || (ft = new Image(), ft.onload = () => {
|
|
2858
2887
|
console.log(`[ExodeUI] Image loaded successfully, size: ${ft.naturalWidth}x${ft.naturalHeight}`);
|
|
2859
|
-
}, ft.onerror = (
|
|
2860
|
-
console.error("[ExodeUI] Image load failed:",
|
|
2861
|
-
}, ft.src =
|
|
2862
|
-
const
|
|
2863
|
-
if (
|
|
2888
|
+
}, ft.onerror = (Z) => {
|
|
2889
|
+
console.error("[ExodeUI] Image load failed:", Z, `Src preview: ${K.substring(0, 100)}...`);
|
|
2890
|
+
}, ft.src = K, this.imageCache.set(K, ft));
|
|
2891
|
+
const q = n.stroke && n.stroke.width > 0 && n.stroke.isEnabled !== !1, X = (((k = n.stroke) == null ? void 0 : k.alignment) || "center").toLowerCase();
|
|
2892
|
+
if (q && (X === "outside" || X === "center") && this.applyStrokeAlignment(t, n, c, a, r, h), n.fill && n.fill.type !== "None") {
|
|
2864
2893
|
t.save();
|
|
2865
|
-
const
|
|
2866
|
-
t.fillStyle =
|
|
2894
|
+
const Z = t.globalAlpha, j = this.createCanvasFill(t, n.fill, a, r);
|
|
2895
|
+
t.fillStyle = j || n.fill.color || "transparent", t.globalAlpha = Z * this.normalizeOpacity(n.fill.opacity ?? 100), h !== 0 ? (this.drawRoundRect(t, -a / 2, -r / 2, a, r, h), t.fill()) : t.fillRect(-a / 2, -r / 2, a, r), t.globalAlpha = Z, t.restore();
|
|
2867
2896
|
}
|
|
2868
|
-
ft.complete && ft.naturalWidth > 0 ? (h !== 0 ? (t.save(), this.drawRoundRect(t, -a / 2, -r / 2, a, r, h), t.clip(), t.drawImage(ft, -a / 2, -r / 2, a, r), t.restore()) : t.drawImage(ft, -a / 2, -r / 2, a, r),
|
|
2897
|
+
ft.complete && ft.naturalWidth > 0 ? (h !== 0 ? (t.save(), this.drawRoundRect(t, -a / 2, -r / 2, a, r, h), t.clip(), t.drawImage(ft, -a / 2, -r / 2, a, r), t.restore()) : t.drawImage(ft, -a / 2, -r / 2, a, r), q && X === "inside" && this.applyStrokeAlignment(t, n, c, a, r, h)) : q && X === "inside" && this.applyStrokeAlignment(t, n, c, a, r, h);
|
|
2869
2898
|
}
|
|
2870
2899
|
} else if (i.type === "SVG") {
|
|
2871
|
-
const
|
|
2872
|
-
if (
|
|
2873
|
-
const ft = n.palette || [],
|
|
2900
|
+
const K = i.svgContent;
|
|
2901
|
+
if (K) {
|
|
2902
|
+
const ft = n.palette || [], q = n.fill, X = n.stroke, Z = q ? this.normalizeOpacity(q.opacity ?? 100) : 1, j = (q == null ? void 0 : q.type) === "Solid" && (!X || X.isEnabled === !1 || X.type === "Solid" && X.color === q.color), Ot = q && q.type !== "None" ? j ? "monochrome" : q.type === "Solid" ? (q.color || "") + "|opacity:" + Z : JSON.stringify(q.stops || []) + "|opacity:" + Z : "", Rt = X && X.isEnabled !== !1 && (X.width || 0) > 0 ? j ? [
|
|
2874
2903
|
"monochrome",
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2904
|
+
X.width || 0,
|
|
2905
|
+
X.trimStart ?? 0,
|
|
2906
|
+
X.trimEnd ?? 1,
|
|
2907
|
+
X.trimOffset ?? 0,
|
|
2908
|
+
X.dashOffset ?? 0
|
|
2880
2909
|
].join("|") : [
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
(
|
|
2910
|
+
X.width || 0,
|
|
2911
|
+
X.fill ? X.fill.type === "Solid" ? X.fill.color || "" : JSON.stringify(X.fill.stops || []) : X.color || "",
|
|
2912
|
+
X.opacity ?? 1,
|
|
2913
|
+
X.lineCap || "",
|
|
2914
|
+
X.lineJoin || "",
|
|
2915
|
+
(X.dashArray || []).join(","),
|
|
2887
2916
|
// [FIX] Include trim-path values so stroke-draw animations bust the cache
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
].join("|") : "nostroke",
|
|
2917
|
+
X.trimStart ?? 0,
|
|
2918
|
+
X.trimEnd ?? 1,
|
|
2919
|
+
X.trimOffset ?? 0,
|
|
2920
|
+
X.dashOffset ?? 0
|
|
2921
|
+
].join("|") : "nostroke", Tt = [
|
|
2893
2922
|
s.id,
|
|
2894
2923
|
ft.join("_"),
|
|
2895
|
-
At,
|
|
2896
2924
|
Ot,
|
|
2925
|
+
Rt,
|
|
2897
2926
|
e.opacity ?? 100,
|
|
2898
2927
|
e.visible !== !1 ? "v" : "h"
|
|
2899
2928
|
].join("_");
|
|
2900
|
-
let Nt = this.imageCache.get(
|
|
2929
|
+
let Nt = this.imageCache.get(Tt);
|
|
2901
2930
|
if (!Nt) {
|
|
2902
2931
|
Nt = new Image(), Nt.crossOrigin = "anonymous";
|
|
2903
|
-
let
|
|
2904
|
-
|
|
2905
|
-
let ct = i.width || a || 100,
|
|
2906
|
-
const
|
|
2907
|
-
if (
|
|
2908
|
-
let
|
|
2909
|
-
return
|
|
2910
|
-
}), i.colors && i.colors.length > 0 && ft.length > 0 && i.colors.forEach((
|
|
2932
|
+
let L = K;
|
|
2933
|
+
L.match(/xmlns=["']http:\/\/www\.w3\.org\/2000\/svg["']/i) || (L = L.replace(/<svg([^>]*)>/i, (rt, It) => `<svg xmlns="http://www.w3.org/2000/svg"${It}>`));
|
|
2934
|
+
let ct = i.width || a || 100, Dt = i.height || r || 100;
|
|
2935
|
+
const At = L.match(/viewBox=["']\s*0\s+0\s+([\d.]+)\s+([\d.]+)\s*["']/i);
|
|
2936
|
+
if (At && (ct = parseFloat(At[1]), Dt = parseFloat(At[2])), L = L.replace(/<svg([^>]*)>/i, (rt, It) => {
|
|
2937
|
+
let vt = It.replace(/\b(?:width|height)=["'][^"']*["']/gi, " ");
|
|
2938
|
+
return vt.match(/\bviewBox=/i) || (vt += ` viewBox="0 0 ${ct} ${Dt}"`), vt.match(/\bpreserveAspectRatio=/i) || (vt += ' preserveAspectRatio="none"'), vt += ' width="100%" height="100%"', `<svg${vt}>`;
|
|
2939
|
+
}), i.colors && i.colors.length > 0 && ft.length > 0 && i.colors.forEach((rt, It) => {
|
|
2911
2940
|
if (ft[It]) {
|
|
2912
|
-
const
|
|
2913
|
-
|
|
2941
|
+
const vt = rt.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"), Ct = new RegExp(vt, "gi");
|
|
2942
|
+
L = L.replace(Ct, ft[It]);
|
|
2914
2943
|
}
|
|
2915
|
-
}),
|
|
2916
|
-
if (
|
|
2917
|
-
const
|
|
2918
|
-
|
|
2919
|
-
} else if (
|
|
2920
|
-
const
|
|
2921
|
-
const
|
|
2922
|
-
return `<stop offset="${
|
|
2944
|
+
}), q && q.type && q.type !== "None") {
|
|
2945
|
+
if (q.type === "Solid" && q.color) {
|
|
2946
|
+
const rt = j ? "#FFFFFF" : q.color, It = j ? 1 : this.normalizeOpacity(q.opacity ?? 100);
|
|
2947
|
+
L = L.replace(/\bfill\s*=\s*["'][^"']*["']/gi, (vt) => /fill\s*=\s*["']\s*(none|transparent)\s*["']/i.test(vt) ? vt : `fill="${rt}"`), L = L.replace(/fill\s*:\s*[^;"')]+/gi, (vt) => /fill\s*:\s*(none|transparent)/i.test(vt) ? vt : `fill:${rt}`), It < 1 && (L = L.replace(/\bfill-opacity\s*=\s*["'][^"']*["']/gi, `fill-opacity="${It}"`), L = L.replace(/fill-opacity\s*:\s*[^;"')]+/gi, `fill-opacity:${It}`), L.match(/\bfill-opacity\s*=/i) || (L = L.replace(/(<svg[^>]*>)/i, `$1<g fill-opacity="${It}">`), L = L.replace(/<\/svg>/i, "</g></svg>")));
|
|
2948
|
+
} else if (q.type === "LinearGradient" || q.type === "RadialGradient" || q.type === "Linear" || q.type === "Radial") {
|
|
2949
|
+
const rt = "exode-fill", It = this.normalizeOpacity(q.opacity ?? 100), vt = (q.stops || []).map((mt) => {
|
|
2950
|
+
const Lt = mt.offset !== void 0 ? mt.offset : mt.pos ?? 0, lt = this.normalizeOpacity(mt.opacity ?? 100) * It;
|
|
2951
|
+
return `<stop offset="${Lt * 100}%" stop-color="${mt.color || "#000"}" stop-opacity="${lt}"/>`;
|
|
2923
2952
|
}).join("");
|
|
2924
|
-
let
|
|
2925
|
-
if (
|
|
2926
|
-
const
|
|
2927
|
-
|
|
2953
|
+
let Ct = "";
|
|
2954
|
+
if (q.type === "LinearGradient" || q.type === "Linear") {
|
|
2955
|
+
const mt = (Mt, V) => Array.isArray(Mt) ? Mt[V] ?? (V === 0 ? 0 : 1) : Mt && typeof Mt == "object" ? Mt[V === 0 ? "x" : "y"] ?? (V === 0 ? 0 : 1) : V === 0 ? 0 : 1, Lt = mt(q.start, 0) * 100, lt = mt(q.start, 1) * 100, st = mt(q.end, 0) * 100, at = mt(q.end, 1) * 100;
|
|
2956
|
+
Ct = `<linearGradient id="${rt}" x1="${Lt}%" y1="${lt}%" x2="${st}%" y2="${at}%" gradientUnits="objectBoundingBox">${vt}</linearGradient>`;
|
|
2928
2957
|
} else {
|
|
2929
|
-
const
|
|
2930
|
-
|
|
2958
|
+
const mt = (at, Mt) => Array.isArray(at) ? at[Mt] ?? 0.5 : at && typeof at == "object" ? at[Mt === 0 ? "x" : "y"] ?? 0.5 : 0.5, Lt = mt(q.center, 0) * 100, lt = mt(q.center, 1) * 100, st = (q.radius ?? 0.5) * 100;
|
|
2959
|
+
Ct = `<radialGradient id="${rt}" cx="${Lt}%" cy="${lt}%" r="${st}%" gradientUnits="objectBoundingBox">${vt}</radialGradient>`;
|
|
2931
2960
|
}
|
|
2932
|
-
/<defs>/i.test(
|
|
2961
|
+
/<defs>/i.test(L) ? L = L.replace(/<defs>/i, `<defs>${Ct}`) : L = L.replace(/<svg([^>]*)>/i, `<svg$1><defs>${Ct}</defs>`), L = L.replace(/\bfill\s*=\s*["'][^"']*["']/gi, (mt) => /fill\s*=\s*["']\s*(none|transparent)\s*["']/i.test(mt) ? mt : `fill="url(#${rt})"`), L = L.replace(/fill\s*:\s*[^;"')]+/gi, (mt) => /fill\s*:\s*(none|transparent)/i.test(mt) ? mt : `fill:url(#${rt})`);
|
|
2933
2962
|
}
|
|
2934
2963
|
}
|
|
2935
|
-
const te = (
|
|
2936
|
-
const
|
|
2937
|
-
const
|
|
2938
|
-
return `<stop offset="${
|
|
2939
|
-
}).join(""),
|
|
2940
|
-
if (
|
|
2941
|
-
const
|
|
2942
|
-
return `<linearGradient id="${It}" x1="${
|
|
2964
|
+
const te = (rt, It, vt = 1) => {
|
|
2965
|
+
const Ct = (rt.stops || []).map((at) => {
|
|
2966
|
+
const Mt = at.offset !== void 0 ? at.offset : at.pos ?? 0, V = this.normalizeOpacity(at.opacity ?? 100) * vt;
|
|
2967
|
+
return `<stop offset="${Mt * 100}%" stop-color="${at.color || "#000"}" stop-opacity="${V}"/>`;
|
|
2968
|
+
}).join(""), mt = (at, Mt, V = 0.5) => Array.isArray(at) ? at[Mt] ?? V : at && typeof at == "object" ? at[Mt === 0 ? "x" : "y"] ?? V : V;
|
|
2969
|
+
if (rt.type === "LinearGradient" || rt.type === "Linear") {
|
|
2970
|
+
const at = mt(rt.start, 0, 0) * 100, Mt = mt(rt.start, 1, 0) * 100, V = mt(rt.end, 0, 1) * 100, ut = mt(rt.end, 1, 1) * 100;
|
|
2971
|
+
return `<linearGradient id="${It}" x1="${at}%" y1="${Mt}%" x2="${V}%" y2="${ut}%" gradientUnits="objectBoundingBox">${Ct}</linearGradient>`;
|
|
2943
2972
|
}
|
|
2944
|
-
const
|
|
2945
|
-
return `<radialGradient id="${It}" cx="${
|
|
2946
|
-
},
|
|
2947
|
-
if (
|
|
2948
|
-
const
|
|
2949
|
-
let
|
|
2950
|
-
const
|
|
2951
|
-
if (
|
|
2952
|
-
if (
|
|
2953
|
-
|
|
2954
|
-
else if (
|
|
2973
|
+
const Lt = mt(rt.center, 0, 0.5) * 100, lt = mt(rt.center, 1, 0.5) * 100, st = (rt.radius ?? 0.5) * 100;
|
|
2974
|
+
return `<radialGradient id="${It}" cx="${Lt}%" cy="${lt}%" r="${st}%" gradientUnits="objectBoundingBox">${Ct}</radialGradient>`;
|
|
2975
|
+
}, Wt = (rt, It) => /<defs>/i.test(rt) ? rt.replace(/<defs>/i, `<defs>${It}`) : rt.replace(/(<svg[^>]*>)/i, `$1<defs>${It}</defs>`);
|
|
2976
|
+
if (X && X.isEnabled !== !1 && (X.width || 0) > 0) {
|
|
2977
|
+
const rt = j ? 1 : this.normalizeOpacity(X.opacity ?? 100), It = j ? "#FFFFFF" : X.color || (q == null ? void 0 : q.color) || "#000000";
|
|
2978
|
+
let vt = "";
|
|
2979
|
+
const Ct = X.fill;
|
|
2980
|
+
if (Ct && Ct.type) {
|
|
2981
|
+
if (Ct.type === "Solid")
|
|
2982
|
+
vt = Ct.color || X.color || "#000000";
|
|
2983
|
+
else if (Ct.type === "LinearGradient" || Ct.type === "RadialGradient" || Ct.type === "Linear" || Ct.type === "Radial") {
|
|
2955
2984
|
const Ht = "exode-stroke";
|
|
2956
|
-
|
|
2985
|
+
L = Wt(L, te(Ct, Ht, rt)), vt = `url(#${Ht})`;
|
|
2957
2986
|
}
|
|
2958
2987
|
}
|
|
2959
|
-
|
|
2988
|
+
vt || (vt = It), L.match(/\bstroke\s*=\s*["']/i) ? L = L.replace(
|
|
2960
2989
|
/\bstroke\s*=\s*["'][^"']*["']/gi,
|
|
2961
|
-
(Ht) => /stroke\s*=\s*["']\s*(none|transparent)\s*["']/i.test(Ht) ? Ht : `stroke="${
|
|
2962
|
-
) :
|
|
2990
|
+
(Ht) => /stroke\s*=\s*["']\s*(none|transparent)\s*["']/i.test(Ht) ? Ht : `stroke="${vt}"`
|
|
2991
|
+
) : L = L.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke="${vt}"`), L = L.replace(
|
|
2963
2992
|
new RegExp(`(?<![a-z-])stroke\\s*:\\s*(?!none|transparent)[^;"')]+`, "gi"),
|
|
2964
|
-
`stroke:${
|
|
2993
|
+
`stroke:${vt}`
|
|
2965
2994
|
);
|
|
2966
|
-
let
|
|
2967
|
-
const
|
|
2968
|
-
if (
|
|
2969
|
-
const Ht = parseFloat(
|
|
2970
|
-
!isNaN(Ht) && !isNaN(se) && (
|
|
2995
|
+
let mt = i.width || a || 100, Lt = i.height || r || 100;
|
|
2996
|
+
const lt = K.match(/viewBox=["']\s*0\s+0\s+([\d.]+)\s+([\d.]+)\s*["']/i);
|
|
2997
|
+
if (lt) {
|
|
2998
|
+
const Ht = parseFloat(lt[1]), se = parseFloat(lt[2]);
|
|
2999
|
+
!isNaN(Ht) && !isNaN(se) && (mt = Ht, Lt = se);
|
|
2971
3000
|
}
|
|
2972
|
-
const st = Math.max(1e-3, a /
|
|
2973
|
-
|
|
2974
|
-
const
|
|
2975
|
-
|
|
2976
|
-
const
|
|
2977
|
-
|
|
2978
|
-
const ce =
|
|
3001
|
+
const st = Math.max(1e-3, a / mt), at = Math.max(1e-3, r / Lt), Mt = (st + at) / 2, V = (X.width || 1) / Mt;
|
|
3002
|
+
L.match(/\bstroke-width\s*=\s*["']/i) ? L = L.replace(/\bstroke-width\s*=\s*["'][^"']*["']/gi, `stroke-width="${V}"`) : L = L.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-width="${V}"`), L = L.replace(/stroke-width\s*:\s*[^;"')]+/gi, `stroke-width:${V}`), L.match(/\bstroke-opacity\s*=\s*["']/i) ? L = L.replace(/\bstroke-opacity\s*=\s*["'][^"']*["']/gi, `stroke-opacity="${rt}"`) : L = L.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-opacity="${rt}"`), L = L.replace(/stroke-opacity\s*:\s*[^;"')]+/gi, `stroke-opacity:${rt}`);
|
|
3003
|
+
const ut = X.lineCap || "round";
|
|
3004
|
+
L.match(/\bstroke-linecap\s*=\s*["']/i) ? L = L.replace(/\bstroke-linecap\s*=\s*["'][^"']*["']/gi, `stroke-linecap="${ut}"`) : L = L.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-linecap="${ut}"`), L = L.replace(/stroke-linecap\s*:\s*[^;"')]+/gi, `stroke-linecap:${ut}`);
|
|
3005
|
+
const gt = X.lineJoin || "round";
|
|
3006
|
+
L.match(/\bstroke-linejoin\s*=\s*["']/i) ? L = L.replace(/\bstroke-linejoin\s*=\s*["'][^"']*["']/gi, `stroke-linejoin="${gt}"`) : L = L.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-linejoin="${gt}"`), L = L.replace(/stroke-linejoin\s*:\s*[^;"')]+/gi, `stroke-linejoin:${gt}`);
|
|
3007
|
+
const ce = X.trimStart ?? 0, me = X.trimEnd ?? 1, Ie = X.trimOffset ?? 0, we = X.dashOffset ?? 0, Te = ce !== 0 || me !== 1 || Ie !== 0 || we !== 0;
|
|
2979
3008
|
if (Te) {
|
|
2980
3009
|
const Ht = Math.max(0, Math.min(1, ce)), se = Math.max(0, Math.min(1, me));
|
|
2981
3010
|
this.frameCount % 600 === 0 && this.debugLog(`SVG Trim - Object: ${s.name || s.id}, Start: ${Ht}, End: ${se}`);
|
|
2982
|
-
const ue = (
|
|
3011
|
+
const ue = (mt + Lt) * 2, Me = (Ie % 1 + 1) % 1, ke = (we % 1 + 1) % 1;
|
|
2983
3012
|
let fe = "", re = 0;
|
|
2984
3013
|
if (Ht >= se)
|
|
2985
3014
|
fe = `0 ${ue}`, re = 0;
|
|
@@ -2987,12 +3016,12 @@ class ci {
|
|
|
2987
3016
|
const le = ue * (se - Ht), ye = ue - le;
|
|
2988
3017
|
re = -(ue * (Ht + Me + ke)), fe = `${le} ${ye}`;
|
|
2989
3018
|
}
|
|
2990
|
-
|
|
2991
|
-
} else if (
|
|
2992
|
-
const Ht =
|
|
2993
|
-
|
|
3019
|
+
L.match(/\bstroke-dasharray\s*=/i) ? L = L.replace(/\bstroke-dasharray\s*=\s*["'][^"']*["']/gi, `stroke-dasharray="${fe}"`) : L = L.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-dasharray="${fe}"`), L = L.replace(/stroke-dasharray\s*:\s*[^;"')]+/gi, `stroke-dasharray:${fe}`), L.match(/\bstroke-dashoffset\s*=/i) ? L = L.replace(/\bstroke-dashoffset\s*=\s*["'][^"']*["']/gi, `stroke-dashoffset="${re}"`) : L = L.replace(/<(path|circle|rect|ellipse|polygon|polyline)/gi, `<$1 stroke-dashoffset="${re}"`), L = L.replace(/stroke-dashoffset\s*:\s*[^;"')]+/gi, `stroke-dashoffset:${re}`);
|
|
3020
|
+
} else if (X.dashArray && X.dashArray.length > 0) {
|
|
3021
|
+
const Ht = X.dashArray.join(" ");
|
|
3022
|
+
L = L.replace(/\bstroke-dasharray\s*=\s*["'][^"']*["']/gi, `stroke-dasharray="${Ht}"`), L = L.replace(/stroke-dasharray\s*:\s*[^;"')]+/gi, `stroke-dasharray:${Ht}`), X.dashOffset && (L = L.replace(/\bstroke-dashoffset\s*=\s*["'][^"']*["']/gi, `stroke-dashoffset="${X.dashOffset}"`), L = L.replace(/stroke-dashoffset\s*:\s*[^;"')]+/gi, `stroke-dashoffset:${X.dashOffset}`));
|
|
2994
3023
|
}
|
|
2995
|
-
if (!/\bstroke\s*=\s*["']/i.test(
|
|
3024
|
+
if (!/\bstroke\s*=\s*["']/i.test(K) && !new RegExp("(?<![a-z-])stroke\\s*:", "i").test(K)) {
|
|
2996
3025
|
let Ht = "", se = "";
|
|
2997
3026
|
if (Te) {
|
|
2998
3027
|
const fe = i.width || a || 100, re = i.height || r || 100, le = (fe + re) * 2, ye = Math.max(0, Math.min(1, ce)), _e = Math.max(0, Math.min(1, me)), Ae = (Ie % 1 + 1) % 1, Oe = (we % 1 + 1) % 1;
|
|
@@ -3002,85 +3031,85 @@ class ci {
|
|
|
3002
3031
|
const Pe = le * (_e - ye), Re = le - Pe, Le = -(le * (ye + Ae + Oe));
|
|
3003
3032
|
Ht = ` stroke-dasharray="${Pe} ${Re}"`, se = ` stroke-dashoffset="${Le}"`;
|
|
3004
3033
|
}
|
|
3005
|
-
} else (
|
|
3006
|
-
const ue = ` stroke-linecap="${
|
|
3007
|
-
|
|
3034
|
+
} else (E = X.dashArray) != null && E.length && (Ht = ` stroke-dasharray="${X.dashArray.join(" ")}"`, X.dashOffset && (se = ` stroke-dashoffset="${X.dashOffset}"`));
|
|
3035
|
+
const ue = ` stroke-linecap="${X.lineCap || "round"}"`, Me = ` stroke-linejoin="${X.lineJoin || "round"}"`, ke = `stroke="${vt}" stroke-width="${V}" stroke-opacity="${rt}"${ue}${Me}${Ht}${se}`;
|
|
3036
|
+
L = L.replace(
|
|
3008
3037
|
/(<svg[^>]*>)(\s*(?:<defs>[\s\S]*?<\/defs>)?)/i,
|
|
3009
3038
|
(fe, re, le) => `${re}${le}<g ${ke}>`
|
|
3010
|
-
),
|
|
3039
|
+
), L = L.replace(/<\/svg>/i, "</g></svg>");
|
|
3011
3040
|
}
|
|
3012
|
-
} else
|
|
3013
|
-
const
|
|
3041
|
+
} else X && X.isEnabled === !1 && (L = L.replace(/\bstroke\s*=\s*["'][^"']*["']/gi, 'stroke="none"'), L = L.replace(new RegExp(`(?<![a-z-])stroke\\s*:\\s*(?!none|transparent)[^;"')]+`, "gi"), "stroke:none"));
|
|
3042
|
+
const Yt = new Blob([L], { type: "image/svg+xml" }), $t = URL.createObjectURL(Yt);
|
|
3014
3043
|
Nt.onload = () => {
|
|
3015
|
-
if (URL.revokeObjectURL(
|
|
3016
|
-
const
|
|
3017
|
-
|
|
3044
|
+
if (URL.revokeObjectURL($t), this.frameCount % 900 === 0) {
|
|
3045
|
+
const rt = this.imageCache.get(Tt);
|
|
3046
|
+
rt && this.debugLog(`SVG Payload Ready: ${s.name || s.id} (${rt.naturalWidth}x${rt.naturalHeight})`);
|
|
3018
3047
|
}
|
|
3019
3048
|
}, Nt.onerror = () => {
|
|
3020
|
-
URL.revokeObjectURL(
|
|
3021
|
-
}, Nt.src =
|
|
3049
|
+
URL.revokeObjectURL($t), this.debugLog(`SVG Error: Failed to load payload for ${s.name || s.id}`);
|
|
3050
|
+
}, Nt.src = $t, this.imageCache.set(Tt, Nt);
|
|
3022
3051
|
}
|
|
3023
|
-
let
|
|
3024
|
-
if (Nt.complete && Nt.naturalWidth > 0 ? (
|
|
3025
|
-
const
|
|
3026
|
-
if (
|
|
3027
|
-
this.maskBuffer || (this.maskBuffer = document.createElement("canvas"), this.maskCtx = this.maskBuffer.getContext("2d")), this.maskBuffer.width =
|
|
3028
|
-
const
|
|
3029
|
-
this.maskCtx.fillStyle =
|
|
3030
|
-
} else h !== 0 ? (t.save(), this.drawRoundRect(t, -
|
|
3052
|
+
let bt = null;
|
|
3053
|
+
if (Nt.complete && Nt.naturalWidth > 0 ? (bt = Nt, this.lastValidSvgImgMap.set(s.id, Nt)) : bt = this.lastValidSvgImgMap.get(s.id) || null, bt && bt.complete && bt.naturalWidth > 0) {
|
|
3054
|
+
const L = Math.max(1, a), ct = Math.max(1, r);
|
|
3055
|
+
if (j && (q == null ? void 0 : q.type) === "Solid") {
|
|
3056
|
+
this.maskBuffer || (this.maskBuffer = document.createElement("canvas"), this.maskCtx = this.maskBuffer.getContext("2d")), this.maskBuffer.width = L, this.maskBuffer.height = ct, this.maskCtx.setTransform(1, 0, 0, 1, 0, 0), this.maskCtx.globalCompositeOperation = "source-over", this.maskCtx.globalAlpha = 1, this.maskCtx.filter = "none", this.maskCtx.clearRect(0, 0, L, ct), this.maskCtx.drawImage(bt, 0, 0, L, ct), this.maskCtx.globalCompositeOperation = "source-in";
|
|
3057
|
+
const Dt = q.color || "#000000", At = this.normalizeOpacity(q.opacity ?? 100);
|
|
3058
|
+
this.maskCtx.fillStyle = Dt, this.maskCtx.globalAlpha = At, this.maskCtx.fillRect(0, 0, L, ct), t.drawImage(this.maskBuffer, -L / 2, -ct / 2, L, ct);
|
|
3059
|
+
} else h !== 0 ? (t.save(), this.drawRoundRect(t, -L / 2, -ct / 2, L, ct, h), t.clip(), t.drawImage(bt, -L / 2, -ct / 2, L, ct), t.restore()) : t.drawImage(bt, -L / 2, -ct / 2, L, ct);
|
|
3031
3060
|
}
|
|
3032
3061
|
}
|
|
3033
3062
|
} else if (c.type === "LineGraph")
|
|
3034
3063
|
this.renderLineGraph(t, c, a, r);
|
|
3035
3064
|
else if (s.type === "Shape") {
|
|
3036
3065
|
if (this.applyPath(t, c, a, r, h), t.save(), n.blur && n.blur.amount > 0 && (t.filter = `blur(${n.blur.amount}px)`), n.fill) {
|
|
3037
|
-
const
|
|
3038
|
-
if (((
|
|
3066
|
+
const K = t.globalAlpha;
|
|
3067
|
+
if (((R = n.fill) == null ? void 0 : R.type) === "Image" && (n.fill.originalSrc || n.fill.src)) {
|
|
3039
3068
|
const ft = n.fill.originalSrc || n.fill.src;
|
|
3040
|
-
let
|
|
3041
|
-
|
|
3069
|
+
let q = this.imageCache.get(ft);
|
|
3070
|
+
q || (q = new Image(), q.src = ft, this.imageCache.set(ft, q)), q.complete && q.naturalWidth > 0 && (t.save(), this.applyPath(t, c, a, r, h), t.clip(), this.renderFittedImage(t, q, -a / 2, -r / 2, a, r, n.fill.fillMode), t.restore());
|
|
3042
3071
|
} else {
|
|
3043
3072
|
const ft = this.createCanvasFill(t, n.fill, a, r);
|
|
3044
|
-
t.fillStyle = ft || (typeof n.fill == "string" ? n.fill : n.fill.color || "transparent"), t.globalAlpha =
|
|
3073
|
+
t.fillStyle = ft || (typeof n.fill == "string" ? n.fill : n.fill.color || "transparent"), t.globalAlpha = K * this.normalizeOpacity(n.fill.opacity ?? 100), this.applyPath(t, c, a, r, h), t.fill();
|
|
3045
3074
|
}
|
|
3046
|
-
t.globalAlpha =
|
|
3075
|
+
t.globalAlpha = K;
|
|
3047
3076
|
}
|
|
3048
3077
|
t.restore(), n.stroke && n.stroke.width > 0 && this.applyStrokeAlignment(t, n, c, a, r, h);
|
|
3049
3078
|
} else if (s.type === "Frame" || s.type === "Group" && !s.isStructuralGroup) {
|
|
3050
|
-
const
|
|
3051
|
-
if (t.save(), t.beginPath(), this.drawRoundRect(t, -
|
|
3052
|
-
const
|
|
3053
|
-
t.fillStyle =
|
|
3079
|
+
const K = e.width ?? i.width ?? s.width ?? a, ft = e.height ?? i.height ?? s.height ?? r, q = h;
|
|
3080
|
+
if (t.save(), t.beginPath(), this.drawRoundRect(t, -K / 2, -ft / 2, K, ft, q), n.fill && n.fill.type !== "None") {
|
|
3081
|
+
const X = t.globalAlpha, Z = this.createCanvasFill(t, n.fill, K, ft);
|
|
3082
|
+
t.fillStyle = Z || n.fill.color || "transparent", t.globalAlpha = X * this.normalizeOpacity(n.fill.opacity ?? 100), t.fill(), t.globalAlpha = X;
|
|
3054
3083
|
}
|
|
3055
3084
|
if (t.restore(), n.stroke && n.stroke.width > 0 && n.stroke.isEnabled !== !1) {
|
|
3056
|
-
const
|
|
3057
|
-
this.applyStrokeAlignment(t, n,
|
|
3085
|
+
const X = { type: "Rectangle" };
|
|
3086
|
+
this.applyStrokeAlignment(t, n, X, K, ft, q);
|
|
3058
3087
|
}
|
|
3059
|
-
} else s.type === "Group" && s.isStructuralGroup || (s.type === "Component" && s.variant === "inputbox" ? this.renderInputBox(t, s) : s.type === "Component" && s.variant === "button" ? this.renderButton(t, s) : s.type === "Component" && s.variant === "toggle_button" ? this.renderToggleButton(t, s) : s.type === "Toggle" || s.type === "Component" && s.variant === "toggle" ? this.renderToggle(t, s) : s.type === "Slider" || s.type === "Component" && s.variant === "slider" ? this.renderSlider(t, s) : s.type === "Dropdown" || s.type === "Component" && s.variant === "dropdown" ? this.renderDropdown(t, s) : s.type === "ListView" || s.type === "Component" && s.variant === "listview" ? this.renderListView(t, s) : s.type === "Checkbox" || s.type === "Component" && s.variant === "checkbox" ? this.renderCheckbox(t, s) : s.type === "RadioGroup" || s.type === "Component" && s.variant === "radiogroup" ? this.renderRadioGroup(t, s) : s.type === "BarChart" || s.type === "Component" && s.variant === "barchart" ? this.renderBarChart(t, s) : s.type === "PieChart" || s.type === "Component" && s.variant === "piechart" ? this.renderPieChart(t, s) : this.frameCount % 60 === 0 && console.warn("[Engine] Unhandled object type in renderObject:", s.type, "Geo:", (
|
|
3060
|
-
if (this.applyArtEffectOverlay(t, s, c, a, r, h), dt &&
|
|
3061
|
-
const ft = s.type === "Frame",
|
|
3062
|
-
if (t.save(),
|
|
3088
|
+
} else s.type === "Group" && s.isStructuralGroup || (s.type === "Component" && s.variant === "inputbox" ? this.renderInputBox(t, s) : s.type === "Component" && s.variant === "button" ? this.renderButton(t, s) : s.type === "Component" && s.variant === "toggle_button" ? this.renderToggleButton(t, s) : s.type === "Toggle" || s.type === "Component" && s.variant === "toggle" ? this.renderToggle(t, s) : s.type === "Slider" || s.type === "Component" && s.variant === "slider" ? this.renderSlider(t, s) : s.type === "Dropdown" || s.type === "Component" && s.variant === "dropdown" ? this.renderDropdown(t, s) : s.type === "ListView" || s.type === "Component" && s.variant === "listview" ? this.renderListView(t, s) : s.type === "Checkbox" || s.type === "Component" && s.variant === "checkbox" ? this.renderCheckbox(t, s) : s.type === "RadioGroup" || s.type === "Component" && s.variant === "radiogroup" ? this.renderRadioGroup(t, s) : s.type === "BarChart" || s.type === "Component" && s.variant === "barchart" ? this.renderBarChart(t, s) : s.type === "PieChart" || s.type === "Component" && s.variant === "piechart" ? this.renderPieChart(t, s) : this.frameCount % 60 === 0 && console.warn("[Engine] Unhandled object type in renderObject:", s.type, "Geo:", (A = s.geometry) == null ? void 0 : A.type));
|
|
3089
|
+
if (this.applyArtEffectOverlay(t, s, c, a, r, h), dt && yt === "BackgroundBlur" && this.applyBackgroundBlurGlass(t, c, a, r, h, it), ee && ee.enabled && t.restore(), s.children && s.children.length > 0) {
|
|
3090
|
+
const ft = s.type === "Frame", q = s.clipsContent !== void 0 ? s.clipsContent : s.clipContent !== void 0 ? s.clipContent : ft;
|
|
3091
|
+
if (t.save(), q) {
|
|
3063
3092
|
t.beginPath();
|
|
3064
|
-
const
|
|
3065
|
-
this.drawRoundRect(t, -
|
|
3093
|
+
const Z = e.width ?? (i == null ? void 0 : i.width) ?? s.width ?? 0, j = e.height ?? (i == null ? void 0 : i.height) ?? s.height ?? 0, Ot = e.cornerRadius ?? (i == null ? void 0 : i.corner_radius) ?? s.cornerRadius ?? 0;
|
|
3094
|
+
this.drawRoundRect(t, -Z / 2, -j / 2, Z, j, Ot), t.clip();
|
|
3066
3095
|
}
|
|
3067
|
-
let
|
|
3068
|
-
for (s.children.forEach((
|
|
3069
|
-
const
|
|
3070
|
-
if (!
|
|
3071
|
-
const
|
|
3072
|
-
if (
|
|
3073
|
-
const
|
|
3074
|
-
this.applyObjectTransform(t,
|
|
3075
|
-
const
|
|
3076
|
-
this.applyPath(t,
|
|
3096
|
+
let X = 0;
|
|
3097
|
+
for (s.children.forEach((Z) => {
|
|
3098
|
+
const j = o.get(Z);
|
|
3099
|
+
if (!j) return;
|
|
3100
|
+
const Ot = this.objectStates.get(Z), Rt = (Ot == null ? void 0 : Ot.geometry) || j.geometry;
|
|
3101
|
+
if (Rt && Rt.isMask && (Ot == null ? void 0 : Ot.visible) !== !1) {
|
|
3102
|
+
const Tt = Rt.width || 0, Nt = Rt.height || 0;
|
|
3103
|
+
this.applyObjectTransform(t, Z);
|
|
3104
|
+
const bt = (Ot == null ? void 0 : Ot.corner_radius) ?? (Rt == null ? void 0 : Rt.corner_radius) ?? 0;
|
|
3105
|
+
this.applyPath(t, Rt, Tt, Nt, bt), t.clip(), X++;
|
|
3077
3106
|
} else
|
|
3078
|
-
this.renderObject(t,
|
|
3079
|
-
});
|
|
3080
|
-
t.restore(),
|
|
3107
|
+
this.renderObject(t, j, o);
|
|
3108
|
+
}); X > 0; )
|
|
3109
|
+
t.restore(), X--;
|
|
3081
3110
|
t.restore();
|
|
3082
3111
|
}
|
|
3083
|
-
if (
|
|
3112
|
+
if (kt) {
|
|
3084
3113
|
this.maskCtx.restore(), (e.masks || (s.maskedBy ? [{
|
|
3085
3114
|
maskId: s.maskedBy,
|
|
3086
3115
|
inverted: s.maskInverted === !0,
|
|
@@ -3088,84 +3117,84 @@ class ci {
|
|
|
3088
3117
|
opacity: s.maskOpacity !== void 0 ? s.maskOpacity / 100 : 1,
|
|
3089
3118
|
feather: s.maskFeather || 0,
|
|
3090
3119
|
isVisible: !0
|
|
3091
|
-
}] : [])).filter((
|
|
3092
|
-
var
|
|
3093
|
-
const
|
|
3094
|
-
if ((
|
|
3095
|
-
(!this.lumaBuffer || this.lumaBuffer.width !== this.maskBuffer.width || this.lumaBuffer.height !== this.maskBuffer.height) && (this.lumaBuffer = document.createElement("canvas"), this.lumaBuffer.width = this.maskBuffer.width, this.lumaBuffer.height = this.maskBuffer.height, this.lumaCtx = this.lumaBuffer.getContext("2d", { willReadFrequently: !0 }), this.lumaCtx && (this.lumaCtx.imageSmoothingEnabled = !0, this.lumaCtx.imageSmoothingQuality = "high")), this.lumaCtx.setTransform(1, 0, 0, 1, 0, 0), this.lumaCtx.globalCompositeOperation = "source-over", this.lumaCtx.globalAlpha = 1, this.lumaCtx.filter = "none", this.lumaCtx.clearRect(0, 0, this.lumaBuffer.width, this.lumaBuffer.height), this.lumaCtx.save(), this.rootTransform && this.lumaCtx.setTransform(this.rootTransform), this.applyAbsoluteTransform(this.lumaCtx,
|
|
3096
|
-
const
|
|
3097
|
-
if (((
|
|
3098
|
-
const
|
|
3099
|
-
this._renderText(this.lumaCtx,
|
|
3100
|
-
} else if (((
|
|
3101
|
-
const
|
|
3102
|
-
if (
|
|
3103
|
-
let
|
|
3104
|
-
|
|
3120
|
+
}] : [])).filter((X) => X.isVisible !== !1 && o.has(X.maskId)).forEach((X) => {
|
|
3121
|
+
var bt, L, ct, Dt, At, te;
|
|
3122
|
+
const Z = o.get(X.maskId), j = this.objectStates.get(Z.id), Ot = X.feather || 0, Rt = X.inverted === !0, Tt = X.opacity !== void 0 ? typeof X.opacity == "number" ? X.opacity : X.opacity / 100 : 1;
|
|
3123
|
+
if ((X.type || "alpha") === "luma") {
|
|
3124
|
+
(!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, Z.id, o), Ot > 0 && (this.lumaCtx.filter = `blur(${Ot}px)`), this.lumaCtx.globalAlpha = Tt;
|
|
3125
|
+
const Wt = (j == null ? void 0 : j.width) || Z.geometry.width || 0, Yt = (j == null ? void 0 : j.height) || Z.geometry.height || 0, $t = (j == null ? void 0 : j.corner_radius) ?? Z.corner_radius ?? 0;
|
|
3126
|
+
if (((bt = Z.geometry) == null ? void 0 : bt.type) === "Text") {
|
|
3127
|
+
const Ct = j != null && j.geometry ? this.deepMerge(Z.geometry, j.geometry) : Z.geometry, mt = j != null && j.style ? this.deepMerge(Z.style, j.style) : Z.style;
|
|
3128
|
+
this._renderText(this.lumaCtx, Z, { ...Ct, width: Wt, height: Yt, corner_radius: $t }, mt, j, Wt, Yt, !0);
|
|
3129
|
+
} else if (((L = Z.geometry) == null ? void 0 : L.type) === "Image") {
|
|
3130
|
+
const Ct = Z.geometry.src;
|
|
3131
|
+
if (Ct) {
|
|
3132
|
+
let mt = this.imageCache.get(Ct);
|
|
3133
|
+
mt || (mt = new Image(), mt.src = Ct, this.imageCache.set(Ct, mt)), mt.complete && mt.naturalWidth > 0 ? this.lumaCtx.drawImage(mt, -Wt / 2, -Yt / 2, Wt, Yt) : (this.applyPath(this.lumaCtx, Z.geometry, Wt, Yt, $t), this.lumaCtx.fillStyle = "#ffffff", this.lumaCtx.fill());
|
|
3105
3134
|
}
|
|
3106
|
-
} else if (((ct =
|
|
3107
|
-
const
|
|
3108
|
-
if (
|
|
3109
|
-
const
|
|
3110
|
-
let
|
|
3111
|
-
if (!
|
|
3112
|
-
|
|
3113
|
-
const
|
|
3114
|
-
|
|
3135
|
+
} else if (((ct = Z.geometry) == null ? void 0 : ct.type) === "SVG") {
|
|
3136
|
+
const Ct = Z.geometry.svgContent;
|
|
3137
|
+
if (Ct) {
|
|
3138
|
+
const mt = `__lumamask_${Z.id}`;
|
|
3139
|
+
let Lt = this.imageCache.get(mt);
|
|
3140
|
+
if (!Lt) {
|
|
3141
|
+
Lt = new Image();
|
|
3142
|
+
const lt = new Blob([Ct], { type: "image/svg+xml" });
|
|
3143
|
+
Lt.src = URL.createObjectURL(lt), Lt.onload = () => {
|
|
3115
3144
|
this.artboard && this.reset();
|
|
3116
|
-
}, this.imageCache.set(
|
|
3145
|
+
}, this.imageCache.set(mt, Lt);
|
|
3117
3146
|
}
|
|
3118
|
-
|
|
3147
|
+
Lt.complete && Lt.naturalWidth > 0 ? this.lumaCtx.drawImage(Lt, -Wt / 2, -Yt / 2, Wt, Yt) : (this.applyPath(this.lumaCtx, Z.geometry, Wt, Yt, $t), this.lumaCtx.fillStyle = "#ffffff", this.lumaCtx.fill());
|
|
3119
3148
|
}
|
|
3120
3149
|
} else
|
|
3121
|
-
this.applyPath(this.lumaCtx,
|
|
3150
|
+
this.applyPath(this.lumaCtx, Z.geometry, Wt, Yt, $t), this.lumaCtx.fillStyle = "#ffffff", this.lumaCtx.fill();
|
|
3122
3151
|
this.lumaCtx.restore();
|
|
3123
|
-
const
|
|
3124
|
-
for (let
|
|
3125
|
-
const
|
|
3126
|
-
let st = (0.299 *
|
|
3127
|
-
|
|
3152
|
+
const rt = this.maskCtx.getImageData(0, 0, this.canvasWidth, this.canvasHeight), It = this.lumaCtx.getImageData(0, 0, this.canvasWidth, this.canvasHeight).data, vt = rt.data;
|
|
3153
|
+
for (let Ct = 0; Ct < vt.length; Ct += 4) {
|
|
3154
|
+
const mt = It[Ct], Lt = It[Ct + 1], lt = It[Ct + 2];
|
|
3155
|
+
let st = (0.299 * mt + 0.587 * Lt + 0.114 * lt) / 255;
|
|
3156
|
+
Rt && (st = 1 - st), vt[Ct + 3] *= st;
|
|
3128
3157
|
}
|
|
3129
|
-
this.maskCtx.putImageData(
|
|
3158
|
+
this.maskCtx.putImageData(rt, 0, 0);
|
|
3130
3159
|
} else {
|
|
3131
|
-
this.maskCtx.save(), this.rootTransform && this.maskCtx.setTransform(this.rootTransform), this.maskCtx.globalCompositeOperation =
|
|
3132
|
-
const
|
|
3133
|
-
if (((
|
|
3134
|
-
const
|
|
3135
|
-
this._renderText(this.maskCtx,
|
|
3136
|
-
} else if (((
|
|
3137
|
-
const
|
|
3138
|
-
if (
|
|
3139
|
-
let It = this.imageCache.get(
|
|
3140
|
-
It || (It = new Image(), It.src =
|
|
3160
|
+
this.maskCtx.save(), this.rootTransform && this.maskCtx.setTransform(this.rootTransform), this.maskCtx.globalCompositeOperation = Rt ? "destination-out" : "destination-in", Ot > 0 && (this.maskCtx.filter = `blur(${Ot}px)`), this.maskCtx.globalAlpha = Tt, this.applyAbsoluteTransform(this.maskCtx, Z.id, o);
|
|
3161
|
+
const Wt = (j == null ? void 0 : j.width) || Z.geometry.width || 0, Yt = (j == null ? void 0 : j.height) || Z.geometry.height || 0, $t = (j == null ? void 0 : j.corner_radius) ?? Z.corner_radius ?? 0;
|
|
3162
|
+
if (((Dt = Z.geometry) == null ? void 0 : Dt.type) === "Text") {
|
|
3163
|
+
const rt = j != null && j.geometry ? this.deepMerge(Z.geometry, j.geometry) : Z.geometry, It = j != null && j.style ? this.deepMerge(Z.style, j.style) : Z.style;
|
|
3164
|
+
this._renderText(this.maskCtx, Z, { ...rt, width: Wt, height: Yt, corner_radius: $t }, It, j, Wt, Yt, !0);
|
|
3165
|
+
} else if (((At = Z.geometry) == null ? void 0 : At.type) === "Image") {
|
|
3166
|
+
const rt = Z.geometry.src;
|
|
3167
|
+
if (rt) {
|
|
3168
|
+
let It = this.imageCache.get(rt);
|
|
3169
|
+
It || (It = new Image(), It.src = rt, this.imageCache.set(rt, It)), It.complete && It.naturalWidth > 0 ? this.maskCtx.drawImage(It, -Wt / 2, -Yt / 2, Wt, Yt) : (this.applyPath(this.maskCtx, Z.geometry, Wt, Yt, $t), this.maskCtx.fillStyle = "#ffffff", this.maskCtx.fill());
|
|
3141
3170
|
}
|
|
3142
|
-
} else if (((te =
|
|
3143
|
-
const
|
|
3144
|
-
if (
|
|
3145
|
-
const It = `__alphamask_${
|
|
3146
|
-
let
|
|
3147
|
-
if (!
|
|
3148
|
-
|
|
3149
|
-
const
|
|
3150
|
-
|
|
3171
|
+
} else if (((te = Z.geometry) == null ? void 0 : te.type) === "SVG") {
|
|
3172
|
+
const rt = Z.geometry.svgContent;
|
|
3173
|
+
if (rt) {
|
|
3174
|
+
const It = `__alphamask_${Z.id}`;
|
|
3175
|
+
let vt = this.imageCache.get(It);
|
|
3176
|
+
if (!vt) {
|
|
3177
|
+
vt = new Image();
|
|
3178
|
+
const Ct = new Blob([rt], { type: "image/svg+xml" });
|
|
3179
|
+
vt.src = URL.createObjectURL(Ct), vt.onload = () => {
|
|
3151
3180
|
this.artboard && this.reset();
|
|
3152
|
-
}, this.imageCache.set(It,
|
|
3181
|
+
}, this.imageCache.set(It, vt);
|
|
3153
3182
|
}
|
|
3154
|
-
|
|
3183
|
+
vt.complete && vt.naturalWidth > 0 ? this.maskCtx.drawImage(vt, -Wt / 2, -Yt / 2, Wt, Yt) : (this.applyPath(this.maskCtx, Z.geometry, Wt, Yt, $t), this.maskCtx.fillStyle = "#ffffff", this.maskCtx.fill());
|
|
3155
3184
|
}
|
|
3156
3185
|
} else
|
|
3157
|
-
this.applyPath(this.maskCtx,
|
|
3186
|
+
this.applyPath(this.maskCtx, Z.geometry, Wt, Yt, $t), this.maskCtx.fillStyle = "#ffffff", this.maskCtx.fill();
|
|
3158
3187
|
this.maskCtx.restore();
|
|
3159
3188
|
}
|
|
3160
|
-
}),
|
|
3161
|
-
const
|
|
3162
|
-
|
|
3189
|
+
}), nt.save(), nt.setTransform(1, 0, 0, 1, 0, 0);
|
|
3190
|
+
const q = s.maskBlendMode || s.blendMode;
|
|
3191
|
+
q && q !== "Normal" && (nt.globalCompositeOperation = q.toLowerCase()), nt.drawImage(this.maskBuffer, 0, 0), nt.restore(), nt.restore();
|
|
3163
3192
|
} else
|
|
3164
3193
|
t.restore();
|
|
3165
3194
|
}
|
|
3166
3195
|
}
|
|
3167
3196
|
_renderText(t, s, o, e, i, n, a, r = !1, l = !1) {
|
|
3168
|
-
var
|
|
3197
|
+
var yt, ht, pt, ot, Et, Ft, wt, Xt, Bt;
|
|
3169
3198
|
let h = o.text || "";
|
|
3170
3199
|
if (o.textInputId && !r) {
|
|
3171
3200
|
const B = this.inputs.get(o.textInputId);
|
|
@@ -3174,24 +3203,24 @@ class ci {
|
|
|
3174
3203
|
if (o.svgPath) {
|
|
3175
3204
|
const B = o.svgPath;
|
|
3176
3205
|
t.save();
|
|
3177
|
-
const
|
|
3178
|
-
t.fillStyle =
|
|
3179
|
-
const
|
|
3180
|
-
t.fill(
|
|
3206
|
+
const nt = ((yt = e == null ? void 0 : e.fill) == null ? void 0 : yt.color) || "#000000", zt = ((ht = e == null ? void 0 : e.fill) == null ? void 0 : ht.opacity) !== void 0 ? (pt = e == null ? void 0 : e.fill) == null ? void 0 : pt.opacity : 1;
|
|
3207
|
+
t.fillStyle = nt, t.globalAlpha *= zt;
|
|
3208
|
+
const kt = new Path2D(B);
|
|
3209
|
+
t.fill(kt), t.restore();
|
|
3181
3210
|
return;
|
|
3182
3211
|
}
|
|
3183
3212
|
let c = h || "";
|
|
3184
3213
|
o.enableSegments === !0 && o.segments && Array.isArray(o.segments) && (c = o.segments.map((B) => B && B.text ? B.text : "").join(""));
|
|
3185
3214
|
const g = o.textCase || "none";
|
|
3186
3215
|
g === "uppercase" ? c = c.toUpperCase() : g === "lowercase" ? c = c.toLowerCase() : g === "capitalize" && (c = c.replace(/\b\w/g, (B) => B.toUpperCase()));
|
|
3187
|
-
let f = ((
|
|
3216
|
+
let f = ((ot = o.fontWeight) == null ? void 0 : ot.toString()) || "400", d = o.fontStyle || "normal";
|
|
3188
3217
|
f.toLowerCase().includes("italic") && (d = "italic", f = f.replace(/italic/gi, "").trim() || "400");
|
|
3189
3218
|
const u = this.mapFontWeight(f), m = Math.max(1, o.fontSize || 32);
|
|
3190
3219
|
let y = o.fontFamily || "Inter";
|
|
3191
3220
|
const v = ["Bold", "SemiBold", "Medium", "Regular", "Light", "Thin", "ExtraBold", "Black", "Italic"];
|
|
3192
3221
|
v.forEach((B) => {
|
|
3193
|
-
const
|
|
3194
|
-
|
|
3222
|
+
const nt = new RegExp(`[\\s-]${B}$`, "i");
|
|
3223
|
+
nt.test(y) && (y = y.replace(nt, "").trim());
|
|
3195
3224
|
});
|
|
3196
3225
|
const S = `${o.smallCaps === !0 ? "small-caps " : ""}${d} ${u} ${m}px "${y}", sans-serif`;
|
|
3197
3226
|
t.font = S;
|
|
@@ -3207,23 +3236,23 @@ class ci {
|
|
|
3207
3236
|
M = B.unit === "PERCENT" ? B.value / 100 * m : B.value;
|
|
3208
3237
|
}
|
|
3209
3238
|
t.letterSpacing !== void 0 && (t.letterSpacing = `${M}px`);
|
|
3210
|
-
const
|
|
3211
|
-
|
|
3212
|
-
const
|
|
3239
|
+
const _ = o.kerning || "auto", T = o.kerningValue || 0;
|
|
3240
|
+
_ === "manual" && T !== 0 && (t.letterSpacing = `${M + T}px`);
|
|
3241
|
+
const $ = o.paragraphSpacing || 0;
|
|
3213
3242
|
let k = o.lineHeight ?? 1.2;
|
|
3214
3243
|
typeof k == "string" && (k = parseFloat(k)), k > 5 && m > 0 && (k = k / m);
|
|
3215
|
-
const
|
|
3244
|
+
const E = (k || 1.2) * m, R = o.isPointText === !0 || !o.width || o.width <= 0, A = ((Et = o.padding) == null ? void 0 : Et.left) || ((Ft = o.padding) == null ? void 0 : Ft.right) || 0, O = R ? 1e5 : o.width && o.width > 0 ? Math.ceil(o.width) - A * 2 : 1e5;
|
|
3216
3245
|
o.autoHeight;
|
|
3217
|
-
const
|
|
3246
|
+
const W = ps({
|
|
3218
3247
|
text: c,
|
|
3219
3248
|
fontFamily: y,
|
|
3220
3249
|
fontSize: m,
|
|
3221
3250
|
fontWeight: u,
|
|
3222
3251
|
fontStyle: d,
|
|
3223
3252
|
lineHeight: k,
|
|
3224
|
-
width:
|
|
3253
|
+
width: O,
|
|
3225
3254
|
letterSpacing: M,
|
|
3226
|
-
paragraphSpacing:
|
|
3255
|
+
paragraphSpacing: $,
|
|
3227
3256
|
paragraphIndent: o.paragraphIndent || 0,
|
|
3228
3257
|
segments: o.segments,
|
|
3229
3258
|
enableSegments: o.enableSegments,
|
|
@@ -3231,25 +3260,25 @@ class ci {
|
|
|
3231
3260
|
hyphenation: o.hyphenation,
|
|
3232
3261
|
composer: o.composer,
|
|
3233
3262
|
balanceRaggedLines: o.balanceRaggedLines
|
|
3234
|
-
}),
|
|
3235
|
-
let
|
|
3236
|
-
a > 0 && a >
|
|
3237
|
-
let
|
|
3263
|
+
}), x = W.lines || [], Y = W.maxFontSize || m, H = this.fontLeadingFactors[y] ?? 0.5, Q = (E - m) * H;
|
|
3264
|
+
let P = W.height, F = -P / 2;
|
|
3265
|
+
a > 0 && a > P && (I === "top" ? F = -a / 2 : I === "middle" || I === "center" ? F = -P / 2 : I === "bottom" && (F = a / 2 - P)), F += Q;
|
|
3266
|
+
let U = null, J = 0;
|
|
3238
3267
|
if (o.pathId && this.artboard) {
|
|
3239
|
-
const B = this.artboard.objects.find((
|
|
3240
|
-
if (B && B.type === "Shape" && ((
|
|
3241
|
-
const
|
|
3242
|
-
|
|
3268
|
+
const B = this.artboard.objects.find((nt) => nt.id === o.pathId);
|
|
3269
|
+
if (B && B.type === "Shape" && ((wt = B.geometry) == null ? void 0 : wt.type) === "Path") {
|
|
3270
|
+
const nt = this.objectStates.get(B.id), zt = nt != null && nt.geometry ? this.deepMerge(B.geometry, nt.geometry) : B.geometry, kt = (nt == null ? void 0 : nt.scale_x) !== void 0 ? (B.width || 0) * nt.scale_x : B.width || 0, _t = (nt == null ? void 0 : nt.scale_y) !== void 0 ? (B.height || 0) * nt.scale_y : B.height || 0;
|
|
3271
|
+
U = { geo: zt, obj: B, w: kt, h: _t }, J = this.getPerimeter(zt, kt, _t);
|
|
3243
3272
|
}
|
|
3244
3273
|
}
|
|
3245
|
-
const it = (B,
|
|
3246
|
-
var
|
|
3247
|
-
if (M === 0 && (!o.enableSegments || !((
|
|
3248
|
-
let
|
|
3249
|
-
for (let
|
|
3250
|
-
const Ut =
|
|
3274
|
+
const it = (B, nt) => {
|
|
3275
|
+
var kt, _t;
|
|
3276
|
+
if (M === 0 && (!o.enableSegments || !((kt = o.segments) != null && kt.length))) return t.measureText(B).width;
|
|
3277
|
+
let zt = 0;
|
|
3278
|
+
for (let Vt = 0; Vt < B.length; Vt++) {
|
|
3279
|
+
const Ut = nt + Vt;
|
|
3251
3280
|
let Jt = 0;
|
|
3252
|
-
if (o.enableSegments === !0 && ((
|
|
3281
|
+
if (o.enableSegments === !0 && ((_t = o.segments) == null ? void 0 : _t.length) > 0) {
|
|
3253
3282
|
let qt = 0, Qt = null;
|
|
3254
3283
|
for (const oe of o.segments) {
|
|
3255
3284
|
if (Ut < qt + (oe.text || "").length) {
|
|
@@ -3261,291 +3290,291 @@ class ci {
|
|
|
3261
3290
|
if (Qt) {
|
|
3262
3291
|
t.save();
|
|
3263
3292
|
let oe = Qt.fontFamily || o.fontFamily || "Inter";
|
|
3264
|
-
const jt = this.mapFontWeight((Qt.fontWeight || o.fontWeight || "400").toString()), ee = Qt.fontStyle || d,
|
|
3265
|
-
t.font = `${ee} ${jt} ${
|
|
3293
|
+
const jt = this.mapFontWeight((Qt.fontWeight || o.fontWeight || "400").toString()), ee = Qt.fontStyle || d, K = Qt.fontSize || m;
|
|
3294
|
+
t.font = `${ee} ${jt} ${K}px "${oe}", sans-serif`, Jt = t.measureText(B[Vt]).width, t.restore();
|
|
3266
3295
|
} else
|
|
3267
|
-
Jt = t.measureText(B[
|
|
3296
|
+
Jt = t.measureText(B[Vt]).width;
|
|
3268
3297
|
} else
|
|
3269
|
-
Jt = t.measureText(B[
|
|
3270
|
-
|
|
3298
|
+
Jt = t.measureText(B[Vt]).width;
|
|
3299
|
+
zt += Jt + M;
|
|
3271
3300
|
}
|
|
3272
|
-
return
|
|
3273
|
-
}, dt = (B,
|
|
3301
|
+
return zt - (B.length > 0 ? M : 0);
|
|
3302
|
+
}, dt = (B, nt, zt, kt, _t) => {
|
|
3274
3303
|
var jt, ee;
|
|
3275
|
-
const Ut = (
|
|
3276
|
-
` || c[
|
|
3277
|
-
(
|
|
3278
|
-
), qt = !o.pathId && !Jt && (o.enableSegments !== !0 || !o.segments || o.segments.length === 0), Qt = o.baselineShift || 0, oe =
|
|
3304
|
+
const Ut = (_t === 0 || c[_t - 1] === `
|
|
3305
|
+
` || c[_t - 1] === "\r") && o.paragraphIndent ? o.paragraphIndent : 0, Jt = (!r || l) && (s.behaviors || []).some(
|
|
3306
|
+
(K) => K.enabled && (K.type.toString().includes("Text") || ["Typewriter", "Scramble", "Wave", "Bounce", "GlitchText", "Reveal3D", "RevealSlide", "RevealBlur"].includes(K.type))
|
|
3307
|
+
), qt = !o.pathId && !Jt && (o.enableSegments !== !0 || !o.segments || o.segments.length === 0), Qt = o.baselineShift || 0, oe = zt + Qt;
|
|
3279
3308
|
if (qt)
|
|
3280
|
-
t.font = S,
|
|
3309
|
+
t.font = S, kt ? t.strokeText(B, nt + Ut, oe) : t.fillText(B, nt + Ut, oe);
|
|
3281
3310
|
else {
|
|
3282
|
-
const
|
|
3283
|
-
let ft =
|
|
3284
|
-
w === "center" ? ft -=
|
|
3285
|
-
const
|
|
3286
|
-
` || c[
|
|
3287
|
-
let
|
|
3288
|
-
const
|
|
3289
|
-
if (w === "justify" && !
|
|
3290
|
-
const
|
|
3311
|
+
const K = it(B, _t);
|
|
3312
|
+
let ft = nt + Ut;
|
|
3313
|
+
w === "center" ? ft -= K / 2 : w === "right" && (ft -= K);
|
|
3314
|
+
const q = _t + B.length >= c.length || c[_t + B.length] === `
|
|
3315
|
+
` || c[_t + B.length] === "\r";
|
|
3316
|
+
let X = 0, Z = 0;
|
|
3317
|
+
const j = o.justifyMinWordSpacing, Ot = o.justifyMaxWordSpacing;
|
|
3318
|
+
if (w === "justify" && !q && K > 0 && !o.pathId) {
|
|
3319
|
+
const bt = R ? K : O - A * 2 + 0, L = Math.max(0, bt - K);
|
|
3291
3320
|
for (let ct = 0; ct < B.length; ct++)
|
|
3292
|
-
B[ct] === " " &&
|
|
3293
|
-
if (
|
|
3321
|
+
B[ct] === " " && Z++;
|
|
3322
|
+
if (Z > 0) {
|
|
3294
3323
|
const ct = t.measureText(" ").width;
|
|
3295
|
-
let
|
|
3296
|
-
|
|
3324
|
+
let Dt = j || ct * 0.5, At = Ot || ct * 2.5;
|
|
3325
|
+
X = Math.max(0, Math.min(L / Z, At - Dt));
|
|
3297
3326
|
}
|
|
3298
3327
|
}
|
|
3299
|
-
let
|
|
3300
|
-
o.pathId &&
|
|
3301
|
-
let
|
|
3328
|
+
let Rt = o.pathOffset || 0;
|
|
3329
|
+
o.pathId && J > 0 && U && (w === "center" ? Rt += J / 2 - K / 2 : w === "right" && (Rt += J - K));
|
|
3330
|
+
let Tt = ft;
|
|
3302
3331
|
const Nt = r && !l ? [] : ((jt = s.behaviors) == null ? void 0 : jt.filter(
|
|
3303
|
-
(
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
].includes(
|
|
3332
|
+
(bt) => [
|
|
3333
|
+
G.Typewriter,
|
|
3334
|
+
G.Scramble,
|
|
3335
|
+
G.Wave,
|
|
3336
|
+
G.Bounce,
|
|
3337
|
+
G.GlitchText,
|
|
3338
|
+
G.TextTrail,
|
|
3339
|
+
G.Reveal3D,
|
|
3340
|
+
G.RevealSlide,
|
|
3341
|
+
G.RevealBlur,
|
|
3342
|
+
G.TextLiquid,
|
|
3343
|
+
G.TextVortex,
|
|
3344
|
+
G.TextExplosion,
|
|
3345
|
+
G.TextRain,
|
|
3346
|
+
G.TextGravity,
|
|
3347
|
+
G.TextElastic,
|
|
3348
|
+
G.TextMatrix,
|
|
3349
|
+
G.TextNeon,
|
|
3350
|
+
G.TextGlitch3D,
|
|
3351
|
+
G.TextDissolve,
|
|
3352
|
+
G.TextOrganic,
|
|
3353
|
+
G.TextBreathe,
|
|
3354
|
+
G.TextFloral,
|
|
3355
|
+
G.TextSmoke,
|
|
3356
|
+
G.TextVariable,
|
|
3357
|
+
G.TextMagnet,
|
|
3358
|
+
G.TextSpin,
|
|
3359
|
+
G.TextZing,
|
|
3360
|
+
G.TextPerspective,
|
|
3361
|
+
G.TextMirror
|
|
3362
|
+
].includes(bt.type) && bt.enabled
|
|
3334
3363
|
)) || [];
|
|
3335
|
-
for (let
|
|
3336
|
-
let
|
|
3337
|
-
const ct =
|
|
3338
|
-
let
|
|
3339
|
-
Nt.forEach((
|
|
3340
|
-
const st =
|
|
3341
|
-
if (
|
|
3342
|
-
this.currentTime * (st.speed || 1) - ct * (st.stagger || 0.05) < 0 && (
|
|
3343
|
-
else if (
|
|
3344
|
-
Math.max(0, Math.min(1, this.currentTime / (st.duration || 1.5)) - ct * 0.02) < 1 && Math.random() < 0.3 && (
|
|
3345
|
-
else if (
|
|
3346
|
-
|
|
3347
|
-
else if (
|
|
3364
|
+
for (let bt = 0; bt < B.length; bt++) {
|
|
3365
|
+
let L = B[bt];
|
|
3366
|
+
const ct = _t + bt;
|
|
3367
|
+
let Dt = 0, At = 0, te = 1, Wt = 1, Yt = 0, $t = 1, rt = L;
|
|
3368
|
+
Nt.forEach((lt) => {
|
|
3369
|
+
const st = lt.settings || {}, at = st.strength || 1, Mt = Date.now();
|
|
3370
|
+
if (lt.type === G.Typewriter)
|
|
3371
|
+
this.currentTime * (st.speed || 1) - ct * (st.stagger || 0.05) < 0 && ($t = 0);
|
|
3372
|
+
else if (lt.type === G.Scramble)
|
|
3373
|
+
Math.max(0, Math.min(1, this.currentTime / (st.duration || 1.5)) - ct * 0.02) < 1 && Math.random() < 0.3 && (rt = "$%#@!*&"[Math.floor(Math.random() * 7)]);
|
|
3374
|
+
else if (lt.type === G.Wave)
|
|
3375
|
+
At += Math.sin(this.currentTime * 5 * (st.speed || 1) + ct * (st.frequency || 1)) * (st.amplitude || 20) * at;
|
|
3376
|
+
else if (lt.type === G.Bounce) {
|
|
3348
3377
|
const V = Math.max(0, this.currentTime % 2 - ct * (st.stagger || 0.1));
|
|
3349
|
-
V < 1 && (
|
|
3350
|
-
} else if (
|
|
3378
|
+
V < 1 && (At -= Math.abs(Math.sin(V * Math.PI)) * (st.height || 50) * at);
|
|
3379
|
+
} else if (lt.type === G.TextTrail) {
|
|
3351
3380
|
const V = this.pointerHistory[Math.max(0, this.pointerHistory.length - 1 - ct * (st.delay || 5))];
|
|
3352
|
-
V && (
|
|
3353
|
-
} else if (
|
|
3381
|
+
V && (Dt += (V.x - (i.x + Tt)) * at * 0.2, At += (V.y - (i.y + zt + At)) * at * 0.2);
|
|
3382
|
+
} else if (lt.type === G.Reveal3D) {
|
|
3354
3383
|
const V = Math.max(0, Math.min(1, this.currentTime * (st.speed || 1) - ct * (st.stagger || 0.1)));
|
|
3355
|
-
te *= V,
|
|
3356
|
-
} else if (
|
|
3357
|
-
const V = Math.max(0, Math.min(1, this.currentTime * 1.5 - ct * 0.05)),
|
|
3358
|
-
|
|
3359
|
-
} else if (
|
|
3384
|
+
te *= V, Wt *= V, $t = V;
|
|
3385
|
+
} else if (lt.type === G.RevealSlide) {
|
|
3386
|
+
const V = Math.max(0, Math.min(1, this.currentTime * 1.5 - ct * 0.05)), ut = (1 - V) * (st.distance || 40) * at, gt = st.direction || "up";
|
|
3387
|
+
gt === "up" ? At -= ut : gt === "down" ? At += ut : gt === "left" ? Dt -= ut : gt === "right" && (Dt += ut), $t = V;
|
|
3388
|
+
} else if (lt.type === G.RevealBlur) {
|
|
3360
3389
|
const V = Math.max(0, Math.min(1, this.currentTime * 1.2 - ct * 0.1));
|
|
3361
|
-
|
|
3362
|
-
} else if (
|
|
3363
|
-
const V = Math.max(0, Math.sin(
|
|
3364
|
-
|
|
3365
|
-
} else if (
|
|
3366
|
-
const V =
|
|
3367
|
-
|
|
3368
|
-
} else if (
|
|
3369
|
-
const V = st.force || 1,
|
|
3370
|
-
if (
|
|
3371
|
-
const
|
|
3372
|
-
|
|
3390
|
+
$t = V, Dt += (1 - V) * 5;
|
|
3391
|
+
} else if (lt.type === G.TextLiquid) {
|
|
3392
|
+
const V = Math.max(0, Math.sin(Mt * 1e-3 * (st.speed || 1) + ct * 0.5));
|
|
3393
|
+
At += V * (st.amplitude || 10) * at, Wt *= 1 + V * 0.2;
|
|
3394
|
+
} else if (lt.type === G.TextVortex) {
|
|
3395
|
+
const V = Mt * 2e-3 * (st.speed || 1) + ct * 0.2, ut = (1 - (Math.sin(Mt * 1e-3) * 0.5 + 0.5)) * (st.radius || 50);
|
|
3396
|
+
Dt += Math.cos(V) * ut * at, At += Math.sin(V) * ut * at;
|
|
3397
|
+
} else if (lt.type === G.TextExplosion) {
|
|
3398
|
+
const V = st.force || 1, ut = this.currentTime % 2;
|
|
3399
|
+
if (ut < 1) {
|
|
3400
|
+
const gt = (ct / B.length - 0.5) * Math.PI * 2, ce = ut * 100 * V;
|
|
3401
|
+
Dt += Math.cos(gt) * ce * at, At += Math.sin(gt) * ce * at, $t = 1 - ut;
|
|
3373
3402
|
}
|
|
3374
|
-
} else if (
|
|
3375
|
-
const V = st.speed || 1,
|
|
3376
|
-
|
|
3377
|
-
} else if (
|
|
3378
|
-
const V = st.gravity || 9.8,
|
|
3379
|
-
|
|
3380
|
-
} else if (
|
|
3403
|
+
} else if (lt.type === G.TextRain) {
|
|
3404
|
+
const V = st.speed || 1, ut = st.height || 100, gt = (Mt * 1e-3 * V + ct * 0.1) % 1;
|
|
3405
|
+
At -= (1 - gt) * ut * at, $t = gt > 0.1 ? 1 : gt * 10;
|
|
3406
|
+
} else if (lt.type === G.TextGravity) {
|
|
3407
|
+
const V = st.gravity || 9.8, ut = this.currentTime % 3 / 3, gt = 0.5 * V * Math.pow(ut * 10, 2);
|
|
3408
|
+
gt < 100 ? At += gt * at : At += 100 * at;
|
|
3409
|
+
} else if (lt.type === G.TextMatrix) {
|
|
3381
3410
|
const V = st.speed || 1;
|
|
3382
3411
|
if (Math.random() < 0.1 * V) {
|
|
3383
|
-
const
|
|
3384
|
-
|
|
3412
|
+
const gt = "0123456789ABCDEF!@#$%^&*";
|
|
3413
|
+
rt = gt[Math.floor(Math.random() * gt.length)];
|
|
3385
3414
|
}
|
|
3386
|
-
|
|
3387
|
-
} else if (
|
|
3415
|
+
$t = 0.3 + (Math.sin(Mt * 0.01 * V + ct) + 1) / 2 * 0.7;
|
|
3416
|
+
} else if (lt.type === G.TextNeon) {
|
|
3388
3417
|
const V = Math.random() > 0.95 ? 0.5 : 1;
|
|
3389
|
-
|
|
3390
|
-
} else if (
|
|
3391
|
-
Math.sin(ct * 1.5 +
|
|
3392
|
-
else if (
|
|
3393
|
-
const V = st.speed || 1,
|
|
3394
|
-
|
|
3395
|
-
} else if (
|
|
3396
|
-
const
|
|
3397
|
-
te *=
|
|
3398
|
-
} else if (
|
|
3418
|
+
$t = (0.7 + (Math.sin(Mt * 5e-3) + 1) / 2 * 0.3) * V;
|
|
3419
|
+
} else if (lt.type === G.TextDissolve)
|
|
3420
|
+
Math.sin(ct * 1.5 + Mt * 2e-3 * (st.speed || 1)) > 0.5 && ($t = 0);
|
|
3421
|
+
else if (lt.type === G.TextOrganic) {
|
|
3422
|
+
const V = st.speed || 1, ut = st.amplitude || 10;
|
|
3423
|
+
Dt += Math.sin(Mt * 2e-3 * V + ct) * ut * at, At += Math.cos(Mt * 15e-4 * V + ct * 0.7) * ut * at;
|
|
3424
|
+
} else if (lt.type === G.TextBreathe) {
|
|
3425
|
+
const ut = 1 + (Math.sin(Mt * 3e-3 + ct * 0.2) + 1) / 2 * 0.2 * at;
|
|
3426
|
+
te *= ut, Wt *= ut;
|
|
3427
|
+
} else if (lt.type === G.TextSpin) {
|
|
3399
3428
|
const V = st.speed || 1;
|
|
3400
|
-
|
|
3401
|
-
} else if (
|
|
3429
|
+
Yt += Mt * 0.01 * V + ct;
|
|
3430
|
+
} else if (lt.type === G.TextMagnet) {
|
|
3402
3431
|
const V = this.pointerHistory[this.pointerHistory.length - 1];
|
|
3403
3432
|
if (V) {
|
|
3404
|
-
const
|
|
3405
|
-
|
|
3433
|
+
const ut = V.x - (i.x + Tt), gt = V.y - (i.y + zt);
|
|
3434
|
+
Yt = Math.atan2(gt, ut);
|
|
3406
3435
|
}
|
|
3407
|
-
} else if (
|
|
3408
|
-
const V = B.length / 2,
|
|
3409
|
-
te *=
|
|
3410
|
-
} else if (
|
|
3411
|
-
|
|
3412
|
-
else if (
|
|
3413
|
-
const V = st.speed || 1,
|
|
3414
|
-
|
|
3415
|
-
} else if (
|
|
3416
|
-
const V = st.speed || 1,
|
|
3417
|
-
|
|
3418
|
-
} else if (
|
|
3419
|
-
const V = st.speed || 1,
|
|
3420
|
-
te *= 1 +
|
|
3421
|
-
} else if (
|
|
3422
|
-
const V = st.speed || 2,
|
|
3423
|
-
|
|
3424
|
-
} else if (
|
|
3425
|
-
const V = st.stiffness || 0.2,
|
|
3426
|
-
|
|
3427
|
-
} else if (
|
|
3436
|
+
} else if (lt.type === G.TextPerspective) {
|
|
3437
|
+
const V = B.length / 2, ut = (ct - V) / V, gt = 1 - Math.abs(ut) * 0.3 * at;
|
|
3438
|
+
te *= gt, Wt *= gt, Dt += ut * 20 * at;
|
|
3439
|
+
} else if (lt.type === G.TextMirror)
|
|
3440
|
+
$t *= 0.8;
|
|
3441
|
+
else if (lt.type === G.TextFloral) {
|
|
3442
|
+
const V = st.speed || 1, ut = st.stagger || 0.1, gt = (Mt * 1e-3 * V + ct * ut) % 2;
|
|
3443
|
+
gt < 1 && (te *= gt, Wt *= gt, Yt += gt * Math.PI);
|
|
3444
|
+
} else if (lt.type === G.TextSmoke) {
|
|
3445
|
+
const V = st.speed || 1, ut = st.height || 50, gt = (Mt * 5e-4 * V + ct * 0.2) % 1;
|
|
3446
|
+
At -= gt * ut * at, Dt += Math.sin(Mt * 2e-3 + ct) * 5 * at, $t = 1 - gt;
|
|
3447
|
+
} else if (lt.type === G.TextVariable) {
|
|
3448
|
+
const V = st.speed || 1, ut = st.intensity || 1.5, gt = (Math.sin(Mt * 4e-3 * V + ct * 0.3) + 1) / 2;
|
|
3449
|
+
te *= 1 + gt * (ut - 1) * at;
|
|
3450
|
+
} else if (lt.type === G.TextZing) {
|
|
3451
|
+
const V = st.speed || 2, ut = st.distance || 100, gt = (Mt * 2e-3 * V + ct * 0.05) % 1;
|
|
3452
|
+
Dt += (1 - gt) * ut * at, $t = gt;
|
|
3453
|
+
} else if (lt.type === G.TextElastic) {
|
|
3454
|
+
const V = st.stiffness || 0.2, ut = st.damping || 0.1, gt = Math.sin(Mt * 0.01) * Math.exp(-Mt * 1e-3 * ut);
|
|
3455
|
+
Wt *= 1 + gt * V * at;
|
|
3456
|
+
} else if (lt.type === G.TextGlitch3D) {
|
|
3428
3457
|
const V = st.intensity || 5;
|
|
3429
|
-
Math.random() < 0.2 && (
|
|
3430
|
-
} else if (
|
|
3458
|
+
Math.random() < 0.2 && (Dt += (Math.random() - 0.5) * V, At += (Math.random() - 0.5) * V, $t = 0.8);
|
|
3459
|
+
} else if (lt.type === G.GlitchText) {
|
|
3431
3460
|
const V = st.intensity || 5;
|
|
3432
|
-
Math.random() < 0.1 && (
|
|
3461
|
+
Math.random() < 0.1 && (Dt += (Math.random() - 0.5) * V, At += (Math.random() - 0.5) * V, Math.random() < 0.05 && ($t = 0.5));
|
|
3433
3462
|
}
|
|
3434
3463
|
});
|
|
3435
|
-
let It = null,
|
|
3464
|
+
let It = null, vt = o.textDecoration || "none", Ct = m;
|
|
3436
3465
|
if (o.enableSegments === !0 && ((ee = o.segments) == null ? void 0 : ee.length) > 0) {
|
|
3437
|
-
let
|
|
3438
|
-
for (const
|
|
3439
|
-
if (ct <
|
|
3440
|
-
st =
|
|
3466
|
+
let lt = 0, st = null;
|
|
3467
|
+
for (const at of o.segments) {
|
|
3468
|
+
if (ct < lt + (at.text || "").length) {
|
|
3469
|
+
st = at;
|
|
3441
3470
|
break;
|
|
3442
3471
|
}
|
|
3443
|
-
|
|
3472
|
+
lt += (at.text || "").length;
|
|
3444
3473
|
}
|
|
3445
3474
|
if (st) {
|
|
3446
|
-
let
|
|
3447
|
-
v.forEach((
|
|
3448
|
-
const
|
|
3449
|
-
|
|
3475
|
+
let at = st.fontFamily || o.fontFamily || "Inter";
|
|
3476
|
+
v.forEach((ut) => {
|
|
3477
|
+
const gt = new RegExp(`[\\s-]${ut}$`, "i");
|
|
3478
|
+
gt.test(at) && (at = at.replace(gt, "").trim());
|
|
3450
3479
|
});
|
|
3451
|
-
const
|
|
3452
|
-
|
|
3480
|
+
const Mt = this.mapFontWeight((st.fontWeight || o.fontWeight || "400").toString()), V = st.fontStyle || d;
|
|
3481
|
+
Ct = st.fontSize || m, t.font = `${V} ${Mt} ${Ct}px "${at}", sans-serif`, st.fill && (It = st.fill), st.textDecoration && (vt = st.textDecoration), Ct < Y && (At += (Y - Ct) * 0.85);
|
|
3453
3482
|
}
|
|
3454
3483
|
} else
|
|
3455
3484
|
t.font = S;
|
|
3456
|
-
const
|
|
3457
|
-
t.globalAlpha *=
|
|
3458
|
-
const
|
|
3459
|
-
if (
|
|
3460
|
-
const
|
|
3461
|
-
t.translate(
|
|
3485
|
+
const mt = t.globalAlpha;
|
|
3486
|
+
t.globalAlpha *= $t, t.save();
|
|
3487
|
+
const Lt = t.measureText(rt).width;
|
|
3488
|
+
if (U && J > 0) {
|
|
3489
|
+
const lt = Tt - ft + Lt / 2, at = (Rt + lt) / J, Mt = this.getPointOnPath(U.geo, U.w, U.h, Math.abs(at % 1)), V = Mt.angle, ut = zt + At + (o.pathOffsetY || 0), gt = o.pathSide === "right" ? -1 : 1, ce = Math.cos(V + Math.PI / 2) * ut * gt, me = Math.sin(V + Math.PI / 2) * ut * gt;
|
|
3490
|
+
t.translate(Mt.x + ce + Dt, Mt.y + me), t.rotate(V + Yt + (gt === -1 ? Math.PI : 0));
|
|
3462
3491
|
} else
|
|
3463
|
-
t.translate(
|
|
3464
|
-
if (t.scale(te,
|
|
3465
|
-
const
|
|
3466
|
-
t.fillStyle =
|
|
3492
|
+
t.translate(Tt + Dt + Lt / 2, zt + At), Yt !== 0 && t.rotate(Yt);
|
|
3493
|
+
if (t.scale(te, Wt), It && !r && !l) {
|
|
3494
|
+
const lt = this.createCanvasFill(t, It, n, a);
|
|
3495
|
+
t.fillStyle = lt || It.color || "#000000";
|
|
3467
3496
|
} else if (!r && !l) {
|
|
3468
|
-
const
|
|
3469
|
-
t.fillStyle =
|
|
3497
|
+
const lt = this.createCanvasFill(t, e.fill, n, a);
|
|
3498
|
+
t.fillStyle = lt || e.fill.color || "#000000";
|
|
3470
3499
|
}
|
|
3471
|
-
if (
|
|
3500
|
+
if ($t > 0)
|
|
3472
3501
|
if (r || l) {
|
|
3473
|
-
const
|
|
3474
|
-
t.fillStyle =
|
|
3475
|
-
} else
|
|
3476
|
-
|
|
3502
|
+
const lt = l ? "#000000" : this.createCanvasFill(t, e.fill, n, a);
|
|
3503
|
+
t.fillStyle = lt || e.fill.color || "#ffffff", t.fillText(rt, -Lt / 2, 0);
|
|
3504
|
+
} else kt ? t.strokeText(rt, -Lt / 2, 0) : t.fillText(rt, -Lt / 2, 0);
|
|
3505
|
+
vt !== "none" && !r && this.drawTextDecoration(t, vt, 0, 0, Lt, Ct), t.restore(), t.globalAlpha = mt, w === "justify" && X > 0 && rt === " " && !q ? Tt += Lt + M + X : Tt += Lt + M;
|
|
3477
3506
|
}
|
|
3478
3507
|
}
|
|
3479
3508
|
};
|
|
3480
3509
|
if (r) {
|
|
3481
|
-
let B = 0,
|
|
3482
|
-
(
|
|
3483
|
-
const
|
|
3484
|
-
|
|
3485
|
-
let
|
|
3486
|
-
w === "center" ?
|
|
3510
|
+
let B = 0, nt = F;
|
|
3511
|
+
(x || []).forEach((zt) => {
|
|
3512
|
+
const kt = zt.text || "", _t = c.indexOf(kt, B);
|
|
3513
|
+
_t !== -1 && (B = _t);
|
|
3514
|
+
let Vt = -n / 2;
|
|
3515
|
+
w === "center" ? Vt = 0 : w === "right" && (Vt = n / 2), dt(kt, Vt, nt, !1, B), B += kt.length, nt += E;
|
|
3487
3516
|
});
|
|
3488
3517
|
} else if (l) {
|
|
3489
|
-
let B = 0,
|
|
3490
|
-
(
|
|
3491
|
-
const
|
|
3492
|
-
let
|
|
3493
|
-
w === "center" ?
|
|
3518
|
+
let B = 0, nt = F;
|
|
3519
|
+
(x || []).forEach((zt) => {
|
|
3520
|
+
const kt = zt.text || "";
|
|
3521
|
+
let _t = -n / 2;
|
|
3522
|
+
w === "center" ? _t = 0 : w === "right" && (_t = n / 2), dt(kt, _t, nt, !1, B), B += kt.length, B < c.length && (c[B] === `
|
|
3494
3523
|
` || c[B] === "\r") && (B++, c[B - 1] === "\r" && c[B] === `
|
|
3495
|
-
` && B++),
|
|
3524
|
+
` && B++), nt += E;
|
|
3496
3525
|
});
|
|
3497
3526
|
} else {
|
|
3498
3527
|
if (e.fill) {
|
|
3499
|
-
const
|
|
3500
|
-
t.fillStyle =
|
|
3501
|
-
const
|
|
3528
|
+
const nt = t.globalAlpha, zt = this.createCanvasFill(t, e.fill, n, a);
|
|
3529
|
+
t.fillStyle = zt || e.fill.color || "#000000", t.globalAlpha = nt * this.normalizeOpacity(e.fill.opacity ?? 100);
|
|
3530
|
+
const kt = W.fullText || (o.enableSegments ? (o.segments || []).map((Ut) => {
|
|
3502
3531
|
let Jt = Ut.text || "";
|
|
3503
3532
|
const qt = Ut.textCase || o.textCase || "none";
|
|
3504
3533
|
return qt === "uppercase" ? Jt.toUpperCase() : qt === "lowercase" ? Jt.toLowerCase() : qt === "capitalize" ? Jt.replace(/\b\w/g, (Qt) => Qt.toUpperCase()) : Jt;
|
|
3505
3534
|
}).join("") : c);
|
|
3506
|
-
let
|
|
3507
|
-
(
|
|
3535
|
+
let _t = 0, Vt = F;
|
|
3536
|
+
(x || []).forEach((Ut) => {
|
|
3508
3537
|
const Jt = Ut.text || "";
|
|
3509
3538
|
let qt = -n / 2;
|
|
3510
|
-
w === "center" ? qt = 0 : w === "right" && (qt = n / 2), dt(Jt, qt,
|
|
3511
|
-
` ||
|
|
3512
|
-
` &&
|
|
3513
|
-
}), t.globalAlpha =
|
|
3539
|
+
w === "center" ? qt = 0 : w === "right" && (qt = n / 2), dt(Jt, qt, Vt, !1, _t), _t += Jt.length, Vt += E, _t < kt.length && (kt[_t] === `
|
|
3540
|
+
` || kt[_t] === "\r") && ($ > 0 && (Vt += $), _t++, kt[_t - 1] === "\r" && kt[_t] === `
|
|
3541
|
+
` && _t++);
|
|
3542
|
+
}), t.globalAlpha = nt;
|
|
3514
3543
|
}
|
|
3515
3544
|
const B = o.paragraphRule;
|
|
3516
|
-
if (B && (((
|
|
3517
|
-
let
|
|
3518
|
-
(
|
|
3545
|
+
if (B && (((Xt = B.top) == null ? void 0 : Xt.width) > 0 || ((Bt = B.bottom) == null ? void 0 : Bt.width) > 0)) {
|
|
3546
|
+
let nt = 0;
|
|
3547
|
+
(x || []).forEach((zt, kt) => {
|
|
3519
3548
|
var Ut, Jt;
|
|
3520
|
-
const
|
|
3521
|
-
` || c[
|
|
3522
|
-
if (
|
|
3549
|
+
const Vt = nt === 0 || nt < c.length && (c[nt] === `
|
|
3550
|
+
` || c[nt] === "\r");
|
|
3551
|
+
if (Vt && kt > 0 && nt++, Vt) {
|
|
3523
3552
|
if (((Ut = B.top) == null ? void 0 : Ut.width) > 0) {
|
|
3524
|
-
const qt = F +
|
|
3553
|
+
const qt = F + kt * E - B.top.offset;
|
|
3525
3554
|
t.strokeStyle = B.top.color || "#000000", t.lineWidth = B.top.width, t.beginPath();
|
|
3526
|
-
const Qt = -n / 2 +
|
|
3527
|
-
t.moveTo(Qt, qt), t.lineTo(n / 2 -
|
|
3555
|
+
const Qt = -n / 2 + E * 0.2;
|
|
3556
|
+
t.moveTo(Qt, qt), t.lineTo(n / 2 - E * 0.2, qt), t.stroke();
|
|
3528
3557
|
}
|
|
3529
3558
|
if (((Jt = B.bottom) == null ? void 0 : Jt.width) > 0) {
|
|
3530
|
-
const qt = F + (
|
|
3559
|
+
const qt = F + (kt + 1) * E - B.bottom.offset;
|
|
3531
3560
|
t.strokeStyle = B.bottom.color || "#000000", t.lineWidth = B.bottom.width, t.beginPath();
|
|
3532
|
-
const Qt = -n / 2 +
|
|
3533
|
-
t.moveTo(Qt, qt), t.lineTo(n / 2 -
|
|
3561
|
+
const Qt = -n / 2 + E * 0.2;
|
|
3562
|
+
t.moveTo(Qt, qt), t.lineTo(n / 2 - E * 0.2, qt), t.stroke();
|
|
3534
3563
|
}
|
|
3535
3564
|
}
|
|
3536
|
-
|
|
3565
|
+
nt += (zt.text || "").length;
|
|
3537
3566
|
});
|
|
3538
3567
|
}
|
|
3539
3568
|
if (e.stroke && e.stroke.width > 0) {
|
|
3540
|
-
const
|
|
3541
|
-
e.fill && e.fill.type !== "None" && e.fill.isEnabled !== !1 && e.fill.opacity !== 0 && e.fill.color !== "transparent" && e.fill.color !== "rgba(0,0,0,0)" && (t.shadowColor = "transparent", t.shadowBlur = 0, t.shadowOffsetX = 0, t.shadowOffsetY = 0), t.strokeStyle = e.stroke.color, t.lineWidth = e.stroke.width, t.globalAlpha =
|
|
3542
|
-
let
|
|
3543
|
-
(
|
|
3569
|
+
const nt = t.globalAlpha;
|
|
3570
|
+
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 = nt * this.normalizeOpacity(e.stroke.opacity ?? 100);
|
|
3571
|
+
let kt = 0, _t = F;
|
|
3572
|
+
(x || []).forEach((Vt) => {
|
|
3544
3573
|
let Ut = -n / 2;
|
|
3545
|
-
w === "center" ? Ut = 0 : w === "right" && (Ut = n / 2), dt(
|
|
3546
|
-
` || c[
|
|
3547
|
-
` &&
|
|
3548
|
-
}), t.globalAlpha =
|
|
3574
|
+
w === "center" ? Ut = 0 : w === "right" && (Ut = n / 2), dt(Vt.text, Ut, _t, !0, kt), kt += (Vt.text || "").length, _t += E, kt < c.length && (c[kt] === `
|
|
3575
|
+
` || c[kt] === "\r") && ($ > 0 && (_t += $), kt++, c[kt - 1] === "\r" && c[kt] === `
|
|
3576
|
+
` && kt++);
|
|
3577
|
+
}), t.globalAlpha = nt;
|
|
3549
3578
|
}
|
|
3550
3579
|
}
|
|
3551
3580
|
}
|
|
@@ -3655,12 +3684,12 @@ class ci {
|
|
|
3655
3684
|
if (t <= 0) return 0;
|
|
3656
3685
|
let c = 0, g = s, f = o;
|
|
3657
3686
|
for (let d = 1; d <= h; d++) {
|
|
3658
|
-
const u = d / h, m = 1 - u, y = u * u, v = m * m, b = v * m, C = y * u, S = b * s + 3 * v * u * e + 3 * m * y * n + C * r, I = b * o + 3 * v * u * i + 3 * m * y * a + C * l, w = S - g, M = I - f,
|
|
3659
|
-
if (c +
|
|
3660
|
-
const T = t - c,
|
|
3661
|
-
return (d - 1 +
|
|
3687
|
+
const u = d / h, m = 1 - u, y = u * u, v = m * m, b = v * m, C = y * u, S = b * s + 3 * v * u * e + 3 * m * y * n + C * r, I = b * o + 3 * v * u * i + 3 * m * y * a + C * l, w = S - g, M = I - f, _ = Math.sqrt(w * w + M * M);
|
|
3688
|
+
if (c + _ >= t) {
|
|
3689
|
+
const T = t - c, $ = _ === 0 ? 0 : T / _;
|
|
3690
|
+
return (d - 1 + $) / h;
|
|
3662
3691
|
}
|
|
3663
|
-
c +=
|
|
3692
|
+
c += _, g = S, f = I;
|
|
3664
3693
|
}
|
|
3665
3694
|
return 1;
|
|
3666
3695
|
}
|
|
@@ -3694,8 +3723,8 @@ class ci {
|
|
|
3694
3723
|
return w = this.getBezierTAtLength(f - d, b.x, b.y, b.out_x ?? b.x, b.out_y ?? b.y, C.in_x ?? C.x, C.in_y ?? C.y, C.x, C.y, 20), this.getBezierPointAndAngle(w, b, C, h, c);
|
|
3695
3724
|
{
|
|
3696
3725
|
w = S === 0 ? 0 : (f - d) / S;
|
|
3697
|
-
const M = b.x + (C.x - b.x) * w - h,
|
|
3698
|
-
return { x: M, y:
|
|
3726
|
+
const M = b.x + (C.x - b.x) * w - h, _ = b.y + (C.y - b.y) * w - c, T = Math.atan2(C.y - b.y, C.x - b.x);
|
|
3727
|
+
return { x: M, y: _, angle: T };
|
|
3699
3728
|
}
|
|
3700
3729
|
}
|
|
3701
3730
|
d += S;
|
|
@@ -3804,8 +3833,8 @@ class ci {
|
|
|
3804
3833
|
const I = b.getContext("2d");
|
|
3805
3834
|
if (I) {
|
|
3806
3835
|
I.imageSmoothingEnabled = !1;
|
|
3807
|
-
const w = t.getTransform(), M = w.e - e / 2,
|
|
3808
|
-
I.drawImage(t.canvas, M,
|
|
3836
|
+
const w = t.getTransform(), M = w.e - e / 2, _ = w.f - i / 2;
|
|
3837
|
+
I.drawImage(t.canvas, M, _, e, i, 0, 0, C, S), t.imageSmoothingEnabled = !1, t.drawImage(b, 0, 0, C, S, -e / 2, -i / 2, e, i), t.imageSmoothingEnabled = !0;
|
|
3809
3838
|
}
|
|
3810
3839
|
} else if (l === "glitch") {
|
|
3811
3840
|
const v = this.currentTime * c, b = r.chaosAmount ?? 0.2, C = Math.max(3, Math.floor(8 * h)), S = h * e * 0.15;
|
|
@@ -3814,10 +3843,10 @@ class ci {
|
|
|
3814
3843
|
t.fillStyle = "rgba(255, 0, 0, 0.4)", t.fillRect(-e / 2 + I, -i / 2, e, i), t.fillStyle = "rgba(0, 255, 255, 0.4)", t.fillRect(-e / 2 - I, -i / 2, e, i), t.globalCompositeOperation = "source-over", t.globalAlpha = 1;
|
|
3815
3844
|
const w = i / C;
|
|
3816
3845
|
for (let M = 0; M < C; M++) {
|
|
3817
|
-
const
|
|
3846
|
+
const _ = Math.sin(M * 127.1 + v * 311.7 * c) * 43758.5, T = _ - Math.floor(_);
|
|
3818
3847
|
if (T > 1 - b) {
|
|
3819
|
-
const
|
|
3820
|
-
t.save(), t.beginPath(), t.rect(-e / 2, k, e, w), t.clip(), t.globalAlpha = 0.8, t.drawImage(t.canvas,
|
|
3848
|
+
const $ = (T - (1 - b)) / b * S * (Math.random() > 0.5 ? 1 : -1), k = -i / 2 + M * w, E = t.getTransform(), R = E.e - e / 2 + $, A = E.f + k;
|
|
3849
|
+
t.save(), t.beginPath(), t.rect(-e / 2, k, e, w), t.clip(), t.globalAlpha = 0.8, t.drawImage(t.canvas, R, A, e, w, -e / 2 + $, k, e, w), t.restore();
|
|
3821
3850
|
}
|
|
3822
3851
|
}
|
|
3823
3852
|
}
|
|
@@ -3980,141 +4009,141 @@ class ci {
|
|
|
3980
4009
|
}
|
|
3981
4010
|
}
|
|
3982
4011
|
renderInputBox(t, s) {
|
|
3983
|
-
var dt,
|
|
3984
|
-
const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.options) || s.options || {}, i = ((dt = s.geometry) == null ? void 0 : dt.width) || 250, n = ((
|
|
4012
|
+
var dt, yt;
|
|
4013
|
+
const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.options) || s.options || {}, i = ((dt = s.geometry) == null ? void 0 : dt.width) || 250, n = ((yt = s.geometry) == null ? void 0 : yt.height) || 45, a = this.focusedId === s.id, r = this.lastHoveredObjectId === s.id, l = e.previewState || "default", h = l !== "default" ? l : a ? "focused" : r ? "hovered" : "default", c = e.label || { visible: !0, text: "Label" }, g = e.helperText || { visible: !1, text: "Helper text" }, f = e.leftIcon || { visible: !1 }, d = e.rightIcon || { visible: !1 }, u = e.multiline === !0, m = e.corner_radius ?? 8, y = e.corners || { tl: m, tr: m, bl: m, br: m }, v = [y.tl, y.tr, y.br, y.bl];
|
|
3985
4014
|
let b = e.backgroundColor || "rgba(31, 41, 55, 1)", C = e.borderColor || "rgba(55, 65, 81, 1)", S = e.borderWidth ?? 1.5, I = e.color || "#ffffff", w = e.placeholderColor || "rgba(156, 163, 175, 1)", M = e.fontSize || 14;
|
|
3986
|
-
const
|
|
4015
|
+
const _ = `${h}Style`, T = e[_];
|
|
3987
4016
|
T ? (T.backgroundColor !== void 0 && (b = T.backgroundColor), T.borderColor !== void 0 && (C = T.borderColor), T.borderWidth !== void 0 && (S = T.borderWidth), T.color !== void 0 && (I = T.color), T.placeholderColor !== void 0 && (w = T.placeholderColor), T.fontSize !== void 0 && (M = T.fontSize)) : h === "focused" ? (C = e.focusBorderColor || "rgba(59, 130, 246, 1)", S = Math.max(S, 2)) : h === "hovered" || h === "hover" ? (C = e.hoverBorderColor || C, b = e.hoverBackgroundColor || b) : h === "disabled" ? (b = e.disabledBackgroundColor || "rgba(31, 41, 55, 0.6)", C = e.disabledBorderColor || "rgba(55, 65, 81, 0.4)") : h === "error" && (C = "rgba(239, 68, 68, 1)", S = Math.max(S, 2)), t.beginPath(), this.drawRoundRect(t, -i / 2, -n / 2, i, n, v);
|
|
3988
|
-
const
|
|
3989
|
-
if (
|
|
4017
|
+
const $ = this.createCanvasFill(t, b, i, n);
|
|
4018
|
+
if ($ && (t.fillStyle = $, t.fill()), S > 0) {
|
|
3990
4019
|
const ht = this.createCanvasFill(t, C, i, n);
|
|
3991
4020
|
if (ht && (t.strokeStyle = ht, t.lineWidth = S, t.stroke()), h === "focused" || h === "focus") {
|
|
3992
4021
|
t.save(), t.beginPath();
|
|
3993
|
-
const
|
|
3994
|
-
this.drawRoundRect(t, -i / 2 - 2, -n / 2 - 2, i + 4, n + 4,
|
|
4022
|
+
const pt = v.map((ot) => ot + 2);
|
|
4023
|
+
this.drawRoundRect(t, -i / 2 - 2, -n / 2 - 2, i + 4, n + 4, pt), t.strokeStyle = "rgba(59, 130, 246, 0.3)", t.lineWidth = 2, t.stroke(), t.restore();
|
|
3995
4024
|
}
|
|
3996
4025
|
}
|
|
3997
|
-
const k = (ht,
|
|
4026
|
+
const k = (ht, pt) => {
|
|
3998
4027
|
if (!ht.visible || !ht.svgPath) return;
|
|
3999
|
-
const
|
|
4000
|
-
if (t.save(), t.translate(
|
|
4001
|
-
const
|
|
4002
|
-
t.scale(B, B), t.translate(-12, -12), t.fillStyle =
|
|
4028
|
+
const ot = ht.size || 14, Et = ht.offset ?? 16, Ft = ht.color || "#ffffff", wt = pt ? -(i / 2) + Et : i / 2 - Et, Xt = ht.svgPath;
|
|
4029
|
+
if (t.save(), t.translate(wt, 0), !Xt.startsWith("<svg")) {
|
|
4030
|
+
const Bt = new Path2D(Xt), B = ot / 24;
|
|
4031
|
+
t.scale(B, B), t.translate(-12, -12), t.fillStyle = Ft, t.fill(Bt);
|
|
4003
4032
|
}
|
|
4004
4033
|
t.restore();
|
|
4005
4034
|
};
|
|
4006
4035
|
k(f, !0), k(d, !1);
|
|
4007
|
-
const
|
|
4008
|
-
t.font = `${H} ${
|
|
4009
|
-
const
|
|
4010
|
-
if (t.save(), t.beginPath(), t.rect(
|
|
4036
|
+
const E = e.text || "", R = e.placeholder || "Enter text...", A = !E, O = E || R, W = A ? w : I, x = M, Y = e.fontFamily || "Inter", H = e.fontWeight || 400;
|
|
4037
|
+
t.font = `${H} ${x}px "${Y}", sans-serif`, t.fillStyle = W, t.textAlign = "left", t.textBaseline = u ? "top" : "middle";
|
|
4038
|
+
const Q = e.inputPadding ?? 16, P = f.visible ? (f.offset ?? 16) + (f.size || 14) / 2 + 8 : Q, F = d.visible ? (d.offset ?? 16) + (d.size || 14) / 2 + 8 : Q, U = -(i / 2) + P, J = i - P - F, it = e.inputType === "password" ? "•".repeat(O.length) : O;
|
|
4039
|
+
if (t.save(), t.beginPath(), t.rect(U - 2, -n / 2 + 4, J + 4, n - 8), t.clip(), u) {
|
|
4011
4040
|
const ht = it.split(`
|
|
4012
4041
|
`);
|
|
4013
|
-
let
|
|
4014
|
-
const
|
|
4015
|
-
let
|
|
4016
|
-
ht.forEach((
|
|
4017
|
-
const
|
|
4018
|
-
let
|
|
4019
|
-
for (let B = 0; B <
|
|
4020
|
-
const
|
|
4021
|
-
t.measureText(
|
|
4042
|
+
let pt = -n / 2 + Q;
|
|
4043
|
+
const ot = x * 1.2;
|
|
4044
|
+
let Et = 0;
|
|
4045
|
+
ht.forEach((Ft, wt) => {
|
|
4046
|
+
const Xt = Ft.split(" ");
|
|
4047
|
+
let Bt = "";
|
|
4048
|
+
for (let B = 0; B < Xt.length; B++) {
|
|
4049
|
+
const nt = Bt + Xt[B] + " ";
|
|
4050
|
+
t.measureText(nt).width > J && B > 0 ? (t.fillText(Bt, U, pt), Bt = Xt[B] + " ", pt += ot) : Bt = nt;
|
|
4022
4051
|
}
|
|
4023
|
-
t.fillText(
|
|
4024
|
-
}), a && !
|
|
4052
|
+
t.fillText(Bt, U, pt), Et = t.measureText(Bt).width, wt < ht.length - 1 && (pt += ot, Et = 0);
|
|
4053
|
+
}), a && !A && Math.floor(performance.now() / 500) % 2 === 0 && t.fillRect(U + Et, pt, 1.5, x);
|
|
4025
4054
|
} else {
|
|
4026
|
-
const
|
|
4027
|
-
let
|
|
4028
|
-
if (
|
|
4029
|
-
const
|
|
4030
|
-
t.fillRect(
|
|
4055
|
+
const pt = t.measureText(it).width;
|
|
4056
|
+
let ot = 0;
|
|
4057
|
+
if (pt > J && (ot = pt - J), t.fillText(it, U - ot, 0), a && !A && Math.floor(performance.now() / 500) % 2 === 0) {
|
|
4058
|
+
const Ft = U + pt - ot;
|
|
4059
|
+
t.fillRect(Ft, -(x / 2), 1.5, x);
|
|
4031
4060
|
}
|
|
4032
4061
|
}
|
|
4033
4062
|
if (t.restore(), c.visible !== !1) {
|
|
4034
|
-
const ht = c.text || "Label",
|
|
4035
|
-
t.font = `600 ${
|
|
4036
|
-
const
|
|
4037
|
-
t.fillText(ht,
|
|
4063
|
+
const ht = c.text || "Label", pt = c.fontSize || 12, ot = c.color || "rgba(156, 163, 175, 1)", Et = c.offset ?? 8;
|
|
4064
|
+
t.font = `600 ${pt}px "${Y}", sans-serif`, t.fillStyle = ot, t.textAlign = "left", t.textBaseline = "bottom";
|
|
4065
|
+
const Ft = -(i / 2), wt = -(n / 2) - Et;
|
|
4066
|
+
t.fillText(ht, Ft, wt);
|
|
4038
4067
|
}
|
|
4039
4068
|
if (g.visible === !0) {
|
|
4040
|
-
const ht = g.text || "Helper text",
|
|
4041
|
-
t.font = `400 ${
|
|
4042
|
-
const
|
|
4043
|
-
t.fillText(ht,
|
|
4069
|
+
const ht = g.text || "Helper text", pt = g.fontSize || 11, ot = h === "error" ? "rgba(239, 68, 68, 1)" : g.color || "rgba(156, 163, 175, 1)", Et = g.offset ?? 6;
|
|
4070
|
+
t.font = `400 ${pt}px "${Y}", sans-serif`, t.fillStyle = ot, t.textAlign = "left", t.textBaseline = "top";
|
|
4071
|
+
const Ft = -(i / 2), wt = n / 2 + Et;
|
|
4072
|
+
t.fillText(ht, Ft, wt);
|
|
4044
4073
|
}
|
|
4045
4074
|
}
|
|
4046
4075
|
renderSlider(t, s) {
|
|
4047
|
-
const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.geometry) || s.geometry, i = (o == null ? void 0 : o.options) || s.options || {}, n = e.width || 200, a = i.value ?? 50, r = i.min ?? 0, h = (i.max ?? 100) - r, c = h === 0 ? 0 : (a - r) / h, g = i.trackHeight || 4, f = i.trackRoundedness ?? 2, d = i.trackShape ?? "Rectangle", u = i.trackPath || "", m = i.accentColor || "#3b82f6", y = i.inactiveColor || "#374151", v = i.thumbShape || "Ellipse", b = i.thumbWidth ?? 16, C = i.thumbHeight ?? 16, S = i.thumbRoundedness ?? 0, I = i.thumbColor || "#ffffff", w = i.thumbPath || "", M = i.thumbIcon || "",
|
|
4048
|
-
if ((
|
|
4076
|
+
const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.geometry) || s.geometry, i = (o == null ? void 0 : o.options) || s.options || {}, n = e.width || 200, a = i.value ?? 50, r = i.min ?? 0, h = (i.max ?? 100) - r, c = h === 0 ? 0 : (a - r) / h, g = i.trackHeight || 4, f = i.trackRoundedness ?? 2, d = i.trackShape ?? "Rectangle", u = i.trackPath || "", m = i.accentColor || "#3b82f6", y = i.inactiveColor || "#374151", v = i.thumbShape || "Ellipse", b = i.thumbWidth ?? 16, C = i.thumbHeight ?? 16, S = i.thumbRoundedness ?? 0, I = i.thumbColor || "#ffffff", w = i.thumbPath || "", M = i.thumbIcon || "", _ = i.showValueTooltip ?? !1, T = i.tooltipBgColor || "#333333", $ = i.tooltipColor || "#ffffff", k = i.tooltipOffsetX ?? 0, E = i.tooltipOffsetY ?? -25, R = (J, it, dt, yt, ht, pt, ot) => {
|
|
4077
|
+
if ((J === "Custom" || J === "Icon") && ot)
|
|
4049
4078
|
try {
|
|
4050
|
-
const
|
|
4051
|
-
if (t.save(), t.translate(it, dt),
|
|
4052
|
-
const
|
|
4053
|
-
t.scale(
|
|
4079
|
+
const Et = new Path2D(ot);
|
|
4080
|
+
if (t.save(), t.translate(it, dt), J === "Icon") {
|
|
4081
|
+
const Ft = Math.min(yt, ht) / 24;
|
|
4082
|
+
t.scale(Ft, Ft), t.translate(-12, -12);
|
|
4054
4083
|
}
|
|
4055
|
-
t.fill(
|
|
4084
|
+
t.fill(Et), t.restore();
|
|
4056
4085
|
return;
|
|
4057
|
-
} catch (
|
|
4058
|
-
console.error("Error drawing slider shape in engine:",
|
|
4086
|
+
} catch (Et) {
|
|
4087
|
+
console.error("Error drawing slider shape in engine:", Et);
|
|
4059
4088
|
}
|
|
4060
|
-
if (t.beginPath(),
|
|
4061
|
-
t.ellipse(it, dt,
|
|
4062
|
-
else if (
|
|
4063
|
-
this.drawRoundRect(t, it -
|
|
4064
|
-
else if (
|
|
4065
|
-
t.moveTo(it, dt - ht / 2), t.lineTo(it +
|
|
4066
|
-
else if (
|
|
4067
|
-
t.moveTo(it, dt - ht / 2), t.lineTo(it +
|
|
4068
|
-
else if (
|
|
4069
|
-
const
|
|
4070
|
-
for (let
|
|
4071
|
-
const
|
|
4072
|
-
|
|
4089
|
+
if (t.beginPath(), J === "Ellipse")
|
|
4090
|
+
t.ellipse(it, dt, yt / 2, ht / 2, 0, 0, Math.PI * 2);
|
|
4091
|
+
else if (J === "Rectangle")
|
|
4092
|
+
this.drawRoundRect(t, it - yt / 2, dt - ht / 2, yt, ht, pt);
|
|
4093
|
+
else if (J === "Triangle")
|
|
4094
|
+
t.moveTo(it, dt - ht / 2), t.lineTo(it + yt / 2, dt + ht / 2), t.lineTo(it - yt / 2, dt + ht / 2), t.closePath();
|
|
4095
|
+
else if (J === "Diamond")
|
|
4096
|
+
t.moveTo(it, dt - ht / 2), t.lineTo(it + yt / 2, dt), t.lineTo(it, dt + ht / 2), t.lineTo(it - yt / 2, dt), t.closePath();
|
|
4097
|
+
else if (J === "Polygon") {
|
|
4098
|
+
const Et = s.geometry.sides || 3, Ft = s.geometry.radius || Math.min(yt, ht) / 2;
|
|
4099
|
+
for (let wt = 0; wt < Et; wt++) {
|
|
4100
|
+
const Xt = wt * 2 * Math.PI / Et - Math.PI / 2, Bt = it + Ft * Math.cos(Xt), B = dt + Ft * Math.sin(Xt);
|
|
4101
|
+
wt === 0 ? t.moveTo(Bt, B) : t.lineTo(Bt, B);
|
|
4073
4102
|
}
|
|
4074
4103
|
t.closePath();
|
|
4075
|
-
} else if (
|
|
4076
|
-
const
|
|
4077
|
-
for (let
|
|
4078
|
-
const
|
|
4079
|
-
t.lineTo(it +
|
|
4104
|
+
} else if (J === "Star") {
|
|
4105
|
+
const Ft = Math.min(yt, ht) / 2, wt = Ft / 2;
|
|
4106
|
+
for (let Xt = 0; Xt < 5 * 2; Xt++) {
|
|
4107
|
+
const Bt = Xt % 2 === 0 ? Ft : wt, B = Xt * Math.PI / 5 - Math.PI / 2;
|
|
4108
|
+
t.lineTo(it + Bt * Math.cos(B), dt + Bt * Math.sin(B));
|
|
4080
4109
|
}
|
|
4081
4110
|
t.closePath();
|
|
4082
|
-
} else
|
|
4111
|
+
} else J === "Line" && (t.moveTo(it - yt / 2, dt), t.lineTo(it + yt / 2, dt));
|
|
4083
4112
|
t.fill();
|
|
4084
|
-
},
|
|
4085
|
-
|
|
4086
|
-
const
|
|
4087
|
-
if (
|
|
4088
|
-
const
|
|
4089
|
-
|
|
4113
|
+
}, A = this.createCanvasFill(t, y, n, g);
|
|
4114
|
+
A && (t.fillStyle = A, t.strokeStyle = A), d === "Line" ? (t.lineWidth = g, t.beginPath(), t.moveTo(-n / 2, 0), t.lineTo(n / 2, 0), t.stroke()) : R(d, 0, 0, n, g, f, u);
|
|
4115
|
+
const O = n - b, W = -n / 2 + b / 2 + c * O, x = W - -n / 2;
|
|
4116
|
+
if (x > 0) {
|
|
4117
|
+
const J = this.createCanvasFill(t, m, n, g);
|
|
4118
|
+
J && (t.fillStyle = J, t.strokeStyle = J), d === "Line" ? (t.lineWidth = g, t.beginPath(), t.moveTo(-n / 2, 0), t.lineTo(W, 0), t.stroke()) : d === "Rectangle" && (t.beginPath(), this.drawRoundRect(t, -n / 2, -g / 2, x, g, f), t.fill());
|
|
4090
4119
|
}
|
|
4091
|
-
t.save(), t.translate(
|
|
4092
|
-
const
|
|
4120
|
+
t.save(), t.translate(W, 0);
|
|
4121
|
+
const Y = t.getTransform(), H = Math.sqrt(Y.a * Y.a + Y.b * Y.b) || 1;
|
|
4093
4122
|
t.shadowColor = "rgba(0,0,0,0.2)", t.shadowBlur = 4 * H, t.shadowOffsetY = 1 * H;
|
|
4094
|
-
const
|
|
4095
|
-
if (
|
|
4096
|
-
t.save(), t.translate(
|
|
4097
|
-
const
|
|
4123
|
+
const Q = this.createCanvasFill(t, I, b, C);
|
|
4124
|
+
if (Q && (t.fillStyle = Q), R(v, 0, 0, b, C, S, v === "Icon" ? M : w), t.restore(), _) {
|
|
4125
|
+
t.save(), t.translate(W + k, E);
|
|
4126
|
+
const J = Math.round(a).toString();
|
|
4098
4127
|
t.font = "10px Inter, sans-serif";
|
|
4099
|
-
const it = t.measureText(
|
|
4100
|
-
t.beginPath(), this.drawRoundRect(t, -ht / 2, -
|
|
4128
|
+
const it = t.measureText(J), dt = 6, yt = 4, ht = it.width + dt * 2, pt = 14 + yt;
|
|
4129
|
+
t.beginPath(), this.drawRoundRect(t, -ht / 2, -pt / 2, ht, pt, 4), t.fillStyle = T, t.fill(), t.fillStyle = $, t.textAlign = "center", t.textBaseline = "middle", t.fillText(J, 0, 0), t.restore();
|
|
4101
4130
|
}
|
|
4102
|
-
const
|
|
4103
|
-
if (
|
|
4104
|
-
const
|
|
4105
|
-
t.font = `600 ${it}px "${
|
|
4106
|
-
const ht = -(n / 2),
|
|
4107
|
-
t.fillText(
|
|
4131
|
+
const P = i.label || {}, F = i.helperText || {}, U = i.fontFamily || "Inter";
|
|
4132
|
+
if (P.visible !== !1) {
|
|
4133
|
+
const J = P.text || "Label", it = P.fontSize || 12, dt = P.color || "rgba(156, 163, 175, 1)", yt = P.offset ?? 8;
|
|
4134
|
+
t.font = `600 ${it}px "${U}", sans-serif`, t.fillStyle = dt, t.textAlign = "left", t.textBaseline = "bottom";
|
|
4135
|
+
const ht = -(n / 2), pt = -(g / 2) - yt;
|
|
4136
|
+
t.fillText(J, ht, pt);
|
|
4108
4137
|
}
|
|
4109
4138
|
if (F.visible === !0) {
|
|
4110
|
-
const
|
|
4111
|
-
t.font = `400 ${it}px "${
|
|
4112
|
-
const ht = -(n / 2),
|
|
4113
|
-
t.fillText(
|
|
4139
|
+
const J = F.text || "Helper text", it = F.fontSize || 11, dt = F.color || "rgba(156, 163, 175, 1)", yt = F.offset ?? 6;
|
|
4140
|
+
t.font = `400 ${it}px "${U}", sans-serif`, t.fillStyle = dt, t.textAlign = "left", t.textBaseline = "top";
|
|
4141
|
+
const ht = -(n / 2), pt = g / 2 + yt;
|
|
4142
|
+
t.fillText(J, ht, pt);
|
|
4114
4143
|
}
|
|
4115
4144
|
}
|
|
4116
4145
|
renderDropdown(t, s) {
|
|
4117
|
-
var
|
|
4146
|
+
var E;
|
|
4118
4147
|
const o = this.objectStates.get(s.id);
|
|
4119
4148
|
if (!o) return;
|
|
4120
4149
|
const e = o.options || s.options || {}, i = s.geometry.width || 160, n = s.geometry.height || 40, a = -i / 2, r = -n / 2, l = e.corner_radius ?? 6, h = e.disabled || e.previewState === "disabled", c = this.lastHoveredObjectId === s.id || e.previewState === "hover", g = (e.isOpen || e.previewState === "active") && !h;
|
|
@@ -4126,44 +4155,44 @@ class ci {
|
|
|
4126
4155
|
y > 0 && (t.strokeStyle = this.createCanvasFill(t, typeof d == "string" ? { type: "Solid", color: d } : d, i, n) || "#e5e7eb", t.lineWidth = y, t.stroke());
|
|
4127
4156
|
const v = 12, b = e.chevronType || "chevron", C = e.chevronSize || 16, S = (g ? e.openIconColor : e.closedIconColor) || e.chevronColor || "#6b7280";
|
|
4128
4157
|
if (b !== "none") {
|
|
4129
|
-
const
|
|
4130
|
-
t.save(), t.translate(
|
|
4131
|
-
const
|
|
4132
|
-
if (t.rotate(
|
|
4158
|
+
const R = a + i - v - C / 2;
|
|
4159
|
+
t.save(), t.translate(R, 0);
|
|
4160
|
+
const A = g ? e.openIconAngle ?? 180 : e.closedIconAngle ?? 0;
|
|
4161
|
+
if (t.rotate(A * Math.PI / 180), t.strokeStyle = S, t.fillStyle = S, t.lineWidth = 1.5, t.lineCap = "round", t.lineJoin = "round", b === "chevron")
|
|
4133
4162
|
t.beginPath(), t.moveTo(-C / 2, -C * 0.2), t.lineTo(0, C * 0.2), t.lineTo(C / 2, -C * 0.2), t.stroke();
|
|
4134
4163
|
else if (b === "custom" || b === "path") {
|
|
4135
|
-
const
|
|
4136
|
-
if (
|
|
4137
|
-
const
|
|
4164
|
+
const O = g && e.openIconPath || e.closedIconPath;
|
|
4165
|
+
if (O) {
|
|
4166
|
+
const W = new Path2D(O);
|
|
4138
4167
|
t.save();
|
|
4139
|
-
const
|
|
4140
|
-
t.scale(
|
|
4168
|
+
const x = C / 24;
|
|
4169
|
+
t.scale(x, x), t.translate(-12, -12), t.fill(W), t.restore();
|
|
4141
4170
|
}
|
|
4142
4171
|
}
|
|
4143
4172
|
t.restore();
|
|
4144
4173
|
}
|
|
4145
|
-
const I = e.selectedOption || e.placeholder || "Select...", w = e.fontSize || 14, M = e.fontWeight || 400,
|
|
4146
|
-
t.font = `${M} ${w}px ${
|
|
4174
|
+
const I = e.selectedOption || e.placeholder || "Select...", w = e.fontSize || 14, M = e.fontWeight || 400, _ = e.fontFamily || "Inter, sans-serif";
|
|
4175
|
+
t.font = `${M} ${w}px ${_}`;
|
|
4147
4176
|
const T = h ? e.disabledColor || "#9ca3af" : !e.selectedOption && e.placeholder ? "#9ca3af" : u;
|
|
4148
4177
|
t.fillStyle = this.createCanvasFill(t, typeof T == "string" ? { type: "Solid", color: T } : T, i, n) || "#333333", t.textAlign = "left", t.textBaseline = "middle";
|
|
4149
|
-
const
|
|
4178
|
+
const $ = b === "none" ? 0 : C + 8, k = i - v * 2 - $;
|
|
4150
4179
|
if (t.save(), t.beginPath(), t.rect(a + v, r, k, n), t.clip(), t.fillText(I, a + v, 0), t.restore(), g && !h) {
|
|
4151
|
-
const
|
|
4180
|
+
const R = r + n + 4, A = e.optionsList || [], O = e.itemHeight || 32, W = e.listPadding ?? 4, x = A.length * O + W * 2, Y = e.listCornerRadius ?? l;
|
|
4152
4181
|
t.save();
|
|
4153
|
-
const H = e.listShadow || {},
|
|
4154
|
-
t.shadowColor = typeof H.color == "string" ? H.color : ((
|
|
4182
|
+
const H = e.listShadow || {}, Q = t.getTransform(), P = Math.sqrt(Q.a * Q.a + Q.b * Q.b) || 1;
|
|
4183
|
+
t.shadowColor = typeof H.color == "string" ? H.color : ((E = H.color) == null ? void 0 : E.color) || "rgba(0,0,0,0.15)", t.shadowBlur = (H.blur ?? 12) * P, t.shadowOffsetY = (H.offsetY ?? 6) * P, t.shadowOffsetX = (H.offsetX ?? 0) * P, t.beginPath(), this.drawRoundRect(t, a, R, i, x, Y), t.fillStyle = this.createCanvasFill(t, typeof e.listBackgroundColor == "string" ? { type: "Solid", color: e.listBackgroundColor } : e.listBackgroundColor || { type: "Solid", color: "#ffffff" }, i, x) || "#ffffff", t.fill();
|
|
4155
4184
|
const F = e.listBorderWidth ?? 1;
|
|
4156
|
-
F > 0 && (t.shadowColor = "transparent", t.strokeStyle = this.createCanvasFill(t, typeof e.listBorderColor == "string" ? { type: "Solid", color: e.listBorderColor } : e.listBorderColor || { type: "Solid", color: d }, i,
|
|
4157
|
-
const
|
|
4158
|
-
t.font = `${M} ${
|
|
4159
|
-
const
|
|
4185
|
+
F > 0 && (t.shadowColor = "transparent", t.strokeStyle = this.createCanvasFill(t, typeof e.listBorderColor == "string" ? { type: "Solid", color: e.listBorderColor } : e.listBorderColor || { type: "Solid", color: d }, i, x) || "#e5e7eb", t.lineWidth = F, t.stroke()), t.restore();
|
|
4186
|
+
const U = e.itemFontSize || w, J = e.itemFontFamily || _;
|
|
4187
|
+
t.font = `${M} ${U}px ${J}`, A.forEach((it, dt) => {
|
|
4188
|
+
const yt = R + W + dt * O;
|
|
4160
4189
|
if (it === e.selectedOption)
|
|
4161
|
-
t.fillStyle = this.createCanvasFill(t, typeof e.itemSelectedBackgroundColor == "string" ? { type: "Solid", color: e.itemSelectedBackgroundColor } : e.itemSelectedBackgroundColor || { type: "Solid", color: "#f3f4f6" }, i,
|
|
4190
|
+
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 + F, yt, i - F * 2, O), t.fillStyle = e.itemSelectedColor || e.accentColor || u || "#374151";
|
|
4162
4191
|
else if (t.fillStyle = e.listTextColor || u || "#333333", this.activeDropdownId === s.id && this._lastPointerPos) {
|
|
4163
|
-
const
|
|
4164
|
-
dt ===
|
|
4192
|
+
const pt = this._lastPointerPos.y - (R + W), ot = Math.floor(pt / O);
|
|
4193
|
+
dt === ot && (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 + F, yt, i - F * 2, O), t.fillStyle = e.itemHoverColor || u);
|
|
4165
4194
|
}
|
|
4166
|
-
t.fillText(it, a + v,
|
|
4195
|
+
t.fillText(it, a + v, yt + O / 2);
|
|
4167
4196
|
});
|
|
4168
4197
|
}
|
|
4169
4198
|
t.globalAlpha = m;
|
|
@@ -4177,16 +4206,16 @@ class ci {
|
|
|
4177
4206
|
t.save(), t.scale(C, C), t.beginPath(), this.drawRoundRect(t, S, I, n, a, y);
|
|
4178
4207
|
const w = this.createCanvasFill(t, d, n, a);
|
|
4179
4208
|
w && (t.fillStyle = w, t.fill()), (b > 0 || r && c.borderColor) && (t.strokeStyle = v, t.lineWidth = b || (r ? 1 : 0), t.stroke());
|
|
4180
|
-
const M = h.fontSize || 14,
|
|
4181
|
-
t.font = `${T} ${M}px "${
|
|
4182
|
-
let
|
|
4209
|
+
const M = h.fontSize || 14, _ = h.fontFamily || "Inter", T = h.fontWeight || 600;
|
|
4210
|
+
t.font = `${T} ${M}px "${_}", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`, t.fillStyle = u, t.textAlign = "center", t.textBaseline = "middle";
|
|
4211
|
+
let $ = 0;
|
|
4183
4212
|
if (f.enabled && f.svgPath) {
|
|
4184
|
-
const k = M * 1.1,
|
|
4185
|
-
|
|
4186
|
-
const
|
|
4187
|
-
t.scale(
|
|
4213
|
+
const k = M * 1.1, E = f.gap || 8, R = t.measureText(m), O = -(R.width + k + E) / 2, W = f.position === "left" ? O + k / 2 : O + R.width + E + k / 2;
|
|
4214
|
+
$ = f.position === "left" ? O + k + E + R.width / 2 : O + R.width / 2, t.save(), t.translate(W, 0);
|
|
4215
|
+
const x = new Path2D(f.svgPath), Y = k / 24;
|
|
4216
|
+
t.scale(Y, Y), t.translate(-12, -12), t.fillStyle = u, t.fill(x), t.restore();
|
|
4188
4217
|
}
|
|
4189
|
-
t.fillText(m,
|
|
4218
|
+
t.fillText(m, $, 0), t.restore();
|
|
4190
4219
|
}
|
|
4191
4220
|
renderToggleButton(t, s) {
|
|
4192
4221
|
var m, y;
|
|
@@ -4196,36 +4225,36 @@ class ci {
|
|
|
4196
4225
|
t.font = `${c.fontWeight || 600} ${d}px "${u}", sans-serif`, t.fillStyle = f, t.textAlign = "center", t.textBaseline = "middle", t.fillText(c.text || "Toggle", 0, 0), t.restore();
|
|
4197
4226
|
}
|
|
4198
4227
|
renderToggle(t, s) {
|
|
4199
|
-
var
|
|
4200
|
-
const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.options) || s.options || {}, i = ((
|
|
4228
|
+
var Y, H, Q, P, F, U, J, it, dt, yt, ht, pt;
|
|
4229
|
+
const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.options) || s.options || {}, i = ((Y = s.geometry) == null ? void 0 : Y.width) || 52, n = ((H = s.geometry) == null ? void 0 : H.height) || 30, a = -i / 2, r = -n / 2, l = e.checked ?? !1, h = e.cornerRadius ?? e.corner_radius ?? n / 2, c = e.toggleStyle || {}, g = c.backgroundColor || e.activeColor || "#10b981", f = c.borderColor || e.borderColor || "transparent", d = c.borderWidth ?? e.borderWidth ?? 0, u = c.knobColor || e.knobColor || "#ffffff", m = l ? g : e.inactiveColor || "#374151", y = l ? f : e.borderColor || "transparent", v = l ? d : e.borderWidth ?? 0, b = l ? u : e.knobColor || "#ffffff";
|
|
4201
4230
|
e.disabled && (t.globalAlpha *= 0.5), t.beginPath(), this.drawRoundRect(t, a, r, i, n, h);
|
|
4202
4231
|
const C = this.createCanvasFill(t, m, i, n);
|
|
4203
4232
|
if (C && (t.fillStyle = C, t.fill()), v > 0) {
|
|
4204
4233
|
t.lineWidth = v;
|
|
4205
|
-
const
|
|
4206
|
-
|
|
4234
|
+
const ot = this.createCanvasFill(t, y, i, n);
|
|
4235
|
+
ot && (t.strokeStyle = ot, t.stroke());
|
|
4207
4236
|
}
|
|
4208
|
-
const S = 2, I = n - S * 2, w = I / 2, M = a + S,
|
|
4209
|
-
t.beginPath(), t.arc(T + w,
|
|
4237
|
+
const S = 2, I = n - S * 2, w = I / 2, M = a + S, _ = a + i - S - I, T = l ? _ : M, $ = r + S;
|
|
4238
|
+
t.beginPath(), t.arc(T + w, $ + w, w, 0, Math.PI * 2);
|
|
4210
4239
|
const k = this.createCanvasFill(t, b, I, I);
|
|
4211
4240
|
k && (t.fillStyle = k, t.fill()), e.disabled && (t.globalAlpha *= 2);
|
|
4212
|
-
let
|
|
4213
|
-
const
|
|
4214
|
-
if ((
|
|
4215
|
-
const
|
|
4216
|
-
t.font = `${
|
|
4241
|
+
let E = !1, R = !1;
|
|
4242
|
+
const A = (l ? (Q = c.leftLabel) == null ? void 0 : Q.text : null) || ((P = e.leftLabel) == null ? void 0 : P.text) || "", O = (l ? (F = c.leftLabel) == null ? void 0 : F.color : null) || ((U = e.leftLabel) == null ? void 0 : U.color) || "#f3f4f6";
|
|
4243
|
+
if ((J = e.leftLabel) != null && J.enabled && A) {
|
|
4244
|
+
const ot = e.leftLabel;
|
|
4245
|
+
t.font = `${ot.fontWeight || 400} ${ot.fontSize || 12}px "${ot.fontFamily || "Inter"}", sans-serif`, t.fillStyle = O, t.textBaseline = "middle", t.textAlign = "right", t.fillText(A, a - (ot.gap || 8), 0), E = !0;
|
|
4217
4246
|
}
|
|
4218
|
-
const
|
|
4219
|
-
if ((
|
|
4220
|
-
const
|
|
4221
|
-
t.font = `${
|
|
4247
|
+
const W = (l ? (it = c.rightLabel) == null ? void 0 : it.text : null) || ((dt = e.rightLabel) == null ? void 0 : dt.text) || "", x = (l ? (yt = c.rightLabel) == null ? void 0 : yt.color : null) || ((ht = e.rightLabel) == null ? void 0 : ht.color) || "#f3f4f6";
|
|
4248
|
+
if ((pt = e.rightLabel) != null && pt.enabled && W) {
|
|
4249
|
+
const ot = e.rightLabel;
|
|
4250
|
+
t.font = `${ot.fontWeight || 400} ${ot.fontSize || 12}px "${ot.fontFamily || "Inter"}", sans-serif`, t.fillStyle = x, t.textBaseline = "middle", t.textAlign = "left", t.fillText(W, a + i + (ot.gap || 8), 0), R = !0;
|
|
4222
4251
|
}
|
|
4223
|
-
if (!
|
|
4224
|
-
const
|
|
4225
|
-
t.font = `${
|
|
4226
|
-
const
|
|
4227
|
-
let
|
|
4228
|
-
|
|
4252
|
+
if (!E && !R && e.label && e.label.text) {
|
|
4253
|
+
const ot = e.label, Et = ot.fontSize || 14, Ft = ot.fontWeight || 400, wt = ot.fontFamily || "Inter";
|
|
4254
|
+
t.font = `${Ft} ${Et}px "${wt}", sans-serif`, t.fillStyle = ot.color || "#f3f4f6", t.textBaseline = "middle";
|
|
4255
|
+
const Xt = ot.gap || 10;
|
|
4256
|
+
let Bt = 0, B = 0;
|
|
4257
|
+
ot.position === "left" ? (t.textAlign = "right", Bt = a - Xt, B = 0) : ot.position === "right" ? (t.textAlign = "left", Bt = a + i + Xt, B = 0) : ot.position === "top" ? (t.textAlign = "center", Bt = 0, B = r - Xt, t.textBaseline = "bottom") : ot.position === "bottom" ? (t.textAlign = "center", Bt = 0, B = r + n + Xt, t.textBaseline = "top") : (t.textAlign = "left", Bt = a + i + Xt, B = 0), t.fillText(ot.text, Bt, B);
|
|
4229
4258
|
}
|
|
4230
4259
|
}
|
|
4231
4260
|
renderCheckbox(t, s) {
|
|
@@ -4246,15 +4275,15 @@ class ci {
|
|
|
4246
4275
|
t.save(), t.beginPath();
|
|
4247
4276
|
const I = this.createCanvasFill(t, f, i, n);
|
|
4248
4277
|
t.strokeStyle = I || f, t.lineWidth = Math.max(2, i * 0.12), t.lineCap = "round", t.lineJoin = "round";
|
|
4249
|
-
const w = a + i * 0.25, M = r + n * 0.5,
|
|
4250
|
-
t.moveTo(w, M), t.lineTo(
|
|
4278
|
+
const w = a + i * 0.25, M = r + n * 0.5, _ = a + i * 0.45, T = r + n * 0.7, $ = a + i * 0.75, k = r + n * 0.25;
|
|
4279
|
+
t.moveTo(w, M), t.lineTo(_, T), t.lineTo($, k), t.stroke(), t.restore();
|
|
4251
4280
|
}
|
|
4252
4281
|
if (e.disabled && (t.globalAlpha *= 2), e.label && e.label.text) {
|
|
4253
4282
|
const I = e.label;
|
|
4254
4283
|
t.save(), t.font = `${I.fontWeight || 400} ${I.fontSize || 14}px "${I.fontFamily || "Inter"}", sans-serif`, t.fillStyle = I.color || "#f3f4f6", t.textBaseline = "middle";
|
|
4255
4284
|
const w = I.gap || 8;
|
|
4256
|
-
let M = 0,
|
|
4257
|
-
I.position === "left" ? (t.textAlign = "right", M = a - w,
|
|
4285
|
+
let M = 0, _ = 0;
|
|
4286
|
+
I.position === "left" ? (t.textAlign = "right", M = a - w, _ = 0) : I.position === "right" ? (t.textAlign = "left", M = a + i + w, _ = 0) : I.position === "top" ? (t.textAlign = "center", M = 0, _ = r - w, t.textBaseline = "bottom") : I.position === "bottom" && (t.textAlign = "center", M = 0, _ = r + n + w, t.textBaseline = "top"), t.fillText(I.text, M, _), t.restore();
|
|
4258
4287
|
}
|
|
4259
4288
|
}
|
|
4260
4289
|
renderRadioGroup(t, s) {
|
|
@@ -4264,34 +4293,34 @@ class ci {
|
|
|
4264
4293
|
const b = 8, C = b * 2;
|
|
4265
4294
|
if (t.save(), t.font = `${v} ${m}px "${y}", sans-serif`, t.textBaseline = "middle", t.textAlign = "left", c === "vertical") {
|
|
4266
4295
|
const w = Math.max(C, m) + g;
|
|
4267
|
-
h.forEach((M,
|
|
4268
|
-
const T = r +
|
|
4296
|
+
h.forEach((M, _) => {
|
|
4297
|
+
const T = r + _ * w + b;
|
|
4269
4298
|
t.beginPath(), t.arc(a + b, T, b, 0, Math.PI * 2);
|
|
4270
|
-
const
|
|
4271
|
-
|
|
4299
|
+
const $ = l === M, k = this.createCanvasFill(t, f, C, C), E = this.createCanvasFill(t, d, C, C);
|
|
4300
|
+
$ ? (t.strokeStyle = k || f, t.lineWidth = 2, t.stroke(), t.beginPath(), t.arc(a + b, T, b / 2, 0, Math.PI * 2), t.fillStyle = k || f, t.fill()) : (t.strokeStyle = E || d, t.lineWidth = 1.5, t.stroke()), t.fillStyle = u, t.fillText(M, a + C + 8, T);
|
|
4272
4301
|
});
|
|
4273
4302
|
} else {
|
|
4274
4303
|
let w = a;
|
|
4275
4304
|
h.forEach((M) => {
|
|
4276
|
-
const
|
|
4305
|
+
const _ = l === M, T = t.measureText(M).width;
|
|
4277
4306
|
t.beginPath(), t.arc(w + b, 0, b, 0, Math.PI * 2);
|
|
4278
|
-
const
|
|
4279
|
-
|
|
4307
|
+
const $ = this.createCanvasFill(t, f, C, C), k = this.createCanvasFill(t, d, C, C);
|
|
4308
|
+
_ ? (t.strokeStyle = $ || f, t.lineWidth = 2, t.stroke(), t.beginPath(), t.arc(w + b, 0, b / 2, 0, Math.PI * 2), t.fillStyle = $ || f, t.fill()) : (t.strokeStyle = k || d, t.lineWidth = 1.5, t.stroke()), t.fillStyle = u, t.fillText(M, w + C + 6, 0), w += C + 6 + T + g;
|
|
4280
4309
|
});
|
|
4281
4310
|
}
|
|
4282
4311
|
if (t.restore(), e.disabled && (t.globalAlpha *= 2), e.label && e.label.text) {
|
|
4283
4312
|
const w = e.label;
|
|
4284
4313
|
t.save(), t.font = `${w.fontWeight || 400} ${w.fontSize || 14}px "${w.fontFamily || "Inter"}", sans-serif`, t.fillStyle = w.color || "#9ca3af", t.textBaseline = "middle";
|
|
4285
4314
|
const M = w.gap || 8;
|
|
4286
|
-
let
|
|
4287
|
-
w.position === "left" ? (t.textAlign = "right",
|
|
4315
|
+
let _ = 0, T = 0;
|
|
4316
|
+
w.position === "left" ? (t.textAlign = "right", _ = a - M, T = 0) : w.position === "right" ? (t.textAlign = "left", _ = a + i + M, T = 0) : w.position === "top" ? (t.textAlign = "center", _ = 0, T = r - M, t.textBaseline = "bottom") : w.position === "bottom" && (t.textAlign = "center", _ = 0, T = r + n + M, t.textBaseline = "top"), t.fillText(w.text, _, T), t.restore();
|
|
4288
4317
|
}
|
|
4289
4318
|
}
|
|
4290
4319
|
renderBarChart(t, s) {
|
|
4291
|
-
var T,
|
|
4320
|
+
var T, $;
|
|
4292
4321
|
const o = this.objectStates.get(s.id), e = (o == null ? void 0 : o.options) || s.options || {}, i = {
|
|
4293
4322
|
width: ((T = s.geometry) == null ? void 0 : T.width) || 300,
|
|
4294
|
-
height: ((
|
|
4323
|
+
height: (($ = s.geometry) == null ? void 0 : $.height) || 180,
|
|
4295
4324
|
chartType: e.chartType || "grouped",
|
|
4296
4325
|
stylePreset: e.stylePreset || "default",
|
|
4297
4326
|
datasets: e.datasets || [{ id: "ds-1", label: "Revenue", data: [42, 67, 31, 55, 78, 48], color: "#6366f1" }],
|
|
@@ -4320,21 +4349,21 @@ class ci {
|
|
|
4320
4349
|
_getPreset: function() {
|
|
4321
4350
|
return fs[this.stylePreset] || fs.default;
|
|
4322
4351
|
},
|
|
4323
|
-
_resolveColor: function(k,
|
|
4324
|
-
const
|
|
4325
|
-
return ["#6366f1", "#f59e0b", "#10b981", "#3b82f6", "#a855f7"].includes(k) ?
|
|
4352
|
+
_resolveColor: function(k, E) {
|
|
4353
|
+
const R = this._getPreset();
|
|
4354
|
+
return ["#6366f1", "#f59e0b", "#10b981", "#3b82f6", "#a855f7"].includes(k) ? R.colors[E % R.colors.length] : typeof k == "string" ? k : R.colors[E % R.colors.length];
|
|
4326
4355
|
},
|
|
4327
|
-
_makeGradient: function(k,
|
|
4328
|
-
if (!this._getPreset().barGradient && !this.barGradient) return
|
|
4329
|
-
const
|
|
4330
|
-
return
|
|
4356
|
+
_makeGradient: function(k, E, R, A, O, W) {
|
|
4357
|
+
if (!this._getPreset().barGradient && !this.barGradient) return E;
|
|
4358
|
+
const Y = k.createLinearGradient(R, A, O, W);
|
|
4359
|
+
return Y.addColorStop(0, E), Y.addColorStop(1, E + "44"), Y;
|
|
4331
4360
|
},
|
|
4332
|
-
_drawRoundedBar: function(k,
|
|
4333
|
-
if (
|
|
4334
|
-
k.rect(
|
|
4361
|
+
_drawRoundedBar: function(k, E, R, A, O, W, x) {
|
|
4362
|
+
if (W = Math.min(W, Math.min(Math.abs(A), Math.abs(O)) / 2), W <= 0 || A === 0 || O === 0) {
|
|
4363
|
+
k.rect(E, R, A, O);
|
|
4335
4364
|
return;
|
|
4336
4365
|
}
|
|
4337
|
-
k.beginPath(),
|
|
4366
|
+
k.beginPath(), x ? (k.moveTo(E, R + O), k.lineTo(E, R + W), k.quadraticCurveTo(E, R, E + W, R), k.lineTo(E + A - W, R), k.quadraticCurveTo(E + A, R, E + A, R + W), k.lineTo(E + A, R + O), k.lineTo(E, R + O)) : (k.moveTo(E, R), k.lineTo(E + A - W, R), k.quadraticCurveTo(E + A, R, E + A, R + W), k.lineTo(E + A, R + O - W), k.quadraticCurveTo(E + A, R + O, E + A - W, R + O), k.lineTo(E, R + O), k.lineTo(E, R)), k.closePath();
|
|
4338
4367
|
}
|
|
4339
4368
|
}, n = i.width, a = i.height, r = -n / 2, l = -a / 2;
|
|
4340
4369
|
if (!i.datasets || i.datasets.length === 0 || i.categories.length === 0) {
|
|
@@ -4346,16 +4375,16 @@ class ci {
|
|
|
4346
4375
|
const f = i.categories.length, d = i.datasets.length;
|
|
4347
4376
|
if (i.chartType === "stacked")
|
|
4348
4377
|
for (let k = 0; k < f; k++) {
|
|
4349
|
-
let
|
|
4350
|
-
i.datasets.forEach((
|
|
4351
|
-
const
|
|
4352
|
-
|
|
4353
|
-
}),
|
|
4378
|
+
let E = 0, R = 0;
|
|
4379
|
+
i.datasets.forEach((A) => {
|
|
4380
|
+
const O = A.data[k] ?? 0;
|
|
4381
|
+
O >= 0 ? E += O : R += O;
|
|
4382
|
+
}), E > c && (c = E), R < g && (g = R);
|
|
4354
4383
|
}
|
|
4355
4384
|
else
|
|
4356
4385
|
i.datasets.forEach((k) => {
|
|
4357
|
-
k.data && k.data.forEach((
|
|
4358
|
-
|
|
4386
|
+
k.data && k.data.forEach((E) => {
|
|
4387
|
+
E > c && (c = E), E < g && (g = E);
|
|
4359
4388
|
});
|
|
4360
4389
|
});
|
|
4361
4390
|
isFinite(c) || (c = 10), isFinite(g) || (g = 0), c = Math.max(c, 0), g = Math.min(g, 0);
|
|
@@ -4365,54 +4394,54 @@ class ci {
|
|
|
4365
4394
|
if (t.beginPath(), t.roundRect(r, l, n, a, 10), t.fillStyle = h.cardBackground, t.fill(), t.strokeStyle = h.cardBorderColor, t.lineWidth = 1, t.stroke(), i.showLegend && d > 0) {
|
|
4366
4395
|
t.font = `${i.legendFontSize}px Inter, sans-serif`, t.textBaseline = "middle";
|
|
4367
4396
|
const k = l + 12;
|
|
4368
|
-
let
|
|
4369
|
-
i.datasets.forEach((
|
|
4370
|
-
const
|
|
4371
|
-
t.beginPath(), t.roundRect(
|
|
4397
|
+
let E = S;
|
|
4398
|
+
i.datasets.forEach((R, A) => {
|
|
4399
|
+
const O = i._resolveColor(R.color, A), W = R.label || `Series ${A + 1}`, x = 7;
|
|
4400
|
+
t.beginPath(), t.roundRect(E, k - x / 2, x, x, 2), t.fillStyle = O, t.fill(), t.fillStyle = h.legendColor, t.textAlign = "left", t.fillText(W, E + x + 4, k), E += t.measureText(W).width + x + 16;
|
|
4372
4401
|
});
|
|
4373
4402
|
}
|
|
4374
|
-
const
|
|
4403
|
+
const _ = 4;
|
|
4375
4404
|
if (i.showGridLines) {
|
|
4376
4405
|
t.setLineDash([3, 4]), t.lineWidth = 1, t.strokeStyle = h.gridColor;
|
|
4377
|
-
for (let k = 0; k <=
|
|
4378
|
-
const
|
|
4379
|
-
t.beginPath(), t.moveTo(S,
|
|
4406
|
+
for (let k = 0; k <= _; k++) {
|
|
4407
|
+
const E = I + k / _ * M;
|
|
4408
|
+
t.beginPath(), t.moveTo(S, E), t.lineTo(S + w, E), t.stroke();
|
|
4380
4409
|
}
|
|
4381
4410
|
t.setLineDash([]);
|
|
4382
4411
|
}
|
|
4383
4412
|
if (i.showYLabels) {
|
|
4384
4413
|
t.font = `${i.axisLabelFontSize}px Inter, sans-serif`, t.textAlign = "right", t.textBaseline = "middle", t.fillStyle = h.axisLabelColor;
|
|
4385
|
-
for (let k = 0; k <=
|
|
4386
|
-
const
|
|
4387
|
-
t.fillText(
|
|
4414
|
+
for (let k = 0; k <= _; k++) {
|
|
4415
|
+
const E = c - k / _ * u, R = I + k / _ * M;
|
|
4416
|
+
t.fillText(E.toFixed(0), S - 6, R);
|
|
4388
4417
|
}
|
|
4389
4418
|
}
|
|
4390
4419
|
if (t.lineWidth = 1, t.setLineDash([]), i.showXAxis && (t.strokeStyle = i.xAxisColor, t.beginPath(), t.moveTo(S, I + M), t.lineTo(S + w, I + M), t.stroke()), i.showYAxis && (t.strokeStyle = i.yAxisColor, t.beginPath(), t.moveTo(S, I), t.lineTo(S, I + M), t.stroke()), i.chartType === "stacked") {
|
|
4391
4420
|
const k = w / f;
|
|
4392
|
-
for (let
|
|
4393
|
-
const
|
|
4394
|
-
i.showXLabels && (t.font = `${i.axisLabelFontSize}px Inter, sans-serif`, t.textAlign = "center", t.textBaseline = "top", t.fillStyle = h.axisLabelColor, t.fillText(i.categories[
|
|
4395
|
-
let
|
|
4396
|
-
i.datasets.forEach((
|
|
4397
|
-
const
|
|
4398
|
-
if (
|
|
4399
|
-
const
|
|
4400
|
-
|
|
4401
|
-
const F = i._resolveColor(
|
|
4402
|
-
t.beginPath(), t.fillStyle = i._makeGradient(t, F,
|
|
4421
|
+
for (let E = 0; E < f; E++) {
|
|
4422
|
+
const R = S + E * k + k / 2;
|
|
4423
|
+
i.showXLabels && (t.font = `${i.axisLabelFontSize}px Inter, sans-serif`, t.textAlign = "center", t.textBaseline = "top", t.fillStyle = h.axisLabelColor, t.fillText(i.categories[E] || "", R, I + M + 5));
|
|
4424
|
+
let A = I + M;
|
|
4425
|
+
i.datasets.forEach((O, W) => {
|
|
4426
|
+
const x = O.data[E] ?? 0;
|
|
4427
|
+
if (x === 0) return;
|
|
4428
|
+
const Y = x / u * M, H = Math.min(i.barWidth * d + i.barGap, k - 8), Q = R - H / 2, P = A - Y;
|
|
4429
|
+
A -= Y;
|
|
4430
|
+
const F = i._resolveColor(O.color, W);
|
|
4431
|
+
t.beginPath(), t.fillStyle = i._makeGradient(t, F, Q, P, Q, P + Y), i._drawRoundedBar(t, Q, P, H, Y, W === d - 1 ? i.barCornerRadius : 0, !0), t.fill();
|
|
4403
4432
|
});
|
|
4404
4433
|
}
|
|
4405
4434
|
} else {
|
|
4406
|
-
const k = w / f,
|
|
4407
|
-
for (let
|
|
4408
|
-
const
|
|
4409
|
-
i.showXLabels && (t.font = `${i.axisLabelFontSize}px Inter, sans-serif`, t.textAlign = "center", t.textBaseline = "top", t.fillStyle = h.axisLabelColor, t.fillText(i.categories[
|
|
4410
|
-
const
|
|
4411
|
-
i.datasets.forEach((
|
|
4412
|
-
const H =
|
|
4413
|
-
if (
|
|
4414
|
-
const
|
|
4415
|
-
t.beginPath(), t.fillStyle = i._makeGradient(t,
|
|
4435
|
+
const k = w / f, E = d * i.barWidth + Math.max(0, (d - 1) * i.barGap), R = I + M - (0 - g) / u * M;
|
|
4436
|
+
for (let A = 0; A < f; A++) {
|
|
4437
|
+
const O = S + A * k + k / 2;
|
|
4438
|
+
i.showXLabels && (t.font = `${i.axisLabelFontSize}px Inter, sans-serif`, t.textAlign = "center", t.textBaseline = "top", t.fillStyle = h.axisLabelColor, t.fillText(i.categories[A] || "", O, I + M + 5));
|
|
4439
|
+
const W = O - E / 2;
|
|
4440
|
+
i.datasets.forEach((x, Y) => {
|
|
4441
|
+
const H = x.data[A] ?? 0, Q = Math.abs(H / u * M);
|
|
4442
|
+
if (Q < 1) return;
|
|
4443
|
+
const P = W + Y * (i.barWidth + i.barGap), F = H >= 0 ? R - Q : R, U = i._resolveColor(x.color, Y);
|
|
4444
|
+
t.beginPath(), t.fillStyle = i._makeGradient(t, U, P, F, P, F + Q), i._drawRoundedBar(t, P, F, i.barWidth, Q, i.barCornerRadius, !0), t.fill(), i.showValueOnTop && H !== 0 && (t.font = `bold ${i.axisLabelFontSize}px Inter, sans-serif`, t.textAlign = "center", t.textBaseline = "bottom", t.fillStyle = U, t.fillText(H.toString(), P + i.barWidth / 2, F - 2));
|
|
4416
4445
|
});
|
|
4417
4446
|
}
|
|
4418
4447
|
}
|
|
@@ -4463,10 +4492,10 @@ class ci {
|
|
|
4463
4492
|
i.slices.forEach((S, I) => {
|
|
4464
4493
|
const w = S.value || 0;
|
|
4465
4494
|
if (w === 0) return;
|
|
4466
|
-
const M = w / v * f,
|
|
4467
|
-
if (t.beginPath(), t.moveTo(d, u), t.arc(d, u, M,
|
|
4468
|
-
const k =
|
|
4469
|
-
t.save(), t.font = `bold ${i.labelFontSize}px Inter, sans-serif`, t.fillStyle = l.labelColor, t.textAlign = "center", t.textBaseline = "middle", t.fillText(`${
|
|
4495
|
+
const M = w / v * f, _ = -Math.PI / 2 + I * b + C / 2, T = _ + b - C, $ = i._resolveSliceColor(S, I);
|
|
4496
|
+
if (t.beginPath(), t.moveTo(d, u), t.arc(d, u, M, _, T), t.closePath(), t.fillStyle = $ + "cc", t.fill(), t.strokeStyle = $, t.lineWidth = 1.5, t.stroke(), i.showLabels) {
|
|
4497
|
+
const k = _ + (T - _) / 2, E = d + M * 0.65 * Math.cos(k), R = u + M * 0.65 * Math.sin(k), A = Math.round(w / r * 100);
|
|
4498
|
+
t.save(), t.font = `bold ${i.labelFontSize}px Inter, sans-serif`, t.fillStyle = l.labelColor, t.textAlign = "center", t.textBaseline = "middle", t.fillText(`${A}%`, E, R), t.restore();
|
|
4470
4499
|
}
|
|
4471
4500
|
});
|
|
4472
4501
|
} else {
|
|
@@ -4478,17 +4507,17 @@ class ci {
|
|
|
4478
4507
|
S += M / r * Math.PI * 2;
|
|
4479
4508
|
return;
|
|
4480
4509
|
}
|
|
4481
|
-
const
|
|
4482
|
-
if (
|
|
4483
|
-
S +=
|
|
4510
|
+
const _ = M / r * Math.PI * 2, T = S + C / 2, $ = S + _ - C / 2;
|
|
4511
|
+
if ($ <= T) {
|
|
4512
|
+
S += _;
|
|
4484
4513
|
return;
|
|
4485
4514
|
}
|
|
4486
4515
|
const k = i._resolveSliceColor(I, w);
|
|
4487
|
-
if (t.beginPath(), t.fillStyle = k, b <= 0 ? (t.moveTo(d, u), t.arc(d, u, f, T,
|
|
4488
|
-
const
|
|
4489
|
-
t.save(), t.font = `bold ${i.labelFontSize}px Inter, sans-serif`, t.fillStyle = l.labelColor, t.textAlign = "center", t.textBaseline = "middle", t.fillText(`${
|
|
4516
|
+
if (t.beginPath(), t.fillStyle = k, b <= 0 ? (t.moveTo(d, u), t.arc(d, u, f, T, $), t.lineTo(d, u)) : (t.moveTo(d + f * Math.cos(T), u + f * Math.sin(T)), t.arc(d, u, f, T, $), t.arc(d, u, b, $, T, !0), t.closePath()), t.fill(), i.showLabels) {
|
|
4517
|
+
const E = T + ($ - T) / 2, R = b + (f - b) / 2, A = d + R * Math.cos(E), O = u + R * Math.sin(E), W = Math.round(M / r * 100);
|
|
4518
|
+
t.save(), t.font = `bold ${i.labelFontSize}px Inter, sans-serif`, t.fillStyle = l.labelColor, t.textAlign = "center", t.textBaseline = "middle", t.fillText(`${W}%`, A, O), t.restore();
|
|
4490
4519
|
}
|
|
4491
|
-
S +=
|
|
4520
|
+
S += _;
|
|
4492
4521
|
}), i.chartType === "donut" && i.showCenterText && b > 14) {
|
|
4493
4522
|
const I = Math.round(r), w = Math.min(Math.floor(b * 0.52), 20), M = Math.min(Math.floor(b * 0.26), 10);
|
|
4494
4523
|
t.textAlign = "center", t.textBaseline = "middle", t.font = `bold ${w}px Inter, sans-serif`, t.fillStyle = l.centerTextColor, t.fillText(I.toString(), d, u - M * 0.5), i.centerLabel && (t.font = `${M}px Inter, sans-serif`, t.fillStyle = l.centerLabelColor, t.fillText(i.centerLabel, d, u + w * 0.6));
|
|
@@ -4498,36 +4527,36 @@ class ci {
|
|
|
4498
4527
|
t.font = `${i.legendFontSize}px Inter, sans-serif`;
|
|
4499
4528
|
const v = 2, b = n / v, C = i.legendFontSize + 8, S = a / 2 - c + 10, I = -n / 2 + 10;
|
|
4500
4529
|
i.slices.forEach((w, M) => {
|
|
4501
|
-
const
|
|
4502
|
-
t.beginPath(), t.roundRect(
|
|
4503
|
-
const
|
|
4504
|
-
let
|
|
4505
|
-
for (; t.measureText(
|
|
4506
|
-
|
|
4507
|
-
t.fillText(
|
|
4530
|
+
const _ = M % v, T = Math.floor(M / v), $ = I + _ * b, k = S + T * C, E = i._resolveSliceColor(w, M), R = 7;
|
|
4531
|
+
t.beginPath(), t.roundRect($, k - R / 2, R, R, 2), t.fillStyle = E, t.fill(), t.textAlign = "left", t.textBaseline = "middle", t.fillStyle = l.legendColor;
|
|
4532
|
+
const A = Math.round((w.value || 0) / r * 100), O = `${w.label || "Item"} ${A}%`, W = b - R - 20;
|
|
4533
|
+
let x = O;
|
|
4534
|
+
for (; t.measureText(x).width > W && x.length > 4; )
|
|
4535
|
+
x = x.slice(0, -4) + "…";
|
|
4536
|
+
t.fillText(x, $ + R + 4, k);
|
|
4508
4537
|
});
|
|
4509
4538
|
}
|
|
4510
4539
|
t.restore();
|
|
4511
4540
|
}
|
|
4512
4541
|
getRadioGroupItemIndexAtPointer(t, s, o) {
|
|
4513
|
-
var M,
|
|
4542
|
+
var M, _;
|
|
4514
4543
|
const e = t.options || {}, i = this.objectStates.get(t.id) || {}, n = e.optionsList || [];
|
|
4515
4544
|
if (n.length === 0) return null;
|
|
4516
|
-
const a = i.width !== void 0 ? i.width : ((M = t.geometry) == null ? void 0 : M.width) || 180, r = i.height !== void 0 ? i.height : ((
|
|
4545
|
+
const a = i.width !== void 0 ? i.width : ((M = t.geometry) == null ? void 0 : M.width) || 180, r = i.height !== void 0 ? i.height : ((_ = t.geometry) == null ? void 0 : _.height) || 100, l = e.orientation || "vertical", h = e.itemGap !== void 0 ? e.itemGap : 16, c = e.fontSize || 14, g = this.getWorldTransform(t.id), f = s - g.x, d = o - g.y, u = -g.rotation * (Math.PI / 180), m = Math.cos(u), y = Math.sin(u), v = f * m - d * y, b = f * y + d * m, S = 8 * 2, I = -a / 2, w = -r / 2;
|
|
4517
4546
|
if (l === "vertical") {
|
|
4518
4547
|
const T = Math.max(S, c) + h;
|
|
4519
|
-
for (let
|
|
4520
|
-
const k = w +
|
|
4548
|
+
for (let $ = 0; $ < n.length; $++) {
|
|
4549
|
+
const k = w + $ * T;
|
|
4521
4550
|
if (v >= I && v <= I + a && b >= k && b <= k + T)
|
|
4522
|
-
return
|
|
4551
|
+
return $;
|
|
4523
4552
|
}
|
|
4524
4553
|
} else {
|
|
4525
4554
|
let T = I;
|
|
4526
|
-
for (let
|
|
4527
|
-
const
|
|
4528
|
-
if (v >= T && v <= T +
|
|
4529
|
-
return
|
|
4530
|
-
T +=
|
|
4555
|
+
for (let $ = 0; $ < n.length; $++) {
|
|
4556
|
+
const E = n[$].length * 8, R = S + 6 + E + h;
|
|
4557
|
+
if (v >= T && v <= T + R && b >= w && b <= w + r)
|
|
4558
|
+
return $;
|
|
4559
|
+
T += R;
|
|
4531
4560
|
}
|
|
4532
4561
|
}
|
|
4533
4562
|
return null;
|
|
@@ -4594,8 +4623,8 @@ class ci {
|
|
|
4594
4623
|
for (let v = 0; v < m.length - 1; v++) {
|
|
4595
4624
|
const b = m[v === 0 ? v : v - 1], C = m[v], S = m[v + 1], I = m[v + 1 === m.length - 1 ? v + 1 : v + 2];
|
|
4596
4625
|
for (let w = 1; w <= d; w++) {
|
|
4597
|
-
const M = w / d,
|
|
4598
|
-
t.lineTo(g(v + M), c(
|
|
4626
|
+
const M = w / d, _ = this._catmullRom(b, C, S, I, M);
|
|
4627
|
+
t.lineTo(g(v + M), c(_));
|
|
4599
4628
|
}
|
|
4600
4629
|
}
|
|
4601
4630
|
else
|
|
@@ -4736,52 +4765,52 @@ class ci {
|
|
|
4736
4765
|
t.moveTo(s + r, o), t.lineTo(s + e - l, o), t.arcTo(s + e, o, s + e, o + l, l), t.lineTo(s + e, o + i - h), t.arcTo(s + e, o + i, s + e - h, o + i, h), t.lineTo(s + c, o + i), t.arcTo(s, o + i, s, o + i - c, c), t.lineTo(s, o + r), t.arcTo(s, o, s + r, o, r), t.closePath();
|
|
4737
4766
|
}
|
|
4738
4767
|
renderListView(t, s) {
|
|
4739
|
-
var
|
|
4740
|
-
const o = this.objectStates.get(s.id) || {}, e = o.options || s.options || {}, i = o.width !== void 0 ? o.width : ((
|
|
4768
|
+
var R, A, O, W;
|
|
4769
|
+
const o = this.objectStates.get(s.id) || {}, e = o.options || s.options || {}, i = o.width !== void 0 ? o.width : ((R = s.geometry) == null ? void 0 : R.width) || 200, n = o.height !== void 0 ? o.height : ((A = s.geometry) == null ? void 0 : A.height) || 300, a = -i / 2, r = -n / 2, l = o.corner_radius !== void 0 ? o.corner_radius : e.corner_radius ?? 0, h = e.orientation || "vertical", c = e.items || [], g = e.itemGap ?? 10, f = e.itemHeight ?? 50, d = e.itemWidth ?? 200, u = e.scrollOffset ?? 0, m = e.padding ?? 0, y = e.glassEffect !== !1, v = e.accentColor || "#3b82f6", b = e.itemTextColor || "#333333", C = e.itemBackgroundColor || "#ffffff", S = e.hoveredIndex ?? null, I = e.activeItemIndex ?? null, w = e.glowIntensity ?? 0, M = e.glowColor || "#3b82f6", _ = typeof M == "string" ? M : M.color || ((W = (O = M.stops) == null ? void 0 : O[0]) == null ? void 0 : W.color) || "#3b82f6", T = e.opacity !== void 0 ? e.opacity : s.opacity !== void 0 ? s.opacity : 1;
|
|
4741
4770
|
if (t.save(), t.globalAlpha *= T, w > 0) {
|
|
4742
|
-
const
|
|
4743
|
-
t.shadowColor =
|
|
4771
|
+
const x = t.getTransform(), Y = Math.sqrt(x.a * x.a + x.b * x.b) || 1;
|
|
4772
|
+
t.shadowColor = _, t.shadowBlur = w * 2 * Y, t.shadowOffsetX = 0, t.shadowOffsetY = 0;
|
|
4744
4773
|
}
|
|
4745
4774
|
if (y) {
|
|
4746
|
-
const
|
|
4747
|
-
t.fillStyle =
|
|
4775
|
+
const x = e.listBackgroundColor || "rgba(31, 41, 55, 0.4)", Y = this.createCanvasFill(t, x, i, n);
|
|
4776
|
+
t.fillStyle = Y || "rgba(31, 41, 55, 0.4)", this.drawListViewRect(t, a, r, i, n, l), t.fill();
|
|
4748
4777
|
const H = t.createLinearGradient(a, r, a + i, r + n);
|
|
4749
4778
|
H.addColorStop(0, "rgba(255, 255, 255, 0.15)"), H.addColorStop(0.5, "rgba(255, 255, 255, 0.08)"), H.addColorStop(1, "rgba(255, 255, 255, 0.03)"), t.fillStyle = H, this.drawListViewRect(t, a, r, i, n, l), t.fill(), t.strokeStyle = "rgba(255, 255, 255, 0.25)", t.lineWidth = 1, this.drawListViewRect(t, a, r, i, n, l), t.stroke();
|
|
4750
4779
|
} else {
|
|
4751
|
-
const
|
|
4752
|
-
|
|
4780
|
+
const x = e.listBackgroundColor || "transparent", Y = this.createCanvasFill(t, x, i, n);
|
|
4781
|
+
Y && (t.fillStyle = Y, this.drawListViewRect(t, a, r, i, n, l), t.fill());
|
|
4753
4782
|
const H = e.borderWidth ?? 0;
|
|
4754
4783
|
H > 0 && (t.strokeStyle = e.borderColor || "#cccccc", t.lineWidth = H, this.drawListViewRect(t, a, r, i, n, l), t.stroke());
|
|
4755
4784
|
}
|
|
4756
4785
|
t.shadowBlur = 0, t.save(), this.drawListViewRect(t, a, r, i, n, l), t.clip();
|
|
4757
|
-
const
|
|
4758
|
-
let k = (h === "vertical" ? r : a) + u +
|
|
4759
|
-
if (t.textBaseline = "middle", c.forEach((
|
|
4760
|
-
const H = h === "vertical" ? i : d,
|
|
4761
|
-
if (
|
|
4762
|
-
const
|
|
4763
|
-
t.fillStyle =
|
|
4764
|
-
const
|
|
4765
|
-
t.globalAlpha =
|
|
4766
|
-
} else if (
|
|
4767
|
-
t.fillStyle = y ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.05)", t.fillRect(
|
|
4786
|
+
const $ = typeof m == "number" ? m : h === "vertical" ? m[0] : m[3];
|
|
4787
|
+
let k = (h === "vertical" ? r : a) + u + $;
|
|
4788
|
+
if (t.textBaseline = "middle", c.forEach((x, Y) => {
|
|
4789
|
+
const H = h === "vertical" ? i : d, Q = h === "vertical" ? f : n, P = h === "vertical" ? a : k, F = h === "vertical" ? k : r, U = S === Y, J = I === Y;
|
|
4790
|
+
if (J) {
|
|
4791
|
+
const pt = this.createCanvasFill(t, v, H, Q);
|
|
4792
|
+
t.fillStyle = pt || v;
|
|
4793
|
+
const ot = t.globalAlpha;
|
|
4794
|
+
t.globalAlpha = ot * 0.8, t.fillRect(P, F, H, Q), t.globalAlpha = ot;
|
|
4795
|
+
} else if (U)
|
|
4796
|
+
t.fillStyle = y ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.05)", t.fillRect(P, F, H, Q);
|
|
4768
4797
|
else if (C !== "transparent") {
|
|
4769
|
-
const
|
|
4770
|
-
t.fillStyle =
|
|
4798
|
+
const pt = this.createCanvasFill(t, C, H, Q);
|
|
4799
|
+
t.fillStyle = pt || C, t.fillRect(P, F, H, Q);
|
|
4771
4800
|
}
|
|
4772
|
-
if (
|
|
4773
|
-
const
|
|
4774
|
-
t.fillStyle =
|
|
4801
|
+
if (J || U) {
|
|
4802
|
+
const pt = this.createCanvasFill(t, v, h === "vertical" ? 3 : H, h === "vertical" ? Q : 3);
|
|
4803
|
+
t.fillStyle = pt || v, h === "vertical" ? t.fillRect(P, F, 3, Q) : t.fillRect(P, F + Q - 3, H, 3);
|
|
4775
4804
|
}
|
|
4776
|
-
const it =
|
|
4777
|
-
t.fillStyle = it, t.font =
|
|
4778
|
-
const dt = typeof
|
|
4779
|
-
h === "horizontal" ? t.textAlign = "center" : t.textAlign = "left", t.fillText(dt,
|
|
4805
|
+
const it = J ? "#ffffff" : y ? "rgba(255, 255, 255, 0.9)" : b;
|
|
4806
|
+
t.fillStyle = it, t.font = J || U ? "600 14px Inter, sans-serif" : "400 14px Inter, sans-serif";
|
|
4807
|
+
const dt = typeof x == "string" ? x : (x == null ? void 0 : x.label) || `Item ${Y + 1}`, yt = P + (h === "vertical" ? 16 : H / 2), ht = F + Q / 2;
|
|
4808
|
+
h === "horizontal" ? t.textAlign = "center" : t.textAlign = "left", t.fillText(dt, yt, ht), k += (h === "vertical" ? f : d) + g;
|
|
4780
4809
|
}), t.restore(), e.showScrollbar !== !1) {
|
|
4781
|
-
const
|
|
4782
|
-
if (
|
|
4783
|
-
const H =
|
|
4784
|
-
t.fillStyle = F, h === "vertical" ? t.fillRect(a + i -
|
|
4810
|
+
const x = (c.length || 0) * (h === "vertical" ? f : d) + ((c.length || 0) - 1) * g, Y = h === "vertical" ? n : i;
|
|
4811
|
+
if (x > Y) {
|
|
4812
|
+
const H = Y / x, Q = Y * H, P = -u / x * Y, F = e.scrollbarColor || "rgba(255,255,255,0.3)", U = e.scrollbarWidth || 4;
|
|
4813
|
+
t.fillStyle = F, h === "vertical" ? t.fillRect(a + i - U - 2, r + P, U, Q) : t.fillRect(a + P, r + n - U - 2, Q, U);
|
|
4785
4814
|
}
|
|
4786
4815
|
}
|
|
4787
4816
|
t.restore();
|
|
@@ -4799,15 +4828,15 @@ class ci {
|
|
|
4799
4828
|
i.hoveredIndex !== e && (i.hoveredIndex = e);
|
|
4800
4829
|
}
|
|
4801
4830
|
getListViewItemIndexAtPointer(t, s, o) {
|
|
4802
|
-
var
|
|
4831
|
+
var $, k;
|
|
4803
4832
|
const e = t.options || {}, i = this.objectStates.get(t.id) || {}, n = e.items || [];
|
|
4804
4833
|
if (n.length === 0) return null;
|
|
4805
|
-
const a = i.width !== void 0 ? i.width : ((
|
|
4806
|
-
let T = (l === "vertical" ? M : w) + f +
|
|
4807
|
-
for (let
|
|
4808
|
-
const
|
|
4809
|
-
if (S >=
|
|
4810
|
-
return
|
|
4834
|
+
const a = i.width !== void 0 ? i.width : (($ = t.geometry) == null ? void 0 : $.width) || 200, r = i.height !== void 0 ? i.height : ((k = t.geometry) == null ? void 0 : k.height) || 300, l = e.orientation || "vertical", h = e.itemGap ?? 10, c = e.itemHeight ?? 50, g = e.itemWidth ?? 200, f = e.scrollOffset ?? 0, d = e.padding ?? 0, u = this.getWorldTransform(t.id), m = s - u.x, y = o - u.y, v = -u.rotation * (Math.PI / 180), b = Math.cos(v), C = Math.sin(v), S = m * b - y * C, I = m * C + y * b, w = -a / 2, M = -r / 2, _ = typeof d == "number" ? d : l === "vertical" ? d[0] : d[3];
|
|
4835
|
+
let T = (l === "vertical" ? M : w) + f + _;
|
|
4836
|
+
for (let E = 0; E < n.length; E++) {
|
|
4837
|
+
const R = l === "vertical" ? a : g, A = l === "vertical" ? c : r, O = l === "vertical" ? w : T, W = l === "vertical" ? T : M;
|
|
4838
|
+
if (S >= O && S <= O + R && I >= W && I <= W + A)
|
|
4839
|
+
return E;
|
|
4811
4840
|
T += (l === "vertical" ? c : g) + h;
|
|
4812
4841
|
}
|
|
4813
4842
|
return null;
|
|
@@ -4826,196 +4855,196 @@ class ci {
|
|
|
4826
4855
|
if (!e.behaviors || e.behaviors.length === 0) return;
|
|
4827
4856
|
const i = this.objectStates.get(e.id);
|
|
4828
4857
|
i && e.behaviors.forEach((n) => {
|
|
4829
|
-
var g, f, d, u, m, y, v, b, C, S, I, w, M,
|
|
4858
|
+
var g, f, d, u, m, y, v, b, C, S, I, w, M, _, T, $, k, E, R, A, O, W, x, Y, H, Q, P, F, U, J, it, dt, yt, ht, pt, ot, Et, Ft, wt, Xt, Bt, B, nt, zt, kt, _t, Vt, Ut, Jt, qt, Qt, oe, jt, ee, K, ft, q, X, Z, j, Ot, Rt, Tt, Nt, bt, L, ct, Dt, At, te, Wt, Yt, $t, rt, It, vt, Ct, mt, Lt, lt, st, at, Mt, V, ut, gt, ce, me, Ie, we, Te, Ht, se, ue, Me, ke, fe, re, le, ye, _e, Ae, Oe, Pe, Re, Le, De, ze, Ve, Ne, He, Ue, qe, Je, Qe, Ke, Ze, je;
|
|
4830
4859
|
if (!n.enabled) return;
|
|
4831
4860
|
const a = n.startTime || 0, r = n.endTime || 1 / 0;
|
|
4832
4861
|
if (this.currentTime < a || this.currentTime > r) return;
|
|
4833
4862
|
const l = i.x - s, h = i.y - o, c = Math.sqrt(l * l + h * h);
|
|
4834
|
-
if (this.frameCount % 240 === 0 && Math.random() < 0.1 && console.log(`[ExodeUI] Executing ${n.type} on ${e.name}`), n.type ===
|
|
4835
|
-
const
|
|
4836
|
-
let
|
|
4837
|
-
c <
|
|
4838
|
-
this.applyBehaviorSensor(i,
|
|
4863
|
+
if (this.frameCount % 240 === 0 && Math.random() < 0.1 && console.log(`[ExodeUI] Executing ${n.type} on ${e.name}`), n.type === G.Proximity) {
|
|
4864
|
+
const D = ((g = n.settings) == null ? void 0 : g.radius) || 300, N = ((f = n.settings) == null ? void 0 : f.falloff) || "smooth";
|
|
4865
|
+
let z = 0;
|
|
4866
|
+
c < D && (N === "linear" ? z = 1 - c / D : z = Math.pow(1 - c / D, 2)), n.sensors.forEach((tt) => {
|
|
4867
|
+
this.applyBehaviorSensor(i, tt, z, t, n.settings, e, l, h, c);
|
|
4839
4868
|
});
|
|
4840
|
-
} else if (n.type ===
|
|
4841
|
-
const
|
|
4842
|
-
if (c <
|
|
4843
|
-
const
|
|
4844
|
-
i.x -=
|
|
4869
|
+
} else if (n.type === G.Magnetic) {
|
|
4870
|
+
const D = ((d = n.settings) == null ? void 0 : d.radius) || 400, N = ((u = n.settings) == null ? void 0 : u.strength) || 0.5;
|
|
4871
|
+
if (c < D && c > 5) {
|
|
4872
|
+
const z = 1 - c / D, tt = l * z * N, Pt = h * z * N;
|
|
4873
|
+
i.x -= tt * t * 10, i.y -= Pt * t * 10;
|
|
4845
4874
|
}
|
|
4846
|
-
} else if (n.type ===
|
|
4847
|
-
const
|
|
4848
|
-
if (c <
|
|
4849
|
-
const
|
|
4850
|
-
i.x += l / (c || 1) *
|
|
4875
|
+
} else if (n.type === G.Repel) {
|
|
4876
|
+
const D = ((m = n.settings) == null ? void 0 : m.radius) || 300, N = ((y = n.settings) == null ? void 0 : y.strength) || 1;
|
|
4877
|
+
if (c < D) {
|
|
4878
|
+
const z = Math.pow(1 - c / D, 2);
|
|
4879
|
+
i.x += l / (c || 1) * z * 60 * N * t * 5, i.y += h / (c || 1) * z * 60 * N * t * 5;
|
|
4851
4880
|
}
|
|
4852
|
-
} else if (n.type ===
|
|
4853
|
-
const
|
|
4854
|
-
i.x += Math.cos(
|
|
4855
|
-
} else if (n.type ===
|
|
4856
|
-
const
|
|
4857
|
-
if (c <
|
|
4858
|
-
const
|
|
4859
|
-
i.x +=
|
|
4881
|
+
} else if (n.type === G.Orbit) {
|
|
4882
|
+
const D = ((v = n.settings) == null ? void 0 : v.speed) || 1, N = ((b = n.settings) == null ? void 0 : b.radius) || 30, z = this.currentTime * D * Math.PI * 2;
|
|
4883
|
+
i.x += Math.cos(z) * N * t * 5, i.y += Math.sin(z) * N * t * 5, i.rotation += 2 * t * 5;
|
|
4884
|
+
} else if (n.type === G.Vortex) {
|
|
4885
|
+
const D = ((C = n.settings) == null ? void 0 : C.radius) || 400, N = ((S = n.settings) == null ? void 0 : S.speed) || 2, z = ((I = n.settings) == null ? void 0 : I.strength) || 1;
|
|
4886
|
+
if (c < D) {
|
|
4887
|
+
const tt = Math.pow(1 - c / D, 1.5), Pt = this.currentTime * N * Math.PI * 2, xt = Math.cos(Pt) * 30 - l * 0.4, Gt = Math.sin(Pt) * 30 - h * 0.4;
|
|
4888
|
+
i.x += xt * tt * z * t * 5, i.y += Gt * tt * z * t * 5, i.rotation += 5 * tt * z * t * 5, i.scale_x *= 1 - tt * 0.1 * z * t, i.scale_y *= 1 - tt * 0.1 * z * t;
|
|
4860
4889
|
}
|
|
4861
|
-
} else if (n.type ===
|
|
4862
|
-
const
|
|
4863
|
-
if (c <
|
|
4864
|
-
const
|
|
4865
|
-
i.x +=
|
|
4890
|
+
} else if (n.type === G.Fluid) {
|
|
4891
|
+
const D = ((w = n.settings) == null ? void 0 : w.radius) || 300, N = ((M = n.settings) == null ? void 0 : M.strength) || 1;
|
|
4892
|
+
if (c < D) {
|
|
4893
|
+
const z = Math.pow(1 - c / D, 1.2), tt = l / (c || 1) * z * 1.2 * N, Pt = h / (c || 1) * z * 1.2 * N;
|
|
4894
|
+
i.x += tt * 10 * t * 5, i.y += Pt * 10 * t * 5, i.scale_x *= 1 + z * 0.3 * N * t, i.scale_y *= 1 + z * 0.3 * N * t;
|
|
4866
4895
|
}
|
|
4867
|
-
} else if (n.type ===
|
|
4868
|
-
const
|
|
4869
|
-
if (c <
|
|
4870
|
-
const
|
|
4871
|
-
i.scale_x *= 1 +
|
|
4896
|
+
} else if (n.type === G.Elastic) {
|
|
4897
|
+
const D = ((_ = n.settings) == null ? void 0 : _.radius) || 300, N = ((T = n.settings) == null ? void 0 : T.strength) || 1;
|
|
4898
|
+
if (c < D) {
|
|
4899
|
+
const z = 1 - c / D;
|
|
4900
|
+
i.scale_x *= 1 + z * 0.4 * N * t, i.scale_y *= 1 + z * 0.4 * N * t;
|
|
4872
4901
|
}
|
|
4873
|
-
} else if (n.type ===
|
|
4874
|
-
const
|
|
4875
|
-
if (i.x -=
|
|
4876
|
-
const
|
|
4877
|
-
i.style.exposure = (i.style.exposure || 1) +
|
|
4902
|
+
} else if (n.type === G.Holographic) {
|
|
4903
|
+
const D = i.x - this.canvasWidth / 2, N = i.y - this.canvasHeight / 2, z = (($ = n.settings) == null ? void 0 : $.factor) || 25;
|
|
4904
|
+
if (i.x -= D / 1e3 * z * t * 5, i.y -= N / 1e3 * z * t * 5, i.style) {
|
|
4905
|
+
const tt = 1 - Math.min(1, c / 400);
|
|
4906
|
+
i.style.exposure = (i.style.exposure || 1) + tt * 0.5 * t;
|
|
4878
4907
|
}
|
|
4879
|
-
} else if (n.type ===
|
|
4880
|
-
const
|
|
4881
|
-
if (c <
|
|
4882
|
-
const
|
|
4883
|
-
i.x -= l *
|
|
4908
|
+
} else if (n.type === G.Sticky) {
|
|
4909
|
+
const D = ((k = n.settings) == null ? void 0 : k.radius) || 80, N = ((E = n.settings) == null ? void 0 : E.strength) || 1;
|
|
4910
|
+
if (c < D) {
|
|
4911
|
+
const z = Math.pow(1 - c / D, 2);
|
|
4912
|
+
i.x -= l * z * N * t * 10, i.y -= h * z * N * t * 10, i.scale_x *= 1 - z * 0.1 * N * t, i.scale_y *= 1 - z * 0.1 * N * t;
|
|
4884
4913
|
}
|
|
4885
|
-
} else if (n.type ===
|
|
4886
|
-
const
|
|
4887
|
-
if (c <
|
|
4888
|
-
const
|
|
4889
|
-
i.scale_x *= 1 +
|
|
4914
|
+
} else if (n.type === G.Dilation) {
|
|
4915
|
+
const D = ((R = n.settings) == null ? void 0 : R.size) || 120, N = ((A = n.settings) == null ? void 0 : A.strength) || 1;
|
|
4916
|
+
if (c < D) {
|
|
4917
|
+
const z = 1 - c / D;
|
|
4918
|
+
i.scale_x *= 1 + z * 0.5 * N * t, i.scale_y *= 1 + z * 0.5 * N * t;
|
|
4890
4919
|
}
|
|
4891
|
-
} else if (n.type ===
|
|
4892
|
-
const
|
|
4893
|
-
i.x = this.lerp(i.x ?? ((
|
|
4894
|
-
} else if (n.type ===
|
|
4920
|
+
} else if (n.type === G.Parallax) {
|
|
4921
|
+
const D = ((O = n.settings) == null ? void 0 : O.factor) || 15, N = ((W = n.settings) == null ? void 0 : W.strength) || 1, z = this.canvasWidth / 2, tt = this.canvasHeight / 2, Pt = this._lastPointerPos || { x: z, y: tt }, xt = (Pt.x - z) / z, Gt = (Pt.y - tt) / tt, Zt = (((x = e.transform) == null ? void 0 : x.x) ?? 0) + xt * D * N, he = (((Y = e.transform) == null ? void 0 : Y.y) ?? 0) + Gt * D * N, be = (((H = e.transform) == null ? void 0 : H.rotate_x) ?? 0) - Gt * D * 1.5 * N, ie = (((Q = e.transform) == null ? void 0 : Q.rotate_y) ?? 0) + xt * D * 1.5 * N, pe = Math.min(1, 10 * t);
|
|
4922
|
+
i.x = this.lerp(i.x ?? ((P = e.transform) == null ? void 0 : P.x) ?? 0, Zt, pe), i.y = this.lerp(i.y ?? ((F = e.transform) == null ? void 0 : F.y) ?? 0, he, pe), i.rotate_x = this.lerp(i.rotate_x ?? ((U = e.transform) == null ? void 0 : U.rotate_x) ?? 0, be, pe), i.rotate_y = this.lerp(i.rotate_y ?? ((J = e.transform) == null ? void 0 : J.rotate_y) ?? 0, ie, pe);
|
|
4923
|
+
} else if (n.type === G.Fold) {
|
|
4895
4924
|
if (c < 300) {
|
|
4896
|
-
const
|
|
4897
|
-
i.skew_x = this.lerp(i.skew_x ?? ((it = e.transform) == null ? void 0 : it.skew_x) ?? 0, N,
|
|
4925
|
+
const D = 1 - c / 300, N = (l > 0 ? -1 : 1) * D * 10, z = 1 - D * 0.1, tt = h / 300 * D * 20, Pt = -(l / 300) * D * 20, xt = Math.min(1, 10 * t);
|
|
4926
|
+
i.skew_x = this.lerp(i.skew_x ?? ((it = e.transform) == null ? void 0 : it.skew_x) ?? 0, N, xt), i.scale_y = this.lerp(i.scale_y ?? ((dt = e.transform) == null ? void 0 : dt.scale_y) ?? 1, (((yt = e.transform) == null ? void 0 : yt.scale_y) ?? 1) * z, xt), i.rotate_x = this.lerp(i.rotate_x ?? ((ht = e.transform) == null ? void 0 : ht.rotate_x) ?? 0, tt, xt), i.rotate_y = this.lerp(i.rotate_y ?? ((pt = e.transform) == null ? void 0 : pt.rotate_y) ?? 0, Pt, xt), i.style = i.style || { ...e.style }, i.style.artEffect = { enabled: !0, type: "fold_overlay", intensity: ((ot = n.settings) == null ? void 0 : ot.opacity) ?? 0.5 };
|
|
4898
4927
|
}
|
|
4899
|
-
} else if (n.type ===
|
|
4928
|
+
} else if (n.type === G.Crumple) {
|
|
4900
4929
|
if (c < 300) {
|
|
4901
|
-
const
|
|
4902
|
-
i.skew_x = this.lerp(i.skew_x ?? ((
|
|
4930
|
+
const D = 1 - c / 300, N = D * (Math.random() - 0.5) * 5, z = D * (Math.random() - 0.5) * 0.05, tt = Math.min(1, 15 * t);
|
|
4931
|
+
i.skew_x = this.lerp(i.skew_x ?? ((Et = e.transform) == null ? void 0 : Et.skew_x) ?? 0, N, tt), i.scale_x = this.lerp(i.scale_x ?? ((Ft = e.transform) == null ? void 0 : Ft.scale_x) ?? 1, (((wt = e.transform) == null ? void 0 : wt.scale_x) ?? 1) * (1 + z), tt), i.scale_y = this.lerp(i.scale_y ?? ((Xt = e.transform) == null ? void 0 : Xt.scale_y) ?? 1, (((Bt = e.transform) == null ? void 0 : Bt.scale_y) ?? 1) * (1 + z), tt), i.style = i.style || { ...e.style }, i.style.artEffect = { enabled: !0, type: "crumple_overlay", intensity: ((B = n.settings) == null ? void 0 : B.intensity) ?? 1, scale: ((nt = n.settings) == null ? void 0 : nt.scale) ?? 2 };
|
|
4903
4932
|
}
|
|
4904
|
-
} else if (n.type ===
|
|
4905
|
-
const
|
|
4906
|
-
c < (e.width || 100) && this.isMouseDown ? (i.scale_y = this.lerp(i.scale_y ?? 1, (((
|
|
4907
|
-
} else if (n.type ===
|
|
4908
|
-
const
|
|
4933
|
+
} else if (n.type === G.Squash) {
|
|
4934
|
+
const D = ((zt = n.settings) == null ? void 0 : zt.strength) || 0.8;
|
|
4935
|
+
c < (e.width || 100) && this.isMouseDown ? (i.scale_y = this.lerp(i.scale_y ?? 1, (((kt = e.transform) == null ? void 0 : kt.scale_y) ?? 1) * D, 0.3), i.scale_x = this.lerp(i.scale_x ?? 1, (((_t = e.transform) == null ? void 0 : _t.scale_x) ?? 1) * (1 + (1 - D) * 0.4), 0.3)) : (i.scale_y = this.lerp(i.scale_y ?? 1, ((Vt = e.transform) == null ? void 0 : Vt.scale_y) ?? 1, 0.2), i.scale_x = this.lerp(i.scale_x ?? 1, ((Ut = e.transform) == null ? void 0 : Ut.scale_x) ?? 1, 0.2));
|
|
4936
|
+
} else if (n.type === G.TextCounter) {
|
|
4937
|
+
const D = ((Jt = n.settings) == null ? void 0 : Jt.duration) || 2, N = ((qt = n.settings) == null ? void 0 : qt.from) || 0, z = ((Qt = n.settings) == null ? void 0 : Qt.to) || 100;
|
|
4909
4938
|
n._runtimeStart === void 0 && (n._runtimeStart = this.currentTime);
|
|
4910
|
-
const
|
|
4939
|
+
const tt = this.currentTime - n._runtimeStart, Pt = Math.min(1, tt / D), xt = Math.floor(N + (z - N) * Pt);
|
|
4911
4940
|
if (((oe = e.geometry) == null ? void 0 : oe.type) === "Text") {
|
|
4912
|
-
const
|
|
4913
|
-
i.geometry || (i.geometry = { ...e.geometry }), i.geometry.text = `${
|
|
4941
|
+
const Gt = ((jt = n.settings) == null ? void 0 : jt.prefix) || "", Zt = ((ee = n.settings) == null ? void 0 : ee.suffix) || "";
|
|
4942
|
+
i.geometry || (i.geometry = { ...e.geometry }), i.geometry.text = `${Gt}${xt}${Zt}`;
|
|
4914
4943
|
}
|
|
4915
|
-
} else if (n.type ===
|
|
4916
|
-
const
|
|
4917
|
-
if (c <
|
|
4918
|
-
const
|
|
4919
|
-
i.style || (i.style = { ...e.style }), i.style.adjustments || (i.style.adjustments = { ...(
|
|
4944
|
+
} else if (n.type === G.Spotlight) {
|
|
4945
|
+
const D = ((K = n.settings) == null ? void 0 : K.radius) || 250, N = ((ft = n.settings) == null ? void 0 : ft.strength) || 1.5;
|
|
4946
|
+
if (c < D) {
|
|
4947
|
+
const z = Math.pow(1 - c / D, 2);
|
|
4948
|
+
i.style || (i.style = { ...e.style }), i.style.adjustments || (i.style.adjustments = { ...(q = e.style) == null ? void 0 : q.adjustments }), i.style.adjustments.exposure = (((Z = (X = e.style) == null ? void 0 : X.adjustments) == null ? void 0 : Z.exposure) || 0) + z * N * 50;
|
|
4920
4949
|
} else
|
|
4921
|
-
(
|
|
4922
|
-
} else if (n.type ===
|
|
4923
|
-
const
|
|
4924
|
-
i.x += Math.sin(
|
|
4925
|
-
} else if (n.type ===
|
|
4926
|
-
const
|
|
4927
|
-
i.scale_x *= 1 +
|
|
4928
|
-
} else if (n.type ===
|
|
4929
|
-
const
|
|
4930
|
-
if (c <
|
|
4931
|
-
const
|
|
4932
|
-
this.applyBehaviorSensor(i, Kt.PositionX,
|
|
4950
|
+
(j = i.style) != null && j.adjustments && (i.style.adjustments.exposure = this.lerp(i.style.adjustments.exposure || 0, ((Rt = (Ot = e.style) == null ? void 0 : Ot.adjustments) == null ? void 0 : Rt.exposure) || 0, 0.1));
|
|
4951
|
+
} else if (n.type === G.Noise || n.type === G.Float) {
|
|
4952
|
+
const D = (((Tt = n.settings) == null ? void 0 : Tt.frequency) || ((Nt = n.settings) == null ? void 0 : Nt.speed) || 1) * 2e-3, N = (((bt = n.settings) == null ? void 0 : bt.amplitude) || ((L = n.settings) == null ? void 0 : L.range) || 50) * (((ct = n.settings) == null ? void 0 : ct.strength) || 1), z = Date.now();
|
|
4953
|
+
i.x += Math.sin(z * D) * N * t, i.y += Math.cos(z * D * 0.8) * N * t, i.rotation += Math.sin(z * D * 0.5) * 5 * t;
|
|
4954
|
+
} else if (n.type === G.Pulse) {
|
|
4955
|
+
const D = (((Dt = n.settings) == null ? void 0 : Dt.speed) || 1) * 5e-3, N = (((At = n.settings) == null ? void 0 : At.scale) || 1.2) - 1, z = Math.sin(Date.now() * D), tt = ((te = n.settings) == null ? void 0 : te.strength) || 1;
|
|
4956
|
+
i.scale_x *= 1 + z * N * tt * t, i.scale_y *= 1 + z * N * tt * t, i.style && (i.style.exposure = (i.style.exposure || 1) + Math.max(0, z) * 0.1 * tt * t);
|
|
4957
|
+
} else if (n.type === G.Draggable) {
|
|
4958
|
+
const D = ((Wt = n.settings) == null ? void 0 : Wt.radius) || 150, N = this.draggingBehaviors.has(e.id);
|
|
4959
|
+
if (c < D || N) {
|
|
4960
|
+
const z = ((Yt = n.settings) == null ? void 0 : Yt.strength) || 1, tt = N ? 1 : Math.max(0, 1 - c / D);
|
|
4961
|
+
this.applyBehaviorSensor(i, Kt.PositionX, tt * z, t, n.settings), this.applyBehaviorSensor(i, Kt.PositionY, tt * z, t, n.settings);
|
|
4933
4962
|
}
|
|
4934
|
-
} else if (n.type ===
|
|
4935
|
-
const
|
|
4936
|
-
(
|
|
4937
|
-
} else if (n.type ===
|
|
4938
|
-
const
|
|
4939
|
-
i.rotation +=
|
|
4940
|
-
} else if (n.type ===
|
|
4941
|
-
const
|
|
4942
|
-
i.style && (i.style.exposure = (i.style.exposure || 1) +
|
|
4943
|
-
} else if (n.type ===
|
|
4963
|
+
} else if (n.type === G.Scroll) {
|
|
4964
|
+
const D = (($t = n.settings) == null ? void 0 : $t.axis) || "vertical", N = ((rt = n.settings) == null ? void 0 : rt.factor) || 0.5, z = ((It = n.settings) == null ? void 0 : It.strength) || 1, tt = ((vt = n.settings) == null ? void 0 : vt.scaleFactor) || 0;
|
|
4965
|
+
(D === "vertical" || D === "both") && (i.y += this.scrollOffset.y * N * z * t), (D === "horizontal" || D === "both") && (i.x += this.scrollOffset.x * N * z * t), tt !== 0 && (i.scale_x *= 1 + this.scrollOffset.y * tt * t, i.scale_y *= 1 + this.scrollOffset.y * tt * t);
|
|
4966
|
+
} else if (n.type === G.LookAt) {
|
|
4967
|
+
const D = ((Ct = n.settings) == null ? void 0 : Ct.factor) || 1, N = ((mt = n.settings) == null ? void 0 : mt.strength) || 1, z = Math.atan2(-h, -l) * (180 / Math.PI), tt = i.rotation, Pt = (z - tt + 180) % 360 - 180;
|
|
4968
|
+
i.rotation += Pt * D * N * t * 10;
|
|
4969
|
+
} else if (n.type === G.Scan) {
|
|
4970
|
+
const D = (((Lt = n.settings) == null ? void 0 : Lt.speed) || 1) * 4e-3, N = ((lt = n.settings) == null ? void 0 : lt.strength) || 1, z = (Math.sin(Date.now() * D) + 1) / 2;
|
|
4971
|
+
i.style && (i.style.exposure = (i.style.exposure || 1) + z * N * t * 5), i.x += (z - 0.5) * 20 * N * t;
|
|
4972
|
+
} else if (n.type === G.Glint)
|
|
4944
4973
|
i.style = i.style || { ...e.style }, i.style.artEffect = {
|
|
4945
4974
|
enabled: !0,
|
|
4946
4975
|
type: "glint_overlay",
|
|
4947
4976
|
intensity: ((st = n.settings) == null ? void 0 : st.strength) ?? 0.8
|
|
4948
4977
|
};
|
|
4949
|
-
else if (n.type ===
|
|
4950
|
-
const
|
|
4951
|
-
i.rotation = this.lerp(i.rotation,
|
|
4952
|
-
} else if (n.type ===
|
|
4953
|
-
const
|
|
4978
|
+
else if (n.type === G.Ratchet) {
|
|
4979
|
+
const D = ((at = n.settings) == null ? void 0 : at.steps) || 12, N = (((Mt = n.settings) == null ? void 0 : Mt.speed) || 1) * 30, z = Math.floor(i.rotation / (360 / D)) * (360 / D);
|
|
4980
|
+
i.rotation = this.lerp(i.rotation, z + N * t, 0.1);
|
|
4981
|
+
} else if (n.type === G.Jitter && c < 300) {
|
|
4982
|
+
const D = ((V = n.settings) == null ? void 0 : V.strength) || 1, N = (((ut = n.settings) == null ? void 0 : ut.intensity) || 5) * D;
|
|
4954
4983
|
i.x += (Math.random() - 0.5) * N * t * 60, i.y += (Math.random() - 0.5) * N * t * 60, i.rotation += (Math.random() - 0.5) * N * t * 120;
|
|
4955
|
-
} else if (n.type ===
|
|
4956
|
-
const
|
|
4957
|
-
if (
|
|
4958
|
-
const N = this.objectStates.get(
|
|
4984
|
+
} else if (n.type === G.Follower) {
|
|
4985
|
+
const D = (gt = n.settings) == null ? void 0 : gt.targetId;
|
|
4986
|
+
if (D) {
|
|
4987
|
+
const N = this.objectStates.get(D);
|
|
4959
4988
|
if (N) {
|
|
4960
|
-
const
|
|
4961
|
-
i.x +=
|
|
4989
|
+
const z = ((ce = n.settings) == null ? void 0 : ce.stiffness) || 0.1, tt = N.x - i.x, Pt = N.y - i.y;
|
|
4990
|
+
i.x += tt * z * t * 60, i.y += Pt * z * t * 60;
|
|
4962
4991
|
}
|
|
4963
4992
|
}
|
|
4964
|
-
} else if (n.type ===
|
|
4993
|
+
} else if (n.type === G.Wrap)
|
|
4965
4994
|
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);
|
|
4966
|
-
else if (n.type ===
|
|
4967
|
-
const
|
|
4968
|
-
i.y +=
|
|
4969
|
-
} else if (n.type ===
|
|
4970
|
-
const
|
|
4971
|
-
i.x +=
|
|
4972
|
-
} else if (n.type ===
|
|
4973
|
-
const
|
|
4995
|
+
else if (n.type === G.Gravity) {
|
|
4996
|
+
const D = ((me = n.settings) == null ? void 0 : me.strength) || 9.8;
|
|
4997
|
+
i.y += D * t * 10;
|
|
4998
|
+
} else if (n.type === G.Velocity) {
|
|
4999
|
+
const D = ((Ie = n.settings) == null ? void 0 : Ie.vx) || 0, N = ((we = n.settings) == null ? void 0 : we.vy) || 0;
|
|
5000
|
+
i.x += D * t * 10, i.y += N * t * 10;
|
|
5001
|
+
} else if (n.type === G.Shear) {
|
|
5002
|
+
const D = ((Te = n.settings) == null ? void 0 : Te.strength) || 1, N = ((Ht = n.settings) == null ? void 0 : Ht.radius) || 300;
|
|
4974
5003
|
if (c < N) {
|
|
4975
|
-
const
|
|
4976
|
-
i.skew_x = this.lerp(i.skew_x || 0, (((se = e.transform) == null ? void 0 : se.skew_x) || 0) +
|
|
5004
|
+
const z = 1 - c / N;
|
|
5005
|
+
i.skew_x = this.lerp(i.skew_x || 0, (((se = e.transform) == null ? void 0 : se.skew_x) || 0) + z * D * 30, 0.1);
|
|
4977
5006
|
} else
|
|
4978
5007
|
i.skew_x = this.lerp(i.skew_x || 0, ((ue = e.transform) == null ? void 0 : ue.skew_x) || 0, 0.05);
|
|
4979
|
-
} else if (n.type ===
|
|
4980
|
-
const
|
|
4981
|
-
if (c <
|
|
4982
|
-
const
|
|
4983
|
-
i.scale_x = this.lerp(i.scale_x ?? 1, (((fe = e.transform) == null ? void 0 : fe.scale_x) ?? 1) * (1 +
|
|
5008
|
+
} else if (n.type === G.Lens) {
|
|
5009
|
+
const D = ((Me = n.settings) == null ? void 0 : Me.radius) || 200, N = ((ke = n.settings) == null ? void 0 : ke.strength) || 0.5;
|
|
5010
|
+
if (c < D) {
|
|
5011
|
+
const z = Math.pow(1 - c / D, 2);
|
|
5012
|
+
i.scale_x = this.lerp(i.scale_x ?? 1, (((fe = e.transform) == null ? void 0 : fe.scale_x) ?? 1) * (1 + z * N), 0.2), i.scale_y = this.lerp(i.scale_y ?? 1, (((re = e.transform) == null ? void 0 : re.scale_y) ?? 1) * (1 + z * N), 0.2);
|
|
4984
5013
|
} else
|
|
4985
5014
|
i.scale_x = this.lerp(i.scale_x ?? 1, ((le = e.transform) == null ? void 0 : le.scale_x) ?? 1, 0.1), i.scale_y = this.lerp(i.scale_y ?? 1, ((ye = e.transform) == null ? void 0 : ye.scale_y) ?? 1, 0.1);
|
|
4986
|
-
} else if (n.type ===
|
|
4987
|
-
const
|
|
5015
|
+
} else if (n.type === G.LayoutAnimation) {
|
|
5016
|
+
const D = ((_e = n.settings) == null ? void 0 : _e.watchProperties) || ["x", "y", "scale_x", "scale_y", "opacity", "rotation"], N = ((Ae = n.settings) == null ? void 0 : Ae.duration) || 0.3;
|
|
4988
5017
|
this._layoutAnimCache.has(e.id) || this._layoutAnimCache.set(e.id, /* @__PURE__ */ new Map());
|
|
4989
|
-
const
|
|
4990
|
-
for (const
|
|
4991
|
-
const
|
|
4992
|
-
if (
|
|
4993
|
-
const
|
|
4994
|
-
if (!
|
|
4995
|
-
|
|
4996
|
-
from:
|
|
4997
|
-
to:
|
|
5018
|
+
const z = this._layoutAnimCache.get(e.id);
|
|
5019
|
+
for (const tt of D) {
|
|
5020
|
+
const Pt = this.getObjectProperty(i, e, tt);
|
|
5021
|
+
if (Pt === void 0) continue;
|
|
5022
|
+
const xt = z.get(tt);
|
|
5023
|
+
if (!xt)
|
|
5024
|
+
z.set(tt, {
|
|
5025
|
+
from: Pt,
|
|
5026
|
+
to: Pt,
|
|
4998
5027
|
startTime: this.currentTime,
|
|
4999
5028
|
duration: 0
|
|
5000
5029
|
});
|
|
5001
|
-
else if (
|
|
5002
|
-
const Zt = this.getObjectProperty(i, e,
|
|
5003
|
-
|
|
5004
|
-
from: Zt ??
|
|
5005
|
-
to:
|
|
5030
|
+
else if (xt.to !== Pt) {
|
|
5031
|
+
const Zt = this.getObjectProperty(i, e, tt);
|
|
5032
|
+
z.set(tt, {
|
|
5033
|
+
from: Zt ?? xt.from,
|
|
5034
|
+
to: Pt,
|
|
5006
5035
|
startTime: this.currentTime,
|
|
5007
5036
|
duration: ((Oe = n.settings) == null ? void 0 : Oe.duration) ?? N
|
|
5008
5037
|
});
|
|
5009
5038
|
}
|
|
5010
|
-
const
|
|
5011
|
-
if (
|
|
5012
|
-
const Zt = this.currentTime -
|
|
5013
|
-
this.setObjectProperty(i, e,
|
|
5039
|
+
const Gt = z.get(tt);
|
|
5040
|
+
if (Gt.duration > 0 && Gt.from !== Gt.to) {
|
|
5041
|
+
const Zt = this.currentTime - Gt.startTime, he = Math.min(1, Zt / Gt.duration), be = this.applyEasing(he, ((Pe = n.settings) == null ? void 0 : Pe.easing) || "easeOutCubic"), ie = Gt.from + (Gt.to - Gt.from) * be;
|
|
5042
|
+
this.setObjectProperty(i, e, tt, ie);
|
|
5014
5043
|
}
|
|
5015
5044
|
}
|
|
5016
|
-
} else if (n.type ===
|
|
5045
|
+
} else if (n.type === G.StateReactive) {
|
|
5017
5046
|
this._layoutAnimCache.has(e.id) || this._layoutAnimCache.set(e.id, /* @__PURE__ */ new Map());
|
|
5018
|
-
const
|
|
5047
|
+
const D = this._layoutAnimCache.get(e.id), N = ((Re = n.settings) == null ? void 0 : Re.defaultDuration) || 0.3, z = [
|
|
5019
5048
|
"x",
|
|
5020
5049
|
"y",
|
|
5021
5050
|
"scale_x",
|
|
@@ -5030,69 +5059,69 @@ class ci {
|
|
|
5030
5059
|
"style.shadow.offsetX",
|
|
5031
5060
|
"style.shadow.offsetY"
|
|
5032
5061
|
];
|
|
5033
|
-
for (const
|
|
5034
|
-
const
|
|
5035
|
-
if (
|
|
5036
|
-
const
|
|
5037
|
-
if (!
|
|
5038
|
-
|
|
5039
|
-
from:
|
|
5040
|
-
to:
|
|
5062
|
+
for (const tt of z) {
|
|
5063
|
+
const Pt = this.getObjectProperty(i, e, tt);
|
|
5064
|
+
if (Pt === void 0 || typeof Pt != "number") continue;
|
|
5065
|
+
const xt = D.get(tt);
|
|
5066
|
+
if (!xt)
|
|
5067
|
+
D.set(tt, {
|
|
5068
|
+
from: Pt,
|
|
5069
|
+
to: Pt,
|
|
5041
5070
|
startTime: this.currentTime,
|
|
5042
5071
|
duration: 0
|
|
5043
5072
|
});
|
|
5044
|
-
else if (
|
|
5045
|
-
const Zt = this.getObjectProperty(i, e,
|
|
5046
|
-
|
|
5047
|
-
from: Zt ??
|
|
5048
|
-
to:
|
|
5073
|
+
else if (xt.to !== Pt) {
|
|
5074
|
+
const Zt = this.getObjectProperty(i, e, tt);
|
|
5075
|
+
D.set(tt, {
|
|
5076
|
+
from: Zt ?? xt.from,
|
|
5077
|
+
to: Pt,
|
|
5049
5078
|
startTime: this.currentTime,
|
|
5050
5079
|
duration: N
|
|
5051
5080
|
});
|
|
5052
5081
|
}
|
|
5053
|
-
const
|
|
5054
|
-
if (
|
|
5055
|
-
const Zt = this.currentTime -
|
|
5056
|
-
this.setObjectProperty(i, e,
|
|
5082
|
+
const Gt = D.get(tt);
|
|
5083
|
+
if (Gt.duration > 0 && Gt.from !== Gt.to) {
|
|
5084
|
+
const Zt = this.currentTime - Gt.startTime, he = Math.min(1, Zt / Gt.duration), be = this.applyEasing(he, ((Le = n.settings) == null ? void 0 : Le.defaultEasing) || "easeOutCubic"), ie = Gt.from + (Gt.to - Gt.from) * be;
|
|
5085
|
+
this.setObjectProperty(i, e, tt, ie);
|
|
5057
5086
|
}
|
|
5058
5087
|
}
|
|
5059
|
-
} else if (n.type ===
|
|
5060
|
-
const
|
|
5088
|
+
} else if (n.type === G.SpringChain) {
|
|
5089
|
+
const D = ((De = n.settings) == null ? void 0 : De.connections) || [], N = ((ze = n.settings) == null ? void 0 : ze.globalDamping) || 0.3;
|
|
5061
5090
|
this._springChainState.has(e.id) || this._springChainState.set(e.id, /* @__PURE__ */ new Map());
|
|
5062
|
-
const
|
|
5063
|
-
for (const
|
|
5064
|
-
if (!
|
|
5065
|
-
const
|
|
5066
|
-
|
|
5067
|
-
x: (
|
|
5068
|
-
y: (
|
|
5091
|
+
const z = this._springChainState.get(e.id);
|
|
5092
|
+
for (const Pt of D) {
|
|
5093
|
+
if (!z.has(Pt.targetId)) {
|
|
5094
|
+
const xt = this.objectStates.get(Pt.targetId);
|
|
5095
|
+
z.set(Pt.targetId, {
|
|
5096
|
+
x: (xt == null ? void 0 : xt.x) ?? 0,
|
|
5097
|
+
y: (xt == null ? void 0 : xt.y) ?? 0,
|
|
5069
5098
|
vx: 0,
|
|
5070
5099
|
vy: 0
|
|
5071
5100
|
});
|
|
5072
5101
|
}
|
|
5073
|
-
|
|
5102
|
+
z.has(e.id) || z.set(e.id, { x: i.x, y: i.y, vx: 0, vy: 0 });
|
|
5074
5103
|
}
|
|
5075
|
-
const
|
|
5076
|
-
if (
|
|
5077
|
-
|
|
5078
|
-
for (const
|
|
5079
|
-
const
|
|
5080
|
-
if (!
|
|
5081
|
-
const
|
|
5082
|
-
|
|
5083
|
-
const de = this.objectStates.get(
|
|
5084
|
-
de && (de.x +=
|
|
5104
|
+
const tt = z.get(e.id);
|
|
5105
|
+
if (tt) {
|
|
5106
|
+
tt.x = i.x, tt.y = i.y;
|
|
5107
|
+
for (const Pt of D) {
|
|
5108
|
+
const xt = z.get(Pt.targetId);
|
|
5109
|
+
if (!xt) continue;
|
|
5110
|
+
const Gt = xt.x - tt.x, Zt = xt.y - tt.y, he = Math.sqrt(Gt * Gt + Zt * Zt) || 1e-3, ie = (he - (Pt.restLength || 50)) * (Pt.stiffness || 0.8), pe = Gt / he * ie, Fe = Zt / he * ie;
|
|
5111
|
+
tt.vx += pe * t * 10, tt.vy += Fe * t * 10, xt.vx -= pe * t * 10, xt.vy -= Fe * t * 10, tt.vx *= 1 - N * t * 10, tt.vy *= 1 - N * t * 10, xt.vx *= 1 - N * t * 10, xt.vy *= 1 - N * t * 10;
|
|
5112
|
+
const de = this.objectStates.get(Pt.targetId);
|
|
5113
|
+
de && (de.x += xt.vx * t, de.y += xt.vy * t);
|
|
5085
5114
|
}
|
|
5086
|
-
i.x +=
|
|
5115
|
+
i.x += tt.vx * t, i.y += tt.vy * t;
|
|
5087
5116
|
}
|
|
5088
|
-
} else if (n.type ===
|
|
5089
|
-
const
|
|
5117
|
+
} else if (n.type === G.ParticleEmitter) {
|
|
5118
|
+
const D = ((Ve = n.settings) == null ? void 0 : Ve.rate) || 10, N = ((Ne = n.settings) == null ? void 0 : Ne.speed) || 100, z = ((He = n.settings) == null ? void 0 : He.size) || 5, tt = ((Ue = n.settings) == null ? void 0 : Ue.lifetime) || 2, Pt = ((qe = n.settings) == null ? void 0 : qe.gravity) || 0, xt = ((Je = n.settings) == null ? void 0 : Je.color) || "#ffffff", Gt = ((Qe = n.settings) == null ? void 0 : Qe.maxParticles) || 200, Zt = (Ke = n.settings) != null && Ke.rateInputId ? this.inputs.get(n.settings.rateInputId) ?? D : D, he = (Ze = n.settings) != null && Ze.gravityInputId ? this.inputs.get(n.settings.gravityInputId) ?? Pt : Pt, be = (je = n.settings) != null && je.speedInputId ? this.inputs.get(n.settings.speedInputId) ?? N : N;
|
|
5090
5119
|
this._emitterPools.has(e.id) || this._emitterPools.set(e.id, []);
|
|
5091
5120
|
const ie = this._emitterPools.get(e.id);
|
|
5092
5121
|
let pe = 0;
|
|
5093
5122
|
n._pendingBurst && n._pendingBurst > 0 && (pe = n._pendingBurst, n._pendingBurst = 0);
|
|
5094
5123
|
const Fe = Math.floor(Zt * t) + (pe || 0);
|
|
5095
|
-
for (let de = 0; de < Math.min(Fe,
|
|
5124
|
+
for (let de = 0; de < Math.min(Fe, Gt - ie.length); de++) {
|
|
5096
5125
|
const ne = Math.random() * Math.PI * 2, ts = be * (0.5 + Math.random() * 0.5);
|
|
5097
5126
|
ie.push({
|
|
5098
5127
|
x: i.x,
|
|
@@ -5100,9 +5129,9 @@ class ci {
|
|
|
5100
5129
|
vx: Math.cos(ne) * ts,
|
|
5101
5130
|
vy: Math.sin(ne) * ts,
|
|
5102
5131
|
life: 0,
|
|
5103
|
-
maxLife:
|
|
5104
|
-
size:
|
|
5105
|
-
color:
|
|
5132
|
+
maxLife: tt * (0.5 + Math.random() * 0.5),
|
|
5133
|
+
size: z * (0.5 + Math.random()),
|
|
5134
|
+
color: xt,
|
|
5106
5135
|
opacity: 1
|
|
5107
5136
|
});
|
|
5108
5137
|
}
|
|
@@ -5115,88 +5144,88 @@ class ci {
|
|
|
5115
5144
|
});
|
|
5116
5145
|
}
|
|
5117
5146
|
applyBehaviorSensor(t, s, o, e, i, n, a = 0, r = 0, l = 1) {
|
|
5118
|
-
var d, u, m, y, v, b, C, S, I, w, M,
|
|
5147
|
+
var d, u, m, y, v, b, C, S, I, w, M, _, T, $, k, E, R, A, O, W, x, Y, H, Q;
|
|
5119
5148
|
const h = (i == null ? void 0 : i.intensity) || (i == null ? void 0 : i.strength) || 1, c = Math.min(1, 15 * e), g = l > 0 ? a / l : 0, f = l > 0 ? r / l : 0;
|
|
5120
5149
|
switch (s) {
|
|
5121
5150
|
case Kt.Scale: {
|
|
5122
|
-
const
|
|
5123
|
-
t.scale_x = (t.scale_x ??
|
|
5151
|
+
const P = ((d = n == null ? void 0 : n.transform) == null ? void 0 : d.scale_x) ?? 1, F = ((u = n == null ? void 0 : n.transform) == null ? void 0 : u.scale_y) ?? 1, U = P * (1 + o * h * 0.4), J = F * (1 + o * h * 0.4);
|
|
5152
|
+
t.scale_x = (t.scale_x ?? P) * (1 - c) + U * c, t.scale_y = (t.scale_y ?? F) * (1 - c) + J * c;
|
|
5124
5153
|
break;
|
|
5125
5154
|
}
|
|
5126
5155
|
case Kt.Opacity: {
|
|
5127
|
-
const
|
|
5128
|
-
t.opacity = (t.opacity ??
|
|
5156
|
+
const P = ((m = n == null ? void 0 : n.transform) == null ? void 0 : m.opacity) ?? 100, F = Math.max(0, Math.min(100, P - o * h * 100));
|
|
5157
|
+
t.opacity = (t.opacity ?? P) * (1 - c) + F * c;
|
|
5129
5158
|
break;
|
|
5130
5159
|
}
|
|
5131
5160
|
case Kt.RotateZ: {
|
|
5132
|
-
const
|
|
5133
|
-
t.rotation = (t.rotation ??
|
|
5161
|
+
const P = ((y = n == null ? void 0 : n.transform) == null ? void 0 : y.rotation) ?? 0, F = P + o * h * 45;
|
|
5162
|
+
t.rotation = (t.rotation ?? P) * (1 - c) + F * c;
|
|
5134
5163
|
break;
|
|
5135
5164
|
}
|
|
5136
5165
|
case Kt.RotateX: {
|
|
5137
|
-
const
|
|
5138
|
-
t.rotate_x = (t.rotate_x ??
|
|
5166
|
+
const P = ((v = n == null ? void 0 : n.transform) == null ? void 0 : v.rotate_x) ?? 0, F = P - f * o * h * 60;
|
|
5167
|
+
t.rotate_x = (t.rotate_x ?? P) * (1 - c) + F * c;
|
|
5139
5168
|
break;
|
|
5140
5169
|
}
|
|
5141
5170
|
case Kt.RotateY: {
|
|
5142
|
-
const
|
|
5143
|
-
t.rotate_y = (t.rotate_y ??
|
|
5171
|
+
const P = ((b = n == null ? void 0 : n.transform) == null ? void 0 : b.rotate_y) ?? 0, F = P + g * o * h * 60;
|
|
5172
|
+
t.rotate_y = (t.rotate_y ?? P) * (1 - c) + F * c;
|
|
5144
5173
|
break;
|
|
5145
5174
|
}
|
|
5146
5175
|
case Kt.PositionX: {
|
|
5147
|
-
const
|
|
5148
|
-
t.x = (t.x ??
|
|
5176
|
+
const P = ((C = n == null ? void 0 : n.transform) == null ? void 0 : C.x) ?? 0, F = P - g * o * h * 40;
|
|
5177
|
+
t.x = (t.x ?? P) * (1 - c) + F * c;
|
|
5149
5178
|
break;
|
|
5150
5179
|
}
|
|
5151
5180
|
case Kt.PositionY: {
|
|
5152
|
-
const
|
|
5153
|
-
t.y = (t.y ??
|
|
5181
|
+
const P = ((S = n == null ? void 0 : n.transform) == null ? void 0 : S.y) ?? 0, F = P - f * o * h * 40;
|
|
5182
|
+
t.y = (t.y ?? P) * (1 - c) + F * c;
|
|
5154
5183
|
break;
|
|
5155
5184
|
}
|
|
5156
5185
|
case Kt.SkewX: {
|
|
5157
|
-
const
|
|
5158
|
-
t.skew_x = (t.skew_x ??
|
|
5186
|
+
const P = ((I = n == null ? void 0 : n.transform) == null ? void 0 : I.skew_x) ?? 0, F = P + g * o * h * 45;
|
|
5187
|
+
t.skew_x = (t.skew_x ?? P) * (1 - c) + F * c, t.skew_x > 85 && (t.skew_x = 85), t.skew_x < -85 && (t.skew_x = -85);
|
|
5159
5188
|
break;
|
|
5160
5189
|
}
|
|
5161
5190
|
case Kt.Blur: {
|
|
5162
5191
|
t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.blur || (t.style.blur = { ...(w = n == null ? void 0 : n.style) == null ? void 0 : w.blur });
|
|
5163
|
-
const
|
|
5164
|
-
t.style.blur.amount = (t.style.blur.amount ??
|
|
5192
|
+
const P = ((_ = (M = n == null ? void 0 : n.style) == null ? void 0 : M.blur) == null ? void 0 : _.amount) || 0, F = P + o * ((i == null ? void 0 : i.blur) || 20) * h;
|
|
5193
|
+
t.style.blur.amount = (t.style.blur.amount ?? P) * (1 - c) + F * c;
|
|
5165
5194
|
break;
|
|
5166
5195
|
}
|
|
5167
5196
|
case Kt.Exposure: {
|
|
5168
5197
|
t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.adjustments || (t.style.adjustments = { ...(T = n == null ? void 0 : n.style) == null ? void 0 : T.adjustments });
|
|
5169
|
-
const
|
|
5170
|
-
t.style.adjustments.exposure = (t.style.adjustments.exposure ??
|
|
5198
|
+
const P = ((k = ($ = n == null ? void 0 : n.style) == null ? void 0 : $.adjustments) == null ? void 0 : k.exposure) || 0, F = P + o * ((i == null ? void 0 : i.exposure) || 50) * h;
|
|
5199
|
+
t.style.adjustments.exposure = (t.style.adjustments.exposure ?? P) * (1 - c) + F * c;
|
|
5171
5200
|
break;
|
|
5172
5201
|
}
|
|
5173
5202
|
case Kt.HueShift: {
|
|
5174
|
-
t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.adjustments || (t.style.adjustments = { ...(
|
|
5175
|
-
const
|
|
5176
|
-
t.style.adjustments.hue = (t.style.adjustments.hue ??
|
|
5203
|
+
t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.adjustments || (t.style.adjustments = { ...(E = n == null ? void 0 : n.style) == null ? void 0 : E.adjustments });
|
|
5204
|
+
const P = ((A = (R = n == null ? void 0 : n.style) == null ? void 0 : R.adjustments) == null ? void 0 : A.hue) || 0, F = P + o * ((i == null ? void 0 : i.hue) || 180) * h;
|
|
5205
|
+
t.style.adjustments.hue = (t.style.adjustments.hue ?? P) * (1 - c) + F * c;
|
|
5177
5206
|
break;
|
|
5178
5207
|
}
|
|
5179
5208
|
case Kt.Negative: {
|
|
5180
|
-
t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.adjustments || (t.style.adjustments = { ...(
|
|
5181
|
-
const
|
|
5182
|
-
t.style.adjustments.negative = (t.style.adjustments.negative ??
|
|
5209
|
+
t.style || (t.style = { ...n == null ? void 0 : n.style }), t.style.adjustments || (t.style.adjustments = { ...(O = n == null ? void 0 : n.style) == null ? void 0 : O.adjustments });
|
|
5210
|
+
const P = ((x = (W = n == null ? void 0 : n.style) == null ? void 0 : W.adjustments) == null ? void 0 : x.negative) || 0, F = P + o * ((i == null ? void 0 : i.negative) || 100) * h;
|
|
5211
|
+
t.style.adjustments.negative = (t.style.adjustments.negative ?? P) * (1 - c) + F * c;
|
|
5183
5212
|
break;
|
|
5184
5213
|
}
|
|
5185
5214
|
case Kt.CornerRadius: {
|
|
5186
|
-
const
|
|
5187
|
-
t.corner_radius = (t.corner_radius ??
|
|
5215
|
+
const P = ((Y = n == null ? void 0 : n.transform) == null ? void 0 : Y.corner_radius) || 0, F = P + o * h * 50;
|
|
5216
|
+
t.corner_radius = (t.corner_radius ?? P) * (1 - c) + F * c;
|
|
5188
5217
|
break;
|
|
5189
5218
|
}
|
|
5190
5219
|
case Kt.StrokeWidth: {
|
|
5191
5220
|
t.style || (t.style = { ...n == null ? void 0 : n.style });
|
|
5192
|
-
const
|
|
5193
|
-
t.style.borderWidth = (t.style.borderWidth ??
|
|
5221
|
+
const P = ((H = n == null ? void 0 : n.style) == null ? void 0 : H.borderWidth) || 0, F = P + o * h * 10;
|
|
5222
|
+
t.style.borderWidth = (t.style.borderWidth ?? P) * (1 - c) + F * c;
|
|
5194
5223
|
break;
|
|
5195
5224
|
}
|
|
5196
5225
|
case Kt.LetterSpacing: {
|
|
5197
5226
|
t.geometry || (t.geometry = {});
|
|
5198
|
-
const
|
|
5199
|
-
t.geometry.letterSpacing = (t.geometry.letterSpacing ??
|
|
5227
|
+
const P = ((Q = n == null ? void 0 : n.geometry) == null ? void 0 : Q.letterSpacing) || 0, F = P + o * h * 10;
|
|
5228
|
+
t.geometry.letterSpacing = (t.geometry.letterSpacing ?? P) * (1 - c) + F * c;
|
|
5200
5229
|
break;
|
|
5201
5230
|
}
|
|
5202
5231
|
}
|
|
@@ -5302,75 +5331,75 @@ const yi = Cs(({
|
|
|
5302
5331
|
mouseX: I,
|
|
5303
5332
|
mouseY: w,
|
|
5304
5333
|
isMouseDown: M,
|
|
5305
|
-
inputs:
|
|
5334
|
+
inputs: _,
|
|
5306
5335
|
interactive: T = !0,
|
|
5307
|
-
onNavigation:
|
|
5336
|
+
onNavigation: $
|
|
5308
5337
|
}, k) => {
|
|
5309
|
-
const
|
|
5310
|
-
Ss(k, () =>
|
|
5311
|
-
H.current = !1,
|
|
5338
|
+
const E = ve(null), R = ve(new ci()), A = ve(void 0), O = ve(0), W = ve(null), x = ve(b), [, Y] = ds(p || null), H = ve(!0);
|
|
5339
|
+
Ss(k, () => E.current), Se(() => (H.current = !0, () => {
|
|
5340
|
+
H.current = !1, A.current && cancelAnimationFrame(A.current);
|
|
5312
5341
|
}), []), Se(() => {
|
|
5313
|
-
|
|
5342
|
+
R.current.setLayout(e, i);
|
|
5314
5343
|
}, [e, i]), Se(() => {
|
|
5315
|
-
const
|
|
5316
|
-
a &&
|
|
5317
|
-
}, [a, r, l, h, c, g, f, d, u, m, y,
|
|
5344
|
+
const P = R.current;
|
|
5345
|
+
a && P.setTriggerCallback(a), r && P.setInputUpdateCallback((F, U) => r({ [F]: U })), l && P.setComponentChangeCallback((F) => l(F)), h && P.setToggleCallback(h), c && P.setInputChangeCallback(c), g && P.setInputFocusCallback(g), f && P.setInputBlurCallback(f), d && P.setOnLogCallback((F) => d(F, "info")), u && P.setLogicUpdateCallback(u), m && P.setButtonClickCallback(m), y && P.setGraphPointClickCallback((F) => y(F.objectId, F)), $ && P.setNavigationCallback($);
|
|
5346
|
+
}, [a, r, l, h, c, g, f, d, u, m, y, $]), Se(() => {
|
|
5318
5347
|
(async () => {
|
|
5319
5348
|
let F = p;
|
|
5320
5349
|
if (t && !p)
|
|
5321
5350
|
try {
|
|
5322
5351
|
t.startsWith("{") ? F = JSON.parse(t) : F = await (await fetch(t)).json();
|
|
5323
|
-
} catch (
|
|
5324
|
-
console.error("[ExodeUI] Failed to load src:",
|
|
5352
|
+
} catch (U) {
|
|
5353
|
+
console.error("[ExodeUI] Failed to load src:", U);
|
|
5325
5354
|
}
|
|
5326
5355
|
if (F) {
|
|
5327
|
-
const
|
|
5328
|
-
(
|
|
5356
|
+
const U = R.current, J = F.id || F.name || "default";
|
|
5357
|
+
(W.current !== J || x.current !== b) && (U.load(F), W.current = J, x.current = b, Y(F), O.current = 0, U.advance(0)), n && n(U);
|
|
5329
5358
|
}
|
|
5330
5359
|
})();
|
|
5331
5360
|
}, [p == null ? void 0 : p.id, t, b]), Se(() => {
|
|
5332
|
-
const
|
|
5333
|
-
if (!
|
|
5334
|
-
const
|
|
5335
|
-
if (!
|
|
5336
|
-
const it =
|
|
5361
|
+
const P = (F) => {
|
|
5362
|
+
if (!R.current || !H.current) return;
|
|
5363
|
+
const U = R.current, J = E.current;
|
|
5364
|
+
if (!J) return;
|
|
5365
|
+
const it = J.getContext("2d");
|
|
5337
5366
|
if (!it) return;
|
|
5338
5367
|
const dt = F / 1e3;
|
|
5339
|
-
|
|
5340
|
-
let
|
|
5341
|
-
|
|
5342
|
-
const ht =
|
|
5343
|
-
(
|
|
5368
|
+
O.current === 0 && (O.current = dt);
|
|
5369
|
+
let yt = dt - O.current;
|
|
5370
|
+
yt > 0.1 && (yt = 0.1), O.current = dt;
|
|
5371
|
+
const ht = J.getBoundingClientRect(), pt = window.devicePixelRatio || 1, ot = Math.round(ht.width * pt), Et = Math.round(ht.height * pt);
|
|
5372
|
+
(J.width !== ot || J.height !== Et) && (J.width = ot, J.height = Et), o ? U.advance(yt) : v !== void 0 && U.seek(v), U.render(it, J.width, J.height), A.current = requestAnimationFrame(P);
|
|
5344
5373
|
};
|
|
5345
|
-
return
|
|
5346
|
-
|
|
5374
|
+
return A.current = requestAnimationFrame(P), () => {
|
|
5375
|
+
A.current && cancelAnimationFrame(A.current);
|
|
5347
5376
|
};
|
|
5348
5377
|
}, [o, v]), Se(() => {
|
|
5349
|
-
const
|
|
5350
|
-
C !== void 0 &&
|
|
5351
|
-
}, [C, S, I, w, M,
|
|
5352
|
-
const
|
|
5353
|
-
if (!T || !
|
|
5354
|
-
const
|
|
5355
|
-
|
|
5378
|
+
const P = R.current;
|
|
5379
|
+
C !== void 0 && P.updateInput("scrollY", C), S !== void 0 && P.updateInput("scrollX", S), I !== void 0 && P.updateInput("mouseX", I), w !== void 0 && P.updateInput("mouseY", w), M !== void 0 && P.updateInput("isMouseDown", M), _ && Object.entries(_).forEach(([F, U]) => P.updateInput(F, U));
|
|
5380
|
+
}, [C, S, I, w, M, _]);
|
|
5381
|
+
const Q = (P, F) => {
|
|
5382
|
+
if (!T || !E.current) return;
|
|
5383
|
+
const U = E.current, J = U.getBoundingClientRect(), it = P.clientX - J.left, dt = P.clientY - J.top, yt = window.devicePixelRatio || 1;
|
|
5384
|
+
R.current.handlePointerInput(F, it * yt, dt * yt, U.width, U.height);
|
|
5356
5385
|
};
|
|
5357
5386
|
return /* @__PURE__ */ Ce(
|
|
5358
5387
|
"canvas",
|
|
5359
5388
|
{
|
|
5360
|
-
ref:
|
|
5361
|
-
onPointerDown: (
|
|
5389
|
+
ref: E,
|
|
5390
|
+
onPointerDown: (P) => {
|
|
5362
5391
|
var F;
|
|
5363
|
-
|
|
5392
|
+
Q(P, "down"), (F = E.current) == null || F.focus();
|
|
5364
5393
|
},
|
|
5365
|
-
onPointerMove: (
|
|
5366
|
-
onPointerUp: (
|
|
5367
|
-
onPointerCancel: (
|
|
5368
|
-
onClick: (
|
|
5369
|
-
onWheel: (
|
|
5370
|
-
|
|
5394
|
+
onPointerMove: (P) => Q(P, "move"),
|
|
5395
|
+
onPointerUp: (P) => Q(P, "up"),
|
|
5396
|
+
onPointerCancel: (P) => Q(P, "up"),
|
|
5397
|
+
onClick: (P) => Q(P, "click"),
|
|
5398
|
+
onWheel: (P) => {
|
|
5399
|
+
R.current.handleWheel(P.deltaX, P.deltaY);
|
|
5371
5400
|
},
|
|
5372
|
-
onKeyDown: (
|
|
5373
|
-
onContextMenu: (
|
|
5401
|
+
onKeyDown: (P) => R.current.handleKeyDown(P.nativeEvent),
|
|
5402
|
+
onContextMenu: (P) => P.preventDefault(),
|
|
5374
5403
|
tabIndex: 0,
|
|
5375
5404
|
style: {
|
|
5376
5405
|
...s,
|
|
@@ -5488,17 +5517,17 @@ const vi = ({ artboard: p, config: t }) => {
|
|
|
5488
5517
|
]
|
|
5489
5518
|
}
|
|
5490
5519
|
);
|
|
5491
|
-
}, fi = "6.3.
|
|
5520
|
+
}, fi = "6.3.20", hi = {
|
|
5492
5521
|
version: fi
|
|
5493
5522
|
}, Ci = hi.version;
|
|
5494
5523
|
export {
|
|
5495
5524
|
Kt as BehaviorSensor,
|
|
5496
|
-
|
|
5525
|
+
G as BehaviorType,
|
|
5497
5526
|
Ms as ConditionOp,
|
|
5498
5527
|
vi as ExodeSEO,
|
|
5499
5528
|
yi as ExodeUICanvas,
|
|
5500
5529
|
ci as ExodeUIEngine,
|
|
5501
|
-
|
|
5530
|
+
St as LogicOp,
|
|
5502
5531
|
Ci as VERSION,
|
|
5503
5532
|
bi as useExodeUI
|
|
5504
5533
|
};
|