@dxos/plugin-sheet 0.8.4-main.9735255 → 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-KE3AKN5W.mjs → chunk-SVGX3MWY.mjs} +25 -160
- 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-6J5L47IB.mjs → chunk-4A2KAXTF.mjs} +25 -160
- 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 +4 -4
- 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 +3 -3
- 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 +1 -1
- 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} +45 -25
- 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 +15 -9
- 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 +1 -1
- package/dist/lib/browser/SheetContainer-J72HS2FI.mjs +0 -397
- package/dist/lib/browser/SheetContainer-J72HS2FI.mjs.map +0 -7
- package/dist/lib/browser/anchor-sort-LLO7PZKF.mjs +0 -23
- package/dist/lib/browser/anchor-sort-LLO7PZKF.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-KE3AKN5W.mjs.map +0 -7
- package/dist/lib/browser/chunk-S27QJYTN.mjs +0 -1473
- package/dist/lib/browser/chunk-S27QJYTN.mjs.map +0 -7
- package/dist/lib/browser/compute-graph-registry-RC5L7RE4.mjs +0 -21
- package/dist/lib/browser/compute-graph-registry-RC5L7RE4.mjs.map +0 -7
- package/dist/lib/browser/markdown-D2T2DOVX.mjs +0 -29
- package/dist/lib/browser/markdown-D2T2DOVX.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-YDOW72CN.mjs +0 -79
- package/dist/lib/browser/operation-resolver-YDOW72CN.mjs.map +0 -7
- package/dist/lib/browser/react-surface-JIYVFH42.mjs +0 -51
- package/dist/lib/browser/react-surface-JIYVFH42.mjs.map +0 -7
- package/dist/lib/node-esm/SheetContainer-OGSSDOZU.mjs +0 -398
- package/dist/lib/node-esm/SheetContainer-OGSSDOZU.mjs.map +0 -7
- package/dist/lib/node-esm/anchor-sort-OX5I2YOW.mjs +0 -24
- package/dist/lib/node-esm/anchor-sort-OX5I2YOW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6J5L47IB.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-Y4V6HVHO.mjs +0 -1474
- package/dist/lib/node-esm/chunk-Y4V6HVHO.mjs.map +0 -7
- package/dist/lib/node-esm/compute-graph-registry-ZGXVLVGD.mjs +0 -22
- package/dist/lib/node-esm/compute-graph-registry-ZGXVLVGD.mjs.map +0 -7
- package/dist/lib/node-esm/markdown-PTV72DLO.mjs +0 -30
- package/dist/lib/node-esm/markdown-PTV72DLO.mjs.map +0 -7
- package/dist/lib/node-esm/operation-resolver-Q63VQBVA.mjs +0 -80
- package/dist/lib/node-esm/operation-resolver-Q63VQBVA.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-SWRZSZVR.mjs +0 -52
- package/dist/lib/node-esm/react-surface-SWRZSZVR.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
|
@@ -18,8 +18,8 @@ import { type SyntaxNode } from '@lezer/common';
|
|
|
18
18
|
import { tags } from '@lezer/highlight';
|
|
19
19
|
import { spreadsheet } from 'codemirror-lang-spreadsheet';
|
|
20
20
|
|
|
21
|
-
import { type FunctionDefinition } from '@dxos/compute';
|
|
22
|
-
import { RANGE_NOTATION } from '@dxos/compute';
|
|
21
|
+
import { type FunctionDefinition } from '@dxos/compute-hyperformula';
|
|
22
|
+
import { RANGE_NOTATION } from '@dxos/compute-hyperformula';
|
|
23
23
|
import { singleValueFacet } from '@dxos/ui-editor';
|
|
24
24
|
import { mx } from '@dxos/ui-theme';
|
|
25
25
|
|
|
@@ -33,30 +33,30 @@ const highlightStyles = HighlightStyle.define([
|
|
|
33
33
|
// Function.
|
|
34
34
|
{
|
|
35
35
|
tag: tags.name,
|
|
36
|
-
class: 'text-
|
|
36
|
+
class: 'text-accent-text',
|
|
37
37
|
},
|
|
38
38
|
// Range.
|
|
39
39
|
{
|
|
40
40
|
tag: tags.tagName,
|
|
41
|
-
class: 'text-
|
|
41
|
+
class: 'text-pink-text',
|
|
42
42
|
},
|
|
43
43
|
// Values.
|
|
44
44
|
{
|
|
45
45
|
tag: tags.number,
|
|
46
|
-
class: 'text-
|
|
46
|
+
class: 'text-teal-text',
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
49
|
tag: tags.bool,
|
|
50
|
-
class: 'text-
|
|
50
|
+
class: 'text-teal-text',
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
53
|
tag: tags.string,
|
|
54
|
-
class: 'text-
|
|
54
|
+
class: 'text-teal-text',
|
|
55
55
|
},
|
|
56
56
|
// Error.
|
|
57
57
|
{
|
|
58
58
|
tag: tags.invalid,
|
|
59
|
-
class: 'text-
|
|
59
|
+
class: 'text-un-accent',
|
|
60
60
|
},
|
|
61
61
|
]);
|
|
62
62
|
|
|
@@ -97,7 +97,7 @@ export const sheetExtension = ({ debug, functions = [] }: SheetExtensionOptions)
|
|
|
97
97
|
|
|
98
98
|
const title = document.createElement('h2');
|
|
99
99
|
title.innerText = name;
|
|
100
|
-
title.className = 'text-lg font-mono text-
|
|
100
|
+
title.className = 'text-lg font-mono text-accent-text';
|
|
101
101
|
root.appendChild(title);
|
|
102
102
|
|
|
103
103
|
if (description) {
|
|
@@ -110,7 +110,7 @@ export const sheetExtension = ({ debug, functions = [] }: SheetExtensionOptions)
|
|
|
110
110
|
if (syntax) {
|
|
111
111
|
const detail = document.createElement('pre');
|
|
112
112
|
detail.innerText = syntax;
|
|
113
|
-
detail.className = 'whitespace-pre-wrap text-
|
|
113
|
+
detail.className = 'whitespace-pre-wrap text-green-text';
|
|
114
114
|
root.appendChild(detail);
|
|
115
115
|
}
|
|
116
116
|
|
|
@@ -169,8 +169,8 @@ export const sheetExtension = ({ debug, functions = [] }: SheetExtensionOptions)
|
|
|
169
169
|
icons: false,
|
|
170
170
|
tooltipClass: () =>
|
|
171
171
|
mx(
|
|
172
|
-
'!-left-[1px] !top-[33px] !-m-0 border
|
|
173
|
-
'[&>ul>li[aria-selected]]:!bg-
|
|
172
|
+
'!-left-[1px] !top-[33px] !-m-0 border border-h-0! [&>ul]:!min-w-[198px]',
|
|
173
|
+
'[&>ul>li[aria-selected]]:!bg-accent-surface',
|
|
174
174
|
'border-separator',
|
|
175
175
|
),
|
|
176
176
|
}),
|
package/src/index.ts
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
import { meta } from './meta';
|
|
8
|
+
|
|
9
|
+
export const SheetPlugin = Plugin.lazy(meta, () => import('./SheetPlugin'));
|
|
10
|
+
|
|
6
11
|
export * from './meta';
|
|
7
|
-
|
|
12
|
+
|
|
13
|
+
export { SheetCapabilities } from './types';
|
|
@@ -2,23 +2,19 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import * as Effect from 'effect/Effect';
|
|
6
5
|
import { useCallback, useEffect, useMemo } from 'react';
|
|
7
6
|
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
8
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
10
9
|
import { debounce } from '@dxos/async';
|
|
11
|
-
import { type CellAddress, type CompleteCellRange, inRange } from '@dxos/compute';
|
|
10
|
+
import { type CellAddress, type CompleteCellRange, inRange } from '@dxos/compute-hyperformula';
|
|
12
11
|
import { Obj, Relation } from '@dxos/echo';
|
|
13
|
-
import {
|
|
14
|
-
import { ATTENDABLE_PATH_SEPARATOR, DeckOperation } from '@dxos/plugin-deck/types';
|
|
15
|
-
import { ThreadOperation } from '@dxos/plugin-thread/types';
|
|
12
|
+
import { ThreadOperation } from '@dxos/plugin-thread/operations';
|
|
16
13
|
import { Filter, Query, useQuery } from '@dxos/react-client/echo';
|
|
17
|
-
import {
|
|
14
|
+
import { linkedSegment } from '@dxos/react-ui-attention';
|
|
18
15
|
import { AnchoredTo, Thread } from '@dxos/types';
|
|
19
16
|
|
|
20
|
-
import { useSheetContext } from '
|
|
21
|
-
import { meta } from '../meta';
|
|
17
|
+
import { useSheetContext } from '#components';
|
|
22
18
|
|
|
23
19
|
export const completeCellRangeToThreadCursor = (range: CompleteCellRange): string => {
|
|
24
20
|
return `${range.from.col},${range.from.row},${range.to.col},${range.to.row}`;
|
|
@@ -37,33 +33,6 @@ export const parseThreadAnchorAsCellRange = (cursor: string): CompleteCellRange
|
|
|
37
33
|
}
|
|
38
34
|
};
|
|
39
35
|
|
|
40
|
-
export const useUpdateFocusedCellOnThreadSelection = (grid: DxGridElement | null) => {
|
|
41
|
-
const { model, setActiveRefs } = useSheetContext();
|
|
42
|
-
const sheetId = Obj.getDXN(model.sheet).toString();
|
|
43
|
-
|
|
44
|
-
const scrollIntoViewHandler = useMemo(
|
|
45
|
-
() =>
|
|
46
|
-
OperationResolver.make({
|
|
47
|
-
operation: Common.LayoutOperation.ScrollIntoView,
|
|
48
|
-
position: 'hoist',
|
|
49
|
-
filter: (input) => input.subject === sheetId && !!input.cursor,
|
|
50
|
-
handler: (input) =>
|
|
51
|
-
Effect.sync(() => {
|
|
52
|
-
const { cursor, ref } = input;
|
|
53
|
-
if (cursor) {
|
|
54
|
-
setActiveRefs(ref as GridContentProps['activeRefs']);
|
|
55
|
-
// TODO(Zan): Everywhere we refer to the cursor in a thread context should change to `anchor`.
|
|
56
|
-
const range = parseThreadAnchorAsCellRange(cursor);
|
|
57
|
-
range && grid?.setFocus({ ...range.to, plane: 'grid' }, true);
|
|
58
|
-
}
|
|
59
|
-
}),
|
|
60
|
-
}),
|
|
61
|
-
[sheetId, setActiveRefs, grid],
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
useOperationResolver(meta.id, scrollIntoViewHandler);
|
|
65
|
-
};
|
|
66
|
-
|
|
67
36
|
export const useSelectThreadOnCellFocus = () => {
|
|
68
37
|
const { model, cursor } = useSheetContext();
|
|
69
38
|
const { invokePromise } = useOperationInvoker();
|
|
@@ -88,12 +57,10 @@ export const useSelectThreadOnCellFocus = () => {
|
|
|
88
57
|
});
|
|
89
58
|
|
|
90
59
|
if (closestThread) {
|
|
91
|
-
const primary = Obj.getDXN(model.sheet).toString();
|
|
92
60
|
void (async () => {
|
|
93
61
|
await invokePromise(ThreadOperation.Select, { current: Relation.getDXN(closestThread).toString() });
|
|
94
|
-
await invokePromise(
|
|
95
|
-
|
|
96
|
-
companion: `${primary}${ATTENDABLE_PATH_SEPARATOR}comments`,
|
|
62
|
+
await invokePromise(LayoutOperation.UpdateCompanion, {
|
|
63
|
+
subject: linkedSegment('comments'),
|
|
97
64
|
});
|
|
98
65
|
})();
|
|
99
66
|
}
|
package/src/meta.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { type Plugin } from '@dxos/app-framework';
|
|
|
6
6
|
import { trim } from '@dxos/util';
|
|
7
7
|
|
|
8
8
|
export const meta: Plugin.Meta = {
|
|
9
|
-
id: 'dxos.
|
|
9
|
+
id: 'org.dxos.plugin.sheet',
|
|
10
10
|
name: 'Sheet',
|
|
11
11
|
description: trim`
|
|
12
12
|
Full-featured spreadsheet application with over 400 built-in formulas for calculations and data analysis.
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
import { afterEach, beforeEach, describe, expect, onTestFinished, test } from 'vitest';
|
|
6
6
|
|
|
7
7
|
import { Trigger } from '@dxos/async';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import { Operation } from '@dxos/compute';
|
|
9
|
+
import { type CellScalarValue, addressFromA1Notation, isFormula } from '@dxos/compute-hyperformula';
|
|
10
|
+
import { TestBuilder, testFunctionPlugins } from '@dxos/compute-hyperformula/testing';
|
|
11
11
|
import { log } from '@dxos/log';
|
|
12
12
|
|
|
13
|
-
import { Sheet, mapFormulaIndicesToRefs, mapFormulaRefsToIndices } from '
|
|
13
|
+
import { Sheet, mapFormulaIndicesToRefs, mapFormulaRefsToIndices } from '#types';
|
|
14
14
|
|
|
15
15
|
import { SheetModel } from './sheet-model';
|
|
16
16
|
import { createTestGrid } from './testing';
|
|
@@ -18,7 +18,7 @@ import { createTestGrid } from './testing';
|
|
|
18
18
|
describe('SheetModel', () => {
|
|
19
19
|
let testBuilder: TestBuilder;
|
|
20
20
|
beforeEach(async () => {
|
|
21
|
-
testBuilder = new TestBuilder({ types: [
|
|
21
|
+
testBuilder = new TestBuilder({ types: [Operation.PersistentOperation], plugins: testFunctionPlugins });
|
|
22
22
|
await testBuilder.open();
|
|
23
23
|
});
|
|
24
24
|
afterEach(async () => {
|
package/src/model/sheet-model.ts
CHANGED
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
addressToA1Notation,
|
|
21
21
|
createSheetName,
|
|
22
22
|
isFormula,
|
|
23
|
-
} from '@dxos/compute';
|
|
23
|
+
} from '@dxos/compute-hyperformula';
|
|
24
24
|
import { Resource } from '@dxos/context';
|
|
25
25
|
import { Obj } from '@dxos/echo';
|
|
26
26
|
import { Format, TypeEnum } from '@dxos/echo/internal';
|
|
@@ -38,8 +38,8 @@ import {
|
|
|
38
38
|
insertIndices,
|
|
39
39
|
mapFormulaIndicesToRefs,
|
|
40
40
|
mapFormulaRefsToIndices,
|
|
41
|
-
} from '
|
|
42
|
-
import { type Sheet, type SheetAction } from '
|
|
41
|
+
} from '#types';
|
|
42
|
+
import { type Sheet, type SheetAction } from '#types';
|
|
43
43
|
|
|
44
44
|
// TODO(burdon): Move to compute.
|
|
45
45
|
// Map sheet types to system types.
|
|
@@ -122,8 +122,8 @@ export class SheetModel extends Resource {
|
|
|
122
122
|
*/
|
|
123
123
|
protected override async _open(): Promise<void> {
|
|
124
124
|
log('initialize', { id: this.id });
|
|
125
|
-
Obj.
|
|
126
|
-
initialize(
|
|
125
|
+
Obj.update(this._sheet, (obj) => {
|
|
126
|
+
initialize(obj);
|
|
127
127
|
});
|
|
128
128
|
|
|
129
129
|
this._graph.update.on((event) => {
|
|
@@ -184,8 +184,8 @@ export class SheetModel extends Resource {
|
|
|
184
184
|
|
|
185
185
|
insertRows(i: number, n = 1): string[] {
|
|
186
186
|
let idx: string[] = [];
|
|
187
|
-
Obj.
|
|
188
|
-
idx = insertIndices(
|
|
187
|
+
Obj.update(this._sheet, (obj) => {
|
|
188
|
+
idx = insertIndices(obj.rows, i, n, MAX_ROWS);
|
|
189
189
|
});
|
|
190
190
|
this.reset();
|
|
191
191
|
return idx;
|
|
@@ -193,8 +193,8 @@ export class SheetModel extends Resource {
|
|
|
193
193
|
|
|
194
194
|
insertColumns(i: number, n = 1): string[] {
|
|
195
195
|
let idx: string[] = [];
|
|
196
|
-
Obj.
|
|
197
|
-
idx = insertIndices(
|
|
196
|
+
Obj.update(this._sheet, (obj) => {
|
|
197
|
+
idx = insertIndices(obj.columns, i, n, MAX_COLS);
|
|
198
198
|
});
|
|
199
199
|
this.reset();
|
|
200
200
|
return idx;
|
|
@@ -208,9 +208,9 @@ export class SheetModel extends Resource {
|
|
|
208
208
|
const values = this.getCellValues(range).flat();
|
|
209
209
|
const index = this._sheet.rows.indexOf(rowIndex);
|
|
210
210
|
this.clear(range);
|
|
211
|
-
Obj.
|
|
212
|
-
|
|
213
|
-
delete
|
|
211
|
+
Obj.update(this._sheet, (obj) => {
|
|
212
|
+
obj.rows.splice(index, 1);
|
|
213
|
+
delete obj.rowMeta[rowIndex];
|
|
214
214
|
});
|
|
215
215
|
this.reset();
|
|
216
216
|
return { axis: 'row', index, axisIndex: rowIndex, axisMeta: this._sheet.rowMeta[rowIndex], values };
|
|
@@ -224,39 +224,41 @@ export class SheetModel extends Resource {
|
|
|
224
224
|
const values = this.getCellValues(range).flat();
|
|
225
225
|
const index = this._sheet.columns.indexOf(colIndex);
|
|
226
226
|
this.clear(range);
|
|
227
|
-
Obj.
|
|
228
|
-
|
|
229
|
-
delete
|
|
227
|
+
Obj.update(this._sheet, (obj) => {
|
|
228
|
+
obj.columns.splice(index, 1);
|
|
229
|
+
delete obj.columnMeta[colIndex];
|
|
230
230
|
});
|
|
231
231
|
this.reset();
|
|
232
232
|
return { axis: 'col', index, axisIndex: colIndex, axisMeta: this._sheet.rowMeta[colIndex], values };
|
|
233
233
|
}
|
|
234
234
|
|
|
235
235
|
restoreRow({ index, axisIndex, axisMeta, values }: SheetAction.RestoreAxis): void {
|
|
236
|
-
Obj.
|
|
237
|
-
|
|
236
|
+
Obj.update(this._sheet, (obj) => {
|
|
237
|
+
obj.rows.splice(index, 0, axisIndex);
|
|
238
238
|
values.forEach((value, col) => {
|
|
239
239
|
if (value) {
|
|
240
|
-
|
|
240
|
+
obj.cells[`${obj.columns[col]}@${axisIndex}`] = { value };
|
|
241
241
|
}
|
|
242
242
|
});
|
|
243
|
+
|
|
243
244
|
if (axisMeta) {
|
|
244
|
-
|
|
245
|
+
obj.rowMeta[axisIndex] = axisMeta;
|
|
245
246
|
}
|
|
246
247
|
});
|
|
247
248
|
this.reset();
|
|
248
249
|
}
|
|
249
250
|
|
|
250
251
|
restoreColumn({ index, axisIndex, axisMeta, values }: SheetAction.RestoreAxis): void {
|
|
251
|
-
Obj.
|
|
252
|
-
|
|
252
|
+
Obj.update(this._sheet, (obj) => {
|
|
253
|
+
obj.columns.splice(index, 0, axisIndex);
|
|
253
254
|
values.forEach((value, row) => {
|
|
254
255
|
if (value) {
|
|
255
|
-
|
|
256
|
+
obj.cells[`${axisIndex}@${obj.rows[row]}`] = { value };
|
|
256
257
|
}
|
|
257
258
|
});
|
|
259
|
+
|
|
258
260
|
if (axisMeta) {
|
|
259
|
-
|
|
261
|
+
obj.columnMeta[axisIndex] = axisMeta;
|
|
260
262
|
}
|
|
261
263
|
});
|
|
262
264
|
this.reset();
|
|
@@ -275,10 +277,10 @@ export class SheetModel extends Resource {
|
|
|
275
277
|
const topLeft = getTopLeft(range);
|
|
276
278
|
const values = this._iterRange(range, () => null);
|
|
277
279
|
this._node.graph.hf.setCellContents(toSimpleCellAddress(this._node.sheetId, topLeft), values);
|
|
278
|
-
Obj.
|
|
280
|
+
Obj.update(this._sheet, (obj) => {
|
|
279
281
|
this._iterRange(range, (cell) => {
|
|
280
282
|
const idx = addressToIndex(this._sheet, cell);
|
|
281
|
-
delete
|
|
283
|
+
delete obj.cells[idx];
|
|
282
284
|
});
|
|
283
285
|
});
|
|
284
286
|
}
|
|
@@ -286,10 +288,10 @@ export class SheetModel extends Resource {
|
|
|
286
288
|
cut(range: CellRange): void {
|
|
287
289
|
invariant(this._node);
|
|
288
290
|
this._node.graph.hf.cut(toModelRange(this._node.sheetId, range));
|
|
289
|
-
Obj.
|
|
291
|
+
Obj.update(this._sheet, (obj) => {
|
|
290
292
|
this._iterRange(range, (cell) => {
|
|
291
293
|
const idx = addressToIndex(this._sheet, cell);
|
|
292
|
-
delete
|
|
294
|
+
delete obj.cells[idx];
|
|
293
295
|
});
|
|
294
296
|
});
|
|
295
297
|
}
|
|
@@ -303,12 +305,12 @@ export class SheetModel extends Resource {
|
|
|
303
305
|
invariant(this._node);
|
|
304
306
|
if (!this._node.graph.hf.isClipboardEmpty()) {
|
|
305
307
|
const changes = this._node.graph.hf.paste(toSimpleCellAddress(this._node.sheetId, cell));
|
|
306
|
-
Obj.
|
|
308
|
+
Obj.update(this._sheet, (obj) => {
|
|
307
309
|
for (const change of changes) {
|
|
308
310
|
if (change instanceof ExportedCellChange) {
|
|
309
311
|
const { address, newValue } = change;
|
|
310
312
|
const idx = addressToIndex(this._sheet, { row: address.row, col: address.col });
|
|
311
|
-
|
|
313
|
+
obj.cells[idx] = { value: newValue };
|
|
312
314
|
}
|
|
313
315
|
}
|
|
314
316
|
});
|
|
@@ -402,14 +404,14 @@ export class SheetModel extends Resource {
|
|
|
402
404
|
// Reallocate if > current bounds.
|
|
403
405
|
let refresh = false;
|
|
404
406
|
if (cell.row >= this._sheet.rows.length) {
|
|
405
|
-
Obj.
|
|
406
|
-
insertIndices(
|
|
407
|
+
Obj.update(this._sheet, (obj) => {
|
|
408
|
+
insertIndices(obj.rows, cell.row, 1, MAX_ROWS);
|
|
407
409
|
});
|
|
408
410
|
refresh = true;
|
|
409
411
|
}
|
|
410
412
|
if (cell.col >= this._sheet.columns.length) {
|
|
411
|
-
Obj.
|
|
412
|
-
insertIndices(
|
|
413
|
+
Obj.update(this._sheet, (obj) => {
|
|
414
|
+
insertIndices(obj.columns, cell.col, 1, MAX_COLS);
|
|
413
415
|
});
|
|
414
416
|
refresh = true;
|
|
415
417
|
}
|
|
@@ -427,16 +429,16 @@ export class SheetModel extends Resource {
|
|
|
427
429
|
// Insert into sheet.
|
|
428
430
|
const idx = addressToIndex(this._sheet, cell);
|
|
429
431
|
if (value === undefined || value === null) {
|
|
430
|
-
Obj.
|
|
431
|
-
delete
|
|
432
|
+
Obj.update(this._sheet, (obj) => {
|
|
433
|
+
delete obj.cells[idx];
|
|
432
434
|
});
|
|
433
435
|
} else {
|
|
434
436
|
if (isFormula(value)) {
|
|
435
437
|
value = this._graph.mapFunctionBindingToId(mapFormulaRefsToIndices(this._sheet, value));
|
|
436
438
|
}
|
|
437
439
|
|
|
438
|
-
Obj.
|
|
439
|
-
|
|
440
|
+
Obj.update(this._sheet, (obj) => {
|
|
441
|
+
obj.cells[idx] = { value };
|
|
440
442
|
});
|
|
441
443
|
}
|
|
442
444
|
}
|
package/src/model/testing.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { addressToA1Notation } from '@dxos/compute';
|
|
5
|
+
import { addressToA1Notation } from '@dxos/compute-hyperformula';
|
|
6
6
|
|
|
7
|
-
import { Sheet } from '
|
|
7
|
+
import { Sheet } from '#types';
|
|
8
8
|
|
|
9
9
|
// TODO(burdon): Create testing endpoint.
|
|
10
10
|
// TODO(burdon): Move to react-ui-sheet.
|
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
import { useEffect, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import { type ComputeGraph } from '@dxos/compute';
|
|
7
|
+
import { type ComputeGraph } from '@dxos/compute-hyperformula';
|
|
8
|
+
|
|
9
|
+
import { type Sheet } from '#types';
|
|
8
10
|
|
|
9
11
|
import { SheetModel } from '../model';
|
|
10
|
-
import { type Sheet } from '../types';
|
|
11
12
|
|
|
12
13
|
export type UseSheetModelOptions = {
|
|
13
14
|
readonly?: boolean;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { Operation } from '@dxos/compute';
|
|
9
|
+
|
|
10
|
+
import { meta } from '#meta';
|
|
11
|
+
|
|
12
|
+
const SHEET_OPERATION = `${meta.id}.operation`;
|
|
13
|
+
|
|
14
|
+
// TODO(wittjosiah): Factor out. This is `DxGridAxis` from `@dxos/react-ui-grid`.
|
|
15
|
+
const Axis = Schema.Union(Schema.Literal('row'), Schema.Literal('col'));
|
|
16
|
+
|
|
17
|
+
export const InsertAxis = Operation.make({
|
|
18
|
+
meta: { key: `${SHEET_OPERATION}.axis-insert`, name: 'Insert Axis' },
|
|
19
|
+
input: Schema.Struct({
|
|
20
|
+
model: Schema.Any,
|
|
21
|
+
axis: Axis,
|
|
22
|
+
index: Schema.Number,
|
|
23
|
+
count: Schema.optional(Schema.Number),
|
|
24
|
+
}),
|
|
25
|
+
output: Schema.Void,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export const DropAxisOutput = Schema.Struct({
|
|
29
|
+
axis: Axis.annotations({ description: 'The axis type (row or col).' }),
|
|
30
|
+
axisIndex: Schema.String.annotations({ description: 'The dropped axis index.' }),
|
|
31
|
+
index: Schema.Number.annotations({ description: 'The position the axis was at.' }),
|
|
32
|
+
axisMeta: Schema.Any.annotations({ description: 'The row/column metadata.' }),
|
|
33
|
+
values: Schema.Array(Schema.Any).annotations({ description: 'The cell values that were dropped.' }),
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export type DropAxisOutput = Schema.Schema.Type<typeof DropAxisOutput>;
|
|
37
|
+
|
|
38
|
+
export const DropAxis = Operation.make({
|
|
39
|
+
meta: { key: `${SHEET_OPERATION}.axis-drop`, name: 'Drop Axis' },
|
|
40
|
+
input: Schema.Struct({
|
|
41
|
+
model: Schema.Any,
|
|
42
|
+
axis: Axis,
|
|
43
|
+
axisIndex: Schema.String,
|
|
44
|
+
}),
|
|
45
|
+
output: DropAxisOutput,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export const ScrollToAnchor = Operation.make({
|
|
49
|
+
meta: { key: `${SHEET_OPERATION}.scroll-to-anchor`, name: 'Scroll To Anchor' },
|
|
50
|
+
services: [Capability.Service],
|
|
51
|
+
input: Schema.Struct({
|
|
52
|
+
subject: Schema.String.annotations({ description: 'Attendable ID of the sheet.' }),
|
|
53
|
+
cursor: Schema.String.annotations({ description: 'Cell range coordinates.' }),
|
|
54
|
+
ref: Schema.optional(Schema.Any.annotations({ description: 'Active refs for highlighting.' })),
|
|
55
|
+
}),
|
|
56
|
+
output: Schema.Void,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Restore a dropped axis (inverse of DropAxis).
|
|
61
|
+
*/
|
|
62
|
+
export const RestoreAxis = Operation.make({
|
|
63
|
+
meta: { key: `${SHEET_OPERATION}.restore-axis`, name: 'Restore Axis' },
|
|
64
|
+
input: Schema.Struct({
|
|
65
|
+
model: Schema.Any.annotations({ description: 'The sheet model.' }),
|
|
66
|
+
axis: Axis.annotations({ description: 'The axis type (row or col).' }),
|
|
67
|
+
axisIndex: Schema.String.annotations({ description: 'The axis index to restore.' }),
|
|
68
|
+
index: Schema.Number.annotations({ description: 'The position to restore at.' }),
|
|
69
|
+
axisMeta: Schema.Any.annotations({ description: 'The row/column metadata.' }),
|
|
70
|
+
values: Schema.Array(Schema.Any).annotations({ description: 'The cell values to restore.' }),
|
|
71
|
+
}),
|
|
72
|
+
output: Schema.Void,
|
|
73
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Operation } from '@dxos/compute';
|
|
8
|
+
|
|
9
|
+
import { DropAxis } from './definitions';
|
|
10
|
+
|
|
11
|
+
const handler: Operation.WithHandler<typeof DropAxis> = DropAxis.pipe(
|
|
12
|
+
Operation.withHandler(({ model, axis, axisIndex }) =>
|
|
13
|
+
Effect.sync(() => {
|
|
14
|
+
const undoData = model[axis === 'col' ? 'dropColumn' : 'dropRow'](axisIndex);
|
|
15
|
+
return {
|
|
16
|
+
axis: undoData.axis,
|
|
17
|
+
axisIndex: undoData.axisIndex,
|
|
18
|
+
index: undoData.index,
|
|
19
|
+
axisMeta: undoData.axisMeta,
|
|
20
|
+
values: undoData.values,
|
|
21
|
+
};
|
|
22
|
+
}),
|
|
23
|
+
),
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export default handler;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { OperationHandlerSet } from '@dxos/compute';
|
|
6
|
+
|
|
7
|
+
export * as SheetOperation from './definitions';
|
|
8
|
+
|
|
9
|
+
export const SheetOperationHandlerSet = OperationHandlerSet.lazy(
|
|
10
|
+
() => import('./drop-axis'),
|
|
11
|
+
() => import('./insert-axis'),
|
|
12
|
+
() => import('./restore-axis'),
|
|
13
|
+
() => import('./scroll-to-anchor'),
|
|
14
|
+
);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Operation } from '@dxos/compute';
|
|
8
|
+
|
|
9
|
+
import { InsertAxis } from './definitions';
|
|
10
|
+
|
|
11
|
+
const handler: Operation.WithHandler<typeof InsertAxis> = InsertAxis.pipe(
|
|
12
|
+
Operation.withHandler(({ model, axis, index, count }) =>
|
|
13
|
+
Effect.sync(() => {
|
|
14
|
+
model[axis === 'col' ? 'insertColumns' : 'insertRows'](index, count);
|
|
15
|
+
}),
|
|
16
|
+
),
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
export default handler;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Operation } from '@dxos/compute';
|
|
8
|
+
|
|
9
|
+
import { RestoreAxis } from './definitions';
|
|
10
|
+
|
|
11
|
+
const handler: Operation.WithHandler<typeof RestoreAxis> = RestoreAxis.pipe(
|
|
12
|
+
Operation.withHandler(({ model, axis, ...restoreData }) =>
|
|
13
|
+
Effect.sync(() => {
|
|
14
|
+
model[axis === 'col' ? 'restoreColumn' : 'restoreRow'](restoreData);
|
|
15
|
+
}),
|
|
16
|
+
),
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
export default handler;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { Operation } from '@dxos/compute';
|
|
9
|
+
|
|
10
|
+
import { parseThreadAnchorAsCellRange } from '../integrations/thread-ranges';
|
|
11
|
+
import { SheetCapabilities } from '../types';
|
|
12
|
+
import { ScrollToAnchor } from './definitions';
|
|
13
|
+
|
|
14
|
+
const handler: Operation.WithHandler<typeof ScrollToAnchor> = ScrollToAnchor.pipe(
|
|
15
|
+
Operation.withHandler(
|
|
16
|
+
Effect.fnUntraced(function* ({ subject, cursor, ref }) {
|
|
17
|
+
const gridInstances = yield* Capability.get(SheetCapabilities.GridInstances);
|
|
18
|
+
const entry = gridInstances.get(subject);
|
|
19
|
+
if (!entry) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
entry.setActiveRefs(ref);
|
|
23
|
+
const range = parseThreadAnchorAsCellRange(cursor);
|
|
24
|
+
if (range) {
|
|
25
|
+
entry.grid.setFocus({ ...range.to, plane: 'grid' }, true);
|
|
26
|
+
}
|
|
27
|
+
}),
|
|
28
|
+
),
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
export default handler;
|
|
@@ -10,7 +10,7 @@ export default defineConfig({
|
|
|
10
10
|
...e2ePreset(import.meta.dirname),
|
|
11
11
|
// TODO(wittjosiah): Avoid hard-coding ports.
|
|
12
12
|
webServer: {
|
|
13
|
-
command: '
|
|
13
|
+
command: 'pnpm storybook dev --ci --quiet --port=9005 --config-dir=.storybook',
|
|
14
14
|
port: 9005,
|
|
15
15
|
reuseExistingServer: false,
|
|
16
16
|
},
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Page, expect, test } from '@playwright/test';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { random } from '@dxos/random';
|
|
8
8
|
import { setupPage, storybookUrl } from '@dxos/test-utils/playwright';
|
|
9
9
|
|
|
10
10
|
import { SheetManager } from './sheet-manager';
|
|
@@ -15,7 +15,7 @@ test.describe('plugin-sheet', () => {
|
|
|
15
15
|
|
|
16
16
|
test.beforeEach(async ({ browser }) => {
|
|
17
17
|
const setup = await setupPage(browser, {
|
|
18
|
-
url: storybookUrl('plugins-plugin-sheet-sheetcontainer--spec', 9005),
|
|
18
|
+
url: storybookUrl('plugins-plugin-sheet-containers-sheetcontainer--spec', 9005),
|
|
19
19
|
viewportSize: { width: 1280, height: 720 },
|
|
20
20
|
});
|
|
21
21
|
page = setup.page;
|
|
@@ -39,7 +39,7 @@ test.describe('plugin-sheet', () => {
|
|
|
39
39
|
// Confirm editor displays
|
|
40
40
|
await expect(sheet.cellEditor()).toBeVisible();
|
|
41
41
|
// Type in a value and press enter
|
|
42
|
-
const testString =
|
|
42
|
+
const testString = random.string.uuid();
|
|
43
43
|
await sheet.setFocusedCellValue(testString, 'Enter');
|
|
44
44
|
// Expect that value to now show in the grid
|
|
45
45
|
await expect(sheet.cellByText(testString)).toBeVisible();
|