@rowsncolumns/spreadsheet-state 28.0.66

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 (1541) hide show
  1. package/LICENSE.md +100 -0
  2. package/Readme.md +65 -0
  3. package/dist/cjs/api/border.d.ts +9 -0
  4. package/dist/cjs/api/border.d.ts.map +1 -0
  5. package/dist/cjs/api/border.js +25 -0
  6. package/dist/cjs/api/conditional-format.d.ts +2 -0
  7. package/dist/cjs/api/conditional-format.d.ts.map +1 -0
  8. package/dist/cjs/api/conditional-format.js +5 -0
  9. package/dist/cjs/api/copy-paste.d.ts +20 -0
  10. package/dist/cjs/api/copy-paste.d.ts.map +1 -0
  11. package/dist/cjs/api/copy-paste.js +384 -0
  12. package/dist/cjs/api/data-validation.d.ts +2 -0
  13. package/dist/cjs/api/data-validation.d.ts.map +1 -0
  14. package/dist/cjs/api/data-validation.js +5 -0
  15. package/dist/cjs/api/datatype.d.ts +89 -0
  16. package/dist/cjs/api/datatype.d.ts.map +1 -0
  17. package/dist/cjs/api/datatype.js +671 -0
  18. package/dist/cjs/api/date.d.ts +27 -0
  19. package/dist/cjs/api/date.d.ts.map +1 -0
  20. package/dist/cjs/api/date.js +222 -0
  21. package/dist/cjs/api/decimals.d.ts +10 -0
  22. package/dist/cjs/api/decimals.d.ts.map +1 -0
  23. package/dist/cjs/api/decimals.js +192 -0
  24. package/dist/cjs/api/dependency.d.ts +64 -0
  25. package/dist/cjs/api/dependency.d.ts.map +1 -0
  26. package/dist/cjs/api/dependency.js +279 -0
  27. package/dist/cjs/api/fill.d.ts +88 -0
  28. package/dist/cjs/api/fill.d.ts.map +1 -0
  29. package/dist/cjs/api/fill.js +959 -0
  30. package/dist/cjs/api/filter-range.d.ts +4 -0
  31. package/dist/cjs/api/filter-range.d.ts.map +1 -0
  32. package/dist/cjs/api/filter-range.js +101 -0
  33. package/dist/cjs/api/filter.d.ts +24 -0
  34. package/dist/cjs/api/filter.d.ts.map +1 -0
  35. package/dist/cjs/api/filter.js +66 -0
  36. package/dist/cjs/api/format-caches.d.ts +43 -0
  37. package/dist/cjs/api/format-caches.d.ts.map +1 -0
  38. package/dist/cjs/api/format-caches.js +107 -0
  39. package/dist/cjs/api/formula.d.ts +69 -0
  40. package/dist/cjs/api/formula.d.ts.map +1 -0
  41. package/dist/cjs/api/formula.js +458 -0
  42. package/dist/cjs/api/immer-utils.d.ts +66 -0
  43. package/dist/cjs/api/immer-utils.d.ts.map +1 -0
  44. package/dist/cjs/api/immer-utils.js +1633 -0
  45. package/dist/cjs/api/intl.d.ts +51 -0
  46. package/dist/cjs/api/intl.d.ts.map +1 -0
  47. package/dist/cjs/api/intl.js +261 -0
  48. package/dist/cjs/api/merges.d.ts +7 -0
  49. package/dist/cjs/api/merges.d.ts.map +1 -0
  50. package/dist/cjs/api/merges.js +134 -0
  51. package/dist/cjs/api/outline.d.ts +33 -0
  52. package/dist/cjs/api/outline.d.ts.map +1 -0
  53. package/dist/cjs/api/outline.js +70 -0
  54. package/dist/cjs/api/parse-html.d.ts +15 -0
  55. package/dist/cjs/api/parse-html.d.ts.map +1 -0
  56. package/dist/cjs/api/parse-html.js +1066 -0
  57. package/dist/cjs/api/patches.d.ts +11 -0
  58. package/dist/cjs/api/patches.d.ts.map +1 -0
  59. package/dist/cjs/api/patches.js +218 -0
  60. package/dist/cjs/api/pivot-range.d.ts +8 -0
  61. package/dist/cjs/api/pivot-range.d.ts.map +1 -0
  62. package/dist/cjs/api/pivot-range.js +130 -0
  63. package/dist/cjs/api/range-rule-helpers.d.ts +65 -0
  64. package/dist/cjs/api/range-rule-helpers.d.ts.map +1 -0
  65. package/dist/cjs/api/range-rule-helpers.js +142 -0
  66. package/dist/cjs/api/range.d.ts +19 -0
  67. package/dist/cjs/api/range.d.ts.map +1 -0
  68. package/dist/cjs/api/range.js +183 -0
  69. package/dist/cjs/api/rename-sheet.d.ts +22 -0
  70. package/dist/cjs/api/rename-sheet.d.ts.map +1 -0
  71. package/dist/cjs/api/rename-sheet.js +54 -0
  72. package/dist/cjs/api/selection.d.ts +36 -0
  73. package/dist/cjs/api/selection.d.ts.map +1 -0
  74. package/dist/cjs/api/selection.js +133 -0
  75. package/dist/cjs/api/sort.d.ts +3 -0
  76. package/dist/cjs/api/sort.d.ts.map +1 -0
  77. package/dist/cjs/api/sort.js +33 -0
  78. package/dist/cjs/api/split-text.d.ts +2 -0
  79. package/dist/cjs/api/split-text.d.ts.map +1 -0
  80. package/dist/cjs/api/split-text.js +25 -0
  81. package/dist/cjs/api/structural-formula-update.d.ts +75 -0
  82. package/dist/cjs/api/structural-formula-update.d.ts.map +1 -0
  83. package/dist/cjs/api/structural-formula-update.js +508 -0
  84. package/dist/cjs/api/table.d.ts +39 -0
  85. package/dist/cjs/api/table.d.ts.map +1 -0
  86. package/dist/cjs/api/table.js +337 -0
  87. package/dist/cjs/api/validation.d.ts +12 -0
  88. package/dist/cjs/api/validation.d.ts.map +1 -0
  89. package/dist/cjs/api/validation.js +306 -0
  90. package/dist/cjs/api/xlsx-source.d.ts +22 -0
  91. package/dist/cjs/api/xlsx-source.d.ts.map +1 -0
  92. package/dist/cjs/api/xlsx-source.js +31 -0
  93. package/dist/cjs/atoms/delete-sheet-atom.d.ts +6 -0
  94. package/dist/cjs/atoms/delete-sheet-atom.d.ts.map +1 -0
  95. package/dist/cjs/atoms/delete-sheet-atom.js +4 -0
  96. package/dist/cjs/atoms/dialog-state.atom.d.ts +23 -0
  97. package/dist/cjs/atoms/dialog-state.atom.d.ts.map +1 -0
  98. package/dist/cjs/atoms/dialog-state.atom.js +72 -0
  99. package/dist/cjs/atoms/editing-data-validation-id.atom.d.ts +7 -0
  100. package/dist/cjs/atoms/editing-data-validation-id.atom.d.ts.map +1 -0
  101. package/dist/cjs/atoms/editing-data-validation-id.atom.js +12 -0
  102. package/dist/cjs/atoms/editing-embed.atom.d.ts +8 -0
  103. package/dist/cjs/atoms/editing-embed.atom.d.ts.map +1 -0
  104. package/dist/cjs/atoms/editing-embed.atom.js +5 -0
  105. package/dist/cjs/atoms/editing-table.atom.d.ts +8 -0
  106. package/dist/cjs/atoms/editing-table.atom.d.ts.map +1 -0
  107. package/dist/cjs/atoms/editing-table.atom.js +6 -0
  108. package/dist/cjs/atoms/error-state.atom.d.ts +10 -0
  109. package/dist/cjs/atoms/error-state.atom.d.ts.map +1 -0
  110. package/dist/cjs/atoms/error-state.atom.js +5 -0
  111. package/dist/cjs/atoms/index.d.ts +5 -0
  112. package/dist/cjs/atoms/index.d.ts.map +1 -0
  113. package/dist/cjs/atoms/index.js +4 -0
  114. package/dist/cjs/atoms/insert-image-state.atom.d.ts +6 -0
  115. package/dist/cjs/atoms/insert-image-state.atom.d.ts.map +1 -0
  116. package/dist/cjs/atoms/insert-image-state.atom.js +9 -0
  117. package/dist/cjs/atoms/named-range.atom.d.ts +8 -0
  118. package/dist/cjs/atoms/named-range.atom.d.ts.map +1 -0
  119. package/dist/cjs/atoms/named-range.atom.js +6 -0
  120. package/dist/cjs/atoms/resize-dimension.atom.d.ts +12 -0
  121. package/dist/cjs/atoms/resize-dimension.atom.d.ts.map +1 -0
  122. package/dist/cjs/atoms/resize-dimension.atom.js +5 -0
  123. package/dist/cjs/atoms/sheet-observer.atom.d.ts +16 -0
  124. package/dist/cjs/atoms/sheet-observer.atom.d.ts.map +1 -0
  125. package/dist/cjs/atoms/sheet-observer.atom.js +19 -0
  126. package/dist/cjs/cellxfs-registry.d.ts +37 -0
  127. package/dist/cjs/cellxfs-registry.d.ts.map +1 -0
  128. package/dist/cjs/cellxfs-registry.js +175 -0
  129. package/dist/cjs/commands.d.ts +691 -0
  130. package/dist/cjs/commands.d.ts.map +1 -0
  131. package/dist/cjs/commands.js +1 -0
  132. package/dist/cjs/components/dialogs/delete-sheet-confirmation.d.ts +7 -0
  133. package/dist/cjs/components/dialogs/delete-sheet-confirmation.d.ts.map +1 -0
  134. package/dist/cjs/components/dialogs/delete-sheet-confirmation.js +31 -0
  135. package/dist/cjs/components/dialogs/error-state.d.ts +3 -0
  136. package/dist/cjs/components/dialogs/error-state.d.ts.map +1 -0
  137. package/dist/cjs/components/dialogs/error-state.js +24 -0
  138. package/dist/cjs/components/editors/cell-format-editor.d.ts +26 -0
  139. package/dist/cjs/components/editors/cell-format-editor.d.ts.map +1 -0
  140. package/dist/cjs/components/editors/cell-format-editor.js +671 -0
  141. package/dist/cjs/components/editors/conditional-format-editor.d.ts +43 -0
  142. package/dist/cjs/components/editors/conditional-format-editor.d.ts.map +1 -0
  143. package/dist/cjs/components/editors/conditional-format-editor.js +176 -0
  144. package/dist/cjs/components/editors/conditional-format-rule-editor.d.ts +27 -0
  145. package/dist/cjs/components/editors/conditional-format-rule-editor.d.ts.map +1 -0
  146. package/dist/cjs/components/editors/conditional-format-rule-editor.js +640 -0
  147. package/dist/cjs/components/editors/data-validation-editor.d.ts +27 -0
  148. package/dist/cjs/components/editors/data-validation-editor.d.ts.map +1 -0
  149. package/dist/cjs/components/editors/data-validation-editor.js +163 -0
  150. package/dist/cjs/components/editors/data-validation-rule-editor.d.ts +17 -0
  151. package/dist/cjs/components/editors/data-validation-rule-editor.d.ts.map +1 -0
  152. package/dist/cjs/components/editors/data-validation-rule-editor.js +217 -0
  153. package/dist/cjs/components/editors/embed-editor.d.ts +19 -0
  154. package/dist/cjs/components/editors/embed-editor.d.ts.map +1 -0
  155. package/dist/cjs/components/editors/embed-editor.js +80 -0
  156. package/dist/cjs/components/editors/insert-image-editor.d.ts +20 -0
  157. package/dist/cjs/components/editors/insert-image-editor.d.ts.map +1 -0
  158. package/dist/cjs/components/editors/insert-image-editor.js +78 -0
  159. package/dist/cjs/components/editors/insert-link-editor.d.ts +20 -0
  160. package/dist/cjs/components/editors/insert-link-editor.d.ts.map +1 -0
  161. package/dist/cjs/components/editors/insert-link-editor.js +64 -0
  162. package/dist/cjs/components/editors/named-range-editor.d.ts +13 -0
  163. package/dist/cjs/components/editors/named-range-editor.d.ts.map +1 -0
  164. package/dist/cjs/components/editors/named-range-editor.js +106 -0
  165. package/dist/cjs/components/editors/resize-dimension-editor.d.ts +9 -0
  166. package/dist/cjs/components/editors/resize-dimension-editor.d.ts.map +1 -0
  167. package/dist/cjs/components/editors/resize-dimension-editor.js +62 -0
  168. package/dist/cjs/components/editors/sheet-filter.d.ts +59 -0
  169. package/dist/cjs/components/editors/sheet-filter.d.ts.map +1 -0
  170. package/dist/cjs/components/editors/sheet-filter.js +119 -0
  171. package/dist/cjs/components/editors/table-editor.d.ts +12 -0
  172. package/dist/cjs/components/editors/table-editor.d.ts.map +1 -0
  173. package/dist/cjs/components/editors/table-editor.js +105 -0
  174. package/dist/cjs/components/index.d.ts +13 -0
  175. package/dist/cjs/components/index.d.ts.map +1 -0
  176. package/dist/cjs/components/index.js +12 -0
  177. package/dist/cjs/generated-names.d.ts +51 -0
  178. package/dist/cjs/generated-names.d.ts.map +1 -0
  179. package/dist/cjs/generated-names.js +5 -0
  180. package/dist/cjs/helpers/iterative-calculation.d.ts +4 -0
  181. package/dist/cjs/helpers/iterative-calculation.d.ts.map +1 -0
  182. package/dist/cjs/helpers/iterative-calculation.js +44 -0
  183. package/dist/cjs/helpers/sheet-title.d.ts +5 -0
  184. package/dist/cjs/helpers/sheet-title.d.ts.map +1 -0
  185. package/dist/cjs/helpers/sheet-title.js +11 -0
  186. package/dist/cjs/helpers.d.ts +45 -0
  187. package/dist/cjs/helpers.d.ts.map +1 -0
  188. package/dist/cjs/helpers.js +154 -0
  189. package/dist/cjs/hooks/use-async-datasource.d.ts +57 -0
  190. package/dist/cjs/hooks/use-async-datasource.d.ts.map +1 -0
  191. package/dist/cjs/hooks/use-async-datasource.js +329 -0
  192. package/dist/cjs/hooks/use-calculation-initialize.d.ts +61 -0
  193. package/dist/cjs/hooks/use-calculation-initialize.d.ts.map +1 -0
  194. package/dist/cjs/hooks/use-calculation-initialize.js +800 -0
  195. package/dist/cjs/hooks/use-calculation-process-array.d.ts +20 -0
  196. package/dist/cjs/hooks/use-calculation-process-array.d.ts.map +1 -0
  197. package/dist/cjs/hooks/use-calculation-process-array.js +331 -0
  198. package/dist/cjs/hooks/use-calculation-queue.d.ts +10 -0
  199. package/dist/cjs/hooks/use-calculation-queue.d.ts.map +1 -0
  200. package/dist/cjs/hooks/use-calculation-queue.js +15 -0
  201. package/dist/cjs/hooks/use-calculation-worker.d.ts +37 -0
  202. package/dist/cjs/hooks/use-calculation-worker.d.ts.map +1 -0
  203. package/dist/cjs/hooks/use-calculation-worker.js +1868 -0
  204. package/dist/cjs/hooks/use-calculation.d.ts +173 -0
  205. package/dist/cjs/hooks/use-calculation.d.ts.map +1 -0
  206. package/dist/cjs/hooks/use-calculation.js +2735 -0
  207. package/dist/cjs/hooks/use-can-edit-cellrange.d.ts +31 -0
  208. package/dist/cjs/hooks/use-can-edit-cellrange.d.ts.map +1 -0
  209. package/dist/cjs/hooks/use-can-edit-cellrange.js +86 -0
  210. package/dist/cjs/hooks/use-cellxfs-registry.d.ts +6 -0
  211. package/dist/cjs/hooks/use-cellxfs-registry.d.ts.map +1 -0
  212. package/dist/cjs/hooks/use-cellxfs-registry.js +22 -0
  213. package/dist/cjs/hooks/use-citations.d.ts +19 -0
  214. package/dist/cjs/hooks/use-citations.d.ts.map +1 -0
  215. package/dist/cjs/hooks/use-citations.js +62 -0
  216. package/dist/cjs/hooks/use-comments.d.ts +14 -0
  217. package/dist/cjs/hooks/use-comments.d.ts.map +1 -0
  218. package/dist/cjs/hooks/use-comments.js +49 -0
  219. package/dist/cjs/hooks/use-conditional-formatting-rules.d.ts +22 -0
  220. package/dist/cjs/hooks/use-conditional-formatting-rules.d.ts.map +1 -0
  221. package/dist/cjs/hooks/use-conditional-formatting-rules.js +95 -0
  222. package/dist/cjs/hooks/use-data-validation-rules.d.ts +54 -0
  223. package/dist/cjs/hooks/use-data-validation-rules.d.ts.map +1 -0
  224. package/dist/cjs/hooks/use-data-validation-rules.js +151 -0
  225. package/dist/cjs/hooks/use-deferred-calculation-flush.d.ts +14 -0
  226. package/dist/cjs/hooks/use-deferred-calculation-flush.d.ts.map +1 -0
  227. package/dist/cjs/hooks/use-deferred-calculation-flush.js +81 -0
  228. package/dist/cjs/hooks/use-idle-scheduler.d.ts +5 -0
  229. package/dist/cjs/hooks/use-idle-scheduler.d.ts.map +1 -0
  230. package/dist/cjs/hooks/use-idle-scheduler.js +46 -0
  231. package/dist/cjs/hooks/use-indent.d.ts +23 -0
  232. package/dist/cjs/hooks/use-indent.d.ts.map +1 -0
  233. package/dist/cjs/hooks/use-indent.js +98 -0
  234. package/dist/cjs/hooks/use-named-range.d.ts +7 -0
  235. package/dist/cjs/hooks/use-named-range.d.ts.map +1 -0
  236. package/dist/cjs/hooks/use-named-range.js +70 -0
  237. package/dist/cjs/hooks/use-on-adjust-row-height.d.ts +11 -0
  238. package/dist/cjs/hooks/use-on-adjust-row-height.d.ts.map +1 -0
  239. package/dist/cjs/hooks/use-on-adjust-row-height.js +66 -0
  240. package/dist/cjs/hooks/use-on-autoresize.d.ts +17 -0
  241. package/dist/cjs/hooks/use-on-autoresize.d.ts.map +1 -0
  242. package/dist/cjs/hooks/use-on-autoresize.js +39 -0
  243. package/dist/cjs/hooks/use-on-banded-ranges.d.ts +15 -0
  244. package/dist/cjs/hooks/use-on-banded-ranges.d.ts.map +1 -0
  245. package/dist/cjs/hooks/use-on-banded-ranges.js +38 -0
  246. package/dist/cjs/hooks/use-on-calculation-begin.d.ts +14 -0
  247. package/dist/cjs/hooks/use-on-calculation-begin.d.ts.map +1 -0
  248. package/dist/cjs/hooks/use-on-calculation-begin.js +36 -0
  249. package/dist/cjs/hooks/use-on-calculation-success.d.ts +22 -0
  250. package/dist/cjs/hooks/use-on-calculation-success.d.ts.map +1 -0
  251. package/dist/cjs/hooks/use-on-calculation-success.js +182 -0
  252. package/dist/cjs/hooks/use-on-change-batch-stream.d.ts +7 -0
  253. package/dist/cjs/hooks/use-on-change-batch-stream.d.ts.map +1 -0
  254. package/dist/cjs/hooks/use-on-change-batch-stream.js +59 -0
  255. package/dist/cjs/hooks/use-on-change-batch.d.ts +54 -0
  256. package/dist/cjs/hooks/use-on-change-batch.d.ts.map +1 -0
  257. package/dist/cjs/hooks/use-on-change-batch.js +124 -0
  258. package/dist/cjs/hooks/use-on-change-calculated-column.d.ts +23 -0
  259. package/dist/cjs/hooks/use-on-change-calculated-column.d.ts.map +1 -0
  260. package/dist/cjs/hooks/use-on-change-calculated-column.js +30 -0
  261. package/dist/cjs/hooks/use-on-change-decimals.d.ts +22 -0
  262. package/dist/cjs/hooks/use-on-change-decimals.d.ts.map +1 -0
  263. package/dist/cjs/hooks/use-on-change-decimals.js +47 -0
  264. package/dist/cjs/hooks/use-on-change-formatting.d.ts +44 -0
  265. package/dist/cjs/hooks/use-on-change-formatting.d.ts.map +1 -0
  266. package/dist/cjs/hooks/use-on-change-formatting.js +165 -0
  267. package/dist/cjs/hooks/use-on-change-sheet-tabcolor.d.ts +11 -0
  268. package/dist/cjs/hooks/use-on-change-sheet-tabcolor.d.ts.map +1 -0
  269. package/dist/cjs/hooks/use-on-change-sheet-tabcolor.js +27 -0
  270. package/dist/cjs/hooks/use-on-change-table-column.d.ts +25 -0
  271. package/dist/cjs/hooks/use-on-change-table-column.d.ts.map +1 -0
  272. package/dist/cjs/hooks/use-on-change-table-column.js +53 -0
  273. package/dist/cjs/hooks/use-on-change-theme.d.ts +11 -0
  274. package/dist/cjs/hooks/use-on-change-theme.d.ts.map +1 -0
  275. package/dist/cjs/hooks/use-on-change-theme.js +20 -0
  276. package/dist/cjs/hooks/use-on-change.d.ts +61 -0
  277. package/dist/cjs/hooks/use-on-change.d.ts.map +1 -0
  278. package/dist/cjs/hooks/use-on-change.js +298 -0
  279. package/dist/cjs/hooks/use-on-clear-formatting.d.ts +17 -0
  280. package/dist/cjs/hooks/use-on-clear-formatting.d.ts.map +1 -0
  281. package/dist/cjs/hooks/use-on-clear-formatting.js +46 -0
  282. package/dist/cjs/hooks/use-on-collapse-column-group.d.ts +11 -0
  283. package/dist/cjs/hooks/use-on-collapse-column-group.d.ts.map +1 -0
  284. package/dist/cjs/hooks/use-on-collapse-column-group.js +47 -0
  285. package/dist/cjs/hooks/use-on-collapse-row-group.d.ts +18 -0
  286. package/dist/cjs/hooks/use-on-collapse-row-group.d.ts.map +1 -0
  287. package/dist/cjs/hooks/use-on-collapse-row-group.js +57 -0
  288. package/dist/cjs/hooks/use-on-copy.d.ts +49 -0
  289. package/dist/cjs/hooks/use-on-copy.d.ts.map +1 -0
  290. package/dist/cjs/hooks/use-on-copy.js +325 -0
  291. package/dist/cjs/hooks/use-on-create-named-range.d.ts +13 -0
  292. package/dist/cjs/hooks/use-on-create-named-range.d.ts.map +1 -0
  293. package/dist/cjs/hooks/use-on-create-named-range.js +33 -0
  294. package/dist/cjs/hooks/use-on-create-sheet.d.ts +23 -0
  295. package/dist/cjs/hooks/use-on-create-sheet.d.ts.map +1 -0
  296. package/dist/cjs/hooks/use-on-create-sheet.js +66 -0
  297. package/dist/cjs/hooks/use-on-delete-cells-shift-left.d.ts +28 -0
  298. package/dist/cjs/hooks/use-on-delete-cells-shift-left.d.ts.map +1 -0
  299. package/dist/cjs/hooks/use-on-delete-cells-shift-left.js +66 -0
  300. package/dist/cjs/hooks/use-on-delete-cells-shift-up.d.ts +28 -0
  301. package/dist/cjs/hooks/use-on-delete-cells-shift-up.d.ts.map +1 -0
  302. package/dist/cjs/hooks/use-on-delete-cells-shift-up.js +66 -0
  303. package/dist/cjs/hooks/use-on-delete-column.d.ts +38 -0
  304. package/dist/cjs/hooks/use-on-delete-column.d.ts.map +1 -0
  305. package/dist/cjs/hooks/use-on-delete-column.js +87 -0
  306. package/dist/cjs/hooks/use-on-delete-named-range.d.ts +14 -0
  307. package/dist/cjs/hooks/use-on-delete-named-range.d.ts.map +1 -0
  308. package/dist/cjs/hooks/use-on-delete-named-range.js +23 -0
  309. package/dist/cjs/hooks/use-on-delete-row.d.ts +38 -0
  310. package/dist/cjs/hooks/use-on-delete-row.d.ts.map +1 -0
  311. package/dist/cjs/hooks/use-on-delete-row.js +87 -0
  312. package/dist/cjs/hooks/use-on-delete-sheet.d.ts +16 -0
  313. package/dist/cjs/hooks/use-on-delete-sheet.d.ts.map +1 -0
  314. package/dist/cjs/hooks/use-on-delete-sheet.js +37 -0
  315. package/dist/cjs/hooks/use-on-delete-table-row.d.ts +29 -0
  316. package/dist/cjs/hooks/use-on-delete-table-row.d.ts.map +1 -0
  317. package/dist/cjs/hooks/use-on-delete-table-row.js +56 -0
  318. package/dist/cjs/hooks/use-on-delete.d.ts +33 -0
  319. package/dist/cjs/hooks/use-on-delete.d.ts.map +1 -0
  320. package/dist/cjs/hooks/use-on-delete.js +60 -0
  321. package/dist/cjs/hooks/use-on-drag-n-drop.d.ts +55 -0
  322. package/dist/cjs/hooks/use-on-drag-n-drop.d.ts.map +1 -0
  323. package/dist/cjs/hooks/use-on-drag-n-drop.js +191 -0
  324. package/dist/cjs/hooks/use-on-duplicate-sheet.d.ts +29 -0
  325. package/dist/cjs/hooks/use-on-duplicate-sheet.d.ts.map +1 -0
  326. package/dist/cjs/hooks/use-on-duplicate-sheet.js +65 -0
  327. package/dist/cjs/hooks/use-on-embeds.d.ts +19 -0
  328. package/dist/cjs/hooks/use-on-embeds.d.ts.map +1 -0
  329. package/dist/cjs/hooks/use-on-embeds.js +87 -0
  330. package/dist/cjs/hooks/use-on-expand-column-group.d.ts +11 -0
  331. package/dist/cjs/hooks/use-on-expand-column-group.d.ts.map +1 -0
  332. package/dist/cjs/hooks/use-on-expand-column-group.js +45 -0
  333. package/dist/cjs/hooks/use-on-expand-row-group.d.ts +18 -0
  334. package/dist/cjs/hooks/use-on-expand-row-group.d.ts.map +1 -0
  335. package/dist/cjs/hooks/use-on-expand-row-group.js +52 -0
  336. package/dist/cjs/hooks/use-on-fill-range.d.ts +9 -0
  337. package/dist/cjs/hooks/use-on-fill-range.d.ts.map +1 -0
  338. package/dist/cjs/hooks/use-on-fill-range.js +55 -0
  339. package/dist/cjs/hooks/use-on-fill.d.ts +29 -0
  340. package/dist/cjs/hooks/use-on-fill.d.ts.map +1 -0
  341. package/dist/cjs/hooks/use-on-fill.js +78 -0
  342. package/dist/cjs/hooks/use-on-filter-table.d.ts +76 -0
  343. package/dist/cjs/hooks/use-on-filter-table.d.ts.map +1 -0
  344. package/dist/cjs/hooks/use-on-filter-table.js +429 -0
  345. package/dist/cjs/hooks/use-on-find-replace.d.ts +19 -0
  346. package/dist/cjs/hooks/use-on-find-replace.d.ts.map +1 -0
  347. package/dist/cjs/hooks/use-on-find-replace.js +150 -0
  348. package/dist/cjs/hooks/use-on-freeze.d.ts +13 -0
  349. package/dist/cjs/hooks/use-on-freeze.d.ts.map +1 -0
  350. package/dist/cjs/hooks/use-on-freeze.js +56 -0
  351. package/dist/cjs/hooks/use-on-group-columns.d.ts +11 -0
  352. package/dist/cjs/hooks/use-on-group-columns.d.ts.map +1 -0
  353. package/dist/cjs/hooks/use-on-group-columns.js +49 -0
  354. package/dist/cjs/hooks/use-on-group-rows.d.ts +17 -0
  355. package/dist/cjs/hooks/use-on-group-rows.d.ts.map +1 -0
  356. package/dist/cjs/hooks/use-on-group-rows.js +55 -0
  357. package/dist/cjs/hooks/use-on-hide-column.d.ts +23 -0
  358. package/dist/cjs/hooks/use-on-hide-column.d.ts.map +1 -0
  359. package/dist/cjs/hooks/use-on-hide-column.js +55 -0
  360. package/dist/cjs/hooks/use-on-hide-row.d.ts +32 -0
  361. package/dist/cjs/hooks/use-on-hide-row.d.ts.map +1 -0
  362. package/dist/cjs/hooks/use-on-hide-row.js +58 -0
  363. package/dist/cjs/hooks/use-on-hide-show-sheet.d.ts +18 -0
  364. package/dist/cjs/hooks/use-on-hide-show-sheet.d.ts.map +1 -0
  365. package/dist/cjs/hooks/use-on-hide-show-sheet.js +90 -0
  366. package/dist/cjs/hooks/use-on-import-csv-legacy.d.ts +8 -0
  367. package/dist/cjs/hooks/use-on-import-csv-legacy.d.ts.map +1 -0
  368. package/dist/cjs/hooks/use-on-import-csv-legacy.js +165 -0
  369. package/dist/cjs/hooks/use-on-import-csv.d.ts +28 -0
  370. package/dist/cjs/hooks/use-on-import-csv.d.ts.map +1 -0
  371. package/dist/cjs/hooks/use-on-import-csv.js +332 -0
  372. package/dist/cjs/hooks/use-on-import-excel.d.ts +67 -0
  373. package/dist/cjs/hooks/use-on-import-excel.d.ts.map +1 -0
  374. package/dist/cjs/hooks/use-on-import-excel.js +689 -0
  375. package/dist/cjs/hooks/use-on-insert-autosum.d.ts +9 -0
  376. package/dist/cjs/hooks/use-on-insert-autosum.d.ts.map +1 -0
  377. package/dist/cjs/hooks/use-on-insert-autosum.js +105 -0
  378. package/dist/cjs/hooks/use-on-insert-cells-shift-down.d.ts +28 -0
  379. package/dist/cjs/hooks/use-on-insert-cells-shift-down.d.ts.map +1 -0
  380. package/dist/cjs/hooks/use-on-insert-cells-shift-down.js +66 -0
  381. package/dist/cjs/hooks/use-on-insert-cells-shift-right.d.ts +28 -0
  382. package/dist/cjs/hooks/use-on-insert-cells-shift-right.d.ts.map +1 -0
  383. package/dist/cjs/hooks/use-on-insert-cells-shift-right.js +66 -0
  384. package/dist/cjs/hooks/use-on-insert-checkbox.d.ts +17 -0
  385. package/dist/cjs/hooks/use-on-insert-checkbox.d.ts.map +1 -0
  386. package/dist/cjs/hooks/use-on-insert-checkbox.js +87 -0
  387. package/dist/cjs/hooks/use-on-insert-column.d.ts +40 -0
  388. package/dist/cjs/hooks/use-on-insert-column.d.ts.map +1 -0
  389. package/dist/cjs/hooks/use-on-insert-column.js +93 -0
  390. package/dist/cjs/hooks/use-on-insert-date-time.d.ts +4 -0
  391. package/dist/cjs/hooks/use-on-insert-date-time.d.ts.map +1 -0
  392. package/dist/cjs/hooks/use-on-insert-date-time.js +12 -0
  393. package/dist/cjs/hooks/use-on-insert-date.d.ts +4 -0
  394. package/dist/cjs/hooks/use-on-insert-date.d.ts.map +1 -0
  395. package/dist/cjs/hooks/use-on-insert-date.js +13 -0
  396. package/dist/cjs/hooks/use-on-insert-image.d.ts +24 -0
  397. package/dist/cjs/hooks/use-on-insert-image.d.ts.map +1 -0
  398. package/dist/cjs/hooks/use-on-insert-image.js +145 -0
  399. package/dist/cjs/hooks/use-on-insert-link.d.ts +25 -0
  400. package/dist/cjs/hooks/use-on-insert-link.d.ts.map +1 -0
  401. package/dist/cjs/hooks/use-on-insert-link.js +220 -0
  402. package/dist/cjs/hooks/use-on-insert-note.d.ts +4 -0
  403. package/dist/cjs/hooks/use-on-insert-note.d.ts.map +1 -0
  404. package/dist/cjs/hooks/use-on-insert-note.js +14 -0
  405. package/dist/cjs/hooks/use-on-insert-row.d.ts +38 -0
  406. package/dist/cjs/hooks/use-on-insert-row.d.ts.map +1 -0
  407. package/dist/cjs/hooks/use-on-insert-row.js +106 -0
  408. package/dist/cjs/hooks/use-on-insert-table-row.d.ts +31 -0
  409. package/dist/cjs/hooks/use-on-insert-table-row.d.ts.map +1 -0
  410. package/dist/cjs/hooks/use-on-insert-table-row.js +60 -0
  411. package/dist/cjs/hooks/use-on-insert-time.d.ts +4 -0
  412. package/dist/cjs/hooks/use-on-insert-time.d.ts.map +1 -0
  413. package/dist/cjs/hooks/use-on-insert-time.js +12 -0
  414. package/dist/cjs/hooks/use-on-locale-change.d.ts +35 -0
  415. package/dist/cjs/hooks/use-on-locale-change.d.ts.map +1 -0
  416. package/dist/cjs/hooks/use-on-locale-change.js +314 -0
  417. package/dist/cjs/hooks/use-on-merge-unmerge-cells.d.ts +28 -0
  418. package/dist/cjs/hooks/use-on-merge-unmerge-cells.d.ts.map +1 -0
  419. package/dist/cjs/hooks/use-on-merge-unmerge-cells.js +366 -0
  420. package/dist/cjs/hooks/use-on-move-columns.d.ts +28 -0
  421. package/dist/cjs/hooks/use-on-move-columns.d.ts.map +1 -0
  422. package/dist/cjs/hooks/use-on-move-columns.js +378 -0
  423. package/dist/cjs/hooks/use-on-move-rows.d.ts +30 -0
  424. package/dist/cjs/hooks/use-on-move-rows.d.ts.map +1 -0
  425. package/dist/cjs/hooks/use-on-move-rows.js +293 -0
  426. package/dist/cjs/hooks/use-on-move-selection.d.ts +35 -0
  427. package/dist/cjs/hooks/use-on-move-selection.d.ts.map +1 -0
  428. package/dist/cjs/hooks/use-on-move-selection.js +477 -0
  429. package/dist/cjs/hooks/use-on-move-sheet.d.ts +12 -0
  430. package/dist/cjs/hooks/use-on-move-sheet.d.ts.map +1 -0
  431. package/dist/cjs/hooks/use-on-move-sheet.js +68 -0
  432. package/dist/cjs/hooks/use-on-move-table-columns.d.ts +21 -0
  433. package/dist/cjs/hooks/use-on-move-table-columns.d.ts.map +1 -0
  434. package/dist/cjs/hooks/use-on-move-table-columns.js +249 -0
  435. package/dist/cjs/hooks/use-on-paste.d.ts +79 -0
  436. package/dist/cjs/hooks/use-on-paste.d.ts.map +1 -0
  437. package/dist/cjs/hooks/use-on-paste.js +985 -0
  438. package/dist/cjs/hooks/use-on-protect-range.d.ts +20 -0
  439. package/dist/cjs/hooks/use-on-protect-range.d.ts.map +1 -0
  440. package/dist/cjs/hooks/use-on-protect-range.js +67 -0
  441. package/dist/cjs/hooks/use-on-protect-sheet.d.ts +19 -0
  442. package/dist/cjs/hooks/use-on-protect-sheet.d.ts.map +1 -0
  443. package/dist/cjs/hooks/use-on-protect-sheet.js +65 -0
  444. package/dist/cjs/hooks/use-on-remove-duplicates.d.ts +21 -0
  445. package/dist/cjs/hooks/use-on-remove-duplicates.d.ts.map +1 -0
  446. package/dist/cjs/hooks/use-on-remove-duplicates.js +40 -0
  447. package/dist/cjs/hooks/use-on-rename-sheet.d.ts +21 -0
  448. package/dist/cjs/hooks/use-on-rename-sheet.d.ts.map +1 -0
  449. package/dist/cjs/hooks/use-on-rename-sheet.js +80 -0
  450. package/dist/cjs/hooks/use-on-request-calculate-wrapper.d.ts +30 -0
  451. package/dist/cjs/hooks/use-on-request-calculate-wrapper.d.ts.map +1 -0
  452. package/dist/cjs/hooks/use-on-request-calculate-wrapper.js +90 -0
  453. package/dist/cjs/hooks/use-on-request-conditional-format.d.ts +2 -0
  454. package/dist/cjs/hooks/use-on-request-conditional-format.d.ts.map +1 -0
  455. package/dist/cjs/hooks/use-on-request-conditional-format.js +8 -0
  456. package/dist/cjs/hooks/use-on-request-data-validation.d.ts +7 -0
  457. package/dist/cjs/hooks/use-on-request-data-validation.d.ts.map +1 -0
  458. package/dist/cjs/hooks/use-on-request-data-validation.js +23 -0
  459. package/dist/cjs/hooks/use-on-request-define-named-range.d.ts +8 -0
  460. package/dist/cjs/hooks/use-on-request-define-named-range.d.ts.map +1 -0
  461. package/dist/cjs/hooks/use-on-request-define-named-range.js +19 -0
  462. package/dist/cjs/hooks/use-on-request-delete-sheet.d.ts +2 -0
  463. package/dist/cjs/hooks/use-on-request-delete-sheet.d.ts.map +1 -0
  464. package/dist/cjs/hooks/use-on-request-delete-sheet.js +12 -0
  465. package/dist/cjs/hooks/use-on-request-edit-table.d.ts +3 -0
  466. package/dist/cjs/hooks/use-on-request-edit-table.d.ts.map +1 -0
  467. package/dist/cjs/hooks/use-on-request-edit-table.js +11 -0
  468. package/dist/cjs/hooks/use-on-request-format-cells.d.ts +2 -0
  469. package/dist/cjs/hooks/use-on-request-format-cells.d.ts.map +1 -0
  470. package/dist/cjs/hooks/use-on-request-format-cells.js +8 -0
  471. package/dist/cjs/hooks/use-on-request-insert-image.d.ts +3 -0
  472. package/dist/cjs/hooks/use-on-request-insert-image.d.ts.map +1 -0
  473. package/dist/cjs/hooks/use-on-request-insert-image.js +12 -0
  474. package/dist/cjs/hooks/use-on-request-insert-link.d.ts +5 -0
  475. package/dist/cjs/hooks/use-on-request-insert-link.d.ts.map +1 -0
  476. package/dist/cjs/hooks/use-on-request-insert-link.js +9 -0
  477. package/dist/cjs/hooks/use-on-request-resize.d.ts +3 -0
  478. package/dist/cjs/hooks/use-on-request-resize.d.ts.map +1 -0
  479. package/dist/cjs/hooks/use-on-request-resize.js +13 -0
  480. package/dist/cjs/hooks/use-on-request-update-named-range.d.ts +3 -0
  481. package/dist/cjs/hooks/use-on-request-update-named-range.d.ts.map +1 -0
  482. package/dist/cjs/hooks/use-on-request-update-named-range.js +11 -0
  483. package/dist/cjs/hooks/use-on-resize-table.d.ts +33 -0
  484. package/dist/cjs/hooks/use-on-resize-table.d.ts.map +1 -0
  485. package/dist/cjs/hooks/use-on-resize-table.js +218 -0
  486. package/dist/cjs/hooks/use-on-resize.d.ts +19 -0
  487. package/dist/cjs/hooks/use-on-resize.d.ts.map +1 -0
  488. package/dist/cjs/hooks/use-on-resize.js +55 -0
  489. package/dist/cjs/hooks/use-on-set-outline-depth.d.ts +17 -0
  490. package/dist/cjs/hooks/use-on-set-outline-depth.d.ts.map +1 -0
  491. package/dist/cjs/hooks/use-on-set-outline-depth.js +96 -0
  492. package/dist/cjs/hooks/use-on-show-column.d.ts +16 -0
  493. package/dist/cjs/hooks/use-on-show-column.d.ts.map +1 -0
  494. package/dist/cjs/hooks/use-on-show-column.js +96 -0
  495. package/dist/cjs/hooks/use-on-show-row.d.ts +22 -0
  496. package/dist/cjs/hooks/use-on-show-row.d.ts.map +1 -0
  497. package/dist/cjs/hooks/use-on-show-row.js +99 -0
  498. package/dist/cjs/hooks/use-on-sort-column.d.ts +53 -0
  499. package/dist/cjs/hooks/use-on-sort-column.d.ts.map +1 -0
  500. package/dist/cjs/hooks/use-on-sort-column.js +300 -0
  501. package/dist/cjs/hooks/use-on-sort-range.d.ts +42 -0
  502. package/dist/cjs/hooks/use-on-sort-range.d.ts.map +1 -0
  503. package/dist/cjs/hooks/use-on-sort-range.js +252 -0
  504. package/dist/cjs/hooks/use-on-sort-table.d.ts +59 -0
  505. package/dist/cjs/hooks/use-on-sort-table.d.ts.map +1 -0
  506. package/dist/cjs/hooks/use-on-sort-table.js +345 -0
  507. package/dist/cjs/hooks/use-on-table.d.ts +49 -0
  508. package/dist/cjs/hooks/use-on-table.d.ts.map +1 -0
  509. package/dist/cjs/hooks/use-on-table.js +386 -0
  510. package/dist/cjs/hooks/use-on-trace-dependents-precedents.d.ts +14 -0
  511. package/dist/cjs/hooks/use-on-trace-dependents-precedents.d.ts.map +1 -0
  512. package/dist/cjs/hooks/use-on-trace-dependents-precedents.js +146 -0
  513. package/dist/cjs/hooks/use-on-ungroup-columns.d.ts +11 -0
  514. package/dist/cjs/hooks/use-on-ungroup-columns.d.ts.map +1 -0
  515. package/dist/cjs/hooks/use-on-ungroup-columns.js +57 -0
  516. package/dist/cjs/hooks/use-on-ungroup-rows.d.ts +17 -0
  517. package/dist/cjs/hooks/use-on-ungroup-rows.d.ts.map +1 -0
  518. package/dist/cjs/hooks/use-on-ungroup-rows.js +63 -0
  519. package/dist/cjs/hooks/use-on-update-named-range.d.ts +19 -0
  520. package/dist/cjs/hooks/use-on-update-named-range.d.ts.map +1 -0
  521. package/dist/cjs/hooks/use-on-update-named-range.js +133 -0
  522. package/dist/cjs/hooks/use-on-update-note.d.ts +13 -0
  523. package/dist/cjs/hooks/use-on-update-note.d.ts.map +1 -0
  524. package/dist/cjs/hooks/use-on-update-note.js +21 -0
  525. package/dist/cjs/hooks/use-on-update-sheet.d.ts +10 -0
  526. package/dist/cjs/hooks/use-on-update-sheet.d.ts.map +1 -0
  527. package/dist/cjs/hooks/use-on-update-sheet.js +12 -0
  528. package/dist/cjs/hooks/use-paint-format.d.ts +17 -0
  529. package/dist/cjs/hooks/use-paint-format.d.ts.map +1 -0
  530. package/dist/cjs/hooks/use-paint-format.js +118 -0
  531. package/dist/cjs/hooks/use-search.d.ts +81 -0
  532. package/dist/cjs/hooks/use-search.d.ts.map +1 -0
  533. package/dist/cjs/hooks/use-search.js +261 -0
  534. package/dist/cjs/hooks/use-select-next-prev-sheet.d.ts +11 -0
  535. package/dist/cjs/hooks/use-select-next-prev-sheet.d.ts.map +1 -0
  536. package/dist/cjs/hooks/use-select-next-prev-sheet.js +22 -0
  537. package/dist/cjs/hooks/use-sheet-observer.d.ts +20 -0
  538. package/dist/cjs/hooks/use-sheet-observer.d.ts.map +1 -0
  539. package/dist/cjs/hooks/use-sheet-observer.js +127 -0
  540. package/dist/cjs/hooks/use-sheet-properties.d.ts +105 -0
  541. package/dist/cjs/hooks/use-sheet-properties.d.ts.map +1 -0
  542. package/dist/cjs/hooks/use-sheet-properties.js +1019 -0
  543. package/dist/cjs/hooks/use-sheet-state.d.ts +17 -0
  544. package/dist/cjs/hooks/use-sheet-state.d.ts.map +1 -0
  545. package/dist/cjs/hooks/use-sheet-state.js +84 -0
  546. package/dist/cjs/hooks/use-sheetdata-subscriber.d.ts +10 -0
  547. package/dist/cjs/hooks/use-sheetdata-subscriber.d.ts.map +1 -0
  548. package/dist/cjs/hooks/use-sheetdata-subscriber.js +15 -0
  549. package/dist/cjs/hooks/use-slicers.d.ts +19 -0
  550. package/dist/cjs/hooks/use-slicers.d.ts.map +1 -0
  551. package/dist/cjs/hooks/use-slicers.js +84 -0
  552. package/dist/cjs/hooks/use-split-text-to-columns.d.ts +19 -0
  553. package/dist/cjs/hooks/use-split-text-to-columns.d.ts.map +1 -0
  554. package/dist/cjs/hooks/use-split-text-to-columns.js +32 -0
  555. package/dist/cjs/hooks/use-spreadsheet-state.d.ts +627 -0
  556. package/dist/cjs/hooks/use-spreadsheet-state.d.ts.map +1 -0
  557. package/dist/cjs/hooks/use-spreadsheet-state.js +2038 -0
  558. package/dist/cjs/hooks/use-ss-registry.d.ts +6 -0
  559. package/dist/cjs/hooks/use-ss-registry.d.ts.map +1 -0
  560. package/dist/cjs/hooks/use-ss-registry.js +17 -0
  561. package/dist/cjs/hooks/use-structured-reference.d.ts +8 -0
  562. package/dist/cjs/hooks/use-structured-reference.d.ts.map +1 -0
  563. package/dist/cjs/hooks/use-structured-reference.js +132 -0
  564. package/dist/cjs/hooks/use-undo-redo-actions.d.ts +40 -0
  565. package/dist/cjs/hooks/use-undo-redo-actions.d.ts.map +1 -0
  566. package/dist/cjs/hooks/use-undo-redo-actions.js +209 -0
  567. package/dist/cjs/hooks/use-undo-redo.d.ts +69 -0
  568. package/dist/cjs/hooks/use-undo-redo.d.ts.map +1 -0
  569. package/dist/cjs/hooks/use-undo-redo.js +124 -0
  570. package/dist/cjs/hooks/utils/frozen-sort.d.ts +9 -0
  571. package/dist/cjs/hooks/utils/frozen-sort.d.ts.map +1 -0
  572. package/dist/cjs/hooks/utils/frozen-sort.js +28 -0
  573. package/dist/cjs/hooks/utils/sort-rows.d.ts +32 -0
  574. package/dist/cjs/hooks/utils/sort-rows.d.ts.map +1 -0
  575. package/dist/cjs/hooks/utils/sort-rows.js +113 -0
  576. package/dist/cjs/index.d.ts +38 -0
  577. package/dist/cjs/index.d.ts.map +1 -0
  578. package/dist/cjs/index.js +39 -0
  579. package/dist/cjs/interface/apply-fill.d.ts +6 -0
  580. package/dist/cjs/interface/apply-fill.d.ts.map +1 -0
  581. package/dist/cjs/interface/apply-fill.js +203 -0
  582. package/dist/cjs/interface/auto-resize.d.ts +4 -0
  583. package/dist/cjs/interface/auto-resize.d.ts.map +1 -0
  584. package/dist/cjs/interface/auto-resize.js +63 -0
  585. package/dist/cjs/interface/calculation-interface.d.ts +67 -0
  586. package/dist/cjs/interface/calculation-interface.d.ts.map +1 -0
  587. package/dist/cjs/interface/calculation-interface.js +409 -0
  588. package/dist/cjs/interface/change-batch-stream.d.ts +25 -0
  589. package/dist/cjs/interface/change-batch-stream.d.ts.map +1 -0
  590. package/dist/cjs/interface/change-batch-stream.js +428 -0
  591. package/dist/cjs/interface/change-batch.d.ts +39 -0
  592. package/dist/cjs/interface/change-batch.d.ts.map +1 -0
  593. package/dist/cjs/interface/change-batch.js +329 -0
  594. package/dist/cjs/interface/change-border.d.ts +5 -0
  595. package/dist/cjs/interface/change-border.d.ts.map +1 -0
  596. package/dist/cjs/interface/change-border.js +141 -0
  597. package/dist/cjs/interface/change-calculated-column.d.ts +5 -0
  598. package/dist/cjs/interface/change-calculated-column.d.ts.map +1 -0
  599. package/dist/cjs/interface/change-calculated-column.js +131 -0
  600. package/dist/cjs/interface/change-decimals.d.ts +7 -0
  601. package/dist/cjs/interface/change-decimals.d.ts.map +1 -0
  602. package/dist/cjs/interface/change-decimals.js +82 -0
  603. package/dist/cjs/interface/change-formatting.d.ts +4 -0
  604. package/dist/cjs/interface/change-formatting.d.ts.map +1 -0
  605. package/dist/cjs/interface/change-formatting.js +240 -0
  606. package/dist/cjs/interface/change-sheet-tabcolor.d.ts +4 -0
  607. package/dist/cjs/interface/change-sheet-tabcolor.d.ts.map +1 -0
  608. package/dist/cjs/interface/change-sheet-tabcolor.js +21 -0
  609. package/dist/cjs/interface/change-table-column.d.ts +49 -0
  610. package/dist/cjs/interface/change-table-column.d.ts.map +1 -0
  611. package/dist/cjs/interface/change-table-column.js +267 -0
  612. package/dist/cjs/interface/change-theme.d.ts +4 -0
  613. package/dist/cjs/interface/change-theme.d.ts.map +1 -0
  614. package/dist/cjs/interface/change-theme.js +23 -0
  615. package/dist/cjs/interface/chart-extensions.d.ts +32 -0
  616. package/dist/cjs/interface/chart-extensions.d.ts.map +1 -0
  617. package/dist/cjs/interface/chart-extensions.js +71 -0
  618. package/dist/cjs/interface/citations.d.ts +33 -0
  619. package/dist/cjs/interface/citations.d.ts.map +1 -0
  620. package/dist/cjs/interface/citations.js +142 -0
  621. package/dist/cjs/interface/clear-formatting.d.ts +5 -0
  622. package/dist/cjs/interface/clear-formatting.d.ts.map +1 -0
  623. package/dist/cjs/interface/clear-formatting.js +72 -0
  624. package/dist/cjs/interface/conditional-formatting-rules.d.ts +7 -0
  625. package/dist/cjs/interface/conditional-formatting-rules.d.ts.map +1 -0
  626. package/dist/cjs/interface/conditional-formatting-rules.js +191 -0
  627. package/dist/cjs/interface/create-table.d.ts +5 -0
  628. package/dist/cjs/interface/create-table.d.ts.map +1 -0
  629. package/dist/cjs/interface/create-table.js +96 -0
  630. package/dist/cjs/interface/data-validation-rules.d.ts +25 -0
  631. package/dist/cjs/interface/data-validation-rules.d.ts.map +1 -0
  632. package/dist/cjs/interface/data-validation-rules.js +366 -0
  633. package/dist/cjs/interface/data-validation-utils.d.ts +12 -0
  634. package/dist/cjs/interface/data-validation-utils.d.ts.map +1 -0
  635. package/dist/cjs/interface/data-validation-utils.js +118 -0
  636. package/dist/cjs/interface/delete-cells-shift-left.d.ts +5 -0
  637. package/dist/cjs/interface/delete-cells-shift-left.d.ts.map +1 -0
  638. package/dist/cjs/interface/delete-cells-shift-left.js +160 -0
  639. package/dist/cjs/interface/delete-cells-shift-up.d.ts +5 -0
  640. package/dist/cjs/interface/delete-cells-shift-up.d.ts.map +1 -0
  641. package/dist/cjs/interface/delete-cells-shift-up.js +152 -0
  642. package/dist/cjs/interface/delete-cells.d.ts +6 -0
  643. package/dist/cjs/interface/delete-cells.d.ts.map +1 -0
  644. package/dist/cjs/interface/delete-cells.js +231 -0
  645. package/dist/cjs/interface/delete-column.d.ts +4 -0
  646. package/dist/cjs/interface/delete-column.d.ts.map +1 -0
  647. package/dist/cjs/interface/delete-column.js +306 -0
  648. package/dist/cjs/interface/delete-row.d.ts +4 -0
  649. package/dist/cjs/interface/delete-row.d.ts.map +1 -0
  650. package/dist/cjs/interface/delete-row.js +227 -0
  651. package/dist/cjs/interface/delete-sheet.d.ts +4 -0
  652. package/dist/cjs/interface/delete-sheet.d.ts.map +1 -0
  653. package/dist/cjs/interface/delete-sheet.js +81 -0
  654. package/dist/cjs/interface/delete-table-column.d.ts +4 -0
  655. package/dist/cjs/interface/delete-table-column.d.ts.map +1 -0
  656. package/dist/cjs/interface/delete-table-column.js +349 -0
  657. package/dist/cjs/interface/delete-table-row.d.ts +4 -0
  658. package/dist/cjs/interface/delete-table-row.d.ts.map +1 -0
  659. package/dist/cjs/interface/delete-table-row.js +313 -0
  660. package/dist/cjs/interface/duplicate-sheet.d.ts +4 -0
  661. package/dist/cjs/interface/duplicate-sheet.d.ts.map +1 -0
  662. package/dist/cjs/interface/duplicate-sheet.js +232 -0
  663. package/dist/cjs/interface/embeds.d.ts +9 -0
  664. package/dist/cjs/interface/embeds.d.ts.map +1 -0
  665. package/dist/cjs/interface/embeds.js +121 -0
  666. package/dist/cjs/interface/freeze.d.ts +5 -0
  667. package/dist/cjs/interface/freeze.d.ts.map +1 -0
  668. package/dist/cjs/interface/freeze.js +160 -0
  669. package/dist/cjs/interface/helpers.d.ts +6 -0
  670. package/dist/cjs/interface/helpers.d.ts.map +1 -0
  671. package/dist/cjs/interface/helpers.js +44 -0
  672. package/dist/cjs/interface/hide-column.d.ts +4 -0
  673. package/dist/cjs/interface/hide-column.d.ts.map +1 -0
  674. package/dist/cjs/interface/hide-column.js +68 -0
  675. package/dist/cjs/interface/hide-row.d.ts +4 -0
  676. package/dist/cjs/interface/hide-row.d.ts.map +1 -0
  677. package/dist/cjs/interface/hide-row.js +65 -0
  678. package/dist/cjs/interface/indent.d.ts +7 -0
  679. package/dist/cjs/interface/indent.d.ts.map +1 -0
  680. package/dist/cjs/interface/indent.js +97 -0
  681. package/dist/cjs/interface/insert-cells-shift-down.d.ts +5 -0
  682. package/dist/cjs/interface/insert-cells-shift-down.d.ts.map +1 -0
  683. package/dist/cjs/interface/insert-cells-shift-down.js +154 -0
  684. package/dist/cjs/interface/insert-cells-shift-right.d.ts +5 -0
  685. package/dist/cjs/interface/insert-cells-shift-right.d.ts.map +1 -0
  686. package/dist/cjs/interface/insert-cells-shift-right.js +150 -0
  687. package/dist/cjs/interface/insert-column.d.ts +7 -0
  688. package/dist/cjs/interface/insert-column.d.ts.map +1 -0
  689. package/dist/cjs/interface/insert-column.js +645 -0
  690. package/dist/cjs/interface/insert-note.d.ts +5 -0
  691. package/dist/cjs/interface/insert-note.d.ts.map +1 -0
  692. package/dist/cjs/interface/insert-note.js +27 -0
  693. package/dist/cjs/interface/insert-row.d.ts +4 -0
  694. package/dist/cjs/interface/insert-row.d.ts.map +1 -0
  695. package/dist/cjs/interface/insert-row.js +188 -0
  696. package/dist/cjs/interface/insert-table-row.d.ts +4 -0
  697. package/dist/cjs/interface/insert-table-row.d.ts.map +1 -0
  698. package/dist/cjs/interface/insert-table-row.js +348 -0
  699. package/dist/cjs/interface/interface-cli.d.ts +3 -0
  700. package/dist/cjs/interface/interface-cli.d.ts.map +1 -0
  701. package/dist/cjs/interface/interface-cli.js +76 -0
  702. package/dist/cjs/interface/named-range-operations.d.ts +19 -0
  703. package/dist/cjs/interface/named-range-operations.d.ts.map +1 -0
  704. package/dist/cjs/interface/named-range-operations.js +96 -0
  705. package/dist/cjs/interface/new-sheet.d.ts +4 -0
  706. package/dist/cjs/interface/new-sheet.d.ts.map +1 -0
  707. package/dist/cjs/interface/new-sheet.js +109 -0
  708. package/dist/cjs/interface/pivot-extensions.d.ts +27 -0
  709. package/dist/cjs/interface/pivot-extensions.d.ts.map +1 -0
  710. package/dist/cjs/interface/pivot-extensions.js +62 -0
  711. package/dist/cjs/interface/remove-duplicates.d.ts +11 -0
  712. package/dist/cjs/interface/remove-duplicates.d.ts.map +1 -0
  713. package/dist/cjs/interface/remove-duplicates.js +132 -0
  714. package/dist/cjs/interface/remove-table.d.ts +4 -0
  715. package/dist/cjs/interface/remove-table.d.ts.map +1 -0
  716. package/dist/cjs/interface/remove-table.js +53 -0
  717. package/dist/cjs/interface/resize-utils.d.ts +18 -0
  718. package/dist/cjs/interface/resize-utils.d.ts.map +1 -0
  719. package/dist/cjs/interface/resize-utils.js +60 -0
  720. package/dist/cjs/interface/resize.d.ts +5 -0
  721. package/dist/cjs/interface/resize.d.ts.map +1 -0
  722. package/dist/cjs/interface/resize.js +56 -0
  723. package/dist/cjs/interface/slicers.d.ts +9 -0
  724. package/dist/cjs/interface/slicers.d.ts.map +1 -0
  725. package/dist/cjs/interface/slicers.js +113 -0
  726. package/dist/cjs/interface/split-text.d.ts +5 -0
  727. package/dist/cjs/interface/split-text.d.ts.map +1 -0
  728. package/dist/cjs/interface/split-text.js +120 -0
  729. package/dist/cjs/interface/spreadsheet-interface.d.ts +642 -0
  730. package/dist/cjs/interface/spreadsheet-interface.d.ts.map +1 -0
  731. package/dist/cjs/interface/spreadsheet-interface.js +2787 -0
  732. package/dist/cjs/interface/table-totalrow.d.ts +20 -0
  733. package/dist/cjs/interface/table-totalrow.d.ts.map +1 -0
  734. package/dist/cjs/interface/table-totalrow.js +170 -0
  735. package/dist/cjs/interface/table-utils.d.ts +21 -0
  736. package/dist/cjs/interface/table-utils.d.ts.map +1 -0
  737. package/dist/cjs/interface/table-utils.js +44 -0
  738. package/dist/cjs/interface/update-sheet.d.ts +16 -0
  739. package/dist/cjs/interface/update-sheet.d.ts.map +1 -0
  740. package/dist/cjs/interface/update-sheet.js +63 -0
  741. package/dist/cjs/interface/update-table.d.ts +4 -0
  742. package/dist/cjs/interface/update-table.d.ts.map +1 -0
  743. package/dist/cjs/interface/update-table.js +109 -0
  744. package/dist/cjs/server-utils.d.ts +8 -0
  745. package/dist/cjs/server-utils.d.ts.map +1 -0
  746. package/dist/cjs/server-utils.js +3 -0
  747. package/dist/cjs/server.browser.d.ts +9 -0
  748. package/dist/cjs/server.browser.d.ts.map +1 -0
  749. package/dist/cjs/server.browser.js +5 -0
  750. package/dist/cjs/server.d.ts +9 -0
  751. package/dist/cjs/server.d.ts.map +1 -0
  752. package/dist/cjs/server.js +5 -0
  753. package/dist/cjs/shared-string-registry.d.ts +35 -0
  754. package/dist/cjs/shared-string-registry.d.ts.map +1 -0
  755. package/dist/cjs/shared-string-registry.js +314 -0
  756. package/dist/cjs/sheet-cell.d.ts +310 -0
  757. package/dist/cjs/sheet-cell.d.ts.map +1 -0
  758. package/dist/cjs/sheet-cell.js +1809 -0
  759. package/dist/cjs/test-setup.d.ts +2 -0
  760. package/dist/cjs/test-setup.d.ts.map +1 -0
  761. package/dist/cjs/test-setup.js +3 -0
  762. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -0
  763. package/dist/cjs/types.d.ts +44 -0
  764. package/dist/cjs/types.d.ts.map +1 -0
  765. package/dist/cjs/types.js +33 -0
  766. package/dist/cjs/validation-schema/table.schema.d.ts +6 -0
  767. package/dist/cjs/validation-schema/table.schema.d.ts.map +1 -0
  768. package/dist/cjs/validation-schema/table.schema.js +4 -0
  769. package/dist/cjs/vitest.config.d.ts +3 -0
  770. package/dist/cjs/vitest.config.d.ts.map +1 -0
  771. package/dist/cjs/vitest.config.js +22 -0
  772. package/dist/esm/api/border.d.ts +9 -0
  773. package/dist/esm/api/border.d.ts.map +1 -0
  774. package/dist/esm/api/border.js +25 -0
  775. package/dist/esm/api/conditional-format.d.ts +2 -0
  776. package/dist/esm/api/conditional-format.d.ts.map +1 -0
  777. package/dist/esm/api/conditional-format.js +5 -0
  778. package/dist/esm/api/copy-paste.d.ts +20 -0
  779. package/dist/esm/api/copy-paste.d.ts.map +1 -0
  780. package/dist/esm/api/copy-paste.js +302 -0
  781. package/dist/esm/api/data-validation.d.ts +2 -0
  782. package/dist/esm/api/data-validation.d.ts.map +1 -0
  783. package/dist/esm/api/data-validation.js +5 -0
  784. package/dist/esm/api/datatype.d.ts +89 -0
  785. package/dist/esm/api/datatype.d.ts.map +1 -0
  786. package/dist/esm/api/datatype.js +639 -0
  787. package/dist/esm/api/date.d.ts +27 -0
  788. package/dist/esm/api/date.d.ts.map +1 -0
  789. package/dist/esm/api/date.js +220 -0
  790. package/dist/esm/api/decimals.d.ts +10 -0
  791. package/dist/esm/api/decimals.d.ts.map +1 -0
  792. package/dist/esm/api/decimals.js +181 -0
  793. package/dist/esm/api/dependency.d.ts +64 -0
  794. package/dist/esm/api/dependency.d.ts.map +1 -0
  795. package/dist/esm/api/dependency.js +251 -0
  796. package/dist/esm/api/fill.d.ts +88 -0
  797. package/dist/esm/api/fill.d.ts.map +1 -0
  798. package/dist/esm/api/fill.js +919 -0
  799. package/dist/esm/api/filter-range.d.ts +4 -0
  800. package/dist/esm/api/filter-range.d.ts.map +1 -0
  801. package/dist/esm/api/filter-range.js +100 -0
  802. package/dist/esm/api/filter.d.ts +24 -0
  803. package/dist/esm/api/filter.d.ts.map +1 -0
  804. package/dist/esm/api/filter.js +62 -0
  805. package/dist/esm/api/format-caches.d.ts +43 -0
  806. package/dist/esm/api/format-caches.d.ts.map +1 -0
  807. package/dist/esm/api/format-caches.js +95 -0
  808. package/dist/esm/api/formula.d.ts +69 -0
  809. package/dist/esm/api/formula.d.ts.map +1 -0
  810. package/dist/esm/api/formula.js +422 -0
  811. package/dist/esm/api/immer-utils.d.ts +66 -0
  812. package/dist/esm/api/immer-utils.d.ts.map +1 -0
  813. package/dist/esm/api/immer-utils.js +1552 -0
  814. package/dist/esm/api/intl.d.ts +51 -0
  815. package/dist/esm/api/intl.d.ts.map +1 -0
  816. package/dist/esm/api/intl.js +257 -0
  817. package/dist/esm/api/merges.d.ts +7 -0
  818. package/dist/esm/api/merges.d.ts.map +1 -0
  819. package/dist/esm/api/merges.js +174 -0
  820. package/dist/esm/api/outline.d.ts +33 -0
  821. package/dist/esm/api/outline.d.ts.map +1 -0
  822. package/dist/esm/api/outline.js +56 -0
  823. package/dist/esm/api/parse-html.d.ts +15 -0
  824. package/dist/esm/api/parse-html.d.ts.map +1 -0
  825. package/dist/esm/api/parse-html.js +865 -0
  826. package/dist/esm/api/patches.d.ts +11 -0
  827. package/dist/esm/api/patches.d.ts.map +1 -0
  828. package/dist/esm/api/patches.js +206 -0
  829. package/dist/esm/api/pivot-range.d.ts +8 -0
  830. package/dist/esm/api/pivot-range.d.ts.map +1 -0
  831. package/dist/esm/api/pivot-range.js +93 -0
  832. package/dist/esm/api/range-rule-helpers.d.ts +65 -0
  833. package/dist/esm/api/range-rule-helpers.d.ts.map +1 -0
  834. package/dist/esm/api/range-rule-helpers.js +138 -0
  835. package/dist/esm/api/range.d.ts +19 -0
  836. package/dist/esm/api/range.d.ts.map +1 -0
  837. package/dist/esm/api/range.js +136 -0
  838. package/dist/esm/api/rename-sheet.d.ts +22 -0
  839. package/dist/esm/api/rename-sheet.d.ts.map +1 -0
  840. package/dist/esm/api/rename-sheet.js +41 -0
  841. package/dist/esm/api/selection.d.ts +36 -0
  842. package/dist/esm/api/selection.d.ts.map +1 -0
  843. package/dist/esm/api/selection.js +138 -0
  844. package/dist/esm/api/sort.d.ts +3 -0
  845. package/dist/esm/api/sort.d.ts.map +1 -0
  846. package/dist/esm/api/sort.js +33 -0
  847. package/dist/esm/api/split-text.d.ts +2 -0
  848. package/dist/esm/api/split-text.d.ts.map +1 -0
  849. package/dist/esm/api/split-text.js +24 -0
  850. package/dist/esm/api/structural-formula-update.d.ts +75 -0
  851. package/dist/esm/api/structural-formula-update.d.ts.map +1 -0
  852. package/dist/esm/api/structural-formula-update.js +431 -0
  853. package/dist/esm/api/table.d.ts +39 -0
  854. package/dist/esm/api/table.d.ts.map +1 -0
  855. package/dist/esm/api/table.js +333 -0
  856. package/dist/esm/api/validation.d.ts +12 -0
  857. package/dist/esm/api/validation.d.ts.map +1 -0
  858. package/dist/esm/api/validation.js +297 -0
  859. package/dist/esm/api/xlsx-source.d.ts +22 -0
  860. package/dist/esm/api/xlsx-source.d.ts.map +1 -0
  861. package/dist/esm/api/xlsx-source.js +30 -0
  862. package/dist/esm/atoms/delete-sheet-atom.d.ts +6 -0
  863. package/dist/esm/atoms/delete-sheet-atom.d.ts.map +1 -0
  864. package/dist/esm/atoms/delete-sheet-atom.js +4 -0
  865. package/dist/esm/atoms/dialog-state.atom.d.ts +23 -0
  866. package/dist/esm/atoms/dialog-state.atom.d.ts.map +1 -0
  867. package/dist/esm/atoms/dialog-state.atom.js +34 -0
  868. package/dist/esm/atoms/editing-data-validation-id.atom.d.ts +7 -0
  869. package/dist/esm/atoms/editing-data-validation-id.atom.d.ts.map +1 -0
  870. package/dist/esm/atoms/editing-data-validation-id.atom.js +6 -0
  871. package/dist/esm/atoms/editing-embed.atom.d.ts +8 -0
  872. package/dist/esm/atoms/editing-embed.atom.d.ts.map +1 -0
  873. package/dist/esm/atoms/editing-embed.atom.js +5 -0
  874. package/dist/esm/atoms/editing-table.atom.d.ts +8 -0
  875. package/dist/esm/atoms/editing-table.atom.d.ts.map +1 -0
  876. package/dist/esm/atoms/editing-table.atom.js +6 -0
  877. package/dist/esm/atoms/error-state.atom.d.ts +10 -0
  878. package/dist/esm/atoms/error-state.atom.d.ts.map +1 -0
  879. package/dist/esm/atoms/error-state.atom.js +5 -0
  880. package/dist/esm/atoms/index.d.ts +5 -0
  881. package/dist/esm/atoms/index.d.ts.map +1 -0
  882. package/dist/esm/atoms/index.js +4 -0
  883. package/dist/esm/atoms/insert-image-state.atom.d.ts +6 -0
  884. package/dist/esm/atoms/insert-image-state.atom.d.ts.map +1 -0
  885. package/dist/esm/atoms/insert-image-state.atom.js +5 -0
  886. package/dist/esm/atoms/named-range.atom.d.ts +8 -0
  887. package/dist/esm/atoms/named-range.atom.d.ts.map +1 -0
  888. package/dist/esm/atoms/named-range.atom.js +6 -0
  889. package/dist/esm/atoms/resize-dimension.atom.d.ts +12 -0
  890. package/dist/esm/atoms/resize-dimension.atom.d.ts.map +1 -0
  891. package/dist/esm/atoms/resize-dimension.atom.js +5 -0
  892. package/dist/esm/atoms/sheet-observer.atom.d.ts +16 -0
  893. package/dist/esm/atoms/sheet-observer.atom.d.ts.map +1 -0
  894. package/dist/esm/atoms/sheet-observer.atom.js +16 -0
  895. package/dist/esm/cellxfs-registry.d.ts +37 -0
  896. package/dist/esm/cellxfs-registry.d.ts.map +1 -0
  897. package/dist/esm/cellxfs-registry.js +147 -0
  898. package/dist/esm/commands.d.ts +691 -0
  899. package/dist/esm/commands.d.ts.map +1 -0
  900. package/dist/esm/commands.js +1 -0
  901. package/dist/esm/components/dialogs/delete-sheet-confirmation.d.ts +7 -0
  902. package/dist/esm/components/dialogs/delete-sheet-confirmation.d.ts.map +1 -0
  903. package/dist/esm/components/dialogs/delete-sheet-confirmation.js +29 -0
  904. package/dist/esm/components/dialogs/error-state.d.ts +3 -0
  905. package/dist/esm/components/dialogs/error-state.d.ts.map +1 -0
  906. package/dist/esm/components/dialogs/error-state.js +22 -0
  907. package/dist/esm/components/editors/cell-format-editor.d.ts +26 -0
  908. package/dist/esm/components/editors/cell-format-editor.d.ts.map +1 -0
  909. package/dist/esm/components/editors/cell-format-editor.js +648 -0
  910. package/dist/esm/components/editors/conditional-format-editor.d.ts +43 -0
  911. package/dist/esm/components/editors/conditional-format-editor.d.ts.map +1 -0
  912. package/dist/esm/components/editors/conditional-format-editor.js +172 -0
  913. package/dist/esm/components/editors/conditional-format-rule-editor.d.ts +27 -0
  914. package/dist/esm/components/editors/conditional-format-rule-editor.d.ts.map +1 -0
  915. package/dist/esm/components/editors/conditional-format-rule-editor.js +608 -0
  916. package/dist/esm/components/editors/data-validation-editor.d.ts +27 -0
  917. package/dist/esm/components/editors/data-validation-editor.d.ts.map +1 -0
  918. package/dist/esm/components/editors/data-validation-editor.js +160 -0
  919. package/dist/esm/components/editors/data-validation-rule-editor.d.ts +17 -0
  920. package/dist/esm/components/editors/data-validation-rule-editor.d.ts.map +1 -0
  921. package/dist/esm/components/editors/data-validation-rule-editor.js +194 -0
  922. package/dist/esm/components/editors/embed-editor.d.ts +19 -0
  923. package/dist/esm/components/editors/embed-editor.d.ts.map +1 -0
  924. package/dist/esm/components/editors/embed-editor.js +75 -0
  925. package/dist/esm/components/editors/insert-image-editor.d.ts +20 -0
  926. package/dist/esm/components/editors/insert-image-editor.d.ts.map +1 -0
  927. package/dist/esm/components/editors/insert-image-editor.js +73 -0
  928. package/dist/esm/components/editors/insert-link-editor.d.ts +20 -0
  929. package/dist/esm/components/editors/insert-link-editor.d.ts.map +1 -0
  930. package/dist/esm/components/editors/insert-link-editor.js +60 -0
  931. package/dist/esm/components/editors/named-range-editor.d.ts +13 -0
  932. package/dist/esm/components/editors/named-range-editor.d.ts.map +1 -0
  933. package/dist/esm/components/editors/named-range-editor.js +103 -0
  934. package/dist/esm/components/editors/resize-dimension-editor.d.ts +9 -0
  935. package/dist/esm/components/editors/resize-dimension-editor.d.ts.map +1 -0
  936. package/dist/esm/components/editors/resize-dimension-editor.js +60 -0
  937. package/dist/esm/components/editors/sheet-filter.d.ts +59 -0
  938. package/dist/esm/components/editors/sheet-filter.d.ts.map +1 -0
  939. package/dist/esm/components/editors/sheet-filter.js +88 -0
  940. package/dist/esm/components/editors/table-editor.d.ts +12 -0
  941. package/dist/esm/components/editors/table-editor.d.ts.map +1 -0
  942. package/dist/esm/components/editors/table-editor.js +106 -0
  943. package/dist/esm/components/index.d.ts +13 -0
  944. package/dist/esm/components/index.d.ts.map +1 -0
  945. package/dist/esm/components/index.js +12 -0
  946. package/dist/esm/generated-names.d.ts +51 -0
  947. package/dist/esm/generated-names.d.ts.map +1 -0
  948. package/dist/esm/generated-names.js +5 -0
  949. package/dist/esm/helpers/iterative-calculation.d.ts +4 -0
  950. package/dist/esm/helpers/iterative-calculation.d.ts.map +1 -0
  951. package/dist/esm/helpers/iterative-calculation.js +44 -0
  952. package/dist/esm/helpers/sheet-title.d.ts +5 -0
  953. package/dist/esm/helpers/sheet-title.d.ts.map +1 -0
  954. package/dist/esm/helpers/sheet-title.js +13 -0
  955. package/dist/esm/helpers.d.ts +45 -0
  956. package/dist/esm/helpers.d.ts.map +1 -0
  957. package/dist/esm/helpers.js +143 -0
  958. package/dist/esm/hooks/use-async-datasource.d.ts +57 -0
  959. package/dist/esm/hooks/use-async-datasource.d.ts.map +1 -0
  960. package/dist/esm/hooks/use-async-datasource.js +276 -0
  961. package/dist/esm/hooks/use-calculation-initialize.d.ts +61 -0
  962. package/dist/esm/hooks/use-calculation-initialize.d.ts.map +1 -0
  963. package/dist/esm/hooks/use-calculation-initialize.js +603 -0
  964. package/dist/esm/hooks/use-calculation-process-array.d.ts +20 -0
  965. package/dist/esm/hooks/use-calculation-process-array.d.ts.map +1 -0
  966. package/dist/esm/hooks/use-calculation-process-array.js +279 -0
  967. package/dist/esm/hooks/use-calculation-queue.d.ts +10 -0
  968. package/dist/esm/hooks/use-calculation-queue.d.ts.map +1 -0
  969. package/dist/esm/hooks/use-calculation-queue.js +13 -0
  970. package/dist/esm/hooks/use-calculation-worker.d.ts +37 -0
  971. package/dist/esm/hooks/use-calculation-worker.d.ts.map +1 -0
  972. package/dist/esm/hooks/use-calculation-worker.js +1688 -0
  973. package/dist/esm/hooks/use-calculation.d.ts +173 -0
  974. package/dist/esm/hooks/use-calculation.d.ts.map +1 -0
  975. package/dist/esm/hooks/use-calculation.js +2069 -0
  976. package/dist/esm/hooks/use-can-edit-cellrange.d.ts +31 -0
  977. package/dist/esm/hooks/use-can-edit-cellrange.d.ts.map +1 -0
  978. package/dist/esm/hooks/use-can-edit-cellrange.js +72 -0
  979. package/dist/esm/hooks/use-cellxfs-registry.d.ts +6 -0
  980. package/dist/esm/hooks/use-cellxfs-registry.d.ts.map +1 -0
  981. package/dist/esm/hooks/use-cellxfs-registry.js +22 -0
  982. package/dist/esm/hooks/use-citations.d.ts +19 -0
  983. package/dist/esm/hooks/use-citations.d.ts.map +1 -0
  984. package/dist/esm/hooks/use-citations.js +61 -0
  985. package/dist/esm/hooks/use-comments.d.ts +14 -0
  986. package/dist/esm/hooks/use-comments.d.ts.map +1 -0
  987. package/dist/esm/hooks/use-comments.js +45 -0
  988. package/dist/esm/hooks/use-conditional-formatting-rules.d.ts +22 -0
  989. package/dist/esm/hooks/use-conditional-formatting-rules.d.ts.map +1 -0
  990. package/dist/esm/hooks/use-conditional-formatting-rules.js +81 -0
  991. package/dist/esm/hooks/use-data-validation-rules.d.ts +54 -0
  992. package/dist/esm/hooks/use-data-validation-rules.d.ts.map +1 -0
  993. package/dist/esm/hooks/use-data-validation-rules.js +135 -0
  994. package/dist/esm/hooks/use-deferred-calculation-flush.d.ts +14 -0
  995. package/dist/esm/hooks/use-deferred-calculation-flush.d.ts.map +1 -0
  996. package/dist/esm/hooks/use-deferred-calculation-flush.js +78 -0
  997. package/dist/esm/hooks/use-idle-scheduler.d.ts +5 -0
  998. package/dist/esm/hooks/use-idle-scheduler.d.ts.map +1 -0
  999. package/dist/esm/hooks/use-idle-scheduler.js +46 -0
  1000. package/dist/esm/hooks/use-indent.d.ts +23 -0
  1001. package/dist/esm/hooks/use-indent.d.ts.map +1 -0
  1002. package/dist/esm/hooks/use-indent.js +97 -0
  1003. package/dist/esm/hooks/use-named-range.d.ts +7 -0
  1004. package/dist/esm/hooks/use-named-range.d.ts.map +1 -0
  1005. package/dist/esm/hooks/use-named-range.js +69 -0
  1006. package/dist/esm/hooks/use-on-adjust-row-height.d.ts +11 -0
  1007. package/dist/esm/hooks/use-on-adjust-row-height.d.ts.map +1 -0
  1008. package/dist/esm/hooks/use-on-adjust-row-height.js +63 -0
  1009. package/dist/esm/hooks/use-on-autoresize.d.ts +17 -0
  1010. package/dist/esm/hooks/use-on-autoresize.d.ts.map +1 -0
  1011. package/dist/esm/hooks/use-on-autoresize.js +38 -0
  1012. package/dist/esm/hooks/use-on-banded-ranges.d.ts +15 -0
  1013. package/dist/esm/hooks/use-on-banded-ranges.d.ts.map +1 -0
  1014. package/dist/esm/hooks/use-on-banded-ranges.js +36 -0
  1015. package/dist/esm/hooks/use-on-calculation-begin.d.ts +14 -0
  1016. package/dist/esm/hooks/use-on-calculation-begin.d.ts.map +1 -0
  1017. package/dist/esm/hooks/use-on-calculation-begin.js +22 -0
  1018. package/dist/esm/hooks/use-on-calculation-success.d.ts +22 -0
  1019. package/dist/esm/hooks/use-on-calculation-success.d.ts.map +1 -0
  1020. package/dist/esm/hooks/use-on-calculation-success.js +167 -0
  1021. package/dist/esm/hooks/use-on-change-batch-stream.d.ts +7 -0
  1022. package/dist/esm/hooks/use-on-change-batch-stream.d.ts.map +1 -0
  1023. package/dist/esm/hooks/use-on-change-batch-stream.js +58 -0
  1024. package/dist/esm/hooks/use-on-change-batch.d.ts +54 -0
  1025. package/dist/esm/hooks/use-on-change-batch.d.ts.map +1 -0
  1026. package/dist/esm/hooks/use-on-change-batch.js +111 -0
  1027. package/dist/esm/hooks/use-on-change-calculated-column.d.ts +23 -0
  1028. package/dist/esm/hooks/use-on-change-calculated-column.d.ts.map +1 -0
  1029. package/dist/esm/hooks/use-on-change-calculated-column.js +29 -0
  1030. package/dist/esm/hooks/use-on-change-decimals.d.ts +22 -0
  1031. package/dist/esm/hooks/use-on-change-decimals.d.ts.map +1 -0
  1032. package/dist/esm/hooks/use-on-change-decimals.js +45 -0
  1033. package/dist/esm/hooks/use-on-change-formatting.d.ts +44 -0
  1034. package/dist/esm/hooks/use-on-change-formatting.d.ts.map +1 -0
  1035. package/dist/esm/hooks/use-on-change-formatting.js +158 -0
  1036. package/dist/esm/hooks/use-on-change-sheet-tabcolor.d.ts +11 -0
  1037. package/dist/esm/hooks/use-on-change-sheet-tabcolor.d.ts.map +1 -0
  1038. package/dist/esm/hooks/use-on-change-sheet-tabcolor.js +26 -0
  1039. package/dist/esm/hooks/use-on-change-table-column.d.ts +25 -0
  1040. package/dist/esm/hooks/use-on-change-table-column.d.ts.map +1 -0
  1041. package/dist/esm/hooks/use-on-change-table-column.js +52 -0
  1042. package/dist/esm/hooks/use-on-change-theme.d.ts +11 -0
  1043. package/dist/esm/hooks/use-on-change-theme.d.ts.map +1 -0
  1044. package/dist/esm/hooks/use-on-change-theme.js +11 -0
  1045. package/dist/esm/hooks/use-on-change.d.ts +61 -0
  1046. package/dist/esm/hooks/use-on-change.d.ts.map +1 -0
  1047. package/dist/esm/hooks/use-on-change.js +281 -0
  1048. package/dist/esm/hooks/use-on-clear-formatting.d.ts +17 -0
  1049. package/dist/esm/hooks/use-on-clear-formatting.d.ts.map +1 -0
  1050. package/dist/esm/hooks/use-on-clear-formatting.js +45 -0
  1051. package/dist/esm/hooks/use-on-collapse-column-group.d.ts +11 -0
  1052. package/dist/esm/hooks/use-on-collapse-column-group.d.ts.map +1 -0
  1053. package/dist/esm/hooks/use-on-collapse-column-group.js +44 -0
  1054. package/dist/esm/hooks/use-on-collapse-row-group.d.ts +18 -0
  1055. package/dist/esm/hooks/use-on-collapse-row-group.d.ts.map +1 -0
  1056. package/dist/esm/hooks/use-on-collapse-row-group.js +54 -0
  1057. package/dist/esm/hooks/use-on-copy.d.ts +49 -0
  1058. package/dist/esm/hooks/use-on-copy.d.ts.map +1 -0
  1059. package/dist/esm/hooks/use-on-copy.js +302 -0
  1060. package/dist/esm/hooks/use-on-create-named-range.d.ts +13 -0
  1061. package/dist/esm/hooks/use-on-create-named-range.d.ts.map +1 -0
  1062. package/dist/esm/hooks/use-on-create-named-range.js +32 -0
  1063. package/dist/esm/hooks/use-on-create-sheet.d.ts +23 -0
  1064. package/dist/esm/hooks/use-on-create-sheet.d.ts.map +1 -0
  1065. package/dist/esm/hooks/use-on-create-sheet.js +64 -0
  1066. package/dist/esm/hooks/use-on-delete-cells-shift-left.d.ts +28 -0
  1067. package/dist/esm/hooks/use-on-delete-cells-shift-left.d.ts.map +1 -0
  1068. package/dist/esm/hooks/use-on-delete-cells-shift-left.js +65 -0
  1069. package/dist/esm/hooks/use-on-delete-cells-shift-up.d.ts +28 -0
  1070. package/dist/esm/hooks/use-on-delete-cells-shift-up.d.ts.map +1 -0
  1071. package/dist/esm/hooks/use-on-delete-cells-shift-up.js +65 -0
  1072. package/dist/esm/hooks/use-on-delete-column.d.ts +38 -0
  1073. package/dist/esm/hooks/use-on-delete-column.d.ts.map +1 -0
  1074. package/dist/esm/hooks/use-on-delete-column.js +86 -0
  1075. package/dist/esm/hooks/use-on-delete-named-range.d.ts +14 -0
  1076. package/dist/esm/hooks/use-on-delete-named-range.d.ts.map +1 -0
  1077. package/dist/esm/hooks/use-on-delete-named-range.js +22 -0
  1078. package/dist/esm/hooks/use-on-delete-row.d.ts +38 -0
  1079. package/dist/esm/hooks/use-on-delete-row.d.ts.map +1 -0
  1080. package/dist/esm/hooks/use-on-delete-row.js +86 -0
  1081. package/dist/esm/hooks/use-on-delete-sheet.d.ts +16 -0
  1082. package/dist/esm/hooks/use-on-delete-sheet.d.ts.map +1 -0
  1083. package/dist/esm/hooks/use-on-delete-sheet.js +36 -0
  1084. package/dist/esm/hooks/use-on-delete-table-row.d.ts +29 -0
  1085. package/dist/esm/hooks/use-on-delete-table-row.d.ts.map +1 -0
  1086. package/dist/esm/hooks/use-on-delete-table-row.js +55 -0
  1087. package/dist/esm/hooks/use-on-delete.d.ts +33 -0
  1088. package/dist/esm/hooks/use-on-delete.d.ts.map +1 -0
  1089. package/dist/esm/hooks/use-on-delete.js +58 -0
  1090. package/dist/esm/hooks/use-on-drag-n-drop.d.ts +55 -0
  1091. package/dist/esm/hooks/use-on-drag-n-drop.d.ts.map +1 -0
  1092. package/dist/esm/hooks/use-on-drag-n-drop.js +160 -0
  1093. package/dist/esm/hooks/use-on-duplicate-sheet.d.ts +29 -0
  1094. package/dist/esm/hooks/use-on-duplicate-sheet.d.ts.map +1 -0
  1095. package/dist/esm/hooks/use-on-duplicate-sheet.js +63 -0
  1096. package/dist/esm/hooks/use-on-embeds.d.ts +19 -0
  1097. package/dist/esm/hooks/use-on-embeds.d.ts.map +1 -0
  1098. package/dist/esm/hooks/use-on-embeds.js +86 -0
  1099. package/dist/esm/hooks/use-on-expand-column-group.d.ts +11 -0
  1100. package/dist/esm/hooks/use-on-expand-column-group.d.ts.map +1 -0
  1101. package/dist/esm/hooks/use-on-expand-column-group.js +42 -0
  1102. package/dist/esm/hooks/use-on-expand-row-group.d.ts +18 -0
  1103. package/dist/esm/hooks/use-on-expand-row-group.d.ts.map +1 -0
  1104. package/dist/esm/hooks/use-on-expand-row-group.js +49 -0
  1105. package/dist/esm/hooks/use-on-fill-range.d.ts +9 -0
  1106. package/dist/esm/hooks/use-on-fill-range.d.ts.map +1 -0
  1107. package/dist/esm/hooks/use-on-fill-range.js +79 -0
  1108. package/dist/esm/hooks/use-on-fill.d.ts +29 -0
  1109. package/dist/esm/hooks/use-on-fill.d.ts.map +1 -0
  1110. package/dist/esm/hooks/use-on-fill.js +66 -0
  1111. package/dist/esm/hooks/use-on-filter-table.d.ts +76 -0
  1112. package/dist/esm/hooks/use-on-filter-table.d.ts.map +1 -0
  1113. package/dist/esm/hooks/use-on-filter-table.js +341 -0
  1114. package/dist/esm/hooks/use-on-find-replace.d.ts +19 -0
  1115. package/dist/esm/hooks/use-on-find-replace.d.ts.map +1 -0
  1116. package/dist/esm/hooks/use-on-find-replace.js +115 -0
  1117. package/dist/esm/hooks/use-on-freeze.d.ts +13 -0
  1118. package/dist/esm/hooks/use-on-freeze.d.ts.map +1 -0
  1119. package/dist/esm/hooks/use-on-freeze.js +55 -0
  1120. package/dist/esm/hooks/use-on-group-columns.d.ts +11 -0
  1121. package/dist/esm/hooks/use-on-group-columns.d.ts.map +1 -0
  1122. package/dist/esm/hooks/use-on-group-columns.js +35 -0
  1123. package/dist/esm/hooks/use-on-group-rows.d.ts +17 -0
  1124. package/dist/esm/hooks/use-on-group-rows.d.ts.map +1 -0
  1125. package/dist/esm/hooks/use-on-group-rows.js +41 -0
  1126. package/dist/esm/hooks/use-on-hide-column.d.ts +23 -0
  1127. package/dist/esm/hooks/use-on-hide-column.d.ts.map +1 -0
  1128. package/dist/esm/hooks/use-on-hide-column.js +54 -0
  1129. package/dist/esm/hooks/use-on-hide-row.d.ts +32 -0
  1130. package/dist/esm/hooks/use-on-hide-row.d.ts.map +1 -0
  1131. package/dist/esm/hooks/use-on-hide-row.js +57 -0
  1132. package/dist/esm/hooks/use-on-hide-show-sheet.d.ts +18 -0
  1133. package/dist/esm/hooks/use-on-hide-show-sheet.d.ts.map +1 -0
  1134. package/dist/esm/hooks/use-on-hide-show-sheet.js +88 -0
  1135. package/dist/esm/hooks/use-on-import-csv-legacy.d.ts +8 -0
  1136. package/dist/esm/hooks/use-on-import-csv-legacy.d.ts.map +1 -0
  1137. package/dist/esm/hooks/use-on-import-csv-legacy.js +148 -0
  1138. package/dist/esm/hooks/use-on-import-csv.d.ts +28 -0
  1139. package/dist/esm/hooks/use-on-import-csv.d.ts.map +1 -0
  1140. package/dist/esm/hooks/use-on-import-csv.js +267 -0
  1141. package/dist/esm/hooks/use-on-import-excel.d.ts +67 -0
  1142. package/dist/esm/hooks/use-on-import-excel.d.ts.map +1 -0
  1143. package/dist/esm/hooks/use-on-import-excel.js +595 -0
  1144. package/dist/esm/hooks/use-on-insert-autosum.d.ts +9 -0
  1145. package/dist/esm/hooks/use-on-insert-autosum.d.ts.map +1 -0
  1146. package/dist/esm/hooks/use-on-insert-autosum.js +91 -0
  1147. package/dist/esm/hooks/use-on-insert-cells-shift-down.d.ts +28 -0
  1148. package/dist/esm/hooks/use-on-insert-cells-shift-down.d.ts.map +1 -0
  1149. package/dist/esm/hooks/use-on-insert-cells-shift-down.js +65 -0
  1150. package/dist/esm/hooks/use-on-insert-cells-shift-right.d.ts +28 -0
  1151. package/dist/esm/hooks/use-on-insert-cells-shift-right.d.ts.map +1 -0
  1152. package/dist/esm/hooks/use-on-insert-cells-shift-right.js +65 -0
  1153. package/dist/esm/hooks/use-on-insert-checkbox.d.ts +17 -0
  1154. package/dist/esm/hooks/use-on-insert-checkbox.d.ts.map +1 -0
  1155. package/dist/esm/hooks/use-on-insert-checkbox.js +73 -0
  1156. package/dist/esm/hooks/use-on-insert-column.d.ts +40 -0
  1157. package/dist/esm/hooks/use-on-insert-column.d.ts.map +1 -0
  1158. package/dist/esm/hooks/use-on-insert-column.js +91 -0
  1159. package/dist/esm/hooks/use-on-insert-date-time.d.ts +4 -0
  1160. package/dist/esm/hooks/use-on-insert-date-time.d.ts.map +1 -0
  1161. package/dist/esm/hooks/use-on-insert-date-time.js +11 -0
  1162. package/dist/esm/hooks/use-on-insert-date.d.ts +4 -0
  1163. package/dist/esm/hooks/use-on-insert-date.d.ts.map +1 -0
  1164. package/dist/esm/hooks/use-on-insert-date.js +12 -0
  1165. package/dist/esm/hooks/use-on-insert-image.d.ts +24 -0
  1166. package/dist/esm/hooks/use-on-insert-image.d.ts.map +1 -0
  1167. package/dist/esm/hooks/use-on-insert-image.js +131 -0
  1168. package/dist/esm/hooks/use-on-insert-link.d.ts +25 -0
  1169. package/dist/esm/hooks/use-on-insert-link.d.ts.map +1 -0
  1170. package/dist/esm/hooks/use-on-insert-link.js +193 -0
  1171. package/dist/esm/hooks/use-on-insert-note.d.ts +4 -0
  1172. package/dist/esm/hooks/use-on-insert-note.d.ts.map +1 -0
  1173. package/dist/esm/hooks/use-on-insert-note.js +14 -0
  1174. package/dist/esm/hooks/use-on-insert-row.d.ts +38 -0
  1175. package/dist/esm/hooks/use-on-insert-row.d.ts.map +1 -0
  1176. package/dist/esm/hooks/use-on-insert-row.js +104 -0
  1177. package/dist/esm/hooks/use-on-insert-table-row.d.ts +31 -0
  1178. package/dist/esm/hooks/use-on-insert-table-row.d.ts.map +1 -0
  1179. package/dist/esm/hooks/use-on-insert-table-row.js +59 -0
  1180. package/dist/esm/hooks/use-on-insert-time.d.ts +4 -0
  1181. package/dist/esm/hooks/use-on-insert-time.d.ts.map +1 -0
  1182. package/dist/esm/hooks/use-on-insert-time.js +11 -0
  1183. package/dist/esm/hooks/use-on-locale-change.d.ts +35 -0
  1184. package/dist/esm/hooks/use-on-locale-change.d.ts.map +1 -0
  1185. package/dist/esm/hooks/use-on-locale-change.js +314 -0
  1186. package/dist/esm/hooks/use-on-merge-unmerge-cells.d.ts +28 -0
  1187. package/dist/esm/hooks/use-on-merge-unmerge-cells.d.ts.map +1 -0
  1188. package/dist/esm/hooks/use-on-merge-unmerge-cells.js +310 -0
  1189. package/dist/esm/hooks/use-on-move-columns.d.ts +28 -0
  1190. package/dist/esm/hooks/use-on-move-columns.d.ts.map +1 -0
  1191. package/dist/esm/hooks/use-on-move-columns.js +295 -0
  1192. package/dist/esm/hooks/use-on-move-rows.d.ts +30 -0
  1193. package/dist/esm/hooks/use-on-move-rows.d.ts.map +1 -0
  1194. package/dist/esm/hooks/use-on-move-rows.js +264 -0
  1195. package/dist/esm/hooks/use-on-move-selection.d.ts +35 -0
  1196. package/dist/esm/hooks/use-on-move-selection.d.ts.map +1 -0
  1197. package/dist/esm/hooks/use-on-move-selection.js +383 -0
  1198. package/dist/esm/hooks/use-on-move-sheet.d.ts +12 -0
  1199. package/dist/esm/hooks/use-on-move-sheet.d.ts.map +1 -0
  1200. package/dist/esm/hooks/use-on-move-sheet.js +65 -0
  1201. package/dist/esm/hooks/use-on-move-table-columns.d.ts +21 -0
  1202. package/dist/esm/hooks/use-on-move-table-columns.d.ts.map +1 -0
  1203. package/dist/esm/hooks/use-on-move-table-columns.js +235 -0
  1204. package/dist/esm/hooks/use-on-paste.d.ts +79 -0
  1205. package/dist/esm/hooks/use-on-paste.d.ts.map +1 -0
  1206. package/dist/esm/hooks/use-on-paste.js +868 -0
  1207. package/dist/esm/hooks/use-on-protect-range.d.ts +20 -0
  1208. package/dist/esm/hooks/use-on-protect-range.d.ts.map +1 -0
  1209. package/dist/esm/hooks/use-on-protect-range.js +67 -0
  1210. package/dist/esm/hooks/use-on-protect-sheet.d.ts +19 -0
  1211. package/dist/esm/hooks/use-on-protect-sheet.d.ts.map +1 -0
  1212. package/dist/esm/hooks/use-on-protect-sheet.js +61 -0
  1213. package/dist/esm/hooks/use-on-remove-duplicates.d.ts +21 -0
  1214. package/dist/esm/hooks/use-on-remove-duplicates.d.ts.map +1 -0
  1215. package/dist/esm/hooks/use-on-remove-duplicates.js +39 -0
  1216. package/dist/esm/hooks/use-on-rename-sheet.d.ts +21 -0
  1217. package/dist/esm/hooks/use-on-rename-sheet.d.ts.map +1 -0
  1218. package/dist/esm/hooks/use-on-rename-sheet.js +78 -0
  1219. package/dist/esm/hooks/use-on-request-calculate-wrapper.d.ts +30 -0
  1220. package/dist/esm/hooks/use-on-request-calculate-wrapper.d.ts.map +1 -0
  1221. package/dist/esm/hooks/use-on-request-calculate-wrapper.js +88 -0
  1222. package/dist/esm/hooks/use-on-request-conditional-format.d.ts +2 -0
  1223. package/dist/esm/hooks/use-on-request-conditional-format.d.ts.map +1 -0
  1224. package/dist/esm/hooks/use-on-request-conditional-format.js +8 -0
  1225. package/dist/esm/hooks/use-on-request-data-validation.d.ts +7 -0
  1226. package/dist/esm/hooks/use-on-request-data-validation.d.ts.map +1 -0
  1227. package/dist/esm/hooks/use-on-request-data-validation.js +21 -0
  1228. package/dist/esm/hooks/use-on-request-define-named-range.d.ts +8 -0
  1229. package/dist/esm/hooks/use-on-request-define-named-range.d.ts.map +1 -0
  1230. package/dist/esm/hooks/use-on-request-define-named-range.js +25 -0
  1231. package/dist/esm/hooks/use-on-request-delete-sheet.d.ts +2 -0
  1232. package/dist/esm/hooks/use-on-request-delete-sheet.d.ts.map +1 -0
  1233. package/dist/esm/hooks/use-on-request-delete-sheet.js +11 -0
  1234. package/dist/esm/hooks/use-on-request-edit-table.d.ts +3 -0
  1235. package/dist/esm/hooks/use-on-request-edit-table.d.ts.map +1 -0
  1236. package/dist/esm/hooks/use-on-request-edit-table.js +11 -0
  1237. package/dist/esm/hooks/use-on-request-format-cells.d.ts +2 -0
  1238. package/dist/esm/hooks/use-on-request-format-cells.d.ts.map +1 -0
  1239. package/dist/esm/hooks/use-on-request-format-cells.js +8 -0
  1240. package/dist/esm/hooks/use-on-request-insert-image.d.ts +3 -0
  1241. package/dist/esm/hooks/use-on-request-insert-image.d.ts.map +1 -0
  1242. package/dist/esm/hooks/use-on-request-insert-image.js +12 -0
  1243. package/dist/esm/hooks/use-on-request-insert-link.d.ts +5 -0
  1244. package/dist/esm/hooks/use-on-request-insert-link.d.ts.map +1 -0
  1245. package/dist/esm/hooks/use-on-request-insert-link.js +9 -0
  1246. package/dist/esm/hooks/use-on-request-resize.d.ts +3 -0
  1247. package/dist/esm/hooks/use-on-request-resize.d.ts.map +1 -0
  1248. package/dist/esm/hooks/use-on-request-resize.js +13 -0
  1249. package/dist/esm/hooks/use-on-request-update-named-range.d.ts +3 -0
  1250. package/dist/esm/hooks/use-on-request-update-named-range.d.ts.map +1 -0
  1251. package/dist/esm/hooks/use-on-request-update-named-range.js +11 -0
  1252. package/dist/esm/hooks/use-on-resize-table.d.ts +33 -0
  1253. package/dist/esm/hooks/use-on-resize-table.d.ts.map +1 -0
  1254. package/dist/esm/hooks/use-on-resize-table.js +212 -0
  1255. package/dist/esm/hooks/use-on-resize.d.ts +19 -0
  1256. package/dist/esm/hooks/use-on-resize.d.ts.map +1 -0
  1257. package/dist/esm/hooks/use-on-resize.js +54 -0
  1258. package/dist/esm/hooks/use-on-set-outline-depth.d.ts +17 -0
  1259. package/dist/esm/hooks/use-on-set-outline-depth.d.ts.map +1 -0
  1260. package/dist/esm/hooks/use-on-set-outline-depth.js +93 -0
  1261. package/dist/esm/hooks/use-on-show-column.d.ts +16 -0
  1262. package/dist/esm/hooks/use-on-show-column.d.ts.map +1 -0
  1263. package/dist/esm/hooks/use-on-show-column.js +82 -0
  1264. package/dist/esm/hooks/use-on-show-row.d.ts +22 -0
  1265. package/dist/esm/hooks/use-on-show-row.d.ts.map +1 -0
  1266. package/dist/esm/hooks/use-on-show-row.js +85 -0
  1267. package/dist/esm/hooks/use-on-sort-column.d.ts +53 -0
  1268. package/dist/esm/hooks/use-on-sort-column.d.ts.map +1 -0
  1269. package/dist/esm/hooks/use-on-sort-column.js +268 -0
  1270. package/dist/esm/hooks/use-on-sort-range.d.ts +42 -0
  1271. package/dist/esm/hooks/use-on-sort-range.d.ts.map +1 -0
  1272. package/dist/esm/hooks/use-on-sort-range.js +247 -0
  1273. package/dist/esm/hooks/use-on-sort-table.d.ts +59 -0
  1274. package/dist/esm/hooks/use-on-sort-table.d.ts.map +1 -0
  1275. package/dist/esm/hooks/use-on-sort-table.js +332 -0
  1276. package/dist/esm/hooks/use-on-table.d.ts +49 -0
  1277. package/dist/esm/hooks/use-on-table.d.ts.map +1 -0
  1278. package/dist/esm/hooks/use-on-table.js +384 -0
  1279. package/dist/esm/hooks/use-on-trace-dependents-precedents.d.ts +14 -0
  1280. package/dist/esm/hooks/use-on-trace-dependents-precedents.d.ts.map +1 -0
  1281. package/dist/esm/hooks/use-on-trace-dependents-precedents.js +144 -0
  1282. package/dist/esm/hooks/use-on-ungroup-columns.d.ts +11 -0
  1283. package/dist/esm/hooks/use-on-ungroup-columns.d.ts.map +1 -0
  1284. package/dist/esm/hooks/use-on-ungroup-columns.js +43 -0
  1285. package/dist/esm/hooks/use-on-ungroup-rows.d.ts +17 -0
  1286. package/dist/esm/hooks/use-on-ungroup-rows.d.ts.map +1 -0
  1287. package/dist/esm/hooks/use-on-ungroup-rows.js +49 -0
  1288. package/dist/esm/hooks/use-on-update-named-range.d.ts +19 -0
  1289. package/dist/esm/hooks/use-on-update-named-range.d.ts.map +1 -0
  1290. package/dist/esm/hooks/use-on-update-named-range.js +108 -0
  1291. package/dist/esm/hooks/use-on-update-note.d.ts +13 -0
  1292. package/dist/esm/hooks/use-on-update-note.d.ts.map +1 -0
  1293. package/dist/esm/hooks/use-on-update-note.js +20 -0
  1294. package/dist/esm/hooks/use-on-update-sheet.d.ts +10 -0
  1295. package/dist/esm/hooks/use-on-update-sheet.d.ts.map +1 -0
  1296. package/dist/esm/hooks/use-on-update-sheet.js +11 -0
  1297. package/dist/esm/hooks/use-paint-format.d.ts +17 -0
  1298. package/dist/esm/hooks/use-paint-format.d.ts.map +1 -0
  1299. package/dist/esm/hooks/use-paint-format.js +110 -0
  1300. package/dist/esm/hooks/use-search.d.ts +81 -0
  1301. package/dist/esm/hooks/use-search.d.ts.map +1 -0
  1302. package/dist/esm/hooks/use-search.js +251 -0
  1303. package/dist/esm/hooks/use-select-next-prev-sheet.d.ts +11 -0
  1304. package/dist/esm/hooks/use-select-next-prev-sheet.d.ts.map +1 -0
  1305. package/dist/esm/hooks/use-select-next-prev-sheet.js +21 -0
  1306. package/dist/esm/hooks/use-sheet-observer.d.ts +20 -0
  1307. package/dist/esm/hooks/use-sheet-observer.d.ts.map +1 -0
  1308. package/dist/esm/hooks/use-sheet-observer.js +120 -0
  1309. package/dist/esm/hooks/use-sheet-properties.d.ts +105 -0
  1310. package/dist/esm/hooks/use-sheet-properties.d.ts.map +1 -0
  1311. package/dist/esm/hooks/use-sheet-properties.js +895 -0
  1312. package/dist/esm/hooks/use-sheet-state.d.ts +17 -0
  1313. package/dist/esm/hooks/use-sheet-state.d.ts.map +1 -0
  1314. package/dist/esm/hooks/use-sheet-state.js +102 -0
  1315. package/dist/esm/hooks/use-sheetdata-subscriber.d.ts +10 -0
  1316. package/dist/esm/hooks/use-sheetdata-subscriber.d.ts.map +1 -0
  1317. package/dist/esm/hooks/use-sheetdata-subscriber.js +14 -0
  1318. package/dist/esm/hooks/use-slicers.d.ts +19 -0
  1319. package/dist/esm/hooks/use-slicers.d.ts.map +1 -0
  1320. package/dist/esm/hooks/use-slicers.js +83 -0
  1321. package/dist/esm/hooks/use-split-text-to-columns.d.ts +19 -0
  1322. package/dist/esm/hooks/use-split-text-to-columns.d.ts.map +1 -0
  1323. package/dist/esm/hooks/use-split-text-to-columns.js +30 -0
  1324. package/dist/esm/hooks/use-spreadsheet-state.d.ts +627 -0
  1325. package/dist/esm/hooks/use-spreadsheet-state.d.ts.map +1 -0
  1326. package/dist/esm/hooks/use-spreadsheet-state.js +2010 -0
  1327. package/dist/esm/hooks/use-ss-registry.d.ts +6 -0
  1328. package/dist/esm/hooks/use-ss-registry.d.ts.map +1 -0
  1329. package/dist/esm/hooks/use-ss-registry.js +17 -0
  1330. package/dist/esm/hooks/use-structured-reference.d.ts +8 -0
  1331. package/dist/esm/hooks/use-structured-reference.d.ts.map +1 -0
  1332. package/dist/esm/hooks/use-structured-reference.js +129 -0
  1333. package/dist/esm/hooks/use-undo-redo-actions.d.ts +40 -0
  1334. package/dist/esm/hooks/use-undo-redo-actions.d.ts.map +1 -0
  1335. package/dist/esm/hooks/use-undo-redo-actions.js +166 -0
  1336. package/dist/esm/hooks/use-undo-redo.d.ts +69 -0
  1337. package/dist/esm/hooks/use-undo-redo.d.ts.map +1 -0
  1338. package/dist/esm/hooks/use-undo-redo.js +113 -0
  1339. package/dist/esm/hooks/utils/frozen-sort.d.ts +9 -0
  1340. package/dist/esm/hooks/utils/frozen-sort.d.ts.map +1 -0
  1341. package/dist/esm/hooks/utils/frozen-sort.js +25 -0
  1342. package/dist/esm/hooks/utils/sort-rows.d.ts +32 -0
  1343. package/dist/esm/hooks/utils/sort-rows.d.ts.map +1 -0
  1344. package/dist/esm/hooks/utils/sort-rows.js +102 -0
  1345. package/dist/esm/index.d.ts +38 -0
  1346. package/dist/esm/index.d.ts.map +1 -0
  1347. package/dist/esm/index.js +39 -0
  1348. package/dist/esm/interface/apply-fill.d.ts +6 -0
  1349. package/dist/esm/interface/apply-fill.d.ts.map +1 -0
  1350. package/dist/esm/interface/apply-fill.js +195 -0
  1351. package/dist/esm/interface/auto-resize.d.ts +4 -0
  1352. package/dist/esm/interface/auto-resize.d.ts.map +1 -0
  1353. package/dist/esm/interface/auto-resize.js +50 -0
  1354. package/dist/esm/interface/calculation-interface.d.ts +67 -0
  1355. package/dist/esm/interface/calculation-interface.d.ts.map +1 -0
  1356. package/dist/esm/interface/calculation-interface.js +339 -0
  1357. package/dist/esm/interface/change-batch-stream.d.ts +25 -0
  1358. package/dist/esm/interface/change-batch-stream.d.ts.map +1 -0
  1359. package/dist/esm/interface/change-batch-stream.js +294 -0
  1360. package/dist/esm/interface/change-batch.d.ts +39 -0
  1361. package/dist/esm/interface/change-batch.d.ts.map +1 -0
  1362. package/dist/esm/interface/change-batch.js +282 -0
  1363. package/dist/esm/interface/change-border.d.ts +5 -0
  1364. package/dist/esm/interface/change-border.d.ts.map +1 -0
  1365. package/dist/esm/interface/change-border.js +116 -0
  1366. package/dist/esm/interface/change-calculated-column.d.ts +5 -0
  1367. package/dist/esm/interface/change-calculated-column.d.ts.map +1 -0
  1368. package/dist/esm/interface/change-calculated-column.js +120 -0
  1369. package/dist/esm/interface/change-decimals.d.ts +7 -0
  1370. package/dist/esm/interface/change-decimals.d.ts.map +1 -0
  1371. package/dist/esm/interface/change-decimals.js +58 -0
  1372. package/dist/esm/interface/change-formatting.d.ts +4 -0
  1373. package/dist/esm/interface/change-formatting.d.ts.map +1 -0
  1374. package/dist/esm/interface/change-formatting.js +209 -0
  1375. package/dist/esm/interface/change-sheet-tabcolor.d.ts +4 -0
  1376. package/dist/esm/interface/change-sheet-tabcolor.d.ts.map +1 -0
  1377. package/dist/esm/interface/change-sheet-tabcolor.js +19 -0
  1378. package/dist/esm/interface/change-table-column.d.ts +49 -0
  1379. package/dist/esm/interface/change-table-column.d.ts.map +1 -0
  1380. package/dist/esm/interface/change-table-column.js +247 -0
  1381. package/dist/esm/interface/change-theme.d.ts +4 -0
  1382. package/dist/esm/interface/change-theme.d.ts.map +1 -0
  1383. package/dist/esm/interface/change-theme.js +21 -0
  1384. package/dist/esm/interface/chart-extensions.d.ts +32 -0
  1385. package/dist/esm/interface/chart-extensions.d.ts.map +1 -0
  1386. package/dist/esm/interface/chart-extensions.js +71 -0
  1387. package/dist/esm/interface/citations.d.ts +33 -0
  1388. package/dist/esm/interface/citations.d.ts.map +1 -0
  1389. package/dist/esm/interface/citations.js +123 -0
  1390. package/dist/esm/interface/clear-formatting.d.ts +5 -0
  1391. package/dist/esm/interface/clear-formatting.d.ts.map +1 -0
  1392. package/dist/esm/interface/clear-formatting.js +48 -0
  1393. package/dist/esm/interface/conditional-formatting-rules.d.ts +7 -0
  1394. package/dist/esm/interface/conditional-formatting-rules.d.ts.map +1 -0
  1395. package/dist/esm/interface/conditional-formatting-rules.js +123 -0
  1396. package/dist/esm/interface/create-table.d.ts +5 -0
  1397. package/dist/esm/interface/create-table.d.ts.map +1 -0
  1398. package/dist/esm/interface/create-table.js +105 -0
  1399. package/dist/esm/interface/data-validation-rules.d.ts +25 -0
  1400. package/dist/esm/interface/data-validation-rules.d.ts.map +1 -0
  1401. package/dist/esm/interface/data-validation-rules.js +310 -0
  1402. package/dist/esm/interface/data-validation-utils.d.ts +12 -0
  1403. package/dist/esm/interface/data-validation-utils.d.ts.map +1 -0
  1404. package/dist/esm/interface/data-validation-utils.js +79 -0
  1405. package/dist/esm/interface/delete-cells-shift-left.d.ts +5 -0
  1406. package/dist/esm/interface/delete-cells-shift-left.d.ts.map +1 -0
  1407. package/dist/esm/interface/delete-cells-shift-left.js +146 -0
  1408. package/dist/esm/interface/delete-cells-shift-up.d.ts +5 -0
  1409. package/dist/esm/interface/delete-cells-shift-up.d.ts.map +1 -0
  1410. package/dist/esm/interface/delete-cells-shift-up.js +138 -0
  1411. package/dist/esm/interface/delete-cells.d.ts +6 -0
  1412. package/dist/esm/interface/delete-cells.d.ts.map +1 -0
  1413. package/dist/esm/interface/delete-cells.js +184 -0
  1414. package/dist/esm/interface/delete-column.d.ts +4 -0
  1415. package/dist/esm/interface/delete-column.d.ts.map +1 -0
  1416. package/dist/esm/interface/delete-column.js +254 -0
  1417. package/dist/esm/interface/delete-row.d.ts +4 -0
  1418. package/dist/esm/interface/delete-row.d.ts.map +1 -0
  1419. package/dist/esm/interface/delete-row.js +226 -0
  1420. package/dist/esm/interface/delete-sheet.d.ts +4 -0
  1421. package/dist/esm/interface/delete-sheet.d.ts.map +1 -0
  1422. package/dist/esm/interface/delete-sheet.js +78 -0
  1423. package/dist/esm/interface/delete-table-column.d.ts +4 -0
  1424. package/dist/esm/interface/delete-table-column.d.ts.map +1 -0
  1425. package/dist/esm/interface/delete-table-column.js +274 -0
  1426. package/dist/esm/interface/delete-table-row.d.ts +4 -0
  1427. package/dist/esm/interface/delete-table-row.d.ts.map +1 -0
  1428. package/dist/esm/interface/delete-table-row.js +278 -0
  1429. package/dist/esm/interface/duplicate-sheet.d.ts +4 -0
  1430. package/dist/esm/interface/duplicate-sheet.d.ts.map +1 -0
  1431. package/dist/esm/interface/duplicate-sheet.js +206 -0
  1432. package/dist/esm/interface/embeds.d.ts +9 -0
  1433. package/dist/esm/interface/embeds.d.ts.map +1 -0
  1434. package/dist/esm/interface/embeds.js +115 -0
  1435. package/dist/esm/interface/freeze.d.ts +5 -0
  1436. package/dist/esm/interface/freeze.d.ts.map +1 -0
  1437. package/dist/esm/interface/freeze.js +109 -0
  1438. package/dist/esm/interface/helpers.d.ts +6 -0
  1439. package/dist/esm/interface/helpers.d.ts.map +1 -0
  1440. package/dist/esm/interface/helpers.js +32 -0
  1441. package/dist/esm/interface/hide-column.d.ts +4 -0
  1442. package/dist/esm/interface/hide-column.d.ts.map +1 -0
  1443. package/dist/esm/interface/hide-column.js +59 -0
  1444. package/dist/esm/interface/hide-row.d.ts +4 -0
  1445. package/dist/esm/interface/hide-row.d.ts.map +1 -0
  1446. package/dist/esm/interface/hide-row.js +54 -0
  1447. package/dist/esm/interface/indent.d.ts +7 -0
  1448. package/dist/esm/interface/indent.d.ts.map +1 -0
  1449. package/dist/esm/interface/indent.js +73 -0
  1450. package/dist/esm/interface/insert-cells-shift-down.d.ts +5 -0
  1451. package/dist/esm/interface/insert-cells-shift-down.d.ts.map +1 -0
  1452. package/dist/esm/interface/insert-cells-shift-down.js +143 -0
  1453. package/dist/esm/interface/insert-cells-shift-right.d.ts +5 -0
  1454. package/dist/esm/interface/insert-cells-shift-right.d.ts.map +1 -0
  1455. package/dist/esm/interface/insert-cells-shift-right.js +134 -0
  1456. package/dist/esm/interface/insert-column.d.ts +7 -0
  1457. package/dist/esm/interface/insert-column.d.ts.map +1 -0
  1458. package/dist/esm/interface/insert-column.js +481 -0
  1459. package/dist/esm/interface/insert-note.d.ts +5 -0
  1460. package/dist/esm/interface/insert-note.d.ts.map +1 -0
  1461. package/dist/esm/interface/insert-note.js +23 -0
  1462. package/dist/esm/interface/insert-row.d.ts +4 -0
  1463. package/dist/esm/interface/insert-row.d.ts.map +1 -0
  1464. package/dist/esm/interface/insert-row.js +158 -0
  1465. package/dist/esm/interface/insert-table-row.d.ts +4 -0
  1466. package/dist/esm/interface/insert-table-row.d.ts.map +1 -0
  1467. package/dist/esm/interface/insert-table-row.js +314 -0
  1468. package/dist/esm/interface/interface-cli.d.ts +3 -0
  1469. package/dist/esm/interface/interface-cli.d.ts.map +1 -0
  1470. package/dist/esm/interface/interface-cli.js +62 -0
  1471. package/dist/esm/interface/named-range-operations.d.ts +19 -0
  1472. package/dist/esm/interface/named-range-operations.d.ts.map +1 -0
  1473. package/dist/esm/interface/named-range-operations.js +71 -0
  1474. package/dist/esm/interface/new-sheet.d.ts +4 -0
  1475. package/dist/esm/interface/new-sheet.d.ts.map +1 -0
  1476. package/dist/esm/interface/new-sheet.js +102 -0
  1477. package/dist/esm/interface/pivot-extensions.d.ts +27 -0
  1478. package/dist/esm/interface/pivot-extensions.d.ts.map +1 -0
  1479. package/dist/esm/interface/pivot-extensions.js +60 -0
  1480. package/dist/esm/interface/remove-duplicates.d.ts +11 -0
  1481. package/dist/esm/interface/remove-duplicates.d.ts.map +1 -0
  1482. package/dist/esm/interface/remove-duplicates.js +107 -0
  1483. package/dist/esm/interface/remove-table.d.ts +4 -0
  1484. package/dist/esm/interface/remove-table.d.ts.map +1 -0
  1485. package/dist/esm/interface/remove-table.js +50 -0
  1486. package/dist/esm/interface/resize-utils.d.ts +18 -0
  1487. package/dist/esm/interface/resize-utils.d.ts.map +1 -0
  1488. package/dist/esm/interface/resize-utils.js +34 -0
  1489. package/dist/esm/interface/resize.d.ts +5 -0
  1490. package/dist/esm/interface/resize.d.ts.map +1 -0
  1491. package/dist/esm/interface/resize.js +43 -0
  1492. package/dist/esm/interface/slicers.d.ts +9 -0
  1493. package/dist/esm/interface/slicers.d.ts.map +1 -0
  1494. package/dist/esm/interface/slicers.js +107 -0
  1495. package/dist/esm/interface/split-text.d.ts +5 -0
  1496. package/dist/esm/interface/split-text.d.ts.map +1 -0
  1497. package/dist/esm/interface/split-text.js +94 -0
  1498. package/dist/esm/interface/spreadsheet-interface.d.ts +642 -0
  1499. package/dist/esm/interface/spreadsheet-interface.d.ts.map +1 -0
  1500. package/dist/esm/interface/spreadsheet-interface.js +2442 -0
  1501. package/dist/esm/interface/table-totalrow.d.ts +20 -0
  1502. package/dist/esm/interface/table-totalrow.d.ts.map +1 -0
  1503. package/dist/esm/interface/table-totalrow.js +155 -0
  1504. package/dist/esm/interface/table-utils.d.ts +21 -0
  1505. package/dist/esm/interface/table-utils.d.ts.map +1 -0
  1506. package/dist/esm/interface/table-utils.js +38 -0
  1507. package/dist/esm/interface/update-sheet.d.ts +16 -0
  1508. package/dist/esm/interface/update-sheet.d.ts.map +1 -0
  1509. package/dist/esm/interface/update-sheet.js +64 -0
  1510. package/dist/esm/interface/update-table.d.ts +4 -0
  1511. package/dist/esm/interface/update-table.d.ts.map +1 -0
  1512. package/dist/esm/interface/update-table.js +111 -0
  1513. package/dist/esm/server-utils.d.ts +8 -0
  1514. package/dist/esm/server-utils.d.ts.map +1 -0
  1515. package/dist/esm/server-utils.js +3 -0
  1516. package/dist/esm/server.browser.d.ts +9 -0
  1517. package/dist/esm/server.browser.d.ts.map +1 -0
  1518. package/dist/esm/server.browser.js +5 -0
  1519. package/dist/esm/server.d.ts +9 -0
  1520. package/dist/esm/server.d.ts.map +1 -0
  1521. package/dist/esm/server.js +5 -0
  1522. package/dist/esm/shared-string-registry.d.ts +35 -0
  1523. package/dist/esm/shared-string-registry.d.ts.map +1 -0
  1524. package/dist/esm/shared-string-registry.js +248 -0
  1525. package/dist/esm/sheet-cell.d.ts +310 -0
  1526. package/dist/esm/sheet-cell.d.ts.map +1 -0
  1527. package/dist/esm/sheet-cell.js +1829 -0
  1528. package/dist/esm/test-setup.d.ts +2 -0
  1529. package/dist/esm/test-setup.d.ts.map +1 -0
  1530. package/dist/esm/test-setup.js +3 -0
  1531. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -0
  1532. package/dist/esm/types.d.ts +44 -0
  1533. package/dist/esm/types.d.ts.map +1 -0
  1534. package/dist/esm/types.js +33 -0
  1535. package/dist/esm/validation-schema/table.schema.d.ts +6 -0
  1536. package/dist/esm/validation-schema/table.schema.d.ts.map +1 -0
  1537. package/dist/esm/validation-schema/table.schema.js +4 -0
  1538. package/dist/esm/vitest.config.d.ts +3 -0
  1539. package/dist/esm/vitest.config.d.ts.map +1 -0
  1540. package/dist/esm/vitest.config.js +22 -0
  1541. package/package.json +89 -0
@@ -0,0 +1,2069 @@
1
+ import { Calculator, cellCoordsToCellCoordinate, DataSource, } from "@rowsncolumns/calculator";
2
+ import { isCellCoordinateWithinCellRange, StaticNode } from "@rowsncolumns/dag";
3
+ import { CellRangeNode, isCellCoordinate, isCellNode, isCellRangeNode, isStaticNode, isStaticReference, makeKey, } from "@rowsncolumns/dag";
4
+ import { CellNode } from "@rowsncolumns/dag";
5
+ import { FormulaError } from "@rowsncolumns/fast-formula-parser";
6
+ import { isAreasEqual } from "@rowsncolumns/grid";
7
+ import { ERROR_COLOR, useCallbackRef } from "@rowsncolumns/spreadsheet";
8
+ import { useIsomorphicLayoutEffect } from "@rowsncolumns/ui";
9
+ import { alpha2number, debug, error, isAFormula, isBareFormulaExpression, isNil, scheduleAfterPaint, } from "@rowsncolumns/utils";
10
+ import { useCallback, useEffect, useMemo, useRef } from "react";
11
+ import { getFunctionNamesFromFormula } from "../api/immer-utils";
12
+ import { isEqualPosition } from "../api/range";
13
+ import { AWAITING_CALCULATION, isCellRange } from "../helpers";
14
+ import { computeDelta } from "../helpers/iterative-calculation";
15
+ import { useCalculationProcessArray } from "./use-calculation-process-array";
16
+ import { useDeferredCalculationFlush } from "./use-deferred-calculation-flush";
17
+ import { useIdleScheduler } from "./use-idle-scheduler";
18
+ const rangesOverlap = (left, right) => {
19
+ if (left.sheet !== right.sheet) {
20
+ return false;
21
+ }
22
+ return (left.from.row <= right.to.row &&
23
+ left.to.row >= right.from.row &&
24
+ left.from.col <= right.to.col &&
25
+ left.to.col >= right.from.col);
26
+ };
27
+ const isErrorResult = (value) => {
28
+ if (value instanceof FormulaError) {
29
+ return true;
30
+ }
31
+ return (!!value &&
32
+ typeof value === "object" &&
33
+ (value.type === "Error" ||
34
+ value.type === "Invalid"));
35
+ };
36
+ const isDerivedCellPosition = (position) => position.conditionalFormatId !== undefined ||
37
+ position.dataValidationId !== undefined;
38
+ const findCircularKeys = (nodes) => {
39
+ if (!nodes.length) {
40
+ return new Set();
41
+ }
42
+ const nodeMap = new Map();
43
+ const nodesBySheet = new Map();
44
+ for (const node of nodes) {
45
+ nodeMap.set(node.key, node);
46
+ const bucket = nodesBySheet.get(node.position.sheetId);
47
+ if (bucket) {
48
+ bucket.push(node);
49
+ }
50
+ else {
51
+ nodesBySheet.set(node.position.sheetId, [node]);
52
+ }
53
+ }
54
+ const adjacency = new Map();
55
+ for (const node of nodes) {
56
+ const edges = new Set();
57
+ for (const input of node.inputKeys) {
58
+ if (isCellNode(input)) {
59
+ const cellInput = input;
60
+ if (nodeMap.has(cellInput.key)) {
61
+ edges.add(cellInput.key);
62
+ }
63
+ continue;
64
+ }
65
+ if (isCellRangeNode(input)) {
66
+ const rangeInput = input;
67
+ const candidates = nodesBySheet.get(rangeInput.position.sheetId);
68
+ if (!candidates) {
69
+ continue;
70
+ }
71
+ for (const candidate of candidates) {
72
+ if (isCellNode(candidate) &&
73
+ !isDerivedCellPosition(candidate.position) &&
74
+ isCellCoordinateWithinCellRange(candidate.position, rangeInput)) {
75
+ edges.add(candidate.key);
76
+ }
77
+ }
78
+ }
79
+ }
80
+ adjacency.set(node.key, edges);
81
+ }
82
+ const indexMap = new Map();
83
+ const lowLink = new Map();
84
+ const stack = [];
85
+ const onStack = new Set();
86
+ let index = 0;
87
+ const components = [];
88
+ const strongConnect = (key) => {
89
+ indexMap.set(key, index);
90
+ lowLink.set(key, index);
91
+ index++;
92
+ stack.push(key);
93
+ onStack.add(key);
94
+ for (const neighbor of adjacency.get(key) ?? []) {
95
+ if (!indexMap.has(neighbor)) {
96
+ strongConnect(neighbor);
97
+ lowLink.set(key, Math.min(lowLink.get(key), lowLink.get(neighbor)));
98
+ }
99
+ else if (onStack.has(neighbor)) {
100
+ lowLink.set(key, Math.min(lowLink.get(key), indexMap.get(neighbor)));
101
+ }
102
+ }
103
+ if (lowLink.get(key) === indexMap.get(key)) {
104
+ const component = [];
105
+ let candidate;
106
+ do {
107
+ candidate = stack.pop();
108
+ onStack.delete(candidate);
109
+ component.push(candidate);
110
+ } while (candidate !== key);
111
+ components.push(component);
112
+ }
113
+ };
114
+ for (const key of nodeMap.keys()) {
115
+ if (!indexMap.has(key)) {
116
+ strongConnect(key);
117
+ }
118
+ }
119
+ const circular = new Set();
120
+ for (const component of components) {
121
+ if (!component.length)
122
+ continue;
123
+ if (component.length === 1 &&
124
+ !adjacency.get(component[0])?.has(component[0])) {
125
+ continue;
126
+ }
127
+ component.forEach((key) => circular.add(key));
128
+ }
129
+ return circular;
130
+ };
131
+ // List of ephemeral functions
132
+ // Ephemeral functions are always recalculated when
133
+ // a cell changes
134
+ export const EPHEMERAL_FUNCTIONS = new Set([
135
+ "NOW",
136
+ "TODAY",
137
+ "RAND",
138
+ "RANDARRAY",
139
+ "RANDBETWEEN",
140
+ "SHEET",
141
+ "SHEETS",
142
+ "OFFSET",
143
+ "INDIRECT",
144
+ ]);
145
+ const DEFAULT_BATCH_WEIGHT = 600;
146
+ const ARRAY_FORMULA_WEIGHT = 300;
147
+ const LARGE_RANGE_MIN_CELLS = 100;
148
+ const MAX_CHUNK_DURATION_MS = 16;
149
+ const getTimestamp = () => typeof performance !== "undefined" && typeof performance.now === "function"
150
+ ? performance.now()
151
+ : Date.now();
152
+ const yieldToBrowser = () => new Promise((resolve) => {
153
+ scheduleAfterPaint(resolve);
154
+ });
155
+ const parseCellReference = (reference) => {
156
+ const match = /^\$?([A-Z]{1,3})\$?(\d+)$/i.exec(reference.trim());
157
+ if (!match) {
158
+ return null;
159
+ }
160
+ const column = alpha2number(match[1].toUpperCase());
161
+ if (column == null) {
162
+ return null;
163
+ }
164
+ const row = Number.parseInt(match[2], 10);
165
+ if (Number.isNaN(row)) {
166
+ return null;
167
+ }
168
+ return { column, row };
169
+ };
170
+ const toValidRange = (range) => {
171
+ const startRowIndex = Math.max(1, range.startRowIndex);
172
+ const endRowIndex = Math.max(startRowIndex, range.endRowIndex);
173
+ const startColumnIndex = Math.max(1, range.startColumnIndex);
174
+ const endColumnIndex = Math.max(startColumnIndex, range.endColumnIndex);
175
+ if (endRowIndex < startRowIndex || endColumnIndex < startColumnIndex) {
176
+ return null;
177
+ }
178
+ return {
179
+ sheetId: range.sheetId,
180
+ startRowIndex,
181
+ endRowIndex,
182
+ startColumnIndex,
183
+ endColumnIndex,
184
+ };
185
+ };
186
+ const getInvalidationRangeFromStructureChange = (change) => {
187
+ switch (change.kind) {
188
+ case "delete-row":
189
+ case "insert-row":
190
+ return toValidRange({
191
+ sheetId: change.sheetId,
192
+ startRowIndex: change.index,
193
+ endRowIndex: change.rowCount,
194
+ startColumnIndex: 1,
195
+ endColumnIndex: change.columnCount,
196
+ });
197
+ case "delete-column":
198
+ case "insert-column":
199
+ return toValidRange({
200
+ sheetId: change.sheetId,
201
+ startRowIndex: 1,
202
+ endRowIndex: change.rowCount,
203
+ startColumnIndex: change.index,
204
+ endColumnIndex: change.columnCount,
205
+ });
206
+ case "delete-cells-shift-up":
207
+ case "insert-cells-shift-down":
208
+ return toValidRange({
209
+ sheetId: change.sheetId,
210
+ startRowIndex: change.startRowIndex,
211
+ endRowIndex: change.rowCount,
212
+ startColumnIndex: change.startColumnIndex,
213
+ endColumnIndex: change.endColumnIndex,
214
+ });
215
+ case "delete-cells-shift-left":
216
+ case "insert-cells-shift-right":
217
+ return toValidRange({
218
+ sheetId: change.sheetId,
219
+ startRowIndex: change.startRowIndex,
220
+ endRowIndex: change.endRowIndex,
221
+ startColumnIndex: change.startColumnIndex,
222
+ endColumnIndex: change.columnCount,
223
+ });
224
+ case "delete-table-row":
225
+ case "insert-table-row":
226
+ return toValidRange({
227
+ sheetId: change.sheetId,
228
+ startRowIndex: change.index,
229
+ endRowIndex: change.rowCount,
230
+ startColumnIndex: change.startColumnIndex,
231
+ endColumnIndex: change.endColumnIndex,
232
+ });
233
+ case "delete-table-column":
234
+ case "insert-table-column":
235
+ return toValidRange({
236
+ sheetId: change.sheetId,
237
+ startRowIndex: change.startRowIndex,
238
+ endRowIndex: change.endRowIndex,
239
+ startColumnIndex: change.index,
240
+ endColumnIndex: change.columnCount,
241
+ });
242
+ case "invalidate-range":
243
+ return toValidRange({
244
+ sheetId: change.sheetId,
245
+ startRowIndex: change.startRowIndex,
246
+ endRowIndex: change.endRowIndex,
247
+ startColumnIndex: change.startColumnIndex,
248
+ endColumnIndex: change.endColumnIndex,
249
+ });
250
+ default:
251
+ return null;
252
+ }
253
+ };
254
+ const hasFullColumnReference = (formula) => {
255
+ const pattern = /(^|[^A-Z0-9_])(\$?[A-Z]{1,3})(?!\d)\s*:\s*(\$?[A-Z]{1,3})(?!\d)/gi;
256
+ return pattern.test(formula);
257
+ };
258
+ const hasFullRowReference = (formula) => {
259
+ const pattern = /(^|[^A-Z0-9_])(\$?\d+)\s*:\s*(\$?\d+)(?!\d)/gi;
260
+ return pattern.test(formula);
261
+ };
262
+ const hasLargeExplicitRange = (formula) => {
263
+ const pattern = /(\$?[A-Z]{1,3}\$?\d+)\s*:\s*(\$?[A-Z]{1,3}\$?\d+)/gi;
264
+ let match;
265
+ while ((match = pattern.exec(formula))) {
266
+ const start = parseCellReference(match[1]);
267
+ const end = parseCellReference(match[2]);
268
+ if (!start || !end) {
269
+ continue;
270
+ }
271
+ const rowCount = Math.abs(end.row - start.row) + 1;
272
+ const columnCount = Math.abs(end.column - start.column) + 1;
273
+ if (rowCount * columnCount >= LARGE_RANGE_MIN_CELLS) {
274
+ return true;
275
+ }
276
+ }
277
+ return false;
278
+ };
279
+ const isHeavyArrayFormula = (formula) => {
280
+ if (!formula)
281
+ return false;
282
+ return (hasFullColumnReference(formula) ||
283
+ hasFullRowReference(formula) ||
284
+ hasLargeExplicitRange(formula));
285
+ };
286
+ const cellPromises = new Map();
287
+ export const useCalculation = ({ locale, functions, iterativeCalculation, onDemandFormulaPattern, activeSheetId, onSuccess, onChangeDependencyGraph, getSheetId, getSheetName, getSheetIndex, getSheetCount, getActiveSheetId, getEffectiveValue, getUserEnteredValue, getConditionalFormatFormula, getDataValidationFormula, getSheetProperties, getCellData, onStructuredReference, onNamedRange, namedRanges, onChangeStaticReference, onBeginCalculation, getEffectiveStructuredValue, isRowHidden, isRowHiddenByFilter, enableLazyCalculation = true, enabled = true, }) => {
288
+ // Convert string pattern to RegExp if provided
289
+ const onDemandPattern = useMemo(() => {
290
+ if (!onDemandFormulaPattern)
291
+ return undefined;
292
+ return new RegExp(onDemandFormulaPattern, "gi");
293
+ }, [onDemandFormulaPattern]);
294
+ const calculator = useRef(undefined);
295
+ const computationCache = useRef(undefined);
296
+ const iterativeCalculationRef = useRef(iterativeCalculation);
297
+ iterativeCalculationRef.current = iterativeCalculation;
298
+ const operationQueue = useRef([]);
299
+ const graphOperationQueue = useRef([]);
300
+ // Results queue
301
+ const resultsQueueRef = useRef(new Map());
302
+ const resultsFlushPendingRef = useRef(false);
303
+ const isFullRecalcRef = useRef(false);
304
+ const staticNodeArrayRef = useRef([]);
305
+ const initialCalculationArrayRef = useRef([]);
306
+ const getSheetNameStable = useCallbackRef(getSheetName);
307
+ const getSheetIdStable = useCallbackRef(getSheetId);
308
+ const getSheetIndexStable = useCallbackRef(getSheetIndex);
309
+ const getSheetCountStable = useCallbackRef(getSheetCount);
310
+ const getCellDataStable = useCallbackRef(getCellData);
311
+ const onStructuredReferenceStable = useCallbackRef(onStructuredReference);
312
+ const getUserEnteredValueStable = useCallbackRef(getUserEnteredValue);
313
+ const isRowHiddenStable = useCallbackRef(isRowHidden);
314
+ const isRowHiddenByFilterStable = useCallbackRef(isRowHiddenByFilter);
315
+ const initialArrayResults = useRef(new Map());
316
+ const ephemeralCellsRef = useRef(new Map());
317
+ const forceRecalcKeys = useRef(new Set());
318
+ // Keys actually consumed (evaluated with fresh state) during the current
319
+ // calculation cycle. Only these are cleared in `onAfterCalculation`; keys
320
+ // added concurrently (e.g. by a paste RAF while a calc was mid-flight, with
321
+ // stale closures) survive into the next cycle so they aren't dropped.
322
+ const consumedForceRecalcKeys = useRef(new Set());
323
+ // Position for each force key, so unconsumed keys can be re-dirtied + rescheduled.
324
+ const forceRecalcPositions = useRef(new Map());
325
+ // Guards the reschedule loop against an unconsumable key spinning forever.
326
+ const rescheduleCount = useRef(0);
327
+ const rafTimerMapRef = useRef(new Map());
328
+ const deferredOperationsBySheetRef = useRef(new Map());
329
+ const pendingStartResultsRef = useRef(new Map());
330
+ const pendingRecalculatedPositionRef = useRef(undefined);
331
+ const startCalculationRef = useRef(null);
332
+ const { schedule: scheduleStartCalculationIdle } = useIdleScheduler();
333
+ // Add to ephemeral function if required
334
+ const addToEphemeralFunction = useCallback((formulaValue, position) => {
335
+ const fns = getFunctionNamesFromFormula(formulaValue);
336
+ if (fns.some((fn) => EPHEMERAL_FUNCTIONS.has(fn.toUpperCase()))) {
337
+ ephemeralCellsRef.current.set(makeKey(position), position);
338
+ }
339
+ }, []);
340
+ // Remove from ephemeral function if required
341
+ const removeFromEphemeralFunction = useCallback((position) => {
342
+ ephemeralCellsRef.current.delete(makeKey(position));
343
+ }, []);
344
+ // Get all ephemeral functions
345
+ const getEphemeralCells = useCallback(() => {
346
+ const ephemeralCellsToRecalc = [
347
+ ...ephemeralCellsRef.current.values(),
348
+ ].map((position) => {
349
+ return {
350
+ type: "add",
351
+ position,
352
+ };
353
+ });
354
+ debug("Recalculation ephemeral cells", ephemeralCellsToRecalc);
355
+ return ephemeralCellsToRecalc;
356
+ }, []);
357
+ // Get computation cache
358
+ // Used for the current calculation frame
359
+ const getComputationCache = useCallback(() => {
360
+ if (computationCache.current === undefined) {
361
+ computationCache.current = new Map();
362
+ }
363
+ return computationCache.current;
364
+ }, []);
365
+ // Clear cache
366
+ const onAfterCalculation = useCallback(() => {
367
+ // Remove cached values
368
+ getComputationCache().clear();
369
+ // Cleanup the graph, so we dont have
370
+ // any stale nodes
371
+ getCalculator().cleanupGraph();
372
+ // Only clear keys that were actually consumed during this calculation cycle.
373
+ // Keys added concurrently (e.g. by a paste RAF while this calculation was
374
+ // running) must survive so the next cycle can evaluate them.
375
+ consumedForceRecalcKeys.current.forEach((key) => {
376
+ forceRecalcKeys.current.delete(key);
377
+ forceRecalcPositions.current.delete(key);
378
+ });
379
+ consumedForceRecalcKeys.current.clear();
380
+ }, []);
381
+ const getFunctions = useCallback(() => {
382
+ return functions;
383
+ }, [functions]);
384
+ const overridesRef = useRef(null);
385
+ // Get user entered value
386
+ const getFinalUserEnteredValue = (position) => {
387
+ const { conditionalFormatId, dataValidationId } = position;
388
+ if (!isNil(conditionalFormatId)) {
389
+ return getConditionalFormatFormula(position.sheetId, position.rowIndex, position.columnIndex, conditionalFormatId);
390
+ }
391
+ if (!isNil(dataValidationId)) {
392
+ return getDataValidationFormula(position.sheetId, position.rowIndex, position.columnIndex, dataValidationId);
393
+ }
394
+ // Read through the stable ref so a calc-captured closure (e.g. a paste RAF
395
+ // that ran with a pre-paste render's `getUserEnteredValue`) still resolves
396
+ // the latest user-entered value rather than a stale snapshot.
397
+ return getUserEnteredValueStable(position.sheetId, position.rowIndex, position.columnIndex);
398
+ };
399
+ const deferCalculationNodes = (positions) => {
400
+ if (!positions.length) {
401
+ return;
402
+ }
403
+ for (const position of positions) {
404
+ const key = makeKey(position);
405
+ const sheetId = position.sheetId;
406
+ const existing = deferredOperationsBySheetRef.current.get(sheetId) ??
407
+ new Map();
408
+ existing.set(key, {
409
+ type: "dirty",
410
+ position,
411
+ force: forceRecalcKeys.current.has(key),
412
+ });
413
+ deferredOperationsBySheetRef.current.set(sheetId, existing);
414
+ getCalculator().unMarkAsDirty(position);
415
+ }
416
+ };
417
+ const filterDirtyCellsForActiveSheet = (cells, rootSheetId) => {
418
+ if (!cells.length) {
419
+ return { included: cells, deferred: [] };
420
+ }
421
+ const cellNodeByKey = new Map();
422
+ const dirtyNodesBySheet = new Map();
423
+ for (const node of cells) {
424
+ cellNodeByKey.set(node.key, node);
425
+ const list = dirtyNodesBySheet.get(node.position.sheetId);
426
+ if (list) {
427
+ list.push(node);
428
+ }
429
+ else {
430
+ dirtyNodesBySheet.set(node.position.sheetId, [node]);
431
+ }
432
+ }
433
+ // Find cells that are inputs to static references (charts, etc.)
434
+ // These cells should not be deferred even if they're on other sheets
435
+ const staticInputKeys = new Set();
436
+ const staticInputs = getCalculator().getStaticReferenceInputs();
437
+ for (const inputNode of staticInputs) {
438
+ if (isCellNode(inputNode)) {
439
+ staticInputKeys.add(inputNode.key);
440
+ }
441
+ else if (isCellRangeNode(inputNode)) {
442
+ // For range inputs, check which dirty cells fall within the range
443
+ const rangeInput = inputNode;
444
+ for (const cell of cells) {
445
+ if (!isDerivedCellPosition(cell.position) &&
446
+ isCellCoordinateWithinCellRange(cell.position, rangeInput)) {
447
+ staticInputKeys.add(cell.key);
448
+ }
449
+ }
450
+ }
451
+ }
452
+ const includedKeys = new Set();
453
+ const forcedKeys = forceRecalcKeys.current;
454
+ const stack = [];
455
+ for (const node of cells) {
456
+ if (forcedKeys.has(node.key) ||
457
+ node.position.sheetId === rootSheetId ||
458
+ staticInputKeys.has(node.key)) {
459
+ includedKeys.add(node.key);
460
+ stack.push(node);
461
+ }
462
+ }
463
+ while (stack.length) {
464
+ const current = stack.pop();
465
+ if (!current) {
466
+ continue;
467
+ }
468
+ const userEnteredValue = getFinalUserEnteredValue(current.position);
469
+ if (!isAFormula(userEnteredValue) || !userEnteredValue) {
470
+ continue;
471
+ }
472
+ const formulaValue = String(userEnteredValue).slice(1);
473
+ const dependencies = getCalculator().dependencies(formulaValue, current.position);
474
+ for (const dependency of dependencies) {
475
+ // Named-range refs (StaticReference) come back as deps too
476
+ // now that the DAG is unified, but this code path is
477
+ // chasing grid-level cell/range dependencies for the
478
+ // active-sheet filter. Skip them.
479
+ if (isStaticReference(dependency))
480
+ continue;
481
+ if (isCellCoordinate(dependency)) {
482
+ const depKey = makeKey(dependency);
483
+ const depNode = cellNodeByKey.get(depKey);
484
+ if (depNode && !includedKeys.has(depKey)) {
485
+ includedKeys.add(depKey);
486
+ stack.push(depNode);
487
+ }
488
+ continue;
489
+ }
490
+ const candidates = dirtyNodesBySheet.get(dependency.sheetId);
491
+ if (!candidates) {
492
+ continue;
493
+ }
494
+ for (const candidate of candidates) {
495
+ if (includedKeys.has(candidate.key)) {
496
+ continue;
497
+ }
498
+ if (isCellRangeNode(dependency) &&
499
+ !isDerivedCellPosition(candidate.position) &&
500
+ isCellCoordinateWithinCellRange(candidate.position, dependency)) {
501
+ includedKeys.add(candidate.key);
502
+ stack.push(candidate);
503
+ }
504
+ }
505
+ }
506
+ }
507
+ const included = [];
508
+ const deferred = [];
509
+ for (const node of cells) {
510
+ if (includedKeys.has(node.key)) {
511
+ included.push(node);
512
+ }
513
+ else {
514
+ deferred.push(node);
515
+ }
516
+ }
517
+ return { included, deferred };
518
+ };
519
+ const scheduleStartCalculation = useCallback((results, recalculatedPosition) => {
520
+ if (results && results.size) {
521
+ for (const entry of results) {
522
+ pendingStartResultsRef.current.set(entry[0], entry[1]);
523
+ }
524
+ }
525
+ if (recalculatedPosition) {
526
+ pendingRecalculatedPositionRef.current = recalculatedPosition;
527
+ }
528
+ scheduleStartCalculationIdle(() => {
529
+ const pendingResults = pendingStartResultsRef.current;
530
+ pendingStartResultsRef.current = new Map();
531
+ const position = pendingRecalculatedPositionRef.current;
532
+ pendingRecalculatedPositionRef.current = undefined;
533
+ startCalculationRef.current?.(pendingResults, position);
534
+ });
535
+ }, [scheduleStartCalculationIdle]);
536
+ // Calculator instance
537
+ const getCalculator = () => {
538
+ if (!calculator.current) {
539
+ const overrideValuesRef = overridesRef;
540
+ calculator.current = new Calculator({
541
+ locale,
542
+ getSheetId: getSheetIdStable,
543
+ getSheetIndex: getSheetIndexStable,
544
+ getSheetCount: getSheetCountStable,
545
+ getSheetProperties: (sheetId = getActiveSheetId()) => getSheetProperties(sheetId),
546
+ getSheetName: getSheetNameStable,
547
+ isRowHidden: isRowHidden ? isRowHiddenStable : undefined,
548
+ isRowHiddenByFilter: isRowHiddenByFilter
549
+ ? isRowHiddenByFilterStable
550
+ : undefined,
551
+ getCellValue(sheetId, rowIndex, columnIndex, property) {
552
+ const key = makeKey({
553
+ sheetId,
554
+ rowIndex,
555
+ columnIndex,
556
+ });
557
+ if (overrideValuesRef.current?.has(key)) {
558
+ const result = overrideValuesRef.current.get(key);
559
+ if (property) {
560
+ return getEffectiveStructuredValue?.(result, property);
561
+ }
562
+ return result;
563
+ }
564
+ const cachedValue = getComputationCache().has(key)
565
+ ? getComputationCache().get(key)
566
+ : null;
567
+ if (cachedValue !== null) {
568
+ // Cached structured value
569
+ if (cachedValue &&
570
+ typeof cachedValue === "object" &&
571
+ cachedValue.kind &&
572
+ getEffectiveStructuredValue) {
573
+ return getEffectiveStructuredValue?.(cachedValue, property);
574
+ }
575
+ return cachedValue;
576
+ }
577
+ return getEffectiveValue(sheetId, rowIndex, columnIndex, property);
578
+ },
579
+ functions: getFunctions(),
580
+ onStructuredReference: onStructuredReferenceStable,
581
+ onVariable: onNamedRange,
582
+ onRecalculation: onRecalculation,
583
+ markAsQueued,
584
+ markAsLoading,
585
+ markAsError,
586
+ getCellData: (coords) => {
587
+ if (isCellRange(coords)) {
588
+ const arr = [];
589
+ const sheetId = coords.sheet
590
+ ? getSheetIdStable(coords.sheet)
591
+ : getActiveSheetId();
592
+ for (let rowIndex = coords.from.row; rowIndex <= coords.to.row; rowIndex++) {
593
+ for (let columnIndex = coords.from.col; columnIndex <= coords.to.col; columnIndex++) {
594
+ arr.push(getCellDataStable(sheetId, rowIndex, columnIndex));
595
+ }
596
+ }
597
+ return arr;
598
+ }
599
+ else {
600
+ const position = cellCoordsToCellCoordinate(coords, coords.sheet
601
+ ? getSheetIdStable(coords.sheet)
602
+ : getActiveSheetId());
603
+ return getCellDataStable(position.sheetId, position.rowIndex, position.columnIndex);
604
+ }
605
+ },
606
+ });
607
+ }
608
+ return calculator.current;
609
+ };
610
+ // Cleanup
611
+ useIsomorphicLayoutEffect(() => {
612
+ return () => {
613
+ calculator.current?.cleanup();
614
+ };
615
+ }, []);
616
+ // Phase 9 — virtual-cell named ranges. Sync the host's named-range
617
+ // list with the calculator's registered set. Each formula-typed
618
+ // named range becomes a DAG node; range-typed ones go straight
619
+ // through `onNamedRange` and are skipped here.
620
+ //
621
+ // Excel-correctness requires named ranges to be registered BEFORE
622
+ // any cell formula is parsed — otherwise the dep parser sees the
623
+ // name as `#NAME?` and no DAG edge to the static node is created.
624
+ // We do this via a callable `applyNamedRanges` that's invoked
625
+ // synchronously by the init hook at the top of its calculate
626
+ // pass (before walking sheetData), AND from a useEffect so
627
+ // ongoing changes (Name Manager edits) propagate too. Both paths
628
+ // are idempotent: the diff against `registeredNamedRangeFormulasRef`
629
+ // means re-calling with the same list is a no-op.
630
+ // Track both formula AND scope so we re-register when scope flips
631
+ // (workbook ↔ sheet) even if the formula text is unchanged. Scope
632
+ // is the numeric sheetId — names can be renamed, ids are stable.
633
+ const registeredNamedRangeFormulasRef = useRef(new Map());
634
+ // Diff the provided list against what's already registered and
635
+ // apply only the delta. Pure function over its arg — no implicit
636
+ // ref reads — so the init hook can call it with the same
637
+ // namedRanges prop it has, and tests can call it directly with
638
+ // any list.
639
+ const applyNamedRanges = useCallbackRef((list) => {
640
+ if (!enabled)
641
+ return;
642
+ const calc = getCalculator();
643
+ // Map key combines lowercase name + scope so workbook-scoped
644
+ // and sheet-scoped names with the same display name don't
645
+ // collide (Excel treats them as separate defined names).
646
+ const scopeKey = (name, sheetId) => `${sheetId == null ? "wb" : String(sheetId)}:${name.toLowerCase()}`;
647
+ const next = new Map();
648
+ for (const nr of list ?? []) {
649
+ const value = nr?.value;
650
+ if (typeof value !== "string")
651
+ continue;
652
+ // Accept both shapes: "=OFFSET(...)" (spreadsheet convention)
653
+ // and bare "OFFSET(...)" (OOXML definedName convention).
654
+ // Static literals and plain references are not registered —
655
+ // they resolve through the host's onNamedRange fallback.
656
+ const trimmedValue = value.trim();
657
+ let formula;
658
+ if (trimmedValue.startsWith("=")) {
659
+ formula = trimmedValue.slice(1).trim();
660
+ }
661
+ else if (isBareFormulaExpression(trimmedValue)) {
662
+ formula = trimmedValue;
663
+ }
664
+ else {
665
+ continue;
666
+ }
667
+ if (!formula)
668
+ continue;
669
+ // Sheet-scoped if NamedRange.range.sheetId is present; else
670
+ // workbook-scoped. sheetId is stable across sheet renames.
671
+ const sheetId = nr.range?.sheetId ?? undefined;
672
+ next.set(scopeKey(nr.name, sheetId), {
673
+ name: nr.name,
674
+ formula,
675
+ sheetId,
676
+ });
677
+ }
678
+ const prev = registeredNamedRangeFormulasRef.current;
679
+ // Removals: in prev, not in next.
680
+ for (const [key, prevEntry] of prev) {
681
+ if (!next.has(key)) {
682
+ // The map key is `<scope>:<name>`; recover the name by
683
+ // slicing past the first colon and pass the tracked
684
+ // sheetId so we hit the right scoped registration.
685
+ calc.unregisterNamedRange(key.slice(key.indexOf(":") + 1), prevEntry.sheetId);
686
+ }
687
+ }
688
+ // Collect adds + updates. Compare formula AND scope so a
689
+ // scope-only change still re-registers (scope changes also
690
+ // flip the map key, so they hit removal+add — defensive
691
+ // equality check kept for robustness).
692
+ const toApply = [];
693
+ const nextPrev = new Map();
694
+ for (const [key, { name, formula, sheetId }] of next) {
695
+ const prevEntry = prev.get(key);
696
+ nextPrev.set(key, { formula, sheetId });
697
+ if (prevEntry?.formula === formula && prevEntry.sheetId === sheetId) {
698
+ continue;
699
+ }
700
+ toApply.push({ name, formula, sheetId });
701
+ }
702
+ // Order-independent batch: cross-name edges
703
+ // (`fullPrice = price * 1.08`) get wired correctly regardless
704
+ // of the order the names appear in the host's array.
705
+ if (toApply.length)
706
+ calc.registerNamedRanges(toApply);
707
+ registeredNamedRangeFormulasRef.current = nextPrev;
708
+ });
709
+ // Re-apply whenever the host's namedRanges list changes.
710
+ useEffect(() => {
711
+ applyNamedRanges(namedRanges);
712
+ }, [namedRanges, enabled, applyNamedRanges]);
713
+ // Hook for processing arrays
714
+ const [processArrayResults, createArraySideEffectsAndGetResults, getErrorResultsFromArrayPosition,] = useCalculationProcessArray({
715
+ locale,
716
+ getCalculator,
717
+ getSheetId: getSheetIdStable,
718
+ getComputationCache,
719
+ getUserEnteredValue,
720
+ getCellData: getCellDataStable,
721
+ });
722
+ /**
723
+ * Mark a cell
724
+ */
725
+ const markCell = useCallback((coords, value, formatting) => {
726
+ const results = new Map();
727
+ const position = cellCoordsToCellCoordinate(coords, coords.sheet ? getSheetIdStable(coords.sheet) : getActiveSheetId());
728
+ const key = makeKey(position);
729
+ if (rafTimerMapRef.current.has(key)) {
730
+ const rafTimerId = rafTimerMapRef.current.get(key);
731
+ if (!isNil(rafTimerId)) {
732
+ cancelAnimationFrame(rafTimerId);
733
+ rafTimerMapRef.current.delete(key);
734
+ }
735
+ }
736
+ results.set(key, [position, value, formatting]);
737
+ publishResults(results.values());
738
+ }, []);
739
+ /**
740
+ * Mark a position as queue
741
+ */
742
+ const markAsQueued = useCallback((coords) => {
743
+ markCell(coords, "Queued", {
744
+ horizontalAlignment: "center",
745
+ });
746
+ }, [markCell]);
747
+ /**
748
+ * Mark a position as loading
749
+ */
750
+ const markAsLoading = useCallback((coords) => {
751
+ markCell(coords, "Loading...", {
752
+ horizontalAlignment: "center",
753
+ });
754
+ }, [markCell]);
755
+ /**
756
+ * Mark a position as error
757
+ */
758
+ const markAsError = useCallback((coords, value) => {
759
+ markCell(coords, value, {
760
+ horizontalAlignment: "center",
761
+ textFormat: {
762
+ color: ERROR_COLOR,
763
+ },
764
+ });
765
+ }, [markCell]);
766
+ // On Recalculation: For dynamically updating calculated values
767
+ const onRecalculation = (coords, calculationResults) => {
768
+ const results = new Map();
769
+ const position = cellCoordsToCellCoordinate(coords, coords.sheet ? getSheetIdStable(coords.sheet) : getActiveSheetId());
770
+ const key = makeKey(position);
771
+ /**
772
+ * Multitenant returns null for
773
+ * unsubscribe callback
774
+ */
775
+ if (calculationResults === null) {
776
+ return;
777
+ }
778
+ // Set this cell as dirty
779
+ getCalculator().markAsDirty(position);
780
+ if (Array.isArray(calculationResults)) {
781
+ const [collides, recomputeOperations] = processArrayResults(calculationResults, position, results, getDependents);
782
+ if (collides) {
783
+ getCalculator().cleanupPipelineFunction(position);
784
+ }
785
+ // New compuete
786
+ enqueueCalculations(recomputeOperations);
787
+ }
788
+ else {
789
+ // Add it to computation cache
790
+ getComputationCache().set(key, calculationResults);
791
+ // Push result to array
792
+ results.set(key, [position, calculationResults]);
793
+ }
794
+ scheduleStartCalculation(results, position);
795
+ };
796
+ // Begin calculation
797
+ const startCalculation = async (initialResults = new Map(), recalculatedPosition) => {
798
+ // `startCalculation` is invoked fire-and-forget (the RAF idle scheduler
799
+ // discards its promise, and `useDeferredCalculationFlush` types
800
+ // `onFlushComplete` as `() => void`), so a rejection here surfaces as a
801
+ // window `unhandledrejection` — seen in production as raw
802
+ // FormulaError("#NAME?", "Unknown range name") exceptions reaching users.
803
+ // Every per-cell path already converts FormulaError into a cell error
804
+ // value; this guard is the backstop for anything thrown outside those
805
+ // catches, so a recalc failure degrades to an aborted pass (dirty cells
806
+ // stay dirty for the next trigger) instead of an uncaught exception. The
807
+ // tail below still runs so calculation state is always released.
808
+ try {
809
+ // Publish initial results
810
+ if (initialResults.size) {
811
+ publishResults(initialResults.values());
812
+ }
813
+ // Per-batch processing of a run of dirty cells (lazy-calc
814
+ // filtering, circular detection, parallel evaluation). Extracted
815
+ // so the interleaved topo loop can call it per cell segment.
816
+ const runCellBatch = async (input) => {
817
+ let cellNodes = input;
818
+ const rootSheetId = enableLazyCalculation
819
+ ? getActiveSheetId()
820
+ : undefined;
821
+ if (typeof rootSheetId === "number") {
822
+ const { included, deferred } = filterDirtyCellsForActiveSheet(cellNodes, rootSheetId);
823
+ if (deferred.length) {
824
+ deferCalculationNodes(deferred.map((cell) => cell.position));
825
+ }
826
+ cellNodes = included;
827
+ }
828
+ if (!cellNodes.length)
829
+ return;
830
+ if (!iterativeCalculationRef.current?.enabled) {
831
+ const circularKeys = findCircularKeys(cellNodes);
832
+ if (circularKeys.size) {
833
+ const results = new Map();
834
+ for (const node of cellNodes) {
835
+ if (!circularKeys.has(node.key)) {
836
+ continue;
837
+ }
838
+ const error = new FormulaError("#REF!", "Circular dependency detected.");
839
+ getComputationCache().set(node.key, error);
840
+ results.set(node.key, [node.position, error]);
841
+ }
842
+ publishResults(results.values());
843
+ cellNodes = cellNodes.filter((node) => !circularKeys.has(node.key));
844
+ }
845
+ }
846
+ await processCells(cellNodes, recalculatedPosition);
847
+ };
848
+ let dirtyCells = [];
849
+ while ((dirtyCells = getCalculator().getDirtyCells()) &&
850
+ dirtyCells.length !== 0) {
851
+ // Walk the dirty list in topological order, interleaving:
852
+ // - CellNode → batched and run by `runCellBatch` (parallel
853
+ // within the batch).
854
+ // - StaticNode that's a named-range virtual cell → evaluate
855
+ // inline; this populates the value cache so
856
+ // downstream cells in this same batch read
857
+ // the fresh value via `onVariable`.
858
+ // - StaticNode other (array spill etc) → `publishStaticCells`.
859
+ //
860
+ // Named-range nodes can appear anywhere in the topo order —
861
+ // they may depend on dirty cells that need to recompute first,
862
+ // and other cells may depend on them. We flush the pending
863
+ // cell batch before each static, so writes land in host state
864
+ // (via onSuccess) before the next static reads them. This is
865
+ // the Excel unified-sort semantics.
866
+ const calc = getCalculator();
867
+ const pendingCells = [];
868
+ const flushPending = async () => {
869
+ if (!pendingCells.length)
870
+ return;
871
+ const batch = pendingCells.slice();
872
+ pendingCells.length = 0;
873
+ await runCellBatch(batch);
874
+ };
875
+ for (const node of dirtyCells) {
876
+ // Duck-type instead of `instanceof` to survive bundler
877
+ // class-duplication: when @rowsncolumns/dag is inlined into separate
878
+ // chunks (the published rnc-engine path), its classes get distinct
879
+ // constructor identities and `instanceof` fails even for shape-identical
880
+ // nodes. StaticNode has no `position` (created via `new StaticNode(id)`);
881
+ // CellNode's `position` is a cell coordinate.
882
+ if (!node.position) {
883
+ await flushPending();
884
+ if (calc.isNamedRangeNodeKey(node.key)) {
885
+ await calc.evaluateNamedRangeNodeKey(node.key);
886
+ }
887
+ else {
888
+ publishStaticCells(node);
889
+ }
890
+ }
891
+ else if (isCellCoordinate(node.position)) {
892
+ // `isCellCoordinate` narrows `node.position`, not `node`; the cast
893
+ // reflects the shape the guard just confirmed (a cell-coordinate node).
894
+ pendingCells.push(node);
895
+ }
896
+ }
897
+ await flushPending();
898
+ }
899
+ }
900
+ catch (err) {
901
+ console.error("[spreadsheet-state] recalculation pass aborted:", err);
902
+ }
903
+ // Clear current calculation array results
904
+ initialArrayResults.current = new Map();
905
+ onAfterCalculation();
906
+ // If there are unconsumed forceRecalcKeys (added concurrently by a paste
907
+ // RAF while this calculation was running with stale closures), re-dirty
908
+ // those cells so the next calculation cycle (with fresh state) can evaluate
909
+ // them. Cap reschedules to prevent an infinite loop if a key can never be
910
+ // consumed.
911
+ if (forceRecalcKeys.current.size > 0) {
912
+ const MAX_RESCHEDULE = 50;
913
+ rescheduleCount.current = (rescheduleCount.current || 0) + 1;
914
+ if (rescheduleCount.current <= MAX_RESCHEDULE) {
915
+ forceRecalcPositions.current.forEach((pos) => {
916
+ getCalculator().markAsDirty(pos);
917
+ });
918
+ scheduleStartCalculation();
919
+ }
920
+ else {
921
+ // Give up — clear to avoid infinite spin.
922
+ forceRecalcKeys.current.clear();
923
+ forceRecalcPositions.current.clear();
924
+ rescheduleCount.current = 0;
925
+ }
926
+ }
927
+ else {
928
+ rescheduleCount.current = 0;
929
+ }
930
+ // Trigger onChange
931
+ onChangeDependencyGraph?.(getCalculator().graph.toJSON());
932
+ };
933
+ startCalculationRef.current = startCalculation;
934
+ // Process async
935
+ async function processCells(cells, recalculatedPosition) {
936
+ if (!iterativeCalculationRef.current?.enabled) {
937
+ return processCellsInParallel(cells, recalculatedPosition);
938
+ }
939
+ const cellMap = new Map();
940
+ for (const cell of cells) {
941
+ cellMap.set(makeKey(cell.position), cell);
942
+ }
943
+ const adjacency = new Map();
944
+ const getDependencies = (cell) => {
945
+ const deps = getCalculator().getPrecedents(cell.position);
946
+ const depKeys = new Set();
947
+ for (const dep of deps) {
948
+ if (isCellNode(dep)) {
949
+ const depKey = makeKey(dep.position);
950
+ if (cellMap.has(depKey)) {
951
+ depKeys.add(depKey);
952
+ }
953
+ continue;
954
+ }
955
+ if (isCellRangeNode(dep)) {
956
+ const rangeDep = dep;
957
+ for (const candidate of cells) {
958
+ if (!isDerivedCellPosition(candidate.position) &&
959
+ isCellCoordinateWithinCellRange(candidate.position, rangeDep)) {
960
+ depKeys.add(makeKey(candidate.position));
961
+ }
962
+ }
963
+ }
964
+ }
965
+ return depKeys;
966
+ };
967
+ const hasSelfReference = (cell) => {
968
+ const userEnteredValue = getFinalUserEnteredValue(cell.position);
969
+ if (!isAFormula(userEnteredValue) || !userEnteredValue) {
970
+ return false;
971
+ }
972
+ const formulaValue = String(userEnteredValue).slice(1);
973
+ try {
974
+ const deps = getCalculator().dependencies(formulaValue, cell.position);
975
+ return deps.some((dep) => {
976
+ // Named-range static refs can't self-reference a cell.
977
+ if (isStaticReference(dep))
978
+ return false;
979
+ if (isCellCoordinate(dep)) {
980
+ return isEqualPosition(dep, cell.position);
981
+ }
982
+ return (dep.sheetId === cell.position.sheetId &&
983
+ cell.position.rowIndex >= dep.startRowIndex &&
984
+ cell.position.rowIndex <= dep.endRowIndex &&
985
+ cell.position.columnIndex >= dep.startColumnIndex &&
986
+ cell.position.columnIndex <= dep.endColumnIndex);
987
+ });
988
+ }
989
+ catch {
990
+ return false;
991
+ }
992
+ };
993
+ const indices = new Map();
994
+ const lowlinks = new Map();
995
+ const stack = [];
996
+ const onStack = new Set();
997
+ const iterativeGroups = [];
998
+ let index = 0;
999
+ const strongConnect = (key) => {
1000
+ indices.set(key, index);
1001
+ lowlinks.set(key, index);
1002
+ index++;
1003
+ stack.push(key);
1004
+ onStack.add(key);
1005
+ const deps = adjacency.get(key) ?? new Set();
1006
+ for (const depKey of deps) {
1007
+ if (!indices.has(depKey)) {
1008
+ strongConnect(depKey);
1009
+ lowlinks.set(key, Math.min(lowlinks.get(key), lowlinks.get(depKey)));
1010
+ }
1011
+ else if (onStack.has(depKey)) {
1012
+ lowlinks.set(key, Math.min(lowlinks.get(key), indices.get(depKey)));
1013
+ }
1014
+ }
1015
+ if (lowlinks.get(key) === indices.get(key)) {
1016
+ const componentKeys = [];
1017
+ let current;
1018
+ do {
1019
+ current = stack.pop();
1020
+ if (!current) {
1021
+ break;
1022
+ }
1023
+ onStack.delete(current);
1024
+ componentKeys.push(current);
1025
+ } while (current !== key);
1026
+ if (componentKeys.length > 1) {
1027
+ iterativeGroups.push(componentKeys
1028
+ .map((componentKey) => cellMap.get(componentKey))
1029
+ .filter((cell) => !!cell));
1030
+ return;
1031
+ }
1032
+ const singleKey = componentKeys[0];
1033
+ const cell = singleKey ? cellMap.get(singleKey) : undefined;
1034
+ if (cell && hasSelfReference(cell)) {
1035
+ iterativeGroups.push([cell]);
1036
+ }
1037
+ }
1038
+ };
1039
+ for (const cell of cells) {
1040
+ const key = makeKey(cell.position);
1041
+ if (!adjacency.has(key)) {
1042
+ adjacency.set(key, getDependencies(cell));
1043
+ }
1044
+ }
1045
+ for (const cell of cells) {
1046
+ const key = makeKey(cell.position);
1047
+ if (!indices.has(key)) {
1048
+ strongConnect(key);
1049
+ }
1050
+ }
1051
+ if (!iterativeGroups.length) {
1052
+ return processCellsInParallel(cells, recalculatedPosition);
1053
+ }
1054
+ const iterativeKeys = new Set();
1055
+ for (const group of iterativeGroups) {
1056
+ for (const cell of group) {
1057
+ iterativeKeys.add(makeKey(cell.position));
1058
+ }
1059
+ }
1060
+ const nonIterativeCells = cells.filter((cell) => !iterativeKeys.has(makeKey(cell.position)));
1061
+ if (nonIterativeCells.length) {
1062
+ await processCellsInParallel(nonIterativeCells, recalculatedPosition);
1063
+ }
1064
+ const maxIterations = Math.max(1, iterativeCalculationRef.current?.maxIterations ?? 100);
1065
+ const maxChange = Math.max(0, iterativeCalculationRef.current?.maxChange ?? 0.001);
1066
+ for (const group of iterativeGroups) {
1067
+ for (const cell of group) {
1068
+ const effectiveValue = getEffectiveValue?.(cell.position.sheetId, cell.position.rowIndex, cell.position.columnIndex);
1069
+ if (isErrorResult(effectiveValue)) {
1070
+ getComputationCache().set(makeKey(cell.position), 0);
1071
+ }
1072
+ }
1073
+ let previousValues = null;
1074
+ let converged = false;
1075
+ for (let iteration = 0; iteration < maxIterations; iteration++) {
1076
+ const currentValues = new Map();
1077
+ for (const cell of group) {
1078
+ if (recalculatedPosition &&
1079
+ isEqualPosition(cell.position, recalculatedPosition)) {
1080
+ continue;
1081
+ }
1082
+ const userEnteredValue = getFinalUserEnteredValue(cell.position);
1083
+ if (!isAFormula(userEnteredValue) || !userEnteredValue) {
1084
+ continue;
1085
+ }
1086
+ try {
1087
+ let result = await getCalculator().calculate(String(userEnteredValue).slice(1), cell.position);
1088
+ if (result instanceof DataSource) {
1089
+ result = await result.get();
1090
+ }
1091
+ const key = makeKey(cell.position);
1092
+ currentValues.set(key, result);
1093
+ if (!Array.isArray(result)) {
1094
+ getComputationCache().set(key, result);
1095
+ }
1096
+ }
1097
+ catch (err) {
1098
+ const error = err instanceof FormulaError
1099
+ ? err
1100
+ : new FormulaError(err?.name ?? "#ERROR!", err?.message ?? String(err), err?.stack);
1101
+ currentValues.set(makeKey(cell.position), error);
1102
+ getComputationCache().set(makeKey(cell.position), error);
1103
+ }
1104
+ }
1105
+ if (previousValues) {
1106
+ let maxDelta = 0;
1107
+ for (const [key, value] of currentValues) {
1108
+ const delta = computeDelta(previousValues.get(key), value);
1109
+ if (delta > maxDelta) {
1110
+ maxDelta = delta;
1111
+ }
1112
+ }
1113
+ previousValues = currentValues;
1114
+ if (maxDelta <= maxChange) {
1115
+ converged = true;
1116
+ break;
1117
+ }
1118
+ }
1119
+ else {
1120
+ previousValues = currentValues;
1121
+ }
1122
+ }
1123
+ const finalValues = previousValues ?? new Map();
1124
+ const results = new Map();
1125
+ for (const cell of group) {
1126
+ const key = makeKey(cell.position);
1127
+ let value = finalValues.get(key);
1128
+ if (!converged) {
1129
+ value = new FormulaError("#NUM!", "Iterative calculation did not converge");
1130
+ }
1131
+ if (value instanceof FormulaError) {
1132
+ const [arrayErrors, recomputeOperations] = getErrorResultsFromArrayPosition(cell.position);
1133
+ getComputationCache().set(key, value);
1134
+ enqueueCalculations(recomputeOperations);
1135
+ results.set(key, [cell.position, value]);
1136
+ for (const [errorKey, errorValue] of arrayErrors) {
1137
+ results.set(errorKey, errorValue);
1138
+ }
1139
+ continue;
1140
+ }
1141
+ if (Array.isArray(value)) {
1142
+ const [collides, recomputeOperations] = processArrayResults(value, cell.position, results, getDependents);
1143
+ if (collides) {
1144
+ getCalculator().cleanupPipelineFunction(cell.position);
1145
+ }
1146
+ enqueueCalculations(recomputeOperations);
1147
+ }
1148
+ else {
1149
+ getComputationCache().set(key, value);
1150
+ results.set(key, [cell.position, value]);
1151
+ }
1152
+ }
1153
+ publishResults(results.values());
1154
+ }
1155
+ const followUpCells = new Map();
1156
+ for (const group of iterativeGroups) {
1157
+ for (const cell of group) {
1158
+ const dependents = getDependents(cell.position);
1159
+ for (const dependent of dependents) {
1160
+ if (isCellNode(dependent)) {
1161
+ const cellDep = dependent;
1162
+ const depKey = makeKey(cellDep.position);
1163
+ if (!iterativeKeys.has(depKey)) {
1164
+ followUpCells.set(depKey, cellDep);
1165
+ }
1166
+ }
1167
+ }
1168
+ }
1169
+ }
1170
+ if (followUpCells.size) {
1171
+ await processCellsInParallel(Array.from(followUpCells.values()), recalculatedPosition);
1172
+ }
1173
+ }
1174
+ async function processCellsInParallel(cells, recalculatedPosition) {
1175
+ const processingCells = new Set();
1176
+ async function processCellWithDependencies(cell) {
1177
+ const cellKey = makeKey(cell.position);
1178
+ // If the cell is already being processed, wait for it to complete
1179
+ while (processingCells.has(cellKey)) {
1180
+ await new Promise((resolve) => setTimeout(resolve, 0));
1181
+ }
1182
+ if (cellPromises.has(cellKey)) {
1183
+ return cellPromises.get(cellKey).promise;
1184
+ }
1185
+ processingCells.add(cellKey);
1186
+ try {
1187
+ // Create a new AbortController for this cell
1188
+ const controller = new AbortController();
1189
+ const dependencies = getPrecedents(cell.position);
1190
+ // Use `isCellNode` / `isCellRangeNode` instead of `instanceof`.
1191
+ // When `@rowsncolumns/dag` is loaded through more than one
1192
+ // module-resolution path in a consumer bundle (CJS/ESM
1193
+ // dual-package hazard hits webpack/Next builds even with a
1194
+ // single installed copy), each path produces its own
1195
+ // constructor identity and `instanceof` returns `false` for
1196
+ // shape-identical nodes. The `___type`-tag check in these
1197
+ // helpers is identity-independent and survives across module
1198
+ // instances.
1199
+ const cellDependencies = dependencies.filter((dep) => isCellNode(dep) && cells.includes(dep));
1200
+ const rangeDependencies = dependencies.filter((dep) => isCellRangeNode(dep));
1201
+ for (const dep of rangeDependencies) {
1202
+ for (const cell of cells) {
1203
+ if (!isDerivedCellPosition(cell.position) &&
1204
+ isCellCoordinateWithinCellRange(cell.position, dep)) {
1205
+ cellDependencies.push(cell);
1206
+ }
1207
+ }
1208
+ }
1209
+ const dependencyPromises = cellDependencies.map((dep) => processCellWithDependencies(dep));
1210
+ const cellPromise = (async () => {
1211
+ await Promise.allSettled(dependencyPromises);
1212
+ // Set signal
1213
+ cell.position.signal = controller.signal;
1214
+ // Process cell
1215
+ await processCell(cell, recalculatedPosition);
1216
+ // Remove signal after processing this cell
1217
+ delete cell.position.signal;
1218
+ })();
1219
+ cellPromises.set(cellKey, { promise: cellPromise, controller });
1220
+ return cellPromise;
1221
+ }
1222
+ finally {
1223
+ processingCells.delete(cellKey);
1224
+ }
1225
+ }
1226
+ // Remove old promises
1227
+ cells.forEach((cell) => {
1228
+ const key = makeKey(cell.position);
1229
+ if (key) {
1230
+ cellPromises.get(key)?.controller.abort();
1231
+ cellPromises.delete(key);
1232
+ }
1233
+ });
1234
+ const getCellWeight = (cell) => {
1235
+ const value = getFinalUserEnteredValue(cell.position);
1236
+ if (typeof value === "string" && value.startsWith("=")) {
1237
+ const formula = value.slice(1);
1238
+ if (isHeavyArrayFormula(formula)) {
1239
+ return ARRAY_FORMULA_WEIGHT;
1240
+ }
1241
+ }
1242
+ return 1;
1243
+ };
1244
+ const chunkCells = () => {
1245
+ if (!cells.length) {
1246
+ return [];
1247
+ }
1248
+ const chunks = [];
1249
+ let current = [];
1250
+ let weight = 0;
1251
+ const flush = () => {
1252
+ if (!current.length) {
1253
+ return;
1254
+ }
1255
+ chunks.push(current);
1256
+ current = [];
1257
+ weight = 0;
1258
+ };
1259
+ for (const cell of cells) {
1260
+ const nextWeight = getCellWeight(cell);
1261
+ if (current.length && weight + nextWeight > DEFAULT_BATCH_WEIGHT) {
1262
+ flush();
1263
+ }
1264
+ current.push(cell);
1265
+ weight += nextWeight;
1266
+ if (weight >= DEFAULT_BATCH_WEIGHT) {
1267
+ flush();
1268
+ }
1269
+ }
1270
+ flush();
1271
+ return chunks.length ? chunks : [cells];
1272
+ };
1273
+ const chunks = chunkCells();
1274
+ for (let index = 0; index < chunks.length; index++) {
1275
+ const chunk = chunks[index];
1276
+ if (!chunk.length) {
1277
+ continue;
1278
+ }
1279
+ const start = getTimestamp();
1280
+ await Promise.allSettled(chunk.map(processCellWithDependencies));
1281
+ const elapsed = getTimestamp() - start;
1282
+ if (elapsed >= MAX_CHUNK_DURATION_MS && index < chunks.length - 1) {
1283
+ await yieldToBrowser();
1284
+ }
1285
+ }
1286
+ cellPromises.clear();
1287
+ }
1288
+ // Process a single dirty cell
1289
+ const processCell = async (dirtyCell, recalculatedPosition) => {
1290
+ const results = new Map();
1291
+ const { position, key } = dirtyCell;
1292
+ const userEnteredValue = getFinalUserEnteredValue(position);
1293
+ const isFormula = isAFormula(userEnteredValue);
1294
+ if (recalculatedPosition &&
1295
+ isEqualPosition(position, recalculatedPosition)) {
1296
+ debug("Prevent recalculation of pipeline function", key);
1297
+ return;
1298
+ }
1299
+ // Check for force
1300
+ if (onDemandPattern) {
1301
+ onDemandPattern.lastIndex = 0;
1302
+ }
1303
+ if (isFormula &&
1304
+ userEnteredValue &&
1305
+ onDemandPattern?.test(userEnteredValue)) {
1306
+ if (!forceRecalcKeys.current.has(key)) {
1307
+ // Prevent calculation
1308
+ const onDemandMap = new Map();
1309
+ onDemandMap.set(key, [position, AWAITING_CALCULATION]);
1310
+ onSuccess(onDemandMap.values());
1311
+ return;
1312
+ }
1313
+ // Mark this on-demand key as consumed inside the gate's PASSED branch.
1314
+ // A stale closure that reads userEnteredValue as undefined (pre-paste
1315
+ // state) has isFormula === false, so it never enters this gate and thus
1316
+ // never consumes the key. The key survives until the next calculation
1317
+ // cycle runs with fresh React state, where getFinalUserEnteredValue
1318
+ // returns the actual formula.
1319
+ consumedForceRecalcKeys.current.add(key);
1320
+ }
1321
+ // For non-on-demand cells in forceRecalcKeys, only consume when we can
1322
+ // confirm the cell actually holds a formula (guards against stale closures
1323
+ // where userEnteredValue is undefined).
1324
+ if (forceRecalcKeys.current.has(key) && isFormula && userEnteredValue) {
1325
+ consumedForceRecalcKeys.current.add(key);
1326
+ }
1327
+ // Log
1328
+ debug("Processing", position, key, userEnteredValue);
1329
+ if (isFormula && userEnteredValue) {
1330
+ let rafTimer;
1331
+ try {
1332
+ // Validate this formuala. Duck-type instead of `instanceof CellNode`
1333
+ // to survive bundler class-duplication (see the dirtyCells loop).
1334
+ const isCellNode = !!dirtyCell.position && isCellCoordinate(dirtyCell.position);
1335
+ rafTimer = isCellNode
1336
+ ? requestAnimationFrame(() => publishBeginCalculation?.(dirtyCell))
1337
+ : undefined;
1338
+ if (!isNil(rafTimer)) {
1339
+ rafTimerMapRef.current.set(key, rafTimer);
1340
+ }
1341
+ let result = await getCalculator().calculate(userEnteredValue.slice(1), position);
1342
+ // Cancel
1343
+ if (rafTimer) {
1344
+ cancelAnimationFrame(rafTimer);
1345
+ rafTimerMapRef.current.delete(key);
1346
+ }
1347
+ // Datasource
1348
+ if (result instanceof DataSource) {
1349
+ result = await result.get();
1350
+ }
1351
+ // Array results
1352
+ if (Array.isArray(result)) {
1353
+ // Get all array cells (excludes parent cell) for recomputing in the same RAF
1354
+ const [collides, recomputeOperations] = processArrayResults(result, position, results, getDependents);
1355
+ // If it does collide
1356
+ if (collides) {
1357
+ getCalculator().cleanupPipelineFunction(position);
1358
+ }
1359
+ // New compuete
1360
+ enqueueCalculations(recomputeOperations);
1361
+ }
1362
+ else {
1363
+ // Add it to computation cache
1364
+ getComputationCache().set(key, result);
1365
+ // Invalidate any cached ranges containing this cell
1366
+ getCalculator().invalidateCacheForCell(position.sheetId, position.rowIndex, position.columnIndex);
1367
+ // Push result to array
1368
+ results.set(key, [position, result]);
1369
+ }
1370
+ }
1371
+ catch (err) {
1372
+ if (rafTimer) {
1373
+ cancelAnimationFrame(rafTimer);
1374
+ }
1375
+ // Calculation error
1376
+ if (err instanceof FormulaError || err instanceof Error) {
1377
+ // Cast error messages
1378
+ const error = err instanceof FormulaError
1379
+ ? err
1380
+ : new FormulaError(err.name, err.message, err.stack);
1381
+ // We have to check if this error is caused in a cell
1382
+ // containing array formula
1383
+ // If so we have to reset all values references by this
1384
+ // array
1385
+ debug("Computation Error", error, position, key, userEnteredValue);
1386
+ const [arrayErrors, recomputeOperations] = getErrorResultsFromArrayPosition(position);
1387
+ // Add it to computation cache
1388
+ getComputationCache().set(key, error);
1389
+ // Invalidate any cached ranges containing this cell
1390
+ getCalculator().invalidateCacheForCell(position.sheetId, position.rowIndex, position.columnIndex);
1391
+ // New compuete
1392
+ enqueueCalculations(recomputeOperations);
1393
+ // Add to results
1394
+ results.set(key, [position, error]);
1395
+ for (const [key, value] of arrayErrors) {
1396
+ results.set(key, value);
1397
+ }
1398
+ }
1399
+ }
1400
+ publishResults(results.values());
1401
+ }
1402
+ else {
1403
+ // Cleanup functions
1404
+ // Scenario -
1405
+ // 1. Delete a pipeline function
1406
+ // 2. Undo
1407
+ // 3. And then Redo - Cleanup should be called when formula is deleted
1408
+ getCalculator().cleanupPipelineFunction(position);
1409
+ }
1410
+ };
1411
+ /**
1412
+ * Publish static cells back
1413
+ */
1414
+ const publishStaticCells = useCallback((node) => {
1415
+ if (staticNodeArrayRef.current.push(node) === 1) {
1416
+ requestAnimationFrame(() => {
1417
+ try {
1418
+ onChangeStaticReference?.(staticNodeArrayRef.current);
1419
+ }
1420
+ catch (err) {
1421
+ console.error("[spreadsheet-state] recalculation pass aborted:", err);
1422
+ }
1423
+ finally {
1424
+ staticNodeArrayRef.current.length = 0;
1425
+ }
1426
+ });
1427
+ }
1428
+ }, [onChangeStaticReference]);
1429
+ /**
1430
+ * Publish loading cells
1431
+ */
1432
+ const publishBeginCalculation = useCallback((node) => {
1433
+ if (initialCalculationArrayRef.current.push(node.position) === 1) {
1434
+ requestAnimationFrame(() => {
1435
+ try {
1436
+ onBeginCalculation?.(initialCalculationArrayRef.current);
1437
+ }
1438
+ catch (err) {
1439
+ console.error("[spreadsheet-state] recalculation pass aborted:", err);
1440
+ }
1441
+ finally {
1442
+ initialCalculationArrayRef.current.length = 0;
1443
+ }
1444
+ });
1445
+ }
1446
+ }, [onBeginCalculation]);
1447
+ /**
1448
+ * Publish results back to the
1449
+ */
1450
+ const publishResults = useCallback((item) => {
1451
+ for (const entry of item) {
1452
+ const [key] = entry;
1453
+ resultsQueueRef.current.set(makeKey(key), entry);
1454
+ }
1455
+ if (resultsQueueRef.current.size === 0) {
1456
+ return;
1457
+ }
1458
+ if (resultsFlushPendingRef.current) {
1459
+ return;
1460
+ }
1461
+ resultsFlushPendingRef.current = true;
1462
+ const isFullRecalc = isFullRecalcRef.current;
1463
+ // The flush RAF is fire-and-forget: a throw from the host's `onSuccess`
1464
+ // used to escape to `window.onerror` as a raw uncaught exception.
1465
+ // Contain it, and clear the queue in `finally` so a throwing host
1466
+ // callback can't replay the same results on every subsequent flush.
1467
+ requestAnimationFrame(() => {
1468
+ resultsFlushPendingRef.current = false;
1469
+ if (!resultsQueueRef.current.size) {
1470
+ return;
1471
+ }
1472
+ try {
1473
+ onSuccess?.(resultsQueueRef.current.values(), isFullRecalc, {});
1474
+ }
1475
+ catch (err) {
1476
+ console.error("[spreadsheet-state] recalculation pass aborted:", err);
1477
+ }
1478
+ finally {
1479
+ resultsQueueRef.current.clear();
1480
+ isFullRecalcRef.current = false;
1481
+ }
1482
+ });
1483
+ }, [onSuccess]);
1484
+ // Immediately enqueue a calculation
1485
+ const enqueueCalculations = (operations) => {
1486
+ operations.forEach(processSingleOperation);
1487
+ };
1488
+ // Seed the calculator's array range map with a persisted spill range.
1489
+ // No-op when no spillRange is supplied or the sheet name can't be resolved.
1490
+ const seedArraySpillRange = (position, spillRange) => {
1491
+ if (!spillRange) {
1492
+ return;
1493
+ }
1494
+ const calculator = getCalculator();
1495
+ const sheetName = calculator.getSheetName(position.sheetId);
1496
+ if (!sheetName) {
1497
+ return;
1498
+ }
1499
+ calculator.setArrayRangeReference(position, {
1500
+ sheet: sheetName,
1501
+ from: {
1502
+ row: spillRange.startRowIndex,
1503
+ col: spillRange.startColumnIndex,
1504
+ },
1505
+ to: {
1506
+ row: spillRange.endRowIndex,
1507
+ col: spillRange.endColumnIndex,
1508
+ },
1509
+ });
1510
+ };
1511
+ // Process a single
1512
+ const processSingleOperation = (operation) => {
1513
+ const { position, type, force, spillRange } = operation;
1514
+ const userEnteredValue = getFinalUserEnteredValue(position);
1515
+ const isFormula = isAFormula(userEnteredValue);
1516
+ const formulaValue = isFormula
1517
+ ? String(userEnteredValue)?.slice(1)
1518
+ : undefined;
1519
+ if (force) {
1520
+ const forceKey = makeKey(position);
1521
+ forceRecalcKeys.current.add(forceKey);
1522
+ forceRecalcPositions.current.set(forceKey, position);
1523
+ }
1524
+ try {
1525
+ // Add/remove to DAG
1526
+ if (isFormula && formulaValue) {
1527
+ // Does both add and update formula. Updates DAG references
1528
+ getCalculator().addFormula(formulaValue, position);
1529
+ // Seed array spill range from persisted ref so dependents pointing
1530
+ // into the spill region resolve on first load without re-eval.
1531
+ seedArraySpillRange(position, spillRange);
1532
+ // Add to ephemeral
1533
+ addToEphemeralFunction(formulaValue, position);
1534
+ }
1535
+ else if (type === "add") {
1536
+ // If user replaces a formula with static text
1537
+ // Remove old references
1538
+ getCalculator().removePrecedents(position);
1539
+ // Mark this cell as dirty
1540
+ getCalculator().markAsDirty(position);
1541
+ // Cleanup ephemeral
1542
+ removeFromEphemeralFunction(position);
1543
+ }
1544
+ else if (type === "dirty") {
1545
+ getCalculator().markAsDirty(position);
1546
+ }
1547
+ else if (type === "remove") {
1548
+ // Remove cell and mark its dependents dirty (not the cell itself)
1549
+ getCalculator().removeCellAndMarkDependentsDirty(position);
1550
+ // Remove ephemeral cells
1551
+ removeFromEphemeralFunction(position);
1552
+ }
1553
+ }
1554
+ catch (err) {
1555
+ if (isFormula) {
1556
+ // Delete formula references
1557
+ getCalculator().removeFormula(position);
1558
+ }
1559
+ // Remove all cell dependencies
1560
+ getCalculator().deleteCell(position);
1561
+ // Remove it from being executed again
1562
+ getCalculator().unMarkAsDirty(position);
1563
+ // For circular dependencies
1564
+ const errorMap = new Map([
1565
+ [makeKey(position), [position, new FormulaError("#REF!", String(err))]],
1566
+ ]);
1567
+ publishResults(errorMap.values());
1568
+ }
1569
+ };
1570
+ // Update dependency graph
1571
+ // without making cells dirty
1572
+ const processUpdateDependencyGraphOperation = useCallback((operation) => {
1573
+ const { position, type, previousPosition, spillRange } = operation;
1574
+ const userEnteredValue = getFinalUserEnteredValue(position);
1575
+ const isFormula = isAFormula(userEnteredValue);
1576
+ const formulaValue = isFormula
1577
+ ? String(userEnteredValue)?.slice(1)
1578
+ : undefined;
1579
+ // We need to move array formulas
1580
+ if (previousPosition) {
1581
+ const shouldRemoveArrayReference = false;
1582
+ const arraySideEffects = createArraySideEffectsAndGetResults({
1583
+ position: previousPosition,
1584
+ shouldRemoveArrayReference,
1585
+ getDependents,
1586
+ });
1587
+ if (arraySideEffects.size) {
1588
+ // Immediately publish array side effects
1589
+ publishResults(arraySideEffects.values());
1590
+ }
1591
+ if (getCalculator().isArray(previousPosition)) {
1592
+ getCalculator().shiftArrayFormula(previousPosition, position);
1593
+ }
1594
+ }
1595
+ try {
1596
+ // Add/remove to DAG
1597
+ if (isFormula && formulaValue) {
1598
+ // Does both add and update formula. Updates DAG references
1599
+ getCalculator().addFormulaToGraph(formulaValue, position);
1600
+ // Seed array spill range so dependents in the spill region resolve
1601
+ // through the DAG even though we skipped evaluation.
1602
+ seedArraySpillRange(position, spillRange);
1603
+ }
1604
+ else if (type === "remove") {
1605
+ getCalculator().removeCellFromGraph(position);
1606
+ }
1607
+ else if (type === "add") {
1608
+ // If user replaces a formula with static text
1609
+ // Remove old references
1610
+ getCalculator().removePrecendentsFromGraph(position);
1611
+ }
1612
+ }
1613
+ catch (err) {
1614
+ error("Error when updateDependencyGraphFromOperation", err);
1615
+ }
1616
+ }, [getFinalUserEnteredValue]);
1617
+ /**
1618
+ * Goes through the queue of update operations and processes them.
1619
+ *
1620
+ * Optimization: Instead of using shift() which is O(n) per call (making the
1621
+ * entire loop O(n²)), we swap the queue with an empty array and iterate
1622
+ * with a for loop. This makes the entire operation O(n).
1623
+ *
1624
+ * If new operations are enqueued during processing, they go into the new
1625
+ * empty array and will be processed in the next animation frame.
1626
+ */
1627
+ const processUpdateDependencyGraphQueue = useCallback(() => {
1628
+ // Swap queue with empty array - O(1) operation
1629
+ const operations = graphOperationQueue.current;
1630
+ if (operations.length === 0)
1631
+ return;
1632
+ graphOperationQueue.current = [];
1633
+ // Process all operations - O(n) total
1634
+ for (let i = 0; i < operations.length; i++) {
1635
+ const operation = operations[i];
1636
+ if (operation) {
1637
+ processUpdateDependencyGraphOperation(operation);
1638
+ }
1639
+ }
1640
+ }, [processUpdateDependencyGraphOperation]);
1641
+ // Add to calculation queue
1642
+ // Stable reference prevents re-render of grid
1643
+ const enqueueGraphOperation = useCallbackRef(useCallback((operation) => {
1644
+ if (graphOperationQueue.current.push(operation) === 1) {
1645
+ requestAnimationFrame(() => {
1646
+ try {
1647
+ // Process operation queuu
1648
+ processUpdateDependencyGraphQueue();
1649
+ }
1650
+ catch (err) {
1651
+ console.error("[spreadsheet-state] recalculation pass aborted:", err);
1652
+ }
1653
+ });
1654
+ }
1655
+ }, [processUpdateDependencyGraphQueue]));
1656
+ useDeferredCalculationFlush({
1657
+ activeSheetId: enableLazyCalculation && !isNil(activeSheetId)
1658
+ ? activeSheetId
1659
+ : undefined,
1660
+ deferredOperationsBySheetRef,
1661
+ enqueueOperation: processSingleOperation,
1662
+ onChunkComplete: yieldToBrowser,
1663
+ onFlushComplete: startCalculation,
1664
+ });
1665
+ // Get all precendets of a cell
1666
+ const getPrecedents = useCallback((source, includeSource) => {
1667
+ return getCalculator()
1668
+ .getPrecedents(source)
1669
+ .filter(
1670
+ // Ignore source
1671
+ (node) => {
1672
+ if (isStaticNode(node)) {
1673
+ return true;
1674
+ }
1675
+ // After isStaticNode early-return, node is CellNode or
1676
+ // CellRangeNode — both have a defined position. The cast
1677
+ // bridges a TS narrowing limitation across the union.
1678
+ const pos = node.position;
1679
+ if (!includeSource &&
1680
+ isCellCoordinate(pos) &&
1681
+ isCellCoordinate(source)) {
1682
+ return !isEqualPosition(pos, source);
1683
+ }
1684
+ if (includeSource &&
1685
+ !isCellCoordinate(pos) &&
1686
+ !isCellCoordinate(source)) {
1687
+ return !isAreasEqual(pos, source);
1688
+ }
1689
+ return true;
1690
+ });
1691
+ }, []);
1692
+ // Get precedents from formula string
1693
+ // Does not check with DAG
1694
+ const getPrecedentsFromFormulaString = useCallback((value, source) => {
1695
+ const dependencies = getCalculator().dependencies(value, source);
1696
+ const nodes = [];
1697
+ for (const pos of dependencies) {
1698
+ if (isStaticReference(pos)) {
1699
+ // Named-range static reference. Build a StaticNode shape
1700
+ // — caller treats it as a non-cell precedent.
1701
+ nodes.push(new StaticNode(makeKey(pos)));
1702
+ }
1703
+ else if (isCellCoordinate(pos)) {
1704
+ nodes.push(new CellNode(makeKey(pos), pos));
1705
+ }
1706
+ else {
1707
+ nodes.push(new CellRangeNode(makeKey(pos), pos));
1708
+ }
1709
+ }
1710
+ return nodes;
1711
+ }, []);
1712
+ // Is array formula
1713
+ const isArrayFormula = useCallbackRef(useCallback((position) => {
1714
+ return (getCalculator().isArray(position) ||
1715
+ getCalculator().isInArrayRange(position));
1716
+ }, []));
1717
+ // Get all dependents of a cell. Returns a mixed list — narrow with
1718
+ // the `isCellNode`/`isStaticNode` helpers at call sites (NOT
1719
+ // `instanceof`, which breaks across bundler module instances).
1720
+ const getDependents = useCallback((source, includeSource) => {
1721
+ return getCalculator()
1722
+ .getDependents(source)
1723
+ .filter(
1724
+ // Ignore source
1725
+ (node) => {
1726
+ if (isStaticNode(node)) {
1727
+ return true;
1728
+ }
1729
+ // Array formulas
1730
+ if (isArrayFormula(node.position)) {
1731
+ return true;
1732
+ }
1733
+ // For cell range
1734
+ if (!includeSource && isCellRangeNode(node)) {
1735
+ return !isAreasEqual(node.position, source);
1736
+ }
1737
+ if (!includeSource &&
1738
+ isCellCoordinate(source) &&
1739
+ isCellNode(node)) {
1740
+ return (node.position.rowIndex !== source.rowIndex ||
1741
+ node.position.columnIndex !== source.columnIndex);
1742
+ }
1743
+ return true;
1744
+ });
1745
+ }, [isArrayFormula]);
1746
+ /**
1747
+ * Process the calculation operation queue.
1748
+ *
1749
+ * Optimization: Instead of using shift() which is O(n) per call (making the
1750
+ * entire loop O(n²)), we swap the queue with an empty array and iterate
1751
+ * with a for loop. This makes the entire operation O(n).
1752
+ *
1753
+ * If new operations are enqueued during processing (via processSingleOperation),
1754
+ * they go into the new empty array and will trigger a new requestAnimationFrame
1755
+ * via the enqueue logic.
1756
+ */
1757
+ const processOperationQueue = useCallback(() => {
1758
+ // Swap queue with empty array - O(1) operation
1759
+ const operations = operationQueue.current;
1760
+ if (operations.length === 0)
1761
+ return;
1762
+ operationQueue.current = [];
1763
+ // Process all operations - O(n) total
1764
+ for (let i = 0; i < operations.length; i++) {
1765
+ const operation = operations[i];
1766
+ if (operation) {
1767
+ const clearedArrayRange = operation.type !== "dirty" && isArrayFormula(operation.position)
1768
+ ? getCalculator().getArrayRange(operation.position)
1769
+ : undefined;
1770
+ if (operation.type === "remove") {
1771
+ // Only publish undefined result for formulas or array formulas
1772
+ // Static cells don't need calculation results
1773
+ const userEnteredValue = getFinalUserEnteredValue(operation.position);
1774
+ if (isAFormula(userEnteredValue) ||
1775
+ isArrayFormula(operation.position)) {
1776
+ initialArrayResults.current.set(makeKey(operation.position), [
1777
+ operation.position,
1778
+ undefined,
1779
+ ]);
1780
+ }
1781
+ }
1782
+ if (operation.type !== "dirty" && isArrayFormula(operation.position)) {
1783
+ const parentCandidates = new Map();
1784
+ for (const [key, value] of createArraySideEffectsAndGetResults({
1785
+ position: operation.position,
1786
+ getDependents,
1787
+ })) {
1788
+ initialArrayResults.current.set(key, value);
1789
+ const [cellPosition] = value;
1790
+ const parent = getCalculator().getClosestArrayParentCell(cellPosition);
1791
+ if (parent &&
1792
+ !isEqualPosition(parent, cellPosition) &&
1793
+ !isEqualPosition(parent, operation.position)) {
1794
+ parentCandidates.set(makeKey(parent), parent);
1795
+ }
1796
+ }
1797
+ for (const parent of parentCandidates.values()) {
1798
+ getCalculator().markAsDirty(parent);
1799
+ }
1800
+ if (clearedArrayRange) {
1801
+ for (const [key, range] of getCalculator().arrayRangeMap) {
1802
+ if (!rangesOverlap(range, clearedArrayRange)) {
1803
+ continue;
1804
+ }
1805
+ const anchor = getCalculator().arrayReferenceMap.get(key);
1806
+ if (anchor && !isEqualPosition(anchor, operation.position)) {
1807
+ getCalculator().markAsDirty(anchor);
1808
+ }
1809
+ }
1810
+ }
1811
+ }
1812
+ const arrayParent = getCalculator().getClosestArrayParentCell(operation.position);
1813
+ if (arrayParent && !isEqualPosition(arrayParent, operation.position)) {
1814
+ for (const [key, value] of createArraySideEffectsAndGetResults({
1815
+ position: arrayParent,
1816
+ shouldRemoveArrayReference: false,
1817
+ getDependents,
1818
+ })) {
1819
+ initialArrayResults.current.set(key, value);
1820
+ }
1821
+ }
1822
+ // Backend driven
1823
+ // When a backend sets a effective value of a formula
1824
+ // Only update the dependent cells.
1825
+ // This can be removed if the agent can do cell dependency computation
1826
+ // And update the changed cells in the back-end
1827
+ if (operation.source === "backend") {
1828
+ const graph = getCalculator().graph;
1829
+ const hasRanges = graph.ranges.size > 0;
1830
+ let shouldResolveDependents = hasRanges;
1831
+ if (!hasRanges) {
1832
+ if (graph.hasNode(operation.position)) {
1833
+ const node = graph.getNode(operation.position);
1834
+ shouldResolveDependents = node.dependentKeys.size > 0;
1835
+ }
1836
+ else {
1837
+ shouldResolveDependents = false;
1838
+ }
1839
+ }
1840
+ if (!shouldResolveDependents) {
1841
+ continue;
1842
+ }
1843
+ const dependents = getDependents(operation.position);
1844
+ dependents.forEach((dependent) => {
1845
+ if (isCellNode(dependent)) {
1846
+ // CellNode.position is always defined — assertion to
1847
+ // bridge a TS narrowing limitation across the union.
1848
+ processSingleOperation({
1849
+ type: "dirty",
1850
+ position: dependent.position,
1851
+ });
1852
+ }
1853
+ });
1854
+ }
1855
+ else {
1856
+ // Process operation
1857
+ processSingleOperation(operation);
1858
+ }
1859
+ }
1860
+ }
1861
+ }, [
1862
+ createArraySideEffectsAndGetResults,
1863
+ getDependents,
1864
+ processSingleOperation,
1865
+ ]);
1866
+ // Add to calculation queue
1867
+ // Stable reference prevents re-render of grid
1868
+ const enqueueCalculation = useCallbackRef(useCallback((operation) => {
1869
+ if (operationQueue.current.push(operation) === 1) {
1870
+ // The RAF callback runs the queue processing + initial publish
1871
+ // synchronously, so a throw here escapes straight to
1872
+ // `window.onerror` (the `$exception` twin of the fire-and-forget
1873
+ // rejection guarded in `startCalculation`). Contain it the same
1874
+ // way: abort this pass, leave the queue for the next trigger.
1875
+ requestAnimationFrame(() => {
1876
+ try {
1877
+ const hasValueAffectingNonEphemeralOp = operationQueue.current.some((queued) => !ephemeralCellsRef.current.has(makeKey(queued.position)));
1878
+ if (hasValueAffectingNonEphemeralOp) {
1879
+ // Add ephemeral functions
1880
+ operationQueue.current.push(...getEphemeralCells());
1881
+ }
1882
+ // Process operation queuu
1883
+ processOperationQueue();
1884
+ const initialResults = initialArrayResults.current;
1885
+ const shouldPublishInitialResults = initialResults.size > 0;
1886
+ if (shouldPublishInitialResults) {
1887
+ initialArrayResults.current = new Map();
1888
+ publishResults(initialResults.values());
1889
+ requestAnimationFrame(() => {
1890
+ scheduleStartCalculation();
1891
+ });
1892
+ return;
1893
+ }
1894
+ // Start calculation
1895
+ scheduleStartCalculation(initialResults);
1896
+ }
1897
+ catch (err) {
1898
+ console.error("[spreadsheet-state] recalculation pass aborted:", err);
1899
+ }
1900
+ });
1901
+ }
1902
+ }, [processOperationQueue, processSingleOperation, scheduleStartCalculation]));
1903
+ // Delete all sheet references
1904
+ const deleteSheetReferences = useCallback((sheetId) => {
1905
+ return getCalculator().deleteSheet(sheetId);
1906
+ }, []);
1907
+ const enqueueStructureChange = useCallbackRef(useCallback((change) => {
1908
+ const range = getInvalidationRangeFromStructureChange(change);
1909
+ if (!range) {
1910
+ return;
1911
+ }
1912
+ getCalculator().invalidateCacheForRange(range.sheetId, range.startRowIndex, range.startColumnIndex, range.endRowIndex, range.endColumnIndex);
1913
+ }, []));
1914
+ const clearRangeCache = useCallbackRef(useCallback(() => {
1915
+ getCalculator().clearRangeCache();
1916
+ }, []));
1917
+ // Used for formula preview
1918
+ const onRequestCalculate = useCallback(async (value, sheetId, rowIndex, columnIndex, options) => {
1919
+ const isArray = options?.isArray ?? false;
1920
+ const disablePreview = options?.disablePreview ?? false;
1921
+ const skipOnDemand = options?.skipOnDemand ?? true;
1922
+ if (skipOnDemand && onDemandPattern) {
1923
+ onDemandPattern.lastIndex = 0;
1924
+ }
1925
+ if (skipOnDemand && isAFormula(value) && onDemandPattern?.test(value)) {
1926
+ return undefined;
1927
+ }
1928
+ const previousOverrides = overridesRef.current;
1929
+ overridesRef.current = options?.overrides ?? null;
1930
+ const position = { sheetId, rowIndex, columnIndex };
1931
+ try {
1932
+ if (iterativeCalculationRef.current?.enabled &&
1933
+ isAFormula(value) &&
1934
+ !disablePreview) {
1935
+ const precedents = getPrecedentsFromFormulaString(value.slice(1), position);
1936
+ const isCircular = precedents.some((node) => {
1937
+ const range = node.position;
1938
+ // Named-range static nodes have no grid position — they
1939
+ // can't be a circular self-reference.
1940
+ if (!range)
1941
+ return false;
1942
+ if ("rowIndex" in range) {
1943
+ return (range.sheetId === sheetId &&
1944
+ range.rowIndex === rowIndex &&
1945
+ range.columnIndex === columnIndex);
1946
+ }
1947
+ return (range.sheetId === sheetId &&
1948
+ rowIndex >= range.startRowIndex &&
1949
+ rowIndex <= range.endRowIndex &&
1950
+ columnIndex >= range.startColumnIndex &&
1951
+ columnIndex <= range.endColumnIndex);
1952
+ });
1953
+ if (isCircular) {
1954
+ return undefined;
1955
+ }
1956
+ }
1957
+ const isPreview = true;
1958
+ return await getCalculator().calculate(value.slice(1), position, isArray, isPreview, disablePreview);
1959
+ }
1960
+ catch (err) {
1961
+ // Formula errors (#NAME?, #REF!, …) are values, not
1962
+ // exceptions — the recalc loop stores them as cell values,
1963
+ // and fire-and-forget preview callers (charts, status bar,
1964
+ // filter-by-condition) have no rejection handler, so a throw
1965
+ // here escapes as an unhandled promise rejection.
1966
+ if (err instanceof FormulaError) {
1967
+ return err;
1968
+ }
1969
+ throw err;
1970
+ }
1971
+ finally {
1972
+ overridesRef.current = previousOverrides ?? null;
1973
+ }
1974
+ }, []);
1975
+ // Get all nodes from calculator
1976
+ const getGraphNodes = useCallback(() => {
1977
+ return getCalculator().graph.nodes;
1978
+ }, []);
1979
+ // Get sheet-bound nodes from the per-sheet bucket. Cheaper than
1980
+ // `getGraphNodes()` for callers that only care about a single sheet —
1981
+ // structural ops use this for the formula-cell sweep so cost scales with
1982
+ // `nodes_in_sheet` rather than `nodes_in_workbook`.
1983
+ const getGraphNodesInSheet = useCallback((sheetId) => {
1984
+ return getCalculator().graph.getNodesInSheet(sheetId);
1985
+ }, []);
1986
+ // Add a static reference
1987
+ const addStaticReference = useCallback((source, sourcePosition) => {
1988
+ return getCalculator().addStaticReference(source, sourcePosition);
1989
+ }, []);
1990
+ const addFormulaToGraph = useCallbackRef(useCallback((formulaValue, position) => {
1991
+ if (!formulaValue) {
1992
+ return;
1993
+ }
1994
+ getCalculator().addFormulaToGraph(formulaValue, position);
1995
+ }, []));
1996
+ // Remove static reference
1997
+ const removeStaticReference = useCallback((source) => {
1998
+ return getCalculator().removeStaticReference(source);
1999
+ }, []);
2000
+ // Reset calculator
2001
+ const onResetCalculator = useCallbackRef(useCallback(() => {
2002
+ isFullRecalcRef.current = true;
2003
+ // Reset graph
2004
+ getCalculator().graph.reset();
2005
+ getCalculator().arrayRangeMap.clear();
2006
+ getCalculator().arrayRangeMap.clear();
2007
+ }, []));
2008
+ /**
2009
+ * Get dependency graph
2010
+ */
2011
+ const getDependencyGraph = useCallbackRef(useCallback(() => {
2012
+ return getCalculator().graph.toJSON();
2013
+ }, []));
2014
+ // Update dependency graph
2015
+ const updateDependencyGraph = useCallbackRef(useCallback((nodes) => {
2016
+ // Reset graph
2017
+ getCalculator().graph.reset();
2018
+ // Update graph
2019
+ getCalculator().graph.fromJSON(JSON.parse(nodes));
2020
+ }, []));
2021
+ const noopCalculationApi = useMemo(() => ({
2022
+ enqueueCalculation: () => { },
2023
+ enqueueGraphOperation: () => { },
2024
+ getPrecedents: () => [],
2025
+ getPrecedentsFromFormulaString: () => [],
2026
+ getDependents: () => [],
2027
+ enqueueStructureChange: () => { },
2028
+ clearRangeCache: () => { },
2029
+ deleteSheetReferences: () => { },
2030
+ onRequestCalculate: async () => undefined,
2031
+ getGraphNodes: () => new Map(),
2032
+ getGraphNodesInSheet: () => undefined,
2033
+ addStaticReference: () => { },
2034
+ addFormulaToGraph: () => { },
2035
+ removeStaticReference: () => { },
2036
+ onResetCalculator: () => { },
2037
+ getDependencyGraph: () => "[]",
2038
+ updateDependencyGraph: () => { },
2039
+ isArrayFormula: () => false,
2040
+ applyNamedRanges: (_list) => { },
2041
+ }), []);
2042
+ const api = {
2043
+ enqueueCalculation,
2044
+ enqueueGraphOperation,
2045
+ getPrecedents,
2046
+ getPrecedentsFromFormulaString,
2047
+ getDependents,
2048
+ enqueueStructureChange,
2049
+ clearRangeCache,
2050
+ deleteSheetReferences,
2051
+ onRequestCalculate,
2052
+ getGraphNodes,
2053
+ getGraphNodesInSheet,
2054
+ addStaticReference,
2055
+ addFormulaToGraph,
2056
+ removeStaticReference,
2057
+ onResetCalculator,
2058
+ getDependencyGraph,
2059
+ updateDependencyGraph,
2060
+ isArrayFormula,
2061
+ // Phase 9 — exposed so `useCalculationInitialize` can guarantee
2062
+ // named ranges are registered BEFORE cell formulas are parsed
2063
+ // (otherwise cells using a named range would form no DAG edge
2064
+ // to its static node — Excel registers names workbook-wide
2065
+ // before any cell evaluates).
2066
+ applyNamedRanges,
2067
+ };
2068
+ return enabled ? api : noopCalculationApi;
2069
+ };