@snowcone-app/canvas 0.13.0 → 0.14.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 (43) hide show
  1. package/dist/advanced.mjs +323 -327
  2. package/dist/advanced.mjs.map +1 -1
  3. package/dist/components/VisualGuideOverlay.d.ts +1 -1
  4. package/dist/components/ui/index.d.ts +34 -34
  5. package/dist/embed.mjs +34 -34
  6. package/dist/embed.mjs.map +1 -1
  7. package/dist/index.mjs +3 -3
  8. package/dist/style.css +1 -1
  9. package/dist/{template-fields-IgDV7PRY.js → template-fields-Dw-KK9DX.js} +182 -182
  10. package/dist/template-fields-Dw-KK9DX.js.map +1 -0
  11. package/dist/validation-BahKiJWj.js +22973 -0
  12. package/dist/validation-BahKiJWj.js.map +1 -0
  13. package/dist/vendor/ui/index.d.ts +35 -0
  14. package/dist/vendor/ui/lib/utils.d.ts +2 -0
  15. package/dist/vendor/ui/primitives/Button.d.ts +14 -0
  16. package/dist/vendor/ui/primitives/accordion.d.ts +37 -0
  17. package/dist/vendor/ui/primitives/badge.d.ts +20 -0
  18. package/dist/vendor/ui/primitives/card.d.ts +12 -0
  19. package/dist/vendor/ui/primitives/checkbox.d.ts +8 -0
  20. package/dist/vendor/ui/primitives/collapsible.d.ts +10 -0
  21. package/dist/vendor/ui/primitives/drawer.d.ts +66 -0
  22. package/dist/vendor/ui/primitives/dropdown-menu.d.ts +27 -0
  23. package/dist/vendor/ui/primitives/fieldset.d.ts +35 -0
  24. package/dist/vendor/ui/primitives/input.d.ts +18 -0
  25. package/dist/vendor/ui/primitives/kbd.d.ts +37 -0
  26. package/dist/vendor/ui/primitives/label.d.ts +5 -0
  27. package/dist/vendor/ui/primitives/link.d.ts +52 -0
  28. package/dist/vendor/ui/primitives/popover.d.ts +26 -0
  29. package/dist/vendor/ui/primitives/radio-group.d.ts +15 -0
  30. package/dist/vendor/ui/primitives/select.d.ts +17 -0
  31. package/dist/vendor/ui/primitives/separator.d.ts +4 -0
  32. package/dist/vendor/ui/primitives/slider.d.ts +26 -0
  33. package/dist/vendor/ui/primitives/spinner.d.ts +12 -0
  34. package/dist/vendor/ui/primitives/surface.d.ts +52 -0
  35. package/dist/vendor/ui/primitives/switch.d.ts +4 -0
  36. package/dist/vendor/ui/primitives/tabs.d.ts +28 -0
  37. package/dist/vendor/ui/primitives/text-field.d.ts +36 -0
  38. package/dist/vendor/ui/primitives/textarea.d.ts +10 -0
  39. package/dist/vendor/ui/primitives/tooltip.d.ts +19 -0
  40. package/package.json +7 -5
  41. package/dist/template-fields-IgDV7PRY.js.map +0 -1
  42. package/dist/validation-BpmNOvuY.js +0 -21177
  43. package/dist/validation-BpmNOvuY.js.map +0 -1
package/dist/advanced.mjs CHANGED
@@ -1,202 +1,198 @@
1
- import { D as te, I as q, r as re, v as ne, i as oe, e as ae } from "./validation-BpmNOvuY.js";
2
- import { j as it, k as lt, l as ct, B as dt, m as ut, n as mt, o as ft, p as ht, q as pt, s as xt, t as gt, w as bt, x as yt, y as vt, F as wt, z as St, G as Ct, H as Et, J as Tt, K as $t, L as kt, N as At, O as Ft, Q as Pt, R as Nt, S as Rt, T as Bt, U as Dt, V as Mt, W as It, X as zt, Y as Ot, Z as Lt, _ as Wt, $ as Kt, a0 as _t, a1 as Gt, a2 as Ut, a3 as jt, a4 as Jt, a5 as qt, a6 as Vt, a7 as Xt, a8 as Yt, a9 as Zt, aa as Ht, ab as Qt, ac as er, ad as tr, ae as rr, af as nr } from "./validation-BpmNOvuY.js";
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
3
  import { u as V } from "./ThemeContext-Cl1JPVLZ.js";
4
- import { E as ar, P as sr, T as ir, p as lr, s as cr, b as dr, c as ur, d as mr, e as fr, f as hr, g as pr, a as xr } from "./ThemeContext-Cl1JPVLZ.js";
5
- import { c as se, G as ie, F as le, g as ce, r as de, u as ue } from "./HybridHistoryManager-NL3zyEl4.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
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 me } from "./ImportManager-eotl7r5d.js";
7
+ import { I as ge } from "./ImportManager-eotl7r5d.js";
8
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 fe } from "react";
10
- import { jsxs as b, jsx as s, Fragment as he } from "react/jsx-runtime";
11
- import { Tooltip as D, TooltipTrigger as M, Button as pe, TooltipContent as I, Popover as xe, PopoverTrigger as ge, PopoverContent as be } from "@snowcone-app/ui";
12
- import { Surface as Hr, surfaceVariants as Qr, useSurface as en } from "@snowcone-app/ui";
13
- import "clsx";
14
- import "tailwind-merge";
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";
15
11
  import { e as ye, c as ve } from "./compose-DtQL_oit.js";
16
- import { P as rn, p as nn, u as on } from "./usePieceGuideBundle-Cyl695jv.js";
17
- const Oe = ({
12
+ import { P as Hr, p as Qr, u as en } from "./usePieceGuideBundle-Cyl695jv.js";
13
+ const Me = ({
18
14
  title: e,
19
15
  icon: t,
20
16
  children: r,
21
17
  enableable: a = !1,
22
18
  enabled: n = !1,
23
- onEnabledChange: o,
19
+ onEnabledChange: s,
24
20
  collapsible: i = !1,
25
21
  expanded: m = !0,
26
- onExpandChange: c,
22
+ onExpandChange: l,
27
23
  className: f = ""
28
24
  }) => {
29
25
  const w = a ? n && m : i ? m : !0, h = a && n || i, d = () => {
30
- o && o(!n);
31
- }, l = () => {
32
- c && c(!m);
26
+ s && s(!n);
27
+ }, c = () => {
28
+ l && l(!m);
33
29
  };
34
- return /* @__PURE__ */ b("div", { className: `rounded-xl border border-border-primary bg-bg-secondary p-xl ${f}`, children: [
35
- /* @__PURE__ */ b("div", { className: "flex items-center justify-between", children: [
36
- /* @__PURE__ */ b("div", { className: "flex items-center gap-md", children: [
37
- a && /* @__PURE__ */ s("label", { className: "flex cursor-pointer items-center", children: /* @__PURE__ */ s(
30
+ return /* @__PURE__ */ b("div", { className: `sc:rounded-xl sc:border sc:border-border-primary sc:bg-bg-secondary sc:p-xl ${f}`, children: [
31
+ /* @__PURE__ */ b("div", { className: "sc:flex sc:items-center sc:justify-between", children: [
32
+ /* @__PURE__ */ b("div", { className: "sc:flex sc:items-center sc:gap-md", children: [
33
+ a && /* @__PURE__ */ o("label", { className: "sc:flex sc:cursor-pointer sc:items-center", children: /* @__PURE__ */ o(
38
34
  "input",
39
35
  {
40
36
  type: "checkbox",
41
37
  checked: n,
42
38
  onChange: d,
43
- className: "h-4 w-4 cursor-pointer rounded border-border-primary bg-bg-input accent-accent-primary"
39
+ className: "sc:h-4 sc:w-4 sc:cursor-pointer sc:rounded sc:border-border-primary sc:bg-bg-input sc:accent-accent-primary"
44
40
  }
45
41
  ) }),
46
- /* @__PURE__ */ b("div", { className: "flex items-center gap-md", children: [
47
- t && /* @__PURE__ */ s("span", { className: "flex items-center text-text-secondary", children: t }),
48
- /* @__PURE__ */ s("h3", { className: "text-xl font-semibold text-text-primary", children: e })
42
+ /* @__PURE__ */ b("div", { className: "sc:flex sc:items-center sc:gap-md", children: [
43
+ t && /* @__PURE__ */ o("span", { className: "sc:flex sc:items-center sc:text-text-secondary", children: t }),
44
+ /* @__PURE__ */ o("h3", { className: "sc:text-xl sc:font-semibold sc:text-text-primary", children: e })
49
45
  ] })
50
46
  ] }),
51
- h && /* @__PURE__ */ s(
47
+ h && /* @__PURE__ */ o(
52
48
  "button",
53
49
  {
54
- onClick: l,
55
- className: "rounded-lg border-none bg-transparent px-md py-xs text-base text-text-muted transition-colors duration-fast hover:text-text-primary",
50
+ onClick: c,
51
+ className: "sc:rounded-lg sc:border-none sc:bg-transparent sc:px-md sc:py-xs sc:text-base sc:text-text-muted sc:transition-colors sc:duration-fast sc:hover:text-text-primary",
56
52
  title: m ? "Collapse" : "Expand",
57
53
  children: m ? "▼" : "▶"
58
54
  }
59
55
  )
60
56
  ] }),
61
- w && /* @__PURE__ */ s("div", { className: "mt-xl flex flex-col gap-xl", children: r })
57
+ w && /* @__PURE__ */ o("div", { className: "sc:mt-xl sc:flex sc:flex-col sc:gap-xl", children: r })
62
58
  ] });
63
- }, Le = ({
59
+ }, Ie = ({
64
60
  label: e,
65
61
  labelSuffix: t,
66
62
  children: r,
67
63
  inline: a = !1,
68
64
  className: n = ""
69
- }) => /* @__PURE__ */ b("div", { className: `flex ${a ? "items-center justify-between" : "flex-col"} gap-sm ${n}`, children: [
70
- /* @__PURE__ */ b("label", { className: "flex items-center justify-between text-base font-medium text-text-secondary", children: [
71
- /* @__PURE__ */ s("span", { children: e }),
72
- t && /* @__PURE__ */ s("span", { className: "font-semibold text-accent-primary", children: t })
65
+ }) => /* @__PURE__ */ b("div", { className: `sc:flex ${a ? "sc:items-center sc:justify-between" : "sc:flex-col"} sc:gap-sm ${n}`, children: [
66
+ /* @__PURE__ */ b("label", { className: "sc:flex sc:items-center sc:justify-between sc:text-base sc:font-medium sc:text-text-secondary", children: [
67
+ /* @__PURE__ */ o("span", { children: e }),
68
+ t && /* @__PURE__ */ o("span", { className: "sc:font-semibold sc:text-accent-primary", children: t })
73
69
  ] }),
74
- /* @__PURE__ */ s("div", { className: a ? "flex-shrink-0" : "", children: r })
70
+ /* @__PURE__ */ o("div", { className: a ? "sc:flex-shrink-0" : "", children: r })
75
71
  ] });
76
- function We({
72
+ function ze({
77
73
  options: e,
78
74
  value: t,
79
75
  onChange: r,
80
76
  fullWidth: a = !0,
81
77
  className: n = ""
82
78
  }) {
83
- return /* @__PURE__ */ s("div", { className: `flex gap-sm ${n}`, children: e.map((o) => {
84
- const i = o.value === t;
79
+ return /* @__PURE__ */ o("div", { className: `sc:flex sc:gap-sm ${n}`, children: e.map((s) => {
80
+ const i = s.value === t;
85
81
  return /* @__PURE__ */ b(
86
82
  "button",
87
83
  {
88
- onClick: () => !o.disabled && r(o.value),
89
- disabled: o.disabled,
90
- title: o.tooltip,
91
- className: ` ${a ? "flex-1" : ""} flex items-center justify-center gap-xs rounded-lg border px-md py-sm text-base font-medium transition-all duration-fast ${i ? "border-accent-primary bg-accent-primary text-text-on-accent" : "border-border-primary bg-bg-tertiary text-text-secondary hover:border-border-secondary hover:bg-bg-hover hover:text-text-primary"} ${o.disabled ? "cursor-not-allowed opacity-disabled" : "cursor-pointer"} `,
84
+ onClick: () => !s.disabled && r(s.value),
85
+ disabled: s.disabled,
86
+ title: s.tooltip,
87
+ className: ` ${a ? "sc:flex-1" : ""} sc:flex sc:items-center sc:justify-center sc:gap-xs sc:rounded-lg sc:border sc:px-md sc:py-sm sc:text-base sc:font-medium sc:transition-all sc:duration-fast ${i ? "sc:border-accent-primary sc:bg-accent-primary sc:text-text-on-accent" : "sc:border-border-primary sc:bg-bg-tertiary sc:text-text-secondary sc:hover:border-border-secondary sc:hover:bg-bg-hover sc:hover:text-text-primary"} ${s.disabled ? "sc:cursor-not-allowed sc:opacity-disabled" : "sc:cursor-pointer"} `,
92
88
  children: [
93
- o.icon && /* @__PURE__ */ s("span", { className: "flex items-center", children: o.icon }),
94
- /* @__PURE__ */ s("span", { children: o.label })
89
+ s.icon && /* @__PURE__ */ o("span", { className: "sc:flex sc:items-center", children: s.icon }),
90
+ /* @__PURE__ */ o("span", { children: s.label })
95
91
  ]
96
92
  },
97
- String(o.value)
93
+ String(s.value)
98
94
  );
99
95
  }) });
100
96
  }
101
- const Ke = ({ label: e, icon: t, checked: r, onChange: a, disabled: n = !1, className: o = "" }) => {
97
+ const Oe = ({ label: e, icon: t, checked: r, onChange: a, disabled: n = !1, className: s = "" }) => {
102
98
  const i = (m) => {
103
99
  a(m.target.checked);
104
100
  };
105
101
  return /* @__PURE__ */ b(
106
102
  "label",
107
103
  {
108
- className: `flex cursor-pointer items-center gap-md ${n ? "cursor-not-allowed opacity-disabled" : ""} ${o}`,
104
+ className: `sc:flex sc:cursor-pointer sc:items-center sc:gap-md ${n ? "sc:cursor-not-allowed sc:opacity-disabled" : ""} ${s}`,
109
105
  children: [
110
- /* @__PURE__ */ s(
106
+ /* @__PURE__ */ o(
111
107
  "input",
112
108
  {
113
109
  type: "checkbox",
114
110
  checked: r,
115
111
  onChange: i,
116
112
  disabled: n,
117
- className: "h-4 w-4 cursor-pointer rounded border-border-primary bg-bg-input accent-accent-primary disabled:cursor-not-allowed"
113
+ className: "sc:h-4 sc:w-4 sc:cursor-pointer sc:rounded sc:border-border-primary sc:bg-bg-input sc:accent-accent-primary sc:disabled:cursor-not-allowed"
118
114
  }
119
115
  ),
120
- /* @__PURE__ */ b("span", { className: "flex items-center gap-sm text-base font-medium text-text-primary", children: [
121
- t && /* @__PURE__ */ s("span", { className: "flex items-center text-text-secondary", children: t }),
122
- /* @__PURE__ */ s("span", { children: e })
116
+ /* @__PURE__ */ b("span", { className: "sc:flex sc:items-center sc:gap-sm sc:text-base sc:font-medium sc:text-text-primary", children: [
117
+ t && /* @__PURE__ */ o("span", { className: "sc:flex sc:items-center sc:text-text-secondary", children: t }),
118
+ /* @__PURE__ */ o("span", { children: e })
123
119
  ] })
124
120
  ]
125
121
  }
126
122
  );
127
- }, _e = ({
123
+ }, Le = ({
128
124
  checked: e,
129
125
  onChange: t,
130
126
  label: r,
131
127
  disabled: a = !1,
132
128
  className: n = ""
133
129
  }) => {
134
- const o = () => {
130
+ const s = () => {
135
131
  a || t(!e);
136
132
  };
137
133
  return /* @__PURE__ */ b(
138
134
  "label",
139
135
  {
140
- className: `flex items-center gap-md cursor-pointer select-none ${a ? "opacity-50 cursor-not-allowed" : ""} ${n}`.trim(),
136
+ className: `sc:flex sc:items-center sc:gap-md sc:cursor-pointer sc:select-none ${a ? "sc:opacity-50 sc:cursor-not-allowed" : ""} ${n}`.trim(),
141
137
  children: [
142
- /* @__PURE__ */ s(
138
+ /* @__PURE__ */ o(
143
139
  "input",
144
140
  {
145
141
  type: "checkbox",
146
142
  checked: e,
147
- onChange: o,
143
+ onChange: s,
148
144
  disabled: a,
149
- className: "absolute opacity-0 w-0 h-0 peer"
145
+ className: "sc:absolute sc:opacity-0 sc:w-0 sc:h-0 sc:peer"
150
146
  }
151
147
  ),
152
- /* @__PURE__ */ s(
148
+ /* @__PURE__ */ o(
153
149
  "span",
154
150
  {
155
151
  className: `
156
- relative inline-block w-9 h-5 rounded-[999px] transition-colors
157
- ${e ? "bg-accent-primary" : "bg-bg-tertiary"}
158
- after:content-[''] after:absolute after:top-[2px] after:left-[2px]
159
- after:w-4 after:h-4 after:bg-white after:rounded-full
160
- after:transition-transform after:shadow-md
161
- ${e ? "after:translate-x-4" : ""}
152
+ sc:relative sc:inline-block sc:w-9 sc:h-5 sc:rounded-[999px] sc:transition-colors
153
+ ${e ? "sc:bg-accent-primary" : "sc:bg-bg-tertiary"}
154
+ sc:after:content-[''] sc:after:absolute sc:after:top-[2px] sc:after:left-[2px]
155
+ sc:after:w-4 sc:after:h-4 sc:after:bg-white sc:after:rounded-full
156
+ sc:after:transition-transform sc:after:shadow-md
157
+ ${e ? "sc:after:translate-x-4" : ""}
162
158
  `.trim()
163
159
  }
164
160
  ),
165
- r && /* @__PURE__ */ s("span", { className: "text-md text-text-primary font-medium", children: r })
161
+ r && /* @__PURE__ */ o("span", { className: "sc:text-md sc:text-text-primary sc:font-medium", children: r })
166
162
  ]
167
163
  }
168
164
  );
169
- }, Ge = ({
165
+ }, We = ({
170
166
  isOpen: e,
171
167
  onToggle: t,
172
168
  trigger: r,
173
169
  children: a
174
- }) => /* @__PURE__ */ s(
170
+ }) => /* @__PURE__ */ o(
175
171
  te,
176
172
  {
177
173
  isOpen: e,
178
174
  onToggle: t,
179
175
  trigger: r || /* @__PURE__ */ b(D, { delayDuration: 0, children: [
180
- /* @__PURE__ */ s(M, { asChild: !0, children: /* @__PURE__ */ s(
181
- pe,
176
+ /* @__PURE__ */ o(M, { asChild: !0, children: /* @__PURE__ */ o(
177
+ re,
182
178
  {
183
179
  variant: "ghost",
184
180
  size: "toolbar",
185
- onClick: (o) => {
186
- o.stopPropagation(), t(!e);
181
+ onClick: (s) => {
182
+ s.stopPropagation(), t(!e);
187
183
  },
188
- children: /* @__PURE__ */ s(q, { icon: "lucide:ellipsis-vertical", className: "size-6" })
184
+ children: /* @__PURE__ */ o(q, { icon: "lucide:ellipsis-vertical", className: "sc:size-6" })
189
185
  }
190
186
  ) }),
191
- /* @__PURE__ */ s(I, { children: /* @__PURE__ */ s("p", { children: "More" }) })
187
+ /* @__PURE__ */ o(I, { children: /* @__PURE__ */ o("p", { children: "More" }) })
192
188
  ] }),
193
189
  position: "bottom",
194
190
  align: "end",
195
191
  offset: 4,
196
- children: /* @__PURE__ */ s("div", { className: "flex items-center gap-sm bg-bg-primary border border-border-primary rounded-xl px-xl py-md shadow-sm h-[52px]", children: a })
192
+ 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 })
197
193
  }
198
194
  );
199
- function Ue(e) {
195
+ function Ke(e) {
200
196
  const t = {
201
197
  name: e.name,
202
198
  capabilities: {
@@ -221,18 +217,18 @@ function Ue(e) {
221
217
  };
222
218
  return e.content && (t.content = { ...e.content }), t;
223
219
  }
224
- function je(e) {
220
+ function _e(e) {
225
221
  if (!e.name || e.name.trim() === "")
226
222
  throw new Error("[loadKitFromJSON] Kit name is required");
227
223
  const t = {};
228
224
  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);
229
225
  let r;
230
226
  if (e.extends) {
231
- const n = re(e.extends);
227
+ const n = ne(e.extends);
232
228
  r = ye(n, { name: e.name, ...t });
233
229
  } else
234
230
  r = ve({ name: e.name, ...t });
235
- const a = ne(r);
231
+ const a = se(r);
236
232
  if (a.warnings.length > 0)
237
233
  for (const n of a.warnings)
238
234
  console.warn(`[loadKitFromJSON] Warning: ${n}`);
@@ -244,70 +240,70 @@ ${a.errors.join(`
244
240
  );
245
241
  return r;
246
242
  }
247
- const L = se("useProjectLoader");
248
- function Je() {
243
+ const L = de("useProjectLoader");
244
+ function Ge() {
249
245
  const {
250
246
  handleLoadWorkspace: e
251
- } = V(), [t, r] = A(!1), [a, n] = A(null), [o, i] = A(null), [m, c] = A(null), f = y(async (d) => {
247
+ } = V(), [t, r] = A(!1), [a, n] = A(null), [s, i] = A(null), [m, l] = A(null), f = y(async (d) => {
252
248
  r(!0), n(null);
253
249
  try {
254
- const l = typeof d == "string" ? JSON.parse(d) : d;
255
- if (!l.artboards || !Array.isArray(l.artboards))
250
+ const c = typeof d == "string" ? JSON.parse(d) : d;
251
+ if (!c.artboards || !Array.isArray(c.artboards))
256
252
  throw new Error("Invalid document format: missing artboards array");
257
- const x = JSON.stringify(l), S = new Blob([x], { type: "application/json" }), C = new File([S], "project.json", { type: "application/json" }), g = await me.importFromJSON(C);
258
- if (!g.success || !g.artboards || !g.elements)
259
- throw new Error(g.error || "Failed to import project");
260
- e(g.artboards, g.elements, g.activeArtboardId || null), i(l);
261
- const u = l.artboards.reduce((p, k) => {
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);
257
+ const u = c.artboards.reduce((p, k) => {
262
258
  var v;
263
259
  return p + (((v = k.elements) == null ? void 0 : v.length) || 0);
264
260
  }, 0);
265
- c({
266
- version: l.metadata.version,
267
- timestamp: l.metadata.timestamp,
268
- artboardCount: l.artboards.length,
261
+ l({
262
+ version: c.metadata.version,
263
+ timestamp: c.metadata.timestamp,
264
+ artboardCount: c.artboards.length,
269
265
  elementCount: u
270
266
  });
271
- } catch (l) {
272
- throw L.error("[useProjectLoader] Failed to load project:", l), n(l), l;
267
+ } catch (c) {
268
+ throw L.error("[useProjectLoader] Failed to load project:", c), n(c), c;
273
269
  } finally {
274
270
  r(!1);
275
271
  }
276
272
  }, [e]), w = y(async (d) => {
277
273
  r(!0), n(null);
278
274
  try {
279
- const l = await d.text();
280
- await f(l);
281
- } catch (l) {
282
- throw L.error("[useProjectLoader] Failed to load file:", l), n(l), l;
275
+ const c = await d.text();
276
+ await f(c);
277
+ } catch (c) {
278
+ throw L.error("[useProjectLoader] Failed to load file:", c), n(c), c;
283
279
  } finally {
284
280
  r(!1);
285
281
  }
286
282
  }, [f]), h = y(async (d) => {
287
283
  r(!0), n(null);
288
284
  try {
289
- const l = {
285
+ const c = {
290
286
  metadata: {
291
287
  version: "2.0.0",
292
288
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
293
289
  appVersion: "1.0.0"
294
290
  },
295
- artboards: d.artboards.map((x, S) => ({
291
+ artboards: d.artboards.map((g, S) => ({
296
292
  id: `artboard-${Date.now()}-${S}`,
297
- name: x.name,
293
+ name: g.name,
298
294
  x: 0,
299
295
  y: 0,
300
- width: x.width,
301
- height: x.height,
302
- backgroundColor: x.backgroundColor,
303
- elements: x.elements || []
296
+ width: g.width,
297
+ height: g.height,
298
+ backgroundColor: g.backgroundColor,
299
+ elements: g.elements || []
304
300
  })),
305
301
  activeArtboardId: null
306
302
  // First artboard will be active by default
307
303
  };
308
- await f(l);
309
- } catch (l) {
310
- throw L.error("[useProjectLoader] Failed to load template:", l), n(l), l;
304
+ await f(c);
305
+ } catch (c) {
306
+ throw L.error("[useProjectLoader] Failed to load template:", c), n(c), c;
311
307
  } finally {
312
308
  r(!1);
313
309
  }
@@ -318,7 +314,7 @@ function Je() {
318
314
  loadTemplate: h,
319
315
  isLoading: t,
320
316
  loadError: a,
321
- currentProject: o,
317
+ currentProject: s,
322
318
  projectMetadata: m
323
319
  };
324
320
  }
@@ -333,37 +329,37 @@ const U = {
333
329
  function we(e, t) {
334
330
  return e >= t.xxl ? "xxl" : e >= t.xl ? "xl" : e >= t.lg ? "lg" : e >= t.md ? "md" : e >= t.sm ? "sm" : "xs";
335
331
  }
336
- function qe(e) {
332
+ function Ue(e) {
337
333
  const t = {
338
334
  ...U,
339
335
  ...e
340
336
  }, [r, a] = A(() => typeof window < "u" ? window.innerWidth : U.lg);
341
337
  X(() => {
342
338
  if (typeof window > "u") return;
343
- const x = () => {
339
+ const g = () => {
344
340
  a(window.innerWidth);
345
341
  };
346
- return window.addEventListener("resize", x), () => window.removeEventListener("resize", x);
342
+ return window.addEventListener("resize", g), () => window.removeEventListener("resize", g);
347
343
  }, []);
348
344
  const n = Y(
349
345
  () => we(r, t),
350
346
  [r, t]
351
- ), o = n === "xs", i = n === "sm", m = n === "md", c = n === "lg", f = n === "xl", w = n === "xxl", h = ["xs", "sm", "md", "lg", "xl", "xxl"];
347
+ ), 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"];
352
348
  return {
353
349
  breakpoint: n,
354
350
  width: r,
355
- isXs: o,
351
+ isXs: s,
356
352
  isSm: i,
357
353
  isMd: m,
358
- isLg: c,
354
+ isLg: l,
359
355
  isXl: f,
360
356
  isXxl: w,
361
- isAtLeast: (x) => {
362
- const S = h.indexOf(n), C = h.indexOf(x);
357
+ isAtLeast: (g) => {
358
+ const S = h.indexOf(n), C = h.indexOf(g);
363
359
  return S >= C;
364
360
  },
365
- isAtMost: (x) => {
366
- const S = h.indexOf(n), C = h.indexOf(x);
361
+ isAtMost: (g) => {
362
+ const S = h.indexOf(n), C = h.indexOf(g);
367
363
  return S <= C;
368
364
  }
369
365
  };
@@ -377,12 +373,12 @@ const j = {
377
373
  exportCount: 0,
378
374
  avgExportTime: 0
379
375
  };
380
- function Ve() {
381
- const [e, t] = A(j), [r, a] = A(!1), n = B([]), o = B([]), i = B([]), m = B(performance.now()), c = 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(() => {
376
+ function je() {
377
+ 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(() => {
382
378
  const u = {
383
379
  fps: f(n.current),
384
- avgRenderTime: w(o.current),
385
- peakRenderTime: Math.max(...o.current, 0),
380
+ avgRenderTime: w(s.current),
381
+ peakRenderTime: Math.max(...s.current, 0),
386
382
  memoryUsage: h(),
387
383
  elementCount: 0,
388
384
  // Would need to be updated by editor context
@@ -390,16 +386,16 @@ function Ve() {
390
386
  avgExportTime: w(i.current)
391
387
  };
392
388
  t(u);
393
- }, [f, w, h]), l = y(() => {
389
+ }, [f, w, h]), c = y(() => {
394
390
  const u = performance.now(), p = u - m.current;
395
- m.current = u, n.current.push(p), n.current.length > 60 && n.current.shift(), n.current.length % 30 === 0 && d(), r && (c.current = requestAnimationFrame(l));
396
- }, [r, d]), x = y(() => {
397
- a(!0), m.current = performance.now(), c.current = requestAnimationFrame(l);
398
- }, [l]), S = y(() => {
399
- a(!1), c.current !== null && (cancelAnimationFrame(c.current), c.current = null);
391
+ 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(() => {
393
+ a(!0), m.current = performance.now(), l.current = requestAnimationFrame(c);
394
+ }, [c]), S = y(() => {
395
+ a(!1), l.current !== null && (cancelAnimationFrame(l.current), l.current = null);
400
396
  }, []), C = y(() => {
401
- n.current = [], o.current = [], i.current = [], t(j);
402
- }, []), g = y(() => `
397
+ n.current = [], s.current = [], i.current = [], t(j);
398
+ }, []), x = y(() => `
403
399
  Performance Report
404
400
  ==================
405
401
  FPS: ${e.fps.toFixed(1)}
@@ -411,45 +407,45 @@ Export Count: ${e.exportCount}
411
407
  Avg Export Time: ${e.avgExportTime.toFixed(2)}ms
412
408
  `.trim(), [e]);
413
409
  return X(() => () => {
414
- c.current !== null && cancelAnimationFrame(c.current);
410
+ l.current !== null && cancelAnimationFrame(l.current);
415
411
  }, []), {
416
412
  metrics: e,
417
- startProfiling: x,
413
+ startProfiling: g,
418
414
  stopProfiling: S,
419
415
  clearMetrics: C,
420
- getReport: g,
416
+ getReport: x,
421
417
  isProfiling: r
422
418
  };
423
419
  }
424
- function Xe(e) {
420
+ function Je(e) {
425
421
  const { getElementById: t } = V();
426
422
  return e ? t(e) ?? null : null;
427
423
  }
428
- function Ye(e) {
424
+ function qe(e) {
429
425
  const {
430
426
  onReorder: t,
431
427
  onGroupReorder: r,
432
428
  onDropIntoGroup: a,
433
429
  onDropIntoGroupAtPosition: n,
434
- findElement: o,
430
+ findElement: s,
435
431
  findParentGroup: i
436
- } = e, [m, c] = A(null), [f, w] = A(null), [h, d] = A(null), l = y((g, u) => {
437
- g.dataTransfer.effectAllowed = "move", requestAnimationFrame(() => {
438
- c(u);
432
+ } = e, [m, l] = A(null), [f, w] = A(null), [h, d] = A(null), c = y((x, u) => {
433
+ x.dataTransfer.effectAllowed = "move", requestAnimationFrame(() => {
434
+ l(u);
439
435
  });
440
- }, []), x = y(
441
- (g, u) => {
442
- g.preventDefault(), g.dataTransfer.dropEffect = "move";
443
- const p = g.currentTarget.getBoundingClientRect(), v = g.clientY - p.top, F = p.height, z = (o == null ? void 0 : o(u)) instanceof ie;
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;
444
440
  let $;
445
441
  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($);
446
442
  },
447
- [o]
443
+ [s]
448
444
  ), S = y(() => {
449
- c(null), w(null), d(null);
445
+ l(null), w(null), d(null);
450
446
  }, []), C = y(
451
- (g, u) => {
452
- if (g.preventDefault(), !m || m === u || !h) {
447
+ (x, u) => {
448
+ if (x.preventDefault(), !m || m === u || !h) {
453
449
  S();
454
450
  return;
455
451
  }
@@ -477,50 +473,50 @@ function Ye(e) {
477
473
  dragOverId: f,
478
474
  dropPosition: h,
479
475
  handlers: {
480
- onDragStart: l,
481
- onDragOver: x,
476
+ onDragStart: c,
477
+ onDragOver: g,
482
478
  onDrop: C,
483
479
  onDragEnd: S
484
480
  }
485
481
  };
486
482
  }
487
- function Ze(e) {
488
- const { selectedId: t, multiSelection: r, onSelectionChange: a, onMultiSelectionChange: n } = e, o = y(
483
+ function Ve(e) {
484
+ const { selectedId: t, multiSelection: r, onSelectionChange: a, onMultiSelectionChange: n } = e, s = y(
489
485
  (m) => m === t || r.includes(m),
490
486
  [t, r]
491
487
  ), i = y(
492
- (m, c) => {
488
+ (m, l) => {
493
489
  if (m.shiftKey) {
494
- const f = r.includes(c), w = t === c;
490
+ const f = r.includes(l), w = t === l;
495
491
  if (r.length > 0)
496
492
  if (f) {
497
- const h = r.filter((d) => d !== c);
493
+ const h = r.filter((d) => d !== l);
498
494
  h.length === 1 ? (n([]), a(h[0])) : h.length === 0 ? (n([]), a(null)) : n(h);
499
495
  } else
500
- n([...r, c]);
496
+ n([...r, l]);
501
497
  else {
502
498
  if (w)
503
499
  return;
504
- t !== null ? (n([t, c]), a(null)) : a(c);
500
+ t !== null ? (n([t, l]), a(null)) : a(l);
505
501
  }
506
502
  } else
507
- a(c), n([]);
503
+ a(l), n([]);
508
504
  },
509
505
  [t, r, a, n]
510
506
  );
511
- return { isSelected: o, handleClick: i };
507
+ return { isSelected: s, handleClick: i };
512
508
  }
513
- const Se = fe(({ value: e, onChange: t, fontSizes: r, isOpen: a, onToggle: n }) => {
514
- const o = (i) => {
509
+ const Se = xe(({ value: e, onChange: t, fontSizes: r, isOpen: a, onToggle: n }) => {
510
+ const s = (i) => {
515
511
  t(i), n(!1);
516
512
  };
517
- return /* @__PURE__ */ b(xe, { open: a, onOpenChange: n, children: [
518
- /* @__PURE__ */ s(ge, { asChild: !0, children: /* @__PURE__ */ s("button", { className: "toolbar-btn", "aria-label": "Font size", children: /* @__PURE__ */ s(q, { icon: "radix-icons:font-size", className: "size-5" }) }) }),
519
- /* @__PURE__ */ s(be, { className: "w-[120px] max-h-[300px] overflow-y-auto p-1", maxZIndex: !0, children: /* @__PURE__ */ s("div", { className: "flex flex-col gap-0.5", children: r.map((i) => /* @__PURE__ */ s(
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(
520
516
  "button",
521
517
  {
522
- onClick: () => o(i),
523
- className: `w-full rounded-md px-3 py-1.5 text-center text-sm transition-colors hover:bg-muted ${e === i ? "bg-muted font-medium" : ""}`,
518
+ onClick: () => s(i),
519
+ className: `sc:w-full sc:rounded-md sc:px-3 sc:py-1.5 sc:text-center sc:text-sm sc:transition-colors sc:hover:bg-muted ${e === i ? "sc:bg-muted sc:font-medium" : ""}`,
524
520
  children: i
525
521
  },
526
522
  i
@@ -528,46 +524,46 @@ const Se = fe(({ value: e, onChange: t, fontSizes: r, isOpen: a, onToggle: n })
528
524
  ] });
529
525
  });
530
526
  Se.displayName = "FontSizeDropdown";
531
- function He({ toolbar: e }) {
532
- const { fontSize: t, handleFontSizeIncrement: r, handleFontSizeChange: a } = e, [n, o] = A(!1);
533
- return /* @__PURE__ */ b("div", { className: "toolbar-group", children: [
527
+ function Xe({ toolbar: e }) {
528
+ const { fontSize: t, handleFontSizeIncrement: r, handleFontSizeChange: a } = e, [n, s] = A(!1);
529
+ return /* @__PURE__ */ b("div", { className: "sc-toolbar-group", children: [
534
530
  /* @__PURE__ */ b(D, { delayDuration: 300, children: [
535
- /* @__PURE__ */ s(M, { asChild: !0, children: /* @__PURE__ */ s("button", { className: "toolbar-btn-sm", onClick: () => r(-1), children: "-" }) }),
536
- /* @__PURE__ */ s(I, { children: "Decrease Font Size" })
531
+ /* @__PURE__ */ o(M, { asChild: !0, children: /* @__PURE__ */ o("button", { className: "sc-toolbar-btn-sm", onClick: () => r(-1), children: "-" }) }),
532
+ /* @__PURE__ */ o(I, { children: "Decrease Font Size" })
537
533
  ] }),
538
534
  /* @__PURE__ */ b(D, { delayDuration: 300, children: [
539
- /* @__PURE__ */ s(M, { asChild: !0, children: /* @__PURE__ */ b("div", { style: { position: "relative" }, children: [
540
- /* @__PURE__ */ s(
535
+ /* @__PURE__ */ o(M, { asChild: !0, children: /* @__PURE__ */ b("div", { style: { position: "relative" }, children: [
536
+ /* @__PURE__ */ o(
541
537
  "button",
542
538
  {
543
- className: "toolbar-font-size-display",
539
+ className: "sc-toolbar-font-size-display",
544
540
  onClick: () => {
545
- oe.protectNextClick(), o(!n);
541
+ ce.protectNextClick(), s(!n);
546
542
  },
547
543
  children: t
548
544
  }
549
545
  ),
550
- n && /* @__PURE__ */ s(
546
+ n && /* @__PURE__ */ o(
551
547
  "div",
552
548
  {
553
549
  className: "font-dropdown",
554
550
  ref: (i) => {
555
551
  if (i) {
556
- const m = (c) => {
557
- const f = c.target;
558
- !i.contains(f) && !f.closest(".toolbar-font-size-display") && o(!1);
552
+ const m = (l) => {
553
+ const f = l.target;
554
+ !i.contains(f) && !f.closest(".sc-toolbar-font-size-display") && s(!1);
559
555
  };
560
556
  setTimeout(() => {
561
557
  document.addEventListener("mousedown", m);
562
558
  }, 0);
563
559
  }
564
560
  },
565
- children: le.map((i) => /* @__PURE__ */ s(
561
+ children: me.map((i) => /* @__PURE__ */ o(
566
562
  "button",
567
563
  {
568
564
  className: `font-dropdown-option ${t === i ? "selected" : ""}`,
569
565
  onClick: () => {
570
- a(i), o(!1);
566
+ a(i), s(!1);
571
567
  },
572
568
  children: i
573
569
  },
@@ -576,16 +572,16 @@ function He({ toolbar: e }) {
576
572
  }
577
573
  )
578
574
  ] }) }),
579
- /* @__PURE__ */ s(I, { children: "Font Size" })
575
+ /* @__PURE__ */ o(I, { children: "Font Size" })
580
576
  ] }),
581
577
  /* @__PURE__ */ b(D, { delayDuration: 300, children: [
582
- /* @__PURE__ */ s(M, { asChild: !0, children: /* @__PURE__ */ s("button", { className: "toolbar-btn-sm", onClick: () => r(1), children: "+" }) }),
583
- /* @__PURE__ */ s(I, { children: "Increase Font Size" })
578
+ /* @__PURE__ */ o(M, { asChild: !0, children: /* @__PURE__ */ o("button", { className: "sc-toolbar-btn-sm", onClick: () => r(1), children: "+" }) }),
579
+ /* @__PURE__ */ o(I, { children: "Increase Font Size" })
584
580
  ] })
585
581
  ] });
586
582
  }
587
583
  const _ = /* @__PURE__ */ new Map();
588
- function Qe(e) {
584
+ function Ye(e) {
589
585
  if (!e.type || typeof e.type != "string")
590
586
  throw new Error('ElementTypeRegistration requires a non-empty "type" string');
591
587
  if (typeof e.Component != "function")
@@ -596,20 +592,20 @@ function Qe(e) {
596
592
  throw new Error(
597
593
  `ElementTypeRegistration for "${e.type}" requires a non-empty "label" string`
598
594
  );
599
- de(e.type, {
595
+ he(e.type, {
600
596
  id: e.type,
601
597
  label: e.label,
602
598
  Component: e.Component
603
599
  }), _.set(e.type, { ...e });
604
600
  }
605
- function et(e) {
606
- ue(e), _.delete(e);
601
+ function Ze(e) {
602
+ pe(e), _.delete(e);
607
603
  }
608
- function tt() {
604
+ function He() {
609
605
  return Array.from(_.values());
610
606
  }
611
- function rt(e) {
612
- return ce(e) !== void 0;
607
+ function Qe(e) {
608
+ return fe(e) !== void 0;
613
609
  }
614
610
  class Ce {
615
611
  constructor() {
@@ -643,8 +639,8 @@ class Ce {
643
639
  * @returns An unsubscribe function
644
640
  */
645
641
  once(t, r) {
646
- const a = (o) => {
647
- n(), r(o);
642
+ const a = (s) => {
643
+ n(), r(s);
648
644
  }, n = this.on(t, a);
649
645
  return n;
650
646
  }
@@ -666,10 +662,10 @@ class Ce {
666
662
  for (const n of [...a])
667
663
  try {
668
664
  n(r);
669
- } catch (o) {
665
+ } catch (s) {
670
666
  console.error(
671
667
  `[CanvasEventBus] Error in handler for "${String(t)}":`,
672
- o
668
+ s
673
669
  );
674
670
  }
675
671
  }
@@ -702,7 +698,7 @@ class Ce {
702
698
  }
703
699
  }
704
700
  const Ee = new Ce();
705
- function nt() {
701
+ function et() {
706
702
  return Ee;
707
703
  }
708
704
  const W = {
@@ -772,7 +768,7 @@ const W = {
772
768
  br: { textAnchor: "end", dominantBaseline: "alphabetic" }
773
769
  };
774
770
  function K(e, t) {
775
- return e.kind === "rect" ? /* @__PURE__ */ s(
771
+ return e.kind === "rect" ? /* @__PURE__ */ o(
776
772
  "rect",
777
773
  {
778
774
  x: e.x,
@@ -781,7 +777,7 @@ function K(e, t) {
781
777
  height: e.height,
782
778
  ...t
783
779
  }
784
- ) : e.kind === "roundedRect" ? /* @__PURE__ */ s(
780
+ ) : e.kind === "roundedRect" ? /* @__PURE__ */ o(
785
781
  "rect",
786
782
  {
787
783
  x: e.x,
@@ -792,7 +788,7 @@ function K(e, t) {
792
788
  ry: e.ry,
793
789
  ...t
794
790
  }
795
- ) : /* @__PURE__ */ s(
791
+ ) : /* @__PURE__ */ o(
796
792
  "path",
797
793
  {
798
794
  d: e.d,
@@ -816,14 +812,14 @@ function J(e) {
816
812
  const t = e.rx ?? e.ry ?? 0, r = e.ry ?? e.rx ?? 0;
817
813
  if (t <= 0 && r <= 0)
818
814
  return `M ${e.x} ${e.y} h ${e.width} v ${e.height} h ${-e.width} Z`;
819
- const { x: a, y: n, width: o, height: i } = e;
815
+ const { x: a, y: n, width: s, height: i } = e;
820
816
  return [
821
817
  `M ${a + t} ${n}`,
822
- `h ${o - 2 * t}`,
818
+ `h ${s - 2 * t}`,
823
819
  `a ${t} ${r} 0 0 1 ${t} ${r}`,
824
820
  `v ${i - 2 * r}`,
825
821
  `a ${t} ${r} 0 0 1 ${-t} ${r}`,
826
- `h ${-(o - 2 * t)}`,
822
+ `h ${-(s - 2 * t)}`,
827
823
  `a ${t} ${r} 0 0 1 ${-t} ${-r}`,
828
824
  `v ${-(i - 2 * r)}`,
829
825
  `a ${t} ${r} 0 0 1 ${t} ${-r}`,
@@ -846,35 +842,35 @@ function ke(e, t, r, a) {
846
842
  }
847
843
  return null;
848
844
  }
849
- function ot({
845
+ function tt({
850
846
  artboardWidth: e,
851
847
  artboardHeight: t,
852
848
  canvasPadding: r = 0,
853
849
  pieces: a,
854
850
  pieceGuides: n,
855
- show: o,
851
+ show: s,
856
852
  style: i,
857
853
  className: m
858
854
  }) {
859
- const c = Y(() => {
855
+ const l = Y(() => {
860
856
  const d = Math.max(
861
857
  16,
862
858
  Math.round(Math.min(e, t) * 0.03)
863
- ), l = {
859
+ ), c = {
864
860
  ...W,
865
861
  ...i ?? {},
866
862
  zoneFill: { ...W.zoneFill, ...(i == null ? void 0 : i.zoneFill) ?? {} },
867
863
  zoneStroke: { ...W.zoneStroke, ...(i == null ? void 0 : i.zoneStroke) ?? {} }
868
864
  };
869
- return (i == null ? void 0 : i.labelFontSize) === void 0 && (l.labelFontSize = d), l;
865
+ return (i == null ? void 0 : i.labelFontSize) === void 0 && (c.labelFontSize = d), c;
870
866
  }, [i, e, t]), f = {
871
- bleed: (o == null ? void 0 : o.bleed) ?? !0,
872
- zones: (o == null ? void 0 : o.zones) ?? !0,
873
- boundary: (o == null ? void 0 : o.boundary) ?? !0,
874
- safeArea: (o == null ? void 0 : o.safeArea) ?? !0,
875
- labels: (o == null ? void 0 : o.labels) ?? !0
867
+ bleed: (s == null ? void 0 : s.bleed) ?? !0,
868
+ zones: (s == null ? void 0 : s.zones) ?? !0,
869
+ boundary: (s == null ? void 0 : s.boundary) ?? !0,
870
+ safeArea: (s == null ? void 0 : s.safeArea) ?? !0,
871
+ labels: (s == null ? void 0 : s.labels) ?? !0
876
872
  }, w = e + r * 2, h = t + r * 2;
877
- return /* @__PURE__ */ s(
873
+ return /* @__PURE__ */ o(
878
874
  "svg",
879
875
  {
880
876
  xmlns: "http://www.w3.org/2000/svg",
@@ -882,11 +878,11 @@ function ot({
882
878
  preserveAspectRatio: "xMidYMid meet",
883
879
  className: m,
884
880
  style: { pointerEvents: "none", width: "100%", height: "100%" },
885
- children: /* @__PURE__ */ s("g", { transform: `translate(${r} ${r})`, children: a.map((d) => {
886
- const l = n == null ? void 0 : n[d.id], x = (l == null ? void 0 : l.zones) ?? [], S = (l == null ? void 0 : l.labels) ?? [], C = d.rotation ?? 0, g = C === 90 || C === 270, u = g ? d.height : d.width, p = g ? d.width : d.height, k = $e(l, u, p), v = ke(l, d, u, p), F = `translate(${d.x} ${d.y})`;
881
+ 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})`;
887
883
  let N = "";
888
884
  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)`);
889
- const z = N ? `${F} ${N}` : F, $ = c.safeAreaWashCornerRadius < 0 ? Math.round(Math.min(u, p) * 0.02) : c.safeAreaWashCornerRadius, P = l != null && l.boundary && (l.boundary.kind === "rect" || l.boundary.kind === "roundedRect") ? l.boundary : null, O = P ? P.kind === "rect" && $ > 0 ? {
885
+ 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 ? {
890
886
  kind: "roundedRect",
891
887
  x: P.x,
892
888
  y: P.y,
@@ -916,9 +912,9 @@ function ot({
916
912
  height: p
917
913
  }, H = O.kind === "rect" || O.kind === "roundedRect";
918
914
  return /* @__PURE__ */ b("g", { transform: z, children: [
919
- f.safeArea && H && /* @__PURE__ */ b(he, { children: [
915
+ f.safeArea && H && /* @__PURE__ */ b(be, { children: [
920
916
  /* @__PURE__ */ b("defs", { children: [
921
- /* @__PURE__ */ s(
917
+ /* @__PURE__ */ o(
922
918
  "filter",
923
919
  {
924
920
  id: G,
@@ -926,7 +922,7 @@ function ot({
926
922
  y: "-20%",
927
923
  width: "140%",
928
924
  height: "140%",
929
- children: /* @__PURE__ */ s(
925
+ children: /* @__PURE__ */ o(
930
926
  "feGaussianBlur",
931
927
  {
932
928
  in: "SourceGraphic",
@@ -947,7 +943,7 @@ function ot({
947
943
  )
948
944
  }
949
945
  ),
950
- /* @__PURE__ */ s("clipPath", { id: `piece-clip-${d.id}`, children: /* @__PURE__ */ s(
946
+ /* @__PURE__ */ o("clipPath", { id: `piece-clip-${d.id}`, children: /* @__PURE__ */ o(
951
947
  "rect",
952
948
  {
953
949
  x: 0,
@@ -957,12 +953,12 @@ function ot({
957
953
  }
958
954
  ) })
959
955
  ] }),
960
- /* @__PURE__ */ s(
956
+ /* @__PURE__ */ o(
961
957
  "g",
962
958
  {
963
959
  clipPath: `url(#piece-clip-${d.id})`,
964
960
  filter: `url(#${G})`,
965
- children: /* @__PURE__ */ s(
961
+ children: /* @__PURE__ */ o(
966
962
  "path",
967
963
  {
968
964
  d: `${J(Z)} ${J(O)}`,
@@ -971,35 +967,35 @@ function ot({
971
967
  // overrides — previously hardcoded, which silently
972
968
  // dropped ADR-0054 Phase 5 `pieceGuidesStyle` edits
973
969
  // in the Loom authoring preview.
974
- fill: c.bleedFill || "var(--color-bg-tertiary, #333)"
970
+ fill: l.bleedFill || "var(--color-bg-tertiary, #333)"
975
971
  },
976
- fillOpacity: c.bleedOpacity ?? 0.55,
972
+ fillOpacity: l.bleedOpacity ?? 0.55,
977
973
  fillRule: "evenodd"
978
974
  }
979
975
  )
980
976
  }
981
977
  )
982
978
  ] }),
983
- f.zones && x.filter((E) => E.kind !== "dieCut").map((E, R) => /* @__PURE__ */ s("g", { children: K(E.path, {
984
- fill: c.zoneFill[E.kind],
985
- stroke: c.zoneStroke[E.kind],
979
+ f.zones && g.filter((E) => E.kind !== "dieCut").map((E, R) => /* @__PURE__ */ o("g", { children: K(E.path, {
980
+ fill: l.zoneFill[E.kind],
981
+ stroke: l.zoneStroke[E.kind],
986
982
  strokeWidth: 1.5,
987
983
  strokeDasharray: E.kind === "wrap" ? "4 3" : void 0,
988
984
  vectorEffect: "non-scaling-stroke"
989
985
  }) }, `zone-${R}`)),
990
- f.zones && x.filter((E) => E.kind === "dieCut").map((E, R) => {
986
+ f.zones && g.filter((E) => E.kind === "dieCut").map((E, R) => {
991
987
  const T = E.path;
992
988
  if (T.kind !== "rect" && T.kind !== "roundedRect")
993
989
  return null;
994
990
  const Q = T.kind === "roundedRect" ? T.rx ?? T.ry ?? 0 : 0, ee = T.kind === "roundedRect" ? T.ry ?? T.rx ?? 0 : 0;
995
- return /* @__PURE__ */ s(
991
+ return /* @__PURE__ */ o(
996
992
  "foreignObject",
997
993
  {
998
994
  x: T.x,
999
995
  y: T.y,
1000
996
  width: T.width,
1001
997
  height: T.height,
1002
- children: /* @__PURE__ */ s(
998
+ children: /* @__PURE__ */ o(
1003
999
  "div",
1004
1000
  {
1005
1001
  xmlns: "http://www.w3.org/1999/xhtml",
@@ -1024,34 +1020,34 @@ function ot({
1024
1020
  `diecut-${R}`
1025
1021
  );
1026
1022
  }),
1027
- f.boundary && c.boundaryStroke && K(k, {
1023
+ f.boundary && l.boundaryStroke && K(k, {
1028
1024
  fill: "none",
1029
- stroke: c.boundaryStroke,
1030
- strokeWidth: c.boundaryStrokeWidth,
1025
+ stroke: l.boundaryStroke,
1026
+ strokeWidth: l.boundaryStrokeWidth,
1031
1027
  vectorEffect: "non-scaling-stroke"
1032
1028
  }),
1033
- f.safeArea && v && c.safeAreaStroke && K(v, {
1029
+ f.safeArea && v && l.safeAreaStroke && K(v, {
1034
1030
  fill: "none",
1035
- stroke: c.safeAreaStroke,
1036
- strokeWidth: c.safeAreaStrokeWidth,
1037
- strokeDasharray: c.safeAreaDashArray,
1031
+ stroke: l.safeAreaStroke,
1032
+ strokeWidth: l.safeAreaStrokeWidth,
1033
+ strokeDasharray: l.safeAreaDashArray,
1038
1034
  vectorEffect: "non-scaling-stroke"
1039
1035
  }),
1040
1036
  f.labels && S.map((E, R) => {
1041
1037
  const T = Te[E.anchor ?? "c"];
1042
- return /* @__PURE__ */ s(
1038
+ return /* @__PURE__ */ o(
1043
1039
  "text",
1044
1040
  {
1045
1041
  x: E.x,
1046
1042
  y: E.y,
1047
1043
  textAnchor: T.textAnchor,
1048
1044
  dominantBaseline: T.dominantBaseline,
1049
- fontSize: c.labelFontSize,
1050
- fontFamily: c.labelFontFamily,
1051
- fill: c.labelColor,
1045
+ fontSize: l.labelFontSize,
1046
+ fontFamily: l.labelFontFamily,
1047
+ fill: l.labelColor,
1052
1048
  style: { paintOrder: "stroke" },
1053
1049
  stroke: "#ffffff",
1054
- strokeWidth: Math.max(2, c.labelFontSize * 0.25),
1050
+ strokeWidth: Math.max(2, l.labelFontSize * 0.25),
1055
1051
  strokeLinejoin: "round",
1056
1052
  children: E.text
1057
1053
  },
@@ -1063,76 +1059,76 @@ function ot({
1063
1059
  }
1064
1060
  );
1065
1061
  }
1066
- ae();
1062
+ le();
1067
1063
  export {
1068
1064
  br as ArtboardElement,
1069
- it as ArtboardPropertiesToolbar,
1070
- lt as ArtboardTabs,
1071
- ct as AutoExportManager,
1072
- dt as BackgroundPickerDropdown,
1065
+ st as ArtboardPropertiesToolbar,
1066
+ at as ArtboardTabs,
1067
+ ot as AutoExportManager,
1068
+ it as BackgroundPickerDropdown,
1073
1069
  yr as BaseElement,
1074
- ut as BoldButton,
1075
- We as ButtonGroup,
1076
- mt as Canvas,
1070
+ ct as BoldButton,
1071
+ ze as ButtonGroup,
1072
+ lt as Canvas,
1077
1073
  Ce as CanvasEventBus,
1078
- ft as CanvasSkeleton,
1079
- ht as ColorPickerDropdown,
1080
- pt as ContextualToolbars,
1081
- Le as ControlGroup,
1082
- xt as CropPanel,
1083
- gt as DEFAULT_AUTO_EXPORT_CONFIG,
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,
1084
1080
  te as Dropdown,
1085
- bt as DropdownMenu,
1081
+ pt as DropdownMenu,
1086
1082
  ar as EditorProvider,
1087
- yt as EffectsPanel,
1088
- vt as ExportPanel,
1089
- wt as FontBrowserDrawer,
1090
- St as FontColorButton,
1083
+ gt as EffectsPanel,
1084
+ xt as ExportPanel,
1085
+ bt as FontBrowserDrawer,
1086
+ yt as FontColorButton,
1091
1087
  Se as FontSizeDropdown,
1092
- He as FontSizeGroup,
1093
- Ct as GlyphPanel,
1094
- ie as GroupElement,
1088
+ Xe as FontSizeGroup,
1089
+ vt as GlyphPanel,
1090
+ ue as GroupElement,
1095
1091
  vr as ImageElement,
1096
- Et as ImagePanel,
1097
- Tt as ImageToolbar,
1098
- $t as ItalicButton,
1099
- kt as KIT_PRESETS,
1100
- At as KitProvider,
1101
- Ft as LayersPanel,
1102
- Pt as LayersPanelSkeleton,
1103
- Nt as MenuButton,
1104
- Rt as MenuItem,
1105
- Bt as MoreMenu,
1106
- rn as PIECE_GUIDES_API_BASE,
1107
- sr as PRESERVE_SELECTION_ATTR,
1108
- Oe as Panel,
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,
1109
1105
  wr as PathElement,
1110
- Dt as PathToolbar,
1106
+ Nt as PathToolbar,
1111
1107
  Sr as RichText,
1112
- Ge as SecondaryToolbar,
1108
+ We as SecondaryToolbar,
1113
1109
  Cr as ShapeElement,
1114
- Mt as ShapeToolbar,
1115
- It as ShapeTypeDrawer,
1116
- zt as Spinner,
1117
- Hr as Surface,
1118
- _e as Switch,
1119
- Ot as TextAlignButton,
1110
+ Rt as ShapeToolbar,
1111
+ Bt as ShapeTypeDrawer,
1112
+ Dt as Spinner,
1113
+ Mt as Surface,
1114
+ Le as Switch,
1115
+ It as TextAlignButton,
1120
1116
  Er as TextElement,
1121
- Lt as TextMoreMenu,
1122
- Wt as TextToolbar,
1117
+ zt as TextMoreMenu,
1118
+ Ot as TextToolbar,
1123
1119
  ir as ThemeProvider,
1124
- Ke as Toggle,
1125
- Kt as ToolbarSkeleton,
1126
- _t as TransformControlPanel,
1127
- Gt as UnderlineButton,
1128
- Ut as UppercaseButton,
1129
- ot as VisualGuideOverlay,
1130
- jt as ZoomControls,
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,
1131
1127
  Ee as canvasEventBus,
1132
- Jt as getAllSections,
1133
- tt as getCustomElementTypes,
1134
- qt as getSection,
1135
- Vt as getSectionIds,
1128
+ Ut as getAllSections,
1129
+ He as getCustomElementTypes,
1130
+ jt as getSection,
1131
+ Jt as getSectionIds,
1136
1132
  Tr as hasDistressEffect,
1137
1133
  $r as hasMasks,
1138
1134
  kr as hasStroke,
@@ -1152,45 +1148,45 @@ export {
1152
1148
  Vr as isPathElement,
1153
1149
  Lr as isPathElementConfig,
1154
1150
  Wr as isPathTransform,
1155
- rt as isRegisteredElementType,
1151
+ Qe as isRegisteredElementType,
1156
1152
  Xr as isShapeElement,
1157
1153
  Kr as isShapeElementConfig,
1158
1154
  _r as isShapeTransform,
1159
1155
  Yr as isTextElement,
1160
1156
  Gr as isTextElementConfig,
1161
1157
  Ur as isWaveTransform,
1162
- je as loadKitFromJSON,
1163
- nn as pieceGuidesForArtboard,
1164
- lr as preserveSelectionProps,
1165
- Xt as registerBuiltinSections,
1166
- Yt as registerBuiltinSectionsSync,
1167
- Qe as registerElementType,
1168
- Zt as registerSection,
1169
- Ht as renderPieceGuides,
1170
- Ue as serializeKit,
1171
- cr as shouldPreserveSelection,
1172
- Qr as surfaceVariants,
1173
- et as unregisterElementType,
1174
- Qt as unregisterSection,
1175
- qe as useBreakpoint,
1176
- nt as useCanvasEvents,
1177
- er as useCapabilities,
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,
1178
1174
  dr as useCommandContext,
1179
- Xe as useElementById,
1175
+ Je as useElementById,
1180
1176
  ur as useElementsContext,
1181
1177
  mr as useHistoryContext,
1182
- tr as useKit,
1183
- Ye as useLayerDragDrop,
1184
- rr as useLayerPreview,
1185
- Ze as useLayerSelection,
1186
- Ve as usePerformance,
1187
- on as usePieceGuideBundle,
1188
- Je as useProjectLoader,
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,
1189
1185
  fr as useSelectionContext,
1190
- en as useSurface,
1186
+ rr as useSurface,
1191
1187
  nr as useTextToolbar,
1192
1188
  hr as useTheme,
1193
1189
  pr as useToolStateContext,
1194
- xr as useViewportContext
1190
+ gr as useViewportContext
1195
1191
  };
1196
1192
  //# sourceMappingURL=advanced.mjs.map