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