@snowcone-app/canvas 0.37.0 → 0.38.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 +39 -8
- package/STYLING_CONTRACT.md +24 -2
- package/dist/{CanvasRenderer-CTN4j-uO.js → CanvasRenderer-D-E5WWLm.js} +4 -4
- package/dist/{CanvasRenderer-CTN4j-uO.js.map → CanvasRenderer-D-E5WWLm.js.map} +1 -1
- package/dist/{CanvasStateV1-DLE5d1-d.js → CanvasStateV1-C9LQt2J0.js} +7 -7
- package/dist/{CanvasStateV1-DLE5d1-d.js.map → CanvasStateV1-C9LQt2J0.js.map} +1 -1
- package/dist/{ContextualToolbars-CG5Gmv_i.js → ContextualToolbars-C62As-xY.js} +202 -202
- package/dist/{ContextualToolbars-CG5Gmv_i.js.map → ContextualToolbars-C62As-xY.js.map} +1 -1
- package/dist/EditorCanvasImpl-BnxEbr2p.js +144 -0
- package/dist/EditorCanvasImpl-BnxEbr2p.js.map +1 -0
- package/dist/{ExportManager-CDX5_up8.js → ExportManager-BbBfO22S.js} +45 -45
- package/dist/{ExportManager-CDX5_up8.js.map → ExportManager-BbBfO22S.js.map} +1 -1
- package/dist/{FontAnalyzer-CEYA_6fY.js → FontAnalyzer-DWHS41ba.js} +128 -128
- package/dist/FontAnalyzer-DWHS41ba.js.map +1 -0
- package/dist/{ImagePanel-DLxIDKV-.js → ImagePanel-BaX0UE-L.js} +57 -57
- package/dist/{ImagePanel-DLxIDKV-.js.map → ImagePanel-BaX0UE-L.js.map} +1 -1
- package/dist/SnowconeCanvas-CWSPyqqj.js +1112 -0
- package/dist/SnowconeCanvas-CWSPyqqj.js.map +1 -0
- package/dist/advanced.mjs +138 -138
- package/dist/api/placement.d.ts +3 -0
- package/dist/components/editor/EditorPlacements.d.ts +19 -6
- package/dist/components/editor/RootInternals.d.ts +7 -0
- package/dist/components/editor/designStateStore.d.ts +18 -0
- package/dist/components/editor/index.d.ts +3 -1
- package/dist/components/editor/placementLinks.d.ts +52 -0
- package/dist/components/editor/usePlacements.d.ts +28 -4
- package/dist/components/embed-realtime/context.d.ts +20 -4
- package/dist/components/embed-realtime/usePieceGuideBundle.d.ts +1 -0
- package/dist/components/embed-realtime/validateEmbed.d.ts +6 -3
- package/dist/{custom-icons-D51KIAfz.js → custom-icons-o1U13Vcg.js} +14 -14
- package/dist/{custom-icons-D51KIAfz.js.map → custom-icons-o1U13Vcg.js.map} +1 -1
- package/dist/{design-builder-CqgTpp9B.js → design-builder-CoCtjIwj.js} +86 -86
- package/dist/{design-builder-CqgTpp9B.js.map → design-builder-CoCtjIwj.js.map} +1 -1
- package/dist/{embed-CLz3CTcX.js → embed-SOFUZlGB.js} +843 -729
- package/dist/embed-SOFUZlGB.js.map +1 -0
- package/dist/embed.mjs +28 -28
- package/dist/errors/editorError.d.ts +7 -2
- package/dist/{guards-DldCuuJq.js → guards-DMmhw_Ow.js} +4 -4
- package/dist/{guards-DldCuuJq.js.map → guards-DMmhw_Ow.js.map} +1 -1
- package/dist/index.mjs +21 -21
- package/dist/internals.mjs +108 -108
- package/dist/internals.mjs.map +1 -1
- package/dist/placement-Br5jI_-u.js +90 -0
- package/dist/placement-Br5jI_-u.js.map +1 -0
- package/dist/placement.d.ts +2 -0
- package/dist/placement.mjs +5 -0
- package/dist/placement.mjs.map +1 -0
- package/dist/template-fields-CBLHgW7G.js +556 -0
- package/dist/template-fields-CBLHgW7G.js.map +1 -0
- package/dist/testing.mjs +24 -24
- package/dist/{useCommands-CQi4Pyd2.js → useCommands-x8J7_Mzy.js} +262 -262
- package/dist/{useCommands-CQi4Pyd2.js.map → useCommands-x8J7_Mzy.js.map} +1 -1
- package/dist/usePieceGuideBundle-C7r06a_x.js +65 -0
- package/dist/usePieceGuideBundle-C7r06a_x.js.map +1 -0
- package/dist/{validation-THw5W6N_.js → validation-BG-V98h0.js} +846 -846
- package/dist/validation-BG-V98h0.js.map +1 -0
- package/example/package.json +1 -1
- package/package.json +9 -4
- package/dist/EditorCanvasImpl-BRdFWZA5.js +0 -81
- package/dist/EditorCanvasImpl-BRdFWZA5.js.map +0 -1
- package/dist/FontAnalyzer-CEYA_6fY.js.map +0 -1
- package/dist/SnowconeCanvas-BaFR8QXs.js +0 -1196
- package/dist/SnowconeCanvas-BaFR8QXs.js.map +0 -1
- package/dist/embed-CLz3CTcX.js.map +0 -1
- package/dist/template-fields-D8uOutD4.js +0 -505
- package/dist/template-fields-D8uOutD4.js.map +0 -1
- package/dist/usePieceGuideBundle-BUQKb0Ja.js +0 -61
- package/dist/usePieceGuideBundle-BUQKb0Ja.js.map +0 -1
- package/dist/validation-THw5W6N_.js.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as e, jsxs as t, Fragment as le } from "react/jsx-runtime";
|
|
2
2
|
import * as ss from "react";
|
|
3
3
|
import $e, { useMemo as je, useState as r, useRef as M, useEffect as ie, useCallback as fe } from "react";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { c as He, I as ds } from "./FontAnalyzer-
|
|
7
|
-
import { T as C, S as Pe, a as Ie, I as Ce, L as Ee } from "./custom-icons-
|
|
8
|
-
import {
|
|
4
|
+
import { b as ts, c as cs } from "./design-builder-CoCtjIwj.js";
|
|
5
|
+
import { u as as, c as rs, a as Ge, D as ns, I as p, i as me, B as X, b as os, d as is, C as ls } from "./useCommands-x8J7_Mzy.js";
|
|
6
|
+
import { c as He, I as ds } from "./FontAnalyzer-DWHS41ba.js";
|
|
7
|
+
import { T as C, S as Pe, a as Ie, I as Ce, L as Ee } from "./custom-icons-o1U13Vcg.js";
|
|
8
|
+
import { i as us } from "./guards-DMmhw_Ow.js";
|
|
9
9
|
const _e = ss.forwardRef(
|
|
10
10
|
({ className: d, isInvalid: a, disabled: x, readOnly: E, required: u, variant: A, ...c }, g) => {
|
|
11
11
|
const o = as(), i = A ?? (o.variant === "default" ? "filled" : "default");
|
|
@@ -37,17 +37,17 @@ const _e = ss.forwardRef(
|
|
|
37
37
|
_e.displayName = "Textarea";
|
|
38
38
|
const Fe = _e;
|
|
39
39
|
Fe.displayName = "TextArea";
|
|
40
|
-
const xe = He("ImageBrowser"), ms = "Image search is temporarily unavailable.", Ve = "Image generation is temporarily unavailable.", fs = "Vector search is temporarily unavailable.",
|
|
40
|
+
const xe = He("ImageBrowser"), ms = "Image search is temporarily unavailable.", Ve = "Image generation is temporarily unavailable.", fs = "Vector search is temporarily unavailable.", De = "Background removal is temporarily unavailable.";
|
|
41
41
|
function gs(d, a) {
|
|
42
42
|
const x = d instanceof Error ? d.message : "";
|
|
43
43
|
return !x || /VITE_|NEXT_PUBLIC_|\.env/i.test(x) ? a : x;
|
|
44
44
|
}
|
|
45
|
-
const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint" },
|
|
46
|
-
const [u, A] = r(!1), [c, g] = r(!1), [o, i] = r("top"), b = M(null), h = M(null),
|
|
45
|
+
const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint" }, Ue = $e.memo(function({ image: a, onImageSelect: x, fixedHeight: E = !1 }) {
|
|
46
|
+
const [u, A] = r(!1), [c, g] = r(!1), [o, i] = r("top"), b = M(null), h = M(null), D = M(null), N = M(!0), [T, v] = r(!1), w = M(null), S = () => {
|
|
47
47
|
c || x(a);
|
|
48
48
|
}, W = (R) => {
|
|
49
|
-
if (!
|
|
50
|
-
const m =
|
|
49
|
+
if (!D.current) return "top";
|
|
50
|
+
const m = D.current.getBoundingClientRect(), Z = R.clientX - m.left, z = R.clientY - m.top, y = m.width, L = m.height, P = {
|
|
51
51
|
top: z,
|
|
52
52
|
bottom: L - z,
|
|
53
53
|
left: Z,
|
|
@@ -75,7 +75,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
|
|
|
75
75
|
b.current && (clearTimeout(b.current), b.current = null), h.current && (clearTimeout(h.current), h.current = null);
|
|
76
76
|
}, _ = () => {
|
|
77
77
|
g(!1);
|
|
78
|
-
},
|
|
78
|
+
}, U = a.source === "unsplash" ? "Unsplash" : "Pixabay", ce = u || c, q = () => {
|
|
79
79
|
if (!u) return "none";
|
|
80
80
|
switch (o) {
|
|
81
81
|
case "top":
|
|
@@ -93,7 +93,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
|
|
|
93
93
|
return /* @__PURE__ */ t(
|
|
94
94
|
"div",
|
|
95
95
|
{
|
|
96
|
-
ref:
|
|
96
|
+
ref: D,
|
|
97
97
|
onClick: S,
|
|
98
98
|
onMouseEnter: se,
|
|
99
99
|
onMouseLeave: Q,
|
|
@@ -136,7 +136,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
|
|
|
136
136
|
className: "sc:size-3 sc:text-white/80"
|
|
137
137
|
}
|
|
138
138
|
),
|
|
139
|
-
/* @__PURE__ */ e("span", { className: "sc:text-xs sc:font-medium sc:text-white/80", children:
|
|
139
|
+
/* @__PURE__ */ e("span", { className: "sc:text-xs sc:font-medium sc:text-white/80", children: U })
|
|
140
140
|
] }),
|
|
141
141
|
/* @__PURE__ */ t("div", { className: "sc:flex sc:flex-col sc:gap-0.5", children: [
|
|
142
142
|
/* @__PURE__ */ e("span", { className: "sc:text-xs sc:text-white/60", children: "Photo by" }),
|
|
@@ -164,7 +164,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
|
|
|
164
164
|
rel: "noopener noreferrer",
|
|
165
165
|
onClick: (R) => R.stopPropagation(),
|
|
166
166
|
className: "sc:underline sc:decoration-white/40 sc:underline-offset-2 sc:hover:decoration-white",
|
|
167
|
-
children:
|
|
167
|
+
children: U
|
|
168
168
|
}
|
|
169
169
|
)
|
|
170
170
|
] })
|
|
@@ -183,7 +183,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
|
|
|
183
183
|
i.current && (clearTimeout(i.current), i.current = null), o.current = setTimeout(() => {
|
|
184
184
|
g(!0);
|
|
185
185
|
}, 400);
|
|
186
|
-
},
|
|
186
|
+
}, D = () => {
|
|
187
187
|
o.current && (clearTimeout(o.current), o.current = null), g(!1);
|
|
188
188
|
}, N = () => {
|
|
189
189
|
o.current && (clearTimeout(o.current), o.current = null), i.current && (clearTimeout(i.current), i.current = null);
|
|
@@ -229,7 +229,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
|
|
|
229
229
|
className: `sc:relative sc:flex sc:h-6 sc:w-6 sc:items-center sc:justify-center sc:rounded-full sc:bg-black/50 sc:transition-all sc:duration-300 sc:ease-in-out sc:hover:scale-110 ${v ? "sc:opacity-100" : "sc:pointer-events-none sc:opacity-0"}`,
|
|
230
230
|
"aria-label": "Vector info",
|
|
231
231
|
onMouseEnter: h,
|
|
232
|
-
onMouseLeave:
|
|
232
|
+
onMouseLeave: D,
|
|
233
233
|
children: /* @__PURE__ */ e(p, { icon: "lucide:aperture", className: "sc:size-4 sc:text-white/80" })
|
|
234
234
|
}
|
|
235
235
|
)
|
|
@@ -269,13 +269,13 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
|
|
|
269
269
|
...g ? ["ai"] : []
|
|
270
270
|
],
|
|
271
271
|
[c, o, g]
|
|
272
|
-
), [h,
|
|
272
|
+
), [h, D] = r(""), [N, T] = r(""), [v, w] = r([]), [S, W] = r(!1), [se, Q] = r(null), [k, te] = r(b[0]), [$, _] = r(1), [U, ce] = r(!0), [q, R] = r("masonry"), [m, Z] = r(""), [z, y] = r([]), [L, P] = r(!1), [J, ae] = r(null), [j, be] = r(null), [K, ge] = r(!0), [re, ve] = r("grid"), [F, G] = r(""), [V, l] = r(!1), [O, de] = r(null), [H, he] = r(null), [B, ne] = r(!1), [oe, ee] = r(null), Ne = M(null), pe = M(null), Le = M(null);
|
|
273
273
|
ie(() => {
|
|
274
274
|
b.includes(k) || te(b[0]);
|
|
275
275
|
}, [b, k]), ie(() => {
|
|
276
276
|
d && E && (T(E), te("url"));
|
|
277
277
|
}, [d, E]), ie(() => {
|
|
278
|
-
d || (
|
|
278
|
+
d || (D(""), T(""), w([]), Q(null), _(1), ce(!0), Z(""), y([]), ae(null), be(null), ge(!0));
|
|
279
279
|
}, [d]);
|
|
280
280
|
const we = fe(
|
|
281
281
|
async (s, n, f) => {
|
|
@@ -283,7 +283,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
|
|
|
283
283
|
W(!0), Q(null);
|
|
284
284
|
try {
|
|
285
285
|
const I = await c.search({ query: s, page: n, perPage: 30 });
|
|
286
|
-
w((
|
|
286
|
+
w((Y) => f ? [...Y, ...I.results] : I.results), _(I.page), ce(I.hasMore);
|
|
287
287
|
} catch (I) {
|
|
288
288
|
Q(ms), xe.error("Error searching images:", I);
|
|
289
289
|
} finally {
|
|
@@ -296,17 +296,17 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
|
|
|
296
296
|
ie(() => {
|
|
297
297
|
d && !h && k === "search" && v.length === 0 && c && we("", 1, !1);
|
|
298
298
|
}, [d, k, c]);
|
|
299
|
-
const
|
|
299
|
+
const Ye = (s) => {
|
|
300
300
|
s.preventDefault(), we(h, 1, !1);
|
|
301
301
|
}, Me = fe(() => {
|
|
302
|
-
S || !
|
|
303
|
-
}, [S,
|
|
302
|
+
S || !U || we(h, $ + 1, !0);
|
|
303
|
+
}, [S, U, h, $, we]);
|
|
304
304
|
ie(() => {
|
|
305
305
|
const s = Ne.current;
|
|
306
306
|
if (!s || !d || k !== "search") return;
|
|
307
307
|
const n = new IntersectionObserver(
|
|
308
308
|
(f) => {
|
|
309
|
-
f[0].isIntersecting &&
|
|
309
|
+
f[0].isIntersecting && U && !S && Me();
|
|
310
310
|
},
|
|
311
311
|
{
|
|
312
312
|
root: null,
|
|
@@ -319,16 +319,16 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
|
|
|
319
319
|
return n.observe(s), () => {
|
|
320
320
|
n.disconnect();
|
|
321
321
|
};
|
|
322
|
-
}, [d, k,
|
|
322
|
+
}, [d, k, U, S, Me]);
|
|
323
323
|
const ye = fe(
|
|
324
324
|
async (s, n) => {
|
|
325
325
|
if (o) {
|
|
326
326
|
P(!0), ae(null);
|
|
327
327
|
try {
|
|
328
328
|
const { results: f, nextPage: I } = await o.search({ query: s, nextPage: n ?? null });
|
|
329
|
-
y(n ? (
|
|
330
|
-
const Re = new Set(
|
|
331
|
-
return [...
|
|
329
|
+
y(n ? (Y) => {
|
|
330
|
+
const Re = new Set(Y.map((ue) => ue.id));
|
|
331
|
+
return [...Y, ...f.filter((ue) => !Re.has(ue.id))];
|
|
332
332
|
} : f), be(I), ge(I !== null);
|
|
333
333
|
} catch (f) {
|
|
334
334
|
ae(fs), xe.error("Error searching vectors:", f);
|
|
@@ -342,7 +342,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
|
|
|
342
342
|
ie(() => {
|
|
343
343
|
d && !m && k === "vector" && z.length === 0 && o && ye("");
|
|
344
344
|
}, [d, k, o]);
|
|
345
|
-
const
|
|
345
|
+
const Xe = (s) => {
|
|
346
346
|
s.preventDefault(), ye(m);
|
|
347
347
|
}, Ae = fe(() => {
|
|
348
348
|
L || !K || !j || ye(m, j);
|
|
@@ -382,9 +382,9 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
|
|
|
382
382
|
const n = (f = s.target.files) == null ? void 0 : f[0];
|
|
383
383
|
if (n && n.type.startsWith("image/")) {
|
|
384
384
|
const I = new FileReader();
|
|
385
|
-
I.onload = (
|
|
385
|
+
I.onload = (Y) => {
|
|
386
386
|
var ue;
|
|
387
|
-
const Re = (ue =
|
|
387
|
+
const Re = (ue = Y.target) == null ? void 0 : ue.result;
|
|
388
388
|
T(Re);
|
|
389
389
|
}, I.readAsDataURL(n);
|
|
390
390
|
}
|
|
@@ -398,7 +398,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
|
|
|
398
398
|
const s = await i(N);
|
|
399
399
|
T(s);
|
|
400
400
|
} catch (s) {
|
|
401
|
-
ee(
|
|
401
|
+
ee(De), xe.error("Error removing background:", s);
|
|
402
402
|
} finally {
|
|
403
403
|
ne(!1);
|
|
404
404
|
}
|
|
@@ -412,15 +412,15 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
|
|
|
412
412
|
}
|
|
413
413
|
l(!0), de(null), he(null);
|
|
414
414
|
try {
|
|
415
|
-
const
|
|
415
|
+
const Y = (f = (n = (await g.generate({
|
|
416
416
|
prompt: F,
|
|
417
417
|
width: 1024,
|
|
418
418
|
height: 1024,
|
|
419
419
|
numberResults: 1
|
|
420
420
|
})).images) == null ? void 0 : n[0]) == null ? void 0 : f.imageUrl;
|
|
421
|
-
if (!
|
|
421
|
+
if (!Y)
|
|
422
422
|
throw new Error(Ve);
|
|
423
|
-
he(
|
|
423
|
+
he(Y);
|
|
424
424
|
} catch (I) {
|
|
425
425
|
de(gs(I, Ve)), xe.error("Error generating AI image:", I);
|
|
426
426
|
} finally {
|
|
@@ -436,7 +436,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
|
|
|
436
436
|
const s = await i(H);
|
|
437
437
|
he(s);
|
|
438
438
|
} catch (s) {
|
|
439
|
-
ee(
|
|
439
|
+
ee(De), xe.error("Error removing background:", s);
|
|
440
440
|
} finally {
|
|
441
441
|
ne(!1);
|
|
442
442
|
}
|
|
@@ -538,21 +538,21 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
|
|
|
538
538
|
}
|
|
539
539
|
) }),
|
|
540
540
|
c && /* @__PURE__ */ t(C.Panel, { id: "search", className: "sc:flex sc:flex-col", children: [
|
|
541
|
-
/* @__PURE__ */ t("form", { onSubmit:
|
|
541
|
+
/* @__PURE__ */ t("form", { onSubmit: Ye, className: "sc:sticky sc:top-0 sc:z-9 sc:flex sc:gap-2 sc:bg-surface sc:px-6 sc:pt-4 sc:pb-3", children: [
|
|
542
542
|
/* @__PURE__ */ e(Ie, { className: "sc:flex-1", "aria-label": "Search for images", children: /* @__PURE__ */ e(
|
|
543
543
|
Ce,
|
|
544
544
|
{
|
|
545
545
|
type: "text",
|
|
546
546
|
placeholder: "Search for images...",
|
|
547
547
|
value: h,
|
|
548
|
-
onChange: (s) =>
|
|
548
|
+
onChange: (s) => D(s.target.value),
|
|
549
549
|
variant: "subtle",
|
|
550
550
|
"data-testid": "image-search-input"
|
|
551
551
|
}
|
|
552
552
|
) }),
|
|
553
|
-
/* @__PURE__ */ e(
|
|
553
|
+
/* @__PURE__ */ e(X, { type: "submit", size: "icon", variant: "secondary", disabled: S, "aria-label": "Search", children: /* @__PURE__ */ e(p, { icon: me.search, className: "sc:size-5" }) }),
|
|
554
554
|
/* @__PURE__ */ e(
|
|
555
|
-
|
|
555
|
+
X,
|
|
556
556
|
{
|
|
557
557
|
size: "icon",
|
|
558
558
|
variant: "secondary",
|
|
@@ -577,7 +577,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
|
|
|
577
577
|
gridAutoRows: u === "bottom" ? "200px" : "120px",
|
|
578
578
|
gap: hs
|
|
579
579
|
},
|
|
580
|
-
children: v.map((s, n) => /* @__PURE__ */ e("div", { className: es(s, n), style: ke, children: /* @__PURE__ */ e(
|
|
580
|
+
children: v.map((s, n) => /* @__PURE__ */ e("div", { className: es(s, n), style: ke, children: /* @__PURE__ */ e(Ue, { image: s, onImageSelect: ze, fixedHeight: !0 }) }, s.id))
|
|
581
581
|
}
|
|
582
582
|
)
|
|
583
583
|
) : (
|
|
@@ -591,13 +591,13 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
|
|
|
591
591
|
gridTemplateColumns: u === "bottom" ? "repeat(auto-fill, minmax(150px, 1fr))" : "repeat(auto-fill, minmax(120px, 1fr))",
|
|
592
592
|
gap: Se
|
|
593
593
|
},
|
|
594
|
-
children: v.map((s) => /* @__PURE__ */ e("div", { style: { aspectRatio: "1 / 1", ...ke }, children: /* @__PURE__ */ e(
|
|
594
|
+
children: v.map((s) => /* @__PURE__ */ e("div", { style: { aspectRatio: "1 / 1", ...ke }, children: /* @__PURE__ */ e(Ue, { image: s, onImageSelect: ze, fixedHeight: !0 }) }, s.id))
|
|
595
595
|
}
|
|
596
596
|
)
|
|
597
597
|
),
|
|
598
|
-
|
|
598
|
+
U && /* @__PURE__ */ e("div", { ref: Ne, className: "sc:h-px" }),
|
|
599
599
|
S && /* @__PURE__ */ e("div", { className: "sc:text-muted sc:py-4 sc:text-center sc:text-sm", children: "Loading more..." }),
|
|
600
|
-
!
|
|
600
|
+
!U && !S && /* @__PURE__ */ e("div", { className: "sc:text-muted sc:py-6 sc:text-center sc:text-sm", children: "No more images" })
|
|
601
601
|
] }),
|
|
602
602
|
!S && v.length === 0 && h && /* @__PURE__ */ t("div", { className: "sc:text-muted sc:px-6 sc:py-12 sc:text-center sc:text-sm", children: [
|
|
603
603
|
'No images found for "',
|
|
@@ -664,7 +664,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
|
|
|
664
664
|
)
|
|
665
665
|
] }),
|
|
666
666
|
/* @__PURE__ */ e(
|
|
667
|
-
|
|
667
|
+
X,
|
|
668
668
|
{
|
|
669
669
|
type: "submit",
|
|
670
670
|
variant: "default",
|
|
@@ -681,7 +681,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
|
|
|
681
681
|
/* @__PURE__ */ t("div", { className: "sc:flex sc:items-center sc:justify-between sc:gap-3", children: [
|
|
682
682
|
/* @__PURE__ */ e("span", { className: "sc:text-xs sc:font-medium sc:uppercase sc:tracking-wider sc:text-muted-foreground", children: "Preview" }),
|
|
683
683
|
i && /* @__PURE__ */ e(
|
|
684
|
-
|
|
684
|
+
X,
|
|
685
685
|
{
|
|
686
686
|
onClick: Ze,
|
|
687
687
|
disabled: B || !N.trim(),
|
|
@@ -723,7 +723,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
|
|
|
723
723
|
] })
|
|
724
724
|
] }),
|
|
725
725
|
o && /* @__PURE__ */ t(C.Panel, { id: "vector", className: "sc:flex sc:flex-col", children: [
|
|
726
|
-
/* @__PURE__ */ t("form", { onSubmit:
|
|
726
|
+
/* @__PURE__ */ t("form", { onSubmit: Xe, className: "sc:sticky sc:top-0 sc:z-9 sc:flex sc:gap-2 sc:bg-surface sc:px-6 sc:pt-4 sc:pb-3", children: [
|
|
727
727
|
/* @__PURE__ */ e(Ie, { className: "sc:flex-1", "aria-label": "Search for vector graphics", children: /* @__PURE__ */ e(
|
|
728
728
|
Ce,
|
|
729
729
|
{
|
|
@@ -735,9 +735,9 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
|
|
|
735
735
|
"data-testid": "vector-search-input"
|
|
736
736
|
}
|
|
737
737
|
) }),
|
|
738
|
-
/* @__PURE__ */ e(
|
|
738
|
+
/* @__PURE__ */ e(X, { type: "submit", size: "icon", variant: "secondary", disabled: L, "aria-label": "Search", children: /* @__PURE__ */ e(p, { icon: me.search, className: "sc:size-5" }) }),
|
|
739
739
|
/* @__PURE__ */ e(
|
|
740
|
-
|
|
740
|
+
X,
|
|
741
741
|
{
|
|
742
742
|
size: "icon",
|
|
743
743
|
variant: "secondary",
|
|
@@ -808,7 +808,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
|
|
|
808
808
|
)
|
|
809
809
|
] }),
|
|
810
810
|
/* @__PURE__ */ e(
|
|
811
|
-
|
|
811
|
+
X,
|
|
812
812
|
{
|
|
813
813
|
type: "submit",
|
|
814
814
|
variant: "default",
|
|
@@ -842,7 +842,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
|
|
|
842
842
|
] }),
|
|
843
843
|
/* @__PURE__ */ t("div", { className: "sc:flex sc:flex-col sc:gap-3", children: [
|
|
844
844
|
i && /* @__PURE__ */ e(
|
|
845
|
-
|
|
845
|
+
X,
|
|
846
846
|
{
|
|
847
847
|
onClick: Oe,
|
|
848
848
|
disabled: B || !H,
|
|
@@ -861,7 +861,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
|
|
|
861
861
|
),
|
|
862
862
|
oe && /* @__PURE__ */ e("div", { className: "sc:border-danger sc:bg-danger/10 sc:text-danger sc:rounded-xl sc:border-2 sc:px-3 sc:py-2 sc:text-xs", children: oe }),
|
|
863
863
|
/* @__PURE__ */ e(
|
|
864
|
-
|
|
864
|
+
X,
|
|
865
865
|
{
|
|
866
866
|
onClick: Ke,
|
|
867
867
|
variant: "default",
|
|
@@ -889,7 +889,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
|
|
|
889
889
|
services: c
|
|
890
890
|
}) => {
|
|
891
891
|
var z;
|
|
892
|
-
const { elements: g, setElements: o, canvasEditorRef: i, artboardManager: b, executeAddElement: h, executeElementUpdate:
|
|
892
|
+
const { elements: g, setElements: o, canvasEditorRef: i, artboardManager: b, executeAddElement: h, executeElementUpdate: D } = ts(), { selectedId: N, setSelectedId: T } = cs(), { activeArtboardId: v } = os(), w = Ge(), S = je(() => {
|
|
893
893
|
if (w.ingestImage) return w.ingestImage;
|
|
894
894
|
if (c != null && c.ingestImage) return c.ingestImage;
|
|
895
895
|
if (c != null && c.ingestImageUrl) return is(c.ingestImageUrl);
|
|
@@ -899,7 +899,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
|
|
|
899
899
|
se.current = g;
|
|
900
900
|
const Q = M(N);
|
|
901
901
|
Q.current = N;
|
|
902
|
-
const [k, te] = r(null), $ = u ?? k, _ = A ?? te, [
|
|
902
|
+
const [k, te] = r(null), $ = u ?? k, _ = A ?? te, [U, ce] = r(!1), q = fe(
|
|
903
903
|
async (y) => {
|
|
904
904
|
var ve, F;
|
|
905
905
|
const L = W.current;
|
|
@@ -921,7 +921,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
|
|
|
921
921
|
l.imageUrl = y, l.transformData.cropX = 0, l.transformData.cropY = 0, l.transformData.cropWidth = 1, l.transformData.cropHeight = 1, l.transformData.flipHorizontal = !1, l.transformData.flipVertical = !1, l.transformData.borderRadius = 0, l.imageLoaded = !1, l.imageElement = null, l.isCropping = !1, l.preserveDimensions = !1, l.transformData.width = de, l.transformData.height = H, l.onLoadCallback = (he) => {
|
|
922
922
|
const B = he, ne = B.transformData.width, oe = B.transformData.height, ee = Math.min(de / ne, H / oe, 1);
|
|
923
923
|
ee < 1 && (B.transformData.width = ne * ee, B.transformData.height = oe * ee), o((Ne) => Ne.map((pe) => pe.id === B.id ? B : pe));
|
|
924
|
-
}, l.loadImage(y),
|
|
924
|
+
}, l.loadImage(y), D(V, l), E && E(l);
|
|
925
925
|
}
|
|
926
926
|
_(null);
|
|
927
927
|
return;
|
|
@@ -952,7 +952,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
|
|
|
952
952
|
// to prevent callback recreation on every context update
|
|
953
953
|
b,
|
|
954
954
|
h,
|
|
955
|
-
|
|
955
|
+
D,
|
|
956
956
|
v,
|
|
957
957
|
i,
|
|
958
958
|
o,
|
|
@@ -973,7 +973,7 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
|
|
|
973
973
|
onToggle: R,
|
|
974
974
|
onImageSelect: q,
|
|
975
975
|
currentImageUrl: m,
|
|
976
|
-
busy:
|
|
976
|
+
busy: U
|
|
977
977
|
}
|
|
978
978
|
);
|
|
979
979
|
return c ? /* @__PURE__ */ e(ls, { services: c, children: Z }) : Z;
|
|
@@ -981,4 +981,4 @@ const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint"
|
|
|
981
981
|
export {
|
|
982
982
|
ks as ImagePanel
|
|
983
983
|
};
|
|
984
|
-
//# sourceMappingURL=ImagePanel-
|
|
984
|
+
//# sourceMappingURL=ImagePanel-BaX0UE-L.js.map
|