@dxos/plugin-sheet 0.6.11 → 0.6.12-main.15a606f

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 (260) hide show
  1. package/dist/lib/browser/SheetContainer-V4GCCZTX.mjs +261 -0
  2. package/dist/lib/browser/SheetContainer-V4GCCZTX.mjs.map +7 -0
  3. package/dist/lib/browser/{chunk-D5AGLXJP.mjs → chunk-6ZMQVB4Z.mjs} +359 -671
  4. package/dist/lib/browser/chunk-6ZMQVB4Z.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-JRL5LGCE.mjs → chunk-QILRZNE5.mjs} +2 -5
  6. package/dist/lib/browser/chunk-QILRZNE5.mjs.map +7 -0
  7. package/dist/lib/browser/{chunk-FUAGSXA4.mjs → chunk-T3NJFTD4.mjs} +8 -15
  8. package/dist/lib/browser/chunk-T3NJFTD4.mjs.map +7 -0
  9. package/dist/lib/browser/{SheetContainer-U4H5D34A.mjs → chunk-U2JHW3L6.mjs} +1020 -240
  10. package/dist/lib/browser/chunk-U2JHW3L6.mjs.map +7 -0
  11. package/dist/lib/browser/graph-T27BOBOV.mjs +21 -0
  12. package/dist/lib/browser/graph-T27BOBOV.mjs.map +7 -0
  13. package/dist/lib/browser/index.mjs +68 -56
  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 -6
  18. package/dist/lib/node/SheetContainer-3ZY7MPWJ.cjs +279 -0
  19. package/dist/lib/node/SheetContainer-3ZY7MPWJ.cjs.map +7 -0
  20. package/dist/lib/node/{chunk-BJ6ZD7MN.cjs → chunk-BNARJ5GM.cjs} +5 -18
  21. package/dist/lib/node/chunk-BNARJ5GM.cjs.map +7 -0
  22. package/dist/lib/node/{chunk-5KKJ4NPP.cjs → chunk-DD6FIXWC.cjs} +360 -667
  23. package/dist/lib/node/chunk-DD6FIXWC.cjs.map +7 -0
  24. package/dist/lib/node/{SheetContainer-AXQV3ZT5.cjs → chunk-OTTD7FBK.cjs} +1050 -279
  25. package/dist/lib/node/chunk-OTTD7FBK.cjs.map +7 -0
  26. package/dist/lib/node/{chunk-DSYKOI4E.cjs → chunk-Q3HBHPRL.cjs} +12 -20
  27. package/dist/lib/node/chunk-Q3HBHPRL.cjs.map +7 -0
  28. package/dist/lib/node/graph-SPKGX7W4.cjs +43 -0
  29. package/dist/lib/node/graph-SPKGX7W4.cjs.map +7 -0
  30. package/dist/lib/node/index.cjs +83 -64
  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 +10 -12
  36. package/dist/lib/node/types.cjs.map +2 -2
  37. package/dist/lib/node-esm/SheetContainer-PXSJX6XK.mjs +262 -0
  38. package/dist/lib/node-esm/SheetContainer-PXSJX6XK.mjs.map +7 -0
  39. package/dist/lib/node-esm/chunk-7HVSOTGA.mjs +2553 -0
  40. package/dist/lib/node-esm/chunk-7HVSOTGA.mjs.map +7 -0
  41. package/dist/lib/node-esm/chunk-BMNA27EX.mjs +76 -0
  42. package/dist/lib/node-esm/chunk-BMNA27EX.mjs.map +7 -0
  43. package/dist/lib/node-esm/chunk-D6KU5MI7.mjs +2925 -0
  44. package/dist/lib/node-esm/chunk-D6KU5MI7.mjs.map +7 -0
  45. package/dist/lib/node-esm/chunk-IU2L277A.mjs +17 -0
  46. package/dist/lib/node-esm/chunk-IU2L277A.mjs.map +7 -0
  47. package/dist/lib/node-esm/graph-U67IO4UC.mjs +22 -0
  48. package/dist/lib/node-esm/graph-U67IO4UC.mjs.map +7 -0
  49. package/dist/lib/node-esm/index.mjs +261 -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 +21 -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/CellEditor/CellEditor.d.ts +23 -3
  58. package/dist/types/src/components/CellEditor/CellEditor.d.ts.map +1 -1
  59. package/dist/types/src/components/CellEditor/CellEditor.stories.d.ts +2 -2
  60. package/dist/types/src/components/CellEditor/CellEditor.stories.d.ts.map +1 -1
  61. package/dist/types/src/components/CellEditor/extension.d.ts +1 -1
  62. package/dist/types/src/components/CellEditor/extension.d.ts.map +1 -1
  63. package/dist/types/src/components/ComputeGraph/ComputeGraphContextProvider.d.ts +11 -0
  64. package/dist/types/src/components/ComputeGraph/ComputeGraphContextProvider.d.ts.map +1 -0
  65. package/dist/types/src/components/ComputeGraph/index.d.ts +1 -3
  66. package/dist/types/src/components/ComputeGraph/index.d.ts.map +1 -1
  67. package/dist/types/src/components/GridSheet/GridSheet.d.ts +10 -0
  68. package/dist/types/src/components/GridSheet/GridSheet.d.ts.map +1 -0
  69. package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts +9 -0
  70. package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +1 -0
  71. package/dist/types/src/components/GridSheet/util.d.ts +6 -0
  72. package/dist/types/src/components/GridSheet/util.d.ts.map +1 -0
  73. package/dist/types/src/components/Sheet/Sheet.d.ts +1 -1
  74. package/dist/types/src/components/Sheet/Sheet.d.ts.map +1 -1
  75. package/dist/types/src/components/Sheet/Sheet.stories.d.ts +5 -6
  76. package/dist/types/src/components/Sheet/Sheet.stories.d.ts.map +1 -1
  77. package/dist/types/src/components/Sheet/decorations.d.ts +24 -0
  78. package/dist/types/src/components/Sheet/decorations.d.ts.map +1 -0
  79. package/dist/types/src/components/Sheet/grid.d.ts +2 -2
  80. package/dist/types/src/components/Sheet/grid.d.ts.map +1 -1
  81. package/dist/types/src/components/Sheet/nav.d.ts +3 -3
  82. package/dist/types/src/components/Sheet/nav.d.ts.map +1 -1
  83. package/dist/types/src/components/Sheet/sheet-context.d.ts +6 -5
  84. package/dist/types/src/components/Sheet/sheet-context.d.ts.map +1 -1
  85. package/dist/types/src/components/Sheet/threads.d.ts +2 -0
  86. package/dist/types/src/components/Sheet/threads.d.ts.map +1 -0
  87. package/dist/types/src/components/SheetContainer.d.ts +2 -3
  88. package/dist/types/src/components/SheetContainer.d.ts.map +1 -1
  89. package/dist/types/src/components/Toolbar/Toolbar.d.ts +19 -3
  90. package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
  91. package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +18 -13
  92. package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -1
  93. package/dist/types/src/components/index.d.ts +2 -2
  94. package/dist/types/src/components/index.d.ts.map +1 -1
  95. package/dist/types/src/defs/index.d.ts +3 -0
  96. package/dist/types/src/defs/index.d.ts.map +1 -0
  97. package/dist/types/src/{model → defs}/types.d.ts +8 -3
  98. package/dist/types/src/defs/types.d.ts.map +1 -0
  99. package/dist/types/src/defs/types.test.d.ts.map +1 -0
  100. package/dist/types/src/defs/util.d.ts +43 -0
  101. package/dist/types/src/defs/util.d.ts.map +1 -0
  102. package/dist/types/src/extensions/compute.d.ts +5 -0
  103. package/dist/types/src/extensions/compute.d.ts.map +1 -0
  104. package/dist/types/src/extensions/compute.stories.d.ts +26 -0
  105. package/dist/types/src/extensions/compute.stories.d.ts.map +1 -0
  106. package/dist/types/src/extensions/index.d.ts +2 -0
  107. package/dist/types/src/extensions/index.d.ts.map +1 -0
  108. package/dist/types/src/{components/ComputeGraph → graph}/async-function.d.ts +1 -1
  109. package/dist/types/src/graph/async-function.d.ts.map +1 -0
  110. package/dist/types/src/graph/compute-graph.browser.test.d.ts +2 -0
  111. package/dist/types/src/graph/compute-graph.browser.test.d.ts.map +1 -0
  112. package/dist/types/src/graph/compute-graph.d.ts +81 -0
  113. package/dist/types/src/graph/compute-graph.d.ts.map +1 -0
  114. package/dist/types/src/graph/compute-graph.stories.d.ts +10 -0
  115. package/dist/types/src/graph/compute-graph.stories.d.ts.map +1 -0
  116. package/dist/types/src/graph/compute-node.d.ts +19 -0
  117. package/dist/types/src/graph/compute-node.d.ts.map +1 -0
  118. package/dist/types/src/{components/ComputeGraph/custom.d.ts → graph/custom-function.d.ts} +1 -1
  119. package/dist/types/src/graph/custom-function.d.ts.map +1 -0
  120. package/dist/types/src/graph/edge-function.d.ts.map +1 -0
  121. package/dist/types/src/{model/functions.d.ts → graph/function-defs.d.ts} +1 -1
  122. package/dist/types/src/graph/function-defs.d.ts.map +1 -0
  123. package/dist/types/src/graph/hyperformula.test.d.ts +2 -0
  124. package/dist/types/src/graph/hyperformula.test.d.ts.map +1 -0
  125. package/dist/types/src/graph/index.d.ts +4 -0
  126. package/dist/types/src/graph/index.d.ts.map +1 -0
  127. package/dist/types/src/graph/util.d.ts +2 -0
  128. package/dist/types/src/graph/util.d.ts.map +1 -0
  129. package/dist/types/src/hooks/hooks.stories.d.ts +11 -0
  130. package/dist/types/src/hooks/hooks.stories.d.ts.map +1 -0
  131. package/dist/types/src/hooks/index.d.ts +4 -0
  132. package/dist/types/src/hooks/index.d.ts.map +1 -0
  133. package/dist/types/src/hooks/useComputeGraph.d.ts +7 -0
  134. package/dist/types/src/hooks/useComputeGraph.d.ts.map +1 -0
  135. package/dist/types/src/hooks/useFormattingModel.d.ts +3 -0
  136. package/dist/types/src/hooks/useFormattingModel.d.ts.map +1 -0
  137. package/dist/types/src/hooks/useSheetModel.d.ts +8 -0
  138. package/dist/types/src/hooks/useSheetModel.d.ts.map +1 -0
  139. package/dist/types/src/meta.d.ts +1 -4
  140. package/dist/types/src/meta.d.ts.map +1 -1
  141. package/dist/types/src/model/formatting-model.d.ts +16 -0
  142. package/dist/types/src/model/formatting-model.d.ts.map +1 -0
  143. package/dist/types/src/model/index.d.ts +2 -3
  144. package/dist/types/src/model/index.d.ts.map +1 -1
  145. package/dist/types/src/model/{model.d.ts → sheet-model.d.ts} +9 -64
  146. package/dist/types/src/model/sheet-model.d.ts.map +1 -0
  147. package/dist/types/src/sanity.test.d.ts +2 -0
  148. package/dist/types/src/sanity.test.d.ts.map +1 -0
  149. package/dist/types/src/testing/index.d.ts +2 -0
  150. package/dist/types/src/testing/index.d.ts.map +1 -0
  151. package/dist/types/src/testing/testing.d.ts +9 -0
  152. package/dist/types/src/testing/testing.d.ts.map +1 -0
  153. package/dist/types/src/translations.d.ts +17 -12
  154. package/dist/types/src/translations.d.ts.map +1 -1
  155. package/dist/types/src/types.d.ts +83 -3
  156. package/dist/types/src/types.d.ts.map +1 -1
  157. package/dist/vendor/hyperformula.mjs +37145 -0
  158. package/package.json +48 -41
  159. package/src/SheetPlugin.tsx +43 -70
  160. package/src/components/CellEditor/CellEditor.stories.tsx +4 -3
  161. package/src/components/CellEditor/CellEditor.tsx +59 -9
  162. package/src/components/CellEditor/extension.test.ts +4 -5
  163. package/src/components/CellEditor/extension.ts +1 -3
  164. package/src/components/ComputeGraph/ComputeGraphContextProvider.tsx +20 -0
  165. package/src/components/ComputeGraph/index.ts +1 -3
  166. package/src/components/GridSheet/GridSheet.stories.tsx +35 -0
  167. package/src/components/GridSheet/GridSheet.tsx +153 -0
  168. package/src/components/GridSheet/util.ts +89 -0
  169. package/src/components/Sheet/Sheet.stories.tsx +45 -82
  170. package/src/components/Sheet/Sheet.tsx +57 -18
  171. package/src/components/Sheet/decorations.ts +62 -0
  172. package/src/components/Sheet/grid.ts +3 -3
  173. package/src/components/Sheet/nav.ts +19 -19
  174. package/src/components/Sheet/sheet-context.tsx +16 -78
  175. package/src/components/Sheet/threads.tsx +205 -0
  176. package/src/components/SheetContainer.tsx +73 -19
  177. package/src/components/Toolbar/Toolbar.tsx +53 -12
  178. package/src/components/index.ts +1 -0
  179. package/src/defs/index.ts +6 -0
  180. package/src/{model → defs}/types.test.ts +8 -9
  181. package/src/{model → defs}/types.ts +23 -14
  182. package/src/defs/util.ts +135 -0
  183. package/src/extensions/compute.stories.tsx +151 -0
  184. package/src/extensions/compute.ts +98 -0
  185. package/src/extensions/index.ts +5 -0
  186. package/src/{components/ComputeGraph → graph}/async-function.ts +3 -1
  187. package/src/graph/compute-graph.browser.test.ts +104 -0
  188. package/src/graph/compute-graph.stories.tsx +92 -0
  189. package/src/graph/compute-graph.ts +290 -0
  190. package/src/graph/compute-node.ts +51 -0
  191. package/src/{components/ComputeGraph/custom.ts → graph/custom-function.ts} +2 -6
  192. package/src/{components/ComputeGraph → graph}/edge-function.ts +2 -1
  193. package/src/graph/hyperformula.test.ts +15 -0
  194. package/src/graph/index.ts +7 -0
  195. package/src/graph/util.ts +8 -0
  196. package/src/hooks/hooks.stories.tsx +50 -0
  197. package/src/hooks/index.ts +7 -0
  198. package/src/hooks/useComputeGraph.ts +20 -0
  199. package/src/hooks/useFormattingModel.ts +11 -0
  200. package/src/hooks/useSheetModel.ts +43 -0
  201. package/src/meta.tsx +1 -5
  202. package/src/{components/Sheet/formatting.ts → model/formatting-model.ts} +20 -13
  203. package/src/model/index.ts +2 -3
  204. package/src/model/sheet-model.ts +399 -0
  205. package/src/sanity.test.ts +40 -0
  206. package/src/testing/index.ts +5 -0
  207. package/src/testing/testing.tsx +66 -0
  208. package/src/translations.ts +6 -1
  209. package/src/types.ts +30 -5
  210. package/dist/lib/browser/SheetContainer-U4H5D34A.mjs.map +0 -7
  211. package/dist/lib/browser/chunk-APHOLYUB.mjs +0 -175
  212. package/dist/lib/browser/chunk-APHOLYUB.mjs.map +0 -7
  213. package/dist/lib/browser/chunk-D5AGLXJP.mjs.map +0 -7
  214. package/dist/lib/browser/chunk-FUAGSXA4.mjs.map +0 -7
  215. package/dist/lib/browser/chunk-JRL5LGCE.mjs.map +0 -7
  216. package/dist/lib/browser/chunk-NU4PBN33.mjs +0 -8
  217. package/dist/lib/browser/chunk-NU4PBN33.mjs.map +0 -7
  218. package/dist/lib/browser/testing.mjs +0 -92
  219. package/dist/lib/browser/testing.mjs.map +0 -7
  220. package/dist/lib/node/SheetContainer-AXQV3ZT5.cjs.map +0 -7
  221. package/dist/lib/node/chunk-5KKJ4NPP.cjs.map +0 -7
  222. package/dist/lib/node/chunk-BJ6ZD7MN.cjs.map +0 -7
  223. package/dist/lib/node/chunk-CN3RPESU.cjs +0 -202
  224. package/dist/lib/node/chunk-CN3RPESU.cjs.map +0 -7
  225. package/dist/lib/node/chunk-DSYKOI4E.cjs.map +0 -7
  226. package/dist/lib/node/chunk-PYXHNAAK.cjs +0 -40
  227. package/dist/lib/node/chunk-PYXHNAAK.cjs.map +0 -7
  228. package/dist/lib/node/testing.cjs +0 -111
  229. package/dist/lib/node/testing.cjs.map +0 -7
  230. package/dist/types/src/components/ComputeGraph/async-function.d.ts.map +0 -1
  231. package/dist/types/src/components/ComputeGraph/custom.d.ts.map +0 -1
  232. package/dist/types/src/components/ComputeGraph/edge-function.d.ts.map +0 -1
  233. package/dist/types/src/components/ComputeGraph/graph-context.d.ts +0 -12
  234. package/dist/types/src/components/ComputeGraph/graph-context.d.ts.map +0 -1
  235. package/dist/types/src/components/ComputeGraph/graph.browser.test.d.ts +0 -2
  236. package/dist/types/src/components/ComputeGraph/graph.browser.test.d.ts.map +0 -1
  237. package/dist/types/src/components/ComputeGraph/graph.d.ts +0 -26
  238. package/dist/types/src/components/ComputeGraph/graph.d.ts.map +0 -1
  239. package/dist/types/src/components/Sheet/formatting.d.ts +0 -14
  240. package/dist/types/src/components/Sheet/formatting.d.ts.map +0 -1
  241. package/dist/types/src/model/functions.d.ts.map +0 -1
  242. package/dist/types/src/model/model.browser.test.d.ts +0 -2
  243. package/dist/types/src/model/model.browser.test.d.ts.map +0 -1
  244. package/dist/types/src/model/model.d.ts.map +0 -1
  245. package/dist/types/src/model/types.d.ts.map +0 -1
  246. package/dist/types/src/model/types.test.d.ts.map +0 -1
  247. package/dist/types/src/model/util.d.ts +0 -15
  248. package/dist/types/src/model/util.d.ts.map +0 -1
  249. package/dist/types/src/testing.d.ts +0 -9
  250. package/dist/types/src/testing.d.ts.map +0 -1
  251. package/src/components/ComputeGraph/graph-context.tsx +0 -50
  252. package/src/components/ComputeGraph/graph.browser.test.ts +0 -50
  253. package/src/components/ComputeGraph/graph.ts +0 -62
  254. package/src/model/model.browser.test.ts +0 -100
  255. package/src/model/model.ts +0 -550
  256. package/src/model/util.ts +0 -36
  257. package/src/testing.ts +0 -50
  258. /package/dist/types/src/{model → defs}/types.test.d.ts +0 -0
  259. /package/dist/types/src/{components/ComputeGraph → graph}/edge-function.d.ts +0 -0
  260. /package/src/{model/functions.ts → graph/function-defs.ts} +0 -0
package/package.json CHANGED
@@ -1,37 +1,39 @@
1
1
  {
2
2
  "name": "@dxos/plugin-sheet",
3
- "version": "0.6.11",
3
+ "version": "0.6.12-main.15a606f",
4
4
  "description": "Braneframe sketch plugin",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
7
7
  "license": "MIT",
8
8
  "author": "DXOS.org",
9
+ "imports": {
10
+ "#hyperformula": {
11
+ "types": "hyperformula",
12
+ "default": "./dist/vendor/hyperformula.mjs"
13
+ }
14
+ },
9
15
  "exports": {
10
16
  ".": {
11
17
  "browser": "./dist/lib/browser/index.mjs",
12
18
  "node": {
13
- "default": "./dist/lib/node/index.cjs"
19
+ "require": "./dist/lib/node/index.cjs",
20
+ "default": "./dist/lib/node-esm/index.mjs"
14
21
  },
15
22
  "types": "./dist/types/src/index.d.ts"
16
23
  },
17
24
  "./meta": {
18
25
  "browser": "./dist/lib/browser/meta.mjs",
19
26
  "node": {
20
- "default": "./dist/lib/node/meta.cjs"
27
+ "require": "./dist/lib/node/meta.cjs",
28
+ "default": "./dist/lib/node-esm/meta.mjs"
21
29
  },
22
30
  "types": "./dist/types/src/meta.d.ts"
23
31
  },
24
- "./testing": {
25
- "browser": "./dist/lib/browser/testing.mjs",
26
- "node": {
27
- "default": "./dist/lib/node/testing.cjs"
28
- },
29
- "types": "./dist/types/src/testing.d.ts"
30
- },
31
32
  "./types": {
32
33
  "browser": "./dist/lib/browser/types.mjs",
33
34
  "node": {
34
- "default": "./dist/lib/node/types.cjs"
35
+ "require": "./dist/lib/node/types.cjs",
36
+ "default": "./dist/lib/node-esm/types.mjs"
35
37
  },
36
38
  "types": "./dist/types/src/types.d.ts"
37
39
  }
@@ -76,25 +78,29 @@
76
78
  "re-resizable": "^6.9.17",
77
79
  "react-markdown": "^8.0.5",
78
80
  "react-resize-detector": "^11.0.1",
79
- "@dxos/app-framework": "0.6.11",
80
- "@dxos/async": "0.6.11",
81
- "@dxos/context": "0.6.11",
82
- "@dxos/client": "0.6.11",
83
- "@dxos/crypto": "0.6.11",
84
- "@dxos/debug": "0.6.11",
85
- "@dxos/echo-schema": "0.6.11",
86
- "@dxos/invariant": "0.6.11",
87
- "@dxos/keys": "0.6.11",
88
- "@dxos/plugin-client": "0.6.11",
89
- "@dxos/log": "0.6.11",
90
- "@dxos/plugin-graph": "0.6.11",
91
- "@dxos/plugin-script": "0.6.11",
92
- "@dxos/plugin-space": "0.6.11",
93
- "@dxos/plugin-stack": "0.6.11",
94
- "@dxos/react-ui-attention": "0.6.11",
95
- "@dxos/react-client": "0.6.11",
96
- "@dxos/react-ui-editor": "0.6.11",
97
- "@dxos/util": "0.6.11"
81
+ "@dxos/app-framework": "0.6.12-main.15a606f",
82
+ "@dxos/async": "0.6.12-main.15a606f",
83
+ "@dxos/client": "0.6.12-main.15a606f",
84
+ "@dxos/crypto": "0.6.12-main.15a606f",
85
+ "@dxos/context": "0.6.12-main.15a606f",
86
+ "@dxos/debug": "0.6.12-main.15a606f",
87
+ "@dxos/echo-schema": "0.6.12-main.15a606f",
88
+ "@dxos/invariant": "0.6.12-main.15a606f",
89
+ "@dxos/keys": "0.6.12-main.15a606f",
90
+ "@dxos/plugin-attention": "0.6.12-main.15a606f",
91
+ "@dxos/log": "0.6.12-main.15a606f",
92
+ "@dxos/plugin-client": "0.6.12-main.15a606f",
93
+ "@dxos/plugin-graph": "0.6.12-main.15a606f",
94
+ "@dxos/plugin-markdown": "0.6.12-main.15a606f",
95
+ "@dxos/plugin-script": "0.6.12-main.15a606f",
96
+ "@dxos/plugin-space": "0.6.12-main.15a606f",
97
+ "@dxos/react-client": "0.6.12-main.15a606f",
98
+ "@dxos/plugin-stack": "0.6.12-main.15a606f",
99
+ "@dxos/react-hooks": "0.6.12-main.15a606f",
100
+ "@dxos/react-ui-attention": "0.6.12-main.15a606f",
101
+ "@dxos/react-ui-editor": "0.6.12-main.15a606f",
102
+ "@dxos/react-ui-grid": "0.6.12-main.15a606f",
103
+ "@dxos/util": "0.6.12-main.15a606f"
98
104
  },
99
105
  "devDependencies": {
100
106
  "@lezer/generator": "^1.7.1",
@@ -106,20 +112,21 @@
106
112
  "@types/react-window": "^1.8.8",
107
113
  "react": "~18.2.0",
108
114
  "react-dom": "~18.2.0",
109
- "vite": "^5.3.4",
110
- "@dxos/echo-generator": "0.6.11",
111
- "@dxos/random": "0.6.11",
112
- "@dxos/react-ui": "0.6.11",
113
- "@dxos/react-ui-types": "0.6.11",
114
- "@dxos/storybook-utils": "0.6.11",
115
- "@dxos/react-ui-theme": "0.6.11"
115
+ "vite": "5.4.7",
116
+ "@dxos/echo-generator": "0.6.12-main.15a606f",
117
+ "@dxos/random": "0.6.12-main.15a606f",
118
+ "@dxos/react-ui": "0.6.12-main.15a606f",
119
+ "@dxos/react-ui-syntax-highlighter": "0.6.12-main.15a606f",
120
+ "@dxos/react-ui-types": "0.6.12-main.15a606f",
121
+ "@dxos/react-ui-theme": "0.6.12-main.15a606f",
122
+ "@dxos/storybook-utils": "0.6.12-main.15a606f"
116
123
  },
117
124
  "optionalDependencies": {
118
125
  "@phosphor-icons/react": "^2.1.5",
119
- "react": "^18.0.0",
120
- "react-dom": "^18.0.0",
121
- "@dxos/react-ui-theme": "0.6.11",
122
- "@dxos/react-ui": "0.6.11"
126
+ "react": "~18.2.0",
127
+ "react-dom": "~18.2.0",
128
+ "@dxos/react-ui": "0.6.12-main.15a606f",
129
+ "@dxos/react-ui-theme": "0.6.12-main.15a606f"
123
130
  },
124
131
  "publishConfig": {
125
132
  "access": "public"
@@ -2,84 +2,69 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { type IconProps, GridNine } from '@phosphor-icons/react';
5
+ import { GridNine } from '@phosphor-icons/react';
6
6
  import React from 'react';
7
7
 
8
- import {
9
- NavigationAction,
10
- parseIntentPlugin,
11
- resolvePlugin,
12
- type PluginDefinition,
13
- type LayoutCoordinate,
14
- } from '@dxos/app-framework';
15
- import { create } from '@dxos/echo-schema';
8
+ import { NavigationAction, parseIntentPlugin, resolvePlugin, type PluginDefinition } from '@dxos/app-framework';
9
+ import { invariant } from '@dxos/invariant';
16
10
  import { parseClientPlugin } from '@dxos/plugin-client';
17
- import { type ActionGroup, createExtension, isActionGroup } from '@dxos/plugin-graph';
11
+ import { createExtension, isActionGroup, type ActionGroup } from '@dxos/plugin-graph';
18
12
  import { FunctionType } from '@dxos/plugin-script/types';
19
13
  import { SpaceAction } from '@dxos/plugin-space';
20
14
  import { getSpace, isEchoObject } from '@dxos/react-client/echo';
21
15
 
22
- import {
23
- createComputeGraph,
24
- CustomPlugin,
25
- CustomPluginTranslations,
26
- SheetContainer,
27
- type ComputeGraph,
28
- } from './components';
29
- // TODO(wittjosiah): Refactor. These are not exported from ./components due to depending on ECHO.
30
- import { EdgeFunctionPlugin, EdgeFunctionPluginTranslations } from './components/ComputeGraph/edge-function';
31
- import { ComputeGraphContextProvider } from './components/ComputeGraph/graph-context';
16
+ import { ComputeGraphContextProvider, SheetContainer } from './components';
17
+ import { compareIndexPositions, createSheet } from './defs';
18
+ import { type ComputeGraphRegistry } from './graph';
32
19
  import meta, { SHEET_PLUGIN } from './meta';
33
- import { SheetModel } from './model';
34
20
  import translations from './translations';
35
- import { createSheet, SheetAction, type SheetPluginProvides, SheetType } from './types';
21
+ import { SheetAction, SheetType, type SheetPluginProvides } from './types';
36
22
 
37
23
  export const SheetPlugin = (): PluginDefinition<SheetPluginProvides> => {
38
- let remoteFunctionUrl: string | undefined;
39
-
40
- const graphs = create<Record<string, ComputeGraph>>({});
41
- const setGraph = (key: string, graph: ComputeGraph) => {
42
- graphs[key] = graph;
43
- };
24
+ let graphRegistry: ComputeGraphRegistry | undefined;
44
25
 
45
26
  return {
46
27
  meta,
47
28
  ready: async (plugins) => {
48
29
  const client = resolvePlugin(plugins, parseClientPlugin)?.provides.client;
49
- if (!client) {
50
- return;
51
- }
52
-
30
+ invariant(client);
31
+ let remoteFunctionUrl: string | undefined;
53
32
  if (client.config.values.runtime?.services?.edge?.url) {
54
33
  const url = new URL('/functions', client.config.values.runtime?.services?.edge?.url);
55
34
  url.protocol = 'https';
56
35
  remoteFunctionUrl = url.toString();
57
36
  }
37
+
38
+ // Async import removes direct dependency on hyperformula.
39
+ const { createComputeGraphRegistry } = await import('./graph');
40
+ graphRegistry = createComputeGraphRegistry({ remoteFunctionUrl });
58
41
  },
59
42
  provides: {
60
43
  context: ({ children }) => {
61
- return (
62
- <ComputeGraphContextProvider graphs={graphs} setGraph={setGraph}>
63
- {children}
64
- </ComputeGraphContextProvider>
65
- );
44
+ invariant(graphRegistry);
45
+ return <ComputeGraphContextProvider registry={graphRegistry}>{children}</ComputeGraphContextProvider>;
66
46
  },
67
47
  metadata: {
68
48
  records: {
69
49
  [SheetType.typename]: {
70
50
  label: (object: any) => (object instanceof SheetType ? object.title : undefined),
71
51
  placeholder: ['sheet title placeholder', { ns: SHEET_PLUGIN }],
72
- icon: (props: IconProps) => <GridNine {...props} />,
73
- iconSymbol: 'ph--grid-nine--regular',
52
+ icon: 'ph--grid-nine--regular',
74
53
  },
75
54
  },
76
55
  },
77
56
  translations,
78
57
  echo: {
79
58
  // TODO(wittjosiah): Factor out to common package/plugin.
80
- // FunctionType is currently registered here in case script plugin isn't enabled.
59
+ // FunctionType is currently registered here in case script plugin isn't enabled.
81
60
  schema: [SheetType, FunctionType],
82
61
  },
62
+ space: {
63
+ onSpaceCreate: {
64
+ label: ['create sheet label', { ns: SHEET_PLUGIN }],
65
+ action: SheetAction.CREATE,
66
+ },
67
+ },
83
68
  graph: {
84
69
  builder: (plugins) => {
85
70
  const client = resolvePlugin(plugins, parseClientPlugin)?.provides.client;
@@ -113,8 +98,7 @@ export const SheetPlugin = (): PluginDefinition<SheetPluginProvides> => {
113
98
  },
114
99
  properties: {
115
100
  label: ['create sheet label', { ns: SHEET_PLUGIN }],
116
- icon: (props: IconProps) => <GridNine {...props} />,
117
- iconSymbol: 'ph--grid-nine--regular',
101
+ icon: 'ph--grid-nine--regular',
118
102
  testId: 'sheetPlugin.createObject',
119
103
  },
120
104
  },
@@ -123,6 +107,15 @@ export const SheetPlugin = (): PluginDefinition<SheetPluginProvides> => {
123
107
  });
124
108
  },
125
109
  },
110
+ markdown: {
111
+ // TODO(burdon): Construct compute node.
112
+ extensions: ({ document }) => {
113
+ return undefined;
114
+ // return [
115
+ // compute(document)
116
+ // ];
117
+ },
118
+ },
126
119
  stack: {
127
120
  creators: [
128
121
  {
@@ -138,23 +131,19 @@ export const SheetPlugin = (): PluginDefinition<SheetPluginProvides> => {
138
131
  },
139
132
  ],
140
133
  },
134
+ thread: {
135
+ predicate: (data) => data instanceof SheetType,
136
+ createSort: (sheet) => (indexA, indexB) =>
137
+ !indexA || !indexB ? 0 : compareIndexPositions(sheet, indexA, indexB),
138
+ },
141
139
  surface: {
142
- component: ({ data, role = 'never' }) => {
143
- // TODO(burdon): Standardize wrapper (with room for toolbar).
140
+ component: ({ data, role }) => {
144
141
  const space = isEchoObject(data.object) && getSpace(data.object);
145
142
  if (space && data.object instanceof SheetType) {
146
143
  switch (role) {
147
144
  case 'article':
148
145
  case 'section': {
149
- return (
150
- <SheetContainer
151
- sheet={data.object}
152
- space={space}
153
- role={role}
154
- coordinate={data.coordinate as LayoutCoordinate}
155
- remoteFunctionUrl={remoteFunctionUrl}
156
- />
157
- );
146
+ return <SheetContainer sheet={data.object} space={space} role={role} />;
158
147
  }
159
148
  }
160
149
  }
@@ -166,23 +155,7 @@ export const SheetPlugin = (): PluginDefinition<SheetPluginProvides> => {
166
155
  resolver: async (intent) => {
167
156
  switch (intent.action) {
168
157
  case SheetAction.CREATE: {
169
- const space = intent.data?.space;
170
- const sheet = createSheet();
171
- const graph =
172
- graphs[space.id] ??
173
- createComputeGraph(
174
- [
175
- { plugin: EdgeFunctionPlugin, translations: EdgeFunctionPluginTranslations },
176
- // TODO(wittjosiah): Remove. Needed for current test sheet generated data.
177
- { plugin: CustomPlugin, translations: CustomPluginTranslations },
178
- ],
179
- space,
180
- { remoteFunctionUrl },
181
- );
182
- const model = new SheetModel(graph, sheet);
183
- await model.initialize();
184
- await model.destroy();
185
- return { data: sheet };
158
+ return { data: createSheet() };
186
159
  }
187
160
  }
188
161
  },
@@ -4,7 +4,6 @@
4
4
 
5
5
  import '@dxos-theme';
6
6
 
7
- import { HyperFormula } from 'hyperformula';
8
7
  import React, { useEffect, useMemo, useState } from 'react';
9
8
 
10
9
  import { Client } from '@dxos/client';
@@ -12,10 +11,12 @@ import { createDocAccessor, type EchoReactiveObject } from '@dxos/client/echo';
12
11
  import { automerge } from '@dxos/react-ui-editor';
13
12
  import { withTheme } from '@dxos/storybook-utils';
14
13
 
14
+ import { HyperFormula } from '#hyperformula';
15
15
  import { CellEditor, type CellEditorProps } from './CellEditor';
16
16
  import { sheetExtension } from './extension';
17
- import { defaultFunctions } from '../../model';
18
- import { createSheet, SheetType } from '../../types';
17
+ import { createSheet } from '../../defs';
18
+ import { defaultFunctions } from '../../graph';
19
+ import { SheetType } from '../../types';
19
20
 
20
21
  export default {
21
22
  title: 'plugin-sheet/CellEditor',
@@ -14,10 +14,13 @@ import {
14
14
  preventNewline,
15
15
  useTextEditor,
16
16
  } from '@dxos/react-ui-editor';
17
+ import { type GridEditBox } from '@dxos/react-ui-grid';
18
+
19
+ type EditorKeyEvent = Pick<KeyboardEvent<HTMLInputElement>, 'key'> & { shift?: boolean };
17
20
 
18
21
  export type EditorKeysProps = {
19
- onClose: (value: string | undefined) => void;
20
- onNav?: (value: string | undefined, ev: Pick<KeyboardEvent<HTMLInputElement>, 'key'>) => void;
22
+ onClose: (value: string | undefined, event: EditorKeyEvent) => void;
23
+ onNav?: (value: string | undefined, event: EditorKeyEvent) => void;
21
24
  };
22
25
 
23
26
  export const editorKeys = ({ onNav, onClose }: EditorKeysProps): Extension => {
@@ -57,14 +60,29 @@ export const editorKeys = ({ onNav, onClose }: EditorKeysProps): Extension => {
57
60
  {
58
61
  key: 'Enter',
59
62
  run: (editor) => {
60
- onClose(editor.state.doc.toString());
63
+ onClose(editor.state.doc.toString(), { key: 'Enter' });
64
+ return true;
65
+ },
66
+ shift: (editor) => {
67
+ onClose(editor.state.doc.toString(), { key: 'Enter', shift: true });
68
+ return true;
69
+ },
70
+ },
71
+ {
72
+ key: 'Tab',
73
+ run: (editor) => {
74
+ onClose(editor.state.doc.toString(), { key: 'Tab' });
75
+ return true;
76
+ },
77
+ shift: (editor) => {
78
+ onClose(editor.state.doc.toString(), { key: 'Tab', shift: true });
61
79
  return true;
62
80
  },
63
81
  },
64
82
  {
65
83
  key: 'Escape',
66
84
  run: () => {
67
- onClose(undefined);
85
+ onClose(undefined, { key: 'Escape' });
68
86
  return true;
69
87
  },
70
88
  },
@@ -74,10 +92,35 @@ export const editorKeys = ({ onNav, onClose }: EditorKeysProps): Extension => {
74
92
  export type CellEditorProps = {
75
93
  value?: string;
76
94
  extension?: Extension;
95
+ variant?: keyof typeof editorVariants;
96
+ box?: GridEditBox;
97
+ gridId?: string;
77
98
  } & Pick<UseTextEditorProps, 'autoFocus'> &
78
99
  Pick<DOMAttributes<HTMLInputElement>, 'onBlur' | 'onKeyDown'>;
79
100
 
80
- export const CellEditor = ({ value, extension, autoFocus, onBlur }: CellEditorProps) => {
101
+ const editorVariants = {
102
+ // TODO(thure): remove when legacy is no longer used.
103
+ legacy: {
104
+ root: 'flex w-full',
105
+ editor: 'flex w-full [&>.cm-scroller]:scrollbar-none',
106
+ content: '!px-2 !py-1',
107
+ },
108
+ grid: {
109
+ root: 'absolute z-[1]',
110
+ editor: '[&>.cm-scroller]:scrollbar-none tabular-nums',
111
+ content: '!border !border-transparent !p-0.5',
112
+ },
113
+ };
114
+
115
+ export const CellEditor = ({
116
+ value,
117
+ extension,
118
+ autoFocus,
119
+ onBlur,
120
+ variant = 'legacy',
121
+ box,
122
+ gridId,
123
+ }: CellEditorProps) => {
81
124
  const { themeMode } = useThemeContext();
82
125
  const { parentRef } = useTextEditor(() => {
83
126
  return {
@@ -98,16 +141,23 @@ export const CellEditor = ({ value, extension, autoFocus, onBlur }: CellEditorPr
98
141
  themeMode,
99
142
  slots: {
100
143
  editor: {
101
- className: 'flex w-full [&>.cm-scroller]:scrollbar-none',
144
+ className: editorVariants[variant].editor,
102
145
  },
103
146
  content: {
104
- className: '!px-2 !py-1',
147
+ className: editorVariants[variant].content,
105
148
  },
106
149
  },
107
150
  }),
108
151
  ],
109
152
  };
110
- }, [extension]);
153
+ }, [extension, autoFocus, value, variant, onBlur]);
111
154
 
112
- return <div ref={parentRef} className='flex w-full' />;
155
+ return (
156
+ <div
157
+ ref={parentRef}
158
+ className={editorVariants[variant].root}
159
+ style={box}
160
+ {...(gridId && { 'data-grid': gridId })}
161
+ />
162
+ );
113
163
  };
@@ -6,12 +6,11 @@ import { CompletionContext, type CompletionSource } from '@codemirror/autocomple
6
6
  import { EditorState } from '@codemirror/state';
7
7
  // @ts-ignore
8
8
  import { testTree } from '@lezer/generator/test';
9
- import { expect } from 'chai';
10
9
  import { spreadsheet } from 'codemirror-lang-spreadsheet';
11
- import { describe, test } from 'vitest';
10
+ import { describe, expect, test } from 'vitest';
12
11
 
13
12
  import { sheetExtension } from './extension';
14
- import { defaultFunctions } from '../../model/functions';
13
+ import { defaultFunctions } from '../../graph';
15
14
 
16
15
  describe('formula parser', () => {
17
16
  const {
@@ -37,8 +36,8 @@ describe('formula parser', () => {
37
36
  extensions: sheetExtension({ functions }),
38
37
  });
39
38
 
40
- const [f] = state.languageDataAt<CompletionSource>('autocomplete', text.length);
41
- const result = await f(new CompletionContext(state, text.length, true));
39
+ const [fn] = state.languageDataAt<CompletionSource>('autocomplete', text.length);
40
+ const result = await fn(new CompletionContext(state, text.length, true));
42
41
  expect(result?.options).to.have.length(1);
43
42
  });
44
43
  });
@@ -20,7 +20,7 @@ import { spreadsheet } from 'codemirror-lang-spreadsheet';
20
20
 
21
21
  import { mx } from '@dxos/react-ui-theme';
22
22
 
23
- import { type FunctionDefinition } from '../../model';
23
+ import { type FunctionDefinition } from '../../graph';
24
24
 
25
25
  /**
26
26
  * https://codemirror.net/examples/styling
@@ -165,8 +165,6 @@ export const sheetExtension = ({ functions = [] }: SheetExtensionOptions): Exten
165
165
  icons: false,
166
166
  tooltipClass: () =>
167
167
  mx(
168
- // TODO(burdon): Factor out fragments.
169
- // TODO(burdon): Size to make width same as column.
170
168
  '!-left-[1px] !top-[33px] !-m-0 border !border-t-0 [&>ul]:!min-w-[198px]',
171
169
  '[&>ul>li[aria-selected]]:!bg-accentSurface',
172
170
  'border-separator',
@@ -0,0 +1,20 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import React, { createContext, type PropsWithChildren } from 'react';
6
+
7
+ import { type ComputeGraphRegistry } from '../../graph';
8
+
9
+ export type ComputeGraphContextType = {
10
+ registry: ComputeGraphRegistry;
11
+ };
12
+
13
+ /**
14
+ * The compute graph context manages a ComputeGraph for each space.
15
+ */
16
+ export const ComputeGraphContext = createContext<ComputeGraphContextType | undefined>(undefined);
17
+
18
+ export const ComputeGraphContextProvider = ({ registry, children }: PropsWithChildren<ComputeGraphContextType>) => {
19
+ return <ComputeGraphContext.Provider value={{ registry }}>{children}</ComputeGraphContext.Provider>;
20
+ };
@@ -2,6 +2,4 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- export * from './async-function';
6
- export * from './custom';
7
- export * from './graph';
5
+ export * from './ComputeGraphContextProvider';
@@ -0,0 +1,35 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import React from 'react';
6
+
7
+ import { useSpace } from '@dxos/react-client/echo';
8
+ import { withClientProvider } from '@dxos/react-client/testing';
9
+ import { withTheme, withLayout } from '@dxos/storybook-utils';
10
+
11
+ import { GridSheet } from './GridSheet';
12
+ import { useComputeGraph } from '../../hooks';
13
+ import { useTestSheet, withGraphDecorator } from '../../testing';
14
+
15
+ export default {
16
+ title: 'plugin-sheet/GridSheet',
17
+ component: GridSheet,
18
+ decorators: [
19
+ withClientProvider({ createSpace: true }),
20
+ withGraphDecorator,
21
+ withTheme,
22
+ withLayout({ fullscreen: true, tooltips: true }),
23
+ ],
24
+ };
25
+
26
+ export const Basic = () => {
27
+ const space = useSpace();
28
+ const graph = useComputeGraph(space);
29
+ const sheet = useTestSheet(space, graph);
30
+ if (!sheet || !space) {
31
+ return null;
32
+ }
33
+
34
+ return <GridSheet space={space} sheet={sheet} />;
35
+ };