@dxos/plugin-sheet 0.8.4-main.3eb6e50203 → 0.8.4-main.4a85c3132b
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/RangeList-S3SHV7T6.mjs +53 -0
- package/dist/lib/browser/RangeList-S3SHV7T6.mjs.map +7 -0
- package/dist/lib/browser/{chunk-EDWHV64N.mjs → SheetContainer-I3NFVVDQ.mjs} +535 -203
- package/dist/lib/browser/SheetContainer-I3NFVVDQ.mjs.map +7 -0
- package/dist/lib/browser/{anchor-sort-AMMLA66W.mjs → anchor-sort-DZ3IHHJJ.mjs} +2 -2
- package/dist/lib/browser/{chunk-IFLWVS2V.mjs → chunk-NNWF7EKC.mjs} +10 -10
- package/dist/lib/browser/{chunk-IFLWVS2V.mjs.map → chunk-NNWF7EKC.mjs.map} +2 -2
- package/dist/lib/browser/{chunk-KE3AKN5W.mjs → chunk-S445OQGW.mjs} +5 -5
- package/dist/lib/browser/{chunk-KE3AKN5W.mjs.map → chunk-S445OQGW.mjs.map} +3 -3
- package/dist/lib/browser/{compute-graph-registry-RC5L7RE4.mjs → compute-graph-registry-W6HO2G3P.mjs} +2 -2
- package/dist/lib/browser/index.mjs +6 -6
- package/dist/lib/browser/{markdown-D2T2DOVX.mjs → markdown-S6GVLHB4.mjs} +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{operation-resolver-P2RX75DA.mjs → operation-resolver-Z4X4UWNR.mjs} +4 -4
- package/dist/lib/browser/operation-resolver-Z4X4UWNR.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-45CRAB5G.mjs → react-surface-KIU6DGKW.mjs} +13 -13
- package/dist/lib/browser/react-surface-KIU6DGKW.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +1 -1
- package/dist/lib/node-esm/RangeList-IB23OJK2.mjs +54 -0
- package/dist/lib/node-esm/RangeList-IB23OJK2.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-AYSEWH7N.mjs → SheetContainer-KUXNCSFP.mjs} +535 -203
- package/dist/lib/node-esm/SheetContainer-KUXNCSFP.mjs.map +7 -0
- package/dist/lib/node-esm/{anchor-sort-VHMBRX2E.mjs → anchor-sort-24OXMOSX.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-PPOYR7DK.mjs → chunk-M52YLLWU.mjs} +10 -10
- package/dist/lib/node-esm/{chunk-PPOYR7DK.mjs.map → chunk-M52YLLWU.mjs.map} +2 -2
- package/dist/lib/node-esm/{chunk-6J5L47IB.mjs → chunk-NKZ3O4OR.mjs} +5 -5
- package/dist/lib/node-esm/{chunk-6J5L47IB.mjs.map → chunk-NKZ3O4OR.mjs.map} +3 -3
- package/dist/lib/node-esm/{compute-graph-registry-ZGXVLVGD.mjs → compute-graph-registry-2C3Y2RPQ.mjs} +2 -2
- package/dist/lib/node-esm/index.mjs +6 -6
- package/dist/lib/node-esm/{markdown-PTV72DLO.mjs → markdown-YT5KJTQT.mjs} +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{operation-resolver-WPIWQ5IO.mjs → operation-resolver-7VD2YXSQ.mjs} +4 -4
- package/dist/lib/node-esm/operation-resolver-7VD2YXSQ.mjs.map +7 -0
- package/dist/lib/node-esm/{react-surface-ITV2L6HK.mjs → react-surface-7FZAE3S7.mjs} +13 -13
- package/dist/lib/node-esm/react-surface-7FZAE3S7.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +1 -1
- package/dist/types/src/capabilities/anchor-sort/anchor-sort.d.ts +1 -1
- package/dist/types/src/capabilities/compute-graph-registry/compute-graph-registry.d.ts +1 -1
- package/dist/types/src/capabilities/markdown/markdown.d.ts +1 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/Sheet/Sheet.d.ts +11 -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 +5 -0
- package/dist/types/src/components/SheetContent/SheetContent.d.ts.map +1 -0
- package/dist/types/src/components/{GridSheet/GridSheet.stories.d.ts → SheetContent/SheetContent.stories.d.ts} +2 -2
- 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} +4 -4
- 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 +5 -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 +6 -3
- package/dist/types/src/components/SheetToolbar/SheetToolbar.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.map +1 -1
- 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/{components → containers}/SheetContainer/SheetContainer.stories.d.ts +1 -2
- 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.map +1 -1
- package/dist/types/src/testing/testing.d.ts +1 -1
- package/dist/types/src/types/Sheet.d.ts +1 -1
- package/dist/types/src/types/types.d.ts +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +56 -57
- package/src/capabilities/operation-resolver/operation-resolver.ts +2 -2
- package/src/capabilities/react-surface/react-surface.tsx +7 -4
- package/src/components/ComputeGraph/compute-graph.stories.tsx +1 -1
- package/src/components/Sheet/Sheet.tsx +20 -0
- package/src/components/Sheet/index.ts +5 -0
- package/src/components/{GridSheet → SheetContent}/SheetCellEditor.stories.tsx +1 -1
- package/src/components/{GridSheet/GridSheet.stories.tsx → SheetContent/SheetContent.stories.tsx} +11 -10
- package/src/components/{GridSheet/GridSheet.tsx → SheetContent/SheetContent.tsx} +12 -9
- package/src/components/{RangeList → SheetContent}/index.ts +1 -1
- package/src/components/{GridSheet → SheetContent}/util.ts +3 -3
- package/src/components/{SheetContext/SheetContext.tsx → SheetRoot/SheetRoot.tsx} +36 -34
- package/src/components/{GridSheet → SheetRoot}/index.ts +1 -1
- package/src/components/{FunctionEditor/FunctionEditor.tsx → SheetStatusbar/SheetStatusbar.tsx} +11 -6
- package/src/components/{FunctionEditor → SheetStatusbar}/index.ts +1 -1
- package/src/components/SheetToolbar/SheetToolbar.stories.tsx +4 -4
- package/src/components/SheetToolbar/SheetToolbar.tsx +10 -9
- package/src/components/SheetToolbar/align.ts +3 -3
- package/src/components/SheetToolbar/style.ts +3 -3
- package/src/components/index.ts +1 -7
- package/src/{components → containers}/RangeList/RangeList.tsx +7 -5
- package/src/containers/RangeList/index.ts +7 -0
- package/src/{components → containers}/SheetContainer/SheetContainer.stories.tsx +11 -30
- 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 +11 -10
- package/src/extensions/editor/sheet-extension.ts +10 -10
- package/src/integrations/thread-ranges.ts +0 -1
- package/src/playwright/playwright.config.ts +1 -1
- package/src/playwright/sheet.spec.ts +1 -1
- package/src/types/sheet-range-types.ts +3 -3
- package/src/types/types.ts +1 -1
- package/dist/lib/browser/SheetContainer-6DNFC4TY.mjs +0 -397
- package/dist/lib/browser/SheetContainer-6DNFC4TY.mjs.map +0 -7
- package/dist/lib/browser/chunk-EDWHV64N.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-P2RX75DA.mjs.map +0 -7
- package/dist/lib/browser/react-surface-45CRAB5G.mjs.map +0 -7
- package/dist/lib/node-esm/SheetContainer-7H5R7M54.mjs +0 -398
- package/dist/lib/node-esm/SheetContainer-7H5R7M54.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-AYSEWH7N.mjs.map +0 -7
- package/dist/lib/node-esm/operation-resolver-WPIWQ5IO.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-ITV2L6HK.mjs.map +0 -7
- 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.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/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.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/components/SheetContainer/SheetContainer.tsx +0 -48
- package/src/components/SheetContext/index.ts +0 -5
- /package/dist/lib/browser/{anchor-sort-AMMLA66W.mjs.map → anchor-sort-DZ3IHHJJ.mjs.map} +0 -0
- /package/dist/lib/browser/{compute-graph-registry-RC5L7RE4.mjs.map → compute-graph-registry-W6HO2G3P.mjs.map} +0 -0
- /package/dist/lib/browser/{markdown-D2T2DOVX.mjs.map → markdown-S6GVLHB4.mjs.map} +0 -0
- /package/dist/lib/node-esm/{anchor-sort-VHMBRX2E.mjs.map → anchor-sort-24OXMOSX.mjs.map} +0 -0
- /package/dist/lib/node-esm/{compute-graph-registry-ZGXVLVGD.mjs.map → compute-graph-registry-2C3Y2RPQ.mjs.map} +0 -0
- /package/dist/lib/node-esm/{markdown-PTV72DLO.mjs.map → markdown-YT5KJTQT.mjs.map} +0 -0
- /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}/RangeList/RangeList.d.ts +0 -0
- /package/dist/types/src/{components → containers}/SheetContainer/index.d.ts +0 -0
|
@@ -9,14 +9,14 @@ import { useAppGraph } from '@dxos/app-toolkit/ui';
|
|
|
9
9
|
import { type CompleteCellRange } from '@dxos/compute';
|
|
10
10
|
import {
|
|
11
11
|
type ActionGraphProps,
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
Menu,
|
|
13
|
+
type MenuRootProps,
|
|
14
14
|
createGapSeparator,
|
|
15
15
|
useMenuActions,
|
|
16
16
|
} from '@dxos/react-ui-menu';
|
|
17
17
|
|
|
18
18
|
import { type SheetModel } from '../../model';
|
|
19
|
-
import { useSheetContext } from '../
|
|
19
|
+
import { useSheetContext } from '../SheetRoot';
|
|
20
20
|
|
|
21
21
|
import { createAlign, useAlignState } from './align';
|
|
22
22
|
import { createStyle, useStyleState } from './style';
|
|
@@ -59,9 +59,10 @@ const createToolbarActions = ({
|
|
|
59
59
|
});
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
-
export type SheetToolbarProps =
|
|
62
|
+
export type SheetToolbarProps = { id: string } & Partial<MenuRootProps> &
|
|
63
|
+
PropsWithChildren<{ id: string } & Partial<MenuRootProps>>;
|
|
63
64
|
|
|
64
|
-
export const SheetToolbar = ({ id }: SheetToolbarProps) => {
|
|
65
|
+
export const SheetToolbar = ({ id, ...props }: SheetToolbarProps) => {
|
|
65
66
|
const { model, cursorFallbackRange } = useSheetContext();
|
|
66
67
|
const stateAtom = useToolbarState({});
|
|
67
68
|
const registry = useContext(RegistryContext);
|
|
@@ -75,7 +76,7 @@ export const SheetToolbar = ({ id }: SheetToolbarProps) => {
|
|
|
75
76
|
const nodes = actions.filter((action) => action.properties.disposition === 'toolbar');
|
|
76
77
|
return {
|
|
77
78
|
nodes,
|
|
78
|
-
edges: nodes.map((node) => ({ source: 'root', target: node.id })),
|
|
79
|
+
edges: nodes.map((node) => ({ source: 'root', target: node.id, relation: 'child' })),
|
|
79
80
|
};
|
|
80
81
|
});
|
|
81
82
|
}, [graph, id]);
|
|
@@ -87,8 +88,8 @@ export const SheetToolbar = ({ id }: SheetToolbarProps) => {
|
|
|
87
88
|
const menu = useMenuActions(actionsCreator);
|
|
88
89
|
|
|
89
90
|
return (
|
|
90
|
-
<
|
|
91
|
-
<
|
|
92
|
-
</
|
|
91
|
+
<Menu.Root {...props} {...menu} attendableId={id}>
|
|
92
|
+
<Menu.Toolbar />
|
|
93
|
+
</Menu.Root>
|
|
93
94
|
);
|
|
94
95
|
};
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
import { meta } from '../../meta';
|
|
18
18
|
import { type SheetModel } from '../../model';
|
|
19
19
|
import { type AlignKey, type AlignValue, alignKey, rangeFromIndex, rangeToIndex } from '../../types';
|
|
20
|
-
import { useSheetContext } from '../
|
|
20
|
+
import { useSheetContext } from '../SheetRoot';
|
|
21
21
|
|
|
22
22
|
import { type ToolbarState, type ToolbarStateAtom } from './useToolbarState';
|
|
23
23
|
|
|
@@ -117,8 +117,8 @@ export const createAlign = (context: AlignActionsContext): ActionGraphProps => {
|
|
|
117
117
|
return {
|
|
118
118
|
nodes: [alignGroup, ...alignActions],
|
|
119
119
|
edges: [
|
|
120
|
-
{ source: 'root', target: 'align' },
|
|
121
|
-
...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' })),
|
|
122
122
|
],
|
|
123
123
|
};
|
|
124
124
|
};
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
import { meta } from '../../meta';
|
|
18
18
|
import { type SheetModel } from '../../model';
|
|
19
19
|
import { type StyleKey, type StyleValue, rangeFromIndex, rangeToIndex } from '../../types';
|
|
20
|
-
import { useSheetContext } from '../
|
|
20
|
+
import { useSheetContext } from '../SheetRoot';
|
|
21
21
|
|
|
22
22
|
import { type ToolbarState, type ToolbarStateAtom } from './useToolbarState';
|
|
23
23
|
|
|
@@ -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,7 +7,7 @@ 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
12
|
import { ghostHover } from '@dxos/ui-theme';
|
|
13
13
|
|
|
@@ -34,11 +34,13 @@ export const RangeList = ({ sheet }: RangeListProps) => {
|
|
|
34
34
|
);
|
|
35
35
|
return (
|
|
36
36
|
<>
|
|
37
|
-
<
|
|
37
|
+
<Input.Root>
|
|
38
|
+
<Input.Label>{t('range list heading')}</Input.Label>
|
|
39
|
+
</Input.Root>
|
|
38
40
|
{sheet.ranges.length < 1 ? (
|
|
39
|
-
<
|
|
40
|
-
<
|
|
41
|
-
</
|
|
41
|
+
<Message.Root>
|
|
42
|
+
<Message.Title>{t('no ranges message')}</Message.Title>
|
|
43
|
+
</Message.Root>
|
|
42
44
|
) : (
|
|
43
45
|
<List.Root<Sheet.Range> items={sheet.ranges} isItem={Schema.is(Sheet.Range)}>
|
|
44
46
|
{({ items: ranges }) =>
|
|
@@ -4,7 +4,7 @@
|
|
|
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
9
|
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
10
10
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
@@ -16,23 +16,22 @@ import { withClientProvider } from '@dxos/react-client/testing';
|
|
|
16
16
|
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
17
17
|
import { AttendableContainer } from '@dxos/react-ui-attention';
|
|
18
18
|
|
|
19
|
+
import { ComputeGraphContext, useComputeGraph } from '../../components';
|
|
19
20
|
import { createTestCells, useTestSheet, withComputeGraphDecorator } from '../../testing';
|
|
20
21
|
import { translations } from '../../translations';
|
|
21
22
|
import { Sheet, SheetOperation } from '../../types';
|
|
22
|
-
import
|
|
23
|
-
import { RangeList } from '../RangeList';
|
|
23
|
+
import RangeList from '../RangeList';
|
|
24
24
|
|
|
25
25
|
import { SheetContainer } from './SheetContainer';
|
|
26
26
|
|
|
27
27
|
const meta = {
|
|
28
|
-
title: 'plugins/plugin-sheet/SheetContainer',
|
|
28
|
+
title: 'plugins/plugin-sheet/containers/SheetContainer',
|
|
29
29
|
component: SheetContainer,
|
|
30
30
|
decorators: [
|
|
31
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: [
|
|
@@ -42,7 +41,6 @@ const meta = {
|
|
|
42
41
|
handler: ({ 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
46
|
}),
|
|
@@ -61,49 +59,32 @@ export default meta;
|
|
|
61
59
|
export const Default = () => {
|
|
62
60
|
const space = useSpace();
|
|
63
61
|
const graph = useComputeGraph(space);
|
|
62
|
+
const { registry } = useContext(ComputeGraphContext) ?? {};
|
|
64
63
|
const sheet = useTestSheet(space, graph, { cells: createTestCells() });
|
|
65
|
-
if (!sheet || !space) {
|
|
64
|
+
if (!sheet || !space || !registry) {
|
|
66
65
|
return null;
|
|
67
66
|
}
|
|
68
67
|
|
|
69
68
|
return (
|
|
70
69
|
<AttendableContainer id={Obj.getDXN(sheet).toString()} classNames='contents'>
|
|
71
|
-
<SheetContainer role='article' space={space} subject={sheet} ignoreAttention />
|
|
70
|
+
<SheetContainer role='article' space={space} subject={sheet} registry={registry} ignoreAttention />
|
|
72
71
|
</AttendableContainer>
|
|
73
72
|
);
|
|
74
73
|
};
|
|
75
74
|
|
|
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
75
|
export const Spec = () => {
|
|
96
76
|
const space = useSpace();
|
|
97
77
|
const graph = useComputeGraph(space);
|
|
78
|
+
const { registry } = useContext(ComputeGraphContext) ?? {};
|
|
98
79
|
const sheet = useTestSheet(space, graph, { cells: { A1: { value: 'Ready' } } });
|
|
99
|
-
if (!sheet || !space) {
|
|
80
|
+
if (!sheet || !space || !registry) {
|
|
100
81
|
return null;
|
|
101
82
|
}
|
|
102
83
|
|
|
103
84
|
return (
|
|
104
85
|
<AttendableContainer id={Obj.getDXN(sheet).toString()} classNames='contents'>
|
|
105
|
-
<div role='none' className='
|
|
106
|
-
<SheetContainer role='article' space={space} subject={sheet} ignoreAttention />
|
|
86
|
+
<div role='none' className='w-full grid grid-cols-[1fr_20rem]'>
|
|
87
|
+
<SheetContainer role='article' space={space} subject={sheet} registry={registry} ignoreAttention />
|
|
107
88
|
<div role='none' data-testid='grid.range-list'>
|
|
108
89
|
<RangeList sheet={sheet} />
|
|
109
90
|
</div>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';
|
|
8
|
+
import { type ComputeGraphRegistry } from '@dxos/compute';
|
|
9
|
+
import { Obj } from '@dxos/echo';
|
|
10
|
+
import { type Space } from '@dxos/react-client/echo';
|
|
11
|
+
import { Panel } from '@dxos/react-ui';
|
|
12
|
+
|
|
13
|
+
import { ComputeGraphContextProvider, Sheet, useComputeGraph } from '../../components';
|
|
14
|
+
import { type Sheet as SheetType } from '../../types';
|
|
15
|
+
|
|
16
|
+
export type SheetContainerProps = SurfaceComponentProps<
|
|
17
|
+
SheetType.Sheet,
|
|
18
|
+
{
|
|
19
|
+
space: Space;
|
|
20
|
+
registry: ComputeGraphRegistry;
|
|
21
|
+
ignoreAttention?: boolean;
|
|
22
|
+
}
|
|
23
|
+
>;
|
|
24
|
+
|
|
25
|
+
export const SheetContainer = ({ registry, ...props }: SheetContainerProps) => (
|
|
26
|
+
<ComputeGraphContextProvider registry={registry}>
|
|
27
|
+
<SheetContainerInner {...props} />
|
|
28
|
+
</ComputeGraphContextProvider>
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const SheetContainerInner = ({
|
|
32
|
+
role,
|
|
33
|
+
subject: sheet,
|
|
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} ignoreAttention={ignoreAttention}>
|
|
44
|
+
<Panel.Root classNames={role === 'section' && 'aspect-aquare'}>
|
|
45
|
+
<Panel.Toolbar asChild>
|
|
46
|
+
<Sheet.Toolbar id={Obj.getDXN(sheet).toString()} />
|
|
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
27
|
import { useTestSheet, withComputeGraphDecorator } from '../testing';
|
|
28
|
-
import { Sheet } from '../types';
|
|
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}>
|
|
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
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
|
}),
|
|
@@ -92,7 +92,6 @@ export const useSelectThreadOnCellFocus = () => {
|
|
|
92
92
|
void (async () => {
|
|
93
93
|
await invokePromise(ThreadOperation.Select, { current: Relation.getDXN(closestThread).toString() });
|
|
94
94
|
await invokePromise(DeckOperation.ChangeCompanion, {
|
|
95
|
-
primary,
|
|
96
95
|
companion: `${primary}${ATTENDABLE_PATH_SEPARATOR}comments`,
|
|
97
96
|
});
|
|
98
97
|
})();
|
|
@@ -10,7 +10,7 @@ export default defineConfig({
|
|
|
10
10
|
...e2ePreset(import.meta.dirname),
|
|
11
11
|
// TODO(wittjosiah): Avoid hard-coding ports.
|
|
12
12
|
webServer: {
|
|
13
|
-
command: '
|
|
13
|
+
command: 'pnpm storybook dev --ci --quiet --port=9005 --config-dir=.storybook',
|
|
14
14
|
port: 9005,
|
|
15
15
|
reuseExistingServer: false,
|
|
16
16
|
},
|
|
@@ -15,7 +15,7 @@ test.describe('plugin-sheet', () => {
|
|
|
15
15
|
|
|
16
16
|
test.beforeEach(async ({ browser }) => {
|
|
17
17
|
const setup = await setupPage(browser, {
|
|
18
|
-
url: storybookUrl('plugins-plugin-sheet-sheetcontainer--spec', 9005),
|
|
18
|
+
url: storybookUrl('plugins-plugin-sheet-containers-sheetcontainer--spec', 9005),
|
|
19
19
|
viewportSize: { width: 1280, height: 720 },
|
|
20
20
|
});
|
|
21
21
|
page = setup.page;
|
|
@@ -34,14 +34,14 @@ export const cellClassNameForRange = ({ key, value }: Sheet.Sheet['ranges'][numb
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
case commentKey:
|
|
37
|
-
return 'bg-
|
|
37
|
+
return 'bg-grid-comment';
|
|
38
38
|
|
|
39
39
|
case styleKey:
|
|
40
40
|
switch (value) {
|
|
41
41
|
case 'highlight':
|
|
42
|
-
return '
|
|
42
|
+
return 'bg-grid-highlight!';
|
|
43
43
|
case 'softwrap':
|
|
44
|
-
return '
|
|
44
|
+
return 'whitespace-normal!';
|
|
45
45
|
default:
|
|
46
46
|
return undefined;
|
|
47
47
|
}
|
package/src/types/types.ts
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
7
|
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { Collection } from '@dxos/echo';
|
|
8
9
|
import { Operation } from '@dxos/operation';
|
|
9
10
|
import { SpaceSchema } from '@dxos/react-client/echo';
|
|
10
|
-
import { Collection } from '@dxos/schema';
|
|
11
11
|
|
|
12
12
|
import { meta } from '../meta';
|
|
13
13
|
|