@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/control.mjs
CHANGED
|
@@ -1,47 +1,48 @@
|
|
|
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 {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
},
|
|
7
|
+
import { t as e } from "./CEyXz1TulkCpAv0t.mjs";
|
|
8
|
+
import { IFont as t } from "@sheetxl/sdk";
|
|
9
|
+
import { memo as n, useEffect as r, useReducer as o, useRef as i } from "react";
|
|
10
|
+
import { jsx as l, jsxs as d } from "react/jsx-runtime";
|
|
11
|
+
var a = (e) => {
|
|
12
|
+
const n = e.getFont();
|
|
13
|
+
if (!n) return {};
|
|
14
|
+
const r = {};
|
|
15
|
+
return n.name && (r.fontFamily = t.toCSSFontFamily(n.name)), void 0 !== n.size && (r.fontSize = `${n.size}pt`), n.bold && (r.fontWeight = "bold"), n.italic && (r.fontStyle = "italic"), n.color && (r.color = n.color), r;
|
|
16
|
+
}, s = {
|
|
16
17
|
pointerEvents: "none",
|
|
17
18
|
width: "100%",
|
|
18
19
|
height: "100%",
|
|
19
20
|
boxSizing: "border-box",
|
|
20
21
|
margin: 0
|
|
21
|
-
},
|
|
22
|
-
...
|
|
22
|
+
}, c = {
|
|
23
|
+
...s,
|
|
23
24
|
display: "flex",
|
|
24
25
|
alignItems: "center",
|
|
25
26
|
gap: "0.35em",
|
|
26
27
|
padding: "0 2px",
|
|
27
28
|
overflow: "hidden",
|
|
28
29
|
whiteSpace: "nowrap"
|
|
29
|
-
},
|
|
30
|
-
const d =
|
|
31
|
-
const { children:
|
|
30
|
+
}, g = (t, i) => {
|
|
31
|
+
const d = n((n) => {
|
|
32
|
+
const { children: i, disabled: d, style: a, movable: c, zoom: g = 1, isDragging: h, onHide: p, onShow: u, onDragZone: m, adornmentHost: x, flip: y, ...f } = n, b = c.getContent(), [, v] = o((e) => e + 1, 0);
|
|
32
33
|
e(b, { onAnyChange() {
|
|
33
34
|
v();
|
|
34
35
|
} });
|
|
35
36
|
const w = b, C = b, I = w.getLinkedCell?.() ?? null;
|
|
36
|
-
|
|
37
|
+
r(() => {
|
|
37
38
|
if (I) return w.getLinkedRange?.()?.addListener(() => v(), { ignoreAddressChanges: !0 });
|
|
38
39
|
}, [b, I]);
|
|
39
|
-
const
|
|
40
|
-
if (
|
|
41
|
-
if (
|
|
42
|
-
}, [b,
|
|
43
|
-
const
|
|
44
|
-
return
|
|
40
|
+
const S = C.getListFillRange?.() ?? null;
|
|
41
|
+
if (r(() => {
|
|
42
|
+
if (S) return C.getListSourceRange?.()?.addListener(() => v(), { ignoreAddressChanges: !0 });
|
|
43
|
+
}, [b, S]), b.isDeleted()) return null;
|
|
44
|
+
const R = c.getBounds();
|
|
45
|
+
return l("div", {
|
|
45
46
|
className: "form-control-renderer",
|
|
46
47
|
...f,
|
|
47
48
|
style: {
|
|
@@ -51,57 +52,57 @@ var d = (e) => {
|
|
|
51
52
|
position: "relative",
|
|
52
53
|
boxShadow: h ? "1px 1px 2px var(--sxl-color-shadow, rgba(0,0,0,.15))" : void 0,
|
|
53
54
|
overflow: "hidden",
|
|
54
|
-
...
|
|
55
|
+
...a
|
|
55
56
|
},
|
|
56
|
-
children:
|
|
57
|
+
children: l("div", {
|
|
57
58
|
inert: !0,
|
|
58
|
-
style:
|
|
59
|
-
children:
|
|
59
|
+
style: s,
|
|
60
|
+
children: l(t, {
|
|
60
61
|
control: b,
|
|
61
|
-
width:
|
|
62
|
-
height:
|
|
62
|
+
width: R?.width ?? 0,
|
|
63
|
+
height: R?.height ?? 0
|
|
63
64
|
})
|
|
64
65
|
})
|
|
65
66
|
});
|
|
66
67
|
});
|
|
67
|
-
return d.displayName =
|
|
68
|
-
},
|
|
68
|
+
return d.displayName = i, d;
|
|
69
|
+
}, h = g(({ control: e }) => l("button", {
|
|
69
70
|
type: "button",
|
|
70
71
|
tabIndex: -1,
|
|
71
72
|
style: {
|
|
72
|
-
...
|
|
73
|
-
...
|
|
73
|
+
...s,
|
|
74
|
+
...a(e)
|
|
74
75
|
},
|
|
75
76
|
children: e.getCaption() ?? ""
|
|
76
|
-
}), "ButtonRenderer"),
|
|
77
|
-
const t =
|
|
78
|
-
return
|
|
79
|
-
t.current && (t.current.indeterminate =
|
|
80
|
-
}, [
|
|
77
|
+
}), "ButtonRenderer"), p = g(({ control: e }) => {
|
|
78
|
+
const t = i(null), n = e.isMixed();
|
|
79
|
+
return r(() => {
|
|
80
|
+
t.current && (t.current.indeterminate = n);
|
|
81
|
+
}, [n]), d("label", {
|
|
81
82
|
style: {
|
|
82
|
-
...
|
|
83
|
-
...
|
|
83
|
+
...c,
|
|
84
|
+
...a(e)
|
|
84
85
|
},
|
|
85
|
-
children: [
|
|
86
|
+
children: [l("input", {
|
|
86
87
|
ref: t,
|
|
87
88
|
type: "checkbox",
|
|
88
89
|
checked: e.isChecked(),
|
|
89
90
|
readOnly: !0
|
|
90
|
-
}),
|
|
91
|
+
}), l("span", { children: e.getCaption() ?? "" })]
|
|
91
92
|
});
|
|
92
|
-
}, "CheckBoxRenderer"),
|
|
93
|
+
}, "CheckBoxRenderer"), u = g(({ control: e }) => d("label", {
|
|
93
94
|
style: {
|
|
94
|
-
...
|
|
95
|
-
...
|
|
95
|
+
...c,
|
|
96
|
+
...a(e)
|
|
96
97
|
},
|
|
97
|
-
children: [
|
|
98
|
+
children: [l("input", {
|
|
98
99
|
type: "radio",
|
|
99
100
|
checked: e.isChecked(),
|
|
100
101
|
readOnly: !0
|
|
101
|
-
}),
|
|
102
|
-
}), "OptionButtonRenderer"),
|
|
102
|
+
}), l("span", { children: e.getCaption() ?? "" })]
|
|
103
|
+
}), "OptionButtonRenderer"), m = g(({ control: e }) => {
|
|
103
104
|
const t = e.isHorizontal();
|
|
104
|
-
return
|
|
105
|
+
return l("input", {
|
|
105
106
|
type: "range",
|
|
106
107
|
tabIndex: -1,
|
|
107
108
|
readOnly: !0,
|
|
@@ -110,7 +111,7 @@ var d = (e) => {
|
|
|
110
111
|
step: e.getIncrement() ?? 1,
|
|
111
112
|
value: e.getValue() ?? e.getMin() ?? 0,
|
|
112
113
|
style: {
|
|
113
|
-
...
|
|
114
|
+
...s,
|
|
114
115
|
writingMode: t ? void 0 : "vertical-lr"
|
|
115
116
|
}
|
|
116
117
|
});
|
|
@@ -121,7 +122,7 @@ var d = (e) => {
|
|
|
121
122
|
left: "7,2 4,5 7,8",
|
|
122
123
|
right: "3,2 6,5 3,8"
|
|
123
124
|
}[e.direction];
|
|
124
|
-
return
|
|
125
|
+
return l("svg", {
|
|
125
126
|
viewBox: "0 0 10 10",
|
|
126
127
|
style: {
|
|
127
128
|
width: "100%",
|
|
@@ -129,14 +130,14 @@ var d = (e) => {
|
|
|
129
130
|
maxWidth: 10,
|
|
130
131
|
maxHeight: 10
|
|
131
132
|
},
|
|
132
|
-
children:
|
|
133
|
+
children: l("polyline", {
|
|
133
134
|
points: t,
|
|
134
135
|
fill: "none",
|
|
135
136
|
stroke: "currentColor",
|
|
136
137
|
strokeWidth: 1.5
|
|
137
138
|
})
|
|
138
139
|
});
|
|
139
|
-
},
|
|
140
|
+
}, y = {
|
|
140
141
|
flex: "1 1 0",
|
|
141
142
|
minWidth: 0,
|
|
142
143
|
minHeight: 0,
|
|
@@ -145,64 +146,64 @@ var d = (e) => {
|
|
|
145
146
|
display: "flex",
|
|
146
147
|
alignItems: "center",
|
|
147
148
|
justifyContent: "center"
|
|
148
|
-
},
|
|
149
|
+
}, f = g(({ width: e, height: t }) => {
|
|
149
150
|
const n = ((e, t, n) => e > 0 && t > 0 ? e > t : n)(e, t, !1);
|
|
150
|
-
return
|
|
151
|
+
return d("div", {
|
|
151
152
|
style: {
|
|
152
|
-
...
|
|
153
|
+
...s,
|
|
153
154
|
display: "flex",
|
|
154
155
|
flexDirection: n ? "row" : "column"
|
|
155
156
|
},
|
|
156
|
-
children: [
|
|
157
|
+
children: [l("button", {
|
|
157
158
|
type: "button",
|
|
158
159
|
tabIndex: -1,
|
|
159
|
-
style:
|
|
160
|
-
children:
|
|
161
|
-
}),
|
|
160
|
+
style: y,
|
|
161
|
+
children: l(x, { direction: n ? "left" : "up" })
|
|
162
|
+
}), l("button", {
|
|
162
163
|
type: "button",
|
|
163
164
|
tabIndex: -1,
|
|
164
|
-
style:
|
|
165
|
-
children:
|
|
165
|
+
style: y,
|
|
166
|
+
children: l(x, { direction: n ? "right" : "down" })
|
|
166
167
|
})]
|
|
167
168
|
});
|
|
168
|
-
}, "SpinnerRenderer"),
|
|
169
|
+
}, "SpinnerRenderer"), b = (e) => e.getListItems().map((e, t) => l("option", {
|
|
169
170
|
value: t,
|
|
170
171
|
children: e
|
|
171
|
-
}, t)),
|
|
172
|
+
}, t)), v = g(({ control: e }) => d("select", {
|
|
172
173
|
tabIndex: -1,
|
|
173
174
|
value: e.getSelectedIndex() ?? -1,
|
|
174
|
-
style:
|
|
175
|
+
style: s,
|
|
175
176
|
onChange: () => {},
|
|
176
|
-
children: [null === e.getSelectedIndex() ?
|
|
177
|
-
}), "DropDownRenderer"),
|
|
177
|
+
children: [null === e.getSelectedIndex() ? l("option", { value: -1 }) : null, b(e)]
|
|
178
|
+
}), "DropDownRenderer"), w = g(({ control: e }) => l("select", {
|
|
178
179
|
tabIndex: -1,
|
|
179
180
|
size: Math.max(2, e.getListItems().length),
|
|
180
181
|
value: e.getSelectedIndex() ?? void 0,
|
|
181
|
-
style:
|
|
182
|
+
style: s,
|
|
182
183
|
onChange: () => {},
|
|
183
|
-
children:
|
|
184
|
-
}), "ListBoxRenderer"),
|
|
184
|
+
children: b(e)
|
|
185
|
+
}), "ListBoxRenderer"), C = g(({ control: e }) => l("fieldset", {
|
|
185
186
|
style: {
|
|
186
|
-
...
|
|
187
|
+
...s,
|
|
187
188
|
padding: 0,
|
|
188
|
-
...
|
|
189
|
+
...a(e)
|
|
189
190
|
},
|
|
190
|
-
children:
|
|
191
|
+
children: l("legend", {
|
|
191
192
|
style: {
|
|
192
193
|
marginLeft: "6px",
|
|
193
194
|
padding: "0 2px"
|
|
194
195
|
},
|
|
195
196
|
children: e.getCaption() ?? ""
|
|
196
197
|
})
|
|
197
|
-
}), "GroupBoxRenderer"),
|
|
198
|
+
}), "GroupBoxRenderer"), I = g(({ control: e }) => l("span", {
|
|
198
199
|
style: {
|
|
199
|
-
...
|
|
200
|
-
...
|
|
200
|
+
...c,
|
|
201
|
+
...a(e)
|
|
201
202
|
},
|
|
202
203
|
children: e.getCaption() ?? ""
|
|
203
|
-
}), "LabelRenderer"),
|
|
204
|
+
}), "LabelRenderer"), S = g(({ control: e }) => l("div", {
|
|
204
205
|
style: {
|
|
205
|
-
...
|
|
206
|
+
...s,
|
|
206
207
|
border: "var(--sxl-color-neutral, grey) solid 1px",
|
|
207
208
|
backgroundColor: "var(--sxl-color-base-100, white)",
|
|
208
209
|
display: "flex",
|
|
@@ -213,4 +214,4 @@ var d = (e) => {
|
|
|
213
214
|
},
|
|
214
215
|
children: e.getName?.() ?? e.getTypeDescription()
|
|
215
216
|
}), "UnmodeledControlRenderer");
|
|
216
|
-
export {
|
|
217
|
+
export { h as ButtonRenderer, p as CheckBoxRenderer, v as DropDownRenderer, C as GroupBoxRenderer, I as LabelRenderer, w as ListBoxRenderer, u as OptionButtonRenderer, m as ScrollBarRenderer, f as SpinnerRenderer, S as UnmodeledControlRenderer };
|
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.8.0-beta.14
|
|
3
|
+
*
|
|
4
|
+
* (C) 2026-present SheetXL Inc. & Michael T. Ford
|
|
5
|
+
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
|
+
*/
|
|
7
|
+
import { Color as t, IFill as e, IGeometry as r, IStroke as n, PaintUtils as o, ShapeStyleUtils as s } from "@sheetxl/sdk";
|
|
8
|
+
import { memo as i, useEffect as l, useId as a, useMemo as u, useState as c } from "react";
|
|
9
|
+
import { Fragment as h, jsx as p, jsxs as f } from "react/jsx-runtime";
|
|
10
|
+
import { BufferUtils as d } from "@sheetxl/utils";
|
|
11
|
+
import { useSurfaceState as m } from "@sheetxl/grid-react";
|
|
12
|
+
import { ReactUtils as y } from "@sheetxl/utils-react";
|
|
13
|
+
var g = (t) => {
|
|
14
|
+
const [e] = m("movable-drag", null), r = t ? e?.[t.getId()] : void 0, n = r?.bounds ?? t?.getBounds();
|
|
15
|
+
return {
|
|
16
|
+
width: n?.width ?? 0,
|
|
17
|
+
height: n?.height ?? 0,
|
|
18
|
+
rotation: r?.rotation ?? (t?.getRotation() || 0),
|
|
19
|
+
content: r?.content ?? null
|
|
20
|
+
};
|
|
21
|
+
}, x = 96 / 72, k = (e, r) => {
|
|
22
|
+
if ("string" != typeof e || !e) return null;
|
|
23
|
+
try {
|
|
24
|
+
return (r ? r.parseColor(e) : new t(e))?.toCSS("adaptive") ?? null;
|
|
25
|
+
} catch {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
}, M = (t) => {
|
|
29
|
+
if (!t) return null;
|
|
30
|
+
switch (t.type) {
|
|
31
|
+
case e.Type.Solid: return t.color ?? null;
|
|
32
|
+
case e.Type.Gradient: {
|
|
33
|
+
const e = t.stops?.[0];
|
|
34
|
+
return ("string" == typeof e ? e : e?.color) ?? null;
|
|
35
|
+
}
|
|
36
|
+
case e.Type.Pattern: return t.foreground ?? t.background ?? null;
|
|
37
|
+
case e.Type.Image:
|
|
38
|
+
default: return null;
|
|
39
|
+
}
|
|
40
|
+
}, b = (t) => Math.max(0, Math.min(1, t ?? 0)), v = (t) => {
|
|
41
|
+
const r = t.stops ?? [];
|
|
42
|
+
if (r.length < 2) return null;
|
|
43
|
+
const n = r.length - 1, o = [];
|
|
44
|
+
for (let t = 0; t < r.length; t++) {
|
|
45
|
+
const e = r[t], s = "string" == typeof e ? e : e?.color;
|
|
46
|
+
if (!s) return null;
|
|
47
|
+
const i = "object" == typeof e && "number" == typeof e.offset ? e.offset : t / n;
|
|
48
|
+
o.push({
|
|
49
|
+
offset: b(i),
|
|
50
|
+
color: s
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
if (o.sort((t, e) => t.offset - e.offset), (t.gradientType ?? e.GradientType.Linear) === e.GradientType.Linear) return {
|
|
54
|
+
kind: "linear",
|
|
55
|
+
angle: (((t.angle ?? 0) - 90) % 360 + 360) % 360,
|
|
56
|
+
scaled: t.scaled ?? !0,
|
|
57
|
+
stops: o
|
|
58
|
+
};
|
|
59
|
+
const s = t.focus, i = b(s?.left), l = b(s?.top), a = b(s?.right), u = b(s?.bottom);
|
|
60
|
+
if (i > a || l > u) return null;
|
|
61
|
+
const c = (i + a) / 2, h = (l + u) / 2, p = Math.max(c, 1 - c), f = Math.max(h, 1 - h);
|
|
62
|
+
return {
|
|
63
|
+
kind: "radial",
|
|
64
|
+
cx: c,
|
|
65
|
+
cy: h,
|
|
66
|
+
r: Math.hypot(p, f),
|
|
67
|
+
stops: o
|
|
68
|
+
};
|
|
69
|
+
}, L = s.inheritedGroupFill, $ = (t, r, i, l) => {
|
|
70
|
+
let a = null;
|
|
71
|
+
try {
|
|
72
|
+
a = r?.getTheme()?.toJSON() ?? null;
|
|
73
|
+
} catch {
|
|
74
|
+
a = null;
|
|
75
|
+
}
|
|
76
|
+
const u = s.resolve(t, a, l), { stroke: c } = u, h = (t) => k(t, r), p = o.toConcreteFill(u.fill, h), f = o.toConcreteFill(c?.fill, h), d = M(f), m = f?.type === e.Type.Gradient ? v(f) ?? void 0 : void 0, y = M(p), g = p?.type === e.Type.Gradient ? v(p) ?? void 0 : void 0;
|
|
77
|
+
let b;
|
|
78
|
+
if (p?.type === e.Type.Image) {
|
|
79
|
+
const t = void 0 === p.resId ? null : i?.(p.resId) ?? null;
|
|
80
|
+
t && (b = {
|
|
81
|
+
resource: t,
|
|
82
|
+
fill: p
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
fill: y,
|
|
87
|
+
gradient: g,
|
|
88
|
+
image: b,
|
|
89
|
+
stroke: d,
|
|
90
|
+
strokeGradient: m,
|
|
91
|
+
strokeWidth: d ? Math.max(0, u.strokeWidth) * x : 0,
|
|
92
|
+
lineJoin: c?.lineJoin ?? "miter",
|
|
93
|
+
lineCap: c?.lineCap ?? "butt",
|
|
94
|
+
miterLimit: "number" == typeof c?.miterLimit ? c.miterLimit : 18.5,
|
|
95
|
+
dash: n.toDashLengths(c?.dash),
|
|
96
|
+
textColor: k(u.fontColor, r)
|
|
97
|
+
};
|
|
98
|
+
}, w = /[MLQCAZ]|[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/g, T = {
|
|
99
|
+
M: 1,
|
|
100
|
+
L: 1,
|
|
101
|
+
Q: 2,
|
|
102
|
+
C: 3,
|
|
103
|
+
A: 1,
|
|
104
|
+
Z: 0
|
|
105
|
+
}, C = (t) => String(Math.round(1e5 * t) / 1e5), S = (t) => {
|
|
106
|
+
const e = t.match(w) ?? [], r = [], n = [], o = [];
|
|
107
|
+
let s = {
|
|
108
|
+
x: 0,
|
|
109
|
+
y: 0
|
|
110
|
+
}, i = null, l = 0, a = null;
|
|
111
|
+
for (; l < e.length;) {
|
|
112
|
+
const t = e[l];
|
|
113
|
+
if (void 0 !== T[t]) a = t, l++;
|
|
114
|
+
else if ("M" === a) a = "L";
|
|
115
|
+
else if (null === a || "Z" === a) break;
|
|
116
|
+
if ("Z" === a) {
|
|
117
|
+
i && (n.push({
|
|
118
|
+
from: s,
|
|
119
|
+
to: i
|
|
120
|
+
}), o.push(s), r.push({
|
|
121
|
+
c: a,
|
|
122
|
+
pts: []
|
|
123
|
+
}), s = i, i = null);
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
const u = "A" === a ? e.slice(l, l + 5) : void 0;
|
|
127
|
+
u && (l += 5);
|
|
128
|
+
const c = [];
|
|
129
|
+
for (let t = 0; t < T[a]; t++) c.push({
|
|
130
|
+
x: Number(e[l++]),
|
|
131
|
+
y: Number(e[l++])
|
|
132
|
+
});
|
|
133
|
+
const h = c[c.length - 1];
|
|
134
|
+
if (!h || Number.isNaN(h.x) || Number.isNaN(h.y)) break;
|
|
135
|
+
"M" === a ? (i && o.push(s), i = h, o.push(h)) : ("L" === a && n.push({
|
|
136
|
+
from: s,
|
|
137
|
+
to: h
|
|
138
|
+
}), i || (i = s, o.push(s))), r.push({
|
|
139
|
+
c: a,
|
|
140
|
+
pts: c,
|
|
141
|
+
arc: u
|
|
142
|
+
}), s = h;
|
|
143
|
+
}
|
|
144
|
+
return i && o.push(s), {
|
|
145
|
+
cmds: r,
|
|
146
|
+
straight: n,
|
|
147
|
+
ends: o
|
|
148
|
+
};
|
|
149
|
+
}, P = (t) => {
|
|
150
|
+
const e = [];
|
|
151
|
+
for (const r of t) {
|
|
152
|
+
const t = r.pts.map((t) => `${C(t.x)} ${C(t.y)}`).join(" ");
|
|
153
|
+
e.push("Z" === r.c ? "Z" : `${r.c}${r.arc ? `${r.arc.join(" ")} ` : ""}${t}`);
|
|
154
|
+
}
|
|
155
|
+
return e.join(" ");
|
|
156
|
+
}, F = 1e-6, G = (t, e, r, n, o) => {
|
|
157
|
+
const s = n ? (o - t) * e.zoom : t * e.zoom, i = y.snapLineCenter(s, r, e.dpr);
|
|
158
|
+
return n ? o - i / e.zoom : i / e.zoom;
|
|
159
|
+
}, N = (t, e, r) => {
|
|
160
|
+
const n = S(t), o = n.ends.map((t) => ({
|
|
161
|
+
x: t.x,
|
|
162
|
+
y: t.y
|
|
163
|
+
})), s = r * e.zoom, i = [];
|
|
164
|
+
for (const t of n.straight) {
|
|
165
|
+
const e = Math.abs(t.to.y - t.from.y) < F;
|
|
166
|
+
e !== Math.abs(t.to.x - t.from.x) < F && i.push({
|
|
167
|
+
seg: t,
|
|
168
|
+
level: e,
|
|
169
|
+
at: e ? t.from.y : t.from.x
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
for (const { seg: t, level: r, at: n } of i) r ? t.from.y = t.to.y = G(n, e, s, e.flipV, e.height) : t.from.x = t.to.x = G(n, e, s, e.flipH, e.width);
|
|
173
|
+
const l = [];
|
|
174
|
+
return n.ends.forEach((t, e) => {
|
|
175
|
+
const r = {
|
|
176
|
+
x: t.x - o[e].x,
|
|
177
|
+
y: t.y - o[e].y
|
|
178
|
+
};
|
|
179
|
+
0 === r.x && 0 === r.y || l.push({
|
|
180
|
+
at: o[e],
|
|
181
|
+
by: r
|
|
182
|
+
});
|
|
183
|
+
}), {
|
|
184
|
+
d: P(n.cmds),
|
|
185
|
+
ends: l
|
|
186
|
+
};
|
|
187
|
+
}, z = (t, e) => {
|
|
188
|
+
if (0 === e.length) return t;
|
|
189
|
+
const r = S(t);
|
|
190
|
+
let n = [], o = null;
|
|
191
|
+
const s = /* @__PURE__ */ new Set(), i = () => {
|
|
192
|
+
if (!o) return;
|
|
193
|
+
let t = null, r = 1 / 0;
|
|
194
|
+
for (const n of e) {
|
|
195
|
+
const e = Math.hypot(n.at.x - o.x, n.at.y - o.y);
|
|
196
|
+
e < r && (t = n, r = e);
|
|
197
|
+
}
|
|
198
|
+
for (const e of n) s.has(e) || (s.add(e), e.x += t.by.x, e.y += t.by.y);
|
|
199
|
+
n = [], o = null;
|
|
200
|
+
};
|
|
201
|
+
for (const t of r.cmds) {
|
|
202
|
+
"M" === t.c && (i(), o = t.pts[0]);
|
|
203
|
+
for (const e of t.pts) n.push(e);
|
|
204
|
+
}
|
|
205
|
+
return i(), P(r.cmds);
|
|
206
|
+
}, j = /* @__PURE__ */ new WeakMap(), E = { filter: "var(--sxl-image-filter)" }, I = (t) => {
|
|
207
|
+
const [e, r] = c(null);
|
|
208
|
+
return l(() => {
|
|
209
|
+
if (!t) return;
|
|
210
|
+
let e = !0;
|
|
211
|
+
return ((t) => {
|
|
212
|
+
let e = j.get(t);
|
|
213
|
+
return e || (e = (async () => {
|
|
214
|
+
const e = await t.getExternalURI();
|
|
215
|
+
if (e) return e;
|
|
216
|
+
const [r, n] = await Promise.all([t.toBuffer(), t.getType()]);
|
|
217
|
+
return `data:${n?.mime ?? "image/png"};base64,${d.arrayBufferToBase64(r)}`;
|
|
218
|
+
})(), j.set(t, e)), e;
|
|
219
|
+
})(t).then((n) => {
|
|
220
|
+
e && r({
|
|
221
|
+
resource: t,
|
|
222
|
+
url: n
|
|
223
|
+
});
|
|
224
|
+
}, () => {}), () => {
|
|
225
|
+
e = !1;
|
|
226
|
+
};
|
|
227
|
+
}, [t]), t && e?.resource === t ? e.url : null;
|
|
228
|
+
}, R = (t, e, r, n) => {
|
|
229
|
+
const o = e.stops.map((t, e) => p("stop", {
|
|
230
|
+
offset: t.offset,
|
|
231
|
+
stopColor: t.color
|
|
232
|
+
}, e));
|
|
233
|
+
if ("linear" === e.kind) {
|
|
234
|
+
const s = e.angle * Math.PI / 180;
|
|
235
|
+
let i = Math.cos(s), l = Math.sin(s);
|
|
236
|
+
if (e.scaled) {
|
|
237
|
+
i *= r, l *= n;
|
|
238
|
+
const t = Math.hypot(i, l) || 1;
|
|
239
|
+
i /= t, l /= t;
|
|
240
|
+
}
|
|
241
|
+
const a = (Math.abs(r * i) + Math.abs(n * l)) / 2, u = r / 2, c = n / 2;
|
|
242
|
+
return p("linearGradient", {
|
|
243
|
+
id: t,
|
|
244
|
+
gradientUnits: "userSpaceOnUse",
|
|
245
|
+
x1: u - a * i,
|
|
246
|
+
y1: c - a * l,
|
|
247
|
+
x2: u + a * i,
|
|
248
|
+
y2: c + a * l,
|
|
249
|
+
children: o
|
|
250
|
+
}, t);
|
|
251
|
+
}
|
|
252
|
+
return p("radialGradient", {
|
|
253
|
+
id: t,
|
|
254
|
+
gradientUnits: "userSpaceOnUse",
|
|
255
|
+
cx: e.cx * r,
|
|
256
|
+
cy: e.cy * r,
|
|
257
|
+
r: e.r * r,
|
|
258
|
+
gradientTransform: `scale(1 ${n / r})`,
|
|
259
|
+
children: o
|
|
260
|
+
}, t);
|
|
261
|
+
}, U = i(({ paths: t, style: e, width: n, height: o, zoom: s, grid: i, hit: l }) => {
|
|
262
|
+
const c = a().replace(/[^A-Za-z0-9_-]/g, ""), d = I(e.image?.resource ?? null), m = ((t, e, r = 1) => {
|
|
263
|
+
const n = (e > 0 ? e : 1) * (r > 0 ? r : 1);
|
|
264
|
+
return Math.max(1, Math.round(Math.max(0, t || 0) * n)) / n;
|
|
265
|
+
})(e.strokeWidth, s, i?.dpr ?? y.getDevicePixelRatio()), g = n > 0 && o > 0, x = g ? e.gradient ?? null : null, k = g ? e.strokeGradient ?? null : null, M = e.image ? d ? `url(#${c}-image)` : null : x ? `url(#${c}-fill)` : e.fill, b = k ? `url(#${c}-stroke)` : e.stroke, v = null !== e.stroke && m > 0, L = v ? ((t, e, r) => {
|
|
266
|
+
if (!(t && e > 0)) return;
|
|
267
|
+
const n = "butt" !== r, o = t.map((t, r) => {
|
|
268
|
+
const o = t * e;
|
|
269
|
+
return n ? r % 2 == 0 ? Math.max(0, o - e) : o + e : o;
|
|
270
|
+
});
|
|
271
|
+
return o.length % 2 == 1 && o.push(n ? e : 0), o.map((t) => +t.toFixed(3)).join(" ");
|
|
272
|
+
})(e.dash, m, e.lineCap) : void 0, $ = u(() => ((t, e, n) => {
|
|
273
|
+
const o = /* @__PURE__ */ new Map();
|
|
274
|
+
if (!e) return o;
|
|
275
|
+
const s = /* @__PURE__ */ new Map(), i = [];
|
|
276
|
+
for (const l of t) {
|
|
277
|
+
if (l.layer !== r.PathLayer.Stroke) continue;
|
|
278
|
+
let t = s.get(l.d);
|
|
279
|
+
if (void 0 === t) {
|
|
280
|
+
const r = N(l.d, e, n);
|
|
281
|
+
t = r.d, s.set(l.d, t), i.push(...r.ends);
|
|
282
|
+
}
|
|
283
|
+
o.set(l.index, t);
|
|
284
|
+
}
|
|
285
|
+
for (const e of t) if (e.layer === r.PathLayer.Fill) {
|
|
286
|
+
const t = s.get(e.d);
|
|
287
|
+
void 0 !== t && o.set(e.index, t);
|
|
288
|
+
} else e.layer === r.PathLayer.Marker && o.set(e.index, z(e.d, i));
|
|
289
|
+
return o;
|
|
290
|
+
})(t, v ? i : null, m), [
|
|
291
|
+
t,
|
|
292
|
+
v,
|
|
293
|
+
i,
|
|
294
|
+
m
|
|
295
|
+
]), w = /* @__PURE__ */ new Set(), T = [];
|
|
296
|
+
for (const n of t) {
|
|
297
|
+
const t = `p${n.index}`, o = $.get(n.index) ?? n.d;
|
|
298
|
+
switch (n.layer) {
|
|
299
|
+
case r.PathLayer.Fill:
|
|
300
|
+
if (null === M) break;
|
|
301
|
+
"norm" !== n.fill && w.add(n.fill), T.push(p("path", {
|
|
302
|
+
d: o,
|
|
303
|
+
fill: M,
|
|
304
|
+
filter: "norm" !== n.fill ? `url(#${c}-${n.fill})` : void 0,
|
|
305
|
+
stroke: "none",
|
|
306
|
+
pointerEvents: l
|
|
307
|
+
}, t));
|
|
308
|
+
break;
|
|
309
|
+
case r.PathLayer.Stroke: {
|
|
310
|
+
if (!v) break;
|
|
311
|
+
const r = 8 / (s > 0 ? s : 1);
|
|
312
|
+
"none" !== l && r > m && T.push(p("path", {
|
|
313
|
+
className: "shape-hit",
|
|
314
|
+
d: o,
|
|
315
|
+
fill: "none",
|
|
316
|
+
stroke: "transparent",
|
|
317
|
+
strokeWidth: r,
|
|
318
|
+
strokeLinejoin: "round",
|
|
319
|
+
strokeLinecap: "round",
|
|
320
|
+
pointerEvents: "stroke"
|
|
321
|
+
}, `${t}-hit`)), T.push(p("path", {
|
|
322
|
+
d: o,
|
|
323
|
+
fill: "none",
|
|
324
|
+
stroke: b,
|
|
325
|
+
strokeWidth: m,
|
|
326
|
+
strokeLinejoin: e.lineJoin,
|
|
327
|
+
strokeLinecap: e.lineCap,
|
|
328
|
+
strokeMiterlimit: "miter" === e.lineJoin ? e.miterLimit : void 0,
|
|
329
|
+
strokeDasharray: L,
|
|
330
|
+
pointerEvents: "none" === l ? "none" : "visibleStroke"
|
|
331
|
+
}, t));
|
|
332
|
+
break;
|
|
333
|
+
}
|
|
334
|
+
case r.PathLayer.Marker: v && T.push(p("path", {
|
|
335
|
+
d: o,
|
|
336
|
+
fill: b,
|
|
337
|
+
stroke: "none",
|
|
338
|
+
pointerEvents: l
|
|
339
|
+
}, t));
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
const C = [];
|
|
343
|
+
for (const t of w) {
|
|
344
|
+
const [e, n] = r.FillTransfer[t];
|
|
345
|
+
C.push(p("filter", {
|
|
346
|
+
id: `${c}-${t}`,
|
|
347
|
+
colorInterpolationFilters: "sRGB",
|
|
348
|
+
children: f("feComponentTransfer", { children: [
|
|
349
|
+
p("feFuncR", {
|
|
350
|
+
type: "linear",
|
|
351
|
+
slope: e,
|
|
352
|
+
intercept: n
|
|
353
|
+
}),
|
|
354
|
+
p("feFuncG", {
|
|
355
|
+
type: "linear",
|
|
356
|
+
slope: e,
|
|
357
|
+
intercept: n
|
|
358
|
+
}),
|
|
359
|
+
p("feFuncB", {
|
|
360
|
+
type: "linear",
|
|
361
|
+
slope: e,
|
|
362
|
+
intercept: n
|
|
363
|
+
})
|
|
364
|
+
] })
|
|
365
|
+
}, t));
|
|
366
|
+
}
|
|
367
|
+
if (x && !e.image && C.push(R(`${c}-fill`, x, n, o)), k && v && C.push(R(`${c}-stroke`, k, n, o)), e.image && d) {
|
|
368
|
+
const t = e.image.fill.stretch ?? {}, r = n * (t.left ?? 0) / 100, s = o * (t.top ?? 0) / 100, i = Math.max(0, n - r - n * (t.right ?? 0) / 100), l = Math.max(0, o - s - o * (t.bottom ?? 0) / 100);
|
|
369
|
+
C.push(p("pattern", {
|
|
370
|
+
id: `${c}-image`,
|
|
371
|
+
patternUnits: "userSpaceOnUse",
|
|
372
|
+
x: 0,
|
|
373
|
+
y: 0,
|
|
374
|
+
width: Math.max(n, 1),
|
|
375
|
+
height: Math.max(o, 1),
|
|
376
|
+
children: p("image", {
|
|
377
|
+
href: d,
|
|
378
|
+
x: r,
|
|
379
|
+
y: s,
|
|
380
|
+
width: i,
|
|
381
|
+
height: l,
|
|
382
|
+
preserveAspectRatio: "none",
|
|
383
|
+
style: E
|
|
384
|
+
})
|
|
385
|
+
}, "image"));
|
|
386
|
+
}
|
|
387
|
+
return f(h, { children: [C.length > 0 ? p("defs", { children: C }) : null, T] });
|
|
388
|
+
});
|
|
389
|
+
U.displayName = "PathRun";
|
|
390
|
+
var W = i(({ geometry: t, style: e, zoom: r, grid: n = null, hit: o }) => {
|
|
391
|
+
const s = u(() => {
|
|
392
|
+
const e = [];
|
|
393
|
+
return t.forEachPath((t) => e.push(t)), e;
|
|
394
|
+
}, [t]);
|
|
395
|
+
return p(U, {
|
|
396
|
+
paths: s,
|
|
397
|
+
style: e,
|
|
398
|
+
width: t.getWidth(),
|
|
399
|
+
height: t.getHeight(),
|
|
400
|
+
zoom: r,
|
|
401
|
+
grid: n,
|
|
402
|
+
hit: o
|
|
403
|
+
});
|
|
404
|
+
});
|
|
405
|
+
W.displayName = "ShapePaths";
|
|
406
|
+
export { g as i, L as n, $ as r, W as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
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.
|