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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (353) hide show
  1. package/THIRD-PARTY-NOTICES.md +1 -1
  2. package/browser/cjs/4f5eoQQfV-V7LO2_.cjs +1 -0
  3. package/browser/cjs/BEnEDC1m546-gzWS.cjs +1 -0
  4. package/browser/cjs/CwCUa4IzGNGissLL.cjs +1 -0
  5. package/browser/cjs/{a0Z-SXs_N71CtqYb.cjs → Dg3GaW0QWwnlqetX.cjs} +1 -1
  6. package/browser/cjs/KWQPie2u7AP69web.cjs +93 -0
  7. package/browser/cjs/index.cjs +2 -2
  8. package/browser/esm/{B0HS42a7lga1k1U_.mjs → BJ9hcZAGY8Tj5_9L.mjs} +1 -1
  9. package/browser/esm/C8vpA2ZBtZf6w4nq.mjs +394 -0
  10. package/browser/esm/DDojiE2-oycJ7qGi.mjs +20 -0
  11. package/browser/esm/DEPT7zmpiMdZ-_qC.mjs +70253 -0
  12. package/browser/esm/DOvCi3lf49To36WP.mjs +8 -0
  13. package/browser/esm/{uyWBMSIxMlt8n5Z3.mjs → Dq3sc4B_HQHBrT5N.mjs} +2 -2
  14. package/browser/esm/index.mjs +871 -696
  15. package/browser/esm/{DlPMeIyxT9tG_WDk.mjs → trwZArJQQq7K9kL7.mjs} +2 -2
  16. package/licenses/dependencies.txt +204 -204
  17. package/node/esm/CGWsQOMWdnDeF4dX.mjs +8 -0
  18. package/node/esm/{Cku7XiUvw1xrRasi.mjs → CL9MI-b6D9BmtVXW.mjs} +1 -1
  19. package/node/esm/CressiwiIhxCVp1v.mjs +28 -0
  20. package/node/esm/O2cOO3xIynWUgOWe.mjs +403 -0
  21. package/node/esm/index.mjs +52356 -37345
  22. package/package.json +6 -7
  23. package/resources/locales/de/model.msg.json +45 -9
  24. package/resources/locales/en/model.msg.json +42 -9
  25. package/types/scripting-api.json +7093 -0
  26. package/types/scripting-enums.json +54 -8
  27. package/types/scripting.d.ts +7006 -1202
  28. package/types/src/anchored/AbstractAnchored.d.ts +18 -8
  29. package/types/src/anchored/AnchoredMap.d.ts +2 -0
  30. package/types/src/anchored/IAnchoredMap.d.ts +52 -4
  31. package/types/src/autoFill/AutoFill.d.ts +316 -32
  32. package/types/src/autoFill/IAutoFill.d.ts +232 -15
  33. package/types/src/border/{IBorder.d.ts → IBorders.d.ts} +41 -40
  34. package/types/src/border/index.d.ts +1 -1
  35. package/types/src/calculation/Calculation.d.ts +740 -35
  36. package/types/src/calculation/ExternalBookBindings.d.ts +118 -0
  37. package/types/src/calculation/FormulaText.d.ts +74 -0
  38. package/types/src/calculation/ICalculation.d.ts +318 -81
  39. package/types/src/calculation/INamedFormulasCollection.d.ts +5 -8
  40. package/types/src/calculation/NamedFormulaCollection.d.ts +139 -107
  41. package/types/src/calculation/NamedLambdaFunction.d.ts +28 -0
  42. package/types/src/calculation/TokenType.d.ts +9 -0
  43. package/types/src/calculation/Types.d.ts +83 -2
  44. package/types/src/calculation/_CloneBoundary.d.ts +80 -0
  45. package/types/src/calculation/compiler/ASTTypes.d.ts +58 -0
  46. package/types/src/calculation/compiler/CompilerUtils.d.ts +134 -12
  47. package/types/src/calculation/compiler/FormulaCompiler.d.ts +29 -4
  48. package/types/src/calculation/compiler/FormulaParser.d.ts +1 -2
  49. package/types/src/calculation/compiler/LiteTransform.d.ts +17 -0
  50. package/types/src/calculation/compiler/ParserUtils.d.ts +26 -1
  51. package/types/src/calculation/compiler/SRParser.d.ts +2 -1
  52. package/types/src/calculation/compiler/Types.d.ts +79 -9
  53. package/types/src/calculation/executor/CalcExecutor.d.ts +312 -33
  54. package/types/src/calculation/executor/CalcExecutorUtils.d.ts +43 -2
  55. package/types/src/calculation/executor/CircularReference.d.ts +2 -0
  56. package/types/src/calculation/formula/Formula.d.ts +58 -21
  57. package/types/src/calculation/formula/FormulaBlock.d.ts +124 -21
  58. package/types/src/calculation/formula/FormulaRecordView.d.ts +79 -0
  59. package/types/src/calculation/formula/IFormulaBlock.d.ts +261 -67
  60. package/types/src/calculation/formula/LambdaValue.d.ts +15 -16
  61. package/types/src/calculation/formula/LazyValue.d.ts +96 -0
  62. package/types/src/calculation/formula/TokenUtils.d.ts +25 -1
  63. package/types/src/calculation/formula/index.d.ts +1 -0
  64. package/types/src/calculation/functions/FunctionDeclarations.d.ts +31 -0
  65. package/types/src/calculation/functions/initializeFunctions.d.ts +15 -2
  66. package/types/src/calculation/grid/CalcGrid.d.ts +384 -158
  67. package/types/src/calculation/grid/CalcGridBackend.d.ts +450 -0
  68. package/types/src/calculation/grid/CalcGridProxy.d.ts +133 -0
  69. package/types/src/calculation/grid/CalcGridUtils.d.ts +62 -12
  70. package/types/src/calculation/grid/FormulaEntry.d.ts +129 -0
  71. package/types/src/calculation/grid/FormulaHost.d.ts +236 -0
  72. package/types/src/calculation/grid/ICalcGrid.d.ts +456 -143
  73. package/types/src/calculation/grid/_CalcRequest.d.ts +272 -0
  74. package/types/src/calculation/grid/index.d.ts +4 -0
  75. package/types/src/calculation/index.d.ts +2 -0
  76. package/types/src/calculation/spatial/ContentfulSpatialValue.d.ts +6 -2
  77. package/types/src/calculation/spatial/FormulaSpatialValue.d.ts +339 -11
  78. package/types/src/calculation/spatial/SpillEntry.d.ts +20 -5
  79. package/types/src/calculation/spatial/TouchedWindows.d.ts +86 -0
  80. package/types/src/calculation/spatial/index.d.ts +1 -0
  81. package/types/src/calculation/state/CalcInputs.d.ts +41 -0
  82. package/types/src/calculation/state/CalcNode.d.ts +141 -30
  83. package/types/src/calculation/state/CalcScope.d.ts +37 -0
  84. package/types/src/calculation/state/CalcState.d.ts +22 -1
  85. package/types/src/calculation/state/CalculationContext.d.ts +36 -2
  86. package/types/src/calculation/state/IContextContainer.d.ts +129 -27
  87. package/types/src/calculation/state/_PendingOverlayGrid.d.ts +163 -0
  88. package/types/src/calculation/state/_ReadObservedGrid.d.ts +74 -8
  89. package/types/src/calculation/state/index.d.ts +1 -0
  90. package/types/src/calculation/symbol/ExternalSheetSymbols.d.ts +80 -0
  91. package/types/src/calculation/symbol/ISymbolRegistry.d.ts +23 -0
  92. package/types/src/calculation/symbol/IndirectSymbolProvider.d.ts +16 -2
  93. package/types/src/calculation/symbol/SheetSymbolProvider.d.ts +63 -3
  94. package/types/src/calculation/symbol/SymbolRegistry.d.ts +20 -0
  95. package/types/src/calculation/symbol/index.d.ts +3 -2
  96. package/types/src/cell/ICell.d.ts +78 -23
  97. package/types/src/cell/ICellProtection.d.ts +50 -10
  98. package/types/src/cellRange/ICellRange.d.ts +329 -72
  99. package/types/src/cellRange/ICellRanges.d.ts +9 -7
  100. package/types/src/chart/Chart.d.ts +72 -2
  101. package/types/src/chart/ChartCollection.d.ts +26 -0
  102. package/types/src/chart/IChart.d.ts +162 -9
  103. package/types/src/chart/IChartCollection.d.ts +25 -0
  104. package/types/src/chart/_ChartXml.d.ts +70 -0
  105. package/types/src/chart/index.d.ts +1 -3
  106. package/types/src/collections/ArraysGrid.d.ts +1 -1
  107. package/types/src/collections/IGrid.d.ts +1 -1
  108. package/types/src/collections/ISparseGrid.d.ts +9 -0
  109. package/types/src/collections/ISpatialMap.d.ts +59 -21
  110. package/types/src/collections/ImmutableList.d.ts +28 -0
  111. package/types/src/collections/MixedTypedArrayList.d.ts +168 -108
  112. package/types/src/collections/OverlappingRangeIterator.d.ts +13 -17
  113. package/types/src/collections/RepeatingList.d.ts +7 -0
  114. package/types/src/collections/ScalarGrid.d.ts +50 -0
  115. package/types/src/collections/SparseGrid.d.ts +1 -1
  116. package/types/src/collections/SpatialMap.d.ts +13 -21
  117. package/types/src/collections/Tuple.d.ts +128 -16
  118. package/types/src/collections/_GridUtils.d.ts +19 -6
  119. package/types/src/collections/_RangeSweep.d.ts +97 -0
  120. package/types/src/collections/_SpatialUtils.d.ts +20 -2
  121. package/types/src/collections/index.d.ts +1 -0
  122. package/types/src/comment/Comment.d.ts +159 -0
  123. package/types/src/comment/CommentCollection.d.ts +40 -0
  124. package/types/src/comment/IComment.d.ts +319 -48
  125. package/types/src/comment/ICommentCollection.d.ts +90 -0
  126. package/types/src/comment/_CommentUtils.d.ts +28 -0
  127. package/types/src/comment/index.d.ts +1 -0
  128. package/types/src/condition/AnchoredConditional.d.ts +76 -17
  129. package/types/src/condition/BuiltInOperators/AbstractOperator.d.ts +8 -7
  130. package/types/src/condition/BuiltInOperators/EqualToOperator.d.ts +2 -1
  131. package/types/src/condition/BuiltInOperators/ExpressionOperator.d.ts +3 -6
  132. package/types/src/condition/BuiltInOperators/InSetOperator.d.ts +1 -1
  133. package/types/src/condition/BuiltinSelectors/BaseSelector.d.ts +7 -0
  134. package/types/src/condition/BuiltinSelectors/ListSelector.d.ts +9 -0
  135. package/types/src/condition/Condition.d.ts +16 -0
  136. package/types/src/condition/ICondition.d.ts +86 -33
  137. package/types/src/condition/_ConditionFormula.d.ts +152 -0
  138. package/types/src/condition/_ConditionUtils.d.ts +73 -10
  139. package/types/src/conditionalFormat/ConditionalFormat.d.ts +21 -10
  140. package/types/src/conditionalFormat/ConditionalFormatCollection.d.ts +19 -8
  141. package/types/src/conditionalFormat/IConditionalFormat.d.ts +5 -3
  142. package/types/src/conditionalFormat/IConditionalFormatCollection.d.ts +2 -0
  143. package/types/src/dataValidation/DataValidation.d.ts +50 -3
  144. package/types/src/dataValidation/DataValidationCollection.d.ts +20 -9
  145. package/types/src/dataValidation/IDataValidation.d.ts +119 -30
  146. package/types/src/dataValidation/IDataValidationCollection.d.ts +10 -2
  147. package/types/src/date/DateUtils.d.ts +20 -0
  148. package/types/src/date/_DateUtils.d.ts +91 -7
  149. package/types/src/externalBook/ExternalBookCollection.d.ts +145 -12
  150. package/types/src/externalBook/ExternalBookName.d.ts +96 -0
  151. package/types/src/externalBook/IExternalBook.d.ts +170 -18
  152. package/types/src/externalBook/IExternalBookCollection.d.ts +79 -7
  153. package/types/src/externalBook/index.d.ts +1 -0
  154. package/types/src/fill/IStroke.d.ts +1 -1
  155. package/types/src/filter/IFilter.d.ts +29 -4
  156. package/types/src/font/IFont.d.ts +17 -0
  157. package/types/src/history/IHistory.d.ts +3 -2
  158. package/types/src/i18n/LanguagePack.d.ts +12 -4
  159. package/types/src/index.d.ts +3 -0
  160. package/types/src/io/AbstractBackingStore.d.ts +24 -1
  161. package/types/src/io/ArrayBackingStore.d.ts +1 -1
  162. package/types/src/io/EmbeddedPart.d.ts +20 -0
  163. package/types/src/io/IEmbeddedPart.d.ts +63 -0
  164. package/types/src/io/IWorkbookIO.d.ts +185 -18
  165. package/types/src/io/WorkbookIO.d.ts +9 -0
  166. package/types/src/io/WorkbookOrigin.d.ts +20 -11
  167. package/types/src/io/WorkbookOriginProvider.d.ts +46 -0
  168. package/types/src/io/_XmlFragment.d.ts +49 -0
  169. package/types/src/io/index.d.ts +1 -0
  170. package/types/src/lib/file/file.browser.d.ts +19 -5
  171. package/types/src/lib/file/file.node.d.ts +5 -0
  172. package/types/src/lib/utils/_Utils.d.ts +11 -0
  173. package/types/src/lib/utils/utils.browser.d.ts +9 -3
  174. package/types/src/license/license-key.d.ts +27 -0
  175. package/types/src/listener/IListener.d.ts +12 -7
  176. package/types/src/listener/ListenerEmitter.d.ts +46 -5
  177. package/types/src/model/AbstractModel.d.ts +14 -5
  178. package/types/src/movable/Control.d.ts +57 -0
  179. package/types/src/movable/IControl.d.ts +84 -0
  180. package/types/src/movable/IMovable.d.ts +23 -1
  181. package/types/src/movable/IMovableCollection.d.ts +2 -0
  182. package/types/src/movable/Movable.d.ts +4 -6
  183. package/types/src/movable/MovableCollection.d.ts +7 -7
  184. package/types/src/movable/index.d.ts +4 -0
  185. package/types/src/named/AbstractNamed.d.ts +1 -1
  186. package/types/src/named/INamed.d.ts +4 -1
  187. package/types/src/named/INamedCollection.d.ts +26 -0
  188. package/types/src/named/NamedCollection.d.ts +16 -15
  189. package/types/src/numFmt/BuiltInFormats.d.ts +15 -7
  190. package/types/src/numFmt/IFormatEngine.d.ts +2 -0
  191. package/types/src/numFmt/NumfmtFormatEngine.d.ts +2 -0
  192. package/types/src/person/IPerson.d.ts +99 -0
  193. package/types/src/person/IPersonCollection.d.ts +51 -0
  194. package/types/src/person/Person.d.ts +32 -0
  195. package/types/src/person/PersonCollection.d.ts +49 -0
  196. package/types/src/person/index.d.ts +3 -0
  197. package/types/src/picture/IPicture.d.ts +2 -0
  198. package/types/src/picture/Picture.d.ts +2 -0
  199. package/types/src/pivot/IPivotTable.d.ts +107 -0
  200. package/types/src/pivot/IPivotTableCollection.d.ts +25 -0
  201. package/types/src/pivot/PivotTable.d.ts +57 -0
  202. package/types/src/pivot/PivotTableCollection.d.ts +25 -0
  203. package/types/src/pivot/index.d.ts +6 -0
  204. package/types/src/primitives/CompositeRangeStats.d.ts +2 -0
  205. package/types/src/primitives/Criteria.d.ts +1 -1
  206. package/types/src/primitives/LambdaBrand.d.ts +21 -0
  207. package/types/src/primitives/PrimitiveUtils.d.ts +56 -19
  208. package/types/src/primitives/Range.d.ts +102 -24
  209. package/types/src/primitives/RangeStats.d.ts +24 -1
  210. package/types/src/primitives/ReferenceRange.d.ts +42 -0
  211. package/types/src/primitives/Runtime.d.ts +15 -2
  212. package/types/src/primitives/stats/FrequencyStats.d.ts +9 -0
  213. package/types/src/primitives/stats/LookupIndex.d.ts +46 -0
  214. package/types/src/primitives/stats/SortedNumbers.d.ts +2 -0
  215. package/types/src/primitives/stats/index.d.ts +1 -0
  216. package/types/src/print/IPrint.d.ts +0 -22
  217. package/types/src/protectedRange/IProtectedRange.d.ts +4 -0
  218. package/types/src/protectedRange/IProtectedRangeCollection.d.ts +2 -0
  219. package/types/src/protectedRange/ProtectedRange.d.ts +1 -4
  220. package/types/src/protectedRange/ProtectedRangeCollection.d.ts +19 -8
  221. package/types/src/protection/DefaultProtection.d.ts +12 -1
  222. package/types/src/protection/IProtection.d.ts +36 -2
  223. package/types/src/reference/ReferenceUtils.d.ts +80 -0
  224. package/types/src/reference/index.d.ts +2 -0
  225. package/types/src/resource/IResource.d.ts +21 -1
  226. package/types/src/resource/IResourceCollection.d.ts +9 -1
  227. package/types/src/resource/ResourceCollection.d.ts +6 -6
  228. package/types/src/scripting/FunctionCollection.d.ts +41 -11
  229. package/types/src/scripting/IFunctionCollection.d.ts +41 -0
  230. package/types/src/scripting/IModule.d.ts +25 -0
  231. package/types/src/scripting/IModuleCollection.d.ts +17 -0
  232. package/types/src/scripting/IScript.d.ts +18 -0
  233. package/types/src/scripting/Module.d.ts +34 -6
  234. package/types/src/scripting/ModuleCollection.d.ts +17 -12
  235. package/types/src/scripting/Runtime.d.ts +15 -0
  236. package/types/src/scripting/Scripts.d.ts +2 -0
  237. package/types/src/scripting/TypedFunction.d.ts +151 -18
  238. package/types/src/scripting/_FunctionIndex.d.ts +5 -0
  239. package/types/src/scripting/_ModuleUtils.d.ts +11 -1
  240. package/types/src/scripting/_ScriptUtils.d.ts +3 -0
  241. package/types/src/scripting/declarations.browser.d.ts +10 -0
  242. package/types/src/scripting/declarations.d.ts +49 -0
  243. package/types/src/scripting/declarations.node.d.ts +9 -0
  244. package/types/src/scripting/index.d.ts +3 -0
  245. package/types/src/selection/IRangeSelection.d.ts +9 -4
  246. package/types/src/selection/RangeSelection.d.ts +2 -0
  247. package/types/src/shape/IShape.d.ts +41 -3
  248. package/types/src/shape/Shape.d.ts +10 -0
  249. package/types/src/shape/_ShapeXml.d.ts +28 -0
  250. package/types/src/sheet/CellRegion.d.ts +6 -0
  251. package/types/src/sheet/ICellContainerOptions.d.ts +50 -0
  252. package/types/src/sheet/ISheet.d.ts +224 -41
  253. package/types/src/sheet/ISheetCollection.d.ts +2 -5
  254. package/types/src/sheet/NamedCellRange.d.ts +16 -7
  255. package/types/src/sheet/Sheet.d.ts +749 -114
  256. package/types/src/sheet/SheetCell.d.ts +81 -21
  257. package/types/src/sheet/SheetCollection.d.ts +19 -8
  258. package/types/src/sheet/SheetRange.d.ts +62 -14
  259. package/types/src/sheet/SheetRanges.d.ts +4 -6
  260. package/types/src/sheet/_CellBuffer.d.ts +214 -0
  261. package/types/src/sheet/_InvalidSheetRange.d.ts +5 -5
  262. package/types/src/sheet/_ListenerAnchor.d.ts +104 -0
  263. package/types/src/sheet/_RangeStateSweep.d.ts +16 -0
  264. package/types/src/sheet/_ScalarListFactory.d.ts +61 -0
  265. package/types/src/sheet/_SheetAutoFillUtils.d.ts +74 -0
  266. package/types/src/sheet/_SheetAutoFitUtils.d.ts +2 -2
  267. package/types/src/sheet/_SheetEvents.d.ts +43 -0
  268. package/types/src/sheet/_SheetFilterUtils.d.ts +32 -1
  269. package/types/src/sheet/_SheetIntents.d.ts +250 -0
  270. package/types/src/sheet/_SheetMutations.d.ts +179 -59
  271. package/types/src/sheet/_SheetStateReader.d.ts +16 -10
  272. package/types/src/sheet/_SheetStateTypes.d.ts +57 -73
  273. package/types/src/sheet/_SheetUtils.d.ts +2 -18
  274. package/types/src/sheet/_WatchAnchor.d.ts +93 -0
  275. package/types/src/sheet/spatial/HeldFormulaEntry.d.ts +36 -0
  276. package/types/src/sheet/spatial/index.d.ts +1 -0
  277. package/types/src/sheet/style/SheetCellStyle.d.ts +91 -64
  278. package/types/src/sheet/style/SheetDirectStyle.d.ts +16 -5
  279. package/types/src/sheet/style/_Resolvers.d.ts +5 -3
  280. package/types/src/sheet/style/_StyleUtils.d.ts +37 -7
  281. package/types/src/sheetHeader/ISheetHeader.d.ts +2 -0
  282. package/types/src/sheetHeader/SheetHeader.d.ts +14 -0
  283. package/types/src/sheetProtection/ISheetProtection.d.ts +41 -7
  284. package/types/src/sheetProtection/SheetProtection.d.ts +12 -0
  285. package/types/src/sheetView/ISheetView.d.ts +45 -1
  286. package/types/src/sheetView/SheetView.d.ts +11 -0
  287. package/types/src/slicer/ISlicer.d.ts +2 -0
  288. package/types/src/slicer/Slicer.d.ts +2 -0
  289. package/types/src/sort/ISort.d.ts +2 -0
  290. package/types/src/string/IStringCollection.d.ts +5 -0
  291. package/types/src/string/StringCollection.d.ts +6 -6
  292. package/types/src/style/INamedStyleCollection.d.ts +72 -0
  293. package/types/src/style/IStyle.d.ts +30 -10
  294. package/types/src/style/IStyleCollection.d.ts +63 -42
  295. package/types/src/style/ITableStyleCollection.d.ts +89 -0
  296. package/types/src/style/NamedStyleCollection.d.ts +39 -0
  297. package/types/src/style/StyleCollection.d.ts +41 -5
  298. package/types/src/style/TableStyleCollection.d.ts +49 -0
  299. package/types/src/style/_BuiltInStyleDefs.d.ts +3 -3
  300. package/types/src/style/index.d.ts +4 -0
  301. package/types/src/table/AnchoredTable.d.ts +644 -68
  302. package/types/src/table/AutoTable.d.ts +5 -5
  303. package/types/src/table/ITable.d.ts +228 -30
  304. package/types/src/table/ITableCollection.d.ts +2 -0
  305. package/types/src/table/TableCollection.d.ts +19 -8
  306. package/types/src/table/_FilterField.d.ts +7 -5
  307. package/types/src/table/_NamedTable.d.ts +17 -1
  308. package/types/src/table/_NamedTableSource.d.ts +1 -0
  309. package/types/src/table/_SortField.d.ts +2 -0
  310. package/types/src/table/_TableColumn.d.ts +13 -2
  311. package/types/src/table/_TableMessages.d.ts +1 -0
  312. package/types/src/table/_TableUtils.d.ts +40 -0
  313. package/types/src/text/Bullet.d.ts +4 -0
  314. package/types/src/text/ITextFrame.d.ts +25 -1
  315. package/types/src/text/TextBoxAlignment.d.ts +15 -6
  316. package/types/src/text/TextFrame.d.ts +4 -0
  317. package/types/src/text/TextLine.d.ts +4 -0
  318. package/types/src/text/TextParagraph.d.ts +4 -0
  319. package/types/src/text/TextRun.d.ts +9 -0
  320. package/types/src/text/TextStacked.d.ts +83 -0
  321. package/types/src/text/index.d.ts +1 -0
  322. package/types/src/theme/ITheme.d.ts +2 -0
  323. package/types/src/theme/IThemeCollection.d.ts +2 -0
  324. package/types/src/theme/ThemeCollection.d.ts +8 -7
  325. package/types/src/transaction/ITransaction.d.ts +238 -36
  326. package/types/src/transaction/Transaction.d.ts +99 -11
  327. package/types/src/type/AbstractCollection.d.ts +101 -0
  328. package/types/src/type/ICollection.d.ts +117 -0
  329. package/types/src/type/ITypes.d.ts +9 -7
  330. package/types/src/type/index.d.ts +1 -0
  331. package/types/src/utils/_CSSUtils.d.ts +3 -3
  332. package/types/src/workbook/IWorkbook.d.ts +171 -40
  333. package/types/src/workbook/Workbook.d.ts +103 -7
  334. package/types/src/workbook/_WorkbookIntents.d.ts +36 -0
  335. package/types/src/workbookProtection/IWorkbookProtection.d.ts +7 -0
  336. package/types/src/workbookProtection/WorkbookProtection.d.ts +3 -0
  337. package/types/src/workbookView/IWorkbookView.d.ts +12 -0
  338. package/types/src/workbookView/WorkbookView.d.ts +5 -0
  339. package/browser/cjs/BatsV2UUraVDCRXm.cjs +0 -57
  340. package/browser/cjs/CUz53T65cRGQRgvv.cjs +0 -33
  341. package/browser/cjs/DU0kYUtdFa3jK-im.cjs +0 -1
  342. package/browser/cjs/Dv4yIPLV98M5zLHa.cjs +0 -1
  343. package/browser/esm/6JKSOvc5czaQB2Bj.mjs +0 -109
  344. package/browser/esm/BtuJ9AGzeURtAsGo.mjs +0 -51241
  345. package/browser/esm/DGU6sM25u0EWCKl1.mjs +0 -824
  346. package/browser/esm/f2G3QRgEbvFJcoa2.mjs +0 -4436
  347. package/node/esm/-pxdn3M3tc6PLHs7.mjs +0 -114
  348. package/node/esm/0n5bslM9jhO1JnI2.mjs +0 -843
  349. package/types/src/cellRange/_GraphNode.d.ts +0 -38
  350. package/types/src/dataValidation/_Utils.d.ts +0 -10
  351. package/types/src/sheet/listener/RangesListener.d.ts +0 -32
  352. package/types/src/sheet/listener/RangesListenerEntry.d.ts +0 -19
  353. package/types/src/sheet/listener/index.d.ts +0 -3
@@ -1,33 +1,58 @@
1
1
  import { Scalar, IRange, FormulaError } from '@sheetxl/primitives';
2
- import { ReferenceableClipboard } from '@sheetxl/utils';
2
+ import { RangeStats } from '../../primitives/RangeStats';
3
3
  import { ITypes } from '../../type';
4
+ import { ITransaction } from '../../transaction';
4
5
  import { IListener } from '../../listener';
5
6
  import { IHistory } from '../../history';
6
- import { ISpatialQuery, ISpatialMap, ISparseGrid, Tuple } from '../../collections';
7
- import { IFormulaBlock } from '../formula';
7
+ import { ISpatialMap, ISpatialQuery, ISparseGrid, Tuple } from '../../collections';
8
+ import { IFormulaBlockView } from '../formula';
9
+ import { FormulaEntry } from './FormulaEntry';
8
10
  import { ContentfulSpatialValue, SpillEntry, CircularEntry } from '../spatial';
9
- import { ReferenceCoords, NamedReference } from '../Types';
11
+ import { NamedReference, NamedNodeInfo } from '../Types';
10
12
  import { ICalculation } from '../ICalculation';
11
13
  /**
12
- * The CalcGrid holds input and outputs of in a 2D space to a scope (usually a sheet).
14
+ * The CalcGridBackend holds input and outputs of in a 2D space to a scope (usually a sheet).
13
15
  *
14
16
  * @remarks
15
17
  * If inputValues are externally managed then formulas update must also be provided.
18
+ *
19
+ * Every mutation is ASYNCHRONOUS and resolves with an {@link ICalcGrid.Results}: the blocks the
20
+ * engine compiled or re-imaged for the write ({@link ICalcGrid.Results.formulaInserts}) and the
21
+ * coords it removed ({@link ICalcGrid.Results.formulaRemoves}). Nothing about the grid is readable
22
+ * synchronously after a write; a caller keeps its own formula text and patches it from the
23
+ * resolution. A request names the snapshot it was made at ({@link ICalcGrid.RequestOptions.commitId})
24
+ * and the resolution echoes it ({@link ICalcGrid.Results.commitId}): its coords mean addresses in
25
+ * THAT snapshot, whatever the caller has done since. A rewrite the engine makes to a grid nobody
26
+ * called - a cross-sheet reference turned `#REF!` by a delete on another sheet - reaches that grid
27
+ * through its own `onCalculated`, the way values do, naming the last snapshot the engine applied.
28
+ *
29
+ * Every request goes through the service's channel (DESIGN-CALC-SERVICE §4, §7.2). On a `Running`
30
+ * engine it is applied at once; while the engine is `Starting` it is held, as data, and applied
31
+ * in send order once the engine is up, behind the seed the grid was opened from; on an `Off`
32
+ * engine it is not recorded at all and resolves with nothing: the caller's own view is the truth
33
+ * there, and a later start is seeded from it. An `Off` engine is never started by a request.
16
34
  */
17
35
  export interface ICalcGrid {
18
36
  /**
19
37
  * Set a group of cells and formula ranges.
20
38
  *
21
- * @param values A set of input values as BoundedTuples
39
+ * @param values A set of input values as Region
22
40
  * @param ranges A set of formula strings as ranged entries.
41
+ * @param options See {@link ICalcGrid.SetInputsOptions}.
42
+ *
43
+ * @returns Resolves with the blocks compiled for the written formulas, the remainders of any
44
+ * block a value split, and the coords cleared.
23
45
  */
24
- setInputs(values: Tuple.BoundedTuples<Scalar> | null, formulas: readonly ISpatialMap.Entry<string>[] | null): IRange.Coords[];
46
+ setInputs(values: Tuple.Region<Scalar> | null, formulas: readonly ISpatialMap.Entry<string>[] | null, options?: ICalcGrid.SetInputsOptions): Promise<ICalcGrid.Results>;
25
47
  /**
26
48
  * Remove all values within a range.
27
49
  *
28
50
  * @param coords The coordinates to remove.
51
+ * @param options See {@link ICalcGrid.RemoveOptions}.
52
+ *
53
+ * @returns Resolves with the coords cleared and the remainders of any block the range split.
29
54
  */
30
- remove(coords: IRange.Coords): IRange.Coords[];
55
+ remove(coords: IRange.Coords, options?: ICalcGrid.RemoveOptions): Promise<ICalcGrid.Results>;
31
56
  /**
32
57
  * Execute a calculate on a single grid.
33
58
  *
@@ -49,107 +74,188 @@ export interface ICalcGrid {
49
74
  */
50
75
  markDirtyRegions(coords: IRange.Coords[]): void;
51
76
  /**
52
- * Returns true if there are any dirty regions that need to be calculated.
77
+ * The key of this grid's record in the model's store (DESIGN-CALC-SERVICE §13.23): what the
78
+ * grid holds, versioned beside the sheet's own record so that an undo restores both together.
79
+ *
80
+ * @remarks
81
+ * For a cell buffer to name among the records its held writes go to, so that a read of the
82
+ * grid through the store makes those writes first. The reads themselves take the transaction
83
+ * to answer for; nothing reads the record by this key.
53
84
  */
54
- getDirtyRegions(): ISpatialQuery;
85
+ getStateId(): string;
55
86
  /**
56
- * Returns the formula block at the given coordinates.
87
+ * The values as the model holds them: the literals it entered and the answers the engine
88
+ * vended, one map (DESIGN-CALC-SERVICE §13.24).
57
89
  *
58
- * @param row The row of the cell to evaluate.
59
- * @param column The column of the cell to evaluate.
90
+ * @remarks
91
+ * The whole grid, not a narrowed read surface: the sheet reads values on its hottest paths and
92
+ * sparse grids are heading for buffer-backed runs, which closes the boundary a narrower type
93
+ * would have bought. Answered from the grid's own store record - never the backend's working
94
+ * copy, which is on the far side of the boundary and can be behind.
95
+ * @param transaction Read the record as this transaction sees it, its held writes not yet
96
+ * made; the current record when omitted.
60
97
  */
61
- getFormulaBlockAt(row: number, column: number): IFormulaBlock | null;
98
+ getValues(transaction?: ITransaction | null): ISparseGrid<Scalar>;
62
99
  /**
63
- * Returns a queryable spatial index of all formulas in the graph.
64
- *
65
- * @remark
66
- * Used by sheet
100
+ * The contentful index: which cells hold a value, summarized per run. Derived from
101
+ * {@link getValues} and kept in step with it.
102
+ * @param transaction Read the record as this transaction sees it, its held writes not yet
103
+ * made; the current record when omitted.
104
+ */
105
+ getContentful(transaction?: ITransaction | null): ISpatialMap<ContentfulSpatialValue>;
106
+ /**
107
+ * The array extents: where an array-entered or dynamic formula occupies more than its anchor.
108
+ * @param transaction Read the record as this transaction sees it, its held writes not yet
109
+ * made; the current record when omitted.
110
+ */
111
+ getSpills(transaction?: ITransaction | null): ISpatialMap<SpillEntry>;
112
+ /**
113
+ * The cells the engine has not answered for yet - an async function in flight, a pass still
114
+ * running.
115
+ * @param transaction Read the record as this transaction sees it, its held writes not yet
116
+ * made; the current record when omitted.
117
+ */
118
+ getPending(transaction?: ITransaction | null): ISpatialMap<boolean>;
119
+ /**
120
+ * Engine FAILURES by cell (a formula that could not be evaluated), as a message. Not error
121
+ * VALUES - those are {@link getErrorValues}.
122
+ * @param transaction Read the record as this transaction sees it, its held writes not yet
123
+ * made; the current record when omitted.
67
124
  */
68
- getFormulas(): ISpatialQuery<IFormulaBlock>;
125
+ getCalcErrors(transaction?: ITransaction | null): ISpatialMap<string>;
69
126
  /**
70
- * Returns a queryable spatial index of the ARRAY EXTENTS on this grid — one entry per array
71
- * formula, keyed by the cells it occupies: a dynamic array's spill, a legacy CSE block, or the
72
- * single cell a blocked spill collapses to.
127
+ * Cells in a reference cycle or downstream of one, by cycle (DESIGN-CIRCULAR-CALC.md §7.2).
128
+ * @param transaction Read the record as this transaction sees it, its held writes not yet
129
+ * made; the current record when omitted.
130
+ */
131
+ getCirculars(transaction?: ITransaction | null): ISpatialMap<CircularEntry>;
132
+ /**
133
+ * Error VALUES (`#DIV/0!`, `#N/A`, ...) by cell: the `Error` scalar kind, entered or computed.
134
+ * Deliberately not per-type - an entry means "an error value lives here".
73
135
  *
74
- * @remark
75
- * The same index a calculation pass writes through {@link ICalcGrid.IncrementalUpdates.spillSpatial}
76
- * (`beginUpdates` hands out this very map), so a read answers identically inside and outside a
77
- * pass — which is what lets a formula evaluated OUTSIDE one resolve a spill anchor.
136
+ * @remarks
137
+ * The reconciled view. The index the write path maintains is fresh for what the model entered
138
+ * and stale for formula cells (the executor does not emit error deltas yet), so this
139
+ * reconciles it against the values and caches the result until the values change again. It
140
+ * collapses into a plain read once the executor emits those deltas.
78
141
  */
79
- getSpills(): ISpatialQuery<SpillEntry>;
142
+ getErrorValues(): ISpatialMap<boolean>;
80
143
  /**
81
- * Returns the current values on the grid.
144
+ * The volatile regions the file listed: what an `Off` save writes back and a seed carries,
145
+ * kept where a formula still sits under them. What the engine knows once it is up it answers
146
+ * itself ({@link isVolatileAt}); this list is not shifted by a structural change.
82
147
  */
83
- getValues(): ISparseGrid<Scalar>;
148
+ getVolatileRegions(): IRange.Address[] | null;
84
149
  /**
85
- * Shifts all values in the graph in a given direction.
150
+ * The statistics cache over {@link getValues}, for the aggregate reads.
86
151
  *
87
- * @param options The options for the shift.
152
+ * @remarks
153
+ * Here because it caches against the value grid INSTANCE, and the instance changes whenever a
154
+ * write or a vend clones the map - which is the grid's business, not its reader's.
88
155
  */
89
- shift(options: ICalcGrid.ShiftOptions): this;
156
+ getRangeStats(): RangeStats;
90
157
  /**
91
- * Returns a snapshot of the graph that can be used for copying.
158
+ * The formula at a cell, as the model holds it: its text the moment it is written, the
159
+ * compiled block's view once the engine has vended one. `null` where there is none.
92
160
  */
93
- getSnapshot(options?: ICalcGrid.GetSnapshotOptions): ICalcGrid.ISnapshot;
161
+ getFormulaAt(row: number, column: number): FormulaEntry | null;
94
162
  /**
95
- * Autofill the values from a single cell to the entire range.
163
+ * The formulas as the model holds them, one entry per run, as a read-only spatial query: the
164
+ * text the moment it is written, the compiled block's view once the engine has vended one.
165
+ *
166
+ * @param commitId A commit to answer for, in place of the current state. `null` when the store
167
+ * no longer has it on its live history (undone, rolled back, pruned) or this grid did not exist
168
+ * at it.
96
169
  *
97
170
  * @remarks
98
- * This is similar to getSnapshot but doesn't return a promise.
171
+ * The current map. A past snapshot's is read from the store, at the commit, under
172
+ * {@link getStateId}.
173
+ * @param transaction Read the record as this transaction sees it, its held writes not yet
174
+ * made; the current record when omitted.
99
175
  */
100
- autoFill(template: IRange.Coords | string, destination: IRange.Coords | string): this;
176
+ getFormulas(transaction?: ITransaction | null): ISpatialQuery<FormulaEntry>;
101
177
  /**
102
- * Returns the dependents for a specific range.
178
+ * Shifts all values in the graph in a given direction.
103
179
  *
104
- * @param coords The coordinates of the range.
180
+ * @param options The options for the shift.
105
181
  *
106
182
  * @remarks
107
- * A range a formula resolved at run time — `INDIRECT`, `OFFSET` — is reported like any other,
108
- * with the caveat under {@link getDirectPrecedentsAt}.
183
+ * Shifts THIS grid in place; a caller that versions the grid clones it first.
184
+ *
185
+ * @returns Resolves with the blocks re-imaged by the shift (references across the boundary,
186
+ * `#REF!`, split pieces) at their new coords, and the coords vacated.
109
187
  */
110
- getDirectDependentsAt(coords: IRange.Coords): IRange.Coords[];
188
+ shift(options: ICalcGrid.ShiftOptions): Promise<ICalcGrid.Results>;
111
189
  /**
112
- * Returns the precedents for a specific range.
190
+ * The model has restored itself to a snapshot (an undo, a redo): the engine restores its own
191
+ * history to the same id (design §13.13).
113
192
  *
114
- * @param coords The coordinates of the range.
193
+ * @param options The snapshot restored to.
115
194
  *
116
195
  * @remarks
117
- * A range a formula resolved at run time — `INDIRECT`, `OFFSET` — is reported like any other,
118
- * but it is not the same KIND of fact and should not be cached as one. A written reference is a
119
- * property of the formula's text: true before anything calculates, and unchanged until the text
120
- * changes. A resolved one is a record of the last calculation, so it moves when the formula's own
121
- * inputs move (`INDIRECT(B1&"!A1")` names a different sheet once `B1` does), and it is absent
122
- * entirely for a block that has not been calculated yet.
196
+ * A response to a request that the restore undid is dropped, so the entries the restore put
197
+ * back have no block until the engine says what it holds for them. The engine knows what
198
+ * changed between the two snapshots from what its commits recorded.
123
199
  *
124
- * Its bounds are also the union of everything the block read, which for a scattered read is wider
125
- * than the cells actually touched. Deliberately: over-reporting costs a caller a check that comes
126
- * back clean, where under-reporting hands it an incomplete answer that looks complete.
200
+ * @returns Resolves with the blocks over the changed cells, at the coords they have in the
201
+ * restored snapshot, and those coords as removes: the view re-adopts exactly what the engine
202
+ * holds there.
203
+ */
204
+ revert(options: ICalcGrid.RevertOptions): Promise<ICalcGrid.Results>;
205
+ /**
206
+ * Returns a snapshot of the graph that can be used for copying.
127
207
  */
128
- getDirectPrecedentsAt(coords: IRange.Coords): IRange.Coords[];
208
+ getSnapshot(options?: ICalcGrid.GetSnapshotOptions): ICalcGrid.ISnapshot;
129
209
  /**
130
- * Returns all ranges recursively, including those that depend on it indirectly
131
- * through the full calculation chain.
210
+ * Autofill the values from a single cell to the entire range.
132
211
  *
133
212
  * @remarks
134
- * This performs a recursive search downstream to find the total impact of a value change.
213
+ * Fills THIS grid in place; a caller that versions the grid clones it first.
214
+ *
215
+ * @param options See {@link ICalcGrid.RequestOptions}.
216
+ *
217
+ * @returns Resolves with the blocks minted over the destination.
135
218
  */
136
- getDependentsAt(coords: IRange.Coords): IRange.Coords[];
219
+ autoFill(template: IRange.Coords | string, destination: IRange.Coords | string, options?: ICalcGrid.RequestOptions): Promise<ICalcGrid.Results>;
137
220
  /**
138
- * Returns all precedents recursively, including those referenced indirectly
139
- * through the full calculation chain.
221
+ * Everything `coords` depends on, or that depends on it - cells AND names, in ONE call.
222
+ *
223
+ * @param coords The range to answer for, scoped in calc currency (a sheet's stableId, or bare
224
+ * for this grid).
225
+ * @param kind Which direction to walk.
226
+ * @param direct `true` for one hop, `false` for the full recursive closure.
140
227
  *
141
228
  * @remarks
142
- * This performs a recursive search upstream to find all root data sources.
229
+ * The graph question belongs here whole. Composed by a caller it was two calls plus the
230
+ * knowledge of which of the four walks pairs with which name half - calculation reasoning that
231
+ * had leaked into the model layer.
232
+ *
233
+ * The two halves are found differently, which is the reason they are not one list. A PRECEDENT
234
+ * name is one the queried formulas MENTION (apply-at-eval leaves no cell edge for it). A
235
+ * DEPENDENT name is one whose virtual grid a walk result LANDED in - that name's body reading
236
+ * these cells - and it is reported only while the name is live.
237
+ *
238
+ * `cells` stay in calc currency; converting their scope to something addressable is the model's
239
+ * job, as is turning ids into range objects.
143
240
  */
144
- getPrecedentsAt(coords: IRange.Coords): IRange.Coords[];
241
+ getGraphNeighborsAt(coords: IRange.Coords, kind: 'precedents' | 'dependents', direct: boolean): Promise<ICalcGrid.GraphNeighbors>;
145
242
  /**
146
- * Returns the absolute direct precedents for a formula.
243
+ * Evaluates the formula at a cell and returns its finalized value.
147
244
  *
148
245
  * @param row The row of the cell to evaluate.
149
246
  * @param column The column of the cell to evaluate.
150
- * @throws Error if there is not a formula at the coordinates.
247
+ * @param options An eval index, or {@link ICalculation.EvaluateOptions}.
248
+ *
249
+ * @remarks
250
+ * The engine side of `IFormula.evaluate()`. Evaluating needs the calc scope, which only the
251
+ * engine has - so it lives on this surface rather than on the block a caller is holding, and
252
+ * is `async` for the same reason `IFormula.evaluate()` always was.
253
+ *
254
+ * Resolves to `null` when no formula is at the cell. The block is resolved HERE rather than
255
+ * captured by the caller: the engine re-mints a block on every rewrite, so a captured
256
+ * instance can be a snapshot of the formula as it was.
151
257
  */
152
- getReferencesAt(row: number, column: number): ReferenceCoords[];
258
+ evaluateAt(row: number, column: number, options?: number | ICalculation.EvaluateOptions): Promise<Scalar | IRange>;
153
259
  /**
154
260
  * Sets the reference to an absolute range at a specific cell coordinate.
155
261
  *
@@ -161,27 +267,36 @@ export interface ICalcGrid {
161
267
  * {@link IFormulaBlock.setReferenceAt}.
162
268
  * @throws Error if the cell is not a formula.
163
269
  */
164
- setReferenceAt(row: number, column: number, index: number, precedent: IRange.FixableCoords | IRange.FixableCellCoords | NamedReference | FormulaError.Ref): this;
270
+ setReferenceAt(row: number, column: number, index: number, precedent: IRange.FixableCoords | IRange.FixableCellCoords | NamedReference | FormulaError.Ref): Promise<IFormulaBlockView | null>;
165
271
  /**
166
- * Return true if the cell at row column is volatile.
272
+ * Cycles the absolute/relative (`$`) style of the reference at `index` - F4.
167
273
  *
168
- * @param row The row of the cell to evaluate.
169
- * @param column The column of the cell to evaluate.
274
+ * @param row The row of the cell holding the formula.
275
+ * @param column The column of the cell holding the formula.
276
+ * @param index The index of the reference to cycle (aligned to the formula's references,
277
+ * `IFormulaBlockView.getReferencesAt`).
278
+ * @param side Which corner of a range to cycle; `'self'` for a standalone cell.
279
+ * @param mode An explicit mode, or `undefined` to advance one step in the F4 order.
280
+ * @throws Error if there is no CELL reference at `index` (a named reference has no `$` style).
170
281
  *
171
282
  * @remarks
172
- *
173
- * This is not used internally but is provided to allow api to query.
283
+ * Read-cycle-write in ONE call. Composed on the client it is three round trips per keypress
284
+ * (the reference, then the write, then reading the result back), which is the wrong shape
285
+ * for a proxied engine.
174
286
  */
175
- isVolatileAt(row: number, column: number): boolean;
287
+ setReferenceModeAt(row: number, column: number, index: number, side?: ICalculation.ReferenceSide, mode?: number): Promise<IFormulaBlockView | null>;
176
288
  /**
177
- * Returns a copy on write clone.
289
+ * Whether the formula at the cell is volatile: found by the engine as it evaluates, so a
290
+ * question answered in order behind the writes sent before it.
178
291
  *
179
- * @param cloneKey A performance optimization that will avoid cloning if the same key is used.
292
+ * @param row The row of the cell to evaluate.
293
+ * @param column The column of the cell to evaluate.
180
294
  *
181
295
  * @remarks
182
- * If the same clone key is used then the same instance will be returned.
296
+ *
297
+ * This is not used internally but is provided to allow api to query.
183
298
  */
184
- clone(cloneKey?: any): this;
299
+ isVolatileAt(row: number, column: number): Promise<boolean>;
185
300
  /**
186
301
  * Add Listeners to graph.
187
302
  */
@@ -191,26 +306,31 @@ export interface ICalcGrid {
191
306
  */
192
307
  getEntireCoords(): IRange.Coords;
193
308
  /**
194
- * Returns the bounding range for the content.
195
- *
196
- * @remarks
197
- * This includes values and formulas.
309
+ * The grid's size changed: {@link getEntireCoords} answers the new one. The engine is told in
310
+ * order with the grid's writes, under the snapshot named, so an undo restores the old size there.
198
311
  *
199
- * @returns `null` if the grid has no content.
312
+ * @param options See {@link ICalcGrid.RequestOptions}.
200
313
  */
201
- getBoundingRange(): IRange.Coords | null;
314
+ resize(options?: ICalcGrid.RequestOptions): void;
202
315
  /**
203
- * Loads the json into the graph.
316
+ * Opens the grid from a seed: a statement of its whole content (DESIGN-CALC-SERVICE §6).
204
317
  *
205
- * @param json The JSON to load.
206
- * @param options {@link ICalcGrid.FromJSONOptions}
318
+ * @param json The content, the same record a save writes.
319
+ * @param options {@link ICalcGrid.SeedOptions}
207
320
  *
208
321
  * @remarks
209
- * This will clear all values and formulas including any pending changes or invalidation.
322
+ * Replaces everything the grid held, so opening twice equals opening once. A seed is a request
323
+ * like any other: applied at once on a `Running` engine, held in order while the engine is
324
+ * `Starting`, not recorded on an `Off` one (the owner keeps the content and hands it over again
325
+ * when the service is started). Its results are a full pass's - `isFull`, every block it
326
+ * compiled and every array extent it read - and reach the owner through `onCalculated` as it is
327
+ * applied, in order with every other record the grid pushes; the promise resolves after that.
210
328
  *
211
- * @returns `undefined` when the calculation is not ready (the load is deferred until start).
329
+ * A seed trusts the values it carries as a load does. One handed over at `start()` by an owner
330
+ * the engine has not been following - a sheet written to while `Off` - asks for a full pass
331
+ * instead ({@link ICalcGrid.SeedOptions.full}).
212
332
  */
213
- fromJSON(json: ICalcGrid.JSON, options?: ICalcGrid.FromJSONOptions): ICalcGrid.Results | undefined;
333
+ seed(json: ICalcGrid.JSON, options?: ICalcGrid.SeedOptions): Promise<ICalcGrid.Results>;
214
334
  /**
215
335
  * Returns a JSON representation of the calcGrid.
216
336
  *
@@ -224,16 +344,18 @@ export interface ICalcGrid {
224
344
  */
225
345
  getId(): string;
226
346
  /**
227
- * Returns a record for new incremental updates.
347
+ * Remove the grid from the calculation: every formula that read it reads `#REF!`.
228
348
  *
229
- * @remarks
230
- * This will create a new record for tracking incremental updates.
349
+ * @param options See {@link ICalcGrid.RequestOptions}; the removal lands under the snapshot
350
+ * named, and a revert to before it registers the grid again.
231
351
  */
232
- beginUpdates(): ICalcGrid.IncrementalUpdates;
352
+ delete(options?: ICalcGrid.RequestOptions): void;
233
353
  /**
234
- * Remove the grid from the calculation.
354
+ * Release the grid: its owner is done with it. The engine takes it out of the graph and every
355
+ * formula that read it computes `#REF!` on its next evaluation. Not undoable - {@link delete} is
356
+ * the removal an undo brings back.
235
357
  */
236
- delete(): void;
358
+ close(): void;
237
359
  }
238
360
  /**
239
361
  * {@inheritDoc ICalcGrid}
@@ -244,7 +366,83 @@ export interface ICalcGrid {
244
366
  * {@link ICalcGrid}
245
367
  */
246
368
  export declare namespace ICalcGrid {
369
+ /**
370
+ * What the model's grid forwards to (DESIGN-CALC-SERVICE §13.23): every verb and every read
371
+ * the engine answers, and nothing the model holds for itself. The in-process engine grid is
372
+ * one; a message-passing proxy under a worker is another.
373
+ */
374
+ type Backend = Omit<ICalcGrid, 'getStateId' | 'getFormulaAt' | 'getFormulas' | 'getValues' | 'getContentful' | 'getSpills' | 'getPending' | 'getCalcErrors' | 'getCirculars' | 'getErrorValues' | 'getVolatileRegions' | 'getRangeStats'> & {
375
+ /** Write a body as authored; the engine anchors it (see {@link ICalcGrid.BodyOptions}). */
376
+ setBody(options: ICalcGrid.BodyOptions): Promise<ICalcGrid.Results>;
377
+ /** {@link ICalcGrid.evaluateAt} coerced to one scalar, as a defined name's `evaluate()` is. */
378
+ evaluateScalarAt(row: number, column: number, evalIndex?: number): Promise<Scalar>;
379
+ /** Owe a pass seeded from this grid, run once the current flush is over. */
380
+ requestPass(): void;
381
+ /**
382
+ * The graph around the defined name whose body this grid holds - its precedents or
383
+ * dependents, cells in calc currency and names - as {@link ICalcGrid.getGraphNeighborsAt}
384
+ * answers for cells.
385
+ */
386
+ getNameGraph(kind: 'precedents' | 'dependents', direct: boolean): Promise<ICalcGrid.GraphNeighbors>;
387
+ };
388
+ /**
389
+ * A body written as it was authored, for a grid that holds one (a name's, a watch's): the engine
390
+ * compiles it where it was authored, binds every bare reference to `scopeGridId`, and writes it
391
+ * over `coords` imaged at their top-left.
392
+ */
393
+ interface BodyOptions {
394
+ /** Where the body goes: the block's extent. */
395
+ coords: IRange.Coords;
396
+ /** The expression as authored. */
397
+ expression: string;
398
+ /** The cell the expression was authored at; relative references are offsets from here. */
399
+ authoredAt: IRange.CellCoords;
400
+ /** The sheet grid a bare reference in the expression resolves against. */
401
+ scopeGridId: string;
402
+ /** Re-derive the formulas that mention this grid's name once the body is in: a defined name's. */
403
+ recompile?: boolean;
404
+ /**
405
+ * Applied ahead of the other requests a start holds: a defined name must be bound before any
406
+ * formula that mentions it is examined.
407
+ */
408
+ priority?: boolean;
409
+ }
410
+ /**
411
+ * What {@link ICalcGrid.getGraphNeighborsAt} answers: the two halves of a graph neighborhood,
412
+ * both in currency that crosses a wire.
413
+ */
414
+ interface GraphNeighbors {
415
+ /** Neighbor ranges, scoped by GRID (a sheet's stableId), or unscoped for the queried grid. */
416
+ cells: IRange.Coords[];
417
+ /** The named formulas in the neighborhood, as plain data ready to become range objects. */
418
+ names: NamedNodeInfo[];
419
+ }
420
+ /**
421
+ * A cell's format on entry when its formula reads cells (see {@link Results.formatInserts}).
422
+ *
423
+ * @remarks
424
+ * Excel ranks the cell a formula reads ahead of a function's format - `=A1+TODAY()` shows what
425
+ * `A1` does - and falls back to the function's only when no reference carries one.
426
+ */
427
+ interface InheritedFormat {
428
+ /**
429
+ * The references the formula reads as values, in text order, relative to the entry's own
430
+ * top-left: offsets on a relative axis, a position on a fixed one. A range stands for its
431
+ * top-left cell. The first whose cell's format is not General is the cell's.
432
+ */
433
+ references: IRange.FixableCoords[];
434
+ /** The format the formula's functions supplied, for when none of the references carries one. */
435
+ fallback: string | null;
436
+ }
437
+ /** What a {@link Results.formatInserts} entry carries: a function's format, or what to inherit. */
438
+ type FormatInsert = string | InheritedFormat;
247
439
  interface Results {
440
+ /**
441
+ * The snapshot this record answers for: the {@link RequestOptions.commitId} of the request,
442
+ * or, for a record the engine pushed (a calculation pass), the last commit the engine
443
+ * applied. The formula coords below are addresses in that snapshot.
444
+ */
445
+ commitId?: string;
248
446
  /**
249
447
  * The id of the calculation that was completed.
250
448
  *
@@ -268,12 +466,12 @@ export declare namespace ICalcGrid {
268
466
  */
269
467
  bounds?: IRange.Coords | null;
270
468
  /**
271
- * The results of the calculation will either be as `Map` or as a `Tuple.BoundedTuples`.
469
+ * The results of the calculation will either be as `Map` or as a `Tuple.Region`.
272
470
  *
273
471
  * @see
274
472
  * {@link CalculateOptions.asTuples}
275
473
  */
276
- valueInserts?: Tuple.BoundedTuples<Scalar>;
474
+ valueInserts?: Tuple.Region<Scalar>;
277
475
  /**
278
476
  * Values that have been cleared.
279
477
  */
@@ -288,12 +486,16 @@ export declare namespace ICalcGrid {
288
486
  */
289
487
  spillRemoves?: ISpatialMap.Entry[];
290
488
  /**
291
- * Formatting updates due to functions.
489
+ * The number format each realized formula cell takes on entry: a format its functions
490
+ * supplied (`=TODAY()` a date), or the references it inherits one from.
292
491
  *
293
492
  * @remarks
294
- * Formats are not cleared.
493
+ * One value per cell, the executor's pick: an {@link InheritedFormat} when the formula has
494
+ * references that are value operands (`IFormulaBlock.getFormatReferences`), else the
495
+ * function's string, else nothing. Which format the references carry, and as of when, is the
496
+ * reader's to resolve. Formats are not cleared.
295
497
  */
296
- formatInserts?: ISpatialMap.Entry<string>[];
498
+ formatInserts?: ISpatialMap.Entry<ICalcGrid.FormatInsert>[];
297
499
  /**
298
500
  * Contains any errors that were inserted.
299
501
  */
@@ -319,6 +521,40 @@ export declare namespace ICalcGrid {
319
521
  * These are guaranteed to not overlap.
320
522
  */
321
523
  circularUpdates?: ISpatialMap.Entry<CircularEntry | null>[];
524
+ /**
525
+ * Blocks the engine compiled or re-imaged, at the coords they cover, as the read views the
526
+ * model holds: the vend of the formula half. Every site that mints a block reports it here -
527
+ * a write, a value splitting a block, a shift, a cross-sheet `#REF!`, a copy, a fill, a
528
+ * reference edit, the legacy `@` wrap on load.
529
+ *
530
+ * @remarks
531
+ * Applied in order after {@link formulaRemoves}. On {@link isFull} every block on the grid is
532
+ * listed, so a caller that dropped its blocks on the full pass has them all back. What
533
+ * crosses is the block as data; the view is imaged from it on the model's side of the
534
+ * channel, against the model's own symbols (DESIGN-CALC-SERVICE §8).
535
+ */
536
+ formulaInserts?: ISpatialMap.Entry<IFormulaBlockView>[];
537
+ /**
538
+ * Coords whose formulas the engine removed: cleared, replaced, or moved away by a shift.
539
+ */
540
+ formulaRemoves?: IRange.Coords[];
541
+ /**
542
+ * For a grid that holds one body (a watch's, a name's): the body's blank region as the pass
543
+ * left it, `null` when nothing is shared. Absent from a sheet's grid.
544
+ */
545
+ blankRegion?: ICalcGrid.BlankRegion | null;
546
+ }
547
+ /**
548
+ * The cells of a body that a pass shares one answer for rather than writing, and that answer:
549
+ * what every such cell reads as.
550
+ */
551
+ interface BlankRegion {
552
+ /** The shared answer. */
553
+ readonly value: Scalar | undefined;
554
+ /** The rectangles it covers, in the grid's coordinates. */
555
+ readonly rects: readonly IRange.Coords[];
556
+ /** The body's extent: a read wider than it shares nothing. */
557
+ readonly extent: IRange.Coords;
322
558
  }
323
559
  /**
324
560
  * Returns from `ICalcGrid.beginUpdates()`.
@@ -335,6 +571,18 @@ export declare namespace ICalcGrid {
335
571
  circularSpatial: ISpatialMap<CircularEntry>;
336
572
  contentfulSpatial: ISpatialMap<ContentfulSpatialValue>;
337
573
  notifyValues: ISpatialMap;
574
+ /**
575
+ * Reports a region whose answer changed without a write to the grid: a blank region the pass
576
+ * shares one answer for on the block instead of writing (PLAN-WATCHES-BLANK-AWARE §4c).
577
+ *
578
+ * @remarks
579
+ * Accumulated as bounds, not as a region index. Only `Results.bounds` learns of this - there
580
+ * are no values to vend - and that is one rectangle over every notify source, so the union is
581
+ * the whole of what a caller can observe.
582
+ *
583
+ * `coords` is read, never kept, and its scope is ignored.
584
+ */
585
+ notifyBlank(coords: IRange.Coords): void;
338
586
  notifySpillsInsert: ISpatialMap.Entry<SpillEntry>[];
339
587
  notifySpillsRemove: IRange.Coords[];
340
588
  notifyFormats: ISpatialMap;
@@ -344,7 +592,7 @@ export declare namespace ICalcGrid {
344
592
  circularConflating: ISpatialMap.IConflatingEntries<CircularEntry | false> | null;
345
593
  errorRemovesConflating: ISpatialMap.IConflatingEntries<null> | null;
346
594
  errorInsertsConflating: ISpatialMap.IConflatingEntries<string> | null;
347
- formatsConflating: ISpatialMap.IConflatingEntries | null;
595
+ formatsConflating: ISpatialMap.IConflatingEntries<ICalcGrid.FormatInsert> | null;
348
596
  /**
349
597
  * Called when the incremental updates are completed
350
598
  *
@@ -356,35 +604,59 @@ export declare namespace ICalcGrid {
356
604
  */
357
605
  done(cycleId: number, options: ICalculation.CalculateOptions): void;
358
606
  }
359
- interface GetSnapshotOptions extends ReferenceableClipboard.CopyOptions {
607
+ /**
608
+ * Options for {@link ICalcGrid.getSnapshot}: what the engine reads, named.
609
+ */
610
+ interface GetSnapshotOptions {
360
611
  /**
361
612
  * The range to capture the snapshot from. If omitted the entire range will be used.
362
613
  */
363
614
  range?: IRange.Coords | string;
615
+ /**
616
+ * `true` when the capture is for a move: the copy that follows vacates the source.
617
+ * @defaultValue false
618
+ */
619
+ isCut?: boolean;
364
620
  }
365
621
  /**
366
622
  * Provides destination details for the Snapshot when using `IHistory.ISnapshot.copyTo`.
367
623
  */
368
624
  interface SnapshotDestination {
369
625
  /**
370
- * The destination calc graph to copy to.
626
+ * The id of the grid to copy to ({@link ICalcGrid.getId}): the destination is named, never
627
+ * handed over.
371
628
  */
372
- calcGrid: ICalcGrid;
629
+ gridId: string;
630
+ /**
631
+ * The model's destination grid, when the caller holds it: what lets a copy land on another
632
+ * workbook's grid, which no id resolves to here. In-process only; never crosses a channel.
633
+ */
634
+ grid?: ICalcGrid;
373
635
  /**
374
636
  * The range to copy the snapshot to.
375
637
  */
376
638
  range: IRange.Coords | string;
377
639
  }
378
- interface ISnapshot extends IHistory.ISnapshot<ICalcGrid.SnapshotDestination, ICalcGrid, IRange.Coords> {
640
+ interface ISnapshot extends IHistory.ISnapshot<ICalcGrid.SnapshotDestination, ICalcGrid.Backend, IRange.Coords, any, ICalcGrid.Results> {
379
641
  /**
380
- * Called when the table is copied to a new collection.
642
+ * Copies the snapshot's formulas to the destination grid.
643
+ *
644
+ * @returns Resolves with the blocks minted at the destination (re-anchored, `#REF!` where a
645
+ * relative reference left the sheet) and, for a cut, the coords vacated at the source. The
646
+ * copied extent is the result's `bounds`.
381
647
  */
382
- copyTo(destination: ICalcGrid.SnapshotDestination, options?: ICalcGrid.CopyOptions): Promise<IRange.Coords>;
648
+ copyTo(destination: ICalcGrid.SnapshotDestination, options?: ICalcGrid.CopyOptions): Promise<ICalcGrid.Results>;
383
649
  }
384
650
  /**
385
- * Options for {@link ISnapshot.copyTo}.
651
+ * Options for {@link ISnapshot.copyTo}: what the engine reads, named. A caller's clipboard
652
+ * options (an undo selection, callbacks) are the caller's, and never ride along.
386
653
  */
387
- interface CopyOptions extends ReferenceableClipboard.CopyOptions {
654
+ interface CopyOptions extends RequestOptions {
655
+ /**
656
+ * `true` for a move: the source is vacated and the precedents of other formulas follow.
657
+ * Defaults to what the snapshot was captured with.
658
+ */
659
+ isCut?: boolean;
388
660
  /**
389
661
  * When pasting from a smaller range to a larger range copy will repeat or 'wallpaper' the
390
662
  * source values.
@@ -409,10 +681,57 @@ export declare namespace ICalcGrid {
409
681
  */
410
682
  coords?: string[];
411
683
  }
684
+ /**
685
+ * Options for {@link ICalcGrid.setInputs}.
686
+ */
687
+ /**
688
+ * What every request to the grid carries.
689
+ */
690
+ /** Options for {@link ICalcGrid.remove}. */
691
+ interface RemoveOptions extends RequestOptions {
692
+ /**
693
+ * Treat the arrays the range touches as Clear Contents does: a fixed (array-entered) one is set
694
+ * aside and put back once the cells are empty, the spilled cells of an anchor inside go now,
695
+ * and one the range cuts through becomes a spill error. A typed delete does not.
696
+ *
697
+ * @defaultValue `false`
698
+ */
699
+ clearArrays?: boolean;
700
+ }
701
+ interface RequestOptions {
702
+ /**
703
+ * The id of the transaction snapshot the request is made at: the commit the calling
704
+ * operation is, or will be. Echoed on {@link Results.commitId}; the resolution's coords are
705
+ * addresses in this snapshot.
706
+ */
707
+ commitId?: string;
708
+ /**
709
+ * The savepoint the request is made under (`ITransaction.getSavepointId`): the root's id for
710
+ * a root-level write, a nested transaction's own for a nested one. What the engine's copy of
711
+ * the maps is keyed by, so a second write under the same savepoint updates the copy the
712
+ * first one made; and what a nested rollback names. Omit outside a transaction.
713
+ */
714
+ cloneKey?: string;
715
+ }
716
+ interface SetInputsOptions extends RequestOptions {
717
+ /**
718
+ * The formula being set is array-entered (Ctrl+Shift+Enter) over this extent: it anchors a
719
+ * `fixed` block whose result is fitted to these coordinates rather than spilling from them.
720
+ * Applies to the formula entry at the extent's top-left.
721
+ */
722
+ arrayFixed?: IRange.Coords;
723
+ }
724
+ /**
725
+ * What a restore tells the grid. See {@link ICalcGrid.revert}.
726
+ */
727
+ interface RevertOptions {
728
+ /** The snapshot the model restored to. */
729
+ commitId: string;
730
+ }
412
731
  /**
413
732
  * Options for shifting the calc graph.
414
733
  */
415
- interface ShiftOptions {
734
+ interface ShiftOptions extends RequestOptions {
416
735
  /**
417
736
  * The range to shift.
418
737
  */
@@ -421,41 +740,44 @@ export declare namespace ICalcGrid {
421
740
  * The direction to shift.
422
741
  */
423
742
  direction: IRange.Direction;
743
+ }
744
+ /**
745
+ * What {@link Events.onInputsWritten} reports of a write.
746
+ */
747
+ interface InputsWritten {
748
+ /** Names the grid's inputs as this write left them; a later write names new ones. */
749
+ inputsId: string;
424
750
  /**
425
- * If `true` the this will return a clone instance of the graph if there are any modifications.
426
- *
427
- * @defaultValue false
428
- *
429
- * @remarks
430
- * This allows for a 0-1 clone on write.
751
+ * The array extents the write set aside, moved or put back - a shift carries a fixed array
752
+ * with the cells - or `null` when it touched none.
431
753
  */
432
- cloneIfUpdate?: boolean;
754
+ arrays: readonly IRange.Coords[] | null;
433
755
  }
434
756
  /**
435
757
  * Events for {@link ICalcGrid}.
436
758
  */
437
759
  interface Events {
438
760
  /**
439
- * Called when the calculation has been updated and a calculation has not been started.
761
+ * The engine answered: values, formulas and status for the cells `results` names. What it
762
+ * carries is already in this grid's maps when this is called.
440
763
  */
441
- onInvalidate?(source: ICalcGrid): void;
442
- /**
443
- * Called when a calculation is started.
444
- */
445
- onStart?(source: ICalcGrid): void;
764
+ onComplete?(source: ICalcGrid, results: ICalcGrid.Results): void;
446
765
  /**
447
- * Called when a calculation is completed.
766
+ * What a formula read answers changed without a write of the model's: the engine attached
767
+ * a compiled block, or rewrote a formula's text (`textChanged`).
448
768
  */
449
- onComplete?(source: ICalcGrid, results: ICalcGrid.Results): void;
769
+ onFormulasChanged?(source: ICalcGrid, textChanged: boolean): void;
450
770
  /**
451
- * Called when the calculation engine is unable to calc.
771
+ * A write the model made landed in this grid: an entry, a removal, a shift, a fill or a copy.
772
+ * Never a seed, never an answer of the engine's.
452
773
  *
453
774
  * @remarks
454
- * This is not when a specific function fails, but when the calculation engine is unable to complete the calculation.
775
+ * Called synchronously, inside the operation the write is part of, so what a listener writes
776
+ * lands in the same commit.
455
777
  */
456
- onError?(source: ICalcGrid): void;
778
+ onInputsWritten?(source: ICalcGrid, written: ICalcGrid.InputsWritten): void;
457
779
  /**
458
- * Called when the CalcGrid is closed.
780
+ * The grid has closed: its owner closed, or the calculation it belongs to did.
459
781
  */
460
782
  onClose?(source: ICalcGrid): void;
461
783
  }
@@ -490,17 +812,16 @@ export declare namespace ICalcGrid {
490
812
  volatile?: IRange.Address[];
491
813
  }
492
814
  /**
493
- * Options for {@link ICalcGrid.fromJSON}.
815
+ * Options for {@link ICalcGrid.seed}.
494
816
  */
495
- interface FromJSONOptions {
817
+ interface SeedOptions {
496
818
  /**
497
- * A structural transform applied to each formula's parsed tree (pre-link) as it loads —
498
- * the READ half of the dialect hook. A format reader (io-xlsx) supplies its legacy unwrap
499
- * here; native loads pass nothing.
819
+ * Recalculate everything the seed carries rather than trusting its values: the seed comes
820
+ * from an owner the engine was not following (design §13.13, the openpyxl rule).
500
821
  *
501
- * @see {@link ICalculation.FormulaTransform}
822
+ * @defaultValue `false`
502
823
  */
503
- formulaTransform?: ICalculation.FormulaTransform;
824
+ full?: boolean;
504
825
  }
505
826
  interface ToJSONOptions {
506
827
  /**
@@ -509,14 +830,6 @@ export declare namespace ICalcGrid {
509
830
  * @defaultValue `false`
510
831
  */
511
832
  includeData?: boolean;
512
- /**
513
- * A structural transform applied to each formula as it serializes (once per formula
514
- * block, on the compiled AST) — how the xlsx writer applies its legacy spellings
515
- * (see io-xlsx `LegacyFormula.ts`).
516
- *
517
- * @see {@link ICalculation.FormulaTransform}
518
- */
519
- formulaTransform?: ICalculation.FormulaTransform;
520
833
  }
521
834
  }
522
835
  //# sourceMappingURL=ICalcGrid.d.ts.map