@betteroffice/docx 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +41 -0
  3. package/dist/Subscribable-DOz6Ohoo.d.mts +33 -0
  4. package/dist/agent/index.d.mts +531 -0
  5. package/dist/agent/index.mjs +1 -0
  6. package/dist/chunk-34K66SY4.mjs +1 -0
  7. package/dist/chunk-3UBMCDME.mjs +1 -0
  8. package/dist/chunk-4RCISPPE.mjs +1 -0
  9. package/dist/chunk-4UD54UM5.mjs +1 -0
  10. package/dist/chunk-52GB3Y42.mjs +1 -0
  11. package/dist/chunk-6NEKRDXF.mjs +1 -0
  12. package/dist/chunk-6PW4CWUG.mjs +1 -0
  13. package/dist/chunk-7DEIW7FL.mjs +1 -0
  14. package/dist/chunk-7PCO5I2O.mjs +1 -0
  15. package/dist/chunk-BI3B33LI.mjs +1 -0
  16. package/dist/chunk-BIQWVK5P.mjs +2 -0
  17. package/dist/chunk-CIRN3LZA.mjs +1 -0
  18. package/dist/chunk-DXKG3HQ5.mjs +16 -0
  19. package/dist/chunk-EUUIJVM6.mjs +0 -0
  20. package/dist/chunk-FPZBTOD6.mjs +1 -0
  21. package/dist/chunk-FZIA7OFY.mjs +1 -0
  22. package/dist/chunk-GWKJ2Y4Y.mjs +1 -0
  23. package/dist/chunk-H3JCIGWK.mjs +1 -0
  24. package/dist/chunk-HJGAQIU7.mjs +2 -0
  25. package/dist/chunk-I6KKMUUC.mjs +1 -0
  26. package/dist/chunk-IL5JZJT7.mjs +1 -0
  27. package/dist/chunk-JY6ILTNS.mjs +1 -0
  28. package/dist/chunk-KEE52TT5.mjs +1 -0
  29. package/dist/chunk-KVKLLTDP.mjs +58 -0
  30. package/dist/chunk-KXNZFTTK.mjs +1 -0
  31. package/dist/chunk-L5ISVQ3W.mjs +1 -0
  32. package/dist/chunk-LDUWIM7M.mjs +1 -0
  33. package/dist/chunk-N5Q3YN64.mjs +1 -0
  34. package/dist/chunk-NEWOMDTX.mjs +1 -0
  35. package/dist/chunk-O2QSE2I7.mjs +1 -0
  36. package/dist/chunk-OBQGPMPQ.mjs +1 -0
  37. package/dist/chunk-OJOHXQNQ.mjs +1 -0
  38. package/dist/chunk-OMR3TWCD.mjs +2 -0
  39. package/dist/chunk-P3KDV4M2.mjs +1 -0
  40. package/dist/chunk-Q7PO7V73.mjs +1 -0
  41. package/dist/chunk-QOUFE3VX.mjs +1 -0
  42. package/dist/chunk-SINEY6ZF.mjs +1 -0
  43. package/dist/chunk-T4EZMUXM.mjs +1 -0
  44. package/dist/chunk-TTRUPDAB.mjs +1 -0
  45. package/dist/chunk-TYHI7RAD.mjs +1 -0
  46. package/dist/chunk-UIEJWORW.mjs +1 -0
  47. package/dist/chunk-VAOUFAUH.mjs +1 -0
  48. package/dist/chunk-VBOTMRXV.mjs +1 -0
  49. package/dist/chunk-VCER63GQ.mjs +1 -0
  50. package/dist/chunk-WAUF2UC7.mjs +2 -0
  51. package/dist/chunk-WRWRCBLK.mjs +1 -0
  52. package/dist/chunk-X4XDO3LZ.mjs +1 -0
  53. package/dist/chunk-XQBCCJBO.mjs +9 -0
  54. package/dist/chunk-XWUOLYRQ.mjs +2 -0
  55. package/dist/chunk-XYH6XWP3.mjs +10 -0
  56. package/dist/chunk-YBIM6UJV.mjs +8 -0
  57. package/dist/chunk-YCIH2Q3E.mjs +1 -0
  58. package/dist/chunk-YUOKI2HB.mjs +1 -0
  59. package/dist/chunk-ZOV5KL7C.mjs +1 -0
  60. package/dist/colorResolver-n0o7H7ep.d.mts +290 -0
  61. package/dist/content-sSHuWw49.d.mts +2202 -0
  62. package/dist/core-plugins.d.mts +37 -0
  63. package/dist/core-plugins.mjs +1 -0
  64. package/dist/core.d.mts +451 -0
  65. package/dist/core.mjs +1 -0
  66. package/dist/displayListQueries-p-ijSzdh.d.mts +222 -0
  67. package/dist/docx/index.d.mts +618 -0
  68. package/dist/docx/index.mjs +2 -0
  69. package/dist/docx/parser.d.mts +41 -0
  70. package/dist/docx/parser.mjs +1 -0
  71. package/dist/docx/rezip.d.mts +148 -0
  72. package/dist/docx/rezip.mjs +1 -0
  73. package/dist/docx/serializer/index.d.mts +42 -0
  74. package/dist/docx/serializer/index.mjs +1 -0
  75. package/dist/docx/wrapTypes.d.mts +19 -0
  76. package/dist/docx/wrapTypes.mjs +1 -0
  77. package/dist/docxInput-DTbCa48g.d.mts +21 -0
  78. package/dist/editor/index.d.mts +170 -0
  79. package/dist/editor/index.mjs +1 -0
  80. package/dist/editorTree-DO5PyDK8.d.mts +37 -0
  81. package/dist/executor-7O2RBJ2B.mjs +1 -0
  82. package/dist/fontLoader-Bx6DK6-2.d.mts +327 -0
  83. package/dist/formatting-DoL7KBSL.d.mts +823 -0
  84. package/dist/generated/edit/docx_edit_bg.wasm +0 -0
  85. package/dist/generated/layout/docx_layout_bg.wasm +0 -0
  86. package/dist/generated/opc/ooxml_opc_bg.wasm +0 -0
  87. package/dist/generated/parse/docx_parse_bg.wasm +0 -0
  88. package/dist/headerFooterLayout-0zPT64Qc.d.mts +316 -0
  89. package/dist/headless.d.mts +69 -0
  90. package/dist/headless.mjs +1 -0
  91. package/dist/layout/flow/index.d.mts +149 -0
  92. package/dist/layout/flow/index.mjs +1 -0
  93. package/dist/layout/index.d.mts +307 -0
  94. package/dist/layout/index.mjs +1 -0
  95. package/dist/layout/measure/index.d.mts +324 -0
  96. package/dist/layout/measure/index.mjs +1 -0
  97. package/dist/layout/pagination/index.d.mts +60 -0
  98. package/dist/layout/pagination/index.mjs +1 -0
  99. package/dist/layout/pagination/types.d.mts +4 -0
  100. package/dist/layout/pagination/types.mjs +1 -0
  101. package/dist/layout/render/index.d.mts +733 -0
  102. package/dist/layout/render/index.mjs +1 -0
  103. package/dist/loadWasmAsset-CMvnVkfA.d.mts +3 -0
  104. package/dist/managers/AutoSaveManager.d.mts +81 -0
  105. package/dist/managers/AutoSaveManager.mjs +1 -0
  106. package/dist/managers/TableSelectionManager.d.mts +74 -0
  107. package/dist/managers/TableSelectionManager.mjs +1 -0
  108. package/dist/managers/types.d.mts +113 -0
  109. package/dist/managers/types.mjs +0 -0
  110. package/dist/mcp-cli.mjs +142 -0
  111. package/dist/mcp.d.mts +162 -0
  112. package/dist/mcp.mjs +16 -0
  113. package/dist/measureBlocksPipeline-Df0Bbrwy.d.mts +109 -0
  114. package/dist/measuredBlock-DZwz8zhD.d.mts +26 -0
  115. package/dist/plugin-api/RenderedDomContext.d.mts +114 -0
  116. package/dist/plugin-api/RenderedDomContext.mjs +1 -0
  117. package/dist/plugin-api/index.d.mts +7 -0
  118. package/dist/plugin-api/index.mjs +0 -0
  119. package/dist/plugin-api/resolveItemPositions.d.mts +39 -0
  120. package/dist/plugin-api/resolveItemPositions.mjs +1 -0
  121. package/dist/plugin-api/types.d.mts +193 -0
  122. package/dist/plugin-api/types.mjs +0 -0
  123. package/dist/processTemplate-HDUIZFJ5.mjs +1 -0
  124. package/dist/registry-DMM5VTdT.d.mts +165 -0
  125. package/dist/rustDisplayList-dqunvwxH.d.mts +1036 -0
  126. package/dist/rustPagination-Bj2hq013.d.mts +106 -0
  127. package/dist/sectionConfigs-DW3J8q0X.d.mts +55 -0
  128. package/dist/selectionContext-Buc9BCU1.d.mts +570 -0
  129. package/dist/selectiveSave-oFBJ1n71.d.mts +16 -0
  130. package/dist/selectiveXmlPatch-ypkxlTD_.d.mts +23 -0
  131. package/dist/settingsParser-CcGvtmCK.d.mts +33 -0
  132. package/dist/styles/index.d.mts +162 -0
  133. package/dist/styles/index.mjs +1 -0
  134. package/dist/styles-VxNcXLdi.d.mts +189 -0
  135. package/dist/types/agentApi.d.mts +456 -0
  136. package/dist/types/agentApi.mjs +1 -0
  137. package/dist/types/content.d.mts +3 -0
  138. package/dist/types/content.mjs +1 -0
  139. package/dist/types/document.d.mts +117 -0
  140. package/dist/types/document.mjs +1 -0
  141. package/dist/types-DNrYr6yQ.d.mts +1754 -0
  142. package/dist/types-dYdjUZMo.d.mts +311 -0
  143. package/dist/units-O5Y02RKQ.d.mts +34 -0
  144. package/dist/utils/autoScroll.d.mts +24 -0
  145. package/dist/utils/autoScroll.mjs +1 -0
  146. package/dist/utils/cardStyles.d.mts +22 -0
  147. package/dist/utils/cardStyles.mjs +1 -0
  148. package/dist/utils/comments.d.mts +120 -0
  149. package/dist/utils/comments.mjs +4 -0
  150. package/dist/utils/findReplace.d.mts +114 -0
  151. package/dist/utils/findReplace.mjs +2 -0
  152. package/dist/utils/findVerticalScrollParent.d.mts +25 -0
  153. package/dist/utils/findVerticalScrollParent.mjs +1 -0
  154. package/dist/utils/fontOptions.d.mts +21 -0
  155. package/dist/utils/fontOptions.mjs +1 -0
  156. package/dist/utils/headingCollector.d.mts +28 -0
  157. package/dist/utils/headingCollector.mjs +1 -0
  158. package/dist/utils/highlightColors.d.mts +14 -0
  159. package/dist/utils/highlightColors.mjs +1 -0
  160. package/dist/utils/index.d.mts +956 -0
  161. package/dist/utils/index.mjs +84 -0
  162. package/dist/utils/listState.d.mts +27 -0
  163. package/dist/utils/listState.mjs +1 -0
  164. package/dist/utils/reportIssue.d.mts +23 -0
  165. package/dist/utils/reportIssue.mjs +2 -0
  166. package/dist/utils/sidebarConstants.d.mts +10 -0
  167. package/dist/utils/sidebarConstants.mjs +1 -0
  168. package/dist/utils/stylePreview.d.mts +70 -0
  169. package/dist/utils/stylePreview.mjs +1 -0
  170. package/dist/utils/textSelection.d.mts +92 -0
  171. package/dist/utils/textSelection.mjs +1 -0
  172. package/dist/utils/units.d.mts +78 -0
  173. package/dist/utils/units.mjs +1 -0
  174. package/dist/variableDetector-Borj29SF.d.mts +115 -0
  175. package/dist/wasm-FZQ5XB2Y.mjs +1 -0
  176. package/dist/wasm-SA237OSP.mjs +1 -0
  177. package/dist/wasm-edit.d.mts +473 -0
  178. package/dist/wasm-edit.mjs +1 -0
  179. package/dist/wasm-layout.d.mts +112 -0
  180. package/dist/wasm-layout.mjs +1 -0
  181. package/dist/wasm-opc.d.mts +16 -0
  182. package/dist/wasm-opc.mjs +1 -0
  183. package/dist/wasm-parse.d.mts +18 -0
  184. package/dist/wasm-parse.mjs +1 -0
  185. package/dist/watermarkApi-DCxjutkg.d.mts +38 -0
  186. package/dist/yrs/index.d.mts +882 -0
  187. package/dist/yrs/index.mjs +1 -0
  188. package/dist/yrs/residentEngineWorker.d.mts +2 -0
  189. package/dist/yrs/residentEngineWorker.mjs +1 -0
  190. package/package.json +365 -0
@@ -0,0 +1,2202 @@
1
+ import { C as ColorValue, P as ParagraphFormatting, T as TextFormatting, o as TableFormatting, s as TableRowFormatting, n as TableCellFormatting, B as BorderSpec, z as ThemeColorSlot } from './formatting-DoL7KBSL.mjs';
2
+ import { WrapType } from './docx/wrapTypes.mjs';
3
+
4
+ /**
5
+ * DrawingML shape primitives — preset shape types, fill/outline/text-body
6
+ * types, and the pure a:-namespace parsers for gradients, line ends,
7
+ * transforms (a:xfrm), and preset geometry.
8
+ */
9
+
10
+ /**
11
+ * Shape types
12
+ *
13
+ * @public
14
+ */
15
+ 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';
16
+ /**
17
+ * Shape fill type
18
+ *
19
+ * @public
20
+ */
21
+ interface ShapeFill {
22
+ type: 'none' | 'solid' | 'gradient' | 'pattern' | 'picture';
23
+ /** Solid fill color */
24
+ color?: ColorValue;
25
+ /** Gradient stops for gradient fill */
26
+ gradient?: {
27
+ type: 'linear' | 'radial' | 'rectangular' | 'path';
28
+ angle?: number;
29
+ stops: Array<{
30
+ position: number;
31
+ color: ColorValue;
32
+ }>;
33
+ };
34
+ }
35
+ /**
36
+ * Shape outline/stroke
37
+ *
38
+ * @public
39
+ */
40
+ interface ShapeOutline {
41
+ /** Line width in EMUs */
42
+ width?: number;
43
+ /** Line color */
44
+ color?: ColorValue;
45
+ /** Line style */
46
+ style?: 'solid' | 'dot' | 'dash' | 'lgDash' | 'dashDot' | 'lgDashDot' | 'lgDashDotDot' | 'sysDot' | 'sysDash' | 'sysDashDot' | 'sysDashDotDot';
47
+ /** Line cap */
48
+ cap?: 'flat' | 'round' | 'square';
49
+ /** Line join */
50
+ join?: 'bevel' | 'miter' | 'round';
51
+ /** Head arrow */
52
+ headEnd?: {
53
+ type: 'none' | 'triangle' | 'stealth' | 'diamond' | 'oval' | 'arrow';
54
+ width?: 'sm' | 'med' | 'lg';
55
+ length?: 'sm' | 'med' | 'lg';
56
+ };
57
+ /** Tail arrow */
58
+ tailEnd?: {
59
+ type: 'none' | 'triangle' | 'stealth' | 'diamond' | 'oval' | 'arrow';
60
+ width?: 'sm' | 'med' | 'lg';
61
+ length?: 'sm' | 'med' | 'lg';
62
+ };
63
+ }
64
+ /**
65
+ * Text body inside a shape.
66
+ *
67
+ * `TContent` is the host's paragraph/content type — DrawingML itself does
68
+ * not prescribe what a paragraph looks like (docx uses `w:p`, pptx `a:p`).
69
+ *
70
+ * @public
71
+ */
72
+ interface ShapeTextBody$1<TContent = unknown> {
73
+ /** Text direction */
74
+ vertical?: boolean;
75
+ /** Rotation */
76
+ rotation?: number;
77
+ /** Anchor/vertical alignment */
78
+ anchor?: 'top' | 'middle' | 'bottom' | 'distributed' | 'justified';
79
+ /** Anchor center */
80
+ anchorCenter?: boolean;
81
+ /** Auto fit */
82
+ autoFit?: 'none' | 'normal' | 'shape';
83
+ /** Text margins */
84
+ margins?: {
85
+ top?: number;
86
+ bottom?: number;
87
+ left?: number;
88
+ right?: number;
89
+ };
90
+ /** Paragraphs inside the shape */
91
+ content: TContent[];
92
+ }
93
+ /**
94
+ * Normalized DrawingML preset-geometry path command.
95
+ *
96
+ * Coordinates are shape-local fractions in the `[0, 1]` box. Consumers scale
97
+ * `x/y` and control points by the shape's resolved width/height.
98
+ *
99
+ * @public
100
+ */
101
+ type PresetGeometryPathCommand = {
102
+ type: 'move';
103
+ x: number;
104
+ y: number;
105
+ } | {
106
+ type: 'line';
107
+ x: number;
108
+ y: number;
109
+ } | {
110
+ type: 'quad';
111
+ cpx: number;
112
+ cpy: number;
113
+ x: number;
114
+ y: number;
115
+ } | {
116
+ type: 'cubic';
117
+ cp1x: number;
118
+ cp1y: number;
119
+ cp2x: number;
120
+ cp2y: number;
121
+ x: number;
122
+ y: number;
123
+ } | {
124
+ type: 'close';
125
+ };
126
+
127
+ /**
128
+ * Lists & Numbering Types
129
+ *
130
+ * Types for bullet lists, numbered lists, and numbering definitions.
131
+ */
132
+
133
+ /**
134
+ * Number format type
135
+ */
136
+ type NumberFormat = 'decimal' | 'upperRoman' | 'lowerRoman' | 'upperLetter' | 'lowerLetter' | 'ordinal' | 'cardinalText' | 'ordinalText' | 'hex' | 'chicago' | 'ideographDigital' | 'japaneseCounting' | 'aiueo' | 'iroha' | 'decimalFullWidth' | 'decimalHalfWidth' | 'japaneseLegal' | 'japaneseDigitalTenThousand' | 'decimalEnclosedCircle' | 'decimalFullWidth2' | 'aiueoFullWidth' | 'irohaFullWidth' | 'decimalZero' | 'decimalZero3' | 'decimalZero4' | 'decimalZero5' | 'bullet' | 'ganada' | 'chosung' | 'decimalEnclosedFullstop' | 'decimalEnclosedParen' | 'decimalEnclosedCircleChinese' | 'ideographEnclosedCircle' | 'ideographTraditional' | 'ideographZodiac' | 'ideographZodiacTraditional' | 'taiwaneseCounting' | 'ideographLegalTraditional' | 'taiwaneseCountingThousand' | 'taiwaneseDigital' | 'chineseCounting' | 'chineseLegalSimplified' | 'chineseCountingThousand' | 'koreanDigital' | 'koreanCounting' | 'koreanLegal' | 'koreanDigital2' | 'vietnameseCounting' | 'russianLower' | 'russianUpper' | 'none' | 'numberInDash' | 'hebrew1' | 'hebrew2' | 'arabicAlpha' | 'arabicAbjad' | 'hindiVowels' | 'hindiConsonants' | 'hindiNumbers' | 'hindiCounting' | 'thaiLetters' | 'thaiNumbers' | 'thaiCounting';
137
+ /**
138
+ * Multi-level suffix (what follows the number)
139
+ */
140
+ type LevelSuffix = 'tab' | 'space' | 'nothing';
141
+ /**
142
+ * One indentation level of an abstract numbering definition (`w:lvl`).
143
+ * Carries the number format, the marker template (`lvlText` — e.g.
144
+ * `"%1.%2."`), the level's paragraph properties (indent, hanging) and
145
+ * character properties (font, size, color for the marker itself).
146
+ *
147
+ * `ilvl` ranges 0-8 in standard Word documents.
148
+ */
149
+ interface ListLevel {
150
+ /** Level index (0-8) */
151
+ ilvl: number;
152
+ /** Starting number */
153
+ start?: number;
154
+ /** Number format */
155
+ numFmt: NumberFormat;
156
+ /** Level text (e.g., "%1." or "•") */
157
+ lvlText: string;
158
+ /** Justification */
159
+ lvlJc?: 'left' | 'center' | 'right';
160
+ /** Suffix after number */
161
+ suffix?: LevelSuffix;
162
+ /** Paragraph properties for this level */
163
+ pPr?: ParagraphFormatting;
164
+ /** Run properties for the number/bullet */
165
+ rPr?: TextFormatting;
166
+ /** Restart numbering from higher level */
167
+ lvlRestart?: number;
168
+ /** Is legal numbering style */
169
+ isLgl?: boolean;
170
+ /** Legacy settings */
171
+ legacy?: {
172
+ legacy?: boolean;
173
+ legacySpace?: number;
174
+ legacyIndent?: number;
175
+ };
176
+ }
177
+ /**
178
+ * Abstract numbering definition (`w:abstractNum`) — the reusable template
179
+ * for a list: which `NumberFormat` at each indentation level, what
180
+ * marker text, what paragraph/character formatting. Multiple
181
+ * `NumberingInstance`s (`w:num`) can reference one abstract numbering
182
+ * to share the template while keeping independent counters.
183
+ *
184
+ * See ECMA-376 §17.9.
185
+ */
186
+ interface AbstractNumbering {
187
+ /** Abstract numbering ID */
188
+ abstractNumId: number;
189
+ /** Multi-level type */
190
+ multiLevelType?: 'hybridMultilevel' | 'multilevel' | 'singleLevel';
191
+ /** Numbering style link */
192
+ numStyleLink?: string;
193
+ /** Style link */
194
+ styleLink?: string;
195
+ /** Level definitions */
196
+ levels: ListLevel[];
197
+ /** Name */
198
+ name?: string;
199
+ }
200
+ /**
201
+ * Numbering instance (w:num)
202
+ */
203
+ interface NumberingInstance {
204
+ /** Numbering ID (referenced by paragraphs) */
205
+ numId: number;
206
+ /** Reference to abstract numbering */
207
+ abstractNumId: number;
208
+ /** Level overrides */
209
+ levelOverrides?: Array<{
210
+ ilvl: number;
211
+ startOverride?: number;
212
+ lvl?: ListLevel;
213
+ }>;
214
+ }
215
+ /**
216
+ * Computed list marker for one paragraph — what the layout engine and
217
+ * painter need to render the "1.", "a)", "•" prefix. Not part of the
218
+ * wire format; the parser fills this from the `numbering.xml` chain plus
219
+ * the paragraph's `numPr`. Paragraphs without list rendering omit it.
220
+ */
221
+ interface ListRendering {
222
+ /** Computed marker text (e.g., "1.", "a)", "•") */
223
+ marker: string;
224
+ /** List level (0-8) */
225
+ level: number;
226
+ /** Numbering ID */
227
+ numId: number;
228
+ /** Whether this is a bullet or numbered list */
229
+ isBullet: boolean;
230
+ /** Number format type (decimal, lowerRoman, upperRoman, etc.) */
231
+ numFmt?: NumberFormat;
232
+ /** Whether the list marker is hidden (w:vanish on level rPr) */
233
+ markerHidden?: boolean;
234
+ /** Marker font family from numbering level rPr (ascii name) */
235
+ markerFontFamily?: string;
236
+ /** Marker font size from numbering level rPr, in points */
237
+ markerFontSize?: number;
238
+ /**
239
+ * Suffix character placed after the marker before body text (§17.9.25).
240
+ * Default is `tab`; `space` inserts a single space; `nothing` no gap.
241
+ * Drives marker-slot sizing in `getListMarkerInlineWidth`.
242
+ */
243
+ markerSuffix?: LevelSuffix;
244
+ /**
245
+ * NumberFormat for each level from 0..ilvl (inclusive).
246
+ * Used to resolve multi-level templates like "%1.%2." where each %N
247
+ * may need a different format (e.g., upperRoman parent + decimal child).
248
+ */
249
+ levelNumFmts?: NumberFormat[];
250
+ /** abstractNumId the paragraph's numId points to (counters key on this). */
251
+ abstractNumId?: number;
252
+ /**
253
+ * Start value from the numId's lvlOverride for the paragraph's ilvl, if any.
254
+ * Per ECMA-376 §17.9.18, this resets the shared abstractNum counter the
255
+ * first time the numId appears.
256
+ */
257
+ startOverride?: number;
258
+ }
259
+ /**
260
+ * Top-level numbering data from `numbering.xml` — the set of abstract
261
+ * templates and the per-document `NumberingInstance`s that reference
262
+ * them. Paragraphs reference a `numId` (instance), not an
263
+ * `abstractNumId` directly.
264
+ */
265
+ interface NumberingDefinitions {
266
+ /** Abstract numbering definitions */
267
+ abstractNums: AbstractNumbering[];
268
+ /** Numbering instances */
269
+ nums: NumberingInstance[];
270
+ }
271
+
272
+ /**
273
+ * Math equations (`m:oMath`, `m:oMathPara`). OMML XML is round-tripped
274
+ * verbatim to preserve fidelity Word/Pages/Docs can disagree on.
275
+ */
276
+ /**
277
+ * Math equation content (m:oMath or m:oMathPara)
278
+ */
279
+ interface MathEquation {
280
+ type: 'mathEquation';
281
+ /** Whether this is a block (oMathPara) or inline (oMath) equation */
282
+ display: 'inline' | 'block';
283
+ /** Raw OMML XML for round-trip preservation */
284
+ ommlXml: string;
285
+ /** Plain text representation for accessibility/fallback */
286
+ plainText?: string;
287
+ }
288
+
289
+ /**
290
+ * Tables (`w:tbl`), rows (`w:tr`), and cells (`w:tc`).
291
+ */
292
+
293
+ /**
294
+ * Table cell (`w:tc`). Holds nested block content (paragraphs and nested
295
+ * tables), cell-level formatting (borders, shading, vertical merge),
296
+ * tracked property changes, and tracked structural changes for cell
297
+ * insert/delete/merge operations.
298
+ */
299
+ interface TableCell {
300
+ type: 'tableCell';
301
+ /** Cell formatting */
302
+ formatting?: TableCellFormatting;
303
+ /** Cell-level tracked property changes (w:tcPrChange) */
304
+ propertyChanges?: TableCellPropertyChange[];
305
+ /** Tracked structural changes (cell insert/delete/merge) */
306
+ structuralChange?: TableStructuralChangeInfo;
307
+ /** Cell content (paragraphs, tables, etc.) */
308
+ content: (Paragraph | Table)[];
309
+ }
310
+ /**
311
+ * Table row (`w:tr`) — an ordered list of `TableCell` plus row-level
312
+ * formatting (height, repeated header, cantSplit) and tracked changes
313
+ * for inserts/deletes.
314
+ */
315
+ interface TableRow {
316
+ type: 'tableRow';
317
+ /** Row formatting */
318
+ formatting?: TableRowFormatting;
319
+ /** Row-level tracked property changes (w:trPrChange) */
320
+ propertyChanges?: TableRowPropertyChange[];
321
+ /** Tracked structural changes (row insert/delete) */
322
+ structuralChange?: TableStructuralChangeInfo;
323
+ /** Cells in this row */
324
+ cells: TableCell[];
325
+ }
326
+ /**
327
+ * Table (`w:tbl`) — a block-level grid of rows × cells. Tables carry
328
+ * their own formatting layer (borders, shading, alignment, indent,
329
+ * floating placement) and an explicit column-width grid in twips. Tables
330
+ * can nest arbitrarily through `TableCell.content`.
331
+ *
332
+ * See ECMA-376 §17.4.
333
+ */
334
+ interface Table {
335
+ type: 'table';
336
+ /** Table formatting */
337
+ formatting?: TableFormatting;
338
+ /** Table-level tracked property changes (w:tblPrChange) */
339
+ propertyChanges?: TablePropertyChange[];
340
+ /** Column widths in twips */
341
+ columnWidths?: number[];
342
+ /** Table rows */
343
+ rows: TableRow[];
344
+ }
345
+
346
+ /**
347
+ * Watermark — the MS Word "Design → Watermark" feature.
348
+ *
349
+ * In OOXML a watermark is legacy VML stored inside a header part, inside a
350
+ * paragraph run: `<w:pict><v:shape>…</v:shape></w:pict>`. It renders behind
351
+ * the body content on every page of the section. Word supports two kinds:
352
+ *
353
+ * - **Text** — `<v:shape type="#_x0000_t136"><v:textpath string="DRAFT"/>`
354
+ * with a fill color, font, optional rotation (diagonal vs horizontal) and a
355
+ * reduced-opacity "semitransparent" look.
356
+ * - **Picture** — `<v:shape><v:imagedata r:id="rIdN"/>` referencing a media
357
+ * file, scaled, optionally "washed out" (lightened).
358
+ *
359
+ * We model the watermark as a dedicated field on the owning `HeaderFooter`
360
+ * rather than as editable run content, so it stays out of the ProseMirror text
361
+ * flow while still round-tripping through parse → render → serialize.
362
+ */
363
+ /**
364
+ * Text watermark (e.g. "CONFIDENTIAL", "DRAFT").
365
+ */
366
+ interface TextWatermark {
367
+ kind: 'text';
368
+ /** The watermark text. */
369
+ text: string;
370
+ /** Font family (e.g. 'Calibri'). */
371
+ font: string;
372
+ /** Fill color as a CSS hex string (e.g. '#C0C0C0'). */
373
+ color: string;
374
+ /** Word's "Semitransparent" checkbox — renders at reduced opacity. */
375
+ semitransparent: boolean;
376
+ /** Diagonal (≈ -45°) or horizontal layout. */
377
+ layout: 'diagonal' | 'horizontal';
378
+ /** Font size in points. When undefined the renderer auto-sizes to the page (Word's "Auto"). */
379
+ fontSize?: number;
380
+ /** Accessibility flag. Undefined defaults to true for watermarks. */
381
+ decorative?: boolean;
382
+ }
383
+ /**
384
+ * Picture watermark — a scaled, optionally washed-out background image.
385
+ */
386
+ interface PictureWatermark {
387
+ kind: 'picture';
388
+ /** Header-part relationship id of the media (set for images parsed from an existing file). */
389
+ relId?: string;
390
+ /** Package path of the media, e.g. 'word/media/image1.png'. */
391
+ mediaPath?: string;
392
+ /** Raw bytes for an image added in-editor (no rId yet). */
393
+ data?: Uint8Array;
394
+ /** MIME type for `data`. */
395
+ contentType?: string;
396
+ /** Ready-to-use data URL for rendering (resolved from media or `data`). */
397
+ dataUrl?: string;
398
+ /** Scale factor; 1 = 100% / Word's "Auto". */
399
+ scale: number;
400
+ /** Word's "Washout" checkbox — lightens the image so text stays readable. */
401
+ washout: boolean;
402
+ /** Natural width in EMUs (when known). */
403
+ widthEmu?: number;
404
+ /** Natural height in EMUs (when known). */
405
+ heightEmu?: number;
406
+ /** Accessibility flag. Undefined defaults to true for watermarks. */
407
+ decorative?: boolean;
408
+ }
409
+ /**
410
+ * A document watermark — text or picture.
411
+ */
412
+ type Watermark = TextWatermark | PictureWatermark;
413
+ /**
414
+ * Default text-watermark presets shown in the watermark dialog, mirroring the
415
+ * canned phrases MS Word offers. Adapters expose a `watermarkPresets` prop to
416
+ * override this list; both React and Vue fall back to these when unset.
417
+ */
418
+ declare const DEFAULT_WATERMARK_PRESETS: readonly string[];
419
+ /**
420
+ * Compute the display dimensions (in EMUs) for a picture watermark from the
421
+ * source image's natural pixel size. Bounds the larger side to a page-sized
422
+ * default and derives the other from the aspect ratio, so the watermark is
423
+ * never distorted (the serializer would otherwise force a square) and never
424
+ * overflows the page. Returns `undefined` for an unusable size (zero/NaN),
425
+ * letting callers fall back to defaults.
426
+ */
427
+ declare function pictureWatermarkDisplayEmu(naturalWidthPx: number, naturalHeightPx: number): {
428
+ widthEmu: number;
429
+ heightEmu: number;
430
+ } | undefined;
431
+
432
+ /**
433
+ * Page furniture — headers (`w:hdr`), footers (`w:ftr`), footnotes
434
+ * (`w:footnote`), and endnotes (`w:endnote`), plus the section-level
435
+ * properties (`w:footnotePr`/`w:endnotePr`) that configure note layout.
436
+ */
437
+
438
+ /**
439
+ * Header/footer type
440
+ */
441
+ type HeaderFooterType = 'default' | 'first' | 'even';
442
+ /**
443
+ * Header or footer reference
444
+ */
445
+ interface HeaderReference {
446
+ type: HeaderFooterType;
447
+ rId: string;
448
+ }
449
+ interface FooterReference {
450
+ type: HeaderFooterType;
451
+ rId: string;
452
+ }
453
+ /**
454
+ * Header or footer content
455
+ */
456
+ interface HeaderFooter {
457
+ type: 'header' | 'footer';
458
+ /** Header/footer type */
459
+ hdrFtrType: HeaderFooterType;
460
+ /** Content (paragraphs, tables, etc.) */
461
+ content: BlockContent[];
462
+ /**
463
+ * Watermark stored on this header (MS Word "Design → Watermark"). Lives
464
+ * here, not in `content`, so it stays out of the editable text flow while
465
+ * still round-tripping. Only headers carry watermarks; footers never do.
466
+ */
467
+ watermark?: Watermark;
468
+ }
469
+ /**
470
+ * Footnote position
471
+ */
472
+ type FootnotePosition = 'pageBottom' | 'beneathText' | 'sectEnd' | 'docEnd';
473
+ /**
474
+ * Endnote position
475
+ */
476
+ type EndnotePosition = 'sectEnd' | 'docEnd';
477
+ /**
478
+ * Number restart type
479
+ */
480
+ type NoteNumberRestart = 'continuous' | 'eachSect' | 'eachPage';
481
+ /** Shared note kind used by footnote/endnote layout contracts. */
482
+ type NoteKind = 'footnote' | 'endnote';
483
+ /** Reference to a special separator/continuation note. */
484
+ interface NoteSeparatorReference {
485
+ kind?: 'separator' | 'continuationSeparator' | 'continuationNotice';
486
+ noteId?: number;
487
+ }
488
+ /**
489
+ * Footnote properties
490
+ */
491
+ interface FootnoteProperties {
492
+ position?: FootnotePosition;
493
+ numFmt?: NumberFormat;
494
+ numStart?: number;
495
+ numRestart?: NoteNumberRestart;
496
+ /** Optional custom number-format string (`w:numFmt/@w:format`). */
497
+ customNumberFormat?: string;
498
+ /** Authored special-note references. Undefined = package defaults. */
499
+ separators?: NoteSeparatorReference[];
500
+ }
501
+ /**
502
+ * Endnote properties
503
+ */
504
+ interface EndnoteProperties {
505
+ position?: EndnotePosition;
506
+ numFmt?: NumberFormat;
507
+ numStart?: number;
508
+ numRestart?: NoteNumberRestart;
509
+ /** Optional custom number-format string (`w:numFmt/@w:format`). */
510
+ customNumberFormat?: string;
511
+ /** Authored special-note references. Undefined = package defaults. */
512
+ separators?: NoteSeparatorReference[];
513
+ }
514
+ /**
515
+ * Footnote (w:footnote)
516
+ */
517
+ interface Footnote {
518
+ type: 'footnote';
519
+ /** Footnote ID */
520
+ id: number;
521
+ /** Special footnote type */
522
+ noteType?: 'normal' | 'separator' | 'continuationSeparator' | 'continuationNotice';
523
+ /**
524
+ * Content. Per ECMA-376 §17.11.10 footnotes can hold the same blocks as
525
+ * the body, so the note parser reuses the body's `parseBlockContent`: the
526
+ * full block model — paragraphs, tables, and block-level `w:sdt` content
527
+ * controls (as `BlockSdt`) — flows through the body pipeline
528
+ * (toProseDoc → toLayoutBlocks) and stays editable on round-trip.
529
+ */
530
+ content: BlockContent[];
531
+ /**
532
+ * Verbatim original XML of the entire `<w:footnote>` element, captured at
533
+ * parse time ONLY when the note body carries a block-level construct the
534
+ * model still can't represent — note-level bookmarks
535
+ * (`w:bookmarkStart`/`w:bookmarkEnd`) or `w:customXml`. Block-level `w:sdt`
536
+ * is NOT a trigger: it round-trips through the model as `BlockSdt`. When
537
+ * present the serializer re-emits these bytes instead of rebuilding from
538
+ * `content`, restoring pre-#646 fidelity for the unmodeled constructs.
539
+ * See `parseNoteBlockContent` / `serializeNote` for the gate (#646 F3).
540
+ */
541
+ verbatimXml?: string;
542
+ }
543
+ /**
544
+ * Endnote (w:endnote)
545
+ */
546
+ interface Endnote {
547
+ type: 'endnote';
548
+ /** Endnote ID */
549
+ id: number;
550
+ /** Special endnote type */
551
+ noteType?: 'normal' | 'separator' | 'continuationSeparator' | 'continuationNotice';
552
+ /**
553
+ * Content. Per ECMA-376 §17.11.4 endnotes can hold the same blocks as
554
+ * the body — paragraphs, tables, and block-level content controls. See note
555
+ * on `Footnote.content`.
556
+ */
557
+ content: BlockContent[];
558
+ /** Verbatim original XML — see `Footnote.verbatimXml` (#646 F3). */
559
+ verbatimXml?: string;
560
+ }
561
+
562
+ /**
563
+ * Comments (`w:comment` in `comments.xml`) and the inline range markers
564
+ * (`w:commentRangeStart`/`End`) that anchor them inside paragraphs.
565
+ */
566
+
567
+ /** Stable reviewer/color assignment shared by comments and revisions. */
568
+ interface CommentAuthor {
569
+ id?: string;
570
+ name?: string;
571
+ initials?: string;
572
+ paletteIndex?: number;
573
+ color?: string;
574
+ }
575
+ /** Exact model anchor for a comment range. */
576
+ interface CommentAnchorRange {
577
+ startBlockId?: string | number;
578
+ startOffset?: number;
579
+ endBlockId?: string | number;
580
+ endOffset?: number;
581
+ collapsed?: boolean;
582
+ objectId?: string;
583
+ }
584
+ /**
585
+ * A comment from `comments.xml` — the top-level entity for review
586
+ * comments and replies. `id` matches the inline `CommentRangeStart` /
587
+ * `CommentRangeEnd` markers that anchor it inside a paragraph; `parentId`
588
+ * threads replies under their parent; `done` reflects Word's "Resolve"
589
+ * state (`w15:done`).
590
+ */
591
+ interface Comment {
592
+ /** Comment ID (matches commentRangeStart/End) */
593
+ id: number;
594
+ /** Author name */
595
+ author: string;
596
+ /** Author initials */
597
+ initials?: string;
598
+ /** Date */
599
+ date?: string;
600
+ /** Comment content (paragraphs) */
601
+ content: Paragraph[];
602
+ /** Parent comment ID (for replies) */
603
+ parentId?: number;
604
+ /** Whether the comment is resolved/done */
605
+ done?: boolean;
606
+ /** Explicit status. Undefined is derived from `done` (false/active). */
607
+ status?: 'active' | 'resolved';
608
+ /** Stable reviewer/person id from modern comment parts. */
609
+ authorId?: string;
610
+ /** Durable modern-comment id. */
611
+ durableId?: string;
612
+ /** Paragraph id used to join commentsExtended metadata. */
613
+ paraId?: string;
614
+ /** UTC timestamp from modern comment metadata. */
615
+ dateUtc?: string;
616
+ /** Stable author-palette index. Undefined = derive by first occurrence. */
617
+ paletteIndex?: number;
618
+ /** Exact range/object anchor. Undefined = use inline markers. */
619
+ anchorRange?: CommentAnchorRange;
620
+ /** Rich block content. Undefined = use legacy paragraph-only `content`. */
621
+ blockContent?: BlockContent[];
622
+ }
623
+ /**
624
+ * Comment range start marker in paragraph content
625
+ */
626
+ interface CommentRangeStart {
627
+ type: 'commentRangeStart';
628
+ id: number;
629
+ /** Block-local offset. Undefined = marker position in source order. */
630
+ offset?: number;
631
+ }
632
+ /**
633
+ * Comment range end marker in paragraph content
634
+ */
635
+ interface CommentRangeEnd {
636
+ type: 'commentRangeEnd';
637
+ id: number;
638
+ /** Block-local offset. Undefined = marker position in source order. */
639
+ offset?: number;
640
+ }
641
+
642
+ /**
643
+ * Section properties (`w:sectPr`) — page size and margins, columns,
644
+ * header/footer references, line numbers, page borders, document grid,
645
+ * paper sources — plus the section and document-body containers that
646
+ * group block-level content.
647
+ */
648
+
649
+ /**
650
+ * Page orientation
651
+ */
652
+ type PageOrientation = 'portrait' | 'landscape';
653
+ /**
654
+ * Section start type
655
+ */
656
+ type SectionStart = 'continuous' | 'nextPage' | 'oddPage' | 'evenPage' | 'nextColumn';
657
+ /**
658
+ * Vertical alignment
659
+ */
660
+ type VerticalAlign = 'top' | 'center' | 'both' | 'bottom';
661
+ /**
662
+ * Line number restart type
663
+ */
664
+ type LineNumberRestart = 'continuous' | 'newPage' | 'newSection';
665
+ /**
666
+ * Column definition
667
+ */
668
+ interface Column {
669
+ /** Column width in twips */
670
+ width?: number;
671
+ /** Space after column in twips */
672
+ space?: number;
673
+ }
674
+ /** Section-scoped page label settings from `w:pgNumType`. */
675
+ interface PageNumberingProperties {
676
+ /** Logical page-number restart (`@w:start`). Undefined = continue. */
677
+ start?: number;
678
+ /** Number format (`@w:fmt`). Undefined = decimal. */
679
+ format?: NumberFormat;
680
+ /** Heading/list outline level used for chapter prefixes (`@w:chapStyle`). */
681
+ chapterStyle?: number;
682
+ /** Chapter/page separator (`@w:chapSep`). Undefined = hyphen. */
683
+ chapterSeparator?: 'colon' | 'emDash' | 'enDash' | 'hyphen' | 'period';
684
+ }
685
+ /**
686
+ * Section properties (`w:sectPr`) — page geometry, margins, columns,
687
+ * header/footer references, and page numbering for one section of the
688
+ * document. Sections are introduced by inline `sectPr` markers on the
689
+ * terminating paragraph (`Paragraph.sectionProperties`) and the body's
690
+ * final `sectPr`.
691
+ *
692
+ * All distance units are twips (1/20 of a point) on the wire. The layout
693
+ * engine converts to pixels.
694
+ *
695
+ * See ECMA-376 §17.6.
696
+ */
697
+ interface SectionProperties {
698
+ /** Stable section identity. Undefined preserves positional identity. */
699
+ sectionId?: string;
700
+ /** Page width in twips */
701
+ pageWidth?: number;
702
+ /** Page height in twips */
703
+ pageHeight?: number;
704
+ /** Page orientation */
705
+ orientation?: PageOrientation;
706
+ /** Top margin in twips */
707
+ marginTop?: number;
708
+ /** Bottom margin in twips */
709
+ marginBottom?: number;
710
+ /** Left margin in twips */
711
+ marginLeft?: number;
712
+ /** Right margin in twips */
713
+ marginRight?: number;
714
+ /** Header distance from top in twips */
715
+ headerDistance?: number;
716
+ /** Footer distance from bottom in twips */
717
+ footerDistance?: number;
718
+ /** Gutter margin in twips */
719
+ gutter?: number;
720
+ /** Number of columns */
721
+ columnCount?: number;
722
+ /** Space between columns in twips */
723
+ columnSpace?: number;
724
+ /** Equal width columns */
725
+ equalWidth?: boolean;
726
+ /** Separator line between columns */
727
+ separator?: boolean;
728
+ /** Individual column definitions */
729
+ columns?: Column[];
730
+ /**
731
+ * Number of columns the footnote area is laid out in (`w15:footnoteColumns`).
732
+ * Word's "Footnote layout → Columns" setting, independent of the body column
733
+ * count above. Undefined/1 means the footnote area follows the body (single
734
+ * column for a single-column section). See ECMA-376 + the w15 extension.
735
+ */
736
+ footnoteColumns?: number;
737
+ /** Section start type */
738
+ sectionStart?: SectionStart;
739
+ /** Vertical alignment of text */
740
+ verticalAlign?: VerticalAlign;
741
+ /** Right-to-left section */
742
+ bidi?: boolean;
743
+ /** Header references */
744
+ headerReferences?: HeaderReference[];
745
+ /** Footer references */
746
+ footerReferences?: FooterReference[];
747
+ /** Different first page header/footer */
748
+ titlePg?: boolean;
749
+ /** Different odd/even page headers/footers */
750
+ evenAndOddHeaders?: boolean;
751
+ /** Line numbering settings */
752
+ lineNumbers?: {
753
+ start?: number;
754
+ countBy?: number;
755
+ distance?: number;
756
+ restart?: LineNumberRestart;
757
+ };
758
+ /** Section-scoped page-number restart/format (`w:pgNumType`). */
759
+ pageNumbering?: PageNumberingProperties;
760
+ /** Page borders */
761
+ pageBorders?: {
762
+ top?: BorderSpec;
763
+ bottom?: BorderSpec;
764
+ left?: BorderSpec;
765
+ right?: BorderSpec;
766
+ /** Display setting */
767
+ display?: 'allPages' | 'firstPage' | 'notFirstPage';
768
+ /** Offset from */
769
+ offsetFrom?: 'page' | 'text';
770
+ /** Z-order */
771
+ zOrder?: 'front' | 'back';
772
+ };
773
+ /** Page background */
774
+ background?: {
775
+ color?: ColorValue;
776
+ themeColor?: ThemeColorSlot;
777
+ themeTint?: string;
778
+ themeShade?: string;
779
+ };
780
+ /** Effective header-owned watermark projection. Undefined = none/inherit. */
781
+ watermark?: Watermark;
782
+ /** Footnote properties for this section */
783
+ footnotePr?: FootnoteProperties;
784
+ /** Endnote properties for this section */
785
+ endnotePr?: EndnoteProperties;
786
+ /** Document grid */
787
+ docGrid?: {
788
+ type?: 'default' | 'lines' | 'linesAndChars' | 'snapToChars';
789
+ linePitch?: number;
790
+ charSpace?: number;
791
+ };
792
+ /** First page paper source */
793
+ paperSrcFirst?: number;
794
+ /** Other pages paper source */
795
+ paperSrcOther?: number;
796
+ }
797
+ /**
798
+ * Block-level content types
799
+ */
800
+ type BlockContent = Paragraph | Table | BlockSdt;
801
+ /**
802
+ * One section of the document — a `SectionProperties` plus the block
803
+ * content (`Paragraph`s and `Table`s) that lives under those properties.
804
+ *
805
+ * Sections are derived during parse: every paragraph carrying an inline
806
+ * `sectPr` ends a section, and the body's final `sectPr` defines the
807
+ * last section. Each section may carry its own headers/footers map.
808
+ */
809
+ interface Section {
810
+ /** Stable section identity. Undefined = derive from array position. */
811
+ id?: string;
812
+ /** Section properties */
813
+ properties: SectionProperties;
814
+ /** Content in this section */
815
+ content: BlockContent[];
816
+ /** Headers for this section */
817
+ headers?: Map<HeaderFooterType, HeaderFooter>;
818
+ /** Footers for this section */
819
+ footers?: Map<HeaderFooterType, HeaderFooter>;
820
+ }
821
+ /**
822
+ * Document body (`w:body`) — the editable content of the document.
823
+ *
824
+ * Contains the ordered block content (paragraphs and tables), the section
825
+ * layout chain derived from inline `sectPr` markers, the final `sectPr`,
826
+ * and any document-level comments. This is what most edit operations
827
+ * mutate; headers/footers/styles live elsewhere in the package.
828
+ */
829
+ interface DocumentBody {
830
+ /** All content (paragraphs, tables) */
831
+ content: BlockContent[];
832
+ /** Sections (derived from sectPr in paragraphs and final sectPr) */
833
+ sections?: Section[];
834
+ /** Final section properties (from body's sectPr) */
835
+ finalSectionProperties?: SectionProperties;
836
+ /** Comments from comments.xml */
837
+ comments?: Comment[];
838
+ /** Stable reviewer palette metadata. Undefined = derive colors by author order. */
839
+ commentAuthors?: CommentAuthor[];
840
+ }
841
+
842
+ /**
843
+ * Structured Document Tags / content controls (`w:sdt`) — inline and
844
+ * block variants, plus properties (alias, tag, lock, list items,
845
+ * checkbox state) for the supported SDT types.
846
+ */
847
+
848
+ /** Glyph/font pair used by checkbox states (`w14:*State`). */
849
+ interface SdtCheckboxGlyph {
850
+ /** Unicode code point as authored. Undefined = Word default glyph. */
851
+ value?: string;
852
+ /** Glyph font. Undefined = inherit/control default. */
853
+ font?: string;
854
+ }
855
+ /** Projected date-control state (`w:date`). */
856
+ interface SdtDateState {
857
+ fullDate?: string;
858
+ format?: string;
859
+ language?: string;
860
+ calendar?: string;
861
+ storageFormat?: 'date' | 'dateTime' | 'text';
862
+ }
863
+ /** Projected building-block gallery/list settings. */
864
+ interface SdtGalleryState {
865
+ gallery?: string;
866
+ category?: string;
867
+ unique?: boolean;
868
+ }
869
+ /** Renderer/editor-neutral typed-control state. Missing members are unset. */
870
+ interface SdtControlState {
871
+ value?: string;
872
+ checked?: boolean;
873
+ selectedIndex?: number;
874
+ selectedValue?: string;
875
+ enabled?: boolean;
876
+ placeholder?: boolean;
877
+ }
878
+ /**
879
+ * SDT type (content control type).
880
+ *
881
+ * Values mirror the `w:sdtPr` type-marker element names from ECMA-376
882
+ * §17.5.2 (`CT_SdtPr`), with two deliberate exceptions:
883
+ * - `checkbox` is the `w14:checkbox` (Office 2010) extension, not a base
884
+ * OOXML type marker.
885
+ * - `buildingBlockGallery` covers both `w:docPartObj` and `w:docPartList`.
886
+ *
887
+ * A `w:sdtPr` with no type marker means `richText` (the spec default). A
888
+ * type marker the parser does not model maps to `unknown` — it is never
889
+ * coerced to `richText`, so the projection stays honest. Round-trip
890
+ * fidelity does not depend on this enum: the raw `w:sdtPr` is replayed
891
+ * verbatim (see `rawPropertiesXml`).
892
+ */
893
+ type SdtType = 'richText' | 'plainText' | 'date' | 'dropDownList' | 'comboBox' | 'checkbox' | 'picture' | 'buildingBlockGallery' | 'group' | 'equation' | 'citation' | 'bibliography' | 'repeatingSection' | 'repeatingSectionItem' | 'unknown';
894
+ /**
895
+ * XML data binding (`w:dataBinding`) — links a content control to a node in a
896
+ * Custom XML data store. Modeled read-only; the binding round-trips verbatim
897
+ * via `rawPropertiesXml` (this projection is for inspection, e.g. "which
898
+ * controls are bound, and to what XPath"). The editor does not resolve or
899
+ * sync bound values.
900
+ */
901
+ interface SdtDataBinding {
902
+ /** XPath into the bound Custom XML part (`w:xpath`). */
903
+ xpath?: string;
904
+ /** Target Custom XML store id (`w:storeItemID`). */
905
+ storeItemID?: string;
906
+ /** Namespace prefix mappings used by the XPath (`w:prefixMappings`). */
907
+ prefixMappings?: string;
908
+ }
909
+ /**
910
+ * SDT properties (`w:sdtPr`).
911
+ *
912
+ * The modeled fields are a **read-only projection** for downstream tooling
913
+ * (tag/alias addressing, template extraction). They are NOT the
914
+ * serialization source: the original `w:sdtPr` is captured verbatim in
915
+ * `rawPropertiesXml` and replayed on save, which preserves element order
916
+ * (`CT_SdtPr` is an `xsd:sequence`), avoids double-emission, and keeps
917
+ * unmodeled features (data binding, `w15:*`, `@lastValue`) lossless.
918
+ */
919
+ interface SdtProperties {
920
+ /** SDT type (projection; see {@link SdtType}). */
921
+ sdtType: SdtType;
922
+ /** Unique numeric id (`w:id`, signed). */
923
+ id?: number;
924
+ /** Alias (friendly name, `w:alias`). */
925
+ alias?: string;
926
+ /** Tag (developer identifier, `w:tag`). */
927
+ tag?: string;
928
+ /** Lock setting (`w:lock`). */
929
+ lock?: 'sdtLocked' | 'contentLocked' | 'sdtContentLocked' | 'unlocked';
930
+ /**
931
+ * Placeholder building-block name (`w:placeholder/w:docPart@w:val`).
932
+ * This is a reference to a glossary docPart that supplies the placeholder
933
+ * content — NOT the literal placeholder text.
934
+ */
935
+ placeholder?: string;
936
+ /** Whether the control is currently showing its placeholder (`w:showingPlcHdr`). */
937
+ showingPlaceholder?: boolean;
938
+ /** Date display format for date controls (`w:date/w:dateFormat@w:val`). */
939
+ dateFormat?: string;
940
+ /** Dropdown/combobox list items. */
941
+ listItems?: {
942
+ displayText: string;
943
+ value: string;
944
+ }[];
945
+ /** Checkbox checked state (`w14:checkbox`). */
946
+ checked?: boolean;
947
+ /** Run properties applied to the control (`w:sdtPr/w:rPr`). */
948
+ runProperties?: TextFormatting;
949
+ /** Remove the control wrapper after editing (`w:temporary`). Undefined = false. */
950
+ temporary?: boolean;
951
+ /** Numeric label (`w:label/@w:val`). */
952
+ label?: number;
953
+ /** Keyboard tab index (`w:tabIndex/@w:val`). */
954
+ tabIndex?: number;
955
+ /** Plain-text control multiline flag. Undefined = false. */
956
+ multiLine?: boolean;
957
+ /** Complete date-control metadata. Undefined = legacy `dateFormat` only. */
958
+ dateState?: SdtDateState;
959
+ /** Last dropdown/combo value (`w:lastValue`). */
960
+ listLastValue?: string;
961
+ /** Checked glyph/font (`w14:checkedState`). */
962
+ checkedState?: SdtCheckboxGlyph;
963
+ /** Unchecked glyph/font (`w14:uncheckedState`). */
964
+ uncheckedState?: SdtCheckboxGlyph;
965
+ /** Building-block gallery metadata. */
966
+ gallery?: SdtGalleryState;
967
+ /** Office content-control appearance. Undefined = bounding box. */
968
+ appearance?: 'boundingBox' | 'tags' | 'hidden';
969
+ /** Office content-control accent color. Undefined = host/Word default. */
970
+ color?: ColorValue;
971
+ /** Typed state used by overlays. Undefined = derive from cached content. */
972
+ controlState?: SdtControlState;
973
+ /** `w15:repeatingSection` marker. Undefined = false. */
974
+ repeatingSection?: boolean;
975
+ /** `w15:repeatingSectionItem` marker. Undefined = false. */
976
+ repeatingSectionItem?: boolean;
977
+ /** XML data binding (`w:dataBinding`), if the control is bound. */
978
+ dataBinding?: SdtDataBinding;
979
+ /**
980
+ * The original `<w:sdtPr>` serialized verbatim as an XML string, captured
981
+ * at parse time. Replayed unchanged on save so the properties block
982
+ * round-trips losslessly. Stored as a string (not an `XmlElement`) so the
983
+ * types layer stays free of the parser/`xml-js` dependency. Absent for
984
+ * SDTs created programmatically — the serializer then synthesizes a
985
+ * minimal, sequence-valid `w:sdtPr` from the modeled fields.
986
+ */
987
+ rawPropertiesXml?: string;
988
+ /** The original `<w:sdtEndPr>` serialized verbatim, if present. */
989
+ rawEndPropertiesXml?: string;
990
+ }
991
+ /**
992
+ * Inline SDT (content control within a paragraph)
993
+ */
994
+ interface InlineSdt {
995
+ type: 'inlineSdt';
996
+ /** SDT properties */
997
+ properties: SdtProperties;
998
+ /**
999
+ * Inline content held inside the control. OOXML allows runs,
1000
+ * hyperlinks, simple/complex fields, nested SDTs, and math at this
1001
+ * level; the renderer must descend into all of them so docProps-bound
1002
+ * fields and similar template content survive paged rendering.
1003
+ */
1004
+ content: (Run | Hyperlink | SimpleField | ComplexField | InlineSdt | MathEquation)[];
1005
+ }
1006
+ /**
1007
+ * Block-level SDT (content control wrapping block content).
1008
+ *
1009
+ * `content` is `BlockContent[]` (not just paragraphs/tables) so a nested
1010
+ * block SDT survives the round trip. `CT_SdtContentBlock` also permits
1011
+ * run-level content (bookmarks, etc.); that is carried through the same
1012
+ * block-content parsing as elsewhere in the document.
1013
+ */
1014
+ interface BlockSdt {
1015
+ type: 'blockSdt';
1016
+ /** SDT properties */
1017
+ properties: SdtProperties;
1018
+ /** Block content inside the control */
1019
+ content: BlockContent[];
1020
+ }
1021
+
1022
+ /**
1023
+ * Hyperlinks (`w:hyperlink`), bookmark markers (`w:bookmarkStart`/`End`),
1024
+ * and field types (`w:fldSimple`, complex `w:fldChar` runs).
1025
+ */
1026
+
1027
+ /** Stable document position used by bookmark and field range contracts. */
1028
+ interface ContentPosition {
1029
+ /** Stable block/paragraph id. Undefined = unresolved. */
1030
+ blockId?: string | number;
1031
+ /** Inline offset within the block. Undefined = block boundary. */
1032
+ offset?: number;
1033
+ /** Table/grid ancestry for cross-cell ranges. Undefined = body flow. */
1034
+ path?: number[];
1035
+ }
1036
+ /** A resolved bookmark range; absent endpoints represent an unresolved marker. */
1037
+ interface BookmarkRange {
1038
+ id?: number;
1039
+ name?: string;
1040
+ start?: ContentPosition;
1041
+ end?: ContentPosition;
1042
+ colFirst?: number;
1043
+ colLast?: number;
1044
+ }
1045
+ /**
1046
+ * Hyperlink (`w:hyperlink`) — wraps runs in a clickable link. External
1047
+ * targets resolve through the relationships part (`rId` → `href`);
1048
+ * internal targets reference a `BookmarkStart` anchor by name.
1049
+ */
1050
+ interface Hyperlink {
1051
+ type: 'hyperlink';
1052
+ /** Relationship ID for external link */
1053
+ rId?: string;
1054
+ /** Resolved URL (from relationships) */
1055
+ href?: string;
1056
+ /** Internal bookmark anchor */
1057
+ anchor?: string;
1058
+ /** Tooltip text */
1059
+ tooltip?: string;
1060
+ /** Target frame */
1061
+ target?: string;
1062
+ /** Link history tracking */
1063
+ history?: boolean;
1064
+ /** Document location */
1065
+ docLocation?: string;
1066
+ /** Child runs */
1067
+ children: (Run | BookmarkStart | BookmarkEnd)[];
1068
+ /**
1069
+ * Recursive `EG_PContent` projection for fields, SDTs, math, and bookmarks.
1070
+ * Undefined means consumers use the legacy `children` run list.
1071
+ */
1072
+ structuredChildren?: HyperlinkContent[];
1073
+ }
1074
+ /** Recursive hyperlink child grammar. Nested hyperlinks remain invalid. */
1075
+ type HyperlinkContent = Run | BookmarkStart | BookmarkEnd | SimpleField | ComplexField | InlineSdt | MathEquation;
1076
+ /**
1077
+ * Bookmark start marker (w:bookmarkStart)
1078
+ */
1079
+ interface BookmarkStart {
1080
+ type: 'bookmarkStart';
1081
+ /** Bookmark ID */
1082
+ id: number;
1083
+ /** Bookmark name */
1084
+ name: string;
1085
+ /** Column index for table bookmarks */
1086
+ colFirst?: number;
1087
+ colLast?: number;
1088
+ /** Exact source position. Undefined = legacy paragraph-boundary behavior. */
1089
+ position?: ContentPosition;
1090
+ }
1091
+ /**
1092
+ * Bookmark end marker (w:bookmarkEnd)
1093
+ */
1094
+ interface BookmarkEnd {
1095
+ type: 'bookmarkEnd';
1096
+ /** Bookmark ID */
1097
+ id: number;
1098
+ /** Exact source position. Undefined = legacy paragraph-boundary behavior. */
1099
+ position?: ContentPosition;
1100
+ }
1101
+ /**
1102
+ * Known field types
1103
+ */
1104
+ 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' | 'FORMTEXT' | 'FORMCHECKBOX' | 'FORMDROPDOWN' | 'CITATION' | 'BIBLIOGRAPHY' | 'UNKNOWN';
1105
+ /**
1106
+ * Recursive, inert field content. Undefined members are empty; no instruction
1107
+ * in this contract is executable merely because it was parsed.
1108
+ */
1109
+ interface StructuredFieldContent {
1110
+ /** Inline result/code children in source order. */
1111
+ inline?: FieldInlineContent[];
1112
+ /** Multi-paragraph/table result children in source order. */
1113
+ blocks?: BlockContent[];
1114
+ }
1115
+ /** Field-capable inline grammar used by nested field code/results. */
1116
+ type FieldInlineContent = Run | Hyperlink | InlineSdt | MathEquation | SimpleField | ComplexField;
1117
+ /** Versioned structured field node; missing version means legacy v0 fields. */
1118
+ interface StructuredFieldTree {
1119
+ /** Contract version. Undefined reads as 0. */
1120
+ version?: number;
1121
+ /** Parsed code container. Undefined = use legacy code fields. */
1122
+ code?: StructuredFieldContent;
1123
+ /** Cached result container. Undefined = use legacy result fields. */
1124
+ result?: StructuredFieldContent;
1125
+ /** Nested child fields in document order. */
1126
+ children?: StructuredFieldTree[];
1127
+ /** Result/code presentation. Undefined = result. */
1128
+ displayMode?: 'result' | 'code';
1129
+ }
1130
+ /**
1131
+ * Simple field (w:fldSimple)
1132
+ */
1133
+ interface SimpleField {
1134
+ type: 'simpleField';
1135
+ /** Field instruction (e.g., "PAGE \\* MERGEFORMAT") */
1136
+ instruction: string;
1137
+ /** Parsed field type */
1138
+ fieldType: FieldType;
1139
+ /** Current display value */
1140
+ content: (Run | Hyperlink)[];
1141
+ /** Field is locked */
1142
+ fldLock?: boolean;
1143
+ /** Field is dirty */
1144
+ dirty?: boolean;
1145
+ /** Rich recursive result projection. Undefined = use `content`. */
1146
+ structuredResult?: StructuredFieldContent;
1147
+ /** Parsed/versioned field tree. Undefined = legacy flat field. */
1148
+ fieldTree?: StructuredFieldTree;
1149
+ }
1150
+ /**
1151
+ * Complex field (w:fldChar begin/separate/end with w:instrText)
1152
+ */
1153
+ interface ComplexField {
1154
+ type: 'complexField';
1155
+ /** Field instruction */
1156
+ instruction: string;
1157
+ /** Parsed field type */
1158
+ fieldType: FieldType;
1159
+ /** Field code runs */
1160
+ fieldCode: Run[];
1161
+ /** Display result runs */
1162
+ fieldResult: Run[];
1163
+ /**
1164
+ * Run formatting carried by the field's structural runs (the runs holding
1165
+ * the `w:fldChar` begin/separate/end). Word styles the field result with
1166
+ * this `w:rPr` when there is no separate result run (e.g. a `PAGE` field
1167
+ * collapsed into a single run). Used as a fallback for rendering and
1168
+ * serialization so the formatting survives the round-trip.
1169
+ */
1170
+ formatting?: TextFormatting;
1171
+ /** Field is locked */
1172
+ fldLock?: boolean;
1173
+ /** Field is dirty */
1174
+ dirty?: boolean;
1175
+ /** Rich recursive code projection. Undefined = use `fieldCode`. */
1176
+ structuredCode?: StructuredFieldContent;
1177
+ /** Rich recursive cached result. Undefined = use `fieldResult`. */
1178
+ structuredResult?: StructuredFieldContent;
1179
+ /** Parsed/versioned nested field tree. Undefined = legacy flat field. */
1180
+ fieldTree?: StructuredFieldTree;
1181
+ }
1182
+ type Field = SimpleField | ComplexField;
1183
+
1184
+ /**
1185
+ * Tracked-changes model — insertion/deletion/move wrappers, range
1186
+ * markers, and per-element property-change wrappers (`w:rPrChange`,
1187
+ * `w:pPrChange`, `w:tblPrChange`, `w:trPrChange`, `w:tcPrChange`) plus
1188
+ * structural changes (row/cell insert/delete/merge).
1189
+ */
1190
+
1191
+ /**
1192
+ * Tracked change metadata (w:ins, w:del attributes)
1193
+ */
1194
+ interface TrackedChangeInfo {
1195
+ /** Revision ID */
1196
+ id: number;
1197
+ /** Author who made the change */
1198
+ author: string;
1199
+ /** Date of the change */
1200
+ date?: string;
1201
+ }
1202
+ /**
1203
+ * Tracked-change attribute triple as it appears on PM node attrs
1204
+ * (`paragraph.pPrIns`, `tableRow.trIns`, etc). Mirrors `TrackedChangeInfo`
1205
+ * but with a `null` date (PM attr defaults) and a `revisionId` name that
1206
+ * matches OOXML's `w:id` more idiomatically on the editor side.
1207
+ *
1208
+ * Round-trip pairs with `TrackedChangeInfo` via
1209
+ * `{ id, author, date? } ↔ { revisionId, author, date | null }`.
1210
+ */
1211
+ interface RevisionInfo {
1212
+ revisionId: number;
1213
+ author: string;
1214
+ date: string | null;
1215
+ }
1216
+ /**
1217
+ * Tracked-cell marker — the OOXML `<w:cellIns>` / `<w:cellDel>` /
1218
+ * `<w:cellMerge>` shape attached to a `TableCell` PM node and surfaced
1219
+ * to the layout model and painter for visual rendering.
1220
+ *
1221
+ * `kind` matches the OOXML element name (ins / del / merge).
1222
+ */
1223
+ interface CellMarker {
1224
+ kind: 'ins' | 'del' | 'merge';
1225
+ info: RevisionInfo;
1226
+ }
1227
+ /**
1228
+ * Generic tracked property-change wrapper metadata (w:*PrChange)
1229
+ */
1230
+ interface PropertyChangeInfo extends TrackedChangeInfo {
1231
+ /** Optional revision session ID */
1232
+ rsid?: string;
1233
+ }
1234
+ /**
1235
+ * Insertion wrapper (w:ins) — runs inserted by tracked changes
1236
+ */
1237
+ interface Insertion {
1238
+ type: 'insertion';
1239
+ /** Tracked change metadata */
1240
+ info: TrackedChangeInfo;
1241
+ /** Inserted content */
1242
+ content: (Run | Hyperlink)[];
1243
+ }
1244
+ /**
1245
+ * Deletion wrapper (w:del) — runs deleted by tracked changes
1246
+ */
1247
+ interface Deletion {
1248
+ type: 'deletion';
1249
+ /** Tracked change metadata */
1250
+ info: TrackedChangeInfo;
1251
+ /** Deleted content */
1252
+ content: (Run | Hyperlink)[];
1253
+ }
1254
+ /**
1255
+ * Move-from wrapper (w:moveFrom) — content moved away from this position
1256
+ */
1257
+ interface MoveFrom {
1258
+ type: 'moveFrom';
1259
+ /** Tracked change metadata */
1260
+ info: TrackedChangeInfo;
1261
+ /** Moved content */
1262
+ content: (Run | Hyperlink)[];
1263
+ }
1264
+ /**
1265
+ * Move-to wrapper (w:moveTo) — content moved into this position
1266
+ */
1267
+ interface MoveTo {
1268
+ type: 'moveTo';
1269
+ /** Tracked change metadata */
1270
+ info: TrackedChangeInfo;
1271
+ /** Moved content */
1272
+ content: (Run | Hyperlink)[];
1273
+ }
1274
+ /**
1275
+ * Move-from range start marker (w:moveFromRangeStart) — ECMA-376 §17.13.5.22
1276
+ * Pairs with moveFromRangeEnd to delimit the source of a move in the document.
1277
+ */
1278
+ interface MoveFromRangeStart {
1279
+ type: 'moveFromRangeStart';
1280
+ id: number;
1281
+ name: string;
1282
+ }
1283
+ /**
1284
+ * Move-from range end marker (w:moveFromRangeEnd)
1285
+ */
1286
+ interface MoveFromRangeEnd {
1287
+ type: 'moveFromRangeEnd';
1288
+ id: number;
1289
+ }
1290
+ /**
1291
+ * Move-to range start marker (w:moveToRangeStart) — ECMA-376 §17.13.5.24
1292
+ * Pairs with moveToRangeEnd to delimit the destination of a move.
1293
+ */
1294
+ interface MoveToRangeStart {
1295
+ type: 'moveToRangeStart';
1296
+ id: number;
1297
+ name: string;
1298
+ }
1299
+ /**
1300
+ * Move-to range end marker (w:moveToRangeEnd)
1301
+ */
1302
+ interface MoveToRangeEnd {
1303
+ type: 'moveToRangeEnd';
1304
+ id: number;
1305
+ }
1306
+ /**
1307
+ * Run-level tracked wrappers represented in WordprocessingML.
1308
+ */
1309
+ type TrackedRunChange = Insertion | Deletion | MoveFrom | MoveTo;
1310
+ /**
1311
+ * Run property change (w:rPrChange)
1312
+ */
1313
+ interface RunPropertyChange {
1314
+ type: 'runPropertyChange';
1315
+ /** Tracked change metadata */
1316
+ info: PropertyChangeInfo;
1317
+ /** Run properties before the tracked change */
1318
+ previousFormatting?: TextFormatting;
1319
+ /** Run properties after the tracked change (editor model convenience) */
1320
+ currentFormatting?: TextFormatting;
1321
+ }
1322
+ /**
1323
+ * Paragraph property change (w:pPrChange)
1324
+ */
1325
+ interface ParagraphPropertyChange {
1326
+ type: 'paragraphPropertyChange';
1327
+ /** Tracked change metadata */
1328
+ info: PropertyChangeInfo;
1329
+ /** Paragraph properties before the tracked change */
1330
+ previousFormatting?: ParagraphFormatting;
1331
+ /** Paragraph properties after the tracked change (editor model convenience) */
1332
+ currentFormatting?: ParagraphFormatting;
1333
+ }
1334
+ /**
1335
+ * Table property change (w:tblPrChange)
1336
+ */
1337
+ interface TablePropertyChange {
1338
+ type: 'tablePropertyChange';
1339
+ /** Tracked change metadata */
1340
+ info: PropertyChangeInfo;
1341
+ /** Table properties before the tracked change */
1342
+ previousFormatting?: TableFormatting;
1343
+ /** Table properties after the tracked change (editor model convenience) */
1344
+ currentFormatting?: TableFormatting;
1345
+ }
1346
+ /**
1347
+ * Table row property change (w:trPrChange)
1348
+ */
1349
+ interface TableRowPropertyChange {
1350
+ type: 'tableRowPropertyChange';
1351
+ /** Tracked change metadata */
1352
+ info: PropertyChangeInfo;
1353
+ /** Row properties before the tracked change */
1354
+ previousFormatting?: TableRowFormatting;
1355
+ /** Row properties after the tracked change (editor model convenience) */
1356
+ currentFormatting?: TableRowFormatting;
1357
+ }
1358
+ /**
1359
+ * Table cell property change (w:tcPrChange)
1360
+ */
1361
+ interface TableCellPropertyChange {
1362
+ type: 'tableCellPropertyChange';
1363
+ /** Tracked change metadata */
1364
+ info: PropertyChangeInfo;
1365
+ /** Cell properties before the tracked change */
1366
+ previousFormatting?: TableCellFormatting;
1367
+ /** Cell properties after the tracked change (editor model convenience) */
1368
+ currentFormatting?: TableCellFormatting;
1369
+ }
1370
+ /**
1371
+ * Table structural tracked change metadata (row/cell insert/delete/merge)
1372
+ */
1373
+ interface TableStructuralChangeInfo {
1374
+ type: 'tableRowInsertion' | 'tableRowDeletion' | 'tableCellInsertion' | 'tableCellDeletion' | 'tableCellMerge';
1375
+ /** Tracked change metadata */
1376
+ info: TrackedChangeInfo;
1377
+ /**
1378
+ * `<w:cellMerge w:vMerge="…">` value, only meaningful for `tableCellMerge`.
1379
+ * Schema `ST_AnnotationVMerge`: `"rest"` = anchor (start of merged span),
1380
+ * `"cont"` = continuation (merged into predecessor). Word's default for a
1381
+ * tracked merge is `"cont"` (most edits track "this cell got merged INTO
1382
+ * the one above"); we preserve the on-disk value when present.
1383
+ */
1384
+ vMerge?: 'rest' | 'cont';
1385
+ /** `<w:cellMerge w:vMergeOrig="…">` — the pre-merge vMerge state. */
1386
+ vMergeOrig?: 'rest' | 'cont';
1387
+ }
1388
+
1389
+ /**
1390
+ * Run content (`w:r`) and the inline pieces that live inside a run —
1391
+ * text, tab, break, symbol, footnote/endnote references, field chars,
1392
+ * instruction text, soft/no-break hyphens, drawings, shapes.
1393
+ */
1394
+
1395
+ /**
1396
+ * Plain text run content (`w:t`). `preserveSpace` mirrors the
1397
+ * `xml:space="preserve"` attribute and matters for runs that begin or end
1398
+ * with whitespace — without it, Word collapses leading/trailing spaces.
1399
+ */
1400
+ interface TextContent {
1401
+ type: 'text';
1402
+ /** The text string */
1403
+ text: string;
1404
+ /** Preserve whitespace (xml:space="preserve") */
1405
+ preserveSpace?: boolean;
1406
+ }
1407
+ /**
1408
+ * Tab character
1409
+ */
1410
+ interface TabContent {
1411
+ type: 'tab';
1412
+ }
1413
+ /**
1414
+ * Line break
1415
+ */
1416
+ interface BreakContent {
1417
+ type: 'break';
1418
+ /** Break type */
1419
+ breakType?: 'page' | 'column' | 'textWrapping';
1420
+ /** Clear type for text wrapping break */
1421
+ clear?: 'none' | 'left' | 'right' | 'all';
1422
+ }
1423
+ /**
1424
+ * Symbol character (special font character)
1425
+ */
1426
+ interface SymbolContent {
1427
+ type: 'symbol';
1428
+ /** Font name */
1429
+ font: string;
1430
+ /** Character code */
1431
+ char: string;
1432
+ }
1433
+ /**
1434
+ * Footnote or endnote reference
1435
+ */
1436
+ interface NoteReferenceContent {
1437
+ type: 'footnoteRef' | 'endnoteRef';
1438
+ /** Note ID */
1439
+ id: number;
1440
+ /** `w:customMarkFollows`; undefined = false/automatic number. */
1441
+ customMarkFollows?: boolean;
1442
+ }
1443
+ /**
1444
+ * Footnote/endnote auto-number mark (`w:footnoteRef` / `w:endnoteRef`).
1445
+ *
1446
+ * Distinct from {@link NoteReferenceContent}: that is the *reference* placed in
1447
+ * the document body (`w:footnoteReference`), whereas this is the numbering
1448
+ * placeholder that lives *inside* the note body — the run carrying it is what
1449
+ * Word renders as the note's leading superscript number. Preserving it keeps
1450
+ * the note's own number visible on round-trip.
1451
+ */
1452
+ interface NoteRefMarkContent {
1453
+ type: 'footnoteRefMark' | 'endnoteRefMark';
1454
+ }
1455
+ /**
1456
+ * Footnote/endnote separator mark (`w:separator` / `w:continuationSeparator`).
1457
+ *
1458
+ * These appear inside the special separator notes (`w:type="separator"` and
1459
+ * `w:type="continuationSeparator"`) and draw the horizontal rule Word places
1460
+ * between the body and its notes. They carry no content; Word rejects a notes
1461
+ * part whose separator notes have lost these markers, so they must round-trip.
1462
+ */
1463
+ interface SeparatorContent {
1464
+ type: 'separator' | 'continuationSeparator';
1465
+ }
1466
+ /** Legacy `w:ffData` projected as inert form-control state. */
1467
+ interface FieldFormData {
1468
+ name?: string;
1469
+ enabled?: boolean;
1470
+ helpText?: string;
1471
+ statusText?: string;
1472
+ entryMacro?: string;
1473
+ exitMacro?: string;
1474
+ calculateOnExit?: boolean;
1475
+ controlType?: 'text' | 'checkbox' | 'dropDown';
1476
+ defaultValue?: string;
1477
+ textType?: string;
1478
+ textFormat?: string;
1479
+ checked?: boolean;
1480
+ defaultChecked?: boolean;
1481
+ checkboxSize?: number;
1482
+ listEntries?: string[];
1483
+ selectedIndex?: number;
1484
+ }
1485
+ /**
1486
+ * Field character (begin/separate/end)
1487
+ */
1488
+ interface FieldCharContent {
1489
+ type: 'fieldChar';
1490
+ /** Field character type */
1491
+ charType: 'begin' | 'separate' | 'end';
1492
+ /** Field is locked */
1493
+ fldLock?: boolean;
1494
+ /** Field is dirty (needs update) */
1495
+ dirty?: boolean;
1496
+ /** Legacy form data. Undefined = no form control. Macros remain inert. */
1497
+ formData?: FieldFormData;
1498
+ }
1499
+ /** Zero-width `w:commentReference` anchor for point/malformed comments. */
1500
+ interface CommentReferenceContent {
1501
+ type: 'commentReference';
1502
+ /** Comment id. Undefined = malformed/unresolved reference. */
1503
+ id?: number;
1504
+ }
1505
+ /**
1506
+ * Field instruction text
1507
+ */
1508
+ interface InstrTextContent {
1509
+ type: 'instrText';
1510
+ /** Field instruction */
1511
+ text: string;
1512
+ }
1513
+ /**
1514
+ * Soft hyphen
1515
+ */
1516
+ interface SoftHyphenContent {
1517
+ type: 'softHyphen';
1518
+ }
1519
+ /**
1520
+ * Non-breaking hyphen
1521
+ */
1522
+ interface NoBreakHyphenContent {
1523
+ type: 'noBreakHyphen';
1524
+ }
1525
+ /**
1526
+ * Drawing/image reference
1527
+ */
1528
+ interface DrawingContent {
1529
+ type: 'drawing';
1530
+ /** Image data */
1531
+ image: Image;
1532
+ }
1533
+ /**
1534
+ * Shape reference
1535
+ */
1536
+ interface ShapeContent {
1537
+ type: 'shape';
1538
+ /** Shape data */
1539
+ shape: Shape;
1540
+ }
1541
+ /**
1542
+ * DrawingML chart reference.
1543
+ */
1544
+ interface ChartContent {
1545
+ type: 'chart';
1546
+ /** Parsed chart data */
1547
+ chart: Chart;
1548
+ }
1549
+ /**
1550
+ * All possible run content types
1551
+ */
1552
+ type RunContent = TextContent | TabContent | BreakContent | SymbolContent | NoteReferenceContent | NoteRefMarkContent | SeparatorContent | CommentReferenceContent | FieldCharContent | InstrTextContent | SoftHyphenContent | NoBreakHyphenContent | DrawingContent | ShapeContent | ChartContent;
1553
+ /**
1554
+ * A run (`w:r`) — a contiguous span of inline content sharing one set of
1555
+ * character properties (bold, italic, font, color, etc.). Runs are the
1556
+ * atomic unit of character formatting; toggling bold on a selection that
1557
+ * spans different formatting creates new runs.
1558
+ *
1559
+ * See ECMA-376 §17.3.2.
1560
+ *
1561
+ * @example
1562
+ * ```ts
1563
+ * const run: Run = {
1564
+ * type: 'run',
1565
+ * formatting: { bold: true },
1566
+ * content: [{ type: 'text', text: 'Hello' }],
1567
+ * };
1568
+ * ```
1569
+ */
1570
+ interface Run {
1571
+ type: 'run';
1572
+ /** Text formatting properties */
1573
+ formatting?: TextFormatting;
1574
+ /** Run-level tracked property changes (w:rPrChange) */
1575
+ propertyChanges?: RunPropertyChange[];
1576
+ /** Run content (text, tabs, breaks, etc.) */
1577
+ content: RunContent[];
1578
+ }
1579
+
1580
+ /**
1581
+ * Paragraph (`w:p`) — the union of inline content that can sit inside a
1582
+ * paragraph (runs, hyperlinks, bookmarks, fields, SDT, comment ranges,
1583
+ * tracked-change wrappers, math) plus paragraph-level metadata
1584
+ * (formatting, list rendering, optional terminating section properties).
1585
+ */
1586
+
1587
+ /**
1588
+ * Inline content that can appear inside a paragraph. Covers runs (text),
1589
+ * hyperlinks, bookmarks, fields, structured document tags, comment range
1590
+ * markers, tracked-change wrappers, and math equations. Every node in
1591
+ * this union carries a `type` discriminator so consumers can narrow at
1592
+ * runtime.
1593
+ */
1594
+ type ParagraphContent = Run | Hyperlink | BookmarkStart | BookmarkEnd | SimpleField | ComplexField | InlineSdt | CommentRangeStart | CommentRangeEnd | Insertion | Deletion | MoveFrom | MoveTo | MoveFromRangeStart | MoveFromRangeEnd | MoveToRangeStart | MoveToRangeEnd | MathEquation;
1595
+ /**
1596
+ * Paragraph (`w:p`) — the primary block-level container in a Word document.
1597
+ *
1598
+ * Every paragraph carries direct formatting (`formatting`), tracked
1599
+ * property changes (`propertyChanges`), inline content (`content`), and
1600
+ * optional list rendering / section break metadata. `paraId` is Word's
1601
+ * stable identifier (`w14:paraId`) and is what `EditorBridge` and the
1602
+ * agent toolkit use to address paragraphs.
1603
+ *
1604
+ * See ECMA-376 §17.3.1.
1605
+ */
1606
+ interface Paragraph {
1607
+ type: 'paragraph';
1608
+ /** Unique paragraph ID */
1609
+ paraId?: string;
1610
+ /** Text ID */
1611
+ textId?: string;
1612
+ /** Paragraph formatting */
1613
+ formatting?: ParagraphFormatting;
1614
+ /** Paragraph-level tracked property changes (w:pPrChange) */
1615
+ propertyChanges?: ParagraphPropertyChange[];
1616
+ /**
1617
+ * Paragraph-mark insertion tracking (`<w:pPr><w:rPr><w:ins/>`). Set when
1618
+ * this paragraph's terminating pilcrow was added as a tracked change —
1619
+ * e.g., the user pressed Enter mid-paragraph in suggesting mode. Reject
1620
+ * joins this paragraph with the following one.
1621
+ */
1622
+ pPrIns?: TrackedChangeInfo;
1623
+ /**
1624
+ * Paragraph-mark deletion tracking (`<w:pPr><w:rPr><w:del/>`). Set when
1625
+ * this paragraph's terminating pilcrow was deleted as a tracked change —
1626
+ * e.g., the user pressed Backspace at the start of the next paragraph in
1627
+ * suggesting mode. Accept joins this paragraph with the following one.
1628
+ */
1629
+ pPrDel?: TrackedChangeInfo;
1630
+ /** Paragraph content */
1631
+ content: ParagraphContent[];
1632
+ /** Computed list rendering (if this is a list item) */
1633
+ listRendering?: ListRendering;
1634
+ /** Word's cached layout says this paragraph started on a new rendered page. */
1635
+ renderedPageBreakBefore?: boolean;
1636
+ /** Section properties (if this paragraph ends a section) */
1637
+ sectionProperties?: SectionProperties;
1638
+ }
1639
+
1640
+ /**
1641
+ * DrawingML shapes (`wps:wsp`) and text boxes — preset shape types,
1642
+ * fill, outline, shape text body, transform.
1643
+ *
1644
+ * This module binds the shared ShapeTextBody to docx paragraphs and keeps the
1645
+ * docx-level Shape/TextBox wrappers.
1646
+ */
1647
+
1648
+ /**
1649
+ * Text body inside a shape (content typed as docx paragraphs)
1650
+ */
1651
+ type ShapeTextBody = ShapeTextBody$1<Paragraph>;
1652
+ /** Detailed DrawingML paint server retained alongside the legacy shared fill. */
1653
+ interface ShapeFillPaint {
1654
+ kind?: 'none' | 'solid' | 'gradient' | 'pattern' | 'picture' | 'theme';
1655
+ color?: ColorValue;
1656
+ themeColor?: ThemeColorSlot;
1657
+ gradientType?: 'linear' | 'path' | 'radial' | 'rectangular';
1658
+ angle?: number;
1659
+ stops?: Array<{
1660
+ position?: number;
1661
+ color?: ColorValue;
1662
+ }>;
1663
+ pathShape?: 'circle' | 'rect' | 'shape';
1664
+ focusRect?: {
1665
+ left?: number;
1666
+ top?: number;
1667
+ right?: number;
1668
+ bottom?: number;
1669
+ };
1670
+ rotateWithShape?: boolean;
1671
+ patternPreset?: string;
1672
+ foregroundColor?: ColorValue;
1673
+ backgroundColor?: ColorValue;
1674
+ picture?: Image;
1675
+ themeRefIndex?: number;
1676
+ /** Picture-fill source crop fractions (`a:srcRect`, 0..1; negative = outset). */
1677
+ srcRect?: {
1678
+ left?: number;
1679
+ top?: number;
1680
+ right?: number;
1681
+ bottom?: number;
1682
+ };
1683
+ /** Picture-fill mode: `a:stretch` (default) or `a:tile`. */
1684
+ fillMode?: 'stretch' | 'tile';
1685
+ /** Picture-fill tile parameters (`a:tile`). Offsets px, scales fractions. */
1686
+ tile?: {
1687
+ offsetX?: number;
1688
+ offsetY?: number;
1689
+ scaleX?: number;
1690
+ scaleY?: number;
1691
+ alignment?: string;
1692
+ flip?: 'none' | 'x' | 'y' | 'xy';
1693
+ };
1694
+ /** Picture-fill stretch target rect fractions (`a:stretch/a:fillRect`, 0..1). */
1695
+ stretchRect?: {
1696
+ left?: number;
1697
+ top?: number;
1698
+ right?: number;
1699
+ bottom?: number;
1700
+ };
1701
+ /** Picture-fill alpha 0..1 (`a:alphaModFix` on the blip). */
1702
+ pictureOpacity?: number;
1703
+ }
1704
+ /** Detailed DrawingML line contract, including arrows and compound/custom dash. */
1705
+ interface ShapeStrokePaint {
1706
+ fill?: ShapeFillPaint;
1707
+ width?: number;
1708
+ dash?: string;
1709
+ customDash?: number[];
1710
+ compound?: 'single' | 'double' | 'thickThin' | 'thinThick' | 'triple';
1711
+ alignment?: 'center' | 'inset';
1712
+ cap?: 'flat' | 'round' | 'square';
1713
+ join?: 'bevel' | 'miter' | 'round';
1714
+ miterLimit?: number;
1715
+ headEnd?: {
1716
+ type?: string;
1717
+ width?: string;
1718
+ length?: string;
1719
+ };
1720
+ tailEnd?: {
1721
+ type?: string;
1722
+ width?: string;
1723
+ length?: string;
1724
+ };
1725
+ themeRefIndex?: number;
1726
+ }
1727
+ /** Common 2-D shape effect. Missing parameters mean the OOXML default. */
1728
+ interface ShapeEffect {
1729
+ kind?: 'shadow' | 'glow' | 'reflection' | 'softEdge' | 'blur' | 'unknown';
1730
+ color?: ColorValue;
1731
+ opacity?: number;
1732
+ blurRadius?: number;
1733
+ distance?: number;
1734
+ direction?: number;
1735
+ size?: number;
1736
+ rawName?: string;
1737
+ }
1738
+ /** Full `a:bodyPr` projection used by text-body/autofit layout. */
1739
+ interface ShapeTextBodyProperties {
1740
+ vertical?: 'horizontal' | 'vertical' | 'vertical270' | 'wordArtVertical' | 'eastAsianVertical' | 'mongolianVertical';
1741
+ rotation?: number;
1742
+ upright?: boolean;
1743
+ anchor?: 'top' | 'middle' | 'bottom' | 'distributed' | 'justified';
1744
+ anchorCenter?: boolean;
1745
+ columns?: number;
1746
+ columnSpacing?: number;
1747
+ wrap?: 'square' | 'none';
1748
+ horizontalOverflow?: 'clip' | 'overflow';
1749
+ verticalOverflow?: 'clip' | 'ellipsis' | 'overflow';
1750
+ margins?: {
1751
+ top?: number;
1752
+ bottom?: number;
1753
+ left?: number;
1754
+ right?: number;
1755
+ };
1756
+ autoFit?: 'none' | 'normal' | 'shape';
1757
+ fontScale?: number;
1758
+ lineSpacingReduction?: number;
1759
+ fromWordArt?: boolean;
1760
+ presetTextWarp?: string;
1761
+ }
1762
+ /** Heterogeneous DrawingML group/canvas scene node. */
1763
+ interface DrawingSceneNode {
1764
+ kind?: 'shape' | 'group' | 'canvas' | 'picture' | 'chart' | 'graphicFrame' | 'contentPart';
1765
+ id?: string;
1766
+ name?: string;
1767
+ shape?: Shape;
1768
+ image?: Image;
1769
+ chart?: Chart;
1770
+ children?: DrawingSceneNode[];
1771
+ transform?: {
1772
+ offsetX?: number;
1773
+ offsetY?: number;
1774
+ width?: number;
1775
+ height?: number;
1776
+ childOffsetX?: number;
1777
+ childOffsetY?: number;
1778
+ childWidth?: number;
1779
+ childHeight?: number;
1780
+ rotation?: number;
1781
+ flipH?: boolean;
1782
+ flipV?: boolean;
1783
+ };
1784
+ fill?: ShapeFillPaint;
1785
+ effects?: ShapeEffect[];
1786
+ relationshipId?: string;
1787
+ }
1788
+ /** Versioned general DrawingML scene. Undefined version reads as legacy v0. */
1789
+ interface DrawingScene {
1790
+ version?: number;
1791
+ root?: DrawingSceneNode;
1792
+ title?: string;
1793
+ description?: string;
1794
+ decorative?: boolean;
1795
+ hidden?: boolean;
1796
+ }
1797
+ /**
1798
+ * Shape/drawing object (wps:wsp)
1799
+ */
1800
+ interface Shape {
1801
+ type: 'shape';
1802
+ /** Shape type preset */
1803
+ shapeType: ShapeType;
1804
+ /** Unique ID */
1805
+ id?: string;
1806
+ /** Name */
1807
+ name?: string;
1808
+ /** Size in EMUs */
1809
+ size: ImageSize;
1810
+ /** Offset in EMUs relative to the containing drawing/group, if any. */
1811
+ offset?: {
1812
+ x: number;
1813
+ y: number;
1814
+ };
1815
+ /** Position for floating shapes */
1816
+ position?: ImagePosition;
1817
+ /** Wrap settings */
1818
+ wrap?: ImageWrap;
1819
+ /** Fill */
1820
+ fill?: ShapeFill;
1821
+ /** Outline/stroke */
1822
+ outline?: ShapeOutline;
1823
+ /** Transform */
1824
+ transform?: ImageTransform;
1825
+ /** Text content inside the shape */
1826
+ textBody?: ShapeTextBody;
1827
+ /** Normalized custom or resolved shape geometry path */
1828
+ geometryPath?: PresetGeometryPathCommand[];
1829
+ /** Nested shapes when this shape is used as a drawing/diagram group. */
1830
+ children?: Shape[];
1831
+ /** Custom geometry points */
1832
+ customGeometry?: string;
1833
+ /** General heterogeneous group/canvas scene. Undefined = legacy shape tree. */
1834
+ scene?: DrawingScene;
1835
+ /** Lossless fill details. Undefined = use `fill`. */
1836
+ fillPaint?: ShapeFillPaint;
1837
+ /** Lossless stroke details. Undefined = use `outline`. */
1838
+ strokePaint?: ShapeStrokePaint;
1839
+ /** Ordered 2-D effects. Undefined = none. */
1840
+ effects?: ShapeEffect[];
1841
+ /** Effect ink/wrap extents in EMUs. Undefined = zero. */
1842
+ effectExtent?: {
1843
+ top?: number;
1844
+ right?: number;
1845
+ bottom?: number;
1846
+ left?: number;
1847
+ };
1848
+ /** Full text-body properties. Undefined = use `textBody` defaults. */
1849
+ textBodyProperties?: ShapeTextBodyProperties;
1850
+ /** Authored accessibility title. Undefined = use name/text. */
1851
+ title?: string;
1852
+ /** Authored accessibility description. */
1853
+ description?: string;
1854
+ /** Decorative flag. Undefined = infer false. */
1855
+ decorative?: boolean;
1856
+ /** Hidden drawing flag. Undefined = visible. */
1857
+ hidden?: boolean;
1858
+ /** Stable z-order. Undefined = source order. */
1859
+ relativeHeight?: number;
1860
+ }
1861
+ /**
1862
+ * Text box (floating text container)
1863
+ */
1864
+ interface TextBox {
1865
+ type: 'textBox';
1866
+ /** Unique ID */
1867
+ id?: string;
1868
+ /** Size */
1869
+ size: ImageSize;
1870
+ /** Position */
1871
+ position?: ImagePosition;
1872
+ /** Wrap settings */
1873
+ wrap?: ImageWrap;
1874
+ /** Fill */
1875
+ fill?: ShapeFill;
1876
+ /** Outline */
1877
+ outline?: ShapeOutline;
1878
+ /** Text content */
1879
+ content: Paragraph[];
1880
+ /** Internal margins */
1881
+ margins?: {
1882
+ top?: number;
1883
+ bottom?: number;
1884
+ left?: number;
1885
+ right?: number;
1886
+ };
1887
+ /** Full block grammar. Undefined = use legacy paragraph-only `content`. */
1888
+ blockContent?: BlockContent[];
1889
+ /** Full `a:bodyPr` projection. Undefined = legacy margins/top anchor. */
1890
+ bodyProperties?: ShapeTextBodyProperties;
1891
+ }
1892
+
1893
+ /**
1894
+ * Embedded images (`w:drawing` → `pic:pic`): size, wrap, position,
1895
+ * transform, padding, crop.
1896
+ */
1897
+
1898
+ /** One point in a `wp:wrapPolygon`, in the drawing's authored coordinates. */
1899
+ interface ImageWrapPoint {
1900
+ x?: number;
1901
+ y?: number;
1902
+ }
1903
+ /**
1904
+ * Image size specification
1905
+ */
1906
+ interface ImageSize {
1907
+ /** Width in EMUs (English Metric Units) */
1908
+ width: number;
1909
+ /** Height in EMUs */
1910
+ height: number;
1911
+ }
1912
+ /**
1913
+ * Image wrap type for floating images
1914
+ */
1915
+ interface ImageWrap {
1916
+ type: WrapType;
1917
+ /** Wrap text direction */
1918
+ wrapText?: 'bothSides' | 'left' | 'right' | 'largest';
1919
+ /** Distance from text */
1920
+ distT?: number;
1921
+ distB?: number;
1922
+ distL?: number;
1923
+ distR?: number;
1924
+ /** Tight/through contour. Undefined = rectangular wrap. */
1925
+ polygon?: ImageWrapPoint[];
1926
+ }
1927
+ /**
1928
+ * Position for floating images
1929
+ */
1930
+ interface ImagePosition {
1931
+ /** Use `wp:simplePos` instead of positionH/V. Undefined = false. */
1932
+ useSimplePos?: boolean;
1933
+ /** `wp:simplePos` coordinates in EMUs. */
1934
+ simplePos?: {
1935
+ x?: number;
1936
+ y?: number;
1937
+ };
1938
+ /** Stable z-order (`wp:anchor/@relativeHeight`). Undefined = source order. */
1939
+ relativeHeight?: number;
1940
+ /** Behind-text plane (`wp:anchor/@behindDoc`). Undefined = false. */
1941
+ behindDoc?: boolean;
1942
+ /** Hidden drawing. Undefined = visible. */
1943
+ hidden?: boolean;
1944
+ /** Locked drawing metadata. Undefined = editable. */
1945
+ locked?: boolean;
1946
+ /** Horizontal positioning */
1947
+ horizontal: {
1948
+ relativeTo: 'character' | 'column' | 'insideMargin' | 'leftMargin' | 'margin' | 'outsideMargin' | 'page' | 'rightMargin';
1949
+ alignment?: 'left' | 'right' | 'center' | 'inside' | 'outside';
1950
+ posOffset?: number;
1951
+ };
1952
+ /** Vertical positioning */
1953
+ vertical: {
1954
+ relativeTo: 'insideMargin' | 'line' | 'margin' | 'outsideMargin' | 'page' | 'paragraph' | 'topMargin' | 'bottomMargin';
1955
+ alignment?: 'top' | 'bottom' | 'center' | 'inside' | 'outside';
1956
+ posOffset?: number;
1957
+ };
1958
+ }
1959
+ /**
1960
+ * Image transformation
1961
+ */
1962
+ interface ImageTransform {
1963
+ /** Rotation in degrees */
1964
+ rotation?: number;
1965
+ /** Flip horizontal */
1966
+ flipH?: boolean;
1967
+ /** Flip vertical */
1968
+ flipV?: boolean;
1969
+ }
1970
+ /** Post-transform layout footprint, kept separate from the content frame. */
1971
+ interface ImageRotationBounds {
1972
+ width?: number;
1973
+ height?: number;
1974
+ offsetX?: number;
1975
+ offsetY?: number;
1976
+ }
1977
+ /** One ordered DrawingML blip effect. Unknown effects stay named and inert. */
1978
+ interface ImageEffect {
1979
+ kind?: 'brightnessContrast' | 'saturation' | 'grayscale' | 'biLevel' | 'colorChange' | 'duotone' | 'alpha' | 'blur' | 'unknown';
1980
+ amount?: number;
1981
+ threshold?: number;
1982
+ colors?: string[];
1983
+ rawName?: string;
1984
+ }
1985
+ /** Safe hyperlink metadata attached to picture non-visual properties. */
1986
+ interface ImageHyperlink {
1987
+ href?: string;
1988
+ tooltip?: string;
1989
+ target?: string;
1990
+ history?: boolean;
1991
+ docLocation?: string;
1992
+ }
1993
+ /**
1994
+ * Image padding/margins
1995
+ */
1996
+ interface ImagePadding {
1997
+ top?: number;
1998
+ bottom?: number;
1999
+ left?: number;
2000
+ right?: number;
2001
+ }
2002
+ /**
2003
+ * Image crop, expressed as fractions of the source image to trim from each
2004
+ * edge. OOXML's `<a:srcRect l="10000" t="0" r="5000" b="0"/>` uses units of
2005
+ * 1/100000 (so 10000 → 0.1 → 10% trimmed from the left). We store the
2006
+ * normalised fraction so both the renderer and the saver can read it
2007
+ * directly without re-parsing units.
2008
+ */
2009
+ interface ImageCrop {
2010
+ left?: number;
2011
+ top?: number;
2012
+ right?: number;
2013
+ bottom?: number;
2014
+ }
2015
+ /**
2016
+ * Embedded image (`w:drawing` with an inline or anchored picture). Carries
2017
+ * the relationship-id pointer to the binary in `word/media/`, its
2018
+ * resolved data URL (`src`), display dimensions, optional crop /
2019
+ * transform / wrap behaviors, and anchor positioning for floating
2020
+ * images.
2021
+ *
2022
+ * See ECMA-376 §20.4 (DrawingML wordprocessingDrawing).
2023
+ */
2024
+ interface Image {
2025
+ type: 'image';
2026
+ /** Unique ID */
2027
+ id?: string;
2028
+ /** Relationship ID for the image data */
2029
+ rId: string;
2030
+ /** Resolved image data (base64 or blob URL) */
2031
+ src?: string;
2032
+ /** Image MIME type */
2033
+ mimeType?: string;
2034
+ /** Original filename */
2035
+ filename?: string;
2036
+ /** Alt text for accessibility */
2037
+ alt?: string;
2038
+ /** Title/description */
2039
+ title?: string;
2040
+ /** Image size */
2041
+ size: ImageSize;
2042
+ /** Original size before any transforms */
2043
+ originalSize?: ImageSize;
2044
+ /** Wrap settings */
2045
+ wrap: ImageWrap;
2046
+ /** Position for floating images */
2047
+ position?: ImagePosition;
2048
+ /** Image transformations */
2049
+ transform?: ImageTransform;
2050
+ /** Padding around image */
2051
+ padding?: ImagePadding;
2052
+ /** Source-image crop (fractional, OOXML `a:srcRect`). */
2053
+ crop?: ImageCrop;
2054
+ /** Opacity in [0, 1] (OOXML `a:alphaModFix amt`). Undefined = fully opaque. */
2055
+ opacity?: number;
2056
+ /** Whether this is a decorative image */
2057
+ decorative?: boolean;
2058
+ /**
2059
+ * `wp:anchor layoutInCell` — when true (default), an anchored image inside
2060
+ * a table cell is constrained to the cell. When false, the image escapes
2061
+ * the cell into the page area. Round-tripped on save.
2062
+ */
2063
+ layoutInCell?: boolean;
2064
+ /**
2065
+ * `wp:anchor allowOverlap` — when true (default), anchored objects may
2066
+ * overlap; when false, Word repositions them to avoid collisions. We
2067
+ * don't currently reposition; we round-trip the flag so saving preserves
2068
+ * the author's intent.
2069
+ */
2070
+ allowOverlap?: boolean;
2071
+ /** Hyperlink URL for clickable image */
2072
+ hlinkHref?: string;
2073
+ /** Image outline/border */
2074
+ outline?: ShapeOutline;
2075
+ /** Image effects */
2076
+ effects?: {
2077
+ brightness?: number;
2078
+ contrast?: number;
2079
+ saturation?: number;
2080
+ /** Ordered blip-effect list. Undefined = legacy scalar effects only. */
2081
+ ordered?: ImageEffect[];
2082
+ };
2083
+ /** Rotated layout bbox. Undefined = use untransformed `size`. */
2084
+ rotationBounds?: ImageRotationBounds;
2085
+ /** Complete picture hyperlink metadata. Undefined = use `hlinkHref`. */
2086
+ hyperlink?: ImageHyperlink;
2087
+ /** Effect extents in EMUs. Undefined = no extra wrap/ink extent. */
2088
+ effectExtent?: ImagePadding;
2089
+ }
2090
+
2091
+ /**
2092
+ * DrawingML chart model for basic rendered charts.
2093
+ *
2094
+ * This is intentionally normalized for display rather than lossless OOXML
2095
+ * round-trip. Unsupported chart families stay in the original package parts.
2096
+ */
2097
+
2098
+ type ChartType = 'bar' | 'column' | 'line' | 'pie' | 'doughnut';
2099
+ type ChartGrouping = 'standard' | 'clustered' | 'stacked' | 'percentStacked';
2100
+ interface ChartPoint {
2101
+ index?: number;
2102
+ value?: number;
2103
+ category?: string;
2104
+ color?: string;
2105
+ explosion?: number;
2106
+ marker?: {
2107
+ symbol?: string;
2108
+ size?: number;
2109
+ color?: string;
2110
+ };
2111
+ label?: string;
2112
+ }
2113
+ interface ChartSeries {
2114
+ name?: string;
2115
+ categories: string[];
2116
+ values: number[];
2117
+ color?: string;
2118
+ index?: number;
2119
+ order?: number;
2120
+ categoryFormula?: string;
2121
+ valueFormula?: string;
2122
+ axisIds?: string[];
2123
+ points?: ChartPoint[];
2124
+ grouping?: ChartGrouping;
2125
+ marker?: {
2126
+ symbol?: string;
2127
+ size?: number;
2128
+ color?: string;
2129
+ };
2130
+ smooth?: boolean;
2131
+ }
2132
+ interface ChartAxis {
2133
+ id?: string;
2134
+ title?: string;
2135
+ min?: number;
2136
+ max?: number;
2137
+ labels?: string[];
2138
+ axisType?: 'category' | 'value' | 'date' | 'series';
2139
+ position?: 'left' | 'right' | 'top' | 'bottom';
2140
+ crossAxisId?: string;
2141
+ crosses?: 'autoZero' | 'min' | 'max' | 'value';
2142
+ crossesAt?: number;
2143
+ majorUnit?: number;
2144
+ minorUnit?: number;
2145
+ logarithmicBase?: number;
2146
+ reversed?: boolean;
2147
+ numberFormat?: string;
2148
+ majorTickMark?: string;
2149
+ minorTickMark?: string;
2150
+ tickLabelPosition?: string;
2151
+ hidden?: boolean;
2152
+ }
2153
+ /** One chart-family element inside `c:plotArea`. */
2154
+ interface ChartPlotGroup {
2155
+ chartType?: ChartType | 'area' | 'scatter' | 'radar' | 'stock' | 'bubble' | 'ofPie' | 'surface';
2156
+ grouping?: ChartGrouping;
2157
+ overlap?: number;
2158
+ gapWidth?: number;
2159
+ axisIds?: string[];
2160
+ series?: ChartSeries[];
2161
+ varyColors?: boolean;
2162
+ firstSliceAngle?: number;
2163
+ holeSize?: number;
2164
+ showDataLabels?: boolean;
2165
+ }
2166
+ interface ChartLegend {
2167
+ position?: 'left' | 'right' | 'top' | 'bottom';
2168
+ visible?: boolean;
2169
+ }
2170
+ interface Chart {
2171
+ type: 'chart';
2172
+ chartType: ChartType;
2173
+ /** Relationship id used by the owning drawing part. */
2174
+ rId?: string;
2175
+ /** Normalized package path, e.g. word/charts/chart1.xml. */
2176
+ path?: string;
2177
+ title?: string;
2178
+ legend?: ChartLegend;
2179
+ series: ChartSeries[];
2180
+ axes?: {
2181
+ category?: ChartAxis;
2182
+ value?: ChartAxis;
2183
+ };
2184
+ /** Drawing extent from wp:extent in EMUs. */
2185
+ size?: ImageSize;
2186
+ /** Wrap metadata from the containing drawing; v1 layout treats charts as inline blocks. */
2187
+ wrap?: ImageWrap;
2188
+ /** Floating anchor. Undefined = inline legacy behavior. */
2189
+ position?: ImagePosition;
2190
+ /** Multiple/combo plot groups. Undefined = synthesize one from legacy fields. */
2191
+ plotGroups?: ChartPlotGroup[];
2192
+ /** Complete axis collection keyed through plot-group `axisIds`. */
2193
+ axisList?: ChartAxis[];
2194
+ /** Chart accessibility description. */
2195
+ description?: string;
2196
+ /** Decorative flag. Undefined = false. */
2197
+ decorative?: boolean;
2198
+ /** Stable z-order for anchored charts. Undefined = source order. */
2199
+ relativeHeight?: number;
2200
+ }
2201
+
2202
+ export { type EndnotePosition as $, type AbstractNumbering as A, type BlockContent as B, type Comment as C, type Deletion as D, type Endnote as E, type Footnote as F, type ChartType as G, type Hyperlink as H, type Image as I, type Column as J, type CommentAnchorRange as K, type ListLevel as L, type MoveFrom as M, type NumberingDefinitions as N, type CommentAuthor as O, type Paragraph as P, type CommentReferenceContent as Q, type Run as R, type SectionProperties as S, type Table as T, type ComplexField as U, type ContentPosition as V, type Watermark as W, DEFAULT_WATERMARK_PRESETS as X, type DrawingContent as Y, type DrawingScene as Z, type DrawingSceneNode as _, type CommentRangeEnd as a, type ShapeTextBody as a$, type EndnoteProperties as a0, type Field as a1, type FieldCharContent as a2, type FieldFormData as a3, type FieldInlineContent as a4, type FieldType as a5, type FooterReference as a6, type FootnotePosition as a7, type FootnoteProperties as a8, type HeaderFooterType as a9, type NoteReferenceContent as aA, type NoteSeparatorReference as aB, type NumberFormat as aC, type NumberingInstance as aD, type PageNumberingProperties as aE, type PageOrientation as aF, type ParagraphPropertyChange as aG, type PictureWatermark as aH, type PropertyChangeInfo as aI, type RunPropertyChange as aJ, type SdtCheckboxGlyph as aK, type SdtControlState as aL, type SdtDataBinding as aM, type SdtDateState as aN, type SdtGalleryState as aO, type SdtProperties as aP, type SdtType as aQ, type Section as aR, type SectionStart as aS, type SeparatorContent as aT, type Shape as aU, type ShapeContent as aV, type ShapeEffect as aW, type ShapeFill as aX, type ShapeFillPaint as aY, type ShapeOutline as aZ, type ShapeStrokePaint as a_, type HeaderReference as aa, type HyperlinkContent as ab, type ImageCrop as ac, type ImageEffect as ad, type ImageHyperlink as ae, type ImagePadding as af, type ImagePosition as ag, type ImageRotationBounds as ah, type ImageSize as ai, type ImageTransform as aj, type ImageWrap as ak, type ImageWrapPoint as al, type InlineSdt as am, type InstrTextContent as an, type LevelSuffix as ao, type LineNumberRestart as ap, type ListRendering as aq, type MathEquation as ar, type MoveFromRangeEnd as as, type MoveFromRangeStart as at, type MoveToRangeEnd as au, type MoveToRangeStart as av, type NoBreakHyphenContent as aw, type NoteKind as ax, type NoteNumberRestart as ay, type NoteRefMarkContent as az, type CommentRangeStart as b, type ShapeTextBodyProperties as b0, type ShapeType as b1, type SimpleField as b2, type SoftHyphenContent as b3, type StructuredFieldContent as b4, type StructuredFieldTree as b5, type SymbolContent as b6, type TabContent as b7, type TableCellPropertyChange as b8, type TablePropertyChange as b9, type TableRowPropertyChange as ba, type TableStructuralChangeInfo as bb, type TextBox as bc, type TextWatermark as bd, type VerticalAlign as be, pictureWatermarkDisplayEmu as bf, type RevisionInfo as bg, type CellMarker as bh, type PresetGeometryPathCommand as bi, type DocumentBody as c, type Insertion as d, type MoveTo as e, type ParagraphContent as f, type RunContent as g, type TableCell as h, type TableRow as i, type TextContent as j, type TrackedChangeInfo as k, type TrackedRunChange as l, type HeaderFooter as m, type Chart as n, type BookmarkRange as o, type BlockSdt as p, type BookmarkEnd as q, type BookmarkStart as r, type BreakContent as s, type ChartAxis as t, type ChartContent as u, type ChartGrouping as v, type ChartLegend as w, type ChartPlotGroup as x, type ChartPoint as y, type ChartSeries as z };