@stll/docx-core 0.4.0 → 0.5.1

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.
@@ -12,10 +12,15 @@ type ThemeColorSlot = "dk1" | "lt1" | "dk2" | "lt2" | "accent1" | "accent2" | "a
12
12
  * Color value - can be direct RGB, theme reference, or auto
13
13
  */
14
14
  type ColorValue = {
15
- /** RGB hex value without # (e.g., "FF0000") */rgb?: string; /** Theme color slot reference */
16
- themeColor?: ThemeColorSlot; /** Tint modifier (0-255 as hex string, e.g., "80") - makes color lighter */
17
- themeTint?: string; /** Shade modifier (0-255 as hex string) - makes color darker */
18
- themeShade?: string; /** Auto color - context-dependent (usually black for text) */
15
+ /** RGB hex value without # (e.g., "FF0000") */
16
+ rgb?: string;
17
+ /** Theme color slot reference */
18
+ themeColor?: ThemeColorSlot;
19
+ /** Tint modifier (0-255 as hex string, e.g., "80") - makes color lighter */
20
+ themeTint?: string;
21
+ /** Shade modifier (0-255 as hex string) - makes color darker */
22
+ themeShade?: string;
23
+ /** Auto color - context-dependent (usually black for text) */
19
24
  auto?: boolean;
20
25
  };
21
26
  type KnownBorderStyle = "none" | "single" | "double" | "dotted" | "dashed" | "thick" | "triple" | "thinThickSmallGap" | "thickThinSmallGap" | "thinThickMediumGap" | "thickThinMediumGap" | "thinThickLargeGap" | "thickThinLargeGap" | "wave" | "doubleWave" | "dashSmallGap" | "dashDotStroked" | "threeDEmboss" | "threeDEngrave" | "outset" | "inset" | "nil";
@@ -23,28 +28,41 @@ type KnownBorderStyle = "none" | "single" | "double" | "dotted" | "dashed" | "th
23
28
  * Border specification for any border (paragraph, table, page)
24
29
  */
25
30
  type BorderSpec = {
26
- /** Border style. Unknown OOXML styles are preserved for fallback rendering. */style: string; /** Color of the border */
27
- color?: ColorValue; /** Width in eighths of a point (1/8 pt) */
28
- size?: number; /** Spacing from text in points */
29
- space?: number; /** Shadow effect */
30
- shadow?: boolean; /** Frame effect */
31
+ /** Border style. Unknown OOXML styles are preserved for fallback rendering. */
32
+ style: string;
33
+ /** Color of the border */
34
+ color?: ColorValue;
35
+ /** Width in eighths of a point (1/8 pt) */
36
+ size?: number;
37
+ /** Spacing from text in points */
38
+ space?: number;
39
+ /** Shadow effect */
40
+ shadow?: boolean;
41
+ /** Frame effect */
31
42
  frame?: boolean;
32
43
  /**
33
44
  * Custom page-border art relationship id (`w:id` on `<w:pgBorders>` side
34
45
  * children). Preserved for round-trip; folio does not paint art glyphs.
35
46
  */
36
- artRelationshipId?: string; /** Custom page-border art relationship id for the top-left corner. */
37
- topLeftArtRelationshipId?: string; /** Custom page-border art relationship id for the top-right corner. */
38
- topRightArtRelationshipId?: string; /** Custom page-border art relationship id for the bottom-left corner. */
39
- bottomLeftArtRelationshipId?: string; /** Custom page-border art relationship id for the bottom-right corner. */
47
+ artRelationshipId?: string;
48
+ /** Custom page-border art relationship id for the top-left corner. */
49
+ topLeftArtRelationshipId?: string;
50
+ /** Custom page-border art relationship id for the top-right corner. */
51
+ topRightArtRelationshipId?: string;
52
+ /** Custom page-border art relationship id for the bottom-left corner. */
53
+ bottomLeftArtRelationshipId?: string;
54
+ /** Custom page-border art relationship id for the bottom-right corner. */
40
55
  bottomRightArtRelationshipId?: string;
41
56
  };
42
57
  /**
43
58
  * Shading/background properties
44
59
  */
45
60
  type ShadingProperties = {
46
- /** Pattern fill color */color?: ColorValue; /** Background fill color */
47
- fill?: ColorValue; /** Shading pattern type */
61
+ /** Pattern fill color */
62
+ color?: ColorValue;
63
+ /** Background fill color */
64
+ fill?: ColorValue;
65
+ /** Shading pattern type */
48
66
  pattern?: "clear" | "solid" | "horzStripe" | "vertStripe" | "reverseDiagStripe" | "diagStripe" | "horzCross" | "diagCross" | "thinHorzStripe" | "thinVertStripe" | "thinReverseDiagStripe" | "thinDiagStripe" | "thinHorzCross" | "thinDiagCross" | "pct5" | "pct10" | "pct12" | "pct15" | "pct20" | "pct25" | "pct30" | "pct35" | "pct37" | "pct40" | "pct45" | "pct50" | "pct55" | "pct60" | "pct62" | "pct65" | "pct70" | "pct75" | "pct80" | "pct85" | "pct87" | "pct90" | "pct95" | "nil";
49
67
  };
50
68
  //#endregion
@@ -65,52 +83,86 @@ type EmphasisMark = "none" | "dot" | "comma" | "circle" | "underDot";
65
83
  * Complete text formatting properties (w:rPr)
66
84
  */
67
85
  type TextFormatting = {
68
- /** Bold (w:b) */bold?: boolean; /** Bold complex script (w:bCs) */
69
- boldCs?: boolean; /** Italic (w:i) */
70
- italic?: boolean; /** Italic complex script (w:iCs) */
71
- italicCs?: boolean; /** Underline style and color (w:u) */
86
+ /** Bold (w:b) */
87
+ bold?: boolean;
88
+ /** Bold complex script (w:bCs) */
89
+ boldCs?: boolean;
90
+ /** Italic (w:i) */
91
+ italic?: boolean;
92
+ /** Italic complex script (w:iCs) */
93
+ italicCs?: boolean;
94
+ /** Underline style and color (w:u) */
72
95
  underline?: {
73
96
  style: UnderlineStyle;
74
97
  color?: ColorValue;
75
- }; /** Strikethrough (w:strike) */
76
- strike?: boolean; /** Double strikethrough (w:dstrike) */
77
- doubleStrike?: boolean; /** Superscript/subscript (w:vertAlign) */
78
- vertAlign?: "baseline" | "superscript" | "subscript"; /** Small caps (w:smallCaps) */
79
- smallCaps?: boolean; /** All caps (w:caps) */
80
- allCaps?: boolean; /** Hidden text (w:vanish) */
81
- hidden?: boolean; /** Text color (w:color) */
82
- color?: ColorValue; /** Highlight/background color (w:highlight) */
83
- highlight?: "black" | "blue" | "cyan" | "darkBlue" | "darkCyan" | "darkGray" | "darkGreen" | "darkMagenta" | "darkRed" | "darkYellow" | "green" | "lightGray" | "magenta" | "none" | "red" | "white" | "yellow"; /** Character shading (w:shd) */
84
- shading?: ShadingProperties; /** Font size in half-points (w:sz) - e.g., 24 = 12pt */
85
- fontSize?: number; /** Font size complex script (w:szCs) */
86
- fontSizeCs?: number; /** Font family (w:rFonts) */
98
+ };
99
+ /** Strikethrough (w:strike) */
100
+ strike?: boolean;
101
+ /** Double strikethrough (w:dstrike) */
102
+ doubleStrike?: boolean;
103
+ /** Superscript/subscript (w:vertAlign) */
104
+ vertAlign?: "baseline" | "superscript" | "subscript";
105
+ /** Small caps (w:smallCaps) */
106
+ smallCaps?: boolean;
107
+ /** All caps (w:caps) */
108
+ allCaps?: boolean;
109
+ /** Hidden text (w:vanish) */
110
+ hidden?: boolean;
111
+ /** Text color (w:color) */
112
+ color?: ColorValue;
113
+ /** Highlight/background color (w:highlight) */
114
+ highlight?: "black" | "blue" | "cyan" | "darkBlue" | "darkCyan" | "darkGray" | "darkGreen" | "darkMagenta" | "darkRed" | "darkYellow" | "green" | "lightGray" | "magenta" | "none" | "red" | "white" | "yellow";
115
+ /** Character shading (w:shd) */
116
+ shading?: ShadingProperties;
117
+ /** Font size in half-points (w:sz) - e.g., 24 = 12pt */
118
+ fontSize?: number;
119
+ /** Font size complex script (w:szCs) */
120
+ fontSizeCs?: number;
121
+ /** Font family (w:rFonts) */
87
122
  fontFamily?: {
88
123
  ascii?: string;
89
124
  hAnsi?: string;
90
125
  eastAsia?: string;
91
- cs?: string; /** Theme font reference */
126
+ cs?: string;
127
+ /** Script slot Word should prefer when selecting a glyph font (w:hint). */
128
+ hint?: "default" | "eastAsia" | "cs";
129
+ /** Theme font reference */
92
130
  asciiTheme?: "majorAscii" | "majorHAnsi" | "majorEastAsia" | "majorBidi" | "minorAscii" | "minorHAnsi" | "minorEastAsia" | "minorBidi";
93
131
  hAnsiTheme?: string;
94
132
  eastAsiaTheme?: string;
95
133
  csTheme?: string;
96
- }; /** Run language metadata (`w:lang`) used by spelling and line breaking. */
134
+ };
135
+ /** Run language metadata (`w:lang`) used by spelling and line breaking. */
97
136
  language?: {
98
137
  val?: string;
99
138
  eastAsia?: string;
100
139
  bidi?: string;
101
- }; /** Character spacing in twips (w:spacing) */
102
- spacing?: number; /** Raised/lowered text position in half-points (w:position) */
103
- position?: number; /** Horizontal text scale percentage (w:w) */
104
- scale?: number; /** Kerning threshold in half-points (w:kern) */
105
- kerning?: number; /** Text effect animation (w:effect) */
106
- effect?: TextEffect; /** Emphasis mark (w:em) */
107
- emphasisMark?: EmphasisMark; /** Emboss effect (w:emboss) */
108
- emboss?: boolean; /** Imprint/engrave effect (w:imprint) */
109
- imprint?: boolean; /** Outline effect (w:outline) */
110
- outline?: boolean; /** Shadow effect (w:shadow) */
111
- shadow?: boolean; /** Right-to-left text (w:rtl) */
112
- rtl?: boolean; /** Complex script formatting (w:cs) */
113
- cs?: boolean; /** Character style ID (w:rStyle) */
140
+ };
141
+ /** Character spacing in twips (w:spacing) */
142
+ spacing?: number;
143
+ /** Raised/lowered text position in half-points (w:position) */
144
+ position?: number;
145
+ /** Horizontal text scale percentage (w:w) */
146
+ scale?: number;
147
+ /** Kerning threshold in half-points (w:kern) */
148
+ kerning?: number;
149
+ /** Text effect animation (w:effect) */
150
+ effect?: TextEffect;
151
+ /** Emphasis mark (w:em) */
152
+ emphasisMark?: EmphasisMark;
153
+ /** Emboss effect (w:emboss) */
154
+ emboss?: boolean;
155
+ /** Imprint/engrave effect (w:imprint) */
156
+ imprint?: boolean;
157
+ /** Outline effect (w:outline) */
158
+ outline?: boolean;
159
+ /** Shadow effect (w:shadow) */
160
+ shadow?: boolean;
161
+ /** Right-to-left text (w:rtl) */
162
+ rtl?: boolean;
163
+ /** Complex script formatting (w:cs) */
164
+ cs?: boolean;
165
+ /** Character style ID (w:rStyle) */
114
166
  styleId?: string;
115
167
  };
116
168
  /**
@@ -125,8 +177,11 @@ type TabLeader = "none" | "dot" | "hyphen" | "underscore" | "heavy" | "middleDot
125
177
  * Tab stop definition
126
178
  */
127
179
  type TabStop = {
128
- /** Position in twips from left margin */position: number; /** Alignment at tab stop */
129
- alignment: TabStopAlignment; /** Leader character */
180
+ /** Position in twips from left margin */
181
+ position: number;
182
+ /** Alignment at tab stop */
183
+ alignment: TabStopAlignment;
184
+ /** Leader character */
130
185
  leader?: TabLeader;
131
186
  };
132
187
  /**
@@ -145,22 +200,39 @@ type SpacingExplicit = {
145
200
  after?: boolean;
146
201
  };
147
202
  type ParagraphFormatting = {
148
- /** Paragraph alignment (w:jc) */alignment?: ParagraphAlignment; /** Text direction (w:bidi) */
149
- bidi?: boolean; /** Apply East Asian first/last-character line-breaking rules (w:kinsoku). */
150
- kinsoku?: boolean; /** Allow punctuation to hang beyond the text margin (w:overflowPunct). */
151
- overflowPunctuation?: boolean; /** Spacing before in twips (w:spacing/@w:before) */
152
- spaceBefore?: number; /** Spacing after in twips (w:spacing/@w:after) */
153
- spaceAfter?: number; /** Line spacing value (w:spacing/@w:line) */
154
- lineSpacing?: number; /** Line spacing rule (w:spacing/@w:lineRule) */
155
- lineSpacingRule?: LineSpacingRule; /** Whether the paragraph participates in the section document grid (w:snapToGrid). */
156
- snapToGrid?: boolean; /** Auto space before (w:spacing/@w:beforeAutospacing) */
157
- beforeAutospacing?: boolean; /** Auto space after (w:spacing/@w:afterAutospacing) */
158
- afterAutospacing?: boolean; /** Which spacing sides came from this paragraph's own pPr. */
159
- spacingExplicit?: SpacingExplicit; /** Left indent in twips (w:ind/@w:left) */
160
- indentLeft?: number; /** Right indent in twips (w:ind/@w:right) */
161
- indentRight?: number; /** First line indent in twips - positive for indent, negative for hanging (w:ind/@w:firstLine or @w:hanging) */
162
- indentFirstLine?: number; /** Whether first line is hanging indent */
163
- hangingIndent?: boolean; /** Paragraph borders (w:pBdr) */
203
+ /** Paragraph alignment (w:jc) */
204
+ alignment?: ParagraphAlignment;
205
+ /** Text direction (w:bidi) */
206
+ bidi?: boolean;
207
+ /** Apply East Asian first/last-character line-breaking rules (w:kinsoku). */
208
+ kinsoku?: boolean;
209
+ /** Allow punctuation to hang beyond the text margin (w:overflowPunct). */
210
+ overflowPunctuation?: boolean;
211
+ /** Spacing before in twips (w:spacing/@w:before) */
212
+ spaceBefore?: number;
213
+ /** Spacing after in twips (w:spacing/@w:after) */
214
+ spaceAfter?: number;
215
+ /** Line spacing value (w:spacing/@w:line) */
216
+ lineSpacing?: number;
217
+ /** Line spacing rule (w:spacing/@w:lineRule) */
218
+ lineSpacingRule?: LineSpacingRule;
219
+ /** Whether the paragraph participates in the section document grid (w:snapToGrid). */
220
+ snapToGrid?: boolean;
221
+ /** Auto space before (w:spacing/@w:beforeAutospacing) */
222
+ beforeAutospacing?: boolean;
223
+ /** Auto space after (w:spacing/@w:afterAutospacing) */
224
+ afterAutospacing?: boolean;
225
+ /** Which spacing sides came from this paragraph's own pPr. */
226
+ spacingExplicit?: SpacingExplicit;
227
+ /** Left indent in twips (w:ind/@w:left) */
228
+ indentLeft?: number;
229
+ /** Right indent in twips (w:ind/@w:right) */
230
+ indentRight?: number;
231
+ /** First line indent in twips - positive for indent, negative for hanging (w:ind/@w:firstLine or @w:hanging) */
232
+ indentFirstLine?: number;
233
+ /** Whether first line is hanging indent */
234
+ hangingIndent?: boolean;
235
+ /** Paragraph borders (w:pBdr) */
164
236
  borders?: {
165
237
  top?: BorderSpec;
166
238
  bottom?: BorderSpec;
@@ -168,16 +240,26 @@ type ParagraphFormatting = {
168
240
  right?: BorderSpec;
169
241
  between?: BorderSpec;
170
242
  bar?: BorderSpec;
171
- }; /** Paragraph shading (w:shd) */
172
- shading?: ShadingProperties; /** Custom tab stops (w:tabs) */
173
- tabs?: TabStop[]; /** Keep with next paragraph (w:keepNext) */
174
- keepNext?: boolean; /** Keep lines together (w:keepLines) */
175
- keepLines?: boolean; /** Widow/orphan control (w:widowControl) */
176
- widowControl?: boolean; /** Page break before (w:pageBreakBefore) */
177
- pageBreakBefore?: boolean; /** Contextual spacing — suppress space between paragraphs of the same style (w:contextualSpacing) */
178
- contextualSpacing?: boolean; /** Numbering properties (w:numPr) */
243
+ };
244
+ /** Paragraph shading (w:shd) */
245
+ shading?: ShadingProperties;
246
+ /** Custom tab stops (w:tabs) */
247
+ tabs?: TabStop[];
248
+ /** Keep with next paragraph (w:keepNext) */
249
+ keepNext?: boolean;
250
+ /** Keep lines together (w:keepLines) */
251
+ keepLines?: boolean;
252
+ /** Widow/orphan control (w:widowControl) */
253
+ widowControl?: boolean;
254
+ /** Page break before (w:pageBreakBefore) */
255
+ pageBreakBefore?: boolean;
256
+ /** Contextual spacing — suppress space between paragraphs of the same style (w:contextualSpacing) */
257
+ contextualSpacing?: boolean;
258
+ /** Numbering properties (w:numPr) */
179
259
  numPr?: {
180
- /** Numbering definition ID (w:numId) */numId?: number; /** List level (0-8) (w:ilvl) */
260
+ /** Numbering definition ID (w:numId) */
261
+ numId?: number;
262
+ /** List level (0-8) (w:ilvl) */
181
263
  ilvl?: number;
182
264
  };
183
265
  /**
@@ -192,9 +274,12 @@ type ParagraphFormatting = {
192
274
  numPrFromStyle?: {
193
275
  numId?: number;
194
276
  ilvl?: number;
195
- }; /** Outline level 0-9 (w:outlineLvl) */
196
- outlineLevel?: number; /** Paragraph style ID (w:pStyle) */
197
- styleId?: string; /** Text frame properties (w:framePr) */
277
+ };
278
+ /** Outline level 0-9 (w:outlineLvl) */
279
+ outlineLevel?: number;
280
+ /** Paragraph style ID (w:pStyle) */
281
+ styleId?: string;
282
+ /** Text frame properties (w:framePr) */
198
283
  frame?: {
199
284
  dropCap?: "none" | "drop" | "margin";
200
285
  lines?: number;
@@ -209,9 +294,12 @@ type ParagraphFormatting = {
209
294
  xAlign?: "left" | "center" | "right" | "inside" | "outside";
210
295
  yAlign?: "top" | "center" | "bottom" | "inside" | "outside" | "inline";
211
296
  wrap?: "around" | "auto" | "none" | "notBeside" | "through" | "tight";
212
- }; /** Suppress line numbers (w:suppressLineNumbers) */
213
- suppressLineNumbers?: boolean; /** Suppress auto hyphens (w:suppressAutoHyphens) */
214
- suppressAutoHyphens?: boolean; /** Run properties to apply to all runs (w:rPr) */
297
+ };
298
+ /** Suppress line numbers (w:suppressLineNumbers) */
299
+ suppressLineNumbers?: boolean;
300
+ /** Suppress auto hyphens (w:suppressAutoHyphens) */
301
+ suppressAutoHyphens?: boolean;
302
+ /** Run properties to apply to all runs (w:rPr) */
215
303
  runProperties?: TextFormatting;
216
304
  /**
217
305
  * Run-in heading: this paragraph's mark carries `<w:specVanish/>`
@@ -227,7 +315,9 @@ type TableWidthType = "auto" | "dxa" | "nil" | "pct";
227
315
  * Table measurement (width or height)
228
316
  */
229
317
  type TableMeasurement = {
230
- /** Value in twips (for dxa) or fifths of a percent (for pct) */value: number; /** Measurement type */
318
+ /** Value in twips (for dxa) or fifths of a percent (for pct) */
319
+ value: number;
320
+ /** Measurement type */
231
321
  type: TableWidthType;
232
322
  };
233
323
  /**
@@ -273,12 +363,17 @@ type TableLook = {
273
363
  * Floating table properties
274
364
  */
275
365
  type FloatingTableProperties = {
276
- /** Horizontal anchor */horzAnchor?: "margin" | "page" | "text"; /** Vertical anchor */
277
- vertAnchor?: "margin" | "page" | "text"; /** Horizontal position */
366
+ /** Horizontal anchor */
367
+ horzAnchor?: "margin" | "page" | "text";
368
+ /** Vertical anchor */
369
+ vertAnchor?: "margin" | "page" | "text";
370
+ /** Horizontal position */
278
371
  tblpX?: number;
279
- tblpXSpec?: "left" | "center" | "right" | "inside" | "outside"; /** Vertical position */
372
+ tblpXSpec?: "left" | "center" | "right" | "inside" | "outside";
373
+ /** Vertical position */
280
374
  tblpY?: number;
281
- tblpYSpec?: "top" | "center" | "bottom" | "inside" | "outside" | "inline"; /** Distance from surrounding text */
375
+ tblpYSpec?: "top" | "center" | "bottom" | "inside" | "outside" | "inline";
376
+ /** Distance from surrounding text */
282
377
  topFromText?: number;
283
378
  bottomFromText?: number;
284
379
  leftFromText?: number;
@@ -288,68 +383,116 @@ type FloatingTableProperties = {
288
383
  * Table formatting properties (w:tblPr)
289
384
  */
290
385
  type TableFormatting = {
291
- /** Table width */width?: TableMeasurement; /** Table justification */
292
- justification?: "left" | "center" | "right"; /** Cell spacing */
293
- cellSpacing?: TableMeasurement; /** Table indent from left margin */
294
- indent?: TableMeasurement; /** Table borders */
295
- borders?: TableBorders; /** Default cell margins */
296
- cellMargins?: CellMargins; /** Table layout */
297
- layout?: "fixed" | "autofit"; /** Table style ID */
298
- styleId?: string; /** Table look (conditional formatting flags) */
299
- look?: TableLook; /** Shading/background */
300
- shading?: ShadingProperties; /** Overlap for floating tables */
301
- overlap?: "never" | "overlap"; /** Floating table properties */
302
- floating?: FloatingTableProperties; /** Right to left table */
386
+ /** Table width */
387
+ width?: TableMeasurement;
388
+ /** Table justification */
389
+ justification?: "left" | "center" | "right";
390
+ /** Cell spacing */
391
+ cellSpacing?: TableMeasurement;
392
+ /** Table indent from left margin */
393
+ indent?: TableMeasurement;
394
+ /** Table borders */
395
+ borders?: TableBorders;
396
+ /** Default cell margins */
397
+ cellMargins?: CellMargins;
398
+ /** Table layout */
399
+ layout?: "fixed" | "autofit";
400
+ /** Table style ID */
401
+ styleId?: string;
402
+ /** Table look (conditional formatting flags) */
403
+ look?: TableLook;
404
+ /** Shading/background */
405
+ shading?: ShadingProperties;
406
+ /** Overlap for floating tables */
407
+ overlap?: "never" | "overlap";
408
+ /** Floating table properties */
409
+ floating?: FloatingTableProperties;
410
+ /** Right to left table */
303
411
  bidi?: boolean;
304
412
  };
305
413
  /**
306
414
  * Table row formatting properties (w:trPr)
307
415
  */
308
416
  type TableRowFormatting = {
309
- /** Number of table grid columns omitted before the first cell */gridBefore?: number; /** Preferred width of the omitted leading grid columns */
310
- widthBefore?: TableMeasurement; /** Number of table grid columns omitted after the last cell */
311
- gridAfter?: number; /** Preferred width of the omitted trailing grid columns */
312
- widthAfter?: TableMeasurement; /** Row height */
313
- height?: TableMeasurement; /** Height rule */
314
- heightRule?: "auto" | "atLeast" | "exact"; /** Header row (repeats on each page) */
315
- header?: boolean; /** Allow row to break across pages */
316
- cantSplit?: boolean; /** Row justification */
317
- justification?: "left" | "center" | "right"; /** Hidden row */
318
- hidden?: boolean; /** Conditional format style */
417
+ /** Number of table grid columns omitted before the first cell */
418
+ gridBefore?: number;
419
+ /** Preferred width of the omitted leading grid columns */
420
+ widthBefore?: TableMeasurement;
421
+ /** Number of table grid columns omitted after the last cell */
422
+ gridAfter?: number;
423
+ /** Preferred width of the omitted trailing grid columns */
424
+ widthAfter?: TableMeasurement;
425
+ /** Row height */
426
+ height?: TableMeasurement;
427
+ /** Height rule */
428
+ heightRule?: "auto" | "atLeast" | "exact";
429
+ /** Header row (repeats on each page) */
430
+ header?: boolean;
431
+ /** Allow row to break across pages */
432
+ cantSplit?: boolean;
433
+ /** Row justification */
434
+ justification?: "left" | "center" | "right";
435
+ /** Hidden row */
436
+ hidden?: boolean;
437
+ /** Conditional format style */
319
438
  conditionalFormat?: ConditionalFormatStyle;
320
439
  };
321
440
  /**
322
441
  * Conditional format style
323
442
  */
324
443
  type ConditionalFormatStyle = {
325
- /** First row */firstRow?: boolean; /** Last row */
326
- lastRow?: boolean; /** First column */
327
- firstColumn?: boolean; /** Last column */
328
- lastColumn?: boolean; /** Odd horizontal band */
329
- oddHBand?: boolean; /** Even horizontal band */
330
- evenHBand?: boolean; /** Odd vertical band */
331
- oddVBand?: boolean; /** Even vertical band */
332
- evenVBand?: boolean; /** Northwest corner */
333
- nwCell?: boolean; /** Northeast corner */
334
- neCell?: boolean; /** Southwest corner */
335
- swCell?: boolean; /** Southeast corner */
444
+ /** First row */
445
+ firstRow?: boolean;
446
+ /** Last row */
447
+ lastRow?: boolean;
448
+ /** First column */
449
+ firstColumn?: boolean;
450
+ /** Last column */
451
+ lastColumn?: boolean;
452
+ /** Odd horizontal band */
453
+ oddHBand?: boolean;
454
+ /** Even horizontal band */
455
+ evenHBand?: boolean;
456
+ /** Odd vertical band */
457
+ oddVBand?: boolean;
458
+ /** Even vertical band */
459
+ evenVBand?: boolean;
460
+ /** Northwest corner */
461
+ nwCell?: boolean;
462
+ /** Northeast corner */
463
+ neCell?: boolean;
464
+ /** Southwest corner */
465
+ swCell?: boolean;
466
+ /** Southeast corner */
336
467
  seCell?: boolean;
337
468
  };
338
469
  /**
339
470
  * Table cell formatting properties (w:tcPr)
340
471
  */
341
472
  type TableCellFormatting = {
342
- /** Cell width */width?: TableMeasurement; /** Cell borders */
343
- borders?: TableCellBorders; /** Cell margins (override table default) */
344
- margins?: CellMargins; /** Cell shading/background */
345
- shading?: ShadingProperties; /** Vertical alignment */
346
- verticalAlign?: "top" | "center" | "bottom"; /** Text direction */
347
- textDirection?: "lr" | "lrV" | "rl" | "rlV" | "tb" | "tbV" | "tbRl" | "tbRlV" | "btLr"; /** Grid span (horizontal merge) */
348
- gridSpan?: number; /** Vertical merge */
349
- vMerge?: "restart" | "continue"; /** Fit text to cell width */
350
- fitText?: boolean; /** Wrap text */
351
- noWrap?: boolean; /** Hide cell marker */
352
- hideMark?: boolean; /** Conditional format style */
473
+ /** Cell width */
474
+ width?: TableMeasurement;
475
+ /** Cell borders */
476
+ borders?: TableCellBorders;
477
+ /** Cell margins (override table default) */
478
+ margins?: CellMargins;
479
+ /** Cell shading/background */
480
+ shading?: ShadingProperties;
481
+ /** Vertical alignment */
482
+ verticalAlign?: "top" | "center" | "bottom";
483
+ /** Text direction */
484
+ textDirection?: "lr" | "lrV" | "rl" | "rlV" | "tb" | "tbV" | "tbRl" | "tbRlV" | "btLr";
485
+ /** Grid span (horizontal merge) */
486
+ gridSpan?: number;
487
+ /** Vertical merge */
488
+ vMerge?: "restart" | "continue";
489
+ /** Fit text to cell width */
490
+ fitText?: boolean;
491
+ /** Wrap text */
492
+ noWrap?: boolean;
493
+ /** Hide cell marker */
494
+ hideMark?: boolean;
495
+ /** Conditional format style */
353
496
  conditionalFormat?: ConditionalFormatStyle;
354
497
  };
355
498
  //#endregion
@@ -366,16 +509,27 @@ type LevelSuffix = "tab" | "space" | "nothing";
366
509
  * List level definition
367
510
  */
368
511
  type ListLevel = {
369
- /** Level index (0-8) */ilvl: number; /** Starting number */
370
- start?: number; /** Number format */
371
- numFmt: NumberFormat; /** Level text (e.g., "%1." or "•") */
372
- lvlText: string; /** Justification */
373
- lvlJc?: "left" | "center" | "right"; /** Suffix after number */
374
- suffix?: LevelSuffix; /** Paragraph properties for this level */
375
- pPr?: ParagraphFormatting; /** Run properties for the number/bullet */
376
- rPr?: TextFormatting; /** Restart numbering from higher level */
377
- lvlRestart?: number; /** Is legal numbering style */
378
- isLgl?: boolean; /** Legacy settings */
512
+ /** Level index (0-8) */
513
+ ilvl: number;
514
+ /** Starting number */
515
+ start?: number;
516
+ /** Number format */
517
+ numFmt: NumberFormat;
518
+ /** Level text (e.g., "%1." or "•") */
519
+ lvlText: string;
520
+ /** Justification */
521
+ lvlJc?: "left" | "center" | "right";
522
+ /** Suffix after number */
523
+ suffix?: LevelSuffix;
524
+ /** Paragraph properties for this level */
525
+ pPr?: ParagraphFormatting;
526
+ /** Run properties for the number/bullet */
527
+ rPr?: TextFormatting;
528
+ /** Restart numbering from higher level */
529
+ lvlRestart?: number;
530
+ /** Is legal numbering style */
531
+ isLgl?: boolean;
532
+ /** Legacy settings */
379
533
  legacy?: {
380
534
  legacy?: boolean;
381
535
  legacySpace?: number;
@@ -386,19 +540,28 @@ type ListLevel = {
386
540
  * Abstract numbering definition (w:abstractNum)
387
541
  */
388
542
  type AbstractNumbering = {
389
- /** Abstract numbering ID */abstractNumId: number; /** Multi-level type */
390
- multiLevelType?: "hybridMultilevel" | "multilevel" | "singleLevel"; /** Numbering style link */
391
- numStyleLink?: string; /** Style link */
392
- styleLink?: string; /** Level definitions */
393
- levels: ListLevel[]; /** Name */
543
+ /** Abstract numbering ID */
544
+ abstractNumId: number;
545
+ /** Multi-level type */
546
+ multiLevelType?: "hybridMultilevel" | "multilevel" | "singleLevel";
547
+ /** Numbering style link */
548
+ numStyleLink?: string;
549
+ /** Style link */
550
+ styleLink?: string;
551
+ /** Level definitions */
552
+ levels: ListLevel[];
553
+ /** Name */
394
554
  name?: string;
395
555
  };
396
556
  /**
397
557
  * Numbering instance (w:num)
398
558
  */
399
559
  type NumberingInstance = {
400
- /** Numbering ID (referenced by paragraphs) */numId: number; /** Reference to abstract numbering */
401
- abstractNumId: number; /** Level overrides */
560
+ /** Numbering ID (referenced by paragraphs) */
561
+ numId: number;
562
+ /** Reference to abstract numbering */
563
+ abstractNumId: number;
564
+ /** Level overrides */
402
565
  levelOverrides?: {
403
566
  ilvl: number;
404
567
  startOverride?: number;
@@ -409,16 +572,27 @@ type NumberingInstance = {
409
572
  * Computed list rendering info
410
573
  */
411
574
  type ListRendering = {
412
- /** Computed marker text (e.g., "1.", "a)", "•") */marker: string; /** List level (0-8) */
413
- level: number; /** Numbering ID */
414
- numId: number; /** Whether this is a bullet or numbered list */
415
- isBullet: boolean; /** Whether this level uses legal numbering (parent placeholders render decimal). */
416
- isLegal?: boolean; /** Number format type (decimal, lowerRoman, upperRoman, etc.) */
417
- numFmt?: NumberFormat; /** Whether the list marker is hidden (w:vanish on level rPr) */
418
- markerHidden?: boolean; /** Marker font family from numbering level rPr (ascii name) */
419
- markerFontFamily?: string; /** Marker font size from numbering level rPr, in points */
420
- markerFontSize?: number; /** Marker bold state from numbering level rPr */
421
- markerBold?: boolean; /** Horizontal alignment of the marker around the paragraph's list anchor. */
575
+ /** Computed marker text (e.g., "1.", "a)", "•") */
576
+ marker: string;
577
+ /** List level (0-8) */
578
+ level: number;
579
+ /** Numbering ID */
580
+ numId: number;
581
+ /** Whether this is a bullet or numbered list */
582
+ isBullet: boolean;
583
+ /** Whether this level uses legal numbering (parent placeholders render decimal). */
584
+ isLegal?: boolean;
585
+ /** Number format type (decimal, lowerRoman, upperRoman, etc.) */
586
+ numFmt?: NumberFormat;
587
+ /** Whether the list marker is hidden (w:vanish on level rPr) */
588
+ markerHidden?: boolean;
589
+ /** Marker font family from numbering level rPr (ascii name) */
590
+ markerFontFamily?: string;
591
+ /** Marker font size from numbering level rPr, in points */
592
+ markerFontSize?: number;
593
+ /** Marker bold state from numbering level rPr */
594
+ markerBold?: boolean;
595
+ /** Horizontal alignment of the marker around the paragraph's list anchor. */
422
596
  markerAlignment?: "left" | "center" | "right";
423
597
  /**
424
598
  * `w:caps` on the numbering level rPr — the marker text renders in upper
@@ -431,9 +605,12 @@ type ListRendering = {
431
605
  * `tab` (the OOXML default) grows the marker to the next tab stop; `space`
432
606
  * adds one space glyph; `nothing` lets body text butt against the marker.
433
607
  */
434
- markerSuffix?: LevelSuffix; /** Number format for each level from 0 through this paragraph's level. */
435
- levelNumFmts?: NumberFormat[]; /** Abstract numbering definition shared by one or more numIds. */
436
- abstractNumId?: number; /** Start override for this numId/level, if the numbering instance defines one. */
608
+ markerSuffix?: LevelSuffix;
609
+ /** Number format for each level from 0 through this paragraph's level. */
610
+ levelNumFmts?: NumberFormat[];
611
+ /** Abstract numbering definition shared by one or more numIds. */
612
+ abstractNumId?: number;
613
+ /** Start override for this numId/level, if the numbering instance defines one. */
437
614
  startOverride?: number;
438
615
  /**
439
616
  * Number of inline `LISTNUM` (default-list) fields the paragraph contains.
@@ -455,7 +632,9 @@ type ListRendering = {
455
632
  * Complete numbering definitions
456
633
  */
457
634
  type NumberingDefinitions = {
458
- /** Abstract numbering definitions */abstractNums: AbstractNumbering[]; /** Numbering instances */
635
+ /** Abstract numbering definitions */
636
+ abstractNums: AbstractNumbering[];
637
+ /** Numbering instances */
459
638
  nums: NumberingInstance[];
460
639
  };
461
640
  //#endregion
@@ -464,8 +643,10 @@ type NumberingDefinitions = {
464
643
  * Plain text content
465
644
  */
466
645
  type TextContent = {
467
- type: "text"; /** The text string */
468
- text: string; /** Preserve whitespace (xml:space="preserve") */
646
+ type: "text";
647
+ /** The text string */
648
+ text: string;
649
+ /** Preserve whitespace (xml:space="preserve") */
469
650
  preserveSpace?: boolean;
470
651
  };
471
652
  /**
@@ -478,32 +659,40 @@ type TabContent = {
478
659
  * Line break
479
660
  */
480
661
  type BreakContent = {
481
- type: "break"; /** Break type */
482
- breakType?: "page" | "column" | "textWrapping"; /** Clear type for text wrapping break */
662
+ type: "break";
663
+ /** Break type */
664
+ breakType?: "page" | "column" | "textWrapping";
665
+ /** Clear type for text wrapping break */
483
666
  clear?: "none" | "left" | "right" | "all";
484
667
  };
485
668
  /**
486
669
  * Symbol character (special font character)
487
670
  */
488
671
  type SymbolContent = {
489
- type: "symbol"; /** Font name */
490
- font: string; /** Character code */
672
+ type: "symbol";
673
+ /** Font name */
674
+ font: string;
675
+ /** Character code */
491
676
  char: string;
492
677
  };
493
678
  /**
494
679
  * Footnote or endnote reference
495
680
  */
496
681
  type NoteReferenceContent = {
497
- type: "footnoteRef" | "endnoteRef"; /** Note ID */
682
+ type: "footnoteRef" | "endnoteRef";
683
+ /** Note ID */
498
684
  id: number;
499
685
  };
500
686
  /**
501
687
  * Field character (begin/separate/end)
502
688
  */
503
689
  type FieldCharContent = {
504
- type: "fieldChar"; /** Field character type */
505
- charType: "begin" | "separate" | "end"; /** Field is locked */
506
- fldLock?: boolean; /** Field is dirty (needs update) */
690
+ type: "fieldChar";
691
+ /** Field character type */
692
+ charType: "begin" | "separate" | "end";
693
+ /** Field is locked */
694
+ fldLock?: boolean;
695
+ /** Field is dirty (needs update) */
507
696
  dirty?: boolean;
508
697
  /**
509
698
  * Cached display value from a child `<w:numberingChange w:original="…"/>`.
@@ -518,7 +707,8 @@ type FieldCharContent = {
518
707
  * Field instruction text
519
708
  */
520
709
  type InstrTextContent = {
521
- type: "instrText"; /** Field instruction */
710
+ type: "instrText";
711
+ /** Field instruction */
522
712
  text: string;
523
713
  };
524
714
  /**
@@ -541,15 +731,18 @@ type RenderedPageBreakContent = {
541
731
  * Drawing/image reference
542
732
  */
543
733
  type DrawingContent = {
544
- type: "drawing"; /** Image data */
545
- image: Image; /** Original OOXML for package-preserving round-trips of unsupported drawing markup. */
734
+ type: "drawing";
735
+ /** Image data */
736
+ image: Image;
737
+ /** Original OOXML for package-preserving round-trips of unsupported drawing markup. */
546
738
  rawXml?: string;
547
739
  };
548
740
  /**
549
741
  * Shape reference
550
742
  */
551
743
  type ShapeContent = {
552
- type: "shape"; /** Shape data */
744
+ type: "shape";
745
+ /** Shape data */
553
746
  shape: Shape;
554
747
  };
555
748
  /**
@@ -560,32 +753,46 @@ type RunContent = TextContent | TabContent | BreakContent | SymbolContent | Note
560
753
  * A run is a contiguous region of text with the same formatting
561
754
  */
562
755
  type Run = {
563
- type: "run"; /** Text formatting properties */
564
- formatting?: TextFormatting; /** Run-level tracked property changes (w:rPrChange) */
565
- propertyChanges?: RunPropertyChange[]; /** Run content (text, tabs, breaks, etc.) */
756
+ type: "run";
757
+ /** Text formatting properties */
758
+ formatting?: TextFormatting;
759
+ /** Run-level tracked property changes (w:rPrChange) */
760
+ propertyChanges?: RunPropertyChange[];
761
+ /** Run content (text, tabs, breaks, etc.) */
566
762
  content: RunContent[];
567
763
  };
568
764
  /**
569
765
  * Hyperlink (w:hyperlink)
570
766
  */
571
767
  type Hyperlink = {
572
- type: "hyperlink"; /** Relationship ID for external link */
573
- rId?: string; /** Resolved URL (from relationships) */
574
- href?: string; /** Internal bookmark anchor */
575
- anchor?: string; /** Tooltip text */
576
- tooltip?: string; /** Target frame */
577
- target?: string; /** Link history tracking */
578
- history?: boolean; /** Document location */
579
- docLocation?: string; /** Child runs */
768
+ type: "hyperlink";
769
+ /** Relationship ID for external link */
770
+ rId?: string;
771
+ /** Resolved URL (from relationships) */
772
+ href?: string;
773
+ /** Internal bookmark anchor */
774
+ anchor?: string;
775
+ /** Tooltip text */
776
+ tooltip?: string;
777
+ /** Target frame */
778
+ target?: string;
779
+ /** Link history tracking */
780
+ history?: boolean;
781
+ /** Document location */
782
+ docLocation?: string;
783
+ /** Child runs */
580
784
  children: (Run | BookmarkStart | BookmarkEnd)[];
581
785
  };
582
786
  /**
583
787
  * Bookmark start marker (w:bookmarkStart)
584
788
  */
585
789
  type BookmarkStart = {
586
- type: "bookmarkStart"; /** Bookmark ID */
587
- id: number; /** Bookmark name */
588
- name: string; /** Column index for table bookmarks */
790
+ type: "bookmarkStart";
791
+ /** Bookmark ID */
792
+ id: number;
793
+ /** Bookmark name */
794
+ name: string;
795
+ /** Column index for table bookmarks */
589
796
  colFirst?: number;
590
797
  colLast?: number;
591
798
  };
@@ -593,7 +800,8 @@ type BookmarkStart = {
593
800
  * Bookmark end marker (w:bookmarkEnd)
594
801
  */
595
802
  type BookmarkEnd = {
596
- type: "bookmarkEnd"; /** Bookmark ID */
803
+ type: "bookmarkEnd";
804
+ /** Bookmark ID */
597
805
  id: number;
598
806
  };
599
807
  /**
@@ -604,21 +812,30 @@ type FieldType = "PAGE" | "NUMPAGES" | "NUMWORDS" | "NUMCHARS" | "DATE" | "TIME"
604
812
  * Simple field (w:fldSimple)
605
813
  */
606
814
  type SimpleField = {
607
- type: "simpleField"; /** Field instruction (e.g., "PAGE \\* MERGEFORMAT") */
608
- instruction: string; /** Parsed field type */
609
- fieldType: FieldType; /** Current display value */
610
- content: (Run | Hyperlink)[]; /** Field is locked */
611
- fldLock?: boolean; /** Field is dirty */
815
+ type: "simpleField";
816
+ /** Field instruction (e.g., "PAGE \\* MERGEFORMAT") */
817
+ instruction: string;
818
+ /** Parsed field type */
819
+ fieldType: FieldType;
820
+ /** Current display value */
821
+ content: (Run | Hyperlink)[];
822
+ /** Field is locked */
823
+ fldLock?: boolean;
824
+ /** Field is dirty */
612
825
  dirty?: boolean;
613
826
  };
614
827
  /**
615
828
  * Complex field (w:fldChar begin/separate/end with w:instrText)
616
829
  */
617
830
  type ComplexField = {
618
- type: "complexField"; /** Field instruction */
619
- instruction: string; /** Parsed field type */
620
- fieldType: FieldType; /** Field code runs */
621
- fieldCode: Run[]; /** Display result runs */
831
+ type: "complexField";
832
+ /** Field instruction */
833
+ instruction: string;
834
+ /** Parsed field type */
835
+ fieldType: FieldType;
836
+ /** Field code runs */
837
+ fieldCode: Run[];
838
+ /** Display result runs */
622
839
  fieldResult: Run[];
623
840
  /**
624
841
  * Run formatting captured from the field's structural run(s) (`w:rPr` on the
@@ -626,8 +843,10 @@ type ComplexField = {
626
843
  * no separate result run to read it from, e.g. a footer `PAGE` number whose
627
844
  * formatting lives on the field run (eigenpal/docx-editor#909).
628
845
  */
629
- formatting?: TextFormatting; /** Field is locked */
630
- fldLock?: boolean; /** Field is dirty */
846
+ formatting?: TextFormatting;
847
+ /** Field is locked */
848
+ fldLock?: boolean;
849
+ /** Field is dirty */
631
850
  dirty?: boolean;
632
851
  };
633
852
  type Field = SimpleField | ComplexField;
@@ -635,15 +854,19 @@ type Field = SimpleField | ComplexField;
635
854
  * Image size specification
636
855
  */
637
856
  type ImageSize = {
638
- /** Width in EMUs (English Metric Units) */width: number; /** Height in EMUs */
857
+ /** Width in EMUs (English Metric Units) */
858
+ width: number;
859
+ /** Height in EMUs */
639
860
  height: number;
640
861
  };
641
862
  /**
642
863
  * Image wrap type for floating images
643
864
  */
644
865
  type ImageWrap = {
645
- type: "inline" | "square" | "tight" | "through" | "topAndBottom" | "behind" | "inFront"; /** Wrap text direction */
646
- wrapText?: "bothSides" | "left" | "right" | "largest"; /** Distance from text */
866
+ type: "inline" | "square" | "tight" | "through" | "topAndBottom" | "behind" | "inFront";
867
+ /** Wrap text direction */
868
+ wrapText?: "bothSides" | "left" | "right" | "largest";
869
+ /** Distance from text */
647
870
  distT?: number;
648
871
  distB?: number;
649
872
  distL?: number;
@@ -653,11 +876,13 @@ type ImageWrap = {
653
876
  * Position for floating images
654
877
  */
655
878
  type ImagePosition = {
656
- /** Horizontal positioning */horizontal: {
879
+ /** Horizontal positioning */
880
+ horizontal: {
657
881
  relativeTo: "character" | "column" | "insideMargin" | "leftMargin" | "margin" | "outsideMargin" | "page" | "rightMargin";
658
882
  alignment?: "left" | "right" | "center" | "inside" | "outside";
659
883
  posOffset?: number;
660
- }; /** Vertical positioning */
884
+ };
885
+ /** Vertical positioning */
661
886
  vertical: {
662
887
  relativeTo: "insideMargin" | "line" | "margin" | "outsideMargin" | "page" | "paragraph" | "topMargin" | "bottomMargin";
663
888
  alignment?: "top" | "bottom" | "center" | "inside" | "outside";
@@ -668,8 +893,11 @@ type ImagePosition = {
668
893
  * Image transformation
669
894
  */
670
895
  type ImageTransform = {
671
- /** Rotation in degrees */rotation?: number; /** Flip horizontal */
672
- flipH?: boolean; /** Flip vertical */
896
+ /** Rotation in degrees */
897
+ rotation?: number;
898
+ /** Flip horizontal */
899
+ flipH?: boolean;
900
+ /** Flip vertical */
673
901
  flipV?: boolean;
674
902
  };
675
903
  /**
@@ -698,20 +926,36 @@ type ImageCrop = {
698
926
  * Embedded image (w:drawing)
699
927
  */
700
928
  type Image = {
701
- type: "image"; /** Unique ID */
702
- id?: string; /** Relationship ID for the image data */
703
- rId: string; /** Resolved image data (base64 or blob URL) */
704
- src?: string; /** Image MIME type */
705
- mimeType?: string; /** Original filename */
706
- filename?: string; /** Alt text for accessibility */
707
- alt?: string; /** Title/description */
708
- title?: string; /** Image size */
709
- size: ImageSize; /** Original size before any transforms */
710
- originalSize?: ImageSize; /** Wrap settings */
711
- wrap: ImageWrap; /** Position for floating images */
712
- position?: ImagePosition; /** Image transformations */
713
- transform?: ImageTransform; /** Padding around image */
714
- padding?: ImagePadding; /** Source-bitmap crop (wp:srcRect), eigenpal #424 */
929
+ type: "image";
930
+ /** Unique ID */
931
+ id?: string;
932
+ /** Relationship ID for the image data */
933
+ rId: string;
934
+ /** Resolved image data (base64 or blob URL) */
935
+ src?: string;
936
+ /** Image MIME type */
937
+ mimeType?: string;
938
+ /** Original filename */
939
+ filename?: string;
940
+ /** Authored non-visual drawing name (`wp:docPr@name`) */
941
+ docPrName?: string;
942
+ /** Alt text for accessibility */
943
+ alt?: string;
944
+ /** Authored non-visual drawing title (`wp:docPr@title`) */
945
+ title?: string;
946
+ /** Image size */
947
+ size: ImageSize;
948
+ /** Original size before any transforms */
949
+ originalSize?: ImageSize;
950
+ /** Wrap settings */
951
+ wrap: ImageWrap;
952
+ /** Position for floating images */
953
+ position?: ImagePosition;
954
+ /** Image transformations */
955
+ transform?: ImageTransform;
956
+ /** Padding around image */
957
+ padding?: ImagePadding;
958
+ /** Source-bitmap crop (wp:srcRect), eigenpal #424 */
715
959
  crop?: ImageCrop;
716
960
  /**
717
961
  * Opacity in [0, 1] (OOXML `a:alphaModFix amt`). Undefined or `1` means
@@ -731,10 +975,16 @@ type Image = {
731
975
  * don't currently reposition, but we round-trip the flag so saving
732
976
  * preserves the author's intent; undefined means "use the spec default".
733
977
  */
734
- allowOverlap?: boolean; /** Whether this is a decorative image */
735
- decorative?: boolean; /** Hyperlink URL for clickable image */
736
- hlinkHref?: string; /** Image outline/border */
737
- outline?: ShapeOutline; /** Image effects */
978
+ allowOverlap?: boolean;
979
+ /** Whether this is a decorative image */
980
+ decorative?: boolean;
981
+ /** Hyperlink URL for clickable image */
982
+ hlinkHref?: string;
983
+ /** Relationship ID for the clickable image hyperlink */
984
+ hlinkRId?: string;
985
+ /** Image outline/border */
986
+ outline?: ShapeOutline;
987
+ /** Image effects */
738
988
  effects?: {
739
989
  brightness?: number;
740
990
  contrast?: number;
@@ -749,8 +999,10 @@ type ShapeType = "rect" | "roundRect" | "ellipse" | "triangle" | "rtTriangle" |
749
999
  * Shape fill type
750
1000
  */
751
1001
  type ShapeFill = {
752
- type: "none" | "solid" | "gradient" | "pattern" | "picture"; /** Solid fill color */
753
- color?: ColorValue; /** Gradient stops for gradient fill */
1002
+ type: "none" | "solid" | "gradient" | "pattern" | "picture";
1003
+ /** Solid fill color */
1004
+ color?: ColorValue;
1005
+ /** Gradient stops for gradient fill */
754
1006
  gradient?: {
755
1007
  type: "linear" | "radial" | "rectangular" | "path";
756
1008
  angle?: number;
@@ -764,16 +1016,23 @@ type ShapeFill = {
764
1016
  * Shape outline/stroke
765
1017
  */
766
1018
  type ShapeOutline = {
767
- /** Line width in EMUs */width?: number; /** Line color */
768
- color?: ColorValue; /** Line style */
769
- style?: "solid" | "dot" | "dash" | "lgDash" | "dashDot" | "lgDashDot" | "lgDashDotDot" | "sysDot" | "sysDash" | "sysDashDot" | "sysDashDotDot"; /** Line cap */
770
- cap?: "flat" | "round" | "square"; /** Line join */
771
- join?: "bevel" | "miter" | "round"; /** Head arrow */
1019
+ /** Line width in EMUs */
1020
+ width?: number;
1021
+ /** Line color */
1022
+ color?: ColorValue;
1023
+ /** Line style */
1024
+ style?: "solid" | "dot" | "dash" | "lgDash" | "dashDot" | "lgDashDot" | "lgDashDotDot" | "sysDot" | "sysDash" | "sysDashDot" | "sysDashDotDot";
1025
+ /** Line cap */
1026
+ cap?: "flat" | "round" | "square";
1027
+ /** Line join */
1028
+ join?: "bevel" | "miter" | "round";
1029
+ /** Head arrow */
772
1030
  headEnd?: {
773
1031
  type: "none" | "triangle" | "stealth" | "diamond" | "oval" | "arrow";
774
1032
  width?: "sm" | "med" | "lg";
775
1033
  length?: "sm" | "med" | "lg";
776
- }; /** Tail arrow */
1034
+ };
1035
+ /** Tail arrow */
777
1036
  tailEnd?: {
778
1037
  type: "none" | "triangle" | "stealth" | "diamond" | "oval" | "arrow";
779
1038
  width?: "sm" | "med" | "lg";
@@ -784,49 +1043,76 @@ type ShapeOutline = {
784
1043
  * Text body inside a shape
785
1044
  */
786
1045
  type ShapeTextBody = {
787
- /** Text direction */vertical?: boolean; /** Rotation */
788
- rotation?: number; /** Anchor/vertical alignment */
789
- anchor?: "top" | "middle" | "bottom" | "distributed" | "justified"; /** Anchor center */
790
- anchorCenter?: boolean; /** Auto fit */
791
- autoFit?: "none" | "normal" | "shape"; /** Text margins */
1046
+ /** Text direction */
1047
+ vertical?: boolean;
1048
+ /** Rotation */
1049
+ rotation?: number;
1050
+ /** Anchor/vertical alignment */
1051
+ anchor?: "top" | "middle" | "bottom" | "distributed" | "justified";
1052
+ /** Anchor center */
1053
+ anchorCenter?: boolean;
1054
+ /** Auto fit */
1055
+ autoFit?: "none" | "normal" | "shape";
1056
+ /** Text margins */
792
1057
  margins?: {
793
1058
  top?: number;
794
1059
  bottom?: number;
795
1060
  left?: number;
796
1061
  right?: number;
797
- }; /** Block content inside the shape */
1062
+ };
1063
+ /** Block content inside the shape */
798
1064
  content: (Paragraph | Table)[];
799
1065
  };
800
1066
  /**
801
1067
  * Shape/drawing object (wps:wsp)
802
1068
  */
803
1069
  type Shape = {
804
- type: "shape"; /** Shape type preset */
805
- shapeType: ShapeType; /** Unique ID */
806
- id?: string; /** Name */
807
- name?: string; /** Size in EMUs */
808
- size: ImageSize; /** Position for floating shapes */
809
- position?: ImagePosition; /** Wrap settings */
810
- wrap?: ImageWrap; /** Fill */
811
- fill?: ShapeFill; /** Outline/stroke */
812
- outline?: ShapeOutline; /** Transform */
813
- transform?: ImageTransform; /** Text content inside the shape */
814
- textBody?: ShapeTextBody; /** Custom geometry points */
1070
+ type: "shape";
1071
+ /** Shape type preset */
1072
+ shapeType: ShapeType;
1073
+ /** Unique ID */
1074
+ id?: string;
1075
+ /** Name */
1076
+ name?: string;
1077
+ /** Size in EMUs */
1078
+ size: ImageSize;
1079
+ /** Position for floating shapes */
1080
+ position?: ImagePosition;
1081
+ /** Wrap settings */
1082
+ wrap?: ImageWrap;
1083
+ /** Fill */
1084
+ fill?: ShapeFill;
1085
+ /** Outline/stroke */
1086
+ outline?: ShapeOutline;
1087
+ /** Transform */
1088
+ transform?: ImageTransform;
1089
+ /** Text content inside the shape */
1090
+ textBody?: ShapeTextBody;
1091
+ /** Custom geometry points */
815
1092
  customGeometry?: string;
816
1093
  };
817
1094
  /**
818
1095
  * Text box (floating text container)
819
1096
  */
820
1097
  type TextBox = {
821
- type: "textBox"; /** Unique ID */
822
- id?: string; /** Size */
823
- size: ImageSize; /** Position */
824
- position?: ImagePosition; /** Wrap settings */
825
- wrap?: ImageWrap; /** Fill */
826
- fill?: ShapeFill; /** Outline */
827
- outline?: ShapeOutline; /** Text and table content */
828
- content: (Paragraph | Table)[]; /** Text fitting behavior */
829
- autoFit?: ShapeTextBody["autoFit"]; /** Internal margins */
1098
+ type: "textBox";
1099
+ /** Unique ID */
1100
+ id?: string;
1101
+ /** Size */
1102
+ size: ImageSize;
1103
+ /** Position */
1104
+ position?: ImagePosition;
1105
+ /** Wrap settings */
1106
+ wrap?: ImageWrap;
1107
+ /** Fill */
1108
+ fill?: ShapeFill;
1109
+ /** Outline */
1110
+ outline?: ShapeOutline;
1111
+ /** Text and table content */
1112
+ content: (Paragraph | Table)[];
1113
+ /** Text fitting behavior */
1114
+ autoFit?: ShapeTextBody["autoFit"];
1115
+ /** Internal margins */
830
1116
  margins?: {
831
1117
  top?: number;
832
1118
  bottom?: number;
@@ -838,42 +1124,61 @@ type TextBox = {
838
1124
  * Table cell
839
1125
  */
840
1126
  type TableCell = {
841
- type: "tableCell"; /** Cell formatting */
842
- formatting?: TableCellFormatting; /** Cell-level tracked property changes (w:tcPrChange) */
843
- propertyChanges?: TableCellPropertyChange[]; /** Tracked structural changes (cell insert/delete/merge) */
844
- structuralChange?: TableStructuralChangeInfo; /** Cell content (paragraphs, tables, etc.) */
1127
+ type: "tableCell";
1128
+ /** Cell formatting */
1129
+ formatting?: TableCellFormatting;
1130
+ /** Cell-level tracked property changes (w:tcPrChange) */
1131
+ propertyChanges?: TableCellPropertyChange[];
1132
+ /** Tracked structural changes (cell insert/delete/merge) */
1133
+ structuralChange?: TableStructuralChangeInfo;
1134
+ /** Cell content (paragraphs, tables, etc.) */
845
1135
  content: (Paragraph | Table)[];
846
1136
  };
847
1137
  /**
848
1138
  * Table row
849
1139
  */
850
1140
  type TableRow = {
851
- type: "tableRow"; /** Row formatting */
852
- formatting?: TableRowFormatting; /** Row-level tracked property changes (w:trPrChange) */
853
- propertyChanges?: TableRowPropertyChange[]; /** Tracked structural changes (row insert/delete) */
854
- structuralChange?: TableStructuralChangeInfo; /** Cells in this row */
1141
+ type: "tableRow";
1142
+ /** Row formatting */
1143
+ formatting?: TableRowFormatting;
1144
+ /** Row-level tracked property changes (w:trPrChange) */
1145
+ propertyChanges?: TableRowPropertyChange[];
1146
+ /** Tracked structural changes (row insert/delete) */
1147
+ structuralChange?: TableStructuralChangeInfo;
1148
+ /** Cells in this row */
855
1149
  cells: TableCell[];
856
1150
  };
857
1151
  /**
858
1152
  * Table (w:tbl)
859
1153
  */
860
1154
  type Table = {
861
- type: "table"; /** Table formatting */
862
- formatting?: TableFormatting; /** Table-level tracked property changes (w:tblPrChange) */
863
- propertyChanges?: TablePropertyChange[]; /** Column widths in twips */
864
- columnWidths?: number[]; /** Table rows */
1155
+ type: "table";
1156
+ /** Table formatting */
1157
+ formatting?: TableFormatting;
1158
+ /** Table-level tracked property changes (w:tblPrChange) */
1159
+ propertyChanges?: TablePropertyChange[];
1160
+ /** Column widths in twips */
1161
+ columnWidths?: number[];
1162
+ /** Table rows */
865
1163
  rows: TableRow[];
866
1164
  };
867
1165
  /**
868
1166
  * A comment (w:comment) from comments.xml
869
1167
  */
870
1168
  type Comment = {
871
- /** Comment ID (matches commentRangeStart/End) */id: number; /** Author name */
872
- author: string; /** Author initials */
873
- initials?: string; /** Date */
874
- date?: string; /** Comment content (paragraphs) */
875
- content: Paragraph[]; /** Parent comment ID (for replies) */
876
- parentId?: number; /** Whether the comment is resolved/done */
1169
+ /** Comment ID (matches commentRangeStart/End) */
1170
+ id: number;
1171
+ /** Author name */
1172
+ author: string;
1173
+ /** Author initials */
1174
+ initials?: string;
1175
+ /** Date */
1176
+ date?: string;
1177
+ /** Comment content (paragraphs) */
1178
+ content: Paragraph[];
1179
+ /** Parent comment ID (for replies) */
1180
+ parentId?: number;
1181
+ /** Whether the comment is resolved/done */
877
1182
  done?: boolean;
878
1183
  };
879
1184
  /**
@@ -902,55 +1207,95 @@ type CommentReference = {
902
1207
  * Math equation content (m:oMath or m:oMathPara)
903
1208
  */
904
1209
  type MathEquation = {
905
- type: "mathEquation"; /** Whether this is a block (oMathPara) or inline (oMath) equation */
906
- display: "inline" | "block"; /** Raw OMML XML for round-trip preservation */
907
- ommlXml: string; /** Plain text representation for accessibility/fallback */
1210
+ type: "mathEquation";
1211
+ /** Whether this is a block (oMathPara) or inline (oMath) equation */
1212
+ display: "inline" | "block";
1213
+ /** Raw OMML XML for round-trip preservation */
1214
+ ommlXml: string;
1215
+ /** Plain text representation for accessibility/fallback */
908
1216
  plainText?: string;
909
1217
  };
1218
+ /**
1219
+ * Largest value a revision id (`w:id`) may carry: 2^31 - 1.
1220
+ *
1221
+ * `w:id` on `<w:ins>`/`<w:del>` comes from `CT_Markup`, typed
1222
+ * `ST_DecimalNumber` — which ECMA-376 defines as an unbounded integer. The
1223
+ * bound below is an implementation limit: conforming consumers read
1224
+ * `ST_DecimalNumber` into a signed 32-bit int, and a value past this bound
1225
+ * overflows on load and surfaces as an unreadable document. Port of
1226
+ * eigenpal/docx-editor#1093.
1227
+ */
1228
+ declare const MAX_REVISION_ID = 2147483647;
1229
+ /**
1230
+ * Coerce any revision id — including one parsed from an untrusted DOCX — into
1231
+ * the range serialized `w:id` attributes may occupy.
1232
+ *
1233
+ * - Malformed (negative, fractional, `NaN`, `Infinity`): collapse to `0`.
1234
+ * - Well-formed but out of range: fold modulo the range (not clamp) so a
1235
+ * contiguous run of overflowing ids stays distinguishable.
1236
+ */
1237
+ declare function normalizeRevisionId(id: number): number;
910
1238
  /**
911
1239
  * Tracked change metadata (w:ins, w:del attributes)
912
1240
  */
913
1241
  type TrackedChangeInfo = {
914
- /** Revision ID */id: number; /** Author who made the change */
915
- author: string; /** Date of the change */
1242
+ /** Revision ID */
1243
+ id: number;
1244
+ /** Author who made the change */
1245
+ author: string;
1246
+ /** Date of the change */
916
1247
  date?: string;
1248
+ /**
1249
+ * Author initials (w:initials). Optional attribution used by the review UI
1250
+ * and carried through the round-trip when present on the source document.
1251
+ */
1252
+ initials?: string;
917
1253
  };
918
1254
  /**
919
1255
  * Generic tracked property-change wrapper metadata (w:*PrChange)
920
1256
  */
921
1257
  type PropertyChangeInfo = {
922
- /** Optional revision session ID */rsid?: string;
1258
+ /** Optional revision session ID */
1259
+ rsid?: string;
923
1260
  } & TrackedChangeInfo;
924
1261
  /**
925
1262
  * Insertion wrapper (w:ins) — runs inserted by tracked changes
926
1263
  */
927
1264
  type Insertion = {
928
- type: "insertion"; /** Tracked change metadata */
929
- info: TrackedChangeInfo; /** Inserted content */
1265
+ type: "insertion";
1266
+ /** Tracked change metadata */
1267
+ info: TrackedChangeInfo;
1268
+ /** Inserted content */
930
1269
  content: (Run | Hyperlink)[];
931
1270
  };
932
1271
  /**
933
1272
  * Deletion wrapper (w:del) — runs deleted by tracked changes
934
1273
  */
935
1274
  type Deletion = {
936
- type: "deletion"; /** Tracked change metadata */
937
- info: TrackedChangeInfo; /** Deleted content */
1275
+ type: "deletion";
1276
+ /** Tracked change metadata */
1277
+ info: TrackedChangeInfo;
1278
+ /** Deleted content */
938
1279
  content: (Run | Hyperlink)[];
939
1280
  };
940
1281
  /**
941
1282
  * Move-from wrapper (w:moveFrom) — content moved away from this position
942
1283
  */
943
1284
  type MoveFrom = {
944
- type: "moveFrom"; /** Tracked change metadata */
945
- info: TrackedChangeInfo; /** Moved content */
1285
+ type: "moveFrom";
1286
+ /** Tracked change metadata */
1287
+ info: TrackedChangeInfo;
1288
+ /** Moved content */
946
1289
  content: (Run | Hyperlink)[];
947
1290
  };
948
1291
  /**
949
1292
  * Move-to wrapper (w:moveTo) — content moved into this position
950
1293
  */
951
1294
  type MoveTo = {
952
- type: "moveTo"; /** Tracked change metadata */
953
- info: TrackedChangeInfo; /** Moved content */
1295
+ type: "moveTo";
1296
+ /** Tracked change metadata */
1297
+ info: TrackedChangeInfo;
1298
+ /** Moved content */
954
1299
  content: (Run | Hyperlink)[];
955
1300
  };
956
1301
  /**
@@ -993,66 +1338,88 @@ type TrackedRunChange = Insertion | Deletion | MoveFrom | MoveTo;
993
1338
  * Run property change (w:rPrChange)
994
1339
  */
995
1340
  type RunPropertyChange = {
996
- type: "runPropertyChange"; /** Tracked change metadata */
997
- info: PropertyChangeInfo; /** Run properties before the tracked change */
998
- previousFormatting?: TextFormatting; /** Run properties after the tracked change (editor model convenience) */
1341
+ type: "runPropertyChange";
1342
+ /** Tracked change metadata */
1343
+ info: PropertyChangeInfo;
1344
+ /** Run properties before the tracked change */
1345
+ previousFormatting?: TextFormatting;
1346
+ /** Run properties after the tracked change (editor model convenience) */
999
1347
  currentFormatting?: TextFormatting;
1000
1348
  };
1001
1349
  /**
1002
1350
  * Paragraph property change (w:pPrChange)
1003
1351
  */
1004
1352
  type ParagraphPropertyChange = {
1005
- type: "paragraphPropertyChange"; /** Tracked change metadata */
1006
- info: PropertyChangeInfo; /** Paragraph properties before the tracked change */
1007
- previousFormatting?: ParagraphFormatting; /** Paragraph properties after the tracked change (editor model convenience) */
1353
+ type: "paragraphPropertyChange";
1354
+ /** Tracked change metadata */
1355
+ info: PropertyChangeInfo;
1356
+ /** Paragraph properties before the tracked change */
1357
+ previousFormatting?: ParagraphFormatting;
1358
+ /** Paragraph properties after the tracked change (editor model convenience) */
1008
1359
  currentFormatting?: ParagraphFormatting;
1009
1360
  };
1010
1361
  /**
1011
1362
  * Table property change (w:tblPrChange)
1012
1363
  */
1013
1364
  type TablePropertyChange = {
1014
- type: "tablePropertyChange"; /** Tracked change metadata */
1015
- info: PropertyChangeInfo; /** Table properties before the tracked change */
1016
- previousFormatting?: TableFormatting; /** Table properties after the tracked change (editor model convenience) */
1365
+ type: "tablePropertyChange";
1366
+ /** Tracked change metadata */
1367
+ info: PropertyChangeInfo;
1368
+ /** Table properties before the tracked change */
1369
+ previousFormatting?: TableFormatting;
1370
+ /** Table properties after the tracked change (editor model convenience) */
1017
1371
  currentFormatting?: TableFormatting;
1018
1372
  };
1019
1373
  /**
1020
1374
  * Table row property change (w:trPrChange)
1021
1375
  */
1022
1376
  type TableRowPropertyChange = {
1023
- type: "tableRowPropertyChange"; /** Tracked change metadata */
1024
- info: PropertyChangeInfo; /** Row properties before the tracked change */
1025
- previousFormatting?: TableRowFormatting; /** Row properties after the tracked change (editor model convenience) */
1377
+ type: "tableRowPropertyChange";
1378
+ /** Tracked change metadata */
1379
+ info: PropertyChangeInfo;
1380
+ /** Row properties before the tracked change */
1381
+ previousFormatting?: TableRowFormatting;
1382
+ /** Row properties after the tracked change (editor model convenience) */
1026
1383
  currentFormatting?: TableRowFormatting;
1027
1384
  };
1028
1385
  /**
1029
1386
  * Table cell property change (w:tcPrChange)
1030
1387
  */
1031
1388
  type TableCellPropertyChange = {
1032
- type: "tableCellPropertyChange"; /** Tracked change metadata */
1033
- info: PropertyChangeInfo; /** Cell properties before the tracked change */
1034
- previousFormatting?: TableCellFormatting; /** Cell properties after the tracked change (editor model convenience) */
1389
+ type: "tableCellPropertyChange";
1390
+ /** Tracked change metadata */
1391
+ info: PropertyChangeInfo;
1392
+ /** Cell properties before the tracked change */
1393
+ previousFormatting?: TableCellFormatting;
1394
+ /** Cell properties after the tracked change (editor model convenience) */
1035
1395
  currentFormatting?: TableCellFormatting;
1036
1396
  };
1037
1397
  /**
1038
1398
  * Section property change (w:sectPrChange)
1039
1399
  */
1040
1400
  type SectionPropertyChange = {
1041
- type: "sectionPropertyChange"; /** Tracked change metadata */
1042
- info: PropertyChangeInfo; /** Section properties before the tracked change */
1043
- previousProperties?: SectionProperties; /** Section properties after the tracked change (editor model convenience) */
1401
+ type: "sectionPropertyChange";
1402
+ /** Tracked change metadata */
1403
+ info: PropertyChangeInfo;
1404
+ /** Section properties before the tracked change */
1405
+ previousProperties?: SectionProperties;
1406
+ /** Section properties after the tracked change (editor model convenience) */
1044
1407
  currentProperties?: SectionProperties;
1045
1408
  };
1046
1409
  /**
1047
1410
  * Table structural tracked change metadata (row/cell insert/delete/merge)
1048
1411
  */
1049
1412
  type TableStructuralChangeInfo = {
1050
- type: "tableRowInsertion" | "tableRowDeletion" | "tableCellInsertion" | "tableCellDeletion"; /** Tracked change metadata */
1413
+ type: "tableRowInsertion" | "tableRowDeletion" | "tableCellInsertion" | "tableCellDeletion";
1414
+ /** Tracked change metadata */
1051
1415
  info: TrackedChangeInfo;
1052
1416
  } | {
1053
- type: "tableCellMerge"; /** Tracked change metadata */
1054
- info: TrackedChangeInfo; /** Vertical merge state applied by the revision. */
1055
- verticalMerge?: "continue" | "rest"; /** Vertical merge state that existed before the revision. */
1417
+ type: "tableCellMerge";
1418
+ /** Tracked change metadata */
1419
+ info: TrackedChangeInfo;
1420
+ /** Vertical merge state applied by the revision. */
1421
+ verticalMerge?: "continue" | "rest";
1422
+ /** Vertical merge state that existed before the revision. */
1056
1423
  verticalMergeOriginal?: "continue" | "rest";
1057
1424
  };
1058
1425
  /**
@@ -1071,17 +1438,24 @@ type SdtType = "richText" | "plainText" | "date" | "dropdown" | "comboBox" | "ch
1071
1438
  * `w:sdtEndPr`) lossless.
1072
1439
  */
1073
1440
  type SdtProperties = {
1074
- /** SDT type (projection; round-trip uses `rawPropertiesXml`). */sdtType: SdtType; /** Numeric id (`w:id/@w:val`). */
1075
- id?: number; /** Alias (friendly name, `w:alias`). */
1076
- alias?: string; /** Tag (developer identifier, `w:tag`). */
1077
- tag?: string; /** Lock setting (`w:lock`). */
1441
+ /** SDT type (projection; round-trip uses `rawPropertiesXml`). */
1442
+ sdtType: SdtType;
1443
+ /** Numeric id (`w:id/@w:val`). */
1444
+ id?: number;
1445
+ /** Alias (friendly name, `w:alias`). */
1446
+ alias?: string;
1447
+ /** Tag (developer identifier, `w:tag`). */
1448
+ tag?: string;
1449
+ /** Lock setting (`w:lock`). */
1078
1450
  lock?: "sdtLocked" | "contentLocked" | "sdtContentLocked" | "unlocked";
1079
1451
  /**
1080
1452
  * Placeholder building-block name (`w:placeholder/w:docPart@w:val`) — a
1081
1453
  * reference to a glossary docPart, not the literal placeholder text.
1082
1454
  */
1083
- placeholder?: string; /** Whether the placeholder is currently shown (`w:showingPlcHdr`). */
1084
- showingPlaceholder?: boolean; /** Date display format (`w:date/w:dateFormat@w:val`). */
1455
+ placeholder?: string;
1456
+ /** Whether the placeholder is currently shown (`w:showingPlcHdr`). */
1457
+ showingPlaceholder?: boolean;
1458
+ /** Date display format (`w:date/w:dateFormat@w:val`). */
1085
1459
  dateFormat?: string;
1086
1460
  /**
1087
1461
  * Bound date value (`w:date/@w:fullDate`), ISO 8601. Independent of
@@ -1089,7 +1463,8 @@ type SdtProperties = {
1089
1463
  * formatted version like "2 June 2026" while this stays as
1090
1464
  * `2026-06-02T00:00:00Z` so Word's date binding round-trips losslessly.
1091
1465
  */
1092
- dateValueISO?: string; /** Dropdown/combobox list items. */
1466
+ dateValueISO?: string;
1467
+ /** Dropdown/combobox list items. */
1093
1468
  listItems?: {
1094
1469
  displayText: string;
1095
1470
  value: string;
@@ -1101,14 +1476,16 @@ type SdtProperties = {
1101
1476
  * matching the body's display text against `listItems`, which picked
1102
1477
  * the wrong entry when two items shared a `displayText`.
1103
1478
  */
1104
- dropdownLastValue?: string; /** Checkbox checked state (`w14:checkbox/w14:checked`). */
1479
+ dropdownLastValue?: string;
1480
+ /** Checkbox checked state (`w14:checkbox/w14:checked`). */
1105
1481
  checked?: boolean;
1106
1482
  /**
1107
1483
  * Verbatim `<w:sdtPr>…</w:sdtPr>` captured at parse time. Replayed on
1108
1484
  * serialize so unmodeled OOXML features (data binding, repeating sections,
1109
1485
  * `@lastValue`, custom XML mappings) survive round-trip.
1110
1486
  */
1111
- rawPropertiesXml?: string; /** Verbatim `<w:sdtEndPr>…</w:sdtEndPr>` captured at parse time. */
1487
+ rawPropertiesXml?: string;
1488
+ /** Verbatim `<w:sdtEndPr>…</w:sdtEndPr>` captured at parse time. */
1112
1489
  rawEndPropertiesXml?: string;
1113
1490
  /**
1114
1491
  * Verbatim XML for any non-content direct children of `<w:sdt>` that
@@ -1119,7 +1496,8 @@ type SdtProperties = {
1119
1496
  * changes that span an SDT boundary round-trip without losing a
1120
1497
  * delimiter.
1121
1498
  */
1122
- rawSdtChildrenBeforeContent?: string; /** Verbatim XML for non-content sdt children that appear AFTER `<w:sdtContent>`. */
1499
+ rawSdtChildrenBeforeContent?: string;
1500
+ /** Verbatim XML for non-content sdt children that appear AFTER `<w:sdtContent>`. */
1123
1501
  rawSdtChildrenAfterContent?: string;
1124
1502
  };
1125
1503
  /**
@@ -1131,8 +1509,10 @@ type SdtProperties = {
1131
1509
  * content do not lose their wrapper on round-trip.
1132
1510
  */
1133
1511
  type InlineSdt = {
1134
- type: "inlineSdt"; /** SDT properties */
1135
- properties: SdtProperties; /** Inline content held inside the control */
1512
+ type: "inlineSdt";
1513
+ /** SDT properties */
1514
+ properties: SdtProperties;
1515
+ /** Inline content held inside the control */
1136
1516
  content: (Run | Hyperlink | SimpleField | ComplexField | InlineSdt | Insertion | Deletion | MoveFrom | MoveTo | MathEquation)[];
1137
1517
  };
1138
1518
  /**
@@ -1143,8 +1523,10 @@ type InlineSdt = {
1143
1523
  * whose row is itself a content control.
1144
1524
  */
1145
1525
  type BlockSdt = {
1146
- type: "blockSdt"; /** SDT properties (raw XML in `properties.rawPropertiesXml` round-trips losslessly). */
1147
- properties: SdtProperties; /** Block content inside the control. */
1526
+ type: "blockSdt";
1527
+ /** SDT properties (raw XML in `properties.rawPropertiesXml` round-trips losslessly). */
1528
+ properties: SdtProperties;
1529
+ /** Block content inside the control. */
1148
1530
  content: BlockContent[];
1149
1531
  };
1150
1532
  /**
@@ -1168,15 +1550,24 @@ type ParagraphMarkChange = {
1168
1550
  info: TrackedChangeInfo;
1169
1551
  };
1170
1552
  type Paragraph = {
1171
- type: "paragraph"; /** Unique paragraph ID */
1172
- paraId?: string; /** Text ID */
1173
- textId?: string; /** Paragraph formatting */
1174
- formatting?: ParagraphFormatting; /** Paragraph-level tracked property changes (w:pPrChange) */
1175
- propertyChanges?: ParagraphPropertyChange[]; /** Paragraph-mark insertion / deletion (w:pPr / w:rPr / w:ins | w:del) */
1176
- pPrMark?: ParagraphMarkChange; /** Paragraph content */
1177
- content: ParagraphContent[]; /** Computed list rendering (if this is a list item) */
1178
- listRendering?: ListRendering; /** Word's cached layout says this paragraph started on a new rendered page. */
1179
- renderedPageBreakBefore?: boolean; /** Section properties (if this paragraph ends a section) */
1553
+ type: "paragraph";
1554
+ /** Unique paragraph ID */
1555
+ paraId?: string;
1556
+ /** Text ID */
1557
+ textId?: string;
1558
+ /** Paragraph formatting */
1559
+ formatting?: ParagraphFormatting;
1560
+ /** Paragraph-level tracked property changes (w:pPrChange) */
1561
+ propertyChanges?: ParagraphPropertyChange[];
1562
+ /** Paragraph-mark insertion / deletion (w:pPr / w:rPr / w:ins | w:del) */
1563
+ pPrMark?: ParagraphMarkChange;
1564
+ /** Paragraph content */
1565
+ content: ParagraphContent[];
1566
+ /** Computed list rendering (if this is a list item) */
1567
+ listRendering?: ListRendering;
1568
+ /** Word's cached layout says this paragraph started on a new rendered page. */
1569
+ renderedPageBreakBefore?: boolean;
1570
+ /** Section properties (if this paragraph ends a section) */
1180
1571
  sectionProperties?: SectionProperties;
1181
1572
  };
1182
1573
  /**
@@ -1198,8 +1589,10 @@ type FooterReference = {
1198
1589
  * Header or footer content
1199
1590
  */
1200
1591
  type HeaderFooter = {
1201
- type: "header" | "footer"; /** Header/footer type */
1202
- hdrFtrType: HeaderFooterType; /** Content (paragraphs, tables, block-level content controls). */
1592
+ type: "header" | "footer";
1593
+ /** Header/footer type */
1594
+ hdrFtrType: HeaderFooterType;
1595
+ /** Content (paragraphs, tables, block-level content controls). */
1203
1596
  content: BlockContent[];
1204
1597
  /**
1205
1598
  * Document watermark detected in this header part. Word emits
@@ -1233,8 +1626,10 @@ type HeaderFooter = {
1233
1626
  */
1234
1627
  type Watermark = TextWatermark | PictureWatermark;
1235
1628
  type TextWatermark = {
1236
- kind: "text"; /** Visible string. Required. */
1237
- text: string; /** Font family. Word's default is Calibri. */
1629
+ kind: "text";
1630
+ /** Visible string. Required. */
1631
+ text: string;
1632
+ /** Font family. Word's default is Calibri. */
1238
1633
  font?: string;
1239
1634
  /**
1240
1635
  * Hex color (`"C0C0C0"`), `"auto"`, or `undefined` for the producer
@@ -1255,7 +1650,8 @@ type TextWatermark = {
1255
1650
  opacity?: number;
1256
1651
  };
1257
1652
  type PictureWatermark = {
1258
- kind: "picture"; /** Relationship id of the image part in `word/_rels/header*.xml.rels`. */
1653
+ kind: "picture";
1654
+ /** Relationship id of the image part in `word/_rels/header*.xml.rels`. */
1259
1655
  imageRId: string;
1260
1656
  /**
1261
1657
  * Stable identity of the image the `imageRId` resolved to in the header it
@@ -1271,7 +1667,8 @@ type PictureWatermark = {
1271
1667
  * When true, {@link imageTarget} is an external (linked) URL written back
1272
1668
  * with `TargetMode="External"`, not an embedded package path.
1273
1669
  */
1274
- imageTargetExternal?: boolean; /** Optional scale factor (1.0 = native, 0.5 = half-size). */
1670
+ imageTargetExternal?: boolean;
1671
+ /** Optional scale factor (1.0 = native, 0.5 = half-size). */
1275
1672
  scale?: number;
1276
1673
  /**
1277
1674
  * Display width in points from the VML shape, captured at parse so the
@@ -1280,7 +1677,8 @@ type PictureWatermark = {
1280
1677
  * non-2:1 image). Absent for synthesized watermarks, which fall back to
1281
1678
  * Word's default box scaled by `scale`.
1282
1679
  */
1283
- widthPt?: number; /** Display height in points from the VML shape. See {@link widthPt}. */
1680
+ widthPt?: number;
1681
+ /** Display height in points from the VML shape. See {@link widthPt}. */
1284
1682
  heightPt?: number;
1285
1683
  /**
1286
1684
  * Whether Word's "washout" effect was applied (low contrast).
@@ -1323,8 +1721,10 @@ type EndnoteProperties = {
1323
1721
  * Footnote (w:footnote)
1324
1722
  */
1325
1723
  type Footnote = {
1326
- type: "footnote"; /** Footnote ID */
1327
- id: number; /** Special footnote type */
1724
+ type: "footnote";
1725
+ /** Footnote ID */
1726
+ id: number;
1727
+ /** Special footnote type */
1328
1728
  noteType?: "normal" | "separator" | "continuationSeparator" | "continuationNotice";
1329
1729
  /**
1330
1730
  * Content. Note bodies may carry block-level `<w:sdt>` content
@@ -1339,8 +1739,10 @@ type Footnote = {
1339
1739
  * Endnote (w:endnote)
1340
1740
  */
1341
1741
  type Endnote = {
1342
- type: "endnote"; /** Endnote ID */
1343
- id: number; /** Special endnote type */
1742
+ type: "endnote";
1743
+ /** Endnote ID */
1744
+ id: number;
1745
+ /** Special endnote type */
1344
1746
  noteType?: "normal" | "separator" | "continuationSeparator" | "continuationNotice";
1345
1747
  /**
1346
1748
  * Content. Like `Footnote.content`, may carry block-level `<w:sdt>`
@@ -1368,7 +1770,9 @@ type LineNumberRestart = "continuous" | "newPage" | "newSection";
1368
1770
  * Column definition
1369
1771
  */
1370
1772
  type Column = {
1371
- /** Column width in twips */width?: number; /** Space after column in twips */
1773
+ /** Column width in twips */
1774
+ width?: number;
1775
+ /** Space after column in twips */
1372
1776
  space?: number;
1373
1777
  };
1374
1778
  /**
@@ -1376,70 +1780,111 @@ type Column = {
1376
1780
  */
1377
1781
  type SectionTextDirection = "lrTb" | "tbRl" | "btLr" | "lrTbV" | "tbRlV" | "tbLrV" | "tb" | "rl" | "lr" | "tbV" | "rlV" | "lrV";
1378
1782
  type SectionProperties = {
1379
- /** Page width in twips */pageWidth?: number; /** Page height in twips */
1380
- pageHeight?: number; /** Page orientation */
1381
- orientation?: PageOrientation; /** Top margin in twips */
1382
- marginTop?: number; /** Bottom margin in twips */
1383
- marginBottom?: number; /** Left margin in twips */
1384
- marginLeft?: number; /** Right margin in twips */
1385
- marginRight?: number; /** Header distance from top in twips */
1386
- headerDistance?: number; /** Footer distance from bottom in twips */
1387
- footerDistance?: number; /** Gutter margin in twips */
1388
- gutter?: number; /** Number of columns */
1389
- columnCount?: number; /** Space between columns in twips */
1390
- columnSpace?: number; /** Equal width columns */
1391
- equalWidth?: boolean; /** Separator line between columns */
1392
- separator?: boolean; /** Individual column definitions */
1393
- columns?: Column[]; /** Section start type */
1394
- sectionStart?: SectionStart; /** Vertical alignment of text */
1395
- verticalAlign?: VerticalAlign; /** Section text direction */
1396
- textDirection?: SectionTextDirection; /** Right-to-left section */
1397
- bidi?: boolean; /** Header references */
1398
- headerReferences?: HeaderReference[]; /** Footer references */
1399
- footerReferences?: FooterReference[]; /** Different first page header/footer */
1400
- titlePg?: boolean; /** Different odd/even page headers/footers */
1401
- evenAndOddHeaders?: boolean; /** Line numbering settings */
1783
+ /** Page width in twips */
1784
+ pageWidth?: number;
1785
+ /** Page height in twips */
1786
+ pageHeight?: number;
1787
+ /** Page orientation */
1788
+ orientation?: PageOrientation;
1789
+ /** Top margin in twips */
1790
+ marginTop?: number;
1791
+ /** Bottom margin in twips */
1792
+ marginBottom?: number;
1793
+ /** Left margin in twips */
1794
+ marginLeft?: number;
1795
+ /** Right margin in twips */
1796
+ marginRight?: number;
1797
+ /** Header distance from top in twips */
1798
+ headerDistance?: number;
1799
+ /** Footer distance from bottom in twips */
1800
+ footerDistance?: number;
1801
+ /** Gutter margin in twips */
1802
+ gutter?: number;
1803
+ /** Number of columns */
1804
+ columnCount?: number;
1805
+ /** Space between columns in twips */
1806
+ columnSpace?: number;
1807
+ /** Equal width columns */
1808
+ equalWidth?: boolean;
1809
+ /** Separator line between columns */
1810
+ separator?: boolean;
1811
+ /** Individual column definitions */
1812
+ columns?: Column[];
1813
+ /** Section start type */
1814
+ sectionStart?: SectionStart;
1815
+ /** Vertical alignment of text */
1816
+ verticalAlign?: VerticalAlign;
1817
+ /** Section text direction */
1818
+ textDirection?: SectionTextDirection;
1819
+ /** Right-to-left section */
1820
+ bidi?: boolean;
1821
+ /** Header references */
1822
+ headerReferences?: HeaderReference[];
1823
+ /** Footer references */
1824
+ footerReferences?: FooterReference[];
1825
+ /** Different first page header/footer */
1826
+ titlePg?: boolean;
1827
+ /** Different odd/even page headers/footers */
1828
+ evenAndOddHeaders?: boolean;
1829
+ /** Line numbering settings */
1402
1830
  lineNumbers?: {
1403
1831
  start?: number;
1404
1832
  countBy?: number;
1405
1833
  distance?: number;
1406
1834
  restart?: LineNumberRestart;
1407
- }; /** Page numbering settings */
1835
+ };
1836
+ /** Page numbering settings */
1408
1837
  pageNumbering?: {
1409
1838
  format?: string;
1410
1839
  start?: number;
1411
1840
  chapterStyle?: number;
1412
1841
  chapterSeparator?: string;
1413
- }; /** Page borders */
1842
+ };
1843
+ /** Page borders */
1414
1844
  pageBorders?: {
1415
1845
  top?: BorderSpec;
1416
1846
  bottom?: BorderSpec;
1417
1847
  left?: BorderSpec;
1418
- right?: BorderSpec; /** Display setting */
1419
- display?: "allPages" | "firstPage" | "notFirstPage"; /** Offset from */
1420
- offsetFrom?: "page" | "text"; /** Z-order */
1848
+ right?: BorderSpec;
1849
+ /** Display setting */
1850
+ display?: "allPages" | "firstPage" | "notFirstPage";
1851
+ /** Offset from */
1852
+ offsetFrom?: "page" | "text";
1853
+ /** Z-order */
1421
1854
  zOrder?: "front" | "back";
1422
- }; /** Page background */
1855
+ };
1856
+ /** Page background */
1423
1857
  background?: {
1424
1858
  color?: ColorValue;
1425
1859
  themeColor?: ThemeColorSlot;
1426
1860
  themeTint?: string;
1427
1861
  themeShade?: string;
1428
- }; /** Footnote properties for this section */
1429
- footnotePr?: FootnoteProperties; /** Number of footnote columns in this section (`w15:footnoteColumns`) */
1430
- footnoteColumns?: number; /** Endnote properties for this section */
1431
- endnotePr?: EndnoteProperties; /** Document grid */
1862
+ };
1863
+ /** Footnote properties for this section */
1864
+ footnotePr?: FootnoteProperties;
1865
+ /** Number of footnote columns in this section (`w15:footnoteColumns`) */
1866
+ footnoteColumns?: number;
1867
+ /** Endnote properties for this section */
1868
+ endnotePr?: EndnoteProperties;
1869
+ /** Document grid */
1432
1870
  docGrid?: {
1433
1871
  type?: "default" | "lines" | "linesAndChars" | "snapToChars";
1434
1872
  linePitch?: number;
1435
1873
  charSpace?: number;
1436
- }; /** First page paper source */
1437
- paperSrcFirst?: number; /** Other pages paper source */
1438
- paperSrcOther?: number; /** Protected forms in this section */
1439
- formProtection?: boolean; /** Suppress endnotes in this section */
1440
- noEndnote?: boolean; /** Use right-to-left gutter in this section */
1441
- rtlGutter?: boolean; /** Relationship id for printer settings */
1442
- printerSettingsRelationshipId?: string; /** Section-level tracked property changes (w:sectPrChange) */
1874
+ };
1875
+ /** First page paper source */
1876
+ paperSrcFirst?: number;
1877
+ /** Other pages paper source */
1878
+ paperSrcOther?: number;
1879
+ /** Protected forms in this section */
1880
+ formProtection?: boolean;
1881
+ /** Suppress endnotes in this section */
1882
+ noEndnote?: boolean;
1883
+ /** Use right-to-left gutter in this section */
1884
+ rtlGutter?: boolean;
1885
+ /** Relationship id for printer settings */
1886
+ printerSettingsRelationshipId?: string;
1887
+ /** Section-level tracked property changes (w:sectPrChange) */
1443
1888
  propertyChanges?: SectionPropertyChange[];
1444
1889
  };
1445
1890
  /**
@@ -1450,18 +1895,26 @@ type BlockContent = Paragraph | Table | BlockSdt;
1450
1895
  * Section (implicit or explicit based on sectPr)
1451
1896
  */
1452
1897
  type Section = {
1453
- /** Section properties */properties: SectionProperties; /** Content in this section */
1454
- content: BlockContent[]; /** Headers for this section */
1455
- headers?: Map<HeaderFooterType, HeaderFooter>; /** Footers for this section */
1898
+ /** Section properties */
1899
+ properties: SectionProperties;
1900
+ /** Content in this section */
1901
+ content: BlockContent[];
1902
+ /** Headers for this section */
1903
+ headers?: Map<HeaderFooterType, HeaderFooter>;
1904
+ /** Footers for this section */
1456
1905
  footers?: Map<HeaderFooterType, HeaderFooter>;
1457
1906
  };
1458
1907
  /**
1459
1908
  * Document body (w:body)
1460
1909
  */
1461
1910
  type DocumentBody = {
1462
- /** All content (paragraphs, tables) */content: BlockContent[]; /** Sections (derived from sectPr in paragraphs and final sectPr) */
1463
- sections?: Section[]; /** Final section properties (from body's sectPr) */
1464
- finalSectionProperties?: SectionProperties; /** Comments from comments.xml */
1911
+ /** All content (paragraphs, tables) */
1912
+ content: BlockContent[];
1913
+ /** Sections (derived from sectPr in paragraphs and final sectPr) */
1914
+ sections?: Section[];
1915
+ /** Final section properties (from body's sectPr) */
1916
+ finalSectionProperties?: SectionProperties;
1917
+ /** Comments from comments.xml */
1465
1918
  comments?: Comment[];
1466
1919
  };
1467
1920
  //#endregion
@@ -1474,24 +1927,43 @@ type StyleType = "paragraph" | "character" | "numbering" | "table";
1474
1927
  * Style definition
1475
1928
  */
1476
1929
  type Style = {
1477
- /** Style ID */styleId: string; /** Style type */
1478
- type: StyleType; /** Display name */
1479
- name?: string; /** Based on style ID */
1480
- basedOn?: string; /** Next style after Enter (for paragraph styles) */
1481
- next?: string; /** Linked style (paragraph/character pair) */
1482
- link?: string; /** UI sort priority */
1483
- uiPriority?: number; /** Hidden from UI */
1484
- hidden?: boolean; /** Semi-hidden from UI */
1485
- semiHidden?: boolean; /** Unhide when used */
1486
- unhideWhenUsed?: boolean; /** Quick format in gallery */
1487
- qFormat?: boolean; /** Is default style */
1488
- default?: boolean; /** Personal style (custom) */
1489
- personal?: boolean; /** Paragraph properties (for paragraph/table styles) */
1490
- pPr?: ParagraphFormatting; /** Run properties */
1491
- rPr?: TextFormatting; /** Table properties (for table styles) */
1492
- tblPr?: TableFormatting; /** Table row properties */
1493
- trPr?: TableRowFormatting; /** Table cell properties */
1494
- tcPr?: TableCellFormatting; /** Conditional table style parts */
1930
+ /** Style ID */
1931
+ styleId: string;
1932
+ /** Style type */
1933
+ type: StyleType;
1934
+ /** Display name */
1935
+ name?: string;
1936
+ /** Based on style ID */
1937
+ basedOn?: string;
1938
+ /** Next style after Enter (for paragraph styles) */
1939
+ next?: string;
1940
+ /** Linked style (paragraph/character pair) */
1941
+ link?: string;
1942
+ /** UI sort priority */
1943
+ uiPriority?: number;
1944
+ /** Hidden from UI */
1945
+ hidden?: boolean;
1946
+ /** Semi-hidden from UI */
1947
+ semiHidden?: boolean;
1948
+ /** Unhide when used */
1949
+ unhideWhenUsed?: boolean;
1950
+ /** Quick format in gallery */
1951
+ qFormat?: boolean;
1952
+ /** Is default style */
1953
+ default?: boolean;
1954
+ /** Personal style (custom) */
1955
+ personal?: boolean;
1956
+ /** Paragraph properties (for paragraph/table styles) */
1957
+ pPr?: ParagraphFormatting;
1958
+ /** Run properties */
1959
+ rPr?: TextFormatting;
1960
+ /** Table properties (for table styles) */
1961
+ tblPr?: TableFormatting;
1962
+ /** Table row properties */
1963
+ trPr?: TableRowFormatting;
1964
+ /** Table cell properties */
1965
+ tcPr?: TableCellFormatting;
1966
+ /** Conditional table style parts */
1495
1967
  tblStylePr?: {
1496
1968
  type: "band1Horz" | "band1Vert" | "band2Horz" | "band2Vert" | "firstCol" | "firstRow" | "lastCol" | "lastRow" | "neCell" | "nwCell" | "seCell" | "swCell" | "wholeTable";
1497
1969
  pPr?: ParagraphFormatting;
@@ -1505,14 +1977,18 @@ type Style = {
1505
1977
  * Document defaults (w:docDefaults)
1506
1978
  */
1507
1979
  type DocDefaults = {
1508
- /** Default run properties */rPr?: TextFormatting; /** Default paragraph properties */
1980
+ /** Default run properties */
1981
+ rPr?: TextFormatting;
1982
+ /** Default paragraph properties */
1509
1983
  pPr?: ParagraphFormatting;
1510
1984
  };
1511
1985
  /**
1512
1986
  * Style definitions from styles.xml
1513
1987
  */
1514
1988
  type StyleDefinitions = {
1515
- /** Document defaults */docDefaults?: DocDefaults; /** Latent styles */
1989
+ /** Document defaults */
1990
+ docDefaults?: DocDefaults;
1991
+ /** Latent styles */
1516
1992
  latentStyles?: {
1517
1993
  defLockedState?: boolean;
1518
1994
  defUIPriority?: number;
@@ -1520,49 +1996,67 @@ type StyleDefinitions = {
1520
1996
  defUnhideWhenUsed?: boolean;
1521
1997
  defQFormat?: boolean;
1522
1998
  count?: number;
1523
- }; /** Style definitions */
1999
+ };
2000
+ /** Style definitions */
1524
2001
  styles: Style[];
1525
2002
  };
1526
2003
  /**
1527
2004
  * Theme color scheme (a:clrScheme)
1528
2005
  */
1529
2006
  type ThemeColorScheme = {
1530
- /** Dark 1 color (usually black) */dk1?: string; /** Light 1 color (usually white) */
1531
- lt1?: string; /** Dark 2 color */
1532
- dk2?: string; /** Light 2 color */
1533
- lt2?: string; /** Accent colors 1-6 */
2007
+ /** Dark 1 color (usually black) */
2008
+ dk1?: string;
2009
+ /** Light 1 color (usually white) */
2010
+ lt1?: string;
2011
+ /** Dark 2 color */
2012
+ dk2?: string;
2013
+ /** Light 2 color */
2014
+ lt2?: string;
2015
+ /** Accent colors 1-6 */
1534
2016
  accent1?: string;
1535
2017
  accent2?: string;
1536
2018
  accent3?: string;
1537
2019
  accent4?: string;
1538
2020
  accent5?: string;
1539
- accent6?: string; /** Hyperlink color */
1540
- hlink?: string; /** Followed hyperlink color */
2021
+ accent6?: string;
2022
+ /** Hyperlink color */
2023
+ hlink?: string;
2024
+ /** Followed hyperlink color */
1541
2025
  folHlink?: string;
1542
2026
  };
1543
2027
  /**
1544
2028
  * Theme font (with script variants)
1545
2029
  */
1546
2030
  type ThemeFont = {
1547
- /** Latin font */latin?: string; /** East Asian font */
1548
- ea?: string; /** Complex script font */
1549
- cs?: string; /** Script-specific fonts */
2031
+ /** Latin font */
2032
+ latin?: string;
2033
+ /** East Asian font */
2034
+ ea?: string;
2035
+ /** Complex script font */
2036
+ cs?: string;
2037
+ /** Script-specific fonts */
1550
2038
  fonts?: Record<string, string>;
1551
2039
  };
1552
2040
  /**
1553
2041
  * Theme font scheme (a:fontScheme)
1554
2042
  */
1555
2043
  type ThemeFontScheme = {
1556
- /** Major font (headings) */majorFont?: ThemeFont; /** Minor font (body text) */
2044
+ /** Major font (headings) */
2045
+ majorFont?: ThemeFont;
2046
+ /** Minor font (body text) */
1557
2047
  minorFont?: ThemeFont;
1558
2048
  };
1559
2049
  /**
1560
2050
  * Theme (from theme1.xml)
1561
2051
  */
1562
2052
  type Theme = {
1563
- /** Theme name */name?: string; /** Color scheme */
1564
- colorScheme?: ThemeColorScheme; /** Font scheme */
1565
- fontScheme?: ThemeFontScheme; /** Format scheme (fills, lines, effects) - simplified */
2053
+ /** Theme name */
2054
+ name?: string;
2055
+ /** Color scheme */
2056
+ colorScheme?: ThemeColorScheme;
2057
+ /** Font scheme */
2058
+ fontScheme?: ThemeFontScheme;
2059
+ /** Format scheme (fills, lines, effects) - simplified */
1566
2060
  formatScheme?: {
1567
2061
  name?: string;
1568
2062
  };
@@ -1571,12 +2065,19 @@ type Theme = {
1571
2065
  * Font info from fontTable.xml
1572
2066
  */
1573
2067
  type FontInfo = {
1574
- /** Font name */name: string; /** Alternate names */
1575
- altName?: string; /** Panose-1 classification */
1576
- panose1?: string; /** Character set */
1577
- charset?: string; /** Font family type */
1578
- family?: "decorative" | "modern" | "roman" | "script" | "swiss" | "auto"; /** Pitch (fixed or variable) */
1579
- pitch?: "default" | "fixed" | "variable"; /** Signature */
2068
+ /** Font name */
2069
+ name: string;
2070
+ /** Alternate names */
2071
+ altName?: string;
2072
+ /** Panose-1 classification */
2073
+ panose1?: string;
2074
+ /** Character set */
2075
+ charset?: string;
2076
+ /** Font family type */
2077
+ family?: "decorative" | "modern" | "roman" | "script" | "swiss" | "auto";
2078
+ /** Pitch (fixed or variable) */
2079
+ pitch?: "default" | "fixed" | "variable";
2080
+ /** Signature */
1580
2081
  sig?: {
1581
2082
  usb0?: string;
1582
2083
  usb1?: string;
@@ -1584,7 +2085,8 @@ type FontInfo = {
1584
2085
  usb3?: string;
1585
2086
  csb0?: string;
1586
2087
  csb1?: string;
1587
- }; /** Embedded font data reference */
2088
+ };
2089
+ /** Embedded font data reference */
1588
2090
  embedRegular?: string;
1589
2091
  embedBold?: string;
1590
2092
  embedItalic?: string;
@@ -1604,9 +2106,13 @@ type RelationshipType = string;
1604
2106
  * Relationship entry
1605
2107
  */
1606
2108
  type Relationship = {
1607
- /** Relationship ID (e.g., "rId1") */id: string; /** Relationship type URI */
1608
- type: RelationshipType; /** Target path or URL */
1609
- target: string; /** Target mode */
2109
+ /** Relationship ID (e.g., "rId1") */
2110
+ id: string;
2111
+ /** Relationship type URI */
2112
+ type: RelationshipType;
2113
+ /** Target path or URL */
2114
+ target: string;
2115
+ /** Target mode */
1610
2116
  targetMode?: "External" | "Internal";
1611
2117
  };
1612
2118
  /**
@@ -1617,11 +2123,17 @@ type RelationshipMap = Map<string, Relationship>;
1617
2123
  * Media file from word/media/
1618
2124
  */
1619
2125
  type MediaFile = {
1620
- /** File path in ZIP */path: string; /** Original filename */
1621
- filename?: string; /** MIME type */
1622
- mimeType: string; /** Binary data */
1623
- data: ArrayBuffer; /** Base64 encoded data for rendering */
1624
- base64?: string; /** Data URL for direct use in src attributes */
2126
+ /** File path in ZIP */
2127
+ path: string;
2128
+ /** Original filename */
2129
+ filename?: string;
2130
+ /** MIME type */
2131
+ mimeType: string;
2132
+ /** Binary data */
2133
+ data: ArrayBuffer;
2134
+ /** Base64 encoded data for rendering */
2135
+ base64?: string;
2136
+ /** Data URL for direct use in src attributes */
1625
2137
  dataUrl?: string;
1626
2138
  };
1627
2139
  //#endregion
@@ -1656,11 +2168,16 @@ type DocumentSettings = {
1656
2168
  themeFontLang?: {
1657
2169
  eastAsia?: string;
1658
2170
  bidi?: string;
1659
- }; /** Automatically hyphenate eligible paragraphs (`w:autoHyphenation`). */
1660
- autoHyphenation?: boolean; /** Keep all-capital words unhyphenated (`w:doNotHyphenateCaps`). */
1661
- doNotHyphenateCaps?: boolean; /** Maximum consecutive automatically hyphenated lines; zero means unlimited. */
1662
- consecutiveHyphenLimit?: number; /** Legacy hyphenation zone (`w:hyphenationZone`) in twips; retained for compatibility tooling. */
1663
- hyphenationZoneTwips?: number; /** Word/OOXML document-wide line-breaking overrides. */
2171
+ };
2172
+ /** Automatically hyphenate eligible paragraphs (`w:autoHyphenation`). */
2173
+ autoHyphenation?: boolean;
2174
+ /** Keep all-capital words unhyphenated (`w:doNotHyphenateCaps`). */
2175
+ doNotHyphenateCaps?: boolean;
2176
+ /** Maximum consecutive automatically hyphenated lines; zero means unlimited. */
2177
+ consecutiveHyphenLimit?: number;
2178
+ /** Legacy hyphenation zone (`w:hyphenationZone`) in twips; retained for compatibility tooling. */
2179
+ hyphenationZoneTwips?: number;
2180
+ /** Word/OOXML document-wide line-breaking overrides. */
1664
2181
  lineBreakRules?: {
1665
2182
  noLineBreaksBefore?: {
1666
2183
  language?: string;
@@ -1671,7 +2188,8 @@ type DocumentSettings = {
1671
2188
  characters: string;
1672
2189
  };
1673
2190
  useLegacyEthiopicAmharicRules?: boolean;
1674
- }; /** Move a break-only paragraph mark onto the page after its hard page break. */
2191
+ };
2192
+ /** Move a break-only paragraph mark onto the page after its hard page break. */
1675
2193
  splitPageBreakAndParagraphMark?: boolean;
1676
2194
  };
1677
2195
  /** DOCX package conformance classes. */
@@ -1684,19 +2202,33 @@ declare const DOCX_CONFORMANCE_CLASSES: Readonly<{
1684
2202
  type DocxConformanceClass = (typeof DOCX_CONFORMANCE_CLASSES)[keyof typeof DOCX_CONFORMANCE_CLASSES];
1685
2203
  /** Complete DOCX package structure. */
1686
2204
  type DocxPackage = {
1687
- /** Conformance class detected from the main document namespace. */conformanceClass?: DocxConformanceClass; /** Document body */
1688
- document: DocumentBody; /** Document-wide settings (`word/settings.xml`). */
1689
- settings?: DocumentSettings; /** Style definitions */
1690
- styles?: StyleDefinitions; /** Theme */
1691
- theme?: Theme; /** Numbering definitions */
1692
- numbering?: NumberingDefinitions; /** Font table */
1693
- fontTable?: FontTable; /** Footnotes */
1694
- footnotes?: Footnote[]; /** Endnotes */
1695
- endnotes?: Endnote[]; /** Headers by relationship ID */
1696
- headers?: Map<string, HeaderFooter>; /** Footers by relationship ID */
1697
- footers?: Map<string, HeaderFooter>; /** Document relationships */
1698
- relationships?: RelationshipMap; /** Media files */
1699
- media?: Map<string, MediaFile>; /** Document properties */
2205
+ /** Conformance class detected from the main document namespace. */
2206
+ conformanceClass?: DocxConformanceClass;
2207
+ /** Document body */
2208
+ document: DocumentBody;
2209
+ /** Document-wide settings (`word/settings.xml`). */
2210
+ settings?: DocumentSettings;
2211
+ /** Style definitions */
2212
+ styles?: StyleDefinitions;
2213
+ /** Theme */
2214
+ theme?: Theme;
2215
+ /** Numbering definitions */
2216
+ numbering?: NumberingDefinitions;
2217
+ /** Font table */
2218
+ fontTable?: FontTable;
2219
+ /** Footnotes */
2220
+ footnotes?: Footnote[];
2221
+ /** Endnotes */
2222
+ endnotes?: Endnote[];
2223
+ /** Headers by relationship ID */
2224
+ headers?: Map<string, HeaderFooter>;
2225
+ /** Footers by relationship ID */
2226
+ footers?: Map<string, HeaderFooter>;
2227
+ /** Document relationships */
2228
+ relationships?: RelationshipMap;
2229
+ /** Media files */
2230
+ media?: Map<string, MediaFile>;
2231
+ /** Document properties */
1700
2232
  properties?: {
1701
2233
  title?: string;
1702
2234
  subject?: string;
@@ -1713,11 +2245,16 @@ type DocxPackage = {
1713
2245
  * Complete parsed DOCX document
1714
2246
  */
1715
2247
  type Document = {
1716
- /** DOCX package with all parsed content */package: DocxPackage; /** Original ArrayBuffer for round-trip */
1717
- originalBuffer?: ArrayBuffer; /** Detected template variables ({{...}}) */
1718
- templateVariables?: string[]; /** Font families referenced in the document (extracted during parsing for deferred loading) */
1719
- requiredFonts?: string[]; /** Parsing warnings/errors */
2248
+ /** DOCX package with all parsed content */
2249
+ package: DocxPackage;
2250
+ /** Original ArrayBuffer for round-trip */
2251
+ originalBuffer?: ArrayBuffer;
2252
+ /** Detected template variables ({{...}}) */
2253
+ templateVariables?: string[];
2254
+ /** Font families referenced in the document (extracted during parsing for deferred loading) */
2255
+ requiredFonts?: string[];
2256
+ /** Parsing warnings/errors */
1720
2257
  warnings?: string[];
1721
2258
  };
1722
2259
  //#endregion
1723
- export { ImageTransform as $, VerticalAlign as $t, ComplexField as A, BorderSpec as An, SectionStart as At, FooterReference as B, TabContent as Bt, BookmarkStart as C, TableLook as Cn, RunContent as Ct, CommentRangeEnd as D, TextEffect as Dn, Section as Dt, Comment as E, TableWidthType as En, SdtType as Et, EndnotePosition as F, ShapeTextBody as Ft, HeaderFooterType as G, TableRow as Gt, FootnotePosition as H, TableCell as Ht, EndnoteProperties as I, ShapeType as It, Image as J, TextBox as Jt, HeaderReference as K, TableRowPropertyChange as Kt, Field as L, SimpleField as Lt, DocumentBody as M, KnownBorderStyle as Mn, ShapeContent as Mt, DrawingContent as N, ShadingProperties as Nn, ShapeFill as Nt, CommentRangeStart as O, TextFormatting as On, SectionProperties as Ot, Endnote as P, ThemeColorSlot as Pn, ShapeOutline as Pt, ImageSize as Q, TrackedRunChange as Qt, FieldCharContent as R, SoftHyphenContent as Rt, BookmarkEnd as S, TableFormatting as Sn, Run as St, Column as T, TableRowFormatting as Tn, SdtProperties as Tt, FootnoteProperties as U, TableCellPropertyChange as Ut, Footnote as V, Table as Vt, HeaderFooter as W, TablePropertyChange as Wt, ImagePadding as X, TextWatermark as Xt, ImageCrop as Y, TextContent as Yt, ImagePosition as Z, TrackedChangeInfo as Zt, ThemeColorScheme as _, TabStop as _n, ParagraphContent as _t, DocxPackage as a, NumberFormat as an, MathEquation as at, BlockContent as b, TableCellBorders as bn, PictureWatermark as bt, FontTable as c, CellMargins as cn, MoveFromRangeStart as ct, RelationshipMap as d, FloatingTableProperties as dn, MoveToRangeStart as dt, Watermark as en, ImageWrap as et, RelationshipType as f, LineSpacingRule as fn, NoBreakHyphenContent as ft, Theme as g, TabLeader as gn, Paragraph as gt, StyleType as h, SpacingExplicit as hn, PageOrientation as ht, DocxConformanceClass as i, ListRendering as in, LineNumberRestart as it, Deletion as j, ColorValue as jn, Shape as jt, CommentReference as k, UnderlineStyle as kn, SectionPropertyChange as kt, MediaFile as l, ConditionalFormatStyle as ln, MoveTo as lt, StyleDefinitions as m, ParagraphFormatting as mn, NoteReferenceContent as mt, Document as n, LevelSuffix as nn, Insertion as nt, DocDefaults as o, NumberingDefinitions as on, MoveFrom as ot, Style as p, ParagraphAlignment as pn, NoteNumberRestart as pt, Hyperlink as q, TableStructuralChangeInfo as qt, DocumentSettings as r, ListLevel as rn, InstrTextContent as rt, FontInfo as s, NumberingInstance as sn, MoveFromRangeEnd as st, DOCX_CONFORMANCE_CLASSES as t, AbstractNumbering as tn, InlineSdt as tt, Relationship as u, EmphasisMark as un, MoveToRangeEnd as ut, ThemeFont as v, TabStopAlignment as vn, ParagraphMarkChange as vt, BreakContent as w, TableMeasurement as wn, RunPropertyChange as wt, BlockSdt as x, TableCellFormatting as xn, PropertyChangeInfo as xt, ThemeFontScheme as y, TableBorders as yn, ParagraphPropertyChange as yt, FieldType as z, SymbolContent as zt };
2260
+ export { ImageTransform as $, TrackedRunChange as $t, ComplexField as A, TextFormatting as An, SectionPropertyChange as At, FooterReference as B, SymbolContent as Bt, BookmarkStart as C, TableCellFormatting as Cn, Run as Ct, CommentRangeEnd as D, TableRowFormatting as Dn, SdtType as Dt, Comment as E, TableMeasurement as En, SdtProperties as Et, EndnotePosition as F, ShadingProperties as Fn, ShapeOutline as Ft, HeaderFooterType as G, TablePropertyChange as Gt, FootnotePosition as H, Table as Ht, EndnoteProperties as I, ThemeColorSlot as In, ShapeTextBody as It, Image as J, TableStructuralChangeInfo as Jt, HeaderReference as K, TableRow as Kt, Field as L, ShapeType as Lt, DocumentBody as M, BorderSpec as Mn, Shape as Mt, DrawingContent as N, ColorValue as Nn, ShapeContent as Nt, CommentRangeStart as O, TableWidthType as On, Section as Ot, Endnote as P, KnownBorderStyle as Pn, ShapeFill as Pt, ImageSize as Q, TrackedChangeInfo as Qt, FieldCharContent as R, SimpleField as Rt, BookmarkEnd as S, TableCellBorders as Sn, PropertyChangeInfo as St, Column as T, TableLook as Tn, RunPropertyChange as Tt, FootnoteProperties as U, TableCell as Ut, Footnote as V, TabContent as Vt, HeaderFooter as W, TableCellPropertyChange as Wt, ImagePadding as X, TextContent as Xt, ImageCrop as Y, TextBox as Yt, ImagePosition as Z, TextWatermark as Zt, ThemeColorScheme as _, SpacingExplicit as _n, Paragraph as _t, DocxPackage as a, ListLevel as an, MAX_REVISION_ID as at, BlockContent as b, TabStopAlignment as bn, ParagraphPropertyChange as bt, FontTable as c, NumberingDefinitions as cn, MoveFromRangeEnd as ct, RelationshipMap as d, ConditionalFormatStyle as dn, MoveToRangeEnd as dt, VerticalAlign as en, ImageWrap as et, RelationshipType as f, EmphasisMark as fn, MoveToRangeStart as ft, Theme as g, ParagraphFormatting as gn, PageOrientation as gt, StyleType as h, ParagraphAlignment as hn, NoteReferenceContent as ht, DocxConformanceClass as i, LevelSuffix as in, LineNumberRestart as it, Deletion as j, UnderlineStyle as jn, SectionStart as jt, CommentReference as k, TextEffect as kn, SectionProperties as kt, MediaFile as l, NumberingInstance as ln, MoveFromRangeStart as lt, StyleDefinitions as m, LineSpacingRule as mn, NoteNumberRestart as mt, Document as n, normalizeRevisionId as nn, Insertion as nt, DocDefaults as o, ListRendering as on, MathEquation as ot, Style as p, FloatingTableProperties as pn, NoBreakHyphenContent as pt, Hyperlink as q, TableRowPropertyChange as qt, DocumentSettings as r, AbstractNumbering as rn, InstrTextContent as rt, FontInfo as s, NumberFormat as sn, MoveFrom as st, DOCX_CONFORMANCE_CLASSES as t, Watermark as tn, InlineSdt as tt, Relationship as u, CellMargins as un, MoveTo as ut, ThemeFont as v, TabLeader as vn, ParagraphContent as vt, BreakContent as w, TableFormatting as wn, RunContent as wt, BlockSdt as x, TableBorders as xn, PictureWatermark as xt, ThemeFontScheme as y, TabStop as yn, ParagraphMarkChange as yt, FieldType as z, SoftHyphenContent as zt };