@dxos/plugin-sheet 0.6.12 → 0.6.13-main.548ca8d

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 (325) hide show
  1. package/dist/lib/browser/SheetContainer-NDNIS44E.mjs +265 -0
  2. package/dist/lib/browser/SheetContainer-NDNIS44E.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-AQSGDA4X.mjs +1614 -0
  4. package/dist/lib/browser/chunk-AQSGDA4X.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-D3QTX46O.mjs +14 -0
  6. package/dist/lib/browser/chunk-D3QTX46O.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-GKI67SEF.mjs +69 -0
  8. package/dist/lib/browser/chunk-GKI67SEF.mjs.map +7 -0
  9. package/dist/lib/browser/chunk-GSV5QNLD.mjs +2966 -0
  10. package/dist/lib/browser/chunk-GSV5QNLD.mjs.map +7 -0
  11. package/dist/lib/browser/graph-M4IQ76QX.mjs +33 -0
  12. package/dist/lib/browser/graph-M4IQ76QX.mjs.map +7 -0
  13. package/dist/lib/browser/index.mjs +93 -62
  14. package/dist/lib/browser/index.mjs.map +3 -3
  15. package/dist/lib/browser/meta.json +1 -1
  16. package/dist/lib/browser/meta.mjs +1 -1
  17. package/dist/lib/browser/types.mjs +4 -10
  18. package/dist/lib/node/SheetContainer-YSQGJD7K.cjs +276 -0
  19. package/dist/lib/node/SheetContainer-YSQGJD7K.cjs.map +7 -0
  20. package/dist/lib/node/{chunk-5KKJ4NPP.cjs → chunk-5XPK2V4A.cjs} +418 -678
  21. package/dist/lib/node/chunk-5XPK2V4A.cjs.map +7 -0
  22. package/dist/lib/node/chunk-6F43RV45.cjs +1610 -0
  23. package/dist/lib/node/chunk-6F43RV45.cjs.map +7 -0
  24. package/dist/lib/node/{chunk-DSYKOI4E.cjs → chunk-ER3PM7GD.cjs} +29 -45
  25. package/dist/lib/node/chunk-ER3PM7GD.cjs.map +7 -0
  26. package/dist/lib/node/chunk-QIFIGEKV.cjs +37 -0
  27. package/dist/lib/node/chunk-QIFIGEKV.cjs.map +7 -0
  28. package/dist/lib/node/graph-Q3N2X26H.cjs +55 -0
  29. package/dist/lib/node/graph-Q3N2X26H.cjs.map +7 -0
  30. package/dist/lib/node/index.cjs +105 -69
  31. package/dist/lib/node/index.cjs.map +3 -3
  32. package/dist/lib/node/meta.cjs +3 -3
  33. package/dist/lib/node/meta.cjs.map +1 -1
  34. package/dist/lib/node/meta.json +1 -1
  35. package/dist/lib/node/types.cjs +8 -14
  36. package/dist/lib/node/types.cjs.map +2 -2
  37. package/dist/lib/node-esm/SheetContainer-M7WRMZDU.mjs +266 -0
  38. package/dist/lib/node-esm/SheetContainer-M7WRMZDU.mjs.map +7 -0
  39. package/dist/lib/{browser/chunk-D5AGLXJP.mjs → node-esm/chunk-5WPZCXNS.mjs} +411 -678
  40. package/dist/lib/node-esm/chunk-5WPZCXNS.mjs.map +7 -0
  41. package/dist/lib/node-esm/chunk-ELTFPX5B.mjs +1615 -0
  42. package/dist/lib/node-esm/chunk-ELTFPX5B.mjs.map +7 -0
  43. package/dist/lib/node-esm/chunk-VCYJWE3O.mjs +16 -0
  44. package/dist/lib/node-esm/chunk-VCYJWE3O.mjs.map +7 -0
  45. package/dist/lib/node-esm/chunk-ZVLLQ2PJ.mjs +70 -0
  46. package/dist/lib/node-esm/chunk-ZVLLQ2PJ.mjs.map +7 -0
  47. package/dist/lib/node-esm/graph-SMPUMOV2.mjs +34 -0
  48. package/dist/lib/node-esm/graph-SMPUMOV2.mjs.map +7 -0
  49. package/dist/lib/node-esm/index.mjs +280 -0
  50. package/dist/lib/node-esm/index.mjs.map +7 -0
  51. package/dist/lib/node-esm/meta.json +1 -0
  52. package/dist/lib/node-esm/meta.mjs +10 -0
  53. package/dist/lib/node-esm/meta.mjs.map +7 -0
  54. package/dist/lib/node-esm/types.mjs +17 -0
  55. package/dist/lib/node-esm/types.mjs.map +7 -0
  56. package/dist/types/src/SheetPlugin.d.ts.map +1 -1
  57. package/dist/types/src/components/ComputeGraph/ComputeGraphContextProvider.d.ts +11 -0
  58. package/dist/types/src/components/ComputeGraph/ComputeGraphContextProvider.d.ts.map +1 -0
  59. package/dist/types/src/components/ComputeGraph/index.d.ts +1 -3
  60. package/dist/types/src/components/ComputeGraph/index.d.ts.map +1 -1
  61. package/dist/types/src/components/FunctionEditor/FunctionEditor.d.ts +3 -0
  62. package/dist/types/src/components/FunctionEditor/FunctionEditor.d.ts.map +1 -0
  63. package/dist/types/src/components/FunctionEditor/index.d.ts +2 -0
  64. package/dist/types/src/components/FunctionEditor/index.d.ts.map +1 -0
  65. package/dist/types/src/components/GridSheet/GridSheet.d.ts +3 -0
  66. package/dist/types/src/components/GridSheet/GridSheet.d.ts.map +1 -0
  67. package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts +9 -0
  68. package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +1 -0
  69. package/dist/types/src/components/{CellEditor/CellEditor.stories.d.ts → GridSheet/SheetCellEditor.stories.d.ts} +4 -4
  70. package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts.map +1 -0
  71. package/dist/types/src/components/GridSheet/index.d.ts +2 -0
  72. package/dist/types/src/components/GridSheet/index.d.ts.map +1 -0
  73. package/dist/types/src/components/GridSheet/util.d.ts +16 -0
  74. package/dist/types/src/components/GridSheet/util.d.ts.map +1 -0
  75. package/dist/types/src/components/SheetContainer/SheetContainer.d.ts +6 -0
  76. package/dist/types/src/components/SheetContainer/SheetContainer.d.ts.map +1 -0
  77. package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts +11 -0
  78. package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +1 -0
  79. package/dist/types/src/components/SheetContainer/index.d.ts +3 -0
  80. package/dist/types/src/components/SheetContainer/index.d.ts.map +1 -0
  81. package/dist/types/src/components/SheetContext/SheetContext.d.ts +27 -0
  82. package/dist/types/src/components/SheetContext/SheetContext.d.ts.map +1 -0
  83. package/dist/types/src/components/SheetContext/index.d.ts +2 -0
  84. package/dist/types/src/components/SheetContext/index.d.ts.map +1 -0
  85. package/dist/types/src/components/Toolbar/Toolbar.d.ts +36 -6
  86. package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
  87. package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +19 -14
  88. package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -1
  89. package/dist/types/src/components/index.d.ts +3 -2
  90. package/dist/types/src/components/index.d.ts.map +1 -1
  91. package/dist/types/src/defs/index.d.ts +3 -0
  92. package/dist/types/src/defs/index.d.ts.map +1 -0
  93. package/dist/types/src/{model → defs}/types.d.ts +8 -3
  94. package/dist/types/src/defs/types.d.ts.map +1 -0
  95. package/dist/types/src/defs/types.test.d.ts.map +1 -0
  96. package/dist/types/src/defs/util.d.ts +43 -0
  97. package/dist/types/src/defs/util.d.ts.map +1 -0
  98. package/dist/types/src/extensions/compute.d.ts +6 -0
  99. package/dist/types/src/extensions/compute.d.ts.map +1 -0
  100. package/dist/types/src/extensions/compute.stories.d.ts +26 -0
  101. package/dist/types/src/extensions/compute.stories.d.ts.map +1 -0
  102. package/dist/types/src/{components/CellEditor → extensions/editor}/extension.d.ts +1 -1
  103. package/dist/types/src/extensions/editor/extension.d.ts.map +1 -0
  104. package/dist/types/src/extensions/editor/extension.test.d.ts.map +1 -0
  105. package/dist/types/src/extensions/editor/index.d.ts +2 -0
  106. package/dist/types/src/extensions/editor/index.d.ts.map +1 -0
  107. package/dist/types/src/extensions/index.d.ts +3 -0
  108. package/dist/types/src/extensions/index.d.ts.map +1 -0
  109. package/dist/types/src/graph/compute-graph-registry.d.ts +34 -0
  110. package/dist/types/src/graph/compute-graph-registry.d.ts.map +1 -0
  111. package/dist/types/src/graph/compute-graph.d.ts +64 -0
  112. package/dist/types/src/graph/compute-graph.d.ts.map +1 -0
  113. package/dist/types/src/graph/compute-graph.stories.d.ts +10 -0
  114. package/dist/types/src/graph/compute-graph.stories.d.ts.map +1 -0
  115. package/dist/types/src/graph/compute-graph.test.d.ts +2 -0
  116. package/dist/types/src/graph/compute-graph.test.d.ts.map +1 -0
  117. package/dist/types/src/graph/compute-node.d.ts +26 -0
  118. package/dist/types/src/graph/compute-node.d.ts.map +1 -0
  119. package/dist/types/src/{components/ComputeGraph → graph/functions}/async-function.d.ts +14 -5
  120. package/dist/types/src/graph/functions/async-function.d.ts.map +1 -0
  121. package/dist/types/src/graph/functions/edge-function.d.ts +21 -0
  122. package/dist/types/src/graph/functions/edge-function.d.ts.map +1 -0
  123. package/dist/types/src/{model/functions.d.ts → graph/functions/function-defs.d.ts} +1 -1
  124. package/dist/types/src/graph/functions/function-defs.d.ts.map +1 -0
  125. package/dist/types/src/graph/functions/index.d.ts +4 -0
  126. package/dist/types/src/graph/functions/index.d.ts.map +1 -0
  127. package/dist/types/src/graph/hyperformula.test.d.ts +2 -0
  128. package/dist/types/src/graph/hyperformula.test.d.ts.map +1 -0
  129. package/dist/types/src/graph/index.d.ts +5 -0
  130. package/dist/types/src/graph/index.d.ts.map +1 -0
  131. package/dist/types/src/graph/testing/index.d.ts +3 -0
  132. package/dist/types/src/graph/testing/index.d.ts.map +1 -0
  133. package/dist/types/src/graph/testing/test-builder.d.ts +15 -0
  134. package/dist/types/src/graph/testing/test-builder.d.ts.map +1 -0
  135. package/dist/types/src/graph/testing/test-plugin.d.ts +36 -0
  136. package/dist/types/src/graph/testing/test-plugin.d.ts.map +1 -0
  137. package/dist/types/src/graph/util.d.ts +2 -0
  138. package/dist/types/src/graph/util.d.ts.map +1 -0
  139. package/dist/types/src/hooks/hooks.stories.d.ts +11 -0
  140. package/dist/types/src/hooks/hooks.stories.d.ts.map +1 -0
  141. package/dist/types/src/hooks/index.d.ts +5 -0
  142. package/dist/types/src/hooks/index.d.ts.map +1 -0
  143. package/dist/types/src/hooks/threads.d.ts +8 -0
  144. package/dist/types/src/hooks/threads.d.ts.map +1 -0
  145. package/dist/types/src/hooks/useComputeGraph.d.ts +7 -0
  146. package/dist/types/src/hooks/useComputeGraph.d.ts.map +1 -0
  147. package/dist/types/src/hooks/useFormattingModel.d.ts +3 -0
  148. package/dist/types/src/hooks/useFormattingModel.d.ts.map +1 -0
  149. package/dist/types/src/hooks/useSheetModel.d.ts +8 -0
  150. package/dist/types/src/hooks/useSheetModel.d.ts.map +1 -0
  151. package/dist/types/src/meta.d.ts +3 -9
  152. package/dist/types/src/meta.d.ts.map +1 -1
  153. package/dist/types/src/model/decorations.d.ts +25 -0
  154. package/dist/types/src/model/decorations.d.ts.map +1 -0
  155. package/dist/types/src/model/formatting-model.d.ts +19 -0
  156. package/dist/types/src/model/formatting-model.d.ts.map +1 -0
  157. package/dist/types/src/model/index.d.ts +3 -3
  158. package/dist/types/src/model/index.d.ts.map +1 -1
  159. package/dist/types/src/model/{model.d.ts → sheet-model.d.ts} +13 -67
  160. package/dist/types/src/model/sheet-model.d.ts.map +1 -0
  161. package/dist/types/src/model/sheet-model.test.d.ts +2 -0
  162. package/dist/types/src/model/sheet-model.test.d.ts.map +1 -0
  163. package/dist/types/src/sanity.test.d.ts +2 -0
  164. package/dist/types/src/sanity.test.d.ts.map +1 -0
  165. package/dist/types/src/testing/index.d.ts +2 -0
  166. package/dist/types/src/testing/index.d.ts.map +1 -0
  167. package/dist/types/src/testing/testing.d.ts +8 -0
  168. package/dist/types/src/testing/testing.d.ts.map +1 -0
  169. package/dist/types/src/translations.d.ts +17 -12
  170. package/dist/types/src/translations.d.ts.map +1 -1
  171. package/dist/types/src/types.d.ts +98 -32
  172. package/dist/types/src/types.d.ts.map +1 -1
  173. package/dist/vendor/hyperformula.mjs +37145 -0
  174. package/package.json +57 -52
  175. package/src/SheetPlugin.tsx +52 -74
  176. package/src/components/ComputeGraph/ComputeGraphContextProvider.tsx +20 -0
  177. package/src/components/ComputeGraph/index.ts +1 -3
  178. package/src/components/FunctionEditor/FunctionEditor.tsx +45 -0
  179. package/src/components/FunctionEditor/index.ts +5 -0
  180. package/src/components/GridSheet/GridSheet.stories.tsx +41 -0
  181. package/src/components/GridSheet/GridSheet.tsx +161 -0
  182. package/src/components/{CellEditor/CellEditor.stories.tsx → GridSheet/SheetCellEditor.stories.tsx} +8 -8
  183. package/src/components/GridSheet/index.ts +5 -0
  184. package/src/components/GridSheet/util.ts +144 -0
  185. package/src/components/SheetContainer/SheetContainer.stories.tsx +40 -0
  186. package/src/components/SheetContainer/SheetContainer.tsx +52 -0
  187. package/src/components/SheetContainer/index.ts +7 -0
  188. package/src/components/SheetContext/SheetContext.tsx +108 -0
  189. package/src/components/SheetContext/index.ts +5 -0
  190. package/src/components/Toolbar/Toolbar.tsx +167 -85
  191. package/src/components/index.ts +2 -0
  192. package/src/defs/index.ts +6 -0
  193. package/src/{model → defs}/types.test.ts +8 -9
  194. package/src/{model → defs}/types.ts +24 -14
  195. package/src/defs/util.ts +151 -0
  196. package/src/extensions/compute.stories.tsx +151 -0
  197. package/src/extensions/compute.ts +147 -0
  198. package/src/{components/CellEditor → extensions/editor}/extension.test.ts +4 -6
  199. package/src/{components/CellEditor → extensions/editor}/extension.ts +5 -6
  200. package/src/{components/CellEditor → extensions/editor}/index.ts +0 -1
  201. package/src/extensions/index.ts +6 -0
  202. package/src/graph/compute-graph-registry.ts +90 -0
  203. package/src/graph/compute-graph.stories.tsx +93 -0
  204. package/src/graph/compute-graph.test.ts +87 -0
  205. package/src/graph/compute-graph.ts +242 -0
  206. package/src/graph/compute-node.ts +63 -0
  207. package/src/{components/ComputeGraph → graph/functions}/async-function.ts +25 -15
  208. package/src/{components/ComputeGraph → graph/functions}/edge-function.ts +16 -14
  209. package/src/graph/functions/index.ts +7 -0
  210. package/src/graph/hyperformula.test.ts +14 -0
  211. package/src/graph/index.ts +8 -0
  212. package/src/graph/testing/index.ts +6 -0
  213. package/src/graph/testing/test-builder.ts +54 -0
  214. package/src/{components/ComputeGraph/custom.ts → graph/testing/test-plugin.ts} +44 -14
  215. package/src/graph/util.ts +8 -0
  216. package/src/hooks/hooks.stories.tsx +50 -0
  217. package/src/hooks/index.ts +8 -0
  218. package/src/hooks/threads.ts +147 -0
  219. package/src/hooks/useComputeGraph.ts +28 -0
  220. package/src/hooks/useFormattingModel.ts +11 -0
  221. package/src/hooks/useSheetModel.ts +40 -0
  222. package/src/meta.ts +14 -0
  223. package/src/model/decorations.ts +64 -0
  224. package/src/{components/Sheet/formatting.ts → model/formatting-model.ts} +30 -20
  225. package/src/model/index.ts +3 -3
  226. package/src/model/sheet-model.test.ts +57 -0
  227. package/src/model/sheet-model.ts +418 -0
  228. package/src/sanity.test.ts +40 -0
  229. package/src/{components/Sheet → testing}/index.ts +1 -1
  230. package/src/testing/testing.tsx +68 -0
  231. package/src/translations.ts +6 -1
  232. package/src/types.ts +40 -41
  233. package/dist/lib/browser/SheetContainer-U4H5D34A.mjs +0 -1772
  234. package/dist/lib/browser/SheetContainer-U4H5D34A.mjs.map +0 -7
  235. package/dist/lib/browser/chunk-APHOLYUB.mjs +0 -175
  236. package/dist/lib/browser/chunk-APHOLYUB.mjs.map +0 -7
  237. package/dist/lib/browser/chunk-D5AGLXJP.mjs.map +0 -7
  238. package/dist/lib/browser/chunk-FUAGSXA4.mjs +0 -82
  239. package/dist/lib/browser/chunk-FUAGSXA4.mjs.map +0 -7
  240. package/dist/lib/browser/chunk-JRL5LGCE.mjs +0 -18
  241. package/dist/lib/browser/chunk-JRL5LGCE.mjs.map +0 -7
  242. package/dist/lib/browser/chunk-NU4PBN33.mjs +0 -8
  243. package/dist/lib/browser/chunk-NU4PBN33.mjs.map +0 -7
  244. package/dist/lib/browser/testing.mjs +0 -92
  245. package/dist/lib/browser/testing.mjs.map +0 -7
  246. package/dist/lib/node/SheetContainer-AXQV3ZT5.cjs +0 -1765
  247. package/dist/lib/node/SheetContainer-AXQV3ZT5.cjs.map +0 -7
  248. package/dist/lib/node/chunk-5KKJ4NPP.cjs.map +0 -7
  249. package/dist/lib/node/chunk-BJ6ZD7MN.cjs +0 -51
  250. package/dist/lib/node/chunk-BJ6ZD7MN.cjs.map +0 -7
  251. package/dist/lib/node/chunk-CN3RPESU.cjs +0 -202
  252. package/dist/lib/node/chunk-CN3RPESU.cjs.map +0 -7
  253. package/dist/lib/node/chunk-DSYKOI4E.cjs.map +0 -7
  254. package/dist/lib/node/chunk-PYXHNAAK.cjs +0 -40
  255. package/dist/lib/node/chunk-PYXHNAAK.cjs.map +0 -7
  256. package/dist/lib/node/testing.cjs +0 -111
  257. package/dist/lib/node/testing.cjs.map +0 -7
  258. package/dist/types/src/components/CellEditor/CellEditor.d.ts +0 -14
  259. package/dist/types/src/components/CellEditor/CellEditor.d.ts.map +0 -1
  260. package/dist/types/src/components/CellEditor/CellEditor.stories.d.ts.map +0 -1
  261. package/dist/types/src/components/CellEditor/extension.d.ts.map +0 -1
  262. package/dist/types/src/components/CellEditor/extension.test.d.ts.map +0 -1
  263. package/dist/types/src/components/CellEditor/index.d.ts +0 -3
  264. package/dist/types/src/components/CellEditor/index.d.ts.map +0 -1
  265. package/dist/types/src/components/ComputeGraph/async-function.d.ts.map +0 -1
  266. package/dist/types/src/components/ComputeGraph/custom.d.ts +0 -21
  267. package/dist/types/src/components/ComputeGraph/custom.d.ts.map +0 -1
  268. package/dist/types/src/components/ComputeGraph/edge-function.d.ts +0 -20
  269. package/dist/types/src/components/ComputeGraph/edge-function.d.ts.map +0 -1
  270. package/dist/types/src/components/ComputeGraph/graph-context.d.ts +0 -12
  271. package/dist/types/src/components/ComputeGraph/graph-context.d.ts.map +0 -1
  272. package/dist/types/src/components/ComputeGraph/graph.browser.test.d.ts +0 -2
  273. package/dist/types/src/components/ComputeGraph/graph.browser.test.d.ts.map +0 -1
  274. package/dist/types/src/components/ComputeGraph/graph.d.ts +0 -26
  275. package/dist/types/src/components/ComputeGraph/graph.d.ts.map +0 -1
  276. package/dist/types/src/components/Sheet/Sheet.d.ts +0 -55
  277. package/dist/types/src/components/Sheet/Sheet.d.ts.map +0 -1
  278. package/dist/types/src/components/Sheet/Sheet.stories.d.ts +0 -54
  279. package/dist/types/src/components/Sheet/Sheet.stories.d.ts.map +0 -1
  280. package/dist/types/src/components/Sheet/formatting.d.ts +0 -14
  281. package/dist/types/src/components/Sheet/formatting.d.ts.map +0 -1
  282. package/dist/types/src/components/Sheet/grid.d.ts +0 -52
  283. package/dist/types/src/components/Sheet/grid.d.ts.map +0 -1
  284. package/dist/types/src/components/Sheet/index.d.ts +0 -2
  285. package/dist/types/src/components/Sheet/index.d.ts.map +0 -1
  286. package/dist/types/src/components/Sheet/nav.d.ts +0 -29
  287. package/dist/types/src/components/Sheet/nav.d.ts.map +0 -1
  288. package/dist/types/src/components/Sheet/sheet-context.d.ts +0 -25
  289. package/dist/types/src/components/Sheet/sheet-context.d.ts.map +0 -1
  290. package/dist/types/src/components/Sheet/util.d.ts +0 -18
  291. package/dist/types/src/components/Sheet/util.d.ts.map +0 -1
  292. package/dist/types/src/components/SheetContainer.d.ts +0 -9
  293. package/dist/types/src/components/SheetContainer.d.ts.map +0 -1
  294. package/dist/types/src/components/Toolbar/common.d.ts +0 -20
  295. package/dist/types/src/components/Toolbar/common.d.ts.map +0 -1
  296. package/dist/types/src/model/functions.d.ts.map +0 -1
  297. package/dist/types/src/model/model.browser.test.d.ts +0 -2
  298. package/dist/types/src/model/model.browser.test.d.ts.map +0 -1
  299. package/dist/types/src/model/model.d.ts.map +0 -1
  300. package/dist/types/src/model/types.d.ts.map +0 -1
  301. package/dist/types/src/model/types.test.d.ts.map +0 -1
  302. package/dist/types/src/model/util.d.ts +0 -15
  303. package/dist/types/src/model/util.d.ts.map +0 -1
  304. package/dist/types/src/testing.d.ts +0 -9
  305. package/dist/types/src/testing.d.ts.map +0 -1
  306. package/src/components/CellEditor/CellEditor.tsx +0 -113
  307. package/src/components/ComputeGraph/graph-context.tsx +0 -50
  308. package/src/components/ComputeGraph/graph.browser.test.ts +0 -50
  309. package/src/components/ComputeGraph/graph.ts +0 -62
  310. package/src/components/Sheet/Sheet.stories.tsx +0 -287
  311. package/src/components/Sheet/Sheet.tsx +0 -1160
  312. package/src/components/Sheet/grid.ts +0 -191
  313. package/src/components/Sheet/nav.ts +0 -157
  314. package/src/components/Sheet/sheet-context.tsx +0 -150
  315. package/src/components/Sheet/util.ts +0 -56
  316. package/src/components/SheetContainer.tsx +0 -34
  317. package/src/components/Toolbar/common.tsx +0 -72
  318. package/src/meta.tsx +0 -18
  319. package/src/model/model.browser.test.ts +0 -100
  320. package/src/model/model.ts +0 -550
  321. package/src/model/util.ts +0 -36
  322. package/src/testing.ts +0 -50
  323. /package/dist/types/src/{model → defs}/types.test.d.ts +0 -0
  324. /package/dist/types/src/{components/CellEditor → extensions/editor}/extension.test.d.ts +0 -0
  325. /package/src/{model/functions.ts → graph/functions/function-defs.ts} +0 -0
@@ -1,54 +0,0 @@
1
- import '@dxos-theme';
2
- import { type Decorator } from '@storybook/react';
3
- import React from 'react';
4
- import { type SizeMap } from './grid';
5
- declare const _default: {
6
- title: string;
7
- component: {
8
- Root: ({ children, ...props }: React.PropsWithChildren<import("./sheet-context").SheetContextProps>) => React.JSX.Element;
9
- Main: React.ForwardRefExoticComponent<Omit<Partial<import("./nav").GridSize>, "className"> & {
10
- classNames?: import("@dxos/react-ui").ClassNameValue;
11
- } & React.RefAttributes<HTMLDivElement>>;
12
- Rows: React.ForwardRefExoticComponent<{
13
- rows: import("../../model").CellIndex[];
14
- } & {
15
- selected?: number;
16
- onSelect?: (selected: number) => void;
17
- } & {
18
- sizes?: SizeMap;
19
- onResize?: (idx: import("../../model").CellIndex, size: number, save?: boolean) => void;
20
- } & {
21
- onMove?: (from: number, to: number) => void;
22
- } & React.RefAttributes<HTMLDivElement>>;
23
- Columns: React.ForwardRefExoticComponent<{
24
- columns: import("../../model").CellIndex[];
25
- } & {
26
- selected?: number;
27
- onSelect?: (selected: number) => void;
28
- } & {
29
- sizes?: SizeMap;
30
- onResize?: (idx: import("../../model").CellIndex, size: number, save?: boolean) => void;
31
- } & {
32
- onMove?: (from: number, to: number) => void;
33
- } & React.RefAttributes<HTMLDivElement>>;
34
- Grid: React.ForwardRefExoticComponent<import("./grid").GridLayoutProps & {
35
- size: import("./nav").GridSize;
36
- } & React.RefAttributes<HTMLDivElement>>;
37
- Cell: ({ id, cell, style, active, onSelect }: import("./Sheet").SheetCellProps) => React.JSX.Element;
38
- StatusBar: () => React.JSX.Element;
39
- Debug: () => React.JSX.Element;
40
- };
41
- decorators: Decorator[];
42
- };
43
- export default _default;
44
- export declare const Default: () => React.JSX.Element | null;
45
- export declare const Debug: () => React.JSX.Element | null;
46
- export declare const Rows: () => React.JSX.Element | null;
47
- export declare const Columns: () => React.JSX.Element | null;
48
- export declare const Main: () => React.JSX.Element | null;
49
- /**
50
- * Scrolling container with fixed border that overlaps the border of inner elements.
51
- */
52
- export declare const ScrollLayout: () => React.JSX.Element;
53
- export declare const GridLayout: () => React.JSX.Element;
54
- //# sourceMappingURL=Sheet.stories.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Sheet.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Sheet/Sheet.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAA0C,MAAM,OAAO,CAAC;AAW/D,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;;;;;;;;;;;;;;;gFA6Q0nF,CAAC;;;;;;;;;;;gFAAD,CAAC;;;;;;;;;;;;;AAtKjqF,wBAIE;AAEF,eAAO,MAAM,OAAO,gCAanB,CAAC;AAEF,eAAO,MAAM,KAAK,gCAajB,CAAC;AAEF,eAAO,MAAM,IAAI,gCAiBhB,CAAC;AAEF,eAAO,MAAM,OAAO,gCAiBnB,CAAC;AAEF,eAAO,MAAM,IAAI,gCAqBhB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,yBAkBxB,CAAC;AAEF,eAAO,MAAM,UAAU,yBActB,CAAC"}
@@ -1,14 +0,0 @@
1
- import { type ClassNameValue } from '@dxos/react-ui-types';
2
- import { type SheetModel, type CellAddress } from '../../model';
3
- export declare class FormattingModel {
4
- private readonly model;
5
- constructor(model: SheetModel);
6
- /**
7
- * Get formatted string value and className for cell.
8
- */
9
- getFormatting(cell: CellAddress): {
10
- value?: string;
11
- classNames?: ClassNameValue;
12
- };
13
- }
14
- //# sourceMappingURL=formatting.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"formatting.d.ts","sourceRoot":"","sources":["../../../../../src/components/Sheet/formatting.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,WAAW,EAAW,MAAM,aAAa,CAAC;AAGzE,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAAL,KAAK,EAAE,UAAU;IAE9C;;OAEG;IACH,aAAa,CAAC,IAAI,EAAE,WAAW,GAAG;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,cAAc,CAAA;KAAE;CA0FlF"}
@@ -1,52 +0,0 @@
1
- import { type MouseEvent } from 'react';
2
- import { type CellAddress, type CellIndex } from '../../model';
3
- export type SizeMap = Record<string, number>;
4
- export type RowPosition = {
5
- row: number;
6
- } & Pick<DOMRect, 'top' | 'height'>;
7
- export type ColumnPosition = {
8
- column: number;
9
- } & Pick<DOMRect, 'left' | 'width'>;
10
- export declare const axisWidth = "calc(var(--rail-size)-2px)";
11
- export declare const axisHeight = 34;
12
- export declare const minWidth = 40;
13
- export declare const maxWidth = 800;
14
- export declare const minHeight = 34;
15
- export declare const maxHeight = 400;
16
- export declare const defaultWidth = 200;
17
- export declare const defaultHeight = 34;
18
- /**
19
- * Cell nodes are identified by their A1 notation.
20
- */
21
- export declare const CELL_DATA_KEY = "cell";
22
- export type GridLayoutProps = {
23
- rows: CellIndex[];
24
- columns: CellIndex[];
25
- rowSizes?: SizeMap;
26
- columnSizes?: SizeMap;
27
- };
28
- export type GridLayout = {
29
- width: number;
30
- height: number;
31
- rowRange: RowPosition[];
32
- columnRange: ColumnPosition[];
33
- };
34
- /**
35
- * Calculates the grid geometry for the current viewport.
36
- */
37
- export declare const useGridLayout: ({ scroller, size, rows, columns, rowSizes, columnSizes, }: GridLayoutProps & {
38
- scroller: HTMLDivElement | null;
39
- size: {
40
- width: number;
41
- height: number;
42
- };
43
- }) => GridLayout;
44
- /**
45
- * Find child node at mouse pointer.
46
- */
47
- export declare const getCellAtPointer: (event: MouseEvent) => CellAddress | undefined;
48
- /**
49
- * Get element.
50
- */
51
- export declare const getCellElement: (root: HTMLElement, cell: CellAddress) => HTMLElement | null;
52
- //# sourceMappingURL=grid.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../../../../src/components/Sheet/grid.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAuB,MAAM,OAAO,CAAC;AAE7D,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAA8C,MAAM,aAAa,CAAC;AAK3G,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE7C,MAAM,MAAM,WAAW,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,OAAO,EAAE,KAAK,GAAG,QAAQ,CAAC,CAAC;AAC5E,MAAM,MAAM,cAAc,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC;AAElF,eAAO,MAAM,SAAS,+BAA+B,CAAC;AACtD,eAAO,MAAM,UAAU,KAAK,CAAC;AAE7B,eAAO,MAAM,QAAQ,KAAK,CAAC;AAC3B,eAAO,MAAM,QAAQ,MAAM,CAAC;AAE5B,eAAO,MAAM,SAAS,KAAa,CAAC;AACpC,eAAO,MAAM,SAAS,MAAM,CAAC;AAE7B,eAAO,MAAM,YAAY,MAAM,CAAC;AAChC,eAAO,MAAM,aAAa,KAAY,CAAC;AAEvC;;GAEG;AACH,eAAO,MAAM,aAAa,SAAS,CAAC;AAEpC,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,SAAS,EAAE,CAAC;IAClB,OAAO,EAAE,SAAS,EAAE,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,WAAW,EAAE,cAAc,EAAE,CAAC;CAC/B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,8DAOvB,eAAe,GAAG;IACnB,QAAQ,EAAE,cAAc,GAAG,IAAI,CAAC;IAChC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CACzC,KAAG,UA4GH,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,UAAW,UAAU,KAAG,WAAW,GAAG,SASlE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,SAAU,WAAW,QAAQ,WAAW,KAAG,WAAW,GAAG,IAGnF,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from './Sheet';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Sheet/index.ts"],"names":[],"mappings":"AAIA,cAAc,SAAS,CAAC"}
@@ -1,29 +0,0 @@
1
- import { type KeyboardEvent, type MouseEventHandler } from 'react';
2
- import { type CellAddress, type CellRange } from '../../model';
3
- export type GridSize = {
4
- numRows: number;
5
- numColumns: number;
6
- };
7
- /**
8
- * Calculate next range based on arrow keys.
9
- */
10
- export declare const handleNav: (ev: KeyboardEvent<HTMLInputElement>, cursor: CellAddress | undefined, range: CellRange | undefined, size: GridSize) => {
11
- cursor?: CellAddress;
12
- range?: CellRange;
13
- };
14
- /**
15
- * Calculate next cell based on arrow keys.
16
- */
17
- export declare const handleArrowNav: (ev: Pick<KeyboardEvent<HTMLInputElement>, "key" | "metaKey">, cursor: CellAddress | undefined, { numRows, numColumns }: GridSize) => CellAddress | undefined;
18
- /**
19
- * Hook to manage range drag handlers.
20
- */
21
- export declare const useRangeSelect: (cb: (event: "start" | "move" | "end", range: CellRange | undefined) => void) => {
22
- range: CellRange | undefined;
23
- handlers: {
24
- onMouseDown: MouseEventHandler<HTMLDivElement>;
25
- onMouseMove: MouseEventHandler<HTMLDivElement>;
26
- onMouseUp: MouseEventHandler<HTMLDivElement>;
27
- };
28
- };
29
- //# sourceMappingURL=nav.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nav.d.ts","sourceRoot":"","sources":["../../../../../src/components/Sheet/nav.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,iBAAiB,EAAY,MAAM,OAAO,CAAC;AAG7E,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAa,MAAM,aAAa,CAAC;AAE1E,MAAM,MAAM,QAAQ,GAAG;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,OAChB,aAAa,CAAC,gBAAgB,CAAC,UAC3B,WAAW,GAAG,SAAS,SACxB,SAAS,GAAG,SAAS,QACtB,QAAQ,KACb;IAAE,MAAM,CAAC,EAAE,WAAW,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAA;CAoC3C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,OACrB,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,EAAE,KAAK,GAAG,SAAS,CAAC,UACpD,WAAW,GAAG,SAAS,2BACN,QAAQ,KAChC,WAAW,GAAG,SAmChB,CAAC;AAEF;;GAEG;AAEH,eAAO,MAAM,cAAc,OACrB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,EAAE,KAAK,EAAE,SAAS,GAAG,SAAS,KAAK,IAAI,KAC1E;IACD,KAAK,EAAE,SAAS,GAAG,SAAS,CAAC;IAC7B,QAAQ,EAAE;QACR,WAAW,EAAE,iBAAiB,CAAC,cAAc,CAAC,CAAC;QAC/C,WAAW,EAAE,iBAAiB,CAAC,cAAc,CAAC,CAAC;QAC/C,SAAS,EAAE,iBAAiB,CAAC,cAAc,CAAC,CAAC;KAC9C,CAAC;CAwCH,CAAC"}
@@ -1,25 +0,0 @@
1
- import React, { type PropsWithChildren } from 'react';
2
- import { type Space } from '@dxos/react-client/echo';
3
- import { FormattingModel } from './formatting';
4
- import { type CellAddress, type CellRange, SheetModel } from '../../model';
5
- import { type SheetType } from '../../types';
6
- import { type FunctionContextOptions } from '../ComputeGraph';
7
- export type SheetContextType = {
8
- model: SheetModel;
9
- formatting: FormattingModel;
10
- cursor?: CellAddress;
11
- setCursor: (cell: CellAddress | undefined) => void;
12
- range?: CellRange;
13
- setRange: (range: CellRange | undefined) => void;
14
- editing: boolean;
15
- setEditing: (editing: boolean) => void;
16
- onInfo?: () => void;
17
- };
18
- export declare const useSheetContext: () => SheetContextType;
19
- export type SheetContextProps = {
20
- sheet: SheetType;
21
- space: Space;
22
- readonly?: boolean;
23
- } & Pick<SheetContextType, 'onInfo'> & Partial<FunctionContextOptions>;
24
- export declare const SheetContextProvider: ({ children, sheet, space, readonly, onInfo, ...options }: PropsWithChildren<SheetContextProps>) => React.JSX.Element | null;
25
- //# sourceMappingURL=sheet-context.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sheet-context.d.ts","sourceRoot":"","sources":["../../../../../src/components/Sheet/sheet-context.tsx"],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* Gets the relative client rect of an element within a parent container.
3
- * NOTE: This is stable even when the parent is scrolling.
4
- * https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect
5
- * @param root Parent container (e.g., scrollable container).
6
- * @param element
7
- */
8
- export declare const getRelativeClientRect: (root: HTMLElement, element: HTMLElement) => DOMRect;
9
- /**
10
- * Union of two rectangles.
11
- */
12
- export declare const getRectUnion: (b1: DOMRect, b2: DOMRect) => Pick<DOMRect, "left" | "top" | "width" | "height">;
13
- /**
14
- * Scroll to cell.
15
- * We need to correct for the DOM `scrollIntoView` function which doesn't show the border.
16
- */
17
- export declare const scrollIntoView: (scrollContainer: HTMLElement, el: HTMLElement) => void;
18
- //# sourceMappingURL=util.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../../../src/components/Sheet/util.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,SAAU,WAAW,WAAW,WAAW,KAAG,OAS/E,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,OAAQ,OAAO,MAAM,OAAO,KAAG,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAOxG,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,oBAAqB,WAAW,MAAM,WAAW,SAiB3E,CAAC"}
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- import { type LayoutCoordinate } from '@dxos/app-framework';
3
- import { type SheetRootProps } from './Sheet';
4
- declare const SheetContainer: ({ sheet, space, role, remoteFunctionUrl, }: SheetRootProps & {
5
- role?: string;
6
- coordinate?: LayoutCoordinate;
7
- }) => React.JSX.Element;
8
- export default SheetContainer;
9
- //# sourceMappingURL=SheetContainer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SheetContainer.d.ts","sourceRoot":"","sources":["../../../../src/components/SheetContainer.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAG5D,OAAO,EAAS,KAAK,cAAc,EAAE,MAAM,SAAS,CAAC;AAErD,QAAA,MAAM,cAAc,+CAKjB,cAAc,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,gBAAgB,CAAA;CAAE,sBAenE,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -1,20 +0,0 @@
1
- import { type Icon } from '@phosphor-icons/react';
2
- import React from 'react';
3
- import { type ToolbarButtonProps as NaturalToolbarButtonProps, type ToolbarToggleGroupItemProps as NaturalToolbarToggleGroupItemProps } from '@dxos/react-ui';
4
- export declare const iconStyles: string;
5
- export declare const buttonStyles = "min-bs-0 p-2";
6
- export declare const tooltipProps: {
7
- side: "top";
8
- classNames: string;
9
- };
10
- export declare const ToolbarSeparator: () => React.JSX.Element;
11
- type ToolbarButtonProps = NaturalToolbarButtonProps & {
12
- Icon: Icon;
13
- };
14
- export declare const ToolbarButton: ({ Icon, children, ...props }: ToolbarButtonProps) => React.JSX.Element;
15
- export type ToolbarToggleButtonProps = NaturalToolbarToggleGroupItemProps & {
16
- Icon: Icon;
17
- };
18
- export declare const ToolbarToggleButton: ({ Icon, children, ...props }: ToolbarToggleButtonProps) => React.JSX.Element;
19
- export {};
20
- //# sourceMappingURL=common.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../../src/components/Toolbar/common.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAGL,KAAK,kBAAkB,IAAI,yBAAyB,EACpD,KAAK,2BAA2B,IAAI,kCAAkC,EACvE,MAAM,gBAAgB,CAAC;AAKxB,eAAO,MAAM,UAAU,QAAa,CAAC;AACrC,eAAO,MAAM,YAAY,iBAAiB,CAAC;AAC3C,eAAO,MAAM,YAAY;;;CAA+C,CAAC;AAEzE,eAAO,MAAM,gBAAgB,yBAAkD,CAAC;AAMhF,KAAK,kBAAkB,GAAG,yBAAyB,GAAG;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC;AAErE,eAAO,MAAM,aAAa,iCAAkC,kBAAkB,sBAiB7E,CAAC;AAMF,MAAM,MAAM,wBAAwB,GAAG,kCAAkC,GAAG;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC;AAE3F,eAAO,MAAM,mBAAmB,iCAAkC,wBAAwB,sBAiBzF,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../../../src/model/functions.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,kBAAkB,EA42EhD,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=model.browser.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"model.browser.test.d.ts","sourceRoot":"","sources":["../../../../src/model/model.browser.test.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../../src/model/model.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAE3F,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAK/C,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAC;A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M,SAAS,MAAO,WAAW,GAAG,SAAS,KAAK,WAAW,GAAG,SAAS,YAE/E,CAAC;AAEF,eAAO,MAAM,YAAY,WAAY,MAAM,KAAG,MAM7C,CAAC;AAEF,eAAO,MAAM,mBAAmB,oBAAqB,WAAW,KAAG,MAElE,CAAC;AAEF,eAAO,MAAM,qBAAqB,QAAS,MAAM,KAAG,WAOnD,CAAC;AAEF,eAAO,MAAM,iBAAiB,UAAW,SAAS,WAIjD,CAAC;AAEF,eAAO,MAAM,mBAAmB,QAAS,MAAM,KAAG,SAGjD,CAAC;AAEF,eAAO,MAAM,OAAO,UAAW,SAAS,GAAG,SAAS,QAAQ,WAAW,KAAG,OAuBzE,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.test.d.ts","sourceRoot":"","sources":["../../../../src/model/types.test.ts"],"names":[],"mappings":""}
@@ -1,15 +0,0 @@
1
- export declare class ApiError extends Error {
2
- }
3
- export declare class ReadonlyException extends ApiError {
4
- }
5
- export declare class RangeException extends ApiError {
6
- constructor(n: number);
7
- }
8
- /**
9
- * With a string length of 8, the chance of a collision is 0.02% for a sheet with 10,000 strings.
10
- */
11
- export declare const createIndex: (length?: number) => string;
12
- export declare const createIndices: (length: number) => string[];
13
- export declare const pickOne: <T>(values: T[]) => T;
14
- export declare const pickSome: <T>(values: T[], n?: number) => T[];
15
- //# sourceMappingURL=util.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../../src/model/util.ts"],"names":[],"mappings":"AAOA,qBAAa,QAAS,SAAQ,KAAK;CAAG;AACtC,qBAAa,iBAAkB,SAAQ,QAAQ;CAAG;AAClD,qBAAa,cAAe,SAAQ,QAAQ;gBAC9B,CAAC,EAAE,MAAM;CAGtB;AAED;;GAEG;AACH,eAAO,MAAM,WAAW,uBAAiB,MAKxC,CAAC;AAEF,eAAO,MAAM,aAAa,WAAY,MAAM,KAAG,MAAM,EAAqD,CAAC;AAG3G,eAAO,MAAM,OAAO,GAAI,CAAC,UAAU,CAAC,EAAE,KAAG,CAAsD,CAAC;AAChG,eAAO,MAAM,QAAQ,GAAI,CAAC,UAAU,CAAC,EAAE,iBAAU,CAAC,EAMjD,CAAC"}
@@ -1,9 +0,0 @@
1
- import { type ComputeGraph } from './components';
2
- import { type CellValue } from './types';
3
- export declare const testSheetName = "test";
4
- export declare const createCells: () => Record<string, CellValue>;
5
- export declare const createTestSheet: ({ name, graph, }?: {
6
- name?: string;
7
- graph?: ComputeGraph;
8
- }) => Promise<import("./types").SheetType>;
9
- //# sourceMappingURL=testing.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../../src/testing.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,YAAY,EAAsB,MAAM,cAAc,CAAC;AAErE,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AAEtD,eAAO,MAAM,aAAa,SAAS,CAAC;AAEpC,eAAO,MAAM,WAAW,QAAO,MAAM,CAAC,MAAM,EAAE,SAAS,CA0BrD,CAAC;AAEH,eAAO,MAAM,eAAe,sBAGzB;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,YAAY,CAAA;CAAE,yCAQzC,CAAC"}
@@ -1,113 +0,0 @@
1
- //
2
- // Copyright 2024 DXOS.org
3
- //
4
-
5
- import { type Extension } from '@codemirror/state';
6
- import { EditorView, keymap } from '@codemirror/view';
7
- import React, { type DOMAttributes, type KeyboardEvent } from 'react';
8
-
9
- import { useThemeContext } from '@dxos/react-ui';
10
- import {
11
- type UseTextEditorProps,
12
- createBasicExtensions,
13
- createThemeExtensions,
14
- preventNewline,
15
- useTextEditor,
16
- } from '@dxos/react-ui-editor';
17
-
18
- export type EditorKeysProps = {
19
- onClose: (value: string | undefined) => void;
20
- onNav?: (value: string | undefined, ev: Pick<KeyboardEvent<HTMLInputElement>, 'key'>) => void;
21
- };
22
-
23
- export const editorKeys = ({ onNav, onClose }: EditorKeysProps): Extension => {
24
- return keymap.of([
25
- {
26
- key: 'ArrowUp',
27
- run: (editor) => {
28
- const value = editor.state.doc.toString();
29
- onNav?.(value, { key: 'ArrowUp' });
30
- return !!onNav;
31
- },
32
- },
33
- {
34
- key: 'ArrowDown',
35
- run: (editor) => {
36
- const value = editor.state.doc.toString();
37
- onNav?.(value, { key: 'ArrowDown' });
38
- return !!onNav;
39
- },
40
- },
41
- {
42
- key: 'ArrowLeft',
43
- run: (editor) => {
44
- const value = editor.state.doc.toString();
45
- onNav?.(value, { key: 'ArrowLeft' });
46
- return !!onNav;
47
- },
48
- },
49
- {
50
- key: 'ArrowRight',
51
- run: (editor) => {
52
- const value = editor.state.doc.toString();
53
- onNav?.(value, { key: 'ArrowRight' });
54
- return !!onNav;
55
- },
56
- },
57
- {
58
- key: 'Enter',
59
- run: (editor) => {
60
- onClose(editor.state.doc.toString());
61
- return true;
62
- },
63
- },
64
- {
65
- key: 'Escape',
66
- run: () => {
67
- onClose(undefined);
68
- return true;
69
- },
70
- },
71
- ]);
72
- };
73
-
74
- export type CellEditorProps = {
75
- value?: string;
76
- extension?: Extension;
77
- } & Pick<UseTextEditorProps, 'autoFocus'> &
78
- Pick<DOMAttributes<HTMLInputElement>, 'onBlur' | 'onKeyDown'>;
79
-
80
- export const CellEditor = ({ value, extension, autoFocus, onBlur }: CellEditorProps) => {
81
- const { themeMode } = useThemeContext();
82
- const { parentRef } = useTextEditor(() => {
83
- return {
84
- autoFocus,
85
- initialValue: value,
86
- selection: { anchor: value?.length ?? 0 },
87
- extensions: [
88
- extension ?? [],
89
- preventNewline,
90
- EditorView.focusChangeEffect.of((_, focusing) => {
91
- if (!focusing) {
92
- onBlur?.({ type: 'blur' } as any);
93
- }
94
- return null;
95
- }),
96
- createBasicExtensions({ lineWrapping: false }),
97
- createThemeExtensions({
98
- themeMode,
99
- slots: {
100
- editor: {
101
- className: 'flex w-full [&>.cm-scroller]:scrollbar-none',
102
- },
103
- content: {
104
- className: '!px-2 !py-1',
105
- },
106
- },
107
- }),
108
- ],
109
- };
110
- }, [extension]);
111
-
112
- return <div ref={parentRef} className='flex w-full' />;
113
- };
@@ -1,50 +0,0 @@
1
- //
2
- // Copyright 2024 DXOS.org
3
- //
4
-
5
- import React, { createContext, type PropsWithChildren, useContext, useEffect } from 'react';
6
-
7
- import { type Space } from '@dxos/react-client/echo';
8
-
9
- import { type FunctionContextOptions } from './async-function';
10
- import { CustomPlugin, CustomPluginTranslations } from './custom';
11
- import { EdgeFunctionPlugin, EdgeFunctionPluginTranslations } from './edge-function';
12
- import { createComputeGraph, type ComputeGraph } from './graph';
13
-
14
- export type ComputeGraphContextType = {
15
- graphs: Record<string, ComputeGraph>;
16
- setGraph: (key: string, graph: ComputeGraph) => void;
17
- };
18
-
19
- export const ComputeGraphContext = createContext<ComputeGraphContextType>({ graphs: {}, setGraph: () => {} });
20
-
21
- export const ComputeGraphContextProvider = ({
22
- children,
23
- graphs,
24
- setGraph,
25
- }: PropsWithChildren<ComputeGraphContextType>) => {
26
- return <ComputeGraphContext.Provider value={{ graphs, setGraph }}>{children}</ComputeGraphContext.Provider>;
27
- };
28
-
29
- export const useComputeGraph = (space: Space, options?: Partial<FunctionContextOptions>): ComputeGraph => {
30
- const { graphs, setGraph } = useContext(ComputeGraphContext);
31
- const graph =
32
- graphs[space.id] ??
33
- createComputeGraph(
34
- [
35
- { plugin: EdgeFunctionPlugin, translations: EdgeFunctionPluginTranslations },
36
- // TODO(wittjosiah): Remove. Needed for current test sheet generated data.
37
- { plugin: CustomPlugin, translations: CustomPluginTranslations },
38
- ],
39
- space,
40
- options,
41
- );
42
-
43
- useEffect(() => {
44
- if (!graphs[space.id]) {
45
- setGraph(space.id, graph);
46
- }
47
- }, [space]);
48
-
49
- return graph;
50
- };
@@ -1,50 +0,0 @@
1
- //
2
- // Copyright 2024 DXOS.org
3
- //
4
-
5
- import { expect } from 'chai';
6
- import { describe, test } from 'vitest';
7
-
8
- import { Trigger } from '@dxos/async';
9
-
10
- import { CustomPlugin, CustomPluginTranslations } from './custom';
11
- import { createComputeGraph } from './graph';
12
- import { addressFromA1Notation, SheetModel } from '../../model';
13
- import { type CellScalarValue, createSheet } from '../../types';
14
-
15
- /**
16
- * VITEST_ENV=chrome p vitest --watch
17
- * NOTE: Browser test required for hyperformula due to raw translation files.
18
- */
19
- describe('compute graph', () => {
20
- const createModel = async () => {
21
- const graph = createComputeGraph([{ plugin: CustomPlugin, translations: CustomPluginTranslations }]);
22
- const sheet = createSheet();
23
- const model = new SheetModel(graph, sheet, undefined, { rows: 5, columns: 5 });
24
- graph.update.on(() => model.update.emit());
25
- return { graph, model };
26
- };
27
-
28
- test('async function', async () => {
29
- const { graph, model } = await createModel();
30
-
31
- // Triggers function.
32
- model.setValue(addressFromA1Notation('A1'), '=TEST()');
33
-
34
- const trigger = new Trigger<CellScalarValue>();
35
- model.update.on(() => {
36
- const value = model.getValue(addressFromA1Notation('A1'));
37
- trigger.wake(value);
38
- });
39
-
40
- // Get initial value (i.e., null).
41
- const v1 = model.getValue(addressFromA1Notation('A1'));
42
- expect(v1).to.be.null;
43
- expect(graph.context.info.invocations.TEST).to.eq(undefined);
44
-
45
- // Wait until async update triggered.
46
- const v2 = await trigger.wait();
47
- expect(v2).not.to.be.null;
48
- expect(graph.context.info.invocations.TEST).to.eq(1);
49
- });
50
- });
@@ -1,62 +0,0 @@
1
- //
2
- // Copyright 2024 DXOS.org
3
- //
4
-
5
- import { type FunctionPluginDefinition, HyperFormula } from 'hyperformula';
6
- import { type FunctionTranslationsPackage } from 'hyperformula/typings/interpreter';
7
-
8
- import { Event } from '@dxos/async';
9
- import { type Space } from '@dxos/client/echo';
10
- import { PublicKey } from '@dxos/keys';
11
- import { log } from '@dxos/log';
12
-
13
- import { FunctionContext, type FunctionContextOptions } from './async-function';
14
-
15
- /**
16
- * Create root graph for space.
17
- */
18
- export const createComputeGraph = (
19
- // TODO(wittjosiah): Factor out this type to make these easier to define.
20
- functionPlugins: { plugin: FunctionPluginDefinition; translations: FunctionTranslationsPackage }[] = [],
21
- space?: Space,
22
- options?: Partial<FunctionContextOptions>,
23
- ): ComputeGraph => {
24
- functionPlugins.forEach(({ plugin, translations }) => {
25
- HyperFormula.registerFunctionPlugin(plugin, translations);
26
- });
27
-
28
- const hf = HyperFormula.buildEmpty({ licenseKey: 'gpl-v3' });
29
- return new ComputeGraph(hf, space, options);
30
- };
31
-
32
- /**
33
- * Per-space compute and dependency graph.
34
- */
35
- // TODO(burdon): Create instance for each space.
36
- export class ComputeGraph {
37
- public readonly id = `graph-${PublicKey.random().truncate()}`;
38
- public readonly update = new Event();
39
-
40
- // The context is passed to all functions.
41
- public readonly context = new FunctionContext(
42
- this.hf,
43
- this._space,
44
- () => {
45
- this.refresh();
46
- },
47
- this._options,
48
- );
49
-
50
- constructor(
51
- public readonly hf: HyperFormula,
52
- private readonly _space?: Space,
53
- private readonly _options?: Partial<FunctionContextOptions>,
54
- ) {
55
- this.hf.updateConfig({ context: this.context });
56
- }
57
-
58
- refresh() {
59
- log('refresh', { id: this.id });
60
- this.update.emit();
61
- }
62
- }