@snowcone-app/canvas 0.30.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/STYLING_CONTRACT.md +2 -2
- package/dist/{CanvasRenderer-BEf0hXeF.js → CanvasRenderer-hpJ05JGO.js} +4 -4
- package/dist/{CanvasRenderer-BEf0hXeF.js.map → CanvasRenderer-hpJ05JGO.js.map} +1 -1
- package/dist/{CanvasStateV1-BDSyYo4A.js → CanvasStateV1-jLOibojY.js} +11 -4
- package/dist/{CanvasStateV1-BDSyYo4A.js.map → CanvasStateV1-jLOibojY.js.map} +1 -1
- package/dist/{ContextualToolbars-C3D_6sep.js → ContextualToolbars-DRbuUE7W.js} +2086 -1985
- package/dist/ContextualToolbars-DRbuUE7W.js.map +1 -0
- package/dist/{EditorCanvasImpl-DXeBz2CX.js → EditorCanvasImpl-P2GHPNA3.js} +19 -20
- package/dist/{EditorCanvasImpl-DXeBz2CX.js.map → EditorCanvasImpl-P2GHPNA3.js.map} +1 -1
- package/dist/{ExportManager-DUdis6se.js → ExportManager-Bkzzyxgw.js} +400 -261
- package/dist/ExportManager-Bkzzyxgw.js.map +1 -0
- package/dist/{FontAnalyzer-DKG5JK0x.js → FontAnalyzer-BYhwxDhe.js} +1084 -1034
- package/dist/FontAnalyzer-BYhwxDhe.js.map +1 -0
- package/dist/{ImagePanel-CBgGqmVV.js → ImagePanel-CEr0_FYy.js} +49 -49
- package/dist/{ImagePanel-CBgGqmVV.js.map → ImagePanel-CEr0_FYy.js.map} +1 -1
- package/dist/{SnowconeCanvas-BWPBngvI.js → SnowconeCanvas-Fa0isFpO.js} +27 -27
- package/dist/{SnowconeCanvas-BWPBngvI.js.map → SnowconeCanvas-Fa0isFpO.js.map} +1 -1
- package/dist/advanced.mjs +14 -14
- package/dist/components/ImageToolbar.d.ts +4 -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/toolbar-button.d.ts +2 -2
- package/dist/core/image-adjustments.d.ts +32 -0
- package/dist/{custom-icons-BIaRovwG.js → custom-icons-Co4rcW0S.js} +7 -7
- package/dist/{custom-icons-BIaRovwG.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-Csez1hui.js → embed-D4TIzO7g.js} +110 -111
- package/dist/{embed-Csez1hui.js.map → embed-D4TIzO7g.js.map} +1 -1
- package/dist/embed.mjs +53 -54
- package/dist/embed.mjs.map +1 -1
- package/dist/{guards-BSoX73yg.js → guards-DgZuwVgu.js} +2 -2
- package/dist/{guards-BSoX73yg.js.map → guards-DgZuwVgu.js.map} +1 -1
- package/dist/hooks/elementPatch.d.ts +7 -2
- package/dist/index.mjs +41 -41
- package/dist/internals.mjs +196 -127
- 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 +5 -0
- package/dist/template-fields-CvFcr5zy.js +505 -0
- package/dist/template-fields-CvFcr5zy.js.map +1 -0
- package/dist/testing.mjs +40 -41
- package/dist/testing.mjs.map +1 -1
- package/dist/types/index.d.ts +21 -0
- package/dist/{UnifiedFontService-Co9tQ59z.js → useCommands-bPXY9rCh.js} +2344 -2103
- package/dist/useCommands-bPXY9rCh.js.map +1 -0
- package/dist/{usePieceGuideBundle-CRLY2iQa.js → usePieceGuideBundle-Bj98nPk0.js} +2 -2
- package/dist/{usePieceGuideBundle-CRLY2iQa.js.map → usePieceGuideBundle-Bj98nPk0.js.map} +1 -1
- package/dist/utils/featureApplied.d.ts +2 -0
- package/dist/{validation-BGEl9rrE.js → validation-CsTlSvJJ.js} +465 -465
- package/dist/{validation-BGEl9rrE.js.map → validation-CsTlSvJJ.js.map} +1 -1
- 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-C3D_6sep.js.map +0 -1
- package/dist/ExportManager-DUdis6se.js.map +0 -1
- package/dist/FontAnalyzer-DKG5JK0x.js.map +0 -1
- package/dist/UnifiedFontService-Co9tQ59z.js.map +0 -1
- package/dist/design-builder-JYLO_Hyi.js +0 -470
- package/dist/design-builder-JYLO_Hyi.js.map +0 -1
- package/dist/editorErrors-WzaNxU1Y.js +0 -1206
- package/dist/editorErrors-WzaNxU1Y.js.map +0 -1
- package/dist/template-fields-DYPW7bVU.js +0 -716
- package/dist/template-fields-DYPW7bVU.js.map +0 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { z as G, c as Q,
|
|
1
|
+
import { z as G, c as Q, ax as Te, I as De } from "./FontAnalyzer-BYhwxDhe.js";
|
|
2
2
|
import { jsx as y, Fragment as Be, jsxs as V } from "react/jsx-runtime";
|
|
3
|
-
import { useMemo as Se, useRef as F, useEffect as R, Component as We, useState as
|
|
4
|
-
import { l as He, e as ze, f as Oe, G as Ke, a as Ue, Z as Xe, i as je, b as Ye, D as Ve, r as Ge, v as Qe, S as
|
|
5
|
-
import { ImagePanel as _e } from "./ImagePanel-
|
|
6
|
-
import { d as et, e as tt } from "./ContextualToolbars-
|
|
7
|
-
import { E as rt,
|
|
8
|
-
import { C as it, D as ct } from "./template-fields-
|
|
9
|
-
import { E as lt, u as ee } from "./
|
|
3
|
+
import { useMemo as Se, useRef as F, useEffect as R, Component as We, useState as Z, useCallback as O, useImperativeHandle as $e, forwardRef as Ae } from "react";
|
|
4
|
+
import { l as He, e as ze, f as Oe, G as Ke, a as Ue, Z as Xe, i as je, b as Ye, D as Ve, r as Ge, v as Qe, S as qe, g as Je, c as Ze } from "./validation-CsTlSvJJ.js";
|
|
5
|
+
import { ImagePanel as _e } from "./ImagePanel-CEr0_FYy.js";
|
|
6
|
+
import { d as et, e as tt } from "./ContextualToolbars-DRbuUE7W.js";
|
|
7
|
+
import { E as rt, p as nt, q as at, C as ot, u as fe, g as st } from "./useCommands-bPXY9rCh.js";
|
|
8
|
+
import { C as it, D as ct } from "./template-fields-CvFcr5zy.js";
|
|
9
|
+
import { E as lt, u as ee } from "./design-builder-CBG2hKc8.js";
|
|
10
10
|
import { T as xe } from "./ThemeContext-Rjz25x9X.js";
|
|
11
|
-
import { c as re, K as dt, e as ut } from "./ExportManager-
|
|
12
|
-
import { C as le } from "./CanvasRenderer-
|
|
13
|
-
const me = Q("KitLayout"),
|
|
11
|
+
import { c as re, K as dt, e as ut } from "./ExportManager-Bkzzyxgw.js";
|
|
12
|
+
import { C as le } from "./CanvasRenderer-hpJ05JGO.js";
|
|
13
|
+
const me = Q("KitLayout"), J = "canvas", de = 320;
|
|
14
14
|
let ye = !1;
|
|
15
15
|
function ft() {
|
|
16
16
|
ye || (ye = !0, He({
|
|
@@ -40,7 +40,7 @@ function mt({ children: n }) {
|
|
|
40
40
|
function ne({ ids: n }) {
|
|
41
41
|
return !n || n.length === 0 ? null : /* @__PURE__ */ y(mt, { children: n.map((e) => {
|
|
42
42
|
var r;
|
|
43
|
-
if (e ===
|
|
43
|
+
if (e === J) return null;
|
|
44
44
|
const t = je(e);
|
|
45
45
|
if (!t)
|
|
46
46
|
return typeof G < "u" && ((r = G.env) == null ? void 0 : r.NODE_ENV) === "development" && me.warn(
|
|
@@ -53,7 +53,7 @@ function ne({ ids: n }) {
|
|
|
53
53
|
function gt({ kit: n, canvas: e }) {
|
|
54
54
|
var p, u, b, E;
|
|
55
55
|
ft();
|
|
56
|
-
const t = n.layout.slots, a = !!((p = t.topbar) != null && p.some((w) => w !==
|
|
56
|
+
const t = n.layout.slots, a = !!((p = t.topbar) != null && p.some((w) => w !== J)), r = !!((u = t.left) != null && u.some((w) => w !== J)), s = !!((b = t.right) != null && b.some((w) => w !== J)), l = !!((E = t.bottombar) != null && E.some((w) => w !== J)), d = Se(
|
|
57
57
|
() => !a && !r && !s && !l,
|
|
58
58
|
[a, r, s, l]
|
|
59
59
|
), i = F(null), f = a || r || s || l, m = F(!1);
|
|
@@ -194,7 +194,7 @@ function Et(n) {
|
|
|
194
194
|
skippedExports: 0,
|
|
195
195
|
lastExportTime: null,
|
|
196
196
|
avgExportInterval: 0
|
|
197
|
-
}), [p, u] =
|
|
197
|
+
}), [p, u] = Z(m.current), b = F(s);
|
|
198
198
|
b.current = s, R(() => {
|
|
199
199
|
const o = new Ye({
|
|
200
200
|
...Ve,
|
|
@@ -290,7 +290,7 @@ function wt() {
|
|
|
290
290
|
return new Promise((n) => requestAnimationFrame(() => n()));
|
|
291
291
|
}
|
|
292
292
|
function St(n) {
|
|
293
|
-
const { isCanvasReady: e, elements: t, hasInitialElements: a, initialElementsLoaded: r } = n, [s, l] =
|
|
293
|
+
const { isCanvasReady: e, elements: t, hasInitialElements: a, initialElementsLoaded: r } = n, [s, l] = Z(!1), d = F(!1);
|
|
294
294
|
return R(() => {
|
|
295
295
|
if (s || !e || a && !r || a && t.length === 0 || d.current) return;
|
|
296
296
|
d.current = !0;
|
|
@@ -615,7 +615,7 @@ function Tt(n) {
|
|
|
615
615
|
}, [p.getActiveArtboardId()]);
|
|
616
616
|
}
|
|
617
617
|
function Dt(n) {
|
|
618
|
-
const { initialElements: e, emitError: t, customFonts: a } = n, { setElements: r, artboardManager: s } = ee(), l = F(!1), [d, i] =
|
|
618
|
+
const { initialElements: e, emitError: t, customFonts: a } = n, { setElements: r, artboardManager: s } = ee(), l = F(!1), [d, i] = Z(!1), f = F(!0);
|
|
619
619
|
return R(() => (f.current = !0, () => {
|
|
620
620
|
f.current = !1;
|
|
621
621
|
}), []), R(() => {
|
|
@@ -707,7 +707,7 @@ function Bt(n) {
|
|
|
707
707
|
onImageLoad: l,
|
|
708
708
|
onImageError: d,
|
|
709
709
|
emitError: i
|
|
710
|
-
} = n, { elements: f, setElements: m, artboardManager: p } = ee(), [u, b] =
|
|
710
|
+
} = n, { elements: f, setElements: m, artboardManager: p } = ee(), [u, b] = Z("idle"), [E, w] = Z(null), A = F(void 0);
|
|
711
711
|
return R(() => {
|
|
712
712
|
if (!e || A.current === e) return;
|
|
713
713
|
if (f.length > 0) {
|
|
@@ -948,15 +948,15 @@ function $t(n, e) {
|
|
|
948
948
|
const P = c.getActiveArtboard();
|
|
949
949
|
u({ status: "scheduled", artboardId: (P == null ? void 0 : P.id) ?? "unknown" });
|
|
950
950
|
}
|
|
951
|
-
}, [p, u, c]),
|
|
951
|
+
}, [p, u, c]), q = St({
|
|
952
952
|
isCanvasReady: x,
|
|
953
953
|
elements: o,
|
|
954
954
|
hasInitialElements: w,
|
|
955
955
|
initialElementsLoaded: A
|
|
956
956
|
}), te = F(!1);
|
|
957
957
|
R(() => {
|
|
958
|
-
|
|
959
|
-
}, [
|
|
958
|
+
q && !te.current && (te.current = !0, E == null || E());
|
|
959
|
+
}, [q, E]), Et({
|
|
960
960
|
config: a ? {
|
|
961
961
|
enabled: a.enabled ?? !0,
|
|
962
962
|
debounceMs: a.debounceMs ?? 100,
|
|
@@ -970,7 +970,7 @@ function $t(n, e) {
|
|
|
970
970
|
elements: o,
|
|
971
971
|
onExport: se,
|
|
972
972
|
onExportScheduled: ie,
|
|
973
|
-
isCanvasReady:
|
|
973
|
+
isCanvasReady: q
|
|
974
974
|
// Gate exports until content is fully ready (fonts loaded, elements deserialized)
|
|
975
975
|
}), R(() => {
|
|
976
976
|
if (h.length > 0 && !x) {
|
|
@@ -1011,7 +1011,7 @@ const we = Q("SnowconeCanvas"), Ie = Ae((n, e) => {
|
|
|
1011
1011
|
enableShortcuts: C,
|
|
1012
1012
|
overlay: X,
|
|
1013
1013
|
resetDocumentOnMount: z
|
|
1014
|
-
} = n, j = b, ae = n.autoExportConfig ?? (t == null ? void 0 : t.autoExportConfig), oe = n.autoExportFormat ?? (t == null ? void 0 : t.format) ?? "dataUrl", se = n.autoExportAll ?? (t == null ? void 0 : t.exportAll) ?? !1, ie = n.exportScale ?? (t == null ? void 0 : t.scale) ?? 2,
|
|
1014
|
+
} = n, j = b, ae = n.autoExportConfig ?? (t == null ? void 0 : t.autoExportConfig), oe = n.autoExportFormat ?? (t == null ? void 0 : t.format) ?? "dataUrl", se = n.autoExportAll ?? (t == null ? void 0 : t.exportAll) ?? !1, ie = n.exportScale ?? (t == null ? void 0 : t.scale) ?? 2, q = n.maxExportSize ?? (t == null ? void 0 : t.maxSize) ?? 4e3, te = n.exportImageFormat ?? (t == null ? void 0 : t.imageFormat) ?? "png", P = n.exportImageQuality ?? (t == null ? void 0 : t.imageQuality) ?? 0.92, L = n.initialImage ?? (a == null ? void 0 : a.src), T = n.initialImageAlignment ?? (a == null ? void 0 : a.alignment) ?? "center", $ = n.initialImageScale ?? (a == null ? void 0 : a.scale) ?? 1, D = n.initialImageScaleMode ?? (a == null ? void 0 : a.scaleMode) ?? "cover", k = n.width ?? (r == null ? void 0 : r.width) ?? 1200, M = n.height ?? (r == null ? void 0 : r.height) ?? 1200, I = n.viewPadding ?? (r == null ? void 0 : r.viewPadding) ?? 0.9, N = n.artboardBorderRadius ?? (r == null ? void 0 : r.artboardBorderRadius) ?? 0, K = n.fixedMargin ?? (r == null ? void 0 : r.fixedMargin), B = n.maxHeight ?? (r == null ? void 0 : r.maxHeight), U = n.showRotationHandle ?? (r == null ? void 0 : r.showRotationHandle) ?? !0, Re = n.hideCanvas ?? (r == null ? void 0 : r.hideCanvas) ?? !1, ge = n.canvasWrapperClassName ?? (r == null ? void 0 : r.canvasWrapperClassName), he = n.canvasWrapperStyle ?? (r == null ? void 0 : r.canvasWrapperStyle), Ce = n.canvasCutouts ?? (r == null ? void 0 : r.canvasCutouts), pe = n.pieceGuides, Me = n.pieceFocus, Fe = C ?? !0, Y = Se(() => Ge(s ?? "pro-studio"), [s]);
|
|
1015
1015
|
R(() => {
|
|
1016
1016
|
var H;
|
|
1017
1017
|
if (typeof G < "u" && ((H = G.env) == null ? void 0 : H.NODE_ENV) === "development" && Y) {
|
|
@@ -1050,7 +1050,7 @@ const we = Q("SnowconeCanvas"), Ie = Ae((n, e) => {
|
|
|
1050
1050
|
autoExportFormat: oe,
|
|
1051
1051
|
autoExportAll: se,
|
|
1052
1052
|
exportScale: ie,
|
|
1053
|
-
maxExportSize:
|
|
1053
|
+
maxExportSize: q,
|
|
1054
1054
|
exportImageFormat: te,
|
|
1055
1055
|
exportImageQuality: P,
|
|
1056
1056
|
onExport: E,
|
|
@@ -1075,7 +1075,7 @@ const we = Q("SnowconeCanvas"), Ie = Ae((n, e) => {
|
|
|
1075
1075
|
justifyContent: "center",
|
|
1076
1076
|
backgroundColor: "var(--surface, #f5f5f5)"
|
|
1077
1077
|
},
|
|
1078
|
-
children: /* @__PURE__ */ y(
|
|
1078
|
+
children: /* @__PURE__ */ y(qe, { size: 48 })
|
|
1079
1079
|
}
|
|
1080
1080
|
);
|
|
1081
1081
|
if (be === "error" && ve)
|
|
@@ -1101,7 +1101,7 @@ const we = Q("SnowconeCanvas"), Ie = Ae((n, e) => {
|
|
|
1101
1101
|
const Le = Object.entries(((Ee = Y.layout) == null ? void 0 : Ee.slots) ?? {}).every(
|
|
1102
1102
|
([H, W]) => H === "canvas" || !W || W.length === 0
|
|
1103
1103
|
) ? { "--color-canvas-bg": "transparent" } : void 0;
|
|
1104
|
-
return /* @__PURE__ */ y(
|
|
1104
|
+
return /* @__PURE__ */ y(Je, { kit: Y, children: /* @__PURE__ */ y("div", { className: `sc-root ${S || ""}`, style: { ...Le, ...h, position: "relative" }, children: /* @__PURE__ */ V(
|
|
1105
1105
|
pt,
|
|
1106
1106
|
{
|
|
1107
1107
|
onError: Ne,
|
|
@@ -1146,7 +1146,7 @@ const we = Q("SnowconeCanvas"), Ie = Ae((n, e) => {
|
|
|
1146
1146
|
children: [
|
|
1147
1147
|
!Re && /* @__PURE__ */ (() => {
|
|
1148
1148
|
const H = /* @__PURE__ */ y(
|
|
1149
|
-
|
|
1149
|
+
Ze,
|
|
1150
1150
|
{
|
|
1151
1151
|
style: { width: "100%" },
|
|
1152
1152
|
fitPadding: I,
|
|
@@ -1189,4 +1189,4 @@ export {
|
|
|
1189
1189
|
St as a,
|
|
1190
1190
|
Et as u
|
|
1191
1191
|
};
|
|
1192
|
-
//# sourceMappingURL=SnowconeCanvas-
|
|
1192
|
+
//# sourceMappingURL=SnowconeCanvas-Fa0isFpO.js.map
|