@snowcone-app/canvas 0.29.0 → 0.30.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 (72) hide show
  1. package/ERROR_CONTRACT.md +13 -0
  2. package/dist/{CanvasRenderer-_lFoIoz5.js → CanvasRenderer-BEf0hXeF.js} +4 -4
  3. package/dist/{CanvasRenderer-_lFoIoz5.js.map → CanvasRenderer-BEf0hXeF.js.map} +1 -1
  4. package/dist/{CanvasStateV1-BMxr6xb8.js → CanvasStateV1-BDSyYo4A.js} +868 -843
  5. package/dist/{CanvasStateV1-BMxr6xb8.js.map → CanvasStateV1-BDSyYo4A.js.map} +1 -1
  6. package/dist/ContextualToolbars-C3D_6sep.js +5960 -0
  7. package/dist/ContextualToolbars-C3D_6sep.js.map +1 -0
  8. package/dist/{EditorCanvasImpl-BNz8TPFs.js → EditorCanvasImpl-DXeBz2CX.js} +8 -8
  9. package/dist/{EditorCanvasImpl-BNz8TPFs.js.map → EditorCanvasImpl-DXeBz2CX.js.map} +1 -1
  10. package/dist/{ExportManager-B8Td7uR5.js → ExportManager-DUdis6se.js} +794 -536
  11. package/dist/ExportManager-DUdis6se.js.map +1 -0
  12. package/dist/{FontAnalyzer-D4Sg-P6_.js → FontAnalyzer-DKG5JK0x.js} +823 -808
  13. package/dist/FontAnalyzer-DKG5JK0x.js.map +1 -0
  14. package/dist/{ImagePanel-CN2Bu3hf.js → ImagePanel-CBgGqmVV.js} +53 -53
  15. package/dist/{ImagePanel-CN2Bu3hf.js.map → ImagePanel-CBgGqmVV.js.map} +1 -1
  16. package/dist/SnowconeCanvas-BWPBngvI.js +1192 -0
  17. package/dist/SnowconeCanvas-BWPBngvI.js.map +1 -0
  18. package/dist/{UnifiedFontService-CgYnYTj7.js → UnifiedFontService-Co9tQ59z.js} +869 -826
  19. package/dist/UnifiedFontService-Co9tQ59z.js.map +1 -0
  20. package/dist/advanced.mjs +14 -14
  21. package/dist/api/embed.d.ts +2 -0
  22. package/dist/api/stable.d.ts +2 -0
  23. package/dist/components/CanvasContextMenu.d.ts +15 -0
  24. package/dist/components/CanvasEditor/hooks/useCanvasInteraction.d.ts +27 -0
  25. package/dist/components/CanvasEditor.d.ts +8 -0
  26. package/dist/components/embed/SnowconeCanvas.d.ts +13 -0
  27. package/dist/components/embed/kernel.d.ts +8 -0
  28. package/dist/components/ui/icons.d.ts +2 -0
  29. package/dist/contexts/CanvasServicesContext.d.ts +17 -0
  30. package/dist/contexts/EditorContext.d.ts +7 -0
  31. package/dist/{custom-icons-B5TRC1Ed.js → custom-icons-BIaRovwG.js} +2 -2
  32. package/dist/{custom-icons-B5TRC1Ed.js.map → custom-icons-BIaRovwG.js.map} +1 -1
  33. package/dist/{design-builder-COj0zkxu.js → design-builder-JYLO_Hyi.js} +2 -2
  34. package/dist/{design-builder-COj0zkxu.js.map → design-builder-JYLO_Hyi.js.map} +1 -1
  35. package/dist/{editorErrors-CCvoKj_P.js → editorErrors-WzaNxU1Y.js} +181 -194
  36. package/dist/editorErrors-WzaNxU1Y.js.map +1 -0
  37. package/dist/{embed-BTRtoktw.js → embed-Csez1hui.js} +113 -112
  38. package/dist/{embed-BTRtoktw.js.map → embed-Csez1hui.js.map} +1 -1
  39. package/dist/embed.mjs +51 -45
  40. package/dist/embed.mjs.map +1 -1
  41. package/dist/errors/editorError.d.ts +8 -0
  42. package/dist/{guards-uQtEQJbs.js → guards-BSoX73yg.js} +2 -2
  43. package/dist/{guards-uQtEQJbs.js.map → guards-BSoX73yg.js.map} +1 -1
  44. package/dist/hooks/useKeyboardShortcuts.d.ts +15 -2
  45. package/dist/hooks/useLayers.d.ts +2 -0
  46. package/dist/index.mjs +42 -37
  47. package/dist/index.mjs.map +1 -1
  48. package/dist/internals.mjs +47 -47
  49. package/dist/state/CanvasStateV1.d.ts +31 -3
  50. package/dist/state/index.d.ts +2 -2
  51. package/dist/{template-fields-BLRp84Ny.js → template-fields-DYPW7bVU.js} +40 -40
  52. package/dist/{template-fields-BLRp84Ny.js.map → template-fields-DYPW7bVU.js.map} +1 -1
  53. package/dist/testing.mjs +13 -13
  54. package/dist/{usePieceGuideBundle-CTQszfKA.js → usePieceGuideBundle-CRLY2iQa.js} +2 -2
  55. package/dist/{usePieceGuideBundle-CTQszfKA.js.map → usePieceGuideBundle-CRLY2iQa.js.map} +1 -1
  56. package/dist/utils/custom-fonts.d.ts +99 -0
  57. package/dist/validation-BGEl9rrE.js +8686 -0
  58. package/dist/validation-BGEl9rrE.js.map +1 -0
  59. package/dist/workers/export-protocol.d.ts +13 -0
  60. package/dist/workers/export-worker.bundle.string.d.ts +1 -1
  61. package/example/package.json +1 -1
  62. package/package.json +1 -1
  63. package/dist/ContextualToolbars-0jWvnQgp.js +0 -5833
  64. package/dist/ContextualToolbars-0jWvnQgp.js.map +0 -1
  65. package/dist/ExportManager-B8Td7uR5.js.map +0 -1
  66. package/dist/FontAnalyzer-D4Sg-P6_.js.map +0 -1
  67. package/dist/SnowconeCanvas-CR_LdRFP.js +0 -1173
  68. package/dist/SnowconeCanvas-CR_LdRFP.js.map +0 -1
  69. package/dist/UnifiedFontService-CgYnYTj7.js.map +0 -1
  70. package/dist/editorErrors-CCvoKj_P.js.map +0 -1
  71. package/dist/validation-eCebhplp.js +0 -8402
  72. package/dist/validation-eCebhplp.js.map +0 -1
package/ERROR_CONTRACT.md CHANGED
@@ -49,6 +49,7 @@ the issue key in `error.data.issue`.
49
49
  | [`E_BINDING_INERT`](#e_binding_inert) | throw | `assertRenders`: the mutated render is byte-identical to the seed render — the binding under test is dead (the two-render contract, F4). |
50
50
  | [`E_NO_MUTABLE_BINDING`](#e_no_mutable_binding) | throw | `assertRenders`: the design has no named text layer to mutate and no `mutate` override was given (F4). |
51
51
  | [`E_AUDIT_NO_ROOT`](#e_audit_no_root) | throw | `auditEditor()` called with no `<Editor.Root>` mounted — the imperative audit reads the most-recent mounted Root's registry (#10). |
52
+ | [`E_FONT_LOAD_FAILED`](#e_font_load_failed) | throw | A custom (brand) font failed to load from its hosted URL — the binary fetch failed (CORS, 404, network) or FontFace rejected the bytes. Custom fonts NEVER fall back silently to a system face: the design would render with a different typeface/metrics everywhere it's consumed. `data` carries `family`, `url`, `weight`, `style`. Fix the URL (must serve the font file over a plain cross-origin GET) and re-register. Dev AND prod. |
52
53
  | [`E_DISTRIBUTE_MIN_THREE`](#e_distribute_min_three) | throw | `computeDistribute()` called with fewer than 3 movable elements — distributing needs something between the two ends. Gate the action on `useAlignDistribute().canDistribute` instead of calling below the threshold (the toolbar hides its distribute buttons for exactly this reason). |
53
54
  | [`missing-shop`](#missing-shop) | error → throws `E_EMBED_CONFIG` | No `shop` (the publishable shop id) was passed. |
54
55
  | [`missing-grant`](#missing-grant) | error → throws `E_EMBED_CONFIG` | No grant source (`grantUrl`/`grant`) — the session can never authorize, so no mockup ever renders. |
@@ -537,6 +538,18 @@ the issue key in `error.data.issue`.
537
538
 
538
539
  `error.data`: `code`, `docSlug`
539
540
 
541
+ ### `E_FONT_LOAD_FAILED`
542
+
543
+ **Fires when:** A custom (brand) font failed to load from its hosted URL — the binary fetch failed (CORS, 404, network) or FontFace rejected the bytes. Custom fonts NEVER fall back silently to a system face: the design would render with a different typeface/metrics everywhere it's consumed. `data` carries `family`, `url`, `weight`, `style`. Fix the URL (must serve the font file over a plain cross-origin GET) and re-register. Dev AND prod.
544
+
545
+ - `src/utils/custom-fonts.ts`
546
+
547
+ ```text
548
+ Custom font "${font.family}" failed to load from ${font.url}. The URL must serve the font binary over a plain cross-origin GET (CORS). Verify the URL is reachable and sends Access-Control-Allow-Origin, then re-register the font. Custom fonts never fall back silently — the design would render with the wrong typeface.
549
+ ```
550
+
551
+ `error.data`: `code`, `family`, `url`, `weight`, `style`
552
+
540
553
  ### `E_DISTRIBUTE_MIN_THREE`
541
554
 
542
555
  **Fires when:** `computeDistribute()` called with fewer than 3 movable elements — distributing needs something between the two ends. Gate the action on `useAlignDistribute().canDistribute` instead of calling below the threshold (the toolbar hides its distribute buttons for exactly this reason).
@@ -1,6 +1,6 @@
1
- import { X as oe, Y as ie, au as nt, Z as Ft, aH as ae, aF as re, ay as Ot, aE as le, ax as gt, aI as he, aJ as Yt, aK as ce, aL as de, c as Zt, aM as fe, aN as ge, aO as ue, aP as pe, a4 as Jt, a0 as Qt, a8 as pt, a1 as te, a2 as Lt, a9 as Gt, a7 as Pt, aa as Xt, a5 as ye, ab as be, aQ as Nt, aR as Se, aS as me, aT as Te, I as we, aU as ve, aV as Me, aW as tt } from "./FontAnalyzer-D4Sg-P6_.js";
2
- import { T as Wt, a as xe, u as Ce, K as Re, z as At, L as Kt, M as ke, N as Pe, O as Ae } from "./ExportManager-B8Td7uR5.js";
3
- import { i as Dt, a as Ee } from "./guards-uQtEQJbs.js";
1
+ import { _ as oe, $ as ie, ax as nt, a0 as Ft, aK as ae, aI as re, aB as Ot, aH as le, aA as gt, aL as he, aM as Yt, aN as ce, aO as de, c as Zt, aP as fe, aQ as ge, aR as ue, aS as pe, a7 as Jt, a3 as Qt, ab as pt, a4 as te, a5 as Lt, ac as Gt, aa as Pt, ad as Xt, a8 as ye, ae as be, aT as Nt, aU as Se, aV as me, aW as Te, I as we, aX as ve, aY as Me, aZ as tt } from "./FontAnalyzer-DKG5JK0x.js";
2
+ import { T as Wt, b as xe, y as Ce, O as Re, F as At, P as Kt, Q as ke, R as Pe, S as Ae } from "./ExportManager-DUdis6se.js";
3
+ import { i as Dt, a as Ee } from "./guards-BSoX73yg.js";
4
4
  const ct = {
5
5
  // Canvas-specific
6
6
  canvas: {
@@ -3444,4 +3444,4 @@ export {
3444
3444
  $t as g,
3445
3445
  Ze as r
3446
3446
  };
3447
- //# sourceMappingURL=CanvasRenderer-_lFoIoz5.js.map
3447
+ //# sourceMappingURL=CanvasRenderer-BEf0hXeF.js.map