@docx4j/core-ts 0.1.0 → 0.1.2

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 (172) hide show
  1. package/README.md +410 -10
  2. package/dist/model/content/Body.d.mts +109 -4
  3. package/dist/model/content/Body.mjs +300 -29
  4. package/dist/model/content/Comment.d.mts +78 -0
  5. package/dist/model/content/Comment.mjs +429 -0
  6. package/dist/model/content/ContentControl.d.mts +173 -0
  7. package/dist/model/content/ContentControl.mjs +638 -0
  8. package/dist/model/content/Font.d.mts +48 -8
  9. package/dist/model/content/Font.mjs +55 -13
  10. package/dist/model/content/InlinePicture.d.mts +103 -0
  11. package/dist/model/content/InlinePicture.mjs +361 -0
  12. package/dist/model/content/List.d.mts +253 -0
  13. package/dist/model/content/List.mjs +778 -0
  14. package/dist/model/content/Paragraph.d.mts +213 -16
  15. package/dist/model/content/Paragraph.mjs +611 -57
  16. package/dist/model/content/Range.d.mts +48 -4
  17. package/dist/model/content/Range.mjs +161 -4
  18. package/dist/model/content/Table.d.mts +130 -0
  19. package/dist/model/content/Table.mjs +429 -0
  20. package/dist/model/content/TrackedChange.d.mts +96 -0
  21. package/dist/model/content/TrackedChange.mjs +352 -0
  22. package/dist/model/content/comments.d.mts +122 -0
  23. package/dist/model/content/comments.mjs +248 -0
  24. package/dist/model/content/index.d.mts +13 -3
  25. package/dist/model/content/index.mjs +15 -3
  26. package/dist/model/content/ooxml.d.mts +17 -0
  27. package/dist/model/content/ooxml.mjs +214 -0
  28. package/dist/model/content/styles.d.mts +21 -0
  29. package/dist/model/content/styles.mjs +86 -0
  30. package/dist/model/content/tracking.d.mts +104 -0
  31. package/dist/model/content/tracking.mjs +313 -0
  32. package/dist/model/content/tree.d.mts +56 -9
  33. package/dist/model/content/tree.mjs +104 -31
  34. package/dist/model/customxml/CustomXmlPart.d.mts +158 -0
  35. package/dist/model/customxml/CustomXmlPart.mjs +415 -0
  36. package/dist/model/customxml/CustomXmlPartCollection.d.mts +68 -0
  37. package/dist/model/customxml/CustomXmlPartCollection.mjs +183 -0
  38. package/dist/model/customxml/XmlMapping.d.mts +46 -0
  39. package/dist/model/customxml/XmlMapping.mjs +98 -0
  40. package/dist/model/customxml/bindings.d.mts +41 -0
  41. package/dist/model/customxml/bindings.mjs +230 -0
  42. package/dist/model/customxml/index.d.mts +7 -0
  43. package/dist/model/customxml/index.mjs +9 -0
  44. package/dist/model/customxml/insert.d.mts +20 -0
  45. package/dist/model/customxml/insert.mjs +22 -0
  46. package/dist/model/customxml/kinds.d.mts +103 -0
  47. package/dist/model/customxml/kinds.mjs +267 -0
  48. package/dist/model/customxml/xpath.d.mts +52 -0
  49. package/dist/model/customxml/xpath.mjs +205 -0
  50. package/dist/model/fonts/CJKToEnglish.d.mts +2 -0
  51. package/dist/model/fonts/CJKToEnglish.mjs +16 -0
  52. package/dist/model/fonts/FontFallback.d.mts +58 -0
  53. package/dist/model/fonts/FontFallback.mjs +219 -0
  54. package/dist/model/fonts/IdentityPlusMapper.d.mts +7 -0
  55. package/dist/model/fonts/IdentityPlusMapper.mjs +19 -0
  56. package/dist/model/fonts/LanguageTagToScriptMapping.d.mts +7 -0
  57. package/dist/model/fonts/LanguageTagToScriptMapping.mjs +67 -0
  58. package/dist/model/fonts/Mapper.d.mts +190 -0
  59. package/dist/model/fonts/Mapper.mjs +481 -0
  60. package/dist/model/fonts/PhysicalFont.d.mts +34 -0
  61. package/dist/model/fonts/PhysicalFont.mjs +62 -0
  62. package/dist/model/fonts/RunFontSelector.d.mts +194 -0
  63. package/dist/model/fonts/RunFontSelector.mjs +441 -0
  64. package/dist/model/fonts/ThemeFonts.d.mts +17 -0
  65. package/dist/model/fonts/ThemeFonts.mjs +76 -0
  66. package/dist/model/fonts/defaultTheme.d.mts +37 -0
  67. package/dist/model/fonts/defaultTheme.mjs +57 -0
  68. package/dist/model/fonts/families.generated.d.mts +11 -0
  69. package/dist/model/fonts/families.generated.mjs +17 -0
  70. package/dist/model/fonts/fontsInUse.d.mts +39 -0
  71. package/dist/model/fonts/fontsInUse.mjs +183 -0
  72. package/dist/model/fonts/index.d.mts +14 -0
  73. package/dist/model/fonts/index.mjs +29 -0
  74. package/dist/model/fonts/lookup.d.mts +5 -0
  75. package/dist/model/fonts/lookup.mjs +12 -0
  76. package/dist/model/fonts/registry.d.mts +31 -0
  77. package/dist/model/fonts/registry.mjs +103 -0
  78. package/dist/model/fonts/scripts.d.mts +2 -0
  79. package/dist/model/fonts/scripts.mjs +78 -0
  80. package/dist/model/fonts/substitutions.generated.d.mts +30 -0
  81. package/dist/model/fonts/substitutions.generated.mjs +12 -0
  82. package/dist/model/fonts/themes.generated.d.mts +6 -0
  83. package/dist/model/fonts/themes.generated.mjs +11 -0
  84. package/dist/model/index.d.mts +5 -0
  85. package/dist/model/index.mjs +13 -1
  86. package/dist/model/listnumbering/Emulator.d.mts +187 -0
  87. package/dist/model/listnumbering/Emulator.mjs +332 -0
  88. package/dist/model/listnumbering/definitions.d.mts +251 -0
  89. package/dist/model/listnumbering/definitions.mjs +571 -0
  90. package/dist/model/listnumbering/formats.d.mts +25 -0
  91. package/dist/model/listnumbering/formats.mjs +320 -0
  92. package/dist/model/listnumbering/index.d.mts +4 -0
  93. package/dist/model/listnumbering/index.mjs +15 -0
  94. package/dist/model/listnumbering/state.d.mts +97 -0
  95. package/dist/model/listnumbering/state.mjs +179 -0
  96. package/dist/model/properties/PropertyResolver.d.mts +216 -0
  97. package/dist/model/properties/PropertyResolver.mjs +524 -0
  98. package/dist/model/properties/catalogue.d.mts +179 -0
  99. package/dist/model/properties/catalogue.mjs +860 -0
  100. package/dist/model/properties/index.d.mts +4 -0
  101. package/dist/model/properties/index.mjs +9 -0
  102. package/dist/model/properties/log.d.mts +7 -0
  103. package/dist/model/properties/log.mjs +25 -0
  104. package/dist/model/properties/styleUtil.d.mts +112 -0
  105. package/dist/model/properties/styleUtil.mjs +359 -0
  106. package/dist/node/index.d.mts +1 -0
  107. package/dist/node/index.mjs +12 -0
  108. package/dist/office-js/document.d.mts +111 -0
  109. package/dist/office-js/document.mjs +267 -0
  110. package/dist/office-js/enums.d.mts +187 -0
  111. package/dist/office-js/enums.mjs +176 -0
  112. package/dist/office-js/errors.d.mts +29 -0
  113. package/dist/office-js/errors.mjs +39 -0
  114. package/dist/office-js/extras.d.mts +5 -0
  115. package/dist/office-js/extras.mjs +29 -0
  116. package/dist/office-js/fragment.d.mts +10 -0
  117. package/dist/office-js/fragment.mjs +23 -0
  118. package/dist/office-js/index.d.mts +183 -0
  119. package/dist/office-js/index.mjs +54 -0
  120. package/dist/office-js/proxy.d.mts +72 -0
  121. package/dist/office-js/proxy.mjs +279 -0
  122. package/dist/office-js/run.d.mts +32 -0
  123. package/dist/office-js/run.mjs +66 -0
  124. package/dist/office-js/supported.d.mts +7 -0
  125. package/dist/office-js/supported.generated.d.mts +1 -0
  126. package/dist/office-js/supported.generated.mjs +235 -0
  127. package/dist/office-js/supported.mjs +53 -0
  128. package/dist/office-js/toApiScript.d.mts +25 -0
  129. package/dist/office-js/toApiScript.mjs +394 -0
  130. package/dist/opc/ContentTypes.d.mts +11 -0
  131. package/dist/opc/ContentTypes.mjs +14 -0
  132. package/dist/opc/DirectoryPartStore.d.mts +47 -0
  133. package/dist/opc/DirectoryPartStore.mjs +123 -0
  134. package/dist/opc/exceptions.d.mts +30 -0
  135. package/dist/opc/exceptions.mjs +38 -0
  136. package/dist/opc/index.d.mts +1 -1
  137. package/dist/opc/index.mjs +1 -1
  138. package/dist/packages/OpcPackage.d.mts +19 -1
  139. package/dist/packages/OpcPackage.mjs +29 -0
  140. package/dist/packages/PresentationMLPackage.d.mts +71 -1
  141. package/dist/packages/PresentationMLPackage.mjs +179 -0
  142. package/dist/packages/SpreadsheetMLPackage.d.mts +30 -1
  143. package/dist/packages/SpreadsheetMLPackage.mjs +78 -0
  144. package/dist/packages/WordprocessingMLPackage.d.mts +124 -2
  145. package/dist/packages/WordprocessingMLPackage.mjs +309 -2
  146. package/dist/packages/index.d.mts +1 -1
  147. package/dist/packages/index.mjs +1 -1
  148. package/dist/parts/DefaultXmlPart.d.mts +18 -0
  149. package/dist/parts/DefaultXmlPart.mjs +34 -5
  150. package/dist/parts/Namespaces.d.mts +18 -0
  151. package/dist/parts/Namespaces.mjs +20 -0
  152. package/dist/parts/Part.d.mts +6 -0
  153. package/dist/parts/Part.mjs +13 -0
  154. package/dist/parts/PartRegistry.mjs +13 -1
  155. package/dist/parts/XmlPart.d.mts +33 -0
  156. package/dist/parts/XmlPart.mjs +105 -2
  157. package/dist/parts/pml/defaults.d.mts +6 -0
  158. package/dist/parts/pml/defaults.mjs +53 -0
  159. package/dist/parts/pml/index.d.mts +66 -3
  160. package/dist/parts/pml/index.mjs +206 -7
  161. package/dist/parts/pml/placeholders.d.mts +71 -0
  162. package/dist/parts/pml/placeholders.mjs +141 -0
  163. package/dist/parts/sml/index.d.mts +80 -1
  164. package/dist/parts/sml/index.mjs +154 -1
  165. package/dist/parts/wml/comments.d.mts +1 -0
  166. package/dist/parts/wml/comments.mjs +179 -0
  167. package/dist/parts/wml/defaultNumbering.d.mts +1 -0
  168. package/dist/parts/wml/defaultNumbering.mjs +216 -0
  169. package/dist/parts/wml/index.d.mts +121 -0
  170. package/dist/parts/wml/index.mjs +291 -0
  171. package/dist/xml/dom.mjs +1 -2
  172. package/package.json +25 -4
@@ -1,11 +1,45 @@
1
1
  import type * as wml from '@docx4j/generated-objects-ts/modules/org_docx4j_wml';
2
- import { type Element, W_NS, type TextSegment } from './tree.mjs';
3
- import { Font } from './Font.mjs';
2
+ import { type Element, W_NS, type TextSegment, type TextViewOptions } from './tree.mjs';
3
+ import { Font, type FontTracking } from './Font.mjs';
4
4
  import { Range } from './Range.mjs';
5
5
  import { type SearchOptions } from './search.mjs';
6
- import type { Body } from './Body.mjs';
7
- /** Office JS Word.Alignment. */
8
- export type Alignment = 'Unknown' | 'Left' | 'Centered' | 'Right' | 'Justified';
6
+ import type { Body, BlockElement } from './Body.mjs';
7
+ import { type TableCell } from './Table.mjs';
8
+ import { ContentControl, type ContentControlType } from './ContentControl.mjs';
9
+ import { InlinePicture, type InlinePictureOptions } from './InlinePicture.mjs';
10
+ import type { Comment } from './Comment.mjs';
11
+ import { type ChangeTracker } from './tracking.mjs';
12
+ import { TrackedChange } from './TrackedChange.mjs';
13
+ import { type List, type ListItem, type StartListOptions } from './List.mjs';
14
+ /**
15
+ * Office JS `Word.Alignment`, as an *effective* read reports it: an absent `w:jc` resolves to
16
+ * `'Left'`, which is what Word does and what Office JS answers. `'Unknown'` is what a direct
17
+ * read (`formatting({ direct: true })`) says for "no `w:jc` here", and is accepted by the
18
+ * setter, where it removes the element (CR-001 Phase B step 2 decision 4).
19
+ */
20
+ export type Alignment = 'Left' | 'Centered' | 'Right' | 'Justified';
21
+ /** {@link Alignment} plus the direct reads' "nothing stated" and the setter's "remove it". */
22
+ export type AlignmentOrUnknown = Alignment | 'Unknown';
23
+ /** Whether a read reports direct formatting instead of the effective value. */
24
+ export interface FormattingOptions {
25
+ /**
26
+ * `true` reads the direct formatting only - the `w:pPr` or `w:rPr` on the element itself -
27
+ * as this package did before CR-001 Phase B. The default is the effective value, resolved
28
+ * through the document defaults and the style chain, which is what Office JS reports.
29
+ */
30
+ direct?: boolean;
31
+ }
32
+ /** Office JS's paragraph formatting properties, read in one call (extension). */
33
+ export interface ParagraphFormatting {
34
+ alignment: AlignmentOrUnknown;
35
+ leftIndent: number;
36
+ rightIndent: number;
37
+ firstLineIndent: number;
38
+ spaceBefore: number;
39
+ spaceAfter: number;
40
+ lineSpacing: number;
41
+ outlineLevel: number;
42
+ }
9
43
  /**
10
44
  * A subset of Office JS `Word.Paragraph` over a `w:p` in a body, cell, header, footer or
11
45
  * content control. A light view: it holds the element and the array that contains it; nothing
@@ -33,15 +67,45 @@ export declare class Paragraph {
33
67
  get text(): string;
34
68
  /** Replaces the content with one run of the text, keeping the first run's formatting. */
35
69
  set text(value: string);
36
- /** The style id (w:pStyle); 'Normal' when none is set. */
70
+ /**
71
+ * The text in one of the two views (extension; `text` is the accepted one). `{ view: 'original' }`
72
+ * reads the document as it was before the tracked changes: `w:del` included, `w:ins` excluded.
73
+ */
74
+ getText(options?: TextViewOptions): string;
75
+ /** The style id (w:pStyle; docx4j's name for it); 'Normal' when none is set. Extension: Office JS has `style` and `styleBuiltIn` only. */
76
+ get styleId(): string;
77
+ set styleId(id: string);
78
+ /**
79
+ * The style's display name ('Heading 1', 'My Style'), as Office JS: from the styles part's
80
+ * `w:name` when that part is unmarshalled, else derived from the id. Setting accepts a display
81
+ * name, a stored name, or an id.
82
+ */
37
83
  get style(): string;
38
- set style(id: string);
39
- /** Word's display name of the style ('Heading 1'); mapped to and from ids by removing spaces. */
84
+ set style(name: string);
85
+ /** The `Word.Style` value ('Heading1'), or 'Other' when the style is not a built-in one, as Office JS. */
40
86
  get styleBuiltIn(): string;
41
- set styleBuiltIn(name: string);
87
+ set styleBuiltIn(value: string);
88
+ /**
89
+ * The paragraph properties which actually apply: the document defaults, the style chain and
90
+ * the numbering level, then this paragraph's own `w:pPr` (docx4j
91
+ * `PropertyResolver.getEffectivePPr`). A live, possibly cached object: copy it before
92
+ * changing it. Needs the package's resolver; see `Body.propertyResolver`.
93
+ */
94
+ get effectivePPr(): wml.PPr;
95
+ /** The paragraph mark's effective run properties (docx4j `getEffectiveParagraphMarkRPr`). */
96
+ get effectiveParagraphMarkRPr(): wml.RPr;
97
+ /** The `w:pPr` a formatting read works from: the resolved one, or this paragraph's own. */
98
+ private readPPr;
99
+ /**
100
+ * Office JS's paragraph formatting in one call, and the way to ask for direct formatting:
101
+ * `formatting({ direct: true })` is what the individual getters reported before CR-001
102
+ * Phase B step 2 (an absent property reads 0, 10 or `'Unknown'`).
103
+ */
104
+ formatting(options?: FormattingOptions): ParagraphFormatting;
105
+ /** The effective alignment; an absent `w:jc` after resolution is `'Left'`, as Office JS. */
42
106
  get alignment(): Alignment;
43
- set alignment(v: Alignment);
44
- /** Indents and spacing in points, as Office JS; 0 when not set directly. */
107
+ set alignment(v: AlignmentOrUnknown);
108
+ /** Indents and spacing in points, as Office JS; the effective values (CR-001 Phase B step 2). */
45
109
  get leftIndent(): number;
46
110
  set leftIndent(pt: number);
47
111
  get rightIndent(): number;
@@ -56,35 +120,97 @@ export declare class Paragraph {
56
120
  /** Line spacing in points: w:line/240 lines of 12pt when the rule is auto, else w:line twips; 0 when not set. */
57
121
  get lineSpacing(): number;
58
122
  set lineSpacing(pt: number);
59
- /** w:outlineLvl + 1 (1 to 9); 10 for body text, as Office JS. */
123
+ /** w:outlineLvl + 1 (1 to 9); 10 for body text, as Office JS. A heading style supplies it. */
60
124
  get outlineLevel(): number;
61
125
  set outlineLevel(level: number);
62
- /** Direct formatting of the runs: reads the first run, writes all (extension: `Font` is over runs, not the paragraph mark). */
126
+ /**
127
+ * The runs' formatting: reads the first run's *effective* properties, writes direct
128
+ * formatting to all (extension: `Font` is over runs, not the paragraph mark).
129
+ */
63
130
  get font(): Font;
131
+ /** `font`, with `{ direct: true }` for the direct formatting of the first run (extension). */
132
+ getFont(options?: FormattingOptions): Font;
64
133
  /** w14:paraId, the stable address Word gives paragraphs. */
65
134
  get paraId(): string | undefined;
66
135
  set paraId(id: string | undefined);
67
136
  /** The runs, direct and nested (hyperlinks, content controls, insertions), in order. */
68
137
  get runs(): Element<wml.R>[];
138
+ /** The cell this paragraph is in, or undefined when it is not in a table (Office JS). */
139
+ get parentTableCell(): TableCell | undefined;
140
+ /** The run-level content controls in this paragraph, in order, nested ones included. */
141
+ get contentControls(): ContentControl[];
142
+ /** The inline pictures in this paragraph, in order (Office JS Paragraph.inlinePictures). */
143
+ get inlinePictures(): InlinePicture[];
69
144
  /** Text inserted at the start, the end, or replacing the whole paragraph's text. */
70
145
  insertText(text: string, location: 'Start' | 'End' | 'Replace'): Range;
71
146
  /** A new paragraph of the text before or after this one, with this paragraph's properties (as Word). */
72
147
  insertParagraph(text: string, location: 'Before' | 'After'): Paragraph;
73
148
  insertBreak(type: 'Page' | 'Line', location: 'Before' | 'After' | 'Start' | 'End'): void;
149
+ /**
150
+ * Adds the image as a part of this paragraph's part, with a relationship, and shows it at the
151
+ * start or the end of this paragraph, or in place of its content (Office JS).
152
+ */
153
+ insertInlinePictureFromBase64(base64: string, location: 'Start' | 'End' | 'Replace', options?: InlinePictureOptions): InlinePicture;
154
+ /**
155
+ * Word's `insertOoxml` at paragraph level: a flat OPC `pkg:package` (or a bare fragment). One
156
+ * incoming paragraph is merged into this one at 'Start' and 'End', as Word's paste does;
157
+ * anything else is inserted as blocks before or after. 'Replace' puts the content where this
158
+ * paragraph was and removes it.
159
+ */
160
+ insertOoxml(ooxml: string, location: 'Before' | 'After' | 'Start' | 'End' | 'Replace'): Promise<(Paragraph | BlockElement)[]>;
74
161
  /** Matches within this paragraph. */
75
162
  search(text: string, options?: SearchOptions): Range[];
163
+ /**
164
+ * Replaces every match of `find` with `replace`, last match first so that the offsets of the
165
+ * ones still to do stay valid (CR-002 section 3.7). Returns the number replaced; tracked when
166
+ * the package's `changeTrackingMode` is on.
167
+ */
168
+ replaceText(find: string, replace: string, options?: SearchOptions): number;
169
+ /** The tracked changes in this paragraph, in document order (CR-002 phase F). */
170
+ getTrackedChanges(): TrackedChange[];
76
171
  getRange(location?: 'Whole' | 'Start' | 'End' | 'Content'): Range;
77
- /** Removes the paragraph from its container. */
172
+ /**
173
+ * Removes the paragraph from its container. While the package tracks changes, the content
174
+ * becomes a `w:del` and the mark is marked deleted (`w:pPr/w:rPr/w:del`) instead, unless the
175
+ * whole paragraph was this author's own insertion, which Word simply takes back.
176
+ */
78
177
  delete(): void;
178
+ private trackedDelete;
179
+ /**
180
+ * The paragraph's content and its mark marked deleted, the paragraph element itself kept:
181
+ * what the cells of a deleted table row need (a `w:tc` must keep a block-level child, and Word
182
+ * writes `w:del` around every run and `w:pPr/w:rPr/w:del` on every mark inside a deleted row).
183
+ * The same primitives `delete()` uses, without its "take back my own insertion" step.
184
+ * Does nothing when the mark is already deleted.
185
+ */
186
+ markDeletedInPlace(tracker: ChangeTracker): void;
79
187
  /** The paragraph as XML (extension; Office JS getOoxml wraps it in a package). */
80
188
  getXml(): Promise<string>;
81
189
  /** docx4j: the P's content list. */
82
190
  getContent(): Element[];
83
- private pPr;
191
+ /**
192
+ * The paragraph's properties, created when absent. Every property setter goes through this
193
+ * one accessor, so this is where a tracked write records `w:pPrChange` with the properties as
194
+ * they stand before it.
195
+ *
196
+ * @internal public so that the list views (CR-002 phase H) write `w:numPr` the same way.
197
+ */
198
+ pPr(): wml.PPr;
199
+ /**
200
+ * The paragraph's `w:numPr`, created when absent, through {@link pPr} so that a tracked
201
+ * write records `w:pPrChange` first.
202
+ *
203
+ * @internal what the list views write through (CR-002 phase H).
204
+ */
205
+ numPr(): wml.PPrBase.NumPr;
84
206
  private ind;
85
207
  private spacing;
208
+ /** The package's change tracker while `changeTrackingMode` is on; undefined when it is off. */
209
+ get changeTracker(): ChangeTracker | undefined;
210
+ /** What `Font` needs to write `w:rPrChange`: the tracker, and the runs that are our own insertion (`Range` shares it). */
211
+ fontTracking(): FontTracking | undefined;
86
212
  /** The text segments (w:t, w:tab, ...) with their offsets. */
87
- segments(): TextSegment[];
213
+ segments(options?: TextViewOptions): TextSegment[];
88
214
  /**
89
215
  * Replaces the text in [start, end) with `text` and returns the range of the inserted text.
90
216
  * Runs are edited in place: a w:t loses or gains characters, a tab or break inside the range
@@ -92,8 +218,79 @@ export declare class Paragraph {
92
218
  * else into a new run with the formatting of the nearest run.
93
219
  */
94
220
  splice(start: number, end: number, text: string): Range;
221
+ /**
222
+ * Inserts run-level items (runs, hyperlinks, content controls) at a text offset, splitting the
223
+ * run there when the offset falls inside one. PARENT is linked on what is inserted.
224
+ */
225
+ insertItemsAt(offset: number, items: Element[]): void;
95
226
  /** Splits the run at a text offset so that [offset, ...) begins a run; returns nothing when the offset is already a boundary. */
96
227
  splitAt(offset: number): void;
228
+ /**
229
+ * Office JS `paragraph.isListItem`: whether Word paints a label in front of this paragraph.
230
+ * The effective `w:numPr` decides it (docx4j `Emulator.numRefFor`), so a "List Number" style
231
+ * counts; a `w:numId` of 0, a `w:numId` naming no `w:num`, and a level linked to another
232
+ * paragraph style do not.
233
+ */
234
+ get isListItem(): boolean;
235
+ /** Office JS `paragraph.list`: the list this paragraph is in; throws when it is not in one. */
236
+ get list(): List;
237
+ /** Office JS `paragraph.listOrNullObject`: the list, or a null object (`isNullObject` true). */
238
+ get listOrNullObject(): List;
239
+ /** Office JS `paragraph.listItem`: this paragraph's place in its list; throws when it has none. */
240
+ get listItem(): ListItem;
241
+ /** Office JS `paragraph.listItemOrNullObject`. */
242
+ get listItemOrNullObject(): ListItem;
243
+ /**
244
+ * Office JS `paragraph.startNewList()`: a new list definition (docx4j's default decimal set,
245
+ * or its bullet set with `{ bullet: true }`) with this paragraph as its first item, adding
246
+ * the numbering part and its relationship when the document has none.
247
+ *
248
+ * Asynchronous where Office JS's is synchronous, since the default definitions are XML to be
249
+ * unmarshalled (CR-002 section 17).
250
+ */
251
+ startNewList(options?: StartListOptions): Promise<List>;
252
+ /** Office JS `paragraph.attachToList(listId, level)`: this paragraph joins that list. */
253
+ attachToList(listId: number | string, level?: number): List;
254
+ /** Office JS `paragraph.detachFromList()`: this paragraph leaves its list. */
255
+ detachFromList(): void;
256
+ /**
257
+ * The same list, starting again at this paragraph: a new `w:num` over the same
258
+ * `w:abstractNum` with a `w:startOverride` (extension; `List.restart()` is the verb).
259
+ */
260
+ restartList(): List;
261
+ /** The comments anchored in this paragraph, replies nested under their parent. */
262
+ getComments(): Promise<Comment[]>;
263
+ /** Comments the whole paragraph (sugar over `getRange().insertComment`). */
264
+ insertComment(text: string): Promise<Comment>;
265
+ /**
266
+ * Wraps this paragraph in a new block-level content control (Office JS
267
+ * `Paragraph.insertContentControl`), typed for the kind when one is given. The `w:id` is free in
268
+ * the body. Returns the control.
269
+ */
270
+ insertContentControl(kind?: ContentControlType): ContentControl;
97
271
  private removeEmptyRuns;
272
+ /**
273
+ * The text in [start, end) becomes a deletion: the runs holding it are isolated, their `w:t`
274
+ * turned into `w:delText`, and each run of consecutive ones moved into one `w:del`. Text this
275
+ * author had inserted is simply removed, as Word does, rather than nested in a `w:del`.
276
+ * Returns the `w:del` elements it made, in document order.
277
+ */
278
+ private deleteText;
279
+ /**
280
+ * Text inserted at `at` as a `w:ins`. A run of this author's own that is already inside a
281
+ * `w:ins` is extended rather than nested in another one, as Word does. `anchor` is the `w:del`
282
+ * of a replacement, which the insertion must follow.
283
+ */
284
+ private insertTracked;
285
+ /**
286
+ * Splits runs so that every run holding text in [start, end) holds nothing else, and returns
287
+ * the segments inside the span. `splitAt` does the `w:t` boundaries; this also moves the items
288
+ * of a run that straddles a boundary (a tab, a break, a drawing) out into runs of their own.
289
+ */
290
+ private isolate;
291
+ /** Moves the items before `seg` into a run of their own, in front of `seg`'s run. */
292
+ private splitRunBefore;
293
+ /** Moves the items after `seg` into a run of their own, behind `seg`'s run. */
294
+ private splitRunAfter;
98
295
  }
99
296
  export { W_NS };