@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
@@ -16,25 +16,26 @@ export type ComputeGraphOptions = {
16
16
  plugins?: ComputeGraphPlugin[];
17
17
  } & Partial<FunctionContextOptions> & Partial<ConfigParams>;
18
18
  export declare const defaultOptions: ComputeGraphOptions;
19
+ export declare const defaultPlugins: ComputeGraphPlugin[];
19
20
  export declare const createSheetName: (id: string) => string;
20
21
  export declare const getSheetId: (name: string) => string | undefined;
21
- /**
22
- * NOTE: Async imports to decouple hyperformula deps.
23
- */
24
- export declare const createComputeGraphRegistry: (options?: Partial<FunctionContextOptions>) => ComputeGraphRegistry;
25
22
  /**
26
23
  * Manages a collection of ComputeGraph instances for each space.
27
24
  *
28
25
  * [ComputePlugin] => [ComputeGraphRegistry] => [ComputeGraph(Space)] => [ComputeNode(Object)]
26
+ *
27
+ * NOTE: The ComputeGraphRegistry manages the hierarchy of resources via its root Context.
29
28
  */
30
29
  export declare class ComputeGraphRegistry extends Resource {
30
+ private readonly _graphs;
31
31
  private readonly _options;
32
- private readonly _registry;
33
- constructor(_options?: ComputeGraphOptions);
32
+ constructor(options?: ComputeGraphOptions);
34
33
  getGraph(spaceId: SpaceId): ComputeGraph | undefined;
35
34
  getOrCreateGraph(space: Space): Promise<ComputeGraph>;
36
35
  createGraph(space: Space): Promise<ComputeGraph>;
36
+ protected _close(): Promise<void>;
37
37
  }
38
+ export type ComputeGraphEvent = 'functionsUpdated';
38
39
  /**
39
40
  * Per-space compute and dependency graph.
40
41
  * Consists of multiple ComputeNode (corresponding to a HyperFormula sheet).
@@ -48,11 +49,12 @@ export declare class ComputeGraph extends Resource {
48
49
  readonly id: string;
49
50
  private readonly _nodes;
50
51
  private _functions;
52
+ readonly update: Event<{
53
+ type: ComputeGraphEvent;
54
+ }>;
51
55
  readonly context: FunctionContext;
52
- readonly update: Event<void>;
53
56
  constructor(_hf: HyperFormula, _space?: Space | undefined, _options?: Partial<FunctionContextOptions> | undefined);
54
57
  get hf(): HyperFormula;
55
- refresh(): void;
56
58
  getFunctions({ standard, echo }?: {
57
59
  standard?: boolean;
58
60
  echo?: boolean;
@@ -60,7 +62,7 @@ export declare class ComputeGraph extends Resource {
60
62
  /**
61
63
  * Get or create cell representing a sheet.
62
64
  */
63
- getOrCreateNode(name: string): ComputeNode;
65
+ getOrCreateNode(name: string): Promise<ComputeNode>;
64
66
  /**
65
67
  * Map bound value to custom function invocation.
66
68
  * E.g., "HELLO(...args)" => "EDGE("HELLO", ...args)".
@@ -77,5 +79,6 @@ export declare class ComputeGraph extends Resource {
77
79
  */
78
80
  mapFunctionBindingFromId(formula: string): string;
79
81
  protected _open(): Promise<void>;
82
+ protected _close(): Promise<void>;
80
83
  }
81
84
  //# sourceMappingURL=compute-graph.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compute-graph.d.ts","sourceRoot":"","sources":["../../../../src/graph/compute-graph.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,KAAK,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAEpF,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,EAA4B,MAAM,mBAAmB,CAAC;AACvF,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAOzC,OA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AAO,CAAC,QAAQ,CAAC,MAAM,CAAC;IACxB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;IAhB5B,SAAgB,EAAE,SAA4C;IAG9D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkC;IAGzD,OAAO,CAAC,UAAU,CAAsB;IAExC,SAAgB,MAAM;cAAqB,iBAAiB;OAAM;IAGlE,SAAgB,OAAO,kBAA6D;gBAGjE,GAAG,EAAE,YAAY,EACjB,MAAM,CAAC,EAAE,KAAK,YAAA,EACd,QAAQ,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,YAAA;IAqB7D,IAAI,EAAE,iBAEL;IAOD,YAAY,CACV,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,OAAO,CAAA;KAAmC,GAC1F,kBAAkB,EAAE;IAWvB;;OAEG;IAMG,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAiBzD;;;OAGG;IACH,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IA0C3C;;;OAGG;IACH,sBAAsB,CAAC,OAAO,EAAE,MAAM;IAgBtC;;;OAGG;IACH,wBAAwB,CAAC,OAAO,EAAE,MAAM;cAgBf,KAAK;cAaL,MAAM;CAKhC"}
@@ -1 +1 @@
1
- {"version":3,"file":"compute-graph.stories.d.ts","sourceRoot":"","sources":["../../../../src/graph/compute-graph.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,KAAsC,MAAM,OAAO,CAAC;;;;mBAkF1C,GAAG;;AAPpB,wBAQE;AAEF,eAAO,MAAM,OAAO,IAAK,CAAC"}
1
+ {"version":3,"file":"compute-graph.stories.d.ts","sourceRoot":"","sources":["../../../../src/graph/compute-graph.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,KAAsC,MAAM,OAAO,CAAC;;;;mBAmF1C,GAAG;;AAPpB,wBAQE;AAEF,eAAO,MAAM,OAAO,IAAK,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=compute-graph.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compute-graph.test.d.ts","sourceRoot":"","sources":["../../../../src/graph/compute-graph.test.ts"],"names":[],"mappings":""}
@@ -1,19 +1,26 @@
1
+ import { type Listeners } from 'hyperformula/typings/Emitter';
2
+ import { type ExportedCellChange } from 'hyperformula/typings/Exporter';
1
3
  import { Event } from '@dxos/async';
2
4
  import { Resource } from '@dxos/context';
3
5
  import { type ComputeGraph } from './compute-graph';
4
6
  import { type CellAddress } from '../defs';
5
7
  import { type CellScalarValue } from '../types';
8
+ export type ComputeNodeEvent = {
9
+ type: keyof Listeners;
10
+ change?: ExportedCellChange;
11
+ };
6
12
  /**
7
13
  * Individual "sheet" (typically corresponds to an ECHO object).
8
14
  */
9
15
  export declare class ComputeNode extends Resource {
10
16
  private readonly _graph;
11
17
  readonly sheetId: number;
12
- readonly update: Event<void>;
18
+ readonly update: Event<ComputeNodeEvent>;
13
19
  constructor(_graph: ComputeGraph, sheetId: number);
14
20
  get graph(): ComputeGraph;
15
- get hf(): import("hyperformula").HyperFormula;
21
+ clear(): void;
16
22
  getValue(cell: CellAddress): CellScalarValue;
17
23
  setValue(cell: CellAddress, value: CellScalarValue): void;
24
+ protected _open(): Promise<void>;
18
25
  }
19
26
  //# sourceMappingURL=compute-node.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compute-node.d.ts","sourceRoot":"","sources":["../../../../src/graph/compute-node.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,KAAK,WAAW,EAAE,M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AK;IAIL,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,eAAe;IAS5C,QAAQ,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,eAAe;cAMzB,KAAK;CAI/B"}
@@ -1 +1 @@
1
- {"version":3,"file":"edge-function.d.ts","sourceRoot":"","sources":["../../../../src/graph/edge-function.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,mDAAmD,CAAC;AAC1F,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAShE,OAAO,EAAsB,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAI3E;;;;GAIG;AACH,qBAAa,kBAAmB,SAAQ,mBAAmB;IACzD,IAAI,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB;CA0ChD;AAwBD,eAAO,MAAM,8BAA8B;;;;;;;CAO1C,CAAC"}
1
+ {"version":3,"file":"edge-function.d.ts","sourceRoot":"","sources":["../../../../src/graph/edge-function.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,mDAAmD,CAAC;AAC1F,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAShE,OAAO,EAAsB,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAI3E;;;;GAIG;AACH,qBAAa,kBAAmB,SAAQ,mBAAmB;IACzD,IAAI,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB;CA0ChD;AAuBD,eAAO,MAAM,8BAA8B;;;;;;;CAO1C,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { type InterpreterState } from 'hyperformula/typings/interpreter/InterpreterState';
2
2
  import { type ProcedureAst } from 'hyperformula/typings/parser';
3
- import { FunctionPluginAsync } from './async-function';
3
+ import { FunctionPluginAsync } from '../async-function';
4
+ import { type ComputeGraphPlugin } from '../compute-graph';
4
5
  /**
5
6
  * https://hyperformula.handsontable.com/guide/custom-functions.html#add-a-simple-custom-function
6
7
  */
@@ -18,4 +19,5 @@ export declare const CustomPluginTranslations: {
18
19
  CRYPTO: string;
19
20
  };
20
21
  };
22
+ export declare const testPlugins: ComputeGraphPlugin[];
21
23
  //# sourceMappingURL=custom-function.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-function.d.ts","sourceRoot":"","sources":["../../../../../src/graph/testing/custom-function.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,mDAAmD,CAAC;AAC1F,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAKhE,OAAO,EAAsB,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAG3D;;GAEG;AACH,qBAAa,YAAa,SAAQ,mBAAmB;IACnD,IAAI,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB;IAQ/C,MAAM,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB;CAelD;AAgBD,eAAO,MAAM,wBAAwB;;;;;;;;;CASpC,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,kBAAkB,EAK3C,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './custom-function';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/graph/testing/index.ts"],"names":[],"mappings":"AAIA,cAAc,mBAAmB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useComputeGraph.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useComputeGraph.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAIrD,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,eAAe,WAAY,KAAK,KAAG,YAAY,GAAG,SAG9D,CAAC"}
1
+ {"version":3,"file":"useComputeGraph.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useComputeGraph.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAIrD,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,eAAe,WAAY,KAAK,KAAG,YAAY,GAAG,SAI9D,CAAC"}
@@ -1,8 +1,8 @@
1
- import { type Space } from '@dxos/react-client/echo';
1
+ import { type ComputeGraph } from '../graph';
2
2
  import { SheetModel } from '../model';
3
3
  import { type SheetType } from '../types';
4
4
  export type UseSheetModelOptions = {
5
5
  readonly?: boolean;
6
6
  };
7
- export declare const useSheetModel: (space?: Space, sheet?: SheetType, { readonly }?: UseSheetModelOptions) => SheetModel | undefined;
7
+ export declare const useSheetModel: (graph?: ComputeGraph, sheet?: SheetType, { readonly }?: UseSheetModelOptions) => SheetModel | undefined;
8
8
  //# sourceMappingURL=useSheetModel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSheetModel.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useSheetModel.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAGrD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,aAAa,WAChB,KAAK,UACL,SAAS,iBACH,oBAAoB,KACjC,UAAU,GAAG,SAsBf,CAAC"}
1
+ {"version":3,"file":"useSheetModel.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useSheetModel.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,aAAa,WAChB,YAAY,UACZ,SAAS,iBACH,oBAAoB,KACjC,UAAU,GAAG,SAqBf,CAAC"}
@@ -2,7 +2,7 @@ import { type SimpleDate, type SimpleDateTime } from 'hyperformula/typings/DateT
2
2
  import { Event } from '@dxos/async';
3
3
  import { Resource } from '@dxos/context';
4
4
  import { type CellAddress, type CellRange } from '../defs';
5
- import { type ComputeGraph } from '../graph';
5
+ import { type ComputeGraph, type ComputeNodeEvent } from '../graph';
6
6
  import { type CellScalarValue, type CellValue, type SheetType, ValueTypeEnum } from '../types';
7
7
  export type SheetModelOptions = {
8
8
  readonly?: boolean;
@@ -17,8 +17,8 @@ export declare class SheetModel extends Resource {
17
17
  private readonly _sheet;
18
18
  private readonly _options;
19
19
  readonly id: string;
20
- readonly update: Event<void>;
21
- private readonly _node;
20
+ readonly update: Event<ComputeNodeEvent>;
21
+ private _node?;
22
22
  constructor(_graph: ComputeGraph, _sheet: SheetType, _options?: SheetModelOptions);
23
23
  get graph(): ComputeGraph;
24
24
  get sheet(): SheetType;
@@ -1 +1 @@
1
- {"version":3,"file":"sheet-model.d.ts","sourceRoot":"","sources":["../../../../src/model/sheet-model.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAE3F,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAMzC,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,SAAS,EAGf,MAAM,SAAS,CAAC;AAEjB,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AAG,aAAa;IAO9C;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,eAAe;IAwClD;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC;IAM3C;;OAEG;IACH,OAAO,CAAC,UAAU;IAqBlB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,YAAY;IAQpB;;OAEG;IACH,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAOhD;;OAEG;IACH,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAWhD;;;;OAIG;IACH,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAK9B,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc;IAKvC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU;IAK/B,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU;CAIhC"}
@@ -1,9 +1,8 @@
1
- import type { Decorator } from '@storybook/react';
1
+ import { type Decorator } from '@storybook/react';
2
2
  import { type Space } from '@dxos/react-client/echo';
3
- import { type ComputeGraph } from '../graph';
3
+ import { type ComputeGraph, type ComputeGraphOptions } from '../graph';
4
4
  import { type CellValue, type CreateSheetOptions } from '../types';
5
- export declare const testSheetName = "test";
6
- export declare const createCells: () => Record<string, CellValue>;
5
+ export declare const createTestCells: () => Record<string, CellValue>;
7
6
  export declare const useTestSheet: (space?: Space, graph?: ComputeGraph, options?: CreateSheetOptions) => import("../types").SheetType | undefined;
8
- export declare const withGraphDecorator: Decorator;
7
+ export declare const withComputeGraphDecorator: (options?: ComputeGraphOptions) => Decorator;
9
8
  //# sourceMappingURL=testing.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../../../src/testing/testing.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAKrD,OAAO,EAAE,KAAK,YAAY,EAAwB,MAAM,UAAU,CAAC;AACnE,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEnE,eAAO,MAAM,aAAa,SAAS,CAAC;AAGpC,eAAO,MAAM,WAAW,QAAO,MAAM,CAAC,MAAM,EAAE,SAAS,CA0BrD,CAAC;AAEH,eAAO,MAAM,YAAY,WAAY,KAAK,UAAU,YAAY,YAAY,kBAAkB,6CAU7F,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,SAOhC,CAAC"}
1
+ {"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../../../src/testing/testing.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAKrD,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,mBAAmB,EAAwB,MAAM,UAAU,CAAC;AAC7F,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAInE,eAAO,MAAM,eAAe,QAAO,MAAM,CAAC,MAAM,EAAE,SAAS,CA0BzD,CAAC;AAEH,eAAO,MAAM,YAAY,WAAY,KAAK,UAAU,YAAY,YAAY,kBAAkB,6CAW7F,CAAC;AAEF,eAAO,MAAM,yBAAyB,aACzB,mBAAmB,KAAG,SAQhC,CAAC"}
@@ -47,7 +47,7 @@ export declare const RowColumnMeta: S.Struct<{
47
47
  size: S.optional<typeof S.Number>;
48
48
  }>;
49
49
  declare const SheetType_base: import("@dxos/echo-schema").AbstractTypedObject<{
50
- title?: string | undefined;
50
+ name?: string | undefined;
51
51
  cells: {
52
52
  [x: string]: {
53
53
  value: any;
@@ -109,7 +109,7 @@ declare const SheetType_base: import("@dxos/echo-schema").AbstractTypedObject<{
109
109
  } & {
110
110
  id: string;
111
111
  }, S.Struct.Encoded<{
112
- title: S.optional<typeof S.String>;
112
+ name: S.optional<typeof S.String>;
113
113
  cells: S.mutable<S.Record$<typeof S.String, S.mutable<S.Struct<{
114
114
  value: typeof S.Any;
115
115
  }>>>>;
@@ -168,7 +168,8 @@ export type SheetSize = {
168
168
  columns: number;
169
169
  };
170
170
  export type CreateSheetOptions = {
171
- title?: string;
171
+ name?: string;
172
+ cells?: Record<string, CellValue>;
172
173
  } & Partial<SheetSize>;
173
174
  export {};
174
175
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACvB,eAAe,EACf,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,GAAG,EAAE,CAAC,EAAe,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAMxD,oBAAY,WAAW;IACrB,MAAM,wCAA2B;CAClC;AAKD,KAAK,cAAc,CAAC,CAAC,IAAI;IACvB,MAAM,EAAE;QACN,SAAS,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,IAAI,CAAC,CAAC;QAClC,UAAU,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,KAAK,MAAM,CAAC;KAC9F,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,eAAe,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E,SAAS,CAAC,CAAC;CACnC,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/plugin-sheet",
3
- "version": "0.6.12-main.ed7cda7",
3
+ "version": "0.6.12-main.f9d0246",
4
4
  "description": "Braneframe sketch plugin",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -78,29 +78,29 @@
78
78
  "re-resizable": "^6.9.17",
79
79
  "react-markdown": "^8.0.5",
80
80
  "react-resize-detector": "^11.0.1",
81
- "@dxos/app-framework": "0.6.12-main.ed7cda7",
82
- "@dxos/async": "0.6.12-main.ed7cda7",
83
- "@dxos/client": "0.6.12-main.ed7cda7",
84
- "@dxos/context": "0.6.12-main.ed7cda7",
85
- "@dxos/debug": "0.6.12-main.ed7cda7",
86
- "@dxos/echo-schema": "0.6.12-main.ed7cda7",
87
- "@dxos/crypto": "0.6.12-main.ed7cda7",
88
- "@dxos/invariant": "0.6.12-main.ed7cda7",
89
- "@dxos/log": "0.6.12-main.ed7cda7",
90
- "@dxos/keys": "0.6.12-main.ed7cda7",
91
- "@dxos/plugin-attention": "0.6.12-main.ed7cda7",
92
- "@dxos/plugin-client": "0.6.12-main.ed7cda7",
93
- "@dxos/plugin-script": "0.6.12-main.ed7cda7",
94
- "@dxos/plugin-graph": "0.6.12-main.ed7cda7",
95
- "@dxos/plugin-space": "0.6.12-main.ed7cda7",
96
- "@dxos/plugin-stack": "0.6.12-main.ed7cda7",
97
- "@dxos/react-client": "0.6.12-main.ed7cda7",
98
- "@dxos/react-hooks": "0.6.12-main.ed7cda7",
99
- "@dxos/plugin-markdown": "0.6.12-main.ed7cda7",
100
- "@dxos/react-ui-grid": "0.6.12-main.ed7cda7",
101
- "@dxos/react-ui-attention": "0.6.12-main.ed7cda7",
102
- "@dxos/util": "0.6.12-main.ed7cda7",
103
- "@dxos/react-ui-editor": "0.6.12-main.ed7cda7"
81
+ "@dxos/app-framework": "0.6.12-main.f9d0246",
82
+ "@dxos/client": "0.6.12-main.f9d0246",
83
+ "@dxos/context": "0.6.12-main.f9d0246",
84
+ "@dxos/async": "0.6.12-main.f9d0246",
85
+ "@dxos/crypto": "0.6.12-main.f9d0246",
86
+ "@dxos/debug": "0.6.12-main.f9d0246",
87
+ "@dxos/invariant": "0.6.12-main.f9d0246",
88
+ "@dxos/echo-schema": "0.6.12-main.f9d0246",
89
+ "@dxos/keys": "0.6.12-main.f9d0246",
90
+ "@dxos/log": "0.6.12-main.f9d0246",
91
+ "@dxos/plugin-attention": "0.6.12-main.f9d0246",
92
+ "@dxos/plugin-client": "0.6.12-main.f9d0246",
93
+ "@dxos/plugin-graph": "0.6.12-main.f9d0246",
94
+ "@dxos/plugin-markdown": "0.6.12-main.f9d0246",
95
+ "@dxos/plugin-space": "0.6.12-main.f9d0246",
96
+ "@dxos/plugin-script": "0.6.12-main.f9d0246",
97
+ "@dxos/react-client": "0.6.12-main.f9d0246",
98
+ "@dxos/plugin-stack": "0.6.12-main.f9d0246",
99
+ "@dxos/react-ui-attention": "0.6.12-main.f9d0246",
100
+ "@dxos/react-hooks": "0.6.12-main.f9d0246",
101
+ "@dxos/react-ui-editor": "0.6.12-main.f9d0246",
102
+ "@dxos/react-ui-grid": "0.6.12-main.f9d0246",
103
+ "@dxos/util": "0.6.12-main.f9d0246"
104
104
  },
105
105
  "devDependencies": {
106
106
  "@lezer/generator": "^1.7.1",
@@ -113,20 +113,20 @@
113
113
  "react": "~18.2.0",
114
114
  "react-dom": "~18.2.0",
115
115
  "vite": "5.4.7",
116
- "@dxos/random": "0.6.12-main.ed7cda7",
117
- "@dxos/echo-generator": "0.6.12-main.ed7cda7",
118
- "@dxos/react-ui-syntax-highlighter": "0.6.12-main.ed7cda7",
119
- "@dxos/react-ui-theme": "0.6.12-main.ed7cda7",
120
- "@dxos/react-ui": "0.6.12-main.ed7cda7",
121
- "@dxos/react-ui-types": "0.6.12-main.ed7cda7",
122
- "@dxos/storybook-utils": "0.6.12-main.ed7cda7"
116
+ "@dxos/random": "0.6.12-main.f9d0246",
117
+ "@dxos/echo-generator": "0.6.12-main.f9d0246",
118
+ "@dxos/react-ui": "0.6.12-main.f9d0246",
119
+ "@dxos/react-ui-types": "0.6.12-main.f9d0246",
120
+ "@dxos/react-ui-theme": "0.6.12-main.f9d0246",
121
+ "@dxos/storybook-utils": "0.6.12-main.f9d0246",
122
+ "@dxos/react-ui-syntax-highlighter": "0.6.12-main.f9d0246"
123
123
  },
124
124
  "optionalDependencies": {
125
125
  "@phosphor-icons/react": "^2.1.5",
126
126
  "react": "~18.2.0",
127
127
  "react-dom": "~18.2.0",
128
- "@dxos/react-ui": "0.6.12-main.ed7cda7",
129
- "@dxos/react-ui-theme": "0.6.12-main.ed7cda7"
128
+ "@dxos/react-ui": "0.6.12-main.f9d0246",
129
+ "@dxos/react-ui-theme": "0.6.12-main.f9d0246"
130
130
  },
131
131
  "publishConfig": {
132
132
  "access": "public"
@@ -16,6 +16,7 @@ import { getSpace, isEchoObject } from '@dxos/react-client/echo';
16
16
  import { ComputeGraphContextProvider, SheetContainer } from './components';
17
17
  import { compareIndexPositions, createSheet } from './defs';
18
18
  import { type ComputeGraphRegistry } from './graph';
19
+ import { useComputeGraph } from './hooks';
19
20
  import meta, { SHEET_PLUGIN } from './meta';
20
21
  import translations from './translations';
21
22
  import { SheetAction, SheetType, type SheetPluginProvides } from './types';
@@ -36,8 +37,8 @@ export const SheetPlugin = (): PluginDefinition<SheetPluginProvides> => {
36
37
  }
37
38
 
38
39
  // Async import removes direct dependency on hyperformula.
39
- const { createComputeGraphRegistry } = await import('./graph');
40
- graphRegistry = createComputeGraphRegistry({ remoteFunctionUrl });
40
+ const { ComputeGraphRegistry } = await import('./graph');
41
+ graphRegistry = new ComputeGraphRegistry({ remoteFunctionUrl });
41
42
  },
42
43
  provides: {
43
44
  context: ({ children }) => {
@@ -47,7 +48,7 @@ export const SheetPlugin = (): PluginDefinition<SheetPluginProvides> => {
47
48
  metadata: {
48
49
  records: {
49
50
  [SheetType.typename]: {
50
- label: (object: any) => (object instanceof SheetType ? object.title : undefined),
51
+ label: (object: any) => (object instanceof SheetType ? object.name : undefined),
51
52
  placeholder: ['sheet title placeholder', { ns: SHEET_PLUGIN }],
52
53
  icon: 'ph--grid-nine--regular',
53
54
  },
@@ -108,7 +109,7 @@ export const SheetPlugin = (): PluginDefinition<SheetPluginProvides> => {
108
109
  },
109
110
  },
110
111
  markdown: {
111
- // TODO(burdon): Construct compute node.
112
+ // TODO(burdon): Facet to get current space/compute graph.
112
113
  extensions: ({ document }) => {
113
114
  return undefined;
114
115
  // return [
@@ -138,12 +139,13 @@ export const SheetPlugin = (): PluginDefinition<SheetPluginProvides> => {
138
139
  },
139
140
  surface: {
140
141
  component: ({ data, role }) => {
141
- const space = isEchoObject(data.object) && getSpace(data.object);
142
- if (space && data.object instanceof SheetType) {
142
+ const space = isEchoObject(data.object) ? getSpace(data.object) : undefined;
143
+ const graph = useComputeGraph(space);
144
+ if (graph && data.object instanceof SheetType) {
143
145
  switch (role) {
144
146
  case 'article':
145
147
  case 'section': {
146
- return <SheetContainer sheet={data.object} space={space} role={role} />;
148
+ return <SheetContainer graph={graph} sheet={data.object} role={role} />;
147
149
  }
148
150
  }
149
151
  }
@@ -49,7 +49,7 @@ const AutomergeStory = ({ value, ...props }: StoryProps) => {
49
49
  client.addTypes([SheetType]);
50
50
 
51
51
  const sheet = createSheet();
52
- sheet.title = 'Test';
52
+ sheet.name = 'Test';
53
53
  sheet.cells[cell] = { value };
54
54
  space.db.add(sheet);
55
55
  setObject(sheet);
@@ -10,14 +10,15 @@ import { withTheme, withLayout } from '@dxos/storybook-utils';
10
10
 
11
11
  import { GridSheet } from './GridSheet';
12
12
  import { useComputeGraph } from '../../hooks';
13
- import { useTestSheet, withGraphDecorator } from '../../testing';
13
+ import { useTestSheet, withComputeGraphDecorator } from '../../testing';
14
+ import { SheetType } from '../../types';
14
15
 
15
16
  export default {
16
17
  title: 'plugin-sheet/GridSheet',
17
18
  component: GridSheet,
18
19
  decorators: [
19
- withClientProvider({ createSpace: true }),
20
- withGraphDecorator,
20
+ withClientProvider({ types: [SheetType], createSpace: true }),
21
+ withComputeGraphDecorator(),
21
22
  withTheme,
22
23
  withLayout({ fullscreen: true, tooltips: true }),
23
24
  ],
@@ -31,5 +32,5 @@ export const Basic = () => {
31
32
  return null;
32
33
  }
33
34
 
34
- return <GridSheet space={space} sheet={sheet} />;
35
+ return <GridSheet graph={graph} sheet={sheet} />;
35
36
  };
@@ -4,7 +4,6 @@
4
4
 
5
5
  import React, { useCallback, useMemo, useRef } from 'react';
6
6
 
7
- import { type Space } from '@dxos/client/echo';
8
7
  import {
9
8
  type DxGridElement,
10
9
  Grid,
@@ -15,6 +14,7 @@ import {
15
14
 
16
15
  import { dxGridCellIndexToSheetCellAddress, useSheetModelDxGridProps } from './util';
17
16
  import { rangeToA1Notation, type CellRange } from '../../defs';
17
+ import { type ComputeGraph } from '../../graph';
18
18
  import { useFormattingModel, useSheetModel, type UseSheetModelOptions } from '../../hooks';
19
19
  import { type SheetModel, type FormattingModel } from '../../model';
20
20
  import { type SheetType } from '../../types';
@@ -136,10 +136,10 @@ const GridSheetImpl = ({
136
136
  );
137
137
  };
138
138
 
139
- export type GridSheetProps = { space?: Space; sheet?: SheetType } & UseSheetModelOptions;
139
+ export type GridSheetProps = { graph?: ComputeGraph; sheet?: SheetType } & UseSheetModelOptions;
140
140
 
141
- export const GridSheet = ({ space, sheet, ...options }: GridSheetProps) => {
142
- const model = useSheetModel(space, sheet, options);
141
+ export const GridSheet = ({ graph, sheet, ...options }: GridSheetProps) => {
142
+ const model = useSheetModel(graph, sheet, options);
143
143
  const formatting = useFormattingModel(model);
144
144
  if (!model || !formatting) {
145
145
  return null;
@@ -7,7 +7,7 @@ import '@dxos-theme';
7
7
  import React, { useState } from 'react';
8
8
 
9
9
  import { log } from '@dxos/log';
10
- import { type Space, useSpace } from '@dxos/react-client/echo';
10
+ import { useSpace } from '@dxos/react-client/echo';
11
11
  import { withClientProvider } from '@dxos/react-client/testing';
12
12
  import { Button } from '@dxos/react-ui';
13
13
  import { mx } from '@dxos/react-ui-theme';
@@ -17,18 +17,19 @@ import { Sheet } from './Sheet';
17
17
  import { type SizeMap } from './grid';
18
18
  import { useSheetContext } from './sheet-context';
19
19
  import { addressToIndex, rangeToIndex } from '../../defs';
20
+ import { type ComputeGraph } from '../../graph';
21
+ import { testPlugins } from '../../graph/testing';
20
22
  import { useComputeGraph } from '../../hooks';
21
- import { useTestSheet, withGraphDecorator } from '../../testing';
23
+ import { createTestCells, useTestSheet, withComputeGraphDecorator } from '../../testing';
22
24
  import { SheetType, ValueTypeEnum } from '../../types';
23
25
  import { Toolbar, type ToolbarActionHandler } from '../Toolbar';
24
26
 
25
27
  // TODO(burdon): Allow toolbar to access sheet context; provide state for current cursor/range.
26
- const SheetWithToolbar = ({ debug, space }: { debug?: boolean; space: Space }) => {
28
+ const SheetWithToolbar = ({ graph, debug }: { graph: ComputeGraph; debug?: boolean }) => {
27
29
  const { model, cursor, range } = useSheetContext();
28
30
 
29
- const graph = useComputeGraph(space);
30
31
  const handleRefresh = () => {
31
- graph?.refresh();
32
+ // graph?.refresh(); // TODO(burdon): ???
32
33
  };
33
34
 
34
35
  // TODO(burdon): Factor out.
@@ -104,7 +105,7 @@ export default {
104
105
  component: Sheet,
105
106
  decorators: [
106
107
  withClientProvider({ types: [SheetType], createIdentity: true }),
107
- withGraphDecorator,
108
+ withComputeGraphDecorator({ plugins: testPlugins }),
108
109
  withTheme,
109
110
  withLayout({ fullscreen: true, tooltips: true, classNames: 'inset-4' }),
110
111
  ],
@@ -114,14 +115,14 @@ export const Default = () => {
114
115
  const [debug, setDebug] = useState(false);
115
116
  const space = useSpace();
116
117
  const graph = useComputeGraph(space);
117
- const sheet = useTestSheet(space, graph);
118
- if (!space || !sheet) {
118
+ const sheet = useTestSheet(space, graph, { cells: createTestCells() });
119
+ if (!graph || !sheet) {
119
120
  return null;
120
121
  }
121
122
 
122
123
  return (
123
- <Sheet.Root space={space} sheet={sheet} onInfo={() => setDebug((debug) => !debug)}>
124
- <SheetWithToolbar debug={debug} space={space} />
124
+ <Sheet.Root graph={graph} sheet={sheet} onInfo={() => setDebug((debug) => !debug)}>
125
+ <SheetWithToolbar graph={graph} debug={debug} />
125
126
  </Sheet.Root>
126
127
  );
127
128
  };
@@ -129,13 +130,13 @@ export const Default = () => {
129
130
  export const Debug = () => {
130
131
  const space = useSpace();
131
132
  const graph = useComputeGraph(space);
132
- const sheet = useTestSheet(space, graph);
133
- if (!sheet || !space) {
133
+ const sheet = useTestSheet(space, graph, { cells: createTestCells() });
134
+ if (!graph || !sheet) {
134
135
  return null;
135
136
  }
136
137
 
137
138
  return (
138
- <Sheet.Root space={space} sheet={sheet}>
139
+ <Sheet.Root graph={graph} sheet={sheet}>
139
140
  <Sheet.Main />
140
141
  <Sheet.Debug />
141
142
  </Sheet.Root>
@@ -147,12 +148,12 @@ export const Rows = () => {
147
148
  const space = useSpace();
148
149
  const graph = useComputeGraph(space);
149
150
  const sheet = useTestSheet(space, graph);
150
- if (!sheet || !space) {
151
+ if (!graph || !sheet) {
151
152
  return null;
152
153
  }
153
154
 
154
155
  return (
155
- <Sheet.Root space={space} sheet={sheet}>
156
+ <Sheet.Root graph={graph} sheet={sheet}>
156
157
  <Sheet.Rows
157
158
  rows={sheet.rows}
158
159
  sizes={rowSizes}
@@ -167,12 +168,12 @@ export const Columns = () => {
167
168
  const space = useSpace();
168
169
  const graph = useComputeGraph(space);
169
170
  const sheet = useTestSheet(space, graph);
170
- if (!sheet || !space) {
171
+ if (!graph || !sheet) {
171
172
  return null;
172
173
  }
173
174
 
174
175
  return (
175
- <Sheet.Root space={space} sheet={sheet}>
176
+ <Sheet.Root graph={graph} sheet={sheet}>
176
177
  <Sheet.Columns
177
178
  columns={sheet.columns}
178
179
  sizes={columnSizes}
@@ -185,13 +186,13 @@ export const Columns = () => {
185
186
  export const Main = () => {
186
187
  const space = useSpace();
187
188
  const graph = useComputeGraph(space);
188
- const sheet = useTestSheet(space, graph);
189
- if (!sheet || !space) {
189
+ const sheet = useTestSheet(space, graph, { cells: createTestCells() });
190
+ if (!graph || !sheet) {
190
191
  return null;
191
192
  }
192
193
 
193
194
  return (
194
- <Sheet.Root space={space} sheet={sheet}>
195
+ <Sheet.Root graph={graph} sheet={sheet}>
195
196
  <Sheet.Grid
196
197
  size={{
197
198
  numRows: 50,