@snowcone-app/canvas 0.28.0 → 0.29.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-B_3GISlW.js → CanvasRenderer-_lFoIoz5.js} +1083 -1071
- package/dist/CanvasRenderer-_lFoIoz5.js.map +1 -0
- package/dist/{CanvasStateV1-kL09wsAn.js → CanvasStateV1-BMxr6xb8.js} +7 -4
- package/dist/{CanvasStateV1-kL09wsAn.js.map → CanvasStateV1-BMxr6xb8.js.map} +1 -1
- package/dist/{ContextualToolbars-C69oYLdw.js → ContextualToolbars-0jWvnQgp.js} +1718 -1656
- package/dist/ContextualToolbars-0jWvnQgp.js.map +1 -0
- package/dist/{EditorCanvasImpl-CrI9C_xM.js → EditorCanvasImpl-BNz8TPFs.js} +8 -8
- package/dist/{EditorCanvasImpl-CrI9C_xM.js.map → EditorCanvasImpl-BNz8TPFs.js.map} +1 -1
- package/dist/{ExportManager-J2xK86uq.js → ExportManager-B8Td7uR5.js} +1043 -964
- package/dist/ExportManager-B8Td7uR5.js.map +1 -0
- package/dist/{FontAnalyzer-PE6nysqE.js → FontAnalyzer-D4Sg-P6_.js} +1234 -1172
- package/dist/FontAnalyzer-D4Sg-P6_.js.map +1 -0
- package/dist/{ImagePanel-CmQCxBGm.js → ImagePanel-CN2Bu3hf.js} +6 -6
- package/dist/{ImagePanel-CmQCxBGm.js.map → ImagePanel-CN2Bu3hf.js.map} +1 -1
- package/dist/{SnowconeCanvas-CQiFVR0X.js → SnowconeCanvas-CR_LdRFP.js} +27 -27
- package/dist/{SnowconeCanvas-CQiFVR0X.js.map → SnowconeCanvas-CR_LdRFP.js.map} +1 -1
- package/dist/{UnifiedFontService-BJzoqfBF.js → UnifiedFontService-CgYnYTj7.js} +7 -7
- package/dist/{UnifiedFontService-BJzoqfBF.js.map → UnifiedFontService-CgYnYTj7.js.map} +1 -1
- package/dist/advanced.mjs +14 -14
- package/dist/components/toolbars/SecondaryPanels.d.ts +11 -0
- package/dist/core/TextElement.d.ts +13 -0
- package/dist/core/TextMetrics.d.ts +17 -3
- package/dist/core/rich-text-layout.d.ts +2 -0
- package/dist/core/text-spacing.d.ts +74 -0
- package/dist/{custom-icons-BWiUGqD6.js → custom-icons-B5TRC1Ed.js} +2 -2
- package/dist/{custom-icons-BWiUGqD6.js.map → custom-icons-B5TRC1Ed.js.map} +1 -1
- package/dist/{design-builder-bquxIHct.js → design-builder-COj0zkxu.js} +2 -2
- package/dist/{design-builder-bquxIHct.js.map → design-builder-COj0zkxu.js.map} +1 -1
- package/dist/{editorErrors-8uDRMhow.js → editorErrors-CCvoKj_P.js} +2 -2
- package/dist/{editorErrors-8uDRMhow.js.map → editorErrors-CCvoKj_P.js.map} +1 -1
- package/dist/{embed-L3oRIgsj.js → embed-BTRtoktw.js} +10 -10
- package/dist/{embed-L3oRIgsj.js.map → embed-BTRtoktw.js.map} +1 -1
- package/dist/embed.mjs +6 -6
- package/dist/{guards-BlbhM5MX.js → guards-uQtEQJbs.js} +2 -2
- package/dist/{guards-BlbhM5MX.js.map → guards-uQtEQJbs.js.map} +1 -1
- package/dist/hooks/useTextToolbar.d.ts +8 -0
- package/dist/index.mjs +8 -8
- package/dist/internals.mjs +5 -5
- package/dist/rendering/renderer-types.d.ts +4 -0
- package/dist/rendering/rich-text-renderer.d.ts +4 -0
- package/dist/rendering/text-renderer.d.ts +4 -1
- package/dist/state/CanvasStateV1.d.ts +3 -0
- package/dist/{template-fields-ai7vnW8g.js → template-fields-BLRp84Ny.js} +6 -6
- package/dist/{template-fields-ai7vnW8g.js.map → template-fields-BLRp84Ny.js.map} +1 -1
- package/dist/testing.mjs +4 -4
- package/dist/types/index.d.ts +26 -0
- package/dist/{usePieceGuideBundle-CMe5br2a.js → usePieceGuideBundle-CTQszfKA.js} +2 -2
- package/dist/{usePieceGuideBundle-CMe5br2a.js.map → usePieceGuideBundle-CTQszfKA.js.map} +1 -1
- package/dist/utils/featureApplied.d.ts +6 -0
- package/dist/{validation-B8kIYutI.js → validation-eCebhplp.js} +1940 -1935
- package/dist/validation-eCebhplp.js.map +1 -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/CanvasRenderer-B_3GISlW.js.map +0 -1
- package/dist/ContextualToolbars-C69oYLdw.js.map +0 -1
- package/dist/ExportManager-J2xK86uq.js.map +0 -1
- package/dist/FontAnalyzer-PE6nysqE.js.map +0 -1
- package/dist/validation-B8kIYutI.js.map +0 -1
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { y as G, c as Q,
|
|
1
|
+
import { y as G, c as Q, aq as Pe, I as Te } from "./FontAnalyzer-D4Sg-P6_.js";
|
|
2
2
|
import { jsx as E, Fragment as De, jsxs as V } from "react/jsx-runtime";
|
|
3
|
-
import { useMemo as we, useRef as F, useEffect as R, Component as Le, useState as
|
|
4
|
-
import { l as We, e as $e, f as He, G as Oe, a as ze, Z as Ke, i as Ue, b as Xe, D as je, r as Ye, v as Ve, S as Ge, g as Qe, c as
|
|
5
|
-
import { ImagePanel as
|
|
6
|
-
import { d as
|
|
7
|
-
import { E as et, o as tt, p as rt, C as nt, u as ue, f as at } from "./UnifiedFontService-
|
|
8
|
-
import { C as ot, D as st } from "./template-fields-
|
|
9
|
-
import { E as it, u as ee } from "./editorErrors-
|
|
3
|
+
import { useMemo as we, useRef as F, useEffect as R, Component as Le, useState as Z, useCallback as z, useImperativeHandle as Be, forwardRef as Se } from "react";
|
|
4
|
+
import { l as We, e as $e, f as He, G as Oe, a as ze, Z as Ke, i as Ue, b as Xe, D as je, r as Ye, v as Ve, S as Ge, g as Qe, c as qe } from "./validation-eCebhplp.js";
|
|
5
|
+
import { ImagePanel as Je } from "./ImagePanel-CN2Bu3hf.js";
|
|
6
|
+
import { d as Ze, e as _e } from "./ContextualToolbars-0jWvnQgp.js";
|
|
7
|
+
import { E as et, o as tt, p as rt, C as nt, u as ue, f as at } from "./UnifiedFontService-CgYnYTj7.js";
|
|
8
|
+
import { C as ot, D as st } from "./template-fields-BLRp84Ny.js";
|
|
9
|
+
import { E as it, u as ee } from "./editorErrors-CCvoKj_P.js";
|
|
10
10
|
import { T as Ee } from "./ThemeContext-Rjz25x9X.js";
|
|
11
|
-
import { C as ce } from "./CanvasRenderer-
|
|
12
|
-
import { F as ct } from "./ExportManager-
|
|
13
|
-
const fe = Q("KitLayout"),
|
|
11
|
+
import { C as ce } from "./CanvasRenderer-_lFoIoz5.js";
|
|
12
|
+
import { F as ct } from "./ExportManager-B8Td7uR5.js";
|
|
13
|
+
const fe = Q("KitLayout"), J = "canvas", le = 320;
|
|
14
14
|
let xe = !1;
|
|
15
15
|
function lt() {
|
|
16
16
|
xe || (xe = !0, We({
|
|
17
17
|
EffectsPanel: $e,
|
|
18
18
|
ExportPanel: He,
|
|
19
|
-
ImagePanel:
|
|
19
|
+
ImagePanel: Je,
|
|
20
20
|
GlyphPanel: Oe,
|
|
21
21
|
ArtboardTabs: ze,
|
|
22
|
-
ContextualToolbars:
|
|
22
|
+
ContextualToolbars: Ze,
|
|
23
23
|
ZoomControls: Ke,
|
|
24
24
|
CropPanel: _e
|
|
25
25
|
}));
|
|
@@ -40,7 +40,7 @@ function dt({ children: n }) {
|
|
|
40
40
|
function re({ ids: n }) {
|
|
41
41
|
return !n || n.length === 0 ? null : /* @__PURE__ */ E(dt, { children: n.map((e) => {
|
|
42
42
|
var r;
|
|
43
|
-
if (e ===
|
|
43
|
+
if (e === J) return null;
|
|
44
44
|
const t = Ue(e);
|
|
45
45
|
if (!t)
|
|
46
46
|
return typeof G < "u" && ((r = G.env) == null ? void 0 : r.NODE_ENV) === "development" && fe.warn(
|
|
@@ -53,7 +53,7 @@ function re({ ids: n }) {
|
|
|
53
53
|
function ut({ kit: n, canvas: e }) {
|
|
54
54
|
var x, d, h, v;
|
|
55
55
|
lt();
|
|
56
|
-
const t = n.layout.slots, a = !!((x = t.topbar) != null && x.some((g) => g !==
|
|
56
|
+
const t = n.layout.slots, a = !!((x = t.topbar) != null && x.some((g) => g !== J)), r = !!((d = t.left) != null && d.some((g) => g !== J)), s = !!((h = t.right) != null && h.some((g) => g !== J)), c = !!((v = t.bottombar) != null && v.some((g) => g !== J)), l = we(
|
|
57
57
|
() => !a && !r && !s && !c,
|
|
58
58
|
[a, r, s, c]
|
|
59
59
|
), i = F(null), f = a || r || s || c, m = F(!1);
|
|
@@ -194,7 +194,7 @@ function pt(n) {
|
|
|
194
194
|
skippedExports: 0,
|
|
195
195
|
lastExportTime: null,
|
|
196
196
|
avgExportInterval: 0
|
|
197
|
-
}), [x, d] =
|
|
197
|
+
}), [x, d] = Z(m.current), h = F(s);
|
|
198
198
|
h.current = s, R(() => {
|
|
199
199
|
const o = new Xe({
|
|
200
200
|
...je,
|
|
@@ -290,7 +290,7 @@ function Et() {
|
|
|
290
290
|
return new Promise((n) => requestAnimationFrame(() => n()));
|
|
291
291
|
}
|
|
292
292
|
function xt(n) {
|
|
293
|
-
const { isCanvasReady: e, elements: t, hasInitialElements: a, initialElementsLoaded: r } = n, [s, c] =
|
|
293
|
+
const { isCanvasReady: e, elements: t, hasInitialElements: a, initialElementsLoaded: r } = n, [s, c] = Z(!1), l = F(!1);
|
|
294
294
|
return R(() => {
|
|
295
295
|
if (s || !e || a && !r || a && t.length === 0 || l.current) return;
|
|
296
296
|
l.current = !0;
|
|
@@ -615,7 +615,7 @@ function Nt(n) {
|
|
|
615
615
|
}, [x.getActiveArtboardId()]);
|
|
616
616
|
}
|
|
617
617
|
function Pt(n) {
|
|
618
|
-
const { initialElements: e, emitError: t } = n, { setElements: a, artboardManager: r } = ee(), s = F(!1), [c, l] =
|
|
618
|
+
const { initialElements: e, emitError: t } = n, { setElements: a, artboardManager: r } = ee(), s = F(!1), [c, l] = Z(!1), i = F(!0);
|
|
619
619
|
return R(() => (i.current = !0, () => {
|
|
620
620
|
i.current = !1;
|
|
621
621
|
}), []), R(() => {
|
|
@@ -690,7 +690,7 @@ function Tt(n) {
|
|
|
690
690
|
onImageLoad: c,
|
|
691
691
|
onImageError: l,
|
|
692
692
|
emitError: i
|
|
693
|
-
} = n, { elements: f, setElements: m, artboardManager: x } = ee(), [d, h] =
|
|
693
|
+
} = n, { elements: f, setElements: m, artboardManager: x } = ee(), [d, h] = Z("idle"), [v, g] = Z(null), S = F(void 0);
|
|
694
694
|
return R(() => {
|
|
695
695
|
if (!e || S.current === e) return;
|
|
696
696
|
if (f.length > 0) {
|
|
@@ -931,15 +931,15 @@ function Lt(n, e) {
|
|
|
931
931
|
const P = u.getActiveArtboard();
|
|
932
932
|
d({ status: "scheduled", artboardId: (P == null ? void 0 : P.id) ?? "unknown" });
|
|
933
933
|
}
|
|
934
|
-
}, [x, d, u]),
|
|
934
|
+
}, [x, d, u]), q = xt({
|
|
935
935
|
isCanvasReady: w,
|
|
936
936
|
elements: o,
|
|
937
937
|
hasInitialElements: g,
|
|
938
938
|
initialElementsLoaded: S
|
|
939
939
|
}), te = F(!1);
|
|
940
940
|
R(() => {
|
|
941
|
-
|
|
942
|
-
}, [
|
|
941
|
+
q && !te.current && (te.current = !0, v == null || v());
|
|
942
|
+
}, [q, v]), pt({
|
|
943
943
|
config: a ? {
|
|
944
944
|
enabled: a.enabled ?? !0,
|
|
945
945
|
debounceMs: a.debounceMs ?? 100,
|
|
@@ -953,7 +953,7 @@ function Lt(n, e) {
|
|
|
953
953
|
elements: o,
|
|
954
954
|
onExport: oe,
|
|
955
955
|
onExportScheduled: se,
|
|
956
|
-
isCanvasReady:
|
|
956
|
+
isCanvasReady: q
|
|
957
957
|
// Gate exports until content is fully ready (fonts loaded, elements deserialized)
|
|
958
958
|
}), R(() => {
|
|
959
959
|
if (p.length > 0 && !w) {
|
|
@@ -993,7 +993,7 @@ const ye = Q("SnowconeCanvas"), ke = Se((n, e) => {
|
|
|
993
993
|
enableShortcuts: p,
|
|
994
994
|
overlay: C,
|
|
995
995
|
resetDocumentOnMount: X
|
|
996
|
-
} = n, O = d, j = n.autoExportConfig ?? (t == null ? void 0 : t.autoExportConfig), ne = n.autoExportFormat ?? (t == null ? void 0 : t.format) ?? "dataUrl", ae = n.autoExportAll ?? (t == null ? void 0 : t.exportAll) ?? !1, oe = n.exportScale ?? (t == null ? void 0 : t.scale) ?? 2, se = n.maxExportSize ?? (t == null ? void 0 : t.maxSize) ?? 4e3,
|
|
996
|
+
} = n, O = d, j = n.autoExportConfig ?? (t == null ? void 0 : t.autoExportConfig), ne = n.autoExportFormat ?? (t == null ? void 0 : t.format) ?? "dataUrl", ae = n.autoExportAll ?? (t == null ? void 0 : t.exportAll) ?? !1, oe = n.exportScale ?? (t == null ? void 0 : t.scale) ?? 2, se = n.maxExportSize ?? (t == null ? void 0 : t.maxSize) ?? 4e3, q = n.exportImageFormat ?? (t == null ? void 0 : t.imageFormat) ?? "png", te = n.exportImageQuality ?? (t == null ? void 0 : t.imageQuality) ?? 0.92, P = n.initialImage ?? (a == null ? void 0 : a.src), T = n.initialImageAlignment ?? (a == null ? void 0 : a.alignment) ?? "center", D = n.initialImageScale ?? (a == null ? void 0 : a.scale) ?? 1, $ = n.initialImageScaleMode ?? (a == null ? void 0 : a.scaleMode) ?? "cover", L = n.width ?? (r == null ? void 0 : r.width) ?? 1200, k = n.height ?? (r == null ? void 0 : r.height) ?? 1200, M = n.viewPadding ?? (r == null ? void 0 : r.viewPadding) ?? 0.9, I = n.artboardBorderRadius ?? (r == null ? void 0 : r.artboardBorderRadius) ?? 0, N = n.fixedMargin ?? (r == null ? void 0 : r.fixedMargin), K = n.maxHeight ?? (r == null ? void 0 : r.maxHeight), B = n.showRotationHandle ?? (r == null ? void 0 : r.showRotationHandle) ?? !0, U = n.hideCanvas ?? (r == null ? void 0 : r.hideCanvas) ?? !1, me = n.canvasWrapperClassName ?? (r == null ? void 0 : r.canvasWrapperClassName), he = n.canvasWrapperStyle ?? (r == null ? void 0 : r.canvasWrapperStyle), Ie = n.canvasCutouts ?? (r == null ? void 0 : r.canvasCutouts), ge = n.pieceGuides, Re = n.pieceFocus, Ce = p ?? !0, Y = we(() => Ye(s ?? "pro-studio"), [s]);
|
|
997
997
|
R(() => {
|
|
998
998
|
var H;
|
|
999
999
|
if (typeof G < "u" && ((H = G.env) == null ? void 0 : H.NODE_ENV) === "development" && Y) {
|
|
@@ -1032,7 +1032,7 @@ const ye = Q("SnowconeCanvas"), ke = Se((n, e) => {
|
|
|
1032
1032
|
autoExportAll: ae,
|
|
1033
1033
|
exportScale: oe,
|
|
1034
1034
|
maxExportSize: se,
|
|
1035
|
-
exportImageFormat:
|
|
1035
|
+
exportImageFormat: q,
|
|
1036
1036
|
exportImageQuality: te,
|
|
1037
1037
|
onExport: h,
|
|
1038
1038
|
onExportScheduled: v,
|
|
@@ -1127,7 +1127,7 @@ const ye = Q("SnowconeCanvas"), ke = Se((n, e) => {
|
|
|
1127
1127
|
children: [
|
|
1128
1128
|
!U && /* @__PURE__ */ (() => {
|
|
1129
1129
|
const H = /* @__PURE__ */ E(
|
|
1130
|
-
|
|
1130
|
+
qe,
|
|
1131
1131
|
{
|
|
1132
1132
|
style: { width: "100%" },
|
|
1133
1133
|
fitPadding: M,
|
|
@@ -1170,4 +1170,4 @@ export {
|
|
|
1170
1170
|
xt as a,
|
|
1171
1171
|
pt as u
|
|
1172
1172
|
};
|
|
1173
|
-
//# sourceMappingURL=SnowconeCanvas-
|
|
1173
|
+
//# sourceMappingURL=SnowconeCanvas-CR_LdRFP.js.map
|