@snowcone-app/canvas 0.37.0 → 0.38.0
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/ERROR_CONTRACT.md +39 -8
- package/STYLING_CONTRACT.md +24 -2
- package/dist/{CanvasRenderer-CTN4j-uO.js → CanvasRenderer-D-E5WWLm.js} +4 -4
- package/dist/{CanvasRenderer-CTN4j-uO.js.map → CanvasRenderer-D-E5WWLm.js.map} +1 -1
- package/dist/{CanvasStateV1-DLE5d1-d.js → CanvasStateV1-C9LQt2J0.js} +7 -7
- package/dist/{CanvasStateV1-DLE5d1-d.js.map → CanvasStateV1-C9LQt2J0.js.map} +1 -1
- package/dist/{ContextualToolbars-CG5Gmv_i.js → ContextualToolbars-C62As-xY.js} +202 -202
- package/dist/{ContextualToolbars-CG5Gmv_i.js.map → ContextualToolbars-C62As-xY.js.map} +1 -1
- package/dist/EditorCanvasImpl-BnxEbr2p.js +144 -0
- package/dist/EditorCanvasImpl-BnxEbr2p.js.map +1 -0
- package/dist/{ExportManager-CDX5_up8.js → ExportManager-BbBfO22S.js} +45 -45
- package/dist/{ExportManager-CDX5_up8.js.map → ExportManager-BbBfO22S.js.map} +1 -1
- package/dist/{FontAnalyzer-CEYA_6fY.js → FontAnalyzer-DWHS41ba.js} +128 -128
- package/dist/FontAnalyzer-DWHS41ba.js.map +1 -0
- package/dist/{ImagePanel-DLxIDKV-.js → ImagePanel-BaX0UE-L.js} +57 -57
- package/dist/{ImagePanel-DLxIDKV-.js.map → ImagePanel-BaX0UE-L.js.map} +1 -1
- package/dist/SnowconeCanvas-CWSPyqqj.js +1112 -0
- package/dist/SnowconeCanvas-CWSPyqqj.js.map +1 -0
- package/dist/advanced.mjs +138 -138
- package/dist/api/placement.d.ts +3 -0
- package/dist/components/editor/EditorPlacements.d.ts +19 -6
- package/dist/components/editor/RootInternals.d.ts +7 -0
- package/dist/components/editor/designStateStore.d.ts +18 -0
- package/dist/components/editor/index.d.ts +3 -1
- package/dist/components/editor/placementLinks.d.ts +52 -0
- package/dist/components/editor/usePlacements.d.ts +28 -4
- package/dist/components/embed-realtime/context.d.ts +20 -4
- package/dist/components/embed-realtime/usePieceGuideBundle.d.ts +1 -0
- package/dist/components/embed-realtime/validateEmbed.d.ts +6 -3
- package/dist/{custom-icons-D51KIAfz.js → custom-icons-o1U13Vcg.js} +14 -14
- package/dist/{custom-icons-D51KIAfz.js.map → custom-icons-o1U13Vcg.js.map} +1 -1
- package/dist/{design-builder-CqgTpp9B.js → design-builder-CoCtjIwj.js} +86 -86
- package/dist/{design-builder-CqgTpp9B.js.map → design-builder-CoCtjIwj.js.map} +1 -1
- package/dist/{embed-CLz3CTcX.js → embed-SOFUZlGB.js} +843 -729
- package/dist/embed-SOFUZlGB.js.map +1 -0
- package/dist/embed.mjs +28 -28
- package/dist/errors/editorError.d.ts +7 -2
- package/dist/{guards-DldCuuJq.js → guards-DMmhw_Ow.js} +4 -4
- package/dist/{guards-DldCuuJq.js.map → guards-DMmhw_Ow.js.map} +1 -1
- package/dist/index.mjs +21 -21
- package/dist/internals.mjs +108 -108
- package/dist/internals.mjs.map +1 -1
- package/dist/placement-Br5jI_-u.js +90 -0
- package/dist/placement-Br5jI_-u.js.map +1 -0
- package/dist/placement.d.ts +2 -0
- package/dist/placement.mjs +5 -0
- package/dist/placement.mjs.map +1 -0
- package/dist/template-fields-CBLHgW7G.js +556 -0
- package/dist/template-fields-CBLHgW7G.js.map +1 -0
- package/dist/testing.mjs +24 -24
- package/dist/{useCommands-CQi4Pyd2.js → useCommands-x8J7_Mzy.js} +262 -262
- package/dist/{useCommands-CQi4Pyd2.js.map → useCommands-x8J7_Mzy.js.map} +1 -1
- package/dist/usePieceGuideBundle-C7r06a_x.js +65 -0
- package/dist/usePieceGuideBundle-C7r06a_x.js.map +1 -0
- package/dist/{validation-THw5W6N_.js → validation-BG-V98h0.js} +846 -846
- package/dist/validation-BG-V98h0.js.map +1 -0
- package/example/package.json +1 -1
- package/package.json +9 -4
- package/dist/EditorCanvasImpl-BRdFWZA5.js +0 -81
- package/dist/EditorCanvasImpl-BRdFWZA5.js.map +0 -1
- package/dist/FontAnalyzer-CEYA_6fY.js.map +0 -1
- package/dist/SnowconeCanvas-BaFR8QXs.js +0 -1196
- package/dist/SnowconeCanvas-BaFR8QXs.js.map +0 -1
- package/dist/embed-CLz3CTcX.js.map +0 -1
- package/dist/template-fields-D8uOutD4.js +0 -505
- package/dist/template-fields-D8uOutD4.js.map +0 -1
- package/dist/usePieceGuideBundle-BUQKb0Ja.js +0 -61
- package/dist/usePieceGuideBundle-BUQKb0Ja.js.map +0 -1
- package/dist/validation-THw5W6N_.js.map +0 -1
package/dist/embed.mjs
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import { C as a,
|
|
2
|
-
import { E as
|
|
3
|
-
import {
|
|
4
|
-
import { D as
|
|
5
|
-
import { D as
|
|
6
|
-
import {
|
|
7
|
-
import { s as ne } from "./CanvasStateV1-
|
|
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-x8J7_Mzy.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 F, g as v, i as y, h, p as k, s as D, j as I, k as L, l as K, v as w } from "./embed-SOFUZlGB.js";
|
|
3
|
+
import { t as M, V as j } from "./FontAnalyzer-DWHS41ba.js";
|
|
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-CBLHgW7G.js";
|
|
6
|
+
import { F as ae, G as te, H as oe, J as re } from "./ExportManager-BbBfO22S.js";
|
|
7
|
+
import { s as ne } from "./CanvasStateV1-C9LQt2J0.js";
|
|
8
8
|
export {
|
|
9
9
|
a as CanvasServicesProvider,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
N as DesignBuilder,
|
|
11
|
+
O as DesignStateStore,
|
|
12
|
+
C as Editor,
|
|
13
|
+
M as EditorError,
|
|
14
|
+
S as RealtimeCanvas,
|
|
15
|
+
T as RealtimeEmbed,
|
|
16
|
+
f as RealtimeMockup,
|
|
17
17
|
P as SnowconeEditor,
|
|
18
|
-
|
|
18
|
+
Q as TEMPLATE_FIELDS_KEY,
|
|
19
19
|
R as auditEditor,
|
|
20
20
|
b as bundleToRenderConfig,
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
B as bundleVariantToken,
|
|
22
|
+
F 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
|
+
v as formatBuyPrice,
|
|
30
|
+
y as isBundleProduct,
|
|
31
31
|
h as isBundleRenderProduct,
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
_ as isColorToken,
|
|
33
|
+
j as isEditorError,
|
|
34
34
|
i as isGroupElement,
|
|
35
35
|
n as isImageElement,
|
|
36
|
-
|
|
36
|
+
z as isLayerToken,
|
|
37
37
|
d as isPathElement,
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
m as isShapeElement,
|
|
39
|
+
u as isTextElement,
|
|
40
40
|
oe as loadCustomFont,
|
|
41
41
|
k as productToRenderConfig,
|
|
42
|
-
|
|
42
|
+
Y as readTemplateFields,
|
|
43
43
|
re as registerCustomFonts,
|
|
44
44
|
ne as serializeState,
|
|
45
45
|
D as splitRoleKey,
|
|
46
46
|
l as useArtboards,
|
|
47
47
|
E as useCanvasServices,
|
|
48
|
-
|
|
48
|
+
q as useColorBinding,
|
|
49
49
|
c as useCommands,
|
|
50
|
-
|
|
50
|
+
H as useEditor,
|
|
51
51
|
U as useElementByName,
|
|
52
52
|
p as useExport,
|
|
53
53
|
W as useFontBinding,
|
|
@@ -39,9 +39,14 @@ export type EditorErrorCode =
|
|
|
39
39
|
/** `design().artboard()`: an artboard with this label already exists in the
|
|
40
40
|
* design (artboard names are placement labels — unique by contract). */
|
|
41
41
|
| 'E_DUPLICATE_ARTBOARD'
|
|
42
|
-
/** `usePlacements().select()`: the label
|
|
43
|
-
* (ADR-0088). Lists the
|
|
42
|
+
/** `usePlacements().select()` / `.split()`: the label is neither a required
|
|
43
|
+
* product placement nor a design artboard (ADR-0088 / ADR-0101). Lists the
|
|
44
|
+
* valid placement labels. */
|
|
44
45
|
| 'E_UNKNOWN_PLACEMENT'
|
|
46
|
+
/** `usePlacements().link()`: the label is the BASE artboard — the one every
|
|
47
|
+
* linked placement inherits — so it cannot be re-linked (ADR-0101). Link
|
|
48
|
+
* a split placement instead, or call `linkAll()`. */
|
|
49
|
+
| 'E_LINK_BASE'
|
|
45
50
|
/** `select()` named an option key/choice that doesn't exist on the product
|
|
46
51
|
* (Buy-owned selection, ADR-0085 §2 / P2). */
|
|
47
52
|
| 'E_UNKNOWN_OPTION'
|
|
@@ -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-DWHS41ba.js";
|
|
2
2
|
function r(e) {
|
|
3
3
|
return e instanceof i;
|
|
4
4
|
}
|
|
@@ -15,10 +15,10 @@ function f(e) {
|
|
|
15
15
|
return e instanceof a;
|
|
16
16
|
}
|
|
17
17
|
export {
|
|
18
|
-
|
|
18
|
+
u as a,
|
|
19
19
|
f as b,
|
|
20
20
|
c,
|
|
21
21
|
r as d,
|
|
22
|
-
|
|
22
|
+
m as i
|
|
23
23
|
};
|
|
24
|
-
//# sourceMappingURL=guards-
|
|
24
|
+
//# sourceMappingURL=guards-DMmhw_Ow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guards-
|
|
1
|
+
{"version":3,"file":"guards-DMmhw_Ow.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,30 +1,30 @@
|
|
|
1
|
-
import { e as u } from "./useCommands-
|
|
2
|
-
import { C as
|
|
3
|
-
import { E as
|
|
4
|
-
import {
|
|
5
|
-
import { C as z, D as w,
|
|
6
|
-
import { T as V, r as b, u as h, a as
|
|
7
|
-
import { A as
|
|
8
|
-
import {
|
|
1
|
+
import { e as u } from "./useCommands-x8J7_Mzy.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 F } from "./useCommands-x8J7_Mzy.js";
|
|
3
|
+
import { E as y, S as L, S as _, u as O, a as R } from "./SnowconeCanvas-CWSPyqqj.js";
|
|
4
|
+
import { b as m, d } from "./design-builder-CoCtjIwj.js";
|
|
5
|
+
import { C as z, D as w, e as D, s as K } 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-CBLHgW7G.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-BG-V98h0.js";
|
|
8
|
+
import { F as ae, G as te, H as oe, J as re } from "./ExportManager-BbBfO22S.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-C9LQt2J0.js";
|
|
11
11
|
function E() {
|
|
12
12
|
const { isCanvasReady: e } = m();
|
|
13
13
|
return e;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function f() {
|
|
16
16
|
const { zoom: e, panOffset: s, zoomIn: a, zoomOut: t, zoomToFit: o, resetView: r, setZoom: n, setPanOffset: i } = d();
|
|
17
17
|
return { zoom: e, panOffset: s, zoomIn: a, zoomOut: t, zoomToFit: o, resetView: r, setZoom: n, setPanOffset: i };
|
|
18
18
|
}
|
|
19
19
|
u();
|
|
20
20
|
export {
|
|
21
|
-
|
|
21
|
+
J as ALL_CAPABILITIES,
|
|
22
22
|
z as CANVAS_STATE_SCHEMA_VERSION,
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
q as COMPACT_CUSTOMIZER,
|
|
24
|
+
c as CanvasServicesProvider,
|
|
25
25
|
w as DesignBuilder,
|
|
26
26
|
Q as EMBED_ONLY,
|
|
27
|
-
|
|
27
|
+
y as ErrorBoundary,
|
|
28
28
|
W as MINIMAL_CAPABILITIES,
|
|
29
29
|
X as PRO_STUDIO,
|
|
30
30
|
L as SnowconeCanvas,
|
|
@@ -54,14 +54,14 @@ export {
|
|
|
54
54
|
T as useCommands,
|
|
55
55
|
R as useContentReady,
|
|
56
56
|
m as useEditor,
|
|
57
|
-
|
|
57
|
+
G as useElementByName,
|
|
58
58
|
B as useExport,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
H as useFontBinding,
|
|
60
|
+
U as useImageBinding,
|
|
61
|
+
F as useLayers,
|
|
62
|
+
Y as useSelectedElement,
|
|
63
|
+
Z as useTextBinding,
|
|
64
|
+
f as useViewport,
|
|
65
65
|
ee as validateKit,
|
|
66
66
|
Ee as validateState,
|
|
67
67
|
j as withTemplateFields
|
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 {
|
|
3
|
-
import { D as hr,
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { A as
|
|
7
|
-
const
|
|
8
|
-
function
|
|
9
|
-
const { brightness:
|
|
1
|
+
import { A as rr, a as or, C as sr, I as er, R as nr, S as tr, T as ir } from "./CanvasRenderer-D-E5WWLm.js";
|
|
2
|
+
import { r as k } from "./ExportManager-BbBfO22S.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 Mr, k as Tr, l as Cr, 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 } from "./ExportManager-BbBfO22S.js";
|
|
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 _r, e as Br, f as Kr, C as Ur, g as Yr, E as Jr, F as Vr, H as qr, L as Gr, h as Qr, W as Zr, j as $r, k as xr, l as Dr, m as ro, n as oo, o as so, s as eo, w as no } from "./FontAnalyzer-DWHS41ba.js";
|
|
6
|
+
import { A as io, a as ao, C as ho, S as co } from "./CanvasStateV1-C9LQt2J0.js";
|
|
7
|
+
const z = F("image-adjustments"), v = 1e-3;
|
|
8
|
+
function N(r, o) {
|
|
9
|
+
const { brightness: i, contrast: s, saturation: h } = o, e = i * s, n = 127.5 * (1 - s), f = Math.abs(e - 1) > v || Math.abs(n) > v, a = new Uint8ClampedArray(256);
|
|
10
10
|
if (f)
|
|
11
|
-
for (let
|
|
12
|
-
const c = Math.abs(h - 1) > v,
|
|
13
|
-
for (let
|
|
14
|
-
let
|
|
15
|
-
if (f && (
|
|
16
|
-
const W = d *
|
|
17
|
-
|
|
11
|
+
for (let l = 0; l < 256; l++) a[l] = l * e + n;
|
|
12
|
+
const c = Math.abs(h - 1) > v, t = h, d = 0.213 + 0.787 * t, g = 0.715 - 0.715 * t, S = 0.072 - 0.072 * t, b = 0.213 - 0.213 * t, P = 0.715 + 0.285 * t, I = 0.072 - 0.072 * t, m = 0.213 - 0.213 * t, A = 0.715 - 0.715 * t, R = 0.072 + 0.928 * t;
|
|
13
|
+
for (let l = 0; l < r.length; l += 4) {
|
|
14
|
+
let u = r[l], p = r[l + 1], y = r[l + 2];
|
|
15
|
+
if (f && (u = a[u], p = a[p], y = a[y]), c) {
|
|
16
|
+
const W = d * u + g * p + S * y, E = b * u + P * p + I * y, O = m * u + A * p + R * y;
|
|
17
|
+
u = W, p = E, y = O;
|
|
18
18
|
}
|
|
19
|
-
r[
|
|
19
|
+
r[l] = u, r[l + 1] = p, r[l + 2] = y;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
const
|
|
22
|
+
const M = /* @__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 i = document.createElement("canvas");
|
|
36
|
+
return i.width = r, i.height = o, i;
|
|
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 i = B(r), s = K(r);
|
|
42
|
+
if (i <= 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(i, 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
|
|
47
|
+
e.drawImage(r, 0, 0, i, s);
|
|
48
|
+
const n = e.getImageData(0, 0, i, s);
|
|
49
|
+
return N(n.data, o), e.putImageData(n, 0, 0), h;
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function C(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 i = j(o);
|
|
54
|
+
let s = M.get(r);
|
|
55
|
+
const h = s == null ? void 0 : s.get(i);
|
|
56
56
|
if (h)
|
|
57
|
-
return s.delete(
|
|
57
|
+
return s.delete(i), s.set(i, h), h;
|
|
58
58
|
let e;
|
|
59
59
|
try {
|
|
60
60
|
e = Y(r, o);
|
|
61
|
-
} catch (
|
|
62
|
-
|
|
61
|
+
} catch (n) {
|
|
62
|
+
z.error("adjustment pixel pass failed — rendering UNADJUSTED source:", n), e = r;
|
|
63
63
|
}
|
|
64
|
-
for (s || (s = /* @__PURE__ */ new Map(),
|
|
65
|
-
const
|
|
66
|
-
s.delete(
|
|
64
|
+
for (s || (s = /* @__PURE__ */ new Map(), M.set(r, s)), s.set(i, e); s.size > _; ) {
|
|
65
|
+
const n = s.keys().next().value;
|
|
66
|
+
s.delete(n);
|
|
67
67
|
}
|
|
68
68
|
return e;
|
|
69
69
|
}
|
|
70
|
-
L(
|
|
70
|
+
L(C);
|
|
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, i) {
|
|
82
|
+
var n, f;
|
|
83
|
+
const s = C(
|
|
84
|
+
i,
|
|
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 a = 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, t = -o.height / 2, d = o.width, g = o.height;
|
|
97
|
+
r.moveTo(c + a, t), r.lineTo(c + d - a, t), r.arcTo(c + d, t, c + d, t + a, a), r.lineTo(c + d, t + g - a), r.arcTo(c + d, t + g, c + d - a, t + g, a), r.lineTo(c + a, t + g), r.arcTo(c, t + g, c, t + g - a, a), r.lineTo(c, t + a), r.arcTo(c, t, c + a, t, a), 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 || i.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(), (n = o.stroke) != null && n.enabled) {
|
|
110
|
+
const a = ((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,71 +120,71 @@ function Z(r, o, a) {
|
|
|
120
120
|
borderRadius: o.borderRadius || 0
|
|
121
121
|
}
|
|
122
122
|
};
|
|
123
|
-
if (
|
|
124
|
-
const
|
|
123
|
+
if (a) {
|
|
124
|
+
const t = r.canvas;
|
|
125
125
|
let d;
|
|
126
126
|
if (typeof OffscreenCanvas < "u")
|
|
127
|
-
d = new OffscreenCanvas(
|
|
127
|
+
d = new OffscreenCanvas(t.width, t.height);
|
|
128
128
|
else if (typeof document < "u")
|
|
129
|
-
d = document.createElement("canvas"), d.width =
|
|
129
|
+
d = document.createElement("canvas"), d.width = t.width, d.height = t.height;
|
|
130
130
|
else {
|
|
131
|
-
|
|
131
|
+
k(r, c);
|
|
132
132
|
return;
|
|
133
133
|
}
|
|
134
|
-
const
|
|
135
|
-
if (!
|
|
136
|
-
|
|
134
|
+
const g = d.getContext("2d");
|
|
135
|
+
if (!g) {
|
|
136
|
+
k(r, c);
|
|
137
137
|
return;
|
|
138
138
|
}
|
|
139
|
-
|
|
139
|
+
k(g, c, { isKnockout: !0 }), r.save(), r.globalCompositeOperation = "destination-out", r.drawImage(d, 0, 0), r.restore();
|
|
140
140
|
} else
|
|
141
|
-
|
|
141
|
+
k(r, c);
|
|
142
142
|
}
|
|
143
143
|
}
|
|
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 i = document.createElement("canvas");
|
|
148
|
+
return i.width = r, i.height = o, i;
|
|
149
149
|
}
|
|
150
150
|
function $(r, o) {
|
|
151
151
|
var e;
|
|
152
|
-
const
|
|
153
|
-
|
|
152
|
+
const i = o.opacity ?? 1, s = !!((e = o.stroke) != null && e.enabled);
|
|
153
|
+
i < 1 && s ? V(r, o, i) : w(r, o, i);
|
|
154
154
|
}
|
|
155
|
-
function V(r, o,
|
|
155
|
+
function V(r, o, i) {
|
|
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, n = Math.ceil(s.width + e * 2), f = Math.ceil(s.height + e * 2), a = J(n, f), c = a.getContext("2d");
|
|
158
158
|
if (!c) {
|
|
159
|
-
|
|
159
|
+
w(r, o, i);
|
|
160
160
|
return;
|
|
161
161
|
}
|
|
162
|
-
const
|
|
162
|
+
const t = {
|
|
163
163
|
...o,
|
|
164
|
-
x:
|
|
164
|
+
x: n / 2,
|
|
165
165
|
y: f / 2
|
|
166
166
|
};
|
|
167
|
-
|
|
167
|
+
w(c, t, 1), r.save(), r.translate(o.x, o.y), o.rotation && r.rotate(-o.rotation * Math.PI / 180), r.globalAlpha = i, r.drawImage(a, -n / 2, -f / 2), r.restore();
|
|
168
168
|
}
|
|
169
|
-
function
|
|
169
|
+
function w(r, o, i) {
|
|
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 = i * h, r.fillStyle = X(r, s), r.beginPath(), T(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 n = o.stroke;
|
|
175
|
+
r.globalAlpha = i * (n.opacity ?? 1), r.strokeStyle = n.color || "#000000", r.lineWidth = n.width || 2, r.lineCap = n.lineCap || "round", r.lineJoin = n.lineJoin || "round", r.beginPath(), T(r, s), r.stroke(), r.restore();
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
|
-
function
|
|
179
|
-
const { shapeType:
|
|
180
|
-
switch (
|
|
178
|
+
function T(r, o) {
|
|
179
|
+
const { shapeType: i, width: s, height: h } = o;
|
|
180
|
+
switch (i) {
|
|
181
181
|
case "rectangle": {
|
|
182
|
-
const e = o.borderRadius || 0,
|
|
182
|
+
const e = o.borderRadius || 0, n = -s / 2, f = -h / 2;
|
|
183
183
|
if (e > 0) {
|
|
184
|
-
const
|
|
185
|
-
r.roundRect(
|
|
184
|
+
const a = Math.min(e / 100 * Math.min(s, h), s / 2, h / 2);
|
|
185
|
+
r.roundRect(n, f, s, h, a);
|
|
186
186
|
} else
|
|
187
|
-
r.rect(
|
|
187
|
+
r.rect(n, f, s, h);
|
|
188
188
|
break;
|
|
189
189
|
}
|
|
190
190
|
case "circle": {
|
|
@@ -197,31 +197,31 @@ function w(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, n = h / 2;
|
|
201
|
+
r.moveTo(0, -n), r.lineTo(e, n), r.lineTo(-e, n), r.closePath();
|
|
202
202
|
break;
|
|
203
203
|
}
|
|
204
204
|
case "polygon": {
|
|
205
|
-
const e = o.sides || 5,
|
|
205
|
+
const e = o.sides || 5, n = Math.min(s, h) / 2;
|
|
206
206
|
for (let f = 0; f < e; f++) {
|
|
207
|
-
const
|
|
208
|
-
f === 0 ? r.moveTo(c,
|
|
207
|
+
const a = f * 2 * Math.PI / e - Math.PI / 2, c = n * Math.cos(a), t = n * Math.sin(a);
|
|
208
|
+
f === 0 ? r.moveTo(c, t) : r.lineTo(c, t);
|
|
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, n = Math.min(s, h) / 2, f = n * (o.innerRadius || 0.4);
|
|
215
|
+
for (let a = 0; a < e * 2; a++) {
|
|
216
|
+
const c = a * Math.PI / e - Math.PI / 2, t = a % 2 === 0 ? n : f, d = t * Math.cos(c), g = t * Math.sin(c);
|
|
217
|
+
a === 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, n = h / 2;
|
|
224
|
+
r.rect(-e, -n, s, h);
|
|
225
225
|
break;
|
|
226
226
|
}
|
|
227
227
|
default:
|
|
@@ -230,9 +230,9 @@ function w(r, o) {
|
|
|
230
230
|
}
|
|
231
231
|
export {
|
|
232
232
|
rr as AlignmentSnapSystem,
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
233
|
+
io as AnyElementConfigSchema,
|
|
234
|
+
ao as AnyTransformDataSchema,
|
|
235
|
+
_r as ArchTransform,
|
|
236
236
|
Br as ArtboardManager,
|
|
237
237
|
or as ArtboardRenderer,
|
|
238
238
|
Kr as AscendTransform,
|
|
@@ -249,37 +249,37 @@ export {
|
|
|
249
249
|
er as InteractionStateMachine,
|
|
250
250
|
Gr as LeanTransform,
|
|
251
251
|
Qr as LogLevel,
|
|
252
|
-
|
|
252
|
+
nr as ResizePipeline,
|
|
253
253
|
co as SerializedArtboardSchema,
|
|
254
|
-
|
|
255
|
-
|
|
254
|
+
tr as SpacingSystem,
|
|
255
|
+
ir as TransformHandles,
|
|
256
256
|
Zr as WaveTransform,
|
|
257
257
|
fr as WorkerExportManager,
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
258
|
+
gr as applySpaceLayoutRules,
|
|
259
|
+
lr as applyStrokeStyle,
|
|
260
|
+
ur as buildFontString,
|
|
261
261
|
$r as calculateFixedCornerPosition,
|
|
262
262
|
xr as calculateResizeHandles,
|
|
263
263
|
Dr 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
|
-
|
|
273
|
-
|
|
270
|
+
Mr as createRectPath,
|
|
271
|
+
Tr as createTextPath,
|
|
272
|
+
Cr as getFontMetrics,
|
|
273
|
+
Sr as getSharedWorkerExportManager,
|
|
274
274
|
ro as hitTestCircle,
|
|
275
275
|
oo as hitTestRect,
|
|
276
|
-
|
|
276
|
+
br as invalidateMaskCache,
|
|
277
277
|
so as logger,
|
|
278
278
|
Pr as measureTextWidth,
|
|
279
279
|
Ir as removeFromImageBitmapCache,
|
|
280
280
|
mr as renderCustomTransform,
|
|
281
281
|
Z as renderImageElement,
|
|
282
|
-
|
|
282
|
+
k as renderImageStroke,
|
|
283
283
|
Ar as renderMultilineText,
|
|
284
284
|
Rr as renderPathStroke,
|
|
285
285
|
Wr as renderRichTextFillOnly,
|
|
@@ -293,7 +293,7 @@ export {
|
|
|
293
293
|
eo as splitRichTextIntoLines,
|
|
294
294
|
Lr as terminateSharedWorkerExportManager,
|
|
295
295
|
Xr as unregisterElementBitmaps,
|
|
296
|
-
|
|
297
|
-
|
|
296
|
+
no as wrapRichTextSpans,
|
|
297
|
+
zr as wrapText
|
|
298
298
|
};
|
|
299
299
|
//# sourceMappingURL=internals.mjs.map
|