@snowcone-app/canvas 0.40.19 → 0.40.21

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 (47) hide show
  1. package/ERROR_CONTRACT.md +30 -0
  2. package/dist/{CanvasRenderer-COHWEK1r.js → CanvasRenderer-BmLEU_Zb.js} +4 -4
  3. package/dist/{CanvasRenderer-COHWEK1r.js.map → CanvasRenderer-BmLEU_Zb.js.map} +1 -1
  4. package/dist/{CanvasStateV1-DwziqxMO.js → CanvasStateV1-DnpfA376.js} +3 -3
  5. package/dist/{CanvasStateV1-DwziqxMO.js.map → CanvasStateV1-DnpfA376.js.map} +1 -1
  6. package/dist/{ContextualToolbars-D-EX9Q9L.js → ContextualToolbars-DSJykxdc.js} +196 -196
  7. package/dist/{ContextualToolbars-D-EX9Q9L.js.map → ContextualToolbars-DSJykxdc.js.map} +1 -1
  8. package/dist/{EditorCanvasImpl-Bt-dfd8v.js → EditorCanvasImpl-t5MD0lMB.js} +8 -8
  9. package/dist/{EditorCanvasImpl-Bt-dfd8v.js.map → EditorCanvasImpl-t5MD0lMB.js.map} +1 -1
  10. package/dist/{ExportManager-DLOH2Kzk.js → ExportManager-CnUTZrbv.js} +2 -2
  11. package/dist/{ExportManager-DLOH2Kzk.js.map → ExportManager-CnUTZrbv.js.map} +1 -1
  12. package/dist/{FontAnalyzer-DWHS41ba.js → FontAnalyzer-Bjtl4XTH.js} +70 -70
  13. package/dist/{FontAnalyzer-DWHS41ba.js.map → FontAnalyzer-Bjtl4XTH.js.map} +1 -1
  14. package/dist/{ImagePanel-BIzwlaf5.js → ImagePanel-AWQgzuXz.js} +6 -6
  15. package/dist/{ImagePanel-BIzwlaf5.js.map → ImagePanel-AWQgzuXz.js.map} +1 -1
  16. package/dist/SnowconeCanvas-BWv3Sd5P.js +1213 -0
  17. package/dist/SnowconeCanvas-BWv3Sd5P.js.map +1 -0
  18. package/dist/advanced.mjs +15 -15
  19. package/dist/api/stable.d.ts +1 -0
  20. package/dist/components/embed/SnowconeCanvas.d.ts +13 -0
  21. package/dist/components/embed/kernel.d.ts +8 -0
  22. package/dist/{custom-icons-DHew1GPV.js → custom-icons-Bn8_I4kt.js} +2 -2
  23. package/dist/{custom-icons-DHew1GPV.js.map → custom-icons-Bn8_I4kt.js.map} +1 -1
  24. package/dist/{design-builder-CoCtjIwj.js → design-builder-B3v5OAQo.js} +48 -48
  25. package/dist/{design-builder-CoCtjIwj.js.map → design-builder-B3v5OAQo.js.map} +1 -1
  26. package/dist/{embed-Dzblbo8q.js → embed-D6-jVZMw.js} +10 -10
  27. package/dist/{embed-Dzblbo8q.js.map → embed-D6-jVZMw.js.map} +1 -1
  28. package/dist/embed.mjs +9 -9
  29. package/dist/errors/editorError.d.ts +6 -0
  30. package/dist/{guards-DMmhw_Ow.js → guards-B_Q3pewr.js} +2 -2
  31. package/dist/{guards-DMmhw_Ow.js.map → guards-B_Q3pewr.js.map} +1 -1
  32. package/dist/index.mjs +9 -9
  33. package/dist/internals.mjs +6 -6
  34. package/dist/{template-fields-BzAlpOEB.js → template-fields-B4sJfQjP.js} +18 -18
  35. package/dist/{template-fields-BzAlpOEB.js.map → template-fields-B4sJfQjP.js.map} +1 -1
  36. package/dist/testing.mjs +3 -3
  37. package/dist/{useCommands-CLnk8kvW.js → useCommands-CZHeVauL.js} +7 -7
  38. package/dist/{useCommands-CLnk8kvW.js.map → useCommands-CZHeVauL.js.map} +1 -1
  39. package/dist/{usePieceGuideBundle-BpIz4qow.js → usePieceGuideBundle-DsCv7HKy.js} +2 -2
  40. package/dist/{usePieceGuideBundle-BpIz4qow.js.map → usePieceGuideBundle-DsCv7HKy.js.map} +1 -1
  41. package/dist/utils/initialImageText.d.ts +51 -0
  42. package/dist/{validation-Ds2Df_gS.js → validation-D9catdeB.js} +11 -11
  43. package/dist/{validation-Ds2Df_gS.js.map → validation-D9catdeB.js.map} +1 -1
  44. package/example/package.json +1 -1
  45. package/package.json +3 -3
  46. package/dist/SnowconeCanvas-BZVuH85I.js +0 -1134
  47. package/dist/SnowconeCanvas-BZVuH85I.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { p as a } from "./FontAnalyzer-DWHS41ba.js";
1
+ import { p as a } from "./FontAnalyzer-Bjtl4XTH.js";
2
2
  import { useState as s, useEffect as h } from "react";
3
3
  import { SNOWCONE_HOSTS as d } from "@snowcone-app/sdk";
4
4
  const c = d.api;
@@ -66,4 +66,4 @@ export {
66
66
  m as p,
67
67
  p as u
68
68
  };
69
- //# sourceMappingURL=usePieceGuideBundle-BpIz4qow.js.map
69
+ //# sourceMappingURL=usePieceGuideBundle-DsCv7HKy.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"usePieceGuideBundle-BpIz4qow.js","sources":["../src/components/embed-realtime/usePieceGuideBundle.ts"],"sourcesContent":["'use client';\n\n/**\n * usePieceGuideBundle — fetch a product's printable-area guides for the embed.\n *\n * Some products hide part of the print file under hardware (a phone case's\n * camera module, a notebook's spine). snowcone.app's own editor draws the\n * printable-area / dead-zone overlay from the product's piece guides;\n * `<RealtimeEmbed>` uses this hook so embedders get the same overlay with\n * zero config — without it, a buyer can edit artwork the mockup will never\n * show, with no signal anywhere (#566).\n *\n * The endpoint is a public read (geometry only — piece rects, safe areas,\n * authored guides; same exposure class as the public catalog). Errors degrade\n * silently to \"no guides\": the editor keeps working, the overlay just doesn't\n * appear — same posture as snowcone.app's own loader.\n *\n * @module\n */\n\nimport { useEffect, useState } from 'react';\nimport { SNOWCONE_HOSTS } from '@snowcone-app/sdk';\nimport type { PieceGuidesConfig } from '../embed/SnowconeCanvas.js';\nimport type {\n PieceGuide,\n PieceGuideRendererPiece,\n PieceGuideRendererStyle,\n} from '../../rendering/PieceGuideRenderer.js';\n\n/** Backend base hosting `GET /printables/by-gvid/:gvid/piece-guides`. */\nexport const PIECE_GUIDES_API_BASE: string = SNOWCONE_HOSTS.api;\n\n/** Wire shape of the piece-guides endpoint (the consumer-safe subset). */\ninterface RawPieceGuidesResponse {\n artboardWidth: number;\n artboardHeight: number;\n /** Inches→px conversion factor for `safeAreaInsetInches`. */\n templateDpi: number;\n pieces: Array<{\n id: string;\n x: number;\n y: number;\n width: number;\n height: number;\n rotation?: number;\n naturalWidth?: number;\n naturalHeight?: number;\n safeAreaInsetInches?: number;\n }>;\n pieceGuides?: Record<string, PieceGuide>;\n pieceGuidesStyle?: PieceGuideRendererStyle;\n}\n\n/** A fetched bundle: the overlay config plus the artboard frame it was authored in. */\nexport interface PieceGuideBundle {\n /** The print-file frame the piece coords live in. */\n artboardWidth: number;\n artboardHeight: number;\n config: PieceGuidesConfig;\n}\n\n/** Convert the wire response into a renderer-ready bundle (inches → px, etc.). */\nexport function transformPieceGuides(raw: RawPieceGuidesResponse): PieceGuideBundle {\n const pieces: PieceGuideRendererPiece[] = raw.pieces.map((p) => ({\n id: p.id,\n x: p.x,\n y: p.y,\n width: p.width,\n height: p.height,\n rotation: typeof p.rotation === 'number' ? p.rotation : undefined,\n // natural (unrotated) size — required at non-right angles (a bandana's 45° folded view)\n naturalWidth: typeof p.naturalWidth === 'number' ? p.naturalWidth : undefined,\n naturalHeight: typeof p.naturalHeight === 'number' ? p.naturalHeight : undefined,\n safeAreaInsetPx:\n typeof p.safeAreaInsetInches === 'number' && p.safeAreaInsetInches > 0\n ? p.safeAreaInsetInches * raw.templateDpi\n : undefined,\n }));\n return {\n artboardWidth: raw.artboardWidth,\n artboardHeight: raw.artboardHeight,\n config: {\n pieces,\n guides: raw.pieceGuides ?? {},\n style: raw.pieceGuidesStyle,\n },\n };\n}\n\n/**\n * Gate the bundle on the design's artboard matching the print-file frame the\n * guides were authored in — the same gate snowcone.app's editor applies. A\n * design authored at other dims would render the overlay misaligned, so it's\n * skipped (with a dev hint, since the fix — author at the placement's dims —\n * is on the embedder's side).\n */\nexport function pieceGuidesForArtboard(\n bundle: PieceGuideBundle,\n artboard: { width: number; height: number; name?: string } | undefined,\n): PieceGuidesConfig | undefined {\n if (!artboard) return undefined;\n // A SEPARATE-mode printable (slides Left/Right, one print file per area)\n // synthesizes one full-frame piece per placement — identical boxes\n // stacked at (0,0). An artboard named for one of those placements draws\n // ITS piece only: both stacked pieces would double-paint the bleed wash\n // (ADR-0101 §6). Any other bundle (a real spread) draws every piece.\n const { pieces } = bundle.config;\n const stacked =\n pieces.length > 1 &&\n pieces.every(\n (p) => p.x === 0 && p.y === 0 && p.width === bundle.artboardWidth && p.height === bundle.artboardHeight,\n );\n if (stacked && artboard.name && pieces.some((p) => p.id === artboard.name)) {\n if (artboard.width === bundle.artboardWidth && artboard.height === bundle.artboardHeight) {\n return { ...bundle.config, pieces: pieces.filter((p) => p.id === artboard.name) };\n }\n }\n if (artboard.width !== bundle.artboardWidth || artboard.height !== bundle.artboardHeight) {\n if (typeof process !== 'undefined' && process.env?.NODE_ENV !== 'production') {\n console.warn(\n `[RealtimeEmbed] This product has printable-area guides (authored at ` +\n `${bundle.artboardWidth}×${bundle.artboardHeight}), but the design's artboard is ` +\n `${artboard.width}×${artboard.height} — the dead-zone overlay is skipped because the ` +\n `coordinates wouldn't line up. Author the design at the placement's dimensions to get it.`,\n );\n }\n return undefined;\n }\n return bundle.config;\n}\n\n/**\n * Fetch the piece-guide bundle for a variant (gvid). Returns null while\n * loading, when `gvid` is undefined, and on any error (silent degrade).\n */\nexport function usePieceGuideBundle(\n gvid: string | undefined,\n apiBase: string = PIECE_GUIDES_API_BASE,\n): PieceGuideBundle | null {\n const [bundle, setBundle] = useState<PieceGuideBundle | null>(null);\n\n useEffect(() => {\n if (!gvid) {\n setBundle(null);\n return;\n }\n let cancelled = false;\n fetch(`${apiBase}/printables/by-gvid/${encodeURIComponent(gvid)}/piece-guides`)\n .then(async (res) => {\n if (!res.ok) throw new Error(`status ${res.status}`);\n return (await res.json()) as RawPieceGuidesResponse;\n })\n .then((raw) => {\n if (!cancelled) setBundle(transformPieceGuides(raw));\n })\n .catch(() => {\n // No guides is a degraded state, not a failure — the editor keeps\n // working, the overlay just doesn't appear.\n if (!cancelled) setBundle(null);\n });\n return () => {\n cancelled = true;\n };\n }, [gvid, apiBase]);\n\n return bundle;\n}\n"],"names":["PIECE_GUIDES_API_BASE","SNOWCONE_HOSTS","transformPieceGuides","raw","pieces","p","pieceGuidesForArtboard","bundle","artboard","process","usePieceGuideBundle","gvid","apiBase","setBundle","useState","useEffect","cancelled","res"],"mappings":";;;AA8BO,MAAMA,IAAgCC,EAAe;AAgCrD,SAASC,EAAqBC,GAA+C;AAClF,QAAMC,IAAoCD,EAAI,OAAO,IAAI,CAACE,OAAO;AAAA,IAC/D,IAAIA,EAAE;AAAA,IACN,GAAGA,EAAE;AAAA,IACL,GAAGA,EAAE;AAAA,IACL,OAAOA,EAAE;AAAA,IACT,QAAQA,EAAE;AAAA,IACV,UAAU,OAAOA,EAAE,YAAa,WAAWA,EAAE,WAAW;AAAA;AAAA,IAExD,cAAc,OAAOA,EAAE,gBAAiB,WAAWA,EAAE,eAAe;AAAA,IACpE,eAAe,OAAOA,EAAE,iBAAkB,WAAWA,EAAE,gBAAgB;AAAA,IACvE,iBACE,OAAOA,EAAE,uBAAwB,YAAYA,EAAE,sBAAsB,IACjEA,EAAE,sBAAsBF,EAAI,cAC5B;AAAA,EAAA,EACN;AACF,SAAO;AAAA,IACL,eAAeA,EAAI;AAAA,IACnB,gBAAgBA,EAAI;AAAA,IACpB,QAAQ;AAAA,MACN,QAAAC;AAAA,MACA,QAAQD,EAAI,eAAe,CAAA;AAAA,MAC3B,OAAOA,EAAI;AAAA,IAAA;AAAA,EACb;AAEJ;AASO,SAASG,EACdC,GACAC,GAC+B;;AAC/B,MAAI,CAACA,EAAU;AAMf,QAAM,EAAE,QAAAJ,MAAWG,EAAO;AAM1B,MAJEH,EAAO,SAAS,KAChBA,EAAO;AAAA,IACL,CAACC,MAAMA,EAAE,MAAM,KAAKA,EAAE,MAAM,KAAKA,EAAE,UAAUE,EAAO,iBAAiBF,EAAE,WAAWE,EAAO;AAAA,EAAA,KAE9EC,EAAS,QAAQJ,EAAO,K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ime/usePieceGuideBundle.ts"],"sourcesContent":["'use client';\n\n/**\n * usePieceGuideBundle — fetch a product's printable-area guides for the embed.\n *\n * Some products hide part of the print file under hardware (a phone case's\n * camera module, a notebook's spine). snowcone.app's own editor draws the\n * printable-area / dead-zone overlay from the product's piece guides;\n * `<RealtimeEmbed>` uses this hook so embedders get the same overlay with\n * zero config — without it, a buyer can edit artwork the mockup will never\n * show, with no signal anywhere (#566).\n *\n * The endpoint is a public read (geometry only — piece rects, safe areas,\n * authored guides; same exposure class as the public catalog). Errors degrade\n * silently to \"no guides\": the editor keeps working, the overlay just doesn't\n * appear — same posture as snowcone.app's own loader.\n *\n * @module\n */\n\nimport { useEffect, useState } from 'react';\nimport { SNOWCONE_HOSTS } from '@snowcone-app/sdk';\nimport type { PieceGuidesConfig } from '../embed/SnowconeCanvas.js';\nimport type {\n PieceGuide,\n PieceGuideRendererPiece,\n PieceGuideRendererStyle,\n} from '../../rendering/PieceGuideRenderer.js';\n\n/** Backend base hosting `GET /printables/by-gvid/:gvid/piece-guides`. */\nexport const PIECE_GUIDES_API_BASE: string = SNOWCONE_HOSTS.api;\n\n/** Wire shape of the piece-guides endpoint (the consumer-safe subset). */\ninterface RawPieceGuidesResponse {\n artboardWidth: number;\n artboardHeight: number;\n /** Inches→px conversion factor for `safeAreaInsetInches`. */\n templateDpi: number;\n pieces: Array<{\n id: string;\n x: number;\n y: number;\n width: number;\n height: number;\n rotation?: number;\n naturalWidth?: number;\n naturalHeight?: number;\n safeAreaInsetInches?: number;\n }>;\n pieceGuides?: Record<string, PieceGuide>;\n pieceGuidesStyle?: PieceGuideRendererStyle;\n}\n\n/** A fetched bundle: the overlay config plus the artboard frame it was authored in. */\nexport interface PieceGuideBundle {\n /** The print-file frame the piece coords live in. */\n artboardWidth: number;\n artboardHeight: number;\n config: PieceGuidesConfig;\n}\n\n/** Convert the wire response into a renderer-ready bundle (inches → px, etc.). */\nexport function transformPieceGuides(raw: RawPieceGuidesResponse): PieceGuideBundle {\n const pieces: PieceGuideRendererPiece[] = raw.pieces.map((p) => ({\n id: p.id,\n x: p.x,\n y: p.y,\n width: p.width,\n height: p.height,\n rotation: typeof p.rotation === 'number' ? p.rotation : undefined,\n // natural (unrotated) size — required at non-right angles (a bandana's 45° folded view)\n naturalWidth: typeof p.naturalWidth === 'number' ? p.naturalWidth : undefined,\n naturalHeight: typeof p.naturalHeight === 'number' ? p.naturalHeight : undefined,\n safeAreaInsetPx:\n typeof p.safeAreaInsetInches === 'number' && p.safeAreaInsetInches > 0\n ? p.safeAreaInsetInches * raw.templateDpi\n : undefined,\n }));\n return {\n artboardWidth: raw.artboardWidth,\n artboardHeight: raw.artboardHeight,\n config: {\n pieces,\n guides: raw.pieceGuides ?? {},\n style: raw.pieceGuidesStyle,\n },\n };\n}\n\n/**\n * Gate the bundle on the design's artboard matching the print-file frame the\n * guides were authored in — the same gate snowcone.app's editor applies. A\n * design authored at other dims would render the overlay misaligned, so it's\n * skipped (with a dev hint, since the fix — author at the placement's dims —\n * is on the embedder's side).\n */\nexport function pieceGuidesForArtboard(\n bundle: PieceGuideBundle,\n artboard: { width: number; height: number; name?: string } | undefined,\n): PieceGuidesConfig | undefined {\n if (!artboard) return undefined;\n // A SEPARATE-mode printable (slides Left/Right, one print file per area)\n // synthesizes one full-frame piece per placement — identical boxes\n // stacked at (0,0). An artboard named for one of those placements draws\n // ITS piece only: both stacked pieces would double-paint the bleed wash\n // (ADR-0101 §6). Any other bundle (a real spread) draws every piece.\n const { pieces } = bundle.config;\n const stacked =\n pieces.length > 1 &&\n pieces.every(\n (p) => p.x === 0 && p.y === 0 && p.width === bundle.artboardWidth && p.height === bundle.artboardHeight,\n );\n if (stacked && artboard.name && pieces.some((p) => p.id === artboard.name)) {\n if (artboard.width === bundle.artboardWidth && artboard.height === bundle.artboardHeight) {\n return { ...bundle.config, pieces: pieces.filter((p) => p.id === artboard.name) };\n }\n }\n if (artboard.width !== bundle.artboardWidth || artboard.height !== bundle.artboardHeight) {\n if (typeof process !== 'undefined' && process.env?.NODE_ENV !== 'production') {\n console.warn(\n `[RealtimeEmbed] This product has printable-area guides (authored at ` +\n `${bundle.artboardWidth}×${bundle.artboardHeight}), but the design's artboard is ` +\n `${artboard.width}×${artboard.height} — the dead-zone overlay is skipped because the ` +\n `coordinates wouldn't line up. Author the design at the placement's dimensions to get it.`,\n );\n }\n return undefined;\n }\n return bundle.config;\n}\n\n/**\n * Fetch the piece-guide bundle for a variant (gvid). Returns null while\n * loading, when `gvid` is undefined, and on any error (silent degrade).\n */\nexport function usePieceGuideBundle(\n gvid: string | undefined,\n apiBase: string = PIECE_GUIDES_API_BASE,\n): PieceGuideBundle | null {\n const [bundle, setBundle] = useState<PieceGuideBundle | null>(null);\n\n useEffect(() => {\n if (!gvid) {\n setBundle(null);\n return;\n }\n let cancelled = false;\n fetch(`${apiBase}/printables/by-gvid/${encodeURIComponent(gvid)}/piece-guides`)\n .then(async (res) => {\n if (!res.ok) throw new Error(`status ${res.status}`);\n return (await res.json()) as RawPieceGuidesResponse;\n })\n .then((raw) => {\n if (!cancelled) setBundle(transformPieceGuides(raw));\n })\n .catch(() => {\n // No guides is a degraded state, not a failure — the editor keeps\n // working, the overlay just doesn't appear.\n if (!cancelled) setBundle(null);\n });\n return () => {\n cancelled = true;\n };\n }, [gvid, apiBase]);\n\n return bundle;\n}\n"],"names":["PIECE_GUIDES_API_BASE","SNOWCONE_HOSTS","transformPieceGuides","raw","pieces","p","pieceGuidesForArtboard","bundle","artboard","process","usePieceGuideBundle","gvid","apiBase","setBundle","useState","useEffect","cancelled","res"],"mappings":";;;AA8BO,MAAMA,IAAgCC,EAAe;AAgCrD,SAASC,EAAqBC,GAA+C;AAClF,QAAMC,IAAoCD,EAAI,OAAO,IAAI,CAACE,OAAO;AAAA,IAC/D,IAAIA,EAAE;AAAA,IACN,GAAGA,EAAE;AAAA,IACL,GAAGA,EAAE;AAAA,IACL,OAAOA,EAAE;AAAA,IACT,QAAQA,EAAE;AAAA,IACV,UAAU,OAAO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EACF;AACA,SAAOD,EAAO;AAChB;AAMO,SAASG,EACdC,GACAC,IAAkBZ,GACO;AACzB,QAAM,CAACO,GAAQM,CAAS,IAAIC,EAAkC,IAAI;AAElE,SAAAC,EAAU,MAAM;AACd,QAAI,CAACJ,GAAM;AACT,MAAAE,EAAU,IAAI;AACd;AAAA,IACF;AACA,QAAIG,IAAY;AAChB,iBAAM,GAAGJ,CAAO,uBAAuB,mBAAmBD,CAAI,CAAC,eAAe,EAC3E,KAAK,OAAOM,MAAQ;AACnB,UAAI,CAACA,EAAI,GAAI,OAAM,IAAI,MAAM,UAAUA,EAAI,MAAM,EAAE;AACnD,aAAQ,MAAMA,EAAI,KAAA;AAAA,IACpB,CAAC,EACA,KAAK,CAACd,MAAQ;AACb,MAAKa,KAAWH,EAAUX,EAAqBC,CAAG,CAAC;AAAA,IACrD,CAAC,EACA,MAAM,MAAM;AAGX,MAAKa,KAAWH,EAAU,IAAI;AAAA,IAChC,CAAC,GACI,MAAM;AACX,MAAAG,IAAY;AAAA,IACd;AAAA,EACF,GAAG,CAACL,GAAMC,CAAO,CAAC,GAEXL;AACT;"}
@@ -0,0 +1,51 @@
1
+ import { CustomElementConfig } from '../types/index.js';
2
+ export interface InitialImageText {
3
+ /** What the line says, as it is to be drawn (capitals already applied). */
4
+ text: string;
5
+ /** A Google Fonts family. */
6
+ fontFamily: string;
7
+ /** `#rrggbb` */
8
+ color: string;
9
+ /** The em, as a share of the picture's height. */
10
+ fontSize: number;
11
+ /** Extra space after each letter, as a share of the picture's height. Default 0. */
12
+ letterSpacing?: number;
13
+ /** Where the line starts, as a share of the picture's width from its left edge. */
14
+ left: number;
15
+ /**
16
+ * How wide the line was laid out, as a share of the picture's width. With `align`, which point holds still: a
17
+ * browser shapes some fonts a few per cent wider or narrower than the layout engine did, so a centred line is
18
+ * placed by its centre and a right-aligned one by its end. Default: the editor's own width (the start holds).
19
+ */
20
+ width?: number;
21
+ /** Which point of the line is kept: its start (default), its centre, or its end. */
22
+ align?: 'left' | 'center' | 'right';
23
+ /** The line's baseline, as a share of the picture's height from its top. */
24
+ baseline: number;
25
+ /** The layer's name in the layers panel. Default: the text. */
26
+ name?: string;
27
+ }
28
+ /**
29
+ * Check the lines before anything is drawn: given without a picture to belong to, or with a line that cannot be
30
+ * placed, it throws (dev and prod) with what to change. Returns the lines as given.
31
+ */
32
+ export declare function readInitialImageText(lines: readonly InitialImageText[] | undefined, initialImage: string | undefined): readonly InitialImageText[];
33
+ /** A copy of the picture on the canvas: its whole (uncropped) box, in canvas coordinates. */
34
+ export interface PictureBox {
35
+ left: number;
36
+ top: number;
37
+ width: number;
38
+ height: number;
39
+ }
40
+ /** What the editor measures for a line, with the font it draws with: its advance and its box above and below the baseline. */
41
+ export interface LineMeasure {
42
+ advance: number;
43
+ ascent: number;
44
+ descent: number;
45
+ }
46
+ /**
47
+ * One line as a text element on one copy of the picture. A straight text element is drawn centred on (x, y) with
48
+ * its box `ascent + descent` tall and its baseline `ascent` below the box's top, so the centre that puts the
49
+ * baseline where the line has it is `baseline - ascent + (ascent + descent) / 2`.
50
+ */
51
+ export declare function imageTextElement(line: InitialImageText, box: PictureBox, measure: (text: string, fontSize: number, fontFamily: string, letterSpacing: number) => LineMeasure): CustomElementConfig;
@@ -1,17 +1,17 @@
1
1
  import { jsx as r, jsxs as y, Fragment as Pn } from "react/jsx-runtime";
2
2
  import * as $n from "react";
3
3
  import je, { useState as le, useEffect as Ie, useCallback as ft, useMemo as xs, useContext as Ar, createContext as Dr, useRef as we, useImperativeHandle as nr, forwardRef as Nr } from "react";
4
- import { b as rs, o as sr, t as _s, v as $s, d as Ts, j as Br, c as Or, m as zr } from "./design-builder-CoCtjIwj.js";
5
- import { l as rr, I as ze, s as Xr, u as or, c as Fn, v as Qt, i as _e, J as Lr, G as Yr, H as Hr, F as _r, W as $r, T as dn, q as un, r as hn, B as Ct, Y as Fr, Z as Wr, _ as Vr, D as ir, k as Kr, b as ar } from "./useCommands-CLnk8kvW.js";
6
- import { I as Lt, G as Re, b5 as Is, aO as ys, ab as cr, b6 as Fs, b7 as Ur, Y as Cn, b8 as Gr, b9 as us, P as wn, c as zn, a1 as en, $ as ms, ba as qr, T as Qe, u as jr, bb as Jn, bc as Zr, bd as Jr, be as Qr, a0 as lr, _ as eo, bf as Es, Z as to, g as no, S as Qn, at as so, x as Bn } from "./FontAnalyzer-DWHS41ba.js";
4
+ import { b as rs, o as sr, t as _s, v as $s, d as Ts, j as Br, c as Or, m as zr } from "./design-builder-B3v5OAQo.js";
5
+ import { l as rr, I as ze, s as Xr, u as or, c as Fn, v as Qt, i as _e, J as Lr, G as Yr, H as Hr, F as _r, W as $r, T as dn, q as un, r as hn, B as Ct, Y as Fr, Z as Wr, _ as Vr, D as ir, k as Kr, b as ar } from "./useCommands-CZHeVauL.js";
6
+ import { I as Lt, G as Re, b5 as Is, x as ys, ac as cr, b6 as Fs, b7 as Ur, _ as Cn, b8 as Gr, b9 as us, P as wn, c as zn, a3 as en, a1 as ms, ba as qr, T as Qe, u as jr, bb as Jn, bc as Zr, bd as Jr, be as Qr, a2 as lr, a0 as eo, bf as Es, $ as to, g as no, S as Qn, au as so, z as Bn } from "./FontAnalyzer-Bjtl4XTH.js";
7
7
  import { createPortal as dr } from "react-dom";
8
- import { b as ro, n as ur, g as _n, c as oo, r as io, d as ao, C as Ws, e as Vs, f as gs, T as co, a as lo, A as uo, S as ho, I as fo } from "./CanvasRenderer-COHWEK1r.js";
8
+ import { b as ro, n as ur, g as _n, c as oo, r as io, d as ao, C as Ws, e as Vs, f as gs, T as co, a as lo, A as uo, S as ho, I as fo } from "./CanvasRenderer-BmLEU_Zb.js";
9
9
  import { u as po } from "./ThemeContext-Rjz25x9X.js";
10
10
  import { renderToStaticMarkup as mo } from "react-dom/server";
11
- import { D as Ps, n as As, o as hr, p as Ds, e as go, q as Mt } from "./ContextualToolbars-D-EX9Q9L.js";
12
- import { L as Tt, S as fr, T as Ot, I as xo } from "./custom-icons-DHew1GPV.js";
11
+ import { D as Ps, n as As, o as hr, p as Ds, e as go, q as Mt } from "./ContextualToolbars-DSJykxdc.js";
12
+ import { L as Tt, S as fr, T as Ot, I as xo } from "./custom-icons-Bn8_I4kt.js";
13
13
  import * as ts from "@radix-ui/react-radio-group";
14
- import { S as yo, U as Ks, V as Us } from "./ExportManager-DLOH2Kzk.js";
14
+ import { S as yo, U as Ks, V as Us } from "./ExportManager-CnUTZrbv.js";
15
15
  import { cva as pr } from "class-variance-authority";
16
16
  import { debounce as Gs } from "lodash-es";
17
17
  const bo = {
@@ -5659,12 +5659,12 @@ async function Ja() {
5659
5659
  ] = await Promise.all([
5660
5660
  Promise.resolve().then(() => va),
5661
5661
  Promise.resolve().then(() => wa),
5662
- import("./ImagePanel-BIzwlaf5.js"),
5662
+ import("./ImagePanel-AWQgzuXz.js"),
5663
5663
  Promise.resolve().then(() => Ra),
5664
5664
  Promise.resolve().then(() => Ta),
5665
- import("./ContextualToolbars-D-EX9Q9L.js").then((c) => c.s),
5665
+ import("./ContextualToolbars-DSJykxdc.js").then((c) => c.s),
5666
5666
  Promise.resolve().then(() => Ia),
5667
- import("./ContextualToolbars-D-EX9Q9L.js").then((c) => c.r)
5667
+ import("./ContextualToolbars-DSJykxdc.js").then((c) => c.r)
5668
5668
  ]);
5669
5669
  It("effects-panel", {
5670
5670
  component: e,
@@ -8694,4 +8694,4 @@ export {
8694
8694
  Za as u,
8695
8695
  oc as v
8696
8696
  };
8697
- //# sourceMappingURL=validation-Ds2Df_gS.js.map
8697
+ //# sourceMappingURL=validation-D9catdeB.js.map