@snowcone-app/canvas 0.42.1 → 0.43.1
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 +45 -0
- package/dist/{CanvasRenderer-Bm7KLh38.js → CanvasRenderer-DnYgiWjt.js} +2 -2
- package/dist/{CanvasRenderer-Bm7KLh38.js.map → CanvasRenderer-DnYgiWjt.js.map} +1 -1
- package/dist/{CanvasStateV1-DPSSkdyD.js → CanvasStateV1-B51bXTyy.js} +2 -2
- package/dist/{CanvasStateV1-DPSSkdyD.js.map → CanvasStateV1-B51bXTyy.js.map} +1 -1
- package/dist/{ContextualToolbars-BuWJ3vD8.js → ContextualToolbars-DtlxDatY.js} +4 -4
- package/dist/{ContextualToolbars-BuWJ3vD8.js.map → ContextualToolbars-DtlxDatY.js.map} +1 -1
- package/dist/{EditorCanvasImpl-CtiIZyyt.js → EditorCanvasImpl-B5IEg9tq.js} +6 -6
- package/dist/{EditorCanvasImpl-CtiIZyyt.js.map → EditorCanvasImpl-B5IEg9tq.js.map} +1 -1
- package/dist/{ExportManager-DCEgNCL-.js → ExportManager-vAuaoF5Q.js} +1212 -1224
- package/dist/{ExportManager-DCEgNCL-.js.map → ExportManager-vAuaoF5Q.js.map} +1 -1
- package/dist/FontAnalyzer-D9R2PYsy.js.map +1 -1
- package/dist/{ImagePanel-WLkHhuBY.js → ImagePanel-kybrF6yT.js} +3 -3
- package/dist/{ImagePanel-WLkHhuBY.js.map → ImagePanel-kybrF6yT.js.map} +1 -1
- package/dist/SnowconeCanvas-rAUrO9PR.js +1157 -0
- package/dist/SnowconeCanvas-rAUrO9PR.js.map +1 -0
- package/dist/advanced.mjs +9 -9
- package/dist/api/embed.d.ts +1 -0
- package/dist/api/stable.d.ts +1 -0
- package/dist/components/embed/SnowconeCanvas.d.ts +13 -0
- package/dist/{custom-icons-B3auKmXj.js → custom-icons-Dlfrg3A_.js} +2 -2
- package/dist/{custom-icons-B3auKmXj.js.map → custom-icons-Dlfrg3A_.js.map} +1 -1
- package/dist/design/template-fields.d.ts +5 -0
- package/dist/{embed-hQtKIv0u.js → embed-BXa1jr7S.js} +7 -7
- package/dist/{embed-hQtKIv0u.js.map → embed-BXa1jr7S.js.map} +1 -1
- package/dist/embed.mjs +5 -5
- package/dist/errors/editorError.d.ts +4 -1
- package/dist/index.mjs +7 -7
- package/dist/internals.mjs +4 -4
- package/dist/{template-fields-pasAAplQ.js → template-fields-ZZEdYB5H.js} +44 -43
- package/dist/{template-fields-pasAAplQ.js.map → template-fields-ZZEdYB5H.js.map} +1 -1
- package/dist/{useCommands-htOtw7w6.js → useCommands-d5UM6Cnc.js} +5 -5
- package/dist/{useCommands-htOtw7w6.js.map → useCommands-d5UM6Cnc.js.map} +1 -1
- package/dist/utils/ExportManager.d.ts +37 -1
- package/dist/utils/printFiles.d.ts +23 -0
- package/dist/{validation-m6hAaElF.js → validation-C8qNtk6j.js} +9 -9
- package/dist/{validation-m6hAaElF.js.map → validation-C8qNtk6j.js.map} +1 -1
- package/example/package.json +1 -1
- package/package.json +2 -2
- package/dist/SnowconeCanvas-1wc08k_m.js +0 -1098
- package/dist/SnowconeCanvas-1wc08k_m.js.map +0 -1
|
@@ -0,0 +1,1157 @@
|
|
|
1
|
+
import { p as ee, c as te, u as ze, t as ae, I as Ge, v as Ue, x as Ve, y as Xe } from "./FontAnalyzer-D9R2PYsy.js";
|
|
2
|
+
import { jsx as v, Fragment as Je, jsxs as _ } from "react/jsx-runtime";
|
|
3
|
+
import Qe, { useMemo as Re, useRef as N, useEffect as S, Component as Ye, useState as oe, useCallback as V, useImperativeHandle as Ze, forwardRef as Ce } from "react";
|
|
4
|
+
import { a as qe, b as _e, c as et, G as tt, d as rt, Z as nt, g as at, e as ot, D as st, r as it, v as ct, S as lt, K as dt, f as ut } from "./validation-C8qNtk6j.js";
|
|
5
|
+
import { ImagePanel as ft } from "./ImagePanel-kybrF6yT.js";
|
|
6
|
+
import { C as mt, a as gt } from "./ContextualToolbars-DtlxDatY.js";
|
|
7
|
+
import { n as ht, o as pt, E as bt, C as vt, b as he, k as Et } from "./useCommands-d5UM6Cnc.js";
|
|
8
|
+
import { C as yt, D as xt } from "./template-fields-ZZEdYB5H.js";
|
|
9
|
+
import { E as wt, b as se, i as It, l as At, j as Ie } from "./design-builder-C8s1r4MF.js";
|
|
10
|
+
import { T as Ae } from "./ThemeContext-Rjz25x9X.js";
|
|
11
|
+
import { c as St } from "./placement-tSiIVhrL.js";
|
|
12
|
+
import { a as kt, G as ce, E as Me, H as Ft } from "./ExportManager-vAuaoF5Q.js";
|
|
13
|
+
import { C as fe } from "./CanvasRenderer-DnYgiWjt.js";
|
|
14
|
+
const pe = te("KitLayout"), ne = "canvas", me = 320;
|
|
15
|
+
let Se = !1;
|
|
16
|
+
function Rt() {
|
|
17
|
+
Se || (Se = !0, qe({
|
|
18
|
+
EffectsPanel: _e,
|
|
19
|
+
ExportPanel: et,
|
|
20
|
+
ImagePanel: ft,
|
|
21
|
+
GlyphPanel: tt,
|
|
22
|
+
ArtboardTabs: rt,
|
|
23
|
+
ContextualToolbars: mt,
|
|
24
|
+
ZoomControls: nt,
|
|
25
|
+
CropPanel: gt
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
function Ct({ children: r }) {
|
|
29
|
+
const n = N(null);
|
|
30
|
+
if (n.current === null) {
|
|
31
|
+
const e = new ht();
|
|
32
|
+
e.registerCanvas("legacy-kit-canvas"), n.current = {
|
|
33
|
+
store: new xt({ elements: [], artboards: [], activeArtboard: "" }),
|
|
34
|
+
commerce: new yt({ productId: "", mockupIds: [] }),
|
|
35
|
+
registry: e,
|
|
36
|
+
...pt((a) => pe.error("[kit section]", a))
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return /* @__PURE__ */ v(bt.Provider, { value: n.current, children: r });
|
|
40
|
+
}
|
|
41
|
+
function le({ ids: r }) {
|
|
42
|
+
return !r || r.length === 0 ? null : /* @__PURE__ */ v(Ct, { children: r.map((n) => {
|
|
43
|
+
var t;
|
|
44
|
+
if (n === ne) return null;
|
|
45
|
+
const e = at(n);
|
|
46
|
+
if (!e)
|
|
47
|
+
return typeof ee < "u" && ((t = ee.env) == null ? void 0 : t.NODE_ENV) === "development" && pe.warn(
|
|
48
|
+
`Kit layout references unknown section "${n}" — skipping. Register it with registerSection("${n}", { ... }).`
|
|
49
|
+
), null;
|
|
50
|
+
const a = e.component;
|
|
51
|
+
return /* @__PURE__ */ v(a, {}, n);
|
|
52
|
+
}) });
|
|
53
|
+
}
|
|
54
|
+
function Mt({ kit: r, canvas: n }) {
|
|
55
|
+
var b, d, E, y;
|
|
56
|
+
Rt();
|
|
57
|
+
const e = r.layout.slots, a = !!((b = e.topbar) != null && b.some((x) => x !== ne)), t = !!((d = e.left) != null && d.some((x) => x !== ne)), o = !!((E = e.right) != null && E.some((x) => x !== ne)), l = !!((y = e.bottombar) != null && y.some((x) => x !== ne)), u = Re(
|
|
58
|
+
() => !a && !t && !o && !l,
|
|
59
|
+
[a, t, o, l]
|
|
60
|
+
), s = N(null), f = a || t || o || l, h = N(!1);
|
|
61
|
+
return S(() => {
|
|
62
|
+
var i;
|
|
63
|
+
if (typeof ee > "u" || ((i = ee.env) == null ? void 0 : i.NODE_ENV) !== "development" || !f) return;
|
|
64
|
+
const x = s.current;
|
|
65
|
+
if (!x || typeof ResizeObserver > "u") return;
|
|
66
|
+
const $ = (g) => {
|
|
67
|
+
g > 0 && g < me && !h.current ? (h.current = !0, pe.warn(
|
|
68
|
+
`Kit "${r.name}" declares chrome (toolbar / panels) but its container is only ${Math.round(g)}px wide — below the ~${me}px needed to render it, so the toolbar / panels are suppressed and the editor looks like a bare canvas. Give the editor more container width, or pass kit="embed-only" if a chrome-less canvas is intended.`
|
|
69
|
+
)) : g >= me && (h.current = !1);
|
|
70
|
+
};
|
|
71
|
+
$(x.getBoundingClientRect().width);
|
|
72
|
+
const M = new ResizeObserver((g) => {
|
|
73
|
+
for (const w of g) $(w.contentRect.width);
|
|
74
|
+
});
|
|
75
|
+
return M.observe(x), () => M.disconnect();
|
|
76
|
+
}, [f, r.name]), u ? /* @__PURE__ */ v(Je, { children: n }) : /* @__PURE__ */ _("div", { ref: s, className: "sc-kit-layout", style: { display: "flex", flexDirection: "column", height: "100%", minHeight: 0 }, children: [
|
|
77
|
+
a && /* @__PURE__ */ v(
|
|
78
|
+
"div",
|
|
79
|
+
{
|
|
80
|
+
className: "sc-kit-topbar sc-toolbar",
|
|
81
|
+
style: { display: "flex", alignItems: "center", gap: 8, flexWrap: "wrap", flexShrink: 0 },
|
|
82
|
+
children: /* @__PURE__ */ v(le, { ids: e.topbar })
|
|
83
|
+
}
|
|
84
|
+
),
|
|
85
|
+
/* @__PURE__ */ _("div", { className: "sc-kit-body", style: { display: "flex", flex: 1, minHeight: 0 }, children: [
|
|
86
|
+
t && /* @__PURE__ */ v("div", { className: "sc-kit-left", style: { flexShrink: 0, overflow: "auto" }, children: /* @__PURE__ */ v(le, { ids: e.left }) }),
|
|
87
|
+
/* @__PURE__ */ v("div", { className: "sc-kit-canvas", style: { flex: 1, minWidth: 0, position: "relative" }, children: n }),
|
|
88
|
+
o && /* @__PURE__ */ v("div", { className: "sc-kit-right", style: { flexShrink: 0, overflow: "auto" }, children: /* @__PURE__ */ v(le, { ids: e.right }) })
|
|
89
|
+
] }),
|
|
90
|
+
l && /* @__PURE__ */ v(
|
|
91
|
+
"div",
|
|
92
|
+
{
|
|
93
|
+
className: "sc-kit-bottombar sc-toolbar",
|
|
94
|
+
style: { display: "flex", alignItems: "center", gap: 8, flexShrink: 0 },
|
|
95
|
+
children: /* @__PURE__ */ v(le, { ids: e.bottombar })
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
] });
|
|
99
|
+
}
|
|
100
|
+
const Tt = te("ErrorBoundary");
|
|
101
|
+
class Nt extends Ye {
|
|
102
|
+
constructor(n) {
|
|
103
|
+
super(n), this.resetError = () => {
|
|
104
|
+
this.setState({
|
|
105
|
+
hasError: !1,
|
|
106
|
+
error: null
|
|
107
|
+
});
|
|
108
|
+
}, this.state = {
|
|
109
|
+
hasError: !1,
|
|
110
|
+
error: null
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
static getDerivedStateFromError(n) {
|
|
114
|
+
return {
|
|
115
|
+
hasError: !0,
|
|
116
|
+
error: n
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
componentDidCatch(n, e) {
|
|
120
|
+
if (Tt.error("Caught error:", n, e), this.props.onError && this.props.onError(n, e), this.props.onCanvasError) {
|
|
121
|
+
const a = {
|
|
122
|
+
category: "unknown",
|
|
123
|
+
message: n.message,
|
|
124
|
+
originalError: n,
|
|
125
|
+
recoverable: !1
|
|
126
|
+
};
|
|
127
|
+
this.props.onCanvasError(a);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
render() {
|
|
131
|
+
return this.state.hasError && this.state.error ? this.props.renderError ? this.props.renderError(this.state.error, this.resetError) : this.props.fallback ? typeof this.props.fallback == "function" ? this.props.fallback(this.state.error, this.resetError) : this.props.fallback : /* @__PURE__ */ _(
|
|
132
|
+
"div",
|
|
133
|
+
{
|
|
134
|
+
style: {
|
|
135
|
+
padding: "24px",
|
|
136
|
+
border: "2px solid var(--danger)",
|
|
137
|
+
borderRadius: "8px",
|
|
138
|
+
backgroundColor: "color-mix(in oklch, var(--danger) 10%, var(--background))",
|
|
139
|
+
color: "var(--danger)",
|
|
140
|
+
fontFamily: "system-ui, sans-serif"
|
|
141
|
+
},
|
|
142
|
+
children: [
|
|
143
|
+
/* @__PURE__ */ v("h2", { style: { margin: "0 0 16px 0", fontSize: "18px", fontWeight: 600 }, children: "Something went wrong" }),
|
|
144
|
+
/* @__PURE__ */ v(
|
|
145
|
+
"pre",
|
|
146
|
+
{
|
|
147
|
+
style: {
|
|
148
|
+
margin: "0 0 16px 0",
|
|
149
|
+
padding: "12px",
|
|
150
|
+
backgroundColor: "color-mix(in oklch, var(--danger) 15%, var(--background))",
|
|
151
|
+
borderRadius: "4px",
|
|
152
|
+
fontSize: "14px",
|
|
153
|
+
overflow: "auto",
|
|
154
|
+
maxHeight: "200px"
|
|
155
|
+
},
|
|
156
|
+
children: this.state.error.message
|
|
157
|
+
}
|
|
158
|
+
),
|
|
159
|
+
/* @__PURE__ */ v(
|
|
160
|
+
"button",
|
|
161
|
+
{
|
|
162
|
+
onClick: this.resetError,
|
|
163
|
+
style: {
|
|
164
|
+
padding: "8px 16px",
|
|
165
|
+
backgroundColor: "var(--danger)",
|
|
166
|
+
color: "var(--danger-foreground)",
|
|
167
|
+
border: "none",
|
|
168
|
+
borderRadius: "4px",
|
|
169
|
+
fontSize: "14px",
|
|
170
|
+
fontWeight: 500,
|
|
171
|
+
cursor: "pointer"
|
|
172
|
+
},
|
|
173
|
+
children: "Try again"
|
|
174
|
+
}
|
|
175
|
+
)
|
|
176
|
+
]
|
|
177
|
+
}
|
|
178
|
+
) : this.props.children;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
function Lt({
|
|
182
|
+
inheritTheme: r,
|
|
183
|
+
externalProvider: n,
|
|
184
|
+
services: e,
|
|
185
|
+
viewPadding: a,
|
|
186
|
+
children: t
|
|
187
|
+
}) {
|
|
188
|
+
const o = n ? /* @__PURE__ */ v(Ae, { defaultTheme: "light", passive: r, children: t }) : /* @__PURE__ */ v(Ae, { defaultTheme: "light", passive: r, children: /* @__PURE__ */ v(wt, { viewPadding: a, children: t }) });
|
|
189
|
+
return e ? /* @__PURE__ */ v(vt, { services: e, children: o }) : o;
|
|
190
|
+
}
|
|
191
|
+
const Pt = te("useAutoExport");
|
|
192
|
+
function $t(r) {
|
|
193
|
+
const { config: n, historyManager: e, artboards: a, elements: t, onExport: o, onExportScheduled: l, isCanvasReady: u = !1 } = r, s = N(null), f = N(!1), h = N({
|
|
194
|
+
totalExports: 0,
|
|
195
|
+
skippedExports: 0,
|
|
196
|
+
lastExportTime: null,
|
|
197
|
+
avgExportInterval: 0
|
|
198
|
+
}), [b, d] = oe(h.current), E = N(o);
|
|
199
|
+
E.current = o, S(() => {
|
|
200
|
+
const i = new ot({
|
|
201
|
+
...st,
|
|
202
|
+
...n
|
|
203
|
+
});
|
|
204
|
+
return i.onExport(async () => {
|
|
205
|
+
try {
|
|
206
|
+
await E.current(), h.current = i.getStats();
|
|
207
|
+
} catch (g) {
|
|
208
|
+
Pt.error("[useAutoExport] Export failed:", g);
|
|
209
|
+
}
|
|
210
|
+
}), s.current = i, () => {
|
|
211
|
+
i.destroy();
|
|
212
|
+
};
|
|
213
|
+
}, []), S(() => {
|
|
214
|
+
u && f.current && s.current && (f.current = !1, s.current.forceExport());
|
|
215
|
+
}, [u]), S(() => {
|
|
216
|
+
s.current && n && s.current.updateConfig(n);
|
|
217
|
+
}, [n == null ? void 0 : n.enabled, n == null ? void 0 : n.debounceMs, n == null ? void 0 : n.maxWaitMs]), S(() => {
|
|
218
|
+
s.current && l && s.current.onExportScheduled(l);
|
|
219
|
+
}, [l]), S(() => {
|
|
220
|
+
if (!e || !s.current)
|
|
221
|
+
return;
|
|
222
|
+
const i = e.onCommandExecuted(() => {
|
|
223
|
+
if (s.current) {
|
|
224
|
+
if (!u) {
|
|
225
|
+
f.current = !0;
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
s.current.scheduleExport();
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
return () => {
|
|
232
|
+
i();
|
|
233
|
+
};
|
|
234
|
+
}, [e, u]), S(() => {
|
|
235
|
+
if (s.current) {
|
|
236
|
+
if (!u) {
|
|
237
|
+
f.current = !0;
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
s.current.scheduleExport();
|
|
241
|
+
}
|
|
242
|
+
}, [t, a, u]), S(() => ze((g) => {
|
|
243
|
+
if (!s.current || !u) return;
|
|
244
|
+
t.some((I) => I.id === g) && s.current.scheduleExport();
|
|
245
|
+
}), [t, u]);
|
|
246
|
+
const y = V((i) => {
|
|
247
|
+
s.current && s.current.updateConfig(i);
|
|
248
|
+
}, []), x = V(async () => {
|
|
249
|
+
s.current && (await s.current.forceExport(), h.current = s.current.getStats(), d(h.current));
|
|
250
|
+
}, []), $ = V(() => {
|
|
251
|
+
s.current && (s.current.resetStats(), h.current = s.current.getStats(), d(h.current));
|
|
252
|
+
}, []), M = V(() => {
|
|
253
|
+
s.current && s.current.resetChangeDetection();
|
|
254
|
+
}, []);
|
|
255
|
+
return {
|
|
256
|
+
stats: b,
|
|
257
|
+
updateConfig: y,
|
|
258
|
+
forceExport: x,
|
|
259
|
+
resetStats: $,
|
|
260
|
+
resetChangeDetection: M
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
const Te = te("useContentReady");
|
|
264
|
+
function Dt(r) {
|
|
265
|
+
var e;
|
|
266
|
+
const n = /* @__PURE__ */ new Set();
|
|
267
|
+
for (const a of r)
|
|
268
|
+
if ("fontFamily" in a && typeof a.fontFamily == "string" && a.fontFamily && n.add(a.fontFamily), "getRichText" in a && typeof a.getRichText == "function")
|
|
269
|
+
try {
|
|
270
|
+
const t = a.getRichText();
|
|
271
|
+
if (t != null && t.spans)
|
|
272
|
+
for (const o of t.spans)
|
|
273
|
+
(e = o.style) != null && e.fontFamily && n.add(o.style.fontFamily);
|
|
274
|
+
} catch {
|
|
275
|
+
}
|
|
276
|
+
return Array.from(n);
|
|
277
|
+
}
|
|
278
|
+
async function Ot(r) {
|
|
279
|
+
if (r.length === 0 || typeof document > "u" || !document.fonts) return;
|
|
280
|
+
const n = [];
|
|
281
|
+
for (const e of r) {
|
|
282
|
+
const a = `16px "${e}"`;
|
|
283
|
+
n.push(document.fonts.load(a));
|
|
284
|
+
}
|
|
285
|
+
await Promise.all(n), document.fonts.ready && await Promise.race([
|
|
286
|
+
document.fonts.ready,
|
|
287
|
+
new Promise((e) => setTimeout(e, 250))
|
|
288
|
+
]), Te.debug(`Awaited ${n.length} font(s)`);
|
|
289
|
+
}
|
|
290
|
+
function Bt() {
|
|
291
|
+
return new Promise((r) => requestAnimationFrame(() => r()));
|
|
292
|
+
}
|
|
293
|
+
function Wt(r) {
|
|
294
|
+
const { isCanvasReady: n, elements: e, hasInitialElements: a, initialElementsLoaded: t } = r, [o, l] = oe(!1), u = N(!1);
|
|
295
|
+
return S(() => {
|
|
296
|
+
if (o || !n || a && !t || a && e.length === 0 || u.current) return;
|
|
297
|
+
u.current = !0;
|
|
298
|
+
let s = !1;
|
|
299
|
+
return (async () => {
|
|
300
|
+
try {
|
|
301
|
+
const f = Dt(e);
|
|
302
|
+
if (f.length > 0 && (await Ot(f), s) || (await Bt(), s)) return;
|
|
303
|
+
l(!0);
|
|
304
|
+
} catch (f) {
|
|
305
|
+
Te.error("Error during content readiness check:", f), s || l(!0);
|
|
306
|
+
} finally {
|
|
307
|
+
u.current = !1;
|
|
308
|
+
}
|
|
309
|
+
})(), () => {
|
|
310
|
+
s = !0, u.current = !1;
|
|
311
|
+
};
|
|
312
|
+
}, [n, e, a, t, o]), o;
|
|
313
|
+
}
|
|
314
|
+
const ke = /^#[0-9a-fA-F]{6}$/, q = (r, n, e) => typeof r == "number" && Number.isFinite(r) && r >= n && r <= e;
|
|
315
|
+
function Ht(r, n) {
|
|
316
|
+
if (!r || r.length === 0) return [];
|
|
317
|
+
if (!n)
|
|
318
|
+
throw new ae(
|
|
319
|
+
"E_INITIAL_TEXT_NO_IMAGE",
|
|
320
|
+
"initialImageText places words on the first picture, and no initialImage was given. Pass the picture as initialImage (the words go where they belong on it), or pass the whole design as initialElements and leave initialImageText out.",
|
|
321
|
+
{ docSlug: "initial-image-text" }
|
|
322
|
+
);
|
|
323
|
+
return r.forEach((e, a) => {
|
|
324
|
+
var o;
|
|
325
|
+
const t = [];
|
|
326
|
+
if ((typeof (e == null ? void 0 : e.text) != "string" || e.text.trim() === "") && t.push("text is a non-empty string"), (typeof (e == null ? void 0 : e.fontFamily) != "string" || e.fontFamily.trim() === "") && t.push("fontFamily is a Google Fonts family"), (typeof (e == null ? void 0 : e.color) != "string" || !ke.test(e.color)) && t.push('color is "#rrggbb"'), q(e == null ? void 0 : e.fontSize, 1e-3, 2) || t.push("fontSize is a share of the picture's height, above 0"), (e == null ? void 0 : e.letterSpacing) !== void 0 && !q(e.letterSpacing, -1, 1) && t.push("letterSpacing is a share of the picture's height"), q(e == null ? void 0 : e.left, -1, 2) || t.push("left is a share of the picture's width"), (e == null ? void 0 : e.width) !== void 0 && !q(e.width, 0, 3) && t.push("width is a share of the picture's width"), (e == null ? void 0 : e.align) !== void 0 && e.align !== "left" && e.align !== "center" && e.align !== "right" && t.push('align is "left" | "center" | "right"'), ((e == null ? void 0 : e.align) === "center" || (e == null ? void 0 : e.align) === "right") && (e == null ? void 0 : e.width) === void 0 && t.push(`align "${e.align}" needs the line's width`), q(e == null ? void 0 : e.baseline, -1, 2) || t.push("baseline is a share of the picture's height"), (e == null ? void 0 : e.stroke) !== void 0 && (typeof ((o = e.stroke) == null ? void 0 : o.color) != "string" || !ke.test(e.stroke.color) || !q(e.stroke.width, 1e-4, 1)) && t.push(`stroke is { color: "#rrggbb", width: a share of the picture's height, above 0 }`), t.length > 0)
|
|
327
|
+
throw new ae("E_INITIAL_TEXT_INVALID", `initialImageText[${a}]: ${t.join("; ")}.`, { docSlug: "initial-image-text", index: a });
|
|
328
|
+
}), r;
|
|
329
|
+
}
|
|
330
|
+
function Kt(r, n, e) {
|
|
331
|
+
const a = r.fontSize * n.height, t = (r.letterSpacing ?? 0) * n.height, o = e(r.text, a, r.fontFamily, t), l = n.left + r.left * n.width, u = (r.width ?? 0) * n.width, s = r.align === "center" ? l + u / 2 : r.align === "right" ? l + u - o.advance / 2 : l + o.advance / 2, f = n.top + r.baseline * n.height;
|
|
332
|
+
return {
|
|
333
|
+
transformType: "custom",
|
|
334
|
+
name: r.name ?? r.text,
|
|
335
|
+
text: r.text,
|
|
336
|
+
fontFamily: r.fontFamily,
|
|
337
|
+
fontSize: a,
|
|
338
|
+
color: r.color,
|
|
339
|
+
textAlign: "center",
|
|
340
|
+
...t !== 0 ? { letterSpacing: t } : {},
|
|
341
|
+
...r.stroke ? { stroke: { enabled: !0, color: r.stroke.color, width: r.stroke.width * n.height, lineJoin: "round", lineCap: "round" } } : {},
|
|
342
|
+
x: s,
|
|
343
|
+
y: f - o.ascent + (o.ascent + o.descent) / 2,
|
|
344
|
+
rotation: 0,
|
|
345
|
+
// Room past the measured advance: the editor wraps a line at its box, and measures spaced letters a little
|
|
346
|
+
// wider when it wraps than when it measures (a spaced "BRIDE SQUAD" broke onto two lines at its exact width).
|
|
347
|
+
transformData: { type: "custom", controlPoints: [], width: Math.ceil(o.advance + 2 * Math.abs(t) + 0.5 * a) }
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
const jt = 1e4;
|
|
351
|
+
function Ne(r) {
|
|
352
|
+
const n = [];
|
|
353
|
+
for (const e of r) {
|
|
354
|
+
e instanceof Ge && n.push(e);
|
|
355
|
+
const a = e.children;
|
|
356
|
+
Array.isArray(a) && n.push(...Ne(a));
|
|
357
|
+
}
|
|
358
|
+
return n;
|
|
359
|
+
}
|
|
360
|
+
async function zt(r, n, e) {
|
|
361
|
+
const a = Date.now();
|
|
362
|
+
for (; ; ) {
|
|
363
|
+
const t = Ne(n.filter((l) => l.visible !== !1)).filter((l) => !l.imageElement || !l.imageLoaded);
|
|
364
|
+
if (t.length === 0) return;
|
|
365
|
+
const o = t.filter((l) => l.imageLoadState === "error");
|
|
366
|
+
if (o.length > 0 || Date.now() - a > e) {
|
|
367
|
+
const l = (o.length > 0 ? o : t).map((u) => u.id);
|
|
368
|
+
throw new ae(
|
|
369
|
+
"E_PRINT_FILE_FAILED",
|
|
370
|
+
`the print file of "${r.name}" needs every picture on it, and ${l.join(", ")} ${o.length > 0 ? "failed to load" : `has not loaded after ${e} ms`}: remove or re-add that picture, then ask again.`,
|
|
371
|
+
{ artboard: r.name, elements: l, state: o.length > 0 ? "error" : "loading" }
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
await new Promise((l) => setTimeout(l, 100));
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
async function Gt(r, n, e = {}, a = {}) {
|
|
378
|
+
var l, u;
|
|
379
|
+
const t = r.map((s) => s.name);
|
|
380
|
+
for (const s of Object.keys(e.regions ?? {}))
|
|
381
|
+
if (!t.includes(s))
|
|
382
|
+
throw new ae("E_PRINT_FILE_FAILED", `regions name the artboard "${s}", which is not one of [${t.join(", ")}].`, {
|
|
383
|
+
artboard: s,
|
|
384
|
+
validNames: t
|
|
385
|
+
});
|
|
386
|
+
const o = {};
|
|
387
|
+
for (const s of r) {
|
|
388
|
+
const f = n(s);
|
|
389
|
+
await zt(s, f, a.imageWaitMs ?? jt);
|
|
390
|
+
const h = (l = e.regions) == null ? void 0 : l[s.name], b = h ? h.map((d) => ({ key: d.id, region: d })) : [{ key: s.name }];
|
|
391
|
+
for (const { key: d, region: E } of b) {
|
|
392
|
+
if (d in o)
|
|
393
|
+
throw new ae("E_PRINT_FILE_FAILED", `two print files are keyed "${d}": region ids and artboard names must all differ.`, { key: d });
|
|
394
|
+
o[d] = await kt.exportPrintFile(s, f, { scale: ((u = e.scale) == null ? void 0 : u[d]) ?? 1, region: E });
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
return o;
|
|
398
|
+
}
|
|
399
|
+
const Q = te("SnowconeCanvas");
|
|
400
|
+
function ge(r, n, e, a) {
|
|
401
|
+
if (a <= 0 || !isFinite(a))
|
|
402
|
+
return e;
|
|
403
|
+
const t = r * e, o = n * e;
|
|
404
|
+
if (Math.max(t, o) <= a)
|
|
405
|
+
return e;
|
|
406
|
+
const u = Math.max(r, n), s = a / u;
|
|
407
|
+
return Math.min(s, e);
|
|
408
|
+
}
|
|
409
|
+
function Ut(r) {
|
|
410
|
+
const n = N(r);
|
|
411
|
+
n.current = r;
|
|
412
|
+
const e = V((t) => {
|
|
413
|
+
var o;
|
|
414
|
+
Q.error(`[${t.category}] ${t.message}`, t.originalError), (o = n.current) == null || o.call(n, t);
|
|
415
|
+
}, []);
|
|
416
|
+
S(() => (fe.onRenderError = e, () => {
|
|
417
|
+
fe.onRenderError === e && (fe.onRenderError = null);
|
|
418
|
+
}), [e]);
|
|
419
|
+
const a = V((t) => {
|
|
420
|
+
e({
|
|
421
|
+
category: "unknown",
|
|
422
|
+
message: t.message,
|
|
423
|
+
originalError: t,
|
|
424
|
+
recoverable: !1
|
|
425
|
+
});
|
|
426
|
+
}, [e]);
|
|
427
|
+
return { emitError: e, handleBoundaryError: a };
|
|
428
|
+
}
|
|
429
|
+
function Vt(r) {
|
|
430
|
+
const {
|
|
431
|
+
artboardConfigs: n,
|
|
432
|
+
width: e,
|
|
433
|
+
height: a,
|
|
434
|
+
pieceGuides: t,
|
|
435
|
+
controlledActiveArtboard: o,
|
|
436
|
+
onArtboardChange: l,
|
|
437
|
+
resetDocumentOnMount: u
|
|
438
|
+
} = r, {
|
|
439
|
+
setElements: s,
|
|
440
|
+
setSelectedId: f,
|
|
441
|
+
setMultiSelection: h,
|
|
442
|
+
artboardManager: b,
|
|
443
|
+
refreshArtboards: d
|
|
444
|
+
} = se(), { createArtboard: E, selectArtboard: y, artboards: x } = he(), $ = N(!1), M = N(!1);
|
|
445
|
+
S(() => {
|
|
446
|
+
if ($.current) return;
|
|
447
|
+
$.current = !0;
|
|
448
|
+
const i = n || [{ name: "Design", width: e, height: a }], g = t ? "transparent" : void 0, w = (c) => c.exportBackground ?? (!!c.backgroundColor && c.backgroundColor !== "transparent"), I = () => {
|
|
449
|
+
for (const c of b.getAllArtboards())
|
|
450
|
+
c.imageFit = It(i.find((m) => m.name === c.name));
|
|
451
|
+
};
|
|
452
|
+
if (u) {
|
|
453
|
+
b.clear(), s([]), f(null), h([]);
|
|
454
|
+
for (const m of i)
|
|
455
|
+
b.createArtboard({
|
|
456
|
+
name: m.name,
|
|
457
|
+
width: m.width,
|
|
458
|
+
height: m.height,
|
|
459
|
+
backgroundColor: m.backgroundColor ?? g,
|
|
460
|
+
exportBackground: w(m),
|
|
461
|
+
clipShape: m.clipShape,
|
|
462
|
+
role: m.role
|
|
463
|
+
});
|
|
464
|
+
const c = b.getAllArtboards();
|
|
465
|
+
c.length > 0 && !o && b.setActiveArtboard(c[0].id), I(), d();
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
const p = b.getAllArtboards();
|
|
469
|
+
if (p.length > 0) {
|
|
470
|
+
const c = i[0], m = p[0];
|
|
471
|
+
m.name = c.name, m.width = c.width, m.height = c.height, m.clipShape = c.clipShape, m.exportBackground = w(c), m.role = c.role, c.backgroundColor ? m.backgroundColor = c.backgroundColor : g && (m.backgroundColor = g);
|
|
472
|
+
for (let A = 1; A < i.length; A++)
|
|
473
|
+
E(i[A].width, i[A].height, {
|
|
474
|
+
name: i[A].name,
|
|
475
|
+
backgroundColor: i[A].backgroundColor ?? g,
|
|
476
|
+
exportBackground: w(i[A]),
|
|
477
|
+
clipShape: i[A].clipShape,
|
|
478
|
+
role: i[A].role
|
|
479
|
+
});
|
|
480
|
+
!o && i.length > 1 && b.setActiveArtboard(m.id);
|
|
481
|
+
}
|
|
482
|
+
I(), d();
|
|
483
|
+
}, []), S(() => {
|
|
484
|
+
if (!o) {
|
|
485
|
+
M.current = !0;
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
const i = x.find((g) => g.name === o);
|
|
489
|
+
if (i) {
|
|
490
|
+
const g = b.getActiveArtboard();
|
|
491
|
+
(g == null ? void 0 : g.name) !== o && y(i.id), M.current = !0;
|
|
492
|
+
}
|
|
493
|
+
}, [o, x]), S(() => {
|
|
494
|
+
if (!l || !M.current) return;
|
|
495
|
+
const i = b.getActiveArtboard();
|
|
496
|
+
i && l(i.name);
|
|
497
|
+
}, [b.getActiveArtboardId()]);
|
|
498
|
+
}
|
|
499
|
+
function Xt(r) {
|
|
500
|
+
const { initialElements: n, emitError: e, customFonts: a } = r, { setElements: t, artboardManager: o } = se(), l = N(!1), [u, s] = oe(!1), f = N(!0);
|
|
501
|
+
return S(() => (f.current = !0, () => {
|
|
502
|
+
f.current = !1;
|
|
503
|
+
}), []), S(() => {
|
|
504
|
+
if (!(!n || n.length === 0) && !l.current) {
|
|
505
|
+
l.current = !0, s(!0);
|
|
506
|
+
try {
|
|
507
|
+
a && a.length > 0 && ce.register(a);
|
|
508
|
+
const h = Me.createManyFromJSON(n), b = o.getAllArtboards();
|
|
509
|
+
if (b.length > 0) {
|
|
510
|
+
const E = new Map(b.map((y) => [y.name, y]));
|
|
511
|
+
h.forEach((y, x) => {
|
|
512
|
+
var i;
|
|
513
|
+
const $ = (i = n[x]) == null ? void 0 : i.artboard, M = $ && E.get($) || b[0];
|
|
514
|
+
o.addElementToArtboard(y.id, M.id);
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
t(h);
|
|
518
|
+
const d = /* @__PURE__ */ new Set();
|
|
519
|
+
for (const E of h) {
|
|
520
|
+
const y = E.fontFamily;
|
|
521
|
+
typeof y == "string" && y.trim().length > 0 && d.add(y);
|
|
522
|
+
}
|
|
523
|
+
if (d.size > 0 && typeof document < "u") {
|
|
524
|
+
const E = document.fonts ?? null, y = Array.from(d).filter(
|
|
525
|
+
(i) => ce.has(i)
|
|
526
|
+
), x = Ft(
|
|
527
|
+
ce.forFamilies(y),
|
|
528
|
+
{
|
|
529
|
+
onLoadError: (i) => {
|
|
530
|
+
f.current && e({
|
|
531
|
+
category: "import",
|
|
532
|
+
message: i.message,
|
|
533
|
+
originalError: i,
|
|
534
|
+
recoverable: !0
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
), M = Array.from(d).filter(
|
|
539
|
+
(i) => !ce.has(i)
|
|
540
|
+
).map((i) => {
|
|
541
|
+
const g = `font-${i.replace(/\s+/g, "-").toLowerCase()}`;
|
|
542
|
+
let w = document.getElementById(g);
|
|
543
|
+
return w || (w = document.createElement("link"), w.id = g, w.rel = "stylesheet", w.href = `https://fonts.googleapis.com/css2?family=${i.replace(
|
|
544
|
+
/\s+/g,
|
|
545
|
+
"+"
|
|
546
|
+
)}:wght@400;700&display=swap`, document.head.appendChild(w)), new Promise((I) => {
|
|
547
|
+
if (w.sheet) {
|
|
548
|
+
I(i);
|
|
549
|
+
return;
|
|
550
|
+
}
|
|
551
|
+
const p = () => I(i);
|
|
552
|
+
w.addEventListener("load", p, { once: !0 }), w.addEventListener("error", p, { once: !0 }), setTimeout(p, 4e3);
|
|
553
|
+
});
|
|
554
|
+
});
|
|
555
|
+
Promise.all([Promise.all(M), x]).then(([i]) => {
|
|
556
|
+
if (!(!f.current || !E))
|
|
557
|
+
return Promise.all(
|
|
558
|
+
i.flatMap((g) => [
|
|
559
|
+
E.load(`400 16px "${g}"`).catch(() => {
|
|
560
|
+
}),
|
|
561
|
+
E.load(`700 16px "${g}"`).catch(() => {
|
|
562
|
+
})
|
|
563
|
+
])
|
|
564
|
+
);
|
|
565
|
+
}).then(() => {
|
|
566
|
+
f.current && t((i) => i.slice());
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
} catch (h) {
|
|
570
|
+
Q.error("Failed to load initial elements:", h);
|
|
571
|
+
const b = h instanceof Error ? h : new Error(String(h));
|
|
572
|
+
e({
|
|
573
|
+
category: "import",
|
|
574
|
+
message: `Failed to load initial elements: ${b.message}`,
|
|
575
|
+
originalError: b,
|
|
576
|
+
recoverable: !0
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
}, [n, o, t, e, a]), { initialElementsLoadedState: u };
|
|
581
|
+
}
|
|
582
|
+
function Jt(r) {
|
|
583
|
+
const {
|
|
584
|
+
initialImage: n,
|
|
585
|
+
initialImageText: e,
|
|
586
|
+
initialImageAlignment: a,
|
|
587
|
+
initialImageScale: t,
|
|
588
|
+
initialImageScaleMode: o,
|
|
589
|
+
initialImageRole: l,
|
|
590
|
+
artboardConfigs: u,
|
|
591
|
+
onImageLoad: s,
|
|
592
|
+
onImageError: f,
|
|
593
|
+
emitError: h
|
|
594
|
+
} = r, { elements: b, setElements: d, artboardManager: E } = se(), [y, x] = oe("idle"), [$, M] = oe(null), i = N(void 0);
|
|
595
|
+
return S(() => {
|
|
596
|
+
if (!n || i.current === n) return;
|
|
597
|
+
if (b.length > 0) {
|
|
598
|
+
i.current = n;
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
601
|
+
i.current = n, (async () => {
|
|
602
|
+
x("loading"), M(null);
|
|
603
|
+
try {
|
|
604
|
+
const w = E.getAllArtboards();
|
|
605
|
+
if (w.length === 0)
|
|
606
|
+
throw new Error("No artboards available");
|
|
607
|
+
const I = [];
|
|
608
|
+
for (const p of w) {
|
|
609
|
+
const c = u == null ? void 0 : u.find((T) => T.name === p.name), m = (c == null ? void 0 : c.scaleMode) || o, A = (c == null ? void 0 : c.imageRegions) ?? [];
|
|
610
|
+
if (A.length > 0) {
|
|
611
|
+
const T = await At(n);
|
|
612
|
+
if (!T.success || !T.width || !T.height) {
|
|
613
|
+
Q.error("Failed to load image for artboard:", p.name, T.error);
|
|
614
|
+
continue;
|
|
615
|
+
}
|
|
616
|
+
for (const W of A) {
|
|
617
|
+
const L = St(T.width / T.height, W), H = await Ie(
|
|
618
|
+
n,
|
|
619
|
+
{
|
|
620
|
+
artboard: { width: L.width, height: L.height, x: p.x + L.centerX - L.width / 2, y: p.y + L.centerY - L.height / 2 },
|
|
621
|
+
alignment: "center",
|
|
622
|
+
scale: 1,
|
|
623
|
+
scaleMode: "cover"
|
|
624
|
+
},
|
|
625
|
+
{ transformData: { type: "image", width: L.width, height: L.height, cropX: L.cropX, cropY: L.cropY, cropWidth: L.cropWidth, cropHeight: L.cropHeight } }
|
|
626
|
+
);
|
|
627
|
+
H.success && H.element ? (E.addElementToArtboard(H.element.id, p.id), I.push(H.element)) : Q.error("Failed to load image for a panel of artboard:", p.name, H.error);
|
|
628
|
+
}
|
|
629
|
+
continue;
|
|
630
|
+
}
|
|
631
|
+
const k = await Ie(
|
|
632
|
+
n,
|
|
633
|
+
{
|
|
634
|
+
artboard: {
|
|
635
|
+
width: p.width,
|
|
636
|
+
height: p.height,
|
|
637
|
+
x: p.x,
|
|
638
|
+
y: p.y
|
|
639
|
+
},
|
|
640
|
+
alignment: (c == null ? void 0 : c.fitAlign) || a,
|
|
641
|
+
scale: t,
|
|
642
|
+
scaleMode: m,
|
|
643
|
+
marginTop: c == null ? void 0 : c.fitMarginTop,
|
|
644
|
+
marginRight: c == null ? void 0 : c.fitMarginRight,
|
|
645
|
+
marginBottom: c == null ? void 0 : c.fitMarginBottom,
|
|
646
|
+
marginLeft: c == null ? void 0 : c.fitMarginLeft
|
|
647
|
+
}
|
|
648
|
+
);
|
|
649
|
+
k.success && k.element ? (E.addElementToArtboard(k.element.id, p.id), I.push(k.element)) : Q.error("Failed to load image for artboard:", p.name, k.error);
|
|
650
|
+
}
|
|
651
|
+
if (e.length > 0 && I.length > 0) {
|
|
652
|
+
const p = await Zt(Array.from(new Set(e.map((m) => m.fontFamily))));
|
|
653
|
+
for (const m of p)
|
|
654
|
+
h({
|
|
655
|
+
category: "import",
|
|
656
|
+
message: `E_FONT_LOAD_FAILED: the font "${m}" for initialImageText could not be loaded; its words are drawn in a fallback font until it loads.`,
|
|
657
|
+
recoverable: !0
|
|
658
|
+
});
|
|
659
|
+
const c = (m, A, k, T) => {
|
|
660
|
+
const W = Ue(A, k);
|
|
661
|
+
return { advance: Ve(m, A, k, !1, !1, T), ascent: W.ascent, descent: W.descent };
|
|
662
|
+
};
|
|
663
|
+
for (const m of I.slice()) {
|
|
664
|
+
const A = E.getArtboardForElement(m.id), k = m.transformData, T = (k == null ? void 0 : k.width) ?? 0, W = (k == null ? void 0 : k.height) ?? 0;
|
|
665
|
+
if (!A || !(T > 0) || !(W > 0)) continue;
|
|
666
|
+
const L = { left: m.x - T / 2, top: m.y - W / 2, width: T, height: W };
|
|
667
|
+
for (const H of e) {
|
|
668
|
+
const Y = Me.createFromJSON(Kt(H, L, c));
|
|
669
|
+
E.addElementToArtboard(Y.id, A.id), I.push(Y);
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
if (I.length > 0)
|
|
674
|
+
l === "placeholder" && E.markPlaceholders(I.map((p) => p.id)), d((p) => [...p, ...I]), x("success"), s == null || s(n);
|
|
675
|
+
else {
|
|
676
|
+
const p = new Error("Failed to load image into any artboard");
|
|
677
|
+
x("error"), M(p), f == null || f(n, p), h({
|
|
678
|
+
category: "image",
|
|
679
|
+
message: p.message,
|
|
680
|
+
originalError: p,
|
|
681
|
+
recoverable: !0
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
} catch (w) {
|
|
685
|
+
const I = w instanceof Error ? w : new Error(String(w));
|
|
686
|
+
x("error"), M(I), f == null || f(n, I), h({
|
|
687
|
+
category: "image",
|
|
688
|
+
message: I.message,
|
|
689
|
+
originalError: I,
|
|
690
|
+
recoverable: !0
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
})();
|
|
694
|
+
}, [n, e, a, t, o, l]), { imageLoadingState: y, imageError: $ };
|
|
695
|
+
}
|
|
696
|
+
function Qt(r) {
|
|
697
|
+
const { onChange: n, onSelectionChange: e } = r, { elements: a, selectedId: t, artboardManager: o } = se(), { artboards: l } = he(), u = N(e);
|
|
698
|
+
u.current = e, S(() => {
|
|
699
|
+
var f;
|
|
700
|
+
(f = u.current) == null || f.call(u, t);
|
|
701
|
+
}, [t]);
|
|
702
|
+
const s = N(n);
|
|
703
|
+
s.current = n, S(() => {
|
|
704
|
+
const f = s.current;
|
|
705
|
+
if (!f) return;
|
|
706
|
+
const h = o.getActiveArtboard(), b = {
|
|
707
|
+
// Stamp each element with the NAME of the artboard it lives on (the
|
|
708
|
+
// manager is the membership source of truth). Without this the public
|
|
709
|
+
// state is flat and a multi-placement design cannot round-trip: restore
|
|
710
|
+
// collapses everything onto the first artboard, and per-placement render
|
|
711
|
+
// states can't be derived from onChange. Pinned by
|
|
712
|
+
// SnowconeCanvas.artboard-membership.test.tsx.
|
|
713
|
+
elements: a.map((d) => {
|
|
714
|
+
const E = d.toJSON(), y = o.getArtboardForElement(d.id);
|
|
715
|
+
return y ? { ...E, artboard: y.name } : E;
|
|
716
|
+
}),
|
|
717
|
+
artboards: l.map((d) => ({
|
|
718
|
+
name: d.name,
|
|
719
|
+
width: d.width,
|
|
720
|
+
height: d.height,
|
|
721
|
+
clipShape: d.clipShape,
|
|
722
|
+
backgroundColor: d.backgroundColor,
|
|
723
|
+
// Carried so serializeStateForServer / saved states keep an
|
|
724
|
+
// explicitly-set background renderable (mockup matches editor).
|
|
725
|
+
exportBackground: d.exportBackground,
|
|
726
|
+
// Pacing role for multi-page templates (ADR-0086) — emitted only when
|
|
727
|
+
// set so non-template states stay byte-identical.
|
|
728
|
+
...d.role ? { role: d.role } : {}
|
|
729
|
+
})),
|
|
730
|
+
activeArtboard: (h == null ? void 0 : h.name) || "Design"
|
|
731
|
+
};
|
|
732
|
+
f(b);
|
|
733
|
+
}, [a, l]);
|
|
734
|
+
}
|
|
735
|
+
function Yt(r, n) {
|
|
736
|
+
const {
|
|
737
|
+
autoExportInterval: e,
|
|
738
|
+
autoExportConfig: a,
|
|
739
|
+
autoExportFormat: t,
|
|
740
|
+
autoExportAll: o,
|
|
741
|
+
exportScale: l,
|
|
742
|
+
maxExportSize: u,
|
|
743
|
+
exportImageFormat: s,
|
|
744
|
+
exportImageQuality: f,
|
|
745
|
+
onExport: h,
|
|
746
|
+
onExportScheduled: b,
|
|
747
|
+
onExportStatus: d,
|
|
748
|
+
onExportReady: E,
|
|
749
|
+
onReady: y,
|
|
750
|
+
hasInitialElements: x,
|
|
751
|
+
initialElementsLoaded: $,
|
|
752
|
+
emitError: M
|
|
753
|
+
} = r, {
|
|
754
|
+
elements: i,
|
|
755
|
+
artboardManager: g,
|
|
756
|
+
historyManager: w,
|
|
757
|
+
isCanvasReady: I,
|
|
758
|
+
setCanvasReady: p
|
|
759
|
+
} = se(), { artboards: c } = he(), { exportArtboard: m, exportAllArtboards: A, exportArtboardAsBlob: k, exportAllArtboardsAsBlobs: T } = Et(), W = N(0), L = N(0), H = N(i);
|
|
760
|
+
H.current = i, Ze(n, () => ({
|
|
761
|
+
exportArtboards: async (D = {}) => {
|
|
762
|
+
const P = D.format || t, B = D.scale || l, K = D.all ?? !1;
|
|
763
|
+
let j = B;
|
|
764
|
+
if (u > 0 && isFinite(u))
|
|
765
|
+
for (const C of c) {
|
|
766
|
+
const R = ge(C.width, C.height, B, u);
|
|
767
|
+
j = Math.min(j, R);
|
|
768
|
+
}
|
|
769
|
+
const F = { scale: j, format: s, quality: f };
|
|
770
|
+
if (K) {
|
|
771
|
+
const C = P === "blob" ? await T(F) : await A(F), R = {};
|
|
772
|
+
for (const [O, X] of Object.entries(C)) {
|
|
773
|
+
const z = c.find((J) => J.id === O);
|
|
774
|
+
z && (R[z.name] = X);
|
|
775
|
+
}
|
|
776
|
+
return R;
|
|
777
|
+
} else {
|
|
778
|
+
const C = g.getActiveArtboard();
|
|
779
|
+
if (!C)
|
|
780
|
+
throw new Error("[SnowconeCanvas] No active artboard found");
|
|
781
|
+
if (P === "blob") {
|
|
782
|
+
const R = await k(C.id, F);
|
|
783
|
+
return { [C.name]: R };
|
|
784
|
+
} else {
|
|
785
|
+
const R = await m(C.id, F);
|
|
786
|
+
return { [C.name]: R };
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
},
|
|
790
|
+
// Print files: every artboard (or its regions), lossless PNG, full size, original picture pixels, one at a time.
|
|
791
|
+
// Never the auto-export's format / maxExportSize: those keep the live preview light, a print file is the product.
|
|
792
|
+
exportPrintFiles: (D = {}) => Gt(
|
|
793
|
+
c,
|
|
794
|
+
(P) => {
|
|
795
|
+
const B = new Set(g.getElementsOnArtboard(P.id));
|
|
796
|
+
return H.current.filter((K) => B.has(K.id));
|
|
797
|
+
},
|
|
798
|
+
D
|
|
799
|
+
)
|
|
800
|
+
}), [m, A, k, T, t, l, u, s, f, g, c]), S(() => {
|
|
801
|
+
E && E(async () => {
|
|
802
|
+
const P = g.getActiveArtboard();
|
|
803
|
+
if (!P)
|
|
804
|
+
throw new Error("[SnowconeCanvas] No active artboard found");
|
|
805
|
+
const B = ge(
|
|
806
|
+
P.width,
|
|
807
|
+
P.height,
|
|
808
|
+
l,
|
|
809
|
+
u
|
|
810
|
+
), K = t === "blob" ? await k(P.id, { scale: B }) : await m(P.id, { scale: B });
|
|
811
|
+
return { [P.name]: K };
|
|
812
|
+
});
|
|
813
|
+
}, [E, m, k, g, t, l, u]);
|
|
814
|
+
const Y = V(async () => {
|
|
815
|
+
if (!h && !d) return;
|
|
816
|
+
const D = ++L.current, P = Date.now();
|
|
817
|
+
let B = l;
|
|
818
|
+
if (u > 0 && isFinite(u))
|
|
819
|
+
for (const F of c) {
|
|
820
|
+
const C = ge(F.width, F.height, l, u);
|
|
821
|
+
B = Math.min(B, C);
|
|
822
|
+
}
|
|
823
|
+
const K = g.getActiveArtboard(), j = (K == null ? void 0 : K.id) ?? "unknown";
|
|
824
|
+
d == null || d({ status: "rendering", artboardId: j }), W.current = P;
|
|
825
|
+
try {
|
|
826
|
+
let F;
|
|
827
|
+
const C = {
|
|
828
|
+
format: s,
|
|
829
|
+
scale: B,
|
|
830
|
+
quality: f
|
|
831
|
+
};
|
|
832
|
+
if (t === "blob")
|
|
833
|
+
if (o) {
|
|
834
|
+
const R = await T(C);
|
|
835
|
+
F = {};
|
|
836
|
+
for (const [O, X] of Object.entries(R)) {
|
|
837
|
+
const z = c.find((J) => J.id === O);
|
|
838
|
+
z && (F[z.name] = X);
|
|
839
|
+
}
|
|
840
|
+
} else {
|
|
841
|
+
const R = g.getActiveArtboard();
|
|
842
|
+
if (!R) return;
|
|
843
|
+
const O = await k(R.id, C);
|
|
844
|
+
F = { [R.name]: O };
|
|
845
|
+
}
|
|
846
|
+
else if (o) {
|
|
847
|
+
const R = await A(C);
|
|
848
|
+
F = {};
|
|
849
|
+
for (const [O, X] of Object.entries(R)) {
|
|
850
|
+
const z = c.find((J) => J.id === O);
|
|
851
|
+
z && (F[z.name] = X);
|
|
852
|
+
}
|
|
853
|
+
} else {
|
|
854
|
+
const R = g.getActiveArtboard();
|
|
855
|
+
if (!R) return;
|
|
856
|
+
const O = await m(R.id, C);
|
|
857
|
+
F = { [R.name]: O };
|
|
858
|
+
}
|
|
859
|
+
h == null || h(F), d == null || d({ status: "complete", artboardId: j, result: F });
|
|
860
|
+
} catch (F) {
|
|
861
|
+
const C = F instanceof Error ? F.message : String(F);
|
|
862
|
+
if (C.includes("Canvas ref not available"))
|
|
863
|
+
return;
|
|
864
|
+
const R = Date.now() - P;
|
|
865
|
+
Q.error("Export failed (export #" + D + "):", {
|
|
866
|
+
duration: `${R}ms`,
|
|
867
|
+
error: C
|
|
868
|
+
});
|
|
869
|
+
const O = F instanceof Error ? F : new Error(C);
|
|
870
|
+
d == null || d({ status: "error", artboardId: j, error: O }), M({
|
|
871
|
+
category: "export",
|
|
872
|
+
message: O.message,
|
|
873
|
+
originalError: O,
|
|
874
|
+
artboardId: j,
|
|
875
|
+
recoverable: !0
|
|
876
|
+
});
|
|
877
|
+
}
|
|
878
|
+
}, [h, d, o, t, l, u, s, f, m, A, k, T, c, g, i, a, M]);
|
|
879
|
+
S(() => {
|
|
880
|
+
e !== void 0 && e > 0 && Q.warn(
|
|
881
|
+
"autoExportInterval is deprecated and ignored. Use autoExportConfig={{ enabled: true, debounceMs: 100, maxWaitMs: 1000 }} instead."
|
|
882
|
+
);
|
|
883
|
+
}, []);
|
|
884
|
+
const de = V(() => {
|
|
885
|
+
if (b == null || b(), d) {
|
|
886
|
+
const D = g.getActiveArtboard();
|
|
887
|
+
d({ status: "scheduled", artboardId: (D == null ? void 0 : D.id) ?? "unknown" });
|
|
888
|
+
}
|
|
889
|
+
}, [b, d, g]), re = Wt({
|
|
890
|
+
isCanvasReady: I,
|
|
891
|
+
elements: i,
|
|
892
|
+
hasInitialElements: x,
|
|
893
|
+
initialElementsLoaded: $
|
|
894
|
+
}), ie = N(!1);
|
|
895
|
+
S(() => {
|
|
896
|
+
re && !ie.current && (ie.current = !0, y == null || y());
|
|
897
|
+
}, [re, y]), $t({
|
|
898
|
+
config: a ? {
|
|
899
|
+
enabled: a.enabled ?? !0,
|
|
900
|
+
debounceMs: a.debounceMs ?? 100,
|
|
901
|
+
maxWaitMs: a.maxWaitMs ?? 1e3
|
|
902
|
+
} : {
|
|
903
|
+
enabled: !1
|
|
904
|
+
// Only use smart export if autoExportConfig is provided
|
|
905
|
+
},
|
|
906
|
+
historyManager: w,
|
|
907
|
+
artboards: c,
|
|
908
|
+
elements: i,
|
|
909
|
+
onExport: Y,
|
|
910
|
+
onExportScheduled: de,
|
|
911
|
+
isCanvasReady: re
|
|
912
|
+
// Gate exports until content is fully ready (fonts loaded, elements deserialized)
|
|
913
|
+
}), S(() => {
|
|
914
|
+
if (c.length > 0 && !I) {
|
|
915
|
+
const D = requestAnimationFrame(() => {
|
|
916
|
+
p(!0);
|
|
917
|
+
});
|
|
918
|
+
return () => cancelAnimationFrame(D);
|
|
919
|
+
}
|
|
920
|
+
}, [c.length, I, p]), S(() => () => {
|
|
921
|
+
p(!1);
|
|
922
|
+
}, [p]);
|
|
923
|
+
}
|
|
924
|
+
async function Zt(r) {
|
|
925
|
+
if (typeof document > "u" || r.length === 0) return [];
|
|
926
|
+
const n = document.fonts ?? null;
|
|
927
|
+
return await Promise.all(
|
|
928
|
+
r.map((e) => {
|
|
929
|
+
const a = `font-${e.replace(/\s+/g, "-").toLowerCase()}`;
|
|
930
|
+
let t = document.getElementById(a);
|
|
931
|
+
return t || (t = document.createElement("link"), t.id = a, t.rel = "stylesheet", t.href = `https://fonts.googleapis.com/css2?family=${e.replace(/\s+/g, "+")}:wght@400;700&display=swap`, document.head.appendChild(t)), new Promise((o) => {
|
|
932
|
+
if (t.sheet) return o();
|
|
933
|
+
t.addEventListener("load", () => o(), { once: !0 }), t.addEventListener("error", () => o(), { once: !0 }), setTimeout(o, 4e3);
|
|
934
|
+
});
|
|
935
|
+
})
|
|
936
|
+
), n ? (await Promise.all(r.map((e) => n.load(`400 16px "${e}"`).catch(() => {
|
|
937
|
+
}))), r.filter((e) => {
|
|
938
|
+
try {
|
|
939
|
+
return !n.check(`400 16px "${e}"`);
|
|
940
|
+
} catch {
|
|
941
|
+
return !0;
|
|
942
|
+
}
|
|
943
|
+
})) : [];
|
|
944
|
+
}
|
|
945
|
+
const Fe = te("SnowconeCanvas"), Le = Ce((r, n) => {
|
|
946
|
+
var we;
|
|
947
|
+
const {
|
|
948
|
+
exportConfig: e,
|
|
949
|
+
imageConfig: a,
|
|
950
|
+
layoutConfig: t,
|
|
951
|
+
kit: o,
|
|
952
|
+
artboards: l,
|
|
953
|
+
activeArtboard: u,
|
|
954
|
+
onArtboardChange: s,
|
|
955
|
+
initialElements: f,
|
|
956
|
+
customFonts: h,
|
|
957
|
+
onChange: b,
|
|
958
|
+
onSelectionChange: d,
|
|
959
|
+
autoExportInterval: E,
|
|
960
|
+
onExport: y,
|
|
961
|
+
onExportScheduled: x,
|
|
962
|
+
onExportStatus: $,
|
|
963
|
+
onExportReady: M,
|
|
964
|
+
onImageLoad: i,
|
|
965
|
+
onImageError: g,
|
|
966
|
+
onImageLoadError: w,
|
|
967
|
+
onError: I,
|
|
968
|
+
onReady: p,
|
|
969
|
+
className: c,
|
|
970
|
+
style: m,
|
|
971
|
+
enableShortcuts: A,
|
|
972
|
+
overlay: k,
|
|
973
|
+
resetDocumentOnMount: T
|
|
974
|
+
} = r, W = E, L = r.autoExportConfig ?? (e == null ? void 0 : e.autoExportConfig), H = r.autoExportFormat ?? (e == null ? void 0 : e.format) ?? "dataUrl", Y = r.autoExportAll ?? (e == null ? void 0 : e.exportAll) ?? !1, de = r.exportScale ?? (e == null ? void 0 : e.scale) ?? 2, re = r.maxExportSize ?? (e == null ? void 0 : e.maxSize) ?? 4e3, ie = r.exportImageFormat ?? (e == null ? void 0 : e.imageFormat) ?? "png", D = r.exportImageQuality ?? (e == null ? void 0 : e.imageQuality) ?? 0.92, P = r.initialImage ?? (a == null ? void 0 : a.src), B = r.initialImageAlignment ?? (a == null ? void 0 : a.alignment) ?? "center", K = r.initialImageScale ?? (a == null ? void 0 : a.scale) ?? 1, j = r.initialImageScaleMode ?? (a == null ? void 0 : a.scaleMode) ?? "cover", F = r.initialImageRole ?? (a == null ? void 0 : a.role) ?? "design", C = Qe.useMemo(() => Ht(r.initialImageText, P), [r.initialImageText, P]), R = r.width ?? (t == null ? void 0 : t.width) ?? 1200, O = r.height ?? (t == null ? void 0 : t.height) ?? 1200, X = r.viewPadding ?? (t == null ? void 0 : t.viewPadding) ?? 0.9, z = r.artboardBorderRadius ?? (t == null ? void 0 : t.artboardBorderRadius) ?? 0, J = r.fixedMargin ?? (t == null ? void 0 : t.fixedMargin), Pe = r.maxHeight ?? (t == null ? void 0 : t.maxHeight), $e = r.showRotationHandle ?? (t == null ? void 0 : t.showRotationHandle) ?? !0, De = r.hideCanvas ?? (t == null ? void 0 : t.hideCanvas) ?? !1, be = r.canvasWrapperClassName ?? (t == null ? void 0 : t.canvasWrapperClassName), ve = r.canvasWrapperStyle ?? (t == null ? void 0 : t.canvasWrapperStyle), Oe = r.canvasCutouts ?? (t == null ? void 0 : t.canvasCutouts), Ee = r.pieceGuides, Be = r.pieceFocus, We = A ?? !0, Z = Re(() => it(o ?? "pro-studio"), [o]);
|
|
975
|
+
S(() => {
|
|
976
|
+
var U;
|
|
977
|
+
if (typeof ee < "u" && ((U = ee.env) == null ? void 0 : U.NODE_ENV) === "development" && Z) {
|
|
978
|
+
const G = ct(Z);
|
|
979
|
+
G.valid || Fe.warn("Kit validation warnings:", G.errors), G.warnings.length > 0 && Fe.warn("Kit validation warnings:", G.warnings);
|
|
980
|
+
}
|
|
981
|
+
}, [Z]), S(() => {
|
|
982
|
+
if (w)
|
|
983
|
+
return Xe(w);
|
|
984
|
+
}, [w]);
|
|
985
|
+
const { emitError: ue, handleBoundaryError: He } = Ut(I);
|
|
986
|
+
Vt({
|
|
987
|
+
artboardConfigs: l,
|
|
988
|
+
width: R,
|
|
989
|
+
height: O,
|
|
990
|
+
pieceGuides: Ee,
|
|
991
|
+
controlledActiveArtboard: u,
|
|
992
|
+
onArtboardChange: s,
|
|
993
|
+
resetDocumentOnMount: T
|
|
994
|
+
});
|
|
995
|
+
const { initialElementsLoadedState: Ke } = Xt({
|
|
996
|
+
initialElements: f,
|
|
997
|
+
customFonts: h,
|
|
998
|
+
emitError: ue
|
|
999
|
+
}), { imageLoadingState: ye, imageError: xe } = Jt({
|
|
1000
|
+
initialImage: P,
|
|
1001
|
+
initialImageText: C,
|
|
1002
|
+
initialImageAlignment: B,
|
|
1003
|
+
initialImageScale: K,
|
|
1004
|
+
initialImageScaleMode: j,
|
|
1005
|
+
initialImageRole: F,
|
|
1006
|
+
artboardConfigs: l,
|
|
1007
|
+
onImageLoad: i,
|
|
1008
|
+
onImageError: g,
|
|
1009
|
+
emitError: ue
|
|
1010
|
+
});
|
|
1011
|
+
if (Qt({ onChange: b, onSelectionChange: d }), Yt(
|
|
1012
|
+
{
|
|
1013
|
+
autoExportInterval: W,
|
|
1014
|
+
autoExportConfig: L,
|
|
1015
|
+
autoExportFormat: H,
|
|
1016
|
+
autoExportAll: Y,
|
|
1017
|
+
exportScale: de,
|
|
1018
|
+
maxExportSize: re,
|
|
1019
|
+
exportImageFormat: ie,
|
|
1020
|
+
exportImageQuality: D,
|
|
1021
|
+
onExport: y,
|
|
1022
|
+
onExportScheduled: x,
|
|
1023
|
+
onExportStatus: $,
|
|
1024
|
+
onExportReady: M,
|
|
1025
|
+
onReady: p,
|
|
1026
|
+
hasInitialElements: !!f && f.length > 0,
|
|
1027
|
+
initialElementsLoaded: Ke,
|
|
1028
|
+
emitError: ue
|
|
1029
|
+
},
|
|
1030
|
+
n
|
|
1031
|
+
), ye === "loading")
|
|
1032
|
+
return /* @__PURE__ */ v(
|
|
1033
|
+
"div",
|
|
1034
|
+
{
|
|
1035
|
+
className: c,
|
|
1036
|
+
style: {
|
|
1037
|
+
...m,
|
|
1038
|
+
display: "flex",
|
|
1039
|
+
alignItems: "center",
|
|
1040
|
+
justifyContent: "center",
|
|
1041
|
+
backgroundColor: "var(--surface, #f5f5f5)"
|
|
1042
|
+
},
|
|
1043
|
+
children: /* @__PURE__ */ v(lt, { size: 48 })
|
|
1044
|
+
}
|
|
1045
|
+
);
|
|
1046
|
+
if (ye === "error" && xe)
|
|
1047
|
+
return /* @__PURE__ */ v(
|
|
1048
|
+
"div",
|
|
1049
|
+
{
|
|
1050
|
+
className: c,
|
|
1051
|
+
style: {
|
|
1052
|
+
...m,
|
|
1053
|
+
display: "flex",
|
|
1054
|
+
alignItems: "center",
|
|
1055
|
+
justifyContent: "center",
|
|
1056
|
+
backgroundColor: "var(--surface, #f5f5f5)",
|
|
1057
|
+
color: "var(--danger, #dc2626)",
|
|
1058
|
+
padding: "1rem"
|
|
1059
|
+
},
|
|
1060
|
+
children: /* @__PURE__ */ _("div", { className: "sc:text-center", children: [
|
|
1061
|
+
/* @__PURE__ */ v("div", { className: "sc:font-medium", children: "Failed to load image" }),
|
|
1062
|
+
/* @__PURE__ */ v("div", { className: "sc:text-sm sc:mt-1 sc:opacity-70", children: xe.message })
|
|
1063
|
+
] })
|
|
1064
|
+
}
|
|
1065
|
+
);
|
|
1066
|
+
const je = Object.entries(((we = Z.layout) == null ? void 0 : we.slots) ?? {}).every(
|
|
1067
|
+
([U, G]) => U === "canvas" || !G || G.length === 0
|
|
1068
|
+
) ? { "--color-canvas-bg": "transparent" } : void 0;
|
|
1069
|
+
return /* @__PURE__ */ v(dt, { kit: Z, children: /* @__PURE__ */ v("div", { className: `sc-root ${c || ""}`, style: { ...je, ...m, position: "relative" }, children: /* @__PURE__ */ _(
|
|
1070
|
+
Nt,
|
|
1071
|
+
{
|
|
1072
|
+
onError: He,
|
|
1073
|
+
fallback: (U, G) => /* @__PURE__ */ _(
|
|
1074
|
+
"div",
|
|
1075
|
+
{
|
|
1076
|
+
style: {
|
|
1077
|
+
display: "flex",
|
|
1078
|
+
flexDirection: "column",
|
|
1079
|
+
alignItems: "center",
|
|
1080
|
+
justifyContent: "center",
|
|
1081
|
+
padding: "24px",
|
|
1082
|
+
minHeight: "200px",
|
|
1083
|
+
backgroundColor: "var(--surface, #f5f5f5)",
|
|
1084
|
+
color: "var(--foreground, #333)",
|
|
1085
|
+
fontFamily: "system-ui, sans-serif",
|
|
1086
|
+
textAlign: "center"
|
|
1087
|
+
},
|
|
1088
|
+
children: [
|
|
1089
|
+
/* @__PURE__ */ v("div", { style: { fontSize: "18px", fontWeight: 600, marginBottom: "8px" }, children: "Something went wrong" }),
|
|
1090
|
+
/* @__PURE__ */ v("div", { style: { fontSize: "14px", opacity: 0.7, marginBottom: "16px", maxWidth: "400px" }, children: U.message }),
|
|
1091
|
+
/* @__PURE__ */ v(
|
|
1092
|
+
"button",
|
|
1093
|
+
{
|
|
1094
|
+
onClick: G,
|
|
1095
|
+
style: {
|
|
1096
|
+
padding: "8px 20px",
|
|
1097
|
+
backgroundColor: "var(--primary, #333)",
|
|
1098
|
+
color: "var(--primary-foreground, #fff)",
|
|
1099
|
+
border: "none",
|
|
1100
|
+
borderRadius: "6px",
|
|
1101
|
+
fontSize: "14px",
|
|
1102
|
+
fontWeight: 500,
|
|
1103
|
+
cursor: "pointer"
|
|
1104
|
+
},
|
|
1105
|
+
children: "Try again"
|
|
1106
|
+
}
|
|
1107
|
+
)
|
|
1108
|
+
]
|
|
1109
|
+
}
|
|
1110
|
+
),
|
|
1111
|
+
children: [
|
|
1112
|
+
!De && /* @__PURE__ */ (() => {
|
|
1113
|
+
const U = /* @__PURE__ */ v(
|
|
1114
|
+
ut,
|
|
1115
|
+
{
|
|
1116
|
+
style: { width: "100%" },
|
|
1117
|
+
fitPadding: X,
|
|
1118
|
+
artboardBorderRadius: z,
|
|
1119
|
+
fixedMargin: J,
|
|
1120
|
+
maxHeight: Pe,
|
|
1121
|
+
showRotationHandle: $e,
|
|
1122
|
+
enableShortcuts: We,
|
|
1123
|
+
canvasCutouts: Oe,
|
|
1124
|
+
pieceGuides: Ee,
|
|
1125
|
+
pieceFocus: Be
|
|
1126
|
+
}
|
|
1127
|
+
);
|
|
1128
|
+
return /* @__PURE__ */ v(Mt, { kit: Z, canvas: be || ve ? /* @__PURE__ */ v("div", { className: be, style: ve, children: U }) : U });
|
|
1129
|
+
})(),
|
|
1130
|
+
k
|
|
1131
|
+
]
|
|
1132
|
+
}
|
|
1133
|
+
) }) });
|
|
1134
|
+
});
|
|
1135
|
+
Le.displayName = "SnowconeCanvasInner";
|
|
1136
|
+
const qt = Ce((r, n) => {
|
|
1137
|
+
var l;
|
|
1138
|
+
const { inheritTheme: e, externalProvider: a, services: t } = r, o = r.viewPadding ?? ((l = r.layoutConfig) == null ? void 0 : l.viewPadding);
|
|
1139
|
+
return /* @__PURE__ */ v(
|
|
1140
|
+
Lt,
|
|
1141
|
+
{
|
|
1142
|
+
inheritTheme: e,
|
|
1143
|
+
externalProvider: a,
|
|
1144
|
+
services: t,
|
|
1145
|
+
viewPadding: o,
|
|
1146
|
+
children: /* @__PURE__ */ v(Le, { ref: n, ...r })
|
|
1147
|
+
}
|
|
1148
|
+
);
|
|
1149
|
+
});
|
|
1150
|
+
qt.displayName = "SnowconeCanvas";
|
|
1151
|
+
export {
|
|
1152
|
+
Nt as E,
|
|
1153
|
+
qt as S,
|
|
1154
|
+
Wt as a,
|
|
1155
|
+
$t as u
|
|
1156
|
+
};
|
|
1157
|
+
//# sourceMappingURL=SnowconeCanvas-rAUrO9PR.js.map
|