@shbernal/ts-xlsx 3.1.0 → 3.2.0

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 (214) hide show
  1. package/README.md +30 -23
  2. package/dist/bytes.d.ts +3 -2
  3. package/dist/core/address.d.ts +36 -0
  4. package/dist/core/address.js +47 -9
  5. package/dist/core/array-formula-ranges.d.ts +33 -0
  6. package/dist/core/array-formula-ranges.js +62 -0
  7. package/dist/core/color-resolution.js +2 -2
  8. package/dist/core/column.js +3 -2
  9. package/dist/core/comment-thread.d.ts +7 -3
  10. package/dist/core/conditional-formatting-overlay.d.ts +9 -0
  11. package/dist/core/conditional-formatting-overlay.js +28 -1
  12. package/dist/core/conditional-formatting.d.ts +98 -10
  13. package/dist/core/conditional-formatting.js +42 -1
  14. package/dist/core/data-validation-overlay.d.ts +5 -0
  15. package/dist/core/data-validation-overlay.js +15 -0
  16. package/dist/core/data-validation.d.ts +16 -0
  17. package/dist/core/data-validation.js +15 -0
  18. package/dist/core/date-format.js +14 -4
  19. package/dist/core/date.js +1 -1
  20. package/dist/core/formula-references.d.ts +26 -0
  21. package/dist/core/formula-references.js +173 -0
  22. package/dist/core/formula-scan.d.ts +2 -0
  23. package/dist/core/formula-scan.js +58 -0
  24. package/dist/core/formula.d.ts +51 -18
  25. package/dist/core/formula.js +77 -86
  26. package/dist/core/function-values.d.ts +4 -0
  27. package/dist/core/function-values.js +58 -0
  28. package/dist/core/future-functions.d.ts +3 -0
  29. package/dist/core/{modern-functions.js → future-functions.js} +119 -88
  30. package/dist/core/grid-edits.d.ts +28 -0
  31. package/dist/core/grid-edits.js +193 -25
  32. package/dist/core/hyperlink.d.ts +39 -0
  33. package/dist/core/hyperlink.js +88 -0
  34. package/dist/core/image.d.ts +36 -5
  35. package/dist/core/image.js +9 -0
  36. package/dist/core/internal.d.ts +3 -1
  37. package/dist/core/limits.d.ts +5 -3
  38. package/dist/core/merge.d.ts +13 -0
  39. package/dist/core/merge.js +15 -1
  40. package/dist/core/page-setup.d.ts +26 -11
  41. package/dist/core/pivot-table.d.ts +49 -10
  42. package/dist/core/pivot-table.js +55 -21
  43. package/dist/core/protection.d.ts +66 -4
  44. package/dist/core/protection.js +4 -0
  45. package/dist/core/row.js +3 -2
  46. package/dist/core/structured-reference.d.ts +7 -0
  47. package/dist/core/structured-reference.js +7 -0
  48. package/dist/core/table.d.ts +38 -8
  49. package/dist/core/table.js +37 -7
  50. package/dist/core/theme.d.ts +2 -0
  51. package/dist/core/theme.js +4 -1
  52. package/dist/core/value.d.ts +51 -28
  53. package/dist/core/value.js +15 -12
  54. package/dist/core/workbook-styles.d.ts +17 -1
  55. package/dist/core/workbook-styles.js +4 -0
  56. package/dist/core/workbook-theme.js +5 -3
  57. package/dist/core/workbook.d.ts +20 -3
  58. package/dist/core/workbook.js +26 -5
  59. package/dist/core/worksheet-merges.d.ts +9 -4
  60. package/dist/core/worksheet-merges.js +17 -11
  61. package/dist/core/worksheet-model.d.ts +1 -1
  62. package/dist/core/worksheet-model.js +4 -0
  63. package/dist/core/worksheet-pictures.d.ts +3 -3
  64. package/dist/core/worksheet-pictures.js +7 -6
  65. package/dist/core/worksheet.d.ts +110 -21
  66. package/dist/core/worksheet.js +174 -49
  67. package/dist/entries/core.d.ts +7 -5
  68. package/dist/entries/core.js +4 -3
  69. package/dist/entries/errors.d.ts +1 -0
  70. package/dist/entries/errors.js +1 -0
  71. package/dist/errors.js +1 -1
  72. package/dist/io/cell-metadata/metadata.d.ts +42 -0
  73. package/dist/io/cell-metadata/metadata.js +35 -0
  74. package/dist/io/cell-metadata/rich-values.d.ts +11 -0
  75. package/dist/io/cell-metadata/rich-values.js +80 -0
  76. package/dist/io/csv/delimiter.d.ts +14 -2
  77. package/dist/io/csv/delimiter.js +12 -0
  78. package/dist/io/csv/errors.d.ts +14 -0
  79. package/dist/io/csv/errors.js +5 -0
  80. package/dist/io/csv/read.d.ts +6 -1
  81. package/dist/io/csv/read.js +46 -24
  82. package/dist/io/csv/write.d.ts +10 -3
  83. package/dist/io/csv/write.js +16 -7
  84. package/dist/io/opc/part-paths.js +4 -4
  85. package/dist/io/opc/read-opc.d.ts +4 -0
  86. package/dist/io/opc/read-opc.js +10 -4
  87. package/dist/io/opc/strict-relationships.d.ts +2 -0
  88. package/dist/io/opc/strict-relationships.js +12 -0
  89. package/dist/io/read-policy/column-budget.d.ts +26 -0
  90. package/dist/io/{xlsx → read-policy}/column-budget.js +4 -8
  91. package/dist/io/read-policy/read-repair.d.ts +74 -0
  92. package/dist/io/read-policy/read-repair.js +119 -0
  93. package/dist/io/style/cell-style-resolution.d.ts +25 -0
  94. package/dist/io/style/cell-style-resolution.js +30 -0
  95. package/dist/io/xlsb/formula.js +4 -2
  96. package/dist/io/xlsb/ptg-functions.js +110 -0
  97. package/dist/io/xlsb/read-metadata.d.ts +7 -0
  98. package/dist/io/xlsb/read-metadata.js +69 -0
  99. package/dist/io/xlsb/read-worksheet.d.ts +6 -0
  100. package/dist/io/xlsb/read-worksheet.js +95 -37
  101. package/dist/io/xlsb/read.js +26 -8
  102. package/dist/io/xlsb/record-types.d.ts +13 -0
  103. package/dist/io/xlsb/record-types.js +13 -0
  104. package/dist/io/xlsb/sheet-protection.d.ts +20 -0
  105. package/dist/io/xlsb/sheet-protection.js +60 -0
  106. package/dist/io/xlsx/cell-accumulator.d.ts +20 -12
  107. package/dist/io/xlsx/cell-accumulator.js +49 -19
  108. package/dist/io/xlsx/cell-metadata.d.ts +39 -0
  109. package/dist/io/xlsx/cell-metadata.js +162 -0
  110. package/dist/io/xlsx/cell-value.d.ts +16 -4
  111. package/dist/io/xlsx/cell-value.js +38 -21
  112. package/dist/io/xlsx/color-xml.js +1 -1
  113. package/dist/io/xlsx/column-span.d.ts +11 -0
  114. package/dist/io/xlsx/column-span.js +9 -0
  115. package/dist/io/xlsx/comments.d.ts +3 -28
  116. package/dist/io/xlsx/comments.js +3 -65
  117. package/dist/io/xlsx/conditional-formatting.d.ts +42 -25
  118. package/dist/io/xlsx/conditional-formatting.js +424 -129
  119. package/dist/io/xlsx/data-validation.d.ts +12 -7
  120. package/dist/io/xlsx/data-validation.js +41 -29
  121. package/dist/io/xlsx/edit-vba.js +43 -36
  122. package/dist/io/xlsx/hyperlinks.d.ts +16 -50
  123. package/dist/io/xlsx/hyperlinks.js +8 -37
  124. package/dist/io/xlsx/images.d.ts +49 -16
  125. package/dist/io/xlsx/images.js +145 -44
  126. package/dist/io/xlsx/namespaces.d.ts +8 -0
  127. package/dist/io/xlsx/namespaces.js +4 -0
  128. package/dist/io/xlsx/package-plan.d.ts +48 -15
  129. package/dist/io/xlsx/package-plan.js +46 -9
  130. package/dist/io/xlsx/part-names.d.ts +6 -8
  131. package/dist/io/xlsx/part-names.js +3 -7
  132. package/dist/io/xlsx/pivot.d.ts +5 -5
  133. package/dist/io/xlsx/pivot.js +23 -22
  134. package/dist/io/xlsx/preserved-splices.d.ts +6 -0
  135. package/dist/io/xlsx/preserved-splices.js +74 -0
  136. package/dist/io/xlsx/read-comments.d.ts +29 -0
  137. package/dist/io/xlsx/read-comments.js +75 -0
  138. package/dist/io/xlsx/read-parts.d.ts +2 -2
  139. package/dist/io/xlsx/read-parts.js +44 -37
  140. package/dist/io/xlsx/read-pivot.js +9 -3
  141. package/dist/io/xlsx/read-rich-runs.d.ts +8 -5
  142. package/dist/io/xlsx/read-rich-runs.js +18 -1
  143. package/dist/io/xlsx/read-rows.d.ts +18 -7
  144. package/dist/io/xlsx/read-rows.js +47 -37
  145. package/dist/io/xlsx/read-styles.d.ts +0 -25
  146. package/dist/io/xlsx/read-styles.js +39 -34
  147. package/dist/io/xlsx/read-workbook-xml.d.ts +6 -0
  148. package/dist/io/xlsx/read-workbook-xml.js +9 -4
  149. package/dist/io/xlsx/read-worksheet.d.ts +8 -3
  150. package/dist/io/xlsx/read-worksheet.js +45 -23
  151. package/dist/io/xlsx/read.d.ts +0 -4
  152. package/dist/io/xlsx/read.js +17 -21
  153. package/dist/io/xlsx/relationships.d.ts +3 -0
  154. package/dist/io/xlsx/relationships.js +4 -0
  155. package/dist/io/xlsx/row-position.d.ts +3 -1
  156. package/dist/io/xlsx/row-xml.d.ts +18 -7
  157. package/dist/io/xlsx/row-xml.js +54 -35
  158. package/dist/io/xlsx/sheet-properties.js +68 -42
  159. package/dist/io/xlsx/strict-parts.d.ts +7 -0
  160. package/dist/io/xlsx/strict-parts.js +171 -0
  161. package/dist/io/xlsx/style-elements.d.ts +0 -2
  162. package/dist/io/xlsx/style-elements.js +9 -29
  163. package/dist/io/xlsx/styles.d.ts +5 -0
  164. package/dist/io/xlsx/styles.js +11 -5
  165. package/dist/io/xlsx/tables.d.ts +10 -2
  166. package/dist/io/xlsx/tables.js +49 -42
  167. package/dist/io/xlsx/theme-xml.d.ts +6 -0
  168. package/dist/io/xlsx/theme-xml.js +16 -19
  169. package/dist/io/xlsx/threaded-comments.d.ts +6 -1
  170. package/dist/io/xlsx/threaded-comments.js +14 -7
  171. package/dist/io/xlsx/workbook-xml.d.ts +13 -24
  172. package/dist/io/xlsx/workbook-xml.js +15 -33
  173. package/dist/io/xlsx/worksheet-xml.d.ts +5 -2
  174. package/dist/io/xlsx/worksheet-xml.js +37 -69
  175. package/dist/io/xlsx/write-stream.d.ts +28 -6
  176. package/dist/io/xlsx/write-stream.js +42 -17
  177. package/dist/io/xlsx/write.d.ts +11 -4
  178. package/dist/io/xlsx/write.js +153 -90
  179. package/dist/rel-type.d.ts +9 -0
  180. package/dist/rel-type.js +3 -0
  181. package/dist/vba/bytes.d.ts +2 -0
  182. package/dist/vba/bytes.js +11 -0
  183. package/dist/vba/cfb-format.d.ts +47 -0
  184. package/dist/vba/cfb-format.js +34 -0
  185. package/dist/vba/cfb-writer.d.ts +1 -2
  186. package/dist/vba/cfb-writer.js +33 -36
  187. package/dist/vba/cfb.d.ts +9 -4
  188. package/dist/vba/cfb.js +55 -43
  189. package/dist/vba/dir-records.d.ts +6 -0
  190. package/dist/vba/dir-records.js +10 -2
  191. package/dist/vba/errors.d.ts +4 -4
  192. package/dist/vba/index.d.ts +0 -2
  193. package/dist/vba/index.js +0 -2
  194. package/dist/vba/ms-ovba.d.ts +6 -2
  195. package/dist/vba/ms-ovba.js +15 -6
  196. package/dist/vba/project-editor.js +102 -87
  197. package/dist/vba/project.d.ts +4 -0
  198. package/dist/vba/project.js +12 -6
  199. package/dist/vba/vba-encoding.d.ts +4 -10
  200. package/dist/vba/vba-encoding.js +2 -15
  201. package/dist/xml/xml-read.d.ts +29 -1
  202. package/dist/xml/xml-read.js +56 -0
  203. package/dist/xml/xml-scan.d.ts +13 -0
  204. package/dist/xml/xml-scan.js +58 -7
  205. package/dist/xml/xml.d.ts +33 -1
  206. package/dist/xml/xml.js +22 -0
  207. package/package.json +5 -4
  208. package/skills/ts-xlsx-upstream/SKILL.md +21 -13
  209. package/dist/core/modern-functions.d.ts +0 -1
  210. package/dist/io/xlsx/cell-style-resolution.d.ts +0 -25
  211. package/dist/io/xlsx/cell-style-resolution.js +0 -29
  212. package/dist/io/xlsx/column-budget.d.ts +0 -26
  213. package/dist/io/xlsx/read-repair.d.ts +0 -26
  214. package/dist/io/xlsx/read-repair.js +0 -39
@@ -5,7 +5,7 @@ import { numberText } from '../../xml/xml.js';
5
5
  function normalizeArgb(argb) {
6
6
  const rgb = parseArgb(argb);
7
7
  if (rgb === undefined) {
8
- throw new SyntaxError(`Invalid ARGB colour ${quoted(argb)}: expected 6 or 8 hexadecimal digits`);
8
+ throw new SyntaxError(`invalid ARGB colour ${quoted(argb)}: expected 6 or 8 hexadecimal digits`);
9
9
  }
10
10
  return rgb;
11
11
  }
@@ -0,0 +1,11 @@
1
+ import type { XmlAttributes } from '../../xml/xml-scan.ts';
2
+ import { type ColumnRecordBudget } from '../read-policy/column-budget.ts';
3
+ /**
4
+ * The columns a `<col min max>` element actually applies to, or `undefined` for one that applies to
5
+ * none: unreadable bounds, or anything {@link clampColumnSpan} refuses. Both XML worksheet readers
6
+ * ask this, so the two cannot read one `<col>` as covering different columns.
7
+ */
8
+ export declare function takeColumnSpan(attrs: XmlAttributes, budget: ColumnRecordBudget): {
9
+ first: number;
10
+ last: number;
11
+ } | undefined;
@@ -0,0 +1,9 @@
1
+ import { numInteger } from '../../xml/xml-attrs.js';
2
+ import { clampColumnSpan } from '../read-policy/column-budget.js';
3
+ export function takeColumnSpan(attrs, budget) {
4
+ const first = numInteger(attrs.min, 1);
5
+ const last = numInteger(attrs.max, 1);
6
+ if (first === undefined || last === undefined)
7
+ return undefined;
8
+ return clampColumnSpan(first, last, budget);
9
+ }
@@ -48,31 +48,6 @@ export declare function commentsXml(comments: readonly CommentCell[]): string;
48
48
  * pixel-exact layout. A thread's fallback shape is `ObjectType="Note"` like any other: Excel draws the
49
49
  * threaded-comment card itself and only needs the shape to exist. */
50
50
  export declare function vmlDrawingXml(comments: readonly CommentCell[]): string;
51
- /** One `<comment>` read back from a comments part. */
52
- export interface ParsedComment {
53
- readonly text: string;
54
- /**
55
- * The thread head id this comment is the legacy fallback for, read off its synthetic `tc={headId}`
56
- * author; absent for a user's own note.
57
- */
58
- readonly threadId?: string;
59
- }
60
- /**
61
- * Parse a `comments{n}.xml` part into a map of A1 reference → comment. Text runs within one comment are
62
- * concatenated; an author-name run is Excel's own convention and is not stripped, so a note reads back
63
- * as exactly the text that was written.
64
- */
65
- export declare function parseComments(xml: string): Map<string, ParsedComment>;
66
- /**
67
- * Apply a parsed comments part onto a sheet's cells as notes, addressing each by its A1 reference.
68
- *
69
- * A thread's legacy fallback is not a note and does not become one: its text is boilerplate wrapping a
70
- * copy of the conversation, so surfacing it as `cell.note` hands the caller garbage, and on write it
71
- * would be re-emitted as a plain note, destroying the `tc=`/`xr:uid` binding and leaving Excel unable to
72
- * see the thread at all.
73
- *
74
- * Suppressed only for a conversation the reader actually holds: a file whose thread part is missing or
75
- * damaged has nothing else left, so there the boilerplate is kept rather than the content lost. Call
76
- * after the sheet's threads are restored, since that is what this reads to decide.
77
- */
78
- export declare function applyNotes(sheet: Worksheet, comments: ReadonlyMap<string, ParsedComment>): void;
51
+ /** Every cell a sheet still holds, row-major: what the writer gathers a sheet's notes from, beside the
52
+ * notes the streaming writer took off the rows it already flushed. */
53
+ export declare function liveCells(sheet: Worksheet): Generator<Cell, void, undefined>;
@@ -1,7 +1,4 @@
1
1
  import { tryDecodeCellRef } from '../../core/address.js';
2
- import { decodeSpreadsheetText, numInteger } from '../../xml/xml-attrs.js';
3
- import { parseXml, TextCapture } from '../../xml/xml-read.js';
4
- import { localName } from '../../xml/xml-scan.js';
5
2
  import { escapeText, textAttr, textElement, XML_DECLARATION } from '../../xml/xml.js';
6
3
  import { MARKUP_COMPATIBILITY_NS, REVISION_NS, SPREADSHEETML_NS } from './namespaces.js';
7
4
  export function collectComments(cells, threads, alreadyCollected = []) {
@@ -108,66 +105,7 @@ export function vmlDrawingXml(comments) {
108
105
  .join('');
109
106
  return `${VML_HEADER}${shapes}</xml>`;
110
107
  }
111
- const COMMENT_EMPTY_CLOSES = new Set(['author', 'text']);
112
- const THREAD_AUTHOR_PREFIX = 'tc=';
113
- export function parseComments(xml) {
114
- const comments = new Map();
115
- const authors = [];
116
- let currentRef;
117
- let currentAuthorId;
118
- const capture = new TextCapture(['author', 'text']);
119
- let body = '';
120
- parseXml(xml, {
121
- onOpen(name, attrs, selfClosing) {
122
- const local = localName(name);
123
- if (local === 'comment') {
124
- currentRef = attrs.ref;
125
- currentAuthorId = attrs.authorId;
126
- body = '';
127
- }
128
- capture.open(local, selfClosing);
129
- },
130
- onText(text) {
131
- capture.text(text);
132
- },
133
- onClose(name) {
134
- const local = localName(name);
135
- const text = capture.close(local);
136
- if (local === 'author') {
137
- authors.push(text ?? '');
138
- }
139
- else if (local === 'text') {
140
- body = decodeSpreadsheetText(text ?? '');
141
- }
142
- else if (local === 'comment' && currentRef !== undefined) {
143
- const threadId = threadIdOf(authors[numInteger(currentAuthorId, 0) ?? -1]);
144
- comments.set(currentRef, {
145
- text: body,
146
- ...(threadId !== undefined ? { threadId } : {}),
147
- });
148
- currentRef = undefined;
149
- currentAuthorId = undefined;
150
- }
151
- },
152
- }, { closeEmptyElements: COMMENT_EMPTY_CLOSES });
153
- return comments;
154
- }
155
- function threadIdOf(author) {
156
- if (author === undefined || !author.startsWith(THREAD_AUTHOR_PREFIX))
157
- return undefined;
158
- const id = author.slice(THREAD_AUTHOR_PREFIX.length);
159
- return id === '' ? undefined : id;
160
- }
161
- export function applyNotes(sheet, comments) {
162
- const headIds = new Set(sheet.commentThreads.flatMap((thread) => {
163
- const head = thread.comments[0];
164
- return head === undefined ? [] : [head.id];
165
- }));
166
- for (const [ref, comment] of comments) {
167
- if (comment.threadId !== undefined && headIds.has(comment.threadId))
168
- continue;
169
- if (tryDecodeCellRef(ref) === undefined)
170
- continue;
171
- sheet.getCell(ref).note = comment.text;
172
- }
108
+ export function* liveCells(sheet) {
109
+ for (const { cells } of sheet.rows())
110
+ yield* cells;
173
111
  }
@@ -1,36 +1,53 @@
1
1
  import { type ConditionalFormatting, type ConditionalFormattingRule } from '../../core/conditional-formatting.ts';
2
+ import type { Worksheet } from '../../core/worksheet.ts';
2
3
  import { type CollectingPass } from '../../xml/xml-read.ts';
3
4
  import type { StyleRegistry } from './styles.ts';
4
- /** Each extended data bar's link id, keyed by rule identity: the one map both passes are handed. */
5
- export type DataBarExtLinks = ReadonlyMap<ConditionalFormattingRule, string>;
6
- export declare function dataBarExtLinks(formattings: readonly ConditionalFormatting[]): DataBarExtLinks;
7
5
  /**
8
- * Serialise every conditional formatting on a sheet into its `<conditionalFormatting>` blocks, in
9
- * insertion order. Returns '' when the sheet has none. A rule missing a `priority` is assigned the
10
- * next free one, so the output always satisfies Excel's requirement that every cfRule carry one.
6
+ * What the classic pass and the extension pass must agree on about a sheet's conditional formats,
7
+ * decided once and handed to both. A classic data bar's link and the `<x14:cfRule>` it names have to
8
+ * carry one id, and two rules in different forms must not be numbered alike, and each pass deriving its
9
+ * half itself makes both agreements hold by the two walks happening to visit the rules in one order.
11
10
  */
12
- export declare function conditionalFormattingsXml(formattings: readonly ConditionalFormatting[], styles: StyleRegistry, extLinks: DataBarExtLinks): string;
11
+ export interface ConditionalFormattingPlan {
12
+ /** Every rule's priority: its own, or the next one free after every priority before it. */
13
+ readonly priorities: ReadonlyMap<ConditionalFormattingRule, number>;
14
+ /**
15
+ * The id of every rule with an `<x14:cfRule>`: a rule written wholly in the extension, and a classic
16
+ * data bar whose extra facets ride there. A rule absent from the map needs no extension.
17
+ */
18
+ readonly extensionIds: ReadonlyMap<ConditionalFormattingRule, string>;
19
+ }
20
+ /** Plan a sheet's conditional formats, in insertion order, for both serialisers. */
21
+ export declare function planConditionalFormatting(formattings: readonly ConditionalFormatting[]): ConditionalFormattingPlan;
13
22
  /**
14
- * The worksheet `<extLst>` `<ext>` carrying the x14 data-bar extensions, or '' when no data bar needs
15
- * one. Each extension's `<x14:cfRule id>` is read from the same {@link dataBarExtLinks} map the classic
16
- * pass uses for the `<x14:id>` its cfRule carries, so the two ends of a link always match. Emitted bare
17
- * (no `<extLst>` wrapper) so the worksheet serialiser can gather it into a single `<extLst>` beside the
18
- * data-validation extension.
23
+ * Serialise the classic `<conditionalFormatting>` blocks of a sheet, in insertion order, leaving out
24
+ * every rule {@link conditionalFormattingsExtXml} writes in the extension form. Returns '' when no rule
25
+ * remains.
26
+ *
27
+ * A rule's formulas, its operands and a `formula` anchor alike, are stored with the function prefixes
28
+ * a cell formula takes, as Excel stores them; `formulaNames` is `formulaNamesInScope` for the sheet.
19
29
  */
20
- export declare function conditionalFormattingsExtXml(formattings: readonly ConditionalFormatting[], extLinks: DataBarExtLinks): string;
30
+ export declare function conditionalFormattingsXml(formattings: readonly ConditionalFormatting[], styles: StyleRegistry, plan: ConditionalFormattingPlan, formulaNames: ReadonlySet<string>): string;
21
31
  /**
22
- * A pass reading a worksheet's conditional formatting into the model. The classic `<conditionalFormatting>`
23
- * blocks supply every rule; the x14 extension (`<x14:conditionalFormatting>` inside `<extLst>`) is
24
- * read only to enrich a classic data bar with the facets the classic element cannot carry (the
25
- * gradient flag and the negative-fill and axis colours) matched by the shared id the two ends link
26
- * on. An extension rule with no classic counterpart (a rule that lives only in x14) is ignored, so it
27
- * is never half-read into a broken classic rule.
32
+ * The worksheet `<extLst>` `<ext>` carrying the sheet's extension-form conditional formats, or '' when
33
+ * it needs none: every rule written wholly there, grouped under its set's range, and every classic data
34
+ * bar's extra facets, under the id the plan gave the link its cfRule carries. Emitted bare (no
35
+ * `<extLst>` wrapper) so the worksheet serialiser can gather it into a single `<extLst>` beside the
36
+ * data-validation extension.
28
37
  */
29
- export declare function conditionalFormattingPass(): CollectingPass<ConditionalFormatting[]>;
38
+ export declare function conditionalFormattingsExtXml(formattings: readonly ConditionalFormatting[], styles: StyleRegistry, plan: ConditionalFormattingPlan, formulaNames: ReadonlySet<string>): string;
30
39
  /**
31
- * Extract the differential-style (`<dxf>`) fragments from styles.xml, each verbatim. Preserving the
32
- * raw XML, rather than reparsing and re-serialising, is what keeps a foreign dxf's number format a
33
- * real format code on re-write instead of a coerced `"[object Object]"`, and keeps every conditional
34
- * formatting's `dxfId` index pointing at the same style it did in the source file.
40
+ * A pass reading a worksheet's conditional formatting into the model, from both forms.
41
+ *
42
+ * The classic `<conditionalFormatting>` blocks come first. Each `<x14:conditionalFormatting>` in the
43
+ * worksheet extension that follows them is read as a set of its own, marked `extended`, unless its rule
44
+ * is a data bar a classic rule links to by id: that one only completes the classic rule with the facets
45
+ * and automatic anchors the classic element cannot carry. An extension rule's inline style is handed to
46
+ * `adoptDifferentialStyle`, which answers the index the rule then holds as its `dxfId`.
47
+ *
48
+ * A rule's formulas shed their function prefixes as a cell formula's do, against `definedNames`, the
49
+ * workbook's names as `definedNameKeys` spells them.
35
50
  */
36
- export declare function parseDxfs(stylesXml: string): string[];
51
+ export declare function conditionalFormattingPass(definedNames: ReadonlySet<string>, adoptDifferentialStyle: (fragment: string) => number): CollectingPass<ConditionalFormatting[]>;
52
+ /** Fold parsed conditional formattings onto a sheet, each bound to its original range. */
53
+ export declare function applyConditionalFormattings(sheet: Worksheet, blocks: readonly ConditionalFormatting[]): void;