@sheetxl/sdk 0.8.0-beta.11 → 0.8.0-beta.12

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 (191) hide show
  1. package/browser/esm/{BpgskG1Er_lGQ_yS.mjs → -Jx-jNHmtIQQfLvK.mjs} +1 -1
  2. package/browser/esm/{BLoUBId2xZpXAK_H.mjs → 2WuhYrIpYmOR5H73.mjs} +15 -15
  3. package/browser/esm/{Ctjb0SsxV4K4MMqG.mjs → 2mIwPy2D2JUX-9wx.mjs} +2 -2
  4. package/browser/esm/{CkxWugaJFjDGZNZ-.mjs → B3wf5vZCsWfWsDbj.mjs} +1 -1
  5. package/browser/esm/{BjkCiv5Jz6WYKZeu.mjs → BIHrHjRGWVlJglcp.mjs} +2 -2
  6. package/browser/esm/{BtvLTTfSBdAKplVG.mjs → BTFBedJMRWGvZyCE.mjs} +1 -1
  7. package/browser/esm/{C4MqfLn9Dm-l3OIk.mjs → BdCJNawfifyPupCP.mjs} +1 -1
  8. package/browser/esm/{CV5EGEjG5_-CPpP0.mjs → Bg5Di9GLNAkbqQ1P.mjs} +3 -3
  9. package/browser/esm/{C2VbEI_XVAoseAwa.mjs → BnC4-27Igwb8oDf2.mjs} +2 -2
  10. package/browser/esm/{CQYjO777cmAznUzK.mjs → Bt8_m94tBdks209L.mjs} +1 -1
  11. package/browser/esm/{C16ycKja6zG0crV_.mjs → BudSIfXBAsTxvu-K.mjs} +17836 -15712
  12. package/browser/esm/{DvAaxH6z_tGvrRzl.mjs → C9u8FUewte5ugUjH.mjs} +686 -686
  13. package/browser/esm/{DEiPS3Dr-s4fPbVZ.mjs → CBYMTDzMf1Vh7pkw.mjs} +1 -1
  14. package/browser/esm/{Dyq_ivuHvlXLwPCl.mjs → CNdjyofiRu6CYOrr.mjs} +1106 -1102
  15. package/browser/esm/{PcHFjNzQsE54POri.mjs → CRkYR-siY2C994KV.mjs} +1 -1
  16. package/browser/esm/{C5E6zSGAALWf61n4.mjs → CTe2qfmIUEad6FJv.mjs} +2 -2
  17. package/browser/esm/{BoV6zPBnfqCBCqZ7.mjs → CUzYuYTTGsChC_kZ.mjs} +3841 -3148
  18. package/browser/esm/CdEO8CEee6lEhabA.mjs +117 -0
  19. package/browser/esm/{S2dNNx1a5ydRnARM.mjs → CfRqiPDg6RBTg1EN.mjs} +2 -2
  20. package/browser/esm/{ClbvFbFzFzXLBKNN.mjs → CndRBvVfQUJIYRRj.mjs} +50 -50
  21. package/browser/esm/{BnG31I6Oj_HEtSPS.mjs → CwOPLXU3-9ZHGyOT.mjs} +1 -1
  22. package/browser/esm/{CHU6iu_WGlm7fLET.mjs → Cxjxk0ncRKx80I-w.mjs} +1 -1
  23. package/browser/esm/D2RZh0O9neOsyLAE.mjs +281 -0
  24. package/browser/esm/{BkBhLS0l6z8sxI6D.mjs → D64dM68B1pKYFzdP.mjs} +2 -2
  25. package/browser/esm/{BVDiOXGMc5_FMGfy.mjs → D9xNz46kAfXMZzp4.mjs} +2 -2
  26. package/browser/esm/{zlLuW405RSguy4Kn.mjs → DK899HhWX1HINMC1.mjs} +53 -53
  27. package/browser/esm/{B7aUIvgUjncMMD_i.mjs → DPhGQLNGmDZwODwJ.mjs} +5 -4
  28. package/browser/esm/{gssVX_FH1XFN-twD.mjs → DVroRnhi-5IDXNgM.mjs} +1 -1
  29. package/{node/esm/CZICGK_ss0HoGHCP.mjs → browser/esm/DZiivy0NmO1Vnyzk.mjs} +2 -2
  30. package/browser/esm/{ClPfI4lODvCece29.mjs → DgrAuRD2qr2DvFeJ.mjs} +61 -61
  31. package/browser/esm/{CU3DmJ-YnVVrC1_k.mjs → DobHLF6VjHr7Xi40.mjs} +1 -1
  32. package/browser/esm/{CaB7J-xgfKO2uAkG.mjs → DwZCT7DZiiXoTweg.mjs} +2 -2
  33. package/browser/esm/{BMyDRQ716j79h_bH.mjs → DwwR3O2sEZApPSTF.mjs} +6 -6
  34. package/browser/esm/{DLLE0FZNsKxbBzRn.mjs → Tah7cnFb_HNZdLtj.mjs} +45 -45
  35. package/browser/esm/{Dlmig06rIo7cInRk.mjs → fXWUMDhZ5yMSO629.mjs} +1 -1
  36. package/browser/esm/{DWNzqw7DUKwoxjri.mjs → hCQJcmIzPDxDEv2q.mjs} +2 -2
  37. package/browser/esm/index.mjs +679 -542
  38. package/browser/esm/{BFagR2JeWs74iAG3.mjs → qO-ujUrgq6H3TQix.mjs} +1 -1
  39. package/browser/esm/w6Jea0TiclPrYZ2M.mjs +1703 -0
  40. package/browser/esm/yuhcOYw6SHQ-RCm3.mjs +114 -0
  41. package/node/esm/-TA0MneBDKdGhsib.mjs +8668 -0
  42. package/node/esm/{B21JjOLghRoDOrkx.mjs → B-HUPAcqvK0eeeCz.mjs} +1 -1
  43. package/node/esm/{DNRhGK-8Tr9xcRyc.mjs → BL2iiEoqxDEV2Xrg.mjs} +3 -3
  44. package/node/esm/{D1TKBVmoKGAXf37B.mjs → BNXLOEddJ6O9gYws.mjs} +2 -2
  45. package/node/esm/{BrCKGFRsX_ezFJ4B.mjs → BSvOluusoDM4z_dx.mjs} +15 -15
  46. package/node/esm/{BIwObuhTJYf0jpUa.mjs → BskP3b8vUoIOGLY6.mjs} +2 -2
  47. package/node/esm/{2Kihw_-5lVTEnwMa.mjs → Btw4148Ot8ifhNc1.mjs} +1 -1
  48. package/node/esm/{BqiexuA89caYnAPz.mjs → C14-R6tifRh7pc0p.mjs} +1 -1
  49. package/node/esm/{DUTskXCXref-IJnI.mjs → C99zzq8DImQXi4BQ.mjs} +47 -47
  50. package/node/esm/{D8zEN-6ZdDqDvTxM.mjs → CBuEu5Jk-LfaDy-H.mjs} +61 -61
  51. package/node/esm/{yavzZOiZW_EjG9lE.mjs → CG-qBU5BAaVz7e-P.mjs} +1 -1
  52. package/node/esm/CPI58duc0j0a-HpJ.mjs +115 -0
  53. package/node/esm/{CCN5vD410obwdz38.mjs → CRt3vXe6YmXzqk3H.mjs} +15 -14
  54. package/node/esm/{CzXT00vrQa1_gvW9.mjs → C_aL7CGS1lrNn1Ng.mjs} +1 -1
  55. package/node/esm/{CZiqiay42tFTrLI4.mjs → C_xf5Bz30VqiJjXn.mjs} +1 -1
  56. package/node/esm/{BIRq1kT7lLRzns9t.mjs → CiIymQN6aJCul62g.mjs} +9 -9
  57. package/node/esm/{CNCNJNg890KdgkWh.mjs → Ci_zLYmCD7e-C79O.mjs} +1 -1
  58. package/{browser/esm/D5np__Jb1euAyaLw.mjs → node/esm/CkRYLed8Mmn3giNg.mjs} +2 -2
  59. package/node/esm/D3ptRKzASqBut1DE.mjs +117 -0
  60. package/node/esm/{cGwrLA1RCE-WhJ7w.mjs → D4ROK9UwDpS6jO3Z.mjs} +1 -1
  61. package/node/esm/{mFiBSM7XgBHV9AY7.mjs → D8hO07ToAibIuniw.mjs} +1535 -1531
  62. package/node/esm/{CDHdgJXH2vS71WMc.mjs → DUTmDHbFbhLDT4F3.mjs} +1 -1
  63. package/node/esm/{CGp6VZL-gZa9Uezx.mjs → DV5CU37aEbFbWFL0.mjs} +1 -1
  64. package/node/esm/{De2IONBxQhz-Qbyh.mjs → DdoiuKg9BKubtF1V.mjs} +1 -1
  65. package/node/esm/{Db0v7zXNnyjBIjjI.mjs → DggQ23jKMpwhENfa.mjs} +2 -2
  66. package/node/esm/{CwePQwTILHHjGDkZ.mjs → DhS6yWjrrSNIJMsn.mjs} +204 -204
  67. package/node/esm/{D_t5AUxSm7_icjzq.mjs → DhTya_mhmN53vskv.mjs} +1 -1
  68. package/node/esm/{DOU54VsOjG-m-NyQ.mjs → Dn1M7YWi25DeeYUb.mjs} +1 -1
  69. package/node/esm/{DkwIPzKc3UwdUIfM.mjs → DrCf6ITcBhVOFpRj.mjs} +6 -6
  70. package/node/esm/{D2KBymQJd1XhpeQD.mjs → DxazKtROyaI51dWl.mjs} +1 -1
  71. package/node/esm/{D6e2z7eZpxOJXHc7.mjs → Q_S1g46ZOTrdhTae.mjs} +1 -1
  72. package/node/esm/{OVfaSb506tNSIvbv.mjs → Vocy-I9dKzZMr0Ct.mjs} +19038 -16822
  73. package/node/esm/ZXPFcsT2zrALCZux.mjs +289 -0
  74. package/node/esm/{857CIBgQgGpnqrXk.mjs → eimUGjiIP-b8HiM6.mjs} +55 -55
  75. package/node/esm/{Bbf1Pm9Gk7YpLTvg.mjs → icn2nX5Z8e_3mNAv.mjs} +1 -1
  76. package/node/esm/index.mjs +740 -603
  77. package/node/esm/{Ct3h15sCus4Tgt6M.mjs → lGJ42sHqg5if2bba.mjs} +624 -616
  78. package/node/esm/{CdJHUJSBRHZoryPe.mjs → pYtP7wPyS96NQyXS.mjs} +59 -59
  79. package/package.json +6 -6
  80. package/resources/locales/de/model.msg.json +8 -2
  81. package/resources/locales/en/model.msg.json +9 -2
  82. package/types/scripting-api.json +10619 -10446
  83. package/types/scripting-enums.json +20 -1
  84. package/types/scripting.d.ts +1233 -296
  85. package/types/src/{sheet → anomalies}/_Anomalies.d.ts +3 -3
  86. package/types/src/anomalies/_FocusTable.d.ts +11 -0
  87. package/types/src/{sheet/_AnomalyFormulaChecks.d.ts → anomalies/_FormulaChecks.d.ts} +10 -2
  88. package/types/src/{sheet/_AnomalyLabelChecks.d.ts → anomalies/_LabelChecks.d.ts} +1 -1
  89. package/types/src/anomalies/_LiteralChecks.d.ts +35 -0
  90. package/types/src/anomalies/_SeriesChecks.d.ts +13 -0
  91. package/types/src/calculation/Calculation.d.ts +47 -9
  92. package/types/src/calculation/ExternalBookBindings.d.ts +2 -3
  93. package/types/src/calculation/ICalculation.d.ts +96 -9
  94. package/types/src/calculation/NamedFormulaCollection.d.ts +104 -8
  95. package/types/src/calculation/_CloneBoundary.d.ts +1 -1
  96. package/types/src/calculation/compiler/ASTTypes.d.ts +6 -2
  97. package/types/src/calculation/compiler/Types.d.ts +8 -0
  98. package/types/src/calculation/engine/CalcBackend.d.ts +104 -6
  99. package/types/src/calculation/executor/CalcExecutor.d.ts +73 -22
  100. package/types/src/calculation/executor/CalcExecutorUtils.d.ts +17 -1
  101. package/types/src/calculation/executor/_WhatIf.d.ts +50 -0
  102. package/types/src/calculation/formula/FormulaBlock.d.ts +4 -3
  103. package/types/src/calculation/formula/IFormulaBlock.d.ts +5 -0
  104. package/types/src/calculation/functions/_DataTableFunction.d.ts +14 -0
  105. package/types/src/calculation/grid/CalcGrid.d.ts +4 -6
  106. package/types/src/calculation/grid/CalcGridBackend.d.ts +5 -27
  107. package/types/src/calculation/grid/CalcGridProxy.d.ts +0 -2
  108. package/types/src/calculation/grid/CalcGridUtils.d.ts +4 -2
  109. package/types/src/calculation/grid/ICalcGrid.d.ts +16 -12
  110. package/types/src/calculation/grid/_CalcRequest.d.ts +17 -5
  111. package/types/src/calculation/spatial/FormulaSpatialValue.d.ts +2 -0
  112. package/types/src/calculation/spatial/SpillEntry.d.ts +16 -2
  113. package/types/src/calculation/state/CalcNode.d.ts +0 -1
  114. package/types/src/calculation/state/CalcScope.d.ts +29 -0
  115. package/types/src/calculation/state/CalcState.d.ts +26 -4
  116. package/types/src/calculation/state/CalculationContext.d.ts +28 -1
  117. package/types/src/calculation/state/DeferredCalls.d.ts +260 -0
  118. package/types/src/calculation/state/IContextContainer.d.ts +20 -0
  119. package/types/src/calculation/state/_PendingOverlayGrid.d.ts +6 -0
  120. package/types/src/calculation/state/_WhatIfLayer.d.ts +91 -0
  121. package/types/src/cell/ICell.d.ts +53 -34
  122. package/types/src/cellControl/CellControl.d.ts +67 -0
  123. package/types/src/cellControl/CellControlCollection.d.ts +29 -0
  124. package/types/src/cellControl/CellControlRegistry.d.ts +47 -0
  125. package/types/src/cellControl/ICellControl.d.ts +99 -0
  126. package/types/src/cellControl/ICellControlCollection.d.ts +67 -0
  127. package/types/src/cellControl/index.d.ts +4 -0
  128. package/types/src/cellRange/ICellRange.d.ts +207 -59
  129. package/types/src/cellRange/ICellRanges.d.ts +4 -3
  130. package/types/src/chart/layout/ChartLayout.d.ts +5 -1
  131. package/types/src/chart/resolve/_Resolve.d.ts +10 -0
  132. package/types/src/chart/resolve/_ResolvedChart.d.ts +5 -2
  133. package/types/src/collections/ISparseGrid.d.ts +11 -2
  134. package/types/src/collections/MixedTypedArrayList.d.ts +8 -2
  135. package/types/src/collections/SparseGrid.d.ts +3 -8
  136. package/types/src/condition/AnchoredConditional.d.ts +2 -2
  137. package/types/src/externalBook/IExternalBook.d.ts +3 -4
  138. package/types/src/fetch/Fetcher.d.ts +15 -0
  139. package/types/src/fetch/IFetcher.d.ts +47 -0
  140. package/types/src/fetch/_WorkbookFetch.d.ts +43 -0
  141. package/types/src/fetch/index.d.ts +3 -0
  142. package/types/src/fill/PaintUtils.d.ts +3 -1
  143. package/types/src/hyperlink/IHyperlink.d.ts +10 -0
  144. package/types/src/hyperlink/_Hyperlink.d.ts +4 -1
  145. package/types/src/index.d.ts +2 -1
  146. package/types/src/named/INamedCollection.d.ts +36 -0
  147. package/types/src/named/NamedCollection.d.ts +18 -0
  148. package/types/src/primitives/AsyncValue.d.ts +58 -0
  149. package/types/src/resource/IResource.d.ts +9 -0
  150. package/types/src/resource/IResourceCollection.d.ts +4 -0
  151. package/types/src/resource/Resource.d.ts +2 -0
  152. package/types/src/resource/_AddResource.d.ts +13 -0
  153. package/types/src/richData/CellImage.d.ts +95 -0
  154. package/types/src/richData/Hyperlink.d.ts +49 -0
  155. package/types/src/richData/IRichDataCollection.d.ts +76 -0
  156. package/types/src/richData/IRichDataKind.d.ts +55 -11
  157. package/types/src/richData/RichArray.d.ts +42 -0
  158. package/types/src/richData/RichDataCollection.d.ts +23 -0
  159. package/types/src/richData/RichDataRegistry.d.ts +46 -14
  160. package/types/src/richData/RichDataValues.d.ts +20 -0
  161. package/types/src/richData/RichRecord.d.ts +68 -0
  162. package/types/src/richData/RichText.d.ts +5 -5
  163. package/types/src/richData/index.d.ts +6 -0
  164. package/types/src/scripting/FunctionArguments.d.ts +17 -1
  165. package/types/src/scripting/FunctionCollection.d.ts +8 -0
  166. package/types/src/scripting/Scripts.d.ts +10 -0
  167. package/types/src/scripting/TypedFunction.d.ts +2 -0
  168. package/types/src/sheet/ICellContainerOptions.d.ts +6 -0
  169. package/types/src/sheet/IWorksheet.d.ts +24 -17
  170. package/types/src/sheet/SheetCell.d.ts +17 -1
  171. package/types/src/sheet/SheetRange.d.ts +8 -2
  172. package/types/src/sheet/SheetRanges.d.ts +2 -2
  173. package/types/src/sheet/Worksheet.d.ts +110 -56
  174. package/types/src/sheet/_ListenerAnchor.d.ts +7 -1
  175. package/types/src/sheet/_ScalarListFactory.d.ts +54 -6
  176. package/types/src/sheet/_SheetMutations.d.ts +4 -1
  177. package/types/src/sheet/_SheetStateTypes.d.ts +23 -11
  178. package/types/src/workbook/IWorkbook.d.ts +40 -1
  179. package/types/src/workbook/Workbook.d.ts +25 -3
  180. package/types/src/workbook/WorkbookRanges.d.ts +1 -1
  181. package/browser/esm/BGOFfpxr2jPIdqmV.mjs +0 -40
  182. package/browser/esm/f1IoRb7tEb0QmCSt.mjs +0 -110
  183. package/browser/esm/nvU0ClAbf0g94YBK.mjs +0 -1695
  184. package/node/esm/B084DssTcdBheTp_.mjs +0 -7966
  185. package/node/esm/Df1bL6VFvrqIdSLB.mjs +0 -40
  186. package/node/esm/DrTZbfemSLq2mseG.mjs +0 -111
  187. package/types/src/dataTable/DataTable.d.ts +0 -67
  188. package/types/src/dataTable/DataTableCollection.d.ts +0 -19
  189. package/types/src/dataTable/IDataTable.d.ts +0 -99
  190. package/types/src/dataTable/IDataTableCollection.d.ts +0 -18
  191. package/types/src/dataTable/index.d.ts +0 -6
@@ -862,6 +862,26 @@ declare global {
862
862
  params?: Record<string, string | number>;
863
863
  }
864
864
 
865
+ /**
866
+ * The control types a cell control can have, by type.
867
+ *
868
+ * @remarks
869
+ * The built-in types are registered before the registry is first used; a host registers its own
870
+ * the same way. A type nobody has registered still loads and saves, and accepts no value, so its
871
+ * cells draw as text.
872
+ */
873
+ export namespace CellControlRegistry {
874
+ /**
875
+ * Registers a kind. A kind registered again under the same type replaces the earlier one,
876
+ * a built-in included.
877
+ */
878
+ function register(kind: ICellControlKind): void;
879
+ /** The kind registered for `type`, or `null`. */
880
+ function get(type: string): ICellControlKind | null;
881
+ /** The registered types. */
882
+ function getTypes(): string[];
883
+ }
884
+
865
885
  /**
866
886
  * The coordinates of a cell in a 2D space.
867
887
  */
@@ -1157,7 +1177,11 @@ declare global {
1157
1177
  width: number;
1158
1178
  height: number;
1159
1179
  chartArea: {
1160
- fill: IFill.JSON | null;
1180
+ /**
1181
+ * `undefined` where the chart states no fill: the chart area is the background of where it is
1182
+ * drawn (Excel draws it in the theme's background color).
1183
+ */
1184
+ fill: IFill.JSON | null | undefined;
1161
1185
  border: IStroke.JSON | null;
1162
1186
  /** The radius of the chart area's corners, measured along the border's path; 0 for square corners. */
1163
1187
  cornerRadius: number;
@@ -2634,6 +2658,11 @@ declare global {
2634
2658
  }
2635
2659
  }
2636
2660
 
2661
+ /**
2662
+ * Excel's checkbox: draws a boolean or a blank cell, in place of its text.
2663
+ */
2664
+ export const CheckboxKind: ICellControlKind;
2665
+
2637
2666
  export const ClipboardUtils: {
2638
2667
  readBlobFromClipboard: (clipboard: Clipboard | null, mimeType: string) => Promise<Blob | null>;
2639
2668
  readStringFromClipboard: (clipboard: Clipboard | null, mimeType?: string) => Promise<string>;
@@ -4992,7 +5021,9 @@ declare global {
4992
5021
  * @returns A promise that will be resolved when the calculation is completed.
4993
5022
  *
4994
5023
  * @remarks
4995
- * For async functions this will return before they are completed.
5024
+ * For async functions this will return before they are completed. An async function is called
5025
+ * again unless its call is still running; what it fetches is answered
5026
+ * from the workbook's cache unless {@link ICalculation.CalculateOptions.external} is set.
4996
5027
  */
4997
5028
  calculate(options?: boolean | ICalculation.CalculateOptions): Promise<ICalculation.Status>;
4998
5029
  /**
@@ -5011,7 +5042,7 @@ declare global {
5011
5042
  /**
5012
5043
  * Resolves once the engine is running and idle: its calculation state is
5013
5044
  * {@link ICalculation.CalculationState.Done}, or {@link ICalculation.CalculationState.Pending} in
5014
- * manual mode.
5045
+ * manual mode (and, under `AutomaticExceptTables`, with only data tables out of date).
5015
5046
  *
5016
5047
  * @remarks
5017
5048
  * * After it, every answer the engine owes has landed: a formula written before it reads as
@@ -5019,14 +5050,46 @@ declare global {
5019
5050
  * * Manual mode does not wait for a recalculation nobody has asked for; call {@link calculate}.
5020
5051
  * * Waits for what consumers derive from the results too ({@link waitUntil}): a conditional
5021
5052
  * format reads as painted after it, including one a read just asked to evaluate.
5022
- * * A streaming or async function's result in flight is not waited for: its cell reads as the
5023
- * current value until the result arrives.
5053
+ * * An async function's result in flight is not waited for: its cell reads as what the
5054
+ * function returned until the result arrives.
5024
5055
  * * Starts the engine if it is {@link ICalculation.Status.Off}. An engine in
5025
5056
  * {@link ICalculation.Status.Error} is not started; {@link start} tries again.
5026
5057
  *
5027
5058
  * @param options Pass `{ full: true }` to recalculate every grid rather than only the dirty ones.
5028
5059
  */
5029
5060
  ready(options?: ICalculation.CalculateOptions): Promise<ICalculation.Status>;
5061
+ /**
5062
+ * How many async function calls are waiting for an answer.
5063
+ */
5064
+ getPendingCount(): number;
5065
+ /**
5066
+ * Resolves once no async function call is pending ({@link getPendingCount} is `0`) and every
5067
+ * answer has been calculated into the workbook — Excel's `CalculateUntilAsyncQueriesDone`.
5068
+ *
5069
+ * @param options `timeout` in milliseconds; 30 seconds when absent.
5070
+ * @returns `true` when nothing is pending; `false` when the timeout came first.
5071
+ *
5072
+ * @remarks
5073
+ * * An answer that makes a formula ask a new question (one call's answer is another's input)
5074
+ * is waited for too.
5075
+ * * {@link ready} is the engine's own readiness and does not wait for answers.
5076
+ */
5077
+ whenPendingDone(options?: {
5078
+ timeout?: number;
5079
+ }): Promise<boolean>;
5080
+ /**
5081
+ * Stops waiting for async function calls — Excel's *Cancel Refresh*: each pending
5082
+ * call the options cover is closed, and the function is told (its `onCancel`).
5083
+ *
5084
+ * @param options Which calls; every call when absent.
5085
+ * @returns A promise that resolves once the cells have been recalculated.
5086
+ *
5087
+ * @remarks
5088
+ * * A cell keeps what it showed — its last answer, or the value its function returned while it
5089
+ * waited — and is no longer pending. An answer that arrives later is dropped.
5090
+ * * A recalculation of a cancelled cell calls its function again.
5091
+ */
5092
+ cancelAsync(options?: ICalculation.CancelOptions): Promise<ICalculation.Status>;
5030
5093
  /**
5031
5094
  * Counts `work` that a consumer derives from the engine's results as calculation in flight
5032
5095
  * until it settles: {@link ready} waits for it, and {@link getCalculationState} reads
@@ -6016,6 +6079,14 @@ declare global {
6016
6079
  * Use {@link ICalculation.FormulaToken.evalIndex} to discover valid indices.
6017
6080
  */
6018
6081
  evalIndex?: number;
6082
+ /**
6083
+ * How long to wait, in milliseconds, for the answers of async functions the formula calls:
6084
+ * the evaluation resolves once each has answered, and
6085
+ * answers a `#TIMEOUT!` error naming the call it waited on when the time runs out.
6086
+ *
6087
+ * @defaultValue `30000`
6088
+ */
6089
+ timeout?: number;
6019
6090
  /**
6020
6091
  * Temporary range of values to use for this evaluation.
6021
6092
  *
@@ -6148,6 +6219,15 @@ declare global {
6148
6219
  * Called when the calculation state has changed - see {@link ICalculation.getCalculationState}.
6149
6220
  */
6150
6221
  onCalculationStateChange?(source: ICalculation): void;
6222
+ /**
6223
+ * Called when the number of async function calls waiting for an answer may have changed — see
6224
+ * {@link ICalculation.getPendingCount}.
6225
+ *
6226
+ * @remarks
6227
+ * Called when calls are made, when answers are applied, and on a cancel or a stop: answers
6228
+ * arriving together are one call.
6229
+ */
6230
+ onPendingChange?(source: ICalculation): void;
6151
6231
  /**
6152
6232
  * Called when a calculation is completed.
6153
6233
  */
@@ -6216,7 +6296,8 @@ declare global {
6216
6296
  readonly Calculating: "calculating";
6217
6297
  /**
6218
6298
  * Changes have been made that need a recalculation, and none will run until one is asked for:
6219
- * manual mode between an edit and {@link ICalculation.calculate}.
6299
+ * manual mode between an edit and {@link ICalculation.calculate}, or the `TABLE` data tables an
6300
+ * edit left out of date under `AutomaticExceptTables`.
6220
6301
  */
6221
6302
  readonly Pending: "pending";
6222
6303
  };
@@ -6287,14 +6368,16 @@ declare global {
6287
6368
  */
6288
6369
  readonly Stale: "stale";
6289
6370
  /**
6290
- * The value is being calculated asynchronously, typically because the function used returned a Promise.
6291
- * All dependent values will also be in the Pending state. If the promise returns an error or times out, the value will be an error value.
6371
+ * The cell's own function asked for its result later (`FormulaContext.defer`) and it has not
6372
+ * arrived: the cell shows what the function returned meanwhile, and its dependents calculate
6373
+ * from that and read as {@link Waiting}. A failed call answers an error value.
6292
6374
  */
6293
6375
  readonly Pending: "pending";
6294
6376
  /**
6295
- * The value is up-to-date, but the underlying data source is streaming live updates.
6377
+ * The value was calculated from a pending value — a precedent whose function has not answered —
6378
+ * and will be calculated again when it does.
6296
6379
  */
6297
- readonly Streaming: "streaming";
6380
+ readonly Waiting: "waiting";
6298
6381
  };
6299
6382
  type ResultStatus = typeof ResultStatus[keyof typeof ResultStatus];
6300
6383
  /**
@@ -6332,6 +6415,39 @@ declare global {
6332
6415
  * live in other sheets, and a named formula's body lives in a virtual grid of its own.
6333
6416
  */
6334
6417
  scope?: string;
6418
+ /**
6419
+ * If `true`, what the calculation reads from outside the workbook is read from the source
6420
+ * again rather than from the workbook's cache — Excel's *Data › Refresh All*: what the async
6421
+ * functions it calls fetch, and, for a calculation that is neither {@link range} nor
6422
+ * {@link scope}, every external book (`IExternalBookCollection.refreshAll`).
6423
+ *
6424
+ * @remarks
6425
+ * * Which functions are called is the calculation's own choice, as without it: pass
6426
+ * {@link full} for every formula. A call still running is left be.
6427
+ * * The calculation resolves without waiting for the new answers or the external books.
6428
+ *
6429
+ * @example Refresh All
6430
+ * ```ts
6431
+ * await workbook.getCalculation().calculate({ full: true, external: true });
6432
+ * ```
6433
+ *
6434
+ * @defaultValue `false`
6435
+ */
6436
+ external?: boolean;
6437
+ }
6438
+ /**
6439
+ * Options for {@link ICalculation.cancelAsync}.
6440
+ */
6441
+ interface CancelOptions {
6442
+ /**
6443
+ * Only the calls of the formulas in this range are cancelled.
6444
+ */
6445
+ range?: ICellRange.Address;
6446
+ /**
6447
+ * Only the calls of the formulas on this sheet, by name, are cancelled. Ignored when
6448
+ * {@link range} is set.
6449
+ */
6450
+ scope?: string;
6335
6451
  }
6336
6452
  interface JSON {
6337
6453
  /**
@@ -6611,10 +6727,16 @@ declare global {
6611
6727
  */
6612
6728
  getRole(): ICell.Role | null;
6613
6729
  /**
6614
- * Returns the hyperlink assigned to the cell.
6730
+ * Returns the cell's link: the hyperlink set on the cell, else the link its value is.
6615
6731
  *
6616
6732
  * @remarks
6617
- * Returns `null` if no hyperlink is set.
6733
+ * Returns `null` when the cell has neither.
6734
+ *
6735
+ * A `HYPERLINK()` result (a {@link Hyperlink} value with an address) is returned as a link with
6736
+ * {@link IHyperlink.isReadOnly} `true`; it is not removed or edited as a link, it changes with
6737
+ * its formula. A hyperlink set on the cell wins when the cell has both. Excel's
6738
+ * `Range.Hyperlinks` and Office Scripts' `Range.getHyperlink()` return nothing for a
6739
+ * `HYPERLINK()` cell.
6618
6740
  */
6619
6741
  getHyperlink(): IHyperlink | null;
6620
6742
  /**
@@ -6831,6 +6953,14 @@ declare global {
6831
6953
  * only lays out text does not need to read this at all.
6832
6954
  */
6833
6955
  getConditionalDecorations(): Readonly<IConditionalFormat.Decorations>;
6956
+ /**
6957
+ * Returns the cell's control, such as a checkbox, or `null` when it has none.
6958
+ *
6959
+ * @remarks
6960
+ * A control draws only a value it accepts: ask `getControl()?.isAccepted(getValue())`. A
6961
+ * checkbox cell holding `2` has a control and draws `2`.
6962
+ */
6963
+ getControl(): ICellControl | null;
6834
6964
  /**
6835
6965
  * If the cell is in a table this will return it.
6836
6966
  */
@@ -7186,40 +7316,10 @@ declare global {
7186
7316
  */
7187
7317
  anchorBounds: Bounds;
7188
7318
  }
7189
- /**
7190
- * Encodings of ScalarType for persistence
7191
- */
7192
- type JSONScalarType = 'n' | 's' | 'b' | 'e' | 'r' | 'z';
7193
- /**
7194
- * A value encoded as a number with an associated type.
7195
- */
7196
- interface JSONTypedValue {
7197
- t: JSONScalarType;
7198
- /**
7199
- * The number, string id, error code or boolean flag; for `'r'`, the rich data's own JSON
7200
- * (`IRichData.JSON`), which its registered kind reads back.
7201
- */
7202
- v: number | IRichData.JSON;
7203
- }
7204
7319
  /**
7205
7320
  * Reexports the `IRange.CellCoords` type for use in cell coordinates.
7206
7321
  */
7207
7322
  type Coords = IRange.CellCoords;
7208
- /**
7209
- * JSON values types that have their type embedded in the
7210
- * 'format'.
7211
- *
7212
- * @remarks
7213
- * A string value is the string id in the `IStringsCollection`.
7214
- */
7215
- type JSONUnTypedValue = number | boolean | string;
7216
- /**
7217
- * For persisting a single Cell value and type.
7218
- *
7219
- * @remarks
7220
- * Styling and other advanced properties are stored as ranges.
7221
- */
7222
- type JSON = JSONUnTypedValue | JSONTypedValue;
7223
7323
  /**
7224
7324
  * Represents the types of content that can be associated with a cell or range.
7225
7325
  *
@@ -7373,12 +7473,22 @@ declare global {
7373
7473
  readonly LookupShape: "lookupShape";
7374
7474
  /** A reference to another workbook, a deleted reference, or a function a converter could not name. */
7375
7475
  readonly ExternalReference: "externalReference";
7476
+ /** A formula that is only an error value, such as `=#DIV/0!`: what a converter leaves when it drops a formula. */
7477
+ readonly ErrorConstant: "errorConstant";
7376
7478
  /** A link to another sheet whose target row is labeled other than its own row. */
7377
7479
  readonly LinkLabelMismatch: "linkLabelMismatch";
7378
7480
  /** A lookup keyed by a typed string that labels neither the formula's row nor its column. */
7379
7481
  readonly KeyLabelMismatch: "keyLabelMismatch";
7380
7482
  /** A link read with the other sign from the sheet's other links into the same row. */
7381
7483
  readonly SignVsSiblings: "signVsSiblings";
7484
+ /** A number typed into a formula that equals a typed number on the sheet no formula reads. */
7485
+ readonly LiteralMatchesInput: "literalMatchesInput";
7486
+ /** A formula that differs from its twins on the sheet, the formulas of the same shape, in a typed number. */
7487
+ readonly TwinBlockDivergence: "twinBlockDivergence";
7488
+ /** A typed number an order of magnitude or more off the numbers typed in its format on the sheet. */
7489
+ readonly ScaleOutlier: "scaleOutlier";
7490
+ /** A constant typed into a formula — a number, a string or a boolean — and how often the workbook types it. */
7491
+ readonly ConstantFrequency: "constantFrequency";
7382
7492
  };
7383
7493
  type ErrorCheck = typeof ErrorCheck[keyof typeof ErrorCheck];
7384
7494
  /**
@@ -7409,9 +7519,14 @@ declare global {
7409
7519
  * | `approximateMatch` | `function`; `matchType`, `'1'`, `'-1'`, `'TRUE'` or `'omitted'` |
7410
7520
  * | `lookupShape` | `array`, the range the result is read from; `vector`, the range the key is found in |
7411
7521
  * | `externalReference` | `kind` (`'workbook'`, `'deleted'`, `'udf'`); `reference`, or `function` for a `'udf'` |
7522
+ * | `errorConstant` | `error`, the error the formula is; `dataTable`, the anchor of a data table that spills less than the block it heads, and `extent`, the rectangle the two cover |
7412
7523
  * | `linkLabelMismatch` | `label` / `labelAt`, the cell's row label; `target` / `targetAt`, the label of the row it links to |
7413
7524
  * | `keyLabelMismatch` | `function`; `key`; `rowLabel` / `rowLabelAt` and `columnLabel` / `columnLabelAt`, where found |
7414
7525
  * | `signVsSiblings` | `reference`; `sign` (`'negative'` / `'positive'`); `siblings`, how many links into that row read the other sign; `siblingAt`, one of them |
7526
+ * | `literalMatchesInput` | `literal`, the number as the formula types it; `inputAt`, the nearest typed number of that value no formula reads; `label` / `labelAt`, that input's label, when it has one; `matches`, the places the value is typed unread |
7527
+ * | `twinBlockDivergence` | `part` (`'literal'` / `'sign'`); for a literal, `literal` and `expected`, this formula's number and its twins'; for a sign, `term` of `terms`, the term that differs, `references`, how many the shape holds, and `sign`, how this formula adds it; `twins`, how many formulas carry the other side; `twinAt`, one of them |
7528
+ * | `scaleOutlier` | `format` (`'percent'`); `times`, the power of ten the value is off by; `typical`, the median of the sheet's typed numbers in that format; `of`, how many there are |
7529
+ * | `constantFrequency` | `kind` (`'number'`, `'string'`, `'boolean'`); `value`, a number without its sign; `uses`, the places in the workbook that type it; `of`, the workbook's constant uses |
7415
7530
  *
7416
7531
  * **Runs.** `formula`, `hardcodeInRun` and `styleBreak` are one rule over different layers of
7417
7532
  * the sheet: a region thin against the run it sits in. The cells on both sides agree with each
@@ -7466,6 +7581,25 @@ declare global {
7466
7581
  * v2 Debugging goldens and move as other measurements arrive. Regions of the `anomalies` feature
7467
7582
  * list highest rank first, and so do a cell's findings, in check order within an equal rank.
7468
7583
  *
7584
+ * **Literals and twins.** `literalMatchesInput` reads the numbers typed into a formula against
7585
+ * the typed numbers no formula reads: a reference replaced by its value is what left the input
7586
+ * unread. Small counts, calendar periods and powers of ten never fire. `twinBlockDivergence`
7587
+ * reads formulas of the same shape once references, literals and signs are set aside: twins that
7588
+ * divide by `12` and by `365`, or one that adds a term the others take away. Literals compare only
7589
+ * when both are a calendar period, a power of ten or a small count. Every side of a divergence is
7590
+ * listed, since two wrong rows can outvote the right one.
7591
+ *
7592
+ * `literalMatchesInput` ranks at `0.8 / matches`. A `twinBlockDivergence` finding ranks at `0.8`
7593
+ * times the share of the twins on the other side, `twins / (twins + this side's count)`, halved
7594
+ * for a sign: signs differ between line items by design, so a sign divergence is read when asked
7595
+ * for by check. `scaleOutlier` ranks at `0.8`.
7596
+ *
7597
+ * `constantFrequency` reports every constant a formula types, the common ones too, with how many
7598
+ * places in the workbook type it (`uses`) and of how many constant uses (`of`). It ranks at
7599
+ * `0.1 / uses × of / (of + 10)`: the rarer the constant, the higher, and a constant on a workbook
7600
+ * that types few has little to be rare against. A finding's `uses` and `of` change when another
7601
+ * sheet changes.
7602
+ *
7469
7603
  * A label's position is absolute (`R12C3`), since it stays put whichever cell of a region reads
7470
7604
  * it; its text is the one read at the region's first cell.
7471
7605
  */
@@ -7503,6 +7637,11 @@ declare global {
7503
7637
  * Option to provide shared strings.
7504
7638
  */
7505
7639
  strings?: IStringCollection;
7640
+ /**
7641
+ * Option to provide shared rich values, the store cells hold rich data in by id, as they hold
7642
+ * strings in {@link strings}.
7643
+ */
7644
+ richData?: IRichDataCollection;
7506
7645
  /**
7507
7646
  * Option to provide a shared StyleCollection. If not provided then a new StyleCollection with default theming will be used.
7508
7647
  */
@@ -7616,6 +7755,189 @@ declare global {
7616
7755
  type CalcOnLoad = 'auto' | 'full' | 'none';
7617
7756
  }
7618
7757
 
7758
+ /**
7759
+ * A control drawn in the cells of a range, such as a checkbox.
7760
+ *
7761
+ * @remarks
7762
+ * A cell control decorates the cell's value; it never holds one. A checkbox draws `TRUE` as
7763
+ * checked and `FALSE` or blank as unchecked, and a click writes the boolean into the cell, where
7764
+ * formulas read it as any other value. Excel's model is the same: the checkbox is a cell
7765
+ * *format*, and *Clear Formats* removes it while the value stays.
7766
+ *
7767
+ * * A cell has at most one control. One control covers any number of cells, and its ranges
7768
+ * shift, split, copy and fill with them.
7769
+ * * A control draws only the values its type accepts ({@link isAccepted}). Any other value draws
7770
+ * as plain text: a checkbox over `2` or `"true"` draws `2` or `true`, as in Excel.
7771
+ * * Most code never needs this interface: {@link ICellRange.setControl} and
7772
+ * {@link ICellRange.getControls} stand in for Office Scripts' `Range.setControl` /
7773
+ * `getControl`.
7774
+ */
7775
+ export interface ICellControl extends IAnchored {
7776
+ /**
7777
+ * The control's type, such as `'checkbox'`.
7778
+ *
7779
+ * @remarks
7780
+ * A type nobody has registered (`CellControlRegistry`) is kept and saved as it was read; it
7781
+ * accepts no value, so its cells draw as text.
7782
+ */
7783
+ getType(): string;
7784
+ /**
7785
+ * Returns the first range the control covers.
7786
+ *
7787
+ * @remarks
7788
+ * See {@link IAnchored.getRanges} for all of them. To change where a control is, use
7789
+ * {@link ICellRange.setControl}.
7790
+ */
7791
+ getRange(): ICellRange;
7792
+ /**
7793
+ * Whether the control draws a cell holding `value`.
7794
+ *
7795
+ * @remarks
7796
+ * A checkbox accepts a boolean or a blank cell. A value it does not accept draws as the cell
7797
+ * would without the control.
7798
+ */
7799
+ isAccepted(value: Scalar): boolean;
7800
+ /**
7801
+ * Add Listeners.
7802
+ *
7803
+ * @see
7804
+ * {@link IListener.ISource.addListeners}
7805
+ */
7806
+ addListeners(listeners: ICellControl.IListeners, options?: IListener.Options): IListener.Remove;
7807
+ /**
7808
+ * The control as JSON: its `type` and any properties of that type.
7809
+ */
7810
+ toJSON(): ICellControl.JSON;
7811
+ /**
7812
+ * For runtime type checking.
7813
+ */
7814
+ readonly isICellControl: true;
7815
+ }
7816
+
7817
+ /**
7818
+ * {@inheritDoc ICellControl}
7819
+ * @see
7820
+ * ### **Interface**
7821
+ *
7822
+ * {@link ICellControl}
7823
+ *
7824
+ * **Additional Interfaces**
7825
+ * * {@link ICellControlCollection}
7826
+ */
7827
+ export namespace ICellControl {
7828
+ /**
7829
+ * A control as JSON: its `type`, and any properties that type defines.
7830
+ *
7831
+ * @remarks
7832
+ * Office Scripts' `CellControl`: `{ type: 'checkbox' }`. A checkbox has no other properties.
7833
+ * Office Scripts' `EmptyCellControl` is `null` here.
7834
+ */
7835
+ interface JSON {
7836
+ /**
7837
+ * The control's type, such as `'checkbox'`.
7838
+ */
7839
+ type: string;
7840
+ /**
7841
+ * Properties of the type.
7842
+ */
7843
+ [property: string]: unknown;
7844
+ }
7845
+ /**
7846
+ * IListener for {@link ICellControl} events.
7847
+ */
7848
+ interface Events extends IAnchored.Events<ICellControl> {
7849
+ }
7850
+ interface IListeners extends IListener.Callbacks<ICellControl, ICellControl.Events> {
7851
+ }
7852
+ }
7853
+
7854
+ /**
7855
+ * Holds a sheet's {@link ICellControl}s.
7856
+ *
7857
+ * @remarks
7858
+ * Most code reaches controls through the range instead: {@link ICellRange.setControl} puts a
7859
+ * control on cells and {@link ICellRange.getControls} reads it back. The collection is for listing
7860
+ * every control, as a task pane does.
7861
+ */
7862
+ export interface ICellControlCollection extends ICollection<ICellControl> {
7863
+ /**
7864
+ * Puts a control on the cells of `address`, replacing their controls, and returns it.
7865
+ *
7866
+ * @param address The address of the cells. May name several discontiguous ranges.
7867
+ * @param control The control, such as `{ type: 'checkbox' }`.
7868
+ *
7869
+ * @remarks
7870
+ * The same write as {@link ICellRange.setControl}, over any address. A cell has at most one
7871
+ * control, so the cells leave whatever control they had, and join a control of the same
7872
+ * definition when the sheet already has one.
7873
+ */
7874
+ add(address: ICellRanges.Address, control: ICellControl.JSON, options?: ITransaction.OperationOptions): ICellControl;
7875
+ /**
7876
+ * Returns items that match the filter criteria.
7877
+ *
7878
+ * If no filter criteria is provided, all items will be returned.
7879
+ *
7880
+ * @param options {@link ICellControlCollection.GetItemsOptions}
7881
+ */
7882
+ getItems(options?: ICellControlCollection.GetItemsOptions): ICellControl[];
7883
+ /** For runtime type checking. */
7884
+ readonly isICellControlCollection: true;
7885
+ }
7886
+
7887
+ /**
7888
+ * {@inheritDoc ICellControlCollection}
7889
+ * @see
7890
+ * ### **Interface**
7891
+ *
7892
+ * {@link ICellControlCollection}
7893
+ */
7894
+ export namespace ICellControlCollection {
7895
+ /**
7896
+ * Options for searching for {@link ICellControl}s.
7897
+ */
7898
+ interface GetItemsOptions extends ICollection.GetItemsOptions {
7899
+ /**
7900
+ * If provided, the search will be limited to items that intersect the range.
7901
+ */
7902
+ address?: ICellRange.Address;
7903
+ /**
7904
+ * Indicate if items that are in hidden headers or marked as hidden should be returned.
7905
+ *
7906
+ * @defaultValue false
7907
+ */
7908
+ ignoreHidden?: boolean;
7909
+ /**
7910
+ * Only return items that are completely contained with the search bounds.
7911
+ *
7912
+ * @defaultValue false
7913
+ */
7914
+ fullyContained?: boolean;
7915
+ }
7916
+ }
7917
+
7918
+ /**
7919
+ * What a control type does to the cells it covers: which values it draws.
7920
+ *
7921
+ * @remarks
7922
+ * The SDK half of a control type. How it looks and how it responds to the pointer and keys belong
7923
+ * to the UI, which registers its own renderer under the same `type`.
7924
+ */
7925
+ export interface ICellControlKind {
7926
+ /**
7927
+ * The type this kind is registered under, such as `'checkbox'`.
7928
+ */
7929
+ readonly type: string;
7930
+ /**
7931
+ * The kind's name where a UI lists the kinds that can be inserted, such as `'Rating'`. Plain
7932
+ * text; the built-in checkbox takes its name from the command catalog instead.
7933
+ */
7934
+ readonly label?: string;
7935
+ /**
7936
+ * Whether the control draws a cell holding `value`. Any other value draws as text.
7937
+ */
7938
+ accepts(value: Scalar): boolean;
7939
+ }
7940
+
7619
7941
  /**
7620
7942
  * A logic label for an entire span of cells in either direction.
7621
7943
  */
@@ -8341,6 +8663,39 @@ declare global {
8341
8663
  * {@link IConditionalFormat.getRanges}.
8342
8664
  */
8343
8665
  getConditionalFormats(options?: ICellRange.GetItemsOptions<IConditionalFormatCollection.GetItemsOptions>): IConditionalFormat[];
8666
+ /**
8667
+ * Returns the {@link ICellControl}s on cells within the range, such as checkboxes.
8668
+ *
8669
+ * @param options The filters of {@link ICellControlCollection.getItems} without `address` —
8670
+ * this range is the address.
8671
+ *
8672
+ * @remarks
8673
+ * See {@link getConditionalFormats} for the overlap and one-entry-per-item rules, which are the
8674
+ * same for every ranged item lookup. A cell has at most one control; ask a cell for its own with
8675
+ * {@link ICell.getControl}.
8676
+ *
8677
+ * Office Scripts' `Range.getControl()` answers one `CellControl` for the whole range; here
8678
+ * `getControls()[0]?.getType()` reads a single cell's, and `toJSON()` gives the
8679
+ * `{ type: 'checkbox' }` shape. A control is about the cell, not its value: a checkbox cell
8680
+ * holding `2` still has one, though it draws `2` ({@link ICellControl.isAccepted}). A type
8681
+ * SheetXL does not know answers with its own name, where Excel answers `unknown`.
8682
+ */
8683
+ getControls(options?: ICellRange.GetItemsOptions<ICellControlCollection.GetItemsOptions>): ICellControl[];
8684
+ /**
8685
+ * Puts `control` on every cell of the range, replacing the control each had; `null` removes
8686
+ * them.
8687
+ *
8688
+ * @param control The control, such as `{ type: 'checkbox' }`, or `null`.
8689
+ *
8690
+ * @remarks
8691
+ * Office Scripts' `Range.setControl`, with `null` for its `{ type: 'empty' }`. A cell has at most
8692
+ * one control. The values stay as they are: a checkbox draws `TRUE` as checked and `FALSE` or a
8693
+ * blank cell as unchecked, and any other value as text.
8694
+ *
8695
+ * A control is a format: refused on a protected sheet unless formatting cells is allowed, removed
8696
+ * by {@link clear} of formats, and carried by a paste of formats.
8697
+ */
8698
+ setControl(control: ICellControl.JSON | null, options?: ITransaction.OperationOptions): this;
8344
8699
  /**
8345
8700
  * Returns the {@link IDataValidation}s that overlap the range.
8346
8701
  *
@@ -9013,7 +9368,7 @@ declare global {
9013
9368
  getRegions(features?: ICellRange.Feature | readonly ICellRange.Feature[], options?: ICellRange.GetRegionsOptions): ICellRegions;
9014
9369
  /**
9015
9370
  * Returns the regions of the `anomalies` feature in reading order: the named checks first, then
9016
- * the rest, each by rank.
9371
+ * the rest, each by the named focus or by rank.
9017
9372
  *
9018
9373
  * @param options {@link ICellRange.GetAnomaliesOptions}
9019
9374
  *
@@ -9022,6 +9377,8 @@ declare global {
9022
9377
  * // Hunting an embedded hardcode: read its checks' findings first, 25 regions at a time.
9023
9378
  * sheet.getAnomalies({ checks: ['hardcodeInRun', 'styleRole'], limit: 25 });
9024
9379
  * sheet.getAnomalies({ checks: ['hardcodeInRun', 'styleRole'], limit: 25, offset: 25 });
9380
+ * // Or name the kind of defect and let the measured order decide.
9381
+ * sheet.getAnomalies({ focus: 'unitMismatch', limit: 25 });
9025
9382
  * ```
9026
9383
  *
9027
9384
  * @remarks
@@ -9032,6 +9389,13 @@ declare global {
9032
9389
  * region two named checks fire on lists once, under the first. An ignored check
9033
9390
  * ({@link setErrorIgnored}) is not there to list.
9034
9391
  *
9392
+ * `focus` names the kind of defect being looked for ({@link ICellRange.AnomalyFocus}). Each
9393
+ * finding then weighs as the share of findings like it — the same check, the same kind of
9394
+ * evidence, about as often repeated in the listing — that were that kind of defect in audited
9395
+ * models, and a region lists by its best finding, by rank where that is equal. Several kinds
9396
+ * merge into one order by the best of them. It reorders; it neither adds nor drops a region, and
9397
+ * the findings' own ranks are unchanged.
9398
+ *
9035
9399
  * `offset` and `limit` page through that one order, so successive windows neither skip nor
9036
9400
  * repeat a region; a window shorter than `limit` is the last. `getRegions('anomalies').getCount()`
9037
9401
  * is the length of the whole list.
@@ -9534,12 +9898,23 @@ declare global {
9534
9898
  */
9535
9899
  select(options?: ICellRange.SelectOptions): Promise<this>;
9536
9900
  /**
9537
- * Add a listener to the range.
9901
+ * Listen for changes at this range: its cells written, recalculated or undone, and the range
9902
+ * itself moved by rows or columns inserted or deleted around it.
9538
9903
  *
9539
- * @returns A callback to remove. {@link IListener.Remove}
9904
+ * @returns A callback that removes the listener. {@link IListener.Remove}
9540
9905
  *
9541
9906
  * @remarks
9542
- * If the range becomes invalid through a delete this will auto remove.
9907
+ * The listener is handed an {@link ICellRange.Event} whose source is the listened range where
9908
+ * it is now. Which events it hears, how it follows inserts and deletes, and whether it takes
9909
+ * part in the change or observes it afterwards are {@link ICellRange.ListenerOptions}.
9910
+ *
9911
+ * @example
9912
+ * ```ts
9913
+ * const remove = sheet.getRange('A1:C3').addListener((event) => {
9914
+ * if (event.getTrigger() === 'data') console.log('changed:', event.getRanges()!.getAddress());
9915
+ * else console.log('now at:', event.getSource().getAddress());
9916
+ * });
9917
+ * ```
9543
9918
  */
9544
9919
  addListener(listener: ICellRange.Listener, options?: ICellRange.ListenerOptions): IListener.Remove;
9545
9920
  /**
@@ -9796,15 +10171,20 @@ declare global {
9796
10171
  */
9797
10172
  type ScalarUpdate = Scalar | null | undefined;
9798
10173
  /**
9799
- * Represents an update to a cell's value in JavaScript, allowing `Date` and `null`.
10174
+ * Represents an update to a cell's value in JavaScript, allowing `Date`, a rich value's JSON
10175
+ * and `null`.
9800
10176
  *
9801
10177
  * @remarks
9802
10178
  * This type allows for updating a cell's value, including `Date` for convenience.
9803
10179
  * As with `ScalarUpdate`, `null` can be used to clear the cell's value.
9804
10180
  *
10181
+ * A rich value may be given as its JSON (`{ type, data }`, what {@link IRichData.toJSON}
10182
+ * returns); it is made by the kind registered for `type`, and an unregistered type is kept
10183
+ * as it was given.
10184
+ *
9805
10185
  * * See {@link InteropScalar} for more details on JavaScript scalar values.
9806
10186
  */
9807
- type InteropScalarUpdate = InteropScalar | null | undefined;
10187
+ type InteropScalarUpdate = InteropScalar | IRichData.JSON | null | undefined;
9808
10188
  /**
9809
10189
  * Single or 2D.
9810
10190
  */
@@ -10935,6 +11315,14 @@ declare global {
10935
11315
  * failure — its cells evaluate, to `0` — and is {@link Feature.Circular}.
10936
11316
  */
10937
11317
  readonly CalcError: "calcError";
11318
+ /**
11319
+ * Evaluated state: cells whose result has not settled. Regions group by status — a cell whose
11320
+ * own function has not answered yet ({@link ICalculation.ResultStatus.Pending}), or one
11321
+ * calculated from such a value and calculated again when it arrives
11322
+ * ({@link ICalculation.ResultStatus.Waiting}). The anchor's `getCalculationStatus()` is the
11323
+ * payload. Empty once every answer has landed.
11324
+ */
11325
+ readonly CalcStatus: "calcStatus";
10938
11326
  /**
10939
11327
  * Evaluated state: cells in a reference cycle, or downstream of one. Both evaluate to `0`
10940
11328
  * (Excel, iterative calculation off) with nothing else to show for it — this is the marker.
@@ -10982,6 +11370,14 @@ declare global {
10982
11370
  readonly Conditionals: "conditionals";
10983
11371
  /** Cells under data-validation rules. */
10984
11372
  readonly DataValidations: "dataValidations";
11373
+ /**
11374
+ * Cells under a cell control ({@link ICellRange.setControl}). Regions group by the control's
11375
+ * definition (its type and properties), so adjacent checkboxes set in two strokes are one
11376
+ * region and a checkbox beside a rating are two; the anchor cell's {@link ICell.getControl} is
11377
+ * the payload. Whether a cell draws its control depends on its value, which is a `Kind`
11378
+ * question: ask for both to split a column of checkboxes from the text cells among them.
11379
+ */
11380
+ readonly CellControl: "cellControl";
10985
11381
  /**
10986
11382
  * Cells where an error check fires — what breaks the pattern around it. Regions group by the
10987
11383
  * check and its evidence, so a filled row that breaks the same way is one region; the anchor
@@ -11003,7 +11399,11 @@ declare global {
11003
11399
  * a reference outside the workbook (`externalReference`); and from labels: a link whose target
11004
11400
  * row is labeled otherwise (`linkLabelMismatch`), a lookup key that is not the row's or
11005
11401
  * column's label (`keyLabelMismatch`), a link with the other sign from its siblings
11006
- * (`signVsSiblings`). An ignored check ({@link ICellRange.setErrorIgnored}) does not fire.
11402
+ * (`signVsSiblings`); and from the numbers: a typed number in a formula equal to an input
11403
+ * nothing reads (`literalMatchesInput`), twin formulas that differ in a unit literal or a sign
11404
+ * (`twinBlockDivergence`), a percent typed as a whole number (`scaleOutlier`), every constant a
11405
+ * formula types with how often the workbook types it (`constantFrequency`). An ignored check
11406
+ * ({@link ICellRange.setErrorIgnored}) does not fire.
11007
11407
  *
11008
11408
  * Regions list highest rank first ({@link ICell.Anomaly.rank}), unless an `axis` is asked for.
11009
11409
  *
@@ -11067,6 +11467,33 @@ declare global {
11067
11467
  */
11068
11468
  containment?: 'intersects' | 'fullyContained';
11069
11469
  }
11470
+ /**
11471
+ * A kind of defect a reader is looking for, which {@link ICellRange.getAnomalies} can order its
11472
+ * findings by ({@link GetAnomaliesOptions.focus}).
11473
+ */
11474
+ const AnomalyFocus: {
11475
+ /** A cell or a subtotal counted twice in a sum. */
11476
+ readonly DoubleCounting: "doubleCounting";
11477
+ /** A typed number where a reference belongs. */
11478
+ readonly EmbeddedHardcode: "embeddedHardcode";
11479
+ /** A cell whose font color is not its role's (inputs, links, calculations). */
11480
+ readonly ColorCoding: "colorCoding";
11481
+ /** An average over the wrong cells. */
11482
+ readonly Average: "average";
11483
+ /** A link to another sheet that reads the wrong row or column. */
11484
+ readonly CrossSheetReference: "crossSheetReference";
11485
+ /** A term added that should be taken away, or the reverse. */
11486
+ readonly SignConvention: "signConvention";
11487
+ /** A lookup that matches approximately, or reads arrays that do not line up. */
11488
+ readonly Lookup: "lookup";
11489
+ /** A reference relative where it should be absolute, or the reverse. */
11490
+ readonly ReferenceAnchoring: "referenceAnchoring";
11491
+ /** A value in the wrong unit: a monthly figure in a daily formula, a percent typed as a whole number. */
11492
+ readonly UnitMismatch: "unitMismatch";
11493
+ /** Rows deleted from a model, which leaves references shifted and `#REF!`. */
11494
+ readonly DeletedRows: "deletedRows";
11495
+ };
11496
+ type AnomalyFocus = typeof AnomalyFocus[keyof typeof AnomalyFocus];
11070
11497
  /**
11071
11498
  * Options for {@link ICellRange.getAnomalies}.
11072
11499
  */
@@ -11077,6 +11504,15 @@ declare global {
11077
11504
  * @defaultValue none — every region by rank
11078
11505
  */
11079
11506
  checks?: readonly ICell.ErrorCheck[];
11507
+ /**
11508
+ * The kind of defect being looked for, or several: regions are ordered by how often findings
11509
+ * like theirs have been that kind of defect, measured on audited models, and by rank where
11510
+ * that is equal. With `checks` too, the named checks still list first and `focus` orders
11511
+ * within each. An unknown name throws.
11512
+ *
11513
+ * @defaultValue none — by rank
11514
+ */
11515
+ focus?: AnomalyFocus | readonly AnomalyFocus[];
11080
11516
  /**
11081
11517
  * At most this many regions.
11082
11518
  *
@@ -11229,85 +11665,101 @@ declare global {
11229
11665
  */
11230
11666
  injectReferences?: IRange.JSONReference<any>[][];
11231
11667
  }
11232
- interface Event {
11668
+ /**
11669
+ * What a range listener is told. See {@link ICellRange.addListener}.
11670
+ *
11671
+ * @typeParam S The source the listener registered on: an `ICellRange` from
11672
+ * {@link ICellRange.addListener}, an `ICellRanges` from {@link ICellRanges.addListener}.
11673
+ */
11674
+ interface Event<S extends ICellRange | ICellRanges = ICellRange> {
11233
11675
  /**
11234
11676
  * The range that was listened to, where it is now.
11235
11677
  *
11236
11678
  * @remarks
11237
- * After a `'address'` or `'restore'` event this is the range at its new address or extent: rows
11679
+ * After an `'address'` or `'restore'` event this is the range at its new address or extent: rows
11238
11680
  * or columns inserted or deleted around it, or an undo that moved it back. The range
11239
11681
  * `addListener` was called on keeps the address it was made with, so this is where to read
11240
11682
  * the range from.
11683
+ *
11684
+ * A range whose cells were deleted is invalid ({@link ICellRange.isInvalid}) and spells
11685
+ * `#REF!`; one restored to a revision from before the listener was added is invalid and
11686
+ * spells `#N/A`.
11241
11687
  */
11242
- getSource<T = ICellRange | ICellRanges>(): T;
11688
+ getSource(): S;
11243
11689
  /**
11244
- * This is the range of data that has been changed.
11690
+ * The cells that changed within the source, for a `'data'` event; `null` for any other.
11245
11691
  *
11246
11692
  * @remarks
11247
- * This is different than the source range as that is the entire range area that was listened to.
11693
+ * A batch is one change: every range of it that reached the listener arrives in one event.
11248
11694
  */
11249
- getFrom(): ICellRanges;
11695
+ getRanges(): ICellRanges | null;
11250
11696
  /**
11251
- * Returns a list of updates that occurred during the event. This is only available for data change events and will be `null` for address or restore events.
11697
+ * Where the source was before an `'address'` event moved it; `null` for any other event, and
11698
+ * for a sheet rename, which moves no cells.
11699
+ *
11700
+ * @remarks
11701
+ * An address rather than a range, because the cells at it now are other cells.
11252
11702
  */
11703
+ getPreviousAddress(): string | null;
11253
11704
  /**
11254
- * Indicates the type of change that triggered the event.
11705
+ * What happened to the range.
11255
11706
  *
11256
11707
  * @remarks
11257
- * * `'data'`: Data within the range has changed.
11258
- * The range's address and dimensions remain the same.
11259
- * * `'address'`: The range's *address* or *dimensions* have changed. This
11260
- * occurs due to row/column insertions, deletions, or move operations — and, for a
11261
- * sheet-qualified range (one from {@link IWorkbook.getRange}, or a sheet's range naming
11262
- * another sheet), when the sheet it names is renamed. A bare range on its own sheet has no
11263
- * qualifier, so a rename is not a change to it.
11264
- * * `'restore'`: The range has been restored to a different revision
11265
- * (undo/redo). The 'restore' trigger is not available for transactional listeners.
11708
+ * * `'data'`: Cells within the range changed: written, recalculated, or undone. The range's
11709
+ * address and extent are as they were. {@link getCommit} is `null` for a recalculation,
11710
+ * which belongs to no commit; {@link isUndo} tells an undo from a write.
11711
+ * * `'address'`: The range's address or extent changed: rows or columns inserted or deleted,
11712
+ * cells moved, its cells deleted (the source spells `#REF!`), or, for a sheet-qualified
11713
+ * range (one from {@link IWorkbook.getRange}, or a sheet's range naming another sheet), a
11714
+ * rename of the sheet it names. A bare range on its own sheet has no qualifier, so a rename
11715
+ * is not a change to it. A listener anchored {@link IAnchored.Type.Absolute} never moves and
11716
+ * never has one.
11717
+ * * `'restore'`: The workbook was restored to a revision from before the listener was added,
11718
+ * so the range is not in it (the source spells `#N/A`). Never delivered to a transactional
11719
+ * listener.
11266
11720
  */
11267
- readonly trigger2?: 'data' | 'address' | 'restore';
11268
- readonly trigger: string;
11721
+ getTrigger(): Event.Trigger;
11269
11722
  /**
11270
- * Indicates if the event is being fired from an undo event.
11723
+ * `true` when the change is an undo. A redo is not an undo: it is told as the forward change
11724
+ * was.
11271
11725
  */
11272
- readonly isUndo?: boolean;
11726
+ isUndo(): boolean;
11273
11727
  /**
11274
- * Returns the transaction Id if the event is occurring in a transaction otherwise `null`.
11728
+ * The commit that made the change, or `null` when none did: a recalculation landing.
11275
11729
  *
11276
- * @see
11277
- * {@link ListenerOptions.getTransactionId}
11730
+ * @remarks
11731
+ * A transactional listener is told before the commit is sealed, so this is the commit it is
11732
+ * writing into ({@link ListenerOptions.transactional}).
11278
11733
  */
11279
- getTransactionId(): string | null;
11734
+ getCommit(): ITransaction.ICommit | null;
11280
11735
  /**
11281
- * Indicates if the event is being fired due to a cell value change.
11282
- *
11283
- * @see
11284
- * {@link ListenerOptions.ignoreDataChanges}
11736
+ * The trigger and the source, for logging.
11285
11737
  */
11286
- readonly isDataChange?: boolean;
11738
+ toString(): string;
11287
11739
  /**
11288
- * To string the event.
11740
+ * When the event was made, in milliseconds since the epoch.
11289
11741
  */
11290
- toString(): string;
11742
+ getTimeStamp(): number;
11743
+ }
11744
+ namespace Event {
11291
11745
  /**
11292
- * The timestamp of the event.
11746
+ * What happened to a listened range. See {@link ICellRange.Event.getTrigger}.
11293
11747
  */
11294
- readonly timeStamp: number;
11748
+ type Trigger = 'data' | 'address' | 'restore';
11295
11749
  }
11296
11750
  /**
11297
- * Represents a listen for a range. The listener will be called when the range's
11298
- * data, address, or restore state changes, subject to the provided options.
11751
+ * Called with what changed at a listened range. See {@link ICellRange.addListener}.
11299
11752
  *
11300
- * @remarks
11301
- * If the range is deleted (rows/columns removed), the trigger will be `'address'`
11302
- * `trigger` of `'address'` and `getRange().getError()`
11303
- * returning `"#REF!"`.
11753
+ * @typeParam S The source the listener registered on; see {@link ICellRange.Event}.
11304
11754
  *
11305
- * If the ranges is restored to a revision *before* the listener was
11306
- * added, the listener will receive event with a `trigger` of `'restore'`
11307
- * and `getRange().getError()` returning `"#N/A"`.
11755
+ * @remarks
11756
+ * Read the range from {@link Event.getSource}, which is where the listened cells are now. It is
11757
+ * invalid ({@link ICellRange.isInvalid}) when the cells were deleted (`#REF!`) or the workbook
11758
+ * was restored to a revision from before the listener was added (`#N/A`); the listener stays
11759
+ * registered through both, and hears the range come back.
11308
11760
  */
11309
- interface Listener {
11310
- (event: ICellRange.Event): void;
11761
+ interface Listener<S extends ICellRange | ICellRanges = ICellRange> {
11762
+ (event: ICellRange.Event<S>): void;
11311
11763
  }
11312
11764
  /**
11313
11765
  * Receives a watch's results — one value per cell of the watched range, read with LOCAL
@@ -11353,11 +11805,28 @@ declare global {
11353
11805
  /**
11354
11806
  * If `true`, the listener will *not* be called when the range's
11355
11807
  * address changes (due to row/column insert/delete, moves, or a rename of
11356
- * the sheet a qualified range names)
11808
+ * the sheet a qualified range names). The range still follows its cells; see {@link anchor}
11809
+ * for a range that should not.
11357
11810
  *
11358
11811
  * @defaultValue false
11359
11812
  */
11360
11813
  ignoreAddressChanges?: boolean;
11814
+ /**
11815
+ * How the listened range follows rows and columns inserted or deleted around it.
11816
+ *
11817
+ * @defaultValue {@link IAnchored.Type.TwoCell}
11818
+ *
11819
+ * @remarks
11820
+ * * `TwoCell`: the range follows its cells, as a formula reference does. An insert above it
11821
+ * moves it down, a delete inside it shrinks it, and deleting all of its cells makes it
11822
+ * `#REF!`. Each move is an `'address'` event.
11823
+ * * `OneCell`: the top-left follows its cell and the extent is kept, as a picture anchored to
11824
+ * one cell. Deleting the top-left cell leaves the range where it is.
11825
+ * * `Absolute`: the range never moves. It names the same addresses whatever is inserted or
11826
+ * deleted, so it never has an `'address'` event. This is what a view listening to the rows
11827
+ * it shows wants: the cells on screen, not the cells that were there when it subscribed.
11828
+ */
11829
+ anchor?: IAnchored.Type;
11361
11830
  /**
11362
11831
  * Whether the listener takes part in the operations that change its range.
11363
11832
  *
@@ -11485,14 +11954,15 @@ declare global {
11485
11954
  * This is Excel's `Ctrl+Enter` fill: the same scalar is written to all selected cells — across every
11486
11955
  * discontiguous range — as a single {@link ICellRanges.doBatch} operation (one undo step). A formula
11487
11956
  * string (e.g. `"=A1+1"`) is coerced and its relative references adjust per cell, exactly as
11488
- * {@link ICellRange.setValue} does within one range.
11957
+ * {@link ICellRange.setValue} does within one range. It takes what that does: a `Date`, or a rich
11958
+ * value's JSON (`{ type, data }`), which each cell makes into its own value.
11489
11959
  *
11490
11960
  * Only the scalar-broadcast form exists (no `setValues`): a 2D shape has no coherent meaning spread
11491
11961
  * across discontiguous ranges of differing sizes.
11492
11962
  * @see
11493
11963
  * {@link ICellRange.setValue}
11494
11964
  */
11495
- setValue(value: ICellRange.ScalarUpdate, options?: ICellRange.SetValuesOptions): this;
11965
+ setValue(value: ICellRange.InteropScalarUpdate, options?: ICellRange.SetValuesOptions): this;
11496
11966
  /**
11497
11967
  * {@inheritDoc ICellRange.merge}
11498
11968
  */
@@ -11748,7 +12218,7 @@ declare global {
11748
12218
  /**
11749
12219
  * {@inheritDoc ICellRange.addListener}
11750
12220
  */
11751
- addListener(listener: ICellRange.Listener, options?: ICellRange.ListenerOptions): IListener.Remove;
12221
+ addListener(listener: ICellRange.Listener<ICellRanges>, options?: ICellRange.ListenerOptions): IListener.Remove;
11752
12222
  /**
11753
12223
  * {@link ICellRange.addWatch} across every area, as ONE expression authored at a shared origin.
11754
12224
  *
@@ -18371,120 +18841,6 @@ declare global {
18371
18841
  }
18372
18842
  }
18373
18843
 
18374
- /**
18375
- * A what-if data table (Excel's **What-If Analysis > Data Table**): a block of result cells, each
18376
- * the table's formula evaluated with its row and column values put in the input cells.
18377
- *
18378
- * @remarks
18379
- * The table is carried, not calculated: its results are the values the file held, and nothing
18380
- * recalculates them. Excel recalculates it when it opens the file (when the calculation mode and
18381
- * {@link IDataTable.JSON.calculateAlways} allow).
18382
- *
18383
- * The anchor is the result cells; the formula, the row values above them and the column values to
18384
- * their left are ordinary cells. As in Excel, an edit to part of the results is refused, and one
18385
- * that clears or deletes all of them deletes the table.
18386
- */
18387
- export interface IDataTable extends IAnchored {
18388
- toJSON(): IDataTable.JSON | null;
18389
- /**
18390
- * Returns the result cells.
18391
- *
18392
- * @remarks
18393
- * An insert or delete before them moves them, one taking all of them deletes the table
18394
- * ({@link IAnchored.isDeleted}), and one that would move part of them is refused.
18395
- */
18396
- getRange(options?: ICellRange.GetRangeOptions): ICellRange;
18397
- /**
18398
- * Returns the input cell the row values are put in, as an A1 address on this sheet, or `null`
18399
- * when the table has none (a one-input table down a column).
18400
- *
18401
- * @remarks
18402
- * Follows the cell through inserts, deletes and moves. Once the cell is deleted this is the last
18403
- * address it had, and {@link isRowInputDeleted} is `true`.
18404
- */
18405
- getRowInput(): string | null;
18406
- /**
18407
- * Returns the input cell the column values are put in, as an A1 address on this sheet, or `null`
18408
- * when the table has none (a one-input table along a row).
18409
- *
18410
- * @remarks
18411
- * Follows the cell as {@link getRowInput} does.
18412
- */
18413
- getColumnInput(): string | null;
18414
- /**
18415
- * Returns whether the row input cell was deleted. The table's results are then `#REF!` in Excel.
18416
- */
18417
- isRowInputDeleted(): boolean;
18418
- /**
18419
- * Returns whether the column input cell was deleted.
18420
- */
18421
- isColumnInputDeleted(): boolean;
18422
- /** For runtime type checking. */
18423
- readonly isIDataTable: true;
18424
- }
18425
-
18426
- export namespace IDataTable {
18427
- /**
18428
- * JSON representation of a data table.
18429
- *
18430
- * @remarks
18431
- * A table has a row input, a column input, or both (a two-input table).
18432
- */
18433
- interface JSON {
18434
- /**
18435
- * The result cells, as an A1 range.
18436
- */
18437
- ref: string;
18438
- /**
18439
- * The input cell the row values are put in, as an A1 address on the same sheet.
18440
- */
18441
- rowInput?: string;
18442
- /**
18443
- * The input cell the column values are put in, as an A1 address on the same sheet.
18444
- */
18445
- columnInput?: string;
18446
- /**
18447
- * Whether the row input cell was deleted; {@link rowInput} is then its last address.
18448
- */
18449
- rowInputDeleted?: boolean;
18450
- /**
18451
- * Whether the column input cell was deleted; {@link columnInput} is then its last address.
18452
- */
18453
- columnInputDeleted?: boolean;
18454
- /**
18455
- * Whether Excel recalculates the table when it opens the file. Without it, Excel shows the
18456
- * results as saved until something recalculates the table.
18457
- *
18458
- * @remarks
18459
- * Kept as read until the workbook's cell data is edited, on any sheet. Then it is set on every
18460
- * table, because nothing here recalculates the results and they may no longer be right. It stays
18461
- * set when the edit is undone.
18462
- */
18463
- calculateAlways?: boolean;
18464
- }
18465
- /**
18466
- * `Events` for {@link IDataTable}.
18467
- */
18468
- interface Events extends IAnchored.Events<IDataTable> {
18469
- }
18470
- }
18471
-
18472
- /**
18473
- * Holds a sheet's {@link IDataTable | data tables}.
18474
- *
18475
- * @remarks
18476
- * Read-only for now: a table is carried as it was read and written back. Creating one and
18477
- * calculating it wait on the engine evaluating `TABLE`.
18478
- */
18479
- export interface IDataTableCollection extends ICollection<IDataTable> {
18480
- /**
18481
- * Returns the data tables, in the order they were read.
18482
- */
18483
- getItems(options?: ICollection.GetItemsOptions): IDataTable[];
18484
- /** For runtime type checking. */
18485
- readonly isIDataTableCollection: true;
18486
- }
18487
-
18488
18844
  /**
18489
18845
  * A data validation: a rule that a cell's value must satisfy, over one or more ranges of a sheet,
18490
18846
  * with the prompt shown when the cell is selected and the alert for a value that fails.
@@ -19861,11 +20217,11 @@ declare global {
19861
20217
  /** `<sheetData refreshError="1">` — Excel could not refresh this sheet's cache last time it tried. */
19862
20218
  refreshError?: boolean;
19863
20219
  /**
19864
- * Sparse cell values — the same encoding `IWorksheet.JSON.data` uses (`ICell.JSON` is already just
20220
+ * Sparse cell values — the same encoding `IWorksheet.JSON.data` uses (`Scalar.JSON` is already just
19865
20221
  * the value+type pair; style/formula live in sibling fields there, none of which apply to a
19866
20222
  * values-only cache — design doc §2.5).
19867
20223
  */
19868
- data: Tuple.GridTuple<ICell.JSON>;
20224
+ data: Tuple.GridTuple<Scalar.JSON>;
19869
20225
  }
19870
20226
  interface JSON {
19871
20227
  /**
@@ -19980,6 +20336,54 @@ declare global {
19980
20336
  }
19981
20337
  }
19982
20338
 
20339
+ /**
20340
+ * How a workbook reaches what lives outside it: the picture an `IMAGE` names, a web service's
20341
+ * answer. A handler per URL scheme; a host registers its own to add authentication, or to serve a
20342
+ * scheme of its own.
20343
+ *
20344
+ * @remarks
20345
+ * Each workbook has one, given as `IWorkbook.ConstructorOptions.fetcher`, or a default that
20346
+ * answers `http:` and `https:` with the global `fetch`.
20347
+ *
20348
+ * @example
20349
+ * ```typescript
20350
+ * const fetcher = new Fetcher();
20351
+ * fetcher.register('https', (url, init) => fetch(url, {
20352
+ * ...init,
20353
+ * headers: { ...init?.headers, Authorization: `Bearer ${token}` }
20354
+ * }));
20355
+ * const workbook = new Workbook({ fetcher });
20356
+ * ```
20357
+ */
20358
+ export interface IFetcher {
20359
+ /**
20360
+ * Fetches `input` with the handler registered for its scheme. A URL without a scheme goes to
20361
+ * the `https` handler.
20362
+ *
20363
+ * @returns The response; rejects with a `TypeError` when no handler serves the scheme, as
20364
+ * `fetch` does for a URL it cannot reach.
20365
+ */
20366
+ fetch(input: string, init?: RequestInit): Promise<Response>;
20367
+ /**
20368
+ * Serves a URL scheme with `handler`, replacing the handler it had.
20369
+ *
20370
+ * @param scheme The scheme, with or without its colon: `'https'`, `'resource:'`.
20371
+ * @returns A function that removes the registration.
20372
+ */
20373
+ register(scheme: string, handler: IFetcher.Handler): () => void;
20374
+ /**
20375
+ * For runtime type checking.
20376
+ */
20377
+ readonly isIFetcher: true;
20378
+ }
20379
+
20380
+ export namespace IFetcher {
20381
+ /**
20382
+ * Answers a fetch for one scheme, with the signature of the standard `fetch`.
20383
+ */
20384
+ type Handler = (url: string, init?: RequestInit) => Promise<Response>;
20385
+ }
20386
+
19983
20387
  /**
19984
20388
  * Defines how an area or shape is filled with color or a pattern.
19985
20389
  */
@@ -21875,6 +22279,7 @@ declare global {
21875
22279
  * | Category | Key methods |
21876
22280
  * |---|---|
21877
22281
  * | Evaluation lifecycle | `markVolatile`, `getRow`, `getColumn`, `getEntireCoords`, `getRandom` |
22282
+ * | Answering later | `defer` |
21878
22283
  * | Argument reflection | `getArgs` |
21879
22284
  * | Output hints | `formatResults` |
21880
22285
  * | Range construction | `createRange`, `flattenAreas`, `filterHidden` |
@@ -22444,6 +22849,64 @@ declare global {
22444
22849
  * @throws If called outside a function dispatch — there are no arguments to reflect on.
22445
22850
  */
22446
22851
  getArgs(): IFunctionArguments;
22852
+ /**
22853
+ * Answers this call later: hands `executor` a call to settle, and leaves the cell showing what
22854
+ * the function returns now.
22855
+ *
22856
+ * @param executor Runs once at the end of the recalculation with every call made against it.
22857
+ * Pass a module-level function by name: calls join one batch when they name the same function.
22858
+ * @param payload Everything the executor needs to answer this call, and how a later evaluation
22859
+ * recognizes it: while the call is still waiting, a recalculation with
22860
+ * an equal payload leaves it be rather than asking again. Once it has stopped, a recalculation
22861
+ * calls the function again; what it fetched is answered from the workbook's cache
22862
+ * (`IBatchContext.fetch`).
22863
+ * @returns The last answer this call gave for the same question, when the function is being
22864
+ * called again (a recalculation); `undefined` on a first call or a changed question. Return it
22865
+ * to keep showing it until the new answer arrives, or return something else to show that the
22866
+ * cell is waiting.
22867
+ *
22868
+ * @remarks
22869
+ * The function still returns a value: what this call answers until its result arrives (nothing
22870
+ * returned reads as blank), and it is what every formula over the cell calculates
22871
+ * from meanwhile: return `#BUSY!` when they should wait as an error, or text such as
22872
+ * `'Fetching…'` when that is what they should show.
22873
+ *
22874
+ * The executor runs after the recalculation, outside any cell; read nothing from the formula
22875
+ * context there. Whatever the body knows goes in the payload.
22876
+ *
22877
+ * @example
22878
+ * ```typescript
22879
+ * function fetchAll(
22880
+ * calls: readonly IFormulaContext.DeferredCall<string>[],
22881
+ * ctx: IFormulaContext.IBatchContext
22882
+ * ): void {
22883
+ * for (const call of calls) {
22884
+ * ctx.fetch(call.payload as string)
22885
+ * .then((response) => response.text())
22886
+ * .then((text) => call.resolve(text), (error) => call.reject(error));
22887
+ * }
22888
+ * }
22889
+ *
22890
+ * export function FETCHTEXT(url: string): string {
22891
+ * FormulaContext.defer(fetchAll, url);
22892
+ * return 'Fetching…';
22893
+ * }
22894
+ * ```
22895
+ */
22896
+ defer(executor: IFormulaContext.DeferExecutor, payload?: unknown): unknown;
22897
+ /**
22898
+ * A rich value of a registered type, made from its data as the type's JSON holds it, for the
22899
+ * workbook being calculated.
22900
+ *
22901
+ * @param type The name of the value's kind (`'hyperlink'`): what its `getKind().getName()`
22902
+ * will answer.
22903
+ * @param data The value's data, as its JSON's `data`.
22904
+ *
22905
+ * @remarks
22906
+ * A type nobody has registered still makes a value: one that carries the data and reads as
22907
+ * nothing.
22908
+ */
22909
+ createRichData(type: string, data?: any): IRichData;
22447
22910
  }
22448
22911
 
22449
22912
  /**
@@ -22595,6 +23058,67 @@ declare global {
22595
23058
  */
22596
23059
  readonly dow: number;
22597
23060
  }
23061
+ /**
23062
+ * Answers the calls made by {@link IFormulaContext.defer} against it. Invoked once at the end of
23063
+ * a recalculation with every such call; how many requests that becomes is the executor's choice.
23064
+ */
23065
+ type DeferExecutor<T = any> = (calls: readonly DeferredCall<T>[], ctx: IBatchContext) => void | Promise<void>;
23066
+ /**
23067
+ * One call made by {@link IFormulaContext.defer}, as its executor receives it.
23068
+ *
23069
+ * @remarks
23070
+ * Settle each call itself, never by its position in a response. An executor that returns a
23071
+ * promise which rejects fails every call it has not settled.
23072
+ */
23073
+ interface DeferredCall<T = any> {
23074
+ /** What the function passed to `defer`. */
23075
+ readonly payload: unknown;
23076
+ /** Settles the call with its result. */
23077
+ resolve(value: T): void;
23078
+ /** Settles the call with an error: a `FormulaError` as itself, anything else as `#VALUE!`. */
23079
+ reject(error: unknown): void;
23080
+ /** Runs `fn` when the result is no longer wanted. */
23081
+ onCancel(fn: () => void): void;
23082
+ /**
23083
+ * Whether the result is no longer wanted. Only an executor that holds calls to settle later
23084
+ * needs it; a result for a cancelled call is dropped.
23085
+ */
23086
+ readonly cancelled: boolean;
23087
+ }
23088
+ /**
23089
+ * What an executor is given beside its calls.
23090
+ */
23091
+ interface IBatchContext {
23092
+ /** A random number in `[0, 1)` from the calculation's source, which a test can seed. */
23093
+ getRandom(): number;
23094
+ /**
23095
+ * State kept for this executor across recalculations, made by `init` on first ask. Keep data
23096
+ * here (maps, numbers, strings, buffers), not connections or sockets.
23097
+ */
23098
+ getState<S>(init: () => S): S;
23099
+ /**
23100
+ * A rich value of a registered type, for the workbook being calculated: what
23101
+ * {@link IFormulaContext.createRichData} makes inside a cell, made here for a call's result.
23102
+ */
23103
+ createRichData(type: string, data?: any): IRichData;
23104
+ /**
23105
+ * Adds bytes to the workbook being calculated as a resource (an `IResource`), for a rich value
23106
+ * to hold: pass it in {@link createRichData}'s data. The workbook saves it while a value holds
23107
+ * it. With `fetchedFrom` it is the workbook's copy of that URL: {@link fetch} answers the URL
23108
+ * from it, and adding the same URL again answers the resource already added.
23109
+ */
23110
+ addResource(buffer: ArrayBuffer, options?: {
23111
+ fetchedFrom?: string;
23112
+ }): object;
23113
+ /**
23114
+ * Fetches through the workbook being calculated: the standard `fetch`, answered by the
23115
+ * fetchers the host registered for the URL's scheme, with the host's authentication. An
23116
+ * answer the workbook already has for the URL (a picture it keeps, or anything fetched while
23117
+ * it is open) answers from the workbook, and two calls for one URL share one request. In an
23118
+ * external calculation (*Refresh All*) it goes to the source.
23119
+ */
23120
+ fetch(input: string, init?: RequestInit): Promise<Response>;
23121
+ }
22598
23122
  }
22599
23123
 
22600
23124
  /**
@@ -22881,11 +23405,9 @@ declare global {
22881
23405
  getMembers(): readonly IFunction.IEnumMember[];
22882
23406
  }
22883
23407
  /**
22884
- * Describes the runtime return behavior of a function, including modifiers like
22885
- * async resolution, streaming data, or volatility.
23408
+ * Describes the runtime return behavior of a function, including modifiers like volatility.
22886
23409
  *
22887
23410
  * @remarks
22888
- * All return type modifiers are mutually exclusive.
22889
23411
  * If none are specified, The value will be returned with no special behavior.
22890
23412
  */
22891
23413
  interface IReturnType extends IValueType {
@@ -22897,19 +23419,6 @@ declare global {
22897
23419
  * @see {@link ReturnTypeJSON.kind}
22898
23420
  */
22899
23421
  getKind(): ValueKind | null;
22900
- /**
22901
- * Indicates the return value is a Promise or Promise-like (i.e., async).
22902
- * The system will mark the result as pending and re-trigger evaluation once resolved.
22903
- *
22904
- * Can be combined with any scalar, array, or range return type.
22905
- */
22906
- isAsync(): boolean;
22907
- /**
22908
- * Indicates whether the function produces a continuous stream of output (e.g., real-time data).
22909
- *
22910
- * @defaultValue `false`
22911
- */
22912
- isStreaming(): boolean;
22913
23422
  /**
22914
23423
  * True when the result can change with nothing dirty, so a cell naming this function
22915
23424
  * recalculates on every pass — the `Volatile<T>` marker.
@@ -23335,8 +23844,7 @@ declare global {
23335
23844
  members: [name: string, value: number | string, deprecated?: string | true][];
23336
23845
  }
23337
23846
  /**
23338
- * Describes the runtime return behavior of a function, including modifiers like
23339
- * async resolution, streaming data, or volatility.
23847
+ * Describes the runtime return behavior of a function, including modifiers like volatility.
23340
23848
  *
23341
23849
  * @remarks
23342
23850
  * If none are specified, The value will be returned with no special behavior.
@@ -23360,19 +23868,6 @@ declare global {
23360
23868
  * is a scalar is its member value downstream.
23361
23869
  */
23362
23870
  kind?: ValueKind;
23363
- /**
23364
- * Indicates the return value is a Promise or Promise-like (i.e., async).
23365
- * The system will mark the result as pending and re-trigger evaluation once resolved.
23366
- *
23367
- * Can be combined with any scalar, array, or range return type.
23368
- */
23369
- async?: boolean;
23370
- /**
23371
- * Indicates whether the function produces a continuous stream of output (e.g., real-time data).
23372
- *
23373
- * @defaultValue `false`
23374
- */
23375
- stream?: boolean;
23376
23871
  /**
23377
23872
  * The result can change with nothing dirty — a cell naming this function recalculates on
23378
23873
  * every pass. Generated from the `Volatile<T>` marker.
@@ -23381,8 +23876,7 @@ declare global {
23381
23876
  * Collected at COMPILE time from the formula text (`CompiledFormula.hasVolatile`), because
23382
23877
  * that is where Excel decides it: `=IF(TRUE,1,RAND())` recalculates on every idle pass though
23383
23878
  * no branch selects the arm, and with lazy arguments the call never happens for the engine to
23384
- * observe. Sits beside {@link async} and {@link stream} because all three are about WHEN a
23385
- * result arrives rather than what it is.
23879
+ * observe.
23386
23880
  *
23387
23881
  * @see {@link Volatile}
23388
23882
  */
@@ -24953,8 +25447,18 @@ declare global {
24953
25447
  getTarget(): string;
24954
25448
  /**
24955
25449
  * Removes the link from the cell it is attached to. The cell's text stays.
25450
+ *
25451
+ * @throws When the link is read-only ({@link isReadOnly}).
24956
25452
  */
24957
25453
  delete(options?: ITransaction.OperationOptions): void;
25454
+ /**
25455
+ * Whether the link can only be followed: it is not edited or removed as a link.
25456
+ *
25457
+ * @remarks
25458
+ * A link that is the cell's value (a `HYPERLINK()` result) is read-only; it changes with its
25459
+ * formula.
25460
+ */
25461
+ isReadOnly(): boolean;
24958
25462
  /**
24959
25463
  * For runtime type checking.
24960
25464
  */
@@ -26994,6 +27498,25 @@ declare global {
26994
27498
  * take the first.
26995
27499
  */
26996
27500
  getByRanges(ranges: ICellRanges.Address, options?: INamedCollection.GetByRangesOptions): string[];
27501
+ /**
27502
+ * Deletes the defined names nothing reads, as one operation.
27503
+ *
27504
+ * @param options `hiddenOnly` limits it to names flagged hidden; `dryRun` counts without deleting.
27505
+ * @returns How many names were deleted, or with `dryRun`, would be.
27506
+ * @throws `Error` if the names are read-only (a protected workbook structure) and this is not a dry run.
27507
+ *
27508
+ * @remarks
27509
+ * A name is read when a cell formula, a conditional format, a data validation, a chart or another
27510
+ * name refers to it — the readers `ICalculation.INamedFormula.getDependents` reports. A name
27511
+ * that a kept name's definition mentions is kept too, whether or not anything reads that one.
27512
+ * Only defined names are considered; a table is named by the table it belongs to. Excel's built-in
27513
+ * names (`_xlnm.Print_Area`, `_xlnm.Print_Titles`, `_xlnm._FilterDatabase`) are read by the sheet
27514
+ * itself, not by formulas, and are never removed.
27515
+ *
27516
+ * One operation, so one undo puts every name back. Asked of a sheet's collection
27517
+ * (`IWorksheet.getNames()`), only the names scoped to that sheet are considered.
27518
+ */
27519
+ removeUnused(options?: INamedCollection.RemoveUnusedOptions): Promise<number>;
26997
27520
  /**
26998
27521
  * Lookup a named range with a given name.
26999
27522
  *
@@ -27133,6 +27656,23 @@ declare global {
27133
27656
  */
27134
27657
  includeHidden?: boolean;
27135
27658
  }
27659
+ /**
27660
+ * Options for {@link INamedCollection.removeUnused}.
27661
+ */
27662
+ interface RemoveUnusedOptions {
27663
+ /**
27664
+ * Only names flagged hidden — the ones a user cannot see to delete.
27665
+ *
27666
+ * @defaultValue false
27667
+ */
27668
+ hiddenOnly?: boolean;
27669
+ /**
27670
+ * Count the names that would be deleted, and delete none.
27671
+ *
27672
+ * @defaultValue false
27673
+ */
27674
+ dryRun?: boolean;
27675
+ }
27136
27676
  /**
27137
27677
  * Options for {@link INamedCollection.getByRanges}.
27138
27678
  *
@@ -31613,6 +32153,11 @@ declare global {
31613
32153
  * An optional name for the resource.
31614
32154
  */
31615
32155
  getName(): string | null;
32156
+ /**
32157
+ * The URL the bytes were fetched from, when the resource is a picture the workbook keeps for it
32158
+ * (an `IMAGE` source): a fetch of that URL answers from these bytes. `null` otherwise.
32159
+ */
32160
+ getFetchedFrom(): string | null;
31616
32161
  /**
31617
32162
  * For saving to json resources.
31618
32163
  */
@@ -31715,6 +32260,10 @@ declare global {
31715
32260
  * This is optional but if provided then resource lookup will use this as a cache key.
31716
32261
  */
31717
32262
  name?: string;
32263
+ /**
32264
+ * The URL the embedded bytes were fetched from: the workbook keeps them as that URL's picture.
32265
+ */
32266
+ fetchedFrom?: string;
31718
32267
  }
31719
32268
  }
31720
32269
 
@@ -31770,6 +32319,10 @@ declare global {
31770
32319
  * This is optional and purely for human consumption and is not used by the system.
31771
32320
  */
31772
32321
  name?: string;
32322
+ /**
32323
+ * The URL the bytes were fetched from, for a picture the workbook keeps for it.
32324
+ */
32325
+ fetchedFrom?: string;
31773
32326
  }
31774
32327
  /**
31775
32328
  * A type that represents the various ways to provide a resource source.
@@ -31825,14 +32378,20 @@ declare global {
31825
32378
  */
31826
32379
  export interface IRichData {
31827
32380
  /**
31828
- * Reference to either a known typename or a JSON Type Definition.
31829
- * * {@link https://jsontypedef.com/}
32381
+ * The value's kind: the properties it has and how they show. Every value of a kind returns the
32382
+ * same instance.
31830
32383
  */
31831
- getType(): string;
32384
+ getKind(): IRichType;
31832
32385
  /**
31833
32386
  * @param name The name of the property to retrieve.
31834
32387
  */
31835
32388
  getProperty(name: string): Scalar;
32389
+ /**
32390
+ * How the property `name` shows on this value: the value's own presentation where it differs
32391
+ * from its kind's (a price in another currency), else the kind's ({@link IRichType.Property.meta}).
32392
+ * `null`, or the method absent, for none.
32393
+ */
32394
+ getPropertyMeta?(name: string): IRichMeta | null;
31836
32395
  /**
31837
32396
  * The text shown for this value where nothing renders it: a client with no renderer for the
31838
32397
  * kind, a log, a placeholder. A rich text shows its text; an image a short description.
@@ -31844,23 +32403,26 @@ declare global {
31844
32403
  toString(): string;
31845
32404
  /**
31846
32405
  * The primitive this value reads as wherever one is consumed: `LEN`, `&`, `+`, comparison,
31847
- * `ISTEXT`, `TYPE()`, sort, filter, find. A rich text reads as its text; an image reads as
31848
- * nothing (`null`, or the method absent), and is `#VALUE!` wherever a primitive is needed.
32406
+ * `ISTEXT`, `TYPE()`, sort, filter, find. A rich text reads as its text; an error that carries
32407
+ * more than its code reads as that error; an image reads as nothing (`null`, or the method
32408
+ * absent), and is `#VALUE!` wherever a primitive is needed.
31849
32409
  *
31850
32410
  * @remarks
31851
- * The ordinary rules then apply to the primitive (text-to-number coercion, collation), so a
31852
- * value adds no coercions of its own.
32411
+ * The ordinary rules then apply to the primitive (text-to-number coercion, collation, error
32412
+ * propagation), so a value adds no coercions of its own.
31853
32413
  */
31854
- toPrimitive?(): number | string | boolean | null;
32414
+ toPrimitive?(): Exclude<Scalar, IRichData>;
31855
32415
  /**
31856
32416
  * The items this value unpacks to where a range or array is accepted (a list); `null`, or the
31857
32417
  * method absent, for a value that is one value.
31858
32418
  */
31859
32419
  toArray?(): Scalar[][] | null;
31860
32420
  /**
31861
- * Indicates this is an IRichData type.
32421
+ * The value as JSON, which its kind makes it again from. A value that holds a resource (a
32422
+ * picture's bytes) names it by the id `toResourceId` answers, and the file saves the resource;
32423
+ * without `toResourceId` it names none.
31862
32424
  */
31863
- toJSON?(): IRichData.JSON | Promise<IRichData.JSON>;
32425
+ toJSON?(toResourceId?: IRichData.ToResourceId): IRichData.JSON | Promise<IRichData.JSON>;
31864
32426
  /**
31865
32427
  * For runtime type checking.
31866
32428
  */
@@ -31868,31 +32430,224 @@ declare global {
31868
32430
  }
31869
32431
 
31870
32432
  export namespace IRichData {
32433
+ /**
32434
+ * The id a file being saved gives a resource a value holds (an `IResource`); `null` when the
32435
+ * file does not save it.
32436
+ */
32437
+ type ToResourceId = (resource: any) => number | null;
31871
32438
  interface JSON {
32439
+ /** The name of the value's kind ({@link IRichType.getName}). */
31872
32440
  type: string;
32441
+ /** The value's own data, as its kind reads it. */
31873
32442
  data?: any;
32443
+ /**
32444
+ * Presentation for the properties where this value differs from its kind, by property name.
32445
+ */
32446
+ meta?: {
32447
+ readonly [property: string]: IRichMeta;
32448
+ };
31874
32449
  }
31875
32450
  }
31876
32451
 
31877
32452
  /**
31878
- * A registered kind of rich data: its name, and how a value of it is made from its JSON.
32453
+ * The rich values a workbook's cells hold, interned: a cell run stores a rich value as its id here,
32454
+ * as it stores a string as its id in the string collection.
31879
32455
  *
31880
32456
  * @remarks
31881
- * A value's `getType()` is the kind's `name`. What a value reads as where a primitive or an array
31882
- * is consumed is the value's own answer ({@link IRichData.toPrimitive}, {@link IRichData.toArray}),
31883
- * as `toString()` is; the kind only makes values.
32457
+ * Equal values share one id (equal JSON; a resource counts by identity), so recalculating a
32458
+ * formula that makes a new but equal value adds nothing. Values are not removed: a save writes only
32459
+ * the ones a cell holds.
32460
+ */
32461
+ export interface IRichDataCollection extends ICollection<IRichData> {
32462
+ /**
32463
+ * The id of `value`, added when no equal value is here.
32464
+ *
32465
+ * @param value A rich value. Never an error: an error is stored by its code.
32466
+ */
32467
+ add(value: IRichData): number;
32468
+ /**
32469
+ * The value for an id, or `null` if not found.
32470
+ *
32471
+ * @param id The id {@link add} answered.
32472
+ */
32473
+ getById(id: number): IRichData | null;
32474
+ /**
32475
+ * Starts saving or loading the rich values cells name. Scopes begun while one is open share its
32476
+ * ids, so a workbook and its sheets agree on them.
32477
+ */
32478
+ beginPersist(): IRichDataCollection.IPersistScope;
32479
+ /** For runtime type checking. */
32480
+ readonly isIRichDataCollection: true;
32481
+ }
32482
+
32483
+ /**
32484
+ * {@inheritDoc IRichDataCollection}
32485
+ * @see
32486
+ * ### **Interface**
31884
32487
  *
31885
- * Register a kind with {@link RichDataRegistry.register}.
32488
+ * {@link IRichDataCollection}
31886
32489
  */
31887
- export interface IRichDataKind<T extends IRichData = IRichData> {
32490
+ export namespace IRichDataCollection {
32491
+ /** A saved rich value: its kind's JSON. */
32492
+ type JSON = IRichData.JSON;
31888
32493
  /**
31889
- * The kind's name, the `type` of its values and their JSON.
32494
+ * One save or load of the rich values cells name. Ids are positions in the saved table, not the
32495
+ * collection's own.
31890
32496
  */
31891
- readonly name: string;
32497
+ interface IPersistScope {
32498
+ /** The saved id of `value`, added to the table when new. */
32499
+ add(value: IRichData): number;
32500
+ /** The value a loaded id names, or `null`. */
32501
+ at(id: number): IRichData | null;
32502
+ /**
32503
+ * Loads a saved table: each entry made by its kind, its ids then answered by {@link at}.
32504
+ *
32505
+ * @param ctx What the values are made for: the workbook's resources, and the file's resource ids.
32506
+ * @param kinds The kinds saved with the table ({@link toKindsJSON}), made before the values
32507
+ * that name them.
32508
+ */
32509
+ fromJSON(json: readonly JSON[] | undefined, ctx: IRichDataKind.Context, kinds?: readonly IRichType.JSON[]): void;
32510
+ /**
32511
+ * The table, in id order.
32512
+ *
32513
+ * @param toResourceId The saved id of a resource a value holds.
32514
+ */
32515
+ toJSONAsync(toResourceId?: IRichData.ToResourceId): Promise<JSON[]>;
32516
+ /**
32517
+ * The kinds the table's values name, nested values included, that are not registered in code
32518
+ * and so are saved with it.
32519
+ */
32520
+ toKindsJSON(): IRichType.JSON[];
32521
+ /** Ends the scope. The last to end lets the table go. */
32522
+ endPersist(): void;
32523
+ }
32524
+ }
32525
+
32526
+ /**
32527
+ * A registered kind of rich data: the {@link IRichType} its values return from `getKind()`, and how
32528
+ * a value of it is made from its JSON.
32529
+ *
32530
+ * @remarks
32531
+ * What a value reads as where a primitive or an array is consumed is the value's own answer
32532
+ * ({@link IRichData.toPrimitive}, {@link IRichData.toArray}), as `toString()` is; the kind
32533
+ * describes values and makes them.
32534
+ *
32535
+ * Make one with {@link IRichDataKind.create}; register it with {@link RichDataRegistry.register}.
32536
+ */
32537
+ export interface IRichDataKind<T extends IRichData = IRichData> extends IRichType {
31892
32538
  /**
31893
32539
  * A value from its JSON, as {@link IRichData.toJSON} wrote it.
32540
+ *
32541
+ * @param ctx What the value is being made for. Every value is made here, whether it is loaded,
32542
+ * written with `setValue`, or returned by a function. `{ type }` alone asks for the kind's
32543
+ * default value, which is what a UI inserts.
32544
+ */
32545
+ fromJSON(json: IRichData.JSON, ctx: IRichDataKind.Context): T;
32546
+ }
32547
+
32548
+ export namespace IRichDataKind {
32549
+ /**
32550
+ * What a kind can reach while making a value.
31894
32551
  */
31895
- fromJSON(json: IRichData.JSON): T;
32552
+ interface Context {
32553
+ /**
32554
+ * Binary resources (image bytes) by id, the store pictures use. `null` when the value is
32555
+ * made outside a workbook, as an external link's cached values are.
32556
+ */
32557
+ readonly resources: IResourceCollection | null;
32558
+ /**
32559
+ * The string table the value's cells share. `null` outside a workbook.
32560
+ */
32561
+ readonly strings: IStringCollection | null;
32562
+ /**
32563
+ * The resource a value's JSON names by id, while a file is being read: the id
32564
+ * `IRichData.toJSON`'s `toResourceId` gave it. `null` for an id the file does not hold, and
32565
+ * always outside a read.
32566
+ */
32567
+ fromResourceId?(id: number): IResource | null;
32568
+ }
32569
+ /** A context with nothing to reach: a value made outside any workbook. */
32570
+ const DetachedContext: Context;
32571
+ /** What {@link create} makes a kind from. */
32572
+ interface Definition<T extends IRichData = IRichData> {
32573
+ /** {@inheritDoc IRichType.getName} */
32574
+ name: string;
32575
+ /** {@inheritDoc IRichType.getLabel} */
32576
+ label?: string;
32577
+ /** {@inheritDoc IRichType.getProperties} */
32578
+ properties?: readonly IRichType.Property[];
32579
+ /** {@inheritDoc IRichType.getDisplayProperty} */
32580
+ displayProperty?: string | null;
32581
+ /** {@inheritDoc IRichType.getMeta} */
32582
+ meta?: IRichMeta | null;
32583
+ /** {@inheritDoc IRichDataKind.fromJSON} */
32584
+ fromJSON(json: IRichData.JSON, ctx: Context): T;
32585
+ }
32586
+ /** A kind from its definition. The kind is immutable. */
32587
+ function create<T extends IRichData>(definition: Definition<T>): IRichDataKind<T>;
32588
+ }
32589
+
32590
+ /**
32591
+ * How a rich value, or one of its properties, is presented: the number format and caption of a
32592
+ * property, where it is offered, its sources; a kind's card, icon and provider.
32593
+ *
32594
+ * @remarks
32595
+ * Presentation only, never a value. A kind gives each of its properties a default; a value gives
32596
+ * one only for a property where it differs (a price in another currency).
32597
+ */
32598
+ export interface IRichMeta {
32599
+ /** The number format a number property shows in. */
32600
+ readonly numberFormat?: string;
32601
+ /** A short caption shown beside the property, such as its unit or the year of its data. */
32602
+ readonly sublabel?: string;
32603
+ /** Where the property is not offered. Each omitted entry is `false`. */
32604
+ readonly excludeFrom?: IRichMeta.ExcludeFrom;
32605
+ /** Where the property's data comes from and under what license. */
32606
+ readonly attribution?: readonly IRichMeta.Attribution[];
32607
+ /** A kind's card. */
32608
+ readonly card?: IRichMeta.Card;
32609
+ /** A kind's icon, by name. */
32610
+ readonly icon?: string;
32611
+ /** Who provides a kind's data. */
32612
+ readonly provider?: IRichMeta.Provider;
32613
+ }
32614
+
32615
+ export namespace IRichMeta {
32616
+ /** Where a property is not offered. */
32617
+ interface ExcludeFrom {
32618
+ /** Not shown on the card. */
32619
+ readonly cardView?: boolean;
32620
+ /** Not offered after `A1.` in a formula. */
32621
+ readonly dotNotation?: boolean;
32622
+ /** Not offered by formula autocomplete. */
32623
+ readonly autoComplete?: boolean;
32624
+ /** A change to the property is not a change to the value. */
32625
+ readonly calcCompare?: boolean;
32626
+ }
32627
+ /** One source of a property's data. */
32628
+ interface Attribution {
32629
+ readonly sourceText?: string;
32630
+ readonly sourceAddress?: string;
32631
+ readonly licenseText?: string;
32632
+ readonly licenseAddress?: string;
32633
+ }
32634
+ /** A kind's card: which properties it shows, and how. */
32635
+ interface Card {
32636
+ /** The properties shown, in order. Omitted, the kind's order. */
32637
+ readonly order?: readonly string[];
32638
+ /** The property shown as the title. */
32639
+ readonly title?: string;
32640
+ /** The property shown under the title. */
32641
+ readonly subTitle?: string;
32642
+ /** The image property shown at the top. */
32643
+ readonly mainImage?: string;
32644
+ }
32645
+ /** Who provides a kind's data. */
32646
+ interface Provider {
32647
+ readonly description?: string;
32648
+ readonly logoSourceAddress?: string;
32649
+ readonly logoTargetAddress?: string;
32650
+ }
31896
32651
  }
31897
32652
 
31898
32653
  /**
@@ -31944,6 +32699,84 @@ declare global {
31944
32699
  } | readonly RunUpdate[] | string;
31945
32700
  }
31946
32701
 
32702
+ /**
32703
+ * The kind of a rich value: its class. A kind is a static set of typed property definitions, and
32704
+ * every value of a kind shares the one `IRichType` its {@link IRichData.getKind} returns.
32705
+ *
32706
+ * @remarks
32707
+ * For introspection: a renderer, a card, a formula editor offering `A1.` completions, or a
32708
+ * function reading a field asks the value's kind which properties it has. What a value reads as
32709
+ * where a primitive is consumed is the value's own answer ({@link IRichData.toPrimitive}).
32710
+ */
32711
+ export interface IRichType {
32712
+ /**
32713
+ * The kind's name: what a value's JSON names as its `type`.
32714
+ */
32715
+ getName(): string;
32716
+ /**
32717
+ * The name a UI shows for the kind, such as in a list of what can be inserted. The name when the
32718
+ * kind has no label of its own.
32719
+ */
32720
+ getLabel(): string;
32721
+ /**
32722
+ * The kind's properties, in the order the kind declares them.
32723
+ */
32724
+ getProperties(): readonly IRichType.Property[];
32725
+ /**
32726
+ * The property `name`, or `null` when the kind has none by that name.
32727
+ */
32728
+ getProperty(name: string): IRichType.Property | null;
32729
+ /**
32730
+ * The property whose value is the text a cell shows for a value of this kind, or `null` when
32731
+ * the kind shows none (an image).
32732
+ */
32733
+ getDisplayProperty(): string | null;
32734
+ /**
32735
+ * The kind's own presentation (a card, an icon, a provider), or `null` for none.
32736
+ */
32737
+ getMeta(): IRichMeta | null;
32738
+ }
32739
+
32740
+ export namespace IRichType {
32741
+ /**
32742
+ * What a property holds.
32743
+ *
32744
+ * @remarks
32745
+ * `rich` is another rich value (a capital city, an image); `array` is an array value; `resource`
32746
+ * is a workbook resource such as a picture's bytes.
32747
+ */
32748
+ type ValueType = 'number' | 'integer' | 'string' | 'boolean' | 'error' | 'rich' | 'array' | 'resource';
32749
+ /**
32750
+ * One property a kind declares.
32751
+ */
32752
+ interface Property {
32753
+ /** The property's name. */
32754
+ readonly name: string;
32755
+ /** What it holds. */
32756
+ readonly valueType: ValueType;
32757
+ /** What it reads as on a value that holds none. Omitted, `null`. */
32758
+ readonly defaultValue?: Scalar;
32759
+ /** How the property shows, unless a value says otherwise. */
32760
+ readonly meta?: IRichMeta;
32761
+ }
32762
+ /**
32763
+ * A kind saved with the workbook whose values name it: one that is not registered in code, such
32764
+ * as a kind read from a file.
32765
+ */
32766
+ interface JSON {
32767
+ /** {@inheritDoc IRichType.getName} */
32768
+ name: string;
32769
+ /** {@inheritDoc IRichType.getLabel} */
32770
+ label?: string;
32771
+ /** {@inheritDoc IRichType.getProperties} */
32772
+ properties?: readonly Property[];
32773
+ /** {@inheritDoc IRichType.getDisplayProperty} */
32774
+ displayProperty?: string | null;
32775
+ /** {@inheritDoc IRichType.getMeta} */
32776
+ meta?: IRichMeta;
32777
+ }
32778
+ }
32779
+
31947
32780
  /**
31948
32781
  * Describes the host environment the calculation engine is running in.
31949
32782
  *
@@ -39082,6 +39915,34 @@ declare global {
39082
39915
  * Returns the current shared resources.
39083
39916
  */
39084
39917
  getResources(): IResourceCollection;
39918
+ /**
39919
+ * The fetcher the workbook reaches outside itself with: the handlers per URL scheme a host
39920
+ * registered, given as {@link IWorkbook.ConstructorOptions.fetcher}.
39921
+ */
39922
+ getFetcher(): IFetcher;
39923
+ /**
39924
+ * Fetches as the workbook does, with the standard `fetch` signature: what `IMAGE`, a web
39925
+ * service function, and a renderer drawing a picture use.
39926
+ *
39927
+ * @remarks
39928
+ * A resource with a `fetchedFrom` is the workbook's copy of that URL, and answers a fetch of it
39929
+ * without a request. Anything else goes to {@link getFetcher}. The fetch saves nothing itself: a
39930
+ * successful answer to a plain GET that is not a picture is cached until the workbook closes and
39931
+ * answers later fetches of that URL. A response whose bytes are a picture says what they are,
39932
+ * whatever the server called them. Plain GETs of one URL in flight together share one request;
39933
+ * aborting one caller's signal does not stop it for the others. `cache: 'reload'` skips all of
39934
+ * these and asks the source.
39935
+ *
39936
+ * The workbook saves a resource while a value holds it: `IMAGE` adds the picture it fetched for
39937
+ * its values. A picture of the host's own goes in a cell the same way, under a URL the host mints:
39938
+ *
39939
+ * ```ts
39940
+ * const source = `resource:${crypto.randomUUID()}`;
39941
+ * const resource = workbook.getResources().add({ source: { buffer: bytes }, fetchedFrom: source });
39942
+ * workbook.getRange('A1').setValue({ type: 'image', data: { source, resource } });
39943
+ * ```
39944
+ */
39945
+ fetch(input: string, init?: RequestInit): Promise<Response>;
39085
39946
  /**
39086
39947
  * Returns the current shared resources.
39087
39948
  */
@@ -39705,6 +40566,10 @@ declare global {
39705
40566
  styles?: IStyleCollection.JSON;
39706
40567
  resources?: IResource.JSON[];
39707
40568
  strings?: string[];
40569
+ /** The rich values cells name by id (`{ t: 'r', v: id }`). */
40570
+ richData?: IRichDataCollection.JSON[];
40571
+ /** The kinds {@link richData} names that are not registered in code (a kind read from a file). */
40572
+ richTypes?: IRichType.JSON[];
39708
40573
  /**
39709
40574
  * The people the workbook knows.
39710
40575
  *
@@ -39825,6 +40690,11 @@ declare global {
39825
40690
  * A theme for the workbook.
39826
40691
  */
39827
40692
  theme?: ITheme;
40693
+ /**
40694
+ * How the workbook reaches outside itself: the handlers per URL scheme, with the host's
40695
+ * authentication. Omitted, a {@link Fetcher} for `http:` and `https:`.
40696
+ */
40697
+ fetcher?: IFetcher;
39828
40698
  /**
39829
40699
  * Load from JSON.
39830
40700
  */
@@ -41796,6 +42666,14 @@ declare global {
41796
42666
  * {@link IWorksheetProtection.isLocked} is true.
41797
42667
  */
41798
42668
  getProtectedRanges(): IProtectedRangeCollection;
42669
+ /**
42670
+ * Returns the cell controls on this sheet, such as checkboxes.
42671
+ *
42672
+ * @remarks
42673
+ * Every entry, in drawing order. To put a control on cells or read what is there, use
42674
+ * {@link ICellRange.setControl} and {@link ICellRange.getControls}.
42675
+ */
42676
+ getCellControls(): ICellControlCollection;
41799
42677
  /**
41800
42678
  * Returns the comments and notes on this sheet.
41801
42679
  *
@@ -42253,14 +43131,6 @@ declare global {
42253
43131
  * workbook's {@link IWorkbook.getPivotTables} walks every sheet's.
42254
43132
  */
42255
43133
  getPivotTables(): IPivotTableCollection;
42256
- /**
42257
- * Returns the what-if data tables on this sheet, in the order they were read.
42258
- *
42259
- * @remarks
42260
- * Read-only for now: each table is carried as it was read, its results as the file held them.
42261
- * As in Excel, an edit to part of a table's results is refused.
42262
- */
42263
- getDataTables(): IDataTableCollection;
42264
43134
  /**
42265
43135
  * Set the picture interface for the entire sheet.
42266
43136
  * @param picture The picture interface to set for the sheet, or null to remove it.
@@ -42553,6 +43423,13 @@ declare global {
42553
43423
  * Always accompanied by the coarse {@link onProtectionChange}.
42554
43424
  */
42555
43425
  onProtectedRangesChange?(source: IWorksheet): void;
43426
+ /**
43427
+ * Called when a cell control is added, removed, re-anchored or reordered.
43428
+ *
43429
+ * @remarks
43430
+ * Always accompanied by the coarse {@link onStyleChange}: a control is a format.
43431
+ */
43432
+ onCellControlsChange?(source: IWorksheet): void;
42556
43433
  /**
42557
43434
  * Called when a comment is added, removed, edited, resolved, replied to or re-anchored.
42558
43435
  *
@@ -42917,7 +43794,7 @@ declare global {
42917
43794
  * JSON representation of an `IWorksheet` used for serialization and deserialization.
42918
43795
  */
42919
43796
  interface JSON extends ISheet.JSON {
42920
- data?: Tuple.GridTuple<ICell.JSON>;
43797
+ data?: Tuple.GridTuple<Scalar.JSON>;
42921
43798
  formulas?: IRange.JSONReferenceTuple<string>[];
42922
43799
  /**
42923
43800
  * The extent occupied by an array formula, and which of the three
@@ -42954,6 +43831,10 @@ declare global {
42954
43831
  styles?: IStyleCollection.JSON;
42955
43832
  resources?: IResource.JSON[];
42956
43833
  strings?: string[];
43834
+ /** The rich values cells name by id (`{ t: 'r', v: id }`), when the sheet owns its own. */
43835
+ richData?: IRichDataCollection.JSON[];
43836
+ /** The kinds {@link richData} names that are not registered in code (a kind read from a file). */
43837
+ richTypes?: IRichType.JSON[];
42957
43838
  /**
42958
43839
  * Modules owned by this sheet, keyed by module name.
42959
43840
  *
@@ -42995,6 +43876,7 @@ declare global {
42995
43876
  */
42996
43877
  validationSettings?: IDataValidationCollection.Settings;
42997
43878
  protectedRanges?: IRange.JSONReference<IProtectedRange.JSON>[];
43879
+ cellControls?: IRange.JSONReference<ICellControl.JSON>[];
42998
43880
  movables?: IMovable.JSON[];
42999
43881
  /**
43000
43882
  * The sheet's VBA code name. Absent when it has none.
@@ -43052,12 +43934,6 @@ declare global {
43052
43934
  * @see {@link IWorksheet.getPivotTables}
43053
43935
  */
43054
43936
  pivotTables?: IPivotTable.JSON[];
43055
- /**
43056
- * The sheet's what-if data tables.
43057
- *
43058
- * @see {@link IWorksheet.getDataTables}
43059
- */
43060
- dataTables?: IDataTable.JSON[];
43061
43937
  /**
43062
43938
  * The cells where Excel's error checks are ignored (the green triangle's **Ignore Error**):
43063
43939
  * each reference's value is the set of checks its cells ignore.
@@ -46229,9 +47105,12 @@ declare global {
46229
47105
  chartEx?: boolean;
46230
47106
  /** The chart's own text font: what text with no font of its own is drawn in. */
46231
47107
  font: ResolvedChart.Font;
46232
- /** `cornerRadius` in points: 0 for square corners. */
47108
+ /**
47109
+ * `fill` is `undefined` where the chart states none: it is drawn in the background of where it is
47110
+ * drawn. `cornerRadius` in points: 0 for square corners.
47111
+ */
46233
47112
  chartArea: {
46234
- fill: IFill.JSON | null;
47113
+ fill: IFill.JSON | null | undefined;
46235
47114
  border: ResolvedChart.Stroke | null;
46236
47115
  cornerRadius: number;
46237
47116
  };
@@ -46838,7 +47717,7 @@ declare global {
46838
47717
  }
46839
47718
 
46840
47719
  /**
46841
- * The kinds of rich data a cell can hold, by name.
47720
+ * The kinds of rich data a cell can hold, by type.
46842
47721
  *
46843
47722
  * @remarks
46844
47723
  * A value is made from its JSON by looking its `type` up here; what a value reads as where a
@@ -46849,27 +47728,54 @@ declare global {
46849
47728
  */
46850
47729
  export namespace RichDataRegistry {
46851
47730
  /**
46852
- * Registers a kind. A kind registered again under the same name replaces the earlier one.
47731
+ * Registers a kind. A kind registered again under the same name replaces the earlier one,
47732
+ * a built-in included.
46853
47733
  */
46854
47734
  function register(kind: IRichDataKind<any>): void;
46855
- /** The kind registered as `name`, or `null`. */
46856
- function get(name: string): IRichDataKind | null;
46857
- /** The kind of `value`, or `null` when its type is not registered. */
47735
+ /**
47736
+ * The kind named `type`: registered, or defined ({@link RichRecord.defineKind}); `null` when
47737
+ * there is none.
47738
+ */
47739
+ function get(type: string): IRichDataKind | null;
47740
+ /** The kind of `value`, registered or defined, or `null` when it is neither. */
46858
47741
  function kindOf(value: IRichData): IRichDataKind | null;
46859
- /** The registered names. */
46860
- function getNames(): string[];
47742
+ /** The names of the registered kinds. */
47743
+ function getTypes(): string[];
46861
47744
  /**
46862
47745
  * A value from its JSON: the registered kind's, or an {@link Unmodeled} one carrying the JSON.
47746
+ *
47747
+ * @param ctx What the value is made for; omitted, a value made outside any workbook.
46863
47748
  */
46864
- function fromJSON(json: IRichData.JSON): IRichData;
47749
+ function fromJSON(json: IRichData.JSON, ctx?: IRichDataKind.Context): IRichData;
47750
+ /**
47751
+ * Whether `value` is the JSON of a rich value (`{ type, data? }`), as `setValue` accepts it
47752
+ * in place of the value.
47753
+ */
47754
+ function isJSON(value: unknown): value is IRichData.JSON;
46865
47755
  /**
46866
47756
  * What `value` reads as where a primitive is consumed ({@link IRichData.toPrimitive}), or
46867
47757
  * `undefined` when it reads as nothing.
46868
47758
  */
46869
- function toPrimitive(value: IRichData): number | string | boolean | undefined;
47759
+ function toPrimitive(value: IRichData): Exclude<Scalar, IRichData | null> | undefined;
46870
47760
  /**
46871
- * The `ScalarType` of what `value` reads as: `String`, `Number` or `Boolean` for a kind with a
46872
- * primitive, `RichData` otherwise.
47761
+ * The text `value` shows in a cell when it reads as no primitive: the value of its kind's
47762
+ * display property ({@link IRichType.getDisplayProperty}), or `null` when the kind names none or
47763
+ * the value holds no text there.
47764
+ *
47765
+ * @remarks
47766
+ * Display only: the value still reads as nothing to calculation.
47767
+ */
47768
+ function toDisplayText(value: IRichData): string | null;
47769
+ /**
47770
+ * The `ScalarType` `value` lays out as in a cell: its primitive's when it has one (a hyperlink
47771
+ * named by a number is a number); `String` when it reads as nothing but shows text (an entity's
47772
+ * display string), so it aligns left and spills into empty neighbors; `RichData` when it shows
47773
+ * no text (a picture).
47774
+ */
47775
+ function layoutTypeOf(value: IRichData): ScalarType;
47776
+ /**
47777
+ * The `ScalarType` of what `value` reads as: `String`, `Number`, `Boolean` or `Error` for a
47778
+ * kind with a primitive, `RichData` otherwise.
46873
47779
  */
46874
47780
  function primitiveTypeOf(value: IRichData): ScalarType;
46875
47781
  /**
@@ -46878,12 +47784,16 @@ declare global {
46878
47784
  */
46879
47785
  function toArray(value: IRichData): Scalar[][] | null;
46880
47786
  /**
46881
- * A value whose type nobody has registered: it carries its JSON as it was read and reads as
47787
+ * A value whose kind nobody has registered: it carries its JSON as it was read and reads as
46882
47788
  * nothing, so a workbook that holds one saves it unchanged.
47789
+ *
47790
+ * @remarks
47791
+ * Its kind is made from what it holds: named by its JSON's `type`, with a property for each
47792
+ * entry of its data.
46883
47793
  */
46884
47794
  class Unmodeled implements IRichData {
46885
47795
  constructor(json: IRichData.JSON);
46886
- getType(): string;
47796
+ getKind(): IRichType;
46887
47797
  getProperty(name: string): Scalar;
46888
47798
  toString(): string;
46889
47799
  toJSON(): IRichData.JSON;
@@ -46991,6 +47901,33 @@ declare global {
46991
47901
  * truncation, not rounding: `1234567890.123456789` stores `…345`, never `…346`.
46992
47902
  */
46993
47903
  function truncateNumberText(text: string): string;
47904
+ /**
47905
+ * Encodings of `ScalarType` for persistence.
47906
+ */
47907
+ type JSONType = 'n' | 's' | 'b' | 'e' | 'r' | 'z';
47908
+ /**
47909
+ * A value encoded as a number with an associated type.
47910
+ */
47911
+ interface JSONTypedValue {
47912
+ t: JSONType;
47913
+ /**
47914
+ * The number, string id, error code or boolean flag; for `'r'`, the rich data's own JSON
47915
+ * (`IRichData.JSON`), which its registered kind reads back.
47916
+ */
47917
+ v: number | IRichData.JSON;
47918
+ }
47919
+ /**
47920
+ * JSON values whose type is implied by their JavaScript type.
47921
+ *
47922
+ * @remarks
47923
+ * What a string means is up to the container: a worksheet stores the id of the string in its
47924
+ * strings collection, while an external link cache stores the string itself.
47925
+ */
47926
+ type JSONUnTypedValue = number | boolean | string;
47927
+ /**
47928
+ * For persisting a single scalar value and its type.
47929
+ */
47930
+ type JSON = JSONUnTypedValue | JSONTypedValue;
46994
47931
  }
46995
47932
 
46996
47933
  /**