@dxos/plugin-sheet 0.8.4-main.28f8d3d → 0.8.4-main.406dc2a

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.
Files changed (148) hide show
  1. package/dist/lib/browser/{SheetContainer-JZNFXBW3.mjs → SheetContainer-VL34UND4.mjs} +28 -28
  2. package/dist/lib/browser/SheetContainer-VL34UND4.mjs.map +7 -0
  3. package/dist/lib/browser/{anchor-sort-VRX3YZKT.mjs → anchor-sort-3N44DS5F.mjs} +5 -5
  4. package/dist/lib/browser/{anchor-sort-VRX3YZKT.mjs.map → anchor-sort-3N44DS5F.mjs.map} +1 -1
  5. package/dist/lib/browser/{chunk-ELAASQ5H.mjs → chunk-ADK2HW4A.mjs} +24 -17
  6. package/dist/lib/browser/chunk-ADK2HW4A.mjs.map +7 -0
  7. package/dist/lib/browser/{chunk-6AKBCBL4.mjs → chunk-CSBSADPQ.mjs} +2 -4
  8. package/dist/lib/browser/chunk-CSBSADPQ.mjs.map +7 -0
  9. package/dist/lib/browser/{chunk-VTTKAHAY.mjs → chunk-SSN4HYJL.mjs} +6 -6
  10. package/dist/lib/browser/chunk-SSN4HYJL.mjs.map +7 -0
  11. package/dist/lib/browser/{chunk-BVTHIA5U.mjs → chunk-ZJWJMX4E.mjs} +25 -20
  12. package/dist/lib/browser/chunk-ZJWJMX4E.mjs.map +7 -0
  13. package/dist/lib/browser/{chunk-KJWZUQVA.mjs → chunk-ZMPNHFIP.mjs} +4 -4
  14. package/dist/lib/browser/chunk-ZMPNHFIP.mjs.map +7 -0
  15. package/dist/lib/browser/compute-graph-registry-MF65HGGM.mjs +21 -0
  16. package/dist/lib/browser/compute-graph-registry-MF65HGGM.mjs.map +7 -0
  17. package/dist/lib/browser/index.mjs +12 -13
  18. package/dist/lib/browser/index.mjs.map +3 -3
  19. package/dist/lib/browser/{intent-resolver-SSLPTP5O.mjs → intent-resolver-BQLV6IAA.mjs} +7 -7
  20. package/dist/lib/browser/intent-resolver-BQLV6IAA.mjs.map +7 -0
  21. package/dist/lib/browser/{markdown-3VPZYNGU.mjs → markdown-RMTMI237.mjs} +6 -6
  22. package/dist/lib/browser/{markdown-3VPZYNGU.mjs.map → markdown-RMTMI237.mjs.map} +1 -1
  23. package/dist/lib/browser/meta.json +1 -1
  24. package/dist/lib/browser/{react-surface-Y7KTPJW2.mjs → react-surface-7ZDMQDCT.mjs} +11 -11
  25. package/dist/lib/browser/react-surface-7ZDMQDCT.mjs.map +7 -0
  26. package/dist/lib/browser/types/index.mjs +2 -2
  27. package/dist/lib/node-esm/{SheetContainer-GOIBAE2P.mjs → SheetContainer-NWJ7L6FC.mjs} +28 -28
  28. package/dist/lib/node-esm/SheetContainer-NWJ7L6FC.mjs.map +7 -0
  29. package/dist/lib/node-esm/{anchor-sort-YM2UBIKL.mjs → anchor-sort-YL2OZHYM.mjs} +5 -5
  30. package/dist/lib/node-esm/{anchor-sort-YM2UBIKL.mjs.map → anchor-sort-YL2OZHYM.mjs.map} +1 -1
  31. package/dist/lib/node-esm/{chunk-4L5CIB7E.mjs → chunk-BZAPYBSH.mjs} +24 -17
  32. package/dist/lib/node-esm/chunk-BZAPYBSH.mjs.map +7 -0
  33. package/dist/lib/node-esm/{chunk-3K5VNYOF.mjs → chunk-H3GSD33H.mjs} +2 -4
  34. package/dist/lib/node-esm/chunk-H3GSD33H.mjs.map +7 -0
  35. package/dist/lib/node-esm/{chunk-FXRXBHWM.mjs → chunk-IK4O7FUJ.mjs} +6 -6
  36. package/dist/lib/node-esm/chunk-IK4O7FUJ.mjs.map +7 -0
  37. package/dist/lib/node-esm/{chunk-6SK5LJ5S.mjs → chunk-LN6ZSAII.mjs} +4 -4
  38. package/dist/lib/node-esm/chunk-LN6ZSAII.mjs.map +7 -0
  39. package/dist/lib/node-esm/{chunk-56HYMW55.mjs → chunk-YL7BVJPC.mjs} +25 -20
  40. package/dist/lib/node-esm/chunk-YL7BVJPC.mjs.map +7 -0
  41. package/dist/lib/node-esm/compute-graph-registry-P2O5LDFZ.mjs +22 -0
  42. package/dist/lib/node-esm/compute-graph-registry-P2O5LDFZ.mjs.map +7 -0
  43. package/dist/lib/node-esm/index.mjs +12 -13
  44. package/dist/lib/node-esm/index.mjs.map +3 -3
  45. package/dist/lib/node-esm/{intent-resolver-5P6DBGK2.mjs → intent-resolver-MV5ZFXAQ.mjs} +7 -7
  46. package/dist/lib/node-esm/intent-resolver-MV5ZFXAQ.mjs.map +7 -0
  47. package/dist/lib/node-esm/{markdown-SFDGQWYE.mjs → markdown-EDIWHA3P.mjs} +6 -6
  48. package/dist/lib/node-esm/{markdown-SFDGQWYE.mjs.map → markdown-EDIWHA3P.mjs.map} +1 -1
  49. package/dist/lib/node-esm/meta.json +1 -1
  50. package/dist/lib/node-esm/{react-surface-6Z5FAOBH.mjs → react-surface-TUME5MM2.mjs} +11 -11
  51. package/dist/lib/node-esm/react-surface-TUME5MM2.mjs.map +7 -0
  52. package/dist/lib/node-esm/types/index.mjs +2 -2
  53. package/dist/types/src/SheetPlugin.d.ts +1 -1
  54. package/dist/types/src/SheetPlugin.d.ts.map +1 -1
  55. package/dist/types/src/capabilities/anchor-sort.d.ts +2 -2
  56. package/dist/types/src/capabilities/compute-graph-registry.d.ts +1 -1
  57. package/dist/types/src/capabilities/compute-graph-registry.d.ts.map +1 -1
  58. package/dist/types/src/capabilities/index.d.ts +6 -8
  59. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  60. package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
  61. package/dist/types/src/capabilities/markdown.d.ts +1 -3
  62. package/dist/types/src/capabilities/markdown.d.ts.map +1 -1
  63. package/dist/types/src/capabilities/react-surface.d.ts +1 -1
  64. package/dist/types/src/components/ComputeGraph/compute-graph.stories.d.ts +9 -4
  65. package/dist/types/src/components/ComputeGraph/compute-graph.stories.d.ts.map +1 -1
  66. package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts +50 -3
  67. package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +1 -1
  68. package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts +11 -20
  69. package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts.map +1 -1
  70. package/dist/types/src/components/SheetContainer/SheetContainer.d.ts.map +1 -1
  71. package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts +52 -5
  72. package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +1 -1
  73. package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts.map +1 -1
  74. package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts +86 -4
  75. package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts.map +1 -1
  76. package/dist/types/src/extensions/compute.d.ts +1 -1
  77. package/dist/types/src/extensions/compute.d.ts.map +1 -1
  78. package/dist/types/src/extensions/compute.stories.d.ts +10 -13
  79. package/dist/types/src/extensions/compute.stories.d.ts.map +1 -1
  80. package/dist/types/src/extensions/editor/index.d.ts +1 -1
  81. package/dist/types/src/extensions/editor/index.d.ts.map +1 -1
  82. package/dist/types/src/extensions/editor/{extension.d.ts → sheet-extension.d.ts} +1 -1
  83. package/dist/types/src/extensions/editor/sheet-extension.d.ts.map +1 -0
  84. package/dist/types/src/extensions/editor/sheet-extension.test.d.ts +2 -0
  85. package/dist/types/src/extensions/editor/sheet-extension.test.d.ts.map +1 -0
  86. package/dist/types/src/integrations/thread-ranges.d.ts.map +1 -1
  87. package/dist/types/src/meta.d.ts +0 -1
  88. package/dist/types/src/meta.d.ts.map +1 -1
  89. package/dist/types/src/model/sheet-model.d.ts +1 -1
  90. package/dist/types/src/model/sheet-model.d.ts.map +1 -1
  91. package/dist/types/src/testing/testing.d.ts +1 -1
  92. package/dist/types/src/testing/testing.d.ts.map +1 -1
  93. package/dist/types/src/types/schema.d.ts +1 -1
  94. package/dist/types/src/types/schema.d.ts.map +1 -1
  95. package/dist/types/src/types/types.d.ts +7 -7
  96. package/dist/types/src/types/types.d.ts.map +1 -1
  97. package/dist/types/tsconfig.tsbuildinfo +1 -1
  98. package/package.json +63 -63
  99. package/src/SheetPlugin.tsx +68 -60
  100. package/src/capabilities/capabilities.ts +2 -2
  101. package/src/capabilities/compute-graph-registry.ts +8 -13
  102. package/src/capabilities/intent-resolver.ts +2 -2
  103. package/src/capabilities/react-surface.tsx +3 -3
  104. package/src/components/ComputeGraph/compute-graph.stories.tsx +10 -10
  105. package/src/components/GridSheet/GridSheet.stories.tsx +16 -11
  106. package/src/components/GridSheet/GridSheet.tsx +8 -8
  107. package/src/components/GridSheet/SheetCellEditor.stories.tsx +38 -40
  108. package/src/components/RangeList/RangeList.tsx +3 -3
  109. package/src/components/SheetContainer/SheetContainer.stories.tsx +37 -37
  110. package/src/components/SheetContainer/SheetContainer.tsx +5 -1
  111. package/src/components/SheetToolbar/SheetToolbar.stories.tsx +17 -12
  112. package/src/components/SheetToolbar/SheetToolbar.tsx +11 -11
  113. package/src/components/SheetToolbar/align.ts +3 -3
  114. package/src/components/SheetToolbar/style.ts +2 -2
  115. package/src/extensions/compute.stories.tsx +26 -23
  116. package/src/extensions/compute.ts +1 -2
  117. package/src/extensions/editor/index.ts +1 -1
  118. package/src/extensions/editor/{extension.test.ts → sheet-extension.test.ts} +1 -1
  119. package/src/integrations/thread-ranges.ts +5 -4
  120. package/src/meta.ts +1 -3
  121. package/src/model/sheet-model.ts +1 -1
  122. package/src/testing/testing.tsx +8 -2
  123. package/src/types/schema.ts +1 -1
  124. package/src/types/types.ts +3 -3
  125. package/dist/lib/browser/SheetContainer-JZNFXBW3.mjs.map +0 -7
  126. package/dist/lib/browser/chunk-6AKBCBL4.mjs.map +0 -7
  127. package/dist/lib/browser/chunk-BVTHIA5U.mjs.map +0 -7
  128. package/dist/lib/browser/chunk-ELAASQ5H.mjs.map +0 -7
  129. package/dist/lib/browser/chunk-KJWZUQVA.mjs.map +0 -7
  130. package/dist/lib/browser/chunk-VTTKAHAY.mjs.map +0 -7
  131. package/dist/lib/browser/compute-graph-registry-6YJHXORG.mjs +0 -30
  132. package/dist/lib/browser/compute-graph-registry-6YJHXORG.mjs.map +0 -7
  133. package/dist/lib/browser/intent-resolver-SSLPTP5O.mjs.map +0 -7
  134. package/dist/lib/browser/react-surface-Y7KTPJW2.mjs.map +0 -7
  135. package/dist/lib/node-esm/SheetContainer-GOIBAE2P.mjs.map +0 -7
  136. package/dist/lib/node-esm/chunk-3K5VNYOF.mjs.map +0 -7
  137. package/dist/lib/node-esm/chunk-4L5CIB7E.mjs.map +0 -7
  138. package/dist/lib/node-esm/chunk-56HYMW55.mjs.map +0 -7
  139. package/dist/lib/node-esm/chunk-6SK5LJ5S.mjs.map +0 -7
  140. package/dist/lib/node-esm/chunk-FXRXBHWM.mjs.map +0 -7
  141. package/dist/lib/node-esm/compute-graph-registry-ET5KJNLV.mjs +0 -31
  142. package/dist/lib/node-esm/compute-graph-registry-ET5KJNLV.mjs.map +0 -7
  143. package/dist/lib/node-esm/intent-resolver-5P6DBGK2.mjs.map +0 -7
  144. package/dist/lib/node-esm/react-surface-6Z5FAOBH.mjs.map +0 -7
  145. package/dist/types/src/extensions/editor/extension.d.ts.map +0 -1
  146. package/dist/types/src/extensions/editor/extension.test.d.ts +0 -2
  147. package/dist/types/src/extensions/editor/extension.test.d.ts.map +0 -1
  148. /package/src/extensions/editor/{extension.ts → sheet-extension.ts} +0 -0
@@ -2,53 +2,48 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import '@dxos-theme';
6
-
7
- import { type Meta } from '@storybook/react-vite';
8
- import React, { useEffect, useMemo, useState } from 'react';
5
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
6
+ import React, { useMemo, useState } from 'react';
9
7
 
10
8
  import { Client } from '@dxos/client';
11
9
  import { createDocAccessor } from '@dxos/client/echo';
12
10
  import { defaultFunctions } from '@dxos/compute';
13
11
  import { getRegisteredFunctionNames } from '@dxos/compute/testing';
12
+ import { useAsyncEffect } from '@dxos/react-hooks';
13
+ import { withTheme } from '@dxos/react-ui/testing';
14
14
  import { automerge } from '@dxos/react-ui-editor';
15
15
  import { CellEditor, type CellEditorProps } from '@dxos/react-ui-grid';
16
- import { withTheme } from '@dxos/storybook-utils';
17
16
 
18
17
  import { sheetExtension } from '../../extensions';
19
18
  import { SheetType, createSheet } from '../../types';
20
19
 
21
- type StoryProps = CellEditorProps;
22
-
23
- const Story = ({ value, ...props }: StoryProps) => {
24
- const extension = useMemo(() => {
20
+ const DefaultStory = ({ value, ...props }: CellEditorProps) => {
21
+ const extensions = useMemo(() => {
25
22
  const functionNames = getRegisteredFunctionNames();
26
23
  const functions = defaultFunctions.filter(({ name }) => functionNames.includes(name));
27
24
  return [sheetExtension({ functions })];
28
25
  }, []);
29
26
 
30
- return <CellEditor {...props} value={value} extension={extension} />;
27
+ return <CellEditor {...props} value={value} extensions={extensions} />;
31
28
  };
32
29
 
33
- const AutomergeStory = ({ value, ...props }: StoryProps) => {
30
+ const AutomergeStory = ({ value, ...props }: CellEditorProps) => {
34
31
  const cell = 'A1';
35
32
  const [object, setObject] = useState<SheetType>();
36
- useEffect(() => {
37
- setTimeout(async () => {
38
- const client = new Client({ types: [SheetType] });
39
- await client.initialize();
40
- await client.halo.createIdentity();
41
- const space = await client.spaces.create();
42
-
43
- const sheet = createSheet();
44
- sheet.name = 'Test';
45
- sheet.cells[cell] = { value };
46
- space.db.add(sheet);
47
- setObject(sheet);
48
- });
33
+ useAsyncEffect(async () => {
34
+ const client = new Client({ types: [SheetType] });
35
+ await client.initialize();
36
+ await client.halo.createIdentity();
37
+ const space = await client.spaces.create();
38
+
39
+ const sheet = createSheet();
40
+ sheet.name = 'Test';
41
+ sheet.cells[cell] = { value };
42
+ space.db.add(sheet);
43
+ setObject(sheet);
49
44
  }, [value]);
50
45
 
51
- const extension = useMemo(() => {
46
+ const extensions = useMemo(() => {
52
47
  if (!object) {
53
48
  return [];
54
49
  }
@@ -59,35 +54,38 @@ const AutomergeStory = ({ value, ...props }: StoryProps) => {
59
54
  return [automerge(accessor), sheetExtension({ functions })];
60
55
  }, [object]);
61
56
 
62
- return <CellEditor {...props} value={value} extension={extension} />;
57
+ return <CellEditor {...props} value={value} extensions={extensions} />;
63
58
  };
64
59
 
65
- export const Default = {};
60
+ const meta = {
61
+ title: 'plugins/plugin-sheet/CellEditor',
62
+
63
+ decorators: [withTheme],
64
+ component: CellEditor,
65
+ render: DefaultStory,
66
+ } satisfies Meta<typeof DefaultStory>;
67
+
68
+ export default meta;
69
+
70
+ type Story = StoryObj<typeof meta>;
66
71
 
67
- export const AutoComplete = {
72
+ export const Default: Story = {};
73
+
74
+ export const AutoComplete: Story = {
68
75
  args: {
69
76
  value: '=SUM',
70
77
  },
71
78
  };
72
79
 
73
- export const Formatting = {
80
+ export const Formatting: Story = {
74
81
  args: {
75
82
  value: '=SUM(A1:A2, 100, TRUE, "100", SUM(A1:A2, B1:B2))',
76
83
  },
77
84
  };
78
85
 
79
- export const Automerge = {
80
- render: (args: StoryProps) => <AutomergeStory {...args} />,
86
+ export const Automerge: Story = {
87
+ render: AutomergeStory,
81
88
  args: {
82
89
  value: '=SUM(A1:A2, 100, TRUE, "100", SUM(A1:A2, B1:B2))',
83
90
  },
84
91
  };
85
-
86
- const meta: Meta = {
87
- title: 'plugins/plugin-sheet/CellEditor',
88
- component: CellEditor,
89
- decorators: [withTheme],
90
- render: (args: StoryProps) => <Story {...args} />,
91
- };
92
-
93
- export default meta;
@@ -2,7 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
  import React, { useCallback } from 'react';
7
7
 
8
8
  import { rangeToA1Notation } from '@dxos/compute';
@@ -10,7 +10,7 @@ import { Callout, useTranslation } from '@dxos/react-ui';
10
10
  import { List } from '@dxos/react-ui-list';
11
11
  import { ghostHover } from '@dxos/react-ui-theme';
12
12
 
13
- import { SHEET_PLUGIN } from '../../meta';
13
+ import { meta } from '../../meta';
14
14
  import { rangeFromIndex } from '../../types';
15
15
  import { Range, type SheetType } from '../../types';
16
16
 
@@ -19,7 +19,7 @@ export type RangeListProps = {
19
19
  };
20
20
 
21
21
  export const RangeList = ({ sheet }: RangeListProps) => {
22
- const { t } = useTranslation(SHEET_PLUGIN);
22
+ const { t } = useTranslation(meta.id);
23
23
  // TODO(thure): Implement similar to comments, #8121
24
24
  const handleSelectRange = (range: Range) => {};
25
25
  const handleDeleteRange = useCallback(
@@ -2,8 +2,6 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import '@dxos-theme';
6
-
7
5
  import { type Meta } from '@storybook/react-vite';
8
6
  import React from 'react';
9
7
 
@@ -12,9 +10,9 @@ import { withPluginManager } from '@dxos/app-framework/testing';
12
10
  import { GraphPlugin } from '@dxos/plugin-graph';
13
11
  import { fullyQualifiedId, useSpace } from '@dxos/react-client/echo';
14
12
  import { withClientProvider } from '@dxos/react-client/testing';
13
+ import { withTheme } from '@dxos/react-ui/testing';
15
14
  import { AttendableContainer } from '@dxos/react-ui-attention';
16
15
  import { withAttention } from '@dxos/react-ui-attention/testing';
17
- import { withLayout, withTheme } from '@dxos/storybook-utils';
18
16
 
19
17
  import { createTestCells, useTestSheet, withComputeGraphDecorator } from '../../testing';
20
18
  import { translations } from '../../translations';
@@ -24,7 +22,39 @@ import { RangeList } from '../RangeList';
24
22
 
25
23
  import { SheetContainer } from './SheetContainer';
26
24
 
27
- export const Basic = () => {
25
+ const meta = {
26
+ title: 'plugins/plugin-sheet/SheetContainer',
27
+ component: SheetContainer,
28
+ decorators: [
29
+ withTheme,
30
+ withClientProvider({ types: [SheetType], createSpace: true }),
31
+ withComputeGraphDecorator(),
32
+ withAttention,
33
+ // TODO(wittjosiah): Consider whether we should refactor component so story doesn't need to depend on intents.
34
+ withPluginManager({
35
+ plugins: [IntentPlugin(), GraphPlugin()],
36
+ capabilities: [
37
+ contributes(
38
+ Capabilities.IntentResolver,
39
+ createResolver({
40
+ intent: SheetAction.DropAxis,
41
+ resolve: ({ model, axis, axisIndex }) => {
42
+ model[axis === 'col' ? 'dropColumn' : 'dropRow'](axisIndex);
43
+ },
44
+ }),
45
+ ),
46
+ ],
47
+ }),
48
+ ],
49
+ parameters: {
50
+ layout: 'fullscreen',
51
+ translations,
52
+ },
53
+ } satisfies Meta<typeof SheetContainer>;
54
+
55
+ export default meta;
56
+
57
+ export const Default = () => {
28
58
  const space = useSpace();
29
59
  const graph = useComputeGraph(space);
30
60
  const sheet = useTestSheet(space, graph, { cells: createTestCells() });
@@ -34,7 +64,7 @@ export const Basic = () => {
34
64
 
35
65
  return (
36
66
  <AttendableContainer id={fullyQualifiedId(sheet)} classNames='contents'>
37
- <SheetContainer space={space} sheet={sheet} role='article' ignoreAttention />
67
+ <SheetContainer space={space} sheet={sheet} role='story' ignoreAttention />
38
68
  </AttendableContainer>
39
69
  );
40
70
  };
@@ -49,8 +79,8 @@ export const Spec = () => {
49
79
 
50
80
  return (
51
81
  <AttendableContainer id={fullyQualifiedId(sheet)} classNames='contents'>
52
- <div role='none' className='grid grid-rows-[66%_33%] grid-cols-1'>
53
- <SheetContainer space={space} sheet={sheet} role='article' ignoreAttention />
82
+ <div role='none' className='grid grid-rows-[66%_33%] bs-full grid-cols-1'>
83
+ <SheetContainer space={space} sheet={sheet} role='story' ignoreAttention />
54
84
  <div role='none' data-testid='grid.range-list'>
55
85
  <RangeList sheet={sheet} />
56
86
  </div>
@@ -58,33 +88,3 @@ export const Spec = () => {
58
88
  </AttendableContainer>
59
89
  );
60
90
  };
61
-
62
- const meta: Meta = {
63
- title: 'plugins/plugin-sheet/SheetContainer',
64
- component: SheetContainer,
65
- decorators: [
66
- withClientProvider({ types: [SheetType], createSpace: true }),
67
- withComputeGraphDecorator(),
68
- withTheme,
69
- withLayout({ fullscreen: true, classNames: 'grid' }),
70
- withAttention,
71
- // TODO(wittjosiah): Consider whether we should refactor component so story doesn't need to depend on intents.
72
- withPluginManager({
73
- plugins: [IntentPlugin(), GraphPlugin()],
74
- capabilities: [
75
- contributes(
76
- Capabilities.IntentResolver,
77
- createResolver({
78
- intent: SheetAction.DropAxis,
79
- resolve: ({ model, axis, axisIndex }) => {
80
- model[axis === 'col' ? 'dropColumn' : 'dropRow'](axisIndex);
81
- },
82
- }),
83
- ),
84
- ],
85
- }),
86
- ],
87
- parameters: { translations },
88
- };
89
-
90
- export default meta;
@@ -26,7 +26,11 @@ export const SheetContainer = ({ space, sheet, role, ignoreAttention }: SheetCon
26
26
 
27
27
  return graph ? (
28
28
  <SheetProvider sheet={sheet} graph={graph} ignoreAttention={ignoreAttention}>
29
- <StackItem.Content toolbar statusbar {...(role === 'section' && { classNames: 'aspect-video' })}>
29
+ <StackItem.Content
30
+ toolbar
31
+ statusbar
32
+ classNames={[role === 'section' && 'aspect-video', role === 'story' && 'bs-full']}
33
+ >
30
34
  <SheetToolbar id={fullyQualifiedId(sheet)} />
31
35
  <GridSheet />
32
36
  <FunctionEditor />
@@ -2,29 +2,34 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import '@dxos-theme';
6
-
7
- import { type Meta } from '@storybook/react-vite';
5
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
8
6
  import React from 'react';
9
7
 
10
- import { withLayout, withTheme } from '@dxos/storybook-utils';
8
+ import { withTheme } from '@dxos/react-ui/testing';
11
9
 
12
10
  import { translations } from '../../translations';
13
11
 
14
12
  import { SheetToolbar } from './SheetToolbar';
15
13
 
16
14
  const DefaultStory = () => {
17
- return <SheetToolbar id='test' />;
15
+ // TODO(wittjosiah): Depends on SheetProvider.
16
+ // return <SheetToolbar id='test' />;
17
+ return <>TODO</>;
18
18
  };
19
19
 
20
- export const Default = {};
21
-
22
- const meta: Meta = {
20
+ const meta = {
23
21
  title: 'plugins/plugin-sheet/Toolbar',
24
- component: SheetToolbar,
22
+ component: SheetToolbar as any,
25
23
  render: DefaultStory,
26
- decorators: [withTheme, withLayout()],
27
- parameters: { translations, layout: 'fullscreen' },
28
- };
24
+ decorators: [withTheme],
25
+ parameters: {
26
+ layout: 'fullscreen',
27
+ translations,
28
+ },
29
+ } satisfies Meta<typeof DefaultStory>;
29
30
 
30
31
  export default meta;
32
+
33
+ type Story = StoryObj<typeof meta>;
34
+
35
+ export const Default: Story = {};
@@ -9,8 +9,6 @@ import { useAppGraph } from '@dxos/app-framework';
9
9
  import { type CompleteCellRange } from '@dxos/compute';
10
10
  import { type ThemedClassName } from '@dxos/react-ui';
11
11
  import {
12
- type ActionGraphEdges,
13
- type ActionGraphNodes,
14
12
  type ActionGraphProps,
15
13
  MenuProvider,
16
14
  ToolbarMenu,
@@ -37,22 +35,24 @@ const createToolbarActions = (
37
35
  state: ToolbarState,
38
36
  cursorFallbackRange?: CompleteCellRange,
39
37
  customActions?: Rx.Rx<ActionGraphProps>,
40
- ) => {
38
+ ): Rx.Rx<ActionGraphProps> => {
41
39
  return Rx.make((get) => {
42
40
  const align = get(rxFromSignal(() => createAlign(model, state, cursorFallbackRange)));
43
41
  const style = get(rxFromSignal(() => createStyle(model, state, cursorFallbackRange)));
44
42
  const gap = createGapSeparator();
45
- const nodes: ActionGraphNodes = [...align.nodes, ...style.nodes, ...gap.nodes];
46
- const edges: ActionGraphEdges = [...align.edges, ...style.edges, ...gap.edges];
43
+
44
+ const graph: ActionGraphProps = {
45
+ nodes: [...align.nodes, ...style.nodes, ...gap.nodes],
46
+ edges: [...align.edges, ...style.edges, ...gap.edges],
47
+ };
48
+
47
49
  if (customActions) {
48
50
  const custom = get(customActions);
49
- nodes.push(...custom.nodes);
50
- edges.push(...custom.edges);
51
+ graph.nodes.push(...custom.nodes);
52
+ graph.edges.push(...custom.edges);
51
53
  }
52
- return {
53
- nodes,
54
- edges,
55
- };
54
+
55
+ return graph;
56
56
  });
57
57
  };
58
58
 
@@ -7,7 +7,7 @@ import { useEffect } from 'react';
7
7
  import { type CompleteCellRange, inRange } from '@dxos/compute';
8
8
  import { type ToolbarMenuActionGroupProperties, createMenuAction, createMenuItemGroup } from '@dxos/react-ui-menu';
9
9
 
10
- import { SHEET_PLUGIN } from '../../meta';
10
+ import { meta } from '../../meta';
11
11
  import { type SheetModel } from '../../model';
12
12
  import { type AlignKey, type AlignValue, alignKey, rangeFromIndex, rangeToIndex } from '../../types';
13
13
  import { useSheetContext } from '../SheetContext';
@@ -40,7 +40,7 @@ export const useAlignState = (state: Partial<AlignState>) => {
40
40
 
41
41
  const createAlignGroupAction = (value?: AlignValue) =>
42
42
  createMenuItemGroup('align', {
43
- label: ['align label', { ns: SHEET_PLUGIN }],
43
+ label: ['align label', { ns: meta.id }],
44
44
  variant: 'toggleGroup',
45
45
  selectCardinality: 'single',
46
46
  value: `${alignKey}--${value}`,
@@ -79,7 +79,7 @@ const createAlignActions = (model: SheetModel, state: ToolbarState, cursorFallba
79
79
  key: alignKey,
80
80
  value: alignValue as AlignValue,
81
81
  checked: state[alignKey] === alignValue,
82
- label: [`range value ${alignValue} label`, { ns: SHEET_PLUGIN }],
82
+ label: [`range value ${alignValue} label`, { ns: meta.id }],
83
83
  icon,
84
84
  testId: `grid.toolbar.${alignKey}.${alignValue}`,
85
85
  },
@@ -7,7 +7,7 @@ import { useEffect } from 'react';
7
7
  import { type CompleteCellRange, inRange } from '@dxos/compute';
8
8
  import { type ToolbarMenuActionGroupProperties, createMenuAction, createMenuItemGroup } from '@dxos/react-ui-menu';
9
9
 
10
- import { SHEET_PLUGIN } from '../../meta';
10
+ import { meta } from '../../meta';
11
11
  import { type SheetModel } from '../../model';
12
12
  import { type StyleKey, type StyleValue, rangeFromIndex, rangeToIndex } from '../../types';
13
13
  import { useSheetContext } from '../SheetContext';
@@ -89,7 +89,7 @@ const createStyleActions = (model: SheetModel, state: StyleState, cursorFallback
89
89
  key: 'style',
90
90
  value: styleValue as StyleValue,
91
91
  icon,
92
- label: [`range value ${styleValue} label`, { ns: SHEET_PLUGIN }],
92
+ label: [`range value ${styleValue} label`, { ns: meta.id }],
93
93
  checked: !!state[styleValue as StyleValue],
94
94
  },
95
95
  );
@@ -2,15 +2,16 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import '@dxos-theme';
6
-
7
- import { type Meta } from '@storybook/react-vite';
5
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
8
6
  import React, { useEffect, useMemo } from 'react';
9
7
 
8
+ import { IntentPlugin } from '@dxos/app-framework';
9
+ import { withPluginManager } from '@dxos/app-framework/testing';
10
10
  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
15
  import {
15
16
  createBasicExtensions,
16
17
  createMarkdownExtensions,
@@ -19,7 +20,6 @@ import {
19
20
  documentId,
20
21
  useTextEditor,
21
22
  } from '@dxos/react-ui-editor';
22
- import { withLayout, withTheme } from '@dxos/storybook-utils';
23
23
  import { isNonNullable } from '@dxos/util';
24
24
 
25
25
  import { GridSheet, SheetProvider, useComputeGraph } from '../components';
@@ -42,7 +42,7 @@ type EditorProps = {
42
42
 
43
43
  const SHEET_NAME = 'Test Sheet';
44
44
 
45
- const EditorStory = ({ text }: EditorProps) => {
45
+ const DefaultStory = ({ text }: EditorProps) => {
46
46
  const id = useMemo(() => PublicKey.random(), []);
47
47
  const { themeMode } = useThemeContext();
48
48
  const space = useSpace();
@@ -52,7 +52,7 @@ const EditorStory = ({ text }: EditorProps) => {
52
52
  initialValue: text,
53
53
  extensions: [
54
54
  createBasicExtensions(),
55
- createMarkdownExtensions({ themeMode }),
55
+ createMarkdownExtensions(),
56
56
  createThemeExtensions({ themeMode, syntaxHighlighting: true }),
57
57
  documentId.of(id.toHex()),
58
58
  computeGraph && computeGraphFacet.of(computeGraph),
@@ -93,15 +93,31 @@ const Grid = () => {
93
93
  const GraphStory = (props: EditorProps) => {
94
94
  return (
95
95
  <div className='grid grid-rows-2'>
96
- <EditorStory {...props} />
96
+ <DefaultStory {...props} />
97
97
  <Grid />
98
98
  </div>
99
99
  );
100
100
  };
101
101
 
102
+ const meta = {
103
+ title: 'plugins/plugin-sheet/extensions',
104
+ decorators: [
105
+ withTheme,
106
+ withClientProvider({ types: [SheetType], createIdentity: true, createSpace: true }),
107
+ // TODO(wittjosiah): Try to write story which does not depend on plugin manager.
108
+ withPluginManager({ plugins: [IntentPlugin()] }),
109
+ withComputeGraphDecorator(),
110
+ ],
111
+ parameters: {
112
+ layout: 'fullscreen',
113
+ },
114
+ } satisfies Meta;
115
+
116
+ export default meta;
117
+
102
118
  // TODO(burdon): Inline formulae.
103
- export const Default = {
104
- render: EditorStory,
119
+ export const Default: StoryObj<typeof DefaultStory> = {
120
+ render: DefaultStory,
105
121
  args: {
106
122
  text: str(
107
123
  //
@@ -124,7 +140,7 @@ export const Default = {
124
140
  },
125
141
  };
126
142
 
127
- export const Graph = {
143
+ export const Graph: StoryObj<typeof GraphStory> = {
128
144
  render: GraphStory,
129
145
  args: {
130
146
  text: str(
@@ -141,16 +157,3 @@ export const Graph = {
141
157
  ),
142
158
  },
143
159
  };
144
-
145
- const meta: Meta = {
146
- title: 'plugins/plugin-sheet/extensions',
147
- decorators: [
148
- withClientProvider({ types: [SheetType], createIdentity: true, createSpace: true }),
149
- withComputeGraphDecorator(),
150
- withTheme,
151
- withLayout({ fullscreen: true, classNames: 'justify-center' }),
152
- ],
153
- parameters: { layout: 'fullscreen' },
154
- };
155
-
156
- export default meta;
@@ -34,7 +34,7 @@ export const computeGraphFacet = singleValueFacet<ComputeGraph>();
34
34
 
35
35
  export type ComputeOptions = {};
36
36
 
37
- export const compute = (options: ComputeOptions = {}): Extension => {
37
+ export const compute = (_options: ComputeOptions = {}): Extension => {
38
38
  let computeNode: ComputeNode | undefined;
39
39
 
40
40
  const update = (state: EditorState, current?: RangeSet<Decoration>) => {
@@ -53,7 +53,6 @@ export const compute = (options: ComputeOptions = {}): Extension => {
53
53
  const text = node.node.getChild('CodeText');
54
54
  if (type === LANGUAGE_TAG && text) {
55
55
  const formula = state.sliceDoc(text.from, text.to);
56
-
57
56
  const iter = current?.iter(node.node.from);
58
57
  if (iter?.value && iter?.value.spec.formula === formula) {
59
58
  // Add existing widget.
@@ -2,4 +2,4 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- export * from './extension';
5
+ export * from './sheet-extension';
@@ -10,7 +10,7 @@ import { describe, expect, test } from 'vitest';
10
10
 
11
11
  import { defaultFunctions } from '@dxos/compute';
12
12
 
13
- import { sheetExtension } from './extension';
13
+ import { sheetExtension } from './sheet-extension';
14
14
 
15
15
  describe('formula parser', () => {
16
16
  const {
@@ -2,7 +2,8 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema, pipe } from 'effect';
5
+ import * as Function from 'effect/Function';
6
+ import * as Schema from 'effect/Schema';
6
7
  import { useCallback, useEffect, useMemo } from 'react';
7
8
 
8
9
  import {
@@ -23,7 +24,7 @@ import { type DxGridElement, type GridContentProps } from '@dxos/react-ui-grid';
23
24
  import { AnchoredTo } from '@dxos/schema';
24
25
 
25
26
  import { useSheetContext } from '../components';
26
- import { SHEET_PLUGIN } from '../meta';
27
+ import { meta } from '../meta';
27
28
 
28
29
  export const completeCellRangeToThreadCursor = (range: CompleteCellRange): string => {
29
30
  return `${range.from.col},${range.from.row},${range.to.col},${range.to.row}`;
@@ -72,7 +73,7 @@ export const useUpdateFocusedCellOnThreadSelection = (grid: DxGridElement | null
72
73
  [model.sheet, setActiveRefs],
73
74
  );
74
75
 
75
- useIntentResolver(SHEET_PLUGIN, scrollIntoViewResolver);
76
+ useIntentResolver(meta.id, scrollIntoViewResolver);
76
77
  };
77
78
 
78
79
  export const useSelectThreadOnCellFocus = () => {
@@ -100,7 +101,7 @@ export const useSelectThreadOnCellFocus = () => {
100
101
 
101
102
  if (closestThread) {
102
103
  const primary = fullyQualifiedId(model.sheet);
103
- const intent = pipe(
104
+ const intent = Function.pipe(
104
105
  createIntent(ThreadAction.Select, { current: fullyQualifiedId(closestThread) }),
105
106
  chain(DeckAction.ChangeCompanion, { primary, companion: `${primary}${ATTENDABLE_PATH_SEPARATOR}comments` }),
106
107
  );
package/src/meta.ts CHANGED
@@ -4,10 +4,8 @@
4
4
 
5
5
  import { type PluginMeta } from '@dxos/app-framework';
6
6
 
7
- export const SHEET_PLUGIN = 'dxos.org/plugin/sheet';
8
-
9
7
  export const meta: PluginMeta = {
10
- id: SHEET_PLUGIN,
8
+ id: 'dxos.org/plugin/sheet',
11
9
  name: 'Sheet',
12
10
  description:
13
11
  'Sheets in Composer are simple spreadsheets which allow you to leverage custom functions inside of cell grids. Leverage more than 400 pre-built formulas like Sum, Average, Count, Max, Min along with many others. You can also deploy your own custom functions using the Scripts plugin. ',
@@ -23,7 +23,7 @@ import {
23
23
  } from '@dxos/compute';
24
24
  import { Resource } from '@dxos/context';
25
25
  import { Obj } from '@dxos/echo';
26
- import { FormatEnum, TypeEnum } from '@dxos/echo-schema';
26
+ import { FormatEnum, TypeEnum } from '@dxos/echo/internal';
27
27
  import { invariant } from '@dxos/invariant';
28
28
  import { PublicKey } from '@dxos/keys';
29
29
  import { log } from '@dxos/log';
@@ -6,6 +6,7 @@ import { type Decorator } from '@storybook/react';
6
6
  import React, { useState } from 'react';
7
7
 
8
8
  import { type ComputeGraph, type ComputeGraphOptions, ComputeGraphRegistry } from '@dxos/compute';
9
+ import { createMockedComputeRuntimeProvider } from '@dxos/compute/testing';
9
10
  import { type Space } from '@dxos/react-client/echo';
10
11
  import { useAsyncState } from '@dxos/react-hooks';
11
12
 
@@ -26,9 +27,14 @@ export const useTestSheet = (space?: Space, graph?: ComputeGraph, options?: Crea
26
27
  };
27
28
 
28
29
  export const withComputeGraphDecorator =
29
- (options?: ComputeGraphOptions): Decorator =>
30
+ (options?: Partial<ComputeGraphOptions>): Decorator =>
30
31
  (Story) => {
31
- const [registry] = useState(new ComputeGraphRegistry(options));
32
+ const [registry] = useState(
33
+ new ComputeGraphRegistry({
34
+ ...options,
35
+ computeRuntime: options?.computeRuntime ?? createMockedComputeRuntimeProvider(),
36
+ }),
37
+ );
32
38
  return (
33
39
  <ComputeGraphContextProvider registry={registry}>
34
40
  <Story />
@@ -2,7 +2,7 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
 
7
7
  import { Type } from '@dxos/echo';
8
8