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