@mypixia/simplex-designer 2.0.4 → 2.0.6
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/dist/index.cjs.js +8 -8
- package/dist/index.es.js +219 -217
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -2,7 +2,7 @@ import Qe, { useState as N, useRef as gt, useEffect as ot, useMemo as ie, forwar
|
|
|
2
2
|
import _e from "qrcode";
|
|
3
3
|
import Ye from "react-barcode";
|
|
4
4
|
import oe from "axios";
|
|
5
|
-
import './index_external.css';var
|
|
5
|
+
import './index_external.css';var Et = { exports: {} }, Tt = {};
|
|
6
6
|
/**
|
|
7
7
|
* @license React
|
|
8
8
|
* react-jsx-runtime.production.js
|
|
@@ -14,7 +14,7 @@ import './index_external.css';var Dt = { exports: {} }, Ct = {};
|
|
|
14
14
|
*/
|
|
15
15
|
var re;
|
|
16
16
|
function qe() {
|
|
17
|
-
if (re) return
|
|
17
|
+
if (re) return Tt;
|
|
18
18
|
re = 1;
|
|
19
19
|
var f = Symbol.for("react.transitional.element"), o = Symbol.for("react.fragment");
|
|
20
20
|
function a(l, s, h) {
|
|
@@ -32,9 +32,9 @@ function qe() {
|
|
|
32
32
|
props: h
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
return
|
|
35
|
+
return Tt.Fragment = o, Tt.jsx = a, Tt.jsxs = a, Tt;
|
|
36
36
|
}
|
|
37
|
-
var
|
|
37
|
+
var jt = {};
|
|
38
38
|
/**
|
|
39
39
|
* @license React
|
|
40
40
|
* react-jsx-runtime.development.js
|
|
@@ -50,7 +50,7 @@ function Ve() {
|
|
|
50
50
|
function f(u) {
|
|
51
51
|
if (u == null) return null;
|
|
52
52
|
if (typeof u == "function")
|
|
53
|
-
return u.$$typeof ===
|
|
53
|
+
return u.$$typeof === _ ? null : u.displayName || u.name || null;
|
|
54
54
|
if (typeof u == "string") return u;
|
|
55
55
|
switch (u) {
|
|
56
56
|
case b:
|
|
@@ -74,7 +74,7 @@ function Ve() {
|
|
|
74
74
|
return "Portal";
|
|
75
75
|
case O:
|
|
76
76
|
return (u.displayName || "Context") + ".Provider";
|
|
77
|
-
case
|
|
77
|
+
case T:
|
|
78
78
|
return (u._context.displayName || "Context") + ".Consumer";
|
|
79
79
|
case v:
|
|
80
80
|
var D = u.render;
|
|
@@ -149,11 +149,11 @@ function Ve() {
|
|
|
149
149
|
}
|
|
150
150
|
function d() {
|
|
151
151
|
var u = f(this.type);
|
|
152
|
-
return
|
|
152
|
+
return Y[u] || (Y[u] = !0, console.error(
|
|
153
153
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
154
154
|
)), u = this.props.ref, u !== void 0 ? u : null;
|
|
155
155
|
}
|
|
156
|
-
function j(u, D, L, H, G, et, X,
|
|
156
|
+
function j(u, D, L, H, G, et, X, q) {
|
|
157
157
|
return L = et.ref, u = {
|
|
158
158
|
$$typeof: E,
|
|
159
159
|
type: u,
|
|
@@ -182,10 +182,10 @@ function Ve() {
|
|
|
182
182
|
configurable: !1,
|
|
183
183
|
enumerable: !1,
|
|
184
184
|
writable: !0,
|
|
185
|
-
value:
|
|
185
|
+
value: q
|
|
186
186
|
}), Object.freeze && (Object.freeze(u.props), Object.freeze(u)), u;
|
|
187
187
|
}
|
|
188
|
-
function S(u, D, L, H, G, et, X,
|
|
188
|
+
function S(u, D, L, H, G, et, X, q) {
|
|
189
189
|
var U = D.children;
|
|
190
190
|
if (U !== void 0)
|
|
191
191
|
if (H)
|
|
@@ -218,8 +218,8 @@ React keys must be passed directly to JSX without using spread:
|
|
|
218
218
|
}
|
|
219
219
|
if (U = null, L !== void 0 && (a(L), U = "" + L), x(D) && (a(D.key), U = "" + D.key), "key" in D) {
|
|
220
220
|
L = {};
|
|
221
|
-
for (var
|
|
222
|
-
|
|
221
|
+
for (var kt in D)
|
|
222
|
+
kt !== "key" && (L[kt] = D[kt]);
|
|
223
223
|
} else L = D;
|
|
224
224
|
return U && n(
|
|
225
225
|
L,
|
|
@@ -232,13 +232,13 @@ React keys must be passed directly to JSX without using spread:
|
|
|
232
232
|
s(),
|
|
233
233
|
L,
|
|
234
234
|
X,
|
|
235
|
-
|
|
235
|
+
q
|
|
236
236
|
);
|
|
237
237
|
}
|
|
238
238
|
function I(u) {
|
|
239
239
|
typeof u == "object" && u !== null && u.$$typeof === E && u._store && (u._store.validated = 1);
|
|
240
240
|
}
|
|
241
|
-
var y = Qe, E = Symbol.for("react.transitional.element"), B = Symbol.for("react.portal"), b = Symbol.for("react.fragment"), F = Symbol.for("react.strict_mode"), J = Symbol.for("react.profiler"),
|
|
241
|
+
var y = Qe, E = Symbol.for("react.transitional.element"), B = Symbol.for("react.portal"), b = Symbol.for("react.fragment"), F = Symbol.for("react.strict_mode"), J = Symbol.for("react.profiler"), T = Symbol.for("react.consumer"), O = Symbol.for("react.context"), v = Symbol.for("react.forward_ref"), st = Symbol.for("react.suspense"), W = Symbol.for("react.suspense_list"), xt = Symbol.for("react.memo"), Q = Symbol.for("react.lazy"), ft = Symbol.for("react.activity"), _ = Symbol.for("react.client.reference"), at = y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, M = Object.prototype.hasOwnProperty, nt = Array.isArray, Z = console.createTask ? console.createTask : function() {
|
|
242
242
|
return null;
|
|
243
243
|
};
|
|
244
244
|
y = {
|
|
@@ -246,11 +246,11 @@ React keys must be passed directly to JSX without using spread:
|
|
|
246
246
|
return u();
|
|
247
247
|
}
|
|
248
248
|
};
|
|
249
|
-
var ct,
|
|
249
|
+
var ct, Y = {}, P = y["react-stack-bottom-frame"].bind(
|
|
250
250
|
y,
|
|
251
251
|
h
|
|
252
|
-
)(),
|
|
253
|
-
|
|
252
|
+
)(), C = Z(l(h)), tt = {};
|
|
253
|
+
jt.Fragment = b, jt.jsx = function(u, D, L, H, G) {
|
|
254
254
|
var et = 1e4 > at.recentlyCreatedOwnerStacks++;
|
|
255
255
|
return S(
|
|
256
256
|
u,
|
|
@@ -260,9 +260,9 @@ React keys must be passed directly to JSX without using spread:
|
|
|
260
260
|
H,
|
|
261
261
|
G,
|
|
262
262
|
et ? Error("react-stack-top-frame") : P,
|
|
263
|
-
et ? Z(l(u)) :
|
|
263
|
+
et ? Z(l(u)) : C
|
|
264
264
|
);
|
|
265
|
-
},
|
|
265
|
+
}, jt.jsxs = function(u, D, L, H, G) {
|
|
266
266
|
var et = 1e4 > at.recentlyCreatedOwnerStacks++;
|
|
267
267
|
return S(
|
|
268
268
|
u,
|
|
@@ -272,14 +272,14 @@ React keys must be passed directly to JSX without using spread:
|
|
|
272
272
|
H,
|
|
273
273
|
G,
|
|
274
274
|
et ? Error("react-stack-top-frame") : P,
|
|
275
|
-
et ? Z(l(u)) :
|
|
275
|
+
et ? Z(l(u)) : C
|
|
276
276
|
);
|
|
277
277
|
};
|
|
278
|
-
}()),
|
|
278
|
+
}()), jt;
|
|
279
279
|
}
|
|
280
280
|
var se;
|
|
281
281
|
function Xe() {
|
|
282
|
-
return se || (se = 1, process.env.NODE_ENV === "production" ?
|
|
282
|
+
return se || (se = 1, process.env.NODE_ENV === "production" ? Et.exports = qe() : Et.exports = Ve()), Et.exports;
|
|
283
283
|
}
|
|
284
284
|
var i = Xe();
|
|
285
285
|
const Ut = {
|
|
@@ -586,7 +586,7 @@ const Ut = {
|
|
|
586
586
|
] })
|
|
587
587
|
] }) }) : null;
|
|
588
588
|
}, ti = ({ isOpen: f, onClose: o, onAddBarcode: a, theme: l }) => {
|
|
589
|
-
const [s, h] = N(""), [x, n] = N("CODE128"), [d, j] = N(null), [S, I] = N(2), [y, E] = N(100), [B, b] = N(20), [F, J] = N("center"), [
|
|
589
|
+
const [s, h] = N(""), [x, n] = N("CODE128"), [d, j] = N(null), [S, I] = N(2), [y, E] = N(100), [B, b] = N(20), [F, J] = N("center"), [T, O] = N("bottom"), [v, st] = N(10), W = gt(null), xt = [
|
|
590
590
|
{ value: "CODE128", label: "CODE128 (Most Common)" },
|
|
591
591
|
{ value: "EAN13", label: "EAN-13 (European Article Number)" },
|
|
592
592
|
{ value: "EAN8", label: "EAN-8 (Short EAN)" },
|
|
@@ -608,7 +608,7 @@ const Ut = {
|
|
|
608
608
|
height: y,
|
|
609
609
|
fontSize: B,
|
|
610
610
|
textAlign: F,
|
|
611
|
-
textPosition:
|
|
611
|
+
textPosition: T,
|
|
612
612
|
margin: v,
|
|
613
613
|
background: "#ffffff",
|
|
614
614
|
lineColor: "#000000"
|
|
@@ -621,18 +621,18 @@ const Ut = {
|
|
|
621
621
|
var M, nt, Z, ct;
|
|
622
622
|
if (!(!d || !W.current))
|
|
623
623
|
try {
|
|
624
|
-
const
|
|
625
|
-
if (!
|
|
624
|
+
const Y = W.current.querySelector("svg");
|
|
625
|
+
if (!Y) {
|
|
626
626
|
console.error("No SVG element found in barcode");
|
|
627
627
|
return;
|
|
628
628
|
}
|
|
629
|
-
const P = document.createElement("canvas"),
|
|
629
|
+
const P = document.createElement("canvas"), C = P.getContext("2d"), tt = Y.getBoundingClientRect(), u = ((nt = (M = Y.width) == null ? void 0 : M.baseVal) == null ? void 0 : nt.value) || tt.width || 200, D = ((ct = (Z = Y.height) == null ? void 0 : Z.baseVal) == null ? void 0 : ct.value) || tt.height || 100;
|
|
630
630
|
P.width = u, P.height = D;
|
|
631
|
-
const L = new XMLSerializer().serializeToString(
|
|
631
|
+
const L = new XMLSerializer().serializeToString(Y), H = new Blob([L], { type: "image/svg+xml;charset=utf-8" }), G = URL.createObjectURL(H), et = new Image();
|
|
632
632
|
et.onload = () => {
|
|
633
|
-
|
|
634
|
-
const X = P.toDataURL("image/png"),
|
|
635
|
-
|
|
633
|
+
C.drawImage(et, 0, 0);
|
|
634
|
+
const X = P.toDataURL("image/png"), q = new Image();
|
|
635
|
+
q.onload = () => {
|
|
636
636
|
a({
|
|
637
637
|
type: "barcode",
|
|
638
638
|
src: X,
|
|
@@ -642,14 +642,14 @@ const Ut = {
|
|
|
642
642
|
height: D,
|
|
643
643
|
x: 100,
|
|
644
644
|
y: 100,
|
|
645
|
-
imageObject:
|
|
646
|
-
}),
|
|
647
|
-
},
|
|
645
|
+
imageObject: q
|
|
646
|
+
}), _();
|
|
647
|
+
}, q.src = X, URL.revokeObjectURL(G);
|
|
648
648
|
}, et.src = G;
|
|
649
|
-
} catch (
|
|
650
|
-
console.error("Error adding barcode to canvas:",
|
|
649
|
+
} catch (Y) {
|
|
650
|
+
console.error("Error adding barcode to canvas:", Y), alert("Failed to add barcode to canvas. Please try again.");
|
|
651
651
|
}
|
|
652
|
-
},
|
|
652
|
+
}, _ = () => {
|
|
653
653
|
h(""), j(null), n("CODE128"), I(2), E(100), b(20), o();
|
|
654
654
|
}, at = (M) => ({
|
|
655
655
|
CODE128: "Supports all ASCII characters. Most versatile format.",
|
|
@@ -662,14 +662,14 @@ const Ut = {
|
|
|
662
662
|
pharmacode: "Numbers 3-131070. Used in pharmaceutical industry.",
|
|
663
663
|
codabar: "Supports 0-9, A-D, and symbols. Used in libraries."
|
|
664
664
|
})[M] || "";
|
|
665
|
-
return f ? /* @__PURE__ */ i.jsx("div", { className: "barcode-modal-overlay", onClick:
|
|
665
|
+
return f ? /* @__PURE__ */ i.jsx("div", { className: "barcode-modal-overlay", onClick: _, children: /* @__PURE__ */ i.jsxs("div", { className: "barcode-modal-content", onClick: (M) => M.stopPropagation(), children: [
|
|
666
666
|
/* @__PURE__ */ i.jsxs("div", { className: "barcode-modal-header", children: [
|
|
667
667
|
/* @__PURE__ */ i.jsx("h3", { children: "Generate Barcode" }),
|
|
668
668
|
/* @__PURE__ */ i.jsx(
|
|
669
669
|
"button",
|
|
670
670
|
{
|
|
671
671
|
className: "barcode-modal-close",
|
|
672
|
-
onClick:
|
|
672
|
+
onClick: _,
|
|
673
673
|
"aria-label": "Close",
|
|
674
674
|
children: "×"
|
|
675
675
|
}
|
|
@@ -764,7 +764,7 @@ const Ut = {
|
|
|
764
764
|
"select",
|
|
765
765
|
{
|
|
766
766
|
id: "text-position",
|
|
767
|
-
value:
|
|
767
|
+
value: T,
|
|
768
768
|
onChange: (M) => O(M.target.value),
|
|
769
769
|
children: [
|
|
770
770
|
/* @__PURE__ */ i.jsx("option", { value: "bottom", children: "Bottom" }),
|
|
@@ -867,14 +867,14 @@ const Ut = {
|
|
|
867
867
|
] }), ii = ({ isOpen: f, onClose: o, onAddSticker: a, theme: l, apiKey: s, apiEndpoint: h }) => {
|
|
868
868
|
const [x, n] = N([]), [d, j] = N(!1), [S, I] = N(null), [y, E] = N(""), [B, b] = N(""), [F, J] = N({});
|
|
869
869
|
gt(null);
|
|
870
|
-
const [
|
|
870
|
+
const [T, O] = N(!1), [v, st] = N(!1), [W, xt] = N(!1), Q = `${h}/api/v1/designer`;
|
|
871
871
|
ot(() => {
|
|
872
872
|
f && s && ft();
|
|
873
873
|
}, [f, s]);
|
|
874
874
|
const ft = async () => {
|
|
875
875
|
const P = sessionStorage.getItem("apc_x_sub_status");
|
|
876
|
-
P === "active" ? (O(!0), st(!0), at()) : P === "inactive" ? (O(!1), st(!0)) : (xt(!0), await
|
|
877
|
-
},
|
|
876
|
+
P === "active" ? (O(!0), st(!0), at()) : P === "inactive" ? (O(!1), st(!0)) : (xt(!0), await _());
|
|
877
|
+
}, _ = async () => {
|
|
878
878
|
if (!s) {
|
|
879
879
|
O(!1), st(!0), xt(!1);
|
|
880
880
|
return;
|
|
@@ -882,8 +882,8 @@ const Ut = {
|
|
|
882
882
|
const P = `${Q}/get-subscription-status/${s}`;
|
|
883
883
|
try {
|
|
884
884
|
(await oe.get(P)).data.object === "active" ? (sessionStorage.setItem("apc_x_sub_status", "active"), O(!0), at()) : (sessionStorage.setItem("apc_x_sub_status", "inactive"), O(!1));
|
|
885
|
-
} catch (
|
|
886
|
-
console.error("Subscription check failed:",
|
|
885
|
+
} catch (C) {
|
|
886
|
+
console.error("Subscription check failed:", C), sessionStorage.setItem("apc_x_sub_status", "inactive"), O(!1);
|
|
887
887
|
} finally {
|
|
888
888
|
xt(!1), st(!0);
|
|
889
889
|
}
|
|
@@ -891,51 +891,51 @@ const Ut = {
|
|
|
891
891
|
const P = sessionStorage.getItem("apc_stickers");
|
|
892
892
|
if (P)
|
|
893
893
|
try {
|
|
894
|
-
const
|
|
895
|
-
n(
|
|
894
|
+
const C = JSON.parse(P);
|
|
895
|
+
n(C);
|
|
896
896
|
return;
|
|
897
897
|
} catch {
|
|
898
898
|
console.warn("Failed to parse cached stickers, fetching fresh data");
|
|
899
899
|
}
|
|
900
900
|
j(!0), I(null);
|
|
901
901
|
try {
|
|
902
|
-
const
|
|
903
|
-
if (
|
|
904
|
-
const tt =
|
|
902
|
+
const C = await oe.get(`${Q}/get-stickers`);
|
|
903
|
+
if (C.data && C.data.object && C.data.object.contents) {
|
|
904
|
+
const tt = C.data.object.contents;
|
|
905
905
|
n(tt), sessionStorage.setItem("apc_stickers", JSON.stringify(tt));
|
|
906
906
|
} else
|
|
907
907
|
throw new Error("Invalid response format");
|
|
908
|
-
} catch (
|
|
909
|
-
console.error("Error fetching stickers:",
|
|
908
|
+
} catch (C) {
|
|
909
|
+
console.error("Error fetching stickers:", C), I("Failed to load stickers. Please try again.");
|
|
910
910
|
} finally {
|
|
911
911
|
j(!1);
|
|
912
912
|
}
|
|
913
|
-
}, M = (P,
|
|
913
|
+
}, M = (P, C) => {
|
|
914
914
|
a({
|
|
915
915
|
type: "sticker",
|
|
916
916
|
src: P,
|
|
917
|
-
name:
|
|
917
|
+
name: C,
|
|
918
918
|
width: 100,
|
|
919
919
|
height: 100,
|
|
920
920
|
x: 100,
|
|
921
921
|
y: 100
|
|
922
922
|
}), o();
|
|
923
923
|
}, nt = (P) => {
|
|
924
|
-
J((
|
|
925
|
-
...
|
|
926
|
-
[P]: !
|
|
924
|
+
J((C) => ({
|
|
925
|
+
...C,
|
|
926
|
+
[P]: !C[P]
|
|
927
927
|
}));
|
|
928
928
|
}, Z = (P) => {
|
|
929
|
-
const
|
|
929
|
+
const C = {};
|
|
930
930
|
return P.forEach((tt) => {
|
|
931
931
|
const u = tt.name.split("/");
|
|
932
|
-
let D =
|
|
932
|
+
let D = C;
|
|
933
933
|
u.forEach((L, H) => {
|
|
934
934
|
D[L] || (D[L] = H === u.length - 1 ? tt : {}), D = D[L];
|
|
935
935
|
});
|
|
936
|
-
}),
|
|
937
|
-
}, ct = (P,
|
|
938
|
-
const D = `${
|
|
936
|
+
}), C;
|
|
937
|
+
}, ct = (P, C = "", tt = 0) => /* @__PURE__ */ i.jsx("div", { className: "sticker-tree-level", style: { paddingLeft: `${tt * 15}px` }, children: Object.keys(P).map((u) => {
|
|
938
|
+
const D = `${C}/${u}`, L = F[D];
|
|
939
939
|
return P[u].type === "image" ? !B || u.toLowerCase().includes(B.toLowerCase()) ? /* @__PURE__ */ i.jsx(
|
|
940
940
|
"div",
|
|
941
941
|
{
|
|
@@ -968,7 +968,7 @@ const Ut = {
|
|
|
968
968
|
),
|
|
969
969
|
L && ct(P[u], D, tt + 1)
|
|
970
970
|
] }, D);
|
|
971
|
-
}) }),
|
|
971
|
+
}) }), Y = x.filter(
|
|
972
972
|
(P) => !B || P.name.toLowerCase().includes(B.toLowerCase())
|
|
973
973
|
);
|
|
974
974
|
return f ? /* @__PURE__ */ i.jsx("div", { className: "sticker-modal-overlay", onClick: o, children: /* @__PURE__ */ i.jsxs("div", { className: "sticker-modal-content", onClick: (P) => P.stopPropagation(), children: [
|
|
@@ -986,8 +986,8 @@ const Ut = {
|
|
|
986
986
|
] }),
|
|
987
987
|
/* @__PURE__ */ i.jsxs("div", { className: "sticker-modal-body", children: [
|
|
988
988
|
W && /* @__PURE__ */ i.jsx(le, {}),
|
|
989
|
-
!
|
|
990
|
-
|
|
989
|
+
!T && !W && v && /* @__PURE__ */ i.jsx(ei, { theme: l }),
|
|
990
|
+
T && v && /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
|
|
991
991
|
/* @__PURE__ */ i.jsx("div", { className: "sticker-modal-controls", children: /* @__PURE__ */ i.jsx("div", { className: "search-container", children: /* @__PURE__ */ i.jsx(
|
|
992
992
|
"input",
|
|
993
993
|
{
|
|
@@ -1003,7 +1003,7 @@ const Ut = {
|
|
|
1003
1003
|
/* @__PURE__ */ i.jsx("p", { children: S }),
|
|
1004
1004
|
/* @__PURE__ */ i.jsx("button", { onClick: at, children: "Retry" })
|
|
1005
1005
|
] }),
|
|
1006
|
-
!d && !S && x.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "sticker-grid", children: ct(Z(
|
|
1006
|
+
!d && !S && x.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "sticker-grid", children: ct(Z(Y)) })
|
|
1007
1007
|
] })
|
|
1008
1008
|
] })
|
|
1009
1009
|
] }) }) : null;
|
|
@@ -2564,7 +2564,7 @@ const Ut = {
|
|
|
2564
2564
|
ot(() => {
|
|
2565
2565
|
f && n(oi);
|
|
2566
2566
|
}, [f]);
|
|
2567
|
-
const
|
|
2567
|
+
const T = (v) => {
|
|
2568
2568
|
a({
|
|
2569
2569
|
type: "embroidery",
|
|
2570
2570
|
src: v.url,
|
|
@@ -2633,7 +2633,7 @@ const Ut = {
|
|
|
2633
2633
|
"div",
|
|
2634
2634
|
{
|
|
2635
2635
|
className: "embroidery-item",
|
|
2636
|
-
onClick: () =>
|
|
2636
|
+
onClick: () => T(v),
|
|
2637
2637
|
title: v.description,
|
|
2638
2638
|
children: [
|
|
2639
2639
|
/* @__PURE__ */ i.jsx("div", { className: "embroidery-preview", children: /* @__PURE__ */ i.jsx(
|
|
@@ -2664,7 +2664,7 @@ const Ut = {
|
|
|
2664
2664
|
]
|
|
2665
2665
|
}
|
|
2666
2666
|
) }) : null;
|
|
2667
|
-
},
|
|
2667
|
+
}, Nt = [
|
|
2668
2668
|
// MOTIVATIONAL & INSPIRATIONAL (25 items)
|
|
2669
2669
|
{
|
|
2670
2670
|
id: 1,
|
|
@@ -4603,15 +4603,15 @@ const Ut = {
|
|
|
4603
4603
|
}
|
|
4604
4604
|
], ai = ({ isOpen: f, onClose: o, onAddText: a, theme: l }) => {
|
|
4605
4605
|
const [s, h] = N(""), [x, n] = N("All"), d = ie(() => {
|
|
4606
|
-
const y =
|
|
4606
|
+
const y = Nt.reduce((E, B) => (E[B.category] = (E[B.category] || 0) + 1, E), {});
|
|
4607
4607
|
return [
|
|
4608
|
-
{ name: "All", count:
|
|
4608
|
+
{ name: "All", count: Nt.length },
|
|
4609
4609
|
...Object.entries(y).map(([E, B]) => ({ name: E, count: B }))
|
|
4610
4610
|
];
|
|
4611
|
-
}, [
|
|
4611
|
+
}, [Nt]), j = ie(() => Nt.filter((y) => {
|
|
4612
4612
|
const E = !s || y.text.toLowerCase().includes(s.toLowerCase()) || y.category.toLowerCase().includes(s.toLowerCase()), B = x === "All" || y.category === x;
|
|
4613
4613
|
return E && B;
|
|
4614
|
-
}), [
|
|
4614
|
+
}), [Nt, s, x]), S = (y) => {
|
|
4615
4615
|
const E = {
|
|
4616
4616
|
...y,
|
|
4617
4617
|
x: 100,
|
|
@@ -4726,12 +4726,12 @@ const Ut = {
|
|
|
4726
4726
|
theme: b,
|
|
4727
4727
|
readOnly: F,
|
|
4728
4728
|
apiKey: J,
|
|
4729
|
-
apiEndpoint:
|
|
4729
|
+
apiEndpoint: T
|
|
4730
4730
|
}) => {
|
|
4731
|
-
const [O, v] = N(!1), [st, W] = N(!1), [xt, Q] = N(!1), [ft,
|
|
4731
|
+
const [O, v] = N(!1), [st, W] = N(!1), [xt, Q] = N(!1), [ft, _] = N(!1), [at, M] = N(!1), [nt, Z] = N(!1), [ct, Y] = N(!1), P = (U) => {
|
|
4732
4732
|
const K = U.target.files[0];
|
|
4733
4733
|
K && K.type.startsWith("image/") && d(K), U.target.value = "";
|
|
4734
|
-
},
|
|
4734
|
+
}, C = (U) => {
|
|
4735
4735
|
f("icon", {
|
|
4736
4736
|
iconData: U,
|
|
4737
4737
|
text: U.symbol,
|
|
@@ -4750,13 +4750,13 @@ const Ut = {
|
|
|
4750
4750
|
}, H = (U, K) => {
|
|
4751
4751
|
f(U, K);
|
|
4752
4752
|
}, G = () => {
|
|
4753
|
-
Z(!nt),
|
|
4753
|
+
Z(!nt), Y(!1);
|
|
4754
4754
|
}, et = () => {
|
|
4755
|
-
|
|
4755
|
+
Y(!ct), Z(!1);
|
|
4756
4756
|
}, X = (U) => {
|
|
4757
4757
|
U === "custom" ? f("text") : U === "templates" && M(!0), Z(!1);
|
|
4758
|
-
},
|
|
4759
|
-
f(U),
|
|
4758
|
+
}, q = (U) => {
|
|
4759
|
+
f(U), Y(!1);
|
|
4760
4760
|
};
|
|
4761
4761
|
return /* @__PURE__ */ i.jsxs("div", { className: "toolbar", children: [
|
|
4762
4762
|
/* @__PURE__ */ i.jsxs("div", { className: "toolbar-section", children: [
|
|
@@ -4831,51 +4831,51 @@ const Ut = {
|
|
|
4831
4831
|
}
|
|
4832
4832
|
),
|
|
4833
4833
|
/* @__PURE__ */ i.jsxs("div", { className: `dropdown-menu ${ct ? "show" : ""}`, children: [
|
|
4834
|
-
/* @__PURE__ */ i.jsxs("button", { onClick: () =>
|
|
4834
|
+
/* @__PURE__ */ i.jsxs("button", { onClick: () => q("rectangle"), children: [
|
|
4835
4835
|
/* @__PURE__ */ i.jsx("span", { className: "icon", children: "▭" }),
|
|
4836
4836
|
" Rectangle"
|
|
4837
4837
|
] }),
|
|
4838
|
-
/* @__PURE__ */ i.jsxs("button", { onClick: () =>
|
|
4838
|
+
/* @__PURE__ */ i.jsxs("button", { onClick: () => q("circle"), children: [
|
|
4839
4839
|
/* @__PURE__ */ i.jsx("span", { className: "icon", children: "●" }),
|
|
4840
4840
|
" Circle"
|
|
4841
4841
|
] }),
|
|
4842
|
-
/* @__PURE__ */ i.jsxs("button", { onClick: () =>
|
|
4842
|
+
/* @__PURE__ */ i.jsxs("button", { onClick: () => q("triangle"), children: [
|
|
4843
4843
|
/* @__PURE__ */ i.jsx("span", { className: "icon", children: "▲" }),
|
|
4844
4844
|
" Triangle"
|
|
4845
4845
|
] }),
|
|
4846
|
-
/* @__PURE__ */ i.jsxs("button", { onClick: () =>
|
|
4846
|
+
/* @__PURE__ */ i.jsxs("button", { onClick: () => q("star"), children: [
|
|
4847
4847
|
/* @__PURE__ */ i.jsx("span", { className: "icon", children: "★" }),
|
|
4848
4848
|
" Star"
|
|
4849
4849
|
] }),
|
|
4850
|
-
/* @__PURE__ */ i.jsxs("button", { onClick: () =>
|
|
4850
|
+
/* @__PURE__ */ i.jsxs("button", { onClick: () => q("heart"), children: [
|
|
4851
4851
|
/* @__PURE__ */ i.jsx("span", { className: "icon", children: "♥" }),
|
|
4852
4852
|
" Heart"
|
|
4853
4853
|
] }),
|
|
4854
|
-
/* @__PURE__ */ i.jsxs("button", { onClick: () =>
|
|
4854
|
+
/* @__PURE__ */ i.jsxs("button", { onClick: () => q("arrow"), children: [
|
|
4855
4855
|
/* @__PURE__ */ i.jsx("span", { className: "icon", children: "➤" }),
|
|
4856
4856
|
" Arrow"
|
|
4857
4857
|
] }),
|
|
4858
|
-
/* @__PURE__ */ i.jsxs("button", { onClick: () =>
|
|
4858
|
+
/* @__PURE__ */ i.jsxs("button", { onClick: () => q("diamond"), children: [
|
|
4859
4859
|
/* @__PURE__ */ i.jsx("span", { className: "icon", children: "◆" }),
|
|
4860
4860
|
" Diamond"
|
|
4861
4861
|
] }),
|
|
4862
|
-
/* @__PURE__ */ i.jsxs("button", { onClick: () =>
|
|
4862
|
+
/* @__PURE__ */ i.jsxs("button", { onClick: () => q("hexagon"), children: [
|
|
4863
4863
|
/* @__PURE__ */ i.jsx("span", { className: "icon", children: "⬡" }),
|
|
4864
4864
|
" Hexagon"
|
|
4865
4865
|
] }),
|
|
4866
|
-
/* @__PURE__ */ i.jsxs("button", { onClick: () =>
|
|
4866
|
+
/* @__PURE__ */ i.jsxs("button", { onClick: () => q("pentagon"), children: [
|
|
4867
4867
|
/* @__PURE__ */ i.jsx("span", { className: "icon", children: "⬟" }),
|
|
4868
4868
|
" Pentagon"
|
|
4869
4869
|
] }),
|
|
4870
|
-
/* @__PURE__ */ i.jsxs("button", { onClick: () =>
|
|
4870
|
+
/* @__PURE__ */ i.jsxs("button", { onClick: () => q("oval"), children: [
|
|
4871
4871
|
/* @__PURE__ */ i.jsx("span", { className: "icon", children: "⬯" }),
|
|
4872
4872
|
" Oval"
|
|
4873
4873
|
] }),
|
|
4874
|
-
/* @__PURE__ */ i.jsxs("button", { onClick: () =>
|
|
4874
|
+
/* @__PURE__ */ i.jsxs("button", { onClick: () => q("roundedRectangle"), children: [
|
|
4875
4875
|
/* @__PURE__ */ i.jsx("span", { className: "icon", children: "▢" }),
|
|
4876
4876
|
" Rounded Rectangle"
|
|
4877
4877
|
] }),
|
|
4878
|
-
/* @__PURE__ */ i.jsxs("button", { onClick: () =>
|
|
4878
|
+
/* @__PURE__ */ i.jsxs("button", { onClick: () => q("horizontalLine"), children: [
|
|
4879
4879
|
/* @__PURE__ */ i.jsx("span", { className: "icon", children: "―" }),
|
|
4880
4880
|
" Horizontal Line"
|
|
4881
4881
|
] })
|
|
@@ -4896,7 +4896,7 @@ const Ut = {
|
|
|
4896
4896
|
)
|
|
4897
4897
|
] }),
|
|
4898
4898
|
/* @__PURE__ */ i.jsx("div", { className: "toolbar-separator" }),
|
|
4899
|
-
/* @__PURE__ */ i.jsx(Ke, { onSelectIcon:
|
|
4899
|
+
/* @__PURE__ */ i.jsx(Ke, { onSelectIcon: C, theme: b, disabled: F }),
|
|
4900
4900
|
/* @__PURE__ */ i.jsxs(
|
|
4901
4901
|
"button",
|
|
4902
4902
|
{
|
|
@@ -4943,7 +4943,7 @@ const Ut = {
|
|
|
4943
4943
|
"button",
|
|
4944
4944
|
{
|
|
4945
4945
|
className: "toolbar-btn compact",
|
|
4946
|
-
onClick: () =>
|
|
4946
|
+
onClick: () => _(!0),
|
|
4947
4947
|
disabled: F,
|
|
4948
4948
|
title: "Add Embroidery Design",
|
|
4949
4949
|
children: [
|
|
@@ -5049,18 +5049,18 @@ const Ut = {
|
|
|
5049
5049
|
onAddSticker: D,
|
|
5050
5050
|
theme: b,
|
|
5051
5051
|
apiKey: J,
|
|
5052
|
-
apiEndpoint:
|
|
5052
|
+
apiEndpoint: T
|
|
5053
5053
|
}
|
|
5054
5054
|
),
|
|
5055
5055
|
/* @__PURE__ */ i.jsx(
|
|
5056
5056
|
ri,
|
|
5057
5057
|
{
|
|
5058
5058
|
isOpen: ft,
|
|
5059
|
-
onClose: () =>
|
|
5059
|
+
onClose: () => _(!1),
|
|
5060
5060
|
onAddEmbroidery: L,
|
|
5061
5061
|
theme: b,
|
|
5062
5062
|
apiKey: J,
|
|
5063
|
-
apiEndpoint:
|
|
5063
|
+
apiEndpoint: T
|
|
5064
5064
|
}
|
|
5065
5065
|
),
|
|
5066
5066
|
/* @__PURE__ */ i.jsx(
|
|
@@ -5098,7 +5098,7 @@ const Ut = {
|
|
|
5098
5098
|
"textarea",
|
|
5099
5099
|
{
|
|
5100
5100
|
value: f.text || "",
|
|
5101
|
-
onChange: (
|
|
5101
|
+
onChange: (T) => n("text", T.target.value),
|
|
5102
5102
|
rows: 3,
|
|
5103
5103
|
placeholder: "Enter your text here..."
|
|
5104
5104
|
}
|
|
@@ -5110,8 +5110,8 @@ const Ut = {
|
|
|
5110
5110
|
"select",
|
|
5111
5111
|
{
|
|
5112
5112
|
value: f.fontFamily || "Arial",
|
|
5113
|
-
onChange: (
|
|
5114
|
-
children: l.map((
|
|
5113
|
+
onChange: (T) => n("fontFamily", T.target.value),
|
|
5114
|
+
children: l.map((T) => /* @__PURE__ */ i.jsx("option", { value: T, children: T }, T))
|
|
5115
5115
|
}
|
|
5116
5116
|
)
|
|
5117
5117
|
] }),
|
|
@@ -5123,7 +5123,7 @@ const Ut = {
|
|
|
5123
5123
|
{
|
|
5124
5124
|
type: "number",
|
|
5125
5125
|
value: f.fontSize || 20,
|
|
5126
|
-
onChange: (
|
|
5126
|
+
onChange: (T) => n("fontSize", parseInt(T.target.value)),
|
|
5127
5127
|
min: "8",
|
|
5128
5128
|
max: "200"
|
|
5129
5129
|
}
|
|
@@ -5137,7 +5137,7 @@ const Ut = {
|
|
|
5137
5137
|
type: "number",
|
|
5138
5138
|
step: "0.1",
|
|
5139
5139
|
value: f.lineHeight || 1.2,
|
|
5140
|
-
onChange: (
|
|
5140
|
+
onChange: (T) => n("lineHeight", parseFloat(T.target.value)),
|
|
5141
5141
|
min: "0.5",
|
|
5142
5142
|
max: "3"
|
|
5143
5143
|
}
|
|
@@ -5193,8 +5193,8 @@ const Ut = {
|
|
|
5193
5193
|
{
|
|
5194
5194
|
className: (b = f.textDecoration) != null && b.includes("underline") ? "active" : "",
|
|
5195
5195
|
onClick: () => {
|
|
5196
|
-
const
|
|
5197
|
-
|
|
5196
|
+
const T = f.textDecoration || "", O = T.split(" ").filter((v) => v && v !== "underline");
|
|
5197
|
+
T.includes("underline") || O.push("underline"), n("textDecoration", O.join(" ").trim());
|
|
5198
5198
|
},
|
|
5199
5199
|
title: "Underline",
|
|
5200
5200
|
children: /* @__PURE__ */ i.jsx("u", { children: "U" })
|
|
@@ -5205,8 +5205,8 @@ const Ut = {
|
|
|
5205
5205
|
{
|
|
5206
5206
|
className: (F = f.textDecoration) != null && F.includes("overline") ? "active" : "",
|
|
5207
5207
|
onClick: () => {
|
|
5208
|
-
const
|
|
5209
|
-
|
|
5208
|
+
const T = f.textDecoration || "", O = T.split(" ").filter((v) => v && v !== "overline");
|
|
5209
|
+
T.includes("overline") || O.push("overline"), n("textDecoration", O.join(" ").trim());
|
|
5210
5210
|
},
|
|
5211
5211
|
title: "Overline",
|
|
5212
5212
|
children: /* @__PURE__ */ i.jsx("span", { style: { textDecoration: "overline" }, children: "O" })
|
|
@@ -5217,8 +5217,8 @@ const Ut = {
|
|
|
5217
5217
|
{
|
|
5218
5218
|
className: (J = f.textDecoration) != null && J.includes("line-through") ? "active" : "",
|
|
5219
5219
|
onClick: () => {
|
|
5220
|
-
const
|
|
5221
|
-
|
|
5220
|
+
const T = f.textDecoration || "", O = T.split(" ").filter((v) => v && v !== "line-through");
|
|
5221
|
+
T.includes("line-through") || O.push("line-through"), n("textDecoration", O.join(" ").trim());
|
|
5222
5222
|
},
|
|
5223
5223
|
title: "Strikethrough",
|
|
5224
5224
|
children: /* @__PURE__ */ i.jsx("s", { children: "S" })
|
|
@@ -5316,7 +5316,7 @@ const Ut = {
|
|
|
5316
5316
|
{
|
|
5317
5317
|
type: "color",
|
|
5318
5318
|
value: f.fill || "#000000",
|
|
5319
|
-
onChange: (
|
|
5319
|
+
onChange: (T) => n("fill", T.target.value)
|
|
5320
5320
|
}
|
|
5321
5321
|
)
|
|
5322
5322
|
] }),
|
|
@@ -5328,7 +5328,7 @@ const Ut = {
|
|
|
5328
5328
|
{
|
|
5329
5329
|
type: "color",
|
|
5330
5330
|
value: f.backgroundColor || "#ffffff",
|
|
5331
|
-
onChange: (
|
|
5331
|
+
onChange: (T) => n("backgroundColor", T.target.value),
|
|
5332
5332
|
disabled: !f.hasBackground
|
|
5333
5333
|
}
|
|
5334
5334
|
),
|
|
@@ -5354,7 +5354,7 @@ const Ut = {
|
|
|
5354
5354
|
type: "number",
|
|
5355
5355
|
step: "0.1",
|
|
5356
5356
|
value: f.letterSpacing || 0,
|
|
5357
|
-
onChange: (
|
|
5357
|
+
onChange: (T) => n("letterSpacing", parseFloat(T.target.value)),
|
|
5358
5358
|
min: "-5",
|
|
5359
5359
|
max: "10"
|
|
5360
5360
|
}
|
|
@@ -5368,7 +5368,7 @@ const Ut = {
|
|
|
5368
5368
|
type: "number",
|
|
5369
5369
|
step: "0.1",
|
|
5370
5370
|
value: f.wordSpacing || 0,
|
|
5371
|
-
onChange: (
|
|
5371
|
+
onChange: (T) => n("wordSpacing", parseFloat(T.target.value)),
|
|
5372
5372
|
min: "-10",
|
|
5373
5373
|
max: "20"
|
|
5374
5374
|
}
|
|
@@ -5394,7 +5394,7 @@ const Ut = {
|
|
|
5394
5394
|
{
|
|
5395
5395
|
type: "number",
|
|
5396
5396
|
value: f.textShadowX || 2,
|
|
5397
|
-
onChange: (
|
|
5397
|
+
onChange: (T) => n("textShadowX", parseInt(T.target.value)),
|
|
5398
5398
|
min: "-20",
|
|
5399
5399
|
max: "20"
|
|
5400
5400
|
}
|
|
@@ -5407,7 +5407,7 @@ const Ut = {
|
|
|
5407
5407
|
{
|
|
5408
5408
|
type: "number",
|
|
5409
5409
|
value: f.textShadowY || 2,
|
|
5410
|
-
onChange: (
|
|
5410
|
+
onChange: (T) => n("textShadowY", parseInt(T.target.value)),
|
|
5411
5411
|
min: "-20",
|
|
5412
5412
|
max: "20"
|
|
5413
5413
|
}
|
|
@@ -5420,7 +5420,7 @@ const Ut = {
|
|
|
5420
5420
|
{
|
|
5421
5421
|
type: "number",
|
|
5422
5422
|
value: f.textShadowBlur || 4,
|
|
5423
|
-
onChange: (
|
|
5423
|
+
onChange: (T) => n("textShadowBlur", parseInt(T.target.value)),
|
|
5424
5424
|
min: "0",
|
|
5425
5425
|
max: "20"
|
|
5426
5426
|
}
|
|
@@ -5433,7 +5433,7 @@ const Ut = {
|
|
|
5433
5433
|
{
|
|
5434
5434
|
type: "color",
|
|
5435
5435
|
value: f.textShadowColor || "#000000",
|
|
5436
|
-
onChange: (
|
|
5436
|
+
onChange: (T) => n("textShadowColor", T.target.value)
|
|
5437
5437
|
}
|
|
5438
5438
|
)
|
|
5439
5439
|
] })
|
|
@@ -5448,7 +5448,7 @@ const Ut = {
|
|
|
5448
5448
|
{
|
|
5449
5449
|
type: "color",
|
|
5450
5450
|
value: f.stroke || "#000000",
|
|
5451
|
-
onChange: (
|
|
5451
|
+
onChange: (T) => n("stroke", T.target.value)
|
|
5452
5452
|
}
|
|
5453
5453
|
)
|
|
5454
5454
|
] }),
|
|
@@ -5459,7 +5459,7 @@ const Ut = {
|
|
|
5459
5459
|
{
|
|
5460
5460
|
type: "number",
|
|
5461
5461
|
value: f.strokeWidth || 0,
|
|
5462
|
-
onChange: (
|
|
5462
|
+
onChange: (T) => n("strokeWidth", parseInt(T.target.value)),
|
|
5463
5463
|
min: "0",
|
|
5464
5464
|
max: "20"
|
|
5465
5465
|
}
|
|
@@ -5476,7 +5476,7 @@ const Ut = {
|
|
|
5476
5476
|
max: "1",
|
|
5477
5477
|
step: "0.1",
|
|
5478
5478
|
value: f.opacity || 1,
|
|
5479
|
-
onChange: (
|
|
5479
|
+
onChange: (T) => n("opacity", parseFloat(T.target.value))
|
|
5480
5480
|
}
|
|
5481
5481
|
),
|
|
5482
5482
|
/* @__PURE__ */ i.jsxs("span", { children: [
|
|
@@ -5490,7 +5490,7 @@ const Ut = {
|
|
|
5490
5490
|
"select",
|
|
5491
5491
|
{
|
|
5492
5492
|
value: f.fontVariant || "normal",
|
|
5493
|
-
onChange: (
|
|
5493
|
+
onChange: (T) => n("fontVariant", T.target.value),
|
|
5494
5494
|
children: [
|
|
5495
5495
|
/* @__PURE__ */ i.jsx("option", { value: "normal", children: "Normal" }),
|
|
5496
5496
|
/* @__PURE__ */ i.jsx("option", { value: "small-caps", children: "Small Caps" })
|
|
@@ -5504,7 +5504,7 @@ const Ut = {
|
|
|
5504
5504
|
"select",
|
|
5505
5505
|
{
|
|
5506
5506
|
value: f.writingMode || "horizontal-tb",
|
|
5507
|
-
onChange: (
|
|
5507
|
+
onChange: (T) => n("writingMode", T.target.value),
|
|
5508
5508
|
children: [
|
|
5509
5509
|
/* @__PURE__ */ i.jsx("option", { value: "horizontal-tb", children: "Horizontal" }),
|
|
5510
5510
|
/* @__PURE__ */ i.jsx("option", { value: "vertical-rl", children: "Vertical Right-to-Left" }),
|
|
@@ -5543,7 +5543,7 @@ const Ut = {
|
|
|
5543
5543
|
{
|
|
5544
5544
|
type: "number",
|
|
5545
5545
|
value: f.backgroundPadding || 5,
|
|
5546
|
-
onChange: (
|
|
5546
|
+
onChange: (T) => n("backgroundPadding", parseInt(T.target.value)),
|
|
5547
5547
|
min: "0",
|
|
5548
5548
|
max: "50",
|
|
5549
5549
|
disabled: !f.hasBackground
|
|
@@ -6380,7 +6380,7 @@ class ci {
|
|
|
6380
6380
|
}
|
|
6381
6381
|
}
|
|
6382
6382
|
async exportCurrentSectionAsJSON(o, a = "png") {
|
|
6383
|
-
var I, y, E, B, b, F, J,
|
|
6383
|
+
var I, y, E, B, b, F, J, T, O;
|
|
6384
6384
|
const l = ((I = o.activeSection) == null ? void 0 : I.sectionName) || "main", s = {
|
|
6385
6385
|
elements: o.elements,
|
|
6386
6386
|
selectedColor: o.selectedColor,
|
|
@@ -6447,7 +6447,7 @@ class ci {
|
|
|
6447
6447
|
productInfo: {
|
|
6448
6448
|
sections: [{
|
|
6449
6449
|
sectionName: l,
|
|
6450
|
-
sectionImage: ((
|
|
6450
|
+
sectionImage: ((T = o.activeSection) == null ? void 0 : T.sectionImage) || ((O = o.activeSection) == null ? void 0 : O.image),
|
|
6451
6451
|
id: l
|
|
6452
6452
|
}]
|
|
6453
6453
|
}
|
|
@@ -6680,28 +6680,28 @@ const fi = $e((f, o) => {
|
|
|
6680
6680
|
]
|
|
6681
6681
|
},
|
|
6682
6682
|
initFile: h
|
|
6683
|
-
} = f, [x, n] = N([]), [d, j] = N(null), [S, I] = N(!1), [y, E] = N(!1), [B, b] = N(!1), [F, J] = N({ x: 0, y: 0 }), [
|
|
6683
|
+
} = f, [x, n] = N([]), [d, j] = N(null), [S, I] = N(!1), [y, E] = N(!1), [B, b] = N(!1), [F, J] = N({ x: 0, y: 0 }), [T, O] = N(null), [v, st] = N(800), [W, xt] = N(600), [Q, ft] = N(1), [_, at] = N(s.colorSettings[0]), [M, nt] = N(!1), [Z, ct] = N(!0), [Y, P] = N(!0), [C, tt] = N(s.sections[0]), [u, D] = N(!1), [L, H] = N({}), [G, et] = N([]), [X, q] = N(-1), [U] = N(new di("localStorage")), K = gt(null), kt = gt(null), mt = gt(null), pt = gt(null), Ot = gt(null), Bt = gt(new ci()), zt = gt(!1), [wt, ce] = N(null), lt = rt(() => {
|
|
6684
6684
|
const e = {
|
|
6685
6685
|
elements: JSON.parse(JSON.stringify(x)),
|
|
6686
6686
|
selectedElement: d ? { ...d } : null,
|
|
6687
6687
|
timestamp: Date.now()
|
|
6688
6688
|
}, t = G.slice(0, X + 1);
|
|
6689
|
-
t.push(e), t.length > 50 ? t.shift() :
|
|
6690
|
-
}, [x, d, G, X]),
|
|
6689
|
+
t.push(e), t.length > 50 ? t.shift() : q(X + 1), et(t);
|
|
6690
|
+
}, [x, d, G, X]), St = rt(() => ({
|
|
6691
6691
|
elements: x,
|
|
6692
6692
|
canvasWidth: v,
|
|
6693
6693
|
canvasHeight: W,
|
|
6694
|
-
selectedColor:
|
|
6695
|
-
activeSection:
|
|
6694
|
+
selectedColor: _,
|
|
6695
|
+
activeSection: C,
|
|
6696
6696
|
product: s,
|
|
6697
6697
|
sectionDesigns: L,
|
|
6698
6698
|
zoomLevel: Q,
|
|
6699
6699
|
showGrid: M,
|
|
6700
|
-
snapToGrid:
|
|
6700
|
+
snapToGrid: Y,
|
|
6701
6701
|
selectedElement: d ? { ...d } : null,
|
|
6702
6702
|
canvasRef: K
|
|
6703
6703
|
// Include reference for thumbnail generation
|
|
6704
|
-
}), [x, v, W,
|
|
6704
|
+
}), [x, v, W, _, C, s, L, Q, M, Y, d]);
|
|
6705
6705
|
ot(() => {
|
|
6706
6706
|
const t = setTimeout(async () => {
|
|
6707
6707
|
if (x.length === 0 && G.length <= 1) {
|
|
@@ -6716,8 +6716,8 @@ const fi = $e((f, o) => {
|
|
|
6716
6716
|
const dt = Object.keys($.sections)[0], it = $.sections[dt];
|
|
6717
6717
|
if (it && it.elements) {
|
|
6718
6718
|
n(it.elements || []), st(it.canvasWidth || 800), xt(it.canvasHeight || 600), at(it.selectedColor || s.colorSettings[0]), ft(it.zoomLevel || 1), nt(it.showGrid || !1), P(it.snapToGrid || !0), j(null), $.sections && H($.sections);
|
|
6719
|
-
const
|
|
6720
|
-
|
|
6719
|
+
const Rt = s.sections.find((Dt) => Dt.sectionName === dt);
|
|
6720
|
+
Rt && tt(Rt), et([]), q(-1), setTimeout(() => {
|
|
6721
6721
|
lt();
|
|
6722
6722
|
}, 100);
|
|
6723
6723
|
return;
|
|
@@ -6761,21 +6761,21 @@ const fi = $e((f, o) => {
|
|
|
6761
6761
|
return () => clearTimeout(t);
|
|
6762
6762
|
}, [h, s.colorSettings, s.sections]);
|
|
6763
6763
|
const Wt = rt((e = "png", t = !0) => {
|
|
6764
|
-
const r =
|
|
6765
|
-
return s.sections,
|
|
6766
|
-
{ [(
|
|
6764
|
+
const r = St();
|
|
6765
|
+
return s.sections, Bt.current.exportAllSections(
|
|
6766
|
+
{ [(C == null ? void 0 : C.sectionName) || "main"]: r },
|
|
6767
6767
|
[{
|
|
6768
|
-
id: (
|
|
6769
|
-
sectionName: (
|
|
6770
|
-
image:
|
|
6771
|
-
sectionImage:
|
|
6768
|
+
id: (C == null ? void 0 : C.sectionName) || "main",
|
|
6769
|
+
sectionName: (C == null ? void 0 : C.sectionName) || "main",
|
|
6770
|
+
image: C == null ? void 0 : C.sectionImage,
|
|
6771
|
+
sectionImage: C == null ? void 0 : C.sectionImage
|
|
6772
6772
|
}],
|
|
6773
6773
|
v,
|
|
6774
6774
|
W,
|
|
6775
6775
|
e,
|
|
6776
6776
|
t
|
|
6777
6777
|
);
|
|
6778
|
-
}, [
|
|
6778
|
+
}, [St, s.sections, C, v, W]), de = [
|
|
6779
6779
|
"Arial",
|
|
6780
6780
|
"Helvetica",
|
|
6781
6781
|
"Times New Roman",
|
|
@@ -6791,7 +6791,7 @@ const fi = $e((f, o) => {
|
|
|
6791
6791
|
"Bookman",
|
|
6792
6792
|
"Avant Garde",
|
|
6793
6793
|
"Century Gothic"
|
|
6794
|
-
],
|
|
6794
|
+
], At = 20;
|
|
6795
6795
|
ot(() => {
|
|
6796
6796
|
const e = () => D(window.innerWidth < 768);
|
|
6797
6797
|
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
@@ -6801,7 +6801,7 @@ const fi = $e((f, o) => {
|
|
|
6801
6801
|
}, [v, W]), ot(() => {
|
|
6802
6802
|
G.length === 0 && lt();
|
|
6803
6803
|
}, []);
|
|
6804
|
-
const
|
|
6804
|
+
const It = (e, t, r, c, g, m) => {
|
|
6805
6805
|
e.beginPath(), e.moveTo(t + m, r), e.lineTo(t + c - m, r), e.quadraticCurveTo(t + c, r, t + c, r + m), e.lineTo(t + c, r + g - m), e.quadraticCurveTo(t + c, r + g, t + c - m, r + g), e.lineTo(t + m, r + g), e.quadraticCurveTo(t, r + g, t, r + g - m), e.lineTo(t, r + m), e.quadraticCurveTo(t, r, t + m, r), e.closePath();
|
|
6806
6806
|
}, Qt = (e, t) => {
|
|
6807
6807
|
if (!t.isIcon)
|
|
@@ -6831,14 +6831,14 @@ const fi = $e((f, o) => {
|
|
|
6831
6831
|
w.x + w.w,
|
|
6832
6832
|
w.y + w.h
|
|
6833
6833
|
);
|
|
6834
|
-
R.addColorStop(0, "#3b82f6"), R.addColorStop(0.5, "#1d4ed8"), R.addColorStop(1, "#3b82f6"), e.strokeStyle = "rgba(59,130,246,.3)", e.lineWidth = 3,
|
|
6834
|
+
R.addColorStop(0, "#3b82f6"), R.addColorStop(0.5, "#1d4ed8"), R.addColorStop(1, "#3b82f6"), e.strokeStyle = "rgba(59,130,246,.3)", e.lineWidth = 3, It(
|
|
6835
6835
|
e,
|
|
6836
6836
|
w.x - 1,
|
|
6837
6837
|
w.y - 1,
|
|
6838
6838
|
w.w + 2,
|
|
6839
6839
|
w.h + 2,
|
|
6840
6840
|
g + 1
|
|
6841
|
-
), e.stroke(), e.strokeStyle = R, e.lineWidth = 2, e.setLineDash([8, 4]),
|
|
6841
|
+
), e.stroke(), e.strokeStyle = R, e.lineWidth = 2, e.setLineDash([8, 4]), It(e, w.x, w.y, w.w, w.h, g), e.stroke(), e.lineDashOffset = -(Date.now() / 50) % 12, e.strokeStyle = "#ffffff", e.lineWidth = 1, e.setLineDash([4, 8]), It(e, w.x, w.y, w.w, w.h, g), e.stroke(), e.setLineDash([]), e.lineDashOffset = 0, [
|
|
6842
6842
|
{ x: w.x, y: w.y },
|
|
6843
6843
|
{ x: w.x + w.w, y: w.y },
|
|
6844
6844
|
{ x: w.x + w.w, y: w.y + w.h },
|
|
@@ -6894,31 +6894,33 @@ const fi = $e((f, o) => {
|
|
|
6894
6894
|
return p.type;
|
|
6895
6895
|
}
|
|
6896
6896
|
return null;
|
|
6897
|
-
},
|
|
6897
|
+
}, Ft = rt(() => {
|
|
6898
6898
|
if (X > 0) {
|
|
6899
6899
|
const e = G[X - 1];
|
|
6900
|
-
n(e.elements), j(e.selectedElement),
|
|
6900
|
+
n(e.elements), j(e.selectedElement), q(X - 1);
|
|
6901
6901
|
}
|
|
6902
|
-
}, [G, X]),
|
|
6902
|
+
}, [G, X]), bt = rt(() => {
|
|
6903
6903
|
if (X < G.length - 1) {
|
|
6904
6904
|
const e = G[X + 1];
|
|
6905
|
-
n(e.elements), j(e.selectedElement),
|
|
6905
|
+
n(e.elements), j(e.selectedElement), q(X + 1);
|
|
6906
6906
|
}
|
|
6907
|
-
}, [G, X]), ut = (e) =>
|
|
6907
|
+
}, [G, X]), ut = (e) => Y ? Math.round(e / At) * At : e;
|
|
6908
6908
|
ot(() => {
|
|
6909
|
-
if (
|
|
6909
|
+
if (C != null && C.sectionImage) {
|
|
6910
6910
|
mt.current = null, pt.current = null;
|
|
6911
6911
|
const e = K.current;
|
|
6912
|
-
e &&
|
|
6912
|
+
e && e.getContext("2d").clearRect(0, 0, v, W);
|
|
6913
6913
|
const t = new Image();
|
|
6914
6914
|
t.crossOrigin = "anonymous", t.onload = () => {
|
|
6915
|
-
mt.current = t, Xt(t,
|
|
6915
|
+
mt.current = t, Xt(t, _);
|
|
6916
6916
|
}, t.onerror = () => {
|
|
6917
|
-
console.error("Failed to load background image:",
|
|
6918
|
-
}
|
|
6917
|
+
console.error("Failed to load background image:", C.sectionImage), V();
|
|
6918
|
+
};
|
|
6919
|
+
let r = C.sectionImage;
|
|
6920
|
+
wt && wt.sectionImage && (C.sectionName === "Front" || wt.sections && Object.keys(wt.sections).includes(C.sectionName)) && (r = wt.sectionImage), t.src = r;
|
|
6919
6921
|
} else
|
|
6920
6922
|
mt.current = null, pt.current = null, V();
|
|
6921
|
-
}, [
|
|
6923
|
+
}, [C, _, wt]), ot(() => {
|
|
6922
6924
|
const e = (t) => {
|
|
6923
6925
|
const r = document.activeElement;
|
|
6924
6926
|
if (!(r && (r.tagName === "INPUT" || r.tagName === "TEXTAREA" || r.tagName === "SELECT" || r.isContentEditable))) {
|
|
@@ -6930,10 +6932,10 @@ const fi = $e((f, o) => {
|
|
|
6930
6932
|
if (t.ctrlKey || t.metaKey)
|
|
6931
6933
|
switch (t.key) {
|
|
6932
6934
|
case "z":
|
|
6933
|
-
t.shiftKey ? (t.preventDefault(),
|
|
6935
|
+
t.shiftKey ? (t.preventDefault(), bt()) : (t.preventDefault(), Ft());
|
|
6934
6936
|
break;
|
|
6935
6937
|
case "y":
|
|
6936
|
-
t.preventDefault(),
|
|
6938
|
+
t.preventDefault(), bt();
|
|
6937
6939
|
break;
|
|
6938
6940
|
}
|
|
6939
6941
|
}
|
|
@@ -6941,7 +6943,7 @@ const fi = $e((f, o) => {
|
|
|
6941
6943
|
return document.addEventListener("keydown", e), () => {
|
|
6942
6944
|
document.removeEventListener("keydown", e);
|
|
6943
6945
|
};
|
|
6944
|
-
}, [d, l,
|
|
6946
|
+
}, [d, l, Ft, bt, lt]);
|
|
6945
6947
|
const ge = (e) => {
|
|
6946
6948
|
const t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
|
|
6947
6949
|
return t ? {
|
|
@@ -6951,9 +6953,9 @@ const fi = $e((f, o) => {
|
|
|
6951
6953
|
} : null;
|
|
6952
6954
|
}, ht = () => `element_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, xe = (e) => {
|
|
6953
6955
|
e.strokeStyle = "#e0e0e0", e.lineWidth = 1, e.setLineDash([1, 1]);
|
|
6954
|
-
for (let t = 0; t <= v; t +=
|
|
6956
|
+
for (let t = 0; t <= v; t += At)
|
|
6955
6957
|
e.beginPath(), e.moveTo(t, 0), e.lineTo(t, W), e.stroke();
|
|
6956
|
-
for (let t = 0; t <= W; t +=
|
|
6958
|
+
for (let t = 0; t <= W; t += At)
|
|
6957
6959
|
e.beginPath(), e.moveTo(0, t), e.lineTo(v, t), e.stroke();
|
|
6958
6960
|
e.setLineDash([]);
|
|
6959
6961
|
}, ye = (e, t) => {
|
|
@@ -7100,11 +7102,11 @@ const fi = $e((f, o) => {
|
|
|
7100
7102
|
const it = R + z / 2;
|
|
7101
7103
|
e.beginPath(), e.moveTo(0, it), e.lineTo(A, it), e.stroke();
|
|
7102
7104
|
}
|
|
7103
|
-
typeof t.textDecoration == "string" && t.textDecoration.includes(" ") && t.textDecoration.split(" ").forEach((
|
|
7104
|
-
switch (
|
|
7105
|
+
typeof t.textDecoration == "string" && t.textDecoration.includes(" ") && t.textDecoration.split(" ").forEach((Rt) => {
|
|
7106
|
+
switch (Rt.trim()) {
|
|
7105
7107
|
case "underline":
|
|
7106
|
-
const
|
|
7107
|
-
e.beginPath(), e.moveTo(0,
|
|
7108
|
+
const Dt = R + z + 2;
|
|
7109
|
+
e.beginPath(), e.moveTo(0, Dt), e.lineTo(A, Dt), e.stroke();
|
|
7108
7110
|
break;
|
|
7109
7111
|
case "overline":
|
|
7110
7112
|
const te = R - 2;
|
|
@@ -7193,7 +7195,7 @@ const fi = $e((f, o) => {
|
|
|
7193
7195
|
e.beginPath(), e.ellipse(r, c, g, m, 0, 0, 2 * Math.PI), t.fill && t.fill !== "transparent" && (e.fillStyle = t.fill, e.fill()), t.stroke && t.strokeWidth > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth, e.stroke());
|
|
7194
7196
|
}, Ae = (e, t) => {
|
|
7195
7197
|
const r = Math.min(t.width, t.height) * 0.1;
|
|
7196
|
-
|
|
7198
|
+
It(e, 0, 0, t.width, t.height, r), t.fill && t.fill !== "transparent" && (e.fillStyle = t.fill, e.fill()), t.stroke && t.strokeWidth > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth, e.stroke());
|
|
7197
7199
|
}, Ie = (e, t) => {
|
|
7198
7200
|
e.save(), t.opacity !== void 0 && (e.globalAlpha = t.opacity), e.strokeStyle = t.stroke || t.fill || "#000000", e.lineWidth = t.strokeWidth || t.height || 2, e.lineCap = "round", e.beginPath(), e.moveTo(0, t.height / 2), e.lineTo(t.width, t.height / 2), e.stroke(), e.restore();
|
|
7199
7201
|
}, Re = (e, t) => {
|
|
@@ -7240,7 +7242,7 @@ const fi = $e((f, o) => {
|
|
|
7240
7242
|
try {
|
|
7241
7243
|
e.drawImage(t.imageObject, 0, 0, t.width, t.height);
|
|
7242
7244
|
} catch (r) {
|
|
7243
|
-
console.error("Error drawing embroidery image:", r),
|
|
7245
|
+
console.error("Error drawing embroidery image:", r), Ct(e, t, "Error loading image");
|
|
7244
7246
|
}
|
|
7245
7247
|
else if (t.src && !t.imageLoading) {
|
|
7246
7248
|
t.imageLoading = !0;
|
|
@@ -7248,10 +7250,10 @@ const fi = $e((f, o) => {
|
|
|
7248
7250
|
r.crossOrigin = "anonymous", r.onload = () => {
|
|
7249
7251
|
r.complete && r.naturalHeight !== 0 ? (t.imageObject = r, t.imageLoading = !1, V()) : (t.imageLoading = !1, console.error("Image loaded but is invalid:", t.src));
|
|
7250
7252
|
}, r.onerror = () => {
|
|
7251
|
-
t.imageLoading = !1, console.error("Failed to load embroidery image:", t.src),
|
|
7252
|
-
}, r.src = t.src,
|
|
7253
|
-
} else t.imageLoading ?
|
|
7254
|
-
},
|
|
7253
|
+
t.imageLoading = !1, console.error("Failed to load embroidery image:", t.src), Ct(e, t, "Failed to load");
|
|
7254
|
+
}, r.src = t.src, Ct(e, t, "Loading...");
|
|
7255
|
+
} else t.imageLoading ? Ct(e, t, "Loading...") : Ct(e, t);
|
|
7256
|
+
}, Ct = (e, t, r = "Embroidery") => {
|
|
7255
7257
|
e.fillStyle = "#f9f9f9", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = "#ddd", e.lineWidth = 2, e.strokeRect(0, 0, t.width, t.height), e.fillStyle = "#999", e.font = "24px Arial", e.textAlign = "center", e.textBaseline = "middle", e.fillText("🧵", t.width / 2, t.height / 2 - 10), e.fillStyle = "#666", e.font = "12px Arial", e.fillText(r, t.width / 2, t.height / 2 + 15);
|
|
7256
7258
|
}, Ht = (e, t, r) => {
|
|
7257
7259
|
if (!r) return !1;
|
|
@@ -7266,7 +7268,7 @@ const fi = $e((f, o) => {
|
|
|
7266
7268
|
const e = (t) => {
|
|
7267
7269
|
if (l) return;
|
|
7268
7270
|
const r = document.activeElement;
|
|
7269
|
-
if (!(r && (r.tagName === "INPUT" || r.tagName === "TEXTAREA" || r.tagName === "SELECT" || r.isContentEditable)) && ((t.ctrlKey || t.metaKey) && (t.key === "z" && !t.shiftKey ? (t.preventDefault(),
|
|
7271
|
+
if (!(r && (r.tagName === "INPUT" || r.tagName === "TEXTAREA" || r.tagName === "SELECT" || r.isContentEditable)) && ((t.ctrlKey || t.metaKey) && (t.key === "z" && !t.shiftKey ? (t.preventDefault(), Ft()) : (t.key === "z" && t.shiftKey || t.key === "y") && (t.preventDefault(), bt())), (t.key === "Delete" || t.key === "Backspace") && d && (Mt(d.id), t.preventDefault()), (t.ctrlKey || t.metaKey) && t.key === "d" && d && (_t(d.id), t.preventDefault()), d && ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(t.key))) {
|
|
7270
7272
|
t.preventDefault();
|
|
7271
7273
|
const g = t.shiftKey ? 10 : 1;
|
|
7272
7274
|
let m = {};
|
|
@@ -7288,7 +7290,7 @@ const fi = $e((f, o) => {
|
|
|
7288
7290
|
}
|
|
7289
7291
|
};
|
|
7290
7292
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
7291
|
-
}, [d,
|
|
7293
|
+
}, [d, Ft, bt, l]);
|
|
7292
7294
|
const ze = (e, t = {}) => {
|
|
7293
7295
|
const r = {
|
|
7294
7296
|
id: ht(),
|
|
@@ -7369,14 +7371,14 @@ const fi = $e((f, o) => {
|
|
|
7369
7371
|
t === "up" && r < c.length - 1 ? (c[r] = c[r + 1], c[r + 1] = g) : t === "down" && r > 0 ? (c[r] = c[r - 1], c[r - 1] = g) : t === "top" ? (c.splice(r, 1), c.push(g)) : t === "bottom" && (c.splice(r, 1), c.unshift(g)), n(c), lt();
|
|
7370
7372
|
};
|
|
7371
7373
|
rt(() => {
|
|
7372
|
-
|
|
7374
|
+
C && H((e) => ({
|
|
7373
7375
|
...e,
|
|
7374
|
-
[
|
|
7376
|
+
[C.sectionName]: {
|
|
7375
7377
|
elements: [...x],
|
|
7376
|
-
selectedColor:
|
|
7378
|
+
selectedColor: _
|
|
7377
7379
|
}
|
|
7378
7380
|
}));
|
|
7379
|
-
}, [
|
|
7381
|
+
}, [C, x, _]);
|
|
7380
7382
|
const [, We] = He((e) => e + 1, 0);
|
|
7381
7383
|
setTimeout(() => {
|
|
7382
7384
|
We();
|
|
@@ -7388,13 +7390,13 @@ const fi = $e((f, o) => {
|
|
|
7388
7390
|
// Access to the existing exportDesign method
|
|
7389
7391
|
exportDesign: Wt,
|
|
7390
7392
|
// Get canvas data for custom exports
|
|
7391
|
-
getCanvasData: () =>
|
|
7393
|
+
getCanvasData: () => St(),
|
|
7392
7394
|
// NEW: Export methods that return JSON with File objects
|
|
7393
7395
|
exportAllDesignsAsJSON: async (e = "png") => {
|
|
7394
7396
|
try {
|
|
7395
|
-
const t =
|
|
7397
|
+
const t = St();
|
|
7396
7398
|
console.log("canvas data to export: ", t);
|
|
7397
|
-
const r = {}, c = (
|
|
7399
|
+
const r = {}, c = (C == null ? void 0 : C.sectionName) || "main";
|
|
7398
7400
|
r[c] = {
|
|
7399
7401
|
elements: t.elements,
|
|
7400
7402
|
selectedColor: t.selectedColor,
|
|
@@ -7404,10 +7406,10 @@ const fi = $e((f, o) => {
|
|
|
7404
7406
|
const g = s.sections && s.sections.length > 0 ? s.sections : [{
|
|
7405
7407
|
id: c,
|
|
7406
7408
|
sectionName: c,
|
|
7407
|
-
image:
|
|
7408
|
-
sectionImage:
|
|
7409
|
+
image: C == null ? void 0 : C.sectionImage,
|
|
7410
|
+
sectionImage: C == null ? void 0 : C.sectionImage
|
|
7409
7411
|
}];
|
|
7410
|
-
return await
|
|
7412
|
+
return await Bt.current.exportAllSectionsAsJSON(
|
|
7411
7413
|
r,
|
|
7412
7414
|
g,
|
|
7413
7415
|
v,
|
|
@@ -7420,8 +7422,8 @@ const fi = $e((f, o) => {
|
|
|
7420
7422
|
},
|
|
7421
7423
|
exportCurrentSectionAsJSON: async (e = "png") => {
|
|
7422
7424
|
try {
|
|
7423
|
-
const t =
|
|
7424
|
-
return await
|
|
7425
|
+
const t = St();
|
|
7426
|
+
return await Bt.current.exportCurrentSectionAsJSON(t, e);
|
|
7425
7427
|
} catch (t) {
|
|
7426
7428
|
throw console.error("Export current section as JSON failed:", t), t;
|
|
7427
7429
|
}
|
|
@@ -7435,24 +7437,24 @@ const fi = $e((f, o) => {
|
|
|
7435
7437
|
t.clearRect(0, 0, v, W), pt.current && t.drawImage(pt.current, 0, 0, v, W), M && xe(t), x.forEach((r) => {
|
|
7436
7438
|
t.save(), t.globalAlpha = r.opacity || 1, ye(t, r), t.restore();
|
|
7437
7439
|
}), d && fe(t, d), Lt.current = !1;
|
|
7438
|
-
}, [x, d, v, W, M]),
|
|
7440
|
+
}, [x, d, v, W, M]), vt = rt(() => {
|
|
7439
7441
|
yt.current && cancelAnimationFrame(yt.current), yt.current = requestAnimationFrame(() => {
|
|
7440
7442
|
V(), yt.current = null;
|
|
7441
7443
|
});
|
|
7442
7444
|
}, [V]);
|
|
7443
7445
|
ot(() => {
|
|
7444
|
-
|
|
7445
|
-
}, [x, d, v, W, M,
|
|
7446
|
-
pt.current &&
|
|
7447
|
-
}, [pt.current,
|
|
7446
|
+
vt();
|
|
7447
|
+
}, [x, d, v, W, M, vt]), ot(() => {
|
|
7448
|
+
pt.current && vt();
|
|
7449
|
+
}, [pt.current, vt]), ot(() => () => {
|
|
7448
7450
|
yt.current && cancelAnimationFrame(yt.current);
|
|
7449
7451
|
}, []);
|
|
7450
7452
|
const Pt = rt(() => {
|
|
7451
7453
|
V(), (S || y || B) && (yt.current = requestAnimationFrame(Pt));
|
|
7452
7454
|
}, [V, S, y, B]);
|
|
7453
7455
|
ot(() => {
|
|
7454
|
-
S || y || B ? Pt() : (yt.current && (cancelAnimationFrame(yt.current), yt.current = null),
|
|
7455
|
-
}, [S, y, B, Pt,
|
|
7456
|
+
S || y || B ? Pt() : (yt.current && (cancelAnimationFrame(yt.current), yt.current = null), vt());
|
|
7457
|
+
}, [S, y, B, Pt, vt]);
|
|
7456
7458
|
const Me = rt((e) => {
|
|
7457
7459
|
if (l) return;
|
|
7458
7460
|
const r = K.current.getBoundingClientRect(), c = (e.clientX - r.left) / Q, g = (e.clientY - r.top) / Q;
|
|
@@ -7510,10 +7512,10 @@ const fi = $e((f, o) => {
|
|
|
7510
7512
|
), j((A) => ({ ...A, rotation: R })), V();
|
|
7511
7513
|
return;
|
|
7512
7514
|
}
|
|
7513
|
-
if (y && d &&
|
|
7515
|
+
if (y && d && T) {
|
|
7514
7516
|
const m = c - F.x, p = g - F.y;
|
|
7515
7517
|
let k = F.initialWidth, w = F.initialHeight, R = F.initialX, A = F.initialY;
|
|
7516
|
-
switch (
|
|
7518
|
+
switch (T) {
|
|
7517
7519
|
case "se-resize":
|
|
7518
7520
|
k = Math.max(20, F.initialWidth + m), w = Math.max(20, F.initialHeight + p);
|
|
7519
7521
|
break;
|
|
@@ -7529,9 +7531,9 @@ const fi = $e((f, o) => {
|
|
|
7529
7531
|
}
|
|
7530
7532
|
if (e.shiftKey && d.type !== "text") {
|
|
7531
7533
|
const $ = F.initialWidth / F.initialHeight;
|
|
7532
|
-
|
|
7534
|
+
T.includes("e"), w = k / $, T.includes("n") && (A = F.initialY + (F.initialHeight - w));
|
|
7533
7535
|
}
|
|
7534
|
-
|
|
7536
|
+
Y && (R = ut(R), A = ut(A), k = ut(k), w = ut(w));
|
|
7535
7537
|
const z = {
|
|
7536
7538
|
...d,
|
|
7537
7539
|
x: R,
|
|
@@ -7548,7 +7550,7 @@ const fi = $e((f, o) => {
|
|
|
7548
7550
|
}
|
|
7549
7551
|
if (S && d) {
|
|
7550
7552
|
let m = c - F.offsetX, p = g - F.offsetY;
|
|
7551
|
-
|
|
7553
|
+
Y && (m = ut(m), p = ut(p)), m = Math.max(0, Math.min(v - d.width, m)), p = Math.max(0, Math.min(W - d.height, p));
|
|
7552
7554
|
const k = {
|
|
7553
7555
|
...d,
|
|
7554
7556
|
x: m,
|
|
@@ -7560,17 +7562,17 @@ const fi = $e((f, o) => {
|
|
|
7560
7562
|
)
|
|
7561
7563
|
), j(k), V();
|
|
7562
7564
|
}
|
|
7563
|
-
}, [l, Q, d, S, y, B,
|
|
7564
|
-
|
|
7565
|
+
}, [l, Q, d, S, y, B, T, F, Y, v, W, x, V]), qt = rt((e) => {
|
|
7566
|
+
C && H((r) => ({
|
|
7565
7567
|
...r,
|
|
7566
|
-
[
|
|
7568
|
+
[C.sectionName]: {
|
|
7567
7569
|
elements: x.map((c) => c.type === "image" ? {
|
|
7568
7570
|
...c,
|
|
7569
7571
|
// Keep the image data reference
|
|
7570
7572
|
imageData: c.imageData,
|
|
7571
7573
|
src: c.src
|
|
7572
7574
|
} : c),
|
|
7573
|
-
selectedColor:
|
|
7575
|
+
selectedColor: _
|
|
7574
7576
|
}
|
|
7575
7577
|
}));
|
|
7576
7578
|
const t = L[e.sectionName];
|
|
@@ -7588,11 +7590,11 @@ const fi = $e((f, o) => {
|
|
|
7588
7590
|
}
|
|
7589
7591
|
return c;
|
|
7590
7592
|
});
|
|
7591
|
-
n(r), at(t.selectedColor ||
|
|
7593
|
+
n(r), at(t.selectedColor || _);
|
|
7592
7594
|
} else
|
|
7593
7595
|
n([]);
|
|
7594
7596
|
tt(e), j(null);
|
|
7595
|
-
}, [
|
|
7597
|
+
}, [C, x, _, L, V]), Pe = rt((e) => {
|
|
7596
7598
|
if (e && e.type.startsWith("image/")) {
|
|
7597
7599
|
const t = new FileReader();
|
|
7598
7600
|
t.onload = (r) => {
|
|
@@ -7629,7 +7631,7 @@ const fi = $e((f, o) => {
|
|
|
7629
7631
|
[V]
|
|
7630
7632
|
);
|
|
7631
7633
|
ot(() => {
|
|
7632
|
-
|
|
7634
|
+
zt.current || Vt();
|
|
7633
7635
|
}, [x, d, M, Vt]);
|
|
7634
7636
|
function Ue(e, t) {
|
|
7635
7637
|
let r;
|
|
@@ -7641,8 +7643,8 @@ const fi = $e((f, o) => {
|
|
|
7641
7643
|
};
|
|
7642
7644
|
}
|
|
7643
7645
|
ot(() => {
|
|
7644
|
-
mt.current && Xt(mt.current,
|
|
7645
|
-
}, [
|
|
7646
|
+
mt.current && Xt(mt.current, _);
|
|
7647
|
+
}, [_]), ot(() => {
|
|
7646
7648
|
V();
|
|
7647
7649
|
}, [V]);
|
|
7648
7650
|
const Oe = (e, t, r) => (0.2126 * e + 0.7152 * t + 0.0722 * r) / 255, Xt = rt((e, t) => {
|
|
@@ -7650,7 +7652,7 @@ const fi = $e((f, o) => {
|
|
|
7650
7652
|
r.width = v, r.height = W, c.clearRect(0, 0, v, W), c.drawImage(e, 0, 0, v, W);
|
|
7651
7653
|
const g = c.getImageData(0, 0, v, W), m = g.data, p = ge(t);
|
|
7652
7654
|
if (!p) {
|
|
7653
|
-
|
|
7655
|
+
zt.current = !1;
|
|
7654
7656
|
return;
|
|
7655
7657
|
}
|
|
7656
7658
|
const { r: k, g: w, b: R } = p;
|
|
@@ -7662,7 +7664,7 @@ const fi = $e((f, o) => {
|
|
|
7662
7664
|
c.putImageData(g, 0, 0);
|
|
7663
7665
|
const A = new Image();
|
|
7664
7666
|
A.onload = () => {
|
|
7665
|
-
pt.current = s.plainColor === "Y" ? A : e,
|
|
7667
|
+
pt.current = s.plainColor === "Y" ? A : e, zt.current = !1, V();
|
|
7666
7668
|
}, A.src = r.toDataURL("image/png");
|
|
7667
7669
|
}, [v, W, V]), Jt = (e) => {
|
|
7668
7670
|
if (!Z) return { horizontal: [], vertical: [] };
|
|
@@ -7712,17 +7714,17 @@ const fi = $e((f, o) => {
|
|
|
7712
7714
|
onAddElement: ze,
|
|
7713
7715
|
onDeleteElement: () => d && Mt(d.id),
|
|
7714
7716
|
onDuplicateElement: () => d && _t(d.id),
|
|
7715
|
-
onUndo:
|
|
7716
|
-
onRedo:
|
|
7717
|
+
onUndo: Ft,
|
|
7718
|
+
onRedo: bt,
|
|
7717
7719
|
onToggleGrid: () => nt(!M),
|
|
7718
7720
|
onToggleRulers: () => ct(!Z),
|
|
7719
|
-
onToggleSnap: () => P(!
|
|
7721
|
+
onToggleSnap: () => P(!Y),
|
|
7720
7722
|
onImageUpload: Pe,
|
|
7721
7723
|
canUndo: X > 0,
|
|
7722
7724
|
canRedo: X < G.length - 1,
|
|
7723
7725
|
showGrid: M,
|
|
7724
7726
|
showRulers: Z,
|
|
7725
|
-
snapToGrid:
|
|
7727
|
+
snapToGrid: Y,
|
|
7726
7728
|
selectedElement: d,
|
|
7727
7729
|
theme: a,
|
|
7728
7730
|
readOnly: l,
|
|
@@ -7751,7 +7753,7 @@ const fi = $e((f, o) => {
|
|
|
7751
7753
|
t
|
|
7752
7754
|
)) }) })
|
|
7753
7755
|
] }),
|
|
7754
|
-
/* @__PURE__ */ i.jsx("div", { className: "canvas-container", ref:
|
|
7756
|
+
/* @__PURE__ */ i.jsx("div", { className: "canvas-container", ref: kt, children: /* @__PURE__ */ i.jsx(
|
|
7755
7757
|
"canvas",
|
|
7756
7758
|
{
|
|
7757
7759
|
ref: K,
|
|
@@ -7803,7 +7805,7 @@ const fi = $e((f, o) => {
|
|
|
7803
7805
|
return /* @__PURE__ */ i.jsxs(
|
|
7804
7806
|
"div",
|
|
7805
7807
|
{
|
|
7806
|
-
className: `section-thumbnail compact ${
|
|
7808
|
+
className: `section-thumbnail compact ${C.sectionName === e.sectionName ? "active" : ""}`,
|
|
7807
7809
|
onClick: (r) => {
|
|
7808
7810
|
r.stopPropagation();
|
|
7809
7811
|
const c = s.sections.find((g) => g.sectionName === e.sectionName);
|
|
@@ -7839,7 +7841,7 @@ const fi = $e((f, o) => {
|
|
|
7839
7841
|
s.colorSettings.slice(0, 3).map((e, t) => /* @__PURE__ */ i.jsxs(
|
|
7840
7842
|
"div",
|
|
7841
7843
|
{
|
|
7842
|
-
className: `color-swatch-enhanced compact ${
|
|
7844
|
+
className: `color-swatch-enhanced compact ${_ === e ? "active" : ""}`,
|
|
7843
7845
|
onClick: (r) => {
|
|
7844
7846
|
r.stopPropagation(), at(e);
|
|
7845
7847
|
},
|
|
@@ -7852,7 +7854,7 @@ const fi = $e((f, o) => {
|
|
|
7852
7854
|
style: { backgroundColor: e }
|
|
7853
7855
|
}
|
|
7854
7856
|
),
|
|
7855
|
-
|
|
7857
|
+
_ === e && /* @__PURE__ */ i.jsx("div", { className: "color-selection-ring compact" })
|
|
7856
7858
|
]
|
|
7857
7859
|
},
|
|
7858
7860
|
e
|
|
@@ -7878,7 +7880,7 @@ const fi = $e((f, o) => {
|
|
|
7878
7880
|
/* @__PURE__ */ i.jsx("div", { className: "color-dropdown-menu", style: { display: "none" }, children: s.colorSettings.slice(3).map((e, t) => /* @__PURE__ */ i.jsxs(
|
|
7879
7881
|
"div",
|
|
7880
7882
|
{
|
|
7881
|
-
className: `color-swatch-dropdown ${
|
|
7883
|
+
className: `color-swatch-dropdown ${_ === e ? "active" : ""}`,
|
|
7882
7884
|
onClick: (r) => {
|
|
7883
7885
|
r.stopPropagation(), at(e), r.currentTarget.parentElement.style.display = "none";
|
|
7884
7886
|
},
|