@dxos/plugin-sheet 0.6.13-main.548ca8d → 0.6.13-main.ed424a1

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 (79) hide show
  1. package/dist/lib/browser/{SheetContainer-NDNIS44E.mjs → SheetContainer-RVRACGCZ.mjs} +107 -82
  2. package/dist/lib/browser/SheetContainer-RVRACGCZ.mjs.map +7 -0
  3. package/dist/lib/browser/{chunk-GKI67SEF.mjs → chunk-BWN5DZWZ.mjs} +16 -11
  4. package/dist/lib/browser/chunk-BWN5DZWZ.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-AQSGDA4X.mjs → chunk-HOG37RYS.mjs} +92 -178
  6. package/dist/lib/browser/chunk-HOG37RYS.mjs.map +7 -0
  7. package/dist/lib/browser/index.mjs +2 -2
  8. package/dist/lib/browser/meta.json +1 -1
  9. package/dist/lib/browser/types.mjs +3 -3
  10. package/dist/lib/node/{SheetContainer-YSQGJD7K.cjs → SheetContainer-J7XROAMN.cjs} +113 -89
  11. package/dist/lib/node/SheetContainer-J7XROAMN.cjs.map +7 -0
  12. package/dist/lib/node/{chunk-6F43RV45.cjs → chunk-AXQZA2YS.cjs} +103 -186
  13. package/dist/lib/node/chunk-AXQZA2YS.cjs.map +7 -0
  14. package/dist/lib/node/{chunk-ER3PM7GD.cjs → chunk-NZARD7UP.cjs} +20 -15
  15. package/dist/lib/node/chunk-NZARD7UP.cjs.map +7 -0
  16. package/dist/lib/node/index.cjs +18 -18
  17. package/dist/lib/node/meta.json +1 -1
  18. package/dist/lib/node/types.cjs +7 -7
  19. package/dist/lib/node/types.cjs.map +1 -1
  20. package/dist/lib/node-esm/{SheetContainer-M7WRMZDU.mjs → SheetContainer-YWQVKHQB.mjs} +107 -82
  21. package/dist/lib/node-esm/SheetContainer-YWQVKHQB.mjs.map +7 -0
  22. package/dist/lib/node-esm/{chunk-ELTFPX5B.mjs → chunk-BPXXIAOQ.mjs} +92 -178
  23. package/dist/lib/node-esm/chunk-BPXXIAOQ.mjs.map +7 -0
  24. package/dist/lib/node-esm/{chunk-ZVLLQ2PJ.mjs → chunk-WFDTY3IC.mjs} +16 -11
  25. package/dist/lib/node-esm/chunk-WFDTY3IC.mjs.map +7 -0
  26. package/dist/lib/node-esm/index.mjs +2 -2
  27. package/dist/lib/node-esm/meta.json +1 -1
  28. package/dist/lib/node-esm/types.mjs +3 -3
  29. package/dist/types/src/components/GridSheet/GridSheet.d.ts.map +1 -1
  30. package/dist/types/src/components/GridSheet/util.d.ts +2 -2
  31. package/dist/types/src/components/GridSheet/util.d.ts.map +1 -1
  32. package/dist/types/src/components/SheetContainer/SheetContainer.d.ts.map +1 -1
  33. package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +1 -1
  34. package/dist/types/src/components/SheetContext/SheetContext.d.ts +1 -2
  35. package/dist/types/src/components/SheetContext/SheetContext.d.ts.map +1 -1
  36. package/dist/types/src/components/Toolbar/Toolbar.d.ts +11 -17
  37. package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
  38. package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +1 -2
  39. package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -1
  40. package/dist/types/src/components/index.d.ts.map +1 -1
  41. package/dist/types/src/defs/index.d.ts +1 -0
  42. package/dist/types/src/defs/index.d.ts.map +1 -1
  43. package/dist/types/src/defs/sheet-range-types.d.ts +13 -0
  44. package/dist/types/src/defs/sheet-range-types.d.ts.map +1 -0
  45. package/dist/types/src/hooks/index.d.ts +0 -1
  46. package/dist/types/src/hooks/index.d.ts.map +1 -1
  47. package/dist/types/src/model/index.d.ts +0 -1
  48. package/dist/types/src/model/index.d.ts.map +1 -1
  49. package/dist/types/src/types.d.ts +39 -20
  50. package/dist/types/src/types.d.ts.map +1 -1
  51. package/package.json +35 -34
  52. package/src/components/GridSheet/GridSheet.stories.tsx +2 -2
  53. package/src/components/GridSheet/GridSheet.tsx +5 -3
  54. package/src/components/GridSheet/util.ts +24 -10
  55. package/src/components/SheetContainer/SheetContainer.stories.tsx +2 -2
  56. package/src/components/SheetContainer/SheetContainer.tsx +3 -28
  57. package/src/components/SheetContext/SheetContext.tsx +5 -9
  58. package/src/components/Toolbar/Toolbar.tsx +116 -68
  59. package/src/defs/index.ts +1 -0
  60. package/src/defs/sheet-range-types.ts +46 -0
  61. package/src/defs/util.ts +1 -1
  62. package/src/hooks/index.ts +0 -1
  63. package/src/model/index.ts +0 -1
  64. package/src/types.ts +5 -11
  65. package/dist/lib/browser/SheetContainer-NDNIS44E.mjs.map +0 -7
  66. package/dist/lib/browser/chunk-AQSGDA4X.mjs.map +0 -7
  67. package/dist/lib/browser/chunk-GKI67SEF.mjs.map +0 -7
  68. package/dist/lib/node/SheetContainer-YSQGJD7K.cjs.map +0 -7
  69. package/dist/lib/node/chunk-6F43RV45.cjs.map +0 -7
  70. package/dist/lib/node/chunk-ER3PM7GD.cjs.map +0 -7
  71. package/dist/lib/node-esm/SheetContainer-M7WRMZDU.mjs.map +0 -7
  72. package/dist/lib/node-esm/chunk-ELTFPX5B.mjs.map +0 -7
  73. package/dist/lib/node-esm/chunk-ZVLLQ2PJ.mjs.map +0 -7
  74. package/dist/types/src/hooks/useFormattingModel.d.ts +0 -3
  75. package/dist/types/src/hooks/useFormattingModel.d.ts.map +0 -1
  76. package/dist/types/src/model/formatting-model.d.ts +0 -19
  77. package/dist/types/src/model/formatting-model.d.ts.map +0 -1
  78. package/src/hooks/useFormattingModel.ts +0 -11
  79. package/src/model/formatting-model.ts +0 -116
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SheetType
3
- } from "./chunk-GKI67SEF.mjs";
3
+ } from "./chunk-BWN5DZWZ.mjs";
4
4
  import {
5
5
  SHEET_PLUGIN
6
6
  } from "./chunk-D3QTX46O.mjs";
@@ -133,7 +133,7 @@ var createSheet = ({ name, cells, ...size } = {}) => {
133
133
  columns: [],
134
134
  rowMeta: {},
135
135
  columnMeta: {},
136
- formatting: []
136
+ ranges: []
137
137
  });
138
138
  initialize(sheet, size);
139
139
  if (cells) {
@@ -156,13 +156,6 @@ var addressFromIndex = (sheet, idx) => {
156
156
  row: sheet.rows.indexOf(row)
157
157
  };
158
158
  };
159
- var rangeFromIndex = (sheet, idx) => {
160
- const [from, to] = idx.split(":").map((index) => addressFromIndex(sheet, index));
161
- return {
162
- from,
163
- to
164
- };
165
- };
166
159
  var closest = (cursor, cells) => {
167
160
  let closestCell2;
168
161
  let closestDistance = Number.MAX_SAFE_INTEGER;
@@ -185,6 +178,34 @@ var compareIndexPositions = (sheet, indexA, indexB) => {
185
178
  }
186
179
  };
187
180
 
181
+ // packages/plugins/plugin-sheet/src/defs/sheet-range-types.ts
182
+ var cellClassNameForRange = ({ key, value }) => {
183
+ switch (key) {
184
+ case "align":
185
+ switch (value) {
186
+ case "start":
187
+ return "text-start";
188
+ case "center":
189
+ return "text-center";
190
+ case "end":
191
+ return "text-end";
192
+ default:
193
+ return void 0;
194
+ }
195
+ case "comment":
196
+ return "bg-gridComment";
197
+ case "style":
198
+ switch (value) {
199
+ case "highlight":
200
+ return "bg-gridHighlight";
201
+ default:
202
+ return void 0;
203
+ }
204
+ default:
205
+ return void 0;
206
+ }
207
+ };
208
+
188
209
  // packages/plugins/plugin-sheet/src/extensions/compute.ts
189
210
  import { syntaxTree } from "@codemirror/language";
190
211
  import { RangeSetBuilder, StateEffect, StateField } from "@codemirror/state";
@@ -410,13 +431,14 @@ import { useAsyncState } from "@dxos/react-hooks";
410
431
  import React4 from "react";
411
432
 
412
433
  // packages/plugins/plugin-sheet/src/components/GridSheet/GridSheet.tsx
413
- import React3, { useCallback as useCallback2, useMemo as useMemo4, useRef } from "react";
434
+ import React3, { useCallback as useCallback2, useMemo as useMemo3, useRef } from "react";
414
435
  import { useAttention } from "@dxos/react-ui-attention";
415
436
  import { Grid as Grid2, editorKeys, GridCellEditor, closestCell } from "@dxos/react-ui-grid";
416
437
 
417
438
  // packages/plugins/plugin-sheet/src/components/GridSheet/util.ts
418
439
  import { useEffect, useLayoutEffect, useState } from "react";
419
440
  import { createDocAccessor } from "@dxos/react-client/echo";
441
+ import { parseValue, cellClassesForFieldType } from "@dxos/react-ui-data";
420
442
  import { colToA1Notation, rowToA1Notation } from "@dxos/react-ui-grid";
421
443
  import { mx as mx2 } from "@dxos/react-ui-theme";
422
444
  var dxGridCellIndexToSheetCellAddress = (index) => {
@@ -452,7 +474,26 @@ var createDxGridRows = (model) => {
452
474
  grid: {}
453
475
  });
454
476
  };
455
- var gridCellGetter = (model, formatting) => {
477
+ var projectCellProps = (model, col, row) => {
478
+ const address = {
479
+ col,
480
+ row
481
+ };
482
+ const rawValue = model.getValue(address);
483
+ if (rawValue === void 0 || rawValue === null) {
484
+ return {
485
+ value: ""
486
+ };
487
+ }
488
+ const ranges = model.sheet.ranges?.filter(({ range }) => inRange(range, address));
489
+ const type = model.getValueType(address);
490
+ const classNames = ranges?.map(cellClassNameForRange).reverse();
491
+ return {
492
+ value: parseValue(type, rawValue),
493
+ className: mx2(cellClassesForFieldType(type), classNames)
494
+ };
495
+ };
496
+ var gridCellGetter = (model) => {
456
497
  const cachedGridCells = {};
457
498
  return (nextBounds) => {
458
499
  [
@@ -463,16 +504,10 @@ var gridCellGetter = (model, formatting) => {
463
504
  ].forEach((_2, r0) => {
464
505
  const col = nextBounds.start.col + c0;
465
506
  const row = nextBounds.start.row + r0;
466
- const cell = formatting.getFormatting({
467
- col,
468
- row
469
- });
507
+ const cell = projectCellProps(model, col, row);
470
508
  if (cell.value) {
471
509
  cachedGridCells;
472
- cachedGridCells[`${col},${row}`] = {
473
- value: cell.value,
474
- className: mx2(cell.classNames)
475
- };
510
+ cachedGridCells[`${col},${row}`] = cell;
476
511
  }
477
512
  });
478
513
  });
@@ -488,8 +523,8 @@ var colLabelCell = (col) => ({
488
523
  value: colToA1Notation(col),
489
524
  resizeHandle: "col"
490
525
  });
491
- var cellGetter = (model, formatting) => {
492
- const getGridCells = gridCellGetter(model, formatting);
526
+ var cellGetter = (model) => {
527
+ const getGridCells = gridCellGetter(model);
493
528
  return (nextBounds, plane) => {
494
529
  switch (plane) {
495
530
  case "grid":
@@ -515,7 +550,7 @@ var cellGetter = (model, formatting) => {
515
550
  }
516
551
  };
517
552
  };
518
- var useSheetModelDxGridProps = (dxGridRef, model, formatting) => {
553
+ var useSheetModelDxGridProps = (dxGridRef, model) => {
519
554
  const [columns, setColumns] = useState(createDxGridColumns(model));
520
555
  const [rows, setRows] = useState(createDxGridColumns(model));
521
556
  useLayoutEffect(() => {
@@ -523,7 +558,7 @@ var useSheetModelDxGridProps = (dxGridRef, model, formatting) => {
523
558
  "cells"
524
559
  ]);
525
560
  if (dxGridRef.current) {
526
- dxGridRef.current.getCells = cellGetter(model, formatting);
561
+ dxGridRef.current.getCells = cellGetter(model);
527
562
  }
528
563
  const handleCellsUpdate = () => {
529
564
  dxGridRef.current?.requestUpdate("initialCells");
@@ -531,8 +566,7 @@ var useSheetModelDxGridProps = (dxGridRef, model, formatting) => {
531
566
  cellsAccessor.handle.addListener("change", handleCellsUpdate);
532
567
  return () => cellsAccessor.handle.removeListener("change", handleCellsUpdate);
533
568
  }, [
534
- model,
535
- formatting
569
+ model
536
570
  ]);
537
571
  useEffect(() => {
538
572
  const columnMetaAccessor = createDocAccessor(model.sheet, [
@@ -562,8 +596,8 @@ var useSheetModelDxGridProps = (dxGridRef, model, formatting) => {
562
596
  };
563
597
  };
564
598
 
565
- // packages/plugins/plugin-sheet/src/hooks/useFormattingModel.ts
566
- import { useMemo } from "react";
599
+ // packages/plugins/plugin-sheet/src/hooks/useSheetModel.ts
600
+ import { useEffect as useEffect2, useState as useState2 } from "react";
567
601
 
568
602
  // packages/plugins/plugin-sheet/src/model/decorations.ts
569
603
  import { create as create2 } from "@dxos/echo-schema";
@@ -604,118 +638,6 @@ var createDecorations = () => {
604
638
  };
605
639
  };
606
640
 
607
- // packages/plugins/plugin-sheet/src/model/formatting-model.ts
608
- import { FieldValueType } from "@dxos/schema";
609
- var FormattingModel = class {
610
- constructor(_model) {
611
- this._model = _model;
612
- }
613
- /**
614
- * Get formatted string value and className for cell.
615
- */
616
- getFormatting(cell) {
617
- const value = this._model.getValue(cell);
618
- if (value === void 0 || value === null) {
619
- return {};
620
- }
621
- const locales = void 0;
622
- const idx = addressToIndex(this._model.sheet, cell);
623
- let formatting = this._model.sheet.formatting.find?.(({ range }) => range === idx);
624
- const classNames = [
625
- ...formatting?.classNames ?? []
626
- ];
627
- for (const [idx2, _formatting] of Object.entries(this._model.sheet.formatting)) {
628
- const range = rangeFromIndex(this._model.sheet, idx2);
629
- if (inRange(range, cell)) {
630
- if (_formatting.classNames) {
631
- classNames.push(..._formatting.classNames);
632
- }
633
- if (_formatting.type) {
634
- formatting = _formatting;
635
- }
636
- }
637
- }
638
- const defaultNumber = "justify-end font-mono";
639
- const type = formatting?.type ?? this._model.getValueType(cell);
640
- switch (type) {
641
- case FieldValueType.Boolean: {
642
- return {
643
- value: value.toLocaleString().toUpperCase(),
644
- classNames: [
645
- ...classNames,
646
- value ? "!text-greenText" : "!text-orangeText"
647
- ]
648
- };
649
- }
650
- //
651
- // Numbers.
652
- //
653
- case FieldValueType.Number: {
654
- return {
655
- value: value.toLocaleString(locales),
656
- classNames: [
657
- ...classNames,
658
- defaultNumber
659
- ]
660
- };
661
- }
662
- case FieldValueType.Percent: {
663
- return {
664
- value: value * 100 + "%",
665
- classNames: [
666
- ...classNames,
667
- defaultNumber
668
- ]
669
- };
670
- }
671
- case FieldValueType.Currency: {
672
- return {
673
- value: value.toLocaleString(locales, {
674
- style: "currency",
675
- currency: "USD",
676
- minimumFractionDigits: 2,
677
- maximumFractionDigits: 2
678
- }),
679
- classNames: [
680
- ...classNames,
681
- defaultNumber
682
- ]
683
- };
684
- }
685
- //
686
- // Dates.
687
- //
688
- case FieldValueType.DateTime: {
689
- const date = this._model.toLocalDate(value);
690
- return {
691
- value: date.toLocaleString(locales),
692
- classNames
693
- };
694
- }
695
- case FieldValueType.Date: {
696
- const date = this._model.toLocalDate(value);
697
- return {
698
- value: date.toLocaleDateString(locales),
699
- classNames
700
- };
701
- }
702
- case FieldValueType.Time: {
703
- const date = this._model.toLocalDate(value);
704
- return {
705
- value: date.toLocaleTimeString(locales),
706
- classNames
707
- };
708
- }
709
- default: {
710
- return {
711
- value: String(value),
712
- classNames
713
- };
714
- }
715
- }
716
- }
717
- };
718
-
719
641
  // packages/plugins/plugin-sheet/src/model/sheet-model.ts
720
642
  import { Event } from "@dxos/async";
721
643
  import { Resource } from "@dxos/context";
@@ -723,17 +645,17 @@ import { getTypename } from "@dxos/echo-schema";
723
645
  import { invariant as invariant3 } from "@dxos/invariant";
724
646
  import { PublicKey } from "@dxos/keys";
725
647
  import { log } from "@dxos/log";
726
- import { FieldValueType as FieldValueType2 } from "@dxos/schema";
648
+ import { FieldValueType } from "@dxos/schema";
727
649
  import { DetailedCellError, ExportedCellChange } from "#hyperformula";
728
650
  var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-sheet/src/model/sheet-model.ts";
729
651
  var typeMap = {
730
- BOOLEAN: FieldValueType2.Boolean,
731
- NUMBER_RAW: FieldValueType2.Number,
732
- NUMBER_PERCENT: FieldValueType2.Percent,
733
- NUMBER_CURRENCY: FieldValueType2.Currency,
734
- NUMBER_DATETIME: FieldValueType2.DateTime,
735
- NUMBER_DATE: FieldValueType2.Date,
736
- NUMBER_TIME: FieldValueType2.Time
652
+ BOOLEAN: FieldValueType.Boolean,
653
+ NUMBER_RAW: FieldValueType.Number,
654
+ NUMBER_PERCENT: FieldValueType.Percent,
655
+ NUMBER_CURRENCY: FieldValueType.Currency,
656
+ NUMBER_DATETIME: FieldValueType.DateTime,
657
+ NUMBER_DATE: FieldValueType.Date,
658
+ NUMBER_TIME: FieldValueType.Time
737
659
  };
738
660
  var getTopLeft = (range) => {
739
661
  const to = range.to ?? range.from;
@@ -1204,15 +1126,7 @@ var SheetModel = class extends Resource {
1204
1126
  }
1205
1127
  };
1206
1128
 
1207
- // packages/plugins/plugin-sheet/src/hooks/useFormattingModel.ts
1208
- var useFormattingModel = (model) => {
1209
- return useMemo(() => model && new FormattingModel(model), [
1210
- model
1211
- ]);
1212
- };
1213
-
1214
1129
  // packages/plugins/plugin-sheet/src/hooks/useSheetModel.ts
1215
- import { useEffect as useEffect2, useState as useState2 } from "react";
1216
1130
  var useSheetModel = (graph, sheet, { readonly } = {}) => {
1217
1131
  const [model, setModel] = useState2();
1218
1132
  useEffect2(() => {
@@ -1241,7 +1155,7 @@ var useSheetModel = (graph, sheet, { readonly } = {}) => {
1241
1155
 
1242
1156
  // packages/plugins/plugin-sheet/src/hooks/threads.ts
1243
1157
  import { effect } from "@preact/signals-core";
1244
- import { useCallback, useEffect as useEffect3, useMemo as useMemo2 } from "react";
1158
+ import { useCallback, useEffect as useEffect3, useMemo } from "react";
1245
1159
  import { LayoutAction, useIntentDispatcher, useIntentResolver } from "@dxos/app-framework";
1246
1160
  import { debounce as debounce2 } from "@dxos/async";
1247
1161
  import { fullyQualifiedId } from "@dxos/react-client/echo";
@@ -1266,11 +1180,11 @@ var useUpdateFocusedCellOnThreadSelection = (model, grid) => {
1266
1180
  };
1267
1181
  var useSelectThreadOnCellFocus = (model, cursor) => {
1268
1182
  const dispatch = useIntentDispatcher();
1269
- const activeThreads = useMemo2(() => model.sheet.threads?.filter((thread) => !!thread && thread.status === "active") ?? [], [
1183
+ const activeThreads = useMemo(() => model.sheet.threads?.filter((thread) => !!thread && thread.status === "active") ?? [], [
1270
1184
  // TODO(thure): Surely we can find a better dependency for this…
1271
1185
  JSON.stringify(model.sheet.threads)
1272
1186
  ]);
1273
- const activeThreadAddresses = useMemo2(() => activeThreads.map((thread) => thread.anchor).filter((anchor) => anchor !== void 0).map((anchor) => addressFromIndex(model.sheet, anchor)), [
1187
+ const activeThreadAddresses = useMemo(() => activeThreads.map((thread) => thread.anchor).filter((anchor) => anchor !== void 0).map((anchor) => addressFromIndex(model.sheet, anchor)), [
1274
1188
  activeThreads,
1275
1189
  model.sheet
1276
1190
  ]);
@@ -1298,7 +1212,7 @@ var useSelectThreadOnCellFocus = (model, cursor) => {
1298
1212
  activeThreadAddresses,
1299
1213
  model.sheet
1300
1214
  ]);
1301
- const debounced = useMemo2(() => {
1215
+ const debounced = useMemo(() => {
1302
1216
  return debounce2((cellCoords) => requestAnimationFrame(() => selectClosestThread(cellCoords)), 50);
1303
1217
  }, [
1304
1218
  selectClosestThread
@@ -1323,10 +1237,10 @@ var createThreadDecoration = (cellIndex, threadId, sheetId) => {
1323
1237
  };
1324
1238
  };
1325
1239
  var useThreadDecorations = (model, decorations) => {
1326
- const sheet = useMemo2(() => model.sheet, [
1240
+ const sheet = useMemo(() => model.sheet, [
1327
1241
  model.sheet
1328
1242
  ]);
1329
- const sheetId = useMemo2(() => fullyQualifiedId(sheet), [
1243
+ const sheetId = useMemo(() => fullyQualifiedId(sheet), [
1330
1244
  sheet
1331
1245
  ]);
1332
1246
  useEffect3(() => {
@@ -1360,7 +1274,7 @@ var useThreadDecorations = (model, decorations) => {
1360
1274
  };
1361
1275
 
1362
1276
  // packages/plugins/plugin-sheet/src/components/SheetContext/SheetContext.tsx
1363
- import React2, { createContext as createContext2, useContext, useMemo as useMemo3, useState as useState3 } from "react";
1277
+ import React2, { createContext as createContext2, useContext, useMemo as useMemo2, useState as useState3 } from "react";
1364
1278
  import { invariant as invariant4 } from "@dxos/invariant";
1365
1279
  import { fullyQualifiedId as fullyQualifiedId2 } from "@dxos/react-client/echo";
1366
1280
  import { Grid, useGridContext } from "@dxos/react-ui-grid";
@@ -1370,7 +1284,7 @@ var useSheetContext = () => {
1370
1284
  const context = useContext(SheetContext);
1371
1285
  invariant4(context, void 0, {
1372
1286
  F: __dxlog_file3,
1373
- L: 46,
1287
+ L: 45,
1374
1288
  S: void 0,
1375
1289
  A: [
1376
1290
  "context",
@@ -1379,9 +1293,9 @@ var useSheetContext = () => {
1379
1293
  });
1380
1294
  return context;
1381
1295
  };
1382
- var SheetProviderImpl = ({ model, formatting, onInfo, children, __gridScope }) => {
1296
+ var SheetProviderImpl = ({ model, onInfo, children, __gridScope }) => {
1383
1297
  const { id, editing, setEditing } = useGridContext("SheetProvider", __gridScope);
1384
- const decorations = useMemo3(() => createDecorations(), []);
1298
+ const decorations = useMemo2(() => createDecorations(), []);
1385
1299
  const [cursor, setCursor] = useState3();
1386
1300
  const [range, setRange] = useState3();
1387
1301
  useSelectThreadOnCellFocus(model, cursor);
@@ -1390,7 +1304,6 @@ var SheetProviderImpl = ({ model, formatting, onInfo, children, __gridScope }) =
1390
1304
  value: {
1391
1305
  id,
1392
1306
  model,
1393
- formatting,
1394
1307
  editing,
1395
1308
  setEditing,
1396
1309
  cursor,
@@ -1407,12 +1320,10 @@ var SheetProvider = ({ children, graph, sheet, readonly, onInfo }) => {
1407
1320
  const model = useSheetModel(graph, sheet, {
1408
1321
  readonly
1409
1322
  });
1410
- const formatting = useFormattingModel(model);
1411
- return !model || !formatting ? null : /* @__PURE__ */ React2.createElement(Grid.Root, {
1323
+ return !model ? null : /* @__PURE__ */ React2.createElement(Grid.Root, {
1412
1324
  id: fullyQualifiedId2(sheet)
1413
1325
  }, /* @__PURE__ */ React2.createElement(SheetProviderImpl, {
1414
1326
  model,
1415
- formatting,
1416
1327
  onInfo
1417
1328
  }, children));
1418
1329
  };
@@ -1453,17 +1364,19 @@ var sheetColDefault = {
1453
1364
  }
1454
1365
  };
1455
1366
  var GridSheet = () => {
1456
- const { id, model, formatting, editing, setEditing, setCursor, setRange } = useSheetContext();
1367
+ const { id, model, editing, setEditing, setCursor, setRange } = useSheetContext();
1457
1368
  const dxGrid = useRef(null);
1458
1369
  const rangeNotifier = useRef();
1459
1370
  const { hasAttention } = useAttention(id);
1460
1371
  const handleFocus = useCallback2((event) => {
1461
1372
  if (!editing) {
1462
1373
  const cell = closestCell(event.target);
1463
- setCursor(cell && cell.plane === "grid" ? {
1464
- col: cell.col,
1465
- row: cell.row
1466
- } : void 0);
1374
+ if (cell && cell.plane === "grid") {
1375
+ setCursor({
1376
+ col: cell.col,
1377
+ row: cell.row
1378
+ });
1379
+ }
1467
1380
  }
1468
1381
  }, [
1469
1382
  editing
@@ -1533,8 +1446,8 @@ var GridSheet = () => {
1533
1446
  }, [
1534
1447
  hasAttention
1535
1448
  ]);
1536
- const { columns, rows } = useSheetModelDxGridProps(dxGrid, model, formatting);
1537
- const extension = useMemo4(() => [
1449
+ const { columns, rows } = useSheetModelDxGridProps(dxGrid, model);
1450
+ const extension = useMemo3(() => [
1538
1451
  editorKeys({
1539
1452
  onClose: handleClose,
1540
1453
  ...editing?.initialContent && {
@@ -1579,7 +1492,7 @@ var GridSheet = () => {
1579
1492
  };
1580
1493
 
1581
1494
  // packages/plugins/plugin-sheet/src/components/index.ts
1582
- var SheetContainer = React4.lazy(() => import("./SheetContainer-NDNIS44E.mjs"));
1495
+ var SheetContainer = React4.lazy(() => import("./SheetContainer-RVRACGCZ.mjs"));
1583
1496
 
1584
1497
  // packages/plugins/plugin-sheet/src/hooks/useComputeGraph.ts
1585
1498
  var useComputeGraph = (space) => {
@@ -1601,6 +1514,7 @@ export {
1601
1514
  ComputeGraphContextProvider,
1602
1515
  addressToA1Notation,
1603
1516
  rangeToA1Notation,
1517
+ inRange,
1604
1518
  createSheet,
1605
1519
  addressToIndex,
1606
1520
  compareIndexPositions,
@@ -1611,4 +1525,4 @@ export {
1611
1525
  GridSheet,
1612
1526
  SheetContainer
1613
1527
  };
1614
- //# sourceMappingURL=chunk-AQSGDA4X.mjs.map
1528
+ //# sourceMappingURL=chunk-HOG37RYS.mjs.map