@docx4j/core-ts 0.4.0 → 0.6.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 (166) hide show
  1. package/NOTICE +4 -0
  2. package/README.md +34 -3
  3. package/dist/html/convert.mjs +40 -15
  4. package/dist/html/elements.mjs +2 -1
  5. package/dist/model/color/ColorMath.d.mts +29 -0
  6. package/dist/model/color/ColorMath.mjs +146 -0
  7. package/dist/model/color/ColorTables.d.mts +6 -0
  8. package/dist/model/color/ColorTables.mjs +83 -0
  9. package/dist/model/color/DrawingMLColors.d.mts +52 -0
  10. package/dist/model/color/DrawingMLColors.mjs +374 -0
  11. package/dist/model/color/ResolvedColor.d.mts +36 -0
  12. package/dist/model/color/ResolvedColor.mjs +65 -0
  13. package/dist/model/color/SpreadsheetColors.d.mts +36 -0
  14. package/dist/model/color/SpreadsheetColors.mjs +84 -0
  15. package/dist/model/color/StyleFill.d.mts +28 -0
  16. package/dist/model/color/StyleFill.mjs +21 -0
  17. package/dist/model/color/ThemeColors.d.mts +86 -0
  18. package/dist/model/color/ThemeColors.mjs +304 -0
  19. package/dist/model/color/WordColors.d.mts +71 -0
  20. package/dist/model/color/WordColors.mjs +121 -0
  21. package/dist/model/color/index.d.mts +6 -0
  22. package/dist/model/color/index.mjs +30 -0
  23. package/dist/model/content/Body.d.mts +153 -19
  24. package/dist/model/content/Body.mjs +570 -131
  25. package/dist/model/content/Comment.d.mts +21 -3
  26. package/dist/model/content/Comment.mjs +202 -19
  27. package/dist/model/content/ContentControl.d.mts +197 -18
  28. package/dist/model/content/ContentControl.mjs +664 -95
  29. package/dist/model/content/Font.d.mts +67 -17
  30. package/dist/model/content/Font.mjs +114 -35
  31. package/dist/model/content/InlinePicture.d.mts +82 -7
  32. package/dist/model/content/InlinePicture.mjs +221 -28
  33. package/dist/model/content/List.mjs +13 -1
  34. package/dist/model/content/Paragraph.d.mts +213 -14
  35. package/dist/model/content/Paragraph.mjs +936 -100
  36. package/dist/model/content/Range.d.mts +242 -11
  37. package/dist/model/content/Range.mjs +975 -119
  38. package/dist/model/content/ResolvedView.d.mts +104 -0
  39. package/dist/model/content/ResolvedView.mjs +596 -0
  40. package/dist/model/content/Table.d.mts +29 -3
  41. package/dist/model/content/Table.mjs +109 -33
  42. package/dist/model/content/TrackedChange.d.mts +301 -16
  43. package/dist/model/content/TrackedChange.mjs +1284 -158
  44. package/dist/model/content/binder.d.mts +2 -1
  45. package/dist/model/content/binder.mjs +48 -1
  46. package/dist/model/content/comments.d.mts +20 -6
  47. package/dist/model/content/comments.mjs +67 -57
  48. package/dist/model/content/generalException.d.mts +18 -0
  49. package/dist/model/content/generalException.mjs +24 -0
  50. package/dist/model/content/index.d.mts +8 -3
  51. package/dist/model/content/index.mjs +7 -2
  52. package/dist/model/content/mathText.d.mts +21 -0
  53. package/dist/model/content/mathText.mjs +267 -0
  54. package/dist/model/content/officeText.d.mts +27 -0
  55. package/dist/model/content/officeText.mjs +74 -0
  56. package/dist/model/content/outline.d.mts +5 -0
  57. package/dist/model/content/outline.mjs +13 -0
  58. package/dist/model/content/placeholders.d.mts +110 -0
  59. package/dist/model/content/placeholders.mjs +253 -0
  60. package/dist/model/content/relationships.d.mts +30 -0
  61. package/dist/model/content/relationships.mjs +133 -0
  62. package/dist/model/content/search.d.mts +72 -0
  63. package/dist/model/content/search.mjs +204 -2
  64. package/dist/model/content/spanEdits.d.mts +159 -0
  65. package/dist/model/content/spanEdits.mjs +728 -0
  66. package/dist/model/content/story.d.mts +44 -0
  67. package/dist/model/content/story.mjs +92 -0
  68. package/dist/model/content/tableColumns.d.mts +1 -1
  69. package/dist/model/content/tableColumns.mjs +108 -80
  70. package/dist/model/content/tableRevisions.d.mts +11 -3
  71. package/dist/model/content/tableRevisions.mjs +72 -42
  72. package/dist/model/content/tableRules.d.mts +30 -0
  73. package/dist/model/content/tableRules.mjs +100 -0
  74. package/dist/model/content/textBoxes.d.mts +18 -0
  75. package/dist/model/content/textBoxes.mjs +105 -0
  76. package/dist/model/content/trackedChangeFilter.d.mts +39 -0
  77. package/dist/model/content/trackedChangeFilter.mjs +81 -0
  78. package/dist/model/content/tracking.d.mts +28 -0
  79. package/dist/model/content/tracking.mjs +149 -10
  80. package/dist/model/content/tree.d.mts +212 -13
  81. package/dist/model/content/tree.mjs +356 -35
  82. package/dist/model/customxml/CustomXmlPartCollection.d.mts +8 -0
  83. package/dist/model/customxml/CustomXmlPartCollection.mjs +34 -11
  84. package/dist/model/customxml/XmlMapping.d.mts +1 -1
  85. package/dist/model/customxml/XmlMapping.mjs +11 -0
  86. package/dist/model/customxml/bindings.d.mts +21 -2
  87. package/dist/model/customxml/bindings.mjs +76 -32
  88. package/dist/model/customxml/kinds.d.mts +8 -3
  89. package/dist/model/customxml/kinds.mjs +26 -5
  90. package/dist/model/customxml/picturePlaceholder.d.mts +17 -0
  91. package/dist/model/customxml/picturePlaceholder.mjs +32 -0
  92. package/dist/model/customxml/pictures.d.mts +9 -5
  93. package/dist/model/customxml/pictures.mjs +31 -13
  94. package/dist/model/customxml/xhtml.mjs +8 -2
  95. package/dist/model/fonts/families.generated.mjs +2 -2
  96. package/dist/model/fonts/registry.mjs +7 -1
  97. package/dist/model/fonts/substitutions.generated.mjs +2 -2
  98. package/dist/model/fonts/themes.generated.mjs +1 -1
  99. package/dist/model/index.d.mts +2 -0
  100. package/dist/model/index.mjs +4 -0
  101. package/dist/model/listnumbering/Emulator.d.mts +37 -5
  102. package/dist/model/listnumbering/Emulator.mjs +63 -9
  103. package/dist/model/listnumbering/definitions.mjs +18 -0
  104. package/dist/model/properties/PropertyResolver.d.mts +87 -7
  105. package/dist/model/properties/PropertyResolver.mjs +197 -17
  106. package/dist/model/properties/catalogue.d.mts +32 -4
  107. package/dist/model/properties/catalogue.mjs +115 -36
  108. package/dist/model/properties/log.d.mts +1 -1
  109. package/dist/model/properties/log.mjs +5 -5
  110. package/dist/model/properties/table.d.mts +16 -2
  111. package/dist/model/properties/table.mjs +17 -5
  112. package/dist/model/text/Extractor.d.mts +289 -0
  113. package/dist/model/text/Extractor.mjs +2162 -0
  114. package/dist/model/text/LinkTargets.d.mts +45 -0
  115. package/dist/model/text/LinkTargets.mjs +170 -0
  116. package/dist/model/text/MarkdownExporter.d.mts +140 -0
  117. package/dist/model/text/MarkdownExporter.mjs +255 -0
  118. package/dist/model/text/PlainText.d.mts +29 -0
  119. package/dist/model/text/PlainText.mjs +539 -0
  120. package/dist/model/text/TextContext.d.mts +161 -0
  121. package/dist/model/text/TextContext.mjs +425 -0
  122. package/dist/model/text/TextOptions.d.mts +150 -0
  123. package/dist/model/text/TextOptions.mjs +278 -0
  124. package/dist/model/text/TextResult.d.mts +504 -0
  125. package/dist/model/text/TextResult.mjs +526 -0
  126. package/dist/model/text/Texts.d.mts +99 -0
  127. package/dist/model/text/Texts.mjs +187 -0
  128. package/dist/model/text/WmlToMarkdown.d.mts +120 -0
  129. package/dist/model/text/WmlToMarkdown.mjs +911 -0
  130. package/dist/model/text/commonmark.d.mts +121 -0
  131. package/dist/model/text/commonmark.mjs +655 -0
  132. package/dist/model/text/index.d.mts +7 -0
  133. package/dist/model/text/index.mjs +8 -0
  134. package/dist/model/text/normalize.d.mts +8 -0
  135. package/dist/model/text/normalize.mjs +13 -0
  136. package/dist/model/text/outline.d.mts +4 -0
  137. package/dist/model/text/outline.mjs +71 -0
  138. package/dist/office-js/fragment.d.mts +7 -5
  139. package/dist/office-js/fragment.mjs +63 -14
  140. package/dist/office-js/proxy.d.mts +8 -0
  141. package/dist/office-js/proxy.mjs +29 -0
  142. package/dist/office-js/run.mjs +2 -0
  143. package/dist/office-js/supported.generated.mjs +16 -0
  144. package/dist/office-js/toApiScript.mjs +21 -5
  145. package/dist/opc/Load.d.mts +9 -2
  146. package/dist/opc/Save.d.mts +17 -0
  147. package/dist/opc/Save.mjs +12 -2
  148. package/dist/opc/index.d.mts +3 -3
  149. package/dist/opc/index.mjs +2 -2
  150. package/dist/opc/mce/preprocessor.d.mts +88 -7
  151. package/dist/opc/mce/preprocessor.mjs +144 -37
  152. package/dist/opc/mce/understood.d.mts +34 -0
  153. package/dist/opc/mce/understood.mjs +55 -3
  154. package/dist/packages/OpcPackage.d.mts +20 -0
  155. package/dist/packages/OpcPackage.mjs +16 -3
  156. package/dist/packages/WordprocessingMLPackage.d.mts +77 -7
  157. package/dist/packages/WordprocessingMLPackage.mjs +242 -11
  158. package/dist/parts/DefaultXmlPart.mjs +2 -2
  159. package/dist/parts/Part.d.mts +10 -2
  160. package/dist/parts/XmlPart.d.mts +35 -32
  161. package/dist/parts/XmlPart.mjs +107 -107
  162. package/dist/parts/wml/comments.mjs +30 -0
  163. package/dist/parts/wml/index.mjs +12 -0
  164. package/dist/xml/dom.d.mts +7 -0
  165. package/dist/xml/dom.mjs +18 -0
  166. package/package.json +2 -2
@@ -70,12 +70,23 @@ export class Emulator {
70
70
  * to. The style itself, or any style it is based on, counts as the level's own. Direct
71
71
  * formatting is never suppressed: a paragraph whose *own* `w:numPr` names such a level is
72
72
  * numbered.
73
+ *
74
+ * A level which names no style belongs to one all the same: the first paragraph style in
75
+ * styles.xml whose own `w:numPr` names it ({@link levelStyleId}, docx4j 17.3.4, measured in
76
+ * Word 365 on the three documents of docx4j's `LevelOwnerTest`). Of two styles carrying such
77
+ * a level Word numbers the first in styles.xml - whatever their names, whichever the document
78
+ * uses first, whether or not it uses that style at all - and gives the other style's paragraphs
79
+ * no label and no count. They keep the level's indent, which the effective indent already
80
+ * gives them. A paragraph naming no style is the default paragraph style's in this check.
73
81
  */
74
82
  styleLinkedElsewhere(numId, ilvl, pStyleVal) {
75
83
  var _a, _b;
76
- const linked = this.definitions.getLinkedStyleId(numId, ilvl);
84
+ const linked = this.levelStyleId(numId, ilvl);
77
85
  if (linked === undefined || linked === '')
78
86
  return false;
87
+ // a paragraph naming no style is in the default paragraph style, which can own a level
88
+ if (pStyleVal === undefined && this.resolver !== undefined)
89
+ pStyleVal = this.resolver.getDefaultParagraphStyleId();
79
90
  if (pStyleVal === undefined)
80
91
  return true;
81
92
  const seen = new Set();
@@ -89,6 +100,42 @@ export class Emulator {
89
100
  }
90
101
  return true;
91
102
  }
103
+ /**
104
+ * The paragraph style a numbering level belongs to: the one its `w:lvl/w:pStyle` names (the
105
+ * `w:num`'s override level's first, as {@link NumberingDefinitions.getLinkedStyleId} reads it),
106
+ * else the first paragraph style in styles.xml whose own `w:numPr` names a `w:num` on the same
107
+ * `w:abstractNum` at that level (its `w:ilvl`, 0 where it states none). Undefined where neither:
108
+ * no style carries the level, so a paragraph reaches it only through its own `w:numPr`.
109
+ *
110
+ * The level is the `w:abstractNum`'s, not a `w:num`'s: a style reaching it through a second
111
+ * `w:num` is on the same level, even where that `w:num` overrides it with a `w:lvl` of its own.
112
+ * A style's level is its `w:numPr`'s `w:ilvl`, not the level whose `w:pStyle` names it, as Word
113
+ * reads it (ECMA-376 17.9.24 has the naming level). docx4j `Emulator.levelStyleId` (17.3.4).
114
+ *
115
+ * @param numId a `w:numId` (not 0)
116
+ * @param ilvl a `w:ilvl`; undefined or empty for 0
117
+ */
118
+ levelStyleId(numId, ilvl) {
119
+ var _a, _b, _c, _d, _e, _f, _g;
120
+ const linked = this.definitions.getLinkedStyleId(numId, ilvl);
121
+ if (linked !== undefined && linked !== '')
122
+ return linked;
123
+ const abstract = (_a = this.definitions.list(numId)) === null || _a === void 0 ? void 0 : _a.abstractDefinition;
124
+ if (abstract === undefined)
125
+ return undefined;
126
+ const level = ilvl === undefined || ilvl === '' ? '0' : ilvl;
127
+ for (const style of (_c = (_b = this.resolver) === null || _b === void 0 ? void 0 : _b.getStylesInOrder()) !== null && _c !== void 0 ? _c : []) {
128
+ const own = (_d = style.pPr) === null || _d === void 0 ? void 0 : _d.numPr;
129
+ if (style.type !== 'paragraph' || style.styleId === undefined || ((_e = own === null || own === void 0 ? void 0 : own.numId) === null || _e === void 0 ? void 0 : _e.val) === undefined)
130
+ continue;
131
+ if (((_f = this.definitions.list(String(own.numId.val))) === null || _f === void 0 ? void 0 : _f.abstractDefinition) !== abstract)
132
+ continue;
133
+ const ownLevel = ((_g = own.ilvl) === null || _g === void 0 ? void 0 : _g.val) === undefined ? '0' : String(own.ilvl.val);
134
+ if (ownLevel === level)
135
+ return style.styleId;
136
+ }
137
+ return undefined;
138
+ }
92
139
  /**
93
140
  * The one resolution of numId and ilvl for a paragraph. docx4j `Emulator.resolve`
94
141
  * (CR-014 phase 3, which collapsed `getNumber`'s and `getInd`'s two copies onto it).
@@ -171,11 +218,13 @@ export class Emulator {
171
218
  }
172
219
  /**
173
220
  * The numbering reference a paragraph resolves to, without taking a number and without
174
- * touching any state. docx4j `Emulator.numRefFor` (17.1.1); never undefined.
221
+ * touching any state. docx4j `Emulator.numRefFor` (17.1.1); never undefined. A paragraph with
222
+ * no `w:pPr` resolves as an empty one, against the default paragraph style, as
223
+ * {@link getNumber} resolves it (docx4j `c283dffdb`, 17.3.4).
175
224
  */
176
225
  numRefFor(pPr) {
177
226
  if (pPr === undefined)
178
- return NumRef.not('no pPr');
227
+ return this.resolve(undefined, undefined, undefined, false);
179
228
  const [pStyleVal, numId, ilvl] = readNumPr(pPr);
180
229
  return this.resolve(pStyleVal, numId, ilvl, numId !== undefined && numId !== '');
181
230
  }
@@ -184,11 +233,14 @@ export class Emulator {
184
233
  * The next number for a paragraph, from its `w:pPr` (its own `w:numPr`, else its style's),
185
234
  * counted in `state` or in this emulator's default state.
186
235
  *
236
+ * A paragraph with no `w:pPr` resolves as one with an empty `w:pPr` does, against the default
237
+ * paragraph style, which may be numbered (docx4j 17.3.4; before, it was not numbered).
238
+ *
187
239
  * @returns undefined where the paragraph is not numbered
188
240
  */
189
241
  getNumber(pPr, state) {
190
242
  if (pPr === undefined)
191
- return undefined;
243
+ return this.getNumberOf(undefined, undefined, undefined, false, state);
192
244
  const [pStyleVal, numId, ilvl] = readNumPr(pPr);
193
245
  return this.getNumberOf(pStyleVal, numId, ilvl, numId !== undefined && numId !== '', state);
194
246
  }
@@ -280,13 +332,11 @@ export class Emulator {
280
332
  }
281
333
  /**
282
334
  * docx4j `Emulator.numRefFor(wmlPackage, pPr)`: where this paragraph's numbering resolves to,
283
- * before any counting. Never undefined; a package with no numbering part, a null `w:pPr` or
284
- * a package whose `PropertyResolver` has not been built each answer {@link NumRef.notNumbered}
285
- * with the reason.
335
+ * before any counting. Never undefined; a package with no numbering part or a package whose
336
+ * `PropertyResolver` has not been built each answer {@link NumRef.notNumbered} with the reason.
337
+ * A null `w:pPr` resolves as an empty one (docx4j `c283dffdb`, 17.3.4).
286
338
  */
287
339
  static numRefFor(pkg, pPr) {
288
- if (pPr === undefined)
289
- return NumRef.not('no pPr');
290
340
  const part = numberingPartOf(pkg);
291
341
  if (part === undefined)
292
342
  return NumRef.not('no numbering part');
@@ -296,6 +346,10 @@ export class Emulator {
296
346
  }
297
347
  return part.getEmulator().numRefFor(pPr);
298
348
  }
349
+ /** docx4j `Emulator.levelStyleId(numberingPart, numId, levelId)`: the paragraph style a level belongs to. */
350
+ static levelStyleId(part, numId, ilvl) {
351
+ return part.getEmulator().levelStyleId(numId, ilvl);
352
+ }
299
353
  /** docx4j `Emulator.getInd(wmlPackage, pStyleVal, numId, levelId)`. */
300
354
  static getInd(pkg, pStyleVal, numId, ilvl) {
301
355
  var _a;
@@ -1,3 +1,4 @@
1
+ import * as f from '@docx4j/generated-objects-ts/factory/org_docx4j_wml';
1
2
  import { log } from '../properties/log.mjs';
2
3
  import { formatValue } from './formats.mjs';
3
4
  /** How many levels a list definition may have (ECMA-376: `w:ilvl` 0 to 8). */
@@ -216,6 +217,16 @@ export class LevelDefinition {
216
217
  return `LevelDefinition ${this.ilvl} ${(_a = this.numFmt) !== null && _a !== void 0 ? _a : '-'} ${JSON.stringify((_b = this.lvlText) !== null && _b !== void 0 ? _b : '')}`;
217
218
  }
218
219
  }
220
+ /**
221
+ * What Word makes of a `w:lvl` without `w:ilvl`: level 0, with no number. docx4j
222
+ * `ListLevel.emptyLevelZero`; the document's own `w:lvl` is left as it is.
223
+ */
224
+ function emptyLevelZero() {
225
+ const lvl = f.createLvl({ ilvl: 0 });
226
+ lvl.numFmt = f.createNumFmt({ val: 'none' });
227
+ lvl.lvlText = f.createLvlLvlText({ val: '' });
228
+ return lvl;
229
+ }
219
230
  /**
220
231
  * One `w:abstractNum`: its levels, and - where it carries `w:numStyleLink` - the numbering style
221
232
  * whose definition it takes them from. docx4j `AbstractListNumberingDefinition`.
@@ -238,6 +249,13 @@ export class AbstractListDefinition {
238
249
  }
239
250
  /** Adds (or replaces) the level read from this `w:lvl`. docx4j `readLevel`. */
240
251
  readLevel(lvl) {
252
+ if (lvl.ilvl === undefined) {
253
+ // w:ilvl is required. Word reads a w:lvl without it as level 0 and keeps none of its
254
+ // content - no number, no indent - and a later level 0 replaces it as usual (docx4j
255
+ // ListLevel, issue 593 at f6b87cd2f: probes 593-a and 593-b, Word 365, 2026-10-11)
256
+ log.warn('w:lvl without w:ilvl: read as an empty level 0, as Word does');
257
+ lvl = emptyLevelZero();
258
+ }
241
259
  const level = new LevelDefinition(String(lvl.ilvl), lvl);
242
260
  // the REFERENCING abstract list: a w:numStyleLink definition counts on its own (P2)
243
261
  level.abstractNumId = this.id;
@@ -1,6 +1,10 @@
1
1
  import type * as wml from '@docx4j/generated-objects-ts/modules/org_docx4j_wml';
2
+ import type * as dml from '@docx4j/generated-objects-ts/modules/org_docx4j_dml';
2
3
  import { NumberingDefinitions } from '../listnumbering/definitions.mjs';
3
4
  import { CellContext, TableContext } from './table.mjs';
5
+ import { ThemeColors } from '../color/ThemeColors.mjs';
6
+ import type { ResolvedColor } from '../color/ResolvedColor.mjs';
7
+ import { type DefaultTheme, type FontSettings } from '../fonts/defaultTheme.mjs';
4
8
  /** The parts the resolver reads. Structural, so this module imports no part class. */
5
9
  export interface ResolverSource {
6
10
  /** The styles part's `w:styles`, or undefined when the package has none. */
@@ -9,9 +13,14 @@ export interface ResolverSource {
9
13
  numbering?: wml.Numbering;
10
14
  /**
11
15
  * The settings part's `w:settings`, or undefined: read for the compatibility mode and
12
- * `overrideTableStyleFontSizeAndJustification` (CR-007). A document with none is in mode 12.
16
+ * `overrideTableStyleFontSizeAndJustification` (CR-007), and `w:clrSchemeMapping` (CR-008).
17
+ * A document with none is in mode 12.
13
18
  */
14
19
  settings?: wml.CTSettings;
20
+ /** The theme part's `a:theme`, or undefined where the package has none (CR-008). */
21
+ theme?: dml.Theme;
22
+ /** The bundled theme a package with no theme part is read as having; `defaultThemeSetting()`'s where undefined. */
23
+ defaultTheme?: DefaultTheme;
15
24
  }
16
25
  /** As much of an `XmlPart<T>` as the resolver uses. */
17
26
  interface ReadablePart<T> {
@@ -25,7 +34,9 @@ interface PackageLike {
25
34
  styleDefinitionsPart?: ReadablePart<wml.Styles>;
26
35
  numberingDefinitionsPart?: ReadablePart<wml.Numbering>;
27
36
  documentSettingsPart?: ReadablePart<wml.CTSettings>;
37
+ themePart?: ReadablePart<dml.Theme>;
28
38
  };
39
+ fonts?: FontSettings;
29
40
  }
30
41
  /** 108 twips (0.08in): the left and right cell margin of Word's built-in Normal Table. */
31
42
  export declare const WORD_DEFAULT_CELL_MARGIN_TWIPS = 108;
@@ -48,6 +59,8 @@ export declare class PropertyResolver {
48
59
  /** A style's `w:basedOn` chain merged root-first, WITHOUT the document defaults, per style id. */
49
60
  private readonly chainPPrCache;
50
61
  private readonly chainRPrCache;
62
+ /** A character style's chain as it applies to a run, where it differs from its chain: see {@link characterLevel}. */
63
+ private readonly characterLevelCache;
51
64
  /** The document defaults with the chain applied over them: what the style overloads return. */
52
65
  private readonly effectivePPrByStyle;
53
66
  private readonly effectiveRPrByStyle;
@@ -62,6 +75,14 @@ export declare class PropertyResolver {
62
75
  private readonly composedRPrCache;
63
76
  /** See {@link appliesTableStyleSizeJcException}; read once per `refresh()`. */
64
77
  private tableStyleSizeJcException;
78
+ /**
79
+ * Whether the document's own `w:docDefaults` state a size, rather than the 10pt the resolver
80
+ * makes explicit where they do not: the size exception takes the document defaults' size only
81
+ * where they state one. Read once per `refresh()`.
82
+ */
83
+ private docDefaultsStateSize;
84
+ /** Whether a paragraph style and a character style hide a run, by paragraph style then character style (`isVanishedByStyles`). */
85
+ private readonly vanishCache;
65
86
  /** Missing styles are logged once each per resolver. */
66
87
  private readonly missingLogged;
67
88
  private numberingDefinitions;
@@ -98,6 +119,28 @@ export declare class PropertyResolver {
98
119
  * contents replaced. The content API calls it where it creates a style.
99
120
  */
100
121
  refresh(): void;
122
+ private themeColors;
123
+ /**
124
+ * The document's theme colours: its theme part (or the bundled theme `pkg.fonts.defaultTheme` names where it has
125
+ * none) and the settings' `w:clrSchemeMapping`. Read once per `refresh()`. A resolver made `fromSource` with no
126
+ * theme parses the bundled one, which needs the objects package's context built (`ThemeColors.loadDefaultTheme()`).
127
+ */
128
+ getThemeColors(): ThemeColors;
129
+ /**
130
+ * The colour Word draws for a run's `w:color`: its theme reference where it has one (the value beside it is a
131
+ * cache), else its value.
132
+ *
133
+ * @returns undefined for automatic: the caller's default (black text, as a rule)
134
+ */
135
+ resolveColor(color: wml.Color | undefined): ResolvedColor | undefined;
136
+ /** A border's colour, as {@link resolveColor}; undefined for automatic. docx4j `resolveColor(CTBorder)`. */
137
+ resolveBorderColor(border: wml.CTBorder | undefined): ResolvedColor | undefined;
138
+ /** An underline's colour, as {@link resolveColor}; undefined for automatic (the text's). docx4j `resolveColor(U)`. */
139
+ resolveUnderlineColor(u: wml.U | undefined): ResolvedColor | undefined;
140
+ /** A shading's fill (`w:fill`, `w:themeFill`); undefined for automatic. */
141
+ resolveFill(shd: wml.CTShd | undefined): ResolvedColor | undefined;
142
+ /** A shading's pattern colour (`w:color`, `w:themeColor`); undefined for automatic. */
143
+ resolvePatternColor(shd: wml.CTShd | undefined): ResolvedColor | undefined;
101
144
  getDocumentDefaultPPr(): wml.PPr;
102
145
  getDocumentDefaultRPr(): wml.RPr;
103
146
  /** The style id of the `w:default="1"` paragraph style, or undefined when the part declares none. */
@@ -106,6 +149,13 @@ export declare class PropertyResolver {
106
149
  getResolvedDefaultParagraphStyle(): wml.PPr;
107
150
  /** The style with this id, or undefined (docx4j `getStyle`). */
108
151
  getStyle(styleId: string | undefined): wml.Style | undefined;
152
+ /**
153
+ * The styles part's `w:style` elements in document order, from the tree this resolver reads (its
154
+ * private copy, or the part's own once that is unmarshalled); empty where there is no styles part.
155
+ * docx4j reads `StyleDefinitionsPart.getJaxbElement().getStyle()` where order matters
156
+ * (`Emulator.levelStyleId`: the first paragraph style in styles.xml carrying a level owns it).
157
+ */
158
+ getStylesInOrder(): readonly wml.Style[];
109
159
  /**
110
160
  * The list definitions of the numbering part this resolver read (CR-001 Phase B step 3), or
111
161
  * undefined where the package has none. The resolver builds them because the paragraph merge
@@ -132,6 +182,13 @@ export declare class PropertyResolver {
132
182
  * object: copy before changing.
133
183
  */
134
184
  getChainRPr(styleId: string | undefined): wml.RPr;
185
+ /**
186
+ * A character style's chain as a level over a run or a paragraph mark: {@link getChainRPr} without its highlight,
187
+ * since Word draws no highlight from a character style (docx4j CR-060 section 13, round 6: alone, with bold, or
188
+ * through `w:basedOn`; its save writes `w:highlight="none"` on such a run). A paragraph style's highlight and a
189
+ * run's own are drawn. docx4j `characterLevel` (1d1b824a9). Cached; live: copy before changing.
190
+ */
191
+ private characterLevel;
135
192
  /**
136
193
  * A style's own `w:pPr` as a layer of its chain. The built-in heading styles have a fixed
137
194
  * outline level, which Word takes from the style's built-in NAME ("heading 1" ...
@@ -193,6 +250,14 @@ export declare class PropertyResolver {
193
250
  * context resolves exactly as `getEffectiveRPr(rPr, pPr)`. A new object each call.
194
251
  */
195
252
  getEffectiveRPr(rPr: wml.RPr | undefined, pPr: wml.PPr | undefined, cellContext: CellContext | undefined): wml.RPr;
253
+ /**
254
+ * Whether a run with no `w:vanish` of its own is hidden by its styles: the effective `w:vanish` of its
255
+ * paragraph style (undefined: the default paragraph style) and its character style, the table style left
256
+ * out, as the text model's hidden rule has it (REQ-507). What `Paragraph.text` leaves out, as Office JS
257
+ * does (CR-012 phase 4, check 48b case 20). Cached per pair; a pair naming a style the part lacks is
258
+ * not cached, so that adding the style is seen.
259
+ */
260
+ isVanishedByStyles(paragraphStyleId: string | undefined, runStyleId: string | undefined): boolean;
196
261
  private effectiveRPrOfStyle;
197
262
  /**
198
263
  * The character style's chain, then the direct formatting.
@@ -205,10 +270,18 @@ export declare class PropertyResolver {
205
270
  private applyCharacterStyleAndDirect;
206
271
  /**
207
272
  * The run properties of the paragraph mark: document defaults, the paragraph style's run
208
- * properties, then the `w:pPr`'s own `w:rPr`. What sizes an empty paragraph, and what a list
209
- * label starts from.
273
+ * properties, the mark's character style, then the `w:pPr`'s own `w:rPr`. What sizes an empty
274
+ * paragraph, and what a list label starts from.
210
275
  */
211
276
  getEffectiveParagraphMarkRPr(pPr: wml.PPr | undefined, cellContext?: CellContext | undefined): wml.RPr;
277
+ /**
278
+ * The paragraph mark's character style (`w:pPr/w:rPr/w:rStyle`) as a level over what is
279
+ * beneath it, then the mark's direct formatting: the order {@link applyCharacterStyleAndDirect}
280
+ * gives a run. docx4j `applyMarkRPr`, since 17.3.2 (fb2a764f7: until then the mark's
281
+ * `w:rStyle` was copied as an attribute and never resolved, so an empty paragraph whose mark
282
+ * names a 9pt character style was sized at its paragraph style's 12pt).
283
+ */
284
+ private applyMarkRPr;
212
285
  /** Whether the run states any formatting of its own (docx4j's deprecated `hasDirectRPrFormatting`). */
213
286
  hasDirectRPrFormatting(rPr: wml.RPr | undefined): boolean;
214
287
  /**
@@ -282,6 +355,12 @@ export declare class PropertyResolver {
282
355
  * is quadratic.
283
356
  */
284
357
  cellContextOf(p: wml.P): CellContext | undefined;
358
+ /**
359
+ * Whether a paragraph in this context is composed over its table level: where the table style
360
+ * gives it text formatting, or, under [MS-DOCX]'s size exception, where the style formats text
361
+ * anywhere ({@link CellContext.styleFormatsText}). docx4j `composes` (900b6a212, 17.3.2).
362
+ */
363
+ private composes;
285
364
  private clearTableCaches;
286
365
  /** The table level's `w:pPr`: the style's own, then its conditional formats'; undefined if none. */
287
366
  private tableLevelPPr;
@@ -290,10 +369,11 @@ export declare class PropertyResolver {
290
369
  private composedPPr;
291
370
  private composedRPr;
292
371
  /**
293
- * [MS-DOCX]'s exception, for a paragraph in a table whose style states a size (or a
294
- * justification): the paragraph's style gives way to it if the style is the default paragraph
295
- * style, or states no size (justification) of its own, and resolves to 12pt (left). A style of
296
- * the paragraph's own which states one keeps it.
372
+ * [MS-DOCX]'s exception, for a paragraph in a table whose style formats text (for the size: the
373
+ * style need not state one, since docx4j 17.3.2) or states a justification: the paragraph's
374
+ * style gives way to it if the style is the default paragraph style, or states no size
375
+ * (justification) of its own, and resolves to 12pt (left). A style of the paragraph's own which
376
+ * states one keeps it.
297
377
  */
298
378
  private paragraphStyleGivesWay;
299
379
  /** Word's built-in Normal Table, as a style: what it applies whatever the document's own definition says. */