@dxos/plugin-sheet 0.8.4-main.dedc0f3 → 0.8.4-main.dfabb4ec29
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/neutral/RangeList-HYB5S6KQ.mjs +46 -0
- package/dist/lib/neutral/RangeList-HYB5S6KQ.mjs.map +7 -0
- package/dist/lib/neutral/SheetContainer-ZOVKGHLT.mjs +33 -0
- package/dist/lib/neutral/SheetContainer-ZOVKGHLT.mjs.map +7 -0
- package/dist/lib/neutral/SheetPlugin.mjs +48 -0
- package/dist/lib/neutral/SheetPlugin.mjs.map +7 -0
- package/dist/lib/neutral/SheetPlugin.node.mjs +27 -0
- package/dist/lib/neutral/SheetPlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/anchor-sort-TTCKGX7V.mjs +22 -0
- package/dist/lib/neutral/anchor-sort-TTCKGX7V.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +25 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/chunk-4GWJDLTH.mjs +83 -0
- package/dist/lib/neutral/chunk-4GWJDLTH.mjs.map +7 -0
- package/dist/lib/{browser/chunk-SSN4HYJL.mjs → neutral/chunk-4SBAIU6F.mjs} +19 -19
- package/dist/lib/neutral/chunk-4SBAIU6F.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-KC2SMDNF.mjs +373 -0
- package/dist/lib/neutral/chunk-KC2SMDNF.mjs.map +7 -0
- package/dist/lib/neutral/chunk-YFHTB6MX.mjs +8 -0
- package/dist/lib/neutral/chunk-YFHTB6MX.mjs.map +7 -0
- package/dist/lib/neutral/chunk-ZWOQCLH7.mjs +21 -0
- package/dist/lib/neutral/chunk-ZWOQCLH7.mjs.map +7 -0
- package/dist/lib/neutral/comment-config-ZBWNCJMZ.mjs +20 -0
- package/dist/lib/neutral/comment-config-ZBWNCJMZ.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +1551 -0
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/compute-graph-registry-IEQBF5XZ.mjs +20 -0
- package/dist/lib/neutral/compute-graph-registry-IEQBF5XZ.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +11 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/create-object-OKQAXJCW.mjs +27 -0
- package/dist/lib/neutral/create-object-OKQAXJCW.mjs.map +7 -0
- package/dist/lib/neutral/drop-axis-G6UOXG54.mjs +23 -0
- package/dist/lib/neutral/drop-axis-G6UOXG54.mjs.map +7 -0
- package/dist/lib/{node-esm/types → neutral}/index.mjs +16 -13
- package/dist/lib/neutral/insert-axis-ZFFNG22G.mjs +16 -0
- package/dist/lib/neutral/insert-axis-ZFFNG22G.mjs.map +7 -0
- package/dist/lib/neutral/markdown-I2AKJYPF.mjs +28 -0
- package/dist/lib/neutral/markdown-I2AKJYPF.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +8 -0
- package/dist/lib/neutral/meta.mjs.map +7 -0
- package/dist/lib/neutral/operation-handler-TB6LFV2H.mjs +13 -0
- package/dist/lib/neutral/operation-handler-TB6LFV2H.mjs.map +7 -0
- package/dist/lib/neutral/operations/index.mjs +8 -0
- package/dist/lib/neutral/operations/index.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +16 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-ID4JCAFR.mjs +44 -0
- package/dist/lib/neutral/react-surface-ID4JCAFR.mjs.map +7 -0
- package/dist/lib/neutral/restore-axis-44DM6N54.mjs +16 -0
- package/dist/lib/neutral/restore-axis-44DM6N54.mjs.map +7 -0
- package/dist/lib/neutral/scroll-to-anchor-WHX3HJC7.mjs +33 -0
- package/dist/lib/neutral/scroll-to-anchor-WHX3HJC7.mjs.map +7 -0
- package/dist/lib/neutral/state-HPA27MX2.mjs +29 -0
- package/dist/lib/neutral/state-HPA27MX2.mjs.map +7 -0
- package/dist/lib/neutral/testing/index.mjs +103 -0
- package/dist/lib/neutral/testing/index.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +55 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/types/index.mjs +8 -12
- package/dist/lib/neutral/types/index.mjs.map +7 -0
- package/dist/lib/neutral/undo-mappings-3FQLSTCZ.mjs +31 -0
- package/dist/lib/neutral/undo-mappings-3FQLSTCZ.mjs.map +7 -0
- package/dist/types/src/SheetPlugin.d.ts +3 -1
- package/dist/types/src/SheetPlugin.d.ts.map +1 -1
- package/dist/types/src/SheetPlugin.node.d.ts +4 -0
- package/dist/types/src/SheetPlugin.node.d.ts.map +1 -0
- package/dist/types/src/SheetPlugin.test.d.ts +2 -0
- package/dist/types/src/SheetPlugin.test.d.ts.map +1 -0
- package/dist/types/src/capabilities/anchor-sort.d.ts +4 -4
- package/dist/types/src/capabilities/anchor-sort.d.ts.map +1 -1
- package/dist/types/src/capabilities/comment-config.d.ts +12 -0
- package/dist/types/src/capabilities/comment-config.d.ts.map +1 -0
- package/dist/types/src/capabilities/compute-graph-registry.d.ts +3 -2
- package/dist/types/src/capabilities/compute-graph-registry.d.ts.map +1 -1
- package/dist/types/src/capabilities/create-object.d.ts +11 -0
- package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +23 -9
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/markdown.d.ts +3 -2
- package/dist/types/src/capabilities/markdown.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts +6 -0
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/undo-mappings.d.ts +5 -0
- package/dist/types/src/capabilities/undo-mappings.d.ts.map +1 -0
- package/dist/types/src/components/ComputeGraph/ComputeGraphContextProvider.d.ts +1 -1
- package/dist/types/src/components/ComputeGraph/ComputeGraphContextProvider.d.ts.map +1 -1
- package/dist/types/src/components/ComputeGraph/compute-graph.stories.d.ts +0 -1
- package/dist/types/src/components/ComputeGraph/compute-graph.stories.d.ts.map +1 -1
- package/dist/types/src/components/Sheet/Sheet.d.ts +17 -0
- package/dist/types/src/components/Sheet/Sheet.d.ts.map +1 -0
- package/dist/types/src/components/Sheet/index.d.ts +2 -0
- package/dist/types/src/components/Sheet/index.d.ts.map +1 -0
- package/dist/types/src/components/{GridSheet → SheetContent}/SheetCellEditor.stories.d.ts +2 -3
- package/dist/types/src/components/SheetContent/SheetCellEditor.stories.d.ts.map +1 -0
- package/dist/types/src/components/SheetContent/SheetContent.d.ts +6 -0
- package/dist/types/src/components/SheetContent/SheetContent.d.ts.map +1 -0
- package/dist/types/src/components/SheetContent/SheetContent.stories.d.ts +93 -0
- package/dist/types/src/components/SheetContent/SheetContent.stories.d.ts.map +1 -0
- package/dist/types/src/components/SheetContent/index.d.ts +2 -0
- package/dist/types/src/components/SheetContent/index.d.ts.map +1 -0
- package/dist/types/src/components/{GridSheet → SheetContent}/util.d.ts +1 -1
- package/dist/types/src/components/SheetContent/util.d.ts.map +1 -0
- package/dist/types/src/components/{SheetContext/SheetContext.d.ts → SheetRoot/SheetRoot.d.ts} +9 -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 +6 -0
- package/dist/types/src/components/SheetStatusbar/SheetStatusbar.d.ts.map +1 -0
- package/dist/types/src/components/SheetStatusbar/index.d.ts +2 -0
- package/dist/types/src/components/SheetStatusbar/index.d.ts.map +1 -0
- package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts +5 -6
- package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts +73 -68
- package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/align.d.ts +14 -21
- package/dist/types/src/components/SheetToolbar/align.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/style.d.ts +14 -20
- 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/containers/RangeList/RangeList.d.ts +7 -0
- package/dist/types/src/containers/RangeList/RangeList.d.ts.map +1 -0
- package/dist/types/src/containers/RangeList/index.d.ts +2 -0
- package/dist/types/src/containers/RangeList/index.d.ts.map +1 -0
- package/dist/types/src/containers/SheetContainer/SheetContainer.d.ts +12 -0
- package/dist/types/src/containers/SheetContainer/SheetContainer.d.ts.map +1 -0
- package/dist/types/src/containers/SheetContainer/SheetContainer.stories.d.ts +92 -0
- package/dist/types/src/containers/SheetContainer/SheetContainer.stories.d.ts.map +1 -0
- package/dist/types/src/containers/SheetContainer/index.d.ts +2 -0
- package/dist/types/src/containers/SheetContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +4 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/extensions/compute.d.ts +1 -1
- package/dist/types/src/extensions/compute.d.ts.map +1 -1
- package/dist/types/src/extensions/compute.stories.d.ts +2 -3
- package/dist/types/src/extensions/compute.stories.d.ts.map +1 -1
- package/dist/types/src/extensions/editor/sheet-extension.d.ts +1 -1
- package/dist/types/src/extensions/editor/sheet-extension.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/integrations/thread-ranges.d.ts +1 -3
- package/dist/types/src/integrations/thread-ranges.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -3
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/model/sheet-model.d.ts +7 -7
- 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 +3 -3
- package/dist/types/src/model/useSheetModel.d.ts.map +1 -1
- 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 +3 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/insert-axis.d.ts +5 -0
- package/dist/types/src/operations/insert-axis.d.ts.map +1 -0
- package/dist/types/src/operations/restore-axis.d.ts +5 -0
- package/dist/types/src/operations/restore-axis.d.ts.map +1 -0
- package/dist/types/src/operations/scroll-to-anchor.d.ts +5 -0
- package/dist/types/src/operations/scroll-to-anchor.d.ts.map +1 -0
- package/dist/types/src/playwright/playwright.config.d.ts.map +1 -1
- package/dist/types/src/playwright/sheet-manager.d.ts.map +1 -1
- package/dist/types/src/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/serializer.d.ts +3 -3
- 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 +28 -4
- package/dist/types/src/testing/testing.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +74 -38
- 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/SheetCapabilities.d.ts +16 -0
- package/dist/types/src/types/SheetCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/SheetOperation.d.ts +45 -0
- package/dist/types/src/types/SheetOperation.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +3 -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 +3 -78
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/types/util.d.ts +11 -11
- package/dist/types/src/types/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +131 -81
- package/src/SheetPlugin.node.ts +21 -0
- package/src/SheetPlugin.test.ts +30 -0
- package/src/SheetPlugin.tsx +46 -68
- package/src/capabilities/anchor-sort.ts +20 -15
- package/src/capabilities/comment-config.ts +24 -0
- package/src/capabilities/compute-graph-registry.ts +21 -20
- package/src/capabilities/create-object.ts +30 -0
- package/src/capabilities/index.ts +16 -8
- package/src/capabilities/markdown.ts +21 -13
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +38 -29
- package/src/capabilities/state.ts +29 -0
- package/src/capabilities/undo-mappings.ts +30 -0
- package/src/components/ComputeGraph/ComputeGraphContextProvider.tsx +1 -1
- package/src/components/ComputeGraph/compute-graph.stories.tsx +23 -22
- package/src/components/Sheet/Sheet.tsx +20 -0
- package/src/components/Sheet/index.ts +5 -0
- package/src/components/{GridSheet → SheetContent}/SheetCellEditor.stories.tsx +18 -15
- package/src/components/SheetContent/SheetContent.stories.tsx +60 -0
- package/src/components/{GridSheet/GridSheet.tsx → SheetContent/SheetContent.tsx} +84 -54
- package/src/components/{RangeList → SheetContent}/index.ts +1 -1
- package/src/components/{GridSheet → SheetContent}/util.ts +17 -10
- package/src/components/{SheetContext/SheetContext.tsx → SheetRoot/SheetRoot.tsx} +55 -42
- package/src/components/{GridSheet → SheetRoot}/index.ts +1 -1
- package/src/components/{FunctionEditor/FunctionEditor.tsx → SheetStatusbar/SheetStatusbar.tsx} +19 -7
- package/src/components/{FunctionEditor → SheetStatusbar}/index.ts +1 -1
- package/src/components/SheetToolbar/SheetToolbar.stories.tsx +11 -8
- package/src/components/SheetToolbar/SheetToolbar.tsx +51 -46
- package/src/components/SheetToolbar/align.ts +50 -25
- package/src/components/SheetToolbar/style.ts +52 -22
- package/src/components/SheetToolbar/useToolbarState.ts +22 -5
- package/src/components/index.ts +1 -7
- package/src/containers/RangeList/RangeList.tsx +65 -0
- package/src/containers/RangeList/index.ts +5 -0
- package/src/containers/SheetContainer/SheetContainer.stories.tsx +110 -0
- package/src/containers/SheetContainer/SheetContainer.tsx +57 -0
- package/src/containers/SheetContainer/index.ts +5 -0
- package/src/containers/index.ts +8 -0
- package/src/extensions/compute.stories.tsx +38 -25
- package/src/extensions/compute.ts +2 -2
- package/src/extensions/editor/sheet-extension.test.ts +1 -1
- package/src/extensions/editor/sheet-extension.ts +18 -15
- package/src/index.ts +2 -2
- package/src/integrations/thread-ranges.ts +19 -61
- package/src/meta.ts +9 -7
- package/src/model/sheet-model.test.ts +6 -6
- package/src/model/sheet-model.ts +82 -50
- package/src/model/testing.ts +5 -5
- package/src/model/useSheetModel.ts +4 -3
- package/src/operations/drop-axis.ts +26 -0
- package/src/operations/index.ts +12 -0
- package/src/operations/insert-axis.ts +19 -0
- package/src/operations/restore-axis.ts +19 -0
- package/src/operations/scroll-to-anchor.ts +30 -0
- package/src/playwright/playwright.config.ts +1 -1
- package/src/playwright/sheet.spec.ts +4 -3
- package/src/plugin.ts +11 -0
- package/src/sanity.test.ts +5 -3
- package/src/serializer.ts +5 -5
- package/src/testing/data.ts +2 -2
- package/src/testing/testing.tsx +13 -7
- package/src/translations.ts +42 -36
- package/src/types/Sheet.ts +103 -0
- package/src/types/SheetCapabilities.ts +26 -0
- package/src/types/SheetOperation.ts +75 -0
- package/src/types/index.ts +4 -1
- package/src/types/sheet-range-types.ts +5 -5
- package/src/types/types.ts +6 -52
- package/src/types/util.ts +12 -39
- package/dist/lib/browser/SheetContainer-OUN6AARA.mjs +0 -350
- package/dist/lib/browser/SheetContainer-OUN6AARA.mjs.map +0 -7
- package/dist/lib/browser/anchor-sort-7WD2VGXW.mjs +0 -24
- package/dist/lib/browser/anchor-sort-7WD2VGXW.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-KJWZUQVA.mjs +0 -15
- package/dist/lib/browser/chunk-KJWZUQVA.mjs.map +0 -7
- package/dist/lib/browser/chunk-SSN4HYJL.mjs.map +0 -7
- package/dist/lib/browser/chunk-X4EWLDT3.mjs +0 -851
- package/dist/lib/browser/chunk-X4EWLDT3.mjs.map +0 -7
- package/dist/lib/browser/chunk-XSXUU6FO.mjs +0 -906
- package/dist/lib/browser/chunk-XSXUU6FO.mjs.map +0 -7
- package/dist/lib/browser/compute-graph-registry-6YJHXORG.mjs +0 -30
- package/dist/lib/browser/compute-graph-registry-6YJHXORG.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -155
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-ROEY4LHM.mjs +0 -56
- package/dist/lib/browser/intent-resolver-ROEY4LHM.mjs.map +0 -7
- package/dist/lib/browser/markdown-VOY636TS.mjs +0 -26
- package/dist/lib/browser/markdown-VOY636TS.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/react-surface-XCNAVF2M.mjs +0 -53
- package/dist/lib/browser/react-surface-XCNAVF2M.mjs.map +0 -7
- package/dist/lib/node-esm/SheetContainer-NFLLTGNV.mjs +0 -351
- package/dist/lib/node-esm/SheetContainer-NFLLTGNV.mjs.map +0 -7
- package/dist/lib/node-esm/anchor-sort-ACQDUIPU.mjs +0 -25
- package/dist/lib/node-esm/anchor-sort-ACQDUIPU.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-IK4O7FUJ.mjs +0 -236
- package/dist/lib/node-esm/chunk-IK4O7FUJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ODP4L4OV.mjs +0 -907
- package/dist/lib/node-esm/chunk-ODP4L4OV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-PYF4ZJXN.mjs +0 -852
- package/dist/lib/node-esm/chunk-PYF4ZJXN.mjs.map +0 -7
- package/dist/lib/node-esm/compute-graph-registry-ET5KJNLV.mjs +0 -31
- package/dist/lib/node-esm/compute-graph-registry-ET5KJNLV.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -156
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-HESRI2ML.mjs +0 -57
- package/dist/lib/node-esm/intent-resolver-HESRI2ML.mjs.map +0 -7
- package/dist/lib/node-esm/markdown-P4CLZ24C.mjs +0 -27
- package/dist/lib/node-esm/markdown-P4CLZ24C.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/react-surface-KE3EEVF4.mjs +0 -54
- package/dist/lib/node-esm/react-surface-KE3EEVF4.mjs.map +0 -7
- 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/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.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 -54
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +0 -1
- package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts.map +0 -1
- package/dist/types/src/components/GridSheet/index.d.ts +0 -2
- package/dist/types/src/components/GridSheet/index.d.ts.map +0 -1
- package/dist/types/src/components/GridSheet/util.d.ts.map +0 -1
- package/dist/types/src/components/RangeList/RangeList.d.ts +0 -7
- 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 -55
- package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +0 -1
- package/dist/types/src/components/SheetContainer/index.d.ts +0 -3
- package/dist/types/src/components/SheetContainer/index.d.ts.map +0 -1
- package/dist/types/src/components/SheetContext/SheetContext.d.ts.map +0 -1
- package/dist/types/src/components/SheetContext/index.d.ts +0 -2
- package/dist/types/src/components/SheetContext/index.d.ts.map +0 -1
- package/dist/types/src/types/schema.d.ts +0 -37
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/capabilities/capabilities.ts +0 -14
- package/src/capabilities/intent-resolver.ts +0 -38
- package/src/components/GridSheet/GridSheet.stories.tsx +0 -56
- package/src/components/RangeList/RangeList.tsx +0 -60
- package/src/components/SheetContainer/SheetContainer.stories.tsx +0 -92
- package/src/components/SheetContainer/SheetContainer.tsx +0 -36
- package/src/components/SheetContainer/index.ts +0 -7
- package/src/components/SheetContext/index.ts +0 -5
- package/src/types/schema.ts +0 -61
- /package/dist/lib/{browser/types/index.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/{node-esm/types → neutral}/index.mjs.map +0 -0
package/src/model/sheet-model.ts
CHANGED
|
@@ -20,10 +20,10 @@ import {
|
|
|
20
20
|
addressToA1Notation,
|
|
21
21
|
createSheetName,
|
|
22
22
|
isFormula,
|
|
23
|
-
} from '@dxos/compute';
|
|
23
|
+
} from '@dxos/compute-hyperformula';
|
|
24
24
|
import { Resource } from '@dxos/context';
|
|
25
25
|
import { Obj } from '@dxos/echo';
|
|
26
|
-
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';
|
|
@@ -38,22 +38,22 @@ import {
|
|
|
38
38
|
insertIndices,
|
|
39
39
|
mapFormulaIndicesToRefs,
|
|
40
40
|
mapFormulaRefsToIndices,
|
|
41
|
-
} from '
|
|
42
|
-
import { type
|
|
41
|
+
} from '#types';
|
|
42
|
+
import { type Sheet, type SheetAction } from '#types';
|
|
43
43
|
|
|
44
44
|
// TODO(burdon): Move to compute.
|
|
45
45
|
// Map sheet types to system types.
|
|
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.update(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.update(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.update(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.update(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.update(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.update(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.update(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.update(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.update(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.update(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.update(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.update(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.update(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.update(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
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { addressToA1Notation } from '@dxos/compute';
|
|
5
|
+
import { addressToA1Notation } from '@dxos/compute-hyperformula';
|
|
6
6
|
|
|
7
|
-
import {
|
|
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
|
});
|
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
import { useEffect, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import { type ComputeGraph } from '@dxos/compute';
|
|
7
|
+
import { type ComputeGraph } from '@dxos/compute-hyperformula';
|
|
8
|
+
|
|
9
|
+
import { type Sheet } from '#types';
|
|
8
10
|
|
|
9
11
|
import { SheetModel } from '../model';
|
|
10
|
-
import { type SheetType } from '../types';
|
|
11
12
|
|
|
12
13
|
export type UseSheetModelOptions = {
|
|
13
14
|
readonly?: boolean;
|
|
@@ -15,7 +16,7 @@ export type UseSheetModelOptions = {
|
|
|
15
16
|
|
|
16
17
|
export const useSheetModel = (
|
|
17
18
|
graph?: ComputeGraph,
|
|
18
|
-
sheet?:
|
|
19
|
+
sheet?: Sheet.Sheet,
|
|
19
20
|
{ readonly }: UseSheetModelOptions = {},
|
|
20
21
|
): SheetModel | undefined => {
|
|
21
22
|
const [model, setModel] = useState<SheetModel>();
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//
|
|
2
|
+
|
|
3
|
+
import * as Effect from 'effect/Effect';
|
|
4
|
+
// Copyright 2025 DXOS.org
|
|
5
|
+
//
|
|
6
|
+
|
|
7
|
+
import { Operation } from '@dxos/compute';
|
|
8
|
+
|
|
9
|
+
import { SheetOperation } from '../types';
|
|
10
|
+
|
|
11
|
+
const handler: Operation.WithHandler<typeof SheetOperation.DropAxis> = SheetOperation.DropAxis.pipe(
|
|
12
|
+
Operation.withHandler(({ model, axis, axisIndex }) =>
|
|
13
|
+
Effect.sync(() => {
|
|
14
|
+
const undoData = model[axis === 'col' ? 'dropColumn' : 'dropRow'](axisIndex);
|
|
15
|
+
return {
|
|
16
|
+
axis: undoData.axis,
|
|
17
|
+
axisIndex: undoData.axisIndex,
|
|
18
|
+
index: undoData.index,
|
|
19
|
+
axisMeta: undoData.axisMeta,
|
|
20
|
+
values: undoData.values,
|
|
21
|
+
};
|
|
22
|
+
}),
|
|
23
|
+
),
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export default handler;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { OperationHandlerSet } from '@dxos/compute';
|
|
6
|
+
|
|
7
|
+
export const SheetOperationHandlerSet = OperationHandlerSet.lazy(
|
|
8
|
+
() => import('./drop-axis'),
|
|
9
|
+
() => import('./insert-axis'),
|
|
10
|
+
() => import('./restore-axis'),
|
|
11
|
+
() => import('./scroll-to-anchor'),
|
|
12
|
+
);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//
|
|
2
|
+
|
|
3
|
+
import * as Effect from 'effect/Effect';
|
|
4
|
+
// Copyright 2025 DXOS.org
|
|
5
|
+
//
|
|
6
|
+
|
|
7
|
+
import { Operation } from '@dxos/compute';
|
|
8
|
+
|
|
9
|
+
import { SheetOperation } from '../types';
|
|
10
|
+
|
|
11
|
+
const handler: Operation.WithHandler<typeof SheetOperation.InsertAxis> = SheetOperation.InsertAxis.pipe(
|
|
12
|
+
Operation.withHandler(({ model, axis, index, count }) =>
|
|
13
|
+
Effect.sync(() => {
|
|
14
|
+
model[axis === 'col' ? 'insertColumns' : 'insertRows'](index, count);
|
|
15
|
+
}),
|
|
16
|
+
),
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
export default handler;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//
|
|
2
|
+
|
|
3
|
+
import * as Effect from 'effect/Effect';
|
|
4
|
+
// Copyright 2025 DXOS.org
|
|
5
|
+
//
|
|
6
|
+
|
|
7
|
+
import { Operation } from '@dxos/compute';
|
|
8
|
+
|
|
9
|
+
import { SheetOperation } from '../types';
|
|
10
|
+
|
|
11
|
+
const handler: Operation.WithHandler<typeof SheetOperation.RestoreAxis> = SheetOperation.RestoreAxis.pipe(
|
|
12
|
+
Operation.withHandler(({ model, axis, ...restoreData }) =>
|
|
13
|
+
Effect.sync(() => {
|
|
14
|
+
model[axis === 'col' ? 'restoreColumn' : 'restoreRow'](restoreData);
|
|
15
|
+
}),
|
|
16
|
+
),
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
export default handler;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { Operation } from '@dxos/compute';
|
|
9
|
+
|
|
10
|
+
import { parseThreadAnchorAsCellRange } from '../integrations/thread-ranges';
|
|
11
|
+
import { SheetCapabilities, SheetOperation } from '../types';
|
|
12
|
+
|
|
13
|
+
const handler: Operation.WithHandler<typeof SheetOperation.ScrollToAnchor> = SheetOperation.ScrollToAnchor.pipe(
|
|
14
|
+
Operation.withHandler(
|
|
15
|
+
Effect.fnUntraced(function* ({ subject, cursor, ref }) {
|
|
16
|
+
const gridInstances = yield* Capability.get(SheetCapabilities.GridInstances);
|
|
17
|
+
const entry = gridInstances.get(subject);
|
|
18
|
+
if (!entry) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
entry.setActiveRefs(ref);
|
|
22
|
+
const range = parseThreadAnchorAsCellRange(cursor);
|
|
23
|
+
if (range) {
|
|
24
|
+
entry.grid.setFocus({ ...range.to, plane: 'grid' }, true);
|
|
25
|
+
}
|
|
26
|
+
}),
|
|
27
|
+
),
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
export default handler;
|
|
@@ -10,7 +10,7 @@ export default defineConfig({
|
|
|
10
10
|
...e2ePreset(import.meta.dirname),
|
|
11
11
|
// TODO(wittjosiah): Avoid hard-coding ports.
|
|
12
12
|
webServer: {
|
|
13
|
-
command: '
|
|
13
|
+
command: 'pnpm storybook dev --ci --quiet --port=9005 --config-dir=.storybook',
|
|
14
14
|
port: 9005,
|
|
15
15
|
reuseExistingServer: false,
|
|
16
16
|
},
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Page, expect, test } from '@playwright/test';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { random } from '@dxos/random';
|
|
8
8
|
import { setupPage, storybookUrl } from '@dxos/test-utils/playwright';
|
|
9
9
|
|
|
10
10
|
import { SheetManager } from './sheet-manager';
|
|
@@ -15,7 +15,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);
|
|
@@ -38,7 +39,7 @@ test.describe('plugin-sheet', () => {
|
|
|
38
39
|
// Confirm editor displays
|
|
39
40
|
await expect(sheet.cellEditor()).toBeVisible();
|
|
40
41
|
// Type in a value and press enter
|
|
41
|
-
const testString =
|
|
42
|
+
const testString = random.string.uuid();
|
|
42
43
|
await sheet.setFocusedCellValue(testString, 'Enter');
|
|
43
44
|
// Expect that value to now show in the grid
|
|
44
45
|
await expect(sheet.cellByText(testString)).toBeVisible();
|
package/src/plugin.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
import { meta } from './meta';
|
|
8
|
+
|
|
9
|
+
export const SheetPlugin = Plugin.lazy(meta, () => import('#plugin'));
|
|
10
|
+
|
|
11
|
+
export { SheetOperationHandlerSet } from './operations';
|
package/src/sanity.test.ts
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import { describe, expect, test } from 'vitest';
|
|
6
6
|
|
|
7
7
|
import { Client } from '@dxos/client';
|
|
8
|
+
import { Operation } from '@dxos/compute';
|
|
8
9
|
import { Obj } from '@dxos/echo';
|
|
9
|
-
import { FunctionType } from '@dxos/functions';
|
|
10
10
|
|
|
11
11
|
// Part 2.
|
|
12
12
|
// TODO(burdon): Cannot test outside of browser.
|
|
@@ -23,7 +23,7 @@ import { FunctionType } from '@dxos/functions';
|
|
|
23
23
|
describe('test', () => {
|
|
24
24
|
test('test', async () => {
|
|
25
25
|
const client = new Client();
|
|
26
|
-
client.addTypes([
|
|
26
|
+
await client.addTypes([Operation.PersistentOperation]);
|
|
27
27
|
await client.initialize();
|
|
28
28
|
await client.halo.createIdentity();
|
|
29
29
|
|
|
@@ -34,7 +34,9 @@ describe('test', () => {
|
|
|
34
34
|
// - ERROR "process.nextTick is not a function"
|
|
35
35
|
// - ERROR "Identifier 'Buffer' has already been declared" if { nodeExternal: true }
|
|
36
36
|
const space = await client.spaces.create();
|
|
37
|
-
const fn = space.db.add(
|
|
37
|
+
const fn = space.db.add(
|
|
38
|
+
Obj.make(Operation.PersistentOperation, { name: 'test', version: '0.0.1', binding: 'HELLO' }),
|
|
39
|
+
);
|
|
38
40
|
expect(fn).to.exist;
|
|
39
41
|
});
|
|
40
42
|
});
|
package/src/serializer.ts
CHANGED
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Obj } from '@dxos/echo';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { getObjectCore } from '@dxos/echo-db';
|
|
7
|
+
import { type TypedObjectSerializer } from '@dxos/plugin-space';
|
|
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 },
|
package/src/testing/testing.tsx
CHANGED
|
@@ -5,20 +5,21 @@
|
|
|
5
5
|
import { type Decorator } from '@storybook/react';
|
|
6
6
|
import React, { useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import { type ComputeGraph, type ComputeGraphOptions, ComputeGraphRegistry } from '@dxos/compute';
|
|
8
|
+
import { type ComputeGraph, type ComputeGraphOptions, ComputeGraphRegistry } from '@dxos/compute-hyperformula';
|
|
9
|
+
import { createMockedComputeRuntimeProvider } from '@dxos/compute-hyperformula/testing';
|
|
9
10
|
import { type Space } from '@dxos/react-client/echo';
|
|
10
11
|
import { useAsyncState } from '@dxos/react-hooks';
|
|
11
12
|
|
|
12
|
-
import { ComputeGraphContextProvider } from '
|
|
13
|
-
import {
|
|
13
|
+
import { ComputeGraphContextProvider } from '#components';
|
|
14
|
+
import { Sheet } from '#types';
|
|
14
15
|
|
|
15
|
-
export const useTestSheet = (space?: Space, graph?: ComputeGraph, options?:
|
|
16
|
+
export const useTestSheet = (space?: Space, graph?: ComputeGraph, options?: Sheet.SheetProps) => {
|
|
16
17
|
const [sheet] = useAsyncState(async () => {
|
|
17
18
|
if (!space || !graph) {
|
|
18
19
|
return;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
const sheet =
|
|
22
|
+
const sheet = Sheet.make(options);
|
|
22
23
|
space.db.add(sheet);
|
|
23
24
|
return sheet;
|
|
24
25
|
}, [space, graph]);
|
|
@@ -26,9 +27,14 @@ export const useTestSheet = (space?: Space, graph?: ComputeGraph, options?: Crea
|
|
|
26
27
|
};
|
|
27
28
|
|
|
28
29
|
export const withComputeGraphDecorator =
|
|
29
|
-
(options?: ComputeGraphOptions): Decorator =>
|
|
30
|
+
(options?: Partial<ComputeGraphOptions>): Decorator =>
|
|
30
31
|
(Story) => {
|
|
31
|
-
const [registry] = useState(
|
|
32
|
+
const [registry] = useState(
|
|
33
|
+
new ComputeGraphRegistry({
|
|
34
|
+
...options,
|
|
35
|
+
computeRuntime: options?.computeRuntime ?? createMockedComputeRuntimeProvider(),
|
|
36
|
+
}),
|
|
37
|
+
);
|
|
32
38
|
return (
|
|
33
39
|
<ComputeGraphContextProvider registry={registry}>
|
|
34
40
|
<Story />
|