@dxos/plugin-sheet 0.6.13 → 0.6.14-main.69511f5

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 (330) hide show
  1. package/dist/lib/browser/SheetContainer-R65IDJHN.mjs +286 -0
  2. package/dist/lib/browser/SheetContainer-R65IDJHN.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-5KVQ5IPW.mjs +65 -0
  4. package/dist/lib/browser/chunk-5KVQ5IPW.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-I2DKJ72A.mjs +1471 -0
  8. package/dist/lib/browser/chunk-I2DKJ72A.mjs.map +7 -0
  9. package/dist/lib/browser/{chunk-D5AGLXJP.mjs → chunk-KCYJSOFB.mjs} +625 -675
  10. package/dist/lib/browser/chunk-KCYJSOFB.mjs.map +7 -0
  11. package/dist/lib/browser/compute-graph-SJT67236.mjs +35 -0
  12. package/dist/lib/browser/compute-graph-SJT67236.mjs.map +7 -0
  13. package/dist/lib/browser/index.mjs +140 -67
  14. package/dist/lib/browser/index.mjs.map +4 -4
  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 +6 -12
  18. package/dist/lib/node/SheetContainer-6BO4C5X2.cjs +290 -0
  19. package/dist/lib/node/SheetContainer-6BO4C5X2.cjs.map +7 -0
  20. package/dist/lib/node/{chunk-DSYKOI4E.cjs → chunk-2XJ5I4UF.cjs} +32 -52
  21. package/dist/lib/node/chunk-2XJ5I4UF.cjs.map +7 -0
  22. package/dist/lib/node/chunk-DEPJHN47.cjs +1457 -0
  23. package/dist/lib/node/chunk-DEPJHN47.cjs.map +7 -0
  24. package/dist/lib/node/{chunk-5KKJ4NPP.cjs → chunk-JF5XNTF3.cjs} +643 -674
  25. package/dist/lib/node/chunk-JF5XNTF3.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/compute-graph-AQBDL7HO.cjs +57 -0
  29. package/dist/lib/node/compute-graph-AQBDL7HO.cjs.map +7 -0
  30. package/dist/lib/node/index.cjs +150 -75
  31. package/dist/lib/node/index.cjs.map +4 -4
  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 +9 -15
  36. package/dist/lib/node/types.cjs.map +2 -2
  37. package/dist/lib/node-esm/SheetContainer-MJXC5E3P.mjs +287 -0
  38. package/dist/lib/node-esm/SheetContainer-MJXC5E3P.mjs.map +7 -0
  39. package/dist/lib/node-esm/chunk-25V7WY4R.mjs +1472 -0
  40. package/dist/lib/node-esm/chunk-25V7WY4R.mjs.map +7 -0
  41. package/dist/lib/node-esm/chunk-5TXLF6PL.mjs +66 -0
  42. package/dist/lib/node-esm/chunk-5TXLF6PL.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-XBEHKYO7.mjs +3186 -0
  46. package/dist/lib/node-esm/chunk-XBEHKYO7.mjs.map +7 -0
  47. package/dist/lib/node-esm/compute-graph-FRCKXEYK.mjs +36 -0
  48. package/dist/lib/node-esm/compute-graph-FRCKXEYK.mjs.map +7 -0
  49. package/dist/lib/node-esm/index.mjs +322 -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 +13 -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 +6 -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} +5 -9
  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 +15 -0
  74. package/dist/types/src/components/GridSheet/util.d.ts.map +1 -0
  75. package/dist/types/src/components/RangeList/RangeList.d.ts +7 -0
  76. package/dist/types/src/components/RangeList/RangeList.d.ts.map +1 -0
  77. package/dist/types/src/components/RangeList/index.d.ts +2 -0
  78. package/dist/types/src/components/RangeList/index.d.ts.map +1 -0
  79. package/dist/types/src/components/SheetContainer/SheetContainer.d.ts +9 -0
  80. package/dist/types/src/components/SheetContainer/SheetContainer.d.ts.map +1 -0
  81. package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts +6 -0
  82. package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +1 -0
  83. package/dist/types/src/components/SheetContainer/index.d.ts +3 -0
  84. package/dist/types/src/components/SheetContainer/index.d.ts.map +1 -0
  85. package/dist/types/src/components/SheetContext/SheetContext.d.ts +28 -0
  86. package/dist/types/src/components/SheetContext/SheetContext.d.ts.map +1 -0
  87. package/dist/types/src/components/SheetContext/index.d.ts +2 -0
  88. package/dist/types/src/components/SheetContext/index.d.ts.map +1 -0
  89. package/dist/types/src/components/Toolbar/Toolbar.d.ts +33 -9
  90. package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
  91. package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +4 -32
  92. package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -1
  93. package/dist/types/src/components/index.d.ts +7 -4
  94. package/dist/types/src/components/index.d.ts.map +1 -1
  95. package/dist/types/src/compute-graph/compute-graph-registry.d.ts +34 -0
  96. package/dist/types/src/compute-graph/compute-graph-registry.d.ts.map +1 -0
  97. package/dist/types/src/compute-graph/compute-graph.d.ts +64 -0
  98. package/dist/types/src/compute-graph/compute-graph.d.ts.map +1 -0
  99. package/dist/types/src/compute-graph/compute-graph.stories.d.ts +6 -0
  100. package/dist/types/src/compute-graph/compute-graph.stories.d.ts.map +1 -0
  101. package/dist/types/src/compute-graph/compute-graph.test.d.ts +2 -0
  102. package/dist/types/src/compute-graph/compute-graph.test.d.ts.map +1 -0
  103. package/dist/types/src/compute-graph/compute-node.d.ts +26 -0
  104. package/dist/types/src/compute-graph/compute-node.d.ts.map +1 -0
  105. package/dist/types/src/{components/ComputeGraph → compute-graph/functions}/async-function.d.ts +14 -5
  106. package/dist/types/src/compute-graph/functions/async-function.d.ts.map +1 -0
  107. package/dist/types/src/compute-graph/functions/edge-function.d.ts +21 -0
  108. package/dist/types/src/compute-graph/functions/edge-function.d.ts.map +1 -0
  109. package/dist/types/src/{model/functions.d.ts → compute-graph/functions/function-defs.d.ts} +1 -1
  110. package/dist/types/src/compute-graph/functions/function-defs.d.ts.map +1 -0
  111. package/dist/types/src/compute-graph/functions/index.d.ts +4 -0
  112. package/dist/types/src/compute-graph/functions/index.d.ts.map +1 -0
  113. package/dist/types/src/compute-graph/hyperformula.test.d.ts +2 -0
  114. package/dist/types/src/compute-graph/hyperformula.test.d.ts.map +1 -0
  115. package/dist/types/src/compute-graph/index.d.ts +5 -0
  116. package/dist/types/src/compute-graph/index.d.ts.map +1 -0
  117. package/dist/types/src/compute-graph/testing/index.d.ts +3 -0
  118. package/dist/types/src/compute-graph/testing/index.d.ts.map +1 -0
  119. package/dist/types/src/compute-graph/testing/test-builder.d.ts +15 -0
  120. package/dist/types/src/compute-graph/testing/test-builder.d.ts.map +1 -0
  121. package/dist/types/src/compute-graph/testing/test-plugin.d.ts +36 -0
  122. package/dist/types/src/compute-graph/testing/test-plugin.d.ts.map +1 -0
  123. package/dist/types/src/compute-graph/util.d.ts +2 -0
  124. package/dist/types/src/compute-graph/util.d.ts.map +1 -0
  125. package/dist/types/src/defs/index.d.ts +4 -0
  126. package/dist/types/src/defs/index.d.ts.map +1 -0
  127. package/dist/types/src/defs/sheet-range-types.d.ts +13 -0
  128. package/dist/types/src/defs/sheet-range-types.d.ts.map +1 -0
  129. package/dist/types/src/defs/types.d.ts +28 -0
  130. package/dist/types/src/defs/types.d.ts.map +1 -0
  131. package/dist/types/src/defs/types.test.d.ts.map +1 -0
  132. package/dist/types/src/defs/util.d.ts +39 -0
  133. package/dist/types/src/defs/util.d.ts.map +1 -0
  134. package/dist/types/src/extensions/compute.d.ts +6 -0
  135. package/dist/types/src/extensions/compute.d.ts.map +1 -0
  136. package/dist/types/src/extensions/compute.stories.d.ts +21 -0
  137. package/dist/types/src/extensions/compute.stories.d.ts.map +1 -0
  138. package/dist/types/src/extensions/editor/extension.d.ts +39 -0
  139. package/dist/types/src/extensions/editor/extension.d.ts.map +1 -0
  140. package/dist/types/src/extensions/editor/extension.test.d.ts.map +1 -0
  141. package/dist/types/src/extensions/editor/index.d.ts +2 -0
  142. package/dist/types/src/extensions/editor/index.d.ts.map +1 -0
  143. package/dist/types/src/extensions/index.d.ts +3 -0
  144. package/dist/types/src/extensions/index.d.ts.map +1 -0
  145. package/dist/types/src/index.d.ts +1 -1
  146. package/dist/types/src/index.d.ts.map +1 -1
  147. package/dist/types/src/integrations/index.d.ts +2 -0
  148. package/dist/types/src/integrations/index.d.ts.map +1 -0
  149. package/dist/types/src/integrations/thread-ranges.d.ts +7 -0
  150. package/dist/types/src/integrations/thread-ranges.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/index.d.ts +2 -3
  154. package/dist/types/src/model/index.d.ts.map +1 -1
  155. package/dist/types/src/model/{model.d.ts → sheet-model.d.ts} +13 -67
  156. package/dist/types/src/model/sheet-model.d.ts.map +1 -0
  157. package/dist/types/src/model/sheet-model.test.d.ts +2 -0
  158. package/dist/types/src/model/sheet-model.test.d.ts.map +1 -0
  159. package/dist/types/src/model/useSheetModel.d.ts +8 -0
  160. package/dist/types/src/model/useSheetModel.d.ts.map +1 -0
  161. package/dist/types/src/sanity.test.d.ts +2 -0
  162. package/dist/types/src/sanity.test.d.ts.map +1 -0
  163. package/dist/types/src/serializer.d.ts +4 -0
  164. package/dist/types/src/serializer.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 +27 -12
  170. package/dist/types/src/translations.d.ts.map +1 -1
  171. package/dist/types/src/types.d.ts +100 -41
  172. package/dist/types/src/types.d.ts.map +1 -1
  173. package/dist/vendor/hyperformula.mjs +37145 -0
  174. package/package.json +60 -61
  175. package/src/SheetPlugin.tsx +69 -78
  176. package/src/components/ComputeGraph/ComputeGraphContextProvider.tsx +37 -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 +46 -0
  181. package/src/components/GridSheet/GridSheet.tsx +297 -0
  182. package/src/components/{CellEditor/CellEditor.stories.tsx → GridSheet/SheetCellEditor.stories.tsx} +18 -15
  183. package/src/components/GridSheet/index.ts +5 -0
  184. package/src/components/GridSheet/util.ts +164 -0
  185. package/src/components/RangeList/RangeList.tsx +53 -0
  186. package/src/components/RangeList/index.ts +5 -0
  187. package/src/components/SheetContainer/SheetContainer.stories.tsx +43 -0
  188. package/src/components/SheetContainer/SheetContainer.tsx +33 -0
  189. package/src/components/SheetContainer/index.ts +7 -0
  190. package/src/components/SheetContext/SheetContext.tsx +127 -0
  191. package/src/components/SheetContext/index.ts +5 -0
  192. package/src/components/Toolbar/Toolbar.stories.tsx +9 -6
  193. package/src/components/Toolbar/Toolbar.tsx +245 -112
  194. package/src/components/index.ts +5 -3
  195. package/src/compute-graph/compute-graph-registry.ts +90 -0
  196. package/src/compute-graph/compute-graph.stories.tsx +97 -0
  197. package/src/compute-graph/compute-graph.test.ts +87 -0
  198. package/src/compute-graph/compute-graph.ts +245 -0
  199. package/src/compute-graph/compute-node.ts +62 -0
  200. package/src/{components/ComputeGraph → compute-graph/functions}/async-function.ts +25 -15
  201. package/src/{components/ComputeGraph → compute-graph/functions}/edge-function.ts +16 -14
  202. package/src/compute-graph/functions/index.ts +7 -0
  203. package/src/compute-graph/hyperformula.test.ts +14 -0
  204. package/src/compute-graph/index.ts +8 -0
  205. package/src/compute-graph/testing/index.ts +6 -0
  206. package/src/compute-graph/testing/test-builder.ts +54 -0
  207. package/src/{components/ComputeGraph/custom.ts → compute-graph/testing/test-plugin.ts} +44 -14
  208. package/src/compute-graph/util.ts +8 -0
  209. package/src/defs/index.ts +7 -0
  210. package/src/defs/sheet-range-types.ts +47 -0
  211. package/src/{model → defs}/types.test.ts +8 -9
  212. package/src/defs/types.ts +86 -0
  213. package/src/defs/util.ts +135 -0
  214. package/src/extensions/compute.stories.tsx +155 -0
  215. package/src/extensions/compute.ts +147 -0
  216. package/src/{components/CellEditor → extensions/editor}/extension.test.ts +4 -6
  217. package/src/{components/CellEditor → extensions/editor}/extension.ts +51 -27
  218. package/src/{components/CellEditor → extensions/editor}/index.ts +0 -1
  219. package/src/extensions/index.ts +6 -0
  220. package/src/index.ts +2 -2
  221. package/src/integrations/index.ts +5 -0
  222. package/src/integrations/thread-ranges.ts +101 -0
  223. package/src/meta.ts +14 -0
  224. package/src/model/index.ts +2 -3
  225. package/src/model/sheet-model.test.ts +57 -0
  226. package/src/model/sheet-model.ts +423 -0
  227. package/src/model/useSheetModel.ts +40 -0
  228. package/src/sanity.test.ts +40 -0
  229. package/src/serializer.ts +27 -0
  230. package/src/{components/Sheet → testing}/index.ts +1 -1
  231. package/src/testing/testing.tsx +68 -0
  232. package/src/translations.ts +19 -4
  233. package/src/types.ts +42 -47
  234. package/dist/lib/browser/SheetContainer-U4H5D34A.mjs +0 -1772
  235. package/dist/lib/browser/SheetContainer-U4H5D34A.mjs.map +0 -7
  236. package/dist/lib/browser/chunk-APHOLYUB.mjs +0 -175
  237. package/dist/lib/browser/chunk-APHOLYUB.mjs.map +0 -7
  238. package/dist/lib/browser/chunk-D5AGLXJP.mjs.map +0 -7
  239. package/dist/lib/browser/chunk-FUAGSXA4.mjs +0 -82
  240. package/dist/lib/browser/chunk-FUAGSXA4.mjs.map +0 -7
  241. package/dist/lib/browser/chunk-JRL5LGCE.mjs +0 -18
  242. package/dist/lib/browser/chunk-JRL5LGCE.mjs.map +0 -7
  243. package/dist/lib/browser/chunk-NU4PBN33.mjs +0 -8
  244. package/dist/lib/browser/chunk-NU4PBN33.mjs.map +0 -7
  245. package/dist/lib/browser/testing.mjs +0 -92
  246. package/dist/lib/browser/testing.mjs.map +0 -7
  247. package/dist/lib/node/SheetContainer-AXQV3ZT5.cjs +0 -1765
  248. package/dist/lib/node/SheetContainer-AXQV3ZT5.cjs.map +0 -7
  249. package/dist/lib/node/chunk-5KKJ4NPP.cjs.map +0 -7
  250. package/dist/lib/node/chunk-BJ6ZD7MN.cjs +0 -51
  251. package/dist/lib/node/chunk-BJ6ZD7MN.cjs.map +0 -7
  252. package/dist/lib/node/chunk-CN3RPESU.cjs +0 -202
  253. package/dist/lib/node/chunk-CN3RPESU.cjs.map +0 -7
  254. package/dist/lib/node/chunk-DSYKOI4E.cjs.map +0 -7
  255. package/dist/lib/node/chunk-PYXHNAAK.cjs +0 -40
  256. package/dist/lib/node/chunk-PYXHNAAK.cjs.map +0 -7
  257. package/dist/lib/node/testing.cjs +0 -111
  258. package/dist/lib/node/testing.cjs.map +0 -7
  259. package/dist/types/src/components/CellEditor/CellEditor.d.ts +0 -14
  260. package/dist/types/src/components/CellEditor/CellEditor.d.ts.map +0 -1
  261. package/dist/types/src/components/CellEditor/CellEditor.stories.d.ts.map +0 -1
  262. package/dist/types/src/components/CellEditor/extension.d.ts +0 -19
  263. package/dist/types/src/components/CellEditor/extension.d.ts.map +0 -1
  264. package/dist/types/src/components/CellEditor/extension.test.d.ts.map +0 -1
  265. package/dist/types/src/components/CellEditor/index.d.ts +0 -3
  266. package/dist/types/src/components/CellEditor/index.d.ts.map +0 -1
  267. package/dist/types/src/components/ComputeGraph/async-function.d.ts.map +0 -1
  268. package/dist/types/src/components/ComputeGraph/custom.d.ts +0 -21
  269. package/dist/types/src/components/ComputeGraph/custom.d.ts.map +0 -1
  270. package/dist/types/src/components/ComputeGraph/edge-function.d.ts +0 -20
  271. package/dist/types/src/components/ComputeGraph/edge-function.d.ts.map +0 -1
  272. package/dist/types/src/components/ComputeGraph/graph-context.d.ts +0 -12
  273. package/dist/types/src/components/ComputeGraph/graph-context.d.ts.map +0 -1
  274. package/dist/types/src/components/ComputeGraph/graph.browser.test.d.ts +0 -2
  275. package/dist/types/src/components/ComputeGraph/graph.browser.test.d.ts.map +0 -1
  276. package/dist/types/src/components/ComputeGraph/graph.d.ts +0 -26
  277. package/dist/types/src/components/ComputeGraph/graph.d.ts.map +0 -1
  278. package/dist/types/src/components/Sheet/Sheet.d.ts +0 -55
  279. package/dist/types/src/components/Sheet/Sheet.d.ts.map +0 -1
  280. package/dist/types/src/components/Sheet/Sheet.stories.d.ts +0 -54
  281. package/dist/types/src/components/Sheet/Sheet.stories.d.ts.map +0 -1
  282. package/dist/types/src/components/Sheet/formatting.d.ts +0 -14
  283. package/dist/types/src/components/Sheet/formatting.d.ts.map +0 -1
  284. package/dist/types/src/components/Sheet/grid.d.ts +0 -52
  285. package/dist/types/src/components/Sheet/grid.d.ts.map +0 -1
  286. package/dist/types/src/components/Sheet/index.d.ts +0 -2
  287. package/dist/types/src/components/Sheet/index.d.ts.map +0 -1
  288. package/dist/types/src/components/Sheet/nav.d.ts +0 -29
  289. package/dist/types/src/components/Sheet/nav.d.ts.map +0 -1
  290. package/dist/types/src/components/Sheet/sheet-context.d.ts +0 -25
  291. package/dist/types/src/components/Sheet/sheet-context.d.ts.map +0 -1
  292. package/dist/types/src/components/Sheet/util.d.ts +0 -18
  293. package/dist/types/src/components/Sheet/util.d.ts.map +0 -1
  294. package/dist/types/src/components/SheetContainer.d.ts +0 -9
  295. package/dist/types/src/components/SheetContainer.d.ts.map +0 -1
  296. package/dist/types/src/components/Toolbar/common.d.ts +0 -20
  297. package/dist/types/src/components/Toolbar/common.d.ts.map +0 -1
  298. package/dist/types/src/model/functions.d.ts.map +0 -1
  299. package/dist/types/src/model/model.browser.test.d.ts +0 -2
  300. package/dist/types/src/model/model.browser.test.d.ts.map +0 -1
  301. package/dist/types/src/model/model.d.ts.map +0 -1
  302. package/dist/types/src/model/types.d.ts +0 -17
  303. package/dist/types/src/model/types.d.ts.map +0 -1
  304. package/dist/types/src/model/types.test.d.ts.map +0 -1
  305. package/dist/types/src/model/util.d.ts +0 -15
  306. package/dist/types/src/model/util.d.ts.map +0 -1
  307. package/dist/types/src/testing.d.ts +0 -9
  308. package/dist/types/src/testing.d.ts.map +0 -1
  309. package/src/components/CellEditor/CellEditor.tsx +0 -113
  310. package/src/components/ComputeGraph/graph-context.tsx +0 -50
  311. package/src/components/ComputeGraph/graph.browser.test.ts +0 -50
  312. package/src/components/ComputeGraph/graph.ts +0 -62
  313. package/src/components/Sheet/Sheet.stories.tsx +0 -287
  314. package/src/components/Sheet/Sheet.tsx +0 -1160
  315. package/src/components/Sheet/formatting.ts +0 -106
  316. package/src/components/Sheet/grid.ts +0 -191
  317. package/src/components/Sheet/nav.ts +0 -157
  318. package/src/components/Sheet/sheet-context.tsx +0 -150
  319. package/src/components/Sheet/util.ts +0 -56
  320. package/src/components/SheetContainer.tsx +0 -34
  321. package/src/components/Toolbar/common.tsx +0 -72
  322. package/src/meta.tsx +0 -18
  323. package/src/model/model.browser.test.ts +0 -100
  324. package/src/model/model.ts +0 -550
  325. package/src/model/types.ts +0 -71
  326. package/src/model/util.ts +0 -36
  327. package/src/testing.ts +0 -50
  328. /package/dist/types/src/{model → defs}/types.test.d.ts +0 -0
  329. /package/dist/types/src/{components/CellEditor → extensions/editor}/extension.test.d.ts +0 -0
  330. /package/src/{model/functions.ts → compute-graph/functions/function-defs.ts} +0 -0
@@ -0,0 +1,127 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import React, { type PropsWithChildren, createContext, useCallback, useContext, useState } from 'react';
6
+
7
+ import { invariant } from '@dxos/invariant';
8
+ import { fullyQualifiedId } from '@dxos/react-client/echo';
9
+ import {
10
+ Grid,
11
+ type GridContentProps,
12
+ type GridEditing,
13
+ type GridScopedProps,
14
+ useGridContext,
15
+ } from '@dxos/react-ui-grid';
16
+
17
+ import { type ComputeGraph } from '../../compute-graph';
18
+ import { type CellAddress, type CellRange, type CompleteCellRange } from '../../defs';
19
+ import { type SheetModel, useSheetModel } from '../../model';
20
+ import { type SheetType } from '../../types';
21
+
22
+ export type SheetContextValue = {
23
+ id: string;
24
+
25
+ model: SheetModel;
26
+
27
+ // Cursor state.
28
+ // TODO(burdon): Cursor and range should use indices.
29
+ cursor?: CellAddress;
30
+ setCursor: (cell: CellAddress | undefined) => void;
31
+ range?: CellRange;
32
+ setRange: (range: CellRange | undefined) => void;
33
+ cursorFallbackRange?: CompleteCellRange;
34
+
35
+ // Editing state (undefined if not editing).
36
+ editing: GridEditing;
37
+ setEditing: (editing: GridEditing) => void;
38
+
39
+ // Active refs
40
+ activeRefs: GridContentProps['activeRefs'];
41
+ setActiveRefs: (activeRefs: GridContentProps['activeRefs']) => void;
42
+
43
+ // Events.
44
+ // TODO(burdon): Generalize.
45
+ onInfo?: () => void;
46
+ };
47
+
48
+ const SheetContext = createContext<SheetContextValue | undefined>(undefined);
49
+
50
+ export const useSheetContext = (): SheetContextValue => {
51
+ const context = useContext(SheetContext);
52
+ invariant(context);
53
+ return context;
54
+ };
55
+
56
+ const SheetProviderImpl = ({
57
+ model,
58
+ onInfo,
59
+ children,
60
+ __gridScope,
61
+ }: GridScopedProps<PropsWithChildren<Pick<SheetContextValue, 'onInfo' | 'model'>>>) => {
62
+ const { id, editing, setEditing } = useGridContext('SheetProvider', __gridScope);
63
+
64
+ const [cursor, setCursorInternal] = useState<CellAddress>();
65
+ const [range, setRangeInternal] = useState<CellRange>();
66
+ const [cursorFallbackRange, setCursorFallbackRange] = useState<CompleteCellRange>();
67
+ const [activeRefs, setActiveRefs] = useState<GridContentProps['activeRefs']>('');
68
+
69
+ const setCursor = useCallback(
70
+ (nextCursor?: CellAddress) => {
71
+ setCursorInternal(nextCursor);
72
+ setCursorFallbackRange(
73
+ range?.to ? (range as CompleteCellRange) : nextCursor ? { from: nextCursor!, to: nextCursor! } : undefined,
74
+ );
75
+ },
76
+ [range],
77
+ );
78
+ const setRange = useCallback(
79
+ (nextRange?: CellRange) => {
80
+ setRangeInternal(nextRange);
81
+ setCursorFallbackRange(
82
+ nextRange?.to ? (nextRange as CompleteCellRange) : cursor ? { from: cursor!, to: cursor! } : undefined,
83
+ );
84
+ },
85
+ [cursor],
86
+ );
87
+
88
+ return (
89
+ <SheetContext.Provider
90
+ value={{
91
+ id,
92
+ model,
93
+ editing,
94
+ setEditing,
95
+ cursor,
96
+ setCursor,
97
+ range,
98
+ setRange,
99
+ cursorFallbackRange,
100
+ activeRefs,
101
+ setActiveRefs,
102
+ // TODO(burdon): Change to event.
103
+ onInfo,
104
+ }}
105
+ >
106
+ {children}
107
+ </SheetContext.Provider>
108
+ );
109
+ };
110
+
111
+ export type SheetProviderProps = {
112
+ graph: ComputeGraph;
113
+ sheet: SheetType;
114
+ readonly?: boolean;
115
+ } & Pick<SheetContextValue, 'onInfo'>;
116
+
117
+ export const SheetProvider = ({ children, graph, sheet, readonly, onInfo }: PropsWithChildren<SheetProviderProps>) => {
118
+ const model = useSheetModel(graph, sheet, { readonly });
119
+
120
+ return !model ? null : (
121
+ <Grid.Root id={fullyQualifiedId(sheet)}>
122
+ <SheetProviderImpl model={model} onInfo={onInfo}>
123
+ {children}
124
+ </SheetProviderImpl>
125
+ </Grid.Root>
126
+ );
127
+ };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ export * from './SheetContext';
@@ -4,6 +4,7 @@
4
4
 
5
5
  import '@dxos-theme';
6
6
 
7
+ import { type Meta } from '@storybook/react';
7
8
  import React from 'react';
8
9
 
9
10
  import { textBlockWidth } from '@dxos/react-ui-theme';
@@ -12,7 +13,7 @@ import { withLayout, withTheme } from '@dxos/storybook-utils';
12
13
  import { Toolbar } from './Toolbar';
13
14
  import translations from '../../translations';
14
15
 
15
- const Story = () => {
16
+ const DefaultStory = () => {
16
17
  return (
17
18
  <Toolbar.Root classNames={textBlockWidth}>
18
19
  <Toolbar.Alignment />
@@ -20,12 +21,14 @@ const Story = () => {
20
21
  );
21
22
  };
22
23
 
23
- export default {
24
- title: 'plugin-sheet/Toolbar',
25
- component: Toolbar,
24
+ export const Default = {};
25
+
26
+ const meta: Meta<typeof Toolbar.Root> = {
27
+ title: 'plugins/plugin-sheet/Toolbar',
28
+ component: Toolbar.Root,
29
+ render: DefaultStory,
26
30
  decorators: [withTheme, withLayout({ tooltips: true })],
27
31
  parameters: { translations, layout: 'fullscreen' },
28
- render: (args: any) => <Story {...args} />,
29
32
  };
30
33
 
31
- export const Default = {};
34
+ export default meta;
@@ -2,167 +2,273 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import {
6
- type Icon,
7
- Calendar,
8
- ChatText,
9
- CurrencyDollar,
10
- Eraser,
11
- HighlighterCircle,
12
- TextAlignCenter,
13
- TextAlignLeft,
14
- TextAlignRight,
15
- } from '@phosphor-icons/react';
16
5
  import { createContext } from '@radix-ui/react-context';
17
- import React, { type PropsWithChildren } from 'react';
6
+ import React, { type PropsWithChildren, useCallback, useMemo } from 'react';
18
7
 
8
+ import { useIntentDispatcher } from '@dxos/app-framework';
19
9
  import {
20
- DensityProvider,
21
- ElevationProvider,
22
- Toolbar as NaturalToolbar,
10
+ Icon,
23
11
  type ThemedClassName,
12
+ Toolbar as NaturalToolbar,
13
+ type ToolbarButtonProps as NaturalToolbarButtonProps,
14
+ type ToolbarToggleGroupItemProps as NaturalToolbarToggleGroupItemProps,
15
+ type ToolbarToggleProps as NaturalToolbarToggleProps,
16
+ Tooltip,
24
17
  useTranslation,
25
18
  } from '@dxos/react-ui';
19
+ import { useAttention } from '@dxos/react-ui-attention';
20
+ import { nonNullable } from '@dxos/util';
26
21
 
27
- import { ToolbarButton, ToolbarSeparator, ToolbarToggleButton } from './common';
22
+ import {
23
+ alignKey,
24
+ type AlignKey,
25
+ type AlignValue,
26
+ type CommentKey,
27
+ type CommentValue,
28
+ inRange,
29
+ rangeFromIndex,
30
+ rangeToIndex,
31
+ type StyleKey,
32
+ type StyleValue,
33
+ } from '../../defs';
34
+ import { completeCellRangeToThreadCursor } from '../../integrations';
28
35
  import { SHEET_PLUGIN } from '../../meta';
29
- import { type Formatting } from '../../types';
36
+ import { type SheetType } from '../../types';
37
+ import { useSheetContext } from '../SheetContext';
30
38
 
31
39
  //
32
- // Root
40
+ // Buttons
33
41
  //
34
42
 
35
- export type ToolbarActionType = 'clear' | 'highlight' | 'left' | 'center' | 'right' | 'date' | 'currency';
43
+ const buttonStyles = 'min-bs-0 p-2';
44
+ const tooltipProps = { side: 'bottom' as const, classNames: 'z-10' };
45
+
46
+ const ToolbarSeparator = () => <div role='separator' className='grow' />;
36
47
 
37
- export type ToolbarAction = {
38
- type: ToolbarActionType;
48
+ //
49
+ // ToolbarItem
50
+ //
51
+
52
+ type ToolbarItemProps =
53
+ | (NaturalToolbarButtonProps & { itemType: 'button'; icon: string })
54
+ | (NaturalToolbarToggleGroupItemProps & { itemType: 'toggleGroupItem'; icon: string })
55
+ | (NaturalToolbarToggleProps & { itemType: 'toggle'; icon: string });
56
+
57
+ export const ToolbarItem = ({ itemType, icon, children, ...props }: ToolbarItemProps) => {
58
+ const Invoker =
59
+ itemType === 'toggleGroupItem'
60
+ ? NaturalToolbar.ToggleGroupItem
61
+ : itemType === 'toggle'
62
+ ? NaturalToolbar.Toggle
63
+ : NaturalToolbar.Button;
64
+ return (
65
+ <Tooltip.Root>
66
+ <Tooltip.Trigger asChild>
67
+ {/* TODO(thure): type the props spread better. */}
68
+ <Invoker variant='ghost' {...(props as any)} classNames={buttonStyles}>
69
+ <Icon icon={icon} size={5} />
70
+ <span className='sr-only'>{children}</span>
71
+ </Invoker>
72
+ </Tooltip.Trigger>
73
+ <Tooltip.Portal>
74
+ <Tooltip.Content {...tooltipProps}>
75
+ {children}
76
+ <Tooltip.Arrow />
77
+ </Tooltip.Content>
78
+ </Tooltip.Portal>
79
+ </Tooltip.Root>
80
+ );
39
81
  };
40
82
 
41
- export type ToolbarActionHandler = ({ type }: ToolbarAction) => void;
83
+ //
84
+ // Root
85
+ //
86
+
87
+ type AlignAction = { key: AlignKey; value: AlignValue };
88
+ type CommentAction = { key: CommentKey; value: CommentValue; cellContent?: string };
89
+ type StyleAction = { key: StyleKey; value: StyleValue };
90
+
91
+ export type ToolbarAction = StyleAction | AlignAction | CommentAction;
92
+
93
+ export type ToolbarActionType = ToolbarAction['key'];
94
+
95
+ export type ToolbarActionHandler = (action: ToolbarAction) => void;
42
96
 
43
97
  export type ToolbarProps = ThemedClassName<
44
98
  PropsWithChildren<{
45
- onAction?: ToolbarActionHandler;
99
+ role?: string;
46
100
  }>
47
101
  >;
48
102
 
49
- const [ToolbarContextProvider, useToolbarContext] = createContext<ToolbarProps>('Toolbar');
103
+ const [ToolbarContextProvider, useToolbarContext] = createContext<{ onAction: (action: ToolbarAction) => void }>(
104
+ 'Toolbar',
105
+ );
106
+
107
+ // TODO(Zan): Factor out, copied this from MarkdownPlugin.
108
+ const sectionToolbarLayout =
109
+ 'bs-[--rail-action] bg-[--sticky-bg] sticky block-start-0 __-block-start-px transition-opacity';
110
+
111
+ type Range = SheetType['ranges'][number];
112
+
113
+ const ToolbarRoot = ({ children, role, classNames }: ToolbarProps) => {
114
+ const { id, model, cursorFallbackRange, cursor } = useSheetContext();
115
+ const { hasAttention } = useAttention(id);
116
+ const dispatch = useIntentDispatcher();
117
+
118
+ // TODO(Zan): Externalize the toolbar action handler. E.g., Toolbar/keys should both fire events.
119
+ const handleAction = useCallback(
120
+ (action: ToolbarAction) => {
121
+ switch (action.key) {
122
+ case 'alignment':
123
+ if (cursor && cursorFallbackRange) {
124
+ const index = model.sheet.ranges?.findIndex(
125
+ (range) => range.key === action.key && inRange(rangeFromIndex(model.sheet, range.range), cursor),
126
+ );
127
+ const nextRangeEntity = {
128
+ range: rangeToIndex(model.sheet, cursorFallbackRange),
129
+ key: action.key,
130
+ value: action.value,
131
+ };
132
+ if (index < 0) {
133
+ model.sheet.ranges?.push(nextRangeEntity);
134
+ } else {
135
+ model.sheet.ranges?.splice(index, 1, nextRangeEntity);
136
+ }
137
+ }
138
+ break;
139
+ case 'style':
140
+ if (action.value === 'unset') {
141
+ const index = model.sheet.ranges?.findIndex((range) => range.key === action.key);
142
+ if (index >= 0) {
143
+ model.sheet.ranges?.splice(index, 1);
144
+ }
145
+ } else if (cursorFallbackRange) {
146
+ model.sheet.ranges?.push({
147
+ range: rangeToIndex(model.sheet, cursorFallbackRange),
148
+ key: action.key,
149
+ value: action.value,
150
+ });
151
+ }
152
+ break;
153
+ case 'comment': {
154
+ // TODO(Zan): We shouldn't hardcode the action ID.
155
+ if (cursorFallbackRange) {
156
+ void dispatch({
157
+ action: 'dxos.org/plugin/thread/action/create',
158
+ data: {
159
+ cursor: completeCellRangeToThreadCursor(cursorFallbackRange),
160
+ name: action.cellContent,
161
+ subject: model.sheet,
162
+ },
163
+ });
164
+ }
165
+ }
166
+ }
167
+ },
168
+ [model.sheet, cursorFallbackRange, cursor, dispatch],
169
+ );
50
170
 
51
- const ToolbarRoot = ({ children, onAction, classNames }: ToolbarProps) => {
52
171
  return (
53
- <ToolbarContextProvider onAction={onAction}>
54
- <DensityProvider density='fine'>
55
- <ElevationProvider elevation='chrome'>
56
- <NaturalToolbar.Root classNames={['is-full shrink-0 overflow-x-auto overflow-y-hidden p-1', classNames]}>
57
- {children}
58
- </NaturalToolbar.Root>
59
- </ElevationProvider>
60
- </DensityProvider>
172
+ <ToolbarContextProvider onAction={handleAction}>
173
+ <NaturalToolbar.Root
174
+ classNames={[
175
+ ...(role === 'section'
176
+ ? ['z-[2] group-focus-within/section:visible', !hasAttention && 'invisible', sectionToolbarLayout]
177
+ : ['attention-surface']),
178
+ classNames,
179
+ ]}
180
+ >
181
+ {children}
182
+ </NaturalToolbar.Root>
61
183
  </ToolbarContextProvider>
62
184
  );
63
185
  };
64
186
 
65
187
  // TODO(burdon): Generalize.
66
188
  // TODO(burdon): Detect and display current state.
67
- type ButtonProps = {
68
- type: ToolbarActionType;
69
- Icon: Icon;
70
- getState: (state: Formatting) => boolean;
71
- disabled?: (state: Formatting) => boolean;
189
+ type ButtonProps<T> = {
190
+ value: T;
191
+ icon: string;
192
+ disabled?: (state: Range) => boolean;
72
193
  };
73
194
 
74
195
  //
75
196
  // Alignment
76
197
  //
77
198
 
78
- const formatOptions: ButtonProps[] = [
79
- { type: 'date', Icon: Calendar, getState: (state) => false },
80
- { type: 'currency', Icon: CurrencyDollar, getState: (state) => false },
81
- ];
82
-
83
- const Format = () => {
84
- const { onAction } = useToolbarContext('Format');
85
- const { t } = useTranslation(SHEET_PLUGIN);
86
-
87
- return (
88
- <NaturalToolbar.ToggleGroup
89
- type='single'
90
- // value={cellStyles.filter(({ getState }) => state && getState(state)).map(({ type }) => type)}
91
- >
92
- {formatOptions.map(({ type, getState, Icon }) => (
93
- <ToolbarToggleButton
94
- key={type}
95
- value={type}
96
- Icon={Icon}
97
- // disabled={state?.blockType === 'codeblock'}
98
- // onClick={state ? () => onAction?.({ type, data: !getState(state) }) : undefined}
99
- onClick={() => onAction?.({ type })}
100
- >
101
- {t(`toolbar ${type} label`)}
102
- </ToolbarToggleButton>
103
- ))}
104
- </NaturalToolbar.ToggleGroup>
105
- );
106
- };
107
-
108
- const alignmentOptions: ButtonProps[] = [
109
- { type: 'left', Icon: TextAlignLeft, getState: (state) => false },
110
- { type: 'center', Icon: TextAlignCenter, getState: (state) => false },
111
- { type: 'right', Icon: TextAlignRight, getState: (state) => false },
199
+ const alignmentOptions: ButtonProps<AlignValue>[] = [
200
+ { value: 'start', icon: 'ph--text-align-left--regular' },
201
+ { value: 'center', icon: 'ph--text-align-center--regular' },
202
+ { value: 'end', icon: 'ph--text-align-right--regular' },
112
203
  ];
113
204
 
114
205
  const Alignment = () => {
206
+ const { cursor, model } = useSheetContext();
115
207
  const { onAction } = useToolbarContext('Alignment');
116
208
  const { t } = useTranslation(SHEET_PLUGIN);
117
209
 
210
+ const value = useMemo(
211
+ () =>
212
+ cursor
213
+ ? model.sheet.ranges?.find(
214
+ ({ range, key }) => key === alignKey && inRange(rangeFromIndex(model.sheet, range), cursor),
215
+ )?.value
216
+ : undefined,
217
+ [cursor, model.sheet.ranges],
218
+ );
219
+
118
220
  return (
119
221
  <NaturalToolbar.ToggleGroup
120
222
  type='single'
121
- // value={cellStyles.filter(({ getState }) => state && getState(state)).map(({ type }) => type)}
223
+ value={value}
224
+ onValueChange={(value: AlignValue) => onAction?.({ key: alignKey, value })}
122
225
  >
123
- {alignmentOptions.map(({ type, getState, Icon }) => (
124
- <ToolbarToggleButton
125
- key={type}
126
- value={type}
127
- Icon={Icon}
128
- // disabled={state?.blockType === 'codeblock'}
129
- // onClick={state ? () => onAction?.({ type, data: !getState(state) }) : undefined}
130
- onClick={() => onAction?.({ type })}
131
- >
132
- {t(`toolbar ${type} label`)}
133
- </ToolbarToggleButton>
226
+ {alignmentOptions.map(({ value, icon }) => (
227
+ <ToolbarItem itemType='toggleGroupItem' key={value} value={value} icon={icon}>
228
+ {t('toolbar action label', {
229
+ key: t(`range key ${alignKey} label`),
230
+ value: t(`range value ${value} label`),
231
+ })}
232
+ </ToolbarItem>
134
233
  ))}
135
234
  </NaturalToolbar.ToggleGroup>
136
235
  );
137
236
  };
138
237
 
139
- const styleOptions: ButtonProps[] = [
140
- { type: 'clear', Icon: Eraser, getState: (state) => false },
141
- { type: 'highlight', Icon: HighlighterCircle, getState: (state) => false },
142
- ];
238
+ const styleOptions: ButtonProps<StyleValue>[] = [{ value: 'highlight', icon: 'ph--highlighter--regular' }];
143
239
 
144
240
  const Styles = () => {
145
- const { onAction } = useToolbarContext('Alignment');
241
+ const { cursor, model } = useSheetContext();
242
+ const { onAction } = useToolbarContext('Styles');
146
243
  const { t } = useTranslation(SHEET_PLUGIN);
147
244
 
245
+ const activeValues = useMemo(
246
+ () =>
247
+ cursor
248
+ ? model.sheet.ranges
249
+ ?.filter(({ range, key }) => key === 'style' && inRange(rangeFromIndex(model.sheet, range), cursor))
250
+ .reduce((acc, { value }) => {
251
+ acc.add(value);
252
+ return acc;
253
+ }, new Set())
254
+ : undefined,
255
+ [cursor, model.sheet.ranges],
256
+ );
257
+
148
258
  return (
149
- <NaturalToolbar.ToggleGroup
150
- type='single'
151
- // value={cellStyles.filter(({ getState }) => state && getState(state)).map(({ type }) => type)}
152
- >
153
- {styleOptions.map(({ type, getState, Icon }) => (
154
- <ToolbarToggleButton
155
- key={type}
156
- value={type}
157
- Icon={Icon}
158
- // disabled={state?.blockType === 'codeblock'}
159
- // onClick={state ? () => onAction?.({ type, data: !getState(state) }) : undefined}
160
- onClick={() => onAction?.({ type })}
259
+ <>
260
+ {styleOptions.map(({ value, icon }) => (
261
+ <ToolbarItem
262
+ itemType='toggle'
263
+ key={value}
264
+ pressed={activeValues?.has(value)}
265
+ onPressedChange={(nextPressed: boolean) => onAction?.({ key: 'style', value: nextPressed ? value : 'unset' })}
266
+ icon={icon}
161
267
  >
162
- {t(`toolbar ${type} label`)}
163
- </ToolbarToggleButton>
268
+ {t(`toolbar ${value} label`)}
269
+ </ToolbarItem>
164
270
  ))}
165
- </NaturalToolbar.ToggleGroup>
271
+ </>
166
272
  );
167
273
  };
168
274
 
@@ -171,18 +277,46 @@ const Styles = () => {
171
277
  //
172
278
 
173
279
  const Actions = () => {
174
- // const { onAction } = useToolbarContext('Actions');
280
+ const { onAction } = useToolbarContext('Actions');
281
+ const { cursorFallbackRange, cursor, model } = useSheetContext();
175
282
  const { t } = useTranslation(SHEET_PLUGIN);
283
+
284
+ const overlapsCommentAnchor = (model.sheet.threads ?? [])
285
+ .filter(nonNullable)
286
+ .filter((thread) => thread.status !== 'resolved')
287
+ .some((thread) => {
288
+ if (!cursorFallbackRange) {
289
+ return false;
290
+ }
291
+ return rangeToIndex(model.sheet, cursorFallbackRange) === thread.anchor;
292
+ });
293
+
294
+ const tooltipLabelKey = !cursor
295
+ ? 'no cursor label'
296
+ : overlapsCommentAnchor
297
+ ? 'selection overlaps existing comment label'
298
+ : 'comment label';
299
+
176
300
  return (
177
- <ToolbarButton
301
+ <ToolbarItem
302
+ itemType='button'
178
303
  value='comment'
179
- Icon={ChatText}
304
+ icon='ph--chat-text--regular'
180
305
  data-testid='editor.toolbar.comment'
181
- // onClick={() => onAction?.({ type: 'comment' })}
182
- // disabled={!state || state.comment || !state.selection}
306
+ onClick={() => {
307
+ if (!(cursorFallbackRange && cursor)) {
308
+ return;
309
+ }
310
+ return onAction?.({
311
+ key: 'comment',
312
+ value: rangeToIndex(model.sheet, cursorFallbackRange),
313
+ cellContent: model.getCellText(cursor),
314
+ });
315
+ }}
316
+ disabled={!cursor || overlapsCommentAnchor}
183
317
  >
184
- {t('comment label')}
185
- </ToolbarButton>
318
+ {t(tooltipLabelKey)}
319
+ </ToolbarItem>
186
320
  );
187
321
  };
188
322
 
@@ -190,7 +324,6 @@ export const Toolbar = {
190
324
  Root: ToolbarRoot,
191
325
  Separator: ToolbarSeparator,
192
326
  Alignment,
193
- Format,
194
327
  Styles,
195
328
  Actions,
196
329
  };
@@ -2,9 +2,11 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import React from 'react';
5
+ import { lazy } from 'react';
6
6
 
7
7
  export * from './ComputeGraph';
8
+ export * from './GridSheet';
9
+ export * from './RangeList';
10
+ export * from './SheetContext';
8
11
 
9
- // Lazily load components for content surfaces.
10
- export const SheetContainer = React.lazy(() => import('./SheetContainer'));
12
+ export const SheetContainer = lazy(() => import('./SheetContainer'));