@snowcone-app/canvas 0.29.0 → 0.31.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 (92) hide show
  1. package/ERROR_CONTRACT.md +13 -0
  2. package/STYLING_CONTRACT.md +2 -2
  3. package/dist/{CanvasRenderer-_lFoIoz5.js → CanvasRenderer-hpJ05JGO.js} +4 -4
  4. package/dist/{CanvasRenderer-_lFoIoz5.js.map → CanvasRenderer-hpJ05JGO.js.map} +1 -1
  5. package/dist/{CanvasStateV1-BMxr6xb8.js → CanvasStateV1-jLOibojY.js} +876 -844
  6. package/dist/{CanvasStateV1-BMxr6xb8.js.map → CanvasStateV1-jLOibojY.js.map} +1 -1
  7. package/dist/ContextualToolbars-DRbuUE7W.js +6061 -0
  8. package/dist/ContextualToolbars-DRbuUE7W.js.map +1 -0
  9. package/dist/{EditorCanvasImpl-BNz8TPFs.js → EditorCanvasImpl-P2GHPNA3.js} +19 -20
  10. package/dist/{EditorCanvasImpl-BNz8TPFs.js.map → EditorCanvasImpl-P2GHPNA3.js.map} +1 -1
  11. package/dist/{ExportManager-B8Td7uR5.js → ExportManager-Bkzzyxgw.js} +973 -576
  12. package/dist/ExportManager-Bkzzyxgw.js.map +1 -0
  13. package/dist/{FontAnalyzer-D4Sg-P6_.js → FontAnalyzer-BYhwxDhe.js} +542 -477
  14. package/dist/FontAnalyzer-BYhwxDhe.js.map +1 -0
  15. package/dist/{ImagePanel-CN2Bu3hf.js → ImagePanel-CEr0_FYy.js} +38 -38
  16. package/dist/{ImagePanel-CN2Bu3hf.js.map → ImagePanel-CEr0_FYy.js.map} +1 -1
  17. package/dist/SnowconeCanvas-Fa0isFpO.js +1192 -0
  18. package/dist/SnowconeCanvas-Fa0isFpO.js.map +1 -0
  19. package/dist/advanced.mjs +14 -14
  20. package/dist/api/embed.d.ts +2 -0
  21. package/dist/api/stable.d.ts +2 -0
  22. package/dist/components/CanvasContextMenu.d.ts +15 -0
  23. package/dist/components/CanvasEditor/hooks/useCanvasInteraction.d.ts +27 -0
  24. package/dist/components/CanvasEditor.d.ts +8 -0
  25. package/dist/components/ImageToolbar.d.ts +4 -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/toolbars/EmbeddedToolbarLayout.d.ts +2 -0
  29. package/dist/components/toolbars/SecondaryPanels.d.ts +17 -1
  30. package/dist/components/toolbars/index.d.ts +2 -2
  31. package/dist/components/ui/SliderRow.d.ts +6 -0
  32. package/dist/components/ui/icons.d.ts +2 -0
  33. package/dist/components/ui/toolbar-button.d.ts +2 -2
  34. package/dist/contexts/CanvasServicesContext.d.ts +17 -0
  35. package/dist/contexts/EditorContext.d.ts +7 -0
  36. package/dist/core/image-adjustments.d.ts +32 -0
  37. package/dist/{custom-icons-B5TRC1Ed.js → custom-icons-Co4rcW0S.js} +7 -7
  38. package/dist/{custom-icons-B5TRC1Ed.js.map → custom-icons-Co4rcW0S.js.map} +1 -1
  39. package/dist/design-builder-CBG2hKc8.js +1672 -0
  40. package/dist/design-builder-CBG2hKc8.js.map +1 -0
  41. package/dist/{embed-BTRtoktw.js → embed-D4TIzO7g.js} +20 -20
  42. package/dist/{embed-BTRtoktw.js.map → embed-D4TIzO7g.js.map} +1 -1
  43. package/dist/embed.mjs +51 -46
  44. package/dist/embed.mjs.map +1 -1
  45. package/dist/errors/editorError.d.ts +8 -0
  46. package/dist/{guards-uQtEQJbs.js → guards-DgZuwVgu.js} +2 -2
  47. package/dist/{guards-uQtEQJbs.js.map → guards-DgZuwVgu.js.map} +1 -1
  48. package/dist/hooks/elementPatch.d.ts +7 -2
  49. package/dist/hooks/useKeyboardShortcuts.d.ts +15 -2
  50. package/dist/hooks/useLayers.d.ts +2 -0
  51. package/dist/index.mjs +57 -52
  52. package/dist/index.mjs.map +1 -1
  53. package/dist/internals.mjs +201 -132
  54. package/dist/internals.mjs.map +1 -1
  55. package/dist/rendering/element-painters.d.ts +0 -13
  56. package/dist/rendering/element-serializer.d.ts +3 -1
  57. package/dist/rendering/image-adjustments.d.ts +24 -0
  58. package/dist/rendering/renderer-types.d.ts +8 -1
  59. package/dist/state/CanvasStateV1.d.ts +36 -3
  60. package/dist/state/index.d.ts +2 -2
  61. package/dist/template-fields-CvFcr5zy.js +505 -0
  62. package/dist/template-fields-CvFcr5zy.js.map +1 -0
  63. package/dist/testing.mjs +46 -47
  64. package/dist/testing.mjs.map +1 -1
  65. package/dist/types/index.d.ts +21 -0
  66. package/dist/{UnifiedFontService-CgYnYTj7.js → useCommands-bPXY9rCh.js} +2429 -2145
  67. package/dist/useCommands-bPXY9rCh.js.map +1 -0
  68. package/dist/{usePieceGuideBundle-CTQszfKA.js → usePieceGuideBundle-Bj98nPk0.js} +2 -2
  69. package/dist/{usePieceGuideBundle-CTQszfKA.js.map → usePieceGuideBundle-Bj98nPk0.js.map} +1 -1
  70. package/dist/utils/custom-fonts.d.ts +99 -0
  71. package/dist/utils/featureApplied.d.ts +2 -0
  72. package/dist/validation-CsTlSvJJ.js +8686 -0
  73. package/dist/validation-CsTlSvJJ.js.map +1 -0
  74. package/dist/workers/export-protocol.d.ts +13 -0
  75. package/dist/workers/export-worker.bundle.string.d.ts +1 -1
  76. package/example/package.json +1 -1
  77. package/package.json +1 -1
  78. package/dist/ContextualToolbars-0jWvnQgp.js +0 -5833
  79. package/dist/ContextualToolbars-0jWvnQgp.js.map +0 -1
  80. package/dist/ExportManager-B8Td7uR5.js.map +0 -1
  81. package/dist/FontAnalyzer-D4Sg-P6_.js.map +0 -1
  82. package/dist/SnowconeCanvas-CR_LdRFP.js +0 -1173
  83. package/dist/SnowconeCanvas-CR_LdRFP.js.map +0 -1
  84. package/dist/UnifiedFontService-CgYnYTj7.js.map +0 -1
  85. package/dist/design-builder-COj0zkxu.js +0 -470
  86. package/dist/design-builder-COj0zkxu.js.map +0 -1
  87. package/dist/editorErrors-CCvoKj_P.js +0 -1219
  88. package/dist/editorErrors-CCvoKj_P.js.map +0 -1
  89. package/dist/template-fields-BLRp84Ny.js +0 -716
  90. package/dist/template-fields-BLRp84Ny.js.map +0 -1
  91. package/dist/validation-eCebhplp.js +0 -8402
  92. 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).
@@ -92,7 +92,7 @@ stable hooks; `sc:`-prefixed utility classes are internal and NOT contract.
92
92
  <div class="sc-toolbar" data-mode="embedded">
93
93
  …
94
94
  <div class="sc-secondary-toolbar-panel-wrapper">
95
- <div> ×16
95
+ <div> ×17
96
96
  ```
97
97
 
98
98
  ### `controls` — Editor.Controls — built-in floating toolbar (no Controls mounted; body portal)
@@ -398,7 +398,7 @@ stable hooks; `sc:`-prefixed utility classes are internal and NOT contract.
398
398
  <div>
399
399
  …
400
400
  <div class="sc-secondary-toolbar-panel-wrapper">
401
- … ×16
401
+ … ×17
402
402
  <div data-sc-part="snowcone-editor-idle-dock">
403
403
  <div data-sc-part="add">
404
404
  <div>
@@ -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 { a2 as oe, a3 as ie, aB as nt, a4 as Ft, aO as ae, aM as re, aF as Ot, aL as le, aE as gt, aP as he, aQ as Yt, aR as ce, aS as de, c as Zt, aT as fe, aU as ge, aV as ue, aW as pe, ab as Jt, a7 as Qt, af as pt, a8 as te, a9 as Lt, ag as Gt, ae as Pt, ah as Xt, ac as ye, ai as be, aX as Nt, aY as Se, aZ as me, a_ as Te, I as we, a$ as ve, b0 as Me, b1 as tt } from "./FontAnalyzer-BYhwxDhe.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-Bkzzyxgw.js";
3
+ import { i as Dt, a as Ee } from "./guards-DgZuwVgu.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-hpJ05JGO.js.map