@dxos/plugin-sheet 0.8.4-main.bc674ce → 0.8.4-main.bcb3aa67d6

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 (281) hide show
  1. package/dist/lib/browser/{chunk-KE3AKN5W.mjs → chunk-CBNIKBPQ.mjs} +21 -140
  2. package/dist/lib/browser/chunk-CBNIKBPQ.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-GZ2EV64I.mjs +118 -0
  4. package/dist/lib/browser/chunk-GZ2EV64I.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
  6. package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
  7. package/dist/lib/browser/drop-axis-PB7F3LBV.mjs +23 -0
  8. package/dist/lib/browser/drop-axis-PB7F3LBV.mjs.map +7 -0
  9. package/dist/lib/browser/index.mjs +104 -86
  10. package/dist/lib/browser/index.mjs.map +4 -4
  11. package/dist/lib/browser/insert-axis-DH5CO4AY.mjs +16 -0
  12. package/dist/lib/browser/insert-axis-DH5CO4AY.mjs.map +7 -0
  13. package/dist/lib/browser/meta.json +1 -1
  14. package/dist/lib/browser/operations/index.mjs +13 -0
  15. package/dist/lib/browser/operations/index.mjs.map +7 -0
  16. package/dist/lib/browser/restore-axis-Y5H5IOC6.mjs +16 -0
  17. package/dist/lib/browser/restore-axis-Y5H5IOC6.mjs.map +7 -0
  18. package/dist/lib/browser/scroll-to-anchor-MN36E3X7.mjs +65 -0
  19. package/dist/lib/browser/scroll-to-anchor-MN36E3X7.mjs.map +7 -0
  20. package/dist/lib/browser/types/index.mjs +2 -3
  21. package/dist/lib/node-esm/{chunk-6J5L47IB.mjs → chunk-3ZYLQWHC.mjs} +21 -140
  22. package/dist/lib/node-esm/chunk-3ZYLQWHC.mjs.map +7 -0
  23. package/dist/lib/node-esm/chunk-74MOADQ7.mjs +119 -0
  24. package/dist/lib/node-esm/chunk-74MOADQ7.mjs.map +7 -0
  25. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
  26. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
  27. package/dist/lib/node-esm/drop-axis-UBBQCU6D.mjs +24 -0
  28. package/dist/lib/node-esm/drop-axis-UBBQCU6D.mjs.map +7 -0
  29. package/dist/lib/node-esm/index.mjs +104 -86
  30. package/dist/lib/node-esm/index.mjs.map +4 -4
  31. package/dist/lib/node-esm/insert-axis-S7BR2RSJ.mjs +17 -0
  32. package/dist/lib/node-esm/insert-axis-S7BR2RSJ.mjs.map +7 -0
  33. package/dist/lib/node-esm/meta.json +1 -1
  34. package/dist/lib/node-esm/operations/index.mjs +14 -0
  35. package/dist/lib/node-esm/operations/index.mjs.map +7 -0
  36. package/dist/lib/node-esm/restore-axis-6B25SOHX.mjs +17 -0
  37. package/dist/lib/node-esm/restore-axis-6B25SOHX.mjs.map +7 -0
  38. package/dist/lib/node-esm/scroll-to-anchor-YLB4MYGF.mjs +66 -0
  39. package/dist/lib/node-esm/scroll-to-anchor-YLB4MYGF.mjs.map +7 -0
  40. package/dist/lib/node-esm/types/index.mjs +2 -3
  41. package/dist/types/src/SheetPlugin.d.ts.map +1 -1
  42. package/dist/types/src/capabilities/anchor-sort.d.ts +6 -0
  43. package/dist/types/src/capabilities/anchor-sort.d.ts.map +1 -0
  44. package/dist/types/src/capabilities/compute-graph-registry.d.ts +5 -0
  45. package/dist/types/src/capabilities/compute-graph-registry.d.ts.map +1 -0
  46. package/dist/types/src/capabilities/index.d.ts +9 -5
  47. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  48. package/dist/types/src/capabilities/markdown.d.ts +5 -0
  49. package/dist/types/src/capabilities/markdown.d.ts.map +1 -0
  50. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  51. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  52. package/dist/types/src/capabilities/react-surface.d.ts +5 -0
  53. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  54. package/dist/types/src/capabilities/state.d.ts +6 -0
  55. package/dist/types/src/capabilities/state.d.ts.map +1 -0
  56. package/dist/types/src/capabilities/undo-mappings.d.ts +5 -0
  57. package/dist/types/src/capabilities/undo-mappings.d.ts.map +1 -0
  58. package/dist/types/src/components/ComputeGraph/compute-graph.stories.d.ts.map +1 -1
  59. package/dist/types/src/components/Sheet/Sheet.d.ts +29 -0
  60. package/dist/types/src/components/Sheet/Sheet.d.ts.map +1 -0
  61. package/dist/types/src/components/Sheet/index.d.ts +2 -0
  62. package/dist/types/src/components/Sheet/index.d.ts.map +1 -0
  63. package/dist/types/src/components/SheetContent/SheetCellEditor.stories.d.ts.map +1 -0
  64. package/dist/types/src/components/SheetContent/SheetContent.d.ts +10 -0
  65. package/dist/types/src/components/SheetContent/SheetContent.d.ts.map +1 -0
  66. package/dist/types/src/components/SheetContent/SheetContent.stories.d.ts +63 -0
  67. package/dist/types/src/components/SheetContent/SheetContent.stories.d.ts.map +1 -0
  68. package/dist/types/src/components/SheetContent/index.d.ts +2 -0
  69. package/dist/types/src/components/SheetContent/index.d.ts.map +1 -0
  70. package/dist/types/src/components/SheetContent/util.d.ts.map +1 -0
  71. package/dist/types/src/components/{SheetContext/SheetContext.d.ts → SheetRoot/SheetRoot.d.ts} +7 -5
  72. package/dist/types/src/components/SheetRoot/SheetRoot.d.ts.map +1 -0
  73. package/dist/types/src/components/SheetRoot/index.d.ts +2 -0
  74. package/dist/types/src/components/SheetRoot/index.d.ts.map +1 -0
  75. package/dist/types/src/components/SheetStatusbar/SheetStatusbar.d.ts +10 -0
  76. package/dist/types/src/components/SheetStatusbar/SheetStatusbar.d.ts.map +1 -0
  77. package/dist/types/src/components/SheetStatusbar/index.d.ts +2 -0
  78. package/dist/types/src/components/SheetStatusbar/index.d.ts.map +1 -0
  79. package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts +9 -5
  80. package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts.map +1 -1
  81. package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts +72 -68
  82. package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts.map +1 -1
  83. package/dist/types/src/components/SheetToolbar/align.d.ts +1 -1
  84. package/dist/types/src/components/SheetToolbar/align.d.ts.map +1 -1
  85. package/dist/types/src/components/SheetToolbar/style.d.ts +1 -1
  86. package/dist/types/src/components/SheetToolbar/style.d.ts.map +1 -1
  87. package/dist/types/src/components/index.d.ts +1 -4
  88. package/dist/types/src/components/index.d.ts.map +1 -1
  89. package/dist/types/src/{components → containers}/RangeList/RangeList.d.ts +1 -1
  90. package/dist/types/src/containers/RangeList/RangeList.d.ts.map +1 -0
  91. package/dist/types/src/containers/RangeList/index.d.ts +3 -0
  92. package/dist/types/src/containers/RangeList/index.d.ts.map +1 -0
  93. package/dist/types/src/containers/SheetContainer/SheetContainer.d.ts +12 -0
  94. package/dist/types/src/containers/SheetContainer/SheetContainer.d.ts.map +1 -0
  95. package/dist/types/src/containers/SheetContainer/SheetContainer.stories.d.ts +58 -0
  96. package/dist/types/src/containers/SheetContainer/SheetContainer.stories.d.ts.map +1 -0
  97. package/dist/types/src/{components → containers}/SheetContainer/index.d.ts.map +1 -1
  98. package/dist/types/src/containers/index.d.ts +4 -0
  99. package/dist/types/src/containers/index.d.ts.map +1 -0
  100. package/dist/types/src/extensions/compute.stories.d.ts.map +1 -1
  101. package/dist/types/src/integrations/thread-ranges.d.ts +0 -2
  102. package/dist/types/src/integrations/thread-ranges.d.ts.map +1 -1
  103. package/dist/types/src/model/sheet-model.d.ts +1 -1
  104. package/dist/types/src/model/sheet-model.d.ts.map +1 -1
  105. package/dist/types/src/model/testing.d.ts +1 -1
  106. package/dist/types/src/model/testing.d.ts.map +1 -1
  107. package/dist/types/src/model/useSheetModel.d.ts +1 -1
  108. package/dist/types/src/model/useSheetModel.d.ts.map +1 -1
  109. package/dist/types/src/operations/definitions.d.ts +45 -0
  110. package/dist/types/src/operations/definitions.d.ts.map +1 -0
  111. package/dist/types/src/operations/drop-axis.d.ts +5 -0
  112. package/dist/types/src/operations/drop-axis.d.ts.map +1 -0
  113. package/dist/types/src/operations/index.d.ts +4 -0
  114. package/dist/types/src/operations/index.d.ts.map +1 -0
  115. package/dist/types/src/operations/insert-axis.d.ts +5 -0
  116. package/dist/types/src/operations/insert-axis.d.ts.map +1 -0
  117. package/dist/types/src/operations/restore-axis.d.ts +5 -0
  118. package/dist/types/src/operations/restore-axis.d.ts.map +1 -0
  119. package/dist/types/src/operations/scroll-to-anchor.d.ts +5 -0
  120. package/dist/types/src/operations/scroll-to-anchor.d.ts.map +1 -0
  121. package/dist/types/src/serializer.d.ts +1 -1
  122. package/dist/types/src/serializer.d.ts.map +1 -1
  123. package/dist/types/src/testing/data.d.ts +1 -1
  124. package/dist/types/src/testing/data.d.ts.map +1 -1
  125. package/dist/types/src/testing/testing.d.ts +5 -5
  126. package/dist/types/src/testing/testing.d.ts.map +1 -1
  127. package/dist/types/src/translations.d.ts +38 -36
  128. package/dist/types/src/translations.d.ts.map +1 -1
  129. package/dist/types/src/types/Sheet.d.ts +7 -7
  130. package/dist/types/src/types/Sheet.d.ts.map +1 -1
  131. package/dist/types/src/types/capabilities.d.ts +12 -0
  132. package/dist/types/src/types/capabilities.d.ts.map +1 -1
  133. package/dist/types/src/types/types.d.ts +0 -92
  134. package/dist/types/src/types/types.d.ts.map +1 -1
  135. package/dist/types/tsconfig.tsbuildinfo +1 -1
  136. package/package.json +81 -63
  137. package/src/SheetPlugin.tsx +46 -28
  138. package/src/capabilities/{anchor-sort/anchor-sort.ts → anchor-sort.ts} +4 -3
  139. package/src/capabilities/{compute-graph-registry/compute-graph-registry.ts → compute-graph-registry.ts} +2 -2
  140. package/src/capabilities/index.ts +13 -5
  141. package/src/capabilities/{markdown/markdown.ts → markdown.ts} +2 -2
  142. package/src/capabilities/operation-handler.ts +16 -0
  143. package/src/capabilities/react-surface.tsx +49 -0
  144. package/src/capabilities/state.ts +29 -0
  145. package/src/capabilities/undo-mappings.ts +30 -0
  146. package/src/components/ComputeGraph/compute-graph.stories.tsx +13 -8
  147. package/src/components/Sheet/Sheet.tsx +20 -0
  148. package/src/components/Sheet/index.ts +5 -0
  149. package/src/components/{GridSheet → SheetContent}/SheetCellEditor.stories.tsx +6 -6
  150. package/src/components/{GridSheet/GridSheet.stories.tsx → SheetContent/SheetContent.stories.tsx} +15 -14
  151. package/src/components/{GridSheet/GridSheet.tsx → SheetContent/SheetContent.tsx} +42 -22
  152. package/src/components/{RangeList → SheetContent}/index.ts +1 -1
  153. package/src/components/{GridSheet → SheetContent}/util.ts +4 -4
  154. package/src/components/{SheetContext/SheetContext.tsx → SheetRoot/SheetRoot.tsx} +45 -38
  155. package/src/components/{GridSheet → SheetRoot}/index.ts +1 -1
  156. package/src/components/{FunctionEditor/FunctionEditor.tsx → SheetStatusbar/SheetStatusbar.tsx} +19 -7
  157. package/src/components/{FunctionEditor → SheetStatusbar}/index.ts +1 -1
  158. package/src/components/SheetToolbar/SheetToolbar.stories.tsx +4 -4
  159. package/src/components/SheetToolbar/SheetToolbar.tsx +18 -21
  160. package/src/components/SheetToolbar/align.ts +13 -13
  161. package/src/components/SheetToolbar/style.ts +10 -10
  162. package/src/components/index.ts +1 -7
  163. package/src/{components → containers}/RangeList/RangeList.tsx +16 -15
  164. package/src/containers/RangeList/index.ts +7 -0
  165. package/src/{components → containers}/SheetContainer/SheetContainer.stories.tsx +38 -42
  166. package/src/containers/SheetContainer/SheetContainer.tsx +57 -0
  167. package/src/{components → containers}/SheetContainer/index.ts +1 -1
  168. package/src/containers/index.ts +8 -0
  169. package/src/extensions/compute.stories.tsx +13 -12
  170. package/src/extensions/editor/sheet-extension.ts +10 -10
  171. package/src/integrations/thread-ranges.ts +6 -39
  172. package/src/meta.ts +1 -1
  173. package/src/model/sheet-model.test.ts +3 -3
  174. package/src/model/sheet-model.ts +38 -36
  175. package/src/model/testing.ts +1 -1
  176. package/src/model/useSheetModel.ts +1 -1
  177. package/src/operations/definitions.ts +73 -0
  178. package/src/operations/drop-axis.ts +26 -0
  179. package/src/operations/index.ts +14 -0
  180. package/src/operations/insert-axis.ts +19 -0
  181. package/src/operations/restore-axis.ts +19 -0
  182. package/src/operations/scroll-to-anchor.ts +31 -0
  183. package/src/playwright/playwright.config.ts +1 -1
  184. package/src/playwright/sheet.spec.ts +1 -1
  185. package/src/sanity.test.ts +6 -3
  186. package/src/serializer.ts +1 -1
  187. package/src/testing/data.ts +1 -1
  188. package/src/testing/testing.tsx +2 -2
  189. package/src/translations.ts +38 -36
  190. package/src/types/Sheet.ts +13 -7
  191. package/src/types/capabilities.ts +14 -2
  192. package/src/types/sheet-range-types.ts +3 -3
  193. package/src/types/types.ts +0 -80
  194. package/dist/lib/browser/SheetContainer-J72HS2FI.mjs +0 -397
  195. package/dist/lib/browser/SheetContainer-J72HS2FI.mjs.map +0 -7
  196. package/dist/lib/browser/anchor-sort-LLO7PZKF.mjs +0 -23
  197. package/dist/lib/browser/anchor-sort-LLO7PZKF.mjs.map +0 -7
  198. package/dist/lib/browser/chunk-IFLWVS2V.mjs +0 -234
  199. package/dist/lib/browser/chunk-IFLWVS2V.mjs.map +0 -7
  200. package/dist/lib/browser/chunk-KE3AKN5W.mjs.map +0 -7
  201. package/dist/lib/browser/chunk-S27QJYTN.mjs +0 -1473
  202. package/dist/lib/browser/chunk-S27QJYTN.mjs.map +0 -7
  203. package/dist/lib/browser/compute-graph-registry-RC5L7RE4.mjs +0 -21
  204. package/dist/lib/browser/compute-graph-registry-RC5L7RE4.mjs.map +0 -7
  205. package/dist/lib/browser/markdown-D2T2DOVX.mjs +0 -29
  206. package/dist/lib/browser/markdown-D2T2DOVX.mjs.map +0 -7
  207. package/dist/lib/browser/operation-resolver-YDOW72CN.mjs +0 -79
  208. package/dist/lib/browser/operation-resolver-YDOW72CN.mjs.map +0 -7
  209. package/dist/lib/browser/react-surface-JIYVFH42.mjs +0 -51
  210. package/dist/lib/browser/react-surface-JIYVFH42.mjs.map +0 -7
  211. package/dist/lib/node-esm/SheetContainer-OGSSDOZU.mjs +0 -398
  212. package/dist/lib/node-esm/SheetContainer-OGSSDOZU.mjs.map +0 -7
  213. package/dist/lib/node-esm/anchor-sort-OX5I2YOW.mjs +0 -24
  214. package/dist/lib/node-esm/anchor-sort-OX5I2YOW.mjs.map +0 -7
  215. package/dist/lib/node-esm/chunk-6J5L47IB.mjs.map +0 -7
  216. package/dist/lib/node-esm/chunk-PPOYR7DK.mjs +0 -236
  217. package/dist/lib/node-esm/chunk-PPOYR7DK.mjs.map +0 -7
  218. package/dist/lib/node-esm/chunk-Y4V6HVHO.mjs +0 -1474
  219. package/dist/lib/node-esm/chunk-Y4V6HVHO.mjs.map +0 -7
  220. package/dist/lib/node-esm/compute-graph-registry-ZGXVLVGD.mjs +0 -22
  221. package/dist/lib/node-esm/compute-graph-registry-ZGXVLVGD.mjs.map +0 -7
  222. package/dist/lib/node-esm/markdown-PTV72DLO.mjs +0 -30
  223. package/dist/lib/node-esm/markdown-PTV72DLO.mjs.map +0 -7
  224. package/dist/lib/node-esm/operation-resolver-Q63VQBVA.mjs +0 -80
  225. package/dist/lib/node-esm/operation-resolver-Q63VQBVA.mjs.map +0 -7
  226. package/dist/lib/node-esm/react-surface-SWRZSZVR.mjs +0 -52
  227. package/dist/lib/node-esm/react-surface-SWRZSZVR.mjs.map +0 -7
  228. package/dist/types/src/capabilities/anchor-sort/anchor-sort.d.ts +0 -5
  229. package/dist/types/src/capabilities/anchor-sort/anchor-sort.d.ts.map +0 -1
  230. package/dist/types/src/capabilities/anchor-sort/index.d.ts +0 -3
  231. package/dist/types/src/capabilities/anchor-sort/index.d.ts.map +0 -1
  232. package/dist/types/src/capabilities/compute-graph-registry/compute-graph-registry.d.ts +0 -5
  233. package/dist/types/src/capabilities/compute-graph-registry/compute-graph-registry.d.ts.map +0 -1
  234. package/dist/types/src/capabilities/compute-graph-registry/index.d.ts +0 -3
  235. package/dist/types/src/capabilities/compute-graph-registry/index.d.ts.map +0 -1
  236. package/dist/types/src/capabilities/markdown/index.d.ts +0 -3
  237. package/dist/types/src/capabilities/markdown/index.d.ts.map +0 -1
  238. package/dist/types/src/capabilities/markdown/markdown.d.ts +0 -5
  239. package/dist/types/src/capabilities/markdown/markdown.d.ts.map +0 -1
  240. package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
  241. package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
  242. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
  243. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
  244. package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
  245. package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
  246. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +0 -5
  247. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
  248. package/dist/types/src/components/FunctionEditor/FunctionEditor.d.ts +0 -3
  249. package/dist/types/src/components/FunctionEditor/FunctionEditor.d.ts.map +0 -1
  250. package/dist/types/src/components/FunctionEditor/index.d.ts +0 -2
  251. package/dist/types/src/components/FunctionEditor/index.d.ts.map +0 -1
  252. package/dist/types/src/components/GridSheet/GridSheet.d.ts +0 -3
  253. package/dist/types/src/components/GridSheet/GridSheet.d.ts.map +0 -1
  254. package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts +0 -55
  255. package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +0 -1
  256. package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts.map +0 -1
  257. package/dist/types/src/components/GridSheet/index.d.ts +0 -2
  258. package/dist/types/src/components/GridSheet/index.d.ts.map +0 -1
  259. package/dist/types/src/components/GridSheet/util.d.ts.map +0 -1
  260. package/dist/types/src/components/RangeList/RangeList.d.ts.map +0 -1
  261. package/dist/types/src/components/RangeList/index.d.ts +0 -2
  262. package/dist/types/src/components/RangeList/index.d.ts.map +0 -1
  263. package/dist/types/src/components/SheetContainer/SheetContainer.d.ts +0 -10
  264. package/dist/types/src/components/SheetContainer/SheetContainer.d.ts.map +0 -1
  265. package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts +0 -57
  266. package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +0 -1
  267. package/dist/types/src/components/SheetContext/SheetContext.d.ts.map +0 -1
  268. package/dist/types/src/components/SheetContext/index.d.ts +0 -2
  269. package/dist/types/src/components/SheetContext/index.d.ts.map +0 -1
  270. package/src/capabilities/anchor-sort/index.ts +0 -7
  271. package/src/capabilities/compute-graph-registry/index.ts +0 -7
  272. package/src/capabilities/markdown/index.ts +0 -7
  273. package/src/capabilities/operation-resolver/index.ts +0 -7
  274. package/src/capabilities/operation-resolver/operation-resolver.ts +0 -77
  275. package/src/capabilities/react-surface/index.ts +0 -7
  276. package/src/capabilities/react-surface/react-surface.tsx +0 -43
  277. package/src/components/SheetContainer/SheetContainer.tsx +0 -48
  278. package/src/components/SheetContext/index.ts +0 -5
  279. /package/dist/types/src/components/{GridSheet → SheetContent}/SheetCellEditor.stories.d.ts +0 -0
  280. /package/dist/types/src/components/{GridSheet → SheetContent}/util.d.ts +0 -0
  281. /package/dist/types/src/{components → containers}/SheetContainer/index.d.ts +0 -0
@@ -1,1473 +0,0 @@
1
- import {
2
- rangeExtension,
3
- sheetExtension
4
- } from "./chunk-IFLWVS2V.mjs";
5
- import {
6
- DEFAULT_COLS,
7
- DEFAULT_ROWS,
8
- MAX_COLS,
9
- MAX_ROWS,
10
- ReadonlyException,
11
- SheetOperation,
12
- Sheet_exports,
13
- addressFromIndex,
14
- addressToIndex,
15
- cellClassNameForRange,
16
- initialize,
17
- insertIndices,
18
- mapFormulaIndicesToRefs,
19
- mapFormulaRefsToIndices,
20
- meta,
21
- rangeFromIndex
22
- } from "./chunk-KE3AKN5W.mjs";
23
-
24
- // src/components/ComputeGraph/ComputeGraphContextProvider.tsx
25
- import React, { createContext, useContext } from "react";
26
- import { raise } from "@dxos/debug";
27
- import { useAsyncState } from "@dxos/react-hooks";
28
- var ComputeGraphContext = /* @__PURE__ */ createContext(void 0);
29
- var ComputeGraphContextProvider = ({ registry, children }) => {
30
- return /* @__PURE__ */ React.createElement(ComputeGraphContext.Provider, {
31
- value: {
32
- registry
33
- }
34
- }, children);
35
- };
36
- var useComputeGraph = (space) => {
37
- const { registry } = useContext(ComputeGraphContext) ?? raise(new Error("Missing ComputeGraphContext"));
38
- const [graph] = useAsyncState(async () => {
39
- if (space) {
40
- const graph2 = registry.getOrCreateGraph(space);
41
- await graph2.open();
42
- return graph2;
43
- }
44
- }, [
45
- space,
46
- registry
47
- ]);
48
- return graph;
49
- };
50
-
51
- // src/components/RangeList/RangeList.tsx
52
- import * as Schema from "effect/Schema";
53
- import React2, { useCallback } from "react";
54
- import { rangeToA1Notation } from "@dxos/compute";
55
- import { Obj } from "@dxos/echo";
56
- import { Callout, useTranslation } from "@dxos/react-ui";
57
- import { List } from "@dxos/react-ui-list";
58
- import { ghostHover } from "@dxos/ui-theme";
59
- var RangeList = ({ sheet }) => {
60
- const { t } = useTranslation(meta.id);
61
- const handleSelectRange = (range) => {
62
- };
63
- const handleDeleteRange = useCallback((range) => {
64
- const index = sheet.ranges.findIndex((sheetRange) => sheetRange === range);
65
- Obj.change(sheet, (s) => {
66
- s.ranges.splice(index, 1);
67
- });
68
- }, [
69
- sheet
70
- ]);
71
- return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement("h2", {
72
- className: "mbs-cardSpacingBlock mbe-labelSpacingBlock text-sm font-semibold"
73
- }, t("range list heading")), sheet.ranges.length < 1 ? /* @__PURE__ */ React2.createElement(Callout.Root, null, /* @__PURE__ */ React2.createElement(Callout.Title, null, t("no ranges message"))) : /* @__PURE__ */ React2.createElement(List.Root, {
74
- items: sheet.ranges,
75
- isItem: Schema.is(Sheet_exports.Range)
76
- }, ({ items: ranges }) => ranges.map((range, i) => /* @__PURE__ */ React2.createElement(List.Item, {
77
- key: i,
78
- item: range,
79
- classNames: [
80
- "p-2",
81
- ghostHover
82
- ]
83
- }, /* @__PURE__ */ React2.createElement(List.ItemDragHandle, null), /* @__PURE__ */ React2.createElement(List.ItemTitle, {
84
- onClick: () => handleSelectRange(range)
85
- }, t("range title", {
86
- position: rangeToA1Notation(rangeFromIndex(sheet, range.range)),
87
- key: t(`range key ${range.key} label`),
88
- value: t(`range value ${range.value} label`)
89
- })), /* @__PURE__ */ React2.createElement(List.ItemDeleteButton, {
90
- onClick: () => handleDeleteRange(range)
91
- })))));
92
- };
93
-
94
- // src/components/index.ts
95
- import { lazy } from "react";
96
-
97
- // src/components/GridSheet/GridSheet.tsx
98
- import React4, { useCallback as useCallback4, useMemo as useMemo2, useRef, useState as useState4 } from "react";
99
- import { useOperationInvoker as useOperationInvoker2 } from "@dxos/app-framework/react";
100
- import { rangeToA1Notation as rangeToA1Notation2 } from "@dxos/compute";
101
- import { Obj as Obj5 } from "@dxos/echo";
102
- import { defaultColSize, defaultRowSize } from "@dxos/lit-grid";
103
- import { DropdownMenu, Icon, useTranslation as useTranslation2 } from "@dxos/react-ui";
104
- import { useAttention } from "@dxos/react-ui-attention";
105
- import { Grid as Grid2, GridCellEditor, closestCell, editorKeys, parseCellIndex } from "@dxos/react-ui-grid";
106
-
107
- // src/integrations/thread-ranges.ts
108
- import * as Effect from "effect/Effect";
109
- import { useCallback as useCallback2, useEffect, useMemo } from "react";
110
- import { Common } from "@dxos/app-framework";
111
- import { useOperationInvoker, useOperationResolver } from "@dxos/app-framework/react";
112
- import { debounce } from "@dxos/async";
113
- import { inRange } from "@dxos/compute";
114
- import { Obj as Obj2, Relation } from "@dxos/echo";
115
- import { OperationResolver } from "@dxos/operation";
116
- import { ATTENDABLE_PATH_SEPARATOR, DeckOperation } from "@dxos/plugin-deck/types";
117
- import { ThreadOperation } from "@dxos/plugin-thread/types";
118
- import { Filter, Query, useQuery } from "@dxos/react-client/echo";
119
- import { AnchoredTo, Thread } from "@dxos/types";
120
- var parseThreadAnchorAsCellRange = (cursor) => {
121
- const coords = cursor.split(",");
122
- if (coords.length !== 4) {
123
- return null;
124
- } else {
125
- const [fromCol, fromRow, toCol, toRow] = coords;
126
- return {
127
- from: {
128
- col: parseInt(fromCol),
129
- row: parseInt(fromRow)
130
- },
131
- to: {
132
- col: parseInt(toCol),
133
- row: parseInt(toRow)
134
- }
135
- };
136
- }
137
- };
138
- var useUpdateFocusedCellOnThreadSelection = (grid) => {
139
- const { model, setActiveRefs } = useSheetContext();
140
- const sheetId = Obj2.getDXN(model.sheet).toString();
141
- const scrollIntoViewHandler = useMemo(() => OperationResolver.make({
142
- operation: Common.LayoutOperation.ScrollIntoView,
143
- position: "hoist",
144
- filter: (input) => input.subject === sheetId && !!input.cursor,
145
- handler: (input) => Effect.sync(() => {
146
- const { cursor, ref } = input;
147
- if (cursor) {
148
- setActiveRefs(ref);
149
- const range = parseThreadAnchorAsCellRange(cursor);
150
- range && grid?.setFocus({
151
- ...range.to,
152
- plane: "grid"
153
- }, true);
154
- }
155
- })
156
- }), [
157
- sheetId,
158
- setActiveRefs,
159
- grid
160
- ]);
161
- useOperationResolver(meta.id, scrollIntoViewHandler);
162
- };
163
- var useSelectThreadOnCellFocus = () => {
164
- const { model, cursor } = useSheetContext();
165
- const { invokePromise } = useOperationInvoker();
166
- const db = Obj2.getDatabase(model.sheet);
167
- const anchors = useQuery(db, Query.select(Filter.id(model.sheet.id)).targetOf(AnchoredTo.AnchoredTo));
168
- const selectClosestThread = useCallback2((cellAddress) => {
169
- if (!cellAddress) {
170
- return;
171
- }
172
- const closestThread = anchors.find((anchor) => {
173
- const source = Relation.getSource(anchor);
174
- if (anchor.anchor && Obj2.instanceOf(Thread.Thread, source)) {
175
- const range = parseThreadAnchorAsCellRange(anchor.anchor);
176
- return range ? inRange(range, cellAddress) : false;
177
- } else {
178
- return false;
179
- }
180
- });
181
- if (closestThread) {
182
- const primary = Obj2.getDXN(model.sheet).toString();
183
- void (async () => {
184
- await invokePromise(ThreadOperation.Select, {
185
- current: Relation.getDXN(closestThread).toString()
186
- });
187
- await invokePromise(DeckOperation.ChangeCompanion, {
188
- primary,
189
- companion: `${primary}${ATTENDABLE_PATH_SEPARATOR}comments`
190
- });
191
- })();
192
- }
193
- }, [
194
- invokePromise,
195
- anchors
196
- ]);
197
- const debounced = useMemo(() => {
198
- return debounce((cellCoords) => requestAnimationFrame(() => selectClosestThread(cellCoords)), 50);
199
- }, [
200
- selectClosestThread
201
- ]);
202
- useEffect(() => {
203
- if (!cursor) {
204
- return;
205
- }
206
- debounced(cursor);
207
- }, [
208
- cursor,
209
- debounced
210
- ]);
211
- };
212
-
213
- // src/components/SheetContext/SheetContext.tsx
214
- import React3, { createContext as createContext2, useCallback as useCallback3, useContext as useContext2, useState as useState2 } from "react";
215
- import { Obj as Obj4 } from "@dxos/echo";
216
- import { invariant as invariant2 } from "@dxos/invariant";
217
- import { Grid, useGridContext } from "@dxos/react-ui-grid";
218
-
219
- // src/model/sheet-model.ts
220
- import { Event } from "@dxos/async";
221
- import { DetailedCellError, ExportedCellChange, addressFromA1Notation, addressToA1Notation, createSheetName, isFormula } from "@dxos/compute";
222
- import { Resource } from "@dxos/context";
223
- import { Obj as Obj3 } from "@dxos/echo";
224
- import { Format, TypeEnum } from "@dxos/echo/internal";
225
- import { invariant } from "@dxos/invariant";
226
- import { PublicKey } from "@dxos/keys";
227
- import { log } from "@dxos/log";
228
- var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-sheet/src/model/sheet-model.ts";
229
- var typeMap = {
230
- BOOLEAN: {
231
- type: TypeEnum.Boolean
232
- },
233
- NUMBER_RAW: {
234
- type: TypeEnum.Number
235
- },
236
- NUMBER_PERCENT: {
237
- type: TypeEnum.Number,
238
- format: Format.TypeFormat.Percent
239
- },
240
- NUMBER_CURRENCY: {
241
- type: TypeEnum.Number,
242
- format: Format.TypeFormat.Currency
243
- },
244
- NUMBER_DATETIME: {
245
- type: TypeEnum.String,
246
- format: Format.TypeFormat.DateTime
247
- },
248
- NUMBER_DATE: {
249
- type: TypeEnum.String,
250
- format: Format.TypeFormat.Date
251
- },
252
- NUMBER_TIME: {
253
- type: TypeEnum.String,
254
- format: Format.TypeFormat.Time
255
- }
256
- };
257
- var getTopLeft = (range) => {
258
- const to = range.to ?? range.from;
259
- return {
260
- row: Math.min(range.from.row, to.row),
261
- col: Math.min(range.from.col, to.col)
262
- };
263
- };
264
- var toSimpleCellAddress = (sheet, cell) => ({
265
- sheet,
266
- row: cell.row,
267
- col: cell.col
268
- });
269
- var toModelRange = (sheet, range) => ({
270
- start: toSimpleCellAddress(sheet, range.from),
271
- end: toSimpleCellAddress(sheet, range.to ?? range.from)
272
- });
273
- var SheetModel = class extends Resource {
274
- _graph;
275
- _sheet;
276
- _options;
277
- id = `model-${PublicKey.random().truncate()}`;
278
- // Wraps compute node.
279
- update = new Event();
280
- _node;
281
- constructor(_graph, _sheet, _options = {}) {
282
- super(), this._graph = _graph, this._sheet = _sheet, this._options = _options;
283
- }
284
- get graph() {
285
- return this._graph;
286
- }
287
- get sheet() {
288
- return this._sheet;
289
- }
290
- get readonly() {
291
- return this._options.readonly;
292
- }
293
- get bounds() {
294
- return {
295
- rows: this._sheet.rows.length,
296
- columns: this._sheet.columns.length
297
- };
298
- }
299
- /**
300
- * Initialize sheet and engine.
301
- */
302
- async _open() {
303
- log("initialize", {
304
- id: this.id
305
- }, {
306
- F: __dxlog_file,
307
- L: 124,
308
- S: this,
309
- C: (f, a) => f(...a)
310
- });
311
- Obj3.change(this._sheet, (s) => {
312
- initialize(s);
313
- });
314
- this._graph.update.on((event) => {
315
- if (event.type === "functionsUpdated") {
316
- this.reset();
317
- }
318
- });
319
- this._node = this._graph.getOrCreateNode(createSheetName({
320
- type: Obj3.getTypename(this._sheet),
321
- id: this._sheet.id
322
- }));
323
- await this._node.open();
324
- const unsubscribe = this._node.update.on((event) => this.update.emit(event));
325
- this._ctx.onDispose(unsubscribe);
326
- this.reset();
327
- }
328
- /**
329
- * Update engine.
330
- * NOTE: This resets the undo history.
331
- * @deprecated
332
- */
333
- reset() {
334
- invariant(this._node, void 0, {
335
- F: __dxlog_file,
336
- L: 154,
337
- S: this,
338
- A: [
339
- "this._node",
340
- ""
341
- ]
342
- });
343
- this._node.graph.hf.clearSheet(this._node.sheetId);
344
- Object.entries(this._sheet.cells).forEach(([key, { value }]) => {
345
- invariant(this._node, void 0, {
346
- F: __dxlog_file,
347
- L: 157,
348
- S: this,
349
- A: [
350
- "this._node",
351
- ""
352
- ]
353
- });
354
- const { col, row } = addressFromIndex(this._sheet, key);
355
- if (isFormula(value)) {
356
- const binding = this._graph.mapFunctionBindingFromId(mapFormulaIndicesToRefs(this._sheet, value));
357
- if (binding) {
358
- value = this._graph.mapFormulaToNative(binding);
359
- } else {
360
- value = "";
361
- }
362
- }
363
- this._node.graph.hf.setCellContents({
364
- sheet: this._node.sheetId,
365
- row,
366
- col
367
- }, value);
368
- });
369
- }
370
- /**
371
- * Recalculate formulas.
372
- * NOTE: This resets the undo history.
373
- * https://hyperformula.handsontable.com/guide/volatile-functions.html#volatile-actions
374
- * @deprecated
375
- */
376
- // TODO(burdon): Remove.
377
- recalculate() {
378
- this._node?.graph.hf.rebuildAndRecalculate();
379
- }
380
- insertRows(i, n = 1) {
381
- let idx = [];
382
- Obj3.change(this._sheet, (s) => {
383
- idx = insertIndices(s.rows, i, n, MAX_ROWS);
384
- });
385
- this.reset();
386
- return idx;
387
- }
388
- insertColumns(i, n = 1) {
389
- let idx = [];
390
- Obj3.change(this._sheet, (s) => {
391
- idx = insertIndices(s.columns, i, n, MAX_COLS);
392
- });
393
- this.reset();
394
- return idx;
395
- }
396
- dropRow(rowIndex) {
397
- const range = {
398
- from: addressFromIndex(this._sheet, `${this._sheet.columns[0]}@${rowIndex}`),
399
- to: addressFromIndex(this._sheet, `${this._sheet.columns[this._sheet.columns.length - 1]}@${rowIndex}`)
400
- };
401
- const values = this.getCellValues(range).flat();
402
- const index = this._sheet.rows.indexOf(rowIndex);
403
- this.clear(range);
404
- Obj3.change(this._sheet, (s) => {
405
- s.rows.splice(index, 1);
406
- delete s.rowMeta[rowIndex];
407
- });
408
- this.reset();
409
- return {
410
- axis: "row",
411
- index,
412
- axisIndex: rowIndex,
413
- axisMeta: this._sheet.rowMeta[rowIndex],
414
- values
415
- };
416
- }
417
- dropColumn(colIndex) {
418
- const range = {
419
- from: addressFromIndex(this._sheet, `${colIndex}@${this._sheet.rows[0]}`),
420
- to: addressFromIndex(this._sheet, `${colIndex}@${this._sheet.rows[this._sheet.rows.length - 1]}`)
421
- };
422
- const values = this.getCellValues(range).flat();
423
- const index = this._sheet.columns.indexOf(colIndex);
424
- this.clear(range);
425
- Obj3.change(this._sheet, (s) => {
426
- s.columns.splice(index, 1);
427
- delete s.columnMeta[colIndex];
428
- });
429
- this.reset();
430
- return {
431
- axis: "col",
432
- index,
433
- axisIndex: colIndex,
434
- axisMeta: this._sheet.rowMeta[colIndex],
435
- values
436
- };
437
- }
438
- restoreRow({ index, axisIndex, axisMeta, values }) {
439
- Obj3.change(this._sheet, (s) => {
440
- s.rows.splice(index, 0, axisIndex);
441
- values.forEach((value, col) => {
442
- if (value) {
443
- s.cells[`${s.columns[col]}@${axisIndex}`] = {
444
- value
445
- };
446
- }
447
- });
448
- if (axisMeta) {
449
- s.rowMeta[axisIndex] = axisMeta;
450
- }
451
- });
452
- this.reset();
453
- }
454
- restoreColumn({ index, axisIndex, axisMeta, values }) {
455
- Obj3.change(this._sheet, (s) => {
456
- s.columns.splice(index, 0, axisIndex);
457
- values.forEach((value, row) => {
458
- if (value) {
459
- s.cells[`${axisIndex}@${s.rows[row]}`] = {
460
- value
461
- };
462
- }
463
- });
464
- if (axisMeta) {
465
- s.columnMeta[axisIndex] = axisMeta;
466
- }
467
- });
468
- this.reset();
469
- }
470
- //
471
- // Undoable actions.
472
- // TODO(burdon): Group undoable methods; consistently update hf/sheet.
473
- //
474
- /**
475
- * Clear range of values.
476
- */
477
- clear(range) {
478
- invariant(this._node, void 0, {
479
- F: __dxlog_file,
480
- L: 274,
481
- S: this,
482
- A: [
483
- "this._node",
484
- ""
485
- ]
486
- });
487
- const topLeft = getTopLeft(range);
488
- const values = this._iterRange(range, () => null);
489
- this._node.graph.hf.setCellContents(toSimpleCellAddress(this._node.sheetId, topLeft), values);
490
- Obj3.change(this._sheet, (s) => {
491
- this._iterRange(range, (cell) => {
492
- const idx = addressToIndex(this._sheet, cell);
493
- delete s.cells[idx];
494
- });
495
- });
496
- }
497
- cut(range) {
498
- invariant(this._node, void 0, {
499
- F: __dxlog_file,
500
- L: 287,
501
- S: this,
502
- A: [
503
- "this._node",
504
- ""
505
- ]
506
- });
507
- this._node.graph.hf.cut(toModelRange(this._node.sheetId, range));
508
- Obj3.change(this._sheet, (s) => {
509
- this._iterRange(range, (cell) => {
510
- const idx = addressToIndex(this._sheet, cell);
511
- delete s.cells[idx];
512
- });
513
- });
514
- }
515
- copy(range) {
516
- invariant(this._node, void 0, {
517
- F: __dxlog_file,
518
- L: 298,
519
- S: this,
520
- A: [
521
- "this._node",
522
- ""
523
- ]
524
- });
525
- this._node.graph.hf.copy(toModelRange(this._node.sheetId, range));
526
- }
527
- paste(cell) {
528
- invariant(this._node, void 0, {
529
- F: __dxlog_file,
530
- L: 303,
531
- S: this,
532
- A: [
533
- "this._node",
534
- ""
535
- ]
536
- });
537
- if (!this._node.graph.hf.isClipboardEmpty()) {
538
- const changes = this._node.graph.hf.paste(toSimpleCellAddress(this._node.sheetId, cell));
539
- Obj3.change(this._sheet, (s) => {
540
- for (const change of changes) {
541
- if (change instanceof ExportedCellChange) {
542
- const { address, newValue } = change;
543
- const idx = addressToIndex(this._sheet, {
544
- row: address.row,
545
- col: address.col
546
- });
547
- s.cells[idx] = {
548
- value: newValue
549
- };
550
- }
551
- }
552
- });
553
- }
554
- }
555
- // TODO(burdon): Display undo/redo state.
556
- undo() {
557
- invariant(this._node, void 0, {
558
- F: __dxlog_file,
559
- L: 320,
560
- S: this,
561
- A: [
562
- "this._node",
563
- ""
564
- ]
565
- });
566
- if (this._node.graph.hf.isThereSomethingToUndo()) {
567
- this._node.graph.hf.undo();
568
- }
569
- }
570
- redo() {
571
- invariant(this._node, void 0, {
572
- F: __dxlog_file,
573
- L: 328,
574
- S: this,
575
- A: [
576
- "this._node",
577
- ""
578
- ]
579
- });
580
- if (this._node.graph.hf.isThereSomethingToRedo()) {
581
- this._node.graph.hf.redo();
582
- }
583
- }
584
- /**
585
- * Get value from sheet.
586
- */
587
- getCellValue(cell) {
588
- const idx = addressToIndex(this._sheet, cell);
589
- return this._sheet.cells[idx]?.value ?? null;
590
- }
591
- /**
592
- * Get value as a string for editing.
593
- */
594
- getCellText(cell) {
595
- const value = this.getCellValue(cell);
596
- if (value == null) {
597
- return void 0;
598
- }
599
- if (isFormula(value)) {
600
- return this._graph.mapFunctionBindingFromId(mapFormulaIndicesToRefs(this._sheet, value));
601
- } else {
602
- return String(value);
603
- }
604
- }
605
- /**
606
- * Get array of raw values from sheet.
607
- */
608
- getCellValues(range) {
609
- return this._iterRange(range, (cell) => this.getCellValue(cell));
610
- }
611
- /**
612
- * Gets the regular or computed value from the engine.
613
- */
614
- getValue(cell) {
615
- invariant(this._node, void 0, {
616
- F: __dxlog_file,
617
- L: 371,
618
- S: this,
619
- A: [
620
- "this._node",
621
- ""
622
- ]
623
- });
624
- const address = toSimpleCellAddress(this._node.sheetId, cell);
625
- const value = this._node.graph.hf.getCellValue(address);
626
- if (value instanceof DetailedCellError) {
627
- log.warn("cell error", {
628
- cell,
629
- error: value
630
- }, {
631
- F: __dxlog_file,
632
- L: 376,
633
- S: this,
634
- C: (f, a) => f(...a)
635
- });
636
- return value.toString();
637
- }
638
- return value;
639
- }
640
- /**
641
- * Get value type.
642
- */
643
- getValueDescription(cell) {
644
- invariant(this._node, void 0, {
645
- F: __dxlog_file,
646
- L: 387,
647
- S: this,
648
- A: [
649
- "this._node",
650
- ""
651
- ]
652
- });
653
- const addr = toSimpleCellAddress(this._node.sheetId, cell);
654
- const type = this._node.graph.hf.getCellValueDetailedType(addr);
655
- return typeMap[type];
656
- }
657
- /**
658
- * Sets the value, updating the sheet and engine.
659
- */
660
- setValue(cell, value) {
661
- invariant(this._node, void 0, {
662
- F: __dxlog_file,
663
- L: 397,
664
- S: this,
665
- A: [
666
- "this._node",
667
- ""
668
- ]
669
- });
670
- if (this._options.readonly) {
671
- throw new ReadonlyException();
672
- }
673
- let refresh = false;
674
- if (cell.row >= this._sheet.rows.length) {
675
- Obj3.change(this._sheet, (s) => {
676
- insertIndices(s.rows, cell.row, 1, MAX_ROWS);
677
- });
678
- refresh = true;
679
- }
680
- if (cell.col >= this._sheet.columns.length) {
681
- Obj3.change(this._sheet, (s) => {
682
- insertIndices(s.columns, cell.col, 1, MAX_COLS);
683
- });
684
- refresh = true;
685
- }
686
- if (refresh) {
687
- this.reset();
688
- }
689
- this._node.graph.hf.setCellContents({
690
- sheet: this._node.sheetId,
691
- row: cell.row,
692
- col: cell.col
693
- }, [
694
- [
695
- isFormula(value) ? this._graph.mapFormulaToNative(value) : value
696
- ]
697
- ]);
698
- const idx = addressToIndex(this._sheet, cell);
699
- if (value === void 0 || value === null) {
700
- Obj3.change(this._sheet, (s) => {
701
- delete s.cells[idx];
702
- });
703
- } else {
704
- if (isFormula(value)) {
705
- value = this._graph.mapFunctionBindingToId(mapFormulaRefsToIndices(this._sheet, value));
706
- }
707
- Obj3.change(this._sheet, (s) => {
708
- s.cells[idx] = {
709
- value
710
- };
711
- });
712
- }
713
- }
714
- /**
715
- * Sets values from a simple map.
716
- */
717
- setValues(values) {
718
- Object.entries(values).forEach(([key, { value }]) => {
719
- this.setValue(addressFromA1Notation(key), value);
720
- });
721
- }
722
- /**
723
- * Iterate range.
724
- */
725
- _iterRange(range, cb) {
726
- const to = range.to ?? range.from;
727
- const rowRange = [
728
- Math.min(range.from.row, to.row),
729
- Math.max(range.from.row, to.row)
730
- ];
731
- const columnRange = [
732
- Math.min(range.from.col, to.col),
733
- Math.max(range.from.col, to.col)
734
- ];
735
- const rows = [];
736
- for (let row = rowRange[0]; row <= rowRange[1]; row++) {
737
- const rowCells = [];
738
- for (let column = columnRange[0]; column <= columnRange[1]; column++) {
739
- const value = cb({
740
- row,
741
- col: column
742
- });
743
- if (value !== void 0) {
744
- rowCells.push(value);
745
- }
746
- }
747
- rows.push(rowCells);
748
- }
749
- return rows;
750
- }
751
- // TODO(burdon): Delete index.
752
- _deleteIndices(indices, i, n) {
753
- throw new Error("Not implemented");
754
- }
755
- // TODO(burdon): Move. Cannot use fractional without changing. Switch back to using unique IDs?
756
- _moveIndices(indices, i, j, n) {
757
- throw new Error("Not implemented");
758
- }
759
- /**
760
- * Map from indices to A1 notation.
761
- */
762
- mapFormulaIndicesToRefs(formula) {
763
- invariant(isFormula(formula), void 0, {
764
- F: __dxlog_file,
765
- L: 490,
766
- S: this,
767
- A: [
768
- "isFormula(formula)",
769
- ""
770
- ]
771
- });
772
- return formula.replace(/([a-zA-Z0-9]+)@([a-zA-Z0-9]+)/g, (idx) => {
773
- return addressToA1Notation(addressFromIndex(this._sheet, idx));
774
- });
775
- }
776
- //
777
- // Values
778
- //
779
- /**
780
- * https://hyperformula.handsontable.com/guide/date-and-time-handling.html#example
781
- * https://hyperformula.handsontable.com/api/interfaces/configparams.html#nulldate
782
- * NOTE: TODAY() is number of FULL days since nullDate. It will typically be -1 days from NOW().
783
- */
784
- toLocalDate(num) {
785
- const { year, month, day, hours, minutes, seconds } = this.toDateTime(num);
786
- return new Date(year, month - 1, day, hours, minutes, seconds);
787
- }
788
- toDateTime(num) {
789
- invariant(this._node, void 0, {
790
- F: __dxlog_file,
791
- L: 511,
792
- S: this,
793
- A: [
794
- "this._node",
795
- ""
796
- ]
797
- });
798
- return this._node.graph.hf.numberToDateTime(num);
799
- }
800
- toDate(num) {
801
- invariant(this._node, void 0, {
802
- F: __dxlog_file,
803
- L: 516,
804
- S: this,
805
- A: [
806
- "this._node",
807
- ""
808
- ]
809
- });
810
- return this._node.graph.hf.numberToDate(num);
811
- }
812
- toTime(num) {
813
- invariant(this._node, void 0, {
814
- F: __dxlog_file,
815
- L: 521,
816
- S: this,
817
- A: [
818
- "this._node",
819
- ""
820
- ]
821
- });
822
- return this._node.graph.hf.numberToTime(num);
823
- }
824
- };
825
-
826
- // src/model/useSheetModel.ts
827
- import { useEffect as useEffect2, useState } from "react";
828
- var useSheetModel = (graph, sheet, { readonly } = {}) => {
829
- const [model, setModel] = useState();
830
- useEffect2(() => {
831
- if (!graph || !sheet) {
832
- return;
833
- }
834
- let model2;
835
- const t = setTimeout(async () => {
836
- model2 = new SheetModel(graph, sheet, {
837
- readonly
838
- });
839
- await model2.open();
840
- setModel(model2);
841
- });
842
- return () => {
843
- clearTimeout(t);
844
- void model2?.close();
845
- };
846
- }, [
847
- graph,
848
- sheet,
849
- readonly
850
- ]);
851
- return model;
852
- };
853
-
854
- // src/components/SheetContext/SheetContext.tsx
855
- var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-sheet/src/components/SheetContext/SheetContext.tsx";
856
- var SheetContext = /* @__PURE__ */ createContext2(void 0);
857
- var useSheetContext = () => {
858
- const context = useContext2(SheetContext);
859
- invariant2(context, void 0, {
860
- F: __dxlog_file2,
861
- L: 54,
862
- S: void 0,
863
- A: [
864
- "context",
865
- ""
866
- ]
867
- });
868
- return context;
869
- };
870
- var SheetProviderImpl = ({ __gridScope, children, ignoreAttention, model, onInfo }) => {
871
- const { id, editing, setEditing } = useGridContext("SheetProvider", __gridScope);
872
- const [cursor, setCursorInternal] = useState2();
873
- const [range, setRangeInternal] = useState2();
874
- const [cursorFallbackRange, setCursorFallbackRange] = useState2();
875
- const [activeRefs, setActiveRefs] = useState2("");
876
- const setCursor = useCallback3((nextCursor) => {
877
- setCursorInternal(nextCursor);
878
- setCursorFallbackRange(range?.to ? range : nextCursor ? {
879
- from: nextCursor,
880
- to: nextCursor
881
- } : void 0);
882
- }, [
883
- range
884
- ]);
885
- const setRange = useCallback3((nextRange) => {
886
- setRangeInternal(nextRange);
887
- setCursorFallbackRange(nextRange?.to ? nextRange : cursor ? {
888
- from: cursor,
889
- to: cursor
890
- } : void 0);
891
- }, [
892
- cursor
893
- ]);
894
- return /* @__PURE__ */ React3.createElement(SheetContext.Provider, {
895
- value: {
896
- id,
897
- model,
898
- editing,
899
- setEditing,
900
- cursor,
901
- setCursor,
902
- range,
903
- setRange,
904
- cursorFallbackRange,
905
- activeRefs,
906
- setActiveRefs,
907
- // TODO(burdon): Change to event.
908
- onInfo,
909
- ignoreAttention
910
- }
911
- }, children);
912
- };
913
- var SheetProvider = ({ children, graph, sheet, readonly, ignoreAttention, onInfo }) => {
914
- const model = useSheetModel(graph, sheet, {
915
- readonly
916
- });
917
- return !model ? null : /* @__PURE__ */ React3.createElement(Grid.Root, {
918
- id: Obj4.getDXN(sheet).toString()
919
- }, /* @__PURE__ */ React3.createElement(SheetProviderImpl, {
920
- model,
921
- onInfo,
922
- ignoreAttention
923
- }, children));
924
- };
925
-
926
- // src/components/GridSheet/util.ts
927
- import { useEffect as useEffect3, useState as useState3 } from "react";
928
- import { inRange as inRange2 } from "@dxos/compute";
929
- import { createDocAccessor } from "@dxos/echo-db";
930
- import { cellClassesForFieldType, parseValue } from "@dxos/react-ui-form";
931
- import { colToA1Notation, commentedClassName, rowToA1Notation } from "@dxos/react-ui-grid";
932
- import { mx } from "@dxos/ui-theme";
933
- var createDxGridColumns = (model) => {
934
- return model.sheet.columns.reduce((acc, columnId, numericIndex) => {
935
- if (model.sheet.columnMeta[columnId] && model.sheet.columnMeta[columnId].size) {
936
- acc.grid[numericIndex] = {
937
- size: model.sheet.columnMeta[columnId].size,
938
- resizeable: true
939
- };
940
- }
941
- return acc;
942
- }, {
943
- grid: {}
944
- });
945
- };
946
- var createDxGridRows = (model) => {
947
- return model.sheet.rows.reduce((acc, rowId, numericIndex) => {
948
- if (model.sheet.rowMeta[rowId] && model.sheet.rowMeta[rowId].size) {
949
- acc.grid[numericIndex] = {
950
- size: model.sheet.rowMeta[rowId].size,
951
- resizeable: true
952
- };
953
- }
954
- return acc;
955
- }, {
956
- grid: {}
957
- });
958
- };
959
- var projectCellProps = (model, col, row) => {
960
- const address = {
961
- col,
962
- row
963
- };
964
- const rawValue = model.getValue(address);
965
- const ranges = model.sheet.ranges?.filter(({ range }) => inRange2(rangeFromIndex(model.sheet, range), address));
966
- const threadRefs = void 0;
967
- const description = model.getValueDescription(address);
968
- const type = description?.type;
969
- const format = description?.format;
970
- const classNames = ranges?.map(cellClassNameForRange).reverse();
971
- return {
972
- value: parseValue({
973
- type,
974
- format,
975
- value: rawValue
976
- }),
977
- className: mx(cellClassesForFieldType({
978
- type,
979
- format
980
- }), threadRefs && commentedClassName, classNames),
981
- dataRefs: threadRefs
982
- };
983
- };
984
- var gridCellGetter = (model) => {
985
- const cachedGridCells = {};
986
- return (nextBounds) => {
987
- [
988
- ...Array(nextBounds.end.col - nextBounds.start.col)
989
- ].forEach((_, c0) => {
990
- return [
991
- ...Array(nextBounds.end.row - nextBounds.start.row)
992
- ].forEach((_2, r0) => {
993
- const col = nextBounds.start.col + c0;
994
- const row = nextBounds.start.row + r0;
995
- cachedGridCells[`${col},${row}`] = projectCellProps(model, col, row);
996
- });
997
- });
998
- return cachedGridCells;
999
- };
1000
- };
1001
- var rowLabelCell = (row) => ({
1002
- value: rowToA1Notation(row),
1003
- className: "!bg-toolbarSurface text-subdued text-end pie-1",
1004
- resizeHandle: "row"
1005
- });
1006
- var colLabelCell = (col) => ({
1007
- value: colToA1Notation(col),
1008
- className: "!bg-toolbarSurface text-subdued",
1009
- resizeHandle: "col"
1010
- });
1011
- var cellGetter = (model) => {
1012
- const getGridCells = gridCellGetter(model);
1013
- return (nextBounds, plane) => {
1014
- switch (plane) {
1015
- case "grid":
1016
- return getGridCells(nextBounds);
1017
- case "fixedStartStart": {
1018
- return {
1019
- "0,0": {
1020
- className: "!bg-toolbarSurface"
1021
- }
1022
- };
1023
- }
1024
- case "frozenColsStart":
1025
- return [
1026
- ...Array(nextBounds.end.row - nextBounds.start.row)
1027
- ].reduce((acc, _, r0) => {
1028
- const r = nextBounds.start.row + r0;
1029
- acc[`0,${r}`] = rowLabelCell(r);
1030
- return acc;
1031
- }, {});
1032
- case "frozenRowsStart":
1033
- return [
1034
- ...Array(nextBounds.end.col - nextBounds.start.col)
1035
- ].reduce((acc, _, c0) => {
1036
- const c = nextBounds.start.col + c0;
1037
- acc[`${c},0`] = colLabelCell(c);
1038
- return acc;
1039
- }, {});
1040
- default:
1041
- return {};
1042
- }
1043
- };
1044
- };
1045
- var useSheetModelDxGridProps = (dxGrid, model) => {
1046
- const [columns, setColumns] = useState3(createDxGridColumns(model));
1047
- const [rows, setRows] = useState3(createDxGridRows(model));
1048
- useEffect3(() => {
1049
- const cellsAccessor = createDocAccessor(model.sheet, [
1050
- "cells"
1051
- ]);
1052
- if (dxGrid) {
1053
- dxGrid.getCells = cellGetter(model);
1054
- }
1055
- const handleCellsUpdate = () => {
1056
- dxGrid?.requestUpdate("initialCells");
1057
- };
1058
- cellsAccessor.handle.addListener("change", handleCellsUpdate);
1059
- const unsubscribe = model.graph.update.on(handleCellsUpdate);
1060
- return () => {
1061
- cellsAccessor.handle.removeListener("change", handleCellsUpdate);
1062
- unsubscribe();
1063
- };
1064
- }, [
1065
- model,
1066
- dxGrid
1067
- ]);
1068
- useEffect3(() => {
1069
- const columnMetaAccessor = createDocAccessor(model.sheet, [
1070
- "columnMeta"
1071
- ]);
1072
- const rowMetaAccessor = createDocAccessor(model.sheet, [
1073
- "rowMeta"
1074
- ]);
1075
- const handleColumnMetaUpdate = () => {
1076
- setColumns(createDxGridColumns(model));
1077
- };
1078
- const handleRowMetaUpdate = () => {
1079
- setRows(createDxGridRows(model));
1080
- };
1081
- columnMetaAccessor.handle.addListener("change", handleColumnMetaUpdate);
1082
- rowMetaAccessor.handle.addListener("change", handleRowMetaUpdate);
1083
- return () => {
1084
- columnMetaAccessor.handle.removeListener("change", handleColumnMetaUpdate);
1085
- rowMetaAccessor.handle.removeListener("change", handleRowMetaUpdate);
1086
- };
1087
- }, [
1088
- model,
1089
- dxGrid
1090
- ]);
1091
- return {
1092
- columns,
1093
- rows
1094
- };
1095
- };
1096
-
1097
- // src/components/GridSheet/GridSheet.tsx
1098
- var inertPosition = {
1099
- plane: "grid",
1100
- col: 0,
1101
- row: 0
1102
- };
1103
- var initialCells = {
1104
- grid: {},
1105
- frozenColsStart: [
1106
- ...Array(64)
1107
- ].reduce((acc, _, i) => {
1108
- acc[`0,${i}`] = rowLabelCell(i);
1109
- return acc;
1110
- }, {}),
1111
- frozenRowsStart: [
1112
- ...Array(12)
1113
- ].reduce((acc, _, i) => {
1114
- acc[`${i},0`] = colLabelCell(i);
1115
- return acc;
1116
- }, {})
1117
- };
1118
- var frozen = {
1119
- frozenColsStart: 1,
1120
- frozenRowsStart: 1
1121
- };
1122
- var sheetColDefault = {
1123
- frozenColsStart: {
1124
- size: 48,
1125
- readonly: true,
1126
- focusUnfurl: false
1127
- },
1128
- grid: {
1129
- size: defaultColSize,
1130
- resizeable: true
1131
- }
1132
- };
1133
- var sheetRowDefault = {
1134
- frozenRowsStart: {
1135
- size: defaultRowSize,
1136
- readonly: true,
1137
- focusUnfurl: false
1138
- },
1139
- grid: {
1140
- size: defaultRowSize,
1141
- resizeable: true
1142
- }
1143
- };
1144
- var GridSheet = () => {
1145
- const { t } = useTranslation2(meta.id);
1146
- const { id, model, editing, setCursor, setRange, cursor, cursorFallbackRange, activeRefs, ignoreAttention } = useSheetContext();
1147
- const [dxGrid, setDxGrid] = useState4(null);
1148
- const [extraplanarFocus, setExtraplanarFocus] = useState4(null);
1149
- const { invokePromise } = useOperationInvoker2();
1150
- const rangeController = useRef(null);
1151
- const { hasAttention } = useAttention(id);
1152
- const handleFocus = useCallback4((event) => {
1153
- if (!editing) {
1154
- const cell = closestCell(event.target);
1155
- if (cell) {
1156
- if (cell.plane === "grid") {
1157
- setCursor({
1158
- col: cell.col,
1159
- row: cell.row
1160
- });
1161
- setExtraplanarFocus(null);
1162
- } else {
1163
- setExtraplanarFocus(cell);
1164
- }
1165
- } else {
1166
- setExtraplanarFocus(null);
1167
- }
1168
- }
1169
- }, [
1170
- editing
1171
- ]);
1172
- const handleClose = useCallback4((_value, event) => {
1173
- if (event) {
1174
- const { key, shift } = event;
1175
- const axis = [
1176
- "Enter",
1177
- "ArrowUp",
1178
- "ArrowDown"
1179
- ].includes(key) ? "row" : [
1180
- "Tab",
1181
- "ArrowLeft",
1182
- "ArrowRight"
1183
- ].includes(key) ? "col" : void 0;
1184
- const delta = key.startsWith("Arrow") ? [
1185
- "ArrowUp",
1186
- "ArrowLeft"
1187
- ].includes(key) ? -1 : 1 : shift ? -1 : 1;
1188
- dxGrid?.refocus(axis, delta);
1189
- }
1190
- }, [
1191
- model,
1192
- editing,
1193
- dxGrid
1194
- ]);
1195
- const handleBlur = useCallback4((value) => {
1196
- if (value !== void 0) {
1197
- model.setValue(parseCellIndex(editing.index), value);
1198
- }
1199
- }, [
1200
- model,
1201
- editing
1202
- ]);
1203
- const handleAxisResize = useCallback4(({ axis, size, index: numericIndex }) => {
1204
- Obj5.change(model.sheet, (sheet) => {
1205
- if (axis === "row") {
1206
- const rowId = sheet.rows[parseInt(numericIndex)];
1207
- sheet.rowMeta[rowId] ??= {};
1208
- sheet.rowMeta[rowId].size = size;
1209
- } else {
1210
- const columnId = sheet.columns[parseInt(numericIndex)];
1211
- sheet.columnMeta[columnId] ??= {};
1212
- sheet.columnMeta[columnId].size = size;
1213
- }
1214
- });
1215
- }, [
1216
- model
1217
- ]);
1218
- const handleSelect = useCallback4(({ minCol, maxCol, minRow, maxRow }) => {
1219
- const range = {
1220
- from: {
1221
- col: minCol,
1222
- row: minRow
1223
- }
1224
- };
1225
- if (minCol !== maxCol || minRow !== maxRow) {
1226
- range.to = {
1227
- col: maxCol,
1228
- row: maxRow
1229
- };
1230
- }
1231
- if (editing) {
1232
- rangeController.current?.setRange(rangeToA1Notation2(range));
1233
- } else {
1234
- setRange(range.to ? range : void 0);
1235
- }
1236
- }, [
1237
- editing
1238
- ]);
1239
- const handleWheel = useCallback4((event) => {
1240
- if (!ignoreAttention && !hasAttention) {
1241
- event.stopPropagation();
1242
- }
1243
- }, [
1244
- hasAttention,
1245
- ignoreAttention
1246
- ]);
1247
- const selectEntireAxis = useCallback4((pos) => {
1248
- switch (pos.plane) {
1249
- case "frozenRowsStart":
1250
- return dxGrid?.setSelection({
1251
- start: {
1252
- col: pos.col,
1253
- row: 0,
1254
- plane: "grid"
1255
- },
1256
- end: {
1257
- col: pos.col,
1258
- row: model.sheet.rows.length - 1,
1259
- plane: "grid"
1260
- }
1261
- });
1262
- case "frozenColsStart":
1263
- return dxGrid?.setSelection({
1264
- start: {
1265
- row: pos.row,
1266
- col: 0,
1267
- plane: "grid"
1268
- },
1269
- end: {
1270
- row: pos.row,
1271
- col: model.sheet.columns.length - 1,
1272
- plane: "grid"
1273
- }
1274
- });
1275
- }
1276
- }, [
1277
- dxGrid,
1278
- model.sheet
1279
- ]);
1280
- const handleClick = useCallback4((event) => {
1281
- const cell = closestCell(event.target);
1282
- if (cell) {
1283
- selectEntireAxis(cell);
1284
- }
1285
- }, [
1286
- selectEntireAxis
1287
- ]);
1288
- const handleKeyDown = useCallback4((event) => {
1289
- switch (event.key) {
1290
- case "Backspace":
1291
- case "Delete":
1292
- event.preventDefault();
1293
- return cursorFallbackRange && model.clear(cursorFallbackRange);
1294
- case "Enter":
1295
- case "Space":
1296
- if (dxGrid && extraplanarFocus) {
1297
- switch (extraplanarFocus.plane) {
1298
- case "frozenRowsStart":
1299
- case "frozenColsStart":
1300
- event.preventDefault();
1301
- return selectEntireAxis(extraplanarFocus);
1302
- }
1303
- }
1304
- }
1305
- if (event.metaKey || event.ctrlKey) {
1306
- switch (event.key) {
1307
- case "x":
1308
- case "X":
1309
- event.preventDefault();
1310
- return cursorFallbackRange && model.cut(cursorFallbackRange);
1311
- case "c":
1312
- case "C":
1313
- event.preventDefault();
1314
- return cursorFallbackRange && model.copy(cursorFallbackRange);
1315
- case "v":
1316
- case "V":
1317
- event.preventDefault();
1318
- return cursor && model.paste(cursor);
1319
- case "z":
1320
- event.preventDefault();
1321
- return event.shiftKey ? model.redo() : model.undo();
1322
- case "Z":
1323
- case "y":
1324
- event.preventDefault();
1325
- return model.redo();
1326
- }
1327
- }
1328
- }, [
1329
- cursorFallbackRange,
1330
- model,
1331
- cursor,
1332
- extraplanarFocus,
1333
- selectEntireAxis
1334
- ]);
1335
- const contextMenuAnchorRef = useRef(null);
1336
- const [contextMenuOpen, setContextMenuOpen] = useState4(null);
1337
- const contextMenuAxis = contextMenuOpen?.plane.startsWith("frozenRows") ? "col" : "row";
1338
- const handleContextMenu = useCallback4((event) => {
1339
- const cell = closestCell(event.target);
1340
- if (cell && cell.plane.startsWith("frozen")) {
1341
- event.preventDefault();
1342
- contextMenuAnchorRef.current = event.target;
1343
- setContextMenuOpen(cell);
1344
- }
1345
- }, []);
1346
- const handleAxisMenuAction = useCallback4((operation) => {
1347
- switch (operation) {
1348
- case "insert-before":
1349
- case "insert-after":
1350
- return invokePromise(SheetOperation.InsertAxis, {
1351
- model,
1352
- axis: contextMenuAxis,
1353
- index: contextMenuOpen[contextMenuAxis] + (operation === "insert-before" ? 0 : 1)
1354
- });
1355
- case "drop":
1356
- return invokePromise(SheetOperation.DropAxis, {
1357
- model,
1358
- axis: contextMenuAxis,
1359
- axisIndex: model.sheet[contextMenuAxis === "row" ? "rows" : "columns"][contextMenuOpen[contextMenuAxis]]
1360
- });
1361
- }
1362
- }, [
1363
- contextMenuAxis,
1364
- contextMenuOpen,
1365
- model,
1366
- invokePromise
1367
- ]);
1368
- const { columns, rows } = useSheetModelDxGridProps(dxGrid, model);
1369
- const extensions = useMemo2(() => [
1370
- editorKeys({
1371
- onClose: handleClose,
1372
- ...editing?.initialContent && {
1373
- onNav: handleClose
1374
- }
1375
- }),
1376
- sheetExtension({
1377
- functions: model.graph.getFunctions()
1378
- }),
1379
- rangeExtension({
1380
- onInit: (fn) => rangeController.current = fn,
1381
- onStateChange: (state) => {
1382
- if (dxGrid) {
1383
- dxGrid.mode = typeof state.activeRange === "undefined" ? "edit" : "edit-select";
1384
- }
1385
- }
1386
- })
1387
- ], [
1388
- model,
1389
- handleClose,
1390
- editing
1391
- ]);
1392
- const getCellContent = useCallback4((index) => {
1393
- return model.getCellText(parseCellIndex(index));
1394
- }, [
1395
- model
1396
- ]);
1397
- useUpdateFocusedCellOnThreadSelection(dxGrid);
1398
- useSelectThreadOnCellFocus();
1399
- return (
1400
- // TODO(thure): Why are Table’s and Sheet’s editor boxes off by 1px?
1401
- /* @__PURE__ */ React4.createElement("div", {
1402
- role: "none",
1403
- className: "relative min-bs-0 [&_.cm-editor]:!border-lb [&_.cm-editor]:!border-transparent"
1404
- }, /* @__PURE__ */ React4.createElement(GridCellEditor, {
1405
- getCellContent,
1406
- extensions,
1407
- onBlur: handleBlur
1408
- }), /* @__PURE__ */ React4.createElement(Grid2.Content, {
1409
- initialCells,
1410
- limitColumns: DEFAULT_COLS,
1411
- limitRows: DEFAULT_ROWS,
1412
- columns,
1413
- rows,
1414
- // TODO(burdon): `col` vs. `column`?
1415
- columnDefault: sheetColDefault,
1416
- rowDefault: sheetRowDefault,
1417
- frozen,
1418
- onAxisResize: handleAxisResize,
1419
- onSelect: handleSelect,
1420
- onFocus: handleFocus,
1421
- onWheelCapture: handleWheel,
1422
- onKeyDown: handleKeyDown,
1423
- onContextMenu: handleContextMenu,
1424
- onClick: handleClick,
1425
- overscroll: "trap",
1426
- className: "[--dx-grid-base:var(--baseSurface)] [&_.dx-grid]:absolute [&_.dx-grid]:inset-0",
1427
- activeRefs,
1428
- ref: setDxGrid
1429
- }), /* @__PURE__ */ React4.createElement(DropdownMenu.Root, {
1430
- modal: false,
1431
- open: !!contextMenuOpen,
1432
- onOpenChange: (nextOpen) => setContextMenuOpen(nextOpen ? inertPosition : null)
1433
- }, /* @__PURE__ */ React4.createElement(DropdownMenu.VirtualTrigger, {
1434
- virtualRef: contextMenuAnchorRef
1435
- }), /* @__PURE__ */ React4.createElement(DropdownMenu.Content, {
1436
- side: contextMenuAxis === "col" ? "bottom" : "right",
1437
- sideOffset: 4,
1438
- collisionPadding: 8
1439
- }, /* @__PURE__ */ React4.createElement(DropdownMenu.Viewport, null, /* @__PURE__ */ React4.createElement(DropdownMenu.Item, {
1440
- onClick: () => handleAxisMenuAction("insert-before"),
1441
- "data-testid": `grid.${contextMenuAxis}.insert-before`
1442
- }, /* @__PURE__ */ React4.createElement(Icon, {
1443
- size: 5,
1444
- icon: contextMenuAxis === "col" ? "ph--columns-plus-left--regular" : "ph--rows-plus-top--regular"
1445
- }), /* @__PURE__ */ React4.createElement("span", null, t(`add ${contextMenuAxis} before label`))), /* @__PURE__ */ React4.createElement(DropdownMenu.Item, {
1446
- onClick: () => handleAxisMenuAction("insert-after"),
1447
- "data-testid": `grid.${contextMenuAxis}.insert-after`
1448
- }, /* @__PURE__ */ React4.createElement(Icon, {
1449
- size: 5,
1450
- icon: contextMenuAxis === "col" ? "ph--columns-plus-right--regular" : "ph--rows-plus-bottom--regular"
1451
- }), /* @__PURE__ */ React4.createElement("span", null, t(`add ${contextMenuAxis} after label`))), /* @__PURE__ */ React4.createElement(DropdownMenu.Item, {
1452
- onClick: () => handleAxisMenuAction("drop"),
1453
- "data-testid": `grid.${contextMenuAxis}.drop`
1454
- }, /* @__PURE__ */ React4.createElement(Icon, {
1455
- size: 5,
1456
- icon: "ph--backspace--regular"
1457
- }), /* @__PURE__ */ React4.createElement("span", null, t(`delete ${contextMenuAxis} label`)))), /* @__PURE__ */ React4.createElement(DropdownMenu.Arrow, null))))
1458
- );
1459
- };
1460
-
1461
- // src/components/index.ts
1462
- var SheetContainer = lazy(() => import("./SheetContainer-J72HS2FI.mjs"));
1463
-
1464
- export {
1465
- ComputeGraphContextProvider,
1466
- useComputeGraph,
1467
- useSheetContext,
1468
- SheetProvider,
1469
- GridSheet,
1470
- RangeList,
1471
- SheetContainer
1472
- };
1473
- //# sourceMappingURL=chunk-S27QJYTN.mjs.map