@eigenpal/docx-js-editor 0.0.17 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/dist/ClipboardManager-D6dkOFg6.d.ts +436 -0
  2. package/dist/ClipboardManager-EZ0C6Onq.d.cts +436 -0
  3. package/dist/DocumentAgent-B0EC8lPC.d.cts +412 -0
  4. package/dist/DocumentAgent-BcCDg7i2.d.ts +412 -0
  5. package/dist/{FindReplaceDialog-MMDEJORP.js → FindReplaceDialog-AWQXKEUQ.js} +2 -2
  6. package/dist/{FindReplaceDialog-MMDEJORP.js.map → FindReplaceDialog-AWQXKEUQ.js.map} +1 -1
  7. package/dist/{FindReplaceDialog-K4GRE4JB.cjs → FindReplaceDialog-I4SZDSVP.cjs} +2 -2
  8. package/dist/{FindReplaceDialog-K4GRE4JB.cjs.map → FindReplaceDialog-I4SZDSVP.cjs.map} +1 -1
  9. package/dist/{FootnotePropertiesDialog-V3YOIJCV.cjs → FootnotePropertiesDialog-73VT2ZVZ.cjs} +2 -2
  10. package/dist/{FootnotePropertiesDialog-V3YOIJCV.cjs.map → FootnotePropertiesDialog-73VT2ZVZ.cjs.map} +1 -1
  11. package/dist/{FootnotePropertiesDialog-HG4267LR.js → FootnotePropertiesDialog-ZM3EF3EF.js} +2 -2
  12. package/dist/{FootnotePropertiesDialog-HG4267LR.js.map → FootnotePropertiesDialog-ZM3EF3EF.js.map} +1 -1
  13. package/dist/{HyperlinkDialog-SCSX4RP7.js → HyperlinkDialog-BA25XUT5.js} +2 -2
  14. package/dist/{HyperlinkDialog-SCSX4RP7.js.map → HyperlinkDialog-BA25XUT5.js.map} +1 -1
  15. package/dist/{HyperlinkDialog-YPKURBZK.cjs → HyperlinkDialog-V63LPOT2.cjs} +2 -2
  16. package/dist/{HyperlinkDialog-YPKURBZK.cjs.map → HyperlinkDialog-V63LPOT2.cjs.map} +1 -1
  17. package/dist/{ImagePositionDialog-CJYJ35PI.js → ImagePositionDialog-AIAMKPFK.js} +2 -2
  18. package/dist/{ImagePositionDialog-CJYJ35PI.js.map → ImagePositionDialog-AIAMKPFK.js.map} +1 -1
  19. package/dist/{ImagePositionDialog-IMVI7EXA.cjs → ImagePositionDialog-KMK7ROV2.cjs} +2 -2
  20. package/dist/{ImagePositionDialog-IMVI7EXA.cjs.map → ImagePositionDialog-KMK7ROV2.cjs.map} +1 -1
  21. package/dist/{ImagePropertiesDialog-P7WN2ALR.js → ImagePropertiesDialog-ERFCUVCW.js} +2 -2
  22. package/dist/{ImagePropertiesDialog-P7WN2ALR.js.map → ImagePropertiesDialog-ERFCUVCW.js.map} +1 -1
  23. package/dist/{ImagePropertiesDialog-YS4KJRN7.cjs → ImagePropertiesDialog-USMMRK6X.cjs} +2 -2
  24. package/dist/{ImagePropertiesDialog-YS4KJRN7.cjs.map → ImagePropertiesDialog-USMMRK6X.cjs.map} +1 -1
  25. package/dist/{TablePropertiesDialog-CUQXUBQN.cjs → TablePropertiesDialog-72CIUAZT.cjs} +2 -2
  26. package/dist/{TablePropertiesDialog-CUQXUBQN.cjs.map → TablePropertiesDialog-72CIUAZT.cjs.map} +1 -1
  27. package/dist/{TablePropertiesDialog-ZHAYVHPZ.js → TablePropertiesDialog-EMUEVYB3.js} +2 -2
  28. package/dist/{TablePropertiesDialog-ZHAYVHPZ.js.map → TablePropertiesDialog-EMUEVYB3.js.map} +1 -1
  29. package/dist/agentApi-BFVyKagE.d.cts +2227 -0
  30. package/dist/agentApi-BFVyKagE.d.ts +2227 -0
  31. package/dist/chunk-2CHPKB5A.cjs +112 -0
  32. package/dist/chunk-2CHPKB5A.cjs.map +1 -0
  33. package/dist/chunk-2QOEHCBX.js +2 -0
  34. package/dist/chunk-2QOEHCBX.js.map +1 -0
  35. package/dist/chunk-4QT5LPBA.cjs +24 -0
  36. package/dist/chunk-4QT5LPBA.cjs.map +1 -0
  37. package/dist/chunk-5DYSI4O4.cjs +60 -0
  38. package/dist/chunk-5DYSI4O4.cjs.map +1 -0
  39. package/dist/chunk-5FJXHXFV.cjs +2 -0
  40. package/dist/chunk-5FJXHXFV.cjs.map +1 -0
  41. package/dist/chunk-6FEWNF6B.js +4 -0
  42. package/dist/chunk-6FEWNF6B.js.map +1 -0
  43. package/dist/chunk-6LF5HZCV.js +10 -0
  44. package/dist/chunk-6LF5HZCV.js.map +1 -0
  45. package/dist/chunk-7JSPKVOW.js +2 -0
  46. package/dist/chunk-7JSPKVOW.js.map +1 -0
  47. package/dist/chunk-C33XDRDJ.cjs +28 -0
  48. package/dist/chunk-C33XDRDJ.cjs.map +1 -0
  49. package/dist/chunk-CV5WFE7K.js +24 -0
  50. package/dist/chunk-CV5WFE7K.js.map +1 -0
  51. package/dist/chunk-CXJRNISO.js +2 -0
  52. package/dist/chunk-CXJRNISO.js.map +1 -0
  53. package/dist/chunk-DP6Q75ZD.js +28 -0
  54. package/dist/chunk-DP6Q75ZD.js.map +1 -0
  55. package/dist/chunk-FDANI5P4.cjs +2 -0
  56. package/dist/chunk-FDANI5P4.cjs.map +1 -0
  57. package/dist/chunk-FGVGZLBL.js +2 -0
  58. package/dist/chunk-FGVGZLBL.js.map +1 -0
  59. package/dist/chunk-GJ4GKSDU.cjs +2 -0
  60. package/dist/chunk-GJ4GKSDU.cjs.map +1 -0
  61. package/dist/chunk-GWBTKVFD.cjs +2 -0
  62. package/dist/chunk-GWBTKVFD.cjs.map +1 -0
  63. package/dist/chunk-JOYPFQW2.js +2 -0
  64. package/dist/chunk-JOYPFQW2.js.map +1 -0
  65. package/dist/chunk-L54YNLSE.js +2 -0
  66. package/dist/chunk-L54YNLSE.js.map +1 -0
  67. package/dist/chunk-LPGMLJMO.js +259 -0
  68. package/dist/chunk-LPGMLJMO.js.map +1 -0
  69. package/dist/chunk-OHG7ROFC.js +11 -0
  70. package/dist/chunk-OHG7ROFC.js.map +1 -0
  71. package/dist/chunk-PANKMCFX.cjs +4 -0
  72. package/dist/chunk-PANKMCFX.cjs.map +1 -0
  73. package/dist/chunk-QDV75OJ4.js +112 -0
  74. package/dist/chunk-QDV75OJ4.js.map +1 -0
  75. package/dist/chunk-QEBO3EQP.cjs +2 -0
  76. package/dist/{chunk-V3MCDVZE.cjs.map → chunk-QEBO3EQP.cjs.map} +1 -1
  77. package/dist/chunk-QVIZ775M.cjs +259 -0
  78. package/dist/chunk-QVIZ775M.cjs.map +1 -0
  79. package/dist/chunk-RMUMR42R.cjs +10 -0
  80. package/dist/chunk-RMUMR42R.cjs.map +1 -0
  81. package/dist/chunk-T2HQYRA7.cjs +2 -0
  82. package/dist/chunk-T2HQYRA7.cjs.map +1 -0
  83. package/dist/chunk-ULXNEG66.js +60 -0
  84. package/dist/chunk-ULXNEG66.js.map +1 -0
  85. package/dist/chunk-WD2HTKRR.cjs +2 -0
  86. package/dist/chunk-WD2HTKRR.cjs.map +1 -0
  87. package/dist/chunk-XZNOV52K.cjs +11 -0
  88. package/dist/chunk-XZNOV52K.cjs.map +1 -0
  89. package/dist/chunk-Y6VCTLCJ.js +2 -0
  90. package/dist/{chunk-AL62KQYJ.js.map → chunk-Y6VCTLCJ.js.map} +1 -1
  91. package/dist/{TableToolbar-RHX9L4h9.d.ts → clipboard-CqE-UZ2d.d.cts} +125 -2
  92. package/dist/{TableToolbar-RHX9L4h9.d.cts → clipboard-beGtyabO.d.ts} +125 -2
  93. package/dist/colorResolver-B5YbO_a4.d.ts +618 -0
  94. package/dist/colorResolver-Cu46bSKr.d.cts +618 -0
  95. package/dist/core-plugins-reexport.cjs +1 -1
  96. package/dist/core-plugins-reexport.cjs.map +1 -1
  97. package/dist/core-plugins-reexport.d.cts +31 -1
  98. package/dist/core-plugins-reexport.d.ts +31 -1
  99. package/dist/core-plugins-reexport.js +1 -1
  100. package/dist/core-plugins-reexport.js.map +1 -1
  101. package/dist/core-reexport.cjs +1 -1
  102. package/dist/core-reexport.cjs.map +1 -1
  103. package/dist/core-reexport.d.cts +309 -4
  104. package/dist/core-reexport.d.ts +309 -4
  105. package/dist/core-reexport.js +1 -1
  106. package/dist/core-reexport.js.map +1 -1
  107. package/dist/executor-K5RXUTTR.js +2 -0
  108. package/dist/executor-K5RXUTTR.js.map +1 -0
  109. package/dist/executor-XIPIU3H4.cjs +2 -0
  110. package/dist/executor-XIPIU3H4.cjs.map +1 -0
  111. package/dist/fontLoader-CFKpg0Ri.d.ts +176 -0
  112. package/dist/fontLoader-HZYfILUm.d.cts +176 -0
  113. package/dist/headless-reexport.cjs +4 -1
  114. package/dist/headless-reexport.cjs.map +1 -1
  115. package/dist/headless-reexport.d.cts +195 -1
  116. package/dist/headless-reexport.d.ts +195 -1
  117. package/dist/headless-reexport.js +4 -1
  118. package/dist/headless-reexport.js.map +1 -1
  119. package/dist/index.cjs +9 -9
  120. package/dist/index.cjs.map +1 -1
  121. package/dist/index.css +2 -0
  122. package/dist/index.css.map +1 -0
  123. package/dist/index.d.cts +261 -30
  124. package/dist/index.d.ts +261 -30
  125. package/dist/index.js +9 -9
  126. package/dist/index.js.map +1 -1
  127. package/dist/mcp-reexport.cjs +16 -1
  128. package/dist/mcp-reexport.cjs.map +1 -1
  129. package/dist/mcp-reexport.d.cts +156 -1
  130. package/dist/mcp-reexport.d.ts +156 -1
  131. package/dist/mcp-reexport.js +16 -1
  132. package/dist/mcp-reexport.js.map +1 -1
  133. package/dist/processTemplate-G37IM66O.js +2 -0
  134. package/dist/processTemplate-G37IM66O.js.map +1 -0
  135. package/dist/processTemplate-RFBGVH7T.cjs +2 -0
  136. package/dist/processTemplate-RFBGVH7T.cjs.map +1 -0
  137. package/dist/react-BjOCdeTs.d.ts +1027 -0
  138. package/dist/react-UzAn4o7l.d.cts +1027 -0
  139. package/dist/react.cjs +1 -1
  140. package/dist/react.cjs.map +1 -1
  141. package/dist/react.css +2 -0
  142. package/dist/react.css.map +1 -0
  143. package/dist/react.d.cts +10 -860
  144. package/dist/react.d.ts +10 -860
  145. package/dist/react.js +1 -1
  146. package/dist/react.js.map +1 -1
  147. package/dist/registry-CV6nYWqP.d.ts +165 -0
  148. package/dist/registry-DjacfR6Q.d.cts +165 -0
  149. package/dist/selectionRects-6DU7HN7E.js +2 -0
  150. package/dist/selectionRects-6DU7HN7E.js.map +1 -0
  151. package/dist/selectionRects-YZSC24ZP.cjs +2 -0
  152. package/dist/selectionRects-YZSC24ZP.cjs.map +1 -0
  153. package/dist/styles.css +1 -1
  154. package/dist/types-Bnp8rvJn.d.cts +310 -0
  155. package/dist/types-DwZ3xysp.d.ts +310 -0
  156. package/dist/ui.cjs +1 -1
  157. package/dist/ui.d.cts +3 -5
  158. package/dist/ui.d.ts +3 -5
  159. package/dist/ui.js +1 -1
  160. package/dist/variableDetector-BaDeXz7D.d.ts +173 -0
  161. package/dist/variableDetector-CMhJtM96.d.cts +173 -0
  162. package/package.json +10 -3
  163. package/dist/chunk-7FEY3YWC.cjs +0 -3
  164. package/dist/chunk-7FEY3YWC.cjs.map +0 -1
  165. package/dist/chunk-AL62KQYJ.js +0 -2
  166. package/dist/chunk-MXGYESPA.cjs +0 -178
  167. package/dist/chunk-MXGYESPA.cjs.map +0 -1
  168. package/dist/chunk-NMYD4OJZ.js +0 -3
  169. package/dist/chunk-NMYD4OJZ.js.map +0 -1
  170. package/dist/chunk-OD33FUTO.js +0 -178
  171. package/dist/chunk-OD33FUTO.js.map +0 -1
  172. package/dist/chunk-V3MCDVZE.cjs +0 -2
  173. package/dist/chunk-VIEW4NAF.js +0 -112
  174. package/dist/chunk-VIEW4NAF.js.map +0 -1
  175. package/dist/chunk-ZX4CSEL3.cjs +0 -112
  176. package/dist/chunk-ZX4CSEL3.cjs.map +0 -1
@@ -0,0 +1,2227 @@
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
+ }
524
+ /**
525
+ * Complete numbering definitions
526
+ */
527
+ interface NumberingDefinitions {
528
+ /** Abstract numbering definitions */
529
+ abstractNums: AbstractNumbering[];
530
+ /** Numbering instances */
531
+ nums: NumberingInstance[];
532
+ }
533
+
534
+ /**
535
+ * Document Content Model
536
+ *
537
+ * All content-bearing types: runs, hyperlinks, bookmarks, fields,
538
+ * images, shapes, tables, lists, paragraphs, headers/footers,
539
+ * footnotes/endnotes, and sections.
540
+ *
541
+ * These types form a deeply interrelated tree (Paragraph ↔ Table ↔ ShapeTextBody)
542
+ * and are kept together to avoid circular import issues.
543
+ */
544
+
545
+ /**
546
+ * Plain text content
547
+ */
548
+ interface TextContent {
549
+ type: 'text';
550
+ /** The text string */
551
+ text: string;
552
+ /** Preserve whitespace (xml:space="preserve") */
553
+ preserveSpace?: boolean;
554
+ }
555
+ /**
556
+ * Tab character
557
+ */
558
+ interface TabContent {
559
+ type: 'tab';
560
+ }
561
+ /**
562
+ * Line break
563
+ */
564
+ interface BreakContent {
565
+ type: 'break';
566
+ /** Break type */
567
+ breakType?: 'page' | 'column' | 'textWrapping';
568
+ /** Clear type for text wrapping break */
569
+ clear?: 'none' | 'left' | 'right' | 'all';
570
+ }
571
+ /**
572
+ * Symbol character (special font character)
573
+ */
574
+ interface SymbolContent {
575
+ type: 'symbol';
576
+ /** Font name */
577
+ font: string;
578
+ /** Character code */
579
+ char: string;
580
+ }
581
+ /**
582
+ * Footnote or endnote reference
583
+ */
584
+ interface NoteReferenceContent {
585
+ type: 'footnoteRef' | 'endnoteRef';
586
+ /** Note ID */
587
+ id: number;
588
+ }
589
+ /**
590
+ * Field character (begin/separate/end)
591
+ */
592
+ interface FieldCharContent {
593
+ type: 'fieldChar';
594
+ /** Field character type */
595
+ charType: 'begin' | 'separate' | 'end';
596
+ /** Field is locked */
597
+ fldLock?: boolean;
598
+ /** Field is dirty (needs update) */
599
+ dirty?: boolean;
600
+ }
601
+ /**
602
+ * Field instruction text
603
+ */
604
+ interface InstrTextContent {
605
+ type: 'instrText';
606
+ /** Field instruction */
607
+ text: string;
608
+ }
609
+ /**
610
+ * Soft hyphen
611
+ */
612
+ interface SoftHyphenContent {
613
+ type: 'softHyphen';
614
+ }
615
+ /**
616
+ * Non-breaking hyphen
617
+ */
618
+ interface NoBreakHyphenContent {
619
+ type: 'noBreakHyphen';
620
+ }
621
+ /**
622
+ * Drawing/image reference
623
+ */
624
+ interface DrawingContent {
625
+ type: 'drawing';
626
+ /** Image data */
627
+ image: Image;
628
+ }
629
+ /**
630
+ * Shape reference
631
+ */
632
+ interface ShapeContent {
633
+ type: 'shape';
634
+ /** Shape data */
635
+ shape: Shape;
636
+ }
637
+ /**
638
+ * All possible run content types
639
+ */
640
+ type RunContent = TextContent | TabContent | BreakContent | SymbolContent | NoteReferenceContent | FieldCharContent | InstrTextContent | SoftHyphenContent | NoBreakHyphenContent | DrawingContent | ShapeContent;
641
+ /**
642
+ * A run is a contiguous region of text with the same formatting
643
+ */
644
+ interface Run {
645
+ type: 'run';
646
+ /** Text formatting properties */
647
+ formatting?: TextFormatting;
648
+ /** Run-level tracked property changes (w:rPrChange) */
649
+ propertyChanges?: RunPropertyChange[];
650
+ /** Run content (text, tabs, breaks, etc.) */
651
+ content: RunContent[];
652
+ }
653
+ /**
654
+ * Hyperlink (w:hyperlink)
655
+ */
656
+ interface Hyperlink {
657
+ type: 'hyperlink';
658
+ /** Relationship ID for external link */
659
+ rId?: string;
660
+ /** Resolved URL (from relationships) */
661
+ href?: string;
662
+ /** Internal bookmark anchor */
663
+ anchor?: string;
664
+ /** Tooltip text */
665
+ tooltip?: string;
666
+ /** Target frame */
667
+ target?: string;
668
+ /** Link history tracking */
669
+ history?: boolean;
670
+ /** Document location */
671
+ docLocation?: string;
672
+ /** Child runs */
673
+ children: (Run | BookmarkStart | BookmarkEnd)[];
674
+ }
675
+ /**
676
+ * Bookmark start marker (w:bookmarkStart)
677
+ */
678
+ interface BookmarkStart {
679
+ type: 'bookmarkStart';
680
+ /** Bookmark ID */
681
+ id: number;
682
+ /** Bookmark name */
683
+ name: string;
684
+ /** Column index for table bookmarks */
685
+ colFirst?: number;
686
+ colLast?: number;
687
+ }
688
+ /**
689
+ * Bookmark end marker (w:bookmarkEnd)
690
+ */
691
+ interface BookmarkEnd {
692
+ type: 'bookmarkEnd';
693
+ /** Bookmark ID */
694
+ id: number;
695
+ }
696
+ /**
697
+ * Known field types
698
+ */
699
+ 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';
700
+ /**
701
+ * Simple field (w:fldSimple)
702
+ */
703
+ interface SimpleField {
704
+ type: 'simpleField';
705
+ /** Field instruction (e.g., "PAGE \\* MERGEFORMAT") */
706
+ instruction: string;
707
+ /** Parsed field type */
708
+ fieldType: FieldType;
709
+ /** Current display value */
710
+ content: (Run | Hyperlink)[];
711
+ /** Field is locked */
712
+ fldLock?: boolean;
713
+ /** Field is dirty */
714
+ dirty?: boolean;
715
+ }
716
+ /**
717
+ * Complex field (w:fldChar begin/separate/end with w:instrText)
718
+ */
719
+ interface ComplexField {
720
+ type: 'complexField';
721
+ /** Field instruction */
722
+ instruction: string;
723
+ /** Parsed field type */
724
+ fieldType: FieldType;
725
+ /** Field code runs */
726
+ fieldCode: Run[];
727
+ /** Display result runs */
728
+ fieldResult: Run[];
729
+ /** Field is locked */
730
+ fldLock?: boolean;
731
+ /** Field is dirty */
732
+ dirty?: boolean;
733
+ }
734
+ type Field = SimpleField | ComplexField;
735
+ /**
736
+ * Image size specification
737
+ */
738
+ interface ImageSize {
739
+ /** Width in EMUs (English Metric Units) */
740
+ width: number;
741
+ /** Height in EMUs */
742
+ height: number;
743
+ }
744
+ /**
745
+ * Image wrap type for floating images
746
+ */
747
+ interface ImageWrap {
748
+ type: 'inline' | 'square' | 'tight' | 'through' | 'topAndBottom' | 'behind' | 'inFront';
749
+ /** Wrap text direction */
750
+ wrapText?: 'bothSides' | 'left' | 'right' | 'largest';
751
+ /** Distance from text */
752
+ distT?: number;
753
+ distB?: number;
754
+ distL?: number;
755
+ distR?: number;
756
+ }
757
+ /**
758
+ * Position for floating images
759
+ */
760
+ interface ImagePosition {
761
+ /** Horizontal positioning */
762
+ horizontal: {
763
+ relativeTo: 'character' | 'column' | 'insideMargin' | 'leftMargin' | 'margin' | 'outsideMargin' | 'page' | 'rightMargin';
764
+ alignment?: 'left' | 'right' | 'center' | 'inside' | 'outside';
765
+ posOffset?: number;
766
+ };
767
+ /** Vertical positioning */
768
+ vertical: {
769
+ relativeTo: 'insideMargin' | 'line' | 'margin' | 'outsideMargin' | 'page' | 'paragraph' | 'topMargin' | 'bottomMargin';
770
+ alignment?: 'top' | 'bottom' | 'center' | 'inside' | 'outside';
771
+ posOffset?: number;
772
+ };
773
+ }
774
+ /**
775
+ * Image transformation
776
+ */
777
+ interface ImageTransform {
778
+ /** Rotation in degrees */
779
+ rotation?: number;
780
+ /** Flip horizontal */
781
+ flipH?: boolean;
782
+ /** Flip vertical */
783
+ flipV?: boolean;
784
+ }
785
+ /**
786
+ * Image padding/margins
787
+ */
788
+ interface ImagePadding {
789
+ top?: number;
790
+ bottom?: number;
791
+ left?: number;
792
+ right?: number;
793
+ }
794
+ /**
795
+ * Embedded image (w:drawing)
796
+ */
797
+ interface Image {
798
+ type: 'image';
799
+ /** Unique ID */
800
+ id?: string;
801
+ /** Relationship ID for the image data */
802
+ rId: string;
803
+ /** Resolved image data (base64 or blob URL) */
804
+ src?: string;
805
+ /** Image MIME type */
806
+ mimeType?: string;
807
+ /** Original filename */
808
+ filename?: string;
809
+ /** Alt text for accessibility */
810
+ alt?: string;
811
+ /** Title/description */
812
+ title?: string;
813
+ /** Image size */
814
+ size: ImageSize;
815
+ /** Original size before any transforms */
816
+ originalSize?: ImageSize;
817
+ /** Wrap settings */
818
+ wrap: ImageWrap;
819
+ /** Position for floating images */
820
+ position?: ImagePosition;
821
+ /** Image transformations */
822
+ transform?: ImageTransform;
823
+ /** Padding around image */
824
+ padding?: ImagePadding;
825
+ /** Whether this is a decorative image */
826
+ decorative?: boolean;
827
+ /** Image outline/border */
828
+ outline?: ShapeOutline;
829
+ /** Image effects */
830
+ effects?: {
831
+ brightness?: number;
832
+ contrast?: number;
833
+ saturation?: number;
834
+ };
835
+ }
836
+ /**
837
+ * Shape types
838
+ */
839
+ 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';
840
+ /**
841
+ * Shape fill type
842
+ */
843
+ interface ShapeFill {
844
+ type: 'none' | 'solid' | 'gradient' | 'pattern' | 'picture';
845
+ /** Solid fill color */
846
+ color?: ColorValue;
847
+ /** Gradient stops for gradient fill */
848
+ gradient?: {
849
+ type: 'linear' | 'radial' | 'rectangular' | 'path';
850
+ angle?: number;
851
+ stops: Array<{
852
+ position: number;
853
+ color: ColorValue;
854
+ }>;
855
+ };
856
+ }
857
+ /**
858
+ * Shape outline/stroke
859
+ */
860
+ interface ShapeOutline {
861
+ /** Line width in EMUs */
862
+ width?: number;
863
+ /** Line color */
864
+ color?: ColorValue;
865
+ /** Line style */
866
+ style?: 'solid' | 'dot' | 'dash' | 'lgDash' | 'dashDot' | 'lgDashDot' | 'lgDashDotDot' | 'sysDot' | 'sysDash' | 'sysDashDot' | 'sysDashDotDot';
867
+ /** Line cap */
868
+ cap?: 'flat' | 'round' | 'square';
869
+ /** Line join */
870
+ join?: 'bevel' | 'miter' | 'round';
871
+ /** Head arrow */
872
+ headEnd?: {
873
+ type: 'none' | 'triangle' | 'stealth' | 'diamond' | 'oval' | 'arrow';
874
+ width?: 'sm' | 'med' | 'lg';
875
+ length?: 'sm' | 'med' | 'lg';
876
+ };
877
+ /** Tail arrow */
878
+ tailEnd?: {
879
+ type: 'none' | 'triangle' | 'stealth' | 'diamond' | 'oval' | 'arrow';
880
+ width?: 'sm' | 'med' | 'lg';
881
+ length?: 'sm' | 'med' | 'lg';
882
+ };
883
+ }
884
+ /**
885
+ * Text body inside a shape
886
+ */
887
+ interface ShapeTextBody {
888
+ /** Text direction */
889
+ vertical?: boolean;
890
+ /** Rotation */
891
+ rotation?: number;
892
+ /** Anchor/vertical alignment */
893
+ anchor?: 'top' | 'middle' | 'bottom' | 'distributed' | 'justified';
894
+ /** Anchor center */
895
+ anchorCenter?: boolean;
896
+ /** Auto fit */
897
+ autoFit?: 'none' | 'normal' | 'shape';
898
+ /** Text margins */
899
+ margins?: {
900
+ top?: number;
901
+ bottom?: number;
902
+ left?: number;
903
+ right?: number;
904
+ };
905
+ /** Paragraphs inside the shape */
906
+ content: Paragraph[];
907
+ }
908
+ /**
909
+ * Shape/drawing object (wps:wsp)
910
+ */
911
+ interface Shape {
912
+ type: 'shape';
913
+ /** Shape type preset */
914
+ shapeType: ShapeType;
915
+ /** Unique ID */
916
+ id?: string;
917
+ /** Name */
918
+ name?: string;
919
+ /** Size in EMUs */
920
+ size: ImageSize;
921
+ /** Position for floating shapes */
922
+ position?: ImagePosition;
923
+ /** Wrap settings */
924
+ wrap?: ImageWrap;
925
+ /** Fill */
926
+ fill?: ShapeFill;
927
+ /** Outline/stroke */
928
+ outline?: ShapeOutline;
929
+ /** Transform */
930
+ transform?: ImageTransform;
931
+ /** Text content inside the shape */
932
+ textBody?: ShapeTextBody;
933
+ /** Custom geometry points */
934
+ customGeometry?: string;
935
+ }
936
+ /**
937
+ * Text box (floating text container)
938
+ */
939
+ interface TextBox {
940
+ type: 'textBox';
941
+ /** Unique ID */
942
+ id?: string;
943
+ /** Size */
944
+ size: ImageSize;
945
+ /** Position */
946
+ position?: ImagePosition;
947
+ /** Wrap settings */
948
+ wrap?: ImageWrap;
949
+ /** Fill */
950
+ fill?: ShapeFill;
951
+ /** Outline */
952
+ outline?: ShapeOutline;
953
+ /** Text content */
954
+ content: Paragraph[];
955
+ /** Internal margins */
956
+ margins?: {
957
+ top?: number;
958
+ bottom?: number;
959
+ left?: number;
960
+ right?: number;
961
+ };
962
+ }
963
+ /**
964
+ * Table cell
965
+ */
966
+ interface TableCell {
967
+ type: 'tableCell';
968
+ /** Cell formatting */
969
+ formatting?: TableCellFormatting;
970
+ /** Cell-level tracked property changes (w:tcPrChange) */
971
+ propertyChanges?: TableCellPropertyChange[];
972
+ /** Tracked structural changes (cell insert/delete/merge) */
973
+ structuralChange?: TableStructuralChangeInfo;
974
+ /** Cell content (paragraphs, tables, etc.) */
975
+ content: (Paragraph | Table)[];
976
+ }
977
+ /**
978
+ * Table row
979
+ */
980
+ interface TableRow {
981
+ type: 'tableRow';
982
+ /** Row formatting */
983
+ formatting?: TableRowFormatting;
984
+ /** Row-level tracked property changes (w:trPrChange) */
985
+ propertyChanges?: TableRowPropertyChange[];
986
+ /** Tracked structural changes (row insert/delete) */
987
+ structuralChange?: TableStructuralChangeInfo;
988
+ /** Cells in this row */
989
+ cells: TableCell[];
990
+ }
991
+ /**
992
+ * Table (w:tbl)
993
+ */
994
+ interface Table {
995
+ type: 'table';
996
+ /** Table formatting */
997
+ formatting?: TableFormatting;
998
+ /** Table-level tracked property changes (w:tblPrChange) */
999
+ propertyChanges?: TablePropertyChange[];
1000
+ /** Column widths in twips */
1001
+ columnWidths?: number[];
1002
+ /** Table rows */
1003
+ rows: TableRow[];
1004
+ }
1005
+ /**
1006
+ * A comment (w:comment) from comments.xml
1007
+ */
1008
+ interface Comment {
1009
+ /** Comment ID (matches commentRangeStart/End) */
1010
+ id: number;
1011
+ /** Author name */
1012
+ author: string;
1013
+ /** Author initials */
1014
+ initials?: string;
1015
+ /** Date */
1016
+ date?: string;
1017
+ /** Comment content (paragraphs) */
1018
+ content: Paragraph[];
1019
+ /** Parent comment ID (for replies) */
1020
+ parentId?: number;
1021
+ /** Whether the comment is resolved/done */
1022
+ done?: boolean;
1023
+ }
1024
+ /**
1025
+ * Comment range start marker in paragraph content
1026
+ */
1027
+ interface CommentRangeStart {
1028
+ type: 'commentRangeStart';
1029
+ id: number;
1030
+ }
1031
+ /**
1032
+ * Comment range end marker in paragraph content
1033
+ */
1034
+ interface CommentRangeEnd {
1035
+ type: 'commentRangeEnd';
1036
+ id: number;
1037
+ }
1038
+ /**
1039
+ * Math equation content (m:oMath or m:oMathPara)
1040
+ */
1041
+ interface MathEquation {
1042
+ type: 'mathEquation';
1043
+ /** Whether this is a block (oMathPara) or inline (oMath) equation */
1044
+ display: 'inline' | 'block';
1045
+ /** Raw OMML XML for round-trip preservation */
1046
+ ommlXml: string;
1047
+ /** Plain text representation for accessibility/fallback */
1048
+ plainText?: string;
1049
+ }
1050
+ /**
1051
+ * Tracked change metadata (w:ins, w:del attributes)
1052
+ */
1053
+ interface TrackedChangeInfo {
1054
+ /** Revision ID */
1055
+ id: number;
1056
+ /** Author who made the change */
1057
+ author: string;
1058
+ /** Date of the change */
1059
+ date?: string;
1060
+ }
1061
+ /**
1062
+ * Generic tracked property-change wrapper metadata (w:*PrChange)
1063
+ */
1064
+ interface PropertyChangeInfo extends TrackedChangeInfo {
1065
+ /** Optional revision session ID */
1066
+ rsid?: string;
1067
+ }
1068
+ /**
1069
+ * Insertion wrapper (w:ins) — runs inserted by tracked changes
1070
+ */
1071
+ interface Insertion {
1072
+ type: 'insertion';
1073
+ /** Tracked change metadata */
1074
+ info: TrackedChangeInfo;
1075
+ /** Inserted content */
1076
+ content: (Run | Hyperlink)[];
1077
+ }
1078
+ /**
1079
+ * Deletion wrapper (w:del) — runs deleted by tracked changes
1080
+ */
1081
+ interface Deletion {
1082
+ type: 'deletion';
1083
+ /** Tracked change metadata */
1084
+ info: TrackedChangeInfo;
1085
+ /** Deleted content */
1086
+ content: (Run | Hyperlink)[];
1087
+ }
1088
+ /**
1089
+ * Move-from wrapper (w:moveFrom) — content moved away from this position
1090
+ */
1091
+ interface MoveFrom {
1092
+ type: 'moveFrom';
1093
+ /** Tracked change metadata */
1094
+ info: TrackedChangeInfo;
1095
+ /** Moved content */
1096
+ content: (Run | Hyperlink)[];
1097
+ }
1098
+ /**
1099
+ * Move-to wrapper (w:moveTo) — content moved into this position
1100
+ */
1101
+ interface MoveTo {
1102
+ type: 'moveTo';
1103
+ /** Tracked change metadata */
1104
+ info: TrackedChangeInfo;
1105
+ /** Moved content */
1106
+ content: (Run | Hyperlink)[];
1107
+ }
1108
+ /**
1109
+ * Move-from range start marker (w:moveFromRangeStart) — ECMA-376 §17.13.5.22
1110
+ * Pairs with moveFromRangeEnd to delimit the source of a move in the document.
1111
+ */
1112
+ interface MoveFromRangeStart {
1113
+ type: 'moveFromRangeStart';
1114
+ id: number;
1115
+ name: string;
1116
+ }
1117
+ /**
1118
+ * Move-from range end marker (w:moveFromRangeEnd)
1119
+ */
1120
+ interface MoveFromRangeEnd {
1121
+ type: 'moveFromRangeEnd';
1122
+ id: number;
1123
+ }
1124
+ /**
1125
+ * Move-to range start marker (w:moveToRangeStart) — ECMA-376 §17.13.5.24
1126
+ * Pairs with moveToRangeEnd to delimit the destination of a move.
1127
+ */
1128
+ interface MoveToRangeStart {
1129
+ type: 'moveToRangeStart';
1130
+ id: number;
1131
+ name: string;
1132
+ }
1133
+ /**
1134
+ * Move-to range end marker (w:moveToRangeEnd)
1135
+ */
1136
+ interface MoveToRangeEnd {
1137
+ type: 'moveToRangeEnd';
1138
+ id: number;
1139
+ }
1140
+ /**
1141
+ * Run property change (w:rPrChange)
1142
+ */
1143
+ interface RunPropertyChange {
1144
+ type: 'runPropertyChange';
1145
+ /** Tracked change metadata */
1146
+ info: PropertyChangeInfo;
1147
+ /** Run properties before the tracked change */
1148
+ previousFormatting?: TextFormatting;
1149
+ /** Run properties after the tracked change (editor model convenience) */
1150
+ currentFormatting?: TextFormatting;
1151
+ }
1152
+ /**
1153
+ * Paragraph property change (w:pPrChange)
1154
+ */
1155
+ interface ParagraphPropertyChange {
1156
+ type: 'paragraphPropertyChange';
1157
+ /** Tracked change metadata */
1158
+ info: PropertyChangeInfo;
1159
+ /** Paragraph properties before the tracked change */
1160
+ previousFormatting?: ParagraphFormatting;
1161
+ /** Paragraph properties after the tracked change (editor model convenience) */
1162
+ currentFormatting?: ParagraphFormatting;
1163
+ }
1164
+ /**
1165
+ * Table property change (w:tblPrChange)
1166
+ */
1167
+ interface TablePropertyChange {
1168
+ type: 'tablePropertyChange';
1169
+ /** Tracked change metadata */
1170
+ info: PropertyChangeInfo;
1171
+ /** Table properties before the tracked change */
1172
+ previousFormatting?: TableFormatting;
1173
+ /** Table properties after the tracked change (editor model convenience) */
1174
+ currentFormatting?: TableFormatting;
1175
+ }
1176
+ /**
1177
+ * Table row property change (w:trPrChange)
1178
+ */
1179
+ interface TableRowPropertyChange {
1180
+ type: 'tableRowPropertyChange';
1181
+ /** Tracked change metadata */
1182
+ info: PropertyChangeInfo;
1183
+ /** Row properties before the tracked change */
1184
+ previousFormatting?: TableRowFormatting;
1185
+ /** Row properties after the tracked change (editor model convenience) */
1186
+ currentFormatting?: TableRowFormatting;
1187
+ }
1188
+ /**
1189
+ * Table cell property change (w:tcPrChange)
1190
+ */
1191
+ interface TableCellPropertyChange {
1192
+ type: 'tableCellPropertyChange';
1193
+ /** Tracked change metadata */
1194
+ info: PropertyChangeInfo;
1195
+ /** Cell properties before the tracked change */
1196
+ previousFormatting?: TableCellFormatting;
1197
+ /** Cell properties after the tracked change (editor model convenience) */
1198
+ currentFormatting?: TableCellFormatting;
1199
+ }
1200
+ /**
1201
+ * Table structural tracked change metadata (row/cell insert/delete/merge)
1202
+ */
1203
+ interface TableStructuralChangeInfo {
1204
+ type: 'tableRowInsertion' | 'tableRowDeletion' | 'tableCellInsertion' | 'tableCellDeletion' | 'tableCellMerge';
1205
+ /** Tracked change metadata */
1206
+ info: TrackedChangeInfo;
1207
+ }
1208
+ /**
1209
+ * SDT type (content control type)
1210
+ */
1211
+ type SdtType = 'richText' | 'plainText' | 'date' | 'dropdown' | 'comboBox' | 'checkbox' | 'picture' | 'buildingBlockGallery' | 'group' | 'unknown';
1212
+ /**
1213
+ * SDT properties (w:sdtPr)
1214
+ */
1215
+ interface SdtProperties {
1216
+ /** SDT type */
1217
+ sdtType: SdtType;
1218
+ /** Alias (friendly name) */
1219
+ alias?: string;
1220
+ /** Tag (developer identifier) */
1221
+ tag?: string;
1222
+ /** Lock content editing */
1223
+ lock?: 'sdtLocked' | 'contentLocked' | 'sdtContentLocked' | 'unlocked';
1224
+ /** Placeholder text */
1225
+ placeholder?: string;
1226
+ /** Whether showing placeholder */
1227
+ showingPlaceholder?: boolean;
1228
+ /** Date format for date controls */
1229
+ dateFormat?: string;
1230
+ /** Dropdown/combobox list items */
1231
+ listItems?: {
1232
+ displayText: string;
1233
+ value: string;
1234
+ }[];
1235
+ /** Checkbox checked state */
1236
+ checked?: boolean;
1237
+ }
1238
+ /**
1239
+ * Inline SDT (content control within a paragraph)
1240
+ */
1241
+ interface InlineSdt {
1242
+ type: 'inlineSdt';
1243
+ /** SDT properties */
1244
+ properties: SdtProperties;
1245
+ /** Content runs inside the control */
1246
+ content: (Run | Hyperlink)[];
1247
+ }
1248
+ /**
1249
+ * Block-level SDT (content control wrapping paragraphs/tables)
1250
+ */
1251
+ interface BlockSdt {
1252
+ type: 'blockSdt';
1253
+ /** SDT properties */
1254
+ properties: SdtProperties;
1255
+ /** Block content inside the control */
1256
+ content: (Paragraph | Table)[];
1257
+ }
1258
+ /**
1259
+ * Paragraph content types
1260
+ */
1261
+ type ParagraphContent = Run | Hyperlink | BookmarkStart | BookmarkEnd | SimpleField | ComplexField | InlineSdt | CommentRangeStart | CommentRangeEnd | Insertion | Deletion | MoveFrom | MoveTo | MoveFromRangeStart | MoveFromRangeEnd | MoveToRangeStart | MoveToRangeEnd | MathEquation;
1262
+ /**
1263
+ * Paragraph (w:p)
1264
+ */
1265
+ interface Paragraph {
1266
+ type: 'paragraph';
1267
+ /** Unique paragraph ID */
1268
+ paraId?: string;
1269
+ /** Text ID */
1270
+ textId?: string;
1271
+ /** Paragraph formatting */
1272
+ formatting?: ParagraphFormatting;
1273
+ /** Paragraph-level tracked property changes (w:pPrChange) */
1274
+ propertyChanges?: ParagraphPropertyChange[];
1275
+ /** Paragraph content */
1276
+ content: ParagraphContent[];
1277
+ /** Computed list rendering (if this is a list item) */
1278
+ listRendering?: ListRendering;
1279
+ /** Section properties (if this paragraph ends a section) */
1280
+ sectionProperties?: SectionProperties;
1281
+ }
1282
+ /**
1283
+ * Header/footer type
1284
+ */
1285
+ type HeaderFooterType = 'default' | 'first' | 'even';
1286
+ /**
1287
+ * Header or footer reference
1288
+ */
1289
+ interface HeaderReference {
1290
+ type: HeaderFooterType;
1291
+ rId: string;
1292
+ }
1293
+ interface FooterReference {
1294
+ type: HeaderFooterType;
1295
+ rId: string;
1296
+ }
1297
+ /**
1298
+ * Header or footer content
1299
+ */
1300
+ interface HeaderFooter {
1301
+ type: 'header' | 'footer';
1302
+ /** Header/footer type */
1303
+ hdrFtrType: HeaderFooterType;
1304
+ /** Content (paragraphs, tables, etc.) */
1305
+ content: (Paragraph | Table)[];
1306
+ }
1307
+ /**
1308
+ * Footnote position
1309
+ */
1310
+ type FootnotePosition = 'pageBottom' | 'beneathText' | 'sectEnd' | 'docEnd';
1311
+ /**
1312
+ * Endnote position
1313
+ */
1314
+ type EndnotePosition = 'sectEnd' | 'docEnd';
1315
+ /**
1316
+ * Number restart type
1317
+ */
1318
+ type NoteNumberRestart = 'continuous' | 'eachSect' | 'eachPage';
1319
+ /**
1320
+ * Footnote properties
1321
+ */
1322
+ interface FootnoteProperties {
1323
+ position?: FootnotePosition;
1324
+ numFmt?: NumberFormat;
1325
+ numStart?: number;
1326
+ numRestart?: NoteNumberRestart;
1327
+ }
1328
+ /**
1329
+ * Endnote properties
1330
+ */
1331
+ interface EndnoteProperties {
1332
+ position?: EndnotePosition;
1333
+ numFmt?: NumberFormat;
1334
+ numStart?: number;
1335
+ numRestart?: NoteNumberRestart;
1336
+ }
1337
+ /**
1338
+ * Footnote (w:footnote)
1339
+ */
1340
+ interface Footnote {
1341
+ type: 'footnote';
1342
+ /** Footnote ID */
1343
+ id: number;
1344
+ /** Special footnote type */
1345
+ noteType?: 'normal' | 'separator' | 'continuationSeparator' | 'continuationNotice';
1346
+ /** Content */
1347
+ content: Paragraph[];
1348
+ }
1349
+ /**
1350
+ * Endnote (w:endnote)
1351
+ */
1352
+ interface Endnote {
1353
+ type: 'endnote';
1354
+ /** Endnote ID */
1355
+ id: number;
1356
+ /** Special endnote type */
1357
+ noteType?: 'normal' | 'separator' | 'continuationSeparator' | 'continuationNotice';
1358
+ /** Content */
1359
+ content: Paragraph[];
1360
+ }
1361
+ /**
1362
+ * Page orientation
1363
+ */
1364
+ type PageOrientation = 'portrait' | 'landscape';
1365
+ /**
1366
+ * Section start type
1367
+ */
1368
+ type SectionStart = 'continuous' | 'nextPage' | 'oddPage' | 'evenPage' | 'nextColumn';
1369
+ /**
1370
+ * Vertical alignment
1371
+ */
1372
+ type VerticalAlign = 'top' | 'center' | 'both' | 'bottom';
1373
+ /**
1374
+ * Line number restart type
1375
+ */
1376
+ type LineNumberRestart = 'continuous' | 'newPage' | 'newSection';
1377
+ /**
1378
+ * Column definition
1379
+ */
1380
+ interface Column {
1381
+ /** Column width in twips */
1382
+ width?: number;
1383
+ /** Space after column in twips */
1384
+ space?: number;
1385
+ }
1386
+ /**
1387
+ * Section properties (w:sectPr)
1388
+ */
1389
+ interface SectionProperties {
1390
+ /** Page width in twips */
1391
+ pageWidth?: number;
1392
+ /** Page height in twips */
1393
+ pageHeight?: number;
1394
+ /** Page orientation */
1395
+ orientation?: PageOrientation;
1396
+ /** Top margin in twips */
1397
+ marginTop?: number;
1398
+ /** Bottom margin in twips */
1399
+ marginBottom?: number;
1400
+ /** Left margin in twips */
1401
+ marginLeft?: number;
1402
+ /** Right margin in twips */
1403
+ marginRight?: number;
1404
+ /** Header distance from top in twips */
1405
+ headerDistance?: number;
1406
+ /** Footer distance from bottom in twips */
1407
+ footerDistance?: number;
1408
+ /** Gutter margin in twips */
1409
+ gutter?: number;
1410
+ /** Number of columns */
1411
+ columnCount?: number;
1412
+ /** Space between columns in twips */
1413
+ columnSpace?: number;
1414
+ /** Equal width columns */
1415
+ equalWidth?: boolean;
1416
+ /** Separator line between columns */
1417
+ separator?: boolean;
1418
+ /** Individual column definitions */
1419
+ columns?: Column[];
1420
+ /** Section start type */
1421
+ sectionStart?: SectionStart;
1422
+ /** Vertical alignment of text */
1423
+ verticalAlign?: VerticalAlign;
1424
+ /** Right-to-left section */
1425
+ bidi?: boolean;
1426
+ /** Header references */
1427
+ headerReferences?: HeaderReference[];
1428
+ /** Footer references */
1429
+ footerReferences?: FooterReference[];
1430
+ /** Different first page header/footer */
1431
+ titlePg?: boolean;
1432
+ /** Different odd/even page headers/footers */
1433
+ evenAndOddHeaders?: boolean;
1434
+ /** Line numbering settings */
1435
+ lineNumbers?: {
1436
+ start?: number;
1437
+ countBy?: number;
1438
+ distance?: number;
1439
+ restart?: LineNumberRestart;
1440
+ };
1441
+ /** Page borders */
1442
+ pageBorders?: {
1443
+ top?: BorderSpec;
1444
+ bottom?: BorderSpec;
1445
+ left?: BorderSpec;
1446
+ right?: BorderSpec;
1447
+ /** Display setting */
1448
+ display?: 'allPages' | 'firstPage' | 'notFirstPage';
1449
+ /** Offset from */
1450
+ offsetFrom?: 'page' | 'text';
1451
+ /** Z-order */
1452
+ zOrder?: 'front' | 'back';
1453
+ };
1454
+ /** Page background */
1455
+ background?: {
1456
+ color?: ColorValue;
1457
+ themeColor?: ThemeColorSlot;
1458
+ themeTint?: string;
1459
+ themeShade?: string;
1460
+ };
1461
+ /** Footnote properties for this section */
1462
+ footnotePr?: FootnoteProperties;
1463
+ /** Endnote properties for this section */
1464
+ endnotePr?: EndnoteProperties;
1465
+ /** Document grid */
1466
+ docGrid?: {
1467
+ type?: 'default' | 'lines' | 'linesAndChars' | 'snapToChars';
1468
+ linePitch?: number;
1469
+ charSpace?: number;
1470
+ };
1471
+ /** First page paper source */
1472
+ paperSrcFirst?: number;
1473
+ /** Other pages paper source */
1474
+ paperSrcOther?: number;
1475
+ }
1476
+ /**
1477
+ * Block-level content types
1478
+ */
1479
+ type BlockContent = Paragraph | Table | BlockSdt;
1480
+ /**
1481
+ * Section (implicit or explicit based on sectPr)
1482
+ */
1483
+ interface Section {
1484
+ /** Section properties */
1485
+ properties: SectionProperties;
1486
+ /** Content in this section */
1487
+ content: BlockContent[];
1488
+ /** Headers for this section */
1489
+ headers?: Map<HeaderFooterType, HeaderFooter>;
1490
+ /** Footers for this section */
1491
+ footers?: Map<HeaderFooterType, HeaderFooter>;
1492
+ }
1493
+ /**
1494
+ * Document body (w:body)
1495
+ */
1496
+ interface DocumentBody {
1497
+ /** All content (paragraphs, tables) */
1498
+ content: BlockContent[];
1499
+ /** Sections (derived from sectPr in paragraphs and final sectPr) */
1500
+ sections?: Section[];
1501
+ /** Final section properties (from body's sectPr) */
1502
+ finalSectionProperties?: SectionProperties;
1503
+ /** Comments from comments.xml */
1504
+ comments?: Comment[];
1505
+ }
1506
+
1507
+ /**
1508
+ * Styles, Theme, Font Table, Relationships & Media Types
1509
+ *
1510
+ * Types for document-level definitions that don't form the content tree.
1511
+ */
1512
+
1513
+ /**
1514
+ * Style type
1515
+ */
1516
+ type StyleType = 'paragraph' | 'character' | 'numbering' | 'table';
1517
+ /**
1518
+ * Style definition
1519
+ */
1520
+ interface Style {
1521
+ /** Style ID */
1522
+ styleId: string;
1523
+ /** Style type */
1524
+ type: StyleType;
1525
+ /** Display name */
1526
+ name?: string;
1527
+ /** Based on style ID */
1528
+ basedOn?: string;
1529
+ /** Next style after Enter (for paragraph styles) */
1530
+ next?: string;
1531
+ /** Linked style (paragraph/character pair) */
1532
+ link?: string;
1533
+ /** UI sort priority */
1534
+ uiPriority?: number;
1535
+ /** Hidden from UI */
1536
+ hidden?: boolean;
1537
+ /** Semi-hidden from UI */
1538
+ semiHidden?: boolean;
1539
+ /** Unhide when used */
1540
+ unhideWhenUsed?: boolean;
1541
+ /** Quick format in gallery */
1542
+ qFormat?: boolean;
1543
+ /** Is default style */
1544
+ default?: boolean;
1545
+ /** Personal style (custom) */
1546
+ personal?: boolean;
1547
+ /** Paragraph properties (for paragraph/table styles) */
1548
+ pPr?: ParagraphFormatting;
1549
+ /** Run properties */
1550
+ rPr?: TextFormatting;
1551
+ /** Table properties (for table styles) */
1552
+ tblPr?: TableFormatting;
1553
+ /** Table row properties */
1554
+ trPr?: TableRowFormatting;
1555
+ /** Table cell properties */
1556
+ tcPr?: TableCellFormatting;
1557
+ /** Conditional table style parts */
1558
+ tblStylePr?: Array<{
1559
+ type: 'band1Horz' | 'band1Vert' | 'band2Horz' | 'band2Vert' | 'firstCol' | 'firstRow' | 'lastCol' | 'lastRow' | 'neCell' | 'nwCell' | 'seCell' | 'swCell';
1560
+ pPr?: ParagraphFormatting;
1561
+ rPr?: TextFormatting;
1562
+ tblPr?: TableFormatting;
1563
+ trPr?: TableRowFormatting;
1564
+ tcPr?: TableCellFormatting;
1565
+ }>;
1566
+ }
1567
+ /**
1568
+ * Document defaults (w:docDefaults)
1569
+ */
1570
+ interface DocDefaults {
1571
+ /** Default run properties */
1572
+ rPr?: TextFormatting;
1573
+ /** Default paragraph properties */
1574
+ pPr?: ParagraphFormatting;
1575
+ }
1576
+ /**
1577
+ * Style definitions from styles.xml
1578
+ */
1579
+ interface StyleDefinitions {
1580
+ /** Document defaults */
1581
+ docDefaults?: DocDefaults;
1582
+ /** Latent styles */
1583
+ latentStyles?: {
1584
+ defLockedState?: boolean;
1585
+ defUIPriority?: number;
1586
+ defSemiHidden?: boolean;
1587
+ defUnhideWhenUsed?: boolean;
1588
+ defQFormat?: boolean;
1589
+ count?: number;
1590
+ };
1591
+ /** Style definitions */
1592
+ styles: Style[];
1593
+ }
1594
+ /**
1595
+ * Theme color scheme (a:clrScheme)
1596
+ */
1597
+ interface ThemeColorScheme {
1598
+ /** Dark 1 color (usually black) */
1599
+ dk1?: string;
1600
+ /** Light 1 color (usually white) */
1601
+ lt1?: string;
1602
+ /** Dark 2 color */
1603
+ dk2?: string;
1604
+ /** Light 2 color */
1605
+ lt2?: string;
1606
+ /** Accent colors 1-6 */
1607
+ accent1?: string;
1608
+ accent2?: string;
1609
+ accent3?: string;
1610
+ accent4?: string;
1611
+ accent5?: string;
1612
+ accent6?: string;
1613
+ /** Hyperlink color */
1614
+ hlink?: string;
1615
+ /** Followed hyperlink color */
1616
+ folHlink?: string;
1617
+ }
1618
+ /**
1619
+ * Theme font (with script variants)
1620
+ */
1621
+ interface ThemeFont {
1622
+ /** Latin font */
1623
+ latin?: string;
1624
+ /** East Asian font */
1625
+ ea?: string;
1626
+ /** Complex script font */
1627
+ cs?: string;
1628
+ /** Script-specific fonts */
1629
+ fonts?: Record<string, string>;
1630
+ }
1631
+ /**
1632
+ * Theme font scheme (a:fontScheme)
1633
+ */
1634
+ interface ThemeFontScheme {
1635
+ /** Major font (headings) */
1636
+ majorFont?: ThemeFont;
1637
+ /** Minor font (body text) */
1638
+ minorFont?: ThemeFont;
1639
+ }
1640
+ /**
1641
+ * Theme (from theme1.xml)
1642
+ */
1643
+ interface Theme {
1644
+ /** Theme name */
1645
+ name?: string;
1646
+ /** Color scheme */
1647
+ colorScheme?: ThemeColorScheme;
1648
+ /** Font scheme */
1649
+ fontScheme?: ThemeFontScheme;
1650
+ /** Format scheme (fills, lines, effects) - simplified */
1651
+ formatScheme?: {
1652
+ name?: string;
1653
+ };
1654
+ }
1655
+ /**
1656
+ * Font info from fontTable.xml
1657
+ */
1658
+ interface FontInfo {
1659
+ /** Font name */
1660
+ name: string;
1661
+ /** Alternate names */
1662
+ altName?: string;
1663
+ /** Panose-1 classification */
1664
+ panose1?: string;
1665
+ /** Character set */
1666
+ charset?: string;
1667
+ /** Font family type */
1668
+ family?: 'decorative' | 'modern' | 'roman' | 'script' | 'swiss' | 'auto';
1669
+ /** Pitch (fixed or variable) */
1670
+ pitch?: 'default' | 'fixed' | 'variable';
1671
+ /** Signature */
1672
+ sig?: {
1673
+ usb0?: string;
1674
+ usb1?: string;
1675
+ usb2?: string;
1676
+ usb3?: string;
1677
+ csb0?: string;
1678
+ csb1?: string;
1679
+ };
1680
+ /** Embedded font data reference */
1681
+ embedRegular?: string;
1682
+ embedBold?: string;
1683
+ embedItalic?: string;
1684
+ embedBoldItalic?: string;
1685
+ }
1686
+ /**
1687
+ * Font table from fontTable.xml
1688
+ */
1689
+ interface FontTable {
1690
+ fonts: FontInfo[];
1691
+ }
1692
+ /**
1693
+ * Relationship type
1694
+ */
1695
+ 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;
1696
+ /**
1697
+ * Relationship entry
1698
+ */
1699
+ interface Relationship {
1700
+ /** Relationship ID (e.g., "rId1") */
1701
+ id: string;
1702
+ /** Relationship type URI */
1703
+ type: RelationshipType;
1704
+ /** Target path or URL */
1705
+ target: string;
1706
+ /** Target mode */
1707
+ targetMode?: 'External' | 'Internal';
1708
+ }
1709
+ /**
1710
+ * Relationship map (keyed by rId)
1711
+ */
1712
+ type RelationshipMap = Map<string, Relationship>;
1713
+ /**
1714
+ * Media file from word/media/
1715
+ */
1716
+ interface MediaFile {
1717
+ /** File path in ZIP */
1718
+ path: string;
1719
+ /** Original filename */
1720
+ filename?: string;
1721
+ /** MIME type */
1722
+ mimeType: string;
1723
+ /** Binary data */
1724
+ data: ArrayBuffer;
1725
+ /** Base64 encoded data for rendering */
1726
+ base64?: string;
1727
+ /** Data URL for direct use in src attributes */
1728
+ dataUrl?: string;
1729
+ }
1730
+
1731
+ /**
1732
+ * Comprehensive TypeScript types for full DOCX document representation
1733
+ *
1734
+ * This barrel file re-exports all types from the split modules.
1735
+ * Existing imports from './types/document' continue to work unchanged.
1736
+ *
1737
+ * Module structure:
1738
+ * - colors.ts — Color primitives, borders, shading
1739
+ * - formatting.ts — Text, paragraph, and table formatting properties
1740
+ * - lists.ts — Numbering and list definitions
1741
+ * - content.ts — Content model (runs, images, shapes, tables, paragraphs, sections)
1742
+ * - styles.ts — Styles, theme, fonts, relationships, media
1743
+ */
1744
+
1745
+ /**
1746
+ * Complete DOCX package structure
1747
+ */
1748
+ interface DocxPackage {
1749
+ /** Document body */
1750
+ document: DocumentBody;
1751
+ /** Style definitions */
1752
+ styles?: StyleDefinitions;
1753
+ /** Theme */
1754
+ theme?: Theme;
1755
+ /** Numbering definitions */
1756
+ numbering?: NumberingDefinitions;
1757
+ /** Font table */
1758
+ fontTable?: FontTable;
1759
+ /** Footnotes */
1760
+ footnotes?: Footnote[];
1761
+ /** Endnotes */
1762
+ endnotes?: Endnote[];
1763
+ /** Headers by relationship ID */
1764
+ headers?: Map<string, HeaderFooter>;
1765
+ /** Footers by relationship ID */
1766
+ footers?: Map<string, HeaderFooter>;
1767
+ /** Document relationships */
1768
+ relationships?: RelationshipMap;
1769
+ /** Media files */
1770
+ media?: Map<string, MediaFile>;
1771
+ /** Document properties */
1772
+ properties?: {
1773
+ title?: string;
1774
+ subject?: string;
1775
+ creator?: string;
1776
+ keywords?: string;
1777
+ description?: string;
1778
+ lastModifiedBy?: string;
1779
+ revision?: number;
1780
+ created?: Date;
1781
+ modified?: Date;
1782
+ };
1783
+ }
1784
+ /**
1785
+ * Complete parsed DOCX document
1786
+ */
1787
+ interface Document {
1788
+ /** DOCX package with all parsed content */
1789
+ package: DocxPackage;
1790
+ /** Original ArrayBuffer for round-trip */
1791
+ originalBuffer?: ArrayBuffer;
1792
+ /** Detected template variables ({{...}}) */
1793
+ templateVariables?: string[];
1794
+ /** Parsing warnings/errors */
1795
+ warnings?: string[];
1796
+ }
1797
+
1798
+ /**
1799
+ * Agent API Types
1800
+ *
1801
+ * TypeScript interfaces for the agent API:
1802
+ * - Position and Range types
1803
+ * - Command types for document manipulation
1804
+ * - Context types for AI agents
1805
+ */
1806
+
1807
+ /**
1808
+ * Position within a document
1809
+ */
1810
+ interface Position {
1811
+ /** Index of the paragraph (0-indexed) */
1812
+ paragraphIndex: number;
1813
+ /** Offset within the paragraph in characters */
1814
+ offset: number;
1815
+ /** Optional: Content index within paragraph (run, hyperlink, etc.) */
1816
+ contentIndex?: number;
1817
+ /** Optional: Section index */
1818
+ sectionIndex?: number;
1819
+ }
1820
+ /**
1821
+ * Range within a document
1822
+ */
1823
+ interface Range {
1824
+ /** Start position */
1825
+ start: Position;
1826
+ /** End position */
1827
+ end: Position;
1828
+ /** Whether the range is collapsed (cursor position) */
1829
+ collapsed?: boolean;
1830
+ }
1831
+ /**
1832
+ * Create a collapsed range (cursor) at a position
1833
+ */
1834
+ declare function createCollapsedRange(position: Position): Range;
1835
+ /**
1836
+ * Create a range from two positions
1837
+ */
1838
+ declare function createRange(start: Position, end: Position): Range;
1839
+ /**
1840
+ * Check if a position is within a range
1841
+ */
1842
+ declare function isPositionInRange(position: Position, range: Range): boolean;
1843
+ /**
1844
+ * Compare two positions
1845
+ * Returns: -1 if a < b, 0 if equal, 1 if a > b
1846
+ */
1847
+ declare function comparePositions(a: Position, b: Position): -1 | 0 | 1;
1848
+ /**
1849
+ * Base command interface
1850
+ */
1851
+ interface BaseCommand {
1852
+ /** Command type */
1853
+ type: string;
1854
+ /** Unique command ID (for undo tracking) */
1855
+ id?: string;
1856
+ }
1857
+ /**
1858
+ * Insert text at a position
1859
+ */
1860
+ interface InsertTextCommand extends BaseCommand {
1861
+ type: 'insertText';
1862
+ /** Position to insert at */
1863
+ position: Position;
1864
+ /** Text to insert */
1865
+ text: string;
1866
+ /** Optional formatting for the inserted text */
1867
+ formatting?: TextFormatting;
1868
+ }
1869
+ /**
1870
+ * Replace text in a range
1871
+ */
1872
+ interface ReplaceTextCommand extends BaseCommand {
1873
+ type: 'replaceText';
1874
+ /** Range to replace */
1875
+ range: Range;
1876
+ /** Replacement text */
1877
+ text: string;
1878
+ /** Optional formatting for the new text */
1879
+ formatting?: TextFormatting;
1880
+ }
1881
+ /**
1882
+ * Delete text in a range
1883
+ */
1884
+ interface DeleteTextCommand extends BaseCommand {
1885
+ type: 'deleteText';
1886
+ /** Range to delete */
1887
+ range: Range;
1888
+ }
1889
+ /**
1890
+ * Apply formatting to a range
1891
+ */
1892
+ interface FormatTextCommand extends BaseCommand {
1893
+ type: 'formatText';
1894
+ /** Range to format */
1895
+ range: Range;
1896
+ /** Formatting to apply */
1897
+ formatting: Partial<TextFormatting>;
1898
+ }
1899
+ /**
1900
+ * Apply paragraph formatting
1901
+ */
1902
+ interface FormatParagraphCommand extends BaseCommand {
1903
+ type: 'formatParagraph';
1904
+ /** Paragraph index */
1905
+ paragraphIndex: number;
1906
+ /** Formatting to apply */
1907
+ formatting: Partial<ParagraphFormatting>;
1908
+ }
1909
+ /**
1910
+ * Apply a named style to a paragraph
1911
+ */
1912
+ interface ApplyStyleCommand extends BaseCommand {
1913
+ type: 'applyStyle';
1914
+ /** Paragraph index */
1915
+ paragraphIndex: number;
1916
+ /** Style ID to apply */
1917
+ styleId: string;
1918
+ }
1919
+ /**
1920
+ * Insert a table at a position
1921
+ */
1922
+ interface InsertTableCommand extends BaseCommand {
1923
+ type: 'insertTable';
1924
+ /** Position to insert at */
1925
+ position: Position;
1926
+ /** Number of rows */
1927
+ rows: number;
1928
+ /** Number of columns */
1929
+ columns: number;
1930
+ /** Optional table data */
1931
+ data?: string[][];
1932
+ /** Optional header row */
1933
+ hasHeader?: boolean;
1934
+ }
1935
+ /**
1936
+ * Insert an image at a position
1937
+ */
1938
+ interface InsertImageCommand extends BaseCommand {
1939
+ type: 'insertImage';
1940
+ /** Position to insert at */
1941
+ position: Position;
1942
+ /** Image source (base64 or URL) */
1943
+ src: string;
1944
+ /** Image width in pixels */
1945
+ width?: number;
1946
+ /** Image height in pixels */
1947
+ height?: number;
1948
+ /** Alt text */
1949
+ alt?: string;
1950
+ }
1951
+ /**
1952
+ * Insert a hyperlink at a range
1953
+ */
1954
+ interface InsertHyperlinkCommand extends BaseCommand {
1955
+ type: 'insertHyperlink';
1956
+ /** Range to make into a hyperlink */
1957
+ range: Range;
1958
+ /** URL of the hyperlink */
1959
+ url: string;
1960
+ /** Display text (replaces range text if provided) */
1961
+ displayText?: string;
1962
+ /** Tooltip */
1963
+ tooltip?: string;
1964
+ }
1965
+ /**
1966
+ * Remove a hyperlink but keep the text
1967
+ */
1968
+ interface RemoveHyperlinkCommand extends BaseCommand {
1969
+ type: 'removeHyperlink';
1970
+ /** Range containing the hyperlink */
1971
+ range: Range;
1972
+ }
1973
+ /**
1974
+ * Insert a paragraph break
1975
+ */
1976
+ interface InsertParagraphBreakCommand extends BaseCommand {
1977
+ type: 'insertParagraphBreak';
1978
+ /** Position to break at */
1979
+ position: Position;
1980
+ }
1981
+ /**
1982
+ * Merge paragraphs
1983
+ */
1984
+ interface MergeParagraphsCommand extends BaseCommand {
1985
+ type: 'mergeParagraphs';
1986
+ /** First paragraph index */
1987
+ paragraphIndex: number;
1988
+ /** Number of paragraphs to merge with */
1989
+ count: number;
1990
+ }
1991
+ /**
1992
+ * Split a paragraph
1993
+ */
1994
+ interface SplitParagraphCommand extends BaseCommand {
1995
+ type: 'splitParagraph';
1996
+ /** Position to split at */
1997
+ position: Position;
1998
+ }
1999
+ /**
2000
+ * Set template variable value
2001
+ */
2002
+ interface SetVariableCommand extends BaseCommand {
2003
+ type: 'setVariable';
2004
+ /** Variable name */
2005
+ name: string;
2006
+ /** Variable value */
2007
+ value: string;
2008
+ }
2009
+ /**
2010
+ * Apply all template variables
2011
+ */
2012
+ interface ApplyVariablesCommand extends BaseCommand {
2013
+ type: 'applyVariables';
2014
+ /** Variable values */
2015
+ values: Record<string, string>;
2016
+ }
2017
+ /**
2018
+ * Union of all command types
2019
+ */
2020
+ type AgentCommand = InsertTextCommand | ReplaceTextCommand | DeleteTextCommand | FormatTextCommand | FormatParagraphCommand | ApplyStyleCommand | InsertTableCommand | InsertImageCommand | InsertHyperlinkCommand | RemoveHyperlinkCommand | InsertParagraphBreakCommand | MergeParagraphsCommand | SplitParagraphCommand | SetVariableCommand | ApplyVariablesCommand;
2021
+ /**
2022
+ * Document context for AI agents
2023
+ */
2024
+ interface AgentContext {
2025
+ /** Total paragraph count */
2026
+ paragraphCount: number;
2027
+ /** Total word count (approximate) */
2028
+ wordCount: number;
2029
+ /** Total character count */
2030
+ characterCount: number;
2031
+ /** Detected template variables */
2032
+ variables: string[];
2033
+ /** Variable count */
2034
+ variableCount: number;
2035
+ /** Available styles */
2036
+ availableStyles: StyleInfo[];
2037
+ /** Content outline (first N chars per paragraph) */
2038
+ outline: ParagraphOutline[];
2039
+ /** Document sections info */
2040
+ sections: SectionInfo[];
2041
+ /** Has tables */
2042
+ hasTables: boolean;
2043
+ /** Has images */
2044
+ hasImages: boolean;
2045
+ /** Has hyperlinks */
2046
+ hasHyperlinks: boolean;
2047
+ /** Document language */
2048
+ language?: string;
2049
+ }
2050
+ /**
2051
+ * Style information for context
2052
+ */
2053
+ interface StyleInfo {
2054
+ /** Style ID */
2055
+ id: string;
2056
+ /** Display name */
2057
+ name: string;
2058
+ /** Style type */
2059
+ type: 'paragraph' | 'character' | 'table';
2060
+ /** Is built-in style */
2061
+ builtIn?: boolean;
2062
+ }
2063
+ /**
2064
+ * Paragraph outline for context
2065
+ */
2066
+ interface ParagraphOutline {
2067
+ /** Paragraph index */
2068
+ index: number;
2069
+ /** First N characters */
2070
+ preview: string;
2071
+ /** Paragraph style */
2072
+ style?: string;
2073
+ /** Is heading */
2074
+ isHeading?: boolean;
2075
+ /** Heading level (1-9) */
2076
+ headingLevel?: number;
2077
+ /** Is list item */
2078
+ isListItem?: boolean;
2079
+ /** Is empty paragraph */
2080
+ isEmpty?: boolean;
2081
+ }
2082
+ /**
2083
+ * Section information
2084
+ */
2085
+ interface SectionInfo {
2086
+ /** Section index */
2087
+ index: number;
2088
+ /** Number of paragraphs */
2089
+ paragraphCount: number;
2090
+ /** Page size */
2091
+ pageSize?: {
2092
+ width: number;
2093
+ height: number;
2094
+ };
2095
+ /** Is landscape */
2096
+ isLandscape?: boolean;
2097
+ /** Has header */
2098
+ hasHeader?: boolean;
2099
+ /** Has footer */
2100
+ hasFooter?: boolean;
2101
+ }
2102
+ /**
2103
+ * Context about the current selection
2104
+ */
2105
+ interface SelectionContext {
2106
+ /** Selected text */
2107
+ selectedText: string;
2108
+ /** Selection range */
2109
+ range: Range;
2110
+ /** Current formatting of selection */
2111
+ formatting: Partial<TextFormatting>;
2112
+ /** Current paragraph formatting */
2113
+ paragraphFormatting: Partial<ParagraphFormatting>;
2114
+ /** Text before selection (context) */
2115
+ textBefore: string;
2116
+ /** Text after selection (context) */
2117
+ textAfter: string;
2118
+ /** Paragraph containing selection */
2119
+ paragraph: ParagraphContext;
2120
+ /** Is selection within a table */
2121
+ inTable?: boolean;
2122
+ /** Is selection within a hyperlink */
2123
+ inHyperlink?: boolean;
2124
+ /** Suggested actions based on selection */
2125
+ suggestedActions?: SuggestedAction[];
2126
+ }
2127
+ /**
2128
+ * Paragraph context for selection
2129
+ */
2130
+ interface ParagraphContext {
2131
+ /** Paragraph index */
2132
+ index: number;
2133
+ /** Full paragraph text */
2134
+ fullText: string;
2135
+ /** Paragraph style */
2136
+ style?: string;
2137
+ /** Word count */
2138
+ wordCount: number;
2139
+ }
2140
+ /**
2141
+ * Suggested action for context menu
2142
+ */
2143
+ interface SuggestedAction {
2144
+ /** Action ID */
2145
+ id: string;
2146
+ /** Display label */
2147
+ label: string;
2148
+ /** Description */
2149
+ description?: string;
2150
+ /** Icon name */
2151
+ icon?: string;
2152
+ /** Priority (higher = more prominent) */
2153
+ priority?: number;
2154
+ }
2155
+ /**
2156
+ * Response from an agent action
2157
+ */
2158
+ interface AgentResponse {
2159
+ /** Success status */
2160
+ success: boolean;
2161
+ /** New text to insert (for rewrite/expand/etc.) */
2162
+ newText?: string;
2163
+ /** New formatted content */
2164
+ newContent?: AgentContent[];
2165
+ /** Commands to execute */
2166
+ commands?: AgentCommand[];
2167
+ /** Error message if failed */
2168
+ error?: string;
2169
+ /** Warning messages */
2170
+ warnings?: string[];
2171
+ /** Metadata about the response */
2172
+ metadata?: Record<string, unknown>;
2173
+ }
2174
+ /**
2175
+ * Content block in agent response
2176
+ */
2177
+ interface AgentContent {
2178
+ /** Content type */
2179
+ type: 'text' | 'paragraph' | 'table' | 'image';
2180
+ /** Text content */
2181
+ text?: string;
2182
+ /** Formatting */
2183
+ formatting?: Partial<TextFormatting>;
2184
+ /** Paragraph formatting */
2185
+ paragraphFormatting?: Partial<ParagraphFormatting>;
2186
+ /** Table data (for table type) */
2187
+ tableData?: string[][];
2188
+ /** Image src (for image type) */
2189
+ imageSrc?: string;
2190
+ }
2191
+ /**
2192
+ * AI action types for context menu
2193
+ */
2194
+ type AIAction = 'askAI' | 'rewrite' | 'expand' | 'summarize' | 'translate' | 'explain' | 'fixGrammar' | 'makeFormal' | 'makeCasual' | 'custom';
2195
+ /**
2196
+ * AI action request
2197
+ */
2198
+ interface AIActionRequest {
2199
+ /** Action type */
2200
+ action: AIAction;
2201
+ /** Selection context */
2202
+ context: SelectionContext;
2203
+ /** Custom prompt (for 'custom' action) */
2204
+ customPrompt?: string;
2205
+ /** Target language (for 'translate' action) */
2206
+ targetLanguage?: string;
2207
+ /** Additional options */
2208
+ options?: Record<string, unknown>;
2209
+ }
2210
+ /**
2211
+ * Get action label
2212
+ */
2213
+ declare function getActionLabel(action: AIAction): string;
2214
+ /**
2215
+ * Get action description
2216
+ */
2217
+ declare function getActionDescription(action: AIAction): string;
2218
+ /**
2219
+ * Default AI actions for context menu
2220
+ */
2221
+ declare const DEFAULT_AI_ACTIONS: AIAction[];
2222
+ /**
2223
+ * Create a command with generated ID
2224
+ */
2225
+ declare function createCommand<T extends AgentCommand>(command: Omit<T, 'id'>): T;
2226
+
2227
+ export { createRange as $, type AgentCommand as A, type BreakContent as B, type SectionProperties as C, type Document as D, type Endnote as E, type Footnote as F, type SelectionContext as G, type Hyperlink as H, type Image as I, type SetVariableCommand as J, type Style as K, type ListLevel as L, type StyleDefinitions as M, type NumberingDefinitions as N, type StyleInfo as O, type Position as P, type SuggestedAction as Q, type Range as R, type SectionInfo as S, type TextFormatting as T, type TableCell as U, type TableRow as V, type TextContent as W, type Theme as X, comparePositions as Y, createCollapsedRange as Z, createCommand as _, type Paragraph as a, getActionDescription as a0, getActionLabel as a1, isPositionInRange as a2, type BookmarkEnd as a3, type BookmarkStart as a4, type Field as a5, type FooterReference as a6, type HeaderFooter as a7, type HeaderReference as a8, type Shape as a9, type TextBox as aa, type ThemeColorScheme as ab, type ThemeFont as ac, type ThemeFontScheme as ad, type ColorValue as ae, type ThemeColorSlot as af, type ParagraphAlignment as ag, type StyleType as ah, type TabStop as ai, type ShadingProperties as aj, type Run as b, type RunContent as c, type DocumentBody as d, type Table as e, type AIAction as f, type AIActionRequest as g, type AgentContext as h, type AgentResponse as i, type ApplyStyleCommand as j, type ApplyVariablesCommand as k, type BlockContent as l, DEFAULT_AI_ACTIONS as m, type DeleteTextCommand as n, type DocxPackage as o, type FormatParagraphCommand as p, type FormatTextCommand as q, type InsertHyperlinkCommand as r, type InsertImageCommand as s, type InsertTableCommand as t, type InsertTextCommand as u, type ParagraphContext as v, type ParagraphFormatting as w, type ParagraphOutline as x, type Relationship as y, type ReplaceTextCommand as z };