@sheetxl/io-xlsx 0.8.0-beta.11 → 0.8.0-beta.13

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 (82) hide show
  1. package/browser/esm/{Bs0EzhdU8WgGfPzf.mjs → 20e8E-6B9lZDdDO3.mjs} +2 -2
  2. package/browser/esm/{DICL6ecj9BdJv8aX.mjs → B4_m1DDdERBw_oc_.mjs} +4 -4
  3. package/browser/esm/{CuAXx5i4uqTz-mMY.mjs → B8HGBRlYw3gtV6cS.mjs} +1 -1
  4. package/browser/esm/{CzFYJPxmLyKgEKF0.mjs → BUnVDknxJ3z7Byym.mjs} +2 -2
  5. package/browser/esm/{yveeVJ6hKDI5KDEz.mjs → BZULU4MreyJ0WsDY.mjs} +1243 -1083
  6. package/browser/esm/{Cv3R6fGatARKedSn.mjs → BduVw3dFdh9sSGv_.mjs} +2560 -2120
  7. package/browser/esm/CM4k1dv3DNPThvDz.mjs +24 -0
  8. package/browser/esm/{CZ9I80og75SDRjv0.mjs → CkEGcTzeyh7cqVVb.mjs} +2 -2
  9. package/browser/esm/{BiDqExNXiY7ykk8E.mjs → DmW0VCJFl3eX7pBV.mjs} +199 -198
  10. package/browser/esm/{DatIA9fZbEPjW4bh.mjs → eFR-PmxEV53J-933.mjs} +1782 -1266
  11. package/browser/esm/index.mjs +2 -2
  12. package/browser/esm/{CLWsOc6DO8l1G_LF.mjs → khCH6SyDFBiHzmSl.mjs} +816 -764
  13. package/node/esm/BqB-dnUZaszNS--K.mjs +6367 -0
  14. package/node/esm/{Bpqm_PpGLpdjL47-.mjs → ByC9KtkF09muIv1I.mjs} +257 -256
  15. package/node/esm/{CAJxmJdobUbzpUz5.mjs → CHElwgFJ32Hh_gHU.mjs} +2 -2
  16. package/node/esm/{fopiRR7OiVoEiF7B.mjs → CIpg0EBGoVM58ajd.mjs} +2 -2
  17. package/node/esm/{DScqM1V4wPntNP6-.mjs → CJt_Kh2EU8DlMcus.mjs} +2046 -1588
  18. package/node/esm/{B9Zn6H1RV07Ob377.mjs → COzTSkHGuyKdKaxO.mjs} +512 -460
  19. package/node/esm/{ipiyzn5Pfohw2afB.mjs → Cc4XXs0Y2lL-2Et9.mjs} +1350 -1184
  20. package/node/esm/{CxlSbH7mmnEEsqmX.mjs → DmvVllQAwUtHEJbX.mjs} +1 -1
  21. package/node/esm/index.mjs +4 -4
  22. package/package.json +3 -3
  23. package/types/src/AutoFilterRules.d.ts +0 -42
  24. package/types/src/DataTableFormula.d.ts +26 -0
  25. package/types/src/DataValidationRules.d.ts +0 -5
  26. package/types/src/ExcelCalcStamp.d.ts +0 -36
  27. package/types/src/ExcelCompat.d.ts +0 -140
  28. package/types/src/ExcelFunctionFacts.d.ts +0 -272
  29. package/types/src/ExcelReservedNames.d.ts +0 -64
  30. package/types/src/KnownFonts.d.ts +0 -13
  31. package/types/src/LegacyFormula.d.ts +0 -58
  32. package/types/src/Plugin.d.ts +3 -3
  33. package/types/src/SheetKinds.d.ts +0 -15
  34. package/types/src/SourcePackage.d.ts +0 -44
  35. package/types/src/Types.d.ts +2 -3
  36. package/types/src/chart/ChartSpaceXml.d.ts +2 -1
  37. package/types/src/chart/_chartCodecs.d.ts +2 -0
  38. package/types/src/chart/_chartExStyle.d.ts +0 -9
  39. package/types/src/reader/CellControls.d.ts +18 -0
  40. package/types/src/reader/DummyFunctionUnwrap.d.ts +43 -23
  41. package/types/src/reader/LibreOfficeDataTable.d.ts +3 -2
  42. package/types/src/reader/domVisitors/AutoFilterVisitor.d.ts +0 -8
  43. package/types/src/reader/domVisitors/ExternalLinkVisitor.d.ts +1 -11
  44. package/types/src/reader/domVisitors/FeaturePropertyBagVisitor.d.ts +18 -0
  45. package/types/src/reader/domVisitors/FmtSchemeVisitor.d.ts +0 -11
  46. package/types/src/reader/domVisitors/SheetStyleVisitor.d.ts +6 -0
  47. package/types/src/reader/domVisitors/WorkbookVisitor.d.ts +0 -9
  48. package/types/src/reader/domVisitors/index.d.ts +2 -4
  49. package/types/src/reader/saxVisitors/ContentTypesVisitor.d.ts +1 -0
  50. package/types/src/reader/saxVisitors/SharedStringsVisitor.d.ts +0 -15
  51. package/types/src/reader/saxVisitors/WorksheetVisitor.d.ts +16 -3
  52. package/types/src/richValue/ErrorRichValueHandler.d.ts +22 -0
  53. package/types/src/richValue/IRichValueHandler.d.ts +109 -0
  54. package/types/src/richValue/LocalImageRichValueHandler.d.ts +18 -0
  55. package/types/src/richValue/RichDataParts.d.ts +69 -0
  56. package/types/src/richValue/RichRecordWriter.d.ts +61 -0
  57. package/types/src/richValue/RichValueHandlers.d.ts +25 -0
  58. package/types/src/richValue/RichValueResolver.d.ts +54 -0
  59. package/types/src/richValue/WebImageRichValueHandler.d.ts +37 -0
  60. package/types/src/richValue/index.d.ts +7 -0
  61. package/types/src/utils/VmlNoteStyle.d.ts +0 -19
  62. package/types/src/vba/VBAProject.d.ts +0 -19
  63. package/types/src/writer/builder/OpcXmlUtils.d.ts +0 -8
  64. package/types/src/writer/builder/PackageBuilder.d.ts +0 -41
  65. package/types/src/writer/builder/Types.d.ts +0 -30
  66. package/types/src/writer/emitters/ExternalLinkEmitter.d.ts +0 -11
  67. package/types/src/writer/emitters/FeaturePropertyBagEmitter.d.ts +8 -0
  68. package/types/src/writer/emitters/RichValuePartsEmitters.d.ts +36 -0
  69. package/types/src/writer/emitters/RichValueRelEmitter.d.ts +12 -0
  70. package/types/src/writer/emitters/RichValueStructureEmitter.d.ts +4 -3
  71. package/types/src/writer/emitters/RichValueTypesEmitter.d.ts +3 -2
  72. package/types/src/writer/emitters/RichValueWebImageEmitter.d.ts +24 -0
  73. package/types/src/writer/emitters/SlicerEmitter.d.ts +5 -2
  74. package/types/src/writer/emitters/StylesEmitter.d.ts +2 -0
  75. package/types/src/writer/utils/CellControlComplements.d.ts +29 -0
  76. package/types/src/writer/utils/DefaultRows.d.ts +0 -16
  77. package/types/src/writer/utils/DummyFunction.d.ts +0 -23
  78. package/types/src/writer/utils/RichValueCollector.d.ts +81 -129
  79. package/types/src/writer/utils/SheetStyleLayout.d.ts +18 -5
  80. package/node/esm/DD-yXSBzvDYy0TX5.mjs +0 -5842
  81. package/types/src/reader/domVisitors/RichValueDataVisitor.d.ts +0 -7
  82. package/types/src/reader/domVisitors/RichValueStructureVisitor.d.ts +0 -6
@@ -1,4 +1,4 @@
1
- import { IWorkbook, IWorksheet } from '@sheetxl/sdk';
1
+ import { INamed, ITypes, IWorkbook } from '@sheetxl/sdk';
2
2
  /** What a cell's `<f>` turned out to be. */
3
3
  export type Unwrapped =
4
4
  /** Not a wrapper — use the text as-is. */
@@ -12,21 +12,12 @@ export type Unwrapped =
12
12
  }
13
13
  /**
14
14
  * A cell the original spilled INTO. It has no formula of its own and its cached value belongs to
15
- * the anchor's result, so BOTH must be dropped — leaving the value behind would block the
16
- * restored anchor from spilling and turn it into `#SPILL!`.
15
+ * the anchor's result, so it has to end up inside the anchor's extent — a plain value there would
16
+ * block the restored anchor from spilling and turn it into `#SPILL!`.
17
17
  */
18
18
  | {
19
19
  kind: 'spilled';
20
20
  };
21
- /** A wrapped cell found during parsing, resolved later by {@link applyDummyFunctionUnwrap}. */
22
- export interface DummyWrapRecord {
23
- /** Identity of the sheet's parse-time JSON; the reader maps it to the constructed sheet. */
24
- sheet: object;
25
- rowIndex: number;
26
- colIndex: number;
27
- /** The original formula text, or `null` when this cell is a spilled-into placeholder. */
28
- formula: string | null;
29
- }
30
21
  /**
31
22
  * Classifies a raw `<f>` text.
32
23
  *
@@ -40,19 +31,48 @@ export declare const unwrapDummyFunction: (text: string) => Unwrapped;
40
31
  * cannot be mistaken for a call, which is the whole reason this is not a regex.
41
32
  */
42
33
  export declare const extractFunctionNames: (text: string) => string[];
34
+ /** Whether a function called by a wrapped formula can run in the workbook being read. */
35
+ export type IsKnownFunction = (name: string) => boolean;
36
+ /**
37
+ * The functions a workbook will have, answered before it exists: the built-in declarations, the
38
+ * file's defined names, and the functions the caller is supplying to it.
39
+ */
40
+ export declare const createIsKnownFunction: (names: readonly INamed.JSON[] | undefined, providers: IWorkbook.ConstructorOptions["functions"]) => IsKnownFunction;
43
41
  /**
44
- * Restores the original formula for every wrapper whose functions this workbook actually has.
42
+ * Whether a wrapped formula calls a volatile function. The wrapper does not say so: to Excel it is
43
+ * a call to one unknown function.
44
+ */
45
+ export declare const callsVolatileFunction: (formula: string) => boolean;
46
+ /**
47
+ * Decides, one wrapper at a time as a sheet's cells are read, what each becomes.
48
+ *
49
+ * A wrapper whose functions are all known becomes the formula it wrapped, and a spilling one a
50
+ * dynamic array over the cached values of its placeholders. That is what the model loads for any
51
+ * stored array formula, so it opens with the file's values and is evaluated for the same reasons.
45
52
  *
46
- * Runs after the workbook is constructed, because that is the first moment the function registry
47
- * exists — and the registry is the whole question. Unwrapping a formula we cannot evaluate would
48
- * replace a correct cached value with `#NAME?`, which is worse than leaving the wrapper alone: the
49
- * wrapper at least still shows the right answer. So a wrapper naming anything unknown (a Sheets
50
- * function we do not implement, a UDF this session has not registered) is left exactly as it was.
53
+ * A wrapper naming anything unknown (a Sheets function we do not implement, a UDF nobody supplied)
54
+ * stays as it is, along with its placeholders: unwrapped, it would be `#NAME?` the first time it
55
+ * ran, and the wrapper keeps the right value on screen and in the next save.
51
56
  *
52
- * A spilled block is all-or-nothing. The placeholders are claimed by flood fill from the anchor —
53
- * spill blocks are contiguous, so a placeholder connected to a resolvable anchor belongs to it —
54
- * and are cleared BEFORE the anchor's formula is restored, since the restored formula needs those
55
- * cells free to spill into. Placeholders of an unresolved anchor keep their values.
57
+ * The cells arrive in reading order, so an anchor precedes its placeholders. Only the placeholder
58
+ * side needs looking up: a block is rectangular, so its first row is what runs right of the anchor,
59
+ * and each later row sits under the one above. A block's own column takes a placeholder ahead of a
60
+ * neighbor's row, because a scalar wrapper beside a spill is the usual reason the two ever touch.
56
61
  */
57
- export declare const applyDummyFunctionUnwrap: (workbook: IWorkbook, records: DummyWrapRecord[], sheetsByRef: Map<object, IWorksheet>) => void;
62
+ export declare class DummyFunctionRestorer {
63
+ private _isKnown;
64
+ private _restored;
65
+ /** The block last seen in each column. */
66
+ private _byColumn;
67
+ constructor(isKnown: IsKnownFunction);
68
+ /** Whether the wrapped formula at this cell is restored. A cell is asked about at most once. */
69
+ anchor(rowIndex: number, colIndex: number, formula: string): boolean;
70
+ /** Whether the placeholder at this cell belongs to a restored block. */
71
+ placeholder(rowIndex: number, colIndex: number): boolean;
72
+ /**
73
+ * Every restored block, whether it spilled or not. An unmarked formula is a legacy one to the
74
+ * load, and would have its `@`s put back; the text in a wrapper was never spelled that way.
75
+ */
76
+ getFormulaArray(): [ref: string, kind: ITypes.FormulaArrayKind][];
77
+ }
58
78
  //# sourceMappingURL=DummyFunctionUnwrap.d.ts.map
@@ -1,4 +1,5 @@
1
- import { IRange, IDataTable } from '@sheetxl/sdk';
1
+ import { IRange } from '@sheetxl/sdk';
2
+ import { DataTableDefinition } from '../DataTableFormula';
2
3
  /**
3
4
  * The table a `TABLE(...)` formula describes, read at the table's first result cell; `null` when it
4
5
  * is not a table laid out as Excel lays one out.
@@ -7,5 +8,5 @@ import { IRange, IDataTable } from '@sheetxl/sdk';
7
8
  * there).
8
9
  * @param results The result cells: the rectangle every cell of which carries this formula.
9
10
  */
10
- export declare const readLibreOfficeDataTable: (text: string, results: IRange.Coords) => IDataTable.JSON | null;
11
+ export declare const readLibreOfficeDataTable: (text: string, results: IRange.Coords) => DataTableDefinition | null;
11
12
  //# sourceMappingURL=LibreOfficeDataTable.d.ts.map
@@ -12,14 +12,6 @@ export declare class AutoFilterVisitor implements Visitor {
12
12
  processColorFilter(context: ExecutionContext, elem: Element): ICondition.JSON;
13
13
  processCustomFilter(context: ExecutionContext, elem: Element): ICondition.JSON | null;
14
14
  processCustomFilters(context: ExecutionContext, elem: Element): ICondition.JSON;
15
- /**
16
- * `dynamicFilter` is Excel's Average (`aboveAverage` / `belowAverage`) or a TimePeriod.
17
- *
18
- * @remarks
19
- * `val` and `maxVal` are Excel's cache of the last evaluation (the average; a period's start
20
- * and exclusive end), not an anchor and not a deviation count. Excel honors `type` alone and
21
- * rewrites them on save (`probe-filter-dynamic`), so they are dropped here.
22
- */
23
15
  processDynamicFilter(context: ExecutionContext, elem: Element): ICondition.JSON;
24
16
  processDateGroupItem(context: ExecutionContext, elem: Element): ICondition.DateGroupItem;
25
17
  processFilterItem(context: ExecutionContext, elem: Element): Scalar | undefined;
@@ -23,7 +23,7 @@ export declare class ExternalLinkVisitor implements Visitor {
23
23
  * Cached types measured across the bench corpus are `n`, `str`, `b`, `e` — strings are inline in
24
24
  * `<v>`, never an sst index (design doc §1). Mirrors `WorksheetVisitor`'s scalar coercion for `n`
25
25
  * / `b` / `e`; `str` here is the literal value (unlike a live sheet's `str`, which is a formula
26
- * marker whose text lives elsewhere), so it needs no `{t,v}` wrapper — `ICell.JSON`'s untyped arm
26
+ * marker whose text lives elsewhere), so it needs no `{t,v}` wrapper — `Scalar.JSON`'s untyped arm
27
27
  * is a bare JS primitive, self-typed at runtime.
28
28
  */
29
29
  private _readCellValue;
@@ -32,16 +32,6 @@ export declare class ExternalLinkVisitor implements Visitor {
32
32
  private _findAbsoluteUrlRelId;
33
33
  }
34
34
  export declare namespace ExternalLinkVisitor {
35
- /**
36
- * The `r:id`s the part's XML points at, handed to `XLSXReader` so it can say which of the part's
37
- * relationships is the book's own path and which is the 2021 `absoluteUrl` companion — then
38
- * stripped. **Not part of {@link IExternalBook.JSON}**: an rId is a name inside one package, and
39
- * a saved book gets fresh ones.
40
- *
41
- * @remarks
42
- * The relationship type cannot answer this on its own — both can be `externalLinkPath` (measured
43
- * on task 40234).
44
- */
45
35
  interface RelIds {
46
36
  __bookRelId?: string;
47
37
  __absoluteUrlRelId?: string;
@@ -0,0 +1,18 @@
1
+ import { ICellControl } from '@sheetxl/sdk';
2
+ import { Visitor, ExecutionContext } from '../dom';
3
+ /**
4
+ * What `xl/featurePropertyBag/featurePropertyBag.xml` says the cell xfs' complements are.
5
+ *
6
+ * @remarks
7
+ * `controls[i]` is the control an xf with `xfComplement i="i"` carries, or `null` when the chain
8
+ * names something SheetXL does not read (a foreign bag type is warned about, and its cells keep
9
+ * their values).
10
+ */
11
+ export interface FeaturePropertyBags {
12
+ controls: (ICellControl.JSON | null)[];
13
+ }
14
+ export declare class FeaturePropertyBagVisitor implements Visitor {
15
+ visit(context: ExecutionContext, elem: Element, jsonParent: any): FeaturePropertyBags;
16
+ private _readBag;
17
+ }
18
+ //# sourceMappingURL=FeaturePropertyBagVisitor.d.ts.map
@@ -1,17 +1,6 @@
1
1
  import { ITheme } from '@sheetxl/sdk';
2
2
  import { Visitor, ExecutionContext } from '../dom';
3
3
  import { ColorContainerVisitor } from './ColorContainerVisitor';
4
- /**
5
- * Parses the source theme's `<a:fmtScheme>` (fill/line/effect/background-fill style lists) into
6
- * typed `ITheme.JSON` fields (`fillStyleLst`/`lnStyleLst`/`effectStyleLst`/`bgFillStyleLst`) so
7
- * idx-referencing shape/chart styles (`<a:lnRef idx="N">`, `<a:fillRef>`, `<a:effectRef>`) keep
8
- * resolving against the same source definitions on save — see DESIGN-PACKAGE-PASSTHROUGH.md §11.2.
9
- *
10
- * Each list that is fully modeled is kept, so the theme draws with the file's own fills and
11
- * lines. If any list isn't (an effect outside the "common" set — see `IEffect` — or a
12
- * `scene3d`/`sp3d` on an effect style), the whole `<a:fmtScheme>` is also captured verbatim
13
- * (`ITheme.JSON.formatSchemeXml`) and `ThemeEmitter` replays that instead of writing the lists.
14
- */
15
4
  export declare class FmtSchemeVisitor extends ColorContainerVisitor implements Visitor {
16
5
  visit(context: ExecutionContext, elemParent: Element, jsonParent: ITheme.JSON): void;
17
6
  private parseFillList;
@@ -16,6 +16,12 @@ export declare class SheetStyleVisitor extends SheetColorContainerVisitor implem
16
16
  * the sheets are read (`applyHiddenFormulas`), since a format alone cannot say it.
17
17
  */
18
18
  collectHiddenXfs(elem: Element): Set<number>;
19
+ /**
20
+ * The cell xfs whose `extLst` carries an `xfComplement`, by xf index, with the complement index.
21
+ * They become cell controls once the sheets and the feature property bags are read
22
+ * (`applyCellControls`); the style itself does not keep them.
23
+ */
24
+ collectXfComplements(elem: Element): Map<number, number>;
19
25
  processProtection(context: ExecutionContext, elem: Element, jsonParent: any): any;
20
26
  processDXF(context: ExecutionContext, elem: Element, jsonParent: ICellStyle.JSON): any;
21
27
  processDXFs(context: ExecutionContext, elem: Element, jsonParent: any[]): any;
@@ -20,15 +20,6 @@ export declare class WorkbookVisitor extends SheetColorContainerVisitor {
20
20
  * `getRef`, which normalizes an empty visitor result to `null` and attaches `sources`).
21
21
  */
22
22
  processExternalReferences(context: ExecutionContext, elem: Element, jsonParent: IWorkbook.JSON): any;
23
- /**
24
- * `<pivotCaches><pivotCache cacheId="n" r:id="rIdN"/></pivotCaches>` — the workbook's pivot
25
- * caches, each carried whole: its definition part and, through that part's own relationships,
26
- * its records. See `PLAN-MODEL-HOMES.md` step 4.
27
- *
28
- * @remarks
29
- * The id is the join key: every pivot table names the cache it summarizes by `cacheId`, and the
30
- * writer puts the same id back so the two still meet.
31
- */
32
23
  processPivotCaches(context: ExecutionContext, elem: Element, jsonParent: IWorkbook.JSON): any;
33
24
  processBookViews(context: ExecutionContext, elem: Element, jsonParent: IWorkbook.JSON): any;
34
25
  processWorkbookView(context: ExecutionContext, elem: Element, jsonParent: IWorkbook.JSON): any;
@@ -27,8 +27,7 @@ import { DrawingPicVisitor } from './DrawingPicVisitor';
27
27
  import { DrawingGrpSpVisitor } from './DrawingGrpSpVisitor';
28
28
  import { DrawingCxnSpVisitor } from './DrawingCxnSpVisitor';
29
29
  import { MetadataVisitor } from './MetadataVisitor';
30
- import { RichValueStructureVisitor } from './RichValueStructureVisitor';
31
- import { RichValueDataVisitor } from './RichValueDataVisitor';
30
+ import { FeaturePropertyBagVisitor } from './FeaturePropertyBagVisitor';
32
31
  import { CommentsVisitor } from './CommentsVisitor';
33
32
  import { CommentVisitor } from './CommentVisitor';
34
33
  import { ThreadedCommentsVisitor } from './ThreadedCommentsVisitor';
@@ -64,8 +63,7 @@ export declare const BuiltInVisitors: {
64
63
  DrawingGrpSpVisitor: typeof DrawingGrpSpVisitor;
65
64
  DrawingCxnSpVisitor: typeof DrawingCxnSpVisitor;
66
65
  MetadataVisitor: typeof MetadataVisitor;
67
- RichValueStructureVisitor: typeof RichValueStructureVisitor;
68
- RichValueDataVisitor: typeof RichValueDataVisitor;
66
+ FeaturePropertyBagVisitor: typeof FeaturePropertyBagVisitor;
69
67
  CommentsVisitor: typeof CommentsVisitor;
70
68
  CommentVisitor: typeof CommentVisitor;
71
69
  ThreadedCommentsVisitor: typeof ThreadedCommentsVisitor;
@@ -28,6 +28,7 @@ export interface ContentTypesDirectory {
28
28
  styles: string[];
29
29
  metadata: string[];
30
30
  people: string[];
31
+ featurePropertyBag: string[];
31
32
  /**
32
33
  * Every `<Override>`, by part path (no leading `/`).
33
34
  *
@@ -43,20 +43,5 @@ export declare class RunCollector {
43
43
  */
44
44
  take(): IRichText.Run[] | null;
45
45
  }
46
- /**
47
- * The runs as a cell holds them: a run with an `<rPr>` gets the whole font Excel reads it as,
48
- * a run without one stays bare.
49
- *
50
- * @remarks
51
- * Measured (`probe-rich-partial.ps1`, 2026-10-18): Excel reads an `<rPr>` as absolute over the
52
- * workbook's DEFAULT font, not the cell's. `<rPr><i/></rPr>` over an Arial 12 bold cell renders
53
- * Calibri 11 italic, not bold; an empty `<rPr/>` (openpyxl) renders the default font; only a run
54
- * with no `<rPr>` inherits the cell font. So a run with an `<rPr>` is completed here from the
55
- * default font with every toggle off, then what the `<rPr>` states; the run then means the same
56
- * read as a delta over any cell font.
57
- *
58
- * @param defaultFont The workbook's Normal font (family, size, color); absent, Excel's
59
- * own default.
60
- */
61
46
  export declare function completeRuns(runs: readonly IRichText.Run[], defaultFont: IFontStyle.JSON | undefined): IRichText.Run[];
62
47
  //# sourceMappingURL=SharedStringsVisitor.d.ts.map
@@ -1,4 +1,4 @@
1
- import { Tuple, IWorksheet, ICell } from '@sheetxl/sdk';
1
+ import { Scalar, Tuple, IWorksheet } from '@sheetxl/sdk';
2
2
  import { SaxParser } from '../sax';
3
3
  import { OnWarning } from '../Warning';
4
4
  /**
@@ -6,6 +6,8 @@ import { OnWarning } from '../Warning';
6
6
  * dialect (`XlsxFormulaDialect`), for condition formulas. Set before any sheet streams.
7
7
  */
8
8
  export declare const PARAM_FORMULA_DIALECT = "formulaDialect";
9
+ /** {@link IsKnownFunction}, set when wrapped formulas are to be restored. Read at the first wrapper. */
10
+ export declare const PARAM_IS_KNOWN_FUNCTION = "isKnownFunction";
9
11
  /**
10
12
  * The `paramMap` key under which the reader hands the worksheet visitor `workbookPr@date1904`, for
11
13
  * `t="d"` cells. Read per cell, not when the visitor is made: it is set once `workbook.xml` is read,
@@ -17,7 +19,7 @@ export declare const PARAM_RICH_STRINGS = "richStrings";
17
19
  /** The workbook's Normal font (`IFontStyle.JSON`), which a rich run's `<rPr>` is read over. */
18
20
  export declare const PARAM_DEFAULT_FONT = "defaultFont";
19
21
  /** What an inline string resolves to: a shared-string id, or a rich value when it has runs. */
20
- type InlineStringResult = number | ICell.JSONTypedValue | undefined;
22
+ type InlineStringResult = number | Scalar.JSONTypedValue | undefined;
21
23
  export declare const createWorksheetSaxVisitor: (sheet: IWorksheet.JSON, getRef: (relId: string, as?: "resource" | "legacyDrawing" | "part" | "formControl") => any, // TODO - this should be a context like DOM.
22
24
  addSharedString: (str: string) => number, mapDxfs?: Map<number, any>, onEnd?: () => void, onWarning?: OnWarning, onProgress?: (amount: number, total?: number) => void, paramMap?: Map<string, any>) => SaxParser.EventHandler;
23
25
  export declare class RowAttributeType {
@@ -32,6 +34,17 @@ export declare class RowAttributeType {
32
34
  static S: number;
33
35
  static Spans: number;
34
36
  }
35
- export declare const createSheetDataSaxVisitor: (tupleBuilder: Tuple.IBuilder<ICell.JSON>, sheet: IWorksheet.JSON, delegate: SaxParser.EventHandler, onWarning: OnWarning | undefined, onProgress: ((amount: number, total?: number) => void) | undefined, stringHandler: SaxParser.EventHandler<InlineStringResult>, paramMap?: Map<string, any>, addSharedString?: (str: string) => number, isZeroHeight?: () => boolean) => SaxParser.EventHandler;
37
+ /**
38
+ * The address of a formula that is a `HYPERLINK` call and nothing else: the first argument when
39
+ * it is a literal string, `null` when it is computed (`HYPERLINK(B2)`), and `undefined` when
40
+ * the formula is not a top-level `HYPERLINK` call.
41
+ *
42
+ * @remarks
43
+ * Excel stores a `HYPERLINK` result as its plain value (`t="str"` friendly name) and nothing in
44
+ * `<hyperlinks>`; it makes the cell a link on open from the formula text. A nested call
45
+ * (`IF(c, HYPERLINK(...))`) is not read as a link.
46
+ */
47
+ export declare const topLevelHyperlinkAddress: (a1: string) => string | null | undefined;
48
+ export declare const createSheetDataSaxVisitor: (tupleBuilder: Tuple.IBuilder<Scalar.JSON>, sheet: IWorksheet.JSON, delegate: SaxParser.EventHandler, onWarning: OnWarning | undefined, onProgress: ((amount: number, total?: number) => void) | undefined, stringHandler: SaxParser.EventHandler<InlineStringResult>, paramMap?: Map<string, any>, addSharedString?: (str: string) => number, isZeroHeight?: () => boolean, lastInlineText?: () => string) => SaxParser.EventHandler;
36
49
  export {};
37
50
  //# sourceMappingURL=WorksheetVisitor.d.ts.map
@@ -0,0 +1,22 @@
1
+ import { IRichValueHandler } from './IRichValueHandler';
2
+ /**
3
+ * Excel's `_error` structure: an error Excel has no cell error code for (`#SPILL!`, `#CALC!`,
4
+ * `#BUSY!`, …), written as `#VALUE!` with a rich value saying which.
5
+ *
6
+ * ```xml
7
+ * <s t="_error">
8
+ * <k n="errorType" t="i"/>
9
+ * <k n="subType" t="i"/>
10
+ * </s>
11
+ * ```
12
+ *
13
+ * @remarks
14
+ * `errorType` does NOT align to `ERROR.TYPE()`: the OOXML sequence is 0-based and skips `#FIELD!`,
15
+ * so it is the error's code minus one. Excel's other keys (`#SPILL!`'s `rwOffset`/`colOffset`,
16
+ * `#PYTHON!`'s `correlationId`, a fetch's `subType` 10) are read past and written as 0 or not at
17
+ * all: an error with a subtype is a rich error kind, not yet built.
18
+ *
19
+ * @internal
20
+ */
21
+ export declare const ErrorRichValueHandler: IRichValueHandler;
22
+ //# sourceMappingURL=ErrorRichValueHandler.d.ts.map
@@ -0,0 +1,109 @@
1
+ import { IRichData, IWorkbook, Scalar } from '@sheetxl/sdk';
2
+ import { DomParser, FileLookup } from '../reader/ReaderUtils';
3
+ import { EmitContext } from '../writer/builder';
4
+ /**
5
+ * OOXML primitive-value type codes used in `<k t="…">` attributes inside `<rvStructures>`.
6
+ *
7
+ * "d" - Date/Time (ISO-8601 string)
8
+ * "i" - Integer (32-bit signed)
9
+ * "b" - Boolean
10
+ * "e" - Error value
11
+ * "s" - Inline string
12
+ * "r" - Nested rich value
13
+ * "a" - Array data (rdarray.xml)
14
+ * "spb" - Supporting property bag
15
+ */
16
+ export type RichPrimitiveType = 'd' | 'i' | 'b' | 'e' | 's' | 'r' | 'a' | 'spb';
17
+ /**
18
+ * One key of a rich value structure: its name (`n=` on `<k>`), its type (`t=`), and the text
19
+ * written when a value has none for it (`''` when omitted).
20
+ */
21
+ export type RichValueProp = [name: string, type: RichPrimitiveType, defaultValue?: string];
22
+ /** A key's flags in `rdRichValueTypes.xml`: `[flag name, value]`. */
23
+ export type RichValueKeyFlags = [key: string, flags: [name: string, value: string][]];
24
+ /**
25
+ * How one Excel rich value structure (`<s t="_webimage">`) reads into a cell value and writes back
26
+ * out of one.
27
+ *
28
+ * @remarks
29
+ * One handler per structure type. A handler maps the structure's keys to and from a cell value (an
30
+ * error, or the JSON of one of our rich data kinds) and owns the parts the structure needs beyond
31
+ * the rich value itself (the web image part and its media for `_webimage`). It works per file:
32
+ * {@link beginRead} and {@link beginWrite} start one file's state, as `strings.beginPersist()` does.
33
+ *
34
+ * @internal
35
+ */
36
+ export interface IRichValueHandler {
37
+ /** Excel's structure type: `t=` on `<s>`. */
38
+ readonly structure: string;
39
+ /**
40
+ * The types of our rich data kinds this structure writes (`IRichData.getKind().getName()`). An error
41
+ * that is not a rich value is written by the `_error` structure, which lists none.
42
+ */
43
+ readonly kinds: readonly string[];
44
+ /**
45
+ * Whether this structure writes `value`, where two structures write one kind (a web picture and
46
+ * a picture placed in a cell are both `image`). Omitted, every value of its kinds.
47
+ */
48
+ writes?(value: Scalar): boolean;
49
+ /** Starts reading one file: reads the parts the structure resolves against. */
50
+ beginRead(ctx: RichValueReadContext): IRichValueReader;
51
+ /** Starts writing one file. */
52
+ beginWrite(ctx: RichValueWriteContext): IRichValueWriter;
53
+ }
54
+ /** What a handler reads a file's parts through. @internal */
55
+ export interface RichValueReadContext {
56
+ getFile: FileLookup;
57
+ domParser: DomParser;
58
+ /** The external target of the relationship `relId` of `part`, or `null`. */
59
+ getAddress(part: string, relId: string): string | null;
60
+ /** The bytes of the part the relationship `relId` of `part` names, or `null`. */
61
+ getBytes(part: string, relId: string): ArrayBuffer | null;
62
+ /**
63
+ * Adds a picture the file holds to the workbook as the copy of `source`, and answers the id a
64
+ * value's JSON names it by (`resId`).
65
+ */
66
+ addFetched(bytes: ArrayBuffer, source: string): number | null;
67
+ /** Marks a part as read into the model, so it is not carried through as unknown. */
68
+ markAbsorbed(part: string): void;
69
+ }
70
+ /** One file's reading of a structure. @internal */
71
+ export interface IRichValueReader {
72
+ /**
73
+ * The cell value one `<rv>` reads as: an error, or a rich data kind's JSON.
74
+ *
75
+ * @param values The `<v>`s by key name; integers are numbers, everything else text.
76
+ * @returns `undefined` when the values cannot be read; the rich value is then kept as read.
77
+ */
78
+ read(values: Record<string, string | number>): Scalar | IRichData.JSON | undefined;
79
+ }
80
+ /** What a handler writes a file through. @internal */
81
+ export interface RichValueWriteContext {
82
+ readonly workbook: IWorkbook;
83
+ }
84
+ /** One file's writing of a structure. @internal */
85
+ export interface IRichValueWriter {
86
+ /** {@inheritDoc IRichValueHandler.structure} */
87
+ readonly structure: string;
88
+ /** The keys written, as `<k>` in `rdrichvaluestructure.xml`; an `<rv>` has a `<v>` for each. */
89
+ readonly props: readonly RichValueProp[];
90
+ /**
91
+ * The `<v>`s for one cell value, parallel to {@link props}, or `null` when it cannot be
92
+ * written by this structure.
93
+ *
94
+ * @param formula The cell's formula text, or `null` for a literal.
95
+ */
96
+ write(value: Scalar, formula: string | null): string[] | null;
97
+ /** The key flags written for the structure in `rdRichValueTypes.xml`, if any. */
98
+ getKeyFlags?(): readonly RichValueKeyFlags[];
99
+ /** Adds the parts the written values need, once every sheet is written. */
100
+ addParts?(ctx: EmitContext): void;
101
+ }
102
+ /**
103
+ * The `<v>`s of `props` read from a record by name: a missing or `null` value writes the prop's
104
+ * default.
105
+ *
106
+ * @internal
107
+ */
108
+ export declare const valuesOf: (props: readonly RichValueProp[], record: Record<string, unknown>) => string[];
109
+ //# sourceMappingURL=IRichValueHandler.d.ts.map
@@ -0,0 +1,18 @@
1
+ import { IRichValueHandler } from './IRichValueHandler';
2
+ /** The part listing the pictures `_localImage` rich values name, by position. */
3
+ export declare const RICH_VALUE_REL_PART = "/xl/richData/richValueRel.xml";
4
+ /**
5
+ * Excel's `_localImage` structure: a picture placed in a cell (Insert ▸ Picture ▸ Place in Cell),
6
+ * read as and written from an `image` value whose source is `resource:<id>` and which holds its
7
+ * picture.
8
+ *
9
+ * @remarks
10
+ * The structure names its picture by position in richValueRel.xml, whose relationship is the media
11
+ * part; there is no source URL, so reading mints one. A literal is `CalcOrigin` 5 (an Excel file,
12
+ * 2026-10-28); a formula over one is written as a `_webimage`'s would be, unprobed. Alt text has
13
+ * no key here: the file for it is unprobed.
14
+ *
15
+ * @internal
16
+ */
17
+ export declare const LocalImageRichValueHandler: IRichValueHandler;
18
+ //# sourceMappingURL=LocalImageRichValueHandler.d.ts.map
@@ -0,0 +1,69 @@
1
+ import { DomParser, FileLookup } from '../reader/ReaderUtils';
2
+ /** The rich data parts, by zip name. */
3
+ export declare const RICH_DATA_PART: {
4
+ readonly structures: "xl/richData/rdrichvaluestructure.xml";
5
+ readonly values: "xl/richData/rdrichvalue.xml";
6
+ readonly arrays: "xl/richData/rdarray.xml";
7
+ readonly bagStructures: "xl/richData/rdsupportingpropertybagstructure.xml";
8
+ readonly bags: "xl/richData/rdsupportingpropertybag.xml";
9
+ readonly types: "xl/richData/rdRichValueTypes.xml";
10
+ readonly richStyles: "xl/richData/richStyles.xml";
11
+ };
12
+ /** A key and its type code (`t=`; absent for a number). */
13
+ export type RichKey = readonly [name: string, type: string | null];
14
+ /** One `<s>` of rdrichvaluestructure.xml. */
15
+ export interface RichStructure {
16
+ readonly t: string;
17
+ readonly keys: readonly RichKey[];
18
+ }
19
+ /** One `<rv>`: its structure, its `<v>`s in key order, and the `<fb>` cached number if any. */
20
+ export interface RawRichValue {
21
+ readonly s: number;
22
+ readonly values: readonly string[];
23
+ readonly fb: string | null;
24
+ }
25
+ /** A typed item of an array or a bag array: `<v t="…">text</v>`. */
26
+ export interface RichItem {
27
+ readonly t: string | null;
28
+ readonly text: string;
29
+ }
30
+ /** One `<a>` of rdarray.xml: its items, row major. */
31
+ export interface RichArrayPart {
32
+ readonly rows: number;
33
+ readonly columns: number;
34
+ readonly items: readonly RichItem[];
35
+ }
36
+ /** One `<spb>`: its bag structure and its `<v>`s in key order. */
37
+ export interface RichBag {
38
+ readonly s: number;
39
+ readonly values: readonly string[];
40
+ }
41
+ /** A key's flags, by flag name (`ShowInCardView` → `'0'`). */
42
+ export type RichKeyFlags = ReadonlyMap<string, string>;
43
+ /** One `<rSty>` of richStyles.xml, resolved: its number format and its card roles. */
44
+ export interface RichStyle {
45
+ readonly numberFormat: string | null;
46
+ readonly isTitle: boolean;
47
+ readonly isHero: boolean;
48
+ }
49
+ /** Everything the rich data parts of one file say. Empty lists for parts the file lacks. */
50
+ export interface RichDataParts {
51
+ readonly structures: readonly RichStructure[];
52
+ readonly values: readonly RawRichValue[];
53
+ readonly arrays: readonly RichArrayPart[];
54
+ readonly bagStructures: readonly (readonly RichKey[])[];
55
+ readonly bagArrays: readonly (readonly RichItem[])[];
56
+ readonly bags: readonly RichBag[];
57
+ /** Flags every structure's keys share. */
58
+ readonly globalKeyFlags: ReadonlyMap<string, RichKeyFlags>;
59
+ /** Flags by structure type, then key. */
60
+ readonly typeKeyFlags: ReadonlyMap<string, ReadonlyMap<string, RichKeyFlags>>;
61
+ readonly richStyles: readonly RichStyle[];
62
+ }
63
+ /**
64
+ * Reads every rich data part of a file. A part the file lacks reads as empty.
65
+ *
66
+ * @internal
67
+ */
68
+ export declare const readRichDataParts: (getFile: FileLookup, domParser: DomParser) => RichDataParts;
69
+ //# sourceMappingURL=RichDataParts.d.ts.map
@@ -0,0 +1,61 @@
1
+ import { IRichType, Scalar } from '@sheetxl/sdk';
2
+ import { RichPrimitiveType } from './IRichValueHandler';
3
+ /** A key of a structure or a bag structure: its name and type code (none for a number). */
4
+ export type RichStructureKey = readonly [name: string, type?: RichPrimitiveType | 'spba', defaultValue?: string];
5
+ /** A structure written: `<s t>` and its keys. @internal */
6
+ export interface RichValueStructureDef {
7
+ readonly structure: string;
8
+ readonly props: readonly RichStructureKey[];
9
+ }
10
+ /** An item of an array or a bag array: `<v t>`. */
11
+ export type RichItemText = readonly [type: string | undefined, text: string];
12
+ /** A `richStyles` entry. */
13
+ export interface RichStyleDef {
14
+ readonly numberFormat?: string;
15
+ readonly isTitle?: boolean;
16
+ readonly isHero?: boolean;
17
+ }
18
+ /**
19
+ * What the record writer writes into: the file's rich data tables. Every add answers the index
20
+ * the file names the entry by; equal entries share one.
21
+ *
22
+ * @internal
23
+ */
24
+ export interface RichValueSink {
25
+ /** The structure `t` with `keys`, added when new. */
26
+ structureFor(t: string, keys: readonly RichStructureKey[]): RichValueStructureDef;
27
+ /** An `<rv>`: its index in rdrichvalue.xml. */
28
+ addValue(structure: RichValueStructureDef, values: readonly string[], fb?: string): number;
29
+ /** An `<rv>` for a value a handler writes (an error, a picture), or `null`. */
30
+ addHandled(value: Scalar): number | null;
31
+ /** An `<a>` of rdarray.xml. */
32
+ addArray(rows: number, columns: number, items: readonly RichItemText[]): number;
33
+ /** An `<spb>`. */
34
+ addBag(keys: readonly RichStructureKey[], values: readonly string[]): number;
35
+ /** An `<a>` of the bags' `spbArrays`. */
36
+ addBagArray(items: readonly RichItemText[]): number;
37
+ /** A `richStyles` entry, 1-based as bags name them. */
38
+ addRichStyle(style: RichStyleDef): number;
39
+ /** A key's flags for the structure type `t`. */
40
+ addKeyFlags(t: string, key: string, flags: readonly (readonly [name: string, value: string])[]): void;
41
+ }
42
+ /** What a kind is a kind of: its name up to the digest (`_linkedentitycore:3f…` → `_linkedentitycore`). */
43
+ export declare const baseOfKind: (kind: IRichType) => string;
44
+ /**
45
+ * Writes rich values as Excel's rich data: records as `<rv>`s of their kind's structure, nested
46
+ * values by index, presentation back into Excel's bags.
47
+ *
48
+ * @remarks
49
+ * The inverse of `createRichValueResolver`. A key's type follows its kind's declared value type,
50
+ * so a number in a `rich` key is written as a `_formattednumber` carrying its format (geography)
51
+ * and a number in a number key takes its format from the record's `_Format` bag (finance). A full
52
+ * entity record is written with the form a cell or a parent names it by: the finance wrapper
53
+ * (`_linkedentity`, `%cvi`), or the geography stub (`_linkedentity2`) beside its full record.
54
+ *
55
+ * @internal
56
+ */
57
+ export declare const createRichRecordWriter: (sink: RichValueSink) => {
58
+ /** The `<rv>` a cell holding `value` names, or `null` when `value` is not one this writes. */
59
+ writeCell: (value: Scalar) => number | null;
60
+ };
61
+ //# sourceMappingURL=RichRecordWriter.d.ts.map
@@ -0,0 +1,25 @@
1
+ import { Scalar } from '@sheetxl/sdk';
2
+ import { IRichValueHandler } from './IRichValueHandler';
3
+ /**
4
+ * The rich value handlers the xlsx reader and writer dispatch through: one per Excel structure
5
+ * type, found by the structure when reading and by the value when writing.
6
+ *
7
+ * @internal
8
+ */
9
+ export declare namespace RichValueHandlers {
10
+ /**
11
+ * Adds a handler, replacing one for the same structure. Where several write one kind, the one
12
+ * registered last that {@link IRichValueHandler.writes} the value writes it.
13
+ */
14
+ function register(handler: IRichValueHandler): void;
15
+ /** Every handler, in registration order. */
16
+ function getAll(): IRichValueHandler[];
17
+ /** The handler that reads a structure type (`t=` on `<s>`), or `null`. */
18
+ function getByStructure(structure: string): IRichValueHandler | null;
19
+ /**
20
+ * The handler that writes a cell value: its kind's for a rich value; for an error with no kind
21
+ * of its own, `_error`. `null` when none does.
22
+ */
23
+ function getForValue(value: Scalar): IRichValueHandler | null;
24
+ }
25
+ //# sourceMappingURL=RichValueHandlers.d.ts.map