@docx-editor.dev/core 2.5.0 → 2.6.1
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/THIRD_PARTY_NOTICES.md +39 -1
- package/dist/automation.cjs +1 -1
- package/dist/automation.d.cts +6 -6
- package/dist/automation.d.ts +6 -6
- package/dist/automation.js +1 -1
- package/dist/binding.cjs +1 -1
- package/dist/binding.d.cts +12 -12
- package/dist/binding.d.ts +12 -12
- package/dist/binding.js +1 -1
- package/dist/chunk-4GQXAXTZ.js +5 -0
- package/dist/chunk-DGUHCJPF.cjs +18 -0
- package/dist/{chunk-2GSRLGUI.cjs → chunk-DY3QVCWC.cjs} +6 -6
- package/dist/{chunk-45FL7KH4.js → chunk-E7BXJ4BF.js} +1 -1
- package/dist/chunk-F7Z6PWAZ.cjs +2 -0
- package/dist/chunk-JEMP5YI5.cjs +15 -0
- package/dist/{chunk-3FRSOOND.cjs → chunk-JZXK4DKV.cjs} +1 -1
- package/dist/chunk-NIGGABAA.js +15 -0
- package/dist/chunk-OPKOTVQQ.js +18 -0
- package/dist/{chunk-GOEBQ26R.js → chunk-PSZH2VXP.js} +1 -1
- package/dist/{chunk-LJIX4ZDF.js → chunk-R75OLPL6.js} +6 -6
- package/dist/{chunk-JDHTCMFA.cjs → chunk-SFMAIFEN.cjs} +1 -1
- package/dist/chunk-SKWYEZCO.cjs +5 -0
- package/dist/{chunk-YTZIGUXT.js → chunk-SMRD66T5.js} +1 -1
- package/dist/chunk-WAVN7MAT.js +2 -0
- package/dist/chunk-WU7PUTVA.js +2 -0
- package/dist/{chunk-OHJQ7GPZ.cjs → chunk-YMYCPY5Y.cjs} +1 -1
- package/dist/{content-control-walk-BeAFh6Xi.d.cts → content-control-walk-CbTqHq6O.d.cts} +1 -1
- package/dist/{content-control-walk-CQp8l6eS.d.ts → content-control-walk-D06GijR0.d.ts} +1 -1
- package/dist/contracts/editor.cjs +1 -1
- package/dist/contracts/editor.d.cts +10 -10
- package/dist/contracts/editor.d.ts +10 -10
- package/dist/contracts/editor.js +1 -1
- package/dist/contracts/interaction.d.cts +9 -9
- package/dist/contracts/interaction.d.ts +9 -9
- package/dist/contracts/modules.d.cts +5 -5
- package/dist/contracts/modules.d.ts +5 -5
- package/dist/contracts/types.d.cts +3 -1
- package/dist/contracts/types.d.ts +3 -1
- package/dist/{custom-node-writes-CIC_-wad.d.cts → custom-node-writes-D9G3GKQ7.d.cts} +7 -7
- package/dist/{custom-node-writes-2clI36T9.d.ts → custom-node-writes-tJw8U9MO.d.ts} +7 -7
- package/dist/dist-YFULGVS3.js +2 -0
- package/dist/{editor-CUul9IuY.d.cts → editor-BZEJL3vv.d.cts} +33 -19
- package/dist/{editor-DIwctMcU.d.ts → editor-D2zOJztO.d.ts} +33 -19
- package/dist/editor.cjs +1 -1
- package/dist/editor.css +375 -38
- package/dist/editor.d.cts +42 -26
- package/dist/editor.d.ts +42 -26
- package/dist/editor.js +1 -1
- package/dist/harfbuzz.wasm +0 -0
- package/dist/{hf-references-CAp1xTv6.d.ts → hf-references-BdjsQNE_.d.ts} +2 -2
- package/dist/{hf-references-BPET4tlK.d.cts → hf-references-CgEOSw3i.d.cts} +2 -2
- package/dist/{image-resources-CSlQmPIm.d.cts → image-resources-BaHz4QAd.d.cts} +10 -10
- package/dist/{image-resources-e13t-pgy.d.ts → image-resources-Cl5_cNi9.d.ts} +10 -10
- package/dist/{index-BUsYjxF5.d.ts → index-D8L8WrNF.d.ts} +111 -21
- package/dist/{index-8t44iXTY.d.cts → index-_xF7n_z0.d.cts} +111 -21
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +20 -20
- package/dist/index.d.ts +20 -20
- package/dist/index.js +1 -1
- package/dist/layout.cjs +1 -1
- package/dist/layout.d.cts +71 -23
- package/dist/layout.d.ts +71 -23
- package/dist/layout.js +1 -1
- package/dist/node-module-shim-TTKTT66I.js +1 -0
- package/dist/{note-nodes-CZQXU6Fg.d.ts → note-nodes-BPSTVDMr.d.ts} +1 -1
- package/dist/{note-nodes-B2wWES2L.d.cts → note-nodes-C6DLxlvj.d.cts} +1 -1
- package/dist/{ooxml-package-Cmbe_M04.d.cts → ooxml-package-CR5us6ad.d.cts} +115 -115
- package/dist/{ooxml-package-BrxTmTsZ.d.ts → ooxml-package-D_CtywTW.d.ts} +115 -115
- package/dist/{ooxml-tree-CG0odFyi.d.cts → ooxml-tree-BU0e3DVi.d.cts} +1 -1
- package/dist/{ooxml-tree-CG0odFyi.d.ts → ooxml-tree-BU0e3DVi.d.ts} +1 -1
- package/dist/output.cjs +1 -1
- package/dist/output.d.cts +22 -8
- package/dist/output.d.ts +22 -8
- package/dist/output.js +1 -1
- package/dist/{protocol-B5oSt08P.d.cts → protocol-CD7slqvl.d.cts} +2 -2
- package/dist/{protocol-ooK7PAXz.d.ts → protocol-DsbfgBwA.d.ts} +2 -2
- package/dist/{note-properties-Dhqkro--.d.cts → review-reads-Dr0CpW6u.d.cts} +67 -67
- package/dist/{note-properties-BS66XmcC.d.ts → review-reads-HDvoQXK2.d.ts} +67 -67
- package/dist/{review-support-Bl9sN8cv.d.ts → review-support-D4ZBdUXa.d.ts} +2 -2
- package/dist/{review-support-CHuJxHmz.d.cts → review-support-T-riLz4Y.d.cts} +2 -2
- package/dist/{revision-projection-u4nT52xT.d.ts → revision-projection-UKqvPa4-.d.ts} +1 -1
- package/dist/{revision-projection-DRZMzoLD.d.cts → revision-projection-WzlQGBJx.d.cts} +1 -1
- package/dist/{semantic-cell-selection-Dc-_enhm.d.ts → semantic-cell-selection-B5vfPz4Q.d.ts} +4 -4
- package/dist/{semantic-cell-selection-CdNQ-a9-.d.cts → semantic-cell-selection-BTQFpN0S.d.cts} +4 -4
- package/dist/{semantic-interaction-DgaWs-5w.d.cts → semantic-interaction-CDNEU_Tx.d.cts} +1 -1
- package/dist/{semantic-interaction-CCVwyw2A.d.ts → semantic-interaction-lvpzZRpA.d.ts} +1 -1
- package/dist/{semantic-paint-6iIB4fhx.d.cts → semantic-paint-BBPL3u5w.d.ts} +111 -3
- package/dist/{semantic-paint-CKIbFkQ7.d.ts → semantic-paint-IjbL-4CT.d.cts} +111 -3
- package/dist/{semantic-records-B-qbrnp2.d.ts → semantic-records-CdQvpUj1.d.ts} +4 -4
- package/dist/{semantic-records-Dq8SlCY8.d.cts → semantic-records-DEOs3_tE.d.cts} +4 -4
- package/dist/{shaped-measurer-Dx4llNhK.d.cts → shaped-measurer-C2SJAjV0.d.cts} +1 -1
- package/dist/{shaped-measurer-BT4FqYe9.d.ts → shaped-measurer-l4o5ITJ0.d.ts} +1 -1
- package/dist/store.cjs +1 -1
- package/dist/store.d.cts +238 -238
- package/dist/store.d.ts +238 -238
- package/dist/store.js +1 -1
- package/dist/{tree-op-types-DOYNkKqD.d.cts → tree-op-types-CUCwPWjT.d.cts} +219 -219
- package/dist/{tree-op-types-CZw9QhWX.d.ts → tree-op-types-D0fTNBVW.d.ts} +219 -219
- package/dist/{tree-session-CF_EOhTW.d.ts → tree-session-CH1oA75f.d.ts} +61 -45
- package/dist/{tree-session-CtK3KgFU.d.cts → tree-session-b7bggR-S.d.cts} +61 -45
- package/dist/{tree-store-Jg-q7fyf.d.cts → tree-store-BqgeCa1Q.d.cts} +3 -3
- package/dist/{tree-store-9TaX-L0V.d.ts → tree-store-CIKASRHk.d.ts} +3 -3
- package/licenses/HarfBuzz-COPYING.txt +42 -0
- package/package.json +5 -3
- package/dist/chunk-2QIA75K3.js +0 -2
- package/dist/chunk-32NXPFYL.js +0 -5
- package/dist/chunk-3C533HSQ.cjs +0 -18
- package/dist/chunk-7GYF33B5.cjs +0 -2
- package/dist/chunk-H3DZP4LE.cjs +0 -5
- package/dist/chunk-L2GMLEHX.cjs +0 -14
- package/dist/chunk-QUZM6LWQ.js +0 -14
- package/dist/chunk-T252F4US.js +0 -18
|
@@ -1,221 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
/** How deep controls may nest before a walk stops descending. Shared by every lane. */
|
|
4
|
-
declare const MAX_CONTENT_CONTROL_NESTING = 32;
|
|
5
|
-
/** Cap on controls one walk reports, so a hostile file cannot make a read unbounded. */
|
|
6
|
-
declare const MAX_CONTENT_CONTROLS_PER_PART = 10000;
|
|
7
|
-
/** `CT_SdtPr/w:id` is `ST_DecimalNumber`; Word treats it as a signed 32-bit integer. */
|
|
8
|
-
declare const CONTENT_CONTROL_ID_MAX = 2147483647;
|
|
9
|
-
/** `ST_Lock` (§17.5.2.24). An absent `w:lock` is `unlocked`. */
|
|
10
|
-
/**
|
|
11
|
-
* `w:lock` — what a control refuses.
|
|
12
|
-
*
|
|
13
|
-
* `sdtLocked` protects the wrapper, `contentLocked` the text inside it, and `sdtContentLocked`
|
|
14
|
-
* both. A control inside a locked one is locked in effect regardless of its own value.
|
|
15
|
-
*/
|
|
16
|
-
type ContentControlLock = 'unlocked' | 'sdtLocked' | 'contentLocked' | 'sdtContentLocked';
|
|
17
|
-
/**
|
|
18
|
-
* What kind of control this is.
|
|
19
|
-
*
|
|
20
|
-
* `checkbox` is the Microsoft `w14:checkbox` extension rather than an ECMA-376 type
|
|
21
|
-
* element, and the two are not mutually exclusive with "declares no type": four controls
|
|
22
|
-
* in the comprehensive fixture declare the extension and no `w:`-prefixed type, so a scan
|
|
23
|
-
* that read only the ECMA-376 choice reported them untyped. `untyped` means the control
|
|
24
|
-
* declares neither — a rich-text container, which is what Word treats it as.
|
|
25
|
-
*/
|
|
26
|
-
/** Which kind of control a `w:sdt` is, and therefore what a written value must look like. */
|
|
27
|
-
type ContentControlKind = 'richText' | 'plainText' | 'checkbox' | 'dropDownList' | 'comboBox' | 'date' | 'picture' | 'docPartObj' | 'docPartList' | 'group' | 'citation' | 'bibliography' | 'equation' | 'untyped';
|
|
28
|
-
/** One declared option of a dropdown or combo box: its display text and its stored value. */
|
|
29
|
-
interface ContentControlListItem {
|
|
30
|
-
readonly displayText: string;
|
|
31
|
-
readonly value: string;
|
|
32
|
-
}
|
|
33
|
-
/** A date picker's authored format and locale, for rendering and for parsing what it stores. */
|
|
34
|
-
interface ContentControlDateFormat {
|
|
35
|
-
readonly fullDate?: string;
|
|
36
|
-
readonly dateFormat?: string;
|
|
37
|
-
readonly lid?: string;
|
|
38
|
-
readonly storeMappedDataAs?: string;
|
|
39
|
-
readonly calendar?: string;
|
|
40
|
-
}
|
|
41
|
-
/** One of a checkbox's two glyphs: the font and code point it is drawn with. */
|
|
42
|
-
interface ContentControlCheckboxState {
|
|
43
|
-
/** The `w14:val` hex code point of the glyph, exactly as the control declares it. */
|
|
44
|
-
readonly value: string;
|
|
45
|
-
readonly font?: string;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* A checkbox's state and the two glyphs it chooses between.
|
|
49
|
-
*
|
|
50
|
-
* Both glyphs matter on a write: setting the value has to update `w14:checked` AND the run's
|
|
51
|
-
* character, or the document's glyph and its recorded state disagree.
|
|
52
|
-
*/
|
|
53
|
-
interface ContentControlCheckbox {
|
|
54
|
-
readonly checked: boolean;
|
|
55
|
-
readonly checkedState?: ContentControlCheckboxState;
|
|
56
|
-
readonly uncheckedState?: ContentControlCheckboxState;
|
|
57
|
-
}
|
|
58
|
-
/** `CT_DataBinding` — preserved metadata. Never resolved, never fetched. */
|
|
59
|
-
/** `w:dataBinding` — the custom-XML part and XPath a control's value is bound to. */
|
|
60
|
-
interface ContentControlDataBinding {
|
|
61
|
-
readonly xpath?: string;
|
|
62
|
-
readonly storeItemID?: string;
|
|
63
|
-
readonly prefixMappings?: string;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* A control's whole `w:sdtPr`, projected into one typed shape.
|
|
67
|
-
*
|
|
68
|
-
* What every other lane reads instead of walking `localName` strings — which also means a Word
|
|
69
|
-
* re-save that demotes the properties node to generic does not break the projection.
|
|
70
|
-
*/
|
|
71
|
-
interface ContentControlProperties {
|
|
72
|
-
readonly type: ContentControlKind;
|
|
73
|
-
readonly alias?: string;
|
|
74
|
-
readonly tag?: string;
|
|
75
|
-
/** `@w:val` of `w:id` when the file declares a parseable one. Never fabricated. */
|
|
76
|
-
readonly id?: number;
|
|
77
|
-
readonly lock: ContentControlLock;
|
|
78
|
-
/** The glossary entry named by `w:placeholder/w:docPart`. Preserved, never loaded. */
|
|
79
|
-
readonly placeholderDocPart?: string;
|
|
80
|
-
readonly temporary: boolean;
|
|
81
|
-
readonly showingPlaceholder: boolean;
|
|
82
|
-
readonly dataBinding?: ContentControlDataBinding;
|
|
83
|
-
readonly label?: string;
|
|
84
|
-
readonly tabIndex?: number;
|
|
85
|
-
/** Items a dropdown or combo box offers. Empty for every other type. */
|
|
86
|
-
readonly listItems: readonly ContentControlListItem[];
|
|
87
|
-
readonly lastValue?: string;
|
|
88
|
-
readonly date?: ContentControlDateFormat;
|
|
89
|
-
readonly multiLine?: boolean;
|
|
90
|
-
readonly checkbox?: ContentControlCheckbox;
|
|
91
|
-
}
|
|
92
|
-
/** Whether a node is a `w:sdt` wrapper. */
|
|
93
|
-
declare function isContentControlNode(node: OoxmlNode): node is OoxmlContentControlNode;
|
|
94
|
-
/** Whether a node is a `w:sdtContent` — the container holding a control's actual content. */
|
|
95
|
-
declare function isContentControlContentNode(node: OoxmlNode): node is OoxmlContentControlContentNode;
|
|
96
|
-
/**
|
|
97
|
-
* A `w:sdt` wrapper, TYPED or DEMOTED.
|
|
98
|
-
*
|
|
99
|
-
* Flattening predates typing and must not stop at a control the reader refused to type: a
|
|
100
|
-
* demoted wrapper still renders its content in place in Word, so a walk that only saw the
|
|
101
|
-
* typed kind would drop every paragraph inside a malformed control out of the story.
|
|
102
|
-
*/
|
|
103
|
-
declare function isContentControlWrapper(node: OoxmlNode): boolean;
|
|
104
|
-
/**
|
|
105
|
-
* The children of a wrapper's `w:sdtContent`, typed or demoted, in order.
|
|
106
|
-
*
|
|
107
|
-
* The one place that knows a control's content is reached through an intermediate element,
|
|
108
|
-
* so the four flattening walks (story blocks, layout, header/footer references, list
|
|
109
|
-
* resolution) ask the same question rather than each re-deriving it.
|
|
110
|
-
*/
|
|
111
|
-
declare function contentControlContentChildren(wrapper: OoxmlNode): readonly OoxmlNode[];
|
|
112
|
-
/**
|
|
113
|
-
* A container's children with every content-control wrapper flattened away, bounded in depth.
|
|
114
|
-
*
|
|
115
|
-
* ONE unwrap rule, for the places where a control sits between a container and the children that
|
|
116
|
-
* container is defined in terms of. `CT_SdtRow` puts it between `w:tbl` and `w:tr`, `CT_SdtCell`
|
|
117
|
-
* between `w:tr` and `w:tc`, and a walk that filtered on the child's kind dropped the row or cell
|
|
118
|
-
* entirely: not measured, not painted, not addressable. Flattening at the point of the filter
|
|
119
|
-
* means a controlled row is the same row to the grid pass, the pagination pass and the story walk.
|
|
120
|
-
*
|
|
121
|
-
* Returns the SAME array identity when there is nothing to unwrap, so the tables that carry no
|
|
122
|
-
* controls — nearly all of them — allocate nothing and the incremental layout cache still sees
|
|
123
|
-
* its own inputs.
|
|
124
|
-
*/
|
|
125
|
-
declare function flattenContentControls(children: readonly OoxmlNode[], maxDepth?: number): readonly OoxmlNode[];
|
|
126
|
-
/** A control's `w:sdtPr`, or null. Matches structurally, so a Word-demoted node still resolves. */
|
|
127
|
-
declare function contentControlPropertiesNodeOf(control: OoxmlNode): OoxmlContentControlPropertiesNode | undefined;
|
|
128
|
-
/** A control's `w:sdtEndPr` — the run properties applied to its closing marker. */
|
|
129
|
-
declare function contentControlEndPropertiesNodeOf(control: OoxmlNode): OoxmlContentControlEndPropertiesNode | undefined;
|
|
130
|
-
/** A control's `w:sdtContent`, or null when the wrapper has none. */
|
|
131
|
-
declare function contentControlContentNodeOf(control: OoxmlNode): OoxmlContentControlContentNode | undefined;
|
|
132
|
-
/** A signed 32-bit `ST_DecimalNumber`, or undefined when the file wrote something else. */
|
|
133
|
-
declare function parseContentControlId(raw: string | undefined): number | undefined;
|
|
134
|
-
/**
|
|
135
|
-
* Read a control's properties.
|
|
136
|
-
*
|
|
137
|
-
* Total: a control with no `w:sdtPr` at all answers the same shape with the defaults an
|
|
138
|
-
* absent property means, so no caller has to branch on the container's existence.
|
|
139
|
-
*/
|
|
140
|
-
declare function contentControlPropertiesOf(control: OoxmlNode): ContentControlProperties;
|
|
141
|
-
/** Where a control sits, read off what its content holds. */
|
|
142
|
-
type ContentControlLevel = 'block' | 'inline' | 'row' | 'cell' | 'empty';
|
|
143
|
-
/**
|
|
144
|
-
* How deeply a control is nested inside other controls.
|
|
145
|
-
*
|
|
146
|
-
* Bounded by {@link MAX_CONTENT_CONTROL_NESTING}: nesting depth comes from a file and is a
|
|
147
|
-
* recursion bound.
|
|
148
|
-
*/
|
|
149
|
-
declare function contentControlLevelOf(control: OoxmlNode): ContentControlLevel;
|
|
150
|
-
/** One control, plus how deeply it is nested and the controls that enclose it. */
|
|
151
|
-
interface ContentControlEntry {
|
|
152
|
-
readonly node: OoxmlContentControlNode;
|
|
153
|
-
/** 0 for a top-level control; the nesting depth otherwise. */
|
|
154
|
-
readonly depth: number;
|
|
155
|
-
/** Enclosing controls, outermost first. Empty at depth 0. */
|
|
156
|
-
readonly ancestors: readonly OoxmlContentControlNode[];
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Every control under a node, in document order, bounded in depth and in count.
|
|
160
|
-
*
|
|
161
|
-
* ONE walk, shared. The nesting bound is the same one layout flattens with, so a control
|
|
162
|
-
* a lane can address is a control every lane can address — and a file that nests past it
|
|
163
|
-
* keeps its content in the tree (the serializer never stops) while no walk recurses
|
|
164
|
-
* further.
|
|
165
|
-
*/
|
|
166
|
-
declare function contentControlsIn(root: OoxmlNode, options?: {
|
|
167
|
-
readonly maxDepth?: number;
|
|
168
|
-
readonly limit?: number;
|
|
169
|
-
}): readonly ContentControlEntry[];
|
|
170
|
-
/** Find one control by canonical node id, with the same bounded walk. */
|
|
171
|
-
declare function findContentControl(root: OoxmlNode, nodeId: string): ContentControlEntry | null;
|
|
172
|
-
/**
|
|
173
|
-
* The plain text a control's content holds, in reading order.
|
|
174
|
-
*
|
|
175
|
-
* `w:delText` is excluded: struck text is not the control's value, and a dropdown whose
|
|
176
|
-
* old item is still present as a tracked deletion would otherwise report both.
|
|
177
|
-
*/
|
|
178
|
-
declare function contentControlTextOf(control: OoxmlNode): string;
|
|
179
|
-
/**
|
|
180
|
-
* Resolve the lock a position inherits from the controls enclosing it.
|
|
181
|
-
*
|
|
182
|
-
* CONSERVATIVE, because a template that says a field cannot be edited and sits inside a
|
|
183
|
-
* section that says it cannot be removed means both. Each half of `ST_Lock` is taken
|
|
184
|
-
* independently and the strongest wins, so an unlocked control inside a `contentLocked`
|
|
185
|
-
* one is still content-locked — a nested control cannot grant a permission its parent
|
|
186
|
-
* withheld, which is the only reading under which a lock is a lock.
|
|
187
|
-
*/
|
|
188
|
-
declare function resolveContentControlLock(chain: readonly ContentControlLock[]): ContentControlLock;
|
|
189
|
-
/** Whether a resolved lock forbids editing the content it covers. */
|
|
190
|
-
declare function lockForbidsEdit(lock: ContentControlLock): boolean;
|
|
191
|
-
/** Whether a resolved lock forbids removing the control itself. */
|
|
192
|
-
declare function lockForbidsRemoval(lock: ContentControlLock): boolean;
|
|
193
|
-
/**
|
|
194
|
-
* `CT_SdtPr`'s declared child order (§17.5.2.38), followed by the type choice.
|
|
195
|
-
*
|
|
196
|
-
* Serialization re-emits children in tree order, so the ONLY way a write keeps the
|
|
197
|
-
* sequence valid is to place the child it authors at its schema position — which is what
|
|
198
|
-
* {@link orderedContentControlProperties} does.
|
|
199
|
-
*/
|
|
200
|
-
declare const CONTENT_CONTROL_PROPERTY_ORDER: readonly string[];
|
|
201
|
-
/**
|
|
202
|
-
* Rebuild a `w:sdtPr`'s children in schema order.
|
|
203
|
-
*
|
|
204
|
-
* Modelled children sort to their declared position and the type element follows them,
|
|
205
|
-
* as the sequence requires. Everything else — a `w15:repeatingSection`, a vendor
|
|
206
|
-
* extension, the `w14:checkbox` that is not part of the ECMA-376 choice — keeps the order
|
|
207
|
-
* it was authored in and follows the modelled block, so a write that touches one property
|
|
208
|
-
* neither drops nor reorders anything it does not name.
|
|
209
|
-
*/
|
|
210
|
-
declare function orderedContentControlProperties(children: readonly OoxmlNode[]): readonly OoxmlNode[];
|
|
211
|
-
/**
|
|
212
|
-
* The next `w:id` to write, seeded from the document's own maximum plus one.
|
|
213
|
-
*
|
|
214
|
-
* Never a clock, a timestamp, a random source or a hash: those collide with ids already
|
|
215
|
-
* in the file and produce values Word rejects. Null when the document already reaches the
|
|
216
|
-
* signed 32-bit bound, so the caller refuses rather than wrapping into a negative id.
|
|
217
|
-
*/
|
|
218
|
-
declare function allocateContentControlId(root: OoxmlNode): number | null;
|
|
1
|
+
import { O as OoxmlNode, a as OoxmlElement, o as OoxmlDrawingNode, b as OoxmlContentControlNode, d as OoxmlContentControlContentNode, p as OoxmlContentControlEndPropertiesNode, q as OoxmlContentControlPropertiesNode, e as OoxmlPart } from './ooxml-tree-BU0e3DVi.js';
|
|
219
2
|
|
|
220
3
|
/** The relationship namespace `r:id` lives in. */
|
|
221
4
|
declare const OFFICE_RELATIONSHIP_NAMESPACE_URI = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
@@ -544,6 +327,223 @@ declare function projectDrawing(drawing: OoxmlDrawingNode, context: Readonly<{
|
|
|
544
327
|
resolveRelationship?: RelationshipTargetResolver;
|
|
545
328
|
}>): DrawingProjection | null;
|
|
546
329
|
|
|
330
|
+
/** How deep controls may nest before a walk stops descending. Shared by every lane. */
|
|
331
|
+
declare const MAX_CONTENT_CONTROL_NESTING = 32;
|
|
332
|
+
/** Cap on controls one walk reports, so a hostile file cannot make a read unbounded. */
|
|
333
|
+
declare const MAX_CONTENT_CONTROLS_PER_PART = 10000;
|
|
334
|
+
/** `CT_SdtPr/w:id` is `ST_DecimalNumber`; Word treats it as a signed 32-bit integer. */
|
|
335
|
+
declare const CONTENT_CONTROL_ID_MAX = 2147483647;
|
|
336
|
+
/** `ST_Lock` (§17.5.2.24). An absent `w:lock` is `unlocked`. */
|
|
337
|
+
/**
|
|
338
|
+
* `w:lock` — what a control refuses.
|
|
339
|
+
*
|
|
340
|
+
* `sdtLocked` protects the wrapper, `contentLocked` the text inside it, and `sdtContentLocked`
|
|
341
|
+
* both. A control inside a locked one is locked in effect regardless of its own value.
|
|
342
|
+
*/
|
|
343
|
+
type ContentControlLock = 'unlocked' | 'sdtLocked' | 'contentLocked' | 'sdtContentLocked';
|
|
344
|
+
/**
|
|
345
|
+
* What kind of control this is.
|
|
346
|
+
*
|
|
347
|
+
* `checkbox` is the Microsoft `w14:checkbox` extension rather than an ECMA-376 type
|
|
348
|
+
* element, and the two are not mutually exclusive with "declares no type": four controls
|
|
349
|
+
* in the comprehensive fixture declare the extension and no `w:`-prefixed type, so a scan
|
|
350
|
+
* that read only the ECMA-376 choice reported them untyped. `untyped` means the control
|
|
351
|
+
* declares neither — a rich-text container, which is what Word treats it as.
|
|
352
|
+
*/
|
|
353
|
+
/** Which kind of control a `w:sdt` is, and therefore what a written value must look like. */
|
|
354
|
+
type ContentControlKind = 'richText' | 'plainText' | 'checkbox' | 'dropDownList' | 'comboBox' | 'date' | 'picture' | 'docPartObj' | 'docPartList' | 'group' | 'citation' | 'bibliography' | 'equation' | 'untyped';
|
|
355
|
+
/** One declared option of a dropdown or combo box: its display text and its stored value. */
|
|
356
|
+
interface ContentControlListItem {
|
|
357
|
+
readonly displayText: string;
|
|
358
|
+
readonly value: string;
|
|
359
|
+
}
|
|
360
|
+
/** A date picker's authored format and locale, for rendering and for parsing what it stores. */
|
|
361
|
+
interface ContentControlDateFormat {
|
|
362
|
+
readonly fullDate?: string;
|
|
363
|
+
readonly dateFormat?: string;
|
|
364
|
+
readonly lid?: string;
|
|
365
|
+
readonly storeMappedDataAs?: string;
|
|
366
|
+
readonly calendar?: string;
|
|
367
|
+
}
|
|
368
|
+
/** One of a checkbox's two glyphs: the font and code point it is drawn with. */
|
|
369
|
+
interface ContentControlCheckboxState {
|
|
370
|
+
/** The `w14:val` hex code point of the glyph, exactly as the control declares it. */
|
|
371
|
+
readonly value: string;
|
|
372
|
+
readonly font?: string;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* A checkbox's state and the two glyphs it chooses between.
|
|
376
|
+
*
|
|
377
|
+
* Both glyphs matter on a write: setting the value has to update `w14:checked` AND the run's
|
|
378
|
+
* character, or the document's glyph and its recorded state disagree.
|
|
379
|
+
*/
|
|
380
|
+
interface ContentControlCheckbox {
|
|
381
|
+
readonly checked: boolean;
|
|
382
|
+
readonly checkedState?: ContentControlCheckboxState;
|
|
383
|
+
readonly uncheckedState?: ContentControlCheckboxState;
|
|
384
|
+
}
|
|
385
|
+
/** `CT_DataBinding` — preserved metadata. Never resolved, never fetched. */
|
|
386
|
+
/** `w:dataBinding` — the custom-XML part and XPath a control's value is bound to. */
|
|
387
|
+
interface ContentControlDataBinding {
|
|
388
|
+
readonly xpath?: string;
|
|
389
|
+
readonly storeItemID?: string;
|
|
390
|
+
readonly prefixMappings?: string;
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* A control's whole `w:sdtPr`, projected into one typed shape.
|
|
394
|
+
*
|
|
395
|
+
* What every other lane reads instead of walking `localName` strings — which also means a Word
|
|
396
|
+
* re-save that demotes the properties node to generic does not break the projection.
|
|
397
|
+
*/
|
|
398
|
+
interface ContentControlProperties {
|
|
399
|
+
readonly type: ContentControlKind;
|
|
400
|
+
readonly alias?: string;
|
|
401
|
+
readonly tag?: string;
|
|
402
|
+
/** `@w:val` of `w:id` when the file declares a parseable one. Never fabricated. */
|
|
403
|
+
readonly id?: number;
|
|
404
|
+
readonly lock: ContentControlLock;
|
|
405
|
+
/** The glossary entry named by `w:placeholder/w:docPart`. Preserved, never loaded. */
|
|
406
|
+
readonly placeholderDocPart?: string;
|
|
407
|
+
readonly temporary: boolean;
|
|
408
|
+
readonly showingPlaceholder: boolean;
|
|
409
|
+
readonly dataBinding?: ContentControlDataBinding;
|
|
410
|
+
readonly label?: string;
|
|
411
|
+
readonly tabIndex?: number;
|
|
412
|
+
/** Items a dropdown or combo box offers. Empty for every other type. */
|
|
413
|
+
readonly listItems: readonly ContentControlListItem[];
|
|
414
|
+
readonly lastValue?: string;
|
|
415
|
+
readonly date?: ContentControlDateFormat;
|
|
416
|
+
readonly multiLine?: boolean;
|
|
417
|
+
readonly checkbox?: ContentControlCheckbox;
|
|
418
|
+
}
|
|
419
|
+
/** Whether a node is a `w:sdt` wrapper. */
|
|
420
|
+
declare function isContentControlNode(node: OoxmlNode): node is OoxmlContentControlNode;
|
|
421
|
+
/** Whether a node is a `w:sdtContent` — the container holding a control's actual content. */
|
|
422
|
+
declare function isContentControlContentNode(node: OoxmlNode): node is OoxmlContentControlContentNode;
|
|
423
|
+
/**
|
|
424
|
+
* A `w:sdt` wrapper, TYPED or DEMOTED.
|
|
425
|
+
*
|
|
426
|
+
* Flattening predates typing and must not stop at a control the reader refused to type: a
|
|
427
|
+
* demoted wrapper still renders its content in place in Word, so a walk that only saw the
|
|
428
|
+
* typed kind would drop every paragraph inside a malformed control out of the story.
|
|
429
|
+
*/
|
|
430
|
+
declare function isContentControlWrapper(node: OoxmlNode): boolean;
|
|
431
|
+
/**
|
|
432
|
+
* The children of a wrapper's `w:sdtContent`, typed or demoted, in order.
|
|
433
|
+
*
|
|
434
|
+
* The one place that knows a control's content is reached through an intermediate element,
|
|
435
|
+
* so the four flattening walks (story blocks, layout, header/footer references, list
|
|
436
|
+
* resolution) ask the same question rather than each re-deriving it.
|
|
437
|
+
*/
|
|
438
|
+
declare function contentControlContentChildren(wrapper: OoxmlNode): readonly OoxmlNode[];
|
|
439
|
+
/**
|
|
440
|
+
* A container's children with every content-control wrapper flattened away, bounded in depth.
|
|
441
|
+
*
|
|
442
|
+
* ONE unwrap rule, for the places where a control sits between a container and the children that
|
|
443
|
+
* container is defined in terms of. `CT_SdtRow` puts it between `w:tbl` and `w:tr`, `CT_SdtCell`
|
|
444
|
+
* between `w:tr` and `w:tc`, and a walk that filtered on the child's kind dropped the row or cell
|
|
445
|
+
* entirely: not measured, not painted, not addressable. Flattening at the point of the filter
|
|
446
|
+
* means a controlled row is the same row to the grid pass, the pagination pass and the story walk.
|
|
447
|
+
*
|
|
448
|
+
* Returns the SAME array identity when there is nothing to unwrap, so the tables that carry no
|
|
449
|
+
* controls — nearly all of them — allocate nothing and the incremental layout cache still sees
|
|
450
|
+
* its own inputs.
|
|
451
|
+
*/
|
|
452
|
+
declare function flattenContentControls(children: readonly OoxmlNode[], maxDepth?: number): readonly OoxmlNode[];
|
|
453
|
+
/** A control's `w:sdtPr`, or null. Matches structurally, so a Word-demoted node still resolves. */
|
|
454
|
+
declare function contentControlPropertiesNodeOf(control: OoxmlNode): OoxmlContentControlPropertiesNode | undefined;
|
|
455
|
+
/** A control's `w:sdtEndPr` — the run properties applied to its closing marker. */
|
|
456
|
+
declare function contentControlEndPropertiesNodeOf(control: OoxmlNode): OoxmlContentControlEndPropertiesNode | undefined;
|
|
457
|
+
/** A control's `w:sdtContent`, or null when the wrapper has none. */
|
|
458
|
+
declare function contentControlContentNodeOf(control: OoxmlNode): OoxmlContentControlContentNode | undefined;
|
|
459
|
+
/** A signed 32-bit `ST_DecimalNumber`, or undefined when the file wrote something else. */
|
|
460
|
+
declare function parseContentControlId(raw: string | undefined): number | undefined;
|
|
461
|
+
/**
|
|
462
|
+
* Read a control's properties.
|
|
463
|
+
*
|
|
464
|
+
* Total: a control with no `w:sdtPr` at all answers the same shape with the defaults an
|
|
465
|
+
* absent property means, so no caller has to branch on the container's existence.
|
|
466
|
+
*/
|
|
467
|
+
declare function contentControlPropertiesOf(control: OoxmlNode): ContentControlProperties;
|
|
468
|
+
/** Where a control sits, read off what its content holds. */
|
|
469
|
+
type ContentControlLevel = 'block' | 'inline' | 'row' | 'cell' | 'empty';
|
|
470
|
+
/**
|
|
471
|
+
* How deeply a control is nested inside other controls.
|
|
472
|
+
*
|
|
473
|
+
* Bounded by {@link MAX_CONTENT_CONTROL_NESTING}: nesting depth comes from a file and is a
|
|
474
|
+
* recursion bound.
|
|
475
|
+
*/
|
|
476
|
+
declare function contentControlLevelOf(control: OoxmlNode): ContentControlLevel;
|
|
477
|
+
/** One control, plus how deeply it is nested and the controls that enclose it. */
|
|
478
|
+
interface ContentControlEntry {
|
|
479
|
+
readonly node: OoxmlContentControlNode;
|
|
480
|
+
/** 0 for a top-level control; the nesting depth otherwise. */
|
|
481
|
+
readonly depth: number;
|
|
482
|
+
/** Enclosing controls, outermost first. Empty at depth 0. */
|
|
483
|
+
readonly ancestors: readonly OoxmlContentControlNode[];
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* Every control under a node, in document order, bounded in depth and in count.
|
|
487
|
+
*
|
|
488
|
+
* ONE walk, shared. The nesting bound is the same one layout flattens with, so a control
|
|
489
|
+
* a lane can address is a control every lane can address — and a file that nests past it
|
|
490
|
+
* keeps its content in the tree (the serializer never stops) while no walk recurses
|
|
491
|
+
* further.
|
|
492
|
+
*/
|
|
493
|
+
declare function contentControlsIn(root: OoxmlNode, options?: {
|
|
494
|
+
readonly maxDepth?: number;
|
|
495
|
+
readonly limit?: number;
|
|
496
|
+
}): readonly ContentControlEntry[];
|
|
497
|
+
/** Find one control by canonical node id, with the same bounded walk. */
|
|
498
|
+
declare function findContentControl(root: OoxmlNode, nodeId: string): ContentControlEntry | null;
|
|
499
|
+
/**
|
|
500
|
+
* The plain text a control's content holds, in reading order.
|
|
501
|
+
*
|
|
502
|
+
* `w:delText` is excluded: struck text is not the control's value, and a dropdown whose
|
|
503
|
+
* old item is still present as a tracked deletion would otherwise report both.
|
|
504
|
+
*/
|
|
505
|
+
declare function contentControlTextOf(control: OoxmlNode): string;
|
|
506
|
+
/**
|
|
507
|
+
* Resolve the lock a position inherits from the controls enclosing it.
|
|
508
|
+
*
|
|
509
|
+
* CONSERVATIVE, because a template that says a field cannot be edited and sits inside a
|
|
510
|
+
* section that says it cannot be removed means both. Each half of `ST_Lock` is taken
|
|
511
|
+
* independently and the strongest wins, so an unlocked control inside a `contentLocked`
|
|
512
|
+
* one is still content-locked — a nested control cannot grant a permission its parent
|
|
513
|
+
* withheld, which is the only reading under which a lock is a lock.
|
|
514
|
+
*/
|
|
515
|
+
declare function resolveContentControlLock(chain: readonly ContentControlLock[]): ContentControlLock;
|
|
516
|
+
/** Whether a resolved lock forbids editing the content it covers. */
|
|
517
|
+
declare function lockForbidsEdit(lock: ContentControlLock): boolean;
|
|
518
|
+
/** Whether a resolved lock forbids removing the control itself. */
|
|
519
|
+
declare function lockForbidsRemoval(lock: ContentControlLock): boolean;
|
|
520
|
+
/**
|
|
521
|
+
* `CT_SdtPr`'s declared child order (§17.5.2.38), followed by the type choice.
|
|
522
|
+
*
|
|
523
|
+
* Serialization re-emits children in tree order, so the ONLY way a write keeps the
|
|
524
|
+
* sequence valid is to place the child it authors at its schema position — which is what
|
|
525
|
+
* {@link orderedContentControlProperties} does.
|
|
526
|
+
*/
|
|
527
|
+
declare const CONTENT_CONTROL_PROPERTY_ORDER: readonly string[];
|
|
528
|
+
/**
|
|
529
|
+
* Rebuild a `w:sdtPr`'s children in schema order.
|
|
530
|
+
*
|
|
531
|
+
* Modelled children sort to their declared position and the type element follows them,
|
|
532
|
+
* as the sequence requires. Everything else — a `w15:repeatingSection`, a vendor
|
|
533
|
+
* extension, the `w14:checkbox` that is not part of the ECMA-376 choice — keeps the order
|
|
534
|
+
* it was authored in and follows the modelled block, so a write that touches one property
|
|
535
|
+
* neither drops nor reorders anything it does not name.
|
|
536
|
+
*/
|
|
537
|
+
declare function orderedContentControlProperties(children: readonly OoxmlNode[]): readonly OoxmlNode[];
|
|
538
|
+
/**
|
|
539
|
+
* The next `w:id` to write, seeded from the document's own maximum plus one.
|
|
540
|
+
*
|
|
541
|
+
* Never a clock, a timestamp, a random source or a hash: those collide with ids already
|
|
542
|
+
* in the file and produce values Word rejects. Null when the document already reaches the
|
|
543
|
+
* signed 32-bit bound, so the caller refuses rather than wrapping into a negative id.
|
|
544
|
+
*/
|
|
545
|
+
declare function allocateContentControlId(root: OoxmlNode): number | null;
|
|
546
|
+
|
|
547
547
|
/** The value a control accepts, by what kind of control it is. */
|
|
548
548
|
type ContentControlValueInput = {
|
|
549
549
|
readonly kind: 'text';
|
|
@@ -1488,4 +1488,4 @@ type TreeOpResult = {
|
|
|
1488
1488
|
readonly detail?: string;
|
|
1489
1489
|
};
|
|
1490
1490
|
|
|
1491
|
-
export { contentControlTextOf as $, ACCEPTED_PARAGRAPH_PROPERTIES as A, type HyperlinkKind as B, type ContentControlKind as C, type DrawingProjection as D, type HyperlinkTarget as E, MAX_CONTENT_CONTROL_NESTING as F, OFFICE_RELATIONSHIP_NAMESPACE_URI as G, HYPERLINK_RELATIONSHIP_TYPE as H, type ImpactClass as I, type RelationshipTargetResolver as J, TABLE_BORDER_STYLES as K, TREE_DOC_OP_KINDS as L, MAX_CONTENT_CONTROLS_PER_PART as M, type TreeDocOpKind as N, type OoxmlProperty as O, type TreeOpEffect as P, allocateContentControlId as Q, type RevisionAddress as R, type SourceCrop as S, type TreeDocOp as T, contentControlContentChildren as U, type VectorShapeProjection as V, contentControlContentNodeOf as W, contentControlEndPropertiesNodeOf as X, contentControlLevelOf as Y, contentControlPropertiesNodeOf as Z, contentControlPropertiesOf as _, type TreeOpRejection as a, contentControlsIn as a0, findContentControl as a1, flattenContentControls as a2, hyperlinkAnchorOf as a3, hyperlinkRelationshipIdOf as a4, hyperlinkTargetOf as a5, isContentControlContentNode as a6, isContentControlNode as a7, isContentControlWrapper as a8, isHyperlinkNode as a9, lockForbidsEdit as aa, lockForbidsRemoval as ab, orderedContentControlProperties as ac, parseContentControlId as ad, projectDrawing as ae, resolveContentControlLock as af, type ImageWrapTarget as b, type DrawingKind as c, type DrawingPositionInput as d, type DrawingLocks as e, type DrawingHorizontalReferenceFrame as f, type DrawingVerticalReferenceFrame as g, type
|
|
1491
|
+
export { contentControlTextOf as $, ACCEPTED_PARAGRAPH_PROPERTIES as A, type HyperlinkKind as B, type ContentControlKind as C, type DrawingProjection as D, type HyperlinkTarget as E, MAX_CONTENT_CONTROL_NESTING as F, OFFICE_RELATIONSHIP_NAMESPACE_URI as G, HYPERLINK_RELATIONSHIP_TYPE as H, type ImpactClass as I, type RelationshipTargetResolver as J, TABLE_BORDER_STYLES as K, TREE_DOC_OP_KINDS as L, MAX_CONTENT_CONTROLS_PER_PART as M, type TreeDocOpKind as N, type OoxmlProperty as O, type TreeOpEffect as P, allocateContentControlId as Q, type RevisionAddress as R, type SourceCrop as S, type TreeDocOp as T, contentControlContentChildren as U, type VectorShapeProjection as V, contentControlContentNodeOf as W, contentControlEndPropertiesNodeOf as X, contentControlLevelOf as Y, contentControlPropertiesNodeOf as Z, contentControlPropertiesOf as _, type TreeOpRejection as a, contentControlsIn as a0, findContentControl as a1, flattenContentControls as a2, hyperlinkAnchorOf as a3, hyperlinkRelationshipIdOf as a4, hyperlinkTargetOf as a5, isContentControlContentNode as a6, isContentControlNode as a7, isContentControlWrapper as a8, isHyperlinkNode as a9, lockForbidsEdit as aa, lockForbidsRemoval as ab, orderedContentControlProperties as ac, parseContentControlId as ad, projectDrawing as ae, resolveContentControlLock as af, type ImageWrapTarget as b, type DrawingKind as c, type DrawingPositionInput as d, type DrawingLocks as e, type DrawingHorizontalReferenceFrame as f, type DrawingVerticalReferenceFrame as g, type DrawingTreeDocOp as h, type TreeDocColorValue as i, IMAGE_WRAP_TARGETS as j, type DrawingAccessibility as k, type DrawingTransform as l, type TableBorderStyle as m, type ContentControlLevel as n, type ContentControlLock as o, type ContentControlDataBinding as p, type TreeOpResult as q, ACCEPTED_RUN_PROPERTIES as r, CONTENT_CONTROL_ID_MAX as s, CONTENT_CONTROL_PROPERTY_ORDER as t, type ContentControlCheckbox as u, type ContentControlCheckboxState as v, type ContentControlDateFormat as w, type ContentControlEntry as x, type ContentControlListItem as y, type ContentControlProperties as z };
|
|
@@ -1,34 +1,13 @@
|
|
|
1
|
-
import { S as SupportedImageMime, b as ImageDecodePort } from './image-resources-
|
|
2
|
-
import { S as StoryScope, a as StoryTargetRejection, D as DocumentTrackingSettings, I as InsertCustomNodeWrite, C as CustomNodeWriteResult, b as CustomNodeSweepOutcome, E as EmbeddedFont, B as BookmarkIndex, L as ListKind, c as InsertImageInput, d as ImageIntentResult, R as ReplaceImageOptions, A as ApplyImagePropertiesInput } from './custom-node-writes-
|
|
1
|
+
import { S as SupportedImageMime, b as ImageDecodePort } from './image-resources-Cl5_cNi9.js';
|
|
2
|
+
import { S as StoryScope, a as StoryTargetRejection, D as DocumentTrackingSettings, I as InsertCustomNodeWrite, C as CustomNodeWriteResult, b as CustomNodeSweepOutcome, E as EmbeddedFont, B as BookmarkIndex, L as ListKind, c as InsertImageInput, d as ImageIntentResult, R as ReplaceImageOptions, A as ApplyImagePropertiesInput } from './custom-node-writes-tJw8U9MO.js';
|
|
3
3
|
import { Node } from 'prosemirror-model';
|
|
4
|
-
import { a as ReviewItem } from './review-support-
|
|
4
|
+
import { a as ReviewItem } from './review-support-D4ZBdUXa.js';
|
|
5
5
|
import { ReviewModuleContribution } from './contracts/modules.js';
|
|
6
|
-
import { e as OoxmlPart, O as OoxmlNode, a as OoxmlElement } from './ooxml-tree-
|
|
7
|
-
import { O as OoxmlPackage, b as OoxmlPackageRejection } from './ooxml-package-
|
|
8
|
-
import { a as HeaderFooterParts, b as HeaderFooterSectionResolution } from './hf-references-
|
|
9
|
-
import { S as SelectionMark, T as TreeModelChange, D as DocumentProperties } from './tree-store-
|
|
10
|
-
import { T as TreeDocOp } from './tree-op-types-
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* The scheme slots the picker shows, in Word's column order.
|
|
14
|
-
*
|
|
15
|
-
* Assumes the default `w:clrSchemeMapping` (bg1→lt1, t1→dk1, ...); a settings part
|
|
16
|
-
* that remaps them is rare and a follow-up.
|
|
17
|
-
*/
|
|
18
|
-
declare const PICKER_SLOTS: readonly ["lt1", "dk1", "lt2", "dk2", "accent1", "accent2", "accent3", "accent4", "accent5", "accent6"];
|
|
19
|
-
type ThemeColorSlot = (typeof PICKER_SLOTS)[number];
|
|
20
|
-
/** One theme colour: the scheme slot and its resolved six-digit hex (no '#'). */
|
|
21
|
-
interface DocumentThemeColorEntry {
|
|
22
|
-
readonly slot: ThemeColorSlot;
|
|
23
|
-
readonly hex: string;
|
|
24
|
-
}
|
|
25
|
-
/** The theme's two font slots, for resolving `w:rFonts` theme attributes. */
|
|
26
|
-
interface DocumentThemeFonts {
|
|
27
|
-
/** `a:majorFont` latin typeface — headings. */
|
|
28
|
-
readonly major: string | null;
|
|
29
|
-
/** `a:minorFont` latin typeface — body text. */
|
|
30
|
-
readonly minor: string | null;
|
|
31
|
-
}
|
|
6
|
+
import { e as OoxmlPart, O as OoxmlNode, a as OoxmlElement } from './ooxml-tree-BU0e3DVi.js';
|
|
7
|
+
import { O as OoxmlPackage, b as OoxmlPackageRejection } from './ooxml-package-D_CtywTW.js';
|
|
8
|
+
import { a as HeaderFooterParts, b as HeaderFooterSectionResolution } from './hf-references-BdjsQNE_.js';
|
|
9
|
+
import { S as SelectionMark, T as TreeModelChange, D as DocumentProperties } from './tree-store-CIKASRHk.js';
|
|
10
|
+
import { T as TreeDocOp } from './tree-op-types-D0fTNBVW.js';
|
|
32
11
|
|
|
33
12
|
/**
|
|
34
13
|
* Why an edited projection could not be mapped back into tree ops.
|
|
@@ -164,6 +143,27 @@ interface DocumentSearchResult {
|
|
|
164
143
|
readonly truncated: boolean;
|
|
165
144
|
}
|
|
166
145
|
|
|
146
|
+
/**
|
|
147
|
+
* The scheme slots the picker shows, in Word's column order.
|
|
148
|
+
*
|
|
149
|
+
* Assumes the default `w:clrSchemeMapping` (bg1→lt1, t1→dk1, ...); a settings part
|
|
150
|
+
* that remaps them is rare and a follow-up.
|
|
151
|
+
*/
|
|
152
|
+
declare const PICKER_SLOTS: readonly ["lt1", "dk1", "lt2", "dk2", "accent1", "accent2", "accent3", "accent4", "accent5", "accent6"];
|
|
153
|
+
type ThemeColorSlot = (typeof PICKER_SLOTS)[number];
|
|
154
|
+
/** One theme colour: the scheme slot and its resolved six-digit hex (no '#'). */
|
|
155
|
+
interface DocumentThemeColorEntry {
|
|
156
|
+
readonly slot: ThemeColorSlot;
|
|
157
|
+
readonly hex: string;
|
|
158
|
+
}
|
|
159
|
+
/** The theme's two font slots, for resolving `w:rFonts` theme attributes. */
|
|
160
|
+
interface DocumentThemeFonts {
|
|
161
|
+
/** `a:majorFont` latin typeface — headings. */
|
|
162
|
+
readonly major: string | null;
|
|
163
|
+
/** `a:minorFont` latin typeface — body text. */
|
|
164
|
+
readonly minor: string | null;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
167
|
/** What a run inherits at one point of the chain — null means "nothing authored". */
|
|
168
168
|
interface StyleRunDefaults {
|
|
169
169
|
readonly fontFamily: string | null;
|
|
@@ -207,7 +207,7 @@ interface TreeApplyResult {
|
|
|
207
207
|
* Holds the whole package, not just the body — headers, footers, notes, comments and styles are
|
|
208
208
|
* all reachable through it, and parts the engine does not model are preserved verbatim.
|
|
209
209
|
*/
|
|
210
|
-
interface
|
|
210
|
+
interface TreeDocxSessionView {
|
|
211
211
|
/** Whether the body holds at least one editable paragraph. */
|
|
212
212
|
readonly editable: boolean;
|
|
213
213
|
/** Canonical node ids of the body paragraphs, in order. */
|
|
@@ -238,20 +238,6 @@ interface TreeDocxSession {
|
|
|
238
238
|
* and one undo unit without swapping the body store.
|
|
239
239
|
*/
|
|
240
240
|
applyTreeOps(ops: readonly TreeDocOp[], selectionBefore?: SelectionMark | null, selectionAfter?: SelectionMark | null, scope?: StoryScope): TreeApplyResult;
|
|
241
|
-
/** Project the current BODY revision into a ProseMirror doc. */
|
|
242
|
-
projectDoc(): Node;
|
|
243
|
-
/** Re-project incrementally from the last committed change, reusing untouched paragraphs. */
|
|
244
|
-
reconcile(previousDoc: Node): Node;
|
|
245
|
-
/**
|
|
246
|
-
* Whether the last commit changed the BLOCK SEQUENCE (a split, join, insert or delete).
|
|
247
|
-
*
|
|
248
|
-
* A host needs this to decide whether the view must be re-projected at all: after a pure
|
|
249
|
-
* text edit the view already holds what the model holds, and re-projecting anyway both
|
|
250
|
-
* wastes work and races the next keystroke.
|
|
251
|
-
*/
|
|
252
|
-
lastCommitWasStructural(): boolean;
|
|
253
|
-
/** Map an edited BODY doc to tree ops and commit them as ONE transaction. */
|
|
254
|
-
applyPmDoc(doc: Node): TreeApplyResult;
|
|
255
241
|
/** Body text, paragraphs joined by newlines, read from the CANONICAL tree. */
|
|
256
242
|
bodyText(): string;
|
|
257
243
|
/** Text of a story scope, paragraphs joined by newlines. */
|
|
@@ -305,6 +291,15 @@ interface TreeDocxSession {
|
|
|
305
291
|
* Memoized per package revision.
|
|
306
292
|
*/
|
|
307
293
|
documentFonts(): readonly string[];
|
|
294
|
+
/**
|
|
295
|
+
* Whether the document puts any literal character on a page, over the same roots
|
|
296
|
+
* {@link TreeDocxSessionView.documentFonts} reads. Memoized per package revision.
|
|
297
|
+
*
|
|
298
|
+
* The font-substitution notice needs it: `documentFonts` reports what the document
|
|
299
|
+
* DECLARES, and a brand-new document declares Word's Calibri default over a single
|
|
300
|
+
* empty paragraph — a declaration with no glyph behind it.
|
|
301
|
+
*/
|
|
302
|
+
rendersText(): boolean;
|
|
308
303
|
/**
|
|
309
304
|
* The `w:style` definitions of the styles part, validated and projected for a style
|
|
310
305
|
* picker. Memoized once: the styles part is immutable for the session's lifetime.
|
|
@@ -552,6 +547,27 @@ interface TreeDocxSession {
|
|
|
552
547
|
/** Apply image property tree ops plus hyperlink relationship wiring atomically. */
|
|
553
548
|
applyImageProperties(scope: StoryScope, input: ApplyImagePropertiesInput): ImageIntentResult;
|
|
554
549
|
}
|
|
550
|
+
/**
|
|
551
|
+
* Binding-only session methods that exchange ProseMirror projections.
|
|
552
|
+
*
|
|
553
|
+
* Editor surfaces expose {@link TreeDocxSessionView}. Only the binding lane sees this extension.
|
|
554
|
+
*/
|
|
555
|
+
interface TreeDocxSession extends TreeDocxSessionView {
|
|
556
|
+
/** Project the current BODY revision into a ProseMirror doc. */
|
|
557
|
+
projectDoc(): Node;
|
|
558
|
+
/** Re-project incrementally from the last committed change, reusing untouched paragraphs. */
|
|
559
|
+
reconcile(previousDoc: Node): Node;
|
|
560
|
+
/**
|
|
561
|
+
* Whether the last commit changed the BLOCK SEQUENCE (a split, join, insert or delete).
|
|
562
|
+
*
|
|
563
|
+
* A host needs this to decide whether the view must be re-projected at all. After a pure
|
|
564
|
+
* text edit, the view already holds what the model holds. Re-projecting wastes work and
|
|
565
|
+
* races the next keystroke.
|
|
566
|
+
*/
|
|
567
|
+
lastCommitWasStructural(): boolean;
|
|
568
|
+
/** Map an edited BODY doc to tree ops and commit them as one transaction. */
|
|
569
|
+
applyPmDoc(doc: Node): TreeApplyResult;
|
|
570
|
+
}
|
|
555
571
|
|
|
556
572
|
/**
|
|
557
573
|
* Why bytes could not be opened: any bounded-reader rejection, plus the package that parsed but
|
|
@@ -595,4 +611,4 @@ declare function openTreeSession(bytes: Uint8Array, options?: OpenTreeSessionOpt
|
|
|
595
611
|
/** The origin a host should use when committing a reconciliation rather than a user edit. */
|
|
596
612
|
declare const PROJECTION_ORIGIN: "dev.docx-editor.core.origin.projection";
|
|
597
613
|
|
|
598
|
-
export { type DocumentStyleEntry as D, type MapResult as M, type OpenTreeSessionResult as O, PROJECTION_ORIGIN as P, type TreeDocxSession as T, type TreeApplyResult as a, type TreeBindingRejection as b, type
|
|
614
|
+
export { type DocumentStyleEntry as D, type MapResult as M, type OpenTreeSessionResult as O, PROJECTION_ORIGIN as P, type TreeDocxSession as T, type TreeApplyResult as a, type TreeBindingRejection as b, type TreeDocxSessionView as c, type TreeSessionRejection as d, bodyParagraphs as e, docToTreeOps as f, type DocumentThemeColorEntry as g, openTreeSession as o, partHasNode as p, reconcileDoc as r, treeToDoc as t };
|