@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,14 +1,13 @@
|
|
|
1
|
-
import { E as Le,
|
|
2
|
-
import { E as T, y as be, z 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
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 { B as tt, E as nt, r as rt } from "./
|
|
7
|
-
import { u as
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import "./
|
|
11
|
-
import "./CanvasStateV1-BDSyYo4A.js";
|
|
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";
|
|
12
11
|
const xe = Je(void 0);
|
|
13
12
|
function K() {
|
|
14
13
|
const t = He(xe);
|
|
@@ -65,14 +64,14 @@ function Re({ shop: t, product: e, design: n, hasGrant: r }) {
|
|
|
65
64
|
issue: "placement-mismatch",
|
|
66
65
|
message: `the design's artboard(s) [${a.join(", ")}] are not in product.placements [${e.placements.join(", ")}]. Every artboard name must equal a real product placement label (renderState targets placements by that name), or the server renders a blank mockup. Fix the \`name\` passed to design({ name }) / design().artboard(name, …).`
|
|
67
66
|
});
|
|
68
|
-
const
|
|
67
|
+
const p = s.elements.map((o) => o.name).filter((o) => !!o), m = p.filter((o, g) => p.indexOf(o) !== g);
|
|
69
68
|
return m.length && i.push({
|
|
70
69
|
severity: "warn",
|
|
71
70
|
issue: "duplicate-layer-names",
|
|
72
71
|
message: `duplicate layer name(s) [${[...new Set(m)].join(", ")}] — useTextBinding(name) / useImageBinding(name) bind to the FIRST match, so a duplicate name makes a control edit the wrong layer. Keep names unique.`
|
|
73
72
|
}), i;
|
|
74
73
|
}
|
|
75
|
-
function
|
|
74
|
+
function ft(t) {
|
|
76
75
|
for (const e of Re(t))
|
|
77
76
|
(e.severity === "error" && e.issue !== "placement-mismatch" ? console.error : console.warn)(`${ut} ${e.message}`);
|
|
78
77
|
}
|
|
@@ -111,15 +110,15 @@ function Se({ registry: t, store: e, product: n }) {
|
|
|
111
110
|
fix: "Mount <Editor.Buy onAddToCart={…}/> under the same <Editor.Root> (it assembles the payload and gates on completeness), or ignore if this composition is deliberately non-commerce."
|
|
112
111
|
});
|
|
113
112
|
}
|
|
114
|
-
const
|
|
113
|
+
const p = [];
|
|
115
114
|
for (const o of s)
|
|
116
115
|
e.layerKindOf(o.name) === void 0 ? r.push({
|
|
117
116
|
code: "A_LAYER_UNMATCHED",
|
|
118
117
|
severity: "error",
|
|
119
118
|
message: `<Editor.TextField layer={design.layer("${o.name}")}> matches zero elements in the current design state — the layer was removed or renamed after the field mounted, so the binding is dead and writes will fail. Bindable layers now: ${JSON.stringify(e.bindableLayerNames())}.`,
|
|
120
119
|
fix: `Restore a text layer named "${o.name}" to the design, or bind the field to an existing layer: layer={design.layer(<one of ${JSON.stringify(e.bindableLayerNames())}>)}.`
|
|
121
|
-
}) :
|
|
122
|
-
const m =
|
|
120
|
+
}) : p.push(o);
|
|
121
|
+
const m = p.filter((o) => !o.optional);
|
|
123
122
|
if (m.length > 0 && m.every((o) => e.textOf(o.name) === e.seedTextOf(o.name))) {
|
|
124
123
|
const o = m.map((g) => g.name);
|
|
125
124
|
r.push({
|
|
@@ -141,13 +140,13 @@ function Se({ registry: t, store: e, product: n }) {
|
|
|
141
140
|
return { findings: r, parts: b };
|
|
142
141
|
}
|
|
143
142
|
const G = [];
|
|
144
|
-
function
|
|
143
|
+
function pt(t) {
|
|
145
144
|
return G.push(t), () => {
|
|
146
145
|
const e = G.indexOf(t);
|
|
147
146
|
e !== -1 && G.splice(e, 1);
|
|
148
147
|
};
|
|
149
148
|
}
|
|
150
|
-
function
|
|
149
|
+
function rn() {
|
|
151
150
|
const t = G[G.length - 1];
|
|
152
151
|
if (!t)
|
|
153
152
|
throw new T(
|
|
@@ -247,11 +246,11 @@ function bt(t) {
|
|
|
247
246
|
onIssue: c,
|
|
248
247
|
wsUrl: u,
|
|
249
248
|
services: a,
|
|
250
|
-
children:
|
|
249
|
+
children: p,
|
|
251
250
|
internals: m,
|
|
252
251
|
recordAudit: y,
|
|
253
252
|
__validation: b = "throw"
|
|
254
|
-
} = t, o = O(() => r.toJSON().activeArtboard, [r]), g = O(() => r.toJSON().artboards.map((h) => h.name), [r]), [w,
|
|
253
|
+
} = t, o = O(() => r.toJSON().activeArtboard, [r]), g = O(() => r.toJSON().artboards.map((h) => h.name), [r]), [w, f] = C(null), S = w && w.design === r ? w.label : o, v = O(
|
|
255
254
|
() => (h) => {
|
|
256
255
|
if (!g.includes(h))
|
|
257
256
|
throw new T(
|
|
@@ -259,7 +258,7 @@ function bt(t) {
|
|
|
259
258
|
`no placement "${h}" in this design — its artboards are ${JSON.stringify(g)}. Add it to the seed with design(…).artboard('${h}', { width, height }) (ADR-0088).`,
|
|
260
259
|
{ placement: h, validNames: g, docSlug: "embed-mode" }
|
|
261
260
|
);
|
|
262
|
-
|
|
261
|
+
f({ design: r, label: h });
|
|
263
262
|
},
|
|
264
263
|
[r, g]
|
|
265
264
|
), V = O(() => {
|
|
@@ -277,10 +276,10 @@ function bt(t) {
|
|
|
277
276
|
m.commerce.getVersion,
|
|
278
277
|
m.commerce.getVersion
|
|
279
278
|
);
|
|
280
|
-
const R = m.commerce.renderVariantId(), _ =
|
|
279
|
+
const R = m.commerce.renderVariantId(), _ = it(R ?? n.variantId ?? n.defaultGvid), D = O(() => {
|
|
281
280
|
if (!_) return null;
|
|
282
281
|
const h = r.toJSON().artboards[0];
|
|
283
|
-
return
|
|
282
|
+
return st(_, h) ?? null;
|
|
284
283
|
}, [_, r]), P = x(s), A = x(d), j = x(c);
|
|
285
284
|
P.current = s, A.current = d, j.current = c;
|
|
286
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(() => {
|
|
@@ -296,20 +295,20 @@ function bt(t) {
|
|
|
296
295
|
for (const B of h)
|
|
297
296
|
typeof L < "u" && ((I = L.env) == null ? void 0 : I.NODE_ENV) !== "production" && console.warn(`[Editor.Root] ${B.message}`);
|
|
298
297
|
return h;
|
|
299
|
-
}, [q, b]),
|
|
298
|
+
}, [q, b]), fe = x(null);
|
|
300
299
|
$(() => {
|
|
301
300
|
var h;
|
|
302
|
-
if (oe.length !== 0 &&
|
|
303
|
-
|
|
301
|
+
if (oe.length !== 0 && fe.current !== q) {
|
|
302
|
+
fe.current = q;
|
|
304
303
|
for (const E of oe) (h = j.current) == null || h.call(j, E);
|
|
305
304
|
}
|
|
306
305
|
}, [oe, q]);
|
|
307
|
-
const
|
|
306
|
+
const pe = x(null);
|
|
308
307
|
$(() => {
|
|
309
308
|
var h;
|
|
310
309
|
if (b === "warn" && typeof L < "u" && ((h = L.env) == null ? void 0 : h.NODE_ENV) !== "production") {
|
|
311
|
-
if (
|
|
312
|
-
|
|
310
|
+
if (pe.current === q) return;
|
|
311
|
+
pe.current = q, ft({ shop: e, product: n, design: r, hasGrant: ne });
|
|
313
312
|
}
|
|
314
313
|
}, [q, b]);
|
|
315
314
|
const Z = O(
|
|
@@ -410,7 +409,7 @@ function bt(t) {
|
|
|
410
409
|
nt,
|
|
411
410
|
{
|
|
412
411
|
...V ? { initialArtboardConfig: V } : {},
|
|
413
|
-
children:
|
|
412
|
+
children: p
|
|
414
413
|
}
|
|
415
414
|
) }) }) });
|
|
416
415
|
return a ? /* @__PURE__ */ l(Fe, { services: a, children: he }) : he;
|
|
@@ -432,8 +431,8 @@ function Ie(t) {
|
|
|
432
431
|
}),
|
|
433
432
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
434
433
|
[s.current.internals, d.current.commerce]
|
|
435
|
-
),
|
|
436
|
-
|
|
434
|
+
), p = x(n);
|
|
435
|
+
p.current = n;
|
|
437
436
|
const m = x(r);
|
|
438
437
|
m.current = r;
|
|
439
438
|
const y = x(null), b = F((w) => {
|
|
@@ -442,17 +441,17 @@ function Ie(t) {
|
|
|
442
441
|
() => Se({
|
|
443
442
|
registry: s.current.internals.registry,
|
|
444
443
|
store: s.current.internals.store,
|
|
445
|
-
product:
|
|
444
|
+
product: p.current
|
|
446
445
|
}),
|
|
447
446
|
[]
|
|
448
447
|
);
|
|
449
|
-
Q(() =>
|
|
448
|
+
Q(() => pt({ compute: o }), [o]);
|
|
450
449
|
const g = x(!1);
|
|
451
450
|
return $(() => {
|
|
452
451
|
let w = !1;
|
|
453
452
|
return queueMicrotask(() => {
|
|
454
|
-
var
|
|
455
|
-
w || g.current || (g.current = !0, (
|
|
453
|
+
var f;
|
|
454
|
+
w || g.current || (g.current = !0, (f = m.current) == null || f.call(m, y.current ?? o()));
|
|
456
455
|
}), () => {
|
|
457
456
|
w = !0;
|
|
458
457
|
};
|
|
@@ -461,7 +460,7 @@ function Ie(t) {
|
|
|
461
460
|
// wrapper, which had no DOM at all, stays layout-identical).
|
|
462
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 }) }) });
|
|
463
462
|
}
|
|
464
|
-
let wt = () => import("./EditorCanvasImpl-
|
|
463
|
+
let wt = () => import("./EditorCanvasImpl-P2GHPNA3.js").then((t) => t.EditorCanvasImpl);
|
|
465
464
|
function Oe() {
|
|
466
465
|
return wt();
|
|
467
466
|
}
|
|
@@ -470,12 +469,12 @@ const Et = we(function({ children: e, maxHeight: n, floatingToolbar: r = !0, cla
|
|
|
470
469
|
J("Editor.Canvas", { floatingToolbar: r });
|
|
471
470
|
const u = de();
|
|
472
471
|
Q(() => c.registry.registerCanvas(u), [c.registry, u]);
|
|
473
|
-
const [a,
|
|
472
|
+
const [a, p] = C(null);
|
|
474
473
|
return $(() => {
|
|
475
474
|
let m = !1;
|
|
476
475
|
return Oe().then(
|
|
477
476
|
(y) => {
|
|
478
|
-
m ||
|
|
477
|
+
m || p(() => y);
|
|
479
478
|
},
|
|
480
479
|
(y) => {
|
|
481
480
|
m || c.reportRuntimeError(
|
|
@@ -601,12 +600,12 @@ const Ne = Ye(function({
|
|
|
601
600
|
}, []);
|
|
602
601
|
const [d, c] = C(!1);
|
|
603
602
|
$(() => {
|
|
604
|
-
const
|
|
605
|
-
return () => cancelAnimationFrame(
|
|
603
|
+
const p = requestAnimationFrame(() => c(!0));
|
|
604
|
+
return () => cancelAnimationFrame(p);
|
|
606
605
|
}, []);
|
|
607
606
|
const u = F(
|
|
608
|
-
(
|
|
609
|
-
|
|
607
|
+
(p) => {
|
|
608
|
+
p.propertyName === "background-color" && (e || n == null || n());
|
|
610
609
|
},
|
|
611
610
|
[e, n]
|
|
612
611
|
);
|
|
@@ -619,18 +618,18 @@ const Ne = Ye(function({
|
|
|
619
618
|
onTransitionEnd: u,
|
|
620
619
|
"aria-hidden": "true",
|
|
621
620
|
children: [
|
|
622
|
-
Array.from({ length: 6 }, (
|
|
623
|
-
i.map((
|
|
621
|
+
Array.from({ length: 6 }, (p, m) => /* @__PURE__ */ l("div", { className: "sc-prism-band" }, `b-${m}`)),
|
|
622
|
+
i.map((p, m) => /* @__PURE__ */ l(
|
|
624
623
|
"div",
|
|
625
624
|
{
|
|
626
625
|
className: "sc-prism-particle",
|
|
627
626
|
style: {
|
|
628
|
-
left: `${
|
|
629
|
-
top: `${
|
|
630
|
-
animationDelay: `${
|
|
631
|
-
animationDuration: `${
|
|
632
|
-
width: `${
|
|
633
|
-
height: `${
|
|
627
|
+
left: `${p.left}%`,
|
|
628
|
+
top: `${p.top}%`,
|
|
629
|
+
animationDelay: `${p.delay}s`,
|
|
630
|
+
animationDuration: `${p.duration}s`,
|
|
631
|
+
width: `${p.size}px`,
|
|
632
|
+
height: `${p.size}px`
|
|
634
633
|
}
|
|
635
634
|
},
|
|
636
635
|
`p-${m}`
|
|
@@ -681,18 +680,18 @@ function $e({
|
|
|
681
680
|
}) {
|
|
682
681
|
const { mockups: d, error: c, isRendering: u } = K();
|
|
683
682
|
J("Editor.Preview", { ...t !== void 0 ? { mockupId: t } : {} });
|
|
684
|
-
const a = $t(r),
|
|
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(
|
|
685
684
|
y && u
|
|
686
|
-
), w = x(/* @__PURE__ */ new Set()),
|
|
685
|
+
), w = x(/* @__PURE__ */ new Set()), f = t ? d.find((v) => v.mockupId === t && v.imageUrl) : d.find((v) => v.imageUrl), S = (v) => {
|
|
687
686
|
var P;
|
|
688
|
-
if (!
|
|
687
|
+
if (!f || typeof L > "u" || ((P = L.env) == null ? void 0 : P.NODE_ENV) === "production" || typeof window > "u" || w.current.has(f.mockupId)) return;
|
|
689
688
|
const V = v.currentTarget, R = V.getBoundingClientRect().width;
|
|
690
689
|
if (R <= 0) return;
|
|
691
690
|
const _ = Math.round(R * (window.devicePixelRatio || 1)), D = Tt(V.naturalWidth, _);
|
|
692
|
-
D && (w.current.add(
|
|
691
|
+
D && (w.current.add(f.mockupId), console.warn(D));
|
|
693
692
|
};
|
|
694
693
|
if (y) {
|
|
695
|
-
const v =
|
|
694
|
+
const v = f != null && f.imageUrl ? u ? "rendering" : "ready" : c ? "error" : "rendering";
|
|
696
695
|
return /* @__PURE__ */ N(
|
|
697
696
|
"div",
|
|
698
697
|
{
|
|
@@ -702,9 +701,9 @@ function $e({
|
|
|
702
701
|
className: `sc-preview-frame${i ? ` ${i}` : ""}`,
|
|
703
702
|
style: s,
|
|
704
703
|
children: [
|
|
705
|
-
|
|
704
|
+
f != null && f.imageUrl ? (
|
|
706
705
|
// eslint-disable-next-line @next/next/no-img-element
|
|
707
|
-
/* @__PURE__ */ l("img", { "data-sc-part": "preview-image", src:
|
|
706
|
+
/* @__PURE__ */ l("img", { "data-sc-part": "preview-image", src: f.imageUrl, alt: n, onLoad: S })
|
|
708
707
|
) : c ? /* @__PURE__ */ l("div", { "data-sc-part": "preview-error", role: "alert", "data-sc-error": c, children: e ?? `Render failed: ${c}` }) : e,
|
|
709
708
|
m ? (
|
|
710
709
|
// Custom indicator: same show-delay + linger window; no exit fade
|
|
@@ -719,11 +718,11 @@ function $e({
|
|
|
719
718
|
children: m
|
|
720
719
|
}
|
|
721
720
|
) : null
|
|
722
|
-
) : b &&
|
|
721
|
+
) : b && p ? /* @__PURE__ */ l(
|
|
723
722
|
Ne,
|
|
724
723
|
{
|
|
725
724
|
visible: o,
|
|
726
|
-
variant:
|
|
725
|
+
variant: p,
|
|
727
726
|
onExited: g
|
|
728
727
|
}
|
|
729
728
|
) : null
|
|
@@ -731,14 +730,14 @@ function $e({
|
|
|
731
730
|
}
|
|
732
731
|
);
|
|
733
732
|
}
|
|
734
|
-
return
|
|
733
|
+
return f != null && f.imageUrl ? (
|
|
735
734
|
// eslint-disable-next-line @next/next/no-img-element
|
|
736
735
|
/* @__PURE__ */ l(
|
|
737
736
|
"img",
|
|
738
737
|
{
|
|
739
738
|
"data-sc-part": "preview",
|
|
740
739
|
"data-sc-preview-state": u ? "rendering" : "ready",
|
|
741
|
-
src:
|
|
740
|
+
src: f.imageUrl,
|
|
742
741
|
alt: n,
|
|
743
742
|
className: i,
|
|
744
743
|
style: s,
|
|
@@ -761,8 +760,8 @@ function $e({
|
|
|
761
760
|
function _t(t) {
|
|
762
761
|
const { layer: e, optional: n = !1, placeholder: r, className: i, style: s } = t, d = H("Editor.TextField");
|
|
763
762
|
J("Editor.TextField");
|
|
764
|
-
const { pushRender: c, throttleMs: u, stateStore: a } = K(),
|
|
765
|
-
if (!
|
|
763
|
+
const { pushRender: c, throttleMs: u, stateStore: a } = K(), p = de(), m = x(null);
|
|
764
|
+
if (!ot(e))
|
|
766
765
|
throw new T(
|
|
767
766
|
"E_LAYER_TOKEN_REQUIRED",
|
|
768
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.`,
|
|
@@ -784,7 +783,7 @@ function _t(t) {
|
|
|
784
783
|
);
|
|
785
784
|
m.current = e.name;
|
|
786
785
|
}
|
|
787
|
-
Q(() => d.registry.registerTextField(
|
|
786
|
+
Q(() => d.registry.registerTextField(p, { name: e.name, optional: n }), [d.registry, p, e.name, n]);
|
|
788
787
|
const y = z(
|
|
789
788
|
a.subscribe,
|
|
790
789
|
() => a.textOf(e.name) ?? "",
|
|
@@ -862,9 +861,9 @@ function Pt(t) {
|
|
|
862
861
|
"<Editor.Buy> has no product context — pass `product` (with `productId`) on <Editor.Root product={…}>. Buy assembles its cart payload from the Root product and the live design state.",
|
|
863
862
|
{ docSlug: "embed-mode" }
|
|
864
863
|
);
|
|
865
|
-
const
|
|
864
|
+
const p = x(!1);
|
|
866
865
|
Q(() => {
|
|
867
|
-
|
|
866
|
+
p.current || (p.current = !0, typeof n == "number" && a.setQuantity(n));
|
|
868
867
|
}, [a]);
|
|
869
868
|
const m = z(u.subscribe, u.getState, u.getState), y = z(a.subscribe, a.getVersion, a.getVersion), b = z(
|
|
870
869
|
d.registry.subscribe,
|
|
@@ -882,7 +881,7 @@ function Pt(t) {
|
|
|
882
881
|
}),
|
|
883
882
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
884
883
|
[a, o, m, y, b]
|
|
885
|
-
), w = g.length === 0, [
|
|
884
|
+
), w = g.length === 0, [f, S] = C(!1), v = x(!1), V = F(() => {
|
|
886
885
|
if (v.current || !w) return;
|
|
887
886
|
v.current = !0, S(!0);
|
|
888
887
|
const R = u.getState(), _ = a.resolvedVariantId(), D = {
|
|
@@ -909,10 +908,10 @@ function Pt(t) {
|
|
|
909
908
|
{
|
|
910
909
|
type: "button",
|
|
911
910
|
"data-sc-part": "buy",
|
|
912
|
-
"data-sc-buy-state":
|
|
911
|
+
"data-sc-buy-state": f ? "busy" : w ? "ready" : "incomplete",
|
|
913
912
|
"data-sc-buy-missing": g.join(",") || void 0,
|
|
914
|
-
disabled: !w ||
|
|
915
|
-
"aria-busy":
|
|
913
|
+
disabled: !w || f,
|
|
914
|
+
"aria-busy": f || void 0,
|
|
916
915
|
onClick: V,
|
|
917
916
|
className: i,
|
|
918
917
|
style: s,
|
|
@@ -936,7 +935,7 @@ function Lt({
|
|
|
936
935
|
return $(() => {
|
|
937
936
|
if (!s) return;
|
|
938
937
|
let u = !1;
|
|
939
|
-
return import("./ContextualToolbars-
|
|
938
|
+
return import("./ContextualToolbars-DRbuUE7W.js").then((a) => a.s).then(
|
|
940
939
|
(a) => {
|
|
941
940
|
u || c(() => a.ContextualToolbars);
|
|
942
941
|
},
|
|
@@ -1028,23 +1027,23 @@ const M = {
|
|
|
1028
1027
|
* Fills its positioned parent; rides the session (canvas-free). */
|
|
1029
1028
|
LoadingOverlay: Vt
|
|
1030
1029
|
};
|
|
1031
|
-
function
|
|
1030
|
+
function on(t) {
|
|
1032
1031
|
return /* @__PURE__ */ l(Ie, { ...t, __validation: "warn" });
|
|
1033
1032
|
}
|
|
1034
|
-
const
|
|
1033
|
+
const sn = we(
|
|
1035
1034
|
function(e, n) {
|
|
1036
1035
|
const { children: r, className: i, style: s, maxHeight: d, ...c } = e, [u, a] = C(null);
|
|
1037
1036
|
return $(() => {
|
|
1038
|
-
let
|
|
1037
|
+
let p = !1;
|
|
1039
1038
|
return Oe().then(
|
|
1040
1039
|
(m) => {
|
|
1041
|
-
|
|
1040
|
+
p || a(() => m);
|
|
1042
1041
|
},
|
|
1043
1042
|
(m) => {
|
|
1044
1043
|
console.error("[RealtimeCanvas] failed to load the rendering chunk:", m);
|
|
1045
1044
|
}
|
|
1046
1045
|
), () => {
|
|
1047
|
-
|
|
1046
|
+
p = !0;
|
|
1048
1047
|
};
|
|
1049
1048
|
}, []), u ? /* @__PURE__ */ l(u, { ref: n, selfScope: !0, maxHeight: d, className: i, style: s, ...c, children: r }) : /* @__PURE__ */ l(
|
|
1050
1049
|
"div",
|
|
@@ -1056,19 +1055,19 @@ const an = we(
|
|
|
1056
1055
|
);
|
|
1057
1056
|
}
|
|
1058
1057
|
);
|
|
1059
|
-
function
|
|
1058
|
+
function an(t) {
|
|
1060
1059
|
return /* @__PURE__ */ l($e, { ...t });
|
|
1061
1060
|
}
|
|
1062
|
-
function
|
|
1061
|
+
function dn() {
|
|
1063
1062
|
const { mockups: t, isRendering: e, error: n } = K();
|
|
1064
1063
|
return { mockups: t, isRendering: e, error: n };
|
|
1065
1064
|
}
|
|
1066
1065
|
function Ft(t) {
|
|
1067
1066
|
return t.type !== "color" && typeof t.width == "number" && t.width > 0 && typeof t.height == "number" && t.height > 0;
|
|
1068
1067
|
}
|
|
1069
|
-
function
|
|
1068
|
+
function ln(t, e = {}) {
|
|
1070
1069
|
var y, b, o, g, w;
|
|
1071
|
-
const n = (t.placements ?? []).filter(Ft), r = n.map((
|
|
1070
|
+
const n = (t.placements ?? []).filter(Ft), r = n.map((f) => f.label), i = e.placement ? n.find((f) => f.label === e.placement) : n[0];
|
|
1072
1071
|
if (!i)
|
|
1073
1072
|
throw e.placement ? new T(
|
|
1074
1073
|
"E_PRODUCT_NOT_RENDERABLE",
|
|
@@ -1080,17 +1079,17 @@ function cn(t, e = {}) {
|
|
|
1080
1079
|
{ productId: t.id, docSlug: "embed-mode" }
|
|
1081
1080
|
);
|
|
1082
1081
|
const s = ((y = t.options) == null ? void 0 : y.attributes) ?? {}, c = Object.values(s).some(
|
|
1083
|
-
(
|
|
1082
|
+
(f) => {
|
|
1084
1083
|
var S;
|
|
1085
|
-
return (S =
|
|
1084
|
+
return (S = f == null ? void 0 : f.choices) == null ? void 0 : S.some((v) => v == null ? void 0 : v.hex);
|
|
1086
1085
|
}
|
|
1087
1086
|
) ? (g = (o = (b = t.options) == null ? void 0 : b.combinations) == null ? void 0 : o.find(
|
|
1088
|
-
(
|
|
1089
|
-
)) == null ? void 0 : g.variantId : void 0, u = t.mockups ?? [], a = c ? u.filter((
|
|
1087
|
+
(f) => typeof f.variantId == "string" && f.variantId !== ""
|
|
1088
|
+
)) == null ? void 0 : g.variantId : void 0, u = t.mockups ?? [], a = c ? u.filter((f) => {
|
|
1090
1089
|
var S;
|
|
1091
|
-
return (S =
|
|
1092
|
-
}) : u,
|
|
1093
|
-
if (
|
|
1090
|
+
return (S = f.gvids) == null ? void 0 : S.includes(c);
|
|
1091
|
+
}) : u, p = (a.length > 0 ? a : u).map((f) => f.id);
|
|
1092
|
+
if (p.length === 0)
|
|
1094
1093
|
throw new T(
|
|
1095
1094
|
"E_PRODUCT_NOT_RENDERABLE",
|
|
1096
1095
|
`product ${t.id} has no mockup scenes — nothing to render a preview into.`,
|
|
@@ -1099,10 +1098,10 @@ function cn(t, e = {}) {
|
|
|
1099
1098
|
return {
|
|
1100
1099
|
product: {
|
|
1101
1100
|
productId: t.id,
|
|
1102
|
-
mockupIds:
|
|
1101
|
+
mockupIds: p,
|
|
1103
1102
|
...typeof c == "string" ? { variantId: c } : {},
|
|
1104
1103
|
options: t.options,
|
|
1105
|
-
placements: (w = t.placements) == null ? void 0 : w.map((
|
|
1104
|
+
placements: (w = t.placements) == null ? void 0 : w.map((f) => f.label),
|
|
1106
1105
|
mockups: u,
|
|
1107
1106
|
requiredPlacements: t.requiredPlacements,
|
|
1108
1107
|
...t.defaultGvid ? { defaultGvid: t.defaultGvid } : {},
|
|
@@ -1115,13 +1114,13 @@ function cn(t, e = {}) {
|
|
|
1115
1114
|
aspectRatio: i.width / i.height
|
|
1116
1115
|
},
|
|
1117
1116
|
placementLabels: r,
|
|
1118
|
-
placements: n.map((
|
|
1119
|
-
label:
|
|
1120
|
-
width:
|
|
1121
|
-
height:
|
|
1122
|
-
aspectRatio:
|
|
1117
|
+
placements: n.map((f) => ({
|
|
1118
|
+
label: f.label,
|
|
1119
|
+
width: f.width,
|
|
1120
|
+
height: f.height,
|
|
1121
|
+
aspectRatio: f.width / f.height
|
|
1123
1122
|
})),
|
|
1124
|
-
primaryMockupId:
|
|
1123
|
+
primaryMockupId: p[0],
|
|
1125
1124
|
variantId: c
|
|
1126
1125
|
};
|
|
1127
1126
|
}
|
|
@@ -1240,15 +1239,15 @@ function qt({
|
|
|
1240
1239
|
}
|
|
1241
1240
|
}
|
|
1242
1241
|
),
|
|
1243
|
-
n > 1 ? Array.from({ length: n }, (a,
|
|
1242
|
+
n > 1 ? Array.from({ length: n }, (a, p) => /* @__PURE__ */ l(
|
|
1244
1243
|
ae,
|
|
1245
1244
|
{
|
|
1246
|
-
label: `View ${
|
|
1245
|
+
label: `View ${p + 1}${p === r ? " ✓" : ""}`,
|
|
1247
1246
|
onSelect: () => {
|
|
1248
|
-
u(), i(
|
|
1247
|
+
u(), i(p);
|
|
1249
1248
|
}
|
|
1250
1249
|
},
|
|
1251
|
-
|
|
1250
|
+
p
|
|
1252
1251
|
)) : null,
|
|
1253
1252
|
/* @__PURE__ */ l(
|
|
1254
1253
|
ae,
|
|
@@ -1365,7 +1364,7 @@ function Wt({
|
|
|
1365
1364
|
className: s,
|
|
1366
1365
|
style: d
|
|
1367
1366
|
}) {
|
|
1368
|
-
const [c, u] = C(!1), [a,
|
|
1367
|
+
const [c, u] = C(!1), [a, p] = C(0), [m, y] = C(!1), b = x(null), o = ct(), g = n[Math.min(a, n.length - 1)], w = F(async () => {
|
|
1369
1368
|
var D;
|
|
1370
1369
|
const v = await ((D = b.current) == null ? void 0 : D.exportArtboards({ format: "dataUrl" }));
|
|
1371
1370
|
if (!v) return;
|
|
@@ -1373,7 +1372,7 @@ function Wt({
|
|
|
1373
1372
|
if (typeof R != "string") return;
|
|
1374
1373
|
const _ = document.createElement("a");
|
|
1375
1374
|
_.href = R, _.download = `${V ?? "design"}.png`, _.click();
|
|
1376
|
-
}, []),
|
|
1375
|
+
}, []), f = {
|
|
1377
1376
|
display: "flex",
|
|
1378
1377
|
flexDirection: "column",
|
|
1379
1378
|
overflow: "hidden",
|
|
@@ -1415,7 +1414,7 @@ function Wt({
|
|
|
1415
1414
|
"data-sc-part": "snowcone-editor",
|
|
1416
1415
|
"data-sc-fullscreen": c ? "true" : void 0,
|
|
1417
1416
|
className: s,
|
|
1418
|
-
style:
|
|
1417
|
+
style: f,
|
|
1419
1418
|
children: [
|
|
1420
1419
|
/* @__PURE__ */ N(
|
|
1421
1420
|
"div",
|
|
@@ -1438,7 +1437,7 @@ function Wt({
|
|
|
1438
1437
|
onToggleFullscreen: () => u((v) => !v),
|
|
1439
1438
|
viewCount: n.length,
|
|
1440
1439
|
viewIndex: a,
|
|
1441
|
-
onSelectView:
|
|
1440
|
+
onSelectView: p,
|
|
1442
1441
|
onExport: () => void w()
|
|
1443
1442
|
}
|
|
1444
1443
|
),
|
|
@@ -1544,7 +1543,7 @@ function Wt({
|
|
|
1544
1543
|
}
|
|
1545
1544
|
);
|
|
1546
1545
|
}
|
|
1547
|
-
function
|
|
1546
|
+
function cn(t) {
|
|
1548
1547
|
const {
|
|
1549
1548
|
onAddToCart: e,
|
|
1550
1549
|
defaultQuantity: n,
|
|
@@ -1570,18 +1569,18 @@ function un(t) {
|
|
|
1570
1569
|
We();
|
|
1571
1570
|
export {
|
|
1572
1571
|
M as E,
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1572
|
+
sn as R,
|
|
1573
|
+
cn as S,
|
|
1574
|
+
on as a,
|
|
1575
|
+
an as b,
|
|
1576
|
+
rn as c,
|
|
1578
1577
|
Re as d,
|
|
1579
1578
|
xt as e,
|
|
1580
1579
|
Ut as f,
|
|
1581
1580
|
Bt as g,
|
|
1582
|
-
|
|
1583
|
-
|
|
1581
|
+
dn as h,
|
|
1582
|
+
ln as p,
|
|
1584
1583
|
K as u,
|
|
1585
|
-
|
|
1584
|
+
ft as v
|
|
1586
1585
|
};
|
|
1587
|
-
//# sourceMappingURL=embed-
|
|
1586
|
+
//# sourceMappingURL=embed-D4TIzO7g.js.map
|