@dxos/plugin-sheet 0.7.4 → 0.7.5-main.9cb18ac

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 (188) hide show
  1. package/dist/lib/browser/{SheetContainer-KCLT6PEO.mjs → SheetContainer-S4NCLUYL.mjs} +16 -22
  2. package/dist/lib/browser/SheetContainer-S4NCLUYL.mjs.map +7 -0
  3. package/dist/lib/browser/{chunk-E5WQ7U7G.mjs → chunk-A374JPWV.mjs} +72 -705
  4. package/dist/lib/browser/chunk-A374JPWV.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-Q4XS4YWF.mjs +900 -0
  6. package/dist/lib/browser/chunk-Q4XS4YWF.mjs.map +7 -0
  7. package/dist/lib/browser/index.mjs +74 -180
  8. package/dist/lib/browser/index.mjs.map +3 -3
  9. package/dist/lib/browser/meta.json +1 -1
  10. package/dist/lib/browser/types/index.mjs +62 -0
  11. package/dist/lib/node/{SheetContainer-VVVRYTQG.cjs → SheetContainer-TP4GYXZB.cjs} +41 -43
  12. package/dist/lib/node/SheetContainer-TP4GYXZB.cjs.map +7 -0
  13. package/dist/lib/node/{chunk-45YW2DX2.cjs → chunk-FDEQ2PGJ.cjs} +115 -726
  14. package/dist/lib/node/chunk-FDEQ2PGJ.cjs.map +7 -0
  15. package/dist/lib/node/chunk-TQOJ7DG2.cjs +935 -0
  16. package/dist/lib/node/chunk-TQOJ7DG2.cjs.map +7 -0
  17. package/dist/lib/node/index.cjs +104 -207
  18. package/dist/lib/node/index.cjs.map +3 -3
  19. package/dist/lib/node/meta.json +1 -1
  20. package/dist/lib/node/types/index.cjs +84 -0
  21. package/dist/lib/node/types/index.cjs.map +7 -0
  22. package/dist/lib/node-esm/{SheetContainer-LSBE6Q4X.mjs → SheetContainer-YB3JBVPZ.mjs} +16 -22
  23. package/dist/lib/node-esm/SheetContainer-YB3JBVPZ.mjs.map +7 -0
  24. package/dist/lib/node-esm/{chunk-NYDNXI7L.mjs → chunk-L5PQHVTX.mjs} +72 -705
  25. package/dist/lib/node-esm/chunk-L5PQHVTX.mjs.map +7 -0
  26. package/dist/lib/node-esm/chunk-NYYIDVR7.mjs +901 -0
  27. package/dist/lib/node-esm/chunk-NYYIDVR7.mjs.map +7 -0
  28. package/dist/lib/node-esm/index.mjs +74 -180
  29. package/dist/lib/node-esm/index.mjs.map +3 -3
  30. package/dist/lib/node-esm/meta.json +1 -1
  31. package/dist/lib/node-esm/types/index.mjs +63 -0
  32. package/dist/types/src/SheetPlugin.d.ts.map +1 -1
  33. package/dist/types/src/components/ComputeGraph/ComputeGraphContextProvider.d.ts +1 -1
  34. package/dist/types/src/components/ComputeGraph/ComputeGraphContextProvider.d.ts.map +1 -1
  35. package/dist/types/src/components/ComputeGraph/compute-graph.stories.d.ts.map +1 -0
  36. package/dist/types/src/components/FunctionEditor/FunctionEditor.d.ts.map +1 -1
  37. package/dist/types/src/components/GridSheet/GridSheet.d.ts.map +1 -1
  38. package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts.map +1 -1
  39. package/dist/types/src/components/GridSheet/util.d.ts.map +1 -1
  40. package/dist/types/src/components/RangeList/RangeList.d.ts.map +1 -1
  41. package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +1 -1
  42. package/dist/types/src/components/SheetContext/SheetContext.d.ts +1 -2
  43. package/dist/types/src/components/SheetContext/SheetContext.d.ts.map +1 -1
  44. package/dist/types/src/components/Toolbar/Toolbar.d.ts +1 -1
  45. package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
  46. package/dist/types/src/components/index.d.ts +1 -1
  47. package/dist/types/src/extensions/compute.d.ts +1 -1
  48. package/dist/types/src/extensions/compute.d.ts.map +1 -1
  49. package/dist/types/src/extensions/editor/extension.d.ts +1 -1
  50. package/dist/types/src/extensions/editor/extension.d.ts.map +1 -1
  51. package/dist/types/src/index.d.ts +1 -1
  52. package/dist/types/src/index.d.ts.map +1 -1
  53. package/dist/types/src/integrations/thread-ranges.d.ts +1 -1
  54. package/dist/types/src/integrations/thread-ranges.d.ts.map +1 -1
  55. package/dist/types/src/model/sheet-model.d.ts +6 -8
  56. package/dist/types/src/model/sheet-model.d.ts.map +1 -1
  57. package/dist/types/src/model/testing.d.ts +1 -1
  58. package/dist/types/src/model/testing.d.ts.map +1 -1
  59. package/dist/types/src/model/useSheetModel.d.ts +1 -1
  60. package/dist/types/src/model/useSheetModel.d.ts.map +1 -1
  61. package/dist/types/src/testing/testing.d.ts +2 -2
  62. package/dist/types/src/testing/testing.d.ts.map +1 -1
  63. package/dist/types/src/{defs → types}/index.d.ts +1 -0
  64. package/dist/types/src/types/index.d.ts.map +1 -0
  65. package/dist/types/src/types/schema.d.ts +105 -0
  66. package/dist/types/src/types/schema.d.ts.map +1 -0
  67. package/dist/types/src/types/sheet-range-types.d.ts.map +1 -0
  68. package/dist/types/src/types/types.d.ts +82 -0
  69. package/dist/types/src/types/types.d.ts.map +1 -0
  70. package/dist/types/src/{defs → types}/util.d.ts +5 -1
  71. package/dist/types/src/types/util.d.ts.map +1 -0
  72. package/dist/types/tsconfig.tsbuildinfo +1 -0
  73. package/package.json +46 -53
  74. package/src/SheetPlugin.tsx +44 -115
  75. package/src/components/ComputeGraph/ComputeGraphContextProvider.tsx +1 -2
  76. package/src/{compute-graph → components/ComputeGraph}/compute-graph.stories.tsx +6 -7
  77. package/src/components/FunctionEditor/FunctionEditor.tsx +2 -1
  78. package/src/components/GridSheet/GridSheet.tsx +15 -18
  79. package/src/components/GridSheet/SheetCellEditor.stories.tsx +6 -7
  80. package/src/components/GridSheet/util.ts +3 -2
  81. package/src/components/RangeList/RangeList.tsx +2 -1
  82. package/src/components/SheetContainer/SheetContainer.stories.tsx +11 -12
  83. package/src/components/SheetContext/SheetContext.tsx +1 -2
  84. package/src/components/Toolbar/Toolbar.tsx +18 -20
  85. package/src/extensions/compute.ts +7 -4
  86. package/src/extensions/editor/extension.test.ts +2 -1
  87. package/src/extensions/editor/extension.ts +2 -3
  88. package/src/index.ts +1 -3
  89. package/src/integrations/thread-ranges.ts +28 -24
  90. package/src/model/sheet-model.test.ts +4 -10
  91. package/src/model/sheet-model.ts +30 -22
  92. package/src/model/testing.ts +3 -2
  93. package/src/model/useSheetModel.ts +2 -1
  94. package/src/sanity.test.ts +1 -1
  95. package/src/testing/testing.tsx +2 -3
  96. package/src/{defs → types}/index.ts +1 -0
  97. package/src/types/schema.ts +56 -0
  98. package/src/types/types.ts +93 -0
  99. package/src/{defs → types}/util.ts +13 -13
  100. package/dist/lib/browser/SheetContainer-KCLT6PEO.mjs.map +0 -7
  101. package/dist/lib/browser/chunk-E5WQ7U7G.mjs.map +0 -7
  102. package/dist/lib/browser/chunk-F3HE6D3J.mjs +0 -3269
  103. package/dist/lib/browser/chunk-F3HE6D3J.mjs.map +0 -7
  104. package/dist/lib/browser/chunk-JXFPOYNA.mjs +0 -67
  105. package/dist/lib/browser/chunk-JXFPOYNA.mjs.map +0 -7
  106. package/dist/lib/browser/compute-graph-SNUS7HOH.mjs +0 -35
  107. package/dist/lib/browser/types.mjs +0 -16
  108. package/dist/lib/node/SheetContainer-VVVRYTQG.cjs.map +0 -7
  109. package/dist/lib/node/chunk-45YW2DX2.cjs.map +0 -7
  110. package/dist/lib/node/chunk-KSEEI5VC.cjs +0 -3323
  111. package/dist/lib/node/chunk-KSEEI5VC.cjs.map +0 -7
  112. package/dist/lib/node/chunk-OWH2EUHZ.cjs +0 -90
  113. package/dist/lib/node/chunk-OWH2EUHZ.cjs.map +0 -7
  114. package/dist/lib/node/compute-graph-WILPHO4A.cjs +0 -57
  115. package/dist/lib/node/compute-graph-WILPHO4A.cjs.map +0 -7
  116. package/dist/lib/node/types.cjs +0 -38
  117. package/dist/lib/node/types.cjs.map +0 -7
  118. package/dist/lib/node-esm/SheetContainer-LSBE6Q4X.mjs.map +0 -7
  119. package/dist/lib/node-esm/chunk-6JF2AHKO.mjs +0 -3270
  120. package/dist/lib/node-esm/chunk-6JF2AHKO.mjs.map +0 -7
  121. package/dist/lib/node-esm/chunk-BVS2IQRO.mjs +0 -68
  122. package/dist/lib/node-esm/chunk-BVS2IQRO.mjs.map +0 -7
  123. package/dist/lib/node-esm/chunk-NYDNXI7L.mjs.map +0 -7
  124. package/dist/lib/node-esm/compute-graph-S6CVN7RS.mjs +0 -36
  125. package/dist/lib/node-esm/compute-graph-S6CVN7RS.mjs.map +0 -7
  126. package/dist/lib/node-esm/types.mjs +0 -17
  127. package/dist/lib/node-esm/types.mjs.map +0 -7
  128. package/dist/types/src/compute-graph/compute-graph-registry.d.ts +0 -34
  129. package/dist/types/src/compute-graph/compute-graph-registry.d.ts.map +0 -1
  130. package/dist/types/src/compute-graph/compute-graph.d.ts +0 -64
  131. package/dist/types/src/compute-graph/compute-graph.d.ts.map +0 -1
  132. package/dist/types/src/compute-graph/compute-graph.stories.d.ts.map +0 -1
  133. package/dist/types/src/compute-graph/compute-graph.test.d.ts +0 -2
  134. package/dist/types/src/compute-graph/compute-graph.test.d.ts.map +0 -1
  135. package/dist/types/src/compute-graph/compute-node.d.ts +0 -26
  136. package/dist/types/src/compute-graph/compute-node.d.ts.map +0 -1
  137. package/dist/types/src/compute-graph/functions/async-function.d.ts +0 -66
  138. package/dist/types/src/compute-graph/functions/async-function.d.ts.map +0 -1
  139. package/dist/types/src/compute-graph/functions/edge-function.d.ts +0 -21
  140. package/dist/types/src/compute-graph/functions/edge-function.d.ts.map +0 -1
  141. package/dist/types/src/compute-graph/functions/function-defs.d.ts +0 -11
  142. package/dist/types/src/compute-graph/functions/function-defs.d.ts.map +0 -1
  143. package/dist/types/src/compute-graph/functions/index.d.ts +0 -4
  144. package/dist/types/src/compute-graph/functions/index.d.ts.map +0 -1
  145. package/dist/types/src/compute-graph/hyperformula.test.d.ts +0 -2
  146. package/dist/types/src/compute-graph/hyperformula.test.d.ts.map +0 -1
  147. package/dist/types/src/compute-graph/index.d.ts +0 -5
  148. package/dist/types/src/compute-graph/index.d.ts.map +0 -1
  149. package/dist/types/src/compute-graph/testing/index.d.ts +0 -3
  150. package/dist/types/src/compute-graph/testing/index.d.ts.map +0 -1
  151. package/dist/types/src/compute-graph/testing/test-builder.d.ts +0 -15
  152. package/dist/types/src/compute-graph/testing/test-builder.d.ts.map +0 -1
  153. package/dist/types/src/compute-graph/testing/test-plugin.d.ts +0 -36
  154. package/dist/types/src/compute-graph/testing/test-plugin.d.ts.map +0 -1
  155. package/dist/types/src/compute-graph/util.d.ts +0 -2
  156. package/dist/types/src/compute-graph/util.d.ts.map +0 -1
  157. package/dist/types/src/defs/index.d.ts.map +0 -1
  158. package/dist/types/src/defs/sheet-range-types.d.ts.map +0 -1
  159. package/dist/types/src/defs/types.d.ts +0 -26
  160. package/dist/types/src/defs/types.d.ts.map +0 -1
  161. package/dist/types/src/defs/types.test.d.ts +0 -2
  162. package/dist/types/src/defs/types.test.d.ts.map +0 -1
  163. package/dist/types/src/defs/util.d.ts.map +0 -1
  164. package/dist/types/src/types.d.ts +0 -182
  165. package/dist/types/src/types.d.ts.map +0 -1
  166. package/dist/vendor/hyperformula.mjs +0 -37145
  167. package/src/compute-graph/compute-graph-registry.ts +0 -90
  168. package/src/compute-graph/compute-graph.test.ts +0 -87
  169. package/src/compute-graph/compute-graph.ts +0 -260
  170. package/src/compute-graph/compute-node.ts +0 -62
  171. package/src/compute-graph/functions/async-function.ts +0 -179
  172. package/src/compute-graph/functions/edge-function.ts +0 -102
  173. package/src/compute-graph/functions/function-defs.ts +0 -2427
  174. package/src/compute-graph/functions/index.ts +0 -7
  175. package/src/compute-graph/hyperformula.test.ts +0 -14
  176. package/src/compute-graph/index.ts +0 -8
  177. package/src/compute-graph/testing/index.ts +0 -6
  178. package/src/compute-graph/testing/test-builder.ts +0 -54
  179. package/src/compute-graph/testing/test-plugin.ts +0 -100
  180. package/src/compute-graph/util.ts +0 -8
  181. package/src/defs/types.test.ts +0 -91
  182. package/src/defs/types.ts +0 -88
  183. package/src/types.ts +0 -125
  184. /package/dist/lib/browser/{compute-graph-SNUS7HOH.mjs.map → types/index.mjs.map} +0 -0
  185. /package/dist/lib/{browser/types.mjs.map → node-esm/types/index.mjs.map} +0 -0
  186. /package/dist/types/src/{compute-graph → components/ComputeGraph}/compute-graph.stories.d.ts +0 -0
  187. /package/dist/types/src/{defs → types}/sheet-range-types.d.ts +0 -0
  188. /package/src/{defs → types}/sheet-range-types.ts +0 -0
@@ -1,29 +1,12 @@
1
1
  import {
2
- DEFAULT_COLUMNS,
2
+ DEFAULT_COLS,
3
3
  DEFAULT_ROWS,
4
- MAX_COLUMNS,
5
- MAX_ROWS,
6
- RANGE_NOTATION,
7
- ReadonlyException,
8
- addressFromA1Notation,
9
- addressFromIndex,
10
- addressToA1Notation,
11
- addressToIndex,
4
+ Range,
5
+ SheetAction,
12
6
  cellClassNameForRange,
13
- createSheetName,
14
- inRange,
15
- initialize,
16
- insertIndices,
17
- isFormula,
18
- mapFormulaIndicesToRefs,
19
- mapFormulaRefsToIndices,
20
7
  rangeFromIndex,
21
- rangeToA1Notation
22
- } from "./chunk-F3HE6D3J.mjs";
23
- import {
24
- Range,
25
- SheetAction
26
- } from "./chunk-JXFPOYNA.mjs";
8
+ useSheetModel
9
+ } from "./chunk-Q4XS4YWF.mjs";
27
10
  import {
28
11
  SHEET_PLUGIN
29
12
  } from "./chunk-RABELMEQ.mjs";
@@ -60,6 +43,7 @@ import { syntaxTree } from "@codemirror/language";
60
43
  import { RangeSetBuilder, StateEffect, StateField } from "@codemirror/state";
61
44
  import { Decoration, EditorView, ViewPlugin, WidgetType } from "@codemirror/view";
62
45
  import { debounce } from "@dxos/async";
46
+ import { createSheetName } from "@dxos/compute";
63
47
  import { invariant } from "@dxos/invariant";
64
48
  import { documentId, singleValueFacet } from "@dxos/react-ui-editor";
65
49
  var updateAllDecorations = StateEffect.define();
@@ -71,6 +55,7 @@ import { HighlightStyle, syntaxHighlighting } from "@codemirror/language";
71
55
  import { ViewPlugin as ViewPlugin2, keymap } from "@codemirror/view";
72
56
  import { tags } from "@lezer/highlight";
73
57
  import { spreadsheet } from "codemirror-lang-spreadsheet";
58
+ import { RANGE_NOTATION } from "@dxos/compute";
74
59
  import { singleValueFacet as singleValueFacet2 } from "@dxos/react-ui-editor";
75
60
  import { mx } from "@dxos/react-ui-theme";
76
61
  var highlightStyles = HighlightStyle.define([
@@ -277,621 +262,17 @@ var visitTree = (node, callback) => {
277
262
  };
278
263
 
279
264
  // packages/plugins/plugin-sheet/src/components/SheetContext/SheetContext.tsx
280
- import React2, { createContext as createContext2, useCallback, useContext as useContext2, useState as useState2 } from "react";
281
- import { invariant as invariant3 } from "@dxos/invariant";
265
+ import React2, { createContext as createContext2, useCallback, useContext as useContext2, useState } from "react";
266
+ import { invariant as invariant2 } from "@dxos/invariant";
282
267
  import { fullyQualifiedId } from "@dxos/react-client/echo";
283
268
  import { Grid, useGridContext } from "@dxos/react-ui-grid";
284
-
285
- // packages/plugins/plugin-sheet/src/model/sheet-model.ts
286
- import { Event } from "@dxos/async";
287
- import { Resource } from "@dxos/context";
288
- import { getTypename, FormatEnum, TypeEnum } from "@dxos/echo-schema";
289
- import { invariant as invariant2 } from "@dxos/invariant";
290
- import { PublicKey } from "@dxos/keys";
291
- import { log } from "@dxos/log";
292
- import { DetailedCellError, ExportedCellChange } from "#hyperformula";
293
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-sheet/src/model/sheet-model.ts";
294
- var typeMap = {
295
- BOOLEAN: {
296
- type: TypeEnum.Boolean
297
- },
298
- NUMBER_RAW: {
299
- type: TypeEnum.Number
300
- },
301
- NUMBER_PERCENT: {
302
- type: TypeEnum.Number,
303
- format: FormatEnum.Percent
304
- },
305
- NUMBER_CURRENCY: {
306
- type: TypeEnum.Number,
307
- format: FormatEnum.Currency
308
- },
309
- NUMBER_DATETIME: {
310
- type: TypeEnum.String,
311
- format: FormatEnum.DateTime
312
- },
313
- NUMBER_DATE: {
314
- type: TypeEnum.String,
315
- format: FormatEnum.Date
316
- },
317
- NUMBER_TIME: {
318
- type: TypeEnum.String,
319
- format: FormatEnum.Time
320
- }
321
- };
322
- var getTopLeft = (range) => {
323
- const to = range.to ?? range.from;
324
- return {
325
- row: Math.min(range.from.row, to.row),
326
- col: Math.min(range.from.col, to.col)
327
- };
328
- };
329
- var toSimpleCellAddress = (sheet, cell) => ({
330
- sheet,
331
- row: cell.row,
332
- col: cell.col
333
- });
334
- var toModelRange = (sheet, range) => ({
335
- start: toSimpleCellAddress(sheet, range.from),
336
- end: toSimpleCellAddress(sheet, range.to ?? range.from)
337
- });
338
- var SheetModel = class extends Resource {
339
- constructor(_graph, _sheet, _options = {}) {
340
- super();
341
- this._graph = _graph;
342
- this._sheet = _sheet;
343
- this._options = _options;
344
- this.id = `model-${PublicKey.random().truncate()}`;
345
- this.update = new Event();
346
- }
347
- get graph() {
348
- return this._graph;
349
- }
350
- get sheet() {
351
- return this._sheet;
352
- }
353
- get readonly() {
354
- return this._options.readonly;
355
- }
356
- get bounds() {
357
- return {
358
- rows: this._sheet.rows.length,
359
- columns: this._sheet.columns.length
360
- };
361
- }
362
- /**
363
- * Initialize sheet and engine.
364
- */
365
- async _open() {
366
- log("initialize", {
367
- id: this.id
368
- }, {
369
- F: __dxlog_file,
370
- L: 115,
371
- S: this,
372
- C: (f, a) => f(...a)
373
- });
374
- initialize(this._sheet);
375
- this._graph.update.on((event) => {
376
- if (event.type === "functionsUpdated") {
377
- this.reset();
378
- }
379
- });
380
- this._node = this._graph.getOrCreateNode(createSheetName({
381
- type: getTypename(this._sheet),
382
- id: this._sheet.id
383
- }));
384
- await this._node.open();
385
- const unsubscribe = this._node.update.on((event) => this.update.emit(event));
386
- this._ctx.onDispose(unsubscribe);
387
- this.reset();
388
- }
389
- /**
390
- * Update engine.
391
- * NOTE: This resets the undo history.
392
- * @deprecated
393
- */
394
- reset() {
395
- invariant2(this._node, void 0, {
396
- F: __dxlog_file,
397
- L: 141,
398
- S: this,
399
- A: [
400
- "this._node",
401
- ""
402
- ]
403
- });
404
- this._node.graph.hf.clearSheet(this._node.sheetId);
405
- Object.entries(this._sheet.cells).forEach(([key, { value }]) => {
406
- invariant2(this._node, void 0, {
407
- F: __dxlog_file,
408
- L: 144,
409
- S: this,
410
- A: [
411
- "this._node",
412
- ""
413
- ]
414
- });
415
- const { col, row } = addressFromIndex(this._sheet, key);
416
- if (isFormula(value)) {
417
- const binding = this._graph.mapFunctionBindingFromId(mapFormulaIndicesToRefs(this._sheet, value));
418
- if (binding) {
419
- value = this._graph.mapFormulaToNative(binding);
420
- } else {
421
- value = "";
422
- }
423
- }
424
- this._node.graph.hf.setCellContents({
425
- sheet: this._node.sheetId,
426
- row,
427
- col
428
- }, value);
429
- });
430
- }
431
- /**
432
- * Recalculate formulas.
433
- * NOTE: This resets the undo history.
434
- * https://hyperformula.handsontable.com/guide/volatile-functions.html#volatile-actions
435
- * @deprecated
436
- */
437
- // TODO(burdon): Remove.
438
- recalculate() {
439
- this._node?.graph.hf.rebuildAndRecalculate();
440
- }
441
- insertRows(i, n = 1) {
442
- const idx = insertIndices(this._sheet.rows, i, n, MAX_ROWS);
443
- this.reset();
444
- return idx;
445
- }
446
- insertColumns(i, n = 1) {
447
- const idx = insertIndices(this._sheet.columns, i, n, MAX_COLUMNS);
448
- this.reset();
449
- return idx;
450
- }
451
- dropRow(rowIndex) {
452
- const range = {
453
- from: addressFromIndex(this._sheet, `${this._sheet.columns[0]}@${rowIndex}`),
454
- to: addressFromIndex(this._sheet, `${this._sheet.columns[this._sheet.columns.length - 1]}@${rowIndex}`)
455
- };
456
- const values = this.getCellValues(range).flat();
457
- const index = this._sheet.rows.indexOf(rowIndex);
458
- this.clear(range);
459
- this._sheet.rows.splice(index, 1);
460
- delete this._sheet.rowMeta[rowIndex];
461
- this.reset();
462
- return {
463
- axis: "row",
464
- index,
465
- axisIndex: rowIndex,
466
- axisMeta: this._sheet.rowMeta[rowIndex],
467
- values
468
- };
469
- }
470
- dropColumn(colIndex) {
471
- const range = {
472
- from: addressFromIndex(this._sheet, `${colIndex}@${this._sheet.rows[0]}`),
473
- to: addressFromIndex(this._sheet, `${colIndex}@${this._sheet.rows[this._sheet.rows.length - 1]}`)
474
- };
475
- const values = this.getCellValues(range).flat();
476
- const index = this._sheet.columns.indexOf(colIndex);
477
- this.clear(range);
478
- this._sheet.columns.splice(index, 1);
479
- delete this._sheet.columnMeta[colIndex];
480
- this.reset();
481
- return {
482
- axis: "col",
483
- index,
484
- axisIndex: colIndex,
485
- axisMeta: this._sheet.rowMeta[colIndex],
486
- values
487
- };
488
- }
489
- restoreRow({ index, axisIndex, axisMeta, values }) {
490
- this._sheet.rows.splice(index, 0, axisIndex);
491
- values.forEach((value, col) => {
492
- if (value) {
493
- this._sheet.cells[`${this._sheet.columns[col]}@${axisIndex}`] = {
494
- value
495
- };
496
- }
497
- });
498
- if (axisMeta) {
499
- this._sheet.rowMeta[axisIndex] = axisMeta;
500
- }
501
- this.reset();
502
- }
503
- restoreColumn({ index, axisIndex, axisMeta, values }) {
504
- this._sheet.columns.splice(index, 0, axisIndex);
505
- values.forEach((value, row) => {
506
- if (value) {
507
- this._sheet.cells[`${axisIndex}@${this._sheet.rows[row]}`] = {
508
- value
509
- };
510
- }
511
- });
512
- if (axisMeta) {
513
- this._sheet.columnMeta[axisIndex] = axisMeta;
514
- }
515
- this.reset();
516
- }
517
- //
518
- // Undoable actions.
519
- // TODO(burdon): Group undoable methods; consistently update hf/sheet.
520
- //
521
- /**
522
- * Clear range of values.
523
- */
524
- clear(range) {
525
- invariant2(this._node, void 0, {
526
- F: __dxlog_file,
527
- L: 247,
528
- S: this,
529
- A: [
530
- "this._node",
531
- ""
532
- ]
533
- });
534
- const topLeft = getTopLeft(range);
535
- const values = this._iterRange(range, () => null);
536
- this._node.graph.hf.setCellContents(toSimpleCellAddress(this._node.sheetId, topLeft), values);
537
- this._iterRange(range, (cell) => {
538
- const idx = addressToIndex(this._sheet, cell);
539
- delete this._sheet.cells[idx];
540
- });
541
- }
542
- cut(range) {
543
- invariant2(this._node, void 0, {
544
- F: __dxlog_file,
545
- L: 258,
546
- S: this,
547
- A: [
548
- "this._node",
549
- ""
550
- ]
551
- });
552
- this._node.graph.hf.cut(toModelRange(this._node.sheetId, range));
553
- this._iterRange(range, (cell) => {
554
- const idx = addressToIndex(this._sheet, cell);
555
- delete this._sheet.cells[idx];
556
- });
557
- }
558
- copy(range) {
559
- invariant2(this._node, void 0, {
560
- F: __dxlog_file,
561
- L: 267,
562
- S: this,
563
- A: [
564
- "this._node",
565
- ""
566
- ]
567
- });
568
- this._node.graph.hf.copy(toModelRange(this._node.sheetId, range));
569
- }
570
- paste(cell) {
571
- invariant2(this._node, void 0, {
572
- F: __dxlog_file,
573
- L: 272,
574
- S: this,
575
- A: [
576
- "this._node",
577
- ""
578
- ]
579
- });
580
- if (!this._node.graph.hf.isClipboardEmpty()) {
581
- const changes = this._node.graph.hf.paste(toSimpleCellAddress(this._node.sheetId, cell));
582
- for (const change of changes) {
583
- if (change instanceof ExportedCellChange) {
584
- const { address, newValue } = change;
585
- const idx = addressToIndex(this._sheet, {
586
- row: address.row,
587
- col: address.col
588
- });
589
- this._sheet.cells[idx] = {
590
- value: newValue
591
- };
592
- }
593
- }
594
- }
595
- }
596
- // TODO(burdon): Display undo/redo state.
597
- undo() {
598
- invariant2(this._node, void 0, {
599
- F: __dxlog_file,
600
- L: 287,
601
- S: this,
602
- A: [
603
- "this._node",
604
- ""
605
- ]
606
- });
607
- if (this._node.graph.hf.isThereSomethingToUndo()) {
608
- this._node.graph.hf.undo();
609
- }
610
- }
611
- redo() {
612
- invariant2(this._node, void 0, {
613
- F: __dxlog_file,
614
- L: 295,
615
- S: this,
616
- A: [
617
- "this._node",
618
- ""
619
- ]
620
- });
621
- if (this._node.graph.hf.isThereSomethingToRedo()) {
622
- this._node.graph.hf.redo();
623
- }
624
- }
625
- /**
626
- * Get value from sheet.
627
- */
628
- getCellValue(cell) {
629
- const idx = addressToIndex(this._sheet, cell);
630
- return this._sheet.cells[idx]?.value ?? null;
631
- }
632
- /**
633
- * Get value as a string for editing.
634
- */
635
- getCellText(cell) {
636
- const value = this.getCellValue(cell);
637
- if (value == null) {
638
- return void 0;
639
- }
640
- if (isFormula(value)) {
641
- return this._graph.mapFunctionBindingFromId(mapFormulaIndicesToRefs(this._sheet, value));
642
- } else {
643
- return String(value);
644
- }
645
- }
646
- /**
647
- * Get array of raw values from sheet.
648
- */
649
- getCellValues(range) {
650
- return this._iterRange(range, (cell) => this.getCellValue(cell));
651
- }
652
- /**
653
- * Gets the regular or computed value from the engine.
654
- */
655
- getValue(cell) {
656
- invariant2(this._node, void 0, {
657
- F: __dxlog_file,
658
- L: 338,
659
- S: this,
660
- A: [
661
- "this._node",
662
- ""
663
- ]
664
- });
665
- const address = toSimpleCellAddress(this._node.sheetId, cell);
666
- const value = this._node.graph.hf.getCellValue(address);
667
- if (value instanceof DetailedCellError) {
668
- log.info("cell error", {
669
- cell,
670
- error: value
671
- }, {
672
- F: __dxlog_file,
673
- L: 343,
674
- S: this,
675
- C: (f, a) => f(...a)
676
- });
677
- return value.toString();
678
- }
679
- return value;
680
- }
681
- /**
682
- * Get value type.
683
- */
684
- getValueDescription(cell) {
685
- invariant2(this._node, void 0, {
686
- F: __dxlog_file,
687
- L: 354,
688
- S: this,
689
- A: [
690
- "this._node",
691
- ""
692
- ]
693
- });
694
- const addr = toSimpleCellAddress(this._node.sheetId, cell);
695
- const type = this._node.graph.hf.getCellValueDetailedType(addr);
696
- return typeMap[type];
697
- }
698
- /**
699
- * Sets the value, updating the sheet and engine.
700
- */
701
- setValue(cell, value) {
702
- invariant2(this._node, void 0, {
703
- F: __dxlog_file,
704
- L: 364,
705
- S: this,
706
- A: [
707
- "this._node",
708
- ""
709
- ]
710
- });
711
- if (this._options.readonly) {
712
- throw new ReadonlyException();
713
- }
714
- let refresh = false;
715
- if (cell.row >= this._sheet.rows.length) {
716
- insertIndices(this._sheet.rows, cell.row, 1, MAX_ROWS);
717
- refresh = true;
718
- }
719
- if (cell.col >= this._sheet.columns.length) {
720
- insertIndices(this._sheet.columns, cell.col, 1, MAX_COLUMNS);
721
- refresh = true;
722
- }
723
- if (refresh) {
724
- this.reset();
725
- }
726
- this._node.graph.hf.setCellContents({
727
- sheet: this._node.sheetId,
728
- row: cell.row,
729
- col: cell.col
730
- }, [
731
- [
732
- isFormula(value) ? this._graph.mapFormulaToNative(value) : value
733
- ]
734
- ]);
735
- const idx = addressToIndex(this._sheet, cell);
736
- if (value === void 0 || value === null) {
737
- delete this._sheet.cells[idx];
738
- } else {
739
- if (isFormula(value)) {
740
- value = this._graph.mapFunctionBindingToId(mapFormulaRefsToIndices(this._sheet, value));
741
- }
742
- this._sheet.cells[idx] = {
743
- value
744
- };
745
- }
746
- }
747
- /**
748
- * Sets values from a simple map.
749
- */
750
- setValues(values) {
751
- Object.entries(values).forEach(([key, { value }]) => {
752
- this.setValue(addressFromA1Notation(key), value);
753
- });
754
- }
755
- /**
756
- * Iterate range.
757
- */
758
- _iterRange(range, cb) {
759
- const to = range.to ?? range.from;
760
- const rowRange = [
761
- Math.min(range.from.row, to.row),
762
- Math.max(range.from.row, to.row)
763
- ];
764
- const columnRange = [
765
- Math.min(range.from.col, to.col),
766
- Math.max(range.from.col, to.col)
767
- ];
768
- const rows = [];
769
- for (let row = rowRange[0]; row <= rowRange[1]; row++) {
770
- const rowCells = [];
771
- for (let column = columnRange[0]; column <= columnRange[1]; column++) {
772
- const value = cb({
773
- row,
774
- col: column
775
- });
776
- if (value !== void 0) {
777
- rowCells.push(value);
778
- }
779
- }
780
- rows.push(rowCells);
781
- }
782
- return rows;
783
- }
784
- // TODO(burdon): Delete index.
785
- _deleteIndices(indices, i, n) {
786
- throw new Error("Not implemented");
787
- }
788
- // TODO(burdon): Move. Cannot use fractional without changing. Switch back to using unique IDs?
789
- _moveIndices(indices, i, j, n) {
790
- throw new Error("Not implemented");
791
- }
792
- /**
793
- * Map from indices to A1 notation.
794
- */
795
- mapFormulaIndicesToRefs(formula) {
796
- invariant2(isFormula(formula), void 0, {
797
- F: __dxlog_file,
798
- L: 449,
799
- S: this,
800
- A: [
801
- "isFormula(formula)",
802
- ""
803
- ]
804
- });
805
- return formula.replace(/([a-zA-Z0-9]+)@([a-zA-Z0-9]+)/g, (idx) => {
806
- return addressToA1Notation(addressFromIndex(this._sheet, idx));
807
- });
808
- }
809
- //
810
- // Values
811
- //
812
- /**
813
- * https://hyperformula.handsontable.com/guide/date-and-time-handling.html#example
814
- * https://hyperformula.handsontable.com/api/interfaces/configparams.html#nulldate
815
- * NOTE: TODAY() is number of FULL days since nullDate. It will typically be -1 days from NOW().
816
- */
817
- toLocalDate(num) {
818
- const { year, month, day, hours, minutes, seconds } = this.toDateTime(num);
819
- return new Date(year, month - 1, day, hours, minutes, seconds);
820
- }
821
- toDateTime(num) {
822
- invariant2(this._node, void 0, {
823
- F: __dxlog_file,
824
- L: 470,
825
- S: this,
826
- A: [
827
- "this._node",
828
- ""
829
- ]
830
- });
831
- return this._node.graph.hf.numberToDateTime(num);
832
- }
833
- toDate(num) {
834
- invariant2(this._node, void 0, {
835
- F: __dxlog_file,
836
- L: 475,
837
- S: this,
838
- A: [
839
- "this._node",
840
- ""
841
- ]
842
- });
843
- return this._node.graph.hf.numberToDate(num);
844
- }
845
- toTime(num) {
846
- invariant2(this._node, void 0, {
847
- F: __dxlog_file,
848
- L: 480,
849
- S: this,
850
- A: [
851
- "this._node",
852
- ""
853
- ]
854
- });
855
- return this._node.graph.hf.numberToTime(num);
856
- }
857
- };
858
-
859
- // packages/plugins/plugin-sheet/src/model/useSheetModel.ts
860
- import { useEffect, useState } from "react";
861
- var useSheetModel = (graph, sheet, { readonly } = {}) => {
862
- const [model, setModel] = useState();
863
- useEffect(() => {
864
- if (!graph || !sheet) {
865
- return;
866
- }
867
- let model2;
868
- const t = setTimeout(async () => {
869
- model2 = new SheetModel(graph, sheet, {
870
- readonly
871
- });
872
- await model2.open();
873
- setModel(model2);
874
- });
875
- return () => {
876
- clearTimeout(t);
877
- void model2?.close();
878
- };
879
- }, [
880
- graph,
881
- sheet,
882
- readonly
883
- ]);
884
- return model;
885
- };
886
-
887
- // packages/plugins/plugin-sheet/src/components/SheetContext/SheetContext.tsx
888
- var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-sheet/src/components/SheetContext/SheetContext.tsx";
269
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-sheet/src/components/SheetContext/SheetContext.tsx";
889
270
  var SheetContext = /* @__PURE__ */ createContext2(void 0);
890
271
  var useSheetContext = () => {
891
272
  const context = useContext2(SheetContext);
892
- invariant3(context, void 0, {
893
- F: __dxlog_file2,
894
- L: 55,
273
+ invariant2(context, void 0, {
274
+ F: __dxlog_file,
275
+ L: 54,
895
276
  S: void 0,
896
277
  A: [
897
278
  "context",
@@ -902,10 +283,10 @@ var useSheetContext = () => {
902
283
  };
903
284
  var SheetProviderImpl = ({ model, onInfo, ignoreAttention, children, __gridScope }) => {
904
285
  const { id, editing, setEditing } = useGridContext("SheetProvider", __gridScope);
905
- const [cursor, setCursorInternal] = useState2();
906
- const [range, setRangeInternal] = useState2();
907
- const [cursorFallbackRange, setCursorFallbackRange] = useState2();
908
- const [activeRefs, setActiveRefs] = useState2("");
286
+ const [cursor, setCursorInternal] = useState();
287
+ const [range, setRangeInternal] = useState();
288
+ const [cursorFallbackRange, setCursorFallbackRange] = useState();
289
+ const [activeRefs, setActiveRefs] = useState("");
909
290
  const setCursor = useCallback((nextCursor) => {
910
291
  setCursorInternal(nextCursor);
911
292
  setCursorFallbackRange(range?.to ? range : nextCursor ? {
@@ -957,23 +338,27 @@ var SheetProvider = ({ children, graph, sheet, readonly, ignoreAttention, onInfo
957
338
  };
958
339
 
959
340
  // packages/plugins/plugin-sheet/src/components/GridSheet/GridSheet.tsx
960
- import React5, { useCallback as useCallback4, useMemo as useMemo2, useRef, useState as useState4 } from "react";
961
- import { useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
341
+ import React5, { useCallback as useCallback4, useMemo as useMemo2, useRef, useState as useState3 } from "react";
342
+ import { createIntent as createIntent2, useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
343
+ import { rangeToA1Notation as rangeToA1Notation2 } from "@dxos/compute";
962
344
  import { DropdownMenu, Icon, useTranslation as useTranslation3 } from "@dxos/react-ui";
963
345
  import { useAttention } from "@dxos/react-ui-attention";
964
346
  import { closestCell, defaultSizeRow, editorKeys, Grid as Grid2, GridCellEditor, parseCellIndex } from "@dxos/react-ui-grid";
965
347
 
966
348
  // packages/plugins/plugin-sheet/src/components/GridSheet/util.ts
967
- import { useEffect as useEffect3, useState as useState3 } from "react";
349
+ import { useEffect as useEffect2, useState as useState2 } from "react";
350
+ import { inRange as inRange2 } from "@dxos/compute";
968
351
  import { createDocAccessor, fullyQualifiedId as fullyQualifiedId3 } from "@dxos/react-client/echo";
969
352
  import { parseValue, cellClassesForFieldType } from "@dxos/react-ui-form";
970
353
  import { colToA1Notation, rowToA1Notation, commentedClassName } from "@dxos/react-ui-grid";
971
354
  import { mx as mx2 } from "@dxos/react-ui-theme";
972
355
 
973
356
  // packages/plugins/plugin-sheet/src/integrations/thread-ranges.ts
974
- import { useCallback as useCallback3, useEffect as useEffect2, useMemo } from "react";
975
- import { LayoutAction, useIntentDispatcher, useIntentResolver } from "@dxos/app-framework";
357
+ import { useCallback as useCallback3, useEffect, useMemo } from "react";
358
+ import { createIntent, createResolver, LayoutAction, useIntentDispatcher, useIntentResolver } from "@dxos/app-framework";
976
359
  import { debounce as debounce2 } from "@dxos/async";
360
+ import { inRange } from "@dxos/compute";
361
+ import { ThreadAction } from "@dxos/plugin-thread/types";
977
362
  import { fullyQualifiedId as fullyQualifiedId2 } from "@dxos/react-client/echo";
978
363
 
979
364
  // packages/plugins/plugin-sheet/src/components/index.ts
@@ -981,6 +366,7 @@ import { lazy } from "react";
981
366
 
982
367
  // packages/plugins/plugin-sheet/src/components/RangeList/RangeList.tsx
983
368
  import React3, { useCallback as useCallback2 } from "react";
369
+ import { rangeToA1Notation } from "@dxos/compute";
984
370
  import { S } from "@dxos/echo-schema";
985
371
  import { useTranslation } from "@dxos/react-ui";
986
372
  import { List } from "@dxos/react-ui-list";
@@ -1039,7 +425,7 @@ var SheetObjectSettings = ({ sheet }) => {
1039
425
  };
1040
426
 
1041
427
  // packages/plugins/plugin-sheet/src/components/index.ts
1042
- var SheetContainer = lazy(() => import("./SheetContainer-KCLT6PEO.mjs"));
428
+ var SheetContainer = lazy(() => import("./SheetContainer-S4NCLUYL.mjs"));
1043
429
 
1044
430
  // packages/plugins/plugin-sheet/src/integrations/thread-ranges.ts
1045
431
  var completeCellRangeToThreadCursor = (range) => {
@@ -1065,32 +451,25 @@ var parseThreadAnchorAsCellRange = (cursor) => {
1065
451
  };
1066
452
  var useUpdateFocusedCellOnThreadSelection = (grid) => {
1067
453
  const { model, setActiveRefs } = useSheetContext();
1068
- const handleScrollIntoView = useCallback3(({ action, data }) => {
1069
- switch (action) {
1070
- case LayoutAction.SCROLL_INTO_VIEW: {
1071
- if (!data?.id || data?.cursor === void 0 || data?.id !== fullyQualifiedId2(model.sheet)) {
1072
- return;
1073
- }
1074
- setActiveRefs(data.thread);
1075
- const range = parseThreadAnchorAsCellRange(data.cursor);
1076
- range && grid?.setFocus({
1077
- ...range.to,
1078
- plane: "grid"
1079
- }, true);
1080
- return {
1081
- data: true
1082
- };
1083
- }
1084
- }
1085
- }, [
454
+ const scrollIntoViewResolver = useMemo(() => createResolver(LayoutAction.ScrollIntoView, ({ cursor, ref }) => {
455
+ setActiveRefs(ref);
456
+ const range = parseThreadAnchorAsCellRange(cursor);
457
+ range && grid?.setFocus({
458
+ ...range.to,
459
+ plane: "grid"
460
+ }, true);
461
+ }, {
462
+ disposition: "hoist",
463
+ filter: (data) => data.id === fullyQualifiedId2(model.sheet) && !!data.cursor
464
+ }), [
1086
465
  model.sheet,
1087
466
  setActiveRefs
1088
467
  ]);
1089
- useIntentResolver(SHEET_PLUGIN, handleScrollIntoView);
468
+ useIntentResolver(SHEET_PLUGIN, scrollIntoViewResolver);
1090
469
  };
1091
470
  var useSelectThreadOnCellFocus = () => {
1092
471
  const { model, cursor } = useSheetContext();
1093
- const dispatch = useIntentDispatcher();
472
+ const { dispatchPromise: dispatch } = useIntentDispatcher();
1094
473
  const threads = useMemo(() => model.sheet.threads?.filter((thread) => !!thread) ?? [], [
1095
474
  // TODO(thure): Surely we can find a better dependency for this…
1096
475
  JSON.stringify(model.sheet.threads)
@@ -1099,23 +478,18 @@ var useSelectThreadOnCellFocus = () => {
1099
478
  if (!cellAddress || !threads) {
1100
479
  return;
1101
480
  }
1102
- const closestThread = threads?.find(({ anchor }) => {
1103
- if (anchor) {
1104
- const range = parseThreadAnchorAsCellRange(anchor);
481
+ const closestThread = threads?.find((ref) => {
482
+ if (ref.target?.anchor) {
483
+ const range = parseThreadAnchorAsCellRange(ref.target.anchor);
1105
484
  return range ? inRange(range, cellAddress) : false;
1106
485
  } else {
1107
486
  return false;
1108
487
  }
1109
488
  });
1110
489
  if (closestThread) {
1111
- void dispatch([
1112
- {
1113
- action: "dxos.org/plugin/thread/action/select",
1114
- data: {
1115
- current: fullyQualifiedId2(closestThread)
1116
- }
1117
- }
1118
- ]);
490
+ void dispatch(createIntent(ThreadAction.Select, {
491
+ current: fullyQualifiedId2(closestThread)
492
+ }));
1119
493
  }
1120
494
  }, [
1121
495
  dispatch,
@@ -1126,7 +500,7 @@ var useSelectThreadOnCellFocus = () => {
1126
500
  }, [
1127
501
  selectClosestThread
1128
502
  ]);
1129
- useEffect2(() => {
503
+ useEffect(() => {
1130
504
  if (!cursor) {
1131
505
  return;
1132
506
  }
@@ -1170,10 +544,10 @@ var projectCellProps = (model, col, row) => {
1170
544
  row
1171
545
  };
1172
546
  const rawValue = model.getValue(address);
1173
- const ranges = model.sheet.ranges?.filter(({ range }) => inRange(rangeFromIndex(model.sheet, range), address));
547
+ const ranges = model.sheet.ranges?.filter(({ range }) => inRange2(rangeFromIndex(model.sheet, range), address));
1174
548
  const threadRefs = model.sheet.threads?.filter((thread) => {
1175
- const range = thread?.anchor && parseThreadAnchorAsCellRange(thread.anchor);
1176
- return thread && range ? inRange(range, address) : false;
549
+ const range = thread.target?.anchor && parseThreadAnchorAsCellRange(thread.target.anchor);
550
+ return thread && range ? inRange2(range, address) : false;
1177
551
  }).map((thread) => fullyQualifiedId3(thread)).join(" ");
1178
552
  const description = model.getValueDescription(address);
1179
553
  const type = description?.type;
@@ -1247,9 +621,9 @@ var cellGetter = (model) => {
1247
621
  };
1248
622
  };
1249
623
  var useSheetModelDxGridProps = (dxGrid, model) => {
1250
- const [columns, setColumns] = useState3(createDxGridColumns(model));
1251
- const [rows, setRows] = useState3(createDxGridRows(model));
1252
- useEffect3(() => {
624
+ const [columns, setColumns] = useState2(createDxGridColumns(model));
625
+ const [rows, setRows] = useState2(createDxGridRows(model));
626
+ useEffect2(() => {
1253
627
  const cellsAccessor = createDocAccessor(model.sheet, [
1254
628
  "cells"
1255
629
  ]);
@@ -1269,7 +643,7 @@ var useSheetModelDxGridProps = (dxGrid, model) => {
1269
643
  model,
1270
644
  dxGrid
1271
645
  ]);
1272
- useEffect3(() => {
646
+ useEffect2(() => {
1273
647
  const columnMetaAccessor = createDocAccessor(model.sheet, [
1274
648
  "columnMeta"
1275
649
  ]);
@@ -1346,9 +720,9 @@ var sheetColDefault = {
1346
720
  var GridSheet = () => {
1347
721
  const { t } = useTranslation3(SHEET_PLUGIN);
1348
722
  const { id, model, editing, setCursor, setRange, cursor, cursorFallbackRange, activeRefs, ignoreAttention } = useSheetContext();
1349
- const [dxGrid, setDxGrid] = useState4(null);
1350
- const [extraplanarFocus, setExtraplanarFocus] = useState4(null);
1351
- const dispatch = useIntentDispatcher2();
723
+ const [dxGrid, setDxGrid] = useState3(null);
724
+ const [extraplanarFocus, setExtraplanarFocus] = useState3(null);
725
+ const { dispatchPromise: dispatch } = useIntentDispatcher2();
1352
726
  const rangeController = useRef();
1353
727
  const { hasAttention } = useAttention(id);
1354
728
  const handleFocus = useCallback4((event) => {
@@ -1429,7 +803,7 @@ var GridSheet = () => {
1429
803
  };
1430
804
  }
1431
805
  if (editing) {
1432
- rangeController.current?.setRange(rangeToA1Notation(range));
806
+ rangeController.current?.setRange(rangeToA1Notation2(range));
1433
807
  } else {
1434
808
  setRange(range.to ? range : void 0);
1435
809
  }
@@ -1533,7 +907,7 @@ var GridSheet = () => {
1533
907
  selectEntireAxis
1534
908
  ]);
1535
909
  const contextMenuAnchorRef = useRef(null);
1536
- const [contextMenuOpen, setContextMenuOpen] = useState4(null);
910
+ const [contextMenuOpen, setContextMenuOpen] = useState3(null);
1537
911
  const contextMenuAxis = contextMenuOpen?.plane.startsWith("frozenRows") ? "col" : "row";
1538
912
  const handleContextMenu = useCallback4((event) => {
1539
913
  const cell = closestCell(event.target);
@@ -1547,24 +921,17 @@ var GridSheet = () => {
1547
921
  switch (operation) {
1548
922
  case "insert-before":
1549
923
  case "insert-after":
1550
- return dispatch({
1551
- action: SheetAction.INSERT_AXIS,
1552
- data: {
1553
- model,
1554
- axis: contextMenuAxis,
1555
- index: contextMenuOpen[contextMenuAxis] + (operation === "insert-before" ? 0 : 1)
1556
- }
1557
- });
1558
- break;
924
+ return dispatch(createIntent2(SheetAction.InsertAxis, {
925
+ model,
926
+ axis: contextMenuAxis,
927
+ index: contextMenuOpen[contextMenuAxis] + (operation === "insert-before" ? 0 : 1)
928
+ }));
1559
929
  case "drop":
1560
- return dispatch({
1561
- action: SheetAction.DROP_AXIS,
1562
- data: {
1563
- model,
1564
- axis: contextMenuAxis,
1565
- axisIndex: model.sheet[contextMenuAxis === "row" ? "rows" : "columns"][contextMenuOpen[contextMenuAxis]]
1566
- }
1567
- });
930
+ return dispatch(createIntent2(SheetAction.DropAxis, {
931
+ model,
932
+ axis: contextMenuAxis,
933
+ axisIndex: model.sheet[contextMenuAxis === "row" ? "rows" : "columns"][contextMenuOpen[contextMenuAxis]]
934
+ }));
1568
935
  }
1569
936
  }, [
1570
937
  contextMenuAxis,
@@ -1612,7 +979,7 @@ var GridSheet = () => {
1612
979
  onBlur: handleBlur
1613
980
  }), /* @__PURE__ */ React5.createElement(Grid2.Content, {
1614
981
  initialCells,
1615
- limitColumns: DEFAULT_COLUMNS,
982
+ limitColumns: DEFAULT_COLS,
1616
983
  limitRows: DEFAULT_ROWS,
1617
984
  columns,
1618
985
  rows,
@@ -1672,4 +1039,4 @@ export {
1672
1039
  SheetObjectSettings,
1673
1040
  SheetContainer
1674
1041
  };
1675
- //# sourceMappingURL=chunk-E5WQ7U7G.mjs.map
1042
+ //# sourceMappingURL=chunk-A374JPWV.mjs.map