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

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 (266) 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-QILRZNE5.mjs → chunk-D3QTX46O.mjs} +4 -5
  6. package/dist/lib/browser/chunk-D3QTX46O.mjs.map +7 -0
  7. package/dist/lib/browser/{chunk-T3NJFTD4.mjs → chunk-GKI67SEF.mjs} +20 -26
  8. package/dist/lib/browser/chunk-GKI67SEF.mjs.map +7 -0
  9. package/dist/lib/browser/{chunk-6ZMQVB4Z.mjs → chunk-GSV5QNLD.mjs} +220 -177
  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/index.mjs +41 -22
  13. package/dist/lib/browser/index.mjs.map +3 -3
  14. package/dist/lib/browser/meta.json +1 -1
  15. package/dist/lib/browser/meta.mjs +1 -1
  16. package/dist/lib/browser/types.mjs +4 -8
  17. package/dist/lib/node/SheetContainer-YSQGJD7K.cjs +276 -0
  18. package/dist/lib/node/SheetContainer-YSQGJD7K.cjs.map +7 -0
  19. package/dist/lib/node/{chunk-DD6FIXWC.cjs → chunk-5XPK2V4A.cjs} +222 -175
  20. package/dist/lib/node/chunk-5XPK2V4A.cjs.map +7 -0
  21. package/dist/lib/node/chunk-6F43RV45.cjs +1610 -0
  22. package/dist/lib/node/chunk-6F43RV45.cjs.map +7 -0
  23. package/dist/lib/node/{chunk-Q3HBHPRL.cjs → chunk-ER3PM7GD.cjs} +26 -34
  24. package/dist/lib/node/chunk-ER3PM7GD.cjs.map +7 -0
  25. package/dist/lib/node/{chunk-BNARJ5GM.cjs → chunk-QIFIGEKV.cjs} +6 -7
  26. package/dist/lib/node/chunk-QIFIGEKV.cjs.map +7 -0
  27. package/dist/lib/node/graph-Q3N2X26H.cjs +55 -0
  28. package/dist/lib/node/graph-Q3N2X26H.cjs.map +7 -0
  29. package/dist/lib/node/index.cjs +61 -44
  30. package/dist/lib/node/index.cjs.map +3 -3
  31. package/dist/lib/node/meta.cjs +3 -3
  32. package/dist/lib/node/meta.cjs.map +1 -1
  33. package/dist/lib/node/meta.json +1 -1
  34. package/dist/lib/node/types.cjs +8 -12
  35. package/dist/lib/node/types.cjs.map +2 -2
  36. package/dist/lib/node-esm/SheetContainer-M7WRMZDU.mjs +266 -0
  37. package/dist/lib/node-esm/SheetContainer-M7WRMZDU.mjs.map +7 -0
  38. package/dist/lib/node-esm/{chunk-D6KU5MI7.mjs → chunk-5WPZCXNS.mjs} +220 -177
  39. package/dist/lib/node-esm/chunk-5WPZCXNS.mjs.map +7 -0
  40. package/dist/lib/node-esm/chunk-ELTFPX5B.mjs +1615 -0
  41. package/dist/lib/node-esm/chunk-ELTFPX5B.mjs.map +7 -0
  42. package/dist/lib/node-esm/{chunk-IU2L277A.mjs → chunk-VCYJWE3O.mjs} +4 -5
  43. package/dist/lib/node-esm/chunk-VCYJWE3O.mjs.map +7 -0
  44. package/dist/lib/node-esm/{chunk-BMNA27EX.mjs → chunk-ZVLLQ2PJ.mjs} +20 -26
  45. package/dist/lib/node-esm/chunk-ZVLLQ2PJ.mjs.map +7 -0
  46. package/dist/lib/node-esm/graph-SMPUMOV2.mjs +34 -0
  47. package/dist/lib/node-esm/index.mjs +41 -22
  48. package/dist/lib/node-esm/index.mjs.map +3 -3
  49. package/dist/lib/node-esm/meta.json +1 -1
  50. package/dist/lib/node-esm/meta.mjs +1 -1
  51. package/dist/lib/node-esm/types.mjs +4 -8
  52. package/dist/types/src/SheetPlugin.d.ts.map +1 -1
  53. package/dist/types/src/components/FunctionEditor/FunctionEditor.d.ts +3 -0
  54. package/dist/types/src/components/FunctionEditor/FunctionEditor.d.ts.map +1 -0
  55. package/dist/types/src/components/FunctionEditor/index.d.ts +2 -0
  56. package/dist/types/src/components/FunctionEditor/index.d.ts.map +1 -0
  57. package/dist/types/src/components/GridSheet/GridSheet.d.ts +1 -8
  58. package/dist/types/src/components/GridSheet/GridSheet.d.ts.map +1 -1
  59. package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts +1 -1
  60. package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +1 -1
  61. package/dist/types/src/components/{CellEditor/CellEditor.stories.d.ts → GridSheet/SheetCellEditor.stories.d.ts} +2 -2
  62. package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts.map +1 -0
  63. package/dist/types/src/components/GridSheet/index.d.ts +2 -0
  64. package/dist/types/src/components/GridSheet/index.d.ts.map +1 -0
  65. package/dist/types/src/components/GridSheet/util.d.ts +13 -3
  66. package/dist/types/src/components/GridSheet/util.d.ts.map +1 -1
  67. package/dist/types/src/components/SheetContainer/SheetContainer.d.ts +6 -0
  68. package/dist/types/src/components/SheetContainer/SheetContainer.d.ts.map +1 -0
  69. package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts +11 -0
  70. package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +1 -0
  71. package/dist/types/src/components/SheetContainer/index.d.ts +3 -0
  72. package/dist/types/src/components/SheetContainer/index.d.ts.map +1 -0
  73. package/dist/types/src/components/SheetContext/SheetContext.d.ts +27 -0
  74. package/dist/types/src/components/SheetContext/SheetContext.d.ts.map +1 -0
  75. package/dist/types/src/components/SheetContext/index.d.ts +2 -0
  76. package/dist/types/src/components/SheetContext/index.d.ts.map +1 -0
  77. package/dist/types/src/components/Toolbar/Toolbar.d.ts +31 -17
  78. package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
  79. package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +1 -1
  80. package/dist/types/src/components/index.d.ts +3 -2
  81. package/dist/types/src/components/index.d.ts.map +1 -1
  82. package/dist/types/src/defs/types.d.ts.map +1 -1
  83. package/dist/types/src/defs/util.d.ts +1 -1
  84. package/dist/types/src/defs/util.d.ts.map +1 -1
  85. package/dist/types/src/extensions/compute.d.ts +3 -2
  86. package/dist/types/src/extensions/compute.d.ts.map +1 -1
  87. package/dist/types/src/extensions/compute.stories.d.ts.map +1 -1
  88. package/dist/types/src/extensions/editor/extension.d.ts.map +1 -0
  89. package/dist/types/src/extensions/editor/extension.test.d.ts.map +1 -0
  90. package/dist/types/src/extensions/editor/index.d.ts +2 -0
  91. package/dist/types/src/extensions/editor/index.d.ts.map +1 -0
  92. package/dist/types/src/extensions/index.d.ts +1 -0
  93. package/dist/types/src/extensions/index.d.ts.map +1 -1
  94. package/dist/types/src/graph/compute-graph-registry.d.ts +34 -0
  95. package/dist/types/src/graph/compute-graph-registry.d.ts.map +1 -0
  96. package/dist/types/src/graph/compute-graph.d.ts +17 -34
  97. package/dist/types/src/graph/compute-graph.d.ts.map +1 -1
  98. package/dist/types/src/graph/compute-graph.stories.d.ts.map +1 -1
  99. package/dist/types/src/graph/compute-graph.test.d.ts +2 -0
  100. package/dist/types/src/graph/compute-graph.test.d.ts.map +1 -0
  101. package/dist/types/src/graph/compute-node.d.ts +9 -2
  102. package/dist/types/src/graph/compute-node.d.ts.map +1 -1
  103. package/dist/types/src/graph/{async-function.d.ts → functions/async-function.d.ts} +13 -4
  104. package/dist/types/src/graph/functions/async-function.d.ts.map +1 -0
  105. package/dist/types/src/graph/functions/edge-function.d.ts +21 -0
  106. package/dist/types/src/graph/functions/edge-function.d.ts.map +1 -0
  107. package/dist/types/src/graph/functions/function-defs.d.ts.map +1 -0
  108. package/dist/types/src/graph/functions/index.d.ts +4 -0
  109. package/dist/types/src/graph/functions/index.d.ts.map +1 -0
  110. package/dist/types/src/graph/index.d.ts +2 -1
  111. package/dist/types/src/graph/index.d.ts.map +1 -1
  112. package/dist/types/src/graph/testing/index.d.ts +3 -0
  113. package/dist/types/src/graph/testing/index.d.ts.map +1 -0
  114. package/dist/types/src/graph/testing/test-builder.d.ts +15 -0
  115. package/dist/types/src/graph/testing/test-builder.d.ts.map +1 -0
  116. package/dist/types/src/graph/testing/test-plugin.d.ts +36 -0
  117. package/dist/types/src/graph/testing/test-plugin.d.ts.map +1 -0
  118. package/dist/types/src/hooks/index.d.ts +1 -0
  119. package/dist/types/src/hooks/index.d.ts.map +1 -1
  120. package/dist/types/src/hooks/threads.d.ts +8 -0
  121. package/dist/types/src/hooks/threads.d.ts.map +1 -0
  122. package/dist/types/src/hooks/useComputeGraph.d.ts.map +1 -1
  123. package/dist/types/src/hooks/useSheetModel.d.ts +2 -2
  124. package/dist/types/src/hooks/useSheetModel.d.ts.map +1 -1
  125. package/dist/types/src/meta.d.ts +3 -6
  126. package/dist/types/src/meta.d.ts.map +1 -1
  127. package/dist/types/src/{components/Sheet → model}/decorations.d.ts +1 -0
  128. package/dist/types/src/model/decorations.d.ts.map +1 -0
  129. package/dist/types/src/model/formatting-model.d.ts +3 -0
  130. package/dist/types/src/model/formatting-model.d.ts.map +1 -1
  131. package/dist/types/src/model/index.d.ts +1 -0
  132. package/dist/types/src/model/index.d.ts.map +1 -1
  133. package/dist/types/src/model/sheet-model.d.ts +6 -5
  134. package/dist/types/src/model/sheet-model.d.ts.map +1 -1
  135. package/dist/types/src/model/sheet-model.test.d.ts +2 -0
  136. package/dist/types/src/model/sheet-model.test.d.ts.map +1 -0
  137. package/dist/types/src/testing/testing.d.ts +4 -5
  138. package/dist/types/src/testing/testing.d.ts.map +1 -1
  139. package/dist/types/src/types.d.ts +17 -31
  140. package/dist/types/src/types.d.ts.map +1 -1
  141. package/package.json +42 -41
  142. package/src/SheetPlugin.tsx +22 -17
  143. package/src/components/FunctionEditor/FunctionEditor.tsx +45 -0
  144. package/src/components/FunctionEditor/index.ts +5 -0
  145. package/src/components/GridSheet/GridSheet.stories.tsx +11 -5
  146. package/src/components/GridSheet/GridSheet.tsx +78 -70
  147. package/src/components/{CellEditor/CellEditor.stories.tsx → GridSheet/SheetCellEditor.stories.tsx} +4 -5
  148. package/src/components/{Sheet → GridSheet}/index.ts +1 -1
  149. package/src/components/GridSheet/util.ts +94 -39
  150. package/src/components/SheetContainer/SheetContainer.stories.tsx +40 -0
  151. package/src/components/SheetContainer/SheetContainer.tsx +52 -0
  152. package/src/components/SheetContainer/index.ts +7 -0
  153. package/src/components/{Sheet/sheet-context.tsx → SheetContext/SheetContext.tsx} +48 -28
  154. package/src/components/SheetContext/index.ts +5 -0
  155. package/src/components/Toolbar/Toolbar.tsx +127 -86
  156. package/src/components/index.ts +2 -1
  157. package/src/defs/types.ts +1 -0
  158. package/src/defs/util.ts +20 -4
  159. package/src/extensions/compute.stories.tsx +23 -23
  160. package/src/extensions/compute.ts +91 -42
  161. package/src/{components/CellEditor → extensions/editor}/extension.test.ts +0 -1
  162. package/src/{components/CellEditor → extensions/editor}/extension.ts +4 -3
  163. package/src/{components/CellEditor → extensions/editor}/index.ts +0 -1
  164. package/src/extensions/index.ts +1 -0
  165. package/src/graph/compute-graph-registry.ts +90 -0
  166. package/src/graph/compute-graph.stories.tsx +4 -3
  167. package/src/graph/compute-graph.test.ts +87 -0
  168. package/src/graph/compute-graph.ts +73 -121
  169. package/src/graph/compute-node.ts +17 -5
  170. package/src/graph/{async-function.ts → functions/async-function.ts} +23 -15
  171. package/src/graph/{edge-function.ts → functions/edge-function.ts} +14 -13
  172. package/src/graph/functions/index.ts +7 -0
  173. package/src/graph/hyperformula.test.ts +1 -2
  174. package/src/graph/index.ts +2 -1
  175. package/src/graph/testing/index.ts +6 -0
  176. package/src/graph/testing/test-builder.ts +54 -0
  177. package/src/graph/{custom-function.ts → testing/test-plugin.ts} +43 -9
  178. package/src/hooks/hooks.stories.tsx +3 -3
  179. package/src/hooks/index.ts +1 -0
  180. package/src/{components/Sheet/threads.tsx → hooks/threads.ts} +26 -84
  181. package/src/hooks/useComputeGraph.ts +9 -1
  182. package/src/hooks/useSheetModel.ts +4 -7
  183. package/src/{meta.tsx → meta.ts} +3 -3
  184. package/src/{components/Sheet → model}/decorations.ts +2 -0
  185. package/src/model/formatting-model.ts +12 -9
  186. package/src/model/index.ts +1 -0
  187. package/src/model/sheet-model.test.ts +57 -0
  188. package/src/model/sheet-model.ts +60 -41
  189. package/src/testing/testing.tsx +17 -15
  190. package/src/types.ts +12 -38
  191. package/dist/lib/browser/SheetContainer-V4GCCZTX.mjs +0 -261
  192. package/dist/lib/browser/SheetContainer-V4GCCZTX.mjs.map +0 -7
  193. package/dist/lib/browser/chunk-6ZMQVB4Z.mjs.map +0 -7
  194. package/dist/lib/browser/chunk-QILRZNE5.mjs.map +0 -7
  195. package/dist/lib/browser/chunk-T3NJFTD4.mjs.map +0 -7
  196. package/dist/lib/browser/chunk-U2JHW3L6.mjs +0 -2552
  197. package/dist/lib/browser/chunk-U2JHW3L6.mjs.map +0 -7
  198. package/dist/lib/browser/graph-T27BOBOV.mjs +0 -21
  199. package/dist/lib/node/SheetContainer-3ZY7MPWJ.cjs +0 -279
  200. package/dist/lib/node/SheetContainer-3ZY7MPWJ.cjs.map +0 -7
  201. package/dist/lib/node/chunk-BNARJ5GM.cjs.map +0 -7
  202. package/dist/lib/node/chunk-DD6FIXWC.cjs.map +0 -7
  203. package/dist/lib/node/chunk-OTTD7FBK.cjs +0 -2536
  204. package/dist/lib/node/chunk-OTTD7FBK.cjs.map +0 -7
  205. package/dist/lib/node/chunk-Q3HBHPRL.cjs.map +0 -7
  206. package/dist/lib/node/graph-SPKGX7W4.cjs +0 -43
  207. package/dist/lib/node/graph-SPKGX7W4.cjs.map +0 -7
  208. package/dist/lib/node-esm/SheetContainer-PXSJX6XK.mjs +0 -262
  209. package/dist/lib/node-esm/SheetContainer-PXSJX6XK.mjs.map +0 -7
  210. package/dist/lib/node-esm/chunk-7HVSOTGA.mjs +0 -2553
  211. package/dist/lib/node-esm/chunk-7HVSOTGA.mjs.map +0 -7
  212. package/dist/lib/node-esm/chunk-BMNA27EX.mjs.map +0 -7
  213. package/dist/lib/node-esm/chunk-D6KU5MI7.mjs.map +0 -7
  214. package/dist/lib/node-esm/chunk-IU2L277A.mjs.map +0 -7
  215. package/dist/lib/node-esm/graph-U67IO4UC.mjs +0 -22
  216. package/dist/types/src/components/CellEditor/CellEditor.d.ts +0 -34
  217. package/dist/types/src/components/CellEditor/CellEditor.d.ts.map +0 -1
  218. package/dist/types/src/components/CellEditor/CellEditor.stories.d.ts.map +0 -1
  219. package/dist/types/src/components/CellEditor/extension.d.ts.map +0 -1
  220. package/dist/types/src/components/CellEditor/extension.test.d.ts.map +0 -1
  221. package/dist/types/src/components/CellEditor/index.d.ts +0 -3
  222. package/dist/types/src/components/CellEditor/index.d.ts.map +0 -1
  223. package/dist/types/src/components/Sheet/Sheet.d.ts +0 -55
  224. package/dist/types/src/components/Sheet/Sheet.d.ts.map +0 -1
  225. package/dist/types/src/components/Sheet/Sheet.stories.d.ts +0 -53
  226. package/dist/types/src/components/Sheet/Sheet.stories.d.ts.map +0 -1
  227. package/dist/types/src/components/Sheet/decorations.d.ts.map +0 -1
  228. package/dist/types/src/components/Sheet/grid.d.ts +0 -52
  229. package/dist/types/src/components/Sheet/grid.d.ts.map +0 -1
  230. package/dist/types/src/components/Sheet/index.d.ts +0 -2
  231. package/dist/types/src/components/Sheet/index.d.ts.map +0 -1
  232. package/dist/types/src/components/Sheet/nav.d.ts +0 -29
  233. package/dist/types/src/components/Sheet/nav.d.ts.map +0 -1
  234. package/dist/types/src/components/Sheet/sheet-context.d.ts +0 -26
  235. package/dist/types/src/components/Sheet/sheet-context.d.ts.map +0 -1
  236. package/dist/types/src/components/Sheet/threads.d.ts +0 -2
  237. package/dist/types/src/components/Sheet/threads.d.ts.map +0 -1
  238. package/dist/types/src/components/Sheet/util.d.ts +0 -18
  239. package/dist/types/src/components/Sheet/util.d.ts.map +0 -1
  240. package/dist/types/src/components/SheetContainer.d.ts +0 -8
  241. package/dist/types/src/components/SheetContainer.d.ts.map +0 -1
  242. package/dist/types/src/components/Toolbar/common.d.ts +0 -20
  243. package/dist/types/src/components/Toolbar/common.d.ts.map +0 -1
  244. package/dist/types/src/graph/async-function.d.ts.map +0 -1
  245. package/dist/types/src/graph/compute-graph.browser.test.d.ts +0 -2
  246. package/dist/types/src/graph/compute-graph.browser.test.d.ts.map +0 -1
  247. package/dist/types/src/graph/custom-function.d.ts +0 -21
  248. package/dist/types/src/graph/custom-function.d.ts.map +0 -1
  249. package/dist/types/src/graph/edge-function.d.ts +0 -20
  250. package/dist/types/src/graph/edge-function.d.ts.map +0 -1
  251. package/dist/types/src/graph/function-defs.d.ts.map +0 -1
  252. package/src/components/CellEditor/CellEditor.tsx +0 -163
  253. package/src/components/Sheet/Sheet.stories.tsx +0 -250
  254. package/src/components/Sheet/Sheet.tsx +0 -1199
  255. package/src/components/Sheet/grid.ts +0 -191
  256. package/src/components/Sheet/nav.ts +0 -157
  257. package/src/components/Sheet/util.ts +0 -56
  258. package/src/components/SheetContainer.tsx +0 -88
  259. package/src/components/Toolbar/common.tsx +0 -72
  260. package/src/graph/compute-graph.browser.test.ts +0 -104
  261. /package/dist/lib/browser/{graph-T27BOBOV.mjs.map → graph-M4IQ76QX.mjs.map} +0 -0
  262. /package/dist/lib/node-esm/{graph-U67IO4UC.mjs.map → graph-SMPUMOV2.mjs.map} +0 -0
  263. /package/dist/types/src/{components/CellEditor → extensions/editor}/extension.d.ts +0 -0
  264. /package/dist/types/src/{components/CellEditor → extensions/editor}/extension.test.d.ts +0 -0
  265. /package/dist/types/src/graph/{function-defs.d.ts → functions/function-defs.d.ts} +0 -0
  266. /package/src/graph/{function-defs.ts → functions/function-defs.ts} +0 -0
@@ -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,YAAY,CAAC;AAK1G,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,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC;AAE/E,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 '../../defs';
3
- export type GridSize = {
4
- numRows: number;
5
- numCols: 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, numCols }: 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,YAAY,CAAC;AAEzE,MAAM,MAAM,QAAQ,GAAG;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,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,wBACT,QAAQ,KAC7B,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,26 +0,0 @@
1
- import React, { type PropsWithChildren } from 'react';
2
- import { type Space } from '@dxos/react-client/echo';
3
- import { createDecorations } from './decorations';
4
- import { type CellAddress, type CellRange } from '../../defs';
5
- import { type FormattingModel, type SheetModel } from '../../model';
6
- import { type SheetType } from '../../types';
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
- decorations: ReturnType<typeof createDecorations>;
18
- };
19
- export declare const useSheetContext: () => SheetContextType;
20
- export type SheetContextProps = {
21
- sheet: SheetType;
22
- space: Space;
23
- readonly?: boolean;
24
- } & Pick<SheetContextType, 'onInfo'>;
25
- export declare const SheetContextProvider: ({ children, sheet, space, readonly, onInfo, }: PropsWithChildren<SheetContextProps>) => React.JSX.Element | null;
26
- //# 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"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAgD,MAAM,OAAO,CAAC;AAGpG,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAE9D,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,UAAU,CAAC;IAClB,UAAU,EAAE,eAAe,CAAC;IAI5B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,SAAS,EAAE,CAAC,IAAI,EAAE,WAAW,GAAG,SAAS,KAAK,IAAI,CAAC;IACnD,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,KAAK,IAAI,CAAC;IAGjD,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAIvC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IAGpB,WAAW,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;CACnD,CAAC;AAIF,eAAO,MAAM,eAAe,QAAO,gBAIlC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,GAAG,IAAI,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;AAErC,eAAO,MAAM,oBAAoB,kDAM9B,iBAAiB,CAAC,iBAAiB,CAAC,6BA6BtC,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare const useThreads: () => void;
2
- //# sourceMappingURL=threads.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"threads.d.ts","sourceRoot":"","sources":["../../../../../src/components/Sheet/threads.tsx"],"names":[],"mappings":"AAwMA,eAAO,MAAM,UAAU,YAItB,CAAC"}
@@ -1,18 +0,0 @@
1
- /**
2
- * 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,8 +0,0 @@
1
- import React from 'react';
2
- import { type SheetRootProps } from './Sheet';
3
- export declare const sectionToolbarLayout = "bs-[--rail-action] bg-[--sticky-bg] sticky block-start-0 __-block-start-px transition-opacity";
4
- declare const SheetContainer: ({ sheet, space, role }: SheetRootProps & {
5
- role?: string;
6
- }) => React.JSX.Element;
7
- export default SheetContainer;
8
- //# 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,KAAsB,MAAM,OAAO,CAAC;AAO3C,OAAO,EAAS,KAAK,cAAc,EAAE,MAAM,SAAS,CAAC;AAUrD,eAAO,MAAM,oBAAoB,kGACgE,CAAC;AAElG,QAAA,MAAM,cAAc,2BAA4B,cAAc,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,sBA6DjF,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":"async-function.d.ts","sourceRoot":"","sources":["../../../../src/graph/async-function.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,mDAAmD,CAAC;AAC1F,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,mDAAmD,CAAC;AAC1F,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAGhE,OAAO,EAAY,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAG/C,OAAO,EAAoC,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AASpG,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAExE,MAAM,MAAM,eAAe,GAAG;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,sBAI3C,CAAC;AAEF;;;;;;;GAOG;AACH,qBAAa,eAAe;IAuBxB,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAtBzB,MAAM,CAAC,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG;IAMrD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA8D;IAGrF,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA6B;IAGtD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA0C;IAGzE,OAAO,CAAC,YAAY,CAA8B;IAElD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAyB;IAClD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAa;gBAGpB,GAAG,EAAE,YAAY,EACjB,MAAM,EAAE,KAAK,GAAG,SAAS,EAC1C,QAAQ,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,IAAI,EAC5C,QAAQ,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC;IAY5C,IAAI,KAAK,sBAER;IAED,IAAI,iBAAiB,WAEpB;IAED,IAAI,IAAI;;;MAEP;IAED,KAAK;IAOL,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,mBAAmB;IAKjE;;;OAGG;IACH,cAAc,CACZ,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,gBAAgB,EACvB,IAAI,EAAE,GAAG,EAAE,EACX,EAAE,EAAE,aAAa,EACjB,OAAO,CAAC,EAAE,eAAe,GACxB,gBAAgB,GAAG,SAAS;CAgChC;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,cAAc;IACrD,IAAI,OAAO,IACqB,eAAe,CAC9C;IAED,gBAAgB,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB,EAAE,EAAE,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,eAAe;CAO1G"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=compute-graph.browser.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compute-graph.browser.test.d.ts","sourceRoot":"","sources":["../../../../src/graph/compute-graph.browser.test.ts"],"names":[],"mappings":""}
@@ -1,21 +0,0 @@
1
- import { type InterpreterState } from 'hyperformula/typings/interpreter/InterpreterState';
2
- import { type ProcedureAst } from 'hyperformula/typings/parser';
3
- import { FunctionPluginAsync } from './async-function';
4
- /**
5
- * https://hyperformula.handsontable.com/guide/custom-functions.html#add-a-simple-custom-function
6
- */
7
- export declare class CustomPlugin extends FunctionPluginAsync {
8
- test(ast: ProcedureAst, state: InterpreterState): import("hyperformula/typings/interpreter/InterpreterValue").RawInterpreterValue;
9
- crypto(ast: ProcedureAst, state: InterpreterState): import("hyperformula/typings/interpreter/InterpreterValue").RawInterpreterValue;
10
- }
11
- export declare const CustomPluginTranslations: {
12
- enGB: {
13
- TEST: string;
14
- CRYPTO: string;
15
- };
16
- enUS: {
17
- TEST: string;
18
- CRYPTO: string;
19
- };
20
- };
21
- //# sourceMappingURL=custom-function.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"custom-function.d.ts","sourceRoot":"","sources":["../../../../src/graph/custom-function.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,mDAAmD,CAAC;AAC1F,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAKhE,OAAO,EAAsB,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAG3E;;GAEG;AACH,qBAAa,YAAa,SAAQ,mBAAmB;IACnD,IAAI,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB;IAQ/C,MAAM,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB;CAelD;AAgBD,eAAO,MAAM,wBAAwB;;;;;;;;;CASpC,CAAC"}
@@ -1,20 +0,0 @@
1
- import { type InterpreterState } from 'hyperformula/typings/interpreter/InterpreterState';
2
- import { type ProcedureAst } from 'hyperformula/typings/parser';
3
- import { FunctionPluginAsync } from './async-function';
4
- /**
5
- * A hyperformula function plugin for calling EDGE functions.
6
- *
7
- * https://hyperformula.handsontable.com/guide/custom-functions.html#add-a-simple-custom-function
8
- */
9
- export declare class EdgeFunctionPlugin extends FunctionPluginAsync {
10
- edge(ast: ProcedureAst, state: InterpreterState): import("hyperformula/typings/interpreter/InterpreterValue").RawInterpreterValue;
11
- }
12
- export declare const EdgeFunctionPluginTranslations: {
13
- enGB: {
14
- EDGE: string;
15
- };
16
- enUS: {
17
- EDGE: string;
18
- };
19
- };
20
- //# sourceMappingURL=edge-function.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"edge-function.d.ts","sourceRoot":"","sources":["../../../../src/graph/edge-function.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,mDAAmD,CAAC;AAC1F,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAShE,OAAO,EAAsB,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAI3E;;;;GAIG;AACH,qBAAa,kBAAmB,SAAQ,mBAAmB;IACzD,IAAI,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB;CA0ChD;AAwBD,eAAO,MAAM,8BAA8B;;;;;;;CAO1C,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"function-defs.d.ts","sourceRoot":"","sources":["../../../../src/graph/function-defs.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,163 +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
- import { type GridEditBox } from '@dxos/react-ui-grid';
18
-
19
- type EditorKeyEvent = Pick<KeyboardEvent<HTMLInputElement>, 'key'> & { shift?: boolean };
20
-
21
- export type EditorKeysProps = {
22
- onClose: (value: string | undefined, event: EditorKeyEvent) => void;
23
- onNav?: (value: string | undefined, event: EditorKeyEvent) => void;
24
- };
25
-
26
- export const editorKeys = ({ onNav, onClose }: EditorKeysProps): Extension => {
27
- return keymap.of([
28
- {
29
- key: 'ArrowUp',
30
- run: (editor) => {
31
- const value = editor.state.doc.toString();
32
- onNav?.(value, { key: 'ArrowUp' });
33
- return !!onNav;
34
- },
35
- },
36
- {
37
- key: 'ArrowDown',
38
- run: (editor) => {
39
- const value = editor.state.doc.toString();
40
- onNav?.(value, { key: 'ArrowDown' });
41
- return !!onNav;
42
- },
43
- },
44
- {
45
- key: 'ArrowLeft',
46
- run: (editor) => {
47
- const value = editor.state.doc.toString();
48
- onNav?.(value, { key: 'ArrowLeft' });
49
- return !!onNav;
50
- },
51
- },
52
- {
53
- key: 'ArrowRight',
54
- run: (editor) => {
55
- const value = editor.state.doc.toString();
56
- onNav?.(value, { key: 'ArrowRight' });
57
- return !!onNav;
58
- },
59
- },
60
- {
61
- key: 'Enter',
62
- run: (editor) => {
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 });
79
- return true;
80
- },
81
- },
82
- {
83
- key: 'Escape',
84
- run: () => {
85
- onClose(undefined, { key: 'Escape' });
86
- return true;
87
- },
88
- },
89
- ]);
90
- };
91
-
92
- export type CellEditorProps = {
93
- value?: string;
94
- extension?: Extension;
95
- variant?: keyof typeof editorVariants;
96
- box?: GridEditBox;
97
- gridId?: string;
98
- } & Pick<UseTextEditorProps, 'autoFocus'> &
99
- Pick<DOMAttributes<HTMLInputElement>, 'onBlur' | 'onKeyDown'>;
100
-
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) => {
124
- const { themeMode } = useThemeContext();
125
- const { parentRef } = useTextEditor(() => {
126
- return {
127
- autoFocus,
128
- initialValue: value,
129
- selection: { anchor: value?.length ?? 0 },
130
- extensions: [
131
- extension ?? [],
132
- preventNewline,
133
- EditorView.focusChangeEffect.of((_, focusing) => {
134
- if (!focusing) {
135
- onBlur?.({ type: 'blur' } as any);
136
- }
137
- return null;
138
- }),
139
- createBasicExtensions({ lineWrapping: false }),
140
- createThemeExtensions({
141
- themeMode,
142
- slots: {
143
- editor: {
144
- className: editorVariants[variant].editor,
145
- },
146
- content: {
147
- className: editorVariants[variant].content,
148
- },
149
- },
150
- }),
151
- ],
152
- };
153
- }, [extension, autoFocus, value, variant, onBlur]);
154
-
155
- return (
156
- <div
157
- ref={parentRef}
158
- className={editorVariants[variant].root}
159
- style={box}
160
- {...(gridId && { 'data-grid': gridId })}
161
- />
162
- );
163
- };
@@ -1,250 +0,0 @@
1
- //
2
- // Copyright 2024 DXOS.org
3
- //
4
-
5
- import '@dxos-theme';
6
-
7
- import React, { useState } from 'react';
8
-
9
- import { log } from '@dxos/log';
10
- import { type Space, useSpace } from '@dxos/react-client/echo';
11
- import { withClientProvider } from '@dxos/react-client/testing';
12
- import { Button } from '@dxos/react-ui';
13
- import { mx } from '@dxos/react-ui-theme';
14
- import { withLayout, withTheme } from '@dxos/storybook-utils';
15
-
16
- import { Sheet } from './Sheet';
17
- import { type SizeMap } from './grid';
18
- import { useSheetContext } from './sheet-context';
19
- import { addressToIndex, rangeToIndex } from '../../defs';
20
- import { useComputeGraph } from '../../hooks';
21
- import { useTestSheet, withGraphDecorator } from '../../testing';
22
- import { SheetType, ValueTypeEnum } from '../../types';
23
- import { Toolbar, type ToolbarActionHandler } from '../Toolbar';
24
-
25
- // TODO(burdon): Allow toolbar to access sheet context; provide state for current cursor/range.
26
- const SheetWithToolbar = ({ debug, space }: { debug?: boolean; space: Space }) => {
27
- const { model, cursor, range } = useSheetContext();
28
-
29
- const graph = useComputeGraph(space);
30
- const handleRefresh = () => {
31
- graph?.refresh();
32
- };
33
-
34
- // TODO(burdon): Factor out.
35
- const handleAction: ToolbarActionHandler = ({ type }) => {
36
- log.info('action', { type, cursor, range });
37
- if (!cursor) {
38
- return;
39
- }
40
-
41
- const idx = range ? rangeToIndex(model.sheet, range) : addressToIndex(model.sheet, cursor);
42
- model.sheet.formatting[idx] ??= {};
43
- const format = model.sheet.formatting[idx];
44
-
45
- switch (type) {
46
- case 'clear': {
47
- // TODO(burdon): Toggle to show all ranges to allow user to delete range.
48
- format.classNames = [];
49
- break;
50
- }
51
- case 'highlight': {
52
- // TODO(burdon): Util to add to set.
53
- format.classNames = ['bg-green-300 dark:bg-green-700'];
54
- break;
55
- }
56
-
57
- case 'left': {
58
- format.classNames = ['text-left'];
59
- break;
60
- }
61
- case 'center': {
62
- format.classNames = ['text-center'];
63
- break;
64
- }
65
- case 'right': {
66
- format.classNames = ['text-right'];
67
- break;
68
- }
69
-
70
- case 'date': {
71
- format.type = ValueTypeEnum.Date;
72
- format.format = 'YYYY-MM-DD';
73
- break;
74
- }
75
- case 'currency': {
76
- format.type = ValueTypeEnum.Currency;
77
- format.precision = 2;
78
- break;
79
- }
80
- case 'comment': {
81
- break;
82
- }
83
- }
84
- };
85
-
86
- return (
87
- <div className='flex flex-col overflow-hidden'>
88
- <Toolbar.Root onAction={handleAction}>
89
- <Toolbar.Styles />
90
- <Toolbar.Format />
91
- <Toolbar.Alignment />
92
- <Toolbar.Separator />
93
- <Toolbar.Actions />
94
- <Button onClick={handleRefresh}>Refresh</Button>
95
- </Toolbar.Root>
96
- <Sheet.Main />
97
- {debug && <Sheet.Debug />}
98
- </div>
99
- );
100
- };
101
-
102
- export default {
103
- title: 'plugin-sheet/Sheet',
104
- component: Sheet,
105
- decorators: [
106
- withClientProvider({ types: [SheetType], createIdentity: true }),
107
- withGraphDecorator,
108
- withTheme,
109
- withLayout({ fullscreen: true, tooltips: true, classNames: 'inset-4' }),
110
- ],
111
- };
112
-
113
- export const Default = () => {
114
- const [debug, setDebug] = useState(false);
115
- const space = useSpace();
116
- const graph = useComputeGraph(space);
117
- const sheet = useTestSheet(space, graph);
118
- if (!space || !sheet) {
119
- return null;
120
- }
121
-
122
- return (
123
- <Sheet.Root space={space} sheet={sheet} onInfo={() => setDebug((debug) => !debug)}>
124
- <SheetWithToolbar debug={debug} space={space} />
125
- </Sheet.Root>
126
- );
127
- };
128
-
129
- export const Debug = () => {
130
- const space = useSpace();
131
- const graph = useComputeGraph(space);
132
- const sheet = useTestSheet(space, graph);
133
- if (!sheet || !space) {
134
- return null;
135
- }
136
-
137
- return (
138
- <Sheet.Root space={space} sheet={sheet}>
139
- <Sheet.Main />
140
- <Sheet.Debug />
141
- </Sheet.Root>
142
- );
143
- };
144
-
145
- export const Rows = () => {
146
- const [rowSizes, setRowSizes] = useState<SizeMap>({});
147
- const space = useSpace();
148
- const graph = useComputeGraph(space);
149
- const sheet = useTestSheet(space, graph);
150
- if (!sheet || !space) {
151
- return null;
152
- }
153
-
154
- return (
155
- <Sheet.Root space={space} sheet={sheet}>
156
- <Sheet.Rows
157
- rows={sheet.rows}
158
- sizes={rowSizes}
159
- onResize={(id, size) => setRowSizes((sizes) => ({ ...sizes, [id]: size }))}
160
- />
161
- </Sheet.Root>
162
- );
163
- };
164
-
165
- export const Columns = () => {
166
- const [columnSizes, setColumnSizes] = useState<SizeMap>({});
167
- const space = useSpace();
168
- const graph = useComputeGraph(space);
169
- const sheet = useTestSheet(space, graph);
170
- if (!sheet || !space) {
171
- return null;
172
- }
173
-
174
- return (
175
- <Sheet.Root space={space} sheet={sheet}>
176
- <Sheet.Columns
177
- columns={sheet.columns}
178
- sizes={columnSizes}
179
- onResize={(id, size) => setColumnSizes((sizes) => ({ ...sizes, [id]: size }))}
180
- />
181
- </Sheet.Root>
182
- );
183
- };
184
-
185
- export const Main = () => {
186
- const space = useSpace();
187
- const graph = useComputeGraph(space);
188
- const sheet = useTestSheet(space, graph);
189
- if (!sheet || !space) {
190
- return null;
191
- }
192
-
193
- return (
194
- <Sheet.Root space={space} sheet={sheet}>
195
- <Sheet.Grid
196
- size={{
197
- numRows: 50,
198
- numCols: 26,
199
- }}
200
- rows={sheet.rows}
201
- columns={sheet.columns}
202
- rowSizes={{}}
203
- columnSizes={{}}
204
- />
205
- </Sheet.Root>
206
- );
207
- };
208
-
209
- /**
210
- * Scrolling container with fixed border that overlaps the border of inner elements.
211
- */
212
- export const ScrollLayout = () => {
213
- return (
214
- <div className='relative flex grow overflow-hidden'>
215
- {/* Fixed border. */}
216
- <div className='z-20 absolute inset-0 border border-primary-500 pointer-events-none' />
217
-
218
- {/* Scroll container. */}
219
- <div className='grow overflow-auto scrollbar-thin'>
220
- {/* Scroll content. */}
221
- <div className='relative w-[2000px] h-[2000px]'>
222
- <Cell label='A1' className='absolute left-0 top-0 w-20 h-20' />
223
- <Cell label='A1' className='absolute right-0 top-0 w-20 h-20' />
224
- <Cell label='A1' className='absolute left-0 bottom-0 w-20 h-20' />
225
- <Cell label='A1' className='absolute right-0 bottom-0 w-20 h-20' />
226
- </div>
227
- </div>
228
- </div>
229
- );
230
- };
231
-
232
- export const GridLayout = () => {
233
- return (
234
- <div className='grid grid-cols-[40px_1fr_40px] grid-rows-[40px_1fr_40px] grow'>
235
- <Cell label='A1' />
236
- <Cell label='B1' />
237
- <Cell label='C1' />
238
- <Cell label='A2' />
239
- <Cell label='B2' />
240
- <Cell label='C2' />
241
- <Cell label='A3' />
242
- <Cell label='B3' />
243
- <Cell label='C3' />
244
- </div>
245
- );
246
- };
247
-
248
- const Cell = ({ className, label }: { className?: string; label: string }) => (
249
- <div className={mx('flex items-center justify-center border', className)}>{label}</div>
250
- );