@docx4j/core-ts 0.4.0 → 0.6.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 (166) hide show
  1. package/NOTICE +4 -0
  2. package/README.md +34 -3
  3. package/dist/html/convert.mjs +40 -15
  4. package/dist/html/elements.mjs +2 -1
  5. package/dist/model/color/ColorMath.d.mts +29 -0
  6. package/dist/model/color/ColorMath.mjs +146 -0
  7. package/dist/model/color/ColorTables.d.mts +6 -0
  8. package/dist/model/color/ColorTables.mjs +83 -0
  9. package/dist/model/color/DrawingMLColors.d.mts +52 -0
  10. package/dist/model/color/DrawingMLColors.mjs +374 -0
  11. package/dist/model/color/ResolvedColor.d.mts +36 -0
  12. package/dist/model/color/ResolvedColor.mjs +65 -0
  13. package/dist/model/color/SpreadsheetColors.d.mts +36 -0
  14. package/dist/model/color/SpreadsheetColors.mjs +84 -0
  15. package/dist/model/color/StyleFill.d.mts +28 -0
  16. package/dist/model/color/StyleFill.mjs +21 -0
  17. package/dist/model/color/ThemeColors.d.mts +86 -0
  18. package/dist/model/color/ThemeColors.mjs +304 -0
  19. package/dist/model/color/WordColors.d.mts +71 -0
  20. package/dist/model/color/WordColors.mjs +121 -0
  21. package/dist/model/color/index.d.mts +6 -0
  22. package/dist/model/color/index.mjs +30 -0
  23. package/dist/model/content/Body.d.mts +153 -19
  24. package/dist/model/content/Body.mjs +570 -131
  25. package/dist/model/content/Comment.d.mts +21 -3
  26. package/dist/model/content/Comment.mjs +202 -19
  27. package/dist/model/content/ContentControl.d.mts +197 -18
  28. package/dist/model/content/ContentControl.mjs +664 -95
  29. package/dist/model/content/Font.d.mts +67 -17
  30. package/dist/model/content/Font.mjs +114 -35
  31. package/dist/model/content/InlinePicture.d.mts +82 -7
  32. package/dist/model/content/InlinePicture.mjs +221 -28
  33. package/dist/model/content/List.mjs +13 -1
  34. package/dist/model/content/Paragraph.d.mts +213 -14
  35. package/dist/model/content/Paragraph.mjs +936 -100
  36. package/dist/model/content/Range.d.mts +242 -11
  37. package/dist/model/content/Range.mjs +975 -119
  38. package/dist/model/content/ResolvedView.d.mts +104 -0
  39. package/dist/model/content/ResolvedView.mjs +596 -0
  40. package/dist/model/content/Table.d.mts +29 -3
  41. package/dist/model/content/Table.mjs +109 -33
  42. package/dist/model/content/TrackedChange.d.mts +301 -16
  43. package/dist/model/content/TrackedChange.mjs +1284 -158
  44. package/dist/model/content/binder.d.mts +2 -1
  45. package/dist/model/content/binder.mjs +48 -1
  46. package/dist/model/content/comments.d.mts +20 -6
  47. package/dist/model/content/comments.mjs +67 -57
  48. package/dist/model/content/generalException.d.mts +18 -0
  49. package/dist/model/content/generalException.mjs +24 -0
  50. package/dist/model/content/index.d.mts +8 -3
  51. package/dist/model/content/index.mjs +7 -2
  52. package/dist/model/content/mathText.d.mts +21 -0
  53. package/dist/model/content/mathText.mjs +267 -0
  54. package/dist/model/content/officeText.d.mts +27 -0
  55. package/dist/model/content/officeText.mjs +74 -0
  56. package/dist/model/content/outline.d.mts +5 -0
  57. package/dist/model/content/outline.mjs +13 -0
  58. package/dist/model/content/placeholders.d.mts +110 -0
  59. package/dist/model/content/placeholders.mjs +253 -0
  60. package/dist/model/content/relationships.d.mts +30 -0
  61. package/dist/model/content/relationships.mjs +133 -0
  62. package/dist/model/content/search.d.mts +72 -0
  63. package/dist/model/content/search.mjs +204 -2
  64. package/dist/model/content/spanEdits.d.mts +159 -0
  65. package/dist/model/content/spanEdits.mjs +728 -0
  66. package/dist/model/content/story.d.mts +44 -0
  67. package/dist/model/content/story.mjs +92 -0
  68. package/dist/model/content/tableColumns.d.mts +1 -1
  69. package/dist/model/content/tableColumns.mjs +108 -80
  70. package/dist/model/content/tableRevisions.d.mts +11 -3
  71. package/dist/model/content/tableRevisions.mjs +72 -42
  72. package/dist/model/content/tableRules.d.mts +30 -0
  73. package/dist/model/content/tableRules.mjs +100 -0
  74. package/dist/model/content/textBoxes.d.mts +18 -0
  75. package/dist/model/content/textBoxes.mjs +105 -0
  76. package/dist/model/content/trackedChangeFilter.d.mts +39 -0
  77. package/dist/model/content/trackedChangeFilter.mjs +81 -0
  78. package/dist/model/content/tracking.d.mts +28 -0
  79. package/dist/model/content/tracking.mjs +149 -10
  80. package/dist/model/content/tree.d.mts +212 -13
  81. package/dist/model/content/tree.mjs +356 -35
  82. package/dist/model/customxml/CustomXmlPartCollection.d.mts +8 -0
  83. package/dist/model/customxml/CustomXmlPartCollection.mjs +34 -11
  84. package/dist/model/customxml/XmlMapping.d.mts +1 -1
  85. package/dist/model/customxml/XmlMapping.mjs +11 -0
  86. package/dist/model/customxml/bindings.d.mts +21 -2
  87. package/dist/model/customxml/bindings.mjs +76 -32
  88. package/dist/model/customxml/kinds.d.mts +8 -3
  89. package/dist/model/customxml/kinds.mjs +26 -5
  90. package/dist/model/customxml/picturePlaceholder.d.mts +17 -0
  91. package/dist/model/customxml/picturePlaceholder.mjs +32 -0
  92. package/dist/model/customxml/pictures.d.mts +9 -5
  93. package/dist/model/customxml/pictures.mjs +31 -13
  94. package/dist/model/customxml/xhtml.mjs +8 -2
  95. package/dist/model/fonts/families.generated.mjs +2 -2
  96. package/dist/model/fonts/registry.mjs +7 -1
  97. package/dist/model/fonts/substitutions.generated.mjs +2 -2
  98. package/dist/model/fonts/themes.generated.mjs +1 -1
  99. package/dist/model/index.d.mts +2 -0
  100. package/dist/model/index.mjs +4 -0
  101. package/dist/model/listnumbering/Emulator.d.mts +37 -5
  102. package/dist/model/listnumbering/Emulator.mjs +63 -9
  103. package/dist/model/listnumbering/definitions.mjs +18 -0
  104. package/dist/model/properties/PropertyResolver.d.mts +87 -7
  105. package/dist/model/properties/PropertyResolver.mjs +197 -17
  106. package/dist/model/properties/catalogue.d.mts +32 -4
  107. package/dist/model/properties/catalogue.mjs +115 -36
  108. package/dist/model/properties/log.d.mts +1 -1
  109. package/dist/model/properties/log.mjs +5 -5
  110. package/dist/model/properties/table.d.mts +16 -2
  111. package/dist/model/properties/table.mjs +17 -5
  112. package/dist/model/text/Extractor.d.mts +289 -0
  113. package/dist/model/text/Extractor.mjs +2162 -0
  114. package/dist/model/text/LinkTargets.d.mts +45 -0
  115. package/dist/model/text/LinkTargets.mjs +170 -0
  116. package/dist/model/text/MarkdownExporter.d.mts +140 -0
  117. package/dist/model/text/MarkdownExporter.mjs +255 -0
  118. package/dist/model/text/PlainText.d.mts +29 -0
  119. package/dist/model/text/PlainText.mjs +539 -0
  120. package/dist/model/text/TextContext.d.mts +161 -0
  121. package/dist/model/text/TextContext.mjs +425 -0
  122. package/dist/model/text/TextOptions.d.mts +150 -0
  123. package/dist/model/text/TextOptions.mjs +278 -0
  124. package/dist/model/text/TextResult.d.mts +504 -0
  125. package/dist/model/text/TextResult.mjs +526 -0
  126. package/dist/model/text/Texts.d.mts +99 -0
  127. package/dist/model/text/Texts.mjs +187 -0
  128. package/dist/model/text/WmlToMarkdown.d.mts +120 -0
  129. package/dist/model/text/WmlToMarkdown.mjs +911 -0
  130. package/dist/model/text/commonmark.d.mts +121 -0
  131. package/dist/model/text/commonmark.mjs +655 -0
  132. package/dist/model/text/index.d.mts +7 -0
  133. package/dist/model/text/index.mjs +8 -0
  134. package/dist/model/text/normalize.d.mts +8 -0
  135. package/dist/model/text/normalize.mjs +13 -0
  136. package/dist/model/text/outline.d.mts +4 -0
  137. package/dist/model/text/outline.mjs +71 -0
  138. package/dist/office-js/fragment.d.mts +7 -5
  139. package/dist/office-js/fragment.mjs +63 -14
  140. package/dist/office-js/proxy.d.mts +8 -0
  141. package/dist/office-js/proxy.mjs +29 -0
  142. package/dist/office-js/run.mjs +2 -0
  143. package/dist/office-js/supported.generated.mjs +16 -0
  144. package/dist/office-js/toApiScript.mjs +21 -5
  145. package/dist/opc/Load.d.mts +9 -2
  146. package/dist/opc/Save.d.mts +17 -0
  147. package/dist/opc/Save.mjs +12 -2
  148. package/dist/opc/index.d.mts +3 -3
  149. package/dist/opc/index.mjs +2 -2
  150. package/dist/opc/mce/preprocessor.d.mts +88 -7
  151. package/dist/opc/mce/preprocessor.mjs +144 -37
  152. package/dist/opc/mce/understood.d.mts +34 -0
  153. package/dist/opc/mce/understood.mjs +55 -3
  154. package/dist/packages/OpcPackage.d.mts +20 -0
  155. package/dist/packages/OpcPackage.mjs +16 -3
  156. package/dist/packages/WordprocessingMLPackage.d.mts +77 -7
  157. package/dist/packages/WordprocessingMLPackage.mjs +242 -11
  158. package/dist/parts/DefaultXmlPart.mjs +2 -2
  159. package/dist/parts/Part.d.mts +10 -2
  160. package/dist/parts/XmlPart.d.mts +35 -32
  161. package/dist/parts/XmlPart.mjs +107 -107
  162. package/dist/parts/wml/comments.mjs +30 -0
  163. package/dist/parts/wml/index.mjs +12 -0
  164. package/dist/xml/dom.d.mts +7 -0
  165. package/dist/xml/dom.mjs +18 -0
  166. package/package.json +2 -2
@@ -1,12 +1,13 @@
1
1
  import type * as wml from '@docx4j/generated-objects-ts/modules/org_docx4j_wml';
2
2
  import type { CellContext } from '../properties/table.mjs';
3
- import { type Element, W_NS, type TextSegment, type TextViewOptions } from './tree.mjs';
3
+ import { type Element, W_NS, type HiddenRuns, type SpanEdges, type SegmentOptions, type TextSegment, type TextViewOptions } from './tree.mjs';
4
4
  import { Font, type FontTracking } from './Font.mjs';
5
5
  import { Range } from './Range.mjs';
6
6
  import { type SearchOptions } from './search.mjs';
7
7
  import type { Body, BlockElement } from './Body.mjs';
8
8
  import { type TableCell } from './Table.mjs';
9
- import { ContentControl, type ContentControlType } from './ContentControl.mjs';
9
+ import { ContentControl, type ContentControlType, type ContentControlOptions } from './ContentControl.mjs';
10
+ import { type LineBreaks } from './officeText.mjs';
10
11
  import { InlinePicture, type InlinePictureOptions } from './InlinePicture.mjs';
11
12
  import { type CommentContent, type CommentOptions } from './comments.mjs';
12
13
  import type { Comment } from './Comment.mjs';
@@ -64,8 +65,23 @@ export declare class Paragraph {
64
65
  parentBody: Body);
65
66
  /** The paragraph value (docx4j: the P). */
66
67
  get p(): wml.P;
68
+ /** @internal A view of another paragraph of this one's body, for a `Range` across paragraphs (CR-014). */
69
+ viewOf(element: Element<wml.P>, container: Element[]): Paragraph;
70
+ /**
71
+ * @internal A range from this paragraph's start to the end of `last`, a later paragraph of the same story, with
72
+ * `last`'s mark where `mark` is set, or `endMark` in its place (CR-014 phase 1).
73
+ */
74
+ rangeTo(last: Paragraph, mark: boolean, endMark?: string): Range;
75
+ /** How many tables deep the paragraph is: 0 outside a table, 1 in a cell, 2 in a nested table's (Office JS `tableNestingLevel`). */
76
+ get tableNestingLevel(): number;
67
77
  get index(): number;
68
- /** The paragraph's text: runs joined, tabs as \t, breaks as \n; deleted text excluded. */
78
+ /**
79
+ * The paragraph's text as Office JS gives it in Word's default view (CR-012 phase 4, section 6.2):
80
+ * the accepted text, hidden text left out, in Word's characters (check 48: a note reference U+0002,
81
+ * a line break U+000B, a page break U+000C, a column break U+000E, a `w:cr` U+000D, the hyphens
82
+ * U+001E and U+001F, a symbol `(`, an equation as Word draws it). A kept `mc:AlternateContent`
83
+ * reads as its selected branch (check 49). Every offset a `Range` or `search` takes counts in it.
84
+ */
69
85
  get text(): string;
70
86
  /** Replaces the content with one run of the text, keeping the first run's formatting. */
71
87
  set text(value: string);
@@ -145,11 +161,12 @@ export declare class Paragraph {
145
161
  get outlineLevel(): number;
146
162
  set outlineLevel(level: number);
147
163
  /**
148
- * The runs' formatting: reads the first run's *effective* properties, writes direct
149
- * formatting to all (extension: `Font` is over runs, not the paragraph mark).
164
+ * The runs' formatting: reads the *effective* properties of the runs holding the paragraph's text, `null` (or `''`,
165
+ * `Mixed`) where they differ, and the mark's where it has no text, as Office JS reads them (CR-002 section 59); writes
166
+ * direct formatting to every run (extension: `Font` is over runs, not the paragraph mark).
150
167
  */
151
168
  get font(): Font;
152
- /** `font`, with `{ direct: true }` for the direct formatting of the first run (extension). */
169
+ /** `font`, with `{ direct: true }` for the runs' direct formatting (extension). */
153
170
  getFont(options?: FormattingOptions): Font;
154
171
  /** w14:paraId, the stable address Word gives paragraphs. */
155
172
  get paraId(): string | undefined;
@@ -160,12 +177,29 @@ export declare class Paragraph {
160
177
  get parentTableCell(): TableCell | undefined;
161
178
  /** The run-level content controls in this paragraph, in order, nested ones included. */
162
179
  get contentControls(): ContentControl[];
163
- /** The inline pictures in this paragraph, in order (Office JS Paragraph.inlinePictures). */
180
+ /**
181
+ * Office JS `getContentControls` (WordApi 1.5): the content controls `contentControls` lists, those of `options.types`
182
+ * where given. Word's `contentControls` lists rich-text controls only; this package's lists every kind, a recorded
183
+ * departure (CR-002 section 60 G1, check 55b), so this is how add-in code that asks for plain-text controls finds them.
184
+ */
185
+ getContentControls(options?: ContentControlOptions): ContentControl[];
186
+ /**
187
+ * The inline pictures in this paragraph, in order (Office JS Paragraph.inlinePictures): each
188
+ * `w:drawing` whose `wp:inline` holds a `pic:pic`, in a run or in the selected branch of a kept
189
+ * `mc:AlternateContent` (`picturesIn`). An inline chart, text box or group is not one (CR-010
190
+ * section 12.6).
191
+ */
164
192
  get inlinePictures(): InlinePicture[];
165
193
  /** Text inserted at the start, the end, or replacing the whole paragraph's text. */
166
194
  insertText(text: string, location: 'Start' | 'End' | 'Replace'): Range;
167
- /** A new paragraph of the text before or after this one, with this paragraph's properties (as Word). */
195
+ /**
196
+ * A new paragraph of the text before or after this one, with this paragraph's properties (as Word). Beside the only
197
+ * paragraph of a block control showing its placeholder it goes outside the control, as Word's went, and the control
198
+ * stays at block level (CR-002 section 63, D6 (b); check 63 cases 10, 11, 36 and 37).
199
+ */
168
200
  insertParagraph(text: string, location: 'Before' | 'After'): Paragraph;
201
+ /** The block-level control holding this paragraph directly while it shows its placeholder (CR-002 section 63). */
202
+ private get placeholderControl();
169
203
  insertBreak(type: 'Page' | 'Line', location: 'Before' | 'After' | 'Start' | 'End'): void;
170
204
  /**
171
205
  * Adds the image as a part of this paragraph's part, with a relationship, and shows it at the
@@ -198,22 +232,52 @@ export declare class Paragraph {
198
232
  replaceText(find: string, replace: string, options?: SearchOptions): number;
199
233
  /** The tracked changes in this paragraph, in document order (CR-002 phase F). */
200
234
  getTrackedChanges(): TrackedChange[];
235
+ /**
236
+ * The paragraph's range: 'Whole' and 'Content' hold its whole content, the pictures at its start and
237
+ * end among them, so deleting it deletes them (CR-002 section 48); 'Start' and 'End' are collapsed.
238
+ * 'Whole' holds the paragraph's mark too, so its `text` ends with `markText`, as Office JS's does
239
+ * (check 48); 'Content' ends with the paragraph's text.
240
+ */
201
241
  getRange(location?: 'Whole' | 'Start' | 'End' | 'Content'): Range;
242
+ /**
243
+ * The character Office JS gives for this paragraph's mark at the end of its 'Whole' range (check 48):
244
+ * `\t` for the last paragraph of a table cell, the cell's end; nothing for a mark tracked as deleted, which
245
+ * Word's default view doesn't show (CR-012 section 19, check 58); and `\r` for any other.
246
+ */
247
+ get markText(): string;
202
248
  /**
203
249
  * Removes the paragraph from its container. While the package tracks changes, the content
204
250
  * becomes a `w:del` and the mark is marked deleted (`w:pPr/w:rPr/w:del`) instead, unless the
205
251
  * whole paragraph was this author's own insertion, which Word simply takes back.
252
+ * The paragraph a table cell ends with, as Word reads it, stays where removing it would leave the
253
+ * cell without one, emptied, its properties kept; tracked, its mark is never marked deleted, as Word
254
+ * keeps a cell's last paragraph (check 52, cases 88 to 91; CR-002 section 55.6).
206
255
  */
207
256
  delete(): void;
257
+ /**
258
+ * `delete()`; with `keepCellEnd` false a cell's last paragraph goes as any other, for `Body.clearContent`'s
259
+ * callers, which put their own paragraph in next.
260
+ * @internal
261
+ */
262
+ remove(keepCellEnd: boolean): void;
263
+ /** Whether the cell this paragraph was in ends with a paragraph without it, as Word reads it (CR-002 section 55). */
264
+ private cellStillEnds;
208
265
  private trackedDelete;
209
266
  /**
210
267
  * The paragraph's content and its mark marked deleted, the paragraph element itself kept:
211
268
  * what the cells of a deleted table row need (a `w:tc` must keep a block-level child, and Word
212
269
  * writes `w:del` around every run and `w:pPr/w:rPr/w:del` on every mark inside a deleted row).
213
270
  * The same primitives `delete()` uses, without its "take back my own insertion" step.
214
- * Does nothing when the mark is already deleted.
271
+ * A mark already deleted is left as it is, and the text is deleted still: a paragraph another author's
272
+ * deletion ended keeps text a range's deletion across it must take (CR-014 phase 2).
215
273
  */
216
274
  markDeletedInPlace(tracker: ChangeTracker): void;
275
+ /**
276
+ * Queues the relationships that content removed outright referenced (a picture's image, a link's
277
+ * target), to be settled when the package is saved: each goes then if nothing references it, and
278
+ * its part with it when nothing else targets that (CR-002 sections 47 and 48).
279
+ */
280
+ releaseRelationships(removed: unknown): void;
217
281
  /** The paragraph as XML (extension; Office JS getOoxml wraps it in a package). */
218
282
  getXml(): Promise<string>;
219
283
  /** docx4j: the P's content list. */
@@ -253,15 +317,104 @@ export declare class Paragraph {
253
317
  get changeTracker(): ChangeTracker | undefined;
254
318
  /** What `Font` needs to write `w:rPrChange`: the tracker, and the runs that are our own insertion (`Range` shares it). */
255
319
  fontTracking(): FontTracking | undefined;
256
- /** The text segments (w:t, w:tab, ...) with their offsets. */
257
- segments(options?: TextViewOptions): TextSegment[];
320
+ /**
321
+ * The text segments (w:t, w:tab, ...) with their offsets in `text`; `{ objects: true }` adds the
322
+ * pictures and the hidden runs' items.
323
+ */
324
+ segments(options?: SegmentOptions): TextSegment[];
325
+ /**
326
+ * True for a paragraph in a text box (`w:txbxContent`), at a `textbox:` address (CR-012 D4). Such a view
327
+ * reads as any paragraph does and is read-only (D5): every write throws `NotSupportedError`.
328
+ */
329
+ get inTextBox(): boolean;
330
+ /**
331
+ * Refuses a write to a paragraph in a text box (CR-012 D5): a box is in each branch of its
332
+ * `mc:AlternateContent`, `wps:txbx` in the Choice and `v:textbox` in the Fallback, and nothing maps the
333
+ * one's paragraphs to the other's, so an edit could not reach every branch as CR-010's D2 has mutators do.
334
+ * And a write to a paragraph in a branch of a kept `mc:AlternateContent` at block, row or cell level
335
+ * (CR-013 D4), for the same reason. Internal: the content API's mutators call it first.
336
+ */
337
+ assertWritable(): void;
338
+ /**
339
+ * True for a paragraph in the selected branch of a kept `mc:AlternateContent` at block, row or cell
340
+ * level, which readers see as Word does (CR-013 phase 2). Such a view is read-only (D4).
341
+ */
342
+ get inBranch(): boolean;
343
+ /** Which of this paragraph's runs are hidden: a run's own `w:vanish`, else its styles' (CR-012 phase 4). */
344
+ hiddenRuns(): HiddenRuns;
258
345
  /**
259
346
  * Replaces the text in [start, end) with `text` and returns the range of the inserted text.
260
347
  * Runs are edited in place: a w:t loses or gains characters, a tab or break inside the range
261
348
  * is removed, a run left empty is removed. Text is inserted into the w:t at `start`,
262
349
  * else into a new run with the formatting of the nearest run.
350
+ *
351
+ * The pictures in the span go with its text: those strictly inside it, and those at an edge `edges`
352
+ * says the span holds (`WHOLE` for a paragraph's whole content), so a span of no text can still
353
+ * delete a picture (CR-002 section 48).
263
354
  */
264
- splice(start: number, end: number, text: string, prefer?: 'before' | 'after'): Range;
355
+ splice(start: number, end: number, text: string, prefer?: 'before' | 'after', edges?: SpanEdges, lineBreaks?: LineBreaks): Range;
356
+ /**
357
+ * The controls bound by `w:dataBinding` that [start, end) is in: those holding the paragraph, and the run-level ones
358
+ * holding text there.
359
+ */
360
+ private boundControlsAt;
361
+ /**
362
+ * @internal Text written at the paragraph's End by Office JS's routes to it: `insertText('End')`, its End range at any
363
+ * location, its Content range's End and After, and so a body's or a cell's `insertText('End')` (CR-002 sections 63.24
364
+ * to 63.27; checks 69 and 70). As Word writes it (D12): after everything the paragraph holds, into none of it - a
365
+ * run-level control, a link, a revision, a field, a bookmark's or a comment's markers, a text box - in a run of its
366
+ * own, or the last run extended. The text takes the last item's run properties where that item is a run holding text,
367
+ * so after a hidden run it is hidden and its range reads nothing (D13); otherwise it has none, and with `plain` (the End
368
+ * range's After, D14) none either. Word's proofing marks, `w:proofErr`, are no item (a choice: Word redoes them).
369
+ * Tracked, the run is a `w:ins`, or joins this author's own `w:ins` where one ends the paragraph. A line break makes
370
+ * paragraphs, as `splice` does (CR-002 section 60 E1); text so broken after a hidden run is written visible (a choice,
371
+ * unmeasured).
372
+ */
373
+ writeAtEnd(text: string, plain?: boolean): Range;
374
+ /**
375
+ * `items` put at `at` in `list` (its end by default): onto the end of `run`, which is in `list` right before `at`,
376
+ * merging into its last `w:t`, or as a new run in its properties where `run` is undefined. Returns the run written.
377
+ */
378
+ private appendTo;
379
+ /** `splice`'s write. */
380
+ private spliceWrite;
381
+ /**
382
+ * Text of several lines put in place of [start, end) as Word's insertText puts it (CR-002 section 60 E1): the lines'
383
+ * text, then a paragraph break after each line but the last, the paragraphs keeping this one's properties; tracked,
384
+ * each new mark inserted. Refused before anything changes where a paragraph can't be split there.
385
+ */
386
+ private spliceLines;
387
+ /** @internal Refuses, before anything changes, a paragraph break at `at` where none can be made (E1; `Range`'s Replace across paragraphs). */
388
+ assertBreakableAt(at: number, prefer: 'before' | 'after'): void;
389
+ /**
390
+ * The segment text put at `at` goes into, as `spliceText` chooses it: a replacement's, the one holding the first
391
+ * replaced character; else the one containing `at`, else the nearer neighbour.
392
+ */
393
+ private landingSegment;
394
+ /** The run-level content control a segment's run is in, the innermost, as a view; undefined for none. */
395
+ private runControlOf;
396
+ /** The block-level content control holding this paragraph directly, as a view; undefined for none. */
397
+ get blockControl(): ContentControl | undefined;
398
+ /**
399
+ * Refuses, before anything changes, a paragraph break where the text lands inside something a paragraph can't be
400
+ * split in: a content control, an equation, a kept mc:AlternateContent (CR-002 section 60 E1, as `splitParagraph`
401
+ * refuses one). A field's result is split: a complex field's runs across the paragraphs, a `w:fldSimple` made a
402
+ * complex field first (section 62.2 D1).
403
+ */
404
+ private assertBreakable;
405
+ /**
406
+ * The characters of [from, to) that are elements written as the elements they read as (CR-002 section 60 D1), each
407
+ * in its run where it stood: a w:t holding one is cut around it. Characters outside the span are left as they are.
408
+ */
409
+ private writeElements;
410
+ /**
411
+ * The first run's properties, for text with no run beside it to take its look from; none where that run is hidden,
412
+ * so that text put into a paragraph whose every run is hidden can be seen (CR-002 section 60: the text was hidden
413
+ * with it, so read as nothing, and its characters escaped the map).
414
+ */
415
+ private visibleFirstRunRPr;
416
+ /** `splice` before section 60: the text put in as it is, as one stretch of a w:t's text. */
417
+ private spliceText;
265
418
  /**
266
419
  * Inserts run-level items (runs, hyperlinks, content controls) at a text offset, splitting the
267
420
  * run there when the offset falls inside one. PARENT is linked on what is inserted.
@@ -269,6 +422,16 @@ export declare class Paragraph {
269
422
  insertItemsAt(offset: number, items: Element[]): void;
270
423
  /** Splits the run at a text offset so that [offset, ...) begins a run; returns nothing when the offset is already a boundary. */
271
424
  splitAt(offset: number): void;
425
+ /**
426
+ * Splits `seg`'s run so that the items of `owner` from `index` on begin a run of their own, behind it.
427
+ * `owner` is the run's content, or the selected branch of a run-level `mc:AlternateContent` in it
428
+ * (CR-012 section 12.2): a run holds the element whole, so the branch splits with it, as the editor's
429
+ * ED-009 section 3.4 has it. The first piece keeps the element, its other branches as they were; the
430
+ * second gets an element of its own, the same branches in the same order with the same `Requires`, the
431
+ * selected one holding the rest of its items and the others empty, so that a reader taking any branch
432
+ * takes the same one in both. The run's items after the element go with the second piece.
433
+ */
434
+ private splitRunAtItem;
272
435
  /**
273
436
  * Office JS `paragraph.isListItem`: whether Word paints a label in front of this paragraph.
274
437
  * The effective `w:numPr` decides it (docx4j `Emulator.numRefFor`), so a "List Number" style
@@ -317,9 +480,29 @@ export declare class Paragraph {
317
480
  * The text in [start, end) becomes a deletion: the runs holding it are isolated, their `w:t`
318
481
  * turned into `w:delText`, and each run of consecutive ones moved into one `w:del`. Text this
319
482
  * author had inserted is simply removed, as Word does, rather than nested in a `w:del`.
483
+ * The pictures in the span (`splice`'s `edges`) are deleted with the text, each in a run of its own
484
+ * where its run held more, as `InlinePicture.delete` gives it one (CR-002 section 48). An equation is deleted where
485
+ * it stands, in Word's form, a `w:del` in each math run and each structure's `m:ctrlPr` (`markEquationDeleted`;
486
+ * section 62.2 D2), the runs either side in `w:del`s of their own; one holding a revision of its own goes into the
487
+ * `w:del` whole, as every equation did before.
320
488
  * Returns the `w:del` elements it made, in document order.
321
489
  */
322
490
  private deleteText;
491
+ /**
492
+ * The run-level controls showing their placeholder that [start, end) holds whole: where the walk passes one strictly
493
+ * inside the span, or at an edge `edges` says it holds. A placeholder is no text, so such a control has no width
494
+ * (CR-002 section 63, D3).
495
+ */
496
+ private placeholderControlsIn;
497
+ /**
498
+ * The runs of comments' references in [start, end): each a run holding nothing but a reference, where the walk
499
+ * passes it, strictly inside the span or at an edge `edges` says it holds. A reference has no text, so a
500
+ * deletion's segments never held it, and a comment whose reference a deletion took stayed. Word's deletion takes
501
+ * it with the text (check 54 cases 27 and 28; CR-014 section 12.6).
502
+ */
503
+ private commentReferencesIn;
504
+ /** A comment queued to go when the package is saved, its markers, replies and entries with it, as a resolution queues one. */
505
+ private queueCommentRemoval;
323
506
  /**
324
507
  * Splits the revision that holds the text at `at` into two - the second half a copy of its
325
508
  * attributes under a new `w:id` - and puts `item` between them. Word splits a revision so when
@@ -361,15 +544,31 @@ export declare class Paragraph {
361
544
  * are split there: never inside another's revision.
362
545
  */
363
546
  private placeInsertion;
547
+ /**
548
+ * Splits runs so that every run holding text in [start, end) holds nothing else (internal: what a
549
+ * `Range.font` write formats). A kept `mc:AlternateContent`'s branch splits with its run (section 12.2).
550
+ */
551
+ splitRunsAround(start: number, end: number): void;
364
552
  /**
365
553
  * Splits runs so that every run holding text in [start, end) holds nothing else, and returns
366
554
  * the segments inside the span. `splitAt` does the `w:t` boundaries; this also moves the items
367
555
  * of a run that straddles a boundary (a tab, a break, a drawing) out into runs of their own.
556
+ * The pictures in the span (`splice`'s `edges`) are among the segments returned, and a run
557
+ * holding one holds nothing outside the span either.
368
558
  */
369
559
  private isolate;
370
- /** Moves the items before `seg` into a run of their own, in front of `seg`'s run. */
560
+ /**
561
+ * Refuses an edit that would cut an equation (CR-012 phase 4). Its text is one segment, Word's drawing of
562
+ * its math runs (`mathTextOf`), so an edit may take it whole but not part of it, nor insert into it. Under change
563
+ * tracking a deletion takes it whole in Word's form (`deleteText`, CR-002 section 62.2 D2, check 57), and a
564
+ * replacement doesn't take it at all: where Word puts the new text beside a deleted equation isn't measured. Since
565
+ * phase 4 every other offset is a place in the runs: `text` is the segments' text, where before it was the objects
566
+ * package's `textOf` and section 12.4 refused an offset past a kept `mc:AlternateContent` among the runs.
567
+ */
568
+ private assertPlaceable;
569
+ /** Moves the items before `seg` into a run of their own, in front of the rest; false where there are none. */
371
570
  private splitRunBefore;
372
- /** Moves the items after `seg` into a run of their own, behind `seg`'s run. */
571
+ /** Moves the items after `seg` into a run of their own, behind it; false where there are none. */
373
572
  private splitRunAfter;
374
573
  }
375
574
  type RevisionHolderOf = NonNullable<TextSegment['revision']>;