@snowcone-app/canvas 0.22.0 → 0.26.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 +600 -0
- package/README.md +2 -1
- package/STYLING_CONTRACT.md +173 -93
- package/dist/{ContextualToolbars-BDEt9ND0.js → ContextualToolbars-DUhBKVxe.js} +3 -3
- package/dist/{ContextualToolbars-BDEt9ND0.js.map → ContextualToolbars-DUhBKVxe.js.map} +1 -1
- package/dist/{EditorCanvasImpl-BH_bKy-F.js → EditorCanvasImpl-BLZV_el0.js} +6 -6
- package/dist/{EditorCanvasImpl-BH_bKy-F.js.map → EditorCanvasImpl-BLZV_el0.js.map} +1 -1
- package/dist/{ImagePanel-BwqFDKvW.js → ImagePanel-sLSjaPWS.js} +3 -3
- package/dist/{ImagePanel-BwqFDKvW.js.map → ImagePanel-sLSjaPWS.js.map} +1 -1
- package/dist/{SnowconeCanvas-Cx7nXlBI.js → SnowconeCanvas-4ef4a61J.js} +6 -6
- package/dist/{SnowconeCanvas-Cx7nXlBI.js.map → SnowconeCanvas-4ef4a61J.js.map} +1 -1
- package/dist/{UnifiedFontService-CC3CSmH5.js → UnifiedFontService-Bx2MxFfy.js} +867 -834
- package/dist/{UnifiedFontService-CC3CSmH5.js.map → UnifiedFontService-Bx2MxFfy.js.map} +1 -1
- package/dist/advanced.mjs +7 -7
- package/dist/api/embed.d.ts +4 -4
- package/dist/components/editor/EditorLoadingOverlay.d.ts +12 -0
- package/dist/components/editor/EditorPlacements.d.ts +14 -0
- package/dist/components/editor/EditorPreview.d.ts +32 -8
- package/dist/components/editor/EditorRoot.d.ts +12 -0
- package/dist/components/editor/PreviewPrismOverlay.d.ts +23 -0
- package/dist/components/editor/RootInternals.d.ts +31 -0
- package/dist/components/editor/editorAudit.d.ts +66 -0
- package/dist/components/editor/index.d.ts +14 -0
- package/dist/components/editor/usePlacements.d.ts +14 -0
- package/dist/components/embed-realtime/context.d.ts +11 -2
- package/dist/components/embed-realtime/validateEmbed.d.ts +20 -1
- package/dist/{custom-icons-BW6hqmkL.js → custom-icons-DeYIrTK1.js} +7 -7
- package/dist/{custom-icons-BW6hqmkL.js.map → custom-icons-DeYIrTK1.js.map} +1 -1
- package/dist/design/design-builder.d.ts +108 -15
- package/dist/design/product-config.d.ts +10 -0
- package/dist/design-builder-U7Su9MMC.js +470 -0
- package/dist/design-builder-U7Su9MMC.js.map +1 -0
- package/dist/editorErrors-B2mb1sVN.js.map +1 -1
- package/dist/embed-DXGydZOT.js +1586 -0
- package/dist/embed-DXGydZOT.js.map +1 -0
- package/dist/embed.mjs +34 -31
- package/dist/errors/editorError.d.ts +27 -1
- package/dist/hooks/bindingGuards.d.ts +16 -0
- package/dist/hooks/useColorBinding.d.ts +2 -1
- package/dist/hooks/useFontBinding.d.ts +2 -1
- package/dist/hooks/useImageBinding.d.ts +2 -1
- package/dist/hooks/useTextBinding.d.ts +2 -1
- package/dist/index.mjs +6 -6
- package/dist/style.css +1 -1
- package/dist/template-fields-DJ157D3E.js +548 -0
- package/dist/template-fields-DJ157D3E.js.map +1 -0
- package/dist/testing/failureFixtures.d.ts +2 -2
- package/dist/testing.mjs +1 -1
- package/dist/{validation-C9Fe9ahK.js → validation-DnAkXdUg.js} +7 -7
- package/dist/{validation-C9Fe9ahK.js.map → validation-DnAkXdUg.js.map} +1 -1
- package/example/package.json +1 -1
- package/llms.txt +3 -0
- package/package.json +6 -3
- package/dist/design-builder-CT4DHIPe.js +0 -367
- package/dist/design-builder-CT4DHIPe.js.map +0 -1
- package/dist/embed-8ecUMMH-.js +0 -1226
- package/dist/embed-8ecUMMH-.js.map +0 -1
- package/dist/template-fields-C2pSfMBh.js +0 -494
- package/dist/template-fields-C2pSfMBh.js.map +0 -1
package/dist/embed.mjs
CHANGED
|
@@ -1,45 +1,48 @@
|
|
|
1
|
-
import { C as a, a as r, b as o, u as t, d as i, f as d, g as n } from "./UnifiedFontService-
|
|
2
|
-
import { E as m, R as l, a as E, b as c, S as
|
|
3
|
-
import { g as
|
|
4
|
-
import { D as
|
|
5
|
-
import { D as
|
|
6
|
-
import { s as
|
|
1
|
+
import { C as a, a as r, b as o, u as t, d as i, f as d, g as n } from "./UnifiedFontService-Bx2MxFfy.js";
|
|
2
|
+
import { E as m, R as l, a as E, b as c, S as g, c as p, d as f, f as S, p as x, e as T, g as v, h as C, v as b } from "./embed-DXGydZOT.js";
|
|
3
|
+
import { g as P, i as y, u as R } from "./editorErrors-B2mb1sVN.js";
|
|
4
|
+
import { D as k, d as F, a as I, i as L } from "./design-builder-U7Su9MMC.js";
|
|
5
|
+
import { D as w, T as M, r as A, u as _, a as z, b as G, c as K, d as N, e as Y, f as j, w as q } from "./template-fields-DJ157D3E.js";
|
|
6
|
+
import { s as J } from "./CanvasStateV1-DmZ1Qvvn.js";
|
|
7
7
|
export {
|
|
8
8
|
a as CanvasServicesProvider,
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
k as DesignBuilder,
|
|
10
|
+
w as DesignStateStore,
|
|
11
11
|
m as Editor,
|
|
12
|
-
|
|
12
|
+
P as EditorError,
|
|
13
13
|
l as RealtimeCanvas,
|
|
14
14
|
E as RealtimeEmbed,
|
|
15
15
|
c as RealtimeMockup,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
g as SnowconeEditor,
|
|
17
|
+
M as TEMPLATE_FIELDS_KEY,
|
|
18
|
+
p as auditEditor,
|
|
19
|
+
f as collectEmbedIssues,
|
|
19
20
|
r as createProxyGenerate,
|
|
20
21
|
o as createProxyImageSearch,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
F as design,
|
|
23
|
+
S as formatBuyPrice,
|
|
24
|
+
I as isColorToken,
|
|
25
|
+
y as isEditorError,
|
|
26
|
+
L as isLayerToken,
|
|
27
|
+
x as productToRenderConfig,
|
|
28
|
+
A as readTemplateFields,
|
|
29
|
+
J as serializeState,
|
|
28
30
|
t as useArtboards,
|
|
29
31
|
i as useCanvasServices,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
_ as useColorBinding,
|
|
33
|
+
z as useCommands,
|
|
34
|
+
R as useEditor,
|
|
35
|
+
G as useElementByName,
|
|
34
36
|
d as useExport,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
K as useFontBinding,
|
|
38
|
+
N as useImageBinding,
|
|
37
39
|
n as useLayers,
|
|
38
|
-
|
|
39
|
-
v as
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
T as usePlacements,
|
|
41
|
+
v as useProductSelection,
|
|
42
|
+
C as useRealtimeMockups,
|
|
43
|
+
Y as useSelectedElement,
|
|
44
|
+
j as useTextBinding,
|
|
45
|
+
b as validateEmbed,
|
|
46
|
+
q as withTemplateFields
|
|
44
47
|
};
|
|
45
48
|
//# sourceMappingURL=embed.mjs.map
|
|
@@ -36,9 +36,32 @@ export type EditorErrorCode =
|
|
|
36
36
|
/** `productToRenderConfig`: the catalog product has no renderable image
|
|
37
37
|
* placement / no mockup scenes, or the requested placement doesn't exist. */
|
|
38
38
|
| 'E_PRODUCT_NOT_RENDERABLE'
|
|
39
|
+
/** `design().artboard()`: an artboard with this label already exists in the
|
|
40
|
+
* design (artboard names are placement labels — unique by contract). */
|
|
41
|
+
| 'E_DUPLICATE_ARTBOARD'
|
|
42
|
+
/** `usePlacements().select()`: the label names no artboard in the design
|
|
43
|
+
* (ADR-0088). Lists the valid placement labels. */
|
|
44
|
+
| 'E_UNKNOWN_PLACEMENT'
|
|
39
45
|
/** `select()` named an option key/choice that doesn't exist on the product
|
|
40
46
|
* (Buy-owned selection, ADR-0085 §2 / P2). */
|
|
41
47
|
| 'E_UNKNOWN_OPTION'
|
|
48
|
+
/** `design({ colors })`: two color roles share one (normalized) hex value.
|
|
49
|
+
* `useColorBinding` matches by VALUE, so colliding roles would capture each
|
|
50
|
+
* other's elements — rejected at mint time instead of failing subtly. */
|
|
51
|
+
| 'E_COLOR_ROLE_COLLISION'
|
|
52
|
+
/** `design({ colors })`: a role's value is not a `#RGB`/`#RRGGBB` hex
|
|
53
|
+
* (value-matched bindings normalize hex; other syntaxes can't bind). */
|
|
54
|
+
| 'E_COLOR_ROLE_INVALID'
|
|
55
|
+
/** `design.color(name)`: no color role with this name — lists the design's
|
|
56
|
+
* declared roles. */
|
|
57
|
+
| 'E_COLOR_ROLE_NOT_FOUND'
|
|
58
|
+
/** `Editor.Preview loadingOverlay` got `false`/an unknown value. A mockup
|
|
59
|
+
* preview ALWAYS has a render-in-flight treatment (a server render takes
|
|
60
|
+
* real time, and the loader paints OVER the still-visible previous
|
|
61
|
+
* mockup) — keep the default, pass a variant/custom element, or declare
|
|
62
|
+
* `"host-owned"` with your own indicator. Silence-then-pop-in is a
|
|
63
|
+
* composition mistake, not a preference. */
|
|
64
|
+
| 'E_PREVIEW_NO_LOADER'
|
|
42
65
|
/** `assertRenders`: the shop's asset-origin allowlist denied a design asset
|
|
43
66
|
* (translated from the server's 403 — F4). */
|
|
44
67
|
| 'E_ASSET_FORBIDDEN'
|
|
@@ -49,7 +72,10 @@ export type EditorErrorCode =
|
|
|
49
72
|
| 'E_BINDING_INERT'
|
|
50
73
|
/** `assertRenders`: the design has no named text layer to mutate and no
|
|
51
74
|
* `mutate` override was given (F4). */
|
|
52
|
-
| 'E_NO_MUTABLE_BINDING'
|
|
75
|
+
| 'E_NO_MUTABLE_BINDING'
|
|
76
|
+
/** `auditEditor()` called with no `<Editor.Root>` mounted — the imperative
|
|
77
|
+
* audit reads the most-recent mounted Root's registry (#10). */
|
|
78
|
+
| 'E_AUDIT_NO_ROOT';
|
|
53
79
|
export interface EditorErrorData {
|
|
54
80
|
code: EditorErrorCode;
|
|
55
81
|
/** Slug under https://developers.snowcone.app/ for the violated contract. */
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LayerKind, LayerToken } from '../design/design-builder.js';
|
|
2
|
+
import { ElementStore } from '../core/ElementStore.js';
|
|
3
|
+
/**
|
|
4
|
+
* Under `<Editor.Root>`, declare that this binding hook needs a mounted
|
|
5
|
+
* `Editor.Canvas` — Root's registry validation throws `E_REQUIRES_CANVAS`
|
|
6
|
+
* (its existing single validation point) when none is in the composition.
|
|
7
|
+
* No-op outside a Root.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useBindingRequiresCanvas(hookName: string): void;
|
|
10
|
+
/**
|
|
11
|
+
* Accept a binding hook's `string | LayerToken` argument and return the bare
|
|
12
|
+
* layer name. With a token under `<Editor.Root>`, mount-validate it against
|
|
13
|
+
* the first non-empty element snapshot (see module doc). Bare strings keep
|
|
14
|
+
* the settle-aware dead-binding console.warn instead.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useValidatedBindingLayer(layerOrName: string | LayerToken, expectedKind: LayerKind, elementStore: ElementStore): string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ColorToken } from '../design/design-builder.js';
|
|
1
2
|
import { EditorElement } from '../contexts/EditorContext.js';
|
|
2
3
|
/** Result returned by {@link useColorBinding}. */
|
|
3
4
|
export interface ColorBindingResult {
|
|
@@ -18,4 +19,4 @@ export interface ColorBindingResult {
|
|
|
18
19
|
* @param originalColor - The hex color to match (the template field's `color`).
|
|
19
20
|
* @returns Applied color, setter, matching elements, and connection status.
|
|
20
21
|
*/
|
|
21
|
-
export declare function useColorBinding(
|
|
22
|
+
export declare function useColorBinding(original: string | ColorToken): ColorBindingResult;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EditorElement } from '../contexts/EditorContext.js';
|
|
2
|
+
import { LayerToken } from '../design/design-builder.js';
|
|
2
3
|
/** Result returned by {@link useFontBinding}. */
|
|
3
4
|
export interface FontBindingResult {
|
|
4
5
|
/** Current font family (from first bound element). Empty string if disconnected. */
|
|
@@ -20,4 +21,4 @@ export interface FontBindingResult {
|
|
|
20
21
|
* @param name - The element name to bind to.
|
|
21
22
|
* @returns Font family, setter, element references, and connection status.
|
|
22
23
|
*/
|
|
23
|
-
export declare function useFontBinding(
|
|
24
|
+
export declare function useFontBinding(layer: string | LayerToken<'text'>): FontBindingResult;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EditorElement } from '../contexts/EditorContext.js';
|
|
2
|
+
import { LayerToken } from '../design/design-builder.js';
|
|
2
3
|
/** How the image fits the element bounds. */
|
|
3
4
|
export type ImageFitMode = 'cover' | 'contain';
|
|
4
5
|
/** Options for {@link useImageBinding}. */
|
|
@@ -31,4 +32,4 @@ export interface ImageBindingResult {
|
|
|
31
32
|
* @param options - Optional configuration (fit mode, etc.).
|
|
32
33
|
* @returns Image URL value, setter, element references, and connection status.
|
|
33
34
|
*/
|
|
34
|
-
export declare function useImageBinding(
|
|
35
|
+
export declare function useImageBinding(layer: string | LayerToken<'image'>, options?: ImageBindingOptions): ImageBindingResult;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EditorElement } from '../contexts/EditorContext.js';
|
|
2
|
+
import { LayerToken } from '../design/design-builder.js';
|
|
2
3
|
/** Result returned by {@link useTextBinding}. */
|
|
3
4
|
export interface TextBindingResult {
|
|
4
5
|
/** Current plain text content (from first bound element). Empty string if disconnected. */
|
|
@@ -23,4 +24,4 @@ export interface TextBindingResult {
|
|
|
23
24
|
* @param name - The element name to bind to.
|
|
24
25
|
* @returns Text value, setter, element references, and connection status.
|
|
25
26
|
*/
|
|
26
|
-
export declare function useTextBinding(
|
|
27
|
+
export declare function useTextBinding(layer: string | LayerToken<'text'>): TextBindingResult;
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { e as u } from "./UnifiedFontService-
|
|
2
|
-
import { C as l, c as x, a as I, b as v, u as A, d as T, f as g, g as B } from "./UnifiedFontService-
|
|
3
|
-
import { E as _, S as y, S as L, u as O, a as M } from "./SnowconeCanvas-
|
|
1
|
+
import { e as u } from "./UnifiedFontService-Bx2MxFfy.js";
|
|
2
|
+
import { C as l, c as x, a as I, b as v, u as A, d as T, f as g, g as B } from "./UnifiedFontService-Bx2MxFfy.js";
|
|
3
|
+
import { E as _, S as y, S as L, u as O, a as M } from "./SnowconeCanvas-4ef4a61J.js";
|
|
4
4
|
import { u as d, a as m } from "./editorErrors-B2mb1sVN.js";
|
|
5
|
-
import { T as z, r as w, u as F, a as D, b as K, c as N, d as V, e as b, f as h, w as U } from "./template-fields-
|
|
6
|
-
import { A as Z, C as G, E as H, M as j, P as k, r as q, v as J } from "./validation-
|
|
7
|
-
import { C as W, D as X, d as $, s as ee } from "./design-builder-
|
|
5
|
+
import { T as z, r as w, u as F, a as D, b as K, c as N, d as V, e as b, f as h, w as U } from "./template-fields-DJ157D3E.js";
|
|
6
|
+
import { A as Z, C as G, E as H, M as j, P as k, r as q, v as J } from "./validation-DnAkXdUg.js";
|
|
7
|
+
import { C as W, D as X, d as $, s as ee } from "./design-builder-U7Su9MMC.js";
|
|
8
8
|
import { c as se, e as te } from "./compose-DtQL_oit.js";
|
|
9
9
|
import { d as oe, m as ie, s as ne, v as ue } from "./CanvasStateV1-DmZ1Qvvn.js";
|
|
10
10
|
function C() {
|