@sheetxl/react 0.6.16 → 0.6.18

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.16
2
+ * @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.6.18
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.6.16
2
+ * @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.6.18
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.
@@ -741,7 +741,7 @@ function xt(e2) {
741
741
  return g2();
742
742
  }, [r2, i2, f2]), Q2 = S((e3, t2, o2 = false, n2) => Y2(e3, (e4) => {
743
743
  const l2 = e4.getSelectedRanges();
744
- o2 && l2.updateStyle(null, n2), l2.updateStyle(t2, n2), l2.autoFit({ expandOnly: s.Orientation.Column, minContent: true, skipCustomSize: true });
744
+ o2 && l2.getStyle().update(null, n2), l2.getStyle().update(t2, n2), l2.autoFit({ expandOnly: s.Orientation.Column, minContent: true, skipCustomSize: true });
745
745
  }), [r2]), ee2 = S((e3, t2, o2) => {
746
746
  Y2(e3, (e4) => {
747
747
  let n2 = t2;
@@ -1466,7 +1466,7 @@ Continue?`, options: ["Convert", "Cancel"], defaultOption: "Convert" })) return;
1466
1466
  const t4 = o3.getSelectedRanges();
1467
1467
  if (t4.merge({ orientations: e4, discardMultipleValues: n4 }), e4 === s.Orientations.Both) {
1468
1468
  const e5 = { alignment: { horizontal: l.HorizontalAlignment.Center } };
1469
- t4.updateStyle(e5);
1469
+ t4.getStyle().update(e5);
1470
1470
  }
1471
1471
  } catch (e5) {
1472
1472
  throw e5;
@@ -1492,7 +1492,7 @@ Continue?`, options: ["Convert", "Cancel"], defaultOption: "Convert" })) return;
1492
1492
  const t3 = e5.getSelectedRanges();
1493
1493
  t3.unmerge();
1494
1494
  const o3 = { alignment: { horizontal: null } };
1495
- t3.updateStyle(o3);
1495
+ t3.getStyle().update(o3);
1496
1496
  } catch (e6) {
1497
1497
  throw e6;
1498
1498
  }
@@ -2185,7 +2185,7 @@ const Rt = (e2, t2, o2 = null) => {
2185
2185
  Ce2.current = true;
2186
2186
  const e3 = Q.lazy(async () => {
2187
2187
  try {
2188
- const e4 = await import("./o_uHh5YJmhI3MMQ3.mjs");
2188
+ const e4 = await import("./C6ZIlg3sg-bFT1k4.mjs");
2189
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;
@@ -3109,7 +3109,9 @@ const sn = (e2) => {
3109
3109
  return te(() => e2 || t2, [e2]);
3110
3110
  }, 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" };
3111
3111
  let hn, mn, pn = ["define", "require"], fn = false;
3112
- const wn = async (e2, t2, o2) => {
3112
+ const wn = "https://cdn.jsdelivr.net/npm/@sheetxl/sdk@0.6.18/types/scripting.d.ts";
3113
+ console.log("loading", wn);
3114
+ const qn = wn, vn = async (e2, t2, o2) => {
3113
3115
  const n2 = e2.getModel();
3114
3116
  if (!n2) return;
3115
3117
  const l2 = await t2.languages.typescript.getTypeScriptWorker(), r2 = await l2(n2.uri), i2 = await r2.getNavigationTree(n2.uri.toString()), a2 = e2.getPosition();
@@ -3118,8 +3120,8 @@ const wn = async (e2, t2, o2) => {
3118
3120
  let d2 = false;
3119
3121
  for (let e3 = a2.lineNumber; e3 >= 1; e3--) {
3120
3122
  if ("" === n2.getLineContent(e3).trim()) {
3121
- const t3 = yn(i2, n2.getOffsetAt({ lineNumber: e3, column: 1 }), "function");
3122
- if (!t3 || Cn(t3)) {
3123
+ const t3 = bn(i2, n2.getOffsetAt({ lineNumber: e3, column: 1 }), "function");
3124
+ if (!t3 || Sn(t3)) {
3123
3125
  d2 = true, s2.lineNumber = e3 + 1;
3124
3126
  break;
3125
3127
  }
@@ -3137,7 +3139,7 @@ const wn = async (e2, t2, o2) => {
3137
3139
  let m2 = null;
3138
3140
  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 });
3139
3141
  };
3140
- function qn(e2, t2) {
3142
+ function yn(e2, t2) {
3141
3143
  let o2 = null;
3142
3144
  const n2 = e2.length;
3143
3145
  for (let l2 = 0; !o2 && l2 < n2; l2++) {
@@ -3146,32 +3148,32 @@ function qn(e2, t2) {
3146
3148
  }
3147
3149
  return o2 ? o2.getContext() : "formula";
3148
3150
  }
3149
- function vn(e2, t2, o2, n2, l2 = []) {
3151
+ function Cn(e2, t2, o2, n2, l2 = []) {
3150
3152
  if ("function" === n2.kind && "export" === n2.kindModifiers) {
3151
3153
  const t3 = n2.spans[0].start, r2 = e2.getPositionAt(t3);
3152
- l2.push({ name: n2.text, type: qn(o2, n2), lineNumber: r2.lineNumber });
3154
+ l2.push({ name: n2.text, type: yn(o2, n2), lineNumber: r2.lineNumber });
3153
3155
  }
3154
- if (n2.childItems) for (const r2 of n2.childItems) vn(e2, t2, o2, r2, l2);
3156
+ if (n2.childItems) for (const r2 of n2.childItems) Cn(e2, t2, o2, r2, l2);
3155
3157
  return l2;
3156
3158
  }
3157
- function yn(e2, t2, o2 = "function", n2) {
3159
+ function bn(e2, t2, o2 = "function", n2) {
3158
3160
  const l2 = e2.spans, r2 = l2.length;
3159
3161
  for (let i2 = 0; i2 < r2; i2++) {
3160
3162
  const r3 = l2[i2];
3161
3163
  if (r3.start <= t2 && t2 < r3.start + r3.length) {
3162
3164
  if (e2.kind === o2 && (!n2 || e2.kindModifiers === n2)) return e2;
3163
3165
  for (const l3 of e2.childItems || []) {
3164
- const e3 = yn(l3, t2, o2, n2);
3166
+ const e3 = bn(l3, t2, o2, n2);
3165
3167
  if (e3) return e3;
3166
3168
  }
3167
3169
  }
3168
3170
  return null;
3169
3171
  }
3170
3172
  }
3171
- function Cn(e2) {
3173
+ function Sn(e2) {
3172
3174
  return "comment" === e2.kind;
3173
3175
  }
3174
- const bn = ee(ne((e2, t2) => {
3176
+ const xn = ee(ne((e2, t2) => {
3175
3177
  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) {
3176
3178
  if (!u2.current) return;
3177
3179
  const t3 = u2.current.editor;
@@ -3225,7 +3227,7 @@ const bn = ee(ne((e2, t2) => {
3225
3227
  let a3 = null, s3 = e4.getSelection();
3226
3228
  const d3 = s3.startLineNumber === s3.endLineNumber && s3.startColumn === s3.endColumn ? n4.getLineCount() : Math.min(s3.endLineNumber, n4.getLineCount());
3227
3229
  for (let e5 = s3.startLineNumber; !a3 && e5 <= d3; e5++) {
3228
- const t5 = yn(i3, n4.getOffsetAt({ lineNumber: e5, column: 1 }), "function", o4);
3230
+ const t5 = bn(i3, n4.getOffsetAt({ lineNumber: e5, column: 1 }), "function", o4);
3229
3231
  t5 && (a3 = t5.text);
3230
3232
  }
3231
3233
  return a3;
@@ -3246,7 +3248,7 @@ const bn = ee(ne((e2, t2) => {
3246
3248
  t4.editor.setModelMarkers(e4, "owner", o4);
3247
3249
  })(e3, t3);
3248
3250
  !(async function(e4, t4, o4, n4) {
3249
- 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) => {
3251
+ const l3 = await t4.languages.typescript.getTypeScriptWorker(), r3 = await l3(e4.uri), i3 = await r3.getNavigationTree(e4.uri.toString()), a3 = Cn(e4, t4, n4, i3).map((e5) => {
3250
3252
  let o5 = null, n5 = null;
3251
3253
  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 } };
3252
3254
  });
@@ -3267,7 +3269,7 @@ const bn = ee(ne((e2, t2) => {
3267
3269
  re(() => {
3268
3270
  if (!C2) return;
3269
3271
  const e3 = { insertSnippet: (e4) => {
3270
- u2.current?.editor && wn(u2.current.editor, u2.current.monaco, e4);
3272
+ u2.current?.editor && vn(u2.current.editor, u2.current.monaco, e4);
3271
3273
  }, close: () => $2() };
3272
3274
  C2.setEditor(e3), C2.setSelectedFunction(H2());
3273
3275
  const t3 = C2.addContainerListener({ onBeforeSave: async () => {
@@ -3293,28 +3295,7 @@ const bn = ee(ne((e2, t2) => {
3293
3295
  const t3 = u2.current?.editor;
3294
3296
  return !!t3 && (t3.focus(e3), true);
3295
3297
  }, [x2]), U2 = le(null), _2 = S((e3, t3) => {
3296
- u2.current = { monaco: t3, editor: e3 }, V2(true), (() => {
3297
- if (fn) return;
3298
- const e4 = (e5, t5) => {
3299
- try {
3300
- if (void 0 === t5) try {
3301
- delete globalThis[e5];
3302
- } catch (t6) {
3303
- try {
3304
- globalThis[e5] = void 0;
3305
- } catch (e6) {
3306
- }
3307
- }
3308
- else globalThis[e5] = t5;
3309
- } catch (e6) {
3310
- }
3311
- }, t4 = pn.length;
3312
- for (let o4 = 0; o4 < t4; o4++) {
3313
- const t5 = pn[o4];
3314
- e4(t5, hn[t5]);
3315
- }
3316
- hn = void 0, fn = true;
3317
- })(), O2("Loading Types");
3298
+ u2.current = { monaco: t3, editor: e3 }, V2(true), O2("Loading Types");
3318
3299
  const o3 = C2.getScripts().getModules().getItems()[0]?.getSource() ?? "";
3319
3300
  e3.setValue(o3), import("monaco-editor-auto-typings/custom-editor.js").then(async (o4) => {
3320
3301
  O2("");
@@ -3328,7 +3309,28 @@ const bn = ee(ne((e2, t2) => {
3328
3309
  } }).then((o5) => {
3329
3310
  P2.current = o5;
3330
3311
  const n4 = e3.getModel();
3331
- B2(n4, t3, e3);
3312
+ B2(n4, t3, e3), (() => {
3313
+ if (fn) return;
3314
+ const e4 = (e5, t5) => {
3315
+ try {
3316
+ if (void 0 === t5) try {
3317
+ delete globalThis[e5];
3318
+ } catch (t6) {
3319
+ try {
3320
+ globalThis[e5] = void 0;
3321
+ } catch (e6) {
3322
+ }
3323
+ }
3324
+ else globalThis[e5] = t5;
3325
+ } catch (e6) {
3326
+ }
3327
+ }, t4 = pn.length;
3328
+ for (let o6 = 0; o6 < t4; o6++) {
3329
+ const t5 = pn[o6];
3330
+ e4(t5, hn[t5]);
3331
+ }
3332
+ hn = void 0, fn = true;
3333
+ })();
3332
3334
  });
3333
3335
  }), e3.addCommand("executeScript", function(e4, ...t4) {
3334
3336
  t4?.[0] && E2({ functionName: t4?.[0] });
@@ -3341,7 +3343,7 @@ const bn = ee(ne((e2, t2) => {
3341
3343
  F2();
3342
3344
  } }), e3.onMouseDown(async (e4) => {
3343
3345
  if (e4.target.type === t3.editor.MouseTargetType.GUTTER_GLYPH_MARGIN) {
3344
- 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);
3346
+ 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 = Cn(n3, t3, a3, i3).find((e5) => e5.lineNumber === o4);
3345
3347
  if (s3) {
3346
3348
  const t4 = e4.event.browserEvent.button;
3347
3349
  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());
@@ -3398,7 +3400,7 @@ const bn = ee(ne((e2, t2) => {
3398
3400
  let t3 = false, o3 = false;
3399
3401
  try {
3400
3402
  const n3 = await (async () => {
3401
- const e5 = await fetch("https://cdn.jsdelivr.net/npm/@sheetxl/sdk/types/scripting.d.ts");
3403
+ const e5 = await fetch(qn);
3402
3404
  return await e5.text();
3403
3405
  })(), l3 = e4.Uri.parse('inmemory://model/"sheetxl-models".d.ts');
3404
3406
  let r3 = e4.editor.getModel(l3);
@@ -3441,7 +3443,7 @@ const bn = ee(ne((e2, t2) => {
3441
3443
  const t4 = e4.languages.typescript.typescriptDefaults.getCompilerOptions();
3442
3444
  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 });
3443
3445
  }
3444
- if (I2.current && (await wn(u2.current.editor, u2.current.monaco, I2.current), I2.current = null), m2.current && requestAnimationFrame(async () => {
3446
+ if (I2.current && (await vn(u2.current.editor, u2.current.monaco, I2.current), I2.current = null), m2.current && requestAnimationFrame(async () => {
3445
3447
  m2.current && e4.editor.focus();
3446
3448
  }), !mn) {
3447
3449
  mn = {};
@@ -3506,7 +3508,7 @@ export {
3506
3508
  Xt as MovableArea,
3507
3509
  wo as PictureEditor,
3508
3510
  Ro as Row,
3509
- bn as ScriptEditor,
3511
+ xn as ScriptEditor,
3510
3512
  lt as SheetCellEditor,
3511
3513
  et as SheetCellRenderer,
3512
3514
  mo as SheetElement,
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.16",
4
+ "version": "0.6.18",
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.16",
41
- "@sheetxl/sdk": "^0.6.16",
42
- "@sheetxl/utils": "^0.6.16",
43
- "@sheetxl/utils-react": "^0.6.16",
40
+ "@sheetxl/grid-react": "^0.6.18",
41
+ "@sheetxl/sdk": "^0.6.18",
42
+ "@sheetxl/utils": "^0.6.18",
43
+ "@sheetxl/utils-react": "^0.6.18",
44
44
  "clsx": "^2.1.1",
45
45
  "monaco-editor-auto-typings": "^0.4.6",
46
46
  "react-merge-refs": "^3.0.2",