@dxos/plugin-sheet 0.8.4-main.937b3ca → 0.8.4-main.abd8ff62ef
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/SheetPlugin-W4PFP6WG.mjs +92 -0
- package/dist/lib/browser/SheetPlugin-W4PFP6WG.mjs.map +7 -0
- package/dist/lib/browser/chunk-5TXOUIGZ.mjs +118 -0
- package/dist/lib/browser/chunk-5TXOUIGZ.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/browser/{chunk-2SAGT3BB.mjs → chunk-SVGX3MWY.mjs} +34 -169
- package/dist/lib/browser/chunk-SVGX3MWY.mjs.map +7 -0
- package/dist/lib/browser/drop-axis-ZLERPPPH.mjs +23 -0
- package/dist/lib/browser/drop-axis-ZLERPPPH.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +24 -135
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/insert-axis-WTRA3HE7.mjs +16 -0
- package/dist/lib/browser/insert-axis-WTRA3HE7.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operations/index.mjs +13 -0
- package/dist/lib/browser/operations/index.mjs.map +7 -0
- package/dist/lib/browser/restore-axis-PYGPW2TB.mjs +16 -0
- package/dist/lib/browser/restore-axis-PYGPW2TB.mjs.map +7 -0
- package/dist/lib/browser/scroll-to-anchor-6I4DNKBW.mjs +65 -0
- package/dist/lib/browser/scroll-to-anchor-6I4DNKBW.mjs.map +7 -0
- package/dist/lib/browser/translations.mjs +55 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +2 -3
- package/dist/lib/node-esm/SheetPlugin-ZJRSEYHB.mjs +93 -0
- package/dist/lib/node-esm/SheetPlugin-ZJRSEYHB.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-IMWGSIDG.mjs → chunk-4A2KAXTF.mjs} +34 -169
- package/dist/lib/node-esm/chunk-4A2KAXTF.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-MCZFRYOP.mjs +119 -0
- package/dist/lib/node-esm/chunk-MCZFRYOP.mjs.map +7 -0
- package/dist/lib/node-esm/drop-axis-FV2GXSZP.mjs +24 -0
- package/dist/lib/node-esm/drop-axis-FV2GXSZP.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +24 -135
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/insert-axis-THXK6DCC.mjs +17 -0
- package/dist/lib/node-esm/insert-axis-THXK6DCC.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operations/index.mjs +14 -0
- package/dist/lib/node-esm/operations/index.mjs.map +7 -0
- package/dist/lib/node-esm/restore-axis-JIFT3Q7Z.mjs +17 -0
- package/dist/lib/node-esm/restore-axis-JIFT3Q7Z.mjs.map +7 -0
- package/dist/lib/node-esm/scroll-to-anchor-JRDC5KK2.mjs +66 -0
- package/dist/lib/node-esm/scroll-to-anchor-JRDC5KK2.mjs.map +7 -0
- package/dist/lib/node-esm/translations.mjs +56 -0
- package/dist/lib/node-esm/translations.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +2 -3
- package/dist/types/src/SheetPlugin.d.ts +1 -0
- package/dist/types/src/SheetPlugin.d.ts.map +1 -1
- package/dist/types/src/SheetPlugin.node.d.ts +4 -0
- package/dist/types/src/SheetPlugin.node.d.ts.map +1 -0
- package/dist/types/src/SheetPlugin.test.d.ts +2 -0
- package/dist/types/src/SheetPlugin.test.d.ts.map +1 -0
- package/dist/types/src/capabilities/anchor-sort.d.ts +6 -0
- package/dist/types/src/capabilities/anchor-sort.d.ts.map +1 -0
- package/dist/types/src/capabilities/compute-graph-registry.d.ts +5 -0
- package/dist/types/src/capabilities/compute-graph-registry.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +9 -5
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/markdown.d.ts +5 -0
- package/dist/types/src/capabilities/markdown.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/state.d.ts +6 -0
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/undo-mappings.d.ts +5 -0
- package/dist/types/src/capabilities/undo-mappings.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 -1
- package/dist/types/src/components/Sheet/Sheet.d.ts +17 -0
- package/dist/types/src/components/Sheet/Sheet.d.ts.map +1 -0
- package/dist/types/src/components/Sheet/index.d.ts +2 -0
- package/dist/types/src/components/Sheet/index.d.ts.map +1 -0
- package/dist/types/src/components/SheetContent/SheetCellEditor.stories.d.ts.map +1 -0
- package/dist/types/src/components/SheetContent/SheetContent.d.ts +6 -0
- package/dist/types/src/components/SheetContent/SheetContent.d.ts.map +1 -0
- package/dist/types/src/components/SheetContent/SheetContent.stories.d.ts +93 -0
- package/dist/types/src/components/SheetContent/SheetContent.stories.d.ts.map +1 -0
- package/dist/types/src/components/SheetContent/index.d.ts +2 -0
- package/dist/types/src/components/SheetContent/index.d.ts.map +1 -0
- package/dist/types/src/components/{GridSheet → SheetContent}/util.d.ts +1 -1
- package/dist/types/src/components/SheetContent/util.d.ts.map +1 -0
- package/dist/types/src/components/{SheetContext/SheetContext.d.ts → SheetRoot/SheetRoot.d.ts} +8 -6
- package/dist/types/src/components/SheetRoot/SheetRoot.d.ts.map +1 -0
- package/dist/types/src/components/SheetRoot/index.d.ts +2 -0
- package/dist/types/src/components/SheetRoot/index.d.ts.map +1 -0
- package/dist/types/src/components/SheetStatusbar/SheetStatusbar.d.ts +6 -0
- package/dist/types/src/components/SheetStatusbar/SheetStatusbar.d.ts.map +1 -0
- package/dist/types/src/components/SheetStatusbar/index.d.ts +2 -0
- package/dist/types/src/components/SheetStatusbar/index.d.ts.map +1 -0
- package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts +5 -5
- package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts +72 -68
- package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/align.d.ts +2 -2
- package/dist/types/src/components/SheetToolbar/align.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/style.d.ts +2 -2
- package/dist/types/src/components/SheetToolbar/style.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/useToolbarState.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/{components → containers}/RangeList/RangeList.d.ts +1 -1
- package/dist/types/src/containers/RangeList/RangeList.d.ts.map +1 -0
- package/dist/types/src/containers/RangeList/index.d.ts +2 -0
- package/dist/types/src/containers/RangeList/index.d.ts.map +1 -0
- package/dist/types/src/containers/SheetContainer/SheetContainer.d.ts +12 -0
- package/dist/types/src/containers/SheetContainer/SheetContainer.d.ts.map +1 -0
- package/dist/types/src/containers/SheetContainer/SheetContainer.stories.d.ts +92 -0
- package/dist/types/src/containers/SheetContainer/SheetContainer.stories.d.ts.map +1 -0
- package/dist/types/src/containers/SheetContainer/index.d.ts +2 -0
- package/dist/types/src/containers/SheetContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +4 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- 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/compute.stories.d.ts.map +1 -1
- package/dist/types/src/extensions/editor/sheet-extension.d.ts +1 -1
- package/dist/types/src/extensions/editor/sheet-extension.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +3 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/integrations/thread-ranges.d.ts +1 -3
- package/dist/types/src/integrations/thread-ranges.d.ts.map +1 -1
- package/dist/types/src/model/sheet-model.d.ts +2 -2
- 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 +2 -2
- package/dist/types/src/model/useSheetModel.d.ts.map +1 -1
- package/dist/types/src/operations/definitions.d.ts +45 -0
- package/dist/types/src/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/operations/drop-axis.d.ts +5 -0
- package/dist/types/src/operations/drop-axis.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +4 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/insert-axis.d.ts +5 -0
- package/dist/types/src/operations/insert-axis.d.ts.map +1 -0
- package/dist/types/src/operations/restore-axis.d.ts +5 -0
- package/dist/types/src/operations/restore-axis.d.ts.map +1 -0
- package/dist/types/src/operations/scroll-to-anchor.d.ts +5 -0
- package/dist/types/src/operations/scroll-to-anchor.d.ts.map +1 -0
- package/dist/types/src/playwright/playwright.config.d.ts.map +1 -1
- package/dist/types/src/playwright/sheet-manager.d.ts.map +1 -1
- package/dist/types/src/serializer.d.ts +1 -1
- package/dist/types/src/serializer.d.ts.map +1 -1
- package/dist/types/src/testing/data.d.ts +1 -1
- package/dist/types/src/testing/data.d.ts.map +1 -1
- package/dist/types/src/testing/testing.d.ts +13 -13
- package/dist/types/src/testing/testing.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +74 -39
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Sheet.d.ts +21 -21
- package/dist/types/src/types/Sheet.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +13 -1
- package/dist/types/src/types/capabilities.d.ts.map +1 -1
- package/dist/types/src/types/sheet-range-types.d.ts +1 -1
- package/dist/types/src/types/sheet-range-types.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +0 -92
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/types/util.d.ts +3 -2
- package/dist/types/src/types/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +89 -70
- package/src/SheetPlugin.node.ts +36 -0
- package/src/SheetPlugin.test.ts +30 -0
- package/src/SheetPlugin.tsx +51 -31
- package/src/capabilities/{anchor-sort/anchor-sort.ts → anchor-sort.ts} +4 -3
- package/src/capabilities/{compute-graph-registry/compute-graph-registry.ts → compute-graph-registry.ts} +5 -3
- package/src/capabilities/index.ts +13 -5
- package/src/capabilities/{markdown/markdown.ts → markdown.ts} +4 -3
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +49 -0
- package/src/capabilities/state.ts +29 -0
- package/src/capabilities/undo-mappings.ts +30 -0
- package/src/components/ComputeGraph/ComputeGraphContextProvider.tsx +1 -1
- package/src/components/ComputeGraph/compute-graph.stories.tsx +19 -16
- package/src/components/Sheet/Sheet.tsx +20 -0
- package/src/components/Sheet/index.ts +5 -0
- package/src/components/{GridSheet → SheetContent}/SheetCellEditor.stories.tsx +10 -9
- package/src/components/{GridSheet/GridSheet.stories.tsx → SheetContent/SheetContent.stories.tsx} +20 -19
- package/src/components/{GridSheet/GridSheet.tsx → SheetContent/SheetContent.tsx} +56 -33
- package/src/components/{RangeList → SheetContent}/index.ts +1 -1
- package/src/components/{GridSheet → SheetContent}/util.ts +6 -5
- package/src/components/{SheetContext/SheetContext.tsx → SheetRoot/SheetRoot.tsx} +52 -39
- package/src/components/{GridSheet → SheetRoot}/index.ts +1 -1
- package/src/components/{FunctionEditor/FunctionEditor.tsx → SheetStatusbar/SheetStatusbar.tsx} +20 -8
- package/src/components/{FunctionEditor → SheetStatusbar}/index.ts +1 -1
- package/src/components/SheetToolbar/SheetToolbar.stories.tsx +5 -5
- package/src/components/SheetToolbar/SheetToolbar.tsx +19 -23
- package/src/components/SheetToolbar/align.ts +15 -15
- package/src/components/SheetToolbar/style.ts +12 -12
- package/src/components/index.ts +1 -7
- package/src/{components → containers}/RangeList/RangeList.tsx +17 -16
- package/src/containers/RangeList/index.ts +5 -0
- package/src/{components → containers}/SheetContainer/SheetContainer.stories.tsx +42 -46
- package/src/containers/SheetContainer/SheetContainer.tsx +57 -0
- package/src/containers/SheetContainer/index.ts +5 -0
- package/src/containers/index.ts +8 -0
- package/src/extensions/compute.stories.tsx +17 -16
- package/src/extensions/compute.ts +1 -1
- package/src/extensions/editor/sheet-extension.test.ts +1 -1
- package/src/extensions/editor/sheet-extension.ts +12 -12
- package/src/index.ts +8 -2
- package/src/integrations/thread-ranges.ts +8 -41
- package/src/meta.ts +1 -1
- package/src/model/sheet-model.test.ts +5 -5
- package/src/model/sheet-model.ts +39 -37
- package/src/model/testing.ts +2 -2
- package/src/model/useSheetModel.ts +3 -2
- package/src/operations/definitions.ts +73 -0
- package/src/operations/drop-axis.ts +26 -0
- package/src/operations/index.ts +14 -0
- package/src/operations/insert-axis.ts +19 -0
- package/src/operations/restore-axis.ts +19 -0
- package/src/operations/scroll-to-anchor.ts +31 -0
- package/src/playwright/playwright.config.ts +1 -1
- package/src/playwright/sheet.spec.ts +3 -3
- package/src/sanity.test.ts +6 -3
- package/src/serializer.ts +1 -1
- package/src/testing/data.ts +1 -1
- package/src/testing/testing.tsx +4 -4
- package/src/translations.ts +41 -36
- package/src/types/Sheet.ts +17 -20
- package/src/types/capabilities.ts +15 -3
- package/src/types/sheet-range-types.ts +3 -3
- package/src/types/types.ts +0 -80
- package/src/types/util.ts +3 -2
- package/dist/lib/browser/SheetContainer-ESCXPI7Y.mjs +0 -397
- package/dist/lib/browser/SheetContainer-ESCXPI7Y.mjs.map +0 -7
- package/dist/lib/browser/anchor-sort-JBRMW6OY.mjs +0 -23
- package/dist/lib/browser/anchor-sort-JBRMW6OY.mjs.map +0 -7
- package/dist/lib/browser/chunk-2SAGT3BB.mjs.map +0 -7
- package/dist/lib/browser/chunk-IFLWVS2V.mjs +0 -234
- package/dist/lib/browser/chunk-IFLWVS2V.mjs.map +0 -7
- package/dist/lib/browser/chunk-W6N44ONZ.mjs +0 -1470
- package/dist/lib/browser/chunk-W6N44ONZ.mjs.map +0 -7
- package/dist/lib/browser/compute-graph-registry-DL2PX7TF.mjs +0 -21
- package/dist/lib/browser/compute-graph-registry-DL2PX7TF.mjs.map +0 -7
- package/dist/lib/browser/markdown-BC4KBDUO.mjs +0 -29
- package/dist/lib/browser/markdown-BC4KBDUO.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-FJ4UWZUM.mjs +0 -79
- package/dist/lib/browser/operation-resolver-FJ4UWZUM.mjs.map +0 -7
- package/dist/lib/browser/react-surface-5BXM6TJ3.mjs +0 -51
- package/dist/lib/browser/react-surface-5BXM6TJ3.mjs.map +0 -7
- package/dist/lib/node-esm/SheetContainer-YVIDJKP4.mjs +0 -398
- package/dist/lib/node-esm/SheetContainer-YVIDJKP4.mjs.map +0 -7
- package/dist/lib/node-esm/anchor-sort-C3XFPI6S.mjs +0 -24
- package/dist/lib/node-esm/anchor-sort-C3XFPI6S.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-IMWGSIDG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-PPOYR7DK.mjs +0 -236
- package/dist/lib/node-esm/chunk-PPOYR7DK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-S7RYX7DG.mjs +0 -1471
- package/dist/lib/node-esm/chunk-S7RYX7DG.mjs.map +0 -7
- package/dist/lib/node-esm/compute-graph-registry-VXH55GDI.mjs +0 -22
- package/dist/lib/node-esm/compute-graph-registry-VXH55GDI.mjs.map +0 -7
- package/dist/lib/node-esm/markdown-6DGZCJRM.mjs +0 -30
- package/dist/lib/node-esm/markdown-6DGZCJRM.mjs.map +0 -7
- package/dist/lib/node-esm/operation-resolver-OGXEUWHA.mjs +0 -80
- package/dist/lib/node-esm/operation-resolver-OGXEUWHA.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-RLHC6B77.mjs +0 -52
- package/dist/lib/node-esm/react-surface-RLHC6B77.mjs.map +0 -7
- package/dist/types/src/capabilities/anchor-sort/anchor-sort.d.ts +0 -5
- package/dist/types/src/capabilities/anchor-sort/anchor-sort.d.ts.map +0 -1
- package/dist/types/src/capabilities/anchor-sort/index.d.ts +0 -3
- package/dist/types/src/capabilities/anchor-sort/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/compute-graph-registry/compute-graph-registry.d.ts +0 -5
- package/dist/types/src/capabilities/compute-graph-registry/compute-graph-registry.d.ts.map +0 -1
- package/dist/types/src/capabilities/compute-graph-registry/index.d.ts +0 -3
- package/dist/types/src/capabilities/compute-graph-registry/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/markdown/index.d.ts +0 -3
- package/dist/types/src/capabilities/markdown/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/markdown/markdown.d.ts +0 -5
- package/dist/types/src/capabilities/markdown/markdown.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +0 -5
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/components/FunctionEditor/FunctionEditor.d.ts +0 -3
- package/dist/types/src/components/FunctionEditor/FunctionEditor.d.ts.map +0 -1
- package/dist/types/src/components/FunctionEditor/index.d.ts +0 -2
- package/dist/types/src/components/FunctionEditor/index.d.ts.map +0 -1
- package/dist/types/src/components/GridSheet/GridSheet.d.ts +0 -3
- package/dist/types/src/components/GridSheet/GridSheet.d.ts.map +0 -1
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts +0 -55
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +0 -1
- package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts.map +0 -1
- package/dist/types/src/components/GridSheet/index.d.ts +0 -2
- package/dist/types/src/components/GridSheet/index.d.ts.map +0 -1
- package/dist/types/src/components/GridSheet/util.d.ts.map +0 -1
- package/dist/types/src/components/RangeList/RangeList.d.ts.map +0 -1
- package/dist/types/src/components/RangeList/index.d.ts +0 -2
- package/dist/types/src/components/RangeList/index.d.ts.map +0 -1
- package/dist/types/src/components/SheetContainer/SheetContainer.d.ts +0 -10
- package/dist/types/src/components/SheetContainer/SheetContainer.d.ts.map +0 -1
- package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts +0 -57
- package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +0 -1
- package/dist/types/src/components/SheetContainer/index.d.ts +0 -3
- package/dist/types/src/components/SheetContainer/index.d.ts.map +0 -1
- package/dist/types/src/components/SheetContext/SheetContext.d.ts.map +0 -1
- package/dist/types/src/components/SheetContext/index.d.ts +0 -2
- package/dist/types/src/components/SheetContext/index.d.ts.map +0 -1
- package/src/capabilities/anchor-sort/index.ts +0 -7
- package/src/capabilities/compute-graph-registry/index.ts +0 -7
- package/src/capabilities/markdown/index.ts +0 -7
- package/src/capabilities/operation-resolver/index.ts +0 -7
- package/src/capabilities/operation-resolver/operation-resolver.ts +0 -77
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/react-surface/react-surface.tsx +0 -43
- package/src/components/SheetContainer/SheetContainer.tsx +0 -48
- package/src/components/SheetContainer/index.ts +0 -7
- package/src/components/SheetContext/index.ts +0 -5
- /package/dist/types/src/components/{GridSheet → SheetContent}/SheetCellEditor.stories.d.ts +0 -0
|
@@ -5,25 +5,26 @@
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React, { useEffect, useRef, useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { Operation } from '@dxos/compute';
|
|
9
|
+
import { testFunctionPlugins } from '@dxos/compute-hyperformula/testing';
|
|
9
10
|
import { Filter } from '@dxos/echo';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
11
|
+
import { Obj } from '@dxos/echo';
|
|
12
|
+
import { useSpaces } from '@dxos/react-client/echo';
|
|
12
13
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
13
14
|
import { Button, Input, Toolbar } from '@dxos/react-ui';
|
|
15
|
+
import { JsonHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
14
16
|
import { withTheme } from '@dxos/react-ui/testing';
|
|
15
|
-
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
16
17
|
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { Sheet } from '../../types';
|
|
18
|
+
import { withComputeGraphDecorator } from '#testing';
|
|
19
|
+
import { Sheet } from '#types';
|
|
20
20
|
|
|
21
|
+
import { useSheetModel } from '../../model';
|
|
21
22
|
import { useComputeGraph } from './ComputeGraphContextProvider';
|
|
22
23
|
|
|
23
24
|
const FUNCTION_NAME = 'TEST';
|
|
24
25
|
|
|
25
26
|
const DefaultStory = () => {
|
|
26
|
-
const space =
|
|
27
|
+
const [space] = useSpaces();
|
|
27
28
|
const graph = useComputeGraph(space);
|
|
28
29
|
const [sheet, setSheet] = useState<Sheet.Sheet>();
|
|
29
30
|
const [text, setText] = useState(`${FUNCTION_NAME}(100)`);
|
|
@@ -44,14 +45,14 @@ const DefaultStory = () => {
|
|
|
44
45
|
setResult({ functions: { standard: f1.length, echo: f2.length } });
|
|
45
46
|
});
|
|
46
47
|
|
|
47
|
-
space.db.add(
|
|
48
|
+
space.db.add(Obj.make(Operation.PersistentOperation, { name: 'test', version: '0.0.1', binding: FUNCTION_NAME }));
|
|
48
49
|
}
|
|
49
50
|
}, [space, graph]);
|
|
50
51
|
|
|
51
52
|
const inputRef = useRef<HTMLInputElement | null>(null);
|
|
52
53
|
const handleTest = async () => {
|
|
53
54
|
if (space && graph) {
|
|
54
|
-
const objects = await space.db.query(Filter.type(
|
|
55
|
+
const objects = await space.db.query(Filter.type(Operation.PersistentOperation)).run();
|
|
55
56
|
const mapped = graph.mapFunctionBindingToId(text);
|
|
56
57
|
const unmapped = graph.mapFunctionBindingFromId(mapped);
|
|
57
58
|
const internal = graph.mapFormulaToNative(text);
|
|
@@ -74,9 +75,7 @@ const DefaultStory = () => {
|
|
|
74
75
|
</Input.Root>
|
|
75
76
|
<Button onClick={handleTest}>Test</Button>
|
|
76
77
|
</Toolbar.Root>
|
|
77
|
-
<
|
|
78
|
-
{JSON.stringify({ space: space?.id, graph: graph?.id, sheet: sheet?.id, model: model?.id, result }, null, 2)}
|
|
79
|
-
</SyntaxHighlighter>
|
|
78
|
+
<JsonHighlighter data={{ space: space?.id, graph: graph?.id, sheet: sheet?.id, model: model?.id, result }} />
|
|
80
79
|
</div>
|
|
81
80
|
);
|
|
82
81
|
};
|
|
@@ -84,11 +83,15 @@ const DefaultStory = () => {
|
|
|
84
83
|
export const Default: Story = {};
|
|
85
84
|
|
|
86
85
|
const meta = {
|
|
87
|
-
title: 'plugins/plugin-sheet/functions',
|
|
86
|
+
title: 'plugins/plugin-sheet/components/functions',
|
|
88
87
|
render: DefaultStory,
|
|
89
88
|
decorators: [
|
|
90
|
-
withTheme,
|
|
91
|
-
withClientProvider({
|
|
89
|
+
withTheme(),
|
|
90
|
+
withClientProvider({
|
|
91
|
+
types: [Operation.PersistentOperation, Sheet.Sheet],
|
|
92
|
+
createIdentity: true,
|
|
93
|
+
createSpace: true,
|
|
94
|
+
}),
|
|
92
95
|
withComputeGraphDecorator({ plugins: testFunctionPlugins }),
|
|
93
96
|
],
|
|
94
97
|
} satisfies Meta<typeof DefaultStory>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { SheetContent } from '../SheetContent';
|
|
6
|
+
import { SheetRoot } from '../SheetRoot';
|
|
7
|
+
import { SheetStatusbar } from '../SheetStatusbar';
|
|
8
|
+
import { SheetToolbar } from '../SheetToolbar';
|
|
9
|
+
|
|
10
|
+
export { useSheetContext, type SheetContextValue, type SheetRootProps } from '../SheetRoot';
|
|
11
|
+
export { type SheetContentProps } from '../SheetContent';
|
|
12
|
+
export { type SheetToolbarProps } from '../SheetToolbar';
|
|
13
|
+
export { type SheetStatusbarProps } from '../SheetStatusbar';
|
|
14
|
+
|
|
15
|
+
export const Sheet = {
|
|
16
|
+
Root: SheetRoot,
|
|
17
|
+
Toolbar: SheetToolbar,
|
|
18
|
+
Content: SheetContent,
|
|
19
|
+
Statusbar: SheetStatusbar,
|
|
20
|
+
};
|
|
@@ -6,17 +6,18 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
|
6
6
|
import React, { useMemo, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { Client } from '@dxos/client';
|
|
9
|
-
import { defaultFunctions } from '@dxos/compute';
|
|
10
|
-
import { getRegisteredFunctionNames } from '@dxos/compute/testing';
|
|
9
|
+
import { defaultFunctions } from '@dxos/compute-hyperformula';
|
|
10
|
+
import { getRegisteredFunctionNames } from '@dxos/compute-hyperformula/testing';
|
|
11
11
|
import { Obj } from '@dxos/echo';
|
|
12
12
|
import { createDocAccessor } from '@dxos/echo-db';
|
|
13
13
|
import { useAsyncEffect } from '@dxos/react-hooks';
|
|
14
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
15
14
|
import { CellEditor, type CellEditorProps } from '@dxos/react-ui-grid';
|
|
15
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
16
16
|
import { automerge } from '@dxos/ui-editor';
|
|
17
17
|
|
|
18
|
+
import { Sheet } from '#types';
|
|
19
|
+
|
|
18
20
|
import { sheetExtension } from '../../extensions';
|
|
19
|
-
import { Sheet } from '../../types';
|
|
20
21
|
|
|
21
22
|
const DefaultStory = ({ value, ...props }: CellEditorProps) => {
|
|
22
23
|
const extensions = useMemo(() => {
|
|
@@ -38,9 +39,9 @@ const AutomergeStory = ({ value, ...props }: CellEditorProps) => {
|
|
|
38
39
|
const space = await client.spaces.create();
|
|
39
40
|
|
|
40
41
|
const sheet = Sheet.make();
|
|
41
|
-
Obj.
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
Obj.update(sheet, (sheet) => {
|
|
43
|
+
sheet.name = 'Test';
|
|
44
|
+
sheet.cells[cell] = { value };
|
|
44
45
|
});
|
|
45
46
|
space.db.add(sheet);
|
|
46
47
|
setObject(sheet);
|
|
@@ -61,9 +62,9 @@ const AutomergeStory = ({ value, ...props }: CellEditorProps) => {
|
|
|
61
62
|
};
|
|
62
63
|
|
|
63
64
|
const meta = {
|
|
64
|
-
title: 'plugins/plugin-sheet/CellEditor',
|
|
65
|
+
title: 'plugins/plugin-sheet/components/CellEditor',
|
|
65
66
|
|
|
66
|
-
decorators: [withTheme],
|
|
67
|
+
decorators: [withTheme()],
|
|
67
68
|
component: CellEditor,
|
|
68
69
|
render: DefaultStory,
|
|
69
70
|
} satisfies Meta<typeof DefaultStory>;
|
package/src/components/{GridSheet/GridSheet.stories.tsx → SheetContent/SheetContent.stories.tsx}
RENAMED
|
@@ -5,23 +5,23 @@
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
|
+
import { OperationPlugin, RuntimePlugin } from '@dxos/app-framework';
|
|
8
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
9
|
-
import { testFunctionPlugins } from '@dxos/compute/testing';
|
|
10
|
-
import {
|
|
11
|
-
import { useSpace } from '@dxos/react-client/echo';
|
|
10
|
+
import { testFunctionPlugins } from '@dxos/compute-hyperformula/testing';
|
|
11
|
+
import { useSpaces } from '@dxos/react-client/echo';
|
|
12
12
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
13
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
13
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
14
14
|
|
|
15
|
-
import { createTestCells, useTestSheet, withComputeGraphDecorator } from '
|
|
16
|
-
import { translations } from '
|
|
17
|
-
import { Sheet } from '
|
|
18
|
-
import { useComputeGraph } from '../ComputeGraph';
|
|
19
|
-
import { SheetProvider } from '../SheetContext';
|
|
15
|
+
import { createTestCells, useTestSheet, withComputeGraphDecorator } from '#testing';
|
|
16
|
+
import { translations } from '#translations';
|
|
17
|
+
import { Sheet } from '#types';
|
|
20
18
|
|
|
21
|
-
import {
|
|
19
|
+
import { useComputeGraph } from '../ComputeGraph';
|
|
20
|
+
import { SheetRoot } from '../SheetRoot';
|
|
21
|
+
import { SheetContent } from './SheetContent';
|
|
22
22
|
|
|
23
23
|
export const Basic = () => {
|
|
24
|
-
const space =
|
|
24
|
+
const [space] = useSpaces();
|
|
25
25
|
const graph = useComputeGraph(space);
|
|
26
26
|
const sheet = useTestSheet(space, graph, { cells: createTestCells() });
|
|
27
27
|
if (!sheet || !graph) {
|
|
@@ -29,19 +29,20 @@ export const Basic = () => {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
return (
|
|
32
|
-
<
|
|
33
|
-
<div role='none' className='grid
|
|
34
|
-
<
|
|
32
|
+
<SheetRoot graph={graph} sheet={sheet} attendableId='test' ignoreAttention>
|
|
33
|
+
<div role='none' className='grid h-full w-full'>
|
|
34
|
+
<SheetContent />
|
|
35
35
|
</div>
|
|
36
|
-
</
|
|
36
|
+
</SheetRoot>
|
|
37
37
|
);
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
const meta = {
|
|
41
|
-
title: 'plugins/plugin-sheet/
|
|
42
|
-
component:
|
|
41
|
+
title: 'plugins/plugin-sheet/components/SheetContent',
|
|
42
|
+
component: SheetContent,
|
|
43
43
|
decorators: [
|
|
44
|
-
withTheme,
|
|
44
|
+
withTheme(),
|
|
45
|
+
withLayout({ layout: 'fullscreen' }),
|
|
45
46
|
withClientProvider({ types: [Sheet.Sheet], createSpace: true }),
|
|
46
47
|
withComputeGraphDecorator({ plugins: testFunctionPlugins }),
|
|
47
48
|
withPluginManager({
|
|
@@ -52,7 +53,7 @@ const meta = {
|
|
|
52
53
|
layout: 'fullscreen',
|
|
53
54
|
translations,
|
|
54
55
|
},
|
|
55
|
-
} satisfies Meta<typeof
|
|
56
|
+
} satisfies Meta<typeof SheetContent>;
|
|
56
57
|
|
|
57
58
|
export default meta;
|
|
58
59
|
|
|
@@ -8,13 +8,15 @@ import React, {
|
|
|
8
8
|
type MouseEvent,
|
|
9
9
|
type WheelEvent,
|
|
10
10
|
useCallback,
|
|
11
|
+
useEffect,
|
|
11
12
|
useMemo,
|
|
12
13
|
useRef,
|
|
13
14
|
useState,
|
|
14
15
|
} from 'react';
|
|
15
16
|
|
|
16
|
-
import { useOperationInvoker } from '@dxos/app-framework/
|
|
17
|
-
import { type CellRange, rangeToA1Notation } from '@dxos/compute';
|
|
17
|
+
import { useCapabilities, useOperationInvoker } from '@dxos/app-framework/ui';
|
|
18
|
+
import { type CellRange, rangeToA1Notation } from '@dxos/compute-hyperformula';
|
|
19
|
+
import { Obj } from '@dxos/echo';
|
|
18
20
|
import { defaultColSize, defaultRowSize } from '@dxos/lit-grid';
|
|
19
21
|
import { DropdownMenu, Icon, useTranslation } from '@dxos/react-ui';
|
|
20
22
|
import { useAttention } from '@dxos/react-ui-attention';
|
|
@@ -31,13 +33,15 @@ import {
|
|
|
31
33
|
editorKeys,
|
|
32
34
|
parseCellIndex,
|
|
33
35
|
} from '@dxos/react-ui-grid';
|
|
36
|
+
import { composable, composableProps } from '@dxos/ui-theme';
|
|
34
37
|
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import { DEFAULT_COLS, DEFAULT_ROWS, SheetOperation } from '../../types';
|
|
39
|
-
import { useSheetContext } from '../SheetContext';
|
|
38
|
+
import { meta } from '#meta';
|
|
39
|
+
import { SheetOperation } from '#operations';
|
|
40
|
+
import { DEFAULT_COLS, DEFAULT_ROWS, SheetCapabilities } from '#types';
|
|
40
41
|
|
|
42
|
+
import { type RangeController, rangeExtension, sheetExtension } from '../../extensions';
|
|
43
|
+
import { useSelectThreadOnCellFocus } from '../../integrations';
|
|
44
|
+
import { useSheetContext } from '../SheetRoot';
|
|
41
45
|
import { colLabelCell, rowLabelCell, useSheetModelDxGridProps } from './util';
|
|
42
46
|
|
|
43
47
|
const inertPosition: DxGridPosition = { plane: 'grid', col: 0, row: 0 };
|
|
@@ -68,10 +72,24 @@ const sheetRowDefault = {
|
|
|
68
72
|
grid: { size: defaultRowSize, resizeable: true },
|
|
69
73
|
};
|
|
70
74
|
|
|
71
|
-
export
|
|
75
|
+
export type SheetContentProps = {};
|
|
76
|
+
|
|
77
|
+
export const SheetContent = composable<HTMLDivElement, SheetContentProps>((props, forwardedRef) => {
|
|
72
78
|
const { t } = useTranslation(meta.id);
|
|
73
|
-
const {
|
|
74
|
-
|
|
79
|
+
const {
|
|
80
|
+
id,
|
|
81
|
+
attendableId,
|
|
82
|
+
model,
|
|
83
|
+
editing,
|
|
84
|
+
setCursor,
|
|
85
|
+
setRange,
|
|
86
|
+
cursor,
|
|
87
|
+
cursorFallbackRange,
|
|
88
|
+
activeRefs,
|
|
89
|
+
setActiveRefs,
|
|
90
|
+
ignoreAttention,
|
|
91
|
+
} = useSheetContext();
|
|
92
|
+
|
|
75
93
|
// NOTE(thure): using `useState` instead of `useRef` works with refs provided by `@lit/react` and gives us
|
|
76
94
|
// a reliable dependency for `useEffect` whereas `useLayoutEffect` does not guarantee the element will be defined.
|
|
77
95
|
const [dxGrid, setDxGrid] = useState<DxGridElement | null>(null);
|
|
@@ -127,15 +145,17 @@ export const GridSheet = () => {
|
|
|
127
145
|
|
|
128
146
|
const handleAxisResize = useCallback<NonNullable<GridContentProps['onAxisResize']>>(
|
|
129
147
|
({ axis, size, index: numericIndex }) => {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
148
|
+
Obj.update(model.sheet, (sheet) => {
|
|
149
|
+
if (axis === 'row') {
|
|
150
|
+
const rowId = sheet.rows[parseInt(numericIndex)];
|
|
151
|
+
sheet.rowMeta[rowId] ??= {};
|
|
152
|
+
sheet.rowMeta[rowId].size = size;
|
|
153
|
+
} else {
|
|
154
|
+
const columnId = sheet.columns[parseInt(numericIndex)];
|
|
155
|
+
sheet.columnMeta[columnId] ??= {};
|
|
156
|
+
sheet.columnMeta[columnId].size = size;
|
|
157
|
+
}
|
|
158
|
+
});
|
|
139
159
|
},
|
|
140
160
|
[model],
|
|
141
161
|
);
|
|
@@ -310,23 +330,31 @@ export const GridSheet = () => {
|
|
|
310
330
|
[model],
|
|
311
331
|
);
|
|
312
332
|
|
|
313
|
-
|
|
333
|
+
const [gridInstances] = useCapabilities(SheetCapabilities.GridInstances);
|
|
334
|
+
useEffect(() => {
|
|
335
|
+
if (dxGrid && gridInstances) {
|
|
336
|
+
gridInstances.register(attendableId, dxGrid, setActiveRefs);
|
|
337
|
+
return () => gridInstances.unregister(attendableId);
|
|
338
|
+
}
|
|
339
|
+
}, [dxGrid, gridInstances, attendableId, setActiveRefs]);
|
|
340
|
+
|
|
314
341
|
useSelectThreadOnCellFocus();
|
|
315
342
|
|
|
316
343
|
return (
|
|
317
|
-
|
|
318
|
-
<div role='none' className='relative min-bs-0 [&_.cm-editor]:!border-lb [&_.cm-editor]:!border-transparent'>
|
|
344
|
+
<div ref={forwardedRef} {...composableProps(props, { classNames: 'relative min-h-0' })}>
|
|
319
345
|
<GridCellEditor getCellContent={getCellContent} extensions={extensions} onBlur={handleBlur} />
|
|
320
346
|
<Grid.Content
|
|
347
|
+
className='[--dx-grid-base:var(--base-surface)] [&_.dx-grid]:absolute [&_.dx-grid]:inset-0'
|
|
321
348
|
initialCells={initialCells}
|
|
322
349
|
limitColumns={DEFAULT_COLS}
|
|
323
350
|
limitRows={DEFAULT_ROWS}
|
|
324
351
|
columns={columns}
|
|
325
352
|
rows={rows}
|
|
326
|
-
// TODO(burdon): `col` vs. `column`?
|
|
327
353
|
columnDefault={sheetColDefault}
|
|
328
354
|
rowDefault={sheetRowDefault}
|
|
355
|
+
activeRefs={activeRefs}
|
|
329
356
|
frozen={frozen}
|
|
357
|
+
overscroll='trap'
|
|
330
358
|
onAxisResize={handleAxisResize}
|
|
331
359
|
onSelect={handleSelect}
|
|
332
360
|
onFocus={handleFocus}
|
|
@@ -334,9 +362,6 @@ export const GridSheet = () => {
|
|
|
334
362
|
onKeyDown={handleKeyDown}
|
|
335
363
|
onContextMenu={handleContextMenu}
|
|
336
364
|
onClick={handleClick}
|
|
337
|
-
overscroll='trap'
|
|
338
|
-
className='[--dx-grid-base:var(--baseSurface)] [&_.dx-grid]:absolute [&_.dx-grid]:inset-0'
|
|
339
|
-
activeRefs={activeRefs}
|
|
340
365
|
ref={setDxGrid}
|
|
341
366
|
/>
|
|
342
367
|
<DropdownMenu.Root
|
|
@@ -352,27 +377,25 @@ export const GridSheet = () => {
|
|
|
352
377
|
data-testid={`grid.${contextMenuAxis}.insert-before`}
|
|
353
378
|
>
|
|
354
379
|
<Icon
|
|
355
|
-
size={5}
|
|
356
380
|
icon={contextMenuAxis === 'col' ? 'ph--columns-plus-left--regular' : 'ph--rows-plus-top--regular'}
|
|
357
381
|
/>
|
|
358
|
-
<span>{t(`add
|
|
382
|
+
<span>{t(`add-${contextMenuAxis}-before.label`)}</span>
|
|
359
383
|
</DropdownMenu.Item>
|
|
360
384
|
<DropdownMenu.Item
|
|
361
385
|
onClick={() => handleAxisMenuAction('insert-after')}
|
|
362
386
|
data-testid={`grid.${contextMenuAxis}.insert-after`}
|
|
363
387
|
>
|
|
364
388
|
<Icon
|
|
365
|
-
size={5}
|
|
366
389
|
icon={contextMenuAxis === 'col' ? 'ph--columns-plus-right--regular' : 'ph--rows-plus-bottom--regular'}
|
|
367
390
|
/>
|
|
368
|
-
<span>{t(`add
|
|
391
|
+
<span>{t(`add-${contextMenuAxis}-after.label`)}</span>
|
|
369
392
|
</DropdownMenu.Item>
|
|
370
393
|
<DropdownMenu.Item
|
|
371
394
|
onClick={() => handleAxisMenuAction('drop')}
|
|
372
395
|
data-testid={`grid.${contextMenuAxis}.drop`}
|
|
373
396
|
>
|
|
374
|
-
<Icon
|
|
375
|
-
<span>{t(`delete
|
|
397
|
+
<Icon icon='ph--backspace--regular' />
|
|
398
|
+
<span>{t(`delete-${contextMenuAxis}.label`)}</span>
|
|
376
399
|
</DropdownMenu.Item>
|
|
377
400
|
</DropdownMenu.Viewport>
|
|
378
401
|
<DropdownMenu.Arrow />
|
|
@@ -380,4 +403,4 @@ export const GridSheet = () => {
|
|
|
380
403
|
</DropdownMenu.Root>
|
|
381
404
|
</div>
|
|
382
405
|
);
|
|
383
|
-
};
|
|
406
|
+
});
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { useEffect, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import { inRange } from '@dxos/compute';
|
|
7
|
+
import { inRange } from '@dxos/compute-hyperformula';
|
|
8
8
|
import { createDocAccessor } from '@dxos/echo-db';
|
|
9
9
|
import { cellClassesForFieldType, parseValue } from '@dxos/react-ui-form';
|
|
10
10
|
import {
|
|
@@ -21,8 +21,9 @@ import {
|
|
|
21
21
|
} from '@dxos/react-ui-grid';
|
|
22
22
|
import { mx } from '@dxos/ui-theme';
|
|
23
23
|
|
|
24
|
+
import { cellClassNameForRange, rangeFromIndex } from '#types';
|
|
25
|
+
|
|
24
26
|
import { type SheetModel } from '../../model';
|
|
25
|
-
import { cellClassNameForRange, rangeFromIndex } from '../../types';
|
|
26
27
|
|
|
27
28
|
const createDxGridColumns = (model: SheetModel): DxGridAxisMeta => {
|
|
28
29
|
return model.sheet.columns.reduce(
|
|
@@ -96,13 +97,13 @@ const gridCellGetter = (model: SheetModel) => {
|
|
|
96
97
|
|
|
97
98
|
export const rowLabelCell = (row: number) => ({
|
|
98
99
|
value: rowToA1Notation(row),
|
|
99
|
-
className: '!bg-
|
|
100
|
+
className: '!bg-toolbar-surface text-subdued text-end pe-1',
|
|
100
101
|
resizeHandle: 'row',
|
|
101
102
|
});
|
|
102
103
|
|
|
103
104
|
export const colLabelCell = (col: number) => ({
|
|
104
105
|
value: colToA1Notation(col),
|
|
105
|
-
className: '!bg-
|
|
106
|
+
className: '!bg-toolbar-surface text-subdued',
|
|
106
107
|
resizeHandle: 'col',
|
|
107
108
|
});
|
|
108
109
|
|
|
@@ -114,7 +115,7 @@ const cellGetter = (model: SheetModel) => {
|
|
|
114
115
|
return getGridCells(nextBounds);
|
|
115
116
|
case 'fixedStartStart': {
|
|
116
117
|
return {
|
|
117
|
-
'0,0': { className: '!bg-
|
|
118
|
+
'0,0': { className: '!bg-toolbar-surface' },
|
|
118
119
|
};
|
|
119
120
|
}
|
|
120
121
|
case 'frozenColsStart':
|
|
@@ -4,9 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { type PropsWithChildren, createContext, useCallback, useContext, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
import {
|
|
8
|
+
type CellAddress,
|
|
9
|
+
type CellRange,
|
|
10
|
+
type CompleteCellRange,
|
|
11
|
+
type ComputeGraph,
|
|
12
|
+
} from '@dxos/compute-hyperformula';
|
|
13
|
+
import { raise } from '@dxos/debug';
|
|
10
14
|
import {
|
|
11
15
|
Grid,
|
|
12
16
|
type GridContentProps,
|
|
@@ -15,12 +19,13 @@ import {
|
|
|
15
19
|
useGridContext,
|
|
16
20
|
} from '@dxos/react-ui-grid';
|
|
17
21
|
|
|
22
|
+
import { type Sheet } from '#types';
|
|
23
|
+
|
|
18
24
|
import { type SheetModel, useSheetModel } from '../../model';
|
|
19
|
-
import { type Sheet } from '../../types';
|
|
20
25
|
|
|
21
26
|
export type SheetContextValue = {
|
|
22
27
|
id: string;
|
|
23
|
-
|
|
28
|
+
attendableId: string;
|
|
24
29
|
model: SheetModel;
|
|
25
30
|
|
|
26
31
|
// Cursor state.
|
|
@@ -39,29 +44,62 @@ export type SheetContextValue = {
|
|
|
39
44
|
activeRefs: GridContentProps['activeRefs'];
|
|
40
45
|
setActiveRefs: (activeRefs: GridContentProps['activeRefs']) => void;
|
|
41
46
|
|
|
47
|
+
// Flags
|
|
48
|
+
ignoreAttention?: boolean;
|
|
49
|
+
|
|
42
50
|
// Events.
|
|
43
51
|
// TODO(burdon): Generalize.
|
|
44
52
|
onInfo?: () => void;
|
|
45
|
-
|
|
46
|
-
// Flags
|
|
47
|
-
ignoreAttention?: boolean;
|
|
48
53
|
};
|
|
49
54
|
|
|
55
|
+
// TODO(burdon): Use radix context.
|
|
50
56
|
const SheetContext = createContext<SheetContextValue | undefined>(undefined);
|
|
51
57
|
|
|
52
58
|
export const useSheetContext = (): SheetContextValue => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
59
|
+
return useContext(SheetContext) ?? raise(new Error('Missing SheetContext'));
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export type SheetRootProps = {
|
|
63
|
+
graph: ComputeGraph;
|
|
64
|
+
sheet: Sheet.Sheet;
|
|
65
|
+
attendableId: string;
|
|
66
|
+
readonly?: boolean;
|
|
67
|
+
ignoreAttention?: boolean;
|
|
68
|
+
} & Pick<SheetContextValue, 'onInfo'>;
|
|
69
|
+
|
|
70
|
+
export const SheetRoot = ({
|
|
71
|
+
children,
|
|
72
|
+
graph,
|
|
73
|
+
sheet,
|
|
74
|
+
attendableId,
|
|
75
|
+
readonly,
|
|
76
|
+
ignoreAttention,
|
|
77
|
+
onInfo,
|
|
78
|
+
}: PropsWithChildren<SheetRootProps>) => {
|
|
79
|
+
const model = useSheetModel(graph, sheet, { readonly });
|
|
80
|
+
if (!model) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<Grid.Root id={attendableId}>
|
|
86
|
+
<SheetProviderImpl model={model} attendableId={attendableId} onInfo={onInfo} ignoreAttention={ignoreAttention}>
|
|
87
|
+
{children}
|
|
88
|
+
</SheetProviderImpl>
|
|
89
|
+
</Grid.Root>
|
|
90
|
+
);
|
|
56
91
|
};
|
|
57
92
|
|
|
58
93
|
const SheetProviderImpl = ({
|
|
59
94
|
__gridScope,
|
|
60
95
|
children,
|
|
96
|
+
attendableId,
|
|
61
97
|
ignoreAttention,
|
|
62
98
|
model,
|
|
63
99
|
onInfo,
|
|
64
|
-
}: GridScopedProps<
|
|
100
|
+
}: GridScopedProps<
|
|
101
|
+
PropsWithChildren<Pick<SheetContextValue, 'attendableId' | 'ignoreAttention' | 'model' | 'onInfo'>>
|
|
102
|
+
>) => {
|
|
65
103
|
const { id, editing, setEditing } = useGridContext('SheetProvider', __gridScope);
|
|
66
104
|
|
|
67
105
|
const [cursor, setCursorInternal] = useState<CellAddress>();
|
|
@@ -92,6 +130,7 @@ const SheetProviderImpl = ({
|
|
|
92
130
|
<SheetContext.Provider
|
|
93
131
|
value={{
|
|
94
132
|
id,
|
|
133
|
+
attendableId,
|
|
95
134
|
model,
|
|
96
135
|
editing,
|
|
97
136
|
setEditing,
|
|
@@ -102,38 +141,12 @@ const SheetProviderImpl = ({
|
|
|
102
141
|
cursorFallbackRange,
|
|
103
142
|
activeRefs,
|
|
104
143
|
setActiveRefs,
|
|
144
|
+
ignoreAttention,
|
|
105
145
|
// TODO(burdon): Change to event.
|
|
106
146
|
onInfo,
|
|
107
|
-
ignoreAttention,
|
|
108
147
|
}}
|
|
109
148
|
>
|
|
110
149
|
{children}
|
|
111
150
|
</SheetContext.Provider>
|
|
112
151
|
);
|
|
113
152
|
};
|
|
114
|
-
|
|
115
|
-
export type SheetProviderProps = {
|
|
116
|
-
graph: ComputeGraph;
|
|
117
|
-
sheet: Sheet.Sheet;
|
|
118
|
-
readonly?: boolean;
|
|
119
|
-
ignoreAttention?: boolean;
|
|
120
|
-
} & Pick<SheetContextValue, 'onInfo'>;
|
|
121
|
-
|
|
122
|
-
export const SheetProvider = ({
|
|
123
|
-
children,
|
|
124
|
-
graph,
|
|
125
|
-
sheet,
|
|
126
|
-
readonly,
|
|
127
|
-
ignoreAttention,
|
|
128
|
-
onInfo,
|
|
129
|
-
}: PropsWithChildren<SheetProviderProps>) => {
|
|
130
|
-
const model = useSheetModel(graph, sheet, { readonly });
|
|
131
|
-
|
|
132
|
-
return !model ? null : (
|
|
133
|
-
<Grid.Root id={Obj.getDXN(sheet).toString()}>
|
|
134
|
-
<SheetProviderImpl model={model} onInfo={onInfo} ignoreAttention={ignoreAttention}>
|
|
135
|
-
{children}
|
|
136
|
-
</SheetProviderImpl>
|
|
137
|
-
</Grid.Root>
|
|
138
|
-
);
|
|
139
|
-
};
|
package/src/components/{FunctionEditor/FunctionEditor.tsx → SheetStatusbar/SheetStatusbar.tsx}
RENAMED
|
@@ -4,13 +4,18 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import { addressToA1Notation, isFormula, rangeToA1Notation } from '@dxos/compute';
|
|
7
|
+
import { addressToA1Notation, isFormula, rangeToA1Notation } from '@dxos/compute-hyperformula';
|
|
8
8
|
import { Icon } from '@dxos/react-ui';
|
|
9
|
+
import { composable, composableProps, mx } from '@dxos/ui-theme';
|
|
9
10
|
|
|
10
|
-
import { mapFormulaIndicesToRefs } from '
|
|
11
|
-
import { useSheetContext } from '../SheetContext';
|
|
11
|
+
import { mapFormulaIndicesToRefs } from '#types';
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
import { useSheetContext } from '../SheetRoot';
|
|
14
|
+
|
|
15
|
+
export type SheetStatusbarProps = {};
|
|
16
|
+
|
|
17
|
+
export const SheetStatusbar = composable<HTMLDivElement, SheetStatusbarProps>((props, forwardedRef) => {
|
|
18
|
+
const { className, ...rest } = composableProps(props);
|
|
14
19
|
const { model, cursor, range } = useSheetContext();
|
|
15
20
|
|
|
16
21
|
let value;
|
|
@@ -26,16 +31,23 @@ export const FunctionEditor = () => {
|
|
|
26
31
|
}
|
|
27
32
|
|
|
28
33
|
return (
|
|
29
|
-
<div
|
|
34
|
+
<div
|
|
35
|
+
ref={forwardedRef}
|
|
36
|
+
{...rest}
|
|
37
|
+
className={mx(
|
|
38
|
+
'flex shrink-0 justify-between items-center px-4 py-1 text-sm bg-toolbar-surface border-y !border-subdued-separator',
|
|
39
|
+
className,
|
|
40
|
+
)}
|
|
41
|
+
>
|
|
30
42
|
<div className='flex gap-4 items-center'>
|
|
31
|
-
<div className='flex
|
|
43
|
+
<div className='flex w-16 items-center font-mono'>
|
|
32
44
|
{(range && rangeToA1Notation(range)) || (cursor && addressToA1Notation(cursor))}
|
|
33
45
|
</div>
|
|
34
46
|
<div className='flex gap-2 items-center'>
|
|
35
|
-
<Icon icon='ph--function--regular' classNames={['text-
|
|
47
|
+
<Icon icon='ph--function--regular' classNames={['text-green-text', formula ? 'visible' : 'invisible']} />
|
|
36
48
|
<span className='font-mono'>{value}</span>
|
|
37
49
|
</div>
|
|
38
50
|
</div>
|
|
39
51
|
</div>
|
|
40
52
|
);
|
|
41
|
-
};
|
|
53
|
+
});
|