@mypixia/simplex-designer 2.0.8 → 2.0.9
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 +493 -483
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import $e, { useState as N, useRef as gt, useEffect as rt, useMemo as ie, forwardRef as He, useCallback as at, useReducer as Ge, useImperativeHandle as _e } from "react";
|
|
2
|
+
import Ye from "qrcode";
|
|
3
|
+
import qe from "react-barcode";
|
|
4
4
|
import oe from "axios";
|
|
5
|
-
import './index_external.css';var Et = { exports: {} },
|
|
5
|
+
import './index_external.css';var Et = { exports: {} }, Tt = {};
|
|
6
6
|
/**
|
|
7
7
|
* @license React
|
|
8
8
|
* react-jsx-runtime.production.js
|
|
@@ -13,8 +13,8 @@ import './index_external.css';var Et = { exports: {} }, jt = {};
|
|
|
13
13
|
* LICENSE file in the root directory of this source tree.
|
|
14
14
|
*/
|
|
15
15
|
var re;
|
|
16
|
-
function
|
|
17
|
-
if (re) return
|
|
16
|
+
function Ve() {
|
|
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, g) {
|
|
@@ -32,9 +32,9 @@ function qe() {
|
|
|
32
32
|
props: g
|
|
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
|
|
@@ -45,12 +45,12 @@ var Tt = {};
|
|
|
45
45
|
* LICENSE file in the root directory of this source tree.
|
|
46
46
|
*/
|
|
47
47
|
var ae;
|
|
48
|
-
function
|
|
48
|
+
function Xe() {
|
|
49
49
|
return ae || (ae = 1, process.env.NODE_ENV !== "production" && function() {
|
|
50
50
|
function f(y) {
|
|
51
51
|
if (y == null) return null;
|
|
52
52
|
if (typeof y == "function")
|
|
53
|
-
return y.$$typeof ===
|
|
53
|
+
return y.$$typeof === G ? null : y.displayName || y.name || null;
|
|
54
54
|
if (typeof y == "string") return y;
|
|
55
55
|
switch (y) {
|
|
56
56
|
case p:
|
|
@@ -70,11 +70,11 @@ function Ve() {
|
|
|
70
70
|
switch (typeof y.tag == "number" && console.error(
|
|
71
71
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
72
72
|
), y.$$typeof) {
|
|
73
|
-
case
|
|
73
|
+
case j:
|
|
74
74
|
return "Portal";
|
|
75
75
|
case O:
|
|
76
76
|
return (y.displayName || "Context") + ".Provider";
|
|
77
|
-
case
|
|
77
|
+
case T:
|
|
78
78
|
return (y._context.displayName || "Context") + ".Consumer";
|
|
79
79
|
case k:
|
|
80
80
|
var D = y.render;
|
|
@@ -102,11 +102,11 @@ function Ve() {
|
|
|
102
102
|
}
|
|
103
103
|
if (D) {
|
|
104
104
|
D = console;
|
|
105
|
-
var L = D.error,
|
|
105
|
+
var L = D.error, $ = typeof Symbol == "function" && Symbol.toStringTag && y[Symbol.toStringTag] || y.constructor.name || "Object";
|
|
106
106
|
return L.call(
|
|
107
107
|
D,
|
|
108
108
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
109
|
-
|
|
109
|
+
$
|
|
110
110
|
), o(y);
|
|
111
111
|
}
|
|
112
112
|
}
|
|
@@ -153,13 +153,13 @@ function Ve() {
|
|
|
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
|
)), y = this.props.ref, y !== void 0 ? y : null;
|
|
155
155
|
}
|
|
156
|
-
function
|
|
156
|
+
function C(y, D, L, $, _, it, J, q) {
|
|
157
157
|
return L = it.ref, y = {
|
|
158
158
|
$$typeof: B,
|
|
159
159
|
type: y,
|
|
160
160
|
key: D,
|
|
161
161
|
props: it,
|
|
162
|
-
_owner:
|
|
162
|
+
_owner: _
|
|
163
163
|
}, (L !== void 0 ? L : null) !== null ? Object.defineProperty(y, "ref", {
|
|
164
164
|
enumerable: !1,
|
|
165
165
|
get: c
|
|
@@ -185,13 +185,13 @@ function Ve() {
|
|
|
185
185
|
value: q
|
|
186
186
|
}), Object.freeze && (Object.freeze(y.props), Object.freeze(y)), y;
|
|
187
187
|
}
|
|
188
|
-
function I(y, D, L,
|
|
188
|
+
function I(y, D, L, $, _, it, J, q) {
|
|
189
189
|
var U = D.children;
|
|
190
190
|
if (U !== void 0)
|
|
191
|
-
if (
|
|
191
|
+
if ($)
|
|
192
192
|
if (nt(U)) {
|
|
193
|
-
for (
|
|
194
|
-
E(U[
|
|
193
|
+
for ($ = 0; $ < U.length; $++)
|
|
194
|
+
E(U[$]);
|
|
195
195
|
Object.freeze && Object.freeze(U);
|
|
196
196
|
} else
|
|
197
197
|
console.error(
|
|
@@ -203,18 +203,18 @@ function Ve() {
|
|
|
203
203
|
var K = Object.keys(D).filter(function(pt) {
|
|
204
204
|
return pt !== "key";
|
|
205
205
|
});
|
|
206
|
-
|
|
206
|
+
$ = 0 < K.length ? "{key: someKey, " + K.join(": ..., ") + ": ...}" : "{key: someKey}", et[U + $] || (K = 0 < K.length ? "{" + K.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
207
207
|
`A props object containing a "key" prop is being spread into JSX:
|
|
208
208
|
let props = %s;
|
|
209
209
|
<%s {...props} />
|
|
210
210
|
React keys must be passed directly to JSX without using spread:
|
|
211
211
|
let props = %s;
|
|
212
212
|
<%s key={someKey} {...props} />`,
|
|
213
|
-
|
|
213
|
+
$,
|
|
214
214
|
U,
|
|
215
215
|
K,
|
|
216
216
|
U
|
|
217
|
-
), et[U +
|
|
217
|
+
), et[U + $] = !0);
|
|
218
218
|
}
|
|
219
219
|
if (U = null, L !== void 0 && (a(L), U = "" + L), h(D) && (a(D.key), U = "" + D.key), "key" in D) {
|
|
220
220
|
L = {};
|
|
@@ -224,11 +224,11 @@ React keys must be passed directly to JSX without using spread:
|
|
|
224
224
|
return U && n(
|
|
225
225
|
L,
|
|
226
226
|
typeof y == "function" ? y.displayName || y.name || "Unknown" : y
|
|
227
|
-
),
|
|
227
|
+
), C(
|
|
228
228
|
y,
|
|
229
229
|
U,
|
|
230
230
|
it,
|
|
231
|
-
|
|
231
|
+
_,
|
|
232
232
|
s(),
|
|
233
233
|
L,
|
|
234
234
|
J,
|
|
@@ -238,50 +238,50 @@ React keys must be passed directly to JSX without using spread:
|
|
|
238
238
|
function E(y) {
|
|
239
239
|
typeof y == "object" && y !== null && y.$$typeof === B && y._store && (y._store.validated = 1);
|
|
240
240
|
}
|
|
241
|
-
var
|
|
241
|
+
var u = $e, B = Symbol.for("react.transitional.element"), j = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), v = Symbol.for("react.strict_mode"), X = Symbol.for("react.profiler"), T = Symbol.for("react.consumer"), O = Symbol.for("react.context"), k = Symbol.for("react.forward_ref"), Z = 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"), G = Symbol.for("react.client.reference"), st = u.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, M = Object.prototype.hasOwnProperty, nt = Array.isArray, tt = console.createTask ? console.createTask : function() {
|
|
242
242
|
return null;
|
|
243
243
|
};
|
|
244
|
-
|
|
244
|
+
u = {
|
|
245
245
|
"react-stack-bottom-frame": function(y) {
|
|
246
246
|
return y();
|
|
247
247
|
}
|
|
248
248
|
};
|
|
249
|
-
var ct, Y = {}, P =
|
|
250
|
-
|
|
249
|
+
var ct, Y = {}, P = u["react-stack-bottom-frame"].bind(
|
|
250
|
+
u,
|
|
251
251
|
g
|
|
252
|
-
)(),
|
|
253
|
-
|
|
252
|
+
)(), F = tt(l(g)), et = {};
|
|
253
|
+
jt.Fragment = p, jt.jsx = function(y, D, L, $, _) {
|
|
254
254
|
var it = 1e4 > st.recentlyCreatedOwnerStacks++;
|
|
255
255
|
return I(
|
|
256
256
|
y,
|
|
257
257
|
D,
|
|
258
258
|
L,
|
|
259
259
|
!1,
|
|
260
|
-
|
|
261
|
-
|
|
260
|
+
$,
|
|
261
|
+
_,
|
|
262
262
|
it ? Error("react-stack-top-frame") : P,
|
|
263
|
-
it ? tt(l(y)) :
|
|
263
|
+
it ? tt(l(y)) : F
|
|
264
264
|
);
|
|
265
|
-
},
|
|
265
|
+
}, jt.jsxs = function(y, D, L, $, _) {
|
|
266
266
|
var it = 1e4 > st.recentlyCreatedOwnerStacks++;
|
|
267
267
|
return I(
|
|
268
268
|
y,
|
|
269
269
|
D,
|
|
270
270
|
L,
|
|
271
271
|
!0,
|
|
272
|
-
|
|
273
|
-
|
|
272
|
+
$,
|
|
273
|
+
_,
|
|
274
274
|
it ? Error("react-stack-top-frame") : P,
|
|
275
|
-
it ? tt(l(y)) :
|
|
275
|
+
it ? tt(l(y)) : F
|
|
276
276
|
);
|
|
277
277
|
};
|
|
278
|
-
}()),
|
|
278
|
+
}()), jt;
|
|
279
279
|
}
|
|
280
280
|
var se;
|
|
281
|
-
function
|
|
282
|
-
return se || (se = 1, process.env.NODE_ENV === "production" ? Et.exports =
|
|
281
|
+
function Je() {
|
|
282
|
+
return se || (se = 1, process.env.NODE_ENV === "production" ? Et.exports = Ve() : Et.exports = Xe()), Et.exports;
|
|
283
283
|
}
|
|
284
|
-
var i =
|
|
284
|
+
var i = Je();
|
|
285
285
|
const Ut = {
|
|
286
286
|
business: {
|
|
287
287
|
name: "Business & Office",
|
|
@@ -378,25 +378,25 @@ const Ut = {
|
|
|
378
378
|
...o,
|
|
379
379
|
category: f.name
|
|
380
380
|
}))
|
|
381
|
-
),
|
|
381
|
+
), Ke = (f) => ne().filter(
|
|
382
382
|
(a) => a.name.toLowerCase().includes(f.toLowerCase()) || a.category.toLowerCase().includes(f.toLowerCase())
|
|
383
|
-
),
|
|
383
|
+
), Ze = ({ onSelectIcon: f, disabled: o = !1 }) => {
|
|
384
384
|
const [a, l] = N(!1), [s, g] = N(""), [h, n] = N("all"), c = gt(null);
|
|
385
385
|
rt(() => {
|
|
386
|
-
const
|
|
386
|
+
const u = (B) => {
|
|
387
387
|
c.current && !c.current.contains(B.target) && l(!1);
|
|
388
388
|
};
|
|
389
|
-
return document.addEventListener("mousedown",
|
|
389
|
+
return document.addEventListener("mousedown", u), () => document.removeEventListener("mousedown", u);
|
|
390
390
|
}, []);
|
|
391
|
-
const
|
|
392
|
-
f(
|
|
391
|
+
const C = (u) => {
|
|
392
|
+
f(u), l(!1), g("");
|
|
393
393
|
}, E = (() => {
|
|
394
|
-
let
|
|
395
|
-
if (s.trim() && (
|
|
394
|
+
let u = ne();
|
|
395
|
+
if (s.trim() && (u = Ke(s)), h !== "all") {
|
|
396
396
|
const B = Ut[h];
|
|
397
|
-
B && (
|
|
397
|
+
B && (u = u.filter((j) => j.category === B.name));
|
|
398
398
|
}
|
|
399
|
-
return
|
|
399
|
+
return u;
|
|
400
400
|
})();
|
|
401
401
|
return /* @__PURE__ */ i.jsxs("div", { className: "icon-selector", ref: c, children: [
|
|
402
402
|
/* @__PURE__ */ i.jsxs(
|
|
@@ -421,7 +421,7 @@ const Ut = {
|
|
|
421
421
|
type: "text",
|
|
422
422
|
placeholder: "Search icons...",
|
|
423
423
|
value: s,
|
|
424
|
-
onChange: (
|
|
424
|
+
onChange: (u) => g(u.target.value),
|
|
425
425
|
className: "icon-search"
|
|
426
426
|
}
|
|
427
427
|
),
|
|
@@ -429,27 +429,27 @@ const Ut = {
|
|
|
429
429
|
"select",
|
|
430
430
|
{
|
|
431
431
|
value: h,
|
|
432
|
-
onChange: (
|
|
432
|
+
onChange: (u) => n(u.target.value),
|
|
433
433
|
className: "category-select",
|
|
434
434
|
children: [
|
|
435
435
|
/* @__PURE__ */ i.jsx("option", { value: "all", children: "All Categories" }),
|
|
436
|
-
Object.entries(Ut).map(([
|
|
436
|
+
Object.entries(Ut).map(([u, B]) => /* @__PURE__ */ i.jsx("option", { value: u, children: B.name }, u))
|
|
437
437
|
]
|
|
438
438
|
}
|
|
439
439
|
)
|
|
440
440
|
] }),
|
|
441
|
-
/* @__PURE__ */ i.jsx("div", { className: "icon-grid", children: E.length === 0 ? /* @__PURE__ */ i.jsx("div", { className: "no-icons", children: s ? "No icons found" : "No icons in this category" }) : E.map((
|
|
441
|
+
/* @__PURE__ */ i.jsx("div", { className: "icon-grid", children: E.length === 0 ? /* @__PURE__ */ i.jsx("div", { className: "no-icons", children: s ? "No icons found" : "No icons in this category" }) : E.map((u, B) => /* @__PURE__ */ i.jsxs(
|
|
442
442
|
"button",
|
|
443
443
|
{
|
|
444
444
|
className: "icon-item",
|
|
445
|
-
onClick: () =>
|
|
446
|
-
title: `${
|
|
445
|
+
onClick: () => C(u),
|
|
446
|
+
title: `${u.name} (${u.category})`,
|
|
447
447
|
children: [
|
|
448
|
-
/* @__PURE__ */ i.jsx("span", { className: "icon-symbol", children:
|
|
449
|
-
/* @__PURE__ */ i.jsx("span", { className: "icon-name", children:
|
|
448
|
+
/* @__PURE__ */ i.jsx("span", { className: "icon-symbol", children: u.symbol }),
|
|
449
|
+
/* @__PURE__ */ i.jsx("span", { className: "icon-name", children: u.name })
|
|
450
450
|
]
|
|
451
451
|
},
|
|
452
|
-
`${
|
|
452
|
+
`${u.name}-${B}`
|
|
453
453
|
)) }),
|
|
454
454
|
/* @__PURE__ */ i.jsx("div", { className: "icon-dropdown-footer", children: /* @__PURE__ */ i.jsxs("span", { className: "icon-count", children: [
|
|
455
455
|
E.length,
|
|
@@ -458,8 +458,8 @@ const Ut = {
|
|
|
458
458
|
] }) })
|
|
459
459
|
] })
|
|
460
460
|
] });
|
|
461
|
-
},
|
|
462
|
-
const [s, g] = N(""), [h, n] = N(""), [c,
|
|
461
|
+
}, ti = ({ isOpen: f, onClose: o, onAddQRCode: a, theme: l }) => {
|
|
462
|
+
const [s, g] = N(""), [h, n] = N(""), [c, C] = N(200), [I, E] = N("M"), u = () => {
|
|
463
463
|
if (!s.trim()) return;
|
|
464
464
|
const p = {
|
|
465
465
|
width: c,
|
|
@@ -472,7 +472,7 @@ const Ut = {
|
|
|
472
472
|
light: "#FFFFFF"
|
|
473
473
|
}
|
|
474
474
|
};
|
|
475
|
-
|
|
475
|
+
Ye.toDataURL(s, p, (v, X) => {
|
|
476
476
|
if (v) {
|
|
477
477
|
console.error("QR Code generation error:", v);
|
|
478
478
|
return;
|
|
@@ -493,19 +493,19 @@ const Ut = {
|
|
|
493
493
|
y: 100,
|
|
494
494
|
imageObject: p
|
|
495
495
|
// Store the loaded image object
|
|
496
|
-
}),
|
|
496
|
+
}), j();
|
|
497
497
|
}, p.src = h;
|
|
498
|
-
},
|
|
498
|
+
}, j = () => {
|
|
499
499
|
g(""), n(""), o();
|
|
500
500
|
};
|
|
501
|
-
return f ? /* @__PURE__ */ i.jsx("div", { className: "qr-modal-overlay", onClick:
|
|
501
|
+
return f ? /* @__PURE__ */ i.jsx("div", { className: "qr-modal-overlay", onClick: j, children: /* @__PURE__ */ i.jsxs("div", { className: "qr-modal-content", onClick: (p) => p.stopPropagation(), children: [
|
|
502
502
|
/* @__PURE__ */ i.jsxs("div", { className: "qr-modal-header", children: [
|
|
503
503
|
/* @__PURE__ */ i.jsx("h3", { children: "Generate QR Code" }),
|
|
504
504
|
/* @__PURE__ */ i.jsx(
|
|
505
505
|
"button",
|
|
506
506
|
{
|
|
507
507
|
className: "qr-modal-close",
|
|
508
|
-
onClick:
|
|
508
|
+
onClick: j,
|
|
509
509
|
"aria-label": "Close",
|
|
510
510
|
children: "×"
|
|
511
511
|
}
|
|
@@ -534,7 +534,7 @@ const Ut = {
|
|
|
534
534
|
type: "number",
|
|
535
535
|
id: "qr-size",
|
|
536
536
|
value: c,
|
|
537
|
-
onChange: (p) =>
|
|
537
|
+
onChange: (p) => C(Math.max(50, Math.min(500, parseInt(p.target.value) || 200))),
|
|
538
538
|
min: "50",
|
|
539
539
|
max: "500"
|
|
540
540
|
}
|
|
@@ -562,7 +562,7 @@ const Ut = {
|
|
|
562
562
|
"button",
|
|
563
563
|
{
|
|
564
564
|
className: "qr-btn qr-btn-generate",
|
|
565
|
-
onClick:
|
|
565
|
+
onClick: u,
|
|
566
566
|
disabled: !s.trim(),
|
|
567
567
|
children: "Generate QR Code"
|
|
568
568
|
}
|
|
@@ -585,8 +585,8 @@ const Ut = {
|
|
|
585
585
|
] })
|
|
586
586
|
] })
|
|
587
587
|
] }) }) : null;
|
|
588
|
-
},
|
|
589
|
-
const [s, g] = N(""), [h, n] = N("CODE128"), [c,
|
|
588
|
+
}, ei = ({ isOpen: f, onClose: o, onAddBarcode: a, theme: l }) => {
|
|
589
|
+
const [s, g] = N(""), [h, n] = N("CODE128"), [c, C] = N(null), [I, E] = N(2), [u, B] = N(100), [j, p] = N(20), [v, X] = N("center"), [T, O] = N("bottom"), [k, Z] = 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)" },
|
|
@@ -599,16 +599,16 @@ const Ut = {
|
|
|
599
599
|
], Q = () => {
|
|
600
600
|
if (s.trim())
|
|
601
601
|
try {
|
|
602
|
-
|
|
603
|
-
|
|
602
|
+
C(/* @__PURE__ */ i.jsx(
|
|
603
|
+
qe,
|
|
604
604
|
{
|
|
605
605
|
value: s,
|
|
606
606
|
format: h,
|
|
607
607
|
width: I,
|
|
608
|
-
height:
|
|
609
|
-
fontSize:
|
|
608
|
+
height: u,
|
|
609
|
+
fontSize: j,
|
|
610
610
|
textAlign: v,
|
|
611
|
-
textPosition:
|
|
611
|
+
textPosition: T,
|
|
612
612
|
margin: k,
|
|
613
613
|
background: "#ffffff",
|
|
614
614
|
lineColor: "#000000"
|
|
@@ -626,11 +626,11 @@ const Ut = {
|
|
|
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"), F = P.getContext("2d"), et = Y.getBoundingClientRect(), y = ((nt = (M = Y.width) == null ? void 0 : M.baseVal) == null ? void 0 : nt.value) || et.width || 200, D = ((ct = (tt = Y.height) == null ? void 0 : tt.baseVal) == null ? void 0 : ct.value) || et.height || 100;
|
|
630
630
|
P.width = y, P.height = D;
|
|
631
|
-
const L = new XMLSerializer().serializeToString(Y),
|
|
631
|
+
const L = new XMLSerializer().serializeToString(Y), $ = new Blob([L], { type: "image/svg+xml;charset=utf-8" }), _ = URL.createObjectURL($), it = new Image();
|
|
632
632
|
it.onload = () => {
|
|
633
|
-
|
|
633
|
+
F.drawImage(it, 0, 0);
|
|
634
634
|
const J = P.toDataURL("image/png"), q = new Image();
|
|
635
635
|
q.onload = () => {
|
|
636
636
|
a({
|
|
@@ -643,14 +643,14 @@ const Ut = {
|
|
|
643
643
|
x: 100,
|
|
644
644
|
y: 100,
|
|
645
645
|
imageObject: q
|
|
646
|
-
}),
|
|
647
|
-
}, q.src = J, URL.revokeObjectURL(
|
|
648
|
-
}, it.src =
|
|
646
|
+
}), G();
|
|
647
|
+
}, q.src = J, URL.revokeObjectURL(_);
|
|
648
|
+
}, it.src = _;
|
|
649
649
|
} catch (Y) {
|
|
650
650
|
console.error("Error adding barcode to canvas:", Y), alert("Failed to add barcode to canvas. Please try again.");
|
|
651
651
|
}
|
|
652
|
-
},
|
|
653
|
-
g(""),
|
|
652
|
+
}, G = () => {
|
|
653
|
+
g(""), C(null), n("CODE128"), E(2), B(100), p(20), o();
|
|
654
654
|
}, st = (M) => ({
|
|
655
655
|
CODE128: "Supports all ASCII characters. Most versatile format.",
|
|
656
656
|
EAN13: "Requires exactly 12 digits (13th is checksum). Used for retail products.",
|
|
@@ -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: G, 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: G,
|
|
673
673
|
"aria-label": "Close",
|
|
674
674
|
children: "×"
|
|
675
675
|
}
|
|
@@ -731,12 +731,12 @@ const Ut = {
|
|
|
731
731
|
id: "barcode-height",
|
|
732
732
|
min: "50",
|
|
733
733
|
max: "200",
|
|
734
|
-
value:
|
|
734
|
+
value: u,
|
|
735
735
|
onChange: (M) => B(parseInt(M.target.value))
|
|
736
736
|
}
|
|
737
737
|
),
|
|
738
738
|
/* @__PURE__ */ i.jsxs("span", { className: "range-value", children: [
|
|
739
|
-
|
|
739
|
+
u,
|
|
740
740
|
"px"
|
|
741
741
|
] })
|
|
742
742
|
] }),
|
|
@@ -749,12 +749,12 @@ const Ut = {
|
|
|
749
749
|
id: "barcode-fontsize",
|
|
750
750
|
min: "10",
|
|
751
751
|
max: "30",
|
|
752
|
-
value:
|
|
752
|
+
value: j,
|
|
753
753
|
onChange: (M) => p(parseInt(M.target.value))
|
|
754
754
|
}
|
|
755
755
|
),
|
|
756
756
|
/* @__PURE__ */ i.jsxs("span", { className: "range-value", children: [
|
|
757
|
-
|
|
757
|
+
j,
|
|
758
758
|
"px"
|
|
759
759
|
] })
|
|
760
760
|
] }),
|
|
@@ -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" }),
|
|
@@ -801,7 +801,7 @@ const Ut = {
|
|
|
801
801
|
] })
|
|
802
802
|
] })
|
|
803
803
|
] }) }) : null;
|
|
804
|
-
},
|
|
804
|
+
}, ii = ({ theme: f }) => /* @__PURE__ */ i.jsxs("div", { className: "premium-feature-container", style: {
|
|
805
805
|
padding: "20px",
|
|
806
806
|
backgroundColor: "#f8f9fa",
|
|
807
807
|
borderRadius: "8px",
|
|
@@ -864,17 +864,17 @@ const Ut = {
|
|
|
864
864
|
100% { transform: rotate(360deg); }
|
|
865
865
|
}
|
|
866
866
|
` })
|
|
867
|
-
] }),
|
|
868
|
-
const [h, n] = N([]), [c,
|
|
867
|
+
] }), oi = ({ isOpen: f, onClose: o, onAddSticker: a, theme: l, apiKey: s, apiEndpoint: g }) => {
|
|
868
|
+
const [h, n] = N([]), [c, C] = N(!1), [I, E] = N(null), [u, B] = N(""), [j, p] = N(""), [v, X] = N({});
|
|
869
869
|
gt(null);
|
|
870
|
-
const [
|
|
870
|
+
const [T, O] = N(!1), [k, Z] = N(!1), [W, xt] = N(!1), Q = `${g}/api/v1/designer`;
|
|
871
871
|
rt(() => {
|
|
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), Z(!0), st()) : P === "inactive" ? (O(!1), Z(!0)) : (xt(!0), await
|
|
877
|
-
},
|
|
876
|
+
P === "active" ? (O(!0), Z(!0), st()) : P === "inactive" ? (O(!1), Z(!0)) : (xt(!0), await G());
|
|
877
|
+
}, G = async () => {
|
|
878
878
|
if (!s) {
|
|
879
879
|
O(!1), Z(!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), st()) : (sessionStorage.setItem("apc_x_sub_status", "inactive"), O(!1));
|
|
885
|
-
} catch (
|
|
886
|
-
console.error("Subscription check failed:",
|
|
885
|
+
} catch (F) {
|
|
886
|
+
console.error("Subscription check failed:", F), sessionStorage.setItem("apc_x_sub_status", "inactive"), O(!1);
|
|
887
887
|
} finally {
|
|
888
888
|
xt(!1), Z(!0);
|
|
889
889
|
}
|
|
@@ -891,52 +891,52 @@ const Ut = {
|
|
|
891
891
|
const P = sessionStorage.getItem("apc_stickers");
|
|
892
892
|
if (P)
|
|
893
893
|
try {
|
|
894
|
-
const
|
|
895
|
-
n(
|
|
894
|
+
const F = JSON.parse(P);
|
|
895
|
+
n(F);
|
|
896
896
|
return;
|
|
897
897
|
} catch {
|
|
898
898
|
console.warn("Failed to parse cached stickers, fetching fresh data");
|
|
899
899
|
}
|
|
900
|
-
|
|
900
|
+
C(!0), E(null);
|
|
901
901
|
try {
|
|
902
|
-
const
|
|
903
|
-
if (
|
|
904
|
-
const et =
|
|
902
|
+
const F = await oe.get(`${Q}/get-stickers`);
|
|
903
|
+
if (F.data && F.data.object && F.data.object.contents) {
|
|
904
|
+
const et = F.data.object.contents;
|
|
905
905
|
n(et), sessionStorage.setItem("apc_stickers", JSON.stringify(et));
|
|
906
906
|
} else
|
|
907
907
|
throw new Error("Invalid response format");
|
|
908
|
-
} catch (
|
|
909
|
-
console.error("Error fetching stickers:",
|
|
908
|
+
} catch (F) {
|
|
909
|
+
console.error("Error fetching stickers:", F), E("Failed to load stickers. Please try again.");
|
|
910
910
|
} finally {
|
|
911
|
-
|
|
911
|
+
C(!1);
|
|
912
912
|
}
|
|
913
|
-
}, M = (P,
|
|
913
|
+
}, M = (P, F) => {
|
|
914
914
|
a({
|
|
915
915
|
type: "sticker",
|
|
916
916
|
src: P,
|
|
917
|
-
name:
|
|
917
|
+
name: F,
|
|
918
918
|
width: 100,
|
|
919
919
|
height: 100,
|
|
920
920
|
x: 100,
|
|
921
921
|
y: 100
|
|
922
922
|
}), o();
|
|
923
923
|
}, nt = (P) => {
|
|
924
|
-
X((
|
|
925
|
-
...
|
|
926
|
-
[P]: !
|
|
924
|
+
X((F) => ({
|
|
925
|
+
...F,
|
|
926
|
+
[P]: !F[P]
|
|
927
927
|
}));
|
|
928
928
|
}, tt = (P) => {
|
|
929
|
-
const
|
|
929
|
+
const F = {};
|
|
930
930
|
return P.forEach((et) => {
|
|
931
931
|
const y = et.name.split("/");
|
|
932
|
-
let D =
|
|
933
|
-
y.forEach((L,
|
|
934
|
-
D[L] || (D[L] =
|
|
932
|
+
let D = F;
|
|
933
|
+
y.forEach((L, $) => {
|
|
934
|
+
D[L] || (D[L] = $ === y.length - 1 ? et : {}), D = D[L];
|
|
935
935
|
});
|
|
936
|
-
}),
|
|
937
|
-
}, ct = (P,
|
|
938
|
-
const D = `${
|
|
939
|
-
return P[y].type === "image" ? !
|
|
936
|
+
}), F;
|
|
937
|
+
}, ct = (P, F = "", et = 0) => /* @__PURE__ */ i.jsx("div", { className: "sticker-tree-level", style: { paddingLeft: `${et * 15}px` }, children: Object.keys(P).map((y) => {
|
|
938
|
+
const D = `${F}/${y}`, L = v[D];
|
|
939
|
+
return P[y].type === "image" ? !j || y.toLowerCase().includes(j.toLowerCase()) ? /* @__PURE__ */ i.jsx(
|
|
940
940
|
"div",
|
|
941
941
|
{
|
|
942
942
|
className: "sticker-item",
|
|
@@ -947,8 +947,8 @@ const Ut = {
|
|
|
947
947
|
src: P[y].url,
|
|
948
948
|
alt: y,
|
|
949
949
|
loading: "lazy",
|
|
950
|
-
onError: (
|
|
951
|
-
|
|
950
|
+
onError: (_) => {
|
|
951
|
+
_.target.style.display = "none";
|
|
952
952
|
}
|
|
953
953
|
}
|
|
954
954
|
) })
|
|
@@ -969,7 +969,7 @@ const Ut = {
|
|
|
969
969
|
L && ct(P[y], D, et + 1)
|
|
970
970
|
] }, D);
|
|
971
971
|
}) }), Y = h.filter(
|
|
972
|
-
(P) => !
|
|
972
|
+
(P) => !j || P.name.toLowerCase().includes(j.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: [
|
|
975
975
|
/* @__PURE__ */ i.jsxs("div", { className: "sticker-modal-header", children: [
|
|
@@ -986,14 +986,14 @@ 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 && k && /* @__PURE__ */ i.jsx(ii, { theme: l }),
|
|
990
|
+
T && k && /* @__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
|
{
|
|
994
994
|
type: "text",
|
|
995
995
|
placeholder: "Search stickers...",
|
|
996
|
-
value:
|
|
996
|
+
value: j,
|
|
997
997
|
onChange: (P) => p(P.target.value),
|
|
998
998
|
className: "sticker-search"
|
|
999
999
|
}
|
|
@@ -1007,7 +1007,7 @@ const Ut = {
|
|
|
1007
1007
|
] })
|
|
1008
1008
|
] })
|
|
1009
1009
|
] }) }) : null;
|
|
1010
|
-
},
|
|
1010
|
+
}, ri = [
|
|
1011
1011
|
// FLORAL DESIGNS (40 items)
|
|
1012
1012
|
{
|
|
1013
1013
|
id: 1,
|
|
@@ -2559,12 +2559,12 @@ const Ut = {
|
|
|
2559
2559
|
category: "Geometric",
|
|
2560
2560
|
description: "Complex mandala flower pattern"
|
|
2561
2561
|
}
|
|
2562
|
-
],
|
|
2563
|
-
const [h, n] = N([]), [c,
|
|
2562
|
+
], ai = ({ isOpen: f, onClose: o, onAddEmbroidery: a, theme: l, apiKey: s, apiEndpoint: g }) => {
|
|
2563
|
+
const [h, n] = N([]), [c, C] = N(!1), [I, E] = N(null), [u, B] = N(""), [j, p] = N("All"), v = gt(null), X = ["All", "Floral", "Nature", "Geometric", "Traditional", "Sports", "Hobbies", "Food", "Symbols", "Holiday", "Text"];
|
|
2564
2564
|
rt(() => {
|
|
2565
|
-
f && n(
|
|
2565
|
+
f && n(ri);
|
|
2566
2566
|
}, [f]);
|
|
2567
|
-
const
|
|
2567
|
+
const T = (k) => {
|
|
2568
2568
|
a({
|
|
2569
2569
|
type: "embroidery",
|
|
2570
2570
|
src: k.url,
|
|
@@ -2577,7 +2577,7 @@ const Ut = {
|
|
|
2577
2577
|
y: 100
|
|
2578
2578
|
}), o();
|
|
2579
2579
|
}, O = h.filter((k) => {
|
|
2580
|
-
const Z = !
|
|
2580
|
+
const Z = !u || k.name.toLowerCase().includes(u.toLowerCase()) || k.description.toLowerCase().includes(u.toLowerCase()), W = j === "All" || k.category === j;
|
|
2581
2581
|
return Z && W;
|
|
2582
2582
|
});
|
|
2583
2583
|
return f ? /* @__PURE__ */ i.jsx("div", { className: "embroidery-modal-overlay", onClick: o, children: /* @__PURE__ */ i.jsxs(
|
|
@@ -2605,7 +2605,7 @@ const Ut = {
|
|
|
2605
2605
|
{
|
|
2606
2606
|
type: "text",
|
|
2607
2607
|
placeholder: "Search embroidery designs...",
|
|
2608
|
-
value:
|
|
2608
|
+
value: u,
|
|
2609
2609
|
onChange: (k) => B(k.target.value),
|
|
2610
2610
|
className: "embroidery-search"
|
|
2611
2611
|
}
|
|
@@ -2615,7 +2615,7 @@ const Ut = {
|
|
|
2615
2615
|
/* @__PURE__ */ i.jsx(
|
|
2616
2616
|
"select",
|
|
2617
2617
|
{
|
|
2618
|
-
value:
|
|
2618
|
+
value: j,
|
|
2619
2619
|
onChange: (k) => p(k.target.value),
|
|
2620
2620
|
className: "category-select",
|
|
2621
2621
|
children: X.map((k) => /* @__PURE__ */ i.jsx("option", { value: k, children: k }, k))
|
|
@@ -2633,7 +2633,7 @@ const Ut = {
|
|
|
2633
2633
|
"div",
|
|
2634
2634
|
{
|
|
2635
2635
|
className: "embroidery-item",
|
|
2636
|
-
onClick: () =>
|
|
2636
|
+
onClick: () => T(k),
|
|
2637
2637
|
title: k.description,
|
|
2638
2638
|
children: [
|
|
2639
2639
|
/* @__PURE__ */ i.jsx("div", { className: "embroidery-preview", children: /* @__PURE__ */ i.jsx(
|
|
@@ -4601,19 +4601,19 @@ const Ut = {
|
|
|
4601
4601
|
fill: "#8B0000",
|
|
4602
4602
|
textAlign: "center"
|
|
4603
4603
|
}
|
|
4604
|
-
],
|
|
4604
|
+
], si = ({ isOpen: f, onClose: o, onAddText: a, theme: l }) => {
|
|
4605
4605
|
const [s, g] = N(""), [h, n] = N("All"), c = ie(() => {
|
|
4606
|
-
const
|
|
4606
|
+
const u = Nt.reduce((B, j) => (B[j.category] = (B[j.category] || 0) + 1, B), {});
|
|
4607
4607
|
return [
|
|
4608
4608
|
{ name: "All", count: Nt.length },
|
|
4609
|
-
...Object.entries(
|
|
4609
|
+
...Object.entries(u).map(([B, j]) => ({ name: B, count: j }))
|
|
4610
4610
|
];
|
|
4611
|
-
}, [Nt]),
|
|
4612
|
-
const B = !s ||
|
|
4613
|
-
return B &&
|
|
4614
|
-
}), [Nt, s, h]), I = (
|
|
4611
|
+
}, [Nt]), C = ie(() => Nt.filter((u) => {
|
|
4612
|
+
const B = !s || u.text.toLowerCase().includes(s.toLowerCase()) || u.category.toLowerCase().includes(s.toLowerCase()), j = h === "All" || u.category === h;
|
|
4613
|
+
return B && j;
|
|
4614
|
+
}), [Nt, s, h]), I = (u) => {
|
|
4615
4615
|
const B = {
|
|
4616
|
-
...
|
|
4616
|
+
...u,
|
|
4617
4617
|
x: 100,
|
|
4618
4618
|
y: 100
|
|
4619
4619
|
};
|
|
@@ -4628,7 +4628,7 @@ const Ut = {
|
|
|
4628
4628
|
y: 100
|
|
4629
4629
|
}), o();
|
|
4630
4630
|
};
|
|
4631
|
-
return f ? /* @__PURE__ */ i.jsx("div", { className: "text-templates-modal-overlay", onClick: o, children: /* @__PURE__ */ i.jsxs("div", { className: "text-templates-modal", onClick: (
|
|
4631
|
+
return f ? /* @__PURE__ */ i.jsx("div", { className: "text-templates-modal-overlay", onClick: o, children: /* @__PURE__ */ i.jsxs("div", { className: "text-templates-modal", onClick: (u) => u.stopPropagation(), children: [
|
|
4632
4632
|
/* @__PURE__ */ i.jsxs("div", { className: "modal-header", children: [
|
|
4633
4633
|
/* @__PURE__ */ i.jsx("h2", { children: "Text Templates" }),
|
|
4634
4634
|
/* @__PURE__ */ i.jsx("button", { className: "close-btn", onClick: o, "aria-label": "Close", children: "×" })
|
|
@@ -4640,25 +4640,25 @@ const Ut = {
|
|
|
4640
4640
|
type: "text",
|
|
4641
4641
|
placeholder: "Search templates...",
|
|
4642
4642
|
value: s,
|
|
4643
|
-
onChange: (
|
|
4643
|
+
onChange: (u) => g(u.target.value),
|
|
4644
4644
|
className: "search-input"
|
|
4645
4645
|
}
|
|
4646
4646
|
) }),
|
|
4647
|
-
/* @__PURE__ */ i.jsx("div", { className: "category-tabs", children: c.map((
|
|
4647
|
+
/* @__PURE__ */ i.jsx("div", { className: "category-tabs", children: c.map((u) => /* @__PURE__ */ i.jsxs(
|
|
4648
4648
|
"button",
|
|
4649
4649
|
{
|
|
4650
|
-
className: `category-tab ${h ===
|
|
4651
|
-
onClick: () => n(
|
|
4650
|
+
className: `category-tab ${h === u.name ? "active" : ""}`,
|
|
4651
|
+
onClick: () => n(u.name),
|
|
4652
4652
|
children: [
|
|
4653
|
-
|
|
4653
|
+
u.name,
|
|
4654
4654
|
/* @__PURE__ */ i.jsxs("span", { className: "count", children: [
|
|
4655
4655
|
"(",
|
|
4656
|
-
|
|
4656
|
+
u.count,
|
|
4657
4657
|
")"
|
|
4658
4658
|
] })
|
|
4659
4659
|
]
|
|
4660
4660
|
},
|
|
4661
|
-
|
|
4661
|
+
u.name
|
|
4662
4662
|
)) })
|
|
4663
4663
|
] }),
|
|
4664
4664
|
/* @__PURE__ */ i.jsxs("div", { className: "templates-grid", children: [
|
|
@@ -4666,48 +4666,48 @@ const Ut = {
|
|
|
4666
4666
|
/* @__PURE__ */ i.jsx("div", { className: "custom-icon", children: "✏️" }),
|
|
4667
4667
|
/* @__PURE__ */ i.jsx("div", { className: "custom-label", children: "Create Custom Text" })
|
|
4668
4668
|
] }) }),
|
|
4669
|
-
|
|
4669
|
+
C.map((u) => /* @__PURE__ */ i.jsxs(
|
|
4670
4670
|
"div",
|
|
4671
4671
|
{
|
|
4672
4672
|
className: "template-item",
|
|
4673
|
-
onClick: () => I(
|
|
4673
|
+
onClick: () => I(u),
|
|
4674
4674
|
children: [
|
|
4675
4675
|
/* @__PURE__ */ i.jsx(
|
|
4676
4676
|
"div",
|
|
4677
4677
|
{
|
|
4678
4678
|
className: "template-preview",
|
|
4679
4679
|
style: {
|
|
4680
|
-
fontFamily:
|
|
4681
|
-
fontSize: `${Math.min(
|
|
4682
|
-
fontWeight:
|
|
4683
|
-
fontStyle:
|
|
4684
|
-
color:
|
|
4685
|
-
backgroundColor:
|
|
4686
|
-
textAlign:
|
|
4687
|
-
textTransform:
|
|
4688
|
-
letterSpacing:
|
|
4689
|
-
textShadow:
|
|
4680
|
+
fontFamily: u.fontFamily,
|
|
4681
|
+
fontSize: `${Math.min(u.fontSize * 0.6, 18)}px`,
|
|
4682
|
+
fontWeight: u.fontWeight,
|
|
4683
|
+
fontStyle: u.fontStyle,
|
|
4684
|
+
color: u.fill,
|
|
4685
|
+
backgroundColor: u.hasBackground ? u.backgroundColor : "transparent",
|
|
4686
|
+
textAlign: u.textAlign || "left",
|
|
4687
|
+
textTransform: u.textTransform || "none",
|
|
4688
|
+
letterSpacing: u.letterSpacing ? `${u.letterSpacing}px` : "normal",
|
|
4689
|
+
textShadow: u.hasTextShadow ? `${u.textShadowX}px ${u.textShadowY}px ${u.textShadowBlur}px ${u.textShadowColor}` : "none"
|
|
4690
4690
|
},
|
|
4691
|
-
children:
|
|
4691
|
+
children: u.text
|
|
4692
4692
|
}
|
|
4693
4693
|
),
|
|
4694
4694
|
/* @__PURE__ */ i.jsxs("div", { className: "template-info", children: [
|
|
4695
|
-
/* @__PURE__ */ i.jsx("span", { className: "template-category", children:
|
|
4696
|
-
/* @__PURE__ */ i.jsx("span", { className: "template-font", children:
|
|
4695
|
+
/* @__PURE__ */ i.jsx("span", { className: "template-category", children: u.category }),
|
|
4696
|
+
/* @__PURE__ */ i.jsx("span", { className: "template-font", children: u.fontFamily })
|
|
4697
4697
|
] })
|
|
4698
4698
|
]
|
|
4699
4699
|
},
|
|
4700
|
-
|
|
4700
|
+
u.id
|
|
4701
4701
|
))
|
|
4702
4702
|
] }),
|
|
4703
4703
|
/* @__PURE__ */ i.jsx("div", { className: "modal-footer", children: /* @__PURE__ */ i.jsxs("div", { className: "results-count", children: [
|
|
4704
|
-
|
|
4704
|
+
C.length,
|
|
4705
4705
|
" template",
|
|
4706
|
-
|
|
4706
|
+
C.length !== 1 ? "s" : "",
|
|
4707
4707
|
" found"
|
|
4708
4708
|
] }) })
|
|
4709
4709
|
] }) }) : null;
|
|
4710
|
-
},
|
|
4710
|
+
}, li = ({
|
|
4711
4711
|
onAddElement: f,
|
|
4712
4712
|
onDeleteElement: o,
|
|
4713
4713
|
onDuplicateElement: a,
|
|
@@ -4717,21 +4717,21 @@ const Ut = {
|
|
|
4717
4717
|
onToggleRulers: h,
|
|
4718
4718
|
onToggleSnap: n,
|
|
4719
4719
|
onImageUpload: c,
|
|
4720
|
-
canUndo:
|
|
4720
|
+
canUndo: C,
|
|
4721
4721
|
canRedo: I,
|
|
4722
4722
|
showGrid: E,
|
|
4723
|
-
showRulers:
|
|
4723
|
+
showRulers: u,
|
|
4724
4724
|
snapToGrid: B,
|
|
4725
|
-
selectedElement:
|
|
4725
|
+
selectedElement: j,
|
|
4726
4726
|
theme: p,
|
|
4727
4727
|
readOnly: v,
|
|
4728
4728
|
apiKey: X,
|
|
4729
|
-
apiEndpoint:
|
|
4729
|
+
apiEndpoint: T
|
|
4730
4730
|
}) => {
|
|
4731
|
-
const [O, k] = N(!1), [Z, W] = N(!1), [xt, Q] = N(!1), [ft,
|
|
4731
|
+
const [O, k] = N(!1), [Z, W] = N(!1), [xt, Q] = N(!1), [ft, G] = N(!1), [st, M] = N(!1), [nt, tt] = N(!1), [ct, Y] = N(!1), P = (U) => {
|
|
4732
4732
|
const K = U.target.files[0];
|
|
4733
4733
|
K && K.type.startsWith("image/") && c(K), U.target.value = "";
|
|
4734
|
-
},
|
|
4734
|
+
}, F = (U) => {
|
|
4735
4735
|
f("icon", {
|
|
4736
4736
|
iconData: U,
|
|
4737
4737
|
text: U.symbol,
|
|
@@ -4747,9 +4747,9 @@ const Ut = {
|
|
|
4747
4747
|
f("sticker", U);
|
|
4748
4748
|
}, L = (U) => {
|
|
4749
4749
|
f("embroidery", U);
|
|
4750
|
-
},
|
|
4750
|
+
}, $ = (U, K) => {
|
|
4751
4751
|
f(U, K);
|
|
4752
|
-
},
|
|
4752
|
+
}, _ = () => {
|
|
4753
4753
|
tt(!nt), Y(!1);
|
|
4754
4754
|
}, it = () => {
|
|
4755
4755
|
Y(!ct), tt(!1);
|
|
@@ -4766,7 +4766,7 @@ const Ut = {
|
|
|
4766
4766
|
{
|
|
4767
4767
|
className: "toolbar-btn compact",
|
|
4768
4768
|
onClick: l,
|
|
4769
|
-
disabled: !
|
|
4769
|
+
disabled: !C || v,
|
|
4770
4770
|
title: "Undo (Ctrl+Z)",
|
|
4771
4771
|
children: [
|
|
4772
4772
|
/* @__PURE__ */ i.jsx("span", { className: "icon", children: "↶" }),
|
|
@@ -4797,7 +4797,7 @@ const Ut = {
|
|
|
4797
4797
|
className: "toolbar-btn compact dropdown-trigger",
|
|
4798
4798
|
disabled: v,
|
|
4799
4799
|
title: "Add Text",
|
|
4800
|
-
onClick:
|
|
4800
|
+
onClick: _,
|
|
4801
4801
|
children: [
|
|
4802
4802
|
/* @__PURE__ */ i.jsx("span", { className: "icon", children: "𝐓" }),
|
|
4803
4803
|
/* @__PURE__ */ i.jsx("span", { className: "label", children: "Text" }),
|
|
@@ -4896,7 +4896,7 @@ const Ut = {
|
|
|
4896
4896
|
)
|
|
4897
4897
|
] }),
|
|
4898
4898
|
/* @__PURE__ */ i.jsx("div", { className: "toolbar-separator" }),
|
|
4899
|
-
/* @__PURE__ */ i.jsx(
|
|
4899
|
+
/* @__PURE__ */ i.jsx(Ze, { onSelectIcon: F, theme: p, disabled: v }),
|
|
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: () => G(!0),
|
|
4947
4947
|
disabled: v,
|
|
4948
4948
|
title: "Add Embroidery Design",
|
|
4949
4949
|
children: [
|
|
@@ -4952,7 +4952,7 @@ const Ut = {
|
|
|
4952
4952
|
]
|
|
4953
4953
|
}
|
|
4954
4954
|
) }),
|
|
4955
|
-
|
|
4955
|
+
j && /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
|
|
4956
4956
|
/* @__PURE__ */ i.jsx("div", { className: "toolbar-separator" }),
|
|
4957
4957
|
/* @__PURE__ */ i.jsxs("div", { className: "toolbar-group", children: [
|
|
4958
4958
|
/* @__PURE__ */ i.jsxs(
|
|
@@ -5000,7 +5000,7 @@ const Ut = {
|
|
|
5000
5000
|
/* @__PURE__ */ i.jsxs(
|
|
5001
5001
|
"button",
|
|
5002
5002
|
{
|
|
5003
|
-
className: `toolbar-btn compact ${
|
|
5003
|
+
className: `toolbar-btn compact ${u ? "active" : ""}`,
|
|
5004
5004
|
onClick: h,
|
|
5005
5005
|
title: "Toggle Rulers",
|
|
5006
5006
|
children: [
|
|
@@ -5024,7 +5024,7 @@ const Ut = {
|
|
|
5024
5024
|
] })
|
|
5025
5025
|
] }),
|
|
5026
5026
|
/* @__PURE__ */ i.jsx(
|
|
5027
|
-
|
|
5027
|
+
ti,
|
|
5028
5028
|
{
|
|
5029
5029
|
isOpen: O,
|
|
5030
5030
|
onClose: () => k(!1),
|
|
@@ -5033,7 +5033,7 @@ const Ut = {
|
|
|
5033
5033
|
}
|
|
5034
5034
|
),
|
|
5035
5035
|
/* @__PURE__ */ i.jsx(
|
|
5036
|
-
|
|
5036
|
+
ei,
|
|
5037
5037
|
{
|
|
5038
5038
|
isOpen: Z,
|
|
5039
5039
|
onClose: () => W(!1),
|
|
@@ -5042,38 +5042,38 @@ const Ut = {
|
|
|
5042
5042
|
}
|
|
5043
5043
|
),
|
|
5044
5044
|
/* @__PURE__ */ i.jsx(
|
|
5045
|
-
|
|
5045
|
+
oi,
|
|
5046
5046
|
{
|
|
5047
5047
|
isOpen: xt,
|
|
5048
5048
|
onClose: () => Q(!1),
|
|
5049
5049
|
onAddSticker: D,
|
|
5050
5050
|
theme: p,
|
|
5051
5051
|
apiKey: X,
|
|
5052
|
-
apiEndpoint:
|
|
5052
|
+
apiEndpoint: T
|
|
5053
5053
|
}
|
|
5054
5054
|
),
|
|
5055
5055
|
/* @__PURE__ */ i.jsx(
|
|
5056
|
-
|
|
5056
|
+
ai,
|
|
5057
5057
|
{
|
|
5058
5058
|
isOpen: ft,
|
|
5059
|
-
onClose: () =>
|
|
5059
|
+
onClose: () => G(!1),
|
|
5060
5060
|
onAddEmbroidery: L,
|
|
5061
5061
|
theme: p,
|
|
5062
5062
|
apiKey: X,
|
|
5063
|
-
apiEndpoint:
|
|
5063
|
+
apiEndpoint: T
|
|
5064
5064
|
}
|
|
5065
5065
|
),
|
|
5066
5066
|
/* @__PURE__ */ i.jsx(
|
|
5067
|
-
|
|
5067
|
+
si,
|
|
5068
5068
|
{
|
|
5069
5069
|
isOpen: st,
|
|
5070
5070
|
onClose: () => M(!1),
|
|
5071
|
-
onAddText:
|
|
5071
|
+
onAddText: $,
|
|
5072
5072
|
theme: p
|
|
5073
5073
|
}
|
|
5074
5074
|
)
|
|
5075
5075
|
] });
|
|
5076
|
-
},
|
|
5076
|
+
}, ni = ({
|
|
5077
5077
|
selectedElement: f,
|
|
5078
5078
|
onUpdate: o,
|
|
5079
5079
|
onMoveLayer: a,
|
|
@@ -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: (p = f.textDecoration) != null && p.includes("underline") ? "active" : "",
|
|
5195
5195
|
onClick: () => {
|
|
5196
|
-
const
|
|
5197
|
-
|
|
5196
|
+
const T = f.textDecoration || "", O = T.split(" ").filter((k) => k && k !== "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: (v = f.textDecoration) != null && v.includes("overline") ? "active" : "",
|
|
5207
5207
|
onClick: () => {
|
|
5208
|
-
const
|
|
5209
|
-
|
|
5208
|
+
const T = f.textDecoration || "", O = T.split(" ").filter((k) => k && k !== "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: (X = f.textDecoration) != null && X.includes("line-through") ? "active" : "",
|
|
5219
5219
|
onClick: () => {
|
|
5220
|
-
const
|
|
5221
|
-
|
|
5220
|
+
const T = f.textDecoration || "", O = T.split(" ").filter((k) => k && k !== "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
|
|
@@ -5552,7 +5552,7 @@ const Ut = {
|
|
|
5552
5552
|
] })
|
|
5553
5553
|
] })
|
|
5554
5554
|
] });
|
|
5555
|
-
},
|
|
5555
|
+
}, C = () => /* @__PURE__ */ i.jsxs("div", { className: "property-group", children: [
|
|
5556
5556
|
/* @__PURE__ */ i.jsx("h4", { children: "Shape Properties" }),
|
|
5557
5557
|
/* @__PURE__ */ i.jsxs("div", { className: "property-row", children: [
|
|
5558
5558
|
/* @__PURE__ */ i.jsx("label", { children: "Fill Color" }),
|
|
@@ -5717,7 +5717,7 @@ const Ut = {
|
|
|
5717
5717
|
"°"
|
|
5718
5718
|
] })
|
|
5719
5719
|
] })
|
|
5720
|
-
] }),
|
|
5720
|
+
] }), u = () => /* @__PURE__ */ i.jsxs("div", { className: "property-group", children: [
|
|
5721
5721
|
/* @__PURE__ */ i.jsx("h4", { children: "Line Properties" }),
|
|
5722
5722
|
/* @__PURE__ */ i.jsxs("div", { className: "property-row", children: [
|
|
5723
5723
|
/* @__PURE__ */ i.jsxs("div", { className: "input-group", children: [
|
|
@@ -5784,7 +5784,7 @@ const Ut = {
|
|
|
5784
5784
|
/* @__PURE__ */ i.jsx("button", { onClick: () => a(f.id, "down"), children: "Send Backward" }),
|
|
5785
5785
|
/* @__PURE__ */ i.jsx("button", { onClick: () => a(f.id, "bottom"), children: "Send to Back" })
|
|
5786
5786
|
] })
|
|
5787
|
-
] }),
|
|
5787
|
+
] }), j = [
|
|
5788
5788
|
"rectangle",
|
|
5789
5789
|
"circle",
|
|
5790
5790
|
"triangle",
|
|
@@ -5804,9 +5804,9 @@ const Ut = {
|
|
|
5804
5804
|
] }),
|
|
5805
5805
|
/* @__PURE__ */ i.jsxs("div", { className: "panel-content", children: [
|
|
5806
5806
|
f.type === "text" && c(),
|
|
5807
|
-
|
|
5807
|
+
j.includes(f.type) && C(),
|
|
5808
5808
|
f.type === "image" && I(),
|
|
5809
|
-
f.type === "horizontalLine" &&
|
|
5809
|
+
f.type === "horizontalLine" && u(),
|
|
5810
5810
|
E(),
|
|
5811
5811
|
B(),
|
|
5812
5812
|
/* @__PURE__ */ i.jsx("div", { className: "property-group", children: /* @__PURE__ */ i.jsxs(
|
|
@@ -5822,7 +5822,7 @@ const Ut = {
|
|
|
5822
5822
|
) })
|
|
5823
5823
|
] })
|
|
5824
5824
|
] });
|
|
5825
|
-
},
|
|
5825
|
+
}, ci = ({
|
|
5826
5826
|
elements: f,
|
|
5827
5827
|
selectedElement: o,
|
|
5828
5828
|
onSelectElement: a,
|
|
@@ -5830,7 +5830,7 @@ const Ut = {
|
|
|
5830
5830
|
onDeleteElement: s,
|
|
5831
5831
|
theme: g
|
|
5832
5832
|
}) => {
|
|
5833
|
-
const h = (c,
|
|
5833
|
+
const h = (c, C) => {
|
|
5834
5834
|
switch (c) {
|
|
5835
5835
|
case "text":
|
|
5836
5836
|
return "T";
|
|
@@ -5872,14 +5872,14 @@ const Ut = {
|
|
|
5872
5872
|
return "?";
|
|
5873
5873
|
}
|
|
5874
5874
|
}, n = (c) => {
|
|
5875
|
-
var
|
|
5875
|
+
var C, I;
|
|
5876
5876
|
if (c.type === "text")
|
|
5877
|
-
return c.isIcon && c.iconData ? `Icon: ${c.iconData.name}` : ((
|
|
5877
|
+
return c.isIcon && c.iconData ? `Icon: ${c.iconData.name}` : ((C = c.text) == null ? void 0 : C.substring(0, 20)) + (((I = c.text) == null ? void 0 : I.length) > 20 ? "..." : "") || "Text";
|
|
5878
5878
|
if (c.type === "qrcode")
|
|
5879
5879
|
return `QR Code: ${(c.data || "").substring(0, 15) + ((c.data || "").length > 15 ? "..." : "")}`;
|
|
5880
5880
|
if (c.type === "barcode") {
|
|
5881
|
-
const E = c.format || "CODE128",
|
|
5882
|
-
return `Barcode (${E}): ${
|
|
5881
|
+
const E = c.format || "CODE128", u = c.data || "";
|
|
5882
|
+
return `Barcode (${E}): ${u.substring(0, 10) + (u.length > 10 ? "..." : "")}`;
|
|
5883
5883
|
}
|
|
5884
5884
|
return c.type === "sticker" ? `Sticker: ${(c.name || "Untitled").substring(0, 15)}` : c.type === "embroidery" ? `Embroidery: ${(c.name || "Design").substring(0, 15)}` : c.type.charAt(0).toUpperCase() + c.type.slice(1);
|
|
5885
5885
|
};
|
|
@@ -5888,7 +5888,7 @@ const Ut = {
|
|
|
5888
5888
|
/* @__PURE__ */ i.jsx("h3", { children: "Layers" }),
|
|
5889
5889
|
/* @__PURE__ */ i.jsx("span", { className: "layer-count", children: f.length })
|
|
5890
5890
|
] }),
|
|
5891
|
-
/* @__PURE__ */ i.jsx("div", { className: "layers-list", children: f.length === 0 ? /* @__PURE__ */ i.jsx("div", { className: "no-layers", children: "No elements added yet" }) : [...f].reverse().map((c,
|
|
5891
|
+
/* @__PURE__ */ i.jsx("div", { className: "layers-list", children: f.length === 0 ? /* @__PURE__ */ i.jsx("div", { className: "no-layers", children: "No elements added yet" }) : [...f].reverse().map((c, C) => /* @__PURE__ */ i.jsxs(
|
|
5892
5892
|
"div",
|
|
5893
5893
|
{
|
|
5894
5894
|
className: `layer-item ${(o == null ? void 0 : o.id) === c.id ? "selected" : ""}`,
|
|
@@ -5906,7 +5906,7 @@ const Ut = {
|
|
|
5906
5906
|
onClick: (I) => {
|
|
5907
5907
|
I.stopPropagation(), l(c.id, "up");
|
|
5908
5908
|
},
|
|
5909
|
-
disabled:
|
|
5909
|
+
disabled: C === 0,
|
|
5910
5910
|
title: "Move Up",
|
|
5911
5911
|
children: "↑"
|
|
5912
5912
|
}
|
|
@@ -5918,7 +5918,7 @@ const Ut = {
|
|
|
5918
5918
|
onClick: (I) => {
|
|
5919
5919
|
I.stopPropagation(), l(c.id, "down");
|
|
5920
5920
|
},
|
|
5921
|
-
disabled:
|
|
5921
|
+
disabled: C === f.length - 1,
|
|
5922
5922
|
title: "Move Down",
|
|
5923
5923
|
children: "↓"
|
|
5924
5924
|
}
|
|
@@ -5941,36 +5941,36 @@ const Ut = {
|
|
|
5941
5941
|
)) })
|
|
5942
5942
|
] });
|
|
5943
5943
|
};
|
|
5944
|
-
class
|
|
5944
|
+
class di {
|
|
5945
5945
|
constructor() {
|
|
5946
5946
|
this.canvas = document.createElement("canvas"), this.ctx = this.canvas.getContext("2d");
|
|
5947
5947
|
}
|
|
5948
5948
|
// Add this method to the ExportManager class
|
|
5949
5949
|
async exportAllSections(o, a, l, s, g = "png", h = !0, n = null) {
|
|
5950
5950
|
const c = {};
|
|
5951
|
-
for (const
|
|
5952
|
-
const I =
|
|
5951
|
+
for (const C of a) {
|
|
5952
|
+
const I = C.id || C.sectionName, E = o[I];
|
|
5953
5953
|
if (!E || !E.elements || E.elements.length === 0) {
|
|
5954
5954
|
console.log(`Skipping section ${I} - no elements`);
|
|
5955
5955
|
continue;
|
|
5956
5956
|
}
|
|
5957
5957
|
if (this.canvas.width = l, this.canvas.height = s, this.ctx.clearRect(0, 0, l, s), h) {
|
|
5958
|
-
let B =
|
|
5959
|
-
if (n && n.sectionImage && (
|
|
5958
|
+
let B = C.image || C.sectionImage;
|
|
5959
|
+
if (n && n.sectionImage && (C.sectionName === "Front" || n.sections && Object.keys(n.sections).includes(C.sectionName)) && (B = n.sectionImage), B)
|
|
5960
5960
|
try {
|
|
5961
|
-
const
|
|
5962
|
-
await this.processImageColor(
|
|
5963
|
-
} catch (
|
|
5964
|
-
console.warn("Failed to load background image:",
|
|
5961
|
+
const j = await this.loadImage(B);
|
|
5962
|
+
await this.processImageColor(j, E.selectedColor || "#FFFFFF"), this.ctx.drawImage(this.processedImage, 0, 0, l, s);
|
|
5963
|
+
} catch (j) {
|
|
5964
|
+
console.warn("Failed to load background image:", j);
|
|
5965
5965
|
}
|
|
5966
5966
|
} else
|
|
5967
5967
|
this.ctx.clearRect(0, 0, l, s);
|
|
5968
5968
|
for (const B of E.elements)
|
|
5969
5969
|
await this.drawElement(B);
|
|
5970
|
-
const
|
|
5970
|
+
const u = this.canvas.toDataURL(`image/${g}`, g === "jpeg" ? 0.9 : void 0);
|
|
5971
5971
|
c[I] = {
|
|
5972
|
-
dataUrl:
|
|
5973
|
-
blob: await this.dataUrlToBlob(
|
|
5972
|
+
dataUrl: u,
|
|
5973
|
+
blob: await this.dataUrlToBlob(u)
|
|
5974
5974
|
};
|
|
5975
5975
|
}
|
|
5976
5976
|
return c;
|
|
@@ -6010,11 +6010,11 @@ class ci {
|
|
|
6010
6010
|
console.warn("Invalid target color:", a);
|
|
6011
6011
|
return;
|
|
6012
6012
|
}
|
|
6013
|
-
const { r: c, g:
|
|
6013
|
+
const { r: c, g: C, b: I } = n;
|
|
6014
6014
|
for (let E = 0; E < h.length; E += 4) {
|
|
6015
6015
|
if (h[E + 3] === 0) continue;
|
|
6016
6016
|
const B = this.getLuma(h[E], h[E + 1], h[E + 2]);
|
|
6017
|
-
h[E] = Math.round(c * B), h[E + 1] = Math.round(
|
|
6017
|
+
h[E] = Math.round(c * B), h[E + 1] = Math.round(C * B), h[E + 2] = Math.round(I * B);
|
|
6018
6018
|
}
|
|
6019
6019
|
return s.putImageData(g, 0, 0), this.processedImage = new Image(), new Promise((E) => {
|
|
6020
6020
|
this.processedImage.onload = () => {
|
|
@@ -6109,7 +6109,7 @@ class ci {
|
|
|
6109
6109
|
const a = o.width / 2, l = o.height / 2, s = Math.min(o.width, o.height) / 2, g = s * 0.4, h = o.numPoints || 5;
|
|
6110
6110
|
this.ctx.beginPath();
|
|
6111
6111
|
for (let n = 0; n < h * 2; n++) {
|
|
6112
|
-
const c = n % 2 === 0 ? s : g,
|
|
6112
|
+
const c = n % 2 === 0 ? s : g, C = n * Math.PI / h, I = a + Math.cos(C) * c, E = l + Math.sin(C) * c;
|
|
6113
6113
|
n === 0 ? this.ctx.moveTo(I, E) : this.ctx.lineTo(I, E);
|
|
6114
6114
|
}
|
|
6115
6115
|
this.ctx.closePath(), o.fill && o.fill !== "transparent" && (this.ctx.fillStyle = o.fill, this.ctx.fill()), o.stroke && o.strokeWidth > 0 && (this.ctx.strokeStyle = o.stroke, this.ctx.lineWidth = o.strokeWidth, this.ctx.stroke());
|
|
@@ -6143,8 +6143,8 @@ class ci {
|
|
|
6143
6143
|
const a = o.width / 2, l = o.height / 2, s = Math.min(o.width, o.height) / 2, g = 6;
|
|
6144
6144
|
this.ctx.beginPath();
|
|
6145
6145
|
for (let h = 0; h < g; h++) {
|
|
6146
|
-
const n = h * 2 * Math.PI / g - Math.PI / 2, c = a + s * Math.cos(n),
|
|
6147
|
-
h === 0 ? this.ctx.moveTo(c,
|
|
6146
|
+
const n = h * 2 * Math.PI / g - Math.PI / 2, c = a + s * Math.cos(n), C = l + s * Math.sin(n);
|
|
6147
|
+
h === 0 ? this.ctx.moveTo(c, C) : this.ctx.lineTo(c, C);
|
|
6148
6148
|
}
|
|
6149
6149
|
this.ctx.closePath(), o.fill && o.fill !== "transparent" && (this.ctx.fillStyle = o.fill, this.ctx.fill()), o.stroke && o.strokeWidth > 0 && (this.ctx.strokeStyle = o.stroke, this.ctx.lineWidth = o.strokeWidth, this.ctx.stroke());
|
|
6150
6150
|
}
|
|
@@ -6152,8 +6152,8 @@ class ci {
|
|
|
6152
6152
|
const a = o.width / 2, l = o.height / 2, s = Math.min(o.width, o.height) / 2, g = 5;
|
|
6153
6153
|
this.ctx.beginPath();
|
|
6154
6154
|
for (let h = 0; h < g; h++) {
|
|
6155
|
-
const n = h * 2 * Math.PI / g - Math.PI / 2, c = a + s * Math.cos(n),
|
|
6156
|
-
h === 0 ? this.ctx.moveTo(c,
|
|
6155
|
+
const n = h * 2 * Math.PI / g - Math.PI / 2, c = a + s * Math.cos(n), C = l + s * Math.sin(n);
|
|
6156
|
+
h === 0 ? this.ctx.moveTo(c, C) : this.ctx.lineTo(c, C);
|
|
6157
6157
|
}
|
|
6158
6158
|
this.ctx.closePath(), o.fill && o.fill !== "transparent" && (this.ctx.fillStyle = o.fill, this.ctx.fill()), o.stroke && o.strokeWidth > 0 && (this.ctx.strokeStyle = o.stroke, this.ctx.lineWidth = o.strokeWidth, this.ctx.stroke());
|
|
6159
6159
|
}
|
|
@@ -6322,17 +6322,17 @@ class ci {
|
|
|
6322
6322
|
}
|
|
6323
6323
|
// Export all sections as JSON with File objects
|
|
6324
6324
|
async exportAllSectionsAsJSON(o, a, l, s, g = "png", h = null) {
|
|
6325
|
-
var
|
|
6326
|
-
const n = [], c = [],
|
|
6327
|
-
for (const
|
|
6328
|
-
const p =
|
|
6325
|
+
var u, B;
|
|
6326
|
+
const n = [], c = [], C = {};
|
|
6327
|
+
for (const j of a) {
|
|
6328
|
+
const p = j.sectionName, v = o[p];
|
|
6329
6329
|
if (!v || !v.elements || v.elements.length === 0) {
|
|
6330
6330
|
console.log(`Skipping section ${p} - no elements`);
|
|
6331
6331
|
continue;
|
|
6332
6332
|
}
|
|
6333
|
-
let X =
|
|
6334
|
-
h && h.sectionImage && (
|
|
6335
|
-
const
|
|
6333
|
+
let X = j.image || j.sectionImage;
|
|
6334
|
+
h && h.sectionImage && (j.sectionName === "Front" || h.sections && Object.keys(h.sections).includes(j.sectionName)) && (X = h.sectionImage);
|
|
6335
|
+
const T = {
|
|
6336
6336
|
...v,
|
|
6337
6337
|
// Include background information using the determined image
|
|
6338
6338
|
backgroundImage: X,
|
|
@@ -6344,10 +6344,10 @@ class ci {
|
|
|
6344
6344
|
canvasWidth: l,
|
|
6345
6345
|
canvasHeight: s
|
|
6346
6346
|
};
|
|
6347
|
-
|
|
6347
|
+
C[p] = T;
|
|
6348
6348
|
const O = await this.exportSectionAsBlob(
|
|
6349
6349
|
v,
|
|
6350
|
-
|
|
6350
|
+
j,
|
|
6351
6351
|
l,
|
|
6352
6352
|
s,
|
|
6353
6353
|
g,
|
|
@@ -6368,7 +6368,7 @@ class ci {
|
|
|
6368
6368
|
}
|
|
6369
6369
|
const k = await this.exportSectionAsBlob(
|
|
6370
6370
|
v,
|
|
6371
|
-
|
|
6371
|
+
j,
|
|
6372
6372
|
l,
|
|
6373
6373
|
s,
|
|
6374
6374
|
g,
|
|
@@ -6388,13 +6388,13 @@ class ci {
|
|
|
6388
6388
|
});
|
|
6389
6389
|
}
|
|
6390
6390
|
}
|
|
6391
|
-
let I = ((
|
|
6391
|
+
let I = ((u = a[0]) == null ? void 0 : u.image) || ((B = a[0]) == null ? void 0 : B.sectionImage);
|
|
6392
6392
|
if (h && h.sectionImage) {
|
|
6393
|
-
const
|
|
6394
|
-
|
|
6393
|
+
const j = a[0];
|
|
6394
|
+
j && (j.sectionName === "Front" || h.sections && Object.keys(h.sections).includes(j.sectionName)) && (I = h.sectionImage);
|
|
6395
6395
|
}
|
|
6396
6396
|
const E = {
|
|
6397
|
-
sections:
|
|
6397
|
+
sections: C,
|
|
6398
6398
|
canvasWidth: l,
|
|
6399
6399
|
canvasHeight: s,
|
|
6400
6400
|
sectionImage: I,
|
|
@@ -6410,10 +6410,10 @@ class ci {
|
|
|
6410
6410
|
},
|
|
6411
6411
|
// Include product information for complete context
|
|
6412
6412
|
product: {
|
|
6413
|
-
sections: a.map((
|
|
6414
|
-
sectionName:
|
|
6415
|
-
sectionImage:
|
|
6416
|
-
id:
|
|
6413
|
+
sections: a.map((j) => ({
|
|
6414
|
+
sectionName: j.sectionName || j.id,
|
|
6415
|
+
sectionImage: j.image || j.sectionImage,
|
|
6416
|
+
id: j.id || j.sectionName
|
|
6417
6417
|
}))
|
|
6418
6418
|
}
|
|
6419
6419
|
};
|
|
@@ -6430,10 +6430,10 @@ class ci {
|
|
|
6430
6430
|
let c = a.image || a.sectionImage;
|
|
6431
6431
|
if (n && n.sectionImage && (a.sectionName === "Front" || n.sections && Object.keys(n.sections).includes(a.sectionName)) && (c = n.sectionImage), c)
|
|
6432
6432
|
try {
|
|
6433
|
-
const
|
|
6434
|
-
await this.processImageColor(
|
|
6435
|
-
} catch (
|
|
6436
|
-
console.warn("Failed to load background image:",
|
|
6433
|
+
const C = await this.loadImage(c);
|
|
6434
|
+
await this.processImageColor(C, o.selectedColor || "#FFFFFF"), this.ctx.drawImage(this.processedImage, 0, 0, l, s);
|
|
6435
|
+
} catch (C) {
|
|
6436
|
+
console.warn("Failed to load background image:", C);
|
|
6437
6437
|
}
|
|
6438
6438
|
} else
|
|
6439
6439
|
this.ctx.clearRect(0, 0, l, s);
|
|
@@ -6447,9 +6447,9 @@ class ci {
|
|
|
6447
6447
|
}
|
|
6448
6448
|
}
|
|
6449
6449
|
async exportCurrentSectionAsJSON(o, a = "png", l = null) {
|
|
6450
|
-
var B,
|
|
6450
|
+
var B, j, p;
|
|
6451
6451
|
const s = ((B = o.activeSection) == null ? void 0 : B.sectionName) || "main";
|
|
6452
|
-
let g = ((
|
|
6452
|
+
let g = ((j = o.activeSection) == null ? void 0 : j.sectionImage) || ((p = o.activeSection) == null ? void 0 : p.image);
|
|
6453
6453
|
l && l.sectionImage && (s === "Front" || l.sections && Object.keys(l.sections).includes(s)) && (g = l.sectionImage);
|
|
6454
6454
|
const h = {
|
|
6455
6455
|
elements: o.elements,
|
|
@@ -6468,7 +6468,7 @@ class ci {
|
|
|
6468
6468
|
sectionName: s,
|
|
6469
6469
|
image: g,
|
|
6470
6470
|
sectionImage: g
|
|
6471
|
-
}, c = [],
|
|
6471
|
+
}, c = [], C = [], I = await this.exportSectionAsBlob(
|
|
6472
6472
|
h,
|
|
6473
6473
|
n,
|
|
6474
6474
|
o.canvasWidth,
|
|
@@ -6505,12 +6505,12 @@ class ci {
|
|
|
6505
6505
|
`${s}-print.${a}`,
|
|
6506
6506
|
`image/${a}`
|
|
6507
6507
|
);
|
|
6508
|
-
|
|
6508
|
+
C.push({
|
|
6509
6509
|
sectionName: s,
|
|
6510
6510
|
sectionImage: v
|
|
6511
6511
|
});
|
|
6512
6512
|
}
|
|
6513
|
-
const
|
|
6513
|
+
const u = {
|
|
6514
6514
|
sections: { [s]: h },
|
|
6515
6515
|
canvasWidth: o.canvasWidth,
|
|
6516
6516
|
canvasHeight: o.canvasHeight,
|
|
@@ -6538,12 +6538,12 @@ class ci {
|
|
|
6538
6538
|
};
|
|
6539
6539
|
return {
|
|
6540
6540
|
fullDesign: c,
|
|
6541
|
-
printReady:
|
|
6542
|
-
designFile: JSON.stringify(
|
|
6541
|
+
printReady: C,
|
|
6542
|
+
designFile: JSON.stringify(u)
|
|
6543
6543
|
};
|
|
6544
6544
|
}
|
|
6545
6545
|
}
|
|
6546
|
-
class
|
|
6546
|
+
class fi {
|
|
6547
6547
|
constructor(o = "localStorage") {
|
|
6548
6548
|
this.storage = o === "sessionStorage" ? sessionStorage : localStorage, this.STORAGE_PREFIX = "mypixia_canvas_", this.DESIGNS_LIST_KEY = "mypixia_saved_designs";
|
|
6549
6549
|
}
|
|
@@ -6733,7 +6733,7 @@ class di {
|
|
|
6733
6733
|
return "Unknown";
|
|
6734
6734
|
}
|
|
6735
6735
|
}
|
|
6736
|
-
const
|
|
6736
|
+
const hi = He((f, o) => {
|
|
6737
6737
|
const {
|
|
6738
6738
|
theme: a = {
|
|
6739
6739
|
primaryColor: "#000000",
|
|
@@ -6764,19 +6764,19 @@ const fi = $e((f, o) => {
|
|
|
6764
6764
|
]
|
|
6765
6765
|
},
|
|
6766
6766
|
initFile: g
|
|
6767
|
-
} = f, [h, n] = N([]), [c,
|
|
6767
|
+
} = f, [h, n] = N([]), [c, C] = N(null), [I, E] = N(!1), [u, B] = N(!1), [j, p] = N(!1), [v, X] = N({ x: 0, y: 0 }), [T, O] = N(null), [k, Z] = N(800), [W, xt] = N(600), [Q, ft] = N(1), [G, st] = N(s.colorSettings[0]), [M, nt] = N(!1), [tt, ct] = N(!0), [Y, P] = N(!0), [F, et] = N(s.sections[0]), [y, D] = N(!1), [L, $] = N({}), [_, it] = N([]), [J, q] = N(-1), [U] = N(new fi("localStorage")), K = gt(null), kt = gt(null), pt = gt(null), wt = gt(null), Ot = gt(null), Bt = gt(new di()), zt = gt(!1), [yt, ce] = N(null), lt = at(() => {
|
|
6768
6768
|
const e = {
|
|
6769
6769
|
elements: JSON.parse(JSON.stringify(h)),
|
|
6770
6770
|
selectedElement: c ? { ...c } : null,
|
|
6771
6771
|
timestamp: Date.now()
|
|
6772
|
-
}, t =
|
|
6772
|
+
}, t = _.slice(0, J + 1);
|
|
6773
6773
|
t.push(e), t.length > 50 ? t.shift() : q(J + 1), it(t);
|
|
6774
|
-
}, [h, c,
|
|
6774
|
+
}, [h, c, _, J]), St = at(() => ({
|
|
6775
6775
|
elements: h,
|
|
6776
6776
|
canvasWidth: k,
|
|
6777
6777
|
canvasHeight: W,
|
|
6778
|
-
selectedColor:
|
|
6779
|
-
activeSection:
|
|
6778
|
+
selectedColor: G,
|
|
6779
|
+
activeSection: F,
|
|
6780
6780
|
product: s,
|
|
6781
6781
|
sectionDesigns: L,
|
|
6782
6782
|
zoomLevel: Q,
|
|
@@ -6785,21 +6785,21 @@ const fi = $e((f, o) => {
|
|
|
6785
6785
|
selectedElement: c ? { ...c } : null,
|
|
6786
6786
|
canvasRef: K
|
|
6787
6787
|
// Include reference for thumbnail generation
|
|
6788
|
-
}), [h, k, W,
|
|
6788
|
+
}), [h, k, W, G, F, s, L, Q, M, Y, c]);
|
|
6789
6789
|
rt(() => {
|
|
6790
6790
|
const t = setTimeout(async () => {
|
|
6791
|
-
if (h.length === 0 &&
|
|
6791
|
+
if (h.length === 0 && _.length <= 1) {
|
|
6792
6792
|
if (g)
|
|
6793
6793
|
try {
|
|
6794
6794
|
const A = await fetch(g);
|
|
6795
6795
|
if (A.ok) {
|
|
6796
6796
|
const z = await A.text();
|
|
6797
6797
|
if (z.trim()) {
|
|
6798
|
-
const
|
|
6799
|
-
if (console.log("Loading design from file:",
|
|
6800
|
-
const dt = Object.keys(
|
|
6798
|
+
const H = JSON.parse(z.trim());
|
|
6799
|
+
if (console.log("Loading design from file:", H), ce(H), H.sections && typeof H.sections == "object") {
|
|
6800
|
+
const dt = Object.keys(H.sections)[0], ot = H.sections[dt];
|
|
6801
6801
|
if (ot && ot.elements) {
|
|
6802
|
-
n(ot.elements || []), Z(ot.canvasWidth || 800), xt(ot.canvasHeight || 600), st(ot.selectedColor || s.colorSettings[0]), ft(ot.zoomLevel || 1), nt(ot.showGrid || !1), P(ot.snapToGrid || !0),
|
|
6802
|
+
n(ot.elements || []), Z(ot.canvasWidth || 800), xt(ot.canvasHeight || 600), st(ot.selectedColor || s.colorSettings[0]), ft(ot.zoomLevel || 1), nt(ot.showGrid || !1), P(ot.snapToGrid || !0), C(null), H.sections && $(H.sections);
|
|
6803
6803
|
const Rt = s.sections.find((Dt) => Dt.sectionName === dt);
|
|
6804
6804
|
Rt && et(Rt), it([]), q(-1), setTimeout(() => {
|
|
6805
6805
|
lt();
|
|
@@ -6837,7 +6837,7 @@ const fi = $e((f, o) => {
|
|
|
6837
6837
|
rotation: 0,
|
|
6838
6838
|
opacity: 1
|
|
6839
6839
|
};
|
|
6840
|
-
n([R]),
|
|
6840
|
+
n([R]), C(R), setTimeout(() => {
|
|
6841
6841
|
lt();
|
|
6842
6842
|
}, 100);
|
|
6843
6843
|
}
|
|
@@ -6847,12 +6847,12 @@ const fi = $e((f, o) => {
|
|
|
6847
6847
|
const Wt = at((e = "png", t = !0) => {
|
|
6848
6848
|
const r = St();
|
|
6849
6849
|
return s.sections, Bt.current.exportAllSections(
|
|
6850
|
-
{ [(
|
|
6850
|
+
{ [(F == null ? void 0 : F.sectionName) || "main"]: r },
|
|
6851
6851
|
[{
|
|
6852
|
-
id: (
|
|
6853
|
-
sectionName: (
|
|
6854
|
-
image:
|
|
6855
|
-
sectionImage:
|
|
6852
|
+
id: (F == null ? void 0 : F.sectionName) || "main",
|
|
6853
|
+
sectionName: (F == null ? void 0 : F.sectionName) || "main",
|
|
6854
|
+
image: F == null ? void 0 : F.sectionImage,
|
|
6855
|
+
sectionImage: F == null ? void 0 : F.sectionImage
|
|
6856
6856
|
}],
|
|
6857
6857
|
k,
|
|
6858
6858
|
W,
|
|
@@ -6860,7 +6860,7 @@ const fi = $e((f, o) => {
|
|
|
6860
6860
|
t,
|
|
6861
6861
|
yt
|
|
6862
6862
|
);
|
|
6863
|
-
}, [St, s.sections,
|
|
6863
|
+
}, [St, s.sections, F, k, W]), de = [
|
|
6864
6864
|
"Arial",
|
|
6865
6865
|
"Helvetica",
|
|
6866
6866
|
"Times New Roman",
|
|
@@ -6884,10 +6884,10 @@ const fi = $e((f, o) => {
|
|
|
6884
6884
|
const e = document.createElement("canvas");
|
|
6885
6885
|
e.width = k, e.height = W, Ot.current = e;
|
|
6886
6886
|
}, [k, W]), rt(() => {
|
|
6887
|
-
|
|
6887
|
+
_.length === 0 && lt();
|
|
6888
6888
|
}, []);
|
|
6889
|
-
const At = (e, t, r, d, x,
|
|
6890
|
-
e.beginPath(), e.moveTo(t +
|
|
6889
|
+
const At = (e, t, r, d, x, m) => {
|
|
6890
|
+
e.beginPath(), e.moveTo(t + m, r), e.lineTo(t + d - m, r), e.quadraticCurveTo(t + d, r, t + d, r + m), e.lineTo(t + d, r + x - m), e.quadraticCurveTo(t + d, r + x, t + d - m, r + x), e.lineTo(t + m, r + x), e.quadraticCurveTo(t, r + x, t, r + x - m), e.lineTo(t, r + m), e.quadraticCurveTo(t, r, t + m, r), e.closePath();
|
|
6891
6891
|
}, Qt = (e, t) => {
|
|
6892
6892
|
if (!t.isIcon)
|
|
6893
6893
|
return {
|
|
@@ -6899,11 +6899,11 @@ const fi = $e((f, o) => {
|
|
|
6899
6899
|
cy: t.y + t.height / 2
|
|
6900
6900
|
};
|
|
6901
6901
|
e.save(), e.font = `${t.fontStyle || ""} ${t.fontWeight || ""} ${t.fontSize}px ${t.fontFamily}`, e.textBaseline = "alphabetic", e.textAlign = "left";
|
|
6902
|
-
const r = e.measureText(t.text), d = r.actualBoundingBoxAscent ?? t.fontSize * 0.8, x = r.actualBoundingBoxDescent ?? t.fontSize * 0.2,
|
|
6903
|
-
return e.restore(), { x: z, y:
|
|
6902
|
+
const r = e.measureText(t.text), d = r.actualBoundingBoxAscent ?? t.fontSize * 0.8, x = r.actualBoundingBoxDescent ?? t.fontSize * 0.2, m = r.actualBoundingBoxLeft ?? 0, w = r.actualBoundingBoxRight ?? r.width, S = m + w, b = d + x, R = t.x, A = t.y, z = R - S / 2 - m, H = A - b / 2 - d;
|
|
6903
|
+
return e.restore(), { x: z, y: H, width: S, height: b, cx: R, cy: A };
|
|
6904
6904
|
}, fe = (e, t) => {
|
|
6905
6905
|
if (!t) return;
|
|
6906
|
-
const r = 8, d = 8, x = 4,
|
|
6906
|
+
const r = 8, d = 8, x = 4, m = 30, w = Qt(e, t), S = t.isIcon ? Math.max(r, 12) : r, b = {
|
|
6907
6907
|
x: -w.width / 2 - S,
|
|
6908
6908
|
y: -w.height / 2 - S,
|
|
6909
6909
|
w: w.width + S * 2,
|
|
@@ -6928,29 +6928,29 @@ const fi = $e((f, o) => {
|
|
|
6928
6928
|
{ x: b.x + b.w, y: b.y },
|
|
6929
6929
|
{ x: b.x + b.w, y: b.y + b.h },
|
|
6930
6930
|
{ x: b.x, y: b.y + b.h }
|
|
6931
|
-
].forEach((
|
|
6931
|
+
].forEach((H) => {
|
|
6932
6932
|
e.fillStyle = "rgba(0,0,0,.2)", e.fillRect(
|
|
6933
|
-
|
|
6934
|
-
|
|
6933
|
+
H.x - d / 2 + 1,
|
|
6934
|
+
H.y - d / 2 + 1,
|
|
6935
6935
|
d,
|
|
6936
6936
|
d
|
|
6937
6937
|
), e.fillStyle = "#ffffff", e.fillRect(
|
|
6938
|
-
|
|
6939
|
-
|
|
6938
|
+
H.x - d / 2,
|
|
6939
|
+
H.y - d / 2,
|
|
6940
6940
|
d,
|
|
6941
6941
|
d
|
|
6942
6942
|
), e.strokeStyle = "#3b82f6", e.lineWidth = 1, e.strokeRect(
|
|
6943
|
-
|
|
6944
|
-
|
|
6943
|
+
H.x - d / 2,
|
|
6944
|
+
H.y - d / 2,
|
|
6945
6945
|
d,
|
|
6946
6946
|
d
|
|
6947
6947
|
);
|
|
6948
6948
|
});
|
|
6949
|
-
const A = 0, z = b.y -
|
|
6949
|
+
const A = 0, z = b.y - m;
|
|
6950
6950
|
e.strokeStyle = "#3b82f6", e.lineWidth = 1, e.setLineDash([2, 2]), e.beginPath(), e.moveTo(A, z + 12), e.lineTo(A, b.y), e.stroke(), e.setLineDash([]), e.beginPath(), e.arc(A, z, 12, 0, 2 * Math.PI), e.fillStyle = "#f59e0b", e.fill(), e.strokeStyle = "#ffffff", e.lineWidth = 2, e.stroke(), e.strokeStyle = "#ffffff", e.lineWidth = 2, e.beginPath(), e.arc(A, z, 6, -Math.PI / 2, Math.PI, !1), e.stroke(), e.beginPath(), e.moveTo(A - 6, z), e.lineTo(A - 3, z - 3), e.lineTo(A - 3, z + 3), e.closePath(), e.fillStyle = "#ffffff", e.fill(), e.restore();
|
|
6951
6951
|
}, he = (e, t) => {
|
|
6952
6952
|
if (!t) return [];
|
|
6953
|
-
const r = Qt(e, t), d = t.isIcon ? Math.max(8, 12) : 8, x = 8,
|
|
6953
|
+
const r = Qt(e, t), d = t.isIcon ? Math.max(8, 12) : 8, x = 8, m = 30, w = (t.rotation || 0) * Math.PI / 180, S = {
|
|
6954
6954
|
x: -r.width / 2 - d,
|
|
6955
6955
|
y: -r.height / 2 - d,
|
|
6956
6956
|
w: r.width + d * 2,
|
|
@@ -6960,7 +6960,7 @@ const fi = $e((f, o) => {
|
|
|
6960
6960
|
{ x: S.x + S.w, y: S.y, type: "ne-resize" },
|
|
6961
6961
|
{ x: S.x + S.w, y: S.y + S.h, type: "se-resize" },
|
|
6962
6962
|
{ x: S.x, y: S.y + S.h, type: "sw-resize" },
|
|
6963
|
-
{ x: 0, y: S.y -
|
|
6963
|
+
{ x: 0, y: S.y - m, type: "rotate" }
|
|
6964
6964
|
], R = Math.cos(w), A = Math.sin(w);
|
|
6965
6965
|
return b.map((z) => ({
|
|
6966
6966
|
x: r.cx + (z.x * R - z.y * A),
|
|
@@ -6972,8 +6972,8 @@ const fi = $e((f, o) => {
|
|
|
6972
6972
|
if (!r) return null;
|
|
6973
6973
|
const d = K.current;
|
|
6974
6974
|
if (!d) return null;
|
|
6975
|
-
const x = d.getContext("2d"),
|
|
6976
|
-
for (const w of
|
|
6975
|
+
const x = d.getContext("2d"), m = he(x, r);
|
|
6976
|
+
for (const w of m) {
|
|
6977
6977
|
const S = e - w.x, b = t - w.y;
|
|
6978
6978
|
if (Math.sqrt(S * S + b * b) <= w.size / 2)
|
|
6979
6979
|
return w.type;
|
|
@@ -6981,39 +6981,39 @@ const fi = $e((f, o) => {
|
|
|
6981
6981
|
return null;
|
|
6982
6982
|
}, Ft = at(() => {
|
|
6983
6983
|
if (J > 0) {
|
|
6984
|
-
const e =
|
|
6985
|
-
n(e.elements),
|
|
6984
|
+
const e = _[J - 1];
|
|
6985
|
+
n(e.elements), C(e.selectedElement), q(J - 1);
|
|
6986
6986
|
}
|
|
6987
|
-
}, [
|
|
6988
|
-
if (J <
|
|
6989
|
-
const e =
|
|
6990
|
-
n(e.elements),
|
|
6987
|
+
}, [_, J]), bt = at(() => {
|
|
6988
|
+
if (J < _.length - 1) {
|
|
6989
|
+
const e = _[J + 1];
|
|
6990
|
+
n(e.elements), C(e.selectedElement), q(J + 1);
|
|
6991
6991
|
}
|
|
6992
|
-
}, [
|
|
6992
|
+
}, [_, J]), mt = (e) => Y ? Math.round(e / It) * It : e;
|
|
6993
6993
|
rt(() => {
|
|
6994
|
-
if (
|
|
6994
|
+
if (F != null && F.sectionImage) {
|
|
6995
6995
|
pt.current = null, wt.current = null;
|
|
6996
6996
|
const e = K.current;
|
|
6997
6997
|
if (e && e.getContext("2d").clearRect(0, 0, k, W), g && !yt)
|
|
6998
6998
|
return;
|
|
6999
6999
|
const t = new Image();
|
|
7000
7000
|
t.crossOrigin = "anonymous", t.onload = () => {
|
|
7001
|
-
pt.current = t, Xt(t,
|
|
7001
|
+
pt.current = t, Xt(t, G);
|
|
7002
7002
|
}, t.onerror = () => {
|
|
7003
|
-
console.error("Failed to load background image:",
|
|
7003
|
+
console.error("Failed to load background image:", F.sectionImage), V();
|
|
7004
7004
|
};
|
|
7005
|
-
let r =
|
|
7006
|
-
yt && yt.sectionImage && (
|
|
7005
|
+
let r = F.sectionImage;
|
|
7006
|
+
yt && yt.sectionImage && (F.sectionName === "Front" || yt.sections && Object.keys(yt.sections).includes(F.sectionName)) && (r = yt.sectionImage), t.src = r;
|
|
7007
7007
|
} else
|
|
7008
7008
|
pt.current = null, wt.current = null, V();
|
|
7009
|
-
}, [
|
|
7009
|
+
}, [F, G, yt]), rt(() => {
|
|
7010
7010
|
const e = (t) => {
|
|
7011
7011
|
const r = document.activeElement;
|
|
7012
7012
|
if (!(r && (r.tagName === "INPUT" || r.tagName === "TEXTAREA" || r.tagName === "SELECT" || r.isContentEditable))) {
|
|
7013
7013
|
if ((t.key === "Delete" || t.key === "Backspace") && c && !l) {
|
|
7014
7014
|
t.preventDefault();
|
|
7015
7015
|
const x = c;
|
|
7016
|
-
n((
|
|
7016
|
+
n((m) => m.filter((w) => w.id !== x.id)), C(null), lt();
|
|
7017
7017
|
}
|
|
7018
7018
|
if (t.ctrlKey || t.metaKey)
|
|
7019
7019
|
switch (t.key) {
|
|
@@ -7073,10 +7073,10 @@ const fi = $e((f, o) => {
|
|
|
7073
7073
|
Ce(e, t);
|
|
7074
7074
|
break;
|
|
7075
7075
|
case "pentagon":
|
|
7076
|
-
|
|
7076
|
+
Te(e, t);
|
|
7077
7077
|
break;
|
|
7078
7078
|
case "heart":
|
|
7079
|
-
|
|
7079
|
+
je(e, t);
|
|
7080
7080
|
break;
|
|
7081
7081
|
case "oval":
|
|
7082
7082
|
Ne(e, t);
|
|
@@ -7088,10 +7088,10 @@ const fi = $e((f, o) => {
|
|
|
7088
7088
|
Re(e, t);
|
|
7089
7089
|
break;
|
|
7090
7090
|
case "qrcode":
|
|
7091
|
-
|
|
7091
|
+
me(e, t);
|
|
7092
7092
|
break;
|
|
7093
7093
|
case "barcode":
|
|
7094
|
-
|
|
7094
|
+
ue(e, t);
|
|
7095
7095
|
break;
|
|
7096
7096
|
case "sticker":
|
|
7097
7097
|
De(e, t);
|
|
@@ -7104,7 +7104,7 @@ const fi = $e((f, o) => {
|
|
|
7104
7104
|
break;
|
|
7105
7105
|
}
|
|
7106
7106
|
e.restore();
|
|
7107
|
-
},
|
|
7107
|
+
}, ue = (e, t) => {
|
|
7108
7108
|
if (t.imageObject)
|
|
7109
7109
|
e.drawImage(t.imageObject, 0, 0, t.width, t.height);
|
|
7110
7110
|
else if (t.src && !t.imageLoading) {
|
|
@@ -7124,7 +7124,7 @@ const fi = $e((f, o) => {
|
|
|
7124
7124
|
);
|
|
7125
7125
|
}, r.src = t.src, e.fillStyle = "#f0f0f0", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = "#ccc", e.strokeRect(0, 0, t.width, t.height), e.fillStyle = "#666", e.font = "12px Arial", e.textAlign = "center", e.textBaseline = "middle", e.fillText("Loading...", t.width / 2, t.height / 2);
|
|
7126
7126
|
} else t.imageLoading ? (e.fillStyle = "#f0f0f0", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = "#ccc", e.strokeRect(0, 0, t.width, t.height), e.fillStyle = "#666", e.font = "12px Arial", e.textAlign = "center", e.textBaseline = "middle", e.fillText("Loading...", t.width / 2, t.height / 2)) : (e.fillStyle = "#f0f0f0", e.fillRect(0, 0, t.width, t.height), e.strokeStyle = "#ccc", e.strokeRect(0, 0, t.width, t.height), e.fillStyle = "#666", e.font = "12px Arial", e.textAlign = "center", e.textBaseline = "middle", e.fillText("No Barcode", t.width / 2, t.height / 2));
|
|
7127
|
-
},
|
|
7127
|
+
}, me = (e, t) => {
|
|
7128
7128
|
if (t.imageObject)
|
|
7129
7129
|
e.drawImage(t.imageObject, 0, 0, t.width, t.height);
|
|
7130
7130
|
else if (t.src && !t.imageLoading) {
|
|
@@ -7161,22 +7161,22 @@ const fi = $e((f, o) => {
|
|
|
7161
7161
|
}
|
|
7162
7162
|
e.font = `${t.fontStyle || "normal"} ${t.fontWeight || "normal"} ${t.fontSize || 20}px ${t.fontFamily || "Arial"}`, e.fillStyle = t.fill || "#000000", e.textAlign = t.textAlign || "left", e.textBaseline = "top", t.opacity !== void 0 && (e.globalAlpha = t.opacity), t.stroke && t.strokeWidth > 0 && (e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth);
|
|
7163
7163
|
const d = r.split(`
|
|
7164
|
-
`), x = (t.fontSize || 20) * (t.lineHeight || 1.2),
|
|
7164
|
+
`), x = (t.fontSize || 20) * (t.lineHeight || 1.2), m = Math.max(...d.map((S) => e.measureText(S).width)), w = d.length * x;
|
|
7165
7165
|
if (t.backgroundColor && t.backgroundColor !== "transparent") {
|
|
7166
7166
|
e.fillStyle = t.backgroundColor;
|
|
7167
7167
|
const S = t.backgroundPadding || 4;
|
|
7168
7168
|
e.fillRect(
|
|
7169
7169
|
-S,
|
|
7170
7170
|
-S,
|
|
7171
|
-
|
|
7171
|
+
m + S * 2,
|
|
7172
7172
|
w + S * 2
|
|
7173
7173
|
), e.fillStyle = t.fill || "#000000";
|
|
7174
7174
|
}
|
|
7175
7175
|
d.forEach((S, b) => {
|
|
7176
7176
|
const R = b * x, A = e.measureText(S).width;
|
|
7177
7177
|
t.stroke && t.strokeWidth > 0 && e.strokeText(S, 0, R), e.fillText(S, 0, R);
|
|
7178
|
-
const z = t.fontSize || 20,
|
|
7179
|
-
if (e.strokeStyle =
|
|
7178
|
+
const z = t.fontSize || 20, H = t.decorationColor || t.fill || "#000000", dt = Math.max(1, z / 20);
|
|
7179
|
+
if (e.strokeStyle = H, e.lineWidth = dt, t.textDecoration === "underline" || t.underline) {
|
|
7180
7180
|
const ot = R + z + 2;
|
|
7181
7181
|
e.beginPath(), e.moveTo(0, ot), e.lineTo(A, ot), e.stroke();
|
|
7182
7182
|
}
|
|
@@ -7214,10 +7214,10 @@ const fi = $e((f, o) => {
|
|
|
7214
7214
|
const r = t.width / 2;
|
|
7215
7215
|
t.height / 2, e.beginPath(), e.moveTo(r, 0), e.lineTo(0, t.height), e.lineTo(t.width, t.height), e.closePath(), 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());
|
|
7216
7216
|
}, ke = (e, t) => {
|
|
7217
|
-
const r = t.width / 2, d = t.height / 2, x = Math.min(t.width, t.height) / 2,
|
|
7217
|
+
const r = t.width / 2, d = t.height / 2, x = Math.min(t.width, t.height) / 2, m = x * 0.4, w = t.numPoints || 5;
|
|
7218
7218
|
e.beginPath();
|
|
7219
7219
|
for (let S = 0; S < w * 2; S++) {
|
|
7220
|
-
const b = S % 2 === 0 ? x :
|
|
7220
|
+
const b = S % 2 === 0 ? x : m, R = S * Math.PI / w, A = r + Math.cos(R) * b, z = d + Math.sin(R) * b;
|
|
7221
7221
|
S === 0 ? e.moveTo(A, z) : e.lineTo(A, z);
|
|
7222
7222
|
}
|
|
7223
7223
|
e.closePath(), 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());
|
|
@@ -7228,57 +7228,57 @@ const fi = $e((f, o) => {
|
|
|
7228
7228
|
const r = t.width / 2, d = t.height / 2;
|
|
7229
7229
|
e.beginPath(), e.moveTo(r, 0), e.lineTo(t.width, d), e.lineTo(r, t.height), e.lineTo(0, d), e.closePath(), 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());
|
|
7230
7230
|
}, Ce = (e, t) => {
|
|
7231
|
-
const r = t.width / 2, d = t.height / 2, x = Math.min(t.width, t.height) / 2,
|
|
7231
|
+
const r = t.width / 2, d = t.height / 2, x = Math.min(t.width, t.height) / 2, m = 6;
|
|
7232
7232
|
e.beginPath();
|
|
7233
|
-
for (let w = 0; w <
|
|
7234
|
-
const S = w * 2 * Math.PI /
|
|
7233
|
+
for (let w = 0; w < m; w++) {
|
|
7234
|
+
const S = w * 2 * Math.PI / m - Math.PI / 2, b = r + x * Math.cos(S), R = d + x * Math.sin(S);
|
|
7235
7235
|
w === 0 ? e.moveTo(b, R) : e.lineTo(b, R);
|
|
7236
7236
|
}
|
|
7237
7237
|
e.closePath(), 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());
|
|
7238
|
-
},
|
|
7239
|
-
const r = t.width / 2, d = t.height / 2, x = Math.min(t.width, t.height) / 2,
|
|
7238
|
+
}, Te = (e, t) => {
|
|
7239
|
+
const r = t.width / 2, d = t.height / 2, x = Math.min(t.width, t.height) / 2, m = 5;
|
|
7240
7240
|
e.beginPath();
|
|
7241
|
-
for (let w = 0; w <
|
|
7242
|
-
const S = w * 2 * Math.PI /
|
|
7241
|
+
for (let w = 0; w < m; w++) {
|
|
7242
|
+
const S = w * 2 * Math.PI / m - Math.PI / 2, b = r + x * Math.cos(S), R = d + x * Math.sin(S);
|
|
7243
7243
|
w === 0 ? e.moveTo(b, R) : e.lineTo(b, R);
|
|
7244
7244
|
}
|
|
7245
7245
|
e.closePath(), 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());
|
|
7246
|
-
},
|
|
7247
|
-
const r = t.width, d = t.height, x = 0,
|
|
7246
|
+
}, je = (e, t) => {
|
|
7247
|
+
const r = t.width, d = t.height, x = 0, m = 0;
|
|
7248
7248
|
e.beginPath();
|
|
7249
7249
|
const w = d * 0.3;
|
|
7250
|
-
e.moveTo(x + r / 2,
|
|
7250
|
+
e.moveTo(x + r / 2, m + w), e.bezierCurveTo(
|
|
7251
7251
|
x + r / 2,
|
|
7252
|
-
|
|
7252
|
+
m,
|
|
7253
7253
|
x,
|
|
7254
|
-
|
|
7254
|
+
m,
|
|
7255
7255
|
x,
|
|
7256
|
-
|
|
7256
|
+
m + w
|
|
7257
7257
|
), e.bezierCurveTo(
|
|
7258
7258
|
x,
|
|
7259
|
-
|
|
7259
|
+
m + (d + w) / 2,
|
|
7260
7260
|
x + r / 2,
|
|
7261
|
-
|
|
7261
|
+
m + (d + w) / 2,
|
|
7262
7262
|
x + r / 2,
|
|
7263
|
-
|
|
7263
|
+
m + d
|
|
7264
7264
|
), e.bezierCurveTo(
|
|
7265
7265
|
x + r / 2,
|
|
7266
|
-
|
|
7266
|
+
m + (d + w) / 2,
|
|
7267
7267
|
x + r,
|
|
7268
|
-
|
|
7268
|
+
m + (d + w) / 2,
|
|
7269
7269
|
x + r,
|
|
7270
|
-
|
|
7270
|
+
m + w
|
|
7271
7271
|
), e.bezierCurveTo(
|
|
7272
7272
|
x + r,
|
|
7273
|
-
|
|
7273
|
+
m,
|
|
7274
7274
|
x + r / 2,
|
|
7275
|
-
|
|
7275
|
+
m,
|
|
7276
7276
|
x + r / 2,
|
|
7277
|
-
|
|
7277
|
+
m + w
|
|
7278
7278
|
), e.closePath(), 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());
|
|
7279
7279
|
}, Ne = (e, t) => {
|
|
7280
|
-
const r = t.width / 2, d = t.height / 2, x = t.width / 2,
|
|
7281
|
-
e.beginPath(), e.ellipse(r, d, x,
|
|
7280
|
+
const r = t.width / 2, d = t.height / 2, x = t.width / 2, m = t.height / 2;
|
|
7281
|
+
e.beginPath(), e.ellipse(r, d, x, 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());
|
|
7282
7282
|
}, Ie = (e, t) => {
|
|
7283
7283
|
const r = Math.min(t.width, t.height) * 0.1;
|
|
7284
7284
|
At(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());
|
|
@@ -7343,13 +7343,13 @@ const fi = $e((f, o) => {
|
|
|
7343
7343
|
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);
|
|
7344
7344
|
}, Ht = (e, t, r) => {
|
|
7345
7345
|
if (!r) return !1;
|
|
7346
|
-
const d = r.x + r.width / 2, x = r.y + r.height / 2,
|
|
7347
|
-
return A >=
|
|
7346
|
+
const d = r.x + r.width / 2, x = r.y + r.height / 2, m = e - d, w = t - x, S = -(r.rotation || 0) * Math.PI / 180, b = Math.cos(S), R = Math.sin(S), A = m * b - w * R, z = m * R + w * b, H = r.width / 2, dt = r.height / 2;
|
|
7347
|
+
return A >= -H && A <= H && z >= -dt && z <= dt;
|
|
7348
7348
|
}, Be = at(() => {
|
|
7349
|
-
(I ||
|
|
7349
|
+
(I || u || j) && lt(), E(!1), B(!1), p(!1), O(null);
|
|
7350
7350
|
const e = K.current;
|
|
7351
7351
|
e && (e.style.cursor = "default");
|
|
7352
|
-
}, [I,
|
|
7352
|
+
}, [I, u, j, lt]);
|
|
7353
7353
|
rt(() => {
|
|
7354
7354
|
const e = (t) => {
|
|
7355
7355
|
if (l) return;
|
|
@@ -7357,22 +7357,22 @@ const fi = $e((f, o) => {
|
|
|
7357
7357
|
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") && c && (Mt(c.id), t.preventDefault()), (t.ctrlKey || t.metaKey) && t.key === "d" && c && (_t(c.id), t.preventDefault()), c && ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(t.key))) {
|
|
7358
7358
|
t.preventDefault();
|
|
7359
7359
|
const x = t.shiftKey ? 10 : 1;
|
|
7360
|
-
let
|
|
7360
|
+
let m = {};
|
|
7361
7361
|
switch (t.key) {
|
|
7362
7362
|
case "ArrowUp":
|
|
7363
|
-
|
|
7363
|
+
m.y = c.y - x;
|
|
7364
7364
|
break;
|
|
7365
7365
|
case "ArrowDown":
|
|
7366
|
-
|
|
7366
|
+
m.y = c.y + x;
|
|
7367
7367
|
break;
|
|
7368
7368
|
case "ArrowLeft":
|
|
7369
|
-
|
|
7369
|
+
m.x = c.x - x;
|
|
7370
7370
|
break;
|
|
7371
7371
|
case "ArrowRight":
|
|
7372
|
-
|
|
7372
|
+
m.x = c.x + x;
|
|
7373
7373
|
break;
|
|
7374
7374
|
}
|
|
7375
|
-
Gt(c.id,
|
|
7375
|
+
Gt(c.id, m), lt();
|
|
7376
7376
|
}
|
|
7377
7377
|
};
|
|
7378
7378
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
@@ -7432,13 +7432,13 @@ const fi = $e((f, o) => {
|
|
|
7432
7432
|
console.warn(`Unknown element type: ${e}`);
|
|
7433
7433
|
return;
|
|
7434
7434
|
}
|
|
7435
|
-
n((d) => [...d, r]),
|
|
7435
|
+
n((d) => [...d, r]), C(r), lt();
|
|
7436
7436
|
}, Gt = (e, t) => {
|
|
7437
7437
|
n((r) => r.map(
|
|
7438
7438
|
(d) => d.id === e ? { ...d, ...t } : d
|
|
7439
|
-
)), c && c.id === e &&
|
|
7439
|
+
)), c && c.id === e && C((r) => ({ ...r, ...t }));
|
|
7440
7440
|
}, Mt = at(() => {
|
|
7441
|
-
c && (n((e) => e.filter((t) => t.id !== c.id)),
|
|
7441
|
+
c && (n((e) => e.filter((t) => t.id !== c.id)), C(null), lt());
|
|
7442
7442
|
}, [c, lt]), _t = (e) => {
|
|
7443
7443
|
const t = h.find((r) => r.id === e);
|
|
7444
7444
|
if (t) {
|
|
@@ -7448,28 +7448,39 @@ const fi = $e((f, o) => {
|
|
|
7448
7448
|
x: t.x + 20,
|
|
7449
7449
|
y: t.y + 20
|
|
7450
7450
|
};
|
|
7451
|
-
n((d) => [...d, r]),
|
|
7451
|
+
n((d) => [...d, r]), C(r), lt();
|
|
7452
7452
|
}
|
|
7453
7453
|
}, Yt = (e, t) => {
|
|
7454
|
-
const r = h.findIndex((
|
|
7454
|
+
const r = h.findIndex((m) => m.id === e);
|
|
7455
7455
|
if (r === -1) return;
|
|
7456
7456
|
const d = [...h], x = d[r];
|
|
7457
7457
|
t === "up" && r < d.length - 1 ? (d[r] = d[r + 1], d[r + 1] = x) : t === "down" && r > 0 ? (d[r] = d[r - 1], d[r - 1] = x) : t === "top" ? (d.splice(r, 1), d.push(x)) : t === "bottom" && (d.splice(r, 1), d.unshift(x)), n(d), lt();
|
|
7458
7458
|
};
|
|
7459
7459
|
at(() => {
|
|
7460
|
-
|
|
7460
|
+
F && $((e) => ({
|
|
7461
7461
|
...e,
|
|
7462
|
-
[
|
|
7462
|
+
[F.sectionName]: {
|
|
7463
7463
|
elements: [...h],
|
|
7464
|
-
selectedColor:
|
|
7464
|
+
selectedColor: G
|
|
7465
7465
|
}
|
|
7466
7466
|
}));
|
|
7467
|
-
}, [
|
|
7468
|
-
const [, We] =
|
|
7467
|
+
}, [F, h, G]);
|
|
7468
|
+
const [, We] = Ge((e) => e + 1, 0);
|
|
7469
7469
|
setTimeout(() => {
|
|
7470
7470
|
We();
|
|
7471
|
-
}, 20)
|
|
7471
|
+
}, 20);
|
|
7472
|
+
const Me = at(() => {
|
|
7473
|
+
F && $((e) => ({
|
|
7474
|
+
...e,
|
|
7475
|
+
[F.sectionName]: {
|
|
7476
|
+
elements: [...h],
|
|
7477
|
+
selectedColor: G
|
|
7478
|
+
}
|
|
7479
|
+
}));
|
|
7480
|
+
}, [F, h, G]);
|
|
7481
|
+
_e(o, () => ({
|
|
7472
7482
|
handleSectionChange: qt,
|
|
7483
|
+
flushCurrentSectionDesign: Me,
|
|
7473
7484
|
// Export methods that return download-ready data
|
|
7474
7485
|
exportPrintReady: async (e = "png") => await Wt(e, !1),
|
|
7475
7486
|
exportFullDesign: async (e = "png") => await Wt(e, !0),
|
|
@@ -7480,24 +7491,23 @@ const fi = $e((f, o) => {
|
|
|
7480
7491
|
// NEW: Export methods that return JSON with File objects
|
|
7481
7492
|
exportAllDesignsAsJSON: async (e = "png") => {
|
|
7482
7493
|
try {
|
|
7483
|
-
const t = St()
|
|
7484
|
-
console.log("canvas data to export: ", t);
|
|
7485
|
-
const r = {}, d = (C == null ? void 0 : C.sectionName) || "main";
|
|
7486
|
-
r[d] = {
|
|
7494
|
+
const t = St(), r = (F == null ? void 0 : F.sectionName) || "main", d = {
|
|
7487
7495
|
elements: t.elements,
|
|
7488
7496
|
selectedColor: t.selectedColor,
|
|
7489
7497
|
canvasWidth: t.canvasWidth,
|
|
7490
7498
|
canvasHeight: t.canvasHeight
|
|
7491
|
-
},
|
|
7492
|
-
|
|
7493
|
-
|
|
7494
|
-
|
|
7495
|
-
|
|
7496
|
-
|
|
7499
|
+
}, x = {
|
|
7500
|
+
...t.sectionDesigns || {},
|
|
7501
|
+
[r]: d
|
|
7502
|
+
}, m = s.sections && s.sections.length > 0 ? s.sections : [{
|
|
7503
|
+
id: r,
|
|
7504
|
+
sectionName: r,
|
|
7505
|
+
image: F == null ? void 0 : F.sectionImage,
|
|
7506
|
+
sectionImage: F == null ? void 0 : F.sectionImage
|
|
7497
7507
|
}];
|
|
7498
7508
|
return await Bt.current.exportAllSectionsAsJSON(
|
|
7499
|
-
r,
|
|
7500
7509
|
x,
|
|
7510
|
+
m,
|
|
7501
7511
|
k,
|
|
7502
7512
|
W,
|
|
7503
7513
|
e,
|
|
@@ -7516,7 +7526,7 @@ const fi = $e((f, o) => {
|
|
|
7516
7526
|
}
|
|
7517
7527
|
}
|
|
7518
7528
|
}));
|
|
7519
|
-
const
|
|
7529
|
+
const ut = gt(null), Lt = gt(!1), V = at(() => {
|
|
7520
7530
|
const e = K.current;
|
|
7521
7531
|
if (!e || Lt.current) return;
|
|
7522
7532
|
Lt.current = !0;
|
|
@@ -7525,8 +7535,8 @@ const fi = $e((f, o) => {
|
|
|
7525
7535
|
t.save(), t.globalAlpha = r.opacity || 1, ye(t, r), t.restore();
|
|
7526
7536
|
}), c && fe(t, c), Lt.current = !1;
|
|
7527
7537
|
}, [h, c, k, W, M]), vt = at(() => {
|
|
7528
|
-
|
|
7529
|
-
V(),
|
|
7538
|
+
ut.current && cancelAnimationFrame(ut.current), ut.current = requestAnimationFrame(() => {
|
|
7539
|
+
V(), ut.current = null;
|
|
7530
7540
|
});
|
|
7531
7541
|
}, [V]);
|
|
7532
7542
|
rt(() => {
|
|
@@ -7534,15 +7544,15 @@ const fi = $e((f, o) => {
|
|
|
7534
7544
|
}, [h, c, k, W, M, vt]), rt(() => {
|
|
7535
7545
|
wt.current && vt();
|
|
7536
7546
|
}, [wt.current, vt]), rt(() => () => {
|
|
7537
|
-
|
|
7547
|
+
ut.current && cancelAnimationFrame(ut.current);
|
|
7538
7548
|
}, []);
|
|
7539
7549
|
const Pt = at(() => {
|
|
7540
|
-
V(), (I ||
|
|
7541
|
-
}, [V, I,
|
|
7550
|
+
V(), (I || u || j) && (ut.current = requestAnimationFrame(Pt));
|
|
7551
|
+
}, [V, I, u, j]);
|
|
7542
7552
|
rt(() => {
|
|
7543
|
-
I ||
|
|
7544
|
-
}, [I,
|
|
7545
|
-
const
|
|
7553
|
+
I || u || j ? Pt() : (ut.current && (cancelAnimationFrame(ut.current), ut.current = null), vt());
|
|
7554
|
+
}, [I, u, j, Pt, vt]);
|
|
7555
|
+
const Le = at((e) => {
|
|
7546
7556
|
if (l) return;
|
|
7547
7557
|
const r = K.current.getBoundingClientRect(), d = (e.clientX - r.left) / Q, x = (e.clientY - r.top) / Q;
|
|
7548
7558
|
if (X({ x: d, y: x }), c) {
|
|
@@ -7569,58 +7579,58 @@ const fi = $e((f, o) => {
|
|
|
7569
7579
|
return;
|
|
7570
7580
|
}
|
|
7571
7581
|
}
|
|
7572
|
-
let
|
|
7582
|
+
let m = null;
|
|
7573
7583
|
for (let w = h.length - 1; w >= 0; w--)
|
|
7574
7584
|
if (Ht(d, x, h[w])) {
|
|
7575
|
-
|
|
7585
|
+
m = h[w];
|
|
7576
7586
|
break;
|
|
7577
7587
|
}
|
|
7578
|
-
|
|
7588
|
+
m ? (C(m), E(!0), X({
|
|
7579
7589
|
x: d,
|
|
7580
7590
|
y: x,
|
|
7581
|
-
offsetX: d -
|
|
7582
|
-
offsetY: x -
|
|
7583
|
-
})) :
|
|
7584
|
-
}, [l, Q, c, h, V]),
|
|
7591
|
+
offsetX: d - m.x,
|
|
7592
|
+
offsetY: x - m.y
|
|
7593
|
+
})) : C(null), V();
|
|
7594
|
+
}, [l, Q, c, h, V]), Pe = at((e) => {
|
|
7585
7595
|
if (l) return;
|
|
7586
7596
|
const t = K.current, r = t.getBoundingClientRect(), d = (e.clientX - r.left) / Q, x = (e.clientY - r.top) / Q;
|
|
7587
|
-
if (c && !I && !
|
|
7588
|
-
const
|
|
7589
|
-
|
|
7597
|
+
if (c && !I && !u && !j) {
|
|
7598
|
+
const m = $t(d, x, c);
|
|
7599
|
+
m ? m === "rotate" ? t.style.cursor = "grab" : t.style.cursor = m : Ht(d, x, c) ? t.style.cursor = "move" : t.style.cursor = "default";
|
|
7590
7600
|
} else
|
|
7591
7601
|
t.style.cursor = I ? "grabbing" : "default";
|
|
7592
|
-
if (
|
|
7593
|
-
const
|
|
7602
|
+
if (j && c) {
|
|
7603
|
+
const m = c.x + c.width / 2, w = c.y + c.height / 2, b = Math.atan2(x - w, d - m) * 180 / Math.PI - v.initialAngle;
|
|
7594
7604
|
let R = v.initialRotation + b;
|
|
7595
7605
|
e.shiftKey && (R = Math.round(R / 15) * 15), R = (R % 360 + 360) % 360, n(
|
|
7596
7606
|
(A) => A.map(
|
|
7597
7607
|
(z) => z.id === c.id ? { ...z, rotation: R } : z
|
|
7598
7608
|
)
|
|
7599
|
-
),
|
|
7609
|
+
), C((A) => ({ ...A, rotation: R })), V();
|
|
7600
7610
|
return;
|
|
7601
7611
|
}
|
|
7602
|
-
if (
|
|
7603
|
-
const
|
|
7612
|
+
if (u && c && T) {
|
|
7613
|
+
const m = d - v.x, w = x - v.y;
|
|
7604
7614
|
let S = v.initialWidth, b = v.initialHeight, R = v.initialX, A = v.initialY;
|
|
7605
|
-
switch (
|
|
7615
|
+
switch (T) {
|
|
7606
7616
|
case "se-resize":
|
|
7607
|
-
S = Math.max(20, v.initialWidth +
|
|
7617
|
+
S = Math.max(20, v.initialWidth + m), b = Math.max(20, v.initialHeight + w);
|
|
7608
7618
|
break;
|
|
7609
7619
|
case "sw-resize":
|
|
7610
|
-
S = Math.max(20, v.initialWidth -
|
|
7620
|
+
S = Math.max(20, v.initialWidth - m), b = Math.max(20, v.initialHeight + w), R = v.initialX + (v.initialWidth - S);
|
|
7611
7621
|
break;
|
|
7612
7622
|
case "ne-resize":
|
|
7613
|
-
S = Math.max(20, v.initialWidth +
|
|
7623
|
+
S = Math.max(20, v.initialWidth + m), b = Math.max(20, v.initialHeight - w), A = v.initialY + (v.initialHeight - b);
|
|
7614
7624
|
break;
|
|
7615
7625
|
case "nw-resize":
|
|
7616
|
-
S = Math.max(20, v.initialWidth -
|
|
7626
|
+
S = Math.max(20, v.initialWidth - m), b = Math.max(20, v.initialHeight - w), R = v.initialX + (v.initialWidth - S), A = v.initialY + (v.initialHeight - b);
|
|
7617
7627
|
break;
|
|
7618
7628
|
}
|
|
7619
7629
|
if (e.shiftKey && c.type !== "text") {
|
|
7620
|
-
const
|
|
7621
|
-
|
|
7630
|
+
const H = v.initialWidth / v.initialHeight;
|
|
7631
|
+
T.includes("e"), b = S / H, T.includes("n") && (A = v.initialY + (v.initialHeight - b));
|
|
7622
7632
|
}
|
|
7623
|
-
Y && (R =
|
|
7633
|
+
Y && (R = mt(R), A = mt(A), S = mt(S), b = mt(b));
|
|
7624
7634
|
const z = {
|
|
7625
7635
|
...c,
|
|
7626
7636
|
x: R,
|
|
@@ -7629,37 +7639,37 @@ const fi = $e((f, o) => {
|
|
|
7629
7639
|
height: b
|
|
7630
7640
|
};
|
|
7631
7641
|
n(
|
|
7632
|
-
(
|
|
7642
|
+
(H) => H.map(
|
|
7633
7643
|
(dt) => dt.id === c.id ? z : dt
|
|
7634
7644
|
)
|
|
7635
|
-
),
|
|
7645
|
+
), C(z), V();
|
|
7636
7646
|
return;
|
|
7637
7647
|
}
|
|
7638
7648
|
if (I && c) {
|
|
7639
|
-
let
|
|
7640
|
-
Y && (
|
|
7649
|
+
let m = d - v.offsetX, w = x - v.offsetY;
|
|
7650
|
+
Y && (m = mt(m), w = mt(w)), m = Math.max(0, Math.min(k - c.width, m)), w = Math.max(0, Math.min(W - c.height, w));
|
|
7641
7651
|
const S = {
|
|
7642
7652
|
...c,
|
|
7643
|
-
x:
|
|
7653
|
+
x: m,
|
|
7644
7654
|
y: w
|
|
7645
7655
|
};
|
|
7646
7656
|
n(
|
|
7647
7657
|
(b) => b.map(
|
|
7648
7658
|
(R) => R.id === c.id ? S : R
|
|
7649
7659
|
)
|
|
7650
|
-
),
|
|
7660
|
+
), C(S), V();
|
|
7651
7661
|
}
|
|
7652
|
-
}, [l, Q, c, I,
|
|
7653
|
-
|
|
7662
|
+
}, [l, Q, c, I, u, j, T, v, Y, k, W, h, V]), qt = at((e) => {
|
|
7663
|
+
F && $((r) => ({
|
|
7654
7664
|
...r,
|
|
7655
|
-
[
|
|
7665
|
+
[F.sectionName]: {
|
|
7656
7666
|
elements: h.map((d) => d.type === "image" ? {
|
|
7657
7667
|
...d,
|
|
7658
7668
|
// Keep the image data reference
|
|
7659
7669
|
imageData: d.imageData,
|
|
7660
7670
|
src: d.src
|
|
7661
7671
|
} : d),
|
|
7662
|
-
selectedColor:
|
|
7672
|
+
selectedColor: G
|
|
7663
7673
|
}
|
|
7664
7674
|
}));
|
|
7665
7675
|
const t = L[e.sectionName];
|
|
@@ -7669,7 +7679,7 @@ const fi = $e((f, o) => {
|
|
|
7669
7679
|
const x = new Image();
|
|
7670
7680
|
return x.onload = () => {
|
|
7671
7681
|
n(
|
|
7672
|
-
(
|
|
7682
|
+
(m) => m.map(
|
|
7673
7683
|
(w) => w.id === d.id ? { ...w, imageData: x } : w
|
|
7674
7684
|
)
|
|
7675
7685
|
), V();
|
|
@@ -7677,11 +7687,11 @@ const fi = $e((f, o) => {
|
|
|
7677
7687
|
}
|
|
7678
7688
|
return d;
|
|
7679
7689
|
});
|
|
7680
|
-
n(r), st(t.selectedColor ||
|
|
7690
|
+
n(r), st(t.selectedColor || G);
|
|
7681
7691
|
} else
|
|
7682
7692
|
n([]);
|
|
7683
|
-
et(e),
|
|
7684
|
-
}, [
|
|
7693
|
+
et(e), C(null);
|
|
7694
|
+
}, [F, h, G, L, V]), Ue = at((e) => {
|
|
7685
7695
|
if (e && e.type.startsWith("image/")) {
|
|
7686
7696
|
const t = new FileReader();
|
|
7687
7697
|
t.onload = (r) => {
|
|
@@ -7690,8 +7700,8 @@ const fi = $e((f, o) => {
|
|
|
7690
7700
|
const x = {
|
|
7691
7701
|
id: ht(),
|
|
7692
7702
|
type: "image",
|
|
7693
|
-
x:
|
|
7694
|
-
y:
|
|
7703
|
+
x: mt(k / 2 - 100),
|
|
7704
|
+
y: mt(W / 2 - 100),
|
|
7695
7705
|
width: Math.min(d.width, 200),
|
|
7696
7706
|
// Limit initial size
|
|
7697
7707
|
height: Math.min(d.height, 200),
|
|
@@ -7700,8 +7710,8 @@ const fi = $e((f, o) => {
|
|
|
7700
7710
|
src: r.target.result,
|
|
7701
7711
|
originalWidth: d.width,
|
|
7702
7712
|
originalHeight: d.height
|
|
7703
|
-
},
|
|
7704
|
-
x.width / x.height !==
|
|
7713
|
+
}, m = d.width / d.height;
|
|
7714
|
+
x.width / x.height !== m && (x.width / m <= 200 ? x.height = x.width / m : x.width = x.height * m), n((w) => [...w, x]), C(x), lt();
|
|
7705
7715
|
}, d.onerror = () => {
|
|
7706
7716
|
console.error("Failed to load uploaded image"), alert("Failed to load the uploaded image. Please try again.");
|
|
7707
7717
|
}, d.src = r.target.result;
|
|
@@ -7710,8 +7720,8 @@ const fi = $e((f, o) => {
|
|
|
7710
7720
|
}, t.readAsDataURL(e);
|
|
7711
7721
|
} else
|
|
7712
7722
|
alert("Please select a valid image file.");
|
|
7713
|
-
}, [k, W,
|
|
7714
|
-
|
|
7723
|
+
}, [k, W, mt, ht, lt]), Vt = at(
|
|
7724
|
+
Oe(() => {
|
|
7715
7725
|
V();
|
|
7716
7726
|
}, 16),
|
|
7717
7727
|
// 60fps limit
|
|
@@ -7720,33 +7730,33 @@ const fi = $e((f, o) => {
|
|
|
7720
7730
|
rt(() => {
|
|
7721
7731
|
zt.current || Vt();
|
|
7722
7732
|
}, [h, c, M, Vt]);
|
|
7723
|
-
function
|
|
7733
|
+
function Oe(e, t) {
|
|
7724
7734
|
let r;
|
|
7725
7735
|
return function(...x) {
|
|
7726
|
-
const
|
|
7736
|
+
const m = () => {
|
|
7727
7737
|
clearTimeout(r), e(...x);
|
|
7728
7738
|
};
|
|
7729
|
-
clearTimeout(r), r = setTimeout(
|
|
7739
|
+
clearTimeout(r), r = setTimeout(m, t);
|
|
7730
7740
|
};
|
|
7731
7741
|
}
|
|
7732
7742
|
rt(() => {
|
|
7733
|
-
pt.current && Xt(pt.current,
|
|
7734
|
-
}, [
|
|
7743
|
+
pt.current && Xt(pt.current, G);
|
|
7744
|
+
}, [G]), rt(() => {
|
|
7735
7745
|
V();
|
|
7736
7746
|
}, [V]);
|
|
7737
|
-
const
|
|
7747
|
+
const Qe = (e, t, r) => (0.2126 * e + 0.7152 * t + 0.0722 * r) / 255, Xt = at((e, t) => {
|
|
7738
7748
|
const r = Ot.current, d = r.getContext("2d");
|
|
7739
7749
|
r.width = k, r.height = W, d.clearRect(0, 0, k, W), d.drawImage(e, 0, 0, k, W);
|
|
7740
|
-
const x = d.getImageData(0, 0, k, W),
|
|
7750
|
+
const x = d.getImageData(0, 0, k, W), m = x.data, w = ge(t);
|
|
7741
7751
|
if (!w) {
|
|
7742
7752
|
zt.current = !1;
|
|
7743
7753
|
return;
|
|
7744
7754
|
}
|
|
7745
7755
|
const { r: S, g: b, b: R } = w;
|
|
7746
|
-
for (let z = 0; z <
|
|
7747
|
-
if (
|
|
7748
|
-
const dt =
|
|
7749
|
-
|
|
7756
|
+
for (let z = 0; z < m.length; z += 4) {
|
|
7757
|
+
if (m[z + 3] === 0) continue;
|
|
7758
|
+
const dt = Qe(m[z], m[z + 1], m[z + 2]);
|
|
7759
|
+
m[z] = Math.round(S * dt), m[z + 1] = Math.round(b * dt), m[z + 2] = Math.round(R * dt);
|
|
7750
7760
|
}
|
|
7751
7761
|
d.putImageData(x, 0, 0);
|
|
7752
7762
|
const A = new Image();
|
|
@@ -7758,9 +7768,9 @@ const fi = $e((f, o) => {
|
|
|
7758
7768
|
const t = document.querySelector(".ruler-horizontal"), r = document.querySelector(".ruler-vertical");
|
|
7759
7769
|
if (!t || !r)
|
|
7760
7770
|
return { horizontal: [], vertical: [] };
|
|
7761
|
-
const d = t.getBoundingClientRect(), x = r.getBoundingClientRect(),
|
|
7762
|
-
for (let A = S; A <=
|
|
7763
|
-
A <=
|
|
7771
|
+
const d = t.getBoundingClientRect(), x = r.getBoundingClientRect(), m = d.width, w = x.height, S = 50, b = [], R = [];
|
|
7772
|
+
for (let A = S; A <= m; A += S)
|
|
7773
|
+
A <= m - 20 && b.push({
|
|
7764
7774
|
position: A,
|
|
7765
7775
|
value: Math.round(A / e)
|
|
7766
7776
|
});
|
|
@@ -7796,7 +7806,7 @@ const fi = $e((f, o) => {
|
|
|
7796
7806
|
}
|
|
7797
7807
|
}, [tt, y, Q]), /* @__PURE__ */ i.jsxs("div", { className: "pure-canvas-designer", children: [
|
|
7798
7808
|
/* @__PURE__ */ i.jsx("div", { className: "designer-header", children: /* @__PURE__ */ i.jsx(
|
|
7799
|
-
|
|
7809
|
+
li,
|
|
7800
7810
|
{
|
|
7801
7811
|
onAddElement: ze,
|
|
7802
7812
|
onDeleteElement: () => c && Mt(c.id),
|
|
@@ -7806,9 +7816,9 @@ const fi = $e((f, o) => {
|
|
|
7806
7816
|
onToggleGrid: () => nt(!M),
|
|
7807
7817
|
onToggleRulers: () => ct(!tt),
|
|
7808
7818
|
onToggleSnap: () => P(!Y),
|
|
7809
|
-
onImageUpload:
|
|
7819
|
+
onImageUpload: Ue,
|
|
7810
7820
|
canUndo: J > 0,
|
|
7811
|
-
canRedo: J <
|
|
7821
|
+
canRedo: J < _.length - 1,
|
|
7812
7822
|
showGrid: M,
|
|
7813
7823
|
showRulers: tt,
|
|
7814
7824
|
snapToGrid: Y,
|
|
@@ -7846,8 +7856,8 @@ const fi = $e((f, o) => {
|
|
|
7846
7856
|
ref: K,
|
|
7847
7857
|
width: k,
|
|
7848
7858
|
height: W,
|
|
7849
|
-
onMouseDown:
|
|
7850
|
-
onMouseMove:
|
|
7859
|
+
onMouseDown: Le,
|
|
7860
|
+
onMouseMove: Pe,
|
|
7851
7861
|
onMouseUp: Be,
|
|
7852
7862
|
style: {
|
|
7853
7863
|
border: "1px solid #e2e8f0",
|
|
@@ -7859,7 +7869,7 @@ const fi = $e((f, o) => {
|
|
|
7859
7869
|
) }),
|
|
7860
7870
|
/* @__PURE__ */ i.jsxs("div", { className: "side-panels", children: [
|
|
7861
7871
|
/* @__PURE__ */ i.jsx(
|
|
7862
|
-
|
|
7872
|
+
ni,
|
|
7863
7873
|
{
|
|
7864
7874
|
selectedElement: c,
|
|
7865
7875
|
onUpdate: Gt,
|
|
@@ -7869,11 +7879,11 @@ const fi = $e((f, o) => {
|
|
|
7869
7879
|
}
|
|
7870
7880
|
),
|
|
7871
7881
|
/* @__PURE__ */ i.jsx(
|
|
7872
|
-
|
|
7882
|
+
ci,
|
|
7873
7883
|
{
|
|
7874
7884
|
elements: h,
|
|
7875
7885
|
selectedElement: c,
|
|
7876
|
-
onSelectElement:
|
|
7886
|
+
onSelectElement: C,
|
|
7877
7887
|
onMoveLayer: Yt,
|
|
7878
7888
|
onDeleteElement: Mt,
|
|
7879
7889
|
theme: a
|
|
@@ -7892,7 +7902,7 @@ const fi = $e((f, o) => {
|
|
|
7892
7902
|
return /* @__PURE__ */ i.jsxs(
|
|
7893
7903
|
"div",
|
|
7894
7904
|
{
|
|
7895
|
-
className: `section-thumbnail compact ${
|
|
7905
|
+
className: `section-thumbnail compact ${F.sectionName === e.sectionName ? "active" : ""}`,
|
|
7896
7906
|
onClick: (r) => {
|
|
7897
7907
|
r.stopPropagation();
|
|
7898
7908
|
const d = s.sections.find((x) => x.sectionName === e.sectionName);
|
|
@@ -7928,7 +7938,7 @@ const fi = $e((f, o) => {
|
|
|
7928
7938
|
s.colorSettings.slice(0, 3).map((e, t) => /* @__PURE__ */ i.jsxs(
|
|
7929
7939
|
"div",
|
|
7930
7940
|
{
|
|
7931
|
-
className: `color-swatch-enhanced compact ${
|
|
7941
|
+
className: `color-swatch-enhanced compact ${G === e ? "active" : ""}`,
|
|
7932
7942
|
onClick: (r) => {
|
|
7933
7943
|
r.stopPropagation(), st(e);
|
|
7934
7944
|
},
|
|
@@ -7941,7 +7951,7 @@ const fi = $e((f, o) => {
|
|
|
7941
7951
|
style: { backgroundColor: e }
|
|
7942
7952
|
}
|
|
7943
7953
|
),
|
|
7944
|
-
|
|
7954
|
+
G === e && /* @__PURE__ */ i.jsx("div", { className: "color-selection-ring compact" })
|
|
7945
7955
|
]
|
|
7946
7956
|
},
|
|
7947
7957
|
e
|
|
@@ -7967,7 +7977,7 @@ const fi = $e((f, o) => {
|
|
|
7967
7977
|
/* @__PURE__ */ i.jsx("div", { className: "color-dropdown-menu", style: { display: "none" }, children: s.colorSettings.slice(3).map((e, t) => /* @__PURE__ */ i.jsxs(
|
|
7968
7978
|
"div",
|
|
7969
7979
|
{
|
|
7970
|
-
className: `color-swatch-dropdown ${
|
|
7980
|
+
className: `color-swatch-dropdown ${G === e ? "active" : ""}`,
|
|
7971
7981
|
onClick: (r) => {
|
|
7972
7982
|
r.stopPropagation(), st(e), r.currentTarget.parentElement.style.display = "none";
|
|
7973
7983
|
},
|
|
@@ -8056,7 +8066,7 @@ const fi = $e((f, o) => {
|
|
|
8056
8066
|
] })
|
|
8057
8067
|
] });
|
|
8058
8068
|
});
|
|
8059
|
-
|
|
8069
|
+
hi.displayName = "Mypixia";
|
|
8060
8070
|
export {
|
|
8061
|
-
|
|
8071
|
+
hi as default
|
|
8062
8072
|
};
|