@snowcone-app/canvas 0.26.0 → 0.27.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.
- package/ERROR_CONTRACT.md +38 -0
- package/dist/{CanvasRenderer-6_HhR4-q.js → CanvasRenderer-yszzrDfo.js} +4 -4
- package/dist/{CanvasRenderer-6_HhR4-q.js.map → CanvasRenderer-yszzrDfo.js.map} +1 -1
- package/dist/{CanvasStateV1-DmZ1Qvvn.js → CanvasStateV1-BTbCD_xC.js} +3 -3
- package/dist/{CanvasStateV1-DmZ1Qvvn.js.map → CanvasStateV1-BTbCD_xC.js.map} +1 -1
- package/dist/{ContextualToolbars-DUhBKVxe.js → ContextualToolbars-BHjYsril.js} +6 -6
- package/dist/{ContextualToolbars-DUhBKVxe.js.map → ContextualToolbars-BHjYsril.js.map} +1 -1
- package/dist/{EditorCanvasImpl-BLZV_el0.js → EditorCanvasImpl-Ui8Ceb-h.js} +8 -8
- package/dist/{EditorCanvasImpl-BLZV_el0.js.map → EditorCanvasImpl-Ui8Ceb-h.js.map} +1 -1
- package/dist/{ExportManager-DoU4VK6h.js → ExportManager-BTcyj4cf.js} +2 -2
- package/dist/{ExportManager-DoU4VK6h.js.map → ExportManager-BTcyj4cf.js.map} +1 -1
- package/dist/{FontAnalyzer-CwIpgTGd.js → FontAnalyzer-EF3gLPr8.js} +30 -20
- package/dist/{FontAnalyzer-CwIpgTGd.js.map → FontAnalyzer-EF3gLPr8.js.map} +1 -1
- package/dist/{ImagePanel-sLSjaPWS.js → ImagePanel-CIk6z41z.js} +6 -6
- package/dist/{ImagePanel-sLSjaPWS.js.map → ImagePanel-CIk6z41z.js.map} +1 -1
- package/dist/{SnowconeCanvas-4ef4a61J.js → SnowconeCanvas-DuWALOAt.js} +10 -10
- package/dist/{SnowconeCanvas-4ef4a61J.js.map → SnowconeCanvas-DuWALOAt.js.map} +1 -1
- package/dist/{UnifiedFontService-Bx2MxFfy.js → UnifiedFontService-CHVYDBDW.js} +7 -7
- package/dist/{UnifiedFontService-Bx2MxFfy.js.map → UnifiedFontService-CHVYDBDW.js.map} +1 -1
- package/dist/advanced.mjs +14 -14
- package/dist/api/embed.d.ts +4 -0
- package/dist/contexts/EditorContext.d.ts +34 -0
- package/dist/core/HybridHistoryManager.d.ts +7 -0
- package/dist/core/elementGuards.d.ts +19 -0
- package/dist/{custom-icons-DeYIrTK1.js → custom-icons-CcLMyybv.js} +2 -2
- package/dist/{custom-icons-DeYIrTK1.js.map → custom-icons-CcLMyybv.js.map} +1 -1
- package/dist/{design-builder-U7Su9MMC.js → design-builder-cZY958Rw.js} +2 -2
- package/dist/{design-builder-U7Su9MMC.js.map → design-builder-cZY958Rw.js.map} +1 -1
- package/dist/editorErrors-BhrZ_nwj.js +1219 -0
- package/dist/editorErrors-BhrZ_nwj.js.map +1 -0
- package/dist/{embed-DXGydZOT.js → embed-CJswRZte.js} +10 -10
- package/dist/{embed-DXGydZOT.js.map → embed-CJswRZte.js.map} +1 -1
- package/dist/embed.mjs +39 -33
- package/dist/errors/editorError.d.ts +12 -0
- package/dist/{guards-8rkFAMBs.js → guards-DIX8aXWM.js} +2 -2
- package/dist/{guards-8rkFAMBs.js.map → guards-DIX8aXWM.js.map} +1 -1
- package/dist/hooks/elementPatch.d.ts +96 -0
- package/dist/hooks/useCommands.d.ts +20 -0
- package/dist/index.mjs +8 -8
- package/dist/internals.mjs +9 -9
- package/dist/template-fields-BXl29sgh.js +716 -0
- package/dist/template-fields-BXl29sgh.js.map +1 -0
- package/dist/testing.mjs +4 -4
- package/dist/{usePieceGuideBundle-CbJJg66S.js → usePieceGuideBundle-DE21DQGZ.js} +2 -2
- package/dist/{usePieceGuideBundle-CbJJg66S.js.map → usePieceGuideBundle-DE21DQGZ.js.map} +1 -1
- package/dist/{validation-DnAkXdUg.js → validation-DGXAQmUC.js} +11 -11
- package/dist/{validation-DnAkXdUg.js.map → validation-DGXAQmUC.js.map} +1 -1
- package/example/package.json +1 -1
- package/package.json +3 -3
- package/dist/editorErrors-B2mb1sVN.js +0 -1208
- package/dist/editorErrors-B2mb1sVN.js.map +0 -1
- package/dist/template-fields-DJ157D3E.js +0 -548
- package/dist/template-fields-DJ157D3E.js.map +0 -1
package/ERROR_CONTRACT.md
CHANGED
|
@@ -42,6 +42,8 @@ the issue key in `error.data.issue`.
|
|
|
42
42
|
| [`E_COLOR_ROLE_INVALID`](#e_color_role_invalid) | throw | `design({ colors })`: a role's value is not a `#RGB`/`#RRGGBB` hex (value-matched bindings normalize hex; other syntaxes can't bind). |
|
|
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
|
+
| [`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_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. |
|
|
45
47
|
| [`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). |
|
|
46
48
|
| [`E_RENDER_FAILED`](#e_render_failed) | throw | `assertRenders`: the render failed or produced no usable image (F4). |
|
|
47
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). |
|
|
@@ -118,6 +120,14 @@ the issue key in `error.data.issue`.
|
|
|
118
120
|
|
|
119
121
|
`error.data`: `code`, `layerName`, `validNames`, `docSlug`
|
|
120
122
|
|
|
123
|
+
- `src/hooks/elementPatch.ts`
|
|
124
|
+
|
|
125
|
+
```text
|
|
126
|
+
no element with ${isToken ? 'layer name' : 'id or layer name'} "${key}" in this document. Valid layer names: ${JSON.stringify(names)}; valid ids: ${JSON.stringify(all.map((el) => el.id))}.
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
`error.data`: `code`, `layerName`, `validNames`, `validIds`, `docSlug`
|
|
130
|
+
|
|
121
131
|
### `E_LAYER_WRONG_KIND`
|
|
122
132
|
|
|
123
133
|
**Fires when:** The layer exists but is not the kind the part binds (e.g. an image layer passed to `Editor.TextField`).
|
|
@@ -406,6 +416,34 @@ the issue key in `error.data.issue`.
|
|
|
406
416
|
|
|
407
417
|
`error.data`: `code`, `docSlug`
|
|
408
418
|
|
|
419
|
+
### `E_INVALID_PATCH`
|
|
420
|
+
|
|
421
|
+
**Fires when:** `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.
|
|
422
|
+
|
|
423
|
+
**Docs:** <https://developers.snowcone.app/embed-mode> (`error.data.docSlug`)
|
|
424
|
+
|
|
425
|
+
- `src/hooks/elementPatch.ts`
|
|
426
|
+
|
|
427
|
+
```text
|
|
428
|
+
${message}
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
`error.data`: `code`, `...data`, `docSlug`
|
|
432
|
+
|
|
433
|
+
### `E_NO_ACTIVE_ARTBOARD`
|
|
434
|
+
|
|
435
|
+
**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.
|
|
436
|
+
|
|
437
|
+
**Docs:** <https://developers.snowcone.app/embed-mode> (`error.data.docSlug`)
|
|
438
|
+
|
|
439
|
+
- `src/contexts/EditorContext.tsx`
|
|
440
|
+
|
|
441
|
+
```text
|
|
442
|
+
addElement({ type: "${elementType}" }) needs an active artboard and none exists. <Editor.Root> seeds one automatically; with a raw EditorProvider create one first (executeCreateArtboard) or select one (artboardManager.setActiveArtboard).
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
`error.data`: `code`, `type`, `docSlug`
|
|
446
|
+
|
|
409
447
|
### `E_ASSET_FORBIDDEN`
|
|
410
448
|
|
|
411
449
|
**Fires when:** `assertRenders`: the shop's asset-origin allowlist denied a design asset (translated from the server's 403 — F4).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { T as Bt, a as Te, u as ve, K as we, z as kt, L as Yt, M as Ce, N as Me, O as xe } from "./ExportManager-
|
|
3
|
-
import { i as Lt, a as Re } from "./guards-
|
|
1
|
+
import { X as te, Y as ee, ar as tt, Z as zt, aE as ne, aC as se, av as Vt, aB as oe, au as ht, aF as ie, aG as Ft, aH as ae, aI as re, c as $t, aJ as le, aK as he, aL as ce, aM as de, a4 as jt, a0 as qt, a6 as ft, a1 as Ut, a2 as Ht, a5 as fe, a8 as ge, aN as Ot, aO as ue, aP as pe, aQ as ye, I as be, aR as Se, aS as me, aT as Q } from "./FontAnalyzer-EF3gLPr8.js";
|
|
2
|
+
import { T as Bt, a as Te, u as ve, K as we, z as kt, L as Yt, M as Ce, N as Me, O as xe } from "./ExportManager-BTcyj4cf.js";
|
|
3
|
+
import { i as Lt, a as Re } from "./guards-DIX8aXWM.js";
|
|
4
4
|
const it = {
|
|
5
5
|
// Canvas-specific
|
|
6
6
|
canvas: {
|
|
@@ -3376,4 +3376,4 @@ export {
|
|
|
3376
3376
|
Gt as g,
|
|
3377
3377
|
Ye as r
|
|
3378
3378
|
};
|
|
3379
|
-
//# sourceMappingURL=CanvasRenderer-
|
|
3379
|
+
//# sourceMappingURL=CanvasRenderer-yszzrDfo.js.map
|