@dxos/plugin-sheet 0.8.4-main.72ec0f3 → 0.8.4-main.765dc60934

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 (350) hide show
  1. package/LICENSE +102 -5
  2. package/dist/lib/neutral/RangeList-HYB5S6KQ.mjs +46 -0
  3. package/dist/lib/neutral/RangeList-HYB5S6KQ.mjs.map +7 -0
  4. package/dist/lib/neutral/SheetArticle-5AJRM3V3.mjs +33 -0
  5. package/dist/lib/neutral/SheetArticle-5AJRM3V3.mjs.map +7 -0
  6. package/dist/lib/neutral/SheetPlugin.mjs +48 -0
  7. package/dist/lib/neutral/SheetPlugin.mjs.map +7 -0
  8. package/dist/lib/neutral/SheetPlugin.node.mjs +27 -0
  9. package/dist/lib/neutral/SheetPlugin.node.mjs.map +7 -0
  10. package/dist/lib/neutral/anchor-sort-TTCKGX7V.mjs +22 -0
  11. package/dist/lib/neutral/anchor-sort-TTCKGX7V.mjs.map +7 -0
  12. package/dist/lib/neutral/capabilities/index.mjs +25 -0
  13. package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
  14. package/dist/lib/{browser/chunk-7VEWYJJN.mjs → neutral/chunk-4SBAIU6F.mjs} +15 -15
  15. package/dist/lib/neutral/chunk-4SBAIU6F.mjs.map +7 -0
  16. package/dist/lib/neutral/chunk-FZWVUKE2.mjs +8 -0
  17. package/dist/lib/neutral/chunk-FZWVUKE2.mjs.map +7 -0
  18. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  19. package/dist/lib/neutral/chunk-KC2SMDNF.mjs +373 -0
  20. package/dist/lib/neutral/chunk-KC2SMDNF.mjs.map +7 -0
  21. package/dist/lib/neutral/chunk-YFY6U524.mjs +83 -0
  22. package/dist/lib/neutral/chunk-YFY6U524.mjs.map +7 -0
  23. package/dist/lib/{browser/chunk-FWFAAGXL.mjs → neutral/chunk-ZWOQCLH7.mjs} +2 -9
  24. package/dist/lib/neutral/chunk-ZWOQCLH7.mjs.map +7 -0
  25. package/dist/lib/neutral/comment-config-ZBWNCJMZ.mjs +20 -0
  26. package/dist/lib/neutral/comment-config-ZBWNCJMZ.mjs.map +7 -0
  27. package/dist/lib/neutral/components/index.mjs +1551 -0
  28. package/dist/lib/neutral/components/index.mjs.map +7 -0
  29. package/dist/lib/neutral/compute-graph-registry-IEQBF5XZ.mjs +20 -0
  30. package/dist/lib/neutral/compute-graph-registry-IEQBF5XZ.mjs.map +7 -0
  31. package/dist/lib/neutral/containers/index.mjs +11 -0
  32. package/dist/lib/neutral/containers/index.mjs.map +7 -0
  33. package/dist/lib/neutral/create-object-OKQAXJCW.mjs +27 -0
  34. package/dist/lib/neutral/create-object-OKQAXJCW.mjs.map +7 -0
  35. package/dist/lib/neutral/drop-axis-G6UOXG54.mjs +23 -0
  36. package/dist/lib/neutral/drop-axis-G6UOXG54.mjs.map +7 -0
  37. package/dist/lib/{node-esm/types → neutral}/index.mjs +14 -3
  38. package/dist/lib/neutral/insert-axis-ZFFNG22G.mjs +16 -0
  39. package/dist/lib/neutral/insert-axis-ZFFNG22G.mjs.map +7 -0
  40. package/dist/lib/neutral/markdown-I2AKJYPF.mjs +28 -0
  41. package/dist/lib/neutral/markdown-I2AKJYPF.mjs.map +7 -0
  42. package/dist/lib/neutral/meta.json +1 -0
  43. package/dist/lib/neutral/meta.mjs +8 -0
  44. package/dist/lib/neutral/meta.mjs.map +7 -0
  45. package/dist/lib/neutral/operation-handler-TB6LFV2H.mjs +13 -0
  46. package/dist/lib/neutral/operation-handler-TB6LFV2H.mjs.map +7 -0
  47. package/dist/lib/neutral/operations/index.mjs +8 -0
  48. package/dist/lib/neutral/operations/index.mjs.map +7 -0
  49. package/dist/lib/neutral/plugin.mjs +16 -0
  50. package/dist/lib/neutral/plugin.mjs.map +7 -0
  51. package/dist/lib/neutral/react-surface-VSTQNVPT.mjs +44 -0
  52. package/dist/lib/neutral/react-surface-VSTQNVPT.mjs.map +7 -0
  53. package/dist/lib/neutral/restore-axis-44DM6N54.mjs +16 -0
  54. package/dist/lib/neutral/restore-axis-44DM6N54.mjs.map +7 -0
  55. package/dist/lib/neutral/scroll-to-anchor-QPOGMAQG.mjs +33 -0
  56. package/dist/lib/neutral/scroll-to-anchor-QPOGMAQG.mjs.map +7 -0
  57. package/dist/lib/neutral/state-HPA27MX2.mjs +29 -0
  58. package/dist/lib/neutral/state-HPA27MX2.mjs.map +7 -0
  59. package/dist/lib/neutral/testing/index.mjs +103 -0
  60. package/dist/lib/neutral/testing/index.mjs.map +7 -0
  61. package/dist/lib/neutral/translations.mjs +55 -0
  62. package/dist/lib/neutral/translations.mjs.map +7 -0
  63. package/dist/lib/{browser → neutral}/types/index.mjs +6 -2
  64. package/dist/lib/neutral/types/index.mjs.map +7 -0
  65. package/dist/lib/neutral/undo-mappings-3FQLSTCZ.mjs +31 -0
  66. package/dist/lib/neutral/undo-mappings-3FQLSTCZ.mjs.map +7 -0
  67. package/dist/types/src/SheetPlugin.d.ts +3 -1
  68. package/dist/types/src/SheetPlugin.d.ts.map +1 -1
  69. package/dist/types/src/SheetPlugin.node.d.ts +4 -0
  70. package/dist/types/src/SheetPlugin.node.d.ts.map +1 -0
  71. package/dist/types/src/SheetPlugin.test.d.ts +2 -0
  72. package/dist/types/src/SheetPlugin.test.d.ts.map +1 -0
  73. package/dist/types/src/capabilities/anchor-sort.d.ts +4 -2
  74. package/dist/types/src/capabilities/anchor-sort.d.ts.map +1 -1
  75. package/dist/types/src/capabilities/comment-config.d.ts +12 -0
  76. package/dist/types/src/capabilities/comment-config.d.ts.map +1 -0
  77. package/dist/types/src/capabilities/compute-graph-registry.d.ts +3 -2
  78. package/dist/types/src/capabilities/compute-graph-registry.d.ts.map +1 -1
  79. package/dist/types/src/capabilities/create-object.d.ts +11 -0
  80. package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
  81. package/dist/types/src/capabilities/index.d.ts +23 -6
  82. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  83. package/dist/types/src/capabilities/markdown.d.ts +3 -2
  84. package/dist/types/src/capabilities/markdown.d.ts.map +1 -1
  85. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  86. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  87. package/dist/types/src/capabilities/react-surface.d.ts +3 -2
  88. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  89. package/dist/types/src/capabilities/state.d.ts +6 -0
  90. package/dist/types/src/capabilities/state.d.ts.map +1 -0
  91. package/dist/types/src/capabilities/undo-mappings.d.ts +5 -0
  92. package/dist/types/src/capabilities/undo-mappings.d.ts.map +1 -0
  93. package/dist/types/src/components/ComputeGraph/ComputeGraphContextProvider.d.ts +1 -1
  94. package/dist/types/src/components/ComputeGraph/ComputeGraphContextProvider.d.ts.map +1 -1
  95. package/dist/types/src/components/ComputeGraph/compute-graph.stories.d.ts.map +1 -1
  96. package/dist/types/src/components/Sheet/Sheet.d.ts +17 -0
  97. package/dist/types/src/components/Sheet/Sheet.d.ts.map +1 -0
  98. package/dist/types/src/components/Sheet/index.d.ts +2 -0
  99. package/dist/types/src/components/Sheet/index.d.ts.map +1 -0
  100. package/dist/types/src/components/{GridSheet → SheetContent}/SheetCellEditor.stories.d.ts +1 -1
  101. package/dist/types/src/components/SheetContent/SheetCellEditor.stories.d.ts.map +1 -0
  102. package/dist/types/src/components/SheetContent/SheetContent.d.ts +6 -0
  103. package/dist/types/src/components/SheetContent/SheetContent.d.ts.map +1 -0
  104. package/dist/types/src/components/SheetContent/SheetContent.stories.d.ts +93 -0
  105. package/dist/types/src/components/SheetContent/SheetContent.stories.d.ts.map +1 -0
  106. package/dist/types/src/components/SheetContent/index.d.ts +2 -0
  107. package/dist/types/src/components/SheetContent/index.d.ts.map +1 -0
  108. package/dist/types/src/components/{GridSheet → SheetContent}/util.d.ts +1 -1
  109. package/dist/types/src/components/SheetContent/util.d.ts.map +1 -0
  110. package/dist/types/src/components/{SheetContext/SheetContext.d.ts → SheetRoot/SheetRoot.d.ts} +8 -6
  111. package/dist/types/src/components/SheetRoot/SheetRoot.d.ts.map +1 -0
  112. package/dist/types/src/components/SheetRoot/index.d.ts +2 -0
  113. package/dist/types/src/components/SheetRoot/index.d.ts.map +1 -0
  114. package/dist/types/src/components/SheetStatusbar/SheetStatusbar.d.ts +6 -0
  115. package/dist/types/src/components/SheetStatusbar/SheetStatusbar.d.ts.map +1 -0
  116. package/dist/types/src/components/SheetStatusbar/index.d.ts +2 -0
  117. package/dist/types/src/components/SheetStatusbar/index.d.ts.map +1 -0
  118. package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts +5 -5
  119. package/dist/types/src/components/SheetToolbar/SheetToolbar.d.ts.map +1 -1
  120. package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts +72 -66
  121. package/dist/types/src/components/SheetToolbar/SheetToolbar.stories.d.ts.map +1 -1
  122. package/dist/types/src/components/SheetToolbar/align.d.ts +14 -21
  123. package/dist/types/src/components/SheetToolbar/align.d.ts.map +1 -1
  124. package/dist/types/src/components/SheetToolbar/style.d.ts +14 -20
  125. package/dist/types/src/components/SheetToolbar/style.d.ts.map +1 -1
  126. package/dist/types/src/components/SheetToolbar/useToolbarState.d.ts +14 -1
  127. package/dist/types/src/components/SheetToolbar/useToolbarState.d.ts.map +1 -1
  128. package/dist/types/src/components/index.d.ts +1 -4
  129. package/dist/types/src/components/index.d.ts.map +1 -1
  130. package/dist/types/src/containers/RangeList/RangeList.d.ts +7 -0
  131. package/dist/types/src/containers/RangeList/RangeList.d.ts.map +1 -0
  132. package/dist/types/src/containers/RangeList/index.d.ts +2 -0
  133. package/dist/types/src/containers/RangeList/index.d.ts.map +1 -0
  134. package/dist/types/src/containers/SheetArticle/SheetArticle.d.ts +12 -0
  135. package/dist/types/src/containers/SheetArticle/SheetArticle.d.ts.map +1 -0
  136. package/dist/types/src/containers/SheetArticle/SheetArticle.stories.d.ts +92 -0
  137. package/dist/types/src/containers/SheetArticle/SheetArticle.stories.d.ts.map +1 -0
  138. package/dist/types/src/containers/SheetArticle/index.d.ts +2 -0
  139. package/dist/types/src/containers/SheetArticle/index.d.ts.map +1 -0
  140. package/dist/types/src/containers/index.d.ts +4 -0
  141. package/dist/types/src/containers/index.d.ts.map +1 -0
  142. package/dist/types/src/extensions/compute.d.ts +1 -1
  143. package/dist/types/src/extensions/compute.d.ts.map +1 -1
  144. package/dist/types/src/extensions/compute.stories.d.ts.map +1 -1
  145. package/dist/types/src/extensions/editor/sheet-extension.d.ts +1 -1
  146. package/dist/types/src/extensions/editor/sheet-extension.d.ts.map +1 -1
  147. package/dist/types/src/index.d.ts +2 -2
  148. package/dist/types/src/index.d.ts.map +1 -1
  149. package/dist/types/src/integrations/thread-ranges.d.ts +1 -3
  150. package/dist/types/src/integrations/thread-ranges.d.ts.map +1 -1
  151. package/dist/types/src/meta.d.ts +2 -2
  152. package/dist/types/src/meta.d.ts.map +1 -1
  153. package/dist/types/src/model/sheet-model.d.ts +4 -4
  154. package/dist/types/src/model/sheet-model.d.ts.map +1 -1
  155. package/dist/types/src/model/testing.d.ts +1 -1
  156. package/dist/types/src/model/testing.d.ts.map +1 -1
  157. package/dist/types/src/model/useSheetModel.d.ts +2 -2
  158. package/dist/types/src/model/useSheetModel.d.ts.map +1 -1
  159. package/dist/types/src/operations/drop-axis.d.ts +5 -0
  160. package/dist/types/src/operations/drop-axis.d.ts.map +1 -0
  161. package/dist/types/src/operations/index.d.ts +3 -0
  162. package/dist/types/src/operations/index.d.ts.map +1 -0
  163. package/dist/types/src/operations/insert-axis.d.ts +5 -0
  164. package/dist/types/src/operations/insert-axis.d.ts.map +1 -0
  165. package/dist/types/src/operations/restore-axis.d.ts +5 -0
  166. package/dist/types/src/operations/restore-axis.d.ts.map +1 -0
  167. package/dist/types/src/operations/scroll-to-anchor.d.ts +5 -0
  168. package/dist/types/src/operations/scroll-to-anchor.d.ts.map +1 -0
  169. package/dist/types/src/playwright/playwright.config.d.ts.map +1 -1
  170. package/dist/types/src/playwright/sheet-manager.d.ts.map +1 -1
  171. package/dist/types/src/plugin.d.ts +4 -0
  172. package/dist/types/src/plugin.d.ts.map +1 -0
  173. package/dist/types/src/serializer.d.ts +2 -2
  174. package/dist/types/src/serializer.d.ts.map +1 -1
  175. package/dist/types/src/testing/data.d.ts +1 -1
  176. package/dist/types/src/testing/data.d.ts.map +1 -1
  177. package/dist/types/src/testing/testing.d.ts +17 -17
  178. package/dist/types/src/testing/testing.d.ts.map +1 -1
  179. package/dist/types/src/translations.d.ts +74 -38
  180. package/dist/types/src/translations.d.ts.map +1 -1
  181. package/dist/types/src/types/Sheet.d.ts +41 -35
  182. package/dist/types/src/types/Sheet.d.ts.map +1 -1
  183. package/dist/types/src/types/SheetCapabilities.d.ts +16 -0
  184. package/dist/types/src/types/SheetCapabilities.d.ts.map +1 -0
  185. package/dist/types/src/types/SheetOperation.d.ts +45 -0
  186. package/dist/types/src/types/SheetOperation.d.ts.map +1 -0
  187. package/dist/types/src/types/index.d.ts +3 -1
  188. package/dist/types/src/types/index.d.ts.map +1 -1
  189. package/dist/types/src/types/sheet-range-types.d.ts +1 -1
  190. package/dist/types/src/types/sheet-range-types.d.ts.map +1 -1
  191. package/dist/types/src/types/types.d.ts +2 -68
  192. package/dist/types/src/types/types.d.ts.map +1 -1
  193. package/dist/types/src/types/util.d.ts +3 -2
  194. package/dist/types/src/types/util.d.ts.map +1 -1
  195. package/dist/types/tsconfig.tsbuildinfo +1 -1
  196. package/package.json +130 -81
  197. package/src/SheetPlugin.node.ts +21 -0
  198. package/src/SheetPlugin.test.ts +30 -0
  199. package/src/SheetPlugin.tsx +37 -68
  200. package/src/capabilities/anchor-sort.ts +19 -13
  201. package/src/capabilities/comment-config.ts +24 -0
  202. package/src/capabilities/compute-graph-registry.ts +19 -13
  203. package/src/capabilities/create-object.ts +30 -0
  204. package/src/capabilities/index.ts +16 -8
  205. package/src/capabilities/markdown.ts +21 -13
  206. package/src/capabilities/operation-handler.ts +16 -0
  207. package/src/capabilities/react-surface.tsx +38 -30
  208. package/src/capabilities/state.ts +29 -0
  209. package/src/capabilities/undo-mappings.ts +30 -0
  210. package/src/components/ComputeGraph/ComputeGraphContextProvider.tsx +1 -1
  211. package/src/components/ComputeGraph/compute-graph.stories.tsx +25 -17
  212. package/src/components/Sheet/Sheet.tsx +20 -0
  213. package/src/components/Sheet/index.ts +5 -0
  214. package/src/components/{GridSheet → SheetContent}/SheetCellEditor.stories.tsx +14 -10
  215. package/src/components/{GridSheet/GridSheet.stories.tsx → SheetContent/SheetContent.stories.tsx} +21 -20
  216. package/src/components/{GridSheet/GridSheet.tsx → SheetContent/SheetContent.tsx} +68 -50
  217. package/src/components/{RangeList → SheetContent}/index.ts +1 -1
  218. package/src/components/{GridSheet → SheetContent}/util.ts +8 -7
  219. package/src/components/{SheetContext/SheetContext.tsx → SheetRoot/SheetRoot.tsx} +55 -42
  220. package/src/components/{GridSheet → SheetRoot}/index.ts +1 -1
  221. package/src/components/{FunctionEditor/FunctionEditor.tsx → SheetStatusbar/SheetStatusbar.tsx} +20 -8
  222. package/src/components/{FunctionEditor → SheetStatusbar}/index.ts +1 -1
  223. package/src/components/SheetToolbar/SheetToolbar.stories.tsx +5 -5
  224. package/src/components/SheetToolbar/SheetToolbar.tsx +46 -39
  225. package/src/components/SheetToolbar/align.ts +50 -25
  226. package/src/components/SheetToolbar/style.ts +52 -22
  227. package/src/components/SheetToolbar/useToolbarState.ts +22 -5
  228. package/src/components/index.ts +1 -7
  229. package/src/{components → containers}/RangeList/RangeList.tsx +23 -18
  230. package/src/containers/RangeList/index.ts +5 -0
  231. package/src/containers/SheetArticle/SheetArticle.stories.tsx +110 -0
  232. package/src/containers/SheetArticle/SheetArticle.tsx +57 -0
  233. package/src/containers/SheetArticle/index.ts +5 -0
  234. package/src/containers/index.ts +8 -0
  235. package/src/extensions/compute.stories.tsx +31 -21
  236. package/src/extensions/compute.ts +2 -2
  237. package/src/extensions/editor/sheet-extension.test.ts +1 -1
  238. package/src/extensions/editor/sheet-extension.ts +18 -15
  239. package/src/index.ts +2 -2
  240. package/src/integrations/thread-ranges.ts +19 -56
  241. package/src/meta.ts +3 -3
  242. package/src/model/sheet-model.test.ts +5 -5
  243. package/src/model/sheet-model.ts +80 -48
  244. package/src/model/testing.ts +2 -2
  245. package/src/model/useSheetModel.ts +3 -2
  246. package/src/operations/drop-axis.ts +26 -0
  247. package/src/operations/index.ts +12 -0
  248. package/src/operations/insert-axis.ts +19 -0
  249. package/src/operations/restore-axis.ts +19 -0
  250. package/src/operations/scroll-to-anchor.ts +30 -0
  251. package/src/playwright/playwright.config.ts +1 -1
  252. package/src/playwright/sheet.spec.ts +4 -3
  253. package/src/plugin.ts +11 -0
  254. package/src/sanity.test.ts +10 -3
  255. package/src/serializer.ts +3 -3
  256. package/src/testing/data.ts +1 -1
  257. package/src/testing/testing.tsx +4 -4
  258. package/src/translations.ts +41 -35
  259. package/src/types/Sheet.ts +32 -32
  260. package/src/types/SheetCapabilities.ts +26 -0
  261. package/src/types/SheetOperation.ts +75 -0
  262. package/src/types/index.ts +4 -1
  263. package/src/types/sheet-range-types.ts +3 -3
  264. package/src/types/types.ts +4 -40
  265. package/src/types/util.ts +3 -2
  266. package/dist/lib/browser/SheetContainer-66BNB3XG.mjs +0 -349
  267. package/dist/lib/browser/SheetContainer-66BNB3XG.mjs.map +0 -7
  268. package/dist/lib/browser/anchor-sort-FCQ5OZZK.mjs +0 -23
  269. package/dist/lib/browser/anchor-sort-FCQ5OZZK.mjs.map +0 -7
  270. package/dist/lib/browser/chunk-73AV3NH6.mjs +0 -15
  271. package/dist/lib/browser/chunk-73AV3NH6.mjs.map +0 -7
  272. package/dist/lib/browser/chunk-7VEWYJJN.mjs.map +0 -7
  273. package/dist/lib/browser/chunk-DVJ3QW3F.mjs +0 -907
  274. package/dist/lib/browser/chunk-DVJ3QW3F.mjs.map +0 -7
  275. package/dist/lib/browser/chunk-FWFAAGXL.mjs.map +0 -7
  276. package/dist/lib/browser/chunk-OU5KTWY3.mjs +0 -852
  277. package/dist/lib/browser/chunk-OU5KTWY3.mjs.map +0 -7
  278. package/dist/lib/browser/compute-graph-registry-AP5RA7W3.mjs +0 -21
  279. package/dist/lib/browser/compute-graph-registry-AP5RA7W3.mjs.map +0 -7
  280. package/dist/lib/browser/index.mjs +0 -154
  281. package/dist/lib/browser/index.mjs.map +0 -7
  282. package/dist/lib/browser/intent-resolver-66OAYVQF.mjs +0 -56
  283. package/dist/lib/browser/intent-resolver-66OAYVQF.mjs.map +0 -7
  284. package/dist/lib/browser/markdown-B6VKYY2S.mjs +0 -26
  285. package/dist/lib/browser/markdown-B6VKYY2S.mjs.map +0 -7
  286. package/dist/lib/browser/meta.json +0 -1
  287. package/dist/lib/browser/react-surface-5GYLVSMR.mjs +0 -54
  288. package/dist/lib/browser/react-surface-5GYLVSMR.mjs.map +0 -7
  289. package/dist/lib/node-esm/SheetContainer-NWEQETAY.mjs +0 -350
  290. package/dist/lib/node-esm/SheetContainer-NWEQETAY.mjs.map +0 -7
  291. package/dist/lib/node-esm/anchor-sort-ZE7IS7SH.mjs +0 -24
  292. package/dist/lib/node-esm/anchor-sort-ZE7IS7SH.mjs.map +0 -7
  293. package/dist/lib/node-esm/chunk-44YTKTMP.mjs +0 -16
  294. package/dist/lib/node-esm/chunk-44YTKTMP.mjs.map +0 -7
  295. package/dist/lib/node-esm/chunk-4H2EHVWE.mjs +0 -908
  296. package/dist/lib/node-esm/chunk-4H2EHVWE.mjs.map +0 -7
  297. package/dist/lib/node-esm/chunk-4MT3JJU2.mjs +0 -853
  298. package/dist/lib/node-esm/chunk-4MT3JJU2.mjs.map +0 -7
  299. package/dist/lib/node-esm/chunk-4QV4AGWK.mjs +0 -236
  300. package/dist/lib/node-esm/chunk-4QV4AGWK.mjs.map +0 -7
  301. package/dist/lib/node-esm/chunk-HILDMVPL.mjs +0 -29
  302. package/dist/lib/node-esm/chunk-HILDMVPL.mjs.map +0 -7
  303. package/dist/lib/node-esm/compute-graph-registry-UMQ5UYCL.mjs +0 -22
  304. package/dist/lib/node-esm/compute-graph-registry-UMQ5UYCL.mjs.map +0 -7
  305. package/dist/lib/node-esm/index.mjs +0 -155
  306. package/dist/lib/node-esm/index.mjs.map +0 -7
  307. package/dist/lib/node-esm/intent-resolver-VNKIMQQT.mjs +0 -57
  308. package/dist/lib/node-esm/intent-resolver-VNKIMQQT.mjs.map +0 -7
  309. package/dist/lib/node-esm/markdown-VKY7HXU2.mjs +0 -27
  310. package/dist/lib/node-esm/markdown-VKY7HXU2.mjs.map +0 -7
  311. package/dist/lib/node-esm/meta.json +0 -1
  312. package/dist/lib/node-esm/react-surface-RK32YZWR.mjs +0 -55
  313. package/dist/lib/node-esm/react-surface-RK32YZWR.mjs.map +0 -7
  314. package/dist/types/src/capabilities/capabilities.d.ts +0 -5
  315. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  316. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  317. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  318. package/dist/types/src/components/FunctionEditor/FunctionEditor.d.ts +0 -3
  319. package/dist/types/src/components/FunctionEditor/FunctionEditor.d.ts.map +0 -1
  320. package/dist/types/src/components/FunctionEditor/index.d.ts +0 -2
  321. package/dist/types/src/components/FunctionEditor/index.d.ts.map +0 -1
  322. package/dist/types/src/components/GridSheet/GridSheet.d.ts +0 -3
  323. package/dist/types/src/components/GridSheet/GridSheet.d.ts.map +0 -1
  324. package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts +0 -54
  325. package/dist/types/src/components/GridSheet/GridSheet.stories.d.ts.map +0 -1
  326. package/dist/types/src/components/GridSheet/SheetCellEditor.stories.d.ts.map +0 -1
  327. package/dist/types/src/components/GridSheet/index.d.ts +0 -2
  328. package/dist/types/src/components/GridSheet/index.d.ts.map +0 -1
  329. package/dist/types/src/components/GridSheet/util.d.ts.map +0 -1
  330. package/dist/types/src/components/RangeList/RangeList.d.ts +0 -7
  331. package/dist/types/src/components/RangeList/RangeList.d.ts.map +0 -1
  332. package/dist/types/src/components/RangeList/index.d.ts +0 -2
  333. package/dist/types/src/components/RangeList/index.d.ts.map +0 -1
  334. package/dist/types/src/components/SheetContainer/SheetContainer.d.ts +0 -11
  335. package/dist/types/src/components/SheetContainer/SheetContainer.d.ts.map +0 -1
  336. package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts +0 -55
  337. package/dist/types/src/components/SheetContainer/SheetContainer.stories.d.ts.map +0 -1
  338. package/dist/types/src/components/SheetContainer/index.d.ts +0 -3
  339. package/dist/types/src/components/SheetContainer/index.d.ts.map +0 -1
  340. package/dist/types/src/components/SheetContext/SheetContext.d.ts.map +0 -1
  341. package/dist/types/src/components/SheetContext/index.d.ts +0 -2
  342. package/dist/types/src/components/SheetContext/index.d.ts.map +0 -1
  343. package/src/capabilities/capabilities.ts +0 -14
  344. package/src/capabilities/intent-resolver.ts +0 -38
  345. package/src/components/SheetContainer/SheetContainer.stories.tsx +0 -93
  346. package/src/components/SheetContainer/SheetContainer.tsx +0 -41
  347. package/src/components/SheetContainer/index.ts +0 -7
  348. package/src/components/SheetContext/index.ts +0 -5
  349. /package/dist/lib/{browser/types/index.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
  350. /package/dist/lib/{node-esm/types → neutral}/index.mjs.map +0 -0
@@ -1,908 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- __export,
4
- meta
5
- } from "./chunk-HILDMVPL.mjs";
6
-
7
- // src/types/Sheet.ts
8
- var Sheet_exports = {};
9
- __export(Sheet_exports, {
10
- CellValue: () => CellValue,
11
- Range: () => Range,
12
- RowColumnMeta: () => RowColumnMeta,
13
- Sheet: () => Sheet,
14
- make: () => make
15
- });
16
- import * as Schema from "effect/Schema";
17
- import { addressFromA1Notation as addressFromA1Notation2, isFormula as isFormula2 } from "@dxos/compute";
18
- import { Obj, Type } from "@dxos/echo";
19
- import { FormAnnotation } from "@dxos/echo/internal";
20
-
21
- // src/types/util.ts
22
- import { addressFromA1Notation, addressToA1Notation, isFormula } from "@dxos/compute";
23
- import { randomBytes } from "@dxos/crypto";
24
- import { invariant } from "@dxos/invariant";
25
- var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-sheet/src/types/util.ts";
26
- var MAX_ROWS = 500;
27
- var MAX_COLS = 676;
28
- var DEFAULT_ROWS = 50;
29
- var DEFAULT_COLS = 26;
30
- var ApiError = class extends Error {
31
- };
32
- var ReadonlyException = class extends ApiError {
33
- };
34
- var RangeException = class extends ApiError {
35
- constructor(n) {
36
- super();
37
- }
38
- };
39
- var createIndex = (length = 8) => {
40
- const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
41
- const charactersLength = characters.length;
42
- const randomBuffer = randomBytes(length);
43
- return Array.from(randomBuffer, (byte) => characters[byte % charactersLength]).join("");
44
- };
45
- var createIndices = (length) => Array.from({
46
- length
47
- }).map(() => createIndex());
48
- var insertIndices = (indices, i, n, max) => {
49
- if (i + n > max) {
50
- throw new RangeException(i + n);
51
- }
52
- const idx = createIndices(n);
53
- indices.splice(i, 0, ...idx);
54
- return idx;
55
- };
56
- var initialize = (sheet, { rows = DEFAULT_ROWS, columns = DEFAULT_COLS } = {}) => {
57
- if (!sheet.rows.length) {
58
- insertIndices(sheet.rows, 0, rows, MAX_ROWS);
59
- }
60
- if (!sheet.columns.length) {
61
- insertIndices(sheet.columns, 0, columns, MAX_COLS);
62
- }
63
- };
64
- var addressToIndex = (sheet, cell) => {
65
- return `${sheet.columns[cell.col]}@${sheet.rows[cell.row]}`;
66
- };
67
- var addressFromIndex = (sheet, idx) => {
68
- const [column, row] = idx.split("@");
69
- return {
70
- col: sheet.columns.indexOf(column),
71
- row: sheet.rows.indexOf(row)
72
- };
73
- };
74
- var rangeToIndex = (sheet, range) => {
75
- return [
76
- range.from,
77
- range.to ?? range.from
78
- ].map((cell) => addressToIndex(sheet, cell)).join(":");
79
- };
80
- var rangeFromIndex = (sheet, idx) => {
81
- const [from, to] = idx.split(":").map((index) => addressFromIndex(sheet, index));
82
- return {
83
- from,
84
- to
85
- };
86
- };
87
- var compareIndexPositions = (sheet, indexA, indexB) => {
88
- const { row: rowA, col: columnA } = addressFromIndex(sheet, indexA);
89
- const { row: rowB, col: columnB } = addressFromIndex(sheet, indexB);
90
- if (rowA !== rowB) {
91
- return rowA - rowB;
92
- } else {
93
- return columnA - columnB;
94
- }
95
- };
96
- var mapFormulaRefsToIndices = (sheet, formula) => {
97
- invariant(isFormula(formula), void 0, {
98
- F: __dxlog_file,
99
- L: 124,
100
- S: void 0,
101
- A: [
102
- "isFormula(formula)",
103
- ""
104
- ]
105
- });
106
- return formula.replace(/([a-zA-Z]+)([0-9]+)/g, (match) => {
107
- return addressToIndex(sheet, addressFromA1Notation(match));
108
- });
109
- };
110
- var mapFormulaIndicesToRefs = (sheet, formula) => {
111
- invariant(isFormula(formula), void 0, {
112
- F: __dxlog_file,
113
- L: 134,
114
- S: void 0,
115
- A: [
116
- "isFormula(formula)",
117
- ""
118
- ]
119
- });
120
- return formula.replace(/([a-zA-Z0-9]+)@([a-zA-Z0-9]+)/g, (idx) => {
121
- return addressToA1Notation(addressFromIndex(sheet, idx));
122
- });
123
- };
124
-
125
- // src/types/Sheet.ts
126
- var CellValue = Schema.Struct({
127
- // TODO(burdon): How to store dates (datetime, date, time), percentages, etc.
128
- // Consider import/export; natural access for other plugins. Special handling for currency (precision).
129
- // TODO(burdon): Automerge (long string) or short string or number.
130
- value: Schema.Any
131
- });
132
- var Range = Schema.Struct({
133
- range: Schema.String,
134
- key: Schema.String,
135
- value: Schema.String
136
- });
137
- var RowColumnMeta = Schema.Struct({
138
- size: Schema.optional(Schema.Number)
139
- });
140
- var Sheet = Schema.Struct({
141
- name: Schema.optional(Schema.String),
142
- // Sparse map of cells referenced by index.
143
- cells: Schema.Record({
144
- key: Schema.String,
145
- value: Schema.mutable(CellValue)
146
- }).pipe(Schema.mutable, FormAnnotation.set(false)),
147
- // Ordered row indices.
148
- rows: Schema.Array(Schema.String).pipe(Schema.mutable, FormAnnotation.set(false)),
149
- // Ordered column indices.
150
- columns: Schema.Array(Schema.String).pipe(Schema.mutable, FormAnnotation.set(false)),
151
- // Row metadata referenced by index.
152
- rowMeta: Schema.Record({
153
- key: Schema.String,
154
- value: Schema.mutable(RowColumnMeta)
155
- }).pipe(Schema.mutable, FormAnnotation.set(false)),
156
- // Column metadata referenced by index.
157
- columnMeta: Schema.Record({
158
- key: Schema.String,
159
- value: Schema.mutable(RowColumnMeta)
160
- }).pipe(Schema.mutable, FormAnnotation.set(false)),
161
- // Cell formatting referenced by indexed range.
162
- ranges: Schema.Array(Range).pipe(Schema.mutable, FormAnnotation.set(false))
163
- }).pipe(Type.Obj({
164
- typename: "dxos.org/type/Sheet",
165
- version: "0.1.0"
166
- }));
167
- var make = ({ name, cells = {}, ...size } = {}) => {
168
- const sheet = Obj.make(Sheet, {
169
- name,
170
- cells: {},
171
- rows: [],
172
- columns: [],
173
- rowMeta: {},
174
- columnMeta: {},
175
- ranges: []
176
- });
177
- initialize(sheet, size);
178
- if (cells) {
179
- Object.entries(cells).forEach(([key, { value }]) => {
180
- const idx = addressToIndex(sheet, addressFromA1Notation2(key));
181
- if (isFormula2(value)) {
182
- value = mapFormulaRefsToIndices(sheet, value);
183
- }
184
- sheet.cells[idx] = {
185
- value
186
- };
187
- });
188
- }
189
- return sheet;
190
- };
191
-
192
- // src/types/sheet-range-types.ts
193
- var alignKey = "alignment";
194
- var commentKey = "comment";
195
- var styleKey = "style";
196
- var cellClassNameForRange = ({ key, value }) => {
197
- switch (key) {
198
- case alignKey:
199
- switch (value) {
200
- case "start":
201
- return "text-start";
202
- case "center":
203
- return "text-center";
204
- case "end":
205
- return "text-end";
206
- default:
207
- return void 0;
208
- }
209
- case commentKey:
210
- return "bg-gridComment";
211
- case styleKey:
212
- switch (value) {
213
- case "highlight":
214
- return "!bg-gridHighlight";
215
- case "softwrap":
216
- return "!whitespace-normal";
217
- default:
218
- return void 0;
219
- }
220
- default:
221
- return void 0;
222
- }
223
- };
224
-
225
- // src/types/types.ts
226
- import * as Schema2 from "effect/Schema";
227
-
228
- // src/model/sheet-model.ts
229
- import { Event } from "@dxos/async";
230
- import { DetailedCellError, ExportedCellChange, addressFromA1Notation as addressFromA1Notation3, addressToA1Notation as addressToA1Notation2, createSheetName, isFormula as isFormula3 } from "@dxos/compute";
231
- import { Resource } from "@dxos/context";
232
- import { Obj as Obj2 } from "@dxos/echo";
233
- import { FormatEnum, TypeEnum } from "@dxos/echo/internal";
234
- import { invariant as invariant2 } from "@dxos/invariant";
235
- import { PublicKey } from "@dxos/keys";
236
- import { log } from "@dxos/log";
237
- var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-sheet/src/model/sheet-model.ts";
238
- var typeMap = {
239
- BOOLEAN: {
240
- type: TypeEnum.Boolean
241
- },
242
- NUMBER_RAW: {
243
- type: TypeEnum.Number
244
- },
245
- NUMBER_PERCENT: {
246
- type: TypeEnum.Number,
247
- format: FormatEnum.Percent
248
- },
249
- NUMBER_CURRENCY: {
250
- type: TypeEnum.Number,
251
- format: FormatEnum.Currency
252
- },
253
- NUMBER_DATETIME: {
254
- type: TypeEnum.String,
255
- format: FormatEnum.DateTime
256
- },
257
- NUMBER_DATE: {
258
- type: TypeEnum.String,
259
- format: FormatEnum.Date
260
- },
261
- NUMBER_TIME: {
262
- type: TypeEnum.String,
263
- format: FormatEnum.Time
264
- }
265
- };
266
- var getTopLeft = (range) => {
267
- const to = range.to ?? range.from;
268
- return {
269
- row: Math.min(range.from.row, to.row),
270
- col: Math.min(range.from.col, to.col)
271
- };
272
- };
273
- var toSimpleCellAddress = (sheet, cell) => ({
274
- sheet,
275
- row: cell.row,
276
- col: cell.col
277
- });
278
- var toModelRange = (sheet, range) => ({
279
- start: toSimpleCellAddress(sheet, range.from),
280
- end: toSimpleCellAddress(sheet, range.to ?? range.from)
281
- });
282
- var SheetModel = class extends Resource {
283
- _graph;
284
- _sheet;
285
- _options;
286
- id = `model-${PublicKey.random().truncate()}`;
287
- // Wraps compute node.
288
- update = new Event();
289
- _node;
290
- constructor(_graph, _sheet, _options = {}) {
291
- super(), this._graph = _graph, this._sheet = _sheet, this._options = _options;
292
- }
293
- get graph() {
294
- return this._graph;
295
- }
296
- get sheet() {
297
- return this._sheet;
298
- }
299
- get readonly() {
300
- return this._options.readonly;
301
- }
302
- get bounds() {
303
- return {
304
- rows: this._sheet.rows.length,
305
- columns: this._sheet.columns.length
306
- };
307
- }
308
- /**
309
- * Initialize sheet and engine.
310
- */
311
- async _open() {
312
- log("initialize", {
313
- id: this.id
314
- }, {
315
- F: __dxlog_file2,
316
- L: 124,
317
- S: this,
318
- C: (f, a) => f(...a)
319
- });
320
- initialize(this._sheet);
321
- this._graph.update.on((event) => {
322
- if (event.type === "functionsUpdated") {
323
- this.reset();
324
- }
325
- });
326
- this._node = this._graph.getOrCreateNode(createSheetName({
327
- type: Obj2.getTypename(this._sheet),
328
- id: this._sheet.id
329
- }));
330
- await this._node.open();
331
- const unsubscribe = this._node.update.on((event) => this.update.emit(event));
332
- this._ctx.onDispose(unsubscribe);
333
- this.reset();
334
- }
335
- /**
336
- * Update engine.
337
- * NOTE: This resets the undo history.
338
- * @deprecated
339
- */
340
- reset() {
341
- invariant2(this._node, void 0, {
342
- F: __dxlog_file2,
343
- L: 152,
344
- S: this,
345
- A: [
346
- "this._node",
347
- ""
348
- ]
349
- });
350
- this._node.graph.hf.clearSheet(this._node.sheetId);
351
- Object.entries(this._sheet.cells).forEach(([key, { value }]) => {
352
- invariant2(this._node, void 0, {
353
- F: __dxlog_file2,
354
- L: 155,
355
- S: this,
356
- A: [
357
- "this._node",
358
- ""
359
- ]
360
- });
361
- const { col, row } = addressFromIndex(this._sheet, key);
362
- if (isFormula3(value)) {
363
- const binding = this._graph.mapFunctionBindingFromId(mapFormulaIndicesToRefs(this._sheet, value));
364
- if (binding) {
365
- value = this._graph.mapFormulaToNative(binding);
366
- } else {
367
- value = "";
368
- }
369
- }
370
- this._node.graph.hf.setCellContents({
371
- sheet: this._node.sheetId,
372
- row,
373
- col
374
- }, value);
375
- });
376
- }
377
- /**
378
- * Recalculate formulas.
379
- * NOTE: This resets the undo history.
380
- * https://hyperformula.handsontable.com/guide/volatile-functions.html#volatile-actions
381
- * @deprecated
382
- */
383
- // TODO(burdon): Remove.
384
- recalculate() {
385
- this._node?.graph.hf.rebuildAndRecalculate();
386
- }
387
- insertRows(i, n = 1) {
388
- const idx = insertIndices(this._sheet.rows, i, n, MAX_ROWS);
389
- this.reset();
390
- return idx;
391
- }
392
- insertColumns(i, n = 1) {
393
- const idx = insertIndices(this._sheet.columns, i, n, MAX_COLS);
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
- this._sheet.rows.splice(index, 1);
406
- delete this._sheet.rowMeta[rowIndex];
407
- this.reset();
408
- return {
409
- axis: "row",
410
- index,
411
- axisIndex: rowIndex,
412
- axisMeta: this._sheet.rowMeta[rowIndex],
413
- values
414
- };
415
- }
416
- dropColumn(colIndex) {
417
- const range = {
418
- from: addressFromIndex(this._sheet, `${colIndex}@${this._sheet.rows[0]}`),
419
- to: addressFromIndex(this._sheet, `${colIndex}@${this._sheet.rows[this._sheet.rows.length - 1]}`)
420
- };
421
- const values = this.getCellValues(range).flat();
422
- const index = this._sheet.columns.indexOf(colIndex);
423
- this.clear(range);
424
- this._sheet.columns.splice(index, 1);
425
- delete this._sheet.columnMeta[colIndex];
426
- this.reset();
427
- return {
428
- axis: "col",
429
- index,
430
- axisIndex: colIndex,
431
- axisMeta: this._sheet.rowMeta[colIndex],
432
- values
433
- };
434
- }
435
- restoreRow({ index, axisIndex, axisMeta, values }) {
436
- this._sheet.rows.splice(index, 0, axisIndex);
437
- values.forEach((value, col) => {
438
- if (value) {
439
- this._sheet.cells[`${this._sheet.columns[col]}@${axisIndex}`] = {
440
- value
441
- };
442
- }
443
- });
444
- if (axisMeta) {
445
- this._sheet.rowMeta[axisIndex] = axisMeta;
446
- }
447
- this.reset();
448
- }
449
- restoreColumn({ index, axisIndex, axisMeta, values }) {
450
- this._sheet.columns.splice(index, 0, axisIndex);
451
- values.forEach((value, row) => {
452
- if (value) {
453
- this._sheet.cells[`${axisIndex}@${this._sheet.rows[row]}`] = {
454
- value
455
- };
456
- }
457
- });
458
- if (axisMeta) {
459
- this._sheet.columnMeta[axisIndex] = axisMeta;
460
- }
461
- this.reset();
462
- }
463
- //
464
- // Undoable actions.
465
- // TODO(burdon): Group undoable methods; consistently update hf/sheet.
466
- //
467
- /**
468
- * Clear range of values.
469
- */
470
- clear(range) {
471
- invariant2(this._node, void 0, {
472
- F: __dxlog_file2,
473
- L: 258,
474
- S: this,
475
- A: [
476
- "this._node",
477
- ""
478
- ]
479
- });
480
- const topLeft = getTopLeft(range);
481
- const values = this._iterRange(range, () => null);
482
- this._node.graph.hf.setCellContents(toSimpleCellAddress(this._node.sheetId, topLeft), values);
483
- this._iterRange(range, (cell) => {
484
- const idx = addressToIndex(this._sheet, cell);
485
- delete this._sheet.cells[idx];
486
- });
487
- }
488
- cut(range) {
489
- invariant2(this._node, void 0, {
490
- F: __dxlog_file2,
491
- L: 269,
492
- S: this,
493
- A: [
494
- "this._node",
495
- ""
496
- ]
497
- });
498
- this._node.graph.hf.cut(toModelRange(this._node.sheetId, range));
499
- this._iterRange(range, (cell) => {
500
- const idx = addressToIndex(this._sheet, cell);
501
- delete this._sheet.cells[idx];
502
- });
503
- }
504
- copy(range) {
505
- invariant2(this._node, void 0, {
506
- F: __dxlog_file2,
507
- L: 278,
508
- S: this,
509
- A: [
510
- "this._node",
511
- ""
512
- ]
513
- });
514
- this._node.graph.hf.copy(toModelRange(this._node.sheetId, range));
515
- }
516
- paste(cell) {
517
- invariant2(this._node, void 0, {
518
- F: __dxlog_file2,
519
- L: 283,
520
- S: this,
521
- A: [
522
- "this._node",
523
- ""
524
- ]
525
- });
526
- if (!this._node.graph.hf.isClipboardEmpty()) {
527
- const changes = this._node.graph.hf.paste(toSimpleCellAddress(this._node.sheetId, cell));
528
- for (const change of changes) {
529
- if (change instanceof ExportedCellChange) {
530
- const { address, newValue } = change;
531
- const idx = addressToIndex(this._sheet, {
532
- row: address.row,
533
- col: address.col
534
- });
535
- this._sheet.cells[idx] = {
536
- value: newValue
537
- };
538
- }
539
- }
540
- }
541
- }
542
- // TODO(burdon): Display undo/redo state.
543
- undo() {
544
- invariant2(this._node, void 0, {
545
- F: __dxlog_file2,
546
- L: 298,
547
- S: this,
548
- A: [
549
- "this._node",
550
- ""
551
- ]
552
- });
553
- if (this._node.graph.hf.isThereSomethingToUndo()) {
554
- this._node.graph.hf.undo();
555
- }
556
- }
557
- redo() {
558
- invariant2(this._node, void 0, {
559
- F: __dxlog_file2,
560
- L: 306,
561
- S: this,
562
- A: [
563
- "this._node",
564
- ""
565
- ]
566
- });
567
- if (this._node.graph.hf.isThereSomethingToRedo()) {
568
- this._node.graph.hf.redo();
569
- }
570
- }
571
- /**
572
- * Get value from sheet.
573
- */
574
- getCellValue(cell) {
575
- const idx = addressToIndex(this._sheet, cell);
576
- return this._sheet.cells[idx]?.value ?? null;
577
- }
578
- /**
579
- * Get value as a string for editing.
580
- */
581
- getCellText(cell) {
582
- const value = this.getCellValue(cell);
583
- if (value == null) {
584
- return void 0;
585
- }
586
- if (isFormula3(value)) {
587
- return this._graph.mapFunctionBindingFromId(mapFormulaIndicesToRefs(this._sheet, value));
588
- } else {
589
- return String(value);
590
- }
591
- }
592
- /**
593
- * Get array of raw values from sheet.
594
- */
595
- getCellValues(range) {
596
- return this._iterRange(range, (cell) => this.getCellValue(cell));
597
- }
598
- /**
599
- * Gets the regular or computed value from the engine.
600
- */
601
- getValue(cell) {
602
- invariant2(this._node, void 0, {
603
- F: __dxlog_file2,
604
- L: 349,
605
- S: this,
606
- A: [
607
- "this._node",
608
- ""
609
- ]
610
- });
611
- const address = toSimpleCellAddress(this._node.sheetId, cell);
612
- const value = this._node.graph.hf.getCellValue(address);
613
- if (value instanceof DetailedCellError) {
614
- log.warn("cell error", {
615
- cell,
616
- error: value
617
- }, {
618
- F: __dxlog_file2,
619
- L: 354,
620
- S: this,
621
- C: (f, a) => f(...a)
622
- });
623
- return value.toString();
624
- }
625
- return value;
626
- }
627
- /**
628
- * Get value type.
629
- */
630
- getValueDescription(cell) {
631
- invariant2(this._node, void 0, {
632
- F: __dxlog_file2,
633
- L: 365,
634
- S: this,
635
- A: [
636
- "this._node",
637
- ""
638
- ]
639
- });
640
- const addr = toSimpleCellAddress(this._node.sheetId, cell);
641
- const type = this._node.graph.hf.getCellValueDetailedType(addr);
642
- return typeMap[type];
643
- }
644
- /**
645
- * Sets the value, updating the sheet and engine.
646
- */
647
- setValue(cell, value) {
648
- invariant2(this._node, void 0, {
649
- F: __dxlog_file2,
650
- L: 375,
651
- S: this,
652
- A: [
653
- "this._node",
654
- ""
655
- ]
656
- });
657
- if (this._options.readonly) {
658
- throw new ReadonlyException();
659
- }
660
- let refresh = false;
661
- if (cell.row >= this._sheet.rows.length) {
662
- insertIndices(this._sheet.rows, cell.row, 1, MAX_ROWS);
663
- refresh = true;
664
- }
665
- if (cell.col >= this._sheet.columns.length) {
666
- insertIndices(this._sheet.columns, cell.col, 1, MAX_COLS);
667
- refresh = true;
668
- }
669
- if (refresh) {
670
- this.reset();
671
- }
672
- this._node.graph.hf.setCellContents({
673
- sheet: this._node.sheetId,
674
- row: cell.row,
675
- col: cell.col
676
- }, [
677
- [
678
- isFormula3(value) ? this._graph.mapFormulaToNative(value) : value
679
- ]
680
- ]);
681
- const idx = addressToIndex(this._sheet, cell);
682
- if (value === void 0 || value === null) {
683
- delete this._sheet.cells[idx];
684
- } else {
685
- if (isFormula3(value)) {
686
- value = this._graph.mapFunctionBindingToId(mapFormulaRefsToIndices(this._sheet, value));
687
- }
688
- this._sheet.cells[idx] = {
689
- value
690
- };
691
- }
692
- }
693
- /**
694
- * Sets values from a simple map.
695
- */
696
- setValues(values) {
697
- Object.entries(values).forEach(([key, { value }]) => {
698
- this.setValue(addressFromA1Notation3(key), value);
699
- });
700
- }
701
- /**
702
- * Iterate range.
703
- */
704
- _iterRange(range, cb) {
705
- const to = range.to ?? range.from;
706
- const rowRange = [
707
- Math.min(range.from.row, to.row),
708
- Math.max(range.from.row, to.row)
709
- ];
710
- const columnRange = [
711
- Math.min(range.from.col, to.col),
712
- Math.max(range.from.col, to.col)
713
- ];
714
- const rows = [];
715
- for (let row = rowRange[0]; row <= rowRange[1]; row++) {
716
- const rowCells = [];
717
- for (let column = columnRange[0]; column <= columnRange[1]; column++) {
718
- const value = cb({
719
- row,
720
- col: column
721
- });
722
- if (value !== void 0) {
723
- rowCells.push(value);
724
- }
725
- }
726
- rows.push(rowCells);
727
- }
728
- return rows;
729
- }
730
- // TODO(burdon): Delete index.
731
- _deleteIndices(indices, i, n) {
732
- throw new Error("Not implemented");
733
- }
734
- // TODO(burdon): Move. Cannot use fractional without changing. Switch back to using unique IDs?
735
- _moveIndices(indices, i, j, n) {
736
- throw new Error("Not implemented");
737
- }
738
- /**
739
- * Map from indices to A1 notation.
740
- */
741
- mapFormulaIndicesToRefs(formula) {
742
- invariant2(isFormula3(formula), void 0, {
743
- F: __dxlog_file2,
744
- L: 460,
745
- S: this,
746
- A: [
747
- "isFormula(formula)",
748
- ""
749
- ]
750
- });
751
- return formula.replace(/([a-zA-Z0-9]+)@([a-zA-Z0-9]+)/g, (idx) => {
752
- return addressToA1Notation2(addressFromIndex(this._sheet, idx));
753
- });
754
- }
755
- //
756
- // Values
757
- //
758
- /**
759
- * https://hyperformula.handsontable.com/guide/date-and-time-handling.html#example
760
- * https://hyperformula.handsontable.com/api/interfaces/configparams.html#nulldate
761
- * NOTE: TODAY() is number of FULL days since nullDate. It will typically be -1 days from NOW().
762
- */
763
- toLocalDate(num) {
764
- const { year, month, day, hours, minutes, seconds } = this.toDateTime(num);
765
- return new Date(year, month - 1, day, hours, minutes, seconds);
766
- }
767
- toDateTime(num) {
768
- invariant2(this._node, void 0, {
769
- F: __dxlog_file2,
770
- L: 481,
771
- S: this,
772
- A: [
773
- "this._node",
774
- ""
775
- ]
776
- });
777
- return this._node.graph.hf.numberToDateTime(num);
778
- }
779
- toDate(num) {
780
- invariant2(this._node, void 0, {
781
- F: __dxlog_file2,
782
- L: 486,
783
- S: this,
784
- A: [
785
- "this._node",
786
- ""
787
- ]
788
- });
789
- return this._node.graph.hf.numberToDate(num);
790
- }
791
- toTime(num) {
792
- invariant2(this._node, void 0, {
793
- F: __dxlog_file2,
794
- L: 491,
795
- S: this,
796
- A: [
797
- "this._node",
798
- ""
799
- ]
800
- });
801
- return this._node.graph.hf.numberToTime(num);
802
- }
803
- };
804
-
805
- // src/model/useSheetModel.ts
806
- import { useEffect, useState } from "react";
807
- var useSheetModel = (graph, sheet, { readonly } = {}) => {
808
- const [model, setModel] = useState();
809
- useEffect(() => {
810
- if (!graph || !sheet) {
811
- return;
812
- }
813
- let model2;
814
- const t = setTimeout(async () => {
815
- model2 = new SheetModel(graph, sheet, {
816
- readonly
817
- });
818
- await model2.open();
819
- setModel(model2);
820
- });
821
- return () => {
822
- clearTimeout(t);
823
- void model2?.close();
824
- };
825
- }, [
826
- graph,
827
- sheet,
828
- readonly
829
- ]);
830
- return model;
831
- };
832
-
833
- // src/types/types.ts
834
- (function(SheetAction2) {
835
- const SHEET_ACTION = `${meta.id}/action`;
836
- class Create extends Schema2.TaggedClass()(`${SHEET_ACTION}/create`, {
837
- input: Schema2.Struct({
838
- name: Schema2.optional(Schema2.String)
839
- }),
840
- output: Schema2.Struct({
841
- object: Sheet
842
- })
843
- }) {
844
- }
845
- SheetAction2.Create = Create;
846
- const Axis = Schema2.Union(Schema2.Literal("row"), Schema2.Literal("col"));
847
- class InsertAxis extends Schema2.TaggedClass()(`${SHEET_ACTION}/axis-insert`, {
848
- input: Schema2.Struct({
849
- // TODO(wittjosiah): Schema.instanceOf(SheetModel) throws when running tests.
850
- model: Schema2.Any.pipe(Schema2.filter((model) => model instanceof SheetModel)),
851
- axis: Axis,
852
- index: Schema2.Number,
853
- count: Schema2.optional(Schema2.Number)
854
- }),
855
- output: Schema2.Void
856
- }) {
857
- }
858
- SheetAction2.InsertAxis = InsertAxis;
859
- SheetAction2.RestoreAxis = Schema2.Struct({
860
- axis: Axis,
861
- axisIndex: Schema2.String,
862
- index: Schema2.Number,
863
- axisMeta: RowColumnMeta,
864
- values: Schema2.Array(Schema2.Any)
865
- });
866
- class DropAxis extends Schema2.TaggedClass()(`${SHEET_ACTION}/axis-drop`, {
867
- input: Schema2.Struct({
868
- // TODO(wittjosiah): Schema.instanceOf(SheetModel) throws when running tests.
869
- model: Schema2.Any.pipe(Schema2.filter((model) => model instanceof SheetModel)),
870
- axis: Axis,
871
- axisIndex: Schema2.String,
872
- deletionData: Schema2.optional(SheetAction2.RestoreAxis)
873
- }),
874
- output: Schema2.Void
875
- }) {
876
- }
877
- SheetAction2.DropAxis = DropAxis;
878
- })(SheetAction || (SheetAction = {}));
879
- var SheetAction;
880
-
881
- export {
882
- MAX_ROWS,
883
- MAX_COLS,
884
- DEFAULT_ROWS,
885
- DEFAULT_COLS,
886
- ApiError,
887
- ReadonlyException,
888
- RangeException,
889
- createIndex,
890
- createIndices,
891
- insertIndices,
892
- initialize,
893
- addressToIndex,
894
- addressFromIndex,
895
- rangeToIndex,
896
- rangeFromIndex,
897
- compareIndexPositions,
898
- mapFormulaRefsToIndices,
899
- mapFormulaIndicesToRefs,
900
- Sheet_exports,
901
- alignKey,
902
- commentKey,
903
- styleKey,
904
- cellClassNameForRange,
905
- useSheetModel,
906
- SheetAction
907
- };
908
- //# sourceMappingURL=chunk-4H2EHVWE.mjs.map