@dxos/plugin-sheet 0.8.4-main.c1de068 → 0.8.4-main.c85a9c8dae
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-S3SHV7T6.mjs +53 -0
- package/dist/lib/browser/RangeList-S3SHV7T6.mjs.map +7 -0
- package/dist/lib/browser/SheetContainer-I3NFVVDQ.mjs +1805 -0
- package/dist/lib/browser/SheetContainer-I3NFVVDQ.mjs.map +7 -0
- package/dist/lib/browser/anchor-sort-DZ3IHHJJ.mjs +24 -0
- package/dist/lib/browser/anchor-sort-DZ3IHHJJ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-7HQX4NQP.mjs → chunk-NNWF7EKC.mjs} +14 -14
- package/dist/lib/browser/chunk-NNWF7EKC.mjs.map +7 -0
- package/dist/lib/browser/chunk-S445OQGW.mjs +397 -0
- package/dist/lib/browser/chunk-S445OQGW.mjs.map +7 -0
- package/dist/lib/browser/compute-graph-registry-W6HO2G3P.mjs +21 -0
- package/dist/lib/browser/compute-graph-registry-W6HO2G3P.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +72 -82
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/markdown-S6GVLHB4.mjs +29 -0
- package/dist/lib/browser/markdown-S6GVLHB4.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-Z4X4UWNR.mjs +79 -0
- package/dist/lib/browser/operation-resolver-Z4X4UWNR.mjs.map +7 -0
- package/dist/lib/browser/react-surface-KIU6DGKW.mjs +51 -0
- package/dist/lib/browser/react-surface-KIU6DGKW.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +7 -12
- package/dist/lib/node-esm/RangeList-IB23OJK2.mjs +54 -0
- package/dist/lib/node-esm/RangeList-IB23OJK2.mjs.map +7 -0
- package/dist/lib/node-esm/SheetContainer-KUXNCSFP.mjs +1806 -0
- package/dist/lib/node-esm/SheetContainer-KUXNCSFP.mjs.map +7 -0
- package/dist/lib/node-esm/anchor-sort-24OXMOSX.mjs +25 -0
- package/dist/lib/node-esm/anchor-sort-24OXMOSX.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-Q6UYC4G5.mjs → chunk-M52YLLWU.mjs} +14 -14
- package/dist/lib/node-esm/chunk-M52YLLWU.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-NKZ3O4OR.mjs +398 -0
- package/dist/lib/node-esm/chunk-NKZ3O4OR.mjs.map +7 -0
- package/dist/lib/node-esm/compute-graph-registry-2C3Y2RPQ.mjs +22 -0
- package/dist/lib/node-esm/compute-graph-registry-2C3Y2RPQ.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +72 -82
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/markdown-YT5KJTQT.mjs +30 -0
- package/dist/lib/node-esm/markdown-YT5KJTQT.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operation-resolver-7VD2YXSQ.mjs +80 -0
- package/dist/lib/node-esm/operation-resolver-7VD2YXSQ.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-7FZAE3S7.mjs +52 -0
- package/dist/lib/node-esm/react-surface-7FZAE3S7.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +7 -12
- 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 +5 -11
- 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-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.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/components/ComputeGraph/ComputeGraphContextProvider.d.ts.map +1 -1
- package/dist/types/src/components/ComputeGraph/compute-graph.stories.d.ts +9 -4
- package/dist/types/src/components/ComputeGraph/compute-graph.stories.d.ts.map +1 -1
- package/dist/types/src/components/Sheet/Sheet.d.ts +11 -0
- package/dist/types/src/components/Sheet/Sheet.d.ts.map +1 -0
- package/dist/types/src/components/Sheet/index.d.ts +2 -0
- package/dist/types/src/components/Sheet/index.d.ts.map +1 -0
- package/dist/types/src/components/SheetContent/SheetCellEditor.stories.d.ts +16 -0
- package/dist/types/src/components/SheetContent/SheetCellEditor.stories.d.ts.map +1 -0
- package/dist/types/src/components/SheetContent/SheetContent.d.ts +5 -0
- package/dist/types/src/components/SheetContent/SheetContent.d.ts.map +1 -0
- package/dist/types/src/components/SheetContent/SheetContent.stories.d.ts +55 -0
- package/dist/types/src/components/SheetContent/SheetContent.stories.d.ts.map +1 -0
- package/dist/types/src/components/SheetContent/index.d.ts +2 -0
- package/dist/types/src/components/SheetContent/index.d.ts.map +1 -0
- package/dist/types/src/components/{GridSheet → SheetContent}/util.d.ts +1 -1
- package/dist/types/src/components/SheetContent/util.d.ts.map +1 -0
- package/dist/types/src/components/{SheetContext/SheetContext.d.ts → SheetRoot/SheetRoot.d.ts} +7 -7
- 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 +5 -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 +6 -4
- package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts +88 -4
- package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/align.d.ts +13 -20
- 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 +2 -2
- package/dist/types/src/containers/RangeList/RangeList.d.ts.map +1 -0
- 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/containers/SheetContainer/SheetContainer.stories.d.ts +56 -0
- 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.d.ts +1 -1
- package/dist/types/src/extensions/compute.d.ts.map +1 -1
- package/dist/types/src/extensions/compute.stories.d.ts +10 -13
- package/dist/types/src/extensions/compute.stories.d.ts.map +1 -1
- package/dist/types/src/extensions/editor/index.d.ts +1 -1
- package/dist/types/src/extensions/editor/index.d.ts.map +1 -1
- package/dist/types/src/extensions/editor/{extension.d.ts → sheet-extension.d.ts} +1 -1
- package/dist/types/src/extensions/editor/sheet-extension.d.ts.map +1 -0
- package/dist/types/src/extensions/editor/sheet-extension.test.d.ts +2 -0
- package/dist/types/src/extensions/editor/sheet-extension.test.d.ts.map +1 -0
- 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.map +1 -1
- package/dist/types/src/meta.d.ts +2 -3
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/model/sheet-model.d.ts +6 -6
- package/dist/types/src/model/sheet-model.d.ts.map +1 -1
- package/dist/types/src/model/testing.d.ts +2 -2
- package/dist/types/src/model/testing.d.ts.map +1 -1
- package/dist/types/src/model/useSheetModel.d.ts +2 -2
- package/dist/types/src/model/useSheetModel.d.ts.map +1 -1
- package/dist/types/src/playwright/sheet-manager.d.ts +1 -1
- package/dist/types/src/playwright/sheet-manager.d.ts.map +1 -1
- package/dist/types/src/serializer.d.ts +2 -2
- package/dist/types/src/serializer.d.ts.map +1 -1
- package/dist/types/src/testing/data.d.ts +2 -2
- package/dist/types/src/testing/data.d.ts.map +1 -1
- package/dist/types/src/testing/testing.d.ts +27 -3
- package/dist/types/src/testing/testing.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +3 -2
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Sheet.d.ts +76 -0
- package/dist/types/src/types/Sheet.d.ts.map +1 -0
- package/dist/types/src/types/capabilities.d.ts +6 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +2 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/sheet-range-types.d.ts +2 -2
- package/dist/types/src/types/sheet-range-types.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +92 -75
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/types/util.d.ts +10 -10
- package/dist/types/src/types/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +81 -72
- package/src/SheetPlugin.tsx +52 -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 +5 -9
- package/src/capabilities/markdown/index.ts +7 -0
- package/src/capabilities/markdown/markdown.ts +30 -0
- package/src/capabilities/operation-resolver/index.ts +7 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +77 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +46 -0
- package/src/components/ComputeGraph/ComputeGraphContextProvider.tsx +1 -1
- package/src/components/ComputeGraph/compute-graph.stories.tsx +22 -21
- package/src/components/Sheet/Sheet.tsx +20 -0
- package/src/components/Sheet/index.ts +5 -0
- package/src/components/SheetContent/SheetCellEditor.stories.tsx +94 -0
- package/src/components/SheetContent/SheetContent.stories.tsx +60 -0
- package/src/components/{GridSheet/GridSheet.tsx → SheetContent/SheetContent.tsx} +74 -60
- package/src/components/{RangeList → SheetContent}/index.ts +1 -1
- package/src/components/{GridSheet → SheetContent}/util.ts +20 -14
- package/src/components/{SheetContext/SheetContext.tsx → SheetRoot/SheetRoot.tsx} +43 -41
- package/src/components/{GridSheet → SheetRoot}/index.ts +1 -1
- package/src/components/{FunctionEditor/FunctionEditor.tsx → SheetStatusbar/SheetStatusbar.tsx} +10 -5
- package/src/components/{FunctionEditor → SheetStatusbar}/index.ts +1 -1
- package/src/components/SheetToolbar/SheetToolbar.stories.tsx +20 -14
- package/src/components/SheetToolbar/SheetToolbar.tsx +57 -46
- package/src/components/SheetToolbar/align.ts +49 -23
- package/src/components/SheetToolbar/style.ts +51 -21
- package/src/components/SheetToolbar/useToolbarState.ts +22 -5
- package/src/components/index.ts +1 -7
- package/src/{components → containers}/RangeList/RangeList.tsx +20 -15
- package/src/containers/RangeList/index.ts +7 -0
- package/src/containers/SheetContainer/SheetContainer.stories.tsx +94 -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 +46 -32
- package/src/extensions/compute.ts +3 -4
- package/src/extensions/editor/index.ts +1 -1
- package/src/extensions/editor/{extension.test.ts → sheet-extension.test.ts} +1 -1
- package/src/extensions/editor/{extension.ts → sheet-extension.ts} +16 -13
- package/src/index.ts +1 -1
- package/src/integrations/thread-ranges.ts +39 -49
- package/src/meta.ts +9 -7
- package/src/model/sheet-model.test.ts +5 -4
- package/src/model/sheet-model.ts +85 -53
- package/src/model/testing.ts +4 -4
- package/src/model/useSheetModel.ts +2 -2
- package/src/playwright/playwright.config.ts +1 -1
- package/src/playwright/sheet-manager.ts +1 -1
- package/src/playwright/sheet.spec.ts +3 -2
- package/src/sanity.test.ts +4 -5
- package/src/serializer.ts +4 -4
- package/src/testing/data.ts +2 -2
- package/src/testing/testing.tsx +11 -5
- package/src/translations.ts +3 -2
- package/src/types/Sheet.ts +97 -0
- package/src/types/capabilities.ts +14 -0
- package/src/types/index.ts +2 -1
- package/src/types/sheet-range-types.ts +5 -5
- package/src/types/types.ts +84 -49
- package/src/types/util.ts +14 -41
- package/dist/lib/browser/SheetContainer-KDGD4AVG.mjs +0 -351
- package/dist/lib/browser/SheetContainer-KDGD4AVG.mjs.map +0 -7
- package/dist/lib/browser/anchor-sort-VHURGBOY.mjs +0 -24
- package/dist/lib/browser/anchor-sort-VHURGBOY.mjs.map +0 -7
- package/dist/lib/browser/chunk-6AKBCBL4.mjs +0 -18
- package/dist/lib/browser/chunk-6AKBCBL4.mjs.map +0 -7
- package/dist/lib/browser/chunk-7HQX4NQP.mjs.map +0 -7
- package/dist/lib/browser/chunk-JUOVL3LE.mjs +0 -847
- package/dist/lib/browser/chunk-JUOVL3LE.mjs.map +0 -7
- package/dist/lib/browser/chunk-KJWZUQVA.mjs +0 -15
- package/dist/lib/browser/chunk-KJWZUQVA.mjs.map +0 -7
- package/dist/lib/browser/chunk-SI4X5GUR.mjs +0 -892
- package/dist/lib/browser/chunk-SI4X5GUR.mjs.map +0 -7
- package/dist/lib/browser/compute-graph-registry-VG7VP7IV.mjs +0 -30
- package/dist/lib/browser/compute-graph-registry-VG7VP7IV.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-WOJGZMSV.mjs +0 -56
- package/dist/lib/browser/intent-resolver-WOJGZMSV.mjs.map +0 -7
- package/dist/lib/browser/markdown-VXMIPUQC.mjs +0 -26
- package/dist/lib/browser/markdown-VXMIPUQC.mjs.map +0 -7
- package/dist/lib/browser/react-surface-SE4HGAEH.mjs +0 -53
- package/dist/lib/browser/react-surface-SE4HGAEH.mjs.map +0 -7
- package/dist/lib/node-esm/SheetContainer-RMG24NZC.mjs +0 -352
- package/dist/lib/node-esm/SheetContainer-RMG24NZC.mjs.map +0 -7
- package/dist/lib/node-esm/anchor-sort-CTJGOPET.mjs +0 -25
- package/dist/lib/node-esm/anchor-sort-CTJGOPET.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3K5VNYOF.mjs +0 -20
- package/dist/lib/node-esm/chunk-3K5VNYOF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6SK5LJ5S.mjs +0 -16
- package/dist/lib/node-esm/chunk-6SK5LJ5S.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CADTJFAS.mjs +0 -893
- package/dist/lib/node-esm/chunk-CADTJFAS.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-IFMIRCZH.mjs +0 -848
- package/dist/lib/node-esm/chunk-IFMIRCZH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Q6UYC4G5.mjs.map +0 -7
- package/dist/lib/node-esm/compute-graph-registry-3K3Q2A5T.mjs +0 -31
- package/dist/lib/node-esm/compute-graph-registry-3K3Q2A5T.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-PZRXBNIJ.mjs +0 -57
- package/dist/lib/node-esm/intent-resolver-PZRXBNIJ.mjs.map +0 -7
- package/dist/lib/node-esm/markdown-4VPQJZNZ.mjs +0 -27
- package/dist/lib/node-esm/markdown-4VPQJZNZ.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-LAU23XBH.mjs +0 -54
- package/dist/lib/node-esm/react-surface-LAU23XBH.mjs.map +0 -7
- package/dist/types/src/capabilities/anchor-sort.d.ts +0 -6
- 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 -6
- 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 +0 -7
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +0 -1
- package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts +0 -25
- package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts.map +0 -1
- package/dist/types/src/components/GridSheet/index.d.ts +0 -2
- package/dist/types/src/components/GridSheet/index.d.ts.map +0 -1
- package/dist/types/src/components/GridSheet/util.d.ts.map +0 -1
- package/dist/types/src/components/RangeList/RangeList.d.ts.map +0 -1
- package/dist/types/src/components/RangeList/index.d.ts +0 -2
- package/dist/types/src/components/RangeList/index.d.ts.map +0 -1
- package/dist/types/src/components/SheetContainer/SheetContainer.d.ts +0 -11
- package/dist/types/src/components/SheetContainer/SheetContainer.d.ts.map +0 -1
- package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts +0 -8
- 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/dist/types/src/extensions/editor/extension.d.ts.map +0 -1
- package/dist/types/src/extensions/editor/extension.test.d.ts +0 -2
- package/dist/types/src/extensions/editor/extension.test.d.ts.map +0 -1
- package/dist/types/src/types/schema.d.ts +0 -37
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/capabilities/anchor-sort.ts +0 -22
- package/src/capabilities/capabilities.ts +0 -14
- package/src/capabilities/compute-graph-registry.ts +0 -28
- package/src/capabilities/intent-resolver.ts +0 -38
- package/src/capabilities/markdown.ts +0 -22
- package/src/capabilities/react-surface.tsx +0 -39
- package/src/components/GridSheet/GridSheet.stories.tsx +0 -53
- package/src/components/GridSheet/SheetCellEditor.stories.tsx +0 -93
- package/src/components/SheetContainer/SheetContainer.stories.tsx +0 -89
- package/src/components/SheetContainer/SheetContainer.tsx +0 -36
- package/src/components/SheetContext/index.ts +0 -5
- package/src/types/schema.ts +0 -61
- /package/dist/types/src/{components → containers}/SheetContainer/index.d.ts +0 -0
|
@@ -2,28 +2,23 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
6
|
import { useCallback, useEffect, useMemo } from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
createResolver,
|
|
11
|
-
LayoutAction,
|
|
12
|
-
useIntentResolver,
|
|
13
|
-
useIntentDispatcher,
|
|
14
|
-
chain,
|
|
15
|
-
} from '@dxos/app-framework';
|
|
8
|
+
import { useOperationInvoker, useOperationResolver } from '@dxos/app-framework/ui';
|
|
9
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
16
10
|
import { debounce } from '@dxos/async';
|
|
17
11
|
import { type CellAddress, type CompleteCellRange, inRange } from '@dxos/compute';
|
|
18
12
|
import { Obj, Relation } from '@dxos/echo';
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
13
|
+
import { OperationResolver } from '@dxos/operation';
|
|
14
|
+
import { ATTENDABLE_PATH_SEPARATOR, DeckOperation } from '@dxos/plugin-deck/types';
|
|
15
|
+
import { ThreadOperation } from '@dxos/plugin-thread/types';
|
|
16
|
+
import { Filter, Query, useQuery } from '@dxos/react-client/echo';
|
|
22
17
|
import { type DxGridElement, type GridContentProps } from '@dxos/react-ui-grid';
|
|
23
|
-
import { AnchoredTo } from '@dxos/
|
|
18
|
+
import { AnchoredTo, Thread } from '@dxos/types';
|
|
24
19
|
|
|
25
20
|
import { useSheetContext } from '../components';
|
|
26
|
-
import {
|
|
21
|
+
import { meta } from '../meta';
|
|
27
22
|
|
|
28
23
|
export const completeCellRangeToThreadCursor = (range: CompleteCellRange): string => {
|
|
29
24
|
return `${range.from.col},${range.from.row},${range.to.col},${range.to.row}`;
|
|
@@ -44,43 +39,37 @@ export const parseThreadAnchorAsCellRange = (cursor: string): CompleteCellRange
|
|
|
44
39
|
|
|
45
40
|
export const useUpdateFocusedCellOnThreadSelection = (grid: DxGridElement | null) => {
|
|
46
41
|
const { model, setActiveRefs } = useSheetContext();
|
|
47
|
-
const
|
|
42
|
+
const sheetId = Obj.getDXN(model.sheet).toString();
|
|
43
|
+
|
|
44
|
+
const scrollIntoViewHandler = useMemo(
|
|
48
45
|
() =>
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
OperationResolver.make({
|
|
47
|
+
operation: LayoutOperation.ScrollIntoView,
|
|
51
48
|
position: 'hoist',
|
|
52
|
-
filter: (
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return data.subject === fullyQualifiedId(model.sheet) && !!data.options?.cursor;
|
|
64
|
-
},
|
|
65
|
-
resolve: ({ options: { cursor, ref } }) => {
|
|
66
|
-
setActiveRefs(ref);
|
|
67
|
-
// TODO(Zan): Everywhere we refer to the cursor in a thread context should change to `anchor`.
|
|
68
|
-
const range = parseThreadAnchorAsCellRange(cursor!);
|
|
69
|
-
range && grid?.setFocus({ ...range.to, plane: 'grid' }, true);
|
|
70
|
-
},
|
|
49
|
+
filter: (input) => input.subject === sheetId && !!input.cursor,
|
|
50
|
+
handler: (input) =>
|
|
51
|
+
Effect.sync(() => {
|
|
52
|
+
const { cursor, ref } = input;
|
|
53
|
+
if (cursor) {
|
|
54
|
+
setActiveRefs(ref as GridContentProps['activeRefs']);
|
|
55
|
+
// TODO(Zan): Everywhere we refer to the cursor in a thread context should change to `anchor`.
|
|
56
|
+
const range = parseThreadAnchorAsCellRange(cursor);
|
|
57
|
+
range && grid?.setFocus({ ...range.to, plane: 'grid' }, true);
|
|
58
|
+
}
|
|
59
|
+
}),
|
|
71
60
|
}),
|
|
72
|
-
[
|
|
61
|
+
[sheetId, setActiveRefs, grid],
|
|
73
62
|
);
|
|
74
63
|
|
|
75
|
-
|
|
64
|
+
useOperationResolver(meta.id, scrollIntoViewHandler);
|
|
76
65
|
};
|
|
77
66
|
|
|
78
67
|
export const useSelectThreadOnCellFocus = () => {
|
|
79
68
|
const { model, cursor } = useSheetContext();
|
|
80
|
-
const {
|
|
69
|
+
const { invokePromise } = useOperationInvoker();
|
|
81
70
|
|
|
82
|
-
const
|
|
83
|
-
const anchors = useQuery(
|
|
71
|
+
const db = Obj.getDatabase(model.sheet);
|
|
72
|
+
const anchors = useQuery(db, Query.select(Filter.id(model.sheet.id)).targetOf(AnchoredTo.AnchoredTo));
|
|
84
73
|
|
|
85
74
|
const selectClosestThread = useCallback(
|
|
86
75
|
(cellAddress: CellAddress) => {
|
|
@@ -90,7 +79,7 @@ export const useSelectThreadOnCellFocus = () => {
|
|
|
90
79
|
|
|
91
80
|
const closestThread = anchors.find((anchor) => {
|
|
92
81
|
const source = Relation.getSource(anchor);
|
|
93
|
-
if (anchor.anchor && Obj.instanceOf(
|
|
82
|
+
if (anchor.anchor && Obj.instanceOf(Thread.Thread, source)) {
|
|
94
83
|
const range = parseThreadAnchorAsCellRange(anchor.anchor);
|
|
95
84
|
return range ? inRange(range, cellAddress) : false;
|
|
96
85
|
} else {
|
|
@@ -99,15 +88,16 @@ export const useSelectThreadOnCellFocus = () => {
|
|
|
99
88
|
});
|
|
100
89
|
|
|
101
90
|
if (closestThread) {
|
|
102
|
-
const primary =
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
91
|
+
const primary = Obj.getDXN(model.sheet).toString();
|
|
92
|
+
void (async () => {
|
|
93
|
+
await invokePromise(ThreadOperation.Select, { current: Relation.getDXN(closestThread).toString() });
|
|
94
|
+
await invokePromise(DeckOperation.ChangeCompanion, {
|
|
95
|
+
companion: `${primary}${ATTENDABLE_PATH_SEPARATOR}comments`,
|
|
96
|
+
});
|
|
97
|
+
})();
|
|
108
98
|
}
|
|
109
99
|
},
|
|
110
|
-
[
|
|
100
|
+
[invokePromise, anchors],
|
|
111
101
|
);
|
|
112
102
|
|
|
113
103
|
const debounced = useMemo(() => {
|
package/src/meta.ts
CHANGED
|
@@ -2,16 +2,18 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { trim } from '@dxos/util';
|
|
6
7
|
|
|
7
|
-
export const
|
|
8
|
-
|
|
9
|
-
export const meta: PluginMeta = {
|
|
10
|
-
id: SHEET_PLUGIN,
|
|
8
|
+
export const meta: Plugin.Meta = {
|
|
9
|
+
id: 'dxos.org/plugin/sheet',
|
|
11
10
|
name: 'Sheet',
|
|
12
|
-
description:
|
|
13
|
-
|
|
11
|
+
description: trim`
|
|
12
|
+
Full-featured spreadsheet application with over 400 built-in formulas for calculations and data analysis.
|
|
13
|
+
Create custom JavaScript functions and integrate with AI agents for advanced automation.
|
|
14
|
+
`,
|
|
14
15
|
icon: 'ph--grid-nine--regular',
|
|
16
|
+
iconHue: 'indigo',
|
|
15
17
|
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-sheet',
|
|
16
18
|
screenshots: ['https://dxos.network/plugin-details-sheet-dark.png'],
|
|
17
19
|
};
|
|
@@ -7,17 +7,18 @@ 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 {
|
|
10
|
+
import { Function } from '@dxos/functions';
|
|
11
11
|
import { log } from '@dxos/log';
|
|
12
12
|
|
|
13
|
+
import { Sheet, mapFormulaIndicesToRefs, mapFormulaRefsToIndices } from '../types';
|
|
14
|
+
|
|
13
15
|
import { SheetModel } from './sheet-model';
|
|
14
16
|
import { createTestGrid } from './testing';
|
|
15
|
-
import { createSheet, mapFormulaIndicesToRefs, mapFormulaRefsToIndices } from '../types';
|
|
16
17
|
|
|
17
18
|
describe('SheetModel', () => {
|
|
18
19
|
let testBuilder: TestBuilder;
|
|
19
20
|
beforeEach(async () => {
|
|
20
|
-
testBuilder = new TestBuilder({ types: [
|
|
21
|
+
testBuilder = new TestBuilder({ types: [Function.Function], plugins: testFunctionPlugins });
|
|
21
22
|
await testBuilder.open();
|
|
22
23
|
});
|
|
23
24
|
afterEach(async () => {
|
|
@@ -30,7 +31,7 @@ describe('SheetModel', () => {
|
|
|
30
31
|
await graph.open();
|
|
31
32
|
|
|
32
33
|
// TODO(burdon): Create via factory.
|
|
33
|
-
const sheet =
|
|
34
|
+
const sheet = Sheet.make({ rows: 5, columns: 5 });
|
|
34
35
|
const model = new SheetModel(graph, sheet);
|
|
35
36
|
await model.open();
|
|
36
37
|
testBuilder.ctx.onDispose(() => model.close());
|
package/src/model/sheet-model.ts
CHANGED
|
@@ -4,10 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
import { Event } from '@dxos/async';
|
|
6
6
|
import {
|
|
7
|
-
addressFromA1Notation,
|
|
8
|
-
addressToA1Notation,
|
|
9
|
-
createSheetName,
|
|
10
|
-
isFormula,
|
|
11
7
|
type CellAddress,
|
|
12
8
|
type CellRange,
|
|
13
9
|
type CellScalarValue,
|
|
@@ -16,14 +12,18 @@ import {
|
|
|
16
12
|
type ComputeNodeEvent,
|
|
17
13
|
DetailedCellError,
|
|
18
14
|
ExportedCellChange,
|
|
19
|
-
type SimpleCellRange,
|
|
20
15
|
type SimpleCellAddress,
|
|
16
|
+
type SimpleCellRange,
|
|
21
17
|
type SimpleDate,
|
|
22
18
|
type SimpleDateTime,
|
|
19
|
+
addressFromA1Notation,
|
|
20
|
+
addressToA1Notation,
|
|
21
|
+
createSheetName,
|
|
22
|
+
isFormula,
|
|
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';
|
|
@@ -39,21 +39,21 @@ import {
|
|
|
39
39
|
mapFormulaIndicesToRefs,
|
|
40
40
|
mapFormulaRefsToIndices,
|
|
41
41
|
} from '../types';
|
|
42
|
-
import { type
|
|
42
|
+
import { type Sheet, type SheetAction } from '../types';
|
|
43
43
|
|
|
44
44
|
// TODO(burdon): Move to compute.
|
|
45
45
|
// Map sheet types to system types.
|
|
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 => {
|
|
@@ -92,7 +92,7 @@ export class SheetModel extends Resource {
|
|
|
92
92
|
|
|
93
93
|
constructor(
|
|
94
94
|
private readonly _graph: ComputeGraph,
|
|
95
|
-
private readonly _sheet:
|
|
95
|
+
private readonly _sheet: Sheet.Sheet,
|
|
96
96
|
private readonly _options: SheetModelOptions = {},
|
|
97
97
|
) {
|
|
98
98
|
super();
|
|
@@ -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,20 +429,24 @@ 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
|
|
|
414
446
|
/**
|
|
415
447
|
* Sets values from a simple map.
|
|
416
448
|
*/
|
|
417
|
-
setValues(values: Record<string, CellValue>): void {
|
|
449
|
+
setValues(values: Record<string, Sheet.CellValue>): void {
|
|
418
450
|
Object.entries(values).forEach(([key, { value }]) => {
|
|
419
451
|
this.setValue(addressFromA1Notation(key), value);
|
|
420
452
|
});
|
package/src/model/testing.ts
CHANGED
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
import { addressToA1Notation } from '@dxos/compute';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Sheet } from '../types';
|
|
8
8
|
|
|
9
9
|
// TODO(burdon): Create testing endpoint.
|
|
10
10
|
// TODO(burdon): Move to react-ui-sheet.
|
|
11
|
-
export const createTestGrid = ({ cols = 4, rows = 10 }: { cols: number; rows: number }):
|
|
11
|
+
export const createTestGrid = ({ cols = 4, rows = 10 }: { cols: number; rows: number }): Sheet.Sheet => {
|
|
12
12
|
const year = new Date().getFullYear();
|
|
13
13
|
|
|
14
|
-
const cells: Record<string, CellValue> = {};
|
|
14
|
+
const cells: Record<string, Sheet.CellValue> = {};
|
|
15
15
|
for (let col = 1; col <= cols; col++) {
|
|
16
16
|
for (let row = 1; row <= 10; row++) {
|
|
17
17
|
const cell = addressToA1Notation({ col, row });
|
|
@@ -27,7 +27,7 @@ export const createTestGrid = ({ cols = 4, rows = 10 }: { cols: number; rows: nu
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
const sheet =
|
|
30
|
+
const sheet = Sheet.make({
|
|
31
31
|
name: 'Test',
|
|
32
32
|
cells,
|
|
33
33
|
});
|
|
@@ -7,7 +7,7 @@ import { useEffect, useState } from 'react';
|
|
|
7
7
|
import { type ComputeGraph } from '@dxos/compute';
|
|
8
8
|
|
|
9
9
|
import { SheetModel } from '../model';
|
|
10
|
-
import { type
|
|
10
|
+
import { type Sheet } from '../types';
|
|
11
11
|
|
|
12
12
|
export type UseSheetModelOptions = {
|
|
13
13
|
readonly?: boolean;
|
|
@@ -15,7 +15,7 @@ export type UseSheetModelOptions = {
|
|
|
15
15
|
|
|
16
16
|
export const useSheetModel = (
|
|
17
17
|
graph?: ComputeGraph,
|
|
18
|
-
sheet?:
|
|
18
|
+
sheet?: Sheet.Sheet,
|
|
19
19
|
{ readonly }: UseSheetModelOptions = {},
|
|
20
20
|
): SheetModel | undefined => {
|
|
21
21
|
const [model, setModel] = useState<SheetModel>();
|
|
@@ -10,7 +10,7 @@ export default defineConfig({
|
|
|
10
10
|
...e2ePreset(import.meta.dirname),
|
|
11
11
|
// TODO(wittjosiah): Avoid hard-coding ports.
|
|
12
12
|
webServer: {
|
|
13
|
-
command: '
|
|
13
|
+
command: 'pnpm storybook dev --ci --quiet --port=9005 --config-dir=.storybook',
|
|
14
14
|
port: 9005,
|
|
15
15
|
reuseExistingServer: false,
|
|
16
16
|
},
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { type Locator, type Page } from '@playwright/test';
|
|
6
6
|
|
|
7
7
|
import { DxGridManager } from '@dxos/lit-grid/testing';
|
|
8
|
-
import { type
|
|
8
|
+
import { type DxGridAxis, type DxGridPosition } from '@dxos/react-ui-grid';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Test helper for managing dx-grid interactions and assertions in Playwright tests.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2021 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { expect, test
|
|
5
|
+
import { type Page, expect, test } from '@playwright/test';
|
|
6
6
|
|
|
7
7
|
import { faker } from '@dxos/random';
|
|
8
8
|
import { setupPage, storybookUrl } from '@dxos/test-utils/playwright';
|
|
@@ -15,7 +15,8 @@ test.describe('plugin-sheet', () => {
|
|
|
15
15
|
|
|
16
16
|
test.beforeEach(async ({ browser }) => {
|
|
17
17
|
const setup = await setupPage(browser, {
|
|
18
|
-
url: storybookUrl('plugins-plugin-sheet-sheetcontainer--spec', 9005),
|
|
18
|
+
url: storybookUrl('plugins-plugin-sheet-containers-sheetcontainer--spec', 9005),
|
|
19
|
+
viewportSize: { width: 1280, height: 720 },
|
|
19
20
|
});
|
|
20
21
|
page = setup.page;
|
|
21
22
|
sheet = new SheetManager(page);
|
package/src/sanity.test.ts
CHANGED
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { describe,
|
|
5
|
+
import { describe, expect, test } from 'vitest';
|
|
6
6
|
|
|
7
7
|
import { Client } from '@dxos/client';
|
|
8
|
-
import {
|
|
9
|
-
import { FunctionType } from '@dxos/functions';
|
|
8
|
+
import { Function } from '@dxos/functions';
|
|
10
9
|
|
|
11
10
|
// Part 2.
|
|
12
11
|
// TODO(burdon): Cannot test outside of browser.
|
|
@@ -23,7 +22,7 @@ import { FunctionType } from '@dxos/functions';
|
|
|
23
22
|
describe('test', () => {
|
|
24
23
|
test('test', async () => {
|
|
25
24
|
const client = new Client();
|
|
26
|
-
client.addTypes([
|
|
25
|
+
await client.addTypes([Function.Function]);
|
|
27
26
|
await client.initialize();
|
|
28
27
|
await client.halo.createIdentity();
|
|
29
28
|
|
|
@@ -34,7 +33,7 @@ describe('test', () => {
|
|
|
34
33
|
// - ERROR "process.nextTick is not a function"
|
|
35
34
|
// - ERROR "Identifier 'Buffer' has already been declared" if { nodeExternal: true }
|
|
36
35
|
const space = await client.spaces.create();
|
|
37
|
-
const fn = space.db.add(
|
|
36
|
+
const fn = space.db.add(Function.make({ name: 'test', version: '0.0.1', binding: 'HELLO' }));
|
|
38
37
|
expect(fn).to.exist;
|
|
39
38
|
});
|
|
40
39
|
});
|
package/src/serializer.ts
CHANGED
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Obj } from '@dxos/echo';
|
|
6
|
+
import { getObjectCore } from '@dxos/echo-db';
|
|
6
7
|
import { type TypedObjectSerializer } from '@dxos/plugin-space/types';
|
|
7
|
-
import { getObjectCore } from '@dxos/react-client/echo';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { Sheet } from './types';
|
|
10
10
|
|
|
11
|
-
export const serializer: TypedObjectSerializer<
|
|
11
|
+
export const serializer: TypedObjectSerializer<Sheet.Sheet> = {
|
|
12
12
|
serialize: async ({ object }): Promise<string> => {
|
|
13
13
|
return JSON.stringify(object, null, 2);
|
|
14
14
|
},
|
|
15
15
|
|
|
16
16
|
deserialize: async ({ content, newId }) => {
|
|
17
17
|
const { id, ...parsed } = JSON.parse(content);
|
|
18
|
-
const sheet = Obj.make(
|
|
18
|
+
const sheet = Obj.make(Sheet.Sheet, parsed);
|
|
19
19
|
|
|
20
20
|
if (!newId) {
|
|
21
21
|
const core = getObjectCore(sheet);
|
package/src/testing/data.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import type {
|
|
5
|
+
import type { Sheet } from '../types';
|
|
6
6
|
|
|
7
|
-
export const createTestCells = (testSheetName = 'test'): Record<string, CellValue> => ({
|
|
7
|
+
export const createTestCells = (testSheetName = 'test'): Record<string, Sheet.CellValue> => ({
|
|
8
8
|
B1: { value: 'Qty2' },
|
|
9
9
|
B3: { value: 1 },
|
|
10
10
|
B4: { value: 2 },
|