@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.
- package/NOTICE +4 -0
- package/README.md +92 -4
- package/dist/html/convert.mjs +2 -1
- package/dist/html/elements.mjs +2 -1
- package/dist/model/color/ColorMath.d.mts +29 -0
- package/dist/model/color/ColorMath.mjs +146 -0
- package/dist/model/color/ColorTables.d.mts +6 -0
- package/dist/model/color/ColorTables.mjs +83 -0
- package/dist/model/color/DrawingMLColors.d.mts +52 -0
- package/dist/model/color/DrawingMLColors.mjs +374 -0
- package/dist/model/color/ResolvedColor.d.mts +36 -0
- package/dist/model/color/ResolvedColor.mjs +65 -0
- package/dist/model/color/SpreadsheetColors.d.mts +36 -0
- package/dist/model/color/SpreadsheetColors.mjs +84 -0
- package/dist/model/color/StyleFill.d.mts +28 -0
- package/dist/model/color/StyleFill.mjs +21 -0
- package/dist/model/color/ThemeColors.d.mts +86 -0
- package/dist/model/color/ThemeColors.mjs +304 -0
- package/dist/model/color/WordColors.d.mts +71 -0
- package/dist/model/color/WordColors.mjs +121 -0
- package/dist/model/color/index.d.mts +6 -0
- package/dist/model/color/index.mjs +30 -0
- package/dist/model/content/Body.d.mts +145 -23
- package/dist/model/content/Body.mjs +507 -150
- package/dist/model/content/Comment.d.mts +23 -5
- package/dist/model/content/Comment.mjs +207 -26
- package/dist/model/content/ContentControl.d.mts +198 -19
- package/dist/model/content/ContentControl.mjs +672 -99
- package/dist/model/content/Font.d.mts +70 -17
- package/dist/model/content/Font.mjs +119 -36
- package/dist/model/content/InlinePicture.d.mts +11 -0
- package/dist/model/content/InlinePicture.mjs +21 -1
- package/dist/model/content/List.d.mts +6 -3
- package/dist/model/content/List.mjs +18 -8
- package/dist/model/content/Paragraph.d.mts +200 -14
- package/dist/model/content/Paragraph.mjs +898 -82
- package/dist/model/content/Range.d.mts +227 -12
- package/dist/model/content/Range.mjs +785 -59
- package/dist/model/content/ResolvedView.d.mts +104 -0
- package/dist/model/content/ResolvedView.mjs +596 -0
- package/dist/model/content/Table.d.mts +29 -3
- package/dist/model/content/Table.mjs +135 -49
- package/dist/model/content/TrackedChange.d.mts +174 -15
- package/dist/model/content/TrackedChange.mjs +734 -170
- package/dist/model/content/comments.d.mts +20 -6
- package/dist/model/content/comments.mjs +67 -57
- package/dist/model/content/generalException.d.mts +18 -0
- package/dist/model/content/generalException.mjs +24 -0
- package/dist/model/content/index.d.mts +10 -3
- package/dist/model/content/index.mjs +10 -2
- package/dist/model/content/mathText.d.mts +21 -0
- package/dist/model/content/mathText.mjs +267 -0
- package/dist/model/content/officeText.d.mts +27 -0
- package/dist/model/content/officeText.mjs +74 -0
- package/dist/model/content/ooxml.mjs +12 -1
- package/dist/model/content/outline.d.mts +5 -0
- package/dist/model/content/outline.mjs +13 -0
- package/dist/model/content/paraIds.d.mts +5 -0
- package/dist/model/content/paraIds.mjs +54 -0
- package/dist/model/content/placeholders.d.mts +110 -0
- package/dist/model/content/placeholders.mjs +253 -0
- package/dist/model/content/search.d.mts +74 -0
- package/dist/model/content/search.mjs +255 -9
- package/dist/model/content/spanEdits.d.mts +159 -0
- package/dist/model/content/spanEdits.mjs +728 -0
- package/dist/model/content/story.d.mts +47 -0
- package/dist/model/content/story.mjs +95 -0
- package/dist/model/content/tableColumns.d.mts +1 -1
- package/dist/model/content/tableColumns.mjs +108 -80
- package/dist/model/content/tableRevisions.d.mts +11 -3
- package/dist/model/content/tableRevisions.mjs +72 -42
- package/dist/model/content/tableRules.d.mts +30 -0
- package/dist/model/content/tableRules.mjs +102 -0
- package/dist/model/content/textBoxes.d.mts +18 -0
- package/dist/model/content/textBoxes.mjs +105 -0
- package/dist/model/content/trackedChangeFilter.d.mts +39 -0
- package/dist/model/content/trackedChangeFilter.mjs +81 -0
- package/dist/model/content/tracking.d.mts +63 -6
- package/dist/model/content/tracking.mjs +242 -22
- package/dist/model/content/tree.d.mts +172 -24
- package/dist/model/content/tree.mjs +328 -54
- package/dist/model/content/wordRange.d.mts +48 -0
- package/dist/model/content/wordRange.mjs +97 -0
- package/dist/model/customxml/CustomXmlPartCollection.d.mts +30 -1
- package/dist/model/customxml/CustomXmlPartCollection.mjs +81 -12
- package/dist/model/customxml/XmlMapping.d.mts +32 -8
- package/dist/model/customxml/XmlMapping.mjs +64 -10
- package/dist/model/customxml/bindings.d.mts +33 -4
- package/dist/model/customxml/bindings.mjs +171 -45
- package/dist/model/customxml/index.d.mts +1 -0
- package/dist/model/customxml/index.mjs +1 -0
- package/dist/model/customxml/kinds.d.mts +8 -3
- package/dist/model/customxml/kinds.mjs +26 -5
- package/dist/model/customxml/opendope.d.mts +4 -1
- package/dist/model/customxml/opendope.mjs +9 -6
- package/dist/model/customxml/picturePlaceholder.d.mts +17 -0
- package/dist/model/customxml/picturePlaceholder.mjs +32 -0
- package/dist/model/customxml/pictures.d.mts +4 -3
- package/dist/model/customxml/pictures.mjs +22 -8
- package/dist/model/customxml/storeItems.d.mts +57 -0
- package/dist/model/customxml/storeItems.mjs +122 -0
- package/dist/model/customxml/xhtml.mjs +23 -22
- package/dist/model/dateZone.d.mts +25 -0
- package/dist/model/dateZone.mjs +57 -0
- package/dist/model/index.d.mts +3 -0
- package/dist/model/index.mjs +5 -0
- package/dist/model/listnumbering/Emulator.d.mts +37 -5
- package/dist/model/listnumbering/Emulator.mjs +63 -9
- package/dist/model/properties/PropertyResolver.d.mts +74 -2
- package/dist/model/properties/PropertyResolver.mjs +133 -5
- package/dist/model/properties/catalogue.d.mts +19 -5
- package/dist/model/properties/catalogue.mjs +41 -15
- package/dist/model/properties/index.d.mts +1 -1
- package/dist/model/properties/log.d.mts +1 -1
- package/dist/model/properties/log.mjs +5 -5
- package/dist/model/properties/styleUtil.d.mts +3 -1
- package/dist/model/properties/styleUtil.mjs +20 -24
- package/dist/model/properties/table.mjs +4 -2
- package/dist/model/text/CaseMapping.d.mts +38 -0
- package/dist/model/text/CaseMapping.mjs +86 -0
- package/dist/model/text/Extractor.d.mts +349 -0
- package/dist/model/text/Extractor.mjs +2406 -0
- package/dist/model/text/LinkTargets.d.mts +45 -0
- package/dist/model/text/LinkTargets.mjs +170 -0
- package/dist/model/text/MarkdownExporter.d.mts +140 -0
- package/dist/model/text/MarkdownExporter.mjs +255 -0
- package/dist/model/text/PlainText.d.mts +29 -0
- package/dist/model/text/PlainText.mjs +542 -0
- package/dist/model/text/TextContext.d.mts +256 -0
- package/dist/model/text/TextContext.mjs +600 -0
- package/dist/model/text/TextOptions.d.mts +233 -0
- package/dist/model/text/TextOptions.mjs +419 -0
- package/dist/model/text/TextResult.d.mts +621 -0
- package/dist/model/text/TextResult.mjs +629 -0
- package/dist/model/text/Texts.d.mts +99 -0
- package/dist/model/text/Texts.mjs +187 -0
- package/dist/model/text/WmlToMarkdown.d.mts +120 -0
- package/dist/model/text/WmlToMarkdown.mjs +936 -0
- package/dist/model/text/caseMapping.generated.d.mts +7 -0
- package/dist/model/text/caseMapping.generated.mjs +214 -0
- package/dist/model/text/commonmark.d.mts +121 -0
- package/dist/model/text/commonmark.mjs +655 -0
- package/dist/model/text/index.d.mts +8 -0
- package/dist/model/text/index.mjs +9 -0
- package/dist/model/text/normalize.d.mts +8 -0
- package/dist/model/text/normalize.mjs +13 -0
- package/dist/model/text/outline.d.mts +4 -0
- package/dist/model/text/outline.mjs +71 -0
- package/dist/model/wordIntegers.d.mts +29 -0
- package/dist/model/wordIntegers.mjs +78 -0
- package/dist/office-js/document.mjs +15 -1
- package/dist/office-js/fragment.d.mts +7 -5
- package/dist/office-js/fragment.mjs +63 -14
- package/dist/office-js/proxy.d.mts +8 -0
- package/dist/office-js/proxy.mjs +29 -0
- package/dist/office-js/run.mjs +2 -0
- package/dist/office-js/supported.generated.mjs +16 -0
- package/dist/office-js/toApiScript.mjs +29 -12
- package/dist/opc/DirectoryPartStore.d.mts +6 -2
- package/dist/opc/DirectoryPartStore.mjs +11 -4
- package/dist/opc/FlatOpcPartStore.d.mts +4 -2
- package/dist/opc/FlatOpcPartStore.mjs +11 -8
- package/dist/opc/Load.d.mts +32 -0
- package/dist/opc/Load.mjs +115 -5
- package/dist/opc/PartStore.d.mts +34 -1
- package/dist/opc/PartStore.mjs +71 -8
- package/dist/opc/Save.d.mts +32 -0
- package/dist/opc/Save.mjs +110 -4
- package/dist/opc/ZipPartStore.d.mts +4 -2
- package/dist/opc/ZipPartStore.mjs +12 -7
- package/dist/opc/exceptions.d.mts +140 -0
- package/dist/opc/exceptions.mjs +108 -0
- package/dist/opc/index.d.mts +8 -5
- package/dist/opc/index.mjs +5 -3
- package/dist/opc/mce/preprocessor.d.mts +141 -5
- package/dist/opc/mce/preprocessor.mjs +119 -18
- package/dist/opc/mce/understood.d.mts +3 -11
- package/dist/opc/mce/understood.mjs +27 -23
- package/dist/opc/repair/breaks.d.mts +23 -0
- package/dist/opc/repair/breaks.mjs +288 -0
- package/dist/opc/repair/hosts.d.mts +12 -0
- package/dist/opc/repair/hosts.mjs +33 -0
- package/dist/opc/repair/mainRoot.d.mts +19 -0
- package/dist/opc/repair/mainRoot.mjs +168 -0
- package/dist/opc/repair/unknownElements.d.mts +8 -0
- package/dist/opc/repair/unknownElements.mjs +180 -0
- package/dist/opc/repair/wmlNames.generated.d.mts +2 -0
- package/dist/opc/repair/wmlNames.generated.mjs +80 -0
- package/dist/opc/skipped.d.mts +50 -0
- package/dist/opc/skipped.mjs +140 -0
- package/dist/packages/OpcPackage.d.mts +110 -4
- package/dist/packages/OpcPackage.mjs +123 -7
- package/dist/packages/WordprocessingMLPackage.d.mts +45 -8
- package/dist/packages/WordprocessingMLPackage.mjs +158 -21
- package/dist/packages/index.d.mts +1 -1
- package/dist/parts/DefaultXmlPart.mjs +2 -2
- package/dist/parts/Part.d.mts +14 -2
- package/dist/parts/RelationshipsPart.d.mts +15 -0
- package/dist/parts/RelationshipsPart.mjs +66 -1
- package/dist/parts/XmlPart.d.mts +63 -32
- package/dist/parts/XmlPart.mjs +240 -96
- package/dist/parts/wml/comments.mjs +30 -0
- package/dist/parts/wml/index.d.mts +12 -1
- package/dist/parts/wml/index.mjs +37 -1
- package/dist/xml/dom.d.mts +7 -0
- package/dist/xml/dom.mjs +18 -0
- 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
|
-
/**
|
|
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`
|
|
31
|
-
*
|
|
32
|
-
*
|
|
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
|
|
99
|
-
* accepted one: the runs of a `w:ins` or `w:moveTo`
|
|
100
|
-
* do not. `{ view: 'original' }` is the other way round
|
|
101
|
-
* lists the drawn objects too, each a segment of no text where
|
|
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`
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
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
|
-
/**
|
|
110
|
-
export
|
|
111
|
-
|
|
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
|
|
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
|
-
/**
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
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. */
|