@snowcone-app/canvas 0.46.2 → 0.46.5

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 (55) hide show
  1. package/dist/{CanvasRenderer-B8BADU_r.js → CanvasRenderer-CmIQSVCK.js} +4 -4
  2. package/dist/{CanvasRenderer-B8BADU_r.js.map → CanvasRenderer-CmIQSVCK.js.map} +1 -1
  3. package/dist/{ContextualToolbars-5tHC6s0Y.js → ContextualToolbars-Dmo86Wd2.js} +323 -322
  4. package/dist/{ContextualToolbars-5tHC6s0Y.js.map → ContextualToolbars-Dmo86Wd2.js.map} +1 -1
  5. package/dist/{EditorCanvasImpl-Cd_umlTI.js → EditorCanvasImpl-BHa8q4iO.js} +16 -15
  6. package/dist/{EditorCanvasImpl-Cd_umlTI.js.map → EditorCanvasImpl-BHa8q4iO.js.map} +1 -1
  7. package/dist/{ExportManager-xRsXgyNo.js → ExportManager-DEJgxB0S.js} +79 -78
  8. package/dist/{ExportManager-xRsXgyNo.js.map → ExportManager-DEJgxB0S.js.map} +1 -1
  9. package/dist/{FontAnalyzer-Ds3Wdba7.js → FontAnalyzer-CLMJi2Sw.js} +374 -409
  10. package/dist/FontAnalyzer-CLMJi2Sw.js.map +1 -0
  11. package/dist/{ImagePanel-bW3yr6Ac.js → ImagePanel-4fHABjNT.js} +6 -6
  12. package/dist/{ImagePanel-bW3yr6Ac.js.map → ImagePanel-4fHABjNT.js.map} +1 -1
  13. package/dist/{SnowconeCanvas-crxPwbib.js → SnowconeCanvas-GPag5BXG.js} +10 -10
  14. package/dist/{SnowconeCanvas-crxPwbib.js.map → SnowconeCanvas-GPag5BXG.js.map} +1 -1
  15. package/dist/advanced.mjs +54 -54
  16. package/dist/core/image-adjustments.d.ts +2 -4
  17. package/dist/core/masked-crop.d.ts +3 -55
  18. package/dist/{custom-icons-DQRp8GhF.js → custom-icons-Dt0Y4VSn.js} +2 -2
  19. package/dist/{custom-icons-DQRp8GhF.js.map → custom-icons-Dt0Y4VSn.js.map} +1 -1
  20. package/dist/design-builder-HKRo18WT.js +1798 -0
  21. package/dist/design-builder-HKRo18WT.js.map +1 -0
  22. package/dist/{embed-DvN5BVmQ.js → embed-DhjsJ3ni.js} +698 -688
  23. package/dist/embed-DhjsJ3ni.js.map +1 -0
  24. package/dist/embed.mjs +35 -36
  25. package/dist/embed.mjs.map +1 -1
  26. package/dist/{export-worker.bundle.string-BL30CYzH.js → export-worker.bundle.string-CyMb_XjB.js} +27 -25
  27. package/dist/{export-worker.bundle.string-BL30CYzH.js.map → export-worker.bundle.string-CyMb_XjB.js.map} +1 -1
  28. package/dist/{guards-DwYEoqcn.js → guards-Dk86a-kH.js} +2 -2
  29. package/dist/{guards-DwYEoqcn.js.map → guards-Dk86a-kH.js.map} +1 -1
  30. package/dist/index.mjs +43 -43
  31. package/dist/internals.mjs +150 -149
  32. package/dist/internals.mjs.map +1 -1
  33. package/dist/rendering/serialize-for-server.d.ts +4 -91
  34. package/dist/state/CanvasStateV1.d.ts +1 -363
  35. package/dist/{CanvasStateV1-BlDWgOzV.js → template-fields-CKEuUmTM.js} +1997 -1835
  36. package/dist/template-fields-CKEuUmTM.js.map +1 -0
  37. package/dist/testing.mjs +61 -60
  38. package/dist/testing.mjs.map +1 -1
  39. package/dist/{useCommands-F-b_SwW-.js → useCommands-BI7O5Lf0.js} +225 -225
  40. package/dist/{useCommands-F-b_SwW-.js.map → useCommands-BI7O5Lf0.js.map} +1 -1
  41. package/dist/{usePieceGuideBundle-BWdobHQE.js → usePieceGuideBundle-DJfjOVEd.js} +2 -2
  42. package/dist/{usePieceGuideBundle-BWdobHQE.js.map → usePieceGuideBundle-DJfjOVEd.js.map} +1 -1
  43. package/dist/utils/custom-fonts.d.ts +2 -16
  44. package/dist/{validation-hn5ZX8Po.js → validation-au_-Sj-A.js} +11 -11
  45. package/dist/{validation-hn5ZX8Po.js.map → validation-au_-Sj-A.js.map} +1 -1
  46. package/dist/workers/export-worker.bundle.string.d.ts +1 -1
  47. package/example/package.json +1 -1
  48. package/package.json +5 -4
  49. package/dist/CanvasStateV1-BlDWgOzV.js.map +0 -1
  50. package/dist/FontAnalyzer-Ds3Wdba7.js.map +0 -1
  51. package/dist/design-builder-sH53Og6j.js +0 -1870
  52. package/dist/design-builder-sH53Og6j.js.map +0 -1
  53. package/dist/embed-DvN5BVmQ.js.map +0 -1
  54. package/dist/template-fields-BaQG0CJY.js +0 -559
  55. package/dist/template-fields-BaQG0CJY.js.map +0 -1
@@ -1,12 +1,13 @@
1
1
  import { jsx as E, jsxs as O, Fragment as R } from "react/jsx-runtime";
2
2
  import { forwardRef as T, useContext as F, useSyncExternalStore as D, useMemo as N, useRef as w, useLayoutEffect as j } from "react";
3
- import { S as $ } from "./SnowconeCanvas-crxPwbib.js";
4
- import { C as G } from "./ContextualToolbars-5tHC6s0Y.js";
5
- import { s as I, u as J, a as U } from "./design-builder-sH53Og6j.js";
6
- import { u as V } from "./embed-DvN5BVmQ.js";
7
- import { A as z, T as L } from "./FontAnalyzer-Ds3Wdba7.js";
8
- import { E as P } from "./ExportManager-xRsXgyNo.js";
9
- import { E as M } from "./useCommands-F-b_SwW-.js";
3
+ import { S as $ } from "./SnowconeCanvas-GPag5BXG.js";
4
+ import { C as G } from "./ContextualToolbars-Dmo86Wd2.js";
5
+ import { u as I } from "./embed-DhjsJ3ni.js";
6
+ import { u as J, a as U } from "./design-builder-HKRo18WT.js";
7
+ import { A as V, T as z } from "./FontAnalyzer-CLMJi2Sw.js";
8
+ import { E as L } from "./ExportManager-DEJgxB0S.js";
9
+ import { E as M } from "./useCommands-BI7O5Lf0.js";
10
+ import { serializeStateForServer as P } from "@snowcone-app/design/wire";
10
11
  const q = () => () => {
11
12
  };
12
13
  function K() {
@@ -41,7 +42,7 @@ function K() {
41
42
  if (u)
42
43
  return u.registerCanvasBridge({
43
44
  setTextByName(c, s) {
44
- const { elementStore: l, executeElementUpdate: a } = n.current, e = l.getAllByName(c).filter((t) => t instanceof L);
45
+ const { elementStore: l, executeElementUpdate: a } = n.current, e = l.getAllByName(c).filter((t) => t instanceof z);
45
46
  if (e.length === 0) return !1;
46
47
  for (const t of e) {
47
48
  const r = t.clone();
@@ -57,7 +58,7 @@ function K() {
57
58
  const { artboardManager: s, elementStore: l } = n.current, a = s.getAllArtboards(), e = a[0];
58
59
  if (!e) return !1;
59
60
  if (a.some((i) => i.name === c)) return !0;
60
- const t = new z({
61
+ const t = new V({
61
62
  name: c,
62
63
  x: e.x,
63
64
  y: e.y,
@@ -72,7 +73,7 @@ function K() {
72
73
  const d = l.get(i);
73
74
  if (!d) continue;
74
75
  const o = { ...d.toJSON() };
75
- delete o.id, o.artboard = c, n.current.executeAddElement(P.createFromJSON(o), t.id);
76
+ delete o.id, o.artboard = c, n.current.executeAddElement(L.createFromJSON(o), t.id);
76
77
  }
77
78
  return n.current.refreshArtboards(), !0;
78
79
  },
@@ -90,7 +91,7 @@ function K() {
90
91
  });
91
92
  }, [u]), null;
92
93
  }
93
- const oe = T(
94
+ const ne = T(
94
95
  function({
95
96
  children: b,
96
97
  kit: x = "embed-only",
@@ -104,7 +105,7 @@ const oe = T(
104
105
  className: u,
105
106
  style: c
106
107
  }, s) {
107
- const { placement: l, throttleMs: a, pieceGuides: e, pushRender: t, stateStore: r } = V(), i = F(M), d = i !== null, o = (i == null ? void 0 : i.registry) ?? null;
108
+ const { placement: l, throttleMs: a, pieceGuides: e, pushRender: t, stateStore: r } = I(), i = F(M), d = i !== null, o = (i == null ? void 0 : i.registry) ?? null;
108
109
  D(
109
110
  o ? o.subscribe : q,
110
111
  o ? o.getVersion : () => 0,
@@ -132,13 +133,13 @@ const oe = T(
132
133
  pieceGuides: e ?? void 0,
133
134
  onChange: (h) => {
134
135
  var B;
135
- r.setState(h), t(I(h), a), (B = C.current) == null || B.call(C, h);
136
+ r.setState(h), t(P(h), a), (B = C.current) == null || B.call(C, h);
136
137
  }
137
138
  }
138
139
  ) });
139
140
  }
140
141
  );
141
142
  export {
142
- oe as EditorCanvasImpl
143
+ ne as EditorCanvasImpl
143
144
  };
144
- //# sourceMappingURL=EditorCanvasImpl-Cd_umlTI.js.map
145
+ //# sourceMappingURL=EditorCanvasImpl-BHa8q4iO.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EditorCanvasImpl-Cd_umlTI.js","sources":["../src/components/editor/EditorCanvasImpl.tsx"],"sourcesContent":["'use client';\n\n/**\n * The heavy half of `Editor.Canvas` (and of the legacy `<RealtimeCanvas>`),\n * extracted from RealtimeCanvas's body. This module statically imports\n * `SnowconeCanvas` — i.e. the full rendering engine — and is therefore ONLY\n * ever reached through a dynamic `import()` (D9): the embed entry's static\n * import graph stays renderer-free, mechanically enforced by the\n * import-graph CI check.\n *\n * Beyond the original wiring (seed → SnowconeCanvas, edit →\n * `serializeStateForServer` → `pushRender`), this adds the ADR-0085 §3 store\n * wiring: every canvas change lands in the Root's {@link DesignStateStore}\n * (the ONE live design state), and a {@link CanvasBridge} is registered so\n * `Editor.TextField` writes route through the editor command path (undo/redo,\n * repaint) while a canvas is mounted — the editor document stays the single\n * write authority.\n */\n\nimport React, {\n forwardRef,\n useContext,\n useLayoutEffect,\n useMemo,\n useRef,\n useSyncExternalStore,\n type CSSProperties,\n type ReactNode,\n} from 'react';\nimport { SnowconeCanvas } from '../embed/SnowconeCanvas.js';\nimport { ContextualToolbars } from '../ContextualToolbars.js';\nimport type { CanvasState, SnowconeCanvasHandle } from '../embed/SnowconeCanvas.js';\nimport { serializeStateForServer } from '../../rendering/serialize-for-server.js';\nimport type { KitPresetId, KitDefinition } from '../../kits/types.js';\nimport type { CanvasServices } from '../../contexts/CanvasServicesContext.js';\nimport { useEmbedContext } from '../embed-realtime/context.js';\nimport { useElementsContext } from '../../contexts/ElementsContext.js';\nimport { useCommandContext } from '../../contexts/CommandContext.js';\nimport { TextElement } from '../../core/TextElement.js';\nimport { ArtboardElement } from '../../core/ArtboardElement.js';\nimport { ElementFactory } from '../../core/ElementFactory.js';\nimport type { AnyElementConfig } from '../../types/index.js';\nimport { EditorRootInternalsContext } from './RootInternals.js';\n\nexport interface EditorCanvasImplProps {\n /** Your controls (toolbar, inputs). Rendered as an overlay inside the editor\n * context so binding hooks work. */\n children?: ReactNode;\n /** Editor chrome preset. `Editor.Canvas` pins the chrome-less `'embed-only'`;\n * the legacy `<RealtimeCanvas kit>` prop passes richer presets through. */\n kit?: KitPresetId | KitDefinition;\n /** Inherit the host app's theme instead of managing its own (default true). */\n inheritTheme?: boolean;\n /** Cap the canvas height in px. */\n maxHeight?: number;\n /** Privileged-service wiring override (usually inherited from Root). */\n services?: CanvasServices;\n /** Observe the live design state (the same {@link CanvasState} the Root's\n * state store tracks). Safe to pass inline — read through a ref. */\n onChange?: (state: CanvasState) => void;\n /** Whether the wrapping div self-applies `.sc-root`. The legacy\n * `<RealtimeCanvas>` always did (it could be the only Snowcone DOM on the\n * page); under `Editor.Root` the Root applies it once and parts never\n * self-apply (ADR-0085). Re-applying is harmless (same variables), so the\n * legacy wrapper keeps `true` for bit-identical back-compat. */\n selfScope?: boolean;\n /** `data-sc-part` value for the wrapping div (the parts contract). */\n partAttr?: string;\n /** Mount the built-in floating contextual toolbar (ADR-0085 §5: with no\n * `Editor.Controls` mounted, `Editor.Canvas` defaults to the floating\n * toolbar; a registered DOCKED Controls suppresses it). Set by\n * `Editor.Canvas` only — the legacy `<RealtimeCanvas>` wrapper keeps\n * today's chrome-less behavior. @internal */\n builtinControls?: boolean;\n className?: string;\n style?: CSSProperties;\n}\n\nconst noopSubscribe = (): (() => void) => () => {};\n\n/**\n * Runs INSIDE the canvas's editor context (the overlay slot) and registers\n * the imperative bridge sibling parts use to edit by layer name through the\n * command path. Generalizes `useTextBinding`'s write mechanics to a dynamic\n * name (a hook can't take names at call time).\n */\nfunction CanvasBindingBridge(): null {\n const { elementStore, artboardManager, refreshArtboards } = useElementsContext();\n const {\n executeElementUpdate,\n executeAddElement,\n executeRemoveElement,\n executeCreateArtboard,\n executeDeleteArtboard,\n } = useCommandContext();\n // Tolerant on purpose: the legacy <RealtimeCanvas> is supported inside a\n // bare EmbedContext (advanced consumers provide their own); only under an\n // <Editor.Root> is there a registry to bridge into.\n const internals = useContext(EditorRootInternalsContext);\n\n const latest = useRef({\n elementStore,\n artboardManager,\n refreshArtboards,\n executeElementUpdate,\n executeAddElement,\n executeRemoveElement,\n executeCreateArtboard,\n executeDeleteArtboard,\n });\n latest.current = {\n elementStore,\n artboardManager,\n refreshArtboards,\n executeElementUpdate,\n executeAddElement,\n executeRemoveElement,\n executeCreateArtboard,\n executeDeleteArtboard,\n };\n\n const registry = internals?.registry ?? null;\n useLayoutEffect(() => {\n if (!registry) return;\n return registry.registerCanvasBridge({\n setTextByName(name: string, text: string): boolean {\n const { elementStore: store, executeElementUpdate: execute } = latest.current;\n const matches = store.getAllByName(name).filter((el): el is TextElement => el instanceof TextElement);\n if (matches.length === 0) return false;\n for (const el of matches) {\n const cloned = el.clone() as TextElement;\n cloned.setText(text);\n execute(el, cloned);\n }\n return true;\n },\n // ADR-0101: split = clone the BASE artboard (the first one) and every\n // element on it into a new artboard named `label`, through the command\n // path so it is one undoable step per command and lands in the Root\n // store via onChange like any edit.\n splitArtboard(label: string): boolean {\n const { artboardManager: mgr, elementStore: store } = latest.current;\n const all = mgr.getAllArtboards();\n const base = all[0];\n if (!base) return false;\n if (all.some((ab) => ab.name === label)) return true;\n const next = new ArtboardElement({\n name: label,\n x: base.x,\n y: base.y,\n width: base.width,\n height: base.height,\n backgroundColor: base.backgroundColor,\n });\n latest.current.executeCreateArtboard(next);\n // CreateArtboardCommand re-creates from a clone of the basic config;\n // carry the fields it doesn't (export flag, clip, role) directly.\n const created = mgr.getArtboard(next.id);\n if (created) {\n created.exportBackground = base.exportBackground;\n created.clipShape = base.clipShape;\n created.role = base.role;\n created.imageFit = base.imageFit ? { ...base.imageFit } : undefined;\n created.engrave = base.engrave ? { ...base.engrave } : undefined;\n }\n for (const id of mgr.getElementsOnArtboard(base.id)) {\n const el = store.get(id);\n if (!el) continue;\n const json = { ...(el.toJSON() as AnyElementConfig) } as AnyElementConfig & { id?: string; artboard?: string };\n delete json.id;\n json.artboard = label;\n latest.current.executeAddElement(ElementFactory.createFromJSON(json) as Parameters<typeof executeAddElement>[0], next.id);\n }\n latest.current.refreshArtboards();\n return true;\n },\n // ADR-0101: link = remove the artboard named `label` and its elements\n // through the command path; the placement inherits the base again.\n removeArtboard(label: string): boolean {\n const { artboardManager: mgr, elementStore: store } = latest.current;\n const target = mgr.getAllArtboards().find((ab) => ab.name === label);\n if (!target) return false;\n for (const id of [...mgr.getElementsOnArtboard(target.id)]) {\n const el = store.get(id);\n if (el) latest.current.executeRemoveElement(el as Parameters<typeof executeRemoveElement>[0]);\n }\n latest.current.executeDeleteArtboard(target);\n latest.current.refreshArtboards();\n return true;\n },\n });\n }, [registry]);\n\n return null;\n}\n\nexport const EditorCanvasImpl = forwardRef<SnowconeCanvasHandle, EditorCanvasImplProps>(\n function EditorCanvasImpl(\n {\n children,\n kit = 'embed-only',\n inheritTheme = true,\n maxHeight,\n services,\n onChange,\n selfScope = false,\n partAttr,\n builtinControls = false,\n className,\n style,\n }: EditorCanvasImplProps,\n ref,\n ): React.ReactElement {\n const { placement, throttleMs, pieceGuides, pushRender, stateStore } = useEmbedContext();\n\n // Under an <Editor.Root> the editor document is mounted by the ROOT (P1\n // provider inversion, D9: state always) — SnowconeCanvas must write into\n // that document instead of mounting its own, and a REMOUNT of this part\n // must rebuild the (surviving) document from the live seed instead of\n // accreting onto the previous mount's artboards/elements. The legacy\n // <RealtimeCanvas> inside a bare EmbedContext (no Root) keeps mounting\n // its own provider, exactly as before.\n const rootInternals = useContext(EditorRootInternalsContext);\n const underRoot = rootInternals !== null;\n\n // ADR-0085 §5 (Controls placement resolution): with no Editor.Controls\n // mounted — or a `placement=\"floating\"` one — the canvas owns the\n // floating contextual toolbar; a registered DOCKED Controls suppresses\n // it. Subscribed to the part registry so the zones swap live when a\n // docked Controls mounts/unmounts.\n const partsRegistry = rootInternals?.registry ?? null;\n useSyncExternalStore(\n partsRegistry ? partsRegistry.subscribe : noopSubscribe,\n partsRegistry ? partsRegistry.getVersion : () => 0,\n partsRegistry ? partsRegistry.getVersion : () => 0,\n );\n const showBuiltinFloatingControls =\n builtinControls && underRoot && !(partsRegistry?.hasDockedControls() ?? false);\n\n // Seed from the LIVE store, not the original design (ADR-0085 §3): the\n // store starts as design.toJSON(), so a fresh mount is identical to the\n // old behavior — but edits made while this chunk was loading (e.g. a\n // TextField keystroke in the first second) survive instead of being\n // clobbered by a stale seed. Captured once per store identity; later\n // store changes flow through the editor document, not re-seeding.\n const seed = useMemo(() => stateStore.getState(), [stateStore]);\n\n // Latest-ref so a host's inline `onChange` identity never matters here\n // (SnowconeCanvas already refs ITS callback; this keeps ours symmetric).\n const onChangeRef = useRef(onChange);\n onChangeRef.current = onChange;\n\n const rootClass = selfScope ? 'sc-root' : 'sc-canvas-frame';\n\n return (\n <div className={`${rootClass}${className ? ` ${className}` : ''}`} style={style} data-sc-part={partAttr}>\n <SnowconeCanvas\n ref={ref}\n kit={kit}\n inheritTheme={inheritTheme}\n services={services}\n externalProvider={underRoot}\n resetDocumentOnMount={underRoot}\n artboards={seed.artboards}\n activeArtboard={placement}\n initialElements={seed.elements}\n layoutConfig={maxHeight ? { maxHeight } : undefined}\n overlay={\n <>\n <CanvasBindingBridge />\n {showBuiltinFloatingControls ? <ContextualToolbars mode=\"floating\" partAttr=\"controls\" /> : null}\n {children}\n </>\n }\n // #566: the product's printable-area / dead-zone overlay, fetched and\n // dims-gated by the Root — same overlay snowcone.app's editor\n // shows, so a buyer can't unknowingly edit under a camera cutout.\n pieceGuides={pieceGuides ?? undefined}\n onChange={(state) => {\n // ONE store, last-write-wins (ADR-0085 §3): the editor document is\n // the write authority while mounted; the Root store derives from\n // its onChange, then the render follows the store.\n stateStore.setState(state);\n pushRender(serializeStateForServer(state), throttleMs);\n onChangeRef.current?.(state);\n }}\n />\n </div>\n );\n },\n);\n\nexport type { CanvasState, SnowconeCanvasHandle };\n"],"names":["noopSubscribe","CanvasBindingBridge","elementStore","artboardManager","refreshArtboards","useElementsContext","executeElementUpdate","executeAddElement","executeRemoveElement","executeCreateArtboard","executeDeleteArtboard","useCommandContext","internals","useContext","EditorRootInternalsContext","latest","useRef","registry","useLayoutEffect","name","text","store","execute","matches","el","TextElement","cloned","label","mgr","all","base","ab","next","ArtboardElement","created","id","json","ElementFactory","target","EditorCanvasImpl","forwardRef","children","kit","inheritTheme","maxHeight","services","onChange","selfScope","partAttr","builtinControls","className","style","ref","placement","throttleMs","pieceGuides","pushRender","stateStore","useEmbedContext","rootInternals","underRoot","partsRegistry","useSyncExternalStore","showBuiltinFloatingControls","seed","useMemo","onChangeRef","jsx","SnowconeCanvas","jsxs","Fragment","ContextualToolbars","state","serializeStateForServer","_a"],"mappings":";;;;;;;;;AA8EA,MAAMA,IAAgB,MAAoB,MAAM;AAAC;AAQjD,SAASC,IAA4B;AACnC,QAAM,EAAE,cAAAC,GAAc,iBAAAC,GAAiB,kBAAAC,EAAA,IAAqBC,EAAA,GACtD;AAAA,IACJ,sBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,uBAAAC;AAAA,IACA,uBAAAC;AAAA,EAAA,IACEC,EAAA,GAIEC,IAAYC,EAAWC,CAA0B,GAEjDC,IAASC,EAAO;AAAA,IACpB,cAAAd;AAAA,IACA,iBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,sBAAAE;AAAA,IACA,mBAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,uBAAAC;AAAA,IACA,uBAAAC;AAAA,EAAA,CACD;AACD,EAAAK,EAAO,UAAU;AAAA,IACf,cAAAb;AAAA,IACA,iBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,sBAAAE;AAAA,IACA,mBAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,uBAAAC;AAAA,IACA,uBAAAC;AAAA,EAAA;AAGF,QAAMO,KAAWL,KAAA,gBAAAA,EAAW,a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QAAAQ,EAAA,KAAAR,GAAsBM;AAAA,QACxB;AAAA,MAAA;AAAA,IAAA,GAEJ;AAAA,EAEJ;AACF;"}
1
+ {"version":3,"file":"EditorCanvasImpl-BHa8q4iO.js","sources":["../src/components/editor/EditorCanvasImpl.tsx"],"sourcesContent":["'use client';\n\n/**\n * The heavy half of `Editor.Canvas` (and of the legacy `<RealtimeCanvas>`),\n * extracted from RealtimeCanvas's body. This module statically imports\n * `SnowconeCanvas` — i.e. the full rendering engine — and is therefore ONLY\n * ever reached through a dynamic `import()` (D9): the embed entry's static\n * import graph stays renderer-free, mechanically enforced by the\n * import-graph CI check.\n *\n * Beyond the original wiring (seed → SnowconeCanvas, edit →\n * `serializeStateForServer` → `pushRender`), this adds the ADR-0085 §3 store\n * wiring: every canvas change lands in the Root's {@link DesignStateStore}\n * (the ONE live design state), and a {@link CanvasBridge} is registered so\n * `Editor.TextField` writes route through the editor command path (undo/redo,\n * repaint) while a canvas is mounted — the editor document stays the single\n * write authority.\n */\n\nimport React, {\n forwardRef,\n useContext,\n useLayoutEffect,\n useMemo,\n useRef,\n useSyncExternalStore,\n type CSSProperties,\n type ReactNode,\n} from 'react';\nimport { SnowconeCanvas } from '../embed/SnowconeCanvas.js';\nimport { ContextualToolbars } from '../ContextualToolbars.js';\nimport type { CanvasState, SnowconeCanvasHandle } from '../embed/SnowconeCanvas.js';\nimport { serializeStateForServer } from '../../rendering/serialize-for-server.js';\nimport type { KitPresetId, KitDefinition } from '../../kits/types.js';\nimport type { CanvasServices } from '../../contexts/CanvasServicesContext.js';\nimport { useEmbedContext } from '../embed-realtime/context.js';\nimport { useElementsContext } from '../../contexts/ElementsContext.js';\nimport { useCommandContext } from '../../contexts/CommandContext.js';\nimport { TextElement } from '../../core/TextElement.js';\nimport { ArtboardElement } from '../../core/ArtboardElement.js';\nimport { ElementFactory } from '../../core/ElementFactory.js';\nimport type { AnyElementConfig } from '../../types/index.js';\nimport { EditorRootInternalsContext } from './RootInternals.js';\n\nexport interface EditorCanvasImplProps {\n /** Your controls (toolbar, inputs). Rendered as an overlay inside the editor\n * context so binding hooks work. */\n children?: ReactNode;\n /** Editor chrome preset. `Editor.Canvas` pins the chrome-less `'embed-only'`;\n * the legacy `<RealtimeCanvas kit>` prop passes richer presets through. */\n kit?: KitPresetId | KitDefinition;\n /** Inherit the host app's theme instead of managing its own (default true). */\n inheritTheme?: boolean;\n /** Cap the canvas height in px. */\n maxHeight?: number;\n /** Privileged-service wiring override (usually inherited from Root). */\n services?: CanvasServices;\n /** Observe the live design state (the same {@link CanvasState} the Root's\n * state store tracks). Safe to pass inline — read through a ref. */\n onChange?: (state: CanvasState) => void;\n /** Whether the wrapping div self-applies `.sc-root`. The legacy\n * `<RealtimeCanvas>` always did (it could be the only Snowcone DOM on the\n * page); under `Editor.Root` the Root applies it once and parts never\n * self-apply (ADR-0085). Re-applying is harmless (same variables), so the\n * legacy wrapper keeps `true` for bit-identical back-compat. */\n selfScope?: boolean;\n /** `data-sc-part` value for the wrapping div (the parts contract). */\n partAttr?: string;\n /** Mount the built-in floating contextual toolbar (ADR-0085 §5: with no\n * `Editor.Controls` mounted, `Editor.Canvas` defaults to the floating\n * toolbar; a registered DOCKED Controls suppresses it). Set by\n * `Editor.Canvas` only — the legacy `<RealtimeCanvas>` wrapper keeps\n * today's chrome-less behavior. @internal */\n builtinControls?: boolean;\n className?: string;\n style?: CSSProperties;\n}\n\nconst noopSubscribe = (): (() => void) => () => {};\n\n/**\n * Runs INSIDE the canvas's editor context (the overlay slot) and registers\n * the imperative bridge sibling parts use to edit by layer name through the\n * command path. Generalizes `useTextBinding`'s write mechanics to a dynamic\n * name (a hook can't take names at call time).\n */\nfunction CanvasBindingBridge(): null {\n const { elementStore, artboardManager, refreshArtboards } = useElementsContext();\n const {\n executeElementUpdate,\n executeAddElement,\n executeRemoveElement,\n executeCreateArtboard,\n executeDeleteArtboard,\n } = useCommandContext();\n // Tolerant on purpose: the legacy <RealtimeCanvas> is supported inside a\n // bare EmbedContext (advanced consumers provide their own); only under an\n // <Editor.Root> is there a registry to bridge into.\n const internals = useContext(EditorRootInternalsContext);\n\n const latest = useRef({\n elementStore,\n artboardManager,\n refreshArtboards,\n executeElementUpdate,\n executeAddElement,\n executeRemoveElement,\n executeCreateArtboard,\n executeDeleteArtboard,\n });\n latest.current = {\n elementStore,\n artboardManager,\n refreshArtboards,\n executeElementUpdate,\n executeAddElement,\n executeRemoveElement,\n executeCreateArtboard,\n executeDeleteArtboard,\n };\n\n const registry = internals?.registry ?? null;\n useLayoutEffect(() => {\n if (!registry) return;\n return registry.registerCanvasBridge({\n setTextByName(name: string, text: string): boolean {\n const { elementStore: store, executeElementUpdate: execute } = latest.current;\n const matches = store.getAllByName(name).filter((el): el is TextElement => el instanceof TextElement);\n if (matches.length === 0) return false;\n for (const el of matches) {\n const cloned = el.clone() as TextElement;\n cloned.setText(text);\n execute(el, cloned);\n }\n return true;\n },\n // ADR-0101: split = clone the BASE artboard (the first one) and every\n // element on it into a new artboard named `label`, through the command\n // path so it is one undoable step per command and lands in the Root\n // store via onChange like any edit.\n splitArtboard(label: string): boolean {\n const { artboardManager: mgr, elementStore: store } = latest.current;\n const all = mgr.getAllArtboards();\n const base = all[0];\n if (!base) return false;\n if (all.some((ab) => ab.name === label)) return true;\n const next = new ArtboardElement({\n name: label,\n x: base.x,\n y: base.y,\n width: base.width,\n height: base.height,\n backgroundColor: base.backgroundColor,\n });\n latest.current.executeCreateArtboard(next);\n // CreateArtboardCommand re-creates from a clone of the basic config;\n // carry the fields it doesn't (export flag, clip, role) directly.\n const created = mgr.getArtboard(next.id);\n if (created) {\n created.exportBackground = base.exportBackground;\n created.clipShape = base.clipShape;\n created.role = base.role;\n created.imageFit = base.imageFit ? { ...base.imageFit } : undefined;\n created.engrave = base.engrave ? { ...base.engrave } : undefined;\n }\n for (const id of mgr.getElementsOnArtboard(base.id)) {\n const el = store.get(id);\n if (!el) continue;\n const json = { ...(el.toJSON() as AnyElementConfig) } as AnyElementConfig & { id?: string; artboard?: string };\n delete json.id;\n json.artboard = label;\n latest.current.executeAddElement(ElementFactory.createFromJSON(json) as Parameters<typeof executeAddElement>[0], next.id);\n }\n latest.current.refreshArtboards();\n return true;\n },\n // ADR-0101: link = remove the artboard named `label` and its elements\n // through the command path; the placement inherits the base again.\n removeArtboard(label: string): boolean {\n const { artboardManager: mgr, elementStore: store } = latest.current;\n const target = mgr.getAllArtboards().find((ab) => ab.name === label);\n if (!target) return false;\n for (const id of [...mgr.getElementsOnArtboard(target.id)]) {\n const el = store.get(id);\n if (el) latest.current.executeRemoveElement(el as Parameters<typeof executeRemoveElement>[0]);\n }\n latest.current.executeDeleteArtboard(target);\n latest.current.refreshArtboards();\n return true;\n },\n });\n }, [registry]);\n\n return null;\n}\n\nexport const EditorCanvasImpl = forwardRef<SnowconeCanvasHandle, EditorCanvasImplProps>(\n function EditorCanvasImpl(\n {\n children,\n kit = 'embed-only',\n inheritTheme = true,\n maxHeight,\n services,\n onChange,\n selfScope = false,\n partAttr,\n builtinControls = false,\n className,\n style,\n }: EditorCanvasImplProps,\n ref,\n ): React.ReactElement {\n const { placement, throttleMs, pieceGuides, pushRender, stateStore } = useEmbedContext();\n\n // Under an <Editor.Root> the editor document is mounted by the ROOT (P1\n // provider inversion, D9: state always) — SnowconeCanvas must write into\n // that document instead of mounting its own, and a REMOUNT of this part\n // must rebuild the (surviving) document from the live seed instead of\n // accreting onto the previous mount's artboards/elements. The legacy\n // <RealtimeCanvas> inside a bare EmbedContext (no Root) keeps mounting\n // its own provider, exactly as before.\n const rootInternals = useContext(EditorRootInternalsContext);\n const underRoot = rootInternals !== null;\n\n // ADR-0085 §5 (Controls placement resolution): with no Editor.Controls\n // mounted — or a `placement=\"floating\"` one — the canvas owns the\n // floating contextual toolbar; a registered DOCKED Controls suppresses\n // it. Subscribed to the part registry so the zones swap live when a\n // docked Controls mounts/unmounts.\n const partsRegistry = rootInternals?.registry ?? null;\n useSyncExternalStore(\n partsRegistry ? partsRegistry.subscribe : noopSubscribe,\n partsRegistry ? partsRegistry.getVersion : () => 0,\n partsRegistry ? partsRegistry.getVersion : () => 0,\n );\n const showBuiltinFloatingControls =\n builtinControls && underRoot && !(partsRegistry?.hasDockedControls() ?? false);\n\n // Seed from the LIVE store, not the original design (ADR-0085 §3): the\n // store starts as design.toJSON(), so a fresh mount is identical to the\n // old behavior — but edits made while this chunk was loading (e.g. a\n // TextField keystroke in the first second) survive instead of being\n // clobbered by a stale seed. Captured once per store identity; later\n // store changes flow through the editor document, not re-seeding.\n const seed = useMemo(() => stateStore.getState(), [stateStore]);\n\n // Latest-ref so a host's inline `onChange` identity never matters here\n // (SnowconeCanvas already refs ITS callback; this keeps ours symmetric).\n const onChangeRef = useRef(onChange);\n onChangeRef.current = onChange;\n\n const rootClass = selfScope ? 'sc-root' : 'sc-canvas-frame';\n\n return (\n <div className={`${rootClass}${className ? ` ${className}` : ''}`} style={style} data-sc-part={partAttr}>\n <SnowconeCanvas\n ref={ref}\n kit={kit}\n inheritTheme={inheritTheme}\n services={services}\n externalProvider={underRoot}\n resetDocumentOnMount={underRoot}\n artboards={seed.artboards}\n activeArtboard={placement}\n initialElements={seed.elements}\n layoutConfig={maxHeight ? { maxHeight } : undefined}\n overlay={\n <>\n <CanvasBindingBridge />\n {showBuiltinFloatingControls ? <ContextualToolbars mode=\"floating\" partAttr=\"controls\" /> : null}\n {children}\n </>\n }\n // #566: the product's printable-area / dead-zone overlay, fetched and\n // dims-gated by the Root — same overlay snowcone.app's editor\n // shows, so a buyer can't unknowingly edit under a camera cutout.\n pieceGuides={pieceGuides ?? undefined}\n onChange={(state) => {\n // ONE store, last-write-wins (ADR-0085 §3): the editor document is\n // the write authority while mounted; the Root store derives from\n // its onChange, then the render follows the store.\n stateStore.setState(state);\n pushRender(serializeStateForServer(state), throttleMs);\n onChangeRef.current?.(state);\n }}\n />\n </div>\n );\n },\n);\n\nexport type { CanvasState, SnowconeCanvasHandle };\n"],"names":["noopSubscribe","CanvasBindingBridge","elementStore","artboardManager","refreshArtboards","useElementsContext","executeElementUpdate","executeAddElement","executeRemoveElement","executeCreateArtboard","executeDeleteArtboard","useCommandContext","internals","useContext","EditorRootInternalsContext","latest","useRef","registry","useLayoutEffect","name","text","store","execute","matches","el","TextElement","cloned","label","mgr","all","base","ab","next","ArtboardElement","created","id","json","ElementFactory","target","EditorCanvasImpl","forwardRef","children","kit","inheritTheme","maxHeight","services","onChange","selfScope","partAttr","builtinControls","className","style","ref","placement","throttleMs","pieceGuides","pushRender","stateStore","useEmbedContext","rootInternals","underRoot","partsRegistry","useSyncExternalStore","showBuiltinFloatingControls","seed","useMemo","onChangeRef","jsx","SnowconeCanvas","jsxs","Fragment","ContextualToolbars","state","serializeStateForServer","_a"],"mappings":";;;;;;;;;;AA8EA,MAAMA,IAAgB,MAAoB,MAAM;AAAC;AAQjD,SAASC,IAA4B;AACnC,QAAM,EAAE,cAAAC,GAAc,iBAAAC,GAAiB,kBAAAC,EAAA,IAAqBC,EAAA,GACtD;AAAA,IACJ,sBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,uBAAAC;AAAA,IACA,uBAAAC;AAAA,EAAA,IACEC,EAAA,GAIEC,IAAYC,EAAWC,CAA0B,GAEjDC,IAASC,EAAO;AAAA,IACpB,cAAAd;AAAA,IACA,iBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,sBAAAE;AAAA,IACA,mBAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,uBAAAC;AAAA,IACA,uBAAAC;AAAA,EAAA,CACD;AACD,EAAAK,EAAO,UAAU;AAAA,IACf,cAAAb;AAAA,IACA,iBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,sBAAAE;AAAA,IACA,mBAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,uBAAAC;AAAA,IACA,uBAAAC;AAAA,EAAA;AAGF,QAAMO,KAAWL,KAAA,gBAAAA,EAAW,aAAY;AACxC,SAAAM,EAAgB,MAAM;AACpB,QAAKD;AACL,aA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A;AAAA,IAAA,GAEJ;AAAA,EAEJ;AACF;"}
@@ -1,9 +1,10 @@
1
- import { c as j, G as Vt, ai as Je, x as Ke, v as Qe, am as Ee, aU as Jt, ak as ze, ah as D, s as Ze, w as De, aj as at, al as Kt, z as ee, az as xe, an as tr, aV as J, aW as er, b as rr, aX as vt, aY as nr, $ as Se, aZ as Ce, P as or, S as ar, I as Wt, F as sr, W as ir, f as lr, d as cr, L as hr, C as fr, g as dr, A as re, a0 as ur, a1 as gr, i as pr, t as gt } from "./FontAnalyzer-Ds3Wdba7.js";
1
+ import { c as j, G as Vt, ae as Ke, v as Je, u as Qe, ai as Ee, aQ as Kt, ag as ze, ad as D, s as Ze, w as De, af as at, ah as Jt, K as ee, av as xe, aj as tr, aR as K, aS as er, b as rr, aT as vt, aU as Se, P as nr, S as or, I as Wt, F as ar, W as sr, f as ir, d as lr, L as cr, C as hr, g as fr, A as re, q as gt } from "./FontAnalyzer-CLMJi2Sw.js";
2
+ import { imageFrameSize as dr, hasImageMasks as Ce, effectiveImageCrop as ur, isFullCrop as gr, isNeutralAdjustments as pr } from "@snowcone-app/design/wire";
2
3
  let Pe = null;
3
4
  function mr(e) {
4
5
  Pe = e;
5
6
  }
6
- function zn() {
7
+ function Zn() {
7
8
  return Pe;
8
9
  }
9
10
  const yr = j("TextureManager"), it = class it {
@@ -148,14 +149,14 @@ function vr(e, t, r) {
148
149
  s + l / 2
149
150
  ));
150
151
  }
151
- function Zn(e, t, r) {
152
+ function Dn(e, t, r) {
152
153
  var c;
153
154
  e.translate(t.x || 0, t.y || 0), e.rotate(-(t.rotation || 0) * Math.PI / 180);
154
155
  const n = t, o = n.fontSize || 24, i = n.fontFamily || "Arial", a = n.bold || !1, l = n.italic || !1;
155
- e.font = Je(o, i, a, l);
156
+ e.font = Ke(o, i, a, l);
156
157
  const s = n.text || "";
157
158
  if (t.transformType === "custom") {
158
- const f = ((c = t.transformData) == null ? void 0 : c.width) || 200, u = Ke(s, o, i, a, l), d = Math.min(u, f), p = o * 1.2;
159
+ const f = ((c = t.transformData) == null ? void 0 : c.width) || 200, u = Je(s, o, i, a, l), d = Math.min(u, f), p = o * 1.2;
159
160
  e.rect(-d / 2, -p / 2, d, p);
160
161
  } else {
161
162
  const h = e.measureText(s).width;
@@ -171,10 +172,10 @@ function Mr(e, t) {
171
172
  } else
172
173
  e.rect(-n / 2, -o / 2, n, o);
173
174
  }
174
- function Dn(e, t, r, n) {
175
+ function xn(e, t, r, n) {
175
176
  e.beginPath(), e.arc(t, r, n, 0, Math.PI * 2), e.closePath();
176
177
  }
177
- function xn(e, t, r, n, o) {
178
+ function to(e, t, r, n, o) {
178
179
  e.beginPath(), e.rect(t, r, n, o), e.closePath();
179
180
  }
180
181
  function Ie(e, t) {
@@ -249,7 +250,7 @@ function st(e, t, r, n, o) {
249
250
  !0,
250
251
  // strict: wrap exactly at maxWidth
251
252
  { letterSpacing: k, lineHeight: r.lineHeight }
252
- ), g = -m / 2, y = -T / 2, S = a * (r.lineHeight ?? Jt);
253
+ ), g = -m / 2, y = -T / 2, S = a * (r.lineHeight ?? Kt);
253
254
  b.forEach((C, P) => {
254
255
  const I = P === 0, M = P === b.length - 1;
255
256
  let A = C;
@@ -278,7 +279,7 @@ function Cr(e, t, r) {
278
279
  const n = (r == null ? void 0 : r.isKnockout) === !0;
279
280
  e.save(), n ? (e.strokeStyle = "#000000", e.lineWidth = t.stroke.width, e.lineCap = t.stroke.lineCap || "butt", e.lineJoin = t.stroke.lineJoin || "miter", e.globalAlpha = 1, t.stroke.miterLimit !== void 0 && (e.miterLimit = t.stroke.miterLimit)) : Ie(e, t.stroke), !n && t.stroke.feather && t.stroke.feather > 0 && "filter" in e && (e.filter = `blur(${t.stroke.feather}px)`), Mr(e, t), e.stroke(), e.restore();
280
281
  }
281
- function to(e, t, r) {
282
+ function eo(e, t, r) {
282
283
  t.enabled && (e.save(), Ie(e, t), t.feather && t.feather > 0 && "filter" in e && (e.filter = `blur(${t.feather}px)`), e.beginPath(), r(), e.stroke(), e.restore());
283
284
  }
284
285
  const oe = j("GlyphRenderer");
@@ -448,7 +449,7 @@ function Ar(e, t, r, n, o) {
448
449
  isParagraphEnd: y
449
450
  });
450
451
  });
451
- const f = ct(r.fontSize, r.fontFamily, r.bold, r.italic), u = r.fontSize * (r.lineHeight ?? Jt);
452
+ const f = ct(r.fontSize, r.fontFamily, r.bold, r.italic), u = r.fontSize * (r.lineHeight ?? Kt);
452
453
  let d;
453
454
  h.length === 0 ? d = 0 : h.length === 1 ? d = f.height : d = (h.length - 1) * u + f.height;
454
455
  const p = -d / 2;
@@ -474,7 +475,7 @@ function Ar(e, t, r, n, o) {
474
475
  }
475
476
  if (E += v.text.length, L.length > 0) {
476
477
  const Y = a(v.style);
477
- e.font = q(R, U, F, B), e.fillStyle = W, e.textBaseline = "alphabetic", e.textAlign = "left", Kt(e, L, y, S, Y);
478
+ e.font = q(R, U, F, B), e.fillStyle = W, e.textBaseline = "alphabetic", e.textAlign = "left", Jt(e, L, y, S, Y);
478
479
  const rt = at(e.measureText(L).width, L, Y);
479
480
  if ($) {
480
481
  const V = S + R * 0.1;
@@ -515,7 +516,7 @@ function ct(e, t, r = !1, n = !1) {
515
516
  const a = o.measureText("ÁÉÍgjpqy"), l = a.actualBoundingBoxAscent || e * 0.8, s = a.actualBoundingBoxDescent || e * 0.2, c = l + s;
516
517
  return { ascent: l, descent: s, height: c };
517
518
  }
518
- function eo(e, t) {
519
+ function ro(e, t) {
519
520
  const r = e.map((o, i) => ({
520
521
  isParagraphStart: !t && i === 0,
521
522
  isParagraphEnd: !t && i === e.length - 1
@@ -532,7 +533,7 @@ function Rr(e, t) {
532
533
  const r = t.fontSize, n = t.fontFamily, o = t.bold || !1, i = t.italic || !1, a = t.textAlign || "center", l = t.text;
533
534
  e.font = q(r, n, o, i), e.textAlign = a, e.textBaseline = "alphabetic", e.fillStyle = t.color;
534
535
  const s = ct(r, n, o, i), f = -s.height / 2 + s.ascent;
535
- Kt(e, l, 0, f, t.letterSpacing);
536
+ Jt(e, l, 0, f, t.letterSpacing);
536
537
  }
537
538
  function Wr(e, t, r, n, o = !1, i = !1, a) {
538
539
  const l = Qt();
@@ -571,7 +572,7 @@ function Wr(e, t, r, n, o = !1, i = !1, a) {
571
572
  }
572
573
  return g.push(y), g.length > 0 && (g[0] = h + g[0], g[g.length - 1] = g[g.length - 1] + f), g;
573
574
  }
574
- function ro(e, t, r, n, o, i, a = "left", l = 0, s = 0, c = 1.2, h = !1, f = !1, u = !1, d = !1, p, m) {
575
+ function no(e, t, r, n, o, i, a = "left", l = 0, s = 0, c = 1.2, h = !1, f = !1, u = !1, d = !1, p, m) {
575
576
  e.font = q(o, i, h, f), e.textBaseline = "alphabetic", e.textAlign = a;
576
577
  const w = (M) => {
577
578
  for (const A of M) {
@@ -668,7 +669,7 @@ function Fr(e, t) {
668
669
  t.fontFamily,
669
670
  t.bold,
670
671
  t.italic
671
- ), h = -((r == null ? void 0 : r.width) ?? 100) / 2, f = -s / 2, u = t.fontSize * (t.lineHeight ?? Jt);
672
+ ), h = -((r == null ? void 0 : r.width) ?? 100) / 2, f = -s / 2, u = t.fontSize * (t.lineHeight ?? Kt);
672
673
  e.font = `${t.italic ? "italic " : ""}${t.bold ? "bold " : ""}${t.fontSize}px ${t.fontFamily}`, e.textBaseline = "alphabetic", e.textAlign = t.textAlign, l.forEach((d, p) => {
673
674
  const m = p === 0, w = p === l.length - 1;
674
675
  let k = d;
@@ -683,7 +684,7 @@ function Fr(e, t) {
683
684
  let b = h + D;
684
685
  t.textAlign === "center" ? b = h + ((r == null ? void 0 : r.width) ?? 100) / 2 : t.textAlign === "right" && (b = h + ((r == null ? void 0 : r.width) ?? 100) - D);
685
686
  const T = f + c.ascent + p * u;
686
- if (Kt(e, k, b, T, a), k.length > 0) {
687
+ if (Jt(e, k, b, T, a), k.length > 0) {
687
688
  const g = at(e.measureText(k).width, k, a);
688
689
  let y = b;
689
690
  if (t.textAlign === "center" ? y -= g / 2 : t.textAlign === "right" && (y -= g), t.underline) {
@@ -699,7 +700,7 @@ function Fr(e, t) {
699
700
  }
700
701
  e.restore();
701
702
  }
702
- function no(e, t) {
703
+ function oo(e, t) {
703
704
  var a;
704
705
  const r = t.opacity ?? 1, n = !!((a = t.stroke) != null && a.enabled), o = t.type === "custom";
705
706
  if (r < 1 && n && o) {
@@ -931,7 +932,7 @@ function _r(e, t) {
931
932
  }
932
933
  var se = !1;
933
934
  function zt() {
934
- se || (se = !0, J("arch", Q(Fe)), J("ascend", Q(Ue)), J("circle", Q(Re)), J("flag", Q(Oe)), J("lean", Q(Be)), J("wave", Q(We)), J(
935
+ se || (se = !0, K("arch", Q(Fe)), K("ascend", Q(Ue)), K("circle", Q(Re)), K("flag", Q(Oe)), K("lean", Q(Be)), K("wave", Q(We)), K(
935
936
  "custom",
936
937
  (e, t) => Ut(e, t)
937
938
  ), er(_r), mr(
@@ -989,7 +990,7 @@ function Gr(e, t, r, n) {
989
990
  var a, l;
990
991
  if (!t.transformData) return;
991
992
  const o = t.transformData, i = ((a = n.renderingContext) == null ? void 0 : a.isKnockout) === !0;
992
- e.beginPath(), Le(e, o), (r === "fill" || r === "both") && (e.fillStyle = i ? "#000000" : rr(e, o), e.globalAlpha = i ? 1 : o.fillOpacity ?? 1, e.fill()), (r === "stroke" || r === "both") && ((l = t.stroke) != null && l.enabled) && (e.save(), Kr(e, t, n.renderingContext), e.restore());
993
+ e.beginPath(), Le(e, o), (r === "fill" || r === "both") && (e.fillStyle = i ? "#000000" : rr(e, o), e.globalAlpha = i ? 1 : o.fillOpacity ?? 1, e.fill()), (r === "stroke" || r === "both") && ((l = t.stroke) != null && l.enabled) && (e.save(), Jr(e, t, n.renderingContext), e.restore());
993
994
  }
994
995
  function Le(e, t) {
995
996
  const { shapeType: r } = t, n = t.width ?? 100, o = t.height ?? 100;
@@ -1004,7 +1005,7 @@ function Le(e, t) {
1004
1005
  Vr(e, n / 2, o / 2);
1005
1006
  break;
1006
1007
  case "star":
1007
- Jr(e, t, Math.min(n, o) / 2);
1008
+ Kr(e, t, Math.min(n, o) / 2);
1008
1009
  break;
1009
1010
  default:
1010
1011
  ie(e, t, n, o);
@@ -1024,7 +1025,7 @@ function Yr(e, t) {
1024
1025
  function Vr(e, t, r) {
1025
1026
  e.ellipse(0, 0, t, r, 0, 0, Math.PI * 2);
1026
1027
  }
1027
- function Jr(e, t, r) {
1028
+ function Kr(e, t, r) {
1028
1029
  const n = Math.max(3, Math.min(20, t.points || 5)), o = Math.max(0.1, Math.min(0.9, t.innerRadius || 0.4)), i = r * o, a = Math.PI / n, l = -Math.PI / 2;
1029
1030
  for (let s = 0; s < n * 2; s++) {
1030
1031
  const c = l + a * s, h = s % 2 === 0 ? r : i, f = Math.cos(c) * h, u = Math.sin(c) * h;
@@ -1032,7 +1033,7 @@ function Jr(e, t, r) {
1032
1033
  }
1033
1034
  e.closePath();
1034
1035
  }
1035
- function Kr(e, t, r) {
1036
+ function Jr(e, t, r) {
1036
1037
  var o;
1037
1038
  if (!((o = t.stroke) != null && o.enabled) || !t.transformData) return;
1038
1039
  const n = (r == null ? void 0 : r.isKnockout) === !0;
@@ -1083,7 +1084,7 @@ function qe(e, t, r, n, o, i, a = "destination-out") {
1083
1084
  s.f
1084
1085
  );
1085
1086
  }
1086
- function oo(e, t, r, n, o, i) {
1087
+ function ao(e, t, r, n, o, i) {
1087
1088
  qe(e, t, r, n, o, i, "destination-out");
1088
1089
  }
1089
1090
  function zr(e, t, r) {
@@ -1278,13 +1279,13 @@ function dn() {
1278
1279
  }
1279
1280
  }
1280
1281
  const un = j("MaskRenderer"), qt = /* @__PURE__ */ new Map(), gn = /* @__PURE__ */ new Map();
1281
- function ao(e) {
1282
+ function so(e) {
1282
1283
  const t = [];
1283
1284
  qt.forEach((r, n) => {
1284
1285
  n.startsWith(e) && t.push(n);
1285
1286
  }), t.forEach((r) => qt.delete(r));
1286
1287
  }
1287
- function so() {
1288
+ function io() {
1288
1289
  qt.clear();
1289
1290
  }
1290
1291
  function fe(e, t, r) {
@@ -1340,7 +1341,7 @@ function bn(e, t, r) {
1340
1341
  e.save(), e.globalCompositeOperation = t.inverted ? "destination-in" : "destination-out", t.opacity !== void 0 && (e.globalAlpha = t.opacity), Mt(e, t.maskElement, r), t.feather && t.feather > 0 && je(e, t.feather), e.restore();
1341
1342
  }
1342
1343
  function kn(e) {
1343
- const t = e.transformData, r = e, n = t && t.type === "image" ? nr(t, Se(e)) : null;
1344
+ const t = e.transformData, r = e, n = t && t.type === "image" ? dr(t, Ce(e)) : null;
1344
1345
  return {
1345
1346
  width: (n == null ? void 0 : n.width) || (t == null ? void 0 : t.width) || r.width || 0,
1346
1347
  height: (n == null ? void 0 : n.height) || (t == null ? void 0 : t.height) || r.height || 0
@@ -1456,7 +1457,7 @@ function Tn(e, t, r, n) {
1456
1457
  }
1457
1458
  function vn(e) {
1458
1459
  var t;
1459
- return e ? ((t = e.shadow) == null ? void 0 : t.enabled) === !0 || Ce(e.blendMode) : !1;
1460
+ return e ? ((t = e.shadow) == null ? void 0 : t.enabled) === !0 || Se(e.blendMode) : !1;
1460
1461
  }
1461
1462
  function Mn(e, t, r) {
1462
1463
  var c;
@@ -1464,7 +1465,7 @@ function Mn(e, t, r) {
1464
1465
  r(e);
1465
1466
  return;
1466
1467
  }
1467
- const n = (c = t.shadow) != null && c.enabled ? t.shadow : void 0, o = Ce(t.blendMode) ? t.blendMode : void 0, i = e.canvas, a = e.getTransform(), l = Sn(i.width, i.height), s = l.getContext("2d");
1468
+ const n = (c = t.shadow) != null && c.enabled ? t.shadow : void 0, o = Se(t.blendMode) ? t.blendMode : void 0, i = e.canvas, a = e.getTransform(), l = Sn(i.width, i.height), s = l.getContext("2d");
1468
1469
  if (!s)
1469
1470
  throw new Error(
1470
1471
  "[canvas] renderWithLayerEffects: could not acquire a 2D context for the layer-effects raster"
@@ -1751,7 +1752,7 @@ function _e(e) {
1751
1752
  }
1752
1753
  return N.has(e) || (N.add(e), Ne(e)), null;
1753
1754
  }
1754
- function io(e) {
1755
+ function lo(e) {
1755
1756
  return X.has(e) ? Promise.resolve() : new Promise((t) => {
1756
1757
  if (X.has(e)) {
1757
1758
  t();
@@ -1883,21 +1884,21 @@ class wt {
1883
1884
  const { transformType: r } = t;
1884
1885
  switch (r) {
1885
1886
  case "custom":
1886
- return new dr(t);
1887
+ return new fr(t);
1887
1888
  case "distort":
1888
1889
  throw new Error("DistortTransform is not yet implemented");
1889
1890
  case "circle":
1890
- return new fr(t);
1891
- case "lean":
1892
1891
  return new hr(t);
1893
- case "arch":
1892
+ case "lean":
1894
1893
  return new cr(t);
1895
- case "ascend":
1894
+ case "arch":
1896
1895
  return new lr(t);
1897
- case "wave":
1896
+ case "ascend":
1898
1897
  return new ir(t);
1899
- case "flag":
1898
+ case "wave":
1900
1899
  return new sr(t);
1900
+ case "flag":
1901
+ return new ar(t);
1901
1902
  case "image":
1902
1903
  return new Wt(t);
1903
1904
  case "group": {
@@ -1907,9 +1908,9 @@ class wt {
1907
1908
  return o.forEach((s) => l.addChild(s)), l;
1908
1909
  }
1909
1910
  case "shape":
1910
- return new ar(t);
1911
- case "path":
1912
1911
  return new or(t);
1912
+ case "path":
1913
+ return new nr(t);
1913
1914
  default:
1914
1915
  const n = r;
1915
1916
  throw new Error(`Unknown transform type: ${n}`);
@@ -2383,10 +2384,10 @@ function _n(e, t) {
2383
2384
  function Nn() {
2384
2385
  bt = null, kt = null;
2385
2386
  }
2386
- function lo() {
2387
+ function co() {
2387
2388
  jt(), bt && bt();
2388
2389
  }
2389
- function co(e) {
2390
+ function ho(e) {
2390
2391
  Ye(e), kt && kt(e);
2391
2392
  }
2392
2393
  function _t(e, t) {
@@ -2443,7 +2444,7 @@ async function Nt(e, t, r = Ge) {
2443
2444
  const g = await jn(s.imageElement, r);
2444
2445
  i.push({ cacheKey: h, bitmap: g }), $n(h);
2445
2446
  }
2446
- const u = s.transformData || {}, d = Se(c), p = ur(u, d), m = u.width * p.cropWidth, w = u.height * p.cropHeight, k = {
2447
+ const u = s.transformData || {}, d = Ce(c), p = ur(u, d), m = u.width * p.cropWidth, w = u.height * p.cropHeight, k = {
2447
2448
  id: s.id,
2448
2449
  type: "image",
2449
2450
  x: s.x,
@@ -2514,11 +2515,11 @@ async function Xn(e, t, r = fetch) {
2514
2515
  return null;
2515
2516
  }
2516
2517
  }
2517
- function K(e) {
2518
+ function J(e) {
2518
2519
  return e.trim().toLowerCase();
2519
2520
  }
2520
2521
  function xt(e) {
2521
- return `${K(e.family)}|${e.weight ?? 400}|${e.style ?? "normal"}`;
2522
+ return `${J(e.family)}|${e.weight ?? 400}|${e.style ?? "normal"}`;
2522
2523
  }
2523
2524
  class Gn {
2524
2525
  constructor() {
@@ -2544,21 +2545,21 @@ class Gn {
2544
2545
  }
2545
2546
  /** Is this family registered as a custom font? (Shadowing check.) */
2546
2547
  has(t) {
2547
- const r = K(t);
2548
+ const r = J(t);
2548
2549
  for (const n of this.fonts.values())
2549
- if (K(n.family) === r) return !0;
2550
+ if (J(n.family) === r) return !0;
2550
2551
  return !1;
2551
2552
  }
2552
2553
  /** All registered faces of one family (possibly several weights/styles). */
2553
2554
  facesOf(t) {
2554
- const r = K(t);
2555
- return [...this.fonts.values()].filter((n) => K(n.family) === r);
2555
+ const r = J(t);
2556
+ return [...this.fonts.values()].filter((n) => J(n.family) === r);
2556
2557
  }
2557
2558
  /** Registered faces whose family appears in `families` — what the export
2558
2559
  * path sends to the worker alongside the used-font list. */
2559
2560
  forFamilies(t) {
2560
- const r = new Set(t.map(K));
2561
- return [...this.fonts.values()].filter((n) => r.has(K(n.family)));
2561
+ const r = new Set(t.map(J));
2562
+ return [...this.fonts.values()].filter((n) => r.has(J(n.family)));
2562
2563
  }
2563
2564
  /** @internal Test helper — wipe registry state between tests. */
2564
2565
  clear() {
@@ -2597,7 +2598,7 @@ async function Vn(e, t = {}) {
2597
2598
  const n = t.fonts ?? (typeof document < "u" ? document.fonts : void 0);
2598
2599
  return n == null || n.add(r), Ve.add(xt(e)), r;
2599
2600
  }
2600
- async function ho(e, t = {}) {
2601
+ async function fo(e, t = {}) {
2601
2602
  Yn(e);
2602
2603
  const { onLoadError: r, ...n } = t;
2603
2604
  await Promise.all(
@@ -2617,8 +2618,8 @@ async function ho(e, t = {}) {
2617
2618
  }
2618
2619
  const O = j("WorkerExport");
2619
2620
  let Gt = null, At = null;
2620
- function Jn() {
2621
- return At ?? (At = (typeof window > "u" ? Promise.reject(new Error("The export worker runs in a browser page only (no window here).")) : import("./export-worker.bundle.string-BL30CYzH.js")).then((e) => Gt = e.default).catch((e) => {
2621
+ function Kn() {
2622
+ return At ?? (At = (typeof window > "u" ? Promise.reject(new Error("The export worker runs in a browser page only (no window here).")) : import("./export-worker.bundle.string-CyMb_XjB.js")).then((e) => Gt = e.default).catch((e) => {
2622
2623
  throw At = null, e;
2623
2624
  })), At;
2624
2625
  }
@@ -2726,7 +2727,7 @@ class ft {
2726
2727
  throw new Error("Browser does not support OffscreenCanvas or Web Workers");
2727
2728
  if (Gt !== null)
2728
2729
  return this.readyPromise = this.startWorker(Gt), this.readyPromise;
2729
- const t = this.initGeneration, r = Jn().then((n) => {
2730
+ const t = this.initGeneration, r = Kn().then((n) => {
2730
2731
  if (t !== this.initGeneration)
2731
2732
  throw new Error("Worker terminated");
2732
2733
  return this.startWorker(n);
@@ -3025,10 +3026,10 @@ class ft {
3025
3026
  }
3026
3027
  }
3027
3028
  let x = null;
3028
- function fo() {
3029
+ function uo() {
3029
3030
  return x || (x = new ft()), x;
3030
3031
  }
3031
- function uo() {
3032
+ function go() {
3032
3033
  x && (x.terminate(), x = null);
3033
3034
  }
3034
3035
  zt();
@@ -3049,7 +3050,7 @@ function Yt(e, t) {
3049
3050
  n != null && n.maskElement && Yt(n.maskElement, t);
3050
3051
  }
3051
3052
  }
3052
- async function Kn(e) {
3053
+ async function Jn(e) {
3053
3054
  if (typeof document > "u" || !document.fonts) return;
3054
3055
  const t = /* @__PURE__ */ new Set();
3055
3056
  for (const n of e) Yt(n, t);
@@ -3277,7 +3278,7 @@ const lt = class lt {
3277
3278
  transparentBackground: a = !1,
3278
3279
  backgroundColor: l = t.backgroundColor
3279
3280
  } = n, s = r.filter((g) => g.visible !== !1);
3280
- await Kn(s);
3281
+ await Jn(s);
3281
3282
  const c = o ?? { x: 0, y: 0, width: t.width, height: t.height }, h = document.createElement("canvas");
3282
3283
  h.width = Math.max(1, Math.round(c.width * i)), h.height = Math.max(1, Math.round(c.height * i));
3283
3284
  const f = h.getContext("2d");
@@ -3583,20 +3584,20 @@ const lt = class lt {
3583
3584
  };
3584
3585
  lt.CURRENT_VERSION = "2.0.0", lt.workerManager = null, lt.workerInitPromise = null;
3585
3586
  let Tt = lt;
3586
- const go = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3587
+ const po = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3587
3588
  __proto__: null,
3588
3589
  ExportManager: Tt,
3589
3590
  default: Tt
3590
3591
  }, Symbol.toStringTag, { value: "Module" }));
3591
3592
  export {
3592
3593
  fe as A,
3593
- uo as B,
3594
+ go as B,
3594
3595
  Ye as C,
3595
3596
  Ge as D,
3596
3597
  wt as E,
3597
3598
  Wr as F,
3598
3599
  Xt as G,
3599
- ho as H,
3600
+ fo as H,
3600
3601
  be as I,
3601
3602
  Vn as J,
3602
3603
  Yn as K,
@@ -3606,41 +3607,41 @@ export {
3606
3607
  Tn as O,
3607
3608
  zt as P,
3608
3609
  ye as Q,
3609
- zn as R,
3610
+ Zn as R,
3610
3611
  Un as S,
3611
3612
  pt as T,
3612
3613
  Rn as U,
3613
- io as V,
3614
+ lo as V,
3614
3615
  ft as W,
3615
3616
  dn as X,
3616
3617
  fn as Y,
3617
3618
  kr as Z,
3618
- go as _,
3619
+ po as _,
3619
3620
  Tt as a,
3620
- eo as b,
3621
+ ro as b,
3621
3622
  Ie as c,
3622
3623
  q as d,
3623
- lo as e,
3624
- so as f,
3624
+ co as e,
3625
+ io as f,
3625
3626
  jt as g,
3626
- Dn as h,
3627
+ xn as h,
3627
3628
  Mr as i,
3628
- xn as j,
3629
- Zn as k,
3629
+ to as j,
3630
+ Dn as k,
3630
3631
  ct as l,
3631
- fo as m,
3632
- ao as n,
3633
- Jn as o,
3632
+ uo as m,
3633
+ so as n,
3634
+ Kn as o,
3634
3635
  ae as p,
3635
- co as q,
3636
+ ho as q,
3636
3637
  Cr as r,
3637
3638
  Ut as s,
3638
- ro as t,
3639
- to as u,
3639
+ no as t,
3640
+ eo as u,
3640
3641
  Ar as v,
3641
- no as w,
3642
+ oo as w,
3642
3643
  Rr as x,
3643
3644
  Ae as y,
3644
- oo as z
3645
+ ao as z
3645
3646
  };
3646
- //# sourceMappingURL=ExportManager-xRsXgyNo.js.map
3647
+ //# sourceMappingURL=ExportManager-DEJgxB0S.js.map