@dxos/plugin-sheet 0.7.4 → 0.7.5-labs.401163d
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/SheetContainer-IMHGS7Z4.mjs +370 -0
- package/dist/lib/browser/SheetContainer-IMHGS7Z4.mjs.map +7 -0
- package/dist/lib/browser/chunk-AT7F2WDW.mjs +808 -0
- package/dist/lib/browser/chunk-AT7F2WDW.mjs.map +7 -0
- package/dist/lib/browser/chunk-FOO6NGBM.mjs +229 -0
- package/dist/lib/browser/chunk-FOO6NGBM.mjs.map +7 -0
- package/dist/lib/browser/chunk-GAFHJBCU.mjs +18 -0
- package/dist/lib/browser/chunk-GAFHJBCU.mjs.map +7 -0
- package/dist/lib/browser/chunk-LXHRT3CC.mjs +15 -0
- package/dist/lib/browser/chunk-LXHRT3CC.mjs.map +7 -0
- package/dist/lib/browser/chunk-OOSRC36N.mjs +900 -0
- package/dist/lib/browser/chunk-OOSRC36N.mjs.map +7 -0
- package/dist/lib/browser/compute-graph-registry-EGPD4HEX.mjs +27 -0
- package/dist/lib/browser/compute-graph-registry-EGPD4HEX.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +80 -324
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-6S2RMLQF.mjs +56 -0
- package/dist/lib/browser/intent-resolver-6S2RMLQF.mjs.map +7 -0
- package/dist/lib/browser/markdown-CFJIWHZX.mjs +26 -0
- package/dist/lib/browser/markdown-CFJIWHZX.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-PHKJZYFB.mjs +52 -0
- package/dist/lib/browser/react-surface-PHKJZYFB.mjs.map +7 -0
- package/dist/lib/browser/thread-7ZWW5EA7.mjs +17 -0
- package/dist/lib/browser/thread-7ZWW5EA7.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +62 -0
- package/dist/lib/node/SheetContainer-NNIZN4AK.cjs +364 -0
- package/dist/lib/node/SheetContainer-NNIZN4AK.cjs.map +7 -0
- package/dist/lib/node/chunk-2KCZUH72.cjs +815 -0
- package/dist/lib/node/chunk-2KCZUH72.cjs.map +7 -0
- package/dist/lib/node/chunk-4LSYTNS4.cjs +935 -0
- package/dist/lib/node/chunk-4LSYTNS4.cjs.map +7 -0
- package/dist/lib/node/{chunk-2ZVZI2KJ.cjs → chunk-MLU6KRQN.cjs} +12 -9
- package/dist/lib/node/chunk-MLU6KRQN.cjs.map +7 -0
- package/dist/lib/node/chunk-P4KSGZSS.cjs +251 -0
- package/dist/lib/node/chunk-P4KSGZSS.cjs.map +7 -0
- package/dist/lib/node/{types.cjs → chunk-ZV2RS3QH.cjs} +12 -16
- package/dist/lib/node/chunk-ZV2RS3QH.cjs.map +7 -0
- package/dist/lib/node/compute-graph-registry-GJK5H264.cjs +53 -0
- package/dist/lib/node/compute-graph-registry-GJK5H264.cjs.map +7 -0
- package/dist/lib/node/index.cjs +81 -318
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/intent-resolver-I25V7SBT.cjs +69 -0
- package/dist/lib/node/intent-resolver-I25V7SBT.cjs.map +7 -0
- package/dist/lib/node/markdown-YTCSW66K.cjs +40 -0
- package/dist/lib/node/markdown-YTCSW66K.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/react-surface-HLE6CRA6.cjs +70 -0
- package/dist/lib/node/react-surface-HLE6CRA6.cjs.map +7 -0
- package/dist/lib/node/{meta.cjs → thread-DRNYTR6M.cjs} +12 -10
- package/dist/lib/node/thread-DRNYTR6M.cjs.map +7 -0
- package/dist/lib/node/types/index.cjs +84 -0
- package/dist/lib/node/types/index.cjs.map +7 -0
- package/dist/lib/node-esm/SheetContainer-PGDJKGTZ.mjs +371 -0
- package/dist/lib/node-esm/SheetContainer-PGDJKGTZ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HPAMZ6SP.mjs +901 -0
- package/dist/lib/node-esm/chunk-HPAMZ6SP.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-PTOI45NK.mjs +231 -0
- package/dist/lib/node-esm/chunk-PTOI45NK.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-RTZXXOS2.mjs +20 -0
- package/dist/lib/node-esm/chunk-RTZXXOS2.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-SX3S7UKU.mjs +16 -0
- package/dist/lib/node-esm/chunk-SX3S7UKU.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-ZM7XLUGL.mjs +809 -0
- package/dist/lib/node-esm/chunk-ZM7XLUGL.mjs.map +7 -0
- package/dist/lib/node-esm/compute-graph-registry-3F5JCYEN.mjs +28 -0
- package/dist/lib/node-esm/compute-graph-registry-3F5JCYEN.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +80 -324
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/intent-resolver-IPRSINII.mjs +57 -0
- package/dist/lib/node-esm/intent-resolver-IPRSINII.mjs.map +7 -0
- package/dist/lib/node-esm/markdown-CGSK44XJ.mjs +27 -0
- package/dist/lib/node-esm/markdown-CGSK44XJ.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-surface-PFRJ7V5N.mjs +53 -0
- package/dist/lib/node-esm/react-surface-PFRJ7V5N.mjs.map +7 -0
- package/dist/lib/node-esm/thread-6T5VXPAF.mjs +18 -0
- package/dist/lib/node-esm/thread-6T5VXPAF.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +63 -0
- package/dist/types/src/SheetPlugin.d.ts +1 -3
- package/dist/types/src/SheetPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts +5 -0
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
- package/dist/types/src/capabilities/compute-graph-registry.d.ts +4 -0
- package/dist/types/src/capabilities/compute-graph-registry.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +12 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts +4 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/markdown.d.ts +6 -0
- package/dist/types/src/capabilities/markdown.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +4 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/thread.d.ts +6 -0
- package/dist/types/src/capabilities/thread.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.map +1 -0
- package/dist/types/src/components/FunctionEditor/FunctionEditor.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/GridSheet.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/GridSheet/util.d.ts.map +1 -1
- package/dist/types/src/components/RangeList/RangeList.d.ts.map +1 -1
- package/dist/types/src/components/SheetContainer/SheetContainer.d.ts.map +1 -1
- package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/SheetContext/SheetContext.d.ts +1 -2
- package/dist/types/src/components/SheetContext/SheetContext.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts +7 -0
- package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts.map +1 -0
- package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts +6 -0
- package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts.map +1 -0
- package/dist/types/src/components/SheetToolbar/align.d.ts +28 -0
- package/dist/types/src/components/SheetToolbar/align.d.ts.map +1 -0
- package/dist/types/src/components/SheetToolbar/comment.d.ts +23 -0
- package/dist/types/src/components/SheetToolbar/comment.d.ts.map +1 -0
- package/dist/types/src/components/SheetToolbar/index.d.ts +2 -0
- package/dist/types/src/components/SheetToolbar/index.d.ts.map +1 -0
- package/dist/types/src/components/SheetToolbar/style.d.ts +26 -0
- package/dist/types/src/components/SheetToolbar/style.d.ts.map +1 -0
- package/dist/types/src/components/SheetToolbar/useToolbarAction.d.ts +8 -0
- package/dist/types/src/components/SheetToolbar/useToolbarAction.d.ts.map +1 -0
- package/dist/types/src/components/SheetToolbar/useToolbarState.d.ts +6 -0
- package/dist/types/src/components/SheetToolbar/useToolbarState.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +0 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- 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/editor/extension.d.ts +1 -1
- package/dist/types/src/extensions/editor/extension.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/integrations/thread-ranges.d.ts +1 -1
- package/dist/types/src/integrations/thread-ranges.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/model/sheet-model.d.ts +6 -8
- package/dist/types/src/model/sheet-model.d.ts.map +1 -1
- package/dist/types/src/model/testing.d.ts +1 -1
- package/dist/types/src/model/testing.d.ts.map +1 -1
- package/dist/types/src/model/useSheetModel.d.ts +1 -1
- package/dist/types/src/model/useSheetModel.d.ts.map +1 -1
- package/dist/types/src/testing/testing.d.ts +1 -1
- package/dist/types/src/testing/testing.d.ts.map +1 -1
- package/dist/types/src/{defs → types}/index.d.ts +1 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/src/types/schema.d.ts +105 -0
- package/dist/types/src/types/schema.d.ts.map +1 -0
- package/dist/types/src/{defs → types}/sheet-range-types.d.ts +1 -1
- package/dist/types/src/types/sheet-range-types.d.ts.map +1 -0
- package/dist/types/src/types/types.d.ts +71 -0
- package/dist/types/src/types/types.d.ts.map +1 -0
- package/dist/types/src/{defs → types}/util.d.ts +5 -1
- package/dist/types/src/types/util.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +48 -62
- package/src/SheetPlugin.tsx +57 -176
- package/src/capabilities/capabilities.ts +14 -0
- package/src/capabilities/compute-graph-registry.ts +25 -0
- package/src/capabilities/index.ts +13 -0
- package/src/capabilities/intent-resolver.ts +38 -0
- package/src/capabilities/markdown.ts +22 -0
- package/src/capabilities/react-surface.tsx +37 -0
- package/src/capabilities/thread.ts +14 -0
- package/src/components/ComputeGraph/ComputeGraphContextProvider.tsx +1 -2
- package/src/{compute-graph → components/ComputeGraph}/compute-graph.stories.tsx +6 -7
- package/src/components/FunctionEditor/FunctionEditor.tsx +2 -1
- package/src/components/GridSheet/GridSheet.stories.tsx +2 -0
- package/src/components/GridSheet/GridSheet.tsx +15 -18
- package/src/components/GridSheet/SheetCellEditor.stories.tsx +6 -7
- package/src/components/GridSheet/util.ts +4 -3
- package/src/components/RangeList/RangeList.tsx +2 -1
- package/src/components/SheetContainer/SheetContainer.stories.tsx +28 -23
- package/src/components/SheetContainer/SheetContainer.tsx +3 -8
- package/src/components/SheetContext/SheetContext.tsx +1 -2
- package/src/components/{Toolbar/Toolbar.stories.tsx → SheetToolbar/SheetToolbar.stories.tsx} +4 -8
- package/src/components/SheetToolbar/SheetToolbar.tsx +48 -0
- package/src/components/SheetToolbar/align.ts +68 -0
- package/src/components/SheetToolbar/comment.ts +56 -0
- package/src/components/{Toolbar → SheetToolbar}/index.ts +1 -1
- package/src/components/SheetToolbar/style.ts +72 -0
- package/src/components/SheetToolbar/useToolbarAction.ts +87 -0
- package/src/components/SheetToolbar/useToolbarState.ts +17 -0
- package/src/components/index.ts +0 -1
- package/src/extensions/compute.stories.tsx +2 -2
- package/src/extensions/compute.ts +7 -4
- package/src/extensions/editor/extension.test.ts +2 -1
- package/src/extensions/editor/extension.ts +2 -3
- package/src/index.ts +2 -7
- package/src/integrations/thread-ranges.ts +39 -24
- package/src/meta.ts +4 -2
- package/src/model/sheet-model.test.ts +4 -10
- package/src/model/sheet-model.ts +30 -22
- package/src/model/testing.ts +3 -2
- package/src/model/useSheetModel.ts +2 -1
- package/src/sanity.test.ts +1 -1
- package/src/testing/testing.tsx +2 -3
- package/src/{defs → types}/index.ts +1 -0
- package/src/types/schema.ts +56 -0
- package/src/{defs → types}/sheet-range-types.ts +1 -1
- package/src/types/types.ts +67 -0
- package/src/{defs → types}/util.ts +13 -13
- package/dist/lib/browser/SheetContainer-KCLT6PEO.mjs +0 -296
- package/dist/lib/browser/SheetContainer-KCLT6PEO.mjs.map +0 -7
- package/dist/lib/browser/chunk-E5WQ7U7G.mjs +0 -1675
- package/dist/lib/browser/chunk-E5WQ7U7G.mjs.map +0 -7
- package/dist/lib/browser/chunk-F3HE6D3J.mjs +0 -3269
- package/dist/lib/browser/chunk-F3HE6D3J.mjs.map +0 -7
- package/dist/lib/browser/chunk-JXFPOYNA.mjs +0 -67
- package/dist/lib/browser/chunk-JXFPOYNA.mjs.map +0 -7
- package/dist/lib/browser/chunk-RABELMEQ.mjs +0 -15
- package/dist/lib/browser/chunk-RABELMEQ.mjs.map +0 -7
- package/dist/lib/browser/compute-graph-SNUS7HOH.mjs +0 -35
- package/dist/lib/browser/meta.mjs +0 -9
- package/dist/lib/browser/types.mjs +0 -16
- package/dist/lib/browser/types.mjs.map +0 -7
- package/dist/lib/node/SheetContainer-VVVRYTQG.cjs +0 -298
- package/dist/lib/node/SheetContainer-VVVRYTQG.cjs.map +0 -7
- package/dist/lib/node/chunk-2ZVZI2KJ.cjs.map +0 -7
- package/dist/lib/node/chunk-45YW2DX2.cjs +0 -1656
- package/dist/lib/node/chunk-45YW2DX2.cjs.map +0 -7
- package/dist/lib/node/chunk-KSEEI5VC.cjs +0 -3323
- package/dist/lib/node/chunk-KSEEI5VC.cjs.map +0 -7
- package/dist/lib/node/chunk-OWH2EUHZ.cjs +0 -90
- package/dist/lib/node/chunk-OWH2EUHZ.cjs.map +0 -7
- package/dist/lib/node/compute-graph-WILPHO4A.cjs +0 -57
- package/dist/lib/node/compute-graph-WILPHO4A.cjs.map +0 -7
- package/dist/lib/node/meta.cjs.map +0 -7
- package/dist/lib/node/types.cjs.map +0 -7
- package/dist/lib/node-esm/SheetContainer-LSBE6Q4X.mjs +0 -297
- package/dist/lib/node-esm/SheetContainer-LSBE6Q4X.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6JF2AHKO.mjs +0 -3270
- package/dist/lib/node-esm/chunk-6JF2AHKO.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BM2Q3FFC.mjs +0 -17
- package/dist/lib/node-esm/chunk-BM2Q3FFC.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BVS2IQRO.mjs +0 -68
- package/dist/lib/node-esm/chunk-BVS2IQRO.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-NYDNXI7L.mjs +0 -1676
- package/dist/lib/node-esm/chunk-NYDNXI7L.mjs.map +0 -7
- package/dist/lib/node-esm/compute-graph-S6CVN7RS.mjs +0 -36
- package/dist/lib/node-esm/compute-graph-S6CVN7RS.mjs.map +0 -7
- package/dist/lib/node-esm/meta.mjs +0 -10
- package/dist/lib/node-esm/meta.mjs.map +0 -7
- package/dist/lib/node-esm/types.mjs +0 -17
- package/dist/lib/node-esm/types.mjs.map +0 -7
- package/dist/types/src/components/SheetObjectSettings.d.ts +0 -7
- package/dist/types/src/components/SheetObjectSettings.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +0 -48
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +0 -7
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/index.d.ts +0 -2
- package/dist/types/src/components/Toolbar/index.d.ts.map +0 -1
- package/dist/types/src/compute-graph/compute-graph-registry.d.ts +0 -34
- package/dist/types/src/compute-graph/compute-graph-registry.d.ts.map +0 -1
- package/dist/types/src/compute-graph/compute-graph.d.ts +0 -64
- package/dist/types/src/compute-graph/compute-graph.d.ts.map +0 -1
- package/dist/types/src/compute-graph/compute-graph.stories.d.ts.map +0 -1
- package/dist/types/src/compute-graph/compute-graph.test.d.ts +0 -2
- package/dist/types/src/compute-graph/compute-graph.test.d.ts.map +0 -1
- package/dist/types/src/compute-graph/compute-node.d.ts +0 -26
- package/dist/types/src/compute-graph/compute-node.d.ts.map +0 -1
- package/dist/types/src/compute-graph/functions/async-function.d.ts +0 -66
- package/dist/types/src/compute-graph/functions/async-function.d.ts.map +0 -1
- package/dist/types/src/compute-graph/functions/edge-function.d.ts +0 -21
- package/dist/types/src/compute-graph/functions/edge-function.d.ts.map +0 -1
- package/dist/types/src/compute-graph/functions/function-defs.d.ts +0 -11
- package/dist/types/src/compute-graph/functions/function-defs.d.ts.map +0 -1
- package/dist/types/src/compute-graph/functions/index.d.ts +0 -4
- package/dist/types/src/compute-graph/functions/index.d.ts.map +0 -1
- package/dist/types/src/compute-graph/hyperformula.test.d.ts +0 -2
- package/dist/types/src/compute-graph/hyperformula.test.d.ts.map +0 -1
- package/dist/types/src/compute-graph/index.d.ts +0 -5
- package/dist/types/src/compute-graph/index.d.ts.map +0 -1
- package/dist/types/src/compute-graph/testing/index.d.ts +0 -3
- package/dist/types/src/compute-graph/testing/index.d.ts.map +0 -1
- package/dist/types/src/compute-graph/testing/test-builder.d.ts +0 -15
- package/dist/types/src/compute-graph/testing/test-builder.d.ts.map +0 -1
- package/dist/types/src/compute-graph/testing/test-plugin.d.ts +0 -36
- package/dist/types/src/compute-graph/testing/test-plugin.d.ts.map +0 -1
- package/dist/types/src/compute-graph/util.d.ts +0 -2
- package/dist/types/src/compute-graph/util.d.ts.map +0 -1
- package/dist/types/src/defs/index.d.ts.map +0 -1
- package/dist/types/src/defs/sheet-range-types.d.ts.map +0 -1
- package/dist/types/src/defs/types.d.ts +0 -26
- package/dist/types/src/defs/types.d.ts.map +0 -1
- package/dist/types/src/defs/types.test.d.ts +0 -2
- package/dist/types/src/defs/types.test.d.ts.map +0 -1
- package/dist/types/src/defs/util.d.ts.map +0 -1
- package/dist/types/src/types.d.ts +0 -182
- package/dist/types/src/types.d.ts.map +0 -1
- package/dist/vendor/hyperformula.mjs +0 -37145
- package/src/components/SheetObjectSettings.tsx +0 -38
- package/src/components/Toolbar/Toolbar.tsx +0 -346
- package/src/compute-graph/compute-graph-registry.ts +0 -90
- package/src/compute-graph/compute-graph.test.ts +0 -87
- package/src/compute-graph/compute-graph.ts +0 -260
- package/src/compute-graph/compute-node.ts +0 -62
- package/src/compute-graph/functions/async-function.ts +0 -179
- package/src/compute-graph/functions/edge-function.ts +0 -102
- package/src/compute-graph/functions/function-defs.ts +0 -2427
- package/src/compute-graph/functions/index.ts +0 -7
- package/src/compute-graph/hyperformula.test.ts +0 -14
- package/src/compute-graph/index.ts +0 -8
- package/src/compute-graph/testing/index.ts +0 -6
- package/src/compute-graph/testing/test-builder.ts +0 -54
- package/src/compute-graph/testing/test-plugin.ts +0 -100
- package/src/compute-graph/util.ts +0 -8
- package/src/defs/types.test.ts +0 -91
- package/src/defs/types.ts +0 -88
- package/src/types.ts +0 -125
- /package/dist/lib/browser/{compute-graph-SNUS7HOH.mjs.map → types/index.mjs.map} +0 -0
- /package/dist/lib/{browser/meta.mjs.map → node-esm/types/index.mjs.map} +0 -0
- /package/dist/types/src/{compute-graph → components/ComputeGraph}/compute-graph.stories.d.ts +0 -0
|
@@ -4,13 +4,21 @@
|
|
|
4
4
|
|
|
5
5
|
import { useCallback, useEffect, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
createIntent,
|
|
9
|
+
createResolver,
|
|
10
|
+
LayoutAction,
|
|
11
|
+
useIntentResolver,
|
|
12
|
+
useIntentDispatcher,
|
|
13
|
+
} from '@dxos/app-framework';
|
|
8
14
|
import { debounce } from '@dxos/async';
|
|
15
|
+
import { type CellAddress, type CompleteCellRange, inRange } from '@dxos/compute';
|
|
16
|
+
import { S } from '@dxos/echo-schema';
|
|
17
|
+
import { ThreadAction } from '@dxos/plugin-thread/types';
|
|
9
18
|
import { fullyQualifiedId } from '@dxos/react-client/echo';
|
|
10
|
-
import { type DxGridElement, type DxGridPosition } from '@dxos/react-ui-grid';
|
|
19
|
+
import { type DxGridElement, type DxGridPosition, type GridContentProps } from '@dxos/react-ui-grid';
|
|
11
20
|
|
|
12
21
|
import { useSheetContext } from '../components';
|
|
13
|
-
import { type CellAddress, type CompleteCellRange, inRange } from '../defs';
|
|
14
22
|
import { SHEET_PLUGIN } from '../meta';
|
|
15
23
|
|
|
16
24
|
export const completeCellRangeToThreadCursor = (range: CompleteCellRange): string => {
|
|
@@ -32,31 +40,40 @@ export const parseThreadAnchorAsCellRange = (cursor: string): CompleteCellRange
|
|
|
32
40
|
|
|
33
41
|
export const useUpdateFocusedCellOnThreadSelection = (grid: DxGridElement | null) => {
|
|
34
42
|
const { model, setActiveRefs } = useSheetContext();
|
|
35
|
-
const
|
|
36
|
-
(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
const scrollIntoViewResolver = useMemo(
|
|
44
|
+
() =>
|
|
45
|
+
createResolver({
|
|
46
|
+
intent: LayoutAction.ScrollIntoView,
|
|
47
|
+
position: 'hoist',
|
|
48
|
+
filter: (
|
|
49
|
+
data,
|
|
50
|
+
): data is {
|
|
51
|
+
part: 'current';
|
|
52
|
+
subject: string;
|
|
53
|
+
options: { cursor: string; ref: GridContentProps['activeRefs'] };
|
|
54
|
+
} => {
|
|
55
|
+
if (!S.is(LayoutAction.ScrollIntoView.fields.input)(data)) {
|
|
56
|
+
return false;
|
|
41
57
|
}
|
|
42
|
-
|
|
58
|
+
|
|
59
|
+
return data.subject === fullyQualifiedId(model.sheet) && !!data.options?.cursor;
|
|
60
|
+
},
|
|
61
|
+
resolve: ({ options: { cursor, ref } }) => {
|
|
62
|
+
setActiveRefs(ref);
|
|
43
63
|
// TODO(Zan): Everywhere we refer to the cursor in a thread context should change to `anchor`.
|
|
44
|
-
const range = parseThreadAnchorAsCellRange(
|
|
64
|
+
const range = parseThreadAnchorAsCellRange(cursor!);
|
|
45
65
|
range && grid?.setFocus({ ...range.to, plane: 'grid' }, true);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
},
|
|
66
|
+
},
|
|
67
|
+
}),
|
|
51
68
|
[model.sheet, setActiveRefs],
|
|
52
69
|
);
|
|
53
70
|
|
|
54
|
-
useIntentResolver(SHEET_PLUGIN,
|
|
71
|
+
useIntentResolver(SHEET_PLUGIN, scrollIntoViewResolver);
|
|
55
72
|
};
|
|
56
73
|
|
|
57
74
|
export const useSelectThreadOnCellFocus = () => {
|
|
58
75
|
const { model, cursor } = useSheetContext();
|
|
59
|
-
const dispatch = useIntentDispatcher();
|
|
76
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
60
77
|
|
|
61
78
|
const threads = useMemo(
|
|
62
79
|
() => model.sheet.threads?.filter((thread): thread is NonNullable<typeof thread> => !!thread) ?? [],
|
|
@@ -72,9 +89,9 @@ export const useSelectThreadOnCellFocus = () => {
|
|
|
72
89
|
return;
|
|
73
90
|
}
|
|
74
91
|
|
|
75
|
-
const closestThread = threads?.find((
|
|
76
|
-
if (anchor) {
|
|
77
|
-
const range = parseThreadAnchorAsCellRange(anchor);
|
|
92
|
+
const closestThread = threads?.find((ref) => {
|
|
93
|
+
if (ref.target?.anchor) {
|
|
94
|
+
const range = parseThreadAnchorAsCellRange(ref.target!.anchor);
|
|
78
95
|
return range ? inRange(range, cellAddress) : false;
|
|
79
96
|
} else {
|
|
80
97
|
return false;
|
|
@@ -82,9 +99,7 @@ export const useSelectThreadOnCellFocus = () => {
|
|
|
82
99
|
});
|
|
83
100
|
|
|
84
101
|
if (closestThread) {
|
|
85
|
-
void dispatch(
|
|
86
|
-
{ action: 'dxos.org/plugin/thread/action/select', data: { current: fullyQualifiedId(closestThread) } },
|
|
87
|
-
]);
|
|
102
|
+
void dispatch(createIntent(ThreadAction.Select, { current: fullyQualifiedId(closestThread) }));
|
|
88
103
|
}
|
|
89
104
|
},
|
|
90
105
|
[dispatch, threads],
|
package/src/meta.ts
CHANGED
|
@@ -6,10 +6,12 @@ import { type PluginMeta } from '@dxos/app-framework';
|
|
|
6
6
|
|
|
7
7
|
export const SHEET_PLUGIN = 'dxos.org/plugin/sheet';
|
|
8
8
|
|
|
9
|
-
export
|
|
9
|
+
export const meta = {
|
|
10
10
|
id: SHEET_PLUGIN,
|
|
11
11
|
name: 'Sheet',
|
|
12
|
-
description:
|
|
12
|
+
description:
|
|
13
|
+
'Sheets in Composer are simple spreadsheets which allow you to leverage custom functions inside of cell grids. Leverage more than 400 pre-built formulas like Sum, Average, Count, Max, Min along with many others. You can also deploy your own custom functions using the Scripts plugin. ',
|
|
13
14
|
icon: 'ph--grid-nine--regular',
|
|
14
15
|
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-sheet',
|
|
16
|
+
screenshots: ['https://dxos.network/plugin-details-sheet-dark.png'],
|
|
15
17
|
} satisfies PluginMeta;
|
|
@@ -5,20 +5,14 @@
|
|
|
5
5
|
import { afterEach, beforeEach, describe, expect, onTestFinished, test } from 'vitest';
|
|
6
6
|
|
|
7
7
|
import { Trigger } from '@dxos/async';
|
|
8
|
+
import { type CellScalarValue, addressFromA1Notation, isFormula } from '@dxos/compute';
|
|
9
|
+
import { TestBuilder, testFunctionPlugins } from '@dxos/compute/testing';
|
|
10
|
+
import { FunctionType } from '@dxos/functions';
|
|
8
11
|
import { log } from '@dxos/log';
|
|
9
|
-
import { FunctionType } from '@dxos/plugin-script/types';
|
|
10
12
|
|
|
11
13
|
import { SheetModel } from './sheet-model';
|
|
12
14
|
import { createTestGrid } from './testing';
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
addressFromA1Notation,
|
|
16
|
-
createSheet,
|
|
17
|
-
isFormula,
|
|
18
|
-
mapFormulaIndicesToRefs,
|
|
19
|
-
mapFormulaRefsToIndices,
|
|
20
|
-
} from '../defs';
|
|
21
|
-
import { type CellScalarValue } from '../types';
|
|
15
|
+
import { createSheet, mapFormulaIndicesToRefs, mapFormulaRefsToIndices } from '../types';
|
|
22
16
|
|
|
23
17
|
describe('SheetModel', () => {
|
|
24
18
|
let testBuilder: TestBuilder;
|
package/src/model/sheet-model.ts
CHANGED
|
@@ -2,37 +2,45 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type SimpleCellRange } from 'hyperformula/typings/AbsoluteCellRange';
|
|
6
|
-
import { type SimpleCellAddress } from 'hyperformula/typings/Cell';
|
|
7
|
-
import { type SimpleDate, type SimpleDateTime } from 'hyperformula/typings/DateTimeHelper';
|
|
8
|
-
|
|
9
5
|
import { Event } from '@dxos/async';
|
|
6
|
+
import {
|
|
7
|
+
addressFromA1Notation,
|
|
8
|
+
addressToA1Notation,
|
|
9
|
+
createSheetName,
|
|
10
|
+
isFormula,
|
|
11
|
+
type CellAddress,
|
|
12
|
+
type CellRange,
|
|
13
|
+
type CellScalarValue,
|
|
14
|
+
type ComputeGraph,
|
|
15
|
+
type ComputeNode,
|
|
16
|
+
type ComputeNodeEvent,
|
|
17
|
+
DetailedCellError,
|
|
18
|
+
ExportedCellChange,
|
|
19
|
+
type SimpleCellRange,
|
|
20
|
+
type SimpleCellAddress,
|
|
21
|
+
type SimpleDate,
|
|
22
|
+
type SimpleDateTime,
|
|
23
|
+
} from '@dxos/compute';
|
|
10
24
|
import { Resource } from '@dxos/context';
|
|
11
25
|
import { getTypename, FormatEnum, TypeEnum } from '@dxos/echo-schema';
|
|
12
26
|
import { invariant } from '@dxos/invariant';
|
|
13
27
|
import { PublicKey } from '@dxos/keys';
|
|
14
28
|
import { log } from '@dxos/log';
|
|
15
29
|
|
|
16
|
-
import { DetailedCellError, ExportedCellChange } from '#hyperformula';
|
|
17
|
-
import { type ComputeGraph, type ComputeNode, type ComputeNodeEvent, createSheetName } from '../compute-graph';
|
|
18
30
|
import {
|
|
19
|
-
|
|
31
|
+
ReadonlyException,
|
|
20
32
|
addressFromIndex,
|
|
21
|
-
addressToA1Notation,
|
|
22
33
|
addressToIndex,
|
|
23
34
|
initialize,
|
|
24
35
|
insertIndices,
|
|
25
|
-
isFormula,
|
|
26
|
-
type CellAddress,
|
|
27
|
-
type CellRange,
|
|
28
|
-
ReadonlyException,
|
|
29
|
-
MAX_COLUMNS,
|
|
30
|
-
MAX_ROWS,
|
|
31
36
|
mapFormulaIndicesToRefs,
|
|
32
37
|
mapFormulaRefsToIndices,
|
|
33
|
-
|
|
34
|
-
|
|
38
|
+
MAX_ROWS,
|
|
39
|
+
MAX_COLS,
|
|
40
|
+
} from '../types';
|
|
41
|
+
import { type SheetAction, type CellValue, type SheetType } from '../types';
|
|
35
42
|
|
|
43
|
+
// TODO(burdon): Move to compute.
|
|
36
44
|
// Map sheet types to system types.
|
|
37
45
|
// https://hyperformula.handsontable.com/guide/types-of-values.html
|
|
38
46
|
// - https://github.com/handsontable/hyperformula/blob/master/src/Cell.ts (CellValueType)
|
|
@@ -176,12 +184,12 @@ export class SheetModel extends Resource {
|
|
|
176
184
|
}
|
|
177
185
|
|
|
178
186
|
insertColumns(i: number, n = 1) {
|
|
179
|
-
const idx = insertIndices(this._sheet.columns, i, n,
|
|
187
|
+
const idx = insertIndices(this._sheet.columns, i, n, MAX_COLS);
|
|
180
188
|
this.reset();
|
|
181
189
|
return idx;
|
|
182
190
|
}
|
|
183
191
|
|
|
184
|
-
dropRow(rowIndex: string): RestoreAxis {
|
|
192
|
+
dropRow(rowIndex: string): SheetAction.RestoreAxis {
|
|
185
193
|
const range = {
|
|
186
194
|
from: addressFromIndex(this._sheet, `${this._sheet.columns[0]}@${rowIndex}`),
|
|
187
195
|
to: addressFromIndex(this._sheet, `${this._sheet.columns[this._sheet.columns.length - 1]}@${rowIndex}`),
|
|
@@ -195,7 +203,7 @@ export class SheetModel extends Resource {
|
|
|
195
203
|
return { axis: 'row', index, axisIndex: rowIndex, axisMeta: this._sheet.rowMeta[rowIndex], values };
|
|
196
204
|
}
|
|
197
205
|
|
|
198
|
-
dropColumn(colIndex: string): RestoreAxis {
|
|
206
|
+
dropColumn(colIndex: string): SheetAction.RestoreAxis {
|
|
199
207
|
const range = {
|
|
200
208
|
from: addressFromIndex(this._sheet, `${colIndex}@${this._sheet.rows[0]}`),
|
|
201
209
|
to: addressFromIndex(this._sheet, `${colIndex}@${this._sheet.rows[this._sheet.rows.length - 1]}`),
|
|
@@ -209,7 +217,7 @@ export class SheetModel extends Resource {
|
|
|
209
217
|
return { axis: 'col', index, axisIndex: colIndex, axisMeta: this._sheet.rowMeta[colIndex], values };
|
|
210
218
|
}
|
|
211
219
|
|
|
212
|
-
restoreRow({ index, axisIndex, axisMeta, values }: RestoreAxis) {
|
|
220
|
+
restoreRow({ index, axisIndex, axisMeta, values }: SheetAction.RestoreAxis) {
|
|
213
221
|
this._sheet.rows.splice(index, 0, axisIndex);
|
|
214
222
|
values.forEach((value, col) => {
|
|
215
223
|
if (value) {
|
|
@@ -222,7 +230,7 @@ export class SheetModel extends Resource {
|
|
|
222
230
|
this.reset();
|
|
223
231
|
}
|
|
224
232
|
|
|
225
|
-
restoreColumn({ index, axisIndex, axisMeta, values }: RestoreAxis) {
|
|
233
|
+
restoreColumn({ index, axisIndex, axisMeta, values }: SheetAction.RestoreAxis) {
|
|
226
234
|
this._sheet.columns.splice(index, 0, axisIndex);
|
|
227
235
|
values.forEach((value, row) => {
|
|
228
236
|
if (value) {
|
|
@@ -373,7 +381,7 @@ export class SheetModel extends Resource {
|
|
|
373
381
|
refresh = true;
|
|
374
382
|
}
|
|
375
383
|
if (cell.col >= this._sheet.columns.length) {
|
|
376
|
-
insertIndices(this._sheet.columns, cell.col, 1,
|
|
384
|
+
insertIndices(this._sheet.columns, cell.col, 1, MAX_COLS);
|
|
377
385
|
refresh = true;
|
|
378
386
|
}
|
|
379
387
|
|
package/src/model/testing.ts
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { addressToA1Notation
|
|
6
|
-
|
|
5
|
+
import { addressToA1Notation } from '@dxos/compute';
|
|
6
|
+
|
|
7
|
+
import { type CellValue, type SheetType, createSheet } from '../types';
|
|
7
8
|
|
|
8
9
|
// TODO(burdon): Create testing endpoint.
|
|
9
10
|
// TODO(burdon): Move to react-ui-sheet.
|
package/src/sanity.test.ts
CHANGED
|
@@ -12,7 +12,7 @@ import { describe, test, expect } from 'vitest';
|
|
|
12
12
|
|
|
13
13
|
import { Client } from '@dxos/client';
|
|
14
14
|
import { create } from '@dxos/client/echo';
|
|
15
|
-
import { FunctionType } from '@dxos/
|
|
15
|
+
import { FunctionType } from '@dxos/functions';
|
|
16
16
|
|
|
17
17
|
// TODO(burdon): Fix test infrastructure:
|
|
18
18
|
// - Need docs? esp. needed for config. need pristine example package?
|
package/src/testing/testing.tsx
CHANGED
|
@@ -5,13 +5,12 @@
|
|
|
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
9
|
import { type Space } from '@dxos/react-client/echo';
|
|
9
10
|
import { useAsyncState } from '@dxos/react-hooks';
|
|
10
11
|
|
|
11
12
|
import { ComputeGraphContextProvider } from '../components';
|
|
12
|
-
import {
|
|
13
|
-
import { createSheet } from '../defs';
|
|
14
|
-
import { type CreateSheetOptions } from '../types';
|
|
13
|
+
import { createSheet, type CreateSheetOptions } from '../types';
|
|
15
14
|
|
|
16
15
|
export const useTestSheet = (space?: Space, graph?: ComputeGraph, options?: CreateSheetOptions) => {
|
|
17
16
|
const [sheet] = useAsyncState(async () => {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Ref, S, TypedObject } from '@dxos/echo-schema';
|
|
6
|
+
import { ThreadType } from '@dxos/plugin-space/types';
|
|
7
|
+
|
|
8
|
+
export const CellValue = S.Struct({
|
|
9
|
+
// TODO(burdon): How to store dates (datetime, date, time), percentages, etc.
|
|
10
|
+
// Consider import/export; natural access for other plugins. Special handling for currency (precision).
|
|
11
|
+
// TODO(burdon): Automerge (long string) or short string or number.
|
|
12
|
+
value: S.Any,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export type CellValue = S.Schema.Type<typeof CellValue>;
|
|
16
|
+
|
|
17
|
+
// TODO(burdon): IMPORTANT: Reconcile with Field definition.
|
|
18
|
+
export const Range = S.Struct({
|
|
19
|
+
range: S.String,
|
|
20
|
+
key: S.String,
|
|
21
|
+
value: S.String,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export type Range = S.Schema.Type<typeof Range>;
|
|
25
|
+
|
|
26
|
+
// TODO(burdon): Visibility, locked, frozen, etc.
|
|
27
|
+
export const RowColumnMeta = S.Struct({
|
|
28
|
+
size: S.optional(S.Number),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// TODO(burdon): Reconcile col/column (across packages).
|
|
32
|
+
// TODO(burdon): Index to all updates when rows/columns are inserted/deleted.
|
|
33
|
+
export class SheetType extends TypedObject({ typename: 'dxos.org/type/Sheet', version: '0.1.0' })({
|
|
34
|
+
name: S.optional(S.String),
|
|
35
|
+
|
|
36
|
+
// Sparse map of cells referenced by index.
|
|
37
|
+
cells: S.mutable(S.Record({ key: S.String, value: S.mutable(CellValue) })),
|
|
38
|
+
|
|
39
|
+
// Ordered row indices.
|
|
40
|
+
rows: S.mutable(S.Array(S.String)),
|
|
41
|
+
|
|
42
|
+
// Ordered column indices.
|
|
43
|
+
columns: S.mutable(S.Array(S.String)),
|
|
44
|
+
|
|
45
|
+
// Row metadata referenced by index.
|
|
46
|
+
rowMeta: S.mutable(S.Record({ key: S.String, value: S.mutable(RowColumnMeta) })),
|
|
47
|
+
|
|
48
|
+
// Column metadata referenced by index.
|
|
49
|
+
columnMeta: S.mutable(S.Record({ key: S.String, value: S.mutable(RowColumnMeta) })),
|
|
50
|
+
|
|
51
|
+
// Cell formatting referenced by indexed range.
|
|
52
|
+
ranges: S.mutable(S.Array(Range)),
|
|
53
|
+
|
|
54
|
+
// Threads associated with the sheet
|
|
55
|
+
threads: S.optional(S.mutable(S.Array(Ref(ThreadType)))),
|
|
56
|
+
}) {}
|
|
@@ -8,7 +8,7 @@ import { type SheetType } from '../types';
|
|
|
8
8
|
|
|
9
9
|
export const alignKey = 'alignment';
|
|
10
10
|
export type AlignKey = typeof alignKey;
|
|
11
|
-
export type AlignValue = 'start' | 'center' | 'end'
|
|
11
|
+
export type AlignValue = 'start' | 'center' | 'end';
|
|
12
12
|
|
|
13
13
|
export const commentKey = 'comment';
|
|
14
14
|
export type CommentKey = typeof commentKey;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { S } from '@dxos/echo-schema';
|
|
6
|
+
|
|
7
|
+
import { type CellValue, RowColumnMeta, SheetType } from './schema';
|
|
8
|
+
import { SHEET_PLUGIN } from '../meta';
|
|
9
|
+
import { SheetModel } from '../model';
|
|
10
|
+
|
|
11
|
+
export type SheetSize = {
|
|
12
|
+
rows: number;
|
|
13
|
+
columns: number;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type CreateSheetOptions = {
|
|
17
|
+
name?: string;
|
|
18
|
+
cells?: Record<string, CellValue>;
|
|
19
|
+
} & Partial<SheetSize>;
|
|
20
|
+
|
|
21
|
+
export namespace SheetAction {
|
|
22
|
+
const SHEET_ACTION = `${SHEET_PLUGIN}/action`;
|
|
23
|
+
|
|
24
|
+
export class Create extends S.TaggedClass<Create>()(`${SHEET_ACTION}/create`, {
|
|
25
|
+
input: S.Struct({
|
|
26
|
+
name: S.optional(S.String),
|
|
27
|
+
}),
|
|
28
|
+
output: S.Struct({
|
|
29
|
+
object: SheetType,
|
|
30
|
+
}),
|
|
31
|
+
}) {}
|
|
32
|
+
|
|
33
|
+
// TODO(wittjosiah): Factor out. This is `DxGridAxis` from `@dxos/react-ui-grid`.
|
|
34
|
+
const Axis = S.Union(S.Literal('row'), S.Literal('col'));
|
|
35
|
+
|
|
36
|
+
export class InsertAxis extends S.TaggedClass<InsertAxis>()(`${SHEET_ACTION}/axis-insert`, {
|
|
37
|
+
input: S.Struct({
|
|
38
|
+
// TODO(wittjosiah): S.instanceOf(SheetModel) throws when running tests.
|
|
39
|
+
model: S.Any.pipe(S.filter((model) => model instanceof SheetModel)) as S.Schema<SheetModel>,
|
|
40
|
+
axis: Axis,
|
|
41
|
+
index: S.Number,
|
|
42
|
+
count: S.optional(S.Number),
|
|
43
|
+
}),
|
|
44
|
+
output: S.Void,
|
|
45
|
+
}) {}
|
|
46
|
+
|
|
47
|
+
export const RestoreAxis = S.Struct({
|
|
48
|
+
axis: Axis,
|
|
49
|
+
axisIndex: S.String,
|
|
50
|
+
index: S.Number,
|
|
51
|
+
axisMeta: RowColumnMeta,
|
|
52
|
+
values: S.Array(S.Any),
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
export type RestoreAxis = S.Schema.Type<typeof RestoreAxis>;
|
|
56
|
+
|
|
57
|
+
export class DropAxis extends S.TaggedClass<DropAxis>()(`${SHEET_ACTION}/axis-drop`, {
|
|
58
|
+
input: S.Struct({
|
|
59
|
+
// TODO(wittjosiah): S.instanceOf(SheetModel) throws when running tests.
|
|
60
|
+
model: S.Any.pipe(S.filter((model) => model instanceof SheetModel)) as S.Schema<SheetModel>,
|
|
61
|
+
axis: Axis,
|
|
62
|
+
axisIndex: S.String,
|
|
63
|
+
deletionData: S.optional(RestoreAxis),
|
|
64
|
+
}),
|
|
65
|
+
output: S.Void,
|
|
66
|
+
}) {}
|
|
67
|
+
}
|
|
@@ -2,10 +2,6 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { randomBytes } from '@dxos/crypto';
|
|
6
|
-
import { invariant } from '@dxos/invariant';
|
|
7
|
-
import { create } from '@dxos/live-object';
|
|
8
|
-
|
|
9
5
|
import {
|
|
10
6
|
addressFromA1Notation,
|
|
11
7
|
addressToA1Notation,
|
|
@@ -13,13 +9,19 @@ import {
|
|
|
13
9
|
type CellAddress,
|
|
14
10
|
type CellRange,
|
|
15
11
|
type CompleteCellRange,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
} from '@dxos/compute';
|
|
13
|
+
import { randomBytes } from '@dxos/crypto';
|
|
14
|
+
import { invariant } from '@dxos/invariant';
|
|
15
|
+
import { create } from '@dxos/live-object';
|
|
16
|
+
|
|
21
17
|
import { type CreateSheetOptions, type SheetSize, SheetType } from '../types';
|
|
22
18
|
|
|
19
|
+
export const MAX_ROWS = 500;
|
|
20
|
+
export const MAX_COLS = 676; // 26^2;
|
|
21
|
+
|
|
22
|
+
export const DEFAULT_ROWS = 50;
|
|
23
|
+
export const DEFAULT_COLS = 26;
|
|
24
|
+
|
|
23
25
|
// TODO(burdon): Factor out from dxos/protocols to new common package.
|
|
24
26
|
export class ApiError extends Error {}
|
|
25
27
|
|
|
@@ -31,8 +33,6 @@ export class RangeException extends ApiError {
|
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
35
|
|
|
34
|
-
// TODO(burdon): Factor out to types lib.
|
|
35
|
-
|
|
36
36
|
/**
|
|
37
37
|
* With a string length of 8, the chance of a collision is 0.02% for a sheet with 10,000 strings.
|
|
38
38
|
*/
|
|
@@ -57,13 +57,13 @@ export const insertIndices = (indices: string[], i: number, n: number, max: numb
|
|
|
57
57
|
|
|
58
58
|
export const initialize = (
|
|
59
59
|
sheet: SheetType,
|
|
60
|
-
{ rows = DEFAULT_ROWS, columns =
|
|
60
|
+
{ rows = DEFAULT_ROWS, columns = DEFAULT_COLS }: Partial<SheetSize> = {},
|
|
61
61
|
) => {
|
|
62
62
|
if (!sheet.rows.length) {
|
|
63
63
|
insertIndices(sheet.rows, 0, rows, MAX_ROWS);
|
|
64
64
|
}
|
|
65
65
|
if (!sheet.columns.length) {
|
|
66
|
-
insertIndices(sheet.columns, 0, columns,
|
|
66
|
+
insertIndices(sheet.columns, 0, columns, MAX_COLS);
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
69
|
|