@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/translations.ts
CHANGED
|
@@ -4,48 +4,54 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Resource } from '@dxos/react-ui';
|
|
6
6
|
|
|
7
|
-
import { meta } from '
|
|
8
|
-
import {
|
|
7
|
+
import { meta } from '#meta';
|
|
8
|
+
import { Sheet } from '#types';
|
|
9
9
|
|
|
10
10
|
export const translations = [
|
|
11
11
|
{
|
|
12
12
|
'en-US': {
|
|
13
|
-
[
|
|
14
|
-
'typename
|
|
15
|
-
'typename
|
|
16
|
-
'typename
|
|
17
|
-
'typename
|
|
18
|
-
'object
|
|
19
|
-
'
|
|
20
|
-
'
|
|
13
|
+
[Sheet.Sheet.typename]: {
|
|
14
|
+
'typename.label': 'Sheet',
|
|
15
|
+
'typename.label_zero': 'Sheets',
|
|
16
|
+
'typename.label_one': 'Sheet',
|
|
17
|
+
'typename.label_other': 'Sheets',
|
|
18
|
+
'object-name.placeholder': 'New sheet',
|
|
19
|
+
'add-object.label': 'Add sheet',
|
|
20
|
+
'rename-object.label': 'Rename sheet',
|
|
21
|
+
'delete-object.label': 'Delete sheet',
|
|
22
|
+
'object-deleted.label': 'Sheet deleted',
|
|
21
23
|
},
|
|
22
24
|
[meta.id]: {
|
|
23
|
-
'plugin
|
|
24
|
-
'cell
|
|
25
|
-
|
|
26
|
-
'range
|
|
27
|
-
'range
|
|
28
|
-
|
|
29
|
-
'range
|
|
30
|
-
'range
|
|
31
|
-
'range
|
|
32
|
-
'
|
|
33
|
-
'
|
|
34
|
-
|
|
35
|
-
'
|
|
36
|
-
'
|
|
37
|
-
'
|
|
38
|
-
'
|
|
39
|
-
'
|
|
40
|
-
'
|
|
41
|
-
'add
|
|
42
|
-
'
|
|
43
|
-
'
|
|
44
|
-
'
|
|
45
|
-
'
|
|
46
|
-
'range
|
|
47
|
-
'
|
|
48
|
-
'
|
|
25
|
+
'plugin.name': 'Sheets',
|
|
26
|
+
'cell.placeholder': 'Cell value...',
|
|
27
|
+
|
|
28
|
+
'range-key.alignment.label': 'Align',
|
|
29
|
+
'range-key.style.label': 'Style',
|
|
30
|
+
|
|
31
|
+
'range-value.start.label': 'Align left',
|
|
32
|
+
'range-value.center.label': 'Align center',
|
|
33
|
+
'range-value.end.label': 'Align right',
|
|
34
|
+
'range-value.softwrap.label': 'Wrap text',
|
|
35
|
+
'range-value.highlight.label': 'Highlight',
|
|
36
|
+
|
|
37
|
+
'toolbar-action.label': '{{value}}',
|
|
38
|
+
'selection-overlaps-existing-comment.label': 'Selected cell already has a comment',
|
|
39
|
+
'comment.label': 'Add comment',
|
|
40
|
+
'comment-ranges-not-supported.label': 'Commenting on ranges is not yet supported',
|
|
41
|
+
'no-cursor.label': 'Select a cell to comment',
|
|
42
|
+
'add-col-before.label': 'Add column before',
|
|
43
|
+
'add-col-after.label': 'Add column after',
|
|
44
|
+
'delete-col.label': 'Delete column',
|
|
45
|
+
'add-row-before.label': 'Add row before',
|
|
46
|
+
'add-row-after.label': 'Add row after',
|
|
47
|
+
'delete-row.label': 'Delete row',
|
|
48
|
+
'range-list.heading': 'Ranges',
|
|
49
|
+
'no-ranges.message': 'No ranges',
|
|
50
|
+
'range.title': '{{position}} — {{value}}',
|
|
51
|
+
'col-dropped.label': 'Deleted a column',
|
|
52
|
+
'row-dropped.label': 'Deleted a row',
|
|
53
|
+
'align.label': 'Text align',
|
|
54
|
+
'axis-dropped.label': 'Drop axis', // TODO(burdon): What does this mean?
|
|
49
55
|
},
|
|
50
56
|
},
|
|
51
57
|
},
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
7
|
+
import * as Schema from 'effect/Schema';
|
|
8
|
+
|
|
9
|
+
import { addressFromA1Notation, isFormula } from '@dxos/compute-hyperformula';
|
|
10
|
+
import { Annotation, Obj, Type } from '@dxos/echo';
|
|
11
|
+
import { FormInputAnnotation } from '@dxos/echo/internal';
|
|
12
|
+
|
|
13
|
+
import { addressToIndex, initialize, mapFormulaRefsToIndices } from './util';
|
|
14
|
+
|
|
15
|
+
export type SheetSize = {
|
|
16
|
+
rows: number;
|
|
17
|
+
columns: number;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const CellValue = Schema.Struct({
|
|
21
|
+
// TODO(burdon): How to store dates (datetime, date, time), percentages, etc.
|
|
22
|
+
// Consider import/export; natural access for other plugins. Special handling for currency (precision).
|
|
23
|
+
// TODO(burdon): Automerge (long string) or short string or number.
|
|
24
|
+
value: Schema.Any,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export type CellValue = Schema.Schema.Type<typeof CellValue>;
|
|
28
|
+
|
|
29
|
+
// TODO(burdon): IMPORTANT: Reconcile with Field definition.
|
|
30
|
+
export const Range = Schema.Struct({
|
|
31
|
+
range: Schema.String,
|
|
32
|
+
key: Schema.String,
|
|
33
|
+
value: Schema.String,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export type Range = Schema.Schema.Type<typeof Range>;
|
|
37
|
+
|
|
38
|
+
// TODO(burdon): Visibility, locked, frozen, etc.
|
|
39
|
+
export const RowColumnMeta = Schema.Struct({
|
|
40
|
+
size: Schema.optional(Schema.Number),
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// TODO(burdon): Reconcile col/column (across packages).
|
|
44
|
+
// TODO(burdon): Index to all updates when rows/columns are inserted/deleted.
|
|
45
|
+
export const Sheet = Schema.Struct({
|
|
46
|
+
name: Schema.optional(Schema.String),
|
|
47
|
+
|
|
48
|
+
// Sparse map of cells referenced by index.
|
|
49
|
+
cells: Schema.Record({ key: Schema.String, value: CellValue }).pipe(FormInputAnnotation.set(false)),
|
|
50
|
+
|
|
51
|
+
// Ordered row indices.
|
|
52
|
+
rows: Schema.Array(Schema.String).pipe(FormInputAnnotation.set(false)),
|
|
53
|
+
|
|
54
|
+
// Ordered column indices.
|
|
55
|
+
columns: Schema.Array(Schema.String).pipe(FormInputAnnotation.set(false)),
|
|
56
|
+
|
|
57
|
+
// Row metadata referenced by index.
|
|
58
|
+
rowMeta: Schema.Record({ key: Schema.String, value: RowColumnMeta }).pipe(FormInputAnnotation.set(false)),
|
|
59
|
+
|
|
60
|
+
// Column metadata referenced by index.
|
|
61
|
+
columnMeta: Schema.Record({ key: Schema.String, value: RowColumnMeta }).pipe(FormInputAnnotation.set(false)),
|
|
62
|
+
|
|
63
|
+
// Cell formatting referenced by indexed range.
|
|
64
|
+
ranges: Schema.Array(Range).pipe(FormInputAnnotation.set(false)),
|
|
65
|
+
}).pipe(
|
|
66
|
+
Type.object({
|
|
67
|
+
typename: 'org.dxos.type.sheet',
|
|
68
|
+
version: '0.1.0',
|
|
69
|
+
}),
|
|
70
|
+
Annotation.IconAnnotation.set({
|
|
71
|
+
icon: 'ph--grid-nine--regular',
|
|
72
|
+
hue: 'indigo',
|
|
73
|
+
}),
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
export interface Sheet extends Schema.Schema.Type<typeof Sheet> {}
|
|
77
|
+
|
|
78
|
+
export type SheetProps = {
|
|
79
|
+
name?: string;
|
|
80
|
+
cells?: Record<string, CellValue>;
|
|
81
|
+
} & Partial<SheetSize>;
|
|
82
|
+
|
|
83
|
+
export const make = ({ name, cells = {}, ...size }: SheetProps = {}) => {
|
|
84
|
+
const sheet = Obj.make(Sheet, { name, cells: {}, rows: [], columns: [], rowMeta: {}, columnMeta: {}, ranges: [] });
|
|
85
|
+
|
|
86
|
+
// Initialize and set cells within Obj.update to satisfy change context requirements.
|
|
87
|
+
Obj.update(sheet, (sheet) => {
|
|
88
|
+
initialize(sheet, size);
|
|
89
|
+
|
|
90
|
+
if (cells) {
|
|
91
|
+
Object.entries(cells).forEach(([key, { value }]) => {
|
|
92
|
+
const idx = addressToIndex(sheet, addressFromA1Notation(key));
|
|
93
|
+
if (isFormula(value)) {
|
|
94
|
+
value = mapFormulaRefsToIndices(sheet, value);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
sheet.cells[idx] = { value };
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
return sheet;
|
|
103
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { type ComputeGraphRegistry as ComputeGraphRegistryType } from '@dxos/compute-hyperformula';
|
|
9
|
+
import { type DxGridElement, type GridContentProps } from '@dxos/react-ui-grid';
|
|
10
|
+
|
|
11
|
+
import { meta } from '#meta';
|
|
12
|
+
|
|
13
|
+
export type GridEntry = { grid: DxGridElement; setActiveRefs: (refs: GridContentProps['activeRefs']) => void };
|
|
14
|
+
|
|
15
|
+
export type GridRegistry = {
|
|
16
|
+
register: (attendableId: string, grid: DxGridElement, setActiveRefs: GridEntry['setActiveRefs']) => void;
|
|
17
|
+
unregister: (attendableId: string) => void;
|
|
18
|
+
get: (attendableId: string) => GridEntry | undefined;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const ComputeGraphRegistry = Capability.make<ComputeGraphRegistryType>(
|
|
22
|
+
`${meta.id}.capability.compute-graph-registry`,
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
/** Registry of active grid instances keyed by attendable ID. */
|
|
26
|
+
export const GridInstances = Capability.make<GridRegistry>(`${meta.id}.capability.grid-instances`);
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
7
|
+
import * as Schema from 'effect/Schema';
|
|
8
|
+
|
|
9
|
+
import { Capability } from '@dxos/app-framework';
|
|
10
|
+
import { Operation } from '@dxos/compute';
|
|
11
|
+
|
|
12
|
+
import { meta } from '#meta';
|
|
13
|
+
|
|
14
|
+
const SHEET_OPERATION = `${meta.id}.operation`;
|
|
15
|
+
|
|
16
|
+
// TODO(wittjosiah): Factor out. This is `DxGridAxis` from `@dxos/react-ui-grid`.
|
|
17
|
+
const Axis = Schema.Union(Schema.Literal('row'), Schema.Literal('col'));
|
|
18
|
+
|
|
19
|
+
export const InsertAxis = Operation.make({
|
|
20
|
+
meta: { key: `${SHEET_OPERATION}.axis-insert`, name: 'Insert Axis' },
|
|
21
|
+
input: Schema.Struct({
|
|
22
|
+
model: Schema.Any,
|
|
23
|
+
axis: Axis,
|
|
24
|
+
index: Schema.Number,
|
|
25
|
+
count: Schema.optional(Schema.Number),
|
|
26
|
+
}),
|
|
27
|
+
output: Schema.Void,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export const DropAxisOutput = Schema.Struct({
|
|
31
|
+
axis: Axis.annotations({ description: 'The axis type (row or col).' }),
|
|
32
|
+
axisIndex: Schema.String.annotations({ description: 'The dropped axis index.' }),
|
|
33
|
+
index: Schema.Number.annotations({ description: 'The position the axis was at.' }),
|
|
34
|
+
axisMeta: Schema.Any.annotations({ description: 'The row/column metadata.' }),
|
|
35
|
+
values: Schema.Array(Schema.Any).annotations({ description: 'The cell values that were dropped.' }),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export type DropAxisOutput = Schema.Schema.Type<typeof DropAxisOutput>;
|
|
39
|
+
|
|
40
|
+
export const DropAxis = Operation.make({
|
|
41
|
+
meta: { key: `${SHEET_OPERATION}.axis-drop`, name: 'Drop Axis' },
|
|
42
|
+
input: Schema.Struct({
|
|
43
|
+
model: Schema.Any,
|
|
44
|
+
axis: Axis,
|
|
45
|
+
axisIndex: Schema.String,
|
|
46
|
+
}),
|
|
47
|
+
output: DropAxisOutput,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export const ScrollToAnchor = Operation.make({
|
|
51
|
+
meta: { key: `${SHEET_OPERATION}.scroll-to-anchor`, name: 'Scroll To Anchor' },
|
|
52
|
+
services: [Capability.Service],
|
|
53
|
+
input: Schema.Struct({
|
|
54
|
+
subject: Schema.String.annotations({ description: 'Attendable ID of the sheet.' }),
|
|
55
|
+
cursor: Schema.String.annotations({ description: 'Cell range coordinates.' }),
|
|
56
|
+
ref: Schema.optional(Schema.Any.annotations({ description: 'Active refs for highlighting.' })),
|
|
57
|
+
}),
|
|
58
|
+
output: Schema.Void,
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Restore a dropped axis (inverse of DropAxis).
|
|
63
|
+
*/
|
|
64
|
+
export const RestoreAxis = Operation.make({
|
|
65
|
+
meta: { key: `${SHEET_OPERATION}.restore-axis`, name: 'Restore Axis' },
|
|
66
|
+
input: Schema.Struct({
|
|
67
|
+
model: Schema.Any.annotations({ description: 'The sheet model.' }),
|
|
68
|
+
axis: Axis.annotations({ description: 'The axis type (row or col).' }),
|
|
69
|
+
axisIndex: Schema.String.annotations({ description: 'The axis index to restore.' }),
|
|
70
|
+
index: Schema.Number.annotations({ description: 'The position to restore at.' }),
|
|
71
|
+
axisMeta: Schema.Any.annotations({ description: 'The row/column metadata.' }),
|
|
72
|
+
values: Schema.Array(Schema.Any).annotations({ description: 'The cell values to restore.' }),
|
|
73
|
+
}),
|
|
74
|
+
output: Schema.Void,
|
|
75
|
+
});
|
package/src/types/index.ts
CHANGED
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
export * from './schema';
|
|
6
5
|
export * from './sheet-range-types';
|
|
7
6
|
export * from './types';
|
|
8
7
|
export * from './util';
|
|
8
|
+
|
|
9
|
+
export * as Sheet from './Sheet';
|
|
10
|
+
export * as SheetCapabilities from './SheetCapabilities';
|
|
11
|
+
export * as SheetOperation from './SheetOperation';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { type ClassNameValue } from '@dxos/react-ui';
|
|
6
6
|
|
|
7
|
-
import { type
|
|
7
|
+
import { type Sheet } from '../types';
|
|
8
8
|
|
|
9
9
|
export const alignKey = 'alignment';
|
|
10
10
|
export type AlignKey = typeof alignKey;
|
|
@@ -19,7 +19,7 @@ export type StyleKey = typeof styleKey;
|
|
|
19
19
|
export type StyleValue = 'highlight' | 'softwrap';
|
|
20
20
|
|
|
21
21
|
// TODO(burdon): Reconcile with plugin-table.
|
|
22
|
-
export const cellClassNameForRange = ({ key, value }:
|
|
22
|
+
export const cellClassNameForRange = ({ key, value }: Sheet.Sheet['ranges'][number]): ClassNameValue => {
|
|
23
23
|
switch (key) {
|
|
24
24
|
case alignKey:
|
|
25
25
|
switch (value) {
|
|
@@ -34,14 +34,14 @@ export const cellClassNameForRange = ({ key, value }: SheetType['ranges'][number
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
case commentKey:
|
|
37
|
-
return 'bg-
|
|
37
|
+
return 'bg-grid-comment';
|
|
38
38
|
|
|
39
39
|
case styleKey:
|
|
40
40
|
switch (value) {
|
|
41
41
|
case 'highlight':
|
|
42
|
-
return '
|
|
42
|
+
return 'bg-grid-highlight!';
|
|
43
43
|
case 'softwrap':
|
|
44
|
-
return '
|
|
44
|
+
return 'whitespace-normal!';
|
|
45
45
|
default:
|
|
46
46
|
return undefined;
|
|
47
47
|
}
|
package/src/types/types.ts
CHANGED
|
@@ -2,67 +2,21 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import
|
|
8
|
-
import { SheetModel } from '../model';
|
|
7
|
+
import * as Sheet from './Sheet';
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export type SheetSize = {
|
|
13
|
-
rows: number;
|
|
14
|
-
columns: number;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export type CreateSheetOptions = {
|
|
18
|
-
name?: string;
|
|
19
|
-
cells?: Record<string, CellValue>;
|
|
20
|
-
} & Partial<SheetSize>;
|
|
9
|
+
// TODO(wittjosiah): Factor out. This is `DxGridAxis` from `@dxos/react-ui-grid`.
|
|
10
|
+
const ActionAxis = Schema.Union(Schema.Literal('row'), Schema.Literal('col'));
|
|
21
11
|
|
|
22
12
|
export namespace SheetAction {
|
|
23
|
-
const SHEET_ACTION = `${SHEET_PLUGIN}/action`;
|
|
24
|
-
|
|
25
|
-
export class Create extends Schema.TaggedClass<Create>()(`${SHEET_ACTION}/create`, {
|
|
26
|
-
input: Schema.Struct({
|
|
27
|
-
name: Schema.optional(Schema.String),
|
|
28
|
-
}),
|
|
29
|
-
output: Schema.Struct({
|
|
30
|
-
object: SheetType,
|
|
31
|
-
}),
|
|
32
|
-
}) {}
|
|
33
|
-
|
|
34
|
-
// TODO(wittjosiah): Factor out. This is `DxGridAxis` from `@dxos/react-ui-grid`.
|
|
35
|
-
const Axis = Schema.Union(Schema.Literal('row'), Schema.Literal('col'));
|
|
36
|
-
|
|
37
|
-
export class InsertAxis extends Schema.TaggedClass<InsertAxis>()(`${SHEET_ACTION}/axis-insert`, {
|
|
38
|
-
input: Schema.Struct({
|
|
39
|
-
// TODO(wittjosiah): Schema.instanceOf(SheetModel) throws when running tests.
|
|
40
|
-
model: Schema.Any.pipe(Schema.filter((model) => model instanceof SheetModel)) as Schema.Schema<SheetModel>,
|
|
41
|
-
axis: Axis,
|
|
42
|
-
index: Schema.Number,
|
|
43
|
-
count: Schema.optional(Schema.Number),
|
|
44
|
-
}),
|
|
45
|
-
output: Schema.Void,
|
|
46
|
-
}) {}
|
|
47
|
-
|
|
48
13
|
export const RestoreAxis = Schema.Struct({
|
|
49
|
-
axis:
|
|
14
|
+
axis: ActionAxis,
|
|
50
15
|
axisIndex: Schema.String,
|
|
51
16
|
index: Schema.Number,
|
|
52
|
-
axisMeta: RowColumnMeta,
|
|
17
|
+
axisMeta: Sheet.RowColumnMeta,
|
|
53
18
|
values: Schema.Array(Schema.Any),
|
|
54
19
|
});
|
|
55
20
|
|
|
56
21
|
export type RestoreAxis = Schema.Schema.Type<typeof RestoreAxis>;
|
|
57
|
-
|
|
58
|
-
export class DropAxis extends Schema.TaggedClass<DropAxis>()(`${SHEET_ACTION}/axis-drop`, {
|
|
59
|
-
input: Schema.Struct({
|
|
60
|
-
// TODO(wittjosiah): Schema.instanceOf(SheetModel) throws when running tests.
|
|
61
|
-
model: Schema.Any.pipe(Schema.filter((model) => model instanceof SheetModel)) as Schema.Schema<SheetModel>,
|
|
62
|
-
axis: Axis,
|
|
63
|
-
axisIndex: Schema.String,
|
|
64
|
-
deletionData: Schema.optional(RestoreAxis),
|
|
65
|
-
}),
|
|
66
|
-
output: Schema.Void,
|
|
67
|
-
}) {}
|
|
68
22
|
}
|
package/src/types/util.ts
CHANGED
|
@@ -9,12 +9,12 @@ import {
|
|
|
9
9
|
addressFromA1Notation,
|
|
10
10
|
addressToA1Notation,
|
|
11
11
|
isFormula,
|
|
12
|
-
} from '@dxos/compute';
|
|
12
|
+
} from '@dxos/compute-hyperformula';
|
|
13
13
|
import { randomBytes } from '@dxos/crypto';
|
|
14
|
-
import { Obj } from '@dxos/echo';
|
|
14
|
+
import { type Obj } from '@dxos/echo';
|
|
15
15
|
import { invariant } from '@dxos/invariant';
|
|
16
16
|
|
|
17
|
-
import { type
|
|
17
|
+
import { type Sheet } from '../types';
|
|
18
18
|
|
|
19
19
|
export const MAX_ROWS = 500;
|
|
20
20
|
export const MAX_COLS = 676; // 26^2;
|
|
@@ -56,8 +56,8 @@ export const insertIndices = (indices: string[], i: number, n: number, max: numb
|
|
|
56
56
|
};
|
|
57
57
|
|
|
58
58
|
export const initialize = (
|
|
59
|
-
sheet:
|
|
60
|
-
{ rows = DEFAULT_ROWS, columns = DEFAULT_COLS }: Partial<SheetSize> = {},
|
|
59
|
+
sheet: Obj.Mutable<Sheet.Sheet>,
|
|
60
|
+
{ rows = DEFAULT_ROWS, columns = DEFAULT_COLS }: Partial<Sheet.SheetSize> = {},
|
|
61
61
|
) => {
|
|
62
62
|
if (!sheet.rows.length) {
|
|
63
63
|
insertIndices(sheet.rows, 0, rows, MAX_ROWS);
|
|
@@ -67,44 +67,17 @@ export const initialize = (
|
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
-
export const createSheet = ({ name, cells, ...size }: CreateSheetOptions = {}): SheetType => {
|
|
71
|
-
const sheet = Obj.make(SheetType, {
|
|
72
|
-
name,
|
|
73
|
-
cells: {},
|
|
74
|
-
rows: [],
|
|
75
|
-
columns: [],
|
|
76
|
-
rowMeta: {},
|
|
77
|
-
columnMeta: {},
|
|
78
|
-
ranges: [],
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
initialize(sheet, size);
|
|
82
|
-
|
|
83
|
-
if (cells) {
|
|
84
|
-
Object.entries(cells).forEach(([key, { value }]) => {
|
|
85
|
-
const idx = addressToIndex(sheet, addressFromA1Notation(key));
|
|
86
|
-
if (isFormula(value)) {
|
|
87
|
-
value = mapFormulaRefsToIndices(sheet, value);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
sheet.cells[idx] = { value };
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
return sheet;
|
|
95
|
-
};
|
|
96
|
-
|
|
97
70
|
/**
|
|
98
71
|
* E.g., "A1" => "CA2@CB3".
|
|
99
72
|
*/
|
|
100
|
-
export const addressToIndex = (sheet:
|
|
73
|
+
export const addressToIndex = (sheet: Sheet.Sheet, cell: CellAddress): string => {
|
|
101
74
|
return `${sheet.columns[cell.col]}@${sheet.rows[cell.row]}`;
|
|
102
75
|
};
|
|
103
76
|
|
|
104
77
|
/**
|
|
105
78
|
* E.g., "CA2@CB3" => "A1".
|
|
106
79
|
*/
|
|
107
|
-
export const addressFromIndex = (sheet:
|
|
80
|
+
export const addressFromIndex = (sheet: Sheet.Sheet, idx: string): CellAddress => {
|
|
108
81
|
const [column, row] = idx.split('@');
|
|
109
82
|
return {
|
|
110
83
|
col: sheet.columns.indexOf(column),
|
|
@@ -115,14 +88,14 @@ export const addressFromIndex = (sheet: SheetType, idx: string): CellAddress =>
|
|
|
115
88
|
/**
|
|
116
89
|
* E.g., "A1:B2" => "CA2@CB3:CC4@CD5".
|
|
117
90
|
*/
|
|
118
|
-
export const rangeToIndex = (sheet:
|
|
91
|
+
export const rangeToIndex = (sheet: Sheet.Sheet, range: CellRange): string => {
|
|
119
92
|
return [range.from, range.to ?? range.from].map((cell) => addressToIndex(sheet, cell)).join(':');
|
|
120
93
|
};
|
|
121
94
|
|
|
122
95
|
/**
|
|
123
96
|
* E.g., "CA2@CB3:CC4@CD5" => "A1:B2".
|
|
124
97
|
*/
|
|
125
|
-
export const rangeFromIndex = (sheet:
|
|
98
|
+
export const rangeFromIndex = (sheet: Sheet.Sheet, idx: string): CompleteCellRange => {
|
|
126
99
|
const [from, to] = idx.split(':').map((index) => addressFromIndex(sheet, index));
|
|
127
100
|
return { from, to };
|
|
128
101
|
};
|
|
@@ -131,7 +104,7 @@ export const rangeFromIndex = (sheet: SheetType, idx: string): CompleteCellRange
|
|
|
131
104
|
* Compares the positions of two cell indexes in a sheet.
|
|
132
105
|
* Sorts primarily by row, then by column if rows are equal.
|
|
133
106
|
*/
|
|
134
|
-
export const compareIndexPositions = (sheet:
|
|
107
|
+
export const compareIndexPositions = (sheet: Sheet.Sheet, indexA: string, indexB: string): number => {
|
|
135
108
|
const { row: rowA, col: columnA } = addressFromIndex(sheet, indexA);
|
|
136
109
|
const { row: rowB, col: columnB } = addressFromIndex(sheet, indexB);
|
|
137
110
|
|
|
@@ -148,7 +121,7 @@ export const compareIndexPositions = (sheet: SheetType, indexA: string, indexB:
|
|
|
148
121
|
/**
|
|
149
122
|
* Map from A1 notation to indices.
|
|
150
123
|
*/
|
|
151
|
-
export const mapFormulaRefsToIndices = (sheet:
|
|
124
|
+
export const mapFormulaRefsToIndices = (sheet: Sheet.Sheet, formula: string): string => {
|
|
152
125
|
invariant(isFormula(formula));
|
|
153
126
|
return formula.replace(/([a-zA-Z]+)([0-9]+)/g, (match) => {
|
|
154
127
|
return addressToIndex(sheet, addressFromA1Notation(match));
|
|
@@ -158,7 +131,7 @@ export const mapFormulaRefsToIndices = (sheet: SheetType, formula: string): stri
|
|
|
158
131
|
/**
|
|
159
132
|
* Map from indices to A1 notation.
|
|
160
133
|
*/
|
|
161
|
-
export const mapFormulaIndicesToRefs = (sheet:
|
|
134
|
+
export const mapFormulaIndicesToRefs = (sheet: Sheet.Sheet, formula: string): string => {
|
|
162
135
|
invariant(isFormula(formula));
|
|
163
136
|
return formula.replace(/([a-zA-Z0-9]+)@([a-zA-Z0-9]+)/g, (idx) => {
|
|
164
137
|
return addressToA1Notation(addressFromIndex(sheet, idx));
|