@shbernal/ts-xlsx 1.0.2 → 1.0.3

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 (105) hide show
  1. package/README.md +6 -0
  2. package/dist/core/autofilter.js +2 -2
  3. package/dist/core/cell.js +4 -4
  4. package/dist/core/color-resolution.js +1 -1
  5. package/dist/core/column.js +2 -2
  6. package/dist/core/conditional-formatting-overlay.js +1 -1
  7. package/dist/core/data-validation-overlay.js +2 -2
  8. package/dist/core/formula.js +2 -2
  9. package/dist/core/grid-edits.js +5 -5
  10. package/dist/core/merge.js +1 -1
  11. package/dist/core/pivot-table.js +3 -3
  12. package/dist/core/range.js +8 -4
  13. package/dist/core/row.js +2 -2
  14. package/dist/core/table-style.d.ts +2 -2
  15. package/dist/core/table-style.js +2 -2
  16. package/dist/core/table.js +2 -2
  17. package/dist/core/theme.d.ts +1 -1
  18. package/dist/core/theme.js +1 -1
  19. package/dist/core/value.d.ts +10 -10
  20. package/dist/core/workbook-protection.d.ts +1 -1
  21. package/dist/core/workbook.d.ts +11 -11
  22. package/dist/core/workbook.js +22 -22
  23. package/dist/core/worksheet-model.d.ts +1 -1
  24. package/dist/core/worksheet-model.js +5 -5
  25. package/dist/core/worksheet.d.ts +2 -2
  26. package/dist/core/worksheet.js +21 -21
  27. package/dist/customui/errors.js +1 -1
  28. package/dist/customui/index.js +2 -2
  29. package/dist/customui/ribbon.d.ts +1 -1
  30. package/dist/customui/ribbon.js +3 -3
  31. package/dist/entries/core.js +14 -14
  32. package/dist/entries/csv.js +2 -2
  33. package/dist/entries/customui.js +1 -1
  34. package/dist/entries/errors.js +7 -7
  35. package/dist/entries/vba.js +2 -2
  36. package/dist/entries/xlsb.js +1 -1
  37. package/dist/entries/xlsx.js +5 -5
  38. package/dist/index.js +7 -7
  39. package/dist/io/csv/read.js +2 -2
  40. package/dist/io/csv/write.js +2 -2
  41. package/dist/io/opc/errors.js +1 -1
  42. package/dist/io/opc/inflate.d.ts +1 -1
  43. package/dist/io/opc/inflate.js +2 -2
  44. package/dist/io/opc/read-opc.js +2 -2
  45. package/dist/io/opc/rels.js +2 -2
  46. package/dist/io/opc/sniff-format.js +2 -2
  47. package/dist/io/style/xf-style.js +2 -2
  48. package/dist/io/xlsb/errors.js +1 -1
  49. package/dist/io/xlsb/formula.js +4 -4
  50. package/dist/io/xlsb/primitives.js +2 -2
  51. package/dist/io/xlsb/read-shared-strings.js +3 -3
  52. package/dist/io/xlsb/read-styles.js +5 -5
  53. package/dist/io/xlsb/read-worksheet.js +9 -9
  54. package/dist/io/xlsb/read.d.ts +1 -1
  55. package/dist/io/xlsb/read.js +15 -15
  56. package/dist/io/xlsb/record-stream.js +1 -1
  57. package/dist/io/xlsx/cell-accumulator.js +6 -6
  58. package/dist/io/xlsx/cell-value.js +4 -4
  59. package/dist/io/xlsx/comments.js +4 -4
  60. package/dist/io/xlsx/conditional-formatting.js +5 -5
  61. package/dist/io/xlsx/data-validation.js +4 -4
  62. package/dist/io/xlsx/edit-vba.js +4 -4
  63. package/dist/io/xlsx/errors.js +1 -1
  64. package/dist/io/xlsx/hyperlinks.js +4 -4
  65. package/dist/io/xlsx/images.js +6 -6
  66. package/dist/io/xlsx/package-plan.js +3 -3
  67. package/dist/io/xlsx/pivot-read.js +2 -2
  68. package/dist/io/xlsx/pivot.js +4 -4
  69. package/dist/io/xlsx/read-rows.d.ts +3 -3
  70. package/dist/io/xlsx/read-rows.js +12 -12
  71. package/dist/io/xlsx/read-styles.js +4 -4
  72. package/dist/io/xlsx/read-worksheet.js +8 -8
  73. package/dist/io/xlsx/read.d.ts +1 -1
  74. package/dist/io/xlsx/read.js +28 -28
  75. package/dist/io/xlsx/relationships.d.ts +6 -6
  76. package/dist/io/xlsx/relationships.js +2 -2
  77. package/dist/io/xlsx/rich-runs.js +1 -1
  78. package/dist/io/xlsx/rich-text.js +2 -2
  79. package/dist/io/xlsx/shared-formulas.js +3 -3
  80. package/dist/io/xlsx/shared-strings-read.js +2 -2
  81. package/dist/io/xlsx/shared-strings.js +3 -3
  82. package/dist/io/xlsx/sheet-properties.js +4 -4
  83. package/dist/io/xlsx/styles.js +6 -6
  84. package/dist/io/xlsx/tables.js +5 -5
  85. package/dist/io/xlsx/threaded-comments.js +5 -5
  86. package/dist/io/xlsx/workbook-xml.js +9 -9
  87. package/dist/io/xlsx/worksheet-xml.js +18 -18
  88. package/dist/io/xlsx/write-stream.d.ts +1 -1
  89. package/dist/io/xlsx/write-stream.js +7 -7
  90. package/dist/io/xlsx/write.d.ts +3 -3
  91. package/dist/io/xlsx/write.js +20 -20
  92. package/dist/io/xlsx/x14-ext.js +1 -1
  93. package/dist/vba/cfb-writer.js +1 -1
  94. package/dist/vba/cfb.js +1 -1
  95. package/dist/vba/codepage.js +1 -1
  96. package/dist/vba/errors.js +1 -1
  97. package/dist/vba/index.js +5 -5
  98. package/dist/vba/ms-ovba.js +1 -1
  99. package/dist/vba/project-editor.js +7 -7
  100. package/dist/vba/project.js +4 -4
  101. package/dist/vba/vba-encoding.js +1 -1
  102. package/dist/xml/errors.js +1 -1
  103. package/dist/xml/xml-read.js +1 -1
  104. package/dist/xml/xml.js +1 -1
  105. package/package.json +3 -2
@@ -2,12 +2,12 @@
2
2
  // per image), the drawing's own relationships to the `xl/media/` bytes, and the reader that turns a
3
3
  // drawing back into anchors. The image bytes themselves are opaque here — the writer copies them
4
4
  // verbatim into a media part and the reader hands them back untouched.
5
- import { isOneCellAnchor, } from "../../core/image.js";
6
- import { XML_DECLARATION } from "../../xml/xml.js";
7
- import { localName, parseXml } from "../../xml/xml-read.js";
8
- import { RELATIONSHIPS_NS } from "../opc/namespaces.js";
9
- import { relationship, relationshipsPart } from "../opc/rels.js";
10
- import { DRAWINGML_NS, XDR_NS } from "./namespaces.js";
5
+ import { isOneCellAnchor, } from '../../core/image.js';
6
+ import { XML_DECLARATION } from '../../xml/xml.js';
7
+ import { localName, parseXml } from '../../xml/xml-read.js';
8
+ import { RELATIONSHIPS_NS } from '../opc/namespaces.js';
9
+ import { relationship, relationshipsPart } from '../opc/rels.js';
10
+ import { DRAWINGML_NS, XDR_NS } from './namespaces.js';
11
11
  const IMAGE_REL_TYPE = `${RELATIONSHIPS_NS}/image`;
12
12
  // The content type Excel expects for each image kind, keyed by lower-case extension. An unlisted
13
13
  // extension falls back to `image/<ext>`, which is what a well-behaved consumer infers anyway.
@@ -1,9 +1,9 @@
1
1
  // The plan layer of the writer: pure graph resolution that turns a Workbook model into the numbered,
2
2
  // cross-referenced set of parts an `.xlsx` package needs — media, preserved (verbatim-carried) parts,
3
3
  // and the sheet-/workbook-local relationship ids that wire them — before any XML is serialised.
4
- import { AuthoringError } from "../../errors.js";
5
- import { extensionOf, relativePartPath, relsPathFor, THEME_PART_PATH } from "../opc/part-paths.js";
6
- import { preservedRelsXml } from "../opc/rels.js";
4
+ import { AuthoringError } from '../../errors.js';
5
+ import { extensionOf, relativePartPath, relsPathFor, THEME_PART_PATH } from '../opc/part-paths.js';
6
+ import { preservedRelsXml } from '../opc/rels.js';
7
7
  // A sheet's relationship-id allocator: hands out `rId1`, `rId2`, … in the one canonical order the
8
8
  // package wires a sheet's parts (tables, drawing, comments, threaded comments, printer settings, external
9
9
  // hyperlinks, background, preserved references, pivot tables). Every sheet-local id is drawn from here in
@@ -11,8 +11,8 @@
11
11
  // attribute yields a sensible default rather than a throw — the strict invariants belong on the
12
12
  // authoring path (`core/pivot-table.ts`), not here. A hostile part therefore degrades to an
13
13
  // incomplete model; it never crashes the reader.
14
- import { pivotMetricFromSubtotal, } from "../../core/pivot-table.js";
15
- import { localName, parseXml } from "../../xml/xml-read.js";
14
+ import { pivotMetricFromSubtotal, } from '../../core/pivot-table.js';
15
+ import { localName, parseXml } from '../../xml/xml-read.js';
16
16
  /** Reconstruct a pivot's semantic model from its two definition parts. The records part is not
17
17
  * consulted: the cache's field catalogue and the table's field roles fully describe the pivot's
18
18
  * shape, and the aggregated values are Excel's to compute on refresh. */
@@ -5,10 +5,10 @@
5
5
  // Every value that reaches an attribute is run through `escapeAttr`, so source strings carrying XML
6
6
  // specials (`Smith & Co`, `<West>`, `It's "best"`) become well-formed markup rather than corrupting
7
7
  // the package — the whole point of the shared-item escaping this module guarantees.
8
- import { encodeAddress } from "../../core/address.js";
9
- import { escapeAttr, XML_DECLARATION } from "../../xml/xml.js";
10
- import { RELATIONSHIPS_NS } from "../opc/namespaces.js";
11
- import { SPREADSHEETML_NS } from "./namespaces.js";
8
+ import { encodeAddress } from '../../core/address.js';
9
+ import { escapeAttr, XML_DECLARATION } from '../../xml/xml.js';
10
+ import { RELATIONSHIPS_NS } from '../opc/namespaces.js';
11
+ import { SPREADSHEETML_NS } from './namespaces.js';
12
12
  // Excel's default caption prefix for each aggregation ("Sum of Amount", "Average of Amount"). A
13
13
  // metric's name is also its `subtotal` value, which is why the record key equals the enum member.
14
14
  const METRIC_CAPTIONS = {
@@ -62,9 +62,9 @@ export interface StreamedSheet {
62
62
  * @param options Sheet selector and the inflate bound (see {@link ReadSheetRowsOptions}).
63
63
  * @throws {UnsupportedFormatError} if the input is not a readable `.xlsx` package (a legacy `.xls`, a
64
64
  * binary `.xlsb`, or an unrecognised/non-ZIP blob — branch on `.format`).
65
- * @throws {@link PackageReadError} if the input is a ZIP that cannot be unpacked — a corrupt or
65
+ * @throws {PackageReadError} if the input is a ZIP that cannot be unpacked — a corrupt or
66
66
  * truncated archive, or one exceeding the inflate bound (a probable zip bomb).
67
- * @throws {@link XlsxParseError} if the package's workbook part declares no worksheets.
67
+ * @throws {XlsxParseError} if the package's workbook part declares no worksheets.
68
68
  * @throws {RangeError} / {@link AuthoringError} if `options.sheet` selects a position, or a name,
69
69
  * that no worksheet has.
70
70
  */
@@ -79,7 +79,7 @@ export declare function readSheetRows(data: Uint8Array, options?: ReadSheetRowsO
79
79
  * @param options The inflate bound (see {@link ReadXlsxOptions}).
80
80
  * @throws {UnsupportedFormatError} if the input is not a readable `.xlsx` package (a legacy `.xls`, a
81
81
  * binary `.xlsb`, or an unrecognised/non-ZIP blob — branch on `.format`).
82
- * @throws {@link PackageReadError} if the input is a ZIP that cannot be unpacked — a corrupt or
82
+ * @throws {PackageReadError} if the input is a ZIP that cannot be unpacked — a corrupt or
83
83
  * truncated archive, or one exceeding the inflate bound (a probable zip bomb).
84
84
  */
85
85
  export declare function readWorkbookStream(data: Uint8Array, options?: ReadXlsxOptions): Generator<StreamedSheet>;
@@ -17,15 +17,15 @@
17
17
  // document-sized and cheap. What this avoids is retaining N materialised cells. A later slice can
18
18
  // make the inflate itself per-part lazy; the pull primitive this stands on (`xmlEvents`) is the
19
19
  // same one that path will use.
20
- import { MAX_COLUMN } from "../../core/address.js";
21
- import { AuthoringError } from "../../errors.js";
22
- import { boolStrict, closeEmptyElements, localName, xmlEvents } from "../../xml/xml-read.js";
23
- import { packageAccessors } from "../opc/read-opc.js";
24
- import { inflateSpreadsheetPackage, unsupportedWorkbookPart } from "../opc/sniff-format.js";
25
- import { CellAccumulator } from "./cell-accumulator.js";
26
- import { XlsxParseError } from "./errors.js";
27
- import { DEFAULT_MAX_UNCOMPRESSED, parseRelationships, parseStyleTable, parseWorkbookSheets, resolveWorkbookPart, } from "./read.js";
28
- import { parseSharedStrings } from "./shared-strings-read.js";
20
+ import { MAX_COLUMN } from '../../core/address.js';
21
+ import { AuthoringError } from '../../errors.js';
22
+ import { boolStrict, closeEmptyElements, localName, xmlEvents } from '../../xml/xml-read.js';
23
+ import { packageAccessors } from '../opc/read-opc.js';
24
+ import { inflateSpreadsheetPackage, unsupportedWorkbookPart } from '../opc/sniff-format.js';
25
+ import { CellAccumulator } from './cell-accumulator.js';
26
+ import { XlsxParseError } from './errors.js';
27
+ import { DEFAULT_MAX_UNCOMPRESSED, parseRelationships, parseStyleTable, parseWorkbookSheets, resolveWorkbookPart, } from './read.js';
28
+ import { parseSharedStrings } from './shared-strings-read.js';
29
29
  /**
30
30
  * Stream a worksheet's rows from an `.xlsx` package, yielding each in sheet order without building
31
31
  * the workbook model. Only rows the sheet actually declares are yielded, and within a row only its
@@ -36,9 +36,9 @@ import { parseSharedStrings } from "./shared-strings-read.js";
36
36
  * @param options Sheet selector and the inflate bound (see {@link ReadSheetRowsOptions}).
37
37
  * @throws {UnsupportedFormatError} if the input is not a readable `.xlsx` package (a legacy `.xls`, a
38
38
  * binary `.xlsb`, or an unrecognised/non-ZIP blob — branch on `.format`).
39
- * @throws {@link PackageReadError} if the input is a ZIP that cannot be unpacked — a corrupt or
39
+ * @throws {PackageReadError} if the input is a ZIP that cannot be unpacked — a corrupt or
40
40
  * truncated archive, or one exceeding the inflate bound (a probable zip bomb).
41
- * @throws {@link XlsxParseError} if the package's workbook part declares no worksheets.
41
+ * @throws {XlsxParseError} if the package's workbook part declares no worksheets.
42
42
  * @throws {RangeError} / {@link AuthoringError} if `options.sheet` selects a position, or a name,
43
43
  * that no worksheet has.
44
44
  */
@@ -61,7 +61,7 @@ export function* readSheetRows(data, options = {}) {
61
61
  * @param options The inflate bound (see {@link ReadXlsxOptions}).
62
62
  * @throws {UnsupportedFormatError} if the input is not a readable `.xlsx` package (a legacy `.xls`, a
63
63
  * binary `.xlsb`, or an unrecognised/non-ZIP blob — branch on `.format`).
64
- * @throws {@link PackageReadError} if the input is a ZIP that cannot be unpacked — a corrupt or
64
+ * @throws {PackageReadError} if the input is a ZIP that cannot be unpacked — a corrupt or
65
65
  * truncated archive, or one exceeding the inflate bound (a probable zip bomb).
66
66
  */
67
67
  export function* readWorkbookStream(data, options = {}) {
@@ -7,10 +7,10 @@
7
7
  // formats, applying an xf to a cell — is a property of the OOXML style model rather than of its
8
8
  // spelling, and lives above both codecs in `../style/xf-style.ts`; the `.xlsb` style reader builds
9
9
  // the same table from BIFF12 records.
10
- import { assignStyleFacets, isBorderStyle, isFillPatternType, isFontScheme, isFontVerticalAlignment, isHorizontalAlignment, isNamedUnderlineStyle, isVerticalAlignment, } from "../../core/style.js";
11
- import { boolPresent, boolStrict, closeEmptyElements, localName, xmlEvents, } from "../../xml/xml-read.js";
12
- import { numFmtCodeFor } from "../style/xf-style.js";
13
- import { parseColor } from "./styles.js";
10
+ import { assignStyleFacets, isBorderStyle, isFillPatternType, isFontScheme, isFontVerticalAlignment, isHorizontalAlignment, isNamedUnderlineStyle, isVerticalAlignment, } from '../../core/style.js';
11
+ import { boolPresent, boolStrict, closeEmptyElements, localName, xmlEvents, } from '../../xml/xml-read.js';
12
+ import { numFmtCodeFor } from '../style/xf-style.js';
13
+ import { parseColor } from './styles.js';
14
14
  // The four sides plus the diagonal — the edge elements a <border> can hold, in the order the
15
15
  // schema lists them. This one tuple drives the edge-name union, the membership set (which drives
16
16
  // edge parsing without a per-name branch), and the "does any edge carry a style" scan below.
@@ -2,14 +2,14 @@
2
2
  // applied onto a {@link Worksheet}. It is a single streaming pass driving a handful of accumulators
3
3
  // (the cell being read, shared-formula masters, an autofilter draft, the current page-break axis) so
4
4
  // each element commits its state as it closes. Style indices resolve through the parsed style table.
5
- import { decodeRange } from "../../core/address.js";
6
- import { isCustomFilterOperator, } from "../../core/autofilter.js";
7
- import { INTERNAL } from "../../core/internal.js";
8
- import { SHEET_PROTECTION_FLAGS, } from "../../core/protection.js";
9
- import { assignStyleFacets } from "../../core/style.js";
10
- import { boolPresent, boolStrict, boolTristate, localName, parseXml, } from "../../xml/xml-read.js";
11
- import { CellAccumulator } from "./cell-accumulator.js";
12
- import { parseColor } from "./styles.js";
5
+ import { decodeRange } from '../../core/address.js';
6
+ import { isCustomFilterOperator, } from '../../core/autofilter.js';
7
+ import { INTERNAL } from '../../core/internal.js';
8
+ import { SHEET_PROTECTION_FLAGS, } from '../../core/protection.js';
9
+ import { assignStyleFacets } from '../../core/style.js';
10
+ import { boolPresent, boolStrict, boolTristate, localName, parseXml, } from '../../xml/xml-read.js';
11
+ import { CellAccumulator } from './cell-accumulator.js';
12
+ import { parseColor } from './styles.js';
13
13
  const MARGIN_SIDES = ['left', 'right', 'top', 'bottom', 'header', 'footer'];
14
14
  // Worksheet elements that commit on their close: a formatted-but-empty `<c/>` and a criteria-free
15
15
  // self-closing `<autoFilter/>` are expanded to open+close so each finalises once in onClose. The
@@ -18,7 +18,7 @@ export { parseStyleTable } from './read-styles.ts';
18
18
  * @throws {UnsupportedFormatError} if the input is neither — a legacy `.xls` (`.format === 'xls'`) or
19
19
  * an unrecognised/non-ZIP blob (`'unknown'`).
20
20
  * @throws {XlsbParseError} if a binary `.xlsb` part is malformed.
21
- * @throws {@link PackageReadError} if the input is a ZIP that cannot be unpacked — a corrupt or
21
+ * @throws {PackageReadError} if the input is a ZIP that cannot be unpacked — a corrupt or
22
22
  * truncated archive, or one exceeding the inflate bound (a probable zip bomb).
23
23
  */
24
24
  export declare function readXlsx(data: Uint8Array, options?: ReadXlsxOptions): Workbook;
@@ -16,38 +16,38 @@
16
16
  // Untrusted input: inflate is bounded by a running byte counter (`./inflate.ts`) that caps
17
17
  // actual decompressed output rather than trusting the archive's forgeable size headers, and
18
18
  // the parser (ADR 0004) never expands entities.
19
- import { decodeRange } from "../../core/address.js";
20
- import { unmangleFunctions } from "../../core/formula.js";
21
- import { INTERNAL } from "../../core/internal.js";
22
- import { Workbook } from "../../core/workbook.js";
23
- import { WORKBOOK_PROTECTION_CREDENTIAL_ATTRS, } from "../../core/workbook-protection.js";
24
- import { boolStrict, localName, openElements, parseXml } from "../../xml/xml-read.js";
25
- import { UnsupportedFormatError } from "../opc/errors.js";
26
- import { extensionOf, relsPathFor } from "../opc/part-paths.js";
27
- import { capturePartClosure, contentTypeResolver, packageAccessors, parseRelationshipRecords, parseRelationships, relationshipTargetByType, relationshipTargetsByType, resolveRelativePart, resolveWorkbookPart, sheetRelTarget, } from "../opc/read-opc.js";
28
- import { DEFAULT_MAX_UNCOMPRESSED } from "../opc/read-options.js";
29
- import { inflateSpreadsheetPackage } from "../opc/sniff-format.js";
30
- import { readXlsbPackage, XLSB_WORKBOOK_PART } from "../xlsb/read.js";
31
- import { applyNotes, parseComments } from "./comments.js";
32
- import { parseConditionalFormattings, parseDxfs } from "./conditional-formatting.js";
33
- import { applyDataValidations, parseDataValidations, parseExtendedDataValidations, } from "./data-validation.js";
34
- import { applyHyperlinks, parseSheetHyperlinks } from "./hyperlinks.js";
35
- import { drawingHasUnmodeledContent, parseDrawing } from "./images.js";
36
- import { parsePivotTable } from "./pivot-read.js";
37
- import { parseStyleTable } from "./read-styles.js";
38
- import { parseWorksheet } from "./read-worksheet.js";
39
- import { parseSharedStrings } from "./shared-strings-read.js";
40
- import { parseIndexedColors, parseMruColors, parseTableStyles } from "./styles.js";
41
- import { parseTable } from "./tables.js";
42
- import { buildCommentThreads, parsePersons, parseThreadedComments } from "./threaded-comments.js";
19
+ import { decodeRange } from '../../core/address.js';
20
+ import { unmangleFunctions } from '../../core/formula.js';
21
+ import { INTERNAL } from '../../core/internal.js';
22
+ import { Workbook } from '../../core/workbook.js';
23
+ import { WORKBOOK_PROTECTION_CREDENTIAL_ATTRS, } from '../../core/workbook-protection.js';
24
+ import { boolStrict, localName, openElements, parseXml } from '../../xml/xml-read.js';
25
+ import { UnsupportedFormatError } from '../opc/errors.js';
26
+ import { extensionOf, relsPathFor } from '../opc/part-paths.js';
27
+ import { capturePartClosure, contentTypeResolver, packageAccessors, parseRelationshipRecords, parseRelationships, relationshipTargetByType, relationshipTargetsByType, resolveRelativePart, resolveWorkbookPart, sheetRelTarget, } from '../opc/read-opc.js';
28
+ import { DEFAULT_MAX_UNCOMPRESSED } from '../opc/read-options.js';
29
+ import { inflateSpreadsheetPackage } from '../opc/sniff-format.js';
30
+ import { readXlsbPackage, XLSB_WORKBOOK_PART } from '../xlsb/read.js';
31
+ import { applyNotes, parseComments } from './comments.js';
32
+ import { parseConditionalFormattings, parseDxfs } from './conditional-formatting.js';
33
+ import { applyDataValidations, parseDataValidations, parseExtendedDataValidations, } from './data-validation.js';
34
+ import { applyHyperlinks, parseSheetHyperlinks } from './hyperlinks.js';
35
+ import { drawingHasUnmodeledContent, parseDrawing } from './images.js';
36
+ import { parsePivotTable } from './pivot-read.js';
37
+ import { parseStyleTable } from './read-styles.js';
38
+ import { parseWorksheet } from './read-worksheet.js';
39
+ import { parseSharedStrings } from './shared-strings-read.js';
40
+ import { parseIndexedColors, parseMruColors, parseTableStyles } from './styles.js';
41
+ import { parseTable } from './tables.js';
42
+ import { buildCommentThreads, parsePersons, parseThreadedComments } from './threaded-comments.js';
43
43
  // Re-exported for the streaming reader (`./read-rows.ts`) and the public barrel, which import these
44
44
  // from here: the split into per-part parsers is internal, so the reader's import surface is stable.
45
- export { parseRelationships, resolveWorkbookPart } from "../opc/read-opc.js";
45
+ export { parseRelationships, resolveWorkbookPart } from '../opc/read-opc.js';
46
46
  // The inflate bound and its option bag are shared with the `.xlsb` reader and the row streamer, so
47
47
  // they are declared apart from all three; they stay reachable here because this is the entry point
48
48
  // callers reach for.
49
- export { DEFAULT_MAX_UNCOMPRESSED } from "../opc/read-options.js";
50
- export { parseStyleTable } from "./read-styles.js";
49
+ export { DEFAULT_MAX_UNCOMPRESSED } from '../opc/read-options.js';
50
+ export { parseStyleTable } from './read-styles.js';
51
51
  /**
52
52
  * Read a spreadsheet package into a {@link Workbook}.
53
53
  *
@@ -60,7 +60,7 @@ export { parseStyleTable } from "./read-styles.js";
60
60
  * @throws {UnsupportedFormatError} if the input is neither — a legacy `.xls` (`.format === 'xls'`) or
61
61
  * an unrecognised/non-ZIP blob (`'unknown'`).
62
62
  * @throws {XlsbParseError} if a binary `.xlsb` part is malformed.
63
- * @throws {@link PackageReadError} if the input is a ZIP that cannot be unpacked — a corrupt or
63
+ * @throws {PackageReadError} if the input is a ZIP that cannot be unpacked — a corrupt or
64
64
  * truncated archive, or one exceeding the inflate bound (a probable zip bomb).
65
65
  */
66
66
  export function readXlsx(data, options = {}) {
@@ -3,12 +3,12 @@ export declare const NS: {
3
3
  readonly packageRels: "http://schemas.openxmlformats.org/package/2006/relationships";
4
4
  readonly main: "http://schemas.openxmlformats.org/spreadsheetml/2006/main";
5
5
  readonly docRels: "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
6
- readonly coreProps: "http://schemas.openxmlformats.org/package/2006/metadata/core-properties";
7
- readonly extProps: "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties";
8
- readonly dc: "http://purl.org/dc/elements/1.1/";
9
- readonly dcterms: "http://purl.org/dc/terms/";
10
- readonly dcmitype: "http://purl.org/dc/dcmitype/";
11
- readonly xsi: "http://www.w3.org/2001/XMLSchema-instance";
6
+ readonly coreProps: 'http://schemas.openxmlformats.org/package/2006/metadata/core-properties';
7
+ readonly extProps: 'http://schemas.openxmlformats.org/officeDocument/2006/extended-properties';
8
+ readonly dc: 'http://purl.org/dc/elements/1.1/';
9
+ readonly dcterms: 'http://purl.org/dc/terms/';
10
+ readonly dcmitype: 'http://purl.org/dc/dcmitype/';
11
+ readonly xsi: 'http://www.w3.org/2001/XMLSchema-instance';
12
12
  };
13
13
  export declare const REL: {
14
14
  readonly worksheet: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet";
@@ -5,8 +5,8 @@
5
5
  //
6
6
  // The `.rels` part envelope these types are written into is container-level, not SpreadsheetML, and
7
7
  // lives in `../opc/rels.ts`.
8
- import { CONTENT_TYPES_NS, PKG_RELS_NS, RELATIONSHIPS_NS } from "../opc/namespaces.js";
9
- import { SPREADSHEETML_NS } from "./namespaces.js";
8
+ import { CONTENT_TYPES_NS, PKG_RELS_NS, RELATIONSHIPS_NS } from '../opc/namespaces.js';
9
+ import { SPREADSHEETML_NS } from './namespaces.js';
10
10
  export const NS = {
11
11
  contentTypes: CONTENT_TYPES_NS,
12
12
  packageRels: PKG_RELS_NS,
@@ -4,7 +4,7 @@
4
4
  // the run's font bundle whose self-closing children each set one facet, and a `<t>` appends the run's
5
5
  // text; the run commits on `</r>`. The surrounding parser owns only whether it is inside an `<is>`/`<si>`
6
6
  // and where a bare (non-run) `<t>` goes.
7
- import { applyFontChild } from "./read-styles.js";
7
+ import { applyFontChild } from './read-styles.js';
8
8
  export class RunAccumulator {
9
9
  #runs = [];
10
10
  #font = null;
@@ -5,8 +5,8 @@
5
5
  // `<name>`) followed by a `<t>` text element. The writer serialises a rich-text value inline
6
6
  // (`t="inlineStr"`), never into the shared-strings table, matching how it writes every other string
7
7
  // value; the reader reconstructs the runs while scanning the inline string.
8
- import { textElement } from "../../xml/xml.js";
9
- import { fontXml } from "./styles.js";
8
+ import { textElement } from '../../xml/xml.js';
9
+ import { fontXml } from './styles.js';
10
10
  /**
11
11
  * Serialise a rich-text value's runs as the inner content of an `<is>` element. A zero-length run
12
12
  * is dropped: an empty `<t/>` is schema-invalid — Excel flags the file as corrupt — and an empty
@@ -1,8 +1,8 @@
1
1
  // Shared-formula group planning: assigning each master/clone group a sheet-unique index and the
2
2
  // master's `ref` range before the row loop serialises a single cell.
3
- import { encodeAddress } from "../../core/address.js";
4
- import { isFormulaValue, isSharedFormulaValue } from "../../core/value.js";
5
- import { AuthoringError } from "../../errors.js";
3
+ import { encodeAddress } from '../../core/address.js';
4
+ import { isFormulaValue, isSharedFormulaValue } from '../../core/value.js';
5
+ import { AuthoringError } from '../../errors.js';
6
6
  // Plan a sheet's shared-formula groups: every clone cell (a {@link SharedFormulaValue}) names its
7
7
  // master by address, so group the clones by master, assign each group a sheet-unique `si`, and record
8
8
  // the `ref` range (master through the furthest clone) on the master. Excel requires the master to sit
@@ -1,8 +1,8 @@
1
1
  // Parser for the shared-string table (`xl/sharedStrings.xml`), the pool that `t="s"` cells index into.
2
2
  // Split out of read.ts beside its sibling parsers (read-styles.ts, rich-runs.ts) so read.ts stays
3
3
  // orchestration; the run structure it decodes is owned by RunAccumulator, shared with inline strings.
4
- import { localName, parseXml } from "../../xml/xml-read.js";
5
- import { RunAccumulator } from "./rich-runs.js";
4
+ import { localName, parseXml } from '../../xml/xml-read.js';
5
+ import { RunAccumulator } from './rich-runs.js';
6
6
  // Shared strings resolve `t="s"` cells. Each `<si>` is one entry: a plain `<si><t>…</t>` decodes to a
7
7
  // string, while a rich `<si><r><rPr>…</rPr><t>…</t></r>…` decodes to a {@link RichTextValue} whose runs
8
8
  // carry their per-run fonts — so rich text Excel pooled reads back formatted, not flattened to text.
@@ -9,9 +9,9 @@
9
9
  // rich value a `<si><r>…</r>…</si>` entry carrying its per-run formatting — the rich `<si>` runs Excel
10
10
  // itself writes. A `t="s"` cell then indexes either, and the reader reconstructs the runs, so pooled
11
11
  // rich text round-trips its formatting rather than flattening to text.
12
- import { textElement, XML_DECLARATION } from "../../xml/xml.js";
13
- import { SPREADSHEETML_NS } from "./namespaces.js";
14
- import { richTextRunsXml } from "./rich-text.js";
12
+ import { textElement, XML_DECLARATION } from '../../xml/xml.js';
13
+ import { SPREADSHEETML_NS } from './namespaces.js';
14
+ import { richTextRunsXml } from './rich-text.js';
15
15
  /**
16
16
  * Interns cell string values into the shared-strings pool. {@link intern} returns the index a
17
17
  * `t="s"` cell writes as its `<v>`; identical entries collapse to one, so `count` (total references)
@@ -2,10 +2,10 @@
2
2
  // `<autoFilter>`, and the print settings (`<printOptions>`, `<pageMargins>`, `<pageSetup>`,
3
3
  // `<headerFooter>`, `<rowBreaks>`/`<colBreaks>`). Each renders one CT_Worksheet child (or child
4
4
  // group) independently of the row/cell body `worksheet-xml.ts` orchestrates them alongside.
5
- import { encodeAddress } from "../../core/address.js";
6
- import { SHEET_PROTECTION_FLAGS } from "../../core/protection.js";
7
- import { attr, boolAttr, escapeAttr, escapeText, numberText } from "../../xml/xml.js";
8
- import { colorAttrs } from "./styles.js";
5
+ import { encodeAddress } from '../../core/address.js';
6
+ import { SHEET_PROTECTION_FLAGS } from '../../core/protection.js';
7
+ import { attr, boolAttr, escapeAttr, escapeText, numberText } from '../../xml/xml.js';
8
+ import { colorAttrs } from './styles.js';
9
9
  // `<sheetViews>` holds the sheet's single view. A frozen view adds a `<pane>` recording the split
10
10
  // and a `<selection>` naming the pane the split activates, exactly as Excel writes it — a normal
11
11
  // view carries neither, so unfreezing leaves no leftover `<pane>` that would trip a repair prompt.
@@ -12,12 +12,12 @@
12
12
  // are child elements *of* the xf — so each is interned into the xf signature directly rather than
13
13
  // into its own id table, and an aligned/protected xf carries them as body children in that order.
14
14
  // An unstyled cell/row/column resolves to xf 0.
15
- import { isBorderStyle, isFillPatternType, isFontScheme, isFontVerticalAlignment, isHorizontalAlignment, isNamedUnderlineStyle, isVerticalAlignment, } from "../../core/style.js";
16
- import { TABLE_STYLE_ELEMENT_TYPES } from "../../core/table-style.js";
17
- import { AuthoringError } from "../../errors.js";
18
- import { escapeAttr, XML_DECLARATION } from "../../xml/xml.js";
19
- import { decodeEntities, openElements } from "../../xml/xml-read.js";
20
- import { MARKUP_COMPATIBILITY_NS, SPREADSHEETML_NS } from "./namespaces.js";
15
+ import { isBorderStyle, isFillPatternType, isFontScheme, isFontVerticalAlignment, isHorizontalAlignment, isNamedUnderlineStyle, isVerticalAlignment, } from '../../core/style.js';
16
+ import { TABLE_STYLE_ELEMENT_TYPES } from '../../core/table-style.js';
17
+ import { AuthoringError } from '../../errors.js';
18
+ import { escapeAttr, XML_DECLARATION } from '../../xml/xml.js';
19
+ import { decodeEntities, openElements } from '../../xml/xml-read.js';
20
+ import { MARKUP_COMPATIBILITY_NS, SPREADSHEETML_NS } from './namespaces.js';
21
21
  // Excel reserves fill ids 0 and 1 for the "none" and "gray125" patterns it always emits;
22
22
  // custom fills are numbered from 2 so a foreign reader's built-in assumptions still hold.
23
23
  const RESERVED_FILL_COUNT = 2;
@@ -6,11 +6,11 @@
6
6
  // single top-left cell plus a data-row count. The two are equivalent: the data-row count is the
7
7
  // range height minus the header row (present unless `headerRowCount="0"`) and the totals row (present
8
8
  // only when `totalsRowCount` is positive), so reconstructing one from the other is lossless.
9
- import { decodeRange, encodeAddress } from "../../core/address.js";
10
- import { isTotalsRowFunction, } from "../../core/table.js";
11
- import { boolAttr, escapeAttr, escapeText, XML_DECLARATION } from "../../xml/xml.js";
12
- import { localName, parseXml } from "../../xml/xml-read.js";
13
- import { NS } from "./relationships.js";
9
+ import { decodeRange, encodeAddress } from '../../core/address.js';
10
+ import { isTotalsRowFunction, } from '../../core/table.js';
11
+ import { boolAttr, escapeAttr, escapeText, XML_DECLARATION } from '../../xml/xml.js';
12
+ import { localName, parseXml } from '../../xml/xml-read.js';
13
+ import { NS } from './relationships.js';
14
14
  export function tableXml(table, id) {
15
15
  const name = escapeAttr(table.name);
16
16
  const displayName = escapeAttr(table.displayName);
@@ -24,11 +24,11 @@
24
24
  // timestamp is written from the model, verbatim, so the same workbook always serialises to the same
25
25
  // bytes. A conversation Excel wrote round-trips as itself; one authored in the model carries whatever
26
26
  // ids and dates the caller supplied.
27
- import { decodeAddress } from "../../core/address.js";
28
- import { MENTION_OFFSET_MAX, } from "../../core/comment-thread.js";
29
- import { escapeAttr, escapeText, XML_DECLARATION } from "../../xml/xml.js";
30
- import { boolStrict, localName, parseXml } from "../../xml/xml-read.js";
31
- import { THREADED_COMMENTS_NS } from "./namespaces.js";
27
+ import { decodeAddress } from '../../core/address.js';
28
+ import { MENTION_OFFSET_MAX, } from '../../core/comment-thread.js';
29
+ import { escapeAttr, escapeText, XML_DECLARATION } from '../../xml/xml.js';
30
+ import { boolStrict, localName, parseXml } from '../../xml/xml-read.js';
31
+ import { THREADED_COMMENTS_NS } from './namespaces.js';
32
32
  /**
33
33
  * Parse `xl/persons/person.xml` into its registered authors, in document order. Order carries no
34
34
  * meaning — Excel re-sorts the list by person id when it saves — so nothing may depend on it. An
@@ -1,15 +1,15 @@
1
1
  // Workbook-level serialisation: the package's `[Content_Types].xml`, its root and workbook `.rels`
2
2
  // parts, `xl/workbook.xml` (sheets, defined names, calc/protection settings, pivot-cache and slicer
3
3
  // registrations), and the `docProps` core/app property parts.
4
- import { mangleFormula, quoteSheetName } from "../../core/formula.js";
5
- import { WORKBOOK_PROTECTION_CREDENTIAL_ATTRS } from "../../core/workbook-protection.js";
6
- import { escapeAttr, escapeText, XML_DECLARATION } from "../../xml/xml.js";
7
- import { extensionOf, relativePartPath, THEME_PART_PATH } from "../opc/part-paths.js";
8
- import { relationship, relationshipsPart } from "../opc/rels.js";
9
- import { imageContentType } from "./images.js";
10
- import { SLICER_CACHES_EXT_URI } from "./namespaces.js";
11
- import { NS, REL } from "./relationships.js";
12
- import { x14Ext } from "./x14-ext.js";
4
+ import { mangleFormula, quoteSheetName } from '../../core/formula.js';
5
+ import { WORKBOOK_PROTECTION_CREDENTIAL_ATTRS } from '../../core/workbook-protection.js';
6
+ import { escapeAttr, escapeText, XML_DECLARATION } from '../../xml/xml.js';
7
+ import { extensionOf, relativePartPath, THEME_PART_PATH } from '../opc/part-paths.js';
8
+ import { relationship, relationshipsPart } from '../opc/rels.js';
9
+ import { imageContentType } from './images.js';
10
+ import { SLICER_CACHES_EXT_URI } from './namespaces.js';
11
+ import { NS, REL } from './relationships.js';
12
+ import { x14Ext } from './x14-ext.js';
13
13
  const CT = {
14
14
  workbook: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml',
15
15
  macroEnabledWorkbook: 'application/vnd.ms-excel.sheet.macroEnabled.main+xml',
@@ -4,24 +4,24 @@
4
4
  // planning in `shared-formulas.ts`, each imported here rather than duplicated. Table *parts*
5
5
  // (`xl/tables/tableN.xml`) are `tables.ts`'s concern, alongside their reader — this module only wires
6
6
  // the sheet's `<tableParts>` back-references to them.
7
- import { decodeRange, encodeAddress, MAX_COLUMN } from "../../core/address.js";
8
- import { DEFAULT_DATE_NUMFMT, dateToSerial } from "../../core/date.js";
9
- import { mangleFormula } from "../../core/formula.js";
10
- import { NAMED_STYLE_ID } from "../../core/internal.js";
11
- import { detectValueType, isDataTableFormulaValue, isErrorValue, isFormulaValue, isHyperlinkValue, isRichTextValue, isSharedFormulaValue, } from "../../core/value.js";
12
- import { AuthoringError, InternalError } from "../../errors.js";
13
- import { escapeAttr, escapeText, numberText, textElement, XML_DECLARATION } from "../../xml/xml.js";
14
- import { relativePartPath } from "../opc/part-paths.js";
15
- import { relationship, relationshipsPart } from "../opc/rels.js";
16
- import { conditionalFormattingsExtXml, conditionalFormattingsXml } from "./conditional-formatting.js";
17
- import { dataValidationsExtXml, dataValidationsXml } from "./data-validation.js";
18
- import { hyperlinksXml } from "./hyperlinks.js";
19
- import { SLICER_LIST_EXT_URI } from "./namespaces.js";
20
- import { NS, REL } from "./relationships.js";
21
- import { richTextRunsXml } from "./rich-text.js";
22
- import { planSharedFormulas } from "./shared-formulas.js";
23
- import { autoFilterXml, headerFooterXml, pageBreaksXml, pageMarginsXml, pageSetupXml, printOptionsXml, sheetProtectionXml, sheetPrXml, sheetViewsXml, } from "./sheet-properties.js";
24
- import { x14Ext } from "./x14-ext.js";
7
+ import { decodeRange, encodeAddress, MAX_COLUMN } from '../../core/address.js';
8
+ import { DEFAULT_DATE_NUMFMT, dateToSerial } from '../../core/date.js';
9
+ import { mangleFormula } from '../../core/formula.js';
10
+ import { NAMED_STYLE_ID } from '../../core/internal.js';
11
+ import { detectValueType, isDataTableFormulaValue, isErrorValue, isFormulaValue, isHyperlinkValue, isRichTextValue, isSharedFormulaValue, } from '../../core/value.js';
12
+ import { AuthoringError, InternalError } from '../../errors.js';
13
+ import { escapeAttr, escapeText, numberText, textElement, XML_DECLARATION } from '../../xml/xml.js';
14
+ import { relativePartPath } from '../opc/part-paths.js';
15
+ import { relationship, relationshipsPart } from '../opc/rels.js';
16
+ import { conditionalFormattingsExtXml, conditionalFormattingsXml } from './conditional-formatting.js';
17
+ import { dataValidationsExtXml, dataValidationsXml } from './data-validation.js';
18
+ import { hyperlinksXml } from './hyperlinks.js';
19
+ import { SLICER_LIST_EXT_URI } from './namespaces.js';
20
+ import { NS, REL } from './relationships.js';
21
+ import { richTextRunsXml } from './rich-text.js';
22
+ import { planSharedFormulas } from './shared-formulas.js';
23
+ import { autoFilterXml, headerFooterXml, pageBreaksXml, pageMarginsXml, pageSetupXml, printOptionsXml, sheetProtectionXml, sheetPrXml, sheetViewsXml, } from './sheet-properties.js';
24
+ import { x14Ext } from './x14-ext.js';
25
25
  /**
26
26
  * The used-cell extent of a sheet — the top-left/bottom-right grid bounds that fold into the
27
27
  * `<dimension>`. Rows carrying only formatting (a row height, an outline level) do not extend the
@@ -83,7 +83,7 @@ export declare class WorksheetStreamWriter {
83
83
  * {@link StreamedRow.commit}; the row's `<row>` XML is retained (interned into the workbook's live
84
84
  * style registry so its ids stay valid) and the cell graph is dropped, bounding peak memory.
85
85
  *
86
- * @throws {@link AuthoringError} if the row carries a shared-formula cell — a finished row cannot join the
86
+ * @throws {AuthoringError} if the row carries a shared-formula cell — a finished row cannot join the
87
87
  * whole-sheet formula planning, so shared formulas must be authored through {@link getCell}.
88
88
  */
89
89
  flushRow(number: number, cells: readonly Cell[]): void;
@@ -27,12 +27,12 @@
27
27
  import { createWriteStream } from 'node:fs';
28
28
  import { PassThrough } from 'node:stream';
29
29
  import { Zip, ZipDeflate } from 'fflate';
30
- import { encodeAddress } from "../../core/address.js";
31
- import { INTERNAL } from "../../core/internal.js";
32
- import { isSharedFormulaValue } from "../../core/value.js";
33
- import { Workbook } from "../../core/workbook.js";
34
- import { AuthoringError } from "../../errors.js";
35
- import { buildColumnDefaults, buildPackageParts, createStyleRegistry, Extent, renderRow, } from "./write.js";
30
+ import { encodeAddress } from '../../core/address.js';
31
+ import { INTERNAL } from '../../core/internal.js';
32
+ import { isSharedFormulaValue } from '../../core/value.js';
33
+ import { Workbook } from '../../core/workbook.js';
34
+ import { AuthoringError } from '../../errors.js';
35
+ import { buildColumnDefaults, buildPackageParts, createStyleRegistry, Extent, renderRow, } from './write.js';
36
36
  /**
37
37
  * A row appended to a {@link WorksheetStreamWriter}. Style its cells through {@link cells}, then call
38
38
  * {@link commit} to mark it finished. In an eager (inline-strings) writer, committing serialises the
@@ -132,7 +132,7 @@ export class WorksheetStreamWriter {
132
132
  * {@link StreamedRow.commit}; the row's `<row>` XML is retained (interned into the workbook's live
133
133
  * style registry so its ids stay valid) and the cell graph is dropped, bounding peak memory.
134
134
  *
135
- * @throws {@link AuthoringError} if the row carries a shared-formula cell — a finished row cannot join the
135
+ * @throws {AuthoringError} if the row carries a shared-formula cell — a finished row cannot join the
136
136
  * whole-sheet formula planning, so shared formulas must be authored through {@link getCell}.
137
137
  */
138
138
  flushRow(number, cells) {
@@ -37,7 +37,7 @@ export interface InternalWriteOptions extends WriteOptions {
37
37
  /**
38
38
  * Serialise a workbook into an `.xlsx` package.
39
39
  *
40
- * @throws {@link AuthoringError} if the workbook has no worksheets (a zero-sheet package is corrupt),
40
+ * @throws {AuthoringError} if the workbook has no worksheets (a zero-sheet package is corrupt),
41
41
  * or holds a value the writer cannot yet represent.
42
42
  */
43
43
  export declare function writeXlsx(workbook: Workbook, options?: WriteOptions): Uint8Array;
@@ -56,7 +56,7 @@ export declare function writeXlsx(workbook: Workbook, options?: WriteOptions): U
56
56
  * no worker can take, and the reader's zip-bomb ceiling is enforced by counting output between
57
57
  * synchronous input slices. See ADR-0024.
58
58
  *
59
- * @throws {@link AuthoringError} — as a rejection — under the same conditions as {@link writeXlsx};
59
+ * @throws {AuthoringError} — as a rejection — under the same conditions as {@link writeXlsx};
60
60
  * the part-building it shares happens before any worker is involved. A failure raised by the zip
61
61
  * layer itself (including an environment that cannot spawn a worker) propagates unwrapped, exactly
62
62
  * as it does from {@link writeXlsx}.
@@ -76,6 +76,6 @@ export declare function createStyleRegistry(workbook: Workbook): StyleRegistry;
76
76
  * streaming writer can drive the identical parts through a streamed zip container rather than
77
77
  * `zipSync`. Neither writer duplicates a byte of serialisation.
78
78
  *
79
- * @throws {@link AuthoringError} if the workbook has no worksheets, or holds a value the writer cannot represent.
79
+ * @throws {AuthoringError} if the workbook has no worksheets, or holds a value the writer cannot represent.
80
80
  */
81
81
  export declare function buildPackageParts(workbook: Workbook, options?: InternalWriteOptions): Record<string, Uint8Array>;