@usejunior/docx-core 0.9.0 → 0.10.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 (185) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/atomizer.d.ts +49 -0
  3. package/dist/atomizer.d.ts.map +1 -1
  4. package/dist/atomizer.js +90 -0
  5. package/dist/atomizer.js.map +1 -1
  6. package/dist/baselines/atomizer/documentReconstructor.d.ts.map +1 -1
  7. package/dist/baselines/atomizer/documentReconstructor.js +289 -92
  8. package/dist/baselines/atomizer/documentReconstructor.js.map +1 -1
  9. package/dist/baselines/atomizer/formattingFidelity.d.ts +99 -0
  10. package/dist/baselines/atomizer/formattingFidelity.d.ts.map +1 -0
  11. package/dist/baselines/atomizer/formattingFidelity.js +449 -0
  12. package/dist/baselines/atomizer/formattingFidelity.js.map +1 -0
  13. package/dist/baselines/atomizer/inPlaceModifier-bookmarks.d.ts +37 -0
  14. package/dist/baselines/atomizer/inPlaceModifier-bookmarks.d.ts.map +1 -0
  15. package/dist/baselines/atomizer/inPlaceModifier-bookmarks.js +189 -0
  16. package/dist/baselines/atomizer/inPlaceModifier-bookmarks.js.map +1 -0
  17. package/dist/baselines/atomizer/inPlaceModifier-containers.d.ts +74 -0
  18. package/dist/baselines/atomizer/inPlaceModifier-containers.d.ts.map +1 -0
  19. package/dist/baselines/atomizer/inPlaceModifier-containers.js +171 -0
  20. package/dist/baselines/atomizer/inPlaceModifier-containers.js.map +1 -0
  21. package/dist/baselines/atomizer/inPlaceModifier-deletion.d.ts +88 -0
  22. package/dist/baselines/atomizer/inPlaceModifier-deletion.d.ts.map +1 -0
  23. package/dist/baselines/atomizer/inPlaceModifier-deletion.js +326 -0
  24. package/dist/baselines/atomizer/inPlaceModifier-deletion.js.map +1 -0
  25. package/dist/baselines/atomizer/inPlaceModifier-postprocess.d.ts +85 -0
  26. package/dist/baselines/atomizer/inPlaceModifier-postprocess.d.ts.map +1 -0
  27. package/dist/baselines/atomizer/inPlaceModifier-postprocess.js +402 -0
  28. package/dist/baselines/atomizer/inPlaceModifier-postprocess.js.map +1 -0
  29. package/dist/baselines/atomizer/inPlaceModifier-presplit.d.ts +39 -0
  30. package/dist/baselines/atomizer/inPlaceModifier-presplit.d.ts.map +1 -0
  31. package/dist/baselines/atomizer/inPlaceModifier-presplit.js +265 -0
  32. package/dist/baselines/atomizer/inPlaceModifier-presplit.js.map +1 -0
  33. package/dist/baselines/atomizer/inPlaceModifier-shared.d.ts +62 -0
  34. package/dist/baselines/atomizer/inPlaceModifier-shared.d.ts.map +1 -0
  35. package/dist/baselines/atomizer/inPlaceModifier-shared.js +139 -0
  36. package/dist/baselines/atomizer/inPlaceModifier-shared.js.map +1 -0
  37. package/dist/baselines/atomizer/inPlaceModifier-wrappers.d.ts +189 -0
  38. package/dist/baselines/atomizer/inPlaceModifier-wrappers.d.ts.map +1 -0
  39. package/dist/baselines/atomizer/inPlaceModifier-wrappers.js +427 -0
  40. package/dist/baselines/atomizer/inPlaceModifier-wrappers.js.map +1 -0
  41. package/dist/baselines/atomizer/inPlaceModifier.d.ts +6 -290
  42. package/dist/baselines/atomizer/inPlaceModifier.d.ts.map +1 -1
  43. package/dist/baselines/atomizer/inPlaceModifier.js +23 -1828
  44. package/dist/baselines/atomizer/inPlaceModifier.js.map +1 -1
  45. package/dist/baselines/atomizer/pipeline.d.ts +76 -1
  46. package/dist/baselines/atomizer/pipeline.d.ts.map +1 -1
  47. package/dist/baselines/atomizer/pipeline.js +445 -108
  48. package/dist/baselines/atomizer/pipeline.js.map +1 -1
  49. package/dist/baselines/atomizer/trackChangesAcceptorAst.d.ts.map +1 -1
  50. package/dist/baselines/atomizer/trackChangesAcceptorAst.js +56 -160
  51. package/dist/baselines/atomizer/trackChangesAcceptorAst.js.map +1 -1
  52. package/dist/compare-types.d.ts +151 -0
  53. package/dist/compare-types.d.ts.map +1 -0
  54. package/dist/compare-types.js +2 -0
  55. package/dist/compare-types.js.map +1 -0
  56. package/dist/core-types.d.ts +5 -1
  57. package/dist/core-types.d.ts.map +1 -1
  58. package/dist/core-types.js +5 -1
  59. package/dist/core-types.js.map +1 -1
  60. package/dist/footnotes.d.ts +8 -3
  61. package/dist/footnotes.d.ts.map +1 -1
  62. package/dist/footnotes.js +8 -3
  63. package/dist/footnotes.js.map +1 -1
  64. package/dist/index.d.ts +6 -150
  65. package/dist/index.d.ts.map +1 -1
  66. package/dist/index.js +6 -0
  67. package/dist/index.js.map +1 -1
  68. package/dist/integration/libreoffice-oracle.d.ts +41 -0
  69. package/dist/integration/libreoffice-oracle.d.ts.map +1 -0
  70. package/dist/integration/libreoffice-oracle.js +282 -0
  71. package/dist/integration/libreoffice-oracle.js.map +1 -0
  72. package/dist/integration/synthetic-docx-fixture.d.ts +62 -0
  73. package/dist/integration/synthetic-docx-fixture.d.ts.map +1 -0
  74. package/dist/integration/synthetic-docx-fixture.js +171 -0
  75. package/dist/integration/synthetic-docx-fixture.js.map +1 -0
  76. package/dist/primitives/accept_changes.d.ts +2 -2
  77. package/dist/primitives/accept_changes.d.ts.map +1 -1
  78. package/dist/primitives/accept_changes.js +24 -79
  79. package/dist/primitives/accept_changes.js.map +1 -1
  80. package/dist/primitives/comments.d.ts +12 -3
  81. package/dist/primitives/comments.d.ts.map +1 -1
  82. package/dist/primitives/comments.js +374 -97
  83. package/dist/primitives/comments.js.map +1 -1
  84. package/dist/primitives/content_fingerprint.d.ts +29 -0
  85. package/dist/primitives/content_fingerprint.d.ts.map +1 -0
  86. package/dist/primitives/content_fingerprint.js +63 -0
  87. package/dist/primitives/content_fingerprint.js.map +1 -0
  88. package/dist/primitives/document.d.ts +56 -15
  89. package/dist/primitives/document.d.ts.map +1 -1
  90. package/dist/primitives/document.js +303 -32
  91. package/dist/primitives/document.js.map +1 -1
  92. package/dist/primitives/document_view-comments.d.ts +18 -0
  93. package/dist/primitives/document_view-comments.d.ts.map +1 -0
  94. package/dist/primitives/document_view-comments.js +159 -0
  95. package/dist/primitives/document_view-comments.js.map +1 -0
  96. package/dist/primitives/document_view-headings.d.ts +45 -0
  97. package/dist/primitives/document_view-headings.d.ts.map +1 -0
  98. package/dist/primitives/document_view-headings.js +247 -0
  99. package/dist/primitives/document_view-headings.js.map +1 -0
  100. package/dist/primitives/document_view-styles.d.ts +11 -0
  101. package/dist/primitives/document_view-styles.d.ts.map +1 -0
  102. package/dist/primitives/document_view-styles.js +104 -0
  103. package/dist/primitives/document_view-styles.js.map +1 -0
  104. package/dist/primitives/document_view-toon.d.ts +37 -0
  105. package/dist/primitives/document_view-toon.d.ts.map +1 -0
  106. package/dist/primitives/document_view-toon.js +199 -0
  107. package/dist/primitives/document_view-toon.js.map +1 -0
  108. package/dist/primitives/document_view-types.d.ts +137 -0
  109. package/dist/primitives/document_view-types.d.ts.map +1 -0
  110. package/dist/primitives/document_view-types.js +2 -0
  111. package/dist/primitives/document_view-types.js.map +1 -0
  112. package/dist/primitives/document_view.d.ts +8 -106
  113. package/dist/primitives/document_view.d.ts.map +1 -1
  114. package/dist/primitives/document_view.js +134 -301
  115. package/dist/primitives/document_view.js.map +1 -1
  116. package/dist/primitives/dom-helpers.d.ts +9 -0
  117. package/dist/primitives/dom-helpers.d.ts.map +1 -1
  118. package/dist/primitives/dom-helpers.js +10 -1
  119. package/dist/primitives/dom-helpers.js.map +1 -1
  120. package/dist/primitives/footnotes.d.ts +4 -3
  121. package/dist/primitives/footnotes.d.ts.map +1 -1
  122. package/dist/primitives/footnotes.js +232 -44
  123. package/dist/primitives/footnotes.js.map +1 -1
  124. package/dist/primitives/formatting_tags.d.ts +6 -0
  125. package/dist/primitives/formatting_tags.d.ts.map +1 -1
  126. package/dist/primitives/formatting_tags.js +6 -1
  127. package/dist/primitives/formatting_tags.js.map +1 -1
  128. package/dist/primitives/index.d.ts +6 -0
  129. package/dist/primitives/index.d.ts.map +1 -1
  130. package/dist/primitives/index.js +5 -0
  131. package/dist/primitives/index.js.map +1 -1
  132. package/dist/primitives/layout.d.ts +4 -3
  133. package/dist/primitives/layout.d.ts.map +1 -1
  134. package/dist/primitives/layout.js +32 -3
  135. package/dist/primitives/layout.js.map +1 -1
  136. package/dist/primitives/merge_runs.d.ts +21 -3
  137. package/dist/primitives/merge_runs.d.ts.map +1 -1
  138. package/dist/primitives/merge_runs.js +32 -10
  139. package/dist/primitives/merge_runs.js.map +1 -1
  140. package/dist/primitives/namespaces.d.ts +6 -0
  141. package/dist/primitives/namespaces.d.ts.map +1 -1
  142. package/dist/primitives/namespaces.js +9 -0
  143. package/dist/primitives/namespaces.js.map +1 -1
  144. package/dist/primitives/reject_changes.d.ts +2 -2
  145. package/dist/primitives/reject_changes.d.ts.map +1 -1
  146. package/dist/primitives/reject_changes.js +24 -81
  147. package/dist/primitives/reject_changes.js.map +1 -1
  148. package/dist/primitives/semantic_tags.d.ts +7 -0
  149. package/dist/primitives/semantic_tags.d.ts.map +1 -1
  150. package/dist/primitives/semantic_tags.js +21 -3
  151. package/dist/primitives/semantic_tags.js.map +1 -1
  152. package/dist/primitives/serialize_html.d.ts +36 -0
  153. package/dist/primitives/serialize_html.d.ts.map +1 -0
  154. package/dist/primitives/serialize_html.js +393 -0
  155. package/dist/primitives/serialize_html.js.map +1 -0
  156. package/dist/primitives/serialize_markdown.d.ts +16 -0
  157. package/dist/primitives/serialize_markdown.d.ts.map +1 -0
  158. package/dist/primitives/serialize_markdown.js +300 -0
  159. package/dist/primitives/serialize_markdown.js.map +1 -0
  160. package/dist/primitives/serialize_plaintext.d.ts +15 -0
  161. package/dist/primitives/serialize_plaintext.d.ts.map +1 -0
  162. package/dist/primitives/serialize_plaintext.js +154 -0
  163. package/dist/primitives/serialize_plaintext.js.map +1 -0
  164. package/dist/primitives/styles.js +22 -22
  165. package/dist/primitives/styles.js.map +1 -1
  166. package/dist/primitives/tables.d.ts.map +1 -1
  167. package/dist/primitives/tables.js +13 -3
  168. package/dist/primitives/tables.js.map +1 -1
  169. package/dist/primitives/text.d.ts +2 -1
  170. package/dist/primitives/text.d.ts.map +1 -1
  171. package/dist/primitives/text.js +116 -12
  172. package/dist/primitives/text.js.map +1 -1
  173. package/dist/primitives/track-changes-emitter.d.ts +139 -0
  174. package/dist/primitives/track-changes-emitter.d.ts.map +1 -0
  175. package/dist/primitives/track-changes-emitter.js +241 -0
  176. package/dist/primitives/track-changes-emitter.js.map +1 -0
  177. package/dist/primitives/xml-helpers.d.ts +29 -0
  178. package/dist/primitives/xml-helpers.d.ts.map +1 -0
  179. package/dist/primitives/xml-helpers.js +35 -0
  180. package/dist/primitives/xml-helpers.js.map +1 -0
  181. package/dist/shared/ooxml/namespaces.d.ts +4 -1
  182. package/dist/shared/ooxml/namespaces.d.ts.map +1 -1
  183. package/dist/shared/ooxml/namespaces.js +4 -1
  184. package/dist/shared/ooxml/namespaces.js.map +1 -1
  185. package/package.json +7 -6
@@ -11,301 +11,17 @@
11
11
  * - addFormatChange: Add <w:rPrChange> for formatting differences
12
12
  */
13
13
  import type { ComparisonUnitAtom } from '../../core-types.js';
14
- /**
15
- * Error thrown when the original and revised documents have different table/container
16
- * topology, making container-aware inplace insertion impossible.
17
- * Caught by the adaptive pass loop to trigger rebuild fallback.
18
- */
19
- export declare class ContainerResolutionError extends Error {
20
- constructor(message: string);
21
- }
22
- /** A single step in a structural path from a paragraph up to w:body. */
23
- interface ContainerPathStep {
24
- tag: string;
25
- index: number;
26
- }
27
- /**
28
- * Compute the structural path from a paragraph to the document body.
29
- * Walks `parentNode` from the paragraph, recording {tag, index} for each
30
- * structural container (w:tc, w:tr, w:tbl). Stops at w:body.
31
- * Returns innermost-first order.
32
- *
33
- * Uses original-tree nodes — safe because only the revised tree is mutated.
34
- */
35
- export declare function getContainerPath(paragraph: Element): ContainerPathStep[];
36
- /**
37
- * Resolve a container path in the revised tree.
38
- * Walks the path in reverse (outermost → innermost) from `body`.
39
- * Returns the deepest container (typically w:tc), or null on mismatch.
40
- */
41
- export declare function resolveContainerInRevised(path: ContainerPathStep[], body: Element): Element | null;
42
- /**
43
- * Validate that the revised tree has compatible topology at the given path.
44
- * Checks row count and cell count match at the target position.
45
- * Returns false if there's a structural mismatch (row/cell additions, gridSpan divergence).
46
- */
47
- export declare function validateContainerTopology(path: ContainerPathStep[], body: Element): boolean;
48
- /**
49
- * Options for in-place modification.
50
- */
51
14
  export interface InPlaceModifierOptions {
52
15
  /** Author name for track changes */
53
16
  author: string;
54
17
  /** Timestamp for track changes */
55
18
  date: Date;
56
19
  }
57
- /**
58
- * State for tracking revision IDs during modification.
59
- */
60
- interface RevisionIdState {
61
- nextId: number;
62
- moveRangeIds: Map<string, {
63
- sourceRangeId: number;
64
- destRangeId: number;
65
- }>;
66
- /** Track which run elements have already been wrapped */
67
- wrappedRuns: Set<Element>;
68
- /**
69
- * Source bookmark markers cloned into inserted deleted/moveFrom content.
70
- * Prevents duplicate marker emission when a single source run is split into
71
- * multiple atoms (word-level atomization).
72
- */
73
- emittedSourceBookmarkMarkers: Set<Element>;
74
- }
75
- /**
76
- * Create initial revision ID state.
77
- */
78
- declare function createRevisionIdState(): RevisionIdState;
79
- interface BookmarkSurvivalContext {
80
- isParagraphRemovedOnReject?: (paragraph: Element) => boolean;
81
- }
82
- /**
83
- * Wrap a run element with <w:ins> to mark it as inserted.
84
- *
85
- * @param run - The w:r element to wrap
86
- * @param author - Author name for track changes
87
- * @param dateStr - Formatted date string
88
- * @param state - Revision ID state
89
- * @returns true if wrapped, false if run was already wrapped or has no parent
90
- */
91
- export declare function wrapAsInserted(run: Element, author: string, dateStr: string, state: RevisionIdState): boolean;
92
- /**
93
- * Wrap a run element with <w:del> to mark it as deleted.
94
- * Also converts w:t to w:delText within the run.
95
- *
96
- * @param run - The w:r element to wrap
97
- * @param author - Author name for track changes
98
- * @param dateStr - Formatted date string
99
- * @param state - Revision ID state
100
- * @returns true if wrapped, false if run was already wrapped or has no parent
101
- */
102
- export declare function wrapAsDeleted(run: Element, author: string, dateStr: string, state: RevisionIdState): boolean;
103
- /**
104
- * Clone a deleted run from the original document and insert it into the revised document.
105
- *
106
- * @param deletedAtom - Atom with the deleted content
107
- * @param insertAfterRun - The run to insert after (null to insert at beginning of paragraph)
108
- * @param targetParagraph - The paragraph to insert into
109
- * @param author - Author name
110
- * @param dateStr - Formatted date
111
- * @param state - Revision ID state
112
- * @returns The inserted del element, or null if insertion failed
113
- */
114
- export declare function insertDeletedRun(deletedAtom: ComparisonUnitAtom, insertAfterRun: Element | null, targetParagraph: Element, author: string, dateStr: string, state: RevisionIdState, context?: BookmarkSurvivalContext): Element | null;
115
- /**
116
- * Clone a moved-from run from the original document and insert it into the revised document.
117
- *
118
- * MovedSource atoms have their sourceRunElement in the ORIGINAL tree, but we need to
119
- * insert the content into the REVISED tree. This function clones the run, wraps it with
120
- * <w:moveFrom> and range markers, and inserts at the correct position.
121
- *
122
- * @param atom - Atom with the moved-from content
123
- * @param moveName - Name for linking source and destination
124
- * @param insertAfterRun - The run to insert after (null to insert at beginning of paragraph)
125
- * @param targetParagraph - The paragraph to insert into
126
- * @param author - Author name
127
- * @param dateStr - Formatted date
128
- * @param state - Revision ID state
129
- * @returns The inserted moveFrom element, or null if insertion failed
130
- */
131
- export declare function insertMoveFromRun(atom: ComparisonUnitAtom, moveName: string, insertAfterRun: Element | null, targetParagraph: Element, author: string, dateStr: string, state: RevisionIdState, context?: BookmarkSurvivalContext): Element | null;
132
- /**
133
- * Clone a deleted paragraph from the original document and insert it.
134
- *
135
- * @param deletedAtom - Atom representing the deleted paragraph
136
- * @param insertAfterParagraph - Paragraph to insert after (null to insert at body start)
137
- * @param targetBody - The body element to insert into
138
- * @param author - Author name
139
- * @param dateStr - Formatted date
140
- * @param state - Revision ID state
141
- * @returns The inserted paragraph, or null if insertion failed
142
- */
143
- export declare function insertDeletedParagraph(deletedAtom: ComparisonUnitAtom, insertAfterParagraph: Element | null, targetContainer: Element, author: string, dateStr: string, state: RevisionIdState): Element | null;
144
- /**
145
- * Wrap a run element with <w:moveFrom> for moved-from content.
146
- *
147
- * @param run - The w:r element to wrap
148
- * @param moveName - Name for linking source and destination
149
- * @param author - Author name
150
- * @param dateStr - Formatted date
151
- * @param state - Revision ID state
152
- * @returns true if wrapped
153
- */
154
- export declare function wrapAsMoveFrom(run: Element, moveName: string, author: string, dateStr: string, state: RevisionIdState): boolean;
155
- /**
156
- * Wrap a run element with <w:moveTo> for moved-to content.
157
- *
158
- * @param run - The w:r element to wrap
159
- * @param moveName - Name for linking source and destination
160
- * @param author - Author name
161
- * @param dateStr - Formatted date
162
- * @param state - Revision ID state
163
- * @returns true if wrapped
164
- */
165
- export declare function wrapAsMoveTo(run: Element, moveName: string, author: string, dateStr: string, state: RevisionIdState): boolean;
166
- /**
167
- * Add format change tracking to a run's properties.
168
- *
169
- * @param run - The w:r element with changed formatting
170
- * @param oldRunProperties - The original run properties (w:rPr)
171
- * @param author - Author name
172
- * @param dateStr - Formatted date
173
- * @param state - Revision ID state
174
- */
175
- export declare function addFormatChange(run: Element, oldRunProperties: Element | null, author: string, dateStr: string, state: RevisionIdState): void;
176
- /**
177
- * Add a paragraph property change element (w:pPrChange) to record the "before"
178
- * state of paragraph properties. This is needed for Google Docs to display
179
- * inserted paragraphs as tracked changes.
180
- *
181
- * The child `<w:pPr>` inside `w:pPrChange` must conform to CT_PPrBase — it
182
- * MUST NOT contain w:rPr, w:sectPr, or w:pPrChange.
183
- *
184
- * @param paragraph - The w:p element
185
- * @param author - Author name
186
- * @param dateStr - Formatted date
187
- * @param state - Revision ID state
188
- */
189
- export declare function addParagraphPropertyChange(paragraph: Element, author: string, dateStr: string, state: RevisionIdState): void;
190
- /**
191
- * Returns true if a w:r element contains at least one visible content child.
192
- * Empty runs (containing only w:rPr or nothing) return false.
193
- */
194
- export declare function runHasVisibleContent(run: Element): boolean;
195
- /**
196
- * Wrap an inserted empty paragraph with <w:ins>.
197
- *
198
- * For empty paragraphs (no content, only pPr), we wrap the entire paragraph.
199
- *
200
- * @param paragraph - The w:p element
201
- * @param author - Author name
202
- * @param dateStr - Formatted date
203
- * @param state - Revision ID state
204
- */
205
- export declare function wrapParagraphAsInserted(paragraph: Element, author: string, dateStr: string, state: RevisionIdState): boolean;
206
- /**
207
- * Wrap a deleted empty paragraph with <w:del>.
208
- *
209
- * @param paragraph - The w:p element
210
- * @param author - Author name
211
- * @param dateStr - Formatted date
212
- * @param state - Revision ID state
213
- */
214
- export declare function wrapParagraphAsDeleted(paragraph: Element, author: string, dateStr: string, state: RevisionIdState): boolean;
215
- /**
216
- * Pre-split revised-tree runs that contain atoms with mixed correlation statuses.
217
- *
218
- * Without this, `handleInserted` wraps the entire run with `<w:ins>`, destroying
219
- * Equal content in the same run. After splitting, each fragment is a separate
220
- * `<w:r>` and existing per-status handlers work without modification.
221
- *
222
- * Safety: wrapped in try/catch per run group. If any DOM operation fails, the
223
- * run is skipped and the existing fallback-to-rebuild architecture handles it.
224
- */
225
- export declare function preSplitMixedStatusRuns(mergedAtoms: ComparisonUnitAtom[]): void;
226
- /**
227
- * Pre-split revised-tree runs where word-split Equal atoms from the same run
228
- * are interleaved with Deleted/MovedSource atoms in the merged atom list.
229
- *
230
- * `preSplitMixedStatusRuns` handles the case where a single run contains atoms
231
- * with DIFFERENT statuses (e.g., some Equal and some Inserted). But it cannot
232
- * handle the case where ALL atoms from a run are Equal yet Deleted atoms (from
233
- * the original tree) are interspersed between them in the merged list.
234
- *
235
- * Without this split, `handleEqual` sees all Equal atoms pointing to the same
236
- * run and skips position advancement (the `lastRevisedRunAnchor` optimization).
237
- * Subsequent `handleDeleted` calls then insert deleted content at the wrong
238
- * position because the cursor never advanced past the shared run.
239
- *
240
- * This function detects interleaved sequences and splits the DOM run so each
241
- * contiguous group of Equal atoms gets its own run fragment. The handlers then
242
- * advance the cursor correctly across fragments.
243
- */
244
- export declare function preSplitInterleavedWordRuns(mergedAtoms: ComparisonUnitAtom[]): void;
245
- /**
246
- * Modify the revised document's AST in-place based on comparison results.
247
- *
248
- * @param revisedRoot - Root element of the revised document
249
- * @param mergedAtoms - Atoms with correlation status from comparison
250
- * @param options - Modification options
251
- * @returns The modified XML string
252
- */
253
20
  export declare function modifyRevisedDocument(revisedRoot: Element, originalAtoms: ComparisonUnitAtom[], revisedAtoms: ComparisonUnitAtom[], mergedAtoms: ComparisonUnitAtom[], options: InPlaceModifierOptions): string;
254
- /**
255
- * Reorder merged atoms so that within each contiguous block of non-equal atoms,
256
- * all deletion-like atoms come before all insertion-like atoms.
257
- *
258
- * This produces grouped tracked changes ("<del>old words</del><ins>new words</ins>")
259
- * instead of alternating word-by-word pairs ("<del>old1</del><ins>new1</ins><del>old2</del>...").
260
- */
261
- export declare function groupDeletionsBeforeInsertions(atoms: ComparisonUnitAtom[]): ComparisonUnitAtom[];
262
- /**
263
- * Check if an adjacent w:del + w:ins pair is a no-op (identical text and formatting).
264
- * Both wrappers must contain the same number of runs with matching rPr and content.
265
- */
266
- export declare function isNoOpPair(del: Element, ins: Element): boolean;
267
- /**
268
- * Suppress no-op del/ins pairs — adjacent w:del + w:ins wrappers where the
269
- * content and formatting are identical. These arise from field-adjacent atoms
270
- * that are false-positive changes.
271
- *
272
- * When a no-op is detected, both wrappers are unwrapped, leaving the ins-side
273
- * runs as plain (non-tracked) children. The del-side runs are removed.
274
- */
275
- export declare function suppressNoOpChangePairs(root: Element): void;
276
- /**
277
- * Merge track-change wrappers (w:del or w:ins) that are separated by a
278
- * whitespace-only run. This groups "word-by-word" tracked changes into
279
- * contiguous blocks for cleaner presentation.
280
- *
281
- * For w:del: clones the whitespace run, converts w:t→w:delText, and absorbs
282
- * both the whitespace and the second wrapper's children into the first wrapper.
283
- *
284
- * For w:ins: moves the whitespace run into the first wrapper, then absorbs
285
- * the second wrapper's children.
286
- *
287
- * Both projections (Accept All, Reject All) remain correct because each
288
- * wrapper independently contains the whitespace it needs.
289
- */
290
- export declare function mergeWhitespaceBridgedTrackChanges(root: Element): void;
291
- /**
292
- * Coalesce alternating del/ins pair chains separated by whitespace-only runs
293
- * into single grouped del + ins wrappers.
294
- *
295
- * Pattern: [w:del, w:ins, ws-segment..., w:del, w:ins, ws-segment..., w:del, w:ins]
296
- *
297
- * For each whitespace segment between consecutive [del, ins] pairs:
298
- * 1. Clone each ws-run → convert to delText → append to first del
299
- * 2. Clone each ws-run → keep as w:t → append to first ins
300
- * 3. Move nextDel's children into first del
301
- * 4. Move nextIns's children into first ins
302
- * 5. Remove original ws-runs, empty nextDel, empty nextIns from parent
303
- *
304
- * Safety invariants:
305
- * - Only bridges when both del AND ins absorb the whitespace (both projections correct)
306
- * - Incomplete tail [del, ins, ws, del] (no trailing ins) → stop chain, don't bridge
307
- * - All wrappers in chain must share same w:author and w:date
308
- */
309
- export declare function coalesceDelInsPairChains(root: Element): void;
310
- export { createRevisionIdState, type RevisionIdState };
21
+ export { createRevisionIdState, type RevisionIdState, } from './inPlaceModifier-shared.js';
22
+ export { ContainerResolutionError, getContainerPath, resolveContainerInRevised, validateContainerTopology, } from './inPlaceModifier-containers.js';
23
+ export { addFormatChange, addParagraphPropertyChange, runHasVisibleContent, wrapAsDeleted, wrapAsInserted, wrapAsMoveFrom, wrapAsMoveTo, wrapParagraphAsDeleted, wrapParagraphAsInserted, } from './inPlaceModifier-wrappers.js';
24
+ export { insertDeletedParagraph, insertDeletedRun, insertMoveFromRun, } from './inPlaceModifier-deletion.js';
25
+ export { preSplitInterleavedWordRuns, preSplitMixedStatusRuns, } from './inPlaceModifier-presplit.js';
26
+ export { coalesceDelInsPairChains, groupDeletionsBeforeInsertions, isNoOpPair, mergeWhitespaceBridgedTrackChanges, suppressNoOpChangePairs, } from './inPlaceModifier-postprocess.js';
311
27
  //# sourceMappingURL=inPlaceModifier.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"inPlaceModifier.d.ts","sourceRoot":"","sources":["../../../src/baselines/atomizer/inPlaceModifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AA6C9D;;;;GAIG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;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,EACb,cAAc,EACd,cAAc,EACd,YAAY,EACZ,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,sBAAsB,EACtB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,2BAA2B,EAC3B,uBAAuB,GACxB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,wBAAwB,EACxB,8BAA8B,EAC9B,UAAU,EACV,kCAAkC,EAClC,uBAAuB,GACxB,MAAM,kCAAkC,CAAC"}