@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
@@ -0,0 +1,256 @@
1
+ import type * as wml from '@docx4j/generated-objects-ts/modules/org_docx4j_wml';
2
+ import type * as w15 from '@docx4j/generated-objects-ts/modules/org_docx4j_w15';
3
+ import type * as w16cid from '@docx4j/generated-objects-ts/modules/org_docx4j_w16cid';
4
+ import type * as w16cex from '@docx4j/generated-objects-ts/modules/org_docx4j_w16cex';
5
+ import type * as core from '@docx4j/generated-objects-ts/modules/org_docx4j_docProps_core';
6
+ import type * as extended from '@docx4j/generated-objects-ts/modules/org_docx4j_docProps_extended';
7
+ import type * as custom from '@docx4j/generated-objects-ts/modules/org_docx4j_docProps_custom';
8
+ import type { Part } from '../../parts/Part.mjs';
9
+ import type { XmlPart } from '../../parts/XmlPart.mjs';
10
+ import { PropertyResolver } from '../properties/PropertyResolver.mjs';
11
+ import { NumberingDefinitions } from '../listnumbering/definitions.mjs';
12
+ import { Emulator, type NumberingPartLike } from '../listnumbering/Emulator.mjs';
13
+ import { NumberingStates } from '../listnumbering/state.mjs';
14
+ import { Body } from '../content/Body.mjs';
15
+ import { ResolvedView } from '../content/ResolvedView.mjs';
16
+ import type { XPathEngine } from '../customxml/xpath.mjs';
17
+ import type { NoteType } from './TextResult.mjs';
18
+ /** As much of a `WordprocessingMLPackage` as a reading uses, so that this module does not import the package. */
19
+ export interface TextPackage {
20
+ getMainDocumentPart(): MainLike;
21
+ getPropertyResolver(): Promise<PropertyResolver>;
22
+ getNumberingEmulator(): Promise<unknown>;
23
+ readonly propertyResolverOrUndefined?: PropertyResolver;
24
+ readonly docPropsCorePart?: XmlPart<core.CoreProperties>;
25
+ readonly docPropsExtendedPart?: XmlPart<extended.Properties>;
26
+ readonly docPropsCustomPart?: XmlPart<custom.Properties>;
27
+ readonly customXmlDataStorageParts: ReadonlyMap<string, {
28
+ parseDocument(): Promise<Document>;
29
+ readonly partName: {
30
+ readonly name: string;
31
+ };
32
+ }>;
33
+ xpathEngine: XPathEngine;
34
+ /** The names the container held twice, read from the first under `repair: 'word'` (CR-024). */
35
+ readonly duplicateEntries?: readonly {
36
+ readonly entry: string;
37
+ readonly count: number;
38
+ }[];
39
+ /** More than one officeDocument relationship, the last's target read under `repair: 'word'` (CR-024 section 9). */
40
+ readonly multipleMainParts?: {
41
+ readonly partName: string;
42
+ readonly count: number;
43
+ } | undefined;
44
+ /** An `External` officeDocument relationship beside an internal one, dropped under `repair: 'all'` (CR-031). */
45
+ readonly externalMainPart?: {
46
+ readonly partName: string;
47
+ readonly urls: readonly string[];
48
+ } | undefined;
49
+ /** The relationships parts read by local name under `repair: 'word'` (CR-031 section 2.3). */
50
+ readonly relationshipsNamespaces?: readonly {
51
+ readonly partName: string;
52
+ readonly count: number;
53
+ }[];
54
+ /** What the load repaired (REQ-207's `repaired`, CR-031). */
55
+ readonly repaired?: 'none' | 'word' | 'own';
56
+ }
57
+ /** As much of a `MainDocumentPart` as a reading uses. */
58
+ export interface MainLike extends XmlPart<wml.Document> {
59
+ readonly styleDefinitionsPart?: Part;
60
+ readonly numberingDefinitionsPart?: XmlPart<wml.Numbering> & NumberingPartLike & {
61
+ getDefinitions(): Promise<NumberingDefinitions>;
62
+ };
63
+ readonly documentSettingsPart?: XmlPart<wml.CTSettings>;
64
+ readonly footnotesPart?: XmlPart<wml.CTFootnotes>;
65
+ readonly endnotesPart?: XmlPart<wml.CTEndnotes>;
66
+ readonly commentsPart?: XmlPart<wml.Comments>;
67
+ readonly commentsExtendedPart?: XmlPart<w15.CTCommentsEx>;
68
+ readonly commentsIdsPart?: XmlPart<w16cid.CTCommentsIds>;
69
+ readonly commentsExtensiblePart?: XmlPart<w16cex.CTCommentsExtensible>;
70
+ readonly glossaryDocumentPart?: XmlPart<wml.GlossaryDocument>;
71
+ readonly headerParts: XmlPart<wml.Hdr>[];
72
+ readonly footerParts: XmlPart<wml.Ftr>[];
73
+ }
74
+ /**
75
+ * A part a reading may need that it could not read (CR-012 section 28, WD REQ-801): its role, by what it supplies. Each is
76
+ * raised as `part.not_read`, naming the part, where the reading needs it.
77
+ */
78
+ export type UnreadPart = 'styles' | 'numbering' | 'settings' | 'core' | 'app' | 'custom';
79
+ /**
80
+ * The trees one reading walks, each read **privately** where its part was not unmarshalled
81
+ * (`XmlPart.readContents`), so that reading a document costs no part its byte-for-byte round trip
82
+ * (REQ-204), and the live tree where it was. Every story is read, so that the views' plan covers them
83
+ * all ("the view is the package's"); the glossary only when it is included.
84
+ */
85
+ export declare class PackageTrees {
86
+ readonly pkg: TextPackage | undefined;
87
+ main: {
88
+ part: MainLike;
89
+ document: wml.Document;
90
+ } | undefined;
91
+ footnotes: {
92
+ part: Part;
93
+ tree: wml.CTFootnotes;
94
+ } | undefined;
95
+ endnotes: {
96
+ part: Part;
97
+ tree: wml.CTEndnotes;
98
+ } | undefined;
99
+ comments: {
100
+ part: Part;
101
+ tree: wml.Comments;
102
+ } | undefined;
103
+ commentsExtended: w15.CTCommentsEx | undefined;
104
+ /**
105
+ * Each comment's `w16cex:dateUtc`, by its last paragraph's `w14:paraId` (upper case): the comments ids part gives the
106
+ * paragraph's durable id, the comments extensible part the durable id's date (REQ-702's offset; docx4j's `commentDatesUtc`).
107
+ */
108
+ readonly commentDatesUtc: Map<string, wml.XmlCalendar>;
109
+ /** Each header and footer part related from the main document part, with its content. */
110
+ readonly headersAndFooters: Map<Part, wml.Ftr | wml.Hdr>;
111
+ glossary: {
112
+ part: Part;
113
+ tree: wml.GlossaryDocument;
114
+ } | undefined;
115
+ /** Each story part that could not be read, with the reason: a reading taking it raises `content.not_read` (REQ-801). */
116
+ readonly unreadable: Map<Part, unknown>;
117
+ settings: wml.CTSettings | undefined;
118
+ /** The document properties under `core`, `app` and `custom` (REQ-515). */
119
+ properties: Record<string, unknown> | undefined;
120
+ /** The resolver, where the package has a styles part that can be read (docx4j makes none without one). */
121
+ resolver: PropertyResolver | undefined;
122
+ /**
123
+ * What the numbering resolves a style's `w:numPr` through: the package's resolver, else, where a styles or numbering part
124
+ * cannot be read, the reading's own without it (CR-012 section 28); undefined where the package has neither part.
125
+ */
126
+ private numberingResolver;
127
+ numbering: NumberingDefinitions | undefined;
128
+ /**
129
+ * The numbering this reading counts by: the numbering part's emulator, one of the reading's own where the styles cannot
130
+ * be read, or, where the numbering part is absent or cannot be read, one over Word's default definition, made at the
131
+ * first numbered paragraph (`numberingFor`).
132
+ */
133
+ emulator: Emulator | undefined;
134
+ /** Where the numbering part is absent or cannot be read: the warning the first numbered paragraph raises, and the part named. */
135
+ numberingMissing: {
136
+ kind: 'part.absent' | 'part.not_read';
137
+ partName: string;
138
+ } | undefined;
139
+ /** The parts this reading could not read that it may need, by role, each with its part's name (CR-012 section 28). */
140
+ readonly notRead: Map<UnreadPart, string>;
141
+ /** The custom XML stores and properties parts a binding could not be read against, by normalised store item id: their part names. */
142
+ private readonly unreadStores;
143
+ /** The core and application properties' DOMs, by their normalised store item ids. */
144
+ private readonly stores;
145
+ /** The custom XML parts' DOMs, in the package's order: what a binding resolves to (CR-020). */
146
+ private readonly customStores;
147
+ private readonly storeItems;
148
+ private xpath;
149
+ private anchored;
150
+ private constructor();
151
+ /** The trees of a package. */
152
+ static read(pkg: TextPackage): Promise<PackageTrees>;
153
+ /**
154
+ * The resolver and the numbering (CR-012 section 28, WD REQ-801). The package's own where they can be built; where a
155
+ * styles or numbering part cannot be read, a resolver of the reading's own without it, as for a package that lacks the
156
+ * part, the part kept in `notRead`. The package's resolver is never set from it, so the content API still refuses the
157
+ * part (CR-001 section 26), and a part put right is read again by the next reading. Where the styles cannot be read the
158
+ * numbering's definitions are read directly and counted by an emulator of the reading's own, so that nothing is kept on
159
+ * the numbering part. A numbering part absent or unread is Word's default definition (`numberingFor`, WD 0.76).
160
+ */
161
+ private readStylesAndNumbering;
162
+ /** `commentDatesUtc`, from the comments ids and extensible parts, read privately; neither read, as D3 (a) leaves them, nothing. */
163
+ private readCommentDates;
164
+ /** `readContents()`, undefined for a part that cannot be read, which is then kept in `notRead` under its role. */
165
+ private readOrNote;
166
+ /**
167
+ * The numbering a numbered paragraph is counted by. Where the numbering part is absent or cannot be read, Word's default
168
+ * definition (WD 0.76, REQ-510), made here once, at the first numbered paragraph, and never written to the package: one
169
+ * abstract definition of nine decimal levels, each `w:start` 1 and `w:lvlText` `%{level+1}.`, and one instance per
170
+ * `w:numId` other than 0 the document names, plain where a paragraph style's `w:numPr` names it, else with a
171
+ * `w:startOverride` of 1 at every level, so that the direct paragraphs restart at their first and then share the style's
172
+ * count.
173
+ */
174
+ numberingFor(): Emulator | undefined;
175
+ /** Trees with no package: content read as it stands (docx4j's planless `Texts.of(content)`). */
176
+ static none(): PackageTrees;
177
+ /** The glossary document, read when `include: glossary` first asks for it. */
178
+ readGlossary(): Promise<void>;
179
+ /** A story part's content; undefined where it has none, and where it could not be read, then kept in `unreadable`. */
180
+ private readStory;
181
+ private readStores;
182
+ /**
183
+ * A data binding's value, docx4j `BoundValues`: the binding's XPath, with its own prefix mappings,
184
+ * against the custom XML part its `w:storeItemID` names (or the core or application properties), or,
185
+ * where it names none, the part its XPath fits, as Word repairs it (CR-020; nothing is written back);
186
+ * the string value of the first node selected. Undefined where the binding does not resolve.
187
+ */
188
+ boundValue(binding: wml.CTDataBinding): string | undefined;
189
+ /**
190
+ * The name of the part a binding names that could not be read: a custom XML store, or the core or application
191
+ * properties (CR-012 section 28, D3); undefined where it names a part that was read, or none.
192
+ */
193
+ unreadStoreOf(binding: wml.CTDataBinding): string | undefined;
194
+ /** The nodes an XPath selects in a store, with a binding's prefix mappings (the default namespace's left out). */
195
+ private selectIn;
196
+ /**
197
+ * The ids of the comments anchored in the document: a `w:commentReference` or a `w:commentRangeStart`
198
+ * in the main document, a header or footer, or a note, in any branch.
199
+ */
200
+ anchoredComments(): Set<string>;
201
+ /** Every story's body, over these trees, for the views' plan: the main document, each note and comment, the headers and footers. */
202
+ stories(): Body[];
203
+ /** The part whose tree holds an object, by its `PARENT`s, or undefined. */
204
+ partOf(object: unknown): Part | undefined;
205
+ }
206
+ /**
207
+ * What a story needs from the rest of the document (CR-012 section 4.4): the note references' order, for
208
+ * `[n]`; the numbering states per story, for list labels and `value`; the bookmarks, for `fields: update`;
209
+ * and, made once, each view's plan of what Accept All or Reject All would leave. A call given a context
210
+ * uses it and adds to it, so that the editor's calls over one part at a time, in the order the
211
+ * specification reads the stories (REQ-501), number the notes and count the lists as one reading of the
212
+ * whole package does; `TextResult.concat` assembles their results.
213
+ *
214
+ * A context is a snapshot of the package as it was read (`Texts.contextOf`): after the package changes,
215
+ * make another. It is for one reading, in one view: the calls under it take the same options, as the parts
216
+ * of one `Texts.of(pkg)` would.
217
+ */
218
+ export declare class TextContext {
219
+ readonly trees: PackageTrees;
220
+ /** Notes referenced, in reference order: id to number, 0 for a note with a custom mark. */
221
+ readonly footnotes: Map<string, number>;
222
+ readonly endnotes: Map<string, number>;
223
+ private footnoteCount;
224
+ private endnoteCount;
225
+ /** The numbering states, one per story (`Emulator`). */
226
+ readonly numberingStates: NumberingStates;
227
+ /** The `w:lastRenderedPageBreak`s of the main story so far (REQ-708). */
228
+ pageMarkers: number;
229
+ /** The bookmarks' text, by lower-cased name (REQ-506's REF, CR-012 phase 5a). */
230
+ readonly bookmarks: Map<string, string>;
231
+ /** Whether the main story has been read under this context, which numbers the notes. */
232
+ mainRead: boolean;
233
+ /**
234
+ * The view the context's first call read in: its note numbers and counts are that view's, so a call in
235
+ * another view is refused (`Texts.of`).
236
+ */
237
+ view: 'accepted' | 'original' | 'markup' | undefined;
238
+ private readonly plans;
239
+ /** Per container, then per options, what the blocks begin inside (`Extractor.fieldsAtBlocks`), made once; shared with siblings. */
240
+ private starts;
241
+ constructor(trees: PackageTrees);
242
+ /** What `make` gives for a container's blocks under options keyed `key`, made once in this context (CR-012 section 17.13). */
243
+ blockStarts<T>(container: object, key: string, make: () => T): T;
244
+ /** The package this context reads. */
245
+ get pkg(): TextPackage | undefined;
246
+ /** A note's number, given at its first reference: in reference order, footnotes and endnotes apart, 0 for a custom mark (REQ-503). */
247
+ noteNumber(type: NoteType, id: string, customMark: boolean): number;
248
+ /** The plan of Accept All (`accepted`) or Reject All, over every story, made once. */
249
+ plan(accepted: boolean): ResolvedView;
250
+ /** A context over the same trees and plans, its own notes and states: for a reading whose blocks are not the result's. */
251
+ sibling(): TextContext;
252
+ /** Adopts the note numbers another context gave (`sibling`'s, for a notes part read before its story). */
253
+ adoptNotes(other: TextContext): void;
254
+ }
255
+ /** An XML calendar as its lexical form. */
256
+ export declare function calendarText(date: unknown): string | undefined;