@sheetxl/sdk 0.7.28-beta.2 → 0.7.28-beta.4

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 (64) hide show
  1. package/browser/cjs/{BREMLtxkQhtNSVra.cjs → BF14ZEAnaqxXroSj.cjs} +1 -1
  2. package/browser/cjs/{BG7YDVxiC4ErxvF1.cjs → BXtvdT1Z-MsB_o5F.cjs} +1 -1
  3. package/browser/cjs/Bc4JjVVZfFo3R4He.cjs +33 -0
  4. package/browser/cjs/{CQf4zxkBmheTVbjX.cjs → CD2RXdnfqSYNc6gX.cjs} +2 -2
  5. package/browser/cjs/DcLpXGexEtOxi-dD.cjs +1 -0
  6. package/browser/cjs/index.cjs +2 -2
  7. package/browser/esm/{DN4d5bDBkti28wuc.mjs → 0Mj5WKM362q6CECb.mjs} +213 -207
  8. package/browser/esm/{BxIOX1TojvA-1ZZP.mjs → CHSahmMFYNB0Ajkf.mjs} +2 -2
  9. package/browser/esm/{CZO1RubmqnJV96rq.mjs → CKk58ZLcrllMzfou.mjs} +2 -2
  10. package/browser/esm/{DRWu3TmcE9JFf78V.mjs → CPTtL2f6_4iblmFM.mjs} +2 -2
  11. package/browser/esm/{DPOelA1J3WHbMXyh.mjs → CoA-sUxjiIUIpTUF.mjs} +2 -2
  12. package/browser/esm/{vHWuKF-ftK7LM1uw.mjs → DBIu6NUHIcxOOBQp.mjs} +1 -1
  13. package/browser/esm/{CB_4gdPPPruwremH.mjs → Dy4Sdpju1T2icURu.mjs} +4748 -3883
  14. package/browser/esm/index.mjs +419 -411
  15. package/node/esm/{XQhP3dYwF_tEuswB.mjs → BtGxbEbBm79YvF_k.mjs} +303 -297
  16. package/node/esm/{B-tgcZihStNV9CbZ.mjs → DUYP6faJJHCaW1Xf.mjs} +1 -1
  17. package/node/esm/{C8tfYGL3wHy9IDDc.mjs → DqgWsVXROpSgKq6c.mjs} +2 -2
  18. package/node/esm/index.mjs +8686 -7802
  19. package/package.json +6 -6
  20. package/resources/locales/de/model.msg.json +12 -0
  21. package/resources/locales/en/model.msg.json +12 -0
  22. package/types/scripting-enums.json +2 -0
  23. package/types/scripting.d.ts +341 -15
  24. package/types/src/anchored/IAnchored.d.ts +27 -0
  25. package/types/src/calculation/Calculation.d.ts +21 -12
  26. package/types/src/calculation/ICalculation.d.ts +183 -0
  27. package/types/src/calculation/compiler/CompilerUtils.d.ts +20 -0
  28. package/types/src/calculation/compiler/FormulaParser.d.ts +32 -6
  29. package/types/src/calculation/executor/CalcExecutor.d.ts +204 -13
  30. package/types/src/calculation/executor/CalcExecutorUtils.d.ts +31 -0
  31. package/types/src/calculation/executor/CircularReference.d.ts +81 -0
  32. package/types/src/calculation/functions/Operators.d.ts +1 -1
  33. package/types/src/calculation/grid/CalcGrid.d.ts +5 -1
  34. package/types/src/calculation/grid/CalcGridUtils.d.ts +3 -2
  35. package/types/src/calculation/grid/ICalcGrid.d.ts +23 -1
  36. package/types/src/calculation/spatial/CircularEntry.d.ts +18 -0
  37. package/types/src/calculation/spatial/index.d.ts +1 -0
  38. package/types/src/calculation/state/CalcNode.d.ts +24 -17
  39. package/types/src/calculation/state/CalcState.d.ts +78 -15
  40. package/types/src/calculation/state/CalculationContext.d.ts +39 -0
  41. package/types/src/calculation/state/_ReadObservedGrid.d.ts +90 -0
  42. package/types/src/cell/ICell.d.ts +16 -0
  43. package/types/src/cellRange/ICellRange.d.ts +72 -6
  44. package/types/src/condition/AnchoredConditional.d.ts +26 -6
  45. package/types/src/conditionalFormat/ConditionalFormat.d.ts +8 -1
  46. package/types/src/conditionalFormat/IConditionalFormat.d.ts +4 -1
  47. package/types/src/conditionalFormat/IConditionalFormatCollection.d.ts +6 -2
  48. package/types/src/dataValidation/IDataValidationCollection.d.ts +6 -2
  49. package/types/src/hyperlink/IHyperlink.d.ts +3 -1
  50. package/types/src/hyperlink/_Hyperlink.d.ts +6 -0
  51. package/types/src/lib/utils/utils.browser.d.ts +5 -0
  52. package/types/src/license/LicenseDetails.d.ts +5 -0
  53. package/types/src/primitives/CalcSignal.d.ts +20 -0
  54. package/types/src/protectedRange/IProtectedRangeCollection.d.ts +7 -2
  55. package/types/src/scripting/_ScriptUtils.d.ts +13 -0
  56. package/types/src/sheet/Sheet.d.ts +33 -2
  57. package/types/src/sheet/SheetCell.d.ts +2 -0
  58. package/types/src/sheet/SheetRange.d.ts +12 -1
  59. package/types/src/sheet/_SheetStateTypes.d.ts +14 -1
  60. package/types/src/style/IStyle.d.ts +5 -0
  61. package/types/src/table/AnchoredTable.d.ts +17 -1
  62. package/types/src/text/TextUtils.d.ts +18 -0
  63. package/browser/cjs/DoemwsUQoGCk0vBK.cjs +0 -33
  64. package/browser/cjs/_c2uwwpr03Y7lzIj.cjs +0 -1
@@ -246,11 +246,24 @@ export interface ICellRange {
246
246
  * Returns a range that includes the current range up to a content edge boundary.
247
247
  *
248
248
  * @param direction The direction.
249
- * @param cell The cell to use as a starting point.
250
- * If not provide the cell closest to the edge will be used.
249
+ * @param cell Either the cell to walk from — as {@link ICellRange.GetExtendedOptions.cell}, and
250
+ * the positional form Office Scripts' `getExtendedRange` takes — or the full
251
+ * {@link ICellRange.GetExtendedOptions}. If neither is given the cell closest to
252
+ * the edge is used.
251
253
  * @returns `ICellRange` extended in the given direction.
254
+ *
255
+ * @remarks
256
+ * The result **includes** the current range, and a boundary with nowhere to go returns the range
257
+ * unchanged — so comparing the two is how you tell there was nothing to extend onto.
258
+ *
259
+ * {@link ICellRange.GetExtendedOptions.basis} picks what the boundary is read from: the range's
260
+ * own content (Ctrl+Arrow, the default) or the lines flanking it (a double-clicked fill handle).
261
+ *
262
+ * Both bases read the content, merge and table indexes rather than walking cells, so the cost is
263
+ * the blocks involved and not the distance traveled — extending across a million rows costs what
264
+ * extending across ten does.
252
265
  */
253
- getExtended(direction: IRange.Direction, cell?: ICell.Address): this;
266
+ getExtended(direction: IRange.Direction, cell?: ICell.Address | ICellRange.GetExtendedOptions): this;
254
267
  /**
255
268
  * Returns a range with coordinates adjusted to be fixed (absolute) or flexible (relative).
256
269
  *
@@ -1391,6 +1404,50 @@ export declare namespace ICellRange {
1391
1404
  */
1392
1405
  colEnd?: boolean;
1393
1406
  }
1407
+ /**
1408
+ * Options for {@link ICellRange.getExtended}.
1409
+ */
1410
+ interface GetExtendedOptions {
1411
+ /**
1412
+ * The cell to walk from. Only `'content'` extends from a cell — the flanking lines a
1413
+ * `'adjacent'` extension reads are fixed by the range's own edges — so this is ignored there.
1414
+ *
1415
+ * @defaultValue the cell of the range closest to the edge being extended toward.
1416
+ */
1417
+ cell?: ICell.Address;
1418
+ /**
1419
+ * What the content edge is read from.
1420
+ *
1421
+ * - `'content'` — the range's own content, walked from {@link cell}. This is Ctrl+Arrow: it
1422
+ * runs to the end of the block it is in, or from a blank onto the next block.
1423
+ * - `'adjacent'` — the two lines flanking the range on the cross axis (for a downward
1424
+ * extension, the column left of the left edge and the column right of the right edge). Each
1425
+ * contributes its contiguous run measured from the line the extension would start on, and
1426
+ * the **further** of the two wins; a flank that starts blank contributes nothing, which is
1427
+ * why a spacer column stops the extension dead. The reach is then cut short **before** the
1428
+ * nearest populated line inside the range's own columns, so an existing block is not run
1429
+ * over. This is the destination Excel picks when the fill handle is double-clicked, and it
1430
+ * feeds {@link ICellRange.autoFill} directly.
1431
+ *
1432
+ * @defaultValue 'content'
1433
+ */
1434
+ basis?: 'content' | 'adjacent';
1435
+ /**
1436
+ * Where a walk that begins on a **blank** cell comes to rest.
1437
+ *
1438
+ * - `'enter'` — on the first cell of the block it runs into. This is Ctrl+Arrow.
1439
+ * - `'before'` — on the last blank, one short of that block. This is what a double-clicked
1440
+ * selection border does.
1441
+ *
1442
+ * Blanks are the *only* thing this changes: from a populated cell both run to the end of that
1443
+ * cell's own block and stop in the same place. It is also independent of {@link basis} — that
1444
+ * says where the boundary is read from, this says what happens on the way — though `'adjacent'`
1445
+ * has nothing to apply it to, since a blank flank contributes no reach in the first place.
1446
+ *
1447
+ * @defaultValue 'enter'
1448
+ */
1449
+ fromBlank?: 'enter' | 'before';
1450
+ }
1394
1451
  /**
1395
1452
  * Options for {@link ICellRange.getSurrounding}.
1396
1453
  */
@@ -2134,11 +2191,20 @@ export declare namespace ICellRange {
2134
2191
  /** Cells inside a dynamic-array spill zone. Writing into one is a real failure mode. */
2135
2192
  readonly Spills: "spills";
2136
2193
  /**
2137
- * Evaluated state: cells whose calculation itself failed — mostly circular references.
2138
- * Distinct from {@link Feature.Error}: `#DIV/0!` is a successfully calculated error VALUE
2139
- * (the `Error` kind); `CalcError` is the engine failing to evaluate at all.
2194
+ * Evaluated state: cells whose calculation itself failed. Distinct from
2195
+ * {@link Feature.Error}: `#DIV/0!` is a successfully calculated error VALUE (the `Error`
2196
+ * kind); `CalcError` is the engine failing to evaluate at all. A reference cycle is not a
2197
+ * failure — its cells evaluate, to `0` — and is {@link Feature.Circular}.
2140
2198
  */
2141
2199
  readonly CalcError: "calcError";
2200
+ /**
2201
+ * Evaluated state: cells in a reference cycle, or downstream of one. Both evaluate to `0`
2202
+ * (Excel, iterative calculation off) with nothing else to show for it — this is the marker.
2203
+ * Regions group by cycle and by kind (`member` | `downstream`), so a block that reads one bad
2204
+ * cell is ONE region, and each region's payload is the cycle itself
2205
+ * (`ICalculation.ICircularReference` — members, counts, whether iteration settled it).
2206
+ */
2207
+ readonly Circular: "circular";
2142
2208
  /** Direct fill. */
2143
2209
  readonly Fill: "fill";
2144
2210
  /** Direct borders. */
@@ -163,21 +163,41 @@ export declare abstract class AnchoredConditional<STATE extends AnchoredConditio
163
163
  protected _rebaseConditionFormulas(json: any, from: IRange.CellCoords, to: IRange.CellCoords): boolean | null;
164
164
  /**
165
165
  * The extend half of a paste: fold the pasted `ranges` into THIS live rule — coalescing
166
- * into clean rectangles where the union is exact — rather than minting a duplicate.
166
+ * into one clean rectangle — rather than minting a duplicate.
167
167
  *
168
168
  * @param ranges The pasted images of the rule's marked areas (already tiled/clipped).
169
169
  * @param jsonAtMark `JSON.stringify` of the rule's `toJSON()` at mark time.
170
- * @returns `false` when this rule can no longer absorb the paste — deleted, or its
171
- * definition changed since the mark — and the caller must clone instead.
170
+ * @returns `false` when this rule cannot absorb the paste — deleted, its definition changed
171
+ * since the mark, or the union would move the anchor — and the caller must clone instead.
172
172
  *
173
173
  * @remarks
174
174
  * Merging is provenance-keyed: only THE rule the areas were copied from extends, which is
175
- * what keeps manually authored duplicates separate. When coalescing would move the anchor
176
- * cell (first range's top-left), formulas rebase ({@link _rebaseAnchorFormulas}); if the
177
- * rebase refuses, the new cells append as separate areas so the anchor stays put.
175
+ * what keeps manually authored duplicates separate.
176
+ *
177
+ * On top of provenance, a paste merges only when the union is a single rectangle whose
178
+ * top-left is still the rule's anchor. That is Excel's rule (desktop and online alike): a
179
+ * paste flush below or to the right of the applies-to merges into it, while one above, to
180
+ * the left, or with a gap mints a separate rule at top priority. The shape of it is that
181
+ * PASTE NEVER MOVES THE ANCHOR — growing down or right leaves the stored formula's frame
182
+ * alone, whereas growing up or left forces a rebase, which Excel is only willing to do for
183
+ * autofill. Hence fill merges in all four directions and paste in two.
178
184
  * @internal
179
185
  */
180
186
  _extendPastedRanges(ranges: readonly IRange.Coords[], jsonAtMark: string): boolean;
187
+ /**
188
+ * Re-anchors a freshly pasted CLONE, whose formulas still carry the SOURCE rule's frame, to
189
+ * its own anchor — the shift Excel applies when a copied rule lands as a new rule (copying
190
+ * `F5:F10`/`G5>5` to `F20` stores `G20>5`).
191
+ *
192
+ * The shift is source-anchor to clone-anchor; the hop through the copied cell cancels, since
193
+ * relative offsets are preserved by both halves of it.
194
+ *
195
+ * A rebase that cannot survive the move leaves the formulas as authored — the wrong frame,
196
+ * but live, which beats a rule of `#REF!`. Excel never hits this: it wraps modulo the sheet
197
+ * instead, the same divergence the io layer converts across.
198
+ * @internal
199
+ */
200
+ _rebaseClonedAnchor(anchorFrom: IRange.Coords): void;
181
201
  /**
182
202
  * The geometry half of {@link _extendPastedRanges}, shared with autofill (which needs no
183
203
  * liveness or definition guards — the rule was read live inside the fill's transaction):
@@ -134,7 +134,14 @@ export declare class ConditionalFormat extends AnchoredConditional<State, Commit
134
134
  /** @internal */
135
135
  protected _createSpatial(coords: IRange.Coords): ISpatialMap.IUpdatableValue;
136
136
  /** {@inheritDoc IConditionalFormat.update} */
137
- update(properties: IConditionalFormat.Modifiers, options?: ITransaction.OperationOptions): this;
137
+ update(properties: IConditionalFormat.Modifiers | IConditionalFormat, options?: ITransaction.OperationOptions): this;
138
+ /**
139
+ * The modifiers that make one rule's definition another's: every mutually-exclusive key is
140
+ * named, so the target's old shape (`scale` vs `condition`+`style`) is cleared rather than
141
+ * merged with.
142
+ * @internal
143
+ */
144
+ static replaceModifiers(json: IConditionalFormat.JSON | null): IConditionalFormat.Modifiers;
138
145
  /** {@inheritDoc IConditionalFormat.toJSON} */
139
146
  toJSON(): IConditionalFormat.JSON | null;
140
147
  /** @internal */
@@ -123,8 +123,11 @@ export interface IConditionalFormat extends IAnchored, ICondition.Stateful, IPro
123
123
  * Only the keys named are touched. An explicit `null` **clears** a key — required when switching
124
124
  * a rule between its two shapes, since `condition`+`style` and `scale` are mutually exclusive
125
125
  * (setting one side also clears the other unless the caller named both).
126
+ *
127
+ * Passing another rule takes its whole definition — every key, cleared where the other rule
128
+ * has none — so the shape switches with it. The anchor is not part of it.
126
129
  */
127
- update(properties: IConditionalFormat.Modifiers, options?: ITransaction.OperationOptions): this;
130
+ update(properties: IConditionalFormat.Modifiers | IConditionalFormat, options?: ITransaction.OperationOptions): this;
128
131
  /**
129
132
  * Returns a snapshot of the conditional that can be used for copying and archiving.
130
133
  */
@@ -1,7 +1,7 @@
1
1
  import { ICellRange, ICellRanges } from '../cellRange';
2
2
  import { ICollection } from '../type';
3
+ import { IAnchored } from '../anchored';
3
4
  import { IConditionalFormat } from './IConditionalFormat';
4
- import { ITransaction } from '../transaction';
5
5
  /**
6
6
  * Holds a collection of {@link IConditionalFormat}s.
7
7
  */
@@ -38,8 +38,12 @@ export interface IConditionalFormatCollection extends ICollection<IConditionalFo
38
38
  export declare namespace IConditionalFormatCollection {
39
39
  /**
40
40
  * Options for adding a {@link IConditionalFormat}.
41
+ *
42
+ * @remarks
43
+ * `replaceExisting` redefines the rule at `index` only when it is a scale rule of the same
44
+ * kind on exactly the same ranges — see {@link IAnchored.AddOptions.replaceExisting}.
41
45
  */
42
- interface AddOptions extends IConditionalFormat.Properties, ITransaction.OperationOptions {
46
+ interface AddOptions extends IConditionalFormat.Properties, IAnchored.AddOptions {
43
47
  }
44
48
  /**
45
49
  * Options for searching for {@link IConditionalFormat}s.
@@ -1,6 +1,6 @@
1
- import { ITransaction } from '../transaction';
2
1
  import { ICollection } from '../type';
3
2
  import { ICellRange, ICellRanges } from '../cellRange';
3
+ import { IAnchored } from '../anchored';
4
4
  import { IDataValidation } from './IDataValidation';
5
5
  /**
6
6
  * Holds a collection of {@link IDataValidation}s.
@@ -38,8 +38,12 @@ export interface IDataValidationCollection extends ICollection<IDataValidation>
38
38
  export declare namespace IDataValidationCollection {
39
39
  /**
40
40
  * Options for adding a data validation to the collection.
41
+ *
42
+ * @remarks
43
+ * `replaceExisting` redefines the validation at `index` when it covers exactly the same ranges —
44
+ * see {@link IAnchored.AddOptions.replaceExisting}.
41
45
  */
42
- interface AddOptions extends IDataValidation.Properties, ITransaction.OperationOptions {
46
+ interface AddOptions extends IDataValidation.Properties, IAnchored.AddOptions {
43
47
  }
44
48
  interface GetItemsOptions {
45
49
  /**
@@ -49,7 +49,9 @@ export interface IHyperlink {
49
49
  * @remarks
50
50
  * This has no counterpart in Excel; it is ours and applies to links opened in a browser.
51
51
  *
52
- * @defaultValue `_self` for a location within this workbook, otherwise `_blank`.
52
+ * @defaultValue `_self` for a location within this workbook or a `mailto:`/`tel:`/`sms:`
53
+ * address (handled by another application, so there is nothing to show in a new tab),
54
+ * otherwise `_blank`.
53
55
  */
54
56
  getTarget(): string;
55
57
  /**
@@ -1,5 +1,11 @@
1
1
  import { ITypes } from '../type';
2
2
  import { IHyperlink } from './IHyperlink';
3
+ /**
4
+ * `true` for an address the browser hands to another application (`mailto:`, `tel:`, `sms:`)
5
+ * rather than rendering.
6
+ * @internal
7
+ */
8
+ export declare const isHandlerScheme: (address: string) => boolean;
3
9
  export declare class Hyperlink implements IHyperlink {
4
10
  protected _t: () => string;
5
11
  protected _p: IHyperlink.Properties;
@@ -1,6 +1,11 @@
1
1
  import { HostDetails } from './_Utils';
2
2
  import { LicenseDetails } from '../../license';
3
3
  export declare function getHostDetails(): Promise<HostDetails>;
4
+ /**
5
+ * Only the loopback host is a dev environment. A dev *build* served on any other host (a LAN IP,
6
+ * a tunnel) is checked exactly like production: license domains apply and an evaluation shows
7
+ * the watermark.
8
+ */
4
9
  export declare function isDevEnv(): Promise<boolean>;
5
10
  /**
6
11
  * The runtime location - the current page url in the browser.
@@ -8,6 +8,11 @@ export interface LicenseDetails {
8
8
  getCpuCount(): number;
9
9
  getMemory(): number;
10
10
  isEval(): boolean;
11
+ /**
12
+ * `true` when the licensed product may run `feature` without the license watermark: a valid
13
+ * license with no exceptions, or an evaluation on localhost / in a dev build. An evaluation on
14
+ * any other host answers `false` so the watermark shows.
15
+ */
11
16
  isValidFor: (feature: string) => boolean;
12
17
  getDeveloperCount(): number;
13
18
  getType(): string;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Base of the control-flow signals the calculation engine throws THROUGH a formula's evaluation.
3
+ *
4
+ * @remarks
5
+ * A demand evaluation (a cell the topological sort could not order) reads its precedents lazily;
6
+ * a read that lands on a cell not yet calculated suspends the formula so that cell can go first,
7
+ * and a read that lands on a cell already suspended is a reference cycle. Both are raised from
8
+ * inside the read and unwind the whole evaluation to the executor, which is the only catcher
9
+ * that knows what to do with them.
10
+ *
11
+ * Every catch site on the evaluation path that turns an arbitrary throw into a `#VALUE!` — a
12
+ * function call, a lambda body, a lift over range members, the commit-site dereference — must
13
+ * let a signal pass: {@link isCalcSignal}. A signal is not an error and never becomes a value.
14
+ */
15
+ export declare class CalcSignal {
16
+ readonly isCalcSignal: true;
17
+ }
18
+ /** `true` for a {@link CalcSignal} — a throw that must be rethrown, never turned into a value. */
19
+ export declare const isCalcSignal: (e: unknown) => e is CalcSignal;
20
+ //# sourceMappingURL=CalcSignal.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { ICellRange, ICellRanges } from '../cellRange';
2
2
  import { ICollection } from '../type';
3
- import { ITransaction } from '../transaction';
3
+ import { IAnchored } from '../anchored';
4
4
  import { IProtectedRange } from './IProtectedRange';
5
5
  /**
6
6
  * Holds a collection of {@link IProtectedRange}s.
@@ -41,8 +41,13 @@ export interface IProtectedRangeCollection extends ICollection<IProtectedRange>
41
41
  export declare namespace IProtectedRangeCollection {
42
42
  /**
43
43
  * Options for adding an {@link IProtectedRange}.
44
+ *
45
+ * @remarks
46
+ * `replaceExisting` redefines the entry at `index` when it covers exactly the same ranges; the
47
+ * entry keeps its name unless a free one is supplied — see
48
+ * {@link IAnchored.AddOptions.replaceExisting}.
44
49
  */
45
- interface AddOptions extends IProtectedRange.Properties, ITransaction.OperationOptions {
50
+ interface AddOptions extends IProtectedRange.Properties, IAnchored.AddOptions {
46
51
  }
47
52
  /**
48
53
  * Options for searching for {@link IProtectedRange}s.
@@ -13,6 +13,19 @@ export declare const _ReuseGlobalContext: {
13
13
  FormulaError: typeof FormulaError;
14
14
  Observable: typeof Observable;
15
15
  };
16
+ /**
17
+ * Publishes the shared context on `globalThis` for bundled scripts.
18
+ *
19
+ * @remarks
20
+ * A compiled script binds `globalThis.__SHEETXL.FormulaContext` (and `IRange`, `FormulaError`, …)
21
+ * ONCE, at module load — the `Bundler`'s virtual `@sheetxl/primitives` module reads them into
22
+ * top-level `export const`s. Every later call goes through that captured singleton, whose
23
+ * per-evaluation state is {@link setGlobalScope}. So the global only has to exist while a module
24
+ * loads. Idempotent, and never removed: nothing observes its absence, and installing it per
25
+ * function invocation (with a stash and a `delete` on the way out) cost ~290,000 property writes
26
+ * and deletes for one load of a 28K-formula workbook.
27
+ */
28
+ export declare function installGlobalContext(): void;
16
29
  export declare function setGlobalScope(scope: Partial<IFormulaContext> | null | undefined): void;
17
30
  export declare function clearGlobalScope(): void;
18
31
  //# sourceMappingURL=_ScriptUtils.d.ts.map
@@ -11,6 +11,7 @@ import { IComment } from '../comment';
11
11
  import { IColor } from '../color';
12
12
  import { IHyperlink } from '../hyperlink';
13
13
  import { ISort } from '../sort';
14
+ import { IAnchored } from '../anchored';
14
15
  import { Anchored } from '../anchored/Anchored';
15
16
  import { IAnchoredMap } from '../anchored/IAnchoredMap';
16
17
  import { ITable, ITableCollection } from '../table';
@@ -841,13 +842,43 @@ export declare class Sheet implements ISheet {
841
842
  * @internal
842
843
  */
843
844
  protected _addTable(address: ICellRange.Address, options: ITableCollection.AddOptions | boolean): ITable;
845
+ /**
846
+ * The add shared by the anchored collections — conditional formats, data validations, protected
847
+ * ranges. Resolves an item-or-address input, keeps the option keys out of the persisted JSON, and
848
+ * either redefines the item at `index` (when `replaceExisting` and the collection agrees it is the
849
+ * same item) or inserts there — first by default, as in Excel.
850
+ * @internal
851
+ */
852
+ protected _addAnchored<T extends IAnchored & {
853
+ getRanges(): ICellRanges;
854
+ toJSON(): J | null;
855
+ }, J extends object>(add: ICellRanges.Address | T | null | undefined, options: (IAnchored.AddOptions & J) | undefined, spec: {
856
+ /** The sheet-state slot the collection lives in. */
857
+ key: 'conditionalFormats' | 'dataValidations' | 'protectedRanges';
858
+ isItem: (add: unknown) => add is T;
859
+ description: string;
860
+ /** Loads one ref into the map, handing the created model to `capture`. */
861
+ load: (map: IAnchoredMap<T, J>, ref: IRange.JSONReference<J>, capture: (model: T) => void) => IAnchoredMap<T, J>;
862
+ /**
863
+ * Whether the item at `index` — already known to cover exactly the same ranges — is the one
864
+ * `json` redefines: the per-collection half of `replaceExisting`. Omit to match on ranges alone.
865
+ */
866
+ isSameItem?: (existing: T, json: J) => boolean;
867
+ /** Redefines `existing` from `json`, inside the add's commit. */
868
+ replace: (existing: T, json: J, options: ITransaction.OperationOptions) => void;
869
+ /** A last look at the JSON before it is inserted (a protected range mints its name here). */
870
+ prepareInsert?: (json: J) => J;
871
+ notify: () => void;
872
+ /** Widen the item's columns after an insert — a validation or format may show a dropdown. */
873
+ autoFit?: boolean;
874
+ }): T;
844
875
  /**
845
876
  * @internal
846
877
  */
847
878
  protected _addDataValidation(add: ICellRanges.Address | IDataValidation, options?: IDataValidationCollection.AddOptions): IDataValidation;
848
879
  /**
849
- * @internal
850
- */
880
+ * @internal
881
+ */
851
882
  protected _addConditionalFormat(add: ICellRanges.Address | IConditionalFormat, options?: IConditionalFormatCollection.AddOptions): IConditionalFormat;
852
883
  /**
853
884
  * The first unused `Range<n>` name, matching Excel's default for a new Allow-Edit-Range.
@@ -292,6 +292,8 @@ export declare class SheetCell implements ICell {
292
292
  getHyperlink(): IHyperlink | null;
293
293
  /** {@inheritDoc ICell.getErrors} */
294
294
  getErrors(): readonly string[];
295
+ /** {@inheritDoc ICell.getCircularReference} */
296
+ getCircularReference(): ICalculation.ICircularReference | null;
295
297
  /** {@inheritDoc ICell.getWarnings} */
296
298
  getWarnings(): readonly string[];
297
299
  /** {@inheritDoc ICell.getSpans} */
@@ -162,7 +162,18 @@ export declare class SheetRange implements ICellRange {
162
162
  /** {@inheritDoc ICellRange.getSurrounding} */
163
163
  getSurrounding(options?: ICellRange.GetSurroundingOptions): this;
164
164
  /** {@inheritDoc ICellRange.getExtended} */
165
- getExtended(direction: IRange.Direction, cell?: ICell.Address): this;
165
+ getExtended(direction: IRange.Direction, cell?: ICell.Address | ICellRange.GetExtendedOptions): this;
166
+ /**
167
+ * `fromBlank: 'before'` — a walk that set off from a blank comes to rest on the last blank rather
168
+ * than on the first cell of the block it ran into. See
169
+ * {@link ICellRange.GetExtendedOptions.fromBlank}.
170
+ */
171
+ private _restBeforeBlock;
172
+ /**
173
+ * `basis: 'adjacent'` — the boundary comes from the lines flanking the range rather than from its
174
+ * own content. See {@link ICellRange.GetExtendedOptions.basis} for the rule.
175
+ */
176
+ private _extendedAdjacent;
166
177
  /** {@inheritDoc ICellRange.getEntireRows} */
167
178
  getEntireRows(shift?: boolean, options?: ICellRange.GetRangeOptions): this;
168
179
  /** {@inheritDoc ICellRange.getEntireColumns} */
@@ -7,7 +7,7 @@ import { IStyle } from '../style';
7
7
  import { ICellRange } from '../cellRange';
8
8
  import { OverlappingRange, ISparseGrid, ISpatialMap } from '../collections';
9
9
  import { MergeEntry } from './spatial';
10
- import { SpillEntry, ContentfulSpatialValue } from '../calculation/spatial';
10
+ import { SpillEntry, ContentfulSpatialValue, CircularEntry } from '../calculation/spatial';
11
11
  import { IConditionalFormat } from '../conditionalFormat';
12
12
  import { IDataValidation } from '../dataValidation';
13
13
  import { IProtectedRange } from '../protectedRange';
@@ -220,6 +220,10 @@ export declare namespace RangeState {
220
220
  * Errors during calculation.
221
221
  */
222
222
  calcError?: string;
223
+ /**
224
+ * In a reference cycle, or downstream of one.
225
+ */
226
+ circular?: CircularEntry;
223
227
  /**
224
228
  * An error VALUE lives here (the `Error` scalar kind — from the reconciled error spatial).
225
229
  */
@@ -263,6 +267,10 @@ export declare namespace RangeState {
263
267
  readonly Spills: "spills";
264
268
  readonly Pending: "pending";
265
269
  readonly CalcError: "calcError";
270
+ /**
271
+ * In a reference cycle, or downstream of one — evaluates to `0` (DESIGN-CIRCULAR-CALC.md §7).
272
+ */
273
+ readonly Circular: "circular";
266
274
  /**
267
275
  * Error VALUES (the `Error` scalar kind). Backed by the RECONCILED view
268
276
  * (`SheetReadContext.getErrorSpatial`), not `state.errorSpatial` directly — resolving it may
@@ -383,6 +391,11 @@ export interface State {
383
391
  spillSpatial: ISpatialMap<SpillEntry>;
384
392
  pendingSpatial: ISpatialMap<boolean>;
385
393
  calcErrorsSpatial: ISpatialMap<string>;
394
+ /**
395
+ * Cells in a reference cycle or downstream of one, by cycle (DESIGN-CIRCULAR-CALC.md §7.2).
396
+ * Maintained by calc realize from the executor's deltas, like {@link pendingSpatial}.
397
+ */
398
+ circularSpatial: ISpatialMap<CircularEntry>;
386
399
  /**
387
400
  * Error VALUES (`#DIV/0!`, `#N/A`, …) — the `Error` scalar kind, NOT engine failures
388
401
  * (those are {@link calcErrorsSpatial} / `CalcError`). Deliberately not per-type: `true`
@@ -479,6 +479,11 @@ export declare namespace IStyle {
479
479
  readonly Quarters5: "5Quarters";
480
480
  readonly Rating5: "5Rating";
481
481
  readonly Boxes5: "5Boxes";
482
+ /**
483
+ * Not a set to apply — the x14 name Excel writes for a band whose custom icon is
484
+ * "No Cell Icon" (`iconSet="NoIcons" iconId="0"`). It holds zero icons.
485
+ */
486
+ readonly NoIcons: "NoIcons";
482
487
  };
483
488
  type IconSet = typeof IconSet[keyof typeof IconSet];
484
489
  }
@@ -217,11 +217,27 @@ export declare class AnchoredTable extends AbstractAnchored<State, CommitView, I
217
217
  * 2. create or reused new Ids
218
218
  *
219
219
  * @remarks
220
- * Mutates columnPropsNews to ensure index is correct.
220
+ * Each entry is cloned before its `index`/`id` are settled. Callers routinely build
221
+ * `columnPropsNews` out of the committed `orderedColumnsProps` (a slice, a spread, a splice),
222
+ * which shares the prop objects with the state undo restores - writing through them would
223
+ * rewrite history in place.
221
224
  *
222
225
  * @internal
223
226
  */
224
227
  protected _updateColumnsState(columnPropsNews: Partial<ColumnPropertiesState>[], options?: string | ITransaction.OperationOptions): ITable.IColumn[];
228
+ /**
229
+ * Re-derives the active filter and sort levels from the column props.
230
+ *
231
+ * @remarks
232
+ * A level is bound to a column id, but the column props are where a filter or sort actually
233
+ * lives. Rebuilding the columns (a delete, a sheet sync) can therefore take a column out from
234
+ * under its level, and a level that outlives its column reads back as unfiltered while its rows
235
+ * stay hidden. Deriving the levels from the props instead of carrying them alongside keeps the
236
+ * two from drifting, and closes the gap in `level` left by whatever was dropped.
237
+ *
238
+ * @internal
239
+ */
240
+ private _rebuildActiveLevels;
225
241
  /** {@inheritDoc ITable.getVisibleRefRangeCoords} */
226
242
  getVisibleRefRangeCoords(): IRange.Coords;
227
243
  /** {@inheritDoc ITable.getVisibleCellCoords} */
@@ -157,6 +157,24 @@ export declare function isValidHttpUrl(value: string): boolean;
157
157
  * @returns `true` if the string is a valid email, `false` otherwise.
158
158
  */
159
159
  export declare function isValidEmail(text: string): boolean;
160
+ /**
161
+ * The hyperlink address for text that Excel's AutoCorrect would turn into a link, or `null`
162
+ * when the text is not link-shaped.
163
+ *
164
+ * @param text The text to check.
165
+ * @returns The address, with the scheme Excel supplies when the text omits one, or `null`.
166
+ *
167
+ * @remarks
168
+ * Mirrors Excel's "Internet and network paths with hyperlinks" rule, which links:
169
+ *
170
+ * * `http(s)://…` - as is.
171
+ * * `www.…` - as `http://www.…`.
172
+ * * `mailto:…` - as is.
173
+ * * an email address - as `mailto:…`.
174
+ *
175
+ * A bare domain (`sheetxl.com`) is left alone, as Excel leaves it.
176
+ */
177
+ export declare function toHyperlinkAddress(text: string): string | null;
160
178
  /**
161
179
  * Converts a number to alphabet.
162
180
  * @param i The number to stringify