@dxos/plugin-sheet 0.7.4 → 0.7.5-main.937ce75

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