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