@snowcone-app/canvas 0.15.0 → 0.17.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 (73) hide show
  1. package/dist/{CanvasStateV1-BQD8fCBU.js → CanvasStateV1-C6i6vU6p.js} +63 -63
  2. package/dist/{CanvasStateV1-BQD8fCBU.js.map → CanvasStateV1-C6i6vU6p.js.map} +1 -1
  3. package/dist/EditorCanvasImpl-DkgE5-C2.js +68 -0
  4. package/dist/EditorCanvasImpl-DkgE5-C2.js.map +1 -0
  5. package/dist/EditorContext-CyanYzo2.js +1131 -0
  6. package/dist/EditorContext-CyanYzo2.js.map +1 -0
  7. package/dist/{ImportManager-eotl7r5d.js → ElementFactory-C05JJkRp.js} +1510 -5121
  8. package/dist/ElementFactory-C05JJkRp.js.map +1 -0
  9. package/dist/{HybridHistoryManager-NL3zyEl4.js → HybridHistoryManager-Bht98XRv.js} +98 -98
  10. package/dist/{HybridHistoryManager-NL3zyEl4.js.map → HybridHistoryManager-Bht98XRv.js.map} +1 -1
  11. package/dist/ImportManager-kRYfIX-D.js +3617 -0
  12. package/dist/ImportManager-kRYfIX-D.js.map +1 -0
  13. package/dist/SnowconeCanvas-C3eZ9PP8.js +1047 -0
  14. package/dist/SnowconeCanvas-C3eZ9PP8.js.map +1 -0
  15. package/dist/ThemeContext-Rjz25x9X.js +75 -0
  16. package/dist/ThemeContext-Rjz25x9X.js.map +1 -0
  17. package/dist/UnifiedFontService-BAtqqkU4.js +1478 -0
  18. package/dist/UnifiedFontService-BAtqqkU4.js.map +1 -0
  19. package/dist/advanced.mjs +210 -207
  20. package/dist/advanced.mjs.map +1 -1
  21. package/dist/api/embed.d.ts +8 -4
  22. package/dist/api/testing.d.ts +1 -0
  23. package/dist/components/editor/EditorBuy.d.ts +49 -0
  24. package/dist/components/editor/EditorCanvas.d.ts +30 -0
  25. package/dist/components/editor/EditorCanvasImpl.d.ts +33 -0
  26. package/dist/components/editor/EditorPreview.d.ts +39 -0
  27. package/dist/components/editor/EditorRoot.d.ts +86 -0
  28. package/dist/components/editor/EditorTextField.d.ts +22 -0
  29. package/dist/components/editor/RootInternals.d.ts +77 -0
  30. package/dist/components/editor/designStateStore.d.ts +45 -0
  31. package/dist/components/editor/index.d.ts +23 -0
  32. package/dist/components/embed-realtime/RealtimeCanvas.d.ts +1 -1
  33. package/dist/components/embed-realtime/RealtimeEmbed.d.ts +5 -78
  34. package/dist/components/embed-realtime/RealtimeMockup.d.ts +5 -34
  35. package/dist/components/embed-realtime/context.d.ts +12 -2
  36. package/dist/components/embed-realtime/validateEmbed.d.ts +17 -3
  37. package/dist/contexts/EditorContext.d.ts +1 -0
  38. package/dist/design/design-builder.d.ts +81 -6
  39. package/dist/editorError-DMENTZ-3.js +19 -0
  40. package/dist/editorError-DMENTZ-3.js.map +1 -0
  41. package/dist/editorErrors-DbIEtCTt.js +29 -0
  42. package/dist/editorErrors-DbIEtCTt.js.map +1 -0
  43. package/dist/embed-Bdj4PKUA.js +737 -0
  44. package/dist/embed-Bdj4PKUA.js.map +1 -0
  45. package/dist/embed.mjs +38 -230
  46. package/dist/embed.mjs.map +1 -1
  47. package/dist/errors/editorError.d.ts +57 -0
  48. package/dist/iconify-D6eVIEy4.js +1089 -0
  49. package/dist/iconify-D6eVIEy4.js.map +1 -0
  50. package/dist/index.mjs +48 -46
  51. package/dist/index.mjs.map +1 -1
  52. package/dist/internals.mjs +105 -104
  53. package/dist/internals.mjs.map +1 -1
  54. package/dist/rendering/PieceGuideRenderer.d.ts +2 -16
  55. package/dist/template-fields-GOM4MNfq.js +643 -0
  56. package/dist/template-fields-GOM4MNfq.js.map +1 -0
  57. package/dist/testing/editorErrors.d.ts +30 -0
  58. package/dist/testing.mjs +28 -23
  59. package/dist/testing.mjs.map +1 -1
  60. package/dist/{usePieceGuideBundle-Cyl695jv.js → usePieceGuideBundle-CGERAQJl.js} +2 -2
  61. package/dist/{usePieceGuideBundle-Cyl695jv.js.map → usePieceGuideBundle-CGERAQJl.js.map} +1 -1
  62. package/dist/utils/inkLuminance.d.ts +38 -0
  63. package/dist/validation-DEd6EOCP.js +19947 -0
  64. package/dist/validation-DEd6EOCP.js.map +1 -0
  65. package/dist/workers/export-worker.bundle.string.d.ts +1 -1
  66. package/package.json +9 -4
  67. package/dist/ImportManager-eotl7r5d.js.map +0 -1
  68. package/dist/ThemeContext-Cl1JPVLZ.js +0 -1158
  69. package/dist/ThemeContext-Cl1JPVLZ.js.map +0 -1
  70. package/dist/template-fields-coO73lV3.js +0 -1632
  71. package/dist/template-fields-coO73lV3.js.map +0 -1
  72. package/dist/validation-BahKiJWj.js +0 -22973
  73. package/dist/validation-BahKiJWj.js.map +0 -1
package/dist/advanced.mjs CHANGED
@@ -1,16 +1,19 @@
1
- import { D as te, T as D, i as M, B as re, I as q, j as I, r as ne, v as se, k as ae, l as oe, m as ie, n as ce, e as le } from "./validation-BahKiJWj.js";
2
- import { o as st, p as at, q as ot, s as it, t as ct, w as lt, x as dt, y as ut, z as mt, F as ft, G as ht, H as pt, J as gt, K as xt, L as bt, N as yt, O as vt, Q as wt, R as St, S as Ct, U as Et, V as Tt, W as $t, X as kt, Y as At, Z as Ft, _ as Pt, $ as Nt, a0 as Rt, a1 as Bt, a2 as Dt, a3 as Mt, a4 as It, a5 as zt, a6 as Ot, a7 as Lt, a8 as Wt, a9 as Kt, aa as _t, ab as Gt, ac as Ut, ad as jt, ae as Jt, af as qt, ag as Vt, ah as Xt, ai as Yt, aj as Zt, ak as Ht, al as Qt, am as er, an as tr, ao as rr, ap as nr } from "./validation-BahKiJWj.js";
3
- import { u as V } from "./ThemeContext-Cl1JPVLZ.js";
4
- import { E as ar, P as or, T as ir, p as cr, s as lr, b as dr, c as ur, d as mr, e as fr, f as hr, g as pr, a as gr } from "./ThemeContext-Cl1JPVLZ.js";
5
- import { c as de, G as ue, F as me, g as fe, r as he, u as pe } from "./HybridHistoryManager-NL3zyEl4.js";
6
- import { A as br, B as yr, I as vr, P as wr, R as Sr, S as Cr, T as Er, h as Tr, a as $r, b as kr, i as Ar, d as Fr, e as Pr, f as Nr, j as Rr, k as Br, l as Dr, m as Mr, n as Ir, o as zr, p as Or, q as Lr, s as Wr, t as Kr, v as _r, w as Gr, x as Ur } from "./HybridHistoryManager-NL3zyEl4.js";
7
- import { I as ge } from "./ImportManager-eotl7r5d.js";
8
- import { i as Jr, a as qr, b as Vr, c as Xr, d as Yr } from "./ImportManager-eotl7r5d.js";
9
- import { useState as A, useCallback as y, useEffect as X, useMemo as Y, useRef as B, memo as xe } from "react";
10
- import { jsxs as b, jsx as o, Fragment as be } from "react/jsx-runtime";
11
- import { e as ye, c as ve } from "./compose-DtQL_oit.js";
12
- import { P as Hr, p as Qr, u as en } from "./usePieceGuideBundle-Cyl695jv.js";
13
- const Me = ({
1
+ import { e as te } from "./UnifiedFontService-BAtqqkU4.js";
2
+ import { D as re, T as D, a as M, B as ne, b as I, r as se, v as ae, c as oe, d as ie, e as ce, f as le } from "./validation-DEd6EOCP.js";
3
+ import { g as ot, h as it, i as ct, j as lt, k as dt, l as ut, m as mt, n as ft, o as ht, p as pt, q as xt, s as gt, t as bt, u as yt, F as vt, w as wt, G as St, I as Ct, x as Et, y as Tt, K as $t, z as kt, L as At, H as Ft, J as Pt, N as Nt, O as Rt, Q as Bt, S as Dt, R as Mt, U as It, V as zt, W as Ot, X as Lt, Y as Wt, Z as Kt, _ as _t, $ as Gt, a0 as Ut, a1 as jt, a2 as Jt, a3 as qt, a4 as Vt, a5 as Xt, a6 as Yt, a7 as Zt, a8 as Ht, a9 as Qt, aa as er, ab as tr, ac as rr, ad as nr, ae as sr, af as ar } from "./validation-DEd6EOCP.js";
4
+ import { u as q } from "./EditorContext-CyanYzo2.js";
5
+ import { E as ir, P as cr, p as lr, s as dr, b as ur, c as mr, d as fr, e as hr, f as pr, a as xr } from "./EditorContext-CyanYzo2.js";
6
+ import { T as br, u as yr } from "./ThemeContext-Rjz25x9X.js";
7
+ import { c as de, G as ue, F as me, g as fe, r as he, u as pe } from "./HybridHistoryManager-Bht98XRv.js";
8
+ import { A as wr, B as Sr, I as Cr, P as Er, R as Tr, S as $r, T as kr, h as Ar, a as Fr, b as Pr, i as Nr, d as Rr, e as Br, f as Dr, j as Mr, k as Ir, l as zr, m as Or, n as Lr, o as Wr, p as Kr, q as _r, s as Gr, t as Ur, v as jr, w as Jr, x as qr } from "./HybridHistoryManager-Bht98XRv.js";
9
+ import { I as xe } from "./ImportManager-kRYfIX-D.js";
10
+ import { i as Xr, a as Yr, b as Zr, c as Hr, d as Qr } from "./ImportManager-kRYfIX-D.js";
11
+ import { useState as A, useCallback as y, useEffect as V, useMemo as X, useRef as B, memo as ge } from "react";
12
+ import { e as be, c as ye } from "./compose-DtQL_oit.js";
13
+ import { jsxs as b, jsx as o, Fragment as ve } from "react/jsx-runtime";
14
+ import { P as tn, p as rn, u as nn } from "./usePieceGuideBundle-CGERAQJl.js";
15
+ import { Icon as Y } from "./iconify-D6eVIEy4.js";
16
+ const ze = ({
14
17
  title: e,
15
18
  icon: t,
16
19
  children: r,
@@ -56,7 +59,7 @@ const Me = ({
56
59
  ] }),
57
60
  w && /* @__PURE__ */ o("div", { className: "sc:mt-xl sc:flex sc:flex-col sc:gap-xl", children: r })
58
61
  ] });
59
- }, Ie = ({
62
+ }, Oe = ({
60
63
  label: e,
61
64
  labelSuffix: t,
62
65
  children: r,
@@ -69,7 +72,7 @@ const Me = ({
69
72
  ] }),
70
73
  /* @__PURE__ */ o("div", { className: a ? "sc:flex-shrink-0" : "", children: r })
71
74
  ] });
72
- function ze({
75
+ function Le({
73
76
  options: e,
74
77
  value: t,
75
78
  onChange: r,
@@ -94,7 +97,7 @@ function ze({
94
97
  );
95
98
  }) });
96
99
  }
97
- const Oe = ({ label: e, icon: t, checked: r, onChange: a, disabled: n = !1, className: s = "" }) => {
100
+ const We = ({ label: e, icon: t, checked: r, onChange: a, disabled: n = !1, className: s = "" }) => {
98
101
  const i = (m) => {
99
102
  a(m.target.checked);
100
103
  };
@@ -120,7 +123,7 @@ const Oe = ({ label: e, icon: t, checked: r, onChange: a, disabled: n = !1, clas
120
123
  ]
121
124
  }
122
125
  );
123
- }, Le = ({
126
+ }, Ke = ({
124
127
  checked: e,
125
128
  onChange: t,
126
129
  label: r,
@@ -162,26 +165,26 @@ const Oe = ({ label: e, icon: t, checked: r, onChange: a, disabled: n = !1, clas
162
165
  ]
163
166
  }
164
167
  );
165
- }, We = ({
168
+ }, _e = ({
166
169
  isOpen: e,
167
170
  onToggle: t,
168
171
  trigger: r,
169
172
  children: a
170
173
  }) => /* @__PURE__ */ o(
171
- te,
174
+ re,
172
175
  {
173
176
  isOpen: e,
174
177
  onToggle: t,
175
178
  trigger: r || /* @__PURE__ */ b(D, { delayDuration: 0, children: [
176
179
  /* @__PURE__ */ o(M, { asChild: !0, children: /* @__PURE__ */ o(
177
- re,
180
+ ne,
178
181
  {
179
182
  variant: "ghost",
180
183
  size: "toolbar",
181
184
  onClick: (s) => {
182
185
  s.stopPropagation(), t(!e);
183
186
  },
184
- children: /* @__PURE__ */ o(q, { icon: "lucide:ellipsis-vertical", className: "sc:size-6" })
187
+ children: /* @__PURE__ */ o(Y, { icon: "lucide:ellipsis-vertical", className: "sc:size-6" })
185
188
  }
186
189
  ) }),
187
190
  /* @__PURE__ */ o(I, { children: /* @__PURE__ */ o("p", { children: "More" }) })
@@ -192,7 +195,7 @@ const Oe = ({ label: e, icon: t, checked: r, onChange: a, disabled: n = !1, clas
192
195
  children: /* @__PURE__ */ o("div", { className: "sc:flex sc:items-center sc:gap-sm sc:bg-bg-primary sc:border sc:border-border-primary sc:rounded-xl sc:px-xl sc:py-md sc:shadow-sm sc:h-[52px]", children: a })
193
196
  }
194
197
  );
195
- function Ke(e) {
198
+ function Ge(e) {
196
199
  const t = {
197
200
  name: e.name,
198
201
  capabilities: {
@@ -217,18 +220,18 @@ function Ke(e) {
217
220
  };
218
221
  return e.content && (t.content = { ...e.content }), t;
219
222
  }
220
- function _e(e) {
223
+ function Ue(e) {
221
224
  if (!e.name || e.name.trim() === "")
222
225
  throw new Error("[loadKitFromJSON] Kit name is required");
223
226
  const t = {};
224
227
  e.capabilities && (t.capabilities = e.capabilities), e.behavior && (t.behavior = e.behavior), e.layout && (t.layout = e.layout), e.style && (t.style = e.style), e.content && (t.content = e.content);
225
228
  let r;
226
229
  if (e.extends) {
227
- const n = ne(e.extends);
228
- r = ye(n, { name: e.name, ...t });
230
+ const n = se(e.extends);
231
+ r = be(n, { name: e.name, ...t });
229
232
  } else
230
- r = ve({ name: e.name, ...t });
231
- const a = se(r);
233
+ r = ye({ name: e.name, ...t });
234
+ const a = ae(r);
232
235
  if (a.warnings.length > 0)
233
236
  for (const n of a.warnings)
234
237
  console.warn(`[loadKitFromJSON] Warning: ${n}`);
@@ -241,19 +244,19 @@ ${a.errors.join(`
241
244
  return r;
242
245
  }
243
246
  const L = de("useProjectLoader");
244
- function Ge() {
247
+ function je() {
245
248
  const {
246
249
  handleLoadWorkspace: e
247
- } = V(), [t, r] = A(!1), [a, n] = A(null), [s, i] = A(null), [m, l] = A(null), f = y(async (d) => {
250
+ } = q(), [t, r] = A(!1), [a, n] = A(null), [s, i] = A(null), [m, l] = A(null), f = y(async (d) => {
248
251
  r(!0), n(null);
249
252
  try {
250
253
  const c = typeof d == "string" ? JSON.parse(d) : d;
251
254
  if (!c.artboards || !Array.isArray(c.artboards))
252
255
  throw new Error("Invalid document format: missing artboards array");
253
- const g = JSON.stringify(c), S = new Blob([g], { type: "application/json" }), C = new File([S], "project.json", { type: "application/json" }), x = await ge.importFromJSON(C);
254
- if (!x.success || !x.artboards || !x.elements)
255
- throw new Error(x.error || "Failed to import project");
256
- e(x.artboards, x.elements, x.activeArtboardId || null), i(c);
256
+ const x = JSON.stringify(c), S = new Blob([x], { type: "application/json" }), C = new File([S], "project.json", { type: "application/json" }), g = await xe.importFromJSON(C);
257
+ if (!g.success || !g.artboards || !g.elements)
258
+ throw new Error(g.error || "Failed to import project");
259
+ e(g.artboards, g.elements, g.activeArtboardId || null), i(c);
257
260
  const u = c.artboards.reduce((p, k) => {
258
261
  var v;
259
262
  return p + (((v = k.elements) == null ? void 0 : v.length) || 0);
@@ -288,15 +291,15 @@ function Ge() {
288
291
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
289
292
  appVersion: "1.0.0"
290
293
  },
291
- artboards: d.artboards.map((g, S) => ({
294
+ artboards: d.artboards.map((x, S) => ({
292
295
  id: `artboard-${Date.now()}-${S}`,
293
- name: g.name,
296
+ name: x.name,
294
297
  x: 0,
295
298
  y: 0,
296
- width: g.width,
297
- height: g.height,
298
- backgroundColor: g.backgroundColor,
299
- elements: g.elements || []
299
+ width: x.width,
300
+ height: x.height,
301
+ backgroundColor: x.backgroundColor,
302
+ elements: x.elements || []
300
303
  })),
301
304
  activeArtboardId: null
302
305
  // First artboard will be active by default
@@ -329,19 +332,19 @@ const U = {
329
332
  function we(e, t) {
330
333
  return e >= t.xxl ? "xxl" : e >= t.xl ? "xl" : e >= t.lg ? "lg" : e >= t.md ? "md" : e >= t.sm ? "sm" : "xs";
331
334
  }
332
- function Ue(e) {
335
+ function Je(e) {
333
336
  const t = {
334
337
  ...U,
335
338
  ...e
336
339
  }, [r, a] = A(() => typeof window < "u" ? window.innerWidth : U.lg);
337
- X(() => {
340
+ V(() => {
338
341
  if (typeof window > "u") return;
339
- const g = () => {
342
+ const x = () => {
340
343
  a(window.innerWidth);
341
344
  };
342
- return window.addEventListener("resize", g), () => window.removeEventListener("resize", g);
345
+ return window.addEventListener("resize", x), () => window.removeEventListener("resize", x);
343
346
  }, []);
344
- const n = Y(
347
+ const n = X(
345
348
  () => we(r, t),
346
349
  [r, t]
347
350
  ), s = n === "xs", i = n === "sm", m = n === "md", l = n === "lg", f = n === "xl", w = n === "xxl", h = ["xs", "sm", "md", "lg", "xl", "xxl"];
@@ -354,12 +357,12 @@ function Ue(e) {
354
357
  isLg: l,
355
358
  isXl: f,
356
359
  isXxl: w,
357
- isAtLeast: (g) => {
358
- const S = h.indexOf(n), C = h.indexOf(g);
360
+ isAtLeast: (x) => {
361
+ const S = h.indexOf(n), C = h.indexOf(x);
359
362
  return S >= C;
360
363
  },
361
- isAtMost: (g) => {
362
- const S = h.indexOf(n), C = h.indexOf(g);
364
+ isAtMost: (x) => {
365
+ const S = h.indexOf(n), C = h.indexOf(x);
363
366
  return S <= C;
364
367
  }
365
368
  };
@@ -373,7 +376,7 @@ const j = {
373
376
  exportCount: 0,
374
377
  avgExportTime: 0
375
378
  };
376
- function je() {
379
+ function qe() {
377
380
  const [e, t] = A(j), [r, a] = A(!1), n = B([]), s = B([]), i = B([]), m = B(performance.now()), l = B(null), f = y((u) => u.length === 0 ? 0 : 1e3 / (u.reduce((k, v) => k + v, 0) / u.length), []), w = y((u) => u.length === 0 ? 0 : u.reduce((p, k) => p + k, 0) / u.length, []), h = y(() => "memory" in performance && performance.memory ? performance.memory.usedJSHeapSize / (1024 * 1024) : 0, []), d = y(() => {
378
381
  const u = {
379
382
  fps: f(n.current),
@@ -389,13 +392,13 @@ function je() {
389
392
  }, [f, w, h]), c = y(() => {
390
393
  const u = performance.now(), p = u - m.current;
391
394
  m.current = u, n.current.push(p), n.current.length > 60 && n.current.shift(), n.current.length % 30 === 0 && d(), r && (l.current = requestAnimationFrame(c));
392
- }, [r, d]), g = y(() => {
395
+ }, [r, d]), x = y(() => {
393
396
  a(!0), m.current = performance.now(), l.current = requestAnimationFrame(c);
394
397
  }, [c]), S = y(() => {
395
398
  a(!1), l.current !== null && (cancelAnimationFrame(l.current), l.current = null);
396
399
  }, []), C = y(() => {
397
400
  n.current = [], s.current = [], i.current = [], t(j);
398
- }, []), x = y(() => `
401
+ }, []), g = y(() => `
399
402
  Performance Report
400
403
  ==================
401
404
  FPS: ${e.fps.toFixed(1)}
@@ -406,22 +409,22 @@ Element Count: ${e.elementCount}
406
409
  Export Count: ${e.exportCount}
407
410
  Avg Export Time: ${e.avgExportTime.toFixed(2)}ms
408
411
  `.trim(), [e]);
409
- return X(() => () => {
412
+ return V(() => () => {
410
413
  l.current !== null && cancelAnimationFrame(l.current);
411
414
  }, []), {
412
415
  metrics: e,
413
- startProfiling: g,
416
+ startProfiling: x,
414
417
  stopProfiling: S,
415
418
  clearMetrics: C,
416
- getReport: x,
419
+ getReport: g,
417
420
  isProfiling: r
418
421
  };
419
422
  }
420
- function Je(e) {
421
- const { getElementById: t } = V();
423
+ function Ve(e) {
424
+ const { getElementById: t } = q();
422
425
  return e ? t(e) ?? null : null;
423
426
  }
424
- function qe(e) {
427
+ function Xe(e) {
425
428
  const {
426
429
  onReorder: t,
427
430
  onGroupReorder: r,
@@ -429,14 +432,14 @@ function qe(e) {
429
432
  onDropIntoGroupAtPosition: n,
430
433
  findElement: s,
431
434
  findParentGroup: i
432
- } = e, [m, l] = A(null), [f, w] = A(null), [h, d] = A(null), c = y((x, u) => {
433
- x.dataTransfer.effectAllowed = "move", requestAnimationFrame(() => {
435
+ } = e, [m, l] = A(null), [f, w] = A(null), [h, d] = A(null), c = y((g, u) => {
436
+ g.dataTransfer.effectAllowed = "move", requestAnimationFrame(() => {
434
437
  l(u);
435
438
  });
436
- }, []), g = y(
437
- (x, u) => {
438
- x.preventDefault(), x.dataTransfer.dropEffect = "move";
439
- const p = x.currentTarget.getBoundingClientRect(), v = x.clientY - p.top, F = p.height, z = (s == null ? void 0 : s(u)) instanceof ue;
439
+ }, []), x = y(
440
+ (g, u) => {
441
+ g.preventDefault(), g.dataTransfer.dropEffect = "move";
442
+ const p = g.currentTarget.getBoundingClientRect(), v = g.clientY - p.top, F = p.height, z = (s == null ? void 0 : s(u)) instanceof ue;
440
443
  let $;
441
444
  z ? v < F * 0.25 ? $ = "before" : v > F * 0.75 ? $ = "after" : $ = "into" : v < F * 0.4 ? $ = "before" : v > F * 0.6 ? $ = "after" : $ = v < F / 2 ? "before" : "after", w(u), d($);
442
445
  },
@@ -444,8 +447,8 @@ function qe(e) {
444
447
  ), S = y(() => {
445
448
  l(null), w(null), d(null);
446
449
  }, []), C = y(
447
- (x, u) => {
448
- if (x.preventDefault(), !m || m === u || !h) {
450
+ (g, u) => {
451
+ if (g.preventDefault(), !m || m === u || !h) {
449
452
  S();
450
453
  return;
451
454
  }
@@ -474,13 +477,13 @@ function qe(e) {
474
477
  dropPosition: h,
475
478
  handlers: {
476
479
  onDragStart: c,
477
- onDragOver: g,
480
+ onDragOver: x,
478
481
  onDrop: C,
479
482
  onDragEnd: S
480
483
  }
481
484
  };
482
485
  }
483
- function Ve(e) {
486
+ function Ye(e) {
484
487
  const { selectedId: t, multiSelection: r, onSelectionChange: a, onMultiSelectionChange: n } = e, s = y(
485
488
  (m) => m === t || r.includes(m),
486
489
  [t, r]
@@ -506,13 +509,13 @@ function Ve(e) {
506
509
  );
507
510
  return { isSelected: s, handleClick: i };
508
511
  }
509
- const Se = xe(({ value: e, onChange: t, fontSizes: r, isOpen: a, onToggle: n }) => {
512
+ const Se = ge(({ value: e, onChange: t, fontSizes: r, isOpen: a, onToggle: n }) => {
510
513
  const s = (i) => {
511
514
  t(i), n(!1);
512
515
  };
513
- return /* @__PURE__ */ b(ae, { open: a, onOpenChange: n, children: [
514
- /* @__PURE__ */ o(oe, { asChild: !0, children: /* @__PURE__ */ o("button", { className: "sc-toolbar-btn", "aria-label": "Font size", children: /* @__PURE__ */ o(q, { icon: "radix-icons:font-size", className: "sc:size-5" }) }) }),
515
- /* @__PURE__ */ o(ie, { className: "sc:w-[120px] sc:max-h-[300px] sc:overflow-y-auto sc:p-1", maxZIndex: !0, children: /* @__PURE__ */ o("div", { className: "sc:flex sc:flex-col sc:gap-0.5", children: r.map((i) => /* @__PURE__ */ o(
516
+ return /* @__PURE__ */ b(oe, { open: a, onOpenChange: n, children: [
517
+ /* @__PURE__ */ o(ie, { asChild: !0, children: /* @__PURE__ */ o("button", { className: "sc-toolbar-btn", "aria-label": "Font size", children: /* @__PURE__ */ o(Y, { icon: "radix-icons:font-size", className: "sc:size-5" }) }) }),
518
+ /* @__PURE__ */ o(ce, { className: "sc:w-[120px] sc:max-h-[300px] sc:overflow-y-auto sc:p-1", maxZIndex: !0, children: /* @__PURE__ */ o("div", { className: "sc:flex sc:flex-col sc:gap-0.5", children: r.map((i) => /* @__PURE__ */ o(
516
519
  "button",
517
520
  {
518
521
  onClick: () => s(i),
@@ -524,7 +527,7 @@ const Se = xe(({ value: e, onChange: t, fontSizes: r, isOpen: a, onToggle: n })
524
527
  ] });
525
528
  });
526
529
  Se.displayName = "FontSizeDropdown";
527
- function Xe({ toolbar: e }) {
530
+ function Ze({ toolbar: e }) {
528
531
  const { fontSize: t, handleFontSizeIncrement: r, handleFontSizeChange: a } = e, [n, s] = A(!1);
529
532
  return /* @__PURE__ */ b("div", { className: "sc-toolbar-group", children: [
530
533
  /* @__PURE__ */ b(D, { delayDuration: 300, children: [
@@ -538,7 +541,7 @@ function Xe({ toolbar: e }) {
538
541
  {
539
542
  className: "sc-toolbar-font-size-display",
540
543
  onClick: () => {
541
- ce.protectNextClick(), s(!n);
544
+ le.protectNextClick(), s(!n);
542
545
  },
543
546
  children: t
544
547
  }
@@ -581,7 +584,7 @@ function Xe({ toolbar: e }) {
581
584
  ] });
582
585
  }
583
586
  const _ = /* @__PURE__ */ new Map();
584
- function Ye(e) {
587
+ function He(e) {
585
588
  if (!e.type || typeof e.type != "string")
586
589
  throw new Error('ElementTypeRegistration requires a non-empty "type" string');
587
590
  if (typeof e.Component != "function")
@@ -598,13 +601,13 @@ function Ye(e) {
598
601
  Component: e.Component
599
602
  }), _.set(e.type, { ...e });
600
603
  }
601
- function Ze(e) {
604
+ function Qe(e) {
602
605
  pe(e), _.delete(e);
603
606
  }
604
- function He() {
607
+ function et() {
605
608
  return Array.from(_.values());
606
609
  }
607
- function Qe(e) {
610
+ function tt(e) {
608
611
  return fe(e) !== void 0;
609
612
  }
610
613
  class Ce {
@@ -698,7 +701,7 @@ class Ce {
698
701
  }
699
702
  }
700
703
  const Ee = new Ce();
701
- function et() {
704
+ function rt() {
702
705
  return Ee;
703
706
  }
704
707
  const W = {
@@ -842,7 +845,7 @@ function ke(e, t, r, a) {
842
845
  }
843
846
  return null;
844
847
  }
845
- function tt({
848
+ function nt({
846
849
  artboardWidth: e,
847
850
  artboardHeight: t,
848
851
  canvasPadding: r = 0,
@@ -852,7 +855,7 @@ function tt({
852
855
  style: i,
853
856
  className: m
854
857
  }) {
855
- const l = Y(() => {
858
+ const l = X(() => {
856
859
  const d = Math.max(
857
860
  16,
858
861
  Math.round(Math.min(e, t) * 0.03)
@@ -879,7 +882,7 @@ function tt({
879
882
  className: m,
880
883
  style: { pointerEvents: "none", width: "100%", height: "100%" },
881
884
  children: /* @__PURE__ */ o("g", { transform: `translate(${r} ${r})`, children: a.map((d) => {
882
- const c = n == null ? void 0 : n[d.id], g = (c == null ? void 0 : c.zones) ?? [], S = (c == null ? void 0 : c.labels) ?? [], C = d.rotation ?? 0, x = C === 90 || C === 270, u = x ? d.height : d.width, p = x ? d.width : d.height, k = $e(c, u, p), v = ke(c, d, u, p), F = `translate(${d.x} ${d.y})`;
885
+ const c = n == null ? void 0 : n[d.id], x = (c == null ? void 0 : c.zones) ?? [], S = (c == null ? void 0 : c.labels) ?? [], C = d.rotation ?? 0, g = C === 90 || C === 270, u = g ? d.height : d.width, p = g ? d.width : d.height, k = $e(c, u, p), v = ke(c, d, u, p), F = `translate(${d.x} ${d.y})`;
883
886
  let N = "";
884
887
  C === 90 ? N = `translate(${d.width} 0) rotate(90)` : C === 180 ? N = `translate(${d.width} ${d.height}) rotate(180)` : C === 270 && (N = `translate(0 ${d.height}) rotate(270)`);
885
888
  const z = N ? `${F} ${N}` : F, $ = l.safeAreaWashCornerRadius < 0 ? Math.round(Math.min(u, p) * 0.02) : l.safeAreaWashCornerRadius, P = c != null && c.boundary && (c.boundary.kind === "rect" || c.boundary.kind === "roundedRect") ? c.boundary : null, O = P ? P.kind === "rect" && $ > 0 ? {
@@ -912,7 +915,7 @@ function tt({
912
915
  height: p
913
916
  }, H = O.kind === "rect" || O.kind === "roundedRect";
914
917
  return /* @__PURE__ */ b("g", { transform: z, children: [
915
- f.safeArea && H && /* @__PURE__ */ b(be, { children: [
918
+ f.safeArea && H && /* @__PURE__ */ b(ve, { children: [
916
919
  /* @__PURE__ */ b("defs", { children: [
917
920
  /* @__PURE__ */ o(
918
921
  "filter",
@@ -976,14 +979,14 @@ function tt({
976
979
  }
977
980
  )
978
981
  ] }),
979
- f.zones && g.filter((E) => E.kind !== "dieCut").map((E, R) => /* @__PURE__ */ o("g", { children: K(E.path, {
982
+ f.zones && x.filter((E) => E.kind !== "dieCut").map((E, R) => /* @__PURE__ */ o("g", { children: K(E.path, {
980
983
  fill: l.zoneFill[E.kind],
981
984
  stroke: l.zoneStroke[E.kind],
982
985
  strokeWidth: 1.5,
983
986
  strokeDasharray: E.kind === "wrap" ? "4 3" : void 0,
984
987
  vectorEffect: "non-scaling-stroke"
985
988
  }) }, `zone-${R}`)),
986
- f.zones && g.filter((E) => E.kind === "dieCut").map((E, R) => {
989
+ f.zones && x.filter((E) => E.kind === "dieCut").map((E, R) => {
987
990
  const T = E.path;
988
991
  if (T.kind !== "rect" && T.kind !== "roundedRect")
989
992
  return null;
@@ -1059,134 +1062,134 @@ function tt({
1059
1062
  }
1060
1063
  );
1061
1064
  }
1062
- le();
1065
+ te();
1063
1066
  export {
1064
- br as ArtboardElement,
1065
- st as ArtboardPropertiesToolbar,
1066
- at as ArtboardTabs,
1067
- ot as AutoExportManager,
1068
- it as BackgroundPickerDropdown,
1069
- yr as BaseElement,
1070
- ct as BoldButton,
1071
- ze as ButtonGroup,
1072
- lt as Canvas,
1067
+ wr as ArtboardElement,
1068
+ ot as ArtboardPropertiesToolbar,
1069
+ it as ArtboardTabs,
1070
+ ct as AutoExportManager,
1071
+ lt as BackgroundPickerDropdown,
1072
+ Sr as BaseElement,
1073
+ dt as BoldButton,
1074
+ Le as ButtonGroup,
1075
+ ut as Canvas,
1073
1076
  Ce as CanvasEventBus,
1074
- dt as CanvasSkeleton,
1075
- ut as ColorPickerDropdown,
1076
- mt as ContextualToolbars,
1077
- Ie as ControlGroup,
1078
- ft as CropPanel,
1079
- ht as DEFAULT_AUTO_EXPORT_CONFIG,
1080
- te as Dropdown,
1081
- pt as DropdownMenu,
1082
- ar as EditorProvider,
1083
- gt as EffectsPanel,
1084
- xt as ExportPanel,
1085
- bt as FontBrowserDrawer,
1086
- yt as FontColorButton,
1077
+ mt as CanvasSkeleton,
1078
+ ft as ColorPickerDropdown,
1079
+ ht as ContextualToolbars,
1080
+ Oe as ControlGroup,
1081
+ pt as CropPanel,
1082
+ xt as DEFAULT_AUTO_EXPORT_CONFIG,
1083
+ re as Dropdown,
1084
+ gt as DropdownMenu,
1085
+ ir as EditorProvider,
1086
+ bt as EffectsPanel,
1087
+ yt as ExportPanel,
1088
+ vt as FontBrowserDrawer,
1089
+ wt as FontColorButton,
1087
1090
  Se as FontSizeDropdown,
1088
- Xe as FontSizeGroup,
1089
- vt as GlyphPanel,
1091
+ Ze as FontSizeGroup,
1092
+ St as GlyphPanel,
1090
1093
  ue as GroupElement,
1091
- vr as ImageElement,
1092
- wt as ImagePanel,
1093
- St as ImageToolbar,
1094
- Ct as ItalicButton,
1095
- Et as KIT_PRESETS,
1096
- Tt as KitProvider,
1097
- $t as LayersPanel,
1098
- kt as LayersPanelSkeleton,
1099
- At as MenuButton,
1100
- Ft as MenuItem,
1101
- Pt as MoreMenu,
1102
- Hr as PIECE_GUIDES_API_BASE,
1103
- or as PRESERVE_SELECTION_ATTR,
1104
- Me as Panel,
1105
- wr as PathElement,
1106
- Nt as PathToolbar,
1107
- Sr as RichText,
1108
- We as SecondaryToolbar,
1109
- Cr as ShapeElement,
1110
- Rt as ShapeToolbar,
1111
- Bt as ShapeTypeDrawer,
1112
- Dt as Spinner,
1113
- Mt as Surface,
1114
- Le as Switch,
1115
- It as TextAlignButton,
1116
- Er as TextElement,
1117
- zt as TextMoreMenu,
1118
- Ot as TextToolbar,
1119
- ir as ThemeProvider,
1120
- Oe as Toggle,
1121
- Lt as ToolbarSkeleton,
1122
- Wt as TransformControlPanel,
1123
- Kt as UnderlineButton,
1124
- _t as UppercaseButton,
1125
- tt as VisualGuideOverlay,
1126
- Gt as ZoomControls,
1094
+ Cr as ImageElement,
1095
+ Ct as ImagePanel,
1096
+ Et as ImageToolbar,
1097
+ Tt as ItalicButton,
1098
+ $t as KIT_PRESETS,
1099
+ kt as KitProvider,
1100
+ At as LayersPanel,
1101
+ Ft as LayersPanelSkeleton,
1102
+ Pt as MenuButton,
1103
+ Nt as MenuItem,
1104
+ Rt as MoreMenu,
1105
+ tn as PIECE_GUIDES_API_BASE,
1106
+ cr as PRESERVE_SELECTION_ATTR,
1107
+ ze as Panel,
1108
+ Er as PathElement,
1109
+ Bt as PathToolbar,
1110
+ Tr as RichText,
1111
+ _e as SecondaryToolbar,
1112
+ $r as ShapeElement,
1113
+ Dt as ShapeToolbar,
1114
+ Mt as ShapeTypeDrawer,
1115
+ It as Spinner,
1116
+ zt as Surface,
1117
+ Ke as Switch,
1118
+ Ot as TextAlignButton,
1119
+ kr as TextElement,
1120
+ Lt as TextMoreMenu,
1121
+ Wt as TextToolbar,
1122
+ br as ThemeProvider,
1123
+ We as Toggle,
1124
+ Kt as ToolbarSkeleton,
1125
+ _t as TransformControlPanel,
1126
+ Gt as UnderlineButton,
1127
+ Ut as UppercaseButton,
1128
+ nt as VisualGuideOverlay,
1129
+ jt as ZoomControls,
1127
1130
  Ee as canvasEventBus,
1128
- Ut as getAllSections,
1129
- He as getCustomElementTypes,
1130
- jt as getSection,
1131
- Jt as getSectionIds,
1132
- Tr as hasDistressEffect,
1133
- $r as hasMasks,
1134
- kr as hasStroke,
1135
- Ar as isArchTransform,
1136
- Fr as isCircleElementConfig,
1137
- Pr as isCircleTransform,
1138
- Nr as isCustomElementConfig,
1139
- Rr as isCustomTransform,
1140
- Br as isFlagTransform,
1141
- Jr as isGroupElement,
1142
- Dr as isGroupElementConfig,
1143
- Mr as isGroupTransform,
1144
- qr as isImageElement,
1145
- Ir as isImageElementConfig,
1146
- zr as isImageTransform,
1147
- Or as isKnockout,
1148
- Vr as isPathElement,
1149
- Lr as isPathElementConfig,
1150
- Wr as isPathTransform,
1151
- Qe as isRegisteredElementType,
1152
- Xr as isShapeElement,
1153
- Kr as isShapeElementConfig,
1154
- _r as isShapeTransform,
1155
- Yr as isTextElement,
1156
- Gr as isTextElementConfig,
1157
- Ur as isWaveTransform,
1158
- _e as loadKitFromJSON,
1159
- Qr as pieceGuidesForArtboard,
1160
- cr as preserveSelectionProps,
1161
- qt as registerBuiltinSections,
1162
- Vt as registerBuiltinSectionsSync,
1163
- Ye as registerElementType,
1164
- Xt as registerSection,
1165
- Yt as renderPieceGuides,
1166
- Ke as serializeKit,
1167
- lr as shouldPreserveSelection,
1168
- Zt as surfaceVariants,
1169
- Ze as unregisterElementType,
1170
- Ht as unregisterSection,
1171
- Ue as useBreakpoint,
1172
- et as useCanvasEvents,
1173
- Qt as useCapabilities,
1174
- dr as useCommandContext,
1175
- Je as useElementById,
1176
- ur as useElementsContext,
1177
- mr as useHistoryContext,
1178
- er as useKit,
1179
- qe as useLayerDragDrop,
1180
- tr as useLayerPreview,
1181
- Ve as useLayerSelection,
1182
- je as usePerformance,
1183
- en as usePieceGuideBundle,
1184
- Ge as useProjectLoader,
1185
- fr as useSelectionContext,
1186
- rr as useSurface,
1187
- nr as useTextToolbar,
1188
- hr as useTheme,
1131
+ Jt as getAllSections,
1132
+ et as getCustomElementTypes,
1133
+ qt as getSection,
1134
+ Vt as getSectionIds,
1135
+ Ar as hasDistressEffect,
1136
+ Fr as hasMasks,
1137
+ Pr as hasStroke,
1138
+ Nr as isArchTransform,
1139
+ Rr as isCircleElementConfig,
1140
+ Br as isCircleTransform,
1141
+ Dr as isCustomElementConfig,
1142
+ Mr as isCustomTransform,
1143
+ Ir as isFlagTransform,
1144
+ Xr as isGroupElement,
1145
+ zr as isGroupElementConfig,
1146
+ Or as isGroupTransform,
1147
+ Yr as isImageElement,
1148
+ Lr as isImageElementConfig,
1149
+ Wr as isImageTransform,
1150
+ Kr as isKnockout,
1151
+ Zr as isPathElement,
1152
+ _r as isPathElementConfig,
1153
+ Gr as isPathTransform,
1154
+ tt as isRegisteredElementType,
1155
+ Hr as isShapeElement,
1156
+ Ur as isShapeElementConfig,
1157
+ jr as isShapeTransform,
1158
+ Qr as isTextElement,
1159
+ Jr as isTextElementConfig,
1160
+ qr as isWaveTransform,
1161
+ Ue as loadKitFromJSON,
1162
+ rn as pieceGuidesForArtboard,
1163
+ lr as preserveSelectionProps,
1164
+ Xt as registerBuiltinSections,
1165
+ Yt as registerBuiltinSectionsSync,
1166
+ He as registerElementType,
1167
+ Zt as registerSection,
1168
+ Ht as renderPieceGuides,
1169
+ Ge as serializeKit,
1170
+ dr as shouldPreserveSelection,
1171
+ Qt as surfaceVariants,
1172
+ Qe as unregisterElementType,
1173
+ er as unregisterSection,
1174
+ Je as useBreakpoint,
1175
+ rt as useCanvasEvents,
1176
+ tr as useCapabilities,
1177
+ ur as useCommandContext,
1178
+ Ve as useElementById,
1179
+ mr as useElementsContext,
1180
+ fr as useHistoryContext,
1181
+ rr as useKit,
1182
+ Xe as useLayerDragDrop,
1183
+ nr as useLayerPreview,
1184
+ Ye as useLayerSelection,
1185
+ qe as usePerformance,
1186
+ nn as usePieceGuideBundle,
1187
+ je as useProjectLoader,
1188
+ hr as useSelectionContext,
1189
+ sr as useSurface,
1190
+ ar as useTextToolbar,
1191
+ yr as useTheme,
1189
1192
  pr as useToolStateContext,
1190
- gr as useViewportContext
1193
+ xr as useViewportContext
1191
1194
  };
1192
1195
  //# sourceMappingURL=advanced.mjs.map