@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
|
@@ -7,7 +7,8 @@ import React, { useEffect, useRef, useState } from 'react';
|
|
|
7
7
|
|
|
8
8
|
import { testFunctionPlugins } from '@dxos/compute/testing';
|
|
9
9
|
import { Filter } from '@dxos/echo';
|
|
10
|
-
import {
|
|
10
|
+
import { Obj } from '@dxos/echo';
|
|
11
|
+
import { Operation } from '@dxos/operation';
|
|
11
12
|
import { useSpace } from '@dxos/react-client/echo';
|
|
12
13
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
13
14
|
import { Button, Input, Toolbar } from '@dxos/react-ui';
|
|
@@ -44,14 +45,14 @@ const DefaultStory = () => {
|
|
|
44
45
|
setResult({ functions: { standard: f1.length, echo: f2.length } });
|
|
45
46
|
});
|
|
46
47
|
|
|
47
|
-
space.db.add(
|
|
48
|
+
space.db.add(Obj.make(Operation.PersistentOperation, { name: 'test', version: '0.0.1', binding: FUNCTION_NAME }));
|
|
48
49
|
}
|
|
49
50
|
}, [space, graph]);
|
|
50
51
|
|
|
51
52
|
const inputRef = useRef<HTMLInputElement | null>(null);
|
|
52
53
|
const handleTest = async () => {
|
|
53
54
|
if (space && graph) {
|
|
54
|
-
const
|
|
55
|
+
const objects = await space.db.query(Filter.type(Operation.PersistentOperation)).run();
|
|
55
56
|
const mapped = graph.mapFunctionBindingToId(text);
|
|
56
57
|
const unmapped = graph.mapFunctionBindingFromId(mapped);
|
|
57
58
|
const internal = graph.mapFormulaToNative(text);
|
|
@@ -84,11 +85,15 @@ const DefaultStory = () => {
|
|
|
84
85
|
export const Default: Story = {};
|
|
85
86
|
|
|
86
87
|
const meta = {
|
|
87
|
-
title: 'plugins/plugin-sheet/functions',
|
|
88
|
+
title: 'plugins/plugin-sheet/components/functions',
|
|
88
89
|
render: DefaultStory,
|
|
89
90
|
decorators: [
|
|
90
|
-
withTheme,
|
|
91
|
-
withClientProvider({
|
|
91
|
+
withTheme(),
|
|
92
|
+
withClientProvider({
|
|
93
|
+
types: [Operation.PersistentOperation, Sheet.Sheet],
|
|
94
|
+
createIdentity: true,
|
|
95
|
+
createSpace: true,
|
|
96
|
+
}),
|
|
92
97
|
withComputeGraphDecorator({ plugins: testFunctionPlugins }),
|
|
93
98
|
],
|
|
94
99
|
} satisfies Meta<typeof DefaultStory>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { SheetContent } from '../SheetContent';
|
|
6
|
+
import { SheetRoot } from '../SheetRoot';
|
|
7
|
+
import { SheetStatusbar } from '../SheetStatusbar';
|
|
8
|
+
import { SheetToolbar } from '../SheetToolbar';
|
|
9
|
+
|
|
10
|
+
export { useSheetContext, type SheetContextValue, type SheetRootProps } from '../SheetRoot';
|
|
11
|
+
export { type SheetContentProps } from '../SheetContent';
|
|
12
|
+
export { type SheetToolbarProps } from '../SheetToolbar';
|
|
13
|
+
export { type SheetStatusbarProps } from '../SheetStatusbar';
|
|
14
|
+
|
|
15
|
+
export const Sheet = {
|
|
16
|
+
Root: SheetRoot,
|
|
17
|
+
Toolbar: SheetToolbar,
|
|
18
|
+
Content: SheetContent,
|
|
19
|
+
Statusbar: SheetStatusbar,
|
|
20
|
+
};
|
|
@@ -6,13 +6,14 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
|
6
6
|
import React, { useMemo, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { Client } from '@dxos/client';
|
|
9
|
-
import { createDocAccessor } from '@dxos/client/echo';
|
|
10
9
|
import { defaultFunctions } from '@dxos/compute';
|
|
11
10
|
import { getRegisteredFunctionNames } from '@dxos/compute/testing';
|
|
11
|
+
import { Obj } from '@dxos/echo';
|
|
12
|
+
import { createDocAccessor } from '@dxos/echo-db';
|
|
12
13
|
import { useAsyncEffect } from '@dxos/react-hooks';
|
|
13
14
|
import { withTheme } from '@dxos/react-ui/testing';
|
|
14
|
-
import { automerge } from '@dxos/react-ui-editor';
|
|
15
15
|
import { CellEditor, type CellEditorProps } from '@dxos/react-ui-grid';
|
|
16
|
+
import { automerge } from '@dxos/ui-editor';
|
|
16
17
|
|
|
17
18
|
import { sheetExtension } from '../../extensions';
|
|
18
19
|
import { Sheet } from '../../types';
|
|
@@ -37,8 +38,10 @@ const AutomergeStory = ({ value, ...props }: CellEditorProps) => {
|
|
|
37
38
|
const space = await client.spaces.create();
|
|
38
39
|
|
|
39
40
|
const sheet = Sheet.make();
|
|
40
|
-
sheet
|
|
41
|
-
|
|
41
|
+
Obj.change(sheet, (obj) => {
|
|
42
|
+
obj.name = 'Test';
|
|
43
|
+
obj.cells[cell] = { value };
|
|
44
|
+
});
|
|
42
45
|
space.db.add(sheet);
|
|
43
46
|
setObject(sheet);
|
|
44
47
|
}, [value]);
|
|
@@ -58,9 +61,9 @@ const AutomergeStory = ({ value, ...props }: CellEditorProps) => {
|
|
|
58
61
|
};
|
|
59
62
|
|
|
60
63
|
const meta = {
|
|
61
|
-
title: 'plugins/plugin-sheet/CellEditor',
|
|
64
|
+
title: 'plugins/plugin-sheet/components/CellEditor',
|
|
62
65
|
|
|
63
|
-
decorators: [withTheme],
|
|
66
|
+
decorators: [withTheme()],
|
|
64
67
|
component: CellEditor,
|
|
65
68
|
render: DefaultStory,
|
|
66
69
|
} satisfies Meta<typeof DefaultStory>;
|
package/src/components/{GridSheet/GridSheet.stories.tsx → SheetContent/SheetContent.stories.tsx}
RENAMED
|
@@ -5,20 +5,20 @@
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
|
-
import { IntentPlugin } from '@dxos/app-framework';
|
|
9
8
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
9
|
import { testFunctionPlugins } from '@dxos/compute/testing';
|
|
10
|
+
import { OperationPlugin, RuntimePlugin } from '@dxos/app-framework';
|
|
11
11
|
import { useSpace } from '@dxos/react-client/echo';
|
|
12
12
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
13
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
13
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
14
14
|
|
|
15
15
|
import { createTestCells, useTestSheet, withComputeGraphDecorator } from '../../testing';
|
|
16
16
|
import { translations } from '../../translations';
|
|
17
17
|
import { Sheet } from '../../types';
|
|
18
18
|
import { useComputeGraph } from '../ComputeGraph';
|
|
19
|
-
import {
|
|
19
|
+
import { SheetRoot } from '../SheetRoot';
|
|
20
20
|
|
|
21
|
-
import {
|
|
21
|
+
import { SheetContent } from './SheetContent';
|
|
22
22
|
|
|
23
23
|
export const Basic = () => {
|
|
24
24
|
const space = useSpace();
|
|
@@ -29,30 +29,31 @@ export const Basic = () => {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
return (
|
|
32
|
-
<
|
|
33
|
-
<div role='none' className='grid
|
|
34
|
-
<
|
|
32
|
+
<SheetRoot graph={graph} sheet={sheet} attendableId='test' ignoreAttention>
|
|
33
|
+
<div role='none' className='grid h-full w-full'>
|
|
34
|
+
<SheetContent />
|
|
35
35
|
</div>
|
|
36
|
-
</
|
|
36
|
+
</SheetRoot>
|
|
37
37
|
);
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
const meta = {
|
|
41
|
-
title: 'plugins/plugin-sheet/
|
|
42
|
-
component:
|
|
41
|
+
title: 'plugins/plugin-sheet/components/SheetContent',
|
|
42
|
+
component: SheetContent,
|
|
43
43
|
decorators: [
|
|
44
|
-
withTheme,
|
|
44
|
+
withTheme(),
|
|
45
|
+
withLayout({ layout: 'fullscreen' }),
|
|
45
46
|
withClientProvider({ types: [Sheet.Sheet], createSpace: true }),
|
|
46
47
|
withComputeGraphDecorator({ plugins: testFunctionPlugins }),
|
|
47
48
|
withPluginManager({
|
|
48
|
-
plugins: [
|
|
49
|
+
plugins: [OperationPlugin(), RuntimePlugin()],
|
|
49
50
|
}),
|
|
50
51
|
],
|
|
51
52
|
parameters: {
|
|
52
53
|
layout: 'fullscreen',
|
|
53
54
|
translations,
|
|
54
55
|
},
|
|
55
|
-
} satisfies Meta<typeof
|
|
56
|
+
} satisfies Meta<typeof SheetContent>;
|
|
56
57
|
|
|
57
58
|
export default meta;
|
|
58
59
|
|
|
@@ -8,14 +8,15 @@ import React, {
|
|
|
8
8
|
type MouseEvent,
|
|
9
9
|
type WheelEvent,
|
|
10
10
|
useCallback,
|
|
11
|
+
useEffect,
|
|
11
12
|
useMemo,
|
|
12
13
|
useRef,
|
|
13
14
|
useState,
|
|
14
15
|
} from 'react';
|
|
15
16
|
|
|
16
|
-
import {
|
|
17
|
-
import { useIntentDispatcher } from '@dxos/app-framework/react';
|
|
17
|
+
import { useCapabilities, useOperationInvoker } from '@dxos/app-framework/ui';
|
|
18
18
|
import { type CellRange, rangeToA1Notation } from '@dxos/compute';
|
|
19
|
+
import { Obj } from '@dxos/echo';
|
|
19
20
|
import { defaultColSize, defaultRowSize } from '@dxos/lit-grid';
|
|
20
21
|
import { DropdownMenu, Icon, useTranslation } from '@dxos/react-ui';
|
|
21
22
|
import { useAttention } from '@dxos/react-ui-attention';
|
|
@@ -32,12 +33,14 @@ import {
|
|
|
32
33
|
editorKeys,
|
|
33
34
|
parseCellIndex,
|
|
34
35
|
} from '@dxos/react-ui-grid';
|
|
36
|
+
import { composable, composableProps } from '@dxos/ui-theme';
|
|
35
37
|
|
|
36
38
|
import { type RangeController, rangeExtension, sheetExtension } from '../../extensions';
|
|
37
|
-
import { useSelectThreadOnCellFocus
|
|
39
|
+
import { useSelectThreadOnCellFocus } from '../../integrations';
|
|
38
40
|
import { meta } from '../../meta';
|
|
39
|
-
import { DEFAULT_COLS, DEFAULT_ROWS,
|
|
40
|
-
import {
|
|
41
|
+
import { DEFAULT_COLS, DEFAULT_ROWS, SheetCapabilities } from '../../types';
|
|
42
|
+
import { SheetOperation } from '../../operations';
|
|
43
|
+
import { useSheetContext } from '../SheetRoot';
|
|
41
44
|
|
|
42
45
|
import { colLabelCell, rowLabelCell, useSheetModelDxGridProps } from './util';
|
|
43
46
|
|
|
@@ -69,15 +72,29 @@ const sheetRowDefault = {
|
|
|
69
72
|
grid: { size: defaultRowSize, resizeable: true },
|
|
70
73
|
};
|
|
71
74
|
|
|
72
|
-
export
|
|
75
|
+
export type SheetContentProps = {};
|
|
76
|
+
|
|
77
|
+
export const SheetContent = composable<HTMLDivElement, SheetContentProps>((props, forwardedRef) => {
|
|
73
78
|
const { t } = useTranslation(meta.id);
|
|
74
|
-
const {
|
|
75
|
-
|
|
79
|
+
const {
|
|
80
|
+
id,
|
|
81
|
+
attendableId,
|
|
82
|
+
model,
|
|
83
|
+
editing,
|
|
84
|
+
setCursor,
|
|
85
|
+
setRange,
|
|
86
|
+
cursor,
|
|
87
|
+
cursorFallbackRange,
|
|
88
|
+
activeRefs,
|
|
89
|
+
setActiveRefs,
|
|
90
|
+
ignoreAttention,
|
|
91
|
+
} = useSheetContext();
|
|
92
|
+
|
|
76
93
|
// NOTE(thure): using `useState` instead of `useRef` works with refs provided by `@lit/react` and gives us
|
|
77
94
|
// a reliable dependency for `useEffect` whereas `useLayoutEffect` does not guarantee the element will be defined.
|
|
78
95
|
const [dxGrid, setDxGrid] = useState<DxGridElement | null>(null);
|
|
79
96
|
const [extraplanarFocus, setExtraplanarFocus] = useState<DxGridPosition | null>(null);
|
|
80
|
-
const {
|
|
97
|
+
const { invokePromise } = useOperationInvoker();
|
|
81
98
|
const rangeController = useRef<RangeController>(null);
|
|
82
99
|
const { hasAttention } = useAttention(id);
|
|
83
100
|
|
|
@@ -128,15 +145,17 @@ export const GridSheet = () => {
|
|
|
128
145
|
|
|
129
146
|
const handleAxisResize = useCallback<NonNullable<GridContentProps['onAxisResize']>>(
|
|
130
147
|
({ axis, size, index: numericIndex }) => {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
148
|
+
Obj.change(model.sheet, (sheet) => {
|
|
149
|
+
if (axis === 'row') {
|
|
150
|
+
const rowId = sheet.rows[parseInt(numericIndex)];
|
|
151
|
+
sheet.rowMeta[rowId] ??= {};
|
|
152
|
+
sheet.rowMeta[rowId].size = size;
|
|
153
|
+
} else {
|
|
154
|
+
const columnId = sheet.columns[parseInt(numericIndex)];
|
|
155
|
+
sheet.columnMeta[columnId] ??= {};
|
|
156
|
+
sheet.columnMeta[columnId].size = size;
|
|
157
|
+
}
|
|
158
|
+
});
|
|
140
159
|
},
|
|
141
160
|
[model],
|
|
142
161
|
);
|
|
@@ -266,24 +285,20 @@ export const GridSheet = () => {
|
|
|
266
285
|
switch (operation) {
|
|
267
286
|
case 'insert-before':
|
|
268
287
|
case 'insert-after':
|
|
269
|
-
return
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
}),
|
|
275
|
-
);
|
|
288
|
+
return invokePromise(SheetOperation.InsertAxis, {
|
|
289
|
+
model,
|
|
290
|
+
axis: contextMenuAxis,
|
|
291
|
+
index: contextMenuOpen![contextMenuAxis] + (operation === 'insert-before' ? 0 : 1),
|
|
292
|
+
});
|
|
276
293
|
case 'drop':
|
|
277
|
-
return
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
}),
|
|
283
|
-
);
|
|
294
|
+
return invokePromise(SheetOperation.DropAxis, {
|
|
295
|
+
model,
|
|
296
|
+
axis: contextMenuAxis,
|
|
297
|
+
axisIndex: model.sheet[contextMenuAxis === 'row' ? 'rows' : 'columns'][contextMenuOpen![contextMenuAxis]],
|
|
298
|
+
});
|
|
284
299
|
}
|
|
285
300
|
},
|
|
286
|
-
[contextMenuAxis, contextMenuOpen, model,
|
|
301
|
+
[contextMenuAxis, contextMenuOpen, model, invokePromise],
|
|
287
302
|
);
|
|
288
303
|
|
|
289
304
|
const { columns, rows } = useSheetModelDxGridProps(dxGrid, model);
|
|
@@ -315,23 +330,31 @@ export const GridSheet = () => {
|
|
|
315
330
|
[model],
|
|
316
331
|
);
|
|
317
332
|
|
|
318
|
-
|
|
333
|
+
const [gridInstances] = useCapabilities(SheetCapabilities.GridInstances);
|
|
334
|
+
useEffect(() => {
|
|
335
|
+
if (dxGrid && gridInstances) {
|
|
336
|
+
gridInstances.register(attendableId, dxGrid, setActiveRefs);
|
|
337
|
+
return () => gridInstances.unregister(attendableId);
|
|
338
|
+
}
|
|
339
|
+
}, [dxGrid, gridInstances, attendableId, setActiveRefs]);
|
|
340
|
+
|
|
319
341
|
useSelectThreadOnCellFocus();
|
|
320
342
|
|
|
321
343
|
return (
|
|
322
|
-
|
|
323
|
-
<div role='none' className='relative min-bs-0 [&_.cm-editor]:!border-lb [&_.cm-editor]:!border-transparent'>
|
|
344
|
+
<div ref={forwardedRef} {...composableProps(props, { role: 'none', classNames: 'relative min-h-0' })}>
|
|
324
345
|
<GridCellEditor getCellContent={getCellContent} extensions={extensions} onBlur={handleBlur} />
|
|
325
346
|
<Grid.Content
|
|
347
|
+
className='[--dx-grid-base:var(--base-surface)] [&_.dx-grid]:absolute [&_.dx-grid]:inset-0'
|
|
326
348
|
initialCells={initialCells}
|
|
327
349
|
limitColumns={DEFAULT_COLS}
|
|
328
350
|
limitRows={DEFAULT_ROWS}
|
|
329
351
|
columns={columns}
|
|
330
352
|
rows={rows}
|
|
331
|
-
// TODO(burdon): `col` vs. `column`?
|
|
332
353
|
columnDefault={sheetColDefault}
|
|
333
354
|
rowDefault={sheetRowDefault}
|
|
355
|
+
activeRefs={activeRefs}
|
|
334
356
|
frozen={frozen}
|
|
357
|
+
overscroll='trap'
|
|
335
358
|
onAxisResize={handleAxisResize}
|
|
336
359
|
onSelect={handleSelect}
|
|
337
360
|
onFocus={handleFocus}
|
|
@@ -339,9 +362,6 @@ export const GridSheet = () => {
|
|
|
339
362
|
onKeyDown={handleKeyDown}
|
|
340
363
|
onContextMenu={handleContextMenu}
|
|
341
364
|
onClick={handleClick}
|
|
342
|
-
overscroll='trap'
|
|
343
|
-
className='[--dx-grid-base:var(--baseSurface)] [&_.dx-grid]:absolute [&_.dx-grid]:inset-0'
|
|
344
|
-
activeRefs={activeRefs}
|
|
345
365
|
ref={setDxGrid}
|
|
346
366
|
/>
|
|
347
367
|
<DropdownMenu.Root
|
|
@@ -357,7 +377,6 @@ export const GridSheet = () => {
|
|
|
357
377
|
data-testid={`grid.${contextMenuAxis}.insert-before`}
|
|
358
378
|
>
|
|
359
379
|
<Icon
|
|
360
|
-
size={5}
|
|
361
380
|
icon={contextMenuAxis === 'col' ? 'ph--columns-plus-left--regular' : 'ph--rows-plus-top--regular'}
|
|
362
381
|
/>
|
|
363
382
|
<span>{t(`add ${contextMenuAxis} before label`)}</span>
|
|
@@ -367,7 +386,6 @@ export const GridSheet = () => {
|
|
|
367
386
|
data-testid={`grid.${contextMenuAxis}.insert-after`}
|
|
368
387
|
>
|
|
369
388
|
<Icon
|
|
370
|
-
size={5}
|
|
371
389
|
icon={contextMenuAxis === 'col' ? 'ph--columns-plus-right--regular' : 'ph--rows-plus-bottom--regular'}
|
|
372
390
|
/>
|
|
373
391
|
<span>{t(`add ${contextMenuAxis} after label`)}</span>
|
|
@@ -376,7 +394,7 @@ export const GridSheet = () => {
|
|
|
376
394
|
onClick={() => handleAxisMenuAction('drop')}
|
|
377
395
|
data-testid={`grid.${contextMenuAxis}.drop`}
|
|
378
396
|
>
|
|
379
|
-
<Icon
|
|
397
|
+
<Icon icon='ph--backspace--regular' />
|
|
380
398
|
<span>{t(`delete ${contextMenuAxis} label`)}</span>
|
|
381
399
|
</DropdownMenu.Item>
|
|
382
400
|
</DropdownMenu.Viewport>
|
|
@@ -385,4 +403,4 @@ export const GridSheet = () => {
|
|
|
385
403
|
</DropdownMenu.Root>
|
|
386
404
|
</div>
|
|
387
405
|
);
|
|
388
|
-
};
|
|
406
|
+
});
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { useEffect, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { inRange } from '@dxos/compute';
|
|
8
|
-
import { createDocAccessor } from '@dxos/
|
|
8
|
+
import { createDocAccessor } from '@dxos/echo-db';
|
|
9
9
|
import { cellClassesForFieldType, parseValue } from '@dxos/react-ui-form';
|
|
10
10
|
import {
|
|
11
11
|
type DxGridAxisMeta,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
commentedClassName,
|
|
20
20
|
rowToA1Notation,
|
|
21
21
|
} from '@dxos/react-ui-grid';
|
|
22
|
-
import { mx } from '@dxos/
|
|
22
|
+
import { mx } from '@dxos/ui-theme';
|
|
23
23
|
|
|
24
24
|
import { type SheetModel } from '../../model';
|
|
25
25
|
import { cellClassNameForRange, rangeFromIndex } from '../../types';
|
|
@@ -96,13 +96,13 @@ const gridCellGetter = (model: SheetModel) => {
|
|
|
96
96
|
|
|
97
97
|
export const rowLabelCell = (row: number) => ({
|
|
98
98
|
value: rowToA1Notation(row),
|
|
99
|
-
className: '!bg-
|
|
99
|
+
className: '!bg-toolbar-surface text-subdued text-end pe-1',
|
|
100
100
|
resizeHandle: 'row',
|
|
101
101
|
});
|
|
102
102
|
|
|
103
103
|
export const colLabelCell = (col: number) => ({
|
|
104
104
|
value: colToA1Notation(col),
|
|
105
|
-
className: '!bg-
|
|
105
|
+
className: '!bg-toolbar-surface text-subdued',
|
|
106
106
|
resizeHandle: 'col',
|
|
107
107
|
});
|
|
108
108
|
|
|
@@ -114,7 +114,7 @@ const cellGetter = (model: SheetModel) => {
|
|
|
114
114
|
return getGridCells(nextBounds);
|
|
115
115
|
case 'fixedStartStart': {
|
|
116
116
|
return {
|
|
117
|
-
'0,0': { className: '!bg-
|
|
117
|
+
'0,0': { className: '!bg-toolbar-surface' },
|
|
118
118
|
};
|
|
119
119
|
}
|
|
120
120
|
case 'frozenColsStart':
|
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
import React, { type PropsWithChildren, createContext, useCallback, useContext, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { type CellAddress, type CellRange, type CompleteCellRange, type ComputeGraph } from '@dxos/compute';
|
|
8
|
-
import {
|
|
9
|
-
import { invariant } from '@dxos/invariant';
|
|
8
|
+
import { raise } from '@dxos/debug';
|
|
10
9
|
import {
|
|
11
10
|
Grid,
|
|
12
11
|
type GridContentProps,
|
|
@@ -20,7 +19,7 @@ import { type Sheet } from '../../types';
|
|
|
20
19
|
|
|
21
20
|
export type SheetContextValue = {
|
|
22
21
|
id: string;
|
|
23
|
-
|
|
22
|
+
attendableId: string;
|
|
24
23
|
model: SheetModel;
|
|
25
24
|
|
|
26
25
|
// Cursor state.
|
|
@@ -39,29 +38,62 @@ export type SheetContextValue = {
|
|
|
39
38
|
activeRefs: GridContentProps['activeRefs'];
|
|
40
39
|
setActiveRefs: (activeRefs: GridContentProps['activeRefs']) => void;
|
|
41
40
|
|
|
41
|
+
// Flags
|
|
42
|
+
ignoreAttention?: boolean;
|
|
43
|
+
|
|
42
44
|
// Events.
|
|
43
45
|
// TODO(burdon): Generalize.
|
|
44
46
|
onInfo?: () => void;
|
|
45
|
-
|
|
46
|
-
// Flags
|
|
47
|
-
ignoreAttention?: boolean;
|
|
48
47
|
};
|
|
49
48
|
|
|
49
|
+
// TODO(burdon): Use radix context.
|
|
50
50
|
const SheetContext = createContext<SheetContextValue | undefined>(undefined);
|
|
51
51
|
|
|
52
52
|
export const useSheetContext = (): SheetContextValue => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
return useContext(SheetContext) ?? raise(new Error('Missing SheetContext'));
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export type SheetRootProps = {
|
|
57
|
+
graph: ComputeGraph;
|
|
58
|
+
sheet: Sheet.Sheet;
|
|
59
|
+
attendableId: string;
|
|
60
|
+
readonly?: boolean;
|
|
61
|
+
ignoreAttention?: boolean;
|
|
62
|
+
} & Pick<SheetContextValue, 'onInfo'>;
|
|
63
|
+
|
|
64
|
+
export const SheetRoot = ({
|
|
65
|
+
children,
|
|
66
|
+
graph,
|
|
67
|
+
sheet,
|
|
68
|
+
attendableId,
|
|
69
|
+
readonly,
|
|
70
|
+
ignoreAttention,
|
|
71
|
+
onInfo,
|
|
72
|
+
}: PropsWithChildren<SheetRootProps>) => {
|
|
73
|
+
const model = useSheetModel(graph, sheet, { readonly });
|
|
74
|
+
if (!model) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<Grid.Root id={attendableId}>
|
|
80
|
+
<SheetProviderImpl model={model} attendableId={attendableId} onInfo={onInfo} ignoreAttention={ignoreAttention}>
|
|
81
|
+
{children}
|
|
82
|
+
</SheetProviderImpl>
|
|
83
|
+
</Grid.Root>
|
|
84
|
+
);
|
|
56
85
|
};
|
|
57
86
|
|
|
58
87
|
const SheetProviderImpl = ({
|
|
88
|
+
__gridScope,
|
|
89
|
+
children,
|
|
90
|
+
attendableId,
|
|
91
|
+
ignoreAttention,
|
|
59
92
|
model,
|
|
60
93
|
onInfo,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}: GridScopedProps<PropsWithChildren<Pick<SheetContextValue, 'onInfo' | 'model' | 'ignoreAttention'>>>) => {
|
|
94
|
+
}: GridScopedProps<
|
|
95
|
+
PropsWithChildren<Pick<SheetContextValue, 'attendableId' | 'ignoreAttention' | 'model' | 'onInfo'>>
|
|
96
|
+
>) => {
|
|
65
97
|
const { id, editing, setEditing } = useGridContext('SheetProvider', __gridScope);
|
|
66
98
|
|
|
67
99
|
const [cursor, setCursorInternal] = useState<CellAddress>();
|
|
@@ -92,6 +124,7 @@ const SheetProviderImpl = ({
|
|
|
92
124
|
<SheetContext.Provider
|
|
93
125
|
value={{
|
|
94
126
|
id,
|
|
127
|
+
attendableId,
|
|
95
128
|
model,
|
|
96
129
|
editing,
|
|
97
130
|
setEditing,
|
|
@@ -102,38 +135,12 @@ const SheetProviderImpl = ({
|
|
|
102
135
|
cursorFallbackRange,
|
|
103
136
|
activeRefs,
|
|
104
137
|
setActiveRefs,
|
|
138
|
+
ignoreAttention,
|
|
105
139
|
// TODO(burdon): Change to event.
|
|
106
140
|
onInfo,
|
|
107
|
-
ignoreAttention,
|
|
108
141
|
}}
|
|
109
142
|
>
|
|
110
143
|
{children}
|
|
111
144
|
</SheetContext.Provider>
|
|
112
145
|
);
|
|
113
146
|
};
|
|
114
|
-
|
|
115
|
-
export type SheetProviderProps = {
|
|
116
|
-
graph: ComputeGraph;
|
|
117
|
-
sheet: Sheet.Sheet;
|
|
118
|
-
readonly?: boolean;
|
|
119
|
-
ignoreAttention?: boolean;
|
|
120
|
-
} & Pick<SheetContextValue, 'onInfo'>;
|
|
121
|
-
|
|
122
|
-
export const SheetProvider = ({
|
|
123
|
-
children,
|
|
124
|
-
graph,
|
|
125
|
-
sheet,
|
|
126
|
-
readonly,
|
|
127
|
-
ignoreAttention,
|
|
128
|
-
onInfo,
|
|
129
|
-
}: PropsWithChildren<SheetProviderProps>) => {
|
|
130
|
-
const model = useSheetModel(graph, sheet, { readonly });
|
|
131
|
-
|
|
132
|
-
return !model ? null : (
|
|
133
|
-
<Grid.Root id={Obj.getDXN(sheet).toString()}>
|
|
134
|
-
<SheetProviderImpl model={model} onInfo={onInfo} ignoreAttention={ignoreAttention}>
|
|
135
|
-
{children}
|
|
136
|
-
</SheetProviderImpl>
|
|
137
|
-
</Grid.Root>
|
|
138
|
-
);
|
|
139
|
-
};
|
package/src/components/{FunctionEditor/FunctionEditor.tsx → SheetStatusbar/SheetStatusbar.tsx}
RENAMED
|
@@ -7,10 +7,15 @@ import React from 'react';
|
|
|
7
7
|
import { addressToA1Notation, isFormula, rangeToA1Notation } from '@dxos/compute';
|
|
8
8
|
import { Icon } from '@dxos/react-ui';
|
|
9
9
|
|
|
10
|
+
import { composable, composableProps, mx } from '@dxos/ui-theme';
|
|
11
|
+
|
|
10
12
|
import { mapFormulaIndicesToRefs } from '../../types';
|
|
11
|
-
import { useSheetContext } from '../
|
|
13
|
+
import { useSheetContext } from '../SheetRoot';
|
|
14
|
+
|
|
15
|
+
export type SheetStatusbarProps = {};
|
|
12
16
|
|
|
13
|
-
export const
|
|
17
|
+
export const SheetStatusbar = composable<HTMLDivElement, SheetStatusbarProps>((props, forwardedRef) => {
|
|
18
|
+
const { className, ...rest } = composableProps(props);
|
|
14
19
|
const { model, cursor, range } = useSheetContext();
|
|
15
20
|
|
|
16
21
|
let value;
|
|
@@ -26,16 +31,23 @@ export const FunctionEditor = () => {
|
|
|
26
31
|
}
|
|
27
32
|
|
|
28
33
|
return (
|
|
29
|
-
<div
|
|
34
|
+
<div
|
|
35
|
+
ref={forwardedRef}
|
|
36
|
+
{...rest}
|
|
37
|
+
className={mx(
|
|
38
|
+
'flex shrink-0 justify-between items-center px-4 py-1 text-sm bg-toolbar-surface border-y !border-subdued-separator',
|
|
39
|
+
className,
|
|
40
|
+
)}
|
|
41
|
+
>
|
|
30
42
|
<div className='flex gap-4 items-center'>
|
|
31
|
-
<div className='flex
|
|
43
|
+
<div className='flex w-16 items-center font-mono'>
|
|
32
44
|
{(range && rangeToA1Notation(range)) || (cursor && addressToA1Notation(cursor))}
|
|
33
45
|
</div>
|
|
34
46
|
<div className='flex gap-2 items-center'>
|
|
35
|
-
<Icon icon='ph--function--regular' classNames={['text-
|
|
47
|
+
<Icon icon='ph--function--regular' classNames={['text-green-text', formula ? 'visible' : 'invisible']} />
|
|
36
48
|
<span className='font-mono'>{value}</span>
|
|
37
49
|
</div>
|
|
38
50
|
</div>
|
|
39
51
|
</div>
|
|
40
52
|
);
|
|
41
|
-
};
|
|
53
|
+
});
|
|
@@ -5,23 +5,23 @@
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
8
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
9
9
|
|
|
10
10
|
import { translations } from '../../translations';
|
|
11
11
|
|
|
12
12
|
import { SheetToolbar } from './SheetToolbar';
|
|
13
13
|
|
|
14
14
|
const DefaultStory = () => {
|
|
15
|
-
// TODO(wittjosiah): Depends on
|
|
15
|
+
// TODO(wittjosiah): Depends on SheetRoot.
|
|
16
16
|
// return <SheetToolbar id='test' />;
|
|
17
17
|
return <>TODO</>;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
const meta = {
|
|
21
|
-
title: 'plugins/plugin-sheet/Toolbar',
|
|
21
|
+
title: 'plugins/plugin-sheet/components/Toolbar',
|
|
22
22
|
component: SheetToolbar as any,
|
|
23
23
|
render: DefaultStory,
|
|
24
|
-
decorators: [withTheme],
|
|
24
|
+
decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
|
|
25
25
|
parameters: {
|
|
26
26
|
layout: 'fullscreen',
|
|
27
27
|
translations,
|