@dxos/plugin-sheet 0.8.4-main.bc674ce → 0.8.4-main.bcb3aa67d6
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/{chunk-KE3AKN5W.mjs → chunk-CBNIKBPQ.mjs} +21 -140
- package/dist/lib/browser/chunk-CBNIKBPQ.mjs.map +7 -0
- package/dist/lib/browser/chunk-GZ2EV64I.mjs +118 -0
- package/dist/lib/browser/chunk-GZ2EV64I.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/browser/drop-axis-PB7F3LBV.mjs +23 -0
- package/dist/lib/browser/drop-axis-PB7F3LBV.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +104 -86
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/insert-axis-DH5CO4AY.mjs +16 -0
- package/dist/lib/browser/insert-axis-DH5CO4AY.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operations/index.mjs +13 -0
- package/dist/lib/browser/operations/index.mjs.map +7 -0
- package/dist/lib/browser/restore-axis-Y5H5IOC6.mjs +16 -0
- package/dist/lib/browser/restore-axis-Y5H5IOC6.mjs.map +7 -0
- package/dist/lib/browser/scroll-to-anchor-MN36E3X7.mjs +65 -0
- package/dist/lib/browser/scroll-to-anchor-MN36E3X7.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +2 -3
- package/dist/lib/node-esm/{chunk-6J5L47IB.mjs → chunk-3ZYLQWHC.mjs} +21 -140
- package/dist/lib/node-esm/chunk-3ZYLQWHC.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-74MOADQ7.mjs +119 -0
- package/dist/lib/node-esm/chunk-74MOADQ7.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/drop-axis-UBBQCU6D.mjs +24 -0
- package/dist/lib/node-esm/drop-axis-UBBQCU6D.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +104 -86
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/insert-axis-S7BR2RSJ.mjs +17 -0
- package/dist/lib/node-esm/insert-axis-S7BR2RSJ.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operations/index.mjs +14 -0
- package/dist/lib/node-esm/operations/index.mjs.map +7 -0
- package/dist/lib/node-esm/restore-axis-6B25SOHX.mjs +17 -0
- package/dist/lib/node-esm/restore-axis-6B25SOHX.mjs.map +7 -0
- package/dist/lib/node-esm/scroll-to-anchor-YLB4MYGF.mjs +66 -0
- package/dist/lib/node-esm/scroll-to-anchor-YLB4MYGF.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +2 -3
- package/dist/types/src/SheetPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/anchor-sort.d.ts +6 -0
- package/dist/types/src/capabilities/anchor-sort.d.ts.map +1 -0
- package/dist/types/src/capabilities/compute-graph-registry.d.ts +5 -0
- package/dist/types/src/capabilities/compute-graph-registry.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +9 -5
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/markdown.d.ts +5 -0
- package/dist/types/src/capabilities/markdown.d.ts.map +1 -0
- 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 +5 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- 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/compute-graph.stories.d.ts.map +1 -1
- package/dist/types/src/components/Sheet/Sheet.d.ts +29 -0
- package/dist/types/src/components/Sheet/Sheet.d.ts.map +1 -0
- package/dist/types/src/components/Sheet/index.d.ts +2 -0
- package/dist/types/src/components/Sheet/index.d.ts.map +1 -0
- package/dist/types/src/components/SheetContent/SheetCellEditor.stories.d.ts.map +1 -0
- package/dist/types/src/components/SheetContent/SheetContent.d.ts +10 -0
- package/dist/types/src/components/SheetContent/SheetContent.d.ts.map +1 -0
- package/dist/types/src/components/SheetContent/SheetContent.stories.d.ts +63 -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/SheetContent/util.d.ts.map +1 -0
- package/dist/types/src/components/{SheetContext/SheetContext.d.ts → SheetRoot/SheetRoot.d.ts} +7 -5
- 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 +10 -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 +9 -5
- package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts +72 -68
- package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/align.d.ts +1 -1
- package/dist/types/src/components/SheetToolbar/align.d.ts.map +1 -1
- package/dist/types/src/components/SheetToolbar/style.d.ts +1 -1
- package/dist/types/src/components/SheetToolbar/style.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/{components → containers}/RangeList/RangeList.d.ts +1 -1
- package/dist/types/src/containers/RangeList/RangeList.d.ts.map +1 -0
- package/dist/types/src/containers/RangeList/index.d.ts +3 -0
- package/dist/types/src/containers/RangeList/index.d.ts.map +1 -0
- package/dist/types/src/containers/SheetContainer/SheetContainer.d.ts +12 -0
- package/dist/types/src/containers/SheetContainer/SheetContainer.d.ts.map +1 -0
- package/dist/types/src/containers/SheetContainer/SheetContainer.stories.d.ts +58 -0
- package/dist/types/src/containers/SheetContainer/SheetContainer.stories.d.ts.map +1 -0
- package/dist/types/src/{components → containers}/SheetContainer/index.d.ts.map +1 -1
- package/dist/types/src/containers/index.d.ts +4 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/extensions/compute.stories.d.ts.map +1 -1
- package/dist/types/src/integrations/thread-ranges.d.ts +0 -2
- package/dist/types/src/integrations/thread-ranges.d.ts.map +1 -1
- package/dist/types/src/model/sheet-model.d.ts +1 -1
- 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/operations/definitions.d.ts +45 -0
- package/dist/types/src/operations/definitions.d.ts.map +1 -0
- 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 +4 -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/serializer.d.ts +1 -1
- package/dist/types/src/serializer.d.ts.map +1 -1
- package/dist/types/src/testing/data.d.ts +1 -1
- package/dist/types/src/testing/data.d.ts.map +1 -1
- package/dist/types/src/testing/testing.d.ts +5 -5
- package/dist/types/src/testing/testing.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +38 -36
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Sheet.d.ts +7 -7
- package/dist/types/src/types/Sheet.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +12 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +0 -92
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +81 -63
- package/src/SheetPlugin.tsx +46 -28
- package/src/capabilities/{anchor-sort/anchor-sort.ts → anchor-sort.ts} +4 -3
- package/src/capabilities/{compute-graph-registry/compute-graph-registry.ts → compute-graph-registry.ts} +2 -2
- package/src/capabilities/index.ts +13 -5
- package/src/capabilities/{markdown/markdown.ts → markdown.ts} +2 -2
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +49 -0
- package/src/capabilities/state.ts +29 -0
- package/src/capabilities/undo-mappings.ts +30 -0
- package/src/components/ComputeGraph/compute-graph.stories.tsx +13 -8
- package/src/components/Sheet/Sheet.tsx +20 -0
- package/src/components/Sheet/index.ts +5 -0
- package/src/components/{GridSheet → SheetContent}/SheetCellEditor.stories.tsx +6 -6
- package/src/components/{GridSheet/GridSheet.stories.tsx → SheetContent/SheetContent.stories.tsx} +15 -14
- package/src/components/{GridSheet/GridSheet.tsx → SheetContent/SheetContent.tsx} +42 -22
- package/src/components/{RangeList → SheetContent}/index.ts +1 -1
- package/src/components/{GridSheet → SheetContent}/util.ts +4 -4
- package/src/components/{SheetContext/SheetContext.tsx → SheetRoot/SheetRoot.tsx} +45 -38
- 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 +4 -4
- package/src/components/SheetToolbar/SheetToolbar.tsx +18 -21
- package/src/components/SheetToolbar/align.ts +13 -13
- package/src/components/SheetToolbar/style.ts +10 -10
- package/src/components/index.ts +1 -7
- package/src/{components → containers}/RangeList/RangeList.tsx +16 -15
- package/src/containers/RangeList/index.ts +7 -0
- package/src/{components → containers}/SheetContainer/SheetContainer.stories.tsx +38 -42
- package/src/containers/SheetContainer/SheetContainer.tsx +57 -0
- package/src/{components → containers}/SheetContainer/index.ts +1 -1
- package/src/containers/index.ts +8 -0
- package/src/extensions/compute.stories.tsx +13 -12
- package/src/extensions/editor/sheet-extension.ts +10 -10
- package/src/integrations/thread-ranges.ts +6 -39
- package/src/meta.ts +1 -1
- package/src/model/sheet-model.test.ts +3 -3
- package/src/model/sheet-model.ts +38 -36
- package/src/model/testing.ts +1 -1
- package/src/model/useSheetModel.ts +1 -1
- package/src/operations/definitions.ts +73 -0
- package/src/operations/drop-axis.ts +26 -0
- package/src/operations/index.ts +14 -0
- package/src/operations/insert-axis.ts +19 -0
- package/src/operations/restore-axis.ts +19 -0
- package/src/operations/scroll-to-anchor.ts +31 -0
- package/src/playwright/playwright.config.ts +1 -1
- package/src/playwright/sheet.spec.ts +1 -1
- package/src/sanity.test.ts +6 -3
- package/src/serializer.ts +1 -1
- package/src/testing/data.ts +1 -1
- package/src/testing/testing.tsx +2 -2
- package/src/translations.ts +38 -36
- package/src/types/Sheet.ts +13 -7
- package/src/types/capabilities.ts +14 -2
- package/src/types/sheet-range-types.ts +3 -3
- package/src/types/types.ts +0 -80
- package/dist/lib/browser/SheetContainer-J72HS2FI.mjs +0 -397
- package/dist/lib/browser/SheetContainer-J72HS2FI.mjs.map +0 -7
- package/dist/lib/browser/anchor-sort-LLO7PZKF.mjs +0 -23
- package/dist/lib/browser/anchor-sort-LLO7PZKF.mjs.map +0 -7
- package/dist/lib/browser/chunk-IFLWVS2V.mjs +0 -234
- package/dist/lib/browser/chunk-IFLWVS2V.mjs.map +0 -7
- package/dist/lib/browser/chunk-KE3AKN5W.mjs.map +0 -7
- package/dist/lib/browser/chunk-S27QJYTN.mjs +0 -1473
- package/dist/lib/browser/chunk-S27QJYTN.mjs.map +0 -7
- package/dist/lib/browser/compute-graph-registry-RC5L7RE4.mjs +0 -21
- package/dist/lib/browser/compute-graph-registry-RC5L7RE4.mjs.map +0 -7
- package/dist/lib/browser/markdown-D2T2DOVX.mjs +0 -29
- package/dist/lib/browser/markdown-D2T2DOVX.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-YDOW72CN.mjs +0 -79
- package/dist/lib/browser/operation-resolver-YDOW72CN.mjs.map +0 -7
- package/dist/lib/browser/react-surface-JIYVFH42.mjs +0 -51
- package/dist/lib/browser/react-surface-JIYVFH42.mjs.map +0 -7
- package/dist/lib/node-esm/SheetContainer-OGSSDOZU.mjs +0 -398
- package/dist/lib/node-esm/SheetContainer-OGSSDOZU.mjs.map +0 -7
- package/dist/lib/node-esm/anchor-sort-OX5I2YOW.mjs +0 -24
- package/dist/lib/node-esm/anchor-sort-OX5I2YOW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6J5L47IB.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-PPOYR7DK.mjs +0 -236
- package/dist/lib/node-esm/chunk-PPOYR7DK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Y4V6HVHO.mjs +0 -1474
- package/dist/lib/node-esm/chunk-Y4V6HVHO.mjs.map +0 -7
- package/dist/lib/node-esm/compute-graph-registry-ZGXVLVGD.mjs +0 -22
- package/dist/lib/node-esm/compute-graph-registry-ZGXVLVGD.mjs.map +0 -7
- package/dist/lib/node-esm/markdown-PTV72DLO.mjs +0 -30
- package/dist/lib/node-esm/markdown-PTV72DLO.mjs.map +0 -7
- package/dist/lib/node-esm/operation-resolver-Q63VQBVA.mjs +0 -80
- package/dist/lib/node-esm/operation-resolver-Q63VQBVA.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-SWRZSZVR.mjs +0 -52
- package/dist/lib/node-esm/react-surface-SWRZSZVR.mjs.map +0 -7
- package/dist/types/src/capabilities/anchor-sort/anchor-sort.d.ts +0 -5
- package/dist/types/src/capabilities/anchor-sort/anchor-sort.d.ts.map +0 -1
- package/dist/types/src/capabilities/anchor-sort/index.d.ts +0 -3
- package/dist/types/src/capabilities/anchor-sort/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/compute-graph-registry/compute-graph-registry.d.ts +0 -5
- package/dist/types/src/capabilities/compute-graph-registry/compute-graph-registry.d.ts.map +0 -1
- package/dist/types/src/capabilities/compute-graph-registry/index.d.ts +0 -3
- package/dist/types/src/capabilities/compute-graph-registry/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/markdown/index.d.ts +0 -3
- package/dist/types/src/capabilities/markdown/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/markdown/markdown.d.ts +0 -5
- package/dist/types/src/capabilities/markdown/markdown.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +0 -5
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/components/FunctionEditor/FunctionEditor.d.ts +0 -3
- package/dist/types/src/components/FunctionEditor/FunctionEditor.d.ts.map +0 -1
- package/dist/types/src/components/FunctionEditor/index.d.ts +0 -2
- package/dist/types/src/components/FunctionEditor/index.d.ts.map +0 -1
- package/dist/types/src/components/GridSheet/GridSheet.d.ts +0 -3
- package/dist/types/src/components/GridSheet/GridSheet.d.ts.map +0 -1
- package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts +0 -55
- 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.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 -10
- package/dist/types/src/components/SheetContainer/SheetContainer.d.ts.map +0 -1
- package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts +0 -57
- package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +0 -1
- package/dist/types/src/components/SheetContext/SheetContext.d.ts.map +0 -1
- package/dist/types/src/components/SheetContext/index.d.ts +0 -2
- package/dist/types/src/components/SheetContext/index.d.ts.map +0 -1
- package/src/capabilities/anchor-sort/index.ts +0 -7
- package/src/capabilities/compute-graph-registry/index.ts +0 -7
- package/src/capabilities/markdown/index.ts +0 -7
- package/src/capabilities/operation-resolver/index.ts +0 -7
- package/src/capabilities/operation-resolver/operation-resolver.ts +0 -77
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/react-surface/react-surface.tsx +0 -43
- package/src/components/SheetContainer/SheetContainer.tsx +0 -48
- package/src/components/SheetContext/index.ts +0 -5
- /package/dist/types/src/components/{GridSheet → SheetContent}/SheetCellEditor.stories.d.ts +0 -0
- /package/dist/types/src/components/{GridSheet → SheetContent}/util.d.ts +0 -0
- /package/dist/types/src/{components → containers}/SheetContainer/index.d.ts +0 -0
|
@@ -14,10 +14,10 @@ import {
|
|
|
14
14
|
createMenuItemGroup,
|
|
15
15
|
} from '@dxos/react-ui-menu';
|
|
16
16
|
|
|
17
|
-
import { meta } from '
|
|
17
|
+
import { meta } from '#meta';
|
|
18
18
|
import { type SheetModel } from '../../model';
|
|
19
|
-
import { type StyleKey, type StyleValue, rangeFromIndex, rangeToIndex } from '
|
|
20
|
-
import { useSheetContext } from '../
|
|
19
|
+
import { type StyleKey, type StyleValue, rangeFromIndex, rangeToIndex } from '#types';
|
|
20
|
+
import { useSheetContext } from '../SheetRoot';
|
|
21
21
|
|
|
22
22
|
import { type ToolbarState, type ToolbarStateAtom } from './useToolbarState';
|
|
23
23
|
|
|
@@ -103,14 +103,14 @@ const createStyleActions = ({ model, state, stateAtom, registry, cursorFallbackR
|
|
|
103
103
|
) {
|
|
104
104
|
// this value should be unset
|
|
105
105
|
if (index >= 0) {
|
|
106
|
-
Obj.change(model.sheet, (
|
|
107
|
-
|
|
106
|
+
Obj.change(model.sheet, (obj) => {
|
|
107
|
+
obj.ranges?.splice(index, 1);
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
110
|
registry.set(stateAtom, { ...currentState, [nextRangeEntity.value]: false });
|
|
111
111
|
} else {
|
|
112
|
-
Obj.change(model.sheet, (
|
|
113
|
-
|
|
112
|
+
Obj.change(model.sheet, (obj) => {
|
|
113
|
+
obj.ranges?.push(nextRangeEntity);
|
|
114
114
|
});
|
|
115
115
|
registry.set(stateAtom, { ...currentState, [nextRangeEntity.value]: true });
|
|
116
116
|
}
|
|
@@ -119,7 +119,7 @@ const createStyleActions = ({ model, state, stateAtom, registry, cursorFallbackR
|
|
|
119
119
|
key: 'style',
|
|
120
120
|
value: styleValue as StyleValue,
|
|
121
121
|
icon,
|
|
122
|
-
label: [`range
|
|
122
|
+
label: [`range-value-${styleValue}.label`, { ns: meta.id }],
|
|
123
123
|
checked: !!state[styleValue as StyleValue],
|
|
124
124
|
},
|
|
125
125
|
);
|
|
@@ -131,8 +131,8 @@ export const createStyle = (context: StyleActionsContext): ActionGraphProps => {
|
|
|
131
131
|
return {
|
|
132
132
|
nodes: [styleGroupAction, ...styleActions],
|
|
133
133
|
edges: [
|
|
134
|
-
{ source: 'root', target: 'style' },
|
|
135
|
-
...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' })),
|
|
136
136
|
],
|
|
137
137
|
};
|
|
138
138
|
};
|
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';
|
|
@@ -7,13 +7,12 @@ import React, { useCallback } from 'react';
|
|
|
7
7
|
|
|
8
8
|
import { rangeToA1Notation } from '@dxos/compute';
|
|
9
9
|
import { Obj } from '@dxos/echo';
|
|
10
|
-
import {
|
|
10
|
+
import { Input, Message, useTranslation } from '@dxos/react-ui';
|
|
11
11
|
import { List } from '@dxos/react-ui-list';
|
|
12
|
-
import { ghostHover } from '@dxos/ui-theme';
|
|
13
12
|
|
|
14
|
-
import { meta } from '
|
|
15
|
-
import { rangeFromIndex } from '
|
|
16
|
-
import { Sheet } from '
|
|
13
|
+
import { meta } from '#meta';
|
|
14
|
+
import { rangeFromIndex } from '#types';
|
|
15
|
+
import { Sheet } from '#types';
|
|
17
16
|
|
|
18
17
|
export type RangeListProps = {
|
|
19
18
|
sheet: Sheet.Sheet;
|
|
@@ -26,30 +25,32 @@ export const RangeList = ({ sheet }: RangeListProps) => {
|
|
|
26
25
|
const handleDeleteRange = useCallback(
|
|
27
26
|
(range: Sheet.Range) => {
|
|
28
27
|
const index = sheet.ranges.findIndex((sheetRange) => sheetRange === range);
|
|
29
|
-
Obj.change(sheet, (
|
|
30
|
-
|
|
28
|
+
Obj.change(sheet, (obj) => {
|
|
29
|
+
obj.ranges.splice(index, 1);
|
|
31
30
|
});
|
|
32
31
|
},
|
|
33
32
|
[sheet],
|
|
34
33
|
);
|
|
35
34
|
return (
|
|
36
35
|
<>
|
|
37
|
-
<
|
|
36
|
+
<Input.Root>
|
|
37
|
+
<Input.Label>{t('range-list.heading')}</Input.Label>
|
|
38
|
+
</Input.Root>
|
|
38
39
|
{sheet.ranges.length < 1 ? (
|
|
39
|
-
<
|
|
40
|
-
<
|
|
41
|
-
</
|
|
40
|
+
<Message.Root>
|
|
41
|
+
<Message.Title>{t('no-ranges.message')}</Message.Title>
|
|
42
|
+
</Message.Root>
|
|
42
43
|
) : (
|
|
43
44
|
<List.Root<Sheet.Range> items={sheet.ranges} isItem={Schema.is(Sheet.Range)}>
|
|
44
45
|
{({ items: ranges }) =>
|
|
45
46
|
ranges.map((range, i) => (
|
|
46
|
-
<List.Item key={i} item={range}
|
|
47
|
+
<List.Item key={i} item={range}>
|
|
47
48
|
<List.ItemDragHandle />
|
|
48
49
|
<List.ItemTitle onClick={() => handleSelectRange(range)}>
|
|
49
|
-
{t('range
|
|
50
|
+
{t('range.title', {
|
|
50
51
|
position: rangeToA1Notation(rangeFromIndex(sheet, range.range)),
|
|
51
|
-
key: t(`range
|
|
52
|
-
value: t(`range
|
|
52
|
+
key: t(`range-key-${range.key}.label`),
|
|
53
|
+
value: t(`range-value-${range.value}.label`),
|
|
53
54
|
})}
|
|
54
55
|
</List.ItemTitle>
|
|
55
56
|
<List.ItemDeleteButton onClick={() => handleDeleteRange(range)} />
|
|
@@ -4,49 +4,48 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Meta } from '@storybook/react-vite';
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
|
-
import React from 'react';
|
|
7
|
+
import React, { useContext } from 'react';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
10
10
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
11
11
|
import { Obj } from '@dxos/echo';
|
|
12
|
-
import {
|
|
12
|
+
import { Operation, OperationHandlerSet } from '@dxos/operation';
|
|
13
13
|
import { corePlugins } from '@dxos/plugin-testing';
|
|
14
14
|
import { useSpace } from '@dxos/react-client/echo';
|
|
15
15
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
16
|
-
import { withLayout
|
|
16
|
+
import { withLayout } from '@dxos/react-ui/testing';
|
|
17
17
|
import { AttendableContainer } from '@dxos/react-ui-attention';
|
|
18
18
|
|
|
19
|
-
import {
|
|
19
|
+
import { ComputeGraphContext, useComputeGraph } from '#components';
|
|
20
|
+
import { createTestCells, useTestSheet, withComputeGraphDecorator } from '#testing';
|
|
20
21
|
import { translations } from '../../translations';
|
|
21
|
-
import { Sheet
|
|
22
|
-
import {
|
|
23
|
-
import
|
|
22
|
+
import { Sheet } from '#types';
|
|
23
|
+
import { SheetOperation } from '#operations';
|
|
24
|
+
import RangeList from '../RangeList';
|
|
24
25
|
|
|
25
26
|
import { SheetContainer } from './SheetContainer';
|
|
26
27
|
|
|
27
28
|
const meta = {
|
|
28
|
-
title: 'plugins/plugin-sheet/SheetContainer',
|
|
29
|
+
title: 'plugins/plugin-sheet/containers/SheetContainer',
|
|
29
30
|
component: SheetContainer,
|
|
30
31
|
decorators: [
|
|
31
|
-
withTheme,
|
|
32
32
|
withLayout({ layout: 'fullscreen' }),
|
|
33
33
|
withClientProvider({ types: [Sheet.Sheet], createSpace: true }),
|
|
34
34
|
withComputeGraphDecorator(),
|
|
35
|
-
// TODO(wittjosiah): Consider whether we should refactor component so story doesn't need to depend on intents.
|
|
36
35
|
withPluginManager({
|
|
37
36
|
plugins: [...corePlugins()],
|
|
38
37
|
capabilities: [
|
|
39
|
-
Capability.contributes(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
Capability.contributes(
|
|
39
|
+
Capabilities.OperationHandler,
|
|
40
|
+
OperationHandlerSet.make(
|
|
41
|
+
Operation.withHandler(SheetOperation.DropAxis, ({ model, axis, axisIndex }) =>
|
|
43
42
|
Effect.sync(() => {
|
|
44
43
|
model[axis === 'col' ? 'dropColumn' : 'dropRow'](axisIndex);
|
|
45
|
-
// Return stub output for story purposes.
|
|
46
44
|
return { axis, axisIndex, index: 0, axisMeta: null, values: [] };
|
|
47
45
|
}),
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
),
|
|
47
|
+
),
|
|
48
|
+
),
|
|
50
49
|
],
|
|
51
50
|
}),
|
|
52
51
|
],
|
|
@@ -61,49 +60,46 @@ export default meta;
|
|
|
61
60
|
export const Default = () => {
|
|
62
61
|
const space = useSpace();
|
|
63
62
|
const graph = useComputeGraph(space);
|
|
63
|
+
const { registry } = useContext(ComputeGraphContext) ?? {};
|
|
64
64
|
const sheet = useTestSheet(space, graph, { cells: createTestCells() });
|
|
65
|
-
if (!sheet || !space) {
|
|
65
|
+
if (!sheet || !space || !registry) {
|
|
66
66
|
return null;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
return (
|
|
70
70
|
<AttendableContainer id={Obj.getDXN(sheet).toString()} classNames='contents'>
|
|
71
|
-
<SheetContainer
|
|
71
|
+
<SheetContainer
|
|
72
|
+
role='article'
|
|
73
|
+
space={space}
|
|
74
|
+
subject={sheet}
|
|
75
|
+
attendableId='test'
|
|
76
|
+
registry={registry}
|
|
77
|
+
ignoreAttention
|
|
78
|
+
/>
|
|
72
79
|
</AttendableContainer>
|
|
73
80
|
);
|
|
74
81
|
};
|
|
75
82
|
|
|
76
|
-
export const Section = () => {
|
|
77
|
-
const space = useSpace();
|
|
78
|
-
const graph = useComputeGraph(space);
|
|
79
|
-
const sheet = useTestSheet(space, graph, { cells: createTestCells() });
|
|
80
|
-
if (!sheet || !space) {
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return (
|
|
85
|
-
<div className='is-full flex justify-center'>
|
|
86
|
-
<div className='is-[40rem]'>
|
|
87
|
-
<AttendableContainer id={Obj.getDXN(sheet).toString()} classNames='contents'>
|
|
88
|
-
<SheetContainer role='section' space={space} subject={sheet} ignoreAttention />
|
|
89
|
-
</AttendableContainer>
|
|
90
|
-
</div>
|
|
91
|
-
</div>
|
|
92
|
-
);
|
|
93
|
-
};
|
|
94
|
-
|
|
95
83
|
export const Spec = () => {
|
|
96
84
|
const space = useSpace();
|
|
97
85
|
const graph = useComputeGraph(space);
|
|
86
|
+
const { registry } = useContext(ComputeGraphContext) ?? {};
|
|
98
87
|
const sheet = useTestSheet(space, graph, { cells: { A1: { value: 'Ready' } } });
|
|
99
|
-
if (!sheet || !space) {
|
|
88
|
+
if (!sheet || !space || !registry) {
|
|
100
89
|
return null;
|
|
101
90
|
}
|
|
102
91
|
|
|
103
92
|
return (
|
|
104
93
|
<AttendableContainer id={Obj.getDXN(sheet).toString()} classNames='contents'>
|
|
105
|
-
<div role='none' className='
|
|
106
|
-
<SheetContainer
|
|
94
|
+
<div role='none' className='w-full grid grid-cols-[1fr_20rem]'>
|
|
95
|
+
<SheetContainer
|
|
96
|
+
role='article'
|
|
97
|
+
space={space}
|
|
98
|
+
subject={sheet}
|
|
99
|
+
attendableId='test'
|
|
100
|
+
registry={registry}
|
|
101
|
+
ignoreAttention
|
|
102
|
+
/>
|
|
107
103
|
<div role='none' data-testid='grid.range-list'>
|
|
108
104
|
<RangeList sheet={sheet} />
|
|
109
105
|
</div>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { type ObjectSurfaceProps } from '@dxos/app-toolkit/ui';
|
|
8
|
+
import { type ComputeGraphRegistry } from '@dxos/compute';
|
|
9
|
+
import { type Space } from '@dxos/react-client/echo';
|
|
10
|
+
import { Panel } from '@dxos/react-ui';
|
|
11
|
+
|
|
12
|
+
import { ComputeGraphContextProvider, Sheet, useComputeGraph } from '#components';
|
|
13
|
+
import { type Sheet as SheetType } from '#types';
|
|
14
|
+
|
|
15
|
+
export type SheetContainerProps = ObjectSurfaceProps<
|
|
16
|
+
SheetType.Sheet,
|
|
17
|
+
{
|
|
18
|
+
space: Space;
|
|
19
|
+
registry: ComputeGraphRegistry;
|
|
20
|
+
ignoreAttention?: boolean;
|
|
21
|
+
}
|
|
22
|
+
>;
|
|
23
|
+
|
|
24
|
+
export const SheetContainer = ({ registry, ...props }: SheetContainerProps) => (
|
|
25
|
+
<ComputeGraphContextProvider registry={registry}>
|
|
26
|
+
<SheetContainerInner {...props} />
|
|
27
|
+
</ComputeGraphContextProvider>
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
const SheetContainerInner = ({
|
|
31
|
+
role,
|
|
32
|
+
subject: sheet,
|
|
33
|
+
attendableId,
|
|
34
|
+
space,
|
|
35
|
+
ignoreAttention,
|
|
36
|
+
}: Omit<SheetContainerProps, 'registry'>) => {
|
|
37
|
+
const graph = useComputeGraph(space);
|
|
38
|
+
if (!graph) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<Sheet.Root graph={graph} sheet={sheet} attendableId={attendableId!} ignoreAttention={ignoreAttention}>
|
|
44
|
+
<Panel.Root classNames={role === 'section' && 'aspect-aquare'}>
|
|
45
|
+
<Panel.Toolbar asChild>
|
|
46
|
+
<Sheet.Toolbar />
|
|
47
|
+
</Panel.Toolbar>
|
|
48
|
+
<Panel.Content asChild>
|
|
49
|
+
<Sheet.Content />
|
|
50
|
+
</Panel.Content>
|
|
51
|
+
<Panel.Statusbar asChild>
|
|
52
|
+
<Sheet.Statusbar />
|
|
53
|
+
</Panel.Statusbar>
|
|
54
|
+
</Panel.Root>
|
|
55
|
+
</Sheet.Root>
|
|
56
|
+
);
|
|
57
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type ComponentType, lazy } from 'react';
|
|
6
|
+
|
|
7
|
+
export const RangeList: ComponentType<any> = lazy(() => import('./RangeList'));
|
|
8
|
+
export const SheetContainer: ComponentType<any> = lazy(() => import('./SheetContainer'));
|
|
@@ -11,7 +11,7 @@ import { PublicKey } from '@dxos/keys';
|
|
|
11
11
|
import { useSpace } from '@dxos/react-client/echo';
|
|
12
12
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
13
13
|
import { useThemeContext } from '@dxos/react-ui';
|
|
14
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
14
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
15
15
|
import { useTextEditor } from '@dxos/react-ui-editor';
|
|
16
16
|
import {
|
|
17
17
|
createBasicExtensions,
|
|
@@ -22,10 +22,10 @@ import {
|
|
|
22
22
|
} from '@dxos/ui-editor';
|
|
23
23
|
import { isNonNullable } from '@dxos/util';
|
|
24
24
|
|
|
25
|
-
import {
|
|
25
|
+
import { Sheet, useComputeGraph } from '#components';
|
|
26
26
|
import { useSheetModel } from '../model';
|
|
27
|
-
import { useTestSheet, withComputeGraphDecorator } from '
|
|
28
|
-
import { Sheet } from '
|
|
27
|
+
import { useTestSheet, withComputeGraphDecorator } from '#testing';
|
|
28
|
+
import { Sheet as SheetType } from '#types';
|
|
29
29
|
|
|
30
30
|
import { compute, computeGraphFacet } from './compute';
|
|
31
31
|
|
|
@@ -63,7 +63,7 @@ const DefaultStory = ({ text }: EditorProps) => {
|
|
|
63
63
|
[computeGraph, themeMode],
|
|
64
64
|
);
|
|
65
65
|
|
|
66
|
-
return <div className='
|
|
66
|
+
return <div className='w-[40rem] overflow-hidden' ref={parentRef} {...focusAttributes} />;
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
const Grid = () => {
|
|
@@ -87,10 +87,10 @@ const Grid = () => {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
return (
|
|
90
|
-
<div className='flex
|
|
91
|
-
<
|
|
92
|
-
<
|
|
93
|
-
</
|
|
90
|
+
<div className='flex w-[40rem] overflow-hidden'>
|
|
91
|
+
<Sheet.Root graph={graph} sheet={sheet} attendableId='test'>
|
|
92
|
+
<Sheet.Content />
|
|
93
|
+
</Sheet.Root>
|
|
94
94
|
</div>
|
|
95
95
|
);
|
|
96
96
|
};
|
|
@@ -105,11 +105,12 @@ const GraphStory = (props: EditorProps) => {
|
|
|
105
105
|
};
|
|
106
106
|
|
|
107
107
|
const meta = {
|
|
108
|
-
title: 'plugins/plugin-sheet/extensions',
|
|
108
|
+
title: 'plugins/plugin-sheet/extensions/compute',
|
|
109
109
|
decorators: [
|
|
110
|
-
withTheme,
|
|
110
|
+
withTheme(),
|
|
111
|
+
withLayout({ layout: 'fullscreen' }),
|
|
111
112
|
withClientProvider({
|
|
112
|
-
types: [
|
|
113
|
+
types: [SheetType.Sheet],
|
|
113
114
|
createIdentity: true,
|
|
114
115
|
createSpace: true,
|
|
115
116
|
}),
|
|
@@ -33,30 +33,30 @@ const highlightStyles = HighlightStyle.define([
|
|
|
33
33
|
// Function.
|
|
34
34
|
{
|
|
35
35
|
tag: tags.name,
|
|
36
|
-
class: 'text-
|
|
36
|
+
class: 'text-accent-text',
|
|
37
37
|
},
|
|
38
38
|
// Range.
|
|
39
39
|
{
|
|
40
40
|
tag: tags.tagName,
|
|
41
|
-
class: 'text-
|
|
41
|
+
class: 'text-pink-text',
|
|
42
42
|
},
|
|
43
43
|
// Values.
|
|
44
44
|
{
|
|
45
45
|
tag: tags.number,
|
|
46
|
-
class: 'text-
|
|
46
|
+
class: 'text-teal-text',
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
49
|
tag: tags.bool,
|
|
50
|
-
class: 'text-
|
|
50
|
+
class: 'text-teal-text',
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
53
|
tag: tags.string,
|
|
54
|
-
class: 'text-
|
|
54
|
+
class: 'text-teal-text',
|
|
55
55
|
},
|
|
56
56
|
// Error.
|
|
57
57
|
{
|
|
58
58
|
tag: tags.invalid,
|
|
59
|
-
class: 'text-
|
|
59
|
+
class: 'text-un-accent',
|
|
60
60
|
},
|
|
61
61
|
]);
|
|
62
62
|
|
|
@@ -97,7 +97,7 @@ export const sheetExtension = ({ debug, functions = [] }: SheetExtensionOptions)
|
|
|
97
97
|
|
|
98
98
|
const title = document.createElement('h2');
|
|
99
99
|
title.innerText = name;
|
|
100
|
-
title.className = 'text-lg font-mono text-
|
|
100
|
+
title.className = 'text-lg font-mono text-accent-text';
|
|
101
101
|
root.appendChild(title);
|
|
102
102
|
|
|
103
103
|
if (description) {
|
|
@@ -110,7 +110,7 @@ export const sheetExtension = ({ debug, functions = [] }: SheetExtensionOptions)
|
|
|
110
110
|
if (syntax) {
|
|
111
111
|
const detail = document.createElement('pre');
|
|
112
112
|
detail.innerText = syntax;
|
|
113
|
-
detail.className = 'whitespace-pre-wrap text-
|
|
113
|
+
detail.className = 'whitespace-pre-wrap text-green-text';
|
|
114
114
|
root.appendChild(detail);
|
|
115
115
|
}
|
|
116
116
|
|
|
@@ -169,8 +169,8 @@ export const sheetExtension = ({ debug, functions = [] }: SheetExtensionOptions)
|
|
|
169
169
|
icons: false,
|
|
170
170
|
tooltipClass: () =>
|
|
171
171
|
mx(
|
|
172
|
-
'!-left-[1px] !top-[33px] !-m-0 border
|
|
173
|
-
'[&>ul>li[aria-selected]]:!bg-
|
|
172
|
+
'!-left-[1px] !top-[33px] !-m-0 border border-h-0! [&>ul]:!min-w-[198px]',
|
|
173
|
+
'[&>ul>li[aria-selected]]:!bg-accent-surface',
|
|
174
174
|
'border-separator',
|
|
175
175
|
),
|
|
176
176
|
}),
|
|
@@ -2,23 +2,19 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import * as Effect from 'effect/Effect';
|
|
6
5
|
import { useCallback, useEffect, useMemo } from 'react';
|
|
7
6
|
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
8
|
+
import { linkedSegment } from '@dxos/react-ui-attention';
|
|
10
9
|
import { debounce } from '@dxos/async';
|
|
11
10
|
import { type CellAddress, type CompleteCellRange, inRange } from '@dxos/compute';
|
|
12
11
|
import { Obj, Relation } from '@dxos/echo';
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { ThreadOperation } from '@dxos/plugin-thread/types';
|
|
12
|
+
import { DeckOperation } from '@dxos/plugin-deck/operations';
|
|
13
|
+
import { ThreadOperation } from '@dxos/plugin-thread/operations';
|
|
16
14
|
import { Filter, Query, useQuery } from '@dxos/react-client/echo';
|
|
17
|
-
import { type DxGridElement, type GridContentProps } from '@dxos/react-ui-grid';
|
|
18
15
|
import { AnchoredTo, Thread } from '@dxos/types';
|
|
19
16
|
|
|
20
|
-
import { useSheetContext } from '
|
|
21
|
-
import { meta } from '../meta';
|
|
17
|
+
import { useSheetContext } from '#components';
|
|
22
18
|
|
|
23
19
|
export const completeCellRangeToThreadCursor = (range: CompleteCellRange): string => {
|
|
24
20
|
return `${range.from.col},${range.from.row},${range.to.col},${range.to.row}`;
|
|
@@ -37,33 +33,6 @@ export const parseThreadAnchorAsCellRange = (cursor: string): CompleteCellRange
|
|
|
37
33
|
}
|
|
38
34
|
};
|
|
39
35
|
|
|
40
|
-
export const useUpdateFocusedCellOnThreadSelection = (grid: DxGridElement | null) => {
|
|
41
|
-
const { model, setActiveRefs } = useSheetContext();
|
|
42
|
-
const sheetId = Obj.getDXN(model.sheet).toString();
|
|
43
|
-
|
|
44
|
-
const scrollIntoViewHandler = useMemo(
|
|
45
|
-
() =>
|
|
46
|
-
OperationResolver.make({
|
|
47
|
-
operation: Common.LayoutOperation.ScrollIntoView,
|
|
48
|
-
position: 'hoist',
|
|
49
|
-
filter: (input) => input.subject === sheetId && !!input.cursor,
|
|
50
|
-
handler: (input) =>
|
|
51
|
-
Effect.sync(() => {
|
|
52
|
-
const { cursor, ref } = input;
|
|
53
|
-
if (cursor) {
|
|
54
|
-
setActiveRefs(ref as GridContentProps['activeRefs']);
|
|
55
|
-
// TODO(Zan): Everywhere we refer to the cursor in a thread context should change to `anchor`.
|
|
56
|
-
const range = parseThreadAnchorAsCellRange(cursor);
|
|
57
|
-
range && grid?.setFocus({ ...range.to, plane: 'grid' }, true);
|
|
58
|
-
}
|
|
59
|
-
}),
|
|
60
|
-
}),
|
|
61
|
-
[sheetId, setActiveRefs, grid],
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
useOperationResolver(meta.id, scrollIntoViewHandler);
|
|
65
|
-
};
|
|
66
|
-
|
|
67
36
|
export const useSelectThreadOnCellFocus = () => {
|
|
68
37
|
const { model, cursor } = useSheetContext();
|
|
69
38
|
const { invokePromise } = useOperationInvoker();
|
|
@@ -88,12 +57,10 @@ export const useSelectThreadOnCellFocus = () => {
|
|
|
88
57
|
});
|
|
89
58
|
|
|
90
59
|
if (closestThread) {
|
|
91
|
-
const primary = Obj.getDXN(model.sheet).toString();
|
|
92
60
|
void (async () => {
|
|
93
61
|
await invokePromise(ThreadOperation.Select, { current: Relation.getDXN(closestThread).toString() });
|
|
94
62
|
await invokePromise(DeckOperation.ChangeCompanion, {
|
|
95
|
-
|
|
96
|
-
companion: `${primary}${ATTENDABLE_PATH_SEPARATOR}comments`,
|
|
63
|
+
companion: linkedSegment('comments'),
|
|
97
64
|
});
|
|
98
65
|
})();
|
|
99
66
|
}
|
package/src/meta.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { type Plugin } from '@dxos/app-framework';
|
|
|
6
6
|
import { trim } from '@dxos/util';
|
|
7
7
|
|
|
8
8
|
export const meta: Plugin.Meta = {
|
|
9
|
-
id: 'dxos.
|
|
9
|
+
id: 'org.dxos.plugin.sheet',
|
|
10
10
|
name: 'Sheet',
|
|
11
11
|
description: trim`
|
|
12
12
|
Full-featured spreadsheet application with over 400 built-in formulas for calculations and data analysis.
|
|
@@ -7,10 +7,10 @@ import { afterEach, beforeEach, describe, expect, onTestFinished, test } from 'v
|
|
|
7
7
|
import { Trigger } from '@dxos/async';
|
|
8
8
|
import { type CellScalarValue, addressFromA1Notation, isFormula } from '@dxos/compute';
|
|
9
9
|
import { TestBuilder, testFunctionPlugins } from '@dxos/compute/testing';
|
|
10
|
-
import { Function } from '@dxos/functions';
|
|
11
10
|
import { log } from '@dxos/log';
|
|
11
|
+
import { Operation } from '@dxos/operation';
|
|
12
12
|
|
|
13
|
-
import { Sheet, mapFormulaIndicesToRefs, mapFormulaRefsToIndices } from '
|
|
13
|
+
import { Sheet, mapFormulaIndicesToRefs, mapFormulaRefsToIndices } from '#types';
|
|
14
14
|
|
|
15
15
|
import { SheetModel } from './sheet-model';
|
|
16
16
|
import { createTestGrid } from './testing';
|
|
@@ -18,7 +18,7 @@ import { createTestGrid } from './testing';
|
|
|
18
18
|
describe('SheetModel', () => {
|
|
19
19
|
let testBuilder: TestBuilder;
|
|
20
20
|
beforeEach(async () => {
|
|
21
|
-
testBuilder = new TestBuilder({ types: [
|
|
21
|
+
testBuilder = new TestBuilder({ types: [Operation.PersistentOperation], plugins: testFunctionPlugins });
|
|
22
22
|
await testBuilder.open();
|
|
23
23
|
});
|
|
24
24
|
afterEach(async () => {
|