@dxos/plugin-sheet 0.10.0 → 0.11.0

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 (227) hide show
  1. package/dist/lib/SheetPlugin.mjs +32 -0
  2. package/dist/lib/SheetPlugin.mjs.map +1 -0
  3. package/dist/lib/SheetPlugin.node.mjs +11 -0
  4. package/dist/lib/SheetPlugin.node.mjs.map +1 -0
  5. package/dist/lib/SheetPlugin.workerd.mjs +11 -0
  6. package/dist/lib/SheetPlugin.workerd.mjs.map +1 -0
  7. package/dist/lib/capabilities/node.mjs +10 -0
  8. package/dist/lib/capabilities/node.mjs.map +1 -0
  9. package/dist/lib/capabilities.mjs +16 -0
  10. package/dist/lib/capabilities.mjs.map +1 -0
  11. package/dist/lib/chunk-RangeList.mjs +47 -0
  12. package/dist/lib/chunk-RangeList.mjs.map +1 -0
  13. package/dist/lib/chunk-SheetArticle.mjs +58 -0
  14. package/dist/lib/chunk-SheetArticle.mjs.map +1 -0
  15. package/dist/lib/chunk-anchor-sort.mjs +18 -0
  16. package/dist/lib/chunk-anchor-sort.mjs.map +1 -0
  17. package/dist/lib/chunk-comment-config.mjs +18 -0
  18. package/dist/lib/chunk-comment-config.mjs.map +1 -0
  19. package/dist/lib/chunk-compute-graph-registry.mjs +24 -0
  20. package/dist/lib/chunk-compute-graph-registry.mjs.map +1 -0
  21. package/dist/lib/chunk-create-object.mjs +24 -0
  22. package/dist/lib/chunk-create-object.mjs.map +1 -0
  23. package/dist/lib/chunk-create.mjs +20 -0
  24. package/dist/lib/chunk-create.mjs.map +1 -0
  25. package/dist/lib/chunk-drop-axis.mjs +18 -0
  26. package/dist/lib/chunk-drop-axis.mjs.map +1 -0
  27. package/dist/lib/chunk-extensions.mjs +246 -0
  28. package/dist/lib/chunk-extensions.mjs.map +1 -0
  29. package/dist/lib/chunk-get-values.mjs +73 -0
  30. package/dist/lib/chunk-get-values.mjs.map +1 -0
  31. package/dist/lib/chunk-insert-axis.mjs +11 -0
  32. package/dist/lib/chunk-insert-axis.mjs.map +1 -0
  33. package/dist/lib/chunk-markdown-extension.mjs +22 -0
  34. package/dist/lib/chunk-markdown-extension.mjs.map +1 -0
  35. package/dist/lib/{neutral/chunk-WTSCOM64.mjs → chunk-meta.mjs} +20 -28
  36. package/dist/lib/chunk-meta.mjs.map +1 -0
  37. package/dist/lib/chunk-operation-handler.mjs +11 -0
  38. package/dist/lib/chunk-operation-handler.mjs.map +1 -0
  39. package/dist/lib/chunk-react-surface.mjs +27 -0
  40. package/dist/lib/chunk-react-surface.mjs.map +1 -0
  41. package/dist/lib/chunk-restore-axis.mjs +11 -0
  42. package/dist/lib/chunk-restore-axis.mjs.map +1 -0
  43. package/dist/lib/chunk-scroll-to-anchor.mjs +20 -0
  44. package/dist/lib/chunk-scroll-to-anchor.mjs.map +1 -0
  45. package/dist/lib/chunk-set-values.mjs +20 -0
  46. package/dist/lib/chunk-set-values.mjs.map +1 -0
  47. package/dist/lib/{neutral/skill-definition-U3KQCFOI.mjs → chunk-skill-definition.mjs} +6 -8
  48. package/dist/lib/chunk-skill-definition.mjs.map +1 -0
  49. package/dist/lib/chunk-state.mjs +27 -0
  50. package/dist/lib/chunk-state.mjs.map +1 -0
  51. package/dist/lib/chunk-thread-ranges.mjs +59 -0
  52. package/dist/lib/chunk-thread-ranges.mjs.map +1 -0
  53. package/dist/lib/chunk-types.mjs +355 -0
  54. package/dist/lib/chunk-types.mjs.map +1 -0
  55. package/dist/lib/chunk-undo-mappings.mjs +22 -0
  56. package/dist/lib/chunk-undo-mappings.mjs.map +1 -0
  57. package/dist/lib/components.mjs +1377 -0
  58. package/dist/lib/components.mjs.map +1 -0
  59. package/dist/lib/containers.mjs +8 -0
  60. package/dist/lib/containers.mjs.map +1 -0
  61. package/dist/lib/index.mjs +4 -0
  62. package/dist/lib/meta.mjs +2 -0
  63. package/dist/lib/operations/node.mjs +7 -0
  64. package/dist/lib/operations/node.mjs.map +1 -0
  65. package/dist/lib/operations.mjs +7 -0
  66. package/dist/lib/operations.mjs.map +1 -0
  67. package/dist/lib/plugin.mjs +9 -0
  68. package/dist/lib/plugin.mjs.map +1 -0
  69. package/dist/lib/skills.mjs +42 -0
  70. package/dist/lib/skills.mjs.map +1 -0
  71. package/dist/lib/testing.mjs +59 -0
  72. package/dist/lib/testing.mjs.map +1 -0
  73. package/dist/lib/translations.mjs +50 -0
  74. package/dist/lib/translations.mjs.map +1 -0
  75. package/dist/lib/types.mjs +2 -0
  76. package/dist/types/src/capabilities/anchor-sort.d.ts +1 -1
  77. package/dist/types/src/capabilities/compute-graph-registry.d.ts +1 -1
  78. package/dist/types/src/capabilities/create-object.d.ts +1 -1
  79. package/dist/types/src/capabilities/markdown-extension.d.ts +1 -1
  80. package/dist/types/src/capabilities/node.d.ts +7 -0
  81. package/dist/types/src/capabilities/node.d.ts.map +1 -0
  82. package/dist/types/src/capabilities/operation-handler.d.ts +1 -1
  83. package/dist/types/src/capabilities/react-surface.d.ts +1 -1
  84. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  85. package/dist/types/src/capabilities/skill-definition.d.ts +1 -1
  86. package/dist/types/src/capabilities/state.d.ts +1 -1
  87. package/dist/types/src/capabilities/undo-mappings.d.ts +1 -1
  88. package/dist/types/src/components/ComputeGraph/ComputeGraphContext.d.ts +11 -0
  89. package/dist/types/src/components/ComputeGraph/ComputeGraphContext.d.ts.map +1 -0
  90. package/dist/types/src/components/ComputeGraph/ComputeGraphContextProvider.d.ts +1 -10
  91. package/dist/types/src/components/ComputeGraph/ComputeGraphContextProvider.d.ts.map +1 -1
  92. package/dist/types/src/components/ComputeGraph/index.d.ts +1 -0
  93. package/dist/types/src/components/ComputeGraph/index.d.ts.map +1 -1
  94. package/dist/types/src/components/Sheet/Sheet.d.ts +4 -4
  95. package/dist/types/src/components/Sheet/Sheet.d.ts.map +1 -1
  96. package/dist/types/src/components/SheetContent/SheetContent.d.ts +1 -1
  97. package/dist/types/src/components/SheetContent/SheetContent.d.ts.map +1 -1
  98. package/dist/types/src/components/SheetContent/SheetContent.stories.d.ts +1 -1
  99. package/dist/types/src/components/SheetRoot/SheetContext.d.ts +4 -0
  100. package/dist/types/src/components/SheetRoot/SheetContext.d.ts.map +1 -0
  101. package/dist/types/src/components/SheetRoot/SheetRoot.d.ts +0 -1
  102. package/dist/types/src/components/SheetRoot/SheetRoot.d.ts.map +1 -1
  103. package/dist/types/src/components/SheetRoot/index.d.ts +1 -0
  104. package/dist/types/src/components/SheetRoot/index.d.ts.map +1 -1
  105. package/dist/types/src/components/SheetStatusbar/SheetStatusbar.d.ts +1 -1
  106. package/dist/types/src/components/SheetStatusbar/SheetStatusbar.d.ts.map +1 -1
  107. package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts +1 -1
  108. package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts.map +1 -1
  109. package/dist/types/src/components/index.d.ts +1 -0
  110. package/dist/types/src/components/index.d.ts.map +1 -1
  111. package/dist/types/src/containers/RangeList/RangeList.d.ts +4 -1
  112. package/dist/types/src/containers/RangeList/RangeList.d.ts.map +1 -1
  113. package/dist/types/src/containers/SheetArticle/SheetArticle.d.ts +4 -5
  114. package/dist/types/src/containers/SheetArticle/SheetArticle.d.ts.map +1 -1
  115. package/dist/types/src/containers/SheetArticle/SheetArticle.stories.d.ts +4 -1
  116. package/dist/types/src/containers/SheetArticle/SheetArticle.stories.d.ts.map +1 -1
  117. package/dist/types/src/extensions/editor/sheet-extension.d.ts.map +1 -1
  118. package/dist/types/src/operations/node.d.ts +3 -0
  119. package/dist/types/src/operations/node.d.ts.map +1 -0
  120. package/dist/types/src/operations/scroll-to-anchor.d.ts.map +1 -1
  121. package/dist/types/src/plugin.d.ts +1 -1
  122. package/dist/types/src/plugin.d.ts.map +1 -1
  123. package/dist/types/src/testing/testing.d.ts +8 -2
  124. package/dist/types/src/testing/testing.d.ts.map +1 -1
  125. package/dist/types/src/types/SheetOperation.d.ts +1 -1
  126. package/dist/types/src/types/SheetOperation.d.ts.map +1 -1
  127. package/dist/types/tsconfig.tsbuildinfo +1 -1
  128. package/dx.config.ts +1 -0
  129. package/package.json +75 -67
  130. package/src/capabilities/node.ts +18 -0
  131. package/src/capabilities/{react-surface.tsx → react-surface.ts} +6 -18
  132. package/src/components/ComputeGraph/ComputeGraphContext.ts +35 -0
  133. package/src/components/ComputeGraph/ComputeGraphContextProvider.tsx +2 -27
  134. package/src/components/ComputeGraph/compute-graph.stories.tsx +1 -1
  135. package/src/components/ComputeGraph/index.ts +2 -0
  136. package/src/components/Sheet/Sheet.tsx +1 -1
  137. package/src/components/SheetRoot/SheetContext.ts +19 -0
  138. package/src/components/SheetRoot/SheetRoot.tsx +2 -9
  139. package/src/components/SheetRoot/index.ts +2 -0
  140. package/src/components/SheetStatusbar/SheetStatusbar.tsx +1 -1
  141. package/src/components/SheetToolbar/SheetToolbar.tsx +9 -9
  142. package/src/components/index.ts +1 -0
  143. package/src/containers/RangeList/RangeList.tsx +2 -0
  144. package/src/containers/SheetArticle/SheetArticle.stories.tsx +15 -24
  145. package/src/containers/SheetArticle/SheetArticle.tsx +23 -11
  146. package/src/extensions/editor/sheet-extension.ts +61 -2
  147. package/src/integrations/thread-ranges.ts +4 -4
  148. package/src/operations/node.ts +18 -0
  149. package/src/operations/scroll-to-anchor.ts +3 -2
  150. package/src/plugin.ts +1 -1
  151. package/src/testing/testing.tsx +11 -5
  152. package/src/types/SheetOperation.ts +6 -2
  153. package/dist/lib/neutral/RangeList-EIJTFS7P.mjs +0 -53
  154. package/dist/lib/neutral/RangeList-EIJTFS7P.mjs.map +0 -7
  155. package/dist/lib/neutral/SheetArticle-IUPQYGUU.mjs +0 -34
  156. package/dist/lib/neutral/SheetArticle-IUPQYGUU.mjs.map +0 -7
  157. package/dist/lib/neutral/SheetPlugin.mjs +0 -61
  158. package/dist/lib/neutral/SheetPlugin.mjs.map +0 -7
  159. package/dist/lib/neutral/SheetPlugin.node.mjs +0 -27
  160. package/dist/lib/neutral/SheetPlugin.node.mjs.map +0 -7
  161. package/dist/lib/neutral/SheetPlugin.workerd.mjs +0 -21
  162. package/dist/lib/neutral/SheetPlugin.workerd.mjs.map +0 -7
  163. package/dist/lib/neutral/anchor-sort-2POWTKTD.mjs +0 -22
  164. package/dist/lib/neutral/anchor-sort-2POWTKTD.mjs.map +0 -7
  165. package/dist/lib/neutral/capabilities/index.mjs +0 -27
  166. package/dist/lib/neutral/capabilities/index.mjs.map +0 -7
  167. package/dist/lib/neutral/chunk-ERHMBRSU.mjs +0 -234
  168. package/dist/lib/neutral/chunk-ERHMBRSU.mjs.map +0 -7
  169. package/dist/lib/neutral/chunk-HEN74ZWI.mjs +0 -83
  170. package/dist/lib/neutral/chunk-HEN74ZWI.mjs.map +0 -7
  171. package/dist/lib/neutral/chunk-HY4DM35G.mjs +0 -466
  172. package/dist/lib/neutral/chunk-HY4DM35G.mjs.map +0 -7
  173. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +0 -10
  174. package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +0 -7
  175. package/dist/lib/neutral/chunk-TDGEOMRG.mjs +0 -8
  176. package/dist/lib/neutral/chunk-TDGEOMRG.mjs.map +0 -7
  177. package/dist/lib/neutral/chunk-WTSCOM64.mjs.map +0 -7
  178. package/dist/lib/neutral/comment-config-4CIQFYM2.mjs +0 -22
  179. package/dist/lib/neutral/comment-config-4CIQFYM2.mjs.map +0 -7
  180. package/dist/lib/neutral/components/index.mjs +0 -1552
  181. package/dist/lib/neutral/components/index.mjs.map +0 -7
  182. package/dist/lib/neutral/compute-graph-registry-YYINTFC2.mjs +0 -26
  183. package/dist/lib/neutral/compute-graph-registry-YYINTFC2.mjs.map +0 -7
  184. package/dist/lib/neutral/containers/index.mjs +0 -11
  185. package/dist/lib/neutral/containers/index.mjs.map +0 -7
  186. package/dist/lib/neutral/create-I3TKMPQO.mjs +0 -30
  187. package/dist/lib/neutral/create-I3TKMPQO.mjs.map +0 -7
  188. package/dist/lib/neutral/create-object-5WEY5XZJ.mjs +0 -27
  189. package/dist/lib/neutral/create-object-5WEY5XZJ.mjs.map +0 -7
  190. package/dist/lib/neutral/drop-axis-JPFU5CJO.mjs +0 -23
  191. package/dist/lib/neutral/drop-axis-JPFU5CJO.mjs.map +0 -7
  192. package/dist/lib/neutral/get-values-7YWQTH65.mjs +0 -92
  193. package/dist/lib/neutral/get-values-7YWQTH65.mjs.map +0 -7
  194. package/dist/lib/neutral/index.mjs +0 -66
  195. package/dist/lib/neutral/index.mjs.map +0 -7
  196. package/dist/lib/neutral/insert-axis-WD6ZC3UA.mjs +0 -16
  197. package/dist/lib/neutral/insert-axis-WD6ZC3UA.mjs.map +0 -7
  198. package/dist/lib/neutral/markdown-extension-HTJDICGT.mjs +0 -28
  199. package/dist/lib/neutral/markdown-extension-HTJDICGT.mjs.map +0 -7
  200. package/dist/lib/neutral/meta.json +0 -1
  201. package/dist/lib/neutral/meta.mjs +0 -8
  202. package/dist/lib/neutral/meta.mjs.map +0 -7
  203. package/dist/lib/neutral/operation-handler-TB6LFV2H.mjs +0 -13
  204. package/dist/lib/neutral/operation-handler-TB6LFV2H.mjs.map +0 -7
  205. package/dist/lib/neutral/operations/index.mjs +0 -8
  206. package/dist/lib/neutral/operations/index.mjs.map +0 -7
  207. package/dist/lib/neutral/plugin.mjs +0 -16
  208. package/dist/lib/neutral/plugin.mjs.map +0 -7
  209. package/dist/lib/neutral/react-surface-TJT6F2E4.mjs +0 -40
  210. package/dist/lib/neutral/react-surface-TJT6F2E4.mjs.map +0 -7
  211. package/dist/lib/neutral/restore-axis-RLPX7P3G.mjs +0 -16
  212. package/dist/lib/neutral/restore-axis-RLPX7P3G.mjs.map +0 -7
  213. package/dist/lib/neutral/scroll-to-anchor-6FJJQWZC.mjs +0 -33
  214. package/dist/lib/neutral/scroll-to-anchor-6FJJQWZC.mjs.map +0 -7
  215. package/dist/lib/neutral/set-values-5DVOVLJH.mjs +0 -30
  216. package/dist/lib/neutral/set-values-5DVOVLJH.mjs.map +0 -7
  217. package/dist/lib/neutral/skill-definition-U3KQCFOI.mjs.map +0 -7
  218. package/dist/lib/neutral/state-HPA27MX2.mjs +0 -29
  219. package/dist/lib/neutral/state-HPA27MX2.mjs.map +0 -7
  220. package/dist/lib/neutral/testing/index.mjs +0 -103
  221. package/dist/lib/neutral/testing/index.mjs.map +0 -7
  222. package/dist/lib/neutral/translations.mjs +0 -56
  223. package/dist/lib/neutral/translations.mjs.map +0 -7
  224. package/dist/lib/neutral/types/index.mjs +0 -58
  225. package/dist/lib/neutral/types/index.mjs.map +0 -7
  226. package/dist/lib/neutral/undo-mappings-O75AYIRG.mjs +0 -31
  227. package/dist/lib/neutral/undo-mappings-O75AYIRG.mjs.map +0 -7
@@ -4,28 +4,38 @@
4
4
 
5
5
  import React from 'react';
6
6
 
7
+ import { useCapability } from '@dxos/app-framework/ui';
7
8
  import { AppSurface } from '@dxos/app-toolkit/ui';
8
- import { type ComputeGraphRegistry } from '@dxos/compute-hyperformula';
9
- import { type Space } from '@dxos/react-client/echo';
9
+ import { type Space, getSpace } from '@dxos/react-client/echo';
10
10
  import { Panel } from '@dxos/react-ui';
11
11
 
12
12
  import { ComputeGraphContextProvider, Sheet, useComputeGraph } from '#components';
13
- import { type Sheet as SheetType } from '#types';
13
+ import { SheetCapabilities, type Sheet as SheetType } from '#types';
14
14
 
15
15
  export type SheetArticleProps = AppSurface.ObjectArticleProps<
16
16
  SheetType.Sheet,
17
17
  {
18
- space: Space;
19
- registry: ComputeGraphRegistry;
20
18
  ignoreAttention?: boolean;
21
19
  }
22
20
  >;
23
21
 
24
- export const SheetArticle = ({ registry, ...props }: SheetArticleProps) => (
25
- <ComputeGraphContextProvider registry={registry}>
26
- <SheetArticleInner {...props} />
27
- </ComputeGraphContextProvider>
28
- );
22
+ /**
23
+ * Resolves the compute-graph registry capability and the sheet's space, then scopes the article to
24
+ * that registry. A sheet outside a space has no graph to evaluate against.
25
+ */
26
+ export const SheetArticle = ({ subject, ...props }: SheetArticleProps) => {
27
+ const registry = useCapability(SheetCapabilities.ComputeGraphRegistry);
28
+ const space = getSpace(subject);
29
+ if (!space) {
30
+ return null;
31
+ }
32
+
33
+ return (
34
+ <ComputeGraphContextProvider registry={registry}>
35
+ <SheetArticleInner {...props} subject={subject} space={space} />
36
+ </ComputeGraphContextProvider>
37
+ );
38
+ };
29
39
 
30
40
  const SheetArticleInner = ({
31
41
  role,
@@ -33,7 +43,7 @@ const SheetArticleInner = ({
33
43
  attendableId,
34
44
  space,
35
45
  ignoreAttention,
36
- }: Omit<SheetArticleProps, 'registry'>) => {
46
+ }: SheetArticleProps & { space: Space }) => {
37
47
  const graph = useComputeGraph(space);
38
48
  if (!graph) {
39
49
  return null;
@@ -55,3 +65,5 @@ const SheetArticleInner = ({
55
65
  </Sheet.Root>
56
66
  );
57
67
  };
68
+
69
+ SheetArticle.displayName = 'SheetArticle';
@@ -161,16 +161,20 @@ export const sheetExtension = ({ debug, functions = [] }: SheetExtensionOptions)
161
161
  }),
162
162
 
163
163
  syntaxHighlighting(highlightStyles),
164
+ anchorCompletionTooltip,
164
165
  autocompletion({
165
166
  aboveCursor: false,
166
167
  defaultKeymap: true,
167
168
  activateOnTyping: true,
168
169
  closeOnBlur: !debug,
169
170
  icons: false,
171
+ // Cosmetics only. The tooltip is `position: fixed` and CodeMirror computes its coordinates from
172
+ // the cursor, so overriding `left`/`top` here measures them against the viewport instead of the
173
+ // cell — which pinned the completion list to the top-left corner of the window.
170
174
  tooltipClass: () =>
171
175
  mx(
172
- '!-left-[1px] !top-[33px] !-m-0 border border-h-0! [&>ul]:!min-w-[198px]',
173
- '[&>ul>li[aria-selected]]:!bg-accent-bg',
176
+ '-m-0! border border-h-0! [&>ul]:min-w-[198px]!',
177
+ '[&>ul>li[aria-selected]]:bg-accent-bg!',
174
178
  'border-separator',
175
179
  ),
176
180
  }),
@@ -311,3 +315,58 @@ const visitTree = (node: SyntaxNode, callback: (node: SyntaxNode) => boolean): b
311
315
 
312
316
  return false;
313
317
  };
318
+
319
+ /**
320
+ * Pins the completion tooltip to the editing cell rather than to the cursor.
321
+ *
322
+ * CodeMirror anchors it at the completion's start offset — a few pixels in from the cell's edge, and
323
+ * further in the longer the expression before the function name — overlapping the cell's lower
324
+ * border. In a grid the cell is the meaningful anchor.
325
+ *
326
+ * Driven by a DOM observer rather than the plugin's `update`: CodeMirror creates and positions the
327
+ * tooltip in its measure phase, which runs *after* the update, so an update-time correction either
328
+ * finds no tooltip or is immediately overwritten. Which side it opens on is still CodeMirror's call,
329
+ * so a tooltip near the bottom of the window still flips above the cell.
330
+ */
331
+ const anchorCompletionTooltip = ViewPlugin.fromClass(
332
+ class {
333
+ private readonly _observer = new MutationObserver(() => this._pin());
334
+
335
+ constructor(private readonly _view: EditorView) {
336
+ this._observer.observe(_view.dom, {
337
+ childList: true,
338
+ subtree: true,
339
+ attributes: true,
340
+ attributeFilter: ['style', 'class'],
341
+ });
342
+ }
343
+
344
+ destroy(): void {
345
+ this._observer.disconnect();
346
+ }
347
+
348
+ /** Idempotent: writing values it already holds would retrigger the observer. */
349
+ private _pin(): void {
350
+ const tooltip = this._view.dom.querySelector<HTMLElement>('.cm-tooltip-autocomplete');
351
+ if (!tooltip) {
352
+ return;
353
+ }
354
+
355
+ // The cell editor's own box, not `view.dom` — the editor sits inset within it.
356
+ const cell = (this._view.dom.closest('.dx-grid__cell-editor') ?? this._view.dom).getBoundingClientRect();
357
+ const left = cell.left;
358
+ const top = tooltip.classList.contains('cm-tooltip-below')
359
+ ? cell.bottom
360
+ : cell.top - tooltip.getBoundingClientRect().height;
361
+ if (
362
+ Math.abs(Number.parseFloat(tooltip.style.left || '0') - left) < 0.5 &&
363
+ Math.abs(Number.parseFloat(tooltip.style.top || '0') - top) < 0.5
364
+ ) {
365
+ return;
366
+ }
367
+
368
+ tooltip.style.left = `${left}px`;
369
+ tooltip.style.top = `${top}px`;
370
+ }
371
+ },
372
+ );
@@ -9,9 +9,9 @@ import { LayoutOperation } from '@dxos/app-toolkit';
9
9
  import { debounce } from '@dxos/async';
10
10
  import { type CellAddress, type CompleteCellRange, inRange } from '@dxos/compute-hyperformula';
11
11
  import { Filter, Obj, Query, Relation } from '@dxos/echo';
12
- import { CommentOperation } from '@dxos/plugin-comments/types';
13
- import { useQuery } from '@dxos/react-client/echo';
14
- import { linkedSegment } from '@dxos/react-ui-attention';
12
+ import { useQuery } from '@dxos/echo-react';
13
+ import { CommentOperation } from '@dxos/plugin-review/types';
14
+ import { Attention } from '@dxos/react-ui-attention';
15
15
  import { AnchoredTo, Thread } from '@dxos/types';
16
16
 
17
17
  import { useSheetContext } from '#components';
@@ -60,7 +60,7 @@ export const useSelectThreadOnCellFocus = () => {
60
60
  void (async () => {
61
61
  await invokePromise(CommentOperation.Select, { current: Relation.getURI(closestThread) });
62
62
  await invokePromise(LayoutOperation.UpdateCompanion, {
63
- subject: linkedSegment('comments'),
63
+ subject: Attention.linkedSegment('comments'),
64
64
  });
65
65
  })();
66
66
  }
@@ -0,0 +1,18 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ import { OperationHandlerSet } from '@dxos/compute';
6
+
7
+ // The operations `SheetPlugin.node` can serve, and only those. `scroll-to-anchor` drives a live
8
+ // editor view, so it is browser-only — and `OperationHandlerSet.lazy` defers the import at runtime
9
+ // without stopping a bundler walking into the React surface behind it.
10
+
11
+ export const SheetOperationHandlerSet = OperationHandlerSet.lazy(
12
+ () => import('./create'),
13
+ () => import('./drop-axis'),
14
+ () => import('./get-values'),
15
+ () => import('./insert-axis'),
16
+ () => import('./restore-axis'),
17
+ () => import('./set-values'),
18
+ );
@@ -12,13 +12,14 @@ import { SheetCapabilities, SheetOperation } from '../types';
12
12
 
13
13
  const handler: Operation.WithHandler<typeof SheetOperation.ScrollToAnchor> = SheetOperation.ScrollToAnchor.pipe(
14
14
  Operation.withHandler(
15
- Effect.fnUntraced(function* ({ subject, cursor, ref }) {
15
+ Effect.fnUntraced(function* ({ subject, cursor, id }) {
16
16
  const gridInstances = yield* Capability.get(SheetCapabilities.GridInstances);
17
17
  const entry = gridInstances.get(subject);
18
18
  if (!entry) {
19
19
  return;
20
20
  }
21
- entry.setActiveRefs(ref);
21
+
22
+ entry.setActiveRefs(id);
22
23
  const range = parseThreadAnchorAsCellRange(cursor);
23
24
  if (range) {
24
25
  entry.grid.setFocus({ ...range.to, plane: 'grid' }, true);
package/src/plugin.ts CHANGED
@@ -8,4 +8,4 @@ import { meta } from './meta';
8
8
 
9
9
  export const SheetPlugin = Plugin.lazy(meta, () => import('#plugin'));
10
10
 
11
- export { SheetOperationHandlerSet } from './operations';
11
+ export { SheetOperationHandlerSet } from '#operations';
@@ -26,14 +26,20 @@ export const useTestSheet = (space?: Space, graph?: ComputeGraph, options?: Shee
26
26
  return sheet;
27
27
  };
28
28
 
29
+ /**
30
+ * Provides the compute-graph context. Pass `registry` when the story also contributes it as the
31
+ * `ComputeGraphRegistry` capability, so the context and the capability share one instance.
32
+ */
29
33
  export const withComputeGraphDecorator =
30
- (options?: Partial<ComputeGraphOptions>): Decorator =>
34
+ (options?: Partial<ComputeGraphOptions> & { registry?: ComputeGraphRegistry }): Decorator =>
31
35
  (Story) => {
32
36
  const [registry] = useState(
33
- new ComputeGraphRegistry({
34
- ...options,
35
- computeRuntime: options?.computeRuntime ?? createMockedComputeRuntimeProvider(),
36
- }),
37
+ () =>
38
+ options?.registry ??
39
+ new ComputeGraphRegistry({
40
+ ...options,
41
+ computeRuntime: options?.computeRuntime ?? createMockedComputeRuntimeProvider(),
42
+ }),
37
43
  );
38
44
  return (
39
45
  <ComputeGraphContextProvider registry={registry}>
@@ -42,7 +42,11 @@ export const DropAxisOutput = Schema.Struct({
42
42
  export type DropAxisOutput = Schema.Schema.Type<typeof DropAxisOutput>;
43
43
 
44
44
  export const DropAxis = Operation.make({
45
- meta: { key: makeKey('axisDrop'), name: 'Drop Axis', icon: 'ph--trash--regular' },
45
+ meta: {
46
+ key: makeKey('axisDrop'),
47
+ name: 'Drop Axis',
48
+ icon: 'ph--trash--regular',
49
+ },
46
50
  input: Schema.Struct({
47
51
  model: Schema.Any,
48
52
  axis: Axis,
@@ -61,7 +65,7 @@ export const ScrollToAnchor = Operation.make({
61
65
  input: Schema.Struct({
62
66
  subject: Schema.String.annotations({ description: 'Attendable ID of the sheet.' }),
63
67
  cursor: Schema.String.annotations({ description: 'Cell range coordinates.' }),
64
- ref: Schema.optional(Schema.Any.annotations({ description: 'Active refs for highlighting.' })),
68
+ id: Schema.optional(Schema.Any.annotations({ description: 'Active refs for highlighting.' })),
65
69
  }),
66
70
  output: Schema.Void,
67
71
  });
@@ -1,53 +0,0 @@
1
- import "./chunk-J5LGTIGS.mjs";
2
-
3
- // src/containers/RangeList/RangeList.tsx
4
- import * as Schema from "effect/Schema";
5
- import React, { useCallback } from "react";
6
- import { rangeToA1Notation } from "@dxos/compute-hyperformula";
7
- import { useObject } from "@dxos/echo-react";
8
- import { Input, Message, useTranslation } from "@dxos/react-ui";
9
- import { OrderedList } from "@dxos/react-ui-list";
10
- import { meta } from "#meta";
11
- import { rangeFromIndex } from "#types";
12
- import { Sheet } from "#types";
13
- var RangeList = ({ sheet: sheetProp }) => {
14
- const { t } = useTranslation(meta.profile.key);
15
- const [sheet, updateSheet] = useObject(sheetProp);
16
- const handleSelectRange = (range) => {
17
- };
18
- const handleDeleteRange = useCallback((range) => {
19
- const index = sheet.ranges.findIndex((sheetRange) => sheetRange === range);
20
- updateSheet((sheet2) => {
21
- sheet2.ranges.splice(index, 1);
22
- });
23
- }, [
24
- sheet,
25
- updateSheet
26
- ]);
27
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Input.Root, null, /* @__PURE__ */ React.createElement(Input.Label, null, t("range-list.heading"))), sheet.ranges.length === 0 ? /* @__PURE__ */ React.createElement(Message.Root, null, /* @__PURE__ */ React.createElement(Message.Title, null, t("no-ranges.message"))) : /* @__PURE__ */ React.createElement(OrderedList.Root, {
28
- items: sheet.ranges,
29
- isItem: Schema.is(Sheet.Range)
30
- }, ({ items: ranges }) => /* @__PURE__ */ React.createElement(OrderedList.Content, null, ranges.map((range) => {
31
- const id = range.range;
32
- return /* @__PURE__ */ React.createElement(OrderedList.Item, {
33
- key: id,
34
- id,
35
- item: range,
36
- hover: true,
37
- classNames: "flex items-center cursor-pointer",
38
- onClick: () => handleSelectRange(range)
39
- }, /* @__PURE__ */ React.createElement("div", {
40
- className: "flex grow items-center truncate px-2"
41
- }, t("range.title", {
42
- position: rangeToA1Notation(rangeFromIndex(sheetProp, range.range)),
43
- key: t(`range-key.${range.key}.label`),
44
- value: t(`range-value.${range.value}.label`)
45
- })), /* @__PURE__ */ React.createElement(OrderedList.DeleteButton, {
46
- onClick: () => handleDeleteRange(range)
47
- }));
48
- }))));
49
- };
50
- export {
51
- RangeList as default
52
- };
53
- //# sourceMappingURL=RangeList-EIJTFS7P.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/containers/RangeList/RangeList.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\nimport React, { useCallback } from 'react';\n\nimport { rangeToA1Notation } from '@dxos/compute-hyperformula';\nimport { useObject } from '@dxos/echo-react';\nimport { Input, Message, useTranslation } from '@dxos/react-ui';\nimport { OrderedList } from '@dxos/react-ui-list';\n\nimport { meta } from '#meta';\nimport { rangeFromIndex } from '#types';\nimport { Sheet } from '#types';\n\nexport type RangeListProps = {\n sheet: Sheet.Sheet;\n};\n\nexport const RangeList = ({ sheet: sheetProp }: RangeListProps) => {\n const { t } = useTranslation(meta.profile.key);\n const [sheet, updateSheet] = useObject(sheetProp);\n // TODO(thure): Implement similar to comments, #8121\n const handleSelectRange = (range: Sheet.Range) => {};\n const handleDeleteRange = useCallback(\n (range: Sheet.Range) => {\n const index = sheet.ranges.findIndex((sheetRange) => sheetRange === range);\n updateSheet((sheet) => {\n sheet.ranges.splice(index, 1);\n });\n },\n [sheet, updateSheet],\n );\n return (\n <>\n <Input.Root>\n <Input.Label>{t('range-list.heading')}</Input.Label>\n </Input.Root>\n {sheet.ranges.length === 0 ? (\n <Message.Root>\n <Message.Title>{t('no-ranges.message')}</Message.Title>\n </Message.Root>\n ) : (\n <OrderedList.Root<Sheet.Range> items={sheet.ranges} isItem={Schema.is(Sheet.Range)}>\n {({ items: ranges }) => (\n <OrderedList.Content>\n {ranges.map((range) => {\n // Use the range's underlying cell range string as the stable id so deletes /\n // re-renders don't shift row identity by array position. Reorder is not\n // wired (DX-8121); add `OrderedList.DragHandle` + a real id strategy when it\n // lands. We avoid `OrderedList.Title` because there's no disclosure panel\n // for it to control here.\n const id = range.range;\n return (\n <OrderedList.Item\n key={id}\n id={id}\n item={range}\n hover\n classNames='flex items-center cursor-pointer'\n onClick={() => handleSelectRange(range)}\n >\n <div className='flex grow items-center truncate px-2'>\n {t('range.title', {\n position: rangeToA1Notation(rangeFromIndex(sheetProp, range.range)),\n key: t(`range-key.${range.key}.label`),\n value: t(`range-value.${range.value}.label`),\n })}\n </div>\n <OrderedList.DeleteButton onClick={() => handleDeleteRange(range)} />\n </OrderedList.Item>\n );\n })}\n </OrderedList.Content>\n )}\n </OrderedList.Root>\n )}\n </>\n );\n};\n"],
5
- "mappings": ";;;AAIA,YAAYA,YAAY;AACxB,OAAOC,SAASC,mBAAmB;AAEnC,SAASC,yBAAyB;AAClC,SAASC,iBAAiB;AAC1B,SAASC,OAAOC,SAASC,sBAAsB;AAC/C,SAASC,mBAAmB;AAE5B,SAASC,YAAY;AACrB,SAASC,sBAAsB;AAC/B,SAASC,aAAa;AAMf,IAAMC,YAAY,CAAC,EAAEC,OAAOC,UAAS,MAAkB;AAC5D,QAAM,EAAEC,EAAC,IAAKR,eAAeE,KAAKO,QAAQC,GAAG;AAC7C,QAAM,CAACJ,OAAOK,WAAAA,IAAed,UAAUU,SAAAA;AAEvC,QAAMK,oBAAoB,CAACC,UAAAA;EAAwB;AACnD,QAAMC,oBAAoBnB,YACxB,CAACkB,UAAAA;AACC,UAAME,QAAQT,MAAMU,OAAOC,UAAU,CAACC,eAAeA,eAAeL,KAAAA;AACpEF,gBAAY,CAACL,WAAAA;AACXA,MAAAA,OAAMU,OAAOG,OAAOJ,OAAO,CAAA;IAC7B,CAAA;EACF,GACA;IAACT;IAAOK;GAAY;AAEtB,SACE,sBAAA,cAAA,MAAA,UAAA,MACE,sBAAA,cAACb,MAAMsB,MAAI,MACT,sBAAA,cAACtB,MAAMuB,OAAK,MAAEb,EAAE,oBAAA,CAAA,CAAA,GAEjBF,MAAMU,OAAOM,WAAW,IACvB,sBAAA,cAACvB,QAAQqB,MAAI,MACX,sBAAA,cAACrB,QAAQwB,OAAK,MAAEf,EAAE,mBAAA,CAAA,CAAA,IAGpB,sBAAA,cAACP,YAAYmB,MAAI;IAAcI,OAAOlB,MAAMU;IAAQS,QAAeC,UAAGtB,MAAMuB,KAAK;KAC9E,CAAC,EAAEH,OAAOR,OAAM,MACf,sBAAA,cAACf,YAAY2B,SAAO,MACjBZ,OAAOa,IAAI,CAAChB,UAAAA;AAMX,UAAMiB,KAAKjB,MAAMA;AACjB,WACE,sBAAA,cAACZ,YAAY8B,MAAI;MACfrB,KAAKoB;MACLA;MACAE,MAAMnB;MACNoB,OAAAA;MACAC,YAAW;MACXC,SAAS,MAAMvB,kBAAkBC,KAAAA;OAEjC,sBAAA,cAACuB,OAAAA;MAAIC,WAAU;OACZ7B,EAAE,eAAe;MAChB8B,UAAU1C,kBAAkBO,eAAeI,WAAWM,MAAMA,KAAK,CAAA;MACjEH,KAAKF,EAAE,aAAaK,MAAMH,GAAG,QAAQ;MACrC6B,OAAO/B,EAAE,eAAeK,MAAM0B,KAAK,QAAQ;IAC7C,CAAA,CAAA,GAEF,sBAAA,cAACtC,YAAYuC,cAAY;MAACL,SAAS,MAAMrB,kBAAkBD,KAAAA;;EAGjE,CAAA,CAAA,CAAA,CAAA;AAOd;",
6
- "names": ["Schema", "React", "useCallback", "rangeToA1Notation", "useObject", "Input", "Message", "useTranslation", "OrderedList", "meta", "rangeFromIndex", "Sheet", "RangeList", "sheet", "sheetProp", "t", "profile", "key", "updateSheet", "handleSelectRange", "range", "handleDeleteRange", "index", "ranges", "findIndex", "sheetRange", "splice", "Root", "Label", "length", "Title", "items", "isItem", "is", "Range", "Content", "map", "id", "Item", "item", "hover", "classNames", "onClick", "div", "className", "position", "value", "DeleteButton"]
7
- }
@@ -1,34 +0,0 @@
1
- import "./chunk-J5LGTIGS.mjs";
2
-
3
- // src/containers/SheetArticle/SheetArticle.tsx
4
- import React from "react";
5
- import { AppSurface } from "@dxos/app-toolkit/ui";
6
- import { Panel } from "@dxos/react-ui";
7
- import { ComputeGraphContextProvider, Sheet, useComputeGraph } from "#components";
8
- var SheetArticle = ({ registry, ...props }) => /* @__PURE__ */ React.createElement(ComputeGraphContextProvider, {
9
- registry
10
- }, /* @__PURE__ */ React.createElement(SheetArticleInner, props));
11
- var SheetArticleInner = ({ role, subject: sheet, attendableId, space, ignoreAttention }) => {
12
- const graph = useComputeGraph(space);
13
- if (!graph) {
14
- return null;
15
- }
16
- return /* @__PURE__ */ React.createElement(Sheet.Root, {
17
- graph,
18
- sheet,
19
- attendableId,
20
- ignoreAttention
21
- }, /* @__PURE__ */ React.createElement(Panel.Root, {
22
- classNames: role === AppSurface.Section.role && "aspect-square"
23
- }, /* @__PURE__ */ React.createElement(Panel.Toolbar, {
24
- asChild: true
25
- }, /* @__PURE__ */ React.createElement(Sheet.Toolbar, null)), /* @__PURE__ */ React.createElement(Panel.Content, {
26
- asChild: true
27
- }, /* @__PURE__ */ React.createElement(Sheet.Content, null)), /* @__PURE__ */ React.createElement(Panel.Statusbar, {
28
- asChild: true
29
- }, /* @__PURE__ */ React.createElement(Sheet.Statusbar, null))));
30
- };
31
- export {
32
- SheetArticle as default
33
- };
34
- //# sourceMappingURL=SheetArticle-IUPQYGUU.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/containers/SheetArticle/SheetArticle.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { AppSurface } from '@dxos/app-toolkit/ui';\nimport { type ComputeGraphRegistry } from '@dxos/compute-hyperformula';\nimport { type Space } from '@dxos/react-client/echo';\nimport { Panel } from '@dxos/react-ui';\n\nimport { ComputeGraphContextProvider, Sheet, useComputeGraph } from '#components';\nimport { type Sheet as SheetType } from '#types';\n\nexport type SheetArticleProps = AppSurface.ObjectArticleProps<\n SheetType.Sheet,\n {\n space: Space;\n registry: ComputeGraphRegistry;\n ignoreAttention?: boolean;\n }\n>;\n\nexport const SheetArticle = ({ registry, ...props }: SheetArticleProps) => (\n <ComputeGraphContextProvider registry={registry}>\n <SheetArticleInner {...props} />\n </ComputeGraphContextProvider>\n);\n\nconst SheetArticleInner = ({\n role,\n subject: sheet,\n attendableId,\n space,\n ignoreAttention,\n}: Omit<SheetArticleProps, 'registry'>) => {\n const graph = useComputeGraph(space);\n if (!graph) {\n return null;\n }\n\n return (\n <Sheet.Root graph={graph} sheet={sheet} attendableId={attendableId!} ignoreAttention={ignoreAttention}>\n <Panel.Root classNames={role === AppSurface.Section.role && 'aspect-square'}>\n <Panel.Toolbar asChild>\n <Sheet.Toolbar />\n </Panel.Toolbar>\n <Panel.Content asChild>\n <Sheet.Content />\n </Panel.Content>\n <Panel.Statusbar asChild>\n <Sheet.Statusbar />\n </Panel.Statusbar>\n </Panel.Root>\n </Sheet.Root>\n );\n};\n"],
5
- "mappings": ";;;AAIA,OAAOA,WAAW;AAElB,SAASC,kBAAkB;AAG3B,SAASC,aAAa;AAEtB,SAASC,6BAA6BC,OAAOC,uBAAuB;AAY7D,IAAMC,eAAe,CAAC,EAAEC,UAAU,GAAGC,MAAAA,MAC1C,sBAAA,cAACL,6BAAAA;EAA4BI;GAC3B,sBAAA,cAACE,mBAAsBD,KAAAA,CAAAA;AAI3B,IAAMC,oBAAoB,CAAC,EACzBC,MACAC,SAASC,OACTC,cACAC,OACAC,gBAAe,MACqB;AACpC,QAAMC,QAAQX,gBAAgBS,KAAAA;AAC9B,MAAI,CAACE,OAAO;AACV,WAAO;EACT;AAEA,SACE,sBAAA,cAACZ,MAAMa,MAAI;IAACD;IAAcJ;IAAcC;IAA6BE;KACnE,sBAAA,cAACb,MAAMe,MAAI;IAACC,YAAYR,SAAST,WAAWkB,QAAQT,QAAQ;KAC1D,sBAAA,cAACR,MAAMkB,SAAO;IAACC,SAAAA;KACb,sBAAA,cAACjB,MAAMgB,SAAO,IAAA,CAAA,GAEhB,sBAAA,cAAClB,MAAMoB,SAAO;IAACD,SAAAA;KACb,sBAAA,cAACjB,MAAMkB,SAAO,IAAA,CAAA,GAEhB,sBAAA,cAACpB,MAAMqB,WAAS;IAACF,SAAAA;KACf,sBAAA,cAACjB,MAAMmB,WAAS,IAAA,CAAA,CAAA,CAAA;AAK1B;",
6
- "names": ["React", "AppSurface", "Panel", "ComputeGraphContextProvider", "Sheet", "useComputeGraph", "SheetArticle", "registry", "props", "SheetArticleInner", "role", "subject", "sheet", "attendableId", "space", "ignoreAttention", "graph", "Root", "classNames", "Section", "Toolbar", "asChild", "Content", "Statusbar"]
7
- }
@@ -1,61 +0,0 @@
1
- import "./chunk-J5LGTIGS.mjs";
2
-
3
- // src/SheetPlugin.tsx
4
- import { ActivationEvent, ActivationEvents, Plugin } from "@dxos/app-framework";
5
- import { AppActivationEvents, AppPlugin } from "@dxos/app-toolkit";
6
- import { ClientEvents } from "@dxos/plugin-client";
7
- import { MarkdownEvents } from "@dxos/plugin-markdown";
8
- import { AnchorSort, CommentConfig, ComputeGraphRegistry, CreateObject, Markdown, OperationHandler, ReactSurface, SheetState, SkillDefinition, UndoMappings } from "#capabilities";
9
- import { meta } from "#meta";
10
- import { translations } from "#translations";
11
- import { Sheet } from "#types";
12
-
13
- // raw-loader:/__w/dxos/dxos/packages/plugins/plugin-sheet/PLUGIN.mdl
14
- var PLUGIN_default = '---\nid: org.dxos.plugin.sheet\nname: SheetPlugin\nversion: 0.1.0\n---\n\nSpreadsheet plugin for `DXOS` Composer \u2014 a full-featured grid backed by ECHO for local-first, real-time collaborative data entry, formula evaluation, and structured data display.\n\n## Extensions\n\nThe following extension dialects are used in this document.\nEach extension is defined in the Appendix or resolved via its URI.\n\n| Term | URI |\n|-------------|--------------------------------|\n| `type` | `org.dxos.mdl.type@1.0` |\n| `feat` | `org.dxos.mdl.feat@1.0` |\n| `test` | `org.dxos.mdl.test@1.0` |\n| `component` | `org.dxos.mdl.component@1.0` |\n| `op` | `org.dxos.mdl.op@1.0` |\n\n## Types\n\n```mdl\ntype CellValue\n fields:\n value: any # scalar: string | number | boolean | formula string\n```\n\n```mdl\ntype RowColumnMeta\n fields:\n size?: number # pixel width/height; absent means default\n```\n\n```mdl\ntype Range\n fields:\n range: string # A1-notation range (e.g. "A1:C3")\n key: string # formatting key: alignment | comment | style\n value: string # formatting value (e.g. "center", "highlight")\n```\n\n```mdl\ntype Axis\n literals: row | col\n```\n\n```mdl\ntype Sheet\n typename: org.dxos.type.sheet\n fields:\n name?: string\n cells: Map<string, CellValue> # sparse map keyed by internal cell index\n rows: string[] # ordered row indices\n columns: string[] # ordered column indices\n rowMeta: Map<string, RowColumnMeta>\n columnMeta: Map<string, RowColumnMeta>\n ranges: Range[] # range-based formatting annotations\n```\n\n## Components\n\n```mdl\ncomponent SheetArticle\n desc: Primary spreadsheet view rendered inside an article or section role surface.\n props:\n subject: Sheet\n attendableId: string\n space: Space\n registry: ComputeGraphRegistry\n state:\n selected?: CellAddress\n activeRefs?: GridContentProps[\'activeRefs\']\n slots:\n toolbar?: ReactNode\n actions:\n selectCell(address: CellAddress)\n editCell(address: CellAddress, value: any)\n insertRow(index: number)\n insertColumn(index: number)\n dropRow(axisIndex: string)\n dropColumn(axisIndex: string)\n layout: |\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 [toolbar slot] \u2502\n \u251C\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n \u2502 \u2502 A \u2502 B \u2502 C \u2502 \u2026 column header \u2502\n \u251C\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2524 \u2502\n \u2502 1 \u2502 \u2502 \u2502 \u2502 cell grid \u2502\n \u251C\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2524 \u2502\n \u2502 2 \u2502 \u2502 \u2502 \u2502 \u2502\n \u2502 \u2026 \u2502 \u2502 \u2502 \u2502 \u2502\n \u2514\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n```\n\n```mdl\ncomponent RangeList\n desc: Object-properties panel listing named ranges and formatting annotations on a Sheet.\n props:\n sheet: Sheet\n state:\n selected?: Range\n actions:\n addRange(range: Range)\n removeRange(range: Range)\n updateRange(range: Range)\n```\n\n## Operations\n\n```mdl\nop insertAxis\n desc: Inserts one or more rows or columns at the given index in the sheet model.\n input:\n model: SheetModel\n axis: Axis\n index: number\n count?: number # defaults to 1\n output: void\n effects: [echo:write]\n```\n\n```mdl\nop dropAxis\n desc: Removes a row or column by axis index, returning data needed to restore it (undo).\n input:\n model: SheetModel\n axis: Axis\n axisIndex: string\n output: DropAxisOutput # axis, axisIndex, index, axisMeta, values\n effects: [echo:write]\n```\n\n```mdl\nop restoreAxis\n desc: Restores a previously dropped row or column (undo of dropAxis).\n input:\n model: SheetModel\n axis: Axis\n axisIndex: string # original axis index to restore\n index: number # original position\n axisMeta: RowColumnMeta\n values: any[] # cell values to re-insert\n output: void\n effects: [echo:write]\n```\n\n```mdl\nop scrollToAnchor\n desc: Programmatically scrolls and highlights a cell range in an active grid instance.\n input:\n subject: string # attendable ID of the target sheet\n cursor: string # A1-notation cell or range\n ref?: any # active refs for highlight overlay\n output: void\n effects: [ui:scroll]\n```\n\n## Features\n\n```mdl\nfeat F-1: Sheet Object\n\n req F-1.1: A Sheet is an ECHO object with typename org.dxos.type.sheet persisted in the user\'s space.\n req F-1.2: Cells are stored in a sparse map keyed by internal row/column indices.\n req F-1.3: Row and column order is maintained via ordered index arrays; insertion/deletion preserves existing cell references.\n req F-1.4: Range-based formatting annotations are stored as a flat array on the Sheet object.\n```\n\n```mdl\nfeat F-2: Formula Evaluation\n\n req F-2.1: Formulas are prefixed with "=" and evaluated by the HyperFormula engine via the ComputeGraph.\n req F-2.2: Over 400 built-in functions are available (arithmetic, statistical, text, date/time, financial, logical).\n req F-2.3:\n when: a cell value changes\n then: all dependent formula cells are recomputed reactively\n req F-2.4: Cell references in stored formulas are translated to internal indices; A1-notation is converted on read/write.\n```\n\n```mdl\nfeat F-3: Row and Column Management\n\n req F-3.1:\n when: op:insertAxis is called\n then: a new row or column is inserted at the specified index; existing cells shift accordingly\n\n req F-3.2:\n when: op:dropAxis is called\n then: the row or column is removed and undo data returned; op:restoreAxis reverses the operation\n\n req F-3.3: Row and column sizes are persisted in rowMeta/columnMeta; absent size means default grid size.\n```\n\n```mdl\nfeat F-4: Cell Formatting\n\n req F-4.1: Ranges support alignment values: start | center | end.\n req F-4.2: Ranges support comment annotations displayed as a visual overlay on the cell.\n req F-4.3: Ranges support style values: highlight | softwrap.\n req F-4.4: RangeList in the object-properties surface allows users to view and manage range annotations.\n```\n\n```mdl\nfeat F-5: Collaborative Editing\n\n req F-5.1: All cell edits are written through ECHO and replicated to peers in real time.\n req F-5.2:\n when: a peer writes a cell value\n then: the local grid re-renders with the updated value without full reload\n\n req F-5.3: ComputeGraphRegistry manages per-space HyperFormula instances so all peers share the same formula graph.\n```\n\n```mdl\nfeat F-6: Markdown Integration\n\n req F-6.1: SheetPlugin contributes a CodeMirror extension to plugin-markdown via MarkdownCapabilities.ExtensionProvider.\n req F-6.2:\n when: the extension is active in a document that belongs to a space\n then: formula references inside Markdown fenced code blocks resolve against the space\'s ComputeGraph\n```\n\n```mdl\nfeat F-7: Anchor Navigation\n\n req F-7.1:\n when: op:scrollToAnchor is invoked with a sheet attendable ID and cursor\n then: the corresponding SheetArticle scrolls to the target cell and applies the active-ref highlight\n\n req F-7.2: AnchorSort contributes a sort comparator so sheet anchors appear in canonical order in navigation menus.\n```\n\n## Acceptance\n\n```mdl\ntest T-1: Create sheet and enter a value\n given: a new Sheet is created in a space\n when: user types "42" into cell A1\n then:\n - Sheet.cells contains an entry for the A1 index with value 42\n - grid displays "42" in the A1 cell\n```\n\n```mdl\ntest T-2: Formula evaluation\n given: A1 = 10, A2 = 20\n when: user enters "=A1+A2" in A3\n then:\n - A3 displays 30\n - changing A1 to 15 causes A3 to update to 35\n```\n\n```mdl\ntest T-3: Insert and drop row\n given: a Sheet with values in rows 1 and 2\n when: op:insertAxis runs with axis=row, index=1\n then:\n - a blank row is inserted between existing rows 1 and 2\n - existing cell references remain valid\n\n when: op:dropAxis runs on the inserted row\n then:\n - the row is removed\n - op:restoreAxis re-inserts the row with its original values\n```\n\n```mdl\ntest T-4: Range formatting\n given: a Sheet open in SheetArticle\n when: user applies "highlight" style to range B2:C4\n then:\n - Sheet.ranges contains an entry with range="B2:C4", key="style", value="highlight"\n - cells in B2:C4 render with the highlight background class\n```\n\n```mdl\ntest T-5: Real-time collaboration\n given: two peers have the same Sheet open\n when: peer A sets cell D5 to "hello"\n then:\n - peer B\'s grid displays "hello" in D5 without reload\n```\n\n```mdl\ntest T-6: Scroll to anchor\n given: a SheetArticle is mounted with attendableId "sheet-1"\n when: op:scrollToAnchor runs with subject="sheet-1", cursor="E10"\n then:\n - the grid scrolls so that E10 is visible\n - E10 is highlighted via activeRefs\n```\n\n---\n\n## Appendix: Extension Definitions\n\n```mdl\next type\n uri: org.dxos.mdl.type@1.0\n desc: A named data structure with typed fields and optional literals.\n fields:\n desc?: Prose\n fields?: FieldMap\n literals?: UnionList\n extends?: TypeRef[]\n```\n\n```mdl\next feat\n uri: org.dxos.mdl.feat@1.0\n desc: A named feature grouping one or more requirements.\n fields:\n desc?: Prose\n req: RequirementList\n nesting: self\n```\n\n```mdl\next test\n uri: org.dxos.mdl.test@1.0\n desc: An acceptance scenario expressed as given / when / then steps.\n fields:\n given?: Step | Step[]\n when?: Step | Step[]\n then: Step | Step[]\n tags?: TagList\n```\n\n```mdl\next component\n uri: org.dxos.mdl.component@1.0\n desc: A UI component with props, internal state, slots, actions, and events.\n fields:\n desc?: Prose\n props?: FieldMap\n state?: FieldMap\n slots?: FieldMap\n actions?: ActionMap\n emits?: EventMap\n layout?: CodeBlock\n```\n\n```mdl\next op\n uri: org.dxos.mdl.op@1.0\n desc: |\n A named operation with typed inputs, outputs, and declared errors.\n Pure ops have no effects or requires. Effectful ops declare both.\n fields:\n desc?: Prose\n input?: FieldMap\n output?: TypeExpr\n errors?: ErrorMap\n effects?: EffectList\n requires?: ServiceList\n note?: Prose\n```\n';
15
-
16
- // src/SheetPlugin.tsx
17
- var SheetPlugin = Plugin.define(meta).pipe(AppPlugin.addSkillDefinitionModule({
18
- activate: SkillDefinition
19
- }), AppPlugin.addCommentConfigModule({
20
- activate: CommentConfig
21
- }), AppPlugin.addCreateObjectModule({
22
- activate: CreateObject
23
- }), AppPlugin.addOperationHandlerModule({
24
- activate: OperationHandler
25
- }), AppPlugin.addUndoMappingsModule({
26
- activate: UndoMappings
27
- }), AppPlugin.addSchemaModule({
28
- schema: [
29
- Sheet.Sheet
30
- ]
31
- }), AppPlugin.addSurfaceModule({
32
- activate: ReactSurface
33
- }), AppPlugin.addTranslationsModule({
34
- translations
35
- }), Plugin.addModule({
36
- activatesOn: AppActivationEvents.SetupSettings,
37
- activate: SheetState
38
- }), Plugin.addModule({
39
- activatesOn: ActivationEvent.allOf(ClientEvents.ClientReady, ActivationEvents.ProcessManagerReady),
40
- activate: ComputeGraphRegistry
41
- }), Plugin.addModule({
42
- activatesOn: MarkdownEvents.SetupExtensions,
43
- activate: Markdown
44
- }), Plugin.addModule({
45
- // TODO(wittjosiah): More relevant event?
46
- activatesOn: AppActivationEvents.AppGraphReady,
47
- activate: AnchorSort
48
- }), AppPlugin.addPluginAssetModule({
49
- asset: {
50
- pluginId: meta.profile.key,
51
- path: "PLUGIN.mdl",
52
- content: PLUGIN_default,
53
- mimeType: "application/x-mdl"
54
- }
55
- }), Plugin.make);
56
- var SheetPlugin_default = SheetPlugin;
57
- export {
58
- SheetPlugin,
59
- SheetPlugin_default as default
60
- };
61
- //# sourceMappingURL=SheetPlugin.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/SheetPlugin.tsx", "raw-loader:/__w/dxos/dxos/packages/plugins/plugin-sheet/PLUGIN.mdl"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { ActivationEvent, ActivationEvents, Plugin } from '@dxos/app-framework';\nimport { AppActivationEvents, AppPlugin } from '@dxos/app-toolkit';\nimport { ClientEvents } from '@dxos/plugin-client';\nimport { MarkdownEvents } from '@dxos/plugin-markdown';\n\nimport {\n AnchorSort,\n CommentConfig,\n ComputeGraphRegistry,\n CreateObject,\n Markdown,\n OperationHandler,\n ReactSurface,\n SheetState,\n SkillDefinition,\n UndoMappings,\n} from '#capabilities';\nimport { meta } from '#meta';\nimport { translations } from '#translations';\nimport { Sheet } from '#types';\n\n// eslint-disable-next-line import/no-relative-packages\nimport pluginSpec from '../PLUGIN.mdl?raw';\n\nexport const SheetPlugin = Plugin.define(meta).pipe(\n AppPlugin.addSkillDefinitionModule({ activate: SkillDefinition }),\n AppPlugin.addCommentConfigModule({ activate: CommentConfig }),\n AppPlugin.addCreateObjectModule({ activate: CreateObject }),\n AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),\n AppPlugin.addUndoMappingsModule({ activate: UndoMappings }),\n AppPlugin.addSchemaModule({ schema: [Sheet.Sheet] }),\n AppPlugin.addSurfaceModule({ activate: ReactSurface }),\n AppPlugin.addTranslationsModule({ translations }),\n Plugin.addModule({\n activatesOn: AppActivationEvents.SetupSettings,\n activate: SheetState,\n }),\n Plugin.addModule({\n activatesOn: ActivationEvent.allOf(ClientEvents.ClientReady, ActivationEvents.ProcessManagerReady),\n activate: ComputeGraphRegistry,\n }),\n Plugin.addModule({\n activatesOn: MarkdownEvents.SetupExtensions,\n activate: Markdown,\n }),\n Plugin.addModule({\n // TODO(wittjosiah): More relevant event?\n activatesOn: AppActivationEvents.AppGraphReady,\n activate: AnchorSort,\n }),\n AppPlugin.addPluginAssetModule({\n asset: { pluginId: meta.profile.key, path: 'PLUGIN.mdl', content: pluginSpec, mimeType: 'application/x-mdl' },\n }),\n Plugin.make,\n);\n\nexport default SheetPlugin;\n", "---\nid: org.dxos.plugin.sheet\nname: SheetPlugin\nversion: 0.1.0\n---\n\nSpreadsheet plugin for `DXOS` Composer \u2014 a full-featured grid backed by ECHO for local-first, real-time collaborative data entry, formula evaluation, and structured data display.\n\n## Extensions\n\nThe following extension dialects are used in this document.\nEach extension is defined in the Appendix or resolved via its URI.\n\n| Term | URI |\n|-------------|--------------------------------|\n| `type` | `org.dxos.mdl.type@1.0` |\n| `feat` | `org.dxos.mdl.feat@1.0` |\n| `test` | `org.dxos.mdl.test@1.0` |\n| `component` | `org.dxos.mdl.component@1.0` |\n| `op` | `org.dxos.mdl.op@1.0` |\n\n## Types\n\n```mdl\ntype CellValue\n fields:\n value: any # scalar: string | number | boolean | formula string\n```\n\n```mdl\ntype RowColumnMeta\n fields:\n size?: number # pixel width/height; absent means default\n```\n\n```mdl\ntype Range\n fields:\n range: string # A1-notation range (e.g. \"A1:C3\")\n key: string # formatting key: alignment | comment | style\n value: string # formatting value (e.g. \"center\", \"highlight\")\n```\n\n```mdl\ntype Axis\n literals: row | col\n```\n\n```mdl\ntype Sheet\n typename: org.dxos.type.sheet\n fields:\n name?: string\n cells: Map<string, CellValue> # sparse map keyed by internal cell index\n rows: string[] # ordered row indices\n columns: string[] # ordered column indices\n rowMeta: Map<string, RowColumnMeta>\n columnMeta: Map<string, RowColumnMeta>\n ranges: Range[] # range-based formatting annotations\n```\n\n## Components\n\n```mdl\ncomponent SheetArticle\n desc: Primary spreadsheet view rendered inside an article or section role surface.\n props:\n subject: Sheet\n attendableId: string\n space: Space\n registry: ComputeGraphRegistry\n state:\n selected?: CellAddress\n activeRefs?: GridContentProps['activeRefs']\n slots:\n toolbar?: ReactNode\n actions:\n selectCell(address: CellAddress)\n editCell(address: CellAddress, value: any)\n insertRow(index: number)\n insertColumn(index: number)\n dropRow(axisIndex: string)\n dropColumn(axisIndex: string)\n layout: |\n \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n \u2502 [toolbar slot] \u2502\n \u251C\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n \u2502 \u2502 A \u2502 B \u2502 C \u2502 \u2026 column header \u2502\n \u251C\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2524 \u2502\n \u2502 1 \u2502 \u2502 \u2502 \u2502 cell grid \u2502\n \u251C\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2524 \u2502\n \u2502 2 \u2502 \u2502 \u2502 \u2502 \u2502\n \u2502 \u2026 \u2502 \u2502 \u2502 \u2502 \u2502\n \u2514\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n```\n\n```mdl\ncomponent RangeList\n desc: Object-properties panel listing named ranges and formatting annotations on a Sheet.\n props:\n sheet: Sheet\n state:\n selected?: Range\n actions:\n addRange(range: Range)\n removeRange(range: Range)\n updateRange(range: Range)\n```\n\n## Operations\n\n```mdl\nop insertAxis\n desc: Inserts one or more rows or columns at the given index in the sheet model.\n input:\n model: SheetModel\n axis: Axis\n index: number\n count?: number # defaults to 1\n output: void\n effects: [echo:write]\n```\n\n```mdl\nop dropAxis\n desc: Removes a row or column by axis index, returning data needed to restore it (undo).\n input:\n model: SheetModel\n axis: Axis\n axisIndex: string\n output: DropAxisOutput # axis, axisIndex, index, axisMeta, values\n effects: [echo:write]\n```\n\n```mdl\nop restoreAxis\n desc: Restores a previously dropped row or column (undo of dropAxis).\n input:\n model: SheetModel\n axis: Axis\n axisIndex: string # original axis index to restore\n index: number # original position\n axisMeta: RowColumnMeta\n values: any[] # cell values to re-insert\n output: void\n effects: [echo:write]\n```\n\n```mdl\nop scrollToAnchor\n desc: Programmatically scrolls and highlights a cell range in an active grid instance.\n input:\n subject: string # attendable ID of the target sheet\n cursor: string # A1-notation cell or range\n ref?: any # active refs for highlight overlay\n output: void\n effects: [ui:scroll]\n```\n\n## Features\n\n```mdl\nfeat F-1: Sheet Object\n\n req F-1.1: A Sheet is an ECHO object with typename org.dxos.type.sheet persisted in the user's space.\n req F-1.2: Cells are stored in a sparse map keyed by internal row/column indices.\n req F-1.3: Row and column order is maintained via ordered index arrays; insertion/deletion preserves existing cell references.\n req F-1.4: Range-based formatting annotations are stored as a flat array on the Sheet object.\n```\n\n```mdl\nfeat F-2: Formula Evaluation\n\n req F-2.1: Formulas are prefixed with \"=\" and evaluated by the HyperFormula engine via the ComputeGraph.\n req F-2.2: Over 400 built-in functions are available (arithmetic, statistical, text, date/time, financial, logical).\n req F-2.3:\n when: a cell value changes\n then: all dependent formula cells are recomputed reactively\n req F-2.4: Cell references in stored formulas are translated to internal indices; A1-notation is converted on read/write.\n```\n\n```mdl\nfeat F-3: Row and Column Management\n\n req F-3.1:\n when: op:insertAxis is called\n then: a new row or column is inserted at the specified index; existing cells shift accordingly\n\n req F-3.2:\n when: op:dropAxis is called\n then: the row or column is removed and undo data returned; op:restoreAxis reverses the operation\n\n req F-3.3: Row and column sizes are persisted in rowMeta/columnMeta; absent size means default grid size.\n```\n\n```mdl\nfeat F-4: Cell Formatting\n\n req F-4.1: Ranges support alignment values: start | center | end.\n req F-4.2: Ranges support comment annotations displayed as a visual overlay on the cell.\n req F-4.3: Ranges support style values: highlight | softwrap.\n req F-4.4: RangeList in the object-properties surface allows users to view and manage range annotations.\n```\n\n```mdl\nfeat F-5: Collaborative Editing\n\n req F-5.1: All cell edits are written through ECHO and replicated to peers in real time.\n req F-5.2:\n when: a peer writes a cell value\n then: the local grid re-renders with the updated value without full reload\n\n req F-5.3: ComputeGraphRegistry manages per-space HyperFormula instances so all peers share the same formula graph.\n```\n\n```mdl\nfeat F-6: Markdown Integration\n\n req F-6.1: SheetPlugin contributes a CodeMirror extension to plugin-markdown via MarkdownCapabilities.ExtensionProvider.\n req F-6.2:\n when: the extension is active in a document that belongs to a space\n then: formula references inside Markdown fenced code blocks resolve against the space's ComputeGraph\n```\n\n```mdl\nfeat F-7: Anchor Navigation\n\n req F-7.1:\n when: op:scrollToAnchor is invoked with a sheet attendable ID and cursor\n then: the corresponding SheetArticle scrolls to the target cell and applies the active-ref highlight\n\n req F-7.2: AnchorSort contributes a sort comparator so sheet anchors appear in canonical order in navigation menus.\n```\n\n## Acceptance\n\n```mdl\ntest T-1: Create sheet and enter a value\n given: a new Sheet is created in a space\n when: user types \"42\" into cell A1\n then:\n - Sheet.cells contains an entry for the A1 index with value 42\n - grid displays \"42\" in the A1 cell\n```\n\n```mdl\ntest T-2: Formula evaluation\n given: A1 = 10, A2 = 20\n when: user enters \"=A1+A2\" in A3\n then:\n - A3 displays 30\n - changing A1 to 15 causes A3 to update to 35\n```\n\n```mdl\ntest T-3: Insert and drop row\n given: a Sheet with values in rows 1 and 2\n when: op:insertAxis runs with axis=row, index=1\n then:\n - a blank row is inserted between existing rows 1 and 2\n - existing cell references remain valid\n\n when: op:dropAxis runs on the inserted row\n then:\n - the row is removed\n - op:restoreAxis re-inserts the row with its original values\n```\n\n```mdl\ntest T-4: Range formatting\n given: a Sheet open in SheetArticle\n when: user applies \"highlight\" style to range B2:C4\n then:\n - Sheet.ranges contains an entry with range=\"B2:C4\", key=\"style\", value=\"highlight\"\n - cells in B2:C4 render with the highlight background class\n```\n\n```mdl\ntest T-5: Real-time collaboration\n given: two peers have the same Sheet open\n when: peer A sets cell D5 to \"hello\"\n then:\n - peer B's grid displays \"hello\" in D5 without reload\n```\n\n```mdl\ntest T-6: Scroll to anchor\n given: a SheetArticle is mounted with attendableId \"sheet-1\"\n when: op:scrollToAnchor runs with subject=\"sheet-1\", cursor=\"E10\"\n then:\n - the grid scrolls so that E10 is visible\n - E10 is highlighted via activeRefs\n```\n\n---\n\n## Appendix: Extension Definitions\n\n```mdl\next type\n uri: org.dxos.mdl.type@1.0\n desc: A named data structure with typed fields and optional literals.\n fields:\n desc?: Prose\n fields?: FieldMap\n literals?: UnionList\n extends?: TypeRef[]\n```\n\n```mdl\next feat\n uri: org.dxos.mdl.feat@1.0\n desc: A named feature grouping one or more requirements.\n fields:\n desc?: Prose\n req: RequirementList\n nesting: self\n```\n\n```mdl\next test\n uri: org.dxos.mdl.test@1.0\n desc: An acceptance scenario expressed as given / when / then steps.\n fields:\n given?: Step | Step[]\n when?: Step | Step[]\n then: Step | Step[]\n tags?: TagList\n```\n\n```mdl\next component\n uri: org.dxos.mdl.component@1.0\n desc: A UI component with props, internal state, slots, actions, and events.\n fields:\n desc?: Prose\n props?: FieldMap\n state?: FieldMap\n slots?: FieldMap\n actions?: ActionMap\n emits?: EventMap\n layout?: CodeBlock\n```\n\n```mdl\next op\n uri: org.dxos.mdl.op@1.0\n desc: |\n A named operation with typed inputs, outputs, and declared errors.\n Pure ops have no effects or requires. Effectful ops declare both.\n fields:\n desc?: Prose\n input?: FieldMap\n output?: TypeExpr\n errors?: ErrorMap\n effects?: EffectList\n requires?: ServiceList\n note?: Prose\n```\n"],
5
- "mappings": ";;;AAIA,SAASA,iBAAiBC,kBAAkBC,cAAc;AAC1D,SAASC,qBAAqBC,iBAAiB;AAC/C,SAASC,oBAAoB;AAC7B,SAASC,sBAAsB;AAE/B,SACEC,YACAC,eACAC,sBACAC,cACAC,UACAC,kBACAC,cACAC,YACAC,iBACAC,oBACK;AACP,SAASC,YAAY;AACrB,SAASC,oBAAoB;AAC7B,SAASC,aAAa;;;ACvBtB;;;AD4BO,IAAMC,cAAcC,OAAOC,OAAOC,IAAAA,EAAMC,KAC7CC,UAAUC,yBAAyB;EAAEC,UAAUC;AAAgB,CAAA,GAC/DH,UAAUI,uBAAuB;EAAEF,UAAUG;AAAc,CAAA,GAC3DL,UAAUM,sBAAsB;EAAEJ,UAAUK;AAAa,CAAA,GACzDP,UAAUQ,0BAA0B;EAAEN,UAAUO;AAAiB,CAAA,GACjET,UAAUU,sBAAsB;EAAER,UAAUS;AAAa,CAAA,GACzDX,UAAUY,gBAAgB;EAAEC,QAAQ;IAACC,MAAMA;;AAAO,CAAA,GAClDd,UAAUe,iBAAiB;EAAEb,UAAUc;AAAa,CAAA,GACpDhB,UAAUiB,sBAAsB;EAAEC;AAAa,CAAA,GAC/CtB,OAAOuB,UAAU;EACfC,aAAaC,oBAAoBC;EACjCpB,UAAUqB;AACZ,CAAA,GACA3B,OAAOuB,UAAU;EACfC,aAAaI,gBAAgBC,MAAMC,aAAaC,aAAaC,iBAAiBC,mBAAmB;EACjG3B,UAAU4B;AACZ,CAAA,GACAlC,OAAOuB,UAAU;EACfC,aAAaW,eAAeC;EAC5B9B,UAAU+B;AACZ,CAAA,GACArC,OAAOuB,UAAU;;EAEfC,aAAaC,oBAAoBa;EACjChC,UAAUiC;AACZ,CAAA,GACAnC,UAAUoC,qBAAqB;EAC7BC,OAAO;IAAEC,UAAUxC,KAAKyC,QAAQC;IAAKC,MAAM;IAAcC,SAASC;IAAYC,UAAU;EAAoB;AAC9G,CAAA,GACAhD,OAAOiD,IAAI;AAGb,IAAA,sBAAelD;",
6
- "names": ["ActivationEvent", "ActivationEvents", "Plugin", "AppActivationEvents", "AppPlugin", "ClientEvents", "MarkdownEvents", "AnchorSort", "CommentConfig", "ComputeGraphRegistry", "CreateObject", "Markdown", "OperationHandler", "ReactSurface", "SheetState", "SkillDefinition", "UndoMappings", "meta", "translations", "Sheet", "SheetPlugin", "Plugin", "define", "meta", "pipe", "AppPlugin", "addSkillDefinitionModule", "activate", "SkillDefinition", "addCommentConfigModule", "CommentConfig", "addCreateObjectModule", "CreateObject", "addOperationHandlerModule", "OperationHandler", "addUndoMappingsModule", "UndoMappings", "addSchemaModule", "schema", "Sheet", "addSurfaceModule", "ReactSurface", "addTranslationsModule", "translations", "addModule", "activatesOn", "AppActivationEvents", "SetupSettings", "SheetState", "ActivationEvent", "allOf", "ClientEvents", "ClientReady", "ActivationEvents", "ProcessManagerReady", "ComputeGraphRegistry", "MarkdownEvents", "SetupExtensions", "Markdown", "AppGraphReady", "AnchorSort", "addPluginAssetModule", "asset", "pluginId", "profile", "key", "path", "content", "pluginSpec", "mimeType", "make"]
7
- }
@@ -1,27 +0,0 @@
1
- import "./chunk-J5LGTIGS.mjs";
2
-
3
- // src/SheetPlugin.node.ts
4
- import { Plugin } from "@dxos/app-framework";
5
- import { AppPlugin } from "@dxos/app-toolkit";
6
- import { CommentConfig, CreateObject, OperationHandler, UndoMappings } from "#capabilities";
7
- import { meta } from "#meta";
8
- import { Sheet } from "#types";
9
- var SheetPlugin = Plugin.define(meta).pipe(AppPlugin.addCommentConfigModule({
10
- activate: CommentConfig
11
- }), AppPlugin.addCreateObjectModule({
12
- activate: CreateObject
13
- }), AppPlugin.addOperationHandlerModule({
14
- activate: OperationHandler
15
- }), AppPlugin.addUndoMappingsModule({
16
- activate: UndoMappings
17
- }), AppPlugin.addSchemaModule({
18
- schema: [
19
- Sheet.Sheet
20
- ]
21
- }), Plugin.make);
22
- var SheetPlugin_node_default = SheetPlugin;
23
- export {
24
- SheetPlugin,
25
- SheetPlugin_node_default as default
26
- };
27
- //# sourceMappingURL=SheetPlugin.node.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/SheetPlugin.node.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\nimport { AppPlugin } from '@dxos/app-toolkit';\n\nimport { CommentConfig, CreateObject, OperationHandler, UndoMappings } from '#capabilities';\nimport { meta } from '#meta';\nimport { Sheet } from '#types';\n\nexport const SheetPlugin = Plugin.define(meta).pipe(\n AppPlugin.addCommentConfigModule({ activate: CommentConfig }),\n AppPlugin.addCreateObjectModule({ activate: CreateObject }),\n AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),\n AppPlugin.addUndoMappingsModule({ activate: UndoMappings }),\n AppPlugin.addSchemaModule({ schema: [Sheet.Sheet] }),\n Plugin.make,\n);\n\nexport default SheetPlugin;\n"],
5
- "mappings": ";;;AAIA,SAASA,cAAc;AACvB,SAASC,iBAAiB;AAE1B,SAASC,eAAeC,cAAcC,kBAAkBC,oBAAoB;AAC5E,SAASC,YAAY;AACrB,SAASC,aAAa;AAEf,IAAMC,cAAcR,OAAOS,OAAOH,IAAAA,EAAMI,KAC7CT,UAAUU,uBAAuB;EAAEC,UAAUV;AAAc,CAAA,GAC3DD,UAAUY,sBAAsB;EAAED,UAAUT;AAAa,CAAA,GACzDF,UAAUa,0BAA0B;EAAEF,UAAUR;AAAiB,CAAA,GACjEH,UAAUc,sBAAsB;EAAEH,UAAUP;AAAa,CAAA,GACzDJ,UAAUe,gBAAgB;EAAEC,QAAQ;IAACV,MAAMA;;AAAO,CAAA,GAClDP,OAAOkB,IAAI;AAGb,IAAA,2BAAeV;",
6
- "names": ["Plugin", "AppPlugin", "CommentConfig", "CreateObject", "OperationHandler", "UndoMappings", "meta", "Sheet", "SheetPlugin", "define", "pipe", "addCommentConfigModule", "activate", "addCreateObjectModule", "addOperationHandlerModule", "addUndoMappingsModule", "addSchemaModule", "schema", "make"]
7
- }
@@ -1,21 +0,0 @@
1
- import "./chunk-J5LGTIGS.mjs";
2
-
3
- // src/SheetPlugin.workerd.ts
4
- import { Plugin } from "@dxos/app-framework";
5
- import { AppPlugin } from "@dxos/app-toolkit";
6
- import { OperationHandler } from "#capabilities";
7
- import { meta } from "#meta";
8
- import { Sheet } from "#types";
9
- var SheetPlugin = Plugin.define(meta).pipe(AppPlugin.addOperationHandlerModule({
10
- activate: OperationHandler
11
- }), AppPlugin.addSchemaModule({
12
- schema: [
13
- Sheet.Sheet
14
- ]
15
- }), Plugin.make);
16
- var SheetPlugin_workerd_default = SheetPlugin;
17
- export {
18
- SheetPlugin,
19
- SheetPlugin_workerd_default as default
20
- };
21
- //# sourceMappingURL=SheetPlugin.workerd.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/SheetPlugin.workerd.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\nimport { AppPlugin } from '@dxos/app-toolkit';\n\nimport { OperationHandler } from '#capabilities';\nimport { meta } from '#meta';\nimport { Sheet } from '#types';\n\nexport const SheetPlugin = Plugin.define(meta).pipe(\n AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),\n AppPlugin.addSchemaModule({ schema: [Sheet.Sheet] }),\n Plugin.make,\n);\n\nexport default SheetPlugin;\n"],
5
- "mappings": ";;;AAIA,SAASA,cAAc;AACvB,SAASC,iBAAiB;AAE1B,SAASC,wBAAwB;AACjC,SAASC,YAAY;AACrB,SAASC,aAAa;AAEf,IAAMC,cAAcL,OAAOM,OAAOH,IAAAA,EAAMI,KAC7CN,UAAUO,0BAA0B;EAAEC,UAAUP;AAAiB,CAAA,GACjED,UAAUS,gBAAgB;EAAEC,QAAQ;IAACP,MAAMA;;AAAO,CAAA,GAClDJ,OAAOY,IAAI;AAGb,IAAA,8BAAeP;",
6
- "names": ["Plugin", "AppPlugin", "OperationHandler", "meta", "Sheet", "SheetPlugin", "define", "pipe", "addOperationHandlerModule", "activate", "addSchemaModule", "schema", "make"]
7
- }
@@ -1,22 +0,0 @@
1
- import "./chunk-J5LGTIGS.mjs";
2
-
3
- // src/capabilities/anchor-sort.ts
4
- import * as Effect from "effect/Effect";
5
- import { Capability } from "@dxos/app-framework";
6
- import { AppCapabilities } from "@dxos/app-toolkit";
7
- import { Relation, Type } from "@dxos/echo";
8
- import { Sheet, compareIndexPositions } from "#types";
9
- var anchor_sort_default = Capability.makeModule(() => Effect.succeed(Capability.contributes(AppCapabilities.AnchorSort, {
10
- key: Type.getTypename(Sheet.Sheet),
11
- sort: (anchorA, anchorB) => {
12
- const sheet = Relation.getTarget(anchorA);
13
- if (sheet !== Relation.getTarget(anchorB)) {
14
- return 0;
15
- }
16
- return !anchorA.anchor || !anchorB.anchor ? 0 : compareIndexPositions(sheet, anchorA.anchor, anchorB.anchor);
17
- }
18
- })));
19
- export {
20
- anchor_sort_default as default
21
- };
22
- //# sourceMappingURL=anchor-sort-2POWTKTD.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/anchor-sort.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability } from '@dxos/app-framework';\nimport { AppCapabilities } from '@dxos/app-toolkit';\nimport { Relation, Type } from '@dxos/echo';\n\nimport { Sheet, compareIndexPositions } from '#types';\n\nexport default Capability.makeModule(() =>\n Effect.succeed(\n Capability.contributes(AppCapabilities.AnchorSort, {\n key: Type.getTypename(Sheet.Sheet),\n sort: (anchorA, anchorB) => {\n const sheet = Relation.getTarget(anchorA) as Sheet.Sheet;\n if (sheet !== Relation.getTarget(anchorB)) {\n return 0;\n }\n\n return !anchorA.anchor || !anchorB.anchor ? 0 : compareIndexPositions(sheet, anchorA.anchor, anchorB.anchor);\n },\n }),\n ),\n);\n"],
5
- "mappings": ";;;AAIA,YAAYA,YAAY;AAExB,SAASC,kBAAkB;AAC3B,SAASC,uBAAuB;AAChC,SAASC,UAAUC,YAAY;AAE/B,SAASC,OAAOC,6BAA6B;AAE7C,IAAA,sBAAeL,WAAWM,WAAW,MAC5BC,eACLP,WAAWQ,YAAYP,gBAAgBQ,YAAY;EACjDC,KAAKP,KAAKQ,YAAYP,MAAMA,KAAK;EACjCQ,MAAM,CAACC,SAASC,YAAAA;AACd,UAAMC,QAAQb,SAASc,UAAUH,OAAAA;AACjC,QAAIE,UAAUb,SAASc,UAAUF,OAAAA,GAAU;AACzC,aAAO;IACT;AAEA,WAAO,CAACD,QAAQI,UAAU,CAACH,QAAQG,SAAS,IAAIZ,sBAAsBU,OAAOF,QAAQI,QAAQH,QAAQG,MAAM;EAC7G;AACF,CAAA,CAAA,CAAA;",
6
- "names": ["Effect", "Capability", "AppCapabilities", "Relation", "Type", "Sheet", "compareIndexPositions", "makeModule", "succeed", "contributes", "AnchorSort", "key", "getTypename", "sort", "anchorA", "anchorB", "sheet", "getTarget", "anchor"]
7
- }