@sheetxl/sdk 0.7.28-beta.4 → 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 (355) 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/Dg3GaW0QWwnlqetX.cjs +1 -0
  6. package/browser/cjs/KWQPie2u7AP69web.cjs +93 -0
  7. package/browser/cjs/index.cjs +2 -2
  8. package/browser/esm/{DBIu6NUHIcxOOBQp.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/{CHSahmMFYNB0Ajkf.mjs → Dq3sc4B_HQHBrT5N.mjs} +2 -2
  14. package/browser/esm/index.mjs +871 -696
  15. package/browser/esm/{CKk58ZLcrllMzfou.mjs → trwZArJQQq7K9kL7.mjs} +2 -2
  16. package/licenses/dependencies.txt +204 -204
  17. package/node/esm/CGWsQOMWdnDeF4dX.mjs +8 -0
  18. package/node/esm/{DUYP6faJJHCaW1Xf.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 +53973 -38584
  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 -4
  27. package/types/scripting.d.ts +7185 -1079
  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 +745 -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 +422 -34
  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 +160 -29
  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 +39 -3
  86. package/types/src/calculation/state/IContextContainer.d.ts +159 -26
  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 +368 -90
  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 +18 -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 +60 -21
  208. package/types/src/primitives/Range.d.ts +105 -25
  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/FunctionArguments.d.ts +22 -0
  229. package/types/src/scripting/FunctionCollection.d.ts +41 -11
  230. package/types/src/scripting/IFunctionCollection.d.ts +41 -0
  231. package/types/src/scripting/IModule.d.ts +25 -0
  232. package/types/src/scripting/IModuleCollection.d.ts +17 -0
  233. package/types/src/scripting/IScript.d.ts +18 -0
  234. package/types/src/scripting/Module.d.ts +34 -6
  235. package/types/src/scripting/ModuleCollection.d.ts +17 -12
  236. package/types/src/scripting/Runtime.d.ts +15 -0
  237. package/types/src/scripting/Scripts.d.ts +2 -0
  238. package/types/src/scripting/TypedFunction.d.ts +197 -4
  239. package/types/src/scripting/_FunctionIndex.d.ts +5 -0
  240. package/types/src/scripting/_ModuleUtils.d.ts +11 -1
  241. package/types/src/scripting/_ScriptUtils.d.ts +3 -0
  242. package/types/src/scripting/declarations.browser.d.ts +10 -0
  243. package/types/src/scripting/declarations.d.ts +49 -0
  244. package/types/src/scripting/declarations.node.d.ts +9 -0
  245. package/types/src/scripting/index.d.ts +3 -0
  246. package/types/src/selection/IRangeSelection.d.ts +9 -4
  247. package/types/src/selection/RangeSelection.d.ts +2 -0
  248. package/types/src/shape/IShape.d.ts +41 -3
  249. package/types/src/shape/Shape.d.ts +10 -0
  250. package/types/src/shape/_ShapeXml.d.ts +28 -0
  251. package/types/src/sheet/CellRegion.d.ts +6 -0
  252. package/types/src/sheet/ICellContainerOptions.d.ts +50 -0
  253. package/types/src/sheet/ISheet.d.ts +224 -41
  254. package/types/src/sheet/ISheetCollection.d.ts +2 -5
  255. package/types/src/sheet/NamedCellRange.d.ts +16 -7
  256. package/types/src/sheet/Sheet.d.ts +757 -114
  257. package/types/src/sheet/SheetCell.d.ts +81 -21
  258. package/types/src/sheet/SheetCollection.d.ts +19 -8
  259. package/types/src/sheet/SheetRange.d.ts +65 -14
  260. package/types/src/sheet/SheetRanges.d.ts +4 -6
  261. package/types/src/sheet/_CellBuffer.d.ts +214 -0
  262. package/types/src/sheet/_InvalidSheetRange.d.ts +5 -5
  263. package/types/src/sheet/_ListenerAnchor.d.ts +104 -0
  264. package/types/src/sheet/_RangeStateSweep.d.ts +16 -0
  265. package/types/src/sheet/_ScalarListFactory.d.ts +61 -0
  266. package/types/src/sheet/_SheetAutoFillUtils.d.ts +74 -0
  267. package/types/src/sheet/_SheetAutoFitUtils.d.ts +28 -0
  268. package/types/src/sheet/_SheetEvents.d.ts +43 -0
  269. package/types/src/sheet/_SheetFilterUtils.d.ts +32 -1
  270. package/types/src/sheet/_SheetIntents.d.ts +250 -0
  271. package/types/src/sheet/_SheetMutations.d.ts +179 -59
  272. package/types/src/sheet/_SheetStateReader.d.ts +16 -10
  273. package/types/src/sheet/_SheetStateTypes.d.ts +57 -73
  274. package/types/src/sheet/_SheetUtils.d.ts +2 -18
  275. package/types/src/sheet/_WatchAnchor.d.ts +93 -0
  276. package/types/src/sheet/spatial/HeldFormulaEntry.d.ts +36 -0
  277. package/types/src/sheet/spatial/index.d.ts +1 -0
  278. package/types/src/sheet/style/SheetCellStyle.d.ts +91 -64
  279. package/types/src/sheet/style/SheetDirectStyle.d.ts +16 -5
  280. package/types/src/sheet/style/_Resolvers.d.ts +5 -3
  281. package/types/src/sheet/style/_StyleUtils.d.ts +37 -7
  282. package/types/src/sheetHeader/ISheetHeader.d.ts +2 -0
  283. package/types/src/sheetHeader/SheetHeader.d.ts +14 -0
  284. package/types/src/sheetProtection/ISheetProtection.d.ts +41 -7
  285. package/types/src/sheetProtection/SheetProtection.d.ts +12 -0
  286. package/types/src/sheetView/ISheetView.d.ts +45 -1
  287. package/types/src/sheetView/SheetView.d.ts +11 -0
  288. package/types/src/slicer/ISlicer.d.ts +2 -0
  289. package/types/src/slicer/Slicer.d.ts +2 -0
  290. package/types/src/sort/ISort.d.ts +2 -0
  291. package/types/src/string/IStringCollection.d.ts +5 -0
  292. package/types/src/string/StringCollection.d.ts +6 -6
  293. package/types/src/style/INamedStyleCollection.d.ts +72 -0
  294. package/types/src/style/IStyle.d.ts +30 -10
  295. package/types/src/style/IStyleCollection.d.ts +63 -42
  296. package/types/src/style/ITableStyleCollection.d.ts +89 -0
  297. package/types/src/style/NamedStyleCollection.d.ts +39 -0
  298. package/types/src/style/StyleCollection.d.ts +41 -5
  299. package/types/src/style/TableStyleCollection.d.ts +49 -0
  300. package/types/src/style/_BuiltInStyleDefs.d.ts +3 -3
  301. package/types/src/style/index.d.ts +4 -0
  302. package/types/src/table/AnchoredTable.d.ts +644 -68
  303. package/types/src/table/AutoTable.d.ts +5 -5
  304. package/types/src/table/ITable.d.ts +228 -30
  305. package/types/src/table/ITableCollection.d.ts +2 -0
  306. package/types/src/table/TableCollection.d.ts +19 -8
  307. package/types/src/table/_FilterField.d.ts +7 -5
  308. package/types/src/table/_NamedTable.d.ts +17 -1
  309. package/types/src/table/_NamedTableSource.d.ts +1 -0
  310. package/types/src/table/_SortField.d.ts +2 -0
  311. package/types/src/table/_TableColumn.d.ts +13 -2
  312. package/types/src/table/_TableMessages.d.ts +1 -0
  313. package/types/src/table/_TableUtils.d.ts +40 -0
  314. package/types/src/text/Bullet.d.ts +4 -0
  315. package/types/src/text/ITextFrame.d.ts +25 -1
  316. package/types/src/text/TextBoxAlignment.d.ts +15 -6
  317. package/types/src/text/TextFrame.d.ts +4 -0
  318. package/types/src/text/TextLine.d.ts +4 -0
  319. package/types/src/text/TextParagraph.d.ts +4 -0
  320. package/types/src/text/TextRun.d.ts +9 -0
  321. package/types/src/text/TextStacked.d.ts +83 -0
  322. package/types/src/text/index.d.ts +1 -0
  323. package/types/src/theme/ITheme.d.ts +2 -0
  324. package/types/src/theme/IThemeCollection.d.ts +2 -0
  325. package/types/src/theme/ThemeCollection.d.ts +8 -7
  326. package/types/src/transaction/ITransaction.d.ts +238 -36
  327. package/types/src/transaction/Transaction.d.ts +99 -11
  328. package/types/src/type/AbstractCollection.d.ts +101 -0
  329. package/types/src/type/ICollection.d.ts +117 -0
  330. package/types/src/type/ITypes.d.ts +9 -7
  331. package/types/src/type/index.d.ts +1 -0
  332. package/types/src/utils/_CSSUtils.d.ts +3 -3
  333. package/types/src/workbook/IWorkbook.d.ts +171 -40
  334. package/types/src/workbook/Workbook.d.ts +103 -7
  335. package/types/src/workbook/_WorkbookIntents.d.ts +36 -0
  336. package/types/src/workbookProtection/IWorkbookProtection.d.ts +7 -0
  337. package/types/src/workbookProtection/WorkbookProtection.d.ts +3 -0
  338. package/types/src/workbookView/IWorkbookView.d.ts +12 -0
  339. package/types/src/workbookView/WorkbookView.d.ts +5 -0
  340. package/browser/cjs/BF14ZEAnaqxXroSj.cjs +0 -1
  341. package/browser/cjs/BXtvdT1Z-MsB_o5F.cjs +0 -1
  342. package/browser/cjs/Bc4JjVVZfFo3R4He.cjs +0 -33
  343. package/browser/cjs/CD2RXdnfqSYNc6gX.cjs +0 -57
  344. package/browser/cjs/DcLpXGexEtOxi-dD.cjs +0 -1
  345. package/browser/esm/0Mj5WKM362q6CECb.mjs +0 -824
  346. package/browser/esm/CPTtL2f6_4iblmFM.mjs +0 -4436
  347. package/browser/esm/CoA-sUxjiIUIpTUF.mjs +0 -109
  348. package/browser/esm/Dy4Sdpju1T2icURu.mjs +0 -50854
  349. package/node/esm/BtGxbEbBm79YvF_k.mjs +0 -843
  350. package/node/esm/DqgWsVXROpSgKq6c.mjs +0 -114
  351. package/types/src/cellRange/_GraphNode.d.ts +0 -38
  352. package/types/src/dataValidation/_Utils.d.ts +0 -10
  353. package/types/src/sheet/listener/RangesListener.d.ts +0 -32
  354. package/types/src/sheet/listener/RangesListenerEntry.d.ts +0 -19
  355. package/types/src/sheet/listener/index.d.ts +0 -3
@@ -7,10 +7,11 @@ import { ITransaction } from '../transaction';
7
7
  import { IResource, IResourceCollection } from '../resource';
8
8
  import { IStringCollection } from '../string';
9
9
  import { IProtection } from '../protection';
10
- import { IComment } from '../comment';
10
+ import { IComment, ICommentCollection } from '../comment';
11
11
  import { IColor } from '../color';
12
12
  import { IHyperlink } from '../hyperlink';
13
13
  import { ISort } from '../sort';
14
+ import { IAutoFill } from '../autoFill';
14
15
  import { IAnchored } from '../anchored';
15
16
  import { Anchored } from '../anchored/Anchored';
16
17
  import { IAnchoredMap } from '../anchored/IAnchoredMap';
@@ -18,38 +19,48 @@ import { ITable, ITableCollection } from '../table';
18
19
  import { NamedTableSource } from '../table/_NamedTableSource';
19
20
  import { AnchoredTable } from '../table/AnchoredTable';
20
21
  import { INamedCollection } from '../named';
22
+ import { IModuleCollection } from '../scripting';
23
+ import { ModuleCollection } from '../scripting/ModuleCollection';
21
24
  import { IMovable, IMovableCollection } from '../movable';
25
+ import { IChartCollection } from '../chart';
22
26
  import { IPicture } from '../picture';
27
+ import { Chart } from '../chart/Chart';
28
+ import { IPivotTable, IPivotTableCollection } from '../pivot';
23
29
  import { ICell } from '../cell';
24
30
  import { ICellRange, ICellRegions, ICellRanges } from '../cellRange';
25
31
  import { IStyle, IStyleCollection } from '../style';
26
32
  import { IRangeSelection } from '../selection';
27
33
  import { IConditionalFormat, IConditionalFormatCollection } from '../conditionalFormat';
28
34
  import { IProtectedRange, IProtectedRangeCollection } from '../protectedRange';
29
- import { Tuple, ISortedMap, ISparseGrid, ISpatialMap, ISpatialQuery } from '../collections';
35
+ import { Tuple, ISpatialMap, ISpatialQuery } from '../collections';
30
36
  import { ListenerEmitter } from '../listener/ListenerEmitter';
31
- import { RangeStats } from '../primitives';
32
37
  import { ICondition } from '../condition';
33
38
  import { ConditionalFormat } from '../conditionalFormat/ConditionalFormat';
34
39
  import { IDataValidationCollection, IDataValidation } from '../dataValidation';
35
40
  import { DataValidation } from '../dataValidation/DataValidation';
36
41
  import { ProtectedRange } from '../protectedRange/ProtectedRange';
42
+ import { Comment } from '../comment/Comment';
37
43
  import { ISheetProtection } from '../sheetProtection';
38
44
  import { ISheetHeader } from '../sheetHeader';
39
45
  import { ISheetView } from '../sheetView';
40
46
  import { ISheet } from './ISheet';
47
+ import { ScalarListFactory } from './_ScalarListFactory';
48
+ import { ListenerAnchor } from './_ListenerAnchor';
49
+ import { WatchAnchor } from './_WatchAnchor';
50
+ import { EventCategory, SheetEvents } from './_SheetEvents';
41
51
  import { SheetHeader } from '../sheetHeader/SheetHeader';
42
52
  import { SheetDirectStyle } from './style/SheetDirectStyle';
43
53
  import { IUsedRangeSpatialMap } from './style/UsedRangeSpatialMap';
44
- import { RangeState, CellState, State, MovableEntry, ICellRangeListenerEntry, ICellRangesListenerEntry, BeforeAfterRange, InternalTupleUpdate } from './_SheetStateTypes';
54
+ import { RangeState, CellState, State, MovableEntry, InternalTupleUpdate } from './_SheetStateTypes';
55
+ import { CellBuffer } from './_CellBuffer';
45
56
  import { SheetReadContext, GetTypedRangeOptions, OverFlowsAndStops } from './_SheetStateReader';
46
- import { AutoFillProjection, AutoFillPreviewCache } from './_SheetMutations';
57
+ import { AutoFillProjection, AutoFillPreviewCache } from './_SheetAutoFillUtils';
47
58
  import { ProtectionCheck } from './_SheetCoords';
48
- import { RangesListener, RangesListenerEntry } from './listener';
49
59
  import { SheetProtection } from '../sheetProtection/SheetProtection';
50
60
  import { SheetCellOptions } from './SheetCell';
51
61
  import { ICalculation } from '../calculation';
52
62
  import { ICalcGrid } from '../calculation/grid';
63
+ import * as _SheetFilterUtils from './_SheetFilterUtils';
53
64
  /**
54
65
  * Implementation of {@link ISheet}.
55
66
  */
@@ -73,6 +84,28 @@ export type SheetMutationContext = ReturnType<Sheet['_buildMutationCtx']>;
73
84
  * @internal
74
85
  */
75
86
  export type SheetCoordContext = ReturnType<Sheet['_buildCoordCtx']>;
87
+ /**
88
+ * What an operation hands {@link Sheet._commitWithDirectives} beyond its selection and options.
89
+ * @internal
90
+ */
91
+ export interface CommitDirectives {
92
+ /** Where an undo lands, when it is not the selection. See `Sheet._recordSelection`. */
93
+ undo?: Partial<IRangeSelection.Coords> | null;
94
+ /** The axis the selection is scrolled along. */
95
+ axis?: IRange.Axis;
96
+ /** Handed to the commit. */
97
+ commit?: ITransaction.StoreOperationOptions;
98
+ }
99
+ /** The sheet's legacy drawing as it holds it: {@link ISheet.LegacyDrawingJSON} with each image resolved to its {@link IResource}, so paste and `.sxl` keep working. */
100
+ interface LegacyDrawing {
101
+ xml: string;
102
+ images?: LegacyDrawingImage[];
103
+ }
104
+ interface LegacyDrawingImage {
105
+ /** The id {@link LegacyDrawing.xml} references this image by. */
106
+ id: string;
107
+ resource: IResource;
108
+ }
76
109
  export declare class Sheet implements ISheet {
77
110
  protected _options: ISheet.ConstructorOptions;
78
111
  protected _id: string;
@@ -81,19 +114,46 @@ export declare class Sheet implements ISheet {
81
114
  protected _transactions: ITransaction.IStore;
82
115
  protected _ownTransactions: boolean;
83
116
  protected _transactionsRemoveListener: IListener.Remove;
84
- protected _lastTransactionUUID: string | null;
117
+ protected _transactionsCloseRemoveListener: IListener.Remove;
118
+ /** The view's selection when the open root began. See {@link _onRootTransactionClose}. */
119
+ protected _selectionAtCommitStart: IRangeSelection.Coords | null;
85
120
  protected _emitter: ListenerEmitter<ISheet, ISheet.IListeners>;
86
121
  protected _initializing: boolean;
87
122
  protected _starting: Promise<void> | null;
88
123
  protected _strings: IStringCollection;
124
+ /** Makes the lists cell values are stored as, over `_strings`. */
125
+ protected _lists: ScalarListFactory;
89
126
  protected _ownStrings: boolean;
90
127
  protected _styles: IStyleCollection;
91
128
  protected _ownStyles: boolean;
92
129
  protected _stylesRemoveListener: IListener.Remove;
130
+ protected _languageRemoveListener?: IListener.Remove;
131
+ protected _regionalRemoveListener?: IListener.Remove;
93
132
  protected _stylesListener: IStyleCollection.IListeners;
94
133
  protected _normalStyleRanged: IProperties.ICellRanged<IStyle.Properties>;
95
134
  protected _resources: IResourceCollection;
96
135
  protected _ownResources: boolean;
136
+ /**
137
+ * The sheet's own legacy drawing and the header/footer's, held as read until the shapes in them
138
+ * have models of their own. Not sheet state: nothing edits them, so they neither transact nor
139
+ * notify.
140
+ */
141
+ protected _legacyDrawing: LegacyDrawing | null;
142
+ protected _legacyDrawingHF: LegacyDrawing | null;
143
+ /** The sheet's pivot tables, held as read for the same reason. */
144
+ protected _pivotTables: IPivotTable[];
145
+ protected _pivotTableCollection: IPivotTableCollection;
146
+ /**
147
+ * Anchored items whose delete this sheet announced itself.
148
+ *
149
+ * @remarks
150
+ * An item's `onDelete` reaches the sheet after the operation lands, and the sheet re-announces
151
+ * it as the collection's change — that is how a delete driven by a row or column removal is
152
+ * announced at all. An item deleted through its own `delete()` comes back to the sheet's
153
+ * `deleteFromContainer`, which announces inside the operation; it records the item here so the
154
+ * later `onDelete` is not a second announcement of the same delete.
155
+ */
156
+ protected _announcedDeletes: WeakSet<IAnchored>;
97
157
  protected _names: INamedCollection;
98
158
  /** Lazy sheet-anchored view over {@link _names} — see {@link getNames}. */
99
159
  protected _namesScoped: INamedCollection | null;
@@ -106,16 +166,22 @@ export declare class Sheet implements ISheet {
106
166
  protected _calculationScoped: ICalculation;
107
167
  protected _workbook: IWorkbook | null;
108
168
  protected _cacheTableColumnHeaders: TableColumnHeaders;
109
- protected _rangeStats: RangeStats;
110
169
  protected _tables: ITableCollection;
111
170
  protected _conditionals: IConditionalFormatCollection;
112
171
  protected _dataValidations: IDataValidationCollection;
113
172
  protected _protectedRanges: IProtectedRangeCollection;
173
+ protected _comments: ICommentCollection;
114
174
  protected _movables: IMovableCollection;
175
+ protected _charts: IChartCollection;
115
176
  protected _emitterMovables: ListenerEmitter<IMovableCollection, ICollection.IListeners>;
116
- protected _rangesListenerSorted: ISortedMap<number, RangesListener> | null;
117
- protected _rangeListenerSpatial: ISpatialMap<ICellRangeListenerEntry>;
118
- protected _rangesListenerMap: Map<number, ICellRangesListenerEntry>;
177
+ /**
178
+ * The callbacks for the reference nodes in `State.listeners`, keyed by node id.
179
+ *
180
+ * @remarks
181
+ * On the instance, never in state: a listener is an observer, not part of the document. An entry
182
+ * in the map with no callback here belongs to a snapshot this sheet no longer serves and is inert.
183
+ */
184
+ protected _listenerNodes: Map<number, ListenerNodeEntry>;
119
185
  protected _lastCellDecoded: {
120
186
  address: ICell.Address | null;
121
187
  coords: IRange.CellCoords | null;
@@ -156,6 +222,18 @@ export declare class Sheet implements ISheet {
156
222
  protected _protectionListener: IProtection.IListeners;
157
223
  protected _protectionRemoveListener: IListener.Remove;
158
224
  protected _tabColor: IColor | null;
225
+ /** VBA binding identity; carried from the file, never minted. See {@link ISheet.getCodeName}. */
226
+ protected _codeName: string | null;
227
+ protected _outlineSettings: Readonly<ISheet.OutlineSettings>;
228
+ protected _conditionalFormatCalculation: boolean;
229
+ /**
230
+ * Modules this sheet owns — see {@link getModules}.
231
+ *
232
+ * Built with the sheet rather than on first ask, because building one opens a transaction and
233
+ * `getModules()` is a READ: a lazy build would fold an initialization commit into whatever
234
+ * unrelated commit happened to be the tip, every time a report walked the sheets.
235
+ */
236
+ protected _modules: ModuleCollection;
159
237
  protected _runtime: IRuntime;
160
238
  protected _isDate1904: boolean;
161
239
  protected _colHeaders: SheetHeader;
@@ -172,6 +250,7 @@ export declare class Sheet implements ISheet {
172
250
  protected _emptyCell: ICell;
173
251
  protected _cellOptions: SheetCellOptions;
174
252
  protected _closed: boolean;
253
+ protected _cellBuffer: CellBuffer | null;
175
254
  protected _defaultColWidthCache: number | null;
176
255
  protected _defaultRowHeightCache: number | null;
177
256
  protected _defaultFontBoundsCache: Readonly<Size> | null;
@@ -189,6 +268,7 @@ export declare class Sheet implements ISheet {
189
268
  _getInternal(): {
190
269
  getSheet: () => ISheet;
191
270
  getState: () => Readonly<State>;
271
+ getCalcGrid: () => ICalcGrid;
192
272
  isDataColumn: () => boolean;
193
273
  createRange: (coords: Readonly<IRange.FixableCoords> | string, getOptions?: ICellRange.GetRangeOptions, readOnly?: string | null) => ICellRange;
194
274
  isContentful: (ranges: readonly IRange.Coords[], ignoreHidden?: boolean | IRange.Axis) => boolean;
@@ -201,11 +281,12 @@ export declare class Sheet implements ISheet {
201
281
  cellIterator: (options: CellState.IteratorOptions) => IterableIterator<ICellRange.Entry, ICellRange.Entry, IRange.CellCoords>;
202
282
  getVisible: (coords: readonly IRange.Coords[], options?: ICellRange.GetVisibleOptions) => readonly IRange.Coords[];
203
283
  getUsedCoords: (options?: ICellRange.GetRangeOptions) => IRange.Coords | null;
204
- updateTuples: (boundedTuples: Tuple.BoundedTuples<ICell.Update> | null, options?: ICellRange.UpdateCellsOptions, coordValidator?: CoordUtils.CoordValidator | null | undefined, internalOptions?: InternalTupleUpdate | null) => void;
284
+ updateTuples: (boundedTuples: Tuple.Region<ICell.Update> | null, options?: ICellRange.UpdateCellsOptions, coordValidator?: CoordUtils.CoordValidator | null | undefined, internalOptions?: InternalTupleUpdate | null) => void;
205
285
  merge: (ranges: readonly IRange.Coords[], options?: IRange.AxisSelection | ICellRange.MergeOptions | null) => void;
206
286
  unmerge: (ranges: readonly IRange.Coords[], options?: ITransaction.OperationOptions) => void;
207
287
  getMerges: (ranges: readonly IRange.Coords[], ignoreHidden?: boolean | IRange.Axis) => IRange.Coords[];
208
288
  insertFrom: (ranges: readonly IRange.Coords[], source: ICellRange.Address | ICellRange.ISnapshot, options?: ICellRange.InsertFromOptions) => Promise<IRange.Coords>;
289
+ canInsertFrom: (ranges: readonly IRange.Coords[], source: ICellRange.Address | ICellRange.ISnapshot, options?: ICellRange.InsertFromOptions) => boolean;
209
290
  insertCells: (ranges: readonly IRange.Coords[], options?: IRange.Axis | ICellRange.InsertOptions, coordValidator?: CoordUtils.CoordValidator) => void;
210
291
  deleteCells: (ranges: readonly IRange.Coords[], options?: IRange.Axis | ICellRange.DeleteOptions) => void;
211
292
  getStyle: (ranges: IRange.Coords[], anchor?: IRangeSelection.Coords, updateStyles?: (update: IStyle.Update, options?: IStyle.UpdateOptions) => void) => IStyle;
@@ -214,23 +295,32 @@ export declare class Sheet implements ISheet {
214
295
  getRangeStats: (coords: readonly IRange.Coords[], iteratorOptions?: ICellRange.GetStatsOptions) => IRangeStats;
215
296
  getDefaultShiftAxis: (coords?: IRange.Coords) => IRange.Axis;
216
297
  getDefaultSortCriteria: (rangeCoords: IRange.Coords, axis?: IRange.Axis, cell?: ICell.Address) => ISort.DefaultSortCriteria;
298
+ getDefaultAutoFillCriteria: (rangeCoords: IRange.Coords, direction?: IRange.Direction, destination?: IRange.Coords) => IAutoFill.DefaultCriteria | null;
217
299
  find: (ranges: readonly IRange.Coords[], options: string | ICellRange.FindOptions) => Iterator<ICell>;
218
300
  copyFrom: (destination: IRange.Coords, source: ICellRange.Address | ICellRange.ISnapshot, options?: ICellRange.CopyOptions) => Promise<IRange.Coords>;
219
301
  contentCounts: (ranges: readonly IRange.Coords[], types: ICell.Content[] | undefined, ignoreHidden?: boolean | IRange.Axis) => Partial<Record<ICell.Content, number>>;
220
302
  featureCounts: (ranges: readonly IRange.Coords[], features?: ICellRange.Feature | readonly ICellRange.Feature[], ignoreHidden?: boolean | IRange.Axis) => ICellRange.Counts;
221
303
  featureRegions: (bounds: IRange.Coords, requested: readonly ICellRange.Feature[], options?: ICellRange.GetRegionsOptions) => IRange.Coords[];
222
- dependencyRanges: (coords: IRange.Coords, kind: "precedents" | "dependents", direct: boolean) => ICellRanges | null;
223
- clear: (ranges: readonly IRange.Coords[], applyTo?: ICell.Content | null, options?: ITransaction.OperationOptions, excludeSorts?: boolean, isCut?: boolean) => void;
304
+ dependencyRanges: (coords: IRange.Coords, kind: "precedents" | "dependents", direct: boolean) => Promise<ICellRanges | null>;
305
+ clear: (ranges: readonly IRange.Coords[], applyTo?: ICell.Content | null, options?: ITransaction.OperationOptions, excludeSorts?: boolean, cutFrom?: IRange.Coords | null) => void;
224
306
  calculate: (ranges: ICellRanges.Coords, options?: ICalculation.CalculateOptions) => void;
225
307
  autoSelect: (options?: boolean | ICellRange.SelectOptions, selectionOverride?: Partial<IRangeSelection.Coords> | null, axis?: IRange.Axis) => Promise<IRange.Coords[]>;
308
+ beginCommit: (options?: ITransaction.StoreOperationOptions | string) => ITransaction;
309
+ recordSelection: (trans: ITransaction, selection: Partial<IRangeSelection.Coords>, options?: Pick<ICellRange.OperationOptions, "autoSelect" | "autoSelectRestore"> | null, undo?: Partial<IRangeSelection.Coords> | null, axis?: IRange.Axis) => void;
310
+ commitWithDirectives: (trans: ITransaction, selection: Partial<IRangeSelection.Coords> | null, options?: ICellRange.OperationOptions, directives?: CommitDirectives) => void;
226
311
  autoFit: (ranges: readonly IRange.Coords[], options?: ICellRange.AutoFitOptions) => void;
227
- addRangesListeners: (ranges: readonly IRange.Coords[], listener: ICellRange.Listener, options?: ICellRange.ListenerOptions) => IListener.Remove;
228
- addRangesListeners2: (ranges: readonly IRange.Coords[], listener: ICellRange.Listener, options: ICellRange.ListenerOptions | undefined, isRanges: boolean) => IListener.Remove;
312
+ getBestFit: (range: IRange.Coords, options?: ICellRange.BestFitOptions) => Size;
313
+ invalidateRendering: () => void;
314
+ addListenerNode: (ranges: readonly IRange.Coords[], listener: ICellRange.Listener, options?: ICellRange.ListenerOptions) => IListener.Remove;
315
+ addWatch: (coords: IRange.Coords, formula: ICalculation.IFormula | string, handlers: WatchAnchor.Handlers, origin?: IRange.CellCoords, options?: ICellRange.WatchOptions) => IListener.Remove;
229
316
  surroundingRegion: (range: IRange.Coords, options?: ICellRange.GetSurroundingOptions) => IRange.Coords;
317
+ getTraverseRegion: (cell: IRange.CellCoords, axis: IRange.Axis, reverse: boolean) => IRange.Coords | null;
230
318
  sort: (coords: Readonly<IRange.Coords>, options?: boolean | ISort.Options[] | (ISort.RangeOptions & ITransaction.OperationOptions)) => IRange.Coords;
231
319
  filter: (coords: Readonly<IRange.Coords>, condition: ICondition.Input | ICondition.RangeOptions, options?: ITransaction.OperationOptions) => Promise<IRange.Coords>;
320
+ evalFilter: (coords: Readonly<IRange.Coords>, condition: ICondition.Input | ICondition.RangeOptions | null | undefined) => Promise<_SheetFilterUtils.FilterRuns>;
321
+ applyFilterRuns: (runs: _SheetFilterUtils.FilterRuns, options?: ITransaction.OperationOptions) => void;
232
322
  setHyperlinks: (ranges: readonly ISpatialMap.Entry<IHyperlink.Update>[], defaultUpdate?: IHyperlink.Update, options?: ITransaction.OperationOptions) => void;
233
- setComments: (ranges: readonly ISpatialMap.Entry<IComment.Properties>[], comments?: IComment.JSON | null, options?: ITransaction.OperationOptions) => void;
323
+ setComments: (ranges: readonly ISpatialMap.Entry<IComment.Update>[], comments?: IComment.Update | IComment.JSON, options?: ITransaction.OperationOptions) => void;
234
324
  getBoundsAtCoords: (coords: IRange.Coords) => Bounds;
235
325
  extendRange: (direction: IRange.Direction, cell: IRange.CellCoords) => Readonly<IRange.Coords>;
236
326
  createTupleBuilder: <T>(transpose?: boolean) => Tuple.IBuilder<T>;
@@ -247,30 +337,22 @@ export declare class Sheet implements ISheet {
247
337
  * @internal
248
338
  */
249
339
  protected _getReadCtx(): SheetReadContext;
250
- /** @internal Reconciled error-VALUE view; see {@link _getErrorSpatialReconciled}. */
251
- protected _errorReconciled: {
252
- grid: ISparseGrid<Scalar> | null;
253
- epoch: number;
254
- spatial: ISpatialMap<boolean>;
255
- } | null;
256
340
  /**
257
- * @internal Bumped whenever `cellValuesGrid` is mutated IN PLACE (calc realize, re-load) —
258
- * grid identity alone catches every other mutation (they clone).
259
- */
260
- protected _errorEpoch: number;
261
- /**
262
- * The reconciled error-VALUE spatial backing `RangeState.Type.Error` — merge-on-READ.
341
+ * The sheet's grid: the synchronous half of the calculation service for this sheet
342
+ * (DESIGN-CALC-SERVICE §13.23, §13.24), holding everything a cell contains - the formulas, the
343
+ * values and the indexes over them - and forwarding every verb to its backend.
263
344
  *
264
345
  * @remarks
265
- * `state.errorSpatial` is write-path only and stale for formula cells after a recalc, so the
266
- * truth is the current values: built here by one scan of `cellValuesGrid`, cached against
267
- * (grid identity, in-place epoch). The calc path pays nothing; the scan runs at agent cadence
268
- * (first error-aware read after a change) and multi-altitude reads share the cache. When the
269
- * calc executor emits error deltas, `state.errorSpatial` becomes fully fresh and this method
270
- * reduces to returning it.
346
+ * A plain field, NOT part of `State` (§13.24 a): one grid serves every version of the sheet, so
347
+ * a versioned slot would answer with the CURRENT maps from a historic record - which the sheet
348
+ * reads (`_resolveInheritedFormats`, the snapshot sheets). What the grid HOLDS versions, in its
349
+ * own record; its reads take the transaction to answer for. Opened by `_fromJSON`, so it is
350
+ * absent until then; a snapshot sheet is handed the source's grid by `_clone`.
271
351
  * @internal
272
352
  */
273
- protected _getErrorSpatialReconciled(): ISpatialMap<boolean>;
353
+ protected _calcGrid: ICalcGrid;
354
+ /** `false` for a snapshot sheet, which holds its source's grid and must not close it. */
355
+ protected _ownsCalcGrid: boolean;
274
356
  /** @internal Cached mutation-engine context. See {@link SheetMutationContext}. */
275
357
  protected _mutationCtx: ReturnType<Sheet['_buildMutationCtx']> | null;
276
358
  /** @internal Access the mutation context (cached). See {@link SheetMutationContext}. */
@@ -288,21 +370,19 @@ export declare class Sheet implements ISheet {
288
370
  readonly columnHeadersShiftCallback: SheetHeader.ShiftCallback | null;
289
371
  getEntireCoords: () => IRange.Coords;
290
372
  getView: () => ISheetView;
291
- beginCommit: (options?: ITransaction.StoreOperationOptions<CommitView> | string) => ITransaction;
373
+ beginCommit: (options?: ITransaction.StoreOperationOptions | string) => ITransaction;
292
374
  updateState: (updateState?: Partial<State>, options?: ITransaction.OperationOptions | string) => State;
293
375
  getState: () => Readonly<State>;
294
376
  stateFor: (trans: ITransaction) => State;
377
+ readonly calcGrid: ICalcGrid;
295
378
  /** Invalidate the cached used-range read (a mutation may change the used bounds). */
296
379
  invalidateUsedCoords: () => void;
297
380
  validateCoords: (coords: IRange.Coords, oobMessage?: string, allowOutOfBounds?: boolean) => void;
298
381
  protectionCheck: (check?: ProtectionCheck | null, coords?: Readonly<IRange.Coords> | readonly IRange.Coords[] | null, action?: string | null) => void;
299
382
  getDefaultShiftAxis: (coords?: IRange.Coords) => IRange.Axis;
300
- processListenerShift: (rangesListenerMap: Map<number, ICellRangesListenerEntry>, beforeAfterMap: Map<number, BeforeAfterRange>, beforeStates: Map<number, ICellRangesListenerEntry>, options: ISpatialMap.ShiftDetails<ICellRangeListenerEntry>) => ISpatialMap.Entry<ICellRangeListenerEntry>[] | void;
301
383
  processLayoutChange: () => void;
302
384
  markColumnHeaderTableNames: () => void;
303
- commitAndAutoSelect: (trans: ITransaction, selection: Partial<IRangeSelection.Coords> | null, selectOptions?: boolean | ICellRange.SelectOptions, commitOptions?: ITransaction.StoreOperationOptions<CommitView>, axis?: IRange.Axis) => Promise<IRange.Coords[]>;
304
- /** Read-clone-write the `_rangeStats` cache against a new values grid. */
305
- cloneRangeStats: (grid: ISparseGrid<Scalar>) => void;
385
+ commitWithDirectives: (trans: ITransaction, selection: Partial<IRangeSelection.Coords> | null, options?: ICellRange.OperationOptions, directives?: CommitDirectives) => void;
306
386
  readonly styles: IStyleCollection;
307
387
  getRangedEntries: <T, E = T>(spatial: ISpatialQuery, ranges: readonly IRange.Coords[], options?: GetTypedRangeOptions<T, E>, spatialSort?: boolean) => T[];
308
388
  createSparseBuilder: (options?: ICellRange.SparseBuilderOptions, sheetRange?: ICellRange | null, internal?: InternalTupleUpdate) => ICellRange.SparseBuilder;
@@ -312,24 +392,34 @@ export declare class Sheet implements ISheet {
312
392
  content: IUsedRangeSpatialMap<SheetDirectStyle>;
313
393
  }) => IUsedRangeSpatialMap<SheetDirectStyle>;
314
394
  autoFit: (ranges: readonly IRange.Coords[], options?: ICellRange.AutoFitOptions) => void;
395
+ recordAutoFormat: (trans: ITransaction) => void;
396
+ recordSkipProtectionCheck: (trans: ITransaction) => void;
397
+ recordFreezePanes: (trans: ITransaction, before: IRange.CellCoords, after: IRange.CellCoords) => void;
398
+ recordSelection: (trans: ITransaction, selection: Partial<IRangeSelection.Coords>, options?: Pick<ICellRange.OperationOptions, "autoSelect" | "autoSelectRestore"> | null, undo?: Partial<IRangeSelection.Coords> | null, axis?: IRange.Axis) => void;
315
399
  notify: (key: keyof ISheet.IListeners) => void | Promise<any>;
316
400
  getRange: (address?: ICellRange.Address, options?: ICellRange.GetRangeOptions) => ICellRange;
317
401
  getSelection: () => IRangeSelection;
318
402
  getMerges: (ranges: readonly IRange.Coords[], ignoreHidden?: boolean | IRange.Axis) => IRange.Coords[];
319
403
  indexMerges: (mergeInserts: IRange.Coords[] | null, mergeRemoves?: IRange.Coords[] | null) => void;
320
- validateOrRemoveOverlaps: (rangeCoords: IRange.Coords, type: string, table?: ITable | null, removeIfContains?: boolean) => void;
404
+ validateOrRemoveOverlaps: (rangeCoords: IRange.Coords, type: string, table?: ITable | null, removeIfContains?: boolean, absorbAutoTable?: boolean) => void;
321
405
  autoSelect: (options?: boolean | ICellRange.SelectOptions, selectionOverride?: Partial<IRangeSelection.Coords> | null, axis?: IRange.Axis) => Promise<IRange.Coords[]>;
322
406
  readonly isDataColumn: boolean;
323
407
  readonly strings: IStringCollection;
408
+ readonly lists: ScalarListFactory;
324
409
  readonly cellOptions: SheetCellOptions;
325
410
  readonly runtime: IRuntime;
326
411
  getProtection: () => ISheetProtection;
327
412
  hasRangedEntries: (key: keyof State, range: IRange.Coords) => boolean;
328
413
  rangeStateIterator: (options: RangeState.IteratorOptions) => RangeState.Iterator;
329
- addEvent: (type: keyof CommitEvents, value: any) => void;
414
+ recordChange: (trans: ITransaction, category: EventCategory, ranges: readonly IRange.Coords[] | null | undefined) => void;
415
+ loadComments: (map: IAnchoredMap<IComment, IComment.JSON>, refs: IRange.JSONReference<IComment.JSON>[]) => IAnchoredMap<IComment, IComment.JSON>;
416
+ newCommentJSON: (modifiers: IComment.Modifiers) => IComment.JSON;
417
+ notifyCommentsChange: () => void;
418
+ recordFormulasEntered: (trans: ITransaction, ranges: readonly IRange.Coords[] | null | undefined) => void;
330
419
  getTables: () => ITableCollection;
331
420
  getAutoTable: () => ITable | null;
332
421
  cellIterator: (options: CellState.IteratorOptions) => IterableIterator<ICellRange.Entry, ICellRange.Entry, IRange.CellCoords>;
422
+ cellStateIterator: (options?: CellState.IteratorOptions) => CellState.Iterator;
333
423
  rangeToCoords: (address: ICellRange.Address, protectionCheck?: ProtectionCheck | null, lookupNames?: boolean) => IRange.Coords;
334
424
  getCell: (address?: ICell.Address) => ICell;
335
425
  createCell: (update: ICell.Update, coords?: IRange.CellCoords | null) => ICell;
@@ -351,6 +441,7 @@ export declare class Sheet implements ISheet {
351
441
  readonly internal: {
352
442
  getSheet: () => ISheet;
353
443
  getState: () => Readonly<State>;
444
+ getCalcGrid: () => ICalcGrid;
354
445
  isDataColumn: () => boolean;
355
446
  createRange: (coords: Readonly<IRange.FixableCoords> | string, getOptions?: ICellRange.GetRangeOptions, readOnly?: string | null) => ICellRange;
356
447
  isContentful: (ranges: readonly IRange.Coords[], ignoreHidden?: boolean | IRange.Axis) => boolean;
@@ -363,11 +454,12 @@ export declare class Sheet implements ISheet {
363
454
  cellIterator: (options: CellState.IteratorOptions) => IterableIterator<ICellRange.Entry, ICellRange.Entry, IRange.CellCoords>;
364
455
  getVisible: (coords: readonly IRange.Coords[], options?: ICellRange.GetVisibleOptions) => readonly IRange.Coords[];
365
456
  getUsedCoords: (options?: ICellRange.GetRangeOptions) => IRange.Coords | null;
366
- updateTuples: (boundedTuples: Tuple.BoundedTuples<ICell.Update> | null, options?: ICellRange.UpdateCellsOptions, coordValidator?: CoordUtils.CoordValidator | null | undefined, internalOptions?: InternalTupleUpdate | null) => void;
457
+ updateTuples: (boundedTuples: Tuple.Region<ICell.Update> | null, options?: ICellRange.UpdateCellsOptions, coordValidator?: CoordUtils.CoordValidator | null | undefined, internalOptions?: InternalTupleUpdate | null) => void;
367
458
  merge: (ranges: readonly IRange.Coords[], options?: IRange.AxisSelection | ICellRange.MergeOptions | null) => void;
368
459
  unmerge: (ranges: readonly IRange.Coords[], options?: ITransaction.OperationOptions) => void;
369
460
  getMerges: (ranges: readonly IRange.Coords[], ignoreHidden?: boolean | IRange.Axis) => IRange.Coords[];
370
461
  insertFrom: (ranges: readonly IRange.Coords[], source: ICellRange.Address | ICellRange.ISnapshot, options?: ICellRange.InsertFromOptions) => Promise<IRange.Coords>;
462
+ canInsertFrom: (ranges: readonly IRange.Coords[], source: ICellRange.Address | ICellRange.ISnapshot, options?: ICellRange.InsertFromOptions) => boolean;
371
463
  insertCells: (ranges: readonly IRange.Coords[], options?: IRange.Axis | ICellRange.InsertOptions, coordValidator?: CoordUtils.CoordValidator) => void;
372
464
  deleteCells: (ranges: readonly IRange.Coords[], options?: IRange.Axis | ICellRange.DeleteOptions) => void;
373
465
  getStyle: (ranges: IRange.Coords[], anchor?: IRangeSelection.Coords, updateStyles?: (update: IStyle.Update, options?: IStyle.UpdateOptions) => void) => IStyle;
@@ -376,23 +468,32 @@ export declare class Sheet implements ISheet {
376
468
  getRangeStats: (coords: readonly IRange.Coords[], iteratorOptions?: ICellRange.GetStatsOptions) => IRangeStats;
377
469
  getDefaultShiftAxis: (coords?: IRange.Coords) => IRange.Axis;
378
470
  getDefaultSortCriteria: (rangeCoords: IRange.Coords, axis?: IRange.Axis, cell?: ICell.Address) => ISort.DefaultSortCriteria;
471
+ getDefaultAutoFillCriteria: (rangeCoords: IRange.Coords, direction?: IRange.Direction, destination?: IRange.Coords) => IAutoFill.DefaultCriteria | null;
379
472
  find: (ranges: readonly IRange.Coords[], options: string | ICellRange.FindOptions) => Iterator<ICell>;
380
473
  copyFrom: (destination: IRange.Coords, source: ICellRange.Address | ICellRange.ISnapshot, options?: ICellRange.CopyOptions) => Promise<IRange.Coords>;
381
474
  contentCounts: (ranges: readonly IRange.Coords[], types: ICell.Content[] | undefined, ignoreHidden?: boolean | IRange.Axis) => Partial<Record<ICell.Content, number>>;
382
475
  featureCounts: (ranges: readonly IRange.Coords[], features?: ICellRange.Feature | readonly ICellRange.Feature[], ignoreHidden?: boolean | IRange.Axis) => ICellRange.Counts;
383
476
  featureRegions: (bounds: IRange.Coords, requested: readonly ICellRange.Feature[], options?: ICellRange.GetRegionsOptions) => IRange.Coords[];
384
- dependencyRanges: (coords: IRange.Coords, kind: "precedents" | "dependents", direct: boolean) => ICellRanges | null;
385
- clear: (ranges: readonly IRange.Coords[], applyTo?: ICell.Content | null, options?: ITransaction.OperationOptions, excludeSorts?: boolean, isCut?: boolean) => void;
477
+ dependencyRanges: (coords: IRange.Coords, kind: "precedents" | "dependents", direct: boolean) => Promise<ICellRanges | null>;
478
+ clear: (ranges: readonly IRange.Coords[], applyTo?: ICell.Content | null, options?: ITransaction.OperationOptions, excludeSorts?: boolean, cutFrom?: IRange.Coords | null) => void;
386
479
  calculate: (ranges: ICellRanges.Coords, options?: ICalculation.CalculateOptions) => void;
387
480
  autoSelect: (options?: boolean | ICellRange.SelectOptions, selectionOverride?: Partial<IRangeSelection.Coords> | null, axis?: IRange.Axis) => Promise<IRange.Coords[]>;
481
+ beginCommit: (options?: ITransaction.StoreOperationOptions | string) => ITransaction;
482
+ recordSelection: (trans: ITransaction, selection: Partial<IRangeSelection.Coords>, options?: Pick<ICellRange.OperationOptions, "autoSelect" | "autoSelectRestore"> | null, undo?: Partial<IRangeSelection.Coords> | null, axis?: IRange.Axis) => void;
483
+ commitWithDirectives: (trans: ITransaction, selection: Partial<IRangeSelection.Coords> | null, options?: ICellRange.OperationOptions, directives?: CommitDirectives) => void;
388
484
  autoFit: (ranges: readonly IRange.Coords[], options?: ICellRange.AutoFitOptions) => void;
389
- addRangesListeners: (ranges: readonly IRange.Coords[], listener: ICellRange.Listener, options?: ICellRange.ListenerOptions) => IListener.Remove;
390
- addRangesListeners2: (ranges: readonly IRange.Coords[], listener: ICellRange.Listener, options: ICellRange.ListenerOptions | undefined, isRanges: boolean) => IListener.Remove;
485
+ getBestFit: (range: IRange.Coords, options?: ICellRange.BestFitOptions) => Size;
486
+ invalidateRendering: () => void;
487
+ addListenerNode: (ranges: readonly IRange.Coords[], listener: ICellRange.Listener, options?: ICellRange.ListenerOptions) => IListener.Remove;
488
+ addWatch: (coords: IRange.Coords, formula: ICalculation.IFormula | string, handlers: WatchAnchor.Handlers, origin?: IRange.CellCoords, options?: ICellRange.WatchOptions) => IListener.Remove;
391
489
  surroundingRegion: (range: IRange.Coords, options?: ICellRange.GetSurroundingOptions) => IRange.Coords;
490
+ getTraverseRegion: (cell: IRange.CellCoords, axis: IRange.Axis, reverse: boolean) => IRange.Coords | null;
392
491
  sort: (coords: Readonly<IRange.Coords>, options?: boolean | ISort.Options[] | (ISort.RangeOptions & ITransaction.OperationOptions)) => IRange.Coords;
393
492
  filter: (coords: Readonly<IRange.Coords>, condition: ICondition.Input | ICondition.RangeOptions, options?: ITransaction.OperationOptions) => Promise<IRange.Coords>;
493
+ evalFilter: (coords: Readonly<IRange.Coords>, condition: ICondition.Input | ICondition.RangeOptions | null | undefined) => Promise<_SheetFilterUtils.FilterRuns>;
494
+ applyFilterRuns: (runs: _SheetFilterUtils.FilterRuns, options?: ITransaction.OperationOptions) => void;
394
495
  setHyperlinks: (ranges: readonly ISpatialMap.Entry<IHyperlink.Update>[], defaultUpdate?: IHyperlink.Update, options?: ITransaction.OperationOptions) => void;
395
- setComments: (ranges: readonly ISpatialMap.Entry<IComment.Properties>[], comments?: IComment.JSON | null, options?: ITransaction.OperationOptions) => void;
496
+ setComments: (ranges: readonly ISpatialMap.Entry<IComment.Update>[], comments?: IComment.Update | IComment.JSON, options?: ITransaction.OperationOptions) => void;
396
497
  getBoundsAtCoords: (coords: IRange.Coords) => Bounds;
397
498
  extendRange: (direction: IRange.Direction, cell: IRange.CellCoords) => Readonly<IRange.Coords>;
398
499
  createTupleBuilder: <T>(transpose?: boolean) => Tuple.IBuilder<T>;
@@ -466,7 +567,7 @@ export declare class Sheet implements ISheet {
466
567
  * @param searchTypes If value is in record it will be search, boolean flag is used for fullyEnclosed.
467
568
  * @internal
468
569
  */
469
- protected _collectRanges(queryCoords: IRange.Coords, rangesByType?: ISpatialMap.Entry<RangeState.Intersection>[], searchTypes?: boolean | RangeState.SearchTypes | null, state?: State, injectReferences?: IRange.JSONReference<any>[][]): void;
570
+ protected _collectRanges(queryCoords: IRange.Coords, rangesByType?: ISpatialMap.Entry<RangeState.Intersection>[], searchTypes?: boolean | RangeState.SearchTypes | null, state?: State, injectReferences?: IRange.JSONReference<any>[][], transaction?: ITransaction | null): void;
470
571
  /**
471
572
  * This wraps the stateIterator with a ICell.IteratorContext.
472
573
  * // TODO - **PERFORMANCE** We are creating a new CellState on very call
@@ -515,6 +616,21 @@ export declare class Sheet implements ISheet {
515
616
  /** @internal Logic lives in `_SheetMutations.updateStyles`. */
516
617
  protected _updateStyles(ranges: readonly ISpatialMap.Entry<IStyle.Update>[], defaultUpdate?: IStyle.Update, // we do this because updateTuples may update each
517
618
  options?: IStyle.UpdateOptions, calcedNumberFormat?: boolean): void;
619
+ /**
620
+ * Holds a style set on one cell in the buffer the cell writes of an open transaction are held in
621
+ * ({@link CellBuffer.holdStyle}).
622
+ *
623
+ * @returns `false` if it is to be written as it comes.
624
+ * @internal
625
+ */
626
+ protected _holdStyle(range: ISpatialMap.Entry<IStyle.Update>, defaultUpdate?: IStyle.Update, options?: IStyle.UpdateOptions): boolean;
627
+ /**
628
+ * Whether a style update written to one cell changes that cell alone; a caller's callback is not
629
+ * known to. (The style typed input implies is not asked: it is a number format, a quote prefix or
630
+ * a wrap.)
631
+ * @internal
632
+ */
633
+ protected _isLocalStyle(state: Readonly<State>, rowIndex: number, colIndex: number, update: IStyle.Update): boolean;
518
634
  /** @internal */
519
635
  protected _createSparseBuilder(options?: ICellRange.SparseBuilderOptions, sheetRange?: ICellRange | null, internal?: InternalTupleUpdate): ICellRange.SparseBuilder;
520
636
  /**
@@ -522,11 +638,20 @@ export declare class Sheet implements ISheet {
522
638
  * Logic lives in `_SheetMutations.updateTuples`.
523
639
  * @internal
524
640
  */
525
- protected _updateTuples(boundedTuples: Tuple.BoundedTuples<ICell.Update> | null, options?: ICellRange.UpdateCellsOptions, coordValidator?: CoordUtils.CoordValidator | null | undefined, internalOptions?: InternalTupleUpdate | null): void;
641
+ protected _updateTuples(boundedTuples: Tuple.Region<ICell.Update> | null, options?: ICellRange.UpdateCellsOptions, coordValidator?: CoordUtils.CoordValidator | null | undefined, internalOptions?: InternalTupleUpdate | null): void;
642
+ /**
643
+ * The buffer single-cell writes made inside an open transaction are held in ({@link CellBuffer}).
644
+ * @internal
645
+ */
646
+ protected _getCellBuffer(): CellBuffer;
526
647
  /** @internal */
527
648
  protected _sort(coords: Readonly<IRange.Coords>, options?: boolean | ISort.Options[] | ISort.RangeOptions & ITransaction.OperationOptions): IRange.Coords;
528
649
  /** @internal */
529
650
  protected _filter(coords: Readonly<IRange.Coords>, condition: ICondition.Input | ICondition.RangeOptions, options?: ITransaction.OperationOptions): Promise<IRange.Coords>;
651
+ /** @internal The read-only half of {@link _filter}: settles the runs without writing. */
652
+ protected _evalFilter(coords: Readonly<IRange.Coords>, condition: ICondition.Input | ICondition.RangeOptions | null | undefined): Promise<_SheetFilterUtils.FilterRuns>;
653
+ /** @internal The write half of {@link _filter}: inside the caller's open transaction. */
654
+ protected _applyFilterRuns(runs: _SheetFilterUtils.FilterRuns, options?: ITransaction.OperationOptions): void;
530
655
  /** @internal Logic lives in `_SheetMutations.autoFill`. */
531
656
  protected _autoFill(template: IRange.Coords, destination: IRange.Coords, options?: ICellRange.AutoFillOptions): boolean | AutoFillProjection;
532
657
  /** @internal Logic lives in `_SheetMutations.autoFillRange`. */
@@ -536,8 +661,67 @@ export declare class Sheet implements ISheet {
536
661
  /** @internal Logic lives in `_SheetMutations.setHyperlinks`. */
537
662
  protected _setHyperlinks(ranges: readonly ISpatialMap.Entry<IHyperlink.Update>[], defaultUpdate?: IHyperlink.Update, // we do this because updateTuples may update each
538
663
  options?: ITransaction.OperationOptions): void;
539
- /** @internal */
664
+ /**
665
+ * The request options for a grid call made under `transaction`: the snapshot it names and the
666
+ * savepoint its maps are cloned under.
667
+ * @internal
668
+ */
669
+ protected _requestFor(transaction: ITransaction | null): ICalcGrid.RequestOptions;
670
+ /**
671
+ * The formats the entered cells of the blocks inherit, as of a commit.
672
+ *
673
+ * Excel's entry rule: a formula typed into a General cell takes the number format of the first
674
+ * cell it reads that has one - `=A1+B1` shows currency when `A1` does. Which cells, and in what
675
+ * order, the engine reports with the results ({@link ICalcGrid.Results.formatInserts}); which
676
+ * formats they carry is read from the ENTERING commit's snapshot, so a pass that comes late -
677
+ * after an engine start, or an F9 under manual calculation - sees the inputs as they were when
678
+ * the formula was entered, whatever was formatted since. Never through a name.
679
+ *
680
+ * @remarks
681
+ * Range-shaped, not per cell. A relative reference names a different cell from each cell of
682
+ * its block, so the cells a block reads through it are a rectangle the block's size offset by
683
+ * the reference; the styled entries found there are shifted back onto the block. A fixed axis
684
+ * reads one row or column for the whole block. A reference stands for its top-left cell.
685
+ * References are written from the last to the first, so the first reference that formats a
686
+ * cell is the one that stands - "the first that is not General", per cell.
687
+ * @internal
688
+ */
689
+ protected _resolveInheritedFormats(commitId: string, blocks: readonly EnteredBlock[], entered: readonly IRange.Coords[]): ISpatialMap.Entry<IStyle.Update>[];
690
+ /**
691
+ * Land a record the engine pushed - a pass's results, a seed's - in the sheet's snapshots.
692
+ *
693
+ * @remarks
694
+ * The record names the snapshot it answers for (`commitId`). Everything it says about cells -
695
+ * the formulas, the values, the spills, the errors, the pending and circular marks - has been
696
+ * landed in the grid's own snapshots by the time this runs, and a record naming a snapshot off
697
+ * the live history never reaches here at all. What is left is the sheet's: what is PROMOTED -
698
+ * number formats, sizes - amended into the commit that entered the formulas, and the
699
+ * notifications, which realize has to make by hand.
700
+ * @internal
701
+ */
540
702
  protected _realizeCalcedValues(results: ICalcGrid.Results): void;
703
+ /**
704
+ * Land the promoted half of a pass's results - number formats and sizes - in the commit that
705
+ * entered the formulas they belong to.
706
+ *
707
+ * @remarks
708
+ * Excel's rule: entering a formula formats and fits it; recalculating it does not. So the set is
709
+ * the formulas the target commit entered on this sheet, clipped to what this pass realized; the
710
+ * directives are the target's own (`autoFormat`, `autoFit`); and once resolved the sheet is
711
+ * marked on the target ({@link IntentCalcResolved}), so a later pass for the same commit - a
712
+ * dependent on another sheet, an explicit recalculation, the pass a redo triggers - leaves what
713
+ * is now in the snapshot alone. The mark is written with the sheet's record so that it lands
714
+ * even when nothing was promoted; an amend with no writes is elided. It is written only by a
715
+ * pass that realized the entered cells: an engine starting up runs a pass that realizes
716
+ * nothing before the one that carries the results.
717
+ *
718
+ * The number format is the engine's pick per cell ({@link ICalcGrid.Results.formatInserts}):
719
+ * the references the formula inherits one from, resolved here against the entering commit's
720
+ * snapshot ({@link _resolveInheritedFormats}), or else the format its functions supplied.
721
+ *
722
+ * @internal
723
+ */
724
+ protected _promoteCalcResults(target: ITransaction.ICommit, results: ICalcGrid.Results): void;
541
725
  /** {@inheritDoc ISheet.calculate} */
542
726
  calculate(full?: boolean): Promise<ICalculation.Status>;
543
727
  /** @internal */
@@ -546,10 +730,10 @@ export declare class Sheet implements ISheet {
546
730
  protected _calculateFull(): void;
547
731
  /** @internal */
548
732
  /** @internal Logic lives in `_SheetMutations.setComments`. */
549
- protected _setComments(ranges: readonly ISpatialMap.Entry<IComment.Properties>[], comments?: IComment.JSON | null, // we do this because updateTuples may update each
733
+ protected _setComments(ranges: readonly ISpatialMap.Entry<IComment.Update>[], comments?: IComment.Update | IComment.JSON, // `undefined` = each entry carries its own (updateTuples)
550
734
  options?: ITransaction.OperationOptions): void;
551
735
  /** @internal Logic lives in `_SheetMutations.clear`. */
552
- protected _clear(ranges: readonly IRange.Coords[], applyTo?: ICell.Content | null, options?: ITransaction.OperationOptions, excludeSorts?: boolean, isCut?: boolean): void;
736
+ protected _clear(ranges: readonly IRange.Coords[], applyTo?: ICell.Content | null, options?: ITransaction.OperationOptions, excludeSorts?: boolean, cutFrom?: IRange.Coords | null): void;
553
737
  /** @internal Logic lives in `_SheetMutations.merge`. */
554
738
  protected _merge(ranges: readonly IRange.Coords[], options?: IRange.AxisSelection | ICellRange.MergeOptions | null): void;
555
739
  /** @internal Logic lives in `_SheetMutations.unmerge`. */
@@ -581,7 +765,23 @@ export declare class Sheet implements ISheet {
581
765
  /** @internal */
582
766
  protected _getTables(address: ICellRanges.Address, ignoreHidden?: boolean, fullyContained?: boolean): ITable[];
583
767
  /** @internal */
768
+ protected _getDefaultAutoFillCriteria(rangeCoords: IRange.Coords, direction?: IRange.Direction, destination?: IRange.Coords): IAutoFill.DefaultCriteria | null;
769
+ /** @internal */
584
770
  protected _getDefaultSortCriteria(rangeCoords: IRange.Coords, axis?: IRange.Axis, cell?: ICell.Address): ISort.DefaultSortCriteria;
771
+ /**
772
+ * The refusal an {@link ICellRange.insertFrom} would raise, as a localized message - `null` when it
773
+ * would go through. Asked BEFORE anything is committed, both by `_insertFrom` itself (so a refusal
774
+ * leaves nothing to roll back and carries the message that fits the reason) and by the public
775
+ * `canInsertFrom`, which is what lets a drag preview show a drop as refused before it is attempted.
776
+ *
777
+ * @internal
778
+ */
779
+ protected _getInsertFromRefusal(coordsInsert: IRange.Coords, coordsCut: IRange.Coords, axis: IRange.Axis, isCut: boolean, isSameSheet: boolean): string | null;
780
+ /**
781
+ * {@inheritDoc ICellRange.canInsertFrom}
782
+ * @internal
783
+ */
784
+ protected _canInsertFrom(ranges: readonly IRange.Coords[], source: ICellRange.Address | ICellRange.ISnapshot, options?: ICellRange.InsertFromOptions): boolean;
585
785
  /** @internal */
586
786
  protected _insertFrom(ranges: readonly IRange.Coords[], source: ICellRange.Address | ICellRange.ISnapshot, options?: ICellRange.InsertFromOptions): Promise<IRange.Coords>;
587
787
  /**
@@ -608,26 +808,175 @@ export declare class Sheet implements ISheet {
608
808
  * Implementation lives in `_SheetAutoFitUtils` (same pattern as `_SheetSortUtils.doSort`).
609
809
  */
610
810
  protected _autoFit(ranges: readonly IRange.Coords[], options?: ICellRange.AutoFitOptions): void;
811
+ /**
812
+ * The size a range's content needs, without writing it. See {@link ICellRange.getBestFit}.
813
+ *
814
+ * @internal
815
+ */
816
+ protected _getBestFit(range: IRange.Coords, options?: ICellRange.BestFitOptions): Size;
611
817
  /** @internal */
612
818
  protected _createRangeEvent(coords: (readonly IRange.FixableCoords[]) | IRange.FixableCoords, options: NotifierOptions, coordsFrom?: (readonly IRange.FixableCoords[]) | IRange.FixableCoords): ICellRange.Event;
613
819
  /**
614
- * Notifies listeners with a range.
820
+ * Register a reference node for a range listener.
821
+ *
822
+ * @remarks
823
+ * The node is written into the anchored map by an AMEND on the current commit, so registering
824
+ * never becomes an undo step, and every snapshot from this commit forward carries the node at
825
+ * whatever coords it has then. That one write is where the whole contract comes from: undo to a
826
+ * snapshot at or after registration and the node is there, at the coords of that moment; undo to
827
+ * one from BEFORE it and the map simply has no entry, which is what `#N/A` is.
828
+ *
829
+ * The callback never enters state - it is held on the instance, keyed by node id.
830
+ *
615
831
  * @internal
616
832
  */
617
- protected _notifyAddressListeners(listenerMapAll: Map<string, RangesListener>, listenerMapEvent: Map<string, RangesListener | null>, // address-only events store null values
618
- visited: Set<string>, options: NotifierOptions): void;
833
+ protected _addListenerNode(ranges: readonly IRange.Coords[], listener: ICellRange.Listener, options?: ICellRange.ListenerOptions): IListener.Remove;
619
834
  /**
620
- * Notifies listeners with a range.
835
+ * {@link _addListenerNode}, also handing back the node, for a caller that reads its coords.
621
836
  * @internal
622
837
  */
623
- protected _notifyDataListeners(spatialMap: ISpatialMap<RangesListenerEntry>, listenerMap: Map<string, RangesListener>, ranges: (readonly IRange.FixableCoords[] | null) | undefined, visited: Set<string>, options: NotifierOptions): void;
838
+ protected _registerListenerNode(ranges: readonly IRange.Coords[], listener: ICellRange.Listener, options?: ICellRange.ListenerOptions, createNode?: (options: ListenerAnchor.ConstructorOptions) => ListenerAnchor): {
839
+ node: ListenerAnchor;
840
+ remove: IListener.Remove;
841
+ };
624
842
  /**
625
- * Notifies listeners with a range.
843
+ * Register a watch: an expression kept evaluated over a range.
844
+ *
845
+ * @remarks
846
+ * A watch is a range listener that fires on formula evaluation - see {@link WatchAnchor}. Its
847
+ * location is a node in `State.listeners`, and its body is a formula block in a grid of its own
848
+ * that shadows this sheet, written at the watched coords exactly as if it had been typed there.
849
+ * A watch is allowed to overlap other formulas, which is why the body has a grid of its own: the
850
+ * sheet's formula map holds one formula per cell, and a validation, a conditional format and a
851
+ * real formula can all sit on D1:D3 at once.
852
+ *
853
+ * Registration waits for the engine and never starts it: a watch added while calculation is off
854
+ * delivers nothing until calculation is started, and registers then. It lands as one amend: the node, the grid and the body join the current commit, so a
855
+ * watch is never an undo step. A snapshot older than the watch has neither, which is `#N/A`.
856
+ * The first delivery is the first pass that evaluates the body.
857
+ *
858
+ * @param coords The range the body is evaluated over.
859
+ * @param formula The expression, authored at `origin`, or a compiled formula anchored at
860
+ * `coords`' top-left.
861
+ * @param handlers `onValues` receives the body's values after every pass that changed them;
862
+ * `onChange` is told that an evaluation happened, without the values.
863
+ * @param origin Where `formula` is authored when it is not `coords`' own top-left: the shared
864
+ * origin of a multi-area watch, from which the body is filled to `coords`.
865
+ * @param options `arrayFirstCell`: every cell of the body is its own 1x1 array-entered formula.
626
866
  * @internal
627
867
  */
628
- protected _notifyRangeListeners(spatial: ISpatialMap<ICellRangeListenerEntry>, listenerMap: Map<number, ICellRangesListenerEntry>, ranges: (readonly IRange.FixableCoords[] | null) | undefined, notificationOptions: NotifierOptions): void;
629
- /** @internal */
630
- protected _notifyRangeListener2(entry: ICellRangesListenerEntry, event?: ICellRange.Event | null, notificationOptions?: NotifierOptions | null): void;
868
+ protected _addWatch(coords: IRange.Coords, formula: ICalculation.IFormula | string, handlers: WatchAnchor.Handlers, origin?: IRange.CellCoords, options?: ICellRange.WatchOptions): IListener.Remove;
869
+ /**
870
+ * The one amend that creates a watch: its node, its grid and its body.
871
+ *
872
+ * @remarks
873
+ * Everything about the BODY is the node's ({@link WatchAnchor.reconcile},
874
+ * {@link WatchAnchor.deliver}). What is here is what every listener gets from the sheet: the
875
+ * node in the versioned map, the entry that holds its callbacks, and the removal.
876
+ * @internal
877
+ */
878
+ protected _registerWatch(coords: IRange.Coords, expression: string, authoredAt: IRange.CellCoords, handlers: WatchAnchor.Handlers, arrayFirstCell: boolean): IListener.Remove;
879
+ /**
880
+ * Hold formulas that belong to no cell - a chart's series - in the calculation engine.
881
+ *
882
+ * @remarks
883
+ * Each is the body of a grid of its own, as a defined name's is, so the engine keeps its
884
+ * references on the cells they name: an insert or delete rewrites them, a cut carries them, a
885
+ * deleted sheet leaves `#REF!`, and undo puts all of it back. Every body demands its first cell
886
+ * only, so holding a reference to a column costs a pass one read, not the column.
887
+ *
888
+ * Registration waits for the engine and then amends the current commit, as a watch's does. An
889
+ * engine that is never started holds nothing, and the formulas read as they were handed over.
890
+ *
891
+ * A relative endpoint is an offset from a body that has no position, so it is left as written;
892
+ * chart formulas are absolute in every file Excel saves.
893
+ * @internal
894
+ */
895
+ protected _holdFormulas(getExpressions: () => readonly string[]): Chart.HeldFormulas;
896
+ /**
897
+ * Carry every reference a cut encloses from its source to its destination.
898
+ *
899
+ * @remarks
900
+ * A cut moves cells, and everything that NAMES those cells goes with them - which is what the
901
+ * calc graph does for a formula precedent (`movePrecedents`), and what a range listener's
902
+ * reference and a watch's location must do for the same reason and by the same rule: the cut
903
+ * carries a reference only when it fully encloses it. Cut B2 to D5 and a listener on B2 reads
904
+ * D5; cut a block that merely clips the reference and it stays put, pointing at cells that are
905
+ * now empty.
906
+ *
907
+ * Called from the cut path beside the calc grid's own move, so the two land in one commit and
908
+ * one undo puts both back. A watch's body follows its node from the node's own address event
909
+ * at commit end (see {@link WatchAnchor.reconcile}).
910
+ *
911
+ * @param from The cut's source.
912
+ * @param to Where the cut's source lands.
913
+ * @internal
914
+ */
915
+ protected _moveReferences(from: IRange.Coords, to: IRange.Coords): void;
916
+ /**
917
+ * Carries the tables a same-sheet cut moved to where the cut put them, as the same instances.
918
+ *
919
+ * @remarks
920
+ * A table moved this way is never deleted, so a handle to it, its name and the structured
921
+ * references to it all stay as they were, and one undo puts it back. Called after
922
+ * {@link _moveReferences}: the node a table watches its header through travels with the cut
923
+ * there, and the table re-registers what did not travel (the ring outside it) from where it now
924
+ * is. Each table is re-anchored by itself, so a table the cut does not carry is never split.
925
+ *
926
+ * @param tables The tables the cut encloses and moves.
927
+ * @param from The cut's source.
928
+ * @param to Where the cut's source lands.
929
+ * @internal
930
+ */
931
+ protected _moveTables(tables: readonly ITable[], from: IRange.Coords, to: IRange.Coords): void;
932
+ /**
933
+ * Drop a node from the current snapshot.
934
+ *
935
+ * @remarks
936
+ * The same amend as registering. Older snapshots keep the entry; one whose callback is gone from
937
+ * the instance is inert, and is swept the next time this runs.
938
+ *
939
+ * @internal
940
+ */
941
+ protected _removeListenerNode(node: ListenerAnchor): void;
942
+ /**
943
+ * Deliver to every node whose reference intersects what changed.
944
+ *
945
+ * @remarks
946
+ * A transactional node is told from inside the transaction, before the commit seals, so what it
947
+ * writes joins that commit; every other node is told once the store has settled. The two are
948
+ * never told from the same place, so `transactional` selects which half this call is for.
949
+ *
950
+ * `ranges` is the commit's change set, so a batch of operations is ONE change to a node: it is
951
+ * told once, carrying every range of the commit that reached it.
952
+ *
953
+ * @internal
954
+ */
955
+ protected _notifyListenerNodes(state: State, ranges: readonly IRange.Coords[] | null, notificationOptions: NotifierOptions, transactional: boolean): void;
956
+ /**
957
+ * Deliver to every live node whose reference is no longer where it was.
958
+ *
959
+ * @remarks
960
+ * Nothing is compared against the log, and the direction the store moved does not matter. The
961
+ * map either holds the node - at whatever coords it has in THIS snapshot - or it does not, and
962
+ * each case answers itself: a difference from the coords last delivered is an `address` change,
963
+ * and no entry at all is `#N/A`, a world from before the node was registered.
964
+ *
965
+ * `transactional` selects which nodes this call is for (see {@link _notifyListenerNodes}). With
966
+ * `notificationOptions` `null` the nodes are only re-based - their last-delivered coords are set
967
+ * to this snapshot's without a delivery. That is a restore seen by a transactional node: it is
968
+ * never told about one, but the next forward move must be measured from where the restore left
969
+ * the reference, not from where it was before.
970
+ *
971
+ * @internal
972
+ */
973
+ protected _notifyListenerNodeMoves(state: State, transactional: boolean, notificationOptions: NotifierOptions | null): void;
974
+ /**
975
+ * One delivery, after the option filters.
976
+ *
977
+ * @internal
978
+ */
979
+ protected _deliverToNode(entry: ListenerNodeEntry, trigger: 'data' | 'address' | 'restore', notificationOptions: NotifierOptions, from?: readonly IRange.Coords[]): void;
631
980
  /** @internal */
632
981
  protected _notifyUsedRangeChange(): void;
633
982
  /** @internal */
@@ -644,22 +993,28 @@ export declare class Sheet implements ISheet {
644
993
  protected _notifyDataValidationsChange(): void;
645
994
  /** {@inheritDoc Sheet._notifyConditionalFormatsChange} @internal */
646
995
  protected _notifyProtectedRangesChange(): void;
996
+ /** {@inheritDoc Sheet._notifyConditionalFormatsChange} @internal */
997
+ protected _notifyCommentsChange(): void;
998
+ /**
999
+ * Presents one of the sheet's own events as a collection's `onCollectionChange`, and the
1000
+ * sheet's `onInvalidated` as the collection's, with the collection as the source of both.
1001
+ *
1002
+ * @remarks
1003
+ * The sheet keeps the state and fires the fine-grained event; the collection is a front over
1004
+ * it. Forwarding, rather than a second emitter, is what keeps the two from drifting apart.
1005
+ * @internal
1006
+ */
1007
+ protected _forwardCollectionListeners(key: 'onTablesChange' | 'onConditionalFormatsChange' | 'onDataValidationsChange' | 'onProtectedRangesChange' | 'onCommentsChange', collection: () => ICollection<any>): (listeners: ICollection.IListeners, options?: IListener.Options) => IListener.Remove;
647
1008
  /** {@inheritDoc ISheet.addListeners} */
648
1009
  addListeners(listeners: ISheet.IListeners, options?: IListener.Options): IListener.Remove;
649
1010
  /** @internal */
650
- protected _addRangesListeners(ranges: readonly IRange.Coords[], listener: ICellRange.Listener, options?: ICellRange.ListenerOptions): IListener.Remove;
651
- /** @internal */
652
- protected _addRangesListeners2(ranges: readonly IRange.Coords[], listener: ICellRange.Listener, options: ICellRange.ListenerOptions | undefined, isRanges: boolean): IListener.Remove;
653
- /** @internal */
654
1011
  protected _getUsedCoords(options?: ICellRange.GetRangeOptions): IRange.Coords | null;
655
1012
  /** @internal */
656
1013
  protected _getRangeStats(coords: readonly IRange.Coords[], iteratorOptions?: ICellRange.GetStatsOptions): IRangeStats;
657
1014
  /** @internal */
658
1015
  protected _isContentful(ranges: readonly IRange.Coords[], ignoreHidden?: boolean | IRange.Axis): boolean;
659
- /** @internal */
660
- protected _getCount(coords: IRange.Coords[], ignoreHidden?: boolean): number;
661
1016
  /**
662
- * Legacy Content-keyed counting — internal callers only (`clear` preflight, `_getCount`).
1017
+ * Legacy Content-keyed counting — internal callers only (`clear` preflight).
663
1018
  * The public path is `_featureCounts`, keyed by `ICellRange.Feature`.
664
1019
  * @internal
665
1020
  */
@@ -690,7 +1045,17 @@ export declare class Sheet implements ISheet {
690
1045
  * removing it would answer a different question than "what does this block read".
691
1046
  * @internal
692
1047
  */
693
- protected _dependencyRanges(coords: IRange.Coords, kind: 'precedents' | 'dependents', direct: boolean): ICellRanges | null;
1048
+ protected _dependencyRanges(coords: IRange.Coords, kind: 'precedents' | 'dependents', direct: boolean): Promise<ICellRanges | null>;
1049
+ /**
1050
+ * Name ids -> the range objects that carry them in a graph answer.
1051
+ *
1052
+ * @remarks
1053
+ * The id half of step 3. Liveness and "is this actually a name" were already applied by the
1054
+ * grid; an id that no longer resolves simply drops. Each node is anchored on ITS OWN sheet
1055
+ * (the name's defining cell), which is why the internal is re-resolved per id.
1056
+ * @internal
1057
+ */
1058
+ private _namedGraphRanges;
694
1059
  /**
695
1060
  * Calc-currency scopes → range-currency scopes: the boundary the whole scope model rests on.
696
1061
  *
@@ -728,10 +1093,8 @@ export declare class Sheet implements ISheet {
728
1093
  * requested features are elided. `features` arrives already resolved (`resolveRegionFeatures`).
729
1094
  *
730
1095
  * Known v1 bounds, recorded in AGENT-PLAN B2: the blank/complement side of the partition is
731
- * not yielded; regions for the projected style features (`NumberFormat`/`Alignment`/`Font`)
732
- * are correct but may be finer than maximal (the shared content-style map splits on parts the
733
- * projection ignores). Every requested feature partitions — there is no unsupported-feature
734
- * throw left in this function.
1096
+ * not yielded. Every requested feature partitions — there is no unsupported-feature throw left
1097
+ * in this function.
735
1098
  * @internal
736
1099
  */
737
1100
  protected _featureRegions(bounds: IRange.Coords, requested: readonly ICellRange.Feature[], options?: ICellRange.GetRegionsOptions): IRange.Coords[];
@@ -743,6 +1106,12 @@ export declare class Sheet implements ISheet {
743
1106
  protected _find(ranges: readonly IRange.Coords[], options: string | ICellRange.FindOptions): Iterator<ICell>;
744
1107
  /** {@inheritDoc ISheet.getRuntime} */
745
1108
  getRuntime(): IRuntime;
1109
+ /**
1110
+ * The region a bare-cursor traverse from `cell` wraps within, or `null` for a plain move. A table
1111
+ * under the cursor answers for itself.
1112
+ * @internal
1113
+ */
1114
+ protected _getTraverseRegion(cell: IRange.CellCoords, axis: IRange.Axis, reverse: boolean): IRange.Coords | null;
746
1115
  /** @internal */
747
1116
  protected _surroundingRegion(range: IRange.Coords, options?: ICellRange.GetSurroundingOptions): IRange.Coords;
748
1117
  /** @internal */
@@ -772,8 +1141,201 @@ export declare class Sheet implements ISheet {
772
1141
  scrollTo(coords: Partial<IRange.Coords>, options?: ISheet.ScrollToOptions): Promise<boolean>;
773
1142
  /** @internal */
774
1143
  protected _resolveSelectOptions(selectOptions: boolean | ICellRange.SelectOptions, axis?: IRange.Axis): ICellRange.SelectOptions | null;
775
- /** @internal */
776
- protected _commitAndAutoSelect(trans: ITransaction, selection: Partial<IRangeSelection.Coords> | null, selectOptions?: boolean | ICellRange.SelectOptions, commitOptions?: ITransaction.StoreOperationOptions<CommitView>, axis?: IRange.Axis): Promise<IRange.Coords[]>;
1144
+ /**
1145
+ * Record the operation's directives over what it produced, then commit.
1146
+ *
1147
+ * @remarks
1148
+ * `options` is the object the operation was handed, so what it declares through
1149
+ * {@link ICellRange.OperationOptions} is what is honored here: `autoSelect` names where the
1150
+ * operation leaves the user, `autoFit` fits the ranges it produced. Both are read from the one
1151
+ * object, so an operation cannot accept a directive it then ignores.
1152
+ *
1153
+ * @internal
1154
+ */
1155
+ protected _commitWithDirectives(trans: ITransaction, selection: Partial<IRangeSelection.Coords> | null, options?: ICellRange.OperationOptions, directives?: CommitDirectives): void;
1156
+ /**
1157
+ * Declare where the operation leaves the user, and where an undo of it lands when that is not
1158
+ * the same place.
1159
+ *
1160
+ * @param selection Where the operation leaves the user - what it acted on, or what it produced
1161
+ * when that is somewhere else (a paste fitted to its source). Also where a redo lands.
1162
+ * @param options The operation's own options, passed through as they were given: its `autoSelect`
1163
+ * and `autoSelectRestore`.
1164
+ * @param undo Where an undo lands, when it is not `selection`: a cut-drag and an insert-from
1165
+ * undo to the SOURCE, an auto-fill to the TEMPLATE it was dragged from.
1166
+ *
1167
+ * @remarks
1168
+ * A declaration, never an action: every operation declares, whatever it was asked, and whether
1169
+ * the view moves - now, on undo or on redo - is decided once, when the commit closes
1170
+ * ({@link resolveSelection}).
1171
+ *
1172
+ * @internal
1173
+ */
1174
+ protected _recordSelection(trans: ITransaction, selection: Partial<IRangeSelection.Coords>, options?: Pick<ICellRange.OperationOptions, 'autoSelect' | 'autoSelectRestore'> | null, undo?: Partial<IRangeSelection.Coords> | null, axis?: IRange.Axis): void;
1175
+ /**
1176
+ * Where an undo or a redo of a commit puts this sheet's view, or `null` when it leaves it
1177
+ * alone. See {@link resolveSelection}.
1178
+ *
1179
+ * @remarks
1180
+ * A sheet can be shown through more than one view, and a view instance is replaced on load and
1181
+ * by {@link setView}, so the match is on {@link ISheetView.getId}.
1182
+ *
1183
+ * @internal
1184
+ */
1185
+ protected _restoredSelection(intents: Readonly<Record<string, any>> | undefined, isUndo: boolean): {
1186
+ selection: Partial<IRangeSelection.Coords>;
1187
+ options: boolean | ICellRange.SelectOptions;
1188
+ } | null;
1189
+ /**
1190
+ * Record what this operation has to announce when it lands, under one category.
1191
+ *
1192
+ * @remarks
1193
+ * Recorded as the `sheet.events` intent on the ROOT and unioned there, so a batch of operations
1194
+ * announces all of them rather than the last. Keyed by {@link getId}, so a commit that spans
1195
+ * sheets announces each sheet separately. The intent travels on the commit, which is what lets
1196
+ * an undo deliver the same categories the forward commit did.
1197
+ *
1198
+ * Copy-on-write: an amend's accumulator is handed the value on the commit it folds into, and
1199
+ * mutating that would announce the whole of the target commit rather than what the amend
1200
+ * recorded - which is what makes a registration amend silent. The range list is the exception
1201
+ * once this operation has made its own ({@link _appendOwnedRanges}): one write per cell in a
1202
+ * batch would otherwise copy every range recorded so far on each of them.
1203
+ *
1204
+ * @internal
1205
+ */
1206
+ protected _recordChange(trans: ITransaction, category: EventCategory, ranges: readonly IRange.Coords[] | null | undefined): void;
1207
+ /**
1208
+ * Record the ranges a formula was entered over.
1209
+ *
1210
+ * @remarks
1211
+ * A subset of the `data` category that no event fires for: it is what the calculation's amend
1212
+ * formats and fits once the results exist ({@link _promoteCalcResults}). Unioned and written
1213
+ * copy-on-write for the same reasons as {@link _recordChange}.
1214
+ *
1215
+ * @internal
1216
+ */
1217
+ protected _recordFormulasEntered(trans: ITransaction, ranges: readonly IRange.Coords[] | null | undefined): void;
1218
+ /**
1219
+ * This sheet's half of what a commit announces.
1220
+ *
1221
+ * @internal
1222
+ */
1223
+ protected _sheetEvents(intents: Readonly<Record<string, any>> | undefined): SheetEvents | null;
1224
+ /**
1225
+ * Every range this sheet announces from a commit, across the given categories (all of them when
1226
+ * `categories` is omitted).
1227
+ *
1228
+ * @remarks
1229
+ * The union is what a consumer asking "did anything happen in my box" wants, and taking it over
1230
+ * every category is what keeps a category added later from silently ceasing to reach one.
1231
+ *
1232
+ * @internal
1233
+ */
1234
+ protected _changedRanges(intents: Readonly<Record<string, any>> | undefined, categories?: readonly EventCategory[]): readonly IRange.Coords[] | null;
1235
+ /**
1236
+ * Record ranges to fit when the operation completes.
1237
+ *
1238
+ * @remarks
1239
+ * The fit is a union over the operation: entries for the same sheet and the same options
1240
+ * accumulate ranges, so a batch measures each column once, at the end, against the finished
1241
+ * content. Resolved by {@link _resolveAutoFit} as the operation's last write.
1242
+ *
1243
+ * @internal
1244
+ */
1245
+ protected _recordAutoFit(trans: ITransaction, ranges: readonly IRange.Coords[], autoFit: boolean | ICellRange.AutoFitOptions): void;
1246
+ /**
1247
+ * Record that the formulas this operation enters take the number format their results carry.
1248
+ *
1249
+ * @remarks
1250
+ * Resolved by the calculation's amend into this commit rather than when the operation
1251
+ * completes: the results do not exist yet. See {@link IntentAutoFormat}.
1252
+ *
1253
+ * @internal
1254
+ */
1255
+ protected _recordAutoFormat(trans: ITransaction): void;
1256
+ /**
1257
+ * Record that this operation has ruled on its own protection, so the commit-time catch-all
1258
+ * stands down. See {@link IntentSkipProtectionCheck}.
1259
+ *
1260
+ * @internal
1261
+ */
1262
+ protected _recordSkipProtectionCheck(trans: ITransaction): void;
1263
+ /**
1264
+ * Record that this commit is a load of the sheet: not a user's write, so the protection check
1265
+ * stands down, and not an edit, so nothing it wrote is announced. See {@link IntentInitial}.
1266
+ *
1267
+ * @internal
1268
+ */
1269
+ protected _recordInitial(trans: ITransaction): void;
1270
+ /**
1271
+ * Record where the freeze panes were and where the operation moved them. See
1272
+ * {@link FreezePanesIntent} for how a batch merges the pair.
1273
+ *
1274
+ * @internal
1275
+ */
1276
+ protected _recordFreezePanes(trans: ITransaction, before: IRange.CellCoords, after: IRange.CellCoords): void;
1277
+ /**
1278
+ * Record the movable selection an undo (`before`) or a redo (`after`) of this operation lands
1279
+ * on. See {@link MovableSelectionIntent} for how a batch merges the pair.
1280
+ *
1281
+ * @remarks
1282
+ * Records against the operation that is open when no transaction is handed in, which is how
1283
+ * {@link ISheetView.recordMovableSelection} reaches it; with nothing open there is nothing to
1284
+ * record against and this does nothing.
1285
+ *
1286
+ * @internal
1287
+ */
1288
+ protected _recordMovableSelection(when: 'before' | 'after', movables: readonly IMovable[], trans?: ITransaction): void;
1289
+ /**
1290
+ * The movable selection to restore for an undo or a redo, or `null` when the operation recorded
1291
+ * none, or recorded it against another sheet or another view.
1292
+ *
1293
+ * @internal
1294
+ */
1295
+ protected _restoredMovableSelection(intents: Readonly<Record<string, any>> | undefined, isUndo: boolean): readonly IMovable[] | null;
1296
+ /**
1297
+ * Fold writes into the current commit without a log entry. See `IStore.amend`.
1298
+ * @internal
1299
+ */
1300
+ protected _amendCurrent<R>(callback: () => R): R;
1301
+ /**
1302
+ * An amend the sheet makes for itself (a listener node, a watch, a promoted calc result) is not
1303
+ * a user's write, so a protected sheet must not refuse it. Only an amend that opens its own
1304
+ * root stands the check down; nested, it joins an operation that answers for itself.
1305
+ * @internal
1306
+ */
1307
+ protected _amendBookkeeping<R>(commitId: string, callback: (commit: ITransaction.ICommit) => R): R;
1308
+ /**
1309
+ * Fit the ranges the operation asked for, as its last write.
1310
+ *
1311
+ * @remarks
1312
+ * Runs while the root transaction is still open so the sizes belong to the same commit as the
1313
+ * content they measure - one undo puts both back. The intent is left on the record: it is what
1314
+ * a redo fits from.
1315
+ *
1316
+ * @internal
1317
+ */
1318
+ protected _resolveAutoFit(commit: ITransaction.ICommit): void;
1319
+ /**
1320
+ * Resolve the operation's directives once its root transaction has closed.
1321
+ *
1322
+ * @internal
1323
+ */
1324
+ protected _onRootTransactionClose(commit: ITransaction.ICommit): void;
1325
+ /**
1326
+ * Keep the view's selection somewhere it can be once the sheet has changed: inside the sheet,
1327
+ * and with its active cell on the top-left of the merge it falls in.
1328
+ *
1329
+ * @param isMergesChanged Whether the change merged anything, which is the only way the active
1330
+ * cell comes to sit inside a merge.
1331
+ *
1332
+ * @remarks
1333
+ * A correction of the view, not an operation's selection: it applies whoever made the change,
1334
+ * and is not undone with it.
1335
+ *
1336
+ * @internal
1337
+ */
1338
+ protected _normalizeSelection(isMergesChanged: boolean): void;
777
1339
  /** @internal */
778
1340
  protected _autoSelect(options?: boolean | ICellRange.SelectOptions, selectionOverride?: Partial<IRangeSelection.Coords> | null, axis?: IRange.Axis): Promise<IRange.Coords[]>;
779
1341
  /** {@inheritDoc ISheet.getSelection} */
@@ -792,10 +1354,32 @@ export declare class Sheet implements ISheet {
792
1354
  getTabColor(): IColor;
793
1355
  /** {@inheritDoc ISheet.setTabColor} */
794
1356
  setTabColor(color: IColor | string | null): this;
1357
+ /** {@inheritDoc ISheet.getCodeName} */
1358
+ getCodeName(): string | null;
1359
+ /** {@inheritDoc ISheet.getOutlineSettings} */
1360
+ getOutlineSettings(): Readonly<ISheet.OutlineSettings>;
1361
+ /** {@inheritDoc ISheet.isConditionalFormatCalculationEnabled} */
1362
+ isConditionalFormatCalculationEnabled(): boolean;
1363
+ /**
1364
+ * A sheet's scripts are workbook structure, like the workbook's own.
1365
+ * @internal
1366
+ */
1367
+ protected _isModulesReadOnly(): boolean;
1368
+ /** {@inheritDoc ISheet.getModules} */
1369
+ getModules(): IModuleCollection;
795
1370
  /** {@inheritDoc ISheet.getRowHeaders} */
796
1371
  getRowHeaders(): ISheetHeader;
797
1372
  /** {@inheritDoc ISheet.getColumnHeaders} */
798
1373
  getColumnHeaders(): ISheetHeader;
1374
+ /**
1375
+ * The sheet's grid, whatever the calculation hands back (DESIGN-CALC-SERVICE §5): opened from
1376
+ * `json` (§6.6), the file's formulas, array extents and cached values, trusted. What the engine
1377
+ * makes of them arrives through the grid's `onComplete`, before this returns when the engine is
1378
+ * `Running`. The grid holds every cell map, and answers an `Off` save and a start's seed itself.
1379
+ * A snapshot sheet over another sheet's state (a copy) shares the grid: the owner answers, with
1380
+ * the state as it is now.
1381
+ */
1382
+ protected _openCalcGrid(json: ICalcGrid.JSON | undefined): ICalcGrid;
799
1383
  /** {@inheritDoc ISheet.toJSON} */
800
1384
  toJSON(options?: ISheet.ToJSONOptions): Promise<ISheet.JSON>;
801
1385
  /** {@inheritDoc ISheet.getStyles} */
@@ -823,6 +1407,8 @@ export declare class Sheet implements ISheet {
823
1407
  setPicture(picture: string | IResource | IResourceCollection.AddOptions | null, options?: ITransaction.OperationOptions): this;
824
1408
  /** {@inheritDoc ISheet.getPicture} */
825
1409
  getPicture(): IPicture | null;
1410
+ /** {@inheritDoc ISheet.getPivotTables} */
1411
+ getPivotTables(): IPivotTableCollection;
826
1412
  /** {@inheritDoc ISheet.getTables} */
827
1413
  getTables(): ITableCollection;
828
1414
  /** {@inheritDoc ISheet.getDataValidations} */
@@ -831,12 +1417,30 @@ export declare class Sheet implements ISheet {
831
1417
  getConditionalFormats(): IConditionalFormatCollection;
832
1418
  /** {@inheritDoc ISheet.getProtectedRanges} */
833
1419
  getProtectedRanges(): IProtectedRangeCollection;
1420
+ /** {@inheritDoc ISheet.getComments} */
1421
+ getComments(): ICommentCollection;
834
1422
  /** @deprecated Use {@link ISheet.getConditionalFormats} */
835
1423
  getConditionals(): IConditionalFormatCollection;
836
1424
  /** {@inheritDoc ISheet.getMovables} */
837
1425
  getMovables(): IMovableCollection;
1426
+ /** {@inheritDoc ISheet.getCharts} */
1427
+ getCharts(): IChartCollection;
838
1428
  /** @internal */
839
- protected _validateOrRemoveOverlaps(rangeCoords: IRange.Coords, type: string, table?: ITable | null, removeIfContains?: boolean): void;
1429
+ protected _validateOrRemoveOverlaps(rangeCoords: IRange.Coords, type: string, table?: ITable | null, removeIfContains?: boolean, absorbAutoTable?: boolean): void;
1430
+ /**
1431
+ * The filter and sort criteria a sheet AutoFilter hands over to a table built in its place.
1432
+ *
1433
+ * @remarks
1434
+ * Read BEFORE `_validateOrRemoveOverlaps` absorbs the AutoFilter and replayed once the table
1435
+ * exists. Excel moves them across only when the table takes EXACTLY the AutoFilter's range —
1436
+ * probed: one extra row or column, or a shifted start, and the new table starts clean. Answers
1437
+ * `null` when there is nothing to carry, which is the common case.
1438
+ * @internal
1439
+ */
1440
+ protected _getAutoTableCarryOver(rangeCoords: IRange.Coords): {
1441
+ conditions: ICondition.Input[];
1442
+ sorts: ISort.Options[];
1443
+ } | null;
840
1444
  /**
841
1445
  * Used by the TableCollection wrapper so we resolve ICellRange.Address here
842
1446
  * @internal
@@ -854,7 +1458,12 @@ export declare class Sheet implements ISheet {
854
1458
  toJSON(): J | null;
855
1459
  }, J extends object>(add: ICellRanges.Address | T | null | undefined, options: (IAnchored.AddOptions & J) | undefined, spec: {
856
1460
  /** The sheet-state slot the collection lives in. */
857
- key: 'conditionalFormats' | 'dataValidations' | 'protectedRanges';
1461
+ key: 'conditionalFormats' | 'dataValidations' | 'protectedRanges' | 'comments';
1462
+ /**
1463
+ * The sheet-protection allowances the add needs. Empty when no option allows it, so the add is
1464
+ * refused whenever the sheet is locked.
1465
+ */
1466
+ allowance: ISheetProtection.PropertyKeys[];
858
1467
  isItem: (add: unknown) => add is T;
859
1468
  description: string;
860
1469
  /** Loads one ref into the map, handing the created model to `capture`. */
@@ -889,6 +1498,10 @@ export declare class Sheet implements ISheet {
889
1498
  * @internal
890
1499
  */
891
1500
  protected _addProtectedRange(add: ICellRanges.Address | IProtectedRange, options?: IProtectedRangeCollection.AddOptions): IProtectedRange;
1501
+ /**
1502
+ * @internal
1503
+ */
1504
+ protected _addComment(address: ICellRange.Address, content: IComment.Content, options?: ICommentCollection.AddOptions): IComment;
892
1505
  /** {@inheritDoc ISheet.createCell} */
893
1506
  createCell(update: ICell.Update, coords?: IRange.CellCoords | null): ICell;
894
1507
  /** @internal */
@@ -916,8 +1529,6 @@ export declare class Sheet implements ISheet {
916
1529
  protected _getRangedEntries<T, E = T>(spatial: ISpatialQuery, ranges: readonly IRange.Coords[], options?: GetTypedRangeOptions<T, E>, spatialSort?: boolean): T[];
917
1530
  /** @internal */
918
1531
  protected _processAnchorShift<T extends Anchored.Entry<any>>(options: ISpatialMap.ShiftDetails<T>): ISpatialMap.Entry<T> | null;
919
- /** @internal */
920
- protected _processListenerShift(rangesListenerMap: Map<number, ICellRangesListenerEntry>, beforeAfterMap: Map<number, BeforeAfterRange>, beforeStates: Map<number, ICellRangesListenerEntry>, options: ISpatialMap.ShiftDetails<ICellRangeListenerEntry>): ISpatialMap.Entry<ICellRangeListenerEntry>[] | void;
921
1532
  /** {@inheritDoc ISheet.delete} */
922
1533
  delete(): void;
923
1534
  /** {@inheritDoc ITransaction.ITransactional.doBatch} */
@@ -938,12 +1549,10 @@ export declare class Sheet implements ISheet {
938
1549
  */
939
1550
  _getStateId(): string;
940
1551
  /** @internal */
941
- protected _beginCommit(options?: ITransaction.StoreOperationOptions<CommitView> | string): ITransaction;
1552
+ protected _beginCommit(options?: ITransaction.StoreOperationOptions | string): ITransaction;
942
1553
  /** @internal */
943
1554
  protected _updateState(updateState?: Partial<State>, options?: ITransaction.OperationOptions | string): State;
944
1555
  /** @internal */
945
- protected _addEvent(type: keyof CommitEvents, value: any): void;
946
- /** @internal */
947
1556
  protected _getScalar(rowIndex: number, columnIndex: number, asJSDate?: boolean): Scalar | InteropScalar;
948
1557
  /**
949
1558
  * This is mostly optimized except for scrolling. On scroll y it must requery. We could debounce this.
@@ -958,6 +1567,15 @@ export declare class Sheet implements ISheet {
958
1567
  * @internal
959
1568
  */
960
1569
  protected _getCellAt(rowIndex: number, colIndex: number): ICell;
1570
+ /**
1571
+ * The cell as `state` has it, or - for `held` - as the held write to it leaves it.
1572
+ *
1573
+ * @returns `null` if the write has to be made to know: the cell has a formula or a calculation
1574
+ * status the write changes, or a style update that reaches past the cell (see
1575
+ * `intersectionAfterStyleUpdate`).
1576
+ * @internal
1577
+ */
1578
+ protected _getCellAtState(state: Readonly<State>, transaction: ITransaction | null, rowIndex: number, colIndex: number, held: CellBuffer.HeldCell | null): ICell | null;
961
1579
  protected _queryStyle(anchorCoords: IRange.Coords, cellOptions: SheetCellOptions, extent?: IRange.Coords): IStyle;
962
1580
  /**
963
1581
  * @param updateStyles Replaces the write half of the returned style. A style READS from the
@@ -983,6 +1601,19 @@ export declare class Sheet implements ISheet {
983
1601
  * @internal
984
1602
  */
985
1603
  protected _initListenerState(): void;
1604
+ /**
1605
+ * Re-derive everything that is a function of how a cell *paints* rather than of what it holds:
1606
+ * the default font metrics, the layout, and the header sizes fitted to that paint.
1607
+ *
1608
+ * @remarks
1609
+ * The theme is the familiar case. A language or locale switch is the same shape — the cell
1610
+ * paints a different word (`WAHR`, `#WERT!`, `15.03.2023`) for a value that never changed — so
1611
+ * the columns fitted to the old word are stale, and nothing below the sheet is told otherwise.
1612
+ * The fit only grows: a maintenance pass must never take back a width the sheet already had.
1613
+ *
1614
+ * @internal
1615
+ */
1616
+ protected _invalidateRendering(): void;
986
1617
  /** @internal */
987
1618
  protected _initViewState(entireCoords: IRange.Coords, json: ISheetView.JSON): void;
988
1619
  protected _initCellState(): void;
@@ -995,6 +1626,13 @@ export declare class Sheet implements ISheet {
995
1626
  /** @internal */
996
1627
  protected _createProtectedRanges(protectedRanges: IAnchoredMap<IProtectedRange, IProtectedRange.JSON>, key: keyof State, refs: IRange.JSONReference<IProtectedRange.JSON>[], createModel: (options: ProtectedRange.ConstructorOptions) => IProtectedRange, addListeners?: (model: IProtectedRange) => IListener.Remove): IAnchoredMap<IProtectedRange, IProtectedRange.JSON>;
997
1628
  /** @internal */
1629
+ protected _createComments(comments: IAnchoredMap<IComment, IComment.JSON>, key: keyof State, refs: IRange.JSONReference<IComment.JSON>[], createModel: (options: Comment.ConstructorOptions) => IComment, addListeners?: (model: IComment) => IListener.Remove): IAnchoredMap<IComment, IComment.JSON>;
1630
+ /**
1631
+ * The JSON for a comment authored now: modifiers with an id, an author and a date minted.
1632
+ * @internal
1633
+ */
1634
+ protected _newCommentJSON(modifiers: IComment.Modifiers): IComment.JSON;
1635
+ /** @internal */
998
1636
  protected _createMovableEntry(json: IMovable.JSON, zIndex: number, fromResourceId?: (resourceId: number) => IResource): ISpatialMap.Entry<MovableEntry>;
999
1637
  /** @internal */
1000
1638
  protected _fromJSON(json: ISheet.JSON | undefined, disableLoadAutoFit?: boolean): void;
@@ -1024,9 +1662,9 @@ export declare class Sheet implements ISheet {
1024
1662
  /** {@inheritDoc ISheet.getCalculation} */
1025
1663
  getCalculation(): ICalculation;
1026
1664
  /** {@inheritDoc ISheet.createFormula} */
1027
- createFormula(expression: string, coords?: Partial<IRange.CellCoords>): ICalculation.IFormula;
1665
+ createFormula(expression: string, coords?: Partial<IRange.CellCoords>, options?: ICalculation.CreateFormulaOptions): ICalculation.IFormula;
1028
1666
  /** {@inheritDoc ISheet.evaluate} */
1029
- evaluate(expression: string, options?: number | ICalculation.EvaluateOptions & Partial<IRange.CellCoords>): Promise<Scalar | IRange>;
1667
+ evaluate(expression: string, options?: number | ICalculation.EvaluateOptions & Partial<IRange.CellCoords> & ICalculation.CreateFormulaOptions): Promise<Scalar | IRange>;
1030
1668
  /** {@inheritDoc ISheet.whenCalculationReady} */
1031
1669
  whenCalculationReady(): Promise<ICalculation.Status>;
1032
1670
  /** {@inheritDoc ISheet.getWorkbook} */
@@ -1046,7 +1684,19 @@ export declare class Sheet implements ISheet {
1046
1684
  * @internal
1047
1685
  */
1048
1686
  export declare function createCellRangeCounts(counts: Readonly<Record<ICellRange.Feature, number>>): ICellRange.Counts;
1687
+ /**
1688
+ * Used for signalling tupleUpdate was called via private apis.
1689
+ * This allows use to 'avoid side effects' and skip validation checks.
1690
+ * @internal
1691
+ */
1049
1692
  interface NotifierOptions {
1693
+ /**
1694
+ * Which error an invalid source reports - `#REF!` when the cells were deleted, `#N/A` when the
1695
+ * world predates the listener.
1696
+ *
1697
+ * @defaultValue `#REF!`
1698
+ */
1699
+ invalidError?: string;
1050
1700
  isDataChange?: boolean;
1051
1701
  getTransactionId: () => string;
1052
1702
  isUndo?: boolean;
@@ -1065,35 +1715,28 @@ interface TableColumnHeaders {
1065
1715
  lastRowIndex: number;
1066
1716
  lastColIndex: number;
1067
1717
  }
1068
- interface CommitEvents {
1069
- address?: Map<string, RangesListener | null>;
1070
- data?: IRange.Coords[];
1071
- dataListeners?: Map<string, RangesListener | null>;
1718
+ /**
1719
+ * A live range listener: its node in the versioned map, and the callback the map must never hold.
1720
+ * @internal
1721
+ */
1722
+ interface ListenerNodeEntry {
1723
+ node: ListenerAnchor;
1724
+ handler: ICellRange.Listener | null;
1725
+ handlerW: WeakRef<ICellRange.Listener> | null;
1726
+ options: ICellRange.ListenerOptions;
1727
+ /** The coords last delivered, so a restore can tell whether the reference moved. */
1728
+ lastCoords: IRange.Coords[] | null;
1729
+ /** Present when the node is a {@link WatchAnchor}: what the watch is told. */
1730
+ watch?: WatchAnchor.Handlers;
1072
1731
  }
1073
- interface CommitView {
1074
- initial?: boolean;
1075
- sheet?: ISheet;
1076
- view?: ISheetView;
1077
- freezePanes?: Partial<IRange.CellCoords>;
1078
- selection?: Partial<IRangeSelection.Coords> | null;
1079
- selectOptions?: boolean | ICellRange.SelectOptions | null;
1080
- movableSelection?: readonly IMovable[];
1081
- ranges?: readonly IRange.FixableCoords[];
1082
- events?: CommitEvents;
1083
- formulas?: readonly IRange.FixableCoords[];
1084
- spills?: readonly IRange.FixableCoords[];
1085
- /**
1086
- * Special case for range listeners that monitored a remove.
1087
- */
1088
- merges?: readonly IRange.FixableCoords[];
1089
- listeners?: Map<number, BeforeAfterRange>;
1090
- table?: ITable;
1091
- /** If `true` then don't do protection check. (For example load or range listeners) */
1092
- skipProtectionCheck?: boolean;
1093
- /**
1094
- * We update values (cache, potentially styling, as a result of calculations)
1095
- */
1096
- calculationSideEffect?: boolean;
1732
+ /**
1733
+ * A run of formula cells with the references they inherit a number format from, relative to the
1734
+ * run's top-left ({@link ICalcGrid.Results.formatInserts}) - what `Sheet._resolveInheritedFormats`
1735
+ * resolves.
1736
+ */
1737
+ interface EnteredBlock {
1738
+ coords: IRange.Coords;
1739
+ references: readonly IRange.FixableCoords[];
1097
1740
  }
1098
1741
  export {};
1099
1742
  //# sourceMappingURL=Sheet.d.ts.map