@snowcone-app/canvas 0.31.0 → 0.33.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 +11 -0
- package/STYLING_CONTRACT.md +5 -3
- package/dist/{CanvasRenderer-hpJ05JGO.js → CanvasRenderer-1j-twIbs.js} +443 -431
- package/dist/{CanvasRenderer-hpJ05JGO.js.map → CanvasRenderer-1j-twIbs.js.map} +1 -1
- package/dist/{CanvasStateV1-jLOibojY.js → CanvasStateV1-BmC1JfPv.js} +810 -802
- package/dist/{CanvasStateV1-jLOibojY.js.map → CanvasStateV1-BmC1JfPv.js.map} +1 -1
- package/dist/ContextualToolbars-CLDFENZq.js +6532 -0
- package/dist/ContextualToolbars-CLDFENZq.js.map +1 -0
- package/dist/{EditorCanvasImpl-P2GHPNA3.js → EditorCanvasImpl-XP_t-tNl.js} +7 -7
- package/dist/{EditorCanvasImpl-P2GHPNA3.js.map → EditorCanvasImpl-XP_t-tNl.js.map} +1 -1
- package/dist/{ExportManager-Bkzzyxgw.js → ExportManager-Ci81K6xA.js} +662 -518
- package/dist/ExportManager-Ci81K6xA.js.map +1 -0
- package/dist/{FontAnalyzer-BYhwxDhe.js → FontAnalyzer-BrKY6XYn.js} +1256 -1146
- package/dist/FontAnalyzer-BrKY6XYn.js.map +1 -0
- package/dist/{ImagePanel-CEr0_FYy.js → ImagePanel-ntJBepby.js} +6 -6
- package/dist/{ImagePanel-CEr0_FYy.js.map → ImagePanel-ntJBepby.js.map} +1 -1
- package/dist/{SnowconeCanvas-Fa0isFpO.js → SnowconeCanvas-wMLBZJ9z.js} +10 -10
- package/dist/{SnowconeCanvas-Fa0isFpO.js.map → SnowconeCanvas-wMLBZJ9z.js.map} +1 -1
- package/dist/advanced.mjs +14 -14
- package/dist/components/ImageToolbar.d.ts +8 -0
- package/dist/components/ShapeToolbar.d.ts +8 -0
- package/dist/components/TextToolbar.d.ts +5 -1
- package/dist/components/toolbars/EmbeddedToolbarLayout.d.ts +6 -0
- package/dist/components/toolbars/FloatingPanels.d.ts +10 -0
- package/dist/components/toolbars/GroupElementToolbar.d.ts +8 -0
- package/dist/components/toolbars/SecondaryPanels.d.ts +37 -1
- package/dist/components/toolbars/alignButtons.d.ts +13 -0
- package/dist/components/toolbars/index.d.ts +5 -3
- package/dist/core/BaseElement.d.ts +2 -1
- package/dist/core/shape-fill.d.ts +31 -0
- package/dist/{custom-icons-Co4rcW0S.js → custom-icons-DTWtkJ9N.js} +2 -2
- package/dist/{custom-icons-Co4rcW0S.js.map → custom-icons-DTWtkJ9N.js.map} +1 -1
- package/dist/{design-builder-CBG2hKc8.js → design-builder-BpbYUYtK.js} +55 -55
- package/dist/{design-builder-CBG2hKc8.js.map → design-builder-BpbYUYtK.js.map} +1 -1
- package/dist/{embed-D4TIzO7g.js → embed-VTcnrkRj.js} +10 -10
- package/dist/{embed-D4TIzO7g.js.map → embed-VTcnrkRj.js.map} +1 -1
- package/dist/embed.mjs +7 -7
- package/dist/errors/editorError.d.ts +7 -0
- package/dist/{guards-DgZuwVgu.js → guards-BhaQgJrE.js} +2 -2
- package/dist/{guards-DgZuwVgu.js.map → guards-BhaQgJrE.js.map} +1 -1
- package/dist/hooks/elementPatch.d.ts +8 -3
- package/dist/index.mjs +9 -9
- package/dist/internals.mjs +123 -123
- package/dist/internals.mjs.map +1 -1
- package/dist/rendering/LayerEffectsRenderer.d.ts +24 -0
- package/dist/rendering/renderer-types.d.ts +3 -1
- package/dist/state/CanvasStateV1.d.ts +17 -0
- package/dist/style.css +1 -1
- package/dist/{template-fields-CvFcr5zy.js → template-fields-D-2oLhCi.js} +5 -5
- package/dist/{template-fields-CvFcr5zy.js.map → template-fields-D-2oLhCi.js.map} +1 -1
- package/dist/testing.mjs +3 -3
- package/dist/types/index.d.ts +84 -1
- package/dist/types/public.d.ts +3 -2
- package/dist/{useCommands-bPXY9rCh.js → useCommands-DwnZHUg8.js} +435 -418
- package/dist/useCommands-DwnZHUg8.js.map +1 -0
- package/dist/{usePieceGuideBundle-Bj98nPk0.js → usePieceGuideBundle-CnSmYrmM.js} +2 -2
- package/dist/{usePieceGuideBundle-Bj98nPk0.js.map → usePieceGuideBundle-CnSmYrmM.js.map} +1 -1
- package/dist/utils/featureApplied.d.ts +4 -0
- package/dist/{validation-CsTlSvJJ.js → validation-CSa86fDE.js} +11 -11
- package/dist/{validation-CsTlSvJJ.js.map → validation-CSa86fDE.js.map} +1 -1
- package/dist/workers/export-worker.bundle.string.d.ts +1 -1
- package/example/package.json +1 -1
- package/package.json +1 -1
- package/dist/ContextualToolbars-DRbuUE7W.js +0 -6061
- package/dist/ContextualToolbars-DRbuUE7W.js.map +0 -1
- package/dist/ExportManager-Bkzzyxgw.js.map +0 -1
- package/dist/FontAnalyzer-BYhwxDhe.js.map +0 -1
- package/dist/useCommands-bPXY9rCh.js.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as k } from "react/jsx-runtime";
|
|
2
|
-
import { useContext as
|
|
3
|
-
import {
|
|
2
|
+
import { useContext as Y, useSyncExternalStore as pe, useCallback as m, createContext as Q, useRef as pt, useState as b, useEffect as Dt, useMemo as q } from "react";
|
|
3
|
+
import { a0 as Ae, E as ot, U as ye, aq as ge, G as jt, ar as xe, as as be, at as we, au as Ee, av as Se, c as Zt, C as Re, aw as Ce, ax as Ie, ay as Te, W as Oe, _ as Wt, I as ve, g as Fe, S as Pe, az as Ne, aA as Mt, y as ze, D as He, M as ke } from "./FontAnalyzer-BrKY6XYn.js";
|
|
4
4
|
const Jt = Q(null), Ue = () => () => {
|
|
5
|
-
},
|
|
5
|
+
}, Yt = () => 0;
|
|
6
6
|
function go() {
|
|
7
|
-
const e =
|
|
7
|
+
const e = Y(Jt), t = pe(
|
|
8
8
|
e ? e.subscribe : Ue,
|
|
9
|
-
e ? e.getVersion :
|
|
10
|
-
e ? e.getVersion :
|
|
9
|
+
e ? e.getVersion : Yt,
|
|
10
|
+
e ? e.getVersion : Yt
|
|
11
11
|
);
|
|
12
12
|
return m(
|
|
13
13
|
(o) => !!(e && o && e.getBoundLayer(o)),
|
|
@@ -18,7 +18,7 @@ function go() {
|
|
|
18
18
|
}
|
|
19
19
|
const gt = Zt("useCommandHistory");
|
|
20
20
|
function Ve(e, t, o, n) {
|
|
21
|
-
const i = pt(new Ae(o)), s =
|
|
21
|
+
const i = pt(new Ae(o)), s = Y(Jt), c = m(
|
|
22
22
|
(l, f) => {
|
|
23
23
|
const g = l == null ? void 0 : l.name;
|
|
24
24
|
if (!s || !g) return;
|
|
@@ -92,14 +92,14 @@ function Ve(e, t, o, n) {
|
|
|
92
92
|
return O.splice(H + 1, 0, U), O;
|
|
93
93
|
}
|
|
94
94
|
for (let O = 0; O < N.length; O++) {
|
|
95
|
-
const
|
|
96
|
-
if (
|
|
97
|
-
const rt =
|
|
95
|
+
const X = N[O];
|
|
96
|
+
if (X instanceof jt && X.children) {
|
|
97
|
+
const rt = X.children.findIndex((G) => G.id === g);
|
|
98
98
|
if (rt !== -1) {
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
return
|
|
99
|
+
const G = X.clone();
|
|
100
|
+
G.children.splice(rt + 1, 0, U);
|
|
101
|
+
const K = [...N];
|
|
102
|
+
return K[O] = G, K;
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
}
|
|
@@ -357,12 +357,12 @@ function Qt(e) {
|
|
|
357
357
|
else if (n.length === 6)
|
|
358
358
|
i = parseInt(n.slice(0, 2), 16), s = parseInt(n.slice(2, 4), 16), c = parseInt(n.slice(4, 6), 16);
|
|
359
359
|
else return null;
|
|
360
|
-
return Number.isNaN(i) || Number.isNaN(s) || Number.isNaN(c) ? null :
|
|
360
|
+
return Number.isNaN(i) || Number.isNaN(s) || Number.isNaN(c) ? null : Xt(i, s, c);
|
|
361
361
|
}
|
|
362
362
|
const o = t.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);
|
|
363
|
-
return o ?
|
|
363
|
+
return o ? Xt(Number(o[1]), Number(o[2]), Number(o[3])) : null;
|
|
364
364
|
}
|
|
365
|
-
function
|
|
365
|
+
function Xt(e, t, o) {
|
|
366
366
|
const n = (i) => {
|
|
367
367
|
const s = i / 255;
|
|
368
368
|
return s <= 0.03928 ? s / 12.92 : Math.pow((s + 0.055) / 1.055, 2.4);
|
|
@@ -373,7 +373,7 @@ const $e = "#333333", Be = "#f4f4f5";
|
|
|
373
373
|
function We(e) {
|
|
374
374
|
return e && Le(e) ? Be : $e;
|
|
375
375
|
}
|
|
376
|
-
const te = Q(null), Me = 0.1,
|
|
376
|
+
const te = Q(null), Me = 0.1, Ye = 4, Gt = 0.25, Xe = ({
|
|
377
377
|
children: e,
|
|
378
378
|
artboardManager: t,
|
|
379
379
|
canvasRef: o,
|
|
@@ -382,9 +382,9 @@ const te = Q(null), Me = 0.1, Xe = 4, Kt = 0.25, Ye = ({
|
|
|
382
382
|
const [i, s] = b(1), [c, r] = b({ x: 0, y: 0 }), [d, a] = b(!1), [z, F] = b(1), V = m(() => {
|
|
383
383
|
F(1), r({ x: 0, y: 0 });
|
|
384
384
|
}, []), E = m(() => {
|
|
385
|
-
s((v) => Math.min(v +
|
|
385
|
+
s((v) => Math.min(v + Gt, Ye));
|
|
386
386
|
}, []), D = m(() => {
|
|
387
|
-
s((v) => Math.max(v -
|
|
387
|
+
s((v) => Math.max(v - Gt, Me));
|
|
388
388
|
}, []), p = m(() => {
|
|
389
389
|
const v = t.getActiveArtboard();
|
|
390
390
|
if (!v || !o.current) return;
|
|
@@ -421,13 +421,13 @@ const te = Q(null), Me = 0.1, Xe = 4, Kt = 0.25, Ye = ({
|
|
|
421
421
|
);
|
|
422
422
|
return /* @__PURE__ */ k(te.Provider, { value: S, children: e });
|
|
423
423
|
};
|
|
424
|
-
function
|
|
425
|
-
const e =
|
|
424
|
+
function Ge() {
|
|
425
|
+
const e = Y(te);
|
|
426
426
|
if (!e)
|
|
427
427
|
throw new Error("useViewportContext must be used within a ViewportProvider (or EditorProvider)");
|
|
428
428
|
return e;
|
|
429
429
|
}
|
|
430
|
-
const ee = Q(null),
|
|
430
|
+
const ee = Q(null), Ke = ({ children: e }) => {
|
|
431
431
|
const [t, o] = b(null), [n, i] = b([]), [s, c] = b(null), [r, d] = b(null), [a, z] = b(!1), F = m((D) => {
|
|
432
432
|
o(D);
|
|
433
433
|
}, []), V = m((D) => {
|
|
@@ -459,7 +459,7 @@ const ee = Q(null), Ge = ({ children: e }) => {
|
|
|
459
459
|
return /* @__PURE__ */ k(ee.Provider, { value: E, children: e });
|
|
460
460
|
};
|
|
461
461
|
function je() {
|
|
462
|
-
const e =
|
|
462
|
+
const e = Y(ee);
|
|
463
463
|
if (!e)
|
|
464
464
|
throw new Error("useSelectionContext must be used within a SelectionProvider (or EditorProvider)");
|
|
465
465
|
return e;
|
|
@@ -490,7 +490,7 @@ const oe = Q(null), Ze = ({ children: e, value: t }) => {
|
|
|
490
490
|
return /* @__PURE__ */ k(oe.Provider, { value: o, children: e });
|
|
491
491
|
};
|
|
492
492
|
function wo() {
|
|
493
|
-
const e =
|
|
493
|
+
const e = Y(oe);
|
|
494
494
|
if (!e)
|
|
495
495
|
throw new Error("useHistoryContext must be used within a HistoryProvider (or EditorProvider)");
|
|
496
496
|
return e;
|
|
@@ -514,7 +514,7 @@ const ne = Q(null), Je = ({ children: e }) => {
|
|
|
514
514
|
return /* @__PURE__ */ k(ne.Provider, { value: F, children: e });
|
|
515
515
|
};
|
|
516
516
|
function qe() {
|
|
517
|
-
const e =
|
|
517
|
+
const e = Y(ne);
|
|
518
518
|
if (!e)
|
|
519
519
|
throw new Error("useToolStateContext must be used within a ToolStateProvider (or EditorProvider)");
|
|
520
520
|
return e;
|
|
@@ -577,7 +577,7 @@ const re = Q(null), Qe = ({ children: e, value: t }) => {
|
|
|
577
577
|
return /* @__PURE__ */ k(re.Provider, { value: o, children: e });
|
|
578
578
|
};
|
|
579
579
|
function Eo() {
|
|
580
|
-
const e =
|
|
580
|
+
const e = Y(re);
|
|
581
581
|
if (!e)
|
|
582
582
|
throw new Error("useElementsContext must be used within an ElementsProvider (or EditorProvider)");
|
|
583
583
|
return e;
|
|
@@ -626,18 +626,18 @@ const ie = Q(null), to = ({ children: e, value: t }) => {
|
|
|
626
626
|
return /* @__PURE__ */ k(ie.Provider, { value: o, children: e });
|
|
627
627
|
};
|
|
628
628
|
function So() {
|
|
629
|
-
const e =
|
|
629
|
+
const e = Y(ie);
|
|
630
630
|
if (!e)
|
|
631
631
|
throw new Error("useCommandContext must be used within a CommandProvider (or EditorProvider)");
|
|
632
632
|
return e;
|
|
633
633
|
}
|
|
634
634
|
const eo = Zt("EditorContext"), se = Q(null), ce = Q(null), Ro = () => {
|
|
635
|
-
const e =
|
|
635
|
+
const e = Y(ce);
|
|
636
636
|
if (!e)
|
|
637
637
|
throw new Error("useEditorHandles must be used within EditorProvider");
|
|
638
638
|
return e;
|
|
639
639
|
}, oo = ({ children: e, artboardManager: t, canvasRef: o, canvasEditorRef: n }) => {
|
|
640
|
-
const i = pt(null), s = q(() => ({ get: () => i.current }), []), c =
|
|
640
|
+
const i = pt(null), s = q(() => ({ get: () => i.current }), []), c = Ge(), r = je(), d = qe(), [a, z] = b(
|
|
641
641
|
() => t.getAllArtboards()
|
|
642
642
|
), [F, V] = b(0), [E, D] = b(
|
|
643
643
|
() => new Wt()
|
|
@@ -666,15 +666,15 @@ const eo = Zt("EditorContext"), se = Q(null), ce = Q(null), Ro = () => {
|
|
|
666
666
|
canUndo: N,
|
|
667
667
|
canRedo: H,
|
|
668
668
|
undoActiveArtboard: O,
|
|
669
|
-
redoActiveArtboard:
|
|
669
|
+
redoActiveArtboard: X,
|
|
670
670
|
canUndoActiveArtboard: rt,
|
|
671
|
-
canRedoActiveArtboard:
|
|
671
|
+
canRedoActiveArtboard: G
|
|
672
672
|
} = Ve(
|
|
673
673
|
p,
|
|
674
674
|
h,
|
|
675
675
|
t,
|
|
676
676
|
L
|
|
677
|
-
),
|
|
677
|
+
), K = m(
|
|
678
678
|
(u) => {
|
|
679
679
|
const A = E.get(u.id);
|
|
680
680
|
_(A, u);
|
|
@@ -687,10 +687,10 @@ const eo = Zt("EditorContext"), se = Q(null), ce = Q(null), Ro = () => {
|
|
|
687
687
|
const A = w.clone(), x = A.children.findIndex(
|
|
688
688
|
(I) => I.id === u.id
|
|
689
689
|
);
|
|
690
|
-
x >= 0 && (A.children[x] = u,
|
|
690
|
+
x >= 0 && (A.children[x] = u, K(A));
|
|
691
691
|
},
|
|
692
|
-
[w,
|
|
693
|
-
), me = r.activeChildElement || w, he = r.activeChildElement ? ue :
|
|
692
|
+
[w, K]
|
|
693
|
+
), me = r.activeChildElement || w, he = r.activeChildElement ? ue : K, {
|
|
694
694
|
fontSize: bt,
|
|
695
695
|
fontColor: wt,
|
|
696
696
|
fontFamily: Et,
|
|
@@ -932,7 +932,7 @@ const eo = Zt("EditorContext"), se = Q(null), ce = Q(null), Ro = () => {
|
|
|
932
932
|
artboardVersion: F,
|
|
933
933
|
// Handlers
|
|
934
934
|
refreshArtboards: L,
|
|
935
|
-
handleElementUpdate:
|
|
935
|
+
handleElementUpdate: K,
|
|
936
936
|
addElement: At,
|
|
937
937
|
handleAddElement: vt,
|
|
938
938
|
handleLoadWorkspace: Nt,
|
|
@@ -954,9 +954,9 @@ const eo = Zt("EditorContext"), se = Q(null), ce = Q(null), Ro = () => {
|
|
|
954
954
|
canUndo: N,
|
|
955
955
|
canRedo: H,
|
|
956
956
|
undoActiveArtboard: O,
|
|
957
|
-
redoActiveArtboard:
|
|
957
|
+
redoActiveArtboard: X,
|
|
958
958
|
canUndoActiveArtboard: rt,
|
|
959
|
-
canRedoActiveArtboard:
|
|
959
|
+
canRedoActiveArtboard: G,
|
|
960
960
|
// Element properties
|
|
961
961
|
fontSize: bt,
|
|
962
962
|
fontColor: wt,
|
|
@@ -1015,7 +1015,7 @@ const eo = Zt("EditorContext"), se = Q(null), ce = Q(null), Ro = () => {
|
|
|
1015
1015
|
h,
|
|
1016
1016
|
F,
|
|
1017
1017
|
L,
|
|
1018
|
-
|
|
1018
|
+
K,
|
|
1019
1019
|
At,
|
|
1020
1020
|
vt,
|
|
1021
1021
|
Nt,
|
|
@@ -1037,9 +1037,9 @@ const eo = Zt("EditorContext"), se = Q(null), ce = Q(null), Ro = () => {
|
|
|
1037
1037
|
N,
|
|
1038
1038
|
H,
|
|
1039
1039
|
O,
|
|
1040
|
-
|
|
1040
|
+
X,
|
|
1041
1041
|
rt,
|
|
1042
|
-
|
|
1042
|
+
G,
|
|
1043
1043
|
// Element properties
|
|
1044
1044
|
bt,
|
|
1045
1045
|
wt,
|
|
@@ -1060,9 +1060,9 @@ const eo = Zt("EditorContext"), se = Q(null), ce = Q(null), Ro = () => {
|
|
|
1060
1060
|
canUndo: N,
|
|
1061
1061
|
canRedo: H,
|
|
1062
1062
|
undoActiveArtboard: O,
|
|
1063
|
-
redoActiveArtboard:
|
|
1063
|
+
redoActiveArtboard: X,
|
|
1064
1064
|
canUndoActiveArtboard: rt,
|
|
1065
|
-
canRedoActiveArtboard:
|
|
1065
|
+
canRedoActiveArtboard: G
|
|
1066
1066
|
},
|
|
1067
1067
|
children: /* @__PURE__ */ k(
|
|
1068
1068
|
Qe,
|
|
@@ -1077,7 +1077,7 @@ const eo = Zt("EditorContext"), se = Q(null), ce = Q(null), Ro = () => {
|
|
|
1077
1077
|
refreshArtboards: L,
|
|
1078
1078
|
getElementById: S,
|
|
1079
1079
|
handleAddElement: vt,
|
|
1080
|
-
handleElementUpdate:
|
|
1080
|
+
handleElementUpdate: K,
|
|
1081
1081
|
handleLoadWorkspace: Nt,
|
|
1082
1082
|
handleCopyElements: Ft,
|
|
1083
1083
|
handlePasteElements: Pt,
|
|
@@ -1110,9 +1110,9 @@ const eo = Zt("EditorContext"), se = Q(null), ce = Q(null), Ro = () => {
|
|
|
1110
1110
|
canUndo: N,
|
|
1111
1111
|
canRedo: H,
|
|
1112
1112
|
undoActiveArtboard: O,
|
|
1113
|
-
redoActiveArtboard:
|
|
1113
|
+
redoActiveArtboard: X,
|
|
1114
1114
|
canUndoActiveArtboard: rt,
|
|
1115
|
-
canRedoActiveArtboard:
|
|
1115
|
+
canRedoActiveArtboard: G,
|
|
1116
1116
|
historyManager: nt
|
|
1117
1117
|
},
|
|
1118
1118
|
children: /* @__PURE__ */ k(se.Provider, { value: _t, children: e })
|
|
@@ -1139,12 +1139,12 @@ const eo = Zt("EditorContext"), se = Q(null), ce = Q(null), Ro = () => {
|
|
|
1139
1139
|
return c.createArtboard(r), c;
|
|
1140
1140
|
}), i = pt(null), s = pt(null);
|
|
1141
1141
|
return /* @__PURE__ */ k(
|
|
1142
|
-
|
|
1142
|
+
Xe,
|
|
1143
1143
|
{
|
|
1144
1144
|
artboardManager: n,
|
|
1145
1145
|
canvasRef: i,
|
|
1146
1146
|
viewPadding: o,
|
|
1147
|
-
children: /* @__PURE__ */ k(
|
|
1147
|
+
children: /* @__PURE__ */ k(Ke, { children: /* @__PURE__ */ k(Je, { children: /* @__PURE__ */ k(
|
|
1148
1148
|
oo,
|
|
1149
1149
|
{
|
|
1150
1150
|
artboardManager: n,
|
|
@@ -1156,7 +1156,7 @@ const eo = Zt("EditorContext"), se = Q(null), ce = Q(null), Ro = () => {
|
|
|
1156
1156
|
}
|
|
1157
1157
|
);
|
|
1158
1158
|
}, Io = () => {
|
|
1159
|
-
const e =
|
|
1159
|
+
const e = Y(se);
|
|
1160
1160
|
if (!e)
|
|
1161
1161
|
throw new Error("useEditor must be used within EditorProvider");
|
|
1162
1162
|
return e;
|
|
@@ -1248,7 +1248,7 @@ function so(e) {
|
|
|
1248
1248
|
};
|
|
1249
1249
|
return !o && (t.cropX !== 0 || t.cropY !== 0 || t.cropWidth !== 1 || t.cropHeight !== 1) && (r.cropX = t.cropX, r.cropY = t.cropY, r.cropWidth = t.cropWidth, r.cropHeight = t.cropHeight, r.needsCropPixelConversion = !0), t.flipHorizontal && (r.flipHorizontal = t.flipHorizontal), t.flipVertical && (r.flipVertical = t.flipVertical), t.borderRadius && (r.borderRadius = t.borderRadius), ke(t.adjustments) || (r.adjustments = { ...t.adjustments }), e.opacity !== void 0 && (r.opacity = e.opacity), e.distressEffect && (r.distressEffect = e.distressEffect), ((a = e.masks) == null ? void 0 : a.length) > 0 && (r.masks = e.masks), e.blendMode && (r.blendMode = e.blendMode), e.knockoutParts && (r.knockoutParts = e.knockoutParts), e.stroke && (r.stroke = e.stroke), ae(r);
|
|
1250
1250
|
}
|
|
1251
|
-
const
|
|
1251
|
+
const Kt = "center", de = Symbol.for("snowcone.canvas.layerToken");
|
|
1252
1252
|
function Po(e) {
|
|
1253
1253
|
return typeof e == "object" && e !== null && e[de] === !0 && typeof e.name == "string" && (e.kind === "text" || e.kind === "image");
|
|
1254
1254
|
}
|
|
@@ -1474,7 +1474,7 @@ class lt {
|
|
|
1474
1474
|
return this.els.unshift(c), this;
|
|
1475
1475
|
}
|
|
1476
1476
|
image(t, o = {}) {
|
|
1477
|
-
const { width: n, height: i } = this.current, s = o.width ?? Math.round(n / 3), c = o.height ?? (o.aspectRatio ? Math.round(s / o.aspectRatio) : s), { x: r, y: d } = Ut(o.anchor ??
|
|
1477
|
+
const { width: n, height: i } = this.current, s = o.width ?? Math.round(n / 3), c = o.height ?? (o.aspectRatio ? Math.round(s / o.aspectRatio) : s), { x: r, y: d } = Ut(o.anchor ?? Kt, s, c, n, i, o.padding ?? 0), a = {
|
|
1478
1478
|
id: this.nextId("img"),
|
|
1479
1479
|
transformType: "image",
|
|
1480
1480
|
x: r,
|
|
@@ -1579,7 +1579,7 @@ class lt {
|
|
|
1579
1579
|
}
|
|
1580
1580
|
/** An anchored vector shape. */
|
|
1581
1581
|
shape(t, o = {}) {
|
|
1582
|
-
const { width: n, height: i } = this.current, s = o.size ?? Math.round(n / 6), c = typeof s == "number" ? s : s.width, r = typeof s == "number" ? s : s.height, { x: d, y: a } = Ut(o.anchor ??
|
|
1582
|
+
const { width: n, height: i } = this.current, s = o.size ?? Math.round(n / 6), c = typeof s == "number" ? s : s.width, r = typeof s == "number" ? s : s.height, { x: d, y: a } = Ut(o.anchor ?? Kt, c, r, n, i, o.padding ?? 0), z = {
|
|
1583
1583
|
type: "shape",
|
|
1584
1584
|
shapeType: t,
|
|
1585
1585
|
width: c,
|
|
@@ -1646,7 +1646,7 @@ export {
|
|
|
1646
1646
|
lt as D,
|
|
1647
1647
|
Co as E,
|
|
1648
1648
|
qt as P,
|
|
1649
|
-
|
|
1649
|
+
Ge as a,
|
|
1650
1650
|
_e as b,
|
|
1651
1651
|
So as c,
|
|
1652
1652
|
No as d,
|
|
@@ -1669,4 +1669,4 @@ export {
|
|
|
1669
1669
|
Io as u,
|
|
1670
1670
|
bo as v
|
|
1671
1671
|
};
|
|
1672
|
-
//# sourceMappingURL=design-builder-
|
|
1672
|
+
//# sourceMappingURL=design-builder-BpbYUYtK.js.map
|