@snowcone-app/canvas 0.40.11 → 0.40.12
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/{CanvasRenderer-b7W2QOJp.js → CanvasRenderer-COHWEK1r.js} +2 -2
- package/dist/{CanvasRenderer-b7W2QOJp.js.map → CanvasRenderer-COHWEK1r.js.map} +1 -1
- package/dist/{CanvasStateV1-zt4kyHFb.js → CanvasStateV1-DwziqxMO.js} +2 -2
- package/dist/{CanvasStateV1-zt4kyHFb.js.map → CanvasStateV1-DwziqxMO.js.map} +1 -1
- package/dist/{ContextualToolbars-Dx3Qyjkt.js → ContextualToolbars-D-EX9Q9L.js} +4 -4
- package/dist/{ContextualToolbars-Dx3Qyjkt.js.map → ContextualToolbars-D-EX9Q9L.js.map} +1 -1
- package/dist/{EditorCanvasImpl-Ddvyg6Mr.js → EditorCanvasImpl-CP6ipFq_.js} +6 -6
- package/dist/{EditorCanvasImpl-Ddvyg6Mr.js.map → EditorCanvasImpl-CP6ipFq_.js.map} +1 -1
- package/dist/{ExportManager-BQ9BPs1U.js → ExportManager-DLOH2Kzk.js} +68 -67
- package/dist/{ExportManager-BQ9BPs1U.js.map → ExportManager-DLOH2Kzk.js.map} +1 -1
- package/dist/{ImagePanel-CwuttJnt.js → ImagePanel-BIzwlaf5.js} +3 -3
- package/dist/{ImagePanel-CwuttJnt.js.map → ImagePanel-BIzwlaf5.js.map} +1 -1
- package/dist/{SnowconeCanvas-Dlec811f.js → SnowconeCanvas-991f9eds.js} +8 -8
- package/dist/{SnowconeCanvas-Dlec811f.js.map → SnowconeCanvas-991f9eds.js.map} +1 -1
- package/dist/advanced.mjs +9 -9
- package/dist/api/internals.d.ts +1 -1
- package/dist/{custom-icons-C1SbDFU3.js → custom-icons-DHew1GPV.js} +2 -2
- package/dist/{custom-icons-C1SbDFU3.js.map → custom-icons-DHew1GPV.js.map} +1 -1
- package/dist/{embed-CZcJqmA1.js → embed-CcKoxfdW.js} +7 -7
- package/dist/{embed-CZcJqmA1.js.map → embed-CcKoxfdW.js.map} +1 -1
- package/dist/embed.mjs +10 -10
- package/dist/index.mjs +12 -12
- package/dist/internals.mjs +117 -116
- package/dist/internals.mjs.map +1 -1
- package/dist/{template-fields-CCNA9LqM.js → template-fields-BzAlpOEB.js} +3 -3
- package/dist/{template-fields-CCNA9LqM.js.map → template-fields-BzAlpOEB.js.map} +1 -1
- package/dist/{useCommands-Bo1KbIND.js → useCommands-CLnk8kvW.js} +5 -5
- package/dist/{useCommands-Bo1KbIND.js.map → useCommands-CLnk8kvW.js.map} +1 -1
- package/dist/{validation-BRp5aW3B.js → validation-Q1_OcfJ_.js} +9 -9
- package/dist/{validation-BRp5aW3B.js.map → validation-Q1_OcfJ_.js.map} +1 -1
- package/example/package.json +1 -1
- package/package.json +1 -1
package/dist/embed.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { C as a, g as t, h as o, K as r, N as i, O as n, P as d, Q as m, R as u, b as l, a as E, j as c, k as p, l as g } from "./useCommands-
|
|
2
|
-
import { E as C, R as S, a as T, b as f, S as P, c as R, d as b, e as B, f as
|
|
1
|
+
import { C as a, g as t, h as o, K as r, N as i, O as n, P as d, Q as m, R as u, b as l, a as E, j as c, k as p, l as g } from "./useCommands-CLnk8kvW.js";
|
|
2
|
+
import { E as C, R as S, a as T, b as f, S as P, c as R, d as b, e as B, f as v, g as y, i as F, h, p as k, s as D, j as I, k as K, l as L, v as w } from "./embed-CcKoxfdW.js";
|
|
3
3
|
import { t as M, V as j } from "./FontAnalyzer-DWHS41ba.js";
|
|
4
4
|
import { D as N, e as V, h as _, i as z, b as H } from "./design-builder-CoCtjIwj.js";
|
|
5
|
-
import { D as O, T as Q, r as Y, u as q, a as U, b as W, c as X, d as Z, e as $, w as ee } from "./template-fields-
|
|
6
|
-
import {
|
|
7
|
-
import { s as ne } from "./CanvasStateV1-
|
|
5
|
+
import { D as O, T as Q, r as Y, u as q, a as U, b as W, c as X, d as Z, e as $, w as ee } from "./template-fields-BzAlpOEB.js";
|
|
6
|
+
import { G as ae, H as te, J as oe, K as re } from "./ExportManager-DLOH2Kzk.js";
|
|
7
|
+
import { s as ne } from "./CanvasStateV1-DwziqxMO.js";
|
|
8
8
|
export {
|
|
9
9
|
a as CanvasServicesProvider,
|
|
10
10
|
N as DesignBuilder,
|
|
@@ -19,15 +19,15 @@ export {
|
|
|
19
19
|
R as auditEditor,
|
|
20
20
|
b as bundleToRenderConfig,
|
|
21
21
|
B as bundleVariantToken,
|
|
22
|
-
|
|
22
|
+
v as collectEmbedIssues,
|
|
23
23
|
t as createProxyGenerate,
|
|
24
24
|
o as createProxyImageSearch,
|
|
25
25
|
ae as customFontRegistry,
|
|
26
26
|
V as design,
|
|
27
27
|
r as editorElementKind,
|
|
28
28
|
te as ensureCustomFontsLoaded,
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
y as formatBuyPrice,
|
|
30
|
+
F as isBundleProduct,
|
|
31
31
|
h as isBundleRenderProduct,
|
|
32
32
|
_ as isColorToken,
|
|
33
33
|
j as isEditorError,
|
|
@@ -54,8 +54,8 @@ export {
|
|
|
54
54
|
X as useImageBinding,
|
|
55
55
|
g as useLayers,
|
|
56
56
|
I as usePlacements,
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
K as useProductSelection,
|
|
58
|
+
L as useRealtimeMockups,
|
|
59
59
|
Z as useSelectedElement,
|
|
60
60
|
$ as useTextBinding,
|
|
61
61
|
w as validateEmbed,
|
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { e as u } from "./useCommands-
|
|
2
|
-
import { C as c, f as x, g as I, h as v, b as A, a as g, j as T, k as B, l as
|
|
3
|
-
import { E as
|
|
1
|
+
import { e as u } from "./useCommands-CLnk8kvW.js";
|
|
2
|
+
import { C as c, f as x, g as I, h as v, b as A, a as g, j as T, k as B, l as P } from "./useCommands-CLnk8kvW.js";
|
|
3
|
+
import { E as F, S as L, S as _, u as O, a as R } from "./SnowconeCanvas-991f9eds.js";
|
|
4
4
|
import { b as m, d } from "./design-builder-CoCtjIwj.js";
|
|
5
|
-
import { C as z, D as w, e as
|
|
6
|
-
import { T as V, r as b, u as h, a as G, b as H, c as U, d as Y, e as Z, w as j } from "./template-fields-
|
|
7
|
-
import { A as J, C as q, E as Q, M as W, P as X, r as $, v as ee } from "./validation-
|
|
8
|
-
import {
|
|
5
|
+
import { C as z, D as w, e as K, s as D } from "./design-builder-CoCtjIwj.js";
|
|
6
|
+
import { T as V, r as b, u as h, a as G, b as H, c as U, d as Y, e as Z, w as j } from "./template-fields-BzAlpOEB.js";
|
|
7
|
+
import { A as J, C as q, E as Q, M as W, P as X, r as $, v as ee } from "./validation-Q1_OcfJ_.js";
|
|
8
|
+
import { G as ae, H as te, J as oe, K as re } from "./ExportManager-DLOH2Kzk.js";
|
|
9
9
|
import { c as ie, e as ue } from "./compose-DtQL_oit.js";
|
|
10
|
-
import { d as de, m as Ce, s as Se, v as Ee } from "./CanvasStateV1-
|
|
10
|
+
import { d as de, m as Ce, s as Se, v as Ee } from "./CanvasStateV1-DwziqxMO.js";
|
|
11
11
|
function E() {
|
|
12
12
|
const { isCanvasReady: e } = m();
|
|
13
13
|
return e;
|
|
@@ -24,7 +24,7 @@ export {
|
|
|
24
24
|
c as CanvasServicesProvider,
|
|
25
25
|
w as DesignBuilder,
|
|
26
26
|
Q as EMBED_ONLY,
|
|
27
|
-
|
|
27
|
+
F as ErrorBoundary,
|
|
28
28
|
W as MINIMAL_CAPABILITIES,
|
|
29
29
|
X as PRO_STUDIO,
|
|
30
30
|
L as SnowconeCanvas,
|
|
@@ -36,7 +36,7 @@ export {
|
|
|
36
36
|
ae as customFontRegistry,
|
|
37
37
|
_ as default,
|
|
38
38
|
de as deserializeState,
|
|
39
|
-
|
|
39
|
+
K as design,
|
|
40
40
|
te as ensureCustomFontsLoaded,
|
|
41
41
|
ue as extendKit,
|
|
42
42
|
oe as loadCustomFont,
|
|
@@ -45,7 +45,7 @@ export {
|
|
|
45
45
|
re as registerCustomFonts,
|
|
46
46
|
$ as resolveKit,
|
|
47
47
|
Se as serializeState,
|
|
48
|
-
|
|
48
|
+
D as serializeStateForServer,
|
|
49
49
|
A as useArtboards,
|
|
50
50
|
O as useAutoExport,
|
|
51
51
|
E as useCanvasReady,
|
|
@@ -58,7 +58,7 @@ export {
|
|
|
58
58
|
B as useExport,
|
|
59
59
|
H as useFontBinding,
|
|
60
60
|
U as useImageBinding,
|
|
61
|
-
|
|
61
|
+
P as useLayers,
|
|
62
62
|
Y as useSelectedElement,
|
|
63
63
|
Z as useTextBinding,
|
|
64
64
|
f as useViewport,
|
package/dist/internals.mjs
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { A as rr, a as or, C as sr, I as er, R as
|
|
2
|
-
import { r as k } from "./ExportManager-
|
|
3
|
-
import { D as hr, a as cr, I as dr, W as fr, b as gr, c as lr, d as ur, e as pr, f as yr, g as kr, h as vr, i as wr, j as
|
|
1
|
+
import { A as rr, a as or, C as sr, I as er, R as tr, S as nr, T as ar } from "./CanvasRenderer-COHWEK1r.js";
|
|
2
|
+
import { r as k } from "./ExportManager-DLOH2Kzk.js";
|
|
3
|
+
import { D as hr, a as cr, I as dr, W as fr, b as gr, c as lr, d as ur, e as pr, f as yr, g as kr, h as vr, i as wr, j as Cr, k as Mr, l as Tr, m as Sr, n as br, o as Pr, p as Ir, q as mr, s as Ar, t as Rr, u as Wr, v as Er, w as Or, x as Hr, y as jr, z as Fr, A as Lr, B as Xr, C as zr, F as Nr } from "./ExportManager-DLOH2Kzk.js";
|
|
4
4
|
import { i as H, a as j, c as F, r as L, b as X } from "./FontAnalyzer-DWHS41ba.js";
|
|
5
|
-
import { d as
|
|
6
|
-
import { A as io, a as
|
|
5
|
+
import { d as Br, e as Kr, f as Ur, C as Yr, g as Jr, E as Vr, F as qr, H as Gr, L as Qr, h as Zr, W as $r, j as xr, k as Dr, l as ro, m as oo, n as so, o as eo, s as to, w as no } from "./FontAnalyzer-DWHS41ba.js";
|
|
6
|
+
import { A as io, a as ho, C as co, S as fo } from "./CanvasStateV1-DwziqxMO.js";
|
|
7
7
|
const z = F("image-adjustments"), v = 1e-3;
|
|
8
8
|
function N(r, o) {
|
|
9
|
-
const { brightness:
|
|
9
|
+
const { brightness: a, contrast: s, saturation: h } = o, e = a * s, t = 127.5 * (1 - s), f = Math.abs(e - 1) > v || Math.abs(t) > v, i = new Uint8ClampedArray(256);
|
|
10
10
|
if (f)
|
|
11
|
-
for (let l = 0; l < 256; l++)
|
|
12
|
-
const c = Math.abs(h - 1) > v,
|
|
11
|
+
for (let l = 0; l < 256; l++) i[l] = l * e + t;
|
|
12
|
+
const c = Math.abs(h - 1) > v, n = h, d = 0.213 + 0.787 * n, g = 0.715 - 0.715 * n, S = 0.072 - 0.072 * n, b = 0.213 - 0.213 * n, P = 0.715 + 0.285 * n, I = 0.072 - 0.072 * n, m = 0.213 - 0.213 * n, A = 0.715 - 0.715 * n, R = 0.072 + 0.928 * n;
|
|
13
13
|
for (let l = 0; l < r.length; l += 4) {
|
|
14
14
|
let u = r[l], p = r[l + 1], y = r[l + 2];
|
|
15
|
-
if (f && (u =
|
|
15
|
+
if (f && (u = i[u], p = i[p], y = i[y]), c) {
|
|
16
16
|
const W = d * u + g * p + S * y, E = b * u + P * p + I * y, O = m * u + A * p + R * y;
|
|
17
17
|
u = W, p = E, y = O;
|
|
18
18
|
}
|
|
19
19
|
r[l] = u, r[l + 1] = p, r[l + 2] = y;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
const
|
|
22
|
+
const C = /* @__PURE__ */ new WeakMap(), _ = 4;
|
|
23
23
|
function B(r) {
|
|
24
24
|
const o = r.naturalWidth;
|
|
25
25
|
return typeof o == "number" && o > 0 ? o : r.width;
|
|
@@ -32,42 +32,42 @@ function U(r, o) {
|
|
|
32
32
|
if (typeof OffscreenCanvas < "u")
|
|
33
33
|
return new OffscreenCanvas(r, o);
|
|
34
34
|
if (typeof document < "u") {
|
|
35
|
-
const
|
|
36
|
-
return
|
|
35
|
+
const a = document.createElement("canvas");
|
|
36
|
+
return a.width = r, a.height = o, a;
|
|
37
37
|
}
|
|
38
38
|
throw new Error("image-adjustments: no canvas implementation available (no OffscreenCanvas, no DOM)");
|
|
39
39
|
}
|
|
40
40
|
function Y(r, o) {
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
41
|
+
const a = B(r), s = K(r);
|
|
42
|
+
if (a <= 0 || s <= 0)
|
|
43
43
|
throw new Error("image-adjustments: source has no pixels (width/height is 0)");
|
|
44
|
-
const h = U(
|
|
44
|
+
const h = U(a, s), e = h.getContext("2d");
|
|
45
45
|
if (!e)
|
|
46
46
|
throw new Error("image-adjustments: could not acquire a 2d context");
|
|
47
|
-
e.drawImage(r, 0, 0,
|
|
48
|
-
const
|
|
49
|
-
return N(
|
|
47
|
+
e.drawImage(r, 0, 0, a, s);
|
|
48
|
+
const t = e.getImageData(0, 0, a, s);
|
|
49
|
+
return N(t.data, o), e.putImageData(t, 0, 0), h;
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function T(r, o) {
|
|
52
52
|
if (H(o)) return r;
|
|
53
|
-
const
|
|
54
|
-
let s =
|
|
55
|
-
const h = s == null ? void 0 : s.get(
|
|
53
|
+
const a = j(o);
|
|
54
|
+
let s = C.get(r);
|
|
55
|
+
const h = s == null ? void 0 : s.get(a);
|
|
56
56
|
if (h)
|
|
57
|
-
return s.delete(
|
|
57
|
+
return s.delete(a), s.set(a, h), h;
|
|
58
58
|
let e;
|
|
59
59
|
try {
|
|
60
60
|
e = Y(r, o);
|
|
61
|
-
} catch (
|
|
62
|
-
z.error("adjustment pixel pass failed — rendering UNADJUSTED source:",
|
|
61
|
+
} catch (t) {
|
|
62
|
+
z.error("adjustment pixel pass failed — rendering UNADJUSTED source:", t), e = r;
|
|
63
63
|
}
|
|
64
|
-
for (s || (s = /* @__PURE__ */ new Map(),
|
|
65
|
-
const
|
|
66
|
-
s.delete(
|
|
64
|
+
for (s || (s = /* @__PURE__ */ new Map(), C.set(r, s)), s.set(a, e); s.size > _; ) {
|
|
65
|
+
const t = s.keys().next().value;
|
|
66
|
+
s.delete(t);
|
|
67
67
|
}
|
|
68
68
|
return e;
|
|
69
69
|
}
|
|
70
|
-
L(
|
|
70
|
+
L(T);
|
|
71
71
|
function Q(r, o) {
|
|
72
72
|
return !r.needsCropPixelConversion || r.cropWidth === void 0 ? r : {
|
|
73
73
|
...r,
|
|
@@ -78,36 +78,36 @@ function Q(r, o) {
|
|
|
78
78
|
needsCropPixelConversion: !1
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
|
-
function Z(r, o,
|
|
82
|
-
var
|
|
83
|
-
const s =
|
|
84
|
-
|
|
81
|
+
function Z(r, o, a) {
|
|
82
|
+
var t, f;
|
|
83
|
+
const s = T(
|
|
84
|
+
a,
|
|
85
85
|
o.adjustments
|
|
86
86
|
);
|
|
87
87
|
r.save(), r.translate(o.x, o.y), o.rotation && r.rotate(-o.rotation * Math.PI / 180);
|
|
88
88
|
let h = 1, e = 1;
|
|
89
89
|
if (o.flipHorizontal && (h = -1), o.flipVertical && (e = -1), (h !== 1 || e !== 1) && r.scale(h, e), o.opacity !== void 0 && o.opacity !== 1 && (r.globalAlpha = o.opacity), o.borderRadius && o.borderRadius > 0) {
|
|
90
|
-
const
|
|
90
|
+
const i = Math.min(
|
|
91
91
|
o.borderRadius / 100 * Math.min(o.width, o.height),
|
|
92
92
|
o.width / 2,
|
|
93
93
|
o.height / 2
|
|
94
94
|
);
|
|
95
95
|
r.beginPath();
|
|
96
|
-
const c = -o.width / 2,
|
|
97
|
-
r.moveTo(c +
|
|
96
|
+
const c = -o.width / 2, n = -o.height / 2, d = o.width, g = o.height;
|
|
97
|
+
r.moveTo(c + i, n), r.lineTo(c + d - i, n), r.arcTo(c + d, n, c + d, n + i, i), r.lineTo(c + d, n + g - i), r.arcTo(c + d, n + g, c + d - i, n + g, i), r.lineTo(c + i, n + g), r.arcTo(c, n + g, c, n + g - i, i), r.lineTo(c, n + i), r.arcTo(c, n, c + i, n, i), r.closePath(), r.clip();
|
|
98
98
|
}
|
|
99
99
|
if (o.cropX !== void 0 && o.cropWidth !== void 0 ? r.drawImage(
|
|
100
100
|
s,
|
|
101
101
|
o.cropX,
|
|
102
102
|
o.cropY || 0,
|
|
103
103
|
o.cropWidth,
|
|
104
|
-
o.cropHeight ||
|
|
104
|
+
o.cropHeight || a.height,
|
|
105
105
|
-o.width / 2,
|
|
106
106
|
-o.height / 2,
|
|
107
107
|
o.width,
|
|
108
108
|
o.height
|
|
109
|
-
) : r.drawImage(s, -o.width / 2, -o.height / 2, o.width, o.height), r.restore(), (
|
|
110
|
-
const
|
|
109
|
+
) : r.drawImage(s, -o.width / 2, -o.height / 2, o.width, o.height), r.restore(), (t = o.stroke) != null && t.enabled) {
|
|
110
|
+
const i = ((f = o.knockoutParts) == null ? void 0 : f.stroke) === !0, c = {
|
|
111
111
|
x: o.x,
|
|
112
112
|
y: o.y,
|
|
113
113
|
rotation: o.rotation,
|
|
@@ -120,13 +120,13 @@ function Z(r, o, i) {
|
|
|
120
120
|
borderRadius: o.borderRadius || 0
|
|
121
121
|
}
|
|
122
122
|
};
|
|
123
|
-
if (
|
|
124
|
-
const
|
|
123
|
+
if (i) {
|
|
124
|
+
const n = r.canvas;
|
|
125
125
|
let d;
|
|
126
126
|
if (typeof OffscreenCanvas < "u")
|
|
127
|
-
d = new OffscreenCanvas(
|
|
127
|
+
d = new OffscreenCanvas(n.width, n.height);
|
|
128
128
|
else if (typeof document < "u")
|
|
129
|
-
d = document.createElement("canvas"), d.width =
|
|
129
|
+
d = document.createElement("canvas"), d.width = n.width, d.height = n.height;
|
|
130
130
|
else {
|
|
131
131
|
k(r, c);
|
|
132
132
|
return;
|
|
@@ -144,47 +144,47 @@ function Z(r, o, i) {
|
|
|
144
144
|
function J(r, o) {
|
|
145
145
|
if (typeof OffscreenCanvas < "u")
|
|
146
146
|
return new OffscreenCanvas(r, o);
|
|
147
|
-
const
|
|
148
|
-
return
|
|
147
|
+
const a = document.createElement("canvas");
|
|
148
|
+
return a.width = r, a.height = o, a;
|
|
149
149
|
}
|
|
150
150
|
function $(r, o) {
|
|
151
151
|
var e;
|
|
152
|
-
const
|
|
153
|
-
|
|
152
|
+
const a = o.opacity ?? 1, s = !!((e = o.stroke) != null && e.enabled);
|
|
153
|
+
a < 1 && s ? V(r, o, a) : w(r, o, a);
|
|
154
154
|
}
|
|
155
|
-
function V(r, o,
|
|
155
|
+
function V(r, o, a) {
|
|
156
156
|
var d;
|
|
157
|
-
const s = o.transformData, e = (((d = o.stroke) == null ? void 0 : d.width) || 2) + 2,
|
|
157
|
+
const s = o.transformData, e = (((d = o.stroke) == null ? void 0 : d.width) || 2) + 2, t = Math.ceil(s.width + e * 2), f = Math.ceil(s.height + e * 2), i = J(t, f), c = i.getContext("2d");
|
|
158
158
|
if (!c) {
|
|
159
|
-
w(r, o,
|
|
159
|
+
w(r, o, a);
|
|
160
160
|
return;
|
|
161
161
|
}
|
|
162
|
-
const
|
|
162
|
+
const n = {
|
|
163
163
|
...o,
|
|
164
|
-
x:
|
|
164
|
+
x: t / 2,
|
|
165
165
|
y: f / 2
|
|
166
166
|
};
|
|
167
|
-
w(c,
|
|
167
|
+
w(c, n, 1), r.save(), r.translate(o.x, o.y), o.rotation && r.rotate(-o.rotation * Math.PI / 180), r.globalAlpha = a, r.drawImage(i, -t / 2, -f / 2), r.restore();
|
|
168
168
|
}
|
|
169
|
-
function w(r, o,
|
|
169
|
+
function w(r, o, a) {
|
|
170
170
|
var e;
|
|
171
171
|
const s = o.transformData, h = s.fillOpacity ?? 1;
|
|
172
|
-
if (r.save(), r.translate(o.x, o.y), o.rotation && r.rotate(-o.rotation * Math.PI / 180), r.globalAlpha =
|
|
172
|
+
if (r.save(), r.translate(o.x, o.y), o.rotation && r.rotate(-o.rotation * Math.PI / 180), r.globalAlpha = a * h, r.fillStyle = X(r, s), r.beginPath(), M(r, s), r.fill(), r.restore(), (e = o.stroke) != null && e.enabled) {
|
|
173
173
|
r.save(), r.translate(o.x, o.y), o.rotation && r.rotate(-o.rotation * Math.PI / 180);
|
|
174
|
-
const
|
|
175
|
-
r.globalAlpha =
|
|
174
|
+
const t = o.stroke;
|
|
175
|
+
r.globalAlpha = a * (t.opacity ?? 1), r.strokeStyle = t.color || "#000000", r.lineWidth = t.width || 2, r.lineCap = t.lineCap || "round", r.lineJoin = t.lineJoin || "round", r.beginPath(), M(r, s), r.stroke(), r.restore();
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
|
-
function
|
|
179
|
-
const { shapeType:
|
|
180
|
-
switch (
|
|
178
|
+
function M(r, o) {
|
|
179
|
+
const { shapeType: a, width: s, height: h } = o;
|
|
180
|
+
switch (a) {
|
|
181
181
|
case "rectangle": {
|
|
182
|
-
const e = o.borderRadius || 0,
|
|
182
|
+
const e = o.borderRadius || 0, t = -s / 2, f = -h / 2;
|
|
183
183
|
if (e > 0) {
|
|
184
|
-
const
|
|
185
|
-
r.roundRect(
|
|
184
|
+
const i = Math.min(e / 100 * Math.min(s, h), s / 2, h / 2);
|
|
185
|
+
r.roundRect(t, f, s, h, i);
|
|
186
186
|
} else
|
|
187
|
-
r.rect(
|
|
187
|
+
r.rect(t, f, s, h);
|
|
188
188
|
break;
|
|
189
189
|
}
|
|
190
190
|
case "circle": {
|
|
@@ -197,31 +197,31 @@ function T(r, o) {
|
|
|
197
197
|
break;
|
|
198
198
|
}
|
|
199
199
|
case "triangle": {
|
|
200
|
-
const e = s / 2,
|
|
201
|
-
r.moveTo(0, -
|
|
200
|
+
const e = s / 2, t = h / 2;
|
|
201
|
+
r.moveTo(0, -t), r.lineTo(e, t), r.lineTo(-e, t), r.closePath();
|
|
202
202
|
break;
|
|
203
203
|
}
|
|
204
204
|
case "polygon": {
|
|
205
|
-
const e = o.sides || 5,
|
|
205
|
+
const e = o.sides || 5, t = Math.min(s, h) / 2;
|
|
206
206
|
for (let f = 0; f < e; f++) {
|
|
207
|
-
const
|
|
208
|
-
f === 0 ? r.moveTo(c,
|
|
207
|
+
const i = f * 2 * Math.PI / e - Math.PI / 2, c = t * Math.cos(i), n = t * Math.sin(i);
|
|
208
|
+
f === 0 ? r.moveTo(c, n) : r.lineTo(c, n);
|
|
209
209
|
}
|
|
210
210
|
r.closePath();
|
|
211
211
|
break;
|
|
212
212
|
}
|
|
213
213
|
case "star": {
|
|
214
|
-
const e = o.points || 5,
|
|
215
|
-
for (let
|
|
216
|
-
const c =
|
|
217
|
-
|
|
214
|
+
const e = o.points || 5, t = Math.min(s, h) / 2, f = t * (o.innerRadius || 0.4);
|
|
215
|
+
for (let i = 0; i < e * 2; i++) {
|
|
216
|
+
const c = i * Math.PI / e - Math.PI / 2, n = i % 2 === 0 ? t : f, d = n * Math.cos(c), g = n * Math.sin(c);
|
|
217
|
+
i === 0 ? r.moveTo(d, g) : r.lineTo(d, g);
|
|
218
218
|
}
|
|
219
219
|
r.closePath();
|
|
220
220
|
break;
|
|
221
221
|
}
|
|
222
222
|
case "line": {
|
|
223
|
-
const e = s / 2,
|
|
224
|
-
r.rect(-e, -
|
|
223
|
+
const e = s / 2, t = h / 2;
|
|
224
|
+
r.rect(-e, -t, s, h);
|
|
225
225
|
break;
|
|
226
226
|
}
|
|
227
227
|
default:
|
|
@@ -231,69 +231,70 @@ function T(r, o) {
|
|
|
231
231
|
export {
|
|
232
232
|
rr as AlignmentSnapSystem,
|
|
233
233
|
io as AnyElementConfigSchema,
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
234
|
+
ho as AnyTransformDataSchema,
|
|
235
|
+
Br as ArchTransform,
|
|
236
|
+
Kr as ArtboardManager,
|
|
237
237
|
or as ArtboardRenderer,
|
|
238
|
-
|
|
238
|
+
Ur as AscendTransform,
|
|
239
239
|
sr as CanvasRenderer,
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
240
|
+
co as CanvasStateV1Schema,
|
|
241
|
+
Yr as CircleTransform,
|
|
242
|
+
Jr as CustomTransform,
|
|
243
243
|
hr as DEFAULT_MAX_BITMAP_DIMENSION,
|
|
244
|
-
|
|
244
|
+
Vr as ElementStore,
|
|
245
245
|
cr as ExportManager,
|
|
246
|
-
|
|
247
|
-
|
|
246
|
+
qr as FlagTransform,
|
|
247
|
+
Gr as HybridHistoryManager,
|
|
248
248
|
dr as ImportManager,
|
|
249
249
|
er as InteractionStateMachine,
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
250
|
+
Qr as LeanTransform,
|
|
251
|
+
Zr as LogLevel,
|
|
252
|
+
tr as ResizePipeline,
|
|
253
|
+
fo as SerializedArtboardSchema,
|
|
254
|
+
nr as SpacingSystem,
|
|
255
|
+
ar as TransformHandles,
|
|
256
|
+
$r as WaveTransform,
|
|
257
257
|
fr as WorkerExportManager,
|
|
258
258
|
gr as applySpaceLayoutRules,
|
|
259
259
|
lr as applyStrokeStyle,
|
|
260
260
|
ur as buildFontString,
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
261
|
+
xr as calculateFixedCornerPosition,
|
|
262
|
+
Dr as calculateResizeHandles,
|
|
263
|
+
ro as calculateRotationHandlePosition,
|
|
264
264
|
pr as clearImageBitmapCache,
|
|
265
265
|
yr as clearMaskCache,
|
|
266
266
|
kr as clearRegisteredBitmapKeys,
|
|
267
267
|
vr as createCirclePath,
|
|
268
268
|
wr as createImagePath,
|
|
269
269
|
F as createLogger,
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
270
|
+
Cr as createRectPath,
|
|
271
|
+
Mr as createTextPath,
|
|
272
|
+
Tr as getFontMetrics,
|
|
273
273
|
Sr as getSharedWorkerExportManager,
|
|
274
|
-
|
|
275
|
-
|
|
274
|
+
oo as hitTestCircle,
|
|
275
|
+
so as hitTestRect,
|
|
276
276
|
br as invalidateMaskCache,
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
Ir as
|
|
280
|
-
mr as
|
|
277
|
+
Pr as loadExportWorkerCode,
|
|
278
|
+
eo as logger,
|
|
279
|
+
Ir as measureTextWidth,
|
|
280
|
+
mr as removeFromImageBitmapCache,
|
|
281
|
+
Ar as renderCustomTransform,
|
|
281
282
|
Z as renderImageElement,
|
|
282
283
|
k as renderImageStroke,
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
284
|
+
Rr as renderMultilineText,
|
|
285
|
+
Wr as renderPathStroke,
|
|
286
|
+
Er as renderRichTextFillOnly,
|
|
286
287
|
$ as renderShapeElement,
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
288
|
+
Or as renderTextElement,
|
|
289
|
+
Hr as renderTextFillOnly,
|
|
290
|
+
jr as renderTextStroke,
|
|
291
|
+
Fr as renderWithKnockout,
|
|
292
|
+
Lr as renderWithMasks,
|
|
292
293
|
Q as resolveServerCrop,
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
294
|
+
to as splitRichTextIntoLines,
|
|
295
|
+
Xr as terminateSharedWorkerExportManager,
|
|
296
|
+
zr as unregisterElementBitmaps,
|
|
296
297
|
no as wrapRichTextSpans,
|
|
297
|
-
|
|
298
|
+
Nr as wrapText
|
|
298
299
|
};
|
|
299
300
|
//# sourceMappingURL=internals.mjs.map
|