@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
|
@@ -5,27 +5,27 @@
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React, { useEffect, useMemo } from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { OperationPlugin, RuntimePlugin } from '@dxos/app-framework';
|
|
9
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
10
|
import { PublicKey } from '@dxos/keys';
|
|
11
11
|
import { useSpace } from '@dxos/react-client/echo';
|
|
12
12
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
13
13
|
import { useThemeContext } from '@dxos/react-ui';
|
|
14
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
14
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
15
|
+
import { useTextEditor } from '@dxos/react-ui-editor';
|
|
15
16
|
import {
|
|
16
17
|
createBasicExtensions,
|
|
17
18
|
createMarkdownExtensions,
|
|
18
19
|
createThemeExtensions,
|
|
19
20
|
decorateMarkdown,
|
|
20
21
|
documentId,
|
|
21
|
-
|
|
22
|
-
} from '@dxos/react-ui-editor';
|
|
22
|
+
} from '@dxos/ui-editor';
|
|
23
23
|
import { isNonNullable } from '@dxos/util';
|
|
24
24
|
|
|
25
|
-
import {
|
|
25
|
+
import { Sheet, useComputeGraph } from '../components';
|
|
26
26
|
import { useSheetModel } from '../model';
|
|
27
27
|
import { useTestSheet, withComputeGraphDecorator } from '../testing';
|
|
28
|
-
import { Sheet } from '../types';
|
|
28
|
+
import { Sheet as SheetType } from '../types';
|
|
29
29
|
|
|
30
30
|
import { compute, computeGraphFacet } from './compute';
|
|
31
31
|
|
|
@@ -63,7 +63,7 @@ const DefaultStory = ({ text }: EditorProps) => {
|
|
|
63
63
|
[computeGraph, themeMode],
|
|
64
64
|
);
|
|
65
65
|
|
|
66
|
-
return <div className='
|
|
66
|
+
return <div className='w-[40rem] overflow-hidden' ref={parentRef} {...focusAttributes} />;
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
const Grid = () => {
|
|
@@ -73,7 +73,12 @@ const Grid = () => {
|
|
|
73
73
|
const model = useSheetModel(graph, sheet);
|
|
74
74
|
useEffect(() => {
|
|
75
75
|
if (model) {
|
|
76
|
-
model.setValues({
|
|
76
|
+
model.setValues({
|
|
77
|
+
A1: { value: 100 },
|
|
78
|
+
A2: { value: 200 },
|
|
79
|
+
A3: { value: 300 },
|
|
80
|
+
A5: { value: '=SUM(A1:A3)' },
|
|
81
|
+
});
|
|
77
82
|
}
|
|
78
83
|
}, [model]);
|
|
79
84
|
|
|
@@ -82,10 +87,10 @@ const Grid = () => {
|
|
|
82
87
|
}
|
|
83
88
|
|
|
84
89
|
return (
|
|
85
|
-
<div className='flex
|
|
86
|
-
<
|
|
87
|
-
<
|
|
88
|
-
</
|
|
90
|
+
<div className='flex w-[40rem] overflow-hidden'>
|
|
91
|
+
<Sheet.Root graph={graph} sheet={sheet} attendableId='test'>
|
|
92
|
+
<Sheet.Content />
|
|
93
|
+
</Sheet.Root>
|
|
89
94
|
</div>
|
|
90
95
|
);
|
|
91
96
|
};
|
|
@@ -100,12 +105,17 @@ const GraphStory = (props: EditorProps) => {
|
|
|
100
105
|
};
|
|
101
106
|
|
|
102
107
|
const meta = {
|
|
103
|
-
title: 'plugins/plugin-sheet/extensions',
|
|
108
|
+
title: 'plugins/plugin-sheet/extensions/compute',
|
|
104
109
|
decorators: [
|
|
105
|
-
withTheme,
|
|
106
|
-
|
|
110
|
+
withTheme(),
|
|
111
|
+
withLayout({ layout: 'fullscreen' }),
|
|
112
|
+
withClientProvider({
|
|
113
|
+
types: [SheetType.Sheet],
|
|
114
|
+
createIdentity: true,
|
|
115
|
+
createSpace: true,
|
|
116
|
+
}),
|
|
107
117
|
// TODO(wittjosiah): Try to write story which does not depend on plugin manager.
|
|
108
|
-
withPluginManager({ plugins: [
|
|
118
|
+
withPluginManager({ plugins: [OperationPlugin(), RuntimePlugin()] }),
|
|
109
119
|
withComputeGraphDecorator(),
|
|
110
120
|
],
|
|
111
121
|
parameters: {
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
createSheetName,
|
|
24
24
|
} from '@dxos/compute';
|
|
25
25
|
import { invariant } from '@dxos/invariant';
|
|
26
|
-
import { documentId, singleValueFacet } from '@dxos/
|
|
26
|
+
import { documentId, singleValueFacet } from '@dxos/ui-editor';
|
|
27
27
|
|
|
28
28
|
const LANGUAGE_TAG = 'dx';
|
|
29
29
|
|
|
@@ -20,8 +20,8 @@ import { spreadsheet } from 'codemirror-lang-spreadsheet';
|
|
|
20
20
|
|
|
21
21
|
import { type FunctionDefinition } from '@dxos/compute';
|
|
22
22
|
import { RANGE_NOTATION } from '@dxos/compute';
|
|
23
|
-
import { singleValueFacet } from '@dxos/
|
|
24
|
-
import { mx } from '@dxos/
|
|
23
|
+
import { singleValueFacet } from '@dxos/ui-editor';
|
|
24
|
+
import { mx } from '@dxos/ui-theme';
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* https://codemirror.net/examples/styling
|
|
@@ -33,30 +33,30 @@ const highlightStyles = HighlightStyle.define([
|
|
|
33
33
|
// Function.
|
|
34
34
|
{
|
|
35
35
|
tag: tags.name,
|
|
36
|
-
class: 'text-
|
|
36
|
+
class: 'text-accent-text',
|
|
37
37
|
},
|
|
38
38
|
// Range.
|
|
39
39
|
{
|
|
40
40
|
tag: tags.tagName,
|
|
41
|
-
class: 'text-
|
|
41
|
+
class: 'text-pink-text',
|
|
42
42
|
},
|
|
43
43
|
// Values.
|
|
44
44
|
{
|
|
45
45
|
tag: tags.number,
|
|
46
|
-
class: 'text-
|
|
46
|
+
class: 'text-teal-text',
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
49
|
tag: tags.bool,
|
|
50
|
-
class: 'text-
|
|
50
|
+
class: 'text-teal-text',
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
53
|
tag: tags.string,
|
|
54
|
-
class: 'text-
|
|
54
|
+
class: 'text-teal-text',
|
|
55
55
|
},
|
|
56
56
|
// Error.
|
|
57
57
|
{
|
|
58
58
|
tag: tags.invalid,
|
|
59
|
-
class: 'text-
|
|
59
|
+
class: 'text-un-accent',
|
|
60
60
|
},
|
|
61
61
|
]);
|
|
62
62
|
|
|
@@ -75,7 +75,10 @@ export type SheetExtensionOptions = {
|
|
|
75
75
|
* https://hyperformula.handsontable.com/guide/key-concepts.html#grammar
|
|
76
76
|
*/
|
|
77
77
|
export const sheetExtension = ({ debug, functions = [] }: SheetExtensionOptions): Extension => {
|
|
78
|
-
const { extension, language } = spreadsheet({
|
|
78
|
+
const { extension, language } = spreadsheet({
|
|
79
|
+
idiom: 'en-US',
|
|
80
|
+
decimalSeparator: '.',
|
|
81
|
+
});
|
|
79
82
|
|
|
80
83
|
const createCompletion = (name: string) => {
|
|
81
84
|
const { section = 'Custom', description, syntax } = functions.find((value) => value.name === name) ?? {};
|
|
@@ -94,7 +97,7 @@ export const sheetExtension = ({ debug, functions = [] }: SheetExtensionOptions)
|
|
|
94
97
|
|
|
95
98
|
const title = document.createElement('h2');
|
|
96
99
|
title.innerText = name;
|
|
97
|
-
title.className = 'text-lg font-mono text-
|
|
100
|
+
title.className = 'text-lg font-mono text-accent-text';
|
|
98
101
|
root.appendChild(title);
|
|
99
102
|
|
|
100
103
|
if (description) {
|
|
@@ -107,7 +110,7 @@ export const sheetExtension = ({ debug, functions = [] }: SheetExtensionOptions)
|
|
|
107
110
|
if (syntax) {
|
|
108
111
|
const detail = document.createElement('pre');
|
|
109
112
|
detail.innerText = syntax;
|
|
110
|
-
detail.className = 'whitespace-pre-wrap text-
|
|
113
|
+
detail.className = 'whitespace-pre-wrap text-green-text';
|
|
111
114
|
root.appendChild(detail);
|
|
112
115
|
}
|
|
113
116
|
|
|
@@ -166,8 +169,8 @@ export const sheetExtension = ({ debug, functions = [] }: SheetExtensionOptions)
|
|
|
166
169
|
icons: false,
|
|
167
170
|
tooltipClass: () =>
|
|
168
171
|
mx(
|
|
169
|
-
'!-left-[1px] !top-[33px] !-m-0 border
|
|
170
|
-
'[&>ul>li[aria-selected]]:!bg-
|
|
172
|
+
'!-left-[1px] !top-[33px] !-m-0 border border-h-0! [&>ul]:!min-w-[198px]',
|
|
173
|
+
'[&>ul>li[aria-selected]]:!bg-accent-surface',
|
|
171
174
|
'border-separator',
|
|
172
175
|
),
|
|
173
176
|
}),
|
package/src/index.ts
CHANGED
|
@@ -2,23 +2,19 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import * as Function from 'effect/Function';
|
|
6
|
-
import * as Schema from 'effect/Schema';
|
|
7
5
|
import { useCallback, useEffect, useMemo } from 'react';
|
|
8
6
|
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
7
|
+
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
8
|
+
import { companionSegment } from '@dxos/app-toolkit';
|
|
11
9
|
import { debounce } from '@dxos/async';
|
|
12
10
|
import { type CellAddress, type CompleteCellRange, inRange } from '@dxos/compute';
|
|
13
11
|
import { Obj, Relation } from '@dxos/echo';
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { Filter, Query,
|
|
17
|
-
import {
|
|
18
|
-
import { AnchoredTo } from '@dxos/types';
|
|
12
|
+
import { DeckOperation } from '@dxos/plugin-deck/operations';
|
|
13
|
+
import { ThreadOperation } from '@dxos/plugin-thread/operations';
|
|
14
|
+
import { Filter, Query, useQuery } from '@dxos/react-client/echo';
|
|
15
|
+
import { AnchoredTo, Thread } from '@dxos/types';
|
|
19
16
|
|
|
20
17
|
import { useSheetContext } from '../components';
|
|
21
|
-
import { meta } from '../meta';
|
|
22
18
|
|
|
23
19
|
export const completeCellRangeToThreadCursor = (range: CompleteCellRange): string => {
|
|
24
20
|
return `${range.from.col},${range.from.row},${range.to.col},${range.to.row}`;
|
|
@@ -37,45 +33,12 @@ export const parseThreadAnchorAsCellRange = (cursor: string): CompleteCellRange
|
|
|
37
33
|
}
|
|
38
34
|
};
|
|
39
35
|
|
|
40
|
-
export const useUpdateFocusedCellOnThreadSelection = (grid: DxGridElement | null) => {
|
|
41
|
-
const { model, setActiveRefs } = useSheetContext();
|
|
42
|
-
const scrollIntoViewResolver = useMemo(
|
|
43
|
-
() =>
|
|
44
|
-
createResolver({
|
|
45
|
-
intent: LayoutAction.ScrollIntoView,
|
|
46
|
-
position: 'hoist',
|
|
47
|
-
filter: (
|
|
48
|
-
data,
|
|
49
|
-
): data is {
|
|
50
|
-
part: 'current';
|
|
51
|
-
subject: string;
|
|
52
|
-
options: { cursor: string; ref: GridContentProps['activeRefs'] };
|
|
53
|
-
} => {
|
|
54
|
-
if (!Schema.is(LayoutAction.ScrollIntoView.fields.input)(data)) {
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return data.subject === Obj.getDXN(model.sheet).toString() && !!data.options?.cursor;
|
|
59
|
-
},
|
|
60
|
-
resolve: ({ options: { cursor, ref } }) => {
|
|
61
|
-
setActiveRefs(ref);
|
|
62
|
-
// TODO(Zan): Everywhere we refer to the cursor in a thread context should change to `anchor`.
|
|
63
|
-
const range = parseThreadAnchorAsCellRange(cursor!);
|
|
64
|
-
range && grid?.setFocus({ ...range.to, plane: 'grid' }, true);
|
|
65
|
-
},
|
|
66
|
-
}),
|
|
67
|
-
[model.sheet, setActiveRefs],
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
useIntentResolver(meta.id, scrollIntoViewResolver);
|
|
71
|
-
};
|
|
72
|
-
|
|
73
36
|
export const useSelectThreadOnCellFocus = () => {
|
|
74
37
|
const { model, cursor } = useSheetContext();
|
|
75
|
-
const {
|
|
38
|
+
const { invokePromise } = useOperationInvoker();
|
|
76
39
|
|
|
77
|
-
const
|
|
78
|
-
const anchors = useQuery(
|
|
40
|
+
const db = Obj.getDatabase(model.sheet);
|
|
41
|
+
const anchors = useQuery(db, Query.select(Filter.id(model.sheet.id)).targetOf(AnchoredTo.AnchoredTo));
|
|
79
42
|
|
|
80
43
|
const selectClosestThread = useCallback(
|
|
81
44
|
(cellAddress: CellAddress) => {
|
|
@@ -94,15 +57,15 @@ export const useSelectThreadOnCellFocus = () => {
|
|
|
94
57
|
});
|
|
95
58
|
|
|
96
59
|
if (closestThread) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
60
|
+
void (async () => {
|
|
61
|
+
await invokePromise(ThreadOperation.Select, { current: Relation.getDXN(closestThread).toString() });
|
|
62
|
+
await invokePromise(DeckOperation.ChangeCompanion, {
|
|
63
|
+
companion: companionSegment('comments'),
|
|
64
|
+
});
|
|
65
|
+
})();
|
|
103
66
|
}
|
|
104
67
|
},
|
|
105
|
-
[
|
|
68
|
+
[invokePromise, anchors],
|
|
106
69
|
);
|
|
107
70
|
|
|
108
71
|
const debounced = useMemo(() => {
|
package/src/meta.ts
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Plugin } from '@dxos/app-framework';
|
|
6
6
|
import { trim } from '@dxos/util';
|
|
7
7
|
|
|
8
|
-
export const meta:
|
|
9
|
-
id: 'dxos.
|
|
8
|
+
export const meta: Plugin.Meta = {
|
|
9
|
+
id: 'org.dxos.plugin.sheet',
|
|
10
10
|
name: 'Sheet',
|
|
11
11
|
description: trim`
|
|
12
12
|
Full-featured spreadsheet application with over 400 built-in formulas for calculations and data analysis.
|
|
@@ -7,8 +7,8 @@ import { afterEach, beforeEach, describe, expect, onTestFinished, test } from 'v
|
|
|
7
7
|
import { Trigger } from '@dxos/async';
|
|
8
8
|
import { type CellScalarValue, addressFromA1Notation, isFormula } from '@dxos/compute';
|
|
9
9
|
import { TestBuilder, testFunctionPlugins } from '@dxos/compute/testing';
|
|
10
|
-
import { Function } from '@dxos/functions';
|
|
11
10
|
import { log } from '@dxos/log';
|
|
11
|
+
import { Operation } from '@dxos/operation';
|
|
12
12
|
|
|
13
13
|
import { Sheet, mapFormulaIndicesToRefs, mapFormulaRefsToIndices } from '../types';
|
|
14
14
|
|
|
@@ -18,7 +18,7 @@ import { createTestGrid } from './testing';
|
|
|
18
18
|
describe('SheetModel', () => {
|
|
19
19
|
let testBuilder: TestBuilder;
|
|
20
20
|
beforeEach(async () => {
|
|
21
|
-
testBuilder = new TestBuilder({ types: [
|
|
21
|
+
testBuilder = new TestBuilder({ types: [Operation.PersistentOperation], plugins: testFunctionPlugins });
|
|
22
22
|
await testBuilder.open();
|
|
23
23
|
});
|
|
24
24
|
afterEach(async () => {
|
package/src/model/sheet-model.ts
CHANGED
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
} from '@dxos/compute';
|
|
24
24
|
import { Resource } from '@dxos/context';
|
|
25
25
|
import { Obj } from '@dxos/echo';
|
|
26
|
-
import {
|
|
26
|
+
import { Format, TypeEnum } from '@dxos/echo/internal';
|
|
27
27
|
import { invariant } from '@dxos/invariant';
|
|
28
28
|
import { PublicKey } from '@dxos/keys';
|
|
29
29
|
import { log } from '@dxos/log';
|
|
@@ -46,14 +46,14 @@ import { type Sheet, type SheetAction } from '../types';
|
|
|
46
46
|
// https://hyperformula.handsontable.com/guide/types-of-values.html
|
|
47
47
|
// - https://github.com/handsontable/hyperformula/blob/master/src/Cell.ts (CellValueType)
|
|
48
48
|
// - https://github.com/handsontable/hyperformula/blob/master/src/interpreter/InterpreterValue.ts (NumberType)
|
|
49
|
-
const typeMap: Record<string, { type: TypeEnum; format?:
|
|
49
|
+
const typeMap: Record<string, { type: TypeEnum; format?: Format.TypeFormat }> = {
|
|
50
50
|
BOOLEAN: { type: TypeEnum.Boolean },
|
|
51
51
|
NUMBER_RAW: { type: TypeEnum.Number },
|
|
52
|
-
NUMBER_PERCENT: { type: TypeEnum.Number, format:
|
|
53
|
-
NUMBER_CURRENCY: { type: TypeEnum.Number, format:
|
|
54
|
-
NUMBER_DATETIME: { type: TypeEnum.String, format:
|
|
55
|
-
NUMBER_DATE: { type: TypeEnum.String, format:
|
|
56
|
-
NUMBER_TIME: { type: TypeEnum.String, format:
|
|
52
|
+
NUMBER_PERCENT: { type: TypeEnum.Number, format: Format.TypeFormat.Percent },
|
|
53
|
+
NUMBER_CURRENCY: { type: TypeEnum.Number, format: Format.TypeFormat.Currency },
|
|
54
|
+
NUMBER_DATETIME: { type: TypeEnum.String, format: Format.TypeFormat.DateTime },
|
|
55
|
+
NUMBER_DATE: { type: TypeEnum.String, format: Format.TypeFormat.Date },
|
|
56
|
+
NUMBER_TIME: { type: TypeEnum.String, format: Format.TypeFormat.Time },
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
const getTopLeft = (range: CellRange): CellAddress => {
|
|
@@ -122,7 +122,9 @@ export class SheetModel extends Resource {
|
|
|
122
122
|
*/
|
|
123
123
|
protected override async _open(): Promise<void> {
|
|
124
124
|
log('initialize', { id: this.id });
|
|
125
|
-
|
|
125
|
+
Obj.change(this._sheet, (obj) => {
|
|
126
|
+
initialize(obj);
|
|
127
|
+
});
|
|
126
128
|
|
|
127
129
|
this._graph.update.on((event) => {
|
|
128
130
|
if (event.type === 'functionsUpdated') {
|
|
@@ -181,13 +183,19 @@ export class SheetModel extends Resource {
|
|
|
181
183
|
}
|
|
182
184
|
|
|
183
185
|
insertRows(i: number, n = 1): string[] {
|
|
184
|
-
|
|
186
|
+
let idx: string[] = [];
|
|
187
|
+
Obj.change(this._sheet, (obj) => {
|
|
188
|
+
idx = insertIndices(obj.rows, i, n, MAX_ROWS);
|
|
189
|
+
});
|
|
185
190
|
this.reset();
|
|
186
191
|
return idx;
|
|
187
192
|
}
|
|
188
193
|
|
|
189
194
|
insertColumns(i: number, n = 1): string[] {
|
|
190
|
-
|
|
195
|
+
let idx: string[] = [];
|
|
196
|
+
Obj.change(this._sheet, (obj) => {
|
|
197
|
+
idx = insertIndices(obj.columns, i, n, MAX_COLS);
|
|
198
|
+
});
|
|
191
199
|
this.reset();
|
|
192
200
|
return idx;
|
|
193
201
|
}
|
|
@@ -200,8 +208,10 @@ export class SheetModel extends Resource {
|
|
|
200
208
|
const values = this.getCellValues(range).flat();
|
|
201
209
|
const index = this._sheet.rows.indexOf(rowIndex);
|
|
202
210
|
this.clear(range);
|
|
203
|
-
this._sheet
|
|
204
|
-
|
|
211
|
+
Obj.change(this._sheet, (obj) => {
|
|
212
|
+
obj.rows.splice(index, 1);
|
|
213
|
+
delete obj.rowMeta[rowIndex];
|
|
214
|
+
});
|
|
205
215
|
this.reset();
|
|
206
216
|
return { axis: 'row', index, axisIndex: rowIndex, axisMeta: this._sheet.rowMeta[rowIndex], values };
|
|
207
217
|
}
|
|
@@ -214,35 +224,43 @@ export class SheetModel extends Resource {
|
|
|
214
224
|
const values = this.getCellValues(range).flat();
|
|
215
225
|
const index = this._sheet.columns.indexOf(colIndex);
|
|
216
226
|
this.clear(range);
|
|
217
|
-
this._sheet
|
|
218
|
-
|
|
227
|
+
Obj.change(this._sheet, (obj) => {
|
|
228
|
+
obj.columns.splice(index, 1);
|
|
229
|
+
delete obj.columnMeta[colIndex];
|
|
230
|
+
});
|
|
219
231
|
this.reset();
|
|
220
232
|
return { axis: 'col', index, axisIndex: colIndex, axisMeta: this._sheet.rowMeta[colIndex], values };
|
|
221
233
|
}
|
|
222
234
|
|
|
223
235
|
restoreRow({ index, axisIndex, axisMeta, values }: SheetAction.RestoreAxis): void {
|
|
224
|
-
this._sheet
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
236
|
+
Obj.change(this._sheet, (obj) => {
|
|
237
|
+
obj.rows.splice(index, 0, axisIndex);
|
|
238
|
+
values.forEach((value, col) => {
|
|
239
|
+
if (value) {
|
|
240
|
+
obj.cells[`${obj.columns[col]}@${axisIndex}`] = { value };
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
if (axisMeta) {
|
|
245
|
+
obj.rowMeta[axisIndex] = axisMeta;
|
|
228
246
|
}
|
|
229
247
|
});
|
|
230
|
-
if (axisMeta) {
|
|
231
|
-
this._sheet.rowMeta[axisIndex] = axisMeta;
|
|
232
|
-
}
|
|
233
248
|
this.reset();
|
|
234
249
|
}
|
|
235
250
|
|
|
236
251
|
restoreColumn({ index, axisIndex, axisMeta, values }: SheetAction.RestoreAxis): void {
|
|
237
|
-
this._sheet
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
252
|
+
Obj.change(this._sheet, (obj) => {
|
|
253
|
+
obj.columns.splice(index, 0, axisIndex);
|
|
254
|
+
values.forEach((value, row) => {
|
|
255
|
+
if (value) {
|
|
256
|
+
obj.cells[`${axisIndex}@${obj.rows[row]}`] = { value };
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
if (axisMeta) {
|
|
261
|
+
obj.columnMeta[axisIndex] = axisMeta;
|
|
241
262
|
}
|
|
242
263
|
});
|
|
243
|
-
if (axisMeta) {
|
|
244
|
-
this._sheet.columnMeta[axisIndex] = axisMeta;
|
|
245
|
-
}
|
|
246
264
|
this.reset();
|
|
247
265
|
}
|
|
248
266
|
|
|
@@ -259,18 +277,22 @@ export class SheetModel extends Resource {
|
|
|
259
277
|
const topLeft = getTopLeft(range);
|
|
260
278
|
const values = this._iterRange(range, () => null);
|
|
261
279
|
this._node.graph.hf.setCellContents(toSimpleCellAddress(this._node.sheetId, topLeft), values);
|
|
262
|
-
this.
|
|
263
|
-
|
|
264
|
-
|
|
280
|
+
Obj.change(this._sheet, (obj) => {
|
|
281
|
+
this._iterRange(range, (cell) => {
|
|
282
|
+
const idx = addressToIndex(this._sheet, cell);
|
|
283
|
+
delete obj.cells[idx];
|
|
284
|
+
});
|
|
265
285
|
});
|
|
266
286
|
}
|
|
267
287
|
|
|
268
288
|
cut(range: CellRange): void {
|
|
269
289
|
invariant(this._node);
|
|
270
290
|
this._node.graph.hf.cut(toModelRange(this._node.sheetId, range));
|
|
271
|
-
this.
|
|
272
|
-
|
|
273
|
-
|
|
291
|
+
Obj.change(this._sheet, (obj) => {
|
|
292
|
+
this._iterRange(range, (cell) => {
|
|
293
|
+
const idx = addressToIndex(this._sheet, cell);
|
|
294
|
+
delete obj.cells[idx];
|
|
295
|
+
});
|
|
274
296
|
});
|
|
275
297
|
}
|
|
276
298
|
|
|
@@ -283,13 +305,15 @@ export class SheetModel extends Resource {
|
|
|
283
305
|
invariant(this._node);
|
|
284
306
|
if (!this._node.graph.hf.isClipboardEmpty()) {
|
|
285
307
|
const changes = this._node.graph.hf.paste(toSimpleCellAddress(this._node.sheetId, cell));
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
308
|
+
Obj.change(this._sheet, (obj) => {
|
|
309
|
+
for (const change of changes) {
|
|
310
|
+
if (change instanceof ExportedCellChange) {
|
|
311
|
+
const { address, newValue } = change;
|
|
312
|
+
const idx = addressToIndex(this._sheet, { row: address.row, col: address.col });
|
|
313
|
+
obj.cells[idx] = { value: newValue };
|
|
314
|
+
}
|
|
291
315
|
}
|
|
292
|
-
}
|
|
316
|
+
});
|
|
293
317
|
}
|
|
294
318
|
}
|
|
295
319
|
|
|
@@ -361,7 +385,7 @@ export class SheetModel extends Resource {
|
|
|
361
385
|
/**
|
|
362
386
|
* Get value type.
|
|
363
387
|
*/
|
|
364
|
-
getValueDescription(cell: CellAddress): { type: TypeEnum; format?:
|
|
388
|
+
getValueDescription(cell: CellAddress): { type: TypeEnum; format?: Format.TypeFormat } | undefined {
|
|
365
389
|
invariant(this._node);
|
|
366
390
|
const addr = toSimpleCellAddress(this._node.sheetId, cell);
|
|
367
391
|
const type = this._node.graph.hf.getCellValueDetailedType(addr);
|
|
@@ -380,11 +404,15 @@ export class SheetModel extends Resource {
|
|
|
380
404
|
// Reallocate if > current bounds.
|
|
381
405
|
let refresh = false;
|
|
382
406
|
if (cell.row >= this._sheet.rows.length) {
|
|
383
|
-
|
|
407
|
+
Obj.change(this._sheet, (obj) => {
|
|
408
|
+
insertIndices(obj.rows, cell.row, 1, MAX_ROWS);
|
|
409
|
+
});
|
|
384
410
|
refresh = true;
|
|
385
411
|
}
|
|
386
412
|
if (cell.col >= this._sheet.columns.length) {
|
|
387
|
-
|
|
413
|
+
Obj.change(this._sheet, (obj) => {
|
|
414
|
+
insertIndices(obj.columns, cell.col, 1, MAX_COLS);
|
|
415
|
+
});
|
|
388
416
|
refresh = true;
|
|
389
417
|
}
|
|
390
418
|
|
|
@@ -401,13 +429,17 @@ export class SheetModel extends Resource {
|
|
|
401
429
|
// Insert into sheet.
|
|
402
430
|
const idx = addressToIndex(this._sheet, cell);
|
|
403
431
|
if (value === undefined || value === null) {
|
|
404
|
-
|
|
432
|
+
Obj.change(this._sheet, (obj) => {
|
|
433
|
+
delete obj.cells[idx];
|
|
434
|
+
});
|
|
405
435
|
} else {
|
|
406
436
|
if (isFormula(value)) {
|
|
407
437
|
value = this._graph.mapFunctionBindingToId(mapFormulaRefsToIndices(this._sheet, value));
|
|
408
438
|
}
|
|
409
439
|
|
|
410
|
-
this._sheet
|
|
440
|
+
Obj.change(this._sheet, (obj) => {
|
|
441
|
+
obj.cells[idx] = { value };
|
|
442
|
+
});
|
|
411
443
|
}
|
|
412
444
|
}
|
|
413
445
|
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { Operation } from '@dxos/operation';
|
|
9
|
+
|
|
10
|
+
import { meta } from '../meta';
|
|
11
|
+
|
|
12
|
+
const SHEET_OPERATION = `${meta.id}.operation`;
|
|
13
|
+
|
|
14
|
+
// TODO(wittjosiah): Factor out. This is `DxGridAxis` from `@dxos/react-ui-grid`.
|
|
15
|
+
const Axis = Schema.Union(Schema.Literal('row'), Schema.Literal('col'));
|
|
16
|
+
|
|
17
|
+
export const InsertAxis = Operation.make({
|
|
18
|
+
meta: { key: `${SHEET_OPERATION}.axis-insert`, name: 'Insert Axis' },
|
|
19
|
+
input: Schema.Struct({
|
|
20
|
+
model: Schema.Any,
|
|
21
|
+
axis: Axis,
|
|
22
|
+
index: Schema.Number,
|
|
23
|
+
count: Schema.optional(Schema.Number),
|
|
24
|
+
}),
|
|
25
|
+
output: Schema.Void,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export const DropAxisOutput = Schema.Struct({
|
|
29
|
+
axis: Axis.annotations({ description: 'The axis type (row or col).' }),
|
|
30
|
+
axisIndex: Schema.String.annotations({ description: 'The dropped axis index.' }),
|
|
31
|
+
index: Schema.Number.annotations({ description: 'The position the axis was at.' }),
|
|
32
|
+
axisMeta: Schema.Any.annotations({ description: 'The row/column metadata.' }),
|
|
33
|
+
values: Schema.Array(Schema.Any).annotations({ description: 'The cell values that were dropped.' }),
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export type DropAxisOutput = Schema.Schema.Type<typeof DropAxisOutput>;
|
|
37
|
+
|
|
38
|
+
export const DropAxis = Operation.make({
|
|
39
|
+
meta: { key: `${SHEET_OPERATION}.axis-drop`, name: 'Drop Axis' },
|
|
40
|
+
input: Schema.Struct({
|
|
41
|
+
model: Schema.Any,
|
|
42
|
+
axis: Axis,
|
|
43
|
+
axisIndex: Schema.String,
|
|
44
|
+
}),
|
|
45
|
+
output: DropAxisOutput,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export const ScrollToAnchor = Operation.make({
|
|
49
|
+
meta: { key: `${SHEET_OPERATION}.scroll-to-anchor`, name: 'Scroll To Anchor' },
|
|
50
|
+
services: [Capability.Service],
|
|
51
|
+
input: Schema.Struct({
|
|
52
|
+
subject: Schema.String.annotations({ description: 'Attendable ID of the sheet.' }),
|
|
53
|
+
cursor: Schema.String.annotations({ description: 'Cell range coordinates.' }),
|
|
54
|
+
ref: Schema.optional(Schema.Any.annotations({ description: 'Active refs for highlighting.' })),
|
|
55
|
+
}),
|
|
56
|
+
output: Schema.Void,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Restore a dropped axis (inverse of DropAxis).
|
|
61
|
+
*/
|
|
62
|
+
export const RestoreAxis = Operation.make({
|
|
63
|
+
meta: { key: `${SHEET_OPERATION}.restore-axis`, name: 'Restore Axis' },
|
|
64
|
+
input: Schema.Struct({
|
|
65
|
+
model: Schema.Any.annotations({ description: 'The sheet model.' }),
|
|
66
|
+
axis: Axis.annotations({ description: 'The axis type (row or col).' }),
|
|
67
|
+
axisIndex: Schema.String.annotations({ description: 'The axis index to restore.' }),
|
|
68
|
+
index: Schema.Number.annotations({ description: 'The position to restore at.' }),
|
|
69
|
+
axisMeta: Schema.Any.annotations({ description: 'The row/column metadata.' }),
|
|
70
|
+
values: Schema.Array(Schema.Any).annotations({ description: 'The cell values to restore.' }),
|
|
71
|
+
}),
|
|
72
|
+
output: Schema.Void,
|
|
73
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Operation } from '@dxos/operation';
|
|
8
|
+
|
|
9
|
+
import { DropAxis } from './definitions';
|
|
10
|
+
|
|
11
|
+
const handler: Operation.WithHandler<typeof DropAxis> = DropAxis.pipe(
|
|
12
|
+
Operation.withHandler(({ model, axis, axisIndex }) =>
|
|
13
|
+
Effect.sync(() => {
|
|
14
|
+
const undoData = model[axis === 'col' ? 'dropColumn' : 'dropRow'](axisIndex);
|
|
15
|
+
return {
|
|
16
|
+
axis: undoData.axis,
|
|
17
|
+
axisIndex: undoData.axisIndex,
|
|
18
|
+
index: undoData.index,
|
|
19
|
+
axisMeta: undoData.axisMeta,
|
|
20
|
+
values: undoData.values,
|
|
21
|
+
};
|
|
22
|
+
}),
|
|
23
|
+
),
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export default handler;
|