@snowcone-app/canvas 0.30.0 → 0.32.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 +11 -0
- package/STYLING_CONTRACT.md +3 -3
- package/dist/{CanvasRenderer-BEf0hXeF.js → CanvasRenderer-1j-twIbs.js} +443 -431
- package/dist/{CanvasRenderer-BEf0hXeF.js.map → CanvasRenderer-1j-twIbs.js.map} +1 -1
- package/dist/{CanvasStateV1-BDSyYo4A.js → CanvasStateV1-BmC1JfPv.js} +813 -798
- package/dist/{CanvasStateV1-BDSyYo4A.js.map → CanvasStateV1-BmC1JfPv.js.map} +1 -1
- package/dist/ContextualToolbars-BKU8IoAM.js +6474 -0
- package/dist/ContextualToolbars-BKU8IoAM.js.map +1 -0
- package/dist/{EditorCanvasImpl-DXeBz2CX.js → EditorCanvasImpl-4voOsj2k.js} +19 -20
- package/dist/{EditorCanvasImpl-DXeBz2CX.js.map → EditorCanvasImpl-4voOsj2k.js.map} +1 -1
- package/dist/{ExportManager-DUdis6se.js → ExportManager-Ci81K6xA.js} +783 -500
- package/dist/ExportManager-Ci81K6xA.js.map +1 -0
- package/dist/{FontAnalyzer-DKG5JK0x.js → FontAnalyzer-BrKY6XYn.js} +1604 -1444
- package/dist/FontAnalyzer-BrKY6XYn.js.map +1 -0
- package/dist/{ImagePanel-CBgGqmVV.js → ImagePanel-ntJBepby.js} +49 -49
- package/dist/{ImagePanel-CBgGqmVV.js.map → ImagePanel-ntJBepby.js.map} +1 -1
- package/dist/{SnowconeCanvas-BWPBngvI.js → SnowconeCanvas-CgQdiBXv.js} +27 -27
- package/dist/{SnowconeCanvas-BWPBngvI.js.map → SnowconeCanvas-CgQdiBXv.js.map} +1 -1
- package/dist/advanced.mjs +14 -14
- package/dist/components/ImageToolbar.d.ts +12 -0
- package/dist/components/ShapeToolbar.d.ts +8 -0
- package/dist/components/TextToolbar.d.ts +5 -1
- package/dist/components/toolbars/EmbeddedToolbarLayout.d.ts +6 -0
- package/dist/components/toolbars/GroupElementToolbar.d.ts +8 -0
- package/dist/components/toolbars/SecondaryPanels.d.ts +40 -1
- package/dist/components/toolbars/index.d.ts +2 -2
- package/dist/components/ui/SliderRow.d.ts +6 -0
- package/dist/components/ui/toolbar-button.d.ts +2 -2
- package/dist/core/BaseElement.d.ts +2 -1
- package/dist/core/image-adjustments.d.ts +32 -0
- package/dist/core/shape-fill.d.ts +31 -0
- package/dist/{custom-icons-BIaRovwG.js → custom-icons-DTWtkJ9N.js} +7 -7
- package/dist/{custom-icons-BIaRovwG.js.map → custom-icons-DTWtkJ9N.js.map} +1 -1
- package/dist/design-builder-BpbYUYtK.js +1672 -0
- package/dist/design-builder-BpbYUYtK.js.map +1 -0
- package/dist/{embed-Csez1hui.js → embed-C69x0jHc.js} +110 -111
- package/dist/{embed-Csez1hui.js.map → embed-C69x0jHc.js.map} +1 -1
- package/dist/embed.mjs +53 -54
- package/dist/embed.mjs.map +1 -1
- package/dist/errors/editorError.d.ts +7 -0
- package/dist/{guards-BSoX73yg.js → guards-BhaQgJrE.js} +2 -2
- package/dist/{guards-BSoX73yg.js.map → guards-BhaQgJrE.js.map} +1 -1
- package/dist/hooks/elementPatch.d.ts +14 -4
- package/dist/index.mjs +41 -41
- package/dist/internals.mjs +202 -133
- package/dist/internals.mjs.map +1 -1
- package/dist/rendering/LayerEffectsRenderer.d.ts +24 -0
- package/dist/rendering/element-painters.d.ts +0 -13
- package/dist/rendering/element-serializer.d.ts +3 -1
- package/dist/rendering/image-adjustments.d.ts +24 -0
- package/dist/rendering/renderer-types.d.ts +10 -1
- package/dist/state/CanvasStateV1.d.ts +22 -0
- package/dist/style.css +1 -1
- package/dist/template-fields-D-2oLhCi.js +505 -0
- package/dist/template-fields-D-2oLhCi.js.map +1 -0
- package/dist/testing.mjs +40 -41
- package/dist/testing.mjs.map +1 -1
- package/dist/types/index.d.ts +105 -1
- package/dist/types/public.d.ts +3 -2
- package/dist/{UnifiedFontService-Co9tQ59z.js → useCommands-DwnZHUg8.js} +2361 -2103
- package/dist/useCommands-DwnZHUg8.js.map +1 -0
- package/dist/{usePieceGuideBundle-CRLY2iQa.js → usePieceGuideBundle-CnSmYrmM.js} +2 -2
- package/dist/{usePieceGuideBundle-CRLY2iQa.js.map → usePieceGuideBundle-CnSmYrmM.js.map} +1 -1
- package/dist/utils/featureApplied.d.ts +6 -0
- package/dist/{validation-BGEl9rrE.js → validation-DyUOjRGa.js} +465 -465
- package/dist/{validation-BGEl9rrE.js.map → validation-DyUOjRGa.js.map} +1 -1
- package/dist/workers/export-worker.bundle.string.d.ts +1 -1
- package/example/package.json +1 -1
- package/package.json +1 -1
- package/dist/ContextualToolbars-C3D_6sep.js +0 -5960
- package/dist/ContextualToolbars-C3D_6sep.js.map +0 -1
- package/dist/ExportManager-DUdis6se.js.map +0 -1
- package/dist/FontAnalyzer-DKG5JK0x.js.map +0 -1
- package/dist/UnifiedFontService-Co9tQ59z.js.map +0 -1
- package/dist/design-builder-JYLO_Hyi.js +0 -470
- package/dist/design-builder-JYLO_Hyi.js.map +0 -1
- package/dist/editorErrors-WzaNxU1Y.js +0 -1206
- package/dist/editorErrors-WzaNxU1Y.js.map +0 -1
- package/dist/template-fields-DYPW7bVU.js +0 -716
- package/dist/template-fields-DYPW7bVU.js.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as e, jsxs as c, Fragment as K } from "react/jsx-runtime";
|
|
2
2
|
import * as Ze from "react";
|
|
3
3
|
import Be, { useMemo as Je, useState as r, useRef as U, useEffect as J, useCallback as ae } from "react";
|
|
4
|
-
import { u as Ke,
|
|
5
|
-
import {
|
|
6
|
-
import { c as ns, I as os } from "./FontAnalyzer-
|
|
7
|
-
import { T as k, S as Te, a as xe, I as ye, L as be } from "./custom-icons-
|
|
8
|
-
import { a as ls } from "./guards-
|
|
4
|
+
import { u as Ke, g as Oe } from "./design-builder-BpbYUYtK.js";
|
|
5
|
+
import { o as es, N as ss, d as cs, W as ts, I as v, O as re, B as _, u as rs, C as as } from "./useCommands-DwnZHUg8.js";
|
|
6
|
+
import { c as ns, I as os } from "./FontAnalyzer-BrKY6XYn.js";
|
|
7
|
+
import { T as k, S as Te, a as xe, I as ye, L as be } from "./custom-icons-DTWtkJ9N.js";
|
|
8
|
+
import { a as ls } from "./guards-BhaQgJrE.js";
|
|
9
9
|
const De = Ze.forwardRef(
|
|
10
10
|
({ className: d, isInvalid: t, disabled: N, readOnly: E, required: u, variant: n, ...x }, l) => {
|
|
11
11
|
const i = es(), m = n ?? (i.variant === "default" ? "filled" : "default");
|
|
@@ -45,17 +45,17 @@ function us(d, t) {
|
|
|
45
45
|
const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N, fixedHeight: E = !1 }) {
|
|
46
46
|
const [u, n] = r(!1), [x, l] = r(!1), [i, m] = r("top"), h = U(null), C = U(null), w = U(null), V = U(!0), [S, R] = r(!1), f = U(null), Y = () => {
|
|
47
47
|
x || N(t);
|
|
48
|
-
},
|
|
48
|
+
}, W = (g) => {
|
|
49
49
|
if (!w.current) return "top";
|
|
50
|
-
const y = w.current.getBoundingClientRect(),
|
|
51
|
-
top:
|
|
52
|
-
bottom: se -
|
|
53
|
-
left:
|
|
54
|
-
right:
|
|
50
|
+
const y = w.current.getBoundingClientRect(), L = g.clientX - y.left, M = g.clientY - y.top, A = y.width, se = y.height, T = {
|
|
51
|
+
top: M,
|
|
52
|
+
bottom: se - M,
|
|
53
|
+
left: L,
|
|
54
|
+
right: A - L
|
|
55
55
|
}, $ = Math.min(T.top, T.bottom, T.left, T.right);
|
|
56
56
|
return $ === T.top ? "top" : $ === T.bottom ? "bottom" : $ === T.left ? "left" : "right";
|
|
57
|
-
},
|
|
58
|
-
const y =
|
|
57
|
+
}, Q = (g) => {
|
|
58
|
+
const y = W(g);
|
|
59
59
|
f.current && (cancelAnimationFrame(f.current), f.current = null), y !== i ? (R(!0), m(y), f.current = requestAnimationFrame(() => {
|
|
60
60
|
f.current = requestAnimationFrame(() => {
|
|
61
61
|
R(!1), n(!0), f.current = null;
|
|
@@ -63,7 +63,7 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
|
|
|
63
63
|
})) : (m(y), n(!0)), V.current = !1;
|
|
64
64
|
}, b = (g) => {
|
|
65
65
|
f.current && (cancelAnimationFrame(f.current), f.current = null);
|
|
66
|
-
const y =
|
|
66
|
+
const y = W(g);
|
|
67
67
|
m(y), R(!1), n(!1);
|
|
68
68
|
}, B = () => {
|
|
69
69
|
C.current && (clearTimeout(C.current), C.current = null), h.current = setTimeout(() => {
|
|
@@ -95,7 +95,7 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
|
|
|
95
95
|
{
|
|
96
96
|
ref: w,
|
|
97
97
|
onClick: Y,
|
|
98
|
-
onMouseEnter:
|
|
98
|
+
onMouseEnter: Q,
|
|
99
99
|
onMouseLeave: b,
|
|
100
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: [
|
|
@@ -268,23 +268,23 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
|
|
|
268
268
|
...x ? ["ai"] : []
|
|
269
269
|
],
|
|
270
270
|
[n, l, x]
|
|
271
|
-
), [h, C] = r(""), [w, V] = r(""), [S, R] = r([]), [f, Y] = r(!1), [
|
|
271
|
+
), [h, C] = r(""), [w, V] = r(""), [S, R] = r([]), [f, Y] = r(!1), [W, Q] = r(null), [b, B] = r(m[0]), [O, ee] = r(1), [D, F] = r(!0), [j, P] = r("masonry"), [g, y] = r(""), [L, M] = r([]), [A, se] = r(!1), [T, $] = r(null), [ce, ne] = r(null), [z, G] = r(!0), [o, q] = r("grid"), [X, de] = r(""), [oe, le] = r(!1), [Ee, ve] = r(null), [Z, Ne] = r(null), [ue, me] = r(!1), [fe, he] = r(null), ke = U(null), Ce = U(null), Re = U(null);
|
|
272
272
|
J(() => {
|
|
273
273
|
m.includes(b) || B(m[0]);
|
|
274
274
|
}, [m, b]), J(() => {
|
|
275
275
|
d && E && (V(E), B("url"));
|
|
276
276
|
}, [d, E]), J(() => {
|
|
277
|
-
d || (C(""), V(""), R([]),
|
|
277
|
+
d || (C(""), V(""), R([]), Q(null), ee(1), F(!0), y(""), M([]), $(null), ne(null), G(!0));
|
|
278
278
|
}, [d]);
|
|
279
279
|
const ge = ae(
|
|
280
280
|
async (s, a, p) => {
|
|
281
281
|
if (n) {
|
|
282
|
-
Y(!0),
|
|
282
|
+
Y(!0), Q(null);
|
|
283
283
|
try {
|
|
284
284
|
const I = await n.search({ query: s, page: a, perPage: 30 });
|
|
285
285
|
R((H) => p ? [...H, ...I.results] : I.results), ee(I.page), F(I.hasMore);
|
|
286
286
|
} catch (I) {
|
|
287
|
-
|
|
287
|
+
Q(is), ie.error("Error searching images:", I);
|
|
288
288
|
} finally {
|
|
289
289
|
Y(!1);
|
|
290
290
|
}
|
|
@@ -325,7 +325,7 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
|
|
|
325
325
|
se(!0), $(null);
|
|
326
326
|
try {
|
|
327
327
|
const { results: p, nextPage: I } = await l.search({ query: s, nextPage: a ?? null });
|
|
328
|
-
|
|
328
|
+
M(a ? (H) => {
|
|
329
329
|
const we = new Set(H.map((te) => te.id));
|
|
330
330
|
return [...H, ...p.filter((te) => !we.has(te.id))];
|
|
331
331
|
} : p), ne(I), G(I !== null);
|
|
@@ -339,19 +339,19 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
|
|
|
339
339
|
[l]
|
|
340
340
|
);
|
|
341
341
|
J(() => {
|
|
342
|
-
d && !g && b === "vector" &&
|
|
342
|
+
d && !g && b === "vector" && L.length === 0 && l && pe("");
|
|
343
343
|
}, [d, b, l]);
|
|
344
344
|
const Ge = (s) => {
|
|
345
345
|
s.preventDefault(), pe(g);
|
|
346
|
-
},
|
|
347
|
-
|
|
348
|
-
}, [
|
|
346
|
+
}, Le = ae(() => {
|
|
347
|
+
A || !z || !ce || pe(g, ce);
|
|
348
|
+
}, [A, z, ce, g, pe]);
|
|
349
349
|
J(() => {
|
|
350
350
|
const s = Ce.current;
|
|
351
351
|
if (!s || !d || b !== "vector") return;
|
|
352
352
|
const a = new IntersectionObserver(
|
|
353
353
|
(p) => {
|
|
354
|
-
p[0].isIntersecting && z && !
|
|
354
|
+
p[0].isIntersecting && z && !A && Le();
|
|
355
355
|
},
|
|
356
356
|
{
|
|
357
357
|
root: null,
|
|
@@ -362,11 +362,11 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
|
|
|
362
362
|
return a.observe(s), () => {
|
|
363
363
|
a.disconnect();
|
|
364
364
|
};
|
|
365
|
-
}, [d, b, z,
|
|
366
|
-
const
|
|
365
|
+
}, [d, b, z, A, Le]);
|
|
366
|
+
const Me = (s) => {
|
|
367
367
|
const a = s.selectUrl || s.urls.svg || s.urls.png;
|
|
368
368
|
a && (N(a), t(!1));
|
|
369
|
-
},
|
|
369
|
+
}, Ae = (s) => {
|
|
370
370
|
var a;
|
|
371
371
|
try {
|
|
372
372
|
Promise.resolve((a = n == null ? void 0 : n.trackSelect) == null ? void 0 : a.call(n, s)).catch(() => {
|
|
@@ -426,9 +426,9 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
|
|
|
426
426
|
le(!1);
|
|
427
427
|
}
|
|
428
428
|
}
|
|
429
|
-
},
|
|
429
|
+
}, We = () => {
|
|
430
430
|
Z && (N(Z), t(!1));
|
|
431
|
-
},
|
|
431
|
+
}, Qe = async () => {
|
|
432
432
|
if (!(!i || !Z)) {
|
|
433
433
|
me(!0), he(null);
|
|
434
434
|
try {
|
|
@@ -548,7 +548,7 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
|
|
|
548
548
|
}
|
|
549
549
|
)
|
|
550
550
|
] }),
|
|
551
|
-
|
|
551
|
+
W && /* @__PURE__ */ e("div", { className: "sc:border-danger sc:bg-danger/10 sc:text-danger sc:mx-6 sc:mb-3 sc:rounded-2xl sc:border-2 sc:px-4 sc:py-3 sc:text-sm", children: W }),
|
|
552
552
|
f && S.length === 0 && /* @__PURE__ */ e("div", { className: "sc:text-muted sc:px-6 sc:py-8 sc:text-center sc:text-sm", children: "Loading images..." }),
|
|
553
553
|
S.length > 0 && /* @__PURE__ */ c("div", { className: "sc:mx-6 sc:overflow-hidden sc:rounded-t-2xl", children: [
|
|
554
554
|
j === "masonry" ? (
|
|
@@ -563,7 +563,7 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
|
|
|
563
563
|
gridAutoRows: u === "bottom" ? "200px" : "120px",
|
|
564
564
|
gap: ms
|
|
565
565
|
},
|
|
566
|
-
children: S.map((s, a) => /* @__PURE__ */ e("div", { className: qe(s, a), children: /* @__PURE__ */ e(Pe, { image: s, onImageSelect:
|
|
566
|
+
children: S.map((s, a) => /* @__PURE__ */ e("div", { className: qe(s, a), children: /* @__PURE__ */ e(Pe, { image: s, onImageSelect: Ae, fixedHeight: !0 }) }, s.id))
|
|
567
567
|
}
|
|
568
568
|
)
|
|
569
569
|
) : (
|
|
@@ -577,7 +577,7 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
|
|
|
577
577
|
gridTemplateColumns: u === "bottom" ? "repeat(auto-fill, minmax(150px, 1fr))" : "repeat(auto-fill, minmax(120px, 1fr))",
|
|
578
578
|
gap: Ie
|
|
579
579
|
},
|
|
580
|
-
children: S.map((s) => /* @__PURE__ */ e("div", { style: { aspectRatio: "1 / 1" }, children: /* @__PURE__ */ e(Pe, { image: s, onImageSelect:
|
|
580
|
+
children: S.map((s) => /* @__PURE__ */ e("div", { style: { aspectRatio: "1 / 1" }, children: /* @__PURE__ */ e(Pe, { image: s, onImageSelect: Ae, fixedHeight: !0 }) }, s.id))
|
|
581
581
|
}
|
|
582
582
|
)
|
|
583
583
|
),
|
|
@@ -721,7 +721,7 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
|
|
|
721
721
|
"data-testid": "vector-search-input"
|
|
722
722
|
}
|
|
723
723
|
) }),
|
|
724
|
-
/* @__PURE__ */ e(_, { type: "submit", size: "icon", variant: "secondary", disabled:
|
|
724
|
+
/* @__PURE__ */ e(_, { type: "submit", size: "icon", variant: "secondary", disabled: A, "aria-label": "Search", children: /* @__PURE__ */ e(v, { icon: re.search, className: "sc:size-5" }) }),
|
|
725
725
|
/* @__PURE__ */ e(
|
|
726
726
|
_,
|
|
727
727
|
{
|
|
@@ -734,8 +734,8 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
|
|
|
734
734
|
)
|
|
735
735
|
] }),
|
|
736
736
|
T && /* @__PURE__ */ e("div", { className: "sc:border-danger sc:bg-danger/10 sc:text-danger sc:mx-6 sc:mb-3 sc:rounded-2xl sc:border-2 sc:px-4 sc:py-3 sc:text-sm", children: T }),
|
|
737
|
-
|
|
738
|
-
|
|
737
|
+
A && L.length === 0 && /* @__PURE__ */ e("div", { className: "sc:text-muted sc:px-6 sc:py-8 sc:text-center sc:text-sm", children: "Loading vectors..." }),
|
|
738
|
+
L.length > 0 && /* @__PURE__ */ c("div", { className: "sc:mx-6 sc:overflow-hidden sc:rounded-t-2xl", children: [
|
|
739
739
|
o === "masonry" ? (
|
|
740
740
|
/* CSS Grid Masonry */
|
|
741
741
|
/* @__PURE__ */ e(
|
|
@@ -748,7 +748,7 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
|
|
|
748
748
|
gridAutoRows: u === "bottom" ? "150px" : "120px",
|
|
749
749
|
gap: Ie
|
|
750
750
|
},
|
|
751
|
-
children:
|
|
751
|
+
children: L.map((s) => /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(Ue, { vector: s, onVectorSelect: Me, fixedHeight: !0 }) }, s.id))
|
|
752
752
|
}
|
|
753
753
|
)
|
|
754
754
|
) : (
|
|
@@ -762,15 +762,15 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
|
|
|
762
762
|
gridTemplateColumns: u === "bottom" ? "repeat(auto-fill, minmax(120px, 1fr))" : "repeat(auto-fill, minmax(100px, 1fr))",
|
|
763
763
|
gap: Ie
|
|
764
764
|
},
|
|
765
|
-
children:
|
|
765
|
+
children: L.map((s) => /* @__PURE__ */ e("div", { style: { aspectRatio: "1 / 1" }, children: /* @__PURE__ */ e(Ue, { vector: s, onVectorSelect: Me, fixedHeight: !0 }) }, s.id))
|
|
766
766
|
}
|
|
767
767
|
)
|
|
768
768
|
),
|
|
769
769
|
z && /* @__PURE__ */ e("div", { ref: Ce, className: "sc:h-px" }),
|
|
770
|
-
|
|
771
|
-
!z && !
|
|
770
|
+
A && /* @__PURE__ */ e("div", { className: "sc:text-muted sc:py-4 sc:text-center sc:text-sm", children: "Loading more..." }),
|
|
771
|
+
!z && !A && /* @__PURE__ */ e("div", { className: "sc:text-muted sc:py-6 sc:text-center sc:text-sm", children: "No more vectors" })
|
|
772
772
|
] }),
|
|
773
|
-
!
|
|
773
|
+
!A && L.length === 0 && g && /* @__PURE__ */ c("div", { className: "sc:text-muted sc:px-6 sc:py-12 sc:text-center sc:text-sm", children: [
|
|
774
774
|
'No vectors found for "',
|
|
775
775
|
g,
|
|
776
776
|
'"'
|
|
@@ -830,7 +830,7 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
|
|
|
830
830
|
i && /* @__PURE__ */ e(
|
|
831
831
|
_,
|
|
832
832
|
{
|
|
833
|
-
onClick:
|
|
833
|
+
onClick: Qe,
|
|
834
834
|
disabled: ue || !Z,
|
|
835
835
|
variant: "secondary",
|
|
836
836
|
size: "sm",
|
|
@@ -849,7 +849,7 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
|
|
|
849
849
|
/* @__PURE__ */ e(
|
|
850
850
|
_,
|
|
851
851
|
{
|
|
852
|
-
onClick:
|
|
852
|
+
onClick: We,
|
|
853
853
|
variant: "default",
|
|
854
854
|
className: "sc:w-full",
|
|
855
855
|
"data-testid": "ai-use-image-btn",
|
|
@@ -878,7 +878,7 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
|
|
|
878
878
|
f.current = l;
|
|
879
879
|
const Y = U(V);
|
|
880
880
|
Y.current = V;
|
|
881
|
-
const [
|
|
881
|
+
const [W, Q] = r(null), b = u ?? W, B = n ?? Q, O = ae(
|
|
882
882
|
(P) => {
|
|
883
883
|
var ce, ne;
|
|
884
884
|
const g = f.current, y = Y.current;
|
|
@@ -898,9 +898,9 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
|
|
|
898
898
|
alert("Please create or select an artboard first");
|
|
899
899
|
return;
|
|
900
900
|
}
|
|
901
|
-
const
|
|
902
|
-
id:
|
|
903
|
-
x:
|
|
901
|
+
const L = `element-${Date.now()}`, M = h.getActiveArtboard(), A = M ? M.x + M.width / 2 : window.innerWidth / 2, se = M ? M.y + M.height / 2 : window.innerHeight / 2, T = ((ne = m.current) == null ? void 0 : ne.getZoom()) || 1, $ = new os({
|
|
902
|
+
id: L,
|
|
903
|
+
x: A,
|
|
904
904
|
y: se,
|
|
905
905
|
imageUrl: P,
|
|
906
906
|
transformData: {
|
|
@@ -912,7 +912,7 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
|
|
|
912
912
|
i((o) => o.map((q) => q.id === G.id ? G : q));
|
|
913
913
|
}
|
|
914
914
|
});
|
|
915
|
-
h.addElementToArtboard(
|
|
915
|
+
h.addElementToArtboard(L, R), C($, R, y || void 0), S(L), N && N($);
|
|
916
916
|
},
|
|
917
917
|
[
|
|
918
918
|
b,
|
|
@@ -948,4 +948,4 @@ const ms = "1px", Ie = "1px", Pe = Be.memo(function({ image: t, onImageSelect: N
|
|
|
948
948
|
export {
|
|
949
949
|
ws as ImagePanel
|
|
950
950
|
};
|
|
951
|
-
//# sourceMappingURL=ImagePanel-
|
|
951
|
+
//# sourceMappingURL=ImagePanel-ntJBepby.js.map
|