@dxos/plugin-sheet 0.6.12-main.ed7cda7 → 0.6.12-main.f9d0246

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 (119) hide show
  1. package/dist/lib/browser/{SheetContainer-V4GCCZTX.mjs → SheetContainer-VISF3VUB.mjs} +6 -6
  2. package/dist/lib/browser/{SheetContainer-V4GCCZTX.mjs.map → SheetContainer-VISF3VUB.mjs.map} +3 -3
  3. package/dist/lib/browser/{chunk-T3NJFTD4.mjs → chunk-WZMOZKQZ.mjs} +2 -2
  4. package/dist/lib/browser/{chunk-T3NJFTD4.mjs.map → chunk-WZMOZKQZ.mjs.map} +3 -3
  5. package/dist/lib/browser/{chunk-6ZMQVB4Z.mjs → chunk-Z2XOOC2R.mjs} +81 -62
  6. package/dist/lib/browser/chunk-Z2XOOC2R.mjs.map +7 -0
  7. package/dist/lib/browser/{chunk-U2JHW3L6.mjs → chunk-ZLJ2GRE2.mjs} +173 -42
  8. package/dist/lib/browser/chunk-ZLJ2GRE2.mjs.map +7 -0
  9. package/dist/lib/browser/{graph-T27BOBOV.mjs → graph-4XFKIHRL.mjs} +4 -4
  10. package/dist/lib/browser/index.mjs +15 -13
  11. package/dist/lib/browser/index.mjs.map +3 -3
  12. package/dist/lib/browser/meta.json +1 -1
  13. package/dist/lib/browser/types.mjs +1 -1
  14. package/dist/lib/node/{SheetContainer-3ZY7MPWJ.cjs → SheetContainer-2MEALQWW.cjs} +14 -14
  15. package/dist/lib/node/{SheetContainer-3ZY7MPWJ.cjs.map → SheetContainer-2MEALQWW.cjs.map} +3 -3
  16. package/dist/lib/node/{chunk-OTTD7FBK.cjs → chunk-6DQABRGJ.cjs} +192 -60
  17. package/dist/lib/node/chunk-6DQABRGJ.cjs.map +7 -0
  18. package/dist/lib/node/{chunk-Q3HBHPRL.cjs → chunk-AOP42UAA.cjs} +5 -5
  19. package/dist/lib/node/{chunk-Q3HBHPRL.cjs.map → chunk-AOP42UAA.cjs.map} +3 -3
  20. package/dist/lib/node/{chunk-DD6FIXWC.cjs → chunk-P5QYYEHQ.cjs} +86 -67
  21. package/dist/lib/node/chunk-P5QYYEHQ.cjs.map +7 -0
  22. package/dist/lib/node/{graph-SPKGX7W4.cjs → graph-2LRDUXBZ.cjs} +14 -14
  23. package/dist/lib/node/graph-2LRDUXBZ.cjs.map +7 -0
  24. package/dist/lib/node/index.cjs +25 -24
  25. package/dist/lib/node/index.cjs.map +3 -3
  26. package/dist/lib/node/meta.json +1 -1
  27. package/dist/lib/node/types.cjs +8 -8
  28. package/dist/lib/node/types.cjs.map +1 -1
  29. package/dist/lib/node-esm/{SheetContainer-PXSJX6XK.mjs → SheetContainer-RPSUSXWS.mjs} +6 -6
  30. package/dist/lib/node-esm/{SheetContainer-PXSJX6XK.mjs.map → SheetContainer-RPSUSXWS.mjs.map} +3 -3
  31. package/dist/lib/node-esm/{chunk-D6KU5MI7.mjs → chunk-4MM7THJW.mjs} +81 -62
  32. package/dist/lib/node-esm/chunk-4MM7THJW.mjs.map +7 -0
  33. package/dist/lib/node-esm/{chunk-7HVSOTGA.mjs → chunk-5RLTCIE2.mjs} +173 -42
  34. package/dist/lib/node-esm/chunk-5RLTCIE2.mjs.map +7 -0
  35. package/dist/lib/node-esm/{chunk-BMNA27EX.mjs → chunk-RR2AO4SM.mjs} +2 -2
  36. package/dist/lib/node-esm/{chunk-BMNA27EX.mjs.map → chunk-RR2AO4SM.mjs.map} +3 -3
  37. package/dist/lib/node-esm/{graph-U67IO4UC.mjs → graph-WG5EKOMO.mjs} +4 -4
  38. package/dist/lib/node-esm/index.mjs +15 -13
  39. package/dist/lib/node-esm/index.mjs.map +3 -3
  40. package/dist/lib/node-esm/meta.json +1 -1
  41. package/dist/lib/node-esm/types.mjs +1 -1
  42. package/dist/types/src/SheetPlugin.d.ts.map +1 -1
  43. package/dist/types/src/components/GridSheet/GridSheet.d.ts +3 -3
  44. package/dist/types/src/components/GridSheet/GridSheet.d.ts.map +1 -1
  45. package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts +1 -1
  46. package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +1 -1
  47. package/dist/types/src/components/Sheet/Sheet.stories.d.ts.map +1 -1
  48. package/dist/types/src/components/Sheet/sheet-context.d.ts +3 -3
  49. package/dist/types/src/components/Sheet/sheet-context.d.ts.map +1 -1
  50. package/dist/types/src/components/SheetContainer.d.ts +1 -1
  51. package/dist/types/src/components/index.d.ts +1 -1
  52. package/dist/types/src/defs/types.d.ts.map +1 -1
  53. package/dist/types/src/defs/util.d.ts +1 -1
  54. package/dist/types/src/defs/util.d.ts.map +1 -1
  55. package/dist/types/src/extensions/compute.d.ts +5 -1
  56. package/dist/types/src/extensions/compute.d.ts.map +1 -1
  57. package/dist/types/src/extensions/compute.stories.d.ts.map +1 -1
  58. package/dist/types/src/graph/async-function.d.ts +7 -1
  59. package/dist/types/src/graph/async-function.d.ts.map +1 -1
  60. package/dist/types/src/graph/compute-graph.d.ts +12 -9
  61. package/dist/types/src/graph/compute-graph.d.ts.map +1 -1
  62. package/dist/types/src/graph/compute-graph.stories.d.ts.map +1 -1
  63. package/dist/types/src/graph/compute-graph.test.d.ts +2 -0
  64. package/dist/types/src/graph/compute-graph.test.d.ts.map +1 -0
  65. package/dist/types/src/graph/compute-node.d.ts +9 -2
  66. package/dist/types/src/graph/compute-node.d.ts.map +1 -1
  67. package/dist/types/src/graph/edge-function.d.ts.map +1 -1
  68. package/dist/types/src/graph/{custom-function.d.ts → testing/custom-function.d.ts} +3 -1
  69. package/dist/types/src/graph/testing/custom-function.d.ts.map +1 -0
  70. package/dist/types/src/graph/testing/index.d.ts +2 -0
  71. package/dist/types/src/graph/testing/index.d.ts.map +1 -0
  72. package/dist/types/src/hooks/useComputeGraph.d.ts.map +1 -1
  73. package/dist/types/src/hooks/useSheetModel.d.ts +2 -2
  74. package/dist/types/src/hooks/useSheetModel.d.ts.map +1 -1
  75. package/dist/types/src/model/sheet-model.d.ts +3 -3
  76. package/dist/types/src/model/sheet-model.d.ts.map +1 -1
  77. package/dist/types/src/testing/testing.d.ts +4 -5
  78. package/dist/types/src/testing/testing.d.ts.map +1 -1
  79. package/dist/types/src/types.d.ts +4 -3
  80. package/dist/types/src/types.d.ts.map +1 -1
  81. package/package.json +33 -33
  82. package/src/SheetPlugin.tsx +9 -7
  83. package/src/components/CellEditor/CellEditor.stories.tsx +1 -1
  84. package/src/components/GridSheet/GridSheet.stories.tsx +5 -4
  85. package/src/components/GridSheet/GridSheet.tsx +4 -4
  86. package/src/components/Sheet/Sheet.stories.tsx +21 -20
  87. package/src/components/Sheet/sheet-context.tsx +4 -4
  88. package/src/components/SheetContainer.tsx +2 -2
  89. package/src/defs/types.ts +1 -0
  90. package/src/defs/util.ts +19 -3
  91. package/src/extensions/compute.stories.tsx +18 -16
  92. package/src/extensions/compute.ts +72 -39
  93. package/src/graph/async-function.ts +13 -6
  94. package/src/graph/compute-graph.stories.tsx +4 -3
  95. package/src/graph/compute-graph.test.ts +127 -0
  96. package/src/graph/compute-graph.ts +64 -41
  97. package/src/graph/compute-node.ts +16 -5
  98. package/src/graph/edge-function.ts +1 -2
  99. package/src/graph/{custom-function.ts → testing/custom-function.ts} +10 -2
  100. package/src/graph/testing/index.ts +5 -0
  101. package/src/hooks/hooks.stories.tsx +3 -3
  102. package/src/hooks/useComputeGraph.ts +2 -1
  103. package/src/hooks/useSheetModel.ts +4 -7
  104. package/src/model/sheet-model.ts +44 -29
  105. package/src/testing/testing.tsx +17 -15
  106. package/src/types.ts +3 -3
  107. package/dist/lib/browser/chunk-6ZMQVB4Z.mjs.map +0 -7
  108. package/dist/lib/browser/chunk-U2JHW3L6.mjs.map +0 -7
  109. package/dist/lib/node/chunk-DD6FIXWC.cjs.map +0 -7
  110. package/dist/lib/node/chunk-OTTD7FBK.cjs.map +0 -7
  111. package/dist/lib/node/graph-SPKGX7W4.cjs.map +0 -7
  112. package/dist/lib/node-esm/chunk-7HVSOTGA.mjs.map +0 -7
  113. package/dist/lib/node-esm/chunk-D6KU5MI7.mjs.map +0 -7
  114. package/dist/types/src/graph/compute-graph.browser.test.d.ts +0 -2
  115. package/dist/types/src/graph/compute-graph.browser.test.d.ts.map +0 -1
  116. package/dist/types/src/graph/custom-function.d.ts.map +0 -1
  117. package/src/graph/compute-graph.browser.test.ts +0 -104
  118. /package/dist/lib/browser/{graph-T27BOBOV.mjs.map → graph-4XFKIHRL.mjs.map} +0 -0
  119. /package/dist/lib/node-esm/{graph-U67IO4UC.mjs.map → graph-WG5EKOMO.mjs.map} +0 -0
@@ -2,13 +2,13 @@ import { createRequire } from 'node:module';const require = createRequire(import
2
2
  import {
3
3
  SheetType,
4
4
  ValueTypeEnum
5
- } from "./chunk-BMNA27EX.mjs";
5
+ } from "./chunk-RR2AO4SM.mjs";
6
6
  import {
7
7
  SHEET_PLUGIN
8
8
  } from "./chunk-IU2L277A.mjs";
9
9
  import {
10
10
  createSheetName
11
- } from "./chunk-D6KU5MI7.mjs";
11
+ } from "./chunk-4MM7THJW.mjs";
12
12
 
13
13
  // packages/plugins/plugin-sheet/src/components/Sheet/Sheet.tsx
14
14
  import { DndContext, DragOverlay, KeyboardSensor, MouseSensor, TouchSensor, useDraggable, useDroppable, useSensor, useSensors } from "@dnd-kit/core";
@@ -57,7 +57,7 @@ var addressFromA1Notation = (ref) => {
57
57
  const match = ref.match(/([A-Z]+)(\d+)/);
58
58
  invariant(match, `Invalid notation: ${ref}`, {
59
59
  F: __dxlog_file,
60
- L: 39,
60
+ L: 40,
61
61
  S: void 0,
62
62
  A: [
63
63
  "match",
@@ -132,9 +132,9 @@ var initialize = (sheet, { rows = DEFAULT_ROWS, columns = DEFAULT_COLUMNS } = {}
132
132
  insertIndices(sheet.columns, 0, columns, MAX_COLUMNS);
133
133
  }
134
134
  };
135
- var createSheet = ({ title, ...size } = {}) => {
135
+ var createSheet = ({ name, cells, ...size } = {}) => {
136
136
  const sheet = create(SheetType, {
137
- title,
137
+ name,
138
138
  cells: {},
139
139
  rows: [],
140
140
  columns: [],
@@ -143,6 +143,14 @@ var createSheet = ({ title, ...size } = {}) => {
143
143
  formatting: {}
144
144
  });
145
145
  initialize(sheet, size);
146
+ if (cells) {
147
+ Object.entries(cells).forEach(([key, { value }]) => {
148
+ const idx = addressToIndex(sheet, addressFromA1Notation(key));
149
+ sheet.cells[idx] = {
150
+ value
151
+ };
152
+ });
153
+ }
146
154
  return sheet;
147
155
  };
148
156
  var addressToIndex = (sheet, cell) => {
@@ -537,15 +545,16 @@ var ComputeGraphContextProvider = ({ registry, children }) => {
537
545
  };
538
546
 
539
547
  // packages/plugins/plugin-sheet/src/components/index.ts
540
- var SheetContainer = React2.lazy(() => import("./SheetContainer-PXSJX6XK.mjs"));
548
+ var SheetContainer = React2.lazy(() => import("./SheetContainer-RPSUSXWS.mjs"));
541
549
 
542
550
  // packages/plugins/plugin-sheet/src/hooks/useComputeGraph.ts
543
551
  var useComputeGraph = (space) => {
544
552
  const { registry } = useContext(ComputeGraphContext) ?? raise(new Error("Missing ComputeGraphContext"));
545
- return useAsyncState(async () => space && registry.getOrCreateGraph(space), [
553
+ const [graph] = useAsyncState(async () => space && registry.getOrCreateGraph(space), [
546
554
  space,
547
555
  registry
548
556
  ]);
557
+ return graph;
549
558
  };
550
559
 
551
560
  // packages/plugins/plugin-sheet/src/hooks/useFormattingModel.ts
@@ -703,8 +712,6 @@ var SheetModel = class extends Resource {
703
712
  this._options = _options;
704
713
  this.id = `model-${PublicKey.random().truncate()}`;
705
714
  this.update = new Event();
706
- this._node = this._graph.getOrCreateNode(createSheetName(this._sheet.id));
707
- this.reset();
708
715
  }
709
716
  get graph() {
710
717
  return this._graph;
@@ -729,14 +736,15 @@ var SheetModel = class extends Resource {
729
736
  id: this.id
730
737
  }, {
731
738
  F: __dxlog_file2,
732
- L: 105,
739
+ L: 103,
733
740
  S: this,
734
741
  C: (f, a) => f(...a)
735
742
  });
736
743
  initialize(this._sheet);
737
- this.reset();
738
- const unsubscribe = this._graph.update.on(() => this.update.emit());
744
+ this._node = await this._graph.getOrCreateNode(createSheetName(this._sheet.id));
745
+ const unsubscribe = this._node.update.on((event) => this.update.emit(event));
739
746
  this._ctx.onDispose(unsubscribe);
747
+ this.reset();
740
748
  }
741
749
  /**
742
750
  * Update engine.
@@ -744,13 +752,31 @@ var SheetModel = class extends Resource {
744
752
  * @deprecated
745
753
  */
746
754
  reset() {
747
- this._node.hf.clearSheet(this._node.sheetId);
755
+ invariant2(this._node, void 0, {
756
+ F: __dxlog_file2,
757
+ L: 122,
758
+ S: this,
759
+ A: [
760
+ "this._node",
761
+ ""
762
+ ]
763
+ });
764
+ this._node.graph.hf.clearSheet(this._node.sheetId);
748
765
  Object.entries(this._sheet.cells).forEach(([key, { value }]) => {
766
+ invariant2(this._node, void 0, {
767
+ F: __dxlog_file2,
768
+ L: 125,
769
+ S: this,
770
+ A: [
771
+ "this._node",
772
+ ""
773
+ ]
774
+ });
749
775
  const { col, row } = addressFromIndex(this._sheet, key);
750
776
  if (typeof value === "string" && value.charAt(0) === "=") {
751
777
  value = this._graph.mapFormulaToNative(this._graph.mapFunctionBindingFromId(this.mapFormulaIndicesToRefs(value)));
752
778
  }
753
- this._node.hf.setCellContents({
779
+ this._node.graph.hf.setCellContents({
754
780
  sheet: this._node.sheetId,
755
781
  row,
756
782
  col
@@ -765,7 +791,7 @@ var SheetModel = class extends Resource {
765
791
  */
766
792
  // TODO(burdon): Remove.
767
793
  recalculate() {
768
- this._node.hf.rebuildAndRecalculate();
794
+ this._node?.graph.hf.rebuildAndRecalculate();
769
795
  }
770
796
  insertRows(i, n = 1) {
771
797
  insertIndices(this._sheet.rows, i, n, MAX_ROWS);
@@ -783,27 +809,63 @@ var SheetModel = class extends Resource {
783
809
  * Clear range of values.
784
810
  */
785
811
  clear(range) {
812
+ invariant2(this._node, void 0, {
813
+ F: __dxlog_file2,
814
+ L: 167,
815
+ S: this,
816
+ A: [
817
+ "this._node",
818
+ ""
819
+ ]
820
+ });
786
821
  const topLeft = getTopLeft(range);
787
822
  const values = this._iterRange(range, () => null);
788
- this._node.hf.setCellContents(toSimpleCellAddress(this._node.sheetId, topLeft), values);
823
+ this._node.graph.hf.setCellContents(toSimpleCellAddress(this._node.sheetId, topLeft), values);
789
824
  this._iterRange(range, (cell) => {
790
825
  const idx = addressToIndex(this._sheet, cell);
791
826
  delete this._sheet.cells[idx];
792
827
  });
793
828
  }
794
829
  cut(range) {
795
- this._node.hf.cut(toModelRange(this._node.sheetId, range));
830
+ invariant2(this._node, void 0, {
831
+ F: __dxlog_file2,
832
+ L: 178,
833
+ S: this,
834
+ A: [
835
+ "this._node",
836
+ ""
837
+ ]
838
+ });
839
+ this._node.graph.hf.cut(toModelRange(this._node.sheetId, range));
796
840
  this._iterRange(range, (cell) => {
797
841
  const idx = addressToIndex(this._sheet, cell);
798
842
  delete this._sheet.cells[idx];
799
843
  });
800
844
  }
801
845
  copy(range) {
802
- this._node.hf.copy(toModelRange(this._node.sheetId, range));
846
+ invariant2(this._node, void 0, {
847
+ F: __dxlog_file2,
848
+ L: 187,
849
+ S: this,
850
+ A: [
851
+ "this._node",
852
+ ""
853
+ ]
854
+ });
855
+ this._node.graph.hf.copy(toModelRange(this._node.sheetId, range));
803
856
  }
804
857
  paste(cell) {
805
- if (!this._node.hf.isClipboardEmpty()) {
806
- const changes = this._node.hf.paste(toSimpleCellAddress(this._node.sheetId, cell));
858
+ invariant2(this._node, void 0, {
859
+ F: __dxlog_file2,
860
+ L: 192,
861
+ S: this,
862
+ A: [
863
+ "this._node",
864
+ ""
865
+ ]
866
+ });
867
+ if (!this._node.graph.hf.isClipboardEmpty()) {
868
+ const changes = this._node.graph.hf.paste(toSimpleCellAddress(this._node.sheetId, cell));
807
869
  for (const change of changes) {
808
870
  if (change instanceof ExportedCellChange) {
809
871
  const { address, newValue } = change;
@@ -820,15 +882,31 @@ var SheetModel = class extends Resource {
820
882
  }
821
883
  // TODO(burdon): Display undo/redo state.
822
884
  undo() {
823
- if (this._node.hf.isThereSomethingToUndo()) {
824
- this._node.hf.undo();
825
- this.update.emit();
885
+ invariant2(this._node, void 0, {
886
+ F: __dxlog_file2,
887
+ L: 207,
888
+ S: this,
889
+ A: [
890
+ "this._node",
891
+ ""
892
+ ]
893
+ });
894
+ if (this._node.graph.hf.isThereSomethingToUndo()) {
895
+ this._node.graph.hf.undo();
826
896
  }
827
897
  }
828
898
  redo() {
829
- if (this._node.hf.isThereSomethingToRedo()) {
830
- this._node.hf.redo();
831
- this.update.emit();
899
+ invariant2(this._node, void 0, {
900
+ F: __dxlog_file2,
901
+ L: 215,
902
+ S: this,
903
+ A: [
904
+ "this._node",
905
+ ""
906
+ ]
907
+ });
908
+ if (this._node.graph.hf.isThereSomethingToRedo()) {
909
+ this._node.graph.hf.redo();
832
910
  }
833
911
  }
834
912
  /**
@@ -862,7 +940,16 @@ var SheetModel = class extends Resource {
862
940
  * Gets the regular or computed value from the engine.
863
941
  */
864
942
  getValue(cell) {
865
- const value = this._node.hf.getCellValue(toSimpleCellAddress(this._node.sheetId, cell));
943
+ invariant2(this._node, void 0, {
944
+ F: __dxlog_file2,
945
+ L: 258,
946
+ S: this,
947
+ A: [
948
+ "this._node",
949
+ ""
950
+ ]
951
+ });
952
+ const value = this._node.graph.hf.getCellValue(toSimpleCellAddress(this._node.sheetId, cell));
866
953
  if (value instanceof DetailedCellError) {
867
954
  return value.toString();
868
955
  }
@@ -872,14 +959,32 @@ var SheetModel = class extends Resource {
872
959
  * Get value type.
873
960
  */
874
961
  getValueType(cell) {
962
+ invariant2(this._node, void 0, {
963
+ F: __dxlog_file2,
964
+ L: 271,
965
+ S: this,
966
+ A: [
967
+ "this._node",
968
+ ""
969
+ ]
970
+ });
875
971
  const addr = toSimpleCellAddress(this._node.sheetId, cell);
876
- const type = this._node.hf.getCellValueDetailedType(addr);
972
+ const type = this._node.graph.hf.getCellValueDetailedType(addr);
877
973
  return typeMap[type];
878
974
  }
879
975
  /**
880
976
  * Sets the value, updating the sheet and engine.
881
977
  */
882
978
  setValue(cell, value) {
979
+ invariant2(this._node, void 0, {
980
+ F: __dxlog_file2,
981
+ L: 281,
982
+ S: this,
983
+ A: [
984
+ "this._node",
985
+ ""
986
+ ]
987
+ });
883
988
  if (this._options.readonly) {
884
989
  throw new ReadonlyException();
885
990
  }
@@ -895,7 +1000,7 @@ var SheetModel = class extends Resource {
895
1000
  if (refresh) {
896
1001
  this.reset();
897
1002
  }
898
- this._node.hf.setCellContents({
1003
+ this._node.graph.hf.setCellContents({
899
1004
  sheet: this._node.sheetId,
900
1005
  row: cell.row,
901
1006
  col: cell.col
@@ -970,7 +1075,7 @@ var SheetModel = class extends Resource {
970
1075
  mapFormulaRefsToIndices(formula) {
971
1076
  invariant2(formula.charAt(0) === "=", void 0, {
972
1077
  F: __dxlog_file2,
973
- L: 358,
1078
+ L: 370,
974
1079
  S: this,
975
1080
  A: [
976
1081
  "formula.charAt(0) === '='",
@@ -987,7 +1092,7 @@ var SheetModel = class extends Resource {
987
1092
  mapFormulaIndicesToRefs(formula) {
988
1093
  invariant2(formula.charAt(0) === "=", void 0, {
989
1094
  F: __dxlog_file2,
990
- L: 368,
1095
+ L: 380,
991
1096
  S: this,
992
1097
  A: [
993
1098
  "formula.charAt(0) === '='",
@@ -1011,13 +1116,40 @@ var SheetModel = class extends Resource {
1011
1116
  return new Date(year, month - 1, day, hours, minutes, seconds);
1012
1117
  }
1013
1118
  toDateTime(num) {
1014
- return this._node.hf.numberToDateTime(num);
1119
+ invariant2(this._node, void 0, {
1120
+ F: __dxlog_file2,
1121
+ L: 401,
1122
+ S: this,
1123
+ A: [
1124
+ "this._node",
1125
+ ""
1126
+ ]
1127
+ });
1128
+ return this._node.graph.hf.numberToDateTime(num);
1015
1129
  }
1016
1130
  toDate(num) {
1017
- return this._node.hf.numberToDate(num);
1131
+ invariant2(this._node, void 0, {
1132
+ F: __dxlog_file2,
1133
+ L: 406,
1134
+ S: this,
1135
+ A: [
1136
+ "this._node",
1137
+ ""
1138
+ ]
1139
+ });
1140
+ return this._node.graph.hf.numberToDate(num);
1018
1141
  }
1019
1142
  toTime(num) {
1020
- return this._node.hf.numberToTime(num);
1143
+ invariant2(this._node, void 0, {
1144
+ F: __dxlog_file2,
1145
+ L: 411,
1146
+ S: this,
1147
+ A: [
1148
+ "this._node",
1149
+ ""
1150
+ ]
1151
+ });
1152
+ return this._node.graph.hf.numberToTime(num);
1021
1153
  }
1022
1154
  };
1023
1155
 
@@ -1030,11 +1162,10 @@ var useFormattingModel = (model) => {
1030
1162
 
1031
1163
  // packages/plugins/plugin-sheet/src/hooks/useSheetModel.ts
1032
1164
  import { useEffect as useEffect2, useState as useState3 } from "react";
1033
- var useSheetModel = (space, sheet, { readonly } = {}) => {
1034
- const graph = useComputeGraph(space);
1165
+ var useSheetModel = (graph, sheet, { readonly } = {}) => {
1035
1166
  const [model, setModel] = useState3();
1036
1167
  useEffect2(() => {
1037
- if (!space || !graph || !sheet) {
1168
+ if (!graph || !sheet) {
1038
1169
  return;
1039
1170
  }
1040
1171
  let model2;
@@ -1050,9 +1181,8 @@ var useSheetModel = (space, sheet, { readonly } = {}) => {
1050
1181
  void model2?.close();
1051
1182
  };
1052
1183
  }, [
1053
- space,
1054
- sheet,
1055
1184
  graph,
1185
+ sheet,
1056
1186
  readonly
1057
1187
  ]);
1058
1188
  return model;
@@ -1074,8 +1204,8 @@ var useSheetContext = () => {
1074
1204
  });
1075
1205
  return context;
1076
1206
  };
1077
- var SheetContextProvider = ({ children, sheet, space, readonly, onInfo }) => {
1078
- const model = useSheetModel(space, sheet, {
1207
+ var SheetContextProvider = ({ children, graph, sheet, readonly, onInfo }) => {
1208
+ const model = useSheetModel(graph, sheet, {
1079
1209
  readonly
1080
1210
  });
1081
1211
  const formatting = useFormattingModel(model);
@@ -2546,8 +2676,9 @@ export {
2546
2676
  createSheet,
2547
2677
  addressToIndex,
2548
2678
  compareIndexPositions,
2679
+ useComputeGraph,
2549
2680
  useSheetContext,
2550
2681
  Sheet,
2551
2682
  SheetContainer
2552
2683
  };
2553
- //# sourceMappingURL=chunk-7HVSOTGA.mjs.map
2684
+ //# sourceMappingURL=chunk-5RLTCIE2.mjs.map