@dxos/plugin-sheet 0.7.4 → 0.7.5-labs.5f04cf6

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 (320) hide show
  1. package/dist/lib/browser/SheetContainer-CM4CO3DC.mjs +370 -0
  2. package/dist/lib/browser/SheetContainer-CM4CO3DC.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-FOO6NGBM.mjs +229 -0
  4. package/dist/lib/browser/chunk-FOO6NGBM.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-H23JW3DX.mjs +800 -0
  6. package/dist/lib/browser/chunk-H23JW3DX.mjs.map +7 -0
  7. package/dist/lib/browser/{chunk-RABELMEQ.mjs → chunk-K6EUYKWT.mjs} +3 -3
  8. package/dist/lib/browser/chunk-K6EUYKWT.mjs.map +7 -0
  9. package/dist/lib/browser/chunk-PW25VUP6.mjs +15 -0
  10. package/dist/lib/browser/chunk-PW25VUP6.mjs.map +7 -0
  11. package/dist/lib/browser/chunk-T3IVPMRX.mjs +900 -0
  12. package/dist/lib/browser/chunk-T3IVPMRX.mjs.map +7 -0
  13. package/dist/lib/browser/compute-graph-registry-XH6B2SWG.mjs +27 -0
  14. package/dist/lib/browser/compute-graph-registry-XH6B2SWG.mjs.map +7 -0
  15. package/dist/lib/browser/index.mjs +86 -324
  16. package/dist/lib/browser/index.mjs.map +4 -4
  17. package/dist/lib/browser/intent-resolver-Q7DTHAM5.mjs +47 -0
  18. package/dist/lib/browser/intent-resolver-Q7DTHAM5.mjs.map +7 -0
  19. package/dist/lib/browser/markdown-IKG5FNCA.mjs +26 -0
  20. package/dist/lib/browser/markdown-IKG5FNCA.mjs.map +7 -0
  21. package/dist/lib/browser/meta.json +1 -1
  22. package/dist/lib/browser/react-context-JG43577H.mjs +28 -0
  23. package/dist/lib/browser/react-context-JG43577H.mjs.map +7 -0
  24. package/dist/lib/browser/react-surface-URRC3AFC.mjs +43 -0
  25. package/dist/lib/browser/react-surface-URRC3AFC.mjs.map +7 -0
  26. package/dist/lib/browser/thread-YX6KBQNQ.mjs +17 -0
  27. package/dist/lib/browser/thread-YX6KBQNQ.mjs.map +7 -0
  28. package/dist/lib/browser/types/index.mjs +62 -0
  29. package/dist/lib/node/SheetContainer-TJ3JQLWM.cjs +364 -0
  30. package/dist/lib/node/SheetContainer-TJ3JQLWM.cjs.map +7 -0
  31. package/dist/lib/node/chunk-E3RXOEL6.cjs +935 -0
  32. package/dist/lib/node/chunk-E3RXOEL6.cjs.map +7 -0
  33. package/dist/lib/node/{types.cjs → chunk-FU5K66DS.cjs} +12 -16
  34. package/dist/lib/node/chunk-FU5K66DS.cjs.map +7 -0
  35. package/dist/lib/node/{chunk-2ZVZI2KJ.cjs → chunk-NLDXUFDG.cjs} +7 -7
  36. package/dist/lib/node/chunk-NLDXUFDG.cjs.map +7 -0
  37. package/dist/lib/node/chunk-P4KSGZSS.cjs +251 -0
  38. package/dist/lib/node/chunk-P4KSGZSS.cjs.map +7 -0
  39. package/dist/lib/node/chunk-ZPWW4LPY.cjs +807 -0
  40. package/dist/lib/node/chunk-ZPWW4LPY.cjs.map +7 -0
  41. package/dist/lib/node/compute-graph-registry-ORGTIE5M.cjs +53 -0
  42. package/dist/lib/node/compute-graph-registry-ORGTIE5M.cjs.map +7 -0
  43. package/dist/lib/node/index.cjs +87 -318
  44. package/dist/lib/node/index.cjs.map +4 -4
  45. package/dist/lib/node/intent-resolver-ZUDJJUFG.cjs +60 -0
  46. package/dist/lib/node/intent-resolver-ZUDJJUFG.cjs.map +7 -0
  47. package/dist/lib/node/markdown-EUUL3Q36.cjs +40 -0
  48. package/dist/lib/node/markdown-EUUL3Q36.cjs.map +7 -0
  49. package/dist/lib/node/meta.json +1 -1
  50. package/dist/lib/node/react-context-OOH5QFE2.cjs +50 -0
  51. package/dist/lib/node/react-context-OOH5QFE2.cjs.map +7 -0
  52. package/dist/lib/node/react-surface-IQN5JKSS.cjs +64 -0
  53. package/dist/lib/node/react-surface-IQN5JKSS.cjs.map +7 -0
  54. package/dist/lib/node/{meta.cjs → thread-VBPS23P2.cjs} +12 -10
  55. package/dist/lib/node/thread-VBPS23P2.cjs.map +7 -0
  56. package/dist/lib/node/types/index.cjs +84 -0
  57. package/dist/lib/node/types/index.cjs.map +7 -0
  58. package/dist/lib/node-esm/SheetContainer-QEEFORIC.mjs +371 -0
  59. package/dist/lib/node-esm/SheetContainer-QEEFORIC.mjs.map +7 -0
  60. package/dist/lib/node-esm/{chunk-BM2Q3FFC.mjs → chunk-FMOVRTS4.mjs} +3 -3
  61. package/dist/lib/node-esm/chunk-FMOVRTS4.mjs.map +7 -0
  62. package/dist/lib/node-esm/chunk-KCXK5UM6.mjs +16 -0
  63. package/dist/lib/node-esm/chunk-KCXK5UM6.mjs.map +7 -0
  64. package/dist/lib/node-esm/chunk-NSVUOAI6.mjs +901 -0
  65. package/dist/lib/node-esm/chunk-NSVUOAI6.mjs.map +7 -0
  66. package/dist/lib/node-esm/chunk-OXD6RBFF.mjs +801 -0
  67. package/dist/lib/node-esm/chunk-OXD6RBFF.mjs.map +7 -0
  68. package/dist/lib/node-esm/chunk-PTOI45NK.mjs +231 -0
  69. package/dist/lib/node-esm/chunk-PTOI45NK.mjs.map +7 -0
  70. package/dist/lib/node-esm/compute-graph-registry-JH2FRHLD.mjs +28 -0
  71. package/dist/lib/node-esm/compute-graph-registry-JH2FRHLD.mjs.map +7 -0
  72. package/dist/lib/node-esm/index.mjs +86 -324
  73. package/dist/lib/node-esm/index.mjs.map +4 -4
  74. package/dist/lib/node-esm/intent-resolver-IF64RN7B.mjs +48 -0
  75. package/dist/lib/node-esm/intent-resolver-IF64RN7B.mjs.map +7 -0
  76. package/dist/lib/node-esm/markdown-D2ZMN7LR.mjs +27 -0
  77. package/dist/lib/node-esm/markdown-D2ZMN7LR.mjs.map +7 -0
  78. package/dist/lib/node-esm/meta.json +1 -1
  79. package/dist/lib/node-esm/react-context-CJVSLO74.mjs +29 -0
  80. package/dist/lib/node-esm/react-context-CJVSLO74.mjs.map +7 -0
  81. package/dist/lib/node-esm/react-surface-XJIX5G3I.mjs +44 -0
  82. package/dist/lib/node-esm/react-surface-XJIX5G3I.mjs.map +7 -0
  83. package/dist/lib/node-esm/thread-HSJD3SR6.mjs +18 -0
  84. package/dist/lib/node-esm/thread-HSJD3SR6.mjs.map +7 -0
  85. package/dist/lib/node-esm/types/index.mjs +63 -0
  86. package/dist/types/src/SheetPlugin.d.ts +1 -3
  87. package/dist/types/src/SheetPlugin.d.ts.map +1 -1
  88. package/dist/types/src/capabilities/capabilities.d.ts +5 -0
  89. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
  90. package/dist/types/src/capabilities/compute-graph-registry.d.ts +4 -0
  91. package/dist/types/src/capabilities/compute-graph-registry.d.ts.map +1 -0
  92. package/dist/types/src/capabilities/index.d.ts +17 -0
  93. package/dist/types/src/capabilities/index.d.ts.map +1 -0
  94. package/dist/types/src/capabilities/intent-resolver.d.ts +4 -0
  95. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
  96. package/dist/types/src/capabilities/markdown.d.ts +6 -0
  97. package/dist/types/src/capabilities/markdown.d.ts.map +1 -0
  98. package/dist/types/src/capabilities/react-context.d.ts +8 -0
  99. package/dist/types/src/capabilities/react-context.d.ts.map +1 -0
  100. package/dist/types/src/capabilities/react-surface.d.ts +4 -0
  101. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  102. package/dist/types/src/capabilities/thread.d.ts +6 -0
  103. package/dist/types/src/capabilities/thread.d.ts.map +1 -0
  104. package/dist/types/src/components/ComputeGraph/ComputeGraphContextProvider.d.ts +1 -1
  105. package/dist/types/src/components/ComputeGraph/ComputeGraphContextProvider.d.ts.map +1 -1
  106. package/dist/types/src/components/ComputeGraph/compute-graph.stories.d.ts.map +1 -0
  107. package/dist/types/src/components/FunctionEditor/FunctionEditor.d.ts.map +1 -1
  108. package/dist/types/src/components/GridSheet/GridSheet.d.ts.map +1 -1
  109. package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +1 -1
  110. package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts.map +1 -1
  111. package/dist/types/src/components/GridSheet/util.d.ts.map +1 -1
  112. package/dist/types/src/components/RangeList/RangeList.d.ts.map +1 -1
  113. package/dist/types/src/components/SheetContainer/SheetContainer.d.ts.map +1 -1
  114. package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +1 -1
  115. package/dist/types/src/components/SheetContext/SheetContext.d.ts +1 -2
  116. package/dist/types/src/components/SheetContext/SheetContext.d.ts.map +1 -1
  117. package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts +7 -0
  118. package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts.map +1 -0
  119. package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts +6 -0
  120. package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts.map +1 -0
  121. package/dist/types/src/components/SheetToolbar/align.d.ts +28 -0
  122. package/dist/types/src/components/SheetToolbar/align.d.ts.map +1 -0
  123. package/dist/types/src/components/SheetToolbar/comment.d.ts +23 -0
  124. package/dist/types/src/components/SheetToolbar/comment.d.ts.map +1 -0
  125. package/dist/types/src/components/SheetToolbar/index.d.ts +2 -0
  126. package/dist/types/src/components/SheetToolbar/index.d.ts.map +1 -0
  127. package/dist/types/src/components/SheetToolbar/style.d.ts +26 -0
  128. package/dist/types/src/components/SheetToolbar/style.d.ts.map +1 -0
  129. package/dist/types/src/components/SheetToolbar/useToolbarAction.d.ts +8 -0
  130. package/dist/types/src/components/SheetToolbar/useToolbarAction.d.ts.map +1 -0
  131. package/dist/types/src/components/SheetToolbar/useToolbarState.d.ts +6 -0
  132. package/dist/types/src/components/SheetToolbar/useToolbarState.d.ts.map +1 -0
  133. package/dist/types/src/components/index.d.ts +0 -1
  134. package/dist/types/src/components/index.d.ts.map +1 -1
  135. package/dist/types/src/extensions/compute.d.ts +1 -1
  136. package/dist/types/src/extensions/compute.d.ts.map +1 -1
  137. package/dist/types/src/extensions/editor/extension.d.ts +1 -1
  138. package/dist/types/src/extensions/editor/extension.d.ts.map +1 -1
  139. package/dist/types/src/index.d.ts +2 -3
  140. package/dist/types/src/index.d.ts.map +1 -1
  141. package/dist/types/src/integrations/thread-ranges.d.ts +1 -1
  142. package/dist/types/src/integrations/thread-ranges.d.ts.map +1 -1
  143. package/dist/types/src/meta.d.ts +1 -2
  144. package/dist/types/src/meta.d.ts.map +1 -1
  145. package/dist/types/src/model/sheet-model.d.ts +6 -8
  146. package/dist/types/src/model/sheet-model.d.ts.map +1 -1
  147. package/dist/types/src/model/testing.d.ts +1 -1
  148. package/dist/types/src/model/testing.d.ts.map +1 -1
  149. package/dist/types/src/model/useSheetModel.d.ts +1 -1
  150. package/dist/types/src/model/useSheetModel.d.ts.map +1 -1
  151. package/dist/types/src/testing/testing.d.ts +1 -1
  152. package/dist/types/src/testing/testing.d.ts.map +1 -1
  153. package/dist/types/src/{defs → types}/index.d.ts +1 -0
  154. package/dist/types/src/types/index.d.ts.map +1 -0
  155. package/dist/types/src/types/schema.d.ts +105 -0
  156. package/dist/types/src/types/schema.d.ts.map +1 -0
  157. package/dist/types/src/{defs → types}/sheet-range-types.d.ts +1 -1
  158. package/dist/types/src/types/sheet-range-types.d.ts.map +1 -0
  159. package/dist/types/src/types/types.d.ts +71 -0
  160. package/dist/types/src/types/types.d.ts.map +1 -0
  161. package/dist/types/src/{defs → types}/util.d.ts +5 -1
  162. package/dist/types/src/types/util.d.ts.map +1 -0
  163. package/dist/types/tsconfig.tsbuildinfo +1 -0
  164. package/package.json +47 -61
  165. package/src/SheetPlugin.tsx +70 -176
  166. package/src/capabilities/capabilities.ts +14 -0
  167. package/src/capabilities/compute-graph-registry.ts +25 -0
  168. package/src/capabilities/index.ts +14 -0
  169. package/src/capabilities/intent-resolver.ts +29 -0
  170. package/src/capabilities/markdown.ts +22 -0
  171. package/src/capabilities/react-context.tsx +20 -0
  172. package/src/capabilities/react-surface.tsx +30 -0
  173. package/src/capabilities/thread.ts +14 -0
  174. package/src/components/ComputeGraph/ComputeGraphContextProvider.tsx +1 -2
  175. package/src/{compute-graph → components/ComputeGraph}/compute-graph.stories.tsx +6 -7
  176. package/src/components/FunctionEditor/FunctionEditor.tsx +2 -1
  177. package/src/components/GridSheet/GridSheet.stories.tsx +2 -0
  178. package/src/components/GridSheet/GridSheet.tsx +15 -18
  179. package/src/components/GridSheet/SheetCellEditor.stories.tsx +6 -7
  180. package/src/components/GridSheet/util.ts +3 -2
  181. package/src/components/RangeList/RangeList.tsx +2 -1
  182. package/src/components/SheetContainer/SheetContainer.stories.tsx +25 -23
  183. package/src/components/SheetContainer/SheetContainer.tsx +3 -8
  184. package/src/components/SheetContext/SheetContext.tsx +1 -2
  185. package/src/components/{Toolbar/Toolbar.stories.tsx → SheetToolbar/SheetToolbar.stories.tsx} +4 -8
  186. package/src/components/SheetToolbar/SheetToolbar.tsx +48 -0
  187. package/src/components/SheetToolbar/align.ts +68 -0
  188. package/src/components/SheetToolbar/comment.ts +56 -0
  189. package/src/components/{Toolbar → SheetToolbar}/index.ts +1 -1
  190. package/src/components/SheetToolbar/style.ts +72 -0
  191. package/src/components/SheetToolbar/useToolbarAction.ts +87 -0
  192. package/src/components/SheetToolbar/useToolbarState.ts +17 -0
  193. package/src/components/index.ts +0 -1
  194. package/src/extensions/compute.ts +7 -4
  195. package/src/extensions/editor/extension.test.ts +2 -1
  196. package/src/extensions/editor/extension.ts +2 -3
  197. package/src/index.ts +2 -7
  198. package/src/integrations/thread-ranges.ts +28 -24
  199. package/src/meta.ts +1 -1
  200. package/src/model/sheet-model.test.ts +4 -10
  201. package/src/model/sheet-model.ts +30 -22
  202. package/src/model/testing.ts +3 -2
  203. package/src/model/useSheetModel.ts +2 -1
  204. package/src/sanity.test.ts +1 -1
  205. package/src/testing/testing.tsx +2 -3
  206. package/src/{defs → types}/index.ts +1 -0
  207. package/src/types/schema.ts +56 -0
  208. package/src/{defs → types}/sheet-range-types.ts +1 -1
  209. package/src/types/types.ts +67 -0
  210. package/src/{defs → types}/util.ts +13 -13
  211. package/dist/lib/browser/SheetContainer-KCLT6PEO.mjs +0 -296
  212. package/dist/lib/browser/SheetContainer-KCLT6PEO.mjs.map +0 -7
  213. package/dist/lib/browser/chunk-E5WQ7U7G.mjs +0 -1675
  214. package/dist/lib/browser/chunk-E5WQ7U7G.mjs.map +0 -7
  215. package/dist/lib/browser/chunk-F3HE6D3J.mjs +0 -3269
  216. package/dist/lib/browser/chunk-F3HE6D3J.mjs.map +0 -7
  217. package/dist/lib/browser/chunk-JXFPOYNA.mjs +0 -67
  218. package/dist/lib/browser/chunk-JXFPOYNA.mjs.map +0 -7
  219. package/dist/lib/browser/chunk-RABELMEQ.mjs.map +0 -7
  220. package/dist/lib/browser/compute-graph-SNUS7HOH.mjs +0 -35
  221. package/dist/lib/browser/meta.mjs +0 -9
  222. package/dist/lib/browser/types.mjs +0 -16
  223. package/dist/lib/browser/types.mjs.map +0 -7
  224. package/dist/lib/node/SheetContainer-VVVRYTQG.cjs +0 -298
  225. package/dist/lib/node/SheetContainer-VVVRYTQG.cjs.map +0 -7
  226. package/dist/lib/node/chunk-2ZVZI2KJ.cjs.map +0 -7
  227. package/dist/lib/node/chunk-45YW2DX2.cjs +0 -1656
  228. package/dist/lib/node/chunk-45YW2DX2.cjs.map +0 -7
  229. package/dist/lib/node/chunk-KSEEI5VC.cjs +0 -3323
  230. package/dist/lib/node/chunk-KSEEI5VC.cjs.map +0 -7
  231. package/dist/lib/node/chunk-OWH2EUHZ.cjs +0 -90
  232. package/dist/lib/node/chunk-OWH2EUHZ.cjs.map +0 -7
  233. package/dist/lib/node/compute-graph-WILPHO4A.cjs +0 -57
  234. package/dist/lib/node/compute-graph-WILPHO4A.cjs.map +0 -7
  235. package/dist/lib/node/meta.cjs.map +0 -7
  236. package/dist/lib/node/types.cjs.map +0 -7
  237. package/dist/lib/node-esm/SheetContainer-LSBE6Q4X.mjs +0 -297
  238. package/dist/lib/node-esm/SheetContainer-LSBE6Q4X.mjs.map +0 -7
  239. package/dist/lib/node-esm/chunk-6JF2AHKO.mjs +0 -3270
  240. package/dist/lib/node-esm/chunk-6JF2AHKO.mjs.map +0 -7
  241. package/dist/lib/node-esm/chunk-BM2Q3FFC.mjs.map +0 -7
  242. package/dist/lib/node-esm/chunk-BVS2IQRO.mjs +0 -68
  243. package/dist/lib/node-esm/chunk-BVS2IQRO.mjs.map +0 -7
  244. package/dist/lib/node-esm/chunk-NYDNXI7L.mjs +0 -1676
  245. package/dist/lib/node-esm/chunk-NYDNXI7L.mjs.map +0 -7
  246. package/dist/lib/node-esm/compute-graph-S6CVN7RS.mjs +0 -36
  247. package/dist/lib/node-esm/compute-graph-S6CVN7RS.mjs.map +0 -7
  248. package/dist/lib/node-esm/meta.mjs +0 -10
  249. package/dist/lib/node-esm/meta.mjs.map +0 -7
  250. package/dist/lib/node-esm/types.mjs +0 -17
  251. package/dist/lib/node-esm/types.mjs.map +0 -7
  252. package/dist/types/src/components/SheetObjectSettings.d.ts +0 -7
  253. package/dist/types/src/components/SheetObjectSettings.d.ts.map +0 -1
  254. package/dist/types/src/components/Toolbar/Toolbar.d.ts +0 -48
  255. package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +0 -1
  256. package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +0 -7
  257. package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +0 -1
  258. package/dist/types/src/components/Toolbar/index.d.ts +0 -2
  259. package/dist/types/src/components/Toolbar/index.d.ts.map +0 -1
  260. package/dist/types/src/compute-graph/compute-graph-registry.d.ts +0 -34
  261. package/dist/types/src/compute-graph/compute-graph-registry.d.ts.map +0 -1
  262. package/dist/types/src/compute-graph/compute-graph.d.ts +0 -64
  263. package/dist/types/src/compute-graph/compute-graph.d.ts.map +0 -1
  264. package/dist/types/src/compute-graph/compute-graph.stories.d.ts.map +0 -1
  265. package/dist/types/src/compute-graph/compute-graph.test.d.ts +0 -2
  266. package/dist/types/src/compute-graph/compute-graph.test.d.ts.map +0 -1
  267. package/dist/types/src/compute-graph/compute-node.d.ts +0 -26
  268. package/dist/types/src/compute-graph/compute-node.d.ts.map +0 -1
  269. package/dist/types/src/compute-graph/functions/async-function.d.ts +0 -66
  270. package/dist/types/src/compute-graph/functions/async-function.d.ts.map +0 -1
  271. package/dist/types/src/compute-graph/functions/edge-function.d.ts +0 -21
  272. package/dist/types/src/compute-graph/functions/edge-function.d.ts.map +0 -1
  273. package/dist/types/src/compute-graph/functions/function-defs.d.ts +0 -11
  274. package/dist/types/src/compute-graph/functions/function-defs.d.ts.map +0 -1
  275. package/dist/types/src/compute-graph/functions/index.d.ts +0 -4
  276. package/dist/types/src/compute-graph/functions/index.d.ts.map +0 -1
  277. package/dist/types/src/compute-graph/hyperformula.test.d.ts +0 -2
  278. package/dist/types/src/compute-graph/hyperformula.test.d.ts.map +0 -1
  279. package/dist/types/src/compute-graph/index.d.ts +0 -5
  280. package/dist/types/src/compute-graph/index.d.ts.map +0 -1
  281. package/dist/types/src/compute-graph/testing/index.d.ts +0 -3
  282. package/dist/types/src/compute-graph/testing/index.d.ts.map +0 -1
  283. package/dist/types/src/compute-graph/testing/test-builder.d.ts +0 -15
  284. package/dist/types/src/compute-graph/testing/test-builder.d.ts.map +0 -1
  285. package/dist/types/src/compute-graph/testing/test-plugin.d.ts +0 -36
  286. package/dist/types/src/compute-graph/testing/test-plugin.d.ts.map +0 -1
  287. package/dist/types/src/compute-graph/util.d.ts +0 -2
  288. package/dist/types/src/compute-graph/util.d.ts.map +0 -1
  289. package/dist/types/src/defs/index.d.ts.map +0 -1
  290. package/dist/types/src/defs/sheet-range-types.d.ts.map +0 -1
  291. package/dist/types/src/defs/types.d.ts +0 -26
  292. package/dist/types/src/defs/types.d.ts.map +0 -1
  293. package/dist/types/src/defs/types.test.d.ts +0 -2
  294. package/dist/types/src/defs/types.test.d.ts.map +0 -1
  295. package/dist/types/src/defs/util.d.ts.map +0 -1
  296. package/dist/types/src/types.d.ts +0 -182
  297. package/dist/types/src/types.d.ts.map +0 -1
  298. package/dist/vendor/hyperformula.mjs +0 -37145
  299. package/src/components/SheetObjectSettings.tsx +0 -38
  300. package/src/components/Toolbar/Toolbar.tsx +0 -346
  301. package/src/compute-graph/compute-graph-registry.ts +0 -90
  302. package/src/compute-graph/compute-graph.test.ts +0 -87
  303. package/src/compute-graph/compute-graph.ts +0 -260
  304. package/src/compute-graph/compute-node.ts +0 -62
  305. package/src/compute-graph/functions/async-function.ts +0 -179
  306. package/src/compute-graph/functions/edge-function.ts +0 -102
  307. package/src/compute-graph/functions/function-defs.ts +0 -2427
  308. package/src/compute-graph/functions/index.ts +0 -7
  309. package/src/compute-graph/hyperformula.test.ts +0 -14
  310. package/src/compute-graph/index.ts +0 -8
  311. package/src/compute-graph/testing/index.ts +0 -6
  312. package/src/compute-graph/testing/test-builder.ts +0 -54
  313. package/src/compute-graph/testing/test-plugin.ts +0 -100
  314. package/src/compute-graph/util.ts +0 -8
  315. package/src/defs/types.test.ts +0 -91
  316. package/src/defs/types.ts +0 -88
  317. package/src/types.ts +0 -125
  318. /package/dist/lib/browser/{compute-graph-SNUS7HOH.mjs.map → types/index.mjs.map} +0 -0
  319. /package/dist/lib/{browser/meta.mjs.map → node-esm/types/index.mjs.map} +0 -0
  320. /package/dist/types/src/{compute-graph → components/ComputeGraph}/compute-graph.stories.d.ts +0 -0
@@ -0,0 +1,72 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { useEffect } from 'react';
6
+
7
+ import { inRange } from '@dxos/compute';
8
+ import { createMenuAction, createMenuItemGroup, type ToolbarMenuActionGroupProperties } from '@dxos/react-ui-menu';
9
+
10
+ import { SHEET_PLUGIN } from '../../meta';
11
+ import { rangeFromIndex, type StyleKey, type StyleValue } from '../../types';
12
+ import { useSheetContext } from '../SheetContext';
13
+
14
+ export type StyleState = Partial<Record<StyleValue, boolean>>;
15
+
16
+ export type StyleAction = { key: StyleKey; value: StyleValue };
17
+
18
+ const styles: Record<StyleValue, string> = {
19
+ highlight: 'ph--highlighter--regular',
20
+ softwrap: 'ph--paragraph--regular',
21
+ };
22
+
23
+ export const useStyleState = (state: StyleState) => {
24
+ const { cursorFallbackRange, model } = useSheetContext();
25
+
26
+ useEffect(() => {
27
+ state.highlight = false;
28
+ state.softwrap = false;
29
+ if (cursorFallbackRange && model.sheet.ranges) {
30
+ model.sheet.ranges
31
+ .filter(
32
+ ({ range, key }) => key === 'style' && inRange(rangeFromIndex(model.sheet, range), cursorFallbackRange.from),
33
+ )
34
+ .forEach(({ value }) => {
35
+ state[value as StyleValue] = true;
36
+ });
37
+ }
38
+ }, [cursorFallbackRange, model.sheet]);
39
+ };
40
+
41
+ const createStyleGroup = (state: StyleState) => {
42
+ return createMenuItemGroup('style', {
43
+ variant: 'toggleGroup',
44
+ selectCardinality: 'multiple',
45
+ value: Object.keys(styles)
46
+ .filter((key) => !!state[key as StyleValue])
47
+ .map((styleValue) => `style--${styleValue}`),
48
+ } as ToolbarMenuActionGroupProperties);
49
+ };
50
+
51
+ const createStyleActions = (state: StyleState) =>
52
+ Object.entries(styles).map(([styleValue, icon]) => {
53
+ return createMenuAction<StyleAction>(`style--${styleValue}`, {
54
+ key: 'style',
55
+ value: styleValue as StyleValue,
56
+ icon,
57
+ label: [`range value ${styleValue} label`, { ns: SHEET_PLUGIN }],
58
+ checked: !!state[styleValue as StyleValue],
59
+ });
60
+ });
61
+
62
+ export const createStyle = (state: StyleState) => {
63
+ const styleGroupAction = createStyleGroup(state);
64
+ const styleActions = createStyleActions(state);
65
+ return {
66
+ nodes: [styleGroupAction, ...styleActions],
67
+ edges: [
68
+ { source: 'root', target: 'style' },
69
+ ...styleActions.map(({ id }) => ({ source: styleGroupAction.id, target: id })),
70
+ ],
71
+ };
72
+ };
@@ -0,0 +1,87 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { useCallback } from 'react';
6
+
7
+ import { createIntent, useIntentDispatcher } from '@dxos/app-framework';
8
+ import { inRange } from '@dxos/compute';
9
+ import { ThreadAction } from '@dxos/plugin-thread/types';
10
+ import type { MenuAction, MenuActionHandler } from '@dxos/react-ui-menu';
11
+
12
+ import { type AlignAction } from './align';
13
+ import { type CommentAction } from './comment';
14
+ import { type StyleAction } from './style';
15
+ import { type ToolbarState } from './useToolbarState';
16
+ import { completeCellRangeToThreadCursor } from '../../integrations';
17
+ import { alignKey, rangeFromIndex, rangeToIndex } from '../../types';
18
+ import { useSheetContext } from '../SheetContext';
19
+
20
+ export type ToolbarAction = StyleAction | AlignAction | CommentAction;
21
+
22
+ export const useToolbarAction = (state: ToolbarState) => {
23
+ const { model, cursorFallbackRange, cursor } = useSheetContext();
24
+ const { dispatchPromise: dispatch } = useIntentDispatcher();
25
+
26
+ // TODO(Zan): Externalize the toolbar action handler. E.g., Toolbar/keys should both fire events.
27
+ return useCallback(
28
+ (action: MenuAction<ToolbarAction>) => {
29
+ const { key, value } = action.properties;
30
+ if (cursorFallbackRange) {
31
+ const index =
32
+ model.sheet.ranges?.findIndex(
33
+ (range) => range.key === key && inRange(rangeFromIndex(model.sheet, range.range), cursorFallbackRange.from),
34
+ ) ?? -1;
35
+ const nextRangeEntity = {
36
+ range: rangeToIndex(model.sheet, cursorFallbackRange),
37
+ key,
38
+ value,
39
+ };
40
+ switch (key) {
41
+ case 'alignment':
42
+ if (index < 0) {
43
+ model.sheet.ranges?.push(nextRangeEntity);
44
+ state[alignKey] = value;
45
+ } else if (model.sheet.ranges![index].value === value) {
46
+ model.sheet.ranges?.splice(index, 1);
47
+ state[alignKey] = undefined;
48
+ } else {
49
+ model.sheet.ranges?.splice(index, 1, nextRangeEntity);
50
+ state[alignKey] = value;
51
+ }
52
+ break;
53
+ case 'style':
54
+ if (
55
+ model.sheet.ranges
56
+ .filter(
57
+ ({ range, key: rangeKey }) =>
58
+ rangeKey === 'style' && inRange(rangeFromIndex(model.sheet, range), cursorFallbackRange.from),
59
+ )
60
+ .some(({ value: rangeValue }) => rangeValue === value)
61
+ ) {
62
+ // this value should be unset
63
+ if (index >= 0) {
64
+ model.sheet.ranges?.splice(index, 1);
65
+ }
66
+ state[value] = false;
67
+ } else {
68
+ model.sheet.ranges?.push(nextRangeEntity);
69
+ state[value] = true;
70
+ }
71
+ break;
72
+ case 'comment': {
73
+ const cellContent = model.getCellText(cursorFallbackRange.from);
74
+ void dispatch(
75
+ createIntent(ThreadAction.Create, {
76
+ cursor: completeCellRangeToThreadCursor(cursorFallbackRange),
77
+ name: cellContent,
78
+ subject: model.sheet,
79
+ }),
80
+ );
81
+ }
82
+ }
83
+ }
84
+ },
85
+ [model.sheet, cursorFallbackRange, cursor, dispatch],
86
+ ) as MenuActionHandler;
87
+ };
@@ -0,0 +1,17 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { useMemo } from 'react';
6
+
7
+ import { create } from '@dxos/live-object';
8
+
9
+ import { type AlignState } from './align';
10
+ import { type CommentState } from './comment';
11
+ import { type StyleState } from './style';
12
+
13
+ export type ToolbarState = Partial<StyleState & AlignState & CommentState>;
14
+
15
+ export const useToolbarState = (initialState: ToolbarState = {}) => {
16
+ return useMemo(() => create<ToolbarState>(initialState), []);
17
+ };
@@ -8,6 +8,5 @@ export * from './ComputeGraph';
8
8
  export * from './GridSheet';
9
9
  export * from './RangeList';
10
10
  export * from './SheetContext';
11
- export * from './SheetObjectSettings';
12
11
 
13
12
  export const SheetContainer = lazy(() => import('./SheetContainer'));
@@ -15,13 +15,16 @@ import {
15
15
  import { Decoration, EditorView, ViewPlugin, WidgetType } from '@codemirror/view';
16
16
 
17
17
  import { type UnsubscribeCallback, debounce } from '@dxos/async';
18
+ import {
19
+ createSheetName,
20
+ type CellAddress,
21
+ type CellScalarValue,
22
+ type ComputeGraph,
23
+ type ComputeNode,
24
+ } from '@dxos/compute';
18
25
  import { invariant } from '@dxos/invariant';
19
26
  import { documentId, singleValueFacet } from '@dxos/react-ui-editor';
20
27
 
21
- import { type ComputeGraph, type ComputeNode, createSheetName } from '../compute-graph';
22
- import { type CellAddress } from '../defs';
23
- import { type CellScalarValue } from '../types';
24
-
25
28
  const LANGUAGE_TAG = 'dx';
26
29
 
27
30
  // TODO(burdon): Create marker just for our decorator?
@@ -8,8 +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';
12
+
11
13
  import { sheetExtension } from './extension';
12
- import { defaultFunctions } from '../../compute-graph';
13
14
 
14
15
  describe('formula parser', () => {
15
16
  const {
@@ -18,12 +18,11 @@ 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';
21
23
  import { singleValueFacet } from '@dxos/react-ui-editor';
22
24
  import { mx } from '@dxos/react-ui-theme';
23
25
 
24
- import { type FunctionDefinition } from '../../compute-graph';
25
- import { RANGE_NOTATION } from '../../defs';
26
-
27
26
  /**
28
27
  * https://codemirror.net/examples/styling
29
28
  * https://lezer.codemirror.net/docs/ref/#highlight
package/src/index.ts CHANGED
@@ -2,11 +2,6 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { SheetPlugin } from './SheetPlugin';
6
-
5
+ export { SheetCapabilities } from './capabilities';
6
+ export * from './meta';
7
7
  export * from './SheetPlugin';
8
-
9
- // TODO(burdon): Move to types entrypoint or create a new one.
10
- export * from './defs';
11
-
12
- export default SheetPlugin;
@@ -4,13 +4,20 @@
4
4
 
5
5
  import { useCallback, useEffect, useMemo } from 'react';
6
6
 
7
- import { type IntentResolver, LayoutAction, useIntentDispatcher, useIntentResolver } from '@dxos/app-framework';
7
+ import {
8
+ createIntent,
9
+ createResolver,
10
+ LayoutAction,
11
+ useIntentDispatcher,
12
+ useIntentResolver,
13
+ } from '@dxos/app-framework';
8
14
  import { debounce } from '@dxos/async';
15
+ import { type CellAddress, type CompleteCellRange, inRange } from '@dxos/compute';
16
+ import { ThreadAction } from '@dxos/plugin-thread/types';
9
17
  import { fullyQualifiedId } from '@dxos/react-client/echo';
10
18
  import { type DxGridElement, type DxGridPosition } from '@dxos/react-ui-grid';
11
19
 
12
20
  import { useSheetContext } from '../components';
13
- import { type CellAddress, type CompleteCellRange, inRange } from '../defs';
14
21
  import { SHEET_PLUGIN } from '../meta';
15
22
 
16
23
  export const completeCellRangeToThreadCursor = (range: CompleteCellRange): string => {
@@ -32,31 +39,30 @@ export const parseThreadAnchorAsCellRange = (cursor: string): CompleteCellRange
32
39
 
33
40
  export const useUpdateFocusedCellOnThreadSelection = (grid: DxGridElement | null) => {
34
41
  const { model, setActiveRefs } = useSheetContext();
35
- const handleScrollIntoView: IntentResolver = useCallback(
36
- ({ action, data }) => {
37
- switch (action) {
38
- case LayoutAction.SCROLL_INTO_VIEW: {
39
- if (!data?.id || data?.cursor === undefined || data?.id !== fullyQualifiedId(model.sheet)) {
40
- return;
41
- }
42
- setActiveRefs(data.thread);
42
+ const scrollIntoViewResolver = useMemo(
43
+ () =>
44
+ createResolver(
45
+ LayoutAction.ScrollIntoView,
46
+ ({ cursor, ref }) => {
47
+ setActiveRefs(ref);
43
48
  // TODO(Zan): Everywhere we refer to the cursor in a thread context should change to `anchor`.
44
- const range = parseThreadAnchorAsCellRange(data.cursor);
49
+ const range = parseThreadAnchorAsCellRange(cursor!);
45
50
  range && grid?.setFocus({ ...range.to, plane: 'grid' }, true);
46
-
47
- return { data: true };
48
- }
49
- }
50
- },
51
+ },
52
+ {
53
+ disposition: 'hoist',
54
+ filter: (data) => data.id === fullyQualifiedId(model.sheet) && !!data.cursor,
55
+ },
56
+ ),
51
57
  [model.sheet, setActiveRefs],
52
58
  );
53
59
 
54
- useIntentResolver(SHEET_PLUGIN, handleScrollIntoView);
60
+ useIntentResolver(SHEET_PLUGIN, scrollIntoViewResolver);
55
61
  };
56
62
 
57
63
  export const useSelectThreadOnCellFocus = () => {
58
64
  const { model, cursor } = useSheetContext();
59
- const dispatch = useIntentDispatcher();
65
+ const { dispatchPromise: dispatch } = useIntentDispatcher();
60
66
 
61
67
  const threads = useMemo(
62
68
  () => model.sheet.threads?.filter((thread): thread is NonNullable<typeof thread> => !!thread) ?? [],
@@ -72,9 +78,9 @@ export const useSelectThreadOnCellFocus = () => {
72
78
  return;
73
79
  }
74
80
 
75
- const closestThread = threads?.find(({ anchor }) => {
76
- if (anchor) {
77
- const range = parseThreadAnchorAsCellRange(anchor);
81
+ const closestThread = threads?.find((ref) => {
82
+ if (ref.target?.anchor) {
83
+ const range = parseThreadAnchorAsCellRange(ref.target!.anchor);
78
84
  return range ? inRange(range, cellAddress) : false;
79
85
  } else {
80
86
  return false;
@@ -82,9 +88,7 @@ export const useSelectThreadOnCellFocus = () => {
82
88
  });
83
89
 
84
90
  if (closestThread) {
85
- void dispatch([
86
- { action: 'dxos.org/plugin/thread/action/select', data: { current: fullyQualifiedId(closestThread) } },
87
- ]);
91
+ void dispatch(createIntent(ThreadAction.Select, { current: fullyQualifiedId(closestThread) }));
88
92
  }
89
93
  },
90
94
  [dispatch, threads],
package/src/meta.ts CHANGED
@@ -6,7 +6,7 @@ import { type PluginMeta } from '@dxos/app-framework';
6
6
 
7
7
  export const SHEET_PLUGIN = 'dxos.org/plugin/sheet';
8
8
 
9
- export default {
9
+ export const meta = {
10
10
  id: SHEET_PLUGIN,
11
11
  name: 'Sheet',
12
12
  description: 'A simple spreadsheet plugin.',
@@ -5,20 +5,14 @@
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
11
  import { log } from '@dxos/log';
9
- import { FunctionType } from '@dxos/plugin-script/types';
10
12
 
11
13
  import { SheetModel } from './sheet-model';
12
14
  import { createTestGrid } from './testing';
13
- import { TestBuilder, testFunctionPlugins } from '../compute-graph/testing';
14
- import {
15
- addressFromA1Notation,
16
- createSheet,
17
- isFormula,
18
- mapFormulaIndicesToRefs,
19
- mapFormulaRefsToIndices,
20
- } from '../defs';
21
- import { type CellScalarValue } from '../types';
15
+ import { createSheet, mapFormulaIndicesToRefs, mapFormulaRefsToIndices } from '../types';
22
16
 
23
17
  describe('SheetModel', () => {
24
18
  let testBuilder: TestBuilder;
@@ -2,37 +2,45 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { type SimpleCellRange } from 'hyperformula/typings/AbsoluteCellRange';
6
- import { type SimpleCellAddress } from 'hyperformula/typings/Cell';
7
- import { type SimpleDate, type SimpleDateTime } from 'hyperformula/typings/DateTimeHelper';
8
-
9
5
  import { Event } from '@dxos/async';
6
+ import {
7
+ addressFromA1Notation,
8
+ addressToA1Notation,
9
+ createSheetName,
10
+ isFormula,
11
+ type CellAddress,
12
+ type CellRange,
13
+ type CellScalarValue,
14
+ type ComputeGraph,
15
+ type ComputeNode,
16
+ type ComputeNodeEvent,
17
+ DetailedCellError,
18
+ ExportedCellChange,
19
+ type SimpleCellRange,
20
+ type SimpleCellAddress,
21
+ type SimpleDate,
22
+ type SimpleDateTime,
23
+ } from '@dxos/compute';
10
24
  import { Resource } from '@dxos/context';
11
25
  import { getTypename, FormatEnum, TypeEnum } from '@dxos/echo-schema';
12
26
  import { invariant } from '@dxos/invariant';
13
27
  import { PublicKey } from '@dxos/keys';
14
28
  import { log } from '@dxos/log';
15
29
 
16
- import { DetailedCellError, ExportedCellChange } from '#hyperformula';
17
- import { type ComputeGraph, type ComputeNode, type ComputeNodeEvent, createSheetName } from '../compute-graph';
18
30
  import {
19
- addressFromA1Notation,
31
+ ReadonlyException,
20
32
  addressFromIndex,
21
- addressToA1Notation,
22
33
  addressToIndex,
23
34
  initialize,
24
35
  insertIndices,
25
- isFormula,
26
- type CellAddress,
27
- type CellRange,
28
- ReadonlyException,
29
- MAX_COLUMNS,
30
- MAX_ROWS,
31
36
  mapFormulaIndicesToRefs,
32
37
  mapFormulaRefsToIndices,
33
- } from '../defs';
34
- import { type CellScalarValue, type CellValue, type SheetType, type RestoreAxis } from '../types';
38
+ MAX_ROWS,
39
+ MAX_COLS,
40
+ } from '../types';
41
+ import { type SheetAction, type CellValue, type SheetType } from '../types';
35
42
 
43
+ // TODO(burdon): Move to compute.
36
44
  // Map sheet types to system types.
37
45
  // https://hyperformula.handsontable.com/guide/types-of-values.html
38
46
  // - https://github.com/handsontable/hyperformula/blob/master/src/Cell.ts (CellValueType)
@@ -176,12 +184,12 @@ export class SheetModel extends Resource {
176
184
  }
177
185
 
178
186
  insertColumns(i: number, n = 1) {
179
- const idx = insertIndices(this._sheet.columns, i, n, MAX_COLUMNS);
187
+ const idx = insertIndices(this._sheet.columns, i, n, MAX_COLS);
180
188
  this.reset();
181
189
  return idx;
182
190
  }
183
191
 
184
- dropRow(rowIndex: string): RestoreAxis {
192
+ dropRow(rowIndex: string): SheetAction.RestoreAxis {
185
193
  const range = {
186
194
  from: addressFromIndex(this._sheet, `${this._sheet.columns[0]}@${rowIndex}`),
187
195
  to: addressFromIndex(this._sheet, `${this._sheet.columns[this._sheet.columns.length - 1]}@${rowIndex}`),
@@ -195,7 +203,7 @@ export class SheetModel extends Resource {
195
203
  return { axis: 'row', index, axisIndex: rowIndex, axisMeta: this._sheet.rowMeta[rowIndex], values };
196
204
  }
197
205
 
198
- dropColumn(colIndex: string): RestoreAxis {
206
+ dropColumn(colIndex: string): SheetAction.RestoreAxis {
199
207
  const range = {
200
208
  from: addressFromIndex(this._sheet, `${colIndex}@${this._sheet.rows[0]}`),
201
209
  to: addressFromIndex(this._sheet, `${colIndex}@${this._sheet.rows[this._sheet.rows.length - 1]}`),
@@ -209,7 +217,7 @@ export class SheetModel extends Resource {
209
217
  return { axis: 'col', index, axisIndex: colIndex, axisMeta: this._sheet.rowMeta[colIndex], values };
210
218
  }
211
219
 
212
- restoreRow({ index, axisIndex, axisMeta, values }: RestoreAxis) {
220
+ restoreRow({ index, axisIndex, axisMeta, values }: SheetAction.RestoreAxis) {
213
221
  this._sheet.rows.splice(index, 0, axisIndex);
214
222
  values.forEach((value, col) => {
215
223
  if (value) {
@@ -222,7 +230,7 @@ export class SheetModel extends Resource {
222
230
  this.reset();
223
231
  }
224
232
 
225
- restoreColumn({ index, axisIndex, axisMeta, values }: RestoreAxis) {
233
+ restoreColumn({ index, axisIndex, axisMeta, values }: SheetAction.RestoreAxis) {
226
234
  this._sheet.columns.splice(index, 0, axisIndex);
227
235
  values.forEach((value, row) => {
228
236
  if (value) {
@@ -373,7 +381,7 @@ export class SheetModel extends Resource {
373
381
  refresh = true;
374
382
  }
375
383
  if (cell.col >= this._sheet.columns.length) {
376
- insertIndices(this._sheet.columns, cell.col, 1, MAX_COLUMNS);
384
+ insertIndices(this._sheet.columns, cell.col, 1, MAX_COLS);
377
385
  refresh = true;
378
386
  }
379
387
 
@@ -2,8 +2,9 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { addressToA1Notation, createSheet } from '../defs';
6
- import type { CellValue, SheetType } from '../types';
5
+ import { addressToA1Notation } from '@dxos/compute';
6
+
7
+ import { type CellValue, type SheetType, createSheet } from '../types';
7
8
 
8
9
  // TODO(burdon): Create testing endpoint.
9
10
  // TODO(burdon): Move to react-ui-sheet.
@@ -4,7 +4,8 @@
4
4
 
5
5
  import { useEffect, useState } from 'react';
6
6
 
7
- import { type ComputeGraph } from '../compute-graph';
7
+ import { type ComputeGraph } from '@dxos/compute';
8
+
8
9
  import { SheetModel } from '../model';
9
10
  import { type SheetType } from '../types';
10
11
 
@@ -12,7 +12,7 @@ import { describe, test, expect } from 'vitest';
12
12
 
13
13
  import { Client } from '@dxos/client';
14
14
  import { create } from '@dxos/client/echo';
15
- import { FunctionType } from '@dxos/plugin-script/types';
15
+ import { FunctionType } from '@dxos/functions';
16
16
 
17
17
  // TODO(burdon): Fix test infrastructure:
18
18
  // - Need docs? esp. needed for config. need pristine example package?
@@ -5,13 +5,12 @@
5
5
  import { type Decorator } from '@storybook/react';
6
6
  import React, { useState } from 'react';
7
7
 
8
+ import { type ComputeGraph, type ComputeGraphOptions, ComputeGraphRegistry } from '@dxos/compute';
8
9
  import { type Space } from '@dxos/react-client/echo';
9
10
  import { useAsyncState } from '@dxos/react-hooks';
10
11
 
11
12
  import { ComputeGraphContextProvider } from '../components';
12
- import { type ComputeGraph, type ComputeGraphOptions, ComputeGraphRegistry } from '../compute-graph';
13
- import { createSheet } from '../defs';
14
- import { type CreateSheetOptions } from '../types';
13
+ import { createSheet, type CreateSheetOptions } from '../types';
15
14
 
16
15
  export const useTestSheet = (space?: Space, graph?: ComputeGraph, options?: CreateSheetOptions) => {
17
16
  const [sheet] = useAsyncState(async () => {
@@ -2,6 +2,7 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
+ export * from './schema';
5
6
  export * from './sheet-range-types';
6
7
  export * from './types';
7
8
  export * from './util';
@@ -0,0 +1,56 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { Ref, S, TypedObject } from '@dxos/echo-schema';
6
+ import { ThreadType } from '@dxos/plugin-space/types';
7
+
8
+ export const CellValue = S.Struct({
9
+ // TODO(burdon): How to store dates (datetime, date, time), percentages, etc.
10
+ // Consider import/export; natural access for other plugins. Special handling for currency (precision).
11
+ // TODO(burdon): Automerge (long string) or short string or number.
12
+ value: S.Any,
13
+ });
14
+
15
+ export type CellValue = S.Schema.Type<typeof CellValue>;
16
+
17
+ // TODO(burdon): IMPORTANT: Reconcile with Field definition.
18
+ export const Range = S.Struct({
19
+ range: S.String,
20
+ key: S.String,
21
+ value: S.String,
22
+ });
23
+
24
+ export type Range = S.Schema.Type<typeof Range>;
25
+
26
+ // TODO(burdon): Visibility, locked, frozen, etc.
27
+ export const RowColumnMeta = S.Struct({
28
+ size: S.optional(S.Number),
29
+ });
30
+
31
+ // TODO(burdon): Reconcile col/column (across packages).
32
+ // TODO(burdon): Index to all updates when rows/columns are inserted/deleted.
33
+ export class SheetType extends TypedObject({ typename: 'dxos.org/type/Sheet', version: '0.1.0' })({
34
+ name: S.optional(S.String),
35
+
36
+ // Sparse map of cells referenced by index.
37
+ cells: S.mutable(S.Record({ key: S.String, value: S.mutable(CellValue) })),
38
+
39
+ // Ordered row indices.
40
+ rows: S.mutable(S.Array(S.String)),
41
+
42
+ // Ordered column indices.
43
+ columns: S.mutable(S.Array(S.String)),
44
+
45
+ // Row metadata referenced by index.
46
+ rowMeta: S.mutable(S.Record({ key: S.String, value: S.mutable(RowColumnMeta) })),
47
+
48
+ // Column metadata referenced by index.
49
+ columnMeta: S.mutable(S.Record({ key: S.String, value: S.mutable(RowColumnMeta) })),
50
+
51
+ // Cell formatting referenced by indexed range.
52
+ ranges: S.mutable(S.Array(Range)),
53
+
54
+ // Threads associated with the sheet
55
+ threads: S.optional(S.mutable(S.Array(Ref(ThreadType)))),
56
+ }) {}
@@ -8,7 +8,7 @@ import { type SheetType } from '../types';
8
8
 
9
9
  export const alignKey = 'alignment';
10
10
  export type AlignKey = typeof alignKey;
11
- export type AlignValue = 'start' | 'center' | 'end' | 'unset';
11
+ export type AlignValue = 'start' | 'center' | 'end';
12
12
 
13
13
  export const commentKey = 'comment';
14
14
  export type CommentKey = typeof commentKey;