@snowcone-app/canvas 0.31.0 → 0.33.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 (68) hide show
  1. package/ERROR_CONTRACT.md +11 -0
  2. package/STYLING_CONTRACT.md +5 -3
  3. package/dist/{CanvasRenderer-hpJ05JGO.js → CanvasRenderer-1j-twIbs.js} +443 -431
  4. package/dist/{CanvasRenderer-hpJ05JGO.js.map → CanvasRenderer-1j-twIbs.js.map} +1 -1
  5. package/dist/{CanvasStateV1-jLOibojY.js → CanvasStateV1-BmC1JfPv.js} +810 -802
  6. package/dist/{CanvasStateV1-jLOibojY.js.map → CanvasStateV1-BmC1JfPv.js.map} +1 -1
  7. package/dist/ContextualToolbars-CLDFENZq.js +6532 -0
  8. package/dist/ContextualToolbars-CLDFENZq.js.map +1 -0
  9. package/dist/{EditorCanvasImpl-P2GHPNA3.js → EditorCanvasImpl-XP_t-tNl.js} +7 -7
  10. package/dist/{EditorCanvasImpl-P2GHPNA3.js.map → EditorCanvasImpl-XP_t-tNl.js.map} +1 -1
  11. package/dist/{ExportManager-Bkzzyxgw.js → ExportManager-Ci81K6xA.js} +662 -518
  12. package/dist/ExportManager-Ci81K6xA.js.map +1 -0
  13. package/dist/{FontAnalyzer-BYhwxDhe.js → FontAnalyzer-BrKY6XYn.js} +1256 -1146
  14. package/dist/FontAnalyzer-BrKY6XYn.js.map +1 -0
  15. package/dist/{ImagePanel-CEr0_FYy.js → ImagePanel-ntJBepby.js} +6 -6
  16. package/dist/{ImagePanel-CEr0_FYy.js.map → ImagePanel-ntJBepby.js.map} +1 -1
  17. package/dist/{SnowconeCanvas-Fa0isFpO.js → SnowconeCanvas-wMLBZJ9z.js} +10 -10
  18. package/dist/{SnowconeCanvas-Fa0isFpO.js.map → SnowconeCanvas-wMLBZJ9z.js.map} +1 -1
  19. package/dist/advanced.mjs +14 -14
  20. package/dist/components/ImageToolbar.d.ts +8 -0
  21. package/dist/components/ShapeToolbar.d.ts +8 -0
  22. package/dist/components/TextToolbar.d.ts +5 -1
  23. package/dist/components/toolbars/EmbeddedToolbarLayout.d.ts +6 -0
  24. package/dist/components/toolbars/FloatingPanels.d.ts +10 -0
  25. package/dist/components/toolbars/GroupElementToolbar.d.ts +8 -0
  26. package/dist/components/toolbars/SecondaryPanels.d.ts +37 -1
  27. package/dist/components/toolbars/alignButtons.d.ts +13 -0
  28. package/dist/components/toolbars/index.d.ts +5 -3
  29. package/dist/core/BaseElement.d.ts +2 -1
  30. package/dist/core/shape-fill.d.ts +31 -0
  31. package/dist/{custom-icons-Co4rcW0S.js → custom-icons-DTWtkJ9N.js} +2 -2
  32. package/dist/{custom-icons-Co4rcW0S.js.map → custom-icons-DTWtkJ9N.js.map} +1 -1
  33. package/dist/{design-builder-CBG2hKc8.js → design-builder-BpbYUYtK.js} +55 -55
  34. package/dist/{design-builder-CBG2hKc8.js.map → design-builder-BpbYUYtK.js.map} +1 -1
  35. package/dist/{embed-D4TIzO7g.js → embed-VTcnrkRj.js} +10 -10
  36. package/dist/{embed-D4TIzO7g.js.map → embed-VTcnrkRj.js.map} +1 -1
  37. package/dist/embed.mjs +7 -7
  38. package/dist/errors/editorError.d.ts +7 -0
  39. package/dist/{guards-DgZuwVgu.js → guards-BhaQgJrE.js} +2 -2
  40. package/dist/{guards-DgZuwVgu.js.map → guards-BhaQgJrE.js.map} +1 -1
  41. package/dist/hooks/elementPatch.d.ts +8 -3
  42. package/dist/index.mjs +9 -9
  43. package/dist/internals.mjs +123 -123
  44. package/dist/internals.mjs.map +1 -1
  45. package/dist/rendering/LayerEffectsRenderer.d.ts +24 -0
  46. package/dist/rendering/renderer-types.d.ts +3 -1
  47. package/dist/state/CanvasStateV1.d.ts +17 -0
  48. package/dist/style.css +1 -1
  49. package/dist/{template-fields-CvFcr5zy.js → template-fields-D-2oLhCi.js} +5 -5
  50. package/dist/{template-fields-CvFcr5zy.js.map → template-fields-D-2oLhCi.js.map} +1 -1
  51. package/dist/testing.mjs +3 -3
  52. package/dist/types/index.d.ts +84 -1
  53. package/dist/types/public.d.ts +3 -2
  54. package/dist/{useCommands-bPXY9rCh.js → useCommands-DwnZHUg8.js} +435 -418
  55. package/dist/useCommands-DwnZHUg8.js.map +1 -0
  56. package/dist/{usePieceGuideBundle-Bj98nPk0.js → usePieceGuideBundle-CnSmYrmM.js} +2 -2
  57. package/dist/{usePieceGuideBundle-Bj98nPk0.js.map → usePieceGuideBundle-CnSmYrmM.js.map} +1 -1
  58. package/dist/utils/featureApplied.d.ts +4 -0
  59. package/dist/{validation-CsTlSvJJ.js → validation-CSa86fDE.js} +11 -11
  60. package/dist/{validation-CsTlSvJJ.js.map → validation-CSa86fDE.js.map} +1 -1
  61. package/dist/workers/export-worker.bundle.string.d.ts +1 -1
  62. package/example/package.json +1 -1
  63. package/package.json +1 -1
  64. package/dist/ContextualToolbars-DRbuUE7W.js +0 -6061
  65. package/dist/ContextualToolbars-DRbuUE7W.js.map +0 -1
  66. package/dist/ExportManager-Bkzzyxgw.js.map +0 -1
  67. package/dist/FontAnalyzer-BYhwxDhe.js.map +0 -1
  68. package/dist/useCommands-bPXY9rCh.js.map +0 -1
package/ERROR_CONTRACT.md CHANGED
@@ -43,6 +43,7 @@ the issue key in `error.data.issue`.
43
43
  | [`E_COLOR_ROLE_NOT_FOUND`](#e_color_role_not_found) | throw | `design.color(name)`: no color role with this name — lists the design's declared roles. |
44
44
  | [`E_PREVIEW_NO_LOADER`](#e_preview_no_loader) | throw | `Editor.Preview loadingOverlay` got `false`/an unknown value. A mockup preview ALWAYS has a render-in-flight treatment (a server render takes real time, and the loader paints OVER the still-visible previous mockup) — keep the default, pass a variant/custom element, or declare `"host-owned"` with your own indicator. Silence-then-pop-in is a composition mistake, not a preference. |
45
45
  | [`E_INVALID_PATCH`](#e_invalid_patch) | throw | `updateElement(target, patch)`: a patch key doesn't apply to the target element's kind (e.g. `fontSize` on a shape), or a value is out of range (opacity outside 0..1, fontSize/width/height <= 0, non-finite number, wrong primitive type). The message names the element kind and lists the valid keys for it. Dev AND prod. |
46
+ | [`E_INVALID_FILL`](#e_invalid_fill) | throw | A shape `fill` value is not a valid `ShapeFill` union member: unknown `type` (valid: "solid" \| "linear" \| "radial"), a gradient with fewer than 2 stops, a stop `offset` outside 0..1 (or non-finite), a non-string stop `color`, or a non-finite linear `angle`. Thrown wherever a fill enters the model — `new ShapeElement(...)` and `updateElement` patches. Dev AND prod. |
46
47
  | [`E_NO_ACTIVE_ARTBOARD`](#e_no_active_artboard) | throw | `addElement(spec)`: there is no active artboard to add the element to. Create or select an artboard first (`<Editor.Root>` seeds one automatically; with a raw `EditorProvider` use `executeCreateArtboard`). Replaces the old `handleAddElement` window.alert — agents read throws, not dialogs. |
47
48
  | [`E_ASSET_FORBIDDEN`](#e_asset_forbidden) | throw | `assertRenders`: the shop's asset-origin allowlist denied a design asset (translated from the server's 403 — F4). |
48
49
  | [`E_RENDER_FAILED`](#e_render_failed) | throw | `assertRenders`: the render failed or produced no usable image (F4). |
@@ -432,6 +433,16 @@ the issue key in `error.data.issue`.
432
433
 
433
434
  `error.data`: `code`, `...data`, `docSlug`
434
435
 
436
+ ### `E_INVALID_FILL`
437
+
438
+ **Fires when:** A shape `fill` value is not a valid `ShapeFill` union member: unknown `type` (valid: "solid" | "linear" | "radial"), a gradient with fewer than 2 stops, a stop `offset` outside 0..1 (or non-finite), a non-string stop `color`, or a non-finite linear `angle`. Thrown wherever a fill enters the model — `new ShapeElement(...)` and `updateElement` patches. Dev AND prod.
439
+
440
+ - `src/core/shape-fill.ts`
441
+
442
+ ```text
443
+ ${message}
444
+ ```
445
+
435
446
  ### `E_NO_ACTIVE_ARTBOARD`
436
447
 
437
448
  **Fires when:** `addElement(spec)`: there is no active artboard to add the element to. Create or select an artboard first (`<Editor.Root>` seeds one automatically; with a raw `EditorProvider` use `executeCreateArtboard`). Replaces the old `handleAddElement` window.alert — agents read throws, not dialogs.
@@ -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> ×17
95
+ <div> ×20
96
96
  ```
97
97
 
98
98
  ### `controls` — Editor.Controls — built-in floating toolbar (no Controls mounted; body portal)
@@ -106,6 +106,8 @@ stable hooks; `sc:`-prefixed utility classes are internal and NOT contract.
106
106
  <button aria-label=<label> aria-pressed="false">
107
107
  <svg>
108
108
  …
109
+ <button aria-label=<label> aria-pressed="false">
110
+ <span class="sc-normalized-icon-responsive">
109
111
  <div class="sc-toolbar-items">
110
112
  <button aria-label=<label> title=<title>>
111
113
  …
@@ -117,7 +119,7 @@ stable hooks; `sc:`-prefixed utility classes are internal and NOT contract.
117
119
  … ×5
118
120
  <button aria-expanded="false" aria-label=<label> class="sc-toolbar-btn" type="button">
119
121
  <button aria-label=<label> aria-pressed="false">
120
- … ×6
122
+ … ×8
121
123
  <button aria-label=<label> aria-pressed="false" disabled>
122
124
  …
123
125
  <button aria-expanded="false" aria-label=<label> class="sc-toolbar-btn" type="button">
@@ -398,7 +400,7 @@ stable hooks; `sc:`-prefixed utility classes are internal and NOT contract.
398
400
  <div>
399
401
  …
400
402
  <div class="sc-secondary-toolbar-panel-wrapper">
401
- … ×17
403
+ … ×20
402
404
  <div data-sc-part="snowcone-editor-idle-dock">
403
405
  <div data-sc-part="add">
404
406
  <div>