@sheetxl/sdk 0.8.0-beta.1 → 0.8.0-beta.2

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 (353) hide show
  1. package/THIRD-PARTY-NOTICES.md +1 -1
  2. package/browser/cjs/4f5eoQQfV-V7LO2_.cjs +1 -0
  3. package/browser/cjs/BEnEDC1m546-gzWS.cjs +1 -0
  4. package/browser/cjs/CwCUa4IzGNGissLL.cjs +1 -0
  5. package/browser/cjs/{a0Z-SXs_N71CtqYb.cjs → Dg3GaW0QWwnlqetX.cjs} +1 -1
  6. package/browser/cjs/KWQPie2u7AP69web.cjs +93 -0
  7. package/browser/cjs/index.cjs +2 -2
  8. package/browser/esm/{B0HS42a7lga1k1U_.mjs → BJ9hcZAGY8Tj5_9L.mjs} +1 -1
  9. package/browser/esm/C8vpA2ZBtZf6w4nq.mjs +394 -0
  10. package/browser/esm/DDojiE2-oycJ7qGi.mjs +20 -0
  11. package/browser/esm/DEPT7zmpiMdZ-_qC.mjs +70253 -0
  12. package/browser/esm/DOvCi3lf49To36WP.mjs +8 -0
  13. package/browser/esm/{uyWBMSIxMlt8n5Z3.mjs → Dq3sc4B_HQHBrT5N.mjs} +2 -2
  14. package/browser/esm/index.mjs +871 -696
  15. package/browser/esm/{DlPMeIyxT9tG_WDk.mjs → trwZArJQQq7K9kL7.mjs} +2 -2
  16. package/licenses/dependencies.txt +204 -204
  17. package/node/esm/CGWsQOMWdnDeF4dX.mjs +8 -0
  18. package/node/esm/{Cku7XiUvw1xrRasi.mjs → CL9MI-b6D9BmtVXW.mjs} +1 -1
  19. package/node/esm/CressiwiIhxCVp1v.mjs +28 -0
  20. package/node/esm/O2cOO3xIynWUgOWe.mjs +403 -0
  21. package/node/esm/index.mjs +52356 -37345
  22. package/package.json +6 -7
  23. package/resources/locales/de/model.msg.json +45 -9
  24. package/resources/locales/en/model.msg.json +42 -9
  25. package/types/scripting-api.json +7093 -0
  26. package/types/scripting-enums.json +54 -8
  27. package/types/scripting.d.ts +7006 -1202
  28. package/types/src/anchored/AbstractAnchored.d.ts +18 -8
  29. package/types/src/anchored/AnchoredMap.d.ts +2 -0
  30. package/types/src/anchored/IAnchoredMap.d.ts +52 -4
  31. package/types/src/autoFill/AutoFill.d.ts +316 -32
  32. package/types/src/autoFill/IAutoFill.d.ts +232 -15
  33. package/types/src/border/{IBorder.d.ts → IBorders.d.ts} +41 -40
  34. package/types/src/border/index.d.ts +1 -1
  35. package/types/src/calculation/Calculation.d.ts +740 -35
  36. package/types/src/calculation/ExternalBookBindings.d.ts +118 -0
  37. package/types/src/calculation/FormulaText.d.ts +74 -0
  38. package/types/src/calculation/ICalculation.d.ts +318 -81
  39. package/types/src/calculation/INamedFormulasCollection.d.ts +5 -8
  40. package/types/src/calculation/NamedFormulaCollection.d.ts +139 -107
  41. package/types/src/calculation/NamedLambdaFunction.d.ts +28 -0
  42. package/types/src/calculation/TokenType.d.ts +9 -0
  43. package/types/src/calculation/Types.d.ts +83 -2
  44. package/types/src/calculation/_CloneBoundary.d.ts +80 -0
  45. package/types/src/calculation/compiler/ASTTypes.d.ts +58 -0
  46. package/types/src/calculation/compiler/CompilerUtils.d.ts +134 -12
  47. package/types/src/calculation/compiler/FormulaCompiler.d.ts +29 -4
  48. package/types/src/calculation/compiler/FormulaParser.d.ts +1 -2
  49. package/types/src/calculation/compiler/LiteTransform.d.ts +17 -0
  50. package/types/src/calculation/compiler/ParserUtils.d.ts +26 -1
  51. package/types/src/calculation/compiler/SRParser.d.ts +2 -1
  52. package/types/src/calculation/compiler/Types.d.ts +79 -9
  53. package/types/src/calculation/executor/CalcExecutor.d.ts +312 -33
  54. package/types/src/calculation/executor/CalcExecutorUtils.d.ts +43 -2
  55. package/types/src/calculation/executor/CircularReference.d.ts +2 -0
  56. package/types/src/calculation/formula/Formula.d.ts +58 -21
  57. package/types/src/calculation/formula/FormulaBlock.d.ts +124 -21
  58. package/types/src/calculation/formula/FormulaRecordView.d.ts +79 -0
  59. package/types/src/calculation/formula/IFormulaBlock.d.ts +261 -67
  60. package/types/src/calculation/formula/LambdaValue.d.ts +15 -16
  61. package/types/src/calculation/formula/LazyValue.d.ts +96 -0
  62. package/types/src/calculation/formula/TokenUtils.d.ts +25 -1
  63. package/types/src/calculation/formula/index.d.ts +1 -0
  64. package/types/src/calculation/functions/FunctionDeclarations.d.ts +31 -0
  65. package/types/src/calculation/functions/initializeFunctions.d.ts +15 -2
  66. package/types/src/calculation/grid/CalcGrid.d.ts +384 -158
  67. package/types/src/calculation/grid/CalcGridBackend.d.ts +450 -0
  68. package/types/src/calculation/grid/CalcGridProxy.d.ts +133 -0
  69. package/types/src/calculation/grid/CalcGridUtils.d.ts +62 -12
  70. package/types/src/calculation/grid/FormulaEntry.d.ts +129 -0
  71. package/types/src/calculation/grid/FormulaHost.d.ts +236 -0
  72. package/types/src/calculation/grid/ICalcGrid.d.ts +456 -143
  73. package/types/src/calculation/grid/_CalcRequest.d.ts +272 -0
  74. package/types/src/calculation/grid/index.d.ts +4 -0
  75. package/types/src/calculation/index.d.ts +2 -0
  76. package/types/src/calculation/spatial/ContentfulSpatialValue.d.ts +6 -2
  77. package/types/src/calculation/spatial/FormulaSpatialValue.d.ts +339 -11
  78. package/types/src/calculation/spatial/SpillEntry.d.ts +20 -5
  79. package/types/src/calculation/spatial/TouchedWindows.d.ts +86 -0
  80. package/types/src/calculation/spatial/index.d.ts +1 -0
  81. package/types/src/calculation/state/CalcInputs.d.ts +41 -0
  82. package/types/src/calculation/state/CalcNode.d.ts +141 -30
  83. package/types/src/calculation/state/CalcScope.d.ts +37 -0
  84. package/types/src/calculation/state/CalcState.d.ts +22 -1
  85. package/types/src/calculation/state/CalculationContext.d.ts +36 -2
  86. package/types/src/calculation/state/IContextContainer.d.ts +129 -27
  87. package/types/src/calculation/state/_PendingOverlayGrid.d.ts +163 -0
  88. package/types/src/calculation/state/_ReadObservedGrid.d.ts +74 -8
  89. package/types/src/calculation/state/index.d.ts +1 -0
  90. package/types/src/calculation/symbol/ExternalSheetSymbols.d.ts +80 -0
  91. package/types/src/calculation/symbol/ISymbolRegistry.d.ts +23 -0
  92. package/types/src/calculation/symbol/IndirectSymbolProvider.d.ts +16 -2
  93. package/types/src/calculation/symbol/SheetSymbolProvider.d.ts +63 -3
  94. package/types/src/calculation/symbol/SymbolRegistry.d.ts +20 -0
  95. package/types/src/calculation/symbol/index.d.ts +3 -2
  96. package/types/src/cell/ICell.d.ts +78 -23
  97. package/types/src/cell/ICellProtection.d.ts +50 -10
  98. package/types/src/cellRange/ICellRange.d.ts +329 -72
  99. package/types/src/cellRange/ICellRanges.d.ts +9 -7
  100. package/types/src/chart/Chart.d.ts +72 -2
  101. package/types/src/chart/ChartCollection.d.ts +26 -0
  102. package/types/src/chart/IChart.d.ts +162 -9
  103. package/types/src/chart/IChartCollection.d.ts +25 -0
  104. package/types/src/chart/_ChartXml.d.ts +70 -0
  105. package/types/src/chart/index.d.ts +1 -3
  106. package/types/src/collections/ArraysGrid.d.ts +1 -1
  107. package/types/src/collections/IGrid.d.ts +1 -1
  108. package/types/src/collections/ISparseGrid.d.ts +9 -0
  109. package/types/src/collections/ISpatialMap.d.ts +59 -21
  110. package/types/src/collections/ImmutableList.d.ts +28 -0
  111. package/types/src/collections/MixedTypedArrayList.d.ts +168 -108
  112. package/types/src/collections/OverlappingRangeIterator.d.ts +13 -17
  113. package/types/src/collections/RepeatingList.d.ts +7 -0
  114. package/types/src/collections/ScalarGrid.d.ts +50 -0
  115. package/types/src/collections/SparseGrid.d.ts +1 -1
  116. package/types/src/collections/SpatialMap.d.ts +13 -21
  117. package/types/src/collections/Tuple.d.ts +128 -16
  118. package/types/src/collections/_GridUtils.d.ts +19 -6
  119. package/types/src/collections/_RangeSweep.d.ts +97 -0
  120. package/types/src/collections/_SpatialUtils.d.ts +20 -2
  121. package/types/src/collections/index.d.ts +1 -0
  122. package/types/src/comment/Comment.d.ts +159 -0
  123. package/types/src/comment/CommentCollection.d.ts +40 -0
  124. package/types/src/comment/IComment.d.ts +319 -48
  125. package/types/src/comment/ICommentCollection.d.ts +90 -0
  126. package/types/src/comment/_CommentUtils.d.ts +28 -0
  127. package/types/src/comment/index.d.ts +1 -0
  128. package/types/src/condition/AnchoredConditional.d.ts +76 -17
  129. package/types/src/condition/BuiltInOperators/AbstractOperator.d.ts +8 -7
  130. package/types/src/condition/BuiltInOperators/EqualToOperator.d.ts +2 -1
  131. package/types/src/condition/BuiltInOperators/ExpressionOperator.d.ts +3 -6
  132. package/types/src/condition/BuiltInOperators/InSetOperator.d.ts +1 -1
  133. package/types/src/condition/BuiltinSelectors/BaseSelector.d.ts +7 -0
  134. package/types/src/condition/BuiltinSelectors/ListSelector.d.ts +9 -0
  135. package/types/src/condition/Condition.d.ts +16 -0
  136. package/types/src/condition/ICondition.d.ts +86 -33
  137. package/types/src/condition/_ConditionFormula.d.ts +152 -0
  138. package/types/src/condition/_ConditionUtils.d.ts +73 -10
  139. package/types/src/conditionalFormat/ConditionalFormat.d.ts +21 -10
  140. package/types/src/conditionalFormat/ConditionalFormatCollection.d.ts +19 -8
  141. package/types/src/conditionalFormat/IConditionalFormat.d.ts +5 -3
  142. package/types/src/conditionalFormat/IConditionalFormatCollection.d.ts +2 -0
  143. package/types/src/dataValidation/DataValidation.d.ts +50 -3
  144. package/types/src/dataValidation/DataValidationCollection.d.ts +20 -9
  145. package/types/src/dataValidation/IDataValidation.d.ts +119 -30
  146. package/types/src/dataValidation/IDataValidationCollection.d.ts +10 -2
  147. package/types/src/date/DateUtils.d.ts +20 -0
  148. package/types/src/date/_DateUtils.d.ts +91 -7
  149. package/types/src/externalBook/ExternalBookCollection.d.ts +145 -12
  150. package/types/src/externalBook/ExternalBookName.d.ts +96 -0
  151. package/types/src/externalBook/IExternalBook.d.ts +170 -18
  152. package/types/src/externalBook/IExternalBookCollection.d.ts +79 -7
  153. package/types/src/externalBook/index.d.ts +1 -0
  154. package/types/src/fill/IStroke.d.ts +1 -1
  155. package/types/src/filter/IFilter.d.ts +29 -4
  156. package/types/src/font/IFont.d.ts +17 -0
  157. package/types/src/history/IHistory.d.ts +3 -2
  158. package/types/src/i18n/LanguagePack.d.ts +12 -4
  159. package/types/src/index.d.ts +3 -0
  160. package/types/src/io/AbstractBackingStore.d.ts +24 -1
  161. package/types/src/io/ArrayBackingStore.d.ts +1 -1
  162. package/types/src/io/EmbeddedPart.d.ts +20 -0
  163. package/types/src/io/IEmbeddedPart.d.ts +63 -0
  164. package/types/src/io/IWorkbookIO.d.ts +185 -18
  165. package/types/src/io/WorkbookIO.d.ts +9 -0
  166. package/types/src/io/WorkbookOrigin.d.ts +20 -11
  167. package/types/src/io/WorkbookOriginProvider.d.ts +46 -0
  168. package/types/src/io/_XmlFragment.d.ts +49 -0
  169. package/types/src/io/index.d.ts +1 -0
  170. package/types/src/lib/file/file.browser.d.ts +19 -5
  171. package/types/src/lib/file/file.node.d.ts +5 -0
  172. package/types/src/lib/utils/_Utils.d.ts +11 -0
  173. package/types/src/lib/utils/utils.browser.d.ts +9 -3
  174. package/types/src/license/license-key.d.ts +27 -0
  175. package/types/src/listener/IListener.d.ts +12 -7
  176. package/types/src/listener/ListenerEmitter.d.ts +46 -5
  177. package/types/src/model/AbstractModel.d.ts +14 -5
  178. package/types/src/movable/Control.d.ts +57 -0
  179. package/types/src/movable/IControl.d.ts +84 -0
  180. package/types/src/movable/IMovable.d.ts +23 -1
  181. package/types/src/movable/IMovableCollection.d.ts +2 -0
  182. package/types/src/movable/Movable.d.ts +4 -6
  183. package/types/src/movable/MovableCollection.d.ts +7 -7
  184. package/types/src/movable/index.d.ts +4 -0
  185. package/types/src/named/AbstractNamed.d.ts +1 -1
  186. package/types/src/named/INamed.d.ts +4 -1
  187. package/types/src/named/INamedCollection.d.ts +26 -0
  188. package/types/src/named/NamedCollection.d.ts +16 -15
  189. package/types/src/numFmt/BuiltInFormats.d.ts +15 -7
  190. package/types/src/numFmt/IFormatEngine.d.ts +2 -0
  191. package/types/src/numFmt/NumfmtFormatEngine.d.ts +2 -0
  192. package/types/src/person/IPerson.d.ts +99 -0
  193. package/types/src/person/IPersonCollection.d.ts +51 -0
  194. package/types/src/person/Person.d.ts +32 -0
  195. package/types/src/person/PersonCollection.d.ts +49 -0
  196. package/types/src/person/index.d.ts +3 -0
  197. package/types/src/picture/IPicture.d.ts +2 -0
  198. package/types/src/picture/Picture.d.ts +2 -0
  199. package/types/src/pivot/IPivotTable.d.ts +107 -0
  200. package/types/src/pivot/IPivotTableCollection.d.ts +25 -0
  201. package/types/src/pivot/PivotTable.d.ts +57 -0
  202. package/types/src/pivot/PivotTableCollection.d.ts +25 -0
  203. package/types/src/pivot/index.d.ts +6 -0
  204. package/types/src/primitives/CompositeRangeStats.d.ts +2 -0
  205. package/types/src/primitives/Criteria.d.ts +1 -1
  206. package/types/src/primitives/LambdaBrand.d.ts +21 -0
  207. package/types/src/primitives/PrimitiveUtils.d.ts +56 -19
  208. package/types/src/primitives/Range.d.ts +102 -24
  209. package/types/src/primitives/RangeStats.d.ts +24 -1
  210. package/types/src/primitives/ReferenceRange.d.ts +42 -0
  211. package/types/src/primitives/Runtime.d.ts +15 -2
  212. package/types/src/primitives/stats/FrequencyStats.d.ts +9 -0
  213. package/types/src/primitives/stats/LookupIndex.d.ts +46 -0
  214. package/types/src/primitives/stats/SortedNumbers.d.ts +2 -0
  215. package/types/src/primitives/stats/index.d.ts +1 -0
  216. package/types/src/print/IPrint.d.ts +0 -22
  217. package/types/src/protectedRange/IProtectedRange.d.ts +4 -0
  218. package/types/src/protectedRange/IProtectedRangeCollection.d.ts +2 -0
  219. package/types/src/protectedRange/ProtectedRange.d.ts +1 -4
  220. package/types/src/protectedRange/ProtectedRangeCollection.d.ts +19 -8
  221. package/types/src/protection/DefaultProtection.d.ts +12 -1
  222. package/types/src/protection/IProtection.d.ts +36 -2
  223. package/types/src/reference/ReferenceUtils.d.ts +80 -0
  224. package/types/src/reference/index.d.ts +2 -0
  225. package/types/src/resource/IResource.d.ts +21 -1
  226. package/types/src/resource/IResourceCollection.d.ts +9 -1
  227. package/types/src/resource/ResourceCollection.d.ts +6 -6
  228. package/types/src/scripting/FunctionCollection.d.ts +41 -11
  229. package/types/src/scripting/IFunctionCollection.d.ts +41 -0
  230. package/types/src/scripting/IModule.d.ts +25 -0
  231. package/types/src/scripting/IModuleCollection.d.ts +17 -0
  232. package/types/src/scripting/IScript.d.ts +18 -0
  233. package/types/src/scripting/Module.d.ts +34 -6
  234. package/types/src/scripting/ModuleCollection.d.ts +17 -12
  235. package/types/src/scripting/Runtime.d.ts +15 -0
  236. package/types/src/scripting/Scripts.d.ts +2 -0
  237. package/types/src/scripting/TypedFunction.d.ts +151 -18
  238. package/types/src/scripting/_FunctionIndex.d.ts +5 -0
  239. package/types/src/scripting/_ModuleUtils.d.ts +11 -1
  240. package/types/src/scripting/_ScriptUtils.d.ts +3 -0
  241. package/types/src/scripting/declarations.browser.d.ts +10 -0
  242. package/types/src/scripting/declarations.d.ts +49 -0
  243. package/types/src/scripting/declarations.node.d.ts +9 -0
  244. package/types/src/scripting/index.d.ts +3 -0
  245. package/types/src/selection/IRangeSelection.d.ts +9 -4
  246. package/types/src/selection/RangeSelection.d.ts +2 -0
  247. package/types/src/shape/IShape.d.ts +41 -3
  248. package/types/src/shape/Shape.d.ts +10 -0
  249. package/types/src/shape/_ShapeXml.d.ts +28 -0
  250. package/types/src/sheet/CellRegion.d.ts +6 -0
  251. package/types/src/sheet/ICellContainerOptions.d.ts +50 -0
  252. package/types/src/sheet/ISheet.d.ts +224 -41
  253. package/types/src/sheet/ISheetCollection.d.ts +2 -5
  254. package/types/src/sheet/NamedCellRange.d.ts +16 -7
  255. package/types/src/sheet/Sheet.d.ts +749 -114
  256. package/types/src/sheet/SheetCell.d.ts +81 -21
  257. package/types/src/sheet/SheetCollection.d.ts +19 -8
  258. package/types/src/sheet/SheetRange.d.ts +62 -14
  259. package/types/src/sheet/SheetRanges.d.ts +4 -6
  260. package/types/src/sheet/_CellBuffer.d.ts +214 -0
  261. package/types/src/sheet/_InvalidSheetRange.d.ts +5 -5
  262. package/types/src/sheet/_ListenerAnchor.d.ts +104 -0
  263. package/types/src/sheet/_RangeStateSweep.d.ts +16 -0
  264. package/types/src/sheet/_ScalarListFactory.d.ts +61 -0
  265. package/types/src/sheet/_SheetAutoFillUtils.d.ts +74 -0
  266. package/types/src/sheet/_SheetAutoFitUtils.d.ts +2 -2
  267. package/types/src/sheet/_SheetEvents.d.ts +43 -0
  268. package/types/src/sheet/_SheetFilterUtils.d.ts +32 -1
  269. package/types/src/sheet/_SheetIntents.d.ts +250 -0
  270. package/types/src/sheet/_SheetMutations.d.ts +179 -59
  271. package/types/src/sheet/_SheetStateReader.d.ts +16 -10
  272. package/types/src/sheet/_SheetStateTypes.d.ts +57 -73
  273. package/types/src/sheet/_SheetUtils.d.ts +2 -18
  274. package/types/src/sheet/_WatchAnchor.d.ts +93 -0
  275. package/types/src/sheet/spatial/HeldFormulaEntry.d.ts +36 -0
  276. package/types/src/sheet/spatial/index.d.ts +1 -0
  277. package/types/src/sheet/style/SheetCellStyle.d.ts +91 -64
  278. package/types/src/sheet/style/SheetDirectStyle.d.ts +16 -5
  279. package/types/src/sheet/style/_Resolvers.d.ts +5 -3
  280. package/types/src/sheet/style/_StyleUtils.d.ts +37 -7
  281. package/types/src/sheetHeader/ISheetHeader.d.ts +2 -0
  282. package/types/src/sheetHeader/SheetHeader.d.ts +14 -0
  283. package/types/src/sheetProtection/ISheetProtection.d.ts +41 -7
  284. package/types/src/sheetProtection/SheetProtection.d.ts +12 -0
  285. package/types/src/sheetView/ISheetView.d.ts +45 -1
  286. package/types/src/sheetView/SheetView.d.ts +11 -0
  287. package/types/src/slicer/ISlicer.d.ts +2 -0
  288. package/types/src/slicer/Slicer.d.ts +2 -0
  289. package/types/src/sort/ISort.d.ts +2 -0
  290. package/types/src/string/IStringCollection.d.ts +5 -0
  291. package/types/src/string/StringCollection.d.ts +6 -6
  292. package/types/src/style/INamedStyleCollection.d.ts +72 -0
  293. package/types/src/style/IStyle.d.ts +30 -10
  294. package/types/src/style/IStyleCollection.d.ts +63 -42
  295. package/types/src/style/ITableStyleCollection.d.ts +89 -0
  296. package/types/src/style/NamedStyleCollection.d.ts +39 -0
  297. package/types/src/style/StyleCollection.d.ts +41 -5
  298. package/types/src/style/TableStyleCollection.d.ts +49 -0
  299. package/types/src/style/_BuiltInStyleDefs.d.ts +3 -3
  300. package/types/src/style/index.d.ts +4 -0
  301. package/types/src/table/AnchoredTable.d.ts +644 -68
  302. package/types/src/table/AutoTable.d.ts +5 -5
  303. package/types/src/table/ITable.d.ts +228 -30
  304. package/types/src/table/ITableCollection.d.ts +2 -0
  305. package/types/src/table/TableCollection.d.ts +19 -8
  306. package/types/src/table/_FilterField.d.ts +7 -5
  307. package/types/src/table/_NamedTable.d.ts +17 -1
  308. package/types/src/table/_NamedTableSource.d.ts +1 -0
  309. package/types/src/table/_SortField.d.ts +2 -0
  310. package/types/src/table/_TableColumn.d.ts +13 -2
  311. package/types/src/table/_TableMessages.d.ts +1 -0
  312. package/types/src/table/_TableUtils.d.ts +40 -0
  313. package/types/src/text/Bullet.d.ts +4 -0
  314. package/types/src/text/ITextFrame.d.ts +25 -1
  315. package/types/src/text/TextBoxAlignment.d.ts +15 -6
  316. package/types/src/text/TextFrame.d.ts +4 -0
  317. package/types/src/text/TextLine.d.ts +4 -0
  318. package/types/src/text/TextParagraph.d.ts +4 -0
  319. package/types/src/text/TextRun.d.ts +9 -0
  320. package/types/src/text/TextStacked.d.ts +83 -0
  321. package/types/src/text/index.d.ts +1 -0
  322. package/types/src/theme/ITheme.d.ts +2 -0
  323. package/types/src/theme/IThemeCollection.d.ts +2 -0
  324. package/types/src/theme/ThemeCollection.d.ts +8 -7
  325. package/types/src/transaction/ITransaction.d.ts +238 -36
  326. package/types/src/transaction/Transaction.d.ts +99 -11
  327. package/types/src/type/AbstractCollection.d.ts +101 -0
  328. package/types/src/type/ICollection.d.ts +117 -0
  329. package/types/src/type/ITypes.d.ts +9 -7
  330. package/types/src/type/index.d.ts +1 -0
  331. package/types/src/utils/_CSSUtils.d.ts +3 -3
  332. package/types/src/workbook/IWorkbook.d.ts +171 -40
  333. package/types/src/workbook/Workbook.d.ts +103 -7
  334. package/types/src/workbook/_WorkbookIntents.d.ts +36 -0
  335. package/types/src/workbookProtection/IWorkbookProtection.d.ts +7 -0
  336. package/types/src/workbookProtection/WorkbookProtection.d.ts +3 -0
  337. package/types/src/workbookView/IWorkbookView.d.ts +12 -0
  338. package/types/src/workbookView/WorkbookView.d.ts +5 -0
  339. package/browser/cjs/BatsV2UUraVDCRXm.cjs +0 -57
  340. package/browser/cjs/CUz53T65cRGQRgvv.cjs +0 -33
  341. package/browser/cjs/DU0kYUtdFa3jK-im.cjs +0 -1
  342. package/browser/cjs/Dv4yIPLV98M5zLHa.cjs +0 -1
  343. package/browser/esm/6JKSOvc5czaQB2Bj.mjs +0 -109
  344. package/browser/esm/BtuJ9AGzeURtAsGo.mjs +0 -51241
  345. package/browser/esm/DGU6sM25u0EWCKl1.mjs +0 -824
  346. package/browser/esm/f2G3QRgEbvFJcoa2.mjs +0 -4436
  347. package/node/esm/-pxdn3M3tc6PLHs7.mjs +0 -114
  348. package/node/esm/0n5bslM9jhO1JnI2.mjs +0 -843
  349. package/types/src/cellRange/_GraphNode.d.ts +0 -38
  350. package/types/src/dataValidation/_Utils.d.ts +0 -10
  351. package/types/src/sheet/listener/RangesListener.d.ts +0 -32
  352. package/types/src/sheet/listener/RangesListenerEntry.d.ts +0 -19
  353. package/types/src/sheet/listener/index.d.ts +0 -3
@@ -1,25 +1,59 @@
1
1
  import { IRange, IFormulaContext, IRuntime, Scalar } from '@sheetxl/primitives';
2
+ import { IListener } from '../listener';
2
3
  import { FunctionProvider } from '@sheetxl/scripting';
3
4
  import { AbstractModel, IModel } from '../model';
5
+ import { ITransaction } from '../transaction';
4
6
  import { IStringCollection } from '../string';
5
7
  import { IFunctionCollection } from '../scripting';
6
8
  import { ISpatialMap, ISpatialMap3D } from '../collections';
7
9
  import { INamed, INamedCollection } from '../named';
8
10
  import { ICellRange, ICellRanges } from '../cellRange';
9
- import { _NamedGraphNode } from '../cellRange/_GraphNode';
10
- import { FormulaBlockResolvers } from './formula';
11
+ import { NamedNodeInfo } from './Types';
12
+ import { ITable } from '../table';
13
+ import { IExternalBook, IExternalBookCollection } from '../externalBook';
14
+ import { ExternalBookCollection } from '../externalBook/ExternalBookCollection';
15
+ import { ExternalBookBindings } from './ExternalBookBindings';
16
+ import { FormulaBlockResolvers, FormulaImager } from './formula';
11
17
  import { IFormulaCompiler } from './compiler';
12
18
  import { CalculationContext, IContextContainer, CalcNode } from './state';
13
19
  import { FormulaSpatialValue, PrecedentSpatialValue } from './spatial';
14
- import { CalcGrid, ICalcGrid } from './grid';
20
+ import { CalcGridBackend, CalcGrid, FormulaHost, ICalcGrid } from './grid';
21
+ import { CalcRequest, CalcResponse, CalcGridSpec, TableSymbols, NameSymbols } from './grid/_CalcRequest';
15
22
  import { CalcExecutor } from './executor';
23
+ import { IndirectSymbolProvider, ISymbolRegistry } from './symbol';
16
24
  import { ICalculation } from './ICalculation';
17
25
  import { NamedFormulaCollection } from './NamedFormulaCollection';
18
26
  import { INamedFormulasCollection } from './INamedFormulasCollection';
27
+ /**
28
+ * What a structured reference resolves against: a live table, or a snapshot of one taken before it
29
+ * was removed ({@link snapshotTableExtent}).
30
+ */
31
+ interface TableExtent {
32
+ getRange(): {
33
+ getCoords(): IRange.Coords;
34
+ };
35
+ getDataRange(): {
36
+ getCoords(): IRange.Coords;
37
+ };
38
+ getHeaderRowRange(): {
39
+ getCoords(): IRange.Coords;
40
+ };
41
+ getTotalRowRange(): {
42
+ getCoords(): IRange.Coords;
43
+ };
44
+ isShowHeaders(): boolean;
45
+ isShowTotals(): boolean;
46
+ getColumnById(id: string): {
47
+ getIndex(): number;
48
+ } | null;
49
+ getSheet(): {
50
+ getId(): string;
51
+ } | null | undefined;
52
+ }
19
53
  /**
20
54
  * Implementation for {@link ICalculation}.
21
55
  */
22
- export declare class Calculation extends AbstractModel<State, ICalculation.JSON, CommitView, ICalculation.IListeners> implements ICalculation {
56
+ export declare class Calculation extends AbstractModel<State, ICalculation.JSON, ICalculation.IListeners> implements ICalculation {
23
57
  protected _container: IContextContainer;
24
58
  protected _context: CalculationContext & IFormulaContext;
25
59
  protected _status: ICalculation.Status;
@@ -27,11 +61,15 @@ export declare class Calculation extends AbstractModel<State, ICalculation.JSON,
27
61
  protected _runtime: IRuntime;
28
62
  protected _functions: IFunctionCollection;
29
63
  protected _namedFormulas: NamedFormulaCollection;
64
+ protected _externalBooks: ExternalBookCollection;
65
+ /** The cache as grids and the cached names as virtual grids — see {@link ExternalBookBindings}. */
66
+ protected _externalBindings: ExternalBookBindings | null;
30
67
  /** `json.names` held from construction until {@link hydrateNames} — see it for why. */
31
68
  protected _pendingNames: INamed.JSON[] | null;
32
69
  protected _compiler: IFormulaCompiler;
33
70
  protected _compilerEditing: IFormulaCompiler;
34
71
  protected _compilerEditingSig: string;
72
+ protected _compilerEditingStorage: IFormulaCompiler | null;
35
73
  protected _compilerModule: typeof import('./compiler/FormulaCompiler');
36
74
  protected _getActiveCell: () => IRange.CellCoords | null;
37
75
  protected _getRange: (address: ICellRange.Address, options?: ICellRange.GetRangeOptions) => ICellRange;
@@ -44,17 +82,54 @@ export declare class Calculation extends AbstractModel<State, ICalculation.JSON,
44
82
  protected _epochSeenPrecedents: ISpatialMap3D<PrecedentSpatialValue> | null;
45
83
  protected _epochSeenDynamics: Map<FormulaSpatialValue, ISpatialMap.Entry<PrecedentSpatialValue>[]> | null;
46
84
  protected _volatiles: Set<CalcNode>;
85
+ /** The current handle of every formula host's grid, by grid id. */
86
+ protected _formulaHosts: Map<string, FormulaHost>;
47
87
  protected _calculatedCommitId: string | null;
88
+ protected _calculatedEngineId: string | null;
89
+ protected _modelStore: ITransaction.IStore | null;
90
+ /** The model-side grids, by grid id (DESIGN-CALC-SERVICE §13.23): what a copy lands on, what a start seeds from. */
91
+ protected readonly _fronts: Map<string, CalcGrid>;
92
+ /** What each model grid is, for the `create` a start sends for it (its size is read then). */
93
+ protected readonly _gridSpecs: Map<string, Omit<CalcGridSpec, 'name' | 'entireCoords'>>;
94
+ /** The engine holds grids: from a start's boot until a stop. */
95
+ protected _engineUp: boolean;
96
+ protected _modelStoreRemoveListener: IListener.Remove | null;
97
+ protected _mirrorRemoveListener: IListener.Remove | null;
98
+ _modelMirrorId: string | null;
99
+ protected _engineIds: Map<string, string>;
100
+ protected _landingOf: Map<string, string>;
101
+ protected _mirroredId: string | null;
102
+ protected _lastRevert: {
103
+ commitId: string;
104
+ regions: Map<string, IRange.Coords[]>;
105
+ } | null;
106
+ protected _outstanding: Set<Promise<ICalcGrid.Results>> | null;
48
107
  protected _pendingActions: (() => Promise<unknown>)[] | null;
49
108
  protected _pendingPriority: (() => Promise<unknown>)[] | null;
50
109
  protected _draining: boolean;
110
+ protected _drainDepth: number;
51
111
  protected _drainScheduled: boolean;
52
112
  protected _calcOwed: boolean;
113
+ protected _calcOwedBy: string | null;
114
+ protected _channel: HeldRequest[] | null;
115
+ protected _bootPending: Promise<void> | null;
116
+ /** Passes running now: see {@link _calculateNow}. */
117
+ protected _passesInFlight: number;
118
+ /** The calculation state last announced (`onCalculationStateChange`). */
119
+ protected _calculationState: ICalculation.CalculationState;
120
+ /** A check of the calculation state is posted: see {@link _noteCalculationState}. */
121
+ protected _calculationStatePosted: boolean;
122
+ /** `ready()` calls waiting for work in flight to end: woken on every check. */
123
+ protected _calculationStateWaiters: (() => void)[] | null;
124
+ protected _bootFull: boolean;
125
+ protected _bootExplicit: boolean;
126
+ protected _compilerWaiters: (() => void)[] | null;
127
+ protected _wroteWhileOff: boolean;
53
128
  /** {@link ICalculation.getCalculationMode} — gates the reactive pass in {@link _calculate}. */
54
129
  protected _calcMode: ICalculation.CalculationMode;
55
130
  /** {@link ICalculation.getIterativeCalculation} — handed to the executor per pass. */
56
131
  protected _iterate: boolean;
57
- protected _maxIterations: number;
132
+ protected _maxIteration: number;
58
133
  protected _maxIterateChange: number;
59
134
  /** The `calcPr` the file carried, kept whole so settings this engine ignores still round-trip. */
60
135
  protected _calcJSON: ICalculation.JSON | null;
@@ -66,6 +141,9 @@ export declare class Calculation extends AbstractModel<State, ICalculation.JSON,
66
141
  * Populated from {@link Calculation.ConstructorOptions} during `_initialize`.
67
142
  */
68
143
  protected _resolvers: FormulaBlockResolvers | null;
144
+ /** Tables as symbols: a table's stable id, which is what a structured reference stores. */
145
+ protected _tableSymbols: IndirectSymbolProvider<INamed<ITable>> | null;
146
+ protected _nameSymbols: IndirectSymbolProvider<ICalculation.INamedFormula> | null;
69
147
  constructor(options?: Calculation.ConstructorOptions);
70
148
  protected _initialize(options?: Calculation.ConstructorOptions): void;
71
149
  /**
@@ -89,19 +167,137 @@ export declare class Calculation extends AbstractModel<State, ICalculation.JSON,
89
167
  * @returns `true` if any formula was marked dirty.
90
168
  */
91
169
  protected _markDirtyReferencing(changedIds: Set<string>): boolean;
170
+ /**
171
+ * Recompiles every formula that references any of `changedIds` — a name or a table, directly or
172
+ * through a name — from its own text, so it re-derives its precedents.
173
+ *
174
+ * @remarks
175
+ * The re-wire half of {@link _markDirtyReferencing}. A node stores the coords its references
176
+ * resolved to when it was wired, and `precedentSpatial` indexes those, so a symbol that now
177
+ * designates different cells (a name redefined, a table resized) leaves its readers evaluating
178
+ * against the old edges; a dirty mark does not reach them. Same `all3D` scan and the same
179
+ * {@link _namedTargets} expansion: a name whose body cites the symbol reaches its own readers.
180
+ *
181
+ * Run at a safe point only — it writes inputs.
182
+ */
183
+ protected _recompileReferencing(changedIds: Set<string>): void;
184
+ /**
185
+ * @internal
186
+ * Rewrites the formulas that reference `table`, which is about to be removed: `'error'` puts
187
+ * `#REF!` in place of each reference (a delete), `'address'` the absolute range it designated
188
+ * (a convert to range).
189
+ *
190
+ * @remarks
191
+ * Called while the table still exists: its id and its extent are read now, and the rewrite runs at
192
+ * the next safe point. A defined name whose body cites the table is not rewritten; it evaluates
193
+ * `#REF!` once the table is gone.
194
+ */
195
+ _releaseTableReferences(table: ITable, release: 'error' | 'address'): void;
196
+ /**
197
+ * @internal
198
+ * A table's body has changed rows: re-fit the A1 references that spanned it.
199
+ *
200
+ * @remarks
201
+ * Excel treats a reference whose ROWS are exactly a table's body - or run from its header to the
202
+ * body's end - as naming the body, whatever columns of the table it covers, and keeps it on the
203
+ * body however the body's rows change (probed, `probe-table-refit.ps1`): `SUM(B2:B5)` over body
204
+ * rows 2-5 reads `SUM(B2:B6)` after a row is appended, and `SUM(B2:B3)` after a resize gives two
205
+ * up. Relative, absolute or mixed alike, from any sheet, and in anything that holds a reference -
206
+ * a defined name, a table's held totals formula and a condition's formula are blocks too. A
207
+ * reference that only starts or only ends with the body is an ordinary one, and a change of
208
+ * COLUMNS re-fits nothing. A name's relative rows are read from its body's origin, A1, as Excel
209
+ * reads them (`probe-table-refit-relative.ps1`); a shift never moves them, so a row at the top
210
+ * leaves such a name alone.
211
+ *
212
+ * An insert or delete inside the body already leaves such a reference right, so this is asked
213
+ * only for what a shift gets wrong: rows taken or given up at the body's end, and a row inserted
214
+ * at its first row (which pushes the whole reference down).
215
+ *
216
+ * One search of the precedent index over the rows that match - an entry per (block, reference)
217
+ * that reads them - so the cost is the readers of the body, on a change of a table's rows. The
218
+ * text a cell shows catches up with the engine the way it does after any shift.
219
+ *
220
+ * A block is re-fitted cell by cell: only the cells whose reference spans the body are rewritten,
221
+ * which splits them out of the block. An array-entered block is one formula, read at its top-left,
222
+ * and is never split.
223
+ *
224
+ * **A DELIBERATE DIVERGENCE lives here** (Michael, 2026-09-22). Excel asks how the cell was
225
+ * authored, not what it reads: a fully relative reference is left where it is when the cell
226
+ * belongs to a shared-formula group, and re-fitted when it stands alone - so `SUM(B2:B5)` follows
227
+ * the body when it was typed and does not when the same three formulas were filled, and the file
228
+ * carries the difference as `<f t="shared">` (`probe-table-refit-fillhandle.ps1`,
229
+ * `probe-table-refit-roundtrip.ps1`). Here a run is a data-model fact, not an authoring one -
230
+ * cells holding the same formula are conflated whatever made them - so honoring that rule would
231
+ * make a formula follow the body or not depending on what a NEIGHBOR happens to hold, which a
232
+ * user cannot see. Every reference that spans the body is re-fitted, however it was written.
233
+ *
234
+ * @param sheet The sheet the table is on, by id or name.
235
+ * @param columns The table's columns. A reference reaching outside them is an ordinary one.
236
+ * @param match The rows a reference has to span to be one of the body's, as they read NOW.
237
+ * @param headerRow The header's row when a reference from it to `match.rowEnd` also counts.
238
+ * @param to The body's rows now.
239
+ * @param afterShift The rows to match are where a shift THIS edit makes will have put them - a
240
+ * row inserted at the body's first row. The table hears of a shift before the engine has made it,
241
+ * so this waits for the next safe point.
242
+ * @param isCurrent Whether the table is still as this change left it.
243
+ */
244
+ _refitTableRows(sheet: string, columns: {
245
+ colStart: number;
246
+ colEnd: number;
247
+ }, match: {
248
+ rowStart: number;
249
+ rowEnd: number;
250
+ }, headerRow: number | null, to: {
251
+ rowStart: number;
252
+ rowEnd: number;
253
+ }, afterShift: boolean, isCurrent: () => boolean): void;
254
+ /**
255
+ * Replaces every structured reference to `tableId` on a sheet: by its address in `extent`, or by
256
+ * `#REF!` when there is none.
257
+ */
258
+ protected _rewriteTableReferences(tableId: string, extent: TableExtent | null): void;
259
+ /**
260
+ * Writes `text` over `fsv`'s cells - or over `coords`, a part of them - as the engine's own input.
261
+ * Safe point only.
262
+ */
263
+ protected _writeBlockText(fsv: FormulaSpatialValue, text: string, coords?: IRange.Coords): void;
264
+ /**
265
+ * @internal
266
+ * Rewrites the 3-D spans that a tab-order change from `before` to `after` broke — an endpoint that
267
+ * `movedId` carried across the other — to their inward neighbor. Called inside the move's commit,
268
+ * so an undo of the move restores the text.
269
+ */
270
+ _replaceSheetSpans(before: readonly string[], after: readonly string[], movedId?: string): void;
92
271
  /**
93
272
  * {@inheritDoc IContextContainer.getNamedDependents}
94
273
  *
95
274
  * @remarks
275
+ * The bucket for a NAME out of {@link _getSymbolDependents}. Kept as the name-flavored spelling
276
+ * the callers read; the index underneath is one index for every symbol kind.
277
+ */
278
+ protected _getNamedDependents(nameId: string): readonly IRange.Coords[];
279
+ /**
280
+ * Every formula block that references a symbol — a defined name, a table, or an external BOOK —
281
+ * by its stable id, as `{ ...ref, scope: gridId }` coords.
282
+ *
283
+ * @remarks
96
284
  * The memo is keyed on the formula spatial's IDENTITY, which is the whole invalidation story:
97
285
  * the map is copy-on-write (`getFormulas().clone()` before any mutation, `setFormulas` to
98
286
  * publish), so a formula added, removed, shifted or recompiled necessarily replaces it — and an
99
287
  * undo, which restores an earlier map, replaces it too. Nothing has to remember to clear this.
100
288
  *
101
289
  * The sweep is the same `all3D` walk `recompileNamed` and {@link _markDirtyReferencing} already
102
- * do, done once for every name instead of once per name.
290
+ * do, done once for every symbol instead of once per symbol. Bucketed off
291
+ * `getReferencedSymbolIds()` — names, tables and books alike — so a book's dependents
292
+ * (`IExternalBook.getDependents`) come out of the same walk as a name's, and a name's body that
293
+ * cites a book lands in the book's bucket with the name's id as its scope.
103
294
  */
104
- protected _getNamedDependents(nameId: string): readonly IRange.Coords[];
295
+ protected _getSymbolDependents(symbolId: string): readonly IRange.Coords[];
296
+ /**
297
+ * Every symbol id a formula cites, to the blocks citing it — the index
298
+ * {@link _getSymbolDependents} answers from, memoized the same way.
299
+ */
300
+ protected _getSymbolIndex(): ReadonlyMap<string, readonly IRange.Coords[]>;
105
301
  /**
106
302
  * {@inheritDoc IContextContainer.getNamedDependentNames}
107
303
  *
@@ -126,6 +322,20 @@ export declare class Calculation extends AbstractModel<State, ICalculation.JSON,
126
322
  * one naming the changed name directly. Ids that are not names (a table's) expand to themselves.
127
323
  */
128
324
  protected _namedTargets(changedIds: Set<string>): ReadonlySet<string>;
325
+ /**
326
+ * @internal
327
+ * Demand/plan counters and timings since construction (or the last {@link _resetStats}) — the
328
+ * plan-cache soak rig. From a console: `SheetXL.getSelectedWorkbook().getCalculation()._stats()`.
329
+ */
330
+ _stats(): ReturnType<CalcExecutor['getDemandStats']>;
331
+ /** @internal Zeroes every counter/timing so a measurement window starts clean. */
332
+ _resetStats(): void;
333
+ /**
334
+ * @internal
335
+ * Read (no argument) or set the plan-cache mode: `'on'` | `'assert'` | `'off'`. `'assert'` is the
336
+ * diagnostic to flip to if values ever look stale — see `CalcExecutor.planCacheMode`.
337
+ */
338
+ _planCacheMode(mode?: 'off' | 'assert' | 'on'): 'off' | 'assert' | 'on';
129
339
  /** @inheritdoc ICalculation.start */
130
340
  start(): Promise<void>;
131
341
  /**
@@ -137,7 +347,7 @@ export declare class Calculation extends AbstractModel<State, ICalculation.JSON,
137
347
  *
138
348
  * - `Starting` — held for `start()`'s drain, which always follows and loops until empty.
139
349
  * - Inside a drain — picked up by the loop already running.
140
- * - `Ready` and settled — a microtask drain is posted (see {@link _scheduleDrain}).
350
+ * - `Running` and settled — a microtask drain is posted (see {@link _scheduleDrain}).
141
351
  *
142
352
  * That last case is why this is no longer called `whenStarting`. It only ever handled work that
143
353
  * arrived while starting: queuing scheduled nothing, and the array was pumped as a side effect of
@@ -151,13 +361,65 @@ export declare class Calculation extends AbstractModel<State, ICalculation.JSON,
151
361
  * only inside a calculation. The drain is a safe point, not a synchronization point.
152
362
  */
153
363
  _whenSafe(action: () => Promise<unknown>, priority?: boolean): void;
364
+ /**
365
+ * Sends a grid request through the channel (DESIGN-CALC-SERVICE §4): applied now on a `Running`
366
+ * engine, held in send order while `Starting`, and neither recorded nor sent on an `Off` one -
367
+ * the caller's own view is the truth there, and a start is seeded from it.
368
+ */
369
+ protected _sendRequest(gridId: string, landingId: string | undefined, request: CalcRequest): Promise<ICalcGrid.Results>;
370
+ protected _sendRequestNow(gridId: string, landingId: string | undefined, request: CalcRequest): Promise<CalcResponse>;
371
+ /** Re-judges every held request: `dead` is what `isDead` answers for it now. */
372
+ protected _markHeld(isDead: (held: HeldRequest) => boolean): void;
373
+ /**
374
+ * A start that did not complete: what the channel held is resolved with nothing (the model
375
+ * keeps every write, and the next start is seeded from it), and whoever waited for the
376
+ * compiler is released.
377
+ */
378
+ protected _abandonStart(): void;
379
+ protected _releaseCompilerWaiters(): void;
380
+ /**
381
+ * @internal
382
+ * Resolves once the engine can compile: at once when `Running`; when the batch has applied the
383
+ * seeds, ahead of the boot pass, while `Starting`; after the start it makes when `Off`.
384
+ *
385
+ * @remarks
386
+ * What an owner that registers a formula asynchronously waits on (a condition formula's
387
+ * evaluation). Waiting on {@link ready} instead resolves after the boot pass, and the
388
+ * registration then costs a pass of its own (design §6.5: a boot owes one).
389
+ */
390
+ _whenCanCompile(): Promise<void>;
391
+ /**
392
+ * The start batch (DESIGN-CALC-SERVICE §6.3), in the order the service owns: service-level
393
+ * content first (the names, wired from the priority queue), then the channel in send order
394
+ * (every seed and every request made while the engine was coming up), then the owners that
395
+ * hold a formula of their own (a host whose grid lost its body writes it again; a watch held for
396
+ * the engine registers inside `onReady`), then the one pass the boot owes.
397
+ *
398
+ * @remarks
399
+ * `isLoading()` holds for the whole batch, so a grid seeded here owes its pass rather than
400
+ * running one against siblings not yet seeded. The pass itself runs on a task of its own
401
+ * ({@link _runBoot}): a consumer whose registration chains through promises resolved here (a
402
+ * data validation's, a conditional format's) lands ahead of it, and N of them cost one pass.
403
+ *
404
+ * A held request lands under the engine's current commit: the snapshot it named has been
405
+ * mirrored already, so its writes belong to the tip, and the maps are versioned under that key.
406
+ * One whose snapshot the model has undone since is skipped.
407
+ */
408
+ protected _boot(): Promise<void>;
409
+ /**
410
+ * Posts the boot pass on a task of its own, and answers the promise `start()`, `ready()` and a
411
+ * `calculate()` made meanwhile wait on. One at a time.
412
+ */
413
+ protected _scheduleBoot(): Promise<void>;
414
+ /** The boot pass: what the batch, and the consumers that registered since, owe - once. */
415
+ protected _runBoot(): Promise<void>;
154
416
  /**
155
417
  * Posts a microtask drain, if one is not already coming.
156
418
  *
157
419
  * @remarks
158
420
  * A no-op in the two cases where a drain is already guaranteed to reach this action:
159
421
  *
160
- * - not `Ready` — `start()` drains at the tail of its transition, and does so inline so
422
+ * - not `Running` — `start()` drains at the tail of its transition, and does so inline so
161
423
  * `await start()` covers the queued work. Posting here would race that.
162
424
  * - already draining — `_drainPending` loops until the queue is empty, so an action appended
163
425
  * during a drain is picked up by the pass in flight.
@@ -186,8 +448,23 @@ export declare class Calculation extends AbstractModel<State, ICalculation.JSON,
186
448
  * This is deliberately not folded into {@link _drainPending}. The other three sites would then
187
449
  * calculate twice, and `start()` would calculate mid-load — which is the thing `isLoading()`
188
450
  * exists to prevent.
451
+ *
452
+ * The pass is reactive whether or not a grid owed it, so manual mode holds it for `calculate()`.
453
+ * That includes the load: a manual-mode file opens with no pass, as Excel's does — its `ca`
454
+ * cells and value-less formulas stay dirty (`isCalculationRequired()`) until asked. A file whose
455
+ * `calcId` says it needs recalculating still gets one; that is the explicit full pass of
456
+ * `calcOnLoad: 'full'`.
189
457
  */
190
458
  protected _drainStandalone(): Promise<void>;
459
+ /**
460
+ * Owe a reactive pass for `gridId`, to run once the current flush is over.
461
+ *
462
+ * @remarks
463
+ * The posted form of `calculateGrid`: the drain scheduler already coalesces everything owed at
464
+ * the end of a flush into one pass, and this is how a consumer asks for that pass without
465
+ * running one itself. See {@link IContextContainer.requestCalculateGrid}.
466
+ */
467
+ protected _owePass(gridId: string): void;
191
468
  /**
192
469
  * Runs queued actions until the queue is empty. The one drain, used by every site that drains.
193
470
  *
@@ -204,8 +481,8 @@ export declare class Calculation extends AbstractModel<State, ICalculation.JSON,
204
481
  * shape, and got away with it only because it goes on to call `grid.calculate()` per dirty grid —
205
482
  * which loop-drains. It held if something was dirty and did not if nothing was.
206
483
  *
207
- * `_draining` is restored rather than cleared, so a nested drain (an action that calculates)
208
- * leaves the outer one's window intact.
484
+ * `_draining` stays set until the last run in flight finishes ({@link _drainDepth}), so a nested
485
+ * drain (an action that calculates) or an overlapping one leaves the other's window intact.
209
486
  *
210
487
  * **Call this under `if (this._pendingActions?.length)`, not unconditionally.** `await` on an
211
488
  * async call yields to the microtask queue even when the callee does nothing, and a calculation
@@ -214,24 +491,332 @@ export declare class Calculation extends AbstractModel<State, ICalculation.JSON,
214
491
  * between. An unconditional drain here pushes the whole pass past a microtask boundary and that
215
492
  * read returns the raw text instead (`use-signs.test.ts`).
216
493
  */
217
- protected _drainPending(): Promise<void>;
494
+ protected _drainPending(priorityOnly?: boolean): Promise<void>;
218
495
  /** @inheritdoc ICalculation.calculate */
219
496
  calculate(options?: ICalculation.CalculateOptions | boolean): Promise<ICalculation.Status>;
220
497
  /**
221
498
  * @returns The status the engine is in once the pass has run — `Starting` if the request was
222
- * deferred to the start-up drain, and whatever non-`Ready` status turned it away
499
+ * deferred to the start-up drain, and whatever non-`Running` status turned it away
223
500
  * otherwise. Never `undefined`: it used to resolve that on every path including the
224
501
  * successful one (the tail simply fell off the end), and two call sites cast the result
225
502
  * to `Status` to satisfy {@link ICalculation.calculate}.
226
503
  */
227
504
  protected _calculate(options?: ICalculation.CalculateOptions, gridId?: string): Promise<ICalculation.Status>;
228
- protected _createCalcGrid(options?: CalcGrid.ConstructorOptions): ICalcGrid;
229
- protected _registerGrid(grid: ICalcGrid): void;
505
+ /** A pass, counted while it runs: what the calculation state reads as a pass in flight. */
506
+ protected _calculateNow(options?: ICalculation.CalculateOptions, gridId?: string): Promise<ICalculation.Status>;
507
+ protected _runCalculation(options?: ICalculation.CalculateOptions, gridId?: string): Promise<ICalculation.Status>;
508
+ /**
509
+ * A restore moves every grid to another snapshot and reports nothing, so each formula host is
510
+ * told here what its grid now holds.
511
+ * @internal
512
+ */
513
+ protected _processRestoreOrRevert(state: State, commit: ITransaction.ICommit): void;
514
+ /**
515
+ * Formula text as a cell at `coords` would STORE it, without writing it anywhere.
516
+ *
517
+ * @remarks
518
+ * {@link createFormula} compiles for editing, which keeps what was typed. A committed cell is
519
+ * compiled for storage: `[#This Row]` becomes `@`, and an unqualified structured reference is
520
+ * given the name of the table it binds to - the one at `coords`. An owner that holds formula text
521
+ * apart from any cell (a table column's totals formula while its row is hidden) stores it
522
+ * through this, so it holds what a cell would.
523
+ *
524
+ * @param coords The cell the text is authored at, on the sheet `scope` names (by id or name).
525
+ * @throws When the engine is not Ready, or `scope` names no sheet.
526
+ * @internal
527
+ */
528
+ _toStoredText(expression: string, coords: IRange.CellCoords & {
529
+ scope: string;
530
+ }): string;
531
+ /**
532
+ * A grid that holds exactly one formula block, as a handle - see {@link FormulaHost}.
533
+ *
534
+ * @remarks
535
+ * Creates the grid unless the container already has one under `id` (a name's grid outlives a
536
+ * redefine and a delete), then answers a handle over it. The handle resolves the grid by id on
537
+ * every use, so it is safe to hold across snapshots.
538
+ *
539
+ * @internal
540
+ */
541
+ _createFormulaHost(options: Calculation.FormulaHostOptions): FormulaHost;
542
+ /**
543
+ * Evaluate an expression once over a block, through the engine.
544
+ *
545
+ * @remarks
546
+ * The implementation of {@link ICalculation.EvaluateOptions.block}: a watch with no lifetime.
547
+ * The body is written over `coords` in a grid that shadows the sheet, exactly as a watch's is
548
+ * (see `WatchAnchor`), one pass evaluates it, and the grid is dropped. What comes back reads over
549
+ * a copy-on-write clone of the dropped grid's values, taken before the drop, so it outlives the
550
+ * grid as a plain object.
551
+ *
552
+ * The grid and its body amend the current commit, as a watch's do: never an undo step. The
553
+ * pass is explicit and seeded from the one grid, so it runs under manual calculation without
554
+ * recalculating what the user has deferred.
555
+ * @internal
556
+ */
557
+ protected _evaluateOver(options: Calculation.EvaluateOverOptions): Promise<IRange>;
558
+ /**
559
+ * A grid for a model to hold (DESIGN-CALC-SERVICE §13.23): the synchronous half, versioned in
560
+ * the model's store, forwarding every verb as a request. The engine's grid is made by the
561
+ * grid's first request, `create`, which an `Off` engine drops: a start makes it then, from this
562
+ * one. What the engine pushes reaches the owner through the grid's events. It opens empty: the
563
+ * owner attaches its listeners, then seeds it.
564
+ * @internal
565
+ */
566
+ _createCalcGrid(options: Calculation.CalcGridOptions): CalcGrid;
567
+ /** What a `create` for a model grid carries: its description, and its size as it is now. */
568
+ protected _specOf(front: CalcGrid): CalcGridSpec;
569
+ /**
570
+ * The engine's grid for a model grid, as a `create` describes it. What it pushes reaches the
571
+ * model grid under the same id.
572
+ */
573
+ protected _createEngineGrid(spec: CalcGridSpec): CalcGridBackend;
574
+ /**
575
+ * Make the engine's grids from the model's (design §6.3): each live model grid's `create`, the
576
+ * hosts' first (a name's grid before any sheet's); each host's body sent again; then every grid
577
+ * a sheet owns seeded from what it holds now. Requests like any other: held while `Starting`,
578
+ * applied at once on a `Running` engine that is rebuilt.
579
+ *
580
+ * @param full The seeds ask for a full pass - a start's, which the boot keeps only when
581
+ * something was written while `Off`.
582
+ */
583
+ protected _openEngineGrids(full: boolean): void;
584
+ /**
585
+ * The engine's graph and every grid in it, gone: what `stop()` leaves, and what a rebuild starts
586
+ * from. The model's grids are untouched.
587
+ */
588
+ protected _dropEngine(): void;
589
+ /**
590
+ * The engine's history starts at the boot: the commits mirrored before it hold none of the
591
+ * grids the boot made, so a restore to one is not followed but rebuilt ({@link _followRestore}).
592
+ * The model's commit now is the boot's.
593
+ */
594
+ protected _forgetEarlierLandings(modelCommitId?: string | null): void;
595
+ /**
596
+ * The model restored itself to `commitId`: the engine restores its own history there, or - on a
597
+ * `Running` engine whose history does not reach it (a commit from before its start, or one
598
+ * trimmed since) - is rebuilt from the model's grids as they are there, at the next safe point.
599
+ */
600
+ protected _followRestore(commitId: string): void;
601
+ /**
602
+ * Make the engine again from the model, as a start does: its replicas, its grids and their
603
+ * seeds, with the values the model holds trusted.
604
+ */
605
+ protected _rebuildEngine(): void;
606
+ /**
607
+ * Report a failure of a request no caller awaits - a grid's seed - as this calculation's error.
608
+ * @internal
609
+ */
610
+ _reportError(error: unknown): void;
611
+ protected _createBackendGrid(options?: CalcGridBackend.ConstructorOptions): CalcGridBackend;
612
+ protected _registerGrid(grid: CalcGridBackend): void;
230
613
  protected _unregisterGrid(gridId: string): void;
614
+ /**
615
+ * The sheet list as the model holds it now: what a `sheets` message carries, and what a start
616
+ * seeds the replica from. Read only at those two moments.
617
+ */
618
+ protected _liveSheets(): [id: string, name: string | null][];
619
+ /**
620
+ * Tells the engine the sheet list as the model holds it now (DESIGN-CALC-SERVICE §8): one
621
+ * message through the channel, applied at once on a `Running` engine, held in order while
622
+ * `Starting`, dropped by an `Off` one (whose next start seeds the replica afresh, and which
623
+ * reads the drop as a write made meanwhile, so that start's pass is full).
624
+ */
625
+ protected _sendSheets(): void;
626
+ /**
627
+ * Replaces the replica with the list a `sheets` message carries.
628
+ *
629
+ * @remarks
630
+ * A sheet that survived with a different name or at a different position changes what the
631
+ * functions reading names and positions answer (`INDIRECT`, `FORMULATEXT`, `CELL`, `SHEET`, a
632
+ * 3-D span's members), and none of that is a precedent: a full pass follows, which is what the
633
+ * model asked for on a rename or a move before the engine was told of either. A sheet
634
+ * appended moves nothing; one inserted or deleted ahead of a survivor moves it, and counts.
635
+ */
636
+ protected _applySheets(sheets: readonly (readonly [id: string, name: string | null])[]): void;
637
+ /** The model's tables as the replica holds them: by id, each table's name and columns. */
638
+ protected _liveTables(): Map<string, TableSymbols>;
639
+ /** The defined names as the replica holds them: by id, each name's spelling and scope sheet. */
640
+ protected _liveNames(): Map<string, NameSymbols>;
641
+ /**
642
+ * Tell the engine one table's name and columns as they are now, or that it is gone - from the
643
+ * model, at the moment it changes, inside the operation (the sheet's table callbacks). So the
644
+ * message is in the channel where the change happened, between the requests made before it and
645
+ * those made after, and a request held while `Starting` binds the names it was sent under. A
646
+ * restore changes nothing here: it reaches the engine as the revert of its own store. An `Off`
647
+ * engine is told nothing; a start seeds the replica from the model.
648
+ *
649
+ * @remarks
650
+ * Reads the table's own record only: a read of the sheet inside an open operation would make the
651
+ * writes a cell buffer holds.
652
+ * @internal
653
+ */
654
+ _tableChanged(table: ITable, removed: boolean): void;
655
+ /** A name written, as {@link _tableChanged} tells a table. */
656
+ protected _nameWritten(written: NamedFormulaCollection.NamesWritten): void;
657
+ /**
658
+ * One change to a replica, as a message: sent to a `Starting` engine as it is (the channel holds
659
+ * it in order), and to a `Running` one only when the replica does not already say so.
660
+ */
661
+ protected _sendSymbolChange<T>(kind: 'tables' | 'names', id: string, entry: T | null, same: (a: T | null | undefined, b: T | null) => boolean): void;
662
+ /**
663
+ * Applies what a `tables` message carries to the replica. A reference bound by a name the
664
+ * replica did not have yet heals to it now, as one to a table added does.
665
+ */
666
+ protected _applyTables(changes: readonly (readonly [id: string, table: TableSymbols | null])[]): void;
667
+ /** Applies what a `names` message carries, as {@link _applyTables} does. */
668
+ protected _applyNames(changes: readonly (readonly [id: string, name: NameSymbols | null])[]): void;
669
+ /** What a replica's change re-resolved - healed, renamed, gone - is marked for the next pass. */
670
+ protected _markDirtyReconciled(provider: {
671
+ reconcile(): string[];
672
+ } | null): void;
673
+ private _tablesDerived;
674
+ private _namesDerived;
675
+ /**
676
+ * The table replica and its name index, or `null` while `Off`: an engine that has been told
677
+ * nothing reads the model.
678
+ */
679
+ protected _replicaTables(): {
680
+ of: ReadonlyMap<string, TableSymbols>;
681
+ idByName: Map<string, string>;
682
+ } | null;
683
+ /** The name replica and its spelling index, as {@link _replicaTables}. @internal */
684
+ _replicaNames(): {
685
+ of: ReadonlyMap<string, NameSymbols>;
686
+ idsByName: Map<string, string[]>;
687
+ } | null;
688
+ /**
689
+ * The name a spelling resolves to from `scope`, by the replica: that sheet's own name first, then
690
+ * the global; asked from no sheet, the global, else any scoped one - the collection's rule
691
+ * (`NamedFormulaCollection.getByName`). `undefined` when the replica cannot answer, and the
692
+ * collection is asked instead.
693
+ * @internal
694
+ */
695
+ _replicaNameId(name: string, scope: string | null | undefined): string | undefined;
696
+ /** See {@link _modelSymbols}. */
697
+ protected _modelSymbolRegistry: ISymbolRegistry;
698
+ /**
699
+ * The model's symbol map (DESIGN-CALC-SERVICE §8): what the facade images the engine's records
700
+ * against. Sheets answer from the model's live list; the rest from the engine's providers.
701
+ * @internal
702
+ */
703
+ _modelSymbols(): ISymbolRegistry;
704
+ /**
705
+ * What images a grid's records for the model (DESIGN-CALC-SERVICE §8): the model's symbol map,
706
+ * the grid as home scope, its bounds and the reader's locale, both read live so a rename or a
707
+ * locale switch shows without a recompile.
708
+ * @internal
709
+ */
710
+ _imagerFor(gridId: string): FormulaImager;
711
+ private _sheetsDerived;
712
+ private _sheetsCache;
713
+ /** Every sheet's grid id in tab order, from the replica. */
714
+ protected _sheetIds(): readonly string[];
715
+ /** A sheet's grid id by its name, as Excel reads sheet names: case-insensitively. `null` when none. */
716
+ protected _sheetIdByName(name: string): string | null;
717
+ /** A sheet's name by its grid id, or `null` for a grid that is no sheet. */
718
+ protected _sheetName(gridId: string): string | null;
231
719
  /** @inheritdoc ICalculation.stop */
232
720
  stop(): Promise<void>;
721
+ /**
722
+ * {@inheritDoc ITransaction.ITransactional.close}
723
+ *
724
+ * @remarks
725
+ * Brings the ENGINE down before the model goes away. The inherited close is a model close — it
726
+ * flips the closed flag and detaches the transaction listener — which left a closed calculation
727
+ * still reporting {@link ICalculation.Status.Running}, with `onStopping`/`onStop` never sent to
728
+ * listeners that were about to be discarded.
729
+ *
730
+ * {@link stop} resolves synchronously (it awaits nothing), so the `void` here loses no ordering;
731
+ * it is `async` only because the interface says so. It is also a no-op unless the status is
732
+ * `Running`, which is what makes closing a still-STARTING engine safe — `start()` observes the close
733
+ * at its own await points instead.
734
+ */
735
+ close(): void;
736
+ /** A model holding writes for the engine makes them on this read (`ITransaction.Hooks.writes`). */
737
+ protected _flushModel(): void;
738
+ /**
739
+ * Runs `action` with its engine writes landing under `landingId`, or as they are when none.
740
+ *
741
+ * @remarks
742
+ * A root-level request after a nested savepoint of the same root has landed: the root's own
743
+ * commit is behind the tip, and the savepoint is part of the root for good, so the write joins
744
+ * the tip. The engine's live maps are always the tip's.
745
+ * @internal
746
+ */
747
+ _landUnder<R>(landingId: string | undefined, action: () => R): R;
748
+ /** Whether the engine still holds a commit: its own record is in every commit made since it was built. */
749
+ protected _holdsEngineCommit(engineId: string): boolean;
750
+ /**
751
+ * Records the model commit that just landed: its mirror, a commit of the engine's own that names
752
+ * it in the engine's record.
753
+ *
754
+ * @remarks
755
+ * A commit even when nothing landed under the model's: an engine write made after the close,
756
+ * outside any model operation (a deferred recompile), amends the engine's tip, and that tip has
757
+ * to be this model commit's, not the one before it, or a restore to the one before carries the
758
+ * write. The engine's record changes with every mirror, so the commit is never elided.
759
+ */
760
+ protected _mirror(commitId: string): void;
761
+ /** Forgets a landing, and the engine commit it made if it made one. */
762
+ protected _dropLanding(landingId: string): void;
763
+ /** Drops the landings whose engine commit the store has trimmed or pruned. Rare: sized by the store's cap. */
764
+ protected _sweepLandings(): void;
765
+ /** The model commits on the live history: the current one and its ancestors. */
766
+ protected _modelHistory(): Set<string>;
767
+ /**
768
+ * A model root closed without landing (an amend, or nothing written): the engine commits made
769
+ * under its id (`<id>:0`, `<id>:n`) fold into the mirror of the model's current commit.
770
+ */
771
+ protected _foldPhantom(rootId: string): void;
772
+ /**
773
+ * The engine commit an engine write made during a model operation lands in: the operation's
774
+ * root (`<id>:0`) or the nested savepoint open now. `null` outside an operation, or while a
775
+ * landing is already open (the write joins it).
776
+ */
777
+ protected _modelLanding(): string | null;
778
+ /**
779
+ * Engine state is never a step of history on its own: a write is attributed to the model
780
+ * operation it is made in, or folded into the current snapshot (a pass's bookkeeping).
781
+ * @internal
782
+ */
783
+ protected _updateState(updateState?: Partial<State>, options?: ITransaction.StoreOperationOptions, events?: (keyof ICalculation.IListeners)[]): this;
784
+ /** @internal */
785
+ protected _amendState(updateState?: Partial<State>, options?: ITransaction.StoreOperationOptions, events?: (keyof ICalculation.IListeners)[]): this;
786
+ /**
787
+ * Restore the engine's history to the model's `commitId`, once; answers what changed per grid.
788
+ *
789
+ * @remarks
790
+ * The changed regions are the union of what every engine commit between the two snapshots
791
+ * recorded as touched (`IntentTouched`), whichever direction the restore goes; they are marked
792
+ * dirty so the pass that follows recomputes them, and handed back so each grid can re-vend the
793
+ * blocks over them. An id the engine no longer holds is answered with `null`: the engine's
794
+ * history is shorter than the model's there, and a seed is what brings it back (step 3).
795
+ * @internal
796
+ */
797
+ _revertTo(commitId: string): Map<string, IRange.Coords[]> | null;
798
+ /**
799
+ * Hook the rollback of the savepoint a request goes out under, the first time one does: a
800
+ * `rollback` message follows, through the channel, if it rolls back. By a step that shares the
801
+ * savepoint and writes nothing - its outcome hooks pass to the savepoint when it closes. A
802
+ * request landing on the operation's own commit (`<id>:0`) needs none: a root rollback is seen by
803
+ * the engine's listener on the store.
804
+ */
805
+ protected _hookRollback(landingId: string): void;
806
+ private _rollbackHooked;
807
+ /**
808
+ * A nested savepoint of the model rolled back: what the engine landed under it goes with it.
809
+ * What a `rollback` message does.
810
+ */
811
+ protected _savepointRolledBack(savepointId: string): void;
233
812
  /** @inheritdoc ICalculation.getStatus */
234
813
  getStatus(): ICalculation.Status;
814
+ /**
815
+ * Resolves once every request sent to a grid has settled and its sender has handled the
816
+ * response. What a save waits for after `ready()`.
817
+ * @internal
818
+ */
819
+ _whenRequestsSettled(): Promise<void>;
235
820
  /** @inheritdoc ICalculation.getCalculationMode */
236
821
  getCalculationMode(): ICalculation.CalculationMode;
237
822
  /** @inheritdoc ICalculation.setCalculationMode */
@@ -246,19 +831,36 @@ export declare class Calculation extends AbstractModel<State, ICalculation.JSON,
246
831
  toJSON(): ICalculation.JSON;
247
832
  /** @inheritdoc ICalculation.ready */
248
833
  ready(options?: ICalculation.CalculateOptions): Promise<ICalculation.Status>;
834
+ /** One round of `ready()`: up, drained, and the passes the dirty set owes (none in manual mode). */
835
+ protected _readyPass(full: boolean): Promise<void>;
836
+ /** @inheritdoc ICalculation.getCalculationState */
837
+ getCalculationState(): ICalculation.CalculationState;
838
+ /**
839
+ * Work in flight: answers owed to the model, a drain posted or running, deferred actions, a pass
840
+ * owed or running, the boot. What `ready()` waits out.
841
+ */
842
+ protected _isWorking(): boolean;
843
+ /**
844
+ * Checks the calculation state once the current flush is over: announces a change, and wakes
845
+ * every `ready()` waiting for work in flight to end. Called wherever that work starts or ends.
846
+ */
847
+ protected _noteCalculationState(): void;
249
848
  /**
250
849
  * The locale-aware editing compiler, (re)built when the workbook locale (separators, Plane 1) or
251
850
  * active spreadsheet-language pack (boolean literals, Plane 3) has changed since it was last built.
252
851
  * Only the editing path uses locale-specific separators; the calc path (`_compiler`) is always
253
852
  * canonical because it only ever parses stored/API text.
254
853
  */
255
- protected _getEditingCompiler(): IFormulaCompiler;
854
+ protected _getEditingCompiler(target?: ICalculation.FormulaTarget): IFormulaCompiler;
256
855
  /** @inheritdoc ICalculation.createFormula */
257
- createFormula(expression: string, coords?: Partial<IRange.CellCoords>): ICalculation.IFormula;
856
+ createFormula(expression: string, coords?: Partial<IRange.CellCoords>, options?: ICalculation.CreateFormulaOptions): ICalculation.IFormula;
857
+ protected _createFormula(expression: string, coords: Partial<IRange.CellCoords> | undefined, target: ICalculation.FormulaTarget): ICalculation.IFormula;
258
858
  /** {@inheritDoc ICalculation.evaluate} */
259
- evaluate(expression: string, options?: number | ICalculation.EvaluateOptions & Partial<IRange.CellCoords>): Promise<Scalar | IRange>;
859
+ evaluate(expression: string, options?: number | ICalculation.EvaluateOptions & Partial<IRange.CellCoords> & ICalculation.CreateFormulaOptions): Promise<Scalar | IRange>;
260
860
  /** @inheritdoc ICalculation.getFunctions */
261
861
  getFunctions(): IFunctionCollection;
862
+ /** @inheritdoc ICalculation.getExternalBooks */
863
+ getExternalBooks(): IExternalBookCollection;
262
864
  /** @inheritdoc ICalculation.getNamedFormulas */
263
865
  getNamedFormulas(): INamedFormulasCollection;
264
866
  /**
@@ -288,6 +890,8 @@ export declare class Calculation extends AbstractModel<State, ICalculation.JSON,
288
890
  protected _statusMessage(): string;
289
891
  get [Symbol.toStringTag](): string;
290
892
  toString(): string;
893
+ /** {@inheritDoc ICalculation.isICalculation} */
894
+ get isICalculation(): true;
291
895
  }
292
896
  /**
293
897
  * Interfaces for creating `Calculation` items.
@@ -298,6 +902,55 @@ export declare class Calculation extends AbstractModel<State, ICalculation.JSON,
298
902
  * {@link Calculation}
299
903
  */
300
904
  export declare namespace Calculation {
905
+ /** See {@link Calculation._evaluateOver}. */
906
+ interface EvaluateOverOptions {
907
+ /** The sheet whose coordinate space the block is in. */
908
+ sheetGridId: string;
909
+ /** The block: the body is filled over it. */
910
+ coords: IRange.Coords;
911
+ /** The expression as authored, without a leading `=`. */
912
+ expression: string;
913
+ /** Where the expression is authored; `coords`' top-left for a plain fill. */
914
+ authoredAt: IRange.CellCoords;
915
+ /** Each cell of the block is its own 1x1 array-entered formula. See {@link ICalculation.EvaluateOptions.arrayFirstCell}. */
916
+ arrayFirstCell?: boolean;
917
+ }
918
+ /** See {@link Calculation._createFormulaHost}. */
919
+ interface FormulaHostOptions {
920
+ /** The grid's id; an existing grid under it is reused. */
921
+ id: string;
922
+ /** The sheet grid whose coordinate space the body lives in - a watch. See {@link ICalcGrid.getShadowOf}. */
923
+ shadowOf?: string;
924
+ /** `true` for a grid whose (0,0) is a synthetic anchor - a name. See {@link CalcGridBackend.ConstructorOptions.unanchored}. */
925
+ unanchored?: boolean;
926
+ /** `true` for a body whose every cell is its own 1x1 array-entered formula. See {@link ICalcGrid.isArrayFirstCell}. */
927
+ arrayFirstCell?: boolean;
928
+ /** The grid's size: fixed, a name's. */
929
+ entireCoords?: IRange.Coords;
930
+ /** The grid whose size the body has, whatever it is then: a sheet's, for a body on it. */
931
+ sizeOf?: string;
932
+ /** Told after every pass that wrote the grid. */
933
+ onCalculated?: (results: ICalcGrid.Results) => void;
934
+ }
935
+ /** See {@link Calculation._createCalcGrid}. */
936
+ interface CalcGridOptions extends CalcGrid.HostOptions, Pick<CalcGrid.ConstructorOptions, 'valuesAxis'> {
937
+ /** The grid's id; a new one is made when absent. */
938
+ uuid?: string;
939
+ /** See {@link CalcGridSpec.name}: a sheet's grid. */
940
+ name?: string | null;
941
+ /** See {@link CalcGridSpec.shadowOf}. */
942
+ shadowOf?: string;
943
+ /** See {@link CalcGridSpec.unanchored}. */
944
+ unanchored?: boolean;
945
+ /** See {@link CalcGridSpec.arrayFirstCell}. */
946
+ arrayFirstCell?: boolean;
947
+ /** The grid's size, as the model knows it: a sheet's, read when asked. */
948
+ getEntireCoords?: () => IRange.Coords;
949
+ /** The grid's size, fixed. */
950
+ entireCoords?: IRange.Coords;
951
+ /** See {@link CalcGridSpec.sizeOf}. */
952
+ sizeOf?: string;
953
+ }
301
954
  /**
302
955
  * Options available when creating a Calculation Service.
303
956
  */
@@ -320,6 +973,11 @@ export declare namespace Calculation {
320
973
  * defining cell when a named formula is added without an explicit `cell` (mirrors Excel).
321
974
  */
322
975
  getActiveCell?: () => IRange.CellCoords | null;
976
+ /**
977
+ * Whether defined names refuse edits, on top of the calculation's own read-only state. A
978
+ * workbook answers with its structure protection.
979
+ */
980
+ isNamesReadOnly?: () => boolean;
323
981
  /**
324
982
  * Returns a sheet handle given an id.
325
983
  */
@@ -337,13 +995,16 @@ export declare namespace Calculation {
337
995
  getRanges?: (address: ICellRanges.Address, options?: ICellRange.GetRangeOptions) => ICellRanges;
338
996
  } | null;
339
997
  /**
340
- * Returns a sheet handle given a name.
998
+ * External books to hydrate at construction, in `IWorkbook.JSON.externalBooks` form — `[n]`
999
+ * order, `null` for a DDE/OLE gap.
1000
+ *
1001
+ * @remarks
1002
+ * The engine owns the collection ({@link ICalculation.getExternalBooks}) for the reason it owns
1003
+ * defined names: a book is a symbol formulas bind into, and its dependents are the engine's index.
341
1004
  */
342
- getSheetByName?: (sheetName: string) => {
343
- getId(): string;
344
- getName(): string;
345
- getEntireCoords: () => IRange.Coords | null;
346
- } | null;
1005
+ externalBooks?: (IExternalBook.JSON | null)[];
1006
+ /** See {@link ICellContainerOptions.externalBookResolver}; held by the collection for the engine's life. */
1007
+ externalBookResolver?: IExternalBook.IResolver;
347
1008
  /**
348
1009
  * Named item collection shared with the workbook.
349
1010
  *
@@ -362,12 +1023,6 @@ export declare namespace Calculation {
362
1023
  * engine has no pre-load lifecycle state.
363
1024
  */
364
1025
  names?: INamed.JSON[];
365
- /**
366
- * A structural transform applied to each hydrated name's expression as it compiles — the READ
367
- * half of the format-dialect hook (see `IWorkbook.ConstructorOptions.formulaTransform`).
368
- * Applies only to {@link names}; formulas added later compile without it.
369
- */
370
- formulaTransform?: ICalculation.FormulaTransform;
371
1026
  getRanges?: (address: ICellRanges.Address, options?: ICellRange.GetRangeOptions) => ICellRanges;
372
1027
  getRange?: (address: ICellRange.Address, options?: ICellRange.GetRangeOptions) => ICellRange;
373
1028
  /**
@@ -381,9 +1036,20 @@ export declare namespace Calculation {
381
1036
  * `INamedRange` — see DESIGN-NAMED-FORMULAS.md §4). Structural like `getRange`/`getRanges`,
382
1037
  * and like them supplied by the workbook. Without it, graph answers fall back to cells only.
383
1038
  */
384
- createGraphRanges?: (cells: readonly IRange.Coords[], names: readonly _NamedGraphNode[]) => ICellRanges | null;
1039
+ createGraphRanges?: (cells: readonly IRange.Coords[], names: readonly NamedNodeInfo[]) => ICellRanges | null;
385
1040
  getSheetIndex?: (sheetName?: string) => number;
386
1041
  getSheetCount?: () => number;
1042
+ /**
1043
+ * Every sheet's stable id in tab order, hidden and very hidden included — the order a 3-D
1044
+ * reference's members are read from.
1045
+ */
1046
+ getSheetIds?: () => string[];
1047
+ /**
1048
+ * Subscribes to the sheet list changing by an operation - a sheet added, deleted, moved,
1049
+ * copied or renamed. Not a restore: an undo or a redo reaches the engine through its own
1050
+ * store, which is restored with the model's (DESIGN-CALC-SERVICE §7.5, §8).
1051
+ */
1052
+ addSheetsListener?: (callback: () => void, options?: IListener.Options) => IListener.Remove;
387
1053
  strings?: IStringCollection;
388
1054
  /**
389
1055
  * Whether to perform iterative calculations when there are circular dependencies.
@@ -396,7 +1062,7 @@ export declare namespace Calculation {
396
1062
  *
397
1063
  * @defaultValue 100
398
1064
  */
399
- maxIterations?: number;
1065
+ maxIteration?: number;
400
1066
  /**
401
1067
  * The maximum change allowed between iterations when performing iterative calculations.
402
1068
  *
@@ -408,7 +1074,25 @@ export declare namespace Calculation {
408
1074
  /**
409
1075
  * Transaction State for Calculation
410
1076
  */
1077
+ /**
1078
+ * A grid request the channel holds while the engine is `Starting` (DESIGN-CALC-SERVICE §4): the
1079
+ * request as data, the snapshot it names, and the caller's continuation.
1080
+ */
1081
+ interface HeldRequest {
1082
+ gridId: string;
1083
+ request: CalcRequest;
1084
+ /** The engine commit it would have landed in; what a nested rollback names. */
1085
+ landingId: string | undefined;
1086
+ /** The model snapshot it was made at (`RequestOptions.commitId`); what a restore names. */
1087
+ commitId: string | undefined;
1088
+ /** The model has undone the snapshot it was made at: skipped when applied, unless a redo revives it. */
1089
+ dead: boolean;
1090
+ resolve: (response: CalcResponse | PromiseLike<CalcResponse>) => void;
1091
+ reject: (error: unknown) => void;
1092
+ }
411
1093
  interface State extends AbstractModel.State {
1094
+ /** The model commit this engine commit mirrors; written by every mirror so the commit lands. */
1095
+ mirrorOf?: string;
412
1096
  /**
413
1097
  * Top down evaluation and marking dirty.
414
1098
  * This is the only spatial map that is completely updated via api.
@@ -442,13 +1126,34 @@ interface State extends AbstractModel.State {
442
1126
  /**
443
1127
  * All registered grids.
444
1128
  */
445
- gridsAll: Map<string, ICalcGrid>;
1129
+ gridsAll: Map<string, CalcGridBackend>;
1130
+ /**
1131
+ * The engine's replica of the model's sheet list (DESIGN-CALC-SERVICE §8): grid id to name, in
1132
+ * tab order. What every symbol lookup, span and sheet-position function reads. Fed by the
1133
+ * `sheets` message and by grid registration; versioned here so a revert restores it with the
1134
+ * formulas that bound through it.
1135
+ */
1136
+ sheets: ReadonlyMap<string, string | null>;
1137
+ /**
1138
+ * The engine's replica of the model's tables (DESIGN-CALC-SERVICE §8): table id to its name and
1139
+ * its columns' ids and names. What a structured reference binds and images through. Fed by the
1140
+ * `tables` message, seeded at a start, versioned here as {@link sheets} is.
1141
+ */
1142
+ tables: ReadonlyMap<string, TableSymbols>;
1143
+ /**
1144
+ * The engine's replica of the defined names: name id to its spelling and the sheet it is scoped
1145
+ * to. What a name binds and images through. Fed by the `names` message, as {@link tables} is.
1146
+ */
1147
+ names: ReadonlyMap<string, NameSymbols>;
1148
+ /**
1149
+ * Each grid's per-grid maps as of this snapshot (`CalcGridMaps`): values, contentful, spills,
1150
+ * errors, pending, circular. Copy-on-write per request; handed back to the grid on a restore.
1151
+ */
1152
+ gridMaps: Map<string, object>;
446
1153
  /**
447
1154
  * Listeners to individual named items
448
1155
  */
449
1156
  itemRemoveListeners: (() => void)[];
450
1157
  }
451
- interface CommitView extends AbstractModel.CommitView {
452
- }
453
1158
  export {};
454
1159
  //# sourceMappingURL=Calculation.d.ts.map