@dxos/plugin-sheet 0.7.4 → 0.7.5-labs.071a3e2

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 (313) hide show
  1. package/dist/lib/browser/SheetContainer-IMHGS7Z4.mjs +370 -0
  2. package/dist/lib/browser/SheetContainer-IMHGS7Z4.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-AT7F2WDW.mjs +808 -0
  4. package/dist/lib/browser/chunk-AT7F2WDW.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-FOO6NGBM.mjs +229 -0
  6. package/dist/lib/browser/chunk-FOO6NGBM.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-GAFHJBCU.mjs +18 -0
  8. package/dist/lib/browser/chunk-GAFHJBCU.mjs.map +7 -0
  9. package/dist/lib/browser/chunk-LXHRT3CC.mjs +15 -0
  10. package/dist/lib/browser/chunk-LXHRT3CC.mjs.map +7 -0
  11. package/dist/lib/browser/chunk-OOSRC36N.mjs +900 -0
  12. package/dist/lib/browser/chunk-OOSRC36N.mjs.map +7 -0
  13. package/dist/lib/browser/compute-graph-registry-EGPD4HEX.mjs +27 -0
  14. package/dist/lib/browser/compute-graph-registry-EGPD4HEX.mjs.map +7 -0
  15. package/dist/lib/browser/index.mjs +80 -324
  16. package/dist/lib/browser/index.mjs.map +4 -4
  17. package/dist/lib/browser/intent-resolver-6S2RMLQF.mjs +56 -0
  18. package/dist/lib/browser/intent-resolver-6S2RMLQF.mjs.map +7 -0
  19. package/dist/lib/browser/markdown-CFJIWHZX.mjs +26 -0
  20. package/dist/lib/browser/markdown-CFJIWHZX.mjs.map +7 -0
  21. package/dist/lib/browser/meta.json +1 -1
  22. package/dist/lib/browser/react-surface-PHKJZYFB.mjs +52 -0
  23. package/dist/lib/browser/react-surface-PHKJZYFB.mjs.map +7 -0
  24. package/dist/lib/browser/thread-7ZWW5EA7.mjs +17 -0
  25. package/dist/lib/browser/thread-7ZWW5EA7.mjs.map +7 -0
  26. package/dist/lib/browser/types/index.mjs +62 -0
  27. package/dist/lib/node/SheetContainer-NNIZN4AK.cjs +364 -0
  28. package/dist/lib/node/SheetContainer-NNIZN4AK.cjs.map +7 -0
  29. package/dist/lib/node/chunk-2KCZUH72.cjs +815 -0
  30. package/dist/lib/node/chunk-2KCZUH72.cjs.map +7 -0
  31. package/dist/lib/node/chunk-4LSYTNS4.cjs +935 -0
  32. package/dist/lib/node/chunk-4LSYTNS4.cjs.map +7 -0
  33. package/dist/lib/node/{chunk-2ZVZI2KJ.cjs → chunk-MLU6KRQN.cjs} +12 -9
  34. package/dist/lib/node/chunk-MLU6KRQN.cjs.map +7 -0
  35. package/dist/lib/node/chunk-P4KSGZSS.cjs +251 -0
  36. package/dist/lib/node/chunk-P4KSGZSS.cjs.map +7 -0
  37. package/dist/lib/node/{types.cjs → chunk-ZV2RS3QH.cjs} +12 -16
  38. package/dist/lib/node/chunk-ZV2RS3QH.cjs.map +7 -0
  39. package/dist/lib/node/compute-graph-registry-GJK5H264.cjs +53 -0
  40. package/dist/lib/node/compute-graph-registry-GJK5H264.cjs.map +7 -0
  41. package/dist/lib/node/index.cjs +81 -318
  42. package/dist/lib/node/index.cjs.map +4 -4
  43. package/dist/lib/node/intent-resolver-I25V7SBT.cjs +69 -0
  44. package/dist/lib/node/intent-resolver-I25V7SBT.cjs.map +7 -0
  45. package/dist/lib/node/markdown-YTCSW66K.cjs +40 -0
  46. package/dist/lib/node/markdown-YTCSW66K.cjs.map +7 -0
  47. package/dist/lib/node/meta.json +1 -1
  48. package/dist/lib/node/react-surface-HLE6CRA6.cjs +70 -0
  49. package/dist/lib/node/react-surface-HLE6CRA6.cjs.map +7 -0
  50. package/dist/lib/node/{meta.cjs → thread-DRNYTR6M.cjs} +12 -10
  51. package/dist/lib/node/thread-DRNYTR6M.cjs.map +7 -0
  52. package/dist/lib/node/types/index.cjs +84 -0
  53. package/dist/lib/node/types/index.cjs.map +7 -0
  54. package/dist/lib/node-esm/SheetContainer-PGDJKGTZ.mjs +371 -0
  55. package/dist/lib/node-esm/SheetContainer-PGDJKGTZ.mjs.map +7 -0
  56. package/dist/lib/node-esm/chunk-HPAMZ6SP.mjs +901 -0
  57. package/dist/lib/node-esm/chunk-HPAMZ6SP.mjs.map +7 -0
  58. package/dist/lib/node-esm/chunk-PTOI45NK.mjs +231 -0
  59. package/dist/lib/node-esm/chunk-PTOI45NK.mjs.map +7 -0
  60. package/dist/lib/node-esm/chunk-RTZXXOS2.mjs +20 -0
  61. package/dist/lib/node-esm/chunk-RTZXXOS2.mjs.map +7 -0
  62. package/dist/lib/node-esm/chunk-SX3S7UKU.mjs +16 -0
  63. package/dist/lib/node-esm/chunk-SX3S7UKU.mjs.map +7 -0
  64. package/dist/lib/node-esm/chunk-ZM7XLUGL.mjs +809 -0
  65. package/dist/lib/node-esm/chunk-ZM7XLUGL.mjs.map +7 -0
  66. package/dist/lib/node-esm/compute-graph-registry-3F5JCYEN.mjs +28 -0
  67. package/dist/lib/node-esm/compute-graph-registry-3F5JCYEN.mjs.map +7 -0
  68. package/dist/lib/node-esm/index.mjs +80 -324
  69. package/dist/lib/node-esm/index.mjs.map +4 -4
  70. package/dist/lib/node-esm/intent-resolver-IPRSINII.mjs +57 -0
  71. package/dist/lib/node-esm/intent-resolver-IPRSINII.mjs.map +7 -0
  72. package/dist/lib/node-esm/markdown-CGSK44XJ.mjs +27 -0
  73. package/dist/lib/node-esm/markdown-CGSK44XJ.mjs.map +7 -0
  74. package/dist/lib/node-esm/meta.json +1 -1
  75. package/dist/lib/node-esm/react-surface-PFRJ7V5N.mjs +53 -0
  76. package/dist/lib/node-esm/react-surface-PFRJ7V5N.mjs.map +7 -0
  77. package/dist/lib/node-esm/thread-6T5VXPAF.mjs +18 -0
  78. package/dist/lib/node-esm/thread-6T5VXPAF.mjs.map +7 -0
  79. package/dist/lib/node-esm/types/index.mjs +63 -0
  80. package/dist/types/src/SheetPlugin.d.ts +1 -3
  81. package/dist/types/src/SheetPlugin.d.ts.map +1 -1
  82. package/dist/types/src/capabilities/capabilities.d.ts +5 -0
  83. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
  84. package/dist/types/src/capabilities/compute-graph-registry.d.ts +4 -0
  85. package/dist/types/src/capabilities/compute-graph-registry.d.ts.map +1 -0
  86. package/dist/types/src/capabilities/index.d.ts +12 -0
  87. package/dist/types/src/capabilities/index.d.ts.map +1 -0
  88. package/dist/types/src/capabilities/intent-resolver.d.ts +4 -0
  89. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
  90. package/dist/types/src/capabilities/markdown.d.ts +6 -0
  91. package/dist/types/src/capabilities/markdown.d.ts.map +1 -0
  92. package/dist/types/src/capabilities/react-surface.d.ts +4 -0
  93. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  94. package/dist/types/src/capabilities/thread.d.ts +6 -0
  95. package/dist/types/src/capabilities/thread.d.ts.map +1 -0
  96. package/dist/types/src/components/ComputeGraph/ComputeGraphContextProvider.d.ts +1 -1
  97. package/dist/types/src/components/ComputeGraph/ComputeGraphContextProvider.d.ts.map +1 -1
  98. package/dist/types/src/components/ComputeGraph/compute-graph.stories.d.ts.map +1 -0
  99. package/dist/types/src/components/FunctionEditor/FunctionEditor.d.ts.map +1 -1
  100. package/dist/types/src/components/GridSheet/GridSheet.d.ts.map +1 -1
  101. package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +1 -1
  102. package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts.map +1 -1
  103. package/dist/types/src/components/GridSheet/util.d.ts.map +1 -1
  104. package/dist/types/src/components/RangeList/RangeList.d.ts.map +1 -1
  105. package/dist/types/src/components/SheetContainer/SheetContainer.d.ts.map +1 -1
  106. package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +1 -1
  107. package/dist/types/src/components/SheetContext/SheetContext.d.ts +1 -2
  108. package/dist/types/src/components/SheetContext/SheetContext.d.ts.map +1 -1
  109. package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts +7 -0
  110. package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts.map +1 -0
  111. package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts +6 -0
  112. package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts.map +1 -0
  113. package/dist/types/src/components/SheetToolbar/align.d.ts +28 -0
  114. package/dist/types/src/components/SheetToolbar/align.d.ts.map +1 -0
  115. package/dist/types/src/components/SheetToolbar/comment.d.ts +23 -0
  116. package/dist/types/src/components/SheetToolbar/comment.d.ts.map +1 -0
  117. package/dist/types/src/components/SheetToolbar/index.d.ts +2 -0
  118. package/dist/types/src/components/SheetToolbar/index.d.ts.map +1 -0
  119. package/dist/types/src/components/SheetToolbar/style.d.ts +26 -0
  120. package/dist/types/src/components/SheetToolbar/style.d.ts.map +1 -0
  121. package/dist/types/src/components/SheetToolbar/useToolbarAction.d.ts +8 -0
  122. package/dist/types/src/components/SheetToolbar/useToolbarAction.d.ts.map +1 -0
  123. package/dist/types/src/components/SheetToolbar/useToolbarState.d.ts +6 -0
  124. package/dist/types/src/components/SheetToolbar/useToolbarState.d.ts.map +1 -0
  125. package/dist/types/src/components/index.d.ts +0 -1
  126. package/dist/types/src/components/index.d.ts.map +1 -1
  127. package/dist/types/src/extensions/compute.d.ts +1 -1
  128. package/dist/types/src/extensions/compute.d.ts.map +1 -1
  129. package/dist/types/src/extensions/editor/extension.d.ts +1 -1
  130. package/dist/types/src/extensions/editor/extension.d.ts.map +1 -1
  131. package/dist/types/src/index.d.ts +2 -3
  132. package/dist/types/src/index.d.ts.map +1 -1
  133. package/dist/types/src/integrations/thread-ranges.d.ts +1 -1
  134. package/dist/types/src/integrations/thread-ranges.d.ts.map +1 -1
  135. package/dist/types/src/meta.d.ts +2 -2
  136. package/dist/types/src/meta.d.ts.map +1 -1
  137. package/dist/types/src/model/sheet-model.d.ts +6 -8
  138. package/dist/types/src/model/sheet-model.d.ts.map +1 -1
  139. package/dist/types/src/model/testing.d.ts +1 -1
  140. package/dist/types/src/model/testing.d.ts.map +1 -1
  141. package/dist/types/src/model/useSheetModel.d.ts +1 -1
  142. package/dist/types/src/model/useSheetModel.d.ts.map +1 -1
  143. package/dist/types/src/testing/testing.d.ts +1 -1
  144. package/dist/types/src/testing/testing.d.ts.map +1 -1
  145. package/dist/types/src/{defs → types}/index.d.ts +1 -0
  146. package/dist/types/src/types/index.d.ts.map +1 -0
  147. package/dist/types/src/types/schema.d.ts +105 -0
  148. package/dist/types/src/types/schema.d.ts.map +1 -0
  149. package/dist/types/src/{defs → types}/sheet-range-types.d.ts +1 -1
  150. package/dist/types/src/types/sheet-range-types.d.ts.map +1 -0
  151. package/dist/types/src/types/types.d.ts +71 -0
  152. package/dist/types/src/types/types.d.ts.map +1 -0
  153. package/dist/types/src/{defs → types}/util.d.ts +5 -1
  154. package/dist/types/src/types/util.d.ts.map +1 -0
  155. package/dist/types/tsconfig.tsbuildinfo +1 -0
  156. package/package.json +48 -62
  157. package/src/SheetPlugin.tsx +57 -176
  158. package/src/capabilities/capabilities.ts +14 -0
  159. package/src/capabilities/compute-graph-registry.ts +25 -0
  160. package/src/capabilities/index.ts +13 -0
  161. package/src/capabilities/intent-resolver.ts +38 -0
  162. package/src/capabilities/markdown.ts +22 -0
  163. package/src/capabilities/react-surface.tsx +37 -0
  164. package/src/capabilities/thread.ts +14 -0
  165. package/src/components/ComputeGraph/ComputeGraphContextProvider.tsx +1 -2
  166. package/src/{compute-graph → components/ComputeGraph}/compute-graph.stories.tsx +6 -7
  167. package/src/components/FunctionEditor/FunctionEditor.tsx +2 -1
  168. package/src/components/GridSheet/GridSheet.stories.tsx +2 -0
  169. package/src/components/GridSheet/GridSheet.tsx +15 -18
  170. package/src/components/GridSheet/SheetCellEditor.stories.tsx +6 -7
  171. package/src/components/GridSheet/util.ts +4 -3
  172. package/src/components/RangeList/RangeList.tsx +2 -1
  173. package/src/components/SheetContainer/SheetContainer.stories.tsx +28 -23
  174. package/src/components/SheetContainer/SheetContainer.tsx +3 -8
  175. package/src/components/SheetContext/SheetContext.tsx +1 -2
  176. package/src/components/{Toolbar/Toolbar.stories.tsx → SheetToolbar/SheetToolbar.stories.tsx} +4 -8
  177. package/src/components/SheetToolbar/SheetToolbar.tsx +48 -0
  178. package/src/components/SheetToolbar/align.ts +68 -0
  179. package/src/components/SheetToolbar/comment.ts +56 -0
  180. package/src/components/{Toolbar → SheetToolbar}/index.ts +1 -1
  181. package/src/components/SheetToolbar/style.ts +72 -0
  182. package/src/components/SheetToolbar/useToolbarAction.ts +87 -0
  183. package/src/components/SheetToolbar/useToolbarState.ts +17 -0
  184. package/src/components/index.ts +0 -1
  185. package/src/extensions/compute.ts +7 -4
  186. package/src/extensions/editor/extension.test.ts +2 -1
  187. package/src/extensions/editor/extension.ts +2 -3
  188. package/src/index.ts +2 -7
  189. package/src/integrations/thread-ranges.ts +39 -24
  190. package/src/meta.ts +4 -2
  191. package/src/model/sheet-model.test.ts +4 -10
  192. package/src/model/sheet-model.ts +30 -22
  193. package/src/model/testing.ts +3 -2
  194. package/src/model/useSheetModel.ts +2 -1
  195. package/src/sanity.test.ts +1 -1
  196. package/src/testing/testing.tsx +2 -3
  197. package/src/{defs → types}/index.ts +1 -0
  198. package/src/types/schema.ts +56 -0
  199. package/src/{defs → types}/sheet-range-types.ts +1 -1
  200. package/src/types/types.ts +67 -0
  201. package/src/{defs → types}/util.ts +13 -13
  202. package/dist/lib/browser/SheetContainer-KCLT6PEO.mjs +0 -296
  203. package/dist/lib/browser/SheetContainer-KCLT6PEO.mjs.map +0 -7
  204. package/dist/lib/browser/chunk-E5WQ7U7G.mjs +0 -1675
  205. package/dist/lib/browser/chunk-E5WQ7U7G.mjs.map +0 -7
  206. package/dist/lib/browser/chunk-F3HE6D3J.mjs +0 -3269
  207. package/dist/lib/browser/chunk-F3HE6D3J.mjs.map +0 -7
  208. package/dist/lib/browser/chunk-JXFPOYNA.mjs +0 -67
  209. package/dist/lib/browser/chunk-JXFPOYNA.mjs.map +0 -7
  210. package/dist/lib/browser/chunk-RABELMEQ.mjs +0 -15
  211. package/dist/lib/browser/chunk-RABELMEQ.mjs.map +0 -7
  212. package/dist/lib/browser/compute-graph-SNUS7HOH.mjs +0 -35
  213. package/dist/lib/browser/meta.mjs +0 -9
  214. package/dist/lib/browser/types.mjs +0 -16
  215. package/dist/lib/browser/types.mjs.map +0 -7
  216. package/dist/lib/node/SheetContainer-VVVRYTQG.cjs +0 -298
  217. package/dist/lib/node/SheetContainer-VVVRYTQG.cjs.map +0 -7
  218. package/dist/lib/node/chunk-2ZVZI2KJ.cjs.map +0 -7
  219. package/dist/lib/node/chunk-45YW2DX2.cjs +0 -1656
  220. package/dist/lib/node/chunk-45YW2DX2.cjs.map +0 -7
  221. package/dist/lib/node/chunk-KSEEI5VC.cjs +0 -3323
  222. package/dist/lib/node/chunk-KSEEI5VC.cjs.map +0 -7
  223. package/dist/lib/node/chunk-OWH2EUHZ.cjs +0 -90
  224. package/dist/lib/node/chunk-OWH2EUHZ.cjs.map +0 -7
  225. package/dist/lib/node/compute-graph-WILPHO4A.cjs +0 -57
  226. package/dist/lib/node/compute-graph-WILPHO4A.cjs.map +0 -7
  227. package/dist/lib/node/meta.cjs.map +0 -7
  228. package/dist/lib/node/types.cjs.map +0 -7
  229. package/dist/lib/node-esm/SheetContainer-LSBE6Q4X.mjs +0 -297
  230. package/dist/lib/node-esm/SheetContainer-LSBE6Q4X.mjs.map +0 -7
  231. package/dist/lib/node-esm/chunk-6JF2AHKO.mjs +0 -3270
  232. package/dist/lib/node-esm/chunk-6JF2AHKO.mjs.map +0 -7
  233. package/dist/lib/node-esm/chunk-BM2Q3FFC.mjs +0 -17
  234. package/dist/lib/node-esm/chunk-BM2Q3FFC.mjs.map +0 -7
  235. package/dist/lib/node-esm/chunk-BVS2IQRO.mjs +0 -68
  236. package/dist/lib/node-esm/chunk-BVS2IQRO.mjs.map +0 -7
  237. package/dist/lib/node-esm/chunk-NYDNXI7L.mjs +0 -1676
  238. package/dist/lib/node-esm/chunk-NYDNXI7L.mjs.map +0 -7
  239. package/dist/lib/node-esm/compute-graph-S6CVN7RS.mjs +0 -36
  240. package/dist/lib/node-esm/compute-graph-S6CVN7RS.mjs.map +0 -7
  241. package/dist/lib/node-esm/meta.mjs +0 -10
  242. package/dist/lib/node-esm/meta.mjs.map +0 -7
  243. package/dist/lib/node-esm/types.mjs +0 -17
  244. package/dist/lib/node-esm/types.mjs.map +0 -7
  245. package/dist/types/src/components/SheetObjectSettings.d.ts +0 -7
  246. package/dist/types/src/components/SheetObjectSettings.d.ts.map +0 -1
  247. package/dist/types/src/components/Toolbar/Toolbar.d.ts +0 -48
  248. package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +0 -1
  249. package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +0 -7
  250. package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +0 -1
  251. package/dist/types/src/components/Toolbar/index.d.ts +0 -2
  252. package/dist/types/src/components/Toolbar/index.d.ts.map +0 -1
  253. package/dist/types/src/compute-graph/compute-graph-registry.d.ts +0 -34
  254. package/dist/types/src/compute-graph/compute-graph-registry.d.ts.map +0 -1
  255. package/dist/types/src/compute-graph/compute-graph.d.ts +0 -64
  256. package/dist/types/src/compute-graph/compute-graph.d.ts.map +0 -1
  257. package/dist/types/src/compute-graph/compute-graph.stories.d.ts.map +0 -1
  258. package/dist/types/src/compute-graph/compute-graph.test.d.ts +0 -2
  259. package/dist/types/src/compute-graph/compute-graph.test.d.ts.map +0 -1
  260. package/dist/types/src/compute-graph/compute-node.d.ts +0 -26
  261. package/dist/types/src/compute-graph/compute-node.d.ts.map +0 -1
  262. package/dist/types/src/compute-graph/functions/async-function.d.ts +0 -66
  263. package/dist/types/src/compute-graph/functions/async-function.d.ts.map +0 -1
  264. package/dist/types/src/compute-graph/functions/edge-function.d.ts +0 -21
  265. package/dist/types/src/compute-graph/functions/edge-function.d.ts.map +0 -1
  266. package/dist/types/src/compute-graph/functions/function-defs.d.ts +0 -11
  267. package/dist/types/src/compute-graph/functions/function-defs.d.ts.map +0 -1
  268. package/dist/types/src/compute-graph/functions/index.d.ts +0 -4
  269. package/dist/types/src/compute-graph/functions/index.d.ts.map +0 -1
  270. package/dist/types/src/compute-graph/hyperformula.test.d.ts +0 -2
  271. package/dist/types/src/compute-graph/hyperformula.test.d.ts.map +0 -1
  272. package/dist/types/src/compute-graph/index.d.ts +0 -5
  273. package/dist/types/src/compute-graph/index.d.ts.map +0 -1
  274. package/dist/types/src/compute-graph/testing/index.d.ts +0 -3
  275. package/dist/types/src/compute-graph/testing/index.d.ts.map +0 -1
  276. package/dist/types/src/compute-graph/testing/test-builder.d.ts +0 -15
  277. package/dist/types/src/compute-graph/testing/test-builder.d.ts.map +0 -1
  278. package/dist/types/src/compute-graph/testing/test-plugin.d.ts +0 -36
  279. package/dist/types/src/compute-graph/testing/test-plugin.d.ts.map +0 -1
  280. package/dist/types/src/compute-graph/util.d.ts +0 -2
  281. package/dist/types/src/compute-graph/util.d.ts.map +0 -1
  282. package/dist/types/src/defs/index.d.ts.map +0 -1
  283. package/dist/types/src/defs/sheet-range-types.d.ts.map +0 -1
  284. package/dist/types/src/defs/types.d.ts +0 -26
  285. package/dist/types/src/defs/types.d.ts.map +0 -1
  286. package/dist/types/src/defs/types.test.d.ts +0 -2
  287. package/dist/types/src/defs/types.test.d.ts.map +0 -1
  288. package/dist/types/src/defs/util.d.ts.map +0 -1
  289. package/dist/types/src/types.d.ts +0 -182
  290. package/dist/types/src/types.d.ts.map +0 -1
  291. package/dist/vendor/hyperformula.mjs +0 -37145
  292. package/src/components/SheetObjectSettings.tsx +0 -38
  293. package/src/components/Toolbar/Toolbar.tsx +0 -346
  294. package/src/compute-graph/compute-graph-registry.ts +0 -90
  295. package/src/compute-graph/compute-graph.test.ts +0 -87
  296. package/src/compute-graph/compute-graph.ts +0 -260
  297. package/src/compute-graph/compute-node.ts +0 -62
  298. package/src/compute-graph/functions/async-function.ts +0 -179
  299. package/src/compute-graph/functions/edge-function.ts +0 -102
  300. package/src/compute-graph/functions/function-defs.ts +0 -2427
  301. package/src/compute-graph/functions/index.ts +0 -7
  302. package/src/compute-graph/hyperformula.test.ts +0 -14
  303. package/src/compute-graph/index.ts +0 -8
  304. package/src/compute-graph/testing/index.ts +0 -6
  305. package/src/compute-graph/testing/test-builder.ts +0 -54
  306. package/src/compute-graph/testing/test-plugin.ts +0 -100
  307. package/src/compute-graph/util.ts +0 -8
  308. package/src/defs/types.test.ts +0 -91
  309. package/src/defs/types.ts +0 -88
  310. package/src/types.ts +0 -125
  311. /package/dist/lib/browser/{compute-graph-SNUS7HOH.mjs.map → types/index.mjs.map} +0 -0
  312. /package/dist/lib/{browser/meta.mjs.map → node-esm/types/index.mjs.map} +0 -0
  313. /package/dist/types/src/{compute-graph → components/ComputeGraph}/compute-graph.stories.d.ts +0 -0
@@ -1,38 +0,0 @@
1
- //
2
- // Copyright 2024 DXOS.org
3
- //
4
-
5
- import React from 'react';
6
-
7
- import { SPACE_PLUGIN } from '@dxos/plugin-space/meta';
8
- import { Input, useTranslation } from '@dxos/react-ui';
9
-
10
- import { RangeList } from './RangeList';
11
- import { type SheetType } from '../types';
12
-
13
- export type SheetObjectSettingsProps = {
14
- sheet: SheetType;
15
- };
16
-
17
- export const SheetObjectSettings = ({ sheet }: SheetObjectSettingsProps) => {
18
- const { t } = useTranslation(SPACE_PLUGIN);
19
-
20
- // TODO(burdon): Standardize forms.
21
- return (
22
- <>
23
- <div role='form' className='flex flex-col w-full p-2 gap-1'>
24
- <Input.Root>
25
- <Input.Label>{t('name label')}</Input.Label>
26
- <Input.TextInput
27
- placeholder={t('name placeholder')}
28
- value={sheet.name ?? ''}
29
- onChange={(event) => {
30
- sheet.name = event.target.value;
31
- }}
32
- />
33
- </Input.Root>
34
- </div>
35
- <RangeList sheet={sheet} />
36
- </>
37
- );
38
- };
@@ -1,346 +0,0 @@
1
- //
2
- // Copyright 2024 DXOS.org
3
- //
4
-
5
- import { createContext } from '@radix-ui/react-context';
6
- import React, { type PropsWithChildren, useCallback } from 'react';
7
-
8
- import { useIntentDispatcher } from '@dxos/app-framework';
9
- import {
10
- Icon,
11
- type ThemedClassName,
12
- Toolbar as NaturalToolbar,
13
- type ToolbarButtonProps as NaturalToolbarButtonProps,
14
- type ToolbarToggleGroupItemProps as NaturalToolbarToggleGroupItemProps,
15
- type ToolbarToggleProps as NaturalToolbarToggleProps,
16
- Tooltip,
17
- useTranslation,
18
- } from '@dxos/react-ui';
19
- import { useAttention } from '@dxos/react-ui-attention';
20
- import { nonNullable } from '@dxos/util';
21
-
22
- import {
23
- alignKey,
24
- type AlignKey,
25
- type AlignValue,
26
- type CommentKey,
27
- type CommentValue,
28
- inRange,
29
- rangeFromIndex,
30
- rangeToIndex,
31
- styleKey,
32
- type StyleKey,
33
- type StyleValue,
34
- } from '../../defs';
35
- import { completeCellRangeToThreadCursor } from '../../integrations';
36
- import { SHEET_PLUGIN } from '../../meta';
37
- import { type SheetType } from '../../types';
38
- import { useSheetContext } from '../SheetContext';
39
-
40
- //
41
- // Buttons
42
- //
43
-
44
- const buttonStyles = 'min-bs-0 p-2';
45
- const tooltipProps = { side: 'bottom' as const, classNames: 'z-10' };
46
-
47
- const ToolbarSeparator = () => <div role='separator' className='grow' />;
48
-
49
- //
50
- // ToolbarItem
51
- //
52
-
53
- type ToolbarItemProps =
54
- | (NaturalToolbarButtonProps & { itemType: 'button'; icon: string })
55
- | (NaturalToolbarToggleGroupItemProps & { itemType: 'toggleGroupItem'; icon: string })
56
- | (NaturalToolbarToggleProps & { itemType: 'toggle'; icon: string });
57
-
58
- export const ToolbarItem = ({ itemType, icon, children, ...props }: ToolbarItemProps) => {
59
- const Invoker =
60
- itemType === 'toggleGroupItem'
61
- ? NaturalToolbar.ToggleGroupItem
62
- : itemType === 'toggle'
63
- ? NaturalToolbar.Toggle
64
- : NaturalToolbar.Button;
65
- return (
66
- <Tooltip.Root>
67
- <Tooltip.Trigger asChild>
68
- {/* TODO(thure): type the props spread better. */}
69
- <Invoker variant='ghost' {...(props as any)} classNames={buttonStyles}>
70
- <Icon icon={icon} size={5} />
71
- <span className='sr-only'>{children}</span>
72
- </Invoker>
73
- </Tooltip.Trigger>
74
- <Tooltip.Portal>
75
- <Tooltip.Content {...tooltipProps}>
76
- {children}
77
- <Tooltip.Arrow />
78
- </Tooltip.Content>
79
- </Tooltip.Portal>
80
- </Tooltip.Root>
81
- );
82
- };
83
-
84
- //
85
- // Root
86
- //
87
-
88
- type AlignAction = { key: AlignKey; value: AlignValue };
89
- type CommentAction = { key: CommentKey; value: CommentValue; cellContent?: string };
90
- type StyleAction = { key: StyleKey; value: StyleValue };
91
-
92
- export type ToolbarAction = StyleAction | AlignAction | CommentAction;
93
- export type ToolbarActionAnnotated = ToolbarAction & { unset?: boolean };
94
-
95
- export type ToolbarActionType = ToolbarAction['key'];
96
-
97
- export type ToolbarActionHandler = (action: ToolbarActionAnnotated) => void;
98
-
99
- export type ToolbarProps = ThemedClassName<
100
- PropsWithChildren<{
101
- role?: string;
102
- }>
103
- >;
104
-
105
- const [ToolbarContextProvider, useToolbarContext] = createContext<{
106
- onAction: (action: ToolbarActionAnnotated) => void;
107
- }>('Toolbar');
108
-
109
- type Range = SheetType['ranges'][number];
110
-
111
- const ToolbarRoot = ({ children, role, classNames }: ToolbarProps) => {
112
- const { id, model, cursorFallbackRange, cursor } = useSheetContext();
113
- const { hasAttention } = useAttention(id);
114
- const dispatch = useIntentDispatcher();
115
-
116
- // TODO(Zan): Externalize the toolbar action handler. E.g., Toolbar/keys should both fire events.
117
- const handleAction = useCallback(
118
- (action: ToolbarActionAnnotated) => {
119
- switch (action.key) {
120
- case 'alignment':
121
- if (cursorFallbackRange) {
122
- const index =
123
- model.sheet.ranges?.findIndex(
124
- (range) =>
125
- range.key === action.key &&
126
- inRange(rangeFromIndex(model.sheet, range.range), cursorFallbackRange.from),
127
- ) ?? -1;
128
- const nextRangeEntity = {
129
- range: rangeToIndex(model.sheet, cursorFallbackRange),
130
- key: action.key,
131
- value: action.value,
132
- };
133
- if (index < 0) {
134
- model.sheet.ranges?.push(nextRangeEntity);
135
- } else if (model.sheet.ranges![index].value === action.value) {
136
- model.sheet.ranges?.splice(index, 1);
137
- } else {
138
- model.sheet.ranges?.splice(index, 1, nextRangeEntity);
139
- }
140
- }
141
- break;
142
- case 'style':
143
- if (action.unset) {
144
- const index = model.sheet.ranges?.findIndex(
145
- (range) =>
146
- range.key === action.key &&
147
- cursorFallbackRange &&
148
- inRange(rangeFromIndex(model.sheet, range.range), cursorFallbackRange.from),
149
- );
150
- if (index >= 0) {
151
- model.sheet.ranges?.splice(index, 1);
152
- }
153
- } else if (cursorFallbackRange) {
154
- model.sheet.ranges?.push({
155
- range: rangeToIndex(model.sheet, cursorFallbackRange),
156
- key: action.key,
157
- value: action.value,
158
- });
159
- }
160
- break;
161
- case 'comment': {
162
- // TODO(Zan): We shouldn't hardcode the action ID.
163
- if (cursorFallbackRange) {
164
- void dispatch({
165
- action: 'dxos.org/plugin/thread/action/create',
166
- data: {
167
- cursor: completeCellRangeToThreadCursor(cursorFallbackRange),
168
- name: action.cellContent,
169
- subject: model.sheet,
170
- },
171
- });
172
- }
173
- }
174
- }
175
- },
176
- [model.sheet, cursorFallbackRange, cursor, dispatch],
177
- );
178
-
179
- return (
180
- <ToolbarContextProvider onAction={handleAction}>
181
- <NaturalToolbar.Root classNames={['pli-0.5 attention-surface', !hasAttention && 'opacity-20', classNames]}>
182
- {children}
183
- </NaturalToolbar.Root>
184
- </ToolbarContextProvider>
185
- );
186
- };
187
-
188
- // TODO(burdon): Generalize.
189
- // TODO(burdon): Detect and display current state.
190
- type ButtonProps<T> = {
191
- value: T;
192
- icon: string;
193
- disabled?: (state: Range) => boolean;
194
- };
195
-
196
- //
197
- // Alignment
198
- //
199
-
200
- const alignmentOptions: ButtonProps<AlignValue>[] = [
201
- { value: 'start', icon: 'ph--text-align-left--regular' },
202
- { value: 'center', icon: 'ph--text-align-center--regular' },
203
- { value: 'end', icon: 'ph--text-align-right--regular' },
204
- ];
205
-
206
- const Alignment = () => {
207
- const { cursor, model } = useSheetContext();
208
- const { onAction } = useToolbarContext('Alignment');
209
- const { t } = useTranslation(SHEET_PLUGIN);
210
-
211
- // TODO(thure): Can this O(n) call be memoized?
212
- const value = cursor
213
- ? model.sheet.ranges?.findLast(
214
- ({ range, key }) => key === alignKey && inRange(rangeFromIndex(model.sheet, range), cursor),
215
- )?.value
216
- : undefined;
217
-
218
- return (
219
- <NaturalToolbar.ToggleGroup
220
- type='single'
221
- value={
222
- // TODO(thure): providing `undefined` leaves the last item active which was active rather than showing none.
223
- value ?? 'never'
224
- }
225
- onValueChange={(value: AlignValue) => onAction?.({ key: alignKey, value })}
226
- >
227
- {alignmentOptions.map(({ value, icon }) => (
228
- <ToolbarItem
229
- itemType='toggleGroupItem'
230
- key={value}
231
- value={value}
232
- icon={icon}
233
- data-testid={`grid.toolbar.${alignKey}.${value}`}
234
- >
235
- {t('toolbar action label', {
236
- key: t(`range key ${alignKey} label`),
237
- value: t(`range value ${value} label`),
238
- })}
239
- </ToolbarItem>
240
- ))}
241
- </NaturalToolbar.ToggleGroup>
242
- );
243
- };
244
-
245
- const styleOptions: ButtonProps<StyleValue>[] = [
246
- { value: 'highlight', icon: 'ph--highlighter--regular' },
247
- { value: 'softwrap', icon: 'ph--paragraph--regular' },
248
- ];
249
-
250
- const Styles = () => {
251
- const { cursorFallbackRange, model } = useSheetContext();
252
- const { onAction } = useToolbarContext('Styles');
253
- const { t } = useTranslation(SHEET_PLUGIN);
254
-
255
- // TODO(thure): Can this O(n) call be memoized?
256
- const activeValues = cursorFallbackRange
257
- ? model.sheet.ranges
258
- ?.filter(
259
- ({ range, key }) => key === 'style' && inRange(rangeFromIndex(model.sheet, range), cursorFallbackRange.from),
260
- )
261
- .reduce((acc, { value }) => {
262
- acc.add(value);
263
- return acc;
264
- }, new Set())
265
- : undefined;
266
-
267
- return (
268
- <>
269
- {styleOptions.map(({ value, icon }) => (
270
- <ToolbarItem
271
- itemType='toggle'
272
- key={value}
273
- pressed={activeValues?.has(value)}
274
- onPressedChange={(nextPressed: boolean) => {
275
- onAction?.({ key: 'style', value, unset: !nextPressed });
276
- }}
277
- icon={icon}
278
- >
279
- {t('toolbar action label', {
280
- key: t(`range key ${styleKey} label`),
281
- value: t(`range value ${value} label`),
282
- })}
283
- </ToolbarItem>
284
- ))}
285
- </>
286
- );
287
- };
288
-
289
- //
290
- // Actions
291
- //
292
-
293
- const Actions = () => {
294
- const { onAction } = useToolbarContext('Actions');
295
- const { cursorFallbackRange, cursor, model } = useSheetContext();
296
- const { t } = useTranslation(SHEET_PLUGIN);
297
-
298
- // TODO(thure): Can this O(n) call be memoized?
299
- const overlapsCommentAnchor = (model.sheet.threads ?? [])
300
- .filter(nonNullable)
301
- .filter((thread) => thread.status !== 'resolved')
302
- .some((thread) => {
303
- if (!cursorFallbackRange) {
304
- return false;
305
- }
306
- return rangeToIndex(model.sheet, cursorFallbackRange) === thread.anchor;
307
- });
308
-
309
- const tooltipLabelKey = !cursor
310
- ? 'no cursor label'
311
- : overlapsCommentAnchor
312
- ? 'selection overlaps existing comment label'
313
- : 'comment label';
314
-
315
- return (
316
- <ToolbarItem
317
- itemType='button'
318
- value='comment'
319
- icon='ph--chat-text--regular'
320
- data-testid='editor.toolbar.comment'
321
- onClick={() => {
322
- if (!cursorFallbackRange) {
323
- return;
324
- }
325
- return onAction?.({
326
- key: 'comment',
327
- value: rangeToIndex(model.sheet, cursorFallbackRange),
328
- cellContent: model.getCellText(cursorFallbackRange.from),
329
- });
330
- }}
331
- disabled={!cursorFallbackRange || overlapsCommentAnchor}
332
- >
333
- {t(tooltipLabelKey)}
334
- </ToolbarItem>
335
- );
336
- };
337
-
338
- export const Toolbar = {
339
- Root: ToolbarRoot,
340
- Separator: ToolbarSeparator,
341
- Alignment,
342
- Styles,
343
- Actions,
344
- };
345
-
346
- export { useToolbarContext };
@@ -1,90 +0,0 @@
1
- //
2
- // Copyright 2024 DXOS.org
3
- //
4
-
5
- import type { FunctionPluginDefinition } from 'hyperformula';
6
- import type { ConfigParams } from 'hyperformula/typings/ConfigParams';
7
- import type { FunctionTranslationsPackage } from 'hyperformula/typings/interpreter';
8
- import defaultsDeep from 'lodash.defaultsdeep';
9
-
10
- import { type SpaceId, type Space } from '@dxos/client/echo';
11
- import { Resource } from '@dxos/context';
12
- import { invariant } from '@dxos/invariant';
13
- import { log } from '@dxos/log';
14
-
15
- import { HyperFormula } from '#hyperformula';
16
- import { ComputeGraph } from './compute-graph';
17
- import { EdgeFunctionPlugin, EdgeFunctionPluginTranslations, type FunctionContextOptions } from './functions';
18
-
19
- export type ComputeGraphPlugin = {
20
- plugin: FunctionPluginDefinition;
21
- translations: FunctionTranslationsPackage;
22
- };
23
-
24
- export type ComputeGraphOptions = {
25
- plugins?: ComputeGraphPlugin[];
26
- } & Partial<FunctionContextOptions> &
27
- Partial<ConfigParams>;
28
-
29
- export const defaultOptions: ComputeGraphOptions = {
30
- licenseKey: 'gpl-v3',
31
- };
32
-
33
- export const defaultPlugins: ComputeGraphPlugin[] = [
34
- {
35
- plugin: EdgeFunctionPlugin,
36
- translations: EdgeFunctionPluginTranslations,
37
- },
38
- ];
39
-
40
- /**
41
- * Manages a collection of ComputeGraph instances for each space.
42
- *
43
- * [ComputePlugin] => [ComputeGraphRegistry] => [ComputeGraph(Space)] => [ComputeNode(Object)]
44
- *
45
- * NOTE: The ComputeGraphRegistry manages the hierarchy of resources via its root Context.
46
- * NOTE: The package.json file defines the packaged #hyperformula module.
47
- */
48
- // TODO(burdon): Move graph into separate plugin; isolate HF deps.
49
- export class ComputeGraphRegistry extends Resource {
50
- private readonly _graphs = new Map<SpaceId, ComputeGraph>();
51
-
52
- private readonly _options: ComputeGraphOptions;
53
-
54
- constructor(options: ComputeGraphOptions = { plugins: defaultPlugins }) {
55
- super();
56
- this._options = defaultsDeep({}, options, defaultOptions);
57
- this._options.plugins?.forEach(({ plugin, translations }) => {
58
- HyperFormula.registerFunctionPlugin(plugin, translations);
59
- });
60
- }
61
-
62
- getGraph(spaceId: SpaceId): ComputeGraph | undefined {
63
- return this._graphs.get(spaceId);
64
- }
65
-
66
- getOrCreateGraph(space: Space): ComputeGraph {
67
- let graph = this._graphs.get(space.id);
68
- if (!graph) {
69
- log('create graph', { space: space.id });
70
- graph = this.createGraph(space);
71
- }
72
-
73
- return graph;
74
- }
75
-
76
- createGraph(space: Space): ComputeGraph {
77
- invariant(!this._graphs.has(space.id), `ComputeGraph already exists for space: ${space.id}`);
78
- const hf = HyperFormula.buildEmpty(this._options);
79
- const graph = new ComputeGraph(hf, space, this._options);
80
- this._graphs.set(space.id, graph);
81
- return graph;
82
- }
83
-
84
- protected override async _close() {
85
- for (const graph of this._graphs.values()) {
86
- await graph.close();
87
- }
88
- this._graphs.clear();
89
- }
90
- }
@@ -1,87 +0,0 @@
1
- //
2
- // Copyright 2024 DXOS.org
3
- //
4
-
5
- import { type CellValue } from 'hyperformula';
6
- import { afterEach, beforeEach, describe, expect, test } from 'vitest';
7
-
8
- import { Trigger } from '@dxos/async';
9
- import { create, fullyQualifiedId } from '@dxos/client/echo';
10
- import { FunctionType } from '@dxos/plugin-script/types';
11
-
12
- import { DetailedCellError } from '#hyperformula';
13
- import { TestBuilder } from './testing';
14
-
15
- describe('ComputeGraph', () => {
16
- let testBuilder: TestBuilder;
17
- beforeEach(async () => {
18
- testBuilder = new TestBuilder({ types: [FunctionType] });
19
- await testBuilder.open();
20
- });
21
- afterEach(async () => {
22
- await testBuilder.close();
23
- });
24
-
25
- test('map functions', async () => {
26
- const space = await testBuilder.client.spaces.create();
27
- const graph = testBuilder.registry.createGraph(space);
28
- await graph.open();
29
-
30
- // Create script.
31
- const trigger = new Trigger();
32
- graph.update.once(() => trigger.wake());
33
- const functionObject = space.db.add(create(FunctionType, { name: 'test', version: '0.0.1', binding: 'TEST' }));
34
- await trigger.wait();
35
- const functions = graph.getFunctions({ echo: true });
36
- expect(functions).to.toHaveLength(1);
37
-
38
- const id = graph.mapFunctionBindingToId('TEST()');
39
- expect(id).to.eq(`${fullyQualifiedId(functionObject)}()`);
40
- });
41
-
42
- test('cross-node references', async () => {
43
- const space = await testBuilder.client.spaces.create();
44
- const graph = testBuilder.registry.createGraph(space);
45
-
46
- // Create nodes.
47
- const node1 = await graph.getOrCreateNode('node-1').open();
48
- const node2 = await graph.getOrCreateNode('node-2').open();
49
- expect(graph.hf.getSheetNames()).to.toHaveLength(2);
50
-
51
- {
52
- node1.graph.hf.setCellContents({ sheet: node1.sheetId, row: 0, col: 0 }, [[100, 200, 300, '=SUM(A1:C1)']]);
53
- node2.graph.hf.setCellContents({ sheet: node2.sheetId, row: 0, col: 0 }, "='node-1'!D1");
54
- const value1 = node1.graph.hf.getCellValue({ sheet: node1.sheetId, col: 3, row: 0 });
55
- const value2 = node2.graph.hf.getCellValue({ sheet: node2.sheetId, col: 0, row: 0 });
56
- expect(value1).to.eq(value2);
57
- }
58
-
59
- // Get updated event.
60
- const trigger = new Trigger<CellValue>();
61
- node2.update.on(({ change }) => {
62
- const value = node2.graph.hf.getCellValue({ sheet: node2.sheetId, col: 0, row: 0 });
63
- expect(value).to.eq(change?.newValue);
64
- trigger.wake(value);
65
- });
66
-
67
- {
68
- node1.graph.hf.setCellContents({ sheet: node1.sheetId, row: 0, col: 0 }, 400);
69
- const value1 = node1.graph.hf.getCellValue({ sheet: node1.sheetId, col: 3, row: 0 });
70
- const value2 = await trigger.wait();
71
- expect(value1).to.eq(value2);
72
- }
73
- });
74
-
75
- // TODO(burdon): Dynamically load node/model based on dependencies.
76
- // - Create dependency then close model.
77
- test('dynamic loading', async () => {
78
- const space = await testBuilder.client.spaces.create();
79
- const graph = testBuilder.registry.createGraph(space);
80
-
81
- const node1 = await graph.getOrCreateNode('node-1').open();
82
- node1.graph.hf.setCellContents({ sheet: node1.sheetId, row: 0, col: 0 }, "='node-2'!A1");
83
- const value1 = node1.graph.hf.getCellValue({ sheet: node1.sheetId, col: 0, row: 0 });
84
- expect(value1).to.be.instanceof(DetailedCellError);
85
- expect((value1 as DetailedCellError).type).to.eq('REF');
86
- });
87
- });