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