@dxos/plugin-sheet 0.8.4-main.2e9d522 → 0.8.4-main.548089c

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 (209) hide show
  1. package/dist/lib/browser/{SheetContainer-KDGD4AVG.mjs → SheetContainer-BDLFSILO.mjs} +38 -40
  2. package/dist/lib/browser/SheetContainer-BDLFSILO.mjs.map +7 -0
  3. package/dist/lib/browser/anchor-sort-FCQ5OZZK.mjs +23 -0
  4. package/dist/lib/browser/anchor-sort-FCQ5OZZK.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-KJWZUQVA.mjs → chunk-73AV3NH6.mjs} +4 -4
  6. package/dist/lib/browser/chunk-73AV3NH6.mjs.map +7 -0
  7. package/dist/lib/browser/{chunk-JUOVL3LE.mjs → chunk-7KRJ2IT5.mjs} +218 -213
  8. package/dist/lib/browser/chunk-7KRJ2IT5.mjs.map +7 -0
  9. package/dist/lib/browser/{chunk-7HQX4NQP.mjs → chunk-7VEWYJJN.mjs} +2 -2
  10. package/dist/lib/browser/chunk-7VEWYJJN.mjs.map +7 -0
  11. package/dist/lib/browser/{chunk-SI4X5GUR.mjs → chunk-DVJ3QW3F.mjs} +220 -205
  12. package/dist/lib/browser/chunk-DVJ3QW3F.mjs.map +7 -0
  13. package/dist/lib/browser/chunk-FWFAAGXL.mjs +28 -0
  14. package/dist/lib/browser/chunk-FWFAAGXL.mjs.map +7 -0
  15. package/dist/lib/browser/compute-graph-registry-AP5RA7W3.mjs +21 -0
  16. package/dist/lib/browser/compute-graph-registry-AP5RA7W3.mjs.map +7 -0
  17. package/dist/lib/browser/index.mjs +20 -21
  18. package/dist/lib/browser/index.mjs.map +3 -3
  19. package/dist/lib/browser/{intent-resolver-WOJGZMSV.mjs → intent-resolver-66OAYVQF.mjs} +10 -10
  20. package/dist/lib/browser/intent-resolver-66OAYVQF.mjs.map +7 -0
  21. package/dist/lib/browser/{markdown-VXMIPUQC.mjs → markdown-B6VKYY2S.mjs} +6 -6
  22. package/dist/lib/browser/markdown-B6VKYY2S.mjs.map +7 -0
  23. package/dist/lib/browser/meta.json +1 -1
  24. package/dist/lib/browser/{react-surface-SE4HGAEH.mjs → react-surface-GXHVZHKU.mjs} +16 -15
  25. package/dist/lib/browser/react-surface-GXHVZHKU.mjs.map +7 -0
  26. package/dist/lib/browser/types/index.mjs +4 -12
  27. package/dist/lib/node-esm/{SheetContainer-RMG24NZC.mjs → SheetContainer-CK5HSJPL.mjs} +38 -40
  28. package/dist/lib/node-esm/SheetContainer-CK5HSJPL.mjs.map +7 -0
  29. package/dist/lib/node-esm/{anchor-sort-CTJGOPET.mjs → anchor-sort-ZE7IS7SH.mjs} +10 -11
  30. package/dist/lib/node-esm/anchor-sort-ZE7IS7SH.mjs.map +7 -0
  31. package/dist/lib/node-esm/{chunk-6SK5LJ5S.mjs → chunk-44YTKTMP.mjs} +4 -4
  32. package/dist/lib/node-esm/chunk-44YTKTMP.mjs.map +7 -0
  33. package/dist/lib/node-esm/{chunk-CADTJFAS.mjs → chunk-4H2EHVWE.mjs} +220 -205
  34. package/dist/lib/node-esm/chunk-4H2EHVWE.mjs.map +7 -0
  35. package/dist/lib/node-esm/{chunk-Q6UYC4G5.mjs → chunk-4QV4AGWK.mjs} +2 -2
  36. package/dist/lib/node-esm/chunk-4QV4AGWK.mjs.map +7 -0
  37. package/dist/lib/node-esm/chunk-HILDMVPL.mjs +29 -0
  38. package/dist/lib/node-esm/chunk-HILDMVPL.mjs.map +7 -0
  39. package/dist/lib/node-esm/{chunk-IFMIRCZH.mjs → chunk-SMYD6H7Q.mjs} +218 -213
  40. package/dist/lib/node-esm/chunk-SMYD6H7Q.mjs.map +7 -0
  41. package/dist/lib/node-esm/compute-graph-registry-UMQ5UYCL.mjs +22 -0
  42. package/dist/lib/node-esm/compute-graph-registry-UMQ5UYCL.mjs.map +7 -0
  43. package/dist/lib/node-esm/index.mjs +20 -21
  44. package/dist/lib/node-esm/index.mjs.map +3 -3
  45. package/dist/lib/node-esm/{intent-resolver-PZRXBNIJ.mjs → intent-resolver-VNKIMQQT.mjs} +10 -10
  46. package/dist/lib/node-esm/intent-resolver-VNKIMQQT.mjs.map +7 -0
  47. package/dist/lib/node-esm/{markdown-4VPQJZNZ.mjs → markdown-VKY7HXU2.mjs} +6 -6
  48. package/dist/lib/node-esm/markdown-VKY7HXU2.mjs.map +7 -0
  49. package/dist/lib/node-esm/meta.json +1 -1
  50. package/dist/lib/node-esm/{react-surface-LAU23XBH.mjs → react-surface-45L45WN6.mjs} +16 -15
  51. package/dist/lib/node-esm/react-surface-45L45WN6.mjs.map +7 -0
  52. package/dist/lib/node-esm/types/index.mjs +4 -12
  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 -4
  56. package/dist/types/src/capabilities/anchor-sort.d.ts.map +1 -1
  57. package/dist/types/src/capabilities/compute-graph-registry.d.ts +1 -1
  58. package/dist/types/src/capabilities/compute-graph-registry.d.ts.map +1 -1
  59. package/dist/types/src/capabilities/index.d.ts +5 -10
  60. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  61. package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
  62. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
  63. package/dist/types/src/capabilities/markdown.d.ts +1 -3
  64. package/dist/types/src/capabilities/markdown.d.ts.map +1 -1
  65. package/dist/types/src/capabilities/react-surface.d.ts +1 -1
  66. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  67. package/dist/types/src/components/ComputeGraph/ComputeGraphContextProvider.d.ts.map +1 -1
  68. package/dist/types/src/components/ComputeGraph/compute-graph.stories.d.ts +9 -4
  69. package/dist/types/src/components/ComputeGraph/compute-graph.stories.d.ts.map +1 -1
  70. package/dist/types/src/components/GridSheet/GridSheet.d.ts.map +1 -1
  71. package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts +50 -3
  72. package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +1 -1
  73. package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts +11 -20
  74. package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts.map +1 -1
  75. package/dist/types/src/components/GridSheet/util.d.ts +1 -1
  76. package/dist/types/src/components/GridSheet/util.d.ts.map +1 -1
  77. package/dist/types/src/components/RangeList/RangeList.d.ts +2 -2
  78. package/dist/types/src/components/RangeList/RangeList.d.ts.map +1 -1
  79. package/dist/types/src/components/SheetContainer/SheetContainer.d.ts +2 -2
  80. package/dist/types/src/components/SheetContainer/SheetContainer.d.ts.map +1 -1
  81. package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts +52 -5
  82. package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +1 -1
  83. package/dist/types/src/components/SheetContext/SheetContext.d.ts +3 -3
  84. package/dist/types/src/components/SheetContext/SheetContext.d.ts.map +1 -1
  85. package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts +3 -4
  86. package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts.map +1 -1
  87. package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts +86 -4
  88. package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts.map +1 -1
  89. package/dist/types/src/components/SheetToolbar/align.d.ts +2 -2
  90. package/dist/types/src/components/SheetToolbar/align.d.ts.map +1 -1
  91. package/dist/types/src/components/SheetToolbar/style.d.ts.map +1 -1
  92. package/dist/types/src/extensions/compute.d.ts +1 -1
  93. package/dist/types/src/extensions/compute.d.ts.map +1 -1
  94. package/dist/types/src/extensions/compute.stories.d.ts +10 -13
  95. package/dist/types/src/extensions/compute.stories.d.ts.map +1 -1
  96. package/dist/types/src/extensions/editor/index.d.ts +1 -1
  97. package/dist/types/src/extensions/editor/index.d.ts.map +1 -1
  98. package/dist/types/src/extensions/editor/{extension.d.ts → sheet-extension.d.ts} +1 -1
  99. package/dist/types/src/extensions/editor/sheet-extension.d.ts.map +1 -0
  100. package/dist/types/src/extensions/editor/sheet-extension.test.d.ts +2 -0
  101. package/dist/types/src/extensions/editor/sheet-extension.test.d.ts.map +1 -0
  102. package/dist/types/src/integrations/thread-ranges.d.ts.map +1 -1
  103. package/dist/types/src/meta.d.ts +0 -1
  104. package/dist/types/src/meta.d.ts.map +1 -1
  105. package/dist/types/src/model/sheet-model.d.ts +5 -5
  106. package/dist/types/src/model/sheet-model.d.ts.map +1 -1
  107. package/dist/types/src/model/testing.d.ts +2 -2
  108. package/dist/types/src/model/testing.d.ts.map +1 -1
  109. package/dist/types/src/model/useSheetModel.d.ts +2 -2
  110. package/dist/types/src/model/useSheetModel.d.ts.map +1 -1
  111. package/dist/types/src/playwright/sheet-manager.d.ts +1 -1
  112. package/dist/types/src/playwright/sheet-manager.d.ts.map +1 -1
  113. package/dist/types/src/serializer.d.ts +2 -2
  114. package/dist/types/src/serializer.d.ts.map +1 -1
  115. package/dist/types/src/testing/data.d.ts +2 -2
  116. package/dist/types/src/testing/data.d.ts.map +1 -1
  117. package/dist/types/src/testing/testing.d.ts +27 -3
  118. package/dist/types/src/testing/testing.d.ts.map +1 -1
  119. package/dist/types/src/translations.d.ts +2 -2
  120. package/dist/types/src/translations.d.ts.map +1 -1
  121. package/dist/types/src/types/{schema.d.ts → Sheet.d.ts} +37 -4
  122. package/dist/types/src/types/Sheet.d.ts.map +1 -0
  123. package/dist/types/src/types/index.d.ts +1 -1
  124. package/dist/types/src/types/index.d.ts.map +1 -1
  125. package/dist/types/src/types/sheet-range-types.d.ts +2 -2
  126. package/dist/types/src/types/sheet-range-types.d.ts.map +1 -1
  127. package/dist/types/src/types/types.d.ts +7 -16
  128. package/dist/types/src/types/types.d.ts.map +1 -1
  129. package/dist/types/src/types/util.d.ts +9 -10
  130. package/dist/types/src/types/util.d.ts.map +1 -1
  131. package/dist/types/tsconfig.tsbuildinfo +1 -1
  132. package/package.json +67 -64
  133. package/src/SheetPlugin.tsx +71 -62
  134. package/src/capabilities/anchor-sort.ts +7 -8
  135. package/src/capabilities/capabilities.ts +2 -2
  136. package/src/capabilities/compute-graph-registry.ts +9 -14
  137. package/src/capabilities/intent-resolver.ts +5 -5
  138. package/src/capabilities/markdown.ts +3 -2
  139. package/src/capabilities/react-surface.tsx +11 -9
  140. package/src/components/ComputeGraph/ComputeGraphContextProvider.tsx +1 -1
  141. package/src/components/ComputeGraph/compute-graph.stories.tsx +21 -20
  142. package/src/components/FunctionEditor/FunctionEditor.tsx +1 -1
  143. package/src/components/GridSheet/GridSheet.stories.tsx +19 -13
  144. package/src/components/GridSheet/GridSheet.tsx +39 -26
  145. package/src/components/GridSheet/SheetCellEditor.stories.tsx +40 -42
  146. package/src/components/GridSheet/util.ts +15 -9
  147. package/src/components/RangeList/RangeList.tsx +8 -8
  148. package/src/components/SheetContainer/SheetContainer.stories.tsx +48 -44
  149. package/src/components/SheetContainer/SheetContainer.tsx +10 -5
  150. package/src/components/SheetContext/SheetContext.tsx +5 -5
  151. package/src/components/SheetToolbar/SheetToolbar.stories.tsx +19 -13
  152. package/src/components/SheetToolbar/SheetToolbar.tsx +29 -30
  153. package/src/components/SheetToolbar/align.ts +7 -6
  154. package/src/components/SheetToolbar/style.ts +4 -4
  155. package/src/extensions/compute.stories.tsx +29 -25
  156. package/src/extensions/compute.ts +2 -3
  157. package/src/extensions/editor/index.ts +1 -1
  158. package/src/extensions/editor/{extension.test.ts → sheet-extension.test.ts} +1 -1
  159. package/src/integrations/thread-ranges.ts +15 -20
  160. package/src/meta.ts +7 -5
  161. package/src/model/sheet-model.test.ts +5 -4
  162. package/src/model/sheet-model.ts +9 -9
  163. package/src/model/testing.ts +4 -4
  164. package/src/model/useSheetModel.ts +2 -2
  165. package/src/playwright/sheet-manager.ts +1 -1
  166. package/src/playwright/sheet.spec.ts +1 -1
  167. package/src/sanity.test.ts +4 -5
  168. package/src/serializer.ts +3 -3
  169. package/src/testing/data.ts +2 -2
  170. package/src/testing/testing.tsx +11 -5
  171. package/src/translations.ts +2 -2
  172. package/src/types/Sheet.ts +103 -0
  173. package/src/types/index.ts +1 -1
  174. package/src/types/sheet-range-types.ts +2 -2
  175. package/src/types/types.ts +6 -15
  176. package/src/types/util.ts +13 -41
  177. package/dist/lib/browser/SheetContainer-KDGD4AVG.mjs.map +0 -7
  178. package/dist/lib/browser/anchor-sort-VHURGBOY.mjs +0 -24
  179. package/dist/lib/browser/anchor-sort-VHURGBOY.mjs.map +0 -7
  180. package/dist/lib/browser/chunk-6AKBCBL4.mjs +0 -18
  181. package/dist/lib/browser/chunk-6AKBCBL4.mjs.map +0 -7
  182. package/dist/lib/browser/chunk-7HQX4NQP.mjs.map +0 -7
  183. package/dist/lib/browser/chunk-JUOVL3LE.mjs.map +0 -7
  184. package/dist/lib/browser/chunk-KJWZUQVA.mjs.map +0 -7
  185. package/dist/lib/browser/chunk-SI4X5GUR.mjs.map +0 -7
  186. package/dist/lib/browser/compute-graph-registry-VG7VP7IV.mjs +0 -30
  187. package/dist/lib/browser/compute-graph-registry-VG7VP7IV.mjs.map +0 -7
  188. package/dist/lib/browser/intent-resolver-WOJGZMSV.mjs.map +0 -7
  189. package/dist/lib/browser/markdown-VXMIPUQC.mjs.map +0 -7
  190. package/dist/lib/browser/react-surface-SE4HGAEH.mjs.map +0 -7
  191. package/dist/lib/node-esm/SheetContainer-RMG24NZC.mjs.map +0 -7
  192. package/dist/lib/node-esm/anchor-sort-CTJGOPET.mjs.map +0 -7
  193. package/dist/lib/node-esm/chunk-3K5VNYOF.mjs +0 -20
  194. package/dist/lib/node-esm/chunk-3K5VNYOF.mjs.map +0 -7
  195. package/dist/lib/node-esm/chunk-6SK5LJ5S.mjs.map +0 -7
  196. package/dist/lib/node-esm/chunk-CADTJFAS.mjs.map +0 -7
  197. package/dist/lib/node-esm/chunk-IFMIRCZH.mjs.map +0 -7
  198. package/dist/lib/node-esm/chunk-Q6UYC4G5.mjs.map +0 -7
  199. package/dist/lib/node-esm/compute-graph-registry-3K3Q2A5T.mjs +0 -31
  200. package/dist/lib/node-esm/compute-graph-registry-3K3Q2A5T.mjs.map +0 -7
  201. package/dist/lib/node-esm/intent-resolver-PZRXBNIJ.mjs.map +0 -7
  202. package/dist/lib/node-esm/markdown-4VPQJZNZ.mjs.map +0 -7
  203. package/dist/lib/node-esm/react-surface-LAU23XBH.mjs.map +0 -7
  204. package/dist/types/src/extensions/editor/extension.d.ts.map +0 -1
  205. package/dist/types/src/extensions/editor/extension.test.d.ts +0 -2
  206. package/dist/types/src/extensions/editor/extension.test.d.ts.map +0 -1
  207. package/dist/types/src/types/schema.d.ts.map +0 -1
  208. package/src/types/schema.ts +0 -61
  209. /package/src/extensions/editor/{extension.ts → sheet-extension.ts} +0 -0
@@ -2,28 +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
- import { SheetToolbar } from './SheetToolbar';
13
10
  import { translations } from '../../translations';
14
11
 
12
+ import { SheetToolbar } from './SheetToolbar';
13
+
15
14
  const DefaultStory = () => {
16
- return <SheetToolbar id='test' />;
15
+ // TODO(wittjosiah): Depends on SheetProvider.
16
+ // return <SheetToolbar id='test' />;
17
+ return <>TODO</>;
17
18
  };
18
19
 
19
- export const Default = {};
20
-
21
- const meta: Meta = {
20
+ const meta = {
22
21
  title: 'plugins/plugin-sheet/Toolbar',
23
- component: SheetToolbar,
22
+ component: SheetToolbar as any,
24
23
  render: DefaultStory,
25
- decorators: [withTheme, withLayout()],
26
- parameters: { translations, layout: 'fullscreen' },
27
- };
24
+ decorators: [withTheme],
25
+ parameters: {
26
+ layout: 'fullscreen',
27
+ translations,
28
+ },
29
+ } satisfies Meta<typeof DefaultStory>;
28
30
 
29
31
  export default meta;
32
+
33
+ type Story = StoryObj<typeof meta>;
34
+
35
+ export const Default: Story = {};
@@ -2,60 +2,56 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Rx } from '@effect-rx/rx-react';
5
+ import { Atom } from '@effect-atom/atom-react';
6
6
  import React, { type PropsWithChildren, useMemo } from 'react';
7
7
 
8
- import { useAppGraph } from '@dxos/app-framework';
8
+ import { useAppGraph } from '@dxos/app-framework/react';
9
9
  import { type CompleteCellRange } from '@dxos/compute';
10
- import { type ThemedClassName } from '@dxos/react-ui';
11
10
  import {
12
- type ActionGraphEdges,
13
- type ActionGraphNodes,
14
11
  type ActionGraphProps,
15
- createGapSeparator,
16
12
  MenuProvider,
17
- rxFromSignal,
18
13
  ToolbarMenu,
14
+ createGapSeparator,
15
+ rxFromSignal,
19
16
  useMenuActions,
20
17
  } from '@dxos/react-ui-menu';
21
18
 
22
- import { createAlign, useAlignState } from './align';
23
- import { createStyle, useStyleState } from './style';
24
- import { type ToolbarState, useToolbarState } from './useToolbarState';
25
19
  import { type SheetModel } from '../../model';
26
20
  import { useSheetContext } from '../SheetContext';
27
21
 
28
- //
29
- // Root
30
- //
31
-
32
- export type SheetToolbarProps = ThemedClassName<PropsWithChildren<{ id: string }>>;
22
+ import { createAlign, useAlignState } from './align';
23
+ import { createStyle, useStyleState } from './style';
24
+ import { type ToolbarState, useToolbarState } from './useToolbarState';
33
25
 
34
26
  const createToolbarActions = (
35
27
  model: SheetModel,
36
28
  state: ToolbarState,
37
29
  cursorFallbackRange?: CompleteCellRange,
38
- customActions?: Rx.Rx<ActionGraphProps>,
39
- ) => {
40
- return Rx.make((get) => {
30
+ customActions?: Atom.Atom<ActionGraphProps>,
31
+ ): Atom.Atom<ActionGraphProps> => {
32
+ return Atom.make((get) => {
41
33
  const align = get(rxFromSignal(() => createAlign(model, state, cursorFallbackRange)));
42
34
  const style = get(rxFromSignal(() => createStyle(model, state, cursorFallbackRange)));
43
35
  const gap = createGapSeparator();
44
- const nodes: ActionGraphNodes = [...align.nodes, ...style.nodes, ...gap.nodes];
45
- const edges: ActionGraphEdges = [...align.edges, ...style.edges, ...gap.edges];
36
+
37
+ const graph: ActionGraphProps = {
38
+ nodes: [...align.nodes, ...style.nodes, ...gap.nodes],
39
+ edges: [...align.edges, ...style.edges, ...gap.edges],
40
+ };
41
+
46
42
  if (customActions) {
47
43
  const custom = get(customActions);
48
- nodes.push(...custom.nodes);
49
- edges.push(...custom.edges);
44
+ graph.nodes.push(...custom.nodes);
45
+ graph.edges.push(...custom.edges);
50
46
  }
51
- return {
52
- nodes,
53
- edges,
54
- };
47
+
48
+ return graph;
55
49
  });
56
50
  };
57
51
 
58
- export const SheetToolbar = ({ id, classNames }: SheetToolbarProps) => {
52
+ export type SheetToolbarProps = PropsWithChildren<{ id: string }>;
53
+
54
+ export const SheetToolbar = ({ id }: SheetToolbarProps) => {
59
55
  const { model, cursorFallbackRange } = useSheetContext();
60
56
  const state = useToolbarState({});
61
57
  useAlignState(state);
@@ -63,10 +59,13 @@ export const SheetToolbar = ({ id, classNames }: SheetToolbarProps) => {
63
59
 
64
60
  const { graph } = useAppGraph();
65
61
  const customActions = useMemo(() => {
66
- return Rx.make((get) => {
62
+ return Atom.make((get) => {
67
63
  const actions = get(graph.actions(id));
68
64
  const nodes = actions.filter((action) => action.properties.disposition === 'toolbar');
69
- return { nodes, edges: nodes.map((node) => ({ source: 'root', target: node.id })) };
65
+ return {
66
+ nodes,
67
+ edges: nodes.map((node) => ({ source: 'root', target: node.id })),
68
+ };
70
69
  });
71
70
  }, [graph]);
72
71
 
@@ -78,7 +77,7 @@ export const SheetToolbar = ({ id, classNames }: SheetToolbarProps) => {
78
77
 
79
78
  return (
80
79
  <MenuProvider {...menu} attendableId={id}>
81
- <ToolbarMenu classNames={classNames} />
80
+ <ToolbarMenu />
82
81
  </MenuProvider>
83
82
  );
84
83
  };
@@ -5,14 +5,15 @@
5
5
  import { useEffect } from 'react';
6
6
 
7
7
  import { type CompleteCellRange, inRange } from '@dxos/compute';
8
- import { createMenuAction, createMenuItemGroup, type ToolbarMenuActionGroupProperties } from '@dxos/react-ui-menu';
8
+ import { type ToolbarMenuActionGroupProperties, createMenuAction, createMenuItemGroup } from '@dxos/react-ui-menu';
9
9
 
10
- import { type ToolbarState } from './useToolbarState';
11
- import { SHEET_PLUGIN } from '../../meta';
10
+ import { meta } from '../../meta';
12
11
  import { type SheetModel } from '../../model';
13
- import { type AlignKey, alignKey, type AlignValue, rangeFromIndex, rangeToIndex } from '../../types';
12
+ import { type AlignKey, type AlignValue, alignKey, rangeFromIndex, rangeToIndex } from '../../types';
14
13
  import { useSheetContext } from '../SheetContext';
15
14
 
15
+ import { type ToolbarState } from './useToolbarState';
16
+
16
17
  export type AlignAction = { key: AlignKey; value: AlignValue };
17
18
 
18
19
  export type AlignState = { [alignKey]: AlignValue | undefined };
@@ -39,7 +40,7 @@ export const useAlignState = (state: Partial<AlignState>) => {
39
40
 
40
41
  const createAlignGroupAction = (value?: AlignValue) =>
41
42
  createMenuItemGroup('align', {
42
- label: ['align label', { ns: SHEET_PLUGIN }],
43
+ label: ['align label', { ns: meta.id }],
43
44
  variant: 'toggleGroup',
44
45
  selectCardinality: 'single',
45
46
  value: `${alignKey}--${value}`,
@@ -78,7 +79,7 @@ const createAlignActions = (model: SheetModel, state: ToolbarState, cursorFallba
78
79
  key: alignKey,
79
80
  value: alignValue as AlignValue,
80
81
  checked: state[alignKey] === alignValue,
81
- label: [`range value ${alignValue} label`, { ns: SHEET_PLUGIN }],
82
+ label: [`range value ${alignValue} label`, { ns: meta.id }],
82
83
  icon,
83
84
  testId: `grid.toolbar.${alignKey}.${alignValue}`,
84
85
  },
@@ -5,11 +5,11 @@
5
5
  import { useEffect } from 'react';
6
6
 
7
7
  import { type CompleteCellRange, inRange } from '@dxos/compute';
8
- import { createMenuAction, createMenuItemGroup, type ToolbarMenuActionGroupProperties } from '@dxos/react-ui-menu';
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
- import { rangeFromIndex, rangeToIndex, type StyleKey, type StyleValue } from '../../types';
12
+ import { type StyleKey, type StyleValue, rangeFromIndex, rangeToIndex } from '../../types';
13
13
  import { useSheetContext } from '../SheetContext';
14
14
 
15
15
  export type StyleState = Partial<Record<StyleValue, boolean>>;
@@ -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,14 +20,14 @@ import {
19
20
  documentId,
20
21
  useTextEditor,
21
22
  } from '@dxos/react-ui-editor';
22
- import { withTheme, withLayout } from '@dxos/storybook-utils';
23
23
  import { isNonNullable } from '@dxos/util';
24
24
 
25
- import { compute, computeGraphFacet } from './compute';
26
25
  import { GridSheet, SheetProvider, useComputeGraph } from '../components';
27
26
  import { useSheetModel } from '../model';
28
27
  import { useTestSheet, withComputeGraphDecorator } from '../testing';
29
- import { SheetType } from '../types';
28
+ import { Sheet } from '../types';
29
+
30
+ import { compute, computeGraphFacet } from './compute';
30
31
 
31
32
  const str = (...lines: string[]) => lines.join('\n');
32
33
 
@@ -41,7 +42,7 @@ type EditorProps = {
41
42
 
42
43
  const SHEET_NAME = 'Test Sheet';
43
44
 
44
- const EditorStory = ({ text }: EditorProps) => {
45
+ const DefaultStory = ({ text }: EditorProps) => {
45
46
  const id = useMemo(() => PublicKey.random(), []);
46
47
  const { themeMode } = useThemeContext();
47
48
  const space = useSpace();
@@ -51,7 +52,7 @@ const EditorStory = ({ text }: EditorProps) => {
51
52
  initialValue: text,
52
53
  extensions: [
53
54
  createBasicExtensions(),
54
- createMarkdownExtensions({ themeMode }),
55
+ createMarkdownExtensions(),
55
56
  createThemeExtensions({ themeMode, syntaxHighlighting: true }),
56
57
  documentId.of(id.toHex()),
57
58
  computeGraph && computeGraphFacet.of(computeGraph),
@@ -92,15 +93,31 @@ const Grid = () => {
92
93
  const GraphStory = (props: EditorProps) => {
93
94
  return (
94
95
  <div className='grid grid-rows-2'>
95
- <EditorStory {...props} />
96
+ <DefaultStory {...props} />
96
97
  <Grid />
97
98
  </div>
98
99
  );
99
100
  };
100
101
 
102
+ const meta = {
103
+ title: 'plugins/plugin-sheet/extensions',
104
+ decorators: [
105
+ withTheme,
106
+ withClientProvider({ types: [Sheet.Sheet], 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
+
101
118
  // TODO(burdon): Inline formulae.
102
- export const Default = {
103
- render: EditorStory,
119
+ export const Default: StoryObj<typeof DefaultStory> = {
120
+ render: DefaultStory,
104
121
  args: {
105
122
  text: str(
106
123
  //
@@ -123,7 +140,7 @@ export const Default = {
123
140
  },
124
141
  };
125
142
 
126
- export const Graph = {
143
+ export const Graph: StoryObj<typeof GraphStory> = {
127
144
  render: GraphStory,
128
145
  args: {
129
146
  text: str(
@@ -140,16 +157,3 @@ export const Graph = {
140
157
  ),
141
158
  },
142
159
  };
143
-
144
- const meta: Meta = {
145
- title: 'plugins/plugin-sheet/extensions',
146
- decorators: [
147
- withClientProvider({ types: [SheetType], createIdentity: true, createSpace: true }),
148
- withComputeGraphDecorator(),
149
- withTheme,
150
- withLayout({ fullscreen: true, classNames: 'justify-center' }),
151
- ],
152
- parameters: { layout: 'fullscreen' },
153
- };
154
-
155
- export default meta;
@@ -16,11 +16,11 @@ import { Decoration, EditorView, ViewPlugin, WidgetType } from '@codemirror/view
16
16
 
17
17
  import { type CleanupFn, debounce } from '@dxos/async';
18
18
  import {
19
- createSheetName,
20
19
  type CellAddress,
21
20
  type CellScalarValue,
22
21
  type ComputeGraph,
23
22
  type ComputeNode,
23
+ createSheetName,
24
24
  } from '@dxos/compute';
25
25
  import { invariant } from '@dxos/invariant';
26
26
  import { documentId, singleValueFacet } from '@dxos/react-ui-editor';
@@ -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,28 +2,23 @@
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
- import {
9
- createIntent,
10
- createResolver,
11
- LayoutAction,
12
- useIntentResolver,
13
- useIntentDispatcher,
14
- chain,
15
- } from '@dxos/app-framework';
9
+ import { LayoutAction, chain, createIntent, createResolver } from '@dxos/app-framework';
10
+ import { useIntentDispatcher, useIntentResolver } from '@dxos/app-framework/react';
16
11
  import { debounce } from '@dxos/async';
17
12
  import { type CellAddress, type CompleteCellRange, inRange } from '@dxos/compute';
18
13
  import { Obj, Relation } from '@dxos/echo';
19
14
  import { ATTENDABLE_PATH_SEPARATOR, DeckAction } from '@dxos/plugin-deck/types';
20
- import { ThreadAction, ThreadType } from '@dxos/plugin-thread/types';
21
- import { Filter, fullyQualifiedId, getSpace, Query, useQuery } from '@dxos/react-client/echo';
15
+ import { Thread, ThreadAction } from '@dxos/plugin-thread/types';
16
+ import { Filter, Query, getSpace, useQuery } from '@dxos/react-client/echo';
22
17
  import { type DxGridElement, type GridContentProps } from '@dxos/react-ui-grid';
23
- import { AnchoredTo } from '@dxos/schema';
18
+ import { AnchoredTo } from '@dxos/types';
24
19
 
25
20
  import { useSheetContext } from '../components';
26
- import { SHEET_PLUGIN } from '../meta';
21
+ import { meta } from '../meta';
27
22
 
28
23
  export const completeCellRangeToThreadCursor = (range: CompleteCellRange): string => {
29
24
  return `${range.from.col},${range.from.row},${range.to.col},${range.to.row}`;
@@ -60,7 +55,7 @@ export const useUpdateFocusedCellOnThreadSelection = (grid: DxGridElement | null
60
55
  return false;
61
56
  }
62
57
 
63
- return data.subject === fullyQualifiedId(model.sheet) && !!data.options?.cursor;
58
+ return data.subject === Obj.getDXN(model.sheet).toString() && !!data.options?.cursor;
64
59
  },
65
60
  resolve: ({ options: { cursor, ref } }) => {
66
61
  setActiveRefs(ref);
@@ -72,7 +67,7 @@ export const useUpdateFocusedCellOnThreadSelection = (grid: DxGridElement | null
72
67
  [model.sheet, setActiveRefs],
73
68
  );
74
69
 
75
- useIntentResolver(SHEET_PLUGIN, scrollIntoViewResolver);
70
+ useIntentResolver(meta.id, scrollIntoViewResolver);
76
71
  };
77
72
 
78
73
  export const useSelectThreadOnCellFocus = () => {
@@ -80,7 +75,7 @@ export const useSelectThreadOnCellFocus = () => {
80
75
  const { dispatchPromise: dispatch } = useIntentDispatcher();
81
76
 
82
77
  const space = getSpace(model.sheet);
83
- const anchors = useQuery(space, Query.select(Filter.ids(model.sheet.id)).targetOf(AnchoredTo));
78
+ const anchors = useQuery(space, Query.select(Filter.ids(model.sheet.id)).targetOf(AnchoredTo.AnchoredTo));
84
79
 
85
80
  const selectClosestThread = useCallback(
86
81
  (cellAddress: CellAddress) => {
@@ -90,7 +85,7 @@ export const useSelectThreadOnCellFocus = () => {
90
85
 
91
86
  const closestThread = anchors.find((anchor) => {
92
87
  const source = Relation.getSource(anchor);
93
- if (anchor.anchor && Obj.instanceOf(ThreadType, source)) {
88
+ if (anchor.anchor && Obj.instanceOf(Thread.Thread, source)) {
94
89
  const range = parseThreadAnchorAsCellRange(anchor.anchor);
95
90
  return range ? inRange(range, cellAddress) : false;
96
91
  } else {
@@ -99,9 +94,9 @@ export const useSelectThreadOnCellFocus = () => {
99
94
  });
100
95
 
101
96
  if (closestThread) {
102
- const primary = fullyQualifiedId(model.sheet);
103
- const intent = pipe(
104
- createIntent(ThreadAction.Select, { current: fullyQualifiedId(closestThread) }),
97
+ const primary = Obj.getDXN(model.sheet).toString();
98
+ const intent = Function.pipe(
99
+ createIntent(ThreadAction.Select, { current: Obj.getDXN(closestThread).toString() }),
105
100
  chain(DeckAction.ChangeCompanion, { primary, companion: `${primary}${ATTENDABLE_PATH_SEPARATOR}comments` }),
106
101
  );
107
102
  void dispatch(intent);
package/src/meta.ts CHANGED
@@ -3,15 +3,17 @@
3
3
  //
4
4
 
5
5
  import { type PluginMeta } from '@dxos/app-framework';
6
-
7
- export const SHEET_PLUGIN = 'dxos.org/plugin/sheet';
6
+ import { trim } from '@dxos/util';
8
7
 
9
8
  export const meta: PluginMeta = {
10
- id: SHEET_PLUGIN,
9
+ id: 'dxos.org/plugin/sheet',
11
10
  name: 'Sheet',
12
- description:
13
- 'Sheets in Composer are simple spreadsheets which allow you to leverage custom functions inside of cell grids. Leverage more than 400 pre-built formulas like Sum, Average, Count, Max, Min along with many others. You can also deploy your own custom functions using the Scripts plugin. ',
11
+ description: trim`
12
+ Full-featured spreadsheet application with over 400 built-in formulas for calculations and data analysis.
13
+ Create custom JavaScript functions and integrate with AI agents for advanced automation.
14
+ `,
14
15
  icon: 'ph--grid-nine--regular',
16
+ iconHue: 'indigo',
15
17
  source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-sheet',
16
18
  screenshots: ['https://dxos.network/plugin-details-sheet-dark.png'],
17
19
  };
@@ -7,17 +7,18 @@ 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 { FunctionType } from '@dxos/functions';
10
+ import { Function } from '@dxos/functions';
11
11
  import { log } from '@dxos/log';
12
12
 
13
+ import { Sheet, mapFormulaIndicesToRefs, mapFormulaRefsToIndices } from '../types';
14
+
13
15
  import { SheetModel } from './sheet-model';
14
16
  import { createTestGrid } from './testing';
15
- import { createSheet, mapFormulaIndicesToRefs, mapFormulaRefsToIndices } from '../types';
16
17
 
17
18
  describe('SheetModel', () => {
18
19
  let testBuilder: TestBuilder;
19
20
  beforeEach(async () => {
20
- testBuilder = new TestBuilder({ types: [FunctionType], plugins: testFunctionPlugins });
21
+ testBuilder = new TestBuilder({ types: [Function.Function], plugins: testFunctionPlugins });
21
22
  await testBuilder.open();
22
23
  });
23
24
  afterEach(async () => {
@@ -30,7 +31,7 @@ describe('SheetModel', () => {
30
31
  await graph.open();
31
32
 
32
33
  // TODO(burdon): Create via factory.
33
- const sheet = createSheet({ rows: 5, columns: 5 });
34
+ const sheet = Sheet.make({ rows: 5, columns: 5 });
34
35
  const model = new SheetModel(graph, sheet);
35
36
  await model.open();
36
37
  testBuilder.ctx.onDispose(() => model.close());
@@ -4,10 +4,6 @@
4
4
 
5
5
  import { Event } from '@dxos/async';
6
6
  import {
7
- addressFromA1Notation,
8
- addressToA1Notation,
9
- createSheetName,
10
- isFormula,
11
7
  type CellAddress,
12
8
  type CellRange,
13
9
  type CellScalarValue,
@@ -16,14 +12,18 @@ import {
16
12
  type ComputeNodeEvent,
17
13
  DetailedCellError,
18
14
  ExportedCellChange,
19
- type SimpleCellRange,
20
15
  type SimpleCellAddress,
16
+ type SimpleCellRange,
21
17
  type SimpleDate,
22
18
  type SimpleDateTime,
19
+ addressFromA1Notation,
20
+ addressToA1Notation,
21
+ createSheetName,
22
+ isFormula,
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';
@@ -39,7 +39,7 @@ import {
39
39
  mapFormulaIndicesToRefs,
40
40
  mapFormulaRefsToIndices,
41
41
  } from '../types';
42
- import { type SheetAction, type CellValue, type SheetType } from '../types';
42
+ import { type Sheet, type SheetAction } from '../types';
43
43
 
44
44
  // TODO(burdon): Move to compute.
45
45
  // Map sheet types to system types.
@@ -92,7 +92,7 @@ export class SheetModel extends Resource {
92
92
 
93
93
  constructor(
94
94
  private readonly _graph: ComputeGraph,
95
- private readonly _sheet: SheetType,
95
+ private readonly _sheet: Sheet.Sheet,
96
96
  private readonly _options: SheetModelOptions = {},
97
97
  ) {
98
98
  super();
@@ -414,7 +414,7 @@ export class SheetModel extends Resource {
414
414
  /**
415
415
  * Sets values from a simple map.
416
416
  */
417
- setValues(values: Record<string, CellValue>): void {
417
+ setValues(values: Record<string, Sheet.CellValue>): void {
418
418
  Object.entries(values).forEach(([key, { value }]) => {
419
419
  this.setValue(addressFromA1Notation(key), value);
420
420
  });
@@ -4,14 +4,14 @@
4
4
 
5
5
  import { addressToA1Notation } from '@dxos/compute';
6
6
 
7
- import { type CellValue, type SheetType, createSheet } from '../types';
7
+ import { Sheet } from '../types';
8
8
 
9
9
  // TODO(burdon): Create testing endpoint.
10
10
  // TODO(burdon): Move to react-ui-sheet.
11
- export const createTestGrid = ({ cols = 4, rows = 10 }: { cols: number; rows: number }): SheetType => {
11
+ export const createTestGrid = ({ cols = 4, rows = 10 }: { cols: number; rows: number }): Sheet.Sheet => {
12
12
  const year = new Date().getFullYear();
13
13
 
14
- const cells: Record<string, CellValue> = {};
14
+ const cells: Record<string, Sheet.CellValue> = {};
15
15
  for (let col = 1; col <= cols; col++) {
16
16
  for (let row = 1; row <= 10; row++) {
17
17
  const cell = addressToA1Notation({ col, row });
@@ -27,7 +27,7 @@ export const createTestGrid = ({ cols = 4, rows = 10 }: { cols: number; rows: nu
27
27
  }
28
28
  }
29
29
 
30
- const sheet = createSheet({
30
+ const sheet = Sheet.make({
31
31
  name: 'Test',
32
32
  cells,
33
33
  });
@@ -7,7 +7,7 @@ import { useEffect, useState } from 'react';
7
7
  import { type ComputeGraph } from '@dxos/compute';
8
8
 
9
9
  import { SheetModel } from '../model';
10
- import { type SheetType } from '../types';
10
+ import { type Sheet } from '../types';
11
11
 
12
12
  export type UseSheetModelOptions = {
13
13
  readonly?: boolean;
@@ -15,7 +15,7 @@ export type UseSheetModelOptions = {
15
15
 
16
16
  export const useSheetModel = (
17
17
  graph?: ComputeGraph,
18
- sheet?: SheetType,
18
+ sheet?: Sheet.Sheet,
19
19
  { readonly }: UseSheetModelOptions = {},
20
20
  ): SheetModel | undefined => {
21
21
  const [model, setModel] = useState<SheetModel>();
@@ -5,7 +5,7 @@
5
5
  import { type Locator, type Page } from '@playwright/test';
6
6
 
7
7
  import { DxGridManager } from '@dxos/lit-grid/testing';
8
- import { type DxGridPosition, type DxGridAxis } from '@dxos/react-ui-grid';
8
+ import { type DxGridAxis, type DxGridPosition } from '@dxos/react-ui-grid';
9
9
 
10
10
  /**
11
11
  * Test helper for managing dx-grid interactions and assertions in Playwright tests.
@@ -2,7 +2,7 @@
2
2
  // Copyright 2021 DXOS.org
3
3
  //
4
4
 
5
- import { expect, test, type Page } from '@playwright/test';
5
+ import { type Page, expect, test } from '@playwright/test';
6
6
 
7
7
  import { faker } from '@dxos/random';
8
8
  import { setupPage, storybookUrl } from '@dxos/test-utils/playwright';