@docx-editor.dev/core 2.9.2 → 2.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/dist/automation.cjs +1 -1
  2. package/dist/automation.d.cts +14 -5
  3. package/dist/automation.d.ts +14 -5
  4. package/dist/automation.js +1 -1
  5. package/dist/binding.cjs +1 -1
  6. package/dist/binding.d.cts +78 -13
  7. package/dist/binding.d.ts +78 -13
  8. package/dist/binding.js +1 -1
  9. package/dist/chunk-34BNQUD4.js +10 -0
  10. package/dist/chunk-5AVHO75P.cjs +19 -0
  11. package/dist/chunk-6HMSC7UV.js +2 -0
  12. package/dist/chunk-6JIJOZDW.js +1 -0
  13. package/dist/chunk-76Y3Y45J.cjs +2 -0
  14. package/dist/chunk-BP7ANXGA.js +1 -0
  15. package/dist/chunk-BTQKU64Q.cjs +1 -0
  16. package/dist/chunk-CRZR6K5Z.js +19 -0
  17. package/dist/chunk-D5EHDHYV.js +1 -0
  18. package/dist/chunk-EJATEGJZ.cjs +1 -0
  19. package/dist/{chunk-PSZH2VXP.js → chunk-GOEBQ26R.js} +1 -1
  20. package/dist/chunk-GRDFEH5Q.cjs +2 -0
  21. package/dist/chunk-GWV65NQW.cjs +10 -0
  22. package/dist/chunk-GXLZCXEH.js +2 -0
  23. package/dist/chunk-JUQOPVSK.cjs +2 -0
  24. package/dist/chunk-LAETEBHD.js +1 -0
  25. package/dist/chunk-M6Z3KFXM.cjs +5 -0
  26. package/dist/{chunk-YMYCPY5Y.cjs → chunk-OHJQ7GPZ.cjs} +1 -1
  27. package/dist/chunk-UQFOYZJO.cjs +18 -0
  28. package/dist/chunk-WPQMPHNR.cjs +1 -0
  29. package/dist/chunk-WXQ245MQ.js +18 -0
  30. package/dist/chunk-WZHIFNSU.js +5 -0
  31. package/dist/chunk-X7A5XART.js +2 -0
  32. package/dist/chunk-ZKWRCLT2.cjs +1 -0
  33. package/dist/collaboration/replication.cjs +1 -0
  34. package/dist/collaboration/replication.d.cts +216 -0
  35. package/dist/collaboration/replication.d.ts +216 -0
  36. package/dist/collaboration/replication.js +1 -0
  37. package/dist/collaboration.cjs +1 -0
  38. package/dist/collaboration.d.cts +176 -0
  39. package/dist/collaboration.d.ts +176 -0
  40. package/dist/collaboration.js +1 -0
  41. package/dist/contracts/document.d.cts +6 -1
  42. package/dist/contracts/document.d.ts +6 -1
  43. package/dist/contracts/editor.cjs +1 -1
  44. package/dist/contracts/editor.d.cts +8 -9
  45. package/dist/contracts/editor.d.ts +8 -9
  46. package/dist/contracts/editor.js +1 -1
  47. package/dist/contracts/interaction.d.cts +8 -9
  48. package/dist/contracts/interaction.d.ts +8 -9
  49. package/dist/contracts/modules.cjs +1 -1
  50. package/dist/contracts/modules.d.cts +20 -8
  51. package/dist/contracts/modules.d.ts +20 -8
  52. package/dist/contracts/modules.js +1 -1
  53. package/dist/custom-node-writes-CwkYRw3V.d.cts +310 -0
  54. package/dist/custom-node-writes-JfTn-Sy6.d.ts +310 -0
  55. package/dist/document-properties-D6Ahr8D6.d.cts +28 -0
  56. package/dist/document-properties-D6Ahr8D6.d.ts +28 -0
  57. package/dist/{editor-Cvd7Geoc.d.ts → editor-BogcVHXk.d.ts} +176 -59
  58. package/dist/{editor-cAEf1uXW.d.cts → editor-C8edZgy5.d.cts} +176 -59
  59. package/dist/editor.cjs +1 -1
  60. package/dist/editor.css +1 -7698
  61. package/dist/editor.d.cts +26 -25
  62. package/dist/editor.d.ts +26 -25
  63. package/dist/editor.js +1 -1
  64. package/dist/failure-BnGjoXf0.d.cts +64 -0
  65. package/dist/failure-BnGjoXf0.d.ts +64 -0
  66. package/dist/{index-DRqY5JVF.d.ts → index-BNv-ZLQP.d.ts} +327 -86
  67. package/dist/{index-wb-iOxfh.d.cts → index-Dn0lOp9Z.d.cts} +327 -86
  68. package/dist/index.cjs +1 -1
  69. package/dist/index.d.cts +20 -19
  70. package/dist/index.d.ts +20 -19
  71. package/dist/index.js +1 -1
  72. package/dist/layout.cjs +1 -1
  73. package/dist/layout.d.cts +92 -55
  74. package/dist/layout.d.ts +92 -55
  75. package/dist/layout.js +1 -1
  76. package/dist/{note-properties-jvnw_DGG.d.ts → note-properties-BmoSdyKS.d.ts} +1 -1
  77. package/dist/{note-properties-CQlxjic_.d.cts → note-properties-BvGfHk5e.d.cts} +1 -1
  78. package/dist/{omml-equation-Dd3mBep-.d.ts → omml-equation-Ciq5rgb7.d.ts} +1 -1
  79. package/dist/{omml-equation-BD-LsmWE.d.cts → omml-equation-CqQOt_dD.d.cts} +1 -1
  80. package/dist/output.cjs +1 -1
  81. package/dist/output.d.cts +6 -8
  82. package/dist/output.d.ts +6 -8
  83. package/dist/output.js +1 -1
  84. package/dist/{protocol-UuZOcOp7.d.cts → protocol-BB-WP3zk.d.cts} +2 -2
  85. package/dist/{protocol-C7ahrdUx.d.ts → protocol-Ckl7hWsv.d.ts} +2 -2
  86. package/dist/{review-items-bdGxFWNA.d.ts → review-items-BdeLNRi2.d.cts} +1 -2
  87. package/dist/{review-items-B8tffIXj.d.cts → review-items-CkYyXhXM.d.ts} +1 -2
  88. package/dist/{review-reads-Bxz03tHG.d.cts → review-reads-BOLSBm5w.d.cts} +2 -2
  89. package/dist/{review-reads-CHODU0LI.d.ts → review-reads-Crf0Xn42.d.ts} +2 -2
  90. package/dist/{revision-projection-CILpvv4M.d.ts → revision-projection-Ae2CWa8E.d.ts} +1 -1
  91. package/dist/{revision-projection-Cc4wz30g.d.cts → revision-projection-C2S8PSQm.d.cts} +1 -1
  92. package/dist/{semantic-cell-selection-BPzx6DdT.d.cts → semantic-cell-selection-C0OFD4D9.d.cts} +4 -4
  93. package/dist/{semantic-cell-selection-CsHcr-yk.d.ts → semantic-cell-selection-DdmoxC-y.d.ts} +4 -4
  94. package/dist/{semantic-interaction-D-RZ9Ust.d.ts → semantic-interaction-COyhZ9WH.d.ts} +21 -2
  95. package/dist/{semantic-interaction-BfWDD_0V.d.cts → semantic-interaction-Cs2jErnt.d.cts} +21 -2
  96. package/dist/{semantic-paint-WhVtSDJK.d.ts → semantic-paint-UHaj3sBY.d.cts} +2 -2
  97. package/dist/{semantic-paint-Bd7EqzXV.d.cts → semantic-paint-vA-oLSdV.d.ts} +2 -2
  98. package/dist/{semantic-records-DadVT_E1.d.cts → semantic-records-5AOQJmLX.d.cts} +20 -5
  99. package/dist/{semantic-records-DCt-ZwKU.d.ts → semantic-records-9xhwbJ23.d.ts} +20 -5
  100. package/dist/{shaped-measurer-CninrHr_.d.cts → shaped-measurer-NeF2mPSu.d.cts} +1 -1
  101. package/dist/{shaped-measurer-B9f4A7QA.d.ts → shaped-measurer-vzsY88oK.d.ts} +1 -1
  102. package/dist/store.cjs +1 -1
  103. package/dist/store.d.cts +193 -19
  104. package/dist/store.d.ts +193 -19
  105. package/dist/store.js +1 -1
  106. package/dist/tree-op-types-BPyXNxyL.d.cts +3053 -0
  107. package/dist/tree-op-types-DnzAOnc9.d.ts +3053 -0
  108. package/dist/{custom-node-writes-D6SGwebL.d.ts → tree-package-fragment-BjZ3RWAS.d.cts} +128 -312
  109. package/dist/{custom-node-writes-Dy3b20PS.d.cts → tree-package-fragment-CDER0G3B.d.ts} +128 -312
  110. package/dist/{tree-session-ZuBFOhIh.d.ts → tree-session-contract-BF2FVBOM.d.cts} +52 -106
  111. package/dist/{tree-session-Df02ajqc.d.cts → tree-session-contract-DhdsFT_z.d.ts} +52 -106
  112. package/dist/{tree-store-B_sJBMIS.d.cts → tree-store-CNZ3O83s.d.ts} +130 -25
  113. package/dist/{tree-store-DgETo6Mf.d.ts → tree-store-DfZi7FqY.d.cts} +130 -25
  114. package/package.json +14 -3
  115. package/dist/chunk-6JWP2H7K.js +0 -2
  116. package/dist/chunk-6KNLLEUW.cjs +0 -18
  117. package/dist/chunk-7ADTI533.cjs +0 -10
  118. package/dist/chunk-7ETDCPF6.cjs +0 -2
  119. package/dist/chunk-7I3BSGGS.js +0 -1
  120. package/dist/chunk-7UU5YFCD.cjs +0 -2
  121. package/dist/chunk-7VQ7YLW3.cjs +0 -1
  122. package/dist/chunk-CKDAK3MV.js +0 -10
  123. package/dist/chunk-DIMEYVNS.js +0 -2
  124. package/dist/chunk-GQQOL4PV.js +0 -1
  125. package/dist/chunk-H2656QDI.cjs +0 -1
  126. package/dist/chunk-KQGENNL5.cjs +0 -15
  127. package/dist/chunk-LIXPSV4T.js +0 -18
  128. package/dist/chunk-O4UULRAQ.cjs +0 -5
  129. package/dist/chunk-SIIFNE6U.js +0 -15
  130. package/dist/chunk-VXYECPKA.js +0 -5
  131. package/dist/hf-references-Dvk6De4Q.d.cts +0 -70
  132. package/dist/hf-references-z5Y4N1ab.d.ts +0 -70
  133. package/dist/image-resources-BgA9EQxY.d.ts +0 -203
  134. package/dist/image-resources-BiA-IXgo.d.cts +0 -203
  135. package/dist/note-nodes-BNCANoGN.d.ts +0 -108
  136. package/dist/note-nodes-DL-Au22P.d.cts +0 -108
  137. package/dist/ooxml-package-CdEy9ufK.d.cts +0 -1222
  138. package/dist/ooxml-package-CdEy9ufK.d.ts +0 -1222
  139. package/dist/tree-op-types-CnRb7AYo.d.ts +0 -1589
  140. package/dist/tree-op-types-D1vNJ7XC.d.cts +0 -1589
@@ -1,1589 +0,0 @@
1
- import { ParagraphTabStop } from './contracts/types.cjs';
2
- import { a as OoxmlNode, b as OoxmlElement, r as OoxmlDrawingNode, p as OoxmlContentControlNode, q as OoxmlContentControlContentNode, s as OoxmlContentControlEndPropertiesNode, t as OoxmlContentControlPropertiesNode, O as OoxmlPart } from './ooxml-package-CdEy9ufK.cjs';
3
-
4
- /** The relationship namespace `r:id` lives in. */
5
- declare const OFFICE_RELATIONSHIP_NAMESPACE_URI = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
6
- /** The `Type` a hyperlink relationship declares. */
7
- declare const HYPERLINK_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink";
8
- /**
9
- * What a part's relationships answer for one `r:id`: the authored target and whether the
10
- * package declared it external. `null` for an id the part does not declare — a DANGLING
11
- * relationship, which is a real thing in real documents.
12
- */
13
- type RelationshipTargetResolver = (relationshipId: string) => {
14
- readonly target: string;
15
- readonly external: boolean;
16
- /**
17
- * The PACKAGE's own verdict on this target (`validateExternalTarget`): whether it is an
18
- * absolute URI with a safe scheme.
19
- *
20
- * Carried separately because `sanitizeHref` cannot answer it. That function is a SCHEME
21
- * allowlist and deliberately admits relative URLs — the right rule for a value the host
22
- * authored, and the wrong one for a value a `.docx` did. A file-supplied
23
- * `Target="/admin/delete-account"` has no scheme to refuse, so it would pass the
24
- * allowlist and resolve against the EMBEDDING APPLICATION'S origin: a link reading
25
- * "Company policy" that issues an authenticated same-origin request to whatever host
26
- * app the editor is mounted in. Absent, a target is treated as unverified.
27
- */
28
- readonly sinkSafe?: boolean;
29
- } | null;
30
- /**
31
- * What a hyperlink points at, which decides what activating it may do.
32
- *
33
- * The security-relevant split: an `external` link goes through `sanitizeHref` and opens only on
34
- * explicit user action, while an anchor merely scrolls and never navigates.
35
- */
36
- type HyperlinkKind =
37
- /** `r:id` → a relationship with `TargetMode="External"`. Opens somewhere else. */
38
- 'external'
39
- /** `w:anchor` → a bookmark in this document. Scrolls, never navigates. */
40
- | 'internal'
41
- /**
42
- * `r:id` naming a relationship the part does not declare, or one that is not external.
43
- *
44
- * The link keeps its runs — the text is never lost twice — but there is nothing to
45
- * activate, so it paints inert exactly like a refused scheme.
46
- */
47
- | 'unresolved';
48
- /** A resolved hyperlink: its kind, its target, and the tooltip Word shows on hover. */
49
- interface HyperlinkTarget {
50
- readonly kind: HyperlinkKind;
51
- /**
52
- * The authored target, verbatim: the relationship's `Target` for an `r:id` link, the
53
- * anchor name for an internal one. Save re-emits from the tree, never from this — it is
54
- * here so a UI can show what the document actually says.
55
- */
56
- readonly authored: string;
57
- /**
58
- * The sanitized runtime projection, or `null` when there is nothing safe to navigate to.
59
- * The ONLY value permitted in a DOM `href`, `window.open`, or a copied link.
60
- */
61
- readonly href: string | null;
62
- /** `w:anchor`, for an internal link. */
63
- readonly anchor?: string;
64
- /** `w:tooltip` — Word's hover text; paint puts it on the anchor's `title`. */
65
- readonly tooltip?: string;
66
- /** The authored `r:id`, so an edit can rewrite the relationship it names. */
67
- readonly relationshipId?: string;
68
- }
69
- /** Whether a node is a typed `w:hyperlink`. */
70
- declare function isHyperlinkNode(node: OoxmlNode): boolean;
71
- /** A typed hyperlink's `w:anchor`, or undefined. */
72
- declare function hyperlinkAnchorOf(link: OoxmlNode): string | undefined;
73
- /** A typed hyperlink's `r:id`, or undefined. */
74
- declare function hyperlinkRelationshipIdOf(link: OoxmlNode): string | undefined;
75
- /**
76
- * Read a typed `w:hyperlink` into its target record.
77
- *
78
- * `r:id` wins over `w:anchor` when a link carries both, matching Word: the relationship
79
- * names the document and the anchor names a place inside it, so the pair is a link to a
80
- * bookmark in ANOTHER file — which this engine will not follow, but whose external half is
81
- * the part that decides where it points.
82
- *
83
- * A link with neither is `unresolved`: it paints its runs and does nothing.
84
- */
85
- declare function hyperlinkTargetOf(link: OoxmlNode, resolve: RelationshipTargetResolver): HyperlinkTarget;
86
-
87
- interface DrawingProjectionLimits {
88
- readonly maxCompatibilityBranches: number;
89
- readonly maxVisitedElements: number;
90
- readonly maxDrawingDepth: number;
91
- }
92
- interface DrawingDiagnostic {
93
- readonly code: 'malformed-drawing' | 'unsupported-graphic' | 'unresolvable-frame' | 'invalid-geometry' | 'resource-refused' | 'wrap-polygon-over-limit' | 'wrap-polygon-malformed';
94
- readonly nodeId: string;
95
- readonly detail: string | null;
96
- }
97
-
98
- /**
99
- * The renderable subset of a `wps:wsp` non-picture graphic: closed polygon subpaths
100
- * (`a:custGeom` with move/line/close verbs only, or `a:prstGeom prst="rect"`) with a
101
- * solid sRGB fill and/or stroke. Anything richer (curves, theme fills, text bodies,
102
- * rotation) projects as `null` and paints the labelled placeholder instead.
103
- */
104
- interface VectorShapeProjection {
105
- /** The drawing extent that frames the subpath coordinate space. */
106
- readonly extentEmu: Readonly<{
107
- cx: number;
108
- cy: number;
109
- }>;
110
- /** Closed subpath polygons in extent-EMU space; fill rule is even-odd. */
111
- readonly subpathsEmu: readonly (readonly Readonly<{
112
- x: number;
113
- y: number;
114
- }>[])[];
115
- /** Validated 6-digit sRGB hex (no `#`), or null for no fill. */
116
- readonly fillHex: string | null;
117
- /** Validated 6-digit sRGB hex (no `#`), or null for no stroke. */
118
- readonly strokeHex: string | null;
119
- /** Stroke width in EMU; 0 when absent. */
120
- readonly strokeWidthEmu: number;
121
- }
122
- /**
123
- * The story carried by a `wps:wsp` text box (`wps:txbx` → `w:txbxContent`).
124
- *
125
- * The projection captures only the story root and the shape chrome reads; it never walks the
126
- * story content, so the per-drawing element budget is not spent on paragraphs. Layout collects
127
- * blocks from `content` under its own caps.
128
- */
129
- interface TextboxStoryProjection {
130
- /** Canonical node id of the `w:txbxContent` element. */
131
- readonly contentNodeId: string;
132
- /** The `w:txbxContent` element itself; treated as an opaque story root here. */
133
- readonly content: OoxmlElement;
134
- /** `wps:bodyPr` insets with the OOXML defaults (91440 EMU l/r, 45720 EMU t/b) when absent. */
135
- readonly insetsEmu: Readonly<{
136
- top: number;
137
- right: number;
138
- bottom: number;
139
- left: number;
140
- }>;
141
- /** `wps:bodyPr/@anchor` collapsed to the three renderable positions; default top. */
142
- readonly verticalAnchor: 'top' | 'center' | 'bottom';
143
- /** Autofit child of `wps:bodyPr`; extent stays authoritative either way (diagnostic only). */
144
- readonly autofit: 'none' | 'shape' | 'normal';
145
- /** Solid fill of the hosting shape, painted behind the story; null for no fill. */
146
- readonly fillHex: string | null;
147
- /** Solid outline of the hosting shape; null for no outline. */
148
- readonly strokeHex: string | null;
149
- /** Outline width in EMU; 0 when absent. */
150
- readonly strokeWidthEmu: number;
151
- }
152
-
153
- /**
154
- * Whether a drawing sits in the text flow or is positioned against a frame.
155
- *
156
- * The distinction that decides everything downstream: an inline drawing occupies a character
157
- * position, while an anchored one has offsets relative to a page, margin or column.
158
- */
159
- type DrawingKind = 'inline' | 'anchored';
160
- /** Nine Word wrap menu targets (inline plus eight floating modes). @public */
161
- type ImageWrapTarget = 'inline' | 'square' | 'squareLeft' | 'squareRight' | 'tight' | 'through' | 'topAndBottom' | 'behind' | 'inFront';
162
- /** Every text-wrap mode a drawing may be set to, including `inline`. */
163
- declare const IMAGE_WRAP_TARGETS: readonly ImageWrapTarget[];
164
- type DrawingWrapElement = 'none' | 'square' | 'tight' | 'through' | 'topAndBottom';
165
- type DrawingHorizontalReferenceFrame = 'character' | 'column' | 'insideMargin' | 'leftMargin' | 'margin' | 'outsideMargin' | 'page' | 'rightMargin';
166
- type DrawingVerticalReferenceFrame = 'bottomMargin' | 'insideMargin' | 'line' | 'margin' | 'outsideMargin' | 'page' | 'paragraph' | 'topMargin';
167
- /** `a:srcRect` — how much of each edge of the source image is cropped away, as fractions. */
168
- interface SourceCrop {
169
- readonly left: number;
170
- readonly top: number;
171
- readonly right: number;
172
- readonly bottom: number;
173
- }
174
- interface DrawingTransform {
175
- readonly rotationDegrees: number;
176
- readonly flipHorizontal: boolean;
177
- readonly flipVertical: boolean;
178
- /** Source `a:off` in EMU; defaults to origin when absent. */
179
- readonly offsetEmu: Readonly<{
180
- x: number;
181
- y: number;
182
- }>;
183
- /** Source `a:ext` in EMU; zero falls back to `wp:extent` at geometry time. */
184
- readonly extentEmu: Readonly<{
185
- cx: number;
186
- cy: number;
187
- }>;
188
- }
189
- /**
190
- * What a drawing refuses: selection, movement, resizing, aspect change.
191
- *
192
- * Read and honoured rather than advisory — chrome that offered a handle the store will refuse
193
- * would promise an edit that cannot happen.
194
- */
195
- interface DrawingLocks {
196
- readonly select: boolean;
197
- readonly move: boolean;
198
- readonly resize: boolean;
199
- readonly changeAspect: boolean;
200
- }
201
- interface DrawingLocksInput {
202
- readonly select?: boolean;
203
- readonly move?: boolean;
204
- readonly resize?: boolean;
205
- readonly changeAspect?: boolean;
206
- }
207
- /**
208
- * An anchored drawing's position: offsets, and the frames they are relative to.
209
- *
210
- * The relative-to bases matter as much as the offsets. Writing an offset without preserving its
211
- * base re-anchors the drawing against a different reference and moves it somewhere nobody asked.
212
- */
213
- interface DrawingPositionInput {
214
- /**
215
- * `'simple'` when `@simplePos="1"`: `horizontalEmu` / `verticalEmu` are authoritative
216
- * `wp:simplePos` x/y. `'frame'` (default) uses positionH/V relative frames.
217
- */
218
- readonly mode?: 'frame' | 'simple';
219
- readonly horizontalEmu?: number;
220
- readonly verticalEmu?: number;
221
- readonly relativeToH?: DrawingHorizontalReferenceFrame;
222
- readonly relativeToV?: DrawingVerticalReferenceFrame;
223
- }
224
- interface DrawingProjection {
225
- readonly drawingNodeId: string;
226
- readonly ownerPartName: string;
227
- readonly kind: DrawingKind;
228
- readonly relationshipId: string | null;
229
- readonly docPrId: number | null;
230
- readonly name: string;
231
- readonly title: string;
232
- readonly description: string;
233
- readonly hyperlinkHref: string | null;
234
- readonly hidden: boolean;
235
- readonly extentEmu: Readonly<{
236
- cx: number;
237
- cy: number;
238
- }>;
239
- readonly effectExtentEmu: Readonly<{
240
- top: number;
241
- right: number;
242
- bottom: number;
243
- left: number;
244
- }>;
245
- readonly inlineDistancesEmu: Readonly<{
246
- top: number;
247
- right: number;
248
- bottom: number;
249
- left: number;
250
- }>;
251
- readonly wrap: ImageWrapTarget;
252
- readonly wrapGeometry: DrawingWrapProjection | null;
253
- readonly position: DrawingPositionProjection | null;
254
- readonly anchor: Readonly<{
255
- simplePos: boolean;
256
- relativeHeight: number;
257
- behindDocument: boolean;
258
- layoutInCell: boolean;
259
- allowOverlap: boolean;
260
- }> | null;
261
- readonly picture: PictureProjection | null;
262
- readonly vectorShape: VectorShapeProjection | null;
263
- readonly textboxStory: TextboxStoryProjection | null;
264
- readonly locks: DrawingLocks;
265
- readonly effects: Readonly<{
266
- grayscale: boolean;
267
- brightness: number;
268
- contrast: number;
269
- }>;
270
- readonly compatibilityBranchNodeId: string | null;
271
- readonly diagnostics: readonly DrawingDiagnostic[];
272
- }
273
- interface DrawingAccessibility {
274
- readonly hidden: boolean;
275
- readonly decorative: boolean;
276
- readonly label: string | null;
277
- }
278
- interface DrawingPositionProjection {
279
- readonly simplePosition: Readonly<{
280
- xEmu: number;
281
- yEmu: number;
282
- }>;
283
- readonly horizontal: Readonly<{
284
- relativeFrom: DrawingHorizontalReferenceFrame;
285
- align: string | null;
286
- offsetEmu: number | null;
287
- }>;
288
- readonly vertical: Readonly<{
289
- relativeFrom: DrawingVerticalReferenceFrame;
290
- align: string | null;
291
- offsetEmu: number | null;
292
- }>;
293
- }
294
- interface DrawingWrapProjection {
295
- readonly element: DrawingWrapElement;
296
- readonly textSide: 'bothSides' | 'left' | 'right' | 'largest';
297
- readonly distancesEmu: Readonly<{
298
- top: number;
299
- right: number;
300
- bottom: number;
301
- left: number;
302
- }>;
303
- readonly polygon: readonly Readonly<{
304
- x: number;
305
- y: number;
306
- }>[];
307
- }
308
- interface PictureProjection {
309
- readonly embeddedRelationshipId: string | null;
310
- readonly linkedRelationshipId: string | null;
311
- readonly crop: SourceCrop;
312
- readonly fillMode: 'stretch' | 'tile';
313
- readonly transform: DrawingTransform;
314
- readonly presetGeometry: string | null;
315
- }
316
- /**
317
- * Project one `w:drawing` into the resolved shape layout and chrome read.
318
- *
319
- * Bounded throughout: extents, crops and nesting all come from a file. Returns a projection that
320
- * reports `hidden` and its locks rather than throwing, so an unusable drawing degrades to
321
- * something the surface can skip.
322
- */
323
- declare function projectDrawing(drawing: OoxmlDrawingNode, context: Readonly<{
324
- ownerPartName: string;
325
- supportedMcRequires: ReadonlySet<string>;
326
- limits: DrawingProjectionLimits;
327
- namespaceScope?: ReadonlyMap<string, string>;
328
- resolveRelationship?: RelationshipTargetResolver;
329
- }>): DrawingProjection | null;
330
-
331
- /** How deep controls may nest before a walk stops descending. Shared by every lane. */
332
- declare const MAX_CONTENT_CONTROL_NESTING = 32;
333
- /** Cap on controls one walk reports, so a hostile file cannot make a read unbounded. */
334
- declare const MAX_CONTENT_CONTROLS_PER_PART = 10000;
335
- /** `CT_SdtPr/w:id` is `ST_DecimalNumber`; Word treats it as a signed 32-bit integer. */
336
- declare const CONTENT_CONTROL_ID_MAX = 2147483647;
337
- /** `ST_Lock` (§17.5.2.24). An absent `w:lock` is `unlocked`. */
338
- /**
339
- * `w:lock` — what a control refuses.
340
- *
341
- * `sdtLocked` protects the wrapper, `contentLocked` the text inside it, and `sdtContentLocked`
342
- * both. A control inside a locked one is locked in effect regardless of its own value.
343
- */
344
- type ContentControlLock = 'unlocked' | 'sdtLocked' | 'contentLocked' | 'sdtContentLocked';
345
- /**
346
- * What kind of control this is.
347
- *
348
- * `checkbox` is the Microsoft `w14:checkbox` extension rather than an ECMA-376 type
349
- * element, and the two are not mutually exclusive with "declares no type": four controls
350
- * in the comprehensive fixture declare the extension and no `w:`-prefixed type, so a scan
351
- * that read only the ECMA-376 choice reported them untyped. `untyped` means the control
352
- * declares neither — a rich-text container, which is what Word treats it as.
353
- */
354
- /** Which kind of control a `w:sdt` is, and therefore what a written value must look like. */
355
- type ContentControlKind = 'richText' | 'plainText' | 'checkbox' | 'dropDownList' | 'comboBox' | 'date' | 'picture' | 'docPartObj' | 'docPartList' | 'group' | 'citation' | 'bibliography' | 'equation' | 'untyped';
356
- /** One declared option of a dropdown or combo box: its display text and its stored value. */
357
- interface ContentControlListItem {
358
- readonly displayText: string;
359
- readonly value: string;
360
- }
361
- /** A date picker's authored format and locale, for rendering and for parsing what it stores. */
362
- interface ContentControlDateFormat {
363
- readonly fullDate?: string;
364
- readonly dateFormat?: string;
365
- readonly lid?: string;
366
- readonly storeMappedDataAs?: string;
367
- readonly calendar?: string;
368
- }
369
- /** One of a checkbox's two glyphs: the font and code point it is drawn with. */
370
- interface ContentControlCheckboxState {
371
- /** The `w14:val` hex code point of the glyph, exactly as the control declares it. */
372
- readonly value: string;
373
- readonly font?: string;
374
- }
375
- /**
376
- * A checkbox's state and the two glyphs it chooses between.
377
- *
378
- * Both glyphs matter on a write: setting the value has to update `w14:checked` AND the run's
379
- * character, or the document's glyph and its recorded state disagree.
380
- */
381
- interface ContentControlCheckbox {
382
- readonly checked: boolean;
383
- readonly checkedState?: ContentControlCheckboxState;
384
- readonly uncheckedState?: ContentControlCheckboxState;
385
- }
386
- /** `CT_DataBinding` — preserved metadata. Never resolved, never fetched. */
387
- /** `w:dataBinding` — the custom-XML part and XPath a control's value is bound to. */
388
- interface ContentControlDataBinding {
389
- readonly xpath?: string;
390
- readonly storeItemID?: string;
391
- readonly prefixMappings?: string;
392
- }
393
- /**
394
- * A control's whole `w:sdtPr`, projected into one typed shape.
395
- *
396
- * What every other lane reads instead of walking `localName` strings — which also means a Word
397
- * re-save that demotes the properties node to generic does not break the projection.
398
- */
399
- interface ContentControlProperties {
400
- readonly type: ContentControlKind;
401
- readonly alias?: string;
402
- readonly tag?: string;
403
- /** `@w:val` of `w:id` when the file declares a parseable one. Never fabricated. */
404
- readonly id?: number;
405
- readonly lock: ContentControlLock;
406
- /** The glossary entry named by `w:placeholder/w:docPart`. Preserved, never loaded. */
407
- readonly placeholderDocPart?: string;
408
- readonly temporary: boolean;
409
- readonly showingPlaceholder: boolean;
410
- readonly dataBinding?: ContentControlDataBinding;
411
- readonly label?: string;
412
- readonly tabIndex?: number;
413
- /** Items a dropdown or combo box offers. Empty for every other type. */
414
- readonly listItems: readonly ContentControlListItem[];
415
- readonly lastValue?: string;
416
- readonly date?: ContentControlDateFormat;
417
- readonly multiLine?: boolean;
418
- readonly checkbox?: ContentControlCheckbox;
419
- }
420
- /** Whether a node is a `w:sdt` wrapper. */
421
- declare function isContentControlNode(node: OoxmlNode): node is OoxmlContentControlNode;
422
- /** Whether a node is a `w:sdtContent` — the container holding a control's actual content. */
423
- declare function isContentControlContentNode(node: OoxmlNode): node is OoxmlContentControlContentNode;
424
- /**
425
- * A `w:sdt` wrapper, TYPED or DEMOTED.
426
- *
427
- * Flattening predates typing and must not stop at a control the reader refused to type: a
428
- * demoted wrapper still renders its content in place in Word, so a walk that only saw the
429
- * typed kind would drop every paragraph inside a malformed control out of the story.
430
- */
431
- declare function isContentControlWrapper(node: OoxmlNode): boolean;
432
- /**
433
- * The children of a wrapper's `w:sdtContent`, typed or demoted, in order.
434
- *
435
- * The one place that knows a control's content is reached through an intermediate element,
436
- * so the four flattening walks (story blocks, layout, header/footer references, list
437
- * resolution) ask the same question rather than each re-deriving it.
438
- */
439
- declare function contentControlContentChildren(wrapper: OoxmlNode): readonly OoxmlNode[];
440
- /**
441
- * A container's children with every content-control wrapper flattened away, bounded in depth.
442
- *
443
- * ONE unwrap rule, for the places where a control sits between a container and the children that
444
- * container is defined in terms of. `CT_SdtRow` puts it between `w:tbl` and `w:tr`, `CT_SdtCell`
445
- * between `w:tr` and `w:tc`, and a walk that filtered on the child's kind dropped the row or cell
446
- * entirely: not measured, not painted, not addressable. Flattening at the point of the filter
447
- * means a controlled row is the same row to the grid pass, the pagination pass and the story walk.
448
- *
449
- * Returns the SAME array identity when there is nothing to unwrap, so the tables that carry no
450
- * controls — nearly all of them — allocate nothing and the incremental layout cache still sees
451
- * its own inputs.
452
- */
453
- declare function flattenContentControls(children: readonly OoxmlNode[], maxDepth?: number): readonly OoxmlNode[];
454
- /** A control's `w:sdtPr`, or null. Matches structurally, so a Word-demoted node still resolves. */
455
- declare function contentControlPropertiesNodeOf(control: OoxmlNode): OoxmlContentControlPropertiesNode | undefined;
456
- /** A control's `w:sdtEndPr` — the run properties applied to its closing marker. */
457
- declare function contentControlEndPropertiesNodeOf(control: OoxmlNode): OoxmlContentControlEndPropertiesNode | undefined;
458
- /** A control's `w:sdtContent`, or null when the wrapper has none. */
459
- declare function contentControlContentNodeOf(control: OoxmlNode): OoxmlContentControlContentNode | undefined;
460
- /** A signed 32-bit `ST_DecimalNumber`, or undefined when the file wrote something else. */
461
- declare function parseContentControlId(raw: string | undefined): number | undefined;
462
- /**
463
- * Read a control's properties.
464
- *
465
- * Total: a control with no `w:sdtPr` at all answers the same shape with the defaults an
466
- * absent property means, so no caller has to branch on the container's existence.
467
- */
468
- declare function contentControlPropertiesOf(control: OoxmlNode): ContentControlProperties;
469
- /** Where a control sits, read off what its content holds. */
470
- type ContentControlLevel = 'block' | 'inline' | 'row' | 'cell' | 'empty';
471
- /**
472
- * How deeply a control is nested inside other controls.
473
- *
474
- * Bounded by {@link MAX_CONTENT_CONTROL_NESTING}: nesting depth comes from a file and is a
475
- * recursion bound.
476
- */
477
- declare function contentControlLevelOf(control: OoxmlNode): ContentControlLevel;
478
- /** One control, plus how deeply it is nested and the controls that enclose it. */
479
- interface ContentControlEntry {
480
- readonly node: OoxmlContentControlNode;
481
- /** 0 for a top-level control; the nesting depth otherwise. */
482
- readonly depth: number;
483
- /** Enclosing controls, outermost first. Empty at depth 0. */
484
- readonly ancestors: readonly OoxmlContentControlNode[];
485
- }
486
- /**
487
- * Every control under a node, in document order, bounded in depth and in count.
488
- *
489
- * ONE walk, shared. The nesting bound is the same one layout flattens with, so a control
490
- * a lane can address is a control every lane can address — and a file that nests past it
491
- * keeps its content in the tree (the serializer never stops) while no walk recurses
492
- * further.
493
- */
494
- declare function contentControlsIn(root: OoxmlNode, options?: {
495
- readonly maxDepth?: number;
496
- readonly limit?: number;
497
- }): readonly ContentControlEntry[];
498
- /** Find one control by canonical node id, with the same bounded walk. */
499
- declare function findContentControl(root: OoxmlNode, nodeId: string): ContentControlEntry | null;
500
- /**
501
- * The plain text a control's content holds, in reading order.
502
- *
503
- * `w:delText` is excluded: struck text is not the control's value, and a dropdown whose
504
- * old item is still present as a tracked deletion would otherwise report both.
505
- */
506
- declare function contentControlTextOf(control: OoxmlNode): string;
507
- /**
508
- * Resolve the lock a position inherits from the controls enclosing it.
509
- *
510
- * CONSERVATIVE, because a template that says a field cannot be edited and sits inside a
511
- * section that says it cannot be removed means both. Each half of `ST_Lock` is taken
512
- * independently and the strongest wins, so an unlocked control inside a `contentLocked`
513
- * one is still content-locked — a nested control cannot grant a permission its parent
514
- * withheld, which is the only reading under which a lock is a lock.
515
- */
516
- declare function resolveContentControlLock(chain: readonly ContentControlLock[]): ContentControlLock;
517
- /** Whether a resolved lock forbids editing the content it covers. */
518
- declare function lockForbidsEdit(lock: ContentControlLock): boolean;
519
- /** Whether a resolved lock forbids removing the control itself. */
520
- declare function lockForbidsRemoval(lock: ContentControlLock): boolean;
521
- /**
522
- * `CT_SdtPr`'s declared child order (§17.5.2.38), followed by the type choice.
523
- *
524
- * Serialization re-emits children in tree order, so the ONLY way a write keeps the
525
- * sequence valid is to place the child it authors at its schema position — which is what
526
- * {@link orderedContentControlProperties} does.
527
- */
528
- declare const CONTENT_CONTROL_PROPERTY_ORDER: readonly string[];
529
- /**
530
- * Rebuild a `w:sdtPr`'s children in schema order.
531
- *
532
- * Modelled children sort to their declared position and the type element follows them,
533
- * as the sequence requires. Everything else — a `w15:repeatingSection`, a vendor
534
- * extension, the `w14:checkbox` that is not part of the ECMA-376 choice — keeps the order
535
- * it was authored in and follows the modelled block, so a write that touches one property
536
- * neither drops nor reorders anything it does not name.
537
- */
538
- declare function orderedContentControlProperties(children: readonly OoxmlNode[]): readonly OoxmlNode[];
539
- /**
540
- * The next `w:id` to write, seeded from the document's own maximum plus one.
541
- *
542
- * Never a clock, a timestamp, a random source or a hash: those collide with ids already
543
- * in the file and produce values Word rejects. Null when the document already reaches the
544
- * signed 32-bit bound, so the caller refuses rather than wrapping into a negative id.
545
- */
546
- declare function allocateContentControlId(root: OoxmlNode): number | null;
547
-
548
- /** The value a control accepts, by what kind of control it is. */
549
- type ContentControlValueInput = {
550
- readonly kind: 'text';
551
- readonly text: string;
552
- } | {
553
- readonly kind: 'listItem';
554
- readonly value: string;
555
- } | {
556
- readonly kind: 'checkbox';
557
- readonly checked: boolean;
558
- }
559
- /** A calendar date, `YYYY-MM-DD` or a full ISO-8601 instant. */
560
- | {
561
- readonly kind: 'date';
562
- readonly iso: string;
563
- };
564
- /** The control types an insertion may author. Picture and repeating section are deferred. */
565
- declare const INSERTABLE_CONTENT_CONTROL_TYPES: readonly ["richText", "plainText", "dropDownList", "comboBox", "date"];
566
- /**
567
- * The OOXML spellings the store writes.
568
- *
569
- * NOT the contract's `InsertableContentControlType`, which is the same set of kinds in the
570
- * READ vocabulary (`dropdown`) plus this lane's spelling of it (`dropDownList`). The editor
571
- * maps between the two; the names differ so a reader can tell which vocabulary a value is in.
572
- */
573
- type InsertableContentControlKind = (typeof INSERTABLE_CONTENT_CONTROL_TYPES)[number];
574
-
575
- /** Allowlisted OOXML table border line styles — store/layout authority. */
576
- declare const TABLE_BORDER_STYLES: readonly ["single", "dashed", "dotted", "double", "triple", "thick"];
577
- /**
578
- * One of the border line styles this engine draws.
579
- *
580
- * An ALLOWLIST, not the full `ST_Border` enumeration: a file may name any of the seventy-odd
581
- * OOXML border styles, and anything outside this set falls back rather than being passed through
582
- * to paint.
583
- */
584
- type TableBorderStyle = (typeof TABLE_BORDER_STYLES)[number];
585
-
586
- /** JSON-safe color input carried on table cell property ops. Theme/auto require a validated literal. */
587
- /**
588
- * A colour as an op carries it: a literal, a theme reference, or automatic.
589
- *
590
- * Theme references stay references so the document keeps following its theme; flattening one to
591
- * hex at write time would freeze the resolved value into the file.
592
- */
593
- type TreeDocColorValue = {
594
- readonly kind: 'hex';
595
- readonly value: string;
596
- } | {
597
- readonly kind: 'theme';
598
- readonly slot: string;
599
- readonly resolvedHex: string;
600
- readonly tint?: number;
601
- readonly shade?: number;
602
- } | {
603
- readonly kind: 'auto';
604
- readonly resolvedHex: string;
605
- };
606
- /** Which cell edges a selected-cell border op targets. */
607
- /** Which edges a border op addresses — the four sides, the interiors, all, or clear. */
608
- type TableBorderTarget = 'all' | 'outside' | 'inside' | 'none' | 'top' | 'bottom' | 'left' | 'right';
609
- /** Concrete edge scopes that apply or clear a complete border spec. */
610
- /** A {@link TableBorderTarget} that draws something — everything except clear. */
611
- type TableBorderEdgeTarget = Exclude<TableBorderTarget, 'none'>;
612
- /** Complete border spec for non-`none` selected-cell border scopes. Size is in eighths of a point. */
613
- /** A complete border spec: style, width and colour. Ops carry all three, never a partial edit. */
614
- interface TableBorderSpecInput {
615
- readonly style: TableBorderStyle;
616
- readonly size: number;
617
- readonly color: TreeDocColorValue;
618
- }
619
- /**
620
- * The accepted RUN property boundary (design D8), as the OOXML element names that carry it.
621
- *
622
- * An explicit allowlist rather than "any `w:rPr` child": a property outside D8 has no
623
- * resolver, no layout behavior and no support claim, so accepting it here would let an
624
- * operation assert support the engine does not have. Unknown properties still ROUND-TRIP —
625
- * they are generic nodes in the tree — they simply cannot be authored by an op.
626
- */
627
- declare const ACCEPTED_RUN_PROPERTIES: readonly ["rFonts", "sz", "szCs", "color", "b", "bCs", "i", "iCs", "u", "strike", "dstrike", "highlight", "vertAlign", "position", "caps", "smallCaps", "spacing", "w", "kern"];
628
- /** The accepted PARAGRAPH property boundary (design D8). */
629
- declare const ACCEPTED_PARAGRAPH_PROPERTIES: readonly ["pStyle", "jc", "spacing", "ind", "tabs", "numPr", "keepNext", "keepLines", "widowControl", "pageBreakBefore", "contextualSpacing", "shd"];
630
- /**
631
- * One tab stop an op can author: where it sits, how it aligns, and what fills the gap.
632
- *
633
- * An alias, not a second declaration. The contract lane already names this shape, and two
634
- * public names for one shape is a trap — a caller building a stop for a read and for an op
635
- * would otherwise have to name it two things.
636
- */
637
- type TabStopWrite = ParagraphTabStop;
638
- /**
639
- * One authored property: an element name plus its `w:`-namespace attributes.
640
- *
641
- * Modeled as name+attributes rather than a typed record per property because that is what
642
- * the tree holds, so an op maps to nodes without a lossy intermediate vocabulary. Attribute
643
- * VALUES are validated as XML text; their meaning is the resolver's business.
644
- *
645
- * Deliberately structural rather than a typed union: the accepted property lists bound WHICH
646
- * properties may be written, so the shape itself does not need to enumerate them.
647
- */
648
- interface OoxmlProperty {
649
- readonly localName: string;
650
- readonly attributes?: Readonly<Record<string, string>>;
651
- }
652
- /**
653
- * The identity of one revision WITHIN a part: `@w:id`, `@w:author` and `@w:date` together.
654
- *
655
- * `@w:id` is not unique and not author-scoped, so `(part, id)` alone would merge two authors'
656
- * distinct revisions; and one logical revision — a tracked row insertion — is deliberately
657
- * many elements sharing an id, which a uniqueness rule could not express at all.
658
- */
659
- /**
660
- * How a tracked change is addressed: its numeric id plus the PART it lives in.
661
- *
662
- * Both, always — `@w:id` is unique only within a part, so an id alone names two revisions in any
663
- * package with a header or a comments part.
664
- */
665
- interface RevisionAddress {
666
- readonly id: string;
667
- readonly author: string;
668
- /** Absent when the file wrote no `@w:date`; part of the identity either way. */
669
- readonly date?: string;
670
- }
671
- /** Who a tracked edit is attributed to. `CT_TrackChange` requires an author. */
672
- /** The author and timestamp a tracked edit is recorded under. */
673
- interface RevisionAttributionInput {
674
- readonly author: string;
675
- /** ISO-8601. Omitted writes no `@w:date`. */
676
- readonly date?: string;
677
- }
678
- /**
679
- * Every mutation the store accepts, as one JSON-safe discriminated union.
680
- *
681
- * The ONLY write path into a document. Each op addresses nodes by id plus UTF-16 offset, which is
682
- * what makes editing a paragraph inside a table cell no different from editing one at the top
683
- * level. Declarative and serializable, so the same op crosses a worker or transport boundary
684
- * unchanged.
685
- */
686
- type TreeDocOp = {
687
- /**
688
- * Replace one story's complete block structure with fresh plain paragraphs.
689
- *
690
- * Unlike a span replacement, this removes section-ending paragraphs and content-control
691
- * wrappers. A body's final direct `w:sectPr` survives to retain the page setup.
692
- */
693
- readonly op: 'replaceStoryBlocks';
694
- readonly storyRootId: string;
695
- readonly paragraphs: readonly string[];
696
- } | {
697
- /**
698
- * Insert an SDT-wrapped TOC immediately before a body paragraph.
699
- * The initial cached result and any heading bookmarks land in one undo unit.
700
- */
701
- readonly op: 'insertToc';
702
- readonly beforeParagraphId: string;
703
- readonly instruction: string;
704
- readonly alias: string;
705
- readonly entries: readonly {
706
- readonly level: number;
707
- readonly text: string;
708
- readonly headingParagraphId: string;
709
- readonly bookmarkName: string;
710
- readonly pageNumberText: string;
711
- }[];
712
- readonly bookmarksToCreate: readonly {
713
- readonly paragraphId: string;
714
- readonly name: string;
715
- }[];
716
- } | {
717
- readonly op: 'insertText';
718
- readonly paragraphId: string;
719
- readonly offset: number;
720
- readonly text: string;
721
- /**
722
- * Write this as a TRACKED insertion, attributed here.
723
- *
724
- * On the op rather than on the store, so suggesting stays a decision the surface makes
725
- * per edit and the write vocabulary stays explicit — a global "everything is tracked
726
- * now" flag is exactly what `DocEdits` refuses, because it makes the meaning of an op
727
- * depend on state the op does not carry.
728
- */
729
- readonly revision?: RevisionAttributionInput;
730
- /**
731
- * When set, the text belongs INSIDE this content control, whatever sits at the offset.
732
- *
733
- * A boundary offset is owned by the run that starts there, which at a control's trailing
734
- * edge is the run after the control — so an offset alone cannot say "append to this field",
735
- * the way it cannot say which run of a field result to format (see `targetRunIds`). A
736
- * caller that names the control gets the text in the control; one that does not gets the
737
- * plain offset rule, which is what a keystroke beside a field means.
738
- */
739
- readonly inside?: string;
740
- /**
741
- * Which side of a run BOUNDARY the text joins. Default `'left'` — Word's typing rule:
742
- * the next character takes the formatting of the character before the caret.
743
- *
744
- * `'right'` is for a caller that is not typing but placing text inside the run that
745
- * STARTS at the offset — the hyperlink editor rewriting a link's display text, where
746
- * landing left of the boundary would put the new text outside the link. Ignored when
747
- * the offset falls strictly inside a run, which has no boundary to choose.
748
- */
749
- readonly bias?: 'left' | 'right';
750
- } | {
751
- readonly op: 'deleteText';
752
- readonly paragraphId: string;
753
- readonly start: number;
754
- readonly end: number;
755
- /** Write this as a TRACKED deletion — the characters stay, wrapped in `w:del`. */
756
- readonly revision?: RevisionAttributionInput;
757
- } | {
758
- /**
759
- * Mark a paragraph's own MARK as inserted or deleted (`w:pPr/w:rPr/w:ins|w:del`,
760
- * §17.13.5). The change is to the paragraph break itself, so no character carries it.
761
- */
762
- readonly op: 'setParagraphMarkRevision';
763
- readonly paragraphId: string;
764
- readonly kind: 'ins' | 'del';
765
- readonly revision: RevisionAttributionInput;
766
- } | {
767
- /**
768
- * Propose merging this paragraph into its PREDECESSOR by striking the predecessor's
769
- * mark. Addressed by the SECOND paragraph so a multi-paragraph delete marks each
770
- * paragraph's own predecessor rather than stamping the group head N times.
771
- */
772
- readonly op: 'proposeParagraphMerge';
773
- readonly paragraphId: string;
774
- readonly revision: RevisionAttributionInput;
775
- } | {
776
- /**
777
- * Place one piece of comment markup at a model offset.
778
- *
779
- * Separate from the comment BODY, which lives in another part: this op is the story half
780
- * of a comment write, and the two are staged in one package transaction.
781
- */
782
- readonly op: 'insertCommentMarker';
783
- readonly paragraphId: string;
784
- readonly offset: number;
785
- readonly commentId: string;
786
- readonly marker: 'start' | 'end' | 'reference';
787
- } | {
788
- /**
789
- * Accept one revision, resolving every site in this part that carries its triple.
790
- */
791
- readonly op: 'acceptRevision';
792
- readonly revision: RevisionAddress;
793
- /** When set, only wrappers with this element local name resolve (ins/del/moveFrom/moveTo). */
794
- readonly localName?: string;
795
- } | {
796
- readonly op: 'rejectRevision';
797
- readonly revision: RevisionAddress;
798
- readonly localName?: string;
799
- } | {
800
- /**
801
- * Accept every revision in the part, or in one exact note root, in ONE transaction and one
802
- * history entry.
803
- *
804
- * Deliberately not a loop over `acceptRevision`: a reviewer who accepts a document's
805
- * changes made one decision, and one undo should restore all of them.
806
- */
807
- readonly op: 'acceptAllRevisions';
808
- /** Internal shared-notes scope. When present, this must be the canonical id of a note root. */
809
- readonly scopeRootId?: string;
810
- } | {
811
- readonly op: 'rejectAllRevisions';
812
- /** Internal shared-notes scope. When present, this must be the canonical id of a note root. */
813
- readonly scopeRootId?: string;
814
- } | {
815
- readonly op: 'insertTab';
816
- readonly paragraphId: string;
817
- readonly offset: number;
818
- /** Write this as a TRACKED insertion, on the same terms as `insertText`. */
819
- readonly revision?: RevisionAttributionInput;
820
- } | {
821
- readonly op: 'insertHardBreak';
822
- readonly paragraphId: string;
823
- readonly offset: number;
824
- /** Write this as a TRACKED insertion, on the same terms as `insertText`. */
825
- readonly revision?: RevisionAttributionInput;
826
- } | {
827
- readonly op: 'insertPageBreak';
828
- readonly paragraphId: string;
829
- readonly offset: number;
830
- /** Write this as a TRACKED insertion, on the same terms as `insertText`. */
831
- readonly revision?: RevisionAttributionInput;
832
- } | {
833
- /**
834
- * Insert an allowlisted page-number complex field at a UTF-16 offset.
835
- *
836
- * `PAGE_X_OF_Y` is PAGE + literal " of " + NUMPAGES in one undoable op. Non-page
837
- * instructions are refused — never authored through this path.
838
- */
839
- readonly op: 'insertPageField';
840
- readonly paragraphId: string;
841
- readonly offset: number;
842
- readonly field: 'PAGE' | 'NUMPAGES' | 'SECTIONPAGES' | 'PAGE_X_OF_Y';
843
- /**
844
- * Write this as a TRACKED insertion, on the same terms as `insertText`.
845
- *
846
- * The whole field — every `w:fldChar`, the instruction, the `PAGE_X_OF_Y` literal —
847
- * goes into ONE `w:ins`, because the field is one proposal: rejecting it must take
848
- * the complete atom back, never leave a `begin` standing without its `end`.
849
- */
850
- readonly revision?: RevisionAttributionInput;
851
- } | {
852
- /**
853
- * Move a numbered paragraph to another `w:numPr/w:ilvl`.
854
- *
855
- * A list item's LEVEL is what selects its format out of `numbering.xml`, so this is
856
- * the op behind Increase/Decrease Indent on a list: the marker changes with it. A
857
- * paragraph carrying no `w:numPr` is refused rather than silently numbered.
858
- */
859
- readonly op: 'setListLevel';
860
- readonly paragraphId: string;
861
- readonly level: number;
862
- } | {
863
- /**
864
- * Put a paragraph in a list, or take it out of one.
865
- *
866
- * `numId` names a `w:num` in `numbering.xml`; null removes `w:numPr` entirely, which
867
- * is what turning a bullet off means. Everything else in `w:pPr` survives.
868
- */
869
- /**
870
- * Run properties of the PARAGRAPH MARK (`w:pPr/w:rPr`, ECMA-376 17.3.1.29).
871
- *
872
- * The mark carries the formatting a paragraph's own pilcrow has, and Word keeps it
873
- * in step whenever formatting is applied to a whole paragraph. It is what a list
874
- * marker inherits its face from — so without it, sizing a bulleted paragraph leaves
875
- * the bullet at the old size.
876
- */
877
- readonly op: 'setParagraphMarkProperties';
878
- readonly paragraphId: string;
879
- readonly properties: readonly OoxmlProperty[];
880
- } | {
881
- readonly op: 'setListNumbering';
882
- readonly paragraphId: string;
883
- readonly numId: string | null;
884
- readonly level?: number;
885
- } | {
886
- /**
887
- * Replace a paragraph's custom tab stops, or clear them with an empty list.
888
- *
889
- * Its OWN op rather than a `w:tabs` entry in `setParagraphProperties`, because
890
- * `OoxmlProperty` is flat and `w:tabs` carries its meaning in `w:tab` children — the
891
- * same reason `setListNumbering` exists for `w:numPr`.
892
- */
893
- readonly op: 'setParagraphTabStops';
894
- readonly paragraphId: string;
895
- readonly stops: readonly TabStopWrite[];
896
- /**
897
- * Every stop position IN FORCE when the editor read the paragraph, including the
898
- * ones a style supplied.
899
- *
900
- * Tab stops are read through the cascade and written at the paragraph level, so a
901
- * replace alone cannot remove an inherited stop — the user clears a row, the style
902
- * puts it straight back, and the command reports success. A position that was in
903
- * force and is not in `stops` is suppressed with `w:val="clear"`, which is what the
904
- * value exists for (§17.3.1.37). Omit when the caller has no cascade to speak of;
905
- * the write is then a plain paragraph-level replace.
906
- */
907
- readonly inForcePositionsTwips?: readonly number[];
908
- } | {
909
- readonly op: 'splitParagraph';
910
- readonly paragraphId: string;
911
- readonly offset: number;
912
- } | {
913
- /**
914
- * Split one `w:p` at MANY offsets in a single op.
915
- *
916
- * Equivalent to applying `splitParagraph` at each offset from the last to the first,
917
- * but the paragraph's content is cut in one pass and the parent's child sequence is
918
- * rebuilt once. A plain-text paste is a paragraph mark per line: as individual ops,
919
- * a large paste rebuilt the body — and re-sliced the pasted text — once per line,
920
- * which is quadratic in paste size.
921
- */
922
- readonly op: 'splitParagraphMany';
923
- readonly paragraphId: string;
924
- /**
925
- * Non-decreasing UTF-16 offsets; each produces one paragraph boundary. A repeated
926
- * offset produces an empty paragraph between the two boundaries — a blank line.
927
- */
928
- readonly offsets: readonly number[];
929
- /**
930
- * Propose the breaks rather than making them, exactly as the single split does.
931
- *
932
- * Every boundary is a paragraph mark this author is adding, so each paragraph that
933
- * PRECEDES one carries `w:rPr/w:ins`. Without it a multi-line paste in suggesting mode
934
- * tracked its text and not its breaks, and Reject left the extra paragraphs standing.
935
- */
936
- readonly revision?: RevisionAttributionInput;
937
- } | {
938
- readonly op: 'joinParagraphs';
939
- readonly firstId: string;
940
- readonly secondId: string;
941
- } | {
942
- readonly op: 'setRunProperties';
943
- readonly paragraphId: string;
944
- readonly start: number;
945
- readonly end: number;
946
- readonly properties: readonly OoxmlProperty[];
947
- /**
948
- * When set, format only these runs (field result ownership). Offset range still
949
- * gates the edit and drives edge splits; without this, multi-run field results that
950
- * share one atom offset would homogenise under a single property bag.
951
- */
952
- readonly targetRunIds?: readonly string[];
953
- } | {
954
- readonly op: 'setParagraphProperties';
955
- readonly paragraphId: string;
956
- readonly properties: readonly OoxmlProperty[];
957
- } | {
958
- /**
959
- * Set page-setup fields — page size, orientation, margins — on every targeted
960
- * `w:sectPr`: all of them (Word's "Apply to: Whole document", the default) or
961
- * only the one governing `anchorParagraphId`. A document whose write must reach
962
- * the implicit tail section gets a body-level `w:sectPr` minted as the body's
963
- * last child. Omitted fields are left exactly as authored per section. Explicit
964
- * dimensions are written literally; `orientation` WITHOUT dimensions swaps each
965
- * section's own (see `plannedSectionDimensions`), so distinct paper sizes
966
- * survive a whole-document flip.
967
- */
968
- readonly op: 'setSectionProperties';
969
- readonly pageWidthTwips?: number;
970
- readonly pageHeightTwips?: number;
971
- readonly orientation?: 'portrait' | 'landscape';
972
- readonly marginTopTwips?: number;
973
- readonly marginRightTwips?: number;
974
- readonly marginBottomTwips?: number;
975
- readonly marginLeftTwips?: number;
976
- /**
977
- * Word's "Apply to: This section": update only the section GOVERNING this
978
- * paragraph — the nearest mid-body `w:sectPr` at or after it, else the body-level
979
- * one. Absent means every section.
980
- */
981
- readonly anchorParagraphId?: string;
982
- } | {
983
- /**
984
- * End a section AT this paragraph: mint a `w:pPr/w:sectPr` cloning the governing
985
- * section's effective page setup, so the blocks up to and including this paragraph
986
- * become their own section (a next-page section break). The paragraph must not
987
- * already carry one.
988
- */
989
- readonly op: 'setSectionMark';
990
- readonly paragraphId: string;
991
- } | {
992
- /**
993
- * Wrap `[start, end)` of a paragraph in a `w:hyperlink`.
994
- *
995
- * The RANGE is the link — text and formatting inside it are untouched, and runs that
996
- * straddle either edge are divided so the link covers exactly the characters asked
997
- * for. Exactly one of `relationshipId` (an external target, already minted on the
998
- * package) or `anchor` (a bookmark in this document) names where it goes.
999
- *
1000
- * A collapsed range is refused: a link with no text is markup with nothing to click,
1001
- * and the caller that wants "insert a link with display text" inserts the text first.
1002
- */
1003
- readonly op: 'insertHyperlink';
1004
- readonly paragraphId: string;
1005
- readonly start: number;
1006
- readonly end: number;
1007
- readonly relationshipId?: string;
1008
- readonly anchor?: string;
1009
- readonly tooltip?: string;
1010
- /**
1011
- * Character style to mark the linked runs with (`w:rStyle`), normally `Hyperlink`.
1012
- *
1013
- * Written HERE rather than through `setRunProperties` because `w:rStyle` is preserved,
1014
- * not accepted: it is not in the set a property write replaces, and putting it there
1015
- * would make a later bold toggle delete it. Marking the text is part of making it a
1016
- * link — Word does both in one operation — so the op that wraps it also styles it.
1017
- * Omitted for a document that declares no such style.
1018
- */
1019
- readonly styleId?: string;
1020
- } | {
1021
- /**
1022
- * Re-aim an existing link. `relationshipId` moves it to another external target,
1023
- * `anchor` to a bookmark; supplying one CLEARS the other, so a link never ends up
1024
- * carrying both and resolving by the wrong one.
1025
- */
1026
- readonly op: 'setHyperlinkTarget';
1027
- readonly linkId: string;
1028
- readonly relationshipId?: string;
1029
- readonly anchor?: string;
1030
- readonly tooltip?: string;
1031
- } | {
1032
- /**
1033
- * Unlink: splice the `w:hyperlink`'s children into the paragraph in its place.
1034
- *
1035
- * The runs keep their identity, their formatting and their order, and any bookmark
1036
- * markers inside the link stay exactly where they were. Only the link element goes,
1037
- * which is what Word's Remove Hyperlink does — the text is not the link's, it was
1038
- * only wrapped by it.
1039
- */
1040
- readonly op: 'removeHyperlink';
1041
- readonly linkId: string;
1042
- } | {
1043
- /**
1044
- * Replace one preserved `m:oMath` atom from bounded linear-math input.
1045
- *
1046
- * The complete equation changes as one unit. Internal OMML text never enters the
1047
- * paragraph offset space, so callers cannot leave a partially edited math tree.
1048
- */
1049
- readonly op: 'setMathEquation';
1050
- readonly equationId: string;
1051
- readonly linear: string;
1052
- } | {
1053
- /** Remove one complete `m:oMath` atom. */
1054
- readonly op: 'removeMathEquation';
1055
- readonly equationId: string;
1056
- } | {
1057
- /**
1058
- * Insert a NEW run-level content control at a text offset: `w:sdt` with a
1059
- * `w:sdtPr` carrying the given tag (and alias/lock) and a `w:sdtContent`
1060
- * holding one run of `text`.
1061
- *
1062
- * The write half of the custom-node contract (pro-review-and-custom-nodes):
1063
- * a node's identity lives in `w:tag`, `sdtLocked` keeps Word users from
1064
- * unwrapping the anchor, and the literal run text is what Word (and the
1065
- * free tier) render. The TAG IS ATTACKER-ADJACENT ON READ but authored
1066
- * here; it is written as an ordinary attribute value, so the serializer's
1067
- * escaping covers it like every other attribute.
1068
- */
1069
- readonly op: 'insertInlineContentControl';
1070
- readonly paragraphId: string;
1071
- readonly offset: number;
1072
- readonly tag: string;
1073
- readonly text: string;
1074
- readonly alias?: string;
1075
- /** `w:lock` value; omitted writes no lock. */
1076
- readonly lock?: 'sdtLocked' | 'sdtContentLocked' | 'contentLocked';
1077
- /**
1078
- * `w:dataBinding` — the customXml data part node this control mirrors.
1079
- *
1080
- * The payload half of the custom-node contract: `w:tag` caps at 64
1081
- * characters, so anything larger lives in a data part and the control
1082
- * points at it. All three attributes travel together because Word needs
1083
- * all three — the store's `ds:itemID`, the XPath to the node's label, and
1084
- * the prefix declaration that XPath's steps resolve through.
1085
- *
1086
- * A control that carries one is READ-ONLY in Word (verified against
1087
- * `sdt-custom-node-databinding-word-roundtrip.docx`), and this engine
1088
- * refuses content edits inside it for the same reason — see
1089
- * `bindingRefusal`. That is what keeps the store and the page from
1090
- * drifting: there is no edit that could move one without the other.
1091
- *
1092
- * Nothing here is resolved or fetched. The op writes the three strings and
1093
- * the store lane owns the part they name.
1094
- */
1095
- readonly dataBinding?: {
1096
- readonly prefixMappings: string;
1097
- readonly xpath: string;
1098
- readonly storeItemId: string;
1099
- };
1100
- } | {
1101
- /** Repeating-section item insert — unsupported at this layer (out of scope). */
1102
- readonly op: 'addRepeatingSectionItem';
1103
- readonly controlId: string;
1104
- readonly index?: number;
1105
- } | {
1106
- /** Repeating-section item remove — unsupported at this layer (out of scope). */
1107
- readonly op: 'removeRepeatingSectionItem';
1108
- readonly controlId: string;
1109
- readonly index: number;
1110
- } | {
1111
- /**
1112
- * Remove a typed block and everything under it.
1113
- *
1114
- * Validation restricts this structural operation to `w:p`, `w:tbl`, and `w:tr`, and
1115
- * refuses removals that would violate required-container or section-mark invariants.
1116
- */
1117
- readonly op: 'deleteBlock';
1118
- readonly blockId: string;
1119
- } | {
1120
- /**
1121
- * Insert a fresh empty table immediately before a block-level paragraph.
1122
- *
1123
- * Before, never after, so the anchor paragraph stays as the block that follows the
1124
- * table: a `w:tbl` is not a valid final child of a story container, and two tables
1125
- * that end up adjacent merge into one when the file is reopened. When the anchor's
1126
- * previous sibling is already a table, a separating empty paragraph is authored with
1127
- * it, which is what Word does for the same reason.
1128
- */
1129
- readonly op: 'insertTable';
1130
- readonly beforeParagraphId: string;
1131
- readonly rows: number;
1132
- readonly cols: number;
1133
- /** Width of every grid column, in twips. The caller divides the content width. */
1134
- readonly columnWidthTwips: number;
1135
- } | {
1136
- /** Insert a fresh row above or below a canonical table row. */
1137
- readonly op: 'insertTableRow';
1138
- readonly tableId: string;
1139
- readonly rowId: string;
1140
- readonly where: 'above' | 'below';
1141
- /** When present, author the row as a Word tracked insertion. */
1142
- readonly revision?: RevisionAttributionInput;
1143
- } | {
1144
- /** Delete one canonical table row; refuses the final row. */
1145
- readonly op: 'deleteTableRow';
1146
- readonly tableId: string;
1147
- readonly rowId: string;
1148
- /** Optional anchor cell for column-aware caret recovery after deletion. */
1149
- readonly referenceCellId?: string;
1150
- /** When present, retain the row and author a Word tracked deletion. */
1151
- readonly revision?: RevisionAttributionInput;
1152
- } | {
1153
- /** Insert one grid column left or right of a canonical `w:gridCol`. */
1154
- readonly op: 'insertTableColumn';
1155
- readonly tableId: string;
1156
- readonly where: 'left' | 'right';
1157
- readonly gridColumnId: string;
1158
- } | {
1159
- /**
1160
- * Insert one grid column beside a first-row reference cell when `w:tblGrid` is absent.
1161
- * Synthesizes a canonical grid before mutation.
1162
- */
1163
- readonly op: 'insertTableColumn';
1164
- readonly tableId: string;
1165
- readonly where: 'left' | 'right';
1166
- readonly referenceCellId: string;
1167
- } | {
1168
- /** Delete one canonical grid column; refuses the final column. */
1169
- readonly op: 'deleteTableColumn';
1170
- readonly tableId: string;
1171
- readonly gridColumnId: string;
1172
- } | {
1173
- /**
1174
- * Resize one internal divider between two adjacent canonical grid columns.
1175
- * Preserves the pair total and sets fixed table layout.
1176
- */
1177
- readonly op: 'setTableColumnWidths';
1178
- readonly tableId: string;
1179
- readonly leftGridColumnId: string;
1180
- readonly rightGridColumnId: string;
1181
- readonly leftWidthTwips: number;
1182
- readonly rightWidthTwips: number;
1183
- } | {
1184
- /**
1185
- * Resize the outer-right edge: last grid column, matching cells, and `w:tblW` total.
1186
- */
1187
- readonly op: 'setTableRightEdgeWidth';
1188
- readonly tableId: string;
1189
- readonly gridColumnId: string;
1190
- readonly columnWidthTwips: number;
1191
- readonly tableWidthTwips: number;
1192
- } | {
1193
- /** Set one authored table row to an exact height in twips. */
1194
- readonly op: 'setTableRowHeight';
1195
- readonly tableId: string;
1196
- readonly rowId: string;
1197
- readonly heightTwips: number;
1198
- } | {
1199
- /** Clear the active edge target on a bounded rectangular cell selection. */
1200
- readonly op: 'setTableCellBorders';
1201
- readonly tableId: string;
1202
- readonly cellIds: readonly string[];
1203
- readonly scope: 'none';
1204
- readonly target: TableBorderEdgeTarget;
1205
- } | {
1206
- /** Apply a complete border spec to the requested edge target. */
1207
- readonly op: 'setTableCellBorders';
1208
- readonly tableId: string;
1209
- readonly cellIds: readonly string[];
1210
- readonly scope: TableBorderEdgeTarget;
1211
- readonly spec: TableBorderSpecInput;
1212
- } | {
1213
- /** Write or remove direct selected-cell shading (`w:tcPr/w:shd`). */
1214
- readonly op: 'setTableCellFill';
1215
- readonly tableId: string;
1216
- readonly cellIds: readonly string[];
1217
- readonly color: TreeDocColorValue | null;
1218
- } | {
1219
- /** Set direct selected-cell vertical alignment (`w:tcPr/w:vAlign`). */
1220
- readonly op: 'setTableCellVerticalAlignment';
1221
- readonly tableId: string;
1222
- readonly cellIds: readonly string[];
1223
- readonly alignment: 'top' | 'center' | 'bottom';
1224
- } | {
1225
- /** Allocate an empty header/footer part and declare it on a section. Package-level. */
1226
- readonly op: 'createHeaderFooter';
1227
- readonly sectionIndex: number;
1228
- readonly kind: 'header' | 'footer';
1229
- readonly variant: 'default' | 'first' | 'even';
1230
- /** When true, also set section `w:titlePg` in the same package transaction. */
1231
- readonly titlePage?: boolean;
1232
- /** When true, also set document `w:evenAndOddHeaders` in the same package transaction. */
1233
- readonly evenAndOddHeaders?: boolean;
1234
- } | {
1235
- /** Remove a section's declared header/footer reference; GC when orphaned. Package-level. */
1236
- readonly op: 'deleteHeaderFooter';
1237
- readonly sectionIndex: number;
1238
- readonly kind: 'header' | 'footer';
1239
- readonly variant: 'default' | 'first' | 'even';
1240
- } | {
1241
- /** Drop a declared ref so the section inherits from the previous. Package-level. */
1242
- readonly op: 'linkToPrevious';
1243
- readonly sectionIndex: number;
1244
- readonly kind: 'header' | 'footer';
1245
- readonly variant: 'default' | 'first' | 'even';
1246
- } | {
1247
- /** Clone an inherited part into a new declared reference. Package-level. */
1248
- readonly op: 'unlinkFromPrevious';
1249
- readonly sectionIndex: number;
1250
- readonly kind: 'header' | 'footer';
1251
- readonly variant: 'default' | 'first' | 'even';
1252
- } | {
1253
- /**
1254
- * Section/document furniture options: `titlePg`, header/footer distances on the
1255
- * section; `evenAndOddHeaders` document-wide in settings. Package-level.
1256
- */
1257
- readonly op: 'setSectionFurnitureOptions';
1258
- readonly sectionIndex?: number;
1259
- readonly titlePage?: boolean;
1260
- readonly evenAndOddHeaders?: boolean;
1261
- readonly headerDistanceTwips?: number;
1262
- readonly footerDistanceTwips?: number;
1263
- } | {
1264
- /**
1265
- * Insert a footnote or endnote: body reference + notes-part body (+ create the
1266
- * notes part/rel/content-type when missing). Package-level; one ModelChange.
1267
- */
1268
- readonly op: 'insertNote';
1269
- readonly noteKind: 'footnote' | 'endnote';
1270
- readonly paragraphId: string;
1271
- readonly offset: number;
1272
- /**
1273
- * Write the citing REFERENCE as a tracked insertion (`w:ins` around the reference
1274
- * run), on the same terms as `insertText`. The note body itself is not revision
1275
- * markup: rejecting the reference removes it, and the body cascade sweeps the
1276
- * orphaned note exactly as an untracked reference deletion does.
1277
- */
1278
- readonly revision?: RevisionAttributionInput;
1279
- } | {
1280
- /**
1281
- * Delete a note body and every matching reference (body, HF, other notes).
1282
- * Package-level; one ModelChange.
1283
- */
1284
- readonly op: 'deleteNote';
1285
- readonly noteKind: 'footnote' | 'endnote';
1286
- readonly noteId: number;
1287
- } | {
1288
- /** Convert a footnote ↔ endnote, reallocating id in the target part. Package-level. */
1289
- readonly op: 'convertNote';
1290
- readonly fromKind: 'footnote' | 'endnote';
1291
- readonly noteId: number;
1292
- } | {
1293
- /**
1294
- * Convert every normal footnote↔endnote of `fromKind` in one package transaction.
1295
- * One ModelChange / undo unit; bounded by notes-part size.
1296
- */
1297
- readonly op: 'convertAllNotes';
1298
- readonly fromKind: 'footnote' | 'endnote';
1299
- } | {
1300
- /**
1301
- * Write a content control's VALUE, in the vocabulary its own type accepts.
1302
- *
1303
- * One transaction for the whole transition: the content, `w:showingPlcHdr`, and the
1304
- * type's own record of the value (`@w:lastValue`, `@w:fullDate`, `w14:checked`) move
1305
- * together, because a control whose glyph says checked and whose flag says unchecked is
1306
- * a document Word and this engine read differently.
1307
- */
1308
- readonly op: 'setContentControlValue';
1309
- readonly controlId: string;
1310
- /** String is the editor-facing v2 form; structured input is the automation form. */
1311
- readonly value: string | ContentControlValueInput;
1312
- } | {
1313
- /**
1314
- * Author the metadata a control carries: its tag, its title, its lock.
1315
- *
1316
- * `null` removes the property. Everything else in `CT_SdtPr` — the type payload, a data
1317
- * binding, an extension this vocabulary does not model — survives in schema order.
1318
- */
1319
- readonly op: 'setContentControlProperties';
1320
- readonly controlId: string;
1321
- readonly tag?: string | null;
1322
- readonly alias?: string | null;
1323
- readonly lock?: ContentControlLock;
1324
- } | {
1325
- /**
1326
- * Remove a control. `keepContent` splices its content into its place — Word's own
1327
- * "Remove content control" — and false takes the content with it.
1328
- */
1329
- readonly op: 'removeContentControl';
1330
- readonly controlId: string;
1331
- /** Defaults to true for the editor-facing v2 operation. */
1332
- readonly keepContent?: boolean;
1333
- } | {
1334
- /**
1335
- * Wrap `[start, end)` of a paragraph in a new control of the named type.
1336
- *
1337
- * A control is a SIBLING of runs, never a thing inside one, so a range ending mid-run
1338
- * splits that run at both edges first. The characters and their formatting are the ones
1339
- * that were there; only the run boundaries move.
1340
- */
1341
- readonly op: 'insertContentControl';
1342
- readonly paragraphId: string;
1343
- readonly start: number;
1344
- readonly end: number;
1345
- readonly type: InsertableContentControlKind;
1346
- readonly tag?: string;
1347
- readonly alias?: string;
1348
- readonly lock?: ContentControlLock;
1349
- } | {
1350
- /**
1351
- * Author `w:footnotePr` / `w:endnotePr` at document (settings) or section scope.
1352
- * Refuse endnote `pageBottom`. Package-level; does not invent props on unedited saves.
1353
- */
1354
- readonly op: 'setNoteProperties';
1355
- readonly scope: 'document' | 'section';
1356
- readonly sectionIndex?: number;
1357
- readonly footnote?: {
1358
- readonly numFmt?: string;
1359
- readonly numRestart?: string;
1360
- readonly position?: string;
1361
- readonly numStart?: number;
1362
- };
1363
- readonly endnote?: {
1364
- readonly numFmt?: string;
1365
- readonly numRestart?: string;
1366
- readonly position?: string;
1367
- readonly numStart?: number;
1368
- };
1369
- } | {
1370
- readonly op: 'insertDrawing';
1371
- readonly paragraphId: string;
1372
- readonly offset: number;
1373
- readonly drawing: OoxmlDrawingNode;
1374
- } | {
1375
- readonly op: 'replaceDrawingResource';
1376
- readonly drawingNodeId: string;
1377
- readonly relationshipId: string;
1378
- } | {
1379
- readonly op: 'deleteDrawing';
1380
- readonly drawingNodeId: string;
1381
- /** Suggesting-mode tracked deletion is refused; owned by typed-revisions-and-comments. */
1382
- readonly revision?: RevisionAttributionInput;
1383
- } | {
1384
- readonly op: 'resizeDrawing';
1385
- readonly drawingNodeId: string;
1386
- readonly extentEmu: {
1387
- readonly cx: number;
1388
- readonly cy: number;
1389
- };
1390
- } | {
1391
- readonly op: 'cropDrawing';
1392
- readonly drawingNodeId: string;
1393
- readonly crop: SourceCrop;
1394
- } | {
1395
- readonly op: 'positionDrawing';
1396
- readonly drawingNodeId: string;
1397
- readonly position: DrawingPositionInput;
1398
- } | {
1399
- readonly op: 'setDrawingWrap';
1400
- readonly drawingNodeId: string;
1401
- readonly wrap: ImageWrapTarget;
1402
- } | {
1403
- readonly op: 'setDrawingMetadata';
1404
- readonly drawingNodeId: string;
1405
- readonly title: string;
1406
- readonly description: string;
1407
- /** Omitted preserves existing `a:hlinkClick`; null removes it; a URL needs a package transaction. */
1408
- readonly hyperlink?: string | null;
1409
- } | {
1410
- readonly op: 'setDrawingLocks';
1411
- readonly drawingNodeId: string;
1412
- readonly locks: DrawingLocksInput;
1413
- } | {
1414
- readonly op: 'transformDrawing';
1415
- readonly drawingNodeId: string;
1416
- readonly action: 'rotateCW' | 'rotateCCW' | 'flipH' | 'flipV';
1417
- } | {
1418
- /**
1419
- * Replace a detected TOC field's cached result paragraphs and ensure heading bookmarks.
1420
- * Preserves field chrome / instruction. One undo unit (phase A of TOC refresh).
1421
- */
1422
- readonly op: 'replaceTocResult';
1423
- readonly tocId: string;
1424
- readonly entries: readonly {
1425
- readonly level: number;
1426
- readonly text: string;
1427
- readonly headingParagraphId: string;
1428
- readonly bookmarkName: string;
1429
- readonly pageNumberText: string;
1430
- }[];
1431
- readonly bookmarksToCreate: readonly {
1432
- readonly paragraphId: string;
1433
- readonly name: string;
1434
- }[];
1435
- } | {
1436
- /**
1437
- * Rewrite page-number text runs inside existing TOC result paragraphs.
1438
- * One undo unit (phase B of TOC refresh).
1439
- */
1440
- readonly op: 'rewriteTocPageNumbers';
1441
- readonly tocId: string;
1442
- readonly updates: readonly {
1443
- readonly paragraphId: string;
1444
- readonly pageNumberText: string;
1445
- }[];
1446
- };
1447
- /** Drawing mutation ops from typed-drawings-and-images task 11. */
1448
- type DrawingTreeDocOp = Extract<TreeDocOp, {
1449
- readonly op: 'insertDrawing' | 'replaceDrawingResource' | 'deleteDrawing' | 'resizeDrawing' | 'cropDrawing' | 'positionDrawing' | 'setDrawingWrap' | 'setDrawingMetadata' | 'setDrawingLocks' | 'transformDrawing';
1450
- }>;
1451
- /** Just the `op` discriminants, for dispatch tables and validation. */
1452
- type TreeDocOpKind = TreeDocOp['op'];
1453
- /** Every {@link TreeDocOpKind}, for validation and exhaustiveness checks. */
1454
- declare const TREE_DOC_OP_KINDS: readonly ["replaceStoryBlocks", "insertText", "deleteText", "setParagraphMarkRevision", "proposeParagraphMerge", "insertCommentMarker", "acceptRevision", "rejectRevision", "acceptAllRevisions", "rejectAllRevisions", "insertTab", "insertHardBreak", "insertPageBreak", "insertPageField", "setListLevel", "setListNumbering", "setParagraphTabStops", "setParagraphMarkProperties", "splitParagraph", "splitParagraphMany", "joinParagraphs", "setRunProperties", "setParagraphProperties", "setSectionProperties", "setSectionMark", "insertHyperlink", "setHyperlinkTarget", "removeHyperlink", "setMathEquation", "removeMathEquation", "setContentControlValue", "removeContentControl", "insertInlineContentControl", "addRepeatingSectionItem", "removeRepeatingSectionItem", "deleteBlock", "insertTable", "insertTableRow", "deleteTableRow", "insertTableColumn", "deleteTableColumn", "setTableColumnWidths", "setTableRightEdgeWidth", "setTableRowHeight", "setTableCellBorders", "setTableCellFill", "setTableCellVerticalAlignment", "createHeaderFooter", "deleteHeaderFooter", "linkToPrevious", "unlinkFromPrevious", "setSectionFurnitureOptions", "insertNote", "deleteNote", "convertNote", "convertAllNotes", "setNoteProperties", "setContentControlProperties", "insertContentControl", "insertDrawing", "replaceDrawingResource", "deleteDrawing", "resizeDrawing", "cropDrawing", "positionDrawing", "setDrawingWrap", "setDrawingMetadata", "setDrawingLocks", "transformDrawing", "insertToc", "replaceTocResult", "rewriteTocPageNumbers"];
1455
- /**
1456
- * How far a committed op can reach, so layout can scope its work (task 5.2).
1457
- *
1458
- * `text-local` touches one paragraph's characters; `paragraph-local` changes one
1459
- * paragraph's own properties; `flow-structural` changes the block sequence and can
1460
- * repaginate everything after it; `global` invalidates every page that shares the
1461
- * edited story (header/footer parts attached to many sections/pages).
1462
- */
1463
- /**
1464
- * How far an op's effects reach — what layout must re-do after it.
1465
- *
1466
- * The knob incremental layout turns: a `text-local` edit re-breaks one paragraph, while a
1467
- * `global` one invalidates the document.
1468
- */
1469
- type ImpactClass = 'text-local' | 'paragraph-local' | 'flow-structural' | 'global';
1470
- /**
1471
- * What one applied op changed: the ids dirtied, created and deleted.
1472
- *
1473
- * These ids are what let layout and paint re-do only what moved instead of the whole document.
1474
- */
1475
- interface TreeOpEffect {
1476
- readonly dirty: readonly string[];
1477
- readonly created: readonly string[];
1478
- readonly deleted: readonly string[];
1479
- readonly split?: {
1480
- readonly from: string;
1481
- readonly tail: string;
1482
- };
1483
- /** One entry per boundary of a many-way split, in document order. */
1484
- readonly splits?: readonly {
1485
- readonly from: string;
1486
- readonly tail: string;
1487
- }[];
1488
- readonly join?: {
1489
- readonly kept: string;
1490
- readonly removed: string;
1491
- };
1492
- readonly dependencyKeys: readonly string[];
1493
- readonly impact: ImpactClass;
1494
- /** First post-edit caret paragraph for table column structural ops. */
1495
- readonly caret?: {
1496
- readonly paragraphId: string;
1497
- };
1498
- }
1499
- /**
1500
- * Why an op was refused.
1501
- *
1502
- * `not-adjacent-siblings` is the notable one: a join across table cells is refused rather than
1503
- * silently merging content out of the cell that owned it.
1504
- */
1505
- type TreeOpRejection = 'unknown-op' | 'unknown-paragraph' | 'not-a-paragraph' | 'offset-out-of-range' | 'invalid-range' | 'not-a-list-paragraph' | 'splits-surrogate-pair' | 'invalid-text' | 'unsupported-property' | 'invalid-property-value' | 'not-adjacent-siblings'
1506
- /**
1507
- * The addressed position is strictly inside content nothing can divide: a hyperlink, an
1508
- * inline content control, a revision wrapper, or an atomic field.
1509
- *
1510
- * Distinct from `invalid-range`, which is an offset the paragraph does not have. This one is
1511
- * a real offset that is not a PLACE — refused rather than resolved to the nearest one, so a
1512
- * caller learns the node would not have landed where they asked.
1513
- */
1514
- | 'indivisible-content' | 'unknown-block' | 'not-a-block' | 'block-required' | 'carries-section-mark'
1515
- /** The transaction named a part the package does not hold. */
1516
- | 'unknown-part'
1517
- /**
1518
- * The transaction would have published a package that does not open: a relationship
1519
- * pointing at a part nobody created, or a part with no declared content type.
1520
- */
1521
- | 'package-invariant'
1522
- /** No revision in this part carries the addressed `(id, author, date)` triple. */
1523
- | 'unknown-revision'
1524
- /**
1525
- * A matched revision is a kind whose accept/reject semantics are structural and not
1526
- * implemented. Refusing is deliberate: removing the markup alone would report the decision
1527
- * applied while leaving the row, cell, or section it describes untouched.
1528
- */
1529
- | 'unsupported-revision' | 'tree-invariant'
1530
- /** No content control in this part carries the addressed node id. */
1531
- | 'unknown-content-control'
1532
- /** The addressed node exists and is not a `w:sdt`. */
1533
- | 'not-a-content-control'
1534
- /**
1535
- * A content control's `w:lock` — or one an enclosing control imposes — forbids this.
1536
- *
1537
- * The same code for an edit inside `contentLocked` content and for the removal of an
1538
- * `sdtLocked` control: both are "the document says no", and the two halves are already
1539
- * distinguished by which operation was refused.
1540
- */
1541
- | 'locked'
1542
- /** The control declares `w:dataBinding`; its value belongs to a custom XML part. */
1543
- | 'bound'
1544
- /** The value offered is not one this control's type accepts. */
1545
- | 'typeMismatch' | 'unknown-control' | 'unsupported'
1546
- /** Malformed lifecycle args / first-section link — mirrors Editor `invalidArgs`. */
1547
- | 'invalidArgs'
1548
- /** The addressed table id is missing, duplicated, or not a typed table. */
1549
- | 'unknown-table'
1550
- /** The addressed row id is missing or not a direct child of the table. */
1551
- | 'unknown-row'
1552
- /** A table property container appears more than once on a typed node. */
1553
- | 'duplicate-property-container'
1554
- /** Row insertion would split an active vertical-merge chain. */
1555
- | 'vertical-merge-crossing'
1556
- /** Column edit refused because the table carries horizontal or vertical merges. */
1557
- | 'table-has-merge'
1558
- /** The addressed grid column id is missing or ambiguous without `w:tblGrid`. */
1559
- | 'unknown-grid-column'
1560
- /** The operation would exceed bounded table topology limits. */
1561
- | 'resource-limit'
1562
- /** The addressed node is not a top-level `w:drawing`. */
1563
- | 'not-a-drawing'
1564
- /** No `w:drawing` with this id exists in the part. */
1565
- | 'unknown-drawing'
1566
- /** The drawing's graphic payload is not a supported picture. */
1567
- | 'not-a-picture-drawing'
1568
- /** A lock flag or `@locked` forbids this mutation. */
1569
- | 'drawing-locked'
1570
- /** Finite EMU extent, crop, or position value is out of range. */
1571
- | 'invalid-drawing-value'
1572
- /** Insertion would cross a table-cell boundary or wrong story container. */
1573
- | 'cross-cell-drawing'
1574
- /** Suggesting-mode drawing deletion is not implemented in this change. */
1575
- | 'trackedDrawingDeletionUnsupported'
1576
- /** Hyperlink target creation or change needs an OPC relationship in a package transaction. */
1577
- | 'packageTransactionRequired';
1578
- /** Whether an op applied, with the effect it produced or the reason it was refused. */
1579
- type TreeOpResult = {
1580
- readonly ok: true;
1581
- readonly part: OoxmlPart;
1582
- readonly effect: TreeOpEffect;
1583
- } | {
1584
- readonly ok: false;
1585
- readonly reason: TreeOpRejection;
1586
- readonly detail?: string;
1587
- };
1588
-
1589
- export { contentControlPropertiesNodeOf as $, ACCEPTED_PARAGRAPH_PROPERTIES as A, type ContentControlProperties as B, type ContentControlKind as C, type DrawingProjection as D, type HyperlinkKind as E, type HyperlinkTarget as F, MAX_CONTENT_CONTROL_NESTING as G, HYPERLINK_RELATIONSHIP_TYPE as H, type ImpactClass as I, OFFICE_RELATIONSHIP_NAMESPACE_URI as J, type RelationshipTargetResolver as K, TABLE_BORDER_STYLES as L, MAX_CONTENT_CONTROLS_PER_PART as M, TREE_DOC_OP_KINDS as N, type OoxmlProperty as O, type TabStopWrite as P, type TreeDocOpKind as Q, type RevisionAddress as R, type SourceCrop as S, type TreeDocOp as T, type TreeOpEffect as U, type VectorShapeProjection as V, allocateContentControlId as W, contentControlContentChildren as X, contentControlContentNodeOf as Y, contentControlEndPropertiesNodeOf as Z, contentControlLevelOf as _, type TreeOpRejection as a, contentControlPropertiesOf as a0, contentControlTextOf as a1, contentControlsIn as a2, findContentControl as a3, flattenContentControls as a4, hyperlinkAnchorOf as a5, hyperlinkRelationshipIdOf as a6, hyperlinkTargetOf as a7, isContentControlContentNode as a8, isContentControlNode as a9, isContentControlWrapper as aa, isHyperlinkNode as ab, lockForbidsEdit as ac, lockForbidsRemoval as ad, orderedContentControlProperties as ae, parseContentControlId as af, projectDrawing as ag, resolveContentControlLock as ah, type ImageWrapTarget as b, type DrawingKind as c, type DrawingPositionInput as d, type DrawingLocks as e, type DrawingHorizontalReferenceFrame as f, type DrawingVerticalReferenceFrame as g, type RevisionAttributionInput as h, type DrawingTreeDocOp as i, type TreeDocColorValue as j, IMAGE_WRAP_TARGETS as k, type DrawingAccessibility as l, type DrawingTransform as m, type TableBorderStyle as n, type ContentControlLevel as o, type ContentControlLock as p, type ContentControlDataBinding as q, type TreeOpResult as r, ACCEPTED_RUN_PROPERTIES as s, CONTENT_CONTROL_ID_MAX as t, CONTENT_CONTROL_PROPERTY_ORDER as u, type ContentControlCheckbox as v, type ContentControlCheckboxState as w, type ContentControlDateFormat as x, type ContentControlEntry as y, type ContentControlListItem as z };