@eigenpal/docx-editor-core 1.0.3 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (266) hide show
  1. package/LICENSE +13 -16
  2. package/dist/agent/index.d.mts +42 -7
  3. package/dist/agent/index.d.ts +42 -7
  4. package/dist/agent/index.js +1 -1
  5. package/dist/agent/index.mjs +1 -1
  6. package/dist/chunk-2EQGBVPV.js +2 -0
  7. package/dist/chunk-2XP6GLA4.mjs +1 -0
  8. package/dist/chunk-44FHVKSI.js +1 -0
  9. package/dist/{chunk-2IE6UDHJ.mjs → chunk-44JKHPGF.mjs} +1 -1
  10. package/dist/{chunk-ABBG4WD2.js → chunk-4QEETB7U.js} +2 -2
  11. package/dist/chunk-53VKL6CG.js +1 -0
  12. package/dist/chunk-5BLQHXWK.mjs +1 -0
  13. package/dist/chunk-5M7TI6TV.js +1 -0
  14. package/dist/chunk-6JKM7TWJ.mjs +1 -0
  15. package/dist/{chunk-EQVNAHL7.mjs → chunk-6Y6LON6Y.mjs} +1 -1
  16. package/dist/{chunk-QVEAQOMR.mjs → chunk-6ZXL3EIP.mjs} +1 -1
  17. package/dist/{chunk-GHQS3I2W.mjs → chunk-7BVHKWEW.mjs} +1 -1
  18. package/dist/chunk-7HANRHHL.js +1 -0
  19. package/dist/chunk-7LRR7RKE.mjs +15 -0
  20. package/dist/chunk-7OW3VCZE.mjs +1 -0
  21. package/dist/chunk-7ZN4WI5N.mjs +4 -0
  22. package/dist/chunk-AMB6Y77B.js +1 -0
  23. package/dist/{chunk-3JXR6YU4.mjs → chunk-BOOHU5EW.mjs} +1 -1
  24. package/dist/{chunk-XBHF5Q2F.js → chunk-BXWOLARZ.js} +1 -1
  25. package/dist/chunk-C45EFOVP.js +1 -0
  26. package/dist/chunk-CCPBNE2F.mjs +2 -0
  27. package/dist/{chunk-XWQB6APW.mjs → chunk-D62KS7QG.mjs} +1 -1
  28. package/dist/chunk-DI6CRWSW.mjs +1 -0
  29. package/dist/chunk-DTTWBKGN.mjs +0 -0
  30. package/dist/chunk-DV6GWBUJ.js +2 -0
  31. package/dist/{chunk-EPX7BBJD.js → chunk-E4JMCA5X.js} +2 -2
  32. package/dist/chunk-EQAORQC3.mjs +1 -0
  33. package/dist/chunk-FO6IX2DB.js +6 -0
  34. package/dist/chunk-FW23IMBF.mjs +1 -0
  35. package/dist/chunk-FYKRDDKG.js +1 -0
  36. package/dist/chunk-GSKMHXHG.js +1 -0
  37. package/dist/chunk-GUQFNJHE.mjs +1 -0
  38. package/dist/{chunk-D536HC5M.js → chunk-HQPWFUP5.js} +1 -1
  39. package/dist/chunk-ICE6NC3S.mjs +1 -0
  40. package/dist/chunk-IFUED5ZS.mjs +1 -0
  41. package/dist/chunk-ISKTBM4L.js +1 -0
  42. package/dist/chunk-IYKBX24M.js +1 -0
  43. package/dist/chunk-KOEWROYV.mjs +6 -0
  44. package/dist/chunk-KRN6YSR2.mjs +1 -0
  45. package/dist/chunk-KZXZWGFX.mjs +1 -0
  46. package/dist/chunk-L24C5TEX.mjs +1 -0
  47. package/dist/chunk-L72YAV5N.js +3 -0
  48. package/dist/chunk-LK6I3HMH.mjs +0 -0
  49. package/dist/{chunk-XBIKSAH6.js → chunk-LTHT4A4S.js} +1 -1
  50. package/dist/chunk-LWH66Q7Q.js +1 -0
  51. package/dist/chunk-MERJFGEP.mjs +59 -0
  52. package/dist/chunk-MJ6XZFVD.mjs +1 -0
  53. package/dist/chunk-MNOHUTKE.js +15 -0
  54. package/dist/chunk-MP4QSEO2.mjs +1 -0
  55. package/dist/{chunk-HL5PQT3A.mjs → chunk-OEXVWIHW.mjs} +1 -1
  56. package/dist/chunk-PVAVS3IU.js +1 -0
  57. package/dist/chunk-QEACB5VG.js +1 -0
  58. package/dist/{chunk-EV6W6KXG.mjs → chunk-QKLY4F2J.mjs} +1 -1
  59. package/dist/chunk-QYF7BRG3.js +2 -0
  60. package/dist/chunk-ROG4MNOR.js +4 -0
  61. package/dist/{chunk-D5E5TA74.js → chunk-RORPREG3.js} +1 -1
  62. package/dist/chunk-SORYYVJ7.js +1 -0
  63. package/dist/chunk-SZIOF5SG.js +59 -0
  64. package/dist/{chunk-SAFW7UQZ.js → chunk-THLJYXFB.js} +1 -1
  65. package/dist/chunk-TUIEV7Q7.js +1 -0
  66. package/dist/{chunk-Z4SJCSTS.js → chunk-U4WUDHDK.js} +1 -1
  67. package/dist/chunk-U4XMGWF7.js +1 -0
  68. package/dist/chunk-U67MWOPZ.mjs +1 -0
  69. package/dist/chunk-VMRUBLPI.js +1 -0
  70. package/dist/chunk-WLDI6N3B.mjs +3 -0
  71. package/dist/chunk-WLHNIXWC.mjs +2 -0
  72. package/dist/chunk-WVERBZZU.js +1 -0
  73. package/dist/chunk-XCKTBNKN.js +1 -0
  74. package/dist/chunk-XPV6VILW.mjs +1 -0
  75. package/dist/chunk-Z5MJYQSD.mjs +1 -0
  76. package/dist/chunk-ZBFNOJGY.js +1 -0
  77. package/dist/chunk-ZX26QZJ5.mjs +1 -0
  78. package/dist/content-CE-ZdMwG.d.mts +1418 -0
  79. package/dist/content-CYXJ2tfQ.d.ts +1418 -0
  80. package/dist/contentControlValues-DAwTWfgR.d.mts +187 -0
  81. package/dist/contentControlValues-gyVPsi6m.d.ts +187 -0
  82. package/dist/core-plugins.d.mts +1 -2
  83. package/dist/core-plugins.d.ts +1 -2
  84. package/dist/core-plugins.js +1 -1
  85. package/dist/core-plugins.mjs +1 -1
  86. package/dist/core.d.mts +6 -7
  87. package/dist/core.d.ts +6 -7
  88. package/dist/core.js +1 -1
  89. package/dist/core.mjs +1 -1
  90. package/dist/{documentSerializer-C1ueey5d.d.mts → documentSerializer-Bghq9rFI.d.mts} +1 -1
  91. package/dist/{documentSerializer-Chn7J1WG.d.ts → documentSerializer-C4lFC60P.d.ts} +1 -1
  92. package/dist/documentStyles-D87dxl18.d.mts +34 -0
  93. package/dist/documentStyles-DToJv9co.d.ts +34 -0
  94. package/dist/docx/index.d.mts +1 -2
  95. package/dist/docx/index.d.ts +1 -2
  96. package/dist/docx/index.js +1 -1
  97. package/dist/docx/index.mjs +1 -1
  98. package/dist/docx/parser.d.mts +1 -2
  99. package/dist/docx/parser.d.ts +1 -2
  100. package/dist/docx/parser.js +1 -1
  101. package/dist/docx/parser.mjs +1 -1
  102. package/dist/docx/rezip.d.mts +1 -2
  103. package/dist/docx/rezip.d.ts +1 -2
  104. package/dist/docx/rezip.js +1 -1
  105. package/dist/docx/rezip.mjs +1 -1
  106. package/dist/docx/serializer/index.d.mts +2 -3
  107. package/dist/docx/serializer/index.d.ts +2 -3
  108. package/dist/docx/serializer/index.js +1 -1
  109. package/dist/docx/serializer/index.mjs +1 -1
  110. package/dist/{fontLoader-QPwbcX5j.d.ts → fontLoader-Cm02v7PO.d.ts} +63 -3
  111. package/dist/{fontLoader-BOt95Jtf.d.mts → fontLoader-Z7pqeNvZ.d.mts} +63 -3
  112. package/dist/{headerFooterLayout-B5LyDpSM.d.ts → headerFooterLayout-Bd58Tum3.d.ts} +74 -2
  113. package/dist/{headerFooterLayout-DVFcJ832.d.mts → headerFooterLayout-CuIJiIzi.d.mts} +74 -2
  114. package/dist/headless.d.mts +7 -6
  115. package/dist/headless.d.ts +7 -6
  116. package/dist/headless.js +1 -1
  117. package/dist/headless.mjs +1 -1
  118. package/dist/layout-bridge/index.d.mts +4 -4
  119. package/dist/layout-bridge/index.d.ts +4 -4
  120. package/dist/layout-bridge/index.js +1 -1
  121. package/dist/layout-bridge/index.mjs +1 -1
  122. package/dist/layout-bridge/measuring/index.d.mts +4 -0
  123. package/dist/layout-bridge/measuring/index.d.ts +4 -0
  124. package/dist/layout-bridge/measuring/index.js +1 -1
  125. package/dist/layout-bridge/measuring/index.mjs +1 -1
  126. package/dist/layout-bridge/tableInsertHover.js +1 -1
  127. package/dist/layout-bridge/tableInsertHover.mjs +1 -1
  128. package/dist/layout-bridge/toFlowBlocks.d.mts +2 -1
  129. package/dist/layout-bridge/toFlowBlocks.d.ts +2 -1
  130. package/dist/layout-bridge/toFlowBlocks.js +1 -1
  131. package/dist/layout-bridge/toFlowBlocks.mjs +1 -1
  132. package/dist/layout-engine/index.d.mts +4 -1
  133. package/dist/layout-engine/index.d.ts +4 -1
  134. package/dist/layout-engine/index.js +1 -1
  135. package/dist/layout-engine/index.mjs +1 -1
  136. package/dist/layout-engine/types.d.mts +74 -1
  137. package/dist/layout-engine/types.d.ts +74 -1
  138. package/dist/layout-painter/index.d.mts +4 -4
  139. package/dist/layout-painter/index.d.ts +4 -4
  140. package/dist/layout-painter/index.js +1 -1
  141. package/dist/layout-painter/index.mjs +1 -1
  142. package/dist/layout-painter/renderPage.d.mts +27 -4
  143. package/dist/layout-painter/renderPage.d.ts +27 -4
  144. package/dist/layout-painter/renderPage.js +1 -1
  145. package/dist/layout-painter/renderPage.mjs +1 -1
  146. package/dist/managers/AutoSaveManager.d.mts +1 -2
  147. package/dist/managers/AutoSaveManager.d.ts +1 -2
  148. package/dist/managers/TableSelectionManager.d.mts +1 -2
  149. package/dist/managers/TableSelectionManager.d.ts +1 -2
  150. package/dist/managers/types.d.mts +1 -2
  151. package/dist/managers/types.d.ts +1 -2
  152. package/dist/mcp-cli.mjs +23 -22
  153. package/dist/mcp.d.mts +1 -2
  154. package/dist/mcp.d.ts +1 -2
  155. package/dist/mcp.js +3 -3
  156. package/dist/mcp.mjs +1 -1
  157. package/dist/{nodes-D7PTUJ2N.d.ts → nodes-BNkRKBBX.d.ts} +64 -3
  158. package/dist/{nodes-CL8M0L-a.d.mts → nodes-Bz-UHhLE.d.mts} +64 -3
  159. package/dist/prosemirror/commands/formatting.js +1 -1
  160. package/dist/prosemirror/commands/formatting.mjs +1 -1
  161. package/dist/prosemirror/commands/index.d.mts +80 -6
  162. package/dist/prosemirror/commands/index.d.ts +80 -6
  163. package/dist/prosemirror/commands/index.js +1 -1
  164. package/dist/prosemirror/commands/index.mjs +1 -1
  165. package/dist/prosemirror/commands/paragraph.js +1 -1
  166. package/dist/prosemirror/commands/paragraph.mjs +1 -1
  167. package/dist/prosemirror/conversion/fromProseDoc.d.mts +2 -3
  168. package/dist/prosemirror/conversion/fromProseDoc.d.ts +2 -3
  169. package/dist/prosemirror/conversion/fromProseDoc.js +1 -1
  170. package/dist/prosemirror/conversion/fromProseDoc.mjs +1 -1
  171. package/dist/prosemirror/conversion/index.d.mts +3 -4
  172. package/dist/prosemirror/conversion/index.d.ts +3 -4
  173. package/dist/prosemirror/conversion/index.js +1 -1
  174. package/dist/prosemirror/conversion/index.mjs +1 -1
  175. package/dist/prosemirror/editor.css +302 -95
  176. package/dist/prosemirror/extensions/index.js +1 -1
  177. package/dist/prosemirror/extensions/index.mjs +1 -1
  178. package/dist/prosemirror/extensions/nodes/TableExtension.js +1 -1
  179. package/dist/prosemirror/extensions/nodes/TableExtension.mjs +1 -1
  180. package/dist/prosemirror/index.d.mts +94 -7
  181. package/dist/prosemirror/index.d.ts +94 -7
  182. package/dist/prosemirror/index.js +3 -1
  183. package/dist/prosemirror/index.mjs +3 -1
  184. package/dist/prosemirror/plugins/index.d.mts +124 -17
  185. package/dist/prosemirror/plugins/index.d.ts +124 -17
  186. package/dist/prosemirror/plugins/index.js +1 -1
  187. package/dist/prosemirror/plugins/index.mjs +1 -1
  188. package/dist/prosemirror/schema/index.d.mts +3 -4
  189. package/dist/prosemirror/schema/index.d.ts +3 -4
  190. package/dist/prosemirror/schema/index.js +1 -1
  191. package/dist/prosemirror/schema/index.mjs +1 -1
  192. package/dist/prosemirror/styles/index.d.mts +9 -0
  193. package/dist/prosemirror/styles/index.d.ts +9 -0
  194. package/dist/prosemirror/styles/index.js +1 -1
  195. package/dist/prosemirror/styles/index.mjs +1 -1
  196. package/dist/prosemirror/utils/extractTrackedChanges.d.mts +44 -22
  197. package/dist/prosemirror/utils/extractTrackedChanges.d.ts +44 -22
  198. package/dist/prosemirror/utils/extractTrackedChanges.js +1 -1
  199. package/dist/prosemirror/utils/extractTrackedChanges.mjs +1 -1
  200. package/dist/types/content.d.mts +4 -1167
  201. package/dist/types/content.d.ts +4 -1167
  202. package/dist/types/document.d.mts +2 -4
  203. package/dist/types/document.d.ts +2 -4
  204. package/dist/utils/comments.d.mts +78 -5
  205. package/dist/utils/comments.d.ts +78 -5
  206. package/dist/utils/comments.js +1 -1
  207. package/dist/utils/comments.mjs +1 -1
  208. package/dist/utils/highlightColors.js +1 -1
  209. package/dist/utils/highlightColors.mjs +1 -1
  210. package/dist/utils/index.d.mts +2 -3
  211. package/dist/utils/index.d.ts +2 -3
  212. package/dist/utils/index.js +3 -3
  213. package/dist/utils/index.mjs +3 -3
  214. package/dist/{variableDetector-CAdt8yOr.d.mts → variableDetector-C7BLz9sJ.d.mts} +1 -1
  215. package/dist/{variableDetector-W4XEN9YC.d.ts → variableDetector-HPZbJ_gw.d.ts} +1 -1
  216. package/package.json +3 -3
  217. package/dist/chunk-3AZWLVLC.js +0 -1
  218. package/dist/chunk-3NLVHZMT.js +0 -59
  219. package/dist/chunk-5SU4HPQS.mjs +0 -1
  220. package/dist/chunk-7PX32GLB.mjs +0 -1
  221. package/dist/chunk-AHXPHBMT.js +0 -1
  222. package/dist/chunk-B6LYBJ4H.mjs +0 -1
  223. package/dist/chunk-BFB4PRS4.mjs +0 -1
  224. package/dist/chunk-BRHHK4MG.mjs +0 -2
  225. package/dist/chunk-CP5OSG5Z.mjs +0 -1
  226. package/dist/chunk-CUXXRGPQ.mjs +0 -1
  227. package/dist/chunk-D4RPOJC7.js +0 -1
  228. package/dist/chunk-FWTP7BN7.mjs +0 -4
  229. package/dist/chunk-G7AKYAKU.mjs +0 -1
  230. package/dist/chunk-HAAMO2Z2.mjs +0 -1
  231. package/dist/chunk-ILJUDEZ5.mjs +0 -1
  232. package/dist/chunk-IN6IYQ2X.js +0 -1
  233. package/dist/chunk-IO6HZ7KR.js +0 -2
  234. package/dist/chunk-IP2VXNWG.js +0 -1
  235. package/dist/chunk-KBU6QQFU.js +0 -9
  236. package/dist/chunk-LBKMYD3M.mjs +0 -1
  237. package/dist/chunk-LDKESXXK.mjs +0 -3
  238. package/dist/chunk-MZOVDLYL.js +0 -1
  239. package/dist/chunk-N3EIZN65.js +0 -1
  240. package/dist/chunk-NBLJPT54.mjs +0 -1
  241. package/dist/chunk-NERY274X.js +0 -1
  242. package/dist/chunk-NNQWQOC5.mjs +0 -1
  243. package/dist/chunk-NO5LW2DQ.mjs +0 -1
  244. package/dist/chunk-OCAX2KJQ.js +0 -4
  245. package/dist/chunk-OTDF6PZK.js +0 -1
  246. package/dist/chunk-P3AXSRLG.mjs +0 -1
  247. package/dist/chunk-Q4CKLXWA.js +0 -1
  248. package/dist/chunk-QMLIXLZJ.mjs +0 -4
  249. package/dist/chunk-QXHL67FG.mjs +0 -1
  250. package/dist/chunk-TGPS3SRR.mjs +0 -1
  251. package/dist/chunk-TMISJEGL.js +0 -1
  252. package/dist/chunk-TRJWRZZD.js +0 -1
  253. package/dist/chunk-TRQN2SFW.mjs +0 -59
  254. package/dist/chunk-UGXSKZVM.js +0 -1
  255. package/dist/chunk-V435QKZB.js +0 -3
  256. package/dist/chunk-V6SWUCTS.js +0 -2
  257. package/dist/chunk-VQWZHPWI.mjs +0 -1
  258. package/dist/chunk-X3NB7STJ.js +0 -1
  259. package/dist/chunk-XOH7YAYL.js +0 -1
  260. package/dist/chunk-Y5HZAMND.mjs +0 -9
  261. package/dist/chunk-Y7I5QDCN.mjs +0 -1
  262. package/dist/chunk-YCDB5TA6.js +0 -4
  263. package/dist/chunk-YE357WVA.js +0 -1
  264. package/dist/chunk-YVYB4YCI.js +0 -1
  265. package/dist/lists-CvG_iVK3.d.mts +0 -148
  266. package/dist/lists-UTp_tk7B.d.ts +0 -148
@@ -0,0 +1,1418 @@
1
+ import { P as ParagraphFormatting, T as TextFormatting, a as TableFormatting, b as TableRowFormatting, c as TableCellFormatting } from './formatting-BH4hcZiq.mjs';
2
+ import { WrapType } from './docx/wrapTypes.mjs';
3
+ import { B as BorderSpec, C as ColorValue, T as ThemeColorSlot } from './colors-C3vA7HUU.mjs';
4
+
5
+ /**
6
+ * Lists & Numbering Types
7
+ *
8
+ * Types for bullet lists, numbered lists, and numbering definitions.
9
+ */
10
+
11
+ /**
12
+ * Number format type
13
+ */
14
+ 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';
15
+ /**
16
+ * Multi-level suffix (what follows the number)
17
+ */
18
+ type LevelSuffix = 'tab' | 'space' | 'nothing';
19
+ /**
20
+ * One indentation level of an abstract numbering definition (`w:lvl`).
21
+ * Carries the number format, the marker template (`lvlText` — e.g.
22
+ * `"%1.%2."`), the level's paragraph properties (indent, hanging) and
23
+ * character properties (font, size, color for the marker itself).
24
+ *
25
+ * `ilvl` ranges 0-8 in standard Word documents.
26
+ */
27
+ interface ListLevel {
28
+ /** Level index (0-8) */
29
+ ilvl: number;
30
+ /** Starting number */
31
+ start?: number;
32
+ /** Number format */
33
+ numFmt: NumberFormat;
34
+ /** Level text (e.g., "%1." or "•") */
35
+ lvlText: string;
36
+ /** Justification */
37
+ lvlJc?: 'left' | 'center' | 'right';
38
+ /** Suffix after number */
39
+ suffix?: LevelSuffix;
40
+ /** Paragraph properties for this level */
41
+ pPr?: ParagraphFormatting;
42
+ /** Run properties for the number/bullet */
43
+ rPr?: TextFormatting;
44
+ /** Restart numbering from higher level */
45
+ lvlRestart?: number;
46
+ /** Is legal numbering style */
47
+ isLgl?: boolean;
48
+ /** Legacy settings */
49
+ legacy?: {
50
+ legacy?: boolean;
51
+ legacySpace?: number;
52
+ legacyIndent?: number;
53
+ };
54
+ }
55
+ /**
56
+ * Abstract numbering definition (`w:abstractNum`) — the reusable template
57
+ * for a list: which `NumberFormat` at each indentation level, what
58
+ * marker text, what paragraph/character formatting. Multiple
59
+ * `NumberingInstance`s (`w:num`) can reference one abstract numbering
60
+ * to share the template while keeping independent counters.
61
+ *
62
+ * See ECMA-376 §17.9.
63
+ */
64
+ interface AbstractNumbering {
65
+ /** Abstract numbering ID */
66
+ abstractNumId: number;
67
+ /** Multi-level type */
68
+ multiLevelType?: 'hybridMultilevel' | 'multilevel' | 'singleLevel';
69
+ /** Numbering style link */
70
+ numStyleLink?: string;
71
+ /** Style link */
72
+ styleLink?: string;
73
+ /** Level definitions */
74
+ levels: ListLevel[];
75
+ /** Name */
76
+ name?: string;
77
+ }
78
+ /**
79
+ * Numbering instance (w:num)
80
+ */
81
+ interface NumberingInstance {
82
+ /** Numbering ID (referenced by paragraphs) */
83
+ numId: number;
84
+ /** Reference to abstract numbering */
85
+ abstractNumId: number;
86
+ /** Level overrides */
87
+ levelOverrides?: Array<{
88
+ ilvl: number;
89
+ startOverride?: number;
90
+ lvl?: ListLevel;
91
+ }>;
92
+ }
93
+ /**
94
+ * Computed list marker for one paragraph — what the layout engine and
95
+ * painter need to render the "1.", "a)", "•" prefix. Not part of the
96
+ * wire format; the parser fills this from the `numbering.xml` chain plus
97
+ * the paragraph's `numPr`. Paragraphs without list rendering omit it.
98
+ */
99
+ interface ListRendering {
100
+ /** Computed marker text (e.g., "1.", "a)", "•") */
101
+ marker: string;
102
+ /** List level (0-8) */
103
+ level: number;
104
+ /** Numbering ID */
105
+ numId: number;
106
+ /** Whether this is a bullet or numbered list */
107
+ isBullet: boolean;
108
+ /** Number format type (decimal, lowerRoman, upperRoman, etc.) */
109
+ numFmt?: NumberFormat;
110
+ /** Whether the list marker is hidden (w:vanish on level rPr) */
111
+ markerHidden?: boolean;
112
+ /** Marker font family from numbering level rPr (ascii name) */
113
+ markerFontFamily?: string;
114
+ /** Marker font size from numbering level rPr, in points */
115
+ markerFontSize?: number;
116
+ /**
117
+ * Suffix character placed after the marker before body text (§17.9.25).
118
+ * Default is `tab`; `space` inserts a single space; `nothing` no gap.
119
+ * Drives marker-slot sizing in `getListMarkerInlineWidth`.
120
+ */
121
+ markerSuffix?: LevelSuffix;
122
+ /**
123
+ * NumberFormat for each level from 0..ilvl (inclusive).
124
+ * Used to resolve multi-level templates like "%1.%2." where each %N
125
+ * may need a different format (e.g., upperRoman parent + decimal child).
126
+ */
127
+ levelNumFmts?: NumberFormat[];
128
+ /** abstractNumId the paragraph's numId points to (counters key on this). */
129
+ abstractNumId?: number;
130
+ /**
131
+ * Start value from the numId's lvlOverride for the paragraph's ilvl, if any.
132
+ * Per ECMA-376 §17.9.18, this resets the shared abstractNum counter the
133
+ * first time the numId appears.
134
+ */
135
+ startOverride?: number;
136
+ }
137
+ /**
138
+ * Top-level numbering data from `numbering.xml` — the set of abstract
139
+ * templates and the per-document `NumberingInstance`s that reference
140
+ * them. Paragraphs reference a `numId` (instance), not an
141
+ * `abstractNumId` directly.
142
+ */
143
+ interface NumberingDefinitions {
144
+ /** Abstract numbering definitions */
145
+ abstractNums: AbstractNumbering[];
146
+ /** Numbering instances */
147
+ nums: NumberingInstance[];
148
+ }
149
+
150
+ /**
151
+ * Hyperlinks (`w:hyperlink`), bookmark markers (`w:bookmarkStart`/`End`),
152
+ * and field types (`w:fldSimple`, complex `w:fldChar` runs).
153
+ */
154
+
155
+ /**
156
+ * Hyperlink (`w:hyperlink`) — wraps runs in a clickable link. External
157
+ * targets resolve through the relationships part (`rId` → `href`);
158
+ * internal targets reference a `BookmarkStart` anchor by name.
159
+ */
160
+ interface Hyperlink {
161
+ type: 'hyperlink';
162
+ /** Relationship ID for external link */
163
+ rId?: string;
164
+ /** Resolved URL (from relationships) */
165
+ href?: string;
166
+ /** Internal bookmark anchor */
167
+ anchor?: string;
168
+ /** Tooltip text */
169
+ tooltip?: string;
170
+ /** Target frame */
171
+ target?: string;
172
+ /** Link history tracking */
173
+ history?: boolean;
174
+ /** Document location */
175
+ docLocation?: string;
176
+ /** Child runs */
177
+ children: (Run | BookmarkStart | BookmarkEnd)[];
178
+ }
179
+ /**
180
+ * Bookmark start marker (w:bookmarkStart)
181
+ */
182
+ interface BookmarkStart {
183
+ type: 'bookmarkStart';
184
+ /** Bookmark ID */
185
+ id: number;
186
+ /** Bookmark name */
187
+ name: string;
188
+ /** Column index for table bookmarks */
189
+ colFirst?: number;
190
+ colLast?: number;
191
+ }
192
+ /**
193
+ * Bookmark end marker (w:bookmarkEnd)
194
+ */
195
+ interface BookmarkEnd {
196
+ type: 'bookmarkEnd';
197
+ /** Bookmark ID */
198
+ id: number;
199
+ }
200
+ /**
201
+ * Known field types
202
+ */
203
+ 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';
204
+ /**
205
+ * Simple field (w:fldSimple)
206
+ */
207
+ interface SimpleField {
208
+ type: 'simpleField';
209
+ /** Field instruction (e.g., "PAGE \\* MERGEFORMAT") */
210
+ instruction: string;
211
+ /** Parsed field type */
212
+ fieldType: FieldType;
213
+ /** Current display value */
214
+ content: (Run | Hyperlink)[];
215
+ /** Field is locked */
216
+ fldLock?: boolean;
217
+ /** Field is dirty */
218
+ dirty?: boolean;
219
+ }
220
+ /**
221
+ * Complex field (w:fldChar begin/separate/end with w:instrText)
222
+ */
223
+ interface ComplexField {
224
+ type: 'complexField';
225
+ /** Field instruction */
226
+ instruction: string;
227
+ /** Parsed field type */
228
+ fieldType: FieldType;
229
+ /** Field code runs */
230
+ fieldCode: Run[];
231
+ /** Display result runs */
232
+ fieldResult: Run[];
233
+ /** Field is locked */
234
+ fldLock?: boolean;
235
+ /** Field is dirty */
236
+ dirty?: boolean;
237
+ }
238
+ type Field = SimpleField | ComplexField;
239
+
240
+ /**
241
+ * Math equations (`m:oMath`, `m:oMathPara`). OMML XML is round-tripped
242
+ * verbatim to preserve fidelity Word/Pages/Docs can disagree on.
243
+ */
244
+ /**
245
+ * Math equation content (m:oMath or m:oMathPara)
246
+ */
247
+ interface MathEquation {
248
+ type: 'mathEquation';
249
+ /** Whether this is a block (oMathPara) or inline (oMath) equation */
250
+ display: 'inline' | 'block';
251
+ /** Raw OMML XML for round-trip preservation */
252
+ ommlXml: string;
253
+ /** Plain text representation for accessibility/fallback */
254
+ plainText?: string;
255
+ }
256
+
257
+ /**
258
+ * Tracked-changes model — insertion/deletion/move wrappers, range
259
+ * markers, and per-element property-change wrappers (`w:rPrChange`,
260
+ * `w:pPrChange`, `w:tblPrChange`, `w:trPrChange`, `w:tcPrChange`) plus
261
+ * structural changes (row/cell insert/delete/merge).
262
+ */
263
+
264
+ /**
265
+ * Tracked change metadata (w:ins, w:del attributes)
266
+ */
267
+ interface TrackedChangeInfo {
268
+ /** Revision ID */
269
+ id: number;
270
+ /** Author who made the change */
271
+ author: string;
272
+ /** Date of the change */
273
+ date?: string;
274
+ }
275
+ /**
276
+ * Tracked-change attribute triple as it appears on PM node attrs
277
+ * (`paragraph.pPrIns`, `tableRow.trIns`, etc). Mirrors `TrackedChangeInfo`
278
+ * but with a `null` date (PM attr defaults) and a `revisionId` name that
279
+ * matches OOXML's `w:id` more idiomatically on the editor side.
280
+ *
281
+ * Round-trip pairs with `TrackedChangeInfo` via
282
+ * `{ id, author, date? } ↔ { revisionId, author, date | null }`.
283
+ */
284
+ interface RevisionInfo {
285
+ revisionId: number;
286
+ author: string;
287
+ date: string | null;
288
+ }
289
+ /**
290
+ * Tracked-cell marker — the OOXML `<w:cellIns>` / `<w:cellDel>` /
291
+ * `<w:cellMerge>` shape attached to a `TableCell` PM node and surfaced
292
+ * to the layout model and painter for visual rendering.
293
+ *
294
+ * `kind` matches the OOXML element name (ins / del / merge).
295
+ */
296
+ interface CellMarker {
297
+ kind: 'ins' | 'del' | 'merge';
298
+ info: RevisionInfo;
299
+ }
300
+ /**
301
+ * Generic tracked property-change wrapper metadata (w:*PrChange)
302
+ */
303
+ interface PropertyChangeInfo extends TrackedChangeInfo {
304
+ /** Optional revision session ID */
305
+ rsid?: string;
306
+ }
307
+ /**
308
+ * Insertion wrapper (w:ins) — runs inserted by tracked changes
309
+ */
310
+ interface Insertion {
311
+ type: 'insertion';
312
+ /** Tracked change metadata */
313
+ info: TrackedChangeInfo;
314
+ /** Inserted content */
315
+ content: (Run | Hyperlink)[];
316
+ }
317
+ /**
318
+ * Deletion wrapper (w:del) — runs deleted by tracked changes
319
+ */
320
+ interface Deletion {
321
+ type: 'deletion';
322
+ /** Tracked change metadata */
323
+ info: TrackedChangeInfo;
324
+ /** Deleted content */
325
+ content: (Run | Hyperlink)[];
326
+ }
327
+ /**
328
+ * Move-from wrapper (w:moveFrom) — content moved away from this position
329
+ */
330
+ interface MoveFrom {
331
+ type: 'moveFrom';
332
+ /** Tracked change metadata */
333
+ info: TrackedChangeInfo;
334
+ /** Moved content */
335
+ content: (Run | Hyperlink)[];
336
+ }
337
+ /**
338
+ * Move-to wrapper (w:moveTo) — content moved into this position
339
+ */
340
+ interface MoveTo {
341
+ type: 'moveTo';
342
+ /** Tracked change metadata */
343
+ info: TrackedChangeInfo;
344
+ /** Moved content */
345
+ content: (Run | Hyperlink)[];
346
+ }
347
+ /**
348
+ * Move-from range start marker (w:moveFromRangeStart) — ECMA-376 §17.13.5.22
349
+ * Pairs with moveFromRangeEnd to delimit the source of a move in the document.
350
+ */
351
+ interface MoveFromRangeStart {
352
+ type: 'moveFromRangeStart';
353
+ id: number;
354
+ name: string;
355
+ }
356
+ /**
357
+ * Move-from range end marker (w:moveFromRangeEnd)
358
+ */
359
+ interface MoveFromRangeEnd {
360
+ type: 'moveFromRangeEnd';
361
+ id: number;
362
+ }
363
+ /**
364
+ * Move-to range start marker (w:moveToRangeStart) — ECMA-376 §17.13.5.24
365
+ * Pairs with moveToRangeEnd to delimit the destination of a move.
366
+ */
367
+ interface MoveToRangeStart {
368
+ type: 'moveToRangeStart';
369
+ id: number;
370
+ name: string;
371
+ }
372
+ /**
373
+ * Move-to range end marker (w:moveToRangeEnd)
374
+ */
375
+ interface MoveToRangeEnd {
376
+ type: 'moveToRangeEnd';
377
+ id: number;
378
+ }
379
+ /**
380
+ * Run-level tracked wrappers represented in WordprocessingML.
381
+ */
382
+ type TrackedRunChange = Insertion | Deletion | MoveFrom | MoveTo;
383
+ /**
384
+ * Run property change (w:rPrChange)
385
+ */
386
+ interface RunPropertyChange {
387
+ type: 'runPropertyChange';
388
+ /** Tracked change metadata */
389
+ info: PropertyChangeInfo;
390
+ /** Run properties before the tracked change */
391
+ previousFormatting?: TextFormatting;
392
+ /** Run properties after the tracked change (editor model convenience) */
393
+ currentFormatting?: TextFormatting;
394
+ }
395
+ /**
396
+ * Paragraph property change (w:pPrChange)
397
+ */
398
+ interface ParagraphPropertyChange {
399
+ type: 'paragraphPropertyChange';
400
+ /** Tracked change metadata */
401
+ info: PropertyChangeInfo;
402
+ /** Paragraph properties before the tracked change */
403
+ previousFormatting?: ParagraphFormatting;
404
+ /** Paragraph properties after the tracked change (editor model convenience) */
405
+ currentFormatting?: ParagraphFormatting;
406
+ }
407
+ /**
408
+ * Table property change (w:tblPrChange)
409
+ */
410
+ interface TablePropertyChange {
411
+ type: 'tablePropertyChange';
412
+ /** Tracked change metadata */
413
+ info: PropertyChangeInfo;
414
+ /** Table properties before the tracked change */
415
+ previousFormatting?: TableFormatting;
416
+ /** Table properties after the tracked change (editor model convenience) */
417
+ currentFormatting?: TableFormatting;
418
+ }
419
+ /**
420
+ * Table row property change (w:trPrChange)
421
+ */
422
+ interface TableRowPropertyChange {
423
+ type: 'tableRowPropertyChange';
424
+ /** Tracked change metadata */
425
+ info: PropertyChangeInfo;
426
+ /** Row properties before the tracked change */
427
+ previousFormatting?: TableRowFormatting;
428
+ /** Row properties after the tracked change (editor model convenience) */
429
+ currentFormatting?: TableRowFormatting;
430
+ }
431
+ /**
432
+ * Table cell property change (w:tcPrChange)
433
+ */
434
+ interface TableCellPropertyChange {
435
+ type: 'tableCellPropertyChange';
436
+ /** Tracked change metadata */
437
+ info: PropertyChangeInfo;
438
+ /** Cell properties before the tracked change */
439
+ previousFormatting?: TableCellFormatting;
440
+ /** Cell properties after the tracked change (editor model convenience) */
441
+ currentFormatting?: TableCellFormatting;
442
+ }
443
+ /**
444
+ * Table structural tracked change metadata (row/cell insert/delete/merge)
445
+ */
446
+ interface TableStructuralChangeInfo {
447
+ type: 'tableRowInsertion' | 'tableRowDeletion' | 'tableCellInsertion' | 'tableCellDeletion' | 'tableCellMerge';
448
+ /** Tracked change metadata */
449
+ info: TrackedChangeInfo;
450
+ /**
451
+ * `<w:cellMerge w:vMerge="…">` value, only meaningful for `tableCellMerge`.
452
+ * Schema `ST_AnnotationVMerge`: `"rest"` = anchor (start of merged span),
453
+ * `"cont"` = continuation (merged into predecessor). Word's default for a
454
+ * tracked merge is `"cont"` (most edits track "this cell got merged INTO
455
+ * the one above"); we preserve the on-disk value when present.
456
+ */
457
+ vMerge?: 'rest' | 'cont';
458
+ /** `<w:cellMerge w:vMergeOrig="…">` — the pre-merge vMerge state. */
459
+ vMergeOrig?: 'rest' | 'cont';
460
+ }
461
+
462
+ /**
463
+ * Tables (`w:tbl`), rows (`w:tr`), and cells (`w:tc`).
464
+ */
465
+
466
+ /**
467
+ * Table cell (`w:tc`). Holds nested block content (paragraphs and nested
468
+ * tables), cell-level formatting (borders, shading, vertical merge),
469
+ * tracked property changes, and tracked structural changes for cell
470
+ * insert/delete/merge operations.
471
+ */
472
+ interface TableCell {
473
+ type: 'tableCell';
474
+ /** Cell formatting */
475
+ formatting?: TableCellFormatting;
476
+ /** Cell-level tracked property changes (w:tcPrChange) */
477
+ propertyChanges?: TableCellPropertyChange[];
478
+ /** Tracked structural changes (cell insert/delete/merge) */
479
+ structuralChange?: TableStructuralChangeInfo;
480
+ /** Cell content (paragraphs, tables, etc.) */
481
+ content: (Paragraph | Table)[];
482
+ }
483
+ /**
484
+ * Table row (`w:tr`) — an ordered list of `TableCell` plus row-level
485
+ * formatting (height, repeated header, cantSplit) and tracked changes
486
+ * for inserts/deletes.
487
+ */
488
+ interface TableRow {
489
+ type: 'tableRow';
490
+ /** Row formatting */
491
+ formatting?: TableRowFormatting;
492
+ /** Row-level tracked property changes (w:trPrChange) */
493
+ propertyChanges?: TableRowPropertyChange[];
494
+ /** Tracked structural changes (row insert/delete) */
495
+ structuralChange?: TableStructuralChangeInfo;
496
+ /** Cells in this row */
497
+ cells: TableCell[];
498
+ }
499
+ /**
500
+ * Table (`w:tbl`) — a block-level grid of rows × cells. Tables carry
501
+ * their own formatting layer (borders, shading, alignment, indent,
502
+ * floating placement) and an explicit column-width grid in twips. Tables
503
+ * can nest arbitrarily through `TableCell.content`.
504
+ *
505
+ * See ECMA-376 §17.4.
506
+ */
507
+ interface Table {
508
+ type: 'table';
509
+ /** Table formatting */
510
+ formatting?: TableFormatting;
511
+ /** Table-level tracked property changes (w:tblPrChange) */
512
+ propertyChanges?: TablePropertyChange[];
513
+ /** Column widths in twips */
514
+ columnWidths?: number[];
515
+ /** Table rows */
516
+ rows: TableRow[];
517
+ }
518
+
519
+ /**
520
+ * Page furniture — headers (`w:hdr`), footers (`w:ftr`), footnotes
521
+ * (`w:footnote`), and endnotes (`w:endnote`), plus the section-level
522
+ * properties (`w:footnotePr`/`w:endnotePr`) that configure note layout.
523
+ */
524
+
525
+ /**
526
+ * Header/footer type
527
+ */
528
+ type HeaderFooterType = 'default' | 'first' | 'even';
529
+ /**
530
+ * Header or footer reference
531
+ */
532
+ interface HeaderReference {
533
+ type: HeaderFooterType;
534
+ rId: string;
535
+ }
536
+ interface FooterReference {
537
+ type: HeaderFooterType;
538
+ rId: string;
539
+ }
540
+ /**
541
+ * Header or footer content
542
+ */
543
+ interface HeaderFooter {
544
+ type: 'header' | 'footer';
545
+ /** Header/footer type */
546
+ hdrFtrType: HeaderFooterType;
547
+ /** Content (paragraphs, tables, etc.) */
548
+ content: BlockContent[];
549
+ }
550
+ /**
551
+ * Footnote position
552
+ */
553
+ type FootnotePosition = 'pageBottom' | 'beneathText' | 'sectEnd' | 'docEnd';
554
+ /**
555
+ * Endnote position
556
+ */
557
+ type EndnotePosition = 'sectEnd' | 'docEnd';
558
+ /**
559
+ * Number restart type
560
+ */
561
+ type NoteNumberRestart = 'continuous' | 'eachSect' | 'eachPage';
562
+ /**
563
+ * Footnote properties
564
+ */
565
+ interface FootnoteProperties {
566
+ position?: FootnotePosition;
567
+ numFmt?: NumberFormat;
568
+ numStart?: number;
569
+ numRestart?: NoteNumberRestart;
570
+ }
571
+ /**
572
+ * Endnote properties
573
+ */
574
+ interface EndnoteProperties {
575
+ position?: EndnotePosition;
576
+ numFmt?: NumberFormat;
577
+ numStart?: number;
578
+ numRestart?: NoteNumberRestart;
579
+ }
580
+ /**
581
+ * Footnote (w:footnote)
582
+ */
583
+ interface Footnote {
584
+ type: 'footnote';
585
+ /** Footnote ID */
586
+ id: number;
587
+ /** Special footnote type */
588
+ noteType?: 'normal' | 'separator' | 'continuationSeparator' | 'continuationNotice';
589
+ /**
590
+ * Content. Per ECMA-376 §17.11.10 footnotes can hold the same blocks as
591
+ * the body — paragraphs and tables. The parser previously only collected
592
+ * <w:p> children which silently dropped any <w:tbl> inside a footnote;
593
+ * widened to match HeaderFooter / TableCell shape so the body pipeline
594
+ * (toProseDoc → toFlowBlocks) can render them uniformly.
595
+ */
596
+ content: BlockContent[];
597
+ }
598
+ /**
599
+ * Endnote (w:endnote)
600
+ */
601
+ interface Endnote {
602
+ type: 'endnote';
603
+ /** Endnote ID */
604
+ id: number;
605
+ /** Special endnote type */
606
+ noteType?: 'normal' | 'separator' | 'continuationSeparator' | 'continuationNotice';
607
+ /**
608
+ * Content. Per ECMA-376 §17.11.4 endnotes can hold the same blocks as
609
+ * the body — paragraphs and tables. See note on `Footnote.content`.
610
+ */
611
+ content: BlockContent[];
612
+ }
613
+
614
+ /**
615
+ * Comments (`w:comment` in `comments.xml`) and the inline range markers
616
+ * (`w:commentRangeStart`/`End`) that anchor them inside paragraphs.
617
+ */
618
+
619
+ /**
620
+ * A comment from `comments.xml` — the top-level entity for review
621
+ * comments and replies. `id` matches the inline `CommentRangeStart` /
622
+ * `CommentRangeEnd` markers that anchor it inside a paragraph; `parentId`
623
+ * threads replies under their parent; `done` reflects Word's "Resolve"
624
+ * state (`w15:done`).
625
+ */
626
+ interface Comment {
627
+ /** Comment ID (matches commentRangeStart/End) */
628
+ id: number;
629
+ /** Author name */
630
+ author: string;
631
+ /** Author initials */
632
+ initials?: string;
633
+ /** Date */
634
+ date?: string;
635
+ /** Comment content (paragraphs) */
636
+ content: Paragraph[];
637
+ /** Parent comment ID (for replies) */
638
+ parentId?: number;
639
+ /** Whether the comment is resolved/done */
640
+ done?: boolean;
641
+ }
642
+ /**
643
+ * Comment range start marker in paragraph content
644
+ */
645
+ interface CommentRangeStart {
646
+ type: 'commentRangeStart';
647
+ id: number;
648
+ }
649
+ /**
650
+ * Comment range end marker in paragraph content
651
+ */
652
+ interface CommentRangeEnd {
653
+ type: 'commentRangeEnd';
654
+ id: number;
655
+ }
656
+
657
+ /**
658
+ * Section properties (`w:sectPr`) — page size and margins, columns,
659
+ * header/footer references, line numbers, page borders, document grid,
660
+ * paper sources — plus the section and document-body containers that
661
+ * group block-level content.
662
+ */
663
+
664
+ /**
665
+ * Page orientation
666
+ */
667
+ type PageOrientation = 'portrait' | 'landscape';
668
+ /**
669
+ * Section start type
670
+ */
671
+ type SectionStart = 'continuous' | 'nextPage' | 'oddPage' | 'evenPage' | 'nextColumn';
672
+ /**
673
+ * Vertical alignment
674
+ */
675
+ type VerticalAlign = 'top' | 'center' | 'both' | 'bottom';
676
+ /**
677
+ * Line number restart type
678
+ */
679
+ type LineNumberRestart = 'continuous' | 'newPage' | 'newSection';
680
+ /**
681
+ * Column definition
682
+ */
683
+ interface Column {
684
+ /** Column width in twips */
685
+ width?: number;
686
+ /** Space after column in twips */
687
+ space?: number;
688
+ }
689
+ /**
690
+ * Section properties (`w:sectPr`) — page geometry, margins, columns,
691
+ * header/footer references, and page numbering for one section of the
692
+ * document. Sections are introduced by inline `sectPr` markers on the
693
+ * terminating paragraph (`Paragraph.sectionProperties`) and the body's
694
+ * final `sectPr`.
695
+ *
696
+ * All distance units are twips (1/20 of a point) on the wire. The layout
697
+ * engine converts to pixels.
698
+ *
699
+ * See ECMA-376 §17.6.
700
+ */
701
+ interface SectionProperties {
702
+ /** Page width in twips */
703
+ pageWidth?: number;
704
+ /** Page height in twips */
705
+ pageHeight?: number;
706
+ /** Page orientation */
707
+ orientation?: PageOrientation;
708
+ /** Top margin in twips */
709
+ marginTop?: number;
710
+ /** Bottom margin in twips */
711
+ marginBottom?: number;
712
+ /** Left margin in twips */
713
+ marginLeft?: number;
714
+ /** Right margin in twips */
715
+ marginRight?: number;
716
+ /** Header distance from top in twips */
717
+ headerDistance?: number;
718
+ /** Footer distance from bottom in twips */
719
+ footerDistance?: number;
720
+ /** Gutter margin in twips */
721
+ gutter?: number;
722
+ /** Number of columns */
723
+ columnCount?: number;
724
+ /** Space between columns in twips */
725
+ columnSpace?: number;
726
+ /** Equal width columns */
727
+ equalWidth?: boolean;
728
+ /** Separator line between columns */
729
+ separator?: boolean;
730
+ /** Individual column definitions */
731
+ columns?: Column[];
732
+ /** Section start type */
733
+ sectionStart?: SectionStart;
734
+ /** Vertical alignment of text */
735
+ verticalAlign?: VerticalAlign;
736
+ /** Right-to-left section */
737
+ bidi?: boolean;
738
+ /** Header references */
739
+ headerReferences?: HeaderReference[];
740
+ /** Footer references */
741
+ footerReferences?: FooterReference[];
742
+ /** Different first page header/footer */
743
+ titlePg?: boolean;
744
+ /** Different odd/even page headers/footers */
745
+ evenAndOddHeaders?: boolean;
746
+ /** Line numbering settings */
747
+ lineNumbers?: {
748
+ start?: number;
749
+ countBy?: number;
750
+ distance?: number;
751
+ restart?: LineNumberRestart;
752
+ };
753
+ /** Page borders */
754
+ pageBorders?: {
755
+ top?: BorderSpec;
756
+ bottom?: BorderSpec;
757
+ left?: BorderSpec;
758
+ right?: BorderSpec;
759
+ /** Display setting */
760
+ display?: 'allPages' | 'firstPage' | 'notFirstPage';
761
+ /** Offset from */
762
+ offsetFrom?: 'page' | 'text';
763
+ /** Z-order */
764
+ zOrder?: 'front' | 'back';
765
+ };
766
+ /** Page background */
767
+ background?: {
768
+ color?: ColorValue;
769
+ themeColor?: ThemeColorSlot;
770
+ themeTint?: string;
771
+ themeShade?: string;
772
+ };
773
+ /** Footnote properties for this section */
774
+ footnotePr?: FootnoteProperties;
775
+ /** Endnote properties for this section */
776
+ endnotePr?: EndnoteProperties;
777
+ /** Document grid */
778
+ docGrid?: {
779
+ type?: 'default' | 'lines' | 'linesAndChars' | 'snapToChars';
780
+ linePitch?: number;
781
+ charSpace?: number;
782
+ };
783
+ /** First page paper source */
784
+ paperSrcFirst?: number;
785
+ /** Other pages paper source */
786
+ paperSrcOther?: number;
787
+ }
788
+ /**
789
+ * Block-level content types
790
+ */
791
+ type BlockContent = Paragraph | Table | BlockSdt;
792
+ /**
793
+ * One section of the document — a `SectionProperties` plus the block
794
+ * content (`Paragraph`s and `Table`s) that lives under those properties.
795
+ *
796
+ * Sections are derived during parse: every paragraph carrying an inline
797
+ * `sectPr` ends a section, and the body's final `sectPr` defines the
798
+ * last section. Each section may carry its own headers/footers map.
799
+ */
800
+ interface Section {
801
+ /** Section properties */
802
+ properties: SectionProperties;
803
+ /** Content in this section */
804
+ content: BlockContent[];
805
+ /** Headers for this section */
806
+ headers?: Map<HeaderFooterType, HeaderFooter>;
807
+ /** Footers for this section */
808
+ footers?: Map<HeaderFooterType, HeaderFooter>;
809
+ }
810
+ /**
811
+ * Document body (`w:body`) — the editable content of the document.
812
+ *
813
+ * Contains the ordered block content (paragraphs and tables), the section
814
+ * layout chain derived from inline `sectPr` markers, the final `sectPr`,
815
+ * and any document-level comments. This is what most edit operations
816
+ * mutate; headers/footers/styles live elsewhere in the package.
817
+ */
818
+ interface DocumentBody {
819
+ /** All content (paragraphs, tables) */
820
+ content: BlockContent[];
821
+ /** Sections (derived from sectPr in paragraphs and final sectPr) */
822
+ sections?: Section[];
823
+ /** Final section properties (from body's sectPr) */
824
+ finalSectionProperties?: SectionProperties;
825
+ /** Comments from comments.xml */
826
+ comments?: Comment[];
827
+ }
828
+
829
+ /**
830
+ * Structured Document Tags / content controls (`w:sdt`) — inline and
831
+ * block variants, plus properties (alias, tag, lock, list items,
832
+ * checkbox state) for the supported SDT types.
833
+ */
834
+
835
+ /**
836
+ * SDT type (content control type).
837
+ *
838
+ * Values mirror the `w:sdtPr` type-marker element names from ECMA-376
839
+ * §17.5.2 (`CT_SdtPr`), with two deliberate exceptions:
840
+ * - `checkbox` is the `w14:checkbox` (Office 2010) extension, not a base
841
+ * OOXML type marker.
842
+ * - `buildingBlockGallery` covers both `w:docPartObj` and `w:docPartList`.
843
+ *
844
+ * A `w:sdtPr` with no type marker means `richText` (the spec default). A
845
+ * type marker the parser does not model maps to `unknown` — it is never
846
+ * coerced to `richText`, so the projection stays honest. Round-trip
847
+ * fidelity does not depend on this enum: the raw `w:sdtPr` is replayed
848
+ * verbatim (see `rawPropertiesXml`).
849
+ */
850
+ type SdtType = 'richText' | 'plainText' | 'date' | 'dropDownList' | 'comboBox' | 'checkbox' | 'picture' | 'buildingBlockGallery' | 'group' | 'equation' | 'citation' | 'bibliography' | 'unknown';
851
+ /**
852
+ * XML data binding (`w:dataBinding`) — links a content control to a node in a
853
+ * Custom XML data store. Modeled read-only; the binding round-trips verbatim
854
+ * via `rawPropertiesXml` (this projection is for inspection, e.g. "which
855
+ * controls are bound, and to what XPath"). The editor does not resolve or
856
+ * sync bound values.
857
+ */
858
+ interface SdtDataBinding {
859
+ /** XPath into the bound Custom XML part (`w:xpath`). */
860
+ xpath?: string;
861
+ /** Target Custom XML store id (`w:storeItemID`). */
862
+ storeItemID?: string;
863
+ /** Namespace prefix mappings used by the XPath (`w:prefixMappings`). */
864
+ prefixMappings?: string;
865
+ }
866
+ /**
867
+ * SDT properties (`w:sdtPr`).
868
+ *
869
+ * The modeled fields are a **read-only projection** for downstream tooling
870
+ * (tag/alias addressing, template extraction). They are NOT the
871
+ * serialization source: the original `w:sdtPr` is captured verbatim in
872
+ * `rawPropertiesXml` and replayed on save, which preserves element order
873
+ * (`CT_SdtPr` is an `xsd:sequence`), avoids double-emission, and keeps
874
+ * unmodeled features (data binding, `w15:*`, `@lastValue`) lossless.
875
+ */
876
+ interface SdtProperties {
877
+ /** SDT type (projection; see {@link SdtType}). */
878
+ sdtType: SdtType;
879
+ /** Unique numeric id (`w:id`, signed). */
880
+ id?: number;
881
+ /** Alias (friendly name, `w:alias`). */
882
+ alias?: string;
883
+ /** Tag (developer identifier, `w:tag`). */
884
+ tag?: string;
885
+ /** Lock setting (`w:lock`). */
886
+ lock?: 'sdtLocked' | 'contentLocked' | 'sdtContentLocked' | 'unlocked';
887
+ /**
888
+ * Placeholder building-block name (`w:placeholder/w:docPart@w:val`).
889
+ * This is a reference to a glossary docPart that supplies the placeholder
890
+ * content — NOT the literal placeholder text.
891
+ */
892
+ placeholder?: string;
893
+ /** Whether the control is currently showing its placeholder (`w:showingPlcHdr`). */
894
+ showingPlaceholder?: boolean;
895
+ /** Date format for date controls (`w:date@w:fullDate`). */
896
+ dateFormat?: string;
897
+ /** Dropdown/combobox list items. */
898
+ listItems?: {
899
+ displayText: string;
900
+ value: string;
901
+ }[];
902
+ /** Checkbox checked state (`w14:checkbox`). */
903
+ checked?: boolean;
904
+ /** XML data binding (`w:dataBinding`), if the control is bound. */
905
+ dataBinding?: SdtDataBinding;
906
+ /**
907
+ * The original `<w:sdtPr>` serialized verbatim as an XML string, captured
908
+ * at parse time. Replayed unchanged on save so the properties block
909
+ * round-trips losslessly. Stored as a string (not an `XmlElement`) so the
910
+ * types layer stays free of the parser/`xml-js` dependency. Absent for
911
+ * SDTs created programmatically — the serializer then synthesizes a
912
+ * minimal, sequence-valid `w:sdtPr` from the modeled fields.
913
+ */
914
+ rawPropertiesXml?: string;
915
+ /** The original `<w:sdtEndPr>` serialized verbatim, if present. */
916
+ rawEndPropertiesXml?: string;
917
+ }
918
+ /**
919
+ * Inline SDT (content control within a paragraph)
920
+ */
921
+ interface InlineSdt {
922
+ type: 'inlineSdt';
923
+ /** SDT properties */
924
+ properties: SdtProperties;
925
+ /**
926
+ * Inline content held inside the control. OOXML allows runs,
927
+ * hyperlinks, simple/complex fields, nested SDTs, and math at this
928
+ * level; the renderer must descend into all of them so docProps-bound
929
+ * fields and similar template content survive paged rendering.
930
+ */
931
+ content: (Run | Hyperlink | SimpleField | ComplexField | InlineSdt | MathEquation)[];
932
+ }
933
+ /**
934
+ * Block-level SDT (content control wrapping block content).
935
+ *
936
+ * `content` is `BlockContent[]` (not just paragraphs/tables) so a nested
937
+ * block SDT survives the round trip. `CT_SdtContentBlock` also permits
938
+ * run-level content (bookmarks, etc.); that is carried through the same
939
+ * block-content parsing as elsewhere in the document.
940
+ */
941
+ interface BlockSdt {
942
+ type: 'blockSdt';
943
+ /** SDT properties */
944
+ properties: SdtProperties;
945
+ /** Block content inside the control */
946
+ content: BlockContent[];
947
+ }
948
+
949
+ /**
950
+ * Paragraph (`w:p`) — the union of inline content that can sit inside a
951
+ * paragraph (runs, hyperlinks, bookmarks, fields, SDT, comment ranges,
952
+ * tracked-change wrappers, math) plus paragraph-level metadata
953
+ * (formatting, list rendering, optional terminating section properties).
954
+ */
955
+
956
+ /**
957
+ * Inline content that can appear inside a paragraph. Covers runs (text),
958
+ * hyperlinks, bookmarks, fields, structured document tags, comment range
959
+ * markers, tracked-change wrappers, and math equations. Every node in
960
+ * this union carries a `type` discriminator so consumers can narrow at
961
+ * runtime.
962
+ */
963
+ type ParagraphContent = Run | Hyperlink | BookmarkStart | BookmarkEnd | SimpleField | ComplexField | InlineSdt | CommentRangeStart | CommentRangeEnd | Insertion | Deletion | MoveFrom | MoveTo | MoveFromRangeStart | MoveFromRangeEnd | MoveToRangeStart | MoveToRangeEnd | MathEquation;
964
+ /**
965
+ * Paragraph (`w:p`) — the primary block-level container in a Word document.
966
+ *
967
+ * Every paragraph carries direct formatting (`formatting`), tracked
968
+ * property changes (`propertyChanges`), inline content (`content`), and
969
+ * optional list rendering / section break metadata. `paraId` is Word's
970
+ * stable identifier (`w14:paraId`) and is what `EditorBridge` and the
971
+ * agent toolkit use to address paragraphs.
972
+ *
973
+ * See ECMA-376 §17.3.1.
974
+ */
975
+ interface Paragraph {
976
+ type: 'paragraph';
977
+ /** Unique paragraph ID */
978
+ paraId?: string;
979
+ /** Text ID */
980
+ textId?: string;
981
+ /** Paragraph formatting */
982
+ formatting?: ParagraphFormatting;
983
+ /** Paragraph-level tracked property changes (w:pPrChange) */
984
+ propertyChanges?: ParagraphPropertyChange[];
985
+ /**
986
+ * Paragraph-mark insertion tracking (`<w:pPr><w:rPr><w:ins/>`). Set when
987
+ * this paragraph's terminating pilcrow was added as a tracked change —
988
+ * e.g., the user pressed Enter mid-paragraph in suggesting mode. Reject
989
+ * joins this paragraph with the following one.
990
+ */
991
+ pPrIns?: TrackedChangeInfo;
992
+ /**
993
+ * Paragraph-mark deletion tracking (`<w:pPr><w:rPr><w:del/>`). Set when
994
+ * this paragraph's terminating pilcrow was deleted as a tracked change —
995
+ * e.g., the user pressed Backspace at the start of the next paragraph in
996
+ * suggesting mode. Accept joins this paragraph with the following one.
997
+ */
998
+ pPrDel?: TrackedChangeInfo;
999
+ /** Paragraph content */
1000
+ content: ParagraphContent[];
1001
+ /** Computed list rendering (if this is a list item) */
1002
+ listRendering?: ListRendering;
1003
+ /** Word's cached layout says this paragraph started on a new rendered page. */
1004
+ renderedPageBreakBefore?: boolean;
1005
+ /** Section properties (if this paragraph ends a section) */
1006
+ sectionProperties?: SectionProperties;
1007
+ }
1008
+
1009
+ /**
1010
+ * DrawingML shapes (`wps:wsp`) and text boxes — preset shape types,
1011
+ * fill, outline, shape text body, transform.
1012
+ */
1013
+
1014
+ /**
1015
+ * Shape types
1016
+ */
1017
+ 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';
1018
+ /**
1019
+ * Shape fill type
1020
+ */
1021
+ interface ShapeFill {
1022
+ type: 'none' | 'solid' | 'gradient' | 'pattern' | 'picture';
1023
+ /** Solid fill color */
1024
+ color?: ColorValue;
1025
+ /** Gradient stops for gradient fill */
1026
+ gradient?: {
1027
+ type: 'linear' | 'radial' | 'rectangular' | 'path';
1028
+ angle?: number;
1029
+ stops: Array<{
1030
+ position: number;
1031
+ color: ColorValue;
1032
+ }>;
1033
+ };
1034
+ }
1035
+ /**
1036
+ * Shape outline/stroke
1037
+ */
1038
+ interface ShapeOutline {
1039
+ /** Line width in EMUs */
1040
+ width?: number;
1041
+ /** Line color */
1042
+ color?: ColorValue;
1043
+ /** Line style */
1044
+ style?: 'solid' | 'dot' | 'dash' | 'lgDash' | 'dashDot' | 'lgDashDot' | 'lgDashDotDot' | 'sysDot' | 'sysDash' | 'sysDashDot' | 'sysDashDotDot';
1045
+ /** Line cap */
1046
+ cap?: 'flat' | 'round' | 'square';
1047
+ /** Line join */
1048
+ join?: 'bevel' | 'miter' | 'round';
1049
+ /** Head arrow */
1050
+ headEnd?: {
1051
+ type: 'none' | 'triangle' | 'stealth' | 'diamond' | 'oval' | 'arrow';
1052
+ width?: 'sm' | 'med' | 'lg';
1053
+ length?: 'sm' | 'med' | 'lg';
1054
+ };
1055
+ /** Tail arrow */
1056
+ tailEnd?: {
1057
+ type: 'none' | 'triangle' | 'stealth' | 'diamond' | 'oval' | 'arrow';
1058
+ width?: 'sm' | 'med' | 'lg';
1059
+ length?: 'sm' | 'med' | 'lg';
1060
+ };
1061
+ }
1062
+ /**
1063
+ * Text body inside a shape
1064
+ */
1065
+ interface ShapeTextBody {
1066
+ /** Text direction */
1067
+ vertical?: boolean;
1068
+ /** Rotation */
1069
+ rotation?: number;
1070
+ /** Anchor/vertical alignment */
1071
+ anchor?: 'top' | 'middle' | 'bottom' | 'distributed' | 'justified';
1072
+ /** Anchor center */
1073
+ anchorCenter?: boolean;
1074
+ /** Auto fit */
1075
+ autoFit?: 'none' | 'normal' | 'shape';
1076
+ /** Text margins */
1077
+ margins?: {
1078
+ top?: number;
1079
+ bottom?: number;
1080
+ left?: number;
1081
+ right?: number;
1082
+ };
1083
+ /** Paragraphs inside the shape */
1084
+ content: Paragraph[];
1085
+ }
1086
+ /**
1087
+ * Shape/drawing object (wps:wsp)
1088
+ */
1089
+ interface Shape {
1090
+ type: 'shape';
1091
+ /** Shape type preset */
1092
+ shapeType: ShapeType;
1093
+ /** Unique ID */
1094
+ id?: string;
1095
+ /** Name */
1096
+ name?: string;
1097
+ /** Size in EMUs */
1098
+ size: ImageSize;
1099
+ /** Position for floating shapes */
1100
+ position?: ImagePosition;
1101
+ /** Wrap settings */
1102
+ wrap?: ImageWrap;
1103
+ /** Fill */
1104
+ fill?: ShapeFill;
1105
+ /** Outline/stroke */
1106
+ outline?: ShapeOutline;
1107
+ /** Transform */
1108
+ transform?: ImageTransform;
1109
+ /** Text content inside the shape */
1110
+ textBody?: ShapeTextBody;
1111
+ /** Custom geometry points */
1112
+ customGeometry?: string;
1113
+ }
1114
+ /**
1115
+ * Text box (floating text container)
1116
+ */
1117
+ interface TextBox {
1118
+ type: 'textBox';
1119
+ /** Unique ID */
1120
+ id?: string;
1121
+ /** Size */
1122
+ size: ImageSize;
1123
+ /** Position */
1124
+ position?: ImagePosition;
1125
+ /** Wrap settings */
1126
+ wrap?: ImageWrap;
1127
+ /** Fill */
1128
+ fill?: ShapeFill;
1129
+ /** Outline */
1130
+ outline?: ShapeOutline;
1131
+ /** Text content */
1132
+ content: Paragraph[];
1133
+ /** Internal margins */
1134
+ margins?: {
1135
+ top?: number;
1136
+ bottom?: number;
1137
+ left?: number;
1138
+ right?: number;
1139
+ };
1140
+ }
1141
+
1142
+ /**
1143
+ * Embedded images (`w:drawing` → `pic:pic`): size, wrap, position,
1144
+ * transform, padding, crop.
1145
+ */
1146
+
1147
+ /**
1148
+ * Image size specification
1149
+ */
1150
+ interface ImageSize {
1151
+ /** Width in EMUs (English Metric Units) */
1152
+ width: number;
1153
+ /** Height in EMUs */
1154
+ height: number;
1155
+ }
1156
+ /**
1157
+ * Image wrap type for floating images
1158
+ */
1159
+ interface ImageWrap {
1160
+ type: WrapType;
1161
+ /** Wrap text direction */
1162
+ wrapText?: 'bothSides' | 'left' | 'right' | 'largest';
1163
+ /** Distance from text */
1164
+ distT?: number;
1165
+ distB?: number;
1166
+ distL?: number;
1167
+ distR?: number;
1168
+ }
1169
+ /**
1170
+ * Position for floating images
1171
+ */
1172
+ interface ImagePosition {
1173
+ /** Horizontal positioning */
1174
+ horizontal: {
1175
+ relativeTo: 'character' | 'column' | 'insideMargin' | 'leftMargin' | 'margin' | 'outsideMargin' | 'page' | 'rightMargin';
1176
+ alignment?: 'left' | 'right' | 'center' | 'inside' | 'outside';
1177
+ posOffset?: number;
1178
+ };
1179
+ /** Vertical positioning */
1180
+ vertical: {
1181
+ relativeTo: 'insideMargin' | 'line' | 'margin' | 'outsideMargin' | 'page' | 'paragraph' | 'topMargin' | 'bottomMargin';
1182
+ alignment?: 'top' | 'bottom' | 'center' | 'inside' | 'outside';
1183
+ posOffset?: number;
1184
+ };
1185
+ }
1186
+ /**
1187
+ * Image transformation
1188
+ */
1189
+ interface ImageTransform {
1190
+ /** Rotation in degrees */
1191
+ rotation?: number;
1192
+ /** Flip horizontal */
1193
+ flipH?: boolean;
1194
+ /** Flip vertical */
1195
+ flipV?: boolean;
1196
+ }
1197
+ /**
1198
+ * Image padding/margins
1199
+ */
1200
+ interface ImagePadding {
1201
+ top?: number;
1202
+ bottom?: number;
1203
+ left?: number;
1204
+ right?: number;
1205
+ }
1206
+ /**
1207
+ * Image crop, expressed as fractions of the source image to trim from each
1208
+ * edge. OOXML's `<a:srcRect l="10000" t="0" r="5000" b="0"/>` uses units of
1209
+ * 1/100000 (so 10000 → 0.1 → 10% trimmed from the left). We store the
1210
+ * normalised fraction so both the renderer and the saver can read it
1211
+ * directly without re-parsing units.
1212
+ */
1213
+ interface ImageCrop {
1214
+ left?: number;
1215
+ top?: number;
1216
+ right?: number;
1217
+ bottom?: number;
1218
+ }
1219
+ /**
1220
+ * Embedded image (`w:drawing` with an inline or anchored picture). Carries
1221
+ * the relationship-id pointer to the binary in `word/media/`, its
1222
+ * resolved data URL (`src`), display dimensions, optional crop /
1223
+ * transform / wrap behaviors, and anchor positioning for floating
1224
+ * images.
1225
+ *
1226
+ * See ECMA-376 §20.4 (DrawingML wordprocessingDrawing).
1227
+ */
1228
+ interface Image {
1229
+ type: 'image';
1230
+ /** Unique ID */
1231
+ id?: string;
1232
+ /** Relationship ID for the image data */
1233
+ rId: string;
1234
+ /** Resolved image data (base64 or blob URL) */
1235
+ src?: string;
1236
+ /** Image MIME type */
1237
+ mimeType?: string;
1238
+ /** Original filename */
1239
+ filename?: string;
1240
+ /** Alt text for accessibility */
1241
+ alt?: string;
1242
+ /** Title/description */
1243
+ title?: string;
1244
+ /** Image size */
1245
+ size: ImageSize;
1246
+ /** Original size before any transforms */
1247
+ originalSize?: ImageSize;
1248
+ /** Wrap settings */
1249
+ wrap: ImageWrap;
1250
+ /** Position for floating images */
1251
+ position?: ImagePosition;
1252
+ /** Image transformations */
1253
+ transform?: ImageTransform;
1254
+ /** Padding around image */
1255
+ padding?: ImagePadding;
1256
+ /** Source-image crop (fractional, OOXML `a:srcRect`). */
1257
+ crop?: ImageCrop;
1258
+ /** Opacity in [0, 1] (OOXML `a:alphaModFix amt`). Undefined = fully opaque. */
1259
+ opacity?: number;
1260
+ /** Whether this is a decorative image */
1261
+ decorative?: boolean;
1262
+ /**
1263
+ * `wp:anchor layoutInCell` — when true (default), an anchored image inside
1264
+ * a table cell is constrained to the cell. When false, the image escapes
1265
+ * the cell into the page area. Round-tripped on save.
1266
+ */
1267
+ layoutInCell?: boolean;
1268
+ /**
1269
+ * `wp:anchor allowOverlap` — when true (default), anchored objects may
1270
+ * overlap; when false, Word repositions them to avoid collisions. We
1271
+ * don't currently reposition; we round-trip the flag so saving preserves
1272
+ * the author's intent.
1273
+ */
1274
+ allowOverlap?: boolean;
1275
+ /** Hyperlink URL for clickable image */
1276
+ hlinkHref?: string;
1277
+ /** Image outline/border */
1278
+ outline?: ShapeOutline;
1279
+ /** Image effects */
1280
+ effects?: {
1281
+ brightness?: number;
1282
+ contrast?: number;
1283
+ saturation?: number;
1284
+ };
1285
+ }
1286
+
1287
+ /**
1288
+ * Run content (`w:r`) and the inline pieces that live inside a run —
1289
+ * text, tab, break, symbol, footnote/endnote references, field chars,
1290
+ * instruction text, soft/no-break hyphens, drawings, shapes.
1291
+ */
1292
+
1293
+ /**
1294
+ * Plain text run content (`w:t`). `preserveSpace` mirrors the
1295
+ * `xml:space="preserve"` attribute and matters for runs that begin or end
1296
+ * with whitespace — without it, Word collapses leading/trailing spaces.
1297
+ */
1298
+ interface TextContent {
1299
+ type: 'text';
1300
+ /** The text string */
1301
+ text: string;
1302
+ /** Preserve whitespace (xml:space="preserve") */
1303
+ preserveSpace?: boolean;
1304
+ }
1305
+ /**
1306
+ * Tab character
1307
+ */
1308
+ interface TabContent {
1309
+ type: 'tab';
1310
+ }
1311
+ /**
1312
+ * Line break
1313
+ */
1314
+ interface BreakContent {
1315
+ type: 'break';
1316
+ /** Break type */
1317
+ breakType?: 'page' | 'column' | 'textWrapping';
1318
+ /** Clear type for text wrapping break */
1319
+ clear?: 'none' | 'left' | 'right' | 'all';
1320
+ }
1321
+ /**
1322
+ * Symbol character (special font character)
1323
+ */
1324
+ interface SymbolContent {
1325
+ type: 'symbol';
1326
+ /** Font name */
1327
+ font: string;
1328
+ /** Character code */
1329
+ char: string;
1330
+ }
1331
+ /**
1332
+ * Footnote or endnote reference
1333
+ */
1334
+ interface NoteReferenceContent {
1335
+ type: 'footnoteRef' | 'endnoteRef';
1336
+ /** Note ID */
1337
+ id: number;
1338
+ }
1339
+ /**
1340
+ * Field character (begin/separate/end)
1341
+ */
1342
+ interface FieldCharContent {
1343
+ type: 'fieldChar';
1344
+ /** Field character type */
1345
+ charType: 'begin' | 'separate' | 'end';
1346
+ /** Field is locked */
1347
+ fldLock?: boolean;
1348
+ /** Field is dirty (needs update) */
1349
+ dirty?: boolean;
1350
+ }
1351
+ /**
1352
+ * Field instruction text
1353
+ */
1354
+ interface InstrTextContent {
1355
+ type: 'instrText';
1356
+ /** Field instruction */
1357
+ text: string;
1358
+ }
1359
+ /**
1360
+ * Soft hyphen
1361
+ */
1362
+ interface SoftHyphenContent {
1363
+ type: 'softHyphen';
1364
+ }
1365
+ /**
1366
+ * Non-breaking hyphen
1367
+ */
1368
+ interface NoBreakHyphenContent {
1369
+ type: 'noBreakHyphen';
1370
+ }
1371
+ /**
1372
+ * Drawing/image reference
1373
+ */
1374
+ interface DrawingContent {
1375
+ type: 'drawing';
1376
+ /** Image data */
1377
+ image: Image;
1378
+ }
1379
+ /**
1380
+ * Shape reference
1381
+ */
1382
+ interface ShapeContent {
1383
+ type: 'shape';
1384
+ /** Shape data */
1385
+ shape: Shape;
1386
+ }
1387
+ /**
1388
+ * All possible run content types
1389
+ */
1390
+ type RunContent = TextContent | TabContent | BreakContent | SymbolContent | NoteReferenceContent | FieldCharContent | InstrTextContent | SoftHyphenContent | NoBreakHyphenContent | DrawingContent | ShapeContent;
1391
+ /**
1392
+ * A run (`w:r`) — a contiguous span of inline content sharing one set of
1393
+ * character properties (bold, italic, font, color, etc.). Runs are the
1394
+ * atomic unit of character formatting; toggling bold on a selection that
1395
+ * spans different formatting creates new runs.
1396
+ *
1397
+ * See ECMA-376 §17.3.2.
1398
+ *
1399
+ * @example
1400
+ * ```ts
1401
+ * const run: Run = {
1402
+ * type: 'run',
1403
+ * formatting: { bold: true },
1404
+ * content: [{ type: 'text', text: 'Hello' }],
1405
+ * };
1406
+ * ```
1407
+ */
1408
+ interface Run {
1409
+ type: 'run';
1410
+ /** Text formatting properties */
1411
+ formatting?: TextFormatting;
1412
+ /** Run-level tracked property changes (w:rPrChange) */
1413
+ propertyChanges?: RunPropertyChange[];
1414
+ /** Run content (text, tabs, breaks, etc.) */
1415
+ content: RunContent[];
1416
+ }
1417
+
1418
+ export type { HeaderFooterType as $, AbstractNumbering as A, BlockContent as B, Comment as C, Deletion as D, Endnote as E, Footnote as F, BookmarkStart as G, Hyperlink as H, Image as I, Column as J, ComplexField as K, ListLevel as L, MoveFrom as M, NumberingDefinitions as N, DrawingContent as O, Paragraph as P, EndnotePosition as Q, Run as R, SectionProperties as S, Table as T, EndnoteProperties as U, Field as V, FieldCharContent as W, FieldType as X, FooterReference as Y, FootnotePosition as Z, FootnoteProperties as _, CommentRangeEnd as a, HeaderReference as a0, ImageCrop as a1, ImagePadding as a2, ImagePosition as a3, ImageSize as a4, ImageTransform as a5, ImageWrap as a6, InlineSdt as a7, InstrTextContent as a8, LevelSuffix as a9, TableStructuralChangeInfo as aA, TextBox as aB, VerticalAlign as aC, LineNumberRestart as aa, ListRendering as ab, MathEquation as ac, MoveFromRangeEnd as ad, MoveFromRangeStart as ae, MoveToRangeEnd as af, MoveToRangeStart as ag, NoBreakHyphenContent as ah, NoteNumberRestart as ai, NoteReferenceContent as aj, NumberingInstance as ak, PageOrientation as al, PropertyChangeInfo as am, RunPropertyChange as an, Section as ao, SectionStart as ap, Shape as aq, ShapeContent as ar, ShapeFill as as, ShapeOutline as at, ShapeTextBody as au, ShapeType as av, SimpleField as aw, SoftHyphenContent as ax, SymbolContent as ay, TabContent as az, CommentRangeStart as b, DocumentBody as c, Insertion as d, MoveTo as e, ParagraphContent as f, RunContent as g, TableCell as h, TableRow as i, TextContent as j, TrackedChangeInfo as k, TrackedRunChange as l, RevisionInfo as m, CellMarker as n, NumberFormat as o, ParagraphPropertyChange as p, TablePropertyChange as q, TableCellPropertyChange as r, TableRowPropertyChange as s, SdtType as t, SdtProperties as u, SdtDataBinding as v, BlockSdt as w, BreakContent as x, HeaderFooter as y, BookmarkEnd as z };