@eigenpal/docx-editor-agents 0.0.28 → 0.0.30
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/dist/bridge.js +3 -1
- package/dist/bridge.js.map +1 -1
- package/dist/bridge.mjs +8 -0
- package/dist/bridge.mjs.map +1 -0
- package/dist/chunk-5D2V7VK3.js +976 -0
- package/dist/chunk-5D2V7VK3.js.map +1 -0
- package/dist/chunk-5E3CFYZ4.mjs +249 -0
- package/dist/chunk-5E3CFYZ4.mjs.map +1 -0
- package/dist/chunk-GACRQVPW.js +11680 -0
- package/dist/chunk-GACRQVPW.js.map +1 -0
- package/dist/chunk-OFUT6WUQ.mjs +969 -0
- package/dist/chunk-OFUT6WUQ.mjs.map +1 -0
- package/dist/chunk-Q2HHIVUL.js +266 -0
- package/dist/chunk-Q2HHIVUL.js.map +1 -0
- package/dist/chunk-R4MIGZEJ.mjs +11587 -0
- package/dist/chunk-R4MIGZEJ.mjs.map +1 -0
- package/dist/executor-6ZG2VUZS.mjs +3 -0
- package/dist/executor-6ZG2VUZS.mjs.map +1 -0
- package/dist/executor-ZRVQSXRT.js +16 -0
- package/dist/executor-ZRVQSXRT.js.map +1 -0
- package/dist/headless-O2RRWYCB.js +422 -0
- package/dist/headless-O2RRWYCB.js.map +1 -0
- package/dist/headless-UKRSG32U.mjs +5 -0
- package/dist/headless-UKRSG32U.mjs.map +1 -0
- package/dist/index.d.mts +2013 -0
- package/dist/index.d.ts +1776 -1
- package/dist/index.js +26 -19
- package/dist/index.js.map +1 -1
- package/dist/{index.cjs → index.mjs} +23 -26
- package/dist/index.mjs.map +1 -0
- package/dist/processTemplate-7M6KZ6GR.mjs +3 -0
- package/dist/processTemplate-7M6KZ6GR.mjs.map +1 -0
- package/dist/processTemplate-H4X2MH5R.js +54 -0
- package/dist/processTemplate-H4X2MH5R.js.map +1 -0
- package/package.json +11 -9
- package/dist/bridge.cjs +0 -10
- package/dist/bridge.cjs.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -238
- /package/dist/{bridge.d.cts → bridge.d.mts} +0 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,2013 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Color & Styling Primitives
|
|
3
|
+
*
|
|
4
|
+
* Basic types used throughout OOXML for colors, borders, and shading.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Theme color slots from theme1.xml
|
|
8
|
+
*/
|
|
9
|
+
type ThemeColorSlot = 'dk1' | 'lt1' | 'dk2' | 'lt2' | 'accent1' | 'accent2' | 'accent3' | 'accent4' | 'accent5' | 'accent6' | 'hlink' | 'folHlink' | 'background1' | 'text1' | 'background2' | 'text2';
|
|
10
|
+
/**
|
|
11
|
+
* Color value - can be direct RGB, theme reference, or auto
|
|
12
|
+
*/
|
|
13
|
+
interface ColorValue {
|
|
14
|
+
/** RGB hex value without # (e.g., "FF0000") */
|
|
15
|
+
rgb?: string;
|
|
16
|
+
/** Theme color slot reference */
|
|
17
|
+
themeColor?: ThemeColorSlot;
|
|
18
|
+
/** Tint modifier (0-255 as hex string, e.g., "80") - makes color lighter */
|
|
19
|
+
themeTint?: string;
|
|
20
|
+
/** Shade modifier (0-255 as hex string) - makes color darker */
|
|
21
|
+
themeShade?: string;
|
|
22
|
+
/** Auto color - context-dependent (usually black for text) */
|
|
23
|
+
auto?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Border specification for any border (paragraph, table, page)
|
|
27
|
+
*/
|
|
28
|
+
interface BorderSpec {
|
|
29
|
+
/** Border style */
|
|
30
|
+
style: 'none' | 'single' | 'double' | 'dotted' | 'dashed' | 'thick' | 'triple' | 'thinThickSmallGap' | 'thickThinSmallGap' | 'thinThickMediumGap' | 'thickThinMediumGap' | 'thinThickLargeGap' | 'thickThinLargeGap' | 'wave' | 'doubleWave' | 'dashSmallGap' | 'dashDotStroked' | 'threeDEmboss' | 'threeDEngrave' | 'outset' | 'inset' | 'nil';
|
|
31
|
+
/** Color of the border */
|
|
32
|
+
color?: ColorValue;
|
|
33
|
+
/** Width in eighths of a point (1/8 pt) */
|
|
34
|
+
size?: number;
|
|
35
|
+
/** Spacing from text in points */
|
|
36
|
+
space?: number;
|
|
37
|
+
/** Shadow effect */
|
|
38
|
+
shadow?: boolean;
|
|
39
|
+
/** Frame effect */
|
|
40
|
+
frame?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Shading/background properties
|
|
44
|
+
*/
|
|
45
|
+
interface ShadingProperties {
|
|
46
|
+
/** Pattern fill color */
|
|
47
|
+
color?: ColorValue;
|
|
48
|
+
/** Background fill color */
|
|
49
|
+
fill?: ColorValue;
|
|
50
|
+
/** Shading pattern type */
|
|
51
|
+
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';
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Text, Paragraph, and Table Formatting Types
|
|
56
|
+
*
|
|
57
|
+
* Properties that control how text, paragraphs, and table structures
|
|
58
|
+
* are formatted in OOXML (w:rPr, w:pPr, w:tblPr, etc.).
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Underline style options
|
|
63
|
+
*/
|
|
64
|
+
type UnderlineStyle = 'none' | 'single' | 'words' | 'double' | 'thick' | 'dotted' | 'dottedHeavy' | 'dash' | 'dashedHeavy' | 'dashLong' | 'dashLongHeavy' | 'dotDash' | 'dashDotHeavy' | 'dotDotDash' | 'dashDotDotHeavy' | 'wave' | 'wavyHeavy' | 'wavyDouble';
|
|
65
|
+
/**
|
|
66
|
+
* Text effect animations
|
|
67
|
+
*/
|
|
68
|
+
type TextEffect = 'none' | 'blinkBackground' | 'lights' | 'antsBlack' | 'antsRed' | 'shimmer' | 'sparkle';
|
|
69
|
+
/**
|
|
70
|
+
* Emphasis mark type
|
|
71
|
+
*/
|
|
72
|
+
type EmphasisMark = 'none' | 'dot' | 'comma' | 'circle' | 'underDot';
|
|
73
|
+
/**
|
|
74
|
+
* Complete text formatting properties (w:rPr)
|
|
75
|
+
*/
|
|
76
|
+
interface TextFormatting {
|
|
77
|
+
/** Bold (w:b) */
|
|
78
|
+
bold?: boolean;
|
|
79
|
+
/** Bold complex script (w:bCs) */
|
|
80
|
+
boldCs?: boolean;
|
|
81
|
+
/** Italic (w:i) */
|
|
82
|
+
italic?: boolean;
|
|
83
|
+
/** Italic complex script (w:iCs) */
|
|
84
|
+
italicCs?: boolean;
|
|
85
|
+
/** Underline style and color (w:u) */
|
|
86
|
+
underline?: {
|
|
87
|
+
style: UnderlineStyle;
|
|
88
|
+
color?: ColorValue;
|
|
89
|
+
};
|
|
90
|
+
/** Strikethrough (w:strike) */
|
|
91
|
+
strike?: boolean;
|
|
92
|
+
/** Double strikethrough (w:dstrike) */
|
|
93
|
+
doubleStrike?: boolean;
|
|
94
|
+
/** Superscript/subscript (w:vertAlign) */
|
|
95
|
+
vertAlign?: 'baseline' | 'superscript' | 'subscript';
|
|
96
|
+
/** Small caps (w:smallCaps) */
|
|
97
|
+
smallCaps?: boolean;
|
|
98
|
+
/** All caps (w:caps) */
|
|
99
|
+
allCaps?: boolean;
|
|
100
|
+
/** Hidden text (w:vanish) */
|
|
101
|
+
hidden?: boolean;
|
|
102
|
+
/** Text color (w:color) */
|
|
103
|
+
color?: ColorValue;
|
|
104
|
+
/** Highlight/background color (w:highlight) */
|
|
105
|
+
highlight?: 'black' | 'blue' | 'cyan' | 'darkBlue' | 'darkCyan' | 'darkGray' | 'darkGreen' | 'darkMagenta' | 'darkRed' | 'darkYellow' | 'green' | 'lightGray' | 'magenta' | 'none' | 'red' | 'white' | 'yellow';
|
|
106
|
+
/** Character shading (w:shd) */
|
|
107
|
+
shading?: ShadingProperties;
|
|
108
|
+
/** Font size in half-points (w:sz) - e.g., 24 = 12pt */
|
|
109
|
+
fontSize?: number;
|
|
110
|
+
/** Font size complex script (w:szCs) */
|
|
111
|
+
fontSizeCs?: number;
|
|
112
|
+
/** Font family (w:rFonts) */
|
|
113
|
+
fontFamily?: {
|
|
114
|
+
ascii?: string;
|
|
115
|
+
hAnsi?: string;
|
|
116
|
+
eastAsia?: string;
|
|
117
|
+
cs?: string;
|
|
118
|
+
/** Theme font reference */
|
|
119
|
+
asciiTheme?: 'majorAscii' | 'majorHAnsi' | 'majorEastAsia' | 'majorBidi' | 'minorAscii' | 'minorHAnsi' | 'minorEastAsia' | 'minorBidi';
|
|
120
|
+
hAnsiTheme?: string;
|
|
121
|
+
eastAsiaTheme?: string;
|
|
122
|
+
csTheme?: string;
|
|
123
|
+
};
|
|
124
|
+
/** Character spacing in twips (w:spacing) */
|
|
125
|
+
spacing?: number;
|
|
126
|
+
/** Raised/lowered text position in half-points (w:position) */
|
|
127
|
+
position?: number;
|
|
128
|
+
/** Horizontal text scale percentage (w:w) */
|
|
129
|
+
scale?: number;
|
|
130
|
+
/** Kerning threshold in half-points (w:kern) */
|
|
131
|
+
kerning?: number;
|
|
132
|
+
/** Text effect animation (w:effect) */
|
|
133
|
+
effect?: TextEffect;
|
|
134
|
+
/** Emphasis mark (w:em) */
|
|
135
|
+
emphasisMark?: EmphasisMark;
|
|
136
|
+
/** Emboss effect (w:emboss) */
|
|
137
|
+
emboss?: boolean;
|
|
138
|
+
/** Imprint/engrave effect (w:imprint) */
|
|
139
|
+
imprint?: boolean;
|
|
140
|
+
/** Outline effect (w:outline) */
|
|
141
|
+
outline?: boolean;
|
|
142
|
+
/** Shadow effect (w:shadow) */
|
|
143
|
+
shadow?: boolean;
|
|
144
|
+
/** Right-to-left text (w:rtl) */
|
|
145
|
+
rtl?: boolean;
|
|
146
|
+
/** Complex script formatting (w:cs) */
|
|
147
|
+
cs?: boolean;
|
|
148
|
+
/** Character style ID (w:rStyle) */
|
|
149
|
+
styleId?: string;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Tab stop alignment
|
|
153
|
+
*/
|
|
154
|
+
type TabStopAlignment = 'left' | 'center' | 'right' | 'decimal' | 'bar' | 'clear' | 'num';
|
|
155
|
+
/**
|
|
156
|
+
* Tab leader character
|
|
157
|
+
*/
|
|
158
|
+
type TabLeader = 'none' | 'dot' | 'hyphen' | 'underscore' | 'heavy' | 'middleDot';
|
|
159
|
+
/**
|
|
160
|
+
* Tab stop definition
|
|
161
|
+
*/
|
|
162
|
+
interface TabStop {
|
|
163
|
+
/** Position in twips from left margin */
|
|
164
|
+
position: number;
|
|
165
|
+
/** Alignment at tab stop */
|
|
166
|
+
alignment: TabStopAlignment;
|
|
167
|
+
/** Leader character */
|
|
168
|
+
leader?: TabLeader;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Line spacing rule
|
|
172
|
+
*/
|
|
173
|
+
type LineSpacingRule = 'auto' | 'exact' | 'atLeast';
|
|
174
|
+
/**
|
|
175
|
+
* Paragraph alignment/justification
|
|
176
|
+
*/
|
|
177
|
+
type ParagraphAlignment = 'left' | 'center' | 'right' | 'both' | 'distribute' | 'mediumKashida' | 'highKashida' | 'lowKashida' | 'thaiDistribute';
|
|
178
|
+
/**
|
|
179
|
+
* Complete paragraph formatting properties (w:pPr)
|
|
180
|
+
*/
|
|
181
|
+
interface ParagraphFormatting {
|
|
182
|
+
/** Paragraph alignment (w:jc) */
|
|
183
|
+
alignment?: ParagraphAlignment;
|
|
184
|
+
/** Text direction (w:bidi) */
|
|
185
|
+
bidi?: boolean;
|
|
186
|
+
/** Spacing before in twips (w:spacing/@w:before) */
|
|
187
|
+
spaceBefore?: number;
|
|
188
|
+
/** Spacing after in twips (w:spacing/@w:after) */
|
|
189
|
+
spaceAfter?: number;
|
|
190
|
+
/** Line spacing value (w:spacing/@w:line) */
|
|
191
|
+
lineSpacing?: number;
|
|
192
|
+
/** Line spacing rule (w:spacing/@w:lineRule) */
|
|
193
|
+
lineSpacingRule?: LineSpacingRule;
|
|
194
|
+
/** Auto space before (w:spacing/@w:beforeAutospacing) */
|
|
195
|
+
beforeAutospacing?: boolean;
|
|
196
|
+
/** Auto space after (w:spacing/@w:afterAutospacing) */
|
|
197
|
+
afterAutospacing?: boolean;
|
|
198
|
+
/** Left indent in twips (w:ind/@w:left) */
|
|
199
|
+
indentLeft?: number;
|
|
200
|
+
/** Right indent in twips (w:ind/@w:right) */
|
|
201
|
+
indentRight?: number;
|
|
202
|
+
/** First line indent in twips - positive for indent, negative for hanging (w:ind/@w:firstLine or @w:hanging) */
|
|
203
|
+
indentFirstLine?: number;
|
|
204
|
+
/** Whether first line is hanging indent */
|
|
205
|
+
hangingIndent?: boolean;
|
|
206
|
+
/** Paragraph borders (w:pBdr) */
|
|
207
|
+
borders?: {
|
|
208
|
+
top?: BorderSpec;
|
|
209
|
+
bottom?: BorderSpec;
|
|
210
|
+
left?: BorderSpec;
|
|
211
|
+
right?: BorderSpec;
|
|
212
|
+
between?: BorderSpec;
|
|
213
|
+
bar?: BorderSpec;
|
|
214
|
+
};
|
|
215
|
+
/** Paragraph shading (w:shd) */
|
|
216
|
+
shading?: ShadingProperties;
|
|
217
|
+
/** Custom tab stops (w:tabs) */
|
|
218
|
+
tabs?: TabStop[];
|
|
219
|
+
/** Keep with next paragraph (w:keepNext) */
|
|
220
|
+
keepNext?: boolean;
|
|
221
|
+
/** Keep lines together (w:keepLines) */
|
|
222
|
+
keepLines?: boolean;
|
|
223
|
+
/** Widow/orphan control (w:widowControl) */
|
|
224
|
+
widowControl?: boolean;
|
|
225
|
+
/** Page break before (w:pageBreakBefore) */
|
|
226
|
+
pageBreakBefore?: boolean;
|
|
227
|
+
/** Contextual spacing — suppress space between paragraphs of the same style (w:contextualSpacing) */
|
|
228
|
+
contextualSpacing?: boolean;
|
|
229
|
+
/** Numbering properties (w:numPr) */
|
|
230
|
+
numPr?: {
|
|
231
|
+
/** Numbering definition ID (w:numId) */
|
|
232
|
+
numId?: number;
|
|
233
|
+
/** List level (0-8) (w:ilvl) */
|
|
234
|
+
ilvl?: number;
|
|
235
|
+
};
|
|
236
|
+
/** Outline level 0-9 (w:outlineLvl) */
|
|
237
|
+
outlineLevel?: number;
|
|
238
|
+
/** Paragraph style ID (w:pStyle) */
|
|
239
|
+
styleId?: string;
|
|
240
|
+
/** Text frame properties (w:framePr) */
|
|
241
|
+
frame?: {
|
|
242
|
+
width?: number;
|
|
243
|
+
height?: number;
|
|
244
|
+
hAnchor?: 'text' | 'margin' | 'page';
|
|
245
|
+
vAnchor?: 'text' | 'margin' | 'page';
|
|
246
|
+
x?: number;
|
|
247
|
+
y?: number;
|
|
248
|
+
xAlign?: 'left' | 'center' | 'right' | 'inside' | 'outside';
|
|
249
|
+
yAlign?: 'top' | 'center' | 'bottom' | 'inside' | 'outside' | 'inline';
|
|
250
|
+
wrap?: 'around' | 'auto' | 'none' | 'notBeside' | 'through' | 'tight';
|
|
251
|
+
};
|
|
252
|
+
/** Suppress line numbers (w:suppressLineNumbers) */
|
|
253
|
+
suppressLineNumbers?: boolean;
|
|
254
|
+
/** Suppress auto hyphens (w:suppressAutoHyphens) */
|
|
255
|
+
suppressAutoHyphens?: boolean;
|
|
256
|
+
/** Run properties to apply to all runs (w:rPr) */
|
|
257
|
+
runProperties?: TextFormatting;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Table width type
|
|
261
|
+
*/
|
|
262
|
+
type TableWidthType = 'auto' | 'dxa' | 'nil' | 'pct';
|
|
263
|
+
/**
|
|
264
|
+
* Table measurement (width or height)
|
|
265
|
+
*/
|
|
266
|
+
interface TableMeasurement {
|
|
267
|
+
/** Value in twips (for dxa) or fifths of a percent (for pct) */
|
|
268
|
+
value: number;
|
|
269
|
+
/** Measurement type */
|
|
270
|
+
type: TableWidthType;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Table borders
|
|
274
|
+
*/
|
|
275
|
+
interface TableBorders {
|
|
276
|
+
top?: BorderSpec;
|
|
277
|
+
bottom?: BorderSpec;
|
|
278
|
+
left?: BorderSpec;
|
|
279
|
+
right?: BorderSpec;
|
|
280
|
+
insideH?: BorderSpec;
|
|
281
|
+
insideV?: BorderSpec;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Cell margins
|
|
285
|
+
*/
|
|
286
|
+
interface CellMargins {
|
|
287
|
+
top?: TableMeasurement;
|
|
288
|
+
bottom?: TableMeasurement;
|
|
289
|
+
left?: TableMeasurement;
|
|
290
|
+
right?: TableMeasurement;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Table look flags (for table styles)
|
|
294
|
+
*/
|
|
295
|
+
interface TableLook {
|
|
296
|
+
firstColumn?: boolean;
|
|
297
|
+
firstRow?: boolean;
|
|
298
|
+
lastColumn?: boolean;
|
|
299
|
+
lastRow?: boolean;
|
|
300
|
+
noHBand?: boolean;
|
|
301
|
+
noVBand?: boolean;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Floating table properties
|
|
305
|
+
*/
|
|
306
|
+
interface FloatingTableProperties {
|
|
307
|
+
/** Horizontal anchor */
|
|
308
|
+
horzAnchor?: 'margin' | 'page' | 'text';
|
|
309
|
+
/** Vertical anchor */
|
|
310
|
+
vertAnchor?: 'margin' | 'page' | 'text';
|
|
311
|
+
/** Horizontal position */
|
|
312
|
+
tblpX?: number;
|
|
313
|
+
tblpXSpec?: 'left' | 'center' | 'right' | 'inside' | 'outside';
|
|
314
|
+
/** Vertical position */
|
|
315
|
+
tblpY?: number;
|
|
316
|
+
tblpYSpec?: 'top' | 'center' | 'bottom' | 'inside' | 'outside' | 'inline';
|
|
317
|
+
/** Distance from surrounding text */
|
|
318
|
+
topFromText?: number;
|
|
319
|
+
bottomFromText?: number;
|
|
320
|
+
leftFromText?: number;
|
|
321
|
+
rightFromText?: number;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Table formatting properties (w:tblPr)
|
|
325
|
+
*/
|
|
326
|
+
interface TableFormatting {
|
|
327
|
+
/** Table width */
|
|
328
|
+
width?: TableMeasurement;
|
|
329
|
+
/** Table justification */
|
|
330
|
+
justification?: 'left' | 'center' | 'right';
|
|
331
|
+
/** Cell spacing */
|
|
332
|
+
cellSpacing?: TableMeasurement;
|
|
333
|
+
/** Table indent from left margin */
|
|
334
|
+
indent?: TableMeasurement;
|
|
335
|
+
/** Table borders */
|
|
336
|
+
borders?: TableBorders;
|
|
337
|
+
/** Default cell margins */
|
|
338
|
+
cellMargins?: CellMargins;
|
|
339
|
+
/** Table layout */
|
|
340
|
+
layout?: 'fixed' | 'autofit';
|
|
341
|
+
/** Table style ID */
|
|
342
|
+
styleId?: string;
|
|
343
|
+
/** Table look (conditional formatting flags) */
|
|
344
|
+
look?: TableLook;
|
|
345
|
+
/** Shading/background */
|
|
346
|
+
shading?: ShadingProperties;
|
|
347
|
+
/** Overlap for floating tables */
|
|
348
|
+
overlap?: 'never' | 'overlap';
|
|
349
|
+
/** Floating table properties */
|
|
350
|
+
floating?: FloatingTableProperties;
|
|
351
|
+
/** Right to left table */
|
|
352
|
+
bidi?: boolean;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Table row formatting properties (w:trPr)
|
|
356
|
+
*/
|
|
357
|
+
interface TableRowFormatting {
|
|
358
|
+
/** Row height */
|
|
359
|
+
height?: TableMeasurement;
|
|
360
|
+
/** Height rule */
|
|
361
|
+
heightRule?: 'auto' | 'atLeast' | 'exact';
|
|
362
|
+
/** Header row (repeats on each page) */
|
|
363
|
+
header?: boolean;
|
|
364
|
+
/** Allow row to break across pages */
|
|
365
|
+
cantSplit?: boolean;
|
|
366
|
+
/** Row justification */
|
|
367
|
+
justification?: 'left' | 'center' | 'right';
|
|
368
|
+
/** Hidden row */
|
|
369
|
+
hidden?: boolean;
|
|
370
|
+
/** Conditional format style */
|
|
371
|
+
conditionalFormat?: ConditionalFormatStyle;
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Conditional format style
|
|
375
|
+
*/
|
|
376
|
+
interface ConditionalFormatStyle {
|
|
377
|
+
/** First row */
|
|
378
|
+
firstRow?: boolean;
|
|
379
|
+
/** Last row */
|
|
380
|
+
lastRow?: boolean;
|
|
381
|
+
/** First column */
|
|
382
|
+
firstColumn?: boolean;
|
|
383
|
+
/** Last column */
|
|
384
|
+
lastColumn?: boolean;
|
|
385
|
+
/** Odd horizontal band */
|
|
386
|
+
oddHBand?: boolean;
|
|
387
|
+
/** Even horizontal band */
|
|
388
|
+
evenHBand?: boolean;
|
|
389
|
+
/** Odd vertical band */
|
|
390
|
+
oddVBand?: boolean;
|
|
391
|
+
/** Even vertical band */
|
|
392
|
+
evenVBand?: boolean;
|
|
393
|
+
/** Northwest corner */
|
|
394
|
+
nwCell?: boolean;
|
|
395
|
+
/** Northeast corner */
|
|
396
|
+
neCell?: boolean;
|
|
397
|
+
/** Southwest corner */
|
|
398
|
+
swCell?: boolean;
|
|
399
|
+
/** Southeast corner */
|
|
400
|
+
seCell?: boolean;
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Table cell formatting properties (w:tcPr)
|
|
404
|
+
*/
|
|
405
|
+
interface TableCellFormatting {
|
|
406
|
+
/** Cell width */
|
|
407
|
+
width?: TableMeasurement;
|
|
408
|
+
/** Cell borders */
|
|
409
|
+
borders?: TableBorders;
|
|
410
|
+
/** Cell margins (override table default) */
|
|
411
|
+
margins?: CellMargins;
|
|
412
|
+
/** Cell shading/background */
|
|
413
|
+
shading?: ShadingProperties;
|
|
414
|
+
/** Vertical alignment */
|
|
415
|
+
verticalAlign?: 'top' | 'center' | 'bottom';
|
|
416
|
+
/** Text direction */
|
|
417
|
+
textDirection?: 'lr' | 'lrV' | 'rl' | 'rlV' | 'tb' | 'tbV' | 'tbRl' | 'tbRlV' | 'btLr';
|
|
418
|
+
/** Grid span (horizontal merge) */
|
|
419
|
+
gridSpan?: number;
|
|
420
|
+
/** Vertical merge */
|
|
421
|
+
vMerge?: 'restart' | 'continue';
|
|
422
|
+
/** Fit text to cell width */
|
|
423
|
+
fitText?: boolean;
|
|
424
|
+
/** Wrap text */
|
|
425
|
+
noWrap?: boolean;
|
|
426
|
+
/** Hide cell marker */
|
|
427
|
+
hideMark?: boolean;
|
|
428
|
+
/** Conditional format style */
|
|
429
|
+
conditionalFormat?: ConditionalFormatStyle;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* Lists & Numbering Types
|
|
434
|
+
*
|
|
435
|
+
* Types for bullet lists, numbered lists, and numbering definitions.
|
|
436
|
+
*/
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* Number format type
|
|
440
|
+
*/
|
|
441
|
+
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' | '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';
|
|
442
|
+
/**
|
|
443
|
+
* Multi-level suffix (what follows the number)
|
|
444
|
+
*/
|
|
445
|
+
type LevelSuffix = 'tab' | 'space' | 'nothing';
|
|
446
|
+
/**
|
|
447
|
+
* List level definition
|
|
448
|
+
*/
|
|
449
|
+
interface ListLevel {
|
|
450
|
+
/** Level index (0-8) */
|
|
451
|
+
ilvl: number;
|
|
452
|
+
/** Starting number */
|
|
453
|
+
start?: number;
|
|
454
|
+
/** Number format */
|
|
455
|
+
numFmt: NumberFormat;
|
|
456
|
+
/** Level text (e.g., "%1." or "•") */
|
|
457
|
+
lvlText: string;
|
|
458
|
+
/** Justification */
|
|
459
|
+
lvlJc?: 'left' | 'center' | 'right';
|
|
460
|
+
/** Suffix after number */
|
|
461
|
+
suffix?: LevelSuffix;
|
|
462
|
+
/** Paragraph properties for this level */
|
|
463
|
+
pPr?: ParagraphFormatting;
|
|
464
|
+
/** Run properties for the number/bullet */
|
|
465
|
+
rPr?: TextFormatting;
|
|
466
|
+
/** Restart numbering from higher level */
|
|
467
|
+
lvlRestart?: number;
|
|
468
|
+
/** Is legal numbering style */
|
|
469
|
+
isLgl?: boolean;
|
|
470
|
+
/** Legacy settings */
|
|
471
|
+
legacy?: {
|
|
472
|
+
legacy?: boolean;
|
|
473
|
+
legacySpace?: number;
|
|
474
|
+
legacyIndent?: number;
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* Abstract numbering definition (w:abstractNum)
|
|
479
|
+
*/
|
|
480
|
+
interface AbstractNumbering {
|
|
481
|
+
/** Abstract numbering ID */
|
|
482
|
+
abstractNumId: number;
|
|
483
|
+
/** Multi-level type */
|
|
484
|
+
multiLevelType?: 'hybridMultilevel' | 'multilevel' | 'singleLevel';
|
|
485
|
+
/** Numbering style link */
|
|
486
|
+
numStyleLink?: string;
|
|
487
|
+
/** Style link */
|
|
488
|
+
styleLink?: string;
|
|
489
|
+
/** Level definitions */
|
|
490
|
+
levels: ListLevel[];
|
|
491
|
+
/** Name */
|
|
492
|
+
name?: string;
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Numbering instance (w:num)
|
|
496
|
+
*/
|
|
497
|
+
interface NumberingInstance {
|
|
498
|
+
/** Numbering ID (referenced by paragraphs) */
|
|
499
|
+
numId: number;
|
|
500
|
+
/** Reference to abstract numbering */
|
|
501
|
+
abstractNumId: number;
|
|
502
|
+
/** Level overrides */
|
|
503
|
+
levelOverrides?: Array<{
|
|
504
|
+
ilvl: number;
|
|
505
|
+
startOverride?: number;
|
|
506
|
+
lvl?: ListLevel;
|
|
507
|
+
}>;
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* Computed list rendering info
|
|
511
|
+
*/
|
|
512
|
+
interface ListRendering {
|
|
513
|
+
/** Computed marker text (e.g., "1.", "a)", "•") */
|
|
514
|
+
marker: string;
|
|
515
|
+
/** List level (0-8) */
|
|
516
|
+
level: number;
|
|
517
|
+
/** Numbering ID */
|
|
518
|
+
numId: number;
|
|
519
|
+
/** Whether this is a bullet or numbered list */
|
|
520
|
+
isBullet: boolean;
|
|
521
|
+
/** Number format type (decimal, lowerRoman, upperRoman, etc.) */
|
|
522
|
+
numFmt?: NumberFormat;
|
|
523
|
+
/** Whether the list marker is hidden (w:vanish on level rPr) */
|
|
524
|
+
markerHidden?: boolean;
|
|
525
|
+
/** Marker font family from numbering level rPr (ascii name) */
|
|
526
|
+
markerFontFamily?: string;
|
|
527
|
+
/** Marker font size from numbering level rPr, in points */
|
|
528
|
+
markerFontSize?: number;
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Complete numbering definitions
|
|
532
|
+
*/
|
|
533
|
+
interface NumberingDefinitions {
|
|
534
|
+
/** Abstract numbering definitions */
|
|
535
|
+
abstractNums: AbstractNumbering[];
|
|
536
|
+
/** Numbering instances */
|
|
537
|
+
nums: NumberingInstance[];
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
/**
|
|
541
|
+
* Document Content Model
|
|
542
|
+
*
|
|
543
|
+
* All content-bearing types: runs, hyperlinks, bookmarks, fields,
|
|
544
|
+
* images, shapes, tables, lists, paragraphs, headers/footers,
|
|
545
|
+
* footnotes/endnotes, and sections.
|
|
546
|
+
*
|
|
547
|
+
* These types form a deeply interrelated tree (Paragraph ↔ Table ↔ ShapeTextBody)
|
|
548
|
+
* and are kept together to avoid circular import issues.
|
|
549
|
+
*/
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* Plain text content
|
|
553
|
+
*/
|
|
554
|
+
interface TextContent {
|
|
555
|
+
type: 'text';
|
|
556
|
+
/** The text string */
|
|
557
|
+
text: string;
|
|
558
|
+
/** Preserve whitespace (xml:space="preserve") */
|
|
559
|
+
preserveSpace?: boolean;
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* Tab character
|
|
563
|
+
*/
|
|
564
|
+
interface TabContent {
|
|
565
|
+
type: 'tab';
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* Line break
|
|
569
|
+
*/
|
|
570
|
+
interface BreakContent {
|
|
571
|
+
type: 'break';
|
|
572
|
+
/** Break type */
|
|
573
|
+
breakType?: 'page' | 'column' | 'textWrapping';
|
|
574
|
+
/** Clear type for text wrapping break */
|
|
575
|
+
clear?: 'none' | 'left' | 'right' | 'all';
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* Symbol character (special font character)
|
|
579
|
+
*/
|
|
580
|
+
interface SymbolContent {
|
|
581
|
+
type: 'symbol';
|
|
582
|
+
/** Font name */
|
|
583
|
+
font: string;
|
|
584
|
+
/** Character code */
|
|
585
|
+
char: string;
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* Footnote or endnote reference
|
|
589
|
+
*/
|
|
590
|
+
interface NoteReferenceContent {
|
|
591
|
+
type: 'footnoteRef' | 'endnoteRef';
|
|
592
|
+
/** Note ID */
|
|
593
|
+
id: number;
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* Field character (begin/separate/end)
|
|
597
|
+
*/
|
|
598
|
+
interface FieldCharContent {
|
|
599
|
+
type: 'fieldChar';
|
|
600
|
+
/** Field character type */
|
|
601
|
+
charType: 'begin' | 'separate' | 'end';
|
|
602
|
+
/** Field is locked */
|
|
603
|
+
fldLock?: boolean;
|
|
604
|
+
/** Field is dirty (needs update) */
|
|
605
|
+
dirty?: boolean;
|
|
606
|
+
}
|
|
607
|
+
/**
|
|
608
|
+
* Field instruction text
|
|
609
|
+
*/
|
|
610
|
+
interface InstrTextContent {
|
|
611
|
+
type: 'instrText';
|
|
612
|
+
/** Field instruction */
|
|
613
|
+
text: string;
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* Soft hyphen
|
|
617
|
+
*/
|
|
618
|
+
interface SoftHyphenContent {
|
|
619
|
+
type: 'softHyphen';
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* Non-breaking hyphen
|
|
623
|
+
*/
|
|
624
|
+
interface NoBreakHyphenContent {
|
|
625
|
+
type: 'noBreakHyphen';
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* Drawing/image reference
|
|
629
|
+
*/
|
|
630
|
+
interface DrawingContent {
|
|
631
|
+
type: 'drawing';
|
|
632
|
+
/** Image data */
|
|
633
|
+
image: Image;
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* Shape reference
|
|
637
|
+
*/
|
|
638
|
+
interface ShapeContent {
|
|
639
|
+
type: 'shape';
|
|
640
|
+
/** Shape data */
|
|
641
|
+
shape: Shape;
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* All possible run content types
|
|
645
|
+
*/
|
|
646
|
+
type RunContent = TextContent | TabContent | BreakContent | SymbolContent | NoteReferenceContent | FieldCharContent | InstrTextContent | SoftHyphenContent | NoBreakHyphenContent | DrawingContent | ShapeContent;
|
|
647
|
+
/**
|
|
648
|
+
* A run is a contiguous region of text with the same formatting
|
|
649
|
+
*/
|
|
650
|
+
interface Run {
|
|
651
|
+
type: 'run';
|
|
652
|
+
/** Text formatting properties */
|
|
653
|
+
formatting?: TextFormatting;
|
|
654
|
+
/** Run-level tracked property changes (w:rPrChange) */
|
|
655
|
+
propertyChanges?: RunPropertyChange[];
|
|
656
|
+
/** Run content (text, tabs, breaks, etc.) */
|
|
657
|
+
content: RunContent[];
|
|
658
|
+
}
|
|
659
|
+
/**
|
|
660
|
+
* Hyperlink (w:hyperlink)
|
|
661
|
+
*/
|
|
662
|
+
interface Hyperlink {
|
|
663
|
+
type: 'hyperlink';
|
|
664
|
+
/** Relationship ID for external link */
|
|
665
|
+
rId?: string;
|
|
666
|
+
/** Resolved URL (from relationships) */
|
|
667
|
+
href?: string;
|
|
668
|
+
/** Internal bookmark anchor */
|
|
669
|
+
anchor?: string;
|
|
670
|
+
/** Tooltip text */
|
|
671
|
+
tooltip?: string;
|
|
672
|
+
/** Target frame */
|
|
673
|
+
target?: string;
|
|
674
|
+
/** Link history tracking */
|
|
675
|
+
history?: boolean;
|
|
676
|
+
/** Document location */
|
|
677
|
+
docLocation?: string;
|
|
678
|
+
/** Child runs */
|
|
679
|
+
children: (Run | BookmarkStart | BookmarkEnd)[];
|
|
680
|
+
}
|
|
681
|
+
/**
|
|
682
|
+
* Bookmark start marker (w:bookmarkStart)
|
|
683
|
+
*/
|
|
684
|
+
interface BookmarkStart {
|
|
685
|
+
type: 'bookmarkStart';
|
|
686
|
+
/** Bookmark ID */
|
|
687
|
+
id: number;
|
|
688
|
+
/** Bookmark name */
|
|
689
|
+
name: string;
|
|
690
|
+
/** Column index for table bookmarks */
|
|
691
|
+
colFirst?: number;
|
|
692
|
+
colLast?: number;
|
|
693
|
+
}
|
|
694
|
+
/**
|
|
695
|
+
* Bookmark end marker (w:bookmarkEnd)
|
|
696
|
+
*/
|
|
697
|
+
interface BookmarkEnd {
|
|
698
|
+
type: 'bookmarkEnd';
|
|
699
|
+
/** Bookmark ID */
|
|
700
|
+
id: number;
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* Known field types
|
|
704
|
+
*/
|
|
705
|
+
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' | 'IF' | 'MERGEFIELD' | 'NEXT' | 'NEXTIF' | 'ASK' | 'SET' | 'QUOTE' | 'INCLUDETEXT' | 'INCLUDEPICTURE' | 'SYMBOL' | 'ADVANCE' | 'EDITTIME' | 'REVNUM' | 'SECTION' | 'SECTIONPAGES' | 'USERADDRESS' | 'USERNAME' | 'USERINITIALS' | 'UNKNOWN';
|
|
706
|
+
/**
|
|
707
|
+
* Simple field (w:fldSimple)
|
|
708
|
+
*/
|
|
709
|
+
interface SimpleField {
|
|
710
|
+
type: 'simpleField';
|
|
711
|
+
/** Field instruction (e.g., "PAGE \\* MERGEFORMAT") */
|
|
712
|
+
instruction: string;
|
|
713
|
+
/** Parsed field type */
|
|
714
|
+
fieldType: FieldType;
|
|
715
|
+
/** Current display value */
|
|
716
|
+
content: (Run | Hyperlink)[];
|
|
717
|
+
/** Field is locked */
|
|
718
|
+
fldLock?: boolean;
|
|
719
|
+
/** Field is dirty */
|
|
720
|
+
dirty?: boolean;
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* Complex field (w:fldChar begin/separate/end with w:instrText)
|
|
724
|
+
*/
|
|
725
|
+
interface ComplexField {
|
|
726
|
+
type: 'complexField';
|
|
727
|
+
/** Field instruction */
|
|
728
|
+
instruction: string;
|
|
729
|
+
/** Parsed field type */
|
|
730
|
+
fieldType: FieldType;
|
|
731
|
+
/** Field code runs */
|
|
732
|
+
fieldCode: Run[];
|
|
733
|
+
/** Display result runs */
|
|
734
|
+
fieldResult: Run[];
|
|
735
|
+
/** Field is locked */
|
|
736
|
+
fldLock?: boolean;
|
|
737
|
+
/** Field is dirty */
|
|
738
|
+
dirty?: boolean;
|
|
739
|
+
}
|
|
740
|
+
/**
|
|
741
|
+
* Image size specification
|
|
742
|
+
*/
|
|
743
|
+
interface ImageSize {
|
|
744
|
+
/** Width in EMUs (English Metric Units) */
|
|
745
|
+
width: number;
|
|
746
|
+
/** Height in EMUs */
|
|
747
|
+
height: number;
|
|
748
|
+
}
|
|
749
|
+
/**
|
|
750
|
+
* Image wrap type for floating images
|
|
751
|
+
*/
|
|
752
|
+
interface ImageWrap {
|
|
753
|
+
type: 'inline' | 'square' | 'tight' | 'through' | 'topAndBottom' | 'behind' | 'inFront';
|
|
754
|
+
/** Wrap text direction */
|
|
755
|
+
wrapText?: 'bothSides' | 'left' | 'right' | 'largest';
|
|
756
|
+
/** Distance from text */
|
|
757
|
+
distT?: number;
|
|
758
|
+
distB?: number;
|
|
759
|
+
distL?: number;
|
|
760
|
+
distR?: number;
|
|
761
|
+
}
|
|
762
|
+
/**
|
|
763
|
+
* Position for floating images
|
|
764
|
+
*/
|
|
765
|
+
interface ImagePosition {
|
|
766
|
+
/** Horizontal positioning */
|
|
767
|
+
horizontal: {
|
|
768
|
+
relativeTo: 'character' | 'column' | 'insideMargin' | 'leftMargin' | 'margin' | 'outsideMargin' | 'page' | 'rightMargin';
|
|
769
|
+
alignment?: 'left' | 'right' | 'center' | 'inside' | 'outside';
|
|
770
|
+
posOffset?: number;
|
|
771
|
+
};
|
|
772
|
+
/** Vertical positioning */
|
|
773
|
+
vertical: {
|
|
774
|
+
relativeTo: 'insideMargin' | 'line' | 'margin' | 'outsideMargin' | 'page' | 'paragraph' | 'topMargin' | 'bottomMargin';
|
|
775
|
+
alignment?: 'top' | 'bottom' | 'center' | 'inside' | 'outside';
|
|
776
|
+
posOffset?: number;
|
|
777
|
+
};
|
|
778
|
+
}
|
|
779
|
+
/**
|
|
780
|
+
* Image transformation
|
|
781
|
+
*/
|
|
782
|
+
interface ImageTransform {
|
|
783
|
+
/** Rotation in degrees */
|
|
784
|
+
rotation?: number;
|
|
785
|
+
/** Flip horizontal */
|
|
786
|
+
flipH?: boolean;
|
|
787
|
+
/** Flip vertical */
|
|
788
|
+
flipV?: boolean;
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
791
|
+
* Image padding/margins
|
|
792
|
+
*/
|
|
793
|
+
interface ImagePadding {
|
|
794
|
+
top?: number;
|
|
795
|
+
bottom?: number;
|
|
796
|
+
left?: number;
|
|
797
|
+
right?: number;
|
|
798
|
+
}
|
|
799
|
+
/**
|
|
800
|
+
* Embedded image (w:drawing)
|
|
801
|
+
*/
|
|
802
|
+
interface Image {
|
|
803
|
+
type: 'image';
|
|
804
|
+
/** Unique ID */
|
|
805
|
+
id?: string;
|
|
806
|
+
/** Relationship ID for the image data */
|
|
807
|
+
rId: string;
|
|
808
|
+
/** Resolved image data (base64 or blob URL) */
|
|
809
|
+
src?: string;
|
|
810
|
+
/** Image MIME type */
|
|
811
|
+
mimeType?: string;
|
|
812
|
+
/** Original filename */
|
|
813
|
+
filename?: string;
|
|
814
|
+
/** Alt text for accessibility */
|
|
815
|
+
alt?: string;
|
|
816
|
+
/** Title/description */
|
|
817
|
+
title?: string;
|
|
818
|
+
/** Image size */
|
|
819
|
+
size: ImageSize;
|
|
820
|
+
/** Original size before any transforms */
|
|
821
|
+
originalSize?: ImageSize;
|
|
822
|
+
/** Wrap settings */
|
|
823
|
+
wrap: ImageWrap;
|
|
824
|
+
/** Position for floating images */
|
|
825
|
+
position?: ImagePosition;
|
|
826
|
+
/** Image transformations */
|
|
827
|
+
transform?: ImageTransform;
|
|
828
|
+
/** Padding around image */
|
|
829
|
+
padding?: ImagePadding;
|
|
830
|
+
/** Whether this is a decorative image */
|
|
831
|
+
decorative?: boolean;
|
|
832
|
+
/** Hyperlink URL for clickable image */
|
|
833
|
+
hlinkHref?: string;
|
|
834
|
+
/** Image outline/border */
|
|
835
|
+
outline?: ShapeOutline;
|
|
836
|
+
/** Image effects */
|
|
837
|
+
effects?: {
|
|
838
|
+
brightness?: number;
|
|
839
|
+
contrast?: number;
|
|
840
|
+
saturation?: number;
|
|
841
|
+
};
|
|
842
|
+
}
|
|
843
|
+
/**
|
|
844
|
+
* Shape types
|
|
845
|
+
*/
|
|
846
|
+
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';
|
|
847
|
+
/**
|
|
848
|
+
* Shape fill type
|
|
849
|
+
*/
|
|
850
|
+
interface ShapeFill {
|
|
851
|
+
type: 'none' | 'solid' | 'gradient' | 'pattern' | 'picture';
|
|
852
|
+
/** Solid fill color */
|
|
853
|
+
color?: ColorValue;
|
|
854
|
+
/** Gradient stops for gradient fill */
|
|
855
|
+
gradient?: {
|
|
856
|
+
type: 'linear' | 'radial' | 'rectangular' | 'path';
|
|
857
|
+
angle?: number;
|
|
858
|
+
stops: Array<{
|
|
859
|
+
position: number;
|
|
860
|
+
color: ColorValue;
|
|
861
|
+
}>;
|
|
862
|
+
};
|
|
863
|
+
}
|
|
864
|
+
/**
|
|
865
|
+
* Shape outline/stroke
|
|
866
|
+
*/
|
|
867
|
+
interface ShapeOutline {
|
|
868
|
+
/** Line width in EMUs */
|
|
869
|
+
width?: number;
|
|
870
|
+
/** Line color */
|
|
871
|
+
color?: ColorValue;
|
|
872
|
+
/** Line style */
|
|
873
|
+
style?: 'solid' | 'dot' | 'dash' | 'lgDash' | 'dashDot' | 'lgDashDot' | 'lgDashDotDot' | 'sysDot' | 'sysDash' | 'sysDashDot' | 'sysDashDotDot';
|
|
874
|
+
/** Line cap */
|
|
875
|
+
cap?: 'flat' | 'round' | 'square';
|
|
876
|
+
/** Line join */
|
|
877
|
+
join?: 'bevel' | 'miter' | 'round';
|
|
878
|
+
/** Head arrow */
|
|
879
|
+
headEnd?: {
|
|
880
|
+
type: 'none' | 'triangle' | 'stealth' | 'diamond' | 'oval' | 'arrow';
|
|
881
|
+
width?: 'sm' | 'med' | 'lg';
|
|
882
|
+
length?: 'sm' | 'med' | 'lg';
|
|
883
|
+
};
|
|
884
|
+
/** Tail arrow */
|
|
885
|
+
tailEnd?: {
|
|
886
|
+
type: 'none' | 'triangle' | 'stealth' | 'diamond' | 'oval' | 'arrow';
|
|
887
|
+
width?: 'sm' | 'med' | 'lg';
|
|
888
|
+
length?: 'sm' | 'med' | 'lg';
|
|
889
|
+
};
|
|
890
|
+
}
|
|
891
|
+
/**
|
|
892
|
+
* Text body inside a shape
|
|
893
|
+
*/
|
|
894
|
+
interface ShapeTextBody {
|
|
895
|
+
/** Text direction */
|
|
896
|
+
vertical?: boolean;
|
|
897
|
+
/** Rotation */
|
|
898
|
+
rotation?: number;
|
|
899
|
+
/** Anchor/vertical alignment */
|
|
900
|
+
anchor?: 'top' | 'middle' | 'bottom' | 'distributed' | 'justified';
|
|
901
|
+
/** Anchor center */
|
|
902
|
+
anchorCenter?: boolean;
|
|
903
|
+
/** Auto fit */
|
|
904
|
+
autoFit?: 'none' | 'normal' | 'shape';
|
|
905
|
+
/** Text margins */
|
|
906
|
+
margins?: {
|
|
907
|
+
top?: number;
|
|
908
|
+
bottom?: number;
|
|
909
|
+
left?: number;
|
|
910
|
+
right?: number;
|
|
911
|
+
};
|
|
912
|
+
/** Paragraphs inside the shape */
|
|
913
|
+
content: Paragraph[];
|
|
914
|
+
}
|
|
915
|
+
/**
|
|
916
|
+
* Shape/drawing object (wps:wsp)
|
|
917
|
+
*/
|
|
918
|
+
interface Shape {
|
|
919
|
+
type: 'shape';
|
|
920
|
+
/** Shape type preset */
|
|
921
|
+
shapeType: ShapeType;
|
|
922
|
+
/** Unique ID */
|
|
923
|
+
id?: string;
|
|
924
|
+
/** Name */
|
|
925
|
+
name?: string;
|
|
926
|
+
/** Size in EMUs */
|
|
927
|
+
size: ImageSize;
|
|
928
|
+
/** Position for floating shapes */
|
|
929
|
+
position?: ImagePosition;
|
|
930
|
+
/** Wrap settings */
|
|
931
|
+
wrap?: ImageWrap;
|
|
932
|
+
/** Fill */
|
|
933
|
+
fill?: ShapeFill;
|
|
934
|
+
/** Outline/stroke */
|
|
935
|
+
outline?: ShapeOutline;
|
|
936
|
+
/** Transform */
|
|
937
|
+
transform?: ImageTransform;
|
|
938
|
+
/** Text content inside the shape */
|
|
939
|
+
textBody?: ShapeTextBody;
|
|
940
|
+
/** Custom geometry points */
|
|
941
|
+
customGeometry?: string;
|
|
942
|
+
}
|
|
943
|
+
/**
|
|
944
|
+
* Table cell
|
|
945
|
+
*/
|
|
946
|
+
interface TableCell {
|
|
947
|
+
type: 'tableCell';
|
|
948
|
+
/** Cell formatting */
|
|
949
|
+
formatting?: TableCellFormatting;
|
|
950
|
+
/** Cell-level tracked property changes (w:tcPrChange) */
|
|
951
|
+
propertyChanges?: TableCellPropertyChange[];
|
|
952
|
+
/** Tracked structural changes (cell insert/delete/merge) */
|
|
953
|
+
structuralChange?: TableStructuralChangeInfo;
|
|
954
|
+
/** Cell content (paragraphs, tables, etc.) */
|
|
955
|
+
content: (Paragraph | Table)[];
|
|
956
|
+
}
|
|
957
|
+
/**
|
|
958
|
+
* Table row
|
|
959
|
+
*/
|
|
960
|
+
interface TableRow {
|
|
961
|
+
type: 'tableRow';
|
|
962
|
+
/** Row formatting */
|
|
963
|
+
formatting?: TableRowFormatting;
|
|
964
|
+
/** Row-level tracked property changes (w:trPrChange) */
|
|
965
|
+
propertyChanges?: TableRowPropertyChange[];
|
|
966
|
+
/** Tracked structural changes (row insert/delete) */
|
|
967
|
+
structuralChange?: TableStructuralChangeInfo;
|
|
968
|
+
/** Cells in this row */
|
|
969
|
+
cells: TableCell[];
|
|
970
|
+
}
|
|
971
|
+
/**
|
|
972
|
+
* Table (w:tbl)
|
|
973
|
+
*/
|
|
974
|
+
interface Table {
|
|
975
|
+
type: 'table';
|
|
976
|
+
/** Table formatting */
|
|
977
|
+
formatting?: TableFormatting;
|
|
978
|
+
/** Table-level tracked property changes (w:tblPrChange) */
|
|
979
|
+
propertyChanges?: TablePropertyChange[];
|
|
980
|
+
/** Column widths in twips */
|
|
981
|
+
columnWidths?: number[];
|
|
982
|
+
/** Table rows */
|
|
983
|
+
rows: TableRow[];
|
|
984
|
+
}
|
|
985
|
+
/**
|
|
986
|
+
* A comment (w:comment) from comments.xml
|
|
987
|
+
*/
|
|
988
|
+
interface Comment {
|
|
989
|
+
/** Comment ID (matches commentRangeStart/End) */
|
|
990
|
+
id: number;
|
|
991
|
+
/** Author name */
|
|
992
|
+
author: string;
|
|
993
|
+
/** Author initials */
|
|
994
|
+
initials?: string;
|
|
995
|
+
/** Date */
|
|
996
|
+
date?: string;
|
|
997
|
+
/** Comment content (paragraphs) */
|
|
998
|
+
content: Paragraph[];
|
|
999
|
+
/** Parent comment ID (for replies) */
|
|
1000
|
+
parentId?: number;
|
|
1001
|
+
/** Whether the comment is resolved/done */
|
|
1002
|
+
done?: boolean;
|
|
1003
|
+
}
|
|
1004
|
+
/**
|
|
1005
|
+
* Comment range start marker in paragraph content
|
|
1006
|
+
*/
|
|
1007
|
+
interface CommentRangeStart {
|
|
1008
|
+
type: 'commentRangeStart';
|
|
1009
|
+
id: number;
|
|
1010
|
+
}
|
|
1011
|
+
/**
|
|
1012
|
+
* Comment range end marker in paragraph content
|
|
1013
|
+
*/
|
|
1014
|
+
interface CommentRangeEnd {
|
|
1015
|
+
type: 'commentRangeEnd';
|
|
1016
|
+
id: number;
|
|
1017
|
+
}
|
|
1018
|
+
/**
|
|
1019
|
+
* Math equation content (m:oMath or m:oMathPara)
|
|
1020
|
+
*/
|
|
1021
|
+
interface MathEquation {
|
|
1022
|
+
type: 'mathEquation';
|
|
1023
|
+
/** Whether this is a block (oMathPara) or inline (oMath) equation */
|
|
1024
|
+
display: 'inline' | 'block';
|
|
1025
|
+
/** Raw OMML XML for round-trip preservation */
|
|
1026
|
+
ommlXml: string;
|
|
1027
|
+
/** Plain text representation for accessibility/fallback */
|
|
1028
|
+
plainText?: string;
|
|
1029
|
+
}
|
|
1030
|
+
/**
|
|
1031
|
+
* Tracked change metadata (w:ins, w:del attributes)
|
|
1032
|
+
*/
|
|
1033
|
+
interface TrackedChangeInfo {
|
|
1034
|
+
/** Revision ID */
|
|
1035
|
+
id: number;
|
|
1036
|
+
/** Author who made the change */
|
|
1037
|
+
author: string;
|
|
1038
|
+
/** Date of the change */
|
|
1039
|
+
date?: string;
|
|
1040
|
+
}
|
|
1041
|
+
/**
|
|
1042
|
+
* Generic tracked property-change wrapper metadata (w:*PrChange)
|
|
1043
|
+
*/
|
|
1044
|
+
interface PropertyChangeInfo extends TrackedChangeInfo {
|
|
1045
|
+
/** Optional revision session ID */
|
|
1046
|
+
rsid?: string;
|
|
1047
|
+
}
|
|
1048
|
+
/**
|
|
1049
|
+
* Insertion wrapper (w:ins) — runs inserted by tracked changes
|
|
1050
|
+
*/
|
|
1051
|
+
interface Insertion {
|
|
1052
|
+
type: 'insertion';
|
|
1053
|
+
/** Tracked change metadata */
|
|
1054
|
+
info: TrackedChangeInfo;
|
|
1055
|
+
/** Inserted content */
|
|
1056
|
+
content: (Run | Hyperlink)[];
|
|
1057
|
+
}
|
|
1058
|
+
/**
|
|
1059
|
+
* Deletion wrapper (w:del) — runs deleted by tracked changes
|
|
1060
|
+
*/
|
|
1061
|
+
interface Deletion {
|
|
1062
|
+
type: 'deletion';
|
|
1063
|
+
/** Tracked change metadata */
|
|
1064
|
+
info: TrackedChangeInfo;
|
|
1065
|
+
/** Deleted content */
|
|
1066
|
+
content: (Run | Hyperlink)[];
|
|
1067
|
+
}
|
|
1068
|
+
/**
|
|
1069
|
+
* Move-from wrapper (w:moveFrom) — content moved away from this position
|
|
1070
|
+
*/
|
|
1071
|
+
interface MoveFrom {
|
|
1072
|
+
type: 'moveFrom';
|
|
1073
|
+
/** Tracked change metadata */
|
|
1074
|
+
info: TrackedChangeInfo;
|
|
1075
|
+
/** Moved content */
|
|
1076
|
+
content: (Run | Hyperlink)[];
|
|
1077
|
+
}
|
|
1078
|
+
/**
|
|
1079
|
+
* Move-to wrapper (w:moveTo) — content moved into this position
|
|
1080
|
+
*/
|
|
1081
|
+
interface MoveTo {
|
|
1082
|
+
type: 'moveTo';
|
|
1083
|
+
/** Tracked change metadata */
|
|
1084
|
+
info: TrackedChangeInfo;
|
|
1085
|
+
/** Moved content */
|
|
1086
|
+
content: (Run | Hyperlink)[];
|
|
1087
|
+
}
|
|
1088
|
+
/**
|
|
1089
|
+
* Move-from range start marker (w:moveFromRangeStart) — ECMA-376 §17.13.5.22
|
|
1090
|
+
* Pairs with moveFromRangeEnd to delimit the source of a move in the document.
|
|
1091
|
+
*/
|
|
1092
|
+
interface MoveFromRangeStart {
|
|
1093
|
+
type: 'moveFromRangeStart';
|
|
1094
|
+
id: number;
|
|
1095
|
+
name: string;
|
|
1096
|
+
}
|
|
1097
|
+
/**
|
|
1098
|
+
* Move-from range end marker (w:moveFromRangeEnd)
|
|
1099
|
+
*/
|
|
1100
|
+
interface MoveFromRangeEnd {
|
|
1101
|
+
type: 'moveFromRangeEnd';
|
|
1102
|
+
id: number;
|
|
1103
|
+
}
|
|
1104
|
+
/**
|
|
1105
|
+
* Move-to range start marker (w:moveToRangeStart) — ECMA-376 §17.13.5.24
|
|
1106
|
+
* Pairs with moveToRangeEnd to delimit the destination of a move.
|
|
1107
|
+
*/
|
|
1108
|
+
interface MoveToRangeStart {
|
|
1109
|
+
type: 'moveToRangeStart';
|
|
1110
|
+
id: number;
|
|
1111
|
+
name: string;
|
|
1112
|
+
}
|
|
1113
|
+
/**
|
|
1114
|
+
* Move-to range end marker (w:moveToRangeEnd)
|
|
1115
|
+
*/
|
|
1116
|
+
interface MoveToRangeEnd {
|
|
1117
|
+
type: 'moveToRangeEnd';
|
|
1118
|
+
id: number;
|
|
1119
|
+
}
|
|
1120
|
+
/**
|
|
1121
|
+
* Run property change (w:rPrChange)
|
|
1122
|
+
*/
|
|
1123
|
+
interface RunPropertyChange {
|
|
1124
|
+
type: 'runPropertyChange';
|
|
1125
|
+
/** Tracked change metadata */
|
|
1126
|
+
info: PropertyChangeInfo;
|
|
1127
|
+
/** Run properties before the tracked change */
|
|
1128
|
+
previousFormatting?: TextFormatting;
|
|
1129
|
+
/** Run properties after the tracked change (editor model convenience) */
|
|
1130
|
+
currentFormatting?: TextFormatting;
|
|
1131
|
+
}
|
|
1132
|
+
/**
|
|
1133
|
+
* Paragraph property change (w:pPrChange)
|
|
1134
|
+
*/
|
|
1135
|
+
interface ParagraphPropertyChange {
|
|
1136
|
+
type: 'paragraphPropertyChange';
|
|
1137
|
+
/** Tracked change metadata */
|
|
1138
|
+
info: PropertyChangeInfo;
|
|
1139
|
+
/** Paragraph properties before the tracked change */
|
|
1140
|
+
previousFormatting?: ParagraphFormatting;
|
|
1141
|
+
/** Paragraph properties after the tracked change (editor model convenience) */
|
|
1142
|
+
currentFormatting?: ParagraphFormatting;
|
|
1143
|
+
}
|
|
1144
|
+
/**
|
|
1145
|
+
* Table property change (w:tblPrChange)
|
|
1146
|
+
*/
|
|
1147
|
+
interface TablePropertyChange {
|
|
1148
|
+
type: 'tablePropertyChange';
|
|
1149
|
+
/** Tracked change metadata */
|
|
1150
|
+
info: PropertyChangeInfo;
|
|
1151
|
+
/** Table properties before the tracked change */
|
|
1152
|
+
previousFormatting?: TableFormatting;
|
|
1153
|
+
/** Table properties after the tracked change (editor model convenience) */
|
|
1154
|
+
currentFormatting?: TableFormatting;
|
|
1155
|
+
}
|
|
1156
|
+
/**
|
|
1157
|
+
* Table row property change (w:trPrChange)
|
|
1158
|
+
*/
|
|
1159
|
+
interface TableRowPropertyChange {
|
|
1160
|
+
type: 'tableRowPropertyChange';
|
|
1161
|
+
/** Tracked change metadata */
|
|
1162
|
+
info: PropertyChangeInfo;
|
|
1163
|
+
/** Row properties before the tracked change */
|
|
1164
|
+
previousFormatting?: TableRowFormatting;
|
|
1165
|
+
/** Row properties after the tracked change (editor model convenience) */
|
|
1166
|
+
currentFormatting?: TableRowFormatting;
|
|
1167
|
+
}
|
|
1168
|
+
/**
|
|
1169
|
+
* Table cell property change (w:tcPrChange)
|
|
1170
|
+
*/
|
|
1171
|
+
interface TableCellPropertyChange {
|
|
1172
|
+
type: 'tableCellPropertyChange';
|
|
1173
|
+
/** Tracked change metadata */
|
|
1174
|
+
info: PropertyChangeInfo;
|
|
1175
|
+
/** Cell properties before the tracked change */
|
|
1176
|
+
previousFormatting?: TableCellFormatting;
|
|
1177
|
+
/** Cell properties after the tracked change (editor model convenience) */
|
|
1178
|
+
currentFormatting?: TableCellFormatting;
|
|
1179
|
+
}
|
|
1180
|
+
/**
|
|
1181
|
+
* Table structural tracked change metadata (row/cell insert/delete/merge)
|
|
1182
|
+
*/
|
|
1183
|
+
interface TableStructuralChangeInfo {
|
|
1184
|
+
type: 'tableRowInsertion' | 'tableRowDeletion' | 'tableCellInsertion' | 'tableCellDeletion' | 'tableCellMerge';
|
|
1185
|
+
/** Tracked change metadata */
|
|
1186
|
+
info: TrackedChangeInfo;
|
|
1187
|
+
}
|
|
1188
|
+
/**
|
|
1189
|
+
* SDT type (content control type)
|
|
1190
|
+
*/
|
|
1191
|
+
type SdtType = 'richText' | 'plainText' | 'date' | 'dropdown' | 'comboBox' | 'checkbox' | 'picture' | 'buildingBlockGallery' | 'group' | 'unknown';
|
|
1192
|
+
/**
|
|
1193
|
+
* SDT properties (w:sdtPr)
|
|
1194
|
+
*/
|
|
1195
|
+
interface SdtProperties {
|
|
1196
|
+
/** SDT type */
|
|
1197
|
+
sdtType: SdtType;
|
|
1198
|
+
/** Alias (friendly name) */
|
|
1199
|
+
alias?: string;
|
|
1200
|
+
/** Tag (developer identifier) */
|
|
1201
|
+
tag?: string;
|
|
1202
|
+
/** Lock content editing */
|
|
1203
|
+
lock?: 'sdtLocked' | 'contentLocked' | 'sdtContentLocked' | 'unlocked';
|
|
1204
|
+
/** Placeholder text */
|
|
1205
|
+
placeholder?: string;
|
|
1206
|
+
/** Whether showing placeholder */
|
|
1207
|
+
showingPlaceholder?: boolean;
|
|
1208
|
+
/** Date format for date controls */
|
|
1209
|
+
dateFormat?: string;
|
|
1210
|
+
/** Dropdown/combobox list items */
|
|
1211
|
+
listItems?: {
|
|
1212
|
+
displayText: string;
|
|
1213
|
+
value: string;
|
|
1214
|
+
}[];
|
|
1215
|
+
/** Checkbox checked state */
|
|
1216
|
+
checked?: boolean;
|
|
1217
|
+
}
|
|
1218
|
+
/**
|
|
1219
|
+
* Inline SDT (content control within a paragraph)
|
|
1220
|
+
*/
|
|
1221
|
+
interface InlineSdt {
|
|
1222
|
+
type: 'inlineSdt';
|
|
1223
|
+
/** SDT properties */
|
|
1224
|
+
properties: SdtProperties;
|
|
1225
|
+
/** Content runs inside the control */
|
|
1226
|
+
content: (Run | Hyperlink)[];
|
|
1227
|
+
}
|
|
1228
|
+
/**
|
|
1229
|
+
* Block-level SDT (content control wrapping paragraphs/tables)
|
|
1230
|
+
*/
|
|
1231
|
+
interface BlockSdt {
|
|
1232
|
+
type: 'blockSdt';
|
|
1233
|
+
/** SDT properties */
|
|
1234
|
+
properties: SdtProperties;
|
|
1235
|
+
/** Block content inside the control */
|
|
1236
|
+
content: (Paragraph | Table)[];
|
|
1237
|
+
}
|
|
1238
|
+
/**
|
|
1239
|
+
* Paragraph content types
|
|
1240
|
+
*/
|
|
1241
|
+
type ParagraphContent = Run | Hyperlink | BookmarkStart | BookmarkEnd | SimpleField | ComplexField | InlineSdt | CommentRangeStart | CommentRangeEnd | Insertion | Deletion | MoveFrom | MoveTo | MoveFromRangeStart | MoveFromRangeEnd | MoveToRangeStart | MoveToRangeEnd | MathEquation;
|
|
1242
|
+
/**
|
|
1243
|
+
* Paragraph (w:p)
|
|
1244
|
+
*/
|
|
1245
|
+
interface Paragraph {
|
|
1246
|
+
type: 'paragraph';
|
|
1247
|
+
/** Unique paragraph ID */
|
|
1248
|
+
paraId?: string;
|
|
1249
|
+
/** Text ID */
|
|
1250
|
+
textId?: string;
|
|
1251
|
+
/** Paragraph formatting */
|
|
1252
|
+
formatting?: ParagraphFormatting;
|
|
1253
|
+
/** Paragraph-level tracked property changes (w:pPrChange) */
|
|
1254
|
+
propertyChanges?: ParagraphPropertyChange[];
|
|
1255
|
+
/** Paragraph content */
|
|
1256
|
+
content: ParagraphContent[];
|
|
1257
|
+
/** Computed list rendering (if this is a list item) */
|
|
1258
|
+
listRendering?: ListRendering;
|
|
1259
|
+
/** Section properties (if this paragraph ends a section) */
|
|
1260
|
+
sectionProperties?: SectionProperties;
|
|
1261
|
+
}
|
|
1262
|
+
/**
|
|
1263
|
+
* Header/footer type
|
|
1264
|
+
*/
|
|
1265
|
+
type HeaderFooterType = 'default' | 'first' | 'even';
|
|
1266
|
+
/**
|
|
1267
|
+
* Header or footer reference
|
|
1268
|
+
*/
|
|
1269
|
+
interface HeaderReference {
|
|
1270
|
+
type: HeaderFooterType;
|
|
1271
|
+
rId: string;
|
|
1272
|
+
}
|
|
1273
|
+
interface FooterReference {
|
|
1274
|
+
type: HeaderFooterType;
|
|
1275
|
+
rId: string;
|
|
1276
|
+
}
|
|
1277
|
+
/**
|
|
1278
|
+
* Header or footer content
|
|
1279
|
+
*/
|
|
1280
|
+
interface HeaderFooter {
|
|
1281
|
+
type: 'header' | 'footer';
|
|
1282
|
+
/** Header/footer type */
|
|
1283
|
+
hdrFtrType: HeaderFooterType;
|
|
1284
|
+
/** Content (paragraphs, tables, etc.) */
|
|
1285
|
+
content: (Paragraph | Table)[];
|
|
1286
|
+
}
|
|
1287
|
+
/**
|
|
1288
|
+
* Footnote position
|
|
1289
|
+
*/
|
|
1290
|
+
type FootnotePosition = 'pageBottom' | 'beneathText' | 'sectEnd' | 'docEnd';
|
|
1291
|
+
/**
|
|
1292
|
+
* Endnote position
|
|
1293
|
+
*/
|
|
1294
|
+
type EndnotePosition = 'sectEnd' | 'docEnd';
|
|
1295
|
+
/**
|
|
1296
|
+
* Number restart type
|
|
1297
|
+
*/
|
|
1298
|
+
type NoteNumberRestart = 'continuous' | 'eachSect' | 'eachPage';
|
|
1299
|
+
/**
|
|
1300
|
+
* Footnote properties
|
|
1301
|
+
*/
|
|
1302
|
+
interface FootnoteProperties {
|
|
1303
|
+
position?: FootnotePosition;
|
|
1304
|
+
numFmt?: NumberFormat;
|
|
1305
|
+
numStart?: number;
|
|
1306
|
+
numRestart?: NoteNumberRestart;
|
|
1307
|
+
}
|
|
1308
|
+
/**
|
|
1309
|
+
* Endnote properties
|
|
1310
|
+
*/
|
|
1311
|
+
interface EndnoteProperties {
|
|
1312
|
+
position?: EndnotePosition;
|
|
1313
|
+
numFmt?: NumberFormat;
|
|
1314
|
+
numStart?: number;
|
|
1315
|
+
numRestart?: NoteNumberRestart;
|
|
1316
|
+
}
|
|
1317
|
+
/**
|
|
1318
|
+
* Footnote (w:footnote)
|
|
1319
|
+
*/
|
|
1320
|
+
interface Footnote {
|
|
1321
|
+
type: 'footnote';
|
|
1322
|
+
/** Footnote ID */
|
|
1323
|
+
id: number;
|
|
1324
|
+
/** Special footnote type */
|
|
1325
|
+
noteType?: 'normal' | 'separator' | 'continuationSeparator' | 'continuationNotice';
|
|
1326
|
+
/** Content */
|
|
1327
|
+
content: Paragraph[];
|
|
1328
|
+
}
|
|
1329
|
+
/**
|
|
1330
|
+
* Endnote (w:endnote)
|
|
1331
|
+
*/
|
|
1332
|
+
interface Endnote {
|
|
1333
|
+
type: 'endnote';
|
|
1334
|
+
/** Endnote ID */
|
|
1335
|
+
id: number;
|
|
1336
|
+
/** Special endnote type */
|
|
1337
|
+
noteType?: 'normal' | 'separator' | 'continuationSeparator' | 'continuationNotice';
|
|
1338
|
+
/** Content */
|
|
1339
|
+
content: Paragraph[];
|
|
1340
|
+
}
|
|
1341
|
+
/**
|
|
1342
|
+
* Page orientation
|
|
1343
|
+
*/
|
|
1344
|
+
type PageOrientation = 'portrait' | 'landscape';
|
|
1345
|
+
/**
|
|
1346
|
+
* Section start type
|
|
1347
|
+
*/
|
|
1348
|
+
type SectionStart = 'continuous' | 'nextPage' | 'oddPage' | 'evenPage' | 'nextColumn';
|
|
1349
|
+
/**
|
|
1350
|
+
* Vertical alignment
|
|
1351
|
+
*/
|
|
1352
|
+
type VerticalAlign = 'top' | 'center' | 'both' | 'bottom';
|
|
1353
|
+
/**
|
|
1354
|
+
* Line number restart type
|
|
1355
|
+
*/
|
|
1356
|
+
type LineNumberRestart = 'continuous' | 'newPage' | 'newSection';
|
|
1357
|
+
/**
|
|
1358
|
+
* Column definition
|
|
1359
|
+
*/
|
|
1360
|
+
interface Column {
|
|
1361
|
+
/** Column width in twips */
|
|
1362
|
+
width?: number;
|
|
1363
|
+
/** Space after column in twips */
|
|
1364
|
+
space?: number;
|
|
1365
|
+
}
|
|
1366
|
+
/**
|
|
1367
|
+
* Section properties (w:sectPr)
|
|
1368
|
+
*/
|
|
1369
|
+
interface SectionProperties {
|
|
1370
|
+
/** Page width in twips */
|
|
1371
|
+
pageWidth?: number;
|
|
1372
|
+
/** Page height in twips */
|
|
1373
|
+
pageHeight?: number;
|
|
1374
|
+
/** Page orientation */
|
|
1375
|
+
orientation?: PageOrientation;
|
|
1376
|
+
/** Top margin in twips */
|
|
1377
|
+
marginTop?: number;
|
|
1378
|
+
/** Bottom margin in twips */
|
|
1379
|
+
marginBottom?: number;
|
|
1380
|
+
/** Left margin in twips */
|
|
1381
|
+
marginLeft?: number;
|
|
1382
|
+
/** Right margin in twips */
|
|
1383
|
+
marginRight?: number;
|
|
1384
|
+
/** Header distance from top in twips */
|
|
1385
|
+
headerDistance?: number;
|
|
1386
|
+
/** Footer distance from bottom in twips */
|
|
1387
|
+
footerDistance?: number;
|
|
1388
|
+
/** Gutter margin in twips */
|
|
1389
|
+
gutter?: number;
|
|
1390
|
+
/** Number of columns */
|
|
1391
|
+
columnCount?: number;
|
|
1392
|
+
/** Space between columns in twips */
|
|
1393
|
+
columnSpace?: number;
|
|
1394
|
+
/** Equal width columns */
|
|
1395
|
+
equalWidth?: boolean;
|
|
1396
|
+
/** Separator line between columns */
|
|
1397
|
+
separator?: boolean;
|
|
1398
|
+
/** Individual column definitions */
|
|
1399
|
+
columns?: Column[];
|
|
1400
|
+
/** Section start type */
|
|
1401
|
+
sectionStart?: SectionStart;
|
|
1402
|
+
/** Vertical alignment of text */
|
|
1403
|
+
verticalAlign?: VerticalAlign;
|
|
1404
|
+
/** Right-to-left section */
|
|
1405
|
+
bidi?: boolean;
|
|
1406
|
+
/** Header references */
|
|
1407
|
+
headerReferences?: HeaderReference[];
|
|
1408
|
+
/** Footer references */
|
|
1409
|
+
footerReferences?: FooterReference[];
|
|
1410
|
+
/** Different first page header/footer */
|
|
1411
|
+
titlePg?: boolean;
|
|
1412
|
+
/** Different odd/even page headers/footers */
|
|
1413
|
+
evenAndOddHeaders?: boolean;
|
|
1414
|
+
/** Line numbering settings */
|
|
1415
|
+
lineNumbers?: {
|
|
1416
|
+
start?: number;
|
|
1417
|
+
countBy?: number;
|
|
1418
|
+
distance?: number;
|
|
1419
|
+
restart?: LineNumberRestart;
|
|
1420
|
+
};
|
|
1421
|
+
/** Page borders */
|
|
1422
|
+
pageBorders?: {
|
|
1423
|
+
top?: BorderSpec;
|
|
1424
|
+
bottom?: BorderSpec;
|
|
1425
|
+
left?: BorderSpec;
|
|
1426
|
+
right?: BorderSpec;
|
|
1427
|
+
/** Display setting */
|
|
1428
|
+
display?: 'allPages' | 'firstPage' | 'notFirstPage';
|
|
1429
|
+
/** Offset from */
|
|
1430
|
+
offsetFrom?: 'page' | 'text';
|
|
1431
|
+
/** Z-order */
|
|
1432
|
+
zOrder?: 'front' | 'back';
|
|
1433
|
+
};
|
|
1434
|
+
/** Page background */
|
|
1435
|
+
background?: {
|
|
1436
|
+
color?: ColorValue;
|
|
1437
|
+
themeColor?: ThemeColorSlot;
|
|
1438
|
+
themeTint?: string;
|
|
1439
|
+
themeShade?: string;
|
|
1440
|
+
};
|
|
1441
|
+
/** Footnote properties for this section */
|
|
1442
|
+
footnotePr?: FootnoteProperties;
|
|
1443
|
+
/** Endnote properties for this section */
|
|
1444
|
+
endnotePr?: EndnoteProperties;
|
|
1445
|
+
/** Document grid */
|
|
1446
|
+
docGrid?: {
|
|
1447
|
+
type?: 'default' | 'lines' | 'linesAndChars' | 'snapToChars';
|
|
1448
|
+
linePitch?: number;
|
|
1449
|
+
charSpace?: number;
|
|
1450
|
+
};
|
|
1451
|
+
/** First page paper source */
|
|
1452
|
+
paperSrcFirst?: number;
|
|
1453
|
+
/** Other pages paper source */
|
|
1454
|
+
paperSrcOther?: number;
|
|
1455
|
+
}
|
|
1456
|
+
/**
|
|
1457
|
+
* Block-level content types
|
|
1458
|
+
*/
|
|
1459
|
+
type BlockContent = Paragraph | Table | BlockSdt;
|
|
1460
|
+
/**
|
|
1461
|
+
* Section (implicit or explicit based on sectPr)
|
|
1462
|
+
*/
|
|
1463
|
+
interface Section {
|
|
1464
|
+
/** Section properties */
|
|
1465
|
+
properties: SectionProperties;
|
|
1466
|
+
/** Content in this section */
|
|
1467
|
+
content: BlockContent[];
|
|
1468
|
+
/** Headers for this section */
|
|
1469
|
+
headers?: Map<HeaderFooterType, HeaderFooter>;
|
|
1470
|
+
/** Footers for this section */
|
|
1471
|
+
footers?: Map<HeaderFooterType, HeaderFooter>;
|
|
1472
|
+
}
|
|
1473
|
+
/**
|
|
1474
|
+
* Document body (w:body)
|
|
1475
|
+
*/
|
|
1476
|
+
interface DocumentBody {
|
|
1477
|
+
/** All content (paragraphs, tables) */
|
|
1478
|
+
content: BlockContent[];
|
|
1479
|
+
/** Sections (derived from sectPr in paragraphs and final sectPr) */
|
|
1480
|
+
sections?: Section[];
|
|
1481
|
+
/** Final section properties (from body's sectPr) */
|
|
1482
|
+
finalSectionProperties?: SectionProperties;
|
|
1483
|
+
/** Comments from comments.xml */
|
|
1484
|
+
comments?: Comment[];
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1487
|
+
/**
|
|
1488
|
+
* Styles, Theme, Font Table, Relationships & Media Types
|
|
1489
|
+
*
|
|
1490
|
+
* Types for document-level definitions that don't form the content tree.
|
|
1491
|
+
*/
|
|
1492
|
+
|
|
1493
|
+
/**
|
|
1494
|
+
* Style type
|
|
1495
|
+
*/
|
|
1496
|
+
type StyleType = 'paragraph' | 'character' | 'numbering' | 'table';
|
|
1497
|
+
/**
|
|
1498
|
+
* Style definition
|
|
1499
|
+
*/
|
|
1500
|
+
interface Style {
|
|
1501
|
+
/** Style ID */
|
|
1502
|
+
styleId: string;
|
|
1503
|
+
/** Style type */
|
|
1504
|
+
type: StyleType;
|
|
1505
|
+
/** Display name */
|
|
1506
|
+
name?: string;
|
|
1507
|
+
/** Based on style ID */
|
|
1508
|
+
basedOn?: string;
|
|
1509
|
+
/** Next style after Enter (for paragraph styles) */
|
|
1510
|
+
next?: string;
|
|
1511
|
+
/** Linked style (paragraph/character pair) */
|
|
1512
|
+
link?: string;
|
|
1513
|
+
/** UI sort priority */
|
|
1514
|
+
uiPriority?: number;
|
|
1515
|
+
/** Hidden from UI */
|
|
1516
|
+
hidden?: boolean;
|
|
1517
|
+
/** Semi-hidden from UI */
|
|
1518
|
+
semiHidden?: boolean;
|
|
1519
|
+
/** Unhide when used */
|
|
1520
|
+
unhideWhenUsed?: boolean;
|
|
1521
|
+
/** Quick format in gallery */
|
|
1522
|
+
qFormat?: boolean;
|
|
1523
|
+
/** Is default style */
|
|
1524
|
+
default?: boolean;
|
|
1525
|
+
/** Personal style (custom) */
|
|
1526
|
+
personal?: boolean;
|
|
1527
|
+
/** Paragraph properties (for paragraph/table styles) */
|
|
1528
|
+
pPr?: ParagraphFormatting;
|
|
1529
|
+
/** Run properties */
|
|
1530
|
+
rPr?: TextFormatting;
|
|
1531
|
+
/** Table properties (for table styles) */
|
|
1532
|
+
tblPr?: TableFormatting;
|
|
1533
|
+
/** Table row properties */
|
|
1534
|
+
trPr?: TableRowFormatting;
|
|
1535
|
+
/** Table cell properties */
|
|
1536
|
+
tcPr?: TableCellFormatting;
|
|
1537
|
+
/** Conditional table style parts */
|
|
1538
|
+
tblStylePr?: Array<{
|
|
1539
|
+
type: 'band1Horz' | 'band1Vert' | 'band2Horz' | 'band2Vert' | 'firstCol' | 'firstRow' | 'lastCol' | 'lastRow' | 'neCell' | 'nwCell' | 'seCell' | 'swCell';
|
|
1540
|
+
pPr?: ParagraphFormatting;
|
|
1541
|
+
rPr?: TextFormatting;
|
|
1542
|
+
tblPr?: TableFormatting;
|
|
1543
|
+
trPr?: TableRowFormatting;
|
|
1544
|
+
tcPr?: TableCellFormatting;
|
|
1545
|
+
}>;
|
|
1546
|
+
}
|
|
1547
|
+
/**
|
|
1548
|
+
* Document defaults (w:docDefaults)
|
|
1549
|
+
*/
|
|
1550
|
+
interface DocDefaults {
|
|
1551
|
+
/** Default run properties */
|
|
1552
|
+
rPr?: TextFormatting;
|
|
1553
|
+
/** Default paragraph properties */
|
|
1554
|
+
pPr?: ParagraphFormatting;
|
|
1555
|
+
}
|
|
1556
|
+
/**
|
|
1557
|
+
* Style definitions from styles.xml
|
|
1558
|
+
*/
|
|
1559
|
+
interface StyleDefinitions {
|
|
1560
|
+
/** Document defaults */
|
|
1561
|
+
docDefaults?: DocDefaults;
|
|
1562
|
+
/** Latent styles */
|
|
1563
|
+
latentStyles?: {
|
|
1564
|
+
defLockedState?: boolean;
|
|
1565
|
+
defUIPriority?: number;
|
|
1566
|
+
defSemiHidden?: boolean;
|
|
1567
|
+
defUnhideWhenUsed?: boolean;
|
|
1568
|
+
defQFormat?: boolean;
|
|
1569
|
+
count?: number;
|
|
1570
|
+
};
|
|
1571
|
+
/** Style definitions */
|
|
1572
|
+
styles: Style[];
|
|
1573
|
+
}
|
|
1574
|
+
/**
|
|
1575
|
+
* Theme color scheme (a:clrScheme)
|
|
1576
|
+
*/
|
|
1577
|
+
interface ThemeColorScheme {
|
|
1578
|
+
/** Dark 1 color (usually black) */
|
|
1579
|
+
dk1?: string;
|
|
1580
|
+
/** Light 1 color (usually white) */
|
|
1581
|
+
lt1?: string;
|
|
1582
|
+
/** Dark 2 color */
|
|
1583
|
+
dk2?: string;
|
|
1584
|
+
/** Light 2 color */
|
|
1585
|
+
lt2?: string;
|
|
1586
|
+
/** Accent colors 1-6 */
|
|
1587
|
+
accent1?: string;
|
|
1588
|
+
accent2?: string;
|
|
1589
|
+
accent3?: string;
|
|
1590
|
+
accent4?: string;
|
|
1591
|
+
accent5?: string;
|
|
1592
|
+
accent6?: string;
|
|
1593
|
+
/** Hyperlink color */
|
|
1594
|
+
hlink?: string;
|
|
1595
|
+
/** Followed hyperlink color */
|
|
1596
|
+
folHlink?: string;
|
|
1597
|
+
}
|
|
1598
|
+
/**
|
|
1599
|
+
* Theme font (with script variants)
|
|
1600
|
+
*/
|
|
1601
|
+
interface ThemeFont {
|
|
1602
|
+
/** Latin font */
|
|
1603
|
+
latin?: string;
|
|
1604
|
+
/** East Asian font */
|
|
1605
|
+
ea?: string;
|
|
1606
|
+
/** Complex script font */
|
|
1607
|
+
cs?: string;
|
|
1608
|
+
/** Script-specific fonts */
|
|
1609
|
+
fonts?: Record<string, string>;
|
|
1610
|
+
}
|
|
1611
|
+
/**
|
|
1612
|
+
* Theme font scheme (a:fontScheme)
|
|
1613
|
+
*/
|
|
1614
|
+
interface ThemeFontScheme {
|
|
1615
|
+
/** Major font (headings) */
|
|
1616
|
+
majorFont?: ThemeFont;
|
|
1617
|
+
/** Minor font (body text) */
|
|
1618
|
+
minorFont?: ThemeFont;
|
|
1619
|
+
}
|
|
1620
|
+
/**
|
|
1621
|
+
* Theme (from theme1.xml)
|
|
1622
|
+
*/
|
|
1623
|
+
interface Theme {
|
|
1624
|
+
/** Theme name */
|
|
1625
|
+
name?: string;
|
|
1626
|
+
/** Color scheme */
|
|
1627
|
+
colorScheme?: ThemeColorScheme;
|
|
1628
|
+
/** Font scheme */
|
|
1629
|
+
fontScheme?: ThemeFontScheme;
|
|
1630
|
+
/** Format scheme (fills, lines, effects) - simplified */
|
|
1631
|
+
formatScheme?: {
|
|
1632
|
+
name?: string;
|
|
1633
|
+
};
|
|
1634
|
+
}
|
|
1635
|
+
/**
|
|
1636
|
+
* Font info from fontTable.xml
|
|
1637
|
+
*/
|
|
1638
|
+
interface FontInfo {
|
|
1639
|
+
/** Font name */
|
|
1640
|
+
name: string;
|
|
1641
|
+
/** Alternate names */
|
|
1642
|
+
altName?: string;
|
|
1643
|
+
/** Panose-1 classification */
|
|
1644
|
+
panose1?: string;
|
|
1645
|
+
/** Character set */
|
|
1646
|
+
charset?: string;
|
|
1647
|
+
/** Font family type */
|
|
1648
|
+
family?: 'decorative' | 'modern' | 'roman' | 'script' | 'swiss' | 'auto';
|
|
1649
|
+
/** Pitch (fixed or variable) */
|
|
1650
|
+
pitch?: 'default' | 'fixed' | 'variable';
|
|
1651
|
+
/** Signature */
|
|
1652
|
+
sig?: {
|
|
1653
|
+
usb0?: string;
|
|
1654
|
+
usb1?: string;
|
|
1655
|
+
usb2?: string;
|
|
1656
|
+
usb3?: string;
|
|
1657
|
+
csb0?: string;
|
|
1658
|
+
csb1?: string;
|
|
1659
|
+
};
|
|
1660
|
+
/** Embedded font data reference */
|
|
1661
|
+
embedRegular?: string;
|
|
1662
|
+
embedBold?: string;
|
|
1663
|
+
embedItalic?: string;
|
|
1664
|
+
embedBoldItalic?: string;
|
|
1665
|
+
}
|
|
1666
|
+
/**
|
|
1667
|
+
* Font table from fontTable.xml
|
|
1668
|
+
*/
|
|
1669
|
+
interface FontTable {
|
|
1670
|
+
fonts: FontInfo[];
|
|
1671
|
+
}
|
|
1672
|
+
/**
|
|
1673
|
+
* Relationship type
|
|
1674
|
+
*/
|
|
1675
|
+
type RelationshipType = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image' | 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink' | 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/header' | 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer' | 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes' | 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes' | 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles' | 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering' | 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable' | 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme' | 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings' | 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings' | 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject' | 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart' | 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramData' | string;
|
|
1676
|
+
/**
|
|
1677
|
+
* Relationship entry
|
|
1678
|
+
*/
|
|
1679
|
+
interface Relationship {
|
|
1680
|
+
/** Relationship ID (e.g., "rId1") */
|
|
1681
|
+
id: string;
|
|
1682
|
+
/** Relationship type URI */
|
|
1683
|
+
type: RelationshipType;
|
|
1684
|
+
/** Target path or URL */
|
|
1685
|
+
target: string;
|
|
1686
|
+
/** Target mode */
|
|
1687
|
+
targetMode?: 'External' | 'Internal';
|
|
1688
|
+
}
|
|
1689
|
+
/**
|
|
1690
|
+
* Relationship map (keyed by rId)
|
|
1691
|
+
*/
|
|
1692
|
+
type RelationshipMap = Map<string, Relationship>;
|
|
1693
|
+
/**
|
|
1694
|
+
* Media file from word/media/
|
|
1695
|
+
*/
|
|
1696
|
+
interface MediaFile {
|
|
1697
|
+
/** File path in ZIP */
|
|
1698
|
+
path: string;
|
|
1699
|
+
/** Original filename */
|
|
1700
|
+
filename?: string;
|
|
1701
|
+
/** MIME type */
|
|
1702
|
+
mimeType: string;
|
|
1703
|
+
/** Binary data */
|
|
1704
|
+
data: ArrayBuffer;
|
|
1705
|
+
/** Base64 encoded data for rendering */
|
|
1706
|
+
base64?: string;
|
|
1707
|
+
/** Data URL for direct use in src attributes */
|
|
1708
|
+
dataUrl?: string;
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
/**
|
|
1712
|
+
* Comprehensive TypeScript types for full DOCX document representation
|
|
1713
|
+
*
|
|
1714
|
+
* This barrel file re-exports all types from the split modules.
|
|
1715
|
+
* Existing imports from './types/document' continue to work unchanged.
|
|
1716
|
+
*
|
|
1717
|
+
* Module structure:
|
|
1718
|
+
* - colors.ts — Color primitives, borders, shading
|
|
1719
|
+
* - formatting.ts — Text, paragraph, and table formatting properties
|
|
1720
|
+
* - lists.ts — Numbering and list definitions
|
|
1721
|
+
* - content.ts — Content model (runs, images, shapes, tables, paragraphs, sections)
|
|
1722
|
+
* - styles.ts — Styles, theme, fonts, relationships, media
|
|
1723
|
+
*/
|
|
1724
|
+
|
|
1725
|
+
/**
|
|
1726
|
+
* Complete DOCX package structure
|
|
1727
|
+
*/
|
|
1728
|
+
interface DocxPackage {
|
|
1729
|
+
/** Document body */
|
|
1730
|
+
document: DocumentBody;
|
|
1731
|
+
/** Style definitions */
|
|
1732
|
+
styles?: StyleDefinitions;
|
|
1733
|
+
/** Theme */
|
|
1734
|
+
theme?: Theme;
|
|
1735
|
+
/** Numbering definitions */
|
|
1736
|
+
numbering?: NumberingDefinitions;
|
|
1737
|
+
/** Font table */
|
|
1738
|
+
fontTable?: FontTable;
|
|
1739
|
+
/** Footnotes */
|
|
1740
|
+
footnotes?: Footnote[];
|
|
1741
|
+
/** Endnotes */
|
|
1742
|
+
endnotes?: Endnote[];
|
|
1743
|
+
/** Headers by relationship ID */
|
|
1744
|
+
headers?: Map<string, HeaderFooter>;
|
|
1745
|
+
/** Footers by relationship ID */
|
|
1746
|
+
footers?: Map<string, HeaderFooter>;
|
|
1747
|
+
/** Document relationships */
|
|
1748
|
+
relationships?: RelationshipMap;
|
|
1749
|
+
/** Media files */
|
|
1750
|
+
media?: Map<string, MediaFile>;
|
|
1751
|
+
/** Document properties */
|
|
1752
|
+
properties?: {
|
|
1753
|
+
title?: string;
|
|
1754
|
+
subject?: string;
|
|
1755
|
+
creator?: string;
|
|
1756
|
+
keywords?: string;
|
|
1757
|
+
description?: string;
|
|
1758
|
+
lastModifiedBy?: string;
|
|
1759
|
+
revision?: number;
|
|
1760
|
+
created?: Date;
|
|
1761
|
+
modified?: Date;
|
|
1762
|
+
};
|
|
1763
|
+
}
|
|
1764
|
+
/**
|
|
1765
|
+
* Complete parsed DOCX document
|
|
1766
|
+
*/
|
|
1767
|
+
interface Document {
|
|
1768
|
+
/** DOCX package with all parsed content */
|
|
1769
|
+
package: DocxPackage;
|
|
1770
|
+
/** Original ArrayBuffer for round-trip */
|
|
1771
|
+
originalBuffer?: ArrayBuffer;
|
|
1772
|
+
/** Detected template variables ({{...}}) */
|
|
1773
|
+
templateVariables?: string[];
|
|
1774
|
+
/** Parsing warnings/errors */
|
|
1775
|
+
warnings?: string[];
|
|
1776
|
+
}
|
|
1777
|
+
|
|
1778
|
+
/**
|
|
1779
|
+
* Types for @eigenpal/docx-editor-agents
|
|
1780
|
+
*/
|
|
1781
|
+
interface HeadingBlock {
|
|
1782
|
+
type: 'heading';
|
|
1783
|
+
index: number;
|
|
1784
|
+
level: number;
|
|
1785
|
+
text: string;
|
|
1786
|
+
}
|
|
1787
|
+
interface ParagraphBlock {
|
|
1788
|
+
type: 'paragraph';
|
|
1789
|
+
index: number;
|
|
1790
|
+
text: string;
|
|
1791
|
+
}
|
|
1792
|
+
interface TableBlock {
|
|
1793
|
+
type: 'table';
|
|
1794
|
+
index: number;
|
|
1795
|
+
rows: string[][];
|
|
1796
|
+
}
|
|
1797
|
+
interface ListItemBlock {
|
|
1798
|
+
type: 'list-item';
|
|
1799
|
+
index: number;
|
|
1800
|
+
text: string;
|
|
1801
|
+
listLevel: number;
|
|
1802
|
+
listType: 'bullet' | 'number';
|
|
1803
|
+
}
|
|
1804
|
+
type ContentBlock = HeadingBlock | ParagraphBlock | TableBlock | ListItemBlock;
|
|
1805
|
+
interface GetContentOptions {
|
|
1806
|
+
fromIndex?: number;
|
|
1807
|
+
toIndex?: number;
|
|
1808
|
+
/** Annotate tracked changes inline. Default: true */
|
|
1809
|
+
includeTrackedChanges?: boolean;
|
|
1810
|
+
/** Annotate comments inline. Default: true */
|
|
1811
|
+
includeCommentAnchors?: boolean;
|
|
1812
|
+
}
|
|
1813
|
+
interface ReviewChange {
|
|
1814
|
+
id: number;
|
|
1815
|
+
type: 'insertion' | 'deletion' | 'moveFrom' | 'moveTo';
|
|
1816
|
+
author: string;
|
|
1817
|
+
date: string | null;
|
|
1818
|
+
text: string;
|
|
1819
|
+
context: string;
|
|
1820
|
+
paragraphIndex: number;
|
|
1821
|
+
}
|
|
1822
|
+
interface ReviewCommentReply {
|
|
1823
|
+
id: number;
|
|
1824
|
+
author: string;
|
|
1825
|
+
date: string | null;
|
|
1826
|
+
text: string;
|
|
1827
|
+
}
|
|
1828
|
+
interface ReviewComment {
|
|
1829
|
+
id: number;
|
|
1830
|
+
author: string;
|
|
1831
|
+
date: string | null;
|
|
1832
|
+
text: string;
|
|
1833
|
+
anchoredText: string;
|
|
1834
|
+
paragraphIndex: number;
|
|
1835
|
+
replies: ReviewCommentReply[];
|
|
1836
|
+
done: boolean;
|
|
1837
|
+
}
|
|
1838
|
+
interface ChangeFilter {
|
|
1839
|
+
author?: string;
|
|
1840
|
+
type?: 'insertion' | 'deletion' | 'moveFrom' | 'moveTo';
|
|
1841
|
+
}
|
|
1842
|
+
interface CommentFilter {
|
|
1843
|
+
author?: string;
|
|
1844
|
+
done?: boolean;
|
|
1845
|
+
}
|
|
1846
|
+
interface AddCommentOptions {
|
|
1847
|
+
paragraphIndex: number;
|
|
1848
|
+
text: string;
|
|
1849
|
+
author?: string;
|
|
1850
|
+
/** Optional: anchor to specific text. Omit to anchor whole paragraph. */
|
|
1851
|
+
search?: string;
|
|
1852
|
+
}
|
|
1853
|
+
interface ReplyOptions {
|
|
1854
|
+
text: string;
|
|
1855
|
+
author?: string;
|
|
1856
|
+
}
|
|
1857
|
+
interface ProposeReplacementOptions {
|
|
1858
|
+
paragraphIndex: number;
|
|
1859
|
+
search: string;
|
|
1860
|
+
replaceWith: string;
|
|
1861
|
+
author?: string;
|
|
1862
|
+
}
|
|
1863
|
+
interface ProposeInsertionOptions {
|
|
1864
|
+
paragraphIndex: number;
|
|
1865
|
+
insertText: string;
|
|
1866
|
+
author?: string;
|
|
1867
|
+
position?: 'before' | 'after';
|
|
1868
|
+
search?: string;
|
|
1869
|
+
}
|
|
1870
|
+
interface ProposeDeletionOptions {
|
|
1871
|
+
paragraphIndex: number;
|
|
1872
|
+
search: string;
|
|
1873
|
+
author?: string;
|
|
1874
|
+
}
|
|
1875
|
+
interface BatchReviewOptions {
|
|
1876
|
+
accept?: number[];
|
|
1877
|
+
reject?: number[];
|
|
1878
|
+
comments?: AddCommentOptions[];
|
|
1879
|
+
replies?: (ReplyOptions & {
|
|
1880
|
+
commentId: number;
|
|
1881
|
+
})[];
|
|
1882
|
+
proposals?: ProposeReplacementOptions[];
|
|
1883
|
+
}
|
|
1884
|
+
interface BatchError {
|
|
1885
|
+
operation: string;
|
|
1886
|
+
id?: number;
|
|
1887
|
+
search?: string;
|
|
1888
|
+
error: string;
|
|
1889
|
+
}
|
|
1890
|
+
interface BatchResult {
|
|
1891
|
+
accepted: number;
|
|
1892
|
+
rejected: number;
|
|
1893
|
+
commentsAdded: number;
|
|
1894
|
+
repliesAdded: number;
|
|
1895
|
+
proposalsAdded: number;
|
|
1896
|
+
errors: BatchError[];
|
|
1897
|
+
}
|
|
1898
|
+
|
|
1899
|
+
/**
|
|
1900
|
+
* DocxReviewer — Word-like API for AI document review.
|
|
1901
|
+
*
|
|
1902
|
+
* @example
|
|
1903
|
+
* ```ts
|
|
1904
|
+
* const reviewer = await DocxReviewer.fromBuffer(buffer, 'AI Reviewer');
|
|
1905
|
+
* const text = reviewer.getContentAsText();
|
|
1906
|
+
* reviewer.addComment(5, 'Fix this paragraph.');
|
|
1907
|
+
* reviewer.replace(5, '$50k', '$500k');
|
|
1908
|
+
* const output = await reviewer.toBuffer();
|
|
1909
|
+
* ```
|
|
1910
|
+
*/
|
|
1911
|
+
|
|
1912
|
+
declare class DocxReviewer {
|
|
1913
|
+
private doc;
|
|
1914
|
+
/** Default author for comments and tracked changes. Set once, used everywhere. */
|
|
1915
|
+
readonly author: string;
|
|
1916
|
+
/**
|
|
1917
|
+
* Create a reviewer from a parsed Document.
|
|
1918
|
+
* @param document - Parsed Document from @eigenpal/docx-core
|
|
1919
|
+
* @param author - Default author name for comments and changes. (default: 'AI')
|
|
1920
|
+
* @param originalBuffer - Original DOCX buffer, needed for toBuffer()
|
|
1921
|
+
*/
|
|
1922
|
+
constructor(document: Document, author?: string, originalBuffer?: ArrayBuffer);
|
|
1923
|
+
/**
|
|
1924
|
+
* Create a reviewer from a DOCX file buffer.
|
|
1925
|
+
* @param buffer - ArrayBuffer of the DOCX file
|
|
1926
|
+
* @param author - Default author name for comments and changes. (default: 'AI')
|
|
1927
|
+
*/
|
|
1928
|
+
static fromBuffer(buffer: ArrayBuffer, author?: string): Promise<DocxReviewer>;
|
|
1929
|
+
private get body();
|
|
1930
|
+
private resolveAuthor;
|
|
1931
|
+
/** Get document content as structured blocks (headings, paragraphs, tables, lists). */
|
|
1932
|
+
getContent(options?: GetContentOptions): ContentBlock[];
|
|
1933
|
+
/**
|
|
1934
|
+
* Get document content as plain text for LLM prompts.
|
|
1935
|
+
* Each paragraph is prefixed with its index: `[0] text`, `[1] text`, etc.
|
|
1936
|
+
* Table cells include position: `[5] (table, row 1, col 2) cell text`.
|
|
1937
|
+
* Avoids JSON quote-escaping issues — LLMs can copy text verbatim.
|
|
1938
|
+
*/
|
|
1939
|
+
getContentAsText(options?: GetContentOptions): string;
|
|
1940
|
+
/** Get all tracked changes in the document. */
|
|
1941
|
+
getChanges(filter?: ChangeFilter): ReviewChange[];
|
|
1942
|
+
/** Get all comments with their replies. */
|
|
1943
|
+
getComments(filter?: CommentFilter): ReviewComment[];
|
|
1944
|
+
/**
|
|
1945
|
+
* Add a comment on a paragraph.
|
|
1946
|
+
* @param paragraphIndex - Index of the paragraph to comment on
|
|
1947
|
+
* @param text - Comment text
|
|
1948
|
+
* @returns The new comment ID
|
|
1949
|
+
*/
|
|
1950
|
+
addComment(paragraphIndex: number, text: string): number;
|
|
1951
|
+
/**
|
|
1952
|
+
* Add a comment with full options (custom author, anchored to specific text).
|
|
1953
|
+
* @param options - Comment options
|
|
1954
|
+
* @returns The new comment ID
|
|
1955
|
+
*/
|
|
1956
|
+
addComment(options: AddCommentOptions): number;
|
|
1957
|
+
/**
|
|
1958
|
+
* Reply to an existing comment.
|
|
1959
|
+
* @param commentId - ID of the comment to reply to
|
|
1960
|
+
* @param text - Reply text
|
|
1961
|
+
* @returns The new reply comment ID
|
|
1962
|
+
*/
|
|
1963
|
+
replyTo(commentId: number, text: string): number;
|
|
1964
|
+
/** Reply to an existing comment with full options. */
|
|
1965
|
+
replyTo(commentId: number, options: ReplyOptions): number;
|
|
1966
|
+
/**
|
|
1967
|
+
* Replace text in a paragraph. Creates a tracked change (deletion + insertion).
|
|
1968
|
+
* @param paragraphIndex - Index of the paragraph
|
|
1969
|
+
* @param search - Short phrase to find within the paragraph
|
|
1970
|
+
* @param replaceWith - Replacement text
|
|
1971
|
+
*/
|
|
1972
|
+
replace(paragraphIndex: number, search: string, replaceWith: string): void;
|
|
1973
|
+
/** Replace text with full options. */
|
|
1974
|
+
replace(options: ProposeReplacementOptions): void;
|
|
1975
|
+
/** @deprecated Use replace() instead. */
|
|
1976
|
+
proposeReplacement(options: ProposeReplacementOptions): void;
|
|
1977
|
+
/** Insert text as a tracked change. */
|
|
1978
|
+
proposeInsertion(options: ProposeInsertionOptions): void;
|
|
1979
|
+
/** Delete text as a tracked change. */
|
|
1980
|
+
proposeDeletion(options: ProposeDeletionOptions): void;
|
|
1981
|
+
/** Accept a tracked change by its revision ID. */
|
|
1982
|
+
acceptChange(id: number): void;
|
|
1983
|
+
/** Reject a tracked change by its revision ID. */
|
|
1984
|
+
rejectChange(id: number): void;
|
|
1985
|
+
/** Accept all tracked changes. Returns count accepted. */
|
|
1986
|
+
acceptAll(): number;
|
|
1987
|
+
/** Reject all tracked changes. Returns count rejected. */
|
|
1988
|
+
rejectAll(): number;
|
|
1989
|
+
/**
|
|
1990
|
+
* Apply multiple review operations in one call.
|
|
1991
|
+
* Uses the reviewer's default author. Individual failures are collected, not thrown.
|
|
1992
|
+
*/
|
|
1993
|
+
applyReview(ops: BatchReviewOptions): BatchResult;
|
|
1994
|
+
/** Get the modified Document model. */
|
|
1995
|
+
toDocument(): Document;
|
|
1996
|
+
/** Serialize back to a DOCX buffer. Requires the original buffer. */
|
|
1997
|
+
toBuffer(): Promise<ArrayBuffer>;
|
|
1998
|
+
}
|
|
1999
|
+
|
|
2000
|
+
/**
|
|
2001
|
+
* Error classes for @eigenpal/docx-editor-agents
|
|
2002
|
+
*/
|
|
2003
|
+
declare class TextNotFoundError extends Error {
|
|
2004
|
+
constructor(search: string, paragraphIndex?: number);
|
|
2005
|
+
}
|
|
2006
|
+
declare class ChangeNotFoundError extends Error {
|
|
2007
|
+
constructor(id: number);
|
|
2008
|
+
}
|
|
2009
|
+
declare class CommentNotFoundError extends Error {
|
|
2010
|
+
constructor(id: number);
|
|
2011
|
+
}
|
|
2012
|
+
|
|
2013
|
+
export { type BatchError, type BatchResult, type BatchReviewOptions, ChangeNotFoundError, CommentNotFoundError, type ContentBlock, DocxReviewer, type GetContentOptions, type ReviewChange, type ReviewComment, TextNotFoundError };
|