@snowcone-app/canvas 0.46.6 → 0.46.8
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/{ContextualToolbars-Dmo86Wd2.js → ContextualToolbars-BG90V6-s.js} +3 -3
- package/dist/ContextualToolbars-BG90V6-s.js.map +1 -0
- package/dist/{EditorCanvasImpl-BHa8q4iO.js → EditorCanvasImpl-C7y7UNl1.js} +5 -5
- package/dist/{EditorCanvasImpl-BHa8q4iO.js.map → EditorCanvasImpl-C7y7UNl1.js.map} +1 -1
- package/dist/{ImagePanel-4fHABjNT.js → ImagePanel-BaEJnUvS.js} +3 -3
- package/dist/ImagePanel-BaEJnUvS.js.map +1 -0
- package/dist/{SnowconeCanvas-GPag5BXG.js → SnowconeCanvas-C6FmL0pj.js} +6 -6
- package/dist/{SnowconeCanvas-GPag5BXG.js.map → SnowconeCanvas-C6FmL0pj.js.map} +1 -1
- package/dist/advanced.mjs +64 -64
- package/dist/advanced.mjs.map +1 -1
- package/dist/compose-Ce53EW1v.js +100 -0
- package/dist/compose-Ce53EW1v.js.map +1 -0
- package/dist/{custom-icons-Dt0Y4VSn.js → custom-icons-BA-MX7Y2.js} +2 -2
- package/dist/{custom-icons-Dt0Y4VSn.js.map → custom-icons-BA-MX7Y2.js.map} +1 -1
- package/dist/{embed-DhjsJ3ni.js → embed-CYlEe_Xv.js} +155 -156
- package/dist/embed-CYlEe_Xv.js.map +1 -0
- package/dist/embed.mjs +44 -44
- package/dist/icons/Icon.d.ts +2 -0
- package/dist/index.mjs +56 -56
- package/dist/{template-fields-CKEuUmTM.js → template-fields-3CH15MFC.js} +2 -2
- package/dist/{template-fields-CKEuUmTM.js.map → template-fields-3CH15MFC.js.map} +1 -1
- package/dist/{useCommands-BI7O5Lf0.js → useCommands-C6nE770t.js} +739 -753
- package/dist/useCommands-C6nE770t.js.map +1 -0
- package/dist/{validation-au_-Sj-A.js → validation-C3FHoCbQ.js} +132 -136
- package/dist/validation-C3FHoCbQ.js.map +1 -0
- package/dist/vendor/ui/primitives/Button.d.ts +1 -1
- package/example/package.json +1 -1
- package/package.json +2 -2
- package/dist/ContextualToolbars-Dmo86Wd2.js.map +0 -1
- package/dist/ImagePanel-4fHABjNT.js.map +0 -1
- package/dist/compose-DtQL_oit.js +0 -85
- package/dist/compose-DtQL_oit.js.map +0 -1
- package/dist/embed-DhjsJ3ni.js.map +0 -1
- package/dist/useCommands-BI7O5Lf0.js.map +0 -1
- package/dist/validation-au_-Sj-A.js.map +0 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { n as Ze, o as et, E as tt, C as nt, y as se, z as oe, A as rt, F as it, G as st, H as ot, J as at, l as dt, e as lt } from "./useCommands-BI7O5Lf0.js";
|
|
2
1
|
import { q as I, Y as De, p as K } from "./FontAnalyzer-CLMJi2Sw.js";
|
|
3
|
-
import { jsx as f, jsxs as U, Fragment as
|
|
4
|
-
import we, { useContext as
|
|
5
|
-
import { assertVariantSelected as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
2
|
+
import { jsx as f, jsxs as U, Fragment as Ze } from "react/jsx-runtime";
|
|
3
|
+
import we, { useContext as et, createContext as tt, useRef as C, useState as D, useMemo as L, useCallback as G, useLayoutEffect as se, useEffect as F, useSyncExternalStore as J, Component as nt, forwardRef as Le, useId as Ee, memo as rt, isValidElement as ke } from "react";
|
|
4
|
+
import { assertVariantSelected as it, RenderSession as st, createCartDetail as ot } from "@snowcone-app/sdk";
|
|
5
|
+
import { n as at, o as dt, E as lt, C as ct, y as oe, z as ae, A as ut, F as mt, G as pt, H as ft, J as ht, l as gt } from "./useCommands-C6nE770t.js";
|
|
6
|
+
import { B as yt, E as bt, o as vt, q as wt } from "./design-builder-HKRo18WT.js";
|
|
7
|
+
import { u as Et, p as kt } from "./usePieceGuideBundle-DJfjOVEd.js";
|
|
8
|
+
import { D as xt, C as St, g as Rt, e as It } from "./template-fields-3CH15MFC.js";
|
|
9
9
|
import { serializeStateForServer as ee } from "@snowcone-app/design/wire";
|
|
10
10
|
import "./ExportManager-DEJgxB0S.js";
|
|
11
|
-
const Be =
|
|
11
|
+
const Be = tt(void 0);
|
|
12
12
|
function te() {
|
|
13
|
-
const e =
|
|
13
|
+
const e = et(Be);
|
|
14
14
|
if (!e)
|
|
15
15
|
throw new Error(
|
|
16
16
|
"useRealtimeMockups / <RealtimeCanvas> / <RealtimeMockup> must be rendered inside <RealtimeEmbed>. Wrap them: <RealtimeEmbed shop=… product=… design=… grantUrl=…>…</RealtimeEmbed>"
|
|
@@ -22,24 +22,24 @@ function Ue(e) {
|
|
|
22
22
|
return Array.isArray((t = e.bundle) == null ? void 0 : t.members) && e.bundle.members.length > 0;
|
|
23
23
|
}
|
|
24
24
|
const W = "bundles";
|
|
25
|
-
function
|
|
25
|
+
function Ot(e) {
|
|
26
26
|
return Object.keys(e).sort().map((t) => `${t}:${e[t]}`).join(",");
|
|
27
27
|
}
|
|
28
28
|
function xe(e) {
|
|
29
29
|
const t = e.indexOf(".");
|
|
30
30
|
return t <= 0 || t === e.length - 1 ? null : { role: e.slice(0, t), key: e.slice(t + 1) };
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function $t(e) {
|
|
33
33
|
return e.type !== "color" && typeof e.width == "number" && e.width > 0 && typeof e.height == "number" && e.height > 0;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function Ct(e, t) {
|
|
36
36
|
var i, s;
|
|
37
37
|
const n = (s = (i = e.options) == null ? void 0 : i.combinations) == null ? void 0 : s.find((o) => o.variantId === t);
|
|
38
38
|
if (!n) return t;
|
|
39
39
|
const r = Object.entries(n).filter(([o, c]) => o !== "variantId" && o !== "price" && (typeof c == "string" || typeof c == "number")).map(([o, c]) => `${o} ${String(c)}`);
|
|
40
40
|
return r.length > 0 ? r.join(" · ") : t;
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function Nn(e, t = {}) {
|
|
43
43
|
var x, w, T, _, V;
|
|
44
44
|
if (!Ue(e))
|
|
45
45
|
throw new I(
|
|
@@ -87,7 +87,7 @@ function _n(e, t = {}) {
|
|
|
87
87
|
}
|
|
88
88
|
s[h.role] = M, o[h.role] = ((V = (_ = A.variants) == null ? void 0 : _.find((v) => v.gvid === M)) == null ? void 0 : V.gvidForMockup) || M;
|
|
89
89
|
const X = c.filter(
|
|
90
|
-
(v) => v.role === h.role && v.memberProductId === A.productId && typeof v.key == "string" && v.key !== "" &&
|
|
90
|
+
(v) => v.role === h.role && v.memberProductId === A.productId && typeof v.key == "string" && v.key !== "" && $t(v)
|
|
91
91
|
).map((v) => ({
|
|
92
92
|
key: v.key,
|
|
93
93
|
role: h.role,
|
|
@@ -103,7 +103,7 @@ function _n(e, t = {}) {
|
|
|
103
103
|
alternatives: S,
|
|
104
104
|
pick: A.productId,
|
|
105
105
|
variantId: M,
|
|
106
|
-
variantChoices: P.map((v) => ({ gvid: v, label:
|
|
106
|
+
variantChoices: P.map((v) => ({ gvid: v, label: Ct(A, v) })),
|
|
107
107
|
placements: X
|
|
108
108
|
});
|
|
109
109
|
}
|
|
@@ -160,7 +160,7 @@ function _n(e, t = {}) {
|
|
|
160
160
|
},
|
|
161
161
|
picks: i,
|
|
162
162
|
variants: s,
|
|
163
|
-
variantToken:
|
|
163
|
+
variantToken: Ot(o),
|
|
164
164
|
roles: a,
|
|
165
165
|
placement: R,
|
|
166
166
|
placements: u,
|
|
@@ -169,7 +169,7 @@ function _n(e, t = {}) {
|
|
|
169
169
|
primaryMockupId: y[0]
|
|
170
170
|
};
|
|
171
171
|
}
|
|
172
|
-
const
|
|
172
|
+
const Nt = "[RealtimeEmbed]";
|
|
173
173
|
function pe(e) {
|
|
174
174
|
var r, i;
|
|
175
175
|
if ((r = e == null ? void 0 : e.requiredPlacements) != null && r.length)
|
|
@@ -179,10 +179,10 @@ function pe(e) {
|
|
|
179
179
|
);
|
|
180
180
|
return !!(e != null && e.variantId) || t.size > 1 ? [] : (e == null ? void 0 : e.placements) ?? [];
|
|
181
181
|
}
|
|
182
|
-
function
|
|
182
|
+
function _t(e) {
|
|
183
183
|
return !!(e != null && e.picks) || !!(e != null && e.variants);
|
|
184
184
|
}
|
|
185
|
-
function
|
|
185
|
+
function Tt(e) {
|
|
186
186
|
const t = /* @__PURE__ */ new Set();
|
|
187
187
|
for (const n of e.placements ?? []) {
|
|
188
188
|
const r = xe(n);
|
|
@@ -209,7 +209,7 @@ function Fe({ shop: e, product: t, design: n, hasGrant: r }) {
|
|
|
209
209
|
message: 'product.mockupIds is empty — pass the catalog scene codes (product.mockups[].id) you want rendered, e.g. ["FV1qjO"].'
|
|
210
210
|
}), t != null && t.options)
|
|
211
211
|
try {
|
|
212
|
-
|
|
212
|
+
it(t);
|
|
213
213
|
} catch (y) {
|
|
214
214
|
i.push({
|
|
215
215
|
severity: "error",
|
|
@@ -217,7 +217,7 @@ function Fe({ shop: e, product: t, design: n, hasGrant: r }) {
|
|
|
217
217
|
message: y instanceof Error ? y.message : String(y)
|
|
218
218
|
});
|
|
219
219
|
}
|
|
220
|
-
const s = n.toJSON(), o = s.artboards.map((y) => y.name), c =
|
|
220
|
+
const s = n.toJSON(), o = s.artboards.map((y) => y.name), c = _t(t);
|
|
221
221
|
let a = [];
|
|
222
222
|
if (c) {
|
|
223
223
|
const y = t.placements ?? [];
|
|
@@ -230,7 +230,7 @@ function Fe({ shop: e, product: t, design: n, hasGrant: r }) {
|
|
|
230
230
|
issue: "bundle-role-required",
|
|
231
231
|
message: `product ${t.productId} is a bundle, but product.variantId ("${t.variantId}") names no slot — the server refuses it (E_BUNDLE_ROLE_REQUIRED). Name the variant per role instead: product.variants = { <role>: <gvid> } (bundleToRenderConfig fills it), and leave variantId unset.`
|
|
232
232
|
});
|
|
233
|
-
const N =
|
|
233
|
+
const N = Tt(t).filter((x) => {
|
|
234
234
|
var w;
|
|
235
235
|
return !((w = t.variants) != null && w[x]);
|
|
236
236
|
});
|
|
@@ -259,9 +259,9 @@ function Fe({ shop: e, product: t, design: n, hasGrant: r }) {
|
|
|
259
259
|
message: `duplicate layer name(s) [${[...new Set(R)].join(", ")}] — useTextBinding(name) / useImageBinding(name) bind to the FIRST match, so a duplicate name makes a control edit the wrong layer. Keep names unique.`
|
|
260
260
|
}), i;
|
|
261
261
|
}
|
|
262
|
-
function
|
|
262
|
+
function At(e) {
|
|
263
263
|
for (const t of Fe(e))
|
|
264
|
-
(t.severity === "error" && t.issue !== "placement-mismatch" ? console.error : console.warn)(`${
|
|
264
|
+
(t.severity === "error" && t.issue !== "placement-mismatch" ? console.error : console.warn)(`${Nt} ${t.message}`);
|
|
265
265
|
}
|
|
266
266
|
function Pe(e, t) {
|
|
267
267
|
const n = new Set(e);
|
|
@@ -350,13 +350,13 @@ function je({ registry: e, store: t, product: n }) {
|
|
|
350
350
|
return { findings: r, parts: R };
|
|
351
351
|
}
|
|
352
352
|
const ie = [];
|
|
353
|
-
function
|
|
353
|
+
function Dt(e) {
|
|
354
354
|
return ie.push(e), () => {
|
|
355
355
|
const t = ie.indexOf(e);
|
|
356
356
|
t !== -1 && ie.splice(t, 1);
|
|
357
357
|
};
|
|
358
358
|
}
|
|
359
|
-
function
|
|
359
|
+
function _n() {
|
|
360
360
|
const e = ie[ie.length - 1];
|
|
361
361
|
if (!e)
|
|
362
362
|
throw new I(
|
|
@@ -367,10 +367,10 @@ function Tn() {
|
|
|
367
367
|
return e.compute();
|
|
368
368
|
}
|
|
369
369
|
const Me = 8e3;
|
|
370
|
-
function
|
|
370
|
+
function Lt(e) {
|
|
371
371
|
return `[RealtimeEmbed] No mockup after ${Math.round(Me / 1e3)}s. Common causes: a variant product missing \`variantId\` (pass \`product.options\` so the embed can flag it up front), a multi-placement product (the server waits for every required placement but <RealtimeEmbed> sends only "${e}" — pass \`product.requiredPlacements\` so this is flagged at mount; such products need the eject path), an unreachable or non-public asset URL in the design, or the placement "${e}" not existing on the product. The render may still arrive — this is a heads-up, not a failure.`;
|
|
372
372
|
}
|
|
373
|
-
function
|
|
373
|
+
function Bt(e) {
|
|
374
374
|
if ("grantUrl" in e && e.grantUrl)
|
|
375
375
|
return { grantUrl: e.grantUrl };
|
|
376
376
|
const t = e.grant;
|
|
@@ -423,7 +423,7 @@ function qe({ error: e, onRetry: t }) {
|
|
|
423
423
|
}
|
|
424
424
|
);
|
|
425
425
|
}
|
|
426
|
-
class
|
|
426
|
+
class Ut extends nt {
|
|
427
427
|
constructor() {
|
|
428
428
|
super(...arguments), this.state = { caught: null };
|
|
429
429
|
}
|
|
@@ -432,20 +432,20 @@ class Ft extends pt {
|
|
|
432
432
|
}
|
|
433
433
|
componentDidCatch(t) {
|
|
434
434
|
var n;
|
|
435
|
-
|
|
435
|
+
vt(t), typeof K < "u" && ((n = K.env) == null ? void 0 : n.NODE_ENV) !== "production" && console.error("[Editor.Root] contained a composition error:", t);
|
|
436
436
|
}
|
|
437
437
|
render() {
|
|
438
438
|
return this.state.caught ? /* @__PURE__ */ f(qe, { error: this.state.caught }) : this.props.children;
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
|
-
function
|
|
441
|
+
function Ft({ reportedError: e, onRetry: t, children: n }) {
|
|
442
442
|
if (e) {
|
|
443
443
|
const r = De(e) && e.code === "E_CHUNK_LOAD_FAILED";
|
|
444
444
|
return /* @__PURE__ */ f(qe, { error: e, onRetry: r ? t : void 0 });
|
|
445
445
|
}
|
|
446
|
-
return /* @__PURE__ */ f(
|
|
446
|
+
return /* @__PURE__ */ f(Ut, { reportedError: null, onRetry: t, children: n });
|
|
447
447
|
}
|
|
448
|
-
function
|
|
448
|
+
function Pt(e) {
|
|
449
449
|
const {
|
|
450
450
|
shop: t,
|
|
451
451
|
product: n,
|
|
@@ -522,13 +522,13 @@ function Vt(e) {
|
|
|
522
522
|
u.commerce.getVersion,
|
|
523
523
|
u.commerce.getVersion
|
|
524
524
|
);
|
|
525
|
-
const j = u.commerce.renderVariantId(), P =
|
|
525
|
+
const j = u.commerce.renderVariantId(), P = Et(j ?? n.variantId ?? n.defaultGvid), M = L(() => {
|
|
526
526
|
if (!P) return null;
|
|
527
527
|
const p = r.toJSON().artboards, k = p.find((O) => O.name === _) ?? p[0];
|
|
528
|
-
return
|
|
528
|
+
return kt(P, k) ?? null;
|
|
529
529
|
}, [P, r, _]), X = C(s), v = C(o), Q = C(c);
|
|
530
530
|
X.current = s, v.current = o, Q.current = c;
|
|
531
|
-
const [Se, Je] = D([]), [de, ne] = D(!0), [Re, le] = D(null), fe = !!("grantUrl" in e && e.grantUrl || "grant" in e && e.grant), he =
|
|
531
|
+
const [Se, Je] = D([]), [de, ne] = D(!0), [Re, le] = D(null), fe = !!("grantUrl" in e && e.grantUrl || "grant" in e && e.grant), he = Bt(e), Qe = "grantUrl" in he ? he.grantUrl : "getToken", Ie = `${n.productId}|${n.mockupIds.join(",")}|${n.variantId ?? ""}`, re = n.picks || n.variants ? JSON.stringify([n.picks ?? null, n.variants ?? null]) : "", Y = `${t}|${Ie}|${re}|${m}|${fe}`, ge = L(() => {
|
|
532
532
|
var O;
|
|
533
533
|
const p = Fe({ shop: t, product: n, design: r, hasGrant: fe });
|
|
534
534
|
if (R !== "throw") return p;
|
|
@@ -554,13 +554,13 @@ function Vt(e) {
|
|
|
554
554
|
var p;
|
|
555
555
|
if (R === "warn" && typeof K < "u" && ((p = K.env) == null ? void 0 : p.NODE_ENV) !== "production") {
|
|
556
556
|
if ($e.current === Y) return;
|
|
557
|
-
$e.current = Y,
|
|
557
|
+
$e.current = Y, At({ shop: t, product: n, design: r, hasGrant: fe });
|
|
558
558
|
}
|
|
559
559
|
}, [Y, R]);
|
|
560
560
|
const ce = L(
|
|
561
561
|
() => {
|
|
562
562
|
try {
|
|
563
|
-
return { session: new
|
|
563
|
+
return { session: new st({ shop: t, product: n, wsUrl: a, ...he }) };
|
|
564
564
|
} catch (p) {
|
|
565
565
|
return { error: p instanceof Error ? p.message : String(p) };
|
|
566
566
|
}
|
|
@@ -621,7 +621,7 @@ function Vt(e) {
|
|
|
621
621
|
if (!de) return;
|
|
622
622
|
const p = setTimeout(() => {
|
|
623
623
|
var O, q;
|
|
624
|
-
const k =
|
|
624
|
+
const k = Lt(m);
|
|
625
625
|
typeof K < "u" && ((O = K.env) == null ? void 0 : O.NODE_ENV) !== "production" && console.warn(k), (q = Q.current) == null || q.call(Q, { severity: "warn", issue: "slow-render", message: k });
|
|
626
626
|
}, Me);
|
|
627
627
|
return () => clearTimeout(p);
|
|
@@ -658,29 +658,29 @@ function Vt(e) {
|
|
|
658
658
|
je({ registry: u.registry, store: u.store, product: n })
|
|
659
659
|
), u.registry.validate();
|
|
660
660
|
}, [u.registry, Xe]);
|
|
661
|
-
const Ne = /* @__PURE__ */ f(
|
|
662
|
-
|
|
661
|
+
const Ne = /* @__PURE__ */ f(lt.Provider, { value: u, children: /* @__PURE__ */ f(Be.Provider, { value: Ye, children: /* @__PURE__ */ f(yt.Provider, { value: u.registry, children: /* @__PURE__ */ f(
|
|
662
|
+
bt,
|
|
663
663
|
{
|
|
664
664
|
...A ? { initialArtboardConfig: A } : {},
|
|
665
665
|
children: l
|
|
666
666
|
}
|
|
667
667
|
) }) }) });
|
|
668
|
-
return d ? /* @__PURE__ */ f(
|
|
668
|
+
return d ? /* @__PURE__ */ f(ct, { services: d, children: Ne }) : Ne;
|
|
669
669
|
}
|
|
670
670
|
function ze(e) {
|
|
671
671
|
const { design: t, product: n, onAudit: r } = e, i = `${n.productId}|${n.variantId ?? ""}`, s = C(null), o = C(null), [c, a] = D(null);
|
|
672
672
|
(s.current === null || s.current.design !== t) && (s.current = {
|
|
673
673
|
design: t,
|
|
674
674
|
internals: {
|
|
675
|
-
store: new
|
|
676
|
-
registry: new
|
|
675
|
+
store: new xt(t.toJSON()),
|
|
676
|
+
registry: new at()
|
|
677
677
|
}
|
|
678
|
-
}), (o.current === null || o.current.productIdentity !== i) && (o.current = { productIdentity: i, commerce: new
|
|
678
|
+
}), (o.current === null || o.current.productIdentity !== i) && (o.current = { productIdentity: i, commerce: new St(n) });
|
|
679
679
|
const d = L(
|
|
680
680
|
() => ({
|
|
681
681
|
...s.current.internals,
|
|
682
682
|
commerce: o.current.commerce,
|
|
683
|
-
...
|
|
683
|
+
...dt(a)
|
|
684
684
|
}),
|
|
685
685
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
686
686
|
[s.current.internals, o.current.commerce]
|
|
@@ -698,7 +698,7 @@ function ze(e) {
|
|
|
698
698
|
}),
|
|
699
699
|
[]
|
|
700
700
|
);
|
|
701
|
-
|
|
701
|
+
se(() => Dt({ compute: m }), [m]);
|
|
702
702
|
const E = C(!1);
|
|
703
703
|
return F(() => {
|
|
704
704
|
let y = !1;
|
|
@@ -711,17 +711,17 @@ function ze(e) {
|
|
|
711
711
|
}, [m]), // `display: contents` — the .sc-root scope without a layout box, so the
|
|
712
712
|
// host's grid/flex sees the parts directly (and the legacy RealtimeEmbed
|
|
713
713
|
// wrapper, which had no DOM at all, stays layout-identical).
|
|
714
|
-
/* @__PURE__ */ f("div", { className: "sc-root", style: { display: "contents" }, "data-sc-part": "root", children: /* @__PURE__ */ f(
|
|
714
|
+
/* @__PURE__ */ f("div", { className: "sc-root", style: { display: "contents" }, "data-sc-part": "root", children: /* @__PURE__ */ f(Ft, { reportedError: c, onRetry: () => a(null), children: /* @__PURE__ */ f(Pt, { ...e, internals: d, recordAudit: R }) }) });
|
|
715
715
|
}
|
|
716
|
-
let
|
|
716
|
+
let Vt = () => import("./EditorCanvasImpl-C7y7UNl1.js").then((e) => e.EditorCanvasImpl);
|
|
717
717
|
function Ke() {
|
|
718
|
-
return
|
|
718
|
+
return Vt();
|
|
719
719
|
}
|
|
720
|
-
const
|
|
721
|
-
const c =
|
|
722
|
-
|
|
720
|
+
const jt = Le(function({ children: t, maxHeight: n, floatingToolbar: r = !0, className: i, style: s }, o) {
|
|
721
|
+
const c = oe("Editor.Canvas");
|
|
722
|
+
ae("Editor.Canvas", { floatingToolbar: r });
|
|
723
723
|
const a = Ee();
|
|
724
|
-
|
|
724
|
+
se(() => c.registry.registerCanvas(a), [c.registry, a]);
|
|
725
725
|
const [d, l] = D(null);
|
|
726
726
|
return F(() => {
|
|
727
727
|
let u = !1;
|
|
@@ -770,7 +770,7 @@ const Mt = Le(function({ children: t, maxHeight: n, floatingToolbar: r = !0, cla
|
|
|
770
770
|
}
|
|
771
771
|
);
|
|
772
772
|
});
|
|
773
|
-
function
|
|
773
|
+
function Mt() {
|
|
774
774
|
const { placements: e, requiredPlacements: t, placement: n, selectPlacement: r, splitPlacement: i, linkPlacement: s } = te();
|
|
775
775
|
return L(() => {
|
|
776
776
|
const o = Pe(e, t), c = e[0] ?? n, a = o.map((l) => ({
|
|
@@ -795,7 +795,7 @@ function qt() {
|
|
|
795
795
|
};
|
|
796
796
|
}, [e, t, n, r, i, s]);
|
|
797
797
|
}
|
|
798
|
-
const
|
|
798
|
+
const qt = (e) => e.length === 2 ? "Both sides" : `All ${e.length} areas`, zt = {
|
|
799
799
|
font: "inherit",
|
|
800
800
|
fontSize: "12px",
|
|
801
801
|
color: "var(--sc-color-muted-foreground, inherit)",
|
|
@@ -806,8 +806,8 @@ const zt = (e) => e.length === 2 ? "Both sides" : `All ${e.length} areas`, Kt =
|
|
|
806
806
|
textDecoration: "underline",
|
|
807
807
|
textUnderlineOffset: "4px"
|
|
808
808
|
};
|
|
809
|
-
function
|
|
810
|
-
const { placements: r, linked: i, select: s, splitAll: o, linkAll: c } =
|
|
809
|
+
function Kt({ className: e, style: t, labels: n }) {
|
|
810
|
+
const { placements: r, linked: i, select: s, splitAll: o, linkAll: c } = Mt();
|
|
811
811
|
if (r.length < 2) return null;
|
|
812
812
|
const a = r.map((d) => d.label);
|
|
813
813
|
return /* @__PURE__ */ U(
|
|
@@ -826,7 +826,7 @@ function Gt({ className: e, style: t, labels: n }) {
|
|
|
826
826
|
"data-sc-linked": "true",
|
|
827
827
|
title: a.join(" · "),
|
|
828
828
|
style: { fontSize: "13px", fontWeight: 700, padding: "2px 8px", color: "var(--sc-color-foreground, inherit)" },
|
|
829
|
-
children: ((n == null ? void 0 : n.linked) ??
|
|
829
|
+
children: ((n == null ? void 0 : n.linked) ?? qt)(a)
|
|
830
830
|
}
|
|
831
831
|
) : r.map(({ label: d, active: l, inherited: u }) => /* @__PURE__ */ f(
|
|
832
832
|
"button",
|
|
@@ -862,7 +862,7 @@ function Gt({ className: e, style: t, labels: n }) {
|
|
|
862
862
|
"data-sc-part": "placements-link-toggle",
|
|
863
863
|
"data-sc-linked": i ? "true" : "false",
|
|
864
864
|
onClick: i ? o : c,
|
|
865
|
-
style:
|
|
865
|
+
style: zt,
|
|
866
866
|
children: i ? (n == null ? void 0 : n.customizeSeparately) ?? "Customize separately" : (n == null ? void 0 : n.useOneDesign) ?? "Use one design for all"
|
|
867
867
|
}
|
|
868
868
|
)
|
|
@@ -870,8 +870,8 @@ function Gt({ className: e, style: t, labels: n }) {
|
|
|
870
870
|
}
|
|
871
871
|
);
|
|
872
872
|
}
|
|
873
|
-
const
|
|
874
|
-
function
|
|
873
|
+
const Gt = 200, Wt = 400;
|
|
874
|
+
function Ht() {
|
|
875
875
|
return Array.from({ length: 10 }, () => ({
|
|
876
876
|
left: 2 + Math.random() * 96,
|
|
877
877
|
top: 2 + Math.random() * 96,
|
|
@@ -881,7 +881,7 @@ function Jt() {
|
|
|
881
881
|
}));
|
|
882
882
|
}
|
|
883
883
|
let Ae = !1;
|
|
884
|
-
function
|
|
884
|
+
function Jt() {
|
|
885
885
|
if (!(Ae || typeof CSS > "u" || typeof CSS.registerProperty != "function")) {
|
|
886
886
|
Ae = !0;
|
|
887
887
|
try {
|
|
@@ -894,15 +894,15 @@ function Qt() {
|
|
|
894
894
|
}
|
|
895
895
|
}
|
|
896
896
|
}
|
|
897
|
-
const Ge =
|
|
897
|
+
const Ge = rt(function({
|
|
898
898
|
visible: t = !0,
|
|
899
899
|
onExited: n,
|
|
900
900
|
variant: r = "dark"
|
|
901
901
|
}) {
|
|
902
|
-
|
|
902
|
+
Jt();
|
|
903
903
|
const [i, s] = D([]);
|
|
904
904
|
F(() => {
|
|
905
|
-
s(
|
|
905
|
+
s(Ht());
|
|
906
906
|
}, []);
|
|
907
907
|
const [o, c] = D(!1);
|
|
908
908
|
F(() => {
|
|
@@ -946,7 +946,7 @@ const Ge = ft(function({
|
|
|
946
946
|
});
|
|
947
947
|
function We(e) {
|
|
948
948
|
const [t, n] = D(!1), [r, i] = D(!1), s = C(null), o = C(null), c = C(!1);
|
|
949
|
-
c.current = t, F(() => (e ? (i(!1), o.current && clearTimeout(o.current), s.current = setTimeout(() => n(!0),
|
|
949
|
+
c.current = t, F(() => (e ? (i(!1), o.current && clearTimeout(o.current), s.current = setTimeout(() => n(!0), Gt)) : (s.current && (clearTimeout(s.current), s.current = null), c.current && (i(!0), o.current = setTimeout(() => i(!1), Wt))), () => {
|
|
950
950
|
s.current && clearTimeout(s.current), o.current && clearTimeout(o.current);
|
|
951
951
|
}), [e]);
|
|
952
952
|
const a = G(() => n(!1), []);
|
|
@@ -956,31 +956,31 @@ function We(e) {
|
|
|
956
956
|
handleExited: a
|
|
957
957
|
};
|
|
958
958
|
}
|
|
959
|
-
const
|
|
960
|
-
function
|
|
959
|
+
const Qt = we.lazy(() => import("@snowcone-app/loaders/beam").then((e) => ({ default: e.BeamLoader })));
|
|
960
|
+
function Yt(e, t) {
|
|
961
961
|
var r;
|
|
962
962
|
if (!t) return null;
|
|
963
963
|
const n = (r = e == null ? void 0 : e.mockups) == null ? void 0 : r.find((i) => (i == null ? void 0 : i.id) === t);
|
|
964
964
|
return typeof (n == null ? void 0 : n.printMask) == "string" && n.printMask ? n.printMask : null;
|
|
965
965
|
}
|
|
966
|
-
const
|
|
967
|
-
function
|
|
966
|
+
const Xt = 1.2, be = [1200, 1400, 1600, 1800, 2e3, 2500, 3e3, 4e3];
|
|
967
|
+
function Zt(e) {
|
|
968
968
|
for (const t of be)
|
|
969
969
|
if (t >= e) return t;
|
|
970
970
|
return be[be.length - 1];
|
|
971
971
|
}
|
|
972
|
-
function
|
|
973
|
-
if (!(e > 0) || !(t > 0) || t <= e *
|
|
974
|
-
const n =
|
|
972
|
+
function en(e, t) {
|
|
973
|
+
if (!(e > 0) || !(t > 0) || t <= e * Xt) return null;
|
|
974
|
+
const n = Zt(t);
|
|
975
975
|
return `[RealtimeMockup] mockup rendered at ${e}px but displayed at ~${t} device px — the preview will look soft. Pass \`product.width\` (e.g. ${n}) on the embed for a crisp preview.`;
|
|
976
976
|
}
|
|
977
|
-
function
|
|
977
|
+
function tn(e) {
|
|
978
978
|
return typeof e == "function" ? !0 : typeof e == "object" && e !== null && "$$typeof" in e && !ke(e);
|
|
979
979
|
}
|
|
980
|
-
function
|
|
980
|
+
function nn(e) {
|
|
981
981
|
if (e === void 0 || e === !0) return "auto";
|
|
982
982
|
if (e === "dark" || e === "light" || e === "host-owned" || ke(e)) return e;
|
|
983
|
-
if (
|
|
983
|
+
if (tn(e)) return { loader: e };
|
|
984
984
|
throw new I(
|
|
985
985
|
"E_PREVIEW_NO_LOADER",
|
|
986
986
|
`Editor.Preview: invalid loadingOverlay value ${JSON.stringify(e)}. 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 (the beam over a picture being edited, the rainbow before one), pass an imported loader component (loadingOverlay={BeamLoader} from "@snowcone-app/loaders/beam"), "dark" | "light" for the rainbow always, a custom ReactElement, or declare "host-owned" if the host renders its own indicator off data-sc-preview-state / <Editor.LoadingOverlay>.`,
|
|
@@ -996,8 +996,8 @@ function He({
|
|
|
996
996
|
style: s
|
|
997
997
|
}) {
|
|
998
998
|
const { mockups: o, error: c, isRendering: a, product: d } = te();
|
|
999
|
-
|
|
1000
|
-
const l =
|
|
999
|
+
ae("Editor.Preview", { ...e !== void 0 ? { mockupId: e } : {} });
|
|
1000
|
+
const l = nn(r), u = ke(l) ? l : null, b = l !== "host-owned", R = l === "auto" ? Qt : typeof l == "object" && l !== null && "loader" in l ? l.loader : null, m = C(null), E = G(() => m.current, []), { showOverlay: y, overlayVisible: g, handleExited: N } = We(
|
|
1001
1001
|
b && a
|
|
1002
1002
|
), x = C(/* @__PURE__ */ new Set()), w = e ? o.find((S) => S.mockupId === e && S.imageUrl) : o.find((S) => S.imageUrl), T = l === "light" ? "light" : R && (w != null && w.imageUrl) ? "edit" : "dark", [_, V] = D(T);
|
|
1003
1003
|
!y && _ !== T && V(T);
|
|
@@ -1006,7 +1006,7 @@ function He({
|
|
|
1006
1006
|
if (!w || typeof K > "u" || ((M = K.env) == null ? void 0 : M.NODE_ENV) === "production" || typeof window > "u" || x.current.has(w.mockupId)) return;
|
|
1007
1007
|
const B = S.currentTarget, A = B.getBoundingClientRect().width;
|
|
1008
1008
|
if (A <= 0) return;
|
|
1009
|
-
const j = Math.round(A * (window.devicePixelRatio || 1)), P =
|
|
1009
|
+
const j = Math.round(A * (window.devicePixelRatio || 1)), P = en(B.naturalWidth, j);
|
|
1010
1010
|
P && (x.current.add(w.mockupId), console.warn(P));
|
|
1011
1011
|
};
|
|
1012
1012
|
if (b) {
|
|
@@ -1044,7 +1044,7 @@ function He({
|
|
|
1044
1044
|
maskKey: w == null ? void 0 : w.mockupId,
|
|
1045
1045
|
// the scene's print mask from the catalog (RenderProduct.mockups[].printMask): the first edit covers
|
|
1046
1046
|
// only the print instead of learning it from frames
|
|
1047
|
-
maskUrl:
|
|
1047
|
+
maskUrl: Yt(d, w == null ? void 0 : w.mockupId),
|
|
1048
1048
|
fit: "cover"
|
|
1049
1049
|
}) }) }) : y && _ !== "edit" ? /* @__PURE__ */ f(
|
|
1050
1050
|
Ge,
|
|
@@ -1085,11 +1085,11 @@ function He({
|
|
|
1085
1085
|
}
|
|
1086
1086
|
) : /* @__PURE__ */ f("div", { "data-sc-part": "preview", "data-sc-preview-state": "rendering", "aria-busy": "true", style: { display: "contents" }, children: t });
|
|
1087
1087
|
}
|
|
1088
|
-
function
|
|
1089
|
-
const { layer: t, optional: n = !1, placeholder: r, className: i, style: s } = e, o =
|
|
1090
|
-
|
|
1088
|
+
function rn(e) {
|
|
1089
|
+
const { layer: t, optional: n = !1, placeholder: r, className: i, style: s } = e, o = oe("Editor.TextField");
|
|
1090
|
+
ae("Editor.TextField");
|
|
1091
1091
|
const { pushRender: c, throttleMs: a, stateStore: d } = te(), l = Ee(), u = C(null);
|
|
1092
|
-
if (!
|
|
1092
|
+
if (!wt(t))
|
|
1093
1093
|
throw new I(
|
|
1094
1094
|
"E_LAYER_TOKEN_REQUIRED",
|
|
1095
1095
|
`the \`layer\` prop must be a token minted by the design — pass layer={design.layer("name")}, not ${typeof t == "string" ? `the bare string "${t}"` : "a plain value"}. Tokens validate the name against the design's layers at mint time.`,
|
|
@@ -1111,7 +1111,7 @@ function sn(e) {
|
|
|
1111
1111
|
);
|
|
1112
1112
|
u.current = t.name;
|
|
1113
1113
|
}
|
|
1114
|
-
|
|
1114
|
+
se(() => o.registry.registerTextField(l, { name: t.name, optional: n }), [o.registry, l, t.name, n]);
|
|
1115
1115
|
const b = J(
|
|
1116
1116
|
d.subscribe,
|
|
1117
1117
|
() => d.textOf(t.name) ?? "",
|
|
@@ -1148,7 +1148,7 @@ function sn(e) {
|
|
|
1148
1148
|
}
|
|
1149
1149
|
);
|
|
1150
1150
|
}
|
|
1151
|
-
function
|
|
1151
|
+
function sn(e) {
|
|
1152
1152
|
const t = [];
|
|
1153
1153
|
for (const n of e.missingOptionKeys)
|
|
1154
1154
|
t.push(`option:${n}`);
|
|
@@ -1165,13 +1165,13 @@ function on(e) {
|
|
|
1165
1165
|
}
|
|
1166
1166
|
return e.hasRenderableElement || t.push("empty-design"), (!Number.isInteger(e.quantity) || e.quantity < 1) && t.push("quantity"), t;
|
|
1167
1167
|
}
|
|
1168
|
-
function
|
|
1168
|
+
function on(e, t) {
|
|
1169
1169
|
const n = t.getCombinations(), r = t.getAttributes();
|
|
1170
1170
|
if (Object.keys(r).length === 0 || n.length === 0) return null;
|
|
1171
1171
|
const i = Object.fromEntries(
|
|
1172
|
-
Object.entries(r).map(([s, o]) => [s, { ...o, choices:
|
|
1172
|
+
Object.entries(r).map(([s, o]) => [s, { ...o, choices: Rt(o) }])
|
|
1173
1173
|
);
|
|
1174
|
-
return
|
|
1174
|
+
return ot({
|
|
1175
1175
|
productId: e.productId,
|
|
1176
1176
|
quantity: t.getQuantity(),
|
|
1177
1177
|
selection: t.getSelection(),
|
|
@@ -1179,9 +1179,9 @@ function an(e, t) {
|
|
|
1179
1179
|
attributes: i
|
|
1180
1180
|
});
|
|
1181
1181
|
}
|
|
1182
|
-
function
|
|
1183
|
-
const { onAddToCart: t, defaultQuantity: n, children: r, className: i, style: s } = e, o =
|
|
1184
|
-
|
|
1182
|
+
function an(e) {
|
|
1183
|
+
const { onAddToCart: t, defaultQuantity: n, children: r, className: i, style: s } = e, o = oe("Editor.Buy");
|
|
1184
|
+
ae("Editor.Buy");
|
|
1185
1185
|
const { product: c, stateStore: a } = te(), d = o.commerce;
|
|
1186
1186
|
if (!(c != null && c.productId))
|
|
1187
1187
|
throw new I(
|
|
@@ -1190,7 +1190,7 @@ function dn(e) {
|
|
|
1190
1190
|
{ docSlug: "embed-mode" }
|
|
1191
1191
|
);
|
|
1192
1192
|
const l = C(!1);
|
|
1193
|
-
|
|
1193
|
+
se(() => {
|
|
1194
1194
|
l.current || (l.current = !0, typeof n == "number" && d.setQuantity(n));
|
|
1195
1195
|
}, [d]);
|
|
1196
1196
|
const u = J(a.subscribe, a.getState, a.getState), b = J(d.subscribe, d.getVersion, d.getVersion), R = J(
|
|
@@ -1198,7 +1198,7 @@ function dn(e) {
|
|
|
1198
1198
|
o.registry.getVersion,
|
|
1199
1199
|
o.registry.getVersion
|
|
1200
1200
|
), m = d.getQuantity(), E = L(
|
|
1201
|
-
() =>
|
|
1201
|
+
() => sn({
|
|
1202
1202
|
quantity: m,
|
|
1203
1203
|
missingOptionKeys: d.missingOptionKeys(),
|
|
1204
1204
|
selectionValid: d.selectionValid(),
|
|
@@ -1217,7 +1217,7 @@ function dn(e) {
|
|
|
1217
1217
|
..._ ? { variantId: _ } : {},
|
|
1218
1218
|
quantity: d.getQuantity(),
|
|
1219
1219
|
selection: d.getSelection(),
|
|
1220
|
-
cartDetail:
|
|
1220
|
+
cartDetail: on(c, d),
|
|
1221
1221
|
designState: T,
|
|
1222
1222
|
// ADR-0101: one artboard per REQUIRED placement — linked placements
|
|
1223
1223
|
// carry the base relabelled — so buy and preview are the same bytes
|
|
@@ -1253,15 +1253,15 @@ function dn(e) {
|
|
|
1253
1253
|
}
|
|
1254
1254
|
);
|
|
1255
1255
|
}
|
|
1256
|
-
function
|
|
1256
|
+
function dn({
|
|
1257
1257
|
placement: e = "docked",
|
|
1258
1258
|
className: t,
|
|
1259
1259
|
style: n
|
|
1260
1260
|
}) {
|
|
1261
|
-
const r =
|
|
1262
|
-
|
|
1261
|
+
const r = oe("Editor.Controls");
|
|
1262
|
+
ut("Editor.Controls"), ae("Editor.Controls");
|
|
1263
1263
|
const i = Ee();
|
|
1264
|
-
|
|
1264
|
+
se(
|
|
1265
1265
|
() => r.registry.registerControls(i, e),
|
|
1266
1266
|
[r.registry, i, e]
|
|
1267
1267
|
);
|
|
@@ -1269,7 +1269,7 @@ function ln({
|
|
|
1269
1269
|
return F(() => {
|
|
1270
1270
|
if (!s) return;
|
|
1271
1271
|
let a = !1;
|
|
1272
|
-
return import("./ContextualToolbars-
|
|
1272
|
+
return import("./ContextualToolbars-BG90V6-s.js").then((d) => d.s).then(
|
|
1273
1273
|
(d) => {
|
|
1274
1274
|
a || c(() => d.ContextualToolbars);
|
|
1275
1275
|
},
|
|
@@ -1297,7 +1297,7 @@ function ln({
|
|
|
1297
1297
|
}
|
|
1298
1298
|
) : null;
|
|
1299
1299
|
}
|
|
1300
|
-
function
|
|
1300
|
+
function ln({
|
|
1301
1301
|
variant: e = "dark",
|
|
1302
1302
|
className: t,
|
|
1303
1303
|
style: n
|
|
@@ -1314,8 +1314,8 @@ function cn({
|
|
|
1314
1314
|
}
|
|
1315
1315
|
) : null;
|
|
1316
1316
|
}
|
|
1317
|
-
function
|
|
1318
|
-
const t =
|
|
1317
|
+
function cn() {
|
|
1318
|
+
const t = oe("useProductSelection").commerce, n = J(t.subscribe, t.getVersion, t.getVersion), r = G((s, o) => t.select(s, o), [t]), i = G((s) => t.setQuantity(s), [t]);
|
|
1319
1319
|
return L(
|
|
1320
1320
|
() => ({
|
|
1321
1321
|
attributes: t.getAttributes(),
|
|
@@ -1337,34 +1337,34 @@ const H = {
|
|
|
1337
1337
|
/** The one provider boundary — session, design, live state, error boundary. */
|
|
1338
1338
|
Root: ze,
|
|
1339
1339
|
/** The editable artboard (the ONE lazy renderer boundary — D9). */
|
|
1340
|
-
Canvas:
|
|
1340
|
+
Canvas: jt,
|
|
1341
1341
|
/** Live product mockup. ×N under one Root is valid. */
|
|
1342
1342
|
Preview: He,
|
|
1343
1343
|
/** Placement switcher tabs (ADR-0088). Renders nothing for a
|
|
1344
1344
|
* single-placement design; headless floor = usePlacements(). */
|
|
1345
|
-
Placements:
|
|
1345
|
+
Placements: Kt,
|
|
1346
1346
|
/** Form input bound to a design text layer by typed token (T1). */
|
|
1347
|
-
TextField:
|
|
1347
|
+
TextField: rn,
|
|
1348
1348
|
/** Smart commerce part: completeness + payload assembly; submit = host callback. */
|
|
1349
|
-
Buy:
|
|
1349
|
+
Buy: an,
|
|
1350
1350
|
/** Layer list. The one editor part that works canvas-free (ADR-0085 §4). */
|
|
1351
|
-
Layers:
|
|
1351
|
+
Layers: ht,
|
|
1352
1352
|
/** Morphing contextual zone — ONE coarse part; placement docked|floating (§5). */
|
|
1353
|
-
Controls:
|
|
1353
|
+
Controls: dn,
|
|
1354
1354
|
/** Undo/redo controls. Requires Editor.Canvas. */
|
|
1355
|
-
History:
|
|
1355
|
+
History: ft,
|
|
1356
1356
|
/** The one ⋯ overflow menu. Requires Editor.Canvas. */
|
|
1357
|
-
Menu:
|
|
1357
|
+
Menu: pt,
|
|
1358
1358
|
/** The ⊕ add-element menu. Requires Editor.Canvas. */
|
|
1359
|
-
Add:
|
|
1359
|
+
Add: mt,
|
|
1360
1360
|
/** Standalone render-in-flight rainbow for host-owned preview surfaces.
|
|
1361
1361
|
* Fills its positioned parent; rides the session (canvas-free). */
|
|
1362
|
-
LoadingOverlay:
|
|
1362
|
+
LoadingOverlay: ln
|
|
1363
1363
|
};
|
|
1364
|
-
function
|
|
1364
|
+
function Tn(e) {
|
|
1365
1365
|
return /* @__PURE__ */ f(ze, { ...e, __validation: "warn" });
|
|
1366
1366
|
}
|
|
1367
|
-
const
|
|
1367
|
+
const An = Le(
|
|
1368
1368
|
function(t, n) {
|
|
1369
1369
|
const { children: r, className: i, style: s, maxHeight: o, ...c } = t, [a, d] = D(null);
|
|
1370
1370
|
return F(() => {
|
|
@@ -1389,17 +1389,17 @@ const Dn = Le(
|
|
|
1389
1389
|
);
|
|
1390
1390
|
}
|
|
1391
1391
|
);
|
|
1392
|
-
function
|
|
1392
|
+
function Dn(e) {
|
|
1393
1393
|
return /* @__PURE__ */ f(He, { ...e });
|
|
1394
1394
|
}
|
|
1395
|
-
function
|
|
1395
|
+
function Ln() {
|
|
1396
1396
|
const { mockups: e, isRendering: t, error: n } = te();
|
|
1397
1397
|
return { mockups: e, isRendering: t, error: n };
|
|
1398
1398
|
}
|
|
1399
|
-
function
|
|
1399
|
+
function un(e) {
|
|
1400
1400
|
return e.type !== "color" && typeof e.width == "number" && e.width > 0 && typeof e.height == "number" && e.height > 0;
|
|
1401
1401
|
}
|
|
1402
|
-
function
|
|
1402
|
+
function Bn(e, t = {}) {
|
|
1403
1403
|
var b, R, m, E, y;
|
|
1404
1404
|
if (Ue(e))
|
|
1405
1405
|
throw new I(
|
|
@@ -1411,7 +1411,7 @@ function Un(e, t = {}) {
|
|
|
1411
1411
|
docSlug: "bundles"
|
|
1412
1412
|
}
|
|
1413
1413
|
);
|
|
1414
|
-
const n = (e.placements ?? []).filter(
|
|
1414
|
+
const n = (e.placements ?? []).filter(un), r = n.map((g) => g.label), i = t.placement ? n.find((g) => g.label === t.placement) : n[0];
|
|
1415
1415
|
if (!i)
|
|
1416
1416
|
throw t.placement ? new I(
|
|
1417
1417
|
"E_PRODUCT_NOT_RENDERABLE",
|
|
@@ -1468,7 +1468,7 @@ function Un(e, t = {}) {
|
|
|
1468
1468
|
variantId: c
|
|
1469
1469
|
};
|
|
1470
1470
|
}
|
|
1471
|
-
function
|
|
1471
|
+
function mn(e) {
|
|
1472
1472
|
return new Intl.NumberFormat("en-US", {
|
|
1473
1473
|
style: "currency",
|
|
1474
1474
|
currency: "USD",
|
|
@@ -1476,7 +1476,7 @@ function pn(e) {
|
|
|
1476
1476
|
maximumFractionDigits: e % 100 === 0 ? 0 : 2
|
|
1477
1477
|
}).format(e / 100);
|
|
1478
1478
|
}
|
|
1479
|
-
const
|
|
1479
|
+
const pn = {
|
|
1480
1480
|
display: "inline-flex",
|
|
1481
1481
|
alignItems: "center",
|
|
1482
1482
|
justifyContent: "center",
|
|
@@ -1491,7 +1491,7 @@ const fn = {
|
|
|
1491
1491
|
fontSize: 16,
|
|
1492
1492
|
lineHeight: 1,
|
|
1493
1493
|
cursor: "pointer"
|
|
1494
|
-
},
|
|
1494
|
+
}, fn = {
|
|
1495
1495
|
display: "flex",
|
|
1496
1496
|
alignItems: "center",
|
|
1497
1497
|
gap: 10,
|
|
@@ -1517,13 +1517,13 @@ function ve({
|
|
|
1517
1517
|
type: "button",
|
|
1518
1518
|
role: "menuitem",
|
|
1519
1519
|
"data-sc-part": "snowcone-editor-menu-item",
|
|
1520
|
-
style:
|
|
1520
|
+
style: fn,
|
|
1521
1521
|
onClick: t,
|
|
1522
1522
|
children: e
|
|
1523
1523
|
}
|
|
1524
1524
|
);
|
|
1525
1525
|
}
|
|
1526
|
-
function
|
|
1526
|
+
function hn({
|
|
1527
1527
|
fullscreen: e,
|
|
1528
1528
|
onToggleFullscreen: t,
|
|
1529
1529
|
viewCount: n,
|
|
@@ -1541,12 +1541,12 @@ function gn({
|
|
|
1541
1541
|
"aria-haspopup": "menu",
|
|
1542
1542
|
"aria-expanded": o,
|
|
1543
1543
|
"data-sc-part": "snowcone-editor-menu",
|
|
1544
|
-
style:
|
|
1544
|
+
style: pn,
|
|
1545
1545
|
onClick: () => c((d) => !d),
|
|
1546
1546
|
children: "⋮"
|
|
1547
1547
|
}
|
|
1548
1548
|
),
|
|
1549
|
-
o ? /* @__PURE__ */ U(
|
|
1549
|
+
o ? /* @__PURE__ */ U(Ze, { children: [
|
|
1550
1550
|
/* @__PURE__ */ f(
|
|
1551
1551
|
"div",
|
|
1552
1552
|
{
|
|
@@ -1608,8 +1608,8 @@ function gn({
|
|
|
1608
1608
|
] }) : null
|
|
1609
1609
|
] });
|
|
1610
1610
|
}
|
|
1611
|
-
function
|
|
1612
|
-
const { flatLayers: e, selectLayer: t, generateAllPreviews: n } =
|
|
1611
|
+
function gn() {
|
|
1612
|
+
const { flatLayers: e, selectLayer: t, generateAllPreviews: n } = gt({ previewSize: 96 });
|
|
1613
1613
|
return F(() => {
|
|
1614
1614
|
e.length > 0 && n();
|
|
1615
1615
|
}, [e.length, n]), /* @__PURE__ */ U(
|
|
@@ -1665,11 +1665,11 @@ function yn() {
|
|
|
1665
1665
|
}
|
|
1666
1666
|
);
|
|
1667
1667
|
}
|
|
1668
|
-
function
|
|
1668
|
+
function yn({
|
|
1669
1669
|
onAddToCart: e,
|
|
1670
1670
|
defaultQuantity: t
|
|
1671
1671
|
}) {
|
|
1672
|
-
const { price: n, complete: r } =
|
|
1672
|
+
const { price: n, complete: r } = cn();
|
|
1673
1673
|
return /* @__PURE__ */ U(
|
|
1674
1674
|
H.Buy,
|
|
1675
1675
|
{
|
|
@@ -1694,12 +1694,12 @@ function bn({
|
|
|
1694
1694
|
},
|
|
1695
1695
|
children: [
|
|
1696
1696
|
"Add to cart",
|
|
1697
|
-
typeof n == "number" ? ` · ${
|
|
1697
|
+
typeof n == "number" ? ` · ${mn(n)}` : ""
|
|
1698
1698
|
]
|
|
1699
1699
|
}
|
|
1700
1700
|
);
|
|
1701
1701
|
}
|
|
1702
|
-
function
|
|
1702
|
+
function bn({
|
|
1703
1703
|
title: e,
|
|
1704
1704
|
height: t,
|
|
1705
1705
|
mockupIds: n,
|
|
@@ -1708,7 +1708,7 @@ function vn({
|
|
|
1708
1708
|
className: s,
|
|
1709
1709
|
style: o
|
|
1710
1710
|
}) {
|
|
1711
|
-
const [c, a] = D(!1), [d, l] = D(0), [u, b] = D(!1), R = C(null), m =
|
|
1711
|
+
const [c, a] = D(!1), [d, l] = D(0), [u, b] = D(!1), R = C(null), m = It(), E = n[Math.min(d, n.length - 1)], y = G(async () => {
|
|
1712
1712
|
var V;
|
|
1713
1713
|
const x = await ((V = R.current) == null ? void 0 : V.exportArtboards({ format: "dataUrl" }));
|
|
1714
1714
|
if (!x) return;
|
|
@@ -1775,7 +1775,7 @@ function vn({
|
|
|
1775
1775
|
/* @__PURE__ */ f("span", { style: { fontSize: 14, fontWeight: 700, marginRight: "auto" }, children: e }),
|
|
1776
1776
|
/* @__PURE__ */ f(H.History, {}),
|
|
1777
1777
|
/* @__PURE__ */ f(
|
|
1778
|
-
|
|
1778
|
+
hn,
|
|
1779
1779
|
{
|
|
1780
1780
|
fullscreen: c,
|
|
1781
1781
|
onToggleFullscreen: () => a((x) => !x),
|
|
@@ -1785,7 +1785,7 @@ function vn({
|
|
|
1785
1785
|
onExport: () => void y()
|
|
1786
1786
|
}
|
|
1787
1787
|
),
|
|
1788
|
-
/* @__PURE__ */ f(
|
|
1788
|
+
/* @__PURE__ */ f(yn, { onAddToCart: r, defaultQuantity: i })
|
|
1789
1789
|
]
|
|
1790
1790
|
}
|
|
1791
1791
|
),
|
|
@@ -1879,7 +1879,7 @@ function vn({
|
|
|
1879
1879
|
style: { flexShrink: 0, padding: "4px 16px 14px" },
|
|
1880
1880
|
children: [
|
|
1881
1881
|
/* @__PURE__ */ f("div", { style: { display: m ? void 0 : "none" }, children: /* @__PURE__ */ f(H.Controls, { placement: "docked" }) }),
|
|
1882
|
-
m ? null : /* @__PURE__ */ f(
|
|
1882
|
+
m ? null : /* @__PURE__ */ f(gn, {})
|
|
1883
1883
|
]
|
|
1884
1884
|
}
|
|
1885
1885
|
)
|
|
@@ -1887,7 +1887,7 @@ function vn({
|
|
|
1887
1887
|
}
|
|
1888
1888
|
);
|
|
1889
1889
|
}
|
|
1890
|
-
function
|
|
1890
|
+
function Un(e) {
|
|
1891
1891
|
const {
|
|
1892
1892
|
onAddToCart: t,
|
|
1893
1893
|
defaultQuantity: n,
|
|
@@ -1898,7 +1898,7 @@ function Fn(e) {
|
|
|
1898
1898
|
...c
|
|
1899
1899
|
} = e;
|
|
1900
1900
|
return /* @__PURE__ */ f(H.Root, { ...c, children: /* @__PURE__ */ f(
|
|
1901
|
-
|
|
1901
|
+
bn,
|
|
1902
1902
|
{
|
|
1903
1903
|
title: r,
|
|
1904
1904
|
height: i,
|
|
@@ -1910,26 +1910,25 @@ function Fn(e) {
|
|
|
1910
1910
|
}
|
|
1911
1911
|
) });
|
|
1912
1912
|
}
|
|
1913
|
-
lt();
|
|
1914
1913
|
export {
|
|
1915
1914
|
H as E,
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1915
|
+
An as R,
|
|
1916
|
+
Un as S,
|
|
1917
|
+
Tn as a,
|
|
1918
|
+
Dn as b,
|
|
1919
|
+
_n as c,
|
|
1920
|
+
Nn as d,
|
|
1921
|
+
Ot as e,
|
|
1923
1922
|
Fe as f,
|
|
1924
|
-
|
|
1925
|
-
|
|
1923
|
+
mn as g,
|
|
1924
|
+
_t as h,
|
|
1926
1925
|
Ue as i,
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1926
|
+
Mt as j,
|
|
1927
|
+
cn as k,
|
|
1928
|
+
Ln as l,
|
|
1929
|
+
Bn as p,
|
|
1931
1930
|
xe as s,
|
|
1932
1931
|
te as u,
|
|
1933
|
-
|
|
1932
|
+
At as v
|
|
1934
1933
|
};
|
|
1935
|
-
//# sourceMappingURL=embed-
|
|
1934
|
+
//# sourceMappingURL=embed-CYlEe_Xv.js.map
|