@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
|
@@ -0,0 +1,45 @@
|
|
|
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 { SheetContainer } from './SheetContainer';
|
|
13
|
+
import { createTestCells, useTestSheet, withComputeGraphDecorator } from '../../testing';
|
|
14
|
+
import translations from '../../translations';
|
|
15
|
+
import { SheetType } from '../../types';
|
|
16
|
+
import { useComputeGraph } from '../ComputeGraph';
|
|
17
|
+
|
|
18
|
+
export const Basic = () => {
|
|
19
|
+
const space = useSpace();
|
|
20
|
+
const graph = useComputeGraph(space);
|
|
21
|
+
const sheet = useTestSheet(space, graph, { cells: createTestCells() });
|
|
22
|
+
if (!sheet || !space) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return <SheetContainer space={space} sheet={sheet} role='article' />;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const meta: Meta = {
|
|
30
|
+
title: 'plugins/plugin-sheet/SheetContainer',
|
|
31
|
+
component: SheetContainer,
|
|
32
|
+
decorators: [
|
|
33
|
+
withClientProvider({ types: [SheetType], createSpace: true }),
|
|
34
|
+
withComputeGraphDecorator(),
|
|
35
|
+
withTheme,
|
|
36
|
+
withLayout({
|
|
37
|
+
fullscreen: true,
|
|
38
|
+
tooltips: true,
|
|
39
|
+
classNames: 'grid grid-cols-1 grid-rows-[min-content_minmax(0,1fr)_min-content]',
|
|
40
|
+
}),
|
|
41
|
+
],
|
|
42
|
+
parameters: { translations },
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export default meta;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { type Space } from '@dxos/react-client/echo';
|
|
8
|
+
|
|
9
|
+
import { type SheetType } from '../../types';
|
|
10
|
+
import { useComputeGraph } from '../ComputeGraph';
|
|
11
|
+
import { FunctionEditor } from '../FunctionEditor';
|
|
12
|
+
import { GridSheet } from '../GridSheet';
|
|
13
|
+
import { SheetProvider } from '../SheetContext';
|
|
14
|
+
import { Toolbar } from '../Toolbar';
|
|
15
|
+
|
|
16
|
+
export const SheetContainer = ({ space, sheet, role }: { space: Space; sheet: SheetType; role?: string }) => {
|
|
17
|
+
const graph = useComputeGraph(space);
|
|
18
|
+
|
|
19
|
+
return graph ? (
|
|
20
|
+
<SheetProvider sheet={sheet} graph={graph}>
|
|
21
|
+
<Toolbar.Root role={role}>
|
|
22
|
+
<Toolbar.Styles />
|
|
23
|
+
<Toolbar.Alignment />
|
|
24
|
+
<Toolbar.Separator />
|
|
25
|
+
<Toolbar.Actions />
|
|
26
|
+
</Toolbar.Root>
|
|
27
|
+
<div role='none' className='border-bs border-separator grid cols-1 rows-[1fr_min-content] min-bs-0'>
|
|
28
|
+
<GridSheet />
|
|
29
|
+
<FunctionEditor />
|
|
30
|
+
</div>
|
|
31
|
+
</SheetProvider>
|
|
32
|
+
) : null;
|
|
33
|
+
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { type PropsWithChildren, createContext, useCallback, useContext, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { invariant } from '@dxos/invariant';
|
|
8
|
+
import { fullyQualifiedId } from '@dxos/react-client/echo';
|
|
9
|
+
import {
|
|
10
|
+
Grid,
|
|
11
|
+
type GridContentProps,
|
|
12
|
+
type GridEditing,
|
|
13
|
+
type GridScopedProps,
|
|
14
|
+
useGridContext,
|
|
15
|
+
} from '@dxos/react-ui-grid';
|
|
16
|
+
|
|
17
|
+
import { type ComputeGraph } from '../../compute-graph';
|
|
18
|
+
import { type CellAddress, type CellRange, type CompleteCellRange } from '../../defs';
|
|
19
|
+
import { type SheetModel, useSheetModel } from '../../model';
|
|
20
|
+
import { type SheetType } from '../../types';
|
|
21
|
+
|
|
22
|
+
export type SheetContextValue = {
|
|
23
|
+
id: string;
|
|
24
|
+
|
|
25
|
+
model: SheetModel;
|
|
26
|
+
|
|
27
|
+
// Cursor state.
|
|
28
|
+
// TODO(burdon): Cursor and range should use indices.
|
|
29
|
+
cursor?: CellAddress;
|
|
30
|
+
setCursor: (cell: CellAddress | undefined) => void;
|
|
31
|
+
range?: CellRange;
|
|
32
|
+
setRange: (range: CellRange | undefined) => void;
|
|
33
|
+
cursorFallbackRange?: CompleteCellRange;
|
|
34
|
+
|
|
35
|
+
// Editing state (undefined if not editing).
|
|
36
|
+
editing: GridEditing;
|
|
37
|
+
setEditing: (editing: GridEditing) => void;
|
|
38
|
+
|
|
39
|
+
// Active refs
|
|
40
|
+
activeRefs: GridContentProps['activeRefs'];
|
|
41
|
+
setActiveRefs: (activeRefs: GridContentProps['activeRefs']) => void;
|
|
42
|
+
|
|
43
|
+
// Events.
|
|
44
|
+
// TODO(burdon): Generalize.
|
|
45
|
+
onInfo?: () => void;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const SheetContext = createContext<SheetContextValue | undefined>(undefined);
|
|
49
|
+
|
|
50
|
+
export const useSheetContext = (): SheetContextValue => {
|
|
51
|
+
const context = useContext(SheetContext);
|
|
52
|
+
invariant(context);
|
|
53
|
+
return context;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const SheetProviderImpl = ({
|
|
57
|
+
model,
|
|
58
|
+
onInfo,
|
|
59
|
+
children,
|
|
60
|
+
__gridScope,
|
|
61
|
+
}: GridScopedProps<PropsWithChildren<Pick<SheetContextValue, 'onInfo' | 'model'>>>) => {
|
|
62
|
+
const { id, editing, setEditing } = useGridContext('SheetProvider', __gridScope);
|
|
63
|
+
|
|
64
|
+
const [cursor, setCursorInternal] = useState<CellAddress>();
|
|
65
|
+
const [range, setRangeInternal] = useState<CellRange>();
|
|
66
|
+
const [cursorFallbackRange, setCursorFallbackRange] = useState<CompleteCellRange>();
|
|
67
|
+
const [activeRefs, setActiveRefs] = useState<GridContentProps['activeRefs']>('');
|
|
68
|
+
|
|
69
|
+
const setCursor = useCallback(
|
|
70
|
+
(nextCursor?: CellAddress) => {
|
|
71
|
+
setCursorInternal(nextCursor);
|
|
72
|
+
setCursorFallbackRange(
|
|
73
|
+
range?.to ? (range as CompleteCellRange) : nextCursor ? { from: nextCursor!, to: nextCursor! } : undefined,
|
|
74
|
+
);
|
|
75
|
+
},
|
|
76
|
+
[range],
|
|
77
|
+
);
|
|
78
|
+
const setRange = useCallback(
|
|
79
|
+
(nextRange?: CellRange) => {
|
|
80
|
+
setRangeInternal(nextRange);
|
|
81
|
+
setCursorFallbackRange(
|
|
82
|
+
nextRange?.to ? (nextRange as CompleteCellRange) : cursor ? { from: cursor!, to: cursor! } : undefined,
|
|
83
|
+
);
|
|
84
|
+
},
|
|
85
|
+
[cursor],
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<SheetContext.Provider
|
|
90
|
+
value={{
|
|
91
|
+
id,
|
|
92
|
+
model,
|
|
93
|
+
editing,
|
|
94
|
+
setEditing,
|
|
95
|
+
cursor,
|
|
96
|
+
setCursor,
|
|
97
|
+
range,
|
|
98
|
+
setRange,
|
|
99
|
+
cursorFallbackRange,
|
|
100
|
+
activeRefs,
|
|
101
|
+
setActiveRefs,
|
|
102
|
+
// TODO(burdon): Change to event.
|
|
103
|
+
onInfo,
|
|
104
|
+
}}
|
|
105
|
+
>
|
|
106
|
+
{children}
|
|
107
|
+
</SheetContext.Provider>
|
|
108
|
+
);
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export type SheetProviderProps = {
|
|
112
|
+
graph: ComputeGraph;
|
|
113
|
+
sheet: SheetType;
|
|
114
|
+
readonly?: boolean;
|
|
115
|
+
} & Pick<SheetContextValue, 'onInfo'>;
|
|
116
|
+
|
|
117
|
+
export const SheetProvider = ({ children, graph, sheet, readonly, onInfo }: PropsWithChildren<SheetProviderProps>) => {
|
|
118
|
+
const model = useSheetModel(graph, sheet, { readonly });
|
|
119
|
+
|
|
120
|
+
return !model ? null : (
|
|
121
|
+
<Grid.Root id={fullyQualifiedId(sheet)}>
|
|
122
|
+
<SheetProviderImpl model={model} onInfo={onInfo}>
|
|
123
|
+
{children}
|
|
124
|
+
</SheetProviderImpl>
|
|
125
|
+
</Grid.Root>
|
|
126
|
+
);
|
|
127
|
+
};
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
+
import { type Meta } from '@storybook/react';
|
|
7
8
|
import React from 'react';
|
|
8
9
|
|
|
9
10
|
import { textBlockWidth } from '@dxos/react-ui-theme';
|
|
@@ -12,7 +13,7 @@ import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
|
12
13
|
import { Toolbar } from './Toolbar';
|
|
13
14
|
import translations from '../../translations';
|
|
14
15
|
|
|
15
|
-
const
|
|
16
|
+
const DefaultStory = () => {
|
|
16
17
|
return (
|
|
17
18
|
<Toolbar.Root classNames={textBlockWidth}>
|
|
18
19
|
<Toolbar.Alignment />
|
|
@@ -20,12 +21,14 @@ const Story = () => {
|
|
|
20
21
|
);
|
|
21
22
|
};
|
|
22
23
|
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
export const Default = {};
|
|
25
|
+
|
|
26
|
+
const meta: Meta<typeof Toolbar.Root> = {
|
|
27
|
+
title: 'plugins/plugin-sheet/Toolbar',
|
|
28
|
+
component: Toolbar.Root,
|
|
29
|
+
render: DefaultStory,
|
|
26
30
|
decorators: [withTheme, withLayout({ tooltips: true })],
|
|
27
31
|
parameters: { translations, layout: 'fullscreen' },
|
|
28
|
-
render: (args: any) => <Story {...args} />,
|
|
29
32
|
};
|
|
30
33
|
|
|
31
|
-
export
|
|
34
|
+
export default meta;
|