@snowcone-app/canvas 0.37.0 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ERROR_CONTRACT.md +39 -8
- package/STYLING_CONTRACT.md +24 -2
- package/dist/{CanvasRenderer-CTN4j-uO.js → CanvasRenderer-D-E5WWLm.js} +4 -4
- package/dist/{CanvasRenderer-CTN4j-uO.js.map → CanvasRenderer-D-E5WWLm.js.map} +1 -1
- package/dist/{CanvasStateV1-DLE5d1-d.js → CanvasStateV1-C9LQt2J0.js} +7 -7
- package/dist/{CanvasStateV1-DLE5d1-d.js.map → CanvasStateV1-C9LQt2J0.js.map} +1 -1
- package/dist/{ContextualToolbars-CG5Gmv_i.js → ContextualToolbars-C62As-xY.js} +202 -202
- package/dist/{ContextualToolbars-CG5Gmv_i.js.map → ContextualToolbars-C62As-xY.js.map} +1 -1
- package/dist/EditorCanvasImpl-BnxEbr2p.js +144 -0
- package/dist/EditorCanvasImpl-BnxEbr2p.js.map +1 -0
- package/dist/{ExportManager-CDX5_up8.js → ExportManager-BbBfO22S.js} +45 -45
- package/dist/{ExportManager-CDX5_up8.js.map → ExportManager-BbBfO22S.js.map} +1 -1
- package/dist/{FontAnalyzer-CEYA_6fY.js → FontAnalyzer-DWHS41ba.js} +128 -128
- package/dist/FontAnalyzer-DWHS41ba.js.map +1 -0
- package/dist/{ImagePanel-DLxIDKV-.js → ImagePanel-BaX0UE-L.js} +57 -57
- package/dist/{ImagePanel-DLxIDKV-.js.map → ImagePanel-BaX0UE-L.js.map} +1 -1
- package/dist/SnowconeCanvas-CWSPyqqj.js +1112 -0
- package/dist/SnowconeCanvas-CWSPyqqj.js.map +1 -0
- package/dist/advanced.mjs +138 -138
- package/dist/api/placement.d.ts +3 -0
- package/dist/components/editor/EditorPlacements.d.ts +19 -6
- package/dist/components/editor/RootInternals.d.ts +7 -0
- package/dist/components/editor/designStateStore.d.ts +18 -0
- package/dist/components/editor/index.d.ts +3 -1
- package/dist/components/editor/placementLinks.d.ts +52 -0
- package/dist/components/editor/usePlacements.d.ts +28 -4
- package/dist/components/embed-realtime/context.d.ts +20 -4
- package/dist/components/embed-realtime/usePieceGuideBundle.d.ts +1 -0
- package/dist/components/embed-realtime/validateEmbed.d.ts +6 -3
- package/dist/{custom-icons-D51KIAfz.js → custom-icons-o1U13Vcg.js} +14 -14
- package/dist/{custom-icons-D51KIAfz.js.map → custom-icons-o1U13Vcg.js.map} +1 -1
- package/dist/{design-builder-CqgTpp9B.js → design-builder-CoCtjIwj.js} +86 -86
- package/dist/{design-builder-CqgTpp9B.js.map → design-builder-CoCtjIwj.js.map} +1 -1
- package/dist/{embed-CLz3CTcX.js → embed-SOFUZlGB.js} +843 -729
- package/dist/embed-SOFUZlGB.js.map +1 -0
- package/dist/embed.mjs +28 -28
- package/dist/errors/editorError.d.ts +7 -2
- package/dist/{guards-DldCuuJq.js → guards-DMmhw_Ow.js} +4 -4
- package/dist/{guards-DldCuuJq.js.map → guards-DMmhw_Ow.js.map} +1 -1
- package/dist/index.mjs +21 -21
- package/dist/internals.mjs +108 -108
- package/dist/internals.mjs.map +1 -1
- package/dist/placement-Br5jI_-u.js +90 -0
- package/dist/placement-Br5jI_-u.js.map +1 -0
- package/dist/placement.d.ts +2 -0
- package/dist/placement.mjs +5 -0
- package/dist/placement.mjs.map +1 -0
- package/dist/template-fields-CBLHgW7G.js +556 -0
- package/dist/template-fields-CBLHgW7G.js.map +1 -0
- package/dist/testing.mjs +24 -24
- package/dist/{useCommands-CQi4Pyd2.js → useCommands-x8J7_Mzy.js} +262 -262
- package/dist/{useCommands-CQi4Pyd2.js.map → useCommands-x8J7_Mzy.js.map} +1 -1
- package/dist/usePieceGuideBundle-C7r06a_x.js +65 -0
- package/dist/usePieceGuideBundle-C7r06a_x.js.map +1 -0
- package/dist/{validation-THw5W6N_.js → validation-BG-V98h0.js} +846 -846
- package/dist/validation-BG-V98h0.js.map +1 -0
- package/example/package.json +1 -1
- package/package.json +9 -4
- package/dist/EditorCanvasImpl-BRdFWZA5.js +0 -81
- package/dist/EditorCanvasImpl-BRdFWZA5.js.map +0 -1
- package/dist/FontAnalyzer-CEYA_6fY.js.map +0 -1
- package/dist/SnowconeCanvas-BaFR8QXs.js +0 -1196
- package/dist/SnowconeCanvas-BaFR8QXs.js.map +0 -1
- package/dist/embed-CLz3CTcX.js.map +0 -1
- package/dist/template-fields-D8uOutD4.js +0 -505
- package/dist/template-fields-D8uOutD4.js.map +0 -1
- package/dist/usePieceGuideBundle-BUQKb0Ja.js +0 -61
- package/dist/usePieceGuideBundle-BUQKb0Ja.js.map +0 -1
- package/dist/validation-THw5W6N_.js.map +0 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { jsx as r, jsxs as y, Fragment as Pn } from "react/jsx-runtime";
|
|
2
2
|
import * as $n from "react";
|
|
3
|
-
import je, { useState as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { I as
|
|
3
|
+
import je, { useState as ae, useEffect as Pe, useCallback as ft, useMemo as xs, useContext as Pr, createContext as Ar, useRef as Se, useImperativeHandle as nr, forwardRef as Nr } from "react";
|
|
4
|
+
import { b as rs, o as sr, t as _s, v as $s, d as Ts, j as Dr, c as Br, m as Or } from "./design-builder-CoCtjIwj.js";
|
|
5
|
+
import { l as rr, I as ze, s as zr, u as or, c as Fn, v as Qt, i as _e, J as Xr, G as Yr, H as Hr, F as Lr, W as _r, T as dn, q as un, r as hn, B as Ct, Y as $r, Z as Fr, _ as Wr, D as ir, k as Vr, b as ar } from "./useCommands-x8J7_Mzy.js";
|
|
6
|
+
import { I as Yt, G as Re, b5 as Is, aO as ys, ab as cr, b6 as Fs, b7 as Kr, Y as Cn, b8 as Ur, b9 as us, P as wn, c as zn, a1 as en, $ as ms, ba as Gr, T as Qe, u as qr, bb as Jn, bc as jr, bd as Zr, be as Jr, a0 as lr, _ as Qr, bf as Es, Z as eo, g as to, S as Qn, at as no, x as Bn } from "./FontAnalyzer-DWHS41ba.js";
|
|
7
7
|
import { createPortal as dr } from "react-dom";
|
|
8
|
-
import { g as _n, b as so, r as ro, c as oo, C as Ws, d as Vs, e as gs, T as io, a as ao, A as co, S as lo, I as uo } from "./CanvasRenderer-
|
|
8
|
+
import { g as _n, b as so, r as ro, c as oo, C as Ws, d as Vs, e as gs, T as io, a as ao, A as co, S as lo, I as uo } from "./CanvasRenderer-D-E5WWLm.js";
|
|
9
9
|
import { u as ho } from "./ThemeContext-Rjz25x9X.js";
|
|
10
10
|
import { renderToStaticMarkup as fo } from "react-dom/server";
|
|
11
|
-
import { D as Ps, n as As, o as ur, p as Ns,
|
|
12
|
-
import { L as Tt, S as hr, T as Ot, I as mo } from "./custom-icons-
|
|
11
|
+
import { D as Ps, n as As, o as ur, p as Ns, e as po, q as Mt } from "./ContextualToolbars-C62As-xY.js";
|
|
12
|
+
import { L as Tt, S as hr, T as Ot, I as mo } from "./custom-icons-o1U13Vcg.js";
|
|
13
13
|
import * as ts from "@radix-ui/react-radio-group";
|
|
14
|
-
import {
|
|
14
|
+
import { R as go, S as Ks, U as Us } from "./ExportManager-BbBfO22S.js";
|
|
15
15
|
import { cva as fr } from "class-variance-authority";
|
|
16
16
|
import { debounce as Gs } from "lodash-es";
|
|
17
17
|
const xo = {
|
|
@@ -153,7 +153,7 @@ function Co(e) {
|
|
|
153
153
|
}
|
|
154
154
|
const mr = Ar(null);
|
|
155
155
|
function $a({ kit: e, children: t }) {
|
|
156
|
-
const [n, s] =
|
|
156
|
+
const [n, s] = ae(e);
|
|
157
157
|
Pe(() => {
|
|
158
158
|
s(e);
|
|
159
159
|
}, [e]);
|
|
@@ -176,11 +176,11 @@ function Fa() {
|
|
|
176
176
|
return e.capabilities;
|
|
177
177
|
}
|
|
178
178
|
function So(e, t) {
|
|
179
|
-
if (t instanceof
|
|
179
|
+
if (t instanceof Yt && t.isCropping || e instanceof Yt && e.isCropping)
|
|
180
180
|
return !0;
|
|
181
181
|
if (e instanceof Re) {
|
|
182
182
|
for (const n of e.children)
|
|
183
|
-
if (n instanceof
|
|
183
|
+
if (n instanceof Yt && n.isCropping)
|
|
184
184
|
return !0;
|
|
185
185
|
}
|
|
186
186
|
return !1;
|
|
@@ -321,9 +321,9 @@ function Eo(e) {
|
|
|
321
321
|
}
|
|
322
322
|
const ko = 280, Ro = (e) => 1 - Math.pow(1 - e, 3);
|
|
323
323
|
function Mo(e, t = ko) {
|
|
324
|
-
const [n, s] =
|
|
324
|
+
const [n, s] = ae(e), o = Se(n);
|
|
325
325
|
o.current = n;
|
|
326
|
-
const i =
|
|
326
|
+
const i = Se(null), a = e ? `${e.x},${e.y},${e.width},${e.height}` : "none";
|
|
327
327
|
return Pe(() => {
|
|
328
328
|
if (i.current !== null && (cancelAnimationFrame(i.current), i.current = null), !e) {
|
|
329
329
|
s(null);
|
|
@@ -425,8 +425,8 @@ function To(e, t) {
|
|
|
425
425
|
const D = Math.min(R, C.length);
|
|
426
426
|
for (let w = 0; w < D; w++) {
|
|
427
427
|
if (!T && w < A) continue;
|
|
428
|
-
const ne = C[w], V = x + w, O = c.getStyleAt(V), u = O.fontSize || n, q = O.fontFamily || s, U = O.bold !== void 0 ? O.bold : o, te = O.italic !== void 0 ? O.italic : i,
|
|
429
|
-
N += ys(ne, u, q, U, te,
|
|
428
|
+
const ne = C[w], V = x + w, O = c.getStyleAt(V), u = O.fontSize || n, q = O.fontFamily || s, U = O.bold !== void 0 ? O.bold : o, te = O.italic !== void 0 ? O.italic : i, ce = O.letterSpacing !== void 0 ? O.letterSpacing : l;
|
|
429
|
+
N += ys(ne, u, q, U, te, ce);
|
|
430
430
|
}
|
|
431
431
|
return {
|
|
432
432
|
lineIndex: v,
|
|
@@ -497,21 +497,21 @@ function Sn(e, t) {
|
|
|
497
497
|
let V = 0;
|
|
498
498
|
for (let O = 0; O < A.length; O++) {
|
|
499
499
|
if (!P && O < I || !N && O >= A.length - g) continue;
|
|
500
|
-
const u = A[O], q = E + O, U = c.getStyleAt(q), te = U.fontSize || n,
|
|
501
|
-
if (ne < V +
|
|
500
|
+
const u = A[O], q = E + O, U = c.getStyleAt(q), te = U.fontSize || n, ce = U.fontFamily || s, L = U.bold !== void 0 ? U.bold : o, me = U.italic !== void 0 ? U.italic : i, ye = U.letterSpacing !== void 0 ? U.letterSpacing : l, ve = ys(u, te, ce, L, me, ye);
|
|
501
|
+
if (ne < V + ve / 2)
|
|
502
502
|
return q;
|
|
503
|
-
V +=
|
|
503
|
+
V += ve;
|
|
504
504
|
}
|
|
505
505
|
return E + A.length;
|
|
506
506
|
}
|
|
507
507
|
function Po() {
|
|
508
|
-
const [e, t] =
|
|
508
|
+
const [e, t] = ae(!1), [n, s] = ae({
|
|
509
509
|
x: 0,
|
|
510
510
|
y: 0
|
|
511
|
-
}), [o, i] =
|
|
511
|
+
}), [o, i] = ae({
|
|
512
512
|
x: 0,
|
|
513
513
|
y: 0
|
|
514
|
-
}), [a, l] =
|
|
514
|
+
}), [a, l] = ae([]);
|
|
515
515
|
return Pe(() => {
|
|
516
516
|
}, [e]), {
|
|
517
517
|
isMarqueeSelecting: e,
|
|
@@ -767,7 +767,7 @@ class Ao {
|
|
|
767
767
|
}
|
|
768
768
|
const No = zn("usePenTool");
|
|
769
769
|
function Do({ selectedElement: e }) {
|
|
770
|
-
const [t] =
|
|
770
|
+
const [t] = ae(() => new Ao()), [n, s] = ae("crosshair");
|
|
771
771
|
return Pe(() => {
|
|
772
772
|
try {
|
|
773
773
|
const o = fo(/* @__PURE__ */ r(ze, { icon: "lucide:pen-tool", width: 24, height: 24 })).replace(
|
|
@@ -802,7 +802,7 @@ function Bo({
|
|
|
802
802
|
transformHandles: n,
|
|
803
803
|
onActiveChildChange: s
|
|
804
804
|
}) {
|
|
805
|
-
const [o, i] =
|
|
805
|
+
const [o, i] = ae(null), a = Se(null), l = ft(
|
|
806
806
|
(c) => {
|
|
807
807
|
i(c), s == null || s(c);
|
|
808
808
|
},
|
|
@@ -821,7 +821,7 @@ function Bo({
|
|
|
821
821
|
};
|
|
822
822
|
}
|
|
823
823
|
function Oo({ onHoverChange: e }) {
|
|
824
|
-
const [t, n] =
|
|
824
|
+
const [t, n] = ae({
|
|
825
825
|
type: null,
|
|
826
826
|
data: null,
|
|
827
827
|
startTime: null
|
|
@@ -949,36 +949,36 @@ class zo {
|
|
|
949
949
|
const P = o.startX - p, N = o.startY - b;
|
|
950
950
|
let D = P * v - N * C, w = P * C + N * v;
|
|
951
951
|
D *= R, w *= E;
|
|
952
|
-
const ne = I - D, V = g - w, O = l.cropX, u = l.cropY, q = l.cropWidth, U = l.cropHeight, te = l.width,
|
|
952
|
+
const ne = I - D, V = g - w, O = l.cropX, u = l.cropY, q = l.cropWidth, U = l.cropHeight, te = l.width, ce = l.height, L = ne / te, me = V / ce, ye = this._calculateNewCropValues(
|
|
953
953
|
n,
|
|
954
954
|
O,
|
|
955
955
|
u,
|
|
956
956
|
q,
|
|
957
957
|
U,
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
),
|
|
958
|
+
L,
|
|
959
|
+
me
|
|
960
|
+
), ve = this._calculateCropCenterOffset(
|
|
961
961
|
O,
|
|
962
962
|
u,
|
|
963
963
|
q,
|
|
964
964
|
U,
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
965
|
+
ye.cropX,
|
|
966
|
+
ye.cropY,
|
|
967
|
+
ye.cropWidth,
|
|
968
|
+
ye.cropHeight,
|
|
969
969
|
te,
|
|
970
|
-
|
|
970
|
+
ce,
|
|
971
971
|
m,
|
|
972
972
|
R,
|
|
973
973
|
E
|
|
974
974
|
);
|
|
975
975
|
return {
|
|
976
|
-
...
|
|
977
|
-
x: p +
|
|
978
|
-
y: b +
|
|
976
|
+
...ye,
|
|
977
|
+
x: p + ve.worldOffsetX,
|
|
978
|
+
y: b + ve.worldOffsetY,
|
|
979
979
|
rotation: m,
|
|
980
980
|
width: te,
|
|
981
|
-
height:
|
|
981
|
+
height: ce,
|
|
982
982
|
cursor: d
|
|
983
983
|
};
|
|
984
984
|
}
|
|
@@ -1039,13 +1039,13 @@ class zo {
|
|
|
1039
1039
|
}
|
|
1040
1040
|
}
|
|
1041
1041
|
function Xo() {
|
|
1042
|
-
const [e] =
|
|
1042
|
+
const [e] = ae(() => new zo());
|
|
1043
1043
|
return {
|
|
1044
1044
|
cropController: e
|
|
1045
1045
|
};
|
|
1046
1046
|
}
|
|
1047
|
-
function
|
|
1048
|
-
const t =
|
|
1047
|
+
function Yo(e) {
|
|
1048
|
+
const t = Se(null), n = Se(null);
|
|
1049
1049
|
return Pe(() => {
|
|
1050
1050
|
n.current = null;
|
|
1051
1051
|
}, [e]), {
|
|
@@ -1056,8 +1056,8 @@ function Lo(e) {
|
|
|
1056
1056
|
function js(e) {
|
|
1057
1057
|
return e != null && e instanceof Qe;
|
|
1058
1058
|
}
|
|
1059
|
-
function
|
|
1060
|
-
const [n, s] =
|
|
1059
|
+
function Ho({ selectedElement: e, ref: t }) {
|
|
1060
|
+
const [n, s] = ae(!1), [o, i] = ae(""), [a, l] = ae({ x: 0, y: 0, width: 200, height: 50 }), [c, f] = ae(0), [d, m] = ae(0), [p, b] = ae(0), x = Se(1), v = Se(performance.now()), C = Se(0), R = Se(!1), [E, A] = ae(null), [T, I] = ae(null), g = Se(null), P = ft(
|
|
1061
1061
|
(w) => {
|
|
1062
1062
|
if (!n || !E)
|
|
1063
1063
|
return;
|
|
@@ -1128,7 +1128,7 @@ function Yo({ selectedElement: e, ref: t }) {
|
|
|
1128
1128
|
toggleFormattingProperty: D
|
|
1129
1129
|
};
|
|
1130
1130
|
}
|
|
1131
|
-
function
|
|
1131
|
+
function Lo({
|
|
1132
1132
|
width: e,
|
|
1133
1133
|
height: t,
|
|
1134
1134
|
zoom: n,
|
|
@@ -1141,12 +1141,12 @@ function Ho({
|
|
|
1141
1141
|
artboardManager: f,
|
|
1142
1142
|
focusedPieceRect: d
|
|
1143
1143
|
}) {
|
|
1144
|
-
const [m, p] =
|
|
1144
|
+
const [m, p] = ae(!1);
|
|
1145
1145
|
Pe(() => {
|
|
1146
1146
|
const V = "ontouchstart" in window || navigator.maxTouchPoints > 0;
|
|
1147
1147
|
p(V);
|
|
1148
1148
|
}, []);
|
|
1149
|
-
const b =
|
|
1149
|
+
const b = Se(null);
|
|
1150
1150
|
Pe(() => {
|
|
1151
1151
|
const V = (O) => {
|
|
1152
1152
|
b.current = O.target, setTimeout(() => {
|
|
@@ -1157,7 +1157,7 @@ function Ho({
|
|
|
1157
1157
|
document.removeEventListener("touchstart", V, { capture: !0 }), document.removeEventListener("pointerdown", V, { capture: !0 });
|
|
1158
1158
|
};
|
|
1159
1159
|
}, []);
|
|
1160
|
-
const [x, v] =
|
|
1160
|
+
const [x, v] = ae({
|
|
1161
1161
|
width: e ?? window.innerWidth,
|
|
1162
1162
|
height: t ?? window.innerHeight
|
|
1163
1163
|
});
|
|
@@ -1199,7 +1199,7 @@ function Ho({
|
|
|
1199
1199
|
};
|
|
1200
1200
|
}
|
|
1201
1201
|
function _o() {
|
|
1202
|
-
const [e, t] =
|
|
1202
|
+
const [e, t] = ae([]), [n, s] = ae([]), [o, i] = ae(!1), [a, l] = ae(!1), [c, f] = ae(0), [d, m] = ae(0), [, p] = ae(0);
|
|
1203
1203
|
return {
|
|
1204
1204
|
snapGuides: e,
|
|
1205
1205
|
setSnapGuides: t,
|
|
@@ -1216,7 +1216,7 @@ function _o() {
|
|
|
1216
1216
|
};
|
|
1217
1217
|
}
|
|
1218
1218
|
function $o({ elements: e }) {
|
|
1219
|
-
const [, t] =
|
|
1219
|
+
const [, t] = ae({}), [n, s] = ae(0), [o, i] = ae(0), [a, l] = ae(0), c = ft(() => {
|
|
1220
1220
|
i((f) => f + 1);
|
|
1221
1221
|
}, []);
|
|
1222
1222
|
return Pe(() => qr((d) => {
|
|
@@ -1411,67 +1411,67 @@ function Go(e) {
|
|
|
1411
1411
|
t.save(), t.translate(N.x, N.y);
|
|
1412
1412
|
const V = N.rotation ?? 0;
|
|
1413
1413
|
V === 90 ? (t.translate(N.width, 0), t.rotate(Math.PI / 2)) : V === 180 ? (t.translate(N.width, N.height), t.rotate(Math.PI)) : V === 270 && (t.translate(0, N.height), t.rotate(3 * Math.PI / 2));
|
|
1414
|
-
const O = V === 90 || V === 270, u = O ? N.height : N.width, q = O ? N.width : N.height, U = Ko(D, u, q), te = Uo(D, N, u, q),
|
|
1414
|
+
const O = V === 90 || V === 270, u = O ? N.height : N.width, q = O ? N.width : N.height, U = Ko(D, u, q), te = Uo(D, N, u, q), ce = !0, L = Math.max(0, (D == null ? void 0 : D.outerRadius) ?? 0), me = D != null && D.boundary && D.boundary.kind === "path" ? D.boundary : null, ye = me ?? (L > 0 ? {
|
|
1415
1415
|
kind: "roundedRect",
|
|
1416
1416
|
x: 0,
|
|
1417
1417
|
y: 0,
|
|
1418
1418
|
width: u,
|
|
1419
1419
|
height: q,
|
|
1420
|
-
rx:
|
|
1421
|
-
ry:
|
|
1420
|
+
rx: L,
|
|
1421
|
+
ry: L
|
|
1422
1422
|
} : {
|
|
1423
1423
|
kind: "rect",
|
|
1424
1424
|
x: 0,
|
|
1425
1425
|
y: 0,
|
|
1426
1426
|
width: u,
|
|
1427
1427
|
height: q
|
|
1428
|
-
};
|
|
1429
|
-
if (
|
|
1430
|
-
const
|
|
1431
|
-
if (
|
|
1432
|
-
const
|
|
1428
|
+
}), ve = L > 0 || me !== null;
|
|
1429
|
+
if (ve && (t.save(), me ? t.clip(new Path2D(me.d), "nonzero") : (t.beginPath(), Vo(t, ye), t.clip())), a.bleed && m.bleedOpacity > 0) {
|
|
1430
|
+
const de = m.bleedInnerEdge === "safeArea" && te ? te : U;
|
|
1431
|
+
if (de) {
|
|
1432
|
+
const Me = f ? "screen" : "multiply", Ae = m.bleedOpacity;
|
|
1433
1433
|
m.bleedMode === "solid" ? jo(
|
|
1434
1434
|
t,
|
|
1435
|
-
|
|
1436
|
-
|
|
1435
|
+
ye,
|
|
1436
|
+
de,
|
|
1437
1437
|
p,
|
|
1438
|
-
|
|
1439
|
-
|
|
1438
|
+
Ae,
|
|
1439
|
+
Me
|
|
1440
1440
|
) : qo(
|
|
1441
1441
|
t,
|
|
1442
1442
|
u,
|
|
1443
1443
|
q,
|
|
1444
|
-
|
|
1445
|
-
|
|
1444
|
+
ye,
|
|
1445
|
+
de,
|
|
1446
1446
|
p,
|
|
1447
|
-
|
|
1447
|
+
Ae,
|
|
1448
1448
|
m.bleedBlurScale,
|
|
1449
1449
|
i,
|
|
1450
|
-
|
|
1450
|
+
Me
|
|
1451
1451
|
);
|
|
1452
1452
|
}
|
|
1453
1453
|
}
|
|
1454
1454
|
if (a.zones)
|
|
1455
|
-
for (const
|
|
1456
|
-
|
|
1455
|
+
for (const de of w)
|
|
1456
|
+
de.kind !== "dieCut" && (t.save(), t.fillStyle = m.zoneFill[de.kind] ?? jn.zoneFill[de.kind], ns(t, de.path), t.strokeStyle = m.zoneStroke[de.kind] ?? jn.zoneStroke[de.kind], Jn(
|
|
1457
1457
|
t,
|
|
1458
1458
|
1.5,
|
|
1459
|
-
|
|
1460
|
-
), es(t,
|
|
1459
|
+
de.kind === "wrap" ? [4, 3] : []
|
|
1460
|
+
), es(t, de.path), t.setLineDash([]), t.restore());
|
|
1461
1461
|
if (a.zones)
|
|
1462
|
-
for (const
|
|
1463
|
-
|
|
1462
|
+
for (const de of w)
|
|
1463
|
+
de.kind === "dieCut" && (m.dieCutMode === "knockout" ? ei(
|
|
1464
1464
|
t,
|
|
1465
|
-
|
|
1465
|
+
de,
|
|
1466
1466
|
m.dieCutStroke,
|
|
1467
1467
|
m.dieCutStrokeWidthPx,
|
|
1468
1468
|
e.interacting === !0,
|
|
1469
|
-
|
|
1469
|
+
ce,
|
|
1470
1470
|
C,
|
|
1471
1471
|
m.dieCutBlurPx
|
|
1472
1472
|
) : Jo(
|
|
1473
1473
|
t,
|
|
1474
|
-
|
|
1474
|
+
de,
|
|
1475
1475
|
C,
|
|
1476
1476
|
b,
|
|
1477
1477
|
m.dieCutTintAlpha,
|
|
@@ -1479,7 +1479,7 @@ function Go(e) {
|
|
|
1479
1479
|
m.dieCutStroke,
|
|
1480
1480
|
m.dieCutStrokeWidthPx
|
|
1481
1481
|
));
|
|
1482
|
-
a.boundary && x && m.boundaryStrokeWidthPx > 0 && (t.save(), t.strokeStyle = x, Jn(t, m.boundaryStrokeWidthPx), es(t, U), t.restore()), a.safeArea && te && m.safeAreaStroke && (t.save(), t.strokeStyle = m.safeAreaStroke, Jn(t, m.safeAreaStrokeWidthPx, m.safeAreaDashPx), es(t, te), t.setLineDash([]), t.restore()), a.labels && ne.length > 0 && ti(t, ne, m, i),
|
|
1482
|
+
a.boundary && x && m.boundaryStrokeWidthPx > 0 && (t.save(), t.strokeStyle = x, Jn(t, m.boundaryStrokeWidthPx), es(t, U), t.restore()), a.safeArea && te && m.safeAreaStroke && (t.save(), t.strokeStyle = m.safeAreaStroke, Jn(t, m.safeAreaStrokeWidthPx, m.safeAreaDashPx), es(t, te), t.setLineDash([]), t.restore()), a.labels && ne.length > 0 && ti(t, ne, m, i), ve && t.restore(), t.restore();
|
|
1483
1483
|
}
|
|
1484
1484
|
t.restore();
|
|
1485
1485
|
}
|
|
@@ -1559,41 +1559,41 @@ function ri(e) {
|
|
|
1559
1559
|
currentRotation: c,
|
|
1560
1560
|
isMarqueeSelecting: f,
|
|
1561
1561
|
zoom: d = 1
|
|
1562
|
-
} = e, m = n.filter((
|
|
1562
|
+
} = e, m = n.filter((ve) => o.has(ve));
|
|
1563
1563
|
if (m.length === 0)
|
|
1564
1564
|
return { updatedOBB: null, groupBounds: null };
|
|
1565
1565
|
const p = i._multiSelectionDragContext, b = i.getMode() === "drag" && p;
|
|
1566
|
-
m.forEach((
|
|
1567
|
-
let
|
|
1566
|
+
m.forEach((ve) => {
|
|
1567
|
+
let de = s.find((Me) => Me.id === ve);
|
|
1568
1568
|
if (b && p.currentElements) {
|
|
1569
|
-
const
|
|
1570
|
-
|
|
1569
|
+
const Me = p.currentElements.get(ve);
|
|
1570
|
+
Me && (de = Me);
|
|
1571
1571
|
}
|
|
1572
|
-
if (
|
|
1573
|
-
const
|
|
1574
|
-
t.save(),
|
|
1572
|
+
if (de) {
|
|
1573
|
+
const Me = de.getVisualBoundingBox(), Ae = de.getRotationAnchor();
|
|
1574
|
+
t.save(), de.rotation !== 0 && (t.translate(Ae.x, Ae.y), t.rotate(-de.rotation * Math.PI / 180), t.translate(-Ae.x, -Ae.y)), t.strokeStyle = Cn(), t.lineWidth = _n(d), t.strokeRect(Me.x, Me.y, Me.width, Me.height), t.restore();
|
|
1575
1575
|
}
|
|
1576
1576
|
});
|
|
1577
|
-
let x = m.map((
|
|
1578
|
-
if (b && p.currentElements && (x = x.map((
|
|
1577
|
+
let x = m.map((ve) => s.find((de) => de.id === ve)).filter((ve) => ve !== void 0);
|
|
1578
|
+
if (b && p.currentElements && (x = x.map((ve) => p.currentElements.get(ve.id) || ve)), x.length === 0)
|
|
1579
1579
|
return { updatedOBB: null, groupBounds: null };
|
|
1580
1580
|
let v = 1 / 0, C = 1 / 0, R = -1 / 0, E = -1 / 0;
|
|
1581
|
-
x.forEach((
|
|
1582
|
-
const
|
|
1583
|
-
{ x:
|
|
1584
|
-
{ x:
|
|
1585
|
-
{ x:
|
|
1586
|
-
{ x:
|
|
1581
|
+
x.forEach((ve) => {
|
|
1582
|
+
const de = ve.getVisualBoundingBox(), Me = [
|
|
1583
|
+
{ x: de.x, y: de.y },
|
|
1584
|
+
{ x: de.x + de.width, y: de.y },
|
|
1585
|
+
{ x: de.x, y: de.y + de.height },
|
|
1586
|
+
{ x: de.x + de.width, y: de.y + de.height }
|
|
1587
1587
|
];
|
|
1588
|
-
if (
|
|
1589
|
-
const
|
|
1590
|
-
|
|
1591
|
-
const ct = pt.x -
|
|
1592
|
-
pt.x =
|
|
1588
|
+
if (ve.rotation !== 0) {
|
|
1589
|
+
const Ae = ve.getRotationAnchor(), Be = -ve.rotation * Math.PI / 180, $e = Math.cos(Be), at = Math.sin(Be);
|
|
1590
|
+
Me.forEach((pt) => {
|
|
1591
|
+
const ct = pt.x - Ae.x, Pt = pt.y - Ae.y;
|
|
1592
|
+
pt.x = Ae.x + (ct * $e - Pt * at), pt.y = Ae.y + (ct * at + Pt * $e);
|
|
1593
1593
|
});
|
|
1594
1594
|
}
|
|
1595
|
-
|
|
1596
|
-
v = Math.min(v,
|
|
1595
|
+
Me.forEach((Ae) => {
|
|
1596
|
+
v = Math.min(v, Ae.x), C = Math.min(C, Ae.y), R = Math.max(R, Ae.x), E = Math.max(E, Ae.y);
|
|
1597
1597
|
});
|
|
1598
1598
|
});
|
|
1599
1599
|
const A = R - v, T = E - C, I = (v + R) / 2, g = (C + E) / 2;
|
|
@@ -1605,49 +1605,49 @@ function ri(e) {
|
|
|
1605
1605
|
height: T,
|
|
1606
1606
|
rotation: 0
|
|
1607
1607
|
}), i.getMode() === "drag" && i._multiSelectionDragContext) {
|
|
1608
|
-
const
|
|
1609
|
-
if (
|
|
1610
|
-
const { dx:
|
|
1608
|
+
const ve = i._multiSelectionDragContext;
|
|
1609
|
+
if (ve != null && ve.startOBB && (ve != null && ve.currentDelta)) {
|
|
1610
|
+
const { dx: de, dy: Me } = ve.currentDelta;
|
|
1611
1611
|
P = {
|
|
1612
1612
|
...P,
|
|
1613
|
-
centerX:
|
|
1614
|
-
centerY:
|
|
1613
|
+
centerX: ve.startOBB.centerX + de,
|
|
1614
|
+
centerY: ve.startOBB.centerY + Me
|
|
1615
1615
|
};
|
|
1616
1616
|
} else
|
|
1617
1617
|
P = { ...P, centerX: I, centerY: g };
|
|
1618
1618
|
}
|
|
1619
|
-
const w = l && i.getMode() === "rotate" ? P.rotation + c : P.rotation, ne = P.width, V = P.height, O = P.centerX, u = P.centerY, q = O - ne / 2, U = u - V / 2, te = O + ne / 2,
|
|
1620
|
-
let
|
|
1619
|
+
const w = l && i.getMode() === "rotate" ? P.rotation + c : P.rotation, ne = P.width, V = P.height, O = P.centerX, u = P.centerY, q = O - ne / 2, U = u - V / 2, te = O + ne / 2, ce = u + V / 2;
|
|
1620
|
+
let L = O, me = ce + jr;
|
|
1621
1621
|
if (w !== 0) {
|
|
1622
|
-
const
|
|
1623
|
-
|
|
1622
|
+
const ve = -w * Math.PI / 180, de = Math.cos(ve), Me = Math.sin(ve), Ae = L - O, Be = me - u;
|
|
1623
|
+
L = O + (Ae * de - Be * Me), me = u + (Ae * Me + Be * de);
|
|
1624
1624
|
}
|
|
1625
|
-
const
|
|
1625
|
+
const ye = {
|
|
1626
1626
|
minX: q,
|
|
1627
1627
|
minY: U,
|
|
1628
1628
|
maxX: te,
|
|
1629
|
-
maxY:
|
|
1629
|
+
maxY: ce,
|
|
1630
1630
|
centerX: O,
|
|
1631
1631
|
centerY: u,
|
|
1632
|
-
rotationHandleX:
|
|
1633
|
-
rotationHandleY:
|
|
1632
|
+
rotationHandleX: L,
|
|
1633
|
+
rotationHandleY: me,
|
|
1634
1634
|
rotation: w
|
|
1635
1635
|
};
|
|
1636
1636
|
return t.save(), t.translate(O, u), t.rotate(-w * Math.PI / 180), t.translate(-O, -u), t.strokeStyle = Cn(), t.lineWidth = _n(d), t.setLineDash(so(d)), t.strokeRect(q, U, ne, V), t.restore(), f || oi(t, {
|
|
1637
1637
|
renderMinX: q,
|
|
1638
1638
|
renderMinY: U,
|
|
1639
1639
|
renderMaxX: te,
|
|
1640
|
-
renderMaxY:
|
|
1640
|
+
renderMaxY: ce,
|
|
1641
1641
|
renderCenterX: O,
|
|
1642
1642
|
renderCenterY: u,
|
|
1643
1643
|
renderWidth: ne,
|
|
1644
1644
|
renderHeight: V,
|
|
1645
1645
|
groupRotation: w,
|
|
1646
|
-
rotationHandleX:
|
|
1647
|
-
rotationHandleY:
|
|
1646
|
+
rotationHandleX: L,
|
|
1647
|
+
rotationHandleY: me,
|
|
1648
1648
|
stateMachine: i,
|
|
1649
1649
|
zoom: d
|
|
1650
|
-
}), { updatedOBB: P, groupBounds:
|
|
1650
|
+
}), { updatedOBB: P, groupBounds: ye };
|
|
1651
1651
|
}
|
|
1652
1652
|
function oi(e, t) {
|
|
1653
1653
|
var A;
|
|
@@ -1697,7 +1697,7 @@ function ci(e) {
|
|
|
1697
1697
|
t.save(), t.translate(o.x + o.width / 2, o.y + o.height / 2), t.rotate(-n.rotation * Math.PI / 180), t.translate(-(o.x + o.width / 2), -(o.y + o.height / 2)), t.strokeStyle = Jr(), t.lineWidth = _n(s), t.setLineDash([]), t.strokeRect(o.x, o.y, o.width, o.height), t.restore();
|
|
1698
1698
|
}
|
|
1699
1699
|
const li = 60;
|
|
1700
|
-
class
|
|
1700
|
+
class Ln {
|
|
1701
1701
|
constructor() {
|
|
1702
1702
|
this.frameTimes = [], this.metrics = {
|
|
1703
1703
|
frameTime: 0,
|
|
@@ -1708,7 +1708,7 @@ class Hn {
|
|
|
1708
1708
|
};
|
|
1709
1709
|
}
|
|
1710
1710
|
static getInstance() {
|
|
1711
|
-
return
|
|
1711
|
+
return Ln.instance || (Ln.instance = new Ln()), Ln.instance;
|
|
1712
1712
|
}
|
|
1713
1713
|
/**
|
|
1714
1714
|
* Record a single frame's render duration. Maintains a rolling window
|
|
@@ -1776,9 +1776,9 @@ function di(e, t, n) {
|
|
|
1776
1776
|
};
|
|
1777
1777
|
}
|
|
1778
1778
|
function ui(e) {
|
|
1779
|
-
const t =
|
|
1779
|
+
const t = Se(e);
|
|
1780
1780
|
t.current = e;
|
|
1781
|
-
const n =
|
|
1781
|
+
const n = Se(!0), s = Se(null), o = Se("#0a0a0a");
|
|
1782
1782
|
Pe(() => {
|
|
1783
1783
|
const i = t.current.canvasRef.current ?? document.documentElement, a = getComputedStyle(i).getPropertyValue("--color-canvas-bg").trim();
|
|
1784
1784
|
o.current = a || "#0a0a0a";
|
|
@@ -1827,7 +1827,7 @@ function ui(e) {
|
|
|
1827
1827
|
if (c.startTime !== null && c.type !== null && performance.now() - c.startTime < 150 && (n.current = !0), n.current) {
|
|
1828
1828
|
n.current = !1;
|
|
1829
1829
|
const f = performance.now();
|
|
1830
|
-
hi(t.current, o, s),
|
|
1830
|
+
hi(t.current, o, s), Ln.getInstance().recordFrameTime(performance.now() - f);
|
|
1831
1831
|
}
|
|
1832
1832
|
i = requestAnimationFrame(l);
|
|
1833
1833
|
};
|
|
@@ -1868,15 +1868,15 @@ function hi(e, t, n) {
|
|
|
1868
1868
|
selectionEnd: q,
|
|
1869
1869
|
cursorOpacityRef: U,
|
|
1870
1870
|
cursorStartTimeRef: te,
|
|
1871
|
-
isTouchDevice:
|
|
1872
|
-
selectionHandlePositionsRef:
|
|
1873
|
-
multiClickSelectionRef:
|
|
1874
|
-
lastMultiClickTimeRef:
|
|
1875
|
-
MULTI_CLICK_DEBOUNCE:
|
|
1876
|
-
snapGuides:
|
|
1877
|
-
spacingIndicators:
|
|
1878
|
-
isAltKeyPressed:
|
|
1879
|
-
multiSelection:
|
|
1871
|
+
isTouchDevice: ce,
|
|
1872
|
+
selectionHandlePositionsRef: L,
|
|
1873
|
+
multiClickSelectionRef: me,
|
|
1874
|
+
lastMultiClickTimeRef: ye,
|
|
1875
|
+
MULTI_CLICK_DEBOUNCE: ve,
|
|
1876
|
+
snapGuides: de,
|
|
1877
|
+
spacingIndicators: Me,
|
|
1878
|
+
isAltKeyPressed: Ae,
|
|
1879
|
+
multiSelection: Be,
|
|
1880
1880
|
multiSelectionOBBRef: $e,
|
|
1881
1881
|
multiSelectionGroupBoundsRef: at,
|
|
1882
1882
|
isMarqueeSelecting: pt,
|
|
@@ -1891,15 +1891,15 @@ function hi(e, t, n) {
|
|
|
1891
1891
|
const se = lt.getContext("2d");
|
|
1892
1892
|
if (!se) return;
|
|
1893
1893
|
if (w) {
|
|
1894
|
-
const Ue = (
|
|
1894
|
+
const Ue = (ge) => ge < 0.5 ? 4 * ge * ge * ge : 1 - Math.pow(-2 * ge + 2, 3) / 2, K = (performance.now() - te.current) % 1060 / 1060, ue = K < 0.5 ? 1 - Ue(K * 2) : Ue((K - 0.5) * 2);
|
|
1895
1895
|
U.current = ue;
|
|
1896
1896
|
} else
|
|
1897
1897
|
U.current = 1;
|
|
1898
1898
|
const h = window.devicePixelRatio || 1, G = v * A, re = C * A;
|
|
1899
1899
|
if (G <= 0 || re <= 0) return;
|
|
1900
|
-
const he = 4096, _ = G * h,
|
|
1900
|
+
const he = 4096, _ = G * h, we = re * h, Ie = Math.max(_, we), Ve = Ie > he ? he / Ie : 1, Xe = h * Ve;
|
|
1901
1901
|
lt.width = G * Xe, lt.height = re * Xe, se.setTransform(1, 0, 0, 1, 0, 0), se.clearRect(0, 0, lt.width, lt.height);
|
|
1902
|
-
const
|
|
1902
|
+
const H = t.current;
|
|
1903
1903
|
se.scale(Xe, Xe), A !== 1 && se.scale(A, A), (R !== 0 || E !== 0) && se.translate(R, E);
|
|
1904
1904
|
const $ = a.find((Ke) => Ke.id === l.getActiveArtboardId()), ot = ($ == null ? void 0 : $.id) ?? null, rt = Ee && $ ? di(
|
|
1905
1905
|
Ee.pieces,
|
|
@@ -1908,11 +1908,11 @@ function hi(e, t, n) {
|
|
|
1908
1908
|
) : void 0;
|
|
1909
1909
|
let Ze = Ee ? 0 : T;
|
|
1910
1910
|
if (Ee && Ee.pieces.length === 1 && $) {
|
|
1911
|
-
const Ke = Ee.pieces[0].id,
|
|
1912
|
-
|
|
1911
|
+
const Ke = Ee.pieces[0].id, Ne = (rn = Ee.guides) == null ? void 0 : rn[Ke], K = Ne == null ? void 0 : Ne.outerRadius, ue = Ne == null ? void 0 : Ne.boundary, ge = ue && typeof ue == "object" && ue.kind === "roundedRect" ? ue.rx ?? ue.ry : void 0, Oe = typeof K == "number" && K > 0 ? K : typeof ge == "number" && ge > 0 ? ge : 0;
|
|
1912
|
+
Oe > 0 && (Ze = Oe);
|
|
1913
1913
|
}
|
|
1914
1914
|
if ($ && !Ee)
|
|
1915
|
-
if (se.fillStyle =
|
|
1915
|
+
if (se.fillStyle = H, rt && typeof rt == "object" && rt.type === "path")
|
|
1916
1916
|
try {
|
|
1917
1917
|
const Ke = new Path2D(rt.d);
|
|
1918
1918
|
se.save(), se.translate($.x, $.y), se.fill(Ke), se.restore();
|
|
@@ -1941,7 +1941,7 @@ function hi(e, t, n) {
|
|
|
1941
1941
|
if (x.getMode() === "drag" && d) {
|
|
1942
1942
|
const Ue = x.getContext()._cachedElement;
|
|
1943
1943
|
Ue && Ue[d.id] && (Nt = Nt.map(
|
|
1944
|
-
(
|
|
1944
|
+
(Ne) => Ne.id === d.id ? Ue[d.id] : Ne
|
|
1945
1945
|
), m || (gt = Ue[d.id]));
|
|
1946
1946
|
}
|
|
1947
1947
|
if (w && d) {
|
|
@@ -1950,17 +1950,17 @@ function hi(e, t, n) {
|
|
|
1950
1950
|
let K = null;
|
|
1951
1951
|
if (Ke && d instanceof Re) {
|
|
1952
1952
|
const ue = Nt.find(
|
|
1953
|
-
(
|
|
1953
|
+
(ge) => ge.id === d.id && ge instanceof Re
|
|
1954
1954
|
);
|
|
1955
1955
|
if (ue) {
|
|
1956
|
-
const
|
|
1957
|
-
|
|
1958
|
-
if (
|
|
1959
|
-
const Je =
|
|
1956
|
+
const ge = ue.clone();
|
|
1957
|
+
ge.children = ge.children.map((Oe) => {
|
|
1958
|
+
if (Oe.id === Ke && V && Oe instanceof Qe) {
|
|
1959
|
+
const Je = Oe.clone();
|
|
1960
1960
|
return Je.setRichText(V), Je;
|
|
1961
1961
|
}
|
|
1962
|
-
return
|
|
1963
|
-
}), K =
|
|
1962
|
+
return Oe;
|
|
1963
|
+
}), K = ge;
|
|
1964
1964
|
}
|
|
1965
1965
|
} else if (V && d instanceof Qe) {
|
|
1966
1966
|
const ue = d.clone();
|
|
@@ -1988,10 +1988,10 @@ function hi(e, t, n) {
|
|
|
1988
1988
|
hoverState: D,
|
|
1989
1989
|
isEditing: w,
|
|
1990
1990
|
stateMachine: x,
|
|
1991
|
-
snapGuides:
|
|
1992
|
-
spacingIndicators:
|
|
1991
|
+
snapGuides: de,
|
|
1992
|
+
spacingIndicators: Me,
|
|
1993
1993
|
hideHandles: Dt,
|
|
1994
|
-
isAltKeyPressed:
|
|
1994
|
+
isAltKeyPressed: Ae,
|
|
1995
1995
|
artboardBackgroundColor: $ == null ? void 0 : $.backgroundColor,
|
|
1996
1996
|
distressTexture: $ == null ? void 0 : $.distressTexture,
|
|
1997
1997
|
imageMask: $ == null ? void 0 : $.imageMask,
|
|
@@ -2016,16 +2016,16 @@ function hi(e, t, n) {
|
|
|
2016
2016
|
suppressOverflowDim: !1,
|
|
2017
2017
|
showRotationHandle: g,
|
|
2018
2018
|
editModeData: w ? (() => {
|
|
2019
|
-
const Ke =
|
|
2019
|
+
const Ke = me.current, Ue = Date.now() - ye.current < ve, Ne = Ke && Ue;
|
|
2020
2020
|
return {
|
|
2021
|
-
cursorPosition:
|
|
2022
|
-
selectionStart:
|
|
2023
|
-
selectionEnd:
|
|
2021
|
+
cursorPosition: Ne ? Ke.cursor : O,
|
|
2022
|
+
selectionStart: Ne ? Ke.start : u,
|
|
2023
|
+
selectionEnd: Ne ? Ke.end : q,
|
|
2024
2024
|
editText: ne,
|
|
2025
2025
|
editRichText: V,
|
|
2026
2026
|
cursorOpacity: U.current,
|
|
2027
|
-
isTouchDevice:
|
|
2028
|
-
selectionHandlePositionsRef:
|
|
2027
|
+
isTouchDevice: ce,
|
|
2028
|
+
selectionHandlePositionsRef: L
|
|
2029
2029
|
};
|
|
2030
2030
|
})() : void 0
|
|
2031
2031
|
}), Ee && Ee.pieces.length > 0 && $) {
|
|
@@ -2033,16 +2033,16 @@ function hi(e, t, n) {
|
|
|
2033
2033
|
const Ue = gt ?? null;
|
|
2034
2034
|
if (Ue && Ee) {
|
|
2035
2035
|
const ue = Ue.getVisualBoundingBox();
|
|
2036
|
-
e: for (const
|
|
2037
|
-
const
|
|
2038
|
-
for (const Je of
|
|
2036
|
+
e: for (const ge of Ee.pieces) {
|
|
2037
|
+
const Oe = ((Ut = (on = Ee.guides) == null ? void 0 : on[ge.id]) == null ? void 0 : Ut.zones) ?? [];
|
|
2038
|
+
for (const Je of Oe) {
|
|
2039
2039
|
if (Je.kind !== "dieCut") continue;
|
|
2040
2040
|
const Ge = Je.path;
|
|
2041
2041
|
if (Ge.kind !== "rect" && Ge.kind !== "roundedRect") {
|
|
2042
2042
|
Ke = !0;
|
|
2043
2043
|
break e;
|
|
2044
2044
|
}
|
|
2045
|
-
const Fe =
|
|
2045
|
+
const Fe = ge.x + (Ge.x ?? 0), nt = ge.y + (Ge.y ?? 0), st = Ge.width ?? 0, xt = Ge.height ?? 0;
|
|
2046
2046
|
if (ue.x < Fe + st && ue.x + ue.width > Fe && ue.y < nt + xt && ue.y + ue.height > nt) {
|
|
2047
2047
|
Ke = !0;
|
|
2048
2048
|
break e;
|
|
@@ -2050,7 +2050,7 @@ function hi(e, t, n) {
|
|
|
2050
2050
|
}
|
|
2051
2051
|
}
|
|
2052
2052
|
}
|
|
2053
|
-
const
|
|
2053
|
+
const Ne = Ke, K = Ze > 0 && $ !== void 0;
|
|
2054
2054
|
if (K && (se.save(), se.beginPath(), se.roundRect(
|
|
2055
2055
|
$.x,
|
|
2056
2056
|
$.y,
|
|
@@ -2067,16 +2067,16 @@ function hi(e, t, n) {
|
|
|
2067
2067
|
show: Ee.show,
|
|
2068
2068
|
style: Ee.style,
|
|
2069
2069
|
zoom: A,
|
|
2070
|
-
interacting:
|
|
2070
|
+
interacting: Ne,
|
|
2071
2071
|
focusedPieceId: e.focusedPieceId ?? null
|
|
2072
2072
|
}), K && se.restore(), e.focusedPieceId && Ee.pieces.length > 1) {
|
|
2073
|
-
const ue = e.focusedPieceRect ?? Ee.pieces.find((
|
|
2073
|
+
const ue = e.focusedPieceRect ?? Ee.pieces.find((ge) => ge.id === e.focusedPieceId) ?? null;
|
|
2074
2074
|
if (ue) {
|
|
2075
2075
|
se.save(), se.translate($.x, $.y), se.globalCompositeOperation = "destination-out";
|
|
2076
|
-
const
|
|
2077
|
-
se.globalAlpha =
|
|
2078
|
-
const
|
|
2079
|
-
se.rect(-
|
|
2076
|
+
const ge = !!d;
|
|
2077
|
+
se.globalAlpha = ge ? 1 - 0.3 : 1, se.fillStyle = "#000", se.beginPath();
|
|
2078
|
+
const Oe = 1e7;
|
|
2079
|
+
se.rect(-Oe, -Oe, 2 * Oe, 2 * Oe), se.rect(
|
|
2080
2080
|
ue.x,
|
|
2081
2081
|
ue.y,
|
|
2082
2082
|
ue.width,
|
|
@@ -2096,7 +2096,7 @@ function hi(e, t, n) {
|
|
|
2096
2096
|
selectedId: f,
|
|
2097
2097
|
hideHandles: Dt,
|
|
2098
2098
|
isEditing: w,
|
|
2099
|
-
isAltKeyPressed:
|
|
2099
|
+
isAltKeyPressed: Ae,
|
|
2100
2100
|
artboardBackgroundColor: $.backgroundColor,
|
|
2101
2101
|
// Hover ring is clipped to the visible artboard / piece bounds
|
|
2102
2102
|
// so it doesn't paint into the overflow region. Uses the piece-
|
|
@@ -2115,11 +2115,11 @@ function hi(e, t, n) {
|
|
|
2115
2115
|
zoom: A,
|
|
2116
2116
|
paddingOffset: { x: R, y: E }
|
|
2117
2117
|
});
|
|
2118
|
-
const tn = pt ? zt :
|
|
2118
|
+
const tn = pt ? zt : Be, Ht = new Set(Nt.map((Ke) => Ke.id)), { updatedOBB: wt, groupBounds: Xt } = ri({
|
|
2119
2119
|
ctx: se,
|
|
2120
2120
|
displaySelection: tn,
|
|
2121
2121
|
elements: o,
|
|
2122
|
-
activeArtboardElementIds:
|
|
2122
|
+
activeArtboardElementIds: Ht,
|
|
2123
2123
|
stateMachine: x,
|
|
2124
2124
|
multiSelectionOBB: $e.current,
|
|
2125
2125
|
isRotating: P,
|
|
@@ -2270,17 +2270,17 @@ function xi(e) {
|
|
|
2270
2270
|
function yi(e) {
|
|
2271
2271
|
const { selectedElement: t, activeChildElement: n } = e;
|
|
2272
2272
|
let s = null, o = -1;
|
|
2273
|
-
if (n instanceof
|
|
2273
|
+
if (n instanceof Yt && n.isCropping)
|
|
2274
2274
|
s = n, t instanceof Re && (o = t.children.findIndex((a) => a.id === n.id));
|
|
2275
2275
|
else if (t instanceof Re)
|
|
2276
2276
|
for (let a = 0; a < t.children.length; a++) {
|
|
2277
2277
|
const l = t.children[a];
|
|
2278
|
-
if (l.visible !== !1 && l instanceof
|
|
2278
|
+
if (l.visible !== !1 && l instanceof Yt && l.isCropping) {
|
|
2279
2279
|
s = l, o = a;
|
|
2280
2280
|
break;
|
|
2281
2281
|
}
|
|
2282
2282
|
}
|
|
2283
|
-
const i = s || (t instanceof
|
|
2283
|
+
const i = s || (t instanceof Yt && t.isCropping ? t : null);
|
|
2284
2284
|
return i ? {
|
|
2285
2285
|
croppingImage: i,
|
|
2286
2286
|
croppingChild: s,
|
|
@@ -2477,15 +2477,15 @@ function Mi(e) {
|
|
|
2477
2477
|
activeChildElement: q,
|
|
2478
2478
|
elements: U,
|
|
2479
2479
|
multiSelection: te,
|
|
2480
|
-
multiSelectionOBBRef:
|
|
2481
|
-
zoom:
|
|
2482
|
-
paddingOffsetX:
|
|
2483
|
-
paddingOffsetY:
|
|
2484
|
-
spacingIndicators:
|
|
2485
|
-
focusedPieceRect:
|
|
2486
|
-
setCursorPosition:
|
|
2487
|
-
setSelectionStart:
|
|
2488
|
-
setSelectionEnd:
|
|
2480
|
+
multiSelectionOBBRef: ce,
|
|
2481
|
+
zoom: L,
|
|
2482
|
+
paddingOffsetX: me,
|
|
2483
|
+
paddingOffsetY: ye,
|
|
2484
|
+
spacingIndicators: ve,
|
|
2485
|
+
focusedPieceRect: de,
|
|
2486
|
+
setCursorPosition: Me,
|
|
2487
|
+
setSelectionStart: Ae,
|
|
2488
|
+
setSelectionEnd: Be,
|
|
2489
2489
|
setIsRotating: $e,
|
|
2490
2490
|
setRotationStartAngle: at,
|
|
2491
2491
|
setCurrentRotation: pt,
|
|
@@ -2502,11 +2502,11 @@ function Mi(e) {
|
|
|
2502
2502
|
snapSystem: re,
|
|
2503
2503
|
spacingSystem: he,
|
|
2504
2504
|
penTool: _,
|
|
2505
|
-
cropController:
|
|
2505
|
+
cropController: we,
|
|
2506
2506
|
onElementUpdate: Ie,
|
|
2507
2507
|
executeElementUpdate: Ve,
|
|
2508
2508
|
onSelectionChange: Xe,
|
|
2509
|
-
onMultiSelectionChange:
|
|
2509
|
+
onMultiSelectionChange: H,
|
|
2510
2510
|
onRotationStateChange: $,
|
|
2511
2511
|
onCropModeEnter: ot,
|
|
2512
2512
|
onContextMenuRequest: rt,
|
|
@@ -2515,17 +2515,17 @@ function Mi(e) {
|
|
|
2515
2515
|
startMarqueeSelection: Nt,
|
|
2516
2516
|
updateMarqueeSelection: Dt,
|
|
2517
2517
|
finishMarqueeSelection: tn,
|
|
2518
|
-
enterTextEditMode:
|
|
2518
|
+
enterTextEditMode: Ht,
|
|
2519
2519
|
setEditPosition: wt,
|
|
2520
2520
|
setEditText: Xt,
|
|
2521
2521
|
setEditRichText: rn,
|
|
2522
2522
|
setIsEditing: on,
|
|
2523
2523
|
setCurrentFormattingStyle: Ut,
|
|
2524
2524
|
getWrappedTextForEditing: Ke
|
|
2525
|
-
} = e, Ue =
|
|
2526
|
-
|
|
2527
|
-
const
|
|
2528
|
-
|
|
2525
|
+
} = e, Ue = Se(null), Ne = Se(/* @__PURE__ */ new Map()), K = Se(null), ue = Se(null), ge = Se(null), Oe = Se(null), Je = Se(null), Ge = Se(null), Fe = Se(null), { userZoom: nt, setUserZoom: st, panOffset: xt, setPanOffset: yt } = Ts(), Lt = Se(nt);
|
|
2526
|
+
Lt.current = nt;
|
|
2527
|
+
const Ce = Se(xt);
|
|
2528
|
+
Ce.current = xt, Pe(() => {
|
|
2529
2529
|
const z = t.current;
|
|
2530
2530
|
if (!z) return;
|
|
2531
2531
|
const fe = () => {
|
|
@@ -2537,7 +2537,7 @@ function Mi(e) {
|
|
|
2537
2537
|
}, [t]), Pe(() => {
|
|
2538
2538
|
const z = t.current;
|
|
2539
2539
|
z && (Ue.current = z.getBoundingClientRect());
|
|
2540
|
-
}, [
|
|
2540
|
+
}, [L, t]);
|
|
2541
2541
|
const as = ft(
|
|
2542
2542
|
(z) => {
|
|
2543
2543
|
var j, pe, ke, ee, J;
|
|
@@ -2546,16 +2546,16 @@ function Mi(e) {
|
|
|
2546
2546
|
if (!fe) return;
|
|
2547
2547
|
const dt = fe.getBoundingClientRect();
|
|
2548
2548
|
Ue.current = dt;
|
|
2549
|
-
const W = (z.clientX - dt.left) /
|
|
2550
|
-
|
|
2549
|
+
const W = (z.clientX - dt.left) / L - me, Z = (z.clientY - dt.top) / L - ye;
|
|
2550
|
+
Ne.current.size === 0 && (ge.current = (u == null ? void 0 : u.id) ?? null), Ne.current.set(z.pointerId, {
|
|
2551
2551
|
x: W,
|
|
2552
2552
|
y: Z,
|
|
2553
2553
|
clientX: z.clientX,
|
|
2554
2554
|
clientY: z.clientY
|
|
2555
2555
|
});
|
|
2556
|
-
const et = g || u instanceof
|
|
2557
|
-
if (
|
|
2558
|
-
const k = Array.from(
|
|
2556
|
+
const et = g || u instanceof Yt && u.isCropping || _.isActive();
|
|
2557
|
+
if (Ne.current.size === 2 && !et) {
|
|
2558
|
+
const k = Array.from(Ne.current.keys()), X = Ne.current.get(k[0]), M = Ne.current.get(k[1]), F = ge.current !== null;
|
|
2559
2559
|
if (!(F && u && !u.locked && (u.hitTest(X.x, X.y) || u.hitTest(M.x, M.y)))) {
|
|
2560
2560
|
if (b.current && b.current.size > 0) {
|
|
2561
2561
|
const Bt = b.current;
|
|
@@ -2566,18 +2566,18 @@ function Mi(e) {
|
|
|
2566
2566
|
})
|
|
2567
2567
|
), b.current = null;
|
|
2568
2568
|
}
|
|
2569
|
-
!F && u && Xe(null), h.isInteracting() && h.end(), Fe.current = null,
|
|
2570
|
-
const oe = M.clientX - X.clientX,
|
|
2569
|
+
!F && u && Xe(null), h.isInteracting() && h.end(), Fe.current = null, Oe.current = null, Je.current = null, delete h._pendingTextEditMode, delete h._pendingChildSelection;
|
|
2570
|
+
const oe = M.clientX - X.clientX, Te = M.clientY - X.clientY, Ye = Math.hypot(oe, Te), bt = (((j = fe.parentElement) == null ? void 0 : j.parentElement) ?? fe).getBoundingClientRect();
|
|
2571
2571
|
Ge.current = {
|
|
2572
2572
|
pointerA: k[0],
|
|
2573
2573
|
pointerB: k[1],
|
|
2574
|
-
startUserZoom:
|
|
2575
|
-
startPanOffset: { ...
|
|
2574
|
+
startUserZoom: Lt.current,
|
|
2575
|
+
startPanOffset: { ...Ce.current },
|
|
2576
2576
|
startCentroidClient: {
|
|
2577
2577
|
x: (X.clientX + M.clientX) / 2,
|
|
2578
2578
|
y: (X.clientY + M.clientY) / 2
|
|
2579
2579
|
},
|
|
2580
|
-
startDistance: Math.max(
|
|
2580
|
+
startDistance: Math.max(Ye, 1),
|
|
2581
2581
|
containerRect: { left: bt.left, top: bt.top }
|
|
2582
2582
|
};
|
|
2583
2583
|
try {
|
|
@@ -2588,21 +2588,21 @@ function Mi(e) {
|
|
|
2588
2588
|
return;
|
|
2589
2589
|
}
|
|
2590
2590
|
}
|
|
2591
|
-
if (
|
|
2591
|
+
if (Ne.current.size === 2 && u && !u.locked && !et) {
|
|
2592
2592
|
if (h.isInteracting()) {
|
|
2593
2593
|
const F = h.getContext();
|
|
2594
2594
|
if (F.element) {
|
|
2595
|
-
const
|
|
2595
|
+
const ie = gt().find(
|
|
2596
2596
|
(oe) => oe.id === F.element.id
|
|
2597
2597
|
);
|
|
2598
|
-
Ve(
|
|
2598
|
+
Ve(ie, F.element);
|
|
2599
2599
|
}
|
|
2600
2600
|
h.end();
|
|
2601
2601
|
}
|
|
2602
|
-
const k = Array.from(
|
|
2602
|
+
const k = Array.from(Ne.current.keys());
|
|
2603
2603
|
K.current = { a: k[0], b: k[1] };
|
|
2604
|
-
const X =
|
|
2605
|
-
|
|
2604
|
+
const X = Ne.current.get(k[0]), M = Ne.current.get(k[1]);
|
|
2605
|
+
Oe.current = null, Je.current = null, Fe.current = null, ue.current = u.clone(), h.startPinch(u, X, M);
|
|
2606
2606
|
try {
|
|
2607
2607
|
fe.setPointerCapture(z.pointerId);
|
|
2608
2608
|
} catch {
|
|
@@ -2614,7 +2614,7 @@ function Mi(e) {
|
|
|
2614
2614
|
if (N && D !== w) {
|
|
2615
2615
|
const k = m.current;
|
|
2616
2616
|
if (k.start || k.end) {
|
|
2617
|
-
const X = en.toRadiansInverse(u.rotation), M = u.getRotationAnchor(), F = W - M.x,
|
|
2617
|
+
const X = en.toRadiansInverse(u.rotation), M = u.getRotationAnchor(), F = W - M.x, ie = Z - M.y, oe = Math.cos(X), Te = Math.sin(X), Ye = F * oe - ie * Te, it = F * Te + ie * oe, bt = Ye, Bt = it, St = 44 / L;
|
|
2618
2618
|
if (k.start && Math.sqrt(
|
|
2619
2619
|
Math.pow(bt - k.start.center.x, 2) + Math.pow(Bt - k.start.center.y, 2)
|
|
2620
2620
|
) <= St) {
|
|
@@ -2631,7 +2631,7 @@ function Mi(e) {
|
|
|
2631
2631
|
}
|
|
2632
2632
|
if (u.hitTest(W, Z)) {
|
|
2633
2633
|
z.preventDefault(), s.current = !0;
|
|
2634
|
-
const k = u.getVisualBoundingBox(), X = en.toRadiansInverse(u.rotation), M = u.getRotationAnchor(), F = W - M.x,
|
|
2634
|
+
const k = u.getVisualBoundingBox(), X = en.toRadiansInverse(u.rotation), M = u.getRotationAnchor(), F = W - M.x, ie = Z - M.y, oe = Math.cos(X), Te = Math.sin(X), Ye = F * oe - ie * Te, it = F * Te + ie * oe, bt = Ye + k.width / 2, Bt = it + k.height / 2, St = Sn(u, { x: bt, y: Bt }), Et = Date.now();
|
|
2635
2635
|
if (Et - a.current < I) {
|
|
2636
2636
|
(ee = n.current) == null || ee.focus();
|
|
2637
2637
|
return;
|
|
@@ -2639,13 +2639,13 @@ function Mi(e) {
|
|
|
2639
2639
|
a.current = Et, Et - l.current >= T && (c.current = null), Et - o.current < A ? i.current += 1 : i.current = 1, o.current = Et;
|
|
2640
2640
|
const ut = P;
|
|
2641
2641
|
if (i.current >= 3)
|
|
2642
|
-
z.preventDefault(), l.current = Et, c.current = { start: 0, end: ut.length, cursor: ut.length }, f.current = !0, i.current = 0,
|
|
2642
|
+
z.preventDefault(), l.current = Et, c.current = { start: 0, end: ut.length, cursor: ut.length }, f.current = !0, i.current = 0, Me(ut.length), Ae(0), Be(ut.length), n.current && (n.current.focus(), n.current.setSelectionRange(0, ut.length));
|
|
2643
2643
|
else if (i.current === 2) {
|
|
2644
2644
|
z.preventDefault(), l.current = Et, f.current = !0;
|
|
2645
2645
|
const kt = xr(ut, St);
|
|
2646
|
-
c.current = { start: kt.start, end: kt.end, cursor: kt.end },
|
|
2646
|
+
c.current = { start: kt.start, end: kt.end, cursor: kt.end }, Me(kt.end), Ae(kt.start), Be(kt.end), n.current && (n.current.focus(), n.current.setSelectionRange(kt.start, kt.end));
|
|
2647
2647
|
} else
|
|
2648
|
-
c.current = null,
|
|
2648
|
+
c.current = null, Me(St), Ae(St), Be(St), n.current && (n.current.focus(), n.current.setSelectionRange(St, St)), f.current = !1;
|
|
2649
2649
|
return;
|
|
2650
2650
|
}
|
|
2651
2651
|
c.current = null, (J = n.current) == null || J.blur();
|
|
@@ -2662,7 +2662,7 @@ function Mi(e) {
|
|
|
2662
2662
|
return;
|
|
2663
2663
|
}
|
|
2664
2664
|
if (te.length > 0 && E.current) {
|
|
2665
|
-
const k = E.current, X = pi({ x: W, y: Z, bounds: k, zoom:
|
|
2665
|
+
const k = E.current, X = pi({ x: W, y: Z, bounds: k, zoom: L });
|
|
2666
2666
|
if (X.type === "corner-handle") {
|
|
2667
2667
|
if (mi({
|
|
2668
2668
|
multiSelection: te,
|
|
@@ -2709,7 +2709,7 @@ function Mi(e) {
|
|
|
2709
2709
|
if (B && B.visible !== !1 && !B.locked && (te.length === 0 || q)) {
|
|
2710
2710
|
const k = yi({ selectedElement: u || null, activeChildElement: q });
|
|
2711
2711
|
if (k) {
|
|
2712
|
-
const M = bi({ x: W, y: Z, cropContext: k, transformHandles: G, zoom:
|
|
2712
|
+
const M = bi({ x: W, y: Z, cropContext: k, transformHandles: G, zoom: L });
|
|
2713
2713
|
if (M.type === "crop-handle") {
|
|
2714
2714
|
vi({
|
|
2715
2715
|
cropContext: k,
|
|
@@ -2751,25 +2751,25 @@ function Mi(e) {
|
|
|
2751
2751
|
onElementUpdate: Ie,
|
|
2752
2752
|
transformHandles: G,
|
|
2753
2753
|
updateActiveChild: Ze,
|
|
2754
|
-
zoom:
|
|
2754
|
+
zoom: L
|
|
2755
2755
|
}), We((F) => F + 1);
|
|
2756
2756
|
return;
|
|
2757
2757
|
}
|
|
2758
2758
|
}
|
|
2759
|
-
if (G.hitTestRotation(W, Z,
|
|
2759
|
+
if (G.hitTestRotation(W, Z, L)) {
|
|
2760
2760
|
if (B.locked) return;
|
|
2761
|
-
const M = B.getBoundingBox(), F = Es(M),
|
|
2762
|
-
$e(!0), at(
|
|
2761
|
+
const M = B.getBoundingBox(), F = Es(M), ie = lr(F.x, F.y, W, Z);
|
|
2762
|
+
$e(!0), at(ie), pt(B.rotation), h.startRotate(B, W, Z, ie, B.rotation), q && u instanceof Re && (h._activeChildContext = {
|
|
2763
2763
|
group: u,
|
|
2764
2764
|
childId: q.id
|
|
2765
|
-
}),
|
|
2765
|
+
}), Oe.current = B.id, Je.current = { x: W, y: Z }, se({});
|
|
2766
2766
|
return;
|
|
2767
2767
|
}
|
|
2768
|
-
const X = G.hitTestResize(W, Z,
|
|
2768
|
+
const X = G.hitTestResize(W, Z, L);
|
|
2769
2769
|
if (X) {
|
|
2770
2770
|
if (B.locked) return;
|
|
2771
2771
|
const M = B.getBoundingBox(), F = B.getVisualBoundingBox();
|
|
2772
|
-
h.startResize(B, X, W, Z, M, F),
|
|
2772
|
+
h.startResize(B, X, W, Z, M, F), Oe.current = B.id, Je.current = { x: W, y: Z }, q && u instanceof Re && (h._activeChildContext = {
|
|
2773
2773
|
group: u,
|
|
2774
2774
|
childId: q.id
|
|
2775
2775
|
}), se({});
|
|
@@ -2781,7 +2781,7 @@ function Mi(e) {
|
|
|
2781
2781
|
const M = u.hitTestChild(W, Z);
|
|
2782
2782
|
M && (h._pendingChildSelection = M);
|
|
2783
2783
|
}
|
|
2784
|
-
u && B.id === u.id && !(B instanceof Qe) && (
|
|
2784
|
+
u && B.id === u.id && !(B instanceof Qe) && (Oe.current = B.id, Je.current = { x: W, y: Z }), B instanceof Qe && !(B instanceof Re) && u && B.id === u.id && !g && (h._pendingTextEditMode = {
|
|
2785
2785
|
elementId: B.id,
|
|
2786
2786
|
originalX: B.x,
|
|
2787
2787
|
originalY: B.y,
|
|
@@ -2807,26 +2807,26 @@ function Mi(e) {
|
|
|
2807
2807
|
dragOriginalElementsRef: b,
|
|
2808
2808
|
setHoverState: Ee,
|
|
2809
2809
|
forceUpdate: se,
|
|
2810
|
-
zoom:
|
|
2810
|
+
zoom: L
|
|
2811
2811
|
})) return;
|
|
2812
|
-
Zs({ updateActiveChild: Ze, selectedElement: u || null, transformHandles: G, setHandlesVersion: We, zoom:
|
|
2812
|
+
Zs({ updateActiveChild: Ze, selectedElement: u || null, transformHandles: G, setHandlesVersion: We, zoom: L });
|
|
2813
2813
|
return;
|
|
2814
2814
|
}
|
|
2815
2815
|
if (q) {
|
|
2816
|
-
Zs({ updateActiveChild: Ze, selectedElement: u || null, transformHandles: G, setHandlesVersion: We, zoom:
|
|
2816
|
+
Zs({ updateActiveChild: Ze, selectedElement: u || null, transformHandles: G, setHandlesVersion: We, zoom: L });
|
|
2817
2817
|
return;
|
|
2818
2818
|
}
|
|
2819
2819
|
if (!z.shiftKey) {
|
|
2820
2820
|
const k = gt(), X = [];
|
|
2821
2821
|
for (let F = k.length - 1; F >= 0; F--) {
|
|
2822
|
-
const
|
|
2823
|
-
|
|
2822
|
+
const ie = k[F];
|
|
2823
|
+
ie.visible !== !1 && ie.hitTest(W, Z) && hs(ie, W, Z, de) && X.push(ie);
|
|
2824
2824
|
}
|
|
2825
2825
|
let M = null;
|
|
2826
2826
|
if (X.length === 0)
|
|
2827
2827
|
u && (M = { kind: "deselect" });
|
|
2828
2828
|
else {
|
|
2829
|
-
const F = u ? X.findIndex((
|
|
2829
|
+
const F = u ? X.findIndex((ie) => ie.id === u.id) : -1;
|
|
2830
2830
|
F === -1 ? M = {
|
|
2831
2831
|
kind: "select-element",
|
|
2832
2832
|
elementId: X[0].id,
|
|
@@ -2845,7 +2845,7 @@ function Mi(e) {
|
|
|
2845
2845
|
pointerId: z.pointerId,
|
|
2846
2846
|
startClientX: z.clientX,
|
|
2847
2847
|
startClientY: z.clientY,
|
|
2848
|
-
startPanOffset: { ...
|
|
2848
|
+
startPanOffset: { ...Ce.current },
|
|
2849
2849
|
movedPastThreshold: !1,
|
|
2850
2850
|
pendingTap: M
|
|
2851
2851
|
};
|
|
@@ -2856,29 +2856,29 @@ function Mi(e) {
|
|
|
2856
2856
|
z.preventDefault();
|
|
2857
2857
|
return;
|
|
2858
2858
|
}
|
|
2859
|
-
const
|
|
2859
|
+
const xe = gt();
|
|
2860
2860
|
if (ki({
|
|
2861
2861
|
x: W,
|
|
2862
2862
|
y: Z,
|
|
2863
2863
|
shiftKey: z.shiftKey,
|
|
2864
|
-
activeArtboardElements:
|
|
2864
|
+
activeArtboardElements: xe,
|
|
2865
2865
|
selectedElement: u || null,
|
|
2866
2866
|
multiSelection: te,
|
|
2867
2867
|
onSelectionChange: Xe,
|
|
2868
|
-
onMultiSelectionChange:
|
|
2868
|
+
onMultiSelectionChange: H,
|
|
2869
2869
|
stateMachine: h,
|
|
2870
2870
|
dragOriginalElementsRef: b,
|
|
2871
2871
|
setHoverState: Ee,
|
|
2872
2872
|
forceUpdate: se
|
|
2873
2873
|
})) return;
|
|
2874
|
-
const
|
|
2875
|
-
if (!
|
|
2876
|
-
if (
|
|
2874
|
+
const Y = zr.shouldProtectClick(), Q = Dr(z.target);
|
|
2875
|
+
if (!Y && !Q)
|
|
2876
|
+
if (Lt.current > 1.001) {
|
|
2877
2877
|
Fe.current = {
|
|
2878
2878
|
pointerId: z.pointerId,
|
|
2879
2879
|
startClientX: z.clientX,
|
|
2880
2880
|
startClientY: z.clientY,
|
|
2881
|
-
startPanOffset: { ...
|
|
2881
|
+
startPanOffset: { ...Ce.current },
|
|
2882
2882
|
movedPastThreshold: !1,
|
|
2883
2883
|
pendingTap: null
|
|
2884
2884
|
};
|
|
@@ -2888,14 +2888,14 @@ function Mi(e) {
|
|
|
2888
2888
|
}
|
|
2889
2889
|
z.preventDefault();
|
|
2890
2890
|
} else
|
|
2891
|
-
Xe(null),
|
|
2891
|
+
Xe(null), H([]), Nt(W, Z);
|
|
2892
2892
|
},
|
|
2893
2893
|
[
|
|
2894
2894
|
g,
|
|
2895
2895
|
u,
|
|
2896
2896
|
gt,
|
|
2897
2897
|
Xe,
|
|
2898
|
-
|
|
2898
|
+
H,
|
|
2899
2899
|
G,
|
|
2900
2900
|
q,
|
|
2901
2901
|
te,
|
|
@@ -2903,14 +2903,14 @@ function Mi(e) {
|
|
|
2903
2903
|
_,
|
|
2904
2904
|
Ve,
|
|
2905
2905
|
We,
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2906
|
+
L,
|
|
2907
|
+
Me,
|
|
2908
|
+
Ae,
|
|
2909
|
+
Be,
|
|
2910
2910
|
// Canvas-zoom pinch entry uses these setters / refs.
|
|
2911
2911
|
t,
|
|
2912
2912
|
lt,
|
|
2913
|
-
|
|
2913
|
+
de
|
|
2914
2914
|
]
|
|
2915
2915
|
), An = ft(
|
|
2916
2916
|
(z) => {
|
|
@@ -2918,21 +2918,21 @@ function Mi(e) {
|
|
|
2918
2918
|
if (z.buttons === 2) return;
|
|
2919
2919
|
const fe = t.current;
|
|
2920
2920
|
if (!fe) return;
|
|
2921
|
-
const dt = Ue.current ?? fe.getBoundingClientRect(), W = (z.clientX - dt.left) /
|
|
2922
|
-
if (p.current = { x: W, y: Z },
|
|
2921
|
+
const dt = Ue.current ?? fe.getBoundingClientRect(), W = (z.clientX - dt.left) / L - me, Z = (z.clientY - dt.top) / L - ye;
|
|
2922
|
+
if (p.current = { x: W, y: Z }, Ne.current.has(z.pointerId) && Ne.current.set(z.pointerId, {
|
|
2923
2923
|
x: W,
|
|
2924
2924
|
y: Z,
|
|
2925
2925
|
clientX: z.clientX,
|
|
2926
2926
|
clientY: z.clientY
|
|
2927
2927
|
}), Ge.current) {
|
|
2928
|
-
const B = Ge.current,
|
|
2929
|
-
if (
|
|
2930
|
-
const
|
|
2928
|
+
const B = Ge.current, xe = Ne.current.get(B.pointerA), S = Ne.current.get(B.pointerB);
|
|
2929
|
+
if (xe && S) {
|
|
2930
|
+
const Y = S.clientX - xe.clientX, Q = S.clientY - xe.clientY, pe = Math.hypot(Y, Q) / B.startDistance, ke = Math.min(
|
|
2931
2931
|
Math.max(B.startUserZoom * pe, 0.25),
|
|
2932
2932
|
8
|
|
2933
|
-
), ee = B.startCentroidClient.x - B.containerRect.left, J = B.startCentroidClient.y - B.containerRect.top, k = (
|
|
2933
|
+
), ee = B.startCentroidClient.x - B.containerRect.left, J = B.startCentroidClient.y - B.containerRect.top, k = (xe.clientX + S.clientX) / 2 - B.containerRect.left, X = (xe.clientY + S.clientY) / 2 - B.containerRect.top, M = ke / B.startUserZoom, F = k - (ee - B.startPanOffset.x) * M, ie = X - (J - B.startPanOffset.y) * M, oe = t.current;
|
|
2934
2934
|
if (oe) {
|
|
2935
|
-
const
|
|
2935
|
+
const Te = oe.getBoundingClientRect(), Ye = (et = oe.parentElement) == null ? void 0 : et.parentElement, it = (Ye == null ? void 0 : Ye.clientWidth) ?? Te.width, bt = (Ye == null ? void 0 : Ye.clientHeight) ?? Te.height, Bt = 80, St = ke / Math.max(Lt.current, 1e-4), Et = Te.width * St, Gt = Te.height * St, ut = Ce.current.x, kt = Ce.current.y, kn = Te.left - B.containerRect.left, Ft = Te.top - B.containerRect.top, qt = kn + (F - ut), jt = Ft + (ie - kt), _t = Math.min(
|
|
2936
2936
|
Math.max(qt, -Et + Bt),
|
|
2937
2937
|
it - Bt
|
|
2938
2938
|
), $t = Math.min(
|
|
@@ -2941,31 +2941,31 @@ function Mi(e) {
|
|
|
2941
2941
|
);
|
|
2942
2942
|
st(ke), yt({
|
|
2943
2943
|
x: F + (_t - qt),
|
|
2944
|
-
y:
|
|
2944
|
+
y: ie + ($t - jt)
|
|
2945
2945
|
});
|
|
2946
2946
|
} else
|
|
2947
|
-
st(ke), yt({ x: F, y:
|
|
2947
|
+
st(ke), yt({ x: F, y: ie });
|
|
2948
2948
|
}
|
|
2949
2949
|
return;
|
|
2950
2950
|
}
|
|
2951
2951
|
if (Fe.current && Fe.current.pointerId === z.pointerId) {
|
|
2952
|
-
const B = Fe.current,
|
|
2952
|
+
const B = Fe.current, xe = z.clientX - B.startClientX, S = z.clientY - B.startClientY;
|
|
2953
2953
|
if (!B.movedPastThreshold)
|
|
2954
|
-
if (Math.hypot(
|
|
2954
|
+
if (Math.hypot(xe, S) > 5)
|
|
2955
2955
|
B.movedPastThreshold = !0, B.pendingTap = null;
|
|
2956
2956
|
else
|
|
2957
2957
|
return;
|
|
2958
|
-
if (
|
|
2958
|
+
if (Lt.current <= 1.001) return;
|
|
2959
2959
|
yt({
|
|
2960
|
-
x: B.startPanOffset.x +
|
|
2960
|
+
x: B.startPanOffset.x + xe,
|
|
2961
2961
|
y: B.startPanOffset.y + S
|
|
2962
2962
|
});
|
|
2963
2963
|
return;
|
|
2964
2964
|
}
|
|
2965
2965
|
if (h.getMode() === "pinch" && K.current) {
|
|
2966
|
-
const { a: B, b:
|
|
2967
|
-
if (S &&
|
|
2968
|
-
const Q = h.updatePinch(S,
|
|
2966
|
+
const { a: B, b: xe } = K.current, S = Ne.current.get(B), Y = Ne.current.get(xe);
|
|
2967
|
+
if (S && Y) {
|
|
2968
|
+
const Q = h.updatePinch(S, Y), { element: j, startData: pe } = h.getPinchContext();
|
|
2969
2969
|
fi.calculatePinch({
|
|
2970
2970
|
element: j,
|
|
2971
2971
|
startData: pe,
|
|
@@ -2984,13 +2984,13 @@ function Mi(e) {
|
|
|
2984
2984
|
return;
|
|
2985
2985
|
}
|
|
2986
2986
|
if (d.current && u instanceof Qe) {
|
|
2987
|
-
const B = u.getVisualBoundingBox(),
|
|
2987
|
+
const B = u.getVisualBoundingBox(), xe = u.getRotationAnchor(), S = en.toRadiansInverse(u.rotation), Y = W - xe.x, Q = Z - xe.y, j = Math.cos(S), pe = Math.sin(S), ke = Y * j - Q * pe, ee = Y * pe + Q * j, J = m.current;
|
|
2988
2988
|
let k = 0;
|
|
2989
2989
|
d.current === "start" && (J != null && J.start) ? k = J.start.textEdge.y - J.start.center.y : d.current === "end" && (J != null && J.end) && (k = J.end.textEdge.y - J.end.center.y);
|
|
2990
2990
|
const X = ke + B.width / 2, M = ee + k + B.height / 2, F = Sn(u, { x: X, y: M });
|
|
2991
|
-
if (d.current === "start" ? F <= w ? (
|
|
2992
|
-
const
|
|
2993
|
-
n.current.setSelectionRange(
|
|
2991
|
+
if (d.current === "start" ? F <= w ? (Ae(F), Me(F)) : (Ae(w), Be(F), Me(F), d.current = "end") : F >= D ? (Be(F), Me(F)) : (Be(D), Ae(F), Me(F), d.current = "start"), n.current) {
|
|
2992
|
+
const ie = Math.min(D, w), oe = Math.max(D, w);
|
|
2993
|
+
n.current.setSelectionRange(ie, oe);
|
|
2994
2994
|
}
|
|
2995
2995
|
return;
|
|
2996
2996
|
}
|
|
@@ -3005,56 +3005,56 @@ function Mi(e) {
|
|
|
3005
3005
|
if (h.getMode() === "drag") {
|
|
3006
3006
|
const B = h._multiSelectionDragContext;
|
|
3007
3007
|
if (B && te.length > 0) {
|
|
3008
|
-
const { dx:
|
|
3008
|
+
const { dx: xe, dy: S } = Vs(
|
|
3009
3009
|
W - B.startX,
|
|
3010
3010
|
Z - B.startY,
|
|
3011
3011
|
{ shift: z.shiftKey }
|
|
3012
3012
|
);
|
|
3013
3013
|
B.currentElements || (B.currentElements = /* @__PURE__ */ new Map());
|
|
3014
|
-
const
|
|
3014
|
+
const Y = [];
|
|
3015
3015
|
B.elementsStartData.forEach((Q) => {
|
|
3016
3016
|
const j = Q.element, pe = Q.startData, ke = j.clone();
|
|
3017
|
-
ke.x = pe.x +
|
|
3018
|
-
}), lt((Q) => Q.map((j) =>
|
|
3017
|
+
ke.x = pe.x + xe, ke.y = pe.y + S, B.currentElements.set(ke.id, ke), Y.push(ke);
|
|
3018
|
+
}), lt((Q) => Q.map((j) => Y.find((pe) => pe.id === j.id) || j)), B.currentDelta = { dx: xe, dy: S }, !B.startOBB && ce.current && (B.startOBB = { ...ce.current }), We((Q) => Q + 1), se({});
|
|
3019
3019
|
return;
|
|
3020
3020
|
}
|
|
3021
3021
|
}
|
|
3022
3022
|
if (h.getMode() === "drag" && u) {
|
|
3023
3023
|
if (h.getDragMode() === "crop-image-drag") {
|
|
3024
3024
|
const ee = h.getContext(), J = ee.element;
|
|
3025
|
-
if (J instanceof
|
|
3026
|
-
const k =
|
|
3025
|
+
if (J instanceof Yt && J.isCropping) {
|
|
3026
|
+
const k = we.handleCropImageDrag(J, ee, W, Z), X = h._cropGroupContext, M = h._activeChildContext, F = X || M;
|
|
3027
3027
|
if (F && u instanceof Re) {
|
|
3028
|
-
const
|
|
3029
|
-
|
|
3030
|
-
const oe = u.clone(),
|
|
3031
|
-
|
|
3032
|
-
const
|
|
3033
|
-
|
|
3028
|
+
const ie = J.clone();
|
|
3029
|
+
ie.x = k.x, ie.y = k.y, ie.updateCrop(k.cropX, k.cropY, k.cropWidth, k.cropHeight, !1);
|
|
3030
|
+
const oe = u.clone(), Te = X ? X.childIndex : oe.children.findIndex((it) => it.id === F.childId);
|
|
3031
|
+
Te >= 0 && (oe.children[Te] = ie, oe.updateBoundsFromChildren(!0)), lt((it) => it.map((bt) => bt.id === oe.id ? oe : bt));
|
|
3032
|
+
const Ye = h.getContext();
|
|
3033
|
+
Ye._cachedElement || (Ye._cachedElement = {}), Ye._cachedElement[oe.id] = oe, M && Te >= 0 && (Ze(oe.children[Te]), G.update(ie, L)), We((it) => it + 1);
|
|
3034
3034
|
} else {
|
|
3035
|
-
const
|
|
3036
|
-
|
|
3037
|
-
(
|
|
3035
|
+
const ie = J.clone();
|
|
3036
|
+
ie.x = k.x, ie.y = k.y, ie.updateCrop(k.cropX, k.cropY, k.cropWidth, k.cropHeight, !1), lt(
|
|
3037
|
+
(Te) => Te.map((Ye) => Ye.id === ie.id ? ie : Ye)
|
|
3038
3038
|
);
|
|
3039
3039
|
const oe = h.getContext();
|
|
3040
|
-
oe._cachedElement || (oe._cachedElement = {}), oe._cachedElement[
|
|
3040
|
+
oe._cachedElement || (oe._cachedElement = {}), oe._cachedElement[ie.id] = ie, G.update(ie, L), We((Te) => Te + 1);
|
|
3041
3041
|
}
|
|
3042
3042
|
return;
|
|
3043
3043
|
}
|
|
3044
3044
|
}
|
|
3045
|
-
const
|
|
3045
|
+
const xe = h._activeChildContext, S = gt(), Y = [];
|
|
3046
3046
|
S.forEach((ee) => {
|
|
3047
|
-
ee instanceof Re ?
|
|
3047
|
+
ee instanceof Re ? Y.push(...ee.children) : Y.push(ee);
|
|
3048
3048
|
});
|
|
3049
3049
|
const Q = { shift: z.shiftKey };
|
|
3050
|
-
let j = h.updateDrag(W, Z,
|
|
3051
|
-
const pe =
|
|
3052
|
-
if (pe && (j = he.snapToSpacing(j, pe,
|
|
3050
|
+
let j = h.updateDrag(W, Z, Y, Q);
|
|
3051
|
+
const pe = xe && u instanceof Re ? u.children.find((ee) => ee.id === xe.childId) : u;
|
|
3052
|
+
if (pe && (j = he.snapToSpacing(j, pe, Y), Q.shift)) {
|
|
3053
3053
|
const ee = h.getContext(), J = ee.startData, { lockedAxis: k } = Vs(W - ee.startX, Z - ee.startY, Q);
|
|
3054
3054
|
k === "x" ? j.x = J.x : k === "y" && (j.y = J.y);
|
|
3055
3055
|
}
|
|
3056
|
-
if (
|
|
3057
|
-
const ee = u.clone(), J = ee.children.findIndex((X) => X.id ===
|
|
3056
|
+
if (xe && u instanceof Re) {
|
|
3057
|
+
const ee = u.clone(), J = ee.children.findIndex((X) => X.id === xe.childId);
|
|
3058
3058
|
if (J >= 0) {
|
|
3059
3059
|
const X = ee.children[J].clone();
|
|
3060
3060
|
X.x = j.x, X.y = j.y, ee.children[J] = X, ee.updateBoundsFromChildren(!0);
|
|
@@ -3063,54 +3063,54 @@ function Mi(e) {
|
|
|
3063
3063
|
const k = h.getContext();
|
|
3064
3064
|
if (k._cachedElement || (k._cachedElement = {}), k._cachedElement[ee.id] = ee, J >= 0) {
|
|
3065
3065
|
const X = ee.children[J];
|
|
3066
|
-
Ze(X), G.update(X,
|
|
3066
|
+
Ze(X), G.update(X, L);
|
|
3067
3067
|
}
|
|
3068
3068
|
We((X) => X + 1), se({});
|
|
3069
3069
|
} else {
|
|
3070
3070
|
const ee = h._groupDragOriginalElement, J = u instanceof Re && ee ? ee.clone() : u.clone();
|
|
3071
3071
|
if (J instanceof Re) {
|
|
3072
|
-
const M = h.getContext().startData, F = j.x - M.x,
|
|
3073
|
-
J.move(F,
|
|
3072
|
+
const M = h.getContext().startData, F = j.x - M.x, ie = j.y - M.y;
|
|
3073
|
+
J.move(F, ie);
|
|
3074
3074
|
} else
|
|
3075
3075
|
J.x = j.x, J.y = j.y;
|
|
3076
|
-
lt((X) => X.map((M) => M.id === J.id ? J : M)), G.update(J,
|
|
3076
|
+
lt((X) => X.map((M) => M.id === J.id ? J : M)), G.update(J, L);
|
|
3077
3077
|
const k = h.getContext();
|
|
3078
3078
|
k._cachedElement || (k._cachedElement = {}), k._cachedElement[J.id] = J;
|
|
3079
3079
|
}
|
|
3080
3080
|
We((ee) => ee + 1), zt(re.getGuides());
|
|
3081
3081
|
let ke;
|
|
3082
|
-
if (
|
|
3083
|
-
ke = u.children.find((ee) => ee.id ===
|
|
3082
|
+
if (xe && u instanceof Re)
|
|
3083
|
+
ke = u.children.find((ee) => ee.id === xe.childId);
|
|
3084
3084
|
else {
|
|
3085
3085
|
const ee = h.getContext();
|
|
3086
3086
|
ee._cachedElement && u ? ke = ee._cachedElement[u.id] : ke = u || void 0;
|
|
3087
3087
|
}
|
|
3088
3088
|
if (ke) {
|
|
3089
|
-
const ee = he.detectSpacing(ke,
|
|
3089
|
+
const ee = he.detectSpacing(ke, Y, O);
|
|
3090
3090
|
At(ee);
|
|
3091
3091
|
}
|
|
3092
3092
|
} else if (h.getMode() === "resize") {
|
|
3093
|
-
const { dx: B, dy:
|
|
3094
|
-
if (
|
|
3095
|
-
const k =
|
|
3096
|
-
let M, F,
|
|
3093
|
+
const { dx: B, dy: xe } = h.updateResize(W, Z), S = h.getResizeContext(), Y = h._multiSelectionResizeContext;
|
|
3094
|
+
if (Y && te.length > 0) {
|
|
3095
|
+
const k = Y.startBounds, X = Y.anchor;
|
|
3096
|
+
let M, F, ie, oe;
|
|
3097
3097
|
switch (X) {
|
|
3098
3098
|
case "top-left":
|
|
3099
|
-
M = k.maxX, F = k.maxY,
|
|
3099
|
+
M = k.maxX, F = k.maxY, ie = k.minX, oe = k.minY;
|
|
3100
3100
|
break;
|
|
3101
3101
|
case "top-right":
|
|
3102
|
-
M = k.minX, F = k.maxY,
|
|
3102
|
+
M = k.minX, F = k.maxY, ie = k.maxX, oe = k.minY;
|
|
3103
3103
|
break;
|
|
3104
3104
|
case "bottom-left":
|
|
3105
|
-
M = k.maxX, F = k.minY,
|
|
3105
|
+
M = k.maxX, F = k.minY, ie = k.minX, oe = k.maxY;
|
|
3106
3106
|
break;
|
|
3107
3107
|
case "bottom-right":
|
|
3108
|
-
M = k.minX, F = k.minY,
|
|
3108
|
+
M = k.minX, F = k.minY, ie = k.maxX, oe = k.maxY;
|
|
3109
3109
|
break;
|
|
3110
3110
|
default:
|
|
3111
|
-
M = k.minX, F = k.minY,
|
|
3111
|
+
M = k.minX, F = k.minY, ie = k.maxX, oe = k.maxY;
|
|
3112
3112
|
}
|
|
3113
|
-
const
|
|
3113
|
+
const Te = ie + B, Ye = oe + xe, it = Math.abs(ie - M), bt = Math.abs(oe - F), Bt = Math.abs(Te - M), St = Math.abs(Ye - F), Et = it > 0 ? Bt / it : 1, Gt = bt > 0 ? St / bt : 1, ut = (Et + Gt) / 2, kt = k.maxX - k.minX, kn = k.maxY - k.minY, Ft = kt * ut, qt = kn * ut;
|
|
3114
3114
|
let jt = M, _t = F, $t = M, an = F;
|
|
3115
3115
|
switch (X) {
|
|
3116
3116
|
case "top-left":
|
|
@@ -3126,9 +3126,9 @@ function Mi(e) {
|
|
|
3126
3126
|
jt = M, _t = F, $t = M + Ft, an = F + qt;
|
|
3127
3127
|
break;
|
|
3128
3128
|
}
|
|
3129
|
-
if (
|
|
3130
|
-
const Vn =
|
|
3131
|
-
if (Wt instanceof
|
|
3129
|
+
if (Y.elementsStartData.forEach((Yn) => {
|
|
3130
|
+
const Vn = Yn.element, nn = Yn.startData, ls = nn.x - M, ds = nn.y - F, Kn = M + ls * ut, Un = F + ds * ut, Wt = Vn.clone();
|
|
3131
|
+
if (Wt instanceof Yt) {
|
|
3132
3132
|
Wt.x = Kn, Wt.y = Un;
|
|
3133
3133
|
const Rn = Wt.transformData, yn = nn.transformData;
|
|
3134
3134
|
Rn.width = yn.width * ut, Rn.height = yn.height * ut;
|
|
@@ -3141,31 +3141,31 @@ function Mi(e) {
|
|
|
3141
3141
|
Wt.resize(X, Rn, yn, nn), Wt.x = Kn, Wt.y = Un;
|
|
3142
3142
|
}
|
|
3143
3143
|
Ie(Wt);
|
|
3144
|
-
}),
|
|
3145
|
-
const
|
|
3146
|
-
|
|
3147
|
-
centerX:
|
|
3144
|
+
}), ce.current) {
|
|
3145
|
+
const Yn = (jt + $t) / 2, Vn = (_t + an) / 2;
|
|
3146
|
+
ce.current = {
|
|
3147
|
+
centerX: Yn,
|
|
3148
3148
|
centerY: Vn,
|
|
3149
3149
|
width: $t - jt,
|
|
3150
3150
|
height: an - _t,
|
|
3151
|
-
rotation:
|
|
3151
|
+
rotation: ce.current.rotation
|
|
3152
3152
|
};
|
|
3153
3153
|
}
|
|
3154
3154
|
return;
|
|
3155
3155
|
}
|
|
3156
3156
|
const Q = S.element;
|
|
3157
|
-
if (Q instanceof
|
|
3158
|
-
const k = S.handle.anchor.replace("crop-", ""), X = h.getContext(), M =
|
|
3157
|
+
if (Q instanceof Yt && Q.isCropping && S.handle.anchor && S.handle.anchor.startsWith("crop-")) {
|
|
3158
|
+
const k = S.handle.anchor.replace("crop-", ""), X = h.getContext(), M = we.handleCropBoxResize(Q, k, S, X, W, Z);
|
|
3159
3159
|
fe.style.cursor = M.cursor;
|
|
3160
|
-
const F = h._cropGroupContext,
|
|
3160
|
+
const F = h._cropGroupContext, ie = h._activeChildContext, oe = F || ie;
|
|
3161
3161
|
if (oe && u instanceof Re) {
|
|
3162
|
-
const
|
|
3163
|
-
|
|
3164
|
-
const
|
|
3165
|
-
it >= 0 && (
|
|
3162
|
+
const Te = Q.clone();
|
|
3163
|
+
Te.x = M.x, Te.y = M.y, Te.rotation = M.rotation, Te.transformData.width = M.width, Te.transformData.height = M.height, Te.updateCrop(M.cropX, M.cropY, M.cropWidth, M.cropHeight, !1);
|
|
3164
|
+
const Ye = u.clone(), it = F ? F.childIndex : Ye.children.findIndex((bt) => bt.id === oe.childId);
|
|
3165
|
+
it >= 0 && (Ye.children[it] = Te, Ye.updateBoundsFromChildren(!0)), Ie(Ye), ie && it >= 0 && Ze(Ye.children[it]);
|
|
3166
3166
|
} else {
|
|
3167
|
-
const
|
|
3168
|
-
|
|
3167
|
+
const Te = Q.clone();
|
|
3168
|
+
Te.x = M.x, Te.y = M.y, Te.rotation = M.rotation, Te.transformData.width = M.width, Te.transformData.height = M.height, Te.updateCrop(M.cropX, M.cropY, M.cropWidth, M.cropHeight, !1), Ie(Te);
|
|
3169
3169
|
}
|
|
3170
3170
|
return;
|
|
3171
3171
|
}
|
|
@@ -3178,7 +3178,7 @@ function Mi(e) {
|
|
|
3178
3178
|
element: S.element,
|
|
3179
3179
|
handle: S.handle,
|
|
3180
3180
|
dx: B,
|
|
3181
|
-
dy:
|
|
3181
|
+
dy: xe,
|
|
3182
3182
|
startData: S.startData,
|
|
3183
3183
|
allElements: ke,
|
|
3184
3184
|
snapSystem: re,
|
|
@@ -3187,9 +3187,9 @@ function Mi(e) {
|
|
|
3187
3187
|
}).element;
|
|
3188
3188
|
if (h.updateResizeElement(J), pe) {
|
|
3189
3189
|
const k = u.clone(), X = k.children.findIndex((M) => M.id === j.childId);
|
|
3190
|
-
X >= 0 && (k.children[X] = J, k.updateBoundsFromChildren(!0)), Ie(k), X >= 0 && (Ze(k.children[X]), G.update(k.children[X],
|
|
3190
|
+
X >= 0 && (k.children[X] = J, k.updateBoundsFromChildren(!0)), Ie(k), X >= 0 && (Ze(k.children[X]), G.update(k.children[X], L));
|
|
3191
3191
|
} else
|
|
3192
|
-
Ie(J), G.update(J,
|
|
3192
|
+
Ie(J), G.update(J, L);
|
|
3193
3193
|
We((k) => k + 1), zt(re.getGuides());
|
|
3194
3194
|
} else if (h.getMode() === "rotate") {
|
|
3195
3195
|
fe.style.cursor = "grabbing", ne || ($e(!0), $ == null || $(!0));
|
|
@@ -3197,43 +3197,43 @@ function Mi(e) {
|
|
|
3197
3197
|
if (B && te.length > 0) {
|
|
3198
3198
|
const J = B.startBounds, k = h.updateRotate(W, Z, J.centerX, J.centerY, { shift: z.shiftKey });
|
|
3199
3199
|
pt(k), B.elementsStartData.forEach((X) => {
|
|
3200
|
-
const M = X.element, F = X.startData,
|
|
3200
|
+
const M = X.element, F = X.startData, ie = ms.rotatePointAroundAnchor(
|
|
3201
3201
|
F.x,
|
|
3202
3202
|
F.y,
|
|
3203
3203
|
J.centerX,
|
|
3204
3204
|
J.centerY,
|
|
3205
3205
|
k
|
|
3206
3206
|
), oe = M.clone();
|
|
3207
|
-
oe.x =
|
|
3207
|
+
oe.x = ie.x, oe.y = ie.y, oe.setRotation(F.rotation + k), Ie(oe);
|
|
3208
3208
|
});
|
|
3209
3209
|
return;
|
|
3210
3210
|
}
|
|
3211
|
-
const
|
|
3211
|
+
const xe = h._activeChildContext, S = xe ? q : u;
|
|
3212
3212
|
if (!S) return;
|
|
3213
|
-
const
|
|
3213
|
+
const Y = S.getBoundingBox(), Q = Es(Y), j = Q.x, pe = Q.y, ke = h.updateRotate(W, Z, Q.x, Q.y, { shift: z.shiftKey }), ee = S.clone();
|
|
3214
3214
|
if (ee.setRotation(ke), !(ee instanceof Re)) {
|
|
3215
3215
|
const J = ee.getBoundingBox(), k = Es(J), X = j - k.x, M = pe - k.y;
|
|
3216
3216
|
ee.x += X, ee.y += M;
|
|
3217
3217
|
}
|
|
3218
|
-
if (x.current = ee, pt(ee.rotation), ct((J) => J + 1),
|
|
3219
|
-
const J = u.clone(), k = J.children.findIndex((X) => X.id ===
|
|
3220
|
-
k >= 0 && (J.children[k] = ee, J.updateBoundsFromChildren(!0)), Ie(J), k >= 0 && (Ze(J.children[k]), G.update(J.children[k],
|
|
3218
|
+
if (x.current = ee, pt(ee.rotation), ct((J) => J + 1), xe && u instanceof Re) {
|
|
3219
|
+
const J = u.clone(), k = J.children.findIndex((X) => X.id === xe.childId);
|
|
3220
|
+
k >= 0 && (J.children[k] = ee, J.updateBoundsFromChildren(!0)), Ie(J), k >= 0 && (Ze(J.children[k]), G.update(J.children[k], L));
|
|
3221
3221
|
} else
|
|
3222
|
-
Ie(ee), G.update(ee,
|
|
3222
|
+
Ie(ee), G.update(ee, L);
|
|
3223
3223
|
We((J) => J + 1);
|
|
3224
3224
|
} else {
|
|
3225
3225
|
if (te.length > 0 && E.current) {
|
|
3226
|
-
const S = E.current,
|
|
3226
|
+
const S = E.current, Y = 16 / L, Q = [
|
|
3227
3227
|
{ x: S.minX, y: S.minY, anchor: "top-left", cursor: "nwse-resize" },
|
|
3228
3228
|
{ x: S.maxX, y: S.minY, anchor: "top-right", cursor: "nesw-resize" },
|
|
3229
3229
|
{ x: S.minX, y: S.maxY, anchor: "bottom-left", cursor: "nesw-resize" },
|
|
3230
3230
|
{ x: S.maxX, y: S.maxY, anchor: "bottom-right", cursor: "nwse-resize" }
|
|
3231
3231
|
], j = S.rotation || 0, pe = Q.map((X) => {
|
|
3232
3232
|
if (j !== 0) {
|
|
3233
|
-
const M = -j * Math.PI / 180, F = Math.cos(M),
|
|
3233
|
+
const M = -j * Math.PI / 180, F = Math.cos(M), ie = Math.sin(M), oe = X.x - S.centerX, Te = X.y - S.centerY;
|
|
3234
3234
|
return {
|
|
3235
|
-
x: S.centerX + (oe * F -
|
|
3236
|
-
y: S.centerY + (oe *
|
|
3235
|
+
x: S.centerX + (oe * F - Te * ie),
|
|
3236
|
+
y: S.centerY + (oe * ie + Te * F),
|
|
3237
3237
|
anchor: X.anchor,
|
|
3238
3238
|
cursor: X.cursor
|
|
3239
3239
|
};
|
|
@@ -3242,12 +3242,12 @@ function Mi(e) {
|
|
|
3242
3242
|
});
|
|
3243
3243
|
for (const X of pe) {
|
|
3244
3244
|
const M = W - X.x, F = Z - X.y;
|
|
3245
|
-
if (Math.sqrt(M * M + F * F) <=
|
|
3245
|
+
if (Math.sqrt(M * M + F * F) <= Y) {
|
|
3246
3246
|
fe.style.cursor = X.cursor, Ee({ type: "multi-selection-handle", data: X });
|
|
3247
3247
|
return;
|
|
3248
3248
|
}
|
|
3249
3249
|
}
|
|
3250
|
-
const ke = 18 /
|
|
3250
|
+
const ke = 18 / L;
|
|
3251
3251
|
if (Math.sqrt(
|
|
3252
3252
|
Math.pow(W - S.rotationHandleX, 2) + Math.pow(Z - S.rotationHandleY, 2)
|
|
3253
3253
|
) <= ke) {
|
|
@@ -3256,8 +3256,8 @@ function Mi(e) {
|
|
|
3256
3256
|
}
|
|
3257
3257
|
let J = W, k = Z;
|
|
3258
3258
|
if (j !== 0) {
|
|
3259
|
-
const X = j * Math.PI / 180, M = Math.cos(X), F = Math.sin(X),
|
|
3260
|
-
J = S.centerX + (
|
|
3259
|
+
const X = j * Math.PI / 180, M = Math.cos(X), F = Math.sin(X), ie = W - S.centerX, oe = Z - S.centerY;
|
|
3260
|
+
J = S.centerX + (ie * M - oe * F), k = S.centerY + (ie * F + oe * M);
|
|
3261
3261
|
}
|
|
3262
3262
|
if (J >= S.minX && J <= S.maxX && k >= S.minY && k <= S.maxY) {
|
|
3263
3263
|
fe.style.cursor = "move", Ee({ type: "multi-selection-bounds", data: S });
|
|
@@ -3266,9 +3266,9 @@ function Mi(e) {
|
|
|
3266
3266
|
}
|
|
3267
3267
|
if (z.altKey) {
|
|
3268
3268
|
let S = null;
|
|
3269
|
-
const
|
|
3270
|
-
for (let Q =
|
|
3271
|
-
const j =
|
|
3269
|
+
const Y = gt();
|
|
3270
|
+
for (let Q = Y.length - 1; Q >= 0; Q--) {
|
|
3271
|
+
const j = Y[Q];
|
|
3272
3272
|
if (j.visible !== !1) {
|
|
3273
3273
|
if (j instanceof Re)
|
|
3274
3274
|
for (let pe = j.children.length - 1; pe >= 0; pe--) {
|
|
@@ -3292,7 +3292,7 @@ function Mi(e) {
|
|
|
3292
3292
|
}
|
|
3293
3293
|
if (S) {
|
|
3294
3294
|
const Q = [];
|
|
3295
|
-
|
|
3295
|
+
Y.forEach((pe) => {
|
|
3296
3296
|
pe instanceof Re ? Q.push(...pe.children) : Q.push(pe);
|
|
3297
3297
|
});
|
|
3298
3298
|
const j = he.detectSpacing(S, Q, !0);
|
|
@@ -3300,11 +3300,11 @@ function Mi(e) {
|
|
|
3300
3300
|
} else
|
|
3301
3301
|
At([]);
|
|
3302
3302
|
} else
|
|
3303
|
-
|
|
3303
|
+
ve.length > 0 && At([]);
|
|
3304
3304
|
const B = q || u;
|
|
3305
3305
|
if (B && B.visible !== !1)
|
|
3306
|
-
if (B instanceof
|
|
3307
|
-
const S = B.hitTestCropHandle(W, Z,
|
|
3306
|
+
if (B instanceof Yt && B.isCropping) {
|
|
3307
|
+
const S = B.hitTestCropHandle(W, Z, L);
|
|
3308
3308
|
if (S) {
|
|
3309
3309
|
const Q = eo(
|
|
3310
3310
|
S.worldX,
|
|
@@ -3318,9 +3318,9 @@ function Mi(e) {
|
|
|
3318
3318
|
fe.style.cursor = Q, Ee({ type: "crop-handle", data: S });
|
|
3319
3319
|
return;
|
|
3320
3320
|
}
|
|
3321
|
-
const
|
|
3322
|
-
if (
|
|
3323
|
-
fe.style.cursor =
|
|
3321
|
+
const Y = G.hitTestResize(W, Z, L);
|
|
3322
|
+
if (Y) {
|
|
3323
|
+
fe.style.cursor = Y.cursor, Ee({ type: "resize-handle", data: Y });
|
|
3324
3324
|
return;
|
|
3325
3325
|
}
|
|
3326
3326
|
if (B.hitTest(W, Z)) {
|
|
@@ -3328,11 +3328,11 @@ function Mi(e) {
|
|
|
3328
3328
|
return;
|
|
3329
3329
|
}
|
|
3330
3330
|
} else {
|
|
3331
|
-
if (G.hitTestRotation(W, Z,
|
|
3331
|
+
if (G.hitTestRotation(W, Z, L)) {
|
|
3332
3332
|
fe.style.cursor = "grab", Ee({ type: "rotation-handle", data: null });
|
|
3333
3333
|
return;
|
|
3334
3334
|
}
|
|
3335
|
-
const S = G.hitTestResize(W, Z,
|
|
3335
|
+
const S = G.hitTestResize(W, Z, L);
|
|
3336
3336
|
if (S) {
|
|
3337
3337
|
fe.style.cursor = S.cursor, Ee({ type: "resize-handle", data: S });
|
|
3338
3338
|
return;
|
|
@@ -3344,18 +3344,18 @@ function Mi(e) {
|
|
|
3344
3344
|
}
|
|
3345
3345
|
if (q && u instanceof Re)
|
|
3346
3346
|
for (let S = u.children.length - 1; S >= 0; S--) {
|
|
3347
|
-
const
|
|
3348
|
-
if (!(
|
|
3349
|
-
fe.style.cursor = "pointer", Ee({ type: "group-sibling", data:
|
|
3347
|
+
const Y = u.children[S];
|
|
3348
|
+
if (!(Y.visible === !1 || Y.id === q.id) && Y.hitTest(W, Z)) {
|
|
3349
|
+
fe.style.cursor = "pointer", Ee({ type: "group-sibling", data: Y });
|
|
3350
3350
|
return;
|
|
3351
3351
|
}
|
|
3352
3352
|
}
|
|
3353
|
-
const
|
|
3354
|
-
for (let S =
|
|
3355
|
-
if (
|
|
3356
|
-
if (!hs(
|
|
3353
|
+
const xe = gt();
|
|
3354
|
+
for (let S = xe.length - 1; S >= 0; S--)
|
|
3355
|
+
if (xe[S].visible !== !1 && !xe[S].locked && xe[S].hitTest(W, Z)) {
|
|
3356
|
+
if (!hs(xe[S], W, Z, de))
|
|
3357
3357
|
continue;
|
|
3358
|
-
fe.style.cursor = "pointer", Ee({ type: "element", data:
|
|
3358
|
+
fe.style.cursor = "pointer", Ee({ type: "element", data: xe[S] });
|
|
3359
3359
|
return;
|
|
3360
3360
|
}
|
|
3361
3361
|
fe.style.cursor = "default", Ee({ type: null, data: null });
|
|
@@ -3370,91 +3370,91 @@ function Mi(e) {
|
|
|
3370
3370
|
V,
|
|
3371
3371
|
re,
|
|
3372
3372
|
te,
|
|
3373
|
-
|
|
3373
|
+
ce,
|
|
3374
3374
|
q,
|
|
3375
3375
|
_,
|
|
3376
3376
|
We,
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3377
|
+
L,
|
|
3378
|
+
me,
|
|
3379
|
+
ye,
|
|
3380
3380
|
Ee,
|
|
3381
3381
|
he,
|
|
3382
3382
|
At,
|
|
3383
|
-
|
|
3384
|
-
|
|
3383
|
+
ve,
|
|
3384
|
+
we,
|
|
3385
3385
|
// Canvas-zoom pinch update uses these viewport setters.
|
|
3386
3386
|
st,
|
|
3387
3387
|
yt
|
|
3388
3388
|
]
|
|
3389
3389
|
), En = ft((z) => {
|
|
3390
|
-
var W, Z, et, B,
|
|
3390
|
+
var W, Z, et, B, xe;
|
|
3391
3391
|
if (z.button === 2) return;
|
|
3392
|
-
if (z.target.releasePointerCapture(z.pointerId),
|
|
3393
|
-
Ge.current = null,
|
|
3392
|
+
if (z.target.releasePointerCapture(z.pointerId), Ne.current.delete(z.pointerId), Ge.current && (z.pointerId === Ge.current.pointerA || z.pointerId === Ge.current.pointerB)) {
|
|
3393
|
+
Ge.current = null, Ne.current.clear();
|
|
3394
3394
|
return;
|
|
3395
3395
|
}
|
|
3396
3396
|
if (Fe.current && Fe.current.pointerId === z.pointerId) {
|
|
3397
3397
|
const S = Fe.current;
|
|
3398
|
-
Fe.current = null, S.movedPastThreshold || (((W = S.pendingTap) == null ? void 0 : W.kind) === "select-element" ? (Xe(S.pendingTap.elementId),
|
|
3398
|
+
Fe.current = null, S.movedPastThreshold || (((W = S.pendingTap) == null ? void 0 : W.kind) === "select-element" ? (Xe(S.pendingTap.elementId), H([])) : ((Z = S.pendingTap) == null ? void 0 : Z.kind) === "deselect" && (Xe(null), H([])));
|
|
3399
3399
|
return;
|
|
3400
3400
|
}
|
|
3401
3401
|
if (h.getMode() === "pinch" && K.current) {
|
|
3402
|
-
const { a: S, b:
|
|
3403
|
-
if (z.pointerId === S || z.pointerId ===
|
|
3402
|
+
const { a: S, b: Y } = K.current;
|
|
3403
|
+
if (z.pointerId === S || z.pointerId === Y) {
|
|
3404
3404
|
const j = h.getContext().element, pe = ue.current ?? void 0;
|
|
3405
3405
|
j && Ve(
|
|
3406
3406
|
pe,
|
|
3407
3407
|
j
|
|
3408
|
-
), h.end(), K.current = null, ue.current = null,
|
|
3408
|
+
), h.end(), K.current = null, ue.current = null, Ne.current.clear();
|
|
3409
3409
|
return;
|
|
3410
3410
|
}
|
|
3411
3411
|
}
|
|
3412
3412
|
if (d.current && (d.current = null), _.isActive() && _.isDraggingHandle()) {
|
|
3413
3413
|
const S = _.isClosingPath();
|
|
3414
3414
|
if (_.finishDraggingHandle(), S && u instanceof wn) {
|
|
3415
|
-
const
|
|
3416
|
-
Ve(u,
|
|
3415
|
+
const Y = u.clone();
|
|
3416
|
+
Ve(u, Y);
|
|
3417
3417
|
}
|
|
3418
|
-
We((
|
|
3418
|
+
We((Y) => Y + 1);
|
|
3419
3419
|
return;
|
|
3420
3420
|
}
|
|
3421
3421
|
if (V) {
|
|
3422
|
-
tn(
|
|
3422
|
+
tn(H);
|
|
3423
3423
|
return;
|
|
3424
3424
|
}
|
|
3425
|
-
b.current && h.getMode() === "drag" && (b.current.forEach((
|
|
3425
|
+
b.current && h.getMode() === "drag" && (b.current.forEach((Y, Q) => {
|
|
3426
3426
|
const j = U.find((pe) => pe.id === Q);
|
|
3427
|
-
j && (
|
|
3427
|
+
j && (Y.x !== j.x || Y.y !== j.y || Y instanceof Re && j instanceof Re && JSON.stringify(Y.children.map((ke) => ({ x: ke.x, y: ke.y }))) !== JSON.stringify(j.children.map((ke) => ({ x: ke.x, y: ke.y })))) && Ve(Y, j);
|
|
3428
3428
|
}), b.current = null);
|
|
3429
3429
|
const fe = t.current;
|
|
3430
3430
|
if (fe && (fe.style.cursor = "default"), re.clearGuides(), re.clearSnapState(), zt([]), he.clearIndicators(), At([]), h._cropGroupContext && delete h._cropGroupContext, h._activeChildContext) {
|
|
3431
3431
|
if (q && u instanceof Re) {
|
|
3432
3432
|
const S = h.getContext(), j = (S._cachedElement && S._cachedElement[u.id] || u).children.find((pe) => pe.id === q.id);
|
|
3433
|
-
j && (Ze(j), G.update(j,
|
|
3433
|
+
j && (Ze(j), G.update(j, L));
|
|
3434
3434
|
}
|
|
3435
3435
|
delete h._activeChildContext;
|
|
3436
3436
|
}
|
|
3437
3437
|
if (h._multiSelectionResizeContext && delete h._multiSelectionResizeContext, U.forEach((S) => {
|
|
3438
3438
|
if (S instanceof to && S._lockedLineCount !== void 0) {
|
|
3439
|
-
const
|
|
3440
|
-
|
|
3439
|
+
const Y = S.clone();
|
|
3440
|
+
Y._lockedLineCount = void 0, Ie(Y);
|
|
3441
3441
|
}
|
|
3442
3442
|
}), h._multiSelectionDragContext) {
|
|
3443
3443
|
const S = h._multiSelectionDragContext;
|
|
3444
3444
|
if (S.startOBB && S.currentDelta) {
|
|
3445
|
-
const { dx:
|
|
3446
|
-
|
|
3445
|
+
const { dx: Y, dy: Q } = S.currentDelta, j = S.startOBB;
|
|
3446
|
+
ce.current = {
|
|
3447
3447
|
...j,
|
|
3448
|
-
centerX: j.centerX +
|
|
3448
|
+
centerX: j.centerX + Y,
|
|
3449
3449
|
centerY: j.centerY + Q
|
|
3450
3450
|
};
|
|
3451
3451
|
}
|
|
3452
3452
|
delete h._multiSelectionDragContext;
|
|
3453
3453
|
}
|
|
3454
3454
|
if (h._multiSelectionRotationContext) {
|
|
3455
|
-
if (h.getMode() === "rotate" && te.length > 0 &&
|
|
3456
|
-
const S =
|
|
3457
|
-
|
|
3455
|
+
if (h.getMode() === "rotate" && te.length > 0 && ce.current) {
|
|
3456
|
+
const S = ce.current;
|
|
3457
|
+
ce.current = {
|
|
3458
3458
|
...S,
|
|
3459
3459
|
rotation: S.rotation + h._multiSelectionRotationContext.currentRotation || S.rotation
|
|
3460
3460
|
};
|
|
@@ -3464,41 +3464,41 @@ function Mi(e) {
|
|
|
3464
3464
|
const dt = h.getContext();
|
|
3465
3465
|
if (dt._cachedElement && delete dt._cachedElement, h._pendingChildSelection) {
|
|
3466
3466
|
const S = h._pendingChildSelection;
|
|
3467
|
-
let
|
|
3467
|
+
let Y = !0;
|
|
3468
3468
|
if (u instanceof Re) {
|
|
3469
3469
|
const Q = h._groupDragOriginalElement;
|
|
3470
|
-
Q && (
|
|
3470
|
+
Q && (Y = !(Math.abs(u.x - Q.x) > 0.1 || Math.abs(u.y - Q.y) > 0.1));
|
|
3471
3471
|
}
|
|
3472
|
-
|
|
3472
|
+
Y && (Ze(S), G.update(S, L), We((Q) => Q + 1)), delete h._pendingChildSelection;
|
|
3473
3473
|
}
|
|
3474
3474
|
if (h._pendingTextEditMode) {
|
|
3475
|
-
const S = h._pendingTextEditMode,
|
|
3476
|
-
!(
|
|
3475
|
+
const S = h._pendingTextEditMode, Y = U.find((j) => j.id === S.elementId);
|
|
3476
|
+
!(Y && (Math.abs(Y.x - S.originalX) > 0.1 || Math.abs(Y.y - S.originalY) > 0.1)) && Y instanceof Qe && !(Y instanceof Yt) && !(Y instanceof Qn) && Ht(Y, S.clickX, S.clickY), delete h._pendingTextEditMode;
|
|
3477
3477
|
}
|
|
3478
|
-
if (
|
|
3479
|
-
const S =
|
|
3480
|
-
(z.clientX - (((B = Ue.current) == null ? void 0 : B.left) ?? 0)) /
|
|
3481
|
-
(z.clientY - (((
|
|
3482
|
-
) > 4 / Math.max(
|
|
3483
|
-
if (!pe && !ke && S === (u == null ? void 0 : u.id) &&
|
|
3478
|
+
if (Oe.current) {
|
|
3479
|
+
const S = Oe.current, Y = Je.current, Q = U.find((ee) => ee.id === S), j = (et = b.current) == null ? void 0 : et.get(S), pe = !!(Q && j && (Math.abs(Q.x - j.x) > 0.1 || Math.abs(Q.y - j.y) > 0.1)), ke = Y ? Math.hypot(
|
|
3480
|
+
(z.clientX - (((B = Ue.current) == null ? void 0 : B.left) ?? 0)) / L - me - Y.x,
|
|
3481
|
+
(z.clientY - (((xe = Ue.current) == null ? void 0 : xe.top) ?? 0)) / L - ye - Y.y
|
|
3482
|
+
) > 4 / Math.max(L, 1e-4) : !1;
|
|
3483
|
+
if (!pe && !ke && S === (u == null ? void 0 : u.id) && Y) {
|
|
3484
3484
|
const ee = gt(), J = [];
|
|
3485
3485
|
for (let X = ee.length - 1; X >= 0; X--) {
|
|
3486
3486
|
const M = ee[X];
|
|
3487
|
-
M.visible !== !1 && M.hitTest(
|
|
3487
|
+
M.visible !== !1 && M.hitTest(Y.x, Y.y) && hs(M, Y.x, Y.y, de) && J.push(M);
|
|
3488
3488
|
}
|
|
3489
3489
|
const k = J.findIndex((X) => X.id === S);
|
|
3490
3490
|
k !== -1 && k + 1 < J.length ? Xe(J[k + 1].id) : Xe(null);
|
|
3491
3491
|
}
|
|
3492
|
-
|
|
3492
|
+
Oe.current = null, Je.current = null;
|
|
3493
3493
|
}
|
|
3494
3494
|
h._groupDragOriginalElement && delete h._groupDragOriginalElement, h.end(), $e(!1), $ == null || $(!1), x.current = null, ct(0), se({});
|
|
3495
3495
|
}, [
|
|
3496
3496
|
h,
|
|
3497
3497
|
re,
|
|
3498
3498
|
V,
|
|
3499
|
-
|
|
3499
|
+
H,
|
|
3500
3500
|
te,
|
|
3501
|
-
|
|
3501
|
+
ce,
|
|
3502
3502
|
q,
|
|
3503
3503
|
u,
|
|
3504
3504
|
Ze,
|
|
@@ -3506,38 +3506,38 @@ function Mi(e) {
|
|
|
3506
3506
|
t,
|
|
3507
3507
|
_,
|
|
3508
3508
|
We,
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3509
|
+
L,
|
|
3510
|
+
me,
|
|
3511
|
+
ye,
|
|
3512
3512
|
$,
|
|
3513
|
-
|
|
3513
|
+
Ht,
|
|
3514
3514
|
U,
|
|
3515
3515
|
Xe,
|
|
3516
3516
|
Ve,
|
|
3517
|
-
|
|
3517
|
+
de
|
|
3518
3518
|
]), cs = ft(
|
|
3519
3519
|
(z) => {
|
|
3520
3520
|
if (!u) return;
|
|
3521
3521
|
const fe = t.current;
|
|
3522
3522
|
if (!fe) return;
|
|
3523
|
-
const dt = Ue.current ?? fe.getBoundingClientRect(), W = (z.clientX - dt.left) /
|
|
3523
|
+
const dt = Ue.current ?? fe.getBoundingClientRect(), W = (z.clientX - dt.left) / L - me, Z = (z.clientY - dt.top) / L - ye;
|
|
3524
3524
|
if (u.hitTest(W, Z)) {
|
|
3525
3525
|
if (u instanceof Re) {
|
|
3526
3526
|
const oe = u.hitTestChild(W, Z);
|
|
3527
3527
|
if (oe) {
|
|
3528
3528
|
if (!(q && q.id === oe.id)) return;
|
|
3529
3529
|
if (oe instanceof Qe && !(oe instanceof Re) && !(oe instanceof Qn)) {
|
|
3530
|
-
const
|
|
3530
|
+
const Ye = oe.getVisualBoundingBox(), it = en.toRadiansInverse(oe.rotation), bt = oe.getRotationAnchor(), Bt = W - bt.x, St = Z - bt.y, Et = Math.cos(it), Gt = Math.sin(it), ut = Bt * Et - St * Gt, kt = Bt * Gt + St * Et, kn = ut + Ye.width / 2, Ft = kt + Ye.height / 2, qt = Sn(oe, { x: kn, y: Ft }), jt = Ye.height + 16, _t = 6;
|
|
3531
3531
|
wt({
|
|
3532
|
-
x: dt.left + (
|
|
3533
|
-
y: dt.top + (
|
|
3534
|
-
width: Math.max(20,
|
|
3535
|
-
height: Math.max(jt *
|
|
3532
|
+
x: dt.left + (Ye.x + me) * L - _t,
|
|
3533
|
+
y: dt.top + (Ye.y + ye) * L - _t,
|
|
3534
|
+
width: Math.max(20, Ye.width * L),
|
|
3535
|
+
height: Math.max(jt * L, 50)
|
|
3536
3536
|
}), Xt(Ke(oe));
|
|
3537
3537
|
const $t = oe.getRichText().clone();
|
|
3538
3538
|
C.current = $t, rn($t);
|
|
3539
3539
|
const an = oe.getRichText().getStyleAt(Math.max(0, oe.text.length - 1));
|
|
3540
|
-
Ut({ ...oe.getDefaultStyle(), ...an }),
|
|
3540
|
+
Ut({ ...oe.getDefaultStyle(), ...an }), Me(qt), Ae(qt), Be(qt), on(!0), R.current = Date.now(), v.current = oe.id;
|
|
3541
3541
|
return;
|
|
3542
3542
|
}
|
|
3543
3543
|
}
|
|
@@ -3549,17 +3549,17 @@ function Mi(e) {
|
|
|
3549
3549
|
}
|
|
3550
3550
|
if (u instanceof Qn || !(u instanceof Qe))
|
|
3551
3551
|
return;
|
|
3552
|
-
const et = u.getVisualBoundingBox(), B = en.toRadiansInverse(u.rotation),
|
|
3552
|
+
const et = u.getVisualBoundingBox(), B = en.toRadiansInverse(u.rotation), xe = u.getRotationAnchor(), S = W - xe.x, Y = Z - xe.y, Q = Math.cos(B), j = Math.sin(B), pe = S * Q - Y * j, ke = S * j + Y * Q, ee = pe + et.width / 2, J = ke + et.height / 2, k = Sn(u, { x: ee, y: J }), X = et.height + 16, M = 6;
|
|
3553
3553
|
wt({
|
|
3554
|
-
x: dt.left + (et.x +
|
|
3555
|
-
y: dt.top + (et.y +
|
|
3556
|
-
width: Math.max(20, et.width *
|
|
3557
|
-
height: Math.max(X *
|
|
3554
|
+
x: dt.left + (et.x + me) * L - M,
|
|
3555
|
+
y: dt.top + (et.y + ye) * L - M,
|
|
3556
|
+
width: Math.max(20, et.width * L),
|
|
3557
|
+
height: Math.max(X * L, 50)
|
|
3558
3558
|
}), Xt(Ke(u));
|
|
3559
3559
|
const F = u.getRichText().clone();
|
|
3560
3560
|
C.current = F, rn(F);
|
|
3561
|
-
const
|
|
3562
|
-
Ut({ ...u.getDefaultStyle(), ...
|
|
3561
|
+
const ie = u.getRichText().getStyleAt(Math.max(0, u.text.length - 1));
|
|
3562
|
+
Ut({ ...u.getDefaultStyle(), ...ie }), Me(k), Ae(k), Be(k), on(!0), R.current = Date.now();
|
|
3563
3563
|
}
|
|
3564
3564
|
},
|
|
3565
3565
|
[
|
|
@@ -3569,16 +3569,16 @@ function Mi(e) {
|
|
|
3569
3569
|
G,
|
|
3570
3570
|
_,
|
|
3571
3571
|
We,
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3572
|
+
L,
|
|
3573
|
+
me,
|
|
3574
|
+
ye,
|
|
3575
3575
|
wt,
|
|
3576
3576
|
Xt,
|
|
3577
3577
|
rn,
|
|
3578
3578
|
Ut,
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3579
|
+
Me,
|
|
3580
|
+
Ae,
|
|
3581
|
+
Be,
|
|
3582
3582
|
on,
|
|
3583
3583
|
Ze,
|
|
3584
3584
|
ot,
|
|
@@ -3617,7 +3617,7 @@ function Mi(e) {
|
|
|
3617
3617
|
(z) => {
|
|
3618
3618
|
const fe = t.current;
|
|
3619
3619
|
if (!fe) return;
|
|
3620
|
-
const dt = z.target, W = dt ? fe.contains(dt) : !1, Z =
|
|
3620
|
+
const dt = z.target, W = dt ? fe.contains(dt) : !1, Z = Ne.current.has(z.pointerId) || Ge.current !== null || Fe.current !== null || K.current !== null || h.isInteracting();
|
|
3621
3621
|
if (!W && !Z) return;
|
|
3622
3622
|
const et = {
|
|
3623
3623
|
clientX: z.clientX,
|
|
@@ -3642,26 +3642,26 @@ function Mi(e) {
|
|
|
3642
3642
|
if (!rt) return;
|
|
3643
3643
|
z.preventDefault();
|
|
3644
3644
|
const fe = t.current;
|
|
3645
|
-
if (!fe || g || u instanceof
|
|
3646
|
-
const W = fe.getBoundingClientRect(), Z = (z.clientX - W.left) /
|
|
3647
|
-
let
|
|
3645
|
+
if (!fe || g || u instanceof Yt && u.isCropping || _.isActive()) return;
|
|
3646
|
+
const W = fe.getBoundingClientRect(), Z = (z.clientX - W.left) / L - me, et = (z.clientY - W.top) / L - ye, B = gt();
|
|
3647
|
+
let xe = null;
|
|
3648
3648
|
for (let S = B.length - 1; S >= 0; S--) {
|
|
3649
|
-
const
|
|
3650
|
-
if (
|
|
3651
|
-
|
|
3649
|
+
const Y = B[S];
|
|
3650
|
+
if (Y.visible !== !1 && Y.hitTest(Z, et) && hs(Y, Z, et, de)) {
|
|
3651
|
+
xe = Y;
|
|
3652
3652
|
break;
|
|
3653
3653
|
}
|
|
3654
3654
|
}
|
|
3655
|
-
if (
|
|
3656
|
-
const S = te.includes(
|
|
3657
|
-
!S && !
|
|
3655
|
+
if (xe) {
|
|
3656
|
+
const S = te.includes(xe.id), Y = (u == null ? void 0 : u.id) === xe.id;
|
|
3657
|
+
!S && !Y && (Xe(xe.id), H([]));
|
|
3658
3658
|
}
|
|
3659
3659
|
rt({
|
|
3660
3660
|
clientX: z.clientX,
|
|
3661
3661
|
clientY: z.clientY,
|
|
3662
3662
|
worldX: Z,
|
|
3663
3663
|
worldY: et,
|
|
3664
|
-
elementId:
|
|
3664
|
+
elementId: xe ? xe.id : null
|
|
3665
3665
|
});
|
|
3666
3666
|
},
|
|
3667
3667
|
[
|
|
@@ -3670,14 +3670,14 @@ function Mi(e) {
|
|
|
3670
3670
|
g,
|
|
3671
3671
|
u,
|
|
3672
3672
|
_,
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3673
|
+
L,
|
|
3674
|
+
me,
|
|
3675
|
+
ye,
|
|
3676
3676
|
gt,
|
|
3677
|
-
|
|
3677
|
+
de,
|
|
3678
3678
|
te,
|
|
3679
3679
|
Xe,
|
|
3680
|
-
|
|
3680
|
+
H
|
|
3681
3681
|
]
|
|
3682
3682
|
);
|
|
3683
3683
|
return {
|
|
@@ -3740,33 +3740,33 @@ function Ti(e) {
|
|
|
3740
3740
|
setEditRichText: q,
|
|
3741
3741
|
setCursorPosition: U,
|
|
3742
3742
|
setSelectionStart: te,
|
|
3743
|
-
setSelectionEnd:
|
|
3744
|
-
setEditPosition:
|
|
3745
|
-
setCurrentFormattingStyle:
|
|
3746
|
-
setCursorAnimationFrame:
|
|
3747
|
-
setHandlesVersion:
|
|
3748
|
-
setElements:
|
|
3749
|
-
onElementUpdate:
|
|
3750
|
-
onTextSelectionChange:
|
|
3751
|
-
transformHandles:
|
|
3743
|
+
setSelectionEnd: ce,
|
|
3744
|
+
setEditPosition: L,
|
|
3745
|
+
setCurrentFormattingStyle: me,
|
|
3746
|
+
setCursorAnimationFrame: ye,
|
|
3747
|
+
setHandlesVersion: ve,
|
|
3748
|
+
setElements: de,
|
|
3749
|
+
onElementUpdate: Me,
|
|
3750
|
+
onTextSelectionChange: Ae,
|
|
3751
|
+
transformHandles: Be,
|
|
3752
3752
|
updateActiveChild: $e
|
|
3753
3753
|
} = e, at = ft(
|
|
3754
3754
|
(h, G, re) => {
|
|
3755
3755
|
const he = t.current;
|
|
3756
3756
|
if (!he) return;
|
|
3757
|
-
const _ = he.getBoundingClientRect(),
|
|
3758
|
-
|
|
3759
|
-
x: _.left + (
|
|
3760
|
-
y: _.top + (
|
|
3761
|
-
width: Math.max(20,
|
|
3757
|
+
const _ = he.getBoundingClientRect(), we = h.getVisualBoundingBox(), Ie = en.toRadiansInverse(h.rotation), Ve = h.getRotationAnchor(), Xe = G - Ve.x, H = re - Ve.y, $ = Math.cos(Ie), ot = Math.sin(Ie), rt = Xe * $ - H * ot, Ze = Xe * ot + H * $, gt = rt + we.width / 2, Nt = Ze + we.height / 2, Dt = Sn(h, { x: gt, y: Nt }), tn = we.height + 16, Ht = 6;
|
|
3758
|
+
L({
|
|
3759
|
+
x: _.left + (we.x + ne) * w - Ht,
|
|
3760
|
+
y: _.top + (we.y + V) * w - Ht,
|
|
3761
|
+
width: Math.max(20, we.width * w),
|
|
3762
3762
|
height: Math.max(tn * w, 50)
|
|
3763
3763
|
}), u(fs(h));
|
|
3764
3764
|
const wt = h.getRichText().clone();
|
|
3765
3765
|
o.current = wt, q(wt);
|
|
3766
3766
|
const Xt = h.getRichText().getStyleAt(Math.max(0, h.text.length - 1));
|
|
3767
|
-
|
|
3767
|
+
me({ ...h.getDefaultStyle(), ...Xt }), U(Dt), te(Dt), ce(Dt), O(!0), p.current = Date.now();
|
|
3768
3768
|
},
|
|
3769
|
-
[w,
|
|
3769
|
+
[w, L, u, q, me, U, te, ce, O]
|
|
3770
3770
|
), pt = ft(
|
|
3771
3771
|
(h) => {
|
|
3772
3772
|
if (!C || !E)
|
|
@@ -3774,10 +3774,10 @@ function Ti(e) {
|
|
|
3774
3774
|
const G = Math.min(T, I), re = Math.max(T, I);
|
|
3775
3775
|
if (G === re) {
|
|
3776
3776
|
const he = E.clone(), _ = he.getText().length;
|
|
3777
|
-
he.applyStyle(0, _, h), o.current = he, q(he), u(he.getText()),
|
|
3777
|
+
he.applyStyle(0, _, h), o.current = he, q(he), u(he.getText()), me((we) => ({ ...we, ...h }));
|
|
3778
3778
|
} else {
|
|
3779
3779
|
const he = E.clone();
|
|
3780
|
-
he.applyStyle(G, re, h), o.current = he, q(he), u(he.getText()),
|
|
3780
|
+
he.applyStyle(G, re, h), o.current = he, q(he), u(he.getText()), me((_) => ({ ..._, ...h }));
|
|
3781
3781
|
}
|
|
3782
3782
|
},
|
|
3783
3783
|
[C, E, T, I]
|
|
@@ -3798,21 +3798,21 @@ function Ti(e) {
|
|
|
3798
3798
|
if (P && h) {
|
|
3799
3799
|
const G = s.current;
|
|
3800
3800
|
if (G && P instanceof Re) {
|
|
3801
|
-
const re = P.clone(), he = re.children.findIndex((
|
|
3801
|
+
const re = P.clone(), he = re.children.findIndex((we) => we.id === G);
|
|
3802
3802
|
if (he >= 0) {
|
|
3803
|
-
const
|
|
3804
|
-
|
|
3803
|
+
const we = re.children[he];
|
|
3804
|
+
we instanceof Qe && we.setRichText(h), re.updateBoundsFromChildren(!0);
|
|
3805
3805
|
}
|
|
3806
|
-
|
|
3806
|
+
Me(re);
|
|
3807
3807
|
const _ = re.children[he];
|
|
3808
|
-
_ && ($e(_),
|
|
3808
|
+
_ && ($e(_), Be.update(_, w), ve((we) => we + 1));
|
|
3809
3809
|
} else if (P instanceof Qe) {
|
|
3810
3810
|
const re = P.clone();
|
|
3811
|
-
re.setRichText(h),
|
|
3811
|
+
re.setRichText(h), Me(re), Be.update(re, w), ve((he) => he + 1);
|
|
3812
3812
|
}
|
|
3813
3813
|
}
|
|
3814
|
-
c.current = null, O(!1), u(""), q(null), o.current = null,
|
|
3815
|
-
}, [C, R, E, o, P,
|
|
3814
|
+
c.current = null, O(!1), u(""), q(null), o.current = null, me(null), s.current = null;
|
|
3815
|
+
}, [C, R, E, o, P, Me, Be, $e, w]), At = ft(() => {
|
|
3816
3816
|
if (Date.now() - l.current < x) {
|
|
3817
3817
|
if (n.current) {
|
|
3818
3818
|
n.current.focus();
|
|
@@ -3831,45 +3831,45 @@ function Ti(e) {
|
|
|
3831
3831
|
m.current = !1, (Ve = n.current) == null || Ve.focus(), n.current && n.current.setSelectionRange(T, I);
|
|
3832
3832
|
return;
|
|
3833
3833
|
}
|
|
3834
|
-
let _ = document.activeElement,
|
|
3834
|
+
let _ = document.activeElement, we = !1;
|
|
3835
3835
|
for (; _; ) {
|
|
3836
|
-
const
|
|
3836
|
+
const H = _.classList, $ = _.getAttribute("data-slot");
|
|
3837
3837
|
if ($ && ($.includes("popover") || $.includes("dialog"))) {
|
|
3838
|
-
|
|
3838
|
+
we = !0;
|
|
3839
3839
|
break;
|
|
3840
3840
|
}
|
|
3841
3841
|
if (_.hasAttribute("data-preserve-selection")) {
|
|
3842
|
-
|
|
3842
|
+
we = !0;
|
|
3843
3843
|
break;
|
|
3844
3844
|
}
|
|
3845
|
-
if (
|
|
3846
|
-
|
|
3845
|
+
if (H && (H.contains("sc-toolbar") || H.contains("sc-toolbar-items") || H.contains("sc-toolbar-btn") || H.contains("sc-toolbar-btn-sm") || H.contains("sc-toolbar-btn-icon") || H.contains("sc-toolbar-color") || H.contains("sc-toolbar-label") || H.contains("sc-toolbar-select") || H.contains("sc-toolbar-select-sm") || H.contains("sc-toolbar-group") || H.contains("sc-toolbar-scroll") || H.contains("sc-toolbar-color-label") || H.contains("sc-toolbar-color-square") || H.contains("sc-color-picker-dropdown") || H.contains("sc-text-color-panel") || H.contains("sc-tooltip-wrapper") || H.contains("sc-font-dropdown-with-label") || H.contains("sc-font-family-select-button") || H.contains("sc-more-menu-btn") || H.contains("sc-more-menu-toolbar") || H.contains("sc-font-drawer-overlay") || H.contains("sc-font-drawer-content") || H.contains("sc-font-drawer-handle") || H.contains("sc-font-drawer-handle-bar") || H.contains("sc-font-dropdown-list-container") || H.contains("sc-font-dropdown-search") || H.contains("sc-font-search-input") || H.contains("sc-font-category-filters") || H.contains("sc-font-category-btn") || H.contains("sc-font-grid-option") || H.contains("sc-font-section") || H.contains("sc-font-section-header") || H.contains("sc-font-section-used") || H.contains("sc-font-section-header-used") || H.contains("sc-font-dropdown-list-grid") || H.contains("sc-font-dropdown-list-grid-used") || H.contains("sc-font-preview") || H.contains("sc-font-name-label") || H.contains("sc-font-size-slider-container") || H.contains("sc-font-size-slider") || H.contains("sc-font-size-icon-small") || H.contains("sc-font-size-icon-large") || H.contains("sc-font-icon-toggle") || H.contains("sc-font-dropdown-empty") || H.contains("vaul-drawer-wrapper") || H.contains("vaul-overlay"))) {
|
|
3846
|
+
we = !0;
|
|
3847
3847
|
break;
|
|
3848
3848
|
}
|
|
3849
3849
|
_ = _.parentElement;
|
|
3850
3850
|
}
|
|
3851
|
-
if (!
|
|
3851
|
+
if (!we && b.current)
|
|
3852
3852
|
for (_ = b.current; _; ) {
|
|
3853
|
-
const
|
|
3853
|
+
const H = _.classList, $ = _.getAttribute("data-slot");
|
|
3854
3854
|
if ($ && ($.includes("popover") || $.includes("dialog"))) {
|
|
3855
|
-
|
|
3855
|
+
we = !0;
|
|
3856
3856
|
break;
|
|
3857
3857
|
}
|
|
3858
3858
|
if (_.hasAttribute("data-preserve-selection")) {
|
|
3859
|
-
|
|
3859
|
+
we = !0;
|
|
3860
3860
|
break;
|
|
3861
3861
|
}
|
|
3862
|
-
if (
|
|
3863
|
-
|
|
3862
|
+
if (H && (H.contains("sc-toolbar") || H.contains("sc-toolbar-items") || H.contains("sc-toolbar-btn") || H.contains("sc-toolbar-btn-sm") || H.contains("sc-toolbar-btn-icon") || H.contains("sc-toolbar-color") || H.contains("sc-toolbar-label") || H.contains("sc-toolbar-select") || H.contains("sc-toolbar-select-sm") || H.contains("sc-toolbar-group") || H.contains("sc-toolbar-scroll") || H.contains("sc-toolbar-color-label") || H.contains("sc-toolbar-color-square") || H.contains("sc-color-picker-dropdown") || H.contains("sc-text-color-panel") || H.contains("sc-tooltip-wrapper") || H.contains("sc-font-dropdown-with-label") || H.contains("sc-font-family-select-button") || H.contains("sc-more-menu-btn") || H.contains("sc-more-menu-toolbar") || H.contains("vaul-drawer-wrapper") || H.contains("vaul-overlay"))) {
|
|
3863
|
+
we = !0;
|
|
3864
3864
|
break;
|
|
3865
3865
|
}
|
|
3866
3866
|
_ = _.parentElement;
|
|
3867
3867
|
}
|
|
3868
|
-
if (!
|
|
3868
|
+
if (!we)
|
|
3869
3869
|
zt();
|
|
3870
3870
|
else {
|
|
3871
|
-
const
|
|
3872
|
-
(Xe = n.current) == null || Xe.focus(), n.current && n.current.setSelectionRange(
|
|
3871
|
+
const H = T, $ = I;
|
|
3872
|
+
(Xe = n.current) == null || Xe.focus(), n.current && n.current.setSelectionRange(H, $);
|
|
3873
3873
|
}
|
|
3874
3874
|
}, 0);
|
|
3875
3875
|
}, [zt, T, I]), We = ft(
|
|
@@ -3878,7 +3878,7 @@ function Ti(e) {
|
|
|
3878
3878
|
if (h.key === "Enter" && (h.metaKey || h.ctrlKey))
|
|
3879
3879
|
h.preventDefault(), zt();
|
|
3880
3880
|
else if (h.key === "Escape")
|
|
3881
|
-
h.preventDefault(), h.stopPropagation(), O(!1), u(""), q(null), o.current = null,
|
|
3881
|
+
h.preventDefault(), h.stopPropagation(), O(!1), u(""), q(null), o.current = null, me(null), s.current = null;
|
|
3882
3882
|
else if ((h.metaKey || h.ctrlKey) && h.key.toLowerCase() === "b")
|
|
3883
3883
|
h.preventDefault(), Pt("bold");
|
|
3884
3884
|
else if ((h.metaKey || h.ctrlKey) && h.key.toLowerCase() === "i")
|
|
@@ -3888,20 +3888,20 @@ function Ti(e) {
|
|
|
3888
3888
|
else if (h.key === "ArrowLeft" || h.key === "ArrowRight")
|
|
3889
3889
|
setTimeout(() => {
|
|
3890
3890
|
const re = G.selectionStart;
|
|
3891
|
-
U(re), te(re),
|
|
3891
|
+
U(re), te(re), ce(G.selectionEnd), i.current = re;
|
|
3892
3892
|
}, 0);
|
|
3893
3893
|
else if (h.key === "ArrowUp" || h.key === "ArrowDown") {
|
|
3894
3894
|
if (P && P instanceof Qe) {
|
|
3895
3895
|
h.preventDefault();
|
|
3896
3896
|
const re = h.key === "ArrowUp" ? "up" : "down", he = Io(P, A, re);
|
|
3897
|
-
U(he), te(he),
|
|
3897
|
+
U(he), te(he), ce(he), i.current = he, G.setSelectionRange(he, he);
|
|
3898
3898
|
}
|
|
3899
3899
|
} else (h.key === "Home" || h.key === "End") && setTimeout(() => {
|
|
3900
3900
|
const re = G.selectionStart;
|
|
3901
|
-
U(re), te(re),
|
|
3901
|
+
U(re), te(re), ce(G.selectionEnd), i.current = re;
|
|
3902
3902
|
}, 0);
|
|
3903
3903
|
},
|
|
3904
|
-
[zt, Pt, U, te,
|
|
3904
|
+
[zt, Pt, U, te, ce, i, A, P]
|
|
3905
3905
|
);
|
|
3906
3906
|
Pe(() => {
|
|
3907
3907
|
C && (a.current = performance.now());
|
|
@@ -3909,20 +3909,20 @@ function Ti(e) {
|
|
|
3909
3909
|
if (!C) return;
|
|
3910
3910
|
let h, G = 0;
|
|
3911
3911
|
const re = 33, he = (_) => {
|
|
3912
|
-
_ - G >= re && (
|
|
3912
|
+
_ - G >= re && (ye((we) => (we + 1) % 1e3), G = _), h = requestAnimationFrame(he);
|
|
3913
3913
|
};
|
|
3914
3914
|
return h = requestAnimationFrame(he), () => cancelAnimationFrame(h);
|
|
3915
3915
|
}, [C]);
|
|
3916
|
-
const Ee =
|
|
3916
|
+
const Ee = Se(!1);
|
|
3917
3917
|
Pe(() => {
|
|
3918
3918
|
if (C && !Ee.current && n.current) {
|
|
3919
3919
|
n.current.focus();
|
|
3920
3920
|
const h = R.length;
|
|
3921
|
-
U(h), te(h),
|
|
3921
|
+
U(h), te(h), ce(h), n.current.setSelectionRange(h, h);
|
|
3922
3922
|
}
|
|
3923
3923
|
Ee.current = C;
|
|
3924
3924
|
}, [C, R]);
|
|
3925
|
-
const lt =
|
|
3925
|
+
const lt = Se(null), se = (h, G) => h === G ? !0 : !h || !G ? !1 : h.color === G.color && h.fontFamily === G.fontFamily && h.fontSize === G.fontSize && h.bold === G.bold && h.italic === G.italic && h.underline === G.underline && h.strikethrough === G.strikethrough;
|
|
3926
3926
|
return Pe(() => {
|
|
3927
3927
|
if (!C || !E) return;
|
|
3928
3928
|
const h = Math.min(T, I), G = Math.max(T, I);
|
|
@@ -3934,7 +3934,7 @@ function Ti(e) {
|
|
|
3934
3934
|
const he = D.find((_) => _.id === g);
|
|
3935
3935
|
he instanceof Qe && (re = he.getDefaultStyle());
|
|
3936
3936
|
}
|
|
3937
|
-
re && !se(re, lt.current) && (lt.current = re,
|
|
3937
|
+
re && !se(re, lt.current) && (lt.current = re, me(re));
|
|
3938
3938
|
}
|
|
3939
3939
|
}, [C, E, T, I, g]), Pe(() => {
|
|
3940
3940
|
if (!C || !n.current) return;
|
|
@@ -3952,18 +3952,18 @@ function Ti(e) {
|
|
|
3952
3952
|
if (!(G instanceof Qe)) return;
|
|
3953
3953
|
const re = G.clone();
|
|
3954
3954
|
E && re.setRichText(E);
|
|
3955
|
-
const he = re.getVisualBoundingBox(), _ = t.current.getBoundingClientRect(),
|
|
3956
|
-
if (
|
|
3955
|
+
const he = re.getVisualBoundingBox(), _ = t.current.getBoundingClientRect(), we = he.height + 16, Ie = 6;
|
|
3956
|
+
if (L({
|
|
3957
3957
|
x: _.left + (he.x + ne) * w - Ie,
|
|
3958
3958
|
y: _.top + (he.y + V) * w - Ie,
|
|
3959
3959
|
width: Math.max(20, he.width * w),
|
|
3960
|
-
height: Math.max(
|
|
3960
|
+
height: Math.max(we * w, 50)
|
|
3961
3961
|
}), s.current && h instanceof Re) {
|
|
3962
|
-
const Ve = h.clone(), Xe = Ve.children.findIndex((
|
|
3963
|
-
Xe >= 0 && (Ve.children[Xe] = re, Ve.updateBoundsFromChildren(!0)),
|
|
3962
|
+
const Ve = h.clone(), Xe = Ve.children.findIndex((H) => H.id === s.current);
|
|
3963
|
+
Xe >= 0 && (Ve.children[Xe] = re, Ve.updateBoundsFromChildren(!0)), de((H) => H.map(($) => $.id === Ve.id ? Ve : $)), Be.update(re, w);
|
|
3964
3964
|
} else
|
|
3965
|
-
|
|
3966
|
-
|
|
3965
|
+
de((Ve) => Ve.map((Xe) => Xe.id === re.id ? re : Xe)), Be.update(re, w);
|
|
3966
|
+
ve((Ve) => Ve + 1);
|
|
3967
3967
|
}, 50), () => {
|
|
3968
3968
|
f.current && clearTimeout(f.current);
|
|
3969
3969
|
};
|
|
@@ -3972,8 +3972,8 @@ function Ti(e) {
|
|
|
3972
3972
|
const h = n.current, G = () => {
|
|
3973
3973
|
if (d.current || Date.now() - l.current < x)
|
|
3974
3974
|
return;
|
|
3975
|
-
const _ = h.selectionStart || 0,
|
|
3976
|
-
U((Ie) => Ie ===
|
|
3975
|
+
const _ = h.selectionStart || 0, we = h.selectionEnd || 0;
|
|
3976
|
+
U((Ie) => Ie === we ? Ie : we), te((Ie) => Ie === _ ? Ie : _), ce((Ie) => Ie === we ? Ie : we), Ae == null || Ae();
|
|
3977
3977
|
};
|
|
3978
3978
|
h.addEventListener("click", G), h.addEventListener("keyup", G), h.addEventListener("select", G), h.addEventListener("mouseup", G);
|
|
3979
3979
|
const re = () => {
|
|
@@ -3987,25 +3987,25 @@ function Ti(e) {
|
|
|
3987
3987
|
const re = G.target;
|
|
3988
3988
|
if (re.tagName === "INPUT" || re.tagName === "TEXTAREA" || G.key !== "Enter" || C || !t.current) return;
|
|
3989
3989
|
const he = t.current.getBoundingClientRect();
|
|
3990
|
-
if (N && N instanceof Qe && !(N instanceof Re) && !(N instanceof
|
|
3990
|
+
if (N && N instanceof Qe && !(N instanceof Re) && !(N instanceof Yt) && !(N instanceof Qn)) {
|
|
3991
3991
|
G.preventDefault();
|
|
3992
|
-
const _ = N.getVisualBoundingBox(),
|
|
3993
|
-
|
|
3992
|
+
const _ = N.getVisualBoundingBox(), we = _.height + 16, Ie = 6;
|
|
3993
|
+
L({
|
|
3994
3994
|
x: he.left + (_.x + ne) * w - Ie,
|
|
3995
3995
|
y: he.top + (_.y + V) * w - Ie,
|
|
3996
3996
|
width: Math.max(200, _.width * w),
|
|
3997
|
-
height: Math.max(
|
|
3997
|
+
height: Math.max(we * w, 50)
|
|
3998
3998
|
}), u(fs(N)), O(!0), p.current = Date.now(), s.current = N.id;
|
|
3999
3999
|
return;
|
|
4000
4000
|
}
|
|
4001
|
-
if (P && P instanceof Qe && !(P instanceof Re) && !(P instanceof
|
|
4001
|
+
if (P && P instanceof Qe && !(P instanceof Re) && !(P instanceof Yt) && !(P instanceof Qn)) {
|
|
4002
4002
|
G.preventDefault();
|
|
4003
|
-
const _ = P.getVisualBoundingBox(),
|
|
4004
|
-
|
|
4003
|
+
const _ = P.getVisualBoundingBox(), we = _.height + 16, Ie = 6;
|
|
4004
|
+
L({
|
|
4005
4005
|
x: he.left + (_.x + ne) * w - Ie,
|
|
4006
4006
|
y: he.top + (_.y + V) * w - Ie,
|
|
4007
4007
|
width: Math.max(200, _.width * w),
|
|
4008
|
-
height: Math.max(
|
|
4008
|
+
height: Math.max(we * w, 50)
|
|
4009
4009
|
}), u(fs(P)), O(!0), p.current = Date.now();
|
|
4010
4010
|
}
|
|
4011
4011
|
};
|
|
@@ -4057,31 +4057,31 @@ const yr = Nr(
|
|
|
4057
4057
|
pieceFocus: q,
|
|
4058
4058
|
focusedPieceRect: U
|
|
4059
4059
|
}, te) => {
|
|
4060
|
-
const { resolvedTheme:
|
|
4060
|
+
const { resolvedTheme: ce } = ho(), L = Se(null), me = R || L, ye = Se(null), ve = Se(!1), de = Se(0), Me = Se(0), Ae = Se(0), Be = Se(!1), $e = Se(0), at = Se(null), pt = Se(0), ct = Se(null), Pt = Se({ start: null, end: null }), zt = Se(null), At = Se(null), We = Se(null), Ee = Se(null), lt = 400, se = 300, h = 50, G = 200, re = je.useMemo(() => {
|
|
4061
4061
|
if (!q || q === "spread") return null;
|
|
4062
|
-
const
|
|
4063
|
-
if (
|
|
4064
|
-
const
|
|
4065
|
-
return
|
|
4062
|
+
const be = (u == null ? void 0 : u.pieces) ?? [];
|
|
4063
|
+
if (be.length <= 1) return null;
|
|
4064
|
+
const le = be.find((He) => He.id === q.pieceId);
|
|
4065
|
+
return le ? { x: le.x, y: le.y, width: le.width, height: le.height } : null;
|
|
4066
4066
|
}, [q, u]), he = U !== void 0 ? U : re, _ = je.useMemo(() => {
|
|
4067
4067
|
if (he) return he;
|
|
4068
|
-
const
|
|
4069
|
-
if (
|
|
4070
|
-
const
|
|
4071
|
-
return { x:
|
|
4068
|
+
const be = (u == null ? void 0 : u.pieces) ?? [];
|
|
4069
|
+
if (be.length === 1) {
|
|
4070
|
+
const le = be[0];
|
|
4071
|
+
return { x: le.x, y: le.y, width: le.width, height: le.height };
|
|
4072
4072
|
}
|
|
4073
4073
|
return null;
|
|
4074
4074
|
}, [he, u]), {
|
|
4075
|
-
isTouchDevice:
|
|
4075
|
+
isTouchDevice: we,
|
|
4076
4076
|
canvasSize: Ie,
|
|
4077
4077
|
lastTouchTargetRef: Ve,
|
|
4078
4078
|
effectiveViewPadding: Xe,
|
|
4079
|
-
paddedCanvasWidth:
|
|
4079
|
+
paddedCanvasWidth: H,
|
|
4080
4080
|
paddedCanvasHeight: $,
|
|
4081
4081
|
paddingOffsetX: ot,
|
|
4082
4082
|
paddingOffsetY: rt,
|
|
4083
4083
|
zoomInvariantBorderRadius: Ze
|
|
4084
|
-
} =
|
|
4084
|
+
} = Lo({
|
|
4085
4085
|
width: E,
|
|
4086
4086
|
height: A,
|
|
4087
4087
|
zoom: T,
|
|
@@ -4098,7 +4098,7 @@ const yr = Nr(
|
|
|
4098
4098
|
setSnapGuides: Nt,
|
|
4099
4099
|
spacingIndicators: Dt,
|
|
4100
4100
|
setSpacingIndicators: tn,
|
|
4101
|
-
isAltKeyPressed:
|
|
4101
|
+
isAltKeyPressed: Ht,
|
|
4102
4102
|
setIsAltKeyPressed: wt,
|
|
4103
4103
|
isRotating: Xt,
|
|
4104
4104
|
setIsRotating: rn,
|
|
@@ -4107,64 +4107,64 @@ const yr = Nr(
|
|
|
4107
4107
|
setCurrentRotation: Ke,
|
|
4108
4108
|
setRotatingElementVersion: Ue
|
|
4109
4109
|
} = _o(), {
|
|
4110
|
-
renderVersion:
|
|
4110
|
+
renderVersion: Ne,
|
|
4111
4111
|
forceRender: K,
|
|
4112
4112
|
handlesVersion: ue,
|
|
4113
|
-
setHandlesVersion:
|
|
4114
|
-
forceUpdate:
|
|
4113
|
+
setHandlesVersion: ge,
|
|
4114
|
+
forceUpdate: Oe,
|
|
4115
4115
|
cursorAnimationFrame: Je,
|
|
4116
4116
|
setCursorAnimationFrame: Ge
|
|
4117
|
-
} = $o({ elements: e }), [Fe] =
|
|
4118
|
-
const
|
|
4119
|
-
return
|
|
4117
|
+
} = $o({ elements: e }), [Fe] = ae(() => new io()), [nt] = ae(() => new ao({ showBorder: !1, showLabel: !1 })), [st] = ae(() => new co({ enabled: !0, showGuides: !0 })), [xt] = ae(() => new lo({ enabled: !0, showLabels: !0 })), [yt] = ae(() => {
|
|
4118
|
+
const be = new uo();
|
|
4119
|
+
return be.setResizePipeline(gs), be.setSnapHandler(st), be;
|
|
4120
4120
|
});
|
|
4121
4121
|
Pe(() => {
|
|
4122
4122
|
nt.setOptions({ borderRadius: Ze });
|
|
4123
4123
|
}, [Ze, nt]), Pe(() => {
|
|
4124
|
-
const
|
|
4124
|
+
const be = U !== void 0 ? U : re;
|
|
4125
4125
|
st.setExtraSnapRects(
|
|
4126
|
-
|
|
4126
|
+
be ? [{ id: "focused-piece", ...be }] : []
|
|
4127
4127
|
);
|
|
4128
4128
|
}, [st, U, re]);
|
|
4129
|
-
const
|
|
4130
|
-
|
|
4131
|
-
const
|
|
4132
|
-
as.current =
|
|
4133
|
-
const [An, En] =
|
|
4129
|
+
const Lt = Se(e);
|
|
4130
|
+
Lt.current = e;
|
|
4131
|
+
const Ce = e.find((be) => be.id === s), as = Se(Ce);
|
|
4132
|
+
as.current = Ce;
|
|
4133
|
+
const [An, En] = ae("");
|
|
4134
4134
|
Pe(() => {
|
|
4135
|
-
var
|
|
4135
|
+
var le;
|
|
4136
4136
|
if (!s) return;
|
|
4137
|
-
const
|
|
4138
|
-
if (
|
|
4139
|
-
if (
|
|
4140
|
-
const
|
|
4141
|
-
En(`Selected text element: ${
|
|
4142
|
-
} else
|
|
4137
|
+
const be = e.find((He) => He.id === s);
|
|
4138
|
+
if (be)
|
|
4139
|
+
if (be instanceof Qe) {
|
|
4140
|
+
const He = ((le = be.text) == null ? void 0 : le.slice(0, 40)) || "empty";
|
|
4141
|
+
En(`Selected text element: ${He}`);
|
|
4142
|
+
} else be instanceof Yt ? En("Selected image element") : be instanceof Re ? En("Selected group") : En("Selected element");
|
|
4143
4143
|
}, [s, e]);
|
|
4144
|
-
const cs =
|
|
4144
|
+
const cs = Se(n);
|
|
4145
4145
|
cs.current = n;
|
|
4146
|
-
const Xn =
|
|
4146
|
+
const Xn = Se(/* @__PURE__ */ new Map());
|
|
4147
4147
|
Pe(() => {
|
|
4148
|
-
const
|
|
4149
|
-
const
|
|
4148
|
+
const be = (le) => {
|
|
4149
|
+
const He = le, Le = cs.current.getActiveArtboardId(), tt = Xn.current.get(Le) || [], vt = [];
|
|
4150
4150
|
return tt.forEach((Rt) => {
|
|
4151
4151
|
Rt instanceof Re ? vt.push(...Rt.children) : vt.push(Rt);
|
|
4152
|
-
}), st.snapDimensions(
|
|
4152
|
+
}), st.snapDimensions(He, vt, He.startData);
|
|
4153
4153
|
};
|
|
4154
|
-
return gs.addHook("afterResize",
|
|
4155
|
-
gs.removeHook("afterResize",
|
|
4154
|
+
return gs.addHook("afterResize", be), () => {
|
|
4155
|
+
gs.removeHook("afterResize", be);
|
|
4156
4156
|
};
|
|
4157
4157
|
}, [st]);
|
|
4158
|
-
const { cropController: Wn } = Xo(), { penTool: xn, penCursor: z } = Do({ selectedElement:
|
|
4158
|
+
const { cropController: Wn } = Xo(), { penTool: xn, penCursor: z } = Do({ selectedElement: Ce }), {
|
|
4159
4159
|
isEditing: fe,
|
|
4160
4160
|
setIsEditing: dt,
|
|
4161
4161
|
editText: W,
|
|
4162
4162
|
setEditText: Z,
|
|
4163
4163
|
editPosition: et,
|
|
4164
4164
|
setEditPosition: B,
|
|
4165
|
-
cursorPosition:
|
|
4165
|
+
cursorPosition: xe,
|
|
4166
4166
|
setCursorPosition: S,
|
|
4167
|
-
selectionStart:
|
|
4167
|
+
selectionStart: Y,
|
|
4168
4168
|
setSelectionStart: Q,
|
|
4169
4169
|
selectionEnd: j,
|
|
4170
4170
|
setSelectionEnd: pe,
|
|
@@ -4175,30 +4175,30 @@ const yr = Nr(
|
|
|
4175
4175
|
editRichText: X,
|
|
4176
4176
|
setEditRichText: M,
|
|
4177
4177
|
editRichTextRef: F,
|
|
4178
|
-
currentFormattingStyle:
|
|
4178
|
+
currentFormattingStyle: ie,
|
|
4179
4179
|
setCurrentFormattingStyle: oe
|
|
4180
|
-
} =
|
|
4180
|
+
} = Ho({ selectedElement: Ce, ref: te });
|
|
4181
4181
|
Pe(() => {
|
|
4182
|
-
const
|
|
4183
|
-
|
|
4184
|
-
}, [
|
|
4182
|
+
const be = Date.now() - $e.current, le = at.current;
|
|
4183
|
+
le && be < se ? (Y !== le.start || j !== le.end) && (S(le.cursor), Q(le.start), pe(le.end), ye.current && ye.current.setSelectionRange(le.start, le.end)) : le && be >= se && (at.current = null);
|
|
4184
|
+
}, [Y, j, xe]), Pe(() => {
|
|
4185
4185
|
if (!fe) return;
|
|
4186
|
-
const
|
|
4187
|
-
if (!
|
|
4188
|
-
let
|
|
4189
|
-
const
|
|
4190
|
-
const
|
|
4191
|
-
if (!
|
|
4192
|
-
const vt = tt.getBoundingClientRect(), Rt = vt.left -
|
|
4193
|
-
Rt === 0 && ht === 0 || (
|
|
4186
|
+
const be = me.current;
|
|
4187
|
+
if (!be) return;
|
|
4188
|
+
let le = be.getBoundingClientRect();
|
|
4189
|
+
const He = () => {
|
|
4190
|
+
const Le = ye.current, tt = me.current;
|
|
4191
|
+
if (!Le || !tt) return;
|
|
4192
|
+
const vt = tt.getBoundingClientRect(), Rt = vt.left - le.left, ht = vt.top - le.top;
|
|
4193
|
+
Rt === 0 && ht === 0 || (le = vt, Le.style.left = `${parseFloat(Le.style.left || "0") + Rt}px`, Le.style.top = `${parseFloat(Le.style.top || "0") + ht}px`);
|
|
4194
4194
|
};
|
|
4195
|
-
return window.addEventListener("scroll",
|
|
4196
|
-
window.removeEventListener("scroll",
|
|
4195
|
+
return window.addEventListener("scroll", He, { passive: !0, capture: !0 }), window.addEventListener("resize", He), () => {
|
|
4196
|
+
window.removeEventListener("scroll", He, { capture: !0 }), window.removeEventListener("resize", He);
|
|
4197
4197
|
};
|
|
4198
4198
|
}, [fe]);
|
|
4199
4199
|
const {
|
|
4200
|
-
isMarqueeSelecting:
|
|
4201
|
-
marqueeStart:
|
|
4200
|
+
isMarqueeSelecting: Te,
|
|
4201
|
+
marqueeStart: Ye,
|
|
4202
4202
|
marqueeEnd: it,
|
|
4203
4203
|
marqueePreviewSelection: bt,
|
|
4204
4204
|
startMarqueeSelection: Bt,
|
|
@@ -4207,52 +4207,52 @@ const yr = Nr(
|
|
|
4207
4207
|
} = Po(), {
|
|
4208
4208
|
multiSelectionGroupBoundsRef: Gt,
|
|
4209
4209
|
multiSelectionOBBRef: ut
|
|
4210
|
-
} =
|
|
4210
|
+
} = Yo(o), {
|
|
4211
4211
|
activeChildElement: kt,
|
|
4212
4212
|
updateActiveChild: kn,
|
|
4213
4213
|
editingChildIdRef: Ft
|
|
4214
|
-
} = Bo({ elements: e, selectedElement:
|
|
4215
|
-
const
|
|
4216
|
-
return e.forEach((
|
|
4217
|
-
const
|
|
4218
|
-
|
|
4219
|
-
}),
|
|
4214
|
+
} = Bo({ elements: e, selectedElement: Ce, transformHandles: Fe, onActiveChildChange: d }), { hoverState: qt, setHoverState: jt } = Oo({ onHoverChange: p }), _t = xs(() => {
|
|
4215
|
+
const be = /* @__PURE__ */ new Map();
|
|
4216
|
+
return e.forEach((le) => {
|
|
4217
|
+
const He = n.getArtboardIdForElement(le.id);
|
|
4218
|
+
be.has(He) || be.set(He, []), be.get(He).push(le);
|
|
4219
|
+
}), be;
|
|
4220
4220
|
}, [e, n]);
|
|
4221
4221
|
Xn.current = _t;
|
|
4222
4222
|
const $t = ft(() => {
|
|
4223
|
-
const
|
|
4224
|
-
return _t.get(
|
|
4223
|
+
const be = n.getActiveArtboardId();
|
|
4224
|
+
return _t.get(be) || [];
|
|
4225
4225
|
}, [_t, n]);
|
|
4226
4226
|
Pe(() => {
|
|
4227
|
-
const
|
|
4227
|
+
const be = (Le) => {
|
|
4228
4228
|
if (!fe) {
|
|
4229
|
-
if (xn.isActive() &&
|
|
4230
|
-
if (
|
|
4231
|
-
|
|
4232
|
-
const tt =
|
|
4233
|
-
l(
|
|
4229
|
+
if (xn.isActive() && Ce instanceof wn) {
|
|
4230
|
+
if (Le.key === "Escape") {
|
|
4231
|
+
Le.preventDefault(), xn.finishPath();
|
|
4232
|
+
const tt = Ce.clone();
|
|
4233
|
+
l(Ce, tt), ge((vt) => vt + 1);
|
|
4234
4234
|
return;
|
|
4235
|
-
} else if (
|
|
4236
|
-
|
|
4235
|
+
} else if (Le.key === "Backspace" || Le.key === "Delete") {
|
|
4236
|
+
Le.preventDefault(), xn.deleteLastPoint(), ge((tt) => tt + 1);
|
|
4237
4237
|
return;
|
|
4238
4238
|
}
|
|
4239
4239
|
}
|
|
4240
|
-
|
|
4240
|
+
Le.altKey && wt(!0);
|
|
4241
4241
|
}
|
|
4242
|
-
},
|
|
4243
|
-
|
|
4244
|
-
},
|
|
4245
|
-
(!
|
|
4242
|
+
}, le = (Le) => {
|
|
4243
|
+
Le.altKey || wt(!1);
|
|
4244
|
+
}, He = (Le) => {
|
|
4245
|
+
(!Le.relatedTarget || !Le.relatedTarget.ownerDocument) && wt(!1);
|
|
4246
4246
|
};
|
|
4247
|
-
return window.addEventListener("keydown",
|
|
4248
|
-
window.removeEventListener("keydown",
|
|
4247
|
+
return window.addEventListener("keydown", be), window.addEventListener("keyup", le), window.addEventListener("blur", He), () => {
|
|
4248
|
+
window.removeEventListener("keydown", be), window.removeEventListener("keyup", le), window.removeEventListener("blur", He);
|
|
4249
4249
|
};
|
|
4250
|
-
}, [xn,
|
|
4251
|
-
if (!
|
|
4250
|
+
}, [xn, Ce, l, ge, fe]), Pe(() => {
|
|
4251
|
+
if (!me.current || !zt.current || yt.getMode() === "drag" || yt.getMode() === "resize")
|
|
4252
4252
|
return;
|
|
4253
|
-
const { x:
|
|
4254
|
-
if (
|
|
4255
|
-
let
|
|
4253
|
+
const { x: le, y: He } = zt.current;
|
|
4254
|
+
if (Ht) {
|
|
4255
|
+
let Le = null;
|
|
4256
4256
|
const tt = $t();
|
|
4257
4257
|
for (let vt = tt.length - 1; vt >= 0; vt--) {
|
|
4258
4258
|
const Rt = tt[vt];
|
|
@@ -4261,43 +4261,43 @@ const yr = Nr(
|
|
|
4261
4261
|
for (let ht = Rt.children.length - 1; ht >= 0; ht--) {
|
|
4262
4262
|
const qe = Rt.children[ht];
|
|
4263
4263
|
if (qe.visible === !1) continue;
|
|
4264
|
-
const
|
|
4265
|
-
if (
|
|
4266
|
-
|
|
4264
|
+
const De = qe.getVisualBoundingBox();
|
|
4265
|
+
if (le >= De.x && le <= De.x + De.width && He >= De.y && He <= De.y + De.height) {
|
|
4266
|
+
Le = qe;
|
|
4267
4267
|
break;
|
|
4268
4268
|
}
|
|
4269
4269
|
}
|
|
4270
4270
|
else {
|
|
4271
4271
|
const ht = Rt.getVisualBoundingBox();
|
|
4272
|
-
if (
|
|
4273
|
-
|
|
4272
|
+
if (le >= ht.x && le <= ht.x + ht.width && He >= ht.y && He <= ht.y + ht.height) {
|
|
4273
|
+
Le = Rt;
|
|
4274
4274
|
break;
|
|
4275
4275
|
}
|
|
4276
4276
|
}
|
|
4277
|
-
if (
|
|
4277
|
+
if (Le) break;
|
|
4278
4278
|
}
|
|
4279
4279
|
}
|
|
4280
|
-
if (
|
|
4280
|
+
if (Le) {
|
|
4281
4281
|
const vt = [];
|
|
4282
4282
|
tt.forEach((ht) => {
|
|
4283
4283
|
ht instanceof Re ? vt.push(...ht.children) : vt.push(ht);
|
|
4284
4284
|
});
|
|
4285
|
-
const Rt = xt.detectSpacing(
|
|
4285
|
+
const Rt = xt.detectSpacing(Le, vt, !0);
|
|
4286
4286
|
tn(Rt);
|
|
4287
4287
|
}
|
|
4288
4288
|
} else
|
|
4289
4289
|
tn([]);
|
|
4290
|
-
}, [
|
|
4291
|
-
const an =
|
|
4290
|
+
}, [Ht, $t, xt, yt]);
|
|
4291
|
+
const an = Se(null);
|
|
4292
4292
|
Pe(() => {
|
|
4293
|
-
const
|
|
4294
|
-
if (
|
|
4295
|
-
const
|
|
4296
|
-
an.current !==
|
|
4293
|
+
const be = e.find((He) => He.id === s), le = kt || be;
|
|
4294
|
+
if (le) {
|
|
4295
|
+
const He = le.getBoundingBox(), Le = `${le.id}-${He.x}-${He.y}-${He.width}-${He.height}-${le.rotation}`;
|
|
4296
|
+
an.current !== Le && (an.current = Le, Fe.update(le, T), ge((tt) => tt + 1));
|
|
4297
4297
|
}
|
|
4298
4298
|
}, [s, kt, Fe, T, e]);
|
|
4299
4299
|
const {
|
|
4300
|
-
handleTextEditBlur:
|
|
4300
|
+
handleTextEditBlur: Yn,
|
|
4301
4301
|
handleTextKeyDown: Vn,
|
|
4302
4302
|
applyFormattingToSelection: nn,
|
|
4303
4303
|
getSelectionStyle: ls,
|
|
@@ -4305,8 +4305,8 @@ const yr = Nr(
|
|
|
4305
4305
|
enterTextEditMode: Kn,
|
|
4306
4306
|
getWrappedTextForEditing: Un
|
|
4307
4307
|
} = Ti({
|
|
4308
|
-
canvasRef:
|
|
4309
|
-
inputRef:
|
|
4308
|
+
canvasRef: me,
|
|
4309
|
+
inputRef: ye,
|
|
4310
4310
|
editingChildIdRef: Ft,
|
|
4311
4311
|
editRichTextRef: F,
|
|
4312
4312
|
selectionAnchorRef: J,
|
|
@@ -4315,19 +4315,19 @@ const yr = Nr(
|
|
|
4315
4315
|
multiClickSelectionRef: at,
|
|
4316
4316
|
editPositionUpdateTimerRef: Ee,
|
|
4317
4317
|
draggingSelectionHandleRef: ct,
|
|
4318
|
-
repositioningCursorRef:
|
|
4319
|
-
editModeEnteredAtRef:
|
|
4318
|
+
repositioningCursorRef: ve,
|
|
4319
|
+
editModeEnteredAtRef: Ae,
|
|
4320
4320
|
lastTouchTargetRef: Ve,
|
|
4321
4321
|
MULTI_CLICK_DEBOUNCE: se,
|
|
4322
4322
|
EDIT_MODE_BLUR_DEBOUNCE: G,
|
|
4323
4323
|
isEditing: fe,
|
|
4324
4324
|
editText: W,
|
|
4325
4325
|
editRichText: X,
|
|
4326
|
-
cursorPosition:
|
|
4327
|
-
selectionStart:
|
|
4326
|
+
cursorPosition: xe,
|
|
4327
|
+
selectionStart: Y,
|
|
4328
4328
|
selectionEnd: j,
|
|
4329
4329
|
selectedId: s,
|
|
4330
|
-
selectedElement:
|
|
4330
|
+
selectedElement: Ce,
|
|
4331
4331
|
activeChildElement: kt,
|
|
4332
4332
|
elements: e,
|
|
4333
4333
|
zoom: T,
|
|
@@ -4342,7 +4342,7 @@ const yr = Nr(
|
|
|
4342
4342
|
setEditPosition: B,
|
|
4343
4343
|
setCurrentFormattingStyle: oe,
|
|
4344
4344
|
setCursorAnimationFrame: Ge,
|
|
4345
|
-
setHandlesVersion:
|
|
4345
|
+
setHandlesVersion: ge,
|
|
4346
4346
|
setElements: a,
|
|
4347
4347
|
onElementUpdate: i,
|
|
4348
4348
|
onTextSelectionChange: m,
|
|
@@ -4355,15 +4355,15 @@ const yr = Nr(
|
|
|
4355
4355
|
handleDoubleClick: Cr,
|
|
4356
4356
|
handleContextMenu: wr
|
|
4357
4357
|
} = Mi({
|
|
4358
|
-
canvasRef:
|
|
4359
|
-
inputRef:
|
|
4360
|
-
repositioningCursorRef:
|
|
4361
|
-
lastClickTimeRef:
|
|
4362
|
-
clickCountRef:
|
|
4358
|
+
canvasRef: me,
|
|
4359
|
+
inputRef: ye,
|
|
4360
|
+
repositioningCursorRef: ve,
|
|
4361
|
+
lastClickTimeRef: de,
|
|
4362
|
+
clickCountRef: Me,
|
|
4363
4363
|
lastProcessedClickTimeRef: pt,
|
|
4364
4364
|
lastMultiClickTimeRef: $e,
|
|
4365
4365
|
multiClickSelectionRef: at,
|
|
4366
|
-
skipDragSelectionRef:
|
|
4366
|
+
skipDragSelectionRef: Be,
|
|
4367
4367
|
draggingSelectionHandleRef: ct,
|
|
4368
4368
|
selectionHandlePositionsRef: Pt,
|
|
4369
4369
|
lastMousePosRef: zt,
|
|
@@ -4371,20 +4371,20 @@ const yr = Nr(
|
|
|
4371
4371
|
rotatingElementRef: We,
|
|
4372
4372
|
editingChildIdRef: Ft,
|
|
4373
4373
|
editRichTextRef: F,
|
|
4374
|
-
editModeEnteredAtRef:
|
|
4374
|
+
editModeEnteredAtRef: Ae,
|
|
4375
4375
|
multiSelectionGroupBoundsRef: Gt,
|
|
4376
4376
|
MULTI_CLICK_THRESHOLD: lt,
|
|
4377
4377
|
MULTI_CLICK_DEBOUNCE: se,
|
|
4378
4378
|
CLICK_DEDUP_THRESHOLD: h,
|
|
4379
4379
|
isEditing: fe,
|
|
4380
4380
|
editText: W,
|
|
4381
|
-
isTouchDevice:
|
|
4382
|
-
selectionStart:
|
|
4381
|
+
isTouchDevice: we,
|
|
4382
|
+
selectionStart: Y,
|
|
4383
4383
|
selectionEnd: j,
|
|
4384
4384
|
isRotating: Xt,
|
|
4385
|
-
isMarqueeSelecting:
|
|
4386
|
-
isAltKeyPressed:
|
|
4387
|
-
selectedElement:
|
|
4385
|
+
isMarqueeSelecting: Te,
|
|
4386
|
+
isAltKeyPressed: Ht,
|
|
4387
|
+
selectedElement: Ce,
|
|
4388
4388
|
activeChildElement: kt,
|
|
4389
4389
|
elements: e,
|
|
4390
4390
|
multiSelection: o,
|
|
@@ -4404,10 +4404,10 @@ const yr = Nr(
|
|
|
4404
4404
|
setIsAltKeyPressed: wt,
|
|
4405
4405
|
setSnapGuides: Nt,
|
|
4406
4406
|
setSpacingIndicators: tn,
|
|
4407
|
-
setHandlesVersion:
|
|
4407
|
+
setHandlesVersion: ge,
|
|
4408
4408
|
setHoverState: jt,
|
|
4409
4409
|
setElements: a,
|
|
4410
|
-
forceUpdate:
|
|
4410
|
+
forceUpdate: Oe,
|
|
4411
4411
|
stateMachine: yt,
|
|
4412
4412
|
transformHandles: Fe,
|
|
4413
4413
|
snapSystem: st,
|
|
@@ -4435,20 +4435,20 @@ const yr = Nr(
|
|
|
4435
4435
|
getWrappedTextForEditing: Un
|
|
4436
4436
|
});
|
|
4437
4437
|
ui({
|
|
4438
|
-
canvasRef:
|
|
4438
|
+
canvasRef: me,
|
|
4439
4439
|
elements: e,
|
|
4440
4440
|
elementsByArtboard: _t,
|
|
4441
4441
|
artboards: t,
|
|
4442
4442
|
artboardManager: n,
|
|
4443
4443
|
artboardRenderer: nt,
|
|
4444
4444
|
selectedId: s,
|
|
4445
|
-
selectedElement:
|
|
4445
|
+
selectedElement: Ce,
|
|
4446
4446
|
activeChildElement: kt,
|
|
4447
4447
|
editingChildIdRef: Ft,
|
|
4448
4448
|
transformHandles: Fe,
|
|
4449
4449
|
stateMachine: yt,
|
|
4450
4450
|
canvasSize: Ie,
|
|
4451
|
-
paddedCanvasWidth:
|
|
4451
|
+
paddedCanvasWidth: H,
|
|
4452
4452
|
paddedCanvasHeight: $,
|
|
4453
4453
|
paddingOffsetX: ot,
|
|
4454
4454
|
paddingOffsetY: rt,
|
|
@@ -4462,43 +4462,43 @@ const yr = Nr(
|
|
|
4462
4462
|
isEditing: fe,
|
|
4463
4463
|
editText: W,
|
|
4464
4464
|
editRichText: X,
|
|
4465
|
-
cursorPosition:
|
|
4466
|
-
selectionStart:
|
|
4465
|
+
cursorPosition: xe,
|
|
4466
|
+
selectionStart: Y,
|
|
4467
4467
|
selectionEnd: j,
|
|
4468
4468
|
cursorOpacityRef: ke,
|
|
4469
4469
|
cursorStartTimeRef: ee,
|
|
4470
|
-
isTouchDevice:
|
|
4470
|
+
isTouchDevice: we,
|
|
4471
4471
|
selectionHandlePositionsRef: Pt,
|
|
4472
4472
|
multiClickSelectionRef: at,
|
|
4473
4473
|
lastMultiClickTimeRef: $e,
|
|
4474
4474
|
MULTI_CLICK_DEBOUNCE: se,
|
|
4475
4475
|
snapGuides: gt,
|
|
4476
4476
|
spacingIndicators: Dt,
|
|
4477
|
-
isAltKeyPressed:
|
|
4477
|
+
isAltKeyPressed: Ht,
|
|
4478
4478
|
multiSelection: o,
|
|
4479
4479
|
multiSelectionOBBRef: ut,
|
|
4480
4480
|
multiSelectionGroupBoundsRef: Gt,
|
|
4481
|
-
isMarqueeSelecting:
|
|
4482
|
-
marqueeStart:
|
|
4481
|
+
isMarqueeSelecting: Te,
|
|
4482
|
+
marqueeStart: Ye,
|
|
4483
4483
|
marqueeEnd: it,
|
|
4484
4484
|
marqueePreviewSelection: bt,
|
|
4485
4485
|
penTool: xn,
|
|
4486
4486
|
handlesVersion: ue,
|
|
4487
4487
|
hideHandles: C,
|
|
4488
|
-
resolvedTheme:
|
|
4488
|
+
resolvedTheme: ce,
|
|
4489
4489
|
cursorAnimationFrame: Je,
|
|
4490
|
-
renderVersion:
|
|
4490
|
+
renderVersion: Ne,
|
|
4491
4491
|
pieceGuides: u,
|
|
4492
4492
|
focusedPieceId: q && q !== "spread" ? q.pieceId : null,
|
|
4493
4493
|
focusedPieceRect: he
|
|
4494
4494
|
}), nr(
|
|
4495
4495
|
te,
|
|
4496
4496
|
() => ({
|
|
4497
|
-
applyTextFormatting: (
|
|
4498
|
-
nn(
|
|
4497
|
+
applyTextFormatting: (be) => {
|
|
4498
|
+
nn(be);
|
|
4499
4499
|
},
|
|
4500
|
-
toggleFormattingProperty: (
|
|
4501
|
-
ds(
|
|
4500
|
+
toggleFormattingProperty: (be) => {
|
|
4501
|
+
ds(be);
|
|
4502
4502
|
},
|
|
4503
4503
|
isEditingText: () => fe,
|
|
4504
4504
|
isRotating: () => Xt,
|
|
@@ -4508,36 +4508,36 @@ const yr = Nr(
|
|
|
4508
4508
|
getEditingState: () => ({
|
|
4509
4509
|
isEditing: fe,
|
|
4510
4510
|
editText: W,
|
|
4511
|
-
cursorPosition:
|
|
4512
|
-
selectionStart:
|
|
4511
|
+
cursorPosition: xe,
|
|
4512
|
+
selectionStart: Y,
|
|
4513
4513
|
selectionEnd: j
|
|
4514
4514
|
}),
|
|
4515
4515
|
getCropState: () => ({
|
|
4516
|
-
isCropping:
|
|
4517
|
-
elementId: (
|
|
4516
|
+
isCropping: Ce instanceof Yt && Ce.isCropping,
|
|
4517
|
+
elementId: (Ce == null ? void 0 : Ce.id) || null
|
|
4518
4518
|
}),
|
|
4519
4519
|
getPaddingOffset: () => ({ x: ot, y: rt })
|
|
4520
4520
|
}),
|
|
4521
|
-
[nn, ds, fe, Xt, ls, T, K, W,
|
|
4521
|
+
[nn, ds, fe, Xt, ls, T, K, W, xe, Y, j, Ce, ot, rt]
|
|
4522
4522
|
);
|
|
4523
4523
|
const Sr = xs(() => {
|
|
4524
4524
|
if (!O || O.length === 0) return;
|
|
4525
|
-
const
|
|
4525
|
+
const be = H * T, le = $ * T, He = `M 0 0 h ${be} v ${le} h ${-be} Z`, Le = O.map((tt) => {
|
|
4526
4526
|
if (tt.kind === "rect" || tt.kind === "roundedRect") {
|
|
4527
4527
|
const vt = (ot + tt.x) * T, Rt = (rt + tt.y) * T, ht = tt.width * T, qe = tt.height * T;
|
|
4528
4528
|
if (tt.kind === "roundedRect") {
|
|
4529
|
-
const
|
|
4530
|
-
if (
|
|
4529
|
+
const De = (tt.rx ?? tt.ry ?? 0) * T, mt = (tt.ry ?? tt.rx ?? 0) * T;
|
|
4530
|
+
if (De > 0 || mt > 0)
|
|
4531
4531
|
return [
|
|
4532
|
-
`M ${vt +
|
|
4533
|
-
`h ${ht - 2 *
|
|
4534
|
-
`a ${
|
|
4532
|
+
`M ${vt + De} ${Rt}`,
|
|
4533
|
+
`h ${ht - 2 * De}`,
|
|
4534
|
+
`a ${De} ${mt} 0 0 1 ${De} ${mt}`,
|
|
4535
4535
|
`v ${qe - 2 * mt}`,
|
|
4536
|
-
`a ${
|
|
4537
|
-
`h ${-(ht - 2 *
|
|
4538
|
-
`a ${
|
|
4536
|
+
`a ${De} ${mt} 0 0 1 ${-De} ${mt}`,
|
|
4537
|
+
`h ${-(ht - 2 * De)}`,
|
|
4538
|
+
`a ${De} ${mt} 0 0 1 ${-De} ${-mt}`,
|
|
4539
4539
|
`v ${-(qe - 2 * mt)}`,
|
|
4540
|
-
`a ${
|
|
4540
|
+
`a ${De} ${mt} 0 0 1 ${De} ${-mt}`,
|
|
4541
4541
|
"Z"
|
|
4542
4542
|
].join(" ");
|
|
4543
4543
|
}
|
|
@@ -4545,9 +4545,9 @@ const yr = Nr(
|
|
|
4545
4545
|
}
|
|
4546
4546
|
return "";
|
|
4547
4547
|
}).filter(Boolean);
|
|
4548
|
-
if (
|
|
4549
|
-
return `path(evenodd, "${
|
|
4550
|
-
}, [O,
|
|
4548
|
+
if (Le.length !== 0)
|
|
4549
|
+
return `path(evenodd, "${He} ${Le.join(" ")}")`;
|
|
4550
|
+
}, [O, H, $, ot, rt, T]);
|
|
4551
4551
|
return /* @__PURE__ */ y(Pn, { children: [
|
|
4552
4552
|
/* @__PURE__ */ r(
|
|
4553
4553
|
"div",
|
|
@@ -4564,7 +4564,7 @@ const yr = Nr(
|
|
|
4564
4564
|
{
|
|
4565
4565
|
role: "application",
|
|
4566
4566
|
"aria-label": "Design editor canvas. Use mouse or touch to select, move, and resize elements.",
|
|
4567
|
-
ref:
|
|
4567
|
+
ref: me,
|
|
4568
4568
|
onPointerDown: Wt,
|
|
4569
4569
|
onPointerMove: Rn,
|
|
4570
4570
|
onPointerUp: yn,
|
|
@@ -4585,9 +4585,9 @@ const yr = Nr(
|
|
|
4585
4585
|
// products keep the legacy editor-surface fill so the
|
|
4586
4586
|
// design canvas still reads as a distinct surface.
|
|
4587
4587
|
background: u ? "transparent" : "var(--color-canvas-bg)",
|
|
4588
|
-
width: `${
|
|
4588
|
+
width: `${H * T}px`,
|
|
4589
4589
|
height: `${$ * T}px`,
|
|
4590
|
-
cursor: xn.isActive() &&
|
|
4590
|
+
cursor: xn.isActive() && Ce instanceof wn ? z : void 0,
|
|
4591
4591
|
position: "absolute",
|
|
4592
4592
|
left: `${I}px`,
|
|
4593
4593
|
top: `${g}px`,
|
|
@@ -4597,39 +4597,39 @@ const yr = Nr(
|
|
|
4597
4597
|
}
|
|
4598
4598
|
),
|
|
4599
4599
|
fe && (() => {
|
|
4600
|
-
let
|
|
4601
|
-
if (Ft.current &&
|
|
4602
|
-
const qe =
|
|
4603
|
-
qe && (
|
|
4600
|
+
let be = Ce;
|
|
4601
|
+
if (Ft.current && Ce instanceof Re) {
|
|
4602
|
+
const qe = Ce.children.find((De) => De.id === Ft.current);
|
|
4603
|
+
qe && (be = qe);
|
|
4604
4604
|
}
|
|
4605
|
-
const
|
|
4605
|
+
const le = be instanceof Qe ? be : null, He = (le == null ? void 0 : le.fontSize) || 24, Le = (le == null ? void 0 : le.fontFamily) || "Arial", tt = (le == null ? void 0 : le.bold) || !1, vt = (le == null ? void 0 : le.italic) || !1, Rt = (le == null ? void 0 : le.textAlign) || "center", ht = /* @__PURE__ */ r(
|
|
4606
4606
|
"textarea",
|
|
4607
4607
|
{
|
|
4608
|
-
ref:
|
|
4608
|
+
ref: ye,
|
|
4609
4609
|
"data-preserve-selection": "",
|
|
4610
4610
|
value: W,
|
|
4611
4611
|
onChange: (qe) => {
|
|
4612
|
-
const
|
|
4612
|
+
const De = qe.target.value;
|
|
4613
4613
|
if (!X) {
|
|
4614
|
-
const Jt = no.fromPlainText(
|
|
4615
|
-
F.current = Jt, M(Jt), Z(
|
|
4614
|
+
const Jt = no.fromPlainText(De, {});
|
|
4615
|
+
F.current = Jt, M(Jt), Z(De);
|
|
4616
4616
|
const Gn = qe.target.selectionEnd;
|
|
4617
4617
|
S(Gn), Q(qe.target.selectionStart), pe(qe.target.selectionEnd);
|
|
4618
4618
|
return;
|
|
4619
4619
|
}
|
|
4620
4620
|
const mt = W, bn = X.clone();
|
|
4621
4621
|
let Vt = 0;
|
|
4622
|
-
for (; Vt < mt.length && Vt <
|
|
4622
|
+
for (; Vt < mt.length && Vt < De.length && mt[Vt] === De[Vt]; )
|
|
4623
4623
|
Vt++;
|
|
4624
4624
|
let Zt = 0;
|
|
4625
|
-
for (; Zt < mt.length - Vt && Zt <
|
|
4625
|
+
for (; Zt < mt.length - Vt && Zt < De.length - Vt && mt[mt.length - 1 - Zt] === De[De.length - 1 - Zt]; )
|
|
4626
4626
|
Zt++;
|
|
4627
|
-
const cn = Vt, Mn = mt.length - Zt, Tn =
|
|
4627
|
+
const cn = Vt, Mn = mt.length - Zt, Tn = De.substring(Vt, De.length - Zt);
|
|
4628
4628
|
if (Mn > cn && bn.delete(cn, Mn), Tn.length > 0) {
|
|
4629
4629
|
let Jt;
|
|
4630
|
-
|
|
4630
|
+
ie ? Jt = ie : cn > 0 ? Jt = bn.getStyleAt(cn - 1) : Ce instanceof Qe ? Jt = Ce.getDefaultStyle() : Jt = {}, bn.insert(cn, Tn, Jt);
|
|
4631
4631
|
}
|
|
4632
|
-
F.current = bn, M(bn), Z(
|
|
4632
|
+
F.current = bn, M(bn), Z(De);
|
|
4633
4633
|
const fn = qe.target.selectionEnd;
|
|
4634
4634
|
S(fn), Q(qe.target.selectionStart), pe(qe.target.selectionEnd), J.current = fn;
|
|
4635
4635
|
const vn = qe.target;
|
|
@@ -4637,50 +4637,50 @@ const yr = Nr(
|
|
|
4637
4637
|
vn && document.activeElement === vn && vn.setSelectionRange(fn, fn);
|
|
4638
4638
|
}, 0);
|
|
4639
4639
|
},
|
|
4640
|
-
onBlur:
|
|
4640
|
+
onBlur: Yn,
|
|
4641
4641
|
onKeyDown: Vn,
|
|
4642
4642
|
onPointerDown: (qe) => {
|
|
4643
|
-
if (qe.preventDefault(), !
|
|
4644
|
-
const
|
|
4645
|
-
if (
|
|
4646
|
-
pt.current =
|
|
4647
|
-
const mt =
|
|
4648
|
-
|
|
4643
|
+
if (qe.preventDefault(), !Ce || !(Ce instanceof Qe) || !me.current) return;
|
|
4644
|
+
const De = Date.now();
|
|
4645
|
+
if (De - pt.current < h) return;
|
|
4646
|
+
pt.current = De, De - $e.current >= se && (at.current = null);
|
|
4647
|
+
const mt = me.current.getBoundingClientRect(), bn = (qe.clientX - mt.left) / T - ot, Vt = (qe.clientY - mt.top) / T - rt, Zt = Ce.getVisualBoundingBox(), cn = Ce.getRotationAnchor(), Mn = en.toRadiansInverse(Ce.rotation), Tn = bn - cn.x, fn = Vt - cn.y, vn = Math.cos(Mn), Jt = Math.sin(Mn), Gn = Tn * vn - fn * Jt, Cs = Tn * Jt + fn * vn, ws = Gn + Zt.width / 2, Nn = Cs + Zt.height / 2, sn = Sn(Ce, { x: ws, y: Nn });
|
|
4648
|
+
De - de.current < lt ? Me.current += 1 : Me.current = 1, de.current = De;
|
|
4649
4649
|
const pn = W;
|
|
4650
|
-
if (k.current = !1,
|
|
4651
|
-
qe.preventDefault(), $e.current =
|
|
4652
|
-
else if (
|
|
4650
|
+
if (k.current = !1, Me.current >= 3)
|
|
4651
|
+
qe.preventDefault(), $e.current = De, at.current = { start: 0, end: pn.length, cursor: pn.length }, Be.current = !0, Me.current = 0, J.current = 0, S(pn.length), Q(0), pe(pn.length), ye.current && (ye.current.focus(), ye.current.setSelectionRange(0, pn.length));
|
|
4652
|
+
else if (Me.current === 2) {
|
|
4653
4653
|
qe.preventDefault();
|
|
4654
4654
|
const ln = xr(pn, sn);
|
|
4655
|
-
$e.current =
|
|
4655
|
+
$e.current = De, at.current = { start: ln.start, end: ln.end, cursor: ln.end }, Be.current = !0, J.current = ln.start, S(ln.end), Q(ln.start), pe(ln.end), ye.current && (ye.current.focus(), ye.current.setSelectionRange(ln.start, ln.end));
|
|
4656
4656
|
} else
|
|
4657
|
-
at.current = null, J.current = sn, Q(sn), S(sn), pe(sn),
|
|
4657
|
+
at.current = null, J.current = sn, Q(sn), S(sn), pe(sn), ye.current && (ye.current.focus(), ye.current.setSelectionRange(sn, sn)), Be.current = !1;
|
|
4658
4658
|
},
|
|
4659
4659
|
onPointerMove: (qe) => {
|
|
4660
4660
|
if (qe.buttons !== 1) return;
|
|
4661
|
-
if (ct.current &&
|
|
4662
|
-
const qn =
|
|
4661
|
+
if (ct.current && Ce instanceof Qe && me.current) {
|
|
4662
|
+
const qn = me.current.getBoundingClientRect(), pn = (qe.clientX - qn.left) / T - ot, ln = (qe.clientY - qn.top) / T - rt, Bs = Ce.getVisualBoundingBox(), Os = Ce.getRotationAnchor(), zs = en.toRadiansInverse(Ce.rotation), Xs = pn - Os.x, Ys = ln - Os.y, Hs = Math.cos(zs), Ls = Math.sin(zs), Er = Xs * Hs - Ys * Ls, kr = Xs * Ls + Ys * Hs, mn = Pt.current;
|
|
4663
4663
|
let Ss = 0;
|
|
4664
4664
|
ct.current === "start" && (mn != null && mn.start) ? Ss = mn.start.textEdge.y - mn.start.center.y : ct.current === "end" && (mn != null && mn.end) && (Ss = mn.end.textEdge.y - mn.end.center.y);
|
|
4665
|
-
const Rr = Er + Bs.width / 2, Mr = kr + Ss + Bs.height / 2, gn = Sn(
|
|
4666
|
-
if (ct.current === "start" ? gn <= j ? (Q(gn), S(gn)) : (Q(j), pe(gn), S(gn), ct.current = "end") : gn >=
|
|
4667
|
-
const Tr = Math.min(
|
|
4668
|
-
|
|
4665
|
+
const Rr = Er + Bs.width / 2, Mr = kr + Ss + Bs.height / 2, gn = Sn(Ce, { x: Rr, y: Mr });
|
|
4666
|
+
if (ct.current === "start" ? gn <= j ? (Q(gn), S(gn)) : (Q(j), pe(gn), S(gn), ct.current = "end") : gn >= Y ? (pe(gn), S(gn)) : (pe(Y), Q(gn), S(gn), ct.current = "start"), ye.current) {
|
|
4667
|
+
const Tr = Math.min(Y, j), Ir = Math.max(Y, j);
|
|
4668
|
+
ye.current.setSelectionRange(Tr, Ir);
|
|
4669
4669
|
}
|
|
4670
4670
|
return;
|
|
4671
4671
|
}
|
|
4672
|
-
if (
|
|
4673
|
-
const
|
|
4674
|
-
if (sn !== Nn && (k.current = !0), pe(Nn), S(Nn), Q(sn),
|
|
4672
|
+
if (Be.current || !Ce || !(Ce instanceof Qe) || !me.current) return;
|
|
4673
|
+
const De = me.current.getBoundingClientRect(), mt = (qe.clientX - De.left) / T - ot, bn = (qe.clientY - De.top) / T - rt, Vt = Ce.getVisualBoundingBox(), Zt = Ce.getRotationAnchor(), cn = en.toRadiansInverse(Ce.rotation), Mn = mt - Zt.x, Tn = bn - Zt.y, fn = Math.cos(cn), vn = Math.sin(cn), Jt = Mn * fn - Tn * vn, Gn = Mn * vn + Tn * fn, Cs = Jt + Vt.width / 2, ws = Gn + Vt.height / 2, Nn = Sn(Ce, { x: Cs, y: ws }), sn = J.current;
|
|
4674
|
+
if (sn !== Nn && (k.current = !0), pe(Nn), S(Nn), Q(sn), ye.current) {
|
|
4675
4675
|
const qn = Math.min(sn, Nn), pn = Math.max(sn, Nn);
|
|
4676
|
-
|
|
4676
|
+
ye.current.setSelectionRange(qn, pn);
|
|
4677
4677
|
}
|
|
4678
4678
|
},
|
|
4679
4679
|
onPointerUp: () => {
|
|
4680
4680
|
ct.current && (ct.current = null);
|
|
4681
4681
|
},
|
|
4682
4682
|
onClick: () => {
|
|
4683
|
-
k.current = !1,
|
|
4683
|
+
k.current = !1, Be.current = !1;
|
|
4684
4684
|
},
|
|
4685
4685
|
onSelect: () => {
|
|
4686
4686
|
},
|
|
@@ -4692,8 +4692,8 @@ const yr = Nr(
|
|
|
4692
4692
|
top: `${et.y}px`,
|
|
4693
4693
|
width: `${et.width}px`,
|
|
4694
4694
|
height: `${et.height || 50}px`,
|
|
4695
|
-
fontSize: `${
|
|
4696
|
-
fontFamily: `"${
|
|
4695
|
+
fontSize: `${He * T}px`,
|
|
4696
|
+
fontFamily: `"${Le}", Arial, sans-serif`,
|
|
4697
4697
|
fontWeight: tt ? 700 : 400,
|
|
4698
4698
|
fontStyle: vt ? "italic" : "normal",
|
|
4699
4699
|
textAlign: Rt,
|
|
@@ -4746,7 +4746,7 @@ const Ii = fr(
|
|
|
4746
4746
|
}
|
|
4747
4747
|
}
|
|
4748
4748
|
);
|
|
4749
|
-
function
|
|
4749
|
+
function Hn({
|
|
4750
4750
|
className: e,
|
|
4751
4751
|
variant: t,
|
|
4752
4752
|
size: n,
|
|
@@ -4964,7 +4964,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
4964
4964
|
groupLayers: R,
|
|
4965
4965
|
ungroupLayer: E,
|
|
4966
4966
|
findElementById: A
|
|
4967
|
-
} = rr(), T = sr(), I =
|
|
4967
|
+
} = rr(), T = sr(), I = Se(null);
|
|
4968
4968
|
Pe(() => {
|
|
4969
4969
|
var u;
|
|
4970
4970
|
(u = I.current) == null || u.focus();
|
|
@@ -5154,7 +5154,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5154
5154
|
/* @__PURE__ */ r("div", { className: "sc-root", style: { display: "contents" }, children: O }),
|
|
5155
5155
|
document.body
|
|
5156
5156
|
);
|
|
5157
|
-
}, Oi = 0.25, zi = 8, Xi = 0.1,
|
|
5157
|
+
}, Oi = 0.25, zi = 8, Xi = 0.1, Yi = 4, Hi = 1e-3, Wa = ({
|
|
5158
5158
|
className: e,
|
|
5159
5159
|
style: t,
|
|
5160
5160
|
width: n,
|
|
@@ -5171,7 +5171,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5171
5171
|
pieceGuides: b,
|
|
5172
5172
|
pieceFocus: x
|
|
5173
5173
|
}) => {
|
|
5174
|
-
var
|
|
5174
|
+
var Ne;
|
|
5175
5175
|
const {
|
|
5176
5176
|
canvasEditorRef: v,
|
|
5177
5177
|
canvasRef: C,
|
|
@@ -5194,17 +5194,17 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5194
5194
|
} = Ts(), {
|
|
5195
5195
|
selectedId: U,
|
|
5196
5196
|
multiSelection: te,
|
|
5197
|
-
handleSelectionChange:
|
|
5198
|
-
setMultiSelection:
|
|
5199
|
-
handleActiveChildChange:
|
|
5200
|
-
setHoveredElementId:
|
|
5201
|
-
hideHandles:
|
|
5197
|
+
handleSelectionChange: ce,
|
|
5198
|
+
setMultiSelection: L,
|
|
5199
|
+
handleActiveChildChange: me,
|
|
5200
|
+
setHoveredElementId: ye,
|
|
5201
|
+
hideHandles: ve
|
|
5202
5202
|
} = Br(), {
|
|
5203
|
-
setTextSelectionVersion:
|
|
5204
|
-
setExpandedPanelType:
|
|
5205
|
-
} = Or(),
|
|
5206
|
-
|
|
5207
|
-
}, [
|
|
5203
|
+
setTextSelectionVersion: de,
|
|
5204
|
+
setExpandedPanelType: Me
|
|
5205
|
+
} = Or(), Ae = je.useCallback(() => {
|
|
5206
|
+
Me("crop");
|
|
5207
|
+
}, [Me]), Be = je.useRef(null), [$e, at] = je.useState(0), [pt, ct] = je.useState(0), [Pt, zt] = je.useState(!1), At = je.useRef(P), We = je.useRef(!1), [Ee, lt] = je.useState(!1), se = je.useRef(null);
|
|
5208
5208
|
Eo({ enabled: m });
|
|
5209
5209
|
const [h, G] = je.useState(null), re = je.useCallback(
|
|
5210
5210
|
(K) => {
|
|
@@ -5215,40 +5215,40 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5215
5215
|
});
|
|
5216
5216
|
},
|
|
5217
5217
|
[]
|
|
5218
|
-
), he = je.useCallback(() => G(null), []), _ = A.getActiveArtboard(),
|
|
5218
|
+
), he = je.useCallback(() => G(null), []), _ = A.getActiveArtboard(), we = je.useCallback(
|
|
5219
5219
|
(K) => {
|
|
5220
5220
|
if (!(a || K.ctrlKey || K.metaKey)) return;
|
|
5221
5221
|
K.preventDefault();
|
|
5222
|
-
const
|
|
5223
|
-
if (!
|
|
5224
|
-
const
|
|
5222
|
+
const ge = Be.current;
|
|
5223
|
+
if (!ge) return;
|
|
5224
|
+
const Oe = ge.getBoundingClientRect(), Je = K.clientX - Oe.left, Ge = K.clientY - Oe.top, Fe = -K.deltaY * Hi;
|
|
5225
5225
|
if (a) {
|
|
5226
|
-
const nt = $e, st = Math.min(Math.max(nt * (1 + Fe), Xi),
|
|
5226
|
+
const nt = $e, st = Math.min(Math.max(nt * (1 + Fe), Xi), Yi);
|
|
5227
5227
|
if (st === nt) return;
|
|
5228
|
-
const xt = st / nt, yt = Je - (Je - D.x) * xt,
|
|
5229
|
-
at(st), w({ x: yt, y:
|
|
5228
|
+
const xt = st / nt, yt = Je - (Je - D.x) * xt, Lt = Ge - (Ge - D.y) * xt;
|
|
5229
|
+
at(st), w({ x: yt, y: Lt });
|
|
5230
5230
|
} else {
|
|
5231
5231
|
const nt = O, st = Math.min(
|
|
5232
5232
|
Math.max(nt * (1 + Fe), Oi),
|
|
5233
5233
|
zi
|
|
5234
5234
|
);
|
|
5235
5235
|
if (st === nt) return;
|
|
5236
|
-
const xt = st / nt, yt = Je - (Je - D.x) * xt,
|
|
5237
|
-
u(st), w({ x: yt, y:
|
|
5236
|
+
const xt = st / nt, yt = Je - (Je - D.x) * xt, Lt = Ge - (Ge - D.y) * xt;
|
|
5237
|
+
u(st), w({ x: yt, y: Lt });
|
|
5238
5238
|
}
|
|
5239
5239
|
},
|
|
5240
5240
|
[a, $e, D, w, O, u]
|
|
5241
5241
|
);
|
|
5242
5242
|
je.useEffect(() => {
|
|
5243
|
-
const K =
|
|
5243
|
+
const K = Be.current;
|
|
5244
5244
|
if (K)
|
|
5245
|
-
return K.addEventListener("wheel",
|
|
5246
|
-
}, [
|
|
5245
|
+
return K.addEventListener("wheel", we, { passive: !1 }), () => K.removeEventListener("wheel", we);
|
|
5246
|
+
}, [we]), je.useEffect(() => {
|
|
5247
5247
|
if (!a) return;
|
|
5248
|
-
const K = (
|
|
5249
|
-
|
|
5250
|
-
}, ue = (
|
|
5251
|
-
|
|
5248
|
+
const K = (ge) => {
|
|
5249
|
+
ge.code === "Space" && !ge.repeat && lt(!0);
|
|
5250
|
+
}, ue = (ge) => {
|
|
5251
|
+
ge.code === "Space" && (lt(!1), se.current = null);
|
|
5252
5252
|
};
|
|
5253
5253
|
return window.addEventListener("keydown", K), window.addEventListener("keyup", ue), () => {
|
|
5254
5254
|
window.removeEventListener("keydown", K), window.removeEventListener("keyup", ue);
|
|
@@ -5257,8 +5257,8 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5257
5257
|
const Ie = je.useCallback(
|
|
5258
5258
|
(K) => {
|
|
5259
5259
|
if (!a) return;
|
|
5260
|
-
const ue = K.button === 1,
|
|
5261
|
-
(ue ||
|
|
5260
|
+
const ue = K.button === 1, ge = Ee && K.button === 0;
|
|
5261
|
+
(ue || ge) && (K.preventDefault(), K.target.setPointerCapture(K.pointerId), V(!0), se.current = {
|
|
5262
5262
|
x: K.clientX,
|
|
5263
5263
|
y: K.clientY,
|
|
5264
5264
|
panX: D.x,
|
|
@@ -5269,10 +5269,10 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5269
5269
|
), Ve = je.useCallback(
|
|
5270
5270
|
(K) => {
|
|
5271
5271
|
if (!ne || !se.current) return;
|
|
5272
|
-
const ue = K.clientX - se.current.x,
|
|
5272
|
+
const ue = K.clientX - se.current.x, ge = K.clientY - se.current.y;
|
|
5273
5273
|
w({
|
|
5274
5274
|
x: se.current.panX + ue,
|
|
5275
|
-
y: se.current.panY +
|
|
5275
|
+
y: se.current.panY + ge
|
|
5276
5276
|
});
|
|
5277
5277
|
},
|
|
5278
5278
|
[ne, w]
|
|
@@ -5286,7 +5286,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5286
5286
|
};
|
|
5287
5287
|
return window.addEventListener("pointerup", K), () => window.removeEventListener("pointerup", K);
|
|
5288
5288
|
}, [a, ne, V]);
|
|
5289
|
-
const
|
|
5289
|
+
const H = je.useMemo(() => {
|
|
5290
5290
|
if (!x || !b) return null;
|
|
5291
5291
|
const K = b.pieces ?? [];
|
|
5292
5292
|
if (K.length <= 1) return null;
|
|
@@ -5297,27 +5297,27 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5297
5297
|
width: _.width,
|
|
5298
5298
|
height: _.height
|
|
5299
5299
|
} : null;
|
|
5300
|
-
const ue = K.find((
|
|
5300
|
+
const ue = K.find((ge) => ge.id === x.pieceId);
|
|
5301
5301
|
return ue ? { x: ue.x, y: ue.y, width: ue.width, height: ue.height } : null;
|
|
5302
|
-
}, [x, b, _]), $ = Mo(
|
|
5302
|
+
}, [x, b, _]), $ = Mo(H);
|
|
5303
5303
|
je.useEffect(() => {
|
|
5304
5304
|
if (o !== void 0) {
|
|
5305
5305
|
at(o);
|
|
5306
5306
|
return;
|
|
5307
5307
|
}
|
|
5308
|
-
if (!
|
|
5308
|
+
if (!Be.current || !_)
|
|
5309
5309
|
return;
|
|
5310
5310
|
let K = 0;
|
|
5311
5311
|
const ue = () => {
|
|
5312
|
-
if (!
|
|
5313
|
-
const Je =
|
|
5312
|
+
if (!Be.current || !_) return;
|
|
5313
|
+
const Je = Be.current.clientWidth;
|
|
5314
5314
|
if (Je === 0)
|
|
5315
5315
|
return;
|
|
5316
5316
|
let Ge = _.width, Fe = _.height;
|
|
5317
5317
|
if (x && x !== "spread" && b) {
|
|
5318
5318
|
const xt = b.pieces ?? [];
|
|
5319
5319
|
if (xt.length > 1) {
|
|
5320
|
-
const yt = xt.find((
|
|
5320
|
+
const yt = xt.find((Lt) => Lt.id === x.pieceId);
|
|
5321
5321
|
yt && (Ge = yt.width, Fe = yt.height);
|
|
5322
5322
|
}
|
|
5323
5323
|
}
|
|
@@ -5325,8 +5325,8 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5325
5325
|
if (c !== void 0) {
|
|
5326
5326
|
const xt = Je - c * 2, yt = Math.min(xt / Ge, 1);
|
|
5327
5327
|
if ($ && f !== void 0) {
|
|
5328
|
-
const
|
|
5329
|
-
nt = Math.min(yt,
|
|
5328
|
+
const Lt = f - c * 2, Ce = Math.min(Lt / Fe, 1);
|
|
5329
|
+
nt = Math.min(yt, Ce), st = Ce <= yt;
|
|
5330
5330
|
} else if (nt = yt, f !== void 0 && Fe * nt + c * 2 > f) {
|
|
5331
5331
|
const An = (f - c * 2) / Fe;
|
|
5332
5332
|
nt = Math.min(nt, An, 1), st = !0;
|
|
@@ -5335,17 +5335,17 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5335
5335
|
nt = Math.min(Je * i / Ge, 1);
|
|
5336
5336
|
at(nt), ct(Je), zt(st);
|
|
5337
5337
|
};
|
|
5338
|
-
let
|
|
5338
|
+
let ge = !1;
|
|
5339
5339
|
We.current ? ue() : K = requestAnimationFrame(() => {
|
|
5340
5340
|
K = requestAnimationFrame(() => {
|
|
5341
|
-
|
|
5341
|
+
ge || (ue(), We.current = !0);
|
|
5342
5342
|
});
|
|
5343
5343
|
});
|
|
5344
|
-
const
|
|
5344
|
+
const Oe = new ResizeObserver(() => {
|
|
5345
5345
|
ue();
|
|
5346
5346
|
});
|
|
5347
|
-
return
|
|
5348
|
-
|
|
5347
|
+
return Oe.observe(Be.current), () => {
|
|
5348
|
+
ge = !0, cancelAnimationFrame(K), Oe.disconnect();
|
|
5349
5349
|
};
|
|
5350
5350
|
}, [o, _, i, c, f, x, b, $]);
|
|
5351
5351
|
const ot = $e > 0 && O > 0 ? $e * O : $e;
|
|
@@ -5368,24 +5368,24 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5368
5368
|
K !== rt.current && (rt.current !== null && q(), rt.current = K);
|
|
5369
5369
|
}, [$, q]);
|
|
5370
5370
|
const Ze = $ ? $.width : (_ == null ? void 0 : _.width) ?? 0, gt = $ ? $.height : (_ == null ? void 0 : _.height) ?? 0, Nt = Ze * ot, Dt = gt * ot, tn = Ze * $e;
|
|
5371
|
-
let
|
|
5372
|
-
f !== void 0 &&
|
|
5371
|
+
let Ht = _ ? c !== void 0 ? Dt + c * 2 : Dt / i : 0;
|
|
5372
|
+
f !== void 0 && Ht > f && (Ht = f);
|
|
5373
5373
|
let wt = c, Xt = c;
|
|
5374
|
-
const rn = ((
|
|
5374
|
+
const rn = ((Ne = Be.current) == null ? void 0 : Ne.clientWidth) || pt;
|
|
5375
5375
|
c !== void 0 && Pt && rn > 0 && tn > 0 && (wt = (rn - tn) / 2);
|
|
5376
|
-
const on =
|
|
5376
|
+
const on = Ht, Ut = je.useRef({ w: 0, h: 0 });
|
|
5377
5377
|
je.useEffect(() => {
|
|
5378
|
-
const K =
|
|
5378
|
+
const K = Be.current;
|
|
5379
5379
|
if (!K) return;
|
|
5380
5380
|
Ut.current = {
|
|
5381
5381
|
w: K.clientWidth,
|
|
5382
5382
|
h: K.clientHeight
|
|
5383
5383
|
};
|
|
5384
|
-
const ue = new ResizeObserver((
|
|
5385
|
-
const
|
|
5386
|
-
|
|
5387
|
-
w:
|
|
5388
|
-
h:
|
|
5384
|
+
const ue = new ResizeObserver((ge) => {
|
|
5385
|
+
const Oe = ge[0];
|
|
5386
|
+
Oe && (Ut.current = {
|
|
5387
|
+
w: Oe.contentRect.width,
|
|
5388
|
+
h: Oe.contentRect.height
|
|
5389
5389
|
});
|
|
5390
5390
|
});
|
|
5391
5391
|
return ue.observe(K), () => ue.disconnect();
|
|
@@ -5397,7 +5397,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5397
5397
|
}
|
|
5398
5398
|
const K = Ut.current.w, ue = Ut.current.h;
|
|
5399
5399
|
if (K === 0 || ue === 0 || Nt === 0 || Dt === 0) return;
|
|
5400
|
-
const
|
|
5400
|
+
const ge = 0.25 * Math.min(Nt, K), Oe = 0.25 * Math.min(Dt, ue), Je = ge - (wt ?? 0) - Nt, Ge = K - ge - (wt ?? 0), Fe = Oe - (Xt ?? 0) - Dt, nt = ue - Oe - (Xt ?? 0), st = Math.max(Je, Math.min(Ge, D.x)), xt = Math.max(Fe, Math.min(nt, D.y));
|
|
5401
5401
|
(st !== D.x || xt !== D.y) && w({ x: st, y: xt });
|
|
5402
5402
|
}, [
|
|
5403
5403
|
a,
|
|
@@ -5453,7 +5453,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5453
5453
|
return /* @__PURE__ */ y(
|
|
5454
5454
|
"div",
|
|
5455
5455
|
{
|
|
5456
|
-
ref:
|
|
5456
|
+
ref: Be,
|
|
5457
5457
|
className: e,
|
|
5458
5458
|
style: Ke,
|
|
5459
5459
|
onPointerDown: a ? Ie : void 0,
|
|
@@ -5474,14 +5474,14 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5474
5474
|
onElementUpdate: T,
|
|
5475
5475
|
setElements: I,
|
|
5476
5476
|
executeElementUpdate: g,
|
|
5477
|
-
onSelectionChange:
|
|
5478
|
-
onMultiSelectionChange:
|
|
5479
|
-
onActiveChildChange:
|
|
5480
|
-
onTextSelectionChange: () =>
|
|
5481
|
-
onHoverChange:
|
|
5482
|
-
onCropModeEnter:
|
|
5477
|
+
onSelectionChange: ce,
|
|
5478
|
+
onMultiSelectionChange: L,
|
|
5479
|
+
onActiveChildChange: me,
|
|
5480
|
+
onTextSelectionChange: () => de((K) => K + 1),
|
|
5481
|
+
onHoverChange: ye,
|
|
5482
|
+
onCropModeEnter: Ae,
|
|
5483
5483
|
onContextMenuRequest: re,
|
|
5484
|
-
hideHandles:
|
|
5484
|
+
hideHandles: ve,
|
|
5485
5485
|
canvasRef: C,
|
|
5486
5486
|
width: _ == null ? void 0 : _.width,
|
|
5487
5487
|
height: _ == null ? void 0 : _.height,
|
|
@@ -5508,14 +5508,14 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5508
5508
|
q();
|
|
5509
5509
|
return;
|
|
5510
5510
|
}
|
|
5511
|
-
const ue =
|
|
5511
|
+
const ue = Be.current;
|
|
5512
5512
|
if (!ue) {
|
|
5513
5513
|
u(K);
|
|
5514
5514
|
return;
|
|
5515
5515
|
}
|
|
5516
|
-
const
|
|
5516
|
+
const ge = ue.getBoundingClientRect(), Oe = ge.width / 2, Je = ge.height / 2, Ge = K / Math.max(O, 1e-4);
|
|
5517
5517
|
u(K), w({
|
|
5518
|
-
x:
|
|
5518
|
+
x: Oe - (Oe - D.x) * Ge,
|
|
5519
5519
|
y: Je - (Je - D.y) * Ge
|
|
5520
5520
|
});
|
|
5521
5521
|
}
|
|
@@ -5524,7 +5524,7 @@ const Di = typeof navigator < "u" && /Mac|iP(hone|ad|od)/.test(navigator.platfor
|
|
|
5524
5524
|
]
|
|
5525
5525
|
}
|
|
5526
5526
|
);
|
|
5527
|
-
},
|
|
5527
|
+
}, Li = [1, 2, 4, 8];
|
|
5528
5528
|
function _i({
|
|
5529
5529
|
userZoom: e,
|
|
5530
5530
|
onSetZoom: t
|
|
@@ -5567,7 +5567,7 @@ function _i({
|
|
|
5567
5567
|
backdropFilter: "blur(6px)"
|
|
5568
5568
|
},
|
|
5569
5569
|
className: "sc:flex sc:flex-col sc:rounded-2xl sc:border sc:border-border/40 sc:bg-popover/95 sc:p-1 sc:shadow-lg",
|
|
5570
|
-
children:
|
|
5570
|
+
children: Li.map((i) => {
|
|
5571
5571
|
const a = i * 100, l = Math.abs(e - i) < 0.05;
|
|
5572
5572
|
return /* @__PURE__ */ y(
|
|
5573
5573
|
"button",
|
|
@@ -5648,12 +5648,12 @@ async function qa() {
|
|
|
5648
5648
|
] = await Promise.all([
|
|
5649
5649
|
Promise.resolve().then(() => xa),
|
|
5650
5650
|
Promise.resolve().then(() => ba),
|
|
5651
|
-
import("./ImagePanel-
|
|
5651
|
+
import("./ImagePanel-BaX0UE-L.js"),
|
|
5652
5652
|
Promise.resolve().then(() => Sa),
|
|
5653
5653
|
Promise.resolve().then(() => ka),
|
|
5654
|
-
import("./ContextualToolbars-
|
|
5654
|
+
import("./ContextualToolbars-C62As-xY.js").then((c) => c.s),
|
|
5655
5655
|
Promise.resolve().then(() => Ra),
|
|
5656
|
-
import("./ContextualToolbars-
|
|
5656
|
+
import("./ContextualToolbars-C62As-xY.js").then((c) => c.r)
|
|
5657
5657
|
]);
|
|
5658
5658
|
It("effects-panel", {
|
|
5659
5659
|
component: e,
|
|
@@ -5703,17 +5703,17 @@ function br() {
|
|
|
5703
5703
|
icon: "gravity-ui:layers",
|
|
5704
5704
|
position: "left"
|
|
5705
5705
|
}), It("menu-button", {
|
|
5706
|
-
component:
|
|
5706
|
+
component: Yr,
|
|
5707
5707
|
label: "Menu",
|
|
5708
5708
|
icon: "gravity-ui:bars",
|
|
5709
5709
|
position: "topbar"
|
|
5710
5710
|
}), It("undo-redo-controls", {
|
|
5711
|
-
component:
|
|
5711
|
+
component: Hr,
|
|
5712
5712
|
label: "Undo / Redo",
|
|
5713
5713
|
icon: "lucide:undo-2",
|
|
5714
5714
|
position: "topbar"
|
|
5715
5715
|
}), It("add-element-menu", {
|
|
5716
|
-
component:
|
|
5716
|
+
component: Lr,
|
|
5717
5717
|
label: "Add Element",
|
|
5718
5718
|
icon: "gravity-ui:plus",
|
|
5719
5719
|
position: "topbar"
|
|
@@ -5762,7 +5762,7 @@ function ja(e) {
|
|
|
5762
5762
|
}));
|
|
5763
5763
|
}
|
|
5764
5764
|
const $i = ({ stroke: e, onChange: t }) => {
|
|
5765
|
-
const [n, s] =
|
|
5765
|
+
const [n, s] = ae((e == null ? void 0 : e.enabled) || !1), o = (e == null ? void 0 : e.enabled) || !1, i = (e == null ? void 0 : e.color) || "#000000", a = (e == null ? void 0 : e.width) || 5, l = (e == null ? void 0 : e.lineCap) || "butt", c = (e == null ? void 0 : e.lineJoin) || "miter", f = (e == null ? void 0 : e.opacity) !== void 0 ? e.opacity : 1, d = (C) => {
|
|
5766
5766
|
t(C ? {
|
|
5767
5767
|
enabled: !0,
|
|
5768
5768
|
color: i,
|
|
@@ -5881,7 +5881,7 @@ const $i = ({ stroke: e, onChange: t }) => {
|
|
|
5881
5881
|
] });
|
|
5882
5882
|
}, Fi = ({ mask: e, index: t, isFirst: n, isLast: s, onUpdate: o, onRemove: i, onReorder: a }) => {
|
|
5883
5883
|
var T;
|
|
5884
|
-
const [l, c] =
|
|
5884
|
+
const [l, c] = ae(!1), f = (I) => {
|
|
5885
5885
|
switch (I) {
|
|
5886
5886
|
case "clip":
|
|
5887
5887
|
return "🎭";
|
|
@@ -6266,7 +6266,7 @@ const $i = ({ stroke: e, onChange: t }) => {
|
|
|
6266
6266
|
] })
|
|
6267
6267
|
] });
|
|
6268
6268
|
}, Wi = ({ masks: e = [], onChange: t }) => {
|
|
6269
|
-
const [n, s] =
|
|
6269
|
+
const [n, s] = ae(e.length > 0), [o, i] = ae(!1), a = (d) => {
|
|
6270
6270
|
const m = {
|
|
6271
6271
|
id: `mask-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
|
|
6272
6272
|
type: d,
|
|
@@ -6565,7 +6565,7 @@ function oa(e, t) {
|
|
|
6565
6565
|
}
|
|
6566
6566
|
const ia = ({ distressEffect: e, onChange: t }) => {
|
|
6567
6567
|
go();
|
|
6568
|
-
const [n, s] =
|
|
6568
|
+
const [n, s] = ae(!1), o = (e == null ? void 0 : e.enabled) || !1, i = (e == null ? void 0 : e.style) || "worn", a = (e == null ? void 0 : e.intensity) || 50, l = (e == null ? void 0 : e.fadeAmount) || 30, c = (e == null ? void 0 : e.grainAmount) || 30, f = (e == null ? void 0 : e.scratchAmount) || 30, d = (e == null ? void 0 : e.edgeWear) || 40, m = (g) => {
|
|
6569
6569
|
t(g ? {
|
|
6570
6570
|
enabled: !0,
|
|
6571
6571
|
style: i,
|
|
@@ -6945,7 +6945,7 @@ function la(e) {
|
|
|
6945
6945
|
return !e || !vr(e) ? "No knockout" : ca(e, "knockout");
|
|
6946
6946
|
}
|
|
6947
6947
|
const da = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
|
|
6948
|
-
const s = e === "knockout" || e === "clip", [o, i] =
|
|
6948
|
+
const s = e === "knockout" || e === "clip", [o, i] = ae(s), a = s, l = (t == null ? void 0 : t.fill) || !1, c = (t == null ? void 0 : t.stroke) || !1, f = (t == null ? void 0 : t.scope) || "group", d = (x) => {
|
|
6949
6949
|
x === "knockout" || x === "clip" ? (n(x, {
|
|
6950
6950
|
fill: !1,
|
|
6951
6951
|
stroke: !0,
|
|
@@ -7077,7 +7077,7 @@ const da = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
|
|
|
7077
7077
|
onSelectGlyph: l,
|
|
7078
7078
|
browseAll: c = !1
|
|
7079
7079
|
}) => {
|
|
7080
|
-
const [f, d] =
|
|
7080
|
+
const [f, d] = ae([]), [m, p] = ae(!1), [b, x] = ae(null);
|
|
7081
7081
|
Pe(() => {
|
|
7082
7082
|
if (!e) return;
|
|
7083
7083
|
p(!0), x(null), (c ? Bn.getAllGlyphs(o, i) : Bn.getGlyphAlternates(o, n, i)).then((E) => {
|
|
@@ -7223,7 +7223,7 @@ const da = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
|
|
|
7223
7223
|
onChange: i,
|
|
7224
7224
|
onGlyphOverridesChange: a
|
|
7225
7225
|
}) => {
|
|
7226
|
-
const [l, c] =
|
|
7226
|
+
const [l, c] = ae(!1), [f, d] = ae([]), [m, p] = ae(!1), [b, x] = ae(!1), [v, C] = ae(0), [R, E] = ae(""), [A, T] = ae(!1), [I, g] = ae(/* @__PURE__ */ new Map()), [P, N] = ae(!1);
|
|
7227
7227
|
Pe(() => {
|
|
7228
7228
|
if (!e) {
|
|
7229
7229
|
d([]);
|
|
@@ -7239,33 +7239,33 @@ const da = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
|
|
|
7239
7239
|
g(/* @__PURE__ */ new Map());
|
|
7240
7240
|
return;
|
|
7241
7241
|
}
|
|
7242
|
-
const U = Array.from(new Set(Array.from(n).filter((
|
|
7242
|
+
const U = Array.from(new Set(Array.from(n).filter((ce) => ce !== " ")));
|
|
7243
7243
|
if (U.length === 0) {
|
|
7244
7244
|
g(/* @__PURE__ */ new Map());
|
|
7245
7245
|
return;
|
|
7246
7246
|
}
|
|
7247
7247
|
N(!0), (async () => {
|
|
7248
|
-
const
|
|
7249
|
-
for (const
|
|
7248
|
+
const ce = /* @__PURE__ */ new Map();
|
|
7249
|
+
for (const L of U)
|
|
7250
7250
|
try {
|
|
7251
|
-
const
|
|
7252
|
-
|
|
7253
|
-
} catch (
|
|
7254
|
-
Rs.error(`Error loading alternates for '${
|
|
7251
|
+
const me = await Bn.getGlyphAlternates(e, L, t), ye = me.length > 0 ? me.length - 1 : 0;
|
|
7252
|
+
ce.set(L, ye);
|
|
7253
|
+
} catch (me) {
|
|
7254
|
+
Rs.error(`Error loading alternates for '${L}':`, me), ce.set(L, 0);
|
|
7255
7255
|
}
|
|
7256
|
-
g(
|
|
7256
|
+
g(ce), N(!1);
|
|
7257
7257
|
})();
|
|
7258
7258
|
}, [n, e, t]);
|
|
7259
7259
|
const D = (U) => {
|
|
7260
|
-
const te = s == null ? void 0 : s[U],
|
|
7260
|
+
const te = s == null ? void 0 : s[U], ce = {
|
|
7261
7261
|
...s,
|
|
7262
7262
|
[U]: !te
|
|
7263
7263
|
};
|
|
7264
|
-
Object.keys(
|
|
7265
|
-
|
|
7266
|
-
}), e && Object.keys(
|
|
7267
|
-
Rs.error("Error pre-loading font for OpenType features:",
|
|
7268
|
-
}), i(Object.keys(
|
|
7264
|
+
Object.keys(ce).forEach((L) => {
|
|
7265
|
+
ce[L] || delete ce[L];
|
|
7266
|
+
}), e && Object.keys(ce).length > 0 && Bn.loadFont(e, t).catch((L) => {
|
|
7267
|
+
Rs.error("Error pre-loading font for OpenType features:", L);
|
|
7268
|
+
}), i(Object.keys(ce).length > 0 ? ce : void 0);
|
|
7269
7269
|
}, w = (U, te) => {
|
|
7270
7270
|
C(U), E(te), T(!1), x(!0);
|
|
7271
7271
|
}, ne = () => {
|
|
@@ -7274,10 +7274,10 @@ const da = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
|
|
|
7274
7274
|
if (!a) return;
|
|
7275
7275
|
let te = [...o];
|
|
7276
7276
|
if (U) {
|
|
7277
|
-
const
|
|
7278
|
-
|
|
7277
|
+
const ce = te.findIndex((L) => L.charIndex === U.charIndex);
|
|
7278
|
+
ce >= 0 ? te[ce] = U : te.push(U);
|
|
7279
7279
|
} else
|
|
7280
|
-
te = te.filter((
|
|
7280
|
+
te = te.filter((ce) => ce.charIndex !== v);
|
|
7281
7281
|
a(te.length > 0 ? te : void 0);
|
|
7282
7282
|
}, O = s ? Object.values(s).filter(Boolean).length : 0, u = o.length, q = fa.reduce(
|
|
7283
7283
|
(U, te) => (U[te.category] || (U[te.category] = []), U[te.category].push(te), U),
|
|
@@ -7322,26 +7322,26 @@ const da = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
|
|
|
7322
7322
|
)
|
|
7323
7323
|
] }),
|
|
7324
7324
|
/* @__PURE__ */ r("div", { className: "sc:flex sc:flex-wrap sc:gap-xs sc:rounded-md sc:border sc:border-border-medium sc:bg-surface sc:p-md", children: Array.from(n).map((U, te) => {
|
|
7325
|
-
const
|
|
7325
|
+
const ce = o.some((ye) => ye.charIndex === te);
|
|
7326
7326
|
if (U === " ")
|
|
7327
7327
|
return /* @__PURE__ */ r("div", { className: "sc:h-4xl sc:w-sm" }, te);
|
|
7328
|
-
const
|
|
7328
|
+
const me = I.get(U) || 0;
|
|
7329
7329
|
return /* @__PURE__ */ y(
|
|
7330
7330
|
"button",
|
|
7331
7331
|
{
|
|
7332
7332
|
onClick: () => w(te, U),
|
|
7333
7333
|
className: `
|
|
7334
7334
|
sc:relative sc:min-w-4xl sc:cursor-pointer sc:rounded sc:border-2 sc:p-xs sc:text-center sc:text-3xl sc:transition-all sc:duration-fast
|
|
7335
|
-
${
|
|
7335
|
+
${ce ? "sc:border-success sc:bg-success sc:text-success-foreground" : "sc:border-border-medium sc:bg-surface sc:text-text-primary sc:hover:border-info sc:hover:bg-info/10"}
|
|
7336
7336
|
`,
|
|
7337
7337
|
style: { fontFamily: e },
|
|
7338
7338
|
children: [
|
|
7339
7339
|
U,
|
|
7340
|
-
|
|
7340
|
+
me > 0 && /* @__PURE__ */ r(
|
|
7341
7341
|
"span",
|
|
7342
7342
|
{
|
|
7343
|
-
className: `sc:absolute sc:-right-[4px] sc:-top-[4px] sc:min-w-lg sc:rounded-full sc:border-2 sc:border-surface sc:px-xs sc:py-[2px] sc:text-center sc:text-3xs sc:font-semibold sc:leading-none sc:shadow-md ${
|
|
7344
|
-
children:
|
|
7343
|
+
className: `sc:absolute sc:-right-[4px] sc:-top-[4px] sc:min-w-lg sc:rounded-full sc:border-2 sc:border-surface sc:px-xs sc:py-[2px] sc:text-center sc:text-3xs sc:font-semibold sc:leading-none sc:shadow-md ${ce ? "sc:bg-success sc:text-success-foreground" : "sc:bg-info sc:text-info-foreground"}`,
|
|
7344
|
+
children: me
|
|
7345
7345
|
}
|
|
7346
7346
|
)
|
|
7347
7347
|
]
|
|
@@ -7351,10 +7351,10 @@ const da = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
|
|
|
7351
7351
|
}) })
|
|
7352
7352
|
] }),
|
|
7353
7353
|
!m && e && f.length > 0 && /* @__PURE__ */ r(Pn, { children: Object.entries(q).map(([U, te]) => {
|
|
7354
|
-
const
|
|
7355
|
-
return
|
|
7354
|
+
const ce = te.filter((L) => f.includes(L.tag));
|
|
7355
|
+
return ce.length === 0 ? null : /* @__PURE__ */ y("div", { className: "sc:mb-lg", children: [
|
|
7356
7356
|
/* @__PURE__ */ r("div", { className: "sc:mb-sm sc:text-2xs sc:font-semibold sc:uppercase sc:tracking-wide sc:text-text-secondary", children: U }),
|
|
7357
|
-
/* @__PURE__ */ r("div", { className: "sc:flex sc:flex-col sc:gap-sm", children:
|
|
7357
|
+
/* @__PURE__ */ r("div", { className: "sc:flex sc:flex-col sc:gap-sm", children: ce.map((L) => /* @__PURE__ */ y(
|
|
7358
7358
|
"label",
|
|
7359
7359
|
{
|
|
7360
7360
|
className: "sc:flex sc:cursor-pointer sc:items-start sc:gap-sm sc:rounded sc:p-xs sc:transition-colors sc:duration-fast sc:hover:bg-surface",
|
|
@@ -7363,18 +7363,18 @@ const da = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
|
|
|
7363
7363
|
"input",
|
|
7364
7364
|
{
|
|
7365
7365
|
type: "checkbox",
|
|
7366
|
-
checked: (s == null ? void 0 : s[
|
|
7367
|
-
onChange: () => D(
|
|
7366
|
+
checked: (s == null ? void 0 : s[L.tag]) || !1,
|
|
7367
|
+
onChange: () => D(L.tag),
|
|
7368
7368
|
className: "sc:mt-[2px] sc:h-4 sc:w-4 sc:cursor-pointer sc:rounded sc:border-border-primary sc:bg-bg-input sc:accent-accent-primary"
|
|
7369
7369
|
}
|
|
7370
7370
|
),
|
|
7371
7371
|
/* @__PURE__ */ y("div", { className: "sc:flex-1", children: [
|
|
7372
|
-
/* @__PURE__ */ r("div", { className: "sc:text-sm sc:font-medium", children:
|
|
7373
|
-
/* @__PURE__ */ r("div", { className: "sc:mt-[2px] sc:text-2xs sc:text-text-secondary", children:
|
|
7372
|
+
/* @__PURE__ */ r("div", { className: "sc:text-sm sc:font-medium", children: L.label }),
|
|
7373
|
+
/* @__PURE__ */ r("div", { className: "sc:mt-[2px] sc:text-2xs sc:text-text-secondary", children: L.description })
|
|
7374
7374
|
] })
|
|
7375
7375
|
]
|
|
7376
7376
|
},
|
|
7377
|
-
|
|
7377
|
+
L.tag
|
|
7378
7378
|
)) })
|
|
7379
7379
|
] }, U);
|
|
7380
7380
|
}) })
|
|
@@ -7396,7 +7396,7 @@ const da = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
|
|
|
7396
7396
|
] });
|
|
7397
7397
|
}, ma = ({ element: e, onElementUpdate: t, isOpen: n, onClose: s }) => {
|
|
7398
7398
|
var p, b;
|
|
7399
|
-
const [o, i] =
|
|
7399
|
+
const [o, i] = ae("stroke");
|
|
7400
7400
|
if (!e) return null;
|
|
7401
7401
|
const a = (p = e.stroke) == null ? void 0 : p.enabled, l = e.masks && e.masks.length > 0, c = (b = e.distressEffect) == null ? void 0 : b.enabled, f = e.blendMode === "knockout" || e.blendMode === "clip", d = e instanceof Qe, m = d && (e.glyphOverrides && e.glyphOverrides.length > 0 || e.openTypeFeatures && Object.keys(e.openTypeFeatures).length > 0);
|
|
7402
7402
|
return /* @__PURE__ */ r(
|
|
@@ -7420,31 +7420,31 @@ const da = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
|
|
|
7420
7420
|
/* @__PURE__ */ y(Ot.Tab, { id: "stroke", children: [
|
|
7421
7421
|
/* @__PURE__ */ r(ze, { icon: _e.minus, className: "sc:size-4" }),
|
|
7422
7422
|
"Stroke",
|
|
7423
|
-
a && /* @__PURE__ */ r(
|
|
7423
|
+
a && /* @__PURE__ */ r(Hn, { variant: "default", className: "sc:ml-2 sc:size-2 sc:rounded-full sc:p-0" }),
|
|
7424
7424
|
/* @__PURE__ */ r(Ot.Indicator, {})
|
|
7425
7425
|
] }),
|
|
7426
7426
|
/* @__PURE__ */ y(Ot.Tab, { id: "masks", children: [
|
|
7427
7427
|
/* @__PURE__ */ r(ze, { icon: _e.group, className: "sc:size-4" }),
|
|
7428
7428
|
"Masks",
|
|
7429
|
-
l && /* @__PURE__ */ r(
|
|
7429
|
+
l && /* @__PURE__ */ r(Hn, { variant: "default", className: "sc:ml-2 sc:size-2 sc:rounded-full sc:p-0" }),
|
|
7430
7430
|
/* @__PURE__ */ r(Ot.Indicator, {})
|
|
7431
7431
|
] }),
|
|
7432
7432
|
/* @__PURE__ */ y(Ot.Tab, { id: "distress", children: [
|
|
7433
7433
|
/* @__PURE__ */ r(ze, { icon: "lucide:cloud", className: "sc:size-4" }),
|
|
7434
7434
|
"Distress",
|
|
7435
|
-
c && /* @__PURE__ */ r(
|
|
7435
|
+
c && /* @__PURE__ */ r(Hn, { variant: "default", className: "sc:ml-2 sc:size-2 sc:rounded-full sc:p-0" }),
|
|
7436
7436
|
/* @__PURE__ */ r(Ot.Indicator, {})
|
|
7437
7437
|
] }),
|
|
7438
7438
|
/* @__PURE__ */ y(Ot.Tab, { id: "compositing", children: [
|
|
7439
7439
|
/* @__PURE__ */ r(ze, { icon: _e.scissors, className: "sc:size-4" }),
|
|
7440
7440
|
"Knockout",
|
|
7441
|
-
f && /* @__PURE__ */ r(
|
|
7441
|
+
f && /* @__PURE__ */ r(Hn, { variant: "default", className: "sc:ml-2 sc:size-2 sc:rounded-full sc:p-0" }),
|
|
7442
7442
|
/* @__PURE__ */ r(Ot.Indicator, {})
|
|
7443
7443
|
] }),
|
|
7444
7444
|
d && /* @__PURE__ */ y(Ot.Tab, { id: "typography", children: [
|
|
7445
7445
|
/* @__PURE__ */ r(ze, { icon: _e.text, className: "sc:size-4" }),
|
|
7446
7446
|
"Typography",
|
|
7447
|
-
m && /* @__PURE__ */ r(
|
|
7447
|
+
m && /* @__PURE__ */ r(Hn, { variant: "default", className: "sc:ml-2 sc:size-2 sc:rounded-full sc:p-0" }),
|
|
7448
7448
|
/* @__PURE__ */ r(Ot.Indicator, {})
|
|
7449
7449
|
] })
|
|
7450
7450
|
] }) }),
|
|
@@ -7586,7 +7586,7 @@ const da = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
|
|
|
7586
7586
|
progress: p,
|
|
7587
7587
|
supportsWorkerExport: b,
|
|
7588
7588
|
workerStats: x
|
|
7589
|
-
} = Vr(), { artboardsInfo: v, activeArtboardId: C } = ar(), [R, E] =
|
|
7589
|
+
} = Vr(), { artboardsInfo: v, activeArtboardId: C } = ar(), [R, E] = ae(t), [A, T] = ae(n), [I, g] = ae(500), P = async () => {
|
|
7590
7590
|
if (C)
|
|
7591
7591
|
try {
|
|
7592
7592
|
const w = await a(C, { scale: R, format: A }), ne = document.createElement("a"), V = v.find((q) => q.id === C), O = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19), u = (V == null ? void 0 : V.name) || "artboard";
|
|
@@ -7888,7 +7888,7 @@ const da = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
|
|
|
7888
7888
|
fontWeight: s = 400,
|
|
7889
7889
|
onInsertGlyph: o
|
|
7890
7890
|
}) => {
|
|
7891
|
-
const [i, a] =
|
|
7891
|
+
const [i, a] = ae([]), [l, c] = ae(!1), [f, d] = ae(null), [m, p] = ae("");
|
|
7892
7892
|
Pe(() => {
|
|
7893
7893
|
e && (c(!0), d(null), p(""), Bn.getAllGlyphs(n, s).then((v) => {
|
|
7894
7894
|
v.length === 0 && d(`No alternate glyphs found in ${n}`), a(v), c(!1);
|
|
@@ -7964,7 +7964,7 @@ const da = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
|
|
|
7964
7964
|
v.previewDataUrl ? /* @__PURE__ */ r("img", { src: v.previewDataUrl, alt: v.name, className: "sc:h-auto sc:w-full sc:object-contain" }) : /* @__PURE__ */ r("div", { className: "sc:text-5xl sc:leading-none", style: { fontFamily: n }, children: v.unicode }),
|
|
7965
7965
|
/* @__PURE__ */ r("div", { className: "sc:w-full sc:overflow-hidden sc:text-ellipsis sc:whitespace-nowrap sc:text-center sc:text-xs sc:text-muted", children: v.name }),
|
|
7966
7966
|
v.category !== "default" && /* @__PURE__ */ r(
|
|
7967
|
-
|
|
7967
|
+
Hn,
|
|
7968
7968
|
{
|
|
7969
7969
|
size: "sm",
|
|
7970
7970
|
color: v.category === "swash" ? "warning" : v.category === "stylistic" ? "primary" : "success",
|
|
@@ -8044,7 +8044,7 @@ const da = ({ blendMode: e = "normal", knockoutParts: t, onChange: n }) => {
|
|
|
8044
8044
|
createArtboard: d,
|
|
8045
8045
|
deleteArtboard: m,
|
|
8046
8046
|
renameArtboard: p
|
|
8047
|
-
} = ar(), [b, x] =
|
|
8047
|
+
} = ar(), [b, x] = ae(null), [v, C] = ae(""), R = (N, D) => {
|
|
8048
8048
|
x(N), C(D);
|
|
8049
8049
|
}, E = () => {
|
|
8050
8050
|
b && v.trim() && p(b, v.trim()), x(null), C("");
|
|
@@ -8656,25 +8656,25 @@ export {
|
|
|
8656
8656
|
Ma as D,
|
|
8657
8657
|
vo as E,
|
|
8658
8658
|
wa as G,
|
|
8659
|
-
|
|
8659
|
+
$a as K,
|
|
8660
8660
|
Qa as L,
|
|
8661
8661
|
pr as M,
|
|
8662
8662
|
bo as P,
|
|
8663
8663
|
tc as S,
|
|
8664
8664
|
ec as T,
|
|
8665
8665
|
er as Z,
|
|
8666
|
-
|
|
8667
|
-
|
|
8668
|
-
|
|
8669
|
-
|
|
8670
|
-
|
|
8671
|
-
|
|
8672
|
-
|
|
8673
|
-
|
|
8674
|
-
|
|
8675
|
-
|
|
8676
|
-
|
|
8677
|
-
|
|
8666
|
+
ja as a,
|
|
8667
|
+
ga as b,
|
|
8668
|
+
ya as c,
|
|
8669
|
+
Ea as d,
|
|
8670
|
+
Za as e,
|
|
8671
|
+
Wa as f,
|
|
8672
|
+
Va as g,
|
|
8673
|
+
Ja as h,
|
|
8674
|
+
qs as i,
|
|
8675
|
+
Ua as j,
|
|
8676
|
+
Ka as k,
|
|
8677
|
+
qa as l,
|
|
8678
8678
|
It as m,
|
|
8679
8679
|
Go as n,
|
|
8680
8680
|
Fa as o,
|
|
@@ -8683,4 +8683,4 @@ export {
|
|
|
8683
8683
|
Ga as u,
|
|
8684
8684
|
nc as v
|
|
8685
8685
|
};
|
|
8686
|
-
//# sourceMappingURL=validation-
|
|
8686
|
+
//# sourceMappingURL=validation-BG-V98h0.js.map
|