@snowcone-app/canvas 0.1.12 → 0.1.13

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/index.mjs CHANGED
@@ -1,14 +1,14 @@
1
- import { T as We, i as Be, r as yt, a as Ue, g as wt, L as Et, E as At, b as St, I as kt, G as Rt, A as It, C as Ct, Z as Mt, M as ze, c as Tt, d as Dt, D as Ft, e as Pt, v as Nt, u as Ht, f as Lt, S as Wt, K as Bt, h as Ut, j as zt } from "./compose-Dqh2f8tS.js";
1
+ import { T as Be, i as Ue, r as yt, a as ze, g as wt, L as Et, E as At, b as St, I as kt, G as Rt, A as It, C as Ct, Z as Mt, M as $e, c as Tt, d as Dt, D as Ft, e as Pt, v as Nt, u as Ht, f as Lt, S as Wt, K as Bt, h as Ut, j as zt } from "./compose-Dqh2f8tS.js";
2
2
  import { k as zr, l as $r, m as Or, n as Yr, P as Xr, o as Vr, p as Kr, q as jr } from "./compose-Dqh2f8tS.js";
3
- import { c as q, p as Xe, s as $t, I as Ve, T as Ot } from "./HybridHistoryManager-jBBnVim8.js";
3
+ import { c as q, p as me, s as $t, I as Ve, T as Ot } from "./HybridHistoryManager-jBBnVim8.js";
4
4
  import { jsxs as j, jsx as v, Fragment as Ke } from "react/jsx-runtime";
5
- import { useCallback as W, useMemo as me, Component as Yt, useRef as D, useState as re, useEffect as I, forwardRef as je, useImperativeHandle as Xt } from "react";
6
- import { u as he, T as $e, E as Vt, a as Se, b as Ge, c as Kt } from "./ThemeContext-wj-wSO7J.js";
7
- import { C as Ee, E as jt } from "./ImportManager-Oqu2yB54.js";
5
+ import { useCallback as W, useMemo as he, Component as Yt, useRef as D, useState as re, useEffect as I, forwardRef as je, useImperativeHandle as Xt } from "react";
6
+ import { u as ge, T as Oe, E as Vt, a as ke, b as Ge, c as Kt } from "./ThemeContext-wj-wSO7J.js";
7
+ import { C as Ae, E as jt } from "./ImportManager-Oqu2yB54.js";
8
8
  import { d as Zr, m as Qr, s as qr, v as Jr } from "./CanvasStateV1-CJU_xYW5.js";
9
- const Oe = q("useCommands");
9
+ const Ye = q("useCommands");
10
10
  function Gt() {
11
- const t = he(), {
11
+ const t = ge(), {
12
12
  undo: e,
13
13
  redo: r,
14
14
  canUndo: a,
@@ -22,9 +22,9 @@ function Gt() {
22
22
  executeDeleteArtboard: M,
23
23
  executeUpdateArtboard: w
24
24
  } = t, S = W(() => {
25
- Oe.warn("[useCommands] clearHistory is not yet implemented in EditorContext");
25
+ Ye.warn("[useCommands] clearHistory is not yet implemented in EditorContext");
26
26
  }, []), T = W((E) => {
27
- Oe.warn("[useCommands] clearArtboardHistory is not yet implemented in EditorContext");
27
+ Ye.warn("[useCommands] clearArtboardHistory is not yet implemented in EditorContext");
28
28
  }, []);
29
29
  return {
30
30
  // Undo/Redo
@@ -51,9 +51,9 @@ const Zt = () => {
51
51
  const { undo: t, redo: e, canUndo: r, canRedo: a } = Gt();
52
52
  return /* @__PURE__ */ j("div", { className: "sc-undo-redo", style: { display: "inline-flex", gap: 4 }, children: [
53
53
  /* @__PURE__ */ v(
54
- We,
54
+ Be,
55
55
  {
56
- icon: Be.undo,
56
+ icon: Ue.undo,
57
57
  onClick: t,
58
58
  disabled: !r,
59
59
  tooltip: "Undo",
@@ -61,9 +61,9 @@ const Zt = () => {
61
61
  }
62
62
  ),
63
63
  /* @__PURE__ */ v(
64
- We,
64
+ Be,
65
65
  {
66
- icon: Be.redo,
66
+ icon: Ue.redo,
67
67
  onClick: e,
68
68
  disabled: !a,
69
69
  tooltip: "Redo",
@@ -72,9 +72,9 @@ const Zt = () => {
72
72
  )
73
73
  ] });
74
74
  }, Qt = q("KitLayout"), te = "canvas";
75
- let Ye = !1;
75
+ let Xe = !1;
76
76
  function qt() {
77
- Ye || (Ye = !0, yt({
77
+ Xe || (Xe = !0, yt({
78
78
  LayersPanel: Et,
79
79
  EffectsPanel: At,
80
80
  ExportPanel: St,
@@ -83,14 +83,14 @@ function qt() {
83
83
  ArtboardTabs: It,
84
84
  ContextualToolbars: Ct,
85
85
  ZoomControls: Mt,
86
- MenuButton: ze,
86
+ MenuButton: $e,
87
87
  CropPanel: Tt
88
- }), Ue("add-element-menu", {
89
- component: ze,
88
+ }), ze("add-element-menu", {
89
+ component: $e,
90
90
  label: "Add Element",
91
91
  icon: "gravity-ui:plus",
92
92
  position: "topbar"
93
- }), Ue("undo-redo-controls", {
93
+ }), ze("undo-redo-controls", {
94
94
  component: Zt,
95
95
  label: "Undo / Redo",
96
96
  icon: "lucide:undo-2",
@@ -99,10 +99,11 @@ function qt() {
99
99
  }
100
100
  function fe({ ids: t }) {
101
101
  return !t || t.length === 0 ? null : /* @__PURE__ */ v(Ke, { children: t.map((e) => {
102
+ var n;
102
103
  if (e === te) return null;
103
104
  const r = wt(e);
104
105
  if (!r)
105
- return Xe.env.NODE_ENV === "development" && Qt.warn(
106
+ return typeof me < "u" && ((n = me.env) == null ? void 0 : n.NODE_ENV) === "development" && Qt.warn(
106
107
  `Kit layout references unknown section "${e}" — skipping. Register it with registerSection("${e}", { ... }).`
107
108
  ), null;
108
109
  const a = r.component;
@@ -113,7 +114,7 @@ function Jt({ kit: t, canvas: e }) {
113
114
  var l, m, A, M;
114
115
  qt();
115
116
  const r = t.layout.slots, a = !!((l = r.topbar) != null && l.some((w) => w !== te)), n = !!((m = r.left) != null && m.some((w) => w !== te)), c = !!((A = r.right) != null && A.some((w) => w !== te)), o = !!((M = r.bottombar) != null && M.some((w) => w !== te));
116
- return me(
117
+ return he(
117
118
  () => !a && !n && !c && !o,
118
119
  [a, n, c, o]
119
120
  ) ? /* @__PURE__ */ v(Ke, { children: e }) : /* @__PURE__ */ j("div", { className: "sc-kit-layout", style: { display: "flex", flexDirection: "column", height: "100%", minHeight: 0 }, children: [
@@ -552,7 +553,7 @@ function gr(t) {
552
553
  return new Promise((e) => setTimeout(e, t));
553
554
  }
554
555
  const K = q("SnowconeCanvas");
555
- function Ae(t, e, r, a) {
556
+ function Se(t, e, r, a) {
556
557
  if (a <= 0 || !isFinite(a))
557
558
  return r;
558
559
  const n = t * r, c = e * r;
@@ -586,11 +587,12 @@ const Qe = je((t, e) => {
586
587
  style: F,
587
588
  enableShortcuts: O,
588
589
  overlay: ne
589
- } = t, ke = w, J = t.autoExportConfig ?? (r == null ? void 0 : r.autoExportConfig), G = t.autoExportFormat ?? (r == null ? void 0 : r.format) ?? "dataUrl", ge = t.autoExportAll ?? (r == null ? void 0 : r.exportAll) ?? !1, X = t.exportScale ?? (r == null ? void 0 : r.scale) ?? 2, U = t.maxExportSize ?? (r == null ? void 0 : r.maxSize) ?? 4e3, ae = t.exportImageFormat ?? (r == null ? void 0 : r.imageFormat) ?? "png", oe = t.exportImageQuality ?? (r == null ? void 0 : r.imageQuality) ?? 0.92, z = t.initialImage ?? (a == null ? void 0 : a.src), Re = t.initialImageAlignment ?? (a == null ? void 0 : a.alignment) ?? "center", Ie = t.initialImageScale ?? (a == null ? void 0 : a.scale) ?? 1, Ce = t.initialImageScaleMode ?? (a == null ? void 0 : a.scaleMode) ?? "cover", qe = t.width ?? (n == null ? void 0 : n.width) ?? 1200, Je = t.height ?? (n == null ? void 0 : n.height) ?? 1200, _e = t.viewPadding ?? (n == null ? void 0 : n.viewPadding) ?? 0.9, et = t.artboardBorderRadius ?? (n == null ? void 0 : n.artboardBorderRadius) ?? 0, tt = t.fixedMargin ?? (n == null ? void 0 : n.fixedMargin), rt = t.maxHeight ?? (n == null ? void 0 : n.maxHeight), nt = t.showRotationHandle ?? (n == null ? void 0 : n.showRotationHandle) ?? !0, at = t.hideCanvas ?? (n == null ? void 0 : n.hideCanvas) ?? !1, Me = t.canvasWrapperClassName ?? (n == null ? void 0 : n.canvasWrapperClassName), Te = t.canvasWrapperStyle ?? (n == null ? void 0 : n.canvasWrapperStyle), ot = t.canvasCutouts ?? (n == null ? void 0 : n.canvasCutouts), De = t.pieceGuides, st = t.pieceFocus, it = O ?? !0, _ = me(() => Pt(c ?? "pro-studio"), [c]);
590
+ } = t, Re = w, J = t.autoExportConfig ?? (r == null ? void 0 : r.autoExportConfig), G = t.autoExportFormat ?? (r == null ? void 0 : r.format) ?? "dataUrl", pe = t.autoExportAll ?? (r == null ? void 0 : r.exportAll) ?? !1, X = t.exportScale ?? (r == null ? void 0 : r.scale) ?? 2, U = t.maxExportSize ?? (r == null ? void 0 : r.maxSize) ?? 4e3, ae = t.exportImageFormat ?? (r == null ? void 0 : r.imageFormat) ?? "png", oe = t.exportImageQuality ?? (r == null ? void 0 : r.imageQuality) ?? 0.92, z = t.initialImage ?? (a == null ? void 0 : a.src), Ie = t.initialImageAlignment ?? (a == null ? void 0 : a.alignment) ?? "center", Ce = t.initialImageScale ?? (a == null ? void 0 : a.scale) ?? 1, Me = t.initialImageScaleMode ?? (a == null ? void 0 : a.scaleMode) ?? "cover", qe = t.width ?? (n == null ? void 0 : n.width) ?? 1200, Je = t.height ?? (n == null ? void 0 : n.height) ?? 1200, _e = t.viewPadding ?? (n == null ? void 0 : n.viewPadding) ?? 0.9, et = t.artboardBorderRadius ?? (n == null ? void 0 : n.artboardBorderRadius) ?? 0, tt = t.fixedMargin ?? (n == null ? void 0 : n.fixedMargin), rt = t.maxHeight ?? (n == null ? void 0 : n.maxHeight), nt = t.showRotationHandle ?? (n == null ? void 0 : n.showRotationHandle) ?? !0, at = t.hideCanvas ?? (n == null ? void 0 : n.hideCanvas) ?? !1, Te = t.canvasWrapperClassName ?? (n == null ? void 0 : n.canvasWrapperClassName), De = t.canvasWrapperStyle ?? (n == null ? void 0 : n.canvasWrapperStyle), ot = t.canvasCutouts ?? (n == null ? void 0 : n.canvasCutouts), Fe = t.pieceGuides, st = t.pieceFocus, it = O ?? !0, _ = he(() => Pt(c ?? "pro-studio"), [c]);
590
591
  I(() => {
591
- if (Xe.env.NODE_ENV === "development" && _) {
592
- const s = Nt(_);
593
- s.valid || K.warn("Kit validation warnings:", s.errors), s.warnings.length > 0 && K.warn("Kit validation warnings:", s.warnings);
592
+ var s;
593
+ if (typeof me < "u" && ((s = me.env) == null ? void 0 : s.NODE_ENV) === "development" && _) {
594
+ const d = Nt(_);
595
+ d.valid || K.warn("Kit validation warnings:", d.errors), d.warnings.length > 0 && K.warn("Kit validation warnings:", d.warnings);
594
596
  }
595
597
  }, [_]);
596
598
  const se = D(R);
@@ -599,26 +601,26 @@ const Qe = je((t, e) => {
599
601
  var d;
600
602
  K.error(`[${s.category}] ${s.message}`, s.originalError), (d = se.current) == null || d.call(se, s);
601
603
  }, []);
602
- I(() => (Ee.onRenderError = B, () => {
603
- Ee.onRenderError === B && (Ee.onRenderError = null);
604
+ I(() => (Ae.onRenderError = B, () => {
605
+ Ae.onRenderError === B && (Ae.onRenderError = null);
604
606
  }), [B]);
605
607
  const {
606
608
  elements: V,
607
609
  setElements: ie,
608
- selectedId: Fe,
610
+ selectedId: Pe,
609
611
  artboardManager: C,
610
612
  refreshArtboards: ct,
611
613
  historyManager: lt,
612
- isCanvasReady: pe,
614
+ isCanvasReady: be,
613
615
  setCanvasReady: ce
614
- } = he(), { createArtboard: dt, selectArtboard: ut, artboards: H } = Ht(), { exportArtboard: Z, exportAllArtboards: le, exportArtboardAsBlob: Q, exportAllArtboardsAsBlobs: de } = Lt();
616
+ } = ge(), { createArtboard: dt, selectArtboard: ut, artboards: H } = Ht(), { exportArtboard: Z, exportAllArtboards: le, exportArtboardAsBlob: Q, exportAllArtboardsAsBlobs: de } = Lt();
615
617
  Xt(e, () => ({
616
618
  exportArtboards: async (s = {}) => {
617
619
  const d = s.format || G, g = s.scale || X, p = s.all ?? !1;
618
620
  let f = g;
619
621
  if (U > 0 && isFinite(U))
620
622
  for (const y of H) {
621
- const b = Ae(y.width, y.height, g, U);
623
+ const b = Se(y.width, y.height, g, U);
622
624
  f = Math.min(f, b);
623
625
  }
624
626
  const u = { scale: f, format: ae, quality: oe };
@@ -647,7 +649,7 @@ const Qe = je((t, e) => {
647
649
  const d = C.getActiveArtboard();
648
650
  if (!d)
649
651
  throw new Error("[SnowconeCanvas] No active artboard found");
650
- const g = Ae(
652
+ const g = Se(
651
653
  d.width,
652
654
  d.height,
653
655
  X,
@@ -656,13 +658,13 @@ const Qe = je((t, e) => {
656
658
  return { [d.name]: p };
657
659
  });
658
660
  }, [N, Z, Q, C, G, X, U]);
659
- const [Pe, ue] = re("idle"), [Ne, be] = re(null), ve = D(void 0), xe = D(!1), He = D(!1), [ft, mt] = re(!1), ht = D(0), gt = D(0), ye = D(!1);
661
+ const [Ne, ue] = re("idle"), [He, ve] = re(null), xe = D(void 0), ye = D(!1), Le = D(!1), [ft, mt] = re(!1), ht = D(0), gt = D(0), we = D(!1);
660
662
  I(() => {
661
- if (xe.current) return;
662
- xe.current = !0;
663
+ if (ye.current) return;
664
+ ye.current = !0;
663
665
  const s = o || [{ name: "Design", width: qe, height: Je }], d = C.getAllArtboards();
664
666
  if (d.length > 0) {
665
- const g = s[0], p = d[0], f = De ? "transparent" : void 0;
667
+ const g = s[0], p = d[0], f = Fe ? "transparent" : void 0;
666
668
  p.name = g.name, p.width = g.width, p.height = g.height, p.clipShape = g.clipShape, g.backgroundColor ? p.backgroundColor = g.backgroundColor : f && (p.backgroundColor = f);
667
669
  for (let u = 1; u < s.length; u++)
668
670
  dt(s[u].width, s[u].height, {
@@ -673,8 +675,8 @@ const Qe = je((t, e) => {
673
675
  }
674
676
  ct();
675
677
  }, []), I(() => {
676
- if (!(!m || m.length === 0) && !He.current && xe.current) {
677
- He.current = !0, mt(!0);
678
+ if (!(!m || m.length === 0) && !Le.current && ye.current) {
679
+ Le.current = !0, mt(!0);
678
680
  try {
679
681
  const s = jt.createManyFromJSON(m), d = C.getAllArtboards();
680
682
  if (d.length > 0) {
@@ -731,29 +733,29 @@ const Qe = je((t, e) => {
731
733
  }
732
734
  }, [m, C, ie, B]), I(() => {
733
735
  if (!i) {
734
- ye.current = !0;
736
+ we.current = !0;
735
737
  return;
736
738
  }
737
739
  const s = H.find((d) => d.name === i);
738
740
  if (s) {
739
741
  const d = C.getActiveArtboard();
740
- (d == null ? void 0 : d.name) !== i && ut(s.id), ye.current = !0;
742
+ (d == null ? void 0 : d.name) !== i && ut(s.id), we.current = !0;
741
743
  }
742
744
  }, [i, H]), I(() => {
743
- if (!z || ve.current === z) return;
745
+ if (!z || xe.current === z) return;
744
746
  if (V.length > 0) {
745
- ve.current = z;
747
+ xe.current = z;
746
748
  return;
747
749
  }
748
- ve.current = z, (async () => {
749
- ue("loading"), be(null);
750
+ xe.current = z, (async () => {
751
+ ue("loading"), ve(null);
750
752
  try {
751
753
  const d = C.getAllArtboards();
752
754
  if (d.length === 0)
753
755
  throw new Error("No artboards available");
754
756
  const g = [];
755
757
  for (const p of d) {
756
- const f = o == null ? void 0 : o.find((b) => b.name === p.name), u = (f == null ? void 0 : f.scaleMode) || Ce, y = await hr(
758
+ const f = o == null ? void 0 : o.find((b) => b.name === p.name), u = (f == null ? void 0 : f.scaleMode) || Me, y = await hr(
757
759
  z,
758
760
  {
759
761
  artboard: {
@@ -762,8 +764,8 @@ const Qe = je((t, e) => {
762
764
  x: p.x,
763
765
  y: p.y
764
766
  },
765
- alignment: (f == null ? void 0 : f.fitAlign) || Re,
766
- scale: Ie,
767
+ alignment: (f == null ? void 0 : f.fitAlign) || Ie,
768
+ scale: Ce,
767
769
  scaleMode: u,
768
770
  marginTop: f == null ? void 0 : f.fitMarginTop,
769
771
  marginRight: f == null ? void 0 : f.fitMarginRight,
@@ -777,7 +779,7 @@ const Qe = je((t, e) => {
777
779
  ie((p) => [...p, ...g]), ue("success"), k == null || k(z);
778
780
  else {
779
781
  const p = new Error("Failed to load image into any artboard");
780
- ue("error"), be(p), h == null || h(z, p), B({
782
+ ue("error"), ve(p), h == null || h(z, p), B({
781
783
  category: "image",
782
784
  message: p.message,
783
785
  originalError: p,
@@ -786,7 +788,7 @@ const Qe = je((t, e) => {
786
788
  }
787
789
  } catch (d) {
788
790
  const g = d instanceof Error ? d : new Error(String(d));
789
- ue("error"), be(g), h == null || h(z, g), B({
791
+ ue("error"), ve(g), h == null || h(z, g), B({
790
792
  category: "image",
791
793
  message: g.message,
792
794
  originalError: g,
@@ -794,9 +796,9 @@ const Qe = je((t, e) => {
794
796
  });
795
797
  }
796
798
  })();
797
- }, [z, Re, Ie, Ce]), I(() => {
798
- M == null || M(Fe);
799
- }, [Fe, M]), I(() => {
799
+ }, [z, Ie, Ce, Me]), I(() => {
800
+ M == null || M(Pe);
801
+ }, [Pe, M]), I(() => {
800
802
  if (!A) return;
801
803
  const s = C.getActiveArtboard(), d = {
802
804
  elements: V.map((g) => g.toJSON()),
@@ -811,7 +813,7 @@ const Qe = je((t, e) => {
811
813
  };
812
814
  A(d);
813
815
  }, [V, H, A]), I(() => {
814
- if (!l || !ye.current) return;
816
+ if (!l || !we.current) return;
815
817
  const s = C.getActiveArtboard();
816
818
  s && l(s.name);
817
819
  }, [C.getActiveArtboardId()]);
@@ -821,7 +823,7 @@ const Qe = je((t, e) => {
821
823
  let g = X;
822
824
  if (U > 0 && isFinite(U))
823
825
  for (const u of H) {
824
- const y = Ae(u.width, u.height, X, U);
826
+ const y = Se(u.width, u.height, X, U);
825
827
  g = Math.min(g, y);
826
828
  }
827
829
  const p = C.getActiveArtboard(), f = (p == null ? void 0 : p.id) ?? "unknown";
@@ -834,7 +836,7 @@ const Qe = je((t, e) => {
834
836
  quality: oe
835
837
  };
836
838
  if (G === "blob")
837
- if (ge) {
839
+ if (pe) {
838
840
  const b = await de(y);
839
841
  u = {};
840
842
  for (const [P, $] of Object.entries(b)) {
@@ -847,7 +849,7 @@ const Qe = je((t, e) => {
847
849
  const P = await Q(b.id, y);
848
850
  u = { [b.name]: P };
849
851
  }
850
- else if (ge) {
852
+ else if (pe) {
851
853
  const b = await le(y);
852
854
  u = {};
853
855
  for (const [P, $] of Object.entries(b)) {
@@ -879,9 +881,9 @@ const Qe = je((t, e) => {
879
881
  recoverable: !0
880
882
  });
881
883
  }
882
- }, [S, E, ge, G, X, U, ae, oe, Z, le, Q, de, H, C, V, J, B]);
884
+ }, [S, E, pe, G, X, U, ae, oe, Z, le, Q, de, H, C, V, J, B]);
883
885
  I(() => {
884
- ke !== void 0 && ke > 0 && K.warn(
886
+ Re !== void 0 && Re > 0 && K.warn(
885
887
  "autoExportInterval is deprecated and ignored. Use autoExportConfig={{ enabled: true, debounceMs: 100, maxWaitMs: 1000 }} instead."
886
888
  );
887
889
  }, []), I(() => {
@@ -891,15 +893,15 @@ const Qe = je((t, e) => {
891
893
  const s = C.getActiveArtboard();
892
894
  E({ status: "scheduled", artboardId: (s == null ? void 0 : s.id) ?? "unknown" });
893
895
  }
894
- }, [T, E, C]), vt = !!m && m.length > 0, we = sr({
895
- isCanvasReady: pe,
896
+ }, [T, E, C]), vt = !!m && m.length > 0, Ee = sr({
897
+ isCanvasReady: be,
896
898
  elements: V,
897
899
  hasInitialElements: vt,
898
900
  initialElementsLoaded: ft
899
- }), Le = D(!1);
901
+ }), We = D(!1);
900
902
  I(() => {
901
- we && !Le.current && (Le.current = !0, x == null || x());
902
- }, [we, x]), rr({
903
+ Ee && !We.current && (We.current = !0, x == null || x());
904
+ }, [Ee, x]), rr({
903
905
  config: J ? {
904
906
  enabled: J.enabled ?? !0,
905
907
  debounceMs: J.debounceMs ?? 100,
@@ -913,16 +915,16 @@ const Qe = je((t, e) => {
913
915
  elements: V,
914
916
  onExport: pt,
915
917
  onExportScheduled: bt,
916
- isCanvasReady: we
918
+ isCanvasReady: Ee
917
919
  // Gate exports until content is fully ready (fonts loaded, elements deserialized)
918
920
  }), I(() => {
919
- if (H.length > 0 && !pe) {
921
+ if (H.length > 0 && !be) {
920
922
  const s = requestAnimationFrame(() => {
921
923
  ce(!0);
922
924
  });
923
925
  return () => cancelAnimationFrame(s);
924
926
  }
925
- }, [H.length, pe, ce]), I(() => () => {
927
+ }, [H.length, be, ce]), I(() => () => {
926
928
  ce(!1);
927
929
  }, [ce]);
928
930
  const xt = W((s) => {
@@ -933,7 +935,7 @@ const Qe = je((t, e) => {
933
935
  recoverable: !1
934
936
  });
935
937
  }, [B]);
936
- return Pe === "loading" ? /* @__PURE__ */ v(
938
+ return Ne === "loading" ? /* @__PURE__ */ v(
937
939
  "div",
938
940
  {
939
941
  className: L,
@@ -946,7 +948,7 @@ const Qe = je((t, e) => {
946
948
  },
947
949
  children: /* @__PURE__ */ v(Wt, { size: 48 })
948
950
  }
949
- ) : Pe === "error" && Ne ? /* @__PURE__ */ v(
951
+ ) : Ne === "error" && He ? /* @__PURE__ */ v(
950
952
  "div",
951
953
  {
952
954
  className: L,
@@ -961,7 +963,7 @@ const Qe = je((t, e) => {
961
963
  },
962
964
  children: /* @__PURE__ */ j("div", { className: "text-center", children: [
963
965
  /* @__PURE__ */ v("div", { className: "font-medium", children: "Failed to load image" }),
964
- /* @__PURE__ */ v("div", { className: "text-sm mt-1 opacity-70", children: Ne.message })
966
+ /* @__PURE__ */ v("div", { className: "text-sm mt-1 opacity-70", children: He.message })
965
967
  ] })
966
968
  }
967
969
  ) : /* @__PURE__ */ v(Bt, { kit: _, children: /* @__PURE__ */ v("div", { className: `app-modern ${L || ""}`, style: { ...F, position: "relative" }, children: /* @__PURE__ */ j(
@@ -1019,11 +1021,11 @@ const Qe = je((t, e) => {
1019
1021
  showRotationHandle: nt,
1020
1022
  enableShortcuts: it,
1021
1023
  canvasCutouts: ot,
1022
- pieceGuides: De,
1024
+ pieceGuides: Fe,
1023
1025
  pieceFocus: st
1024
1026
  }
1025
1027
  );
1026
- return /* @__PURE__ */ v(Jt, { kit: _, canvas: Me || Te ? /* @__PURE__ */ v("div", { className: Me, style: Te, children: s }) : s });
1028
+ return /* @__PURE__ */ v(Jt, { kit: _, canvas: Te || De ? /* @__PURE__ */ v("div", { className: Te, style: De, children: s }) : s });
1027
1029
  })(),
1028
1030
  ne
1029
1031
  ]
@@ -1034,21 +1036,21 @@ Qe.displayName = "SnowconeCanvasInner";
1034
1036
  const pr = je((t, e) => {
1035
1037
  var o;
1036
1038
  const { inheritTheme: r, externalProvider: a } = t, n = t.viewPadding ?? ((o = t.layoutConfig) == null ? void 0 : o.viewPadding), c = /* @__PURE__ */ v(Qe, { ref: e, ...t });
1037
- return a ? /* @__PURE__ */ v($e, { defaultTheme: "light", passive: r, children: c }) : /* @__PURE__ */ v($e, { defaultTheme: "light", passive: r, children: /* @__PURE__ */ v(Vt, { viewPadding: n, children: c }) });
1039
+ return a ? /* @__PURE__ */ v(Oe, { defaultTheme: "light", passive: r, children: c }) : /* @__PURE__ */ v(Oe, { defaultTheme: "light", passive: r, children: /* @__PURE__ */ v(Vt, { viewPadding: n, children: c }) });
1038
1040
  });
1039
1041
  pr.displayName = "SnowconeCanvas";
1040
1042
  function Dr() {
1041
- const { selectedElement: t } = he();
1043
+ const { selectedElement: t } = ge();
1042
1044
  return t ?? null;
1043
1045
  }
1044
1046
  function Fr() {
1045
- const { isCanvasReady: t } = he();
1047
+ const { isCanvasReady: t } = ge();
1046
1048
  return t;
1047
1049
  }
1048
1050
  const br = () => {
1049
1051
  }, vr = [];
1050
1052
  function Pr(t) {
1051
- const { elementStore: e } = Se(), { executeElementUpdate: r } = Ge(), a = me(() => e.getAllByName(t).filter((o) => o instanceof Ot), [e, t]), n = W(
1053
+ const { elementStore: e } = ke(), { executeElementUpdate: r } = Ge(), a = he(() => e.getAllByName(t).filter((o) => o instanceof Ot), [e, t]), n = W(
1052
1054
  (c) => {
1053
1055
  for (const o of a) {
1054
1056
  const i = o.clone();
@@ -1092,7 +1094,7 @@ function wr(t, e, r) {
1092
1094
  }
1093
1095
  }
1094
1096
  function Nr(t, e) {
1095
- const r = (e == null ? void 0 : e.fit) ?? "cover", { elementStore: a, setElements: n } = Se(), { executeElementUpdate: c } = Ge(), o = me(() => a.getAllByName(t).filter((S) => S instanceof Ve), [a, t]), i = D(/* @__PURE__ */ new Map());
1097
+ const r = (e == null ? void 0 : e.fit) ?? "cover", { elementStore: a, setElements: n } = ke(), { executeElementUpdate: c } = Ge(), o = he(() => a.getAllByName(t).filter((S) => S instanceof Ve), [a, t]), i = D(/* @__PURE__ */ new Map());
1096
1098
  for (const w of o)
1097
1099
  if (!i.current.has(w.id)) {
1098
1100
  const S = w.transformData;
@@ -1135,7 +1137,7 @@ function Nr(t, e) {
1135
1137
  };
1136
1138
  }
1137
1139
  function Hr(t) {
1138
- const { elementStore: e } = Se();
1140
+ const { elementStore: e } = ke();
1139
1141
  return t ? e.getByName(t) ?? null : null;
1140
1142
  }
1141
1143
  function Lr() {
@@ -1208,7 +1210,7 @@ export {
1208
1210
  Fr as useCanvasReady,
1209
1211
  Gt as useCommands,
1210
1212
  sr as useContentReady,
1211
- he as useEditor,
1213
+ ge as useEditor,
1212
1214
  Hr as useElementByName,
1213
1215
  Lt as useExport,
1214
1216
  Nr as useImageBinding,