@docx4j/core-ts 0.5.0 → 0.7.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 (207) hide show
  1. package/NOTICE +4 -0
  2. package/README.md +92 -4
  3. package/dist/html/convert.mjs +2 -1
  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 +145 -23
  24. package/dist/model/content/Body.mjs +507 -150
  25. package/dist/model/content/Comment.d.mts +23 -5
  26. package/dist/model/content/Comment.mjs +207 -26
  27. package/dist/model/content/ContentControl.d.mts +198 -19
  28. package/dist/model/content/ContentControl.mjs +672 -99
  29. package/dist/model/content/Font.d.mts +70 -17
  30. package/dist/model/content/Font.mjs +119 -36
  31. package/dist/model/content/InlinePicture.d.mts +11 -0
  32. package/dist/model/content/InlinePicture.mjs +21 -1
  33. package/dist/model/content/List.d.mts +6 -3
  34. package/dist/model/content/List.mjs +18 -8
  35. package/dist/model/content/Paragraph.d.mts +200 -14
  36. package/dist/model/content/Paragraph.mjs +898 -82
  37. package/dist/model/content/Range.d.mts +227 -12
  38. package/dist/model/content/Range.mjs +785 -59
  39. package/dist/model/content/ResolvedView.d.mts +104 -0
  40. package/dist/model/content/ResolvedView.mjs +596 -0
  41. package/dist/model/content/Table.d.mts +29 -3
  42. package/dist/model/content/Table.mjs +135 -49
  43. package/dist/model/content/TrackedChange.d.mts +174 -15
  44. package/dist/model/content/TrackedChange.mjs +734 -170
  45. package/dist/model/content/comments.d.mts +20 -6
  46. package/dist/model/content/comments.mjs +67 -57
  47. package/dist/model/content/generalException.d.mts +18 -0
  48. package/dist/model/content/generalException.mjs +24 -0
  49. package/dist/model/content/index.d.mts +10 -3
  50. package/dist/model/content/index.mjs +10 -2
  51. package/dist/model/content/mathText.d.mts +21 -0
  52. package/dist/model/content/mathText.mjs +267 -0
  53. package/dist/model/content/officeText.d.mts +27 -0
  54. package/dist/model/content/officeText.mjs +74 -0
  55. package/dist/model/content/ooxml.mjs +12 -1
  56. package/dist/model/content/outline.d.mts +5 -0
  57. package/dist/model/content/outline.mjs +13 -0
  58. package/dist/model/content/paraIds.d.mts +5 -0
  59. package/dist/model/content/paraIds.mjs +54 -0
  60. package/dist/model/content/placeholders.d.mts +110 -0
  61. package/dist/model/content/placeholders.mjs +253 -0
  62. package/dist/model/content/search.d.mts +74 -0
  63. package/dist/model/content/search.mjs +255 -9
  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 +47 -0
  67. package/dist/model/content/story.mjs +95 -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 +102 -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 +63 -6
  79. package/dist/model/content/tracking.mjs +242 -22
  80. package/dist/model/content/tree.d.mts +172 -24
  81. package/dist/model/content/tree.mjs +328 -54
  82. package/dist/model/content/wordRange.d.mts +48 -0
  83. package/dist/model/content/wordRange.mjs +97 -0
  84. package/dist/model/customxml/CustomXmlPartCollection.d.mts +30 -1
  85. package/dist/model/customxml/CustomXmlPartCollection.mjs +81 -12
  86. package/dist/model/customxml/XmlMapping.d.mts +32 -8
  87. package/dist/model/customxml/XmlMapping.mjs +64 -10
  88. package/dist/model/customxml/bindings.d.mts +33 -4
  89. package/dist/model/customxml/bindings.mjs +171 -45
  90. package/dist/model/customxml/index.d.mts +1 -0
  91. package/dist/model/customxml/index.mjs +1 -0
  92. package/dist/model/customxml/kinds.d.mts +8 -3
  93. package/dist/model/customxml/kinds.mjs +26 -5
  94. package/dist/model/customxml/opendope.d.mts +4 -1
  95. package/dist/model/customxml/opendope.mjs +9 -6
  96. package/dist/model/customxml/picturePlaceholder.d.mts +17 -0
  97. package/dist/model/customxml/picturePlaceholder.mjs +32 -0
  98. package/dist/model/customxml/pictures.d.mts +4 -3
  99. package/dist/model/customxml/pictures.mjs +22 -8
  100. package/dist/model/customxml/storeItems.d.mts +57 -0
  101. package/dist/model/customxml/storeItems.mjs +122 -0
  102. package/dist/model/customxml/xhtml.mjs +23 -22
  103. package/dist/model/dateZone.d.mts +25 -0
  104. package/dist/model/dateZone.mjs +57 -0
  105. package/dist/model/index.d.mts +3 -0
  106. package/dist/model/index.mjs +5 -0
  107. package/dist/model/listnumbering/Emulator.d.mts +37 -5
  108. package/dist/model/listnumbering/Emulator.mjs +63 -9
  109. package/dist/model/properties/PropertyResolver.d.mts +74 -2
  110. package/dist/model/properties/PropertyResolver.mjs +133 -5
  111. package/dist/model/properties/catalogue.d.mts +19 -5
  112. package/dist/model/properties/catalogue.mjs +41 -15
  113. package/dist/model/properties/index.d.mts +1 -1
  114. package/dist/model/properties/log.d.mts +1 -1
  115. package/dist/model/properties/log.mjs +5 -5
  116. package/dist/model/properties/styleUtil.d.mts +3 -1
  117. package/dist/model/properties/styleUtil.mjs +20 -24
  118. package/dist/model/properties/table.mjs +4 -2
  119. package/dist/model/text/CaseMapping.d.mts +38 -0
  120. package/dist/model/text/CaseMapping.mjs +86 -0
  121. package/dist/model/text/Extractor.d.mts +349 -0
  122. package/dist/model/text/Extractor.mjs +2406 -0
  123. package/dist/model/text/LinkTargets.d.mts +45 -0
  124. package/dist/model/text/LinkTargets.mjs +170 -0
  125. package/dist/model/text/MarkdownExporter.d.mts +140 -0
  126. package/dist/model/text/MarkdownExporter.mjs +255 -0
  127. package/dist/model/text/PlainText.d.mts +29 -0
  128. package/dist/model/text/PlainText.mjs +542 -0
  129. package/dist/model/text/TextContext.d.mts +256 -0
  130. package/dist/model/text/TextContext.mjs +600 -0
  131. package/dist/model/text/TextOptions.d.mts +233 -0
  132. package/dist/model/text/TextOptions.mjs +419 -0
  133. package/dist/model/text/TextResult.d.mts +621 -0
  134. package/dist/model/text/TextResult.mjs +629 -0
  135. package/dist/model/text/Texts.d.mts +99 -0
  136. package/dist/model/text/Texts.mjs +187 -0
  137. package/dist/model/text/WmlToMarkdown.d.mts +120 -0
  138. package/dist/model/text/WmlToMarkdown.mjs +936 -0
  139. package/dist/model/text/caseMapping.generated.d.mts +7 -0
  140. package/dist/model/text/caseMapping.generated.mjs +214 -0
  141. package/dist/model/text/commonmark.d.mts +121 -0
  142. package/dist/model/text/commonmark.mjs +655 -0
  143. package/dist/model/text/index.d.mts +8 -0
  144. package/dist/model/text/index.mjs +9 -0
  145. package/dist/model/text/normalize.d.mts +8 -0
  146. package/dist/model/text/normalize.mjs +13 -0
  147. package/dist/model/text/outline.d.mts +4 -0
  148. package/dist/model/text/outline.mjs +71 -0
  149. package/dist/model/wordIntegers.d.mts +29 -0
  150. package/dist/model/wordIntegers.mjs +78 -0
  151. package/dist/office-js/document.mjs +15 -1
  152. package/dist/office-js/fragment.d.mts +7 -5
  153. package/dist/office-js/fragment.mjs +63 -14
  154. package/dist/office-js/proxy.d.mts +8 -0
  155. package/dist/office-js/proxy.mjs +29 -0
  156. package/dist/office-js/run.mjs +2 -0
  157. package/dist/office-js/supported.generated.mjs +16 -0
  158. package/dist/office-js/toApiScript.mjs +29 -12
  159. package/dist/opc/DirectoryPartStore.d.mts +6 -2
  160. package/dist/opc/DirectoryPartStore.mjs +11 -4
  161. package/dist/opc/FlatOpcPartStore.d.mts +4 -2
  162. package/dist/opc/FlatOpcPartStore.mjs +11 -8
  163. package/dist/opc/Load.d.mts +32 -0
  164. package/dist/opc/Load.mjs +115 -5
  165. package/dist/opc/PartStore.d.mts +34 -1
  166. package/dist/opc/PartStore.mjs +71 -8
  167. package/dist/opc/Save.d.mts +32 -0
  168. package/dist/opc/Save.mjs +110 -4
  169. package/dist/opc/ZipPartStore.d.mts +4 -2
  170. package/dist/opc/ZipPartStore.mjs +12 -7
  171. package/dist/opc/exceptions.d.mts +140 -0
  172. package/dist/opc/exceptions.mjs +108 -0
  173. package/dist/opc/index.d.mts +8 -5
  174. package/dist/opc/index.mjs +5 -3
  175. package/dist/opc/mce/preprocessor.d.mts +141 -5
  176. package/dist/opc/mce/preprocessor.mjs +119 -18
  177. package/dist/opc/mce/understood.d.mts +3 -11
  178. package/dist/opc/mce/understood.mjs +27 -23
  179. package/dist/opc/repair/breaks.d.mts +23 -0
  180. package/dist/opc/repair/breaks.mjs +288 -0
  181. package/dist/opc/repair/hosts.d.mts +12 -0
  182. package/dist/opc/repair/hosts.mjs +33 -0
  183. package/dist/opc/repair/mainRoot.d.mts +19 -0
  184. package/dist/opc/repair/mainRoot.mjs +168 -0
  185. package/dist/opc/repair/unknownElements.d.mts +8 -0
  186. package/dist/opc/repair/unknownElements.mjs +180 -0
  187. package/dist/opc/repair/wmlNames.generated.d.mts +2 -0
  188. package/dist/opc/repair/wmlNames.generated.mjs +80 -0
  189. package/dist/opc/skipped.d.mts +50 -0
  190. package/dist/opc/skipped.mjs +140 -0
  191. package/dist/packages/OpcPackage.d.mts +110 -4
  192. package/dist/packages/OpcPackage.mjs +123 -7
  193. package/dist/packages/WordprocessingMLPackage.d.mts +45 -8
  194. package/dist/packages/WordprocessingMLPackage.mjs +158 -21
  195. package/dist/packages/index.d.mts +1 -1
  196. package/dist/parts/DefaultXmlPart.mjs +2 -2
  197. package/dist/parts/Part.d.mts +14 -2
  198. package/dist/parts/RelationshipsPart.d.mts +15 -0
  199. package/dist/parts/RelationshipsPart.mjs +66 -1
  200. package/dist/parts/XmlPart.d.mts +63 -32
  201. package/dist/parts/XmlPart.mjs +240 -96
  202. package/dist/parts/wml/comments.mjs +30 -0
  203. package/dist/parts/wml/index.d.mts +12 -1
  204. package/dist/parts/wml/index.mjs +37 -1
  205. package/dist/xml/dom.d.mts +7 -0
  206. package/dist/xml/dom.mjs +18 -0
  207. 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 SpanEdges, type SegmentOptions, 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);
@@ -126,7 +142,11 @@ export declare class Paragraph {
126
142
  * hold for any value. Undefined without a resolver, where the value is written as asked.
127
143
  */
128
144
  private inheritedAlignment;
129
- /** Indents and spacing in points, as Office JS; the effective values (CR-001 Phase B step 2). */
145
+ /**
146
+ * Indents and spacing in points, as Office JS; the effective values (CR-001 Phase B step 2). A value written is held to
147
+ * the range Word 365 stores its attribute in (`withinWord`, CR-002 section 65): outside it, `InvalidArgument`, before
148
+ * anything changes.
149
+ */
130
150
  get leftIndent(): number;
131
151
  set leftIndent(pt: number);
132
152
  get rightIndent(): number;
@@ -140,16 +160,22 @@ export declare class Paragraph {
140
160
  set spaceAfter(pt: number);
141
161
  /** Line spacing in points: w:line/240 lines of 12pt when the rule is auto, else w:line twips; 0 when not set. */
142
162
  get lineSpacing(): number;
163
+ /**
164
+ * Writes `w:line` as 20 × points under `w:lineRule="auto"`, as Word 365's own setter does (check 71b: 0.75 pt as
165
+ * `w:line="15" w:lineRule="auto"`; Office JS: "in the Word UI, this value is divided by 12", so 12 pt is single spacing),
166
+ * within Word's own limits, 0.75 to 1584 pt (CR-002 section 65.9). Until check 71b it wrote an exact rule.
167
+ */
143
168
  set lineSpacing(pt: number);
144
169
  /** w:outlineLvl + 1 (1 to 9); 10 for body text, as Office JS. A heading style supplies it. */
145
170
  get outlineLevel(): number;
146
171
  set outlineLevel(level: number);
147
172
  /**
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).
173
+ * The runs' formatting: reads the *effective* properties of the runs holding the paragraph's text, `null` (or `''`,
174
+ * `Mixed`) where they differ, and the mark's where it has no text, as Office JS reads them (CR-002 section 59); writes
175
+ * direct formatting to every run (extension: `Font` is over runs, not the paragraph mark).
150
176
  */
151
177
  get font(): Font;
152
- /** `font`, with `{ direct: true }` for the direct formatting of the first run (extension). */
178
+ /** `font`, with `{ direct: true }` for the runs' direct formatting (extension). */
153
179
  getFont(options?: FormattingOptions): Font;
154
180
  /** w14:paraId, the stable address Word gives paragraphs. */
155
181
  get paraId(): string | undefined;
@@ -160,6 +186,12 @@ export declare class Paragraph {
160
186
  get parentTableCell(): TableCell | undefined;
161
187
  /** The run-level content controls in this paragraph, in order, nested ones included. */
162
188
  get contentControls(): ContentControl[];
189
+ /**
190
+ * Office JS `getContentControls` (WordApi 1.5): the content controls `contentControls` lists, those of `options.types`
191
+ * where given. Word's `contentControls` lists rich-text controls only; this package's lists every kind, a recorded
192
+ * departure (CR-002 section 60 G1, check 55b), so this is how add-in code that asks for plain-text controls finds them.
193
+ */
194
+ getContentControls(options?: ContentControlOptions): ContentControl[];
163
195
  /**
164
196
  * The inline pictures in this paragraph, in order (Office JS Paragraph.inlinePictures): each
165
197
  * `w:drawing` whose `wp:inline` holds a `pic:pic`, in a run or in the selected branch of a kept
@@ -169,8 +201,14 @@ export declare class Paragraph {
169
201
  get inlinePictures(): InlinePicture[];
170
202
  /** Text inserted at the start, the end, or replacing the whole paragraph's text. */
171
203
  insertText(text: string, location: 'Start' | 'End' | 'Replace'): Range;
172
- /** A new paragraph of the text before or after this one, with this paragraph's properties (as Word). */
204
+ /**
205
+ * A new paragraph of the text before or after this one, with this paragraph's properties (as Word). Beside the only
206
+ * paragraph of a block control showing its placeholder it goes outside the control, as Word's went, and the control
207
+ * stays at block level (CR-002 section 63, D6 (b); check 63 cases 10, 11, 36 and 37).
208
+ */
173
209
  insertParagraph(text: string, location: 'Before' | 'After'): Paragraph;
210
+ /** The block-level control holding this paragraph directly while it shows its placeholder (CR-002 section 63). */
211
+ private get placeholderControl();
174
212
  insertBreak(type: 'Page' | 'Line', location: 'Before' | 'After' | 'Start' | 'End'): void;
175
213
  /**
176
214
  * Adds the image as a part of this paragraph's part, with a relationship, and shows it at the
@@ -206,21 +244,42 @@ export declare class Paragraph {
206
244
  /**
207
245
  * The paragraph's range: 'Whole' and 'Content' hold its whole content, the pictures at its start and
208
246
  * end among them, so deleting it deletes them (CR-002 section 48); 'Start' and 'End' are collapsed.
247
+ * 'Whole' holds the paragraph's mark too, so its `text` ends with `markText`, as Office JS's does
248
+ * (check 48); 'Content' ends with the paragraph's text.
209
249
  */
210
250
  getRange(location?: 'Whole' | 'Start' | 'End' | 'Content'): Range;
251
+ /**
252
+ * The character Office JS gives for this paragraph's mark at the end of its 'Whole' range (check 48):
253
+ * `\t` for the last paragraph of a table cell, the cell's end; nothing for a mark tracked as deleted, which
254
+ * Word's default view doesn't show (CR-012 section 19, check 58), or as moved from, as the paragraph's runs read
255
+ * (CR-002 section 64); and `\r` for any other.
256
+ */
257
+ get markText(): string;
211
258
  /**
212
259
  * Removes the paragraph from its container. While the package tracks changes, the content
213
260
  * becomes a `w:del` and the mark is marked deleted (`w:pPr/w:rPr/w:del`) instead, unless the
214
261
  * whole paragraph was this author's own insertion, which Word simply takes back.
262
+ * The paragraph a table cell ends with, as Word reads it, stays where removing it would leave the
263
+ * cell without one, emptied, its properties kept; tracked, its mark is never marked deleted, as Word
264
+ * keeps a cell's last paragraph (check 52, cases 88 to 91; CR-002 section 55.6).
215
265
  */
216
266
  delete(): void;
267
+ /**
268
+ * `delete()`; with `keepCellEnd` false a cell's last paragraph goes as any other, for `Body.clearContent`'s
269
+ * callers, which put their own paragraph in next.
270
+ * @internal
271
+ */
272
+ remove(keepCellEnd: boolean): void;
273
+ /** Whether the cell this paragraph was in ends with a paragraph without it, as Word reads it (CR-002 section 55). */
274
+ private cellStillEnds;
217
275
  private trackedDelete;
218
276
  /**
219
277
  * The paragraph's content and its mark marked deleted, the paragraph element itself kept:
220
278
  * what the cells of a deleted table row need (a `w:tc` must keep a block-level child, and Word
221
279
  * writes `w:del` around every run and `w:pPr/w:rPr/w:del` on every mark inside a deleted row).
222
280
  * The same primitives `delete()` uses, without its "take back my own insertion" step.
223
- * Does nothing when the mark is already deleted.
281
+ * A mark already deleted is left as it is, and the text is deleted still: a paragraph another author's
282
+ * deletion ended keeps text a range's deletion across it must take (CR-014 phase 2).
224
283
  */
225
284
  markDeletedInPlace(tracker: ChangeTracker): void;
226
285
  /**
@@ -268,8 +327,31 @@ export declare class Paragraph {
268
327
  get changeTracker(): ChangeTracker | undefined;
269
328
  /** What `Font` needs to write `w:rPrChange`: the tracker, and the runs that are our own insertion (`Range` shares it). */
270
329
  fontTracking(): FontTracking | undefined;
271
- /** The text segments (w:t, w:tab, ...) with their offsets; `{ objects: true }` adds the pictures. */
330
+ /**
331
+ * The text segments (w:t, w:tab, ...) with their offsets in `text`; `{ objects: true }` adds the
332
+ * pictures and the hidden runs' items.
333
+ */
272
334
  segments(options?: SegmentOptions): TextSegment[];
335
+ /**
336
+ * True for a paragraph in a text box (`w:txbxContent`), at a `textbox:` address (CR-012 D4). Such a view
337
+ * reads as any paragraph does and is read-only (D5): every write throws `NotSupportedError`.
338
+ */
339
+ get inTextBox(): boolean;
340
+ /**
341
+ * Refuses a write to a paragraph in a text box (CR-012 D5): a box is in each branch of its
342
+ * `mc:AlternateContent`, `wps:txbx` in the Choice and `v:textbox` in the Fallback, and nothing maps the
343
+ * one's paragraphs to the other's, so an edit could not reach every branch as CR-010's D2 has mutators do.
344
+ * And a write to a paragraph in a branch of a kept `mc:AlternateContent` at block, row or cell level
345
+ * (CR-013 D4), for the same reason. Internal: the content API's mutators call it first.
346
+ */
347
+ assertWritable(): void;
348
+ /**
349
+ * True for a paragraph in the selected branch of a kept `mc:AlternateContent` at block, row or cell
350
+ * level, which readers see as Word does (CR-013 phase 2). Such a view is read-only (D4).
351
+ */
352
+ get inBranch(): boolean;
353
+ /** Which of this paragraph's runs are hidden: a run's own `w:vanish`, else its styles' (CR-012 phase 4). */
354
+ hiddenRuns(): HiddenRuns;
273
355
  /**
274
356
  * Replaces the text in [start, end) with `text` and returns the range of the inserted text.
275
357
  * Runs are edited in place: a w:t loses or gains characters, a tab or break inside the range
@@ -280,7 +362,69 @@ export declare class Paragraph {
280
362
  * says the span holds (`WHOLE` for a paragraph's whole content), so a span of no text can still
281
363
  * delete a picture (CR-002 section 48).
282
364
  */
283
- splice(start: number, end: number, text: string, prefer?: 'before' | 'after', edges?: SpanEdges): Range;
365
+ splice(start: number, end: number, text: string, prefer?: 'before' | 'after', edges?: SpanEdges, lineBreaks?: LineBreaks): Range;
366
+ /**
367
+ * The controls bound by `w:dataBinding` that [start, end) is in: those holding the paragraph, and the run-level ones
368
+ * holding text there.
369
+ */
370
+ private boundControlsAt;
371
+ /**
372
+ * @internal Text written at the paragraph's End by Office JS's routes to it: `insertText('End')`, its End range at any
373
+ * location, its Content range's End and After, and so a body's or a cell's `insertText('End')` (CR-002 sections 63.24
374
+ * to 63.27; checks 69 and 70). As Word writes it (D12): after everything the paragraph holds, into none of it - a
375
+ * 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
376
+ * own, or the last run extended. The text takes the last item's run properties where that item is a run holding text,
377
+ * so after a hidden run it is hidden and its range reads nothing (D13); otherwise it has none, and with `plain` (the End
378
+ * range's After, D14) none either. Word's proofing marks, `w:proofErr`, are no item (a choice: Word redoes them).
379
+ * Tracked, the run is a `w:ins`, or joins this author's own `w:ins` where one ends the paragraph. A line break makes
380
+ * paragraphs, as `splice` does (CR-002 section 60 E1); text so broken after a hidden run is written visible (a choice,
381
+ * unmeasured).
382
+ */
383
+ writeAtEnd(text: string, plain?: boolean): Range;
384
+ /**
385
+ * `items` put at `at` in `list` (its end by default): onto the end of `run`, which is in `list` right before `at`,
386
+ * merging into its last `w:t`, or as a new run in its properties where `run` is undefined. Returns the run written.
387
+ */
388
+ private appendTo;
389
+ /** `splice`'s write. */
390
+ private spliceWrite;
391
+ /**
392
+ * Text of several lines put in place of [start, end) as Word's insertText puts it (CR-002 section 60 E1): the lines'
393
+ * text, then a paragraph break after each line but the last, the paragraphs keeping this one's properties; tracked,
394
+ * each new mark inserted. Refused before anything changes where a paragraph can't be split there.
395
+ */
396
+ private spliceLines;
397
+ /** @internal Refuses, before anything changes, a paragraph break at `at` where none can be made (E1; `Range`'s Replace across paragraphs). */
398
+ assertBreakableAt(at: number, prefer: 'before' | 'after'): void;
399
+ /**
400
+ * The segment text put at `at` goes into, as `spliceText` chooses it: a replacement's, the one holding the first
401
+ * replaced character; else the one containing `at`, else the nearer neighbour.
402
+ */
403
+ private landingSegment;
404
+ /** The run-level content control a segment's run is in, the innermost, as a view; undefined for none. */
405
+ private runControlOf;
406
+ /** The block-level content control holding this paragraph directly, as a view; undefined for none. */
407
+ get blockControl(): ContentControl | undefined;
408
+ /**
409
+ * Refuses, before anything changes, a paragraph break where the text lands inside something a paragraph can't be
410
+ * split in: a content control, an equation, a kept mc:AlternateContent (CR-002 section 60 E1, as `splitParagraph`
411
+ * refuses one). A field's result is split: a complex field's runs across the paragraphs, a `w:fldSimple` made a
412
+ * complex field first (section 62.2 D1).
413
+ */
414
+ private assertBreakable;
415
+ /**
416
+ * The characters of [from, to) that are elements written as the elements they read as (CR-002 section 60 D1), each
417
+ * in its run where it stood: a w:t holding one is cut around it. Characters outside the span are left as they are.
418
+ */
419
+ private writeElements;
420
+ /**
421
+ * The first run's properties, for text with no run beside it to take its look from; none where that run is hidden,
422
+ * so that text put into a paragraph whose every run is hidden can be seen (CR-002 section 60: the text was hidden
423
+ * with it, so read as nothing, and its characters escaped the map).
424
+ */
425
+ private visibleFirstRunRPr;
426
+ /** `splice` before section 60: the text put in as it is, as one stretch of a w:t's text. */
427
+ private spliceText;
284
428
  /**
285
429
  * Inserts run-level items (runs, hyperlinks, content controls) at a text offset, splitting the
286
430
  * run there when the offset falls inside one. PARENT is linked on what is inserted.
@@ -288,6 +432,16 @@ export declare class Paragraph {
288
432
  insertItemsAt(offset: number, items: Element[]): void;
289
433
  /** Splits the run at a text offset so that [offset, ...) begins a run; returns nothing when the offset is already a boundary. */
290
434
  splitAt(offset: number): void;
435
+ /**
436
+ * Splits `seg`'s run so that the items of `owner` from `index` on begin a run of their own, behind it.
437
+ * `owner` is the run's content, or the selected branch of a run-level `mc:AlternateContent` in it
438
+ * (CR-012 section 12.2): a run holds the element whole, so the branch splits with it, as the editor's
439
+ * ED-009 section 3.4 has it. The first piece keeps the element, its other branches as they were; the
440
+ * second gets an element of its own, the same branches in the same order with the same `Requires`, the
441
+ * selected one holding the rest of its items and the others empty, so that a reader taking any branch
442
+ * takes the same one in both. The run's items after the element go with the second piece.
443
+ */
444
+ private splitRunAtItem;
291
445
  /**
292
446
  * Office JS `paragraph.isListItem`: whether Word paints a label in front of this paragraph.
293
447
  * The effective `w:numPr` decides it (docx4j `Emulator.numRefFor`), so a "List Number" style
@@ -337,10 +491,28 @@ export declare class Paragraph {
337
491
  * turned into `w:delText`, and each run of consecutive ones moved into one `w:del`. Text this
338
492
  * author had inserted is simply removed, as Word does, rather than nested in a `w:del`.
339
493
  * The pictures in the span (`splice`'s `edges`) are deleted with the text, each in a run of its own
340
- * where its run held more, as `InlinePicture.delete` gives it one (CR-002 section 48).
494
+ * where its run held more, as `InlinePicture.delete` gives it one (CR-002 section 48). An equation is deleted where
495
+ * it stands, in Word's form, a `w:del` in each math run and each structure's `m:ctrlPr` (`markEquationDeleted`;
496
+ * 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
497
+ * `w:del` whole, as every equation did before.
341
498
  * Returns the `w:del` elements it made, in document order.
342
499
  */
343
500
  private deleteText;
501
+ /**
502
+ * The run-level controls showing their placeholder that [start, end) holds whole: where the walk passes one strictly
503
+ * inside the span, or at an edge `edges` says it holds. A placeholder is no text, so such a control has no width
504
+ * (CR-002 section 63, D3).
505
+ */
506
+ private placeholderControlsIn;
507
+ /**
508
+ * The runs of comments' references in [start, end): each a run holding nothing but a reference, where the walk
509
+ * passes it, strictly inside the span or at an edge `edges` says it holds. A reference has no text, so a
510
+ * deletion's segments never held it, and a comment whose reference a deletion took stayed. Word's deletion takes
511
+ * it with the text (check 54 cases 27 and 28; CR-014 section 12.6).
512
+ */
513
+ private commentReferencesIn;
514
+ /** A comment queued to go when the package is saved, its markers, replies and entries with it, as a resolution queues one. */
515
+ private queueCommentRemoval;
344
516
  /**
345
517
  * Splits the revision that holds the text at `at` into two - the second half a copy of its
346
518
  * attributes under a new `w:id` - and puts `item` between them. Word splits a revision so when
@@ -382,6 +554,11 @@ export declare class Paragraph {
382
554
  * are split there: never inside another's revision.
383
555
  */
384
556
  private placeInsertion;
557
+ /**
558
+ * Splits runs so that every run holding text in [start, end) holds nothing else (internal: what a
559
+ * `Range.font` write formats). A kept `mc:AlternateContent`'s branch splits with its run (section 12.2).
560
+ */
561
+ splitRunsAround(start: number, end: number): void;
385
562
  /**
386
563
  * Splits runs so that every run holding text in [start, end) holds nothing else, and returns
387
564
  * the segments inside the span. `splitAt` does the `w:t` boundaries; this also moves the items
@@ -390,9 +567,18 @@ export declare class Paragraph {
390
567
  * holding one holds nothing outside the span either.
391
568
  */
392
569
  private isolate;
393
- /** Moves the items before `seg` into a run of their own, in front of `seg`'s run. */
570
+ /**
571
+ * Refuses an edit that would cut an equation (CR-012 phase 4). Its text is one segment, Word's drawing of
572
+ * its math runs (`mathTextOf`), so an edit may take it whole but not part of it, nor insert into it. Under change
573
+ * tracking a deletion takes it whole in Word's form (`deleteText`, CR-002 section 62.2 D2, check 57), and a
574
+ * replacement doesn't take it at all: where Word puts the new text beside a deleted equation isn't measured. Since
575
+ * phase 4 every other offset is a place in the runs: `text` is the segments' text, where before it was the objects
576
+ * package's `textOf` and section 12.4 refused an offset past a kept `mc:AlternateContent` among the runs.
577
+ */
578
+ private assertPlaceable;
579
+ /** Moves the items before `seg` into a run of their own, in front of the rest; false where there are none. */
394
580
  private splitRunBefore;
395
- /** Moves the items after `seg` into a run of their own, behind `seg`'s run. */
581
+ /** Moves the items after `seg` into a run of their own, behind it; false where there are none. */
396
582
  private splitRunAfter;
397
583
  }
398
584
  type RevisionHolderOf = NonNullable<TextSegment['revision']>;