@dxos/plugin-sheet 0.6.13 → 0.6.14-main.1366248
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-JZEKRM4Z.mjs +297 -0
- package/dist/lib/browser/SheetContainer-JZEKRM4Z.mjs.map +7 -0
- package/dist/lib/browser/chunk-BVUN7SHF.mjs +67 -0
- package/dist/lib/browser/chunk-BVUN7SHF.mjs.map +7 -0
- package/dist/lib/browser/chunk-G2FUL6PK.mjs +1671 -0
- package/dist/lib/browser/chunk-G2FUL6PK.mjs.map +7 -0
- package/dist/lib/browser/chunk-RABELMEQ.mjs +15 -0
- package/dist/lib/browser/chunk-RABELMEQ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-D5AGLXJP.mjs → chunk-VMSX6Z4X.mjs} +659 -675
- package/dist/lib/browser/chunk-VMSX6Z4X.mjs.map +7 -0
- package/dist/lib/browser/compute-graph-GGWUX644.mjs +35 -0
- package/dist/lib/browser/compute-graph-GGWUX644.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +168 -67
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -1
- package/dist/lib/browser/types.mjs +6 -12
- package/dist/lib/node/SheetContainer-PJE74VO4.cjs +300 -0
- package/dist/lib/node/SheetContainer-PJE74VO4.cjs.map +7 -0
- package/dist/lib/node/chunk-2ZVZI2KJ.cjs +38 -0
- package/dist/lib/node/chunk-2ZVZI2KJ.cjs.map +7 -0
- package/dist/lib/node/{chunk-DSYKOI4E.cjs → chunk-AWKOWDMI.cjs} +34 -52
- package/dist/lib/node/chunk-AWKOWDMI.cjs.map +7 -0
- package/dist/lib/node/{chunk-5KKJ4NPP.cjs → chunk-O7XR4R7Y.cjs} +678 -674
- package/dist/lib/node/chunk-O7XR4R7Y.cjs.map +7 -0
- package/dist/lib/node/chunk-STZ7S7RF.cjs +1656 -0
- package/dist/lib/node/chunk-STZ7S7RF.cjs.map +7 -0
- package/dist/lib/node/compute-graph-KGWA2QLE.cjs +57 -0
- package/dist/lib/node/compute-graph-KGWA2QLE.cjs.map +7 -0
- package/dist/lib/node/index.cjs +178 -75
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.cjs +3 -3
- package/dist/lib/node/meta.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/types.cjs +9 -15
- package/dist/lib/node/types.cjs.map +2 -2
- package/dist/lib/node-esm/SheetContainer-R73XEXHU.mjs +298 -0
- package/dist/lib/node-esm/SheetContainer-R73XEXHU.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-BM2Q3FFC.mjs +17 -0
- package/dist/lib/node-esm/chunk-BM2Q3FFC.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-CR4K75EL.mjs +3220 -0
- package/dist/lib/node-esm/chunk-CR4K75EL.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-UIBWRHW7.mjs +68 -0
- package/dist/lib/node-esm/chunk-UIBWRHW7.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-V5N3Y2O5.mjs +1672 -0
- package/dist/lib/node-esm/chunk-V5N3Y2O5.mjs.map +7 -0
- package/dist/lib/node-esm/compute-graph-2SCZT7N5.mjs +36 -0
- package/dist/lib/node-esm/compute-graph-2SCZT7N5.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +350 -0
- package/dist/lib/node-esm/index.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -0
- package/dist/lib/node-esm/meta.mjs +10 -0
- package/dist/lib/node-esm/meta.mjs.map +7 -0
- package/dist/lib/node-esm/types.mjs +17 -0
- package/dist/lib/node-esm/types.mjs.map +7 -0
- package/dist/types/src/SheetPlugin.d.ts.map +1 -1
- package/dist/types/src/components/ComputeGraph/ComputeGraphContextProvider.d.ts +13 -0
- package/dist/types/src/components/ComputeGraph/ComputeGraphContextProvider.d.ts.map +1 -0
- package/dist/types/src/components/ComputeGraph/index.d.ts +1 -3
- package/dist/types/src/components/ComputeGraph/index.d.ts.map +1 -1
- package/dist/types/src/components/FunctionEditor/FunctionEditor.d.ts +3 -0
- package/dist/types/src/components/FunctionEditor/FunctionEditor.d.ts.map +1 -0
- package/dist/types/src/components/FunctionEditor/index.d.ts +2 -0
- package/dist/types/src/components/FunctionEditor/index.d.ts.map +1 -0
- package/dist/types/src/components/GridSheet/GridSheet.d.ts +3 -0
- package/dist/types/src/components/GridSheet/GridSheet.d.ts.map +1 -0
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts +6 -0
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +1 -0
- package/dist/types/src/components/{CellEditor/CellEditor.stories.d.ts → GridSheet/SheetCellEditor.stories.d.ts} +5 -9
- package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts.map +1 -0
- package/dist/types/src/components/GridSheet/index.d.ts +2 -0
- package/dist/types/src/components/GridSheet/index.d.ts.map +1 -0
- package/dist/types/src/components/GridSheet/util.d.ts +15 -0
- package/dist/types/src/components/GridSheet/util.d.ts.map +1 -0
- package/dist/types/src/components/RangeList/RangeList.d.ts +7 -0
- package/dist/types/src/components/RangeList/RangeList.d.ts.map +1 -0
- package/dist/types/src/components/RangeList/index.d.ts +2 -0
- package/dist/types/src/components/RangeList/index.d.ts.map +1 -0
- package/dist/types/src/components/SheetContainer/SheetContainer.d.ts +9 -0
- package/dist/types/src/components/SheetContainer/SheetContainer.d.ts.map +1 -0
- package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts +6 -0
- package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +1 -0
- package/dist/types/src/components/SheetContainer/index.d.ts +3 -0
- package/dist/types/src/components/SheetContainer/index.d.ts.map +1 -0
- package/dist/types/src/components/SheetContext/SheetContext.d.ts +28 -0
- package/dist/types/src/components/SheetContext/SheetContext.d.ts.map +1 -0
- package/dist/types/src/components/SheetContext/index.d.ts +2 -0
- package/dist/types/src/components/SheetContext/index.d.ts.map +1 -0
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +36 -9
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +4 -32
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +7 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/compute-graph/compute-graph-registry.d.ts +34 -0
- package/dist/types/src/compute-graph/compute-graph-registry.d.ts.map +1 -0
- package/dist/types/src/compute-graph/compute-graph.d.ts +64 -0
- package/dist/types/src/compute-graph/compute-graph.d.ts.map +1 -0
- package/dist/types/src/compute-graph/compute-graph.stories.d.ts +6 -0
- package/dist/types/src/compute-graph/compute-graph.stories.d.ts.map +1 -0
- package/dist/types/src/compute-graph/compute-graph.test.d.ts +2 -0
- package/dist/types/src/compute-graph/compute-graph.test.d.ts.map +1 -0
- package/dist/types/src/compute-graph/compute-node.d.ts +26 -0
- package/dist/types/src/compute-graph/compute-node.d.ts.map +1 -0
- package/dist/types/src/{components/ComputeGraph → compute-graph/functions}/async-function.d.ts +14 -5
- package/dist/types/src/compute-graph/functions/async-function.d.ts.map +1 -0
- package/dist/types/src/compute-graph/functions/edge-function.d.ts +21 -0
- package/dist/types/src/compute-graph/functions/edge-function.d.ts.map +1 -0
- package/dist/types/src/{model/functions.d.ts → compute-graph/functions/function-defs.d.ts} +1 -1
- package/dist/types/src/compute-graph/functions/function-defs.d.ts.map +1 -0
- package/dist/types/src/compute-graph/functions/index.d.ts +4 -0
- package/dist/types/src/compute-graph/functions/index.d.ts.map +1 -0
- package/dist/types/src/compute-graph/hyperformula.test.d.ts +2 -0
- package/dist/types/src/compute-graph/hyperformula.test.d.ts.map +1 -0
- package/dist/types/src/compute-graph/index.d.ts +5 -0
- package/dist/types/src/compute-graph/index.d.ts.map +1 -0
- package/dist/types/src/compute-graph/testing/index.d.ts +3 -0
- package/dist/types/src/compute-graph/testing/index.d.ts.map +1 -0
- package/dist/types/src/compute-graph/testing/test-builder.d.ts +15 -0
- package/dist/types/src/compute-graph/testing/test-builder.d.ts.map +1 -0
- package/dist/types/src/compute-graph/testing/test-plugin.d.ts +36 -0
- package/dist/types/src/compute-graph/testing/test-plugin.d.ts.map +1 -0
- package/dist/types/src/compute-graph/util.d.ts +2 -0
- package/dist/types/src/compute-graph/util.d.ts.map +1 -0
- package/dist/types/src/defs/index.d.ts +4 -0
- package/dist/types/src/defs/index.d.ts.map +1 -0
- package/dist/types/src/defs/sheet-range-types.d.ts +13 -0
- package/dist/types/src/defs/sheet-range-types.d.ts.map +1 -0
- package/dist/types/src/defs/types.d.ts +28 -0
- package/dist/types/src/defs/types.d.ts.map +1 -0
- package/dist/types/src/defs/types.test.d.ts.map +1 -0
- package/dist/types/src/defs/util.d.ts +39 -0
- package/dist/types/src/defs/util.d.ts.map +1 -0
- package/dist/types/src/extensions/compute.d.ts +6 -0
- package/dist/types/src/extensions/compute.d.ts.map +1 -0
- package/dist/types/src/extensions/compute.stories.d.ts +21 -0
- package/dist/types/src/extensions/compute.stories.d.ts.map +1 -0
- package/dist/types/src/extensions/editor/extension.d.ts +39 -0
- package/dist/types/src/extensions/editor/extension.d.ts.map +1 -0
- package/dist/types/src/extensions/editor/extension.test.d.ts.map +1 -0
- package/dist/types/src/extensions/editor/index.d.ts +2 -0
- package/dist/types/src/extensions/editor/index.d.ts.map +1 -0
- package/dist/types/src/extensions/index.d.ts +3 -0
- package/dist/types/src/extensions/index.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/integrations/index.d.ts +2 -0
- package/dist/types/src/integrations/index.d.ts.map +1 -0
- package/dist/types/src/integrations/thread-ranges.d.ts +7 -0
- package/dist/types/src/integrations/thread-ranges.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts +4 -9
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/model/index.d.ts +2 -3
- package/dist/types/src/model/index.d.ts.map +1 -1
- package/dist/types/src/model/{model.d.ts → sheet-model.d.ts} +22 -69
- package/dist/types/src/model/sheet-model.d.ts.map +1 -0
- package/dist/types/src/model/sheet-model.test.d.ts +2 -0
- package/dist/types/src/model/sheet-model.test.d.ts.map +1 -0
- package/dist/types/src/model/useSheetModel.d.ts +8 -0
- package/dist/types/src/model/useSheetModel.d.ts.map +1 -0
- package/dist/types/src/sanity.test.d.ts +2 -0
- package/dist/types/src/sanity.test.d.ts.map +1 -0
- package/dist/types/src/serializer.d.ts +4 -0
- package/dist/types/src/serializer.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +2 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- package/dist/types/src/testing/testing.d.ts +8 -0
- package/dist/types/src/testing/testing.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +32 -12
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +132 -43
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/vendor/hyperformula.mjs +37145 -0
- package/package.json +60 -61
- package/src/SheetPlugin.tsx +89 -78
- package/src/components/ComputeGraph/ComputeGraphContextProvider.tsx +37 -0
- package/src/components/ComputeGraph/index.ts +1 -3
- package/src/components/FunctionEditor/FunctionEditor.tsx +45 -0
- package/src/components/FunctionEditor/index.ts +5 -0
- package/src/components/GridSheet/GridSheet.stories.tsx +46 -0
- package/src/components/GridSheet/GridSheet.tsx +358 -0
- package/src/components/{CellEditor/CellEditor.stories.tsx → GridSheet/SheetCellEditor.stories.tsx} +18 -15
- package/src/components/GridSheet/index.ts +5 -0
- package/src/components/GridSheet/util.ts +170 -0
- package/src/components/RangeList/RangeList.tsx +53 -0
- package/src/components/RangeList/index.ts +5 -0
- package/src/components/SheetContainer/SheetContainer.stories.tsx +45 -0
- package/src/components/SheetContainer/SheetContainer.tsx +33 -0
- package/src/components/SheetContainer/index.ts +7 -0
- package/src/components/SheetContext/SheetContext.tsx +127 -0
- package/src/components/SheetContext/index.ts +5 -0
- package/src/components/Toolbar/Toolbar.stories.tsx +9 -6
- package/src/components/Toolbar/Toolbar.tsx +265 -111
- package/src/components/index.ts +5 -3
- package/src/compute-graph/compute-graph-registry.ts +90 -0
- package/src/compute-graph/compute-graph.stories.tsx +97 -0
- package/src/compute-graph/compute-graph.test.ts +87 -0
- package/src/compute-graph/compute-graph.ts +260 -0
- package/src/compute-graph/compute-node.ts +62 -0
- package/src/{components/ComputeGraph → compute-graph/functions}/async-function.ts +26 -15
- package/src/{components/ComputeGraph → compute-graph/functions}/edge-function.ts +21 -17
- package/src/compute-graph/functions/index.ts +7 -0
- package/src/compute-graph/hyperformula.test.ts +14 -0
- package/src/compute-graph/index.ts +8 -0
- package/src/compute-graph/testing/index.ts +6 -0
- package/src/compute-graph/testing/test-builder.ts +54 -0
- package/src/{components/ComputeGraph/custom.ts → compute-graph/testing/test-plugin.ts} +44 -14
- package/src/compute-graph/util.ts +8 -0
- package/src/defs/index.ts +7 -0
- package/src/defs/sheet-range-types.ts +49 -0
- package/src/{model → defs}/types.test.ts +8 -9
- package/src/defs/types.ts +86 -0
- package/src/defs/util.ts +136 -0
- package/src/extensions/compute.stories.tsx +155 -0
- package/src/extensions/compute.ts +147 -0
- package/src/{components/CellEditor → extensions/editor}/extension.test.ts +4 -6
- package/src/{components/CellEditor → extensions/editor}/extension.ts +51 -27
- package/src/{components/CellEditor → extensions/editor}/index.ts +0 -1
- package/src/extensions/index.ts +6 -0
- package/src/index.ts +2 -2
- package/src/integrations/index.ts +5 -0
- package/src/integrations/thread-ranges.ts +101 -0
- package/src/meta.ts +15 -0
- package/src/model/index.ts +2 -3
- package/src/model/sheet-model.test.ts +59 -0
- package/src/model/sheet-model.ts +495 -0
- package/src/model/useSheetModel.ts +40 -0
- package/src/sanity.test.ts +40 -0
- package/src/serializer.ts +27 -0
- package/src/{components/Sheet → testing}/index.ts +1 -1
- package/src/testing/testing.tsx +68 -0
- package/src/translations.ts +24 -4
- package/src/types.ts +62 -47
- package/dist/lib/browser/SheetContainer-U4H5D34A.mjs +0 -1772
- package/dist/lib/browser/SheetContainer-U4H5D34A.mjs.map +0 -7
- package/dist/lib/browser/chunk-APHOLYUB.mjs +0 -175
- package/dist/lib/browser/chunk-APHOLYUB.mjs.map +0 -7
- package/dist/lib/browser/chunk-D5AGLXJP.mjs.map +0 -7
- package/dist/lib/browser/chunk-FUAGSXA4.mjs +0 -82
- package/dist/lib/browser/chunk-FUAGSXA4.mjs.map +0 -7
- package/dist/lib/browser/chunk-JRL5LGCE.mjs +0 -18
- package/dist/lib/browser/chunk-JRL5LGCE.mjs.map +0 -7
- package/dist/lib/browser/chunk-NU4PBN33.mjs +0 -8
- package/dist/lib/browser/chunk-NU4PBN33.mjs.map +0 -7
- package/dist/lib/browser/testing.mjs +0 -92
- package/dist/lib/browser/testing.mjs.map +0 -7
- package/dist/lib/node/SheetContainer-AXQV3ZT5.cjs +0 -1765
- package/dist/lib/node/SheetContainer-AXQV3ZT5.cjs.map +0 -7
- package/dist/lib/node/chunk-5KKJ4NPP.cjs.map +0 -7
- package/dist/lib/node/chunk-BJ6ZD7MN.cjs +0 -51
- package/dist/lib/node/chunk-BJ6ZD7MN.cjs.map +0 -7
- package/dist/lib/node/chunk-CN3RPESU.cjs +0 -202
- package/dist/lib/node/chunk-CN3RPESU.cjs.map +0 -7
- package/dist/lib/node/chunk-DSYKOI4E.cjs.map +0 -7
- package/dist/lib/node/chunk-PYXHNAAK.cjs +0 -40
- package/dist/lib/node/chunk-PYXHNAAK.cjs.map +0 -7
- package/dist/lib/node/testing.cjs +0 -111
- package/dist/lib/node/testing.cjs.map +0 -7
- package/dist/types/src/components/CellEditor/CellEditor.d.ts +0 -14
- package/dist/types/src/components/CellEditor/CellEditor.d.ts.map +0 -1
- package/dist/types/src/components/CellEditor/CellEditor.stories.d.ts.map +0 -1
- package/dist/types/src/components/CellEditor/extension.d.ts +0 -19
- package/dist/types/src/components/CellEditor/extension.d.ts.map +0 -1
- package/dist/types/src/components/CellEditor/extension.test.d.ts.map +0 -1
- package/dist/types/src/components/CellEditor/index.d.ts +0 -3
- package/dist/types/src/components/CellEditor/index.d.ts.map +0 -1
- package/dist/types/src/components/ComputeGraph/async-function.d.ts.map +0 -1
- package/dist/types/src/components/ComputeGraph/custom.d.ts +0 -21
- package/dist/types/src/components/ComputeGraph/custom.d.ts.map +0 -1
- package/dist/types/src/components/ComputeGraph/edge-function.d.ts +0 -20
- package/dist/types/src/components/ComputeGraph/edge-function.d.ts.map +0 -1
- package/dist/types/src/components/ComputeGraph/graph-context.d.ts +0 -12
- package/dist/types/src/components/ComputeGraph/graph-context.d.ts.map +0 -1
- package/dist/types/src/components/ComputeGraph/graph.browser.test.d.ts +0 -2
- package/dist/types/src/components/ComputeGraph/graph.browser.test.d.ts.map +0 -1
- package/dist/types/src/components/ComputeGraph/graph.d.ts +0 -26
- package/dist/types/src/components/ComputeGraph/graph.d.ts.map +0 -1
- package/dist/types/src/components/Sheet/Sheet.d.ts +0 -55
- package/dist/types/src/components/Sheet/Sheet.d.ts.map +0 -1
- package/dist/types/src/components/Sheet/Sheet.stories.d.ts +0 -54
- package/dist/types/src/components/Sheet/Sheet.stories.d.ts.map +0 -1
- package/dist/types/src/components/Sheet/formatting.d.ts +0 -14
- package/dist/types/src/components/Sheet/formatting.d.ts.map +0 -1
- package/dist/types/src/components/Sheet/grid.d.ts +0 -52
- package/dist/types/src/components/Sheet/grid.d.ts.map +0 -1
- package/dist/types/src/components/Sheet/index.d.ts +0 -2
- package/dist/types/src/components/Sheet/index.d.ts.map +0 -1
- package/dist/types/src/components/Sheet/nav.d.ts +0 -29
- package/dist/types/src/components/Sheet/nav.d.ts.map +0 -1
- package/dist/types/src/components/Sheet/sheet-context.d.ts +0 -25
- package/dist/types/src/components/Sheet/sheet-context.d.ts.map +0 -1
- package/dist/types/src/components/Sheet/util.d.ts +0 -18
- package/dist/types/src/components/Sheet/util.d.ts.map +0 -1
- package/dist/types/src/components/SheetContainer.d.ts +0 -9
- package/dist/types/src/components/SheetContainer.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/common.d.ts +0 -20
- package/dist/types/src/components/Toolbar/common.d.ts.map +0 -1
- package/dist/types/src/model/functions.d.ts.map +0 -1
- package/dist/types/src/model/model.browser.test.d.ts +0 -2
- package/dist/types/src/model/model.browser.test.d.ts.map +0 -1
- package/dist/types/src/model/model.d.ts.map +0 -1
- package/dist/types/src/model/types.d.ts +0 -17
- package/dist/types/src/model/types.d.ts.map +0 -1
- package/dist/types/src/model/types.test.d.ts.map +0 -1
- package/dist/types/src/model/util.d.ts +0 -15
- package/dist/types/src/model/util.d.ts.map +0 -1
- package/dist/types/src/testing.d.ts +0 -9
- package/dist/types/src/testing.d.ts.map +0 -1
- package/src/components/CellEditor/CellEditor.tsx +0 -113
- package/src/components/ComputeGraph/graph-context.tsx +0 -50
- package/src/components/ComputeGraph/graph.browser.test.ts +0 -50
- package/src/components/ComputeGraph/graph.ts +0 -62
- package/src/components/Sheet/Sheet.stories.tsx +0 -287
- package/src/components/Sheet/Sheet.tsx +0 -1160
- package/src/components/Sheet/formatting.ts +0 -106
- package/src/components/Sheet/grid.ts +0 -191
- package/src/components/Sheet/nav.ts +0 -157
- package/src/components/Sheet/sheet-context.tsx +0 -150
- package/src/components/Sheet/util.ts +0 -56
- package/src/components/SheetContainer.tsx +0 -34
- package/src/components/Toolbar/common.tsx +0 -72
- package/src/meta.tsx +0 -18
- package/src/model/model.browser.test.ts +0 -100
- package/src/model/model.ts +0 -550
- package/src/model/types.ts +0 -71
- package/src/model/util.ts +0 -36
- package/src/testing.ts +0 -50
- /package/dist/types/src/{model → defs}/types.test.d.ts +0 -0
- /package/dist/types/src/{components/CellEditor → extensions/editor}/extension.test.d.ts +0 -0
- /package/src/{model/functions.ts → compute-graph/functions/function-defs.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,39 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-sheet",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.14-main.1366248",
|
|
4
4
|
"description": "Braneframe sketch plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"author": "DXOS.org",
|
|
9
|
+
"sideEffects": true,
|
|
10
|
+
"imports": {
|
|
11
|
+
"#hyperformula": {
|
|
12
|
+
"types": "hyperformula",
|
|
13
|
+
"default": "./dist/vendor/hyperformula.mjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
9
16
|
"exports": {
|
|
10
17
|
".": {
|
|
18
|
+
"types": "./dist/types/src/index.d.ts",
|
|
11
19
|
"browser": "./dist/lib/browser/index.mjs",
|
|
12
|
-
"node":
|
|
13
|
-
"default": "./dist/lib/node/index.cjs"
|
|
14
|
-
},
|
|
15
|
-
"types": "./dist/types/src/index.d.ts"
|
|
20
|
+
"node": "./dist/lib/node-esm/index.mjs"
|
|
16
21
|
},
|
|
17
22
|
"./meta": {
|
|
23
|
+
"types": "./dist/types/src/meta.d.ts",
|
|
18
24
|
"browser": "./dist/lib/browser/meta.mjs",
|
|
19
|
-
"node":
|
|
20
|
-
"default": "./dist/lib/node/meta.cjs"
|
|
21
|
-
},
|
|
22
|
-
"types": "./dist/types/src/meta.d.ts"
|
|
23
|
-
},
|
|
24
|
-
"./testing": {
|
|
25
|
-
"browser": "./dist/lib/browser/testing.mjs",
|
|
26
|
-
"node": {
|
|
27
|
-
"default": "./dist/lib/node/testing.cjs"
|
|
28
|
-
},
|
|
29
|
-
"types": "./dist/types/src/testing.d.ts"
|
|
25
|
+
"node": "./dist/lib/node-esm/meta.mjs"
|
|
30
26
|
},
|
|
31
27
|
"./types": {
|
|
28
|
+
"types": "./dist/types/src/types.d.ts",
|
|
32
29
|
"browser": "./dist/lib/browser/types.mjs",
|
|
33
|
-
"node":
|
|
34
|
-
"default": "./dist/lib/node/types.cjs"
|
|
35
|
-
},
|
|
36
|
-
"types": "./dist/types/src/types.d.ts"
|
|
30
|
+
"node": "./dist/lib/node-esm/types.mjs"
|
|
37
31
|
}
|
|
38
32
|
},
|
|
39
33
|
"types": "dist/types/src/index.d.ts",
|
|
@@ -42,9 +36,6 @@
|
|
|
42
36
|
"meta": [
|
|
43
37
|
"dist/types/src/meta.d.ts"
|
|
44
38
|
],
|
|
45
|
-
"testing": [
|
|
46
|
-
"dist/types/src/testing.d.ts"
|
|
47
|
-
],
|
|
48
39
|
"types": [
|
|
49
40
|
"dist/types/src/types.d.ts"
|
|
50
41
|
]
|
|
@@ -55,50 +46,58 @@
|
|
|
55
46
|
"src"
|
|
56
47
|
],
|
|
57
48
|
"dependencies": {
|
|
58
|
-
"@codemirror/autocomplete": "^6.18.
|
|
59
|
-
"@codemirror/language": "^6.10.
|
|
49
|
+
"@codemirror/autocomplete": "^6.18.1",
|
|
50
|
+
"@codemirror/language": "^6.10.3",
|
|
60
51
|
"@codemirror/state": "^6.4.1",
|
|
61
|
-
"@codemirror/view": "^6.
|
|
52
|
+
"@codemirror/view": "^6.34.1",
|
|
62
53
|
"@dnd-kit/core": "^6.0.5",
|
|
63
54
|
"@dnd-kit/modifiers": "^6.0.0",
|
|
64
55
|
"@dnd-kit/sortable": "^7.0.1",
|
|
65
56
|
"@dnd-kit/utilities": "^3.2.0",
|
|
66
|
-
"@
|
|
67
|
-
"@lezer/
|
|
57
|
+
"@effect/schema": "^0.75.1",
|
|
58
|
+
"@lezer/common": "^1.2.2",
|
|
59
|
+
"@lezer/highlight": "^1.2.1",
|
|
68
60
|
"@lezer/lezer": "^1.1.2",
|
|
69
61
|
"@lezer/lr": "^1.4.2",
|
|
70
62
|
"@preact/signals-core": "^1.6.0",
|
|
71
63
|
"@radix-ui/react-context": "^1.0.0",
|
|
72
64
|
"@tanstack/react-virtual": "^3.9.0",
|
|
73
65
|
"codemirror-lang-spreadsheet": "^1.3.0",
|
|
66
|
+
"date-fns": "^3.3.1",
|
|
74
67
|
"hyperformula": "^2.7.1",
|
|
75
68
|
"lodash.defaultsdeep": "^4.6.1",
|
|
76
69
|
"re-resizable": "^6.9.17",
|
|
77
70
|
"react-markdown": "^8.0.5",
|
|
78
71
|
"react-resize-detector": "^11.0.1",
|
|
79
|
-
"@dxos/app-framework": "0.6.
|
|
80
|
-
"@dxos/async": "0.6.
|
|
81
|
-
"@dxos/client": "0.6.
|
|
82
|
-
"@dxos/context": "0.6.
|
|
83
|
-
"@dxos/crypto": "0.6.
|
|
84
|
-
"@dxos/debug": "0.6.
|
|
85
|
-
"@dxos/echo-schema": "0.6.
|
|
86
|
-
"@dxos/invariant": "0.6.
|
|
87
|
-
"@dxos/keys": "0.6.
|
|
88
|
-
"@dxos/log": "0.6.
|
|
89
|
-
"@dxos/plugin-
|
|
90
|
-
"@dxos/plugin-
|
|
91
|
-
"@dxos/plugin-
|
|
92
|
-
"@dxos/plugin-
|
|
93
|
-
"@dxos/plugin-
|
|
94
|
-
"@dxos/
|
|
95
|
-
"@dxos/react-
|
|
96
|
-
"@dxos/
|
|
97
|
-
"@dxos/
|
|
72
|
+
"@dxos/app-framework": "0.6.14-main.1366248",
|
|
73
|
+
"@dxos/async": "0.6.14-main.1366248",
|
|
74
|
+
"@dxos/client": "0.6.14-main.1366248",
|
|
75
|
+
"@dxos/context": "0.6.14-main.1366248",
|
|
76
|
+
"@dxos/crypto": "0.6.14-main.1366248",
|
|
77
|
+
"@dxos/debug": "0.6.14-main.1366248",
|
|
78
|
+
"@dxos/echo-schema": "0.6.14-main.1366248",
|
|
79
|
+
"@dxos/invariant": "0.6.14-main.1366248",
|
|
80
|
+
"@dxos/keys": "0.6.14-main.1366248",
|
|
81
|
+
"@dxos/log": "0.6.14-main.1366248",
|
|
82
|
+
"@dxos/plugin-attention": "0.6.14-main.1366248",
|
|
83
|
+
"@dxos/plugin-client": "0.6.14-main.1366248",
|
|
84
|
+
"@dxos/plugin-graph": "0.6.14-main.1366248",
|
|
85
|
+
"@dxos/plugin-markdown": "0.6.14-main.1366248",
|
|
86
|
+
"@dxos/plugin-script": "0.6.14-main.1366248",
|
|
87
|
+
"@dxos/plugin-space": "0.6.14-main.1366248",
|
|
88
|
+
"@dxos/react-client": "0.6.14-main.1366248",
|
|
89
|
+
"@dxos/plugin-stack": "0.6.14-main.1366248",
|
|
90
|
+
"@dxos/react-hooks": "0.6.14-main.1366248",
|
|
91
|
+
"@dxos/react-ui-attention": "0.6.14-main.1366248",
|
|
92
|
+
"@dxos/react-ui-data": "0.6.14-main.1366248",
|
|
93
|
+
"@dxos/react-ui-editor": "0.6.14-main.1366248",
|
|
94
|
+
"@dxos/react-ui-grid": "0.6.14-main.1366248",
|
|
95
|
+
"@dxos/react-ui-list": "0.6.14-main.1366248",
|
|
96
|
+
"@dxos/schema": "0.6.14-main.1366248",
|
|
97
|
+
"@dxos/util": "0.6.14-main.1366248"
|
|
98
98
|
},
|
|
99
99
|
"devDependencies": {
|
|
100
100
|
"@lezer/generator": "^1.7.1",
|
|
101
|
-
"@phosphor-icons/react": "^2.1.5",
|
|
102
101
|
"@tldraw/indices": "^2.0.0-alpha.14",
|
|
103
102
|
"@types/lodash.defaultsdeep": "^4.6.6",
|
|
104
103
|
"@types/react": "~18.2.0",
|
|
@@ -106,20 +105,20 @@
|
|
|
106
105
|
"@types/react-window": "^1.8.8",
|
|
107
106
|
"react": "~18.2.0",
|
|
108
107
|
"react-dom": "~18.2.0",
|
|
109
|
-
"vite": "
|
|
110
|
-
"@dxos/echo-generator": "0.6.
|
|
111
|
-
"@dxos/random": "0.6.
|
|
112
|
-
"@dxos/react-ui": "0.6.
|
|
113
|
-
"@dxos/react-ui
|
|
114
|
-
"@dxos/react-ui-
|
|
115
|
-
"@dxos/storybook-utils": "0.6.
|
|
108
|
+
"vite": "5.4.7",
|
|
109
|
+
"@dxos/echo-generator": "0.6.14-main.1366248",
|
|
110
|
+
"@dxos/random": "0.6.14-main.1366248",
|
|
111
|
+
"@dxos/react-ui-theme": "0.6.14-main.1366248",
|
|
112
|
+
"@dxos/react-ui": "0.6.14-main.1366248",
|
|
113
|
+
"@dxos/react-ui-syntax-highlighter": "0.6.14-main.1366248",
|
|
114
|
+
"@dxos/storybook-utils": "0.6.14-main.1366248",
|
|
115
|
+
"@dxos/react-ui-types": "0.6.14-main.1366248"
|
|
116
116
|
},
|
|
117
|
-
"
|
|
118
|
-
"
|
|
119
|
-
"react": "
|
|
120
|
-
"react-
|
|
121
|
-
"@dxos/react-ui-theme": "0.6.
|
|
122
|
-
"@dxos/react-ui": "0.6.13"
|
|
117
|
+
"peerDependencies": {
|
|
118
|
+
"react": "~18.2.0",
|
|
119
|
+
"react-dom": "~18.2.0",
|
|
120
|
+
"@dxos/react-ui": "0.6.14-main.1366248",
|
|
121
|
+
"@dxos/react-ui-theme": "0.6.14-main.1366248"
|
|
123
122
|
},
|
|
124
123
|
"publishConfig": {
|
|
125
124
|
"access": "public"
|
package/src/SheetPlugin.tsx
CHANGED
|
@@ -2,84 +2,72 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type IconProps, GridNine } from '@phosphor-icons/react';
|
|
6
5
|
import React from 'react';
|
|
7
6
|
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
parseIntentPlugin,
|
|
11
|
-
resolvePlugin,
|
|
12
|
-
type PluginDefinition,
|
|
13
|
-
type LayoutCoordinate,
|
|
14
|
-
} from '@dxos/app-framework';
|
|
15
|
-
import { create } from '@dxos/echo-schema';
|
|
7
|
+
import { NavigationAction, parseIntentPlugin, resolvePlugin, type PluginDefinition } from '@dxos/app-framework';
|
|
8
|
+
import { invariant } from '@dxos/invariant';
|
|
16
9
|
import { parseClientPlugin } from '@dxos/plugin-client';
|
|
17
|
-
import {
|
|
10
|
+
import { createExtension, isActionGroup, type ActionGroup } from '@dxos/plugin-graph';
|
|
18
11
|
import { FunctionType } from '@dxos/plugin-script/types';
|
|
19
12
|
import { SpaceAction } from '@dxos/plugin-space';
|
|
20
13
|
import { getSpace, isEchoObject } from '@dxos/react-client/echo';
|
|
14
|
+
import { Icon } from '@dxos/react-ui';
|
|
21
15
|
|
|
22
|
-
import {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
SheetContainer,
|
|
27
|
-
type ComputeGraph,
|
|
28
|
-
} from './components';
|
|
29
|
-
// TODO(wittjosiah): Refactor. These are not exported from ./components due to depending on ECHO.
|
|
30
|
-
import { EdgeFunctionPlugin, EdgeFunctionPluginTranslations } from './components/ComputeGraph/edge-function';
|
|
31
|
-
import { ComputeGraphContextProvider } from './components/ComputeGraph/graph-context';
|
|
16
|
+
import { ComputeGraphContextProvider, RangeList, SheetContainer } from './components';
|
|
17
|
+
import { type ComputeGraphRegistry } from './compute-graph';
|
|
18
|
+
import { compareIndexPositions, createSheet } from './defs';
|
|
19
|
+
import { computeGraphFacet } from './extensions';
|
|
32
20
|
import meta, { SHEET_PLUGIN } from './meta';
|
|
33
|
-
import {
|
|
21
|
+
import { serializer } from './serializer';
|
|
34
22
|
import translations from './translations';
|
|
35
|
-
import {
|
|
23
|
+
import { SheetAction, SheetType, type SheetPluginProvides } from './types';
|
|
36
24
|
|
|
37
25
|
export const SheetPlugin = (): PluginDefinition<SheetPluginProvides> => {
|
|
38
|
-
let
|
|
39
|
-
|
|
40
|
-
const graphs = create<Record<string, ComputeGraph>>({});
|
|
41
|
-
const setGraph = (key: string, graph: ComputeGraph) => {
|
|
42
|
-
graphs[key] = graph;
|
|
43
|
-
};
|
|
26
|
+
let computeGraphRegistry: ComputeGraphRegistry | undefined;
|
|
44
27
|
|
|
45
28
|
return {
|
|
46
29
|
meta,
|
|
47
30
|
ready: async (plugins) => {
|
|
48
31
|
const client = resolvePlugin(plugins, parseClientPlugin)?.provides.client;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
32
|
+
invariant(client);
|
|
33
|
+
let remoteFunctionUrl: string | undefined;
|
|
53
34
|
if (client.config.values.runtime?.services?.edge?.url) {
|
|
54
35
|
const url = new URL('/functions', client.config.values.runtime?.services?.edge?.url);
|
|
55
36
|
url.protocol = 'https';
|
|
56
37
|
remoteFunctionUrl = url.toString();
|
|
57
38
|
}
|
|
39
|
+
|
|
40
|
+
// Async import removes direct dependency on hyperformula.
|
|
41
|
+
const { defaultPlugins, ComputeGraphRegistry } = await import('./compute-graph');
|
|
42
|
+
computeGraphRegistry = new ComputeGraphRegistry({ plugins: defaultPlugins, remoteFunctionUrl });
|
|
58
43
|
},
|
|
59
44
|
provides: {
|
|
60
45
|
context: ({ children }) => {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
{children}
|
|
64
|
-
</ComputeGraphContextProvider>
|
|
65
|
-
);
|
|
46
|
+
invariant(computeGraphRegistry);
|
|
47
|
+
return <ComputeGraphContextProvider registry={computeGraphRegistry}>{children}</ComputeGraphContextProvider>;
|
|
66
48
|
},
|
|
67
49
|
metadata: {
|
|
68
50
|
records: {
|
|
69
51
|
[SheetType.typename]: {
|
|
70
|
-
label: (object: any) => (object instanceof SheetType ? object.
|
|
52
|
+
label: (object: any) => (object instanceof SheetType ? object.name : undefined),
|
|
71
53
|
placeholder: ['sheet title placeholder', { ns: SHEET_PLUGIN }],
|
|
72
|
-
icon:
|
|
73
|
-
|
|
54
|
+
icon: 'ph--grid-nine--regular',
|
|
55
|
+
serializer,
|
|
74
56
|
},
|
|
75
57
|
},
|
|
76
58
|
},
|
|
77
59
|
translations,
|
|
78
60
|
echo: {
|
|
79
61
|
// TODO(wittjosiah): Factor out to common package/plugin.
|
|
80
|
-
//
|
|
62
|
+
// FunctionType is currently registered here in case script plugin isn't enabled.
|
|
81
63
|
schema: [SheetType, FunctionType],
|
|
82
64
|
},
|
|
65
|
+
space: {
|
|
66
|
+
onSpaceCreate: {
|
|
67
|
+
label: ['create sheet label', { ns: SHEET_PLUGIN }],
|
|
68
|
+
action: SheetAction.CREATE,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
83
71
|
graph: {
|
|
84
72
|
builder: (plugins) => {
|
|
85
73
|
const client = resolvePlugin(plugins, parseClientPlugin)?.provides.client;
|
|
@@ -113,8 +101,7 @@ export const SheetPlugin = (): PluginDefinition<SheetPluginProvides> => {
|
|
|
113
101
|
},
|
|
114
102
|
properties: {
|
|
115
103
|
label: ['create sheet label', { ns: SHEET_PLUGIN }],
|
|
116
|
-
icon:
|
|
117
|
-
iconSymbol: 'ph--grid-nine--regular',
|
|
104
|
+
icon: 'ph--grid-nine--regular',
|
|
118
105
|
testId: 'sheetPlugin.createObject',
|
|
119
106
|
},
|
|
120
107
|
},
|
|
@@ -123,6 +110,16 @@ export const SheetPlugin = (): PluginDefinition<SheetPluginProvides> => {
|
|
|
123
110
|
});
|
|
124
111
|
},
|
|
125
112
|
},
|
|
113
|
+
markdown: {
|
|
114
|
+
extensions: ({ document: doc }) => {
|
|
115
|
+
invariant(computeGraphRegistry);
|
|
116
|
+
const space = getSpace(doc);
|
|
117
|
+
if (space) {
|
|
118
|
+
const computeGraph = computeGraphRegistry.getOrCreateGraph(space);
|
|
119
|
+
return computeGraphFacet.of(computeGraph);
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
},
|
|
126
123
|
stack: {
|
|
127
124
|
creators: [
|
|
128
125
|
{
|
|
@@ -130,7 +127,8 @@ export const SheetPlugin = (): PluginDefinition<SheetPluginProvides> => {
|
|
|
130
127
|
testId: 'sheetPlugin.createSection',
|
|
131
128
|
type: ['plugin name', { ns: SHEET_PLUGIN }],
|
|
132
129
|
label: ['create sheet section label', { ns: SHEET_PLUGIN }],
|
|
133
|
-
|
|
130
|
+
// TODO(thure): Refactor to use strings
|
|
131
|
+
icon: (props: any) => <Icon icon='ph--grid-nine--regular' {...props} />,
|
|
134
132
|
intent: {
|
|
135
133
|
plugin: SHEET_PLUGIN,
|
|
136
134
|
action: SheetAction.CREATE,
|
|
@@ -138,25 +136,34 @@ export const SheetPlugin = (): PluginDefinition<SheetPluginProvides> => {
|
|
|
138
136
|
},
|
|
139
137
|
],
|
|
140
138
|
},
|
|
139
|
+
thread: {
|
|
140
|
+
predicate: (data) => data instanceof SheetType,
|
|
141
|
+
createSort: (sheet) => (indexA, indexB) =>
|
|
142
|
+
!indexA || !indexB ? 0 : compareIndexPositions(sheet, indexA, indexB),
|
|
143
|
+
},
|
|
141
144
|
surface: {
|
|
142
|
-
component: ({ data, role
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
role={role}
|
|
154
|
-
coordinate={data.coordinate as LayoutCoordinate}
|
|
155
|
-
remoteFunctionUrl={remoteFunctionUrl}
|
|
156
|
-
/>
|
|
157
|
-
);
|
|
145
|
+
component: ({ data, role }) => {
|
|
146
|
+
const space = isEchoObject(data.object) ? getSpace(data.object) : undefined;
|
|
147
|
+
if (!space) {
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
switch (role) {
|
|
152
|
+
case 'article':
|
|
153
|
+
case 'section':
|
|
154
|
+
if (data.object instanceof SheetType) {
|
|
155
|
+
return <SheetContainer space={space} sheet={data.object} role={role} />;
|
|
158
156
|
}
|
|
159
|
-
|
|
157
|
+
|
|
158
|
+
return null;
|
|
159
|
+
case 'complementary--settings':
|
|
160
|
+
if (data.subject instanceof SheetType) {
|
|
161
|
+
return {
|
|
162
|
+
node: <RangeList sheet={data.subject} />,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return null;
|
|
160
167
|
}
|
|
161
168
|
|
|
162
169
|
return null;
|
|
@@ -166,23 +173,27 @@ export const SheetPlugin = (): PluginDefinition<SheetPluginProvides> => {
|
|
|
166
173
|
resolver: async (intent) => {
|
|
167
174
|
switch (intent.action) {
|
|
168
175
|
case SheetAction.CREATE: {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
176
|
+
return { data: createSheet() };
|
|
177
|
+
}
|
|
178
|
+
case SheetAction.INSERT_AXIS: {
|
|
179
|
+
const { model, axis, index, count } = intent.data as SheetAction.InsertAxis;
|
|
180
|
+
const _indices = model[axis === 'col' ? 'insertColumns' : 'insertRows'](index, count);
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
case SheetAction.DROP_AXIS: {
|
|
184
|
+
if (!intent.undo) {
|
|
185
|
+
const { model, axis, axisIndex } = intent.data as SheetAction.DropAxis;
|
|
186
|
+
const undoData = model[axis === 'col' ? 'dropColumn' : 'dropRow'](axisIndex);
|
|
187
|
+
return {
|
|
188
|
+
undoable: {
|
|
189
|
+
message: translations[0]['en-US'][SHEET_PLUGIN][`${axis} dropped label`],
|
|
190
|
+
data: { ...undoData, model },
|
|
191
|
+
},
|
|
192
|
+
};
|
|
193
|
+
} else {
|
|
194
|
+
const { model, ...undoData } = intent.data as SheetAction.DropAxisRestore;
|
|
195
|
+
model[undoData.axis === 'col' ? 'restoreColumn' : 'restoreRow'](undoData);
|
|
196
|
+
}
|
|
186
197
|
}
|
|
187
198
|
}
|
|
188
199
|
},
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { createContext, type PropsWithChildren, useContext } from 'react';
|
|
6
|
+
|
|
7
|
+
import { raise } from '@dxos/debug';
|
|
8
|
+
import { type Space } from '@dxos/react-client/echo';
|
|
9
|
+
import { useAsyncState } from '@dxos/react-hooks';
|
|
10
|
+
|
|
11
|
+
import { type ComputeGraph, type ComputeGraphRegistry } from '../../compute-graph';
|
|
12
|
+
|
|
13
|
+
export type ComputeGraphContextType = {
|
|
14
|
+
registry: ComputeGraphRegistry;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The compute graph context manages a ComputeGraph for each space.
|
|
19
|
+
*/
|
|
20
|
+
export const ComputeGraphContext = createContext<ComputeGraphContextType | undefined>(undefined);
|
|
21
|
+
|
|
22
|
+
export const ComputeGraphContextProvider = ({ registry, children }: PropsWithChildren<ComputeGraphContextType>) => {
|
|
23
|
+
return <ComputeGraphContext.Provider value={{ registry }}>{children}</ComputeGraphContext.Provider>;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const useComputeGraph = (space?: Space): ComputeGraph | undefined => {
|
|
27
|
+
const { registry } = useContext(ComputeGraphContext) ?? raise(new Error('Missing ComputeGraphContext'));
|
|
28
|
+
const [graph] = useAsyncState(async () => {
|
|
29
|
+
if (space) {
|
|
30
|
+
const graph = registry.getOrCreateGraph(space);
|
|
31
|
+
await graph.open();
|
|
32
|
+
return graph;
|
|
33
|
+
}
|
|
34
|
+
}, [space, registry]);
|
|
35
|
+
|
|
36
|
+
return graph;
|
|
37
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { Icon } from '@dxos/react-ui';
|
|
8
|
+
import { mx } from '@dxos/react-ui-theme';
|
|
9
|
+
|
|
10
|
+
import { addressToA1Notation, isFormula, rangeToA1Notation } from '../../defs';
|
|
11
|
+
import { useSheetContext } from '../SheetContext';
|
|
12
|
+
|
|
13
|
+
export const FunctionEditor = () => {
|
|
14
|
+
const { model, cursor, range } = useSheetContext();
|
|
15
|
+
|
|
16
|
+
let value;
|
|
17
|
+
let formula = false;
|
|
18
|
+
if (cursor) {
|
|
19
|
+
value = model.getCellValue(cursor);
|
|
20
|
+
if (isFormula(value)) {
|
|
21
|
+
value = model.graph.mapFunctionBindingFromId(model.mapFormulaIndicesToRefs(value));
|
|
22
|
+
formula = true;
|
|
23
|
+
} else if (value != null) {
|
|
24
|
+
value = String(value);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<div
|
|
30
|
+
className={mx(
|
|
31
|
+
'flex shrink-0 justify-between items-center px-4 py-1 text-sm border-bs !border-separator attention-surface',
|
|
32
|
+
)}
|
|
33
|
+
>
|
|
34
|
+
<div className='flex gap-4 items-center'>
|
|
35
|
+
<div className='flex w-16 items-center font-mono'>
|
|
36
|
+
{(range && rangeToA1Notation(range)) || (cursor && addressToA1Notation(cursor))}
|
|
37
|
+
</div>
|
|
38
|
+
<div className='flex gap-2 items-center'>
|
|
39
|
+
<Icon icon='ph--function--regular' classNames={['text-greenText', formula ? 'visible' : 'invisible']} />
|
|
40
|
+
<span className='font-mono'>{value}</span>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta } from '@storybook/react';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import { useSpace } from '@dxos/react-client/echo';
|
|
9
|
+
import { withClientProvider } from '@dxos/react-client/testing';
|
|
10
|
+
import { withTheme, withLayout } from '@dxos/storybook-utils';
|
|
11
|
+
|
|
12
|
+
import { GridSheet } from './GridSheet';
|
|
13
|
+
import { createTestCells, useTestSheet, withComputeGraphDecorator } from '../../testing';
|
|
14
|
+
import translations from '../../translations';
|
|
15
|
+
import { SheetType } from '../../types';
|
|
16
|
+
import { useComputeGraph } from '../ComputeGraph';
|
|
17
|
+
import { SheetProvider } from '../SheetContext';
|
|
18
|
+
|
|
19
|
+
export const Basic = () => {
|
|
20
|
+
const space = useSpace();
|
|
21
|
+
const graph = useComputeGraph(space);
|
|
22
|
+
const sheet = useTestSheet(space, graph, { cells: createTestCells() });
|
|
23
|
+
if (!sheet || !graph) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<SheetProvider graph={graph} sheet={sheet}>
|
|
29
|
+
<GridSheet />
|
|
30
|
+
</SheetProvider>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const meta: Meta = {
|
|
35
|
+
title: 'plugins/plugin-sheet/GridSheet',
|
|
36
|
+
component: GridSheet,
|
|
37
|
+
decorators: [
|
|
38
|
+
withClientProvider({ types: [SheetType], createSpace: true }),
|
|
39
|
+
withComputeGraphDecorator(),
|
|
40
|
+
withTheme,
|
|
41
|
+
withLayout({ fullscreen: true, tooltips: true }),
|
|
42
|
+
],
|
|
43
|
+
parameters: { translations },
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default meta;
|