@sheetxl/react 0.6.8 → 0.6.10

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.6.8
2
+ * @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.6.10
3
3
  *
4
4
  * (C) 2025-present SheetXL Inc. & Michael T. Ford
5
5
  * License: The license can be found at https://www.sheetxl.com/license.
@@ -1054,8 +1054,8 @@ Continue?`, options: ["Convert", "Cancel"], defaultOption: "Convert" })) return;
1054
1054
  }), new R("formatNumberFormatDecreaseDecimal", p2, { label: "Decrease Decimal", description: "Show few decimal places." }, function() {
1055
1055
  Q2(this, (e3) => ({ numberFormat: t.Parser.adjustDecimalPlaces(e3.getNumberFormat(), -1) }));
1056
1056
  }), new R("displayPlaceholdersToggle", p2, { label: "Display Placeholders", description: "Switch between hiding objects, displaying objects, and displaying placeholders for objects.", shortcut: { key: "6", modifiers: [M.Ctrl] } }), new k("noOp", p2, { label: "Do nothing", description: "Do Nothing.", shortcut: { key: "7", modifiers: [M.Ctrl] } }, function() {
1057
- }), new R("displayOutlineSymbolsToggle", p2, { label: "Display Outline Symbols", description: "Display or hide the outline symbols.", shortcut: { key: "8", modifiers: [M.Ctrl] } }), new R("hideRows", p2, { label: "Hide Rows", description: "Hide the rows.", shortcut: { key: "9", modifiers: [M.Ctrl] } }), new R("unhideRows", p2, { label: "Unhide Rows", description: "Unhide the rows.", shortcut: { key: "(", modifiers: [M.Ctrl, M.Shift] } }), new R("hideColumns", p2, { label: "Hide Columns", description: "Hide the columns.", shortcut: [{ key: "0", modifiers: [M.Ctrl] }, { key: "0", modifiers: [M.Ctrl, M.Alt] }] }), new R("unhideColumns", p2, { label: "Unhide Columns", description: "Unhide the columns.", shortcut: { key: ")", modifiers: [M.Ctrl, M.Shift] } }), new k("calculate", p2, { label: "Calculate Sheet", description: "Recalculate the formulas on the current sheet.", shortcut: { key: "=", modifiers: [M.Ctrl] } }), new R("insertFunction", p2, { label: "Insert Function", disabled: true, scopedLabels: { insert: "Function", insertFunction: "More Functions..." }, description: "Work with the function in the current cell.", shortcut: { key: "F3", modifiers: [M.Shift] } }, function(e3, t2) {
1058
- console.log("insertFunction");
1057
+ }), new R("displayOutlineSymbolsToggle", p2, { label: "Display Outline Symbols", description: "Display or hide the outline symbols.", shortcut: { key: "8", modifiers: [M.Ctrl] } }), new R("hideRows", p2, { label: "Hide Rows", description: "Hide the rows.", shortcut: { key: "9", modifiers: [M.Ctrl] } }), new R("unhideRows", p2, { label: "Unhide Rows", description: "Unhide the rows.", shortcut: { key: "(", modifiers: [M.Ctrl, M.Shift] } }), new R("hideColumns", p2, { label: "Hide Columns", description: "Hide the columns.", shortcut: [{ key: "0", modifiers: [M.Ctrl] }, { key: "0", modifiers: [M.Ctrl, M.Alt] }] }), new R("unhideColumns", p2, { label: "Unhide Columns", description: "Unhide the columns.", shortcut: { key: ")", modifiers: [M.Ctrl, M.Shift] } }), new k("calculate", p2, { label: "Calculate Sheet", description: "Recalculate the formulas on the current sheet.", shortcut: { key: "=", modifiers: [M.Ctrl] } }), new R("insertFunction", p2, { label: "Insert Function", disabled: true, scopedLabels: { insert: "Function", insertFunction: "More Functions..." }, description: "Work with the function in the current cell.", shortcut: { key: "F3", modifiers: [M.Shift] } }, function(e3) {
1058
+ e3 && me2(this, e3.getName());
1059
1059
  }), new R("insertFunctionSum", p2, { label: "Quick Sum", scopedLabels: { insertFunction: "Sum" }, description: "Quick sum of the cells.", shortcut: { key: "=", modifiers: [M.Alt] } }, function() {
1060
1060
  me2(this, "SUM");
1061
1061
  }), new R("insertFunctionAverage", p2, { label: "Quick Average", scopedLabels: { insertFunction: "Average" }, description: "Quick average of the cells." }, function() {
@@ -2054,7 +2054,7 @@ const Rt = (e2, t2, o2 = null) => {
2054
2054
  v2 && !S2?.current?.contains(e3.relatedTarget) && y2(null), e3.relatedTarget && b2(false);
2055
2055
  }, ...f2, children: x2 });
2056
2056
  })), Kt = "_movable-area_314c6_5", Xt = ee(ne((e2, t2) => {
2057
- const { view: o2, movables: n2, movablesView: l2, renderMovable: r2, transactional: i2, onUnFocus: a2, onFocus: s2, disabled: d2 = false, disableDrag: c2 = false, disableResize: g2 = false, className: u2, style: h2, renderDirections: m2 = ["nw", "n", "ne", "w", "e", "sw", "s", "se"], onFirstRender: p2, ...f2 } = e2, q2 = o2.getBounds(), v2 = S(p2, [p2]), y2 = S(a2, [a2]), C2 = S(s2, [s2]), [k2, R2] = oe([]), [M2, T2] = oe(false), [A2, z2] = oe(false), F2 = le(true), E2 = le(/* @__PURE__ */ new Map()), D2 = le(/* @__PURE__ */ new Map()), I2 = le(/* @__PURE__ */ new Map()), N2 = le(/* @__PURE__ */ new Map()), V2 = le(/* @__PURE__ */ new Map()), L2 = le({ onRequestFocus: (e3) => (ge2(e3), null) }), H2 = le(null), B2 = le(null), O2 = le(null), [P2, $2] = se((e3) => e3 + 1, 0);
2057
+ const { view: o2, movables: n2, movablesView: l2, renderMovable: r2, transactional: i2, onUnFocus: a2, onFocus: s2, disabled: d2 = false, disableDrag: c2 = false, disableResize: g2 = false, className: u2, style: h2, renderDirections: m2 = ["nw", "n", "ne", "w", "e", "sw", "s", "se"], onFirstRender: p2, ...f2 } = e2, q2 = o2.getBounds(), v2 = S(p2, [p2]), y2 = S(a2, [a2]), C2 = S(s2, [s2]), [k2, R2] = oe([]), [M2, T2] = oe(false), [A2, z2] = oe(false), F2 = le(true), E2 = le(/* @__PURE__ */ new Map()), D2 = le(/* @__PURE__ */ new Map()), I2 = le(/* @__PURE__ */ new Map()), N2 = le(/* @__PURE__ */ new Map()), V2 = le(/* @__PURE__ */ new Map()), L2 = le({ onRequestFocus: (e3) => (ue2(e3), null) }), H2 = le(null), B2 = le(null), O2 = le(null), [P2, $2] = se((e3) => e3 + 1, 0);
2058
2058
  ie(() => {
2059
2059
  $2();
2060
2060
  }, [o2, n2]), Ct(n2, { onCollectionChange: () => {
@@ -2087,25 +2087,25 @@ const Rt = (e2, t2, o2 = null) => {
2087
2087
  if (!n3) return;
2088
2088
  -1 !== t3.indexOf(o3) && e3.push(n3);
2089
2089
  }), R2((t4) => K.isEqualArrays(t4, e3) ? t4 : e3);
2090
- }, _2 = le(null), j2 = te(() => new Promise((e3) => {
2090
+ }, _2 = le(null), j2 = le(null), X2 = te(() => (j2.current || (j2.current = new Promise((e3) => {
2091
2091
  _2.current = e3;
2092
- }), []), X2 = le(null), Y2 = S(async (e3, t3) => {
2093
- X2.current = t3;
2094
- await (async () => !(!await j2.then() || !O2.current))() && X2.current === t3 && O2.current.dragStart(e3, t3);
2095
- }, [k2]), [J2, ee2] = oe(false), ne2 = le(null), ce2 = le(null), ge2 = S(async (e3 = null) => {
2092
+ })), j2.current), []), Y2 = le(null), J2 = S(async (e3, t3) => {
2093
+ Y2.current = t3;
2094
+ await (async () => !(!await X2.then() || !O2.current))() && Y2.current === t3 && O2.current.dragStart(e3, t3);
2095
+ }, [k2]), [ee2, ne2] = oe(false), ce2 = le(null), ge2 = le(null), ue2 = S(async (e3 = null) => {
2096
2096
  if (e3 || (e3 = l2.getMovableSelection()[0]), !e3) return y2?.(), false;
2097
2097
  const t3 = I2.current.get(e3);
2098
- t3 ? (await K.whenFocus(t3), t3.focus(), ce2.current = t3, ne2.current = null) : ne2.current = e3;
2098
+ t3 ? (await K.whenFocus(t3), t3.focus(), ge2.current = t3, ce2.current = null) : ce2.current = e3;
2099
2099
  }, [l2]);
2100
2100
  re(() => {
2101
- J2 && k2.length > 0 && ce2.current !== k2[0] && ge2(), F2.current && (v2?.(), F2.current = false);
2101
+ ee2 && k2.length > 0 && ge2.current !== k2[0] && ue2(), F2.current && (v2?.(), F2.current = false);
2102
2102
  }, [k2]);
2103
- const ue2 = te(() => {
2103
+ const he2 = te(() => {
2104
2104
  const e3 = n2.getItems({ address: o2.getVisibleRangeCoords(), excludeHidden: true });
2105
2105
  if (0 === e3.length && 0 === E2.current.size) return null;
2106
2106
  const t3 = (t4, n3, l3, i4 = true) => {
2107
2107
  const a4 = t4.isSelected(), s4 = { tabIndex: l3, view: o2, movable: t4, onRefLoad: (e4) => {
2108
- ne2.current === t4 && (e4.focus(), ce2.current = e4, ne2.current = null), I2.current.set(t4, e4), D2.current.set(e4, t4), n3.rendered = true, U2();
2108
+ ce2.current === t4 && (e4.focus(), ge2.current = e4, ce2.current = null), I2.current.set(t4, e4), D2.current.set(e4, t4), n3.rendered = true, U2();
2109
2109
  }, onRefUnload: (e4) => {
2110
2110
  I2.current.delete(t4), D2.current.delete(e4), n3.rendered = false, U2();
2111
2111
  }, onUnFocus: y2, onHide: (e4) => {
@@ -2114,13 +2114,13 @@ const Rt = (e2, t2, o2 = null) => {
2114
2114
  n3.onShow = e4;
2115
2115
  }, isDragging: a4 && (A2 || M2), disabled: d2, renderMovable: r2, updateFrameBounds: (e4) => {
2116
2116
  W2(t4, e4);
2117
- }, dragStart: Y2, onMouseUp: () => {
2118
- if (X2.current = null, B2.current) {
2117
+ }, dragStart: J2, onMouseUp: () => {
2118
+ if (Y2.current = null, B2.current) {
2119
2119
  T2(false), z2(false);
2120
2120
  let e4 = false;
2121
2121
  N2.current?.forEach((t5) => {
2122
2122
  K.isEqualBounds(t5.movable.getBounds(), t5.startBounds) || (e4 = true);
2123
- }), e4 ? me2() : pe2();
2123
+ }), e4 ? pe2() : fe2();
2124
2124
  }
2125
2125
  }, style: { opacity: i4 ? M2 && a4 ? 0.7 : void 0 : 0, zIndex: M2 && a4 ? t4.getZIndex() + e3.length : void 0, pointerEvents: i4 ? void 0 : "none", cursor: A2 && a4 ? "grabbing" : d2 || c2 ? "initial" : "move", boxShadow: !a4 || A2 && !M2 ? void 0 : "1px 1px 2px 2px rgba(0,0,0,.15)" } };
2126
2126
  return G(jt, { ...s4 }, `movable-${t4.getUUID()}`);
@@ -2151,50 +2151,50 @@ const Rt = (e2, t2, o2 = null) => {
2151
2151
  }), i3.forEach((e4, o3) => {
2152
2152
  e4.frame = t3(o3, e4, -1, false), g3.push(e4.frame), e4.doHide(o3, e4), i3.delete(o3), a3.set(o3, e4);
2153
2153
  }), E2.current = a3, U2(), [...g3, ...s3];
2154
- }, [P2, o2, r2, d2, c2, g2, M2, A2]), he2 = S((e3, t3) => {
2154
+ }, [P2, o2, r2, d2, c2, g2, M2, A2]), me2 = S((e3, t3) => {
2155
2155
  const n3 = `${t3} ${1 === k2.length ? w.capitalize(D2.current?.get(k2[0]).getContent().getType()) : "Drawings"}`;
2156
2156
  B2.current && (console.warn(`Transaction ${B2.current.getDescription()} is being replaced by ${n3}`), B2.current.rollback(), B2.current = null), B2.current = i2.beginCommit({ description: n3 }), N2.current.clear();
2157
2157
  for (let e4 = 0; e4 < k2.length; e4++) {
2158
2158
  const t4 = k2[e4], n4 = D2.current?.get(t4);
2159
2159
  n4 ? N2.current.set(t4, { movable: n4, startBounds: o2.toViewBounds(n4.getBounds()) }) : console.warn("invalid element", n4);
2160
2160
  }
2161
- }, [i2, o2, k2]), me2 = ae(() => {
2161
+ }, [i2, o2, k2]), pe2 = ae(() => {
2162
2162
  if (!B2.current) return;
2163
2163
  const e3 = [];
2164
2164
  N2.current?.forEach((t3) => {
2165
2165
  e3.push(t3.movable);
2166
2166
  }), B2.current.commit({ viewAfter: { view: l2, movableSelection: e3 } }), N2.current.clear(), B2.current = null;
2167
- }, []), pe2 = ae(() => {
2167
+ }, []), fe2 = ae(() => {
2168
2168
  B2.current && (B2.current.rollback(), B2.current = null);
2169
- }, []), fe2 = le(null);
2169
+ }, []), we2 = le(null);
2170
2170
  re(() => {
2171
- fe2.current && (fe2.current.onscroll = (e3) => {
2171
+ we2.current && (we2.current.onscroll = (e3) => {
2172
2172
  e3.preventDefault(), e3.srcElement.scrollTop = 0, e3.srcElement.scrollLeft = 0;
2173
2173
  });
2174
- }, [fe2.current]);
2175
- const we2 = b(t2, () => ({ isMovableArea: () => true, focusMovable: ge2, focus: () => {
2176
- ge2();
2177
- } }), [l2]), [qe2, ve2] = oe(null), ye2 = le(false), Ce2 = le(false), be2 = le(false);
2174
+ }, [we2.current]);
2175
+ const qe2 = b(t2, () => ({ isMovableArea: () => true, focusMovable: ue2, focus: () => {
2176
+ ue2();
2177
+ } }), [l2]), [ve2, ye2] = oe(null), Ce2 = le(false), be2 = le(false), Se2 = le(false);
2178
2178
  re(() => {
2179
2179
  if (d2 || 0 === k2.length) return;
2180
- if (be2.current) return;
2181
- if (ye2.current) return;
2182
- if (Ce2.current) return void requestAnimationFrame(() => {
2183
- O2.current && H2.current && O2.current.refTargets.length > 0 && (be2.current = true, _2.current?.(true)), R2([...k2]);
2180
+ if (Se2.current) return;
2181
+ if (Ce2.current) return;
2182
+ if (be2.current) return void requestAnimationFrame(() => {
2183
+ O2.current && H2.current && O2.current.refTargets.length > 0 && (Se2.current = true, _2.current?.(true)), R2([...k2]);
2184
2184
  });
2185
- ye2.current = true;
2185
+ Ce2.current = true;
2186
2186
  const e3 = Q.lazy(async () => {
2187
2187
  try {
2188
- const e4 = await import("./4GvsEqYx_7ldThJ8.mjs");
2189
- return ye2.current = false, Ce2.current = true, R2([...k2]), e4;
2188
+ const e4 = await import("./tO66r1jtg6pC2Pmn.mjs");
2189
+ return Ce2.current = false, be2.current = true, R2([...k2]), e4;
2190
2190
  } catch (e4) {
2191
2191
  return console.warn(e4), _2.current?.(false), null;
2192
2192
  }
2193
2193
  });
2194
- ve2(e3);
2194
+ ye2(e3);
2195
2195
  }, [k2, d2, c2, g2]);
2196
- const Se2 = te(() => !qe2 || d2 ? null : G(de, { children: G(qe2, { className: Me({ dragging: M2 || A2, resizing: M2, moving: A2 }), container: null, ref: O2, target: O2.current ? k2 : [], draggable: !d2 && !c2, resizable: !d2 && !g2, individualGroupable: true, edgeDraggable: false, throttleDrag: 2, throttleResize: 2, origin: false, keepRatio: false, renderDirections: m2, onResizeStart: (e3) => {
2197
- he2(e3.target, "Resize");
2196
+ const xe2 = te(() => !ve2 || d2 ? null : G(de, { children: G(ve2, { className: Me({ dragging: M2 || A2, resizing: M2, moving: A2 }), container: null, ref: O2, target: O2.current ? k2 : [], draggable: !d2 && !c2, resizable: !d2 && !g2, individualGroupable: true, edgeDraggable: false, throttleDrag: 2, throttleResize: 2, origin: false, keepRatio: false, renderDirections: m2, onResizeStart: (e3) => {
2197
+ me2(e3.target, "Resize");
2198
2198
  }, onResize: (e3) => {
2199
2199
  if (!B2.current) return e3.stopDrag(), void $2();
2200
2200
  T2(true);
@@ -2216,9 +2216,9 @@ const Rt = (e2, t2, o2 = null) => {
2216
2216
  -1 === e3.direction[0] && (p3.x = Math.max(0, Math.min(a3.startBounds.x + h3, a3.startBounds.x + h3 - p3.width))), -1 === e3.direction[1] && (p3.y = Math.min(a3.startBounds.y + m3, a3.startBounds.y + m3 - p3.height)), a3.movable.setBounds(o2.toAbsoluteBounds(p3));
2217
2217
  }
2218
2218
  }, onResizeEnd: (e3) => {
2219
- T2(false), me2();
2219
+ T2(false), pe2();
2220
2220
  }, onDragStart: (e3) => {
2221
- he2(e3.target, "Move");
2221
+ me2(e3.target, "Move");
2222
2222
  }, onDrag: (e3) => {
2223
2223
  if (!B2.current) return e3.stopDrag(), void $2();
2224
2224
  z2(true);
@@ -2228,11 +2228,11 @@ const Rt = (e2, t2, o2 = null) => {
2228
2228
  }
2229
2229
  }, onDragEnd: (e3) => {
2230
2230
  }, onMouseUp: (e3) => {
2231
- } }) }), [P2, qe2, k2, o2, d2, c2, g2, M2, A2]);
2232
- return G("div", { className: Me(u2, "movable-area", Kt), style: { width: q2.width, height: q2.height, ...h2, position: "absolute", overflow: "hidden", willChange: "transform" }, ref: ke([we2, fe2]), ...f2, children: G("div", { className: "movable-scroll", style: { position: "absolute", cursor: "initial", left: 0, top: 0, width: q2.width, height: q2.height }, ...f2, children: Z("div", { ref: H2, style: { position: "absolute", pointerEvents: "auto" }, onFocus: (e3) => {
2233
- C2?.(), ee2(true);
2231
+ } }) }), [P2, ve2, k2, o2, d2, c2, g2, M2, A2]);
2232
+ return G("div", { className: Me(u2, "movable-area", Kt), style: { width: q2.width, height: q2.height, ...h2, position: "absolute", overflow: "hidden", willChange: "transform" }, ref: ke([qe2, we2]), ...f2, children: G("div", { className: "movable-scroll", style: { position: "absolute", cursor: "initial", left: 0, top: 0, width: q2.width, height: q2.height }, ...f2, children: Z("div", { ref: H2, style: { position: "absolute", pointerEvents: "auto" }, onFocus: (e3) => {
2233
+ C2?.(), ne2(true);
2234
2234
  }, onBlur: (e3) => {
2235
- ee2(false);
2235
+ ne2(false);
2236
2236
  }, onKeyDownCapture: (e3) => {
2237
2237
  if (e3.isDefaultPrevented()) return;
2238
2238
  const t3 = e3.nativeEvent.ctrlKey, o3 = e3.nativeEvent.altKey, r3 = e3.nativeEvent.shiftKey;
@@ -2273,7 +2273,7 @@ const Rt = (e2, t2, o2 = null) => {
2273
2273
  const t4 = l2.getMovableSelection();
2274
2274
  l2.selectMovables(n2.getItems(), true), l2.selectMovables(t4, true), e3.preventDefault();
2275
2275
  } else "ArrowLeft" === e3.key ? (r3 ? s3(i3, false) : o3 ? a3(-10) : d3({ x: t3 ? -10 : -1 }), e3.preventDefault()) : "ArrowRight" === e3.key ? (r3 ? s3(i3, true) : o3 ? a3(10) : d3({ x: t3 ? 10 : 1 }), e3.preventDefault()) : "ArrowUp" === e3.key ? (r3 ? s3(i3, true) : d3({ y: t3 ? -10 : -1 }), e3.preventDefault()) : "ArrowDown" === e3.key && (r3 ? s3(i3, false) : d3({ y: t3 ? 10 : 1 }), e3.preventDefault());
2276
- }, children: [ue2, Se2] }) }) });
2276
+ }, children: [he2, xe2] }) }) });
2277
2277
  })), Yt = (e2) => {
2278
2278
  let t2 = Number.MAX_SAFE_INTEGER, o2 = Number.MAX_SAFE_INTEGER, n2 = 0, l2 = 0;
2279
2279
  for (let r2 = 0; r2 < e2.length; r2++) {
@@ -3104,8 +3104,8 @@ const sn = (e2) => {
3104
3104
  const e2 = he(an), [t2] = oe(() => new y());
3105
3105
  return te(() => e2 || t2, [e2]);
3106
3106
  }, cn = "_script-editor_iy654_5", gn = Q.lazy(() => import("@monaco-editor/react")), un = { lightbulb: { enabled: false }, tabSize: 2, acceptSuggestionOnCommitCharacter: true, acceptSuggestionOnEnter: "on", accessibilitySupport: "auto", automaticLayout: true, autoIndent: false, codeLens: true, colorDecorators: true, contextmenu: true, cursorBlinking: "blink", cursorSmoothCaretAnimation: false, cursorStyle: "line", disableLayerHinting: false, disableMonospaceOptimizations: false, dragAndDrop: true, glyphMargin: true, fixedOverflowWidgets: false, folding: true, foldingStrategy: "auto", fontLigatures: false, formatOnPaste: true, formatOnType: false, hideCursorInOverviewRuler: false, highlightActiveIndentGuide: true, links: true, lineDecorationsWidth: 8, lineNumbersMinChars: 3, mouseWheelZoom: false, multiCursorMergeOverlapping: true, multiCursorModifier: "alt", overviewRulerBorder: true, overviewRulerLanes: 2, quickSuggestions: true, quickSuggestionsDelay: 100, readOnly: false, renderControlCharacters: false, renderFinalNewline: true, renderIndentGuides: true, renderLineHighlight: "all", renderWhitespace: "none", revealHorizontalRightPadding: 30, roundedSelection: true, rulers: [], scrollBeyondLastColumn: 5, scrollBeyondLastLine: true, selectOnLineNumbers: true, selectionClipboard: true, selectionHighlight: true, showLightbulbIconMode: false, showFoldingControls: "mouseover", smoothScrolling: true, suggestOnTriggerCharacters: true, wordBasedSuggestions: true, wordSeparators: `~!@#$%^&*()-=+[{]}|;:'",.<>/?`, wordWrap: "off", wordWrapBreakAfterCharacters: " })]?|&,;", wordWrapBreakBeforeCharacters: "{([+", wordWrapBreakObtrusiveCharacters: ".", wordWrapColumn: 80, wordWrapMinified: true, wrappingIndent: "none" };
3107
- let hn, mn, pn = ["define", "require"];
3108
- const fn = async (e2, t2, o2) => {
3107
+ let hn, mn, pn = ["define", "require"], fn = false;
3108
+ const wn = async (e2, t2, o2) => {
3109
3109
  const n2 = e2.getModel();
3110
3110
  if (!n2) return;
3111
3111
  const l2 = await t2.languages.typescript.getTypeScriptWorker(), r2 = await l2(n2.uri), i2 = await r2.getNavigationTree(n2.uri.toString()), a2 = e2.getPosition();
@@ -3114,8 +3114,8 @@ const fn = async (e2, t2, o2) => {
3114
3114
  let d2 = false;
3115
3115
  for (let e3 = a2.lineNumber; e3 >= 1; e3--) {
3116
3116
  if ("" === n2.getLineContent(e3).trim()) {
3117
- const t3 = vn(i2, n2.getOffsetAt({ lineNumber: e3, column: 1 }), "function");
3118
- if (!t3 || yn(t3)) {
3117
+ const t3 = yn(i2, n2.getOffsetAt({ lineNumber: e3, column: 1 }), "function");
3118
+ if (!t3 || Cn(t3)) {
3119
3119
  d2 = true, s2.lineNumber = e3 + 1;
3120
3120
  break;
3121
3121
  }
@@ -3133,7 +3133,7 @@ const fn = async (e2, t2, o2) => {
3133
3133
  let m2 = null;
3134
3134
  n2.pushEditOperations([], h2, (e3) => (m2 = e3[0].range, g2 && m2.startLineNumber++, u2 && m2.endLineNumber--, [new t2.Selection(m2.startLineNumber, m2.startColumn, m2.endLineNumber, m2.endColumn)])), e2.setSelection({ startLineNumber: m2.endLineNumber, startColumn: m2.endColumn, endLineNumber: m2.startLineNumber, endColumn: m2.startColumn });
3135
3135
  };
3136
- function wn(e2, t2) {
3136
+ function qn(e2, t2) {
3137
3137
  let o2 = null;
3138
3138
  const n2 = e2.length;
3139
3139
  for (let l2 = 0; !o2 && l2 < n2; l2++) {
@@ -3142,32 +3142,32 @@ function wn(e2, t2) {
3142
3142
  }
3143
3143
  return o2 ? o2.getContext() : "formula";
3144
3144
  }
3145
- function qn(e2, t2, o2, n2, l2 = []) {
3145
+ function vn(e2, t2, o2, n2, l2 = []) {
3146
3146
  if ("function" === n2.kind && "export" === n2.kindModifiers) {
3147
3147
  const t3 = n2.spans[0].start, r2 = e2.getPositionAt(t3);
3148
- l2.push({ name: n2.text, type: wn(o2, n2), lineNumber: r2.lineNumber });
3148
+ l2.push({ name: n2.text, type: qn(o2, n2), lineNumber: r2.lineNumber });
3149
3149
  }
3150
- if (n2.childItems) for (const r2 of n2.childItems) qn(e2, t2, o2, r2, l2);
3150
+ if (n2.childItems) for (const r2 of n2.childItems) vn(e2, t2, o2, r2, l2);
3151
3151
  return l2;
3152
3152
  }
3153
- function vn(e2, t2, o2 = "function", n2) {
3153
+ function yn(e2, t2, o2 = "function", n2) {
3154
3154
  const l2 = e2.spans, r2 = l2.length;
3155
3155
  for (let i2 = 0; i2 < r2; i2++) {
3156
3156
  const r3 = l2[i2];
3157
3157
  if (r3.start <= t2 && t2 < r3.start + r3.length) {
3158
3158
  if (e2.kind === o2 && (!n2 || e2.kindModifiers === n2)) return e2;
3159
3159
  for (const l3 of e2.childItems || []) {
3160
- const e3 = vn(l3, t2, o2, n2);
3160
+ const e3 = yn(l3, t2, o2, n2);
3161
3161
  if (e3) return e3;
3162
3162
  }
3163
3163
  }
3164
3164
  return null;
3165
3165
  }
3166
3166
  }
3167
- function yn(e2) {
3167
+ function Cn(e2) {
3168
3168
  return "comment" === e2.kind;
3169
3169
  }
3170
- const Cn = ee(ne((e2, t2) => {
3170
+ const bn = ee(ne((e2, t2) => {
3171
3171
  const { className: o2, style: n2, commands: l2, readOnly: r2 = false, onClose: i2, darkMode: a2, loadingPanel: s2, autoFocus: d2 = true, onStatusChange: c2, ...g2 } = e2, u2 = le(null), h2 = S(i2, [i2]), m2 = le(false), p2 = te(() => ({ contains(e3) {
3172
3172
  if (!u2.current) return;
3173
3173
  const t3 = u2.current.editor;
@@ -3221,7 +3221,7 @@ const Cn = ee(ne((e2, t2) => {
3221
3221
  let a3 = null, s3 = e4.getSelection();
3222
3222
  const d3 = s3.startLineNumber === s3.endLineNumber && s3.startColumn === s3.endColumn ? n4.getLineCount() : Math.min(s3.endLineNumber, n4.getLineCount());
3223
3223
  for (let e5 = s3.startLineNumber; !a3 && e5 <= d3; e5++) {
3224
- const t5 = vn(i3, n4.getOffsetAt({ lineNumber: e5, column: 1 }), "function", o4);
3224
+ const t5 = yn(i3, n4.getOffsetAt({ lineNumber: e5, column: 1 }), "function", o4);
3225
3225
  t5 && (a3 = t5.text);
3226
3226
  }
3227
3227
  return a3;
@@ -3242,7 +3242,7 @@ const Cn = ee(ne((e2, t2) => {
3242
3242
  t4.editor.setModelMarkers(e4, "owner", o4);
3243
3243
  })(e3, t3);
3244
3244
  !(async function(e4, t4, o4, n4) {
3245
- const l3 = await t4.languages.typescript.getTypeScriptWorker(), r3 = await l3(e4.uri), i3 = await r3.getNavigationTree(e4.uri.toString()), a3 = qn(e4, t4, n4, i3).map((e5) => {
3245
+ const l3 = await t4.languages.typescript.getTypeScriptWorker(), r3 = await l3(e4.uri), i3 = await r3.getNavigationTree(e4.uri.toString()), a3 = vn(e4, t4, n4, i3).map((e5) => {
3246
3246
  let o5 = null, n5 = null;
3247
3247
  return "formula" === e5.type ? (o5 = "formula.margin-icon", n5 = "Formula") : "macro" === e5.type ? (o5 = "macro.margin-icon", n5 = "Macro") : "autoRun" === e5.type && (o5 = "autorun.margin-icon", n5 = "Auto Run"), { range: new t4.Range(e5.lineNumber, 1, e5.lineNumber, 1), options: { isWholeLine: false, glyphMarginClassName: o5, glyphMarginHoverMessage: { value: n5 }, stickiness: t4.editor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges } };
3248
3248
  });
@@ -3263,7 +3263,7 @@ const Cn = ee(ne((e2, t2) => {
3263
3263
  re(() => {
3264
3264
  if (!C2) return;
3265
3265
  const e3 = { insertSnippet: (e4) => {
3266
- u2.current?.editor && fn(u2.current.editor, u2.current.monaco, e4);
3266
+ u2.current?.editor && wn(u2.current.editor, u2.current.monaco, e4);
3267
3267
  }, close: () => $2() };
3268
3268
  C2.setEditor(e3), C2.setSelectedFunction(L2());
3269
3269
  const t3 = C2.addContainerListener({ onBeforeSave: async () => {
@@ -3289,7 +3289,28 @@ const Cn = ee(ne((e2, t2) => {
3289
3289
  const t3 = u2.current?.editor;
3290
3290
  return !!t3 && (t3.focus(e3), true);
3291
3291
  }, [x2]), U2 = le(null), _2 = S((e3, t3) => {
3292
- u2.current = { monaco: t3, editor: e3 }, V2(true), O2("Loading Types");
3292
+ u2.current = { monaco: t3, editor: e3 }, V2(true), (() => {
3293
+ if (fn) return;
3294
+ const e4 = (e5, t5) => {
3295
+ try {
3296
+ if (void 0 === t5) try {
3297
+ delete globalThis[e5];
3298
+ } catch (t6) {
3299
+ try {
3300
+ globalThis[e5] = void 0;
3301
+ } catch (e6) {
3302
+ }
3303
+ }
3304
+ else globalThis[e5] = t5;
3305
+ } catch (e6) {
3306
+ }
3307
+ }, t4 = pn.length;
3308
+ for (let o4 = 0; o4 < t4; o4++) {
3309
+ const t5 = pn[o4];
3310
+ e4(t5, hn[t5]);
3311
+ }
3312
+ hn = void 0, fn = true;
3313
+ })(), O2("Loading Types");
3293
3314
  const o3 = C2.getScripts().getModules().getItems()[0]?.getSource() ?? "";
3294
3315
  e3.setValue(o3), import("monaco-editor-auto-typings/custom-editor.js").then(async (o4) => {
3295
3316
  O2("");
@@ -3316,7 +3337,7 @@ const Cn = ee(ne((e2, t2) => {
3316
3337
  F2();
3317
3338
  } }), e3.onMouseDown(async (e4) => {
3318
3339
  if (e4.target.type === t3.editor.MouseTargetType.GUTTER_GLYPH_MARGIN) {
3319
- const o4 = e4.target.position.lineNumber, l3 = await t3.languages.typescript.getTypeScriptWorker(), r3 = await l3(n3.uri), i3 = await r3.getNavigationTree(n3.uri.toString()), a3 = (await F2()).getFunctions().getItems(), s3 = qn(n3, t3, a3, i3).find((e5) => e5.lineNumber === o4);
3340
+ const o4 = e4.target.position.lineNumber, l3 = await t3.languages.typescript.getTypeScriptWorker(), r3 = await l3(n3.uri), i3 = await r3.getNavigationTree(n3.uri.toString()), a3 = (await F2()).getFunctions().getItems(), s3 = vn(n3, t3, a3, i3).find((e5) => e5.lineNumber === o4);
3320
3341
  if (s3) {
3321
3342
  const t4 = e4.event.browserEvent.button;
3322
3343
  0 === t4 ? "macro" === s3.type || "autoRun" === s3.type ? E2({ functionName: s3.name }) : "formula" === s3.type && C2.quickInsertFunction?.(s3.name) : 2 === t4 && (console.log("Context menu for function:", s3.name), e4.event.browserEvent.preventDefault());
@@ -3416,7 +3437,7 @@ const Cn = ee(ne((e2, t2) => {
3416
3437
  const t4 = e4.languages.typescript.typescriptDefaults.getCompilerOptions();
3417
3438
  e4.languages.typescript.typescriptDefaults.setCompilerOptions({ ...t4, target: e4.languages.typescript.ScriptTarget.ES2020, lib: ["webworker", "es2020", "esnext.asynciterable"], downlevelIteration: true, moduleResolution: e4.languages.typescript.ModuleResolutionKind.NodeJs, allowSyntheticDefaultImports: true, baseUrl: "inmemory://model/", allowNonTsExtensions: true });
3418
3439
  }
3419
- if (I2.current && (await fn(u2.current.editor, u2.current.monaco, I2.current), I2.current = null), m2.current && requestAnimationFrame(async () => {
3440
+ if (I2.current && (await wn(u2.current.editor, u2.current.monaco, I2.current), I2.current = null), m2.current && requestAnimationFrame(async () => {
3420
3441
  m2.current && e4.editor.focus();
3421
3442
  }), !mn) {
3422
3443
  mn = {};
@@ -3426,27 +3447,6 @@ const Cn = ee(ne((e2, t2) => {
3426
3447
  mn[e6] = globalThis[e6];
3427
3448
  }
3428
3449
  }
3429
- (() => {
3430
- const e5 = (e6, t5) => {
3431
- try {
3432
- if (void 0 === t5) try {
3433
- delete globalThis[e6];
3434
- } catch (t6) {
3435
- try {
3436
- globalThis[e6] = void 0;
3437
- } catch (e7) {
3438
- }
3439
- }
3440
- else globalThis[e6] = t5;
3441
- } catch (e7) {
3442
- }
3443
- }, t4 = pn.length;
3444
- for (let o4 = 0; o4 < t4; o4++) {
3445
- const t5 = pn[o4];
3446
- e5(t5, hn[t5]);
3447
- }
3448
- hn = void 0;
3449
- })(), V2(true);
3450
3450
  })();
3451
3451
  }, onMount: _2 }) }), j2] });
3452
3452
  }, [C2, w2, r2, j2, a2]), Y2 = b(t2, () => ({ isScriptEditorElement: () => true, focus: (e3) => {
@@ -3502,7 +3502,7 @@ export {
3502
3502
  Xt as MovableArea,
3503
3503
  wo as PictureEditor,
3504
3504
  Ro as Row,
3505
- Cn as ScriptEditor,
3505
+ bn as ScriptEditor,
3506
3506
  lt as SheetCellEditor,
3507
3507
  et as SheetCellRenderer,
3508
3508
  mo as SheetElement,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.6.8
2
+ * @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.6.10
3
3
  *
4
4
  * (C) 2025-present SheetXL Inc. & Michael T. Ford
5
5
  * License: The license can be found at https://www.sheetxl.com/license.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sheetxl/react",
3
3
  "description": "React - React components needed to build advanced grid and spreadsheet UIs.",
4
- "version": "0.6.8",
4
+ "version": "0.6.10",
5
5
  "license": "SEE LICENSE IN <LICENSE>",
6
6
  "type": "module",
7
7
  "exports": {
@@ -37,10 +37,10 @@
37
37
  "@dnd-kit/sortable": "^10.0.0",
38
38
  "@dnd-kit/utilities": "^3.2.2",
39
39
  "@monaco-editor/react": "^4.6.0",
40
- "@sheetxl/grid-react": "^0.6.8",
41
- "@sheetxl/sdk": "^0.6.8",
42
- "@sheetxl/utils": "^0.6.8",
43
- "@sheetxl/utils-react": "^0.6.8",
40
+ "@sheetxl/grid-react": "^0.6.10",
41
+ "@sheetxl/sdk": "^0.6.10",
42
+ "@sheetxl/utils": "^0.6.10",
43
+ "@sheetxl/utils-react": "^0.6.10",
44
44
  "clsx": "^2.1.1",
45
45
  "monaco-editor-auto-typings": "^0.4.6",
46
46
  "react-merge-refs": "^3.0.2",