@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,6 +1,6 @@
1
1
  import type * as wml from '@docx4j/generated-objects-ts/modules/org_docx4j_wml';
2
2
  import type * as mce from '@docx4j/generated-objects-ts/modules/org_docx4j_mce';
3
- import { isElement, runItemsOf, type Element } from '@docx4j/generated-objects-ts/builders/wml';
3
+ import { isElement, runItemsOf, type McOptions, type Element } from '@docx4j/generated-objects-ts/builders/wml';
4
4
  export { isElement, typeNameOf, walk, find, linkParents, textOf, W_NS, type Element } from '@docx4j/generated-objects-ts/builders/wml';
5
5
  /** The two views of a tracked document: as it will read once accepted, or as it read before the changes. */
6
6
  export type TextView = 'accepted' | 'original';
@@ -8,13 +8,42 @@ export interface TextViewOptions {
8
8
  /** 'accepted' (the default: w:ins included, w:del excluded) or 'original' (the other way). */
9
9
  view?: TextView;
10
10
  }
11
- /** `segmentsOf`'s options: a view, and whether drawn objects get a segment of their own. */
11
+ /** Whether a run is hidden: its effective `w:vanish` (`hiddenRunsOf` makes one for a paragraph). */
12
+ export type HiddenRuns = (run: wml.R) => boolean;
13
+ /** `segmentsOf`'s options: a view, whether drawn objects get a segment of their own, which runs are hidden. */
12
14
  export interface SegmentOptions extends TextViewOptions {
13
15
  /**
14
16
  * True to list each picture or other drawn object (`OBJECT_ITEMS`) as a segment of no text at its
15
17
  * place in the text (`object` set), so that a deletion of a span can find it (CR-002 section 48).
18
+ * Hidden runs' items are listed with them.
16
19
  */
17
20
  objects?: boolean;
21
+ /**
22
+ * Which runs are hidden. Office JS's text leaves hidden text out, a run's own `w:vanish` or its
23
+ * styles' (check 48b), so `Paragraph.text` does too (CR-012 phase 4): a hidden run's items take no
24
+ * offset, and are listed only with the objects, each `object` and `hidden`, so that a span's deletion
25
+ * takes the hidden text strictly inside it as it takes a picture. Undefined: no run is hidden.
26
+ */
27
+ hidden?: HiddenRuns;
28
+ /**
29
+ * Called for every element the walk passes that adds no text: each element of a run holder's list
30
+ * (runs, revision holders, markers, before it is entered) and each item of a run that adds none (a
31
+ * comment reference, a field character, a drawing, a hidden run's text), with the offset it stands at,
32
+ * the list holding it and its run. What gives a comment marker or a revision its offset in the same text.
33
+ */
34
+ visit?: (item: Element, at: number, owner: Element[], run: {
35
+ element: Element<wml.R>;
36
+ owner: Element[];
37
+ } | undefined) => void;
38
+ /**
39
+ * `office` (the default): Office JS's characters (`officeItemText`), a kept `mc:AlternateContent`'s
40
+ * selected branch read, an equation's drawn text. `textOf`: the characters of the objects package's
41
+ * `textOf` and docx4j's `TextUtils`, as this function read before CR-012 phase 4 (a break `\n`, the
42
+ * hyphens U+2011 and U+00AD, a symbol its code point, a note reference nothing), a run-level element
43
+ * one object, a paragraph-level one and an equation nothing: what a tracked change's `text` is, which
44
+ * the revisions goldens hold to docx4j's.
45
+ */
46
+ characters?: 'office' | 'textOf';
18
47
  }
19
48
  /**
20
49
  * Run content that stands in the text and has no text of its own: a `w:drawing` (a picture, a chart, a
@@ -27,12 +56,13 @@ export declare const OBJECT_ITEMS: ReadonlySet<string>;
27
56
  export declare const ALTERNATE_CONTENT = "org_docx4j_mce.AlternateContent";
28
57
  /**
29
58
  * The branch of a kept `mc:AlternateContent` the content API reads (docx4j's `McMode.READ`, CR-010
30
- * phase 3): the objects package's `mcBranchOf` over the prefixes load understands
31
- * (`UNDERSTOOD_PREFIXES`), so a reader of the kept element takes the branch the preprocessor would have
32
- * resolved it to. A mutator walks every branch instead (docx4j's `McMode.ALL`). Undefined for an element
33
- * with no branches.
59
+ * phase 3): the objects package's `mcBranchOf`, the first `mc:Choice` whose `Requires` names only namespaces in the
60
+ * understood set, by URI, else the `mc:Fallback`, else nothing (WD REQ-302 to REQ-305, CR-029). So a reader takes the
61
+ * branch the preprocessor resolves the element to. A mutator walks every branch instead (docx4j's `McMode.ALL`). Undefined
62
+ * where nothing is selected, as for an element with no branches. `options` are `mcBranchOf`'s: the text model passes
63
+ * `onNothingSelected` for `mce.nothing_selected`.
34
64
  */
35
- export declare function selectedBranchOf(value: mce.AlternateContent | undefined): Element[] | undefined;
65
+ export declare function selectedBranchOf(value: mce.AlternateContent | undefined, options?: McOptions): Element[] | undefined;
36
66
  /** True for a kept `mc:AlternateContent`: its element pair, or its value. */
37
67
  export declare function isAlternateContent(value: unknown): boolean;
38
68
  /**
@@ -87,44 +117,162 @@ export interface TextSegment {
87
117
  * next to it goes beside it (`revision.owner`) unless the same author may extend it.
88
118
  */
89
119
  revision?: RevisionHolder;
120
+ /**
121
+ * An item of a hidden run (`SegmentOptions.hidden`): no text, listed with the objects, `object` set too;
122
+ * a drawing in a hidden run is one (Word's default view doesn't show it: `search`'s `^g` passes it by).
123
+ */
124
+ hidden?: boolean;
125
+ /**
126
+ * An equation (`m:oMath`, `m:oMathPara`): one segment holding its text as Word draws it
127
+ * (`mathTextOf`). `item` is the equation and `owner` the list holding it, as `runOwner` is; `run`
128
+ * is a frozen stand-in, since an equation is in no run. An edit may take it whole, not in part.
129
+ */
130
+ math?: boolean;
131
+ /**
132
+ * The kept `mc:AlternateContent` whose selected branch holds this item (a run-level element) or its
133
+ * run (a paragraph-level one), the innermost: an edit lands in that branch, the others kept as they
134
+ * were read (CR-012 section 12.2).
135
+ */
136
+ alternate?: AlternateLocation;
137
+ }
138
+ /** Where a kept `mc:AlternateContent` whose selected branch holds text stands (CR-012 section 12.2). */
139
+ export interface AlternateLocation {
140
+ /** The element pair. */
141
+ element: Element;
142
+ /** The array holding it: a run's content (`run` level) or a run holder's list (`paragraph` level). */
143
+ owner: Element[];
144
+ /** Its selected branch's items (`selectedBranchOf`). */
145
+ branch: Element[];
146
+ /** `run`: the element is run content and its branch holds run items; `paragraph`: it stands among runs and its branch holds runs. */
147
+ level: 'run' | 'paragraph';
90
148
  }
91
149
  /** Types whose value holds runs (directly or through sdtContent); the revision holders are separate. */
92
150
  declare const RUN_HOLDERS: Set<string>;
93
151
  /** The kind of a run-level revision element, by its name; undefined when it is not one. */
94
152
  export declare function revisionKindOf(el: Element): RevisionKind | undefined;
95
153
  export { runItemsOf };
154
+ /**
155
+ * An item's text in Office JS's text, Word's own character stream (CR-012 phase 4; check 48, Word 365):
156
+ * a `w:br` U+000B, of type page U+000C and column U+000E; a `w:cr` U+000D; a `w:ptab` `0`; the
157
+ * non-breaking and optional hyphens U+001E and U+001F; any `w:sym` `(`, whatever its font or code
158
+ * (check 48b); a footnote or endnote reference U+0002, and so the note's own mark (`w:footnoteRef`,
159
+ * `w:endnoteRef`, not measured). Undefined for an item that adds no text: a comment reference, a
160
+ * field's characters and code, a drawing.
161
+ */
162
+ export declare function officeItemText(item: Element): string | undefined;
163
+ /**
164
+ * The item text the revision listings and the text model's plan count (`itemTextOf`): whether a run
165
+ * holds text, in the characters `textOf` gives. Not Office JS's (`officeItemText`).
166
+ */
96
167
  declare function itemText(item: Element): string | undefined;
97
168
  /**
98
- * The text segments of a paragraph (or any run holder) in order. The default view is the
99
- * accepted one: the runs of a `w:ins` or `w:moveTo` count, those of a `w:del` or `w:moveFrom`
100
- * do not. `{ view: 'original' }` is the other way round (CR-002 phase F). `{ objects: true }`
101
- * lists the drawn objects too, each a segment of no text where it stands (CR-002 section 48).
169
+ * The text segments of a paragraph (or any run holder) in order, in Office JS's characters
170
+ * (`officeItemText`). The default view is the accepted one: the runs of a `w:ins` or `w:moveTo`
171
+ * count, those of a `w:del` or `w:moveFrom` do not. `{ view: 'original' }` is the other way round
172
+ * (CR-002 phase F). `{ objects: true }` lists the drawn objects too, each a segment of no text where
173
+ * it stands (CR-002 section 48), and the items of hidden runs (`hidden`).
102
174
  *
103
- * A kept `mc:AlternateContent` in a run is one object segment, whatever its branches hold, so that
104
- * removing a span removes every branch with it (CR-010 phase 3). A drawing adds no text, so the
105
- * offsets are a resolved load's. One in a paragraph's content, outside a run, is not listed: Word
106
- * writes none, and the corpus has none (CR-010 section 11.3).
175
+ * A kept `mc:AlternateContent` reads as its selected branch (CR-012 section 12.2, ED-009): in a run,
176
+ * a branch holding run items reads as those items, at the run's offsets, and one holding a drawing,
177
+ * a picture or an object is one object segment, as a drawing is (CR-010 phase 3); among a paragraph's
178
+ * runs, it reads as the runs its branch holds. Either way the segments carry `alternate`, so that an
179
+ * edit lands in that branch. An equation is one segment of its drawn text (`math`).
107
180
  */
108
181
  export declare function segmentsOf(container: object, options?: SegmentOptions): TextSegment[];
109
- /** The text of a paragraph or container in one of the two views (`textOf` is the accepted one). */
110
- export declare function textOfView(container: object, options?: TextViewOptions): string;
111
- /** The runs of a paragraph, direct and nested in hyperlinks, content controls and insertions, in order. */
182
+ /** What `hiddenRunsOf` asks of a `PropertyResolver`. */
183
+ export interface VanishResolver {
184
+ isVanishedByStyles(paragraphStyleId: string | undefined, runStyleId: string | undefined): boolean;
185
+ }
186
+ /**
187
+ * Which of a paragraph's runs are hidden, as the text model's rule has it (REQ-507) and Office JS's text
188
+ * leaves them out (check 48b): a run's own `w:vanish`, else its paragraph style's and character style's.
189
+ * Without a resolver only a run's own counts.
190
+ */
191
+ export declare function hiddenRunsOf(resolver: VanishResolver | undefined, p: wml.P): HiddenRuns;
192
+ /**
193
+ * Whether a run is in a content control showing its placeholder (`w:showingPlcHdr`), run-level or block-level, up its
194
+ * `PARENT`s. Office JS reads a placeholder as no text, and finds no text there to keep (check 53 cases 34 and 35, check 58
195
+ * cases 11 and 12; CR-012 section 18), so the readers take its runs as they take hidden ones.
196
+ */
197
+ export declare function inShowingPlaceholder(run: object): boolean;
198
+ /** The text of a paragraph or container in one of the two views, in Office JS's characters (`segmentsOf`). */
199
+ export declare function textOfView(container: object, options?: SegmentOptions): string;
200
+ /**
201
+ * The runs of a paragraph, direct and nested in hyperlinks, content controls and insertions, in order,
202
+ * and in the selected branch of a kept `mc:AlternateContent` among them (CR-012 section 12.2).
203
+ */
112
204
  export declare function runsOf(container: object, options?: TextViewOptions): Element<wml.R>[];
205
+ /** The TYPE_NAMEs of a kept `mc:AlternateContent`'s branches, whose items are their `any`. */
206
+ export declare const BRANCH_TYPES: ReadonlySet<string>;
207
+ /**
208
+ * How a walk takes a kept `mc:AlternateContent` among blocks, rows or cells (CR-013): `'read'`, a reader's,
209
+ * its selected branch (`selectedBranchOf`), as Word reads it; `'every'`, a mutator's, every branch, Choices
210
+ * first (phase 3). With no mode the element is stepped over, as every walk did before CR-013 phase 2.
211
+ */
212
+ export type BranchMode = 'read' | 'every';
113
213
  /**
114
214
  * The block-level children of a container: body, header, footer, cell, sdt content, table (rows),
115
215
  * row (cells). A content control of any kind (block, row, cell, run) answers with its
116
- * `sdtContent`'s content, so that a traversal does not have to know the four types.
216
+ * `sdtContent`'s content, so that a traversal does not have to know the four types. A branch of a kept
217
+ * `mc:AlternateContent` (a Choice or the Fallback) answers with its items, so that a locator climbing
218
+ * `PARENT` from a branch's paragraph, row or cell finds the list it is in; the element itself answers
219
+ * in a reader's walk (`'read'`) with its selected branch (CR-013 phase 2), and otherwise not at all.
220
+ */
221
+ export declare function childrenOf(value: object, mode?: 'read'): Element[] | undefined;
222
+ /** Every branch of a kept `mc:AlternateContent`, the Choices in order, then the Fallback. */
223
+ export declare function branchesOf(value: mce.AlternateContent): Element[][];
224
+ /**
225
+ * Runs a bulk edit that reaches every branch of a kept `mc:AlternateContent` (CR-013 phase 3): a
226
+ * `replaceText`, a tracked clear or row deletion, the binding passes. Inside it the views it makes of
227
+ * what is in a branch write, where a caller's view refuses (D4): the edit itself reaches every branch,
228
+ * the selected one and the others alike, as CR-010's rule has mutators do.
229
+ */
230
+ export declare function writingEveryBranch<T>(edit: () => T): T;
231
+ /**
232
+ * Refuses a write through a view in a branch of a kept `mc:AlternateContent` at block, row or cell level
233
+ * (CR-013 D4): the view reads the selected branch, and a write would have to reach the element's other
234
+ * branches too, which nothing maps. A bulk edit reaching every branch writes there (`writingEveryBranch`).
235
+ * `className` is Office JS's ('Paragraph', 'Body').
117
236
  */
118
- export declare function childrenOf(value: object): Element[] | undefined;
237
+ export declare function assertOutsideBranch(value: object | undefined, className: string, what?: string): void;
238
+ /**
239
+ * True for a value inside a branch of a kept `mc:AlternateContent` at block, row or cell level: a
240
+ * paragraph, table, row, cell or content control a reader sees in the selected branch (CR-013 phase 2).
241
+ * A view of one is read-only (D4). From `PARENT` links; a run-level element's content is not reached
242
+ * from a paragraph, which is outside it.
243
+ */
244
+ export declare function inBranch(value: object | undefined): boolean;
245
+ /**
246
+ * True for a value no reader sees: inside a branch of a kept `mc:AlternateContent` other than the one
247
+ * `selectedBranchOf` takes, at any depth (CR-013 phase 3). What a bulk edit writes there it does not
248
+ * count, as resolve-all counts the listed changes: the count is of what a reader sees.
249
+ */
250
+ export declare function inUnreadBranch(value: object | undefined): boolean;
251
+ /**
252
+ * The lists a walk takes for a kept `mc:AlternateContent` among blocks, rows or cells: a reader's
253
+ * (`'read'`) its selected branch, a mutator's (`'every'`) every branch, the Choices first.
254
+ */
255
+ export declare function branchListsOf(value: mce.AlternateContent, mode: BranchMode): Element[][];
119
256
  /** An element with the array that holds it: what a view needs to edit it in place. */
120
257
  export interface Located<T = unknown> {
121
258
  element: Element<T>;
122
259
  container: Element[];
123
260
  }
124
- /** The rows of a table, in order, descending into row-level content controls (an OpenDoPE repeat). */
125
- export declare function rowsOf(tbl: object): Located<wml.Tr>[];
126
- /** The cells of a row, in order, descending into cell-level content controls. */
127
- export declare function cellsOf(tr: object): Located<wml.Tc>[];
261
+ /**
262
+ * The rows of a table, in order, descending into row-level content controls (an OpenDoPE repeat), and,
263
+ * with a mode, into a row-level `mc:AlternateContent` (`BranchMode`; CR-013 phase 2).
264
+ */
265
+ export declare function rowsOf(tbl: object, mode?: BranchMode): Located<wml.Tr>[];
266
+ /** The cells of a row, in order, descending into cell-level content controls, and with a mode into a cell-level `mc:AlternateContent`. */
267
+ export declare function cellsOf(tr: object, mode?: BranchMode): Located<wml.Tc>[];
268
+ /**
269
+ * A row's cells as laid along the grid, one list per reading of the row (docx4j's `Lister.cellLayoutsOf`,
270
+ * its CR-051 phase 2): the selected branches' first (`cellsOf(tr, 'read')`), then, for each cell-level
271
+ * `mc:AlternateContent` and each of its other branches, the row read with that branch in the element's
272
+ * place. Every branch spans the same grid columns, so every cell is in some list at its grid position:
273
+ * what a pass over the grid's columns walks (`collapseGrid`, the column passes; CR-013 phase 3).
274
+ */
275
+ export declare function cellLayoutsOf(tr: object): Located<wml.Tc>[][];
128
276
  /** Content controls: `w:sdt` at block, row, cell and run level, by TYPE_NAME. */
129
277
  export declare const SDT_TYPES: Set<string>;
130
278
  /** True for what a body or cell may hold directly (the Body content union), by TYPE_NAME. */