@snowcone-app/canvas 0.36.4 → 0.37.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 +137 -0
- package/dist/{ContextualToolbars-GAkUFq2m.js → ContextualToolbars-CG5Gmv_i.js} +3 -3
- package/dist/{ContextualToolbars-GAkUFq2m.js.map → ContextualToolbars-CG5Gmv_i.js.map} +1 -1
- package/dist/{EditorCanvasImpl-B43TaPgW.js → EditorCanvasImpl-BRdFWZA5.js} +5 -5
- package/dist/{EditorCanvasImpl-B43TaPgW.js.map → EditorCanvasImpl-BRdFWZA5.js.map} +1 -1
- package/dist/FontAnalyzer-CEYA_6fY.js.map +1 -1
- package/dist/{ImagePanel-DK3Zflyc.js → ImagePanel-DLxIDKV-.js} +131 -131
- package/dist/ImagePanel-DLxIDKV-.js.map +1 -0
- package/dist/{SnowconeCanvas-B1lq53my.js → SnowconeCanvas-BaFR8QXs.js} +6 -6
- package/dist/{SnowconeCanvas-B1lq53my.js.map → SnowconeCanvas-BaFR8QXs.js.map} +1 -1
- package/dist/advanced.mjs +7 -7
- package/dist/api/embed.d.ts +3 -0
- package/dist/components/embed-realtime/validateEmbed.d.ts +13 -0
- package/dist/{custom-icons-wZuopKx7.js → custom-icons-D51KIAfz.js} +2 -2
- package/dist/{custom-icons-wZuopKx7.js.map → custom-icons-D51KIAfz.js.map} +1 -1
- package/dist/design/bundle-config.d.ts +127 -0
- package/dist/design/product-config.d.ts +3 -0
- package/dist/embed-CLz3CTcX.js +1799 -0
- package/dist/embed-CLz3CTcX.js.map +1 -0
- package/dist/embed.mjs +50 -45
- package/dist/errors/editorError.d.ts +28 -1
- package/dist/index.mjs +5 -5
- package/dist/{template-fields-CMK7aqCw.js → template-fields-D8uOutD4.js} +2 -2
- package/dist/{template-fields-CMK7aqCw.js.map → template-fields-D8uOutD4.js.map} +1 -1
- package/dist/{useCommands-DC6ZPY1n.js → useCommands-CQi4Pyd2.js} +2 -2
- package/dist/{useCommands-DC6ZPY1n.js.map → useCommands-CQi4Pyd2.js.map} +1 -1
- package/dist/{validation-Bm2noYgt.js → validation-THw5W6N_.js} +7 -7
- package/dist/{validation-Bm2noYgt.js.map → validation-THw5W6N_.js.map} +1 -1
- package/example/package.json +1 -1
- package/package.json +4 -4
- package/dist/ImagePanel-DK3Zflyc.js.map +0 -1
- package/dist/embed-DbCQZ8Q9.js +0 -1588
- package/dist/embed-DbCQZ8Q9.js.map +0 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsx as e, jsxs as t, Fragment as le } from "react/jsx-runtime";
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
4
|
-
import { u as
|
|
5
|
-
import { o as
|
|
6
|
-
import { c as
|
|
7
|
-
import { T as C, S as
|
|
8
|
-
import { a as
|
|
9
|
-
const
|
|
10
|
-
({ className: d, isInvalid: a, disabled: x, readOnly:
|
|
11
|
-
const o =
|
|
2
|
+
import * as ss from "react";
|
|
3
|
+
import $e, { useMemo as je, useState as r, useRef as M, useEffect as ie, useCallback as fe } from "react";
|
|
4
|
+
import { u as ts, g as cs } from "./design-builder-CqgTpp9B.js";
|
|
5
|
+
import { o as as, N as rs, d as Ge, W as ns, I as p, O as me, B as Y, u as os, X as is, C as ls } from "./useCommands-CQi4Pyd2.js";
|
|
6
|
+
import { c as He, I as ds } from "./FontAnalyzer-CEYA_6fY.js";
|
|
7
|
+
import { T as C, S as Pe, a as Ie, I as Ce, L as Ee } from "./custom-icons-D51KIAfz.js";
|
|
8
|
+
import { a as us } from "./guards-DldCuuJq.js";
|
|
9
|
+
const _e = ss.forwardRef(
|
|
10
|
+
({ className: d, isInvalid: a, disabled: x, readOnly: E, required: u, variant: A, ...c }, g) => {
|
|
11
|
+
const o = as(), i = A ?? (o.variant === "default" ? "filled" : "default");
|
|
12
12
|
return /* @__PURE__ */ e(
|
|
13
13
|
"textarea",
|
|
14
14
|
{
|
|
15
|
-
className:
|
|
15
|
+
className: rs(
|
|
16
16
|
"sc:flex sc:min-h-[80px] sc:w-full sc:rounded-input sc:px-2.5 sc:py-2 sc:text-sm sc:transition-colors",
|
|
17
17
|
"sc:text-foreground sc:border-none",
|
|
18
18
|
"sc:placeholder:text-foreground/50",
|
|
@@ -26,7 +26,7 @@ const He = es.forwardRef(
|
|
|
26
26
|
),
|
|
27
27
|
ref: g,
|
|
28
28
|
disabled: x,
|
|
29
|
-
readOnly:
|
|
29
|
+
readOnly: E,
|
|
30
30
|
required: u,
|
|
31
31
|
"aria-invalid": a,
|
|
32
32
|
...c
|
|
@@ -34,18 +34,18 @@ const He = es.forwardRef(
|
|
|
34
34
|
);
|
|
35
35
|
}
|
|
36
36
|
);
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
const xe =
|
|
41
|
-
function
|
|
37
|
+
_e.displayName = "Textarea";
|
|
38
|
+
const Fe = _e;
|
|
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.", Ue = "Background removal is temporarily unavailable.";
|
|
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
|
|
45
|
+
const hs = "1px", Se = "1px", ke = { contentVisibility: "auto", contain: "paint" }, De = $e.memo(function({ image: a, onImageSelect: x, fixedHeight: E = !1 }) {
|
|
46
46
|
const [u, A] = r(!1), [c, g] = r(!1), [o, i] = r("top"), b = M(null), h = M(null), U = M(null), N = M(!0), [T, v] = r(!1), w = M(null), S = () => {
|
|
47
47
|
c || x(a);
|
|
48
|
-
},
|
|
48
|
+
}, W = (R) => {
|
|
49
49
|
if (!U.current) return "top";
|
|
50
50
|
const m = U.current.getBoundingClientRect(), Z = R.clientX - m.left, z = R.clientY - m.top, y = m.width, L = m.height, P = {
|
|
51
51
|
top: z,
|
|
@@ -55,7 +55,7 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
55
55
|
}, J = Math.min(P.top, P.bottom, P.left, P.right);
|
|
56
56
|
return J === P.top ? "top" : J === P.bottom ? "bottom" : J === P.left ? "left" : "right";
|
|
57
57
|
}, se = (R) => {
|
|
58
|
-
const m =
|
|
58
|
+
const m = W(R);
|
|
59
59
|
w.current && (cancelAnimationFrame(w.current), w.current = null), m !== o ? (v(!0), i(m), w.current = requestAnimationFrame(() => {
|
|
60
60
|
w.current = requestAnimationFrame(() => {
|
|
61
61
|
v(!1), A(!0), w.current = null;
|
|
@@ -63,9 +63,9 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
63
63
|
})) : (i(m), A(!0)), N.current = !1;
|
|
64
64
|
}, Q = (R) => {
|
|
65
65
|
w.current && (cancelAnimationFrame(w.current), w.current = null);
|
|
66
|
-
const m =
|
|
66
|
+
const m = W(R);
|
|
67
67
|
i(m), v(!1), A(!1);
|
|
68
|
-
},
|
|
68
|
+
}, k = () => {
|
|
69
69
|
h.current && (clearTimeout(h.current), h.current = null), b.current = setTimeout(() => {
|
|
70
70
|
g(!0);
|
|
71
71
|
}, 400);
|
|
@@ -76,7 +76,7 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
76
76
|
}, _ = () => {
|
|
77
77
|
g(!1);
|
|
78
78
|
}, D = a.source === "unsplash" ? "Unsplash" : "Pixabay", ce = u || c, q = () => {
|
|
79
|
-
if (!u) return
|
|
79
|
+
if (!u) return "none";
|
|
80
80
|
switch (o) {
|
|
81
81
|
case "top":
|
|
82
82
|
return `scale(${1.12}) translateY(5%)`;
|
|
@@ -97,26 +97,26 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
97
97
|
onClick: S,
|
|
98
98
|
onMouseEnter: se,
|
|
99
99
|
onMouseLeave: Q,
|
|
100
|
-
className: `sc:group sc:relative sc:cursor-pointer sc:overflow-hidden ${
|
|
100
|
+
className: `sc:group sc:relative sc:cursor-pointer sc:overflow-hidden ${E ? "sc:h-full sc:rounded-xs" : "sc:break-inside-avoid sc:rounded-lg"}`,
|
|
101
101
|
children: [
|
|
102
102
|
/* @__PURE__ */ e(
|
|
103
103
|
"img",
|
|
104
104
|
{
|
|
105
105
|
src: a.urls.small,
|
|
106
106
|
alt: a.alt || "Image",
|
|
107
|
-
className: `sc:duration-500 sc:ease-out ${T ? "sc:transition-none" : "sc:transition-transform"} ${
|
|
107
|
+
className: `sc:duration-500 sc:ease-out ${T ? "sc:transition-none" : "sc:transition-transform"} ${E ? "sc:h-full sc:w-full sc:object-cover" : "sc:w-full sc:object-cover"}`,
|
|
108
108
|
style: {
|
|
109
109
|
transform: q(),
|
|
110
|
-
filter: u ? "brightness(1)" :
|
|
110
|
+
filter: u ? "brightness(1.04)" : void 0
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
),
|
|
114
114
|
/* @__PURE__ */ e("div", { className: "sc:absolute sc:top-2 sc:right-2 sc:z-10", children: /* @__PURE__ */ e(
|
|
115
115
|
"button",
|
|
116
116
|
{
|
|
117
|
-
className: `sc:relative sc:flex sc:h-6 sc:w-6 sc:items-center sc:justify-center sc:rounded-full sc:bg-black/
|
|
117
|
+
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 ${ce ? "sc:opacity-100" : "sc:pointer-events-none sc:opacity-0"}`,
|
|
118
118
|
"aria-label": "Image info",
|
|
119
|
-
onMouseEnter:
|
|
119
|
+
onMouseEnter: k,
|
|
120
120
|
onMouseLeave: te,
|
|
121
121
|
children: /* @__PURE__ */ e(p, { icon: "lucide:aperture", className: "sc:size-4 sc:text-white/80" })
|
|
122
122
|
}
|
|
@@ -176,7 +176,7 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
176
176
|
]
|
|
177
177
|
}
|
|
178
178
|
);
|
|
179
|
-
}),
|
|
179
|
+
}), Be = $e.memo(function({ vector: a, onVectorSelect: x, fixedHeight: E = !1 }) {
|
|
180
180
|
const [u, A] = r(!1), [c, g] = r(!1), o = M(null), i = M(null), b = () => {
|
|
181
181
|
c || x(a);
|
|
182
182
|
}, h = () => {
|
|
@@ -196,12 +196,12 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
196
196
|
onClick: b,
|
|
197
197
|
onMouseEnter: () => A(!0),
|
|
198
198
|
onMouseLeave: () => A(!1),
|
|
199
|
-
className: `sc:group sc:relative sc:cursor-pointer sc:overflow-hidden sc:bg-white/10 sc:transition-all sc:duration-300 ${
|
|
199
|
+
className: `sc:group sc:relative sc:cursor-pointer sc:overflow-hidden sc:bg-white/10 sc:transition-all sc:duration-300 ${E ? "sc:h-full sc:rounded-xs" : "sc:break-inside-avoid sc:rounded-lg"} ${u ? "sc:scale-105 sc:bg-white/20" : ""}`,
|
|
200
200
|
children: [
|
|
201
201
|
/* @__PURE__ */ e(
|
|
202
202
|
"div",
|
|
203
203
|
{
|
|
204
|
-
className: `sc:flex sc:items-center sc:justify-center sc:p-6 sc:transition-all sc:duration-300 ${
|
|
204
|
+
className: `sc:flex sc:items-center sc:justify-center sc:p-6 sc:transition-all sc:duration-300 ${E ? "sc:h-full sc:w-full" : "sc:aspect-square sc:w-full"}`,
|
|
205
205
|
children: /* @__PURE__ */ e(
|
|
206
206
|
"img",
|
|
207
207
|
{
|
|
@@ -209,7 +209,7 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
209
209
|
alt: a.term,
|
|
210
210
|
className: `sc:max-h-full sc:max-w-full sc:object-contain sc:transition-all sc:duration-300 ${u ? "sc:scale-110" : "sc:scale-100"}`,
|
|
211
211
|
style: {
|
|
212
|
-
filter: u ? "brightness(1.1)" :
|
|
212
|
+
filter: u ? "brightness(1.1)" : void 0
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
215
|
)
|
|
@@ -226,7 +226,7 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
226
226
|
/* @__PURE__ */ e(
|
|
227
227
|
"button",
|
|
228
228
|
{
|
|
229
|
-
className: `sc:relative sc:flex sc:h-6 sc:w-6 sc:items-center sc:justify-center sc:rounded-full sc:bg-black/
|
|
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
232
|
onMouseLeave: U,
|
|
@@ -253,15 +253,15 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
253
253
|
]
|
|
254
254
|
}
|
|
255
255
|
);
|
|
256
|
-
}),
|
|
256
|
+
}), ps = ({
|
|
257
257
|
isOpen: d,
|
|
258
258
|
onToggle: a,
|
|
259
259
|
onImageSelect: x,
|
|
260
|
-
currentImageUrl:
|
|
260
|
+
currentImageUrl: E,
|
|
261
261
|
placement: u = "bottom",
|
|
262
262
|
busy: A = !1
|
|
263
263
|
}) => {
|
|
264
|
-
const { imageSearch: c, generate: g, vectors: o, removeBackground: i } =
|
|
264
|
+
const { imageSearch: c, generate: g, vectors: o, removeBackground: i } = Ge(), b = je(
|
|
265
265
|
() => [
|
|
266
266
|
...c ? ["search"] : [],
|
|
267
267
|
"url",
|
|
@@ -269,44 +269,44 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
269
269
|
...g ? ["ai"] : []
|
|
270
270
|
],
|
|
271
271
|
[c, o, g]
|
|
272
|
-
), [h, U] = r(""), [N, T] = r(""), [v, w] = r([]), [S,
|
|
272
|
+
), [h, U] = r(""), [N, T] = r(""), [v, w] = r([]), [S, W] = r(!1), [se, Q] = r(null), [k, te] = r(b[0]), [$, _] = r(1), [D, 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
|
-
b.includes(
|
|
275
|
-
}, [b,
|
|
276
|
-
d &&
|
|
277
|
-
}, [d,
|
|
274
|
+
b.includes(k) || te(b[0]);
|
|
275
|
+
}, [b, k]), ie(() => {
|
|
276
|
+
d && E && (T(E), te("url"));
|
|
277
|
+
}, [d, E]), ie(() => {
|
|
278
278
|
d || (U(""), 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) => {
|
|
282
282
|
if (c) {
|
|
283
|
-
|
|
283
|
+
W(!0), Q(null);
|
|
284
284
|
try {
|
|
285
285
|
const I = await c.search({ query: s, page: n, perPage: 30 });
|
|
286
286
|
w((X) => f ? [...X, ...I.results] : I.results), _(I.page), ce(I.hasMore);
|
|
287
287
|
} catch (I) {
|
|
288
|
-
Q(
|
|
288
|
+
Q(ms), xe.error("Error searching images:", I);
|
|
289
289
|
} finally {
|
|
290
|
-
|
|
290
|
+
W(!1);
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
293
|
},
|
|
294
294
|
[c]
|
|
295
295
|
);
|
|
296
296
|
ie(() => {
|
|
297
|
-
d && !h &&
|
|
298
|
-
}, [d,
|
|
299
|
-
const
|
|
297
|
+
d && !h && k === "search" && v.length === 0 && c && we("", 1, !1);
|
|
298
|
+
}, [d, k, c]);
|
|
299
|
+
const Xe = (s) => {
|
|
300
300
|
s.preventDefault(), we(h, 1, !1);
|
|
301
|
-
},
|
|
301
|
+
}, Me = fe(() => {
|
|
302
302
|
S || !D || we(h, $ + 1, !0);
|
|
303
303
|
}, [S, D, h, $, we]);
|
|
304
304
|
ie(() => {
|
|
305
305
|
const s = Ne.current;
|
|
306
|
-
if (!s || !d ||
|
|
306
|
+
if (!s || !d || k !== "search") return;
|
|
307
307
|
const n = new IntersectionObserver(
|
|
308
308
|
(f) => {
|
|
309
|
-
f[0].isIntersecting && D && !S &&
|
|
309
|
+
f[0].isIntersecting && D && !S && Me();
|
|
310
310
|
},
|
|
311
311
|
{
|
|
312
312
|
root: null,
|
|
@@ -319,7 +319,7 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
319
319
|
return n.observe(s), () => {
|
|
320
320
|
n.disconnect();
|
|
321
321
|
};
|
|
322
|
-
}, [d,
|
|
322
|
+
}, [d, k, D, S, Me]);
|
|
323
323
|
const ye = fe(
|
|
324
324
|
async (s, n) => {
|
|
325
325
|
if (o) {
|
|
@@ -327,11 +327,11 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
327
327
|
try {
|
|
328
328
|
const { results: f, nextPage: I } = await o.search({ query: s, nextPage: n ?? null });
|
|
329
329
|
y(n ? (X) => {
|
|
330
|
-
const
|
|
331
|
-
return [...X, ...f.filter((ue) => !
|
|
330
|
+
const Re = new Set(X.map((ue) => ue.id));
|
|
331
|
+
return [...X, ...f.filter((ue) => !Re.has(ue.id))];
|
|
332
332
|
} : f), be(I), ge(I !== null);
|
|
333
333
|
} catch (f) {
|
|
334
|
-
ae(
|
|
334
|
+
ae(fs), xe.error("Error searching vectors:", f);
|
|
335
335
|
} finally {
|
|
336
336
|
P(!1);
|
|
337
337
|
}
|
|
@@ -340,19 +340,19 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
340
340
|
[o]
|
|
341
341
|
);
|
|
342
342
|
ie(() => {
|
|
343
|
-
d && !m &&
|
|
344
|
-
}, [d,
|
|
345
|
-
const
|
|
343
|
+
d && !m && k === "vector" && z.length === 0 && o && ye("");
|
|
344
|
+
}, [d, k, o]);
|
|
345
|
+
const Ye = (s) => {
|
|
346
346
|
s.preventDefault(), ye(m);
|
|
347
|
-
},
|
|
347
|
+
}, Ae = fe(() => {
|
|
348
348
|
L || !K || !j || ye(m, j);
|
|
349
349
|
}, [L, K, j, m, ye]);
|
|
350
350
|
ie(() => {
|
|
351
351
|
const s = pe.current;
|
|
352
|
-
if (!s || !d ||
|
|
352
|
+
if (!s || !d || k !== "vector") return;
|
|
353
353
|
const n = new IntersectionObserver(
|
|
354
354
|
(f) => {
|
|
355
|
-
f[0].isIntersecting && K && !L &&
|
|
355
|
+
f[0].isIntersecting && K && !L && Ae();
|
|
356
356
|
},
|
|
357
357
|
{
|
|
358
358
|
root: null,
|
|
@@ -363,11 +363,11 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
363
363
|
return n.observe(s), () => {
|
|
364
364
|
n.disconnect();
|
|
365
365
|
};
|
|
366
|
-
}, [d,
|
|
367
|
-
const
|
|
366
|
+
}, [d, k, K, L, Ae]);
|
|
367
|
+
const Te = (s) => {
|
|
368
368
|
const n = s.selectUrl || s.urls.svg || s.urls.png;
|
|
369
369
|
n && (x(n), a(!1));
|
|
370
|
-
},
|
|
370
|
+
}, ze = (s) => {
|
|
371
371
|
var n;
|
|
372
372
|
try {
|
|
373
373
|
Promise.resolve((n = c == null ? void 0 : c.trackSelect) == null ? void 0 : n.call(c, s)).catch(() => {
|
|
@@ -377,33 +377,33 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
377
377
|
x(s.urls.regular), a(!1);
|
|
378
378
|
}, We = (s) => {
|
|
379
379
|
s.preventDefault(), N.trim() && (x(N.trim()), a(!1));
|
|
380
|
-
},
|
|
380
|
+
}, Qe = (s) => {
|
|
381
381
|
var f;
|
|
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
385
|
I.onload = (X) => {
|
|
386
386
|
var ue;
|
|
387
|
-
const
|
|
388
|
-
T(
|
|
387
|
+
const Re = (ue = X.target) == null ? void 0 : ue.result;
|
|
388
|
+
T(Re);
|
|
389
389
|
}, I.readAsDataURL(n);
|
|
390
390
|
}
|
|
391
|
-
},
|
|
391
|
+
}, qe = () => {
|
|
392
392
|
var s;
|
|
393
|
-
(s =
|
|
394
|
-
},
|
|
393
|
+
(s = Le.current) == null || s.click();
|
|
394
|
+
}, Ze = async () => {
|
|
395
395
|
if (!(!i || !N.trim())) {
|
|
396
396
|
ne(!0), ee(null);
|
|
397
397
|
try {
|
|
398
398
|
const s = await i(N);
|
|
399
399
|
T(s);
|
|
400
400
|
} catch (s) {
|
|
401
|
-
ee(
|
|
401
|
+
ee(Ue), xe.error("Error removing background:", s);
|
|
402
402
|
} finally {
|
|
403
403
|
ne(!1);
|
|
404
404
|
}
|
|
405
405
|
}
|
|
406
|
-
},
|
|
406
|
+
}, Je = async (s) => {
|
|
407
407
|
var n, f;
|
|
408
408
|
if (s.preventDefault(), !!g) {
|
|
409
409
|
if (!F.trim()) {
|
|
@@ -419,34 +419,34 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
419
419
|
numberResults: 1
|
|
420
420
|
})).images) == null ? void 0 : n[0]) == null ? void 0 : f.imageUrl;
|
|
421
421
|
if (!X)
|
|
422
|
-
throw new Error(
|
|
422
|
+
throw new Error(Ve);
|
|
423
423
|
he(X);
|
|
424
424
|
} catch (I) {
|
|
425
|
-
de(
|
|
425
|
+
de(gs(I, Ve)), xe.error("Error generating AI image:", I);
|
|
426
426
|
} finally {
|
|
427
427
|
l(!1);
|
|
428
428
|
}
|
|
429
429
|
}
|
|
430
|
-
},
|
|
430
|
+
}, Ke = () => {
|
|
431
431
|
H && (x(H), a(!1));
|
|
432
|
-
},
|
|
432
|
+
}, Oe = async () => {
|
|
433
433
|
if (!(!i || !H)) {
|
|
434
434
|
ne(!0), ee(null);
|
|
435
435
|
try {
|
|
436
436
|
const s = await i(H);
|
|
437
437
|
he(s);
|
|
438
438
|
} catch (s) {
|
|
439
|
-
ee(
|
|
439
|
+
ee(Ue), xe.error("Error removing background:", s);
|
|
440
440
|
} finally {
|
|
441
441
|
ne(!1);
|
|
442
442
|
}
|
|
443
443
|
}
|
|
444
|
-
},
|
|
444
|
+
}, es = (s, n) => {
|
|
445
445
|
const f = s.width / s.height;
|
|
446
446
|
return n % 12 === 0 && f > 0.8 && f < 1.2 ? "sc:col-span-2 sc:row-span-2" : f < 0.75 ? "sc:row-span-2" : f > 1.5 ? "sc:col-span-2" : "";
|
|
447
447
|
};
|
|
448
448
|
return /* @__PURE__ */ t(
|
|
449
|
-
|
|
449
|
+
ns,
|
|
450
450
|
{
|
|
451
451
|
isOpen: d,
|
|
452
452
|
onClose: () => a(!1),
|
|
@@ -475,7 +475,7 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
475
475
|
/* @__PURE__ */ t(
|
|
476
476
|
C,
|
|
477
477
|
{
|
|
478
|
-
value:
|
|
478
|
+
value: k,
|
|
479
479
|
onValueChange: (s) => te(s),
|
|
480
480
|
className: "sc:flex sc:flex-col",
|
|
481
481
|
"data-testid": "image-browser-container",
|
|
@@ -529,7 +529,7 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
529
529
|
className: "sc:h-11 sc:w-14 sc:px-0 sc:md:h-9 sc:md:w-11",
|
|
530
530
|
"data-testid": "image-tab-ai",
|
|
531
531
|
children: [
|
|
532
|
-
/* @__PURE__ */ e(
|
|
532
|
+
/* @__PURE__ */ e(Pe, { size: 24 }),
|
|
533
533
|
/* @__PURE__ */ e(C.Indicator, {})
|
|
534
534
|
]
|
|
535
535
|
}
|
|
@@ -538,9 +538,9 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
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: 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: [
|
|
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...",
|
|
@@ -550,9 +550,9 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
550
550
|
"data-testid": "image-search-input"
|
|
551
551
|
}
|
|
552
552
|
) }),
|
|
553
|
-
/* @__PURE__ */ e(
|
|
553
|
+
/* @__PURE__ */ e(Y, { 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
|
+
Y,
|
|
556
556
|
{
|
|
557
557
|
size: "icon",
|
|
558
558
|
variant: "secondary",
|
|
@@ -575,9 +575,9 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
575
575
|
display: "grid",
|
|
576
576
|
gridTemplateColumns: u === "bottom" ? "repeat(auto-fill, minmax(200px, 1fr))" : "repeat(3, 1fr)",
|
|
577
577
|
gridAutoRows: u === "bottom" ? "200px" : "120px",
|
|
578
|
-
gap:
|
|
578
|
+
gap: hs
|
|
579
579
|
},
|
|
580
|
-
children: v.map((s, n) => /* @__PURE__ */ e("div", { className:
|
|
580
|
+
children: v.map((s, n) => /* @__PURE__ */ e("div", { className: es(s, n), style: ke, children: /* @__PURE__ */ e(De, { image: s, onImageSelect: ze, fixedHeight: !0 }) }, s.id))
|
|
581
581
|
}
|
|
582
582
|
)
|
|
583
583
|
) : (
|
|
@@ -589,9 +589,9 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
589
589
|
style: {
|
|
590
590
|
display: "grid",
|
|
591
591
|
gridTemplateColumns: u === "bottom" ? "repeat(auto-fill, minmax(150px, 1fr))" : "repeat(auto-fill, minmax(120px, 1fr))",
|
|
592
|
-
gap:
|
|
592
|
+
gap: Se
|
|
593
593
|
},
|
|
594
|
-
children: v.map((s) => /* @__PURE__ */ e("div", { style: { aspectRatio: "1 / 1" }, children: /* @__PURE__ */ e(
|
|
594
|
+
children: v.map((s) => /* @__PURE__ */ e("div", { style: { aspectRatio: "1 / 1", ...ke }, children: /* @__PURE__ */ e(De, { image: s, onImageSelect: ze, fixedHeight: !0 }) }, s.id))
|
|
595
595
|
}
|
|
596
596
|
)
|
|
597
597
|
),
|
|
@@ -609,10 +609,10 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
609
609
|
/* @__PURE__ */ e(
|
|
610
610
|
"input",
|
|
611
611
|
{
|
|
612
|
-
ref:
|
|
612
|
+
ref: Le,
|
|
613
613
|
type: "file",
|
|
614
614
|
accept: "image/*",
|
|
615
|
-
onChange:
|
|
615
|
+
onChange: Qe,
|
|
616
616
|
className: "sc:hidden"
|
|
617
617
|
}
|
|
618
618
|
),
|
|
@@ -620,7 +620,7 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
620
620
|
"button",
|
|
621
621
|
{
|
|
622
622
|
type: "button",
|
|
623
|
-
onClick:
|
|
623
|
+
onClick: qe,
|
|
624
624
|
className: "sc:flex sc:flex-col sc:items-center sc:justify-center sc:gap-3 sc:rounded-2xl sc:border-2 sc:border-dashed sc:border-divider sc:bg-muted/30 sc:px-6 sc:py-10 sc:transition-colors sc:hover:bg-muted/50 sc:active:bg-muted/60",
|
|
625
625
|
"data-testid": "image-upload-btn",
|
|
626
626
|
children: [
|
|
@@ -650,9 +650,9 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
650
650
|
className: "sc:flex sc:flex-col sc:gap-3",
|
|
651
651
|
children: [
|
|
652
652
|
/* @__PURE__ */ t(Ie, { children: [
|
|
653
|
-
/* @__PURE__ */ e(
|
|
653
|
+
/* @__PURE__ */ e(Ee, { className: "sc:sr-only", children: "Image URL" }),
|
|
654
654
|
/* @__PURE__ */ e(
|
|
655
|
-
|
|
655
|
+
Ce,
|
|
656
656
|
{
|
|
657
657
|
type: "url",
|
|
658
658
|
placeholder: "https://example.com/image.jpg",
|
|
@@ -664,7 +664,7 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
664
664
|
)
|
|
665
665
|
] }),
|
|
666
666
|
/* @__PURE__ */ e(
|
|
667
|
-
|
|
667
|
+
Y,
|
|
668
668
|
{
|
|
669
669
|
type: "submit",
|
|
670
670
|
variant: "default",
|
|
@@ -681,9 +681,9 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
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
|
+
Y,
|
|
685
685
|
{
|
|
686
|
-
onClick:
|
|
686
|
+
onClick: Ze,
|
|
687
687
|
disabled: B || !N.trim(),
|
|
688
688
|
variant: "secondary",
|
|
689
689
|
size: "sm",
|
|
@@ -723,9 +723,9 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
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: 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: [
|
|
727
727
|
/* @__PURE__ */ e(Ie, { className: "sc:flex-1", "aria-label": "Search for vector graphics", children: /* @__PURE__ */ e(
|
|
728
|
-
|
|
728
|
+
Ce,
|
|
729
729
|
{
|
|
730
730
|
type: "text",
|
|
731
731
|
placeholder: "Search for icons...",
|
|
@@ -735,9 +735,9 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
735
735
|
"data-testid": "vector-search-input"
|
|
736
736
|
}
|
|
737
737
|
) }),
|
|
738
|
-
/* @__PURE__ */ e(
|
|
738
|
+
/* @__PURE__ */ e(Y, { 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
|
+
Y,
|
|
741
741
|
{
|
|
742
742
|
size: "icon",
|
|
743
743
|
variant: "secondary",
|
|
@@ -760,9 +760,9 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
760
760
|
display: "grid",
|
|
761
761
|
gridTemplateColumns: u === "bottom" ? "repeat(auto-fill, minmax(150px, 1fr))" : "repeat(3, 1fr)",
|
|
762
762
|
gridAutoRows: u === "bottom" ? "150px" : "120px",
|
|
763
|
-
gap:
|
|
763
|
+
gap: Se
|
|
764
764
|
},
|
|
765
|
-
children: z.map((s) => /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
765
|
+
children: z.map((s) => /* @__PURE__ */ e("div", { style: ke, children: /* @__PURE__ */ e(Be, { vector: s, onVectorSelect: Te, fixedHeight: !0 }) }, s.id))
|
|
766
766
|
}
|
|
767
767
|
)
|
|
768
768
|
) : (
|
|
@@ -774,9 +774,9 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
774
774
|
style: {
|
|
775
775
|
display: "grid",
|
|
776
776
|
gridTemplateColumns: u === "bottom" ? "repeat(auto-fill, minmax(120px, 1fr))" : "repeat(auto-fill, minmax(100px, 1fr))",
|
|
777
|
-
gap:
|
|
777
|
+
gap: Se
|
|
778
778
|
},
|
|
779
|
-
children: z.map((s) => /* @__PURE__ */ e("div", { style: { aspectRatio: "1 / 1" }, children: /* @__PURE__ */ e(
|
|
779
|
+
children: z.map((s) => /* @__PURE__ */ e("div", { style: { aspectRatio: "1 / 1", ...ke }, children: /* @__PURE__ */ e(Be, { vector: s, onVectorSelect: Te, fixedHeight: !0 }) }, s.id))
|
|
780
780
|
}
|
|
781
781
|
)
|
|
782
782
|
),
|
|
@@ -791,11 +791,11 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
791
791
|
] })
|
|
792
792
|
] }),
|
|
793
793
|
g && /* @__PURE__ */ t(C.Panel, { id: "ai", className: "sc:flex sc:flex-col sc:gap-6 sc:p-6", children: [
|
|
794
|
-
/* @__PURE__ */ t("form", { onSubmit:
|
|
794
|
+
/* @__PURE__ */ t("form", { onSubmit: Je, className: "sc:flex sc:flex-col sc:gap-6", children: [
|
|
795
795
|
/* @__PURE__ */ t(Ie, { children: [
|
|
796
|
-
/* @__PURE__ */ e(
|
|
796
|
+
/* @__PURE__ */ e(Ee, { children: "Prompt" }),
|
|
797
797
|
/* @__PURE__ */ e(
|
|
798
|
-
|
|
798
|
+
Fe,
|
|
799
799
|
{
|
|
800
800
|
placeholder: "Describe the image you want to generate... (e.g., 'avocado, transparent background')",
|
|
801
801
|
value: F,
|
|
@@ -808,7 +808,7 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
808
808
|
)
|
|
809
809
|
] }),
|
|
810
810
|
/* @__PURE__ */ e(
|
|
811
|
-
|
|
811
|
+
Y,
|
|
812
812
|
{
|
|
813
813
|
type: "submit",
|
|
814
814
|
variant: "default",
|
|
@@ -819,7 +819,7 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
819
819
|
/* @__PURE__ */ e(p, { icon: "eos-icons:loading", className: "sc:size-5 sc:animate-spin" }),
|
|
820
820
|
"Generating..."
|
|
821
821
|
] }) : /* @__PURE__ */ t(le, { children: [
|
|
822
|
-
/* @__PURE__ */ e(
|
|
822
|
+
/* @__PURE__ */ e(Pe, { size: 24 }),
|
|
823
823
|
"Generate Image"
|
|
824
824
|
] })
|
|
825
825
|
}
|
|
@@ -827,7 +827,7 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
827
827
|
] }),
|
|
828
828
|
O && /* @__PURE__ */ e("div", { className: "sc:border-danger sc:bg-danger/10 sc:text-danger sc:rounded-2xl sc:border-2 sc:px-4 sc:py-3 sc:text-sm", children: O }),
|
|
829
829
|
H && /* @__PURE__ */ t("div", { className: "sc:flex sc:flex-col sc:gap-4 sc:rounded-2xl sc:border sc:border-divider sc:bg-muted/40 sc:p-6", children: [
|
|
830
|
-
/* @__PURE__ */ e("div", { className: "sc:flex sc:items-center sc:justify-between", children: /* @__PURE__ */ e(
|
|
830
|
+
/* @__PURE__ */ e("div", { className: "sc:flex sc:items-center sc:justify-between", children: /* @__PURE__ */ e(Ee, { className: "sc:text-muted sc:text-xs sc:uppercase sc:tracking-wide", children: "Generated Image" }) }),
|
|
831
831
|
/* @__PURE__ */ e("div", { className: "sc:flex sc:w-fit sc:items-center sc:justify-center sc:overflow-hidden sc:rounded-lg sc:bg-white/50 sc:dark:bg-black/50", style: { maxHeight: "500px", maxWidth: "100%" }, children: /* @__PURE__ */ e(
|
|
832
832
|
"img",
|
|
833
833
|
{
|
|
@@ -837,14 +837,14 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
837
837
|
}
|
|
838
838
|
) }),
|
|
839
839
|
/* @__PURE__ */ t("div", { className: "sc:flex sc:flex-col sc:gap-1", children: [
|
|
840
|
-
/* @__PURE__ */ e(
|
|
840
|
+
/* @__PURE__ */ e(Ee, { className: "sc:text-muted sc:text-xs", children: "Prompt" }),
|
|
841
841
|
/* @__PURE__ */ e("p", { className: "sc:text-sm", children: F })
|
|
842
842
|
] }),
|
|
843
843
|
/* @__PURE__ */ t("div", { className: "sc:flex sc:flex-col sc:gap-3", children: [
|
|
844
844
|
i && /* @__PURE__ */ e(
|
|
845
|
-
|
|
845
|
+
Y,
|
|
846
846
|
{
|
|
847
|
-
onClick:
|
|
847
|
+
onClick: Oe,
|
|
848
848
|
disabled: B || !H,
|
|
849
849
|
variant: "secondary",
|
|
850
850
|
size: "sm",
|
|
@@ -861,9 +861,9 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
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
|
+
Y,
|
|
865
865
|
{
|
|
866
|
-
onClick:
|
|
866
|
+
onClick: Ke,
|
|
867
867
|
variant: "default",
|
|
868
868
|
className: "sc:w-full",
|
|
869
869
|
"data-testid": "ai-use-image-btn",
|
|
@@ -879,36 +879,36 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
879
879
|
]
|
|
880
880
|
}
|
|
881
881
|
);
|
|
882
|
-
},
|
|
882
|
+
}, xs = He("ImagePanel"), ks = ({
|
|
883
883
|
isOpen: d,
|
|
884
884
|
onOpenChange: a,
|
|
885
885
|
onImageAdded: x,
|
|
886
|
-
onImageChanged:
|
|
886
|
+
onImageChanged: E,
|
|
887
887
|
changingElementId: u,
|
|
888
888
|
onChangingElementIdChange: A,
|
|
889
889
|
services: c
|
|
890
890
|
}) => {
|
|
891
891
|
var z;
|
|
892
|
-
const { elements: g, setElements: o, canvasEditorRef: i, artboardManager: b, executeAddElement: h, executeElementUpdate: U } =
|
|
892
|
+
const { elements: g, setElements: o, canvasEditorRef: i, artboardManager: b, executeAddElement: h, executeElementUpdate: U } = 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
|
-
if (c != null && c.ingestImageUrl) return
|
|
896
|
-
}, [w.ingestImage, c == null ? void 0 : c.ingestImage, c == null ? void 0 : c.ingestImageUrl]),
|
|
897
|
-
|
|
895
|
+
if (c != null && c.ingestImageUrl) return is(c.ingestImageUrl);
|
|
896
|
+
}, [w.ingestImage, c == null ? void 0 : c.ingestImage, c == null ? void 0 : c.ingestImageUrl]), W = M(S);
|
|
897
|
+
W.current = S;
|
|
898
898
|
const se = M(g);
|
|
899
899
|
se.current = g;
|
|
900
900
|
const Q = M(N);
|
|
901
901
|
Q.current = N;
|
|
902
|
-
const [
|
|
902
|
+
const [k, te] = r(null), $ = u ?? k, _ = A ?? te, [D, ce] = r(!1), q = fe(
|
|
903
903
|
async (y) => {
|
|
904
904
|
var ve, F;
|
|
905
|
-
const L =
|
|
905
|
+
const L = W.current;
|
|
906
906
|
if (L) {
|
|
907
907
|
ce(!0);
|
|
908
908
|
try {
|
|
909
909
|
y = await L(y);
|
|
910
910
|
} catch (G) {
|
|
911
|
-
|
|
911
|
+
xs.warn("Image ingest failed; placing the original URL", G);
|
|
912
912
|
} finally {
|
|
913
913
|
ce(!1);
|
|
914
914
|
}
|
|
@@ -916,12 +916,12 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
916
916
|
const P = se.current, J = Q.current;
|
|
917
917
|
if ($) {
|
|
918
918
|
const G = P.find((V) => V.id === $);
|
|
919
|
-
if (G &&
|
|
919
|
+
if (G && us(G)) {
|
|
920
920
|
const V = G, l = G.clone(), O = ((ve = i.current) == null ? void 0 : ve.getZoom()) || 1, de = V.transformData.width || 300 / O, H = V.transformData.height || 300 / O;
|
|
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), U(V, l),
|
|
924
|
+
}, l.loadImage(y), U(V, l), E && E(l);
|
|
925
925
|
}
|
|
926
926
|
_(null);
|
|
927
927
|
return;
|
|
@@ -930,7 +930,7 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
930
930
|
alert("Please create or select an artboard first");
|
|
931
931
|
return;
|
|
932
932
|
}
|
|
933
|
-
const ae = `element-${Date.now()}`, j = b.getActiveArtboard(), be = j ? j.x + j.width / 2 : window.innerWidth / 2, K = j ? j.y + j.height / 2 : window.innerHeight / 2, ge = ((F = i.current) == null ? void 0 : F.getZoom()) || 1, re = new
|
|
933
|
+
const ae = `element-${Date.now()}`, j = b.getActiveArtboard(), be = j ? j.x + j.width / 2 : window.innerWidth / 2, K = j ? j.y + j.height / 2 : window.innerHeight / 2, ge = ((F = i.current) == null ? void 0 : F.getZoom()) || 1, re = new ds({
|
|
934
934
|
id: ae,
|
|
935
935
|
x: be,
|
|
936
936
|
y: K,
|
|
@@ -959,7 +959,7 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
959
959
|
T,
|
|
960
960
|
_,
|
|
961
961
|
x,
|
|
962
|
-
|
|
962
|
+
E
|
|
963
963
|
]
|
|
964
964
|
), R = fe(
|
|
965
965
|
(y) => {
|
|
@@ -967,7 +967,7 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
967
967
|
},
|
|
968
968
|
[a, _]
|
|
969
969
|
), m = $ ? (z = g.find((y) => y.id === $)) == null ? void 0 : z.imageUrl : void 0, Z = /* @__PURE__ */ e(
|
|
970
|
-
|
|
970
|
+
ps,
|
|
971
971
|
{
|
|
972
972
|
isOpen: d,
|
|
973
973
|
onToggle: R,
|
|
@@ -976,9 +976,9 @@ const gs = "1px", Ce = "1px", Ue = Be.memo(function({ image: a, onImageSelect: x
|
|
|
976
976
|
busy: D
|
|
977
977
|
}
|
|
978
978
|
);
|
|
979
|
-
return c ? /* @__PURE__ */ e(
|
|
979
|
+
return c ? /* @__PURE__ */ e(ls, { services: c, children: Z }) : Z;
|
|
980
980
|
};
|
|
981
981
|
export {
|
|
982
982
|
ks as ImagePanel
|
|
983
983
|
};
|
|
984
|
-
//# sourceMappingURL=ImagePanel-
|
|
984
|
+
//# sourceMappingURL=ImagePanel-DLxIDKV-.js.map
|