@dxos/plugin-sheet 0.8.4-main.406dc2a → 0.8.4-main.4f23b4e393

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 (355) hide show
  1. package/dist/lib/neutral/RangeList-HYB5S6KQ.mjs +46 -0
  2. package/dist/lib/neutral/RangeList-HYB5S6KQ.mjs.map +7 -0
  3. package/dist/lib/neutral/SheetContainer-ZOVKGHLT.mjs +33 -0
  4. package/dist/lib/neutral/SheetContainer-ZOVKGHLT.mjs.map +7 -0
  5. package/dist/lib/neutral/SheetPlugin.mjs +48 -0
  6. package/dist/lib/neutral/SheetPlugin.mjs.map +7 -0
  7. package/dist/lib/neutral/SheetPlugin.node.mjs +27 -0
  8. package/dist/lib/neutral/SheetPlugin.node.mjs.map +7 -0
  9. package/dist/lib/neutral/anchor-sort-TTCKGX7V.mjs +22 -0
  10. package/dist/lib/neutral/anchor-sort-TTCKGX7V.mjs.map +7 -0
  11. package/dist/lib/neutral/capabilities/index.mjs +25 -0
  12. package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
  13. package/dist/lib/{browser/chunk-SSN4HYJL.mjs → neutral/chunk-4SBAIU6F.mjs} +19 -19
  14. package/dist/lib/neutral/chunk-4SBAIU6F.mjs.map +7 -0
  15. package/dist/lib/neutral/chunk-FZWVUKE2.mjs +8 -0
  16. package/dist/lib/neutral/chunk-FZWVUKE2.mjs.map +7 -0
  17. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  18. package/dist/lib/neutral/chunk-KC2SMDNF.mjs +373 -0
  19. package/dist/lib/neutral/chunk-KC2SMDNF.mjs.map +7 -0
  20. package/dist/lib/neutral/chunk-YFY6U524.mjs +83 -0
  21. package/dist/lib/neutral/chunk-YFY6U524.mjs.map +7 -0
  22. package/dist/lib/neutral/chunk-ZWOQCLH7.mjs +21 -0
  23. package/dist/lib/neutral/chunk-ZWOQCLH7.mjs.map +7 -0
  24. package/dist/lib/neutral/comment-config-ZBWNCJMZ.mjs +20 -0
  25. package/dist/lib/neutral/comment-config-ZBWNCJMZ.mjs.map +7 -0
  26. package/dist/lib/neutral/components/index.mjs +1551 -0
  27. package/dist/lib/neutral/components/index.mjs.map +7 -0
  28. package/dist/lib/neutral/compute-graph-registry-IEQBF5XZ.mjs +20 -0
  29. package/dist/lib/neutral/compute-graph-registry-IEQBF5XZ.mjs.map +7 -0
  30. package/dist/lib/neutral/containers/index.mjs +11 -0
  31. package/dist/lib/neutral/containers/index.mjs.map +7 -0
  32. package/dist/lib/neutral/create-object-OKQAXJCW.mjs +27 -0
  33. package/dist/lib/neutral/create-object-OKQAXJCW.mjs.map +7 -0
  34. package/dist/lib/neutral/drop-axis-G6UOXG54.mjs +23 -0
  35. package/dist/lib/neutral/drop-axis-G6UOXG54.mjs.map +7 -0
  36. package/dist/lib/{node-esm/types → neutral}/index.mjs +16 -13
  37. package/dist/lib/neutral/insert-axis-ZFFNG22G.mjs +16 -0
  38. package/dist/lib/neutral/insert-axis-ZFFNG22G.mjs.map +7 -0
  39. package/dist/lib/neutral/markdown-I2AKJYPF.mjs +28 -0
  40. package/dist/lib/neutral/markdown-I2AKJYPF.mjs.map +7 -0
  41. package/dist/lib/neutral/meta.json +1 -0
  42. package/dist/lib/neutral/meta.mjs +8 -0
  43. package/dist/lib/neutral/meta.mjs.map +7 -0
  44. package/dist/lib/neutral/operation-handler-TB6LFV2H.mjs +13 -0
  45. package/dist/lib/neutral/operation-handler-TB6LFV2H.mjs.map +7 -0
  46. package/dist/lib/neutral/operations/index.mjs +8 -0
  47. package/dist/lib/neutral/operations/index.mjs.map +7 -0
  48. package/dist/lib/neutral/plugin.mjs +16 -0
  49. package/dist/lib/neutral/plugin.mjs.map +7 -0
  50. package/dist/lib/neutral/react-surface-UYA3OYHT.mjs +44 -0
  51. package/dist/lib/neutral/react-surface-UYA3OYHT.mjs.map +7 -0
  52. package/dist/lib/neutral/restore-axis-44DM6N54.mjs +16 -0
  53. package/dist/lib/neutral/restore-axis-44DM6N54.mjs.map +7 -0
  54. package/dist/lib/neutral/scroll-to-anchor-QPOGMAQG.mjs +33 -0
  55. package/dist/lib/neutral/scroll-to-anchor-QPOGMAQG.mjs.map +7 -0
  56. package/dist/lib/neutral/state-HPA27MX2.mjs +29 -0
  57. package/dist/lib/neutral/state-HPA27MX2.mjs.map +7 -0
  58. package/dist/lib/neutral/testing/index.mjs +103 -0
  59. package/dist/lib/neutral/testing/index.mjs.map +7 -0
  60. package/dist/lib/neutral/translations.mjs +55 -0
  61. package/dist/lib/neutral/translations.mjs.map +7 -0
  62. package/dist/lib/{browser → neutral}/types/index.mjs +8 -12
  63. package/dist/lib/neutral/types/index.mjs.map +7 -0
  64. package/dist/lib/neutral/undo-mappings-3FQLSTCZ.mjs +31 -0
  65. package/dist/lib/neutral/undo-mappings-3FQLSTCZ.mjs.map +7 -0
  66. package/dist/types/src/SheetPlugin.d.ts +3 -1
  67. package/dist/types/src/SheetPlugin.d.ts.map +1 -1
  68. package/dist/types/src/SheetPlugin.node.d.ts +4 -0
  69. package/dist/types/src/SheetPlugin.node.d.ts.map +1 -0
  70. package/dist/types/src/SheetPlugin.test.d.ts +2 -0
  71. package/dist/types/src/SheetPlugin.test.d.ts.map +1 -0
  72. package/dist/types/src/capabilities/anchor-sort.d.ts +4 -4
  73. package/dist/types/src/capabilities/anchor-sort.d.ts.map +1 -1
  74. package/dist/types/src/capabilities/comment-config.d.ts +12 -0
  75. package/dist/types/src/capabilities/comment-config.d.ts.map +1 -0
  76. package/dist/types/src/capabilities/compute-graph-registry.d.ts +3 -2
  77. package/dist/types/src/capabilities/compute-graph-registry.d.ts.map +1 -1
  78. package/dist/types/src/capabilities/create-object.d.ts +11 -0
  79. package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
  80. package/dist/types/src/capabilities/index.d.ts +23 -9
  81. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  82. package/dist/types/src/capabilities/markdown.d.ts +3 -2
  83. package/dist/types/src/capabilities/markdown.d.ts.map +1 -1
  84. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  85. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  86. package/dist/types/src/capabilities/react-surface.d.ts +3 -2
  87. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  88. package/dist/types/src/capabilities/state.d.ts +6 -0
  89. package/dist/types/src/capabilities/state.d.ts.map +1 -0
  90. package/dist/types/src/capabilities/undo-mappings.d.ts +5 -0
  91. package/dist/types/src/capabilities/undo-mappings.d.ts.map +1 -0
  92. package/dist/types/src/components/ComputeGraph/ComputeGraphContextProvider.d.ts +1 -1
  93. package/dist/types/src/components/ComputeGraph/ComputeGraphContextProvider.d.ts.map +1 -1
  94. package/dist/types/src/components/ComputeGraph/compute-graph.stories.d.ts.map +1 -1
  95. package/dist/types/src/components/Sheet/Sheet.d.ts +17 -0
  96. package/dist/types/src/components/Sheet/Sheet.d.ts.map +1 -0
  97. package/dist/types/src/components/Sheet/index.d.ts +2 -0
  98. package/dist/types/src/components/Sheet/index.d.ts.map +1 -0
  99. package/dist/types/src/components/{GridSheet → SheetContent}/SheetCellEditor.stories.d.ts +1 -1
  100. package/dist/types/src/components/SheetContent/SheetCellEditor.stories.d.ts.map +1 -0
  101. package/dist/types/src/components/SheetContent/SheetContent.d.ts +6 -0
  102. package/dist/types/src/components/SheetContent/SheetContent.d.ts.map +1 -0
  103. package/dist/types/src/components/SheetContent/SheetContent.stories.d.ts +93 -0
  104. package/dist/types/src/components/SheetContent/SheetContent.stories.d.ts.map +1 -0
  105. package/dist/types/src/components/SheetContent/index.d.ts +2 -0
  106. package/dist/types/src/components/SheetContent/index.d.ts.map +1 -0
  107. package/dist/types/src/components/{GridSheet → SheetContent}/util.d.ts +1 -1
  108. package/dist/types/src/components/SheetContent/util.d.ts.map +1 -0
  109. package/dist/types/src/components/{SheetContext/SheetContext.d.ts → SheetRoot/SheetRoot.d.ts} +9 -7
  110. package/dist/types/src/components/SheetRoot/SheetRoot.d.ts.map +1 -0
  111. package/dist/types/src/components/SheetRoot/index.d.ts +2 -0
  112. package/dist/types/src/components/SheetRoot/index.d.ts.map +1 -0
  113. package/dist/types/src/components/SheetStatusbar/SheetStatusbar.d.ts +6 -0
  114. package/dist/types/src/components/SheetStatusbar/SheetStatusbar.d.ts.map +1 -0
  115. package/dist/types/src/components/SheetStatusbar/index.d.ts +2 -0
  116. package/dist/types/src/components/SheetStatusbar/index.d.ts.map +1 -0
  117. package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts +5 -6
  118. package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts.map +1 -1
  119. package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts +72 -66
  120. package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts.map +1 -1
  121. package/dist/types/src/components/SheetToolbar/align.d.ts +14 -21
  122. package/dist/types/src/components/SheetToolbar/align.d.ts.map +1 -1
  123. package/dist/types/src/components/SheetToolbar/style.d.ts +14 -20
  124. package/dist/types/src/components/SheetToolbar/style.d.ts.map +1 -1
  125. package/dist/types/src/components/SheetToolbar/useToolbarState.d.ts +14 -1
  126. package/dist/types/src/components/SheetToolbar/useToolbarState.d.ts.map +1 -1
  127. package/dist/types/src/components/index.d.ts +1 -4
  128. package/dist/types/src/components/index.d.ts.map +1 -1
  129. package/dist/types/src/containers/RangeList/RangeList.d.ts +7 -0
  130. package/dist/types/src/containers/RangeList/RangeList.d.ts.map +1 -0
  131. package/dist/types/src/containers/RangeList/index.d.ts +2 -0
  132. package/dist/types/src/containers/RangeList/index.d.ts.map +1 -0
  133. package/dist/types/src/containers/SheetContainer/SheetContainer.d.ts +12 -0
  134. package/dist/types/src/containers/SheetContainer/SheetContainer.d.ts.map +1 -0
  135. package/dist/types/src/containers/SheetContainer/SheetContainer.stories.d.ts +92 -0
  136. package/dist/types/src/containers/SheetContainer/SheetContainer.stories.d.ts.map +1 -0
  137. package/dist/types/src/containers/SheetContainer/index.d.ts +2 -0
  138. package/dist/types/src/containers/SheetContainer/index.d.ts.map +1 -0
  139. package/dist/types/src/containers/index.d.ts +4 -0
  140. package/dist/types/src/containers/index.d.ts.map +1 -0
  141. package/dist/types/src/extensions/compute.d.ts +1 -1
  142. package/dist/types/src/extensions/compute.d.ts.map +1 -1
  143. package/dist/types/src/extensions/compute.stories.d.ts.map +1 -1
  144. package/dist/types/src/extensions/editor/sheet-extension.d.ts +1 -1
  145. package/dist/types/src/extensions/editor/sheet-extension.d.ts.map +1 -1
  146. package/dist/types/src/index.d.ts +2 -2
  147. package/dist/types/src/index.d.ts.map +1 -1
  148. package/dist/types/src/integrations/thread-ranges.d.ts +1 -3
  149. package/dist/types/src/integrations/thread-ranges.d.ts.map +1 -1
  150. package/dist/types/src/meta.d.ts +2 -2
  151. package/dist/types/src/meta.d.ts.map +1 -1
  152. package/dist/types/src/model/sheet-model.d.ts +7 -7
  153. package/dist/types/src/model/sheet-model.d.ts.map +1 -1
  154. package/dist/types/src/model/testing.d.ts +2 -2
  155. package/dist/types/src/model/testing.d.ts.map +1 -1
  156. package/dist/types/src/model/useSheetModel.d.ts +3 -3
  157. package/dist/types/src/model/useSheetModel.d.ts.map +1 -1
  158. package/dist/types/src/operations/drop-axis.d.ts +5 -0
  159. package/dist/types/src/operations/drop-axis.d.ts.map +1 -0
  160. package/dist/types/src/operations/index.d.ts +3 -0
  161. package/dist/types/src/operations/index.d.ts.map +1 -0
  162. package/dist/types/src/operations/insert-axis.d.ts +5 -0
  163. package/dist/types/src/operations/insert-axis.d.ts.map +1 -0
  164. package/dist/types/src/operations/restore-axis.d.ts +5 -0
  165. package/dist/types/src/operations/restore-axis.d.ts.map +1 -0
  166. package/dist/types/src/operations/scroll-to-anchor.d.ts +5 -0
  167. package/dist/types/src/operations/scroll-to-anchor.d.ts.map +1 -0
  168. package/dist/types/src/playwright/playwright.config.d.ts.map +1 -1
  169. package/dist/types/src/playwright/sheet-manager.d.ts.map +1 -1
  170. package/dist/types/src/plugin.d.ts +4 -0
  171. package/dist/types/src/plugin.d.ts.map +1 -0
  172. package/dist/types/src/serializer.d.ts +3 -3
  173. package/dist/types/src/serializer.d.ts.map +1 -1
  174. package/dist/types/src/testing/data.d.ts +2 -2
  175. package/dist/types/src/testing/data.d.ts.map +1 -1
  176. package/dist/types/src/testing/testing.d.ts +27 -3
  177. package/dist/types/src/testing/testing.d.ts.map +1 -1
  178. package/dist/types/src/translations.d.ts +74 -38
  179. package/dist/types/src/translations.d.ts.map +1 -1
  180. package/dist/types/src/types/Sheet.d.ts +76 -0
  181. package/dist/types/src/types/Sheet.d.ts.map +1 -0
  182. package/dist/types/src/types/SheetCapabilities.d.ts +16 -0
  183. package/dist/types/src/types/SheetCapabilities.d.ts.map +1 -0
  184. package/dist/types/src/types/SheetOperation.d.ts +45 -0
  185. package/dist/types/src/types/SheetOperation.d.ts.map +1 -0
  186. package/dist/types/src/types/index.d.ts +3 -1
  187. package/dist/types/src/types/index.d.ts.map +1 -1
  188. package/dist/types/src/types/sheet-range-types.d.ts +2 -2
  189. package/dist/types/src/types/sheet-range-types.d.ts.map +1 -1
  190. package/dist/types/src/types/types.d.ts +2 -77
  191. package/dist/types/src/types/types.d.ts.map +1 -1
  192. package/dist/types/src/types/util.d.ts +11 -11
  193. package/dist/types/src/types/util.d.ts.map +1 -1
  194. package/dist/types/tsconfig.tsbuildinfo +1 -1
  195. package/package.json +129 -79
  196. package/src/SheetPlugin.node.ts +21 -0
  197. package/src/SheetPlugin.test.ts +30 -0
  198. package/src/SheetPlugin.tsx +37 -67
  199. package/src/capabilities/anchor-sort.ts +20 -15
  200. package/src/capabilities/comment-config.ts +24 -0
  201. package/src/capabilities/compute-graph-registry.ts +19 -13
  202. package/src/capabilities/create-object.ts +30 -0
  203. package/src/capabilities/index.ts +16 -8
  204. package/src/capabilities/markdown.ts +21 -13
  205. package/src/capabilities/operation-handler.ts +16 -0
  206. package/src/capabilities/react-surface.tsx +38 -29
  207. package/src/capabilities/state.ts +29 -0
  208. package/src/capabilities/undo-mappings.ts +30 -0
  209. package/src/components/ComputeGraph/ComputeGraphContextProvider.tsx +1 -1
  210. package/src/components/ComputeGraph/compute-graph.stories.tsx +20 -18
  211. package/src/components/Sheet/Sheet.tsx +20 -0
  212. package/src/components/Sheet/index.ts +5 -0
  213. package/src/components/{GridSheet → SheetContent}/SheetCellEditor.stories.tsx +17 -13
  214. package/src/components/SheetContent/SheetContent.stories.tsx +60 -0
  215. package/src/components/{GridSheet/GridSheet.tsx → SheetContent/SheetContent.tsx} +82 -52
  216. package/src/components/{RangeList → SheetContent}/index.ts +1 -1
  217. package/src/components/{GridSheet → SheetContent}/util.ts +17 -10
  218. package/src/components/{SheetContext/SheetContext.tsx → SheetRoot/SheetRoot.tsx} +55 -42
  219. package/src/components/{GridSheet → SheetRoot}/index.ts +1 -1
  220. package/src/components/{FunctionEditor/FunctionEditor.tsx → SheetStatusbar/SheetStatusbar.tsx} +19 -7
  221. package/src/components/{FunctionEditor → SheetStatusbar}/index.ts +1 -1
  222. package/src/components/SheetToolbar/SheetToolbar.stories.tsx +5 -5
  223. package/src/components/SheetToolbar/SheetToolbar.tsx +51 -46
  224. package/src/components/SheetToolbar/align.ts +50 -25
  225. package/src/components/SheetToolbar/style.ts +52 -22
  226. package/src/components/SheetToolbar/useToolbarState.ts +22 -5
  227. package/src/components/index.ts +1 -7
  228. package/src/containers/RangeList/RangeList.tsx +65 -0
  229. package/src/containers/RangeList/index.ts +5 -0
  230. package/src/containers/SheetContainer/SheetContainer.stories.tsx +110 -0
  231. package/src/containers/SheetContainer/SheetContainer.tsx +57 -0
  232. package/src/containers/SheetContainer/index.ts +5 -0
  233. package/src/containers/index.ts +8 -0
  234. package/src/extensions/compute.stories.tsx +29 -19
  235. package/src/extensions/compute.ts +2 -2
  236. package/src/extensions/editor/sheet-extension.test.ts +1 -1
  237. package/src/extensions/editor/sheet-extension.ts +18 -15
  238. package/src/index.ts +2 -2
  239. package/src/integrations/thread-ranges.ts +20 -63
  240. package/src/meta.ts +9 -5
  241. package/src/model/sheet-model.test.ts +6 -6
  242. package/src/model/sheet-model.ts +82 -50
  243. package/src/model/testing.ts +5 -5
  244. package/src/model/useSheetModel.ts +4 -3
  245. package/src/operations/drop-axis.ts +26 -0
  246. package/src/operations/index.ts +12 -0
  247. package/src/operations/insert-axis.ts +19 -0
  248. package/src/operations/restore-axis.ts +19 -0
  249. package/src/operations/scroll-to-anchor.ts +30 -0
  250. package/src/playwright/playwright.config.ts +1 -1
  251. package/src/playwright/sheet.spec.ts +4 -3
  252. package/src/plugin.ts +11 -0
  253. package/src/sanity.test.ts +5 -3
  254. package/src/serializer.ts +5 -5
  255. package/src/testing/data.ts +2 -2
  256. package/src/testing/testing.tsx +6 -6
  257. package/src/translations.ts +42 -36
  258. package/src/types/Sheet.ts +103 -0
  259. package/src/types/SheetCapabilities.ts +26 -0
  260. package/src/types/SheetOperation.ts +75 -0
  261. package/src/types/index.ts +4 -1
  262. package/src/types/sheet-range-types.ts +5 -5
  263. package/src/types/types.ts +5 -51
  264. package/src/types/util.ts +12 -39
  265. package/dist/lib/browser/SheetContainer-VL34UND4.mjs +0 -351
  266. package/dist/lib/browser/SheetContainer-VL34UND4.mjs.map +0 -7
  267. package/dist/lib/browser/anchor-sort-3N44DS5F.mjs +0 -24
  268. package/dist/lib/browser/anchor-sort-3N44DS5F.mjs.map +0 -7
  269. package/dist/lib/browser/chunk-ADK2HW4A.mjs +0 -906
  270. package/dist/lib/browser/chunk-ADK2HW4A.mjs.map +0 -7
  271. package/dist/lib/browser/chunk-CSBSADPQ.mjs +0 -16
  272. package/dist/lib/browser/chunk-CSBSADPQ.mjs.map +0 -7
  273. package/dist/lib/browser/chunk-SSN4HYJL.mjs.map +0 -7
  274. package/dist/lib/browser/chunk-ZJWJMX4E.mjs +0 -852
  275. package/dist/lib/browser/chunk-ZJWJMX4E.mjs.map +0 -7
  276. package/dist/lib/browser/chunk-ZMPNHFIP.mjs +0 -15
  277. package/dist/lib/browser/chunk-ZMPNHFIP.mjs.map +0 -7
  278. package/dist/lib/browser/compute-graph-registry-MF65HGGM.mjs +0 -21
  279. package/dist/lib/browser/compute-graph-registry-MF65HGGM.mjs.map +0 -7
  280. package/dist/lib/browser/index.mjs +0 -154
  281. package/dist/lib/browser/index.mjs.map +0 -7
  282. package/dist/lib/browser/intent-resolver-BQLV6IAA.mjs +0 -56
  283. package/dist/lib/browser/intent-resolver-BQLV6IAA.mjs.map +0 -7
  284. package/dist/lib/browser/markdown-RMTMI237.mjs +0 -26
  285. package/dist/lib/browser/markdown-RMTMI237.mjs.map +0 -7
  286. package/dist/lib/browser/meta.json +0 -1
  287. package/dist/lib/browser/react-surface-7ZDMQDCT.mjs +0 -53
  288. package/dist/lib/browser/react-surface-7ZDMQDCT.mjs.map +0 -7
  289. package/dist/lib/node-esm/SheetContainer-NWJ7L6FC.mjs +0 -352
  290. package/dist/lib/node-esm/SheetContainer-NWJ7L6FC.mjs.map +0 -7
  291. package/dist/lib/node-esm/anchor-sort-YL2OZHYM.mjs +0 -25
  292. package/dist/lib/node-esm/anchor-sort-YL2OZHYM.mjs.map +0 -7
  293. package/dist/lib/node-esm/chunk-BZAPYBSH.mjs +0 -907
  294. package/dist/lib/node-esm/chunk-BZAPYBSH.mjs.map +0 -7
  295. package/dist/lib/node-esm/chunk-H3GSD33H.mjs +0 -18
  296. package/dist/lib/node-esm/chunk-H3GSD33H.mjs.map +0 -7
  297. package/dist/lib/node-esm/chunk-IK4O7FUJ.mjs +0 -236
  298. package/dist/lib/node-esm/chunk-IK4O7FUJ.mjs.map +0 -7
  299. package/dist/lib/node-esm/chunk-LN6ZSAII.mjs +0 -16
  300. package/dist/lib/node-esm/chunk-LN6ZSAII.mjs.map +0 -7
  301. package/dist/lib/node-esm/chunk-YL7BVJPC.mjs +0 -853
  302. package/dist/lib/node-esm/chunk-YL7BVJPC.mjs.map +0 -7
  303. package/dist/lib/node-esm/compute-graph-registry-P2O5LDFZ.mjs +0 -22
  304. package/dist/lib/node-esm/compute-graph-registry-P2O5LDFZ.mjs.map +0 -7
  305. package/dist/lib/node-esm/index.mjs +0 -155
  306. package/dist/lib/node-esm/index.mjs.map +0 -7
  307. package/dist/lib/node-esm/intent-resolver-MV5ZFXAQ.mjs +0 -57
  308. package/dist/lib/node-esm/intent-resolver-MV5ZFXAQ.mjs.map +0 -7
  309. package/dist/lib/node-esm/markdown-EDIWHA3P.mjs +0 -27
  310. package/dist/lib/node-esm/markdown-EDIWHA3P.mjs.map +0 -7
  311. package/dist/lib/node-esm/meta.json +0 -1
  312. package/dist/lib/node-esm/react-surface-TUME5MM2.mjs +0 -54
  313. package/dist/lib/node-esm/react-surface-TUME5MM2.mjs.map +0 -7
  314. package/dist/types/src/capabilities/capabilities.d.ts +0 -5
  315. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  316. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  317. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  318. package/dist/types/src/components/FunctionEditor/FunctionEditor.d.ts +0 -3
  319. package/dist/types/src/components/FunctionEditor/FunctionEditor.d.ts.map +0 -1
  320. package/dist/types/src/components/FunctionEditor/index.d.ts +0 -2
  321. package/dist/types/src/components/FunctionEditor/index.d.ts.map +0 -1
  322. package/dist/types/src/components/GridSheet/GridSheet.d.ts +0 -3
  323. package/dist/types/src/components/GridSheet/GridSheet.d.ts.map +0 -1
  324. package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts +0 -54
  325. package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +0 -1
  326. package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts.map +0 -1
  327. package/dist/types/src/components/GridSheet/index.d.ts +0 -2
  328. package/dist/types/src/components/GridSheet/index.d.ts.map +0 -1
  329. package/dist/types/src/components/GridSheet/util.d.ts.map +0 -1
  330. package/dist/types/src/components/RangeList/RangeList.d.ts +0 -7
  331. package/dist/types/src/components/RangeList/RangeList.d.ts.map +0 -1
  332. package/dist/types/src/components/RangeList/index.d.ts +0 -2
  333. package/dist/types/src/components/RangeList/index.d.ts.map +0 -1
  334. package/dist/types/src/components/SheetContainer/SheetContainer.d.ts +0 -11
  335. package/dist/types/src/components/SheetContainer/SheetContainer.d.ts.map +0 -1
  336. package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts +0 -55
  337. package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +0 -1
  338. package/dist/types/src/components/SheetContainer/index.d.ts +0 -3
  339. package/dist/types/src/components/SheetContainer/index.d.ts.map +0 -1
  340. package/dist/types/src/components/SheetContext/SheetContext.d.ts.map +0 -1
  341. package/dist/types/src/components/SheetContext/index.d.ts +0 -2
  342. package/dist/types/src/components/SheetContext/index.d.ts.map +0 -1
  343. package/dist/types/src/types/schema.d.ts +0 -37
  344. package/dist/types/src/types/schema.d.ts.map +0 -1
  345. package/src/capabilities/capabilities.ts +0 -14
  346. package/src/capabilities/intent-resolver.ts +0 -38
  347. package/src/components/GridSheet/GridSheet.stories.tsx +0 -59
  348. package/src/components/RangeList/RangeList.tsx +0 -60
  349. package/src/components/SheetContainer/SheetContainer.stories.tsx +0 -90
  350. package/src/components/SheetContainer/SheetContainer.tsx +0 -40
  351. package/src/components/SheetContainer/index.ts +0 -7
  352. package/src/components/SheetContext/index.ts +0 -5
  353. package/src/types/schema.ts +0 -61
  354. /package/dist/lib/{browser/types/index.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
  355. /package/dist/lib/{node-esm/types → neutral}/index.mjs.map +0 -0
@@ -0,0 +1,16 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+
7
+ import { Capabilities, Capability } from '@dxos/app-framework';
8
+ import type { OperationHandlerSet } from '@dxos/compute';
9
+
10
+ import { SheetOperationHandlerSet } from '#operations';
11
+
12
+ export default Capability.makeModule<OperationHandlerSet.OperationHandlerSet>(
13
+ Effect.fnUntraced(function* () {
14
+ return Capability.contributes(Capabilities.OperationHandler, SheetOperationHandlerSet);
15
+ }),
16
+ );
@@ -2,39 +2,48 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
+ import * as Effect from 'effect/Effect';
5
6
  import React from 'react';
6
7
 
7
- import { Capabilities, contributes, createSurface, useCapability } from '@dxos/app-framework';
8
+ import { Capabilities, Capability } from '@dxos/app-framework';
9
+ import { Surface, useCapability } from '@dxos/app-framework/ui';
10
+ import { AppSurface } from '@dxos/app-toolkit/ui';
8
11
  import { Obj } from '@dxos/echo';
9
12
  import { getSpace } from '@dxos/react-client/echo';
10
13
 
11
- import { ComputeGraphContextProvider, RangeList, SheetContainer } from '../components';
12
- import { meta } from '../meta';
13
- import { SheetType } from '../types';
14
+ import { RangeList, SheetContainer } from '#containers';
15
+ import { Sheet, SheetCapabilities } from '#types';
14
16
 
15
- import { SheetCapabilities } from './capabilities';
17
+ export default Capability.makeModule(() =>
18
+ Effect.succeed(
19
+ Capability.contributes(Capabilities.ReactSurface, [
20
+ Surface.create({
21
+ id: 'sheet',
22
+ // TODO(wittjosiah): Split into multiple surfaces if this filter proves too strict for non-article roles.
23
+ role: ['article', 'section'],
24
+ filter: (data): data is { attendableId: string; subject: Sheet.Sheet } =>
25
+ typeof data.attendableId === 'string' &&
26
+ Obj.instanceOf(Sheet.Sheet, data.subject) &&
27
+ !!Obj.getDatabase(data.subject),
28
+ component: ({ data, role }) => {
29
+ const computeGraphRegistry = useCapability(SheetCapabilities.ComputeGraphRegistry);
16
30
 
17
- export default () =>
18
- contributes(Capabilities.ReactSurface, [
19
- createSurface({
20
- id: `${meta.id}/sheet`,
21
- role: ['article', 'section'],
22
- filter: (data): data is { subject: SheetType } =>
23
- Obj.instanceOf(SheetType, data.subject) && !!getSpace(data.subject),
24
- component: ({ data, role }) => {
25
- const computeGraphRegistry = useCapability(SheetCapabilities.ComputeGraphRegistry);
26
-
27
- return (
28
- <ComputeGraphContextProvider registry={computeGraphRegistry}>
29
- <SheetContainer space={getSpace(data.subject)!} sheet={data.subject} role={role} />
30
- </ComputeGraphContextProvider>
31
- );
32
- },
33
- }),
34
- createSurface({
35
- id: `${meta.id}/object-settings`,
36
- role: 'object-settings',
37
- filter: (data): data is { subject: SheetType } => Obj.instanceOf(SheetType, data.subject),
38
- component: ({ data }) => <RangeList sheet={data.subject} />,
39
- }),
40
- ]);
31
+ return (
32
+ <SheetContainer
33
+ role={role}
34
+ subject={data.subject}
35
+ attendableId={data.attendableId}
36
+ space={getSpace(data.subject)!}
37
+ registry={computeGraphRegistry}
38
+ />
39
+ );
40
+ },
41
+ }),
42
+ Surface.create({
43
+ id: 'object-properties',
44
+ filter: AppSurface.object(AppSurface.ObjectProperties, Sheet.Sheet),
45
+ component: ({ data }) => <RangeList sheet={data.subject} />,
46
+ }),
47
+ ]),
48
+ ),
49
+ );
@@ -0,0 +1,29 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+
7
+ import { Capability } from '@dxos/app-framework';
8
+
9
+ import { SheetCapabilities } from '#types';
10
+
11
+ const createGridRegistry = (): SheetCapabilities.GridRegistry => {
12
+ const grids = new Map<string, SheetCapabilities.GridEntry>();
13
+ return {
14
+ register: (attendableId, grid, setActiveRefs) => {
15
+ grids.set(attendableId, { grid, setActiveRefs });
16
+ },
17
+ unregister: (attendableId) => {
18
+ grids.delete(attendableId);
19
+ },
20
+ get: (attendableId) => grids.get(attendableId),
21
+ };
22
+ };
23
+
24
+ export default Capability.makeModule(
25
+ Effect.fnUntraced(function* () {
26
+ const gridInstances = createGridRegistry();
27
+ return Capability.contributes(SheetCapabilities.GridInstances, gridInstances);
28
+ }),
29
+ );
@@ -0,0 +1,30 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+
7
+ import { Capabilities, Capability, UndoMapping } from '@dxos/app-framework';
8
+
9
+ import { meta } from '#meta';
10
+ import { SheetOperation } from '#types';
11
+
12
+ export default Capability.makeModule(() =>
13
+ Effect.succeed(
14
+ Capability.contributes(Capabilities.UndoMapping, [
15
+ UndoMapping.make({
16
+ operation: SheetOperation.DropAxis,
17
+ inverse: SheetOperation.RestoreAxis,
18
+ deriveContext: (input, output) => ({
19
+ model: input.model,
20
+ axis: output.axis,
21
+ axisIndex: output.axisIndex,
22
+ index: output.index,
23
+ axisMeta: output.axisMeta,
24
+ values: output.values,
25
+ }),
26
+ message: ['axis-dropped.label', { ns: meta.id }],
27
+ }),
28
+ ]),
29
+ ),
30
+ );
@@ -4,7 +4,7 @@
4
4
 
5
5
  import React, { type PropsWithChildren, createContext, useContext } from 'react';
6
6
 
7
- import { type ComputeGraph, type ComputeGraphRegistry } from '@dxos/compute';
7
+ import { type ComputeGraph, type ComputeGraphRegistry } from '@dxos/compute-hyperformula';
8
8
  import { raise } from '@dxos/debug';
9
9
  import { type Space } from '@dxos/react-client/echo';
10
10
  import { useAsyncState } from '@dxos/react-hooks';
@@ -5,33 +5,33 @@
5
5
  import { type Meta, type StoryObj } from '@storybook/react-vite';
6
6
  import React, { useEffect, useRef, useState } from 'react';
7
7
 
8
- import { testFunctionPlugins } from '@dxos/compute/testing';
8
+ import { Operation } from '@dxos/compute';
9
+ import { testFunctionPlugins } from '@dxos/compute-hyperformula/testing';
9
10
  import { Filter, Obj } from '@dxos/echo';
10
- import { FunctionType } from '@dxos/functions';
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 { Button, Input, Toolbar } from '@dxos/react-ui';
14
+ import { JsonHighlighter } from '@dxos/react-ui-syntax-highlighter';
14
15
  import { withTheme } from '@dxos/react-ui/testing';
15
- import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
16
16
 
17
- import { useSheetModel } from '../../model';
18
- import { withComputeGraphDecorator } from '../../testing';
19
- import { SheetType, createSheet } from '../../types';
17
+ import { withComputeGraphDecorator } from '#testing';
18
+ import { Sheet } from '#types';
20
19
 
20
+ import { useSheetModel } from '../../model';
21
21
  import { useComputeGraph } from './ComputeGraphContextProvider';
22
22
 
23
23
  const FUNCTION_NAME = 'TEST';
24
24
 
25
25
  const DefaultStory = () => {
26
- const space = useSpace();
26
+ const [space] = useSpaces();
27
27
  const graph = useComputeGraph(space);
28
- const [sheet, setSheet] = useState<SheetType>();
28
+ const [sheet, setSheet] = useState<Sheet.Sheet>();
29
29
  const [text, setText] = useState(`${FUNCTION_NAME}(100)`);
30
30
  const [result, setResult] = useState<any>();
31
31
  const model = useSheetModel(graph, sheet);
32
32
  useEffect(() => {
33
33
  if (space) {
34
- const sheet = space.db.add(createSheet());
34
+ const sheet = space.db.add(Sheet.make());
35
35
  setSheet(sheet);
36
36
  }
37
37
  }, [space]);
@@ -44,14 +44,14 @@ const DefaultStory = () => {
44
44
  setResult({ functions: { standard: f1.length, echo: f2.length } });
45
45
  });
46
46
 
47
- space.db.add(Obj.make(FunctionType, { name: 'test', version: '0.0.1', binding: FUNCTION_NAME }));
47
+ space.db.add(Obj.make(Operation.PersistentOperation, { name: 'test', version: '0.0.1', binding: FUNCTION_NAME }));
48
48
  }
49
49
  }, [space, graph]);
50
50
 
51
51
  const inputRef = useRef<HTMLInputElement | null>(null);
52
52
  const handleTest = async () => {
53
53
  if (space && graph) {
54
- const { objects } = await space.db.query(Filter.type(FunctionType)).run();
54
+ const objects = await space.db.query(Filter.type(Operation.PersistentOperation)).run();
55
55
  const mapped = graph.mapFunctionBindingToId(text);
56
56
  const unmapped = graph.mapFunctionBindingFromId(mapped);
57
57
  const internal = graph.mapFormulaToNative(text);
@@ -74,9 +74,7 @@ const DefaultStory = () => {
74
74
  </Input.Root>
75
75
  <Button onClick={handleTest}>Test</Button>
76
76
  </Toolbar.Root>
77
- <SyntaxHighlighter language='json'>
78
- {JSON.stringify({ space: space?.id, graph: graph?.id, sheet: sheet?.id, model: model?.id, result }, null, 2)}
79
- </SyntaxHighlighter>
77
+ <JsonHighlighter data={{ space: space?.id, graph: graph?.id, sheet: sheet?.id, model: model?.id, result }} />
80
78
  </div>
81
79
  );
82
80
  };
@@ -84,11 +82,15 @@ const DefaultStory = () => {
84
82
  export const Default: Story = {};
85
83
 
86
84
  const meta = {
87
- title: 'plugins/plugin-sheet/functions',
85
+ title: 'plugins/plugin-sheet/components/functions',
88
86
  render: DefaultStory,
89
87
  decorators: [
90
- withTheme,
91
- withClientProvider({ types: [FunctionType, SheetType], createIdentity: true, createSpace: true }),
88
+ withTheme(),
89
+ withClientProvider({
90
+ types: [Operation.PersistentOperation, Sheet.Sheet],
91
+ createIdentity: true,
92
+ createSpace: true,
93
+ }),
92
94
  withComputeGraphDecorator({ plugins: testFunctionPlugins }),
93
95
  ],
94
96
  } satisfies Meta<typeof DefaultStory>;
@@ -0,0 +1,20 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { SheetContent } from '../SheetContent';
6
+ import { SheetRoot } from '../SheetRoot';
7
+ import { SheetStatusbar } from '../SheetStatusbar';
8
+ import { SheetToolbar } from '../SheetToolbar';
9
+
10
+ export { useSheetContext, type SheetContextValue, type SheetRootProps } from '../SheetRoot';
11
+ export { type SheetContentProps } from '../SheetContent';
12
+ export { type SheetToolbarProps } from '../SheetToolbar';
13
+ export { type SheetStatusbarProps } from '../SheetStatusbar';
14
+
15
+ export const Sheet = {
16
+ Root: SheetRoot,
17
+ Toolbar: SheetToolbar,
18
+ Content: SheetContent,
19
+ Statusbar: SheetStatusbar,
20
+ };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export * from './Sheet';
@@ -6,16 +6,18 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
6
6
  import React, { useMemo, useState } from 'react';
7
7
 
8
8
  import { Client } from '@dxos/client';
9
- import { createDocAccessor } from '@dxos/client/echo';
10
- import { defaultFunctions } from '@dxos/compute';
11
- import { getRegisteredFunctionNames } from '@dxos/compute/testing';
9
+ import { defaultFunctions } from '@dxos/compute-hyperformula';
10
+ import { getRegisteredFunctionNames } from '@dxos/compute-hyperformula/testing';
11
+ import { Obj } from '@dxos/echo';
12
+ import { createDocAccessor } from '@dxos/echo-db';
12
13
  import { useAsyncEffect } from '@dxos/react-hooks';
13
- import { withTheme } from '@dxos/react-ui/testing';
14
- import { automerge } from '@dxos/react-ui-editor';
15
14
  import { CellEditor, type CellEditorProps } from '@dxos/react-ui-grid';
15
+ import { withTheme } from '@dxos/react-ui/testing';
16
+ import { automerge } from '@dxos/ui-editor';
17
+
18
+ import { Sheet } from '#types';
16
19
 
17
20
  import { sheetExtension } from '../../extensions';
18
- import { SheetType, createSheet } from '../../types';
19
21
 
20
22
  const DefaultStory = ({ value, ...props }: CellEditorProps) => {
21
23
  const extensions = useMemo(() => {
@@ -29,16 +31,18 @@ const DefaultStory = ({ value, ...props }: CellEditorProps) => {
29
31
 
30
32
  const AutomergeStory = ({ value, ...props }: CellEditorProps) => {
31
33
  const cell = 'A1';
32
- const [object, setObject] = useState<SheetType>();
34
+ const [object, setObject] = useState<Sheet.Sheet>();
33
35
  useAsyncEffect(async () => {
34
- const client = new Client({ types: [SheetType] });
36
+ const client = new Client({ types: [Sheet.Sheet] });
35
37
  await client.initialize();
36
38
  await client.halo.createIdentity();
37
39
  const space = await client.spaces.create();
38
40
 
39
- const sheet = createSheet();
40
- sheet.name = 'Test';
41
- sheet.cells[cell] = { value };
41
+ const sheet = Sheet.make();
42
+ Obj.update(sheet, (sheet) => {
43
+ sheet.name = 'Test';
44
+ sheet.cells[cell] = { value };
45
+ });
42
46
  space.db.add(sheet);
43
47
  setObject(sheet);
44
48
  }, [value]);
@@ -58,9 +62,9 @@ const AutomergeStory = ({ value, ...props }: CellEditorProps) => {
58
62
  };
59
63
 
60
64
  const meta = {
61
- title: 'plugins/plugin-sheet/CellEditor',
65
+ title: 'plugins/plugin-sheet/components/CellEditor',
62
66
 
63
- decorators: [withTheme],
67
+ decorators: [withTheme()],
64
68
  component: CellEditor,
65
69
  render: DefaultStory,
66
70
  } satisfies Meta<typeof DefaultStory>;
@@ -0,0 +1,60 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
6
+ import React from 'react';
7
+
8
+ import { OperationPlugin, RuntimePlugin } from '@dxos/app-framework';
9
+ import { withPluginManager } from '@dxos/app-framework/testing';
10
+ import { testFunctionPlugins } from '@dxos/compute-hyperformula/testing';
11
+ import { useSpaces } from '@dxos/react-client/echo';
12
+ import { withClientProvider } from '@dxos/react-client/testing';
13
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
14
+
15
+ import { createTestCells, useTestSheet, withComputeGraphDecorator } from '#testing';
16
+ import { translations } from '#translations';
17
+ import { Sheet } from '#types';
18
+
19
+ import { useComputeGraph } from '../ComputeGraph';
20
+ import { SheetRoot } from '../SheetRoot';
21
+ import { SheetContent } from './SheetContent';
22
+
23
+ export const Basic = () => {
24
+ const [space] = useSpaces();
25
+ const graph = useComputeGraph(space);
26
+ const sheet = useTestSheet(space, graph, { cells: createTestCells() });
27
+ if (!sheet || !graph) {
28
+ return null;
29
+ }
30
+
31
+ return (
32
+ <SheetRoot graph={graph} sheet={sheet} attendableId='test' ignoreAttention>
33
+ <div className='grid h-full w-full'>
34
+ <SheetContent />
35
+ </div>
36
+ </SheetRoot>
37
+ );
38
+ };
39
+
40
+ const meta = {
41
+ title: 'plugins/plugin-sheet/components/SheetContent',
42
+ component: SheetContent,
43
+ decorators: [
44
+ withTheme(),
45
+ withLayout({ layout: 'fullscreen' }),
46
+ withClientProvider({ types: [Sheet.Sheet], createSpace: true }),
47
+ withComputeGraphDecorator({ plugins: testFunctionPlugins }),
48
+ withPluginManager({
49
+ plugins: [OperationPlugin(), RuntimePlugin()],
50
+ }),
51
+ ],
52
+ parameters: {
53
+ layout: 'fullscreen',
54
+ translations,
55
+ },
56
+ } satisfies Meta<typeof SheetContent>;
57
+
58
+ export default meta;
59
+
60
+ type Story = StoryObj<typeof meta>;
@@ -8,13 +8,15 @@ import React, {
8
8
  type MouseEvent,
9
9
  type WheelEvent,
10
10
  useCallback,
11
+ useEffect,
11
12
  useMemo,
12
13
  useRef,
13
14
  useState,
14
15
  } from 'react';
15
16
 
16
- import { createIntent, useIntentDispatcher } from '@dxos/app-framework';
17
- import { type CellRange, rangeToA1Notation } from '@dxos/compute';
17
+ import { useCapabilities, useOperationInvoker } from '@dxos/app-framework/ui';
18
+ import { type CellRange, rangeToA1Notation } from '@dxos/compute-hyperformula';
19
+ import { Obj } from '@dxos/echo';
18
20
  import { defaultColSize, defaultRowSize } from '@dxos/lit-grid';
19
21
  import { DropdownMenu, Icon, useTranslation } from '@dxos/react-ui';
20
22
  import { useAttention } from '@dxos/react-ui-attention';
@@ -31,13 +33,15 @@ import {
31
33
  editorKeys,
32
34
  parseCellIndex,
33
35
  } from '@dxos/react-ui-grid';
36
+ import { composable, composableProps } from '@dxos/ui-theme';
34
37
 
35
- import { type RangeController, rangeExtension, sheetExtension } from '../../extensions';
36
- import { useSelectThreadOnCellFocus, useUpdateFocusedCellOnThreadSelection } from '../../integrations';
37
- import { meta } from '../../meta';
38
- import { DEFAULT_COLS, DEFAULT_ROWS, SheetAction } from '../../types';
39
- import { useSheetContext } from '../SheetContext';
38
+ import { meta } from '#meta';
39
+ import { SheetOperation } from '#types';
40
+ import { DEFAULT_COLS, DEFAULT_ROWS, SheetCapabilities } from '#types';
40
41
 
42
+ import { type RangeController, rangeExtension, sheetExtension } from '../../extensions';
43
+ import { useSelectThreadOnCellFocus } from '../../integrations';
44
+ import { useSheetContext } from '../SheetRoot';
41
45
  import { colLabelCell, rowLabelCell, useSheetModelDxGridProps } from './util';
42
46
 
43
47
  const inertPosition: DxGridPosition = { plane: 'grid', col: 0, row: 0 };
@@ -68,15 +72,29 @@ const sheetRowDefault = {
68
72
  grid: { size: defaultRowSize, resizeable: true },
69
73
  };
70
74
 
71
- export const GridSheet = () => {
75
+ export type SheetContentProps = {};
76
+
77
+ export const SheetContent = composable<HTMLDivElement, SheetContentProps>((props, forwardedRef) => {
72
78
  const { t } = useTranslation(meta.id);
73
- const { id, model, editing, setCursor, setRange, cursor, cursorFallbackRange, activeRefs, ignoreAttention } =
74
- useSheetContext();
79
+ const {
80
+ id,
81
+ attendableId,
82
+ model,
83
+ editing,
84
+ setCursor,
85
+ setRange,
86
+ cursor,
87
+ cursorFallbackRange,
88
+ activeRefs,
89
+ setActiveRefs,
90
+ ignoreAttention,
91
+ } = useSheetContext();
92
+
75
93
  // NOTE(thure): using `useState` instead of `useRef` works with refs provided by `@lit/react` and gives us
76
94
  // a reliable dependency for `useEffect` whereas `useLayoutEffect` does not guarantee the element will be defined.
77
95
  const [dxGrid, setDxGrid] = useState<DxGridElement | null>(null);
78
96
  const [extraplanarFocus, setExtraplanarFocus] = useState<DxGridPosition | null>(null);
79
- const { dispatchPromise: dispatch } = useIntentDispatcher();
97
+ const { invokePromise } = useOperationInvoker();
80
98
  const rangeController = useRef<RangeController>(null);
81
99
  const { hasAttention } = useAttention(id);
82
100
 
@@ -127,15 +145,17 @@ export const GridSheet = () => {
127
145
 
128
146
  const handleAxisResize = useCallback<NonNullable<GridContentProps['onAxisResize']>>(
129
147
  ({ axis, size, index: numericIndex }) => {
130
- if (axis === 'row') {
131
- const rowId = model.sheet.rows[parseInt(numericIndex)];
132
- model.sheet.rowMeta[rowId] ??= {};
133
- model.sheet.rowMeta[rowId].size = size;
134
- } else {
135
- const columnId = model.sheet.columns[parseInt(numericIndex)];
136
- model.sheet.columnMeta[columnId] ??= {};
137
- model.sheet.columnMeta[columnId].size = size;
138
- }
148
+ Obj.update(model.sheet, (sheet) => {
149
+ if (axis === 'row') {
150
+ const rowId = sheet.rows[parseInt(numericIndex)];
151
+ sheet.rowMeta[rowId] ??= {};
152
+ sheet.rowMeta[rowId].size = size;
153
+ } else {
154
+ const columnId = sheet.columns[parseInt(numericIndex)];
155
+ sheet.columnMeta[columnId] ??= {};
156
+ sheet.columnMeta[columnId].size = size;
157
+ }
158
+ });
139
159
  },
140
160
  [model],
141
161
  );
@@ -172,12 +192,20 @@ export const GridSheet = () => {
172
192
  case 'frozenRowsStart':
173
193
  return dxGrid?.setSelection({
174
194
  start: { col: pos.col, row: 0, plane: 'grid' },
175
- end: { col: pos.col, row: model.sheet.rows.length - 1, plane: 'grid' },
195
+ end: {
196
+ col: pos.col,
197
+ row: model.sheet.rows.length - 1,
198
+ plane: 'grid',
199
+ },
176
200
  });
177
201
  case 'frozenColsStart':
178
202
  return dxGrid?.setSelection({
179
203
  start: { row: pos.row, col: 0, plane: 'grid' },
180
- end: { row: pos.row, col: model.sheet.columns.length - 1, plane: 'grid' },
204
+ end: {
205
+ row: pos.row,
206
+ col: model.sheet.columns.length - 1,
207
+ plane: 'grid',
208
+ },
181
209
  });
182
210
  }
183
211
  },
@@ -257,31 +285,30 @@ export const GridSheet = () => {
257
285
  switch (operation) {
258
286
  case 'insert-before':
259
287
  case 'insert-after':
260
- return dispatch(
261
- createIntent(SheetAction.InsertAxis, {
262
- model,
263
- axis: contextMenuAxis,
264
- index: contextMenuOpen![contextMenuAxis] + (operation === 'insert-before' ? 0 : 1),
265
- }),
266
- );
288
+ return invokePromise(SheetOperation.InsertAxis, {
289
+ model,
290
+ axis: contextMenuAxis,
291
+ index: contextMenuOpen![contextMenuAxis] + (operation === 'insert-before' ? 0 : 1),
292
+ });
267
293
  case 'drop':
268
- return dispatch(
269
- createIntent(SheetAction.DropAxis, {
270
- model,
271
- axis: contextMenuAxis,
272
- axisIndex: model.sheet[contextMenuAxis === 'row' ? 'rows' : 'columns'][contextMenuOpen![contextMenuAxis]],
273
- }),
274
- );
294
+ return invokePromise(SheetOperation.DropAxis, {
295
+ model,
296
+ axis: contextMenuAxis,
297
+ axisIndex: model.sheet[contextMenuAxis === 'row' ? 'rows' : 'columns'][contextMenuOpen![contextMenuAxis]],
298
+ });
275
299
  }
276
300
  },
277
- [contextMenuAxis, contextMenuOpen, model, dispatch],
301
+ [contextMenuAxis, contextMenuOpen, model, invokePromise],
278
302
  );
279
303
 
280
304
  const { columns, rows } = useSheetModelDxGridProps(dxGrid, model);
281
305
 
282
306
  const extensions = useMemo(
283
307
  () => [
284
- editorKeys({ onClose: handleClose, ...(editing?.initialContent && { onNav: handleClose }) }),
308
+ editorKeys({
309
+ onClose: handleClose,
310
+ ...(editing?.initialContent && { onNav: handleClose }),
311
+ }),
285
312
  sheetExtension({ functions: model.graph.getFunctions() }),
286
313
  rangeExtension({
287
314
  onInit: (fn) => (rangeController.current = fn),
@@ -303,23 +330,31 @@ export const GridSheet = () => {
303
330
  [model],
304
331
  );
305
332
 
306
- useUpdateFocusedCellOnThreadSelection(dxGrid);
333
+ const [gridInstances] = useCapabilities(SheetCapabilities.GridInstances);
334
+ useEffect(() => {
335
+ if (dxGrid && gridInstances) {
336
+ gridInstances.register(attendableId, dxGrid, setActiveRefs);
337
+ return () => gridInstances.unregister(attendableId);
338
+ }
339
+ }, [dxGrid, gridInstances, attendableId, setActiveRefs]);
340
+
307
341
  useSelectThreadOnCellFocus();
308
342
 
309
343
  return (
310
- // TODO(thure): Why are Table’s and Sheet’s editor boxes off by 1px?
311
- <div role='none' className='relative min-bs-0 [&_.cm-editor]:!border-lb [&_.cm-editor]:!border-transparent'>
344
+ <div ref={forwardedRef} {...composableProps(props, { classNames: 'relative min-h-0' })}>
312
345
  <GridCellEditor getCellContent={getCellContent} extensions={extensions} onBlur={handleBlur} />
313
346
  <Grid.Content
347
+ className='[--dx-grid-base:var(--base-surface)] [&_.dx-grid]:absolute [&_.dx-grid]:inset-0'
314
348
  initialCells={initialCells}
315
349
  limitColumns={DEFAULT_COLS}
316
350
  limitRows={DEFAULT_ROWS}
317
351
  columns={columns}
318
352
  rows={rows}
319
- // TODO(burdon): `col` vs. `column`?
320
353
  columnDefault={sheetColDefault}
321
354
  rowDefault={sheetRowDefault}
355
+ activeRefs={activeRefs}
322
356
  frozen={frozen}
357
+ overscroll='trap'
323
358
  onAxisResize={handleAxisResize}
324
359
  onSelect={handleSelect}
325
360
  onFocus={handleFocus}
@@ -327,9 +362,6 @@ export const GridSheet = () => {
327
362
  onKeyDown={handleKeyDown}
328
363
  onContextMenu={handleContextMenu}
329
364
  onClick={handleClick}
330
- overscroll='trap'
331
- className='[--dx-grid-base:var(--baseSurface)] [&_.dx-grid]:absolute [&_.dx-grid]:inset-0'
332
- activeRefs={activeRefs}
333
365
  ref={setDxGrid}
334
366
  />
335
367
  <DropdownMenu.Root
@@ -345,27 +377,25 @@ export const GridSheet = () => {
345
377
  data-testid={`grid.${contextMenuAxis}.insert-before`}
346
378
  >
347
379
  <Icon
348
- size={5}
349
380
  icon={contextMenuAxis === 'col' ? 'ph--columns-plus-left--regular' : 'ph--rows-plus-top--regular'}
350
381
  />
351
- <span>{t(`add ${contextMenuAxis} before label`)}</span>
382
+ <span>{t(`add-${contextMenuAxis}-before.label`)}</span>
352
383
  </DropdownMenu.Item>
353
384
  <DropdownMenu.Item
354
385
  onClick={() => handleAxisMenuAction('insert-after')}
355
386
  data-testid={`grid.${contextMenuAxis}.insert-after`}
356
387
  >
357
388
  <Icon
358
- size={5}
359
389
  icon={contextMenuAxis === 'col' ? 'ph--columns-plus-right--regular' : 'ph--rows-plus-bottom--regular'}
360
390
  />
361
- <span>{t(`add ${contextMenuAxis} after label`)}</span>
391
+ <span>{t(`add-${contextMenuAxis}-after.label`)}</span>
362
392
  </DropdownMenu.Item>
363
393
  <DropdownMenu.Item
364
394
  onClick={() => handleAxisMenuAction('drop')}
365
395
  data-testid={`grid.${contextMenuAxis}.drop`}
366
396
  >
367
- <Icon size={5} icon='ph--backspace--regular' />
368
- <span>{t(`delete ${contextMenuAxis} label`)}</span>
397
+ <Icon icon='ph--backspace--regular' />
398
+ <span>{t(`delete-${contextMenuAxis}.label`)}</span>
369
399
  </DropdownMenu.Item>
370
400
  </DropdownMenu.Viewport>
371
401
  <DropdownMenu.Arrow />
@@ -373,4 +403,4 @@ export const GridSheet = () => {
373
403
  </DropdownMenu.Root>
374
404
  </div>
375
405
  );
376
- };
406
+ });
@@ -2,4 +2,4 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- export * from './RangeList';
5
+ export * from './SheetContent';