exodeui 6.3.29 → 6.3.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +19 -19
- package/dist/index.mjs +318 -315
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -598,16 +598,16 @@ const ps = (g) => g, Rs = (g) => g > 0 ? 1 : 0, xs = (g) => g < 1 ? 0 : 1, is =
|
|
|
598
598
|
const A = i[b[0].boneId] || [1, 0, 0, 1, 0, 0], _ = A[0] * A[3] - A[1] * A[2];
|
|
599
599
|
let L = 0, X = 0;
|
|
600
600
|
if (_ !== 0) {
|
|
601
|
-
const V = (A[2] * A[5] - A[3] * A[4]) / _, it = (A[1] * A[4] - A[0] * A[5]) / _,
|
|
601
|
+
const V = (A[2] * A[5] - A[3] * A[4]) / _, it = (A[1] * A[4] - A[0] * A[5]) / _, lt = Math.atan2(-A[1], A[3]);
|
|
602
602
|
if (!H)
|
|
603
603
|
L = V, X = it;
|
|
604
604
|
else {
|
|
605
|
-
const
|
|
606
|
-
L = V - It * Math.sin(
|
|
605
|
+
const ht = -A[2] / _, wt = A[0] / _, Mt = Math.hypot(ht, wt), It = M.length * Mt;
|
|
606
|
+
L = V - It * Math.sin(lt), X = it + It * Math.cos(lt);
|
|
607
607
|
}
|
|
608
|
-
const nt = Math.hypot(y - L, m - X),
|
|
609
|
-
if (
|
|
610
|
-
const
|
|
608
|
+
const nt = Math.hypot(y - L, m - X), bt = Math.hypot(f - $, u - Y);
|
|
609
|
+
if (bt > 0 && nt > 0) {
|
|
610
|
+
const ht = Math.max(bt, 0.01), wt = Math.min(nt / ht, 3), Mt = $ + (f - $) * wt, It = Y + (u - Y) * wt, Ot = b[0].amount, At = b[1].amount, Tt = Math.min(Ot, At) * 2, zt = 1 - Math.pow(1 - Tt, 4);
|
|
611
611
|
f = f * (1 - zt) + Mt * zt, u = u * (1 - zt) + It * zt;
|
|
612
612
|
}
|
|
613
613
|
}
|
|
@@ -2924,13 +2924,13 @@ class ci {
|
|
|
2924
2924
|
this.warn("No state for object:", i.id);
|
|
2925
2925
|
return;
|
|
2926
2926
|
}
|
|
2927
|
-
this.frameCount % 60, t.roundRect || (t.roundRect = (L, X, V, it,
|
|
2927
|
+
this.frameCount % 60, t.roundRect || (t.roundRect = (L, X, V, it, lt) => (this.drawRoundRect(t, L, X, V, it, lt), t));
|
|
2928
2928
|
const s = e.geometry ? this.deepMerge(i.geometry, e.geometry) : i.geometry, n = e.style ? this.deepMerge(i.style, e.style) : i.style;
|
|
2929
2929
|
let a = (s == null ? void 0 : s.width) || ((p = i.geometry) == null ? void 0 : p.width) || i.width || 0, r = (s == null ? void 0 : s.height) || ((y = i.geometry) == null ? void 0 : y.height) || i.height || 0;
|
|
2930
2930
|
if ((a === 0 || r === 0) && (s != null && s.points) && Array.isArray(s.points) && s.points.length > 0) {
|
|
2931
2931
|
let L = 1 / 0, X = -1 / 0, V = 1 / 0, it = -1 / 0;
|
|
2932
|
-
s.points.forEach((
|
|
2933
|
-
L = Math.min(L,
|
|
2932
|
+
s.points.forEach((lt) => {
|
|
2933
|
+
L = Math.min(L, lt.x), X = Math.max(X, lt.x), V = Math.min(V, lt.y), it = Math.max(it, lt.y);
|
|
2934
2934
|
}), a === 0 && (a = X - L), r === 0 && (r = it - V);
|
|
2935
2935
|
}
|
|
2936
2936
|
const l = (L) => {
|
|
@@ -2955,23 +2955,23 @@ class ci {
|
|
|
2955
2955
|
return;
|
|
2956
2956
|
const u = i.repeaterConfig, h = u && u.isEnabled && u.count > 1, d = h ? u.count : 1;
|
|
2957
2957
|
for (let L = 0; L < d; L++) {
|
|
2958
|
-
let X = e.x !== void 0 ? e.x : ((m = e.transform) == null ? void 0 : m.x) ?? 0, V = e.y !== void 0 ? e.y : ((b = e.transform) == null ? void 0 : b.y) ?? 0, it = e.rotation !== void 0 ? e.rotation : ((v = e.transform) == null ? void 0 : v.rotation) ?? 0,
|
|
2958
|
+
let X = e.x !== void 0 ? e.x : ((m = e.transform) == null ? void 0 : m.x) ?? 0, V = e.y !== void 0 ? e.y : ((b = e.transform) == null ? void 0 : b.y) ?? 0, it = e.rotation !== void 0 ? e.rotation : ((v = e.transform) == null ? void 0 : v.rotation) ?? 0, lt = e.scale_x !== void 0 ? e.scale_x : ((S = e.transform) == null ? void 0 : S.scale_x) ?? 1, nt = e.scale_y !== void 0 ? e.scale_y : ((C = e.transform) == null ? void 0 : C.scale_y) ?? 1;
|
|
2959
2959
|
if (h && L > 0) {
|
|
2960
2960
|
if (u.type === "Linear") {
|
|
2961
|
-
const
|
|
2962
|
-
X += L *
|
|
2961
|
+
const at = u.offsetX || 0, gt = u.offsetY || 0, j = u.rotation || 0, z = u.scale !== void 0 ? u.scale : 1;
|
|
2962
|
+
X += L * at, V += L * gt, it += L * j, lt *= Math.pow(z, L), nt *= Math.pow(z, L);
|
|
2963
2963
|
} else if (u.type === "Grid") {
|
|
2964
|
-
const
|
|
2965
|
-
X += D * et, V += z *
|
|
2964
|
+
const at = u.cols || Math.ceil(Math.sqrt(u.count)), gt = u.gapX || 0, j = u.gapY || 0, z = Math.floor(L / at), D = L % at, et = a + gt, mt = r + j;
|
|
2965
|
+
X += D * et, V += z * mt;
|
|
2966
2966
|
} else if (u.type === "Radial") {
|
|
2967
|
-
const
|
|
2968
|
-
X = e.x +
|
|
2967
|
+
const at = u.radius || 100, gt = u.startAngle || 0, z = (u.endAngle || 360) - gt, D = u.count > 1 ? z / (z === 360 ? u.count : u.count - 1) : 0, et = gt + L * D, mt = et * Math.PI / 180;
|
|
2968
|
+
X = e.x + at * Math.cos(mt), V = e.y + at * Math.sin(mt), it += et;
|
|
2969
2969
|
}
|
|
2970
2970
|
}
|
|
2971
|
-
const
|
|
2972
|
-
if (!
|
|
2973
|
-
const
|
|
2974
|
-
if (!this.isObjectInView(t, X, V, a, r,
|
|
2971
|
+
const bt = i.type === "Group" || i.type === "Frame" || i.type === "Component", ht = a > 0 && r > 0;
|
|
2972
|
+
if (!bt && ht) {
|
|
2973
|
+
const at = (((w = n.shadow) == null ? void 0 : w.isEnabled) !== !1 ? (((I = n.shadow) == null ? void 0 : I.blur) || 0) + 10 : 0) + (((M = n.blur) == null ? void 0 : M.isEnabled) !== !1 && ((k = n.blur) == null ? void 0 : k.radius) || 0) + 20;
|
|
2974
|
+
if (!this.isObjectInView(t, X, V, a, r, at))
|
|
2975
2975
|
continue;
|
|
2976
2976
|
}
|
|
2977
2977
|
this.debug_objectsRendered++, t.save();
|
|
@@ -2992,33 +2992,33 @@ class ci {
|
|
|
2992
2992
|
hue: 0
|
|
2993
2993
|
} : Et;
|
|
2994
2994
|
if (e && ut && (e.geometry = e.geometry || {}, e.geometry.adjustments = { ...ut }), ut) {
|
|
2995
|
-
const
|
|
2995
|
+
const at = (ut.exposure || 0) / 100, gt = ut.contrast || 0, j = 1 + (ut.saturation || 0) / 100, z = (ut.temperature || 0) / 200, D = (ut.tint || 0) / 200, et = (ut.highlights || 0) / 500, mt = (ut.shadows || 0) / 500;
|
|
2996
2996
|
let Pt = "", Ct = "SourceGraphic";
|
|
2997
|
-
if (
|
|
2997
|
+
if (at !== 0 && (Pt += `
|
|
2998
2998
|
<feComponentTransfer in="${Ct}" result="exposure">
|
|
2999
|
-
<feFuncR type="linear" slope="1" intercept="${
|
|
3000
|
-
<feFuncG type="linear" slope="1" intercept="${
|
|
3001
|
-
<feFuncB type="linear" slope="1" intercept="${
|
|
3002
|
-
</feComponentTransfer>`, Ct = "exposure"),
|
|
3003
|
-
const
|
|
2999
|
+
<feFuncR type="linear" slope="1" intercept="${at}"/>
|
|
3000
|
+
<feFuncG type="linear" slope="1" intercept="${at}"/>
|
|
3001
|
+
<feFuncB type="linear" slope="1" intercept="${at}"/>
|
|
3002
|
+
</feComponentTransfer>`, Ct = "exposure"), gt !== 0) {
|
|
3003
|
+
const yt = (gt + 100) / 100, F = 0.5 * (1 - yt);
|
|
3004
3004
|
Pt += `
|
|
3005
3005
|
<feComponentTransfer in="${Ct}" result="contrast">
|
|
3006
|
-
<feFuncR type="linear" slope="${
|
|
3007
|
-
<feFuncG type="linear" slope="${
|
|
3008
|
-
<feFuncB type="linear" slope="${
|
|
3006
|
+
<feFuncR type="linear" slope="${yt}" intercept="${F}"/>
|
|
3007
|
+
<feFuncG type="linear" slope="${yt}" intercept="${F}"/>
|
|
3008
|
+
<feFuncB type="linear" slope="${yt}" intercept="${F}"/>
|
|
3009
3009
|
</feComponentTransfer>`, Ct = "contrast";
|
|
3010
3010
|
}
|
|
3011
3011
|
if (j !== 1 && (Pt += `<feColorMatrix in="${Ct}" type="saturate" values="${j}" result="saturate"/>`, Ct = "saturate"), ut.hue && (Pt += `<feColorMatrix in="${Ct}" type="hueRotate" values="${ut.hue}" result="hue"/>`, Ct = "hue"), ut.negative) {
|
|
3012
|
-
const
|
|
3012
|
+
const yt = 1 - ut.negative / 50;
|
|
3013
3013
|
Pt += `
|
|
3014
3014
|
<feColorMatrix in="${Ct}" type="matrix" result="invert"
|
|
3015
|
-
values="${
|
|
3016
|
-
0 ${
|
|
3017
|
-
0 0 ${
|
|
3015
|
+
values="${yt} 0 0 0 ${1 - yt}
|
|
3016
|
+
0 ${yt} 0 0 ${1 - yt}
|
|
3017
|
+
0 0 ${yt} 0 ${1 - yt}
|
|
3018
3018
|
0 0 0 1 0"/>`, Ct = "invert";
|
|
3019
3019
|
}
|
|
3020
|
-
if (z !== 0 || D !== 0 || et !== 0 ||
|
|
3021
|
-
const
|
|
3020
|
+
if (z !== 0 || D !== 0 || et !== 0 || mt !== 0) {
|
|
3021
|
+
const yt = 1 + et + mt, F = yt * (1 + z - D / 2), Lt = yt * (1 + D), jt = yt * (1 - z - D / 2), Vt = ut.shadows * 0.1 / 255, ce = [
|
|
3022
3022
|
F,
|
|
3023
3023
|
0,
|
|
3024
3024
|
0,
|
|
@@ -3043,7 +3043,7 @@ class ci {
|
|
|
3043
3043
|
Pt += `<feColorMatrix in="${Ct}" type="matrix" values="${ce}" result="advanced"/>`, Ct = "advanced";
|
|
3044
3044
|
}
|
|
3045
3045
|
if (ut.blur && (Pt += `<feGaussianBlur in="${Ct}" stdDeviation="${ut.blur}" result="blur"/>`, Ct = "blur"), Pt) {
|
|
3046
|
-
const
|
|
3046
|
+
const yt = `<svg xmlns="http://www.w3.org/2000/svg"><filter id="f" color-interpolation-filters="sRGB">${Pt}</filter></svg>`, F = btoa(yt);
|
|
3047
3047
|
wt.push(`url('data:image/svg+xml;base64,${F}#f')`);
|
|
3048
3048
|
}
|
|
3049
3049
|
}
|
|
@@ -3052,7 +3052,7 @@ class ci {
|
|
|
3052
3052
|
t.globalAlpha = vt * xt;
|
|
3053
3053
|
const Xt = e.compositeOperation || e.blendMode;
|
|
3054
3054
|
if (Xt && Xt !== "Normal") {
|
|
3055
|
-
const
|
|
3055
|
+
const at = Xt.toLowerCase();
|
|
3056
3056
|
[
|
|
3057
3057
|
"multiply",
|
|
3058
3058
|
"screen",
|
|
@@ -3082,7 +3082,7 @@ class ci {
|
|
|
3082
3082
|
"xor",
|
|
3083
3083
|
"multiply",
|
|
3084
3084
|
"screen"
|
|
3085
|
-
].includes(
|
|
3085
|
+
].includes(at) && (t.globalCompositeOperation = at);
|
|
3086
3086
|
}
|
|
3087
3087
|
const Bt = t, Dt = e.masks || (i.maskedBy ? [{
|
|
3088
3088
|
maskId: i.maskedBy,
|
|
@@ -3093,69 +3093,72 @@ class ci {
|
|
|
3093
3093
|
isVisible: !0
|
|
3094
3094
|
}] : []);
|
|
3095
3095
|
let Ht = !1;
|
|
3096
|
-
const te = Dt.filter((
|
|
3096
|
+
const te = Dt.filter((at) => at.isVisible !== !1 && o.has(at.maskId));
|
|
3097
3097
|
if (te.length > 0) {
|
|
3098
|
-
const
|
|
3098
|
+
const at = te[0], gt = o.get(at.maskId), j = this.objectStates.get(gt.id);
|
|
3099
3099
|
j && j.visible !== !1 && (Ht = !0, (!this.maskBuffer || this.maskBuffer.width !== this.canvasWidth || this.maskBuffer.height !== this.canvasHeight) && (this.maskBuffer = document.createElement("canvas"), this.maskBuffer.width = this.canvasWidth, this.maskBuffer.height = this.canvasHeight, this.maskCtx = this.maskBuffer.getContext("2d", { willReadFrequently: !0 }), this.maskCtx && (this.maskCtx.imageSmoothingEnabled = !0, this.maskCtx.imageSmoothingQuality = "high")), this.maskCtx.setTransform(1, 0, 0, 1, 0, 0), this.maskCtx.globalCompositeOperation = "source-over", this.maskCtx.globalAlpha = 1, this.maskCtx.filter = "none", this.maskCtx.clearRect(0, 0, this.maskBuffer.width, this.maskBuffer.height), this.rootTransform && this.maskCtx.setTransform(this.rootTransform), i.parentId && this.applyAbsoluteTransform(this.maskCtx, i.parentId, o), this.maskCtx.save(), this.maskCtx.globalAlpha = 1, t = this.maskCtx, t.filter = Bt.filter);
|
|
3100
3100
|
}
|
|
3101
3101
|
t.translate(Math.round(X), Math.round(V)), t.rotate(it * Math.PI / 180);
|
|
3102
3102
|
const ue = e.skew_x || 0, pe = e.skew_y || 0;
|
|
3103
|
-
(ue !== 0 || pe !== 0)
|
|
3103
|
+
if (ue !== 0 || pe !== 0) {
|
|
3104
|
+
const at = Math.tan(ue * Math.PI / 180), gt = Math.tan(pe * Math.PI / 180);
|
|
3105
|
+
t.transform(1 + at * gt, gt, at, 1, 0, 0);
|
|
3106
|
+
}
|
|
3104
3107
|
const Qt = e.rotate_x !== void 0 ? e.rotate_x : ((x = e.transform) == null ? void 0 : x.rotate_x) ?? 0, me = e.rotate_y !== void 0 ? e.rotate_y : ((O = e.transform) == null ? void 0 : O.rotate_y) ?? 0, ye = 1 + (e.translate_z !== void 0 ? e.translate_z : ((W = e.transform) == null ? void 0 : W.translate_z) ?? 0) / 1e3, Se = (e.flip_x === !0 ? -1 : 1) * Math.cos(me * Math.PI / 180) * ye, Pe = (e.flip_y === !0 ? -1 : 1) * Math.cos(Qt * Math.PI / 180) * ye;
|
|
3105
3108
|
t.scale(
|
|
3106
|
-
|
|
3109
|
+
lt * Se,
|
|
3107
3110
|
nt * Pe
|
|
3108
3111
|
), n.shadow && n.shadow.isEnabled !== !0 && ((n.shadow.blur || 0) > 0 || Math.abs(n.shadow.offsetX || 0) > 0 || Math.abs(n.shadow.offsetY || 0) > 0) && (n.shadow.isEnabled = !0);
|
|
3109
3112
|
const ae = n.shadow;
|
|
3110
3113
|
if (ae && ae.isEnabled !== !1) {
|
|
3111
|
-
let
|
|
3112
|
-
($ = (B = this.artboard) == null ? void 0 : B.tokens) != null && $.colors && this.artboard.tokens.colors[
|
|
3113
|
-
const
|
|
3114
|
-
let et =
|
|
3115
|
-
if (
|
|
3116
|
-
const Ct =
|
|
3117
|
-
et = `rgba(${Wt}, ${
|
|
3118
|
-
} else if (
|
|
3119
|
-
const Ct =
|
|
3114
|
+
let at = ae.color || "#000000";
|
|
3115
|
+
($ = (B = this.artboard) == null ? void 0 : B.tokens) != null && $.colors && this.artboard.tokens.colors[at] && (at = this.artboard.tokens.colors[at]);
|
|
3116
|
+
const gt = this.normalizeOpacity(ae.opacity ?? 100), j = ae.spread || 0, D = (ae.blur || 0) + j * 1.5;
|
|
3117
|
+
let et = at;
|
|
3118
|
+
if (at.startsWith("#")) {
|
|
3119
|
+
const Ct = at.replace("#", ""), Wt = parseInt(Ct.substring(0, 2), 16), yt = parseInt(Ct.substring(2, 4), 16), F = parseInt(Ct.substring(4, 6), 16);
|
|
3120
|
+
et = `rgba(${Wt}, ${yt}, ${F}, ${gt})`;
|
|
3121
|
+
} else if (at.startsWith("rgba")) {
|
|
3122
|
+
const Ct = at.match(/[\d.]+/g);
|
|
3120
3123
|
if (Ct && Ct.length >= 4) {
|
|
3121
|
-
const Wt = Ct[0],
|
|
3122
|
-
et = `rgba(${Wt}, ${
|
|
3124
|
+
const Wt = Ct[0], yt = Ct[1], F = Ct[2], Lt = Ct[3];
|
|
3125
|
+
et = `rgba(${Wt}, ${yt}, ${F}, ${parseFloat(Lt) * gt})`;
|
|
3123
3126
|
}
|
|
3124
3127
|
}
|
|
3125
|
-
const
|
|
3128
|
+
const mt = t.getTransform(), Pt = Math.sqrt(mt.a * mt.a + mt.b * mt.b) || 1;
|
|
3126
3129
|
t.shadowColor = et, t.shadowBlur = D * Pt, t.shadowOffsetX = (ae.offsetX || 0) * Pt, t.shadowOffsetY = (ae.offsetY || 0) * Pt;
|
|
3127
3130
|
}
|
|
3128
3131
|
const ee = i.liquidFill || ((Y = i.style) == null ? void 0 : Y.liquidFill);
|
|
3129
3132
|
if (ee && ee.enabled) {
|
|
3130
3133
|
t.save();
|
|
3131
|
-
const
|
|
3134
|
+
const at = ee.fillLevel ?? 0.5;
|
|
3132
3135
|
t.beginPath();
|
|
3133
|
-
const
|
|
3134
|
-
t.rect(-a / 2,
|
|
3136
|
+
const gt = r / 2 - r * at;
|
|
3137
|
+
t.rect(-a / 2, gt, a, r * at), t.clip(), t.fillStyle = ee.color || "#3b82f6", t.globalAlpha = t.globalAlpha * (ee.opacity ?? 1);
|
|
3135
3138
|
}
|
|
3136
3139
|
if ((s == null ? void 0 : s.type) === "Text")
|
|
3137
3140
|
this._renderText(t, i, f, n, e, a, r);
|
|
3138
3141
|
else if ((s == null ? void 0 : s.type) === "Image") {
|
|
3139
|
-
const
|
|
3140
|
-
if (
|
|
3141
|
-
let
|
|
3142
|
-
|
|
3143
|
-
this.log(`[ExodeUI] Image loaded successfully, size: ${
|
|
3144
|
-
},
|
|
3145
|
-
console.error("[ExodeUI] Image load failed:", D, `Src preview: ${
|
|
3146
|
-
},
|
|
3142
|
+
const at = s.originalSrc || s.src;
|
|
3143
|
+
if (at) {
|
|
3144
|
+
let gt = this.imageCache.get(at);
|
|
3145
|
+
gt || (gt = new Image(), gt.onload = () => {
|
|
3146
|
+
this.log(`[ExodeUI] Image loaded successfully, size: ${gt.naturalWidth}x${gt.naturalHeight}`);
|
|
3147
|
+
}, gt.onerror = (D) => {
|
|
3148
|
+
console.error("[ExodeUI] Image load failed:", D, `Src preview: ${at.substring(0, 100)}...`);
|
|
3149
|
+
}, gt.src = at, this.imageCache.set(at, gt));
|
|
3147
3150
|
const j = n.stroke && n.stroke.width > 0 && n.stroke.isEnabled !== !1, z = (((H = n.stroke) == null ? void 0 : H.alignment) || "center").toLowerCase();
|
|
3148
3151
|
if (j && (z === "outside" || z === "center") && this.applyStrokeAlignment(t, n, f, a, r, c), n.fill && n.fill.type !== "None") {
|
|
3149
3152
|
t.save();
|
|
3150
3153
|
const D = t.globalAlpha, et = this.createCanvasFill(t, n.fill, a, r);
|
|
3151
3154
|
t.fillStyle = et || n.fill.color || "transparent", t.globalAlpha = D * this.normalizeOpacity(n.fill.opacity ?? 100), c !== 0 ? (this.drawRoundRect(t, -a / 2, -r / 2, a, r, c), t.fill()) : t.fillRect(-a / 2, -r / 2, a, r), t.globalAlpha = D, t.restore();
|
|
3152
3155
|
}
|
|
3153
|
-
|
|
3156
|
+
gt.complete && gt.naturalWidth > 0 ? (c !== 0 ? (t.save(), this.drawRoundRect(t, -a / 2, -r / 2, a, r, c), t.clip(), t.drawImage(gt, -a / 2, -r / 2, a, r), t.restore()) : t.drawImage(gt, -a / 2, -r / 2, a, r), j && z === "inside" && this.applyStrokeAlignment(t, n, f, a, r, c)) : j && z === "inside" && this.applyStrokeAlignment(t, n, f, a, r, c);
|
|
3154
3157
|
}
|
|
3155
3158
|
} else if (s.type === "SVG") {
|
|
3156
|
-
const
|
|
3157
|
-
if (
|
|
3158
|
-
const
|
|
3159
|
+
const at = s.svgContent;
|
|
3160
|
+
if (at) {
|
|
3161
|
+
const gt = n.palette || [], j = n.fill, z = n.stroke, D = j ? this.normalizeOpacity(j.opacity ?? 100) : 1, et = (j == null ? void 0 : j.type) === "Solid" && (!z || z.isEnabled === !1 || z.type === "Solid" && z.color === j.color), mt = j && j.type !== "None" ? et ? "monochrome" : j.type === "Solid" ? (j.color || "") + "|opacity:" + D : JSON.stringify(j.stops || []) + "|opacity:" + D : "", Pt = z && z.isEnabled !== !1 && (z.width || 0) > 0 ? et ? [
|
|
3159
3162
|
"monochrome",
|
|
3160
3163
|
z.width || 0,
|
|
3161
3164
|
z.trimStart ?? 0,
|
|
@@ -3176,8 +3179,8 @@ class ci {
|
|
|
3176
3179
|
z.dashOffset ?? 0
|
|
3177
3180
|
].join("|") : "nostroke", Ct = [
|
|
3178
3181
|
i.id,
|
|
3179
|
-
|
|
3180
|
-
|
|
3182
|
+
gt.join("_"),
|
|
3183
|
+
mt,
|
|
3181
3184
|
Pt,
|
|
3182
3185
|
e.opacity ?? 100,
|
|
3183
3186
|
e.visible !== !1 ? "v" : "h"
|
|
@@ -3185,17 +3188,17 @@ class ci {
|
|
|
3185
3188
|
let Wt = this.imageCache.get(Ct);
|
|
3186
3189
|
if (!Wt) {
|
|
3187
3190
|
Wt = new Image(), Wt.crossOrigin = "anonymous";
|
|
3188
|
-
let F =
|
|
3191
|
+
let F = at;
|
|
3189
3192
|
F.match(/xmlns=["']http:\/\/www\.w3\.org\/2000\/svg["']/i) || (F = F.replace(/<svg([^>]*)>/i, (tt, dt) => `<svg xmlns="http://www.w3.org/2000/svg"${dt}>`));
|
|
3190
3193
|
let Lt = s.width || a || 100, jt = s.height || r || 100;
|
|
3191
3194
|
const Vt = F.match(/viewBox=["']\s*0\s+0\s+([\d.]+)\s+([\d.]+)\s*["']/i);
|
|
3192
3195
|
if (Vt && (Lt = parseFloat(Vt[1]), jt = parseFloat(Vt[2])), F = F.replace(/<svg([^>]*)>/i, (tt, dt) => {
|
|
3193
3196
|
let G = dt.replace(/\b(?:width|height)=["'][^"']*["']/gi, " ");
|
|
3194
3197
|
return G.match(/\bviewBox=/i) || (G += ` viewBox="0 0 ${Lt} ${jt}"`), G.match(/\bpreserveAspectRatio=/i) || (G += ' preserveAspectRatio="none"'), G += ' width="100%" height="100%"', `<svg${G}>`;
|
|
3195
|
-
}), s.colors && s.colors.length > 0 &&
|
|
3196
|
-
if (
|
|
3198
|
+
}), s.colors && s.colors.length > 0 && gt.length > 0 && s.colors.forEach((tt, dt) => {
|
|
3199
|
+
if (gt[dt]) {
|
|
3197
3200
|
const G = tt.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"), st = new RegExp(G, "gi");
|
|
3198
|
-
F = F.replace(st,
|
|
3201
|
+
F = F.replace(st, gt[dt]);
|
|
3199
3202
|
}
|
|
3200
3203
|
}), j && j.type && j.type !== "None") {
|
|
3201
3204
|
if (j.type === "Solid" && j.color) {
|
|
@@ -3249,7 +3252,7 @@ class ci {
|
|
|
3249
3252
|
`stroke:${G}`
|
|
3250
3253
|
);
|
|
3251
3254
|
let J = s.width || a || 100, Ft = s.height || r || 100;
|
|
3252
|
-
const Ut =
|
|
3255
|
+
const Ut = at.match(/viewBox=["']\s*0\s+0\s+([\d.]+)\s+([\d.]+)\s*["']/i);
|
|
3253
3256
|
if (Ut) {
|
|
3254
3257
|
const Gt = parseFloat(Ut[1]), ie = parseFloat(Ut[2]);
|
|
3255
3258
|
!isNaN(Gt) && !isNaN(ie) && (J = Gt, Ft = ie);
|
|
@@ -3277,7 +3280,7 @@ class ci {
|
|
|
3277
3280
|
const Gt = z.dashArray.join(" ");
|
|
3278
3281
|
F = F.replace(/\bstroke-dasharray\s*=\s*["'][^"']*["']/gi, `stroke-dasharray="${Gt}"`), F = F.replace(/stroke-dasharray\s*:\s*[^;"')]+/gi, `stroke-dasharray:${Gt}`), z.dashOffset && (F = F.replace(/\bstroke-dashoffset\s*=\s*["'][^"']*["']/gi, `stroke-dashoffset="${z.dashOffset}"`), F = F.replace(/stroke-dashoffset\s*:\s*[^;"')]+/gi, `stroke-dashoffset:${z.dashOffset}`));
|
|
3279
3282
|
}
|
|
3280
|
-
if (!/\bstroke\s*=\s*["']/i.test(
|
|
3283
|
+
if (!/\bstroke\s*=\s*["']/i.test(at) && !new RegExp("(?<![a-z-])stroke\\s*:", "i").test(at)) {
|
|
3281
3284
|
let Gt = "", ie = "";
|
|
3282
3285
|
if ($e) {
|
|
3283
3286
|
const he = s.width || a || 100, re = s.height || r || 100, le = (he + re) * 2, we = Math.max(0, Math.min(1, Ae)), We = Math.max(0, Math.min(1, Oe)), Ge = (Re % 1 + 1) % 1, De = (xe % 1 + 1) % 1;
|
|
@@ -3295,70 +3298,70 @@ class ci {
|
|
|
3295
3298
|
), F = F.replace(/<\/svg>/i, "</g></svg>");
|
|
3296
3299
|
}
|
|
3297
3300
|
} else z && z.isEnabled === !1 && (F = F.replace(/\bstroke\s*=\s*["'][^"']*["']/gi, 'stroke="none"'), F = F.replace(new RegExp(`(?<![a-z-])stroke\\s*:\\s*(?!none|transparent)[^;"')]+`, "gi"), "stroke:none"));
|
|
3298
|
-
const ft = new Blob([F], { type: "image/svg+xml" }),
|
|
3301
|
+
const ft = new Blob([F], { type: "image/svg+xml" }), ct = URL.createObjectURL(ft);
|
|
3299
3302
|
Wt.onload = () => {
|
|
3300
|
-
if (URL.revokeObjectURL(
|
|
3303
|
+
if (URL.revokeObjectURL(ct), this.frameCount % 900 === 0) {
|
|
3301
3304
|
const tt = this.imageCache.get(Ct);
|
|
3302
3305
|
tt && this.debugLog(`SVG Payload Ready: ${i.name || i.id} (${tt.naturalWidth}x${tt.naturalHeight})`);
|
|
3303
3306
|
}
|
|
3304
3307
|
}, Wt.onerror = () => {
|
|
3305
|
-
URL.revokeObjectURL(
|
|
3306
|
-
}, Wt.src =
|
|
3308
|
+
URL.revokeObjectURL(ct), this.debugLog(`SVG Error: Failed to load payload for ${i.name || i.id}`);
|
|
3309
|
+
}, Wt.src = ct, this.imageCache.set(Ct, Wt);
|
|
3307
3310
|
}
|
|
3308
|
-
let
|
|
3309
|
-
if (Wt.complete && Wt.naturalWidth > 0 ? (
|
|
3311
|
+
let yt = null;
|
|
3312
|
+
if (Wt.complete && Wt.naturalWidth > 0 ? (yt = Wt, this.lastValidSvgImgMap.set(i.id, Wt)) : yt = this.lastValidSvgImgMap.get(i.id) || null, yt && yt.complete && yt.naturalWidth > 0) {
|
|
3310
3313
|
const F = Math.max(1, a), Lt = Math.max(1, r);
|
|
3311
3314
|
if (et && (j == null ? void 0 : j.type) === "Solid") {
|
|
3312
|
-
this.maskBuffer || (this.maskBuffer = document.createElement("canvas"), this.maskCtx = this.maskBuffer.getContext("2d")), this.maskBuffer.width = F, this.maskBuffer.height = Lt, this.maskCtx.setTransform(1, 0, 0, 1, 0, 0), this.maskCtx.globalCompositeOperation = "source-over", this.maskCtx.globalAlpha = 1, this.maskCtx.filter = "none", this.maskCtx.clearRect(0, 0, F, Lt), this.maskCtx.drawImage(
|
|
3315
|
+
this.maskBuffer || (this.maskBuffer = document.createElement("canvas"), this.maskCtx = this.maskBuffer.getContext("2d")), this.maskBuffer.width = F, this.maskBuffer.height = Lt, this.maskCtx.setTransform(1, 0, 0, 1, 0, 0), this.maskCtx.globalCompositeOperation = "source-over", this.maskCtx.globalAlpha = 1, this.maskCtx.filter = "none", this.maskCtx.clearRect(0, 0, F, Lt), this.maskCtx.drawImage(yt, 0, 0, F, Lt), this.maskCtx.globalCompositeOperation = "source-in";
|
|
3313
3316
|
const jt = j.color || "#000000", Vt = this.normalizeOpacity(j.opacity ?? 100);
|
|
3314
3317
|
this.maskCtx.fillStyle = jt, this.maskCtx.globalAlpha = Vt, this.maskCtx.fillRect(0, 0, F, Lt), t.drawImage(this.maskBuffer, -F / 2, -Lt / 2, F, Lt);
|
|
3315
|
-
} else c !== 0 ? (t.save(), this.drawRoundRect(t, -F / 2, -Lt / 2, F, Lt, c), t.clip(), t.drawImage(
|
|
3318
|
+
} else c !== 0 ? (t.save(), this.drawRoundRect(t, -F / 2, -Lt / 2, F, Lt, c), t.clip(), t.drawImage(yt, -F / 2, -Lt / 2, F, Lt), t.restore()) : t.drawImage(yt, -F / 2, -Lt / 2, F, Lt);
|
|
3316
3319
|
}
|
|
3317
3320
|
}
|
|
3318
3321
|
} else if (f.type === "LineGraph")
|
|
3319
3322
|
this.renderLineGraph(t, f, a, r);
|
|
3320
3323
|
else if (i.type === "Shape") {
|
|
3321
3324
|
if (this.applyPath(t, f, a, r, c), t.save(), n.blur && n.blur.amount > 0 && (t.filter = `blur(${n.blur.amount}px)`), n.fill) {
|
|
3322
|
-
const
|
|
3325
|
+
const at = t.globalAlpha;
|
|
3323
3326
|
if (((A = n.fill) == null ? void 0 : A.type) === "Image" && (n.fill.originalSrc || n.fill.src)) {
|
|
3324
|
-
const
|
|
3325
|
-
let j = this.imageCache.get(
|
|
3326
|
-
j || (j = new Image(), j.src =
|
|
3327
|
+
const gt = n.fill.originalSrc || n.fill.src;
|
|
3328
|
+
let j = this.imageCache.get(gt);
|
|
3329
|
+
j || (j = new Image(), j.src = gt, this.imageCache.set(gt, j)), j.complete && j.naturalWidth > 0 && (t.save(), this.applyPath(t, f, a, r, c), t.clip(), this.renderFittedImage(t, j, -a / 2, -r / 2, a, r, n.fill.fillMode), t.restore());
|
|
3327
3330
|
} else {
|
|
3328
|
-
const
|
|
3329
|
-
t.fillStyle =
|
|
3331
|
+
const gt = this.createCanvasFill(t, n.fill, a, r);
|
|
3332
|
+
t.fillStyle = gt || (typeof n.fill == "string" ? n.fill : n.fill.color || "transparent"), t.globalAlpha = at * this.normalizeOpacity(n.fill.opacity ?? 100), this.applyPath(t, f, a, r, c), t.fill();
|
|
3330
3333
|
}
|
|
3331
|
-
t.globalAlpha =
|
|
3334
|
+
t.globalAlpha = at;
|
|
3332
3335
|
}
|
|
3333
3336
|
t.restore(), n.stroke && n.stroke.width > 0 && this.applyStrokeAlignment(t, n, f, a, r, c);
|
|
3334
3337
|
} else if (i.type === "Frame" || i.type === "Group" && !i.isStructuralGroup) {
|
|
3335
|
-
const
|
|
3336
|
-
if (t.save(), t.beginPath(), this.drawRoundRect(t, -
|
|
3337
|
-
const z = t.globalAlpha, D = this.createCanvasFill(t, n.fill,
|
|
3338
|
+
const at = e.width ?? s.width ?? i.width ?? a, gt = e.height ?? s.height ?? i.height ?? r, j = c;
|
|
3339
|
+
if (t.save(), t.beginPath(), this.drawRoundRect(t, -at / 2, -gt / 2, at, gt, j), n.fill && n.fill.type !== "None") {
|
|
3340
|
+
const z = t.globalAlpha, D = this.createCanvasFill(t, n.fill, at, gt);
|
|
3338
3341
|
t.fillStyle = D || n.fill.color || "transparent", t.globalAlpha = z * this.normalizeOpacity(n.fill.opacity ?? 100), t.fill(), t.globalAlpha = z;
|
|
3339
3342
|
}
|
|
3340
3343
|
if (t.restore(), n.stroke && n.stroke.width > 0 && n.stroke.isEnabled !== !1) {
|
|
3341
3344
|
const z = { type: "Rectangle" };
|
|
3342
|
-
this.applyStrokeAlignment(t, n, z,
|
|
3345
|
+
this.applyStrokeAlignment(t, n, z, at, gt, j);
|
|
3343
3346
|
}
|
|
3344
3347
|
} else i.type === "Group" && i.isStructuralGroup || (i.type === "Component" && i.variant === "inputbox" ? this.renderInputBox(t, i) : i.type === "Component" && i.variant === "button" ? this.renderButton(t, i) : i.type === "Component" && i.variant === "toggle_button" ? this.renderToggleButton(t, i) : i.type === "Toggle" || i.type === "Component" && i.variant === "toggle" ? this.renderToggle(t, i) : i.type === "Slider" || i.type === "Component" && i.variant === "slider" ? this.renderSlider(t, i) : i.type === "Dropdown" || i.type === "Component" && i.variant === "dropdown" ? this.renderDropdown(t, i) : i.type === "ListView" || i.type === "Component" && i.variant === "listview" ? this.renderListView(t, i) : i.type === "Checkbox" || i.type === "Component" && i.variant === "checkbox" ? this.renderCheckbox(t, i) : i.type === "RadioGroup" || i.type === "Component" && i.variant === "radiogroup" ? this.renderRadioGroup(t, i) : i.type === "BarChart" || i.type === "Component" && i.variant === "barchart" ? this.renderBarChart(t, i) : i.type === "PieChart" || i.type === "Component" && i.variant === "piechart" ? this.renderPieChart(t, i) : i.type === "Joystick" || i.type === "Component" && i.variant === "joystick" ? this.renderJoystick(t, i) : this.frameCount % 300 === 0 && this.warn("[Engine] Unhandled object type in renderObject:", i.type, "Geo:", (_ = i.geometry) == null ? void 0 : _.type));
|
|
3345
3348
|
if (this.applyArtEffectOverlay(t, i, f, a, r, c), Ot && At === "BackgroundBlur" && this.applyBackgroundBlurGlass(t, f, a, r, c, It), ee && ee.enabled && t.restore(), i.children && i.children.length > 0) {
|
|
3346
|
-
const
|
|
3349
|
+
const gt = i.type === "Frame", j = i.clipsContent !== void 0 ? i.clipsContent : i.clipContent !== void 0 ? i.clipContent : gt;
|
|
3347
3350
|
if (t.save(), j) {
|
|
3348
3351
|
t.beginPath();
|
|
3349
|
-
const D = e.width ?? (s == null ? void 0 : s.width) ?? i.width ?? 0, et = e.height ?? (s == null ? void 0 : s.height) ?? i.height ?? 0,
|
|
3350
|
-
this.drawRoundRect(t, -D / 2, -et / 2, D, et,
|
|
3352
|
+
const D = e.width ?? (s == null ? void 0 : s.width) ?? i.width ?? 0, et = e.height ?? (s == null ? void 0 : s.height) ?? i.height ?? 0, mt = e.cornerRadius ?? (s == null ? void 0 : s.corner_radius) ?? i.cornerRadius ?? 0;
|
|
3353
|
+
this.drawRoundRect(t, -D / 2, -et / 2, D, et, mt), t.clip();
|
|
3351
3354
|
}
|
|
3352
3355
|
let z = 0;
|
|
3353
3356
|
for (i.children.forEach((D) => {
|
|
3354
3357
|
const et = o.get(D);
|
|
3355
3358
|
if (!et) return;
|
|
3356
|
-
const
|
|
3357
|
-
if (Pt && Pt.isMask && (
|
|
3359
|
+
const mt = this.objectStates.get(D), Pt = (mt == null ? void 0 : mt.geometry) || et.geometry;
|
|
3360
|
+
if (Pt && Pt.isMask && (mt == null ? void 0 : mt.visible) !== !1) {
|
|
3358
3361
|
const Ct = Pt.width || 0, Wt = Pt.height || 0;
|
|
3359
3362
|
this.applyObjectTransform(t, D);
|
|
3360
|
-
const
|
|
3361
|
-
this.applyPath(t, Pt, Ct, Wt,
|
|
3363
|
+
const yt = (mt == null ? void 0 : mt.corner_radius) ?? (Pt == null ? void 0 : Pt.corner_radius) ?? 0;
|
|
3364
|
+
this.applyPath(t, Pt, Ct, Wt, yt), t.clip(), z++;
|
|
3362
3365
|
} else
|
|
3363
3366
|
this.renderObject(t, et, o);
|
|
3364
3367
|
}); z > 0; )
|
|
@@ -3374,19 +3377,19 @@ class ci {
|
|
|
3374
3377
|
feather: i.maskFeather || 0,
|
|
3375
3378
|
isVisible: !0
|
|
3376
3379
|
}] : [])).filter((z) => z.isVisible !== !1 && o.has(z.maskId)).forEach((z) => {
|
|
3377
|
-
var
|
|
3378
|
-
const D = o.get(z.maskId), et = this.objectStates.get(D.id),
|
|
3380
|
+
var yt, F, Lt, jt, Vt, ce;
|
|
3381
|
+
const D = o.get(z.maskId), et = this.objectStates.get(D.id), mt = z.feather || 0, Pt = z.inverted === !0, Ct = z.opacity !== void 0 ? typeof z.opacity == "number" ? z.opacity : z.opacity / 100 : 1;
|
|
3379
3382
|
if ((z.type || "alpha") === "luma") {
|
|
3380
|
-
(!this.lumaBuffer || this.lumaBuffer.width !== this.maskBuffer.width || this.lumaBuffer.height !== this.maskBuffer.height) && (this.lumaBuffer = document.createElement("canvas"), this.lumaBuffer.width = this.maskBuffer.width, this.lumaBuffer.height = this.maskBuffer.height, this.lumaCtx = this.lumaBuffer.getContext("2d", { willReadFrequently: !0 }), this.lumaCtx && (this.lumaCtx.imageSmoothingEnabled = !0, this.lumaCtx.imageSmoothingQuality = "high")), this.lumaCtx.setTransform(1, 0, 0, 1, 0, 0), this.lumaCtx.globalCompositeOperation = "source-over", this.lumaCtx.globalAlpha = 1, this.lumaCtx.filter = "none", this.lumaCtx.clearRect(0, 0, this.lumaBuffer.width, this.lumaBuffer.height), this.lumaCtx.save(), this.rootTransform && this.lumaCtx.setTransform(this.rootTransform), this.applyAbsoluteTransform(this.lumaCtx, D.id, o),
|
|
3381
|
-
const Rt = (et == null ? void 0 : et.width) || D.geometry.width || 0, ft = (et == null ? void 0 : et.height) || D.geometry.height || 0,
|
|
3382
|
-
if (((
|
|
3383
|
+
(!this.lumaBuffer || this.lumaBuffer.width !== this.maskBuffer.width || this.lumaBuffer.height !== this.maskBuffer.height) && (this.lumaBuffer = document.createElement("canvas"), this.lumaBuffer.width = this.maskBuffer.width, this.lumaBuffer.height = this.maskBuffer.height, this.lumaCtx = this.lumaBuffer.getContext("2d", { willReadFrequently: !0 }), this.lumaCtx && (this.lumaCtx.imageSmoothingEnabled = !0, this.lumaCtx.imageSmoothingQuality = "high")), this.lumaCtx.setTransform(1, 0, 0, 1, 0, 0), this.lumaCtx.globalCompositeOperation = "source-over", this.lumaCtx.globalAlpha = 1, this.lumaCtx.filter = "none", this.lumaCtx.clearRect(0, 0, this.lumaBuffer.width, this.lumaBuffer.height), this.lumaCtx.save(), this.rootTransform && this.lumaCtx.setTransform(this.rootTransform), this.applyAbsoluteTransform(this.lumaCtx, D.id, o), mt > 0 && (this.lumaCtx.filter = `blur(${mt}px)`), this.lumaCtx.globalAlpha = Ct;
|
|
3384
|
+
const Rt = (et == null ? void 0 : et.width) || D.geometry.width || 0, ft = (et == null ? void 0 : et.height) || D.geometry.height || 0, ct = (et == null ? void 0 : et.corner_radius) ?? D.corner_radius ?? 0;
|
|
3385
|
+
if (((yt = D.geometry) == null ? void 0 : yt.type) === "Text") {
|
|
3383
3386
|
const st = et != null && et.geometry ? this.deepMerge(D.geometry, et.geometry) : D.geometry, J = et != null && et.style ? this.deepMerge(D.style, et.style) : D.style;
|
|
3384
|
-
this._renderText(this.lumaCtx, D, { ...st, width: Rt, height: ft, corner_radius:
|
|
3387
|
+
this._renderText(this.lumaCtx, D, { ...st, width: Rt, height: ft, corner_radius: ct }, J, et, Rt, ft, !0);
|
|
3385
3388
|
} else if (((F = D.geometry) == null ? void 0 : F.type) === "Image") {
|
|
3386
3389
|
const st = D.geometry.src;
|
|
3387
3390
|
if (st) {
|
|
3388
3391
|
let J = this.imageCache.get(st);
|
|
3389
|
-
J || (J = new Image(), J.src = st, this.imageCache.set(st, J)), J.complete && J.naturalWidth > 0 ? this.lumaCtx.drawImage(J, -Rt / 2, -ft / 2, Rt, ft) : (this.applyPath(this.lumaCtx, D.geometry, Rt, ft,
|
|
3392
|
+
J || (J = new Image(), J.src = st, this.imageCache.set(st, J)), J.complete && J.naturalWidth > 0 ? this.lumaCtx.drawImage(J, -Rt / 2, -ft / 2, Rt, ft) : (this.applyPath(this.lumaCtx, D.geometry, Rt, ft, ct), this.lumaCtx.fillStyle = "#ffffff", this.lumaCtx.fill());
|
|
3390
3393
|
}
|
|
3391
3394
|
} else if (((Lt = D.geometry) == null ? void 0 : Lt.type) === "SVG") {
|
|
3392
3395
|
const st = D.geometry.svgContent;
|
|
@@ -3400,10 +3403,10 @@ class ci {
|
|
|
3400
3403
|
this.artboard && this.reset();
|
|
3401
3404
|
}, this.imageCache.set(J, Ft);
|
|
3402
3405
|
}
|
|
3403
|
-
Ft.complete && Ft.naturalWidth > 0 ? this.lumaCtx.drawImage(Ft, -Rt / 2, -ft / 2, Rt, ft) : (this.applyPath(this.lumaCtx, D.geometry, Rt, ft,
|
|
3406
|
+
Ft.complete && Ft.naturalWidth > 0 ? this.lumaCtx.drawImage(Ft, -Rt / 2, -ft / 2, Rt, ft) : (this.applyPath(this.lumaCtx, D.geometry, Rt, ft, ct), this.lumaCtx.fillStyle = "#ffffff", this.lumaCtx.fill());
|
|
3404
3407
|
}
|
|
3405
3408
|
} else
|
|
3406
|
-
this.applyPath(this.lumaCtx, D.geometry, Rt, ft,
|
|
3409
|
+
this.applyPath(this.lumaCtx, D.geometry, Rt, ft, ct), this.lumaCtx.fillStyle = "#ffffff", this.lumaCtx.fill();
|
|
3407
3410
|
this.lumaCtx.restore();
|
|
3408
3411
|
const tt = this.maskCtx.getImageData(0, 0, this.canvasWidth, this.canvasHeight), dt = this.lumaCtx.getImageData(0, 0, this.canvasWidth, this.canvasHeight).data, G = tt.data;
|
|
3409
3412
|
for (let st = 0; st < G.length; st += 4) {
|
|
@@ -3413,16 +3416,16 @@ class ci {
|
|
|
3413
3416
|
}
|
|
3414
3417
|
this.maskCtx.putImageData(tt, 0, 0);
|
|
3415
3418
|
} else {
|
|
3416
|
-
this.maskCtx.save(), this.rootTransform && this.maskCtx.setTransform(this.rootTransform), this.maskCtx.globalCompositeOperation = Pt ? "destination-out" : "destination-in",
|
|
3417
|
-
const Rt = (et == null ? void 0 : et.width) || D.geometry.width || 0, ft = (et == null ? void 0 : et.height) || D.geometry.height || 0,
|
|
3419
|
+
this.maskCtx.save(), this.rootTransform && this.maskCtx.setTransform(this.rootTransform), this.maskCtx.globalCompositeOperation = Pt ? "destination-out" : "destination-in", mt > 0 && (this.maskCtx.filter = `blur(${mt}px)`), this.maskCtx.globalAlpha = Ct, this.applyAbsoluteTransform(this.maskCtx, D.id, o);
|
|
3420
|
+
const Rt = (et == null ? void 0 : et.width) || D.geometry.width || 0, ft = (et == null ? void 0 : et.height) || D.geometry.height || 0, ct = (et == null ? void 0 : et.corner_radius) ?? D.corner_radius ?? 0;
|
|
3418
3421
|
if (((jt = D.geometry) == null ? void 0 : jt.type) === "Text") {
|
|
3419
3422
|
const tt = et != null && et.geometry ? this.deepMerge(D.geometry, et.geometry) : D.geometry, dt = et != null && et.style ? this.deepMerge(D.style, et.style) : D.style;
|
|
3420
|
-
this._renderText(this.maskCtx, D, { ...tt, width: Rt, height: ft, corner_radius:
|
|
3423
|
+
this._renderText(this.maskCtx, D, { ...tt, width: Rt, height: ft, corner_radius: ct }, dt, et, Rt, ft, !0);
|
|
3421
3424
|
} else if (((Vt = D.geometry) == null ? void 0 : Vt.type) === "Image") {
|
|
3422
3425
|
const tt = D.geometry.src;
|
|
3423
3426
|
if (tt) {
|
|
3424
3427
|
let dt = this.imageCache.get(tt);
|
|
3425
|
-
dt || (dt = new Image(), dt.src = tt, this.imageCache.set(tt, dt)), dt.complete && dt.naturalWidth > 0 ? this.maskCtx.drawImage(dt, -Rt / 2, -ft / 2, Rt, ft) : (this.applyPath(this.maskCtx, D.geometry, Rt, ft,
|
|
3428
|
+
dt || (dt = new Image(), dt.src = tt, this.imageCache.set(tt, dt)), dt.complete && dt.naturalWidth > 0 ? this.maskCtx.drawImage(dt, -Rt / 2, -ft / 2, Rt, ft) : (this.applyPath(this.maskCtx, D.geometry, Rt, ft, ct), this.maskCtx.fillStyle = "#ffffff", this.maskCtx.fill());
|
|
3426
3429
|
}
|
|
3427
3430
|
} else if (((ce = D.geometry) == null ? void 0 : ce.type) === "SVG") {
|
|
3428
3431
|
const tt = D.geometry.svgContent;
|
|
@@ -3436,10 +3439,10 @@ class ci {
|
|
|
3436
3439
|
this.artboard && this.reset();
|
|
3437
3440
|
}, this.imageCache.set(dt, G);
|
|
3438
3441
|
}
|
|
3439
|
-
G.complete && G.naturalWidth > 0 ? this.maskCtx.drawImage(G, -Rt / 2, -ft / 2, Rt, ft) : (this.applyPath(this.maskCtx, D.geometry, Rt, ft,
|
|
3442
|
+
G.complete && G.naturalWidth > 0 ? this.maskCtx.drawImage(G, -Rt / 2, -ft / 2, Rt, ft) : (this.applyPath(this.maskCtx, D.geometry, Rt, ft, ct), this.maskCtx.fillStyle = "#ffffff", this.maskCtx.fill());
|
|
3440
3443
|
}
|
|
3441
3444
|
} else
|
|
3442
|
-
this.applyPath(this.maskCtx, D.geometry, Rt, ft,
|
|
3445
|
+
this.applyPath(this.maskCtx, D.geometry, Rt, ft, ct), this.maskCtx.fillStyle = "#ffffff", this.maskCtx.fill();
|
|
3443
3446
|
this.maskCtx.restore();
|
|
3444
3447
|
}
|
|
3445
3448
|
}), Bt.save(), Bt.setTransform(1, 0, 0, 1, 0, 0);
|
|
@@ -3450,7 +3453,7 @@ class ci {
|
|
|
3450
3453
|
}
|
|
3451
3454
|
}
|
|
3452
3455
|
_renderText(t, i, o, e, s, n, a, r = !1, l = !1) {
|
|
3453
|
-
var
|
|
3456
|
+
var bt, ht, wt, Mt, It, Ot, At, Tt, zt;
|
|
3454
3457
|
let c = o.text || "";
|
|
3455
3458
|
if (o.textInputId && !r) {
|
|
3456
3459
|
const Z = this.inputs.get(o.textInputId);
|
|
@@ -3459,7 +3462,7 @@ class ci {
|
|
|
3459
3462
|
if (o.svgPath) {
|
|
3460
3463
|
const Z = o.svgPath;
|
|
3461
3464
|
t.save();
|
|
3462
|
-
const pt = ((
|
|
3465
|
+
const pt = ((bt = e == null ? void 0 : e.fill) == null ? void 0 : bt.color) || "#000000", Et = ((ht = e == null ? void 0 : e.fill) == null ? void 0 : ht.opacity) !== void 0 ? (wt = e == null ? void 0 : e.fill) == null ? void 0 : wt.opacity : 1;
|
|
3463
3466
|
t.fillStyle = pt, t.globalAlpha *= Et;
|
|
3464
3467
|
const ut = new Path2D(Z);
|
|
3465
3468
|
t.fill(ut), t.restore();
|
|
@@ -3538,7 +3541,7 @@ class ci {
|
|
|
3538
3541
|
V = { geo: Et, obj: Z, w: ut, h: vt }, it = this.getPerimeter(Et, ut, vt);
|
|
3539
3542
|
}
|
|
3540
3543
|
}
|
|
3541
|
-
const
|
|
3544
|
+
const lt = (Z, pt) => {
|
|
3542
3545
|
var ut, vt;
|
|
3543
3546
|
if (M === 0 && (!o.enableSegments || !((ut = o.segments) != null && ut.length))) return t.measureText(Z).width;
|
|
3544
3547
|
let Et = 0;
|
|
@@ -3575,7 +3578,7 @@ class ci {
|
|
|
3575
3578
|
if (Dt)
|
|
3576
3579
|
t.font = C, ut ? t.strokeText(Z, pt + Xt, te) : t.fillText(Z, pt + Xt, te);
|
|
3577
3580
|
else {
|
|
3578
|
-
const Qt =
|
|
3581
|
+
const Qt = lt(Z, vt);
|
|
3579
3582
|
let me = pt + Xt;
|
|
3580
3583
|
I === "center" ? me -= Qt / 2 : I === "right" && (me -= Qt);
|
|
3581
3584
|
const _e = vt + Z.length >= f.length || f[vt + Z.length] === `
|
|
@@ -3588,14 +3591,14 @@ class ci {
|
|
|
3588
3591
|
Z[D] === " " && Se++;
|
|
3589
3592
|
if (Se > 0) {
|
|
3590
3593
|
const D = t.measureText(" ").width;
|
|
3591
|
-
let et = Pe || D * 0.5,
|
|
3592
|
-
ye = Math.max(0, Math.min(z / Se,
|
|
3594
|
+
let et = Pe || D * 0.5, mt = ae || D * 2.5;
|
|
3595
|
+
ye = Math.max(0, Math.min(z / Se, mt - et));
|
|
3593
3596
|
}
|
|
3594
3597
|
}
|
|
3595
3598
|
let ee = o.pathOffset || 0;
|
|
3596
3599
|
o.pathId && it > 0 && V && (I === "center" ? ee += it / 2 - Qt / 2 : I === "right" && (ee += it - Qt));
|
|
3597
|
-
let
|
|
3598
|
-
const
|
|
3600
|
+
let at = me;
|
|
3601
|
+
const gt = r && !l ? [] : ((ue = i.behaviors) == null ? void 0 : ue.filter(
|
|
3599
3602
|
(j) => [
|
|
3600
3603
|
N.Typewriter,
|
|
3601
3604
|
N.Scramble,
|
|
@@ -3631,132 +3634,132 @@ class ci {
|
|
|
3631
3634
|
for (let j = 0; j < Z.length; j++) {
|
|
3632
3635
|
let z = Z[j];
|
|
3633
3636
|
const D = vt + j;
|
|
3634
|
-
let et = 0,
|
|
3635
|
-
|
|
3636
|
-
const
|
|
3637
|
+
let et = 0, mt = 0, Pt = 1, Ct = 1, Wt = 0, yt = 1, F = z;
|
|
3638
|
+
gt.forEach((ft) => {
|
|
3639
|
+
const ct = ft.settings || {}, tt = ct.strength || 1, dt = Date.now();
|
|
3637
3640
|
if (ft.type === N.Typewriter)
|
|
3638
|
-
this.currentTime * (
|
|
3641
|
+
this.currentTime * (ct.speed || 1) - D * (ct.stagger || 0.05) < 0 && (yt = 0);
|
|
3639
3642
|
else if (ft.type === N.Scramble)
|
|
3640
|
-
Math.max(0, Math.min(1, this.currentTime / (
|
|
3643
|
+
Math.max(0, Math.min(1, this.currentTime / (ct.duration || 1.5)) - D * 0.02) < 1 && Math.random() < 0.3 && (F = "$%#@!*&"[Math.floor(Math.random() * 7)]);
|
|
3641
3644
|
else if (ft.type === N.Wave)
|
|
3642
|
-
|
|
3645
|
+
mt += Math.sin(this.currentTime * 5 * (ct.speed || 1) + D * (ct.frequency || 1)) * (ct.amplitude || 20) * tt;
|
|
3643
3646
|
else if (ft.type === N.Bounce) {
|
|
3644
|
-
const G = Math.max(0, this.currentTime % 2 - D * (
|
|
3645
|
-
G < 1 && (
|
|
3647
|
+
const G = Math.max(0, this.currentTime % 2 - D * (ct.stagger || 0.1));
|
|
3648
|
+
G < 1 && (mt -= Math.abs(Math.sin(G * Math.PI)) * (ct.height || 50) * tt);
|
|
3646
3649
|
} else if (ft.type === N.TextTrail) {
|
|
3647
|
-
const G = this.pointerHistory[Math.max(0, this.pointerHistory.length - 1 - D * (
|
|
3648
|
-
G && (et += (G.x - (s.x +
|
|
3650
|
+
const G = this.pointerHistory[Math.max(0, this.pointerHistory.length - 1 - D * (ct.delay || 5))];
|
|
3651
|
+
G && (et += (G.x - (s.x + at)) * tt * 0.2, mt += (G.y - (s.y + Et + mt)) * tt * 0.2);
|
|
3649
3652
|
} else if (ft.type === N.Reveal3D) {
|
|
3650
|
-
const G = Math.max(0, Math.min(1, this.currentTime * (
|
|
3651
|
-
Pt *= G, Ct *= G,
|
|
3653
|
+
const G = Math.max(0, Math.min(1, this.currentTime * (ct.speed || 1) - D * (ct.stagger || 0.1)));
|
|
3654
|
+
Pt *= G, Ct *= G, yt = G;
|
|
3652
3655
|
} else if (ft.type === N.RevealSlide) {
|
|
3653
|
-
const G = Math.max(0, Math.min(1, this.currentTime * 1.5 - D * 0.05)), st = (1 - G) * (
|
|
3654
|
-
J === "up" ?
|
|
3656
|
+
const G = Math.max(0, Math.min(1, this.currentTime * 1.5 - D * 0.05)), st = (1 - G) * (ct.distance || 40) * tt, J = ct.direction || "up";
|
|
3657
|
+
J === "up" ? mt -= st : J === "down" ? mt += st : J === "left" ? et -= st : J === "right" && (et += st), yt = G;
|
|
3655
3658
|
} else if (ft.type === N.RevealBlur) {
|
|
3656
3659
|
const G = Math.max(0, Math.min(1, this.currentTime * 1.2 - D * 0.1));
|
|
3657
|
-
|
|
3660
|
+
yt = G, et += (1 - G) * 5;
|
|
3658
3661
|
} else if (ft.type === N.TextLiquid) {
|
|
3659
|
-
const G = Math.max(0, Math.sin(dt * 1e-3 * (
|
|
3660
|
-
|
|
3662
|
+
const G = Math.max(0, Math.sin(dt * 1e-3 * (ct.speed || 1) + D * 0.5));
|
|
3663
|
+
mt += G * (ct.amplitude || 10) * tt, Ct *= 1 + G * 0.2;
|
|
3661
3664
|
} else if (ft.type === N.TextVortex) {
|
|
3662
|
-
const G = dt * 2e-3 * (
|
|
3663
|
-
et += Math.cos(G) * st * tt,
|
|
3665
|
+
const G = dt * 2e-3 * (ct.speed || 1) + D * 0.2, st = (1 - (Math.sin(dt * 1e-3) * 0.5 + 0.5)) * (ct.radius || 50);
|
|
3666
|
+
et += Math.cos(G) * st * tt, mt += Math.sin(G) * st * tt;
|
|
3664
3667
|
} else if (ft.type === N.TextExplosion) {
|
|
3665
|
-
const G =
|
|
3668
|
+
const G = ct.force || 1, st = this.currentTime % 2;
|
|
3666
3669
|
if (st < 1) {
|
|
3667
3670
|
const J = (D / Z.length - 0.5) * Math.PI * 2, Ft = st * 100 * G;
|
|
3668
|
-
et += Math.cos(J) * Ft * tt,
|
|
3671
|
+
et += Math.cos(J) * Ft * tt, mt += Math.sin(J) * Ft * tt, yt = 1 - st;
|
|
3669
3672
|
}
|
|
3670
3673
|
} else if (ft.type === N.TextRain) {
|
|
3671
|
-
const G =
|
|
3672
|
-
|
|
3674
|
+
const G = ct.speed || 1, st = ct.height || 100, J = (dt * 1e-3 * G + D * 0.1) % 1;
|
|
3675
|
+
mt -= (1 - J) * st * tt, yt = J > 0.1 ? 1 : J * 10;
|
|
3673
3676
|
} else if (ft.type === N.TextGravity) {
|
|
3674
|
-
const G =
|
|
3675
|
-
J < 100 ?
|
|
3677
|
+
const G = ct.gravity || 9.8, st = this.currentTime % 3 / 3, J = 0.5 * G * Math.pow(st * 10, 2);
|
|
3678
|
+
J < 100 ? mt += J * tt : mt += 100 * tt;
|
|
3676
3679
|
} else if (ft.type === N.TextMatrix) {
|
|
3677
|
-
const G =
|
|
3680
|
+
const G = ct.speed || 1;
|
|
3678
3681
|
if (Math.random() < 0.1 * G) {
|
|
3679
3682
|
const J = "0123456789ABCDEF!@#$%^&*";
|
|
3680
3683
|
F = J[Math.floor(Math.random() * J.length)];
|
|
3681
3684
|
}
|
|
3682
|
-
|
|
3685
|
+
yt = 0.3 + (Math.sin(dt * 0.01 * G + D) + 1) / 2 * 0.7;
|
|
3683
3686
|
} else if (ft.type === N.TextNeon) {
|
|
3684
3687
|
const G = Math.random() > 0.95 ? 0.5 : 1;
|
|
3685
|
-
|
|
3688
|
+
yt = (0.7 + (Math.sin(dt * 5e-3) + 1) / 2 * 0.3) * G;
|
|
3686
3689
|
} else if (ft.type === N.TextDissolve)
|
|
3687
|
-
Math.sin(D * 1.5 + dt * 2e-3 * (
|
|
3690
|
+
Math.sin(D * 1.5 + dt * 2e-3 * (ct.speed || 1)) > 0.5 && (yt = 0);
|
|
3688
3691
|
else if (ft.type === N.TextOrganic) {
|
|
3689
|
-
const G =
|
|
3690
|
-
et += Math.sin(dt * 2e-3 * G + D) * st * tt,
|
|
3692
|
+
const G = ct.speed || 1, st = ct.amplitude || 10;
|
|
3693
|
+
et += Math.sin(dt * 2e-3 * G + D) * st * tt, mt += Math.cos(dt * 15e-4 * G + D * 0.7) * st * tt;
|
|
3691
3694
|
} else if (ft.type === N.TextBreathe) {
|
|
3692
3695
|
const st = 1 + (Math.sin(dt * 3e-3 + D * 0.2) + 1) / 2 * 0.2 * tt;
|
|
3693
3696
|
Pt *= st, Ct *= st;
|
|
3694
3697
|
} else if (ft.type === N.TextSpin) {
|
|
3695
|
-
const G =
|
|
3698
|
+
const G = ct.speed || 1;
|
|
3696
3699
|
Wt += dt * 0.01 * G + D;
|
|
3697
3700
|
} else if (ft.type === N.TextMagnet) {
|
|
3698
3701
|
const G = this.pointerHistory[this.pointerHistory.length - 1];
|
|
3699
3702
|
if (G) {
|
|
3700
|
-
const st = G.x - (s.x +
|
|
3703
|
+
const st = G.x - (s.x + at), J = G.y - (s.y + Et);
|
|
3701
3704
|
Wt = Math.atan2(J, st);
|
|
3702
3705
|
}
|
|
3703
3706
|
} else if (ft.type === N.TextPerspective) {
|
|
3704
3707
|
const G = Z.length / 2, st = (D - G) / G, J = 1 - Math.abs(st) * 0.3 * tt;
|
|
3705
3708
|
Pt *= J, Ct *= J, et += st * 20 * tt;
|
|
3706
3709
|
} else if (ft.type === N.TextMirror)
|
|
3707
|
-
|
|
3710
|
+
yt *= 0.8;
|
|
3708
3711
|
else if (ft.type === N.TextFloral) {
|
|
3709
|
-
const G =
|
|
3712
|
+
const G = ct.speed || 1, st = ct.stagger || 0.1, J = (dt * 1e-3 * G + D * st) % 2;
|
|
3710
3713
|
J < 1 && (Pt *= J, Ct *= J, Wt += J * Math.PI);
|
|
3711
3714
|
} else if (ft.type === N.TextSmoke) {
|
|
3712
|
-
const G =
|
|
3713
|
-
|
|
3715
|
+
const G = ct.speed || 1, st = ct.height || 50, J = (dt * 5e-4 * G + D * 0.2) % 1;
|
|
3716
|
+
mt -= J * st * tt, et += Math.sin(dt * 2e-3 + D) * 5 * tt, yt = 1 - J;
|
|
3714
3717
|
} else if (ft.type === N.TextVariable) {
|
|
3715
|
-
const G =
|
|
3718
|
+
const G = ct.speed || 1, st = ct.intensity || 1.5, J = (Math.sin(dt * 4e-3 * G + D * 0.3) + 1) / 2;
|
|
3716
3719
|
Pt *= 1 + J * (st - 1) * tt;
|
|
3717
3720
|
} else if (ft.type === N.TextZing) {
|
|
3718
|
-
const G =
|
|
3719
|
-
et += (1 - J) * st * tt,
|
|
3721
|
+
const G = ct.speed || 2, st = ct.distance || 100, J = (dt * 2e-3 * G + D * 0.05) % 1;
|
|
3722
|
+
et += (1 - J) * st * tt, yt = J;
|
|
3720
3723
|
} else if (ft.type === N.TextElastic) {
|
|
3721
|
-
const G =
|
|
3724
|
+
const G = ct.stiffness || 0.2, st = ct.damping || 0.1, J = Math.sin(dt * 0.01) * Math.exp(-dt * 1e-3 * st);
|
|
3722
3725
|
Ct *= 1 + J * G * tt;
|
|
3723
3726
|
} else if (ft.type === N.TextGlitch3D) {
|
|
3724
|
-
const G =
|
|
3725
|
-
Math.random() < 0.2 && (et += (Math.random() - 0.5) * G,
|
|
3727
|
+
const G = ct.intensity || 5;
|
|
3728
|
+
Math.random() < 0.2 && (et += (Math.random() - 0.5) * G, mt += (Math.random() - 0.5) * G, yt = 0.8);
|
|
3726
3729
|
} else if (ft.type === N.GlitchText) {
|
|
3727
|
-
const G =
|
|
3728
|
-
Math.random() < 0.1 && (et += (Math.random() - 0.5) * G,
|
|
3730
|
+
const G = ct.intensity || 5;
|
|
3731
|
+
Math.random() < 0.1 && (et += (Math.random() - 0.5) * G, mt += (Math.random() - 0.5) * G, Math.random() < 0.05 && (yt = 0.5));
|
|
3729
3732
|
}
|
|
3730
3733
|
});
|
|
3731
3734
|
let Lt = null, jt = o.textDecoration || "none", Vt = y;
|
|
3732
3735
|
if (o.enableSegments === !0 && ((pe = o.segments) == null ? void 0 : pe.length) > 0) {
|
|
3733
|
-
let ft = 0,
|
|
3736
|
+
let ft = 0, ct = null;
|
|
3734
3737
|
for (const tt of o.segments) {
|
|
3735
3738
|
if (D < ft + (tt.text || "").length) {
|
|
3736
|
-
|
|
3739
|
+
ct = tt;
|
|
3737
3740
|
break;
|
|
3738
3741
|
}
|
|
3739
3742
|
ft += (tt.text || "").length;
|
|
3740
3743
|
}
|
|
3741
|
-
if (
|
|
3742
|
-
let tt =
|
|
3744
|
+
if (ct) {
|
|
3745
|
+
let tt = ct.fontFamily || o.fontFamily || "Inter";
|
|
3743
3746
|
b.forEach((st) => {
|
|
3744
3747
|
const J = new RegExp(`[\\s-]${st}$`, "i");
|
|
3745
3748
|
J.test(tt) && (tt = tt.replace(J, "").trim());
|
|
3746
3749
|
});
|
|
3747
|
-
const dt = this.mapFontWeight((
|
|
3748
|
-
Vt =
|
|
3750
|
+
const dt = this.mapFontWeight((ct.fontWeight || o.fontWeight || "400").toString()), G = ct.fontStyle || d;
|
|
3751
|
+
Vt = ct.fontSize || y, t.font = `${G} ${dt} ${Vt}px "${tt}", sans-serif`, ct.fill && (Lt = ct.fill), ct.textDecoration && (jt = ct.textDecoration), Vt < Y && (mt += (Y - Vt) * 0.85);
|
|
3749
3752
|
}
|
|
3750
3753
|
} else
|
|
3751
3754
|
t.font = C;
|
|
3752
3755
|
const ce = t.globalAlpha;
|
|
3753
|
-
t.globalAlpha *=
|
|
3756
|
+
t.globalAlpha *= yt, t.save();
|
|
3754
3757
|
const Rt = t.measureText(F).width;
|
|
3755
3758
|
if (V && it > 0) {
|
|
3756
|
-
const ft =
|
|
3759
|
+
const ft = at - me + Rt / 2, tt = (ee + ft) / it, dt = this.getPointOnPath(V.geo, V.w, V.h, Math.abs(tt % 1)), G = dt.angle, st = Et + mt + (o.pathOffsetY || 0), J = o.pathSide === "right" ? -1 : 1, Ft = Math.cos(G + Math.PI / 2) * st * J, Ut = Math.sin(G + Math.PI / 2) * st * J;
|
|
3757
3760
|
t.translate(dt.x + Ft + et, dt.y + Ut), t.rotate(G + Wt + (J === -1 ? Math.PI : 0));
|
|
3758
3761
|
} else
|
|
3759
|
-
t.translate(
|
|
3762
|
+
t.translate(at + et + Rt / 2, Et + mt), Wt !== 0 && t.rotate(Wt);
|
|
3760
3763
|
if (t.scale(Pt, Ct), Lt && !r && !l) {
|
|
3761
3764
|
const ft = this.createCanvasFill(t, Lt, _, L);
|
|
3762
3765
|
t.fillStyle = ft || Lt.color || "#000000";
|
|
@@ -3764,12 +3767,12 @@ class ci {
|
|
|
3764
3767
|
const ft = this.createCanvasFill(t, e.fill, _, L);
|
|
3765
3768
|
t.fillStyle = ft || e.fill.color || "#000000";
|
|
3766
3769
|
}
|
|
3767
|
-
if (
|
|
3770
|
+
if (yt > 0)
|
|
3768
3771
|
if (r || l) {
|
|
3769
3772
|
const ft = l ? "#000000" : this.createCanvasFill(t, e.fill, _, L);
|
|
3770
3773
|
t.fillStyle = ft || e.fill.color || "#ffffff", t.fillText(F, -Rt / 2, 0);
|
|
3771
3774
|
} else ut ? t.strokeText(F, -Rt / 2, 0) : t.fillText(F, -Rt / 2, 0);
|
|
3772
|
-
jt !== "none" && !r && this.drawTextDecoration(t, jt, 0, 0, Rt, Vt), t.restore(), t.globalAlpha = ce, I === "justify" && ye > 0 && F === " " && !_e ?
|
|
3775
|
+
jt !== "none" && !r && this.drawTextDecoration(t, jt, 0, 0, Rt, Vt), t.restore(), t.globalAlpha = ce, I === "justify" && ye > 0 && F === " " && !_e ? at += Rt + M + ye : at += Rt + M;
|
|
3773
3776
|
}
|
|
3774
3777
|
}
|
|
3775
3778
|
};
|
|
@@ -4276,8 +4279,8 @@ class ci {
|
|
|
4276
4279
|
}
|
|
4277
4280
|
}
|
|
4278
4281
|
renderInputBox(t, i) {
|
|
4279
|
-
var it,
|
|
4280
|
-
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = ((it = i.geometry) == null ? void 0 : it.width) || 250, n = ((
|
|
4282
|
+
var it, lt;
|
|
4283
|
+
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = ((it = i.geometry) == null ? void 0 : it.width) || 250, n = ((lt = i.geometry) == null ? void 0 : lt.height) || 45, a = this.focusedId === i.id, r = this.lastHoveredObjectId === i.id, l = e.previewState || "default", c = l !== "default" ? l : a ? "focused" : r ? "hovered" : "default", f = e.label || { visible: !0, text: "Label" }, u = e.helperText || { visible: !1, text: "Helper text" }, h = e.leftIcon || { visible: !1 }, d = e.rightIcon || { visible: !1 }, p = e.multiline === !0, y = e.corner_radius ?? 8, m = e.corners || { tl: y, tr: y, bl: y, br: y }, b = [m.tl, m.tr, m.br, m.bl];
|
|
4281
4284
|
let v = e.backgroundColor || "rgba(31, 41, 55, 1)", S = e.borderColor || "rgba(55, 65, 81, 1)", C = e.borderWidth ?? 1.5, w = e.color || "#ffffff", I = e.placeholderColor || "rgba(156, 163, 175, 1)", M = e.fontSize || 14;
|
|
4282
4285
|
const k = `${c}Style`, T = e[k];
|
|
4283
4286
|
T ? (T.backgroundColor !== void 0 && (v = T.backgroundColor), T.borderColor !== void 0 && (S = T.borderColor), T.borderWidth !== void 0 && (C = T.borderWidth), T.color !== void 0 && (w = T.color), T.placeholderColor !== void 0 && (I = T.placeholderColor), T.fontSize !== void 0 && (M = T.fontSize)) : c === "focused" ? (S = e.focusBorderColor || "rgba(59, 130, 246, 1)", C = Math.max(C, 2)) : c === "hovered" || c === "hover" ? (S = e.hoverBorderColor || S, v = e.hoverBackgroundColor || v) : c === "disabled" ? (v = e.disabledBackgroundColor || "rgba(31, 41, 55, 0.6)", S = e.disabledBorderColor || "rgba(55, 65, 81, 0.4)") : c === "error" && (S = "rgba(239, 68, 68, 1)", C = Math.max(C, 2)), t.beginPath(), this.drawRoundRect(t, -s / 2, -n / 2, s, n, b);
|
|
@@ -4286,15 +4289,15 @@ class ci {
|
|
|
4286
4289
|
const nt = this.createCanvasFill(t, S, s, n);
|
|
4287
4290
|
if (nt && (t.strokeStyle = nt, t.lineWidth = C, t.stroke()), c === "focused" || c === "focus") {
|
|
4288
4291
|
t.save(), t.beginPath();
|
|
4289
|
-
const
|
|
4290
|
-
this.drawRoundRect(t, -s / 2 - 2, -n / 2 - 2, s + 4, n + 4,
|
|
4292
|
+
const bt = b.map((ht) => ht + 2);
|
|
4293
|
+
this.drawRoundRect(t, -s / 2 - 2, -n / 2 - 2, s + 4, n + 4, bt), t.strokeStyle = "rgba(59, 130, 246, 0.3)", t.lineWidth = 2, t.stroke(), t.restore();
|
|
4291
4294
|
}
|
|
4292
4295
|
}
|
|
4293
|
-
const P = (nt,
|
|
4296
|
+
const P = (nt, bt) => {
|
|
4294
4297
|
if (!nt.visible || !nt.svgPath) return;
|
|
4295
|
-
const
|
|
4298
|
+
const ht = nt.size || 14, wt = nt.offset ?? 16, Mt = nt.color || "#ffffff", It = bt ? -(s / 2) + wt : s / 2 - wt, Ot = nt.svgPath;
|
|
4296
4299
|
if (t.save(), t.translate(It, 0), !Ot.startsWith("<svg")) {
|
|
4297
|
-
const At = new Path2D(Ot), Tt =
|
|
4300
|
+
const At = new Path2D(Ot), Tt = ht / 24;
|
|
4298
4301
|
t.scale(Tt, Tt), t.translate(-12, -12), t.fillStyle = Mt, t.fill(At);
|
|
4299
4302
|
}
|
|
4300
4303
|
t.restore();
|
|
@@ -4306,46 +4309,46 @@ class ci {
|
|
|
4306
4309
|
if (t.save(), t.beginPath(), t.rect(L - 2, -n / 2 + 4, X + 4, n - 8), t.clip(), p) {
|
|
4307
4310
|
const nt = V.split(`
|
|
4308
4311
|
`);
|
|
4309
|
-
let
|
|
4310
|
-
const
|
|
4312
|
+
let bt = -n / 2 + K;
|
|
4313
|
+
const ht = $ * 1.2;
|
|
4311
4314
|
let wt = 0;
|
|
4312
4315
|
nt.forEach((Mt, It) => {
|
|
4313
4316
|
const Ot = Mt.split(" ");
|
|
4314
4317
|
let At = "";
|
|
4315
4318
|
for (let Tt = 0; Tt < Ot.length; Tt++) {
|
|
4316
4319
|
const zt = At + Ot[Tt] + " ";
|
|
4317
|
-
t.measureText(zt).width > X && Tt > 0 ? (t.fillText(At, L,
|
|
4320
|
+
t.measureText(zt).width > X && Tt > 0 ? (t.fillText(At, L, bt), At = Ot[Tt] + " ", bt += ht) : At = zt;
|
|
4318
4321
|
}
|
|
4319
|
-
t.fillText(At, L,
|
|
4320
|
-
}), a && !O && Math.floor(performance.now() / 500) % 2 === 0 && t.fillRect(L + wt,
|
|
4322
|
+
t.fillText(At, L, bt), wt = t.measureText(At).width, It < nt.length - 1 && (bt += ht, wt = 0);
|
|
4323
|
+
}), a && !O && Math.floor(performance.now() / 500) % 2 === 0 && t.fillRect(L + wt, bt, 1.5, $);
|
|
4321
4324
|
} else {
|
|
4322
|
-
const
|
|
4323
|
-
let
|
|
4324
|
-
if (
|
|
4325
|
-
const Mt = L +
|
|
4325
|
+
const bt = t.measureText(V).width;
|
|
4326
|
+
let ht = 0;
|
|
4327
|
+
if (bt > X && (ht = bt - X), t.fillText(V, L - ht, 0), a && !O && Math.floor(performance.now() / 500) % 2 === 0) {
|
|
4328
|
+
const Mt = L + bt - ht;
|
|
4326
4329
|
t.fillRect(Mt, -($ / 2), 1.5, $);
|
|
4327
4330
|
}
|
|
4328
4331
|
}
|
|
4329
4332
|
if (t.restore(), f.visible !== !1) {
|
|
4330
|
-
const nt = f.text || "Label",
|
|
4331
|
-
t.font = `600 ${
|
|
4333
|
+
const nt = f.text || "Label", bt = f.fontSize || 12, ht = f.color || "rgba(156, 163, 175, 1)", wt = f.offset ?? 8;
|
|
4334
|
+
t.font = `600 ${bt}px "${Y}", sans-serif`, t.fillStyle = ht, t.textAlign = "left", t.textBaseline = "bottom";
|
|
4332
4335
|
const Mt = -(s / 2), It = -(n / 2) - wt;
|
|
4333
4336
|
t.fillText(nt, Mt, It);
|
|
4334
4337
|
}
|
|
4335
4338
|
if (u.visible === !0) {
|
|
4336
|
-
const nt = u.text || "Helper text",
|
|
4337
|
-
t.font = `400 ${
|
|
4339
|
+
const nt = u.text || "Helper text", bt = u.fontSize || 11, ht = c === "error" ? "rgba(239, 68, 68, 1)" : u.color || "rgba(156, 163, 175, 1)", wt = u.offset ?? 6;
|
|
4340
|
+
t.font = `400 ${bt}px "${Y}", sans-serif`, t.fillStyle = ht, t.textAlign = "left", t.textBaseline = "top";
|
|
4338
4341
|
const Mt = -(s / 2), It = n / 2 + wt;
|
|
4339
4342
|
t.fillText(nt, Mt, It);
|
|
4340
4343
|
}
|
|
4341
4344
|
}
|
|
4342
4345
|
renderSlider(t, i) {
|
|
4343
|
-
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.geometry) || i.geometry, s = (o == null ? void 0 : o.options) || i.options || {}, n = e.width || 200, a = s.value ?? 50, r = s.min ?? 0, c = (s.max ?? 100) - r, f = c === 0 ? 0 : (a - r) / c, u = s.trackHeight || 4, h = s.trackRoundedness ?? 2, d = s.trackShape ?? "Rectangle", p = s.trackPath || "", y = s.accentColor || "#3b82f6", m = s.inactiveColor || "#374151", b = s.thumbShape || "Ellipse", v = s.thumbWidth ?? 16, S = s.thumbHeight ?? 16, C = s.thumbRoundedness ?? 0, w = s.thumbColor || "#ffffff", I = s.thumbPath || "", M = s.thumbIcon || "", k = s.showValueTooltip ?? !1, T = s.tooltipBgColor || "#333333", R = s.tooltipColor || "#ffffff", P = s.tooltipOffsetX ?? 0, E = s.tooltipOffsetY ?? -25, x = (X, V, it,
|
|
4344
|
-
if ((X === "Custom" || X === "Icon") &&
|
|
4346
|
+
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.geometry) || i.geometry, s = (o == null ? void 0 : o.options) || i.options || {}, n = e.width || 200, a = s.value ?? 50, r = s.min ?? 0, c = (s.max ?? 100) - r, f = c === 0 ? 0 : (a - r) / c, u = s.trackHeight || 4, h = s.trackRoundedness ?? 2, d = s.trackShape ?? "Rectangle", p = s.trackPath || "", y = s.accentColor || "#3b82f6", m = s.inactiveColor || "#374151", b = s.thumbShape || "Ellipse", v = s.thumbWidth ?? 16, S = s.thumbHeight ?? 16, C = s.thumbRoundedness ?? 0, w = s.thumbColor || "#ffffff", I = s.thumbPath || "", M = s.thumbIcon || "", k = s.showValueTooltip ?? !1, T = s.tooltipBgColor || "#333333", R = s.tooltipColor || "#ffffff", P = s.tooltipOffsetX ?? 0, E = s.tooltipOffsetY ?? -25, x = (X, V, it, lt, nt, bt, ht) => {
|
|
4347
|
+
if ((X === "Custom" || X === "Icon") && ht)
|
|
4345
4348
|
try {
|
|
4346
|
-
const wt = new Path2D(
|
|
4349
|
+
const wt = new Path2D(ht);
|
|
4347
4350
|
if (t.save(), t.translate(V, it), X === "Icon") {
|
|
4348
|
-
const Mt = Math.min(
|
|
4351
|
+
const Mt = Math.min(lt, nt) / 24;
|
|
4349
4352
|
t.scale(Mt, Mt), t.translate(-12, -12);
|
|
4350
4353
|
}
|
|
4351
4354
|
t.fill(wt), t.restore();
|
|
@@ -4354,28 +4357,28 @@ class ci {
|
|
|
4354
4357
|
console.error("Error drawing slider shape in engine:", wt);
|
|
4355
4358
|
}
|
|
4356
4359
|
if (t.beginPath(), X === "Ellipse")
|
|
4357
|
-
t.ellipse(V, it,
|
|
4360
|
+
t.ellipse(V, it, lt / 2, nt / 2, 0, 0, Math.PI * 2);
|
|
4358
4361
|
else if (X === "Rectangle")
|
|
4359
|
-
this.drawRoundRect(t, V -
|
|
4362
|
+
this.drawRoundRect(t, V - lt / 2, it - nt / 2, lt, nt, bt);
|
|
4360
4363
|
else if (X === "Triangle")
|
|
4361
|
-
t.moveTo(V, it - nt / 2), t.lineTo(V +
|
|
4364
|
+
t.moveTo(V, it - nt / 2), t.lineTo(V + lt / 2, it + nt / 2), t.lineTo(V - lt / 2, it + nt / 2), t.closePath();
|
|
4362
4365
|
else if (X === "Diamond")
|
|
4363
|
-
t.moveTo(V, it - nt / 2), t.lineTo(V +
|
|
4366
|
+
t.moveTo(V, it - nt / 2), t.lineTo(V + lt / 2, it), t.lineTo(V, it + nt / 2), t.lineTo(V - lt / 2, it), t.closePath();
|
|
4364
4367
|
else if (X === "Polygon") {
|
|
4365
|
-
const wt = i.geometry.sides || 3, Mt = i.geometry.radius || Math.min(
|
|
4368
|
+
const wt = i.geometry.sides || 3, Mt = i.geometry.radius || Math.min(lt, nt) / 2;
|
|
4366
4369
|
for (let It = 0; It < wt; It++) {
|
|
4367
4370
|
const Ot = It * 2 * Math.PI / wt - Math.PI / 2, At = V + Mt * Math.cos(Ot), Tt = it + Mt * Math.sin(Ot);
|
|
4368
4371
|
It === 0 ? t.moveTo(At, Tt) : t.lineTo(At, Tt);
|
|
4369
4372
|
}
|
|
4370
4373
|
t.closePath();
|
|
4371
4374
|
} else if (X === "Star") {
|
|
4372
|
-
const Mt = Math.min(
|
|
4375
|
+
const Mt = Math.min(lt, nt) / 2, It = Mt / 2;
|
|
4373
4376
|
for (let Ot = 0; Ot < 10; Ot++) {
|
|
4374
4377
|
const At = Ot % 2 === 0 ? Mt : It, Tt = Ot * Math.PI / 5 - Math.PI / 2;
|
|
4375
4378
|
t.lineTo(V + At * Math.cos(Tt), it + At * Math.sin(Tt));
|
|
4376
4379
|
}
|
|
4377
4380
|
t.closePath();
|
|
4378
|
-
} else X === "Line" && (t.moveTo(V -
|
|
4381
|
+
} else X === "Line" && (t.moveTo(V - lt / 2, it), t.lineTo(V + lt / 2, it));
|
|
4379
4382
|
t.fill();
|
|
4380
4383
|
}, O = this.createCanvasFill(t, m, n, u);
|
|
4381
4384
|
O && (t.fillStyle = O, t.strokeStyle = O), d === "Line" ? (t.lineWidth = u, t.beginPath(), t.moveTo(-n / 2, 0), t.lineTo(n / 2, 0), t.stroke()) : x(d, 0, 0, n, u, h, p);
|
|
@@ -4392,21 +4395,21 @@ class ci {
|
|
|
4392
4395
|
t.save(), t.translate(B + P, E);
|
|
4393
4396
|
const X = Math.round(a).toString();
|
|
4394
4397
|
t.font = "10px Inter, sans-serif";
|
|
4395
|
-
const V = t.measureText(X), it = 6,
|
|
4396
|
-
t.beginPath(), this.drawRoundRect(t, -nt / 2, -
|
|
4398
|
+
const V = t.measureText(X), it = 6, lt = 4, nt = V.width + it * 2, bt = 14 + lt;
|
|
4399
|
+
t.beginPath(), this.drawRoundRect(t, -nt / 2, -bt / 2, nt, bt, 4), t.fillStyle = T, t.fill(), t.fillStyle = R, t.textAlign = "center", t.textBaseline = "middle", t.fillText(X, 0, 0), t.restore();
|
|
4397
4400
|
}
|
|
4398
4401
|
const A = s.label || {}, _ = s.helperText || {}, L = s.fontFamily || "Inter";
|
|
4399
4402
|
if (A.visible !== !1) {
|
|
4400
|
-
const X = A.text || "Label", V = A.fontSize || 12, it = A.color || "rgba(156, 163, 175, 1)",
|
|
4403
|
+
const X = A.text || "Label", V = A.fontSize || 12, it = A.color || "rgba(156, 163, 175, 1)", lt = A.offset ?? 8;
|
|
4401
4404
|
t.font = `600 ${V}px "${L}", sans-serif`, t.fillStyle = it, t.textAlign = "left", t.textBaseline = "bottom";
|
|
4402
|
-
const nt = -(n / 2),
|
|
4403
|
-
t.fillText(X, nt,
|
|
4405
|
+
const nt = -(n / 2), bt = -(u / 2) - lt;
|
|
4406
|
+
t.fillText(X, nt, bt);
|
|
4404
4407
|
}
|
|
4405
4408
|
if (_.visible === !0) {
|
|
4406
|
-
const X = _.text || "Helper text", V = _.fontSize || 11, it = _.color || "rgba(156, 163, 175, 1)",
|
|
4409
|
+
const X = _.text || "Helper text", V = _.fontSize || 11, it = _.color || "rgba(156, 163, 175, 1)", lt = _.offset ?? 6;
|
|
4407
4410
|
t.font = `400 ${V}px "${L}", sans-serif`, t.fillStyle = it, t.textAlign = "left", t.textBaseline = "top";
|
|
4408
|
-
const nt = -(n / 2),
|
|
4409
|
-
t.fillText(X, nt,
|
|
4411
|
+
const nt = -(n / 2), bt = u / 2 + lt;
|
|
4412
|
+
t.fillText(X, nt, bt);
|
|
4410
4413
|
}
|
|
4411
4414
|
}
|
|
4412
4415
|
renderDropdown(t, i) {
|
|
@@ -4452,14 +4455,14 @@ class ci {
|
|
|
4452
4455
|
_ > 0 && (t.shadowColor = "transparent", t.strokeStyle = this.createCanvasFill(t, typeof e.listBorderColor == "string" ? { type: "Solid", color: e.listBorderColor } : e.listBorderColor || { type: "Solid", color: d }, s, $) || "#e5e7eb", t.lineWidth = _, t.stroke()), t.restore();
|
|
4453
4456
|
const L = e.itemFontSize || I, X = e.itemFontFamily || k;
|
|
4454
4457
|
t.font = `${M} ${L}px ${X}`, O.forEach((V, it) => {
|
|
4455
|
-
const
|
|
4458
|
+
const lt = x + B + it * W;
|
|
4456
4459
|
if (V === e.selectedOption)
|
|
4457
|
-
t.fillStyle = this.createCanvasFill(t, typeof e.itemSelectedBackgroundColor == "string" ? { type: "Solid", color: e.itemSelectedBackgroundColor } : e.itemSelectedBackgroundColor || { type: "Solid", color: "#f3f4f6" }, s, W) || "#f3f4f6", t.fillRect(a + _,
|
|
4460
|
+
t.fillStyle = this.createCanvasFill(t, typeof e.itemSelectedBackgroundColor == "string" ? { type: "Solid", color: e.itemSelectedBackgroundColor } : e.itemSelectedBackgroundColor || { type: "Solid", color: "#f3f4f6" }, s, W) || "#f3f4f6", t.fillRect(a + _, lt, s - _ * 2, W), t.fillStyle = e.itemSelectedColor || e.accentColor || p || "#374151";
|
|
4458
4461
|
else if (t.fillStyle = e.listTextColor || p || "#333333", this.activeDropdownId === i.id && this._lastPointerPos) {
|
|
4459
|
-
const
|
|
4460
|
-
it ===
|
|
4462
|
+
const bt = this._lastPointerPos.y - (x + B), ht = Math.floor(bt / W);
|
|
4463
|
+
it === ht && (t.fillStyle = this.createCanvasFill(t, typeof e.itemHoverBackgroundColor == "string" ? { type: "Solid", color: e.itemHoverBackgroundColor } : e.itemHoverBackgroundColor || { type: "Solid", color: "#f9fafb" }, s, W) || "#f9fafb", t.fillRect(a + _, lt, s - _ * 2, W), t.fillStyle = e.itemHoverColor || p);
|
|
4461
4464
|
}
|
|
4462
|
-
t.fillText(V, a + b,
|
|
4465
|
+
t.fillText(V, a + b, lt + W / 2);
|
|
4463
4466
|
});
|
|
4464
4467
|
}
|
|
4465
4468
|
t.globalAlpha = y;
|
|
@@ -4492,14 +4495,14 @@ class ci {
|
|
|
4492
4495
|
t.font = `${f.fontWeight || 600} ${d}px "${p}", sans-serif`, t.fillStyle = h, t.textAlign = "center", t.textBaseline = "middle", t.fillText(f.text || "Toggle", 0, 0), t.restore();
|
|
4493
4496
|
}
|
|
4494
4497
|
renderToggle(t, i) {
|
|
4495
|
-
var Y, H, K, A, _, L, X, V, it,
|
|
4498
|
+
var Y, H, K, A, _, L, X, V, it, lt, nt, bt;
|
|
4496
4499
|
const o = this.objectStates.get(i.id), e = (o == null ? void 0 : o.options) || i.options || {}, s = ((Y = i.geometry) == null ? void 0 : Y.width) || 52, n = ((H = i.geometry) == null ? void 0 : H.height) || 30, a = -s / 2, r = -n / 2, l = e.checked ?? !1, c = e.cornerRadius ?? e.corner_radius ?? n / 2, f = e.toggleStyle || {}, u = f.backgroundColor || e.activeColor || "#10b981", h = f.borderColor || e.borderColor || "transparent", d = f.borderWidth ?? e.borderWidth ?? 0, p = f.knobColor || e.knobColor || "#ffffff", y = l ? u : e.inactiveColor || "#374151", m = l ? h : e.borderColor || "transparent", b = l ? d : e.borderWidth ?? 0, v = l ? p : e.knobColor || "#ffffff";
|
|
4497
4500
|
e.disabled && (t.globalAlpha *= 0.5), t.beginPath(), this.drawRoundRect(t, a, r, s, n, c);
|
|
4498
4501
|
const S = this.createCanvasFill(t, y, s, n);
|
|
4499
4502
|
if (S && (t.fillStyle = S, t.fill()), b > 0) {
|
|
4500
4503
|
t.lineWidth = b;
|
|
4501
|
-
const
|
|
4502
|
-
|
|
4504
|
+
const ht = this.createCanvasFill(t, m, s, n);
|
|
4505
|
+
ht && (t.strokeStyle = ht, t.stroke());
|
|
4503
4506
|
}
|
|
4504
4507
|
const C = 2, w = n - C * 2, I = w / 2, M = a + C, k = a + s - C - w, T = l ? k : M, R = r + C;
|
|
4505
4508
|
t.beginPath(), t.arc(T + I, R + I, I, 0, Math.PI * 2);
|
|
@@ -4508,20 +4511,20 @@ class ci {
|
|
|
4508
4511
|
let E = !1, x = !1;
|
|
4509
4512
|
const O = (l ? (K = f.leftLabel) == null ? void 0 : K.text : null) || ((A = e.leftLabel) == null ? void 0 : A.text) || "", W = (l ? (_ = f.leftLabel) == null ? void 0 : _.color : null) || ((L = e.leftLabel) == null ? void 0 : L.color) || "#f3f4f6";
|
|
4510
4513
|
if ((X = e.leftLabel) != null && X.enabled && O) {
|
|
4511
|
-
const
|
|
4512
|
-
t.font = `${
|
|
4514
|
+
const ht = e.leftLabel;
|
|
4515
|
+
t.font = `${ht.fontWeight || 400} ${ht.fontSize || 12}px "${ht.fontFamily || "Inter"}", sans-serif`, t.fillStyle = W, t.textBaseline = "middle", t.textAlign = "right", t.fillText(O, a - (ht.gap || 8), 0), E = !0;
|
|
4513
4516
|
}
|
|
4514
|
-
const B = (l ? (V = f.rightLabel) == null ? void 0 : V.text : null) || ((it = e.rightLabel) == null ? void 0 : it.text) || "", $ = (l ? (
|
|
4515
|
-
if ((
|
|
4516
|
-
const
|
|
4517
|
-
t.font = `${
|
|
4517
|
+
const B = (l ? (V = f.rightLabel) == null ? void 0 : V.text : null) || ((it = e.rightLabel) == null ? void 0 : it.text) || "", $ = (l ? (lt = f.rightLabel) == null ? void 0 : lt.color : null) || ((nt = e.rightLabel) == null ? void 0 : nt.color) || "#f3f4f6";
|
|
4518
|
+
if ((bt = e.rightLabel) != null && bt.enabled && B) {
|
|
4519
|
+
const ht = e.rightLabel;
|
|
4520
|
+
t.font = `${ht.fontWeight || 400} ${ht.fontSize || 12}px "${ht.fontFamily || "Inter"}", sans-serif`, t.fillStyle = $, t.textBaseline = "middle", t.textAlign = "left", t.fillText(B, a + s + (ht.gap || 8), 0), x = !0;
|
|
4518
4521
|
}
|
|
4519
4522
|
if (!E && !x && e.label && e.label.text) {
|
|
4520
|
-
const
|
|
4521
|
-
t.font = `${Mt} ${wt}px "${It}", sans-serif`, t.fillStyle =
|
|
4522
|
-
const Ot =
|
|
4523
|
+
const ht = e.label, wt = ht.fontSize || 14, Mt = ht.fontWeight || 400, It = ht.fontFamily || "Inter";
|
|
4524
|
+
t.font = `${Mt} ${wt}px "${It}", sans-serif`, t.fillStyle = ht.color || "#f3f4f6", t.textBaseline = "middle";
|
|
4525
|
+
const Ot = ht.gap || 10;
|
|
4523
4526
|
let At = 0, Tt = 0;
|
|
4524
|
-
|
|
4527
|
+
ht.position === "left" ? (t.textAlign = "right", At = a - Ot, Tt = 0) : ht.position === "right" ? (t.textAlign = "left", At = a + s + Ot, Tt = 0) : ht.position === "top" ? (t.textAlign = "center", At = 0, Tt = r - Ot, t.textBaseline = "bottom") : ht.position === "bottom" ? (t.textAlign = "center", At = 0, Tt = r + n + Ot, t.textBaseline = "top") : (t.textAlign = "left", At = a + s + Ot, Tt = 0), t.fillText(ht.text, At, Tt);
|
|
4525
4528
|
}
|
|
4526
4529
|
}
|
|
4527
4530
|
renderCheckbox(t, i) {
|
|
@@ -5142,24 +5145,24 @@ class ci {
|
|
|
5142
5145
|
L = vt + Math.cos(ut) * pt - A / 2, X = xt + Math.sin(ut) * pt - _ / 2, V = ut + (e.itemRotation || 0) * Math.PI / 180;
|
|
5143
5146
|
} else
|
|
5144
5147
|
L = c === "vertical" ? a : E, X = c === "vertical" ? E : r, V = (e.itemRotation || 0) * Math.PI / 180;
|
|
5145
|
-
const it = C === H,
|
|
5146
|
-
if (t.save(), V !== 0 && (t.translate(L + A / 2, X + _ / 2), t.rotate(V), t.translate(-(L + A / 2), -(X + _ / 2))),
|
|
5148
|
+
const it = C === H, lt = w === H, nt = lt && e.activeItemShape ? e.activeItemShape : e.itemShape || "rectangle", bt = lt && e.activeItemShape ? e.activeItemPath : e.itemPath || "", ht = e.itemCornerRadius || 0;
|
|
5149
|
+
if (t.save(), V !== 0 && (t.translate(L + A / 2, X + _ / 2), t.rotate(V), t.translate(-(L + A / 2), -(X + _ / 2))), lt) {
|
|
5147
5150
|
const Tt = this.createCanvasFill(t, b, A, _);
|
|
5148
5151
|
t.fillStyle = Tt || b;
|
|
5149
5152
|
const zt = t.globalAlpha;
|
|
5150
|
-
t.globalAlpha = zt * 0.8, t.beginPath(), this.drawCustomShape(t, nt,
|
|
5153
|
+
t.globalAlpha = zt * 0.8, t.beginPath(), this.drawCustomShape(t, nt, bt, L, X, A, _, ht) || (t.rect(L, X, A, _), t.fill()), t.globalAlpha = zt;
|
|
5151
5154
|
} else if (it)
|
|
5152
|
-
t.fillStyle = m ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.05)", t.beginPath(), this.drawCustomShape(t, nt,
|
|
5155
|
+
t.fillStyle = m ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.05)", t.beginPath(), this.drawCustomShape(t, nt, bt, L, X, A, _, ht) || (t.rect(L, X, A, _), t.fill());
|
|
5153
5156
|
else if (S !== "transparent") {
|
|
5154
5157
|
const Tt = this.createCanvasFill(t, S, A, _);
|
|
5155
|
-
t.fillStyle = Tt || S, t.beginPath(), this.drawCustomShape(t, nt,
|
|
5158
|
+
t.fillStyle = Tt || S, t.beginPath(), this.drawCustomShape(t, nt, bt, L, X, A, _, ht) || (t.rect(L, X, A, _), t.fill());
|
|
5156
5159
|
}
|
|
5157
|
-
if (
|
|
5160
|
+
if (lt || it) {
|
|
5158
5161
|
const Tt = this.createCanvasFill(t, b, c === "vertical" ? 3 : A, c === "vertical" ? _ : 3);
|
|
5159
5162
|
t.fillStyle = Tt || b, c === "vertical" ? t.fillRect(L, X, 3, _) : t.fillRect(L, X + _ - 3, A, 3);
|
|
5160
5163
|
}
|
|
5161
|
-
const wt =
|
|
5162
|
-
t.fillStyle = wt, t.font =
|
|
5164
|
+
const wt = lt ? "#ffffff" : m ? "rgba(255, 255, 255, 0.9)" : v;
|
|
5165
|
+
t.fillStyle = wt, t.font = lt || it ? "600 14px Inter, sans-serif" : "400 14px Inter, sans-serif";
|
|
5163
5166
|
const Mt = typeof Y == "string" ? Y : (Y == null ? void 0 : Y.label) || `Item ${H + 1}`, It = L + (c === "vertical" ? 16 : A / 2), Ot = X + _ / 2;
|
|
5164
5167
|
c === "horizontal" || K === "circular" ? t.textAlign = "center" : t.textAlign = "left";
|
|
5165
5168
|
const At = K === "circular" ? L + A / 2 : It;
|
|
@@ -5171,11 +5174,11 @@ class ci {
|
|
|
5171
5174
|
if (A) {
|
|
5172
5175
|
const X = Math.min(s, n) / 2 - L / 2 - 2, V = a + s / 2, it = r + n / 2;
|
|
5173
5176
|
if (t.strokeStyle = _, t.lineWidth = L, t.lineCap = "round", t.beginPath(), K === "circular") {
|
|
5174
|
-
const
|
|
5175
|
-
t.arc(V, it, X, nt, nt +
|
|
5177
|
+
const lt = Math.PI / 4, nt = -(p * 0.01) - Math.PI / 2;
|
|
5178
|
+
t.arc(V, it, X, nt, nt + lt);
|
|
5176
5179
|
} else {
|
|
5177
|
-
const
|
|
5178
|
-
t.arc(V, it, X, Mt, Mt +
|
|
5180
|
+
const lt = Math.PI / 2, nt = H / Y, bt = lt * nt, ht = -p / Y * lt, Mt = -Math.PI / 4 + ht;
|
|
5181
|
+
t.arc(V, it, X, Mt, Mt + bt);
|
|
5179
5182
|
}
|
|
5180
5183
|
t.stroke();
|
|
5181
5184
|
} else {
|
|
@@ -5233,8 +5236,8 @@ class ci {
|
|
|
5233
5236
|
} else
|
|
5234
5237
|
A = l === "vertical" ? I : T, _ = l === "vertical" ? T : M, L = (e.itemRotation || 0) * Math.PI / 180;
|
|
5235
5238
|
if (L !== 0) {
|
|
5236
|
-
const X = A + H / 2, V = _ + K / 2, it = C - X,
|
|
5237
|
-
if (
|
|
5239
|
+
const X = A + H / 2, V = _ + K / 2, it = C - X, lt = w - V, nt = -L, bt = it * Math.cos(nt) - lt * Math.sin(nt) + X, ht = it * Math.sin(nt) + lt * Math.cos(nt) + V;
|
|
5240
|
+
if (bt >= A && bt <= A + H && ht >= _ && ht <= _ + K)
|
|
5238
5241
|
return Y;
|
|
5239
5242
|
} else if (C >= A && C <= A + H && w >= _ && w <= _ + K)
|
|
5240
5243
|
return Y;
|
|
@@ -5256,7 +5259,7 @@ class ci {
|
|
|
5256
5259
|
if (!e.behaviors || e.behaviors.length === 0) return;
|
|
5257
5260
|
const s = this.objectStates.get(e.id);
|
|
5258
5261
|
s && e.behaviors.forEach((n) => {
|
|
5259
|
-
var u, h, d, p, y, m, b, v, S, C, w, I, M, k, T, R, P, E, x, O, W, B, $, Y, H, K, A, _, L, X, V, it,
|
|
5262
|
+
var u, h, d, p, y, m, b, v, S, C, w, I, M, k, T, R, P, E, x, O, W, B, $, Y, H, K, A, _, L, X, V, it, lt, nt, bt, ht, wt, Mt, It, Ot, At, Tt, zt, Z, pt, Et, ut, vt, xt, Xt, Bt, Dt, Ht, te, ue, pe, Qt, me, _e, ye, Se, Pe, ae, ee, at, gt, j, z, D, et, mt, Pt, Ct, Wt, yt, F, Lt, jt, Vt, ce, Rt, ft, ct, tt, dt, G, st, J, Ft, Ut, se, Yt, qt, Nt, Ce, Ee, Ae, Oe, Re, xe, $e, Gt, ie, be, Le, Fe, he, re, le, we, We, Ge, De, Be, ze, Ve, Ze, je;
|
|
5260
5263
|
if (!n.enabled) return;
|
|
5261
5264
|
const a = n.startTime || 0, r = n.endTime || 1 / 0;
|
|
5262
5265
|
if (this.currentTime < a || this.currentTime > r) return;
|
|
@@ -5264,14 +5267,14 @@ class ci {
|
|
|
5264
5267
|
if (this.frameCount % 240 === 0 && Math.random() < 0.1 && this.log(`[ExodeUI] Executing ${n.type} on ${e.name}`), n.type === N.Proximity) {
|
|
5265
5268
|
const U = ((u = n.settings) == null ? void 0 : u.radius) || 300, Q = ((h = n.settings) == null ? void 0 : h.falloff) || "smooth";
|
|
5266
5269
|
let q = 0;
|
|
5267
|
-
f < U && (Q === "linear" ? q = 1 - f / U : q = Math.pow(1 - f / U, 2)), n.sensors.forEach((
|
|
5268
|
-
this.applyBehaviorSensor(s,
|
|
5270
|
+
f < U && (Q === "linear" ? q = 1 - f / U : q = Math.pow(1 - f / U, 2)), n.sensors.forEach((rt) => {
|
|
5271
|
+
this.applyBehaviorSensor(s, rt, q, t, n.settings, e, l, c, f);
|
|
5269
5272
|
});
|
|
5270
5273
|
} else if (n.type === N.Magnetic) {
|
|
5271
5274
|
const U = ((d = n.settings) == null ? void 0 : d.radius) || 400, Q = ((p = n.settings) == null ? void 0 : p.strength) || 0.5;
|
|
5272
5275
|
if (f < U && f > 5) {
|
|
5273
|
-
const q = 1 - f / U,
|
|
5274
|
-
s.x -=
|
|
5276
|
+
const q = 1 - f / U, rt = l * q * Q, kt = c * q * Q;
|
|
5277
|
+
s.x -= rt * t * 10, s.y -= kt * t * 10;
|
|
5275
5278
|
}
|
|
5276
5279
|
} else if (n.type === N.Repel) {
|
|
5277
5280
|
const U = ((y = n.settings) == null ? void 0 : y.radius) || 300, Q = ((m = n.settings) == null ? void 0 : m.strength) || 1;
|
|
@@ -5285,14 +5288,14 @@ class ci {
|
|
|
5285
5288
|
} else if (n.type === N.Vortex) {
|
|
5286
5289
|
const U = ((S = n.settings) == null ? void 0 : S.radius) || 400, Q = ((C = n.settings) == null ? void 0 : C.speed) || 2, q = ((w = n.settings) == null ? void 0 : w.strength) || 1;
|
|
5287
5290
|
if (f < U) {
|
|
5288
|
-
const
|
|
5289
|
-
s.x += _t *
|
|
5291
|
+
const rt = Math.pow(1 - f / U, 1.5), kt = this.currentTime * Q * Math.PI * 2, _t = Math.cos(kt) * 30 - l * 0.4, $t = Math.sin(kt) * 30 - c * 0.4;
|
|
5292
|
+
s.x += _t * rt * q * t * 5, s.y += $t * rt * q * t * 5, s.rotation += 5 * rt * q * t * 5, s.scale_x *= 1 - rt * 0.1 * q * t, s.scale_y *= 1 - rt * 0.1 * q * t;
|
|
5290
5293
|
}
|
|
5291
5294
|
} else if (n.type === N.Fluid) {
|
|
5292
5295
|
const U = ((I = n.settings) == null ? void 0 : I.radius) || 300, Q = ((M = n.settings) == null ? void 0 : M.strength) || 1;
|
|
5293
5296
|
if (f < U) {
|
|
5294
|
-
const q = Math.pow(1 - f / U, 1.2),
|
|
5295
|
-
s.x +=
|
|
5297
|
+
const q = Math.pow(1 - f / U, 1.2), rt = l / (f || 1) * q * 1.2 * Q, kt = c / (f || 1) * q * 1.2 * Q;
|
|
5298
|
+
s.x += rt * 10 * t * 5, s.y += kt * 10 * t * 5, s.scale_x *= 1 + q * 0.3 * Q * t, s.scale_y *= 1 + q * 0.3 * Q * t;
|
|
5296
5299
|
}
|
|
5297
5300
|
} else if (n.type === N.Elastic) {
|
|
5298
5301
|
const U = ((k = n.settings) == null ? void 0 : k.radius) || 300, Q = ((T = n.settings) == null ? void 0 : T.strength) || 1;
|
|
@@ -5303,8 +5306,8 @@ class ci {
|
|
|
5303
5306
|
} else if (n.type === N.Holographic) {
|
|
5304
5307
|
const U = s.x - this.canvasWidth / 2, Q = s.y - this.canvasHeight / 2, q = ((R = n.settings) == null ? void 0 : R.factor) || 25;
|
|
5305
5308
|
if (s.x -= U / 1e3 * q * t * 5, s.y -= Q / 1e3 * q * t * 5, s.style) {
|
|
5306
|
-
const
|
|
5307
|
-
s.style.exposure = (s.style.exposure || 1) +
|
|
5309
|
+
const rt = 1 - Math.min(1, f / 400);
|
|
5310
|
+
s.style.exposure = (s.style.exposure || 1) + rt * 0.5 * t;
|
|
5308
5311
|
}
|
|
5309
5312
|
} else if (n.type === N.Sticky) {
|
|
5310
5313
|
const U = ((P = n.settings) == null ? void 0 : P.radius) || 80, Q = ((E = n.settings) == null ? void 0 : E.strength) || 1;
|
|
@@ -5319,17 +5322,17 @@ class ci {
|
|
|
5319
5322
|
s.scale_x *= 1 + q * 0.5 * Q * t, s.scale_y *= 1 + q * 0.5 * Q * t;
|
|
5320
5323
|
}
|
|
5321
5324
|
} else if (n.type === N.Parallax) {
|
|
5322
|
-
const U = ((W = n.settings) == null ? void 0 : W.factor) || 15, Q = ((B = n.settings) == null ? void 0 : B.strength) || 1, q = this.canvasWidth / 2,
|
|
5325
|
+
const U = ((W = n.settings) == null ? void 0 : W.factor) || 15, Q = ((B = n.settings) == null ? void 0 : B.strength) || 1, q = this.canvasWidth / 2, rt = this.canvasHeight / 2, kt = this._lastPointerPos || { x: q, y: rt }, _t = (kt.x - q) / q, $t = (kt.y - rt) / rt, Zt = ((($ = e.transform) == null ? void 0 : $.x) ?? 0) + _t * U * Q, fe = (((Y = e.transform) == null ? void 0 : Y.y) ?? 0) + $t * U * Q, Ie = (((H = e.transform) == null ? void 0 : H.rotate_x) ?? 0) - $t * U * 1.5 * Q, ne = (((K = e.transform) == null ? void 0 : K.rotate_y) ?? 0) + _t * U * 1.5 * Q, ge = Math.min(1, 10 * t);
|
|
5323
5326
|
s.x = this.lerp(s.x ?? ((A = e.transform) == null ? void 0 : A.x) ?? 0, Zt, ge), s.y = this.lerp(s.y ?? ((_ = e.transform) == null ? void 0 : _.y) ?? 0, fe, ge), s.rotate_x = this.lerp(s.rotate_x ?? ((L = e.transform) == null ? void 0 : L.rotate_x) ?? 0, Ie, ge), s.rotate_y = this.lerp(s.rotate_y ?? ((X = e.transform) == null ? void 0 : X.rotate_y) ?? 0, ne, ge);
|
|
5324
5327
|
} else if (n.type === N.Fold) {
|
|
5325
5328
|
if (f < 300) {
|
|
5326
|
-
const U = 1 - f / 300, Q = (l > 0 ? -1 : 1) * U * 10, q = 1 - U * 0.1,
|
|
5327
|
-
s.skew_x = this.lerp(s.skew_x ?? ((V = e.transform) == null ? void 0 : V.skew_x) ?? 0, Q, _t), s.scale_y = this.lerp(s.scale_y ?? ((it = e.transform) == null ? void 0 : it.scale_y) ?? 1, (((
|
|
5329
|
+
const U = 1 - f / 300, Q = (l > 0 ? -1 : 1) * U * 10, q = 1 - U * 0.1, rt = c / 300 * U * 20, kt = -(l / 300) * U * 20, _t = Math.min(1, 10 * t);
|
|
5330
|
+
s.skew_x = this.lerp(s.skew_x ?? ((V = e.transform) == null ? void 0 : V.skew_x) ?? 0, Q, _t), s.scale_y = this.lerp(s.scale_y ?? ((it = e.transform) == null ? void 0 : it.scale_y) ?? 1, (((lt = e.transform) == null ? void 0 : lt.scale_y) ?? 1) * q, _t), s.rotate_x = this.lerp(s.rotate_x ?? ((nt = e.transform) == null ? void 0 : nt.rotate_x) ?? 0, rt, _t), s.rotate_y = this.lerp(s.rotate_y ?? ((bt = e.transform) == null ? void 0 : bt.rotate_y) ?? 0, kt, _t), s.style = s.style || { ...e.style }, s.style.artEffect = { enabled: !0, type: "fold_overlay", intensity: ((ht = n.settings) == null ? void 0 : ht.opacity) ?? 0.5 };
|
|
5328
5331
|
}
|
|
5329
5332
|
} else if (n.type === N.Crumple) {
|
|
5330
5333
|
if (f < 300) {
|
|
5331
|
-
const U = 1 - f / 300, Q = U * (Math.random() - 0.5) * 5, q = U * (Math.random() - 0.5) * 0.05,
|
|
5332
|
-
s.skew_x = this.lerp(s.skew_x ?? ((wt = e.transform) == null ? void 0 : wt.skew_x) ?? 0, Q,
|
|
5334
|
+
const U = 1 - f / 300, Q = U * (Math.random() - 0.5) * 5, q = U * (Math.random() - 0.5) * 0.05, rt = Math.min(1, 15 * t);
|
|
5335
|
+
s.skew_x = this.lerp(s.skew_x ?? ((wt = e.transform) == null ? void 0 : wt.skew_x) ?? 0, Q, rt), s.scale_x = this.lerp(s.scale_x ?? ((Mt = e.transform) == null ? void 0 : Mt.scale_x) ?? 1, (((It = e.transform) == null ? void 0 : It.scale_x) ?? 1) * (1 + q), rt), s.scale_y = this.lerp(s.scale_y ?? ((Ot = e.transform) == null ? void 0 : Ot.scale_y) ?? 1, (((At = e.transform) == null ? void 0 : At.scale_y) ?? 1) * (1 + q), rt), s.style = s.style || { ...e.style }, s.style.artEffect = { enabled: !0, type: "crumple_overlay", intensity: ((Tt = n.settings) == null ? void 0 : Tt.intensity) ?? 1, scale: ((zt = n.settings) == null ? void 0 : zt.scale) ?? 2 };
|
|
5333
5336
|
}
|
|
5334
5337
|
} else if (n.type === N.Squash) {
|
|
5335
5338
|
const U = ((Z = n.settings) == null ? void 0 : Z.strength) || 0.8;
|
|
@@ -5337,7 +5340,7 @@ class ci {
|
|
|
5337
5340
|
} else if (n.type === N.TextCounter) {
|
|
5338
5341
|
const U = ((xt = n.settings) == null ? void 0 : xt.duration) || 2, Q = ((Xt = n.settings) == null ? void 0 : Xt.from) || 0, q = ((Bt = n.settings) == null ? void 0 : Bt.to) || 100;
|
|
5339
5342
|
n._runtimeStart === void 0 && (n._runtimeStart = this.currentTime);
|
|
5340
|
-
const
|
|
5343
|
+
const rt = this.currentTime - n._runtimeStart, kt = Math.min(1, rt / U), _t = Math.floor(Q + (q - Q) * kt);
|
|
5341
5344
|
if (((Dt = e.geometry) == null ? void 0 : Dt.type) === "Text") {
|
|
5342
5345
|
const $t = ((Ht = n.settings) == null ? void 0 : Ht.prefix) || "", Zt = ((te = n.settings) == null ? void 0 : te.suffix) || "";
|
|
5343
5346
|
s.geometry || (s.geometry = { ...e.geometry }), s.geometry.text = `${$t}${_t}${Zt}`;
|
|
@@ -5350,22 +5353,22 @@ class ci {
|
|
|
5350
5353
|
} else
|
|
5351
5354
|
(ye = s.style) != null && ye.adjustments && (s.style.adjustments.exposure = this.lerp(s.style.adjustments.exposure || 0, ((Pe = (Se = e.style) == null ? void 0 : Se.adjustments) == null ? void 0 : Pe.exposure) || 0, 0.1));
|
|
5352
5355
|
} else if (n.type === N.Noise || n.type === N.Float) {
|
|
5353
|
-
const U = (((ae = n.settings) == null ? void 0 : ae.frequency) || ((ee = n.settings) == null ? void 0 : ee.speed) || 1) * 2e-3, Q = (((
|
|
5356
|
+
const U = (((ae = n.settings) == null ? void 0 : ae.frequency) || ((ee = n.settings) == null ? void 0 : ee.speed) || 1) * 2e-3, Q = (((at = n.settings) == null ? void 0 : at.amplitude) || ((gt = n.settings) == null ? void 0 : gt.range) || 50) * (((j = n.settings) == null ? void 0 : j.strength) || 1), q = Date.now();
|
|
5354
5357
|
s.x += Math.sin(q * U) * Q * t, s.y += Math.cos(q * U * 0.8) * Q * t, s.rotation += Math.sin(q * U * 0.5) * 5 * t;
|
|
5355
5358
|
} else if (n.type === N.Pulse) {
|
|
5356
|
-
const U = (((z = n.settings) == null ? void 0 : z.speed) || 1) * 5e-3, Q = (((D = n.settings) == null ? void 0 : D.scale) || 1.2) - 1, q = Math.sin(Date.now() * U),
|
|
5357
|
-
s.scale_x *= 1 + q * Q *
|
|
5359
|
+
const U = (((z = n.settings) == null ? void 0 : z.speed) || 1) * 5e-3, Q = (((D = n.settings) == null ? void 0 : D.scale) || 1.2) - 1, q = Math.sin(Date.now() * U), rt = ((et = n.settings) == null ? void 0 : et.strength) || 1;
|
|
5360
|
+
s.scale_x *= 1 + q * Q * rt * t, s.scale_y *= 1 + q * Q * rt * t, s.style && (s.style.exposure = (s.style.exposure || 1) + Math.max(0, q) * 0.1 * rt * t);
|
|
5358
5361
|
} else if (n.type === N.Draggable) {
|
|
5359
|
-
const U = ((
|
|
5362
|
+
const U = ((mt = n.settings) == null ? void 0 : mt.radius) || 150, Q = this.draggingBehaviors.has(e.id);
|
|
5360
5363
|
if (f < U || Q) {
|
|
5361
|
-
const q = ((Pt = n.settings) == null ? void 0 : Pt.strength) || 1,
|
|
5362
|
-
this.applyBehaviorSensor(s, Kt.PositionX,
|
|
5364
|
+
const q = ((Pt = n.settings) == null ? void 0 : Pt.strength) || 1, rt = Q ? 1 : Math.max(0, 1 - f / U);
|
|
5365
|
+
this.applyBehaviorSensor(s, Kt.PositionX, rt * q, t, n.settings), this.applyBehaviorSensor(s, Kt.PositionY, rt * q, t, n.settings);
|
|
5363
5366
|
}
|
|
5364
5367
|
} else if (n.type === N.Scroll) {
|
|
5365
|
-
const U = ((Ct = n.settings) == null ? void 0 : Ct.axis) || "vertical", Q = ((Wt = n.settings) == null ? void 0 : Wt.factor) || 0.5, q = ((
|
|
5366
|
-
(U === "vertical" || U === "both") && (s.y += this.scrollOffset.y * Q * q * t), (U === "horizontal" || U === "both") && (s.x += this.scrollOffset.x * Q * q * t),
|
|
5368
|
+
const U = ((Ct = n.settings) == null ? void 0 : Ct.axis) || "vertical", Q = ((Wt = n.settings) == null ? void 0 : Wt.factor) || 0.5, q = ((yt = n.settings) == null ? void 0 : yt.strength) || 1, rt = ((F = n.settings) == null ? void 0 : F.scaleFactor) || 0;
|
|
5369
|
+
(U === "vertical" || U === "both") && (s.y += this.scrollOffset.y * Q * q * t), (U === "horizontal" || U === "both") && (s.x += this.scrollOffset.x * Q * q * t), rt !== 0 && (s.scale_x *= 1 + this.scrollOffset.y * rt * t, s.scale_y *= 1 + this.scrollOffset.y * rt * t);
|
|
5367
5370
|
} else if (n.type === N.LookAt) {
|
|
5368
|
-
const U = ((Lt = n.settings) == null ? void 0 : Lt.factor) || 1, Q = ((jt = n.settings) == null ? void 0 : jt.strength) || 1, q = Math.atan2(-c, -l) * (180 / Math.PI),
|
|
5371
|
+
const U = ((Lt = n.settings) == null ? void 0 : Lt.factor) || 1, Q = ((jt = n.settings) == null ? void 0 : jt.strength) || 1, q = Math.atan2(-c, -l) * (180 / Math.PI), rt = s.rotation, kt = (q - rt + 180) % 360 - 180;
|
|
5369
5372
|
s.rotation += kt * U * Q * t * 10;
|
|
5370
5373
|
} else if (n.type === N.Scan) {
|
|
5371
5374
|
const U = (((Vt = n.settings) == null ? void 0 : Vt.speed) || 1) * 4e-3, Q = ((ce = n.settings) == null ? void 0 : ce.strength) || 1, q = (Math.sin(Date.now() * U) + 1) / 2;
|
|
@@ -5377,7 +5380,7 @@ class ci {
|
|
|
5377
5380
|
intensity: ((Rt = n.settings) == null ? void 0 : Rt.strength) ?? 0.8
|
|
5378
5381
|
};
|
|
5379
5382
|
else if (n.type === N.Ratchet) {
|
|
5380
|
-
const U = ((ft = n.settings) == null ? void 0 : ft.steps) || 12, Q = (((
|
|
5383
|
+
const U = ((ft = n.settings) == null ? void 0 : ft.steps) || 12, Q = (((ct = n.settings) == null ? void 0 : ct.speed) || 1) * 30, q = Math.floor(s.rotation / (360 / U)) * (360 / U);
|
|
5381
5384
|
s.rotation = this.lerp(s.rotation, q + Q * t, 0.1);
|
|
5382
5385
|
} else if (n.type === N.Jitter && f < 300) {
|
|
5383
5386
|
const U = ((tt = n.settings) == null ? void 0 : tt.strength) || 1, Q = (((dt = n.settings) == null ? void 0 : dt.intensity) || 5) * U;
|
|
@@ -5387,8 +5390,8 @@ class ci {
|
|
|
5387
5390
|
if (U) {
|
|
5388
5391
|
const Q = this.objectStates.get(U);
|
|
5389
5392
|
if (Q) {
|
|
5390
|
-
const q = ((st = n.settings) == null ? void 0 : st.stiffness) || 0.1,
|
|
5391
|
-
s.x +=
|
|
5393
|
+
const q = ((st = n.settings) == null ? void 0 : st.stiffness) || 0.1, rt = Q.x - s.x, kt = Q.y - s.y;
|
|
5394
|
+
s.x += rt * q * t * 60, s.y += kt * q * t * 60;
|
|
5392
5395
|
}
|
|
5393
5396
|
}
|
|
5394
5397
|
} else if (n.type === N.Wrap)
|
|
@@ -5417,30 +5420,30 @@ class ci {
|
|
|
5417
5420
|
const U = (($e = n.settings) == null ? void 0 : $e.watchProperties) || ["x", "y", "scale_x", "scale_y", "opacity", "rotation"], Q = ((Gt = n.settings) == null ? void 0 : Gt.duration) || 0.3;
|
|
5418
5421
|
this._layoutAnimCache.has(e.id) || this._layoutAnimCache.set(e.id, /* @__PURE__ */ new Map());
|
|
5419
5422
|
const q = this._layoutAnimCache.get(e.id);
|
|
5420
|
-
for (const
|
|
5421
|
-
const kt = this.getObjectProperty(s, e,
|
|
5423
|
+
for (const rt of U) {
|
|
5424
|
+
const kt = this.getObjectProperty(s, e, rt);
|
|
5422
5425
|
if (kt === void 0) continue;
|
|
5423
|
-
const _t = q.get(
|
|
5426
|
+
const _t = q.get(rt);
|
|
5424
5427
|
if (!_t)
|
|
5425
|
-
q.set(
|
|
5428
|
+
q.set(rt, {
|
|
5426
5429
|
from: kt,
|
|
5427
5430
|
to: kt,
|
|
5428
5431
|
startTime: this.currentTime,
|
|
5429
5432
|
duration: 0
|
|
5430
5433
|
});
|
|
5431
5434
|
else if (_t.to !== kt) {
|
|
5432
|
-
const Zt = this.getObjectProperty(s, e,
|
|
5433
|
-
q.set(
|
|
5435
|
+
const Zt = this.getObjectProperty(s, e, rt);
|
|
5436
|
+
q.set(rt, {
|
|
5434
5437
|
from: Zt ?? _t.from,
|
|
5435
5438
|
to: kt,
|
|
5436
5439
|
startTime: this.currentTime,
|
|
5437
5440
|
duration: ((ie = n.settings) == null ? void 0 : ie.duration) ?? Q
|
|
5438
5441
|
});
|
|
5439
5442
|
}
|
|
5440
|
-
const $t = q.get(
|
|
5443
|
+
const $t = q.get(rt);
|
|
5441
5444
|
if ($t.duration > 0 && $t.from !== $t.to) {
|
|
5442
5445
|
const Zt = this.currentTime - $t.startTime, fe = Math.min(1, Zt / $t.duration), Ie = this.applyEasing(fe, ((be = n.settings) == null ? void 0 : be.easing) || "easeOutCubic"), ne = $t.from + ($t.to - $t.from) * Ie;
|
|
5443
|
-
this.setObjectProperty(s, e,
|
|
5446
|
+
this.setObjectProperty(s, e, rt, ne);
|
|
5444
5447
|
}
|
|
5445
5448
|
}
|
|
5446
5449
|
} else if (n.type === N.StateReactive) {
|
|
@@ -5460,30 +5463,30 @@ class ci {
|
|
|
5460
5463
|
"style.shadow.offsetX",
|
|
5461
5464
|
"style.shadow.offsetY"
|
|
5462
5465
|
];
|
|
5463
|
-
for (const
|
|
5464
|
-
const kt = this.getObjectProperty(s, e,
|
|
5466
|
+
for (const rt of q) {
|
|
5467
|
+
const kt = this.getObjectProperty(s, e, rt);
|
|
5465
5468
|
if (kt === void 0 || typeof kt != "number") continue;
|
|
5466
|
-
const _t = U.get(
|
|
5469
|
+
const _t = U.get(rt);
|
|
5467
5470
|
if (!_t)
|
|
5468
|
-
U.set(
|
|
5471
|
+
U.set(rt, {
|
|
5469
5472
|
from: kt,
|
|
5470
5473
|
to: kt,
|
|
5471
5474
|
startTime: this.currentTime,
|
|
5472
5475
|
duration: 0
|
|
5473
5476
|
});
|
|
5474
5477
|
else if (_t.to !== kt) {
|
|
5475
|
-
const Zt = this.getObjectProperty(s, e,
|
|
5476
|
-
U.set(
|
|
5478
|
+
const Zt = this.getObjectProperty(s, e, rt);
|
|
5479
|
+
U.set(rt, {
|
|
5477
5480
|
from: Zt ?? _t.from,
|
|
5478
5481
|
to: kt,
|
|
5479
5482
|
startTime: this.currentTime,
|
|
5480
5483
|
duration: Q
|
|
5481
5484
|
});
|
|
5482
5485
|
}
|
|
5483
|
-
const $t = U.get(
|
|
5486
|
+
const $t = U.get(rt);
|
|
5484
5487
|
if ($t.duration > 0 && $t.from !== $t.to) {
|
|
5485
5488
|
const Zt = this.currentTime - $t.startTime, fe = Math.min(1, Zt / $t.duration), Ie = this.applyEasing(fe, ((Fe = n.settings) == null ? void 0 : Fe.defaultEasing) || "easeOutCubic"), ne = $t.from + ($t.to - $t.from) * Ie;
|
|
5486
|
-
this.setObjectProperty(s, e,
|
|
5489
|
+
this.setObjectProperty(s, e, rt, ne);
|
|
5487
5490
|
}
|
|
5488
5491
|
}
|
|
5489
5492
|
} else if (n.type === N.SpringChain) {
|
|
@@ -5502,21 +5505,21 @@ class ci {
|
|
|
5502
5505
|
}
|
|
5503
5506
|
q.has(e.id) || q.set(e.id, { x: s.x, y: s.y, vx: 0, vy: 0 });
|
|
5504
5507
|
}
|
|
5505
|
-
const
|
|
5506
|
-
if (
|
|
5507
|
-
|
|
5508
|
+
const rt = q.get(e.id);
|
|
5509
|
+
if (rt) {
|
|
5510
|
+
rt.x = s.x, rt.y = s.y;
|
|
5508
5511
|
for (const kt of U) {
|
|
5509
5512
|
const _t = q.get(kt.targetId);
|
|
5510
5513
|
if (!_t) continue;
|
|
5511
|
-
const $t = _t.x -
|
|
5512
|
-
|
|
5514
|
+
const $t = _t.x - rt.x, Zt = _t.y - rt.y, fe = Math.sqrt($t * $t + Zt * Zt) || 1e-3, ne = (fe - (kt.restLength || 50)) * (kt.stiffness || 0.8), ge = $t / fe * ne, Ne = Zt / fe * ne;
|
|
5515
|
+
rt.vx += ge * t * 10, rt.vy += Ne * t * 10, _t.vx -= ge * t * 10, _t.vy -= Ne * t * 10, rt.vx *= 1 - Q * t * 10, rt.vy *= 1 - Q * t * 10, _t.vx *= 1 - Q * t * 10, _t.vy *= 1 - Q * t * 10;
|
|
5513
5516
|
const de = this.objectStates.get(kt.targetId);
|
|
5514
5517
|
de && (de.x += _t.vx * t, de.y += _t.vy * t);
|
|
5515
5518
|
}
|
|
5516
|
-
s.x +=
|
|
5519
|
+
s.x += rt.vx * t, s.y += rt.vy * t;
|
|
5517
5520
|
}
|
|
5518
5521
|
} else if (n.type === N.ParticleEmitter) {
|
|
5519
|
-
const U = ((le = n.settings) == null ? void 0 : le.rate) || 10, Q = ((we = n.settings) == null ? void 0 : we.speed) || 100, q = ((We = n.settings) == null ? void 0 : We.size) || 5,
|
|
5522
|
+
const U = ((le = n.settings) == null ? void 0 : le.rate) || 10, Q = ((we = n.settings) == null ? void 0 : we.speed) || 100, q = ((We = n.settings) == null ? void 0 : We.size) || 5, rt = ((Ge = n.settings) == null ? void 0 : Ge.lifetime) || 2, kt = ((De = n.settings) == null ? void 0 : De.gravity) || 0, _t = ((Be = n.settings) == null ? void 0 : Be.color) || "#ffffff", $t = ((ze = n.settings) == null ? void 0 : ze.maxParticles) || 200, Zt = (Ve = n.settings) != null && Ve.rateInputId ? this.inputs.get(n.settings.rateInputId) ?? U : U, fe = (Ze = n.settings) != null && Ze.gravityInputId ? this.inputs.get(n.settings.gravityInputId) ?? kt : kt, Ie = (je = n.settings) != null && je.speedInputId ? this.inputs.get(n.settings.speedInputId) ?? Q : Q;
|
|
5520
5523
|
this._emitterPools.has(e.id) || this._emitterPools.set(e.id, []);
|
|
5521
5524
|
const ne = this._emitterPools.get(e.id);
|
|
5522
5525
|
let ge = 0;
|
|
@@ -5530,7 +5533,7 @@ class ci {
|
|
|
5530
5533
|
vx: Math.cos(oe) * ts,
|
|
5531
5534
|
vy: Math.sin(oe) * ts,
|
|
5532
5535
|
life: 0,
|
|
5533
|
-
maxLife:
|
|
5536
|
+
maxLife: rt * (0.5 + Math.random() * 0.5),
|
|
5534
5537
|
size: q * (0.5 + Math.random()),
|
|
5535
5538
|
color: _t,
|
|
5536
5539
|
opacity: 1
|
|
@@ -5767,11 +5770,11 @@ const yi = Ss(({
|
|
|
5767
5770
|
if (!V) return;
|
|
5768
5771
|
const it = V.getContext("2d");
|
|
5769
5772
|
if (!it) return;
|
|
5770
|
-
const
|
|
5771
|
-
W.current === 0 && (W.current =
|
|
5772
|
-
let nt =
|
|
5773
|
-
nt > 0.1 && (nt = 0.1), W.current =
|
|
5774
|
-
const
|
|
5773
|
+
const lt = L / 1e3;
|
|
5774
|
+
W.current === 0 && (W.current = lt);
|
|
5775
|
+
let nt = lt - W.current;
|
|
5776
|
+
nt > 0.1 && (nt = 0.1), W.current = lt;
|
|
5777
|
+
const bt = V.getBoundingClientRect(), ht = window.devicePixelRatio || 1, wt = Math.round(bt.width * ht), Mt = Math.round(bt.height * ht);
|
|
5775
5778
|
(V.width !== wt || V.height !== Mt) && (V.width = wt, V.height = Mt);
|
|
5776
5779
|
try {
|
|
5777
5780
|
o ? X.advance(nt) : b !== void 0 && X.seek(b), X.render(it, V.width, V.height);
|
|
@@ -5790,8 +5793,8 @@ const yi = Ss(({
|
|
|
5790
5793
|
const A = (_, L) => {
|
|
5791
5794
|
if (!T || !E.current) return;
|
|
5792
5795
|
_.stopPropagation(), "nativeEvent" in _ && _.nativeEvent && typeof _.nativeEvent.stopImmediatePropagation == "function" ? _.nativeEvent.stopImmediatePropagation() : typeof _.stopImmediatePropagation == "function" && _.stopImmediatePropagation();
|
|
5793
|
-
const X = E.current, V = X.getBoundingClientRect(), it = _.clientX - V.left,
|
|
5794
|
-
(L === "click" || L === "down" || L === "up") && d && d(`[Canvas] Pointer ${L} at rect(${Math.round(it)},${Math.round(
|
|
5796
|
+
const X = E.current, V = X.getBoundingClientRect(), it = _.clientX - V.left, lt = _.clientY - V.top, nt = window.devicePixelRatio || 1;
|
|
5797
|
+
(L === "click" || L === "down" || L === "up") && d && d(`[Canvas] Pointer ${L} at rect(${Math.round(it)},${Math.round(lt)}) mapped to buffer(${Math.round(it * nt)},${Math.round(lt * nt)})`, "info"), x.current.handlePointerInput(L, it * nt, lt * nt, X.width, X.height);
|
|
5795
5798
|
};
|
|
5796
5799
|
return /* @__PURE__ */ ke(
|
|
5797
5800
|
"canvas",
|
|
@@ -5927,7 +5930,7 @@ const vi = ({ artboard: g, config: t }) => {
|
|
|
5927
5930
|
]
|
|
5928
5931
|
}
|
|
5929
5932
|
);
|
|
5930
|
-
}, hi = "6.3.
|
|
5933
|
+
}, hi = "6.3.30", fi = {
|
|
5931
5934
|
version: hi
|
|
5932
5935
|
}, Si = fi.version;
|
|
5933
5936
|
export {
|