@sheetxl/react 0.8.0-beta.12 → 0.8.0-beta.14
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/browser/esm/{DGG1auUKsjFbAazu.mjs → 3bA4ZNVK9px28j8g.mjs} +3 -3
- package/browser/esm/{CUekkfE6uwwsdQpc.mjs → B1mBZyt2eP2CpVwp.mjs} +1 -1
- package/browser/esm/{ZoS0cpNEBcv6p-Z1.mjs → B9bUlu6d3vrRZxS-.mjs} +3 -3
- package/browser/esm/BAhJx_sa3wR4i_0q.mjs +145 -0
- package/browser/esm/{BDlpRkuBok0Uu4Hn.mjs → BCZ5elyhp4P5oEuf.mjs} +1 -1
- package/browser/esm/BLYs69szBviI7Jjh.mjs +303 -0
- package/browser/esm/{D_usN3pWuCJU2GN-.mjs → BNyPX5tVpHU3d3Vj.mjs} +2 -2
- package/browser/esm/{_6Sb6ElRcZftxMNh.mjs → BSqY5OuRUNgKmwp8.mjs} +1 -1
- package/browser/esm/{D22NJmTiky4NL8tM.mjs → Bk4hW9MxdjC3CGlC.mjs} +1 -1
- package/browser/esm/{D2GydDzPuvIjdpok.mjs → BoJ5N_Kc7V9zyftG.mjs} +1 -1
- package/browser/esm/{C_LUq-BnguetvGZz.mjs → C1yjI8GDwCp8bC1Z.mjs} +2 -2
- package/browser/esm/{LBQDhVhz7S7i6a8i.mjs → C6TgQuQt88nz0-jL.mjs} +1 -1
- package/browser/esm/{CSFORKZ8zrVL_Y0w.mjs → CAT9L5BY3HAluoJf.mjs} +1 -1
- package/browser/esm/{DxEczXCHTerDemDP.mjs → CDf6czK5WuKJhq0y.mjs} +4 -4
- package/browser/esm/CoRairrEG42TjiZk.mjs +19 -0
- package/browser/esm/CuPu7ToiaqUerd85.mjs +401 -0
- package/browser/esm/{BapujiblfiXDlu67.mjs → D0Sg0TONmNBjIlEg.mjs} +1 -1
- package/browser/esm/{Cslk_qRdBSuJIi1O.mjs → DxwO-Y_gJ9IaBQ4B.mjs} +6 -6
- package/browser/esm/{DN3lqq95KY0K6f1x.mjs → K9YyKehkJlT3axZh.mjs} +1 -1
- package/browser/esm/NG_Q0Dq4JXnEWACp.mjs +341 -0
- package/browser/esm/{B4mT3G7GHwgDYFGP.mjs → PL83wgS5ferhptps.mjs} +2 -2
- package/browser/esm/chart.mjs +3 -3
- package/browser/esm/control.mjs +74 -73
- package/browser/esm/group.mjs +3 -3
- package/browser/esm/index.mjs +3971 -3744
- package/browser/esm/{CtGhA0kS2MCfEsHN.mjs → nm3DZw1nJMIh89Dx.mjs} +3 -3
- package/browser/esm/note.mjs +5 -5
- package/browser/esm/picture.mjs +2 -81
- package/browser/esm/shape.mjs +2 -2
- package/browser/esm/slicer.mjs +112 -111
- package/browser/esm/{Ck1LbcsdSfKNi6xq.mjs → wQh060x4Bo_NqUYk.mjs} +1 -1
- package/node/esm/6VFNx4NTcuHaXbnF.mjs +146 -0
- package/node/esm/{CzN6c6KyxVmNvayz.mjs → BBm7LjTGVud73kml.mjs} +1 -1
- package/node/esm/{CH1DVfFhjdd_3pw1.mjs → BayAQ4VhPgK40T5V.mjs} +2 -2
- package/node/esm/{T5lfCrudsUnOTxEn.mjs → BgH9YejvQpQrZeHl.mjs} +1 -1
- package/node/esm/{iL9jKJcnED6oi0B4.mjs → ByTkh2-kGcBTZn9j.mjs} +1 -1
- package/node/esm/{DayGI0Bt57FDNbVF.mjs → C0HgFe1pYpEl1EgM.mjs} +1 -1
- package/node/esm/{MWges5ywL3aEdChp.mjs → CEyXz1TulkCpAv0t.mjs} +1 -1
- package/node/esm/{C0KLMCRb3sbd5Q20.mjs → CMSfxUMv1tFyNlRJ.mjs} +5 -5
- package/node/esm/{DWkPWuf5ZrLRMixG.mjs → CZfiN5xD1_Zws8z-.mjs} +15 -15
- package/node/esm/{DXiNwr6ZnXBe7TlG.mjs → D-lQa7ydREp9WwxP.mjs} +1 -1
- package/node/esm/{Bi2Jwc0zpweaNzKc.mjs → D2dDGnBtilmmDxBJ.mjs} +2 -2
- package/node/esm/{CNOLkUDURBElaaIf.mjs → DA6UdPMREzxobL8H.mjs} +3 -3
- package/node/esm/{YB_qExw23Ci4nMYy.mjs → Duu2zmr8YkGTo-iP.mjs} +2 -2
- package/node/esm/{Apcuz4_QtBHt7G47.mjs → Dztz6JUUcE4NG6sn.mjs} +1 -1
- package/node/esm/ShpbUw8_QnOxZu2h.mjs +19 -0
- package/node/esm/{DyetXBW7vFLJWB22.mjs → _OzLYz_iliC3tcW2.mjs} +1 -1
- package/node/esm/chart.mjs +2 -2
- package/node/esm/control.mjs +79 -78
- package/node/esm/eG-mlQfoOvRwAwU1.mjs +406 -0
- package/node/esm/{DKqdv5JubgVaq-g9.mjs → fhOm7EkeM-0FAdDI.mjs} +1 -1
- package/node/esm/group.mjs +3 -3
- package/node/esm/index.mjs +6469 -6242
- package/node/esm/note.mjs +18 -18
- package/node/esm/picture.mjs +269 -50
- package/node/esm/{CalVk3o4-kX79s3v.mjs → r0Bg1Uwd5WHBFQyj.mjs} +1 -1
- package/node/esm/shape.mjs +186 -580
- package/node/esm/slicer.mjs +51 -50
- package/node/esm/{bRD1KCpSpAYTEs50.mjs → wtQ7d7f37N1tuJZB.mjs} +1 -1
- package/package.json +7 -7
- package/resources/locales/de/picture.cmd.json +157 -0
- package/resources/locales/de/sheet.cmd.json +24 -2
- package/resources/locales/de/ui.msg.json +3 -0
- package/resources/locales/en/picture.cmd.json +157 -0
- package/resources/locales/en/sheet.cmd.json +24 -2
- package/resources/locales/en/ui.msg.json +3 -0
- package/types/src/chart/ChartCommands.d.ts +1 -1
- package/types/src/chart/paint/_graphics.d.ts +0 -8
- package/types/src/chart/paint/echarts.d.ts +1 -1
- package/types/src/chart/paint/index.d.ts +1 -1
- package/types/src/chart/paint/kinds/ChartPaintKind.d.ts +1 -1
- package/types/src/chart/paint/kinds/_builtIns.d.ts +0 -9
- package/types/src/chart/paint/toEChartsOption.d.ts +1 -1
- package/types/src/layer/CircularIndicatorLayer.d.ts +1 -1
- package/types/src/layer/HyperlinkLayer.d.ts +13 -9
- package/types/src/layer/_visibleCellFeatures.d.ts +11 -0
- package/types/src/layer/useValidationPicker.d.ts +1 -1
- package/types/src/movable/useFramePreview.d.ts +17 -0
- package/types/src/picture/PictureCommands.d.ts +8 -0
- package/types/src/picture/_pictureHyperlink.d.ts +13 -0
- package/types/src/picture/pictureCrop.d.ts +32 -0
- package/types/src/sheet/_hyperlinkEdit.d.ts +7 -0
- package/types/src/sheet/circularReferences.d.ts +1 -1
- package/types/src/theme/buildDocThemeCSS.d.ts +4 -1
- package/browser/esm/BR-AiOwuQlYh5-tr.mjs +0 -730
- package/browser/esm/DhYQRc8L2kALmFNz.mjs +0 -75
- package/node/esm/Cp1DuCae46eQKzWy.mjs +0 -76
package/node/esm/shape.mjs
CHANGED
|
@@ -1,409 +1,52 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.8.0-beta.
|
|
2
|
+
* @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.8.0-beta.14
|
|
3
3
|
*
|
|
4
4
|
* (C) 2026-present SheetXL Inc. & Michael T. Ford
|
|
5
5
|
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
6
|
*/
|
|
7
|
-
import { t as e } from "./
|
|
8
|
-
import { n as t } from "./
|
|
9
|
-
import { t as n } from "./
|
|
10
|
-
import { t as
|
|
11
|
-
import {
|
|
12
|
-
import { forwardRef as
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if ("string" != typeof e || !e) return null;
|
|
20
|
-
try {
|
|
21
|
-
return (t ? t.parseColor(e) : new o(e))?.toCSS("adaptive") ?? null;
|
|
22
|
-
} catch {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
}, L = (e) => {
|
|
26
|
-
if (!e) return null;
|
|
27
|
-
switch (e.type) {
|
|
28
|
-
case s.Type.Solid: return e.color ?? null;
|
|
29
|
-
case s.Type.Gradient: {
|
|
30
|
-
const t = e.stops?.[0];
|
|
31
|
-
return ("string" == typeof t ? t : t?.color) ?? null;
|
|
32
|
-
}
|
|
33
|
-
case s.Type.Pattern: return e.foreground ?? e.background ?? null;
|
|
34
|
-
case s.Type.Image:
|
|
35
|
-
default: return null;
|
|
36
|
-
}
|
|
37
|
-
}, N = (e) => Math.max(0, Math.min(1, e ?? 0)), E = (e) => {
|
|
38
|
-
const t = e.stops ?? [];
|
|
39
|
-
if (t.length < 2) return null;
|
|
40
|
-
const n = t.length - 1, r = [];
|
|
41
|
-
for (let e = 0; e < t.length; e++) {
|
|
42
|
-
const o = t[e], s = "string" == typeof o ? o : o?.color;
|
|
43
|
-
if (!s) return null;
|
|
44
|
-
const i = "object" == typeof o && "number" == typeof o.offset ? o.offset : e / n;
|
|
45
|
-
r.push({
|
|
46
|
-
offset: N(i),
|
|
47
|
-
color: s
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
if (r.sort((e, t) => e.offset - t.offset), (e.gradientType ?? s.GradientType.Linear) === s.GradientType.Linear) return {
|
|
51
|
-
kind: "linear",
|
|
52
|
-
angle: (((e.angle ?? 0) - 90) % 360 + 360) % 360,
|
|
53
|
-
scaled: e.scaled ?? !0,
|
|
54
|
-
stops: r
|
|
55
|
-
};
|
|
56
|
-
const o = e.focus, i = N(o?.left), l = N(o?.top), a = N(o?.right), c = N(o?.bottom);
|
|
57
|
-
if (i > a || l > c) return null;
|
|
58
|
-
const h = (i + a) / 2, u = (l + c) / 2, p = Math.max(h, 1 - h), d = Math.max(u, 1 - u);
|
|
59
|
-
return {
|
|
60
|
-
kind: "radial",
|
|
61
|
-
cx: h,
|
|
62
|
-
cy: u,
|
|
63
|
-
r: Math.hypot(p, d),
|
|
64
|
-
stops: r
|
|
65
|
-
};
|
|
66
|
-
}, z = c.inheritedGroupFill, A = /[MLQCAZ]|[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/g, I = {
|
|
67
|
-
M: 1,
|
|
68
|
-
L: 1,
|
|
69
|
-
Q: 2,
|
|
70
|
-
C: 3,
|
|
71
|
-
A: 1,
|
|
72
|
-
Z: 0
|
|
73
|
-
}, F = (e) => String(Math.round(1e5 * e) / 1e5), G = (e) => {
|
|
74
|
-
const t = e.match(A) ?? [], n = [], r = [], o = [];
|
|
75
|
-
let s = {
|
|
76
|
-
x: 0,
|
|
77
|
-
y: 0
|
|
78
|
-
}, i = null, l = 0, a = null;
|
|
79
|
-
for (; l < t.length;) {
|
|
80
|
-
const e = t[l];
|
|
81
|
-
if (void 0 !== I[e]) a = e, l++;
|
|
82
|
-
else if ("M" === a) a = "L";
|
|
83
|
-
else if (null === a || "Z" === a) break;
|
|
84
|
-
if ("Z" === a) {
|
|
85
|
-
i && (r.push({
|
|
86
|
-
from: s,
|
|
87
|
-
to: i
|
|
88
|
-
}), o.push(s), n.push({
|
|
89
|
-
c: a,
|
|
90
|
-
pts: []
|
|
91
|
-
}), s = i, i = null);
|
|
92
|
-
continue;
|
|
93
|
-
}
|
|
94
|
-
const c = "A" === a ? t.slice(l, l + 5) : void 0;
|
|
95
|
-
c && (l += 5);
|
|
96
|
-
const h = [];
|
|
97
|
-
for (let e = 0; e < I[a]; e++) h.push({
|
|
98
|
-
x: Number(t[l++]),
|
|
99
|
-
y: Number(t[l++])
|
|
100
|
-
});
|
|
101
|
-
const u = h[h.length - 1];
|
|
102
|
-
if (!u || Number.isNaN(u.x) || Number.isNaN(u.y)) break;
|
|
103
|
-
"M" === a ? (i && o.push(s), i = u, o.push(u)) : ("L" === a && r.push({
|
|
104
|
-
from: s,
|
|
105
|
-
to: u
|
|
106
|
-
}), i || (i = s, o.push(s))), n.push({
|
|
107
|
-
c: a,
|
|
108
|
-
pts: h,
|
|
109
|
-
arc: c
|
|
110
|
-
}), s = u;
|
|
111
|
-
}
|
|
112
|
-
return i && o.push(s), {
|
|
113
|
-
cmds: n,
|
|
114
|
-
straight: r,
|
|
115
|
-
ends: o
|
|
116
|
-
};
|
|
117
|
-
}, D = (e) => {
|
|
118
|
-
const t = [];
|
|
119
|
-
for (const n of e) {
|
|
120
|
-
const e = n.pts.map((e) => `${F(e.x)} ${F(e.y)}`).join(" ");
|
|
121
|
-
t.push("Z" === n.c ? "Z" : `${n.c}${n.arc ? `${n.arc.join(" ")} ` : ""}${e}`);
|
|
122
|
-
}
|
|
123
|
-
return t.join(" ");
|
|
124
|
-
}, R = 1e-6, H = (e, t, n, r, o) => {
|
|
125
|
-
const s = r ? (o - e) * t.zoom : e * t.zoom, i = C.snapLineCenter(s, n, t.dpr);
|
|
126
|
-
return r ? o - i / t.zoom : i / t.zoom;
|
|
127
|
-
}, W = (e, t, n) => {
|
|
128
|
-
const r = G(e), o = r.ends.map((e) => ({
|
|
129
|
-
x: e.x,
|
|
130
|
-
y: e.y
|
|
131
|
-
})), s = n * t.zoom, i = [];
|
|
132
|
-
for (const e of r.straight) {
|
|
133
|
-
const t = Math.abs(e.to.y - e.from.y) < R;
|
|
134
|
-
t !== Math.abs(e.to.x - e.from.x) < R && i.push({
|
|
135
|
-
seg: e,
|
|
136
|
-
level: t,
|
|
137
|
-
at: t ? e.from.y : e.from.x
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
for (const { seg: e, level: n, at: r } of i) n ? e.from.y = e.to.y = H(r, t, s, t.flipV, t.height) : e.from.x = e.to.x = H(r, t, s, t.flipH, t.width);
|
|
141
|
-
const l = [];
|
|
142
|
-
return r.ends.forEach((e, t) => {
|
|
143
|
-
const n = {
|
|
144
|
-
x: e.x - o[t].x,
|
|
145
|
-
y: e.y - o[t].y
|
|
146
|
-
};
|
|
147
|
-
0 === n.x && 0 === n.y || l.push({
|
|
148
|
-
at: o[t],
|
|
149
|
-
by: n
|
|
150
|
-
});
|
|
151
|
-
}), {
|
|
152
|
-
d: D(r.cmds),
|
|
153
|
-
ends: l
|
|
154
|
-
};
|
|
155
|
-
}, B = (e, t) => {
|
|
156
|
-
if (0 === t.length) return e;
|
|
157
|
-
const n = G(e);
|
|
158
|
-
let r = [], o = null;
|
|
159
|
-
const s = /* @__PURE__ */ new Set(), i = () => {
|
|
160
|
-
if (!o) return;
|
|
161
|
-
let e = null, n = 1 / 0;
|
|
162
|
-
for (const r of t) {
|
|
163
|
-
const t = Math.hypot(r.at.x - o.x, r.at.y - o.y);
|
|
164
|
-
t < n && (e = r, n = t);
|
|
165
|
-
}
|
|
166
|
-
for (const t of r) s.has(t) || (s.add(t), t.x += e.by.x, t.y += e.by.y);
|
|
167
|
-
r = [], o = null;
|
|
168
|
-
};
|
|
169
|
-
for (const e of n.cmds) {
|
|
170
|
-
"M" === e.c && (i(), o = e.pts[0]);
|
|
171
|
-
for (const t of e.pts) r.push(t);
|
|
172
|
-
}
|
|
173
|
-
return i(), D(n.cmds);
|
|
174
|
-
}, O = /* @__PURE__ */ new WeakMap(), U = { filter: "var(--sxl-image-filter)" }, Z = (e) => {
|
|
175
|
-
const [t, n] = x(null);
|
|
176
|
-
return d(() => {
|
|
177
|
-
if (!e) return;
|
|
178
|
-
let t = !0;
|
|
179
|
-
return ((e) => {
|
|
180
|
-
let t = O.get(e);
|
|
181
|
-
return t || (t = (async () => {
|
|
182
|
-
const t = await e.getExternalURI();
|
|
183
|
-
if (t) return t;
|
|
184
|
-
const [n, r] = await Promise.all([e.toBuffer(), e.getType()]);
|
|
185
|
-
return `data:${r?.mime ?? "image/png"};base64,${M.arrayBufferToBase64(n)}`;
|
|
186
|
-
})(), O.set(e, t)), t;
|
|
187
|
-
})(e).then((r) => {
|
|
188
|
-
t && n({
|
|
189
|
-
resource: e,
|
|
190
|
-
url: r
|
|
191
|
-
});
|
|
192
|
-
}, () => {}), () => {
|
|
193
|
-
t = !1;
|
|
194
|
-
};
|
|
195
|
-
}, [e]), e && t?.resource === e ? t.url : null;
|
|
196
|
-
}, J = (e, t, n, r) => {
|
|
197
|
-
const o = t.stops.map((e, t) => b("stop", {
|
|
198
|
-
offset: e.offset,
|
|
199
|
-
stopColor: e.color
|
|
200
|
-
}, t));
|
|
201
|
-
if ("linear" === t.kind) {
|
|
202
|
-
const s = t.angle * Math.PI / 180;
|
|
203
|
-
let i = Math.cos(s), l = Math.sin(s);
|
|
204
|
-
if (t.scaled) {
|
|
205
|
-
i *= n, l *= r;
|
|
206
|
-
const e = Math.hypot(i, l) || 1;
|
|
207
|
-
i /= e, l /= e;
|
|
208
|
-
}
|
|
209
|
-
const a = (Math.abs(n * i) + Math.abs(r * l)) / 2, c = n / 2, h = r / 2;
|
|
210
|
-
return b("linearGradient", {
|
|
211
|
-
id: e,
|
|
212
|
-
gradientUnits: "userSpaceOnUse",
|
|
213
|
-
x1: c - a * i,
|
|
214
|
-
y1: h - a * l,
|
|
215
|
-
x2: c + a * i,
|
|
216
|
-
y2: h + a * l,
|
|
217
|
-
children: o
|
|
218
|
-
}, e);
|
|
219
|
-
}
|
|
220
|
-
return b("radialGradient", {
|
|
221
|
-
id: e,
|
|
222
|
-
gradientUnits: "userSpaceOnUse",
|
|
223
|
-
cx: t.cx * n,
|
|
224
|
-
cy: t.cy * n,
|
|
225
|
-
r: t.r * n,
|
|
226
|
-
gradientTransform: `scale(1 ${r / n})`,
|
|
227
|
-
children: o
|
|
228
|
-
}, e);
|
|
229
|
-
}, Q = u(({ paths: e, style: t, width: n, height: r, zoom: o, grid: s, hit: l }) => {
|
|
230
|
-
const a = f().replace(/[^A-Za-z0-9_-]/g, ""), c = Z(t.image?.resource ?? null), h = ((e, t, n = 1) => {
|
|
231
|
-
const r = (t > 0 ? t : 1) * (n > 0 ? n : 1);
|
|
232
|
-
return Math.max(1, Math.round(Math.max(0, e || 0) * r)) / r;
|
|
233
|
-
})(t.strokeWidth, o, s?.dpr ?? C.getDevicePixelRatio()), u = n > 0 && r > 0, p = u ? t.gradient ?? null : null, d = u ? t.strokeGradient ?? null : null, g = t.image ? c ? `url(#${a}-image)` : null : p ? `url(#${a}-fill)` : t.fill, y = d ? `url(#${a}-stroke)` : t.stroke, x = null !== t.stroke && h > 0, M = x ? ((e, t, n) => {
|
|
234
|
-
if (!(e && t > 0)) return;
|
|
235
|
-
const r = "butt" !== n, o = e.map((e, n) => {
|
|
236
|
-
const o = e * t;
|
|
237
|
-
return r ? n % 2 == 0 ? Math.max(0, o - t) : o + t : o;
|
|
238
|
-
});
|
|
239
|
-
return o.length % 2 == 1 && o.push(r ? t : 0), o.map((e) => +e.toFixed(3)).join(" ");
|
|
240
|
-
})(t.dash, h, t.lineCap) : void 0, w = m(() => ((e, t, n) => {
|
|
241
|
-
const r = /* @__PURE__ */ new Map();
|
|
242
|
-
if (!t) return r;
|
|
243
|
-
const o = /* @__PURE__ */ new Map(), s = [];
|
|
244
|
-
for (const l of e) {
|
|
245
|
-
if (l.layer !== i.PathLayer.Stroke) continue;
|
|
246
|
-
let e = o.get(l.d);
|
|
247
|
-
if (void 0 === e) {
|
|
248
|
-
const r = W(l.d, t, n);
|
|
249
|
-
e = r.d, o.set(l.d, e), s.push(...r.ends);
|
|
250
|
-
}
|
|
251
|
-
r.set(l.index, e);
|
|
252
|
-
}
|
|
253
|
-
for (const t of e) if (t.layer === i.PathLayer.Fill) {
|
|
254
|
-
const e = o.get(t.d);
|
|
255
|
-
void 0 !== e && r.set(t.index, e);
|
|
256
|
-
} else t.layer === i.PathLayer.Marker && r.set(t.index, B(t.d, s));
|
|
257
|
-
return r;
|
|
258
|
-
})(e, x ? s : null, h), [
|
|
259
|
-
e,
|
|
260
|
-
x,
|
|
261
|
-
s,
|
|
262
|
-
h
|
|
263
|
-
]), T = /* @__PURE__ */ new Set(), $ = [];
|
|
264
|
-
for (const n of e) {
|
|
265
|
-
const e = `p${n.index}`, r = w.get(n.index) ?? n.d;
|
|
266
|
-
switch (n.layer) {
|
|
267
|
-
case i.PathLayer.Fill:
|
|
268
|
-
if (null === g) break;
|
|
269
|
-
"norm" !== n.fill && T.add(n.fill), $.push(b("path", {
|
|
270
|
-
d: r,
|
|
271
|
-
fill: g,
|
|
272
|
-
filter: "norm" !== n.fill ? `url(#${a}-${n.fill})` : void 0,
|
|
273
|
-
stroke: "none",
|
|
274
|
-
pointerEvents: l
|
|
275
|
-
}, e));
|
|
276
|
-
break;
|
|
277
|
-
case i.PathLayer.Stroke: {
|
|
278
|
-
if (!x) break;
|
|
279
|
-
const n = 8 / (o > 0 ? o : 1);
|
|
280
|
-
"none" !== l && n > h && $.push(b("path", {
|
|
281
|
-
className: "shape-hit",
|
|
282
|
-
d: r,
|
|
283
|
-
fill: "none",
|
|
284
|
-
stroke: "transparent",
|
|
285
|
-
strokeWidth: n,
|
|
286
|
-
strokeLinejoin: "round",
|
|
287
|
-
strokeLinecap: "round",
|
|
288
|
-
pointerEvents: "stroke"
|
|
289
|
-
}, `${e}-hit`)), $.push(b("path", {
|
|
290
|
-
d: r,
|
|
291
|
-
fill: "none",
|
|
292
|
-
stroke: y,
|
|
293
|
-
strokeWidth: h,
|
|
294
|
-
strokeLinejoin: t.lineJoin,
|
|
295
|
-
strokeLinecap: t.lineCap,
|
|
296
|
-
strokeMiterlimit: "miter" === t.lineJoin ? t.miterLimit : void 0,
|
|
297
|
-
strokeDasharray: M,
|
|
298
|
-
pointerEvents: "none" === l ? "none" : "visibleStroke"
|
|
299
|
-
}, e));
|
|
300
|
-
break;
|
|
301
|
-
}
|
|
302
|
-
case i.PathLayer.Marker: x && $.push(b("path", {
|
|
303
|
-
d: r,
|
|
304
|
-
fill: y,
|
|
305
|
-
stroke: "none",
|
|
306
|
-
pointerEvents: l
|
|
307
|
-
}, e));
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
const S = [];
|
|
311
|
-
for (const e of T) {
|
|
312
|
-
const [t, n] = i.FillTransfer[e];
|
|
313
|
-
S.push(b("filter", {
|
|
314
|
-
id: `${a}-${e}`,
|
|
315
|
-
colorInterpolationFilters: "sRGB",
|
|
316
|
-
children: k("feComponentTransfer", { children: [
|
|
317
|
-
b("feFuncR", {
|
|
318
|
-
type: "linear",
|
|
319
|
-
slope: t,
|
|
320
|
-
intercept: n
|
|
321
|
-
}),
|
|
322
|
-
b("feFuncG", {
|
|
323
|
-
type: "linear",
|
|
324
|
-
slope: t,
|
|
325
|
-
intercept: n
|
|
326
|
-
}),
|
|
327
|
-
b("feFuncB", {
|
|
328
|
-
type: "linear",
|
|
329
|
-
slope: t,
|
|
330
|
-
intercept: n
|
|
331
|
-
})
|
|
332
|
-
] })
|
|
333
|
-
}, e));
|
|
334
|
-
}
|
|
335
|
-
if (p && !t.image && S.push(J(`${a}-fill`, p, n, r)), d && x && S.push(J(`${a}-stroke`, d, n, r)), t.image && c) {
|
|
336
|
-
const e = t.image.fill.stretch ?? {}, o = n * (e.left ?? 0) / 100, s = r * (e.top ?? 0) / 100, i = Math.max(0, n - o - n * (e.right ?? 0) / 100), l = Math.max(0, r - s - r * (e.bottom ?? 0) / 100);
|
|
337
|
-
S.push(b("pattern", {
|
|
338
|
-
id: `${a}-image`,
|
|
339
|
-
patternUnits: "userSpaceOnUse",
|
|
340
|
-
x: 0,
|
|
341
|
-
y: 0,
|
|
342
|
-
width: Math.max(n, 1),
|
|
343
|
-
height: Math.max(r, 1),
|
|
344
|
-
children: b("image", {
|
|
345
|
-
href: c,
|
|
346
|
-
x: o,
|
|
347
|
-
y: s,
|
|
348
|
-
width: i,
|
|
349
|
-
height: l,
|
|
350
|
-
preserveAspectRatio: "none",
|
|
351
|
-
style: U
|
|
352
|
-
})
|
|
353
|
-
}, "image"));
|
|
354
|
-
}
|
|
355
|
-
return k(v, { children: [S.length > 0 ? b("defs", { children: S }) : null, $] });
|
|
356
|
-
});
|
|
357
|
-
Q.displayName = "PathRun";
|
|
358
|
-
var V = u(({ geometry: e, style: t, zoom: n, grid: r = null, hit: o }) => {
|
|
359
|
-
const s = m(() => {
|
|
360
|
-
const t = [];
|
|
361
|
-
return e.forEachPath((e) => t.push(e)), t;
|
|
362
|
-
}, [e]);
|
|
363
|
-
return b(Q, {
|
|
364
|
-
paths: s,
|
|
365
|
-
style: t,
|
|
366
|
-
width: e.getWidth(),
|
|
367
|
-
height: e.getHeight(),
|
|
368
|
-
zoom: n,
|
|
369
|
-
grid: r,
|
|
370
|
-
hit: o
|
|
371
|
-
});
|
|
372
|
-
});
|
|
373
|
-
V.displayName = "ShapePaths";
|
|
374
|
-
var X = u(({ handles: e, width: t, height: n, zoom: r, onDrag: o }) => {
|
|
375
|
-
const s = y(null), i = y(null), [l, a] = x(!1), c = p((e) => {
|
|
7
|
+
import { t as e } from "./CEyXz1TulkCpAv0t.mjs";
|
|
8
|
+
import { n as t } from "./D-lQa7ydREp9WwxP.mjs";
|
|
9
|
+
import { t as n } from "./wtQ7d7f37N1tuJZB.mjs";
|
|
10
|
+
import { t as o } from "./DA6UdPMREzxobL8H.mjs";
|
|
11
|
+
import { i as r, n as s, r as i, t as l } from "./eG-mlQfoOvRwAwU1.mjs";
|
|
12
|
+
import { forwardRef as a, memo as p, useCallback as c, useEffect as d, useMemo as h, useReducer as u, useRef as m, useState as g } from "react";
|
|
13
|
+
import { jsx as f, jsxs as y } from "react/jsx-runtime";
|
|
14
|
+
import { messageKey as v } from "@sheetxl/utils";
|
|
15
|
+
import { ReactUtils as x, useImperativeElement as w } from "@sheetxl/utils-react";
|
|
16
|
+
import { createPortal as b } from "react-dom";
|
|
17
|
+
var j = p(({ handles: e, width: t, height: n, zoom: o, onDrag: r }) => {
|
|
18
|
+
const s = m(null), i = m(null), [l, a] = g(!1), p = c((e) => {
|
|
376
19
|
const t = s.current, n = t?.getScreenCTM();
|
|
377
20
|
if (!t || !n) return null;
|
|
378
|
-
const
|
|
21
|
+
const o = new DOMPoint(e.clientX, e.clientY).matrixTransform(n.inverse());
|
|
379
22
|
return {
|
|
380
|
-
x:
|
|
381
|
-
y:
|
|
23
|
+
x: o.x,
|
|
24
|
+
y: o.y
|
|
382
25
|
};
|
|
383
|
-
}, []),
|
|
26
|
+
}, []), d = c((e, t) => {
|
|
384
27
|
0 === e.button && (e.stopPropagation(), e.preventDefault(), i.current = {
|
|
385
28
|
index: t,
|
|
386
29
|
pointerId: e.pointerId
|
|
387
30
|
}, e.currentTarget.setPointerCapture(e.pointerId), a(!0));
|
|
388
|
-
}, []),
|
|
31
|
+
}, []), h = c((e) => {
|
|
389
32
|
const t = i.current;
|
|
390
33
|
if (!t || t.pointerId !== e.pointerId) return;
|
|
391
34
|
e.stopPropagation();
|
|
392
|
-
const n =
|
|
393
|
-
n &&
|
|
394
|
-
}, [
|
|
35
|
+
const n = p(e);
|
|
36
|
+
n && r(t.index, n.x, n.y, "move");
|
|
37
|
+
}, [p, r]), u = c((e) => {
|
|
395
38
|
const t = i.current;
|
|
396
39
|
if (!t || t.pointerId !== e.pointerId) return;
|
|
397
40
|
e.stopPropagation(), i.current = null, a(!1);
|
|
398
|
-
const n =
|
|
399
|
-
n ?
|
|
400
|
-
}, [
|
|
41
|
+
const n = p(e);
|
|
42
|
+
n ? r(t.index, n.x, n.y, "end") : r(t.index, 0, 0, "cancel");
|
|
43
|
+
}, [p, r]), v = c((e) => {
|
|
401
44
|
const t = i.current;
|
|
402
|
-
t && t.pointerId === e.pointerId && (i.current = null, a(!1),
|
|
403
|
-
}, [
|
|
45
|
+
t && t.pointerId === e.pointerId && (i.current = null, a(!1), r(t.index, 0, 0, "cancel"));
|
|
46
|
+
}, [r]);
|
|
404
47
|
if (!(0 !== e.length && t > 0 && n > 0)) return null;
|
|
405
|
-
const
|
|
406
|
-
return
|
|
48
|
+
const x = o > 0 ? o : 1, w = 4.5 / x;
|
|
49
|
+
return f("svg", {
|
|
407
50
|
ref: s,
|
|
408
51
|
className: l ? "shape-handles movable-gesture" : "shape-handles",
|
|
409
52
|
viewBox: `0 0 ${t} ${n}`,
|
|
@@ -419,212 +62,175 @@ var X = u(({ handles: e, width: t, height: n, zoom: r, onDrag: o }) => {
|
|
|
419
62
|
pointerEvents: "none",
|
|
420
63
|
touchAction: "none"
|
|
421
64
|
},
|
|
422
|
-
children: e.map((e) =>
|
|
65
|
+
children: e.map((e) => y("g", {
|
|
423
66
|
className: "shape-handle",
|
|
424
|
-
style: { "--shape-scale":
|
|
425
|
-
children: [
|
|
67
|
+
style: { "--shape-scale": x },
|
|
68
|
+
children: [f("circle", {
|
|
426
69
|
cx: e.x,
|
|
427
70
|
cy: e.y,
|
|
428
|
-
r:
|
|
71
|
+
r: w,
|
|
429
72
|
fill: "#ffc000",
|
|
430
73
|
stroke: "#7f6000",
|
|
431
|
-
strokeWidth: 1 /
|
|
74
|
+
strokeWidth: 1 / x,
|
|
432
75
|
style: { pointerEvents: "none" }
|
|
433
|
-
}),
|
|
76
|
+
}), f("circle", {
|
|
434
77
|
className: "shape-handle-hit",
|
|
435
78
|
cx: e.x,
|
|
436
79
|
cy: e.y,
|
|
437
|
-
r:
|
|
80
|
+
r: w,
|
|
438
81
|
fill: "transparent",
|
|
439
82
|
style: {
|
|
440
83
|
pointerEvents: "all",
|
|
441
84
|
cursor: "crosshair",
|
|
442
85
|
touchAction: "none"
|
|
443
86
|
},
|
|
444
|
-
onPointerDown: (t) =>
|
|
445
|
-
onPointerMove:
|
|
446
|
-
onPointerUp:
|
|
447
|
-
onPointerCancel:
|
|
87
|
+
onPointerDown: (t) => d(t, e.index),
|
|
88
|
+
onPointerMove: h,
|
|
89
|
+
onPointerUp: u,
|
|
90
|
+
onPointerCancel: v,
|
|
448
91
|
onMouseDown: (e) => e.stopPropagation()
|
|
449
92
|
})]
|
|
450
93
|
}, e.index))
|
|
451
94
|
});
|
|
452
95
|
});
|
|
453
|
-
|
|
454
|
-
var
|
|
96
|
+
j.displayName = "ShapeHandles";
|
|
97
|
+
var T = (e, t) => e > 0 || t > 0, C = (e, t, n) => !e || e.getWidth() === t && e.getHeight() === n ? e : T(t, n) ? e.resize(t, n) : null, P = (e) => {
|
|
455
98
|
const t = [];
|
|
456
99
|
return e.forEachConnection((e) => t.push(e)), t;
|
|
457
|
-
},
|
|
458
|
-
const { children:
|
|
459
|
-
e(
|
|
460
|
-
onBoundsChange:
|
|
461
|
-
onSelectionChange:
|
|
100
|
+
}, S = p(a((a, p) => {
|
|
101
|
+
const { children: S, disabled: E, style: A, shape: D, movable: N, zoom: z = 1, isDragging: I, onHide: H, onShow: M, onDragZone: $, adornmentHost: k, flip: R, gesture: O, debugGeometry: B = !1, ...F } = a, G = t()?.getStyles() ?? null, [W, X] = u((e) => e + 1, 0);
|
|
102
|
+
e(D, { onAnyChange: X }), e(N ?? null, {
|
|
103
|
+
onBoundsChange: X,
|
|
104
|
+
onSelectionChange: X
|
|
462
105
|
});
|
|
463
|
-
const J =
|
|
464
|
-
const [t] = T("movable-drag", null), n = e ? t?.[e.getId()] : void 0, r = n?.bounds ?? e?.getBounds();
|
|
465
|
-
return {
|
|
466
|
-
width: r?.width ?? 0,
|
|
467
|
-
height: r?.height ?? 0,
|
|
468
|
-
rotation: n?.rotation ?? (e?.getRotation() || 0),
|
|
469
|
-
content: n?.content ?? null
|
|
470
|
-
};
|
|
471
|
-
})(M), ne = v.getShapeType(), re = v.getAdjustments(), oe = Y(Q, K), [se, ie] = x(null), le = y(0);
|
|
106
|
+
const J = D.toJSON(), { width: L, height: U, rotation: V, content: Y } = r(N), Z = D.getShapeType(), q = D.getAdjustments(), K = T(L, U), [Q, _] = g(null), ee = m(0);
|
|
472
107
|
d(() => {
|
|
473
|
-
if (!
|
|
474
|
-
const e = ++
|
|
475
|
-
|
|
476
|
-
|
|
108
|
+
if (!K) return void _(null);
|
|
109
|
+
const e = ++ee.current, t = D.getShapeType();
|
|
110
|
+
D.getGeometry(L, U).then((n) => {
|
|
111
|
+
ee.current === e && _(n ? {
|
|
477
112
|
shapeType: t,
|
|
478
113
|
geometry: n
|
|
479
114
|
} : null);
|
|
480
115
|
}, () => {
|
|
481
|
-
|
|
116
|
+
ee.current === e && _(null);
|
|
482
117
|
});
|
|
483
118
|
}, [
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
119
|
+
D,
|
|
120
|
+
L,
|
|
121
|
+
U,
|
|
122
|
+
W
|
|
488
123
|
]);
|
|
489
|
-
const
|
|
124
|
+
const te = void 0 !== Y?.shapeType && Y.shapeType !== Z ? Y.shapeType : null, [ne, oe] = g(null);
|
|
490
125
|
d(() => {
|
|
491
|
-
if (!
|
|
126
|
+
if (!te || !K || ne?.shapeType === te) return;
|
|
492
127
|
let e = !0;
|
|
493
|
-
return
|
|
494
|
-
e && t &&
|
|
495
|
-
shapeType:
|
|
128
|
+
return D.getGeometry(L, U, { shapeType: te }).then((t) => {
|
|
129
|
+
e && t && oe({
|
|
130
|
+
shapeType: te,
|
|
496
131
|
geometry: t
|
|
497
132
|
});
|
|
498
133
|
}, () => {}), () => {
|
|
499
134
|
e = !1;
|
|
500
135
|
};
|
|
501
136
|
}, [
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
137
|
+
D,
|
|
138
|
+
te,
|
|
139
|
+
K
|
|
505
140
|
]);
|
|
506
|
-
const
|
|
507
|
-
const e =
|
|
508
|
-
return e ?
|
|
141
|
+
const re = h(() => {
|
|
142
|
+
const e = Q?.shapeType === Z ? Q : ne?.shapeType === Z ? ne : null;
|
|
143
|
+
return e ? C(e.geometry, L, U)?.withAdjustments(q) ?? null : C(Q?.geometry ?? null, L, U);
|
|
509
144
|
}, [
|
|
510
|
-
se,
|
|
511
|
-
ce,
|
|
512
|
-
ne,
|
|
513
|
-
re,
|
|
514
145
|
Q,
|
|
515
|
-
|
|
516
|
-
|
|
146
|
+
ne,
|
|
147
|
+
Z,
|
|
148
|
+
q,
|
|
149
|
+
L,
|
|
150
|
+
U
|
|
151
|
+
]), se = c((e) => D.getResource(e), [D]);
|
|
517
152
|
d(() => {
|
|
518
153
|
const e = [];
|
|
519
|
-
for (let t =
|
|
154
|
+
for (let t = N?.getParent() ?? null; t; t = t.getParent()) e.push(t.getContent().addListeners({ onAnyChange: X }));
|
|
520
155
|
return () => {
|
|
521
156
|
for (const t of e) t();
|
|
522
157
|
};
|
|
523
|
-
}, [
|
|
524
|
-
const
|
|
525
|
-
let o = null;
|
|
526
|
-
try {
|
|
527
|
-
o = t?.getTheme()?.toJSON() ?? null;
|
|
528
|
-
} catch {
|
|
529
|
-
o = null;
|
|
530
|
-
}
|
|
531
|
-
const i = c.resolve(e, o, r), { stroke: h } = i, u = (e) => j(e, t), p = a.toConcreteFill(i.fill, u), d = a.toConcreteFill(h?.fill, u), f = L(d), m = d?.type === s.Type.Gradient ? E(d) ?? void 0 : void 0, g = L(p), y = p?.type === s.Type.Gradient ? E(p) ?? void 0 : void 0;
|
|
532
|
-
let x;
|
|
533
|
-
if (p?.type === s.Type.Image) {
|
|
534
|
-
const e = void 0 === p.resId ? null : n?.(p.resId) ?? null;
|
|
535
|
-
e && (x = {
|
|
536
|
-
resource: e,
|
|
537
|
-
fill: p
|
|
538
|
-
});
|
|
539
|
-
}
|
|
540
|
-
return {
|
|
541
|
-
fill: g,
|
|
542
|
-
gradient: y,
|
|
543
|
-
image: x,
|
|
544
|
-
stroke: f,
|
|
545
|
-
strokeGradient: m,
|
|
546
|
-
strokeWidth: f ? Math.max(0, i.strokeWidth) * P : 0,
|
|
547
|
-
lineJoin: h?.lineJoin ?? "miter",
|
|
548
|
-
lineCap: h?.lineCap ?? "butt",
|
|
549
|
-
miterLimit: "number" == typeof h?.miterLimit ? h.miterLimit : 18.5,
|
|
550
|
-
dash: l.toDashLengths(h?.dash),
|
|
551
|
-
textColor: j(i.fontColor, t)
|
|
552
|
-
};
|
|
553
|
-
})(J, O, pe, de), [
|
|
158
|
+
}, [N]);
|
|
159
|
+
const ie = s(N), le = h(() => i(J, G, se, ie), [
|
|
554
160
|
J,
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
]), [
|
|
559
|
-
if (
|
|
560
|
-
const e =
|
|
561
|
-
return e && void 0 !==
|
|
161
|
+
G,
|
|
162
|
+
se,
|
|
163
|
+
ie
|
|
164
|
+
]), [ae, pe] = g(null), ce = void 0 !== Y?.adjustments ? Y.adjustments : ae ?? void 0, de = h(() => {
|
|
165
|
+
if (te && ne?.shapeType !== te) return re;
|
|
166
|
+
const e = te ? C(ne.geometry, L, U) : re;
|
|
167
|
+
return e && void 0 !== ce ? e.withAdjustments(ce) : e;
|
|
562
168
|
}, [
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
]),
|
|
570
|
-
if ("cancel" ===
|
|
571
|
-
if (!
|
|
572
|
-
const
|
|
573
|
-
if ("move" ===
|
|
574
|
-
if (
|
|
575
|
-
if (!
|
|
576
|
-
const e = { adjustments:
|
|
169
|
+
re,
|
|
170
|
+
te,
|
|
171
|
+
ne,
|
|
172
|
+
L,
|
|
173
|
+
U,
|
|
174
|
+
ce
|
|
175
|
+
]), he = m(null), [ue, me] = g(!1), ge = c((e, t, n, o) => {
|
|
176
|
+
if ("cancel" === o) return he.current && (he.current = null, me(!1), O?.cancel()), void pe(null);
|
|
177
|
+
if (!de || !re) return;
|
|
178
|
+
const r = de.adjustmentsFromHandle(e, t, n);
|
|
179
|
+
if ("move" === o) {
|
|
180
|
+
if (O && !E) {
|
|
181
|
+
if (!he.current) {
|
|
182
|
+
const e = { adjustments: r }, t = (t) => {
|
|
577
183
|
t.getContent().setAdjustments(e.adjustments);
|
|
578
184
|
};
|
|
579
|
-
if (!
|
|
580
|
-
|
|
185
|
+
if (!O.start(v("op.setShapeAdjustments"), t)) return;
|
|
186
|
+
he.current = e, me(!0);
|
|
581
187
|
}
|
|
582
|
-
|
|
188
|
+
he.current.adjustments = r, O.preview({ content: { adjustments: r } });
|
|
583
189
|
return;
|
|
584
190
|
}
|
|
585
|
-
|
|
191
|
+
pe(r);
|
|
586
192
|
return;
|
|
587
193
|
}
|
|
588
|
-
const s =
|
|
589
|
-
if (s) return
|
|
590
|
-
|
|
194
|
+
const s = he.current;
|
|
195
|
+
if (s) return he.current = null, me(!1), s.adjustments = r, void O?.finish();
|
|
196
|
+
pe(null), E || D.setAdjustments(r);
|
|
591
197
|
}, [
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
]),
|
|
198
|
+
de,
|
|
199
|
+
re,
|
|
200
|
+
D,
|
|
201
|
+
E,
|
|
202
|
+
O
|
|
203
|
+
]), fe = h(() => {
|
|
598
204
|
const e = [];
|
|
599
|
-
return
|
|
600
|
-
}, [
|
|
601
|
-
dpr:
|
|
602
|
-
zoom:
|
|
603
|
-
width:
|
|
604
|
-
height:
|
|
605
|
-
flipH:
|
|
606
|
-
flipV:
|
|
205
|
+
return de?.forEachHandle((t) => e.push(t)), e;
|
|
206
|
+
}, [de]), ye = w(p, () => ({ isShapeEditor: () => !0 }), []), ve = R ?? N?.getFlip(), xe = ve?.horizontal ?? !1, we = ve?.vertical ?? !1, be = V % 360 != 0, je = h(() => !be && T(L, U) ? {
|
|
207
|
+
dpr: x.getDevicePixelRatio(),
|
|
208
|
+
zoom: z,
|
|
209
|
+
width: L,
|
|
210
|
+
height: U,
|
|
211
|
+
flipH: xe,
|
|
212
|
+
flipV: we
|
|
607
213
|
} : null, [
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
214
|
+
be,
|
|
215
|
+
z,
|
|
216
|
+
L,
|
|
217
|
+
U,
|
|
218
|
+
xe,
|
|
219
|
+
we
|
|
614
220
|
]);
|
|
615
|
-
if (
|
|
616
|
-
const
|
|
617
|
-
transform:
|
|
221
|
+
if (D.isDeleted() || !J) return null;
|
|
222
|
+
const Te = "none" === A?.pointerEvents, Ce = Te ? "none" : "visiblePainted", Pe = !Te && !E && (!I || ue) && !!N?.isSelected(), Se = {
|
|
223
|
+
transform: xe || we ? `scale(${xe ? -1 : 1}, ${we ? -1 : 1})` : void 0,
|
|
618
224
|
transformOrigin: "center"
|
|
619
225
|
};
|
|
620
|
-
let
|
|
621
|
-
|
|
622
|
-
handles:
|
|
623
|
-
width:
|
|
624
|
-
height:
|
|
625
|
-
zoom:
|
|
626
|
-
onDrag:
|
|
627
|
-
}),
|
|
226
|
+
let Ee = null;
|
|
227
|
+
Pe && fe.length > 0 && (Ee = f(j, {
|
|
228
|
+
handles: fe,
|
|
229
|
+
width: L,
|
|
230
|
+
height: U,
|
|
231
|
+
zoom: z,
|
|
232
|
+
onDrag: ge
|
|
233
|
+
}), k && (Ee = b(f("div", {
|
|
628
234
|
className: "shape-adornment",
|
|
629
235
|
style: {
|
|
630
236
|
position: "absolute",
|
|
@@ -632,32 +238,32 @@ var Y = (e, t) => e > 0 || t > 0, _ = (e, t, n) => !e || e.getWidth() === t && e
|
|
|
632
238
|
top: 0,
|
|
633
239
|
width: "100%",
|
|
634
240
|
height: "100%",
|
|
635
|
-
...
|
|
241
|
+
...Se,
|
|
636
242
|
pointerEvents: "none"
|
|
637
243
|
},
|
|
638
|
-
children:
|
|
639
|
-
}),
|
|
640
|
-
const
|
|
641
|
-
return
|
|
244
|
+
children: Ee
|
|
245
|
+
}), k)));
|
|
246
|
+
const Ae = xe !== we ? "scaleX(-1)" : void 0, De = de?.getTextRect(), Ne = J.text, ze = !!Ne && Ne.paragraphs.some((e) => e.runs.some((e) => "" !== e.text));
|
|
247
|
+
return y("div", {
|
|
642
248
|
className: "shape-editor",
|
|
643
|
-
...
|
|
644
|
-
ref:
|
|
249
|
+
...F,
|
|
250
|
+
ref: ye,
|
|
645
251
|
style: {
|
|
646
252
|
width: "100%",
|
|
647
253
|
height: "100%",
|
|
648
254
|
position: "relative",
|
|
649
255
|
overflow: "visible",
|
|
650
|
-
filter:
|
|
651
|
-
...
|
|
652
|
-
...
|
|
256
|
+
filter: E ? "blur(1px)" : void 0,
|
|
257
|
+
...Se,
|
|
258
|
+
...A,
|
|
653
259
|
pointerEvents: "none"
|
|
654
260
|
},
|
|
655
261
|
children: [
|
|
656
|
-
|
|
262
|
+
T(L, U) ? y("svg", {
|
|
657
263
|
className: "shape-geometry",
|
|
658
|
-
viewBox: `0 0 ${
|
|
659
|
-
width:
|
|
660
|
-
height:
|
|
264
|
+
viewBox: `0 0 ${L > 0 ? L : 1 / z} ${U > 0 ? U : 1 / z}`,
|
|
265
|
+
width: L > 0 ? "100%" : "1px",
|
|
266
|
+
height: U > 0 ? "100%" : "1px",
|
|
661
267
|
preserveAspectRatio: "none",
|
|
662
268
|
overflow: "visible",
|
|
663
269
|
style: {
|
|
@@ -666,50 +272,50 @@ var Y = (e, t) => e > 0 || t > 0, _ = (e, t, n) => !e || e.getWidth() === t && e
|
|
|
666
272
|
top: 0,
|
|
667
273
|
display: "block",
|
|
668
274
|
pointerEvents: "none",
|
|
669
|
-
filter:
|
|
275
|
+
filter: Pe ? "drop-shadow(1px 1px 2px rgba(0,0,0,.15))" : void 0
|
|
670
276
|
},
|
|
671
|
-
children: [
|
|
672
|
-
geometry:
|
|
673
|
-
style:
|
|
674
|
-
zoom:
|
|
277
|
+
children: [de ? f(l, {
|
|
278
|
+
geometry: de,
|
|
279
|
+
style: le,
|
|
280
|
+
zoom: z,
|
|
675
281
|
grid: je,
|
|
676
|
-
hit:
|
|
677
|
-
}) : null,
|
|
282
|
+
hit: Ce
|
|
283
|
+
}) : null, B && de && De ? y("g", {
|
|
678
284
|
pointerEvents: "none",
|
|
679
|
-
children: [
|
|
680
|
-
x:
|
|
681
|
-
y:
|
|
682
|
-
width: Math.max(0,
|
|
683
|
-
height: Math.max(0,
|
|
285
|
+
children: [f("rect", {
|
|
286
|
+
x: De.l,
|
|
287
|
+
y: De.t,
|
|
288
|
+
width: Math.max(0, De.r - De.l),
|
|
289
|
+
height: Math.max(0, De.b - De.t),
|
|
684
290
|
fill: "none",
|
|
685
291
|
stroke: "#c00",
|
|
686
|
-
strokeWidth: 1 /
|
|
687
|
-
strokeDasharray: `${4 /
|
|
688
|
-
}),
|
|
689
|
-
x: e.x - 3 /
|
|
690
|
-
y: e.y - 3 /
|
|
691
|
-
width: 6 /
|
|
692
|
-
height: 6 /
|
|
292
|
+
strokeWidth: 1 / z,
|
|
293
|
+
strokeDasharray: `${4 / z} ${2 / z}`
|
|
294
|
+
}), P(de).map((e) => f("rect", {
|
|
295
|
+
x: e.x - 3 / z,
|
|
296
|
+
y: e.y - 3 / z,
|
|
297
|
+
width: 6 / z,
|
|
298
|
+
height: 6 / z,
|
|
693
299
|
fill: "#0a0"
|
|
694
300
|
}, e.index))]
|
|
695
301
|
}) : null]
|
|
696
302
|
}) : null,
|
|
697
|
-
|
|
303
|
+
ze && De ? f("div", {
|
|
698
304
|
className: "shape-text-frame",
|
|
699
305
|
style: {
|
|
700
306
|
position: "absolute",
|
|
701
|
-
left:
|
|
702
|
-
top:
|
|
703
|
-
width: Math.max(0,
|
|
704
|
-
height: Math.max(0,
|
|
705
|
-
zoom:
|
|
706
|
-
transform:
|
|
307
|
+
left: De.l,
|
|
308
|
+
top: De.t,
|
|
309
|
+
width: Math.max(0, De.r - De.l),
|
|
310
|
+
height: Math.max(0, De.b - De.t),
|
|
311
|
+
zoom: z,
|
|
312
|
+
transform: Ae,
|
|
707
313
|
transformOrigin: "center",
|
|
708
|
-
pointerEvents:
|
|
709
|
-
color:
|
|
314
|
+
pointerEvents: Te ? "none" : "auto",
|
|
315
|
+
color: le.textColor ?? void 0
|
|
710
316
|
},
|
|
711
|
-
children:
|
|
712
|
-
movable:
|
|
317
|
+
children: f(n, {
|
|
318
|
+
movable: N,
|
|
713
319
|
disabled: !0,
|
|
714
320
|
style: {
|
|
715
321
|
fontFamily: "Calibri, Carlito, sans-serif",
|
|
@@ -721,16 +327,16 @@ var Y = (e, t) => e > 0 || t > 0, _ = (e, t, n) => !e || e.getWidth() === t && e
|
|
|
721
327
|
padding: 0,
|
|
722
328
|
overflow: "hidden"
|
|
723
329
|
},
|
|
724
|
-
children:
|
|
725
|
-
text:
|
|
726
|
-
styles:
|
|
727
|
-
color:
|
|
330
|
+
children: f(o, {
|
|
331
|
+
text: Ne,
|
|
332
|
+
styles: G,
|
|
333
|
+
color: le.textColor
|
|
728
334
|
})
|
|
729
335
|
})
|
|
730
336
|
}) : null,
|
|
731
|
-
|
|
337
|
+
Ee
|
|
732
338
|
]
|
|
733
339
|
});
|
|
734
340
|
}));
|
|
735
|
-
|
|
736
|
-
export {
|
|
341
|
+
S.displayName = "ShapeEditor";
|
|
342
|
+
export { S as ShapeEditor };
|