@sheetxl/react 0.7.17 → 0.7.19

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,7 +1,7 @@
1
1
  import * as On from "react";
2
2
  import { forwardRef as ua, useRef as ca, useImperativeHandle as la, useEffect as fa, createElement as yr } from "react";
3
3
  /**
4
- * @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.7.17
4
+ * @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.7.19
5
5
  *
6
6
  * (C) 2025-present SheetXL Inc. & Michael T. Ford
7
7
  * License: The license can be found at https://www.sheetxl.com/license.
@@ -1,6 +1,6 @@
1
1
  import x, { memo as ce, useState as q, useRef as h, useCallback as ie, useEffect as M } from "react";
2
2
  /**
3
- * @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.7.17
3
+ * @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.7.19
4
4
  *
5
5
  * (C) 2025-present SheetXL Inc. & Michael T. Ford
6
6
  * License: The license can be found at https://www.sheetxl.com/license.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.7.17
2
+ * @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.7.19
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.
@@ -9,7 +9,7 @@ import Qe, { memo as ht, useMemo as we, useState as ve, forwardRef as yt, useRef
9
9
  import { STANDARD_KEY_CHARS as yl, useSelection as ri, useHeaderSelection as bl, HeaderRenderer as Cl, Grid as ii, HeaderDivider as ql, SELECTION_CLIP_INSETS as Ko, defaultSelectionRenderer as Sl, useKeyboardEditorOverlay as xl, Selection as li, SVGLine as lo } from "@sheetxl/grid-react";
10
10
  import { unstable_batchedUpdates as Ln, createPortal as ai } from "react-dom";
11
11
  /**
12
- * @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.7.17
12
+ * @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.7.19
13
13
  *
14
14
  * (C) 2025-present SheetXL Inc. & Michael T. Ford
15
15
  * License: The license can be found at https://www.sheetxl.com/license.
@@ -899,7 +899,7 @@ function jl(e) {
899
899
  be(() => {
900
900
  k.current = t, ge();
901
901
  }, [t]);
902
- const B = ee(() => t.getRange(w).getCell(), [t, w]), E = ee(async (s, p, q = null, a = !1, y = !0) => {
902
+ const B = ee(() => t.getSelectedCell(), [t]), E = ee(async (s, p, q = null, a = !1, y = !0) => {
903
903
  const T = s?.label?.(), re = async () => {
904
904
  const ae = await Promise.resolve(y && l.showBusy(T ?? "Busy..."));
905
905
  try {
@@ -2368,7 +2368,7 @@ The content is not applied.`, icon: "PasteFormats" }), new Z("pasteFormulas", h,
2368
2368
  _e.current = !0;
2369
2369
  const Q = Qe.lazy(async () => {
2370
2370
  try {
2371
- const Ie = await import("./C7_G_J7Udg3rnAvi.mjs");
2371
+ const Ie = await import("./BfpgwUZO0tjFAtn7.mjs");
2372
2372
  return _e.current = !1, g.current = !0, D([...h]), Ie;
2373
2373
  } catch (Ie) {
2374
2374
  return console.warn(Ie), He.current?.(!1), null;
@@ -4597,8 +4597,8 @@ const Nc = (e) => {
4597
4597
  }, Lc = () => {
4598
4598
  const e = en(ur), [t] = ve(() => new il());
4599
4599
  return we(() => e || t, [e]);
4600
- }, _s = "_script-editor_iy654_5", Gs = { lightbulb: { enabled: !1 }, tabSize: 2, acceptSuggestionOnCommitCharacter: !0, acceptSuggestionOnEnter: "on", accessibilitySupport: "auto", automaticLayout: !0, autoIndent: !1, codeLens: !0, colorDecorators: !0, contextmenu: !0, cursorBlinking: "blink", cursorSmoothCaretAnimation: !1, cursorStyle: "line", disableLayerHinting: !1, disableMonospaceOptimizations: !1, dragAndDrop: !0, glyphMargin: !0, fixedOverflowWidgets: !1, folding: !0, foldingStrategy: "auto", fontLigatures: !1, formatOnPaste: !0, formatOnType: !1, hideCursorInOverviewRuler: !1, highlightActiveIndentGuide: !0, links: !0, lineDecorationsWidth: 8, lineNumbersMinChars: 3, mouseWheelZoom: !1, multiCursorMergeOverlapping: !0, multiCursorModifier: "alt", overviewRulerBorder: !0, overviewRulerLanes: 2, quickSuggestions: !0, quickSuggestionsDelay: 100, readOnly: !1, renderControlCharacters: !1, renderFinalNewline: !0, renderIndentGuides: !0, renderLineHighlight: "all", renderWhitespace: "none", revealHorizontalRightPadding: 30, roundedSelection: !0, rulers: [], scrollBeyondLastColumn: 5, scrollBeyondLastLine: !0, selectOnLineNumbers: !0, selectionClipboard: !0, selectionHighlight: !0, showLightbulbIconMode: !1, showFoldingControls: "mouseover", smoothScrolling: !0, suggestOnTriggerCharacters: !0, wordBasedSuggestions: !0, wordSeparators: `~!@#$%^&*()-=+[{]}|;:'",.<>/?`, wordWrap: "off", wordWrapBreakAfterCharacters: " })]?|&,;", wordWrapBreakBeforeCharacters: "{([+", wordWrapBreakObtrusiveCharacters: ".", wordWrapColumn: 80, wordWrapMinified: !0, wrappingIndent: "none" }, Zs = Qe.lazy(() => import("./KVlxPuUTtpuhwoz1.mjs"));
4601
- let Fn, Nn, an = ["define", "require"], Kr = !1, mo = "@0.7.17";
4600
+ }, _s = "_script-editor_iy654_5", Gs = { lightbulb: { enabled: !1 }, tabSize: 2, acceptSuggestionOnCommitCharacter: !0, acceptSuggestionOnEnter: "on", accessibilitySupport: "auto", automaticLayout: !0, autoIndent: !1, codeLens: !0, colorDecorators: !0, contextmenu: !0, cursorBlinking: "blink", cursorSmoothCaretAnimation: !1, cursorStyle: "line", disableLayerHinting: !1, disableMonospaceOptimizations: !1, dragAndDrop: !0, glyphMargin: !0, fixedOverflowWidgets: !1, folding: !0, foldingStrategy: "auto", fontLigatures: !1, formatOnPaste: !0, formatOnType: !1, hideCursorInOverviewRuler: !1, highlightActiveIndentGuide: !0, links: !0, lineDecorationsWidth: 8, lineNumbersMinChars: 3, mouseWheelZoom: !1, multiCursorMergeOverlapping: !0, multiCursorModifier: "alt", overviewRulerBorder: !0, overviewRulerLanes: 2, quickSuggestions: !0, quickSuggestionsDelay: 100, readOnly: !1, renderControlCharacters: !1, renderFinalNewline: !0, renderIndentGuides: !0, renderLineHighlight: "all", renderWhitespace: "none", revealHorizontalRightPadding: 30, roundedSelection: !0, rulers: [], scrollBeyondLastColumn: 5, scrollBeyondLastLine: !0, selectOnLineNumbers: !0, selectionClipboard: !0, selectionHighlight: !0, showLightbulbIconMode: !1, showFoldingControls: "mouseover", smoothScrolling: !0, suggestOnTriggerCharacters: !0, wordBasedSuggestions: !0, wordSeparators: `~!@#$%^&*()-=+[{]}|;:'",.<>/?`, wordWrap: "off", wordWrapBreakAfterCharacters: " })]?|&,;", wordWrapBreakBeforeCharacters: "{([+", wordWrapBreakObtrusiveCharacters: ".", wordWrapColumn: 80, wordWrapMinified: !0, wrappingIndent: "none" }, Zs = Qe.lazy(() => import("./ClA06sSv40DOG9dC.mjs"));
4601
+ let Fn, Nn, an = ["define", "require"], Kr = !1, mo = "@0.7.19";
4602
4602
  mo !== "@local" && mo !== "@0.0.0" || (mo = "");
4603
4603
  const js = `https://cdn.jsdelivr.net/npm/@sheetxl/sdk${mo}/types/scripting.d.ts`, Yr = async (e, t, n) => {
4604
4604
  const r = e.getModel();
@@ -4795,7 +4795,7 @@ const Pc = ht(yt((e, t) => {
4795
4795
  }, [D]), Oe = ke(null), $e = ee((K, G) => {
4796
4796
  d.current = { monaco: G, editor: K }, E(!0), X("Loading Types");
4797
4797
  const de = h?.getScripts().getModules().getItems()[0]?.getSource() ?? "";
4798
- K.setValue(de), import("./gvTLMpS3g_4xl65x.mjs").then((ye) => ye.c).then(async (ye) => {
4798
+ K.setValue(de), import("./btjXQiR1z4Cuggt_.mjs").then((ye) => ye.c).then(async (ye) => {
4799
4799
  X(""), ye.AutoTypings.create(K, { shareCache: !0, dontAdaptEditorOptions: !0, monaco: G, onUpdate: (H, J) => {
4800
4800
  if (H.type === "LookedUpPackage" && H.success !== void 0) {
4801
4801
  const ce = G.languages.typescript.typescriptDefaults.getDiagnosticsOptions();
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.7.17
2
+ * @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.7.19
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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.7.17
2
+ * @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.7.19
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.
@@ -873,7 +873,7 @@ function Ht(e2) {
873
873
  ce(() => {
874
874
  F2.current = r2, te2();
875
875
  }, [r2]);
876
- const le2 = k(() => r2.getRange(b2).getCell(), [r2, b2]), re2 = k(async (e3, t2, o2 = null, n2 = false, l2 = true) => {
876
+ const le2 = k(() => r2.getSelectedCell(), [r2]), re2 = k(async (e3, t2, o2 = null, n2 = false, l2 = true) => {
877
877
  const a2 = e3?.label?.(), s2 = async () => {
878
878
  const e4 = await Promise.resolve(l2 && y2.showBusy(a2 ?? "Busy..."));
879
879
  try {
@@ -2355,7 +2355,7 @@ const Vt = (e2, t2, o2 = null) => {
2355
2355
  Ce2.current = true;
2356
2356
  const e3 = le.lazy(async () => {
2357
2357
  try {
2358
- const e4 = await import("./D6cQU9kdJEKxqrvE.mjs");
2358
+ const e4 = await import("./DyynNlEdsc5XrmrT.mjs");
2359
2359
  return Ce2.current = false, be2.current = true, S2([...b2]), e4;
2360
2360
  } catch (e4) {
2361
2361
  return console.warn(e4), _2.current?.(false), null;
@@ -3278,7 +3278,7 @@ const qn = (e2) => {
3278
3278
  return ie(() => e2 || t2, [e2]);
3279
3279
  }, Cn = "_script-editor_iy654_5", bn = { 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" }, Sn = le.lazy(() => import("@monaco-editor/react"));
3280
3280
  let xn, kn, Tn = ["define", "require"], Rn = false;
3281
- let Mn = "@0.7.17";
3281
+ let Mn = "@0.7.19";
3282
3282
  "@local" !== Mn && "@0.0.0" !== Mn || (Mn = "");
3283
3283
  const An = `https://cdn.jsdelivr.net/npm/@sheetxl/sdk${Mn}/types/scripting.d.ts`, zn = async (e2, t2, o2) => {
3284
3284
  const n2 = e2.getModel();
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.7.17",
4
+ "version": "0.7.19",
5
5
  "license": "SEE LICENSE IN <LICENSE>",
6
6
  "type": "module",
7
7
  "exports": {
@@ -49,10 +49,10 @@
49
49
  "@dnd-kit/sortable": "^10.0.0",
50
50
  "@dnd-kit/utilities": "^3.2.2",
51
51
  "@monaco-editor/react": "^4.6.0",
52
- "@sheetxl/grid-react": "^0.7.17",
53
- "@sheetxl/sdk": "^0.7.17",
54
- "@sheetxl/utils": "^0.7.17",
55
- "@sheetxl/utils-react": "^0.7.17",
52
+ "@sheetxl/grid-react": "^0.7.19",
53
+ "@sheetxl/sdk": "^0.7.19",
54
+ "@sheetxl/utils": "^0.7.19",
55
+ "@sheetxl/utils-react": "^0.7.19",
56
56
  "clsx": "^2.1.1",
57
57
  "monaco-editor-auto-typings": "^0.4.6",
58
58
  "react-merge-refs": "^3.0.2",
package/types/index.d.ts CHANGED
@@ -1644,21 +1644,47 @@ export declare const useBordersOverlay: ({ getBorderAt, borderRenderer, getVisib
1644
1644
  export declare const useDocThemes: () => IThemeCollection;
1645
1645
 
1646
1646
  /**
1647
- * React hook that subscribes IModel.addListeners.
1648
- * This also ensures that it a listener object is passed in that was dynamically recreated it will
1649
- * not deregister on each render.
1647
+ * React hook for subscribing to model-level events (workbooks, sheets, etc.).
1650
1648
  *
1651
- * @param source
1652
- * @param listeners
1649
+ * @template SOURCE - The model type (e.g., IWorkbook, ISheet)
1650
+ * @template EVENTS - The listener interface type (e.g., ISheet.IListeners)
1651
+ *
1652
+ * @param source - The model instance to listen to
1653
+ * @param listeners - Object containing listener callbacks for various events
1654
+ * @param options - Optional configuration
1653
1655
  *
1654
1656
  * @remarks
1655
- * **IMPORTANT** This assumes that while the listeners object may change the shape does not.
1657
+ * This hook automatically manages the listener lifecycle:
1658
+ * - Subscribes when the component mounts or `source` changes
1659
+ * - Unsubscribes when the component unmounts or `source` changes
1660
+ * - Prevents unnecessary re-subscriptions when the `listeners` object reference changes
1661
+ * (as long as the shape/keys remain consistent)
1662
+ *
1663
+ * By default (`fireOnModelChange: true`), all listeners are called once immediately
1664
+ * on mount with the current source state, allowing you to initialize component state
1665
+ * based on the model's current values.
1666
+ *
1667
+ * @example
1668
+ * ```tsx
1669
+ * function SheetComponent({ sheet }: { sheet: ISheet }) {
1670
+ * useModelListener<ISheet, ISheet.IListeners>(sheet, {
1671
+ * onSave(source, json) {
1672
+ * console.log('Sheet saved:', json);
1673
+ * },
1674
+ * });
1675
+ *
1676
+ * return <div>Sheet: {sheet.getName()}</div>;
1677
+ * }
1678
+ * ```
1656
1679
  */
1657
1680
  export declare const useModelListener: <SOURCE, EVENTS>(source: IListener.ISource<SOURCE>, listeners: IListener.Callbacks<SOURCE, EVENTS>, options?: useModelListenerOptions) => void;
1658
1681
 
1659
1682
  export declare interface useModelListenerOptions extends IListener.Options {
1660
1683
  /**
1661
- * Will also fire the listener when the model changes. (with a null event)
1684
+ * If `true` (default), fires all listeners once immediately when the component mounts
1685
+ * or when the source changes, allowing initialization based on current model state.
1686
+ *
1687
+ * @defaultValue true
1662
1688
  */
1663
1689
  fireOnModelChange?: boolean;
1664
1690
  }
@@ -1691,7 +1717,8 @@ export declare interface useMovableCommandsOptions {
1691
1717
  }
1692
1718
 
1693
1719
  /**
1694
- * This hook delegates to the model getRange(address).addListener.
1720
+ * This hook delegates to the an model that contains a getRange(address) method.
1721
+ *
1695
1722
  * @param model
1696
1723
  * @param listener
1697
1724
  */