@dxos/plugin-sheet 0.8.4-main.72ec0f3 → 0.8.4-main.7996785055
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/RangeList-RRNK4LL5.mjs +50 -0
- package/dist/lib/browser/RangeList-RRNK4LL5.mjs.map +7 -0
- package/dist/lib/browser/SheetContainer-N7GPNSOM.mjs +44 -0
- package/dist/lib/browser/SheetContainer-N7GPNSOM.mjs.map +7 -0
- package/dist/lib/browser/{anchor-sort-FCQ5OZZK.mjs → anchor-sort-J4Y5NKYR.mjs} +9 -7
- package/dist/lib/browser/anchor-sort-J4Y5NKYR.mjs.map +7 -0
- package/dist/lib/browser/chunk-AIOU5OTJ.mjs +118 -0
- package/dist/lib/browser/chunk-AIOU5OTJ.mjs.map +7 -0
- package/dist/lib/browser/chunk-BZEV7AQM.mjs +278 -0
- package/dist/lib/browser/chunk-BZEV7AQM.mjs.map +7 -0
- package/dist/lib/browser/{chunk-FWFAAGXL.mjs → chunk-MFMDZ433.mjs} +2 -2
- package/dist/lib/browser/chunk-MFMDZ433.mjs.map +7 -0
- package/dist/lib/browser/{chunk-7VEWYJJN.mjs → chunk-NNWF7EKC.mjs} +13 -13
- package/dist/lib/browser/chunk-NNWF7EKC.mjs.map +7 -0
- package/dist/lib/browser/chunk-T5XHKC7L.mjs +1771 -0
- package/dist/lib/browser/chunk-T5XHKC7L.mjs.map +7 -0
- package/dist/lib/browser/chunk-UZ4SHAES.mjs +8 -0
- package/dist/lib/browser/chunk-UZ4SHAES.mjs.map +7 -0
- package/dist/lib/browser/compute-graph-registry-FEG3DN5R.mjs +22 -0
- package/dist/lib/browser/compute-graph-registry-FEG3DN5R.mjs.map +7 -0
- package/dist/lib/browser/drop-axis-UTOJ5MVT.mjs +23 -0
- package/dist/lib/browser/drop-axis-UTOJ5MVT.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +94 -76
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/insert-axis-OS5VFQDK.mjs +16 -0
- package/dist/lib/browser/insert-axis-OS5VFQDK.mjs.map +7 -0
- package/dist/lib/browser/markdown-ZDM2HMK6.mjs +30 -0
- package/dist/lib/browser/markdown-ZDM2HMK6.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-handler-5PGGEH6O.mjs +16 -0
- package/dist/lib/browser/operation-handler-5PGGEH6O.mjs.map +7 -0
- package/dist/lib/browser/operations/index.mjs +12 -0
- package/dist/lib/browser/operations/index.mjs.map +7 -0
- package/dist/lib/browser/react-surface-7LK375A6.mjs +54 -0
- package/dist/lib/browser/react-surface-7LK375A6.mjs.map +7 -0
- package/dist/lib/browser/restore-axis-O7PHU7ON.mjs +16 -0
- package/dist/lib/browser/restore-axis-O7PHU7ON.mjs.map +7 -0
- package/dist/lib/browser/scroll-to-anchor-HNCUXJGW.mjs +37 -0
- package/dist/lib/browser/scroll-to-anchor-HNCUXJGW.mjs.map +7 -0
- package/dist/lib/browser/state-35W4C372.mjs +31 -0
- package/dist/lib/browser/state-35W4C372.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +4 -2
- package/dist/lib/browser/undo-mappings-GTX6XUZK.mjs +35 -0
- package/dist/lib/browser/undo-mappings-GTX6XUZK.mjs.map +7 -0
- package/dist/lib/node-esm/RangeList-X6IU5QKI.mjs +51 -0
- package/dist/lib/node-esm/RangeList-X6IU5QKI.mjs.map +7 -0
- package/dist/lib/node-esm/SheetContainer-QFRHGZZE.mjs +45 -0
- package/dist/lib/node-esm/SheetContainer-QFRHGZZE.mjs.map +7 -0
- package/dist/lib/node-esm/{anchor-sort-ZE7IS7SH.mjs → anchor-sort-XLGKHSB4.mjs} +9 -7
- package/dist/lib/node-esm/anchor-sort-XLGKHSB4.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HI3E7P4K.mjs +10 -0
- package/dist/lib/node-esm/chunk-HI3E7P4K.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-J7XCAKTA.mjs +279 -0
- package/dist/lib/node-esm/chunk-J7XCAKTA.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-4QV4AGWK.mjs → chunk-M52YLLWU.mjs} +13 -13
- package/dist/lib/node-esm/chunk-M52YLLWU.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-PK76XIMN.mjs +1772 -0
- package/dist/lib/node-esm/chunk-PK76XIMN.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-HILDMVPL.mjs → chunk-UMXU7BDG.mjs} +2 -2
- package/dist/lib/node-esm/chunk-UMXU7BDG.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-Z4BXHF76.mjs +119 -0
- package/dist/lib/node-esm/chunk-Z4BXHF76.mjs.map +7 -0
- package/dist/lib/node-esm/compute-graph-registry-TOMM5AGM.mjs +23 -0
- package/dist/lib/node-esm/compute-graph-registry-TOMM5AGM.mjs.map +7 -0
- package/dist/lib/node-esm/drop-axis-XFFTKE4J.mjs +24 -0
- package/dist/lib/node-esm/drop-axis-XFFTKE4J.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +94 -76
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/insert-axis-QYN6V3NH.mjs +17 -0
- package/dist/lib/node-esm/insert-axis-QYN6V3NH.mjs.map +7 -0
- package/dist/lib/node-esm/markdown-TTSQDUPW.mjs +31 -0
- package/dist/lib/node-esm/markdown-TTSQDUPW.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operation-handler-G6SZSFCD.mjs +17 -0
- package/dist/lib/node-esm/operation-handler-G6SZSFCD.mjs.map +7 -0
- package/dist/lib/node-esm/operations/index.mjs +13 -0
- package/dist/lib/node-esm/operations/index.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-OVBFWYD7.mjs +55 -0
- package/dist/lib/node-esm/react-surface-OVBFWYD7.mjs.map +7 -0
- package/dist/lib/node-esm/restore-axis-WUXX5KAE.mjs +17 -0
- package/dist/lib/node-esm/restore-axis-WUXX5KAE.mjs.map +7 -0
- package/dist/lib/node-esm/scroll-to-anchor-UUXINUVP.mjs +38 -0
- package/dist/lib/node-esm/scroll-to-anchor-UUXINUVP.mjs.map +7 -0
- package/dist/lib/node-esm/state-L3SAQ6V7.mjs +32 -0
- package/dist/lib/node-esm/state-L3SAQ6V7.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +4 -2
- package/dist/lib/node-esm/undo-mappings-CQIVZKAC.mjs +36 -0
- package/dist/lib/node-esm/undo-mappings-CQIVZKAC.mjs.map +7 -0
- package/dist/types/src/SheetPlugin.d.ts +2 -1
- package/dist/types/src/SheetPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/anchor-sort/anchor-sort.d.ts +6 -0
- package/dist/types/src/capabilities/anchor-sort/anchor-sort.d.ts.map +1 -0
- package/dist/types/src/capabilities/anchor-sort/index.d.ts +3 -0
- package/dist/types/src/capabilities/anchor-sort/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/compute-graph-registry/compute-graph-registry.d.ts +5 -0
- package/dist/types/src/capabilities/compute-graph-registry/compute-graph-registry.d.ts.map +1 -0
- package/dist/types/src/capabilities/compute-graph-registry/index.d.ts +3 -0
- package/dist/types/src/capabilities/compute-graph-registry/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +7 -6
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/markdown/index.d.ts +3 -0
- package/dist/types/src/capabilities/markdown/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/markdown/markdown.d.ts +5 -0
- package/dist/types/src/capabilities/markdown/markdown.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler/index.d.ts +4 -0
- package/dist/types/src/capabilities/operation-handler/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/index.d.ts +3 -0
- package/dist/types/src/capabilities/state/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/state.d.ts +6 -0
- package/dist/types/src/capabilities/state/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/undo-mappings/index.d.ts +3 -0
- package/dist/types/src/capabilities/undo-mappings/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/undo-mappings/undo-mappings.d.ts +5 -0
- package/dist/types/src/capabilities/undo-mappings/undo-mappings.d.ts.map +1 -0
- package/dist/types/src/components/ComputeGraph/compute-graph.stories.d.ts.map +1 -1
- package/dist/types/src/components/Sheet/Sheet.d.ts +29 -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/{GridSheet → SheetContent}/SheetCellEditor.stories.d.ts +1 -1
- package/dist/types/src/components/SheetContent/SheetCellEditor.stories.d.ts.map +1 -0
- package/dist/types/src/components/SheetContent/SheetContent.d.ts +10 -0
- package/dist/types/src/components/SheetContent/SheetContent.d.ts.map +1 -0
- package/dist/types/src/components/{GridSheet/GridSheet.stories.d.ts → SheetContent/SheetContent.stories.d.ts} +10 -2
- 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/SheetContent/util.d.ts.map +1 -0
- package/dist/types/src/components/{SheetContext/SheetContext.d.ts → SheetRoot/SheetRoot.d.ts} +6 -4
- 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 +10 -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 +9 -5
- package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts +4 -0
- package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/align.d.ts +12 -19
- package/dist/types/src/components/SheetToolbar/align.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/style.d.ts +12 -18
- package/dist/types/src/components/SheetToolbar/style.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/useToolbarState.d.ts +14 -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.map +1 -1
- package/dist/types/src/containers/RangeList/index.d.ts +3 -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/{components → containers}/SheetContainer/SheetContainer.stories.d.ts +3 -1
- package/dist/types/src/containers/SheetContainer/SheetContainer.stories.d.ts.map +1 -0
- package/dist/types/src/{components → containers}/SheetContainer/index.d.ts.map +1 -1
- 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.stories.d.ts.map +1 -1
- package/dist/types/src/extensions/editor/sheet-extension.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/integrations/thread-ranges.d.ts +0 -2
- package/dist/types/src/integrations/thread-ranges.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.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/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/serializer.d.ts.map +1 -1
- package/dist/types/src/testing/testing.d.ts +15 -15
- package/dist/types/src/translations.d.ts +2 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Sheet.d.ts +41 -35
- package/dist/types/src/types/Sheet.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +18 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +1 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +2 -68
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/types/util.d.ts +2 -1
- package/dist/types/src/types/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +83 -68
- package/src/SheetPlugin.tsx +59 -64
- package/src/capabilities/anchor-sort/anchor-sort.ts +27 -0
- package/src/capabilities/anchor-sort/index.ts +7 -0
- package/src/capabilities/compute-graph-registry/compute-graph-registry.ts +27 -0
- package/src/capabilities/compute-graph-registry/index.ts +7 -0
- package/src/capabilities/index.ts +7 -9
- package/src/capabilities/markdown/index.ts +7 -0
- package/src/capabilities/markdown/markdown.ts +30 -0
- package/src/capabilities/operation-handler/index.ts +11 -0
- package/src/capabilities/operation-handler/operation-handler.ts +16 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +49 -0
- package/src/capabilities/state/index.ts +7 -0
- package/src/capabilities/state/state.ts +29 -0
- package/src/capabilities/undo-mappings/index.ts +7 -0
- package/src/capabilities/undo-mappings/undo-mappings.ts +30 -0
- package/src/components/ComputeGraph/compute-graph.stories.tsx +11 -6
- package/src/components/Sheet/Sheet.tsx +20 -0
- package/src/components/Sheet/index.ts +5 -0
- package/src/components/{GridSheet → SheetContent}/SheetCellEditor.stories.tsx +9 -6
- package/src/components/{GridSheet/GridSheet.stories.tsx → SheetContent/SheetContent.stories.tsx} +14 -13
- package/src/components/{GridSheet/GridSheet.tsx → SheetContent/SheetContent.tsx} +62 -44
- package/src/components/{RangeList → SheetContent}/index.ts +1 -1
- package/src/components/{GridSheet → SheetContent}/util.ts +5 -5
- package/src/components/{SheetContext/SheetContext.tsx → SheetRoot/SheetRoot.tsx} +47 -40
- package/src/components/{GridSheet → SheetRoot}/index.ts +1 -1
- package/src/components/{FunctionEditor/FunctionEditor.tsx → SheetStatusbar/SheetStatusbar.tsx} +18 -6
- package/src/components/{FunctionEditor → SheetStatusbar}/index.ts +1 -1
- package/src/components/SheetToolbar/SheetToolbar.stories.tsx +4 -4
- package/src/components/SheetToolbar/SheetToolbar.tsx +45 -37
- package/src/components/SheetToolbar/align.ts +44 -19
- package/src/components/SheetToolbar/style.ts +48 -18
- package/src/components/SheetToolbar/useToolbarState.ts +22 -5
- package/src/components/index.ts +1 -7
- package/src/{components → containers}/RangeList/RangeList.tsx +12 -8
- package/src/containers/RangeList/index.ts +7 -0
- package/src/containers/SheetContainer/SheetContainer.stories.tsx +109 -0
- package/src/containers/SheetContainer/SheetContainer.tsx +57 -0
- package/src/{components → containers}/SheetContainer/index.ts +1 -1
- package/src/containers/index.ts +8 -0
- package/src/extensions/compute.stories.tsx +26 -16
- package/src/extensions/compute.ts +1 -1
- package/src/extensions/editor/sheet-extension.ts +16 -13
- package/src/index.ts +1 -1
- package/src/integrations/thread-ranges.ts +16 -53
- package/src/meta.ts +3 -3
- package/src/model/sheet-model.test.ts +2 -2
- package/src/model/sheet-model.ts +77 -45
- 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 +2 -1
- package/src/sanity.test.ts +6 -3
- package/src/serializer.ts +1 -1
- package/src/translations.ts +2 -0
- package/src/types/Sheet.ts +31 -31
- package/src/types/capabilities.ts +26 -0
- package/src/types/index.ts +1 -0
- package/src/types/sheet-range-types.ts +3 -3
- package/src/types/types.ts +4 -40
- package/src/types/util.ts +2 -1
- package/dist/lib/browser/SheetContainer-66BNB3XG.mjs +0 -349
- package/dist/lib/browser/SheetContainer-66BNB3XG.mjs.map +0 -7
- package/dist/lib/browser/anchor-sort-FCQ5OZZK.mjs.map +0 -7
- package/dist/lib/browser/chunk-73AV3NH6.mjs +0 -15
- package/dist/lib/browser/chunk-73AV3NH6.mjs.map +0 -7
- package/dist/lib/browser/chunk-7VEWYJJN.mjs.map +0 -7
- package/dist/lib/browser/chunk-DVJ3QW3F.mjs +0 -907
- package/dist/lib/browser/chunk-DVJ3QW3F.mjs.map +0 -7
- package/dist/lib/browser/chunk-FWFAAGXL.mjs.map +0 -7
- package/dist/lib/browser/chunk-OU5KTWY3.mjs +0 -852
- package/dist/lib/browser/chunk-OU5KTWY3.mjs.map +0 -7
- package/dist/lib/browser/compute-graph-registry-AP5RA7W3.mjs +0 -21
- package/dist/lib/browser/compute-graph-registry-AP5RA7W3.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-66OAYVQF.mjs +0 -56
- package/dist/lib/browser/intent-resolver-66OAYVQF.mjs.map +0 -7
- package/dist/lib/browser/markdown-B6VKYY2S.mjs +0 -26
- package/dist/lib/browser/markdown-B6VKYY2S.mjs.map +0 -7
- package/dist/lib/browser/react-surface-5GYLVSMR.mjs +0 -54
- package/dist/lib/browser/react-surface-5GYLVSMR.mjs.map +0 -7
- package/dist/lib/node-esm/SheetContainer-NWEQETAY.mjs +0 -350
- package/dist/lib/node-esm/SheetContainer-NWEQETAY.mjs.map +0 -7
- package/dist/lib/node-esm/anchor-sort-ZE7IS7SH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-44YTKTMP.mjs +0 -16
- package/dist/lib/node-esm/chunk-44YTKTMP.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4H2EHVWE.mjs +0 -908
- package/dist/lib/node-esm/chunk-4H2EHVWE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4MT3JJU2.mjs +0 -853
- package/dist/lib/node-esm/chunk-4MT3JJU2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4QV4AGWK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HILDMVPL.mjs.map +0 -7
- package/dist/lib/node-esm/compute-graph-registry-UMQ5UYCL.mjs +0 -22
- package/dist/lib/node-esm/compute-graph-registry-UMQ5UYCL.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-VNKIMQQT.mjs +0 -57
- package/dist/lib/node-esm/intent-resolver-VNKIMQQT.mjs.map +0 -7
- package/dist/lib/node-esm/markdown-VKY7HXU2.mjs +0 -27
- package/dist/lib/node-esm/markdown-VKY7HXU2.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-RK32YZWR.mjs +0 -55
- package/dist/lib/node-esm/react-surface-RK32YZWR.mjs.map +0 -7
- package/dist/types/src/capabilities/anchor-sort.d.ts +0 -4
- package/dist/types/src/capabilities/anchor-sort.d.ts.map +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -5
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/compute-graph-registry.d.ts +0 -4
- package/dist/types/src/capabilities/compute-graph-registry.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/markdown.d.ts +0 -4
- package/dist/types/src/capabilities/markdown.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/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.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/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 -11
- package/dist/types/src/components/SheetContainer/SheetContainer.d.ts.map +0 -1
- package/dist/types/src/components/SheetContainer/SheetContainer.stories.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.ts +0 -21
- package/src/capabilities/capabilities.ts +0 -14
- package/src/capabilities/compute-graph-registry.ts +0 -23
- package/src/capabilities/intent-resolver.ts +0 -38
- package/src/capabilities/markdown.ts +0 -23
- package/src/capabilities/react-surface.tsx +0 -41
- package/src/components/SheetContainer/SheetContainer.stories.tsx +0 -93
- package/src/components/SheetContainer/SheetContainer.tsx +0 -41
- package/src/components/SheetContext/index.ts +0 -5
- /package/dist/types/src/components/{GridSheet → SheetContent}/util.d.ts +0 -0
- /package/dist/types/src/{components → containers}/RangeList/RangeList.d.ts +0 -0
- /package/dist/types/src/{components → containers}/SheetContainer/index.d.ts +0 -0
|
@@ -2,36 +2,41 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Atom } from '@effect-atom/atom-react';
|
|
6
|
-
import React, {
|
|
5
|
+
import { Atom, type Registry, RegistryContext } from '@effect-atom/atom-react';
|
|
6
|
+
import React, { useContext, useMemo } from 'react';
|
|
7
7
|
|
|
8
|
-
import { useAppGraph } from '@dxos/app-
|
|
8
|
+
import { useAppGraph } from '@dxos/app-toolkit/ui';
|
|
9
9
|
import { type CompleteCellRange } from '@dxos/compute';
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
MenuProvider,
|
|
13
|
-
ToolbarMenu,
|
|
14
|
-
atomFromSignal,
|
|
15
|
-
createGapSeparator,
|
|
16
|
-
useMenuActions,
|
|
17
|
-
} from '@dxos/react-ui-menu';
|
|
10
|
+
import { type ActionGraphProps, Menu, createGapSeparator, useMenuActions } from '@dxos/react-ui-menu';
|
|
11
|
+
import { composable, composableProps } from '@dxos/ui-theme';
|
|
18
12
|
|
|
19
13
|
import { type SheetModel } from '../../model';
|
|
20
|
-
import { useSheetContext } from '../
|
|
14
|
+
import { useSheetContext } from '../SheetRoot';
|
|
21
15
|
|
|
22
16
|
import { createAlign, useAlignState } from './align';
|
|
23
17
|
import { createStyle, useStyleState } from './style';
|
|
24
|
-
import { type
|
|
18
|
+
import { type ToolbarStateAtom, useToolbarState } from './useToolbarState';
|
|
25
19
|
|
|
26
|
-
|
|
27
|
-
model: SheetModel
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
type ToolbarActionsContext = {
|
|
21
|
+
model: SheetModel;
|
|
22
|
+
stateAtom: ToolbarStateAtom;
|
|
23
|
+
registry: Registry.Registry;
|
|
24
|
+
cursorFallbackRange?: CompleteCellRange;
|
|
25
|
+
customActions?: Atom.Atom<ActionGraphProps>;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const createToolbarActions = ({
|
|
29
|
+
model,
|
|
30
|
+
stateAtom,
|
|
31
|
+
registry,
|
|
32
|
+
cursorFallbackRange,
|
|
33
|
+
customActions,
|
|
34
|
+
}: ToolbarActionsContext): Atom.Atom<ActionGraphProps> => {
|
|
32
35
|
return Atom.make((get) => {
|
|
33
|
-
const
|
|
34
|
-
const
|
|
36
|
+
const state = get(stateAtom);
|
|
37
|
+
const context = { model, state, stateAtom, registry, cursorFallbackRange };
|
|
38
|
+
const align = createAlign(context);
|
|
39
|
+
const style = createStyle(context);
|
|
35
40
|
const gap = createGapSeparator();
|
|
36
41
|
|
|
37
42
|
const graph: ActionGraphProps = {
|
|
@@ -49,35 +54,38 @@ const createToolbarActions = (
|
|
|
49
54
|
});
|
|
50
55
|
};
|
|
51
56
|
|
|
52
|
-
export type SheetToolbarProps =
|
|
57
|
+
export type SheetToolbarProps = {};
|
|
53
58
|
|
|
54
|
-
export const SheetToolbar = (
|
|
55
|
-
const { model, cursorFallbackRange } = useSheetContext();
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
export const SheetToolbar = composable<HTMLDivElement, SheetToolbarProps>((props, forwardedRef) => {
|
|
60
|
+
const { attendableId, model, cursorFallbackRange } = useSheetContext();
|
|
61
|
+
const stateAtom = useToolbarState({});
|
|
62
|
+
const registry = useContext(RegistryContext);
|
|
63
|
+
useAlignState(stateAtom);
|
|
64
|
+
useStyleState(stateAtom);
|
|
59
65
|
|
|
60
66
|
const { graph } = useAppGraph();
|
|
61
67
|
const customActions = useMemo(() => {
|
|
62
68
|
return Atom.make((get) => {
|
|
63
|
-
const actions = get(graph.actions(
|
|
69
|
+
const actions = get(graph.actions(attendableId));
|
|
64
70
|
const nodes = actions.filter((action) => action.properties.disposition === 'toolbar');
|
|
65
71
|
return {
|
|
66
72
|
nodes,
|
|
67
|
-
edges: nodes.map((node) => ({ source: 'root', target: node.id })),
|
|
73
|
+
edges: nodes.map((node) => ({ source: 'root', target: node.id, relation: 'child' })),
|
|
68
74
|
};
|
|
69
75
|
});
|
|
70
|
-
}, [graph]);
|
|
76
|
+
}, [graph, attendableId]);
|
|
71
77
|
|
|
72
78
|
const actionsCreator = useMemo(
|
|
73
|
-
() => createToolbarActions(model,
|
|
74
|
-
[model,
|
|
79
|
+
() => createToolbarActions({ model, stateAtom, registry, cursorFallbackRange, customActions }),
|
|
80
|
+
[model, stateAtom, registry, cursorFallbackRange, customActions],
|
|
75
81
|
);
|
|
76
|
-
const
|
|
82
|
+
const menuActions = useMenuActions(actionsCreator);
|
|
77
83
|
|
|
78
84
|
return (
|
|
79
|
-
<
|
|
80
|
-
<
|
|
81
|
-
</
|
|
85
|
+
<Menu.Root {...menuActions} attendableId={attendableId}>
|
|
86
|
+
<Menu.Toolbar {...composableProps(props)} ref={forwardedRef} />
|
|
87
|
+
</Menu.Root>
|
|
82
88
|
);
|
|
83
|
-
};
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
SheetToolbar.displayName = 'SheetToolbar';
|
|
@@ -2,17 +2,24 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { type Registry, RegistryContext } from '@effect-atom/atom-react';
|
|
6
|
+
import { useContext, useEffect } from 'react';
|
|
6
7
|
|
|
7
8
|
import { type CompleteCellRange, inRange } from '@dxos/compute';
|
|
8
|
-
import {
|
|
9
|
+
import { Obj } from '@dxos/echo';
|
|
10
|
+
import {
|
|
11
|
+
type ActionGraphProps,
|
|
12
|
+
type ToolbarMenuActionGroupProperties,
|
|
13
|
+
createMenuAction,
|
|
14
|
+
createMenuItemGroup,
|
|
15
|
+
} from '@dxos/react-ui-menu';
|
|
9
16
|
|
|
10
17
|
import { meta } from '../../meta';
|
|
11
18
|
import { type SheetModel } from '../../model';
|
|
12
19
|
import { type AlignKey, type AlignValue, alignKey, rangeFromIndex, rangeToIndex } from '../../types';
|
|
13
|
-
import { useSheetContext } from '../
|
|
20
|
+
import { useSheetContext } from '../SheetRoot';
|
|
14
21
|
|
|
15
|
-
import { type ToolbarState } from './useToolbarState';
|
|
22
|
+
import { type ToolbarState, type ToolbarStateAtom } from './useToolbarState';
|
|
16
23
|
|
|
17
24
|
export type AlignAction = { key: AlignKey; value: AlignValue };
|
|
18
25
|
|
|
@@ -24,18 +31,21 @@ const aligns: Record<AlignValue, string> = {
|
|
|
24
31
|
end: 'ph--text-align-right--regular',
|
|
25
32
|
};
|
|
26
33
|
|
|
27
|
-
export const useAlignState = (
|
|
34
|
+
export const useAlignState = (stateAtom: ToolbarStateAtom) => {
|
|
35
|
+
const registry = useContext(RegistryContext);
|
|
28
36
|
const { cursor, model } = useSheetContext();
|
|
29
37
|
useEffect(() => {
|
|
30
38
|
// TODO(thure): Can this O(n) call be memoized?
|
|
31
|
-
|
|
39
|
+
const alignValue = (
|
|
32
40
|
cursor
|
|
33
41
|
? model.sheet.ranges?.findLast(
|
|
34
42
|
({ range, key }) => key === alignKey && inRange(rangeFromIndex(model.sheet, range), cursor),
|
|
35
43
|
)?.value
|
|
36
44
|
: undefined
|
|
37
45
|
) as AlignValue | undefined;
|
|
38
|
-
|
|
46
|
+
const prev = registry.get(stateAtom);
|
|
47
|
+
registry.set(stateAtom, { ...prev, [alignKey]: alignValue });
|
|
48
|
+
}, [cursor, model.sheet, registry, stateAtom]);
|
|
39
49
|
};
|
|
40
50
|
|
|
41
51
|
const createAlignGroupAction = (value?: AlignValue) =>
|
|
@@ -46,7 +56,15 @@ const createAlignGroupAction = (value?: AlignValue) =>
|
|
|
46
56
|
value: `${alignKey}--${value}`,
|
|
47
57
|
} as ToolbarMenuActionGroupProperties);
|
|
48
58
|
|
|
49
|
-
|
|
59
|
+
type AlignActionsContext = {
|
|
60
|
+
model: SheetModel;
|
|
61
|
+
state: ToolbarState;
|
|
62
|
+
stateAtom: ToolbarStateAtom;
|
|
63
|
+
registry: Registry.Registry;
|
|
64
|
+
cursorFallbackRange?: CompleteCellRange;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const createAlignActions = ({ model, state, stateAtom, registry, cursorFallbackRange }: AlignActionsContext) =>
|
|
50
68
|
Object.entries(aligns).map(([alignValue, icon]) => {
|
|
51
69
|
return createMenuAction<AlignAction>(
|
|
52
70
|
`${alignKey}--${alignValue}`,
|
|
@@ -64,15 +82,22 @@ const createAlignActions = (model: SheetModel, state: ToolbarState, cursorFallba
|
|
|
64
82
|
key: alignKey,
|
|
65
83
|
value: alignValue as AlignValue,
|
|
66
84
|
};
|
|
85
|
+
const currentState = registry.get(stateAtom);
|
|
67
86
|
if (index < 0) {
|
|
68
|
-
model.sheet
|
|
69
|
-
|
|
87
|
+
Obj.change(model.sheet, (obj) => {
|
|
88
|
+
obj.ranges?.push(nextRangeEntity);
|
|
89
|
+
});
|
|
90
|
+
registry.set(stateAtom, { ...currentState, [alignKey]: nextRangeEntity.value });
|
|
70
91
|
} else if (model.sheet.ranges![index].value === nextRangeEntity.value) {
|
|
71
|
-
model.sheet
|
|
72
|
-
|
|
92
|
+
Obj.change(model.sheet, (obj) => {
|
|
93
|
+
obj.ranges?.splice(index, 1);
|
|
94
|
+
});
|
|
95
|
+
registry.set(stateAtom, { ...currentState, [alignKey]: undefined });
|
|
73
96
|
} else {
|
|
74
|
-
model.sheet
|
|
75
|
-
|
|
97
|
+
Obj.change(model.sheet, (obj) => {
|
|
98
|
+
obj.ranges?.splice(index, 1, nextRangeEntity);
|
|
99
|
+
});
|
|
100
|
+
registry.set(stateAtom, { ...currentState, [alignKey]: nextRangeEntity.value });
|
|
76
101
|
}
|
|
77
102
|
},
|
|
78
103
|
{
|
|
@@ -86,14 +111,14 @@ const createAlignActions = (model: SheetModel, state: ToolbarState, cursorFallba
|
|
|
86
111
|
);
|
|
87
112
|
});
|
|
88
113
|
|
|
89
|
-
export const createAlign = (
|
|
90
|
-
const alignGroup = createAlignGroupAction(state[alignKey]);
|
|
91
|
-
const alignActions = createAlignActions(
|
|
114
|
+
export const createAlign = (context: AlignActionsContext): ActionGraphProps => {
|
|
115
|
+
const alignGroup = createAlignGroupAction(context.state[alignKey]);
|
|
116
|
+
const alignActions = createAlignActions(context);
|
|
92
117
|
return {
|
|
93
118
|
nodes: [alignGroup, ...alignActions],
|
|
94
119
|
edges: [
|
|
95
|
-
{ source: 'root', target: 'align' },
|
|
96
|
-
...alignActions.map(({ id }) => ({ source: alignGroup.id, target: id })),
|
|
120
|
+
{ source: 'root', target: 'align', relation: 'child' },
|
|
121
|
+
...alignActions.map(({ id }) => ({ source: alignGroup.id, target: id, relation: 'child' })),
|
|
97
122
|
],
|
|
98
123
|
};
|
|
99
124
|
};
|
|
@@ -2,15 +2,24 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { type Registry, RegistryContext } from '@effect-atom/atom-react';
|
|
6
|
+
import { useContext, useEffect } from 'react';
|
|
6
7
|
|
|
7
8
|
import { type CompleteCellRange, inRange } from '@dxos/compute';
|
|
8
|
-
import {
|
|
9
|
+
import { Obj } from '@dxos/echo';
|
|
10
|
+
import {
|
|
11
|
+
type ActionGraphProps,
|
|
12
|
+
type ToolbarMenuActionGroupProperties,
|
|
13
|
+
createMenuAction,
|
|
14
|
+
createMenuItemGroup,
|
|
15
|
+
} from '@dxos/react-ui-menu';
|
|
9
16
|
|
|
10
17
|
import { meta } from '../../meta';
|
|
11
18
|
import { type SheetModel } from '../../model';
|
|
12
19
|
import { type StyleKey, type StyleValue, rangeFromIndex, rangeToIndex } from '../../types';
|
|
13
|
-
import { useSheetContext } from '../
|
|
20
|
+
import { useSheetContext } from '../SheetRoot';
|
|
21
|
+
|
|
22
|
+
import { type ToolbarState, type ToolbarStateAtom } from './useToolbarState';
|
|
14
23
|
|
|
15
24
|
export type StyleState = Partial<Record<StyleValue, boolean>>;
|
|
16
25
|
|
|
@@ -21,22 +30,30 @@ const styles: Record<StyleValue, string> = {
|
|
|
21
30
|
softwrap: 'ph--paragraph--regular',
|
|
22
31
|
};
|
|
23
32
|
|
|
24
|
-
export const useStyleState = (
|
|
33
|
+
export const useStyleState = (stateAtom: ToolbarStateAtom) => {
|
|
34
|
+
const registry = useContext(RegistryContext);
|
|
25
35
|
const { cursorFallbackRange, model } = useSheetContext();
|
|
26
36
|
|
|
27
37
|
useEffect(() => {
|
|
28
|
-
|
|
29
|
-
|
|
38
|
+
let highlight = false;
|
|
39
|
+
let softwrap = false;
|
|
30
40
|
if (cursorFallbackRange && model.sheet.ranges) {
|
|
31
41
|
model.sheet.ranges
|
|
32
42
|
.filter(
|
|
33
43
|
({ range, key }) => key === 'style' && inRange(rangeFromIndex(model.sheet, range), cursorFallbackRange.from),
|
|
34
44
|
)
|
|
35
45
|
.forEach(({ value }) => {
|
|
36
|
-
|
|
46
|
+
if (value === 'highlight') {
|
|
47
|
+
highlight = true;
|
|
48
|
+
}
|
|
49
|
+
if (value === 'softwrap') {
|
|
50
|
+
softwrap = true;
|
|
51
|
+
}
|
|
37
52
|
});
|
|
38
53
|
}
|
|
39
|
-
|
|
54
|
+
const prev = registry.get(stateAtom);
|
|
55
|
+
registry.set(stateAtom, { ...prev, highlight, softwrap });
|
|
56
|
+
}, [cursorFallbackRange, model.sheet, registry, stateAtom]);
|
|
40
57
|
};
|
|
41
58
|
|
|
42
59
|
const createStyleGroup = (state: StyleState) => {
|
|
@@ -49,7 +66,15 @@ const createStyleGroup = (state: StyleState) => {
|
|
|
49
66
|
} as ToolbarMenuActionGroupProperties);
|
|
50
67
|
};
|
|
51
68
|
|
|
52
|
-
|
|
69
|
+
type StyleActionsContext = {
|
|
70
|
+
model: SheetModel;
|
|
71
|
+
state: ToolbarState;
|
|
72
|
+
stateAtom: ToolbarStateAtom;
|
|
73
|
+
registry: Registry.Registry;
|
|
74
|
+
cursorFallbackRange?: CompleteCellRange;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const createStyleActions = ({ model, state, stateAtom, registry, cursorFallbackRange }: StyleActionsContext) =>
|
|
53
78
|
Object.entries(styles).map(([styleValue, icon]) => {
|
|
54
79
|
return createMenuAction<StyleAction>(
|
|
55
80
|
`style--${styleValue}`,
|
|
@@ -67,6 +92,7 @@ const createStyleActions = (model: SheetModel, state: StyleState, cursorFallback
|
|
|
67
92
|
key: 'style',
|
|
68
93
|
value: styleValue as StyleValue,
|
|
69
94
|
};
|
|
95
|
+
const currentState = registry.get(stateAtom);
|
|
70
96
|
if (
|
|
71
97
|
model.sheet.ranges
|
|
72
98
|
.filter(
|
|
@@ -77,12 +103,16 @@ const createStyleActions = (model: SheetModel, state: StyleState, cursorFallback
|
|
|
77
103
|
) {
|
|
78
104
|
// this value should be unset
|
|
79
105
|
if (index >= 0) {
|
|
80
|
-
model.sheet
|
|
106
|
+
Obj.change(model.sheet, (obj) => {
|
|
107
|
+
obj.ranges?.splice(index, 1);
|
|
108
|
+
});
|
|
81
109
|
}
|
|
82
|
-
|
|
110
|
+
registry.set(stateAtom, { ...currentState, [nextRangeEntity.value]: false });
|
|
83
111
|
} else {
|
|
84
|
-
model.sheet
|
|
85
|
-
|
|
112
|
+
Obj.change(model.sheet, (obj) => {
|
|
113
|
+
obj.ranges?.push(nextRangeEntity);
|
|
114
|
+
});
|
|
115
|
+
registry.set(stateAtom, { ...currentState, [nextRangeEntity.value]: true });
|
|
86
116
|
}
|
|
87
117
|
},
|
|
88
118
|
{
|
|
@@ -95,14 +125,14 @@ const createStyleActions = (model: SheetModel, state: StyleState, cursorFallback
|
|
|
95
125
|
);
|
|
96
126
|
});
|
|
97
127
|
|
|
98
|
-
export const createStyle = (
|
|
99
|
-
const styleGroupAction = createStyleGroup(state);
|
|
100
|
-
const styleActions = createStyleActions(
|
|
128
|
+
export const createStyle = (context: StyleActionsContext): ActionGraphProps => {
|
|
129
|
+
const styleGroupAction = createStyleGroup(context.state);
|
|
130
|
+
const styleActions = createStyleActions(context);
|
|
101
131
|
return {
|
|
102
132
|
nodes: [styleGroupAction, ...styleActions],
|
|
103
133
|
edges: [
|
|
104
|
-
{ source: 'root', target: 'style' },
|
|
105
|
-
...styleActions.map(({ id }) => ({ source: styleGroupAction.id, target: id })),
|
|
134
|
+
{ source: 'root', target: 'style', relation: 'child' },
|
|
135
|
+
...styleActions.map(({ id }) => ({ source: styleGroupAction.id, target: id, relation: 'child' })),
|
|
106
136
|
],
|
|
107
137
|
};
|
|
108
138
|
};
|
|
@@ -2,15 +2,32 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import { live } from '@dxos/live-object';
|
|
5
|
+
import { Atom, type Registry, RegistryContext, useAtomValue } from '@effect-atom/atom-react';
|
|
6
|
+
import { useContext, useMemo } from 'react';
|
|
8
7
|
|
|
9
8
|
import { type AlignState } from './align';
|
|
10
9
|
import { type StyleState } from './style';
|
|
11
10
|
|
|
12
11
|
export type ToolbarState = Partial<StyleState & AlignState>;
|
|
12
|
+
export type ToolbarStateAtom = Atom.Writable<ToolbarState>;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Creates a reactive toolbar state Atom.
|
|
16
|
+
*/
|
|
17
|
+
export const useToolbarState = (initialState: ToolbarState = {}): ToolbarStateAtom => {
|
|
18
|
+
return useMemo(() => Atom.make<ToolbarState>(initialState).pipe(Atom.keepAlive), []);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Hook to read the current toolbar state value.
|
|
23
|
+
*/
|
|
24
|
+
export const useToolbarStateValue = (stateAtom: ToolbarStateAtom): ToolbarState => {
|
|
25
|
+
return useAtomValue(stateAtom);
|
|
26
|
+
};
|
|
13
27
|
|
|
14
|
-
|
|
15
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Hook to get the registry for updating toolbar state.
|
|
30
|
+
*/
|
|
31
|
+
export const useToolbarStateRegistry = (): Registry.Registry => {
|
|
32
|
+
return useContext(RegistryContext);
|
|
16
33
|
};
|
package/src/components/index.ts
CHANGED
|
@@ -2,11 +2,5 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { lazy } from 'react';
|
|
6
|
-
|
|
7
5
|
export * from './ComputeGraph';
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './RangeList';
|
|
10
|
-
export * from './SheetContext';
|
|
11
|
-
|
|
12
|
-
export const SheetContainer = lazy(() => import('./SheetContainer'));
|
|
6
|
+
export * from './Sheet';
|
|
@@ -6,9 +6,9 @@ import * as Schema from 'effect/Schema';
|
|
|
6
6
|
import React, { useCallback } from 'react';
|
|
7
7
|
|
|
8
8
|
import { rangeToA1Notation } from '@dxos/compute';
|
|
9
|
-
import {
|
|
9
|
+
import { Obj } from '@dxos/echo';
|
|
10
|
+
import { Input, Message, useTranslation } from '@dxos/react-ui';
|
|
10
11
|
import { List } from '@dxos/react-ui-list';
|
|
11
|
-
import { ghostHover } from '@dxos/react-ui-theme';
|
|
12
12
|
|
|
13
13
|
import { meta } from '../../meta';
|
|
14
14
|
import { rangeFromIndex } from '../../types';
|
|
@@ -25,22 +25,26 @@ export const RangeList = ({ sheet }: RangeListProps) => {
|
|
|
25
25
|
const handleDeleteRange = useCallback(
|
|
26
26
|
(range: Sheet.Range) => {
|
|
27
27
|
const index = sheet.ranges.findIndex((sheetRange) => sheetRange === range);
|
|
28
|
-
|
|
28
|
+
Obj.change(sheet, (obj) => {
|
|
29
|
+
obj.ranges.splice(index, 1);
|
|
30
|
+
});
|
|
29
31
|
},
|
|
30
32
|
[sheet],
|
|
31
33
|
);
|
|
32
34
|
return (
|
|
33
35
|
<>
|
|
34
|
-
<
|
|
36
|
+
<Input.Root>
|
|
37
|
+
<Input.Label>{t('range list heading')}</Input.Label>
|
|
38
|
+
</Input.Root>
|
|
35
39
|
{sheet.ranges.length < 1 ? (
|
|
36
|
-
<
|
|
37
|
-
<
|
|
38
|
-
</
|
|
40
|
+
<Message.Root>
|
|
41
|
+
<Message.Title>{t('no ranges message')}</Message.Title>
|
|
42
|
+
</Message.Root>
|
|
39
43
|
) : (
|
|
40
44
|
<List.Root<Sheet.Range> items={sheet.ranges} isItem={Schema.is(Sheet.Range)}>
|
|
41
45
|
{({ items: ranges }) =>
|
|
42
46
|
ranges.map((range, i) => (
|
|
43
|
-
<List.Item key={i} item={range}
|
|
47
|
+
<List.Item key={i} item={range}>
|
|
44
48
|
<List.ItemDragHandle />
|
|
45
49
|
<List.ItemTitle onClick={() => handleSelectRange(range)}>
|
|
46
50
|
{t('range title', {
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta } from '@storybook/react-vite';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import React, { useContext } from 'react';
|
|
8
|
+
|
|
9
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
10
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
11
|
+
import { Obj } from '@dxos/echo';
|
|
12
|
+
import { Operation, OperationHandlerSet } from '@dxos/operation';
|
|
13
|
+
import { corePlugins } from '@dxos/plugin-testing';
|
|
14
|
+
import { useSpace } from '@dxos/react-client/echo';
|
|
15
|
+
import { withClientProvider } from '@dxos/react-client/testing';
|
|
16
|
+
import { withLayout } from '@dxos/react-ui/testing';
|
|
17
|
+
import { AttendableContainer } from '@dxos/react-ui-attention';
|
|
18
|
+
|
|
19
|
+
import { ComputeGraphContext, useComputeGraph } from '../../components';
|
|
20
|
+
import { createTestCells, useTestSheet, withComputeGraphDecorator } from '../../testing';
|
|
21
|
+
import { translations } from '../../translations';
|
|
22
|
+
import { Sheet } from '../../types';
|
|
23
|
+
import { SheetOperation } from '../../operations';
|
|
24
|
+
import RangeList from '../RangeList';
|
|
25
|
+
|
|
26
|
+
import { SheetContainer } from './SheetContainer';
|
|
27
|
+
|
|
28
|
+
const meta = {
|
|
29
|
+
title: 'plugins/plugin-sheet/containers/SheetContainer',
|
|
30
|
+
component: SheetContainer,
|
|
31
|
+
decorators: [
|
|
32
|
+
withLayout({ layout: 'fullscreen' }),
|
|
33
|
+
withClientProvider({ types: [Sheet.Sheet], createSpace: true }),
|
|
34
|
+
withComputeGraphDecorator(),
|
|
35
|
+
withPluginManager({
|
|
36
|
+
plugins: [...corePlugins()],
|
|
37
|
+
capabilities: [
|
|
38
|
+
Capability.contributes(
|
|
39
|
+
Capabilities.OperationHandler,
|
|
40
|
+
OperationHandlerSet.make(
|
|
41
|
+
Operation.withHandler(SheetOperation.DropAxis, ({ model, axis, axisIndex }) =>
|
|
42
|
+
Effect.sync(() => {
|
|
43
|
+
model[axis === 'col' ? 'dropColumn' : 'dropRow'](axisIndex);
|
|
44
|
+
return { axis, axisIndex, index: 0, axisMeta: null, values: [] };
|
|
45
|
+
}),
|
|
46
|
+
),
|
|
47
|
+
),
|
|
48
|
+
),
|
|
49
|
+
],
|
|
50
|
+
}),
|
|
51
|
+
],
|
|
52
|
+
parameters: {
|
|
53
|
+
layout: 'fullscreen',
|
|
54
|
+
translations,
|
|
55
|
+
},
|
|
56
|
+
} satisfies Meta<typeof SheetContainer>;
|
|
57
|
+
|
|
58
|
+
export default meta;
|
|
59
|
+
|
|
60
|
+
export const Default = () => {
|
|
61
|
+
const space = useSpace();
|
|
62
|
+
const graph = useComputeGraph(space);
|
|
63
|
+
const { registry } = useContext(ComputeGraphContext) ?? {};
|
|
64
|
+
const sheet = useTestSheet(space, graph, { cells: createTestCells() });
|
|
65
|
+
if (!sheet || !space || !registry) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<AttendableContainer id={Obj.getDXN(sheet).toString()} classNames='contents'>
|
|
71
|
+
<SheetContainer
|
|
72
|
+
role='article'
|
|
73
|
+
space={space}
|
|
74
|
+
subject={sheet}
|
|
75
|
+
attendableId='test'
|
|
76
|
+
registry={registry}
|
|
77
|
+
ignoreAttention
|
|
78
|
+
/>
|
|
79
|
+
</AttendableContainer>
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export const Spec = () => {
|
|
84
|
+
const space = useSpace();
|
|
85
|
+
const graph = useComputeGraph(space);
|
|
86
|
+
const { registry } = useContext(ComputeGraphContext) ?? {};
|
|
87
|
+
const sheet = useTestSheet(space, graph, { cells: { A1: { value: 'Ready' } } });
|
|
88
|
+
if (!sheet || !space || !registry) {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<AttendableContainer id={Obj.getDXN(sheet).toString()} classNames='contents'>
|
|
94
|
+
<div role='none' className='w-full grid grid-cols-[1fr_20rem]'>
|
|
95
|
+
<SheetContainer
|
|
96
|
+
role='article'
|
|
97
|
+
space={space}
|
|
98
|
+
subject={sheet}
|
|
99
|
+
attendableId='test'
|
|
100
|
+
registry={registry}
|
|
101
|
+
ignoreAttention
|
|
102
|
+
/>
|
|
103
|
+
<div role='none' data-testid='grid.range-list'>
|
|
104
|
+
<RangeList sheet={sheet} />
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
</AttendableContainer>
|
|
108
|
+
);
|
|
109
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';
|
|
8
|
+
import { type ComputeGraphRegistry } from '@dxos/compute';
|
|
9
|
+
import { type Space } from '@dxos/react-client/echo';
|
|
10
|
+
import { Panel } from '@dxos/react-ui';
|
|
11
|
+
|
|
12
|
+
import { ComputeGraphContextProvider, Sheet, useComputeGraph } from '../../components';
|
|
13
|
+
import { type Sheet as SheetType } from '../../types';
|
|
14
|
+
|
|
15
|
+
export type SheetContainerProps = SurfaceComponentProps<
|
|
16
|
+
SheetType.Sheet,
|
|
17
|
+
{
|
|
18
|
+
space: Space;
|
|
19
|
+
registry: ComputeGraphRegistry;
|
|
20
|
+
ignoreAttention?: boolean;
|
|
21
|
+
}
|
|
22
|
+
>;
|
|
23
|
+
|
|
24
|
+
export const SheetContainer = ({ registry, ...props }: SheetContainerProps) => (
|
|
25
|
+
<ComputeGraphContextProvider registry={registry}>
|
|
26
|
+
<SheetContainerInner {...props} />
|
|
27
|
+
</ComputeGraphContextProvider>
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
const SheetContainerInner = ({
|
|
31
|
+
role,
|
|
32
|
+
subject: sheet,
|
|
33
|
+
attendableId,
|
|
34
|
+
space,
|
|
35
|
+
ignoreAttention,
|
|
36
|
+
}: Omit<SheetContainerProps, 'registry'>) => {
|
|
37
|
+
const graph = useComputeGraph(space);
|
|
38
|
+
if (!graph) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<Sheet.Root graph={graph} sheet={sheet} attendableId={attendableId!} ignoreAttention={ignoreAttention}>
|
|
44
|
+
<Panel.Root classNames={role === 'section' && 'aspect-aquare'}>
|
|
45
|
+
<Panel.Toolbar asChild>
|
|
46
|
+
<Sheet.Toolbar />
|
|
47
|
+
</Panel.Toolbar>
|
|
48
|
+
<Panel.Content asChild>
|
|
49
|
+
<Sheet.Content />
|
|
50
|
+
</Panel.Content>
|
|
51
|
+
<Panel.Statusbar asChild>
|
|
52
|
+
<Sheet.Statusbar />
|
|
53
|
+
</Panel.Statusbar>
|
|
54
|
+
</Panel.Root>
|
|
55
|
+
</Sheet.Root>
|
|
56
|
+
);
|
|
57
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type ComponentType, lazy } from 'react';
|
|
6
|
+
|
|
7
|
+
export const RangeList: ComponentType<any> = lazy(() => import('./RangeList'));
|
|
8
|
+
export const SheetContainer: ComponentType<any> = lazy(() => import('./SheetContainer'));
|