@snowcone-app/canvas 0.43.7 → 0.44.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/dist/{CanvasRenderer-DIug_mjX.js → CanvasRenderer-B8BADU_r.js} +876 -830
- package/dist/CanvasRenderer-B8BADU_r.js.map +1 -0
- package/dist/{CanvasStateV1-BWd358xJ.js → CanvasStateV1-BlDWgOzV.js} +3 -3
- package/dist/{CanvasStateV1-BWd358xJ.js.map → CanvasStateV1-BlDWgOzV.js.map} +1 -1
- package/dist/ContextualToolbars-rCZo-KCm.js +6808 -0
- package/dist/ContextualToolbars-rCZo-KCm.js.map +1 -0
- package/dist/EditorCanvasImpl-C63QS2OK.js +144 -0
- package/dist/EditorCanvasImpl-C63QS2OK.js.map +1 -0
- package/dist/{ExportManager-BDH9jW4Q.js → ExportManager-xRsXgyNo.js} +2 -2
- package/dist/{ExportManager-BDH9jW4Q.js.map → ExportManager-xRsXgyNo.js.map} +1 -1
- package/dist/{FontAnalyzer-CyhywbAM.js → FontAnalyzer-Ds3Wdba7.js} +239 -236
- package/dist/FontAnalyzer-Ds3Wdba7.js.map +1 -0
- package/dist/{ImagePanel-CIGpLY3B.js → ImagePanel-DhOWKvIN.js} +6 -6
- package/dist/{ImagePanel-CIGpLY3B.js.map → ImagePanel-DhOWKvIN.js.map} +1 -1
- package/dist/{SnowconeCanvas-Bs34CUv5.js → SnowconeCanvas-C-AGGT44.js} +478 -465
- package/dist/SnowconeCanvas-C-AGGT44.js.map +1 -0
- package/dist/adjust-CDVzlVBY.js +145 -0
- package/dist/adjust-CDVzlVBY.js.map +1 -0
- package/dist/advanced.mjs +15 -15
- package/dist/api/stable.d.ts +2 -0
- package/dist/components/ImageToolbar.d.ts +3 -0
- package/dist/components/ShapeToolbar.d.ts +2 -0
- package/dist/components/TextToolbar.d.ts +2 -1
- package/dist/components/embed/SnowconeCanvas.d.ts +8 -0
- package/dist/components/toolbars/SecondaryPanels.d.ts +24 -0
- package/dist/components/toolbars/index.d.ts +2 -2
- package/dist/core/ArtboardElement.d.ts +2 -0
- package/dist/core/CanvasRenderer.d.ts +3 -1
- package/dist/core/pickOrder.d.ts +4 -0
- package/dist/{custom-icons-sT5sNRcG.js → custom-icons-C4bzABm2.js} +2 -2
- package/dist/{custom-icons-sT5sNRcG.js.map → custom-icons-C4bzABm2.js.map} +1 -1
- package/dist/{design-builder-CwfefZJC.js → design-builder-DCHVrEFV.js} +315 -314
- package/dist/design-builder-DCHVrEFV.js.map +1 -0
- package/dist/{embed-BcYaDLRo.js → embed-DnjyfavG.js} +10 -10
- package/dist/{embed-BcYaDLRo.js.map → embed-DnjyfavG.js.map} +1 -1
- package/dist/embed.mjs +19 -19
- package/dist/engrave/EngraveSync.d.ts +5 -0
- package/dist/engrave/adjust.d.ts +36 -0
- package/dist/engrave/makeEngraved.d.ts +23 -0
- package/dist/engrave/types.d.ts +33 -0
- package/dist/{guards-Dvw7Qch0.js → guards-DwYEoqcn.js} +2 -2
- package/dist/{guards-Dvw7Qch0.js.map → guards-DwYEoqcn.js.map} +1 -1
- package/dist/index.mjs +57 -54
- package/dist/index.mjs.map +1 -1
- package/dist/internals.mjs +6 -6
- package/dist/rendering/EngraveViewRenderer.d.ts +15 -0
- package/dist/{template-fields-DF1ijCl9.js → template-fields-CK7Uvvc8.js} +5 -5
- package/dist/{template-fields-DF1ijCl9.js.map → template-fields-CK7Uvvc8.js.map} +1 -1
- package/dist/testing.mjs +3 -3
- package/dist/types/index.d.ts +5 -0
- package/dist/{useCommands-wwGeWCn6.js → useCommands-BrkGKdXr.js} +7 -7
- package/dist/{useCommands-wwGeWCn6.js.map → useCommands-BrkGKdXr.js.map} +1 -1
- package/dist/{usePieceGuideBundle-BWQINIJR.js → usePieceGuideBundle-BWdobHQE.js} +2 -2
- package/dist/{usePieceGuideBundle-BWQINIJR.js.map → usePieceGuideBundle-BWdobHQE.js.map} +1 -1
- package/dist/{validation-B6sLZULE.js → validation-DETfj7tg.js} +2923 -2906
- package/dist/validation-DETfj7tg.js.map +1 -0
- package/example/package.json +1 -1
- package/package.json +3 -3
- package/dist/CanvasRenderer-DIug_mjX.js.map +0 -1
- package/dist/ContextualToolbars-CspkC1T3.js +0 -6604
- package/dist/ContextualToolbars-CspkC1T3.js.map +0 -1
- package/dist/EditorCanvasImpl-DpssZT6w.js +0 -144
- package/dist/EditorCanvasImpl-DpssZT6w.js.map +0 -1
- package/dist/FontAnalyzer-CyhywbAM.js.map +0 -1
- package/dist/SnowconeCanvas-Bs34CUv5.js.map +0 -1
- package/dist/design-builder-CwfefZJC.js.map +0 -1
- package/dist/validation-B6sLZULE.js.map +0 -1
package/dist/embed.mjs
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { C as a, g as t, h as o, K as r, N as i, O as n, P as d, Q as m, R as u, b as l, a as E, j as c, k as p, l as g } from "./useCommands-
|
|
2
|
-
import { E as x, R as C, a as S, b as T, S as P, c as R, d as b, e as B, f as v, g as y, i as F, h as k, p as h, s as D, j as I, k as K, l as L, v as w } from "./embed-
|
|
3
|
-
import { t as M,
|
|
4
|
-
import { D as N, f as
|
|
5
|
-
import { D as
|
|
6
|
-
import { G as ae, H as te, J as oe, K as re } from "./ExportManager-
|
|
7
|
-
import { s as ne } from "./CanvasStateV1-
|
|
1
|
+
import { C as a, g as t, h as o, K as r, N as i, O as n, P as d, Q as m, R as u, b as l, a as E, j as c, k as p, l as g } from "./useCommands-BrkGKdXr.js";
|
|
2
|
+
import { E as x, R as C, a as S, b as T, S as P, c as R, d as b, e as B, f as v, g as y, i as F, h as k, p as h, s as D, j as I, k as K, l as L, v as w } from "./embed-DnjyfavG.js";
|
|
3
|
+
import { t as M, Z as j } from "./FontAnalyzer-Ds3Wdba7.js";
|
|
4
|
+
import { D as N, f as _, n as z, m as H, b as J } from "./design-builder-DCHVrEFV.js";
|
|
5
|
+
import { D as Q, T as V, r as Y, u as Z, a as q, b as U, c as W, d as X, e as $, w as ee } from "./template-fields-CK7Uvvc8.js";
|
|
6
|
+
import { G as ae, H as te, J as oe, K as re } from "./ExportManager-xRsXgyNo.js";
|
|
7
|
+
import { s as ne } from "./CanvasStateV1-BlDWgOzV.js";
|
|
8
8
|
export {
|
|
9
9
|
a as CanvasServicesProvider,
|
|
10
10
|
N as DesignBuilder,
|
|
11
|
-
|
|
11
|
+
Q as DesignStateStore,
|
|
12
12
|
x as Editor,
|
|
13
13
|
M as EditorError,
|
|
14
14
|
C as RealtimeCanvas,
|
|
15
15
|
S as RealtimeEmbed,
|
|
16
16
|
T as RealtimeMockup,
|
|
17
17
|
P as SnowconeEditor,
|
|
18
|
-
|
|
18
|
+
V as TEMPLATE_FIELDS_KEY,
|
|
19
19
|
R as auditEditor,
|
|
20
20
|
b as bundleToRenderConfig,
|
|
21
21
|
B as bundleVariantToken,
|
|
@@ -23,40 +23,40 @@ export {
|
|
|
23
23
|
t as createProxyGenerate,
|
|
24
24
|
o as createProxyImageSearch,
|
|
25
25
|
ae as customFontRegistry,
|
|
26
|
-
|
|
26
|
+
_ as design,
|
|
27
27
|
r as editorElementKind,
|
|
28
28
|
te as ensureCustomFontsLoaded,
|
|
29
29
|
y as formatBuyPrice,
|
|
30
30
|
F as isBundleProduct,
|
|
31
31
|
k as isBundleRenderProduct,
|
|
32
|
-
|
|
32
|
+
z as isColorToken,
|
|
33
33
|
j as isEditorError,
|
|
34
34
|
i as isGroupElement,
|
|
35
35
|
n as isImageElement,
|
|
36
|
-
|
|
36
|
+
H as isLayerToken,
|
|
37
37
|
d as isPathElement,
|
|
38
38
|
m as isShapeElement,
|
|
39
39
|
u as isTextElement,
|
|
40
40
|
oe as loadCustomFont,
|
|
41
41
|
h as productToRenderConfig,
|
|
42
|
-
|
|
42
|
+
Y as readTemplateFields,
|
|
43
43
|
re as registerCustomFonts,
|
|
44
44
|
ne as serializeState,
|
|
45
45
|
D as splitRoleKey,
|
|
46
46
|
l as useArtboards,
|
|
47
47
|
E as useCanvasServices,
|
|
48
|
-
|
|
48
|
+
Z as useColorBinding,
|
|
49
49
|
c as useCommands,
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
J as useEditor,
|
|
51
|
+
q as useElementByName,
|
|
52
52
|
p as useExport,
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
U as useFontBinding,
|
|
54
|
+
W as useImageBinding,
|
|
55
55
|
g as useLayers,
|
|
56
56
|
I as usePlacements,
|
|
57
57
|
K as useProductSelection,
|
|
58
58
|
L as useRealtimeMockups,
|
|
59
|
-
|
|
59
|
+
X as useSelectedElement,
|
|
60
60
|
$ as useTextBinding,
|
|
61
61
|
w as validateEmbed,
|
|
62
62
|
ee as withTemplateFields
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ImageElement } from '../core/ImageElement.js';
|
|
2
|
+
import { ImageEngraveSettings } from './types.js';
|
|
3
|
+
/** A copy of `el` showing `url`, made with `settings`; `onLoaded` gets the loaded copy. */
|
|
4
|
+
export declare function engravedCopy(el: ImageElement, url: string, settings: ImageEngraveSettings, onLoaded: (e: ImageElement) => void): ImageElement;
|
|
5
|
+
export declare function EngraveSync(): null;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** "original" = the picture as it is (line art, a logo): the shared rule cuts its dark parts, nothing else changes. */
|
|
2
|
+
export type EngraveStyle = 'photo' | 'drawing' | 'solid' | 'original';
|
|
3
|
+
export declare const ENGRAVE_STYLES: readonly EngraveStyle[];
|
|
4
|
+
/**
|
|
5
|
+
* Is this picture already made for a laser: line art or a logo, near black or near white (or clear) almost
|
|
6
|
+
* everywhere? Such a picture lands as "original" (cut as it is); anything with real middle tones (a photo, a painting)
|
|
7
|
+
* lands as "photo" (dots).
|
|
8
|
+
*/
|
|
9
|
+
export declare function isLineArt(src: Rgba): boolean;
|
|
10
|
+
export interface EngraveAdjustOptions {
|
|
11
|
+
style: EngraveStyle;
|
|
12
|
+
/** true = the picture's LIGHT parts are cut (right way round on a dark coat). See cutLightFor. */
|
|
13
|
+
cutLight: boolean;
|
|
14
|
+
/** -1..1: less .. more of the picture cut. 0 = the picture's own balance. */
|
|
15
|
+
amount: number;
|
|
16
|
+
}
|
|
17
|
+
export interface Rgba {
|
|
18
|
+
width: number;
|
|
19
|
+
height: number;
|
|
20
|
+
data: Uint8ClampedArray;
|
|
21
|
+
}
|
|
22
|
+
/** The bare steel a laser leaves (rendercenter compiler/engrave.mjs MATERIALS.steel.color, sRGB codes). */
|
|
23
|
+
export declare const ENGRAVE_STEEL = "#b0b0ad";
|
|
24
|
+
/** sRGB hex -> luma 0..1 (Rec.709 on codes, the cut rule's). Unknown -> null. */
|
|
25
|
+
export declare function hexLuma(hex: string | null | undefined): number | null;
|
|
26
|
+
/**
|
|
27
|
+
* Whether a picture should cut its LIGHT parts: yes when what the laser leaves is lighter than the surface (bare steel
|
|
28
|
+
* on a dark coat), no when it is darker (a burn on wood, steel on a white coat). The picture then reads the right way round.
|
|
29
|
+
*/
|
|
30
|
+
export declare function cutLightFor(coatHex: string | null | undefined, cutHex?: string): boolean;
|
|
31
|
+
/** The laser's thinnest line in px of an area drawn at `dpi` (an engraved area's artboard is 300 dpi px). */
|
|
32
|
+
export declare function minLinePxAt(dpi: number): number;
|
|
33
|
+
/** `src` (any picture, straight alpha) -> black where cut, clear elsewhere, at the same size. */
|
|
34
|
+
export declare function engraveAdjust(src: Rgba, opts: EngraveAdjustOptions, minLinePx: number): Rgba;
|
|
35
|
+
/** How much of `rgba` the laser cuts, and how much of that is thinner than its line (0..1 each), by the shared rule. */
|
|
36
|
+
export declare function cutShare(rgba: Rgba): number;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { EngraveStyle } from './adjust.js';
|
|
2
|
+
import { ArtboardEngrave, ImageEngraveSettings } from './types.js';
|
|
3
|
+
import { ImageElement } from '../core/ImageElement.js';
|
|
4
|
+
export declare const E_ENGRAVE_PICTURE_LOAD = "E_ENGRAVE_PICTURE_LOAD";
|
|
5
|
+
/** The settings a picture gets when it first lands on an engraved area: dots, the picture's own balance, the coat decides. */
|
|
6
|
+
export declare const DEFAULT_ENGRAVE: {
|
|
7
|
+
style: EngraveStyle;
|
|
8
|
+
amount: number;
|
|
9
|
+
invert: boolean;
|
|
10
|
+
};
|
|
11
|
+
/** Which parts are cut for these settings on this coat. */
|
|
12
|
+
export declare function cutLightOf(invert: boolean, area: ArtboardEngrave): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* The picture `element` shows, made for engraving with `settings` on `area`. The source is `settings.sourceUrl`. The
|
|
15
|
+
* picture is drawn whole at the size it has on the artboard (its box widened by its crop), so its dots and lines keep
|
|
16
|
+
* their size in print.
|
|
17
|
+
*/
|
|
18
|
+
export declare function makeEngravedPicture(element: ImageElement, settings: Omit<ImageEngraveSettings, 'cutLight'>, area: ArtboardEngrave): Promise<{
|
|
19
|
+
url: string;
|
|
20
|
+
settings: ImageEngraveSettings;
|
|
21
|
+
}>;
|
|
22
|
+
/** The style a picture gets when it lands on an engraved area: "original" for line art or a logo, else "photo". */
|
|
23
|
+
export declare function landingStyle(sourceUrl: string): Promise<EngraveStyle>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { EngraveStyle } from './adjust.js';
|
|
2
|
+
/**
|
|
3
|
+
* An ENGRAVED print area (a laser cuts the design into a coated cup or into wood; there is no ink). Host config on an
|
|
4
|
+
* artboard (SnowconeCanvas `artboards[].engrave`): the editor then shows the design as the laser cuts it (bare steel
|
|
5
|
+
* on the coat, lines too thin to cut in red), hides the colour controls, and makes every picture for engraving.
|
|
6
|
+
*/
|
|
7
|
+
export interface ArtboardEngrave {
|
|
8
|
+
/** The surface's colour where nothing is cut (the cup's coat, the wood), sRGB hex, e.g. "#1c1c1e". */
|
|
9
|
+
coat: string;
|
|
10
|
+
/** What the laser leaves where it cuts, sRGB hex: bare steel "#b0b0ad" (ENGRAVE_STEEL) on a coated cup, a dark burn on wood. */
|
|
11
|
+
cut: string;
|
|
12
|
+
/** The artboard's px per inch (an engraved area is drawn at the supplier file's own 300 dpi px). */
|
|
13
|
+
dpi: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* How a picture on an engraved area was made for engraving (`ImageElement.transformData.engrave`). The element's
|
|
17
|
+
* `imageUrl` is the result (black = cut, clear = not); `sourceUrl` is the picture as it came in, so the shopper can
|
|
18
|
+
* change the style any time without losing the original.
|
|
19
|
+
*/
|
|
20
|
+
export interface ImageEngraveSettings {
|
|
21
|
+
style: EngraveStyle;
|
|
22
|
+
/** -1..1: less .. more of the picture cut. */
|
|
23
|
+
amount: number;
|
|
24
|
+
/** false = the coat decides which parts are cut (the picture reads the right way round); true = the other way. */
|
|
25
|
+
invert: boolean;
|
|
26
|
+
/** The picture before it was made for engraving. */
|
|
27
|
+
sourceUrl: string;
|
|
28
|
+
/** Which parts the result cuts (true = the source's light parts): re-made when the coat calls for the other. */
|
|
29
|
+
cutLight: boolean;
|
|
30
|
+
}
|
|
31
|
+
export declare const ENGRAVE_RED: readonly [229, 72, 77];
|
|
32
|
+
/** The ink of everything added on an engraved area: black, which the laser cuts (it has no colours). */
|
|
33
|
+
export declare const ENGRAVE_INK = "#000000";
|
|
@@ -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-Ds3Wdba7.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
|
m as i
|
|
23
23
|
};
|
|
24
|
-
//# sourceMappingURL=guards-
|
|
24
|
+
//# sourceMappingURL=guards-DwYEoqcn.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guards-
|
|
1
|
+
{"version":3,"file":"guards-DwYEoqcn.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;"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { e as u } from "./useCommands-
|
|
2
|
-
import { C as
|
|
3
|
-
import { E as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
1
|
+
import { e as u } from "./useCommands-BrkGKdXr.js";
|
|
2
|
+
import { C as l, f as x, g as A, h as I, b as g, a as v, j as T, k as L, l as B } from "./useCommands-BrkGKdXr.js";
|
|
3
|
+
import { E as P, S as _, S as y, u as R, a as O } from "./SnowconeCanvas-C-AGGT44.js";
|
|
4
|
+
import { E as z, c as w } from "./adjust-CDVzlVBY.js";
|
|
5
|
+
import { b as m, e as d } from "./design-builder-DCHVrEFV.js";
|
|
6
|
+
import { C as N, D as V, f as D, s as b } from "./design-builder-DCHVrEFV.js";
|
|
7
|
+
import { T as G, r as H, u as U, a as Y, b as Z, c as j, d as k, e as J, w as q } from "./template-fields-CK7Uvvc8.js";
|
|
8
|
+
import { A as W, C as X, E as $, M as ee, P as se, r as ae, v as te } from "./validation-DETfj7tg.js";
|
|
9
|
+
import { G as re, H as ne, J as ie, K as ue } from "./ExportManager-xRsXgyNo.js";
|
|
10
|
+
import { c as de, e as Ee } from "./compose-DtQL_oit.js";
|
|
11
|
+
import { d as Ce, m as fe, s as ce, v as pe } from "./CanvasStateV1-BlDWgOzV.js";
|
|
12
|
+
function C() {
|
|
12
13
|
const { isCanvasReady: e } = m();
|
|
13
14
|
return e;
|
|
14
15
|
}
|
|
@@ -18,52 +19,54 @@ function f() {
|
|
|
18
19
|
}
|
|
19
20
|
u();
|
|
20
21
|
export {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
W as ALL_CAPABILITIES,
|
|
23
|
+
N as CANVAS_STATE_SCHEMA_VERSION,
|
|
24
|
+
X as COMPACT_CUSTOMIZER,
|
|
25
|
+
l as CanvasServicesProvider,
|
|
26
|
+
V as DesignBuilder,
|
|
27
|
+
$ as EMBED_ONLY,
|
|
28
|
+
z as ENGRAVE_STEEL,
|
|
29
|
+
P as ErrorBoundary,
|
|
30
|
+
ee as MINIMAL_CAPABILITIES,
|
|
31
|
+
se as PRO_STUDIO,
|
|
32
|
+
_ as SnowconeCanvas,
|
|
33
|
+
G as TEMPLATE_FIELDS_KEY,
|
|
34
|
+
de as createKit,
|
|
33
35
|
x as createProxyBgRemove,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
36
|
+
A as createProxyGenerate,
|
|
37
|
+
I as createProxyImageSearch,
|
|
38
|
+
re as customFontRegistry,
|
|
39
|
+
w as cutLightFor,
|
|
40
|
+
y as default,
|
|
41
|
+
Ce as deserializeState,
|
|
42
|
+
D as design,
|
|
43
|
+
ne as ensureCustomFontsLoaded,
|
|
44
|
+
Ee as extendKit,
|
|
45
|
+
ie as loadCustomFont,
|
|
46
|
+
fe as migrateState,
|
|
47
|
+
H as readTemplateFields,
|
|
48
|
+
ue as registerCustomFonts,
|
|
49
|
+
ae as resolveKit,
|
|
50
|
+
ce as serializeState,
|
|
51
|
+
b as serializeStateForServer,
|
|
52
|
+
g as useArtboards,
|
|
53
|
+
R as useAutoExport,
|
|
54
|
+
C as useCanvasReady,
|
|
55
|
+
v as useCanvasServices,
|
|
56
|
+
U as useColorBinding,
|
|
54
57
|
T as useCommands,
|
|
55
|
-
|
|
58
|
+
O as useContentReady,
|
|
56
59
|
m as useEditor,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
Y as useElementByName,
|
|
61
|
+
L as useExport,
|
|
62
|
+
Z as useFontBinding,
|
|
63
|
+
j as useImageBinding,
|
|
64
|
+
B as useLayers,
|
|
65
|
+
k as useSelectedElement,
|
|
66
|
+
J as useTextBinding,
|
|
64
67
|
f as useViewport,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
+
te as validateKit,
|
|
69
|
+
pe as validateState,
|
|
70
|
+
q as withTemplateFields
|
|
68
71
|
};
|
|
69
72
|
//# 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;;"}
|
package/dist/internals.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { A as rr, a as or, C as sr, I as er, R as tr, S as nr, T as ar } from "./CanvasRenderer-
|
|
2
|
-
import { r as k } from "./ExportManager-
|
|
3
|
-
import { D as hr, a as cr, I as dr, W as fr, b as gr, c as lr, d as ur, e as pr, f as yr, g as kr, h as vr, i as wr, j as Cr, k as Mr, l as Tr, m as Sr, n as br, o as Pr, p as Ir, q as mr, s as Ar, t as Rr, u as Wr, v as Er, w as Or, x as Hr, y as jr, z as Fr, A as Lr, B as Xr, C as zr, F as Nr } from "./ExportManager-
|
|
4
|
-
import { i as H, a as j, c as F, r as L, b as X } from "./FontAnalyzer-
|
|
5
|
-
import { d as Br, e as Kr, f as Ur, C as Yr, g as Jr, E as Vr, F as qr, H as Gr, L as Qr, h as Zr, W as $r, j as xr, k as Dr, l as ro, m as oo, n as so, o as eo, s as to, w as no } from "./FontAnalyzer-
|
|
6
|
-
import { A as io, a as ho, C as co, S as fo } from "./CanvasStateV1-
|
|
1
|
+
import { A as rr, a as or, C as sr, I as er, R as tr, S as nr, T as ar } from "./CanvasRenderer-B8BADU_r.js";
|
|
2
|
+
import { r as k } from "./ExportManager-xRsXgyNo.js";
|
|
3
|
+
import { D as hr, a as cr, I as dr, W as fr, b as gr, c as lr, d as ur, e as pr, f as yr, g as kr, h as vr, i as wr, j as Cr, k as Mr, l as Tr, m as Sr, n as br, o as Pr, p as Ir, q as mr, s as Ar, t as Rr, u as Wr, v as Er, w as Or, x as Hr, y as jr, z as Fr, A as Lr, B as Xr, C as zr, F as Nr } from "./ExportManager-xRsXgyNo.js";
|
|
4
|
+
import { i as H, a as j, c as F, r as L, b as X } from "./FontAnalyzer-Ds3Wdba7.js";
|
|
5
|
+
import { d as Br, e as Kr, f as Ur, C as Yr, g as Jr, E as Vr, F as qr, H as Gr, L as Qr, h as Zr, W as $r, j as xr, k as Dr, l as ro, m as oo, n as so, o as eo, s as to, w as no } from "./FontAnalyzer-Ds3Wdba7.js";
|
|
6
|
+
import { A as io, a as ho, C as co, S as fo } from "./CanvasStateV1-BlDWgOzV.js";
|
|
7
7
|
const z = F("image-adjustments"), v = 1e-3;
|
|
8
8
|
function N(r, o) {
|
|
9
9
|
const { brightness: a, contrast: s, saturation: h } = o, e = a * s, t = 127.5 * (1 - s), f = Math.abs(e - 1) > v || Math.abs(t) > v, i = new Uint8ClampedArray(256);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ArtboardEngrave } from '../engrave/types.js';
|
|
2
|
+
type ContextLike = CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;
|
|
3
|
+
/** The render loop asks this each frame: true once after the thin-line marks for the current view are ready. */
|
|
4
|
+
export declare function takeEngraveRepaint(): boolean;
|
|
5
|
+
/** How many thin parts the last engraved view found (machine-readable state for the host and tests). */
|
|
6
|
+
export declare function engraveViewThinParts(): number;
|
|
7
|
+
export declare function applyArtboardEngraveView(ctx: ContextLike, engrave: ArtboardEngrave, artboard: {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
}): void;
|
|
13
|
+
/** Test hook: forget every cached and pending thin-line search. */
|
|
14
|
+
export declare function resetEngraveViewForTests(): void;
|
|
15
|
+
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as v, p as V, T, I as M, z as st } from "./FontAnalyzer-
|
|
2
|
-
import { k as G, b as ot, m as it, u as O, a as B, n as rt } from "./design-builder-
|
|
1
|
+
import { t as v, p as V, T, I as M, z as st } from "./FontAnalyzer-Ds3Wdba7.js";
|
|
2
|
+
import { k as G, b as ot, m as it, u as O, a as B, n as rt } from "./design-builder-DCHVrEFV.js";
|
|
3
3
|
import { toOptionAttributes as at, toCombinations as ct, getMissingSelections as lt, validateProductSelection as mt, findBestCombination as F, computeDisabledChoices as ft } from "@snowcone-app/sdk";
|
|
4
4
|
import { useEffect as ut, useContext as Z, useId as dt, useLayoutEffect as ht, useRef as C, useMemo as k, useCallback as A, useState as q } from "react";
|
|
5
|
-
import { E as tt, U as gt } from "./useCommands-
|
|
6
|
-
import { b as pt, o as $, c as m, e as bt, l as h, n as yt, u as z, f as vt } from "./CanvasStateV1-
|
|
5
|
+
import { E as tt, U as gt } from "./useCommands-BrkGKdXr.js";
|
|
6
|
+
import { b as pt, o as $, c as m, e as bt, l as h, n as yt, u as z, f as vt } from "./CanvasStateV1-BlDWgOzV.js";
|
|
7
7
|
function R(s) {
|
|
8
8
|
return s.text;
|
|
9
9
|
}
|
|
@@ -556,4 +556,4 @@ export {
|
|
|
556
556
|
Gt as u,
|
|
557
557
|
Xt as w
|
|
558
558
|
};
|
|
559
|
-
//# sourceMappingURL=template-fields-
|
|
559
|
+
//# sourceMappingURL=template-fields-CK7Uvvc8.js.map
|