@snowcone-app/canvas 0.37.1 → 0.39.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-COO5UXtZ.js} +704 -669
- package/dist/CanvasRenderer-COO5UXtZ.js.map +1 -0
- package/dist/{CanvasStateV1-DLE5d1-d.js → CanvasStateV1-CJJff7Ci.js} +319 -318
- package/dist/{CanvasStateV1-DLE5d1-d.js.map → CanvasStateV1-CJJff7Ci.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-C_72UKu3.js +144 -0
- package/dist/EditorCanvasImpl-C_72UKu3.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-C-YbGCcQ.js +1112 -0
- package/dist/SnowconeCanvas-C-YbGCcQ.js.map +1 -0
- package/dist/advanced.mjs +427 -429
- package/dist/advanced.mjs.map +1 -1
- package/dist/api/placement.d.ts +3 -0
- package/dist/components/VisualGuideOverlay.d.ts +4 -1
- 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 +3 -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-DtlgX9iG.js} +843 -729
- package/dist/embed-DtlgX9iG.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/rendering/PieceGuideRenderer.d.ts +4 -1
- package/dist/state/CanvasStateV1.d.ts +3 -3
- package/dist/template-fields-Dltc4Ztb.js +556 -0
- package/dist/template-fields-Dltc4Ztb.js.map +1 -0
- package/dist/testing.mjs +24 -24
- package/dist/types/index.d.ts +2 -1
- 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-Cab2gRnn.js +68 -0
- package/dist/usePieceGuideBundle-Cab2gRnn.js.map +1 -0
- package/dist/utils/pieceRotation.d.ts +35 -0
- package/dist/{validation-THw5W6N_.js → validation-Dh9sVEb9.js} +1182 -1184
- package/dist/validation-Dh9sVEb9.js.map +1 -0
- package/example/package.json +1 -1
- package/package.json +7 -2
- package/dist/CanvasRenderer-CTN4j-uO.js.map +0 -1
- 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
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as k } from "react/jsx-runtime";
|
|
2
|
-
import { useContext as
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
5
|
-
},
|
|
2
|
+
import { useContext as X, 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 { H as Ae, t as ot, U as ye, y as ge, G as jt, R as xe, z as be, D as we, B as Ee, J as Se, c as Jt, x as Re, M as Ce, K as Ie, N as Te, e as Oe, E as Wt, I as Fe, q as ve, S as Pe, O as Ne, Q as Mt, V as ze, X as He, i as ke } from "./FontAnalyzer-DWHS41ba.js";
|
|
4
|
+
const Zt = Q(null), Ue = () => () => {
|
|
5
|
+
}, Xt = () => 0;
|
|
6
6
|
function go() {
|
|
7
|
-
const e =
|
|
7
|
+
const e = X(Zt), t = pe(
|
|
8
8
|
e ? e.subscribe : Ue,
|
|
9
|
-
e ? e.getVersion :
|
|
10
|
-
e ? e.getVersion :
|
|
9
|
+
e ? e.getVersion : Xt,
|
|
10
|
+
e ? e.getVersion : Xt
|
|
11
11
|
);
|
|
12
12
|
return m(
|
|
13
13
|
(o) => !!(e && o && e.getBoundLayer(o)),
|
|
@@ -16,9 +16,9 @@ function go() {
|
|
|
16
16
|
[e, t]
|
|
17
17
|
);
|
|
18
18
|
}
|
|
19
|
-
const gt =
|
|
19
|
+
const gt = Jt("useCommandHistory");
|
|
20
20
|
function Ve(e, t, o, n) {
|
|
21
|
-
const s = pt(new Ae(o)), i =
|
|
21
|
+
const s = pt(new Ae(o)), i = X(Zt), c = m(
|
|
22
22
|
(l, f) => {
|
|
23
23
|
const g = l == null ? void 0 : l.name;
|
|
24
24
|
if (!i || !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 Y = N[O];
|
|
96
|
+
if (Y instanceof jt && Y.children) {
|
|
97
|
+
const rt = Y.children.findIndex((K) => K.id === g);
|
|
98
98
|
if (rt !== -1) {
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
return
|
|
99
|
+
const K = Y.clone();
|
|
100
|
+
K.children.splice(rt + 1, 0, U);
|
|
101
|
+
const G = [...N];
|
|
102
|
+
return G[O] = K, G;
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
}
|
|
@@ -357,12 +357,12 @@ function Qt(e) {
|
|
|
357
357
|
else if (n.length === 6)
|
|
358
358
|
s = parseInt(n.slice(0, 2), 16), i = parseInt(n.slice(2, 4), 16), c = parseInt(n.slice(4, 6), 16);
|
|
359
359
|
else return null;
|
|
360
|
-
return Number.isNaN(s) || Number.isNaN(i) || Number.isNaN(c) ? null :
|
|
360
|
+
return Number.isNaN(s) || Number.isNaN(i) || Number.isNaN(c) ? null : Yt(s, i, c);
|
|
361
361
|
}
|
|
362
362
|
const o = t.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);
|
|
363
|
-
return o ?
|
|
363
|
+
return o ? Yt(Number(o[1]), Number(o[2]), Number(o[3])) : null;
|
|
364
364
|
}
|
|
365
|
-
function
|
|
365
|
+
function Yt(e, t, o) {
|
|
366
366
|
const n = (s) => {
|
|
367
367
|
const i = s / 255;
|
|
368
368
|
return i <= 0.03928 ? i / 12.92 : Math.pow((i + 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, Xe = 4, Kt = 0.25, Ye = ({
|
|
377
377
|
children: e,
|
|
378
378
|
artboardManager: t,
|
|
379
379
|
canvasRef: o,
|
|
@@ -382,9 +382,9 @@ const te = Q(null), Me = 0.1, Ye = 4, Gt = 0.25, Xe = ({
|
|
|
382
382
|
const [s, i] = b(1), [c, r] = b({ x: 0, y: 0 }), [d, a] = b(!1), [z, v] = b(1), V = m(() => {
|
|
383
383
|
v(1), r({ x: 0, y: 0 });
|
|
384
384
|
}, []), E = m(() => {
|
|
385
|
-
i((F) => Math.min(F +
|
|
385
|
+
i((F) => Math.min(F + Kt, Xe));
|
|
386
386
|
}, []), D = m(() => {
|
|
387
|
-
i((F) => Math.max(F -
|
|
387
|
+
i((F) => Math.max(F - Kt, Me));
|
|
388
388
|
}, []), p = m(() => {
|
|
389
389
|
const F = t.getActiveArtboard();
|
|
390
390
|
if (!F || !o.current) return;
|
|
@@ -421,13 +421,13 @@ const te = Q(null), Me = 0.1, Ye = 4, Gt = 0.25, Xe = ({
|
|
|
421
421
|
);
|
|
422
422
|
return /* @__PURE__ */ k(te.Provider, { value: S, children: e });
|
|
423
423
|
};
|
|
424
|
-
function
|
|
425
|
-
const e =
|
|
424
|
+
function Ke() {
|
|
425
|
+
const e = X(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), Ge = ({ children: e }) => {
|
|
431
431
|
const [t, o] = b(null), [n, s] = b([]), [i, c] = b(null), [r, d] = b(null), [a, z] = b(!1), v = m((D) => {
|
|
432
432
|
o(D);
|
|
433
433
|
}, []), V = m((D) => {
|
|
@@ -459,12 +459,12 @@ const ee = Q(null), Ke = ({ 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 = X(ee);
|
|
463
463
|
if (!e)
|
|
464
464
|
throw new Error("useSelectionContext must be used within a SelectionProvider (or EditorProvider)");
|
|
465
465
|
return e;
|
|
466
466
|
}
|
|
467
|
-
const oe = Q(null),
|
|
467
|
+
const oe = Q(null), Je = ({ children: e, value: t }) => {
|
|
468
468
|
const o = q(
|
|
469
469
|
() => ({
|
|
470
470
|
undo: t.undo,
|
|
@@ -490,12 +490,12 @@ 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 = X(oe);
|
|
494
494
|
if (!e)
|
|
495
495
|
throw new Error("useHistoryContext must be used within a HistoryProvider (or EditorProvider)");
|
|
496
496
|
return e;
|
|
497
497
|
}
|
|
498
|
-
const ne = Q(null),
|
|
498
|
+
const ne = Q(null), Ze = ({ children: e }) => {
|
|
499
499
|
const [t, o] = b(null), [n, s] = b(!1), [i, c] = b(0), [r, d] = b(!1), [a, z] = b(!1), v = q(
|
|
500
500
|
() => ({
|
|
501
501
|
expandedPanelType: t,
|
|
@@ -514,7 +514,7 @@ const ne = Q(null), Je = ({ children: e }) => {
|
|
|
514
514
|
return /* @__PURE__ */ k(ne.Provider, { value: v, children: e });
|
|
515
515
|
};
|
|
516
516
|
function qe() {
|
|
517
|
-
const e =
|
|
517
|
+
const e = X(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 = X(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 = X(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
|
-
const eo =
|
|
635
|
-
const e =
|
|
634
|
+
const eo = Jt("EditorContext"), se = Q(null), ce = Q(null), Ro = () => {
|
|
635
|
+
const e = X(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 s = pt(null), i = q(() => ({ get: () => s.current }), []), c =
|
|
640
|
+
const s = pt(null), i = q(() => ({ get: () => s.current }), []), c = Ke(), r = je(), d = qe(), [a, z] = b(
|
|
641
641
|
() => t.getAllArtboards()
|
|
642
642
|
), [v, 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: Y,
|
|
670
670
|
canUndoActiveArtboard: rt,
|
|
671
|
-
canRedoActiveArtboard:
|
|
671
|
+
canRedoActiveArtboard: K
|
|
672
672
|
} = Ve(
|
|
673
673
|
p,
|
|
674
674
|
h,
|
|
675
675
|
t,
|
|
676
676
|
L
|
|
677
|
-
),
|
|
677
|
+
), G = 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, G(A));
|
|
691
691
|
},
|
|
692
|
-
[w,
|
|
693
|
-
), me = r.activeChildElement || w, he = r.activeChildElement ? ue :
|
|
692
|
+
[w, G]
|
|
693
|
+
), me = r.activeChildElement || w, he = r.activeChildElement ? ue : G, {
|
|
694
694
|
fontSize: bt,
|
|
695
695
|
fontColor: wt,
|
|
696
696
|
fontFamily: Et,
|
|
@@ -712,14 +712,14 @@ const eo = Zt("EditorContext"), se = Q(null), ce = Q(null), Ro = () => {
|
|
|
712
712
|
);
|
|
713
713
|
const T = `element-${Date.now()}`, B = t.getActiveArtboard(), mt = B ? B.x + B.width / 2 : window.innerWidth / 2, st = B ? B.y + B.height / 2 : window.innerHeight / 2, j = ((Lt = n.current) == null ? void 0 : Lt.getZoom()) || c.zoom || 1;
|
|
714
714
|
if (A === "image") {
|
|
715
|
-
const ft = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==", et = 200 / j,
|
|
715
|
+
const ft = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==", et = 200 / j, J = x == null ? void 0 : x.src, W = new Fe({
|
|
716
716
|
id: T,
|
|
717
717
|
name: u.name,
|
|
718
718
|
x: mt,
|
|
719
719
|
y: st,
|
|
720
720
|
// Defer loading `src` until after the element is in the store so a
|
|
721
721
|
// synchronously-cached image can't fire onLoadCallback too early.
|
|
722
|
-
imageUrl:
|
|
722
|
+
imageUrl: J ? "" : ft,
|
|
723
723
|
transformData: {
|
|
724
724
|
type: "image",
|
|
725
725
|
width: et,
|
|
@@ -733,10 +733,10 @@ const eo = Zt("EditorContext"), se = Q(null), ce = Q(null), Ro = () => {
|
|
|
733
733
|
borderRadius: 0
|
|
734
734
|
}
|
|
735
735
|
});
|
|
736
|
-
return
|
|
737
|
-
const $t =
|
|
738
|
-
kt < 1 && (
|
|
739
|
-
}), M(W, I), r.setSelectedId(W.id),
|
|
736
|
+
return J && (W.imageLoaded = !1, W.imageElement = null, W.isCropping = !1, W.imageUrl = J, W.preserveDimensions = !1, W.onLoadCallback = (Z) => {
|
|
737
|
+
const $t = Z.transformData.width, Bt = Z.transformData.height, kt = Math.min(et / $t, et / Bt, 1);
|
|
738
|
+
kt < 1 && (Z.transformData.width = $t * kt, Z.transformData.height = Bt * kt), Z.transformData.cropX = 0, Z.transformData.cropY = 0, Z.transformData.cropWidth = 1, Z.transformData.cropHeight = 1, _(W, Z);
|
|
739
|
+
}), M(W, I), r.setSelectedId(W.id), J && W.loadImage(J), { id: W.id, name: u.name ?? "" };
|
|
740
740
|
}
|
|
741
741
|
let tt;
|
|
742
742
|
const at = {
|
|
@@ -751,8 +751,8 @@ const eo = Zt("EditorContext"), se = Q(null), ce = Q(null), Ro = () => {
|
|
|
751
751
|
const ht = t.getActiveArtboard(), fe = ht ? Math.min(ht.width, ht.height) * 0.1 : 80, Ht = ht ? ht.width * 0.5 : 300;
|
|
752
752
|
if (A === "shape") {
|
|
753
753
|
const ft = (x == null ? void 0 : x.shapeType) ?? "rectangle";
|
|
754
|
-
let et = 200 / j,
|
|
755
|
-
ft === "ellipse" ? (et = 150 / j,
|
|
754
|
+
let et = 200 / j, J = 200 / j;
|
|
755
|
+
ft === "ellipse" ? (et = 150 / j, J = 250 / j) : ft === "line" && (et = 300 / j, J = 8 / j), tt = new Pe({
|
|
756
756
|
id: T,
|
|
757
757
|
name: u.name,
|
|
758
758
|
x: mt,
|
|
@@ -761,7 +761,7 @@ const eo = Zt("EditorContext"), se = Q(null), ce = Q(null), Ro = () => {
|
|
|
761
761
|
type: "shape",
|
|
762
762
|
shapeType: ft,
|
|
763
763
|
width: et,
|
|
764
|
-
height:
|
|
764
|
+
height: J,
|
|
765
765
|
fillColor: "#3b82f6",
|
|
766
766
|
fillOpacity: 1
|
|
767
767
|
}
|
|
@@ -932,7 +932,7 @@ const eo = Zt("EditorContext"), se = Q(null), ce = Q(null), Ro = () => {
|
|
|
932
932
|
artboardVersion: v,
|
|
933
933
|
// Handlers
|
|
934
934
|
refreshArtboards: L,
|
|
935
|
-
handleElementUpdate:
|
|
935
|
+
handleElementUpdate: G,
|
|
936
936
|
addElement: At,
|
|
937
937
|
handleAddElement: Ft,
|
|
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: Y,
|
|
958
958
|
canUndoActiveArtboard: rt,
|
|
959
|
-
canRedoActiveArtboard:
|
|
959
|
+
canRedoActiveArtboard: K,
|
|
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
|
v,
|
|
1017
1017
|
L,
|
|
1018
|
-
|
|
1018
|
+
G,
|
|
1019
1019
|
At,
|
|
1020
1020
|
Ft,
|
|
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
|
+
Y,
|
|
1041
1041
|
rt,
|
|
1042
|
-
|
|
1042
|
+
K,
|
|
1043
1043
|
// Element properties
|
|
1044
1044
|
bt,
|
|
1045
1045
|
wt,
|
|
@@ -1052,7 +1052,7 @@ const eo = Zt("EditorContext"), se = Q(null), ce = Q(null), Ro = () => {
|
|
|
1052
1052
|
Ot
|
|
1053
1053
|
]);
|
|
1054
1054
|
return s.current = _t, /* @__PURE__ */ k(ce.Provider, { value: i, children: /* @__PURE__ */ k(
|
|
1055
|
-
|
|
1055
|
+
Je,
|
|
1056
1056
|
{
|
|
1057
1057
|
value: {
|
|
1058
1058
|
undo: P,
|
|
@@ -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: Y,
|
|
1064
1064
|
canUndoActiveArtboard: rt,
|
|
1065
|
-
canRedoActiveArtboard:
|
|
1065
|
+
canRedoActiveArtboard: K
|
|
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: Ft,
|
|
1080
|
-
handleElementUpdate:
|
|
1080
|
+
handleElementUpdate: G,
|
|
1081
1081
|
handleLoadWorkspace: Nt,
|
|
1082
1082
|
handleCopyElements: vt,
|
|
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: Y,
|
|
1114
1114
|
canUndoActiveArtboard: rt,
|
|
1115
|
-
canRedoActiveArtboard:
|
|
1115
|
+
canRedoActiveArtboard: K,
|
|
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
|
}), s = pt(null), i = pt(null);
|
|
1141
1141
|
return /* @__PURE__ */ k(
|
|
1142
|
-
|
|
1142
|
+
Ye,
|
|
1143
1143
|
{
|
|
1144
1144
|
artboardManager: n,
|
|
1145
1145
|
canvasRef: s,
|
|
1146
1146
|
viewPadding: o,
|
|
1147
|
-
children: /* @__PURE__ */ k(
|
|
1147
|
+
children: /* @__PURE__ */ k(Ge, { children: /* @__PURE__ */ k(Ze, { 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 = X(se);
|
|
1160
1160
|
if (!e)
|
|
1161
1161
|
throw new Error("useEditor must be used within EditorProvider");
|
|
1162
1162
|
return e;
|
|
@@ -1252,7 +1252,7 @@ function so(e) {
|
|
|
1252
1252
|
};
|
|
1253
1253
|
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), e.shadow && (r.shadow = e.shadow), 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);
|
|
1254
1254
|
}
|
|
1255
|
-
const
|
|
1255
|
+
const Gt = "center", de = Symbol.for("snowcone.canvas.layerToken");
|
|
1256
1256
|
function Po(e) {
|
|
1257
1257
|
return typeof e == "object" && e !== null && e[de] === !0 && typeof e.name == "string" && (e.kind === "text" || e.kind === "image");
|
|
1258
1258
|
}
|
|
@@ -1478,7 +1478,7 @@ class lt {
|
|
|
1478
1478
|
return this.els.unshift(c), this;
|
|
1479
1479
|
}
|
|
1480
1480
|
image(t, o = {}) {
|
|
1481
|
-
const { width: n, height: s } = this.current, i = o.width ?? Math.round(n / 3), c = o.height ?? (o.aspectRatio ? Math.round(i / o.aspectRatio) : i), { x: r, y: d } = Ut(o.anchor ??
|
|
1481
|
+
const { width: n, height: s } = this.current, i = o.width ?? Math.round(n / 3), c = o.height ?? (o.aspectRatio ? Math.round(i / o.aspectRatio) : i), { x: r, y: d } = Ut(o.anchor ?? Gt, i, c, n, s, o.padding ?? 0), a = {
|
|
1482
1482
|
id: this.nextId("img"),
|
|
1483
1483
|
transformType: "image",
|
|
1484
1484
|
x: r,
|
|
@@ -1583,7 +1583,7 @@ class lt {
|
|
|
1583
1583
|
}
|
|
1584
1584
|
/** An anchored vector shape. */
|
|
1585
1585
|
shape(t, o = {}) {
|
|
1586
|
-
const { width: n, height: s } = this.current, i = o.size ?? Math.round(n / 6), c = typeof i == "number" ? i : i.width, r = typeof i == "number" ? i : i.height, { x: d, y: a } = Ut(o.anchor ??
|
|
1586
|
+
const { width: n, height: s } = this.current, i = o.size ?? Math.round(n / 6), c = typeof i == "number" ? i : i.width, r = typeof i == "number" ? i : i.height, { x: d, y: a } = Ut(o.anchor ?? Gt, c, r, n, s, o.padding ?? 0), z = {
|
|
1587
1587
|
type: "shape",
|
|
1588
1588
|
shapeType: t,
|
|
1589
1589
|
width: c,
|
|
@@ -1645,32 +1645,32 @@ function zo(e) {
|
|
|
1645
1645
|
return Vt(e);
|
|
1646
1646
|
}
|
|
1647
1647
|
export {
|
|
1648
|
-
|
|
1648
|
+
Zt as B,
|
|
1649
1649
|
no as C,
|
|
1650
1650
|
lt as D,
|
|
1651
1651
|
Co as E,
|
|
1652
1652
|
qt as P,
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1653
|
+
So as a,
|
|
1654
|
+
Io as b,
|
|
1655
|
+
je as c,
|
|
1656
|
+
Ke as d,
|
|
1657
|
+
No as e,
|
|
1658
|
+
vo as f,
|
|
1659
|
+
Oo as g,
|
|
1660
|
+
ao as h,
|
|
1661
1661
|
Po as i,
|
|
1662
|
-
|
|
1663
|
-
|
|
1662
|
+
_e as j,
|
|
1663
|
+
wo as k,
|
|
1664
1664
|
zo as l,
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1665
|
+
qe as m,
|
|
1666
|
+
To as n,
|
|
1667
|
+
go as o,
|
|
1668
1668
|
xo as p,
|
|
1669
|
-
|
|
1670
|
-
|
|
1669
|
+
Ro as q,
|
|
1670
|
+
Fo as r,
|
|
1671
1671
|
ro as s,
|
|
1672
1672
|
Le as t,
|
|
1673
|
-
|
|
1673
|
+
Eo as u,
|
|
1674
1674
|
bo as v
|
|
1675
1675
|
};
|
|
1676
|
-
//# sourceMappingURL=design-builder-
|
|
1676
|
+
//# sourceMappingURL=design-builder-CoCtjIwj.js.map
|