@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.
- package/ERROR_CONTRACT.md +13 -0
- package/STYLING_CONTRACT.md +2 -2
- package/dist/{CanvasRenderer-_lFoIoz5.js → CanvasRenderer-hpJ05JGO.js} +4 -4
- package/dist/{CanvasRenderer-_lFoIoz5.js.map → CanvasRenderer-hpJ05JGO.js.map} +1 -1
- package/dist/{CanvasStateV1-BMxr6xb8.js → CanvasStateV1-jLOibojY.js} +876 -844
- package/dist/{CanvasStateV1-BMxr6xb8.js.map → CanvasStateV1-jLOibojY.js.map} +1 -1
- package/dist/ContextualToolbars-DRbuUE7W.js +6061 -0
- package/dist/ContextualToolbars-DRbuUE7W.js.map +1 -0
- package/dist/{EditorCanvasImpl-BNz8TPFs.js → EditorCanvasImpl-P2GHPNA3.js} +19 -20
- package/dist/{EditorCanvasImpl-BNz8TPFs.js.map → EditorCanvasImpl-P2GHPNA3.js.map} +1 -1
- package/dist/{ExportManager-B8Td7uR5.js → ExportManager-Bkzzyxgw.js} +973 -576
- package/dist/ExportManager-Bkzzyxgw.js.map +1 -0
- package/dist/{FontAnalyzer-D4Sg-P6_.js → FontAnalyzer-BYhwxDhe.js} +542 -477
- package/dist/FontAnalyzer-BYhwxDhe.js.map +1 -0
- package/dist/{ImagePanel-CN2Bu3hf.js → ImagePanel-CEr0_FYy.js} +38 -38
- package/dist/{ImagePanel-CN2Bu3hf.js.map → ImagePanel-CEr0_FYy.js.map} +1 -1
- package/dist/SnowconeCanvas-Fa0isFpO.js +1192 -0
- package/dist/SnowconeCanvas-Fa0isFpO.js.map +1 -0
- package/dist/advanced.mjs +14 -14
- package/dist/api/embed.d.ts +2 -0
- package/dist/api/stable.d.ts +2 -0
- package/dist/components/CanvasContextMenu.d.ts +15 -0
- package/dist/components/CanvasEditor/hooks/useCanvasInteraction.d.ts +27 -0
- package/dist/components/CanvasEditor.d.ts +8 -0
- package/dist/components/ImageToolbar.d.ts +4 -0
- package/dist/components/embed/SnowconeCanvas.d.ts +13 -0
- package/dist/components/embed/kernel.d.ts +8 -0
- package/dist/components/toolbars/EmbeddedToolbarLayout.d.ts +2 -0
- package/dist/components/toolbars/SecondaryPanels.d.ts +17 -1
- package/dist/components/toolbars/index.d.ts +2 -2
- package/dist/components/ui/SliderRow.d.ts +6 -0
- package/dist/components/ui/icons.d.ts +2 -0
- package/dist/components/ui/toolbar-button.d.ts +2 -2
- package/dist/contexts/CanvasServicesContext.d.ts +17 -0
- package/dist/contexts/EditorContext.d.ts +7 -0
- package/dist/core/image-adjustments.d.ts +32 -0
- package/dist/{custom-icons-B5TRC1Ed.js → custom-icons-Co4rcW0S.js} +7 -7
- package/dist/{custom-icons-B5TRC1Ed.js.map → custom-icons-Co4rcW0S.js.map} +1 -1
- package/dist/design-builder-CBG2hKc8.js +1672 -0
- package/dist/design-builder-CBG2hKc8.js.map +1 -0
- package/dist/{embed-BTRtoktw.js → embed-D4TIzO7g.js} +20 -20
- package/dist/{embed-BTRtoktw.js.map → embed-D4TIzO7g.js.map} +1 -1
- package/dist/embed.mjs +51 -46
- package/dist/embed.mjs.map +1 -1
- package/dist/errors/editorError.d.ts +8 -0
- package/dist/{guards-uQtEQJbs.js → guards-DgZuwVgu.js} +2 -2
- package/dist/{guards-uQtEQJbs.js.map → guards-DgZuwVgu.js.map} +1 -1
- package/dist/hooks/elementPatch.d.ts +7 -2
- package/dist/hooks/useKeyboardShortcuts.d.ts +15 -2
- package/dist/hooks/useLayers.d.ts +2 -0
- package/dist/index.mjs +57 -52
- package/dist/index.mjs.map +1 -1
- package/dist/internals.mjs +201 -132
- package/dist/internals.mjs.map +1 -1
- package/dist/rendering/element-painters.d.ts +0 -13
- package/dist/rendering/element-serializer.d.ts +3 -1
- package/dist/rendering/image-adjustments.d.ts +24 -0
- package/dist/rendering/renderer-types.d.ts +8 -1
- package/dist/state/CanvasStateV1.d.ts +36 -3
- package/dist/state/index.d.ts +2 -2
- package/dist/template-fields-CvFcr5zy.js +505 -0
- package/dist/template-fields-CvFcr5zy.js.map +1 -0
- package/dist/testing.mjs +46 -47
- package/dist/testing.mjs.map +1 -1
- package/dist/types/index.d.ts +21 -0
- package/dist/{UnifiedFontService-CgYnYTj7.js → useCommands-bPXY9rCh.js} +2429 -2145
- package/dist/useCommands-bPXY9rCh.js.map +1 -0
- package/dist/{usePieceGuideBundle-CTQszfKA.js → usePieceGuideBundle-Bj98nPk0.js} +2 -2
- package/dist/{usePieceGuideBundle-CTQszfKA.js.map → usePieceGuideBundle-Bj98nPk0.js.map} +1 -1
- package/dist/utils/custom-fonts.d.ts +99 -0
- package/dist/utils/featureApplied.d.ts +2 -0
- package/dist/validation-CsTlSvJJ.js +8686 -0
- package/dist/validation-CsTlSvJJ.js.map +1 -0
- package/dist/workers/export-protocol.d.ts +13 -0
- package/dist/workers/export-worker.bundle.string.d.ts +1 -1
- package/example/package.json +1 -1
- package/package.json +1 -1
- package/dist/ContextualToolbars-0jWvnQgp.js +0 -5833
- package/dist/ContextualToolbars-0jWvnQgp.js.map +0 -1
- package/dist/ExportManager-B8Td7uR5.js.map +0 -1
- package/dist/FontAnalyzer-D4Sg-P6_.js.map +0 -1
- package/dist/SnowconeCanvas-CR_LdRFP.js +0 -1173
- package/dist/SnowconeCanvas-CR_LdRFP.js.map +0 -1
- package/dist/UnifiedFontService-CgYnYTj7.js.map +0 -1
- package/dist/design-builder-COj0zkxu.js +0 -470
- package/dist/design-builder-COj0zkxu.js.map +0 -1
- package/dist/editorErrors-CCvoKj_P.js +0 -1219
- package/dist/editorErrors-CCvoKj_P.js.map +0 -1
- package/dist/template-fields-BLRp84Ny.js +0 -716
- package/dist/template-fields-BLRp84Ny.js.map +0 -1
- package/dist/validation-eCebhplp.js +0 -8402
- package/dist/validation-eCebhplp.js.map +0 -1
package/dist/embed.mjs
CHANGED
|
@@ -1,54 +1,59 @@
|
|
|
1
|
-
import { C as a, a as
|
|
2
|
-
import { E as
|
|
3
|
-
import {
|
|
4
|
-
import { D as
|
|
5
|
-
import { D as
|
|
6
|
-
import {
|
|
1
|
+
import { C as a, a as t, b as r, A as o, F as i, G as n, H as d, J as m, K as u, u as l, d as E, f as c, g as p, h as g } from "./useCommands-bPXY9rCh.js";
|
|
2
|
+
import { E as S, R as f, a as C, b as T, S as F, c as v, d as y, f as P, p as b, e as B, g as R, h, v as D } from "./embed-D4TIzO7g.js";
|
|
3
|
+
import { E as L, y as k } from "./FontAnalyzer-BYhwxDhe.js";
|
|
4
|
+
import { D as A, d as G, j as K, i as M, u as _ } from "./design-builder-CBG2hKc8.js";
|
|
5
|
+
import { D as z, T as H, r as J, u as N, a as Y, b as q, c as O, d as Q, e as U, w as V } from "./template-fields-CvFcr5zy.js";
|
|
6
|
+
import { c as X, e as Z, l as $, r as ee } from "./ExportManager-Bkzzyxgw.js";
|
|
7
|
+
import { s as ae } from "./CanvasStateV1-jLOibojY.js";
|
|
7
8
|
export {
|
|
8
9
|
a as CanvasServicesProvider,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
10
|
+
A as DesignBuilder,
|
|
11
|
+
z as DesignStateStore,
|
|
12
|
+
S as Editor,
|
|
13
|
+
L as EditorError,
|
|
14
|
+
f as RealtimeCanvas,
|
|
15
|
+
C as RealtimeEmbed,
|
|
16
|
+
T as RealtimeMockup,
|
|
17
|
+
F as SnowconeEditor,
|
|
18
|
+
H as TEMPLATE_FIELDS_KEY,
|
|
19
|
+
v as auditEditor,
|
|
20
|
+
y as collectEmbedIssues,
|
|
21
|
+
t as createProxyGenerate,
|
|
22
|
+
r as createProxyImageSearch,
|
|
23
|
+
X as customFontRegistry,
|
|
24
|
+
G as design,
|
|
25
|
+
o as editorElementKind,
|
|
26
|
+
Z as ensureCustomFontsLoaded,
|
|
27
|
+
P as formatBuyPrice,
|
|
28
|
+
K as isColorToken,
|
|
29
|
+
k as isEditorError,
|
|
30
|
+
i as isGroupElement,
|
|
31
|
+
n as isImageElement,
|
|
32
|
+
M as isLayerToken,
|
|
33
|
+
d as isPathElement,
|
|
34
|
+
m as isShapeElement,
|
|
35
|
+
u as isTextElement,
|
|
36
|
+
$ as loadCustomFont,
|
|
37
|
+
b as productToRenderConfig,
|
|
38
|
+
J as readTemplateFields,
|
|
39
|
+
ee as registerCustomFonts,
|
|
40
|
+
ae as serializeState,
|
|
41
|
+
l as useArtboards,
|
|
42
|
+
E as useCanvasServices,
|
|
43
|
+
N as useColorBinding,
|
|
44
|
+
c as useCommands,
|
|
45
|
+
_ as useEditor,
|
|
46
|
+
Y as useElementByName,
|
|
47
|
+
p as useExport,
|
|
48
|
+
q as useFontBinding,
|
|
44
49
|
O as useImageBinding,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
50
|
+
g as useLayers,
|
|
51
|
+
B as usePlacements,
|
|
52
|
+
R as useProductSelection,
|
|
53
|
+
h as useRealtimeMockups,
|
|
49
54
|
Q as useSelectedElement,
|
|
50
55
|
U as useTextBinding,
|
|
51
|
-
|
|
56
|
+
D as validateEmbed,
|
|
52
57
|
V as withTemplateFields
|
|
53
58
|
};
|
|
54
59
|
//# sourceMappingURL=embed.mjs.map
|
package/dist/embed.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embed.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"embed.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
|
@@ -88,6 +88,14 @@ export type EditorErrorCode =
|
|
|
88
88
|
/** `auditEditor()` called with no `<Editor.Root>` mounted — the imperative
|
|
89
89
|
* audit reads the most-recent mounted Root's registry (#10). */
|
|
90
90
|
| 'E_AUDIT_NO_ROOT'
|
|
91
|
+
/** A custom (brand) font failed to load from its hosted URL — the binary
|
|
92
|
+
* fetch failed (CORS, 404, network) or FontFace rejected the bytes.
|
|
93
|
+
* Custom fonts NEVER fall back silently to a system face: the design
|
|
94
|
+
* would render with a different typeface/metrics everywhere it's
|
|
95
|
+
* consumed. `data` carries `family`, `url`, `weight`, `style`. Fix the
|
|
96
|
+
* URL (must serve the font file over a plain cross-origin GET) and
|
|
97
|
+
* re-register. Dev AND prod. */
|
|
98
|
+
| 'E_FONT_LOAD_FAILED'
|
|
91
99
|
/** `computeDistribute()` called with fewer than 3 movable elements —
|
|
92
100
|
* distributing needs something between the two ends. Gate the action on
|
|
93
101
|
* `useAlignDistribute().canDistribute` instead of calling below the
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as n, I as t, P as a, S as s, T as i } from "./FontAnalyzer-
|
|
1
|
+
import { G as n, I as t, P as a, S as s, T as i } from "./FontAnalyzer-BYhwxDhe.js";
|
|
2
2
|
function r(e) {
|
|
3
3
|
return e instanceof i;
|
|
4
4
|
}
|
|
@@ -21,4 +21,4 @@ export {
|
|
|
21
21
|
r as d,
|
|
22
22
|
u as i
|
|
23
23
|
};
|
|
24
|
-
//# sourceMappingURL=guards-
|
|
24
|
+
//# sourceMappingURL=guards-DgZuwVgu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guards-
|
|
1
|
+
{"version":3,"file":"guards-DgZuwVgu.js","sources":["../src/types/guards.ts"],"sourcesContent":["/**\n * Type guards for EditorElement discrimination\n *\n * These guards use instanceof checks against the concrete element classes,\n * matching the pattern established in EditorContext.tsx. They accept\n * BaseElement | EditorElement | undefined | null for maximum flexibility\n * at call sites.\n */\n\nimport { BaseElement } from '../core/BaseElement.js';\nimport { TextElement } from '../core/TextElement.js';\nimport { ImageElement } from '../core/ImageElement.js';\nimport { GroupElement } from '../core/GroupElement.js';\nimport { ShapeElement } from '../core/ShapeElement.js';\nimport { PathElement } from '../core/PathElement.js';\n\ntype Narrowable = BaseElement | TextElement | ImageElement | GroupElement | ShapeElement | PathElement | undefined | null;\n\n/**\n * Type guard: checks if an element is a TextElement (or any text-based transform subclass).\n *\n * TextElement is the base class for all text transforms (custom, circle, arch, wave, etc.),\n * so this returns true for any text-based element regardless of its specific transformType.\n */\nexport function isTextElement(element: Narrowable): element is TextElement {\n return element instanceof TextElement;\n}\n\n/**\n * Type guard: checks if an element is an ImageElement.\n */\nexport function isImageElement(element: Narrowable): element is ImageElement {\n return element instanceof ImageElement;\n}\n\n/**\n * Type guard: checks if an element is a GroupElement.\n */\nexport function isGroupElement(element: Narrowable): element is GroupElement {\n return element instanceof GroupElement;\n}\n\n/**\n * Type guard: checks if an element is a ShapeElement.\n */\nexport function isShapeElement(element: Narrowable): element is ShapeElement {\n return element instanceof ShapeElement;\n}\n\n/**\n * Type guard: checks if an element is a PathElement.\n */\nexport function isPathElement(element: Narrowable): element is PathElement {\n return element instanceof PathElement;\n}\n"],"names":["isTextElement","element","TextElement","isImageElement","ImageElement","isGroupElement","GroupElement","isShapeElement","ShapeElement","isPathElement","PathElement"],"mappings":";AAwBO,SAASA,EAAcC,GAA6C;AACzE,SAAOA,aAAmBC;AAC5B;AAKO,SAASC,EAAeF,GAA8C;AAC3E,SAAOA,aAAmBG;AAC5B;AAKO,SAASC,EAAeJ,GAA8C;AAC3E,SAAOA,aAAmBK;AAC5B;AAKO,SAASC,EAAeN,GAA8C;AAC3E,SAAOA,aAAmBO;AAC5B;AAKO,SAASC,EAAcR,GAA6C;AACzE,SAAOA,aAAmBS;AAC5B;"}
|
|
@@ -2,7 +2,7 @@ import { LayerToken } from '../design/design-builder.js';
|
|
|
2
2
|
import { EditorElementKind } from '../core/elementGuards.js';
|
|
3
3
|
import { ElementStore } from '../core/ElementStore.js';
|
|
4
4
|
import { EditorElement } from '../contexts/EditorContext.js';
|
|
5
|
-
import { TextAlign } from '../types/index.js';
|
|
5
|
+
import { TextAlign, ImageAdjustments } from '../types/index.js';
|
|
6
6
|
/**
|
|
7
7
|
* A serializable element patch for {@link UseCommandsReturn.updateElement}.
|
|
8
8
|
*
|
|
@@ -15,7 +15,7 @@ import { TextAlign } from '../types/index.js';
|
|
|
15
15
|
* | `x`, `y`, `rotation`, `opacity`, `name`, `visible`, `locked` | every kind |
|
|
16
16
|
* | `text`, `fontSize`, `color`, `fontFamily`, `bold`, `italic`, `textAlign` | text |
|
|
17
17
|
* | `fillColor`, `width`, `height` | shape |
|
|
18
|
-
* | `imageUrl`, `width`, `height` | image |
|
|
18
|
+
* | `imageUrl`, `width`, `height`, `adjustments` | image |
|
|
19
19
|
*/
|
|
20
20
|
export interface ElementPatch {
|
|
21
21
|
/** Center x in artboard coordinates. Any kind. */
|
|
@@ -56,6 +56,11 @@ export interface ElementPatch {
|
|
|
56
56
|
* Combined with explicit `width`/`height` the frame is preserved;
|
|
57
57
|
* otherwise the frame height re-fits the loaded aspect ratio. */
|
|
58
58
|
imageUrl?: string;
|
|
59
|
+
/** Brightness/contrast/saturation multipliers (each 0..3, 1 = neutral —
|
|
60
|
+
* e.g. "warmer/brighter photo" ≈ `{ brightness: 1.1, contrast: 1, saturation: 1.2 }`).
|
|
61
|
+
* Passing all-neutral `{1, 1, 1}` RESETS (the stored neutral state is the
|
|
62
|
+
* absence of adjustments). Image elements only. */
|
|
63
|
+
adjustments?: ImageAdjustments;
|
|
59
64
|
}
|
|
60
65
|
/** Options for {@link UseCommandsReturn.updateElement}. */
|
|
61
66
|
export interface UpdateElementOptions {
|
|
@@ -1,7 +1,20 @@
|
|
|
1
|
+
import { useEditor } from '../contexts/EditorContext.js';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
3
|
+
* Select every element on the ACTIVE artboard (multi-selection).
|
|
4
|
+
*
|
|
5
|
+
* Shared implementation behind Cmd/Ctrl+A AND the canvas context menu's
|
|
6
|
+
* "Select All" entry — one definition so the two surfaces can't drift.
|
|
7
|
+
* Locked elements are included — locking gates manipulation, not selection
|
|
8
|
+
* (gotcha #20); hidden elements are skipped to mirror marquee selection.
|
|
9
|
+
* Same state path as marquee selection: the multi-selection array is the
|
|
10
|
+
* source of truth; single selection is cleared alongside it.
|
|
4
11
|
*/
|
|
12
|
+
export declare function selectAllOnActiveArtboard(opts: {
|
|
13
|
+
elements: ReturnType<typeof useEditor>['elements'];
|
|
14
|
+
artboardManager: ReturnType<typeof useEditor>['artboardManager'];
|
|
15
|
+
handleSelectionChange: (id: string | null) => void;
|
|
16
|
+
setMultiSelection: (ids: string[]) => void;
|
|
17
|
+
}): void;
|
|
5
18
|
/**
|
|
6
19
|
* Hook that sets up keyboard shortcuts for the editor
|
|
7
20
|
* Handles copy/paste, delete, undo/redo, and other shortcuts
|
|
@@ -40,6 +40,8 @@ export interface UseLayersReturn {
|
|
|
40
40
|
reorderWithinGroup: (draggedId: string, targetId: string, position: 'before' | 'after', groupId: string) => void;
|
|
41
41
|
moveLayerForward: (id: string) => void;
|
|
42
42
|
moveLayerBackward: (id: string) => void;
|
|
43
|
+
bringToFront: (id: string) => void;
|
|
44
|
+
sendToBack: (id: string) => void;
|
|
43
45
|
groupLayers: (ids: string[]) => void;
|
|
44
46
|
ungroupLayer: (id: string) => void;
|
|
45
47
|
addToGroup: (elementId: string, groupId: string) => void;
|
package/dist/index.mjs
CHANGED
|
@@ -1,64 +1,69 @@
|
|
|
1
|
-
import { e as u } from "./
|
|
2
|
-
import { C as
|
|
3
|
-
import { E as
|
|
4
|
-
import { u as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { C as W,
|
|
8
|
-
import { c as
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { e as u } from "./useCommands-bPXY9rCh.js";
|
|
2
|
+
import { C as p, c as x, a as I, b as v, u as A, d as g, f as T, g as B, h as P } from "./useCommands-bPXY9rCh.js";
|
|
3
|
+
import { E as F, S as L, S as _, u as O, a as R } from "./SnowconeCanvas-Fa0isFpO.js";
|
|
4
|
+
import { u as m, a as d } from "./design-builder-CBG2hKc8.js";
|
|
5
|
+
import { C as z, D as w, d as D, s as K } from "./design-builder-CBG2hKc8.js";
|
|
6
|
+
import { T as V, r as b, u as h, a as U, b as Y, c as Z, d as G, e as H, w as j } from "./template-fields-CvFcr5zy.js";
|
|
7
|
+
import { A as q, C as J, E as Q, M as W, P as X, r as $, v as ee } from "./validation-CsTlSvJJ.js";
|
|
8
|
+
import { c as ae, e as te, l as oe, r as re } from "./ExportManager-Bkzzyxgw.js";
|
|
9
|
+
import { c as ie, e as ue } from "./compose-DtQL_oit.js";
|
|
10
|
+
import { d as de, m as Ce, s as Se, v as Ee } from "./CanvasStateV1-jLOibojY.js";
|
|
11
|
+
function E() {
|
|
12
|
+
const { isCanvasReady: e } = m();
|
|
12
13
|
return e;
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
-
const { zoom: e, panOffset:
|
|
16
|
-
return { zoom: e, panOffset:
|
|
15
|
+
function c() {
|
|
16
|
+
const { zoom: e, panOffset: s, zoomIn: a, zoomOut: t, zoomToFit: o, resetView: r, setZoom: n, setPanOffset: i } = d();
|
|
17
|
+
return { zoom: e, panOffset: s, zoomIn: a, zoomOut: t, zoomToFit: o, resetView: r, setZoom: n, setPanOffset: i };
|
|
17
18
|
}
|
|
18
19
|
u();
|
|
19
20
|
export {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
21
|
+
q as ALL_CAPABILITIES,
|
|
22
|
+
z as CANVAS_STATE_SCHEMA_VERSION,
|
|
23
|
+
J as COMPACT_CUSTOMIZER,
|
|
24
|
+
p as CanvasServicesProvider,
|
|
25
|
+
w as DesignBuilder,
|
|
26
|
+
Q as EMBED_ONLY,
|
|
27
|
+
F as ErrorBoundary,
|
|
28
|
+
W as MINIMAL_CAPABILITIES,
|
|
29
|
+
X as PRO_STUDIO,
|
|
30
|
+
L as SnowconeCanvas,
|
|
31
|
+
V as TEMPLATE_FIELDS_KEY,
|
|
32
|
+
ie as createKit,
|
|
32
33
|
x as createProxyBgRemove,
|
|
33
34
|
I as createProxyGenerate,
|
|
34
35
|
v as createProxyImageSearch,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
ae as customFontRegistry,
|
|
37
|
+
_ as default,
|
|
38
|
+
de as deserializeState,
|
|
39
|
+
D as design,
|
|
40
|
+
te as ensureCustomFontsLoaded,
|
|
41
|
+
ue as extendKit,
|
|
42
|
+
oe as loadCustomFont,
|
|
43
|
+
Ce as migrateState,
|
|
44
|
+
b as readTemplateFields,
|
|
45
|
+
re as registerCustomFonts,
|
|
46
|
+
$ as resolveKit,
|
|
47
|
+
Se as serializeState,
|
|
48
|
+
K as serializeStateForServer,
|
|
44
49
|
A as useArtboards,
|
|
45
50
|
O as useAutoExport,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
51
|
+
E as useCanvasReady,
|
|
52
|
+
g as useCanvasServices,
|
|
53
|
+
h as useColorBinding,
|
|
54
|
+
T as useCommands,
|
|
55
|
+
R as useContentReady,
|
|
56
|
+
m as useEditor,
|
|
57
|
+
U as useElementByName,
|
|
58
|
+
B as useExport,
|
|
59
|
+
Y as useFontBinding,
|
|
60
|
+
Z as useImageBinding,
|
|
61
|
+
P as useLayers,
|
|
62
|
+
G as useSelectedElement,
|
|
63
|
+
H as useTextBinding,
|
|
64
|
+
c as useViewport,
|
|
65
|
+
ee as validateKit,
|
|
66
|
+
Ee as validateState,
|
|
67
|
+
j as withTemplateFields
|
|
63
68
|
};
|
|
64
69
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/hooks/useCanvasReady.ts","../src/hooks/useViewport.ts"],"sourcesContent":["import { useEditor } from '../contexts/EditorContext.js';\n\n/**\n * Returns whether the canvas is fully initialized and ready for operations.\n *\n * The canvas is not ready until the underlying `<canvas>` element is mounted\n * and the editor has completed its initial setup. Use this to gate operations\n * like export or programmatic element manipulation that require a live canvas.\n *\n * @returns `true` when the canvas is mounted and ready, `false` otherwise.\n *\n * @example\n * ```tsx\n * function ExportButton() {\n * const ready = useCanvasReady();\n * return (\n * <button disabled={!ready} onClick={handleExport}>\n * Export PNG\n * </button>\n * );\n * }\n * ```\n */\nexport function useCanvasReady(): boolean {\n const { isCanvasReady } = useEditor();\n return isCanvasReady;\n}\n","import React from 'react';\nimport { useViewportContext } from '../contexts/ViewportContext.js';\nimport type { PanOffset } from '../contexts/ViewportContext.js';\n\n/**\n * Return type for {@link useViewport}.\n */\nexport interface UseViewportReturn {\n /** Current zoom level (1.0 = 100%) */\n zoom: number;\n /** Current pan offset in world coordinates */\n panOffset: PanOffset;\n /** Increment zoom by one step */\n zoomIn: () => void;\n /** Decrement zoom by one step */\n zoomOut: () => void;\n /** Zoom to fit the active artboard in the viewport */\n zoomToFit: () => void;\n /** Reset zoom to 100% and pan offset to origin */\n resetView: () => void;\n /** Set zoom to an exact value */\n setZoom: React.Dispatch<React.SetStateAction<number>>;\n /** Set pan offset to an exact value */\n setPanOffset: React.Dispatch<React.SetStateAction<PanOffset>>;\n}\n\n/**\n * Returns viewport state (zoom, pan) and control functions.\n *\n * This hook now reads directly from ViewportContext (instead of the full\n * EditorContext), so components using it will only re-render when viewport\n * state changes -- not when elements, selection, or other state changes.\n *\n * @example\n * ```tsx\n * function ZoomBar() {\n * const { zoom, zoomIn, zoomOut, zoomToFit } = useViewport();\n * return (\n * <div>\n * <button onClick={zoomOut}>-</button>\n * <span>{Math.round(zoom * 100)}%</span>\n * <button onClick={zoomIn}>+</button>\n * <button onClick={zoomToFit}>Fit</button>\n * </div>\n * );\n * }\n * ```\n */\nexport function useViewport(): UseViewportReturn {\n const { zoom, panOffset, zoomIn, zoomOut, zoomToFit, resetView, setZoom, setPanOffset } = useViewportContext();\n return { zoom, panOffset, zoomIn, zoomOut, zoomToFit, resetView, setZoom, setPanOffset };\n}\n"],"names":["useCanvasReady","isCanvasReady","useEditor","useViewport","zoom","panOffset","zoomIn","zoomOut","zoomToFit","resetView","setZoom","setPanOffset","useViewportContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/hooks/useCanvasReady.ts","../src/hooks/useViewport.ts"],"sourcesContent":["import { useEditor } from '../contexts/EditorContext.js';\n\n/**\n * Returns whether the canvas is fully initialized and ready for operations.\n *\n * The canvas is not ready until the underlying `<canvas>` element is mounted\n * and the editor has completed its initial setup. Use this to gate operations\n * like export or programmatic element manipulation that require a live canvas.\n *\n * @returns `true` when the canvas is mounted and ready, `false` otherwise.\n *\n * @example\n * ```tsx\n * function ExportButton() {\n * const ready = useCanvasReady();\n * return (\n * <button disabled={!ready} onClick={handleExport}>\n * Export PNG\n * </button>\n * );\n * }\n * ```\n */\nexport function useCanvasReady(): boolean {\n const { isCanvasReady } = useEditor();\n return isCanvasReady;\n}\n","import React from 'react';\nimport { useViewportContext } from '../contexts/ViewportContext.js';\nimport type { PanOffset } from '../contexts/ViewportContext.js';\n\n/**\n * Return type for {@link useViewport}.\n */\nexport interface UseViewportReturn {\n /** Current zoom level (1.0 = 100%) */\n zoom: number;\n /** Current pan offset in world coordinates */\n panOffset: PanOffset;\n /** Increment zoom by one step */\n zoomIn: () => void;\n /** Decrement zoom by one step */\n zoomOut: () => void;\n /** Zoom to fit the active artboard in the viewport */\n zoomToFit: () => void;\n /** Reset zoom to 100% and pan offset to origin */\n resetView: () => void;\n /** Set zoom to an exact value */\n setZoom: React.Dispatch<React.SetStateAction<number>>;\n /** Set pan offset to an exact value */\n setPanOffset: React.Dispatch<React.SetStateAction<PanOffset>>;\n}\n\n/**\n * Returns viewport state (zoom, pan) and control functions.\n *\n * This hook now reads directly from ViewportContext (instead of the full\n * EditorContext), so components using it will only re-render when viewport\n * state changes -- not when elements, selection, or other state changes.\n *\n * @example\n * ```tsx\n * function ZoomBar() {\n * const { zoom, zoomIn, zoomOut, zoomToFit } = useViewport();\n * return (\n * <div>\n * <button onClick={zoomOut}>-</button>\n * <span>{Math.round(zoom * 100)}%</span>\n * <button onClick={zoomIn}>+</button>\n * <button onClick={zoomToFit}>Fit</button>\n * </div>\n * );\n * }\n * ```\n */\nexport function useViewport(): UseViewportReturn {\n const { zoom, panOffset, zoomIn, zoomOut, zoomToFit, resetView, setZoom, setPanOffset } = useViewportContext();\n return { zoom, panOffset, zoomIn, zoomOut, zoomToFit, resetView, setZoom, setPanOffset };\n}\n"],"names":["useCanvasReady","isCanvasReady","useEditor","useViewport","zoom","panOffset","zoomIn","zoomOut","zoomToFit","resetView","setZoom","setPanOffset","useViewportContext"],"mappings":";;;;;;;;;;AAuBO,SAASA,IAA0B;AACxC,QAAM,EAAE,eAAAC,EAAA,IAAkBC,EAAA;AAC1B,SAAOD;AACT;ACsBO,SAASE,IAAiC;AAC/C,QAAM,EAAE,MAAAC,GAAM,WAAAC,GAAW,QAAAC,GAAQ,SAAAC,GAAS,WAAAC,GAAW,WAAAC,GAAW,SAAAC,GAAS,cAAAC,EAAA,IAAiBC,EAAA;AAC1F,SAAO,EAAE,MAAAR,GAAM,WAAAC,GAAW,QAAAC,GAAQ,SAAAC,GAAS,WAAAC,GAAW,WAAAC,GAAW,SAAAC,GAAS,cAAAC,EAAA;AAC5E;;"}
|