@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
|
@@ -2,43 +2,40 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import React, {
|
|
5
|
+
import { Atom, type Registry, RegistryContext } from '@effect-atom/atom-react';
|
|
6
|
+
import React, { useContext, useMemo } from 'react';
|
|
7
7
|
|
|
8
|
-
import { useAppGraph } from '@dxos/app-
|
|
9
|
-
import { type CompleteCellRange } from '@dxos/compute';
|
|
10
|
-
import { type
|
|
11
|
-
import {
|
|
12
|
-
type ActionGraphProps,
|
|
13
|
-
MenuProvider,
|
|
14
|
-
ToolbarMenu,
|
|
15
|
-
createGapSeparator,
|
|
16
|
-
rxFromSignal,
|
|
17
|
-
useMenuActions,
|
|
18
|
-
} from '@dxos/react-ui-menu';
|
|
8
|
+
import { useAppGraph } from '@dxos/app-toolkit/ui';
|
|
9
|
+
import { type CompleteCellRange } from '@dxos/compute-hyperformula';
|
|
10
|
+
import { type ActionGraphProps, Menu, createGapSeparator, useMenuActions } from '@dxos/react-ui-menu';
|
|
11
|
+
import { composable, composableProps } from '@dxos/ui-theme';
|
|
19
12
|
|
|
20
13
|
import { type SheetModel } from '../../model';
|
|
21
|
-
import { useSheetContext } from '../
|
|
22
|
-
|
|
14
|
+
import { useSheetContext } from '../SheetRoot';
|
|
23
15
|
import { createAlign, useAlignState } from './align';
|
|
24
16
|
import { createStyle, useStyleState } from './style';
|
|
25
|
-
import { type
|
|
26
|
-
|
|
27
|
-
//
|
|
28
|
-
// Root
|
|
29
|
-
//
|
|
17
|
+
import { type ToolbarStateAtom, useToolbarState } from './useToolbarState';
|
|
30
18
|
|
|
31
|
-
|
|
19
|
+
type ToolbarActionsContext = {
|
|
20
|
+
model: SheetModel;
|
|
21
|
+
stateAtom: ToolbarStateAtom;
|
|
22
|
+
registry: Registry.Registry;
|
|
23
|
+
cursorFallbackRange?: CompleteCellRange;
|
|
24
|
+
customActions?: Atom.Atom<ActionGraphProps>;
|
|
25
|
+
};
|
|
32
26
|
|
|
33
|
-
const createToolbarActions = (
|
|
34
|
-
model
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const
|
|
27
|
+
const createToolbarActions = ({
|
|
28
|
+
model,
|
|
29
|
+
stateAtom,
|
|
30
|
+
registry,
|
|
31
|
+
cursorFallbackRange,
|
|
32
|
+
customActions,
|
|
33
|
+
}: ToolbarActionsContext): Atom.Atom<ActionGraphProps> => {
|
|
34
|
+
return Atom.make((get) => {
|
|
35
|
+
const state = get(stateAtom);
|
|
36
|
+
const context = { model, state, stateAtom, registry, cursorFallbackRange };
|
|
37
|
+
const align = createAlign(context);
|
|
38
|
+
const style = createStyle(context);
|
|
42
39
|
const gap = createGapSeparator();
|
|
43
40
|
|
|
44
41
|
const graph: ActionGraphProps = {
|
|
@@ -56,30 +53,38 @@ const createToolbarActions = (
|
|
|
56
53
|
});
|
|
57
54
|
};
|
|
58
55
|
|
|
59
|
-
export
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
56
|
+
export type SheetToolbarProps = {};
|
|
57
|
+
|
|
58
|
+
export const SheetToolbar = composable<HTMLDivElement, SheetToolbarProps>((props, forwardedRef) => {
|
|
59
|
+
const { attendableId, model, cursorFallbackRange } = useSheetContext();
|
|
60
|
+
const stateAtom = useToolbarState({});
|
|
61
|
+
const registry = useContext(RegistryContext);
|
|
62
|
+
useAlignState(stateAtom);
|
|
63
|
+
useStyleState(stateAtom);
|
|
64
64
|
|
|
65
65
|
const { graph } = useAppGraph();
|
|
66
66
|
const customActions = useMemo(() => {
|
|
67
|
-
return
|
|
68
|
-
const actions = get(graph.actions(
|
|
67
|
+
return Atom.make((get) => {
|
|
68
|
+
const actions = get(graph.actions(attendableId));
|
|
69
69
|
const nodes = actions.filter((action) => action.properties.disposition === 'toolbar');
|
|
70
|
-
return {
|
|
70
|
+
return {
|
|
71
|
+
nodes,
|
|
72
|
+
edges: nodes.map((node) => ({ source: 'root', target: node.id, relation: 'child' })),
|
|
73
|
+
};
|
|
71
74
|
});
|
|
72
|
-
}, [graph]);
|
|
75
|
+
}, [graph, attendableId]);
|
|
73
76
|
|
|
74
77
|
const actionsCreator = useMemo(
|
|
75
|
-
() => createToolbarActions(model,
|
|
76
|
-
[model,
|
|
78
|
+
() => createToolbarActions({ model, stateAtom, registry, cursorFallbackRange, customActions }),
|
|
79
|
+
[model, stateAtom, registry, cursorFallbackRange, customActions],
|
|
77
80
|
);
|
|
78
|
-
const
|
|
81
|
+
const menuActions = useMenuActions(actionsCreator);
|
|
79
82
|
|
|
80
83
|
return (
|
|
81
|
-
<
|
|
82
|
-
<
|
|
83
|
-
</
|
|
84
|
+
<Menu.Root {...menuActions} attendableId={attendableId}>
|
|
85
|
+
<Menu.Toolbar {...composableProps(props)} ref={forwardedRef} />
|
|
86
|
+
</Menu.Root>
|
|
84
87
|
);
|
|
85
|
-
};
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
SheetToolbar.displayName = 'SheetToolbar';
|
|
@@ -2,17 +2,24 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { type Registry, RegistryContext } from '@effect-atom/atom-react';
|
|
6
|
+
import { useContext, useEffect } from 'react';
|
|
6
7
|
|
|
7
|
-
import { type CompleteCellRange, inRange } from '@dxos/compute';
|
|
8
|
-
import {
|
|
8
|
+
import { type CompleteCellRange, inRange } from '@dxos/compute-hyperformula';
|
|
9
|
+
import { Obj } from '@dxos/echo';
|
|
10
|
+
import {
|
|
11
|
+
type ActionGraphProps,
|
|
12
|
+
type ToolbarMenuActionGroupProperties,
|
|
13
|
+
createMenuAction,
|
|
14
|
+
createMenuItemGroup,
|
|
15
|
+
} from '@dxos/react-ui-menu';
|
|
9
16
|
|
|
10
|
-
import {
|
|
11
|
-
import { type
|
|
12
|
-
import { type AlignKey, type AlignValue, alignKey, rangeFromIndex, rangeToIndex } from '../../types';
|
|
13
|
-
import { useSheetContext } from '../SheetContext';
|
|
17
|
+
import { meta } from '#meta';
|
|
18
|
+
import { type AlignKey, type AlignValue, alignKey, rangeFromIndex, rangeToIndex } from '#types';
|
|
14
19
|
|
|
15
|
-
import { type
|
|
20
|
+
import { type SheetModel } from '../../model';
|
|
21
|
+
import { useSheetContext } from '../SheetRoot';
|
|
22
|
+
import { type ToolbarState, type ToolbarStateAtom } from './useToolbarState';
|
|
16
23
|
|
|
17
24
|
export type AlignAction = { key: AlignKey; value: AlignValue };
|
|
18
25
|
|
|
@@ -24,29 +31,40 @@ const aligns: Record<AlignValue, string> = {
|
|
|
24
31
|
end: 'ph--text-align-right--regular',
|
|
25
32
|
};
|
|
26
33
|
|
|
27
|
-
export const useAlignState = (
|
|
34
|
+
export const useAlignState = (stateAtom: ToolbarStateAtom) => {
|
|
35
|
+
const registry = useContext(RegistryContext);
|
|
28
36
|
const { cursor, model } = useSheetContext();
|
|
29
37
|
useEffect(() => {
|
|
30
38
|
// TODO(thure): Can this O(n) call be memoized?
|
|
31
|
-
|
|
39
|
+
const alignValue = (
|
|
32
40
|
cursor
|
|
33
41
|
? model.sheet.ranges?.findLast(
|
|
34
42
|
({ range, key }) => key === alignKey && inRange(rangeFromIndex(model.sheet, range), cursor),
|
|
35
43
|
)?.value
|
|
36
44
|
: undefined
|
|
37
45
|
) as AlignValue | undefined;
|
|
38
|
-
|
|
46
|
+
const prev = registry.get(stateAtom);
|
|
47
|
+
registry.set(stateAtom, { ...prev, [alignKey]: alignValue });
|
|
48
|
+
}, [cursor, model.sheet, registry, stateAtom]);
|
|
39
49
|
};
|
|
40
50
|
|
|
41
51
|
const createAlignGroupAction = (value?: AlignValue) =>
|
|
42
52
|
createMenuItemGroup('align', {
|
|
43
|
-
label: ['align
|
|
53
|
+
label: ['align.label', { ns: meta.id }],
|
|
44
54
|
variant: 'toggleGroup',
|
|
45
55
|
selectCardinality: 'single',
|
|
46
56
|
value: `${alignKey}--${value}`,
|
|
47
57
|
} as ToolbarMenuActionGroupProperties);
|
|
48
58
|
|
|
49
|
-
|
|
59
|
+
type AlignActionsContext = {
|
|
60
|
+
model: SheetModel;
|
|
61
|
+
state: ToolbarState;
|
|
62
|
+
stateAtom: ToolbarStateAtom;
|
|
63
|
+
registry: Registry.Registry;
|
|
64
|
+
cursorFallbackRange?: CompleteCellRange;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const createAlignActions = ({ model, state, stateAtom, registry, cursorFallbackRange }: AlignActionsContext) =>
|
|
50
68
|
Object.entries(aligns).map(([alignValue, icon]) => {
|
|
51
69
|
return createMenuAction<AlignAction>(
|
|
52
70
|
`${alignKey}--${alignValue}`,
|
|
@@ -64,36 +82,43 @@ const createAlignActions = (model: SheetModel, state: ToolbarState, cursorFallba
|
|
|
64
82
|
key: alignKey,
|
|
65
83
|
value: alignValue as AlignValue,
|
|
66
84
|
};
|
|
85
|
+
const currentState = registry.get(stateAtom);
|
|
67
86
|
if (index < 0) {
|
|
68
|
-
model.sheet
|
|
69
|
-
|
|
87
|
+
Obj.update(model.sheet, (obj) => {
|
|
88
|
+
obj.ranges?.push(nextRangeEntity);
|
|
89
|
+
});
|
|
90
|
+
registry.set(stateAtom, { ...currentState, [alignKey]: nextRangeEntity.value });
|
|
70
91
|
} else if (model.sheet.ranges![index].value === nextRangeEntity.value) {
|
|
71
|
-
model.sheet
|
|
72
|
-
|
|
92
|
+
Obj.update(model.sheet, (obj) => {
|
|
93
|
+
obj.ranges?.splice(index, 1);
|
|
94
|
+
});
|
|
95
|
+
registry.set(stateAtom, { ...currentState, [alignKey]: undefined });
|
|
73
96
|
} else {
|
|
74
|
-
model.sheet
|
|
75
|
-
|
|
97
|
+
Obj.update(model.sheet, (obj) => {
|
|
98
|
+
obj.ranges?.splice(index, 1, nextRangeEntity);
|
|
99
|
+
});
|
|
100
|
+
registry.set(stateAtom, { ...currentState, [alignKey]: nextRangeEntity.value });
|
|
76
101
|
}
|
|
77
102
|
},
|
|
78
103
|
{
|
|
79
104
|
key: alignKey,
|
|
80
105
|
value: alignValue as AlignValue,
|
|
81
106
|
checked: state[alignKey] === alignValue,
|
|
82
|
-
label: [`range
|
|
107
|
+
label: [`range-value.${alignValue}.label`, { ns: meta.id }],
|
|
83
108
|
icon,
|
|
84
109
|
testId: `grid.toolbar.${alignKey}.${alignValue}`,
|
|
85
110
|
},
|
|
86
111
|
);
|
|
87
112
|
});
|
|
88
113
|
|
|
89
|
-
export const createAlign = (
|
|
90
|
-
const alignGroup = createAlignGroupAction(state[alignKey]);
|
|
91
|
-
const alignActions = createAlignActions(
|
|
114
|
+
export const createAlign = (context: AlignActionsContext): ActionGraphProps => {
|
|
115
|
+
const alignGroup = createAlignGroupAction(context.state[alignKey]);
|
|
116
|
+
const alignActions = createAlignActions(context);
|
|
92
117
|
return {
|
|
93
118
|
nodes: [alignGroup, ...alignActions],
|
|
94
119
|
edges: [
|
|
95
|
-
{ source: 'root', target: 'align' },
|
|
96
|
-
...alignActions.map(({ id }) => ({ source: alignGroup.id, target: id })),
|
|
120
|
+
{ source: 'root', target: 'align', relation: 'child' },
|
|
121
|
+
...alignActions.map(({ id }) => ({ source: alignGroup.id, target: id, relation: 'child' })),
|
|
97
122
|
],
|
|
98
123
|
};
|
|
99
124
|
};
|
|
@@ -2,15 +2,24 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { type Registry, RegistryContext } from '@effect-atom/atom-react';
|
|
6
|
+
import { useContext, useEffect } from 'react';
|
|
6
7
|
|
|
7
|
-
import { type CompleteCellRange, inRange } from '@dxos/compute';
|
|
8
|
-
import {
|
|
8
|
+
import { type CompleteCellRange, inRange } from '@dxos/compute-hyperformula';
|
|
9
|
+
import { Obj } from '@dxos/echo';
|
|
10
|
+
import {
|
|
11
|
+
type ActionGraphProps,
|
|
12
|
+
type ToolbarMenuActionGroupProperties,
|
|
13
|
+
createMenuAction,
|
|
14
|
+
createMenuItemGroup,
|
|
15
|
+
} from '@dxos/react-ui-menu';
|
|
16
|
+
|
|
17
|
+
import { meta } from '#meta';
|
|
18
|
+
import { type StyleKey, type StyleValue, rangeFromIndex, rangeToIndex } from '#types';
|
|
9
19
|
|
|
10
|
-
import { SHEET_PLUGIN } from '../../meta';
|
|
11
20
|
import { type SheetModel } from '../../model';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
21
|
+
import { useSheetContext } from '../SheetRoot';
|
|
22
|
+
import { type ToolbarState, type ToolbarStateAtom } from './useToolbarState';
|
|
14
23
|
|
|
15
24
|
export type StyleState = Partial<Record<StyleValue, boolean>>;
|
|
16
25
|
|
|
@@ -21,22 +30,30 @@ const styles: Record<StyleValue, string> = {
|
|
|
21
30
|
softwrap: 'ph--paragraph--regular',
|
|
22
31
|
};
|
|
23
32
|
|
|
24
|
-
export const useStyleState = (
|
|
33
|
+
export const useStyleState = (stateAtom: ToolbarStateAtom) => {
|
|
34
|
+
const registry = useContext(RegistryContext);
|
|
25
35
|
const { cursorFallbackRange, model } = useSheetContext();
|
|
26
36
|
|
|
27
37
|
useEffect(() => {
|
|
28
|
-
|
|
29
|
-
|
|
38
|
+
let highlight = false;
|
|
39
|
+
let softwrap = false;
|
|
30
40
|
if (cursorFallbackRange && model.sheet.ranges) {
|
|
31
41
|
model.sheet.ranges
|
|
32
42
|
.filter(
|
|
33
43
|
({ range, key }) => key === 'style' && inRange(rangeFromIndex(model.sheet, range), cursorFallbackRange.from),
|
|
34
44
|
)
|
|
35
45
|
.forEach(({ value }) => {
|
|
36
|
-
|
|
46
|
+
if (value === 'highlight') {
|
|
47
|
+
highlight = true;
|
|
48
|
+
}
|
|
49
|
+
if (value === 'softwrap') {
|
|
50
|
+
softwrap = true;
|
|
51
|
+
}
|
|
37
52
|
});
|
|
38
53
|
}
|
|
39
|
-
|
|
54
|
+
const prev = registry.get(stateAtom);
|
|
55
|
+
registry.set(stateAtom, { ...prev, highlight, softwrap });
|
|
56
|
+
}, [cursorFallbackRange, model.sheet, registry, stateAtom]);
|
|
40
57
|
};
|
|
41
58
|
|
|
42
59
|
const createStyleGroup = (state: StyleState) => {
|
|
@@ -49,7 +66,15 @@ const createStyleGroup = (state: StyleState) => {
|
|
|
49
66
|
} as ToolbarMenuActionGroupProperties);
|
|
50
67
|
};
|
|
51
68
|
|
|
52
|
-
|
|
69
|
+
type StyleActionsContext = {
|
|
70
|
+
model: SheetModel;
|
|
71
|
+
state: ToolbarState;
|
|
72
|
+
stateAtom: ToolbarStateAtom;
|
|
73
|
+
registry: Registry.Registry;
|
|
74
|
+
cursorFallbackRange?: CompleteCellRange;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const createStyleActions = ({ model, state, stateAtom, registry, cursorFallbackRange }: StyleActionsContext) =>
|
|
53
78
|
Object.entries(styles).map(([styleValue, icon]) => {
|
|
54
79
|
return createMenuAction<StyleAction>(
|
|
55
80
|
`style--${styleValue}`,
|
|
@@ -67,6 +92,7 @@ const createStyleActions = (model: SheetModel, state: StyleState, cursorFallback
|
|
|
67
92
|
key: 'style',
|
|
68
93
|
value: styleValue as StyleValue,
|
|
69
94
|
};
|
|
95
|
+
const currentState = registry.get(stateAtom);
|
|
70
96
|
if (
|
|
71
97
|
model.sheet.ranges
|
|
72
98
|
.filter(
|
|
@@ -77,32 +103,36 @@ const createStyleActions = (model: SheetModel, state: StyleState, cursorFallback
|
|
|
77
103
|
) {
|
|
78
104
|
// this value should be unset
|
|
79
105
|
if (index >= 0) {
|
|
80
|
-
model.sheet
|
|
106
|
+
Obj.update(model.sheet, (obj) => {
|
|
107
|
+
obj.ranges?.splice(index, 1);
|
|
108
|
+
});
|
|
81
109
|
}
|
|
82
|
-
|
|
110
|
+
registry.set(stateAtom, { ...currentState, [nextRangeEntity.value]: false });
|
|
83
111
|
} else {
|
|
84
|
-
model.sheet
|
|
85
|
-
|
|
112
|
+
Obj.update(model.sheet, (obj) => {
|
|
113
|
+
obj.ranges?.push(nextRangeEntity);
|
|
114
|
+
});
|
|
115
|
+
registry.set(stateAtom, { ...currentState, [nextRangeEntity.value]: true });
|
|
86
116
|
}
|
|
87
117
|
},
|
|
88
118
|
{
|
|
89
119
|
key: 'style',
|
|
90
120
|
value: styleValue as StyleValue,
|
|
91
121
|
icon,
|
|
92
|
-
label: [`range
|
|
122
|
+
label: [`range-value.${styleValue}.label`, { ns: meta.id }],
|
|
93
123
|
checked: !!state[styleValue as StyleValue],
|
|
94
124
|
},
|
|
95
125
|
);
|
|
96
126
|
});
|
|
97
127
|
|
|
98
|
-
export const createStyle = (
|
|
99
|
-
const styleGroupAction = createStyleGroup(state);
|
|
100
|
-
const styleActions = createStyleActions(
|
|
128
|
+
export const createStyle = (context: StyleActionsContext): ActionGraphProps => {
|
|
129
|
+
const styleGroupAction = createStyleGroup(context.state);
|
|
130
|
+
const styleActions = createStyleActions(context);
|
|
101
131
|
return {
|
|
102
132
|
nodes: [styleGroupAction, ...styleActions],
|
|
103
133
|
edges: [
|
|
104
|
-
{ source: 'root', target: 'style' },
|
|
105
|
-
...styleActions.map(({ id }) => ({ source: styleGroupAction.id, target: id })),
|
|
134
|
+
{ source: 'root', target: 'style', relation: 'child' },
|
|
135
|
+
...styleActions.map(({ id }) => ({ source: styleGroupAction.id, target: id, relation: 'child' })),
|
|
106
136
|
],
|
|
107
137
|
};
|
|
108
138
|
};
|
|
@@ -2,15 +2,32 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import { live } from '@dxos/live-object';
|
|
5
|
+
import { Atom, type Registry, RegistryContext, useAtomValue } from '@effect-atom/atom-react';
|
|
6
|
+
import { useContext, useMemo } from 'react';
|
|
8
7
|
|
|
9
8
|
import { type AlignState } from './align';
|
|
10
9
|
import { type StyleState } from './style';
|
|
11
10
|
|
|
12
11
|
export type ToolbarState = Partial<StyleState & AlignState>;
|
|
12
|
+
export type ToolbarStateAtom = Atom.Writable<ToolbarState>;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Creates a reactive toolbar state Atom.
|
|
16
|
+
*/
|
|
17
|
+
export const useToolbarState = (initialState: ToolbarState = {}): ToolbarStateAtom => {
|
|
18
|
+
return useMemo(() => Atom.make<ToolbarState>(initialState).pipe(Atom.keepAlive), []);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Hook to read the current toolbar state value.
|
|
23
|
+
*/
|
|
24
|
+
export const useToolbarStateValue = (stateAtom: ToolbarStateAtom): ToolbarState => {
|
|
25
|
+
return useAtomValue(stateAtom);
|
|
26
|
+
};
|
|
13
27
|
|
|
14
|
-
|
|
15
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Hook to get the registry for updating toolbar state.
|
|
30
|
+
*/
|
|
31
|
+
export const useToolbarStateRegistry = (): Registry.Registry => {
|
|
32
|
+
return useContext(RegistryContext);
|
|
16
33
|
};
|
package/src/components/index.ts
CHANGED
|
@@ -2,11 +2,5 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { lazy } from 'react';
|
|
6
|
-
|
|
7
5
|
export * from './ComputeGraph';
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './RangeList';
|
|
10
|
-
export * from './SheetContext';
|
|
11
|
-
|
|
12
|
-
export const SheetContainer = lazy(() => import('./SheetContainer'));
|
|
6
|
+
export * from './Sheet';
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
import React, { useCallback } from 'react';
|
|
7
|
+
|
|
8
|
+
import { rangeToA1Notation } from '@dxos/compute-hyperformula';
|
|
9
|
+
import { useObject } from '@dxos/echo-react';
|
|
10
|
+
import { Input, Message, useTranslation } from '@dxos/react-ui';
|
|
11
|
+
import { List } from '@dxos/react-ui-list';
|
|
12
|
+
|
|
13
|
+
import { meta } from '#meta';
|
|
14
|
+
import { rangeFromIndex } from '#types';
|
|
15
|
+
import { Sheet } from '#types';
|
|
16
|
+
|
|
17
|
+
export type RangeListProps = {
|
|
18
|
+
sheet: Sheet.Sheet;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const RangeList = ({ sheet: sheetProp }: RangeListProps) => {
|
|
22
|
+
const { t } = useTranslation(meta.id);
|
|
23
|
+
const [sheet, updateSheet] = useObject(sheetProp);
|
|
24
|
+
// TODO(thure): Implement similar to comments, #8121
|
|
25
|
+
const handleSelectRange = (range: Sheet.Range) => {};
|
|
26
|
+
const handleDeleteRange = useCallback(
|
|
27
|
+
(range: Sheet.Range) => {
|
|
28
|
+
const index = sheet.ranges.findIndex((sheetRange) => sheetRange === range);
|
|
29
|
+
updateSheet((sheet) => {
|
|
30
|
+
sheet.ranges.splice(index, 1);
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
[sheet, updateSheet],
|
|
34
|
+
);
|
|
35
|
+
return (
|
|
36
|
+
<>
|
|
37
|
+
<Input.Root>
|
|
38
|
+
<Input.Label>{t('range-list.heading')}</Input.Label>
|
|
39
|
+
</Input.Root>
|
|
40
|
+
{sheet.ranges.length < 1 ? (
|
|
41
|
+
<Message.Root>
|
|
42
|
+
<Message.Title>{t('no-ranges.message')}</Message.Title>
|
|
43
|
+
</Message.Root>
|
|
44
|
+
) : (
|
|
45
|
+
<List.Root<Sheet.Range> items={sheet.ranges} isItem={Schema.is(Sheet.Range)}>
|
|
46
|
+
{({ items: ranges }) =>
|
|
47
|
+
ranges.map((range, i) => (
|
|
48
|
+
<List.Item key={i} item={range}>
|
|
49
|
+
<List.ItemDragHandle />
|
|
50
|
+
<List.ItemTitle onClick={() => handleSelectRange(range)}>
|
|
51
|
+
{t('range.title', {
|
|
52
|
+
position: rangeToA1Notation(rangeFromIndex(sheetProp, range.range)),
|
|
53
|
+
key: t(`range-key.${range.key}.label`),
|
|
54
|
+
value: t(`range-value.${range.value}.label`),
|
|
55
|
+
})}
|
|
56
|
+
</List.ItemTitle>
|
|
57
|
+
<List.ItemDeleteButton onClick={() => handleDeleteRange(range)} />
|
|
58
|
+
</List.Item>
|
|
59
|
+
))
|
|
60
|
+
}
|
|
61
|
+
</List.Root>
|
|
62
|
+
)}
|
|
63
|
+
</>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta } from '@storybook/react-vite';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import React, { useContext } from 'react';
|
|
8
|
+
|
|
9
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
10
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
11
|
+
import { Operation, OperationHandlerSet } from '@dxos/compute';
|
|
12
|
+
import { Obj } from '@dxos/echo';
|
|
13
|
+
import { corePlugins } from '@dxos/plugin-testing';
|
|
14
|
+
import { useSpaces } from '@dxos/react-client/echo';
|
|
15
|
+
import { withClientProvider } from '@dxos/react-client/testing';
|
|
16
|
+
import { AttendableContainer } from '@dxos/react-ui-attention';
|
|
17
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
18
|
+
|
|
19
|
+
import { ComputeGraphContext, useComputeGraph } from '#components';
|
|
20
|
+
import { createTestCells, useTestSheet, withComputeGraphDecorator } from '#testing';
|
|
21
|
+
import { translations } from '#translations';
|
|
22
|
+
import { SheetOperation } from '#types';
|
|
23
|
+
import { Sheet } from '#types';
|
|
24
|
+
|
|
25
|
+
import RangeList from '../RangeList';
|
|
26
|
+
import { SheetContainer } from './SheetContainer';
|
|
27
|
+
|
|
28
|
+
const meta = {
|
|
29
|
+
title: 'plugins/plugin-sheet/containers/SheetContainer',
|
|
30
|
+
component: SheetContainer,
|
|
31
|
+
decorators: [
|
|
32
|
+
withTheme(),
|
|
33
|
+
withLayout({ layout: 'fullscreen' }),
|
|
34
|
+
withClientProvider({ types: [Sheet.Sheet], createSpace: true }),
|
|
35
|
+
withComputeGraphDecorator(),
|
|
36
|
+
withPluginManager({
|
|
37
|
+
plugins: [...corePlugins()],
|
|
38
|
+
capabilities: [
|
|
39
|
+
Capability.contributes(
|
|
40
|
+
Capabilities.OperationHandler,
|
|
41
|
+
OperationHandlerSet.make(
|
|
42
|
+
Operation.withHandler(SheetOperation.DropAxis, ({ model, axis, axisIndex }) =>
|
|
43
|
+
Effect.sync(() => {
|
|
44
|
+
model[axis === 'col' ? 'dropColumn' : 'dropRow'](axisIndex);
|
|
45
|
+
return { axis, axisIndex, index: 0, axisMeta: null, values: [] };
|
|
46
|
+
}),
|
|
47
|
+
),
|
|
48
|
+
),
|
|
49
|
+
),
|
|
50
|
+
],
|
|
51
|
+
}),
|
|
52
|
+
],
|
|
53
|
+
parameters: {
|
|
54
|
+
layout: 'fullscreen',
|
|
55
|
+
translations,
|
|
56
|
+
},
|
|
57
|
+
} satisfies Meta<typeof SheetContainer>;
|
|
58
|
+
|
|
59
|
+
export default meta;
|
|
60
|
+
|
|
61
|
+
export const Default = () => {
|
|
62
|
+
const [space] = useSpaces();
|
|
63
|
+
const graph = useComputeGraph(space);
|
|
64
|
+
const { registry } = useContext(ComputeGraphContext) ?? {};
|
|
65
|
+
const sheet = useTestSheet(space, graph, { cells: createTestCells() });
|
|
66
|
+
if (!sheet || !space || !registry) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<AttendableContainer id={Obj.getDXN(sheet).toString()} classNames='contents'>
|
|
72
|
+
<SheetContainer
|
|
73
|
+
role='article'
|
|
74
|
+
space={space}
|
|
75
|
+
subject={sheet}
|
|
76
|
+
attendableId='test'
|
|
77
|
+
registry={registry}
|
|
78
|
+
ignoreAttention
|
|
79
|
+
/>
|
|
80
|
+
</AttendableContainer>
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export const Spec = () => {
|
|
85
|
+
const [space] = useSpaces();
|
|
86
|
+
const graph = useComputeGraph(space);
|
|
87
|
+
const { registry } = useContext(ComputeGraphContext) ?? {};
|
|
88
|
+
const sheet = useTestSheet(space, graph, { cells: { A1: { value: 'Ready' } } });
|
|
89
|
+
if (!sheet || !space || !registry) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<AttendableContainer id={Obj.getDXN(sheet).toString()} classNames='contents'>
|
|
95
|
+
<div className='w-full grid grid-cols-[1fr_20rem]'>
|
|
96
|
+
<SheetContainer
|
|
97
|
+
role='article'
|
|
98
|
+
space={space}
|
|
99
|
+
subject={sheet}
|
|
100
|
+
attendableId='test'
|
|
101
|
+
registry={registry}
|
|
102
|
+
ignoreAttention
|
|
103
|
+
/>
|
|
104
|
+
<div data-testid='grid.range-list'>
|
|
105
|
+
<RangeList sheet={sheet} />
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
</AttendableContainer>
|
|
109
|
+
);
|
|
110
|
+
};
|