@snowcone-app/canvas 0.46.3 → 0.46.5
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-B8BADU_r.js → CanvasRenderer-CmIQSVCK.js} +4 -4
- package/dist/{CanvasRenderer-B8BADU_r.js.map → CanvasRenderer-CmIQSVCK.js.map} +1 -1
- package/dist/{ContextualToolbars-5tHC6s0Y.js → ContextualToolbars-Dmo86Wd2.js} +323 -322
- package/dist/{ContextualToolbars-5tHC6s0Y.js.map → ContextualToolbars-Dmo86Wd2.js.map} +1 -1
- package/dist/{EditorCanvasImpl-CrP9FSoY.js → EditorCanvasImpl-BHa8q4iO.js} +16 -15
- package/dist/{EditorCanvasImpl-CrP9FSoY.js.map → EditorCanvasImpl-BHa8q4iO.js.map} +1 -1
- package/dist/{ExportManager-xRsXgyNo.js → ExportManager-DEJgxB0S.js} +79 -78
- package/dist/{ExportManager-xRsXgyNo.js.map → ExportManager-DEJgxB0S.js.map} +1 -1
- package/dist/{FontAnalyzer-Ds3Wdba7.js → FontAnalyzer-CLMJi2Sw.js} +374 -409
- package/dist/FontAnalyzer-CLMJi2Sw.js.map +1 -0
- package/dist/{ImagePanel-bW3yr6Ac.js → ImagePanel-4fHABjNT.js} +6 -6
- package/dist/{ImagePanel-bW3yr6Ac.js.map → ImagePanel-4fHABjNT.js.map} +1 -1
- package/dist/{SnowconeCanvas-crxPwbib.js → SnowconeCanvas-GPag5BXG.js} +10 -10
- package/dist/{SnowconeCanvas-crxPwbib.js.map → SnowconeCanvas-GPag5BXG.js.map} +1 -1
- package/dist/advanced.mjs +54 -54
- package/dist/core/image-adjustments.d.ts +2 -4
- package/dist/core/masked-crop.d.ts +3 -55
- package/dist/{custom-icons-DQRp8GhF.js → custom-icons-Dt0Y4VSn.js} +2 -2
- package/dist/{custom-icons-DQRp8GhF.js.map → custom-icons-Dt0Y4VSn.js.map} +1 -1
- package/dist/design-builder-HKRo18WT.js +1798 -0
- package/dist/design-builder-HKRo18WT.js.map +1 -0
- package/dist/{embed-D0f-YvCl.js → embed-DhjsJ3ni.js} +10 -10
- package/dist/{embed-D0f-YvCl.js.map → embed-DhjsJ3ni.js.map} +1 -1
- package/dist/embed.mjs +35 -36
- package/dist/embed.mjs.map +1 -1
- package/dist/{export-worker.bundle.string-BL30CYzH.js → export-worker.bundle.string-CyMb_XjB.js} +27 -25
- package/dist/{export-worker.bundle.string-BL30CYzH.js.map → export-worker.bundle.string-CyMb_XjB.js.map} +1 -1
- package/dist/{guards-DwYEoqcn.js → guards-Dk86a-kH.js} +2 -2
- package/dist/{guards-DwYEoqcn.js.map → guards-Dk86a-kH.js.map} +1 -1
- package/dist/index.mjs +43 -43
- package/dist/internals.mjs +150 -149
- package/dist/internals.mjs.map +1 -1
- package/dist/rendering/serialize-for-server.d.ts +4 -91
- package/dist/state/CanvasStateV1.d.ts +1 -363
- package/dist/{CanvasStateV1-BlDWgOzV.js → template-fields-CKEuUmTM.js} +1997 -1835
- package/dist/template-fields-CKEuUmTM.js.map +1 -0
- package/dist/testing.mjs +61 -60
- package/dist/testing.mjs.map +1 -1
- package/dist/{useCommands-F-b_SwW-.js → useCommands-BI7O5Lf0.js} +225 -225
- package/dist/{useCommands-F-b_SwW-.js.map → useCommands-BI7O5Lf0.js.map} +1 -1
- package/dist/{usePieceGuideBundle-BWdobHQE.js → usePieceGuideBundle-DJfjOVEd.js} +2 -2
- package/dist/{usePieceGuideBundle-BWdobHQE.js.map → usePieceGuideBundle-DJfjOVEd.js.map} +1 -1
- package/dist/utils/custom-fonts.d.ts +2 -16
- package/dist/{validation-hn5ZX8Po.js → validation-au_-Sj-A.js} +11 -11
- package/dist/{validation-hn5ZX8Po.js.map → validation-au_-Sj-A.js.map} +1 -1
- package/dist/workers/export-worker.bundle.string.d.ts +1 -1
- package/example/package.json +1 -1
- package/package.json +3 -2
- package/dist/CanvasStateV1-BlDWgOzV.js.map +0 -1
- package/dist/FontAnalyzer-Ds3Wdba7.js.map +0 -1
- package/dist/design-builder-sH53Og6j.js +0 -1870
- package/dist/design-builder-sH53Og6j.js.map +0 -1
- package/dist/template-fields-BaQG0CJY.js +0 -559
- package/dist/template-fields-BaQG0CJY.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as n, I as t, P as a, S as s, T as i } from "./FontAnalyzer-
|
|
1
|
+
import { G as n, I as t, P as a, S as s, T as i } from "./FontAnalyzer-CLMJi2Sw.js";
|
|
2
2
|
function r(e) {
|
|
3
3
|
return e instanceof i;
|
|
4
4
|
}
|
|
@@ -21,4 +21,4 @@ export {
|
|
|
21
21
|
r as d,
|
|
22
22
|
m as i
|
|
23
23
|
};
|
|
24
|
-
//# sourceMappingURL=guards-
|
|
24
|
+
//# sourceMappingURL=guards-Dk86a-kH.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guards-
|
|
1
|
+
{"version":3,"file":"guards-Dk86a-kH.js","sources":["../src/types/guards.ts"],"sourcesContent":["/**\n * Type guards for EditorElement discrimination\n *\n * These guards use instanceof checks against the concrete element classes,\n * matching the pattern established in EditorContext.tsx. They accept\n * BaseElement | EditorElement | undefined | null for maximum flexibility\n * at call sites.\n */\n\nimport { BaseElement } from '../core/BaseElement.js';\nimport { TextElement } from '../core/TextElement.js';\nimport { ImageElement } from '../core/ImageElement.js';\nimport { GroupElement } from '../core/GroupElement.js';\nimport { ShapeElement } from '../core/ShapeElement.js';\nimport { PathElement } from '../core/PathElement.js';\n\ntype Narrowable = BaseElement | TextElement | ImageElement | GroupElement | ShapeElement | PathElement | undefined | null;\n\n/**\n * Type guard: checks if an element is a TextElement (or any text-based transform subclass).\n *\n * TextElement is the base class for all text transforms (custom, circle, arch, wave, etc.),\n * so this returns true for any text-based element regardless of its specific transformType.\n */\nexport function isTextElement(element: Narrowable): element is TextElement {\n return element instanceof TextElement;\n}\n\n/**\n * Type guard: checks if an element is an ImageElement.\n */\nexport function isImageElement(element: Narrowable): element is ImageElement {\n return element instanceof ImageElement;\n}\n\n/**\n * Type guard: checks if an element is a GroupElement.\n */\nexport function isGroupElement(element: Narrowable): element is GroupElement {\n return element instanceof GroupElement;\n}\n\n/**\n * Type guard: checks if an element is a ShapeElement.\n */\nexport function isShapeElement(element: Narrowable): element is ShapeElement {\n return element instanceof ShapeElement;\n}\n\n/**\n * Type guard: checks if an element is a PathElement.\n */\nexport function isPathElement(element: Narrowable): element is PathElement {\n return element instanceof PathElement;\n}\n"],"names":["isTextElement","element","TextElement","isImageElement","ImageElement","isGroupElement","GroupElement","isShapeElement","ShapeElement","isPathElement","PathElement"],"mappings":";AAwBO,SAASA,EAAcC,GAA6C;AACzE,SAAOA,aAAmBC;AAC5B;AAKO,SAASC,EAAeF,GAA8C;AAC3E,SAAOA,aAAmBG;AAC5B;AAKO,SAASC,EAAeJ,GAA8C;AAC3E,SAAOA,aAAmBK;AAC5B;AAKO,SAASC,EAAeN,GAA8C;AAC3E,SAAOA,aAAmBO;AAC5B;AAKO,SAASC,EAAcR,GAA6C;AACzE,SAAOA,aAAmBS;AAC5B;"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
import { e as u } from "./useCommands-
|
|
2
|
-
import { C as l, f as x, g as A, h as I, b as g, a as v, j as T, k as L, l as B } from "./useCommands-
|
|
3
|
-
import { E as P, S as _, S as y, u as R, a as O } from "./SnowconeCanvas-
|
|
1
|
+
import { e as u } from "./useCommands-BI7O5Lf0.js";
|
|
2
|
+
import { C as l, f as x, g as A, h as I, b as g, a as v, j as T, k as L, l as B } from "./useCommands-BI7O5Lf0.js";
|
|
3
|
+
import { E as P, S as _, S as y, u as R, a as O } from "./SnowconeCanvas-GPag5BXG.js";
|
|
4
4
|
import { E as z, c as w } from "./adjust-CDVzlVBY.js";
|
|
5
|
-
import { b as m, e as d } from "./design-builder-
|
|
6
|
-
import {
|
|
7
|
-
import { T as G, r as H,
|
|
8
|
-
import { A as
|
|
9
|
-
import { G as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
function
|
|
5
|
+
import { b as m, e as d } from "./design-builder-HKRo18WT.js";
|
|
6
|
+
import { D as N, f as V } from "./design-builder-HKRo18WT.js";
|
|
7
|
+
import { T as b, d as h, m as G, r as H, s as U, u as Y, a as Z, b as j, c as k, e as J, f as q, v as Q, w as W } from "./template-fields-CKEuUmTM.js";
|
|
8
|
+
import { A as $, C as ee, E as se, M as ae, P as te, r as oe, v as re } from "./validation-au_-Sj-A.js";
|
|
9
|
+
import { G as ie, H as ue, J as me, K as de } from "./ExportManager-DEJgxB0S.js";
|
|
10
|
+
import { CANVAS_STATE_SCHEMA_VERSION as Se, serializeStateForServer as fe } from "@snowcone-app/design/wire";
|
|
11
|
+
import { c as ce, e as pe } from "./compose-DtQL_oit.js";
|
|
12
|
+
function f() {
|
|
13
13
|
const { isCanvasReady: e } = m();
|
|
14
14
|
return e;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function C() {
|
|
17
17
|
const { zoom: e, panOffset: s, zoomIn: a, zoomOut: t, zoomToFit: o, resetView: r, setZoom: n, setPanOffset: i } = d();
|
|
18
18
|
return { zoom: e, panOffset: s, zoomIn: a, zoomOut: t, zoomToFit: o, resetView: r, setZoom: n, setPanOffset: i };
|
|
19
19
|
}
|
|
20
20
|
u();
|
|
21
21
|
export {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
$ as ALL_CAPABILITIES,
|
|
23
|
+
Se as CANVAS_STATE_SCHEMA_VERSION,
|
|
24
|
+
ee as COMPACT_CUSTOMIZER,
|
|
25
25
|
l as CanvasServicesProvider,
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
N as DesignBuilder,
|
|
27
|
+
se as EMBED_ONLY,
|
|
28
28
|
z as ENGRAVE_STEEL,
|
|
29
29
|
P as ErrorBoundary,
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
ae as MINIMAL_CAPABILITIES,
|
|
31
|
+
te as PRO_STUDIO,
|
|
32
32
|
_ as SnowconeCanvas,
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
b as TEMPLATE_FIELDS_KEY,
|
|
34
|
+
ce as createKit,
|
|
35
35
|
x as createProxyBgRemove,
|
|
36
36
|
A as createProxyGenerate,
|
|
37
37
|
I as createProxyImageSearch,
|
|
38
|
-
|
|
38
|
+
ie as customFontRegistry,
|
|
39
39
|
w as cutLightFor,
|
|
40
40
|
y as default,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
h as deserializeState,
|
|
42
|
+
V as design,
|
|
43
|
+
ue as ensureCustomFontsLoaded,
|
|
44
|
+
pe as extendKit,
|
|
45
|
+
me as loadCustomFont,
|
|
46
|
+
G as migrateState,
|
|
47
47
|
H as readTemplateFields,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
de as registerCustomFonts,
|
|
49
|
+
oe as resolveKit,
|
|
50
|
+
U as serializeState,
|
|
51
|
+
fe as serializeStateForServer,
|
|
52
52
|
g as useArtboards,
|
|
53
53
|
R as useAutoExport,
|
|
54
|
-
|
|
54
|
+
f as useCanvasReady,
|
|
55
55
|
v as useCanvasServices,
|
|
56
|
-
|
|
56
|
+
Y as useColorBinding,
|
|
57
57
|
T as useCommands,
|
|
58
58
|
O as useContentReady,
|
|
59
59
|
m as useEditor,
|
|
60
|
-
|
|
60
|
+
Z as useElementByName,
|
|
61
61
|
L as useExport,
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
j as useFontBinding,
|
|
63
|
+
k as useImageBinding,
|
|
64
64
|
B as useLayers,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
65
|
+
J as useSelectedElement,
|
|
66
|
+
q as useTextBinding,
|
|
67
|
+
C as useViewport,
|
|
68
|
+
re as validateKit,
|
|
69
|
+
Q as validateState,
|
|
70
|
+
W as withTemplateFields
|
|
71
71
|
};
|
|
72
72
|
//# sourceMappingURL=index.mjs.map
|
package/dist/internals.mjs
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { r as k } from "./ExportManager-
|
|
3
|
-
import { D as
|
|
4
|
-
import {
|
|
5
|
-
import { d as
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
import { A as or, a as er, C as sr, I as tr, R as nr, S as ir, T as ar } from "./CanvasRenderer-CmIQSVCK.js";
|
|
2
|
+
import { r as k } from "./ExportManager-DEJgxB0S.js";
|
|
3
|
+
import { D as cr, a as dr, I as fr, W as gr, b as lr, c as ur, d as pr, e as yr, f as kr, g as vr, h as wr, i as Mr, j as Tr, k as Cr, l as br, m as Sr, n as Pr, o as Ir, p as mr, q as Ar, s as Rr, t as Wr, u as Er, v as Or, w as Hr, x as jr, y as Fr, z as Lr, A as Xr, B as zr, C as Nr, F as _r } from "./ExportManager-DEJgxB0S.js";
|
|
4
|
+
import { a as H, c as j, r as F, b as L } from "./FontAnalyzer-CLMJi2Sw.js";
|
|
5
|
+
import { d as Kr, e as Ur, f as Yr, C as Jr, g as Vr, E as qr, F as Gr, H as Qr, L as Zr, h as $r, W as xr, i as Dr, j as ro, k as oo, l as eo, m as so, n as to, s as no, w as io } from "./FontAnalyzer-CLMJi2Sw.js";
|
|
6
|
+
import { AnyElementConfigSchema as ho, AnyTransformDataSchema as co, CanvasStateV1Schema as fo, SerializedArtboardSchema as go } from "@snowcone-app/design";
|
|
7
|
+
import { isNeutralAdjustments as X } from "@snowcone-app/design/wire";
|
|
8
|
+
const z = j("image-adjustments"), v = 1e-3;
|
|
8
9
|
function N(r, o) {
|
|
9
|
-
const { brightness:
|
|
10
|
+
const { brightness: i, contrast: e, saturation: h } = o, s = i * e, t = 127.5 * (1 - e), f = Math.abs(s - 1) > v || Math.abs(t) > v, a = new Uint8ClampedArray(256);
|
|
10
11
|
if (f)
|
|
11
|
-
for (let l = 0; l < 256; l++)
|
|
12
|
-
const c = Math.abs(h - 1) > v, n = h, d = 0.213 + 0.787 * n, g = 0.715 - 0.715 * n,
|
|
12
|
+
for (let l = 0; l < 256; l++) a[l] = l * s + t;
|
|
13
|
+
const c = Math.abs(h - 1) > v, n = h, d = 0.213 + 0.787 * n, g = 0.715 - 0.715 * n, b = 0.072 - 0.072 * n, S = 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
14
|
for (let l = 0; l < r.length; l += 4) {
|
|
14
15
|
let u = r[l], p = r[l + 1], y = r[l + 2];
|
|
15
|
-
if (f && (u =
|
|
16
|
-
const W = d * u + g * p +
|
|
16
|
+
if (f && (u = a[u], p = a[p], y = a[y]), c) {
|
|
17
|
+
const W = d * u + g * p + b * y, E = S * u + P * p + I * y, O = m * u + A * p + R * y;
|
|
17
18
|
u = W, p = E, y = O;
|
|
18
19
|
}
|
|
19
20
|
r[l] = u, r[l + 1] = p, r[l + 2] = y;
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
|
-
const
|
|
23
|
+
const M = /* @__PURE__ */ new WeakMap(), _ = 4;
|
|
23
24
|
function B(r) {
|
|
24
25
|
const o = r.naturalWidth;
|
|
25
26
|
return typeof o == "number" && o > 0 ? o : r.width;
|
|
@@ -32,43 +33,43 @@ function U(r, o) {
|
|
|
32
33
|
if (typeof OffscreenCanvas < "u")
|
|
33
34
|
return new OffscreenCanvas(r, o);
|
|
34
35
|
if (typeof document < "u") {
|
|
35
|
-
const
|
|
36
|
-
return
|
|
36
|
+
const i = document.createElement("canvas");
|
|
37
|
+
return i.width = r, i.height = o, i;
|
|
37
38
|
}
|
|
38
39
|
throw new Error("image-adjustments: no canvas implementation available (no OffscreenCanvas, no DOM)");
|
|
39
40
|
}
|
|
40
41
|
function Y(r, o) {
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
42
|
+
const i = B(r), e = K(r);
|
|
43
|
+
if (i <= 0 || e <= 0)
|
|
43
44
|
throw new Error("image-adjustments: source has no pixels (width/height is 0)");
|
|
44
|
-
const h = U(
|
|
45
|
-
if (!
|
|
45
|
+
const h = U(i, e), s = h.getContext("2d");
|
|
46
|
+
if (!s)
|
|
46
47
|
throw new Error("image-adjustments: could not acquire a 2d context");
|
|
47
|
-
|
|
48
|
-
const t =
|
|
49
|
-
return N(t.data, o),
|
|
48
|
+
s.drawImage(r, 0, 0, i, e);
|
|
49
|
+
const t = s.getImageData(0, 0, i, e);
|
|
50
|
+
return N(t.data, o), s.putImageData(t, 0, 0), h;
|
|
50
51
|
}
|
|
51
|
-
function
|
|
52
|
-
if (
|
|
53
|
-
const
|
|
54
|
-
let
|
|
55
|
-
const h =
|
|
52
|
+
function C(r, o) {
|
|
53
|
+
if (X(o)) return r;
|
|
54
|
+
const i = H(o);
|
|
55
|
+
let e = M.get(r);
|
|
56
|
+
const h = e == null ? void 0 : e.get(i);
|
|
56
57
|
if (h)
|
|
57
|
-
return
|
|
58
|
-
let
|
|
58
|
+
return e.delete(i), e.set(i, h), h;
|
|
59
|
+
let s;
|
|
59
60
|
try {
|
|
60
|
-
|
|
61
|
+
s = Y(r, o);
|
|
61
62
|
} catch (t) {
|
|
62
|
-
z.error("adjustment pixel pass failed — rendering UNADJUSTED source:", t),
|
|
63
|
+
z.error("adjustment pixel pass failed — rendering UNADJUSTED source:", t), s = r;
|
|
63
64
|
}
|
|
64
|
-
for (
|
|
65
|
-
const t =
|
|
66
|
-
|
|
65
|
+
for (e || (e = /* @__PURE__ */ new Map(), M.set(r, e)), e.set(i, s); e.size > _; ) {
|
|
66
|
+
const t = e.keys().next().value;
|
|
67
|
+
e.delete(t);
|
|
67
68
|
}
|
|
68
|
-
return
|
|
69
|
+
return s;
|
|
69
70
|
}
|
|
70
|
-
|
|
71
|
-
function
|
|
71
|
+
F(C);
|
|
72
|
+
function Z(r, o) {
|
|
72
73
|
return !r.needsCropPixelConversion || r.cropWidth === void 0 ? r : {
|
|
73
74
|
...r,
|
|
74
75
|
cropX: (r.cropX ?? 0) * o.width,
|
|
@@ -78,36 +79,36 @@ function Q(r, o) {
|
|
|
78
79
|
needsCropPixelConversion: !1
|
|
79
80
|
};
|
|
80
81
|
}
|
|
81
|
-
function
|
|
82
|
+
function $(r, o, i) {
|
|
82
83
|
var t, f;
|
|
83
|
-
const
|
|
84
|
-
|
|
84
|
+
const e = C(
|
|
85
|
+
i,
|
|
85
86
|
o.adjustments
|
|
86
87
|
);
|
|
87
88
|
r.save(), r.translate(o.x, o.y), o.rotation && r.rotate(-o.rotation * Math.PI / 180);
|
|
88
|
-
let h = 1,
|
|
89
|
-
if (o.flipHorizontal && (h = -1), o.flipVertical && (
|
|
90
|
-
const
|
|
89
|
+
let h = 1, s = 1;
|
|
90
|
+
if (o.flipHorizontal && (h = -1), o.flipVertical && (s = -1), (h !== 1 || s !== 1) && r.scale(h, s), o.opacity !== void 0 && o.opacity !== 1 && (r.globalAlpha = o.opacity), o.borderRadius && o.borderRadius > 0) {
|
|
91
|
+
const a = Math.min(
|
|
91
92
|
o.borderRadius / 100 * Math.min(o.width, o.height),
|
|
92
93
|
o.width / 2,
|
|
93
94
|
o.height / 2
|
|
94
95
|
);
|
|
95
96
|
r.beginPath();
|
|
96
97
|
const c = -o.width / 2, n = -o.height / 2, d = o.width, g = o.height;
|
|
97
|
-
r.moveTo(c +
|
|
98
|
+
r.moveTo(c + a, n), r.lineTo(c + d - a, n), r.arcTo(c + d, n, c + d, n + a, a), r.lineTo(c + d, n + g - a), r.arcTo(c + d, n + g, c + d - a, n + g, a), r.lineTo(c + a, n + g), r.arcTo(c, n + g, c, n + g - a, a), r.lineTo(c, n + a), r.arcTo(c, n, c + a, n, a), r.closePath(), r.clip();
|
|
98
99
|
}
|
|
99
100
|
if (o.cropX !== void 0 && o.cropWidth !== void 0 ? r.drawImage(
|
|
100
|
-
|
|
101
|
+
e,
|
|
101
102
|
o.cropX,
|
|
102
103
|
o.cropY || 0,
|
|
103
104
|
o.cropWidth,
|
|
104
|
-
o.cropHeight ||
|
|
105
|
+
o.cropHeight || i.height,
|
|
105
106
|
-o.width / 2,
|
|
106
107
|
-o.height / 2,
|
|
107
108
|
o.width,
|
|
108
109
|
o.height
|
|
109
|
-
) : r.drawImage(
|
|
110
|
-
const
|
|
110
|
+
) : r.drawImage(e, -o.width / 2, -o.height / 2, o.width, o.height), r.restore(), (t = o.stroke) != null && t.enabled) {
|
|
111
|
+
const a = ((f = o.knockoutParts) == null ? void 0 : f.stroke) === !0, c = {
|
|
111
112
|
x: o.x,
|
|
112
113
|
y: o.y,
|
|
113
114
|
rotation: o.rotation,
|
|
@@ -120,7 +121,7 @@ function Z(r, o, a) {
|
|
|
120
121
|
borderRadius: o.borderRadius || 0
|
|
121
122
|
}
|
|
122
123
|
};
|
|
123
|
-
if (
|
|
124
|
+
if (a) {
|
|
124
125
|
const n = r.canvas;
|
|
125
126
|
let d;
|
|
126
127
|
if (typeof OffscreenCanvas < "u")
|
|
@@ -144,19 +145,19 @@ function Z(r, o, a) {
|
|
|
144
145
|
function J(r, o) {
|
|
145
146
|
if (typeof OffscreenCanvas < "u")
|
|
146
147
|
return new OffscreenCanvas(r, o);
|
|
147
|
-
const
|
|
148
|
-
return
|
|
148
|
+
const i = document.createElement("canvas");
|
|
149
|
+
return i.width = r, i.height = o, i;
|
|
149
150
|
}
|
|
150
|
-
function
|
|
151
|
-
var
|
|
152
|
-
const
|
|
153
|
-
|
|
151
|
+
function x(r, o) {
|
|
152
|
+
var s;
|
|
153
|
+
const i = o.opacity ?? 1, e = !!((s = o.stroke) != null && s.enabled);
|
|
154
|
+
i < 1 && e ? V(r, o, i) : w(r, o, i);
|
|
154
155
|
}
|
|
155
|
-
function V(r, o,
|
|
156
|
+
function V(r, o, i) {
|
|
156
157
|
var d;
|
|
157
|
-
const
|
|
158
|
+
const e = o.transformData, s = (((d = o.stroke) == null ? void 0 : d.width) || 2) + 2, t = Math.ceil(e.width + s * 2), f = Math.ceil(e.height + s * 2), a = J(t, f), c = a.getContext("2d");
|
|
158
159
|
if (!c) {
|
|
159
|
-
w(r, o,
|
|
160
|
+
w(r, o, i);
|
|
160
161
|
return;
|
|
161
162
|
}
|
|
162
163
|
const n = {
|
|
@@ -164,137 +165,137 @@ function V(r, o, a) {
|
|
|
164
165
|
x: t / 2,
|
|
165
166
|
y: f / 2
|
|
166
167
|
};
|
|
167
|
-
w(c, n, 1), r.save(), r.translate(o.x, o.y), o.rotation && r.rotate(-o.rotation * Math.PI / 180), r.globalAlpha =
|
|
168
|
+
w(c, n, 1), r.save(), r.translate(o.x, o.y), o.rotation && r.rotate(-o.rotation * Math.PI / 180), r.globalAlpha = i, r.drawImage(a, -t / 2, -f / 2), r.restore();
|
|
168
169
|
}
|
|
169
|
-
function w(r, o,
|
|
170
|
-
var
|
|
171
|
-
const
|
|
172
|
-
if (r.save(), r.translate(o.x, o.y), o.rotation && r.rotate(-o.rotation * Math.PI / 180), r.globalAlpha =
|
|
170
|
+
function w(r, o, i) {
|
|
171
|
+
var s;
|
|
172
|
+
const e = o.transformData, h = e.fillOpacity ?? 1;
|
|
173
|
+
if (r.save(), r.translate(o.x, o.y), o.rotation && r.rotate(-o.rotation * Math.PI / 180), r.globalAlpha = i * h, r.fillStyle = L(r, e), r.beginPath(), T(r, e), r.fill(), r.restore(), (s = o.stroke) != null && s.enabled) {
|
|
173
174
|
r.save(), r.translate(o.x, o.y), o.rotation && r.rotate(-o.rotation * Math.PI / 180);
|
|
174
175
|
const t = o.stroke;
|
|
175
|
-
r.globalAlpha =
|
|
176
|
+
r.globalAlpha = i * (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(), T(r, e), r.stroke(), r.restore();
|
|
176
177
|
}
|
|
177
178
|
}
|
|
178
|
-
function
|
|
179
|
-
const { shapeType:
|
|
180
|
-
switch (
|
|
179
|
+
function T(r, o) {
|
|
180
|
+
const { shapeType: i, width: e, height: h } = o;
|
|
181
|
+
switch (i) {
|
|
181
182
|
case "rectangle": {
|
|
182
|
-
const
|
|
183
|
-
if (
|
|
184
|
-
const
|
|
185
|
-
r.roundRect(t, f,
|
|
183
|
+
const s = o.borderRadius || 0, t = -e / 2, f = -h / 2;
|
|
184
|
+
if (s > 0) {
|
|
185
|
+
const a = Math.min(s / 100 * Math.min(e, h), e / 2, h / 2);
|
|
186
|
+
r.roundRect(t, f, e, h, a);
|
|
186
187
|
} else
|
|
187
|
-
r.rect(t, f,
|
|
188
|
+
r.rect(t, f, e, h);
|
|
188
189
|
break;
|
|
189
190
|
}
|
|
190
191
|
case "circle": {
|
|
191
|
-
const
|
|
192
|
-
r.arc(0, 0,
|
|
192
|
+
const s = Math.min(e, h) / 2;
|
|
193
|
+
r.arc(0, 0, s, 0, Math.PI * 2);
|
|
193
194
|
break;
|
|
194
195
|
}
|
|
195
196
|
case "ellipse": {
|
|
196
|
-
r.ellipse(0, 0,
|
|
197
|
+
r.ellipse(0, 0, e / 2, h / 2, 0, 0, Math.PI * 2);
|
|
197
198
|
break;
|
|
198
199
|
}
|
|
199
200
|
case "triangle": {
|
|
200
|
-
const
|
|
201
|
-
r.moveTo(0, -t), r.lineTo(
|
|
201
|
+
const s = e / 2, t = h / 2;
|
|
202
|
+
r.moveTo(0, -t), r.lineTo(s, t), r.lineTo(-s, t), r.closePath();
|
|
202
203
|
break;
|
|
203
204
|
}
|
|
204
205
|
case "polygon": {
|
|
205
|
-
const
|
|
206
|
-
for (let f = 0; f <
|
|
207
|
-
const
|
|
206
|
+
const s = o.sides || 5, t = Math.min(e, h) / 2;
|
|
207
|
+
for (let f = 0; f < s; f++) {
|
|
208
|
+
const a = f * 2 * Math.PI / s - Math.PI / 2, c = t * Math.cos(a), n = t * Math.sin(a);
|
|
208
209
|
f === 0 ? r.moveTo(c, n) : r.lineTo(c, n);
|
|
209
210
|
}
|
|
210
211
|
r.closePath();
|
|
211
212
|
break;
|
|
212
213
|
}
|
|
213
214
|
case "star": {
|
|
214
|
-
const
|
|
215
|
-
for (let
|
|
216
|
-
const c =
|
|
217
|
-
|
|
215
|
+
const s = o.points || 5, t = Math.min(e, h) / 2, f = t * (o.innerRadius || 0.4);
|
|
216
|
+
for (let a = 0; a < s * 2; a++) {
|
|
217
|
+
const c = a * Math.PI / s - Math.PI / 2, n = a % 2 === 0 ? t : f, d = n * Math.cos(c), g = n * Math.sin(c);
|
|
218
|
+
a === 0 ? r.moveTo(d, g) : r.lineTo(d, g);
|
|
218
219
|
}
|
|
219
220
|
r.closePath();
|
|
220
221
|
break;
|
|
221
222
|
}
|
|
222
223
|
case "line": {
|
|
223
|
-
const
|
|
224
|
-
r.rect(-
|
|
224
|
+
const s = e / 2, t = h / 2;
|
|
225
|
+
r.rect(-s, -t, e, h);
|
|
225
226
|
break;
|
|
226
227
|
}
|
|
227
228
|
default:
|
|
228
|
-
r.rect(-
|
|
229
|
+
r.rect(-e / 2, -h / 2, e, h);
|
|
229
230
|
}
|
|
230
231
|
}
|
|
231
232
|
export {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
233
|
+
or as AlignmentSnapSystem,
|
|
234
|
+
ho as AnyElementConfigSchema,
|
|
235
|
+
co as AnyTransformDataSchema,
|
|
236
|
+
Kr as ArchTransform,
|
|
237
|
+
Ur as ArtboardManager,
|
|
238
|
+
er as ArtboardRenderer,
|
|
239
|
+
Yr as AscendTransform,
|
|
239
240
|
sr as CanvasRenderer,
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
241
|
+
fo as CanvasStateV1Schema,
|
|
242
|
+
Jr as CircleTransform,
|
|
243
|
+
Vr as CustomTransform,
|
|
244
|
+
cr as DEFAULT_MAX_BITMAP_DIMENSION,
|
|
245
|
+
qr as ElementStore,
|
|
246
|
+
dr as ExportManager,
|
|
247
|
+
Gr as FlagTransform,
|
|
248
|
+
Qr as HybridHistoryManager,
|
|
249
|
+
fr as ImportManager,
|
|
250
|
+
tr as InteractionStateMachine,
|
|
251
|
+
Zr as LeanTransform,
|
|
252
|
+
$r as LogLevel,
|
|
253
|
+
nr as ResizePipeline,
|
|
254
|
+
go as SerializedArtboardSchema,
|
|
255
|
+
ir as SpacingSystem,
|
|
255
256
|
ar as TransformHandles,
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
257
|
+
xr as WaveTransform,
|
|
258
|
+
gr as WorkerExportManager,
|
|
259
|
+
lr as applySpaceLayoutRules,
|
|
260
|
+
ur as applyStrokeStyle,
|
|
261
|
+
pr as buildFontString,
|
|
262
|
+
Dr as calculateFixedCornerPosition,
|
|
263
|
+
ro as calculateResizeHandles,
|
|
264
|
+
oo as calculateRotationHandlePosition,
|
|
265
|
+
yr as clearImageBitmapCache,
|
|
266
|
+
kr as clearMaskCache,
|
|
267
|
+
vr as clearRegisteredBitmapKeys,
|
|
268
|
+
wr as createCirclePath,
|
|
269
|
+
Mr as createImagePath,
|
|
270
|
+
j as createLogger,
|
|
271
|
+
Tr as createRectPath,
|
|
272
|
+
Cr as createTextPath,
|
|
273
|
+
br as getFontMetrics,
|
|
273
274
|
Sr as getSharedWorkerExportManager,
|
|
274
|
-
|
|
275
|
+
eo as hitTestCircle,
|
|
275
276
|
so as hitTestRect,
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
277
|
+
Pr as invalidateMaskCache,
|
|
278
|
+
Ir as loadExportWorkerCode,
|
|
279
|
+
to as logger,
|
|
280
|
+
mr as measureTextWidth,
|
|
281
|
+
Ar as removeFromImageBitmapCache,
|
|
282
|
+
Rr as renderCustomTransform,
|
|
283
|
+
$ as renderImageElement,
|
|
283
284
|
k as renderImageStroke,
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
285
|
+
Wr as renderMultilineText,
|
|
286
|
+
Er as renderPathStroke,
|
|
287
|
+
Or as renderRichTextFillOnly,
|
|
288
|
+
x as renderShapeElement,
|
|
289
|
+
Hr as renderTextElement,
|
|
290
|
+
jr as renderTextFillOnly,
|
|
291
|
+
Fr as renderTextStroke,
|
|
292
|
+
Lr as renderWithKnockout,
|
|
293
|
+
Xr as renderWithMasks,
|
|
294
|
+
Z as resolveServerCrop,
|
|
295
|
+
no as splitRichTextIntoLines,
|
|
296
|
+
zr as terminateSharedWorkerExportManager,
|
|
297
|
+
Nr as unregisterElementBitmaps,
|
|
298
|
+
io as wrapRichTextSpans,
|
|
299
|
+
_r as wrapText
|
|
299
300
|
};
|
|
300
301
|
//# sourceMappingURL=internals.mjs.map
|