@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
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { E as Le,
|
|
2
|
-
import { y as L } from "./FontAnalyzer-
|
|
1
|
+
import { E as Le, p as Ve, q as Be, C as Fe, r as H, t as J, v as Ue, w as Me, x as je, y as qe, z as ze, h as Ke, e as We } from "./useCommands-bPXY9rCh.js";
|
|
2
|
+
import { E as T, y as be, z as L } from "./FontAnalyzer-BYhwxDhe.js";
|
|
3
3
|
import { jsx as l, jsxs as N, Fragment as Ge } from "react/jsx-runtime";
|
|
4
|
-
import { useContext as He, createContext as Je, useRef as x, useState as C, useMemo as O, useCallback as F, useLayoutEffect as Q, useEffect as $, useSyncExternalStore as z, Component as Qe, forwardRef as
|
|
4
|
+
import { useContext as He, createContext as Je, useRef as x, useState as C, useMemo as O, useCallback as F, useLayoutEffect as Q, useEffect as $, useSyncExternalStore as z, Component as Qe, forwardRef as we, useId as de, memo as Ye, isValidElement as Ee } from "react";
|
|
5
5
|
import { assertVariantSelected as Xe, RenderSession as Ze, createCartDetail as et } from "@snowcone-app/sdk";
|
|
6
|
-
import {
|
|
7
|
-
import { u as
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import "./CanvasStateV1-
|
|
6
|
+
import { s as le, B as tt, E as nt, r as rt, i as ot } from "./design-builder-CBG2hKc8.js";
|
|
7
|
+
import { u as it, p as st } from "./usePieceGuideBundle-Bj98nPk0.js";
|
|
8
|
+
import { D as at, C as dt, f as lt, d as ct } from "./template-fields-CvFcr5zy.js";
|
|
9
|
+
import "./ExportManager-Bkzzyxgw.js";
|
|
10
|
+
import "./CanvasStateV1-jLOibojY.js";
|
|
11
11
|
const xe = Je(void 0);
|
|
12
12
|
function K() {
|
|
13
13
|
const t = He(xe);
|
|
@@ -167,7 +167,7 @@ function gt(t) {
|
|
|
167
167
|
return typeof e == "function" ? { getToken: e } : { getToken: () => Promise.resolve(e) };
|
|
168
168
|
}
|
|
169
169
|
function Ce({ error: t, onRetry: e }) {
|
|
170
|
-
const n =
|
|
170
|
+
const n = be(t) ? t.code : "EDITOR_ERROR";
|
|
171
171
|
return /* @__PURE__ */ N(
|
|
172
172
|
"div",
|
|
173
173
|
{
|
|
@@ -230,7 +230,7 @@ class yt extends Qe {
|
|
|
230
230
|
}
|
|
231
231
|
function vt({ reportedError: t, onRetry: e, children: n }) {
|
|
232
232
|
if (t) {
|
|
233
|
-
const r =
|
|
233
|
+
const r = be(t) && t.code === "E_CHUNK_LOAD_FAILED";
|
|
234
234
|
return /* @__PURE__ */ l(Ce, { error: t, onRetry: r ? e : void 0 });
|
|
235
235
|
}
|
|
236
236
|
return /* @__PURE__ */ l(yt, { reportedError: null, onRetry: e, children: n });
|
|
@@ -276,10 +276,10 @@ function bt(t) {
|
|
|
276
276
|
m.commerce.getVersion,
|
|
277
277
|
m.commerce.getVersion
|
|
278
278
|
);
|
|
279
|
-
const R = m.commerce.renderVariantId(), _ =
|
|
279
|
+
const R = m.commerce.renderVariantId(), _ = it(R ?? n.variantId ?? n.defaultGvid), D = O(() => {
|
|
280
280
|
if (!_) return null;
|
|
281
281
|
const h = r.toJSON().artboards[0];
|
|
282
|
-
return
|
|
282
|
+
return st(_, h) ?? null;
|
|
283
283
|
}, [_, r]), P = x(s), A = x(d), j = x(c);
|
|
284
284
|
P.current = s, A.current = d, j.current = c;
|
|
285
285
|
const [ce, _e] = C([]), [Y, W] = C(!0), [ue, X] = C(null), ne = !!("grantUrl" in t && t.grantUrl || "grant" in t && t.grant), re = gt(t), Ae = "grantUrl" in re ? re.grantUrl : "getToken", me = `${n.productId}|${n.mockupIds.join(",")}|${n.variantId ?? ""}`, q = `${e}|${me}|${o}|${ne}`, oe = O(() => {
|
|
@@ -460,11 +460,11 @@ function Ie(t) {
|
|
|
460
460
|
// wrapper, which had no DOM at all, stays layout-identical).
|
|
461
461
|
/* @__PURE__ */ l("div", { className: "sc-root", style: { display: "contents" }, "data-sc-part": "root", children: /* @__PURE__ */ l(vt, { reportedError: c, onRetry: () => u(null), children: /* @__PURE__ */ l(bt, { ...t, internals: a, recordAudit: b }) }) });
|
|
462
462
|
}
|
|
463
|
-
let wt = () => import("./EditorCanvasImpl-
|
|
463
|
+
let wt = () => import("./EditorCanvasImpl-P2GHPNA3.js").then((t) => t.EditorCanvasImpl);
|
|
464
464
|
function Oe() {
|
|
465
465
|
return wt();
|
|
466
466
|
}
|
|
467
|
-
const Et =
|
|
467
|
+
const Et = we(function({ children: e, maxHeight: n, floatingToolbar: r = !0, className: i, style: s }, d) {
|
|
468
468
|
const c = H("Editor.Canvas");
|
|
469
469
|
J("Editor.Canvas", { floatingToolbar: r });
|
|
470
470
|
const u = de();
|
|
@@ -663,7 +663,7 @@ function Tt(t, e) {
|
|
|
663
663
|
}
|
|
664
664
|
function $t(t) {
|
|
665
665
|
if (t === void 0 || t === !0 || t === "dark") return "dark";
|
|
666
|
-
if (t === "light" || t === "host-owned" ||
|
|
666
|
+
if (t === "light" || t === "host-owned" || Ee(t)) return t;
|
|
667
667
|
throw new T(
|
|
668
668
|
"E_PREVIEW_NO_LOADER",
|
|
669
669
|
`Editor.Preview: invalid loadingOverlay value ${JSON.stringify(t)}. A mockup preview always has a render-in-flight treatment (the loader paints over the still-visible previous mockup). Omit the prop for the default rainbow overlay, pass "dark" | "light", pass a custom ReactElement, or declare "host-owned" if the host renders its own indicator off data-sc-preview-state / <Editor.LoadingOverlay>.`,
|
|
@@ -680,7 +680,7 @@ function $e({
|
|
|
680
680
|
}) {
|
|
681
681
|
const { mockups: d, error: c, isRendering: u } = K();
|
|
682
682
|
J("Editor.Preview", { ...t !== void 0 ? { mockupId: t } : {} });
|
|
683
|
-
const a = $t(r), p = a === "dark" || a === "light" ? a : null, m =
|
|
683
|
+
const a = $t(r), p = a === "dark" || a === "light" ? a : null, m = Ee(a) ? a : null, y = a !== "host-owned", { showOverlay: b, overlayVisible: o, handleExited: g } = Te(
|
|
684
684
|
y && u
|
|
685
685
|
), w = x(/* @__PURE__ */ new Set()), f = t ? d.find((v) => v.mockupId === t && v.imageUrl) : d.find((v) => v.imageUrl), S = (v) => {
|
|
686
686
|
var P;
|
|
@@ -761,7 +761,7 @@ function _t(t) {
|
|
|
761
761
|
const { layer: e, optional: n = !1, placeholder: r, className: i, style: s } = t, d = H("Editor.TextField");
|
|
762
762
|
J("Editor.TextField");
|
|
763
763
|
const { pushRender: c, throttleMs: u, stateStore: a } = K(), p = de(), m = x(null);
|
|
764
|
-
if (!
|
|
764
|
+
if (!ot(e))
|
|
765
765
|
throw new T(
|
|
766
766
|
"E_LAYER_TOKEN_REQUIRED",
|
|
767
767
|
`the \`layer\` prop must be a token minted by the design — pass layer={design.layer("name")}, not ${typeof e == "string" ? `the bare string "${e}"` : "a plain value"}. Tokens validate the name against the design's layers at mint time.`,
|
|
@@ -935,7 +935,7 @@ function Lt({
|
|
|
935
935
|
return $(() => {
|
|
936
936
|
if (!s) return;
|
|
937
937
|
let u = !1;
|
|
938
|
-
return import("./ContextualToolbars-
|
|
938
|
+
return import("./ContextualToolbars-DRbuUE7W.js").then((a) => a.s).then(
|
|
939
939
|
(a) => {
|
|
940
940
|
u || c(() => a.ContextualToolbars);
|
|
941
941
|
},
|
|
@@ -1030,7 +1030,7 @@ const M = {
|
|
|
1030
1030
|
function on(t) {
|
|
1031
1031
|
return /* @__PURE__ */ l(Ie, { ...t, __validation: "warn" });
|
|
1032
1032
|
}
|
|
1033
|
-
const sn =
|
|
1033
|
+
const sn = we(
|
|
1034
1034
|
function(e, n) {
|
|
1035
1035
|
const { children: r, className: i, style: s, maxHeight: d, ...c } = e, [u, a] = C(null);
|
|
1036
1036
|
return $(() => {
|
|
@@ -1583,4 +1583,4 @@ export {
|
|
|
1583
1583
|
K as u,
|
|
1584
1584
|
ft as v
|
|
1585
1585
|
};
|
|
1586
|
-
//# sourceMappingURL=embed-
|
|
1586
|
+
//# sourceMappingURL=embed-D4TIzO7g.js.map
|