@sheetxl/react 0.6.8 → 0.6.9

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.9
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.8
2
+ * @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.6.9
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.
@@ -2185,7 +2185,7 @@ const Rt = (e2, t2, o2 = null) => {
2185
2185
  ye2.current = true;
2186
2186
  const e3 = Q.lazy(async () => {
2187
2187
  try {
2188
- const e4 = await import("./4GvsEqYx_7ldThJ8.mjs");
2188
+ const e4 = await import("./Bi6qduoGUlv12Fdp.mjs");
2189
2189
  return ye2.current = false, Ce2.current = true, R2([...k2]), e4;
2190
2190
  } catch (e4) {
2191
2191
  return console.warn(e4), _2.current?.(false), null;
@@ -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,
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.9",
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.9",
41
+ "@sheetxl/sdk": "^0.6.9",
42
+ "@sheetxl/utils": "^0.6.9",
43
+ "@sheetxl/utils-react": "^0.6.9",
44
44
  "clsx": "^2.1.1",
45
45
  "monaco-editor-auto-typings": "^0.4.6",
46
46
  "react-merge-refs": "^3.0.2",