@sheetxl/react 0.8.0-beta.20 → 0.8.0-beta.22

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.
Files changed (67) hide show
  1. package/browser/esm/{BzZ2vOT8CNsqcL8P.mjs → B9rbGikcuRq1OnhM.mjs} +2 -2
  2. package/browser/esm/{CM9e6dbkYbw56iFf.mjs → B9wkino8VMasq6E3.mjs} +2 -2
  3. package/browser/esm/{B06WJCAWTIB7QYlK.mjs → BPS1PDZKyF6ivJwa.mjs} +1 -1
  4. package/browser/esm/{BkBxhk45Iln3h-sG.mjs → Biz8qA4-1wRN8de2.mjs} +1 -1
  5. package/browser/esm/{C5RaHvks1HTBfWcr.mjs → Bjzo7g25tw9kTCYC.mjs} +2 -2
  6. package/browser/esm/{qeb-_mAjUAWD7bo4.mjs → BqIbT28MM3SBdvh_.mjs} +2 -2
  7. package/browser/esm/C7rc3CMd_XOITW1V.mjs +264 -0
  8. package/browser/esm/{CUPlUCBX7owYqDq5.mjs → CJVcfqrty5b-eowN.mjs} +2 -2
  9. package/browser/esm/{BGcs5WWx5PpaiJo4.mjs → CgOhJ3utK7aSQm26.mjs} +1 -1
  10. package/browser/esm/{CU67T36gmVTq9ZwH.mjs → CrTfqdSwWScJN566.mjs} +1 -1
  11. package/browser/esm/{Cwye4MAU1-EF7Xlv.mjs → D01C312OntVURMN9.mjs} +14 -14
  12. package/browser/esm/{CPjk4grd05Rp-e3V.mjs → D0g7sllamMog1m-Z.mjs} +3 -3
  13. package/browser/esm/{DcEGutcM_5gl0fZm.mjs → D7P7zWW2gdWclI2p.mjs} +3 -3
  14. package/browser/esm/{BFjx8_H3wUxrWDq9.mjs → D8NUgUzdI7YFxyyA.mjs} +4 -4
  15. package/browser/esm/{Ca_Ki0Si5ozlm1sl.mjs → DH8xeknZXWn7AV5q.mjs} +10 -10
  16. package/browser/esm/{DeOhqQroIiAic6-j.mjs → DgmkBz2cYtVZ8tXv.mjs} +1 -1
  17. package/browser/esm/{SESUB_fypyWmhCWm.mjs → DhGJU1camaOf7KOq.mjs} +12 -12
  18. package/browser/esm/{BcC6S9k7zkHfCNRX.mjs → DxsGY5rYjITV3SLK.mjs} +1 -1
  19. package/browser/esm/{Dkw3FFdQKXZQrkFv.mjs → DyFeCww9e_4G9c-1.mjs} +10 -10
  20. package/browser/esm/{COn0z_IT5hyEPNfV.mjs → HQkKZC6SPUdQwgxi.mjs} +1 -1
  21. package/browser/esm/{CtbJ8PCap2NGxlu0.mjs → QKnTzTdIYAMcBU8r.mjs} +1 -1
  22. package/browser/esm/chart.mjs +3 -3
  23. package/browser/esm/control.mjs +3 -3
  24. package/browser/esm/group.mjs +7 -7
  25. package/browser/esm/{CckrsFaUWle82oNL.mjs → hTeTTb8oYTssk6EY.mjs} +1 -1
  26. package/browser/esm/index.mjs +6538 -6531
  27. package/browser/esm/{QJPDAP6UIHTbY1fM.mjs → mJyEnJIX0iGfGtvE.mjs} +3 -3
  28. package/browser/esm/{B8_6V0LUnuA1dLW6.mjs → mUKvsPCmRWzQke-M.mjs} +1 -1
  29. package/browser/esm/note.mjs +5 -5
  30. package/browser/esm/{C1Qp40Kq88D9nzcX.mjs → np1ChcItFltS6AC5.mjs} +1 -1
  31. package/browser/esm/picture.mjs +2 -2
  32. package/browser/esm/shape.mjs +2 -2
  33. package/browser/esm/slicer.mjs +10 -10
  34. package/node/esm/{gfwmGAXGhq9IIu1U.mjs → -6T2zqPkDm0WgUKI.mjs} +2 -2
  35. package/node/esm/{Jy5x43_CAF31L14-.mjs → BPMjPMRyVTEZq_6j.mjs} +1 -1
  36. package/node/esm/{C9Yq98-vMDznppO2.mjs → BcASbEBHzMKiXn5i.mjs} +3 -3
  37. package/node/esm/{c1FOnFN_eCD6KR4l.mjs → BpcTu_chuDjr_XFv.mjs} +1 -1
  38. package/node/esm/{Nn0yfoegNHIym4QM.mjs → C3XXdc_UXH2g2W5E.mjs} +1 -1
  39. package/node/esm/{DrFBSp6XMEAjkdoG.mjs → C91YeRrspETjFcRc.mjs} +2 -2
  40. package/node/esm/{DytW9LaLlJGM-6m6.mjs → CE5fMGMmykts2yJP.mjs} +1 -1
  41. package/node/esm/{CqnJ_hGK1txHO0j9.mjs → COlzVELrEvgm2STX.mjs} +18 -18
  42. package/node/esm/{G9tXP39ldfioRVhL.mjs → CZc2QH8i-TgW9nGI.mjs} +1 -1
  43. package/node/esm/{7_AWLfp_6MpYBpiV.mjs → CcLUKcJROXrbSXjb.mjs} +1 -1
  44. package/node/esm/{DmPmSA-2Aha-_6qu.mjs → CfpNgRvWmu36cTfV.mjs} +9 -9
  45. package/node/esm/{CER7_OJffhze14wR.mjs → CzQMRmArhJ6blZJp.mjs} +1 -1
  46. package/node/esm/{BOAB33GIG2M2CWMr.mjs → DHTbAHbCiEWhilV_.mjs} +1 -1
  47. package/node/esm/{D63HF8XToGXrf7ds.mjs → DX7ysYSfnigj0ak8.mjs} +1 -1
  48. package/node/esm/{C7wmHIY8RLeNSX3T.mjs → DxKxx-yEkSydHyWQ.mjs} +1 -1
  49. package/node/esm/{77PQMLXXAN7fjBHS.mjs → FUQMKIiQQ5m3xzeO.mjs} +1 -1
  50. package/node/esm/{CBHY_xaB7ke3yH-f.mjs → GG78Gq3CY8SDS-48.mjs} +2 -2
  51. package/node/esm/{UBas29HOMjk4p5jo.mjs → aLt3NYdUcYQu4Ur4.mjs} +1 -1
  52. package/node/esm/chart.mjs +2 -2
  53. package/node/esm/{Ef8HHL90yLZgk3Gf.mjs → cju5Gx-t_74o116W.mjs} +2 -2
  54. package/node/esm/control.mjs +3 -3
  55. package/node/esm/group.mjs +9 -9
  56. package/node/esm/{CWOKAmLpdinc-0TK.mjs → i4aPmKocZebCBeSd.mjs} +83 -81
  57. package/node/esm/index.mjs +5627 -5620
  58. package/node/esm/{BbnUYxeK64Fq92Lo.mjs → l0GtU6LYlBywzc9T.mjs} +2 -2
  59. package/node/esm/note.mjs +5 -5
  60. package/node/esm/picture.mjs +31 -31
  61. package/node/esm/shape.mjs +25 -25
  62. package/node/esm/slicer.mjs +17 -17
  63. package/package.json +7 -7
  64. package/types/src/movable/MovableLayer.d.ts +1 -1
  65. package/types/src/theme/GridColorSchemeContext.d.ts +8 -0
  66. package/types/src/theme/useGridColorScheme.d.ts +5 -1
  67. package/browser/esm/Ch5X-uGft55TOqxa.mjs +0 -262
@@ -1,29 +1,31 @@
1
1
  /**
2
- * @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.8.0-beta.20
2
+ * @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.8.0-beta.22
3
3
  *
4
4
  * (C) 2026-present SheetXL Inc. & Michael T. Ford
5
5
  * License: SheetXL EULA — https://www.sheetxl.com/eula
6
6
  */
7
- import { forwardRef as e, memo as t, useCallback as r, useEffect as n, useLayoutEffect as o, useRef as l, useState as s } from "react";
8
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
9
- import { CommonUtils as c, defineLazyModule as d } from "@sheetxl/utils";
10
- import { useImperativeElement as u, useMeasure as h, usePendingRender as g, usePersistentState as m, useResolvedThemeMode as p } from "@sheetxl/utils-react";
11
- import { useMergeRefs as f } from "react-merge-refs";
12
- var y = {
7
+ import { createContext as e, forwardRef as t, memo as r, useCallback as n, useContext as o, useEffect as l, useLayoutEffect as s, useRef as i, useState as a } from "react";
8
+ import { jsx as c, jsxs as d } from "react/jsx-runtime";
9
+ import { CommonUtils as u, defineLazyModule as h } from "@sheetxl/utils";
10
+ import { useImperativeElement as g, useMeasure as m, usePendingRender as p, usePersistentState as f, useResolvedThemeMode as x } from "@sheetxl/utils-react";
11
+ import { useMergeRefs as y } from "react-merge-refs";
12
+ var b = {
13
13
  Mode: "themeMode",
14
14
  DarkGrid: "enableDarkGrid",
15
15
  DarkImages: "enableDarkImages"
16
- }, b = {
17
- [y.Mode]: null,
18
- [y.DarkGrid]: !1,
19
- [y.DarkImages]: !1
20
- }, x = (e) => {
21
- const [t] = m(y.Mode, b[y.Mode]), [r] = m(y.DarkGrid, b[y.DarkGrid]), { themeMode: n } = p({ mode: e ?? t ?? void 0 });
22
- return e || ("dark" === n && r ? "dark" : "light");
23
- }, v = () => {
24
- const [e] = m(y.Mode, b[y.Mode]), { themeMode: t } = p({ mode: e ?? void 0 });
16
+ }, v = {
17
+ [b.Mode]: null,
18
+ [b.DarkGrid]: !1,
19
+ [b.DarkImages]: !1
20
+ }, k = e(null);
21
+ k.displayName = "GridColorSchemeContext";
22
+ var w = (e) => {
23
+ const t = o(k), [r] = f(b.Mode, v[b.Mode]), [n] = f(b.DarkGrid, v[b.DarkGrid]), { themeMode: l } = x({ mode: e ?? r ?? void 0 });
24
+ return e || t || ("dark" === l && n ? "dark" : "light");
25
+ }, E = () => {
26
+ const [e] = f(b.Mode, v[b.Mode]), { themeMode: t } = x({ mode: e ?? void 0 });
25
27
  return t;
26
- }, k = d("chart:paint", () => import("./DrFBSp6XMEAjkdoG.mjs")), w = (e, t) => {
28
+ }, M = h("chart:paint", () => import("./C91YeRrspETjFcRc.mjs")), C = (e, t) => {
27
29
  const r = e.getElementType();
28
30
  if ("point" === r) {
29
31
  const r = e.getParent();
@@ -38,28 +40,28 @@ var y = {
38
40
  return n ? t === n || "dataLabel" === t?.getElementType() && t.getParent()?.getParent() === r ? e : n : e;
39
41
  }
40
42
  return e;
41
- }, E = {
43
+ }, P = {
42
44
  boxes: [],
43
45
  handles: []
44
- }, M = t(e((e, t) => {
45
- const { children: d, style: m, chart: p, onChartChange: y, zoom: b = 1, width: x, height: M, selection: P = null, colorScheme: C, onElementPress: D, onPointerDown: L, ...A } = e, [G, S] = s(() => c.isPromiseLike(p) ? null : p), [T, z] = s(null), F = l(y);
46
- F.current = y;
47
- const I = l(null);
48
- n(() => {
46
+ }, D = r(t((e, t) => {
47
+ const { children: r, style: o, chart: h, onChartChange: f, zoom: x = 1, width: b, height: v, selection: k = null, colorScheme: w, onElementPress: D, onPointerDown: L, ...G } = e, [S, A] = a(() => u.isPromiseLike(h) ? null : h), [T, z] = a(null), F = i(f);
48
+ F.current = f;
49
+ const I = i(null);
50
+ l(() => {
49
51
  let e = !0;
50
52
  const t = (e, t) => {
51
- z(t), S(e), I.current !== e && (I.current = e, F.current?.(e));
53
+ z(t), A(e), I.current !== e && (I.current = e, F.current?.(e));
52
54
  };
53
- if (c.isPromiseLike(p)) return p.then((r) => {
55
+ if (u.isPromiseLike(h)) return h.then((r) => {
54
56
  e && t(r, null);
55
57
  }, (r) => {
56
58
  e && t(null, r);
57
59
  }), () => {
58
60
  e = !1;
59
61
  };
60
- t(p, null);
61
- }, [p]);
62
- const [N, $] = h(), B = "number" == typeof x ? x : $.width, R = "number" == typeof M ? M : $.height, j = B ? Math.round(B / b) : 0, V = R ? Math.round(R / b) : 0, X = l({
62
+ t(h, null);
63
+ }, [h]);
64
+ const [N, $] = m(), B = "number" == typeof b ? b : $.width, R = "number" == typeof v ? v : $.height, j = B ? Math.round(B / x) : 0, V = R ? Math.round(R / x) : 0, X = i({
63
65
  width: j,
64
66
  height: V
65
67
  });
@@ -67,14 +69,14 @@ var y = {
67
69
  width: j,
68
70
  height: V
69
71
  };
70
- const Y = v(), q = "dark" === (C ?? Y), H = r(async (e) => {
72
+ const Y = E(), q = "dark" === (w ?? Y), H = n(async (e) => {
71
73
  const t = X.current;
72
- if (!G || !t.width || !t.height) return null;
73
- const r = G.getLayout(t);
74
- return r ? (await k.load()).renderChartToSVG(r, { darkMode: e?.darkMode ?? !1 }) : null;
75
- }, [G]), J = l(null), K = l(null), O = l(b);
76
- O.current = b;
77
- const Q = r((e, t) => {
74
+ if (!S || !t.width || !t.height) return null;
75
+ const r = S.getLayout(t);
76
+ return r ? (await M.load()).renderChartToSVG(r, { darkMode: e?.darkMode ?? !1 }) : null;
77
+ }, [S]), J = i(null), K = i(null), O = i(x);
78
+ O.current = x;
79
+ const Q = n((e, t) => {
78
80
  const r = J.current;
79
81
  if (!r) return null;
80
82
  const n = r.getBoundingClientRect(), o = O.current || 1;
@@ -82,27 +84,27 @@ var y = {
82
84
  x: (e - n.left) / o,
83
85
  y: (t - n.top) / o
84
86
  };
85
- }, []), U = r((e, t) => {
87
+ }, []), U = n((e, t) => {
86
88
  const r = K.current, n = Q(e, t);
87
- return G && r && n ? G.getElementAt(n, r) : null;
88
- }, [G, Q]), W = u(t, () => ({
89
+ return S && r && n ? S.getElementAt(n, r) : null;
90
+ }, [S, Q]), W = g(t, () => ({
89
91
  isChartElement: () => !0,
90
- getChart: () => G,
92
+ getChart: () => S,
91
93
  toSVG: H,
92
94
  getElementAt: U
93
95
  }), [
94
- G,
96
+ S,
95
97
  H,
96
98
  U
97
- ]), Z = f([
99
+ ]), Z = y([
98
100
  W,
99
101
  N,
100
102
  J
101
- ]), _ = l(null), ee = l(null), [te, re] = s(() => k.peek() ?? null), [ne, oe] = s(null), [le, se] = s(0), [ie, ae] = s(E);
102
- n(() => G?.addListeners({ onLayoutChange: () => se((e) => e + 1) }), [G]), g(!(ne || T || te && G)), n(() => {
103
+ ]), _ = i(null), ee = i(null), [te, re] = a(() => M.peek() ?? null), [ne, oe] = a(null), [le, se] = a(0), [ie, ae] = a(P);
104
+ l(() => S?.addListeners({ onLayoutChange: () => se((e) => e + 1) }), [S]), p(!(ne || T || te && S)), l(() => {
103
105
  if (te) return;
104
106
  let e = !0;
105
- return k.load().then((t) => {
107
+ return M.load().then((t) => {
106
108
  e && re(t);
107
109
  }, (t) => {
108
110
  e && oe(t);
@@ -110,9 +112,9 @@ var y = {
110
112
  e = !1;
111
113
  };
112
114
  }, [te]);
113
- const ce = r(() => {
115
+ const ce = n(() => {
114
116
  const e = K.current;
115
- ae(G && e && P && !P.isEmpty() ? ((e, t, r) => {
117
+ ae(S && e && k && !k.isEmpty() ? ((e, t, r) => {
116
118
  const n = [], o = [];
117
119
  for (const l of r.getItems()) {
118
120
  if (l.getChart() !== e) continue;
@@ -146,12 +148,12 @@ var y = {
146
148
  boxes: n,
147
149
  handles: o
148
150
  };
149
- })(G, e, P) : E);
150
- }, [G, P]);
151
- n(() => P?.addListeners({ onChange: ce }), [P, ce]), o(() => {
151
+ })(S, e, k) : P);
152
+ }, [S, k]);
153
+ l(() => k?.addListeners({ onChange: ce }), [k, ce]), s(() => {
152
154
  const e = _.current;
153
- if (!(te && e && G && j && V)) return;
154
- const t = G.getLayout({
155
+ if (!(te && e && S && j && V)) return;
156
+ const t = S.getLayout({
155
157
  width: j,
156
158
  height: V
157
159
  });
@@ -165,50 +167,50 @@ var y = {
165
167
  ee.current ? ee.current.update(t, n) : ee.current = te.mountChart(e, t, n), ce();
166
168
  }, [
167
169
  te,
168
- G,
170
+ S,
169
171
  j,
170
172
  V,
171
173
  le,
172
174
  q,
173
175
  ce
174
- ]), n(() => () => {
176
+ ]), l(() => () => {
175
177
  ee.current?.dispose(), ee.current = null, K.current = null;
176
- }, [G]);
177
- const de = r((e) => {
178
+ }, [S]);
179
+ const de = n((e) => {
178
180
  if (L?.(e), 0 !== e.button && 2 !== e.button) return;
179
181
  const t = K.current, r = Q(e.clientX, e.clientY);
180
- if (!G || !t || !r) return;
181
- const n = G.getElementAt(r, t);
182
+ if (!S || !t || !r) return;
183
+ const n = S.getElementAt(r, t);
182
184
  if (D?.({
183
185
  element: n,
184
186
  point: r,
185
187
  event: e
186
- }), !P) return;
187
- if (!n || "chartArea" === n.getElementType()) return void P.clear();
188
- const o = w(n, P.getActive());
189
- P.isSelected(o) && 1 === P.getItems().length || P.select([o]);
188
+ }), !k) return;
189
+ if (!n || "chartArea" === n.getElementType()) return void k.clear();
190
+ const o = C(n, k.getActive());
191
+ k.isSelected(o) && 1 === k.getItems().length || k.select([o]);
190
192
  }, [
191
- G,
192
- P,
193
+ S,
194
+ k,
193
195
  D,
194
196
  L,
195
197
  Q
196
198
  ]);
197
- if (G?.isDeleted()) return;
199
+ if (S?.isDeleted()) return;
198
200
  const ue = ne ?? T;
199
- return a("div", {
200
- ...A,
201
+ return d("div", {
202
+ ...G,
201
203
  onPointerDown: de,
202
204
  style: {
203
- ...void 0 !== x ? { width: x } : {},
204
- ...void 0 !== M ? { height: M } : {},
205
- ...m,
205
+ ...void 0 !== b ? { width: b } : {},
206
+ ...void 0 !== v ? { height: v } : {},
207
+ ...o,
206
208
  overflow: "hidden"
207
209
  },
208
210
  ref: Z,
209
211
  children: [
210
- ue ? i("div", {
211
- className: "chart-element-error",
212
+ ue ? c("div", {
213
+ className: "sxl-chart-element-error",
212
214
  style: {
213
215
  padding: "8px",
214
216
  fontSize: "12px",
@@ -216,28 +218,28 @@ var y = {
216
218
  },
217
219
  children: ue.message
218
220
  }) : null,
219
- i("div", {
220
- className: "chart-element",
221
+ c("div", {
222
+ className: "sxl-chart-element",
221
223
  ref: _,
222
224
  style: {
223
225
  width: j || "100%",
224
226
  height: V || "100%",
225
- zoom: b,
227
+ zoom: x,
226
228
  position: "relative"
227
229
  }
228
230
  }),
229
- ie.boxes.length > 0 ? a("div", {
230
- className: "chart-element-selection",
231
+ ie.boxes.length > 0 ? d("div", {
232
+ className: "sxl-chart-element-selection",
231
233
  style: {
232
234
  position: "absolute",
233
235
  left: 0,
234
236
  top: 0,
235
237
  width: j,
236
238
  height: V,
237
- zoom: b,
239
+ zoom: x,
238
240
  pointerEvents: "none"
239
241
  },
240
- children: [ie.boxes.map((e, t) => i("div", { style: {
242
+ children: [ie.boxes.map((e, t) => c("div", { style: {
241
243
  position: "absolute",
242
244
  left: e.x - 1,
243
245
  top: e.y - 1,
@@ -245,7 +247,7 @@ var y = {
245
247
  height: Math.max(0, e.height),
246
248
  border: "1px solid var(--sxl-color-primary, #1a73e8)",
247
249
  boxSizing: "content-box"
248
- } }, `box-${t}`)), ie.handles.map((e, t) => i("div", { style: {
250
+ } }, `box-${t}`)), ie.handles.map((e, t) => c("div", { style: {
249
251
  position: "absolute",
250
252
  left: e.x - 3,
251
253
  top: e.y - 3,
@@ -259,5 +261,5 @@ var y = {
259
261
  ]
260
262
  });
261
263
  }));
262
- M.displayName = "ChartElement";
263
- export { b as a, x as i, w as n, y as o, v as r, M as t };
264
+ D.displayName = "ChartElement";
265
+ export { k as a, w as i, C as n, v as o, E as r, b as s, D as t };