@dxos/plugin-sheet 0.8.4-main.f9ba587 → 0.8.4-staging.60fe92afc8

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 (395) hide show
  1. package/LICENSE +102 -5
  2. package/PLUGIN.mdl +359 -0
  3. package/dist/lib/neutral/RangeList-HYB5S6KQ.mjs +46 -0
  4. package/dist/lib/neutral/RangeList-HYB5S6KQ.mjs.map +7 -0
  5. package/dist/lib/neutral/SheetArticle-5AJRM3V3.mjs +33 -0
  6. package/dist/lib/neutral/SheetArticle-5AJRM3V3.mjs.map +7 -0
  7. package/dist/lib/neutral/SheetPlugin.mjs +63 -0
  8. package/dist/lib/neutral/SheetPlugin.mjs.map +7 -0
  9. package/dist/lib/neutral/SheetPlugin.node.mjs +27 -0
  10. package/dist/lib/neutral/SheetPlugin.node.mjs.map +7 -0
  11. package/dist/lib/neutral/SheetPlugin.workerd.mjs +21 -0
  12. package/dist/lib/neutral/SheetPlugin.workerd.mjs.map +7 -0
  13. package/dist/lib/neutral/anchor-sort-2POWTKTD.mjs +22 -0
  14. package/dist/lib/neutral/anchor-sort-2POWTKTD.mjs.map +7 -0
  15. package/dist/lib/neutral/app-graph-builder-2QP6GYB2.mjs +67 -0
  16. package/dist/lib/neutral/app-graph-builder-2QP6GYB2.mjs.map +7 -0
  17. package/dist/lib/neutral/capabilities/index.mjs +29 -0
  18. package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
  19. package/dist/lib/neutral/chunk-BGR7FVNF.mjs +8 -0
  20. package/dist/lib/neutral/chunk-BGR7FVNF.mjs.map +7 -0
  21. package/dist/lib/{browser/chunk-7HQX4NQP.mjs → neutral/chunk-ERHMBRSU.mjs} +16 -16
  22. package/dist/lib/neutral/chunk-ERHMBRSU.mjs.map +7 -0
  23. package/dist/lib/neutral/chunk-FQHTXKMF.mjs +34 -0
  24. package/dist/lib/neutral/chunk-FQHTXKMF.mjs.map +7 -0
  25. package/dist/lib/neutral/chunk-HEN74ZWI.mjs +83 -0
  26. package/dist/lib/neutral/chunk-HEN74ZWI.mjs.map +7 -0
  27. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  28. package/dist/lib/neutral/chunk-KUWATEHB.mjs +374 -0
  29. package/dist/lib/neutral/chunk-KUWATEHB.mjs.map +7 -0
  30. package/dist/lib/neutral/chunk-S2UNH6VD.mjs +10 -0
  31. package/dist/lib/neutral/chunk-S2UNH6VD.mjs.map +7 -0
  32. package/dist/lib/neutral/comment-config-WGXXX5FG.mjs +22 -0
  33. package/dist/lib/neutral/comment-config-WGXXX5FG.mjs.map +7 -0
  34. package/dist/lib/neutral/components/index.mjs +1552 -0
  35. package/dist/lib/neutral/components/index.mjs.map +7 -0
  36. package/dist/lib/neutral/compute-graph-registry-YYINTFC2.mjs +26 -0
  37. package/dist/lib/neutral/compute-graph-registry-YYINTFC2.mjs.map +7 -0
  38. package/dist/lib/neutral/containers/index.mjs +11 -0
  39. package/dist/lib/neutral/containers/index.mjs.map +7 -0
  40. package/dist/lib/neutral/create-object-TDQQ24IB.mjs +31 -0
  41. package/dist/lib/neutral/create-object-TDQQ24IB.mjs.map +7 -0
  42. package/dist/lib/neutral/drop-axis-WSWFOLQN.mjs +23 -0
  43. package/dist/lib/neutral/drop-axis-WSWFOLQN.mjs.map +7 -0
  44. package/dist/lib/{node-esm/types → neutral}/index.mjs +22 -13
  45. package/dist/lib/neutral/insert-axis-6UQJTIWC.mjs +16 -0
  46. package/dist/lib/neutral/insert-axis-6UQJTIWC.mjs.map +7 -0
  47. package/dist/lib/neutral/markdown-extension-HTJDICGT.mjs +28 -0
  48. package/dist/lib/neutral/markdown-extension-HTJDICGT.mjs.map +7 -0
  49. package/dist/lib/neutral/meta.json +1 -0
  50. package/dist/lib/neutral/meta.mjs +8 -0
  51. package/dist/lib/neutral/meta.mjs.map +7 -0
  52. package/dist/lib/neutral/navigation-resolver-FXEZYO7G.mjs +14 -0
  53. package/dist/lib/neutral/navigation-resolver-FXEZYO7G.mjs.map +7 -0
  54. package/dist/lib/neutral/operation-handler-TB6LFV2H.mjs +13 -0
  55. package/dist/lib/neutral/operation-handler-TB6LFV2H.mjs.map +7 -0
  56. package/dist/lib/neutral/operations/index.mjs +8 -0
  57. package/dist/lib/neutral/operations/index.mjs.map +7 -0
  58. package/dist/lib/neutral/plugin.mjs +16 -0
  59. package/dist/lib/neutral/plugin.mjs.map +7 -0
  60. package/dist/lib/neutral/react-surface-4H3PC4WG.mjs +44 -0
  61. package/dist/lib/neutral/react-surface-4H3PC4WG.mjs.map +7 -0
  62. package/dist/lib/neutral/restore-axis-AMMVTPS3.mjs +16 -0
  63. package/dist/lib/neutral/restore-axis-AMMVTPS3.mjs.map +7 -0
  64. package/dist/lib/neutral/scroll-to-anchor-FK2CXCQR.mjs +33 -0
  65. package/dist/lib/neutral/scroll-to-anchor-FK2CXCQR.mjs.map +7 -0
  66. package/dist/lib/neutral/state-HPA27MX2.mjs +29 -0
  67. package/dist/lib/neutral/state-HPA27MX2.mjs.map +7 -0
  68. package/dist/lib/neutral/testing/index.mjs +103 -0
  69. package/dist/lib/neutral/testing/index.mjs.map +7 -0
  70. package/dist/lib/neutral/translations.mjs +56 -0
  71. package/dist/lib/neutral/translations.mjs.map +7 -0
  72. package/dist/lib/{browser → neutral}/types/index.mjs +8 -12
  73. package/dist/lib/neutral/types/index.mjs.map +7 -0
  74. package/dist/lib/neutral/undo-mappings-3FQLSTCZ.mjs +31 -0
  75. package/dist/lib/neutral/undo-mappings-3FQLSTCZ.mjs.map +7 -0
  76. package/dist/types/src/SheetPlugin.d.ts +3 -1
  77. package/dist/types/src/SheetPlugin.d.ts.map +1 -1
  78. package/dist/types/src/SheetPlugin.node.d.ts +4 -0
  79. package/dist/types/src/SheetPlugin.node.d.ts.map +1 -0
  80. package/dist/types/src/SheetPlugin.test.d.ts +2 -0
  81. package/dist/types/src/SheetPlugin.test.d.ts.map +1 -0
  82. package/dist/types/src/SheetPlugin.workerd.d.ts +4 -0
  83. package/dist/types/src/SheetPlugin.workerd.d.ts.map +1 -0
  84. package/dist/types/src/capabilities/anchor-sort.d.ts +4 -4
  85. package/dist/types/src/capabilities/anchor-sort.d.ts.map +1 -1
  86. package/dist/types/src/capabilities/app-graph-builder.d.ts +6 -0
  87. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
  88. package/dist/types/src/capabilities/comment-config.d.ts +6 -0
  89. package/dist/types/src/capabilities/comment-config.d.ts.map +1 -0
  90. package/dist/types/src/capabilities/compute-graph-registry.d.ts +9 -2
  91. package/dist/types/src/capabilities/compute-graph-registry.d.ts.map +1 -1
  92. package/dist/types/src/capabilities/create-object.d.ts +11 -0
  93. package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
  94. package/dist/types/src/capabilities/index.d.ts +19 -11
  95. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  96. package/dist/types/src/capabilities/markdown-extension.d.ts +5 -0
  97. package/dist/types/src/capabilities/markdown-extension.d.ts.map +1 -0
  98. package/dist/types/src/capabilities/navigation-resolver.d.ts +6 -0
  99. package/dist/types/src/capabilities/navigation-resolver.d.ts.map +1 -0
  100. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  101. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  102. package/dist/types/src/capabilities/react-surface.d.ts +3 -2
  103. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  104. package/dist/types/src/capabilities/state.d.ts +6 -0
  105. package/dist/types/src/capabilities/state.d.ts.map +1 -0
  106. package/dist/types/src/capabilities/undo-mappings.d.ts +5 -0
  107. package/dist/types/src/capabilities/undo-mappings.d.ts.map +1 -0
  108. package/dist/types/src/components/ComputeGraph/ComputeGraphContextProvider.d.ts +1 -1
  109. package/dist/types/src/components/ComputeGraph/ComputeGraphContextProvider.d.ts.map +1 -1
  110. package/dist/types/src/components/ComputeGraph/compute-graph.stories.d.ts +9 -4
  111. package/dist/types/src/components/ComputeGraph/compute-graph.stories.d.ts.map +1 -1
  112. package/dist/types/src/components/Sheet/Sheet.d.ts +17 -0
  113. package/dist/types/src/components/Sheet/Sheet.d.ts.map +1 -0
  114. package/dist/types/src/components/Sheet/index.d.ts +2 -0
  115. package/dist/types/src/components/Sheet/index.d.ts.map +1 -0
  116. package/dist/types/src/components/SheetContent/SheetCellEditor.stories.d.ts +16 -0
  117. package/dist/types/src/components/SheetContent/SheetCellEditor.stories.d.ts.map +1 -0
  118. package/dist/types/src/components/SheetContent/SheetContent.d.ts +6 -0
  119. package/dist/types/src/components/SheetContent/SheetContent.d.ts.map +1 -0
  120. package/dist/types/src/components/SheetContent/SheetContent.stories.d.ts +93 -0
  121. package/dist/types/src/components/SheetContent/SheetContent.stories.d.ts.map +1 -0
  122. package/dist/types/src/components/SheetContent/index.d.ts +2 -0
  123. package/dist/types/src/components/SheetContent/index.d.ts.map +1 -0
  124. package/dist/types/src/components/{GridSheet → SheetContent}/util.d.ts +2 -2
  125. package/dist/types/src/components/SheetContent/util.d.ts.map +1 -0
  126. package/dist/types/src/components/{SheetContext/SheetContext.d.ts → SheetRoot/SheetRoot.d.ts} +9 -7
  127. package/dist/types/src/components/SheetRoot/SheetRoot.d.ts.map +1 -0
  128. package/dist/types/src/components/SheetRoot/index.d.ts +2 -0
  129. package/dist/types/src/components/SheetRoot/index.d.ts.map +1 -0
  130. package/dist/types/src/components/SheetStatusbar/SheetStatusbar.d.ts +6 -0
  131. package/dist/types/src/components/SheetStatusbar/SheetStatusbar.d.ts.map +1 -0
  132. package/dist/types/src/components/SheetStatusbar/index.d.ts +2 -0
  133. package/dist/types/src/components/SheetStatusbar/index.d.ts.map +1 -0
  134. package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts +5 -6
  135. package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts.map +1 -1
  136. package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts +92 -4
  137. package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts.map +1 -1
  138. package/dist/types/src/components/SheetToolbar/align.d.ts +14 -21
  139. package/dist/types/src/components/SheetToolbar/align.d.ts.map +1 -1
  140. package/dist/types/src/components/SheetToolbar/style.d.ts +14 -20
  141. package/dist/types/src/components/SheetToolbar/style.d.ts.map +1 -1
  142. package/dist/types/src/components/SheetToolbar/useToolbarState.d.ts +14 -1
  143. package/dist/types/src/components/SheetToolbar/useToolbarState.d.ts.map +1 -1
  144. package/dist/types/src/components/index.d.ts +1 -4
  145. package/dist/types/src/components/index.d.ts.map +1 -1
  146. package/dist/types/src/containers/RangeList/RangeList.d.ts +7 -0
  147. package/dist/types/src/containers/RangeList/RangeList.d.ts.map +1 -0
  148. package/dist/types/src/containers/RangeList/index.d.ts +2 -0
  149. package/dist/types/src/containers/RangeList/index.d.ts.map +1 -0
  150. package/dist/types/src/containers/SheetArticle/SheetArticle.d.ts +12 -0
  151. package/dist/types/src/containers/SheetArticle/SheetArticle.d.ts.map +1 -0
  152. package/dist/types/src/containers/SheetArticle/SheetArticle.stories.d.ts +92 -0
  153. package/dist/types/src/containers/SheetArticle/SheetArticle.stories.d.ts.map +1 -0
  154. package/dist/types/src/containers/SheetArticle/index.d.ts +2 -0
  155. package/dist/types/src/containers/SheetArticle/index.d.ts.map +1 -0
  156. package/dist/types/src/containers/index.d.ts +4 -0
  157. package/dist/types/src/containers/index.d.ts.map +1 -0
  158. package/dist/types/src/extensions/compute.d.ts +2 -2
  159. package/dist/types/src/extensions/compute.d.ts.map +1 -1
  160. package/dist/types/src/extensions/compute.stories.d.ts +10 -13
  161. package/dist/types/src/extensions/compute.stories.d.ts.map +1 -1
  162. package/dist/types/src/extensions/editor/index.d.ts +1 -1
  163. package/dist/types/src/extensions/editor/index.d.ts.map +1 -1
  164. package/dist/types/src/extensions/editor/{extension.d.ts → sheet-extension.d.ts} +2 -2
  165. package/dist/types/src/extensions/editor/sheet-extension.d.ts.map +1 -0
  166. package/dist/types/src/extensions/editor/sheet-extension.test.d.ts +2 -0
  167. package/dist/types/src/extensions/editor/sheet-extension.test.d.ts.map +1 -0
  168. package/dist/types/src/index.d.ts +3 -2
  169. package/dist/types/src/index.d.ts.map +1 -1
  170. package/dist/types/src/integrations/thread-ranges.d.ts +1 -3
  171. package/dist/types/src/integrations/thread-ranges.d.ts.map +1 -1
  172. package/dist/types/src/meta.d.ts +2 -3
  173. package/dist/types/src/meta.d.ts.map +1 -1
  174. package/dist/types/src/model/sheet-model.d.ts +31 -7
  175. package/dist/types/src/model/sheet-model.d.ts.map +1 -1
  176. package/dist/types/src/model/testing.d.ts +2 -2
  177. package/dist/types/src/model/testing.d.ts.map +1 -1
  178. package/dist/types/src/model/useSheetModel.d.ts +3 -3
  179. package/dist/types/src/model/useSheetModel.d.ts.map +1 -1
  180. package/dist/types/src/operations/drop-axis.d.ts +5 -0
  181. package/dist/types/src/operations/drop-axis.d.ts.map +1 -0
  182. package/dist/types/src/operations/index.d.ts +3 -0
  183. package/dist/types/src/operations/index.d.ts.map +1 -0
  184. package/dist/types/src/operations/insert-axis.d.ts +5 -0
  185. package/dist/types/src/operations/insert-axis.d.ts.map +1 -0
  186. package/dist/types/src/operations/restore-axis.d.ts +5 -0
  187. package/dist/types/src/operations/restore-axis.d.ts.map +1 -0
  188. package/dist/types/src/operations/scroll-to-anchor.d.ts +5 -0
  189. package/dist/types/src/operations/scroll-to-anchor.d.ts.map +1 -0
  190. package/dist/types/src/paths.d.ts +3 -0
  191. package/dist/types/src/paths.d.ts.map +1 -0
  192. package/dist/types/src/playwright/playwright.config.d.ts.map +1 -1
  193. package/dist/types/src/playwright/sheet-manager.d.ts +1 -1
  194. package/dist/types/src/playwright/sheet-manager.d.ts.map +1 -1
  195. package/dist/types/src/plugin.d.ts +4 -0
  196. package/dist/types/src/plugin.d.ts.map +1 -0
  197. package/dist/types/src/serializer.d.ts +3 -3
  198. package/dist/types/src/serializer.d.ts.map +1 -1
  199. package/dist/types/src/testing/data.d.ts +2 -2
  200. package/dist/types/src/testing/data.d.ts.map +1 -1
  201. package/dist/types/src/testing/testing.d.ts +28 -4
  202. package/dist/types/src/testing/testing.d.ts.map +1 -1
  203. package/dist/types/src/translations.d.ts +74 -36
  204. package/dist/types/src/translations.d.ts.map +1 -1
  205. package/dist/types/src/types/Sheet.d.ts +75 -0
  206. package/dist/types/src/types/Sheet.d.ts.map +1 -0
  207. package/dist/types/src/types/SheetCapabilities.d.ts +16 -0
  208. package/dist/types/src/types/SheetCapabilities.d.ts.map +1 -0
  209. package/dist/types/src/types/SheetOperation.d.ts +45 -0
  210. package/dist/types/src/types/SheetOperation.d.ts.map +1 -0
  211. package/dist/types/src/types/index.d.ts +3 -1
  212. package/dist/types/src/types/index.d.ts.map +1 -1
  213. package/dist/types/src/types/sheet-range-types.d.ts +2 -2
  214. package/dist/types/src/types/sheet-range-types.d.ts.map +1 -1
  215. package/dist/types/src/types/types.d.ts +3 -78
  216. package/dist/types/src/types/types.d.ts.map +1 -1
  217. package/dist/types/src/types/util.d.ts +11 -11
  218. package/dist/types/src/types/util.d.ts.map +1 -1
  219. package/dist/types/tsconfig.tsbuildinfo +1 -1
  220. package/package.json +133 -97
  221. package/src/SheetPlugin.node.ts +21 -0
  222. package/src/SheetPlugin.test.ts +30 -0
  223. package/src/SheetPlugin.tsx +55 -68
  224. package/src/SheetPlugin.workerd.ts +18 -0
  225. package/src/capabilities/anchor-sort.ts +20 -15
  226. package/src/capabilities/app-graph-builder.ts +63 -0
  227. package/src/capabilities/comment-config.ts +28 -0
  228. package/src/capabilities/compute-graph-registry.ts +34 -20
  229. package/src/capabilities/create-object.ts +33 -0
  230. package/src/capabilities/index.ts +22 -8
  231. package/src/capabilities/markdown-extension.ts +31 -0
  232. package/src/capabilities/navigation-resolver.ts +16 -0
  233. package/src/capabilities/operation-handler.ts +16 -0
  234. package/src/capabilities/react-surface.tsx +38 -28
  235. package/src/capabilities/state.ts +29 -0
  236. package/src/capabilities/undo-mappings.ts +30 -0
  237. package/src/components/ComputeGraph/ComputeGraphContextProvider.tsx +2 -2
  238. package/src/components/ComputeGraph/compute-graph.stories.tsx +38 -29
  239. package/src/components/Sheet/Sheet.tsx +20 -0
  240. package/src/components/Sheet/index.ts +5 -0
  241. package/src/components/SheetContent/SheetCellEditor.stories.tsx +95 -0
  242. package/src/components/SheetContent/SheetContent.stories.tsx +60 -0
  243. package/src/components/{GridSheet/GridSheet.tsx → SheetContent/SheetContent.tsx} +100 -69
  244. package/src/components/{RangeList → SheetContent}/index.ts +1 -1
  245. package/src/components/{GridSheet → SheetContent}/util.ts +23 -16
  246. package/src/components/{SheetContext/SheetContext.tsx → SheetRoot/SheetRoot.tsx} +55 -42
  247. package/src/components/{GridSheet → SheetRoot}/index.ts +1 -1
  248. package/src/components/{FunctionEditor/FunctionEditor.tsx → SheetStatusbar/SheetStatusbar.tsx} +20 -7
  249. package/src/components/{FunctionEditor → SheetStatusbar}/index.ts +1 -1
  250. package/src/components/SheetToolbar/SheetToolbar.stories.tsx +20 -14
  251. package/src/components/SheetToolbar/SheetToolbar.tsx +62 -56
  252. package/src/components/SheetToolbar/align.ts +50 -24
  253. package/src/components/SheetToolbar/style.ts +52 -22
  254. package/src/components/SheetToolbar/useToolbarState.ts +22 -5
  255. package/src/components/index.ts +1 -7
  256. package/src/containers/RangeList/RangeList.tsx +65 -0
  257. package/src/containers/RangeList/index.ts +5 -0
  258. package/src/containers/SheetArticle/SheetArticle.stories.tsx +110 -0
  259. package/src/containers/SheetArticle/SheetArticle.tsx +57 -0
  260. package/src/containers/SheetArticle/index.ts +5 -0
  261. package/src/containers/index.ts +8 -0
  262. package/src/extensions/compute.stories.tsx +50 -36
  263. package/src/extensions/compute.ts +4 -5
  264. package/src/extensions/editor/index.ts +1 -1
  265. package/src/extensions/editor/{extension.test.ts → sheet-extension.test.ts} +2 -2
  266. package/src/extensions/editor/{extension.ts → sheet-extension.ts} +18 -15
  267. package/src/index.ts +3 -2
  268. package/src/integrations/thread-ranges.ts +22 -63
  269. package/src/meta.ts +22 -8
  270. package/src/model/sheet-model.test.ts +35 -6
  271. package/src/model/sheet-model.ts +89 -57
  272. package/src/model/testing.ts +5 -5
  273. package/src/model/useSheetModel.ts +4 -3
  274. package/src/operations/drop-axis.ts +26 -0
  275. package/src/operations/index.ts +12 -0
  276. package/src/operations/insert-axis.ts +19 -0
  277. package/src/operations/restore-axis.ts +19 -0
  278. package/src/operations/scroll-to-anchor.ts +30 -0
  279. package/src/paths.ts +11 -0
  280. package/src/playwright/playwright.config.ts +1 -1
  281. package/src/playwright/sheet-manager.ts +1 -1
  282. package/src/playwright/sheet.spec.ts +5 -4
  283. package/src/plugin.ts +11 -0
  284. package/src/sanity.test.ts +10 -4
  285. package/src/serializer.ts +4 -12
  286. package/src/testing/data.ts +2 -2
  287. package/src/testing/testing.tsx +13 -7
  288. package/src/translations.ts +43 -34
  289. package/src/types/Sheet.ts +97 -0
  290. package/src/types/SheetCapabilities.ts +26 -0
  291. package/src/types/SheetOperation.ts +84 -0
  292. package/src/types/index.ts +4 -1
  293. package/src/types/sheet-range-types.ts +5 -5
  294. package/src/types/types.ts +6 -51
  295. package/src/types/util.ts +18 -45
  296. package/src/vite-env.d.ts +10 -0
  297. package/dist/lib/browser/SheetContainer-6IWQKRJC.mjs +0 -351
  298. package/dist/lib/browser/SheetContainer-6IWQKRJC.mjs.map +0 -7
  299. package/dist/lib/browser/anchor-sort-VHURGBOY.mjs +0 -24
  300. package/dist/lib/browser/anchor-sort-VHURGBOY.mjs.map +0 -7
  301. package/dist/lib/browser/chunk-6AKBCBL4.mjs +0 -18
  302. package/dist/lib/browser/chunk-6AKBCBL4.mjs.map +0 -7
  303. package/dist/lib/browser/chunk-7HQX4NQP.mjs.map +0 -7
  304. package/dist/lib/browser/chunk-KJWZUQVA.mjs +0 -15
  305. package/dist/lib/browser/chunk-KJWZUQVA.mjs.map +0 -7
  306. package/dist/lib/browser/chunk-SI4X5GUR.mjs +0 -892
  307. package/dist/lib/browser/chunk-SI4X5GUR.mjs.map +0 -7
  308. package/dist/lib/browser/chunk-ULWNSP4B.mjs +0 -847
  309. package/dist/lib/browser/chunk-ULWNSP4B.mjs.map +0 -7
  310. package/dist/lib/browser/compute-graph-registry-VG7VP7IV.mjs +0 -30
  311. package/dist/lib/browser/compute-graph-registry-VG7VP7IV.mjs.map +0 -7
  312. package/dist/lib/browser/index.mjs +0 -153
  313. package/dist/lib/browser/index.mjs.map +0 -7
  314. package/dist/lib/browser/intent-resolver-WOJGZMSV.mjs +0 -56
  315. package/dist/lib/browser/intent-resolver-WOJGZMSV.mjs.map +0 -7
  316. package/dist/lib/browser/markdown-VXMIPUQC.mjs +0 -26
  317. package/dist/lib/browser/markdown-VXMIPUQC.mjs.map +0 -7
  318. package/dist/lib/browser/meta.json +0 -1
  319. package/dist/lib/browser/react-surface-DAHMBIQW.mjs +0 -53
  320. package/dist/lib/browser/react-surface-DAHMBIQW.mjs.map +0 -7
  321. package/dist/lib/node-esm/SheetContainer-SW55KKOT.mjs +0 -352
  322. package/dist/lib/node-esm/SheetContainer-SW55KKOT.mjs.map +0 -7
  323. package/dist/lib/node-esm/anchor-sort-CTJGOPET.mjs +0 -25
  324. package/dist/lib/node-esm/anchor-sort-CTJGOPET.mjs.map +0 -7
  325. package/dist/lib/node-esm/chunk-3K5VNYOF.mjs +0 -20
  326. package/dist/lib/node-esm/chunk-3K5VNYOF.mjs.map +0 -7
  327. package/dist/lib/node-esm/chunk-6SK5LJ5S.mjs +0 -16
  328. package/dist/lib/node-esm/chunk-6SK5LJ5S.mjs.map +0 -7
  329. package/dist/lib/node-esm/chunk-CADTJFAS.mjs +0 -893
  330. package/dist/lib/node-esm/chunk-CADTJFAS.mjs.map +0 -7
  331. package/dist/lib/node-esm/chunk-Q6UYC4G5.mjs +0 -236
  332. package/dist/lib/node-esm/chunk-Q6UYC4G5.mjs.map +0 -7
  333. package/dist/lib/node-esm/chunk-VEGX32AT.mjs +0 -848
  334. package/dist/lib/node-esm/chunk-VEGX32AT.mjs.map +0 -7
  335. package/dist/lib/node-esm/compute-graph-registry-3K3Q2A5T.mjs +0 -31
  336. package/dist/lib/node-esm/compute-graph-registry-3K3Q2A5T.mjs.map +0 -7
  337. package/dist/lib/node-esm/index.mjs +0 -154
  338. package/dist/lib/node-esm/index.mjs.map +0 -7
  339. package/dist/lib/node-esm/intent-resolver-PZRXBNIJ.mjs +0 -57
  340. package/dist/lib/node-esm/intent-resolver-PZRXBNIJ.mjs.map +0 -7
  341. package/dist/lib/node-esm/markdown-4VPQJZNZ.mjs +0 -27
  342. package/dist/lib/node-esm/markdown-4VPQJZNZ.mjs.map +0 -7
  343. package/dist/lib/node-esm/meta.json +0 -1
  344. package/dist/lib/node-esm/react-surface-Z7TVWQ4V.mjs +0 -54
  345. package/dist/lib/node-esm/react-surface-Z7TVWQ4V.mjs.map +0 -7
  346. package/dist/types/src/capabilities/capabilities.d.ts +0 -5
  347. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  348. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  349. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  350. package/dist/types/src/capabilities/markdown.d.ts +0 -6
  351. package/dist/types/src/capabilities/markdown.d.ts.map +0 -1
  352. package/dist/types/src/components/FunctionEditor/FunctionEditor.d.ts +0 -3
  353. package/dist/types/src/components/FunctionEditor/FunctionEditor.d.ts.map +0 -1
  354. package/dist/types/src/components/FunctionEditor/index.d.ts +0 -2
  355. package/dist/types/src/components/FunctionEditor/index.d.ts.map +0 -1
  356. package/dist/types/src/components/GridSheet/GridSheet.d.ts +0 -3
  357. package/dist/types/src/components/GridSheet/GridSheet.d.ts.map +0 -1
  358. package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts +0 -7
  359. package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +0 -1
  360. package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts +0 -25
  361. package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts.map +0 -1
  362. package/dist/types/src/components/GridSheet/index.d.ts +0 -2
  363. package/dist/types/src/components/GridSheet/index.d.ts.map +0 -1
  364. package/dist/types/src/components/GridSheet/util.d.ts.map +0 -1
  365. package/dist/types/src/components/RangeList/RangeList.d.ts +0 -7
  366. package/dist/types/src/components/RangeList/RangeList.d.ts.map +0 -1
  367. package/dist/types/src/components/RangeList/index.d.ts +0 -2
  368. package/dist/types/src/components/RangeList/index.d.ts.map +0 -1
  369. package/dist/types/src/components/SheetContainer/SheetContainer.d.ts +0 -11
  370. package/dist/types/src/components/SheetContainer/SheetContainer.d.ts.map +0 -1
  371. package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts +0 -8
  372. package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +0 -1
  373. package/dist/types/src/components/SheetContainer/index.d.ts +0 -3
  374. package/dist/types/src/components/SheetContainer/index.d.ts.map +0 -1
  375. package/dist/types/src/components/SheetContext/SheetContext.d.ts.map +0 -1
  376. package/dist/types/src/components/SheetContext/index.d.ts +0 -2
  377. package/dist/types/src/components/SheetContext/index.d.ts.map +0 -1
  378. package/dist/types/src/extensions/editor/extension.d.ts.map +0 -1
  379. package/dist/types/src/extensions/editor/extension.test.d.ts +0 -2
  380. package/dist/types/src/extensions/editor/extension.test.d.ts.map +0 -1
  381. package/dist/types/src/types/schema.d.ts +0 -37
  382. package/dist/types/src/types/schema.d.ts.map +0 -1
  383. package/src/capabilities/capabilities.ts +0 -14
  384. package/src/capabilities/intent-resolver.ts +0 -38
  385. package/src/capabilities/markdown.ts +0 -22
  386. package/src/components/GridSheet/GridSheet.stories.tsx +0 -53
  387. package/src/components/GridSheet/SheetCellEditor.stories.tsx +0 -93
  388. package/src/components/RangeList/RangeList.tsx +0 -60
  389. package/src/components/SheetContainer/SheetContainer.stories.tsx +0 -89
  390. package/src/components/SheetContainer/SheetContainer.tsx +0 -36
  391. package/src/components/SheetContainer/index.ts +0 -7
  392. package/src/components/SheetContext/index.ts +0 -5
  393. package/src/types/schema.ts +0 -61
  394. /package/dist/lib/{browser/types/index.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
  395. /package/dist/lib/{node-esm/types → neutral}/index.mjs.map +0 -0
@@ -0,0 +1,57 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import React from 'react';
6
+
7
+ import { type AppSurface } from '@dxos/app-toolkit/ui';
8
+ import { type ComputeGraphRegistry } from '@dxos/compute-hyperformula';
9
+ import { type Space } from '@dxos/react-client/echo';
10
+ import { Panel } from '@dxos/react-ui';
11
+
12
+ import { ComputeGraphContextProvider, Sheet, useComputeGraph } from '#components';
13
+ import { type Sheet as SheetType } from '#types';
14
+
15
+ export type SheetArticleProps = AppSurface.ObjectArticleProps<
16
+ SheetType.Sheet,
17
+ {
18
+ space: Space;
19
+ registry: ComputeGraphRegistry;
20
+ ignoreAttention?: boolean;
21
+ }
22
+ >;
23
+
24
+ export const SheetArticle = ({ registry, ...props }: SheetArticleProps) => (
25
+ <ComputeGraphContextProvider registry={registry}>
26
+ <SheetArticleInner {...props} />
27
+ </ComputeGraphContextProvider>
28
+ );
29
+
30
+ const SheetArticleInner = ({
31
+ role,
32
+ subject: sheet,
33
+ attendableId,
34
+ space,
35
+ ignoreAttention,
36
+ }: Omit<SheetArticleProps, 'registry'>) => {
37
+ const graph = useComputeGraph(space);
38
+ if (!graph) {
39
+ return null;
40
+ }
41
+
42
+ return (
43
+ <Sheet.Root graph={graph} sheet={sheet} attendableId={attendableId!} ignoreAttention={ignoreAttention}>
44
+ <Panel.Root classNames={role === 'section' && 'aspect-aquare'}>
45
+ <Panel.Toolbar asChild>
46
+ <Sheet.Toolbar />
47
+ </Panel.Toolbar>
48
+ <Panel.Content asChild>
49
+ <Sheet.Content />
50
+ </Panel.Content>
51
+ <Panel.Statusbar asChild>
52
+ <Sheet.Statusbar />
53
+ </Panel.Statusbar>
54
+ </Panel.Root>
55
+ </Sheet.Root>
56
+ );
57
+ };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ export { SheetArticle as default } from './SheetArticle';
@@ -0,0 +1,8 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { type ComponentType, lazy } from 'react';
6
+
7
+ export const RangeList: ComponentType<any> = lazy(() => import('./RangeList'));
8
+ export const SheetArticle: ComponentType<any> = lazy(() => import('./SheetArticle'));
@@ -2,31 +2,32 @@
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 { ProcessManagerPlugin } from '@dxos/app-framework';
9
+ import { withPluginManager } from '@dxos/app-framework/testing';
10
10
  import { PublicKey } from '@dxos/keys';
11
- import { useSpace } from '@dxos/react-client/echo';
11
+ import { useSpaces } from '@dxos/react-client/echo';
12
12
  import { withClientProvider } from '@dxos/react-client/testing';
13
13
  import { useThemeContext } from '@dxos/react-ui';
14
+ import { useTextEditor } from '@dxos/react-ui-editor';
15
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
14
16
  import {
15
17
  createBasicExtensions,
16
18
  createMarkdownExtensions,
17
19
  createThemeExtensions,
18
20
  decorateMarkdown,
19
21
  documentId,
20
- useTextEditor,
21
- } from '@dxos/react-ui-editor';
22
- import { withTheme, withLayout } from '@dxos/storybook-utils';
22
+ } from '@dxos/ui-editor';
23
23
  import { isNonNullable } from '@dxos/util';
24
24
 
25
- import { compute, computeGraphFacet } from './compute';
26
- import { GridSheet, SheetProvider, useComputeGraph } from '../components';
25
+ import { Sheet, useComputeGraph } from '#components';
26
+ import { useTestSheet, withComputeGraphDecorator } from '#testing';
27
+ import { Sheet as SheetType } from '#types';
28
+
27
29
  import { useSheetModel } from '../model';
28
- import { useTestSheet, withComputeGraphDecorator } from '../testing';
29
- import { SheetType } from '../types';
30
+ import { compute, computeGraphFacet } from './compute';
30
31
 
31
32
  const str = (...lines: string[]) => lines.join('\n');
32
33
 
@@ -41,17 +42,17 @@ 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
- const space = useSpace();
48
+ const [space] = useSpaces();
48
49
  const computeGraph = useComputeGraph(space);
49
50
  const { parentRef, focusAttributes } = useTextEditor(
50
51
  () => ({
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),
@@ -66,13 +67,18 @@ const EditorStory = ({ text }: EditorProps) => {
66
67
  };
67
68
 
68
69
  const Grid = () => {
69
- const space = useSpace();
70
+ const [space] = useSpaces();
70
71
  const graph = useComputeGraph(space);
71
72
  const sheet = useTestSheet(space, graph, { name: SHEET_NAME });
72
73
  const model = useSheetModel(graph, sheet);
73
74
  useEffect(() => {
74
75
  if (model) {
75
- model.setValues({ A1: { value: 100 }, A2: { value: 200 }, A3: { value: 300 }, A5: { value: '=SUM(A1:A3)' } });
76
+ model.setValues({
77
+ A1: { value: 100 },
78
+ A2: { value: 200 },
79
+ A3: { value: 300 },
80
+ A5: { value: '=SUM(A1:A3)' },
81
+ });
76
82
  }
77
83
  }, [model]);
78
84
 
@@ -82,9 +88,9 @@ const Grid = () => {
82
88
 
83
89
  return (
84
90
  <div className='flex w-[40rem] overflow-hidden'>
85
- <SheetProvider graph={graph} sheet={sheet}>
86
- <GridSheet />
87
- </SheetProvider>
91
+ <Sheet.Root graph={graph} sheet={sheet} attendableId='test'>
92
+ <Sheet.Content />
93
+ </Sheet.Root>
88
94
  </div>
89
95
  );
90
96
  };
@@ -92,15 +98,36 @@ const Grid = () => {
92
98
  const GraphStory = (props: EditorProps) => {
93
99
  return (
94
100
  <div className='grid grid-rows-2'>
95
- <EditorStory {...props} />
101
+ <DefaultStory {...props} />
96
102
  <Grid />
97
103
  </div>
98
104
  );
99
105
  };
100
106
 
107
+ const meta = {
108
+ title: 'plugins/plugin-sheet/extensions/compute',
109
+ decorators: [
110
+ withTheme(),
111
+ withLayout({ layout: 'fullscreen' }),
112
+ withClientProvider({
113
+ types: [SheetType.Sheet],
114
+ createIdentity: true,
115
+ createSpace: true,
116
+ }),
117
+ // TODO(wittjosiah): Try to write story which does not depend on plugin manager.
118
+ withPluginManager({ plugins: [ProcessManagerPlugin()] }),
119
+ withComputeGraphDecorator(),
120
+ ],
121
+ parameters: {
122
+ layout: 'fullscreen',
123
+ },
124
+ } satisfies Meta;
125
+
126
+ export default meta;
127
+
101
128
  // TODO(burdon): Inline formulae.
102
- export const Default = {
103
- render: EditorStory,
129
+ export const Default: StoryObj<typeof DefaultStory> = {
130
+ render: DefaultStory,
104
131
  args: {
105
132
  text: str(
106
133
  //
@@ -123,7 +150,7 @@ export const Default = {
123
150
  },
124
151
  };
125
152
 
126
- export const Graph = {
153
+ export const Graph: StoryObj<typeof GraphStory> = {
127
154
  render: GraphStory,
128
155
  args: {
129
156
  text: str(
@@ -140,16 +167,3 @@ export const Graph = {
140
167
  ),
141
168
  },
142
169
  };
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,14 +16,14 @@ 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,
24
- } from '@dxos/compute';
23
+ createSheetName,
24
+ } from '@dxos/compute-hyperformula';
25
25
  import { invariant } from '@dxos/invariant';
26
- import { documentId, singleValueFacet } from '@dxos/react-ui-editor';
26
+ import { documentId, singleValueFacet } from '@dxos/ui-editor';
27
27
 
28
28
  const LANGUAGE_TAG = 'dx';
29
29
 
@@ -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';
@@ -8,9 +8,9 @@ import { testTree } from '@lezer/generator/test';
8
8
  import { spreadsheet } from 'codemirror-lang-spreadsheet';
9
9
  import { describe, expect, test } from 'vitest';
10
10
 
11
- import { defaultFunctions } from '@dxos/compute';
11
+ import { defaultFunctions } from '@dxos/compute-hyperformula';
12
12
 
13
- import { sheetExtension } from './extension';
13
+ import { sheetExtension } from './sheet-extension';
14
14
 
15
15
  describe('formula parser', () => {
16
16
  const {
@@ -18,10 +18,10 @@ import { type SyntaxNode } from '@lezer/common';
18
18
  import { tags } from '@lezer/highlight';
19
19
  import { spreadsheet } from 'codemirror-lang-spreadsheet';
20
20
 
21
- import { type FunctionDefinition } from '@dxos/compute';
22
- import { RANGE_NOTATION } from '@dxos/compute';
23
- import { singleValueFacet } from '@dxos/react-ui-editor';
24
- import { mx } from '@dxos/react-ui-theme';
21
+ import { type FunctionDefinition } from '@dxos/compute-hyperformula';
22
+ import { RANGE_NOTATION } from '@dxos/compute-hyperformula';
23
+ import { singleValueFacet } from '@dxos/ui-editor';
24
+ import { mx } from '@dxos/ui-theme';
25
25
 
26
26
  /**
27
27
  * https://codemirror.net/examples/styling
@@ -33,30 +33,30 @@ const highlightStyles = HighlightStyle.define([
33
33
  // Function.
34
34
  {
35
35
  tag: tags.name,
36
- class: 'text-accentText',
36
+ class: 'text-accent-text',
37
37
  },
38
38
  // Range.
39
39
  {
40
40
  tag: tags.tagName,
41
- class: 'text-pinkText',
41
+ class: 'text-pink-text',
42
42
  },
43
43
  // Values.
44
44
  {
45
45
  tag: tags.number,
46
- class: 'text-tealText',
46
+ class: 'text-teal-text',
47
47
  },
48
48
  {
49
49
  tag: tags.bool,
50
- class: 'text-tealText',
50
+ class: 'text-teal-text',
51
51
  },
52
52
  {
53
53
  tag: tags.string,
54
- class: 'text-tealText',
54
+ class: 'text-teal-text',
55
55
  },
56
56
  // Error.
57
57
  {
58
58
  tag: tags.invalid,
59
- class: 'text-unAccent',
59
+ class: 'text-un-accent',
60
60
  },
61
61
  ]);
62
62
 
@@ -75,7 +75,10 @@ export type SheetExtensionOptions = {
75
75
  * https://hyperformula.handsontable.com/guide/key-concepts.html#grammar
76
76
  */
77
77
  export const sheetExtension = ({ debug, functions = [] }: SheetExtensionOptions): Extension => {
78
- const { extension, language } = spreadsheet({ idiom: 'en-US', decimalSeparator: '.' });
78
+ const { extension, language } = spreadsheet({
79
+ idiom: 'en-US',
80
+ decimalSeparator: '.',
81
+ });
79
82
 
80
83
  const createCompletion = (name: string) => {
81
84
  const { section = 'Custom', description, syntax } = functions.find((value) => value.name === name) ?? {};
@@ -94,7 +97,7 @@ export const sheetExtension = ({ debug, functions = [] }: SheetExtensionOptions)
94
97
 
95
98
  const title = document.createElement('h2');
96
99
  title.innerText = name;
97
- title.className = 'text-lg font-mono text-accentText';
100
+ title.className = 'text-lg font-mono text-accent-text';
98
101
  root.appendChild(title);
99
102
 
100
103
  if (description) {
@@ -107,7 +110,7 @@ export const sheetExtension = ({ debug, functions = [] }: SheetExtensionOptions)
107
110
  if (syntax) {
108
111
  const detail = document.createElement('pre');
109
112
  detail.innerText = syntax;
110
- detail.className = 'whitespace-pre-wrap text-greenText';
113
+ detail.className = 'whitespace-pre-wrap text-green-text';
111
114
  root.appendChild(detail);
112
115
  }
113
116
 
@@ -166,8 +169,8 @@ export const sheetExtension = ({ debug, functions = [] }: SheetExtensionOptions)
166
169
  icons: false,
167
170
  tooltipClass: () =>
168
171
  mx(
169
- '!-left-[1px] !top-[33px] !-m-0 border !border-t-0 [&>ul]:!min-w-[198px]',
170
- '[&>ul>li[aria-selected]]:!bg-accentSurface',
172
+ '!-left-[1px] !top-[33px] !-m-0 border border-h-0! [&>ul]:!min-w-[198px]',
173
+ '[&>ul>li[aria-selected]]:!bg-accent-bg',
171
174
  'border-separator',
172
175
  ),
173
176
  }),
package/src/index.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- export { SheetCapabilities } from './capabilities';
6
5
  export * from './meta';
7
- export * from './SheetPlugin';
6
+ export * from './operations';
7
+ export * from './paths';
8
+ export * from './types';
@@ -2,28 +2,19 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Schema, pipe } from 'effect';
6
5
  import { useCallback, useEffect, useMemo } from 'react';
7
6
 
8
- import {
9
- createIntent,
10
- createResolver,
11
- LayoutAction,
12
- useIntentResolver,
13
- useIntentDispatcher,
14
- chain,
15
- } from '@dxos/app-framework';
7
+ import { useOperationInvoker } from '@dxos/app-framework/ui';
8
+ import { LayoutOperation } from '@dxos/app-toolkit';
16
9
  import { debounce } from '@dxos/async';
17
- import { type CellAddress, type CompleteCellRange, inRange } from '@dxos/compute';
18
- import { Obj, Relation } from '@dxos/echo';
19
- 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';
22
- import { type DxGridElement, type DxGridPosition, type GridContentProps } from '@dxos/react-ui-grid';
23
- import { AnchoredTo } from '@dxos/schema';
10
+ import { type CellAddress, type CompleteCellRange, inRange } from '@dxos/compute-hyperformula';
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';
15
+ import { AnchoredTo, Thread } from '@dxos/types';
24
16
 
25
- import { useSheetContext } from '../components';
26
- import { SHEET_PLUGIN } from '../meta';
17
+ import { useSheetContext } from '#components';
27
18
 
28
19
  export const completeCellRangeToThreadCursor = (range: CompleteCellRange): string => {
29
20
  return `${range.from.col},${range.from.row},${range.to.col},${range.to.row}`;
@@ -42,45 +33,12 @@ export const parseThreadAnchorAsCellRange = (cursor: string): CompleteCellRange
42
33
  }
43
34
  };
44
35
 
45
- export const useUpdateFocusedCellOnThreadSelection = (grid: DxGridElement | null) => {
46
- const { model, setActiveRefs } = useSheetContext();
47
- const scrollIntoViewResolver = useMemo(
48
- () =>
49
- createResolver({
50
- intent: LayoutAction.ScrollIntoView,
51
- position: 'hoist',
52
- filter: (
53
- data,
54
- ): data is {
55
- part: 'current';
56
- subject: string;
57
- options: { cursor: string; ref: GridContentProps['activeRefs'] };
58
- } => {
59
- if (!Schema.is(LayoutAction.ScrollIntoView.fields.input)(data)) {
60
- return false;
61
- }
62
-
63
- return data.subject === fullyQualifiedId(model.sheet) && !!data.options?.cursor;
64
- },
65
- resolve: ({ options: { cursor, ref } }) => {
66
- setActiveRefs(ref);
67
- // TODO(Zan): Everywhere we refer to the cursor in a thread context should change to `anchor`.
68
- const range = parseThreadAnchorAsCellRange(cursor!);
69
- range && grid?.setFocus({ ...range.to, plane: 'grid' }, true);
70
- },
71
- }),
72
- [model.sheet, setActiveRefs],
73
- );
74
-
75
- useIntentResolver(SHEET_PLUGIN, scrollIntoViewResolver);
76
- };
77
-
78
36
  export const useSelectThreadOnCellFocus = () => {
79
37
  const { model, cursor } = useSheetContext();
80
- const { dispatchPromise: dispatch } = useIntentDispatcher();
38
+ const { invokePromise } = useOperationInvoker();
81
39
 
82
- const space = getSpace(model.sheet);
83
- const anchors = useQuery(space, Query.select(Filter.ids(model.sheet.id)).targetOf(AnchoredTo));
40
+ const db = Obj.getDatabase(model.sheet);
41
+ const anchors = useQuery(db, Query.select(Filter.id(model.sheet.id)).targetOf(AnchoredTo.AnchoredTo));
84
42
 
85
43
  const selectClosestThread = useCallback(
86
44
  (cellAddress: CellAddress) => {
@@ -90,7 +48,7 @@ export const useSelectThreadOnCellFocus = () => {
90
48
 
91
49
  const closestThread = anchors.find((anchor) => {
92
50
  const source = Relation.getSource(anchor);
93
- if (anchor.anchor && Obj.instanceOf(ThreadType, source)) {
51
+ if (anchor.anchor && Obj.instanceOf(Thread.Thread, source)) {
94
52
  const range = parseThreadAnchorAsCellRange(anchor.anchor);
95
53
  return range ? inRange(range, cellAddress) : false;
96
54
  } else {
@@ -99,25 +57,26 @@ export const useSelectThreadOnCellFocus = () => {
99
57
  });
100
58
 
101
59
  if (closestThread) {
102
- const primary = fullyQualifiedId(model.sheet);
103
- const intent = pipe(
104
- createIntent(ThreadAction.Select, { current: fullyQualifiedId(closestThread) }),
105
- chain(DeckAction.ChangeCompanion, { primary, companion: `${primary}${ATTENDABLE_PATH_SEPARATOR}comments` }),
106
- );
107
- void dispatch(intent);
60
+ void (async () => {
61
+ await invokePromise(CommentOperation.Select, { current: Relation.getURI(closestThread) });
62
+ await invokePromise(LayoutOperation.UpdateCompanion, {
63
+ subject: linkedSegment('comments'),
64
+ });
65
+ })();
108
66
  }
109
67
  },
110
- [dispatch, anchors],
68
+ [invokePromise, anchors],
111
69
  );
112
70
 
113
71
  const debounced = useMemo(() => {
114
- return debounce((cellCoords: DxGridPosition) => requestAnimationFrame(() => selectClosestThread(cellCoords)), 50);
72
+ return debounce((cellCoords: CellAddress) => requestAnimationFrame(() => selectClosestThread(cellCoords)), 50);
115
73
  }, [selectClosestThread]);
116
74
 
117
75
  useEffect(() => {
118
76
  if (!cursor) {
119
77
  return;
120
78
  }
79
+
121
80
  debounced(cursor);
122
81
  }, [cursor, debounced]);
123
82
  };
package/src/meta.ts CHANGED
@@ -2,16 +2,30 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { type PluginMeta } from '@dxos/app-framework';
5
+ import { Plugin } from '@dxos/app-framework';
6
+ import { DXN } from '@dxos/keys';
7
+ import { trim } from '@dxos/util';
6
8
 
7
- export const SHEET_PLUGIN = 'dxos.org/plugin/sheet';
8
-
9
- export const meta: PluginMeta = {
10
- id: SHEET_PLUGIN,
9
+ export const meta = Plugin.makeMeta({
10
+ key: DXN.make('org.dxos.plugin.sheet'),
11
11
  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. ',
12
+ author: 'DXOS',
13
+ description: trim`
14
+ Full-featured spreadsheet for DXOS Composer backed by ECHO for local-first, real-time collaborative editing.
15
+ Cells, row/column metadata, and range-based formatting are all stored as ECHO objects and replicated to peers instantly.
16
+
17
+ Formula evaluation is powered by HyperFormula, providing over 400 built-in functions covering arithmetic, statistics,
18
+ text manipulation, date/time, financial, and logical operations. Formulas are stored with internal cell indices and
19
+ translated to A1-notation on display, keeping references stable across row and column insertions.
20
+
21
+ The plugin integrates with plugin-markdown to expose formula results inside document fenced code blocks, and
22
+ contributes anchor-navigation support so other plugins can scroll and highlight specific cell ranges by DXN reference.
23
+ AI agents can invoke sheet operations — insert/drop axes, scroll to anchor, and read or write cell values — through
24
+ the standard operations framework.
25
+ `,
14
26
  icon: 'ph--grid-nine--regular',
27
+ iconHue: 'indigo',
15
28
  source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-sheet',
29
+ spec: 'PLUGIN.mdl',
16
30
  screenshots: ['https://dxos.network/plugin-details-sheet-dark.png'],
17
- };
31
+ });
@@ -5,19 +5,20 @@
5
5
  import { afterEach, beforeEach, describe, expect, onTestFinished, test } from 'vitest';
6
6
 
7
7
  import { Trigger } from '@dxos/async';
8
- import { type CellScalarValue, addressFromA1Notation, isFormula } from '@dxos/compute';
9
- import { TestBuilder, testFunctionPlugins } from '@dxos/compute/testing';
10
- import { FunctionType } from '@dxos/functions';
8
+ import { Operation } from '@dxos/compute';
9
+ import { type CellScalarValue, addressFromA1Notation, isFormula } from '@dxos/compute-hyperformula';
10
+ import { TestBuilder, testFunctionPlugins } from '@dxos/compute-hyperformula/testing';
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: [Operation.PersistentOperation], 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());
@@ -59,6 +60,34 @@ describe('SheetModel', () => {
59
60
  expect(graph.context.info.invocations.TEST).to.eq(1);
60
61
  });
61
62
 
63
+ test('drop row shifts values and updates sum', async () => {
64
+ const space = await testBuilder.client.spaces.create();
65
+ const graph = testBuilder.registry.createGraph(space);
66
+ await graph.open();
67
+
68
+ const sheet = Sheet.make({ rows: 10, columns: 5 });
69
+ const model = new SheetModel(graph, sheet);
70
+ await model.open();
71
+ onTestFinished(() => void model.close());
72
+
73
+ // Column A: rows 0..2 = 123, 789, 567; row 3 = SUM(A0:A2).
74
+ model.setValue({ col: 0, row: 0 }, 123);
75
+ model.setValue({ col: 0, row: 1 }, 789);
76
+ model.setValue({ col: 0, row: 2 }, 567);
77
+ model.setValue({ col: 0, row: 3 }, '=SUM(A1:A3)');
78
+
79
+ expect(model.getValue({ col: 0, row: 3 })).to.eq(123 + 789 + 567);
80
+
81
+ // Delete the middle row (789).
82
+ const rowId = sheet.rows[1];
83
+ model.dropRow(rowId);
84
+
85
+ // Values shift up: row 1 = 567, row 2 = SUM(123 + 567).
86
+ expect(model.getValue({ col: 0, row: 0 })).to.eq(123);
87
+ expect(model.getValue({ col: 0, row: 1 })).to.eq(567);
88
+ expect(model.getValue({ col: 0, row: 2 })).to.eq(123 + 567);
89
+ });
90
+
62
91
  test('formula', async () => {
63
92
  const space = await testBuilder.client.spaces.create();
64
93
  const graph = testBuilder.registry.createGraph(space);