@fraczled/sdk 1.30.58 → 1.30.60
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/{canvasExportPipeline-BhATF00t.js → canvasExportPipeline-DtOvC8zy.js} +256 -255
- package/dist/fraczled-sdk.es.js +1 -1
- package/dist/fraczled-sdk.umd.js +243 -224
- package/dist/{index-CshG7pKg.js → index-1ZLOWYyw.js} +13755 -13351
- package/dist/{index.es-I7K82h__.js → index.es-Ch9N7Z6f.js} +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { g as q, b as V, a as B, t as
|
|
2
|
-
const
|
|
1
|
+
import { g as q, b as V, a as B, t as R, c as Z, d as I, e as Q, f as K, h as m, i as J, j as x, k as at, l as it, m as lt, s as ct, n as ft, E as H, o as ht, p as tt, q as ot, r as st, u as dt } from "./index-1ZLOWYyw.js";
|
|
2
|
+
const ut = {
|
|
3
3
|
normal: "source-over",
|
|
4
4
|
dissolve: "source-over",
|
|
5
5
|
darken: "darken",
|
|
@@ -27,56 +27,56 @@ const dt = {
|
|
|
27
27
|
saturation: "saturation",
|
|
28
28
|
color: "color",
|
|
29
29
|
luminosity: "luminosity"
|
|
30
|
-
},
|
|
30
|
+
}, gt = (t) => t && ut[t] || "source-over", pt = (t = "behind") => {
|
|
31
31
|
const o = ["adjustments"];
|
|
32
32
|
return t === "behind" && o.push("stroke-behind"), o.push("effect", "fill"), t === "front" && o.push("stroke-front"), o;
|
|
33
|
-
},
|
|
34
|
-
const
|
|
33
|
+
}, yt = (t, o) => !o || o === "none" ? t : o === "uppercase" ? t.toUpperCase() : o === "lowercase" ? t.toLowerCase() : o === "capitalize" ? t.replace(/\b\w/g, (s) => s.toUpperCase()) : t, X = (t, o, s) => o ? t.measureText(o).width + (o.length > 1 ? s * (o.length - 1) : 0) : 0, wt = (t, o, s, r) => {
|
|
34
|
+
const a = [], n = o.split(`
|
|
35
35
|
`);
|
|
36
|
-
return
|
|
36
|
+
return n.forEach((i, l) => {
|
|
37
37
|
if (s === void 0 || s <= 0) {
|
|
38
|
-
|
|
38
|
+
a.push({ text: i, width: X(t, i, r) }), l < n.length - 1 && i === "" && a.push({ text: "", width: 0 });
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
|
-
const e =
|
|
41
|
+
const e = i.split(/(\s+)/).filter((h) => h.length > 0);
|
|
42
42
|
let c = "";
|
|
43
43
|
e.forEach((h) => {
|
|
44
44
|
const d = c + h;
|
|
45
|
-
if (!c && (X(t, h,
|
|
45
|
+
if (!c && (X(t, h, r) <= s || h.trim() === "")) {
|
|
46
46
|
c = h;
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
|
-
if (X(t, d,
|
|
49
|
+
if (X(t, d, r) <= s) {
|
|
50
50
|
c = d;
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
|
-
if (c &&
|
|
53
|
+
if (c && a.push({ text: c, width: X(t, c, r) }), X(t, h, r) <= s) {
|
|
54
54
|
c = h;
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
57
|
let f = "";
|
|
58
58
|
for (const g of h) {
|
|
59
59
|
const b = f + g;
|
|
60
|
-
if (!f || X(t, b,
|
|
60
|
+
if (!f || X(t, b, r) <= s) {
|
|
61
61
|
f = b;
|
|
62
62
|
continue;
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
a.push({ text: f, width: X(t, f, r) }), f = g;
|
|
65
65
|
}
|
|
66
66
|
c = f;
|
|
67
|
-
}), c &&
|
|
68
|
-
}),
|
|
69
|
-
},
|
|
70
|
-
const
|
|
71
|
-
|
|
67
|
+
}), c && a.push({ text: c, width: X(t, c, r) }), l < n.length - 1 && i === "" && a.push({ text: "", width: 0 });
|
|
68
|
+
}), a;
|
|
69
|
+
}, bt = (t, o, s) => {
|
|
70
|
+
const r = o.fontSize || 24, a = at(
|
|
71
|
+
r,
|
|
72
72
|
o.fontFamily || "sans-serif",
|
|
73
73
|
o.fontWeight || "normal",
|
|
74
74
|
o.fontStyle || "normal"
|
|
75
|
-
),
|
|
76
|
-
t.save(), t.font =
|
|
77
|
-
const h =
|
|
75
|
+
), n = (o.lineHeight ?? 1.4) * r, i = (o.letterSpacing ?? 0) * r, l = o.textAlign || "left", e = o.autoWidth ? void 0 : s, c = yt(o.content || "", o.textTransform);
|
|
76
|
+
t.save(), t.font = a;
|
|
77
|
+
const h = wt(t, c, e, i), d = it({
|
|
78
78
|
ctx: t,
|
|
79
|
-
fontSize:
|
|
79
|
+
fontSize: r,
|
|
80
80
|
fontFamily: o.fontFamily || "sans-serif",
|
|
81
81
|
fontWeight: o.fontWeight || "normal",
|
|
82
82
|
fontStyle: o.fontStyle || "normal",
|
|
@@ -85,39 +85,39 @@ const dt = {
|
|
|
85
85
|
});
|
|
86
86
|
return t.restore(), {
|
|
87
87
|
lines: h,
|
|
88
|
-
lineHeight:
|
|
89
|
-
letterSpacing:
|
|
88
|
+
lineHeight: n,
|
|
89
|
+
letterSpacing: i,
|
|
90
90
|
width: s,
|
|
91
91
|
align: l,
|
|
92
|
-
font:
|
|
92
|
+
font: a,
|
|
93
93
|
offsetY: d.baselineOffset
|
|
94
94
|
};
|
|
95
|
-
}, _ = (t, o, s,
|
|
95
|
+
}, _ = (t, o, s, r, a, n) => {
|
|
96
96
|
if (!o) return;
|
|
97
|
-
if (
|
|
98
|
-
|
|
97
|
+
if (a === 0) {
|
|
98
|
+
n === "fill" ? t.fillText(o, s, r) : t.strokeText(o, s, r);
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
101
|
-
let
|
|
101
|
+
let i = s;
|
|
102
102
|
for (const l of o)
|
|
103
|
-
|
|
103
|
+
n === "fill" ? t.fillText(l, i, r) : t.strokeText(l, i, r), i += t.measureText(l).width + a;
|
|
104
104
|
}, C = (t, o, s) => {
|
|
105
|
-
const { lines:
|
|
106
|
-
t.save(), t.font = e, t.textBaseline = "alphabetic", t.textAlign = "left", s.fillStyle && (t.fillStyle = s.fillStyle), s.strokeStyle && s.strokeWidth && (t.strokeStyle = s.strokeStyle, t.lineWidth = s.strokeWidth, t.lineJoin = s.lineJoin ?? "round", t.lineCap = s.lineCap ?? "round"),
|
|
107
|
-
const u = p *
|
|
105
|
+
const { lines: r, lineHeight: a, letterSpacing: n, width: i, align: l, font: e } = o, c = s.offsetX ?? 0, h = (o.offsetY ?? 0) + (s.offsetY ?? 0);
|
|
106
|
+
t.save(), t.font = e, t.textBaseline = "alphabetic", t.textAlign = "left", s.fillStyle && (t.fillStyle = s.fillStyle), s.strokeStyle && s.strokeWidth && (t.strokeStyle = s.strokeStyle, t.lineWidth = s.strokeWidth, t.lineJoin = s.lineJoin ?? "round", t.lineCap = s.lineCap ?? "round"), r.forEach((d, p) => {
|
|
107
|
+
const u = p * a + h, f = d.width;
|
|
108
108
|
let g = c;
|
|
109
|
-
l === "center" ? g =
|
|
109
|
+
l === "center" ? g = i / 2 - f / 2 + c : l === "right" && (g = i - f + c), s.strokeStyle && s.strokeWidth && _(t, d.text, g, u, n, "stroke"), s.fillStyle && _(t, d.text, g, u, n, "fill");
|
|
110
110
|
}), t.restore();
|
|
111
|
-
},
|
|
112
|
-
const
|
|
113
|
-
return u.addColorStop(0,
|
|
114
|
-
},
|
|
115
|
-
const { lines:
|
|
116
|
-
|
|
111
|
+
}, kt = (t, o, s, r, a, n) => {
|
|
112
|
+
const i = (r - 90) * Math.PI / 180, l = Math.cos(i), e = Math.sin(i), c = o / 2 - l * (o / 2), h = s / 2 - e * (s / 2), d = o / 2 + l * (o / 2), p = s / 2 + e * (s / 2), u = t.createLinearGradient(c, h, d, p);
|
|
113
|
+
return u.addColorStop(0, a), u.addColorStop(1, n), u;
|
|
114
|
+
}, St = (t, o, s) => {
|
|
115
|
+
const { lines: r, lineHeight: a, width: n, align: i } = o, l = s.spread, e = Math.max(0, s.roundness);
|
|
116
|
+
r.forEach((c, h) => {
|
|
117
117
|
const d = c.width;
|
|
118
118
|
let p = 0;
|
|
119
|
-
|
|
120
|
-
const u = h *
|
|
119
|
+
i === "center" ? p = n / 2 - d / 2 : i === "right" && (p = n - d);
|
|
120
|
+
const u = h * a, f = p - l, g = u, b = d + l * 2, v = a;
|
|
121
121
|
if (t.save(), t.fillStyle = s.fillStyle, t.beginPath(), e <= 0)
|
|
122
122
|
t.rect(f, g, b, v);
|
|
123
123
|
else {
|
|
@@ -126,45 +126,45 @@ const dt = {
|
|
|
126
126
|
}
|
|
127
127
|
t.fill(), t.restore();
|
|
128
128
|
});
|
|
129
|
-
}, j = (t, o, s,
|
|
129
|
+
}, j = (t, o, s, r, a, n) => {
|
|
130
130
|
var T;
|
|
131
|
-
const
|
|
132
|
-
if (
|
|
133
|
-
const l = o.color || "#000000", e = q(
|
|
134
|
-
p <= 0 || C(t,
|
|
131
|
+
const i = bt(t, o, s);
|
|
132
|
+
if (i.lines.length === 0) return;
|
|
133
|
+
const l = o.color || "#000000", e = q(n, l), c = V((T = o.effect) == null ? void 0 : T.adjustments), h = n.blurAmount ?? 5, d = a === "blur" ? `${c} blur(${h}px)` : c, p = o.textStrokeWidth ?? 0, u = o.textStrokeColor || "#000000", f = o.textStrokePosition || "behind", g = o.textStrokeStyle || "round", b = g === "round" ? "round" : "miter", v = g === "round" ? "round" : "butt", w = () => {
|
|
134
|
+
p <= 0 || C(t, i, {
|
|
135
135
|
strokeStyle: u,
|
|
136
136
|
strokeWidth: p,
|
|
137
137
|
lineJoin: b,
|
|
138
138
|
lineCap: v
|
|
139
139
|
});
|
|
140
|
-
},
|
|
141
|
-
t.save(), t.filter = d,
|
|
140
|
+
}, P = pt(f === "front" ? "front" : "behind");
|
|
141
|
+
t.save(), t.filter = d, P.forEach((D) => {
|
|
142
142
|
switch (D) {
|
|
143
143
|
case "stroke-behind":
|
|
144
144
|
w();
|
|
145
145
|
break;
|
|
146
146
|
case "effect": {
|
|
147
|
-
switch (
|
|
147
|
+
switch (a) {
|
|
148
148
|
case "shadow": {
|
|
149
|
-
const { offsetX: y, offsetY: S } =
|
|
150
|
-
t.save(), t.shadowColor = k, t.shadowBlur =
|
|
149
|
+
const { offsetX: y, offsetY: S } = I(n), M = n.blur ?? 0, Y = B(n), k = R(e, Y);
|
|
150
|
+
t.save(), t.shadowColor = k, t.shadowBlur = M, t.shadowOffsetX = y, t.shadowOffsetY = S, C(t, i, { fillStyle: l }), t.restore();
|
|
151
151
|
break;
|
|
152
152
|
}
|
|
153
153
|
case "lift": {
|
|
154
|
-
const y = x(
|
|
155
|
-
t.save(), t.shadowColor = S, t.shadowBlur = 20 * y, t.shadowOffsetX = 0, t.shadowOffsetY = 10 * y, C(t,
|
|
154
|
+
const y = x(n), S = `rgba(0,0,0, ${0.5 * y})`;
|
|
155
|
+
t.save(), t.shadowColor = S, t.shadowBlur = 20 * y, t.shadowOffsetX = 0, t.shadowOffsetY = 10 * y, C(t, i, { fillStyle: l }), t.restore();
|
|
156
156
|
break;
|
|
157
157
|
}
|
|
158
158
|
case "neon": {
|
|
159
|
-
const y = J(
|
|
160
|
-
t.save(), [y * 5, y * 3, y].forEach((
|
|
161
|
-
t.shadowColor = e, t.shadowBlur =
|
|
162
|
-
}), C(t,
|
|
159
|
+
const y = J(n), S = n.textColor || "#ffffff";
|
|
160
|
+
t.save(), [y * 5, y * 3, y].forEach((M) => {
|
|
161
|
+
t.shadowColor = e, t.shadowBlur = M, t.shadowOffsetX = 0, t.shadowOffsetY = 0, C(t, i, { fillStyle: S });
|
|
162
|
+
}), C(t, i, { fillStyle: S }), t.restore();
|
|
163
163
|
break;
|
|
164
164
|
}
|
|
165
165
|
case "outline": {
|
|
166
|
-
const y = m(
|
|
167
|
-
C(t,
|
|
166
|
+
const y = m(n);
|
|
167
|
+
C(t, i, {
|
|
168
168
|
strokeStyle: e,
|
|
169
169
|
strokeWidth: y,
|
|
170
170
|
lineJoin: "round",
|
|
@@ -174,8 +174,8 @@ const dt = {
|
|
|
174
174
|
break;
|
|
175
175
|
}
|
|
176
176
|
case "hollow": {
|
|
177
|
-
const y = K(
|
|
178
|
-
C(t,
|
|
177
|
+
const y = K(n);
|
|
178
|
+
C(t, i, {
|
|
179
179
|
strokeStyle: e,
|
|
180
180
|
strokeWidth: y,
|
|
181
181
|
lineJoin: "round",
|
|
@@ -184,13 +184,13 @@ const dt = {
|
|
|
184
184
|
break;
|
|
185
185
|
}
|
|
186
186
|
case "splice": {
|
|
187
|
-
const y = Q(
|
|
188
|
-
t.save(), t.shadowColor = "rgba(0,0,0,0.2)", t.shadowBlur = 0, t.shadowOffsetX = S, t.shadowOffsetY =
|
|
187
|
+
const y = Q(n), { offsetX: S, offsetY: M } = I(n);
|
|
188
|
+
t.save(), t.shadowColor = "rgba(0,0,0,0.2)", t.shadowBlur = 0, t.shadowOffsetX = S, t.shadowOffsetY = M, C(t, i, {
|
|
189
189
|
strokeStyle: e,
|
|
190
190
|
strokeWidth: y,
|
|
191
191
|
lineJoin: "round",
|
|
192
192
|
lineCap: "round"
|
|
193
|
-
}), t.restore(), C(t,
|
|
193
|
+
}), t.restore(), C(t, i, {
|
|
194
194
|
strokeStyle: e,
|
|
195
195
|
strokeWidth: y,
|
|
196
196
|
lineJoin: "round",
|
|
@@ -199,54 +199,54 @@ const dt = {
|
|
|
199
199
|
break;
|
|
200
200
|
}
|
|
201
201
|
case "echo": {
|
|
202
|
-
const { offsetX: y, offsetY: S } =
|
|
203
|
-
C(t,
|
|
204
|
-
fillStyle:
|
|
202
|
+
const { offsetX: y, offsetY: S } = I(n);
|
|
203
|
+
C(t, i, { fillStyle: R(e, 0.5), offsetX: y, offsetY: S }), C(t, i, {
|
|
204
|
+
fillStyle: R(e, 0.3),
|
|
205
205
|
offsetX: y * 2,
|
|
206
206
|
offsetY: S * 2
|
|
207
|
-
}), C(t,
|
|
207
|
+
}), C(t, i, { fillStyle: l });
|
|
208
208
|
break;
|
|
209
209
|
}
|
|
210
210
|
case "glitch": {
|
|
211
|
-
const y = Z(
|
|
212
|
-
C(t,
|
|
211
|
+
const y = Z(n);
|
|
212
|
+
C(t, i, { fillStyle: "#0ea5e9", offsetX: -y, offsetY: 0 }), C(t, i, { fillStyle: "#f43f5e", offsetX: y, offsetY: 0 }), C(t, i, { fillStyle: l });
|
|
213
213
|
break;
|
|
214
214
|
}
|
|
215
215
|
case "blur": {
|
|
216
|
-
C(t,
|
|
216
|
+
C(t, i, { fillStyle: l });
|
|
217
217
|
break;
|
|
218
218
|
}
|
|
219
219
|
case "duotone": {
|
|
220
|
-
const y =
|
|
221
|
-
C(t,
|
|
220
|
+
const y = n.duotoneLight || "#f472b6", S = n.duotoneDark || "#1e40af";
|
|
221
|
+
C(t, i, { fillStyle: y, offsetX: 1, offsetY: 1 }), C(t, i, { fillStyle: y, offsetX: -1, offsetY: -1 }), C(t, i, { fillStyle: S });
|
|
222
222
|
break;
|
|
223
223
|
}
|
|
224
224
|
case "reflection": {
|
|
225
|
-
const y = (
|
|
226
|
-
t.save(), t.shadowColor =
|
|
225
|
+
const y = (n.reflectionOpacity ?? 50) / 100, S = n.reflectionDistance ?? 5, M = `rgba(0,0,0, ${y * 0.3})`;
|
|
226
|
+
t.save(), t.shadowColor = M, t.shadowBlur = S, t.shadowOffsetX = 0, t.shadowOffsetY = S + 10, C(t, i, { fillStyle: l }), t.restore();
|
|
227
227
|
break;
|
|
228
228
|
}
|
|
229
229
|
case "background": {
|
|
230
|
-
const y = B(
|
|
231
|
-
|
|
232
|
-
fillStyle:
|
|
230
|
+
const y = B(n), S = (n.spread ?? 50) / 5, M = (n.roundness ?? 0) / 2;
|
|
231
|
+
St(t, i, {
|
|
232
|
+
fillStyle: R(e, y),
|
|
233
233
|
spread: S,
|
|
234
|
-
roundness:
|
|
234
|
+
roundness: M
|
|
235
235
|
});
|
|
236
236
|
break;
|
|
237
237
|
}
|
|
238
238
|
case "gradient_overlay": {
|
|
239
|
-
const y =
|
|
240
|
-
C(t,
|
|
239
|
+
const y = n.gradientColor1 || "#667eea", S = n.gradientColor2 || "#764ba2", M = n.gradientAngle || 135, Y = kt(t, s, r, M, y, S);
|
|
240
|
+
C(t, i, { fillStyle: Y });
|
|
241
241
|
break;
|
|
242
242
|
}
|
|
243
243
|
default:
|
|
244
|
-
C(t,
|
|
244
|
+
C(t, i, { fillStyle: l });
|
|
245
245
|
}
|
|
246
246
|
break;
|
|
247
247
|
}
|
|
248
248
|
case "fill":
|
|
249
|
-
|
|
249
|
+
a === "background" && C(t, i, { fillStyle: l });
|
|
250
250
|
break;
|
|
251
251
|
case "stroke-front":
|
|
252
252
|
w();
|
|
@@ -262,106 +262,106 @@ const dt = {
|
|
|
262
262
|
arrow: "0,35 60,35 60,15 100,50 60,85 60,65 0,65",
|
|
263
263
|
heart: "50,20 55,15 65,10 80,10 95,25 95,45 50,90 5,45 5,25 20,10 35,10 45,15"
|
|
264
264
|
}, L = (t, o, s) => {
|
|
265
|
-
const
|
|
266
|
-
|
|
267
|
-
const
|
|
268
|
-
if (!
|
|
265
|
+
const r = document.createElement("canvas");
|
|
266
|
+
r.width = Math.max(1, Math.ceil(t * s)), r.height = Math.max(1, Math.ceil(o * s));
|
|
267
|
+
const a = r.getContext("2d");
|
|
268
|
+
if (!a)
|
|
269
269
|
throw new Error("Failed to get canvas context");
|
|
270
|
-
return
|
|
270
|
+
return a.setTransform(1, 0, 0, 1, 0, 0), a.scale(s, s), { canvas: r, ctx: a };
|
|
271
271
|
}, z = (t) => {
|
|
272
272
|
if (!t)
|
|
273
273
|
return { x: 0, y: 0, width: 0, height: 0 };
|
|
274
274
|
const o = t.split(/[\s,]+/).map((s) => Number.parseFloat(s)).filter((s) => !Number.isNaN(s));
|
|
275
275
|
return o.length >= 4 ? { x: o[0], y: o[1], width: o[2], height: o[3] } : { x: 0, y: 0, width: 0, height: 0 };
|
|
276
|
-
},
|
|
276
|
+
}, Ct = (t) => {
|
|
277
277
|
try {
|
|
278
|
-
let o = "linear", s = 90,
|
|
278
|
+
let o = "linear", s = 90, r = "";
|
|
279
279
|
if (t.includes("radial-gradient")) {
|
|
280
280
|
o = "radial";
|
|
281
|
-
const
|
|
282
|
-
if (!
|
|
283
|
-
const l =
|
|
284
|
-
l[0].includes("circle") || l[0].includes("ellipse") || l[0].includes("at ") ?
|
|
281
|
+
const n = t.match(/radial-gradient\((.*)\)/);
|
|
282
|
+
if (!n) return null;
|
|
283
|
+
const l = n[1].split(/,(?![^()]*\))/).map((e) => e.trim());
|
|
284
|
+
l[0].includes("circle") || l[0].includes("ellipse") || l[0].includes("at ") ? r = l.slice(1).join(",") : r = l.join(",");
|
|
285
285
|
} else {
|
|
286
|
-
const
|
|
287
|
-
if (!
|
|
288
|
-
const l =
|
|
289
|
-
l[0].includes("deg") ? (s = parseInt(l[0], 10),
|
|
286
|
+
const n = t.match(/linear-gradient\((.*)\)/);
|
|
287
|
+
if (!n) return null;
|
|
288
|
+
const l = n[1].split(/,(?![^()]*\))/).map((e) => e.trim());
|
|
289
|
+
l[0].includes("deg") ? (s = parseInt(l[0], 10), r = l.slice(1).join(",")) : l[0].includes("to ") ? (l[0] === "to right" ? s = 90 : l[0] === "to bottom" ? s = 180 : l[0] === "to left" ? s = 270 : l[0] === "to top" ? s = 0 : s = 180, r = l.slice(1).join(",")) : (s = 180, r = l.join(","));
|
|
290
290
|
}
|
|
291
|
-
const
|
|
292
|
-
const
|
|
293
|
-
return
|
|
294
|
-
}).filter((
|
|
295
|
-
return
|
|
291
|
+
const a = r.split(/,(?![^()]*\))/).map((n) => n.trim()).map((n) => {
|
|
292
|
+
const i = n.match(/(.+)\s+(\d+)%$/);
|
|
293
|
+
return i ? { color: i[1], offset: i[2] + "%" } : { color: n, offset: "" };
|
|
294
|
+
}).filter((n) => n.color);
|
|
295
|
+
return a.length === 2 && (a[0].offset || (a[0].offset = "0%"), a[1].offset || (a[1].offset = "100%")), { type: o, angle: s, stops: a };
|
|
296
296
|
} catch {
|
|
297
297
|
return null;
|
|
298
298
|
}
|
|
299
|
-
},
|
|
300
|
-
const
|
|
299
|
+
}, et = (t, o, s, r) => {
|
|
300
|
+
const a = (r - 90) * Math.PI / 180, n = Math.cos(a), i = Math.sin(a), l = o / 2 - n * (o / 2), e = s / 2 - i * (s / 2), c = o / 2 + n * (o / 2), h = s / 2 + i * (s / 2);
|
|
301
301
|
return t.createLinearGradient(l, e, c, h);
|
|
302
|
-
},
|
|
303
|
-
const
|
|
302
|
+
}, vt = (t, o, s) => {
|
|
303
|
+
const r = Math.min(o, s) / 2;
|
|
304
304
|
if (typeof t == "number") {
|
|
305
|
-
const c = Math.max(0, Math.min(t,
|
|
305
|
+
const c = Math.max(0, Math.min(t, r));
|
|
306
306
|
return { tl: c, tr: c, br: c, bl: c };
|
|
307
307
|
}
|
|
308
|
-
const
|
|
309
|
-
return { tl:
|
|
310
|
-
}, N = (t, o, s,
|
|
311
|
-
const { tl:
|
|
312
|
-
if (
|
|
313
|
-
t.rect(o, s,
|
|
308
|
+
const a = t, n = Math.max(0, Math.min((a == null ? void 0 : a.tl) ?? 0, r)), i = Math.max(0, Math.min((a == null ? void 0 : a.tr) ?? 0, r)), l = Math.max(0, Math.min((a == null ? void 0 : a.br) ?? 0, r)), e = Math.max(0, Math.min((a == null ? void 0 : a.bl) ?? 0, r));
|
|
309
|
+
return { tl: n, tr: i, br: l, bl: e };
|
|
310
|
+
}, N = (t, o, s, r, a, n) => {
|
|
311
|
+
const { tl: i, tr: l, br: e, bl: c } = vt(n, r, a);
|
|
312
|
+
if (i === 0 && l === 0 && e === 0 && c === 0) {
|
|
313
|
+
t.rect(o, s, r, a);
|
|
314
314
|
return;
|
|
315
315
|
}
|
|
316
|
-
t.moveTo(o +
|
|
317
|
-
},
|
|
318
|
-
const
|
|
316
|
+
t.moveTo(o + i, s), t.lineTo(o + r - l, s), t.arcTo(o + r, s, o + r, s + l, l), t.lineTo(o + r, s + a - e), t.arcTo(o + r, s + a, o + r - e, s + a, e), t.lineTo(o + c, s + a), t.arcTo(o, s + a, o, s + a - c, c), t.lineTo(o, s + i), t.arcTo(o, s, o + i, s, i), t.closePath();
|
|
317
|
+
}, rt = (t, o, s, r) => {
|
|
318
|
+
const a = t.split(" ").map((e) => {
|
|
319
319
|
const [c, h] = e.split(",").map(Number);
|
|
320
|
-
return { x: c / 100 * s, y: h / 100 *
|
|
321
|
-
}),
|
|
322
|
-
if (
|
|
323
|
-
return `M ${
|
|
324
|
-
const
|
|
320
|
+
return { x: c / 100 * s, y: h / 100 * r };
|
|
321
|
+
}), n = typeof o == "number";
|
|
322
|
+
if (n && o <= 0)
|
|
323
|
+
return `M ${a.map((e) => `${e.x},${e.y}`).join(" L ")} Z`;
|
|
324
|
+
const i = a.length;
|
|
325
325
|
let l = "";
|
|
326
|
-
for (let e = 0; e <
|
|
327
|
-
const c =
|
|
326
|
+
for (let e = 0; e < i; e++) {
|
|
327
|
+
const c = a[(e - 1 + i) % i], h = a[e], d = a[(e + 1) % i], p = { x: c.x - h.x, y: c.y - h.y }, u = { x: d.x - h.x, y: d.y - h.y }, f = Math.sqrt(p.x * p.x + p.y * p.y), g = Math.sqrt(u.x * u.x + u.y * u.y), b = Math.min(f, g) / 2;
|
|
328
328
|
let v = 0;
|
|
329
|
-
|
|
329
|
+
n ? v = o : v = o[`p${e}`] ?? 0;
|
|
330
330
|
const w = Math.min(v, b);
|
|
331
331
|
if (w <= 0) {
|
|
332
332
|
e === 0 ? l += `M ${h.x},${h.y} ` : l += `L ${h.x},${h.y} `;
|
|
333
333
|
continue;
|
|
334
334
|
}
|
|
335
|
-
const
|
|
336
|
-
e === 0 ? l += `M ${
|
|
335
|
+
const P = { x: h.x + p.x / f * w, y: h.y + p.y / f * w }, T = { x: h.x + u.x / g * w, y: h.y + u.y / g * w };
|
|
336
|
+
e === 0 ? l += `M ${P.x},${P.y} ` : l += `L ${P.x},${P.y} `, l += `Q ${h.x},${h.y} ${T.x},${T.y} `;
|
|
337
337
|
}
|
|
338
338
|
return l += "Z", l;
|
|
339
|
-
},
|
|
339
|
+
}, Mt = (t) => {
|
|
340
340
|
const o = t.clip;
|
|
341
341
|
if (!o) return null;
|
|
342
|
-
const s = Math.max(0, o.left ?? 0),
|
|
343
|
-
if (!(
|
|
344
|
-
const l = t.width - s -
|
|
342
|
+
const s = Math.max(0, o.left ?? 0), r = Math.max(0, o.top ?? 0), a = Math.max(0, o.right ?? 0), n = Math.max(0, o.bottom ?? 0);
|
|
343
|
+
if (!(r > 0 || a > 0 || n > 0 || s > 0)) return null;
|
|
344
|
+
const l = t.width - s - a, e = t.height - r - n;
|
|
345
345
|
return l <= 0 || e <= 0 ? null : {
|
|
346
346
|
left: s,
|
|
347
|
-
top:
|
|
347
|
+
top: r,
|
|
348
348
|
width: l,
|
|
349
349
|
height: e,
|
|
350
350
|
originX: s + l / 2,
|
|
351
|
-
originY:
|
|
351
|
+
originY: r + e / 2
|
|
352
352
|
};
|
|
353
|
-
},
|
|
354
|
-
var
|
|
355
|
-
const o = (
|
|
353
|
+
}, Pt = (t) => {
|
|
354
|
+
var a, n, i, l;
|
|
355
|
+
const o = (n = (a = t.effect) == null ? void 0 : a.style) == null ? void 0 : n.type, s = ((l = (i = t.effect) == null ? void 0 : i.style) == null ? void 0 : l.params) || {};
|
|
356
356
|
if (!o || o === "none") return 0;
|
|
357
|
-
const
|
|
357
|
+
const r = (e, c) => e ?? c;
|
|
358
358
|
switch (o) {
|
|
359
359
|
case "shadow": {
|
|
360
|
-
const e =
|
|
360
|
+
const e = r(s.blur, 10), c = r(s.offset, 50) / 5;
|
|
361
361
|
return e + c + 10;
|
|
362
362
|
}
|
|
363
363
|
case "lift": {
|
|
364
|
-
const e =
|
|
364
|
+
const e = r(s.intensity, 50) / 50, c = 20 * e, h = 10 * e;
|
|
365
365
|
return c + h + 10;
|
|
366
366
|
}
|
|
367
367
|
case "neon":
|
|
@@ -371,153 +371,154 @@ const dt = {
|
|
|
371
371
|
case "hollow":
|
|
372
372
|
return K(s) * 2 + 2;
|
|
373
373
|
case "splice": {
|
|
374
|
-
const e = Q(s), { offsetX: c, offsetY: h } =
|
|
374
|
+
const e = Q(s), { offsetX: c, offsetY: h } = I(s);
|
|
375
375
|
return Math.max(Math.abs(c), Math.abs(h)) + e * 2 + 4;
|
|
376
376
|
}
|
|
377
377
|
case "echo": {
|
|
378
|
-
const { offsetX: e, offsetY: c } =
|
|
378
|
+
const { offsetX: e, offsetY: c } = I(s);
|
|
379
379
|
return Math.max(Math.abs(e), Math.abs(c)) * 2 + 4;
|
|
380
380
|
}
|
|
381
381
|
case "glitch":
|
|
382
382
|
return Math.abs(Z(s)) + 4;
|
|
383
383
|
case "blur":
|
|
384
|
-
return
|
|
384
|
+
return r(s.blurAmount, 5) * 2 + 4;
|
|
385
385
|
case "duotone":
|
|
386
386
|
case "gradient_overlay":
|
|
387
387
|
case "background":
|
|
388
388
|
return 2;
|
|
389
389
|
case "reflection": {
|
|
390
|
-
const e =
|
|
390
|
+
const e = r(s.reflectionDistance, 5), c = e, h = e + 10;
|
|
391
391
|
return Math.abs(h) + c + 6;
|
|
392
392
|
}
|
|
393
393
|
default:
|
|
394
394
|
return 0;
|
|
395
395
|
}
|
|
396
|
-
},
|
|
396
|
+
}, nt = (t) => {
|
|
397
397
|
const o = [], s = /d=\"([^\"]+)\"/g;
|
|
398
|
-
let
|
|
399
|
-
for (; (
|
|
400
|
-
o.push(
|
|
398
|
+
let r = null;
|
|
399
|
+
for (; (r = s.exec(t)) !== null; )
|
|
400
|
+
o.push(r[1]);
|
|
401
401
|
return o;
|
|
402
|
-
},
|
|
402
|
+
}, Tt = (t, o, s) => {
|
|
403
403
|
if (t.type === "shape") {
|
|
404
|
-
const
|
|
405
|
-
if (
|
|
406
|
-
const
|
|
407
|
-
if (
|
|
408
|
-
const { x:
|
|
409
|
-
return
|
|
410
|
-
const f = new Path2D(u), g = new DOMMatrix().translate(-
|
|
404
|
+
const r = t.content, a = tt(r);
|
|
405
|
+
if (a && typeof DOMMatrix < "u") {
|
|
406
|
+
const n = nt(a.markup);
|
|
407
|
+
if (n.length > 0) {
|
|
408
|
+
const { x: i, y: l, width: e, height: c } = z(a.viewBox), h = e > 0 ? o / e : 1, d = c > 0 ? s / c : 1, p = new Path2D();
|
|
409
|
+
return n.forEach((u) => {
|
|
410
|
+
const f = new Path2D(u), g = new DOMMatrix().translate(-i, -l).scale(h, d);
|
|
411
411
|
p.addPath(f, g);
|
|
412
412
|
}), p;
|
|
413
413
|
}
|
|
414
414
|
}
|
|
415
|
-
if (
|
|
416
|
-
const
|
|
417
|
-
return N(
|
|
415
|
+
if (r === "rect") {
|
|
416
|
+
const n = new Path2D(), i = t.cornerRadius || 0;
|
|
417
|
+
return N(n, 0, 0, o, s, i), n;
|
|
418
418
|
}
|
|
419
|
-
if (
|
|
420
|
-
const
|
|
421
|
-
return
|
|
419
|
+
if (r === "circle") {
|
|
420
|
+
const n = new Path2D();
|
|
421
|
+
return n.ellipse(o / 2, s / 2, o / 2, s / 2, 0, 0, Math.PI * 2), n;
|
|
422
422
|
}
|
|
423
|
-
if (
|
|
424
|
-
const
|
|
425
|
-
return
|
|
423
|
+
if (r === "line") {
|
|
424
|
+
const n = new Path2D();
|
|
425
|
+
return n.moveTo(0, s / 2), n.lineTo(o, s / 2), n;
|
|
426
426
|
}
|
|
427
|
-
if (E[
|
|
428
|
-
const
|
|
429
|
-
return new Path2D(
|
|
427
|
+
if (E[r]) {
|
|
428
|
+
const n = t.cornerRadius || 0, i = rt(E[r], n, o, s);
|
|
429
|
+
return new Path2D(i);
|
|
430
430
|
}
|
|
431
431
|
}
|
|
432
432
|
return null;
|
|
433
433
|
}, $ = (t, o, s) => {
|
|
434
434
|
if (t.type === "image" && t.clipShape) {
|
|
435
|
-
const
|
|
436
|
-
if (
|
|
437
|
-
const
|
|
438
|
-
if (
|
|
439
|
-
const { x:
|
|
440
|
-
return
|
|
441
|
-
const u = new Path2D(p), f = new DOMMatrix().translate(-
|
|
435
|
+
const r = tt(t.clipShape);
|
|
436
|
+
if (r) {
|
|
437
|
+
const a = nt(r.markup);
|
|
438
|
+
if (a.length > 0 && typeof DOMMatrix < "u") {
|
|
439
|
+
const { x: n, y: i, width: l, height: e } = z(r.viewBox), c = l > 0 ? o / l : 1, h = e > 0 ? s / e : 1, d = new Path2D();
|
|
440
|
+
return a.forEach((p) => {
|
|
441
|
+
const u = new Path2D(p), f = new DOMMatrix().translate(-n, -i).scale(c, h);
|
|
442
442
|
d.addPath(u, f);
|
|
443
443
|
}), d;
|
|
444
444
|
}
|
|
445
445
|
}
|
|
446
446
|
if (t.clipShape === "circle") {
|
|
447
|
-
const
|
|
448
|
-
return
|
|
447
|
+
const a = new Path2D();
|
|
448
|
+
return a.ellipse(o / 2, s / 2, o / 2, s / 2, 0, 0, Math.PI * 2), a;
|
|
449
449
|
}
|
|
450
450
|
if (t.clipShape === "path" && t.path) {
|
|
451
|
-
const
|
|
452
|
-
return new Path2D(
|
|
451
|
+
const a = ot(t.path);
|
|
452
|
+
return new Path2D(a);
|
|
453
453
|
}
|
|
454
454
|
if (E[t.clipShape]) {
|
|
455
|
-
const
|
|
456
|
-
return new Path2D(
|
|
455
|
+
const a = t.cornerRadius || 0, n = rt(E[t.clipShape], a, o, s);
|
|
456
|
+
return new Path2D(n);
|
|
457
457
|
}
|
|
458
458
|
}
|
|
459
459
|
return null;
|
|
460
|
-
},
|
|
461
|
-
const
|
|
462
|
-
if (
|
|
463
|
-
if (
|
|
464
|
-
const c = t.createRadialGradient(s / 2,
|
|
465
|
-
|
|
466
|
-
const p =
|
|
460
|
+
}, Wt = (t, o, s, r) => {
|
|
461
|
+
const a = o.backgroundColor || "transparent", n = a.includes("gradient") ? Ct(a) : null;
|
|
462
|
+
if (n)
|
|
463
|
+
if (n.type === "radial") {
|
|
464
|
+
const c = t.createRadialGradient(s / 2, r / 2, 0, s / 2, r / 2, Math.max(s, r) / 2);
|
|
465
|
+
n.stops.forEach((h, d) => {
|
|
466
|
+
const p = n.stops.length > 1 ? d / (n.stops.length - 1) : 0, u = h.offset ? Number.parseFloat(h.offset) / 100 : p;
|
|
467
467
|
c.addColorStop(Number.isFinite(u) ? u : p, h.color);
|
|
468
468
|
}), t.fillStyle = c;
|
|
469
469
|
} else {
|
|
470
|
-
const c =
|
|
471
|
-
|
|
472
|
-
const p =
|
|
470
|
+
const c = et(t, s, r, n.angle);
|
|
471
|
+
n.stops.forEach((h, d) => {
|
|
472
|
+
const p = n.stops.length > 1 ? d / (n.stops.length - 1) : 0, u = h.offset ? Number.parseFloat(h.offset) / 100 : p;
|
|
473
473
|
c.addColorStop(Number.isFinite(u) ? u : p, h.color);
|
|
474
474
|
}), t.fillStyle = c;
|
|
475
475
|
}
|
|
476
476
|
else
|
|
477
|
-
t.fillStyle =
|
|
478
|
-
const
|
|
479
|
-
|
|
477
|
+
t.fillStyle = a;
|
|
478
|
+
const i = Tt(o, s, r);
|
|
479
|
+
i ? t.fill(i) : t.fillRect(0, 0, s, r);
|
|
480
480
|
const l = o.content === "line" ? Math.max(2, o.strokeWidth || 4) : o.strokeWidth || 0, e = o.strokeColor || "transparent";
|
|
481
|
-
l > 0 && e !== "transparent" && (t.save(), t.strokeStyle = e, t.lineWidth = l, t.lineJoin = "round", t.lineCap = o.strokeStyle === "round" ? "round" : "butt", o.strokeStyle === "dashed" ? t.setLineDash([6, 4]) : o.strokeStyle === "dotted" ? t.setLineDash([2, 2]) : t.setLineDash([]),
|
|
482
|
-
},
|
|
481
|
+
l > 0 && e !== "transparent" && (t.save(), t.strokeStyle = e, t.lineWidth = l, t.lineJoin = "round", t.lineCap = o.strokeStyle === "round" ? "round" : "butt", o.strokeStyle === "dashed" ? t.setLineDash([6, 4]) : o.strokeStyle === "dotted" ? t.setLineDash([2, 2]) : t.setLineDash([]), i ? t.stroke(i) : t.strokeRect(0, 0, s, r), t.restore());
|
|
482
|
+
}, Ot = (t, o, s) => {
|
|
483
483
|
if (o === "none") return t;
|
|
484
|
-
const
|
|
485
|
-
return
|
|
486
|
-
},
|
|
487
|
-
const
|
|
488
|
-
|
|
489
|
-
}),
|
|
484
|
+
const r = t.width / s, a = t.height / s, { canvas: n, ctx: i } = L(r, a, s);
|
|
485
|
+
return i.filter = o, i.drawImage(t, 0, 0, r, a), n;
|
|
486
|
+
}, Dt = (t) => new Promise((o, s) => {
|
|
487
|
+
const r = new Image();
|
|
488
|
+
r.decoding = "async", r.crossOrigin = "anonymous", r.onload = () => o(r), r.onerror = (a) => s(a), r.src = st(t);
|
|
489
|
+
}), Yt = async (t, o, s, r, a) => {
|
|
490
490
|
if (o.isIcon && o.iconPaths && o.iconPaths.length > 0) {
|
|
491
|
-
const { x:
|
|
492
|
-
o.iconViewBox || `0 0 ${s} ${
|
|
493
|
-
),
|
|
494
|
-
t.save(), t.fillStyle = o.color || "#000000", t.translate(-
|
|
495
|
-
const
|
|
496
|
-
t.fill(
|
|
491
|
+
const { x: T, y: D, width: y, height: S } = z(
|
|
492
|
+
o.iconViewBox || `0 0 ${s} ${r}`
|
|
493
|
+
), M = y > 0 ? s / y : 1, Y = S > 0 ? r / S : 1;
|
|
494
|
+
t.save(), t.fillStyle = o.color || "#000000", t.translate(-T * M, -D * Y), t.scale(M, Y), o.iconPaths.forEach((k) => {
|
|
495
|
+
const O = new Path2D(k);
|
|
496
|
+
t.fill(O);
|
|
497
497
|
}), t.restore();
|
|
498
498
|
return;
|
|
499
499
|
}
|
|
500
|
-
const
|
|
501
|
-
if (!
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
500
|
+
const n = o.content;
|
|
501
|
+
if (!n) return;
|
|
502
|
+
const i = st(n);
|
|
503
|
+
let l = a.get(i);
|
|
504
|
+
l || (l = await Dt(i), a.set(i, l));
|
|
505
|
+
const e = l.naturalWidth || l.width || s, c = l.naturalHeight || l.height || r, h = dt(o.crop, s, r, e, c), d = h.width * e, p = h.height * c, u = s / d, f = r / p, g = e * u, b = c * f, v = -(h.x * e) * u, w = -(h.y * c) * f, P = (o.imageRotation ?? 0) * (Math.PI / 180);
|
|
506
|
+
if (o.backgroundColor && o.backgroundColor !== "transparent" && (t.save(), t.fillStyle = o.backgroundColor, t.fillRect(0, 0, s, r), t.restore()), t.save(), P) {
|
|
507
|
+
const T = v + g / 2, D = w + b / 2;
|
|
508
|
+
t.translate(T, D), t.rotate(P), t.translate(-T, -D);
|
|
508
509
|
}
|
|
509
|
-
t.drawImage(
|
|
510
|
-
},
|
|
510
|
+
t.drawImage(l, v, w, g, b), t.restore();
|
|
511
|
+
}, Xt = (t, o) => {
|
|
511
512
|
if (!o.path) return;
|
|
512
513
|
const s = ot(o.path);
|
|
513
514
|
if (!s) return;
|
|
514
|
-
const
|
|
515
|
-
|
|
516
|
-
},
|
|
517
|
-
var D, y, S,
|
|
518
|
-
const
|
|
519
|
-
e.save(), e.translate(
|
|
520
|
-
const c =
|
|
515
|
+
const r = new Path2D(s), a = o.backgroundColor ?? o.path.fillColor ?? "transparent", n = o.strokeColor ?? o.path.strokeColor ?? "transparent", i = o.strokeWidth ?? o.path.strokeWidth ?? 0;
|
|
516
|
+
a && a !== "transparent" && (t.save(), t.fillStyle = a, t.fill(r), t.restore()), i > 0 && n && n !== "transparent" && (t.save(), t.strokeStyle = n, t.lineWidth = i, t.lineCap = o.path.lineCap, t.lineJoin = o.path.lineJoin, o.strokeStyle === "dashed" ? t.setLineDash([6, 4]) : o.strokeStyle === "dotted" ? t.setLineDash([2, 2]) : t.setLineDash([]), t.stroke(r), t.restore());
|
|
517
|
+
}, It = async (t, o, s) => {
|
|
518
|
+
var D, y, S, M, Y;
|
|
519
|
+
const r = Pt(t), a = typeof r == "number" ? r : 0, n = t.width + a * 2, i = t.height + a * 2, { canvas: l, ctx: e } = L(n, i, o);
|
|
520
|
+
e.save(), e.translate(a, a);
|
|
521
|
+
const c = Mt(t), h = ((y = (D = t.effect) == null ? void 0 : D.style) == null ? void 0 : y.type) ?? "none", d = ((M = (S = t.effect) == null ? void 0 : S.style) == null ? void 0 : M.params) ?? {}, p = V((Y = t.effect) == null ? void 0 : Y.adjustments), { canvas: u, ctx: f } = L(t.width, t.height, o);
|
|
521
522
|
if (t.type === "text")
|
|
522
523
|
c ? (f.save(), f.beginPath(), f.rect(c.left, c.top, c.width, c.height), f.clip(), j(f, t, t.width, t.height, h, d), f.restore()) : j(f, t, t.width, t.height, h, d);
|
|
523
524
|
else {
|
|
@@ -527,7 +528,7 @@ const dt = {
|
|
|
527
528
|
const k = $(t, t.width, t.height);
|
|
528
529
|
k ? (f.beginPath(), f.addPath(k), f.clip()) : t.type === "image" && t.cornerRadius && (f.beginPath(), N(f, 0, 0, t.width, t.height, t.cornerRadius), f.clip());
|
|
529
530
|
}
|
|
530
|
-
if (t.type === "shape" ?
|
|
531
|
+
if (t.type === "shape" ? Wt(f, t, t.width, t.height) : t.type === "image" ? await Yt(f, t, t.width, t.height, s) : t.type === "path" ? Xt(f, t) : (f.fillStyle = t.backgroundColor || "transparent", f.fillRect(0, 0, t.width, t.height)), f.restore(), t.type === "image" && (t.strokeWidth || 0) > 0) {
|
|
531
532
|
const k = $(t, t.width, t.height);
|
|
532
533
|
f.save(), f.strokeStyle = t.strokeColor || "#000000", f.lineWidth = t.strokeWidth || 0, f.lineJoin = "round", f.lineCap = t.strokeStyle === "round" ? "round" : "butt", t.strokeStyle === "dashed" ? f.setLineDash([6, 4]) : t.strokeStyle === "dotted" ? f.setLineDash([2, 2]) : f.setLineDash([]), k ? f.stroke(k) : t.cornerRadius ? (f.beginPath(), N(f, 0, 0, t.width, t.height, t.cornerRadius), f.stroke()) : f.strokeRect(0, 0, t.width, t.height), f.restore();
|
|
533
534
|
}
|
|
@@ -540,26 +541,26 @@ const dt = {
|
|
|
540
541
|
}
|
|
541
542
|
h === "duotone" && b.push("grayscale(100%)");
|
|
542
543
|
}
|
|
543
|
-
const v = b.join(" ").trim() || "none", w = !g && h === "blur",
|
|
544
|
+
const v = b.join(" ").trim() || "none", w = !g && h === "blur", P = g || w ? u : Ot(u, v, o);
|
|
544
545
|
if (!g && (h === "shadow" || h === "lift" || h === "neon")) {
|
|
545
546
|
if (e.save(), e.filter = "none", h === "shadow") {
|
|
546
|
-
const { offsetX: k, offsetY: O } =
|
|
547
|
-
e.shadowColor =
|
|
547
|
+
const { offsetX: k, offsetY: O } = I(d), W = d.blur ?? 0, A = B(d);
|
|
548
|
+
e.shadowColor = R(q(d, "#000000"), A), e.shadowBlur = W, e.shadowOffsetX = k, e.shadowOffsetY = O, e.drawImage(P, 0, 0, t.width, t.height);
|
|
548
549
|
} else if (h === "lift") {
|
|
549
550
|
const k = x(d);
|
|
550
|
-
e.shadowColor = `rgba(0,0,0, ${0.5 * k})`, e.shadowBlur = 20 * k, e.shadowOffsetX = 0, e.shadowOffsetY = 10 * k, e.drawImage(
|
|
551
|
+
e.shadowColor = `rgba(0,0,0, ${0.5 * k})`, e.shadowBlur = 20 * k, e.shadowOffsetX = 0, e.shadowOffsetY = 10 * k, e.drawImage(P, 0, 0, t.width, t.height);
|
|
551
552
|
} else if (h === "neon") {
|
|
552
553
|
const k = J(d), O = d.color || "#00ff00";
|
|
553
554
|
[k * 5, k * 3, k].forEach((W) => {
|
|
554
|
-
e.shadowColor = O, e.shadowBlur = W, e.shadowOffsetX = 0, e.shadowOffsetY = 0, e.drawImage(
|
|
555
|
+
e.shadowColor = O, e.shadowBlur = W, e.shadowOffsetX = 0, e.shadowOffsetY = 0, e.drawImage(P, 0, 0, t.width, t.height);
|
|
555
556
|
});
|
|
556
557
|
}
|
|
557
558
|
e.restore();
|
|
558
559
|
}
|
|
559
560
|
if (!g && h === "reflection") {
|
|
560
561
|
const k = (d.reflectionOpacity ?? 50) / 100, O = d.reflectionDistance ?? 5, W = 0.35;
|
|
561
|
-
e.save(), e.drawImage(
|
|
562
|
-
|
|
562
|
+
e.save(), e.drawImage(P, 0, 0, t.width, t.height), e.translate(0, t.height + O), e.scale(1, -1), e.globalAlpha = k, e.drawImage(
|
|
563
|
+
P,
|
|
563
564
|
0,
|
|
564
565
|
t.height - t.height * W,
|
|
565
566
|
t.width,
|
|
@@ -570,11 +571,11 @@ const dt = {
|
|
|
570
571
|
t.height * W
|
|
571
572
|
), e.restore();
|
|
572
573
|
} else
|
|
573
|
-
w ? (e.save(), e.filter = v, e.drawImage(u, 0, 0, t.width, t.height), e.restore()) : e.drawImage(
|
|
574
|
+
w ? (e.save(), e.filter = v, e.drawImage(u, 0, 0, t.width, t.height), e.restore()) : e.drawImage(P, 0, 0, t.width, t.height);
|
|
574
575
|
if (!g && h === "gradient_overlay") {
|
|
575
576
|
const k = d.gradientColor1 || "#667eea", O = d.gradientColor2 || "#764ba2", W = d.gradientAngle || 135, A = (d.transparency ?? 80) / 100;
|
|
576
577
|
e.save(), e.globalAlpha = A, e.filter = p || "none", e.globalCompositeOperation = "overlay";
|
|
577
|
-
const F =
|
|
578
|
+
const F = et(e, t.width, t.height, W);
|
|
578
579
|
F.addColorStop(0, k), F.addColorStop(1, O), e.fillStyle = F;
|
|
579
580
|
const G = $(t, t.width, t.height);
|
|
580
581
|
G ? (e.save(), e.beginPath(), e.addPath(G), e.clip(), e.fillRect(0, 0, t.width, t.height), e.restore()) : e.fillRect(0, 0, t.width, t.height), e.restore();
|
|
@@ -587,47 +588,47 @@ const dt = {
|
|
|
587
588
|
const T = c ? { x: c.originX, y: c.originY } : { x: t.width / 2, y: t.height / 2 };
|
|
588
589
|
return {
|
|
589
590
|
canvas: l,
|
|
590
|
-
padding:
|
|
591
|
+
padding: a,
|
|
591
592
|
origin: T,
|
|
592
|
-
width:
|
|
593
|
-
height:
|
|
593
|
+
width: n,
|
|
594
|
+
height: i
|
|
594
595
|
};
|
|
595
596
|
}, U = async (t, o) => {
|
|
596
|
-
const { page: s, settings:
|
|
597
|
-
|
|
597
|
+
const { page: s, settings: r, bleed: a, backgroundColor: n, pixelRatio: i } = o, l = o.width, e = o.height, c = a, h = a;
|
|
598
|
+
n !== "transparent" && (t.save(), t.fillStyle = n || r.backgroundColor || "#ffffff", t.fillRect(0, 0, l, e), t.restore());
|
|
598
599
|
const d = [...s.elements].filter((u) => u.visible !== !1).sort((u, f) => u.zIndex - f.zIndex), p = /* @__PURE__ */ new Map();
|
|
599
600
|
for (const u of d) {
|
|
600
|
-
const { canvas: f, padding: g, origin: b, width: v, height: w } = await
|
|
601
|
+
const { canvas: f, padding: g, origin: b, width: v, height: w } = await It(
|
|
601
602
|
u,
|
|
602
|
-
|
|
603
|
+
i,
|
|
603
604
|
p
|
|
604
605
|
);
|
|
605
|
-
t.save(), t.globalCompositeOperation =
|
|
606
|
+
t.save(), t.globalCompositeOperation = gt(u.blendMode), t.globalAlpha = u.opacity ?? 1, t.translate(c + u.x, h + u.y), t.translate(b.x, b.y), t.rotate((u.rotation ?? 0) * Math.PI / 180), t.scale(u.flipX ? -1 : 1, u.flipY ? -1 : 1), t.translate(-b.x, -b.y), t.drawImage(f, -g, -g, v, w), t.restore();
|
|
606
607
|
}
|
|
607
|
-
},
|
|
608
|
-
await
|
|
608
|
+
}, Lt = async (t) => {
|
|
609
|
+
await lt(document);
|
|
609
610
|
const o = t.width, s = t.height;
|
|
610
|
-
if (!
|
|
611
|
+
if (!ct(
|
|
611
612
|
o,
|
|
612
613
|
s,
|
|
613
614
|
t.pixelRatio,
|
|
614
615
|
8192,
|
|
615
616
|
67108864
|
|
616
617
|
)) {
|
|
617
|
-
const { canvas:
|
|
618
|
-
return await U(l, t),
|
|
618
|
+
const { canvas: i, ctx: l } = L(o, s, t.pixelRatio);
|
|
619
|
+
return await U(l, t), i;
|
|
619
620
|
}
|
|
620
|
-
const
|
|
621
|
+
const a = ft(o, s, {
|
|
621
622
|
tileWidth: H.tileSize,
|
|
622
623
|
tileHeight: H.tileSize,
|
|
623
624
|
overlap: H.tileOverlap
|
|
624
|
-
}),
|
|
625
|
-
for (const
|
|
626
|
-
const { canvas: l, ctx: e } = L(
|
|
627
|
-
e.translate(-
|
|
625
|
+
}), n = [];
|
|
626
|
+
for (const i of a.tiles) {
|
|
627
|
+
const { canvas: l, ctx: e } = L(i.width, i.height, t.pixelRatio);
|
|
628
|
+
e.translate(-i.x, -i.y), await U(e, t), n.push({ rect: i, canvas: l });
|
|
628
629
|
}
|
|
629
|
-
return
|
|
630
|
+
return ht(n, o, s, t.pixelRatio);
|
|
630
631
|
};
|
|
631
632
|
export {
|
|
632
|
-
|
|
633
|
+
Lt as capturePageCanvas
|
|
633
634
|
};
|