@stll/docx-core 0.0.1-placeholder.0 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -0
- package/dist/document-IR6XvC0O.d.ts +1659 -0
- package/dist/index.d.ts +143 -0
- package/dist/index.js +1927 -0
- package/dist/model/document.d.ts +2 -0
- package/dist/model/document.js +0 -0
- package/package.json +64 -3
|
@@ -0,0 +1,1659 @@
|
|
|
1
|
+
//#region src/model/colors.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Color & Styling Primitives
|
|
4
|
+
*
|
|
5
|
+
* Basic types used throughout OOXML for colors, borders, and shading.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Theme color slots from theme1.xml
|
|
9
|
+
*/
|
|
10
|
+
type ThemeColorSlot = "dk1" | "lt1" | "dk2" | "lt2" | "accent1" | "accent2" | "accent3" | "accent4" | "accent5" | "accent6" | "hlink" | "folHlink" | "background1" | "text1" | "background2" | "text2";
|
|
11
|
+
/**
|
|
12
|
+
* Color value - can be direct RGB, theme reference, or auto
|
|
13
|
+
*/
|
|
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) */
|
|
19
|
+
auto?: boolean;
|
|
20
|
+
};
|
|
21
|
+
type KnownBorderStyle = "none" | "single" | "double" | "dotted" | "dashed" | "thick" | "triple" | "thinThickSmallGap" | "thickThinSmallGap" | "thinThickMediumGap" | "thickThinMediumGap" | "thinThickLargeGap" | "thickThinLargeGap" | "wave" | "doubleWave" | "dashSmallGap" | "dashDotStroked" | "threeDEmboss" | "threeDEngrave" | "outset" | "inset" | "nil";
|
|
22
|
+
/**
|
|
23
|
+
* Border specification for any border (paragraph, table, page)
|
|
24
|
+
*/
|
|
25
|
+
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
|
+
frame?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Custom page-border art relationship id (`w:id` on `<w:pgBorders>` side
|
|
34
|
+
* children). Preserved for round-trip; folio does not paint art glyphs.
|
|
35
|
+
*/
|
|
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. */
|
|
40
|
+
bottomRightArtRelationshipId?: string;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Shading/background properties
|
|
44
|
+
*/
|
|
45
|
+
type ShadingProperties = {
|
|
46
|
+
/** Pattern fill color */color?: ColorValue; /** Background fill color */
|
|
47
|
+
fill?: ColorValue; /** Shading pattern type */
|
|
48
|
+
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
|
+
};
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/model/formatting.d.ts
|
|
52
|
+
/**
|
|
53
|
+
* Underline style options
|
|
54
|
+
*/
|
|
55
|
+
type UnderlineStyle = "none" | "single" | "words" | "double" | "thick" | "dotted" | "dottedHeavy" | "dash" | "dashedHeavy" | "dashLong" | "dashLongHeavy" | "dotDash" | "dashDotHeavy" | "dotDotDash" | "dashDotDotHeavy" | "wave" | "wavyHeavy" | "wavyDouble";
|
|
56
|
+
/**
|
|
57
|
+
* Text effect animations
|
|
58
|
+
*/
|
|
59
|
+
type TextEffect = "none" | "blinkBackground" | "lights" | "antsBlack" | "antsRed" | "shimmer" | "sparkle";
|
|
60
|
+
/**
|
|
61
|
+
* Emphasis mark type
|
|
62
|
+
*/
|
|
63
|
+
type EmphasisMark = "none" | "dot" | "comma" | "circle" | "underDot";
|
|
64
|
+
/**
|
|
65
|
+
* Complete text formatting properties (w:rPr)
|
|
66
|
+
*/
|
|
67
|
+
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) */
|
|
72
|
+
underline?: {
|
|
73
|
+
style: UnderlineStyle;
|
|
74
|
+
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) */
|
|
87
|
+
fontFamily?: {
|
|
88
|
+
ascii?: string;
|
|
89
|
+
hAnsi?: string;
|
|
90
|
+
eastAsia?: string;
|
|
91
|
+
cs?: string; /** Theme font reference */
|
|
92
|
+
asciiTheme?: "majorAscii" | "majorHAnsi" | "majorEastAsia" | "majorBidi" | "minorAscii" | "minorHAnsi" | "minorEastAsia" | "minorBidi";
|
|
93
|
+
hAnsiTheme?: string;
|
|
94
|
+
eastAsiaTheme?: string;
|
|
95
|
+
csTheme?: string;
|
|
96
|
+
}; /** Character spacing in twips (w:spacing) */
|
|
97
|
+
spacing?: number; /** Raised/lowered text position in half-points (w:position) */
|
|
98
|
+
position?: number; /** Horizontal text scale percentage (w:w) */
|
|
99
|
+
scale?: number; /** Kerning threshold in half-points (w:kern) */
|
|
100
|
+
kerning?: number; /** Text effect animation (w:effect) */
|
|
101
|
+
effect?: TextEffect; /** Emphasis mark (w:em) */
|
|
102
|
+
emphasisMark?: EmphasisMark; /** Emboss effect (w:emboss) */
|
|
103
|
+
emboss?: boolean; /** Imprint/engrave effect (w:imprint) */
|
|
104
|
+
imprint?: boolean; /** Outline effect (w:outline) */
|
|
105
|
+
outline?: boolean; /** Shadow effect (w:shadow) */
|
|
106
|
+
shadow?: boolean; /** Right-to-left text (w:rtl) */
|
|
107
|
+
rtl?: boolean; /** Complex script formatting (w:cs) */
|
|
108
|
+
cs?: boolean; /** Character style ID (w:rStyle) */
|
|
109
|
+
styleId?: string;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Tab stop alignment
|
|
113
|
+
*/
|
|
114
|
+
type TabStopAlignment = "left" | "center" | "right" | "decimal" | "bar" | "clear" | "num";
|
|
115
|
+
/**
|
|
116
|
+
* Tab leader character
|
|
117
|
+
*/
|
|
118
|
+
type TabLeader = "none" | "dot" | "hyphen" | "underscore" | "heavy" | "middleDot";
|
|
119
|
+
/**
|
|
120
|
+
* Tab stop definition
|
|
121
|
+
*/
|
|
122
|
+
type TabStop = {
|
|
123
|
+
/** Position in twips from left margin */position: number; /** Alignment at tab stop */
|
|
124
|
+
alignment: TabStopAlignment; /** Leader character */
|
|
125
|
+
leader?: TabLeader;
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* Line spacing rule
|
|
129
|
+
*/
|
|
130
|
+
type LineSpacingRule = "auto" | "exact" | "atLeast";
|
|
131
|
+
/**
|
|
132
|
+
* Paragraph alignment/justification
|
|
133
|
+
*/
|
|
134
|
+
type ParagraphAlignment = "left" | "center" | "right" | "both" | "distribute" | "mediumKashida" | "highKashida" | "lowKashida" | "thaiDistribute";
|
|
135
|
+
/**
|
|
136
|
+
* Complete paragraph formatting properties (w:pPr)
|
|
137
|
+
*/
|
|
138
|
+
type SpacingExplicit = {
|
|
139
|
+
before?: boolean;
|
|
140
|
+
after?: boolean;
|
|
141
|
+
};
|
|
142
|
+
type ParagraphFormatting = {
|
|
143
|
+
/** Paragraph alignment (w:jc) */alignment?: ParagraphAlignment; /** Text direction (w:bidi) */
|
|
144
|
+
bidi?: boolean; /** Spacing before in twips (w:spacing/@w:before) */
|
|
145
|
+
spaceBefore?: number; /** Spacing after in twips (w:spacing/@w:after) */
|
|
146
|
+
spaceAfter?: number; /** Line spacing value (w:spacing/@w:line) */
|
|
147
|
+
lineSpacing?: number; /** Line spacing rule (w:spacing/@w:lineRule) */
|
|
148
|
+
lineSpacingRule?: LineSpacingRule; /** Auto space before (w:spacing/@w:beforeAutospacing) */
|
|
149
|
+
beforeAutospacing?: boolean; /** Auto space after (w:spacing/@w:afterAutospacing) */
|
|
150
|
+
afterAutospacing?: boolean; /** Which spacing sides came from this paragraph's own pPr. */
|
|
151
|
+
spacingExplicit?: SpacingExplicit; /** Left indent in twips (w:ind/@w:left) */
|
|
152
|
+
indentLeft?: number; /** Right indent in twips (w:ind/@w:right) */
|
|
153
|
+
indentRight?: number; /** First line indent in twips - positive for indent, negative for hanging (w:ind/@w:firstLine or @w:hanging) */
|
|
154
|
+
indentFirstLine?: number; /** Whether first line is hanging indent */
|
|
155
|
+
hangingIndent?: boolean; /** Paragraph borders (w:pBdr) */
|
|
156
|
+
borders?: {
|
|
157
|
+
top?: BorderSpec;
|
|
158
|
+
bottom?: BorderSpec;
|
|
159
|
+
left?: BorderSpec;
|
|
160
|
+
right?: BorderSpec;
|
|
161
|
+
between?: BorderSpec;
|
|
162
|
+
bar?: BorderSpec;
|
|
163
|
+
}; /** Paragraph shading (w:shd) */
|
|
164
|
+
shading?: ShadingProperties; /** Custom tab stops (w:tabs) */
|
|
165
|
+
tabs?: TabStop[]; /** Keep with next paragraph (w:keepNext) */
|
|
166
|
+
keepNext?: boolean; /** Keep lines together (w:keepLines) */
|
|
167
|
+
keepLines?: boolean; /** Widow/orphan control (w:widowControl) */
|
|
168
|
+
widowControl?: boolean; /** Page break before (w:pageBreakBefore) */
|
|
169
|
+
pageBreakBefore?: boolean; /** Contextual spacing — suppress space between paragraphs of the same style (w:contextualSpacing) */
|
|
170
|
+
contextualSpacing?: boolean; /** Numbering properties (w:numPr) */
|
|
171
|
+
numPr?: {
|
|
172
|
+
/** Numbering definition ID (w:numId) */numId?: number; /** List level (0-8) (w:ilvl) */
|
|
173
|
+
ilvl?: number;
|
|
174
|
+
};
|
|
175
|
+
/**
|
|
176
|
+
* When `numPr` was resolved from the paragraph STYLE's pPr rather than the
|
|
177
|
+
* paragraph's own `<w:numPr>`, this records the style-sourced value. The
|
|
178
|
+
* serializer omits `numPr` while it still equals this value — writing it as
|
|
179
|
+
* direct formatting would flip Word's indent precedence (a directly
|
|
180
|
+
* referenced level's indents beat the style's; a style-referenced level's
|
|
181
|
+
* do not) and break the document on save/reload. Cleared the moment the
|
|
182
|
+
* user changes the numbering (values diverge).
|
|
183
|
+
*/
|
|
184
|
+
numPrFromStyle?: {
|
|
185
|
+
numId?: number;
|
|
186
|
+
ilvl?: number;
|
|
187
|
+
}; /** Outline level 0-9 (w:outlineLvl) */
|
|
188
|
+
outlineLevel?: number; /** Paragraph style ID (w:pStyle) */
|
|
189
|
+
styleId?: string; /** Text frame properties (w:framePr) */
|
|
190
|
+
frame?: {
|
|
191
|
+
width?: number;
|
|
192
|
+
height?: number;
|
|
193
|
+
hAnchor?: "text" | "margin" | "page";
|
|
194
|
+
vAnchor?: "text" | "margin" | "page";
|
|
195
|
+
x?: number;
|
|
196
|
+
y?: number;
|
|
197
|
+
xAlign?: "left" | "center" | "right" | "inside" | "outside";
|
|
198
|
+
yAlign?: "top" | "center" | "bottom" | "inside" | "outside" | "inline";
|
|
199
|
+
wrap?: "around" | "auto" | "none" | "notBeside" | "through" | "tight";
|
|
200
|
+
}; /** Suppress line numbers (w:suppressLineNumbers) */
|
|
201
|
+
suppressLineNumbers?: boolean; /** Suppress auto hyphens (w:suppressAutoHyphens) */
|
|
202
|
+
suppressAutoHyphens?: boolean; /** Run properties to apply to all runs (w:rPr) */
|
|
203
|
+
runProperties?: TextFormatting;
|
|
204
|
+
/**
|
|
205
|
+
* Run-in heading: this paragraph's mark carries `<w:specVanish/>`
|
|
206
|
+
* and the next paragraph should render inline on the same line.
|
|
207
|
+
*/
|
|
208
|
+
runInWithNext?: boolean;
|
|
209
|
+
};
|
|
210
|
+
/**
|
|
211
|
+
* Table width type
|
|
212
|
+
*/
|
|
213
|
+
type TableWidthType = "auto" | "dxa" | "nil" | "pct";
|
|
214
|
+
/**
|
|
215
|
+
* Table measurement (width or height)
|
|
216
|
+
*/
|
|
217
|
+
type TableMeasurement = {
|
|
218
|
+
/** Value in twips (for dxa) or fifths of a percent (for pct) */value: number; /** Measurement type */
|
|
219
|
+
type: TableWidthType;
|
|
220
|
+
};
|
|
221
|
+
/**
|
|
222
|
+
* Table borders
|
|
223
|
+
*/
|
|
224
|
+
type TableBorders = {
|
|
225
|
+
top?: BorderSpec;
|
|
226
|
+
bottom?: BorderSpec;
|
|
227
|
+
left?: BorderSpec;
|
|
228
|
+
right?: BorderSpec;
|
|
229
|
+
insideH?: BorderSpec;
|
|
230
|
+
insideV?: BorderSpec;
|
|
231
|
+
};
|
|
232
|
+
/**
|
|
233
|
+
* Cell margins
|
|
234
|
+
*/
|
|
235
|
+
type CellMargins = {
|
|
236
|
+
top?: TableMeasurement;
|
|
237
|
+
bottom?: TableMeasurement;
|
|
238
|
+
left?: TableMeasurement;
|
|
239
|
+
right?: TableMeasurement;
|
|
240
|
+
};
|
|
241
|
+
/**
|
|
242
|
+
* Table look flags (for table styles)
|
|
243
|
+
*/
|
|
244
|
+
type TableLook = {
|
|
245
|
+
firstColumn?: boolean;
|
|
246
|
+
firstRow?: boolean;
|
|
247
|
+
lastColumn?: boolean;
|
|
248
|
+
lastRow?: boolean;
|
|
249
|
+
noHBand?: boolean;
|
|
250
|
+
noVBand?: boolean;
|
|
251
|
+
};
|
|
252
|
+
/**
|
|
253
|
+
* Floating table properties
|
|
254
|
+
*/
|
|
255
|
+
type FloatingTableProperties = {
|
|
256
|
+
/** Horizontal anchor */horzAnchor?: "margin" | "page" | "text"; /** Vertical anchor */
|
|
257
|
+
vertAnchor?: "margin" | "page" | "text"; /** Horizontal position */
|
|
258
|
+
tblpX?: number;
|
|
259
|
+
tblpXSpec?: "left" | "center" | "right" | "inside" | "outside"; /** Vertical position */
|
|
260
|
+
tblpY?: number;
|
|
261
|
+
tblpYSpec?: "top" | "center" | "bottom" | "inside" | "outside" | "inline"; /** Distance from surrounding text */
|
|
262
|
+
topFromText?: number;
|
|
263
|
+
bottomFromText?: number;
|
|
264
|
+
leftFromText?: number;
|
|
265
|
+
rightFromText?: number;
|
|
266
|
+
};
|
|
267
|
+
/**
|
|
268
|
+
* Table formatting properties (w:tblPr)
|
|
269
|
+
*/
|
|
270
|
+
type TableFormatting = {
|
|
271
|
+
/** Table width */width?: TableMeasurement; /** Table justification */
|
|
272
|
+
justification?: "left" | "center" | "right"; /** Cell spacing */
|
|
273
|
+
cellSpacing?: TableMeasurement; /** Table indent from left margin */
|
|
274
|
+
indent?: TableMeasurement; /** Table borders */
|
|
275
|
+
borders?: TableBorders; /** Default cell margins */
|
|
276
|
+
cellMargins?: CellMargins; /** Table layout */
|
|
277
|
+
layout?: "fixed" | "autofit"; /** Table style ID */
|
|
278
|
+
styleId?: string; /** Table look (conditional formatting flags) */
|
|
279
|
+
look?: TableLook; /** Shading/background */
|
|
280
|
+
shading?: ShadingProperties; /** Overlap for floating tables */
|
|
281
|
+
overlap?: "never" | "overlap"; /** Floating table properties */
|
|
282
|
+
floating?: FloatingTableProperties; /** Right to left table */
|
|
283
|
+
bidi?: boolean;
|
|
284
|
+
};
|
|
285
|
+
/**
|
|
286
|
+
* Table row formatting properties (w:trPr)
|
|
287
|
+
*/
|
|
288
|
+
type TableRowFormatting = {
|
|
289
|
+
/** Row height */height?: TableMeasurement; /** Height rule */
|
|
290
|
+
heightRule?: "auto" | "atLeast" | "exact"; /** Header row (repeats on each page) */
|
|
291
|
+
header?: boolean; /** Allow row to break across pages */
|
|
292
|
+
cantSplit?: boolean; /** Row justification */
|
|
293
|
+
justification?: "left" | "center" | "right"; /** Hidden row */
|
|
294
|
+
hidden?: boolean; /** Conditional format style */
|
|
295
|
+
conditionalFormat?: ConditionalFormatStyle;
|
|
296
|
+
};
|
|
297
|
+
/**
|
|
298
|
+
* Conditional format style
|
|
299
|
+
*/
|
|
300
|
+
type ConditionalFormatStyle = {
|
|
301
|
+
/** First row */firstRow?: boolean; /** Last row */
|
|
302
|
+
lastRow?: boolean; /** First column */
|
|
303
|
+
firstColumn?: boolean; /** Last column */
|
|
304
|
+
lastColumn?: boolean; /** Odd horizontal band */
|
|
305
|
+
oddHBand?: boolean; /** Even horizontal band */
|
|
306
|
+
evenHBand?: boolean; /** Odd vertical band */
|
|
307
|
+
oddVBand?: boolean; /** Even vertical band */
|
|
308
|
+
evenVBand?: boolean; /** Northwest corner */
|
|
309
|
+
nwCell?: boolean; /** Northeast corner */
|
|
310
|
+
neCell?: boolean; /** Southwest corner */
|
|
311
|
+
swCell?: boolean; /** Southeast corner */
|
|
312
|
+
seCell?: boolean;
|
|
313
|
+
};
|
|
314
|
+
/**
|
|
315
|
+
* Table cell formatting properties (w:tcPr)
|
|
316
|
+
*/
|
|
317
|
+
type TableCellFormatting = {
|
|
318
|
+
/** Cell width */width?: TableMeasurement; /** Cell borders */
|
|
319
|
+
borders?: TableBorders; /** Cell margins (override table default) */
|
|
320
|
+
margins?: CellMargins; /** Cell shading/background */
|
|
321
|
+
shading?: ShadingProperties; /** Vertical alignment */
|
|
322
|
+
verticalAlign?: "top" | "center" | "bottom"; /** Text direction */
|
|
323
|
+
textDirection?: "lr" | "lrV" | "rl" | "rlV" | "tb" | "tbV" | "tbRl" | "tbRlV" | "btLr"; /** Grid span (horizontal merge) */
|
|
324
|
+
gridSpan?: number; /** Vertical merge */
|
|
325
|
+
vMerge?: "restart" | "continue"; /** Fit text to cell width */
|
|
326
|
+
fitText?: boolean; /** Wrap text */
|
|
327
|
+
noWrap?: boolean; /** Hide cell marker */
|
|
328
|
+
hideMark?: boolean; /** Conditional format style */
|
|
329
|
+
conditionalFormat?: ConditionalFormatStyle;
|
|
330
|
+
};
|
|
331
|
+
//#endregion
|
|
332
|
+
//#region src/model/lists.d.ts
|
|
333
|
+
/**
|
|
334
|
+
* Number format type
|
|
335
|
+
*/
|
|
336
|
+
type NumberFormat = "decimal" | "upperRoman" | "lowerRoman" | "upperLetter" | "lowerLetter" | "ordinal" | "cardinalText" | "ordinalText" | "hex" | "chicago" | "ideographDigital" | "japaneseCounting" | "aiueo" | "iroha" | "decimalFullWidth" | "decimalHalfWidth" | "japaneseLegal" | "japaneseDigitalTenThousand" | "decimalEnclosedCircle" | "decimalFullWidth2" | "aiueoFullWidth" | "irohaFullWidth" | "decimalZero" | "decimalZero3" | "decimalZero4" | "decimalZero5" | "bullet" | "ganada" | "chosung" | "decimalEnclosedFullstop" | "decimalEnclosedParen" | "decimalEnclosedCircleChinese" | "ideographEnclosedCircle" | "ideographTraditional" | "ideographZodiac" | "ideographZodiacTraditional" | "taiwaneseCounting" | "ideographLegalTraditional" | "taiwaneseCountingThousand" | "taiwaneseDigital" | "chineseCounting" | "chineseLegalSimplified" | "chineseCountingThousand" | "koreanDigital" | "koreanCounting" | "koreanLegal" | "koreanDigital2" | "vietnameseCounting" | "russianLower" | "russianUpper" | "none" | "numberInDash" | "hebrew1" | "hebrew2" | "arabicAlpha" | "arabicAbjad" | "hindiVowels" | "hindiConsonants" | "hindiNumbers" | "hindiCounting" | "thaiLetters" | "thaiNumbers" | "thaiCounting";
|
|
337
|
+
/**
|
|
338
|
+
* Multi-level suffix (what follows the number)
|
|
339
|
+
*/
|
|
340
|
+
type LevelSuffix = "tab" | "space" | "nothing";
|
|
341
|
+
/**
|
|
342
|
+
* List level definition
|
|
343
|
+
*/
|
|
344
|
+
type ListLevel = {
|
|
345
|
+
/** Level index (0-8) */ilvl: number; /** Starting number */
|
|
346
|
+
start?: number; /** Number format */
|
|
347
|
+
numFmt: NumberFormat; /** Level text (e.g., "%1." or "•") */
|
|
348
|
+
lvlText: string; /** Justification */
|
|
349
|
+
lvlJc?: "left" | "center" | "right"; /** Suffix after number */
|
|
350
|
+
suffix?: LevelSuffix; /** Paragraph properties for this level */
|
|
351
|
+
pPr?: ParagraphFormatting; /** Run properties for the number/bullet */
|
|
352
|
+
rPr?: TextFormatting; /** Restart numbering from higher level */
|
|
353
|
+
lvlRestart?: number; /** Is legal numbering style */
|
|
354
|
+
isLgl?: boolean; /** Legacy settings */
|
|
355
|
+
legacy?: {
|
|
356
|
+
legacy?: boolean;
|
|
357
|
+
legacySpace?: number;
|
|
358
|
+
legacyIndent?: number;
|
|
359
|
+
};
|
|
360
|
+
};
|
|
361
|
+
/**
|
|
362
|
+
* Abstract numbering definition (w:abstractNum)
|
|
363
|
+
*/
|
|
364
|
+
type AbstractNumbering = {
|
|
365
|
+
/** Abstract numbering ID */abstractNumId: number; /** Multi-level type */
|
|
366
|
+
multiLevelType?: "hybridMultilevel" | "multilevel" | "singleLevel"; /** Numbering style link */
|
|
367
|
+
numStyleLink?: string; /** Style link */
|
|
368
|
+
styleLink?: string; /** Level definitions */
|
|
369
|
+
levels: ListLevel[]; /** Name */
|
|
370
|
+
name?: string;
|
|
371
|
+
};
|
|
372
|
+
/**
|
|
373
|
+
* Numbering instance (w:num)
|
|
374
|
+
*/
|
|
375
|
+
type NumberingInstance = {
|
|
376
|
+
/** Numbering ID (referenced by paragraphs) */numId: number; /** Reference to abstract numbering */
|
|
377
|
+
abstractNumId: number; /** Level overrides */
|
|
378
|
+
levelOverrides?: {
|
|
379
|
+
ilvl: number;
|
|
380
|
+
startOverride?: number;
|
|
381
|
+
lvl?: ListLevel;
|
|
382
|
+
}[];
|
|
383
|
+
};
|
|
384
|
+
/**
|
|
385
|
+
* Computed list rendering info
|
|
386
|
+
*/
|
|
387
|
+
type ListRendering = {
|
|
388
|
+
/** Computed marker text (e.g., "1.", "a)", "•") */marker: string; /** List level (0-8) */
|
|
389
|
+
level: number; /** Numbering ID */
|
|
390
|
+
numId: number; /** Whether this is a bullet or numbered list */
|
|
391
|
+
isBullet: boolean; /** Whether this level uses legal numbering (parent placeholders render decimal). */
|
|
392
|
+
isLegal?: boolean; /** Number format type (decimal, lowerRoman, upperRoman, etc.) */
|
|
393
|
+
numFmt?: NumberFormat; /** Whether the list marker is hidden (w:vanish on level rPr) */
|
|
394
|
+
markerHidden?: boolean; /** Marker font family from numbering level rPr (ascii name) */
|
|
395
|
+
markerFontFamily?: string; /** Marker font size from numbering level rPr, in points */
|
|
396
|
+
markerFontSize?: number;
|
|
397
|
+
/**
|
|
398
|
+
* `w:caps` on the numbering level rPr — the marker text renders in upper
|
|
399
|
+
* case (e.g. "SCHEDULE 1" instead of "Schedule 1"). Apply at substitution
|
|
400
|
+
* time so number-format letters (lowerLetter / lowerRoman) also flip.
|
|
401
|
+
*/
|
|
402
|
+
markerAllCaps?: boolean;
|
|
403
|
+
/**
|
|
404
|
+
* `w:suff` (§17.9.25) — what follows the marker before body text.
|
|
405
|
+
* `tab` (the OOXML default) grows the marker to the next tab stop; `space`
|
|
406
|
+
* adds one space glyph; `nothing` lets body text butt against the marker.
|
|
407
|
+
*/
|
|
408
|
+
markerSuffix?: LevelSuffix; /** Number format for each level from 0 through this paragraph's level. */
|
|
409
|
+
levelNumFmts?: NumberFormat[]; /** Abstract numbering definition shared by one or more numIds. */
|
|
410
|
+
abstractNumId?: number; /** Start override for this numId/level, if the numbering instance defines one. */
|
|
411
|
+
startOverride?: number;
|
|
412
|
+
/**
|
|
413
|
+
* Number of inline `LISTNUM` (default-list) fields the paragraph contains.
|
|
414
|
+
* Each represents an implicit counter advance at `ilvl + 1` (Word's
|
|
415
|
+
* default LISTNUM behaviour), so the next paragraph at that depth picks
|
|
416
|
+
* up the next letter — e.g. an OutNum2 line carrying inline "(a)" must
|
|
417
|
+
* be followed by an OutNum3 "(b)", not another "(a)".
|
|
418
|
+
*/
|
|
419
|
+
implicitChildLevelAdvances?: number;
|
|
420
|
+
/**
|
|
421
|
+
* Column offset (in twips, from the marker zone's left edge) where the
|
|
422
|
+
* second slot of a tab-separated marker should land. Set when LISTNUM is
|
|
423
|
+
* folded into the marker so the cached "(a)" aligns vertically with the
|
|
424
|
+
* deeper level's marker column. Uses the next ilvl's `hangingIndent`.
|
|
425
|
+
*/
|
|
426
|
+
markerSecondSlotOffsetTwips?: number;
|
|
427
|
+
};
|
|
428
|
+
/**
|
|
429
|
+
* Complete numbering definitions
|
|
430
|
+
*/
|
|
431
|
+
type NumberingDefinitions = {
|
|
432
|
+
/** Abstract numbering definitions */abstractNums: AbstractNumbering[]; /** Numbering instances */
|
|
433
|
+
nums: NumberingInstance[];
|
|
434
|
+
};
|
|
435
|
+
//#endregion
|
|
436
|
+
//#region src/model/content.d.ts
|
|
437
|
+
/**
|
|
438
|
+
* Plain text content
|
|
439
|
+
*/
|
|
440
|
+
type TextContent = {
|
|
441
|
+
type: "text"; /** The text string */
|
|
442
|
+
text: string; /** Preserve whitespace (xml:space="preserve") */
|
|
443
|
+
preserveSpace?: boolean;
|
|
444
|
+
};
|
|
445
|
+
/**
|
|
446
|
+
* Tab character
|
|
447
|
+
*/
|
|
448
|
+
type TabContent = {
|
|
449
|
+
type: "tab";
|
|
450
|
+
};
|
|
451
|
+
/**
|
|
452
|
+
* Line break
|
|
453
|
+
*/
|
|
454
|
+
type BreakContent = {
|
|
455
|
+
type: "break"; /** Break type */
|
|
456
|
+
breakType?: "page" | "column" | "textWrapping"; /** Clear type for text wrapping break */
|
|
457
|
+
clear?: "none" | "left" | "right" | "all";
|
|
458
|
+
};
|
|
459
|
+
/**
|
|
460
|
+
* Symbol character (special font character)
|
|
461
|
+
*/
|
|
462
|
+
type SymbolContent = {
|
|
463
|
+
type: "symbol"; /** Font name */
|
|
464
|
+
font: string; /** Character code */
|
|
465
|
+
char: string;
|
|
466
|
+
};
|
|
467
|
+
/**
|
|
468
|
+
* Footnote or endnote reference
|
|
469
|
+
*/
|
|
470
|
+
type NoteReferenceContent = {
|
|
471
|
+
type: "footnoteRef" | "endnoteRef"; /** Note ID */
|
|
472
|
+
id: number;
|
|
473
|
+
};
|
|
474
|
+
/**
|
|
475
|
+
* Field character (begin/separate/end)
|
|
476
|
+
*/
|
|
477
|
+
type FieldCharContent = {
|
|
478
|
+
type: "fieldChar"; /** Field character type */
|
|
479
|
+
charType: "begin" | "separate" | "end"; /** Field is locked */
|
|
480
|
+
fldLock?: boolean; /** Field is dirty (needs update) */
|
|
481
|
+
dirty?: boolean;
|
|
482
|
+
/**
|
|
483
|
+
* Cached display value from a child `<w:numberingChange w:original="…"/>`.
|
|
484
|
+
* Word writes this on the end fldChar of self-numbering fields (LISTNUM,
|
|
485
|
+
* AUTONUM, …) so the static "(a)" / "1." text is recoverable without
|
|
486
|
+
* re-evaluating the field. Used as a fallback `fieldResult` when the
|
|
487
|
+
* field has no `separate` run.
|
|
488
|
+
*/
|
|
489
|
+
originalValue?: string;
|
|
490
|
+
};
|
|
491
|
+
/**
|
|
492
|
+
* Field instruction text
|
|
493
|
+
*/
|
|
494
|
+
type InstrTextContent = {
|
|
495
|
+
type: "instrText"; /** Field instruction */
|
|
496
|
+
text: string;
|
|
497
|
+
};
|
|
498
|
+
/**
|
|
499
|
+
* Soft hyphen
|
|
500
|
+
*/
|
|
501
|
+
type SoftHyphenContent = {
|
|
502
|
+
type: "softHyphen";
|
|
503
|
+
};
|
|
504
|
+
/**
|
|
505
|
+
* Non-breaking hyphen
|
|
506
|
+
*/
|
|
507
|
+
type NoBreakHyphenContent = {
|
|
508
|
+
type: "noBreakHyphen";
|
|
509
|
+
};
|
|
510
|
+
/**
|
|
511
|
+
* Drawing/image reference
|
|
512
|
+
*/
|
|
513
|
+
type DrawingContent = {
|
|
514
|
+
type: "drawing"; /** Image data */
|
|
515
|
+
image: Image; /** Original OOXML for package-preserving round-trips of unsupported drawing markup. */
|
|
516
|
+
rawXml?: string;
|
|
517
|
+
};
|
|
518
|
+
/**
|
|
519
|
+
* Shape reference
|
|
520
|
+
*/
|
|
521
|
+
type ShapeContent = {
|
|
522
|
+
type: "shape"; /** Shape data */
|
|
523
|
+
shape: Shape;
|
|
524
|
+
};
|
|
525
|
+
/**
|
|
526
|
+
* All possible run content types
|
|
527
|
+
*/
|
|
528
|
+
type RunContent = TextContent | TabContent | BreakContent | SymbolContent | NoteReferenceContent | FieldCharContent | InstrTextContent | SoftHyphenContent | NoBreakHyphenContent | DrawingContent | ShapeContent;
|
|
529
|
+
/**
|
|
530
|
+
* A run is a contiguous region of text with the same formatting
|
|
531
|
+
*/
|
|
532
|
+
type Run = {
|
|
533
|
+
type: "run"; /** Text formatting properties */
|
|
534
|
+
formatting?: TextFormatting; /** Run-level tracked property changes (w:rPrChange) */
|
|
535
|
+
propertyChanges?: RunPropertyChange[]; /** Run content (text, tabs, breaks, etc.) */
|
|
536
|
+
content: RunContent[];
|
|
537
|
+
};
|
|
538
|
+
/**
|
|
539
|
+
* Hyperlink (w:hyperlink)
|
|
540
|
+
*/
|
|
541
|
+
type Hyperlink = {
|
|
542
|
+
type: "hyperlink"; /** Relationship ID for external link */
|
|
543
|
+
rId?: string; /** Resolved URL (from relationships) */
|
|
544
|
+
href?: string; /** Internal bookmark anchor */
|
|
545
|
+
anchor?: string; /** Tooltip text */
|
|
546
|
+
tooltip?: string; /** Target frame */
|
|
547
|
+
target?: string; /** Link history tracking */
|
|
548
|
+
history?: boolean; /** Document location */
|
|
549
|
+
docLocation?: string; /** Child runs */
|
|
550
|
+
children: (Run | BookmarkStart | BookmarkEnd)[];
|
|
551
|
+
};
|
|
552
|
+
/**
|
|
553
|
+
* Bookmark start marker (w:bookmarkStart)
|
|
554
|
+
*/
|
|
555
|
+
type BookmarkStart = {
|
|
556
|
+
type: "bookmarkStart"; /** Bookmark ID */
|
|
557
|
+
id: number; /** Bookmark name */
|
|
558
|
+
name: string; /** Column index for table bookmarks */
|
|
559
|
+
colFirst?: number;
|
|
560
|
+
colLast?: number;
|
|
561
|
+
};
|
|
562
|
+
/**
|
|
563
|
+
* Bookmark end marker (w:bookmarkEnd)
|
|
564
|
+
*/
|
|
565
|
+
type BookmarkEnd = {
|
|
566
|
+
type: "bookmarkEnd"; /** Bookmark ID */
|
|
567
|
+
id: number;
|
|
568
|
+
};
|
|
569
|
+
/**
|
|
570
|
+
* Known field types
|
|
571
|
+
*/
|
|
572
|
+
type FieldType = "PAGE" | "NUMPAGES" | "NUMWORDS" | "NUMCHARS" | "DATE" | "TIME" | "CREATEDATE" | "SAVEDATE" | "PRINTDATE" | "AUTHOR" | "TITLE" | "SUBJECT" | "KEYWORDS" | "COMMENTS" | "FILENAME" | "FILESIZE" | "TEMPLATE" | "DOCPROPERTY" | "DOCVARIABLE" | "REF" | "PAGEREF" | "NOTEREF" | "HYPERLINK" | "TOC" | "TOA" | "INDEX" | "SEQ" | "STYLEREF" | "AUTONUM" | "AUTONUMLGL" | "AUTONUMOUT" | "LISTNUM" | "IF" | "MERGEFIELD" | "NEXT" | "NEXTIF" | "ASK" | "SET" | "QUOTE" | "INCLUDETEXT" | "INCLUDEPICTURE" | "SYMBOL" | "ADVANCE" | "EDITTIME" | "REVNUM" | "SECTION" | "SECTIONPAGES" | "USERADDRESS" | "USERNAME" | "USERINITIALS" | "UNKNOWN";
|
|
573
|
+
/**
|
|
574
|
+
* Simple field (w:fldSimple)
|
|
575
|
+
*/
|
|
576
|
+
type SimpleField = {
|
|
577
|
+
type: "simpleField"; /** Field instruction (e.g., "PAGE \\* MERGEFORMAT") */
|
|
578
|
+
instruction: string; /** Parsed field type */
|
|
579
|
+
fieldType: FieldType; /** Current display value */
|
|
580
|
+
content: (Run | Hyperlink)[]; /** Field is locked */
|
|
581
|
+
fldLock?: boolean; /** Field is dirty */
|
|
582
|
+
dirty?: boolean;
|
|
583
|
+
};
|
|
584
|
+
/**
|
|
585
|
+
* Complex field (w:fldChar begin/separate/end with w:instrText)
|
|
586
|
+
*/
|
|
587
|
+
type ComplexField = {
|
|
588
|
+
type: "complexField"; /** Field instruction */
|
|
589
|
+
instruction: string; /** Parsed field type */
|
|
590
|
+
fieldType: FieldType; /** Field code runs */
|
|
591
|
+
fieldCode: Run[]; /** Display result runs */
|
|
592
|
+
fieldResult: Run[];
|
|
593
|
+
/**
|
|
594
|
+
* Run formatting captured from the field's structural run(s) (`w:rPr` on the
|
|
595
|
+
* `begin`/code run). Used as the run-formatting fallback when the field has
|
|
596
|
+
* no separate result run to read it from, e.g. a footer `PAGE` number whose
|
|
597
|
+
* formatting lives on the field run (eigenpal/docx-editor#909).
|
|
598
|
+
*/
|
|
599
|
+
formatting?: TextFormatting; /** Field is locked */
|
|
600
|
+
fldLock?: boolean; /** Field is dirty */
|
|
601
|
+
dirty?: boolean;
|
|
602
|
+
};
|
|
603
|
+
type Field = SimpleField | ComplexField;
|
|
604
|
+
/**
|
|
605
|
+
* Image size specification
|
|
606
|
+
*/
|
|
607
|
+
type ImageSize = {
|
|
608
|
+
/** Width in EMUs (English Metric Units) */width: number; /** Height in EMUs */
|
|
609
|
+
height: number;
|
|
610
|
+
};
|
|
611
|
+
/**
|
|
612
|
+
* Image wrap type for floating images
|
|
613
|
+
*/
|
|
614
|
+
type ImageWrap = {
|
|
615
|
+
type: "inline" | "square" | "tight" | "through" | "topAndBottom" | "behind" | "inFront"; /** Wrap text direction */
|
|
616
|
+
wrapText?: "bothSides" | "left" | "right" | "largest"; /** Distance from text */
|
|
617
|
+
distT?: number;
|
|
618
|
+
distB?: number;
|
|
619
|
+
distL?: number;
|
|
620
|
+
distR?: number;
|
|
621
|
+
};
|
|
622
|
+
/**
|
|
623
|
+
* Position for floating images
|
|
624
|
+
*/
|
|
625
|
+
type ImagePosition = {
|
|
626
|
+
/** Horizontal positioning */horizontal: {
|
|
627
|
+
relativeTo: "character" | "column" | "insideMargin" | "leftMargin" | "margin" | "outsideMargin" | "page" | "rightMargin";
|
|
628
|
+
alignment?: "left" | "right" | "center" | "inside" | "outside";
|
|
629
|
+
posOffset?: number;
|
|
630
|
+
}; /** Vertical positioning */
|
|
631
|
+
vertical: {
|
|
632
|
+
relativeTo: "insideMargin" | "line" | "margin" | "outsideMargin" | "page" | "paragraph" | "topMargin" | "bottomMargin";
|
|
633
|
+
alignment?: "top" | "bottom" | "center" | "inside" | "outside";
|
|
634
|
+
posOffset?: number;
|
|
635
|
+
};
|
|
636
|
+
};
|
|
637
|
+
/**
|
|
638
|
+
* Image transformation
|
|
639
|
+
*/
|
|
640
|
+
type ImageTransform = {
|
|
641
|
+
/** Rotation in degrees */rotation?: number; /** Flip horizontal */
|
|
642
|
+
flipH?: boolean; /** Flip vertical */
|
|
643
|
+
flipV?: boolean;
|
|
644
|
+
};
|
|
645
|
+
/**
|
|
646
|
+
* Image padding/margins
|
|
647
|
+
*/
|
|
648
|
+
type ImagePadding = {
|
|
649
|
+
top?: number;
|
|
650
|
+
bottom?: number;
|
|
651
|
+
left?: number;
|
|
652
|
+
right?: number;
|
|
653
|
+
};
|
|
654
|
+
/**
|
|
655
|
+
* Image crop fractions in [0, 1] applied to each side of the source bitmap.
|
|
656
|
+
* Mirrors the four `<a:srcRect>` attributes (`l`, `t`, `r`, `b`) defined in
|
|
657
|
+
* ECMA-376 §20.1.8.55, stored in 1/100000 units on the wire.
|
|
658
|
+
*
|
|
659
|
+
* eigenpal #424 (image-crop subset).
|
|
660
|
+
*/
|
|
661
|
+
type ImageCrop = {
|
|
662
|
+
left?: number;
|
|
663
|
+
top?: number;
|
|
664
|
+
right?: number;
|
|
665
|
+
bottom?: number;
|
|
666
|
+
};
|
|
667
|
+
/**
|
|
668
|
+
* Embedded image (w:drawing)
|
|
669
|
+
*/
|
|
670
|
+
type Image = {
|
|
671
|
+
type: "image"; /** Unique ID */
|
|
672
|
+
id?: string; /** Relationship ID for the image data */
|
|
673
|
+
rId: string; /** Resolved image data (base64 or blob URL) */
|
|
674
|
+
src?: string; /** Image MIME type */
|
|
675
|
+
mimeType?: string; /** Original filename */
|
|
676
|
+
filename?: string; /** Alt text for accessibility */
|
|
677
|
+
alt?: string; /** Title/description */
|
|
678
|
+
title?: string; /** Image size */
|
|
679
|
+
size: ImageSize; /** Original size before any transforms */
|
|
680
|
+
originalSize?: ImageSize; /** Wrap settings */
|
|
681
|
+
wrap: ImageWrap; /** Position for floating images */
|
|
682
|
+
position?: ImagePosition; /** Image transformations */
|
|
683
|
+
transform?: ImageTransform; /** Padding around image */
|
|
684
|
+
padding?: ImagePadding; /** Source-bitmap crop (wp:srcRect), eigenpal #424 */
|
|
685
|
+
crop?: ImageCrop;
|
|
686
|
+
/**
|
|
687
|
+
* Opacity in [0, 1] (OOXML `a:alphaModFix amt`). Undefined or `1` means
|
|
688
|
+
* fully opaque. Mirrors eigenpal docx-editor #424.
|
|
689
|
+
*/
|
|
690
|
+
opacity?: number;
|
|
691
|
+
/**
|
|
692
|
+
* `wp:anchor layoutInCell` — when true (OOXML default), an anchored image
|
|
693
|
+
* inside a table cell is constrained to the cell. When false, the image
|
|
694
|
+
* escapes the cell into the page area. Round-tripped on save so the
|
|
695
|
+
* author's intent survives; undefined means "use the spec default".
|
|
696
|
+
*/
|
|
697
|
+
layoutInCell?: boolean;
|
|
698
|
+
/**
|
|
699
|
+
* `wp:anchor allowOverlap` — when true (OOXML default), anchored objects
|
|
700
|
+
* may overlap; when false, Word repositions them to avoid collisions. We
|
|
701
|
+
* don't currently reposition, but we round-trip the flag so saving
|
|
702
|
+
* preserves the author's intent; undefined means "use the spec default".
|
|
703
|
+
*/
|
|
704
|
+
allowOverlap?: boolean; /** Whether this is a decorative image */
|
|
705
|
+
decorative?: boolean; /** Hyperlink URL for clickable image */
|
|
706
|
+
hlinkHref?: string; /** Image outline/border */
|
|
707
|
+
outline?: ShapeOutline; /** Image effects */
|
|
708
|
+
effects?: {
|
|
709
|
+
brightness?: number;
|
|
710
|
+
contrast?: number;
|
|
711
|
+
saturation?: number;
|
|
712
|
+
};
|
|
713
|
+
};
|
|
714
|
+
/**
|
|
715
|
+
* Shape types
|
|
716
|
+
*/
|
|
717
|
+
type ShapeType = "rect" | "roundRect" | "ellipse" | "triangle" | "rtTriangle" | "parallelogram" | "trapezoid" | "pentagon" | "hexagon" | "heptagon" | "octagon" | "decagon" | "dodecagon" | "star4" | "star5" | "star6" | "star7" | "star8" | "star10" | "star12" | "star16" | "star24" | "star32" | "line" | "straightConnector1" | "bentConnector2" | "bentConnector3" | "bentConnector4" | "bentConnector5" | "curvedConnector2" | "curvedConnector3" | "curvedConnector4" | "curvedConnector5" | "rightArrow" | "leftArrow" | "upArrow" | "downArrow" | "leftRightArrow" | "upDownArrow" | "quadArrow" | "leftRightUpArrow" | "bentArrow" | "uturnArrow" | "leftUpArrow" | "bentUpArrow" | "curvedRightArrow" | "curvedLeftArrow" | "curvedUpArrow" | "curvedDownArrow" | "stripedRightArrow" | "notchedRightArrow" | "homePlate" | "chevron" | "rightArrowCallout" | "downArrowCallout" | "leftArrowCallout" | "upArrowCallout" | "leftRightArrowCallout" | "quadArrowCallout" | "circularArrow" | "flowChartProcess" | "flowChartAlternateProcess" | "flowChartDecision" | "flowChartInputOutput" | "flowChartPredefinedProcess" | "flowChartInternalStorage" | "flowChartDocument" | "flowChartMultidocument" | "flowChartTerminator" | "flowChartPreparation" | "flowChartManualInput" | "flowChartManualOperation" | "flowChartConnector" | "flowChartOffpageConnector" | "flowChartPunchedCard" | "flowChartPunchedTape" | "flowChartSummingJunction" | "flowChartOr" | "flowChartCollate" | "flowChartSort" | "flowChartExtract" | "flowChartMerge" | "flowChartOnlineStorage" | "flowChartDelay" | "flowChartMagneticTape" | "flowChartMagneticDisk" | "flowChartMagneticDrum" | "flowChartDisplay" | "wedgeRectCallout" | "wedgeRoundRectCallout" | "wedgeEllipseCallout" | "cloudCallout" | "borderCallout1" | "borderCallout2" | "borderCallout3" | "accentCallout1" | "accentCallout2" | "accentCallout3" | "callout1" | "callout2" | "callout3" | "accentBorderCallout1" | "accentBorderCallout2" | "accentBorderCallout3" | "actionButtonBlank" | "actionButtonHome" | "actionButtonHelp" | "actionButtonInformation" | "actionButtonBackPrevious" | "actionButtonForwardNext" | "actionButtonBeginning" | "actionButtonEnd" | "actionButtonReturn" | "actionButtonDocument" | "actionButtonSound" | "actionButtonMovie" | "irregularSeal1" | "irregularSeal2" | "frame" | "halfFrame" | "corner" | "diagStripe" | "chord" | "arc" | "bracketPair" | "bracePair" | "leftBracket" | "rightBracket" | "leftBrace" | "rightBrace" | "can" | "cube" | "bevel" | "donut" | "noSmoking" | "blockArc" | "foldedCorner" | "smileyFace" | "heart" | "lightningBolt" | "sun" | "moon" | "cloud" | "snip1Rect" | "snip2SameRect" | "snip2DiagRect" | "snipRoundRect" | "round1Rect" | "round2SameRect" | "round2DiagRect" | "plaque" | "teardrop" | "mathPlus" | "mathMinus" | "mathMultiply" | "mathDivide" | "mathEqual" | "mathNotEqual" | "gear6" | "gear9" | "funnel" | "pieWedge" | "pie" | "leftCircularArrow" | "leftRightCircularArrow" | "swooshArrow" | "textBox";
|
|
718
|
+
/**
|
|
719
|
+
* Shape fill type
|
|
720
|
+
*/
|
|
721
|
+
type ShapeFill = {
|
|
722
|
+
type: "none" | "solid" | "gradient" | "pattern" | "picture"; /** Solid fill color */
|
|
723
|
+
color?: ColorValue; /** Gradient stops for gradient fill */
|
|
724
|
+
gradient?: {
|
|
725
|
+
type: "linear" | "radial" | "rectangular" | "path";
|
|
726
|
+
angle?: number;
|
|
727
|
+
stops: {
|
|
728
|
+
position: number;
|
|
729
|
+
color: ColorValue;
|
|
730
|
+
}[];
|
|
731
|
+
};
|
|
732
|
+
};
|
|
733
|
+
/**
|
|
734
|
+
* Shape outline/stroke
|
|
735
|
+
*/
|
|
736
|
+
type ShapeOutline = {
|
|
737
|
+
/** Line width in EMUs */width?: number; /** Line color */
|
|
738
|
+
color?: ColorValue; /** Line style */
|
|
739
|
+
style?: "solid" | "dot" | "dash" | "lgDash" | "dashDot" | "lgDashDot" | "lgDashDotDot" | "sysDot" | "sysDash" | "sysDashDot" | "sysDashDotDot"; /** Line cap */
|
|
740
|
+
cap?: "flat" | "round" | "square"; /** Line join */
|
|
741
|
+
join?: "bevel" | "miter" | "round"; /** Head arrow */
|
|
742
|
+
headEnd?: {
|
|
743
|
+
type: "none" | "triangle" | "stealth" | "diamond" | "oval" | "arrow";
|
|
744
|
+
width?: "sm" | "med" | "lg";
|
|
745
|
+
length?: "sm" | "med" | "lg";
|
|
746
|
+
}; /** Tail arrow */
|
|
747
|
+
tailEnd?: {
|
|
748
|
+
type: "none" | "triangle" | "stealth" | "diamond" | "oval" | "arrow";
|
|
749
|
+
width?: "sm" | "med" | "lg";
|
|
750
|
+
length?: "sm" | "med" | "lg";
|
|
751
|
+
};
|
|
752
|
+
};
|
|
753
|
+
/**
|
|
754
|
+
* Text body inside a shape
|
|
755
|
+
*/
|
|
756
|
+
type ShapeTextBody = {
|
|
757
|
+
/** Text direction */vertical?: boolean; /** Rotation */
|
|
758
|
+
rotation?: number; /** Anchor/vertical alignment */
|
|
759
|
+
anchor?: "top" | "middle" | "bottom" | "distributed" | "justified"; /** Anchor center */
|
|
760
|
+
anchorCenter?: boolean; /** Auto fit */
|
|
761
|
+
autoFit?: "none" | "normal" | "shape"; /** Text margins */
|
|
762
|
+
margins?: {
|
|
763
|
+
top?: number;
|
|
764
|
+
bottom?: number;
|
|
765
|
+
left?: number;
|
|
766
|
+
right?: number;
|
|
767
|
+
}; /** Paragraphs inside the shape */
|
|
768
|
+
content: Paragraph[];
|
|
769
|
+
};
|
|
770
|
+
/**
|
|
771
|
+
* Shape/drawing object (wps:wsp)
|
|
772
|
+
*/
|
|
773
|
+
type Shape = {
|
|
774
|
+
type: "shape"; /** Shape type preset */
|
|
775
|
+
shapeType: ShapeType; /** Unique ID */
|
|
776
|
+
id?: string; /** Name */
|
|
777
|
+
name?: string; /** Size in EMUs */
|
|
778
|
+
size: ImageSize; /** Position for floating shapes */
|
|
779
|
+
position?: ImagePosition; /** Wrap settings */
|
|
780
|
+
wrap?: ImageWrap; /** Fill */
|
|
781
|
+
fill?: ShapeFill; /** Outline/stroke */
|
|
782
|
+
outline?: ShapeOutline; /** Transform */
|
|
783
|
+
transform?: ImageTransform; /** Text content inside the shape */
|
|
784
|
+
textBody?: ShapeTextBody; /** Custom geometry points */
|
|
785
|
+
customGeometry?: string;
|
|
786
|
+
};
|
|
787
|
+
/**
|
|
788
|
+
* Text box (floating text container)
|
|
789
|
+
*/
|
|
790
|
+
type TextBox = {
|
|
791
|
+
type: "textBox"; /** Unique ID */
|
|
792
|
+
id?: string; /** Size */
|
|
793
|
+
size: ImageSize; /** Position */
|
|
794
|
+
position?: ImagePosition; /** Wrap settings */
|
|
795
|
+
wrap?: ImageWrap; /** Fill */
|
|
796
|
+
fill?: ShapeFill; /** Outline */
|
|
797
|
+
outline?: ShapeOutline; /** Text content */
|
|
798
|
+
content: Paragraph[]; /** Internal margins */
|
|
799
|
+
margins?: {
|
|
800
|
+
top?: number;
|
|
801
|
+
bottom?: number;
|
|
802
|
+
left?: number;
|
|
803
|
+
right?: number;
|
|
804
|
+
};
|
|
805
|
+
};
|
|
806
|
+
/**
|
|
807
|
+
* Table cell
|
|
808
|
+
*/
|
|
809
|
+
type TableCell = {
|
|
810
|
+
type: "tableCell"; /** Cell formatting */
|
|
811
|
+
formatting?: TableCellFormatting; /** Cell-level tracked property changes (w:tcPrChange) */
|
|
812
|
+
propertyChanges?: TableCellPropertyChange[]; /** Tracked structural changes (cell insert/delete/merge) */
|
|
813
|
+
structuralChange?: TableStructuralChangeInfo; /** Cell content (paragraphs, tables, etc.) */
|
|
814
|
+
content: (Paragraph | Table)[];
|
|
815
|
+
};
|
|
816
|
+
/**
|
|
817
|
+
* Table row
|
|
818
|
+
*/
|
|
819
|
+
type TableRow = {
|
|
820
|
+
type: "tableRow"; /** Row formatting */
|
|
821
|
+
formatting?: TableRowFormatting; /** Row-level tracked property changes (w:trPrChange) */
|
|
822
|
+
propertyChanges?: TableRowPropertyChange[]; /** Tracked structural changes (row insert/delete) */
|
|
823
|
+
structuralChange?: TableStructuralChangeInfo; /** Cells in this row */
|
|
824
|
+
cells: TableCell[];
|
|
825
|
+
};
|
|
826
|
+
/**
|
|
827
|
+
* Table (w:tbl)
|
|
828
|
+
*/
|
|
829
|
+
type Table = {
|
|
830
|
+
type: "table"; /** Table formatting */
|
|
831
|
+
formatting?: TableFormatting; /** Table-level tracked property changes (w:tblPrChange) */
|
|
832
|
+
propertyChanges?: TablePropertyChange[]; /** Column widths in twips */
|
|
833
|
+
columnWidths?: number[]; /** Table rows */
|
|
834
|
+
rows: TableRow[];
|
|
835
|
+
};
|
|
836
|
+
/**
|
|
837
|
+
* A comment (w:comment) from comments.xml
|
|
838
|
+
*/
|
|
839
|
+
type Comment = {
|
|
840
|
+
/** Comment ID (matches commentRangeStart/End) */id: number; /** Author name */
|
|
841
|
+
author: string; /** Author initials */
|
|
842
|
+
initials?: string; /** Date */
|
|
843
|
+
date?: string; /** Comment content (paragraphs) */
|
|
844
|
+
content: Paragraph[]; /** Parent comment ID (for replies) */
|
|
845
|
+
parentId?: number; /** Whether the comment is resolved/done */
|
|
846
|
+
done?: boolean;
|
|
847
|
+
};
|
|
848
|
+
/**
|
|
849
|
+
* Comment range start marker in paragraph content
|
|
850
|
+
*/
|
|
851
|
+
type CommentRangeStart = {
|
|
852
|
+
type: "commentRangeStart";
|
|
853
|
+
id: number;
|
|
854
|
+
};
|
|
855
|
+
/**
|
|
856
|
+
* Comment range end marker in paragraph content
|
|
857
|
+
*/
|
|
858
|
+
type CommentRangeEnd = {
|
|
859
|
+
type: "commentRangeEnd";
|
|
860
|
+
id: number;
|
|
861
|
+
};
|
|
862
|
+
/**
|
|
863
|
+
* Point comment reference (w:commentReference without an explicit range).
|
|
864
|
+
* Word sometimes stores comments this way; we anchor them to nearby text for display.
|
|
865
|
+
*/
|
|
866
|
+
type CommentReference = {
|
|
867
|
+
type: "commentReference";
|
|
868
|
+
id: number;
|
|
869
|
+
};
|
|
870
|
+
/**
|
|
871
|
+
* Math equation content (m:oMath or m:oMathPara)
|
|
872
|
+
*/
|
|
873
|
+
type MathEquation = {
|
|
874
|
+
type: "mathEquation"; /** Whether this is a block (oMathPara) or inline (oMath) equation */
|
|
875
|
+
display: "inline" | "block"; /** Raw OMML XML for round-trip preservation */
|
|
876
|
+
ommlXml: string; /** Plain text representation for accessibility/fallback */
|
|
877
|
+
plainText?: string;
|
|
878
|
+
};
|
|
879
|
+
/**
|
|
880
|
+
* Tracked change metadata (w:ins, w:del attributes)
|
|
881
|
+
*/
|
|
882
|
+
type TrackedChangeInfo = {
|
|
883
|
+
/** Revision ID */id: number; /** Author who made the change */
|
|
884
|
+
author: string; /** Date of the change */
|
|
885
|
+
date?: string;
|
|
886
|
+
};
|
|
887
|
+
/**
|
|
888
|
+
* Generic tracked property-change wrapper metadata (w:*PrChange)
|
|
889
|
+
*/
|
|
890
|
+
type PropertyChangeInfo = {
|
|
891
|
+
/** Optional revision session ID */rsid?: string;
|
|
892
|
+
} & TrackedChangeInfo;
|
|
893
|
+
/**
|
|
894
|
+
* Insertion wrapper (w:ins) — runs inserted by tracked changes
|
|
895
|
+
*/
|
|
896
|
+
type Insertion = {
|
|
897
|
+
type: "insertion"; /** Tracked change metadata */
|
|
898
|
+
info: TrackedChangeInfo; /** Inserted content */
|
|
899
|
+
content: (Run | Hyperlink)[];
|
|
900
|
+
};
|
|
901
|
+
/**
|
|
902
|
+
* Deletion wrapper (w:del) — runs deleted by tracked changes
|
|
903
|
+
*/
|
|
904
|
+
type Deletion = {
|
|
905
|
+
type: "deletion"; /** Tracked change metadata */
|
|
906
|
+
info: TrackedChangeInfo; /** Deleted content */
|
|
907
|
+
content: (Run | Hyperlink)[];
|
|
908
|
+
};
|
|
909
|
+
/**
|
|
910
|
+
* Move-from wrapper (w:moveFrom) — content moved away from this position
|
|
911
|
+
*/
|
|
912
|
+
type MoveFrom = {
|
|
913
|
+
type: "moveFrom"; /** Tracked change metadata */
|
|
914
|
+
info: TrackedChangeInfo; /** Moved content */
|
|
915
|
+
content: (Run | Hyperlink)[];
|
|
916
|
+
};
|
|
917
|
+
/**
|
|
918
|
+
* Move-to wrapper (w:moveTo) — content moved into this position
|
|
919
|
+
*/
|
|
920
|
+
type MoveTo = {
|
|
921
|
+
type: "moveTo"; /** Tracked change metadata */
|
|
922
|
+
info: TrackedChangeInfo; /** Moved content */
|
|
923
|
+
content: (Run | Hyperlink)[];
|
|
924
|
+
};
|
|
925
|
+
/**
|
|
926
|
+
* Move-from range start marker (w:moveFromRangeStart) — ECMA-376 §17.13.5.22
|
|
927
|
+
* Pairs with moveFromRangeEnd to delimit the source of a move in the document.
|
|
928
|
+
*/
|
|
929
|
+
type MoveFromRangeStart = {
|
|
930
|
+
type: "moveFromRangeStart";
|
|
931
|
+
id: number;
|
|
932
|
+
name: string;
|
|
933
|
+
};
|
|
934
|
+
/**
|
|
935
|
+
* Move-from range end marker (w:moveFromRangeEnd)
|
|
936
|
+
*/
|
|
937
|
+
type MoveFromRangeEnd = {
|
|
938
|
+
type: "moveFromRangeEnd";
|
|
939
|
+
id: number;
|
|
940
|
+
};
|
|
941
|
+
/**
|
|
942
|
+
* Move-to range start marker (w:moveToRangeStart) — ECMA-376 §17.13.5.24
|
|
943
|
+
* Pairs with moveToRangeEnd to delimit the destination of a move.
|
|
944
|
+
*/
|
|
945
|
+
type MoveToRangeStart = {
|
|
946
|
+
type: "moveToRangeStart";
|
|
947
|
+
id: number;
|
|
948
|
+
name: string;
|
|
949
|
+
};
|
|
950
|
+
/**
|
|
951
|
+
* Move-to range end marker (w:moveToRangeEnd)
|
|
952
|
+
*/
|
|
953
|
+
type MoveToRangeEnd = {
|
|
954
|
+
type: "moveToRangeEnd";
|
|
955
|
+
id: number;
|
|
956
|
+
};
|
|
957
|
+
/**
|
|
958
|
+
* Run-level tracked wrappers represented in WordprocessingML.
|
|
959
|
+
*/
|
|
960
|
+
type TrackedRunChange = Insertion | Deletion | MoveFrom | MoveTo;
|
|
961
|
+
/**
|
|
962
|
+
* Run property change (w:rPrChange)
|
|
963
|
+
*/
|
|
964
|
+
type RunPropertyChange = {
|
|
965
|
+
type: "runPropertyChange"; /** Tracked change metadata */
|
|
966
|
+
info: PropertyChangeInfo; /** Run properties before the tracked change */
|
|
967
|
+
previousFormatting?: TextFormatting; /** Run properties after the tracked change (editor model convenience) */
|
|
968
|
+
currentFormatting?: TextFormatting;
|
|
969
|
+
};
|
|
970
|
+
/**
|
|
971
|
+
* Paragraph property change (w:pPrChange)
|
|
972
|
+
*/
|
|
973
|
+
type ParagraphPropertyChange = {
|
|
974
|
+
type: "paragraphPropertyChange"; /** Tracked change metadata */
|
|
975
|
+
info: PropertyChangeInfo; /** Paragraph properties before the tracked change */
|
|
976
|
+
previousFormatting?: ParagraphFormatting; /** Paragraph properties after the tracked change (editor model convenience) */
|
|
977
|
+
currentFormatting?: ParagraphFormatting;
|
|
978
|
+
};
|
|
979
|
+
/**
|
|
980
|
+
* Table property change (w:tblPrChange)
|
|
981
|
+
*/
|
|
982
|
+
type TablePropertyChange = {
|
|
983
|
+
type: "tablePropertyChange"; /** Tracked change metadata */
|
|
984
|
+
info: PropertyChangeInfo; /** Table properties before the tracked change */
|
|
985
|
+
previousFormatting?: TableFormatting; /** Table properties after the tracked change (editor model convenience) */
|
|
986
|
+
currentFormatting?: TableFormatting;
|
|
987
|
+
};
|
|
988
|
+
/**
|
|
989
|
+
* Table row property change (w:trPrChange)
|
|
990
|
+
*/
|
|
991
|
+
type TableRowPropertyChange = {
|
|
992
|
+
type: "tableRowPropertyChange"; /** Tracked change metadata */
|
|
993
|
+
info: PropertyChangeInfo; /** Row properties before the tracked change */
|
|
994
|
+
previousFormatting?: TableRowFormatting; /** Row properties after the tracked change (editor model convenience) */
|
|
995
|
+
currentFormatting?: TableRowFormatting;
|
|
996
|
+
};
|
|
997
|
+
/**
|
|
998
|
+
* Table cell property change (w:tcPrChange)
|
|
999
|
+
*/
|
|
1000
|
+
type TableCellPropertyChange = {
|
|
1001
|
+
type: "tableCellPropertyChange"; /** Tracked change metadata */
|
|
1002
|
+
info: PropertyChangeInfo; /** Cell properties before the tracked change */
|
|
1003
|
+
previousFormatting?: TableCellFormatting; /** Cell properties after the tracked change (editor model convenience) */
|
|
1004
|
+
currentFormatting?: TableCellFormatting;
|
|
1005
|
+
};
|
|
1006
|
+
/**
|
|
1007
|
+
* Section property change (w:sectPrChange)
|
|
1008
|
+
*/
|
|
1009
|
+
type SectionPropertyChange = {
|
|
1010
|
+
type: "sectionPropertyChange"; /** Tracked change metadata */
|
|
1011
|
+
info: PropertyChangeInfo; /** Section properties before the tracked change */
|
|
1012
|
+
previousProperties?: SectionProperties; /** Section properties after the tracked change (editor model convenience) */
|
|
1013
|
+
currentProperties?: SectionProperties;
|
|
1014
|
+
};
|
|
1015
|
+
/**
|
|
1016
|
+
* Table structural tracked change metadata (row/cell insert/delete/merge)
|
|
1017
|
+
*/
|
|
1018
|
+
type TableStructuralChangeInfo = {
|
|
1019
|
+
type: "tableRowInsertion" | "tableRowDeletion" | "tableCellInsertion" | "tableCellDeletion" | "tableCellMerge"; /** Tracked change metadata */
|
|
1020
|
+
info: TrackedChangeInfo;
|
|
1021
|
+
};
|
|
1022
|
+
/**
|
|
1023
|
+
* SDT type (content control type)
|
|
1024
|
+
*/
|
|
1025
|
+
type SdtType = "richText" | "plainText" | "date" | "dropdown" | "comboBox" | "checkbox" | "picture" | "buildingBlockGallery" | "group" | "unknown";
|
|
1026
|
+
/**
|
|
1027
|
+
* SDT properties (`w:sdtPr`).
|
|
1028
|
+
*
|
|
1029
|
+
* Modeled fields are a read-only projection for downstream tooling
|
|
1030
|
+
* (tag/alias addressing, template extraction). They are NOT the
|
|
1031
|
+
* serialization source: the original `<w:sdtPr>` is captured verbatim in
|
|
1032
|
+
* `rawPropertiesXml` and replayed on save, which preserves element order
|
|
1033
|
+
* (`CT_SdtPr` is an `xsd:sequence`), avoids double-emission, and keeps
|
|
1034
|
+
* unmodeled features (`w:dataBinding`, `w15:repeatingSection`, `@lastValue`,
|
|
1035
|
+
* `w:sdtEndPr`) lossless.
|
|
1036
|
+
*/
|
|
1037
|
+
type SdtProperties = {
|
|
1038
|
+
/** SDT type (projection; round-trip uses `rawPropertiesXml`). */sdtType: SdtType; /** Numeric id (`w:id/@w:val`). */
|
|
1039
|
+
id?: number; /** Alias (friendly name, `w:alias`). */
|
|
1040
|
+
alias?: string; /** Tag (developer identifier, `w:tag`). */
|
|
1041
|
+
tag?: string; /** Lock setting (`w:lock`). */
|
|
1042
|
+
lock?: "sdtLocked" | "contentLocked" | "sdtContentLocked" | "unlocked";
|
|
1043
|
+
/**
|
|
1044
|
+
* Placeholder building-block name (`w:placeholder/w:docPart@w:val`) — a
|
|
1045
|
+
* reference to a glossary docPart, not the literal placeholder text.
|
|
1046
|
+
*/
|
|
1047
|
+
placeholder?: string; /** Whether the placeholder is currently shown (`w:showingPlcHdr`). */
|
|
1048
|
+
showingPlaceholder?: boolean; /** Date display format (`w:date/w:dateFormat@w:val`). */
|
|
1049
|
+
dateFormat?: string;
|
|
1050
|
+
/**
|
|
1051
|
+
* Bound date value (`w:date/@w:fullDate`), ISO 8601. Independent of
|
|
1052
|
+
* `dateFormat` (which controls display): the body text may show a
|
|
1053
|
+
* formatted version like "2 June 2026" while this stays as
|
|
1054
|
+
* `2026-06-02T00:00:00Z` so Word's date binding round-trips losslessly.
|
|
1055
|
+
*/
|
|
1056
|
+
dateValueISO?: string; /** Dropdown/combobox list items. */
|
|
1057
|
+
listItems?: {
|
|
1058
|
+
displayText: string;
|
|
1059
|
+
value: string;
|
|
1060
|
+
}[];
|
|
1061
|
+
/**
|
|
1062
|
+
* Selected dropdown / comboBox value (`w:dropDownList@w:lastValue`).
|
|
1063
|
+
* Persisted as the OOXML value, independent of the body display text.
|
|
1064
|
+
* Without this, the serializer had to recover the saved value by
|
|
1065
|
+
* matching the body's display text against `listItems`, which picked
|
|
1066
|
+
* the wrong entry when two items shared a `displayText`.
|
|
1067
|
+
*/
|
|
1068
|
+
dropdownLastValue?: string; /** Checkbox checked state (`w14:checkbox/w14:checked`). */
|
|
1069
|
+
checked?: boolean;
|
|
1070
|
+
/**
|
|
1071
|
+
* Verbatim `<w:sdtPr>…</w:sdtPr>` captured at parse time. Replayed on
|
|
1072
|
+
* serialize so unmodeled OOXML features (data binding, repeating sections,
|
|
1073
|
+
* `@lastValue`, custom XML mappings) survive round-trip.
|
|
1074
|
+
*/
|
|
1075
|
+
rawPropertiesXml?: string; /** Verbatim `<w:sdtEndPr>…</w:sdtEndPr>` captured at parse time. */
|
|
1076
|
+
rawEndPropertiesXml?: string;
|
|
1077
|
+
/**
|
|
1078
|
+
* Verbatim XML for any non-content direct children of `<w:sdt>` that
|
|
1079
|
+
* appear BEFORE `<w:sdtContent>` — MS-OE376 §2.5.2.30 documents 16
|
|
1080
|
+
* range-marker elements Word emits as direct sdt siblings (bookmark,
|
|
1081
|
+
* comment range, custom XML range, tracked-change range). Captured at
|
|
1082
|
+
* parse time and replayed on serialize so comment threads or tracked
|
|
1083
|
+
* changes that span an SDT boundary round-trip without losing a
|
|
1084
|
+
* delimiter.
|
|
1085
|
+
*/
|
|
1086
|
+
rawSdtChildrenBeforeContent?: string; /** Verbatim XML for non-content sdt children that appear AFTER `<w:sdtContent>`. */
|
|
1087
|
+
rawSdtChildrenAfterContent?: string;
|
|
1088
|
+
};
|
|
1089
|
+
/**
|
|
1090
|
+
* Inline SDT (content control within a paragraph).
|
|
1091
|
+
*
|
|
1092
|
+
* OOXML allows runs, hyperlinks, simple/complex fields, nested SDTs,
|
|
1093
|
+
* and math at this level. All of them must survive parse → edit → save
|
|
1094
|
+
* so docProps-bound fields and similar template content do not lose
|
|
1095
|
+
* their wrapper on round-trip.
|
|
1096
|
+
*/
|
|
1097
|
+
type InlineSdt = {
|
|
1098
|
+
type: "inlineSdt"; /** SDT properties */
|
|
1099
|
+
properties: SdtProperties; /** Inline content held inside the control */
|
|
1100
|
+
content: (Run | Hyperlink | SimpleField | ComplexField | InlineSdt | MathEquation)[];
|
|
1101
|
+
};
|
|
1102
|
+
/**
|
|
1103
|
+
* Block-level SDT (content control wrapping paragraphs/tables).
|
|
1104
|
+
*
|
|
1105
|
+
* Content is `BlockContent[]` (not just `(Paragraph | Table)[]`) because
|
|
1106
|
+
* OOXML allows block SDTs to nest — e.g. a repeating-section control
|
|
1107
|
+
* whose row is itself a content control.
|
|
1108
|
+
*/
|
|
1109
|
+
type BlockSdt = {
|
|
1110
|
+
type: "blockSdt"; /** SDT properties (raw XML in `properties.rawPropertiesXml` round-trips losslessly). */
|
|
1111
|
+
properties: SdtProperties; /** Block content inside the control. */
|
|
1112
|
+
content: BlockContent[];
|
|
1113
|
+
};
|
|
1114
|
+
/**
|
|
1115
|
+
* Paragraph content types
|
|
1116
|
+
*/
|
|
1117
|
+
type ParagraphContent = Run | Hyperlink | BookmarkStart | BookmarkEnd | SimpleField | ComplexField | InlineSdt | CommentRangeStart | CommentRangeEnd | CommentReference | Insertion | Deletion | MoveFrom | MoveTo | MoveFromRangeStart | MoveFromRangeEnd | MoveToRangeStart | MoveToRangeEnd | MathEquation;
|
|
1118
|
+
/**
|
|
1119
|
+
* Paragraph (w:p)
|
|
1120
|
+
*/
|
|
1121
|
+
/**
|
|
1122
|
+
* Paragraph-mark tracked-change marker (ECMA-376 §17.13.5).
|
|
1123
|
+
*
|
|
1124
|
+
* Word writes this as a child of `<w:pPr><w:rPr>` — `<w:ins/>` when the
|
|
1125
|
+
* paragraph break itself was inserted in track-changes mode (the user
|
|
1126
|
+
* pressed Enter mid-paragraph), `<w:del/>` when the paragraph break is
|
|
1127
|
+
* pending deletion (Backspace at paragraph start or Delete at paragraph
|
|
1128
|
+
* end). The mark is independent of the inline runs the paragraph carries.
|
|
1129
|
+
*/
|
|
1130
|
+
type ParagraphMarkChange = {
|
|
1131
|
+
kind: "ins" | "del";
|
|
1132
|
+
info: TrackedChangeInfo;
|
|
1133
|
+
};
|
|
1134
|
+
type Paragraph = {
|
|
1135
|
+
type: "paragraph"; /** Unique paragraph ID */
|
|
1136
|
+
paraId?: string; /** Text ID */
|
|
1137
|
+
textId?: string; /** Paragraph formatting */
|
|
1138
|
+
formatting?: ParagraphFormatting; /** Paragraph-level tracked property changes (w:pPrChange) */
|
|
1139
|
+
propertyChanges?: ParagraphPropertyChange[]; /** Paragraph-mark insertion / deletion (w:pPr / w:rPr / w:ins | w:del) */
|
|
1140
|
+
pPrMark?: ParagraphMarkChange; /** Paragraph content */
|
|
1141
|
+
content: ParagraphContent[]; /** Computed list rendering (if this is a list item) */
|
|
1142
|
+
listRendering?: ListRendering; /** Word's cached layout says this paragraph started on a new rendered page. */
|
|
1143
|
+
renderedPageBreakBefore?: boolean; /** Section properties (if this paragraph ends a section) */
|
|
1144
|
+
sectionProperties?: SectionProperties;
|
|
1145
|
+
};
|
|
1146
|
+
/**
|
|
1147
|
+
* Header/footer type
|
|
1148
|
+
*/
|
|
1149
|
+
type HeaderFooterType = "default" | "first" | "even";
|
|
1150
|
+
/**
|
|
1151
|
+
* Header or footer reference
|
|
1152
|
+
*/
|
|
1153
|
+
type HeaderReference = {
|
|
1154
|
+
type: HeaderFooterType;
|
|
1155
|
+
rId: string;
|
|
1156
|
+
};
|
|
1157
|
+
type FooterReference = {
|
|
1158
|
+
type: HeaderFooterType;
|
|
1159
|
+
rId: string;
|
|
1160
|
+
};
|
|
1161
|
+
/**
|
|
1162
|
+
* Header or footer content
|
|
1163
|
+
*/
|
|
1164
|
+
type HeaderFooter = {
|
|
1165
|
+
type: "header" | "footer"; /** Header/footer type */
|
|
1166
|
+
hdrFtrType: HeaderFooterType; /** Content (paragraphs, tables, block-level content controls). */
|
|
1167
|
+
content: BlockContent[];
|
|
1168
|
+
/**
|
|
1169
|
+
* Document watermark detected in this header part. Word emits
|
|
1170
|
+
* watermarks as VML or DrawingML behind-content shapes inside header
|
|
1171
|
+
* parts; the body paragraph that contains them is empty otherwise.
|
|
1172
|
+
* The modeled `Watermark` is exposed alongside `content` so callers
|
|
1173
|
+
* can render and edit it without walking raw runs.
|
|
1174
|
+
*/
|
|
1175
|
+
watermark?: Watermark;
|
|
1176
|
+
/**
|
|
1177
|
+
* Verbatim XML of the paragraph(s) containing the source watermark
|
|
1178
|
+
* shape. Captured at parse time so an untouched DOCX serializes the
|
|
1179
|
+
* watermark byte-exact even though `runParser` does not surface VML /
|
|
1180
|
+
* DrawingML at the run level. Cleared (or rewritten) when callers
|
|
1181
|
+
* mutate the modeled watermark via the headless API.
|
|
1182
|
+
*/
|
|
1183
|
+
rawWatermarkXml?: string;
|
|
1184
|
+
/**
|
|
1185
|
+
* Index where the watermark paragraph sat among block-level siblings
|
|
1186
|
+
* in the source header. The serializer inserts the watermark (raw or
|
|
1187
|
+
* synthesized) at this position so a header that originally placed
|
|
1188
|
+
* the watermark after visible text round-trips with the same flow.
|
|
1189
|
+
* Undefined when no watermark was parsed or when callers built the
|
|
1190
|
+
* watermark programmatically — in that case the serializer emits it
|
|
1191
|
+
* at the top of the header (the same position Word's own UI uses).
|
|
1192
|
+
*/
|
|
1193
|
+
watermarkBlockIndex?: number;
|
|
1194
|
+
};
|
|
1195
|
+
/**
|
|
1196
|
+
* Document watermark (MS Word's behind-content page decoration).
|
|
1197
|
+
*/
|
|
1198
|
+
type Watermark = TextWatermark | PictureWatermark;
|
|
1199
|
+
type TextWatermark = {
|
|
1200
|
+
kind: "text"; /** Visible string. Required. */
|
|
1201
|
+
text: string; /** Font family. Word's default is Calibri. */
|
|
1202
|
+
font?: string;
|
|
1203
|
+
/**
|
|
1204
|
+
* Hex color (`"C0C0C0"`), `"auto"`, or `undefined` for the producer
|
|
1205
|
+
* default. Word emits `#C0C0C0` (light gray) for text watermarks.
|
|
1206
|
+
*/
|
|
1207
|
+
color?: string;
|
|
1208
|
+
/**
|
|
1209
|
+
* `true` = diagonal (Word default, -45°), `false` = horizontal.
|
|
1210
|
+
* Stored as a boolean since the only Word-supported rotations are
|
|
1211
|
+
* -45 and 0.
|
|
1212
|
+
*/
|
|
1213
|
+
diagonal?: boolean;
|
|
1214
|
+
/**
|
|
1215
|
+
* Opacity 0..1. Word's interactive UI exposes a "transparency"
|
|
1216
|
+
* percentage; folio stores it as an opacity scalar for renderer
|
|
1217
|
+
* convenience. Default ~0.5.
|
|
1218
|
+
*/
|
|
1219
|
+
opacity?: number;
|
|
1220
|
+
};
|
|
1221
|
+
type PictureWatermark = {
|
|
1222
|
+
kind: "picture"; /** Relationship id of the image part in `word/_rels/header*.xml.rels`. */
|
|
1223
|
+
imageRId: string;
|
|
1224
|
+
/**
|
|
1225
|
+
* Stable identity of the image the `imageRId` resolved to in the header it
|
|
1226
|
+
* was parsed from — an absolute package path for embedded media (e.g.
|
|
1227
|
+
* `word/media/image1.png`) or the URL for a linked image (see
|
|
1228
|
+
* {@link imageTargetExternal}). Relationship ids are scoped per header part
|
|
1229
|
+
* and commonly repeat, so propagating a watermark across headers rebinds
|
|
1230
|
+
* against this anchored target rather than the (ambiguous) source rId; each
|
|
1231
|
+
* target header's relationship is written relative to its own part location.
|
|
1232
|
+
*/
|
|
1233
|
+
imageTarget?: string;
|
|
1234
|
+
/**
|
|
1235
|
+
* When true, {@link imageTarget} is an external (linked) URL written back
|
|
1236
|
+
* with `TargetMode="External"`, not an embedded package path.
|
|
1237
|
+
*/
|
|
1238
|
+
imageTargetExternal?: boolean; /** Optional scale factor (1.0 = native, 0.5 = half-size). */
|
|
1239
|
+
scale?: number;
|
|
1240
|
+
/**
|
|
1241
|
+
* Display width in points from the VML shape, captured at parse so the
|
|
1242
|
+
* source aspect ratio survives a save that re-synthesizes the watermark
|
|
1243
|
+
* (Word stretches the image to the shape box, so a non-2:1 box distorts a
|
|
1244
|
+
* non-2:1 image). Absent for synthesized watermarks, which fall back to
|
|
1245
|
+
* Word's default box scaled by `scale`.
|
|
1246
|
+
*/
|
|
1247
|
+
widthPt?: number; /** Display height in points from the VML shape. See {@link widthPt}. */
|
|
1248
|
+
heightPt?: number;
|
|
1249
|
+
/**
|
|
1250
|
+
* Whether Word's "washout" effect was applied (low contrast).
|
|
1251
|
+
* Default true — Word emits washout=true on every picture
|
|
1252
|
+
* watermark inserted via Insert → Watermark.
|
|
1253
|
+
*/
|
|
1254
|
+
washout?: boolean;
|
|
1255
|
+
};
|
|
1256
|
+
/**
|
|
1257
|
+
* Footnote position
|
|
1258
|
+
*/
|
|
1259
|
+
type FootnotePosition = "pageBottom" | "beneathText" | "sectEnd" | "docEnd";
|
|
1260
|
+
/**
|
|
1261
|
+
* Endnote position
|
|
1262
|
+
*/
|
|
1263
|
+
type EndnotePosition = "sectEnd" | "docEnd";
|
|
1264
|
+
/**
|
|
1265
|
+
* Number restart type
|
|
1266
|
+
*/
|
|
1267
|
+
type NoteNumberRestart = "continuous" | "eachSect" | "eachPage";
|
|
1268
|
+
/**
|
|
1269
|
+
* Footnote properties
|
|
1270
|
+
*/
|
|
1271
|
+
type FootnoteProperties = {
|
|
1272
|
+
position?: FootnotePosition;
|
|
1273
|
+
numFmt?: NumberFormat;
|
|
1274
|
+
numStart?: number;
|
|
1275
|
+
numRestart?: NoteNumberRestart;
|
|
1276
|
+
};
|
|
1277
|
+
/**
|
|
1278
|
+
* Endnote properties
|
|
1279
|
+
*/
|
|
1280
|
+
type EndnoteProperties = {
|
|
1281
|
+
position?: EndnotePosition;
|
|
1282
|
+
numFmt?: NumberFormat;
|
|
1283
|
+
numStart?: number;
|
|
1284
|
+
numRestart?: NoteNumberRestart;
|
|
1285
|
+
};
|
|
1286
|
+
/**
|
|
1287
|
+
* Footnote (w:footnote)
|
|
1288
|
+
*/
|
|
1289
|
+
type Footnote = {
|
|
1290
|
+
type: "footnote"; /** Footnote ID */
|
|
1291
|
+
id: number; /** Special footnote type */
|
|
1292
|
+
noteType?: "normal" | "separator" | "continuationSeparator" | "continuationNotice";
|
|
1293
|
+
/**
|
|
1294
|
+
* Content. Note bodies may carry block-level `<w:sdt>` content
|
|
1295
|
+
* controls (citation slots, bound metadata fields) — preserved as
|
|
1296
|
+
* `BlockSdt` so the rest of folio's SDT round-trip + mutate APIs
|
|
1297
|
+
* work in notes the same as they do in the main body. Mirrors the
|
|
1298
|
+
* shape upstream eigenpal/docx-editor#678 fixed for the same case.
|
|
1299
|
+
*/
|
|
1300
|
+
content: (Paragraph | Table | BlockSdt)[];
|
|
1301
|
+
};
|
|
1302
|
+
/**
|
|
1303
|
+
* Endnote (w:endnote)
|
|
1304
|
+
*/
|
|
1305
|
+
type Endnote = {
|
|
1306
|
+
type: "endnote"; /** Endnote ID */
|
|
1307
|
+
id: number; /** Special endnote type */
|
|
1308
|
+
noteType?: "normal" | "separator" | "continuationSeparator" | "continuationNotice";
|
|
1309
|
+
/**
|
|
1310
|
+
* Content. Like `Footnote.content`, may carry block-level `<w:sdt>`
|
|
1311
|
+
* preserved as `BlockSdt` so SDT round-trip works inside endnotes.
|
|
1312
|
+
*/
|
|
1313
|
+
content: (Paragraph | Table | BlockSdt)[];
|
|
1314
|
+
};
|
|
1315
|
+
/**
|
|
1316
|
+
* Page orientation
|
|
1317
|
+
*/
|
|
1318
|
+
type PageOrientation = "portrait" | "landscape";
|
|
1319
|
+
/**
|
|
1320
|
+
* Section start type
|
|
1321
|
+
*/
|
|
1322
|
+
type SectionStart = "continuous" | "nextPage" | "oddPage" | "evenPage" | "nextColumn";
|
|
1323
|
+
/**
|
|
1324
|
+
* Vertical alignment
|
|
1325
|
+
*/
|
|
1326
|
+
type VerticalAlign = "top" | "center" | "both" | "bottom";
|
|
1327
|
+
/**
|
|
1328
|
+
* Line number restart type
|
|
1329
|
+
*/
|
|
1330
|
+
type LineNumberRestart = "continuous" | "newPage" | "newSection";
|
|
1331
|
+
/**
|
|
1332
|
+
* Column definition
|
|
1333
|
+
*/
|
|
1334
|
+
type Column = {
|
|
1335
|
+
/** Column width in twips */width?: number; /** Space after column in twips */
|
|
1336
|
+
space?: number;
|
|
1337
|
+
};
|
|
1338
|
+
/**
|
|
1339
|
+
* Section properties (w:sectPr)
|
|
1340
|
+
*/
|
|
1341
|
+
type SectionTextDirection = "lrTb" | "tbRl" | "btLr" | "lrTbV" | "tbRlV" | "tbLrV" | "tb" | "rl" | "lr" | "tbV" | "rlV" | "lrV";
|
|
1342
|
+
type SectionProperties = {
|
|
1343
|
+
/** Page width in twips */pageWidth?: number; /** Page height in twips */
|
|
1344
|
+
pageHeight?: number; /** Page orientation */
|
|
1345
|
+
orientation?: PageOrientation; /** Top margin in twips */
|
|
1346
|
+
marginTop?: number; /** Bottom margin in twips */
|
|
1347
|
+
marginBottom?: number; /** Left margin in twips */
|
|
1348
|
+
marginLeft?: number; /** Right margin in twips */
|
|
1349
|
+
marginRight?: number; /** Header distance from top in twips */
|
|
1350
|
+
headerDistance?: number; /** Footer distance from bottom in twips */
|
|
1351
|
+
footerDistance?: number; /** Gutter margin in twips */
|
|
1352
|
+
gutter?: number; /** Number of columns */
|
|
1353
|
+
columnCount?: number; /** Space between columns in twips */
|
|
1354
|
+
columnSpace?: number; /** Equal width columns */
|
|
1355
|
+
equalWidth?: boolean; /** Separator line between columns */
|
|
1356
|
+
separator?: boolean; /** Individual column definitions */
|
|
1357
|
+
columns?: Column[]; /** Section start type */
|
|
1358
|
+
sectionStart?: SectionStart; /** Vertical alignment of text */
|
|
1359
|
+
verticalAlign?: VerticalAlign; /** Section text direction */
|
|
1360
|
+
textDirection?: SectionTextDirection; /** Right-to-left section */
|
|
1361
|
+
bidi?: boolean; /** Header references */
|
|
1362
|
+
headerReferences?: HeaderReference[]; /** Footer references */
|
|
1363
|
+
footerReferences?: FooterReference[]; /** Different first page header/footer */
|
|
1364
|
+
titlePg?: boolean; /** Different odd/even page headers/footers */
|
|
1365
|
+
evenAndOddHeaders?: boolean; /** Line numbering settings */
|
|
1366
|
+
lineNumbers?: {
|
|
1367
|
+
start?: number;
|
|
1368
|
+
countBy?: number;
|
|
1369
|
+
distance?: number;
|
|
1370
|
+
restart?: LineNumberRestart;
|
|
1371
|
+
}; /** Page numbering settings */
|
|
1372
|
+
pageNumbering?: {
|
|
1373
|
+
format?: string;
|
|
1374
|
+
start?: number;
|
|
1375
|
+
chapterStyle?: number;
|
|
1376
|
+
chapterSeparator?: string;
|
|
1377
|
+
}; /** Page borders */
|
|
1378
|
+
pageBorders?: {
|
|
1379
|
+
top?: BorderSpec;
|
|
1380
|
+
bottom?: BorderSpec;
|
|
1381
|
+
left?: BorderSpec;
|
|
1382
|
+
right?: BorderSpec; /** Display setting */
|
|
1383
|
+
display?: "allPages" | "firstPage" | "notFirstPage"; /** Offset from */
|
|
1384
|
+
offsetFrom?: "page" | "text"; /** Z-order */
|
|
1385
|
+
zOrder?: "front" | "back";
|
|
1386
|
+
}; /** Page background */
|
|
1387
|
+
background?: {
|
|
1388
|
+
color?: ColorValue;
|
|
1389
|
+
themeColor?: ThemeColorSlot;
|
|
1390
|
+
themeTint?: string;
|
|
1391
|
+
themeShade?: string;
|
|
1392
|
+
}; /** Footnote properties for this section */
|
|
1393
|
+
footnotePr?: FootnoteProperties; /** Number of footnote columns in this section (`w15:footnoteColumns`) */
|
|
1394
|
+
footnoteColumns?: number; /** Endnote properties for this section */
|
|
1395
|
+
endnotePr?: EndnoteProperties; /** Document grid */
|
|
1396
|
+
docGrid?: {
|
|
1397
|
+
type?: "default" | "lines" | "linesAndChars" | "snapToChars";
|
|
1398
|
+
linePitch?: number;
|
|
1399
|
+
charSpace?: number;
|
|
1400
|
+
}; /** First page paper source */
|
|
1401
|
+
paperSrcFirst?: number; /** Other pages paper source */
|
|
1402
|
+
paperSrcOther?: number; /** Protected forms in this section */
|
|
1403
|
+
formProtection?: boolean; /** Suppress endnotes in this section */
|
|
1404
|
+
noEndnote?: boolean; /** Use right-to-left gutter in this section */
|
|
1405
|
+
rtlGutter?: boolean; /** Relationship id for printer settings */
|
|
1406
|
+
printerSettingsRelationshipId?: string; /** Section-level tracked property changes (w:sectPrChange) */
|
|
1407
|
+
propertyChanges?: SectionPropertyChange[];
|
|
1408
|
+
};
|
|
1409
|
+
/**
|
|
1410
|
+
* Block-level content types
|
|
1411
|
+
*/
|
|
1412
|
+
type BlockContent = Paragraph | Table | BlockSdt;
|
|
1413
|
+
/**
|
|
1414
|
+
* Section (implicit or explicit based on sectPr)
|
|
1415
|
+
*/
|
|
1416
|
+
type Section = {
|
|
1417
|
+
/** Section properties */properties: SectionProperties; /** Content in this section */
|
|
1418
|
+
content: BlockContent[]; /** Headers for this section */
|
|
1419
|
+
headers?: Map<HeaderFooterType, HeaderFooter>; /** Footers for this section */
|
|
1420
|
+
footers?: Map<HeaderFooterType, HeaderFooter>;
|
|
1421
|
+
};
|
|
1422
|
+
/**
|
|
1423
|
+
* Document body (w:body)
|
|
1424
|
+
*/
|
|
1425
|
+
type DocumentBody = {
|
|
1426
|
+
/** All content (paragraphs, tables) */content: BlockContent[]; /** Sections (derived from sectPr in paragraphs and final sectPr) */
|
|
1427
|
+
sections?: Section[]; /** Final section properties (from body's sectPr) */
|
|
1428
|
+
finalSectionProperties?: SectionProperties; /** Comments from comments.xml */
|
|
1429
|
+
comments?: Comment[];
|
|
1430
|
+
};
|
|
1431
|
+
//#endregion
|
|
1432
|
+
//#region src/model/styles.d.ts
|
|
1433
|
+
/**
|
|
1434
|
+
* Style type
|
|
1435
|
+
*/
|
|
1436
|
+
type StyleType = "paragraph" | "character" | "numbering" | "table";
|
|
1437
|
+
/**
|
|
1438
|
+
* Style definition
|
|
1439
|
+
*/
|
|
1440
|
+
type Style = {
|
|
1441
|
+
/** Style ID */styleId: string; /** Style type */
|
|
1442
|
+
type: StyleType; /** Display name */
|
|
1443
|
+
name?: string; /** Based on style ID */
|
|
1444
|
+
basedOn?: string; /** Next style after Enter (for paragraph styles) */
|
|
1445
|
+
next?: string; /** Linked style (paragraph/character pair) */
|
|
1446
|
+
link?: string; /** UI sort priority */
|
|
1447
|
+
uiPriority?: number; /** Hidden from UI */
|
|
1448
|
+
hidden?: boolean; /** Semi-hidden from UI */
|
|
1449
|
+
semiHidden?: boolean; /** Unhide when used */
|
|
1450
|
+
unhideWhenUsed?: boolean; /** Quick format in gallery */
|
|
1451
|
+
qFormat?: boolean; /** Is default style */
|
|
1452
|
+
default?: boolean; /** Personal style (custom) */
|
|
1453
|
+
personal?: boolean; /** Paragraph properties (for paragraph/table styles) */
|
|
1454
|
+
pPr?: ParagraphFormatting; /** Run properties */
|
|
1455
|
+
rPr?: TextFormatting; /** Table properties (for table styles) */
|
|
1456
|
+
tblPr?: TableFormatting; /** Table row properties */
|
|
1457
|
+
trPr?: TableRowFormatting; /** Table cell properties */
|
|
1458
|
+
tcPr?: TableCellFormatting; /** Conditional table style parts */
|
|
1459
|
+
tblStylePr?: {
|
|
1460
|
+
type: "band1Horz" | "band1Vert" | "band2Horz" | "band2Vert" | "firstCol" | "firstRow" | "lastCol" | "lastRow" | "neCell" | "nwCell" | "seCell" | "swCell" | "wholeTable";
|
|
1461
|
+
pPr?: ParagraphFormatting;
|
|
1462
|
+
rPr?: TextFormatting;
|
|
1463
|
+
tblPr?: TableFormatting;
|
|
1464
|
+
trPr?: TableRowFormatting;
|
|
1465
|
+
tcPr?: TableCellFormatting;
|
|
1466
|
+
}[];
|
|
1467
|
+
};
|
|
1468
|
+
/**
|
|
1469
|
+
* Document defaults (w:docDefaults)
|
|
1470
|
+
*/
|
|
1471
|
+
type DocDefaults = {
|
|
1472
|
+
/** Default run properties */rPr?: TextFormatting; /** Default paragraph properties */
|
|
1473
|
+
pPr?: ParagraphFormatting;
|
|
1474
|
+
};
|
|
1475
|
+
/**
|
|
1476
|
+
* Style definitions from styles.xml
|
|
1477
|
+
*/
|
|
1478
|
+
type StyleDefinitions = {
|
|
1479
|
+
/** Document defaults */docDefaults?: DocDefaults; /** Latent styles */
|
|
1480
|
+
latentStyles?: {
|
|
1481
|
+
defLockedState?: boolean;
|
|
1482
|
+
defUIPriority?: number;
|
|
1483
|
+
defSemiHidden?: boolean;
|
|
1484
|
+
defUnhideWhenUsed?: boolean;
|
|
1485
|
+
defQFormat?: boolean;
|
|
1486
|
+
count?: number;
|
|
1487
|
+
}; /** Style definitions */
|
|
1488
|
+
styles: Style[];
|
|
1489
|
+
};
|
|
1490
|
+
/**
|
|
1491
|
+
* Theme color scheme (a:clrScheme)
|
|
1492
|
+
*/
|
|
1493
|
+
type ThemeColorScheme = {
|
|
1494
|
+
/** Dark 1 color (usually black) */dk1?: string; /** Light 1 color (usually white) */
|
|
1495
|
+
lt1?: string; /** Dark 2 color */
|
|
1496
|
+
dk2?: string; /** Light 2 color */
|
|
1497
|
+
lt2?: string; /** Accent colors 1-6 */
|
|
1498
|
+
accent1?: string;
|
|
1499
|
+
accent2?: string;
|
|
1500
|
+
accent3?: string;
|
|
1501
|
+
accent4?: string;
|
|
1502
|
+
accent5?: string;
|
|
1503
|
+
accent6?: string; /** Hyperlink color */
|
|
1504
|
+
hlink?: string; /** Followed hyperlink color */
|
|
1505
|
+
folHlink?: string;
|
|
1506
|
+
};
|
|
1507
|
+
/**
|
|
1508
|
+
* Theme font (with script variants)
|
|
1509
|
+
*/
|
|
1510
|
+
type ThemeFont = {
|
|
1511
|
+
/** Latin font */latin?: string; /** East Asian font */
|
|
1512
|
+
ea?: string; /** Complex script font */
|
|
1513
|
+
cs?: string; /** Script-specific fonts */
|
|
1514
|
+
fonts?: Record<string, string>;
|
|
1515
|
+
};
|
|
1516
|
+
/**
|
|
1517
|
+
* Theme font scheme (a:fontScheme)
|
|
1518
|
+
*/
|
|
1519
|
+
type ThemeFontScheme = {
|
|
1520
|
+
/** Major font (headings) */majorFont?: ThemeFont; /** Minor font (body text) */
|
|
1521
|
+
minorFont?: ThemeFont;
|
|
1522
|
+
};
|
|
1523
|
+
/**
|
|
1524
|
+
* Theme (from theme1.xml)
|
|
1525
|
+
*/
|
|
1526
|
+
type Theme = {
|
|
1527
|
+
/** Theme name */name?: string; /** Color scheme */
|
|
1528
|
+
colorScheme?: ThemeColorScheme; /** Font scheme */
|
|
1529
|
+
fontScheme?: ThemeFontScheme; /** Format scheme (fills, lines, effects) - simplified */
|
|
1530
|
+
formatScheme?: {
|
|
1531
|
+
name?: string;
|
|
1532
|
+
};
|
|
1533
|
+
};
|
|
1534
|
+
/**
|
|
1535
|
+
* Font info from fontTable.xml
|
|
1536
|
+
*/
|
|
1537
|
+
type FontInfo = {
|
|
1538
|
+
/** Font name */name: string; /** Alternate names */
|
|
1539
|
+
altName?: string; /** Panose-1 classification */
|
|
1540
|
+
panose1?: string; /** Character set */
|
|
1541
|
+
charset?: string; /** Font family type */
|
|
1542
|
+
family?: "decorative" | "modern" | "roman" | "script" | "swiss" | "auto"; /** Pitch (fixed or variable) */
|
|
1543
|
+
pitch?: "default" | "fixed" | "variable"; /** Signature */
|
|
1544
|
+
sig?: {
|
|
1545
|
+
usb0?: string;
|
|
1546
|
+
usb1?: string;
|
|
1547
|
+
usb2?: string;
|
|
1548
|
+
usb3?: string;
|
|
1549
|
+
csb0?: string;
|
|
1550
|
+
csb1?: string;
|
|
1551
|
+
}; /** Embedded font data reference */
|
|
1552
|
+
embedRegular?: string;
|
|
1553
|
+
embedBold?: string;
|
|
1554
|
+
embedItalic?: string;
|
|
1555
|
+
embedBoldItalic?: string;
|
|
1556
|
+
};
|
|
1557
|
+
/**
|
|
1558
|
+
* Font table from fontTable.xml
|
|
1559
|
+
*/
|
|
1560
|
+
type FontTable = {
|
|
1561
|
+
fonts: FontInfo[];
|
|
1562
|
+
};
|
|
1563
|
+
/**
|
|
1564
|
+
* Relationship type
|
|
1565
|
+
*/
|
|
1566
|
+
type RelationshipType = string;
|
|
1567
|
+
/**
|
|
1568
|
+
* Relationship entry
|
|
1569
|
+
*/
|
|
1570
|
+
type Relationship = {
|
|
1571
|
+
/** Relationship ID (e.g., "rId1") */id: string; /** Relationship type URI */
|
|
1572
|
+
type: RelationshipType; /** Target path or URL */
|
|
1573
|
+
target: string; /** Target mode */
|
|
1574
|
+
targetMode?: "External" | "Internal";
|
|
1575
|
+
};
|
|
1576
|
+
/**
|
|
1577
|
+
* Relationship map (keyed by rId)
|
|
1578
|
+
*/
|
|
1579
|
+
type RelationshipMap = Map<string, Relationship>;
|
|
1580
|
+
/**
|
|
1581
|
+
* Media file from word/media/
|
|
1582
|
+
*/
|
|
1583
|
+
type MediaFile = {
|
|
1584
|
+
/** File path in ZIP */path: string; /** Original filename */
|
|
1585
|
+
filename?: string; /** MIME type */
|
|
1586
|
+
mimeType: string; /** Binary data */
|
|
1587
|
+
data: ArrayBuffer; /** Base64 encoded data for rendering */
|
|
1588
|
+
base64?: string; /** Data URL for direct use in src attributes */
|
|
1589
|
+
dataUrl?: string;
|
|
1590
|
+
};
|
|
1591
|
+
//#endregion
|
|
1592
|
+
//#region src/model/document.d.ts
|
|
1593
|
+
/**
|
|
1594
|
+
* Document-wide settings parsed from `word/settings.xml`.
|
|
1595
|
+
* Extend as more settings.xml fields enter the layout pipeline.
|
|
1596
|
+
*/
|
|
1597
|
+
type DocumentSettings = {
|
|
1598
|
+
/**
|
|
1599
|
+
* `w:defaultTabStop` (§17.6.13) — interval in twips between default
|
|
1600
|
+
* tab stops applied when a paragraph has no custom `w:tabs`. Word
|
|
1601
|
+
* defaults to 720 twips (½ inch) when absent.
|
|
1602
|
+
*/
|
|
1603
|
+
defaultTabStop: number;
|
|
1604
|
+
/**
|
|
1605
|
+
* `w:evenAndOddHeaders` (§17.10.1) — when true, even pages use a distinct
|
|
1606
|
+
* even header/footer. Word stores this in `settings.xml` (not `sectPr`), so
|
|
1607
|
+
* it is a document-wide flag; absent means odd/even share one header.
|
|
1608
|
+
*/
|
|
1609
|
+
evenAndOddHeaders?: boolean;
|
|
1610
|
+
/**
|
|
1611
|
+
* `w:themeFontLang` (§17.15.1.88) — language Word uses to fill empty
|
|
1612
|
+
* `<a:ea>`/`<a:cs>` theme font slots from the script-specific
|
|
1613
|
+
* `<a:font script="…">` entries. Absent for non-CJK/bidi docs.
|
|
1614
|
+
*/
|
|
1615
|
+
themeFontLang?: {
|
|
1616
|
+
eastAsia?: string;
|
|
1617
|
+
bidi?: string;
|
|
1618
|
+
};
|
|
1619
|
+
};
|
|
1620
|
+
/**
|
|
1621
|
+
* Complete DOCX package structure
|
|
1622
|
+
*/
|
|
1623
|
+
type DocxPackage = {
|
|
1624
|
+
/** Document body */document: DocumentBody; /** Document-wide settings (`word/settings.xml`). */
|
|
1625
|
+
settings?: DocumentSettings; /** Style definitions */
|
|
1626
|
+
styles?: StyleDefinitions; /** Theme */
|
|
1627
|
+
theme?: Theme; /** Numbering definitions */
|
|
1628
|
+
numbering?: NumberingDefinitions; /** Font table */
|
|
1629
|
+
fontTable?: FontTable; /** Footnotes */
|
|
1630
|
+
footnotes?: Footnote[]; /** Endnotes */
|
|
1631
|
+
endnotes?: Endnote[]; /** Headers by relationship ID */
|
|
1632
|
+
headers?: Map<string, HeaderFooter>; /** Footers by relationship ID */
|
|
1633
|
+
footers?: Map<string, HeaderFooter>; /** Document relationships */
|
|
1634
|
+
relationships?: RelationshipMap; /** Media files */
|
|
1635
|
+
media?: Map<string, MediaFile>; /** Document properties */
|
|
1636
|
+
properties?: {
|
|
1637
|
+
title?: string;
|
|
1638
|
+
subject?: string;
|
|
1639
|
+
creator?: string;
|
|
1640
|
+
keywords?: string;
|
|
1641
|
+
description?: string;
|
|
1642
|
+
lastModifiedBy?: string;
|
|
1643
|
+
revision?: number;
|
|
1644
|
+
created?: Date;
|
|
1645
|
+
modified?: Date;
|
|
1646
|
+
};
|
|
1647
|
+
};
|
|
1648
|
+
/**
|
|
1649
|
+
* Complete parsed DOCX document
|
|
1650
|
+
*/
|
|
1651
|
+
type Document = {
|
|
1652
|
+
/** DOCX package with all parsed content */package: DocxPackage; /** Original ArrayBuffer for round-trip */
|
|
1653
|
+
originalBuffer?: ArrayBuffer; /** Detected template variables ({{...}}) */
|
|
1654
|
+
templateVariables?: string[]; /** Font families referenced in the document (extracted during parsing for deferred loading) */
|
|
1655
|
+
requiredFonts?: string[]; /** Parsing warnings/errors */
|
|
1656
|
+
warnings?: string[];
|
|
1657
|
+
};
|
|
1658
|
+
//#endregion
|
|
1659
|
+
export { InlineSdt as $, AbstractNumbering as $t, DocumentBody as A, ShadingProperties as An, ShapeContent as At, FootnotePosition as B, TableCell as Bt, Column as C, TableWidthType as Cn, SdtProperties as Ct, CommentReference as D, BorderSpec as Dn, SectionPropertyChange as Dt, CommentRangeStart as E, UnderlineStyle as En, SectionProperties as Et, Field as F, SimpleField as Ft, Hyperlink as G, TableStructuralChangeInfo as Gt, HeaderFooter as H, TablePropertyChange as Ht, FieldCharContent as I, SoftHyphenContent as It, ImagePadding as J, TextWatermark as Jt, Image as K, TextBox as Kt, FieldType as L, SymbolContent as Lt, Endnote as M, ShapeOutline as Mt, EndnotePosition as N, ShapeTextBody as Nt, ComplexField as O, ColorValue as On, SectionStart as Ot, EndnoteProperties as P, ShapeType as Pt, ImageWrap as Q, Watermark as Qt, FooterReference as R, TabContent as Rt, BreakContent as S, TableRowFormatting as Sn, RunPropertyChange as St, CommentRangeEnd as T, TextFormatting as Tn, Section as Tt, HeaderFooterType as U, TableRow as Ut, FootnoteProperties as V, TableCellPropertyChange as Vt, HeaderReference as W, TableRowPropertyChange as Wt, ImageSize as X, TrackedRunChange as Xt, ImagePosition as Y, TrackedChangeInfo as Yt, ImageTransform as Z, VerticalAlign as Zt, ThemeFontScheme as _, TableBorders as _n, ParagraphPropertyChange as _t, FontInfo as a, NumberingInstance as an, MoveFromRangeEnd as at, BookmarkEnd as b, TableLook as bn, Run as bt, Relationship as c, EmphasisMark as cn, MoveToRangeEnd as ct, Style as d, ParagraphAlignment as dn, NoteNumberRestart as dt, LevelSuffix as en, Insertion as et, StyleDefinitions as f, ParagraphFormatting as fn, NoteReferenceContent as ft, ThemeFont as g, TabStopAlignment as gn, ParagraphMarkChange as gt, ThemeColorScheme as h, TabStop as hn, ParagraphContent as ht, DocDefaults as i, NumberingDefinitions as in, MoveFrom as it, DrawingContent as j, ThemeColorSlot as jn, ShapeFill as jt, Deletion as k, KnownBorderStyle as kn, Shape as kt, RelationshipMap as l, FloatingTableProperties as ln, MoveToRangeStart as lt, Theme as m, TabLeader as mn, Paragraph as mt, DocumentSettings as n, ListRendering as nn, LineNumberRestart as nt, FontTable as o, CellMargins as on, MoveFromRangeStart as ot, StyleType as p, SpacingExplicit as pn, PageOrientation as pt, ImageCrop as q, TextContent as qt, DocxPackage as r, NumberFormat as rn, MathEquation as rt, MediaFile as s, ConditionalFormatStyle as sn, MoveTo as st, Document as t, ListLevel as tn, InstrTextContent as tt, RelationshipType as u, LineSpacingRule as un, NoBreakHyphenContent as ut, BlockContent as v, TableCellFormatting as vn, PictureWatermark as vt, Comment as w, TextEffect as wn, SdtType as wt, BookmarkStart as x, TableMeasurement as xn, RunContent as xt, BlockSdt as y, TableFormatting as yn, PropertyChangeInfo as yt, Footnote as z, Table as zt };
|