@snowcone-app/canvas 0.37.1 → 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.
Files changed (69) hide show
  1. package/ERROR_CONTRACT.md +39 -8
  2. package/STYLING_CONTRACT.md +24 -2
  3. package/dist/{CanvasRenderer-CTN4j-uO.js → CanvasRenderer-D-E5WWLm.js} +4 -4
  4. package/dist/{CanvasRenderer-CTN4j-uO.js.map → CanvasRenderer-D-E5WWLm.js.map} +1 -1
  5. package/dist/{CanvasStateV1-DLE5d1-d.js → CanvasStateV1-C9LQt2J0.js} +7 -7
  6. package/dist/{CanvasStateV1-DLE5d1-d.js.map → CanvasStateV1-C9LQt2J0.js.map} +1 -1
  7. package/dist/{ContextualToolbars-CG5Gmv_i.js → ContextualToolbars-C62As-xY.js} +202 -202
  8. package/dist/{ContextualToolbars-CG5Gmv_i.js.map → ContextualToolbars-C62As-xY.js.map} +1 -1
  9. package/dist/EditorCanvasImpl-BnxEbr2p.js +144 -0
  10. package/dist/EditorCanvasImpl-BnxEbr2p.js.map +1 -0
  11. package/dist/{ExportManager-CDX5_up8.js → ExportManager-BbBfO22S.js} +45 -45
  12. package/dist/{ExportManager-CDX5_up8.js.map → ExportManager-BbBfO22S.js.map} +1 -1
  13. package/dist/{FontAnalyzer-CEYA_6fY.js → FontAnalyzer-DWHS41ba.js} +128 -128
  14. package/dist/FontAnalyzer-DWHS41ba.js.map +1 -0
  15. package/dist/{ImagePanel-DLxIDKV-.js → ImagePanel-BaX0UE-L.js} +57 -57
  16. package/dist/{ImagePanel-DLxIDKV-.js.map → ImagePanel-BaX0UE-L.js.map} +1 -1
  17. package/dist/SnowconeCanvas-CWSPyqqj.js +1112 -0
  18. package/dist/SnowconeCanvas-CWSPyqqj.js.map +1 -0
  19. package/dist/advanced.mjs +138 -138
  20. package/dist/api/placement.d.ts +3 -0
  21. package/dist/components/editor/EditorPlacements.d.ts +19 -6
  22. package/dist/components/editor/RootInternals.d.ts +7 -0
  23. package/dist/components/editor/designStateStore.d.ts +18 -0
  24. package/dist/components/editor/index.d.ts +3 -1
  25. package/dist/components/editor/placementLinks.d.ts +52 -0
  26. package/dist/components/editor/usePlacements.d.ts +28 -4
  27. package/dist/components/embed-realtime/context.d.ts +20 -4
  28. package/dist/components/embed-realtime/usePieceGuideBundle.d.ts +1 -0
  29. package/dist/components/embed-realtime/validateEmbed.d.ts +6 -3
  30. package/dist/{custom-icons-D51KIAfz.js → custom-icons-o1U13Vcg.js} +14 -14
  31. package/dist/{custom-icons-D51KIAfz.js.map → custom-icons-o1U13Vcg.js.map} +1 -1
  32. package/dist/{design-builder-CqgTpp9B.js → design-builder-CoCtjIwj.js} +86 -86
  33. package/dist/{design-builder-CqgTpp9B.js.map → design-builder-CoCtjIwj.js.map} +1 -1
  34. package/dist/{embed-CLz3CTcX.js → embed-SOFUZlGB.js} +843 -729
  35. package/dist/embed-SOFUZlGB.js.map +1 -0
  36. package/dist/embed.mjs +28 -28
  37. package/dist/errors/editorError.d.ts +7 -2
  38. package/dist/{guards-DldCuuJq.js → guards-DMmhw_Ow.js} +4 -4
  39. package/dist/{guards-DldCuuJq.js.map → guards-DMmhw_Ow.js.map} +1 -1
  40. package/dist/index.mjs +21 -21
  41. package/dist/internals.mjs +108 -108
  42. package/dist/internals.mjs.map +1 -1
  43. package/dist/placement-Br5jI_-u.js +90 -0
  44. package/dist/placement-Br5jI_-u.js.map +1 -0
  45. package/dist/placement.d.ts +2 -0
  46. package/dist/placement.mjs +5 -0
  47. package/dist/placement.mjs.map +1 -0
  48. package/dist/template-fields-CBLHgW7G.js +556 -0
  49. package/dist/template-fields-CBLHgW7G.js.map +1 -0
  50. package/dist/testing.mjs +24 -24
  51. package/dist/{useCommands-CQi4Pyd2.js → useCommands-x8J7_Mzy.js} +262 -262
  52. package/dist/{useCommands-CQi4Pyd2.js.map → useCommands-x8J7_Mzy.js.map} +1 -1
  53. package/dist/usePieceGuideBundle-C7r06a_x.js +65 -0
  54. package/dist/usePieceGuideBundle-C7r06a_x.js.map +1 -0
  55. package/dist/{validation-THw5W6N_.js → validation-BG-V98h0.js} +846 -846
  56. package/dist/validation-BG-V98h0.js.map +1 -0
  57. package/example/package.json +1 -1
  58. package/package.json +7 -2
  59. package/dist/EditorCanvasImpl-BRdFWZA5.js +0 -81
  60. package/dist/EditorCanvasImpl-BRdFWZA5.js.map +0 -1
  61. package/dist/FontAnalyzer-CEYA_6fY.js.map +0 -1
  62. package/dist/SnowconeCanvas-BaFR8QXs.js +0 -1196
  63. package/dist/SnowconeCanvas-BaFR8QXs.js.map +0 -1
  64. package/dist/embed-CLz3CTcX.js.map +0 -1
  65. package/dist/template-fields-D8uOutD4.js +0 -505
  66. package/dist/template-fields-D8uOutD4.js.map +0 -1
  67. package/dist/usePieceGuideBundle-BUQKb0Ja.js +0 -61
  68. package/dist/usePieceGuideBundle-BUQKb0Ja.js.map +0 -1
  69. package/dist/validation-THw5W6N_.js.map +0 -1
@@ -1,11 +1,11 @@
1
1
  import { jsx as e, jsxs as t, Fragment as le } from "react/jsx-runtime";
2
2
  import * as ss from "react";
3
3
  import $e, { useMemo as je, useState as r, useRef as M, useEffect as ie, useCallback as fe } from "react";
4
- import { u as ts, g as cs } from "./design-builder-CqgTpp9B.js";
5
- import { o as as, N as rs, d as Ge, W as ns, I as p, O as me, B as Y, u as os, X as is, C as ls } from "./useCommands-CQi4Pyd2.js";
6
- import { c as He, I as ds } from "./FontAnalyzer-CEYA_6fY.js";
7
- import { T as C, S as Pe, a as Ie, I as Ce, L as Ee } from "./custom-icons-D51KIAfz.js";
8
- import { a as us } from "./guards-DldCuuJq.js";
4
+ import { b as ts, c as cs } from "./design-builder-CoCtjIwj.js";
5
+ import { u as as, c as rs, a as Ge, D as ns, I as p, i as me, B as X, b as os, d as is, C as ls } from "./useCommands-x8J7_Mzy.js";
6
+ import { c as He, I as ds } from "./FontAnalyzer-DWHS41ba.js";
7
+ import { T as C, S as Pe, a as Ie, I as Ce, L as Ee } from "./custom-icons-o1U13Vcg.js";
8
+ import { i as us } from "./guards-DMmhw_Ow.js";
9
9
  const _e = ss.forwardRef(
10
10
  ({ className: d, isInvalid: a, disabled: x, readOnly: E, required: u, variant: A, ...c }, g) => {
11
11
  const o = as(), i = A ?? (o.variant === "default" ? "filled" : "default");
@@ -37,17 +37,17 @@ const _e = ss.forwardRef(
37
37
  _e.displayName = "Textarea";
38
38
  const Fe = _e;
39
39
  Fe.displayName = "TextArea";
40
- const xe = He("ImageBrowser"), ms = "Image search is temporarily unavailable.", Ve = "Image generation is temporarily unavailable.", fs = "Vector search is temporarily unavailable.", Ue = "Background removal is temporarily unavailable.";
40
+ const xe = He("ImageBrowser"), ms = "Image search is temporarily unavailable.", Ve = "Image generation is temporarily unavailable.", fs = "Vector search is temporarily unavailable.", De = "Background removal is temporarily unavailable.";
41
41
  function gs(d, a) {
42
42
  const x = d instanceof Error ? d.message : "";
43
43
  return !x || /VITE_|NEXT_PUBLIC_|\.env/i.test(x) ? a : x;
44
44
  }
45
- const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint" }, De = $e.memo(function({ image: a, onImageSelect: x, fixedHeight: E = !1 }) {
46
- const [u, A] = r(!1), [c, g] = r(!1), [o, i] = r("top"), b = M(null), h = M(null), U = M(null), N = M(!0), [T, v] = r(!1), w = M(null), S = () => {
45
+ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint" }, Ue = $e.memo(function({ image: a, onImageSelect: x, fixedHeight: E = !1 }) {
46
+ const [u, A] = r(!1), [c, g] = r(!1), [o, i] = r("top"), b = M(null), h = M(null), D = M(null), N = M(!0), [T, v] = r(!1), w = M(null), S = () => {
47
47
  c || x(a);
48
48
  }, W = (R) => {
49
- if (!U.current) return "top";
50
- const m = U.current.getBoundingClientRect(), Z = R.clientX - m.left, z = R.clientY - m.top, y = m.width, L = m.height, P = {
49
+ if (!D.current) return "top";
50
+ const m = D.current.getBoundingClientRect(), Z = R.clientX - m.left, z = R.clientY - m.top, y = m.width, L = m.height, P = {
51
51
  top: z,
52
52
  bottom: L - z,
53
53
  left: Z,
@@ -75,7 +75,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
75
75
  b.current && (clearTimeout(b.current), b.current = null), h.current && (clearTimeout(h.current), h.current = null);
76
76
  }, _ = () => {
77
77
  g(!1);
78
- }, D = a.source === "unsplash" ? "Unsplash" : "Pixabay", ce = u || c, q = () => {
78
+ }, U = a.source === "unsplash" ? "Unsplash" : "Pixabay", ce = u || c, q = () => {
79
79
  if (!u) return "none";
80
80
  switch (o) {
81
81
  case "top":
@@ -93,7 +93,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
93
93
  return /* @__PURE__ */ t(
94
94
  "div",
95
95
  {
96
- ref: U,
96
+ ref: D,
97
97
  onClick: S,
98
98
  onMouseEnter: se,
99
99
  onMouseLeave: Q,
@@ -136,7 +136,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
136
136
  className: "sc:size-3 sc:text-white/80"
137
137
  }
138
138
  ),
139
- /* @__PURE__ */ e("span", { className: "sc:text-xs sc:font-medium sc:text-white/80", children: D })
139
+ /* @__PURE__ */ e("span", { className: "sc:text-xs sc:font-medium sc:text-white/80", children: U })
140
140
  ] }),
141
141
  /* @__PURE__ */ t("div", { className: "sc:flex sc:flex-col sc:gap-0.5", children: [
142
142
  /* @__PURE__ */ e("span", { className: "sc:text-xs sc:text-white/60", children: "Photo by" }),
@@ -164,7 +164,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
164
164
  rel: "noopener noreferrer",
165
165
  onClick: (R) => R.stopPropagation(),
166
166
  className: "sc:underline sc:decoration-white/40 sc:underline-offset-2 sc:hover:decoration-white",
167
- children: D
167
+ children: U
168
168
  }
169
169
  )
170
170
  ] })
@@ -183,7 +183,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
183
183
  i.current && (clearTimeout(i.current), i.current = null), o.current = setTimeout(() => {
184
184
  g(!0);
185
185
  }, 400);
186
- }, U = () => {
186
+ }, D = () => {
187
187
  o.current && (clearTimeout(o.current), o.current = null), g(!1);
188
188
  }, N = () => {
189
189
  o.current && (clearTimeout(o.current), o.current = null), i.current && (clearTimeout(i.current), i.current = null);
@@ -229,7 +229,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
229
229
  className: `sc:relative sc:flex sc:h-6 sc:w-6 sc:items-center sc:justify-center sc:rounded-full sc:bg-black/50 sc:transition-all sc:duration-300 sc:ease-in-out sc:hover:scale-110 ${v ? "sc:opacity-100" : "sc:pointer-events-none sc:opacity-0"}`,
230
230
  "aria-label": "Vector info",
231
231
  onMouseEnter: h,
232
- onMouseLeave: U,
232
+ onMouseLeave: D,
233
233
  children: /* @__PURE__ */ e(p, { icon: "lucide:aperture", className: "sc:size-4 sc:text-white/80" })
234
234
  }
235
235
  )
@@ -269,13 +269,13 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
269
269
  ...g ? ["ai"] : []
270
270
  ],
271
271
  [c, o, g]
272
- ), [h, U] = r(""), [N, T] = r(""), [v, w] = r([]), [S, W] = r(!1), [se, Q] = r(null), [k, te] = r(b[0]), [$, _] = r(1), [D, ce] = r(!0), [q, R] = r("masonry"), [m, Z] = r(""), [z, y] = r([]), [L, P] = r(!1), [J, ae] = r(null), [j, be] = r(null), [K, ge] = r(!0), [re, ve] = r("grid"), [F, G] = r(""), [V, l] = r(!1), [O, de] = r(null), [H, he] = r(null), [B, ne] = r(!1), [oe, ee] = r(null), Ne = M(null), pe = M(null), Le = M(null);
272
+ ), [h, D] = r(""), [N, T] = r(""), [v, w] = r([]), [S, W] = r(!1), [se, Q] = r(null), [k, te] = r(b[0]), [$, _] = r(1), [U, ce] = r(!0), [q, R] = r("masonry"), [m, Z] = r(""), [z, y] = r([]), [L, P] = r(!1), [J, ae] = r(null), [j, be] = r(null), [K, ge] = r(!0), [re, ve] = r("grid"), [F, G] = r(""), [V, l] = r(!1), [O, de] = r(null), [H, he] = r(null), [B, ne] = r(!1), [oe, ee] = r(null), Ne = M(null), pe = M(null), Le = M(null);
273
273
  ie(() => {
274
274
  b.includes(k) || te(b[0]);
275
275
  }, [b, k]), ie(() => {
276
276
  d && E && (T(E), te("url"));
277
277
  }, [d, E]), ie(() => {
278
- d || (U(""), T(""), w([]), Q(null), _(1), ce(!0), Z(""), y([]), ae(null), be(null), ge(!0));
278
+ d || (D(""), T(""), w([]), Q(null), _(1), ce(!0), Z(""), y([]), ae(null), be(null), ge(!0));
279
279
  }, [d]);
280
280
  const we = fe(
281
281
  async (s, n, f) => {
@@ -283,7 +283,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
283
283
  W(!0), Q(null);
284
284
  try {
285
285
  const I = await c.search({ query: s, page: n, perPage: 30 });
286
- w((X) => f ? [...X, ...I.results] : I.results), _(I.page), ce(I.hasMore);
286
+ w((Y) => f ? [...Y, ...I.results] : I.results), _(I.page), ce(I.hasMore);
287
287
  } catch (I) {
288
288
  Q(ms), xe.error("Error searching images:", I);
289
289
  } finally {
@@ -296,17 +296,17 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
296
296
  ie(() => {
297
297
  d && !h && k === "search" && v.length === 0 && c && we("", 1, !1);
298
298
  }, [d, k, c]);
299
- const Xe = (s) => {
299
+ const Ye = (s) => {
300
300
  s.preventDefault(), we(h, 1, !1);
301
301
  }, Me = fe(() => {
302
- S || !D || we(h, $ + 1, !0);
303
- }, [S, D, h, $, we]);
302
+ S || !U || we(h, $ + 1, !0);
303
+ }, [S, U, h, $, we]);
304
304
  ie(() => {
305
305
  const s = Ne.current;
306
306
  if (!s || !d || k !== "search") return;
307
307
  const n = new IntersectionObserver(
308
308
  (f) => {
309
- f[0].isIntersecting && D && !S && Me();
309
+ f[0].isIntersecting && U && !S && Me();
310
310
  },
311
311
  {
312
312
  root: null,
@@ -319,16 +319,16 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
319
319
  return n.observe(s), () => {
320
320
  n.disconnect();
321
321
  };
322
- }, [d, k, D, S, Me]);
322
+ }, [d, k, U, S, Me]);
323
323
  const ye = fe(
324
324
  async (s, n) => {
325
325
  if (o) {
326
326
  P(!0), ae(null);
327
327
  try {
328
328
  const { results: f, nextPage: I } = await o.search({ query: s, nextPage: n ?? null });
329
- y(n ? (X) => {
330
- const Re = new Set(X.map((ue) => ue.id));
331
- return [...X, ...f.filter((ue) => !Re.has(ue.id))];
329
+ y(n ? (Y) => {
330
+ const Re = new Set(Y.map((ue) => ue.id));
331
+ return [...Y, ...f.filter((ue) => !Re.has(ue.id))];
332
332
  } : f), be(I), ge(I !== null);
333
333
  } catch (f) {
334
334
  ae(fs), xe.error("Error searching vectors:", f);
@@ -342,7 +342,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
342
342
  ie(() => {
343
343
  d && !m && k === "vector" && z.length === 0 && o && ye("");
344
344
  }, [d, k, o]);
345
- const Ye = (s) => {
345
+ const Xe = (s) => {
346
346
  s.preventDefault(), ye(m);
347
347
  }, Ae = fe(() => {
348
348
  L || !K || !j || ye(m, j);
@@ -382,9 +382,9 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
382
382
  const n = (f = s.target.files) == null ? void 0 : f[0];
383
383
  if (n && n.type.startsWith("image/")) {
384
384
  const I = new FileReader();
385
- I.onload = (X) => {
385
+ I.onload = (Y) => {
386
386
  var ue;
387
- const Re = (ue = X.target) == null ? void 0 : ue.result;
387
+ const Re = (ue = Y.target) == null ? void 0 : ue.result;
388
388
  T(Re);
389
389
  }, I.readAsDataURL(n);
390
390
  }
@@ -398,7 +398,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
398
398
  const s = await i(N);
399
399
  T(s);
400
400
  } catch (s) {
401
- ee(Ue), xe.error("Error removing background:", s);
401
+ ee(De), xe.error("Error removing background:", s);
402
402
  } finally {
403
403
  ne(!1);
404
404
  }
@@ -412,15 +412,15 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
412
412
  }
413
413
  l(!0), de(null), he(null);
414
414
  try {
415
- const X = (f = (n = (await g.generate({
415
+ const Y = (f = (n = (await g.generate({
416
416
  prompt: F,
417
417
  width: 1024,
418
418
  height: 1024,
419
419
  numberResults: 1
420
420
  })).images) == null ? void 0 : n[0]) == null ? void 0 : f.imageUrl;
421
- if (!X)
421
+ if (!Y)
422
422
  throw new Error(Ve);
423
- he(X);
423
+ he(Y);
424
424
  } catch (I) {
425
425
  de(gs(I, Ve)), xe.error("Error generating AI image:", I);
426
426
  } finally {
@@ -436,7 +436,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
436
436
  const s = await i(H);
437
437
  he(s);
438
438
  } catch (s) {
439
- ee(Ue), xe.error("Error removing background:", s);
439
+ ee(De), xe.error("Error removing background:", s);
440
440
  } finally {
441
441
  ne(!1);
442
442
  }
@@ -538,21 +538,21 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
538
538
  }
539
539
  ) }),
540
540
  c && /* @__PURE__ */ t(C.Panel, { id: "search", className: "sc:flex sc:flex-col", children: [
541
- /* @__PURE__ */ t("form", { onSubmit: Xe, className: "sc:sticky sc:top-0 sc:z-9 sc:flex sc:gap-2 sc:bg-surface sc:px-6 sc:pt-4 sc:pb-3", children: [
541
+ /* @__PURE__ */ t("form", { onSubmit: Ye, className: "sc:sticky sc:top-0 sc:z-9 sc:flex sc:gap-2 sc:bg-surface sc:px-6 sc:pt-4 sc:pb-3", children: [
542
542
  /* @__PURE__ */ e(Ie, { className: "sc:flex-1", "aria-label": "Search for images", children: /* @__PURE__ */ e(
543
543
  Ce,
544
544
  {
545
545
  type: "text",
546
546
  placeholder: "Search for images...",
547
547
  value: h,
548
- onChange: (s) => U(s.target.value),
548
+ onChange: (s) => D(s.target.value),
549
549
  variant: "subtle",
550
550
  "data-testid": "image-search-input"
551
551
  }
552
552
  ) }),
553
- /* @__PURE__ */ e(Y, { type: "submit", size: "icon", variant: "secondary", disabled: S, "aria-label": "Search", children: /* @__PURE__ */ e(p, { icon: me.search, className: "sc:size-5" }) }),
553
+ /* @__PURE__ */ e(X, { type: "submit", size: "icon", variant: "secondary", disabled: S, "aria-label": "Search", children: /* @__PURE__ */ e(p, { icon: me.search, className: "sc:size-5" }) }),
554
554
  /* @__PURE__ */ e(
555
- Y,
555
+ X,
556
556
  {
557
557
  size: "icon",
558
558
  variant: "secondary",
@@ -577,7 +577,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
577
577
  gridAutoRows: u === "bottom" ? "200px" : "120px",
578
578
  gap: hs
579
579
  },
580
- children: v.map((s, n) => /* @__PURE__ */ e("div", { className: es(s, n), style: ke, children: /* @__PURE__ */ e(De, { image: s, onImageSelect: ze, fixedHeight: !0 }) }, s.id))
580
+ children: v.map((s, n) => /* @__PURE__ */ e("div", { className: es(s, n), style: ke, children: /* @__PURE__ */ e(Ue, { image: s, onImageSelect: ze, fixedHeight: !0 }) }, s.id))
581
581
  }
582
582
  )
583
583
  ) : (
@@ -591,13 +591,13 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
591
591
  gridTemplateColumns: u === "bottom" ? "repeat(auto-fill, minmax(150px, 1fr))" : "repeat(auto-fill, minmax(120px, 1fr))",
592
592
  gap: Se
593
593
  },
594
- children: v.map((s) => /* @__PURE__ */ e("div", { style: { aspectRatio: "1 / 1", ...ke }, children: /* @__PURE__ */ e(De, { image: s, onImageSelect: ze, fixedHeight: !0 }) }, s.id))
594
+ children: v.map((s) => /* @__PURE__ */ e("div", { style: { aspectRatio: "1 / 1", ...ke }, children: /* @__PURE__ */ e(Ue, { image: s, onImageSelect: ze, fixedHeight: !0 }) }, s.id))
595
595
  }
596
596
  )
597
597
  ),
598
- D && /* @__PURE__ */ e("div", { ref: Ne, className: "sc:h-px" }),
598
+ U && /* @__PURE__ */ e("div", { ref: Ne, className: "sc:h-px" }),
599
599
  S && /* @__PURE__ */ e("div", { className: "sc:text-muted sc:py-4 sc:text-center sc:text-sm", children: "Loading more..." }),
600
- !D && !S && /* @__PURE__ */ e("div", { className: "sc:text-muted sc:py-6 sc:text-center sc:text-sm", children: "No more images" })
600
+ !U && !S && /* @__PURE__ */ e("div", { className: "sc:text-muted sc:py-6 sc:text-center sc:text-sm", children: "No more images" })
601
601
  ] }),
602
602
  !S && v.length === 0 && h && /* @__PURE__ */ t("div", { className: "sc:text-muted sc:px-6 sc:py-12 sc:text-center sc:text-sm", children: [
603
603
  'No images found for "',
@@ -664,7 +664,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
664
664
  )
665
665
  ] }),
666
666
  /* @__PURE__ */ e(
667
- Y,
667
+ X,
668
668
  {
669
669
  type: "submit",
670
670
  variant: "default",
@@ -681,7 +681,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
681
681
  /* @__PURE__ */ t("div", { className: "sc:flex sc:items-center sc:justify-between sc:gap-3", children: [
682
682
  /* @__PURE__ */ e("span", { className: "sc:text-xs sc:font-medium sc:uppercase sc:tracking-wider sc:text-muted-foreground", children: "Preview" }),
683
683
  i && /* @__PURE__ */ e(
684
- Y,
684
+ X,
685
685
  {
686
686
  onClick: Ze,
687
687
  disabled: B || !N.trim(),
@@ -723,7 +723,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
723
723
  ] })
724
724
  ] }),
725
725
  o && /* @__PURE__ */ t(C.Panel, { id: "vector", className: "sc:flex sc:flex-col", children: [
726
- /* @__PURE__ */ t("form", { onSubmit: Ye, className: "sc:sticky sc:top-0 sc:z-9 sc:flex sc:gap-2 sc:bg-surface sc:px-6 sc:pt-4 sc:pb-3", children: [
726
+ /* @__PURE__ */ t("form", { onSubmit: Xe, className: "sc:sticky sc:top-0 sc:z-9 sc:flex sc:gap-2 sc:bg-surface sc:px-6 sc:pt-4 sc:pb-3", children: [
727
727
  /* @__PURE__ */ e(Ie, { className: "sc:flex-1", "aria-label": "Search for vector graphics", children: /* @__PURE__ */ e(
728
728
  Ce,
729
729
  {
@@ -735,9 +735,9 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
735
735
  "data-testid": "vector-search-input"
736
736
  }
737
737
  ) }),
738
- /* @__PURE__ */ e(Y, { type: "submit", size: "icon", variant: "secondary", disabled: L, "aria-label": "Search", children: /* @__PURE__ */ e(p, { icon: me.search, className: "sc:size-5" }) }),
738
+ /* @__PURE__ */ e(X, { type: "submit", size: "icon", variant: "secondary", disabled: L, "aria-label": "Search", children: /* @__PURE__ */ e(p, { icon: me.search, className: "sc:size-5" }) }),
739
739
  /* @__PURE__ */ e(
740
- Y,
740
+ X,
741
741
  {
742
742
  size: "icon",
743
743
  variant: "secondary",
@@ -808,7 +808,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
808
808
  )
809
809
  ] }),
810
810
  /* @__PURE__ */ e(
811
- Y,
811
+ X,
812
812
  {
813
813
  type: "submit",
814
814
  variant: "default",
@@ -842,7 +842,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
842
842
  ] }),
843
843
  /* @__PURE__ */ t("div", { className: "sc:flex sc:flex-col sc:gap-3", children: [
844
844
  i && /* @__PURE__ */ e(
845
- Y,
845
+ X,
846
846
  {
847
847
  onClick: Oe,
848
848
  disabled: B || !H,
@@ -861,7 +861,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
861
861
  ),
862
862
  oe && /* @__PURE__ */ e("div", { className: "sc:border-danger sc:bg-danger/10 sc:text-danger sc:rounded-xl sc:border-2 sc:px-3 sc:py-2 sc:text-xs", children: oe }),
863
863
  /* @__PURE__ */ e(
864
- Y,
864
+ X,
865
865
  {
866
866
  onClick: Ke,
867
867
  variant: "default",
@@ -889,7 +889,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
889
889
  services: c
890
890
  }) => {
891
891
  var z;
892
- const { elements: g, setElements: o, canvasEditorRef: i, artboardManager: b, executeAddElement: h, executeElementUpdate: U } = ts(), { selectedId: N, setSelectedId: T } = cs(), { activeArtboardId: v } = os(), w = Ge(), S = je(() => {
892
+ const { elements: g, setElements: o, canvasEditorRef: i, artboardManager: b, executeAddElement: h, executeElementUpdate: D } = ts(), { selectedId: N, setSelectedId: T } = cs(), { activeArtboardId: v } = os(), w = Ge(), S = je(() => {
893
893
  if (w.ingestImage) return w.ingestImage;
894
894
  if (c != null && c.ingestImage) return c.ingestImage;
895
895
  if (c != null && c.ingestImageUrl) return is(c.ingestImageUrl);
@@ -899,7 +899,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
899
899
  se.current = g;
900
900
  const Q = M(N);
901
901
  Q.current = N;
902
- const [k, te] = r(null), $ = u ?? k, _ = A ?? te, [D, ce] = r(!1), q = fe(
902
+ const [k, te] = r(null), $ = u ?? k, _ = A ?? te, [U, ce] = r(!1), q = fe(
903
903
  async (y) => {
904
904
  var ve, F;
905
905
  const L = W.current;
@@ -921,7 +921,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
921
921
  l.imageUrl = y, l.transformData.cropX = 0, l.transformData.cropY = 0, l.transformData.cropWidth = 1, l.transformData.cropHeight = 1, l.transformData.flipHorizontal = !1, l.transformData.flipVertical = !1, l.transformData.borderRadius = 0, l.imageLoaded = !1, l.imageElement = null, l.isCropping = !1, l.preserveDimensions = !1, l.transformData.width = de, l.transformData.height = H, l.onLoadCallback = (he) => {
922
922
  const B = he, ne = B.transformData.width, oe = B.transformData.height, ee = Math.min(de / ne, H / oe, 1);
923
923
  ee < 1 && (B.transformData.width = ne * ee, B.transformData.height = oe * ee), o((Ne) => Ne.map((pe) => pe.id === B.id ? B : pe));
924
- }, l.loadImage(y), U(V, l), E && E(l);
924
+ }, l.loadImage(y), D(V, l), E && E(l);
925
925
  }
926
926
  _(null);
927
927
  return;
@@ -952,7 +952,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
952
952
  // to prevent callback recreation on every context update
953
953
  b,
954
954
  h,
955
- U,
955
+ D,
956
956
  v,
957
957
  i,
958
958
  o,
@@ -973,7 +973,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
973
973
  onToggle: R,
974
974
  onImageSelect: q,
975
975
  currentImageUrl: m,
976
- busy: D
976
+ busy: U
977
977
  }
978
978
  );
979
979
  return c ? /* @__PURE__ */ e(ls, { services: c, children: Z }) : Z;
@@ -981,4 +981,4 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
981
981
  export {
982
982
  ks as ImagePanel
983
983
  };
984
- //# sourceMappingURL=ImagePanel-DLxIDKV-.js.map
984
+ //# sourceMappingURL=ImagePanel-BaX0UE-L.js.map