@dxos/plugin-sheet 0.7.4 → 0.7.5-labs.5f04cf6
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.
- package/dist/lib/browser/SheetContainer-CM4CO3DC.mjs +370 -0
- package/dist/lib/browser/SheetContainer-CM4CO3DC.mjs.map +7 -0
- package/dist/lib/browser/chunk-FOO6NGBM.mjs +229 -0
- package/dist/lib/browser/chunk-FOO6NGBM.mjs.map +7 -0
- package/dist/lib/browser/chunk-H23JW3DX.mjs +800 -0
- package/dist/lib/browser/chunk-H23JW3DX.mjs.map +7 -0
- package/dist/lib/browser/{chunk-RABELMEQ.mjs → chunk-K6EUYKWT.mjs} +3 -3
- package/dist/lib/browser/chunk-K6EUYKWT.mjs.map +7 -0
- package/dist/lib/browser/chunk-PW25VUP6.mjs +15 -0
- package/dist/lib/browser/chunk-PW25VUP6.mjs.map +7 -0
- package/dist/lib/browser/chunk-T3IVPMRX.mjs +900 -0
- package/dist/lib/browser/chunk-T3IVPMRX.mjs.map +7 -0
- package/dist/lib/browser/compute-graph-registry-XH6B2SWG.mjs +27 -0
- package/dist/lib/browser/compute-graph-registry-XH6B2SWG.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +86 -324
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-Q7DTHAM5.mjs +47 -0
- package/dist/lib/browser/intent-resolver-Q7DTHAM5.mjs.map +7 -0
- package/dist/lib/browser/markdown-IKG5FNCA.mjs +26 -0
- package/dist/lib/browser/markdown-IKG5FNCA.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-context-JG43577H.mjs +28 -0
- package/dist/lib/browser/react-context-JG43577H.mjs.map +7 -0
- package/dist/lib/browser/react-surface-URRC3AFC.mjs +43 -0
- package/dist/lib/browser/react-surface-URRC3AFC.mjs.map +7 -0
- package/dist/lib/browser/thread-YX6KBQNQ.mjs +17 -0
- package/dist/lib/browser/thread-YX6KBQNQ.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +62 -0
- package/dist/lib/node/SheetContainer-TJ3JQLWM.cjs +364 -0
- package/dist/lib/node/SheetContainer-TJ3JQLWM.cjs.map +7 -0
- package/dist/lib/node/chunk-E3RXOEL6.cjs +935 -0
- package/dist/lib/node/chunk-E3RXOEL6.cjs.map +7 -0
- package/dist/lib/node/{types.cjs → chunk-FU5K66DS.cjs} +12 -16
- package/dist/lib/node/chunk-FU5K66DS.cjs.map +7 -0
- package/dist/lib/node/{chunk-2ZVZI2KJ.cjs → chunk-NLDXUFDG.cjs} +7 -7
- package/dist/lib/node/chunk-NLDXUFDG.cjs.map +7 -0
- package/dist/lib/node/chunk-P4KSGZSS.cjs +251 -0
- package/dist/lib/node/chunk-P4KSGZSS.cjs.map +7 -0
- package/dist/lib/node/chunk-ZPWW4LPY.cjs +807 -0
- package/dist/lib/node/chunk-ZPWW4LPY.cjs.map +7 -0
- package/dist/lib/node/compute-graph-registry-ORGTIE5M.cjs +53 -0
- package/dist/lib/node/compute-graph-registry-ORGTIE5M.cjs.map +7 -0
- package/dist/lib/node/index.cjs +87 -318
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/intent-resolver-ZUDJJUFG.cjs +60 -0
- package/dist/lib/node/intent-resolver-ZUDJJUFG.cjs.map +7 -0
- package/dist/lib/node/markdown-EUUL3Q36.cjs +40 -0
- package/dist/lib/node/markdown-EUUL3Q36.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/react-context-OOH5QFE2.cjs +50 -0
- package/dist/lib/node/react-context-OOH5QFE2.cjs.map +7 -0
- package/dist/lib/node/react-surface-IQN5JKSS.cjs +64 -0
- package/dist/lib/node/react-surface-IQN5JKSS.cjs.map +7 -0
- package/dist/lib/node/{meta.cjs → thread-VBPS23P2.cjs} +12 -10
- package/dist/lib/node/thread-VBPS23P2.cjs.map +7 -0
- package/dist/lib/node/types/index.cjs +84 -0
- package/dist/lib/node/types/index.cjs.map +7 -0
- package/dist/lib/node-esm/SheetContainer-QEEFORIC.mjs +371 -0
- package/dist/lib/node-esm/SheetContainer-QEEFORIC.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-BM2Q3FFC.mjs → chunk-FMOVRTS4.mjs} +3 -3
- package/dist/lib/node-esm/chunk-FMOVRTS4.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-KCXK5UM6.mjs +16 -0
- package/dist/lib/node-esm/chunk-KCXK5UM6.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-NSVUOAI6.mjs +901 -0
- package/dist/lib/node-esm/chunk-NSVUOAI6.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-OXD6RBFF.mjs +801 -0
- package/dist/lib/node-esm/chunk-OXD6RBFF.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-PTOI45NK.mjs +231 -0
- package/dist/lib/node-esm/chunk-PTOI45NK.mjs.map +7 -0
- package/dist/lib/node-esm/compute-graph-registry-JH2FRHLD.mjs +28 -0
- package/dist/lib/node-esm/compute-graph-registry-JH2FRHLD.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +86 -324
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/intent-resolver-IF64RN7B.mjs +48 -0
- package/dist/lib/node-esm/intent-resolver-IF64RN7B.mjs.map +7 -0
- package/dist/lib/node-esm/markdown-D2ZMN7LR.mjs +27 -0
- package/dist/lib/node-esm/markdown-D2ZMN7LR.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-context-CJVSLO74.mjs +29 -0
- package/dist/lib/node-esm/react-context-CJVSLO74.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-XJIX5G3I.mjs +44 -0
- package/dist/lib/node-esm/react-surface-XJIX5G3I.mjs.map +7 -0
- package/dist/lib/node-esm/thread-HSJD3SR6.mjs +18 -0
- package/dist/lib/node-esm/thread-HSJD3SR6.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +63 -0
- package/dist/types/src/SheetPlugin.d.ts +1 -3
- package/dist/types/src/SheetPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts +5 -0
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
- package/dist/types/src/capabilities/compute-graph-registry.d.ts +4 -0
- package/dist/types/src/capabilities/compute-graph-registry.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +17 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts +4 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/markdown.d.ts +6 -0
- package/dist/types/src/capabilities/markdown.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-context.d.ts +8 -0
- package/dist/types/src/capabilities/react-context.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +4 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/thread.d.ts +6 -0
- package/dist/types/src/capabilities/thread.d.ts.map +1 -0
- package/dist/types/src/components/ComputeGraph/ComputeGraphContextProvider.d.ts +1 -1
- package/dist/types/src/components/ComputeGraph/ComputeGraphContextProvider.d.ts.map +1 -1
- package/dist/types/src/components/ComputeGraph/compute-graph.stories.d.ts.map +1 -0
- package/dist/types/src/components/FunctionEditor/FunctionEditor.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/GridSheet.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/util.d.ts.map +1 -1
- package/dist/types/src/components/RangeList/RangeList.d.ts.map +1 -1
- package/dist/types/src/components/SheetContainer/SheetContainer.d.ts.map +1 -1
- package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/SheetContext/SheetContext.d.ts +1 -2
- package/dist/types/src/components/SheetContext/SheetContext.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts +7 -0
- package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts.map +1 -0
- package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts +6 -0
- package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts.map +1 -0
- package/dist/types/src/components/SheetToolbar/align.d.ts +28 -0
- package/dist/types/src/components/SheetToolbar/align.d.ts.map +1 -0
- package/dist/types/src/components/SheetToolbar/comment.d.ts +23 -0
- package/dist/types/src/components/SheetToolbar/comment.d.ts.map +1 -0
- package/dist/types/src/components/SheetToolbar/index.d.ts +2 -0
- package/dist/types/src/components/SheetToolbar/index.d.ts.map +1 -0
- package/dist/types/src/components/SheetToolbar/style.d.ts +26 -0
- package/dist/types/src/components/SheetToolbar/style.d.ts.map +1 -0
- package/dist/types/src/components/SheetToolbar/useToolbarAction.d.ts +8 -0
- package/dist/types/src/components/SheetToolbar/useToolbarAction.d.ts.map +1 -0
- package/dist/types/src/components/SheetToolbar/useToolbarState.d.ts +6 -0
- package/dist/types/src/components/SheetToolbar/useToolbarState.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +0 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/extensions/compute.d.ts +1 -1
- package/dist/types/src/extensions/compute.d.ts.map +1 -1
- package/dist/types/src/extensions/editor/extension.d.ts +1 -1
- package/dist/types/src/extensions/editor/extension.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/integrations/thread-ranges.d.ts +1 -1
- package/dist/types/src/integrations/thread-ranges.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/model/sheet-model.d.ts +6 -8
- package/dist/types/src/model/sheet-model.d.ts.map +1 -1
- package/dist/types/src/model/testing.d.ts +1 -1
- package/dist/types/src/model/testing.d.ts.map +1 -1
- package/dist/types/src/model/useSheetModel.d.ts +1 -1
- package/dist/types/src/model/useSheetModel.d.ts.map +1 -1
- package/dist/types/src/testing/testing.d.ts +1 -1
- package/dist/types/src/testing/testing.d.ts.map +1 -1
- package/dist/types/src/{defs → types}/index.d.ts +1 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/src/types/schema.d.ts +105 -0
- package/dist/types/src/types/schema.d.ts.map +1 -0
- package/dist/types/src/{defs → types}/sheet-range-types.d.ts +1 -1
- package/dist/types/src/types/sheet-range-types.d.ts.map +1 -0
- package/dist/types/src/types/types.d.ts +71 -0
- package/dist/types/src/types/types.d.ts.map +1 -0
- package/dist/types/src/{defs → types}/util.d.ts +5 -1
- package/dist/types/src/types/util.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +47 -61
- package/src/SheetPlugin.tsx +70 -176
- package/src/capabilities/capabilities.ts +14 -0
- package/src/capabilities/compute-graph-registry.ts +25 -0
- package/src/capabilities/index.ts +14 -0
- package/src/capabilities/intent-resolver.ts +29 -0
- package/src/capabilities/markdown.ts +22 -0
- package/src/capabilities/react-context.tsx +20 -0
- package/src/capabilities/react-surface.tsx +30 -0
- package/src/capabilities/thread.ts +14 -0
- package/src/components/ComputeGraph/ComputeGraphContextProvider.tsx +1 -2
- package/src/{compute-graph → components/ComputeGraph}/compute-graph.stories.tsx +6 -7
- package/src/components/FunctionEditor/FunctionEditor.tsx +2 -1
- package/src/components/GridSheet/GridSheet.stories.tsx +2 -0
- package/src/components/GridSheet/GridSheet.tsx +15 -18
- package/src/components/GridSheet/SheetCellEditor.stories.tsx +6 -7
- package/src/components/GridSheet/util.ts +3 -2
- package/src/components/RangeList/RangeList.tsx +2 -1
- package/src/components/SheetContainer/SheetContainer.stories.tsx +25 -23
- package/src/components/SheetContainer/SheetContainer.tsx +3 -8
- package/src/components/SheetContext/SheetContext.tsx +1 -2
- package/src/components/{Toolbar/Toolbar.stories.tsx → SheetToolbar/SheetToolbar.stories.tsx} +4 -8
- package/src/components/SheetToolbar/SheetToolbar.tsx +48 -0
- package/src/components/SheetToolbar/align.ts +68 -0
- package/src/components/SheetToolbar/comment.ts +56 -0
- package/src/components/{Toolbar → SheetToolbar}/index.ts +1 -1
- package/src/components/SheetToolbar/style.ts +72 -0
- package/src/components/SheetToolbar/useToolbarAction.ts +87 -0
- package/src/components/SheetToolbar/useToolbarState.ts +17 -0
- package/src/components/index.ts +0 -1
- package/src/extensions/compute.ts +7 -4
- package/src/extensions/editor/extension.test.ts +2 -1
- package/src/extensions/editor/extension.ts +2 -3
- package/src/index.ts +2 -7
- package/src/integrations/thread-ranges.ts +28 -24
- package/src/meta.ts +1 -1
- package/src/model/sheet-model.test.ts +4 -10
- package/src/model/sheet-model.ts +30 -22
- package/src/model/testing.ts +3 -2
- package/src/model/useSheetModel.ts +2 -1
- package/src/sanity.test.ts +1 -1
- package/src/testing/testing.tsx +2 -3
- package/src/{defs → types}/index.ts +1 -0
- package/src/types/schema.ts +56 -0
- package/src/{defs → types}/sheet-range-types.ts +1 -1
- package/src/types/types.ts +67 -0
- package/src/{defs → types}/util.ts +13 -13
- package/dist/lib/browser/SheetContainer-KCLT6PEO.mjs +0 -296
- package/dist/lib/browser/SheetContainer-KCLT6PEO.mjs.map +0 -7
- package/dist/lib/browser/chunk-E5WQ7U7G.mjs +0 -1675
- package/dist/lib/browser/chunk-E5WQ7U7G.mjs.map +0 -7
- package/dist/lib/browser/chunk-F3HE6D3J.mjs +0 -3269
- package/dist/lib/browser/chunk-F3HE6D3J.mjs.map +0 -7
- package/dist/lib/browser/chunk-JXFPOYNA.mjs +0 -67
- package/dist/lib/browser/chunk-JXFPOYNA.mjs.map +0 -7
- package/dist/lib/browser/chunk-RABELMEQ.mjs.map +0 -7
- package/dist/lib/browser/compute-graph-SNUS7HOH.mjs +0 -35
- package/dist/lib/browser/meta.mjs +0 -9
- package/dist/lib/browser/types.mjs +0 -16
- package/dist/lib/browser/types.mjs.map +0 -7
- package/dist/lib/node/SheetContainer-VVVRYTQG.cjs +0 -298
- package/dist/lib/node/SheetContainer-VVVRYTQG.cjs.map +0 -7
- package/dist/lib/node/chunk-2ZVZI2KJ.cjs.map +0 -7
- package/dist/lib/node/chunk-45YW2DX2.cjs +0 -1656
- package/dist/lib/node/chunk-45YW2DX2.cjs.map +0 -7
- package/dist/lib/node/chunk-KSEEI5VC.cjs +0 -3323
- package/dist/lib/node/chunk-KSEEI5VC.cjs.map +0 -7
- package/dist/lib/node/chunk-OWH2EUHZ.cjs +0 -90
- package/dist/lib/node/chunk-OWH2EUHZ.cjs.map +0 -7
- package/dist/lib/node/compute-graph-WILPHO4A.cjs +0 -57
- package/dist/lib/node/compute-graph-WILPHO4A.cjs.map +0 -7
- package/dist/lib/node/meta.cjs.map +0 -7
- package/dist/lib/node/types.cjs.map +0 -7
- package/dist/lib/node-esm/SheetContainer-LSBE6Q4X.mjs +0 -297
- package/dist/lib/node-esm/SheetContainer-LSBE6Q4X.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6JF2AHKO.mjs +0 -3270
- package/dist/lib/node-esm/chunk-6JF2AHKO.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BM2Q3FFC.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BVS2IQRO.mjs +0 -68
- package/dist/lib/node-esm/chunk-BVS2IQRO.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-NYDNXI7L.mjs +0 -1676
- package/dist/lib/node-esm/chunk-NYDNXI7L.mjs.map +0 -7
- package/dist/lib/node-esm/compute-graph-S6CVN7RS.mjs +0 -36
- package/dist/lib/node-esm/compute-graph-S6CVN7RS.mjs.map +0 -7
- package/dist/lib/node-esm/meta.mjs +0 -10
- package/dist/lib/node-esm/meta.mjs.map +0 -7
- package/dist/lib/node-esm/types.mjs +0 -17
- package/dist/lib/node-esm/types.mjs.map +0 -7
- package/dist/types/src/components/SheetObjectSettings.d.ts +0 -7
- package/dist/types/src/components/SheetObjectSettings.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +0 -48
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +0 -7
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/index.d.ts +0 -2
- package/dist/types/src/components/Toolbar/index.d.ts.map +0 -1
- package/dist/types/src/compute-graph/compute-graph-registry.d.ts +0 -34
- package/dist/types/src/compute-graph/compute-graph-registry.d.ts.map +0 -1
- package/dist/types/src/compute-graph/compute-graph.d.ts +0 -64
- package/dist/types/src/compute-graph/compute-graph.d.ts.map +0 -1
- package/dist/types/src/compute-graph/compute-graph.stories.d.ts.map +0 -1
- package/dist/types/src/compute-graph/compute-graph.test.d.ts +0 -2
- package/dist/types/src/compute-graph/compute-graph.test.d.ts.map +0 -1
- package/dist/types/src/compute-graph/compute-node.d.ts +0 -26
- package/dist/types/src/compute-graph/compute-node.d.ts.map +0 -1
- package/dist/types/src/compute-graph/functions/async-function.d.ts +0 -66
- package/dist/types/src/compute-graph/functions/async-function.d.ts.map +0 -1
- package/dist/types/src/compute-graph/functions/edge-function.d.ts +0 -21
- package/dist/types/src/compute-graph/functions/edge-function.d.ts.map +0 -1
- package/dist/types/src/compute-graph/functions/function-defs.d.ts +0 -11
- package/dist/types/src/compute-graph/functions/function-defs.d.ts.map +0 -1
- package/dist/types/src/compute-graph/functions/index.d.ts +0 -4
- package/dist/types/src/compute-graph/functions/index.d.ts.map +0 -1
- package/dist/types/src/compute-graph/hyperformula.test.d.ts +0 -2
- package/dist/types/src/compute-graph/hyperformula.test.d.ts.map +0 -1
- package/dist/types/src/compute-graph/index.d.ts +0 -5
- package/dist/types/src/compute-graph/index.d.ts.map +0 -1
- package/dist/types/src/compute-graph/testing/index.d.ts +0 -3
- package/dist/types/src/compute-graph/testing/index.d.ts.map +0 -1
- package/dist/types/src/compute-graph/testing/test-builder.d.ts +0 -15
- package/dist/types/src/compute-graph/testing/test-builder.d.ts.map +0 -1
- package/dist/types/src/compute-graph/testing/test-plugin.d.ts +0 -36
- package/dist/types/src/compute-graph/testing/test-plugin.d.ts.map +0 -1
- package/dist/types/src/compute-graph/util.d.ts +0 -2
- package/dist/types/src/compute-graph/util.d.ts.map +0 -1
- package/dist/types/src/defs/index.d.ts.map +0 -1
- package/dist/types/src/defs/sheet-range-types.d.ts.map +0 -1
- package/dist/types/src/defs/types.d.ts +0 -26
- package/dist/types/src/defs/types.d.ts.map +0 -1
- package/dist/types/src/defs/types.test.d.ts +0 -2
- package/dist/types/src/defs/types.test.d.ts.map +0 -1
- package/dist/types/src/defs/util.d.ts.map +0 -1
- package/dist/types/src/types.d.ts +0 -182
- package/dist/types/src/types.d.ts.map +0 -1
- package/dist/vendor/hyperformula.mjs +0 -37145
- package/src/components/SheetObjectSettings.tsx +0 -38
- package/src/components/Toolbar/Toolbar.tsx +0 -346
- package/src/compute-graph/compute-graph-registry.ts +0 -90
- package/src/compute-graph/compute-graph.test.ts +0 -87
- package/src/compute-graph/compute-graph.ts +0 -260
- package/src/compute-graph/compute-node.ts +0 -62
- package/src/compute-graph/functions/async-function.ts +0 -179
- package/src/compute-graph/functions/edge-function.ts +0 -102
- package/src/compute-graph/functions/function-defs.ts +0 -2427
- package/src/compute-graph/functions/index.ts +0 -7
- package/src/compute-graph/hyperformula.test.ts +0 -14
- package/src/compute-graph/index.ts +0 -8
- package/src/compute-graph/testing/index.ts +0 -6
- package/src/compute-graph/testing/test-builder.ts +0 -54
- package/src/compute-graph/testing/test-plugin.ts +0 -100
- package/src/compute-graph/util.ts +0 -8
- package/src/defs/types.test.ts +0 -91
- package/src/defs/types.ts +0 -88
- package/src/types.ts +0 -125
- /package/dist/lib/browser/{compute-graph-SNUS7HOH.mjs.map → types/index.mjs.map} +0 -0
- /package/dist/lib/{browser/meta.mjs.map → node-esm/types/index.mjs.map} +0 -0
- /package/dist/types/src/{compute-graph → components/ComputeGraph}/compute-graph.stories.d.ts +0 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useEffect } from 'react';
|
|
6
|
+
|
|
7
|
+
import { inRange } from '@dxos/compute';
|
|
8
|
+
import { createMenuAction, createMenuItemGroup, type ToolbarMenuActionGroupProperties } from '@dxos/react-ui-menu';
|
|
9
|
+
|
|
10
|
+
import { SHEET_PLUGIN } from '../../meta';
|
|
11
|
+
import { rangeFromIndex, type StyleKey, type StyleValue } from '../../types';
|
|
12
|
+
import { useSheetContext } from '../SheetContext';
|
|
13
|
+
|
|
14
|
+
export type StyleState = Partial<Record<StyleValue, boolean>>;
|
|
15
|
+
|
|
16
|
+
export type StyleAction = { key: StyleKey; value: StyleValue };
|
|
17
|
+
|
|
18
|
+
const styles: Record<StyleValue, string> = {
|
|
19
|
+
highlight: 'ph--highlighter--regular',
|
|
20
|
+
softwrap: 'ph--paragraph--regular',
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const useStyleState = (state: StyleState) => {
|
|
24
|
+
const { cursorFallbackRange, model } = useSheetContext();
|
|
25
|
+
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
state.highlight = false;
|
|
28
|
+
state.softwrap = false;
|
|
29
|
+
if (cursorFallbackRange && model.sheet.ranges) {
|
|
30
|
+
model.sheet.ranges
|
|
31
|
+
.filter(
|
|
32
|
+
({ range, key }) => key === 'style' && inRange(rangeFromIndex(model.sheet, range), cursorFallbackRange.from),
|
|
33
|
+
)
|
|
34
|
+
.forEach(({ value }) => {
|
|
35
|
+
state[value as StyleValue] = true;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}, [cursorFallbackRange, model.sheet]);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const createStyleGroup = (state: StyleState) => {
|
|
42
|
+
return createMenuItemGroup('style', {
|
|
43
|
+
variant: 'toggleGroup',
|
|
44
|
+
selectCardinality: 'multiple',
|
|
45
|
+
value: Object.keys(styles)
|
|
46
|
+
.filter((key) => !!state[key as StyleValue])
|
|
47
|
+
.map((styleValue) => `style--${styleValue}`),
|
|
48
|
+
} as ToolbarMenuActionGroupProperties);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const createStyleActions = (state: StyleState) =>
|
|
52
|
+
Object.entries(styles).map(([styleValue, icon]) => {
|
|
53
|
+
return createMenuAction<StyleAction>(`style--${styleValue}`, {
|
|
54
|
+
key: 'style',
|
|
55
|
+
value: styleValue as StyleValue,
|
|
56
|
+
icon,
|
|
57
|
+
label: [`range value ${styleValue} label`, { ns: SHEET_PLUGIN }],
|
|
58
|
+
checked: !!state[styleValue as StyleValue],
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export const createStyle = (state: StyleState) => {
|
|
63
|
+
const styleGroupAction = createStyleGroup(state);
|
|
64
|
+
const styleActions = createStyleActions(state);
|
|
65
|
+
return {
|
|
66
|
+
nodes: [styleGroupAction, ...styleActions],
|
|
67
|
+
edges: [
|
|
68
|
+
{ source: 'root', target: 'style' },
|
|
69
|
+
...styleActions.map(({ id }) => ({ source: styleGroupAction.id, target: id })),
|
|
70
|
+
],
|
|
71
|
+
};
|
|
72
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useCallback } from 'react';
|
|
6
|
+
|
|
7
|
+
import { createIntent, useIntentDispatcher } from '@dxos/app-framework';
|
|
8
|
+
import { inRange } from '@dxos/compute';
|
|
9
|
+
import { ThreadAction } from '@dxos/plugin-thread/types';
|
|
10
|
+
import type { MenuAction, MenuActionHandler } from '@dxos/react-ui-menu';
|
|
11
|
+
|
|
12
|
+
import { type AlignAction } from './align';
|
|
13
|
+
import { type CommentAction } from './comment';
|
|
14
|
+
import { type StyleAction } from './style';
|
|
15
|
+
import { type ToolbarState } from './useToolbarState';
|
|
16
|
+
import { completeCellRangeToThreadCursor } from '../../integrations';
|
|
17
|
+
import { alignKey, rangeFromIndex, rangeToIndex } from '../../types';
|
|
18
|
+
import { useSheetContext } from '../SheetContext';
|
|
19
|
+
|
|
20
|
+
export type ToolbarAction = StyleAction | AlignAction | CommentAction;
|
|
21
|
+
|
|
22
|
+
export const useToolbarAction = (state: ToolbarState) => {
|
|
23
|
+
const { model, cursorFallbackRange, cursor } = useSheetContext();
|
|
24
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
25
|
+
|
|
26
|
+
// TODO(Zan): Externalize the toolbar action handler. E.g., Toolbar/keys should both fire events.
|
|
27
|
+
return useCallback(
|
|
28
|
+
(action: MenuAction<ToolbarAction>) => {
|
|
29
|
+
const { key, value } = action.properties;
|
|
30
|
+
if (cursorFallbackRange) {
|
|
31
|
+
const index =
|
|
32
|
+
model.sheet.ranges?.findIndex(
|
|
33
|
+
(range) => range.key === key && inRange(rangeFromIndex(model.sheet, range.range), cursorFallbackRange.from),
|
|
34
|
+
) ?? -1;
|
|
35
|
+
const nextRangeEntity = {
|
|
36
|
+
range: rangeToIndex(model.sheet, cursorFallbackRange),
|
|
37
|
+
key,
|
|
38
|
+
value,
|
|
39
|
+
};
|
|
40
|
+
switch (key) {
|
|
41
|
+
case 'alignment':
|
|
42
|
+
if (index < 0) {
|
|
43
|
+
model.sheet.ranges?.push(nextRangeEntity);
|
|
44
|
+
state[alignKey] = value;
|
|
45
|
+
} else if (model.sheet.ranges![index].value === value) {
|
|
46
|
+
model.sheet.ranges?.splice(index, 1);
|
|
47
|
+
state[alignKey] = undefined;
|
|
48
|
+
} else {
|
|
49
|
+
model.sheet.ranges?.splice(index, 1, nextRangeEntity);
|
|
50
|
+
state[alignKey] = value;
|
|
51
|
+
}
|
|
52
|
+
break;
|
|
53
|
+
case 'style':
|
|
54
|
+
if (
|
|
55
|
+
model.sheet.ranges
|
|
56
|
+
.filter(
|
|
57
|
+
({ range, key: rangeKey }) =>
|
|
58
|
+
rangeKey === 'style' && inRange(rangeFromIndex(model.sheet, range), cursorFallbackRange.from),
|
|
59
|
+
)
|
|
60
|
+
.some(({ value: rangeValue }) => rangeValue === value)
|
|
61
|
+
) {
|
|
62
|
+
// this value should be unset
|
|
63
|
+
if (index >= 0) {
|
|
64
|
+
model.sheet.ranges?.splice(index, 1);
|
|
65
|
+
}
|
|
66
|
+
state[value] = false;
|
|
67
|
+
} else {
|
|
68
|
+
model.sheet.ranges?.push(nextRangeEntity);
|
|
69
|
+
state[value] = true;
|
|
70
|
+
}
|
|
71
|
+
break;
|
|
72
|
+
case 'comment': {
|
|
73
|
+
const cellContent = model.getCellText(cursorFallbackRange.from);
|
|
74
|
+
void dispatch(
|
|
75
|
+
createIntent(ThreadAction.Create, {
|
|
76
|
+
cursor: completeCellRangeToThreadCursor(cursorFallbackRange),
|
|
77
|
+
name: cellContent,
|
|
78
|
+
subject: model.sheet,
|
|
79
|
+
}),
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
[model.sheet, cursorFallbackRange, cursor, dispatch],
|
|
86
|
+
) as MenuActionHandler;
|
|
87
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useMemo } from 'react';
|
|
6
|
+
|
|
7
|
+
import { create } from '@dxos/live-object';
|
|
8
|
+
|
|
9
|
+
import { type AlignState } from './align';
|
|
10
|
+
import { type CommentState } from './comment';
|
|
11
|
+
import { type StyleState } from './style';
|
|
12
|
+
|
|
13
|
+
export type ToolbarState = Partial<StyleState & AlignState & CommentState>;
|
|
14
|
+
|
|
15
|
+
export const useToolbarState = (initialState: ToolbarState = {}) => {
|
|
16
|
+
return useMemo(() => create<ToolbarState>(initialState), []);
|
|
17
|
+
};
|
package/src/components/index.ts
CHANGED
|
@@ -15,13 +15,16 @@ import {
|
|
|
15
15
|
import { Decoration, EditorView, ViewPlugin, WidgetType } from '@codemirror/view';
|
|
16
16
|
|
|
17
17
|
import { type UnsubscribeCallback, debounce } from '@dxos/async';
|
|
18
|
+
import {
|
|
19
|
+
createSheetName,
|
|
20
|
+
type CellAddress,
|
|
21
|
+
type CellScalarValue,
|
|
22
|
+
type ComputeGraph,
|
|
23
|
+
type ComputeNode,
|
|
24
|
+
} from '@dxos/compute';
|
|
18
25
|
import { invariant } from '@dxos/invariant';
|
|
19
26
|
import { documentId, singleValueFacet } from '@dxos/react-ui-editor';
|
|
20
27
|
|
|
21
|
-
import { type ComputeGraph, type ComputeNode, createSheetName } from '../compute-graph';
|
|
22
|
-
import { type CellAddress } from '../defs';
|
|
23
|
-
import { type CellScalarValue } from '../types';
|
|
24
|
-
|
|
25
28
|
const LANGUAGE_TAG = 'dx';
|
|
26
29
|
|
|
27
30
|
// TODO(burdon): Create marker just for our decorator?
|
|
@@ -8,8 +8,9 @@ import { testTree } from '@lezer/generator/test';
|
|
|
8
8
|
import { spreadsheet } from 'codemirror-lang-spreadsheet';
|
|
9
9
|
import { describe, expect, test } from 'vitest';
|
|
10
10
|
|
|
11
|
+
import { defaultFunctions } from '@dxos/compute';
|
|
12
|
+
|
|
11
13
|
import { sheetExtension } from './extension';
|
|
12
|
-
import { defaultFunctions } from '../../compute-graph';
|
|
13
14
|
|
|
14
15
|
describe('formula parser', () => {
|
|
15
16
|
const {
|
|
@@ -18,12 +18,11 @@ import { type SyntaxNode } from '@lezer/common';
|
|
|
18
18
|
import { tags } from '@lezer/highlight';
|
|
19
19
|
import { spreadsheet } from 'codemirror-lang-spreadsheet';
|
|
20
20
|
|
|
21
|
+
import { type FunctionDefinition } from '@dxos/compute';
|
|
22
|
+
import { RANGE_NOTATION } from '@dxos/compute';
|
|
21
23
|
import { singleValueFacet } from '@dxos/react-ui-editor';
|
|
22
24
|
import { mx } from '@dxos/react-ui-theme';
|
|
23
25
|
|
|
24
|
-
import { type FunctionDefinition } from '../../compute-graph';
|
|
25
|
-
import { RANGE_NOTATION } from '../../defs';
|
|
26
|
-
|
|
27
26
|
/**
|
|
28
27
|
* https://codemirror.net/examples/styling
|
|
29
28
|
* https://lezer.codemirror.net/docs/ref/#highlight
|
package/src/index.ts
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
export { SheetCapabilities } from './capabilities';
|
|
6
|
+
export * from './meta';
|
|
7
7
|
export * from './SheetPlugin';
|
|
8
|
-
|
|
9
|
-
// TODO(burdon): Move to types entrypoint or create a new one.
|
|
10
|
-
export * from './defs';
|
|
11
|
-
|
|
12
|
-
export default SheetPlugin;
|
|
@@ -4,13 +4,20 @@
|
|
|
4
4
|
|
|
5
5
|
import { useCallback, useEffect, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
createIntent,
|
|
9
|
+
createResolver,
|
|
10
|
+
LayoutAction,
|
|
11
|
+
useIntentDispatcher,
|
|
12
|
+
useIntentResolver,
|
|
13
|
+
} from '@dxos/app-framework';
|
|
8
14
|
import { debounce } from '@dxos/async';
|
|
15
|
+
import { type CellAddress, type CompleteCellRange, inRange } from '@dxos/compute';
|
|
16
|
+
import { ThreadAction } from '@dxos/plugin-thread/types';
|
|
9
17
|
import { fullyQualifiedId } from '@dxos/react-client/echo';
|
|
10
18
|
import { type DxGridElement, type DxGridPosition } from '@dxos/react-ui-grid';
|
|
11
19
|
|
|
12
20
|
import { useSheetContext } from '../components';
|
|
13
|
-
import { type CellAddress, type CompleteCellRange, inRange } from '../defs';
|
|
14
21
|
import { SHEET_PLUGIN } from '../meta';
|
|
15
22
|
|
|
16
23
|
export const completeCellRangeToThreadCursor = (range: CompleteCellRange): string => {
|
|
@@ -32,31 +39,30 @@ export const parseThreadAnchorAsCellRange = (cursor: string): CompleteCellRange
|
|
|
32
39
|
|
|
33
40
|
export const useUpdateFocusedCellOnThreadSelection = (grid: DxGridElement | null) => {
|
|
34
41
|
const { model, setActiveRefs } = useSheetContext();
|
|
35
|
-
const
|
|
36
|
-
(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
setActiveRefs(data.thread);
|
|
42
|
+
const scrollIntoViewResolver = useMemo(
|
|
43
|
+
() =>
|
|
44
|
+
createResolver(
|
|
45
|
+
LayoutAction.ScrollIntoView,
|
|
46
|
+
({ cursor, ref }) => {
|
|
47
|
+
setActiveRefs(ref);
|
|
43
48
|
// TODO(Zan): Everywhere we refer to the cursor in a thread context should change to `anchor`.
|
|
44
|
-
const range = parseThreadAnchorAsCellRange(
|
|
49
|
+
const range = parseThreadAnchorAsCellRange(cursor!);
|
|
45
50
|
range && grid?.setFocus({ ...range.to, plane: 'grid' }, true);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
disposition: 'hoist',
|
|
54
|
+
filter: (data) => data.id === fullyQualifiedId(model.sheet) && !!data.cursor,
|
|
55
|
+
},
|
|
56
|
+
),
|
|
51
57
|
[model.sheet, setActiveRefs],
|
|
52
58
|
);
|
|
53
59
|
|
|
54
|
-
useIntentResolver(SHEET_PLUGIN,
|
|
60
|
+
useIntentResolver(SHEET_PLUGIN, scrollIntoViewResolver);
|
|
55
61
|
};
|
|
56
62
|
|
|
57
63
|
export const useSelectThreadOnCellFocus = () => {
|
|
58
64
|
const { model, cursor } = useSheetContext();
|
|
59
|
-
const dispatch = useIntentDispatcher();
|
|
65
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
60
66
|
|
|
61
67
|
const threads = useMemo(
|
|
62
68
|
() => model.sheet.threads?.filter((thread): thread is NonNullable<typeof thread> => !!thread) ?? [],
|
|
@@ -72,9 +78,9 @@ export const useSelectThreadOnCellFocus = () => {
|
|
|
72
78
|
return;
|
|
73
79
|
}
|
|
74
80
|
|
|
75
|
-
const closestThread = threads?.find((
|
|
76
|
-
if (anchor) {
|
|
77
|
-
const range = parseThreadAnchorAsCellRange(anchor);
|
|
81
|
+
const closestThread = threads?.find((ref) => {
|
|
82
|
+
if (ref.target?.anchor) {
|
|
83
|
+
const range = parseThreadAnchorAsCellRange(ref.target!.anchor);
|
|
78
84
|
return range ? inRange(range, cellAddress) : false;
|
|
79
85
|
} else {
|
|
80
86
|
return false;
|
|
@@ -82,9 +88,7 @@ export const useSelectThreadOnCellFocus = () => {
|
|
|
82
88
|
});
|
|
83
89
|
|
|
84
90
|
if (closestThread) {
|
|
85
|
-
void dispatch(
|
|
86
|
-
{ action: 'dxos.org/plugin/thread/action/select', data: { current: fullyQualifiedId(closestThread) } },
|
|
87
|
-
]);
|
|
91
|
+
void dispatch(createIntent(ThreadAction.Select, { current: fullyQualifiedId(closestThread) }));
|
|
88
92
|
}
|
|
89
93
|
},
|
|
90
94
|
[dispatch, threads],
|
package/src/meta.ts
CHANGED
|
@@ -5,20 +5,14 @@
|
|
|
5
5
|
import { afterEach, beforeEach, describe, expect, onTestFinished, test } from 'vitest';
|
|
6
6
|
|
|
7
7
|
import { Trigger } from '@dxos/async';
|
|
8
|
+
import { type CellScalarValue, addressFromA1Notation, isFormula } from '@dxos/compute';
|
|
9
|
+
import { TestBuilder, testFunctionPlugins } from '@dxos/compute/testing';
|
|
10
|
+
import { FunctionType } from '@dxos/functions';
|
|
8
11
|
import { log } from '@dxos/log';
|
|
9
|
-
import { FunctionType } from '@dxos/plugin-script/types';
|
|
10
12
|
|
|
11
13
|
import { SheetModel } from './sheet-model';
|
|
12
14
|
import { createTestGrid } from './testing';
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
addressFromA1Notation,
|
|
16
|
-
createSheet,
|
|
17
|
-
isFormula,
|
|
18
|
-
mapFormulaIndicesToRefs,
|
|
19
|
-
mapFormulaRefsToIndices,
|
|
20
|
-
} from '../defs';
|
|
21
|
-
import { type CellScalarValue } from '../types';
|
|
15
|
+
import { createSheet, mapFormulaIndicesToRefs, mapFormulaRefsToIndices } from '../types';
|
|
22
16
|
|
|
23
17
|
describe('SheetModel', () => {
|
|
24
18
|
let testBuilder: TestBuilder;
|
package/src/model/sheet-model.ts
CHANGED
|
@@ -2,37 +2,45 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type SimpleCellRange } from 'hyperformula/typings/AbsoluteCellRange';
|
|
6
|
-
import { type SimpleCellAddress } from 'hyperformula/typings/Cell';
|
|
7
|
-
import { type SimpleDate, type SimpleDateTime } from 'hyperformula/typings/DateTimeHelper';
|
|
8
|
-
|
|
9
5
|
import { Event } from '@dxos/async';
|
|
6
|
+
import {
|
|
7
|
+
addressFromA1Notation,
|
|
8
|
+
addressToA1Notation,
|
|
9
|
+
createSheetName,
|
|
10
|
+
isFormula,
|
|
11
|
+
type CellAddress,
|
|
12
|
+
type CellRange,
|
|
13
|
+
type CellScalarValue,
|
|
14
|
+
type ComputeGraph,
|
|
15
|
+
type ComputeNode,
|
|
16
|
+
type ComputeNodeEvent,
|
|
17
|
+
DetailedCellError,
|
|
18
|
+
ExportedCellChange,
|
|
19
|
+
type SimpleCellRange,
|
|
20
|
+
type SimpleCellAddress,
|
|
21
|
+
type SimpleDate,
|
|
22
|
+
type SimpleDateTime,
|
|
23
|
+
} from '@dxos/compute';
|
|
10
24
|
import { Resource } from '@dxos/context';
|
|
11
25
|
import { getTypename, FormatEnum, TypeEnum } from '@dxos/echo-schema';
|
|
12
26
|
import { invariant } from '@dxos/invariant';
|
|
13
27
|
import { PublicKey } from '@dxos/keys';
|
|
14
28
|
import { log } from '@dxos/log';
|
|
15
29
|
|
|
16
|
-
import { DetailedCellError, ExportedCellChange } from '#hyperformula';
|
|
17
|
-
import { type ComputeGraph, type ComputeNode, type ComputeNodeEvent, createSheetName } from '../compute-graph';
|
|
18
30
|
import {
|
|
19
|
-
|
|
31
|
+
ReadonlyException,
|
|
20
32
|
addressFromIndex,
|
|
21
|
-
addressToA1Notation,
|
|
22
33
|
addressToIndex,
|
|
23
34
|
initialize,
|
|
24
35
|
insertIndices,
|
|
25
|
-
isFormula,
|
|
26
|
-
type CellAddress,
|
|
27
|
-
type CellRange,
|
|
28
|
-
ReadonlyException,
|
|
29
|
-
MAX_COLUMNS,
|
|
30
|
-
MAX_ROWS,
|
|
31
36
|
mapFormulaIndicesToRefs,
|
|
32
37
|
mapFormulaRefsToIndices,
|
|
33
|
-
|
|
34
|
-
|
|
38
|
+
MAX_ROWS,
|
|
39
|
+
MAX_COLS,
|
|
40
|
+
} from '../types';
|
|
41
|
+
import { type SheetAction, type CellValue, type SheetType } from '../types';
|
|
35
42
|
|
|
43
|
+
// TODO(burdon): Move to compute.
|
|
36
44
|
// Map sheet types to system types.
|
|
37
45
|
// https://hyperformula.handsontable.com/guide/types-of-values.html
|
|
38
46
|
// - https://github.com/handsontable/hyperformula/blob/master/src/Cell.ts (CellValueType)
|
|
@@ -176,12 +184,12 @@ export class SheetModel extends Resource {
|
|
|
176
184
|
}
|
|
177
185
|
|
|
178
186
|
insertColumns(i: number, n = 1) {
|
|
179
|
-
const idx = insertIndices(this._sheet.columns, i, n,
|
|
187
|
+
const idx = insertIndices(this._sheet.columns, i, n, MAX_COLS);
|
|
180
188
|
this.reset();
|
|
181
189
|
return idx;
|
|
182
190
|
}
|
|
183
191
|
|
|
184
|
-
dropRow(rowIndex: string): RestoreAxis {
|
|
192
|
+
dropRow(rowIndex: string): SheetAction.RestoreAxis {
|
|
185
193
|
const range = {
|
|
186
194
|
from: addressFromIndex(this._sheet, `${this._sheet.columns[0]}@${rowIndex}`),
|
|
187
195
|
to: addressFromIndex(this._sheet, `${this._sheet.columns[this._sheet.columns.length - 1]}@${rowIndex}`),
|
|
@@ -195,7 +203,7 @@ export class SheetModel extends Resource {
|
|
|
195
203
|
return { axis: 'row', index, axisIndex: rowIndex, axisMeta: this._sheet.rowMeta[rowIndex], values };
|
|
196
204
|
}
|
|
197
205
|
|
|
198
|
-
dropColumn(colIndex: string): RestoreAxis {
|
|
206
|
+
dropColumn(colIndex: string): SheetAction.RestoreAxis {
|
|
199
207
|
const range = {
|
|
200
208
|
from: addressFromIndex(this._sheet, `${colIndex}@${this._sheet.rows[0]}`),
|
|
201
209
|
to: addressFromIndex(this._sheet, `${colIndex}@${this._sheet.rows[this._sheet.rows.length - 1]}`),
|
|
@@ -209,7 +217,7 @@ export class SheetModel extends Resource {
|
|
|
209
217
|
return { axis: 'col', index, axisIndex: colIndex, axisMeta: this._sheet.rowMeta[colIndex], values };
|
|
210
218
|
}
|
|
211
219
|
|
|
212
|
-
restoreRow({ index, axisIndex, axisMeta, values }: RestoreAxis) {
|
|
220
|
+
restoreRow({ index, axisIndex, axisMeta, values }: SheetAction.RestoreAxis) {
|
|
213
221
|
this._sheet.rows.splice(index, 0, axisIndex);
|
|
214
222
|
values.forEach((value, col) => {
|
|
215
223
|
if (value) {
|
|
@@ -222,7 +230,7 @@ export class SheetModel extends Resource {
|
|
|
222
230
|
this.reset();
|
|
223
231
|
}
|
|
224
232
|
|
|
225
|
-
restoreColumn({ index, axisIndex, axisMeta, values }: RestoreAxis) {
|
|
233
|
+
restoreColumn({ index, axisIndex, axisMeta, values }: SheetAction.RestoreAxis) {
|
|
226
234
|
this._sheet.columns.splice(index, 0, axisIndex);
|
|
227
235
|
values.forEach((value, row) => {
|
|
228
236
|
if (value) {
|
|
@@ -373,7 +381,7 @@ export class SheetModel extends Resource {
|
|
|
373
381
|
refresh = true;
|
|
374
382
|
}
|
|
375
383
|
if (cell.col >= this._sheet.columns.length) {
|
|
376
|
-
insertIndices(this._sheet.columns, cell.col, 1,
|
|
384
|
+
insertIndices(this._sheet.columns, cell.col, 1, MAX_COLS);
|
|
377
385
|
refresh = true;
|
|
378
386
|
}
|
|
379
387
|
|
package/src/model/testing.ts
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { addressToA1Notation
|
|
6
|
-
|
|
5
|
+
import { addressToA1Notation } from '@dxos/compute';
|
|
6
|
+
|
|
7
|
+
import { type CellValue, type SheetType, createSheet } from '../types';
|
|
7
8
|
|
|
8
9
|
// TODO(burdon): Create testing endpoint.
|
|
9
10
|
// TODO(burdon): Move to react-ui-sheet.
|
package/src/sanity.test.ts
CHANGED
|
@@ -12,7 +12,7 @@ import { describe, test, expect } from 'vitest';
|
|
|
12
12
|
|
|
13
13
|
import { Client } from '@dxos/client';
|
|
14
14
|
import { create } from '@dxos/client/echo';
|
|
15
|
-
import { FunctionType } from '@dxos/
|
|
15
|
+
import { FunctionType } from '@dxos/functions';
|
|
16
16
|
|
|
17
17
|
// TODO(burdon): Fix test infrastructure:
|
|
18
18
|
// - Need docs? esp. needed for config. need pristine example package?
|
package/src/testing/testing.tsx
CHANGED
|
@@ -5,13 +5,12 @@
|
|
|
5
5
|
import { type Decorator } from '@storybook/react';
|
|
6
6
|
import React, { useState } from 'react';
|
|
7
7
|
|
|
8
|
+
import { type ComputeGraph, type ComputeGraphOptions, ComputeGraphRegistry } from '@dxos/compute';
|
|
8
9
|
import { type Space } from '@dxos/react-client/echo';
|
|
9
10
|
import { useAsyncState } from '@dxos/react-hooks';
|
|
10
11
|
|
|
11
12
|
import { ComputeGraphContextProvider } from '../components';
|
|
12
|
-
import {
|
|
13
|
-
import { createSheet } from '../defs';
|
|
14
|
-
import { type CreateSheetOptions } from '../types';
|
|
13
|
+
import { createSheet, type CreateSheetOptions } from '../types';
|
|
15
14
|
|
|
16
15
|
export const useTestSheet = (space?: Space, graph?: ComputeGraph, options?: CreateSheetOptions) => {
|
|
17
16
|
const [sheet] = useAsyncState(async () => {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Ref, S, TypedObject } from '@dxos/echo-schema';
|
|
6
|
+
import { ThreadType } from '@dxos/plugin-space/types';
|
|
7
|
+
|
|
8
|
+
export const CellValue = S.Struct({
|
|
9
|
+
// TODO(burdon): How to store dates (datetime, date, time), percentages, etc.
|
|
10
|
+
// Consider import/export; natural access for other plugins. Special handling for currency (precision).
|
|
11
|
+
// TODO(burdon): Automerge (long string) or short string or number.
|
|
12
|
+
value: S.Any,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export type CellValue = S.Schema.Type<typeof CellValue>;
|
|
16
|
+
|
|
17
|
+
// TODO(burdon): IMPORTANT: Reconcile with Field definition.
|
|
18
|
+
export const Range = S.Struct({
|
|
19
|
+
range: S.String,
|
|
20
|
+
key: S.String,
|
|
21
|
+
value: S.String,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export type Range = S.Schema.Type<typeof Range>;
|
|
25
|
+
|
|
26
|
+
// TODO(burdon): Visibility, locked, frozen, etc.
|
|
27
|
+
export const RowColumnMeta = S.Struct({
|
|
28
|
+
size: S.optional(S.Number),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// TODO(burdon): Reconcile col/column (across packages).
|
|
32
|
+
// TODO(burdon): Index to all updates when rows/columns are inserted/deleted.
|
|
33
|
+
export class SheetType extends TypedObject({ typename: 'dxos.org/type/Sheet', version: '0.1.0' })({
|
|
34
|
+
name: S.optional(S.String),
|
|
35
|
+
|
|
36
|
+
// Sparse map of cells referenced by index.
|
|
37
|
+
cells: S.mutable(S.Record({ key: S.String, value: S.mutable(CellValue) })),
|
|
38
|
+
|
|
39
|
+
// Ordered row indices.
|
|
40
|
+
rows: S.mutable(S.Array(S.String)),
|
|
41
|
+
|
|
42
|
+
// Ordered column indices.
|
|
43
|
+
columns: S.mutable(S.Array(S.String)),
|
|
44
|
+
|
|
45
|
+
// Row metadata referenced by index.
|
|
46
|
+
rowMeta: S.mutable(S.Record({ key: S.String, value: S.mutable(RowColumnMeta) })),
|
|
47
|
+
|
|
48
|
+
// Column metadata referenced by index.
|
|
49
|
+
columnMeta: S.mutable(S.Record({ key: S.String, value: S.mutable(RowColumnMeta) })),
|
|
50
|
+
|
|
51
|
+
// Cell formatting referenced by indexed range.
|
|
52
|
+
ranges: S.mutable(S.Array(Range)),
|
|
53
|
+
|
|
54
|
+
// Threads associated with the sheet
|
|
55
|
+
threads: S.optional(S.mutable(S.Array(Ref(ThreadType)))),
|
|
56
|
+
}) {}
|
|
@@ -8,7 +8,7 @@ import { type SheetType } from '../types';
|
|
|
8
8
|
|
|
9
9
|
export const alignKey = 'alignment';
|
|
10
10
|
export type AlignKey = typeof alignKey;
|
|
11
|
-
export type AlignValue = 'start' | 'center' | 'end'
|
|
11
|
+
export type AlignValue = 'start' | 'center' | 'end';
|
|
12
12
|
|
|
13
13
|
export const commentKey = 'comment';
|
|
14
14
|
export type CommentKey = typeof commentKey;
|