@snowcone-app/canvas 0.30.0 → 0.32.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.
Files changed (80) hide show
  1. package/ERROR_CONTRACT.md +11 -0
  2. package/STYLING_CONTRACT.md +3 -3
  3. package/dist/{CanvasRenderer-BEf0hXeF.js → CanvasRenderer-1j-twIbs.js} +443 -431
  4. package/dist/{CanvasRenderer-BEf0hXeF.js.map → CanvasRenderer-1j-twIbs.js.map} +1 -1
  5. package/dist/{CanvasStateV1-BDSyYo4A.js → CanvasStateV1-BmC1JfPv.js} +813 -798
  6. package/dist/{CanvasStateV1-BDSyYo4A.js.map → CanvasStateV1-BmC1JfPv.js.map} +1 -1
  7. package/dist/ContextualToolbars-BKU8IoAM.js +6474 -0
  8. package/dist/ContextualToolbars-BKU8IoAM.js.map +1 -0
  9. package/dist/{EditorCanvasImpl-DXeBz2CX.js → EditorCanvasImpl-4voOsj2k.js} +19 -20
  10. package/dist/{EditorCanvasImpl-DXeBz2CX.js.map → EditorCanvasImpl-4voOsj2k.js.map} +1 -1
  11. package/dist/{ExportManager-DUdis6se.js → ExportManager-Ci81K6xA.js} +783 -500
  12. package/dist/ExportManager-Ci81K6xA.js.map +1 -0
  13. package/dist/{FontAnalyzer-DKG5JK0x.js → FontAnalyzer-BrKY6XYn.js} +1604 -1444
  14. package/dist/FontAnalyzer-BrKY6XYn.js.map +1 -0
  15. package/dist/{ImagePanel-CBgGqmVV.js → ImagePanel-ntJBepby.js} +49 -49
  16. package/dist/{ImagePanel-CBgGqmVV.js.map → ImagePanel-ntJBepby.js.map} +1 -1
  17. package/dist/{SnowconeCanvas-BWPBngvI.js → SnowconeCanvas-CgQdiBXv.js} +27 -27
  18. package/dist/{SnowconeCanvas-BWPBngvI.js.map → SnowconeCanvas-CgQdiBXv.js.map} +1 -1
  19. package/dist/advanced.mjs +14 -14
  20. package/dist/components/ImageToolbar.d.ts +12 -0
  21. package/dist/components/ShapeToolbar.d.ts +8 -0
  22. package/dist/components/TextToolbar.d.ts +5 -1
  23. package/dist/components/toolbars/EmbeddedToolbarLayout.d.ts +6 -0
  24. package/dist/components/toolbars/GroupElementToolbar.d.ts +8 -0
  25. package/dist/components/toolbars/SecondaryPanels.d.ts +40 -1
  26. package/dist/components/toolbars/index.d.ts +2 -2
  27. package/dist/components/ui/SliderRow.d.ts +6 -0
  28. package/dist/components/ui/toolbar-button.d.ts +2 -2
  29. package/dist/core/BaseElement.d.ts +2 -1
  30. package/dist/core/image-adjustments.d.ts +32 -0
  31. package/dist/core/shape-fill.d.ts +31 -0
  32. package/dist/{custom-icons-BIaRovwG.js → custom-icons-DTWtkJ9N.js} +7 -7
  33. package/dist/{custom-icons-BIaRovwG.js.map → custom-icons-DTWtkJ9N.js.map} +1 -1
  34. package/dist/design-builder-BpbYUYtK.js +1672 -0
  35. package/dist/design-builder-BpbYUYtK.js.map +1 -0
  36. package/dist/{embed-Csez1hui.js → embed-C69x0jHc.js} +110 -111
  37. package/dist/{embed-Csez1hui.js.map → embed-C69x0jHc.js.map} +1 -1
  38. package/dist/embed.mjs +53 -54
  39. package/dist/embed.mjs.map +1 -1
  40. package/dist/errors/editorError.d.ts +7 -0
  41. package/dist/{guards-BSoX73yg.js → guards-BhaQgJrE.js} +2 -2
  42. package/dist/{guards-BSoX73yg.js.map → guards-BhaQgJrE.js.map} +1 -1
  43. package/dist/hooks/elementPatch.d.ts +14 -4
  44. package/dist/index.mjs +41 -41
  45. package/dist/internals.mjs +202 -133
  46. package/dist/internals.mjs.map +1 -1
  47. package/dist/rendering/LayerEffectsRenderer.d.ts +24 -0
  48. package/dist/rendering/element-painters.d.ts +0 -13
  49. package/dist/rendering/element-serializer.d.ts +3 -1
  50. package/dist/rendering/image-adjustments.d.ts +24 -0
  51. package/dist/rendering/renderer-types.d.ts +10 -1
  52. package/dist/state/CanvasStateV1.d.ts +22 -0
  53. package/dist/style.css +1 -1
  54. package/dist/template-fields-D-2oLhCi.js +505 -0
  55. package/dist/template-fields-D-2oLhCi.js.map +1 -0
  56. package/dist/testing.mjs +40 -41
  57. package/dist/testing.mjs.map +1 -1
  58. package/dist/types/index.d.ts +105 -1
  59. package/dist/types/public.d.ts +3 -2
  60. package/dist/{UnifiedFontService-Co9tQ59z.js → useCommands-DwnZHUg8.js} +2361 -2103
  61. package/dist/useCommands-DwnZHUg8.js.map +1 -0
  62. package/dist/{usePieceGuideBundle-CRLY2iQa.js → usePieceGuideBundle-CnSmYrmM.js} +2 -2
  63. package/dist/{usePieceGuideBundle-CRLY2iQa.js.map → usePieceGuideBundle-CnSmYrmM.js.map} +1 -1
  64. package/dist/utils/featureApplied.d.ts +6 -0
  65. package/dist/{validation-BGEl9rrE.js → validation-DyUOjRGa.js} +465 -465
  66. package/dist/{validation-BGEl9rrE.js.map → validation-DyUOjRGa.js.map} +1 -1
  67. package/dist/workers/export-worker.bundle.string.d.ts +1 -1
  68. package/example/package.json +1 -1
  69. package/package.json +1 -1
  70. package/dist/ContextualToolbars-C3D_6sep.js +0 -5960
  71. package/dist/ContextualToolbars-C3D_6sep.js.map +0 -1
  72. package/dist/ExportManager-DUdis6se.js.map +0 -1
  73. package/dist/FontAnalyzer-DKG5JK0x.js.map +0 -1
  74. package/dist/UnifiedFontService-Co9tQ59z.js.map +0 -1
  75. package/dist/design-builder-JYLO_Hyi.js +0 -470
  76. package/dist/design-builder-JYLO_Hyi.js.map +0 -1
  77. package/dist/editorErrors-WzaNxU1Y.js +0 -1206
  78. package/dist/editorErrors-WzaNxU1Y.js.map +0 -1
  79. package/dist/template-fields-DYPW7bVU.js +0 -716
  80. package/dist/template-fields-DYPW7bVU.js.map +0 -1
@@ -1,11 +1,11 @@
1
1
  import { jsx as e, jsxs as c, Fragment as K } from "react/jsx-runtime";
2
2
  import * as Ze from "react";
3
3
  import Be, { useMemo as Je, useState as r, useRef as U, useEffect as J, useCallback as ae } from "react";
4
- import { u as Ke, e as Oe } from "./editorErrors-WzaNxU1Y.js";
5
- import { n as es, z as ss, d as cs, K as ts, I as v, A as re, B as _, u as rs, C as as } from "./UnifiedFontService-Co9tQ59z.js";
6
- import { c as ns, I as os } from "./FontAnalyzer-DKG5JK0x.js";
7
- import { T as k, S as Te, a as xe, I as ye, L as be } from "./custom-icons-BIaRovwG.js";
8
- import { a as ls } from "./guards-BSoX73yg.js";
4
+ import { u as Ke, g as Oe } from "./design-builder-BpbYUYtK.js";
5
+ import { o as es, N as ss, d as cs, W as ts, I as v, O as re, B as _, u as rs, C as as } from "./useCommands-DwnZHUg8.js";
6
+ import { c as ns, I as os } from "./FontAnalyzer-BrKY6XYn.js";
7
+ import { T as k, S as Te, a as xe, I as ye, L as be } from "./custom-icons-DTWtkJ9N.js";
8
+ import { a as ls } from "./guards-BhaQgJrE.js";
9
9
  const De = Ze.forwardRef(
10
10
  ({ className: d, isInvalid: t, disabled: N, readOnly: E, required: u, variant: n, ...x }, l) => {
11
11
  const i = es(), m = n ?? (i.variant === "default" ? "filled" : "default");
@@ -45,17 +45,17 @@ function us(d, t) {
45
45
  const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N, fixedHeight: E = !1 }) {
46
46
  const [u, n] = r(!1), [x, l] = r(!1), [i, m] = r("top"), h = U(null), C = U(null), w = U(null), V = U(!0), [S, R] = r(!1), f = U(null), Y = () => {
47
47
  x || N(t);
48
- }, Q = (g) => {
48
+ }, W = (g) => {
49
49
  if (!w.current) return "top";
50
- const y = w.current.getBoundingClientRect(), A = g.clientX - y.left, L = g.clientY - y.top, M = y.width, se = y.height, T = {
51
- top: L,
52
- bottom: se - L,
53
- left: A,
54
- right: M - A
50
+ const y = w.current.getBoundingClientRect(), L = g.clientX - y.left, M = g.clientY - y.top, A = y.width, se = y.height, T = {
51
+ top: M,
52
+ bottom: se - M,
53
+ left: L,
54
+ right: A - L
55
55
  }, $ = Math.min(T.top, T.bottom, T.left, T.right);
56
56
  return $ === T.top ? "top" : $ === T.bottom ? "bottom" : $ === T.left ? "left" : "right";
57
- }, W = (g) => {
58
- const y = Q(g);
57
+ }, Q = (g) => {
58
+ const y = W(g);
59
59
  f.current && (cancelAnimationFrame(f.current), f.current = null), y !== i ? (R(!0), m(y), f.current = requestAnimationFrame(() => {
60
60
  f.current = requestAnimationFrame(() => {
61
61
  R(!1), n(!0), f.current = null;
@@ -63,7 +63,7 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
63
63
  })) : (m(y), n(!0)), V.current = !1;
64
64
  }, b = (g) => {
65
65
  f.current && (cancelAnimationFrame(f.current), f.current = null);
66
- const y = Q(g);
66
+ const y = W(g);
67
67
  m(y), R(!1), n(!1);
68
68
  }, B = () => {
69
69
  C.current && (clearTimeout(C.current), C.current = null), h.current = setTimeout(() => {
@@ -95,7 +95,7 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
95
95
  {
96
96
  ref: w,
97
97
  onClick: Y,
98
- onMouseEnter: W,
98
+ onMouseEnter: Q,
99
99
  onMouseLeave: b,
100
100
  className: `sc:group sc:relative sc:cursor-pointer sc:overflow-hidden ${E ? "sc:h-full sc:rounded-xs" : "sc:break-inside-avoid sc:rounded-lg"}`,
101
101
  children: [
@@ -268,23 +268,23 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
268
268
  ...x ? ["ai"] : []
269
269
  ],
270
270
  [n, l, x]
271
- ), [h, C] = r(""), [w, V] = r(""), [S, R] = r([]), [f, Y] = r(!1), [Q, W] = r(null), [b, B] = r(m[0]), [O, ee] = r(1), [D, F] = r(!0), [j, P] = r("masonry"), [g, y] = r(""), [A, L] = r([]), [M, se] = r(!1), [T, $] = r(null), [ce, ne] = r(null), [z, G] = r(!0), [o, q] = r("grid"), [X, de] = r(""), [oe, le] = r(!1), [Ee, ve] = r(null), [Z, Ne] = r(null), [ue, me] = r(!1), [fe, he] = r(null), ke = U(null), Ce = U(null), Re = U(null);
271
+ ), [h, C] = r(""), [w, V] = r(""), [S, R] = r([]), [f, Y] = r(!1), [W, Q] = r(null), [b, B] = r(m[0]), [O, ee] = r(1), [D, F] = r(!0), [j, P] = r("masonry"), [g, y] = r(""), [L, M] = r([]), [A, se] = r(!1), [T, $] = r(null), [ce, ne] = r(null), [z, G] = r(!0), [o, q] = r("grid"), [X, de] = r(""), [oe, le] = r(!1), [Ee, ve] = r(null), [Z, Ne] = r(null), [ue, me] = r(!1), [fe, he] = r(null), ke = U(null), Ce = U(null), Re = U(null);
272
272
  J(() => {
273
273
  m.includes(b) || B(m[0]);
274
274
  }, [m, b]), J(() => {
275
275
  d && E && (V(E), B("url"));
276
276
  }, [d, E]), J(() => {
277
- d || (C(""), V(""), R([]), W(null), ee(1), F(!0), y(""), L([]), $(null), ne(null), G(!0));
277
+ d || (C(""), V(""), R([]), Q(null), ee(1), F(!0), y(""), M([]), $(null), ne(null), G(!0));
278
278
  }, [d]);
279
279
  const ge = ae(
280
280
  async (s, a, p) => {
281
281
  if (n) {
282
- Y(!0), W(null);
282
+ Y(!0), Q(null);
283
283
  try {
284
284
  const I = await n.search({ query: s, page: a, perPage: 30 });
285
285
  R((H) => p ? [...H, ...I.results] : I.results), ee(I.page), F(I.hasMore);
286
286
  } catch (I) {
287
- W(is), ie.error("Error searching images:", I);
287
+ Q(is), ie.error("Error searching images:", I);
288
288
  } finally {
289
289
  Y(!1);
290
290
  }
@@ -325,7 +325,7 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
325
325
  se(!0), $(null);
326
326
  try {
327
327
  const { results: p, nextPage: I } = await l.search({ query: s, nextPage: a ?? null });
328
- L(a ? (H) => {
328
+ M(a ? (H) => {
329
329
  const we = new Set(H.map((te) => te.id));
330
330
  return [...H, ...p.filter((te) => !we.has(te.id))];
331
331
  } : p), ne(I), G(I !== null);
@@ -339,19 +339,19 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
339
339
  [l]
340
340
  );
341
341
  J(() => {
342
- d && !g && b === "vector" && A.length === 0 && l && pe("");
342
+ d && !g && b === "vector" && L.length === 0 && l && pe("");
343
343
  }, [d, b, l]);
344
344
  const Ge = (s) => {
345
345
  s.preventDefault(), pe(g);
346
- }, Ae = ae(() => {
347
- M || !z || !ce || pe(g, ce);
348
- }, [M, z, ce, g, pe]);
346
+ }, Le = ae(() => {
347
+ A || !z || !ce || pe(g, ce);
348
+ }, [A, z, ce, g, pe]);
349
349
  J(() => {
350
350
  const s = Ce.current;
351
351
  if (!s || !d || b !== "vector") return;
352
352
  const a = new IntersectionObserver(
353
353
  (p) => {
354
- p[0].isIntersecting && z && !M && Ae();
354
+ p[0].isIntersecting && z && !A && Le();
355
355
  },
356
356
  {
357
357
  root: null,
@@ -362,11 +362,11 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
362
362
  return a.observe(s), () => {
363
363
  a.disconnect();
364
364
  };
365
- }, [d, b, z, M, Ae]);
366
- const Le = (s) => {
365
+ }, [d, b, z, A, Le]);
366
+ const Me = (s) => {
367
367
  const a = s.selectUrl || s.urls.svg || s.urls.png;
368
368
  a && (N(a), t(!1));
369
- }, Me = (s) => {
369
+ }, Ae = (s) => {
370
370
  var a;
371
371
  try {
372
372
  Promise.resolve((a = n == null ? void 0 : n.trackSelect) == null ? void 0 : a.call(n, s)).catch(() => {
@@ -426,9 +426,9 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
426
426
  le(!1);
427
427
  }
428
428
  }
429
- }, Qe = () => {
429
+ }, We = () => {
430
430
  Z && (N(Z), t(!1));
431
- }, We = async () => {
431
+ }, Qe = async () => {
432
432
  if (!(!i || !Z)) {
433
433
  me(!0), he(null);
434
434
  try {
@@ -548,7 +548,7 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
548
548
  }
549
549
  )
550
550
  ] }),
551
- Q && /* @__PURE__ */ e("div", { className: "sc:border-danger sc:bg-danger/10 sc:text-danger sc:mx-6 sc:mb-3 sc:rounded-2xl sc:border-2 sc:px-4 sc:py-3 sc:text-sm", children: Q }),
551
+ W && /* @__PURE__ */ e("div", { className: "sc:border-danger sc:bg-danger/10 sc:text-danger sc:mx-6 sc:mb-3 sc:rounded-2xl sc:border-2 sc:px-4 sc:py-3 sc:text-sm", children: W }),
552
552
  f && S.length === 0 && /* @__PURE__ */ e("div", { className: "sc:text-muted sc:px-6 sc:py-8 sc:text-center sc:text-sm", children: "Loading images..." }),
553
553
  S.length > 0 && /* @__PURE__ */ c("div", { className: "sc:mx-6 sc:overflow-hidden sc:rounded-t-2xl", children: [
554
554
  j === "masonry" ? (
@@ -563,7 +563,7 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
563
563
  gridAutoRows: u === "bottom" ? "200px" : "120px",
564
564
  gap: ms
565
565
  },
566
- children: S.map((s, a) => /* @__PURE__ */ e("div", { className: qe(s, a), children: /* @__PURE__ */ e(Pe, { image: s, onImageSelect: Me, fixedHeight: !0 }) }, s.id))
566
+ children: S.map((s, a) => /* @__PURE__ */ e("div", { className: qe(s, a), children: /* @__PURE__ */ e(Pe, { image: s, onImageSelect: Ae, fixedHeight: !0 }) }, s.id))
567
567
  }
568
568
  )
569
569
  ) : (
@@ -577,7 +577,7 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
577
577
  gridTemplateColumns: u === "bottom" ? "repeat(auto-fill, minmax(150px, 1fr))" : "repeat(auto-fill, minmax(120px, 1fr))",
578
578
  gap: Ie
579
579
  },
580
- children: S.map((s) => /* @__PURE__ */ e("div", { style: { aspectRatio: "1 / 1" }, children: /* @__PURE__ */ e(Pe, { image: s, onImageSelect: Me, fixedHeight: !0 }) }, s.id))
580
+ children: S.map((s) => /* @__PURE__ */ e("div", { style: { aspectRatio: "1 / 1" }, children: /* @__PURE__ */ e(Pe, { image: s, onImageSelect: Ae, fixedHeight: !0 }) }, s.id))
581
581
  }
582
582
  )
583
583
  ),
@@ -721,7 +721,7 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
721
721
  "data-testid": "vector-search-input"
722
722
  }
723
723
  ) }),
724
- /* @__PURE__ */ e(_, { type: "submit", size: "icon", variant: "secondary", disabled: M, "aria-label": "Search", children: /* @__PURE__ */ e(v, { icon: re.search, className: "sc:size-5" }) }),
724
+ /* @__PURE__ */ e(_, { type: "submit", size: "icon", variant: "secondary", disabled: A, "aria-label": "Search", children: /* @__PURE__ */ e(v, { icon: re.search, className: "sc:size-5" }) }),
725
725
  /* @__PURE__ */ e(
726
726
  _,
727
727
  {
@@ -734,8 +734,8 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
734
734
  )
735
735
  ] }),
736
736
  T && /* @__PURE__ */ e("div", { className: "sc:border-danger sc:bg-danger/10 sc:text-danger sc:mx-6 sc:mb-3 sc:rounded-2xl sc:border-2 sc:px-4 sc:py-3 sc:text-sm", children: T }),
737
- M && A.length === 0 && /* @__PURE__ */ e("div", { className: "sc:text-muted sc:px-6 sc:py-8 sc:text-center sc:text-sm", children: "Loading vectors..." }),
738
- A.length > 0 && /* @__PURE__ */ c("div", { className: "sc:mx-6 sc:overflow-hidden sc:rounded-t-2xl", children: [
737
+ A && L.length === 0 && /* @__PURE__ */ e("div", { className: "sc:text-muted sc:px-6 sc:py-8 sc:text-center sc:text-sm", children: "Loading vectors..." }),
738
+ L.length > 0 && /* @__PURE__ */ c("div", { className: "sc:mx-6 sc:overflow-hidden sc:rounded-t-2xl", children: [
739
739
  o === "masonry" ? (
740
740
  /* CSS Grid Masonry */
741
741
  /* @__PURE__ */ e(
@@ -748,7 +748,7 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
748
748
  gridAutoRows: u === "bottom" ? "150px" : "120px",
749
749
  gap: Ie
750
750
  },
751
- children: A.map((s) => /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(Ue, { vector: s, onVectorSelect: Le, fixedHeight: !0 }) }, s.id))
751
+ children: L.map((s) => /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(Ue, { vector: s, onVectorSelect: Me, fixedHeight: !0 }) }, s.id))
752
752
  }
753
753
  )
754
754
  ) : (
@@ -762,15 +762,15 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
762
762
  gridTemplateColumns: u === "bottom" ? "repeat(auto-fill, minmax(120px, 1fr))" : "repeat(auto-fill, minmax(100px, 1fr))",
763
763
  gap: Ie
764
764
  },
765
- children: A.map((s) => /* @__PURE__ */ e("div", { style: { aspectRatio: "1 / 1" }, children: /* @__PURE__ */ e(Ue, { vector: s, onVectorSelect: Le, fixedHeight: !0 }) }, s.id))
765
+ children: L.map((s) => /* @__PURE__ */ e("div", { style: { aspectRatio: "1 / 1" }, children: /* @__PURE__ */ e(Ue, { vector: s, onVectorSelect: Me, fixedHeight: !0 }) }, s.id))
766
766
  }
767
767
  )
768
768
  ),
769
769
  z && /* @__PURE__ */ e("div", { ref: Ce, className: "sc:h-px" }),
770
- M && /* @__PURE__ */ e("div", { className: "sc:text-muted sc:py-4 sc:text-center sc:text-sm", children: "Loading more..." }),
771
- !z && !M && /* @__PURE__ */ e("div", { className: "sc:text-muted sc:py-6 sc:text-center sc:text-sm", children: "No more vectors" })
770
+ A && /* @__PURE__ */ e("div", { className: "sc:text-muted sc:py-4 sc:text-center sc:text-sm", children: "Loading more..." }),
771
+ !z && !A && /* @__PURE__ */ e("div", { className: "sc:text-muted sc:py-6 sc:text-center sc:text-sm", children: "No more vectors" })
772
772
  ] }),
773
- !M && A.length === 0 && g && /* @__PURE__ */ c("div", { className: "sc:text-muted sc:px-6 sc:py-12 sc:text-center sc:text-sm", children: [
773
+ !A && L.length === 0 && g && /* @__PURE__ */ c("div", { className: "sc:text-muted sc:px-6 sc:py-12 sc:text-center sc:text-sm", children: [
774
774
  'No vectors found for "',
775
775
  g,
776
776
  '"'
@@ -830,7 +830,7 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
830
830
  i && /* @__PURE__ */ e(
831
831
  _,
832
832
  {
833
- onClick: We,
833
+ onClick: Qe,
834
834
  disabled: ue || !Z,
835
835
  variant: "secondary",
836
836
  size: "sm",
@@ -849,7 +849,7 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
849
849
  /* @__PURE__ */ e(
850
850
  _,
851
851
  {
852
- onClick: Qe,
852
+ onClick: We,
853
853
  variant: "default",
854
854
  className: "sc:w-full",
855
855
  "data-testid": "ai-use-image-btn",
@@ -878,7 +878,7 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
878
878
  f.current = l;
879
879
  const Y = U(V);
880
880
  Y.current = V;
881
- const [Q, W] = r(null), b = u ?? Q, B = n ?? W, O = ae(
881
+ const [W, Q] = r(null), b = u ?? W, B = n ?? Q, O = ae(
882
882
  (P) => {
883
883
  var ce, ne;
884
884
  const g = f.current, y = Y.current;
@@ -898,9 +898,9 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
898
898
  alert("Please create or select an artboard first");
899
899
  return;
900
900
  }
901
- const A = `element-${Date.now()}`, L = h.getActiveArtboard(), M = L ? L.x + L.width / 2 : window.innerWidth / 2, se = L ? L.y + L.height / 2 : window.innerHeight / 2, T = ((ne = m.current) == null ? void 0 : ne.getZoom()) || 1, $ = new os({
902
- id: A,
903
- x: M,
901
+ const L = `element-${Date.now()}`, M = h.getActiveArtboard(), A = M ? M.x + M.width / 2 : window.innerWidth / 2, se = M ? M.y + M.height / 2 : window.innerHeight / 2, T = ((ne = m.current) == null ? void 0 : ne.getZoom()) || 1, $ = new os({
902
+ id: L,
903
+ x: A,
904
904
  y: se,
905
905
  imageUrl: P,
906
906
  transformData: {
@@ -912,7 +912,7 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
912
912
  i((o) => o.map((q) => q.id === G.id ? G : q));
913
913
  }
914
914
  });
915
- h.addElementToArtboard(A, R), C($, R, y || void 0), S(A), N && N($);
915
+ h.addElementToArtboard(L, R), C($, R, y || void 0), S(L), N && N($);
916
916
  },
917
917
  [
918
918
  b,
@@ -948,4 +948,4 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
948
948
  export {
949
949
  ws as ImagePanel
950
950
  };
951
- //# sourceMappingURL=ImagePanel-CBgGqmVV.js.map
951
+ //# sourceMappingURL=ImagePanel-ntJBepby.js.map