@docx-editor.dev/core 2.10.0 → 2.11.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/dist/automation.cjs +1 -1
- package/dist/automation.d.cts +14 -5
- package/dist/automation.d.ts +14 -5
- package/dist/automation.js +1 -1
- package/dist/binding.cjs +1 -1
- package/dist/binding.d.cts +12 -11
- package/dist/binding.d.ts +12 -11
- package/dist/binding.js +1 -1
- package/dist/chunk-34BNQUD4.js +10 -0
- package/dist/chunk-5AVHO75P.cjs +19 -0
- package/dist/chunk-6HMSC7UV.js +2 -0
- package/dist/chunk-6JIJOZDW.js +1 -0
- package/dist/chunk-76Y3Y45J.cjs +2 -0
- package/dist/chunk-BP7ANXGA.js +1 -0
- package/dist/chunk-BTQKU64Q.cjs +1 -0
- package/dist/chunk-CRZR6K5Z.js +19 -0
- package/dist/chunk-D5EHDHYV.js +1 -0
- package/dist/chunk-EJATEGJZ.cjs +1 -0
- package/dist/{chunk-PSZH2VXP.js → chunk-GOEBQ26R.js} +1 -1
- package/dist/chunk-GRDFEH5Q.cjs +2 -0
- package/dist/chunk-GWV65NQW.cjs +10 -0
- package/dist/chunk-GXLZCXEH.js +2 -0
- package/dist/chunk-JUQOPVSK.cjs +2 -0
- package/dist/chunk-LAETEBHD.js +1 -0
- package/dist/chunk-M6Z3KFXM.cjs +5 -0
- package/dist/{chunk-YMYCPY5Y.cjs → chunk-OHJQ7GPZ.cjs} +1 -1
- package/dist/chunk-UQFOYZJO.cjs +18 -0
- package/dist/chunk-WPQMPHNR.cjs +1 -0
- package/dist/chunk-WXQ245MQ.js +18 -0
- package/dist/chunk-WZHIFNSU.js +5 -0
- package/dist/chunk-X7A5XART.js +2 -0
- package/dist/chunk-ZKWRCLT2.cjs +1 -0
- package/dist/collaboration/replication.cjs +1 -0
- package/dist/collaboration/replication.d.cts +216 -0
- package/dist/collaboration/replication.d.ts +216 -0
- package/dist/collaboration/replication.js +1 -0
- package/dist/collaboration.cjs +1 -0
- package/dist/collaboration.d.cts +176 -0
- package/dist/collaboration.d.ts +176 -0
- package/dist/collaboration.js +1 -0
- package/dist/contracts/editor.cjs +1 -1
- package/dist/contracts/editor.d.cts +8 -9
- package/dist/contracts/editor.d.ts +8 -9
- package/dist/contracts/editor.js +1 -1
- package/dist/contracts/interaction.d.cts +8 -9
- package/dist/contracts/interaction.d.ts +8 -9
- package/dist/contracts/modules.cjs +1 -1
- package/dist/contracts/modules.d.cts +21 -8
- package/dist/contracts/modules.d.ts +21 -8
- package/dist/contracts/modules.js +1 -1
- package/dist/custom-node-writes-CwkYRw3V.d.cts +310 -0
- package/dist/custom-node-writes-JfTn-Sy6.d.ts +310 -0
- package/dist/document-properties-D6Ahr8D6.d.cts +28 -0
- package/dist/document-properties-D6Ahr8D6.d.ts +28 -0
- package/dist/{editor-C0my6Uta.d.ts → editor-BogcVHXk.d.ts} +145 -49
- package/dist/{editor-CwzY2Hcg.d.cts → editor-C8edZgy5.d.cts} +145 -49
- package/dist/editor.cjs +1 -1
- package/dist/editor.css +1 -7299
- package/dist/editor.d.cts +26 -25
- package/dist/editor.d.ts +26 -25
- package/dist/editor.js +1 -1
- package/dist/failure-BnGjoXf0.d.cts +64 -0
- package/dist/failure-BnGjoXf0.d.ts +64 -0
- package/dist/{index-kID8Ymkp.d.ts → index-BNv-ZLQP.d.ts} +262 -81
- package/dist/{index-nLFwo_17.d.cts → index-Dn0lOp9Z.d.cts} +262 -81
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +19 -18
- package/dist/index.d.ts +19 -18
- package/dist/index.js +1 -1
- package/dist/layout.cjs +1 -1
- package/dist/layout.d.cts +71 -53
- package/dist/layout.d.ts +71 -53
- package/dist/layout.js +1 -1
- package/dist/{note-properties-jvnw_DGG.d.ts → note-properties-BmoSdyKS.d.ts} +1 -1
- package/dist/{note-properties-CQlxjic_.d.cts → note-properties-BvGfHk5e.d.cts} +1 -1
- package/dist/{omml-equation-Dd3mBep-.d.ts → omml-equation-Ciq5rgb7.d.ts} +1 -1
- package/dist/{omml-equation-BD-LsmWE.d.cts → omml-equation-CqQOt_dD.d.cts} +1 -1
- package/dist/output.cjs +1 -1
- package/dist/output.d.cts +6 -8
- package/dist/output.d.ts +6 -8
- package/dist/output.js +1 -1
- package/dist/{protocol-UuZOcOp7.d.cts → protocol-BB-WP3zk.d.cts} +2 -2
- package/dist/{protocol-C7ahrdUx.d.ts → protocol-Ckl7hWsv.d.ts} +2 -2
- package/dist/{review-items-Dw-8a6Ie.d.ts → review-items-BdeLNRi2.d.cts} +1 -2
- package/dist/{review-items-CwixiHNe.d.cts → review-items-CkYyXhXM.d.ts} +1 -2
- package/dist/{review-reads-BqkiJTeR.d.cts → review-reads-BOLSBm5w.d.cts} +2 -2
- package/dist/{review-reads-C0u-IKEA.d.ts → review-reads-Crf0Xn42.d.ts} +2 -2
- package/dist/{revision-projection-CILpvv4M.d.ts → revision-projection-Ae2CWa8E.d.ts} +1 -1
- package/dist/{revision-projection-Cc4wz30g.d.cts → revision-projection-C2S8PSQm.d.cts} +1 -1
- package/dist/{semantic-cell-selection-DT9x9WLf.d.cts → semantic-cell-selection-C0OFD4D9.d.cts} +4 -4
- package/dist/{semantic-cell-selection-Utrf0lz7.d.ts → semantic-cell-selection-DdmoxC-y.d.ts} +4 -4
- package/dist/{semantic-interaction-B6hFRQLy.d.ts → semantic-interaction-COyhZ9WH.d.ts} +1 -1
- package/dist/{semantic-interaction-Z0xKQcB4.d.cts → semantic-interaction-Cs2jErnt.d.cts} +1 -1
- package/dist/{semantic-paint-CQEOC0Od.d.cts → semantic-paint-UHaj3sBY.d.cts} +2 -2
- package/dist/{semantic-paint-quke354p.d.ts → semantic-paint-vA-oLSdV.d.ts} +2 -2
- package/dist/{semantic-records-Do3-i5oB.d.ts → semantic-records-5AOQJmLX.d.cts} +5 -4
- package/dist/{semantic-records-CMakzQ1X.d.cts → semantic-records-9xhwbJ23.d.ts} +5 -4
- package/dist/{shaped-measurer-DzRwWrL5.d.cts → shaped-measurer-NeF2mPSu.d.cts} +1 -1
- package/dist/{shaped-measurer-BxwTUluj.d.ts → shaped-measurer-vzsY88oK.d.ts} +1 -1
- package/dist/store.cjs +1 -1
- package/dist/store.d.cts +74 -16
- package/dist/store.d.ts +74 -16
- package/dist/store.js +1 -1
- package/dist/{tree-op-types-DSJYmf5b.d.cts → tree-op-types-BPyXNxyL.d.cts} +1247 -10
- package/dist/{tree-op-types-BuOfCrkp.d.ts → tree-op-types-DnzAOnc9.d.ts} +1247 -10
- package/dist/{custom-node-writes-BvpWCnW8.d.ts → tree-package-fragment-BjZ3RWAS.d.cts} +107 -322
- package/dist/{custom-node-writes-Db8H6Z3n.d.cts → tree-package-fragment-CDER0G3B.d.ts} +107 -322
- package/dist/{tree-session-contract-C1dfE9hy.d.ts → tree-session-contract-BF2FVBOM.d.cts} +16 -10
- package/dist/{tree-session-contract-ByWx8eew.d.cts → tree-session-contract-DhdsFT_z.d.ts} +16 -10
- package/dist/{tree-store-ASBtz7UB.d.ts → tree-store-CNZ3O83s.d.ts} +130 -25
- package/dist/{tree-store-CWOUMGN8.d.cts → tree-store-DfZi7FqY.d.cts} +130 -25
- package/package.json +14 -3
- package/dist/chunk-27APDXY2.js +0 -2
- package/dist/chunk-35MI6K7M.cjs +0 -10
- package/dist/chunk-4XL7SOWQ.cjs +0 -2
- package/dist/chunk-6K6QQVAZ.cjs +0 -18
- package/dist/chunk-7VQ7YLW3.cjs +0 -1
- package/dist/chunk-7ZJL5AEY.cjs +0 -1
- package/dist/chunk-C6LK2BYA.cjs +0 -2
- package/dist/chunk-GQQOL4PV.js +0 -1
- package/dist/chunk-HBEBUCRM.cjs +0 -5
- package/dist/chunk-LG5K46OM.js +0 -2
- package/dist/chunk-LWADHMVV.js +0 -5
- package/dist/chunk-N725IUO7.js +0 -18
- package/dist/chunk-N7DBENH4.js +0 -10
- package/dist/chunk-NVGFWMCO.js +0 -1
- package/dist/chunk-SYTWKJPJ.cjs +0 -18
- package/dist/chunk-YI6JXF7U.js +0 -18
- package/dist/hf-references-Dvk6De4Q.d.cts +0 -70
- package/dist/hf-references-z5Y4N1ab.d.ts +0 -70
- package/dist/note-nodes-BNCANoGN.d.ts +0 -108
- package/dist/note-nodes-DL-Au22P.d.cts +0 -108
- package/dist/ooxml-package-CdEy9ufK.d.cts +0 -1222
- package/dist/ooxml-package-CdEy9ufK.d.ts +0 -1222
- package/dist/tree-op-revision-attribution-CN06Xshv.d.cts +0 -24
- package/dist/tree-op-revision-attribution-CN06Xshv.d.ts +0 -24
|
@@ -1,1222 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Why a part or relationship name was refused.
|
|
3
|
-
*
|
|
4
|
-
* Path traversal is the reason this exists: a name with `..` or a leading `/` is refused rather
|
|
5
|
-
* than normalized, because normalizing is how a crafted package reaches outside itself.
|
|
6
|
-
*/
|
|
7
|
-
type NameRejection = 'empty' | 'control-char' | 'backslash' | 'drive-or-unc' | 'encoded-separator' | 'encoded-dot' | 'bad-encoding' | 'empty-segment' | 'dot-segment' | 'unsafe-key' | 'segment-trailing-dot' | 'traversal-escape' | 'not-absolute-uri' | 'unsafe-scheme';
|
|
8
|
-
/** A validated OPC name, or the typed reason it was refused. */
|
|
9
|
-
type NameResult = {
|
|
10
|
-
readonly ok: true;
|
|
11
|
-
readonly partName: string;
|
|
12
|
-
} | {
|
|
13
|
-
readonly ok: false;
|
|
14
|
-
readonly reason: NameRejection;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Normalize a ZIP entry name or OPC part name into a canonical part name
|
|
18
|
-
* (`/word/document.xml`). Accepts leading-slash and no-leading-slash inputs;
|
|
19
|
-
* rejects traversal, dot segments, and the attack surface. Duplicate detection
|
|
20
|
-
* folds ASCII case (OPC part-name equivalence).
|
|
21
|
-
*/
|
|
22
|
-
declare function normalizePartName(raw: string): NameResult;
|
|
23
|
-
/**
|
|
24
|
-
* ASCII-only lowercase fold. OPC part-name/extension equivalence is US-ASCII
|
|
25
|
-
* case-insensitive; a locale `toLowerCase()` mis-folds e.g. Turkish `I`/`İ` and
|
|
26
|
-
* could let two "equivalent" part names evade duplicate detection.
|
|
27
|
-
*/
|
|
28
|
-
declare function asciiFold(s: string): string;
|
|
29
|
-
/** Case-folded key for OPC part-name equivalence / duplicate detection. */
|
|
30
|
-
declare function partNameKey(partName: string): string;
|
|
31
|
-
/**
|
|
32
|
-
* Detect archive entries that collide after normalization (before inflation).
|
|
33
|
-
* Returns the case-folded keys that more than one raw name maps to.
|
|
34
|
-
*/
|
|
35
|
-
declare function detectDuplicateNames(rawNames: readonly string[]): {
|
|
36
|
-
readonly duplicates: readonly string[];
|
|
37
|
-
readonly rejected: readonly {
|
|
38
|
-
raw: string;
|
|
39
|
-
reason: NameRejection;
|
|
40
|
-
}[];
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Resolve an internal relationship target against its owner part, without
|
|
44
|
-
* escaping the package root. `ownerPartName` is a canonical part name; the base
|
|
45
|
-
* is its containing folder. A leading "/" target is package-absolute. `.`/`..`
|
|
46
|
-
* segments resolve on a stack; popping above root is `traversal-escape`.
|
|
47
|
-
*/
|
|
48
|
-
declare function resolveInternalTarget(ownerPartName: string, rawTarget: string): NameResult;
|
|
49
|
-
/**
|
|
50
|
-
* Validate an external-mode relationship target. It MUST be an absolute URI, is
|
|
51
|
-
* retained verbatim by the caller, and is NEVER owner-resolved or fetched here.
|
|
52
|
-
* Unsafe schemes (javascript/vbscript/data/file) are rejected for runtime sinks;
|
|
53
|
-
* the raw lexical form is still preserved separately by the authored record.
|
|
54
|
-
*/
|
|
55
|
-
declare function validateExternalTarget(raw: string): NameResult;
|
|
56
|
-
|
|
57
|
-
/** One `<Default>`: a file extension mapped to a content type. */
|
|
58
|
-
interface DefaultRecord {
|
|
59
|
-
readonly extension: string;
|
|
60
|
-
readonly contentType: string;
|
|
61
|
-
readonly order: number;
|
|
62
|
-
}
|
|
63
|
-
/** One `<Override>`: a specific part name mapped to a content type. Beats any Default. */
|
|
64
|
-
interface OverrideRecord {
|
|
65
|
-
readonly partName: string;
|
|
66
|
-
readonly contentType: string;
|
|
67
|
-
readonly order: number;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* The authored `[Content_Types].xml` records, in significant order.
|
|
71
|
-
*
|
|
72
|
-
* Retained rather than collapsed into a lookup, because the file's lexical form and ordering are
|
|
73
|
-
* part of what a lossless save re-emits.
|
|
74
|
-
*/
|
|
75
|
-
interface ContentTypeRecords {
|
|
76
|
-
readonly defaults: readonly DefaultRecord[];
|
|
77
|
-
readonly overrides: readonly OverrideRecord[];
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Why content-type records could not be indexed.
|
|
81
|
-
*
|
|
82
|
-
* All fail CLOSED: conflicting Defaults on one extension, duplicate normalized Override names, or
|
|
83
|
-
* invalid MIME syntax are refused rather than resolved by picking one.
|
|
84
|
-
*/
|
|
85
|
-
type ContentTypeError = {
|
|
86
|
-
readonly code: 'invalid-mime';
|
|
87
|
-
readonly value: string;
|
|
88
|
-
} | {
|
|
89
|
-
readonly code: 'conflicting-default';
|
|
90
|
-
readonly extension: string;
|
|
91
|
-
} | {
|
|
92
|
-
readonly code: 'duplicate-override';
|
|
93
|
-
readonly partName: string;
|
|
94
|
-
} | {
|
|
95
|
-
readonly code: 'invalid-override-name';
|
|
96
|
-
readonly partName: string;
|
|
97
|
-
} | {
|
|
98
|
-
readonly code: 'too-many-records';
|
|
99
|
-
readonly limit: number;
|
|
100
|
-
};
|
|
101
|
-
/** Whether a string is syntactically a MIME type. Syntax only — no registry lookup. */
|
|
102
|
-
declare function isValidMime(value: string): boolean;
|
|
103
|
-
/** ASCII-case-insensitive extension key (leading dot removed; ASCII-only fold). */
|
|
104
|
-
declare function extensionKey(extension: string): string;
|
|
105
|
-
/** The resolved lookup: Override by case-folded part name, Default by case-insensitive extension. */
|
|
106
|
-
interface ContentTypeIndex {
|
|
107
|
-
/** ext key -> single MIME (identical duplicates collapsed). */
|
|
108
|
-
readonly defaults: ReadonlyMap<string, string>;
|
|
109
|
-
/** case-folded part name -> MIME. */
|
|
110
|
-
readonly overrides: ReadonlyMap<string, string>;
|
|
111
|
-
}
|
|
112
|
-
/** The built index, or the conflict that made it impossible. */
|
|
113
|
-
type IndexResult = {
|
|
114
|
-
readonly ok: true;
|
|
115
|
-
readonly index: ContentTypeIndex;
|
|
116
|
-
} | {
|
|
117
|
-
readonly ok: false;
|
|
118
|
-
readonly error: ContentTypeError;
|
|
119
|
-
};
|
|
120
|
-
/**
|
|
121
|
-
* Build a resolved content-type index, failing closed on conflict/duplicate/MIME
|
|
122
|
-
* errors. `maxRecords` bounds the combined record count (N/N+1 gate).
|
|
123
|
-
*/
|
|
124
|
-
declare function buildContentTypeIndex(records: ContentTypeRecords, maxRecords?: number): IndexResult;
|
|
125
|
-
/**
|
|
126
|
-
* A part's content type, or why it has none.
|
|
127
|
-
*
|
|
128
|
-
* An orphan record never determines a part's type — a Default with no matching part is preserved
|
|
129
|
-
* inertly rather than applied.
|
|
130
|
-
*/
|
|
131
|
-
type ResolveResult = {
|
|
132
|
-
readonly ok: true;
|
|
133
|
-
readonly contentType: string;
|
|
134
|
-
readonly source: 'override' | 'default';
|
|
135
|
-
} | {
|
|
136
|
-
readonly ok: false;
|
|
137
|
-
readonly reason: 'unknown';
|
|
138
|
-
};
|
|
139
|
-
/** Resolve a part's content type: Override wins over Default; else unknown. */
|
|
140
|
-
declare function resolveContentType(index: ContentTypeIndex, partName: string): ResolveResult;
|
|
141
|
-
|
|
142
|
-
/** OOXML image relationship type for embedded or linked media parts. */
|
|
143
|
-
declare const IMAGE_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image";
|
|
144
|
-
/**
|
|
145
|
-
* Whether a relationship points inside the package or out of it.
|
|
146
|
-
*
|
|
147
|
-
* The security-relevant distinction: an `External` target is retained VERBATIM and never
|
|
148
|
-
* owner-resolved or fetched, because auto-loading a file-supplied remote target is a zero-click
|
|
149
|
-
* external fetch.
|
|
150
|
-
*/
|
|
151
|
-
type TargetMode = 'Internal' | 'External';
|
|
152
|
-
/**
|
|
153
|
-
* One authored relationship, with nothing materialized away: owner part, id, type, raw target
|
|
154
|
-
* lexical form, mode, and position.
|
|
155
|
-
*/
|
|
156
|
-
interface RelationshipRecord {
|
|
157
|
-
readonly ownerPart: string;
|
|
158
|
-
readonly id: string;
|
|
159
|
-
readonly type: string;
|
|
160
|
-
readonly rawTarget: string;
|
|
161
|
-
readonly targetMode: TargetMode;
|
|
162
|
-
readonly order: number;
|
|
163
|
-
}
|
|
164
|
-
/** Why a relationship set is invalid. Duplicate ids within one owner fail closed. */
|
|
165
|
-
type RelationshipError = {
|
|
166
|
-
readonly code: 'duplicate-id';
|
|
167
|
-
readonly ownerPart: string;
|
|
168
|
-
readonly id: string;
|
|
169
|
-
};
|
|
170
|
-
/** The validated relationship set, or the conflict that rejected it. */
|
|
171
|
-
type RelationshipSetResult = {
|
|
172
|
-
readonly ok: true;
|
|
173
|
-
readonly byOwner: ReadonlyMap<string, readonly RelationshipRecord[]>;
|
|
174
|
-
} | {
|
|
175
|
-
readonly ok: false;
|
|
176
|
-
readonly error: RelationshipError;
|
|
177
|
-
};
|
|
178
|
-
/** Group relationships by owner in authored order; reject duplicate ids per owner. */
|
|
179
|
-
declare function buildRelationshipSet(records: readonly RelationshipRecord[]): RelationshipSetResult;
|
|
180
|
-
/**
|
|
181
|
-
* A relationship resolved to a part, or the reason it could not be.
|
|
182
|
-
*
|
|
183
|
-
* External targets resolve to a refusal by design: they are never followed from a file.
|
|
184
|
-
*/
|
|
185
|
-
type ResolvedRelationship = {
|
|
186
|
-
readonly mode: 'Internal';
|
|
187
|
-
readonly target: NameResult;
|
|
188
|
-
readonly raw: string;
|
|
189
|
-
} | {
|
|
190
|
-
readonly mode: 'External';
|
|
191
|
-
readonly sinkSafe: NameResult;
|
|
192
|
-
readonly raw: string;
|
|
193
|
-
};
|
|
194
|
-
/**
|
|
195
|
-
* Resolve a relationship to a runtime projection while the raw target stays
|
|
196
|
-
* authored. Internal -> owner-relative part name; External -> sink-safe
|
|
197
|
-
* validation only (never owner-resolved, never fetched). `raw` is always the
|
|
198
|
-
* verbatim authored target.
|
|
199
|
-
*/
|
|
200
|
-
declare function resolveRelationship(rec: RelationshipRecord): ResolvedRelationship;
|
|
201
|
-
/**
|
|
202
|
-
* An image relationship resolved to package bytes, or why it was refused.
|
|
203
|
-
*
|
|
204
|
-
* External-mode image rels are refused rather than fetched — the no-zero-click-external-fetch
|
|
205
|
-
* rule applies to images exactly as it does to links.
|
|
206
|
-
*/
|
|
207
|
-
type ImageRelationshipResolution = {
|
|
208
|
-
readonly mode: 'internal';
|
|
209
|
-
readonly partName: string;
|
|
210
|
-
readonly raw: string;
|
|
211
|
-
} | {
|
|
212
|
-
readonly mode: 'external';
|
|
213
|
-
readonly sinkSafe: boolean;
|
|
214
|
-
readonly raw: string;
|
|
215
|
-
} | {
|
|
216
|
-
readonly mode: 'missing';
|
|
217
|
-
};
|
|
218
|
-
/**
|
|
219
|
-
* Resolve an image relationship id from an owner part. Internal targets resolve
|
|
220
|
-
* owner-relative; external targets are never fetched; a missing id is `missing`.
|
|
221
|
-
*/
|
|
222
|
-
declare function resolveImageRelationship(records: readonly RelationshipRecord[] | undefined, ownerPart: string, relationshipId: string): ImageRelationshipResolution;
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* One parsed XML node, preserving significant order, whitespace and raw lexical values.
|
|
226
|
-
*
|
|
227
|
-
* Attribute records have a NULL prototype: attribute names come from a file and become object
|
|
228
|
-
* keys, so `__proto__` must be inert by construction rather than by filtering.
|
|
229
|
-
*/
|
|
230
|
-
type XmlNode = {
|
|
231
|
-
readonly type: 'element';
|
|
232
|
-
readonly name: string;
|
|
233
|
-
readonly attributes: Readonly<Record<string, string>>;
|
|
234
|
-
readonly children: readonly XmlNode[];
|
|
235
|
-
} | {
|
|
236
|
-
readonly type: 'text';
|
|
237
|
-
readonly value: string;
|
|
238
|
-
};
|
|
239
|
-
/**
|
|
240
|
-
* Why XML was refused at the trust boundary.
|
|
241
|
-
*
|
|
242
|
-
* DTDs, entity declarations and external-entity references are PRE-rejected before parsing —
|
|
243
|
-
* blocking XXE and billion-laughs by never handing the parser the construct, rather than by
|
|
244
|
-
* trusting it to be configured safely.
|
|
245
|
-
*/
|
|
246
|
-
type XmlRejection = 'too-large' | 'dtd-forbidden' | 'entity-forbidden' | 'too-deep' | 'too-many-elements' | 'invalid-limits' | 'parse-error';
|
|
247
|
-
/** A parsed document, or a typed refusal. Never throws — the input is untrusted. */
|
|
248
|
-
type XmlResult = {
|
|
249
|
-
readonly ok: true;
|
|
250
|
-
readonly nodes: readonly XmlNode[];
|
|
251
|
-
} | {
|
|
252
|
-
readonly ok: false;
|
|
253
|
-
readonly reason: XmlRejection;
|
|
254
|
-
};
|
|
255
|
-
/** Per-part caps on size, element count and depth. Clamped into the hard ceilings. */
|
|
256
|
-
interface XmlLimits {
|
|
257
|
-
readonly maxBytes: number;
|
|
258
|
-
readonly maxElements?: number;
|
|
259
|
-
}
|
|
260
|
-
/** Read XML into an ordered tree, refusing DTDs/entities and bounding size. */
|
|
261
|
-
/**
|
|
262
|
-
* Read XML at the trust boundary: bounded, entity-free, and fidelity-preserving.
|
|
263
|
-
*
|
|
264
|
-
* Pre-rejects DTDs and entity constructs, disables expansion and value coercion, and keeps child
|
|
265
|
-
* order, attributes, whitespace and raw lexical form — everything a lossless re-emit needs.
|
|
266
|
-
*/
|
|
267
|
-
declare function readXml(xml: string, limits?: XmlLimits): XmlResult;
|
|
268
|
-
/** Find the first descendant element with the given qualified name. */
|
|
269
|
-
declare function findElement(nodes: readonly XmlNode[], name: string): Extract<XmlNode, {
|
|
270
|
-
type: 'element';
|
|
271
|
-
}> | undefined;
|
|
272
|
-
/** All direct child elements with the given name. */
|
|
273
|
-
declare function childElements(node: Extract<XmlNode, {
|
|
274
|
-
type: 'element';
|
|
275
|
-
}>, name: string): Extract<XmlNode, {
|
|
276
|
-
type: 'element';
|
|
277
|
-
}>[];
|
|
278
|
-
/** Concatenated text content of an element (all descendant text nodes). */
|
|
279
|
-
declare function textContent(node: Extract<XmlNode, {
|
|
280
|
-
type: 'element';
|
|
281
|
-
}>): string;
|
|
282
|
-
|
|
283
|
-
/** The WordprocessingML main namespace — the `w:` prefix in every `word/document.xml`. */
|
|
284
|
-
declare const WML_NAMESPACE_URI = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
285
|
-
/** The reserved `xml:` namespace, which carries `xml:space`. */
|
|
286
|
-
declare const XML_NAMESPACE_URI = "http://www.w3.org/XML/1998/namespace";
|
|
287
|
-
/** The reserved `xmlns:` namespace that namespace declarations themselves live in. */
|
|
288
|
-
declare const XMLNS_NAMESPACE_URI = "http://www.w3.org/2000/xmlns/";
|
|
289
|
-
/** The `w14` wordml-2010 extension namespace — `w14:paraId`/`w14:textId` live here. */
|
|
290
|
-
declare const W14_NAMESPACE_URI = "http://schemas.microsoft.com/office/word/2010/wordml";
|
|
291
|
-
declare const DRAWINGML_MAIN_NAMESPACE_URI = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
292
|
-
declare const WP_NAMESPACE_URI = "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing";
|
|
293
|
-
declare const PIC_NAMESPACE_URI = "http://schemas.openxmlformats.org/drawingml/2006/picture";
|
|
294
|
-
/** The four content-position revision wrappers, which nest and carry runs. */
|
|
295
|
-
declare function isContentRevisionKind(kind: OoxmlNode['kind']): kind is 'revisionInsert' | 'revisionDelete' | 'revisionMoveFrom' | 'revisionMoveTo';
|
|
296
|
-
/** Move-range and comment-range boundary markers, which are empty and sit between runs. */
|
|
297
|
-
declare function isRangeMarkerKind(kind: OoxmlNode['kind']): kind is 'moveFromRangeStart' | 'moveFromRangeEnd' | 'moveToRangeStart' | 'moveToRangeEnd' | 'commentRangeStart' | 'commentRangeEnd';
|
|
298
|
-
/**
|
|
299
|
-
* OOXML on/off toggle: on only when a same-namespace child is present and its `w:val`
|
|
300
|
-
* (same namespace as the child) does not explicitly disable. Foreign-namespace siblings
|
|
301
|
-
* with the same local name cannot turn the flag on.
|
|
302
|
-
*/
|
|
303
|
-
declare function readOnOffChild(parent: OoxmlNode, localName: string, namespaceUri?: string): boolean;
|
|
304
|
-
|
|
305
|
-
/**
|
|
306
|
-
* A node's stable identity within its part.
|
|
307
|
-
*
|
|
308
|
-
* Minted deterministically from the structural path at parse, then RETAINED through structural
|
|
309
|
-
* sharing — the same bytes always produce the same ids, and an edit elsewhere in the document
|
|
310
|
-
* does not renumber untouched nodes. Every tree op addresses nodes by these.
|
|
311
|
-
*/
|
|
312
|
-
type OoxmlNodeId = string;
|
|
313
|
-
/**
|
|
314
|
-
* One `xmlns:` declaration carried on a node.
|
|
315
|
-
*
|
|
316
|
-
* Preserved rather than normalized away: a document that binds `w14` at the root and a document
|
|
317
|
-
* that binds it on a paragraph are different bytes, and re-emitting the wrong one is a fidelity
|
|
318
|
-
* loss even though the semantics match.
|
|
319
|
-
*/
|
|
320
|
-
interface OoxmlNamespaceBinding {
|
|
321
|
-
readonly prefix: string;
|
|
322
|
-
readonly namespaceUri: string;
|
|
323
|
-
}
|
|
324
|
-
interface OoxmlAttributeBase {
|
|
325
|
-
readonly namespaceUri: string;
|
|
326
|
-
readonly localName: string;
|
|
327
|
-
readonly prefix?: string;
|
|
328
|
-
readonly value: string;
|
|
329
|
-
}
|
|
330
|
-
/** `xml:space`, which decides whether a run's leading and trailing whitespace survives. */
|
|
331
|
-
interface OoxmlXmlSpaceAttribute extends OoxmlAttributeBase {
|
|
332
|
-
readonly kind: 'xmlSpace';
|
|
333
|
-
readonly namespaceUri: typeof XML_NAMESPACE_URI;
|
|
334
|
-
readonly localName: 'space';
|
|
335
|
-
readonly prefix: 'xml';
|
|
336
|
-
readonly value: 'default' | 'preserve';
|
|
337
|
-
}
|
|
338
|
-
/** `w:val` — the attribute nearly every WordprocessingML property carries its value in. */
|
|
339
|
-
interface OoxmlWmlValAttribute extends OoxmlAttributeBase {
|
|
340
|
-
readonly kind: 'wmlVal';
|
|
341
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
342
|
-
readonly localName: 'val';
|
|
343
|
-
}
|
|
344
|
-
/**
|
|
345
|
-
* Any attribute outside the typed vocabulary, carried verbatim.
|
|
346
|
-
*
|
|
347
|
-
* Where losslessness actually happens: an attribute this engine has no model for is preserved
|
|
348
|
-
* exactly rather than dropped, so a save re-emits what the file said.
|
|
349
|
-
*/
|
|
350
|
-
interface OoxmlGenericExtensionAttribute extends OoxmlAttributeBase {
|
|
351
|
-
readonly kind: 'genericExtension';
|
|
352
|
-
}
|
|
353
|
-
/** Any attribute on any node: the two typed ones, plus the verbatim catch-all. */
|
|
354
|
-
type OoxmlAttribute = OoxmlXmlSpaceAttribute | OoxmlWmlValAttribute | OoxmlGenericExtensionAttribute;
|
|
355
|
-
/**
|
|
356
|
-
* Attributes a TYPED node may carry.
|
|
357
|
-
*
|
|
358
|
-
* Excludes `w:val` on purpose: a node the engine models keeps its value in typed fields, and
|
|
359
|
-
* allowing a stray `w:val` alongside them would create two sources of truth for one property.
|
|
360
|
-
*/
|
|
361
|
-
type OoxmlKnownNodeAttribute = OoxmlXmlSpaceAttribute | OoxmlGenericExtensionAttribute;
|
|
362
|
-
interface OoxmlElementBase<Children extends readonly OoxmlNode[] = readonly OoxmlNode[], Attributes extends readonly OoxmlAttribute[] = readonly OoxmlAttribute[]> {
|
|
363
|
-
readonly id: OoxmlNodeId;
|
|
364
|
-
readonly namespaceUri: string;
|
|
365
|
-
readonly localName: string;
|
|
366
|
-
/** Authored prefix retained as non-authoritative fidelity evidence. */
|
|
367
|
-
readonly prefix?: string;
|
|
368
|
-
/** Namespace declarations authored directly on this element, in source order. */
|
|
369
|
-
readonly namespaceBindings: readonly OoxmlNamespaceBinding[];
|
|
370
|
-
readonly attributes: Attributes;
|
|
371
|
-
readonly children: Children;
|
|
372
|
-
}
|
|
373
|
-
/** `w:document` — the root of a main document part. */
|
|
374
|
-
interface OoxmlDocumentNode extends OoxmlElementBase<readonly (OoxmlBodyNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
375
|
-
readonly kind: 'document';
|
|
376
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
377
|
-
readonly localName: 'document';
|
|
378
|
-
}
|
|
379
|
-
/** `w:body` — the main story's block content. */
|
|
380
|
-
interface OoxmlBodyNode extends OoxmlElementBase<readonly (OoxmlParagraphNode | OoxmlTableNode | OoxmlContentControlNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
381
|
-
readonly kind: 'body';
|
|
382
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
383
|
-
readonly localName: 'body';
|
|
384
|
-
}
|
|
385
|
-
interface OoxmlTableNode extends OoxmlElementBase<readonly (OoxmlTablePropertiesNode | OoxmlTableGridNode | OoxmlTableRowNode | OoxmlContentControlNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
386
|
-
readonly kind: 'table';
|
|
387
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
388
|
-
readonly localName: 'tbl';
|
|
389
|
-
}
|
|
390
|
-
interface OoxmlTableRowNode extends OoxmlElementBase<readonly (OoxmlTableCellNode | OoxmlContentControlNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
391
|
-
readonly kind: 'tableRow';
|
|
392
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
393
|
-
readonly localName: 'tr';
|
|
394
|
-
}
|
|
395
|
-
interface OoxmlTableCellNode extends OoxmlElementBase<readonly (OoxmlParagraphNode | OoxmlTableNode | OoxmlContentControlNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
396
|
-
readonly kind: 'tableCell';
|
|
397
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
398
|
-
readonly localName: 'tc';
|
|
399
|
-
}
|
|
400
|
-
/** Grid children (`w:gridCol`) stay generic: they are property leaves, not structure. */
|
|
401
|
-
interface OoxmlTableGridNode extends OoxmlElementBase<readonly OoxmlGenericElementNode[], readonly OoxmlKnownNodeAttribute[]> {
|
|
402
|
-
readonly kind: 'tableGrid';
|
|
403
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
404
|
-
readonly localName: 'tblGrid';
|
|
405
|
-
}
|
|
406
|
-
/** Property children stay generic, mirroring `runProperties`. */
|
|
407
|
-
interface OoxmlTablePropertiesNode extends OoxmlElementBase<readonly OoxmlGenericElementNode[], readonly OoxmlKnownNodeAttribute[]> {
|
|
408
|
-
readonly kind: 'tableProperties';
|
|
409
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
410
|
-
readonly localName: 'tblPr';
|
|
411
|
-
}
|
|
412
|
-
/**
|
|
413
|
-
* `w:p` — a paragraph, and the unit every offset in this engine is relative to.
|
|
414
|
-
*
|
|
415
|
-
* Positions are addressed as this node's id plus a UTF-16 offset, which is what makes a paragraph
|
|
416
|
-
* inside a table cell no different from one at the top level.
|
|
417
|
-
*/
|
|
418
|
-
interface OoxmlParagraphNode extends OoxmlElementBase<readonly (OoxmlParagraphPropertiesNode | OoxmlRunNode | OoxmlHyperlinkNode | OoxmlContentControlNode | OoxmlBookmarkStartNode | OoxmlBookmarkEndNode | OoxmlRevisionContentNode | OoxmlRangeMarkerNode | OoxmlFldSimpleNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
419
|
-
readonly kind: 'paragraph';
|
|
420
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
421
|
-
readonly localName: 'p';
|
|
422
|
-
}
|
|
423
|
-
/**
|
|
424
|
-
* `CT_Hyperlink` (ECMA-376 §17.16.22) — a RUN CONTAINER, not a leaf.
|
|
425
|
-
*
|
|
426
|
-
* Its runs are part of the paragraph's inline sequence: they measure, paint, select and
|
|
427
|
-
* take offsets exactly like a run written directly under the `w:p`. Typing the element is
|
|
428
|
-
* what lets them in; while it was generic, its runs never reached the token stream and the
|
|
429
|
-
* words inside every link simply did not paint.
|
|
430
|
-
*
|
|
431
|
-
* Targets live in the ATTRIBUTES, and §17.16.22 declares exactly six. They divide into two
|
|
432
|
-
* groups, and the difference is load-bearing:
|
|
433
|
-
*
|
|
434
|
-
* MODELED `r:id` (a relationship, resolved against the owning part's rels), `w:anchor`
|
|
435
|
-
* (a bookmark name in this document) and `w:tooltip`. These are the three the
|
|
436
|
-
* ops read and write — `setHyperlinkTarget` sets one target attribute and
|
|
437
|
-
* CLEARS the other, so a link never carries both and resolves by the wrong one.
|
|
438
|
-
*
|
|
439
|
-
* PRESERVED `w:tgtFrame`, `w:docLocation` and `w:history`. Nothing in this engine
|
|
440
|
-
* interprets them and no op names them; they survive because attributes are
|
|
441
|
-
* carried verbatim, and `setHyperlinkTarget` must leave them exactly as
|
|
442
|
-
* authored. That is a REQUIREMENT, not an incidental property of the current
|
|
443
|
-
* applier: `w:docLocation` names a location inside the target document, so
|
|
444
|
-
* silently dropping it on a retarget would change where a link goes.
|
|
445
|
-
* `hyperlink-lossless-editing.test.ts` pins both against a retarget.
|
|
446
|
-
*
|
|
447
|
-
* Nothing here is a runtime URL — the sanitized projection is computed separately (see
|
|
448
|
-
* `hyperlinkTargetOf`), and only that reaches a DOM or navigation sink.
|
|
449
|
-
*
|
|
450
|
-
* Bookmark markers are admitted as children because Word writes them inside links; anything
|
|
451
|
-
* else it can carry (a drawing, a field, a nested SDT) stays `generic` at its position, so a
|
|
452
|
-
* link around a picture keeps both the picture and the link.
|
|
453
|
-
*
|
|
454
|
-
* A link may contain ANOTHER link: §17.16.22's content model is `EG_PContent`, which lists
|
|
455
|
-
* `w:hyperlink` among its own members. That is why this child union is self-referential
|
|
456
|
-
* rather than bottoming out at runs. Demoting the inner one to `generic` would have been the
|
|
457
|
-
* easier type, and it would have reintroduced exactly the bug typing this element fixed —
|
|
458
|
-
* a generic link's runs never reach the token stream, so the words inside it stop painting.
|
|
459
|
-
* Every walk that descends a link therefore recurses (`segmentsOf`, `runsUnder`,
|
|
460
|
-
* `runPropertyEdits`) instead of descending one level.
|
|
461
|
-
*/
|
|
462
|
-
interface OoxmlHyperlinkNode extends OoxmlElementBase<readonly (OoxmlRunNode | OoxmlHyperlinkNode | OoxmlContentControlNode | OoxmlBookmarkStartNode | OoxmlBookmarkEndNode | OoxmlRevisionContentNode | OoxmlRangeMarkerNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
463
|
-
readonly kind: 'hyperlink';
|
|
464
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
465
|
-
readonly localName: 'hyperlink';
|
|
466
|
-
}
|
|
467
|
-
/**
|
|
468
|
-
* A content-position revision wrapper — `w:ins`, `w:del`, `w:moveFrom`, `w:moveTo`.
|
|
469
|
-
*
|
|
470
|
-
* These wrap runs, so a walk that visits only direct `run` children never reaches
|
|
471
|
-
* the content inside them. Typing them is what lets layout descend deliberately
|
|
472
|
-
* rather than treating tracked content as unknown markup.
|
|
473
|
-
*
|
|
474
|
-
* ECMA-376 §17.13.5.18/.14/.25/.29. All four extend `CT_TrackChange`: `@w:id` and
|
|
475
|
-
* `@w:author` are required, `@w:date` is optional and is never fabricated.
|
|
476
|
-
*
|
|
477
|
-
* The SAME element names appear in property positions — `w:pPr/w:rPr/w:ins` marks a
|
|
478
|
-
* paragraph mark, `w:trPr/w:del` marks a row — where they carry no content and mean
|
|
479
|
-
* something structurally different. Those stay generic; see `contentRevisionKind`.
|
|
480
|
-
*/
|
|
481
|
-
interface OoxmlRevisionContentNode extends OoxmlElementBase<readonly (OoxmlRunNode | OoxmlRevisionContentNode | OoxmlHyperlinkNode | OoxmlRangeMarkerNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
482
|
-
readonly kind: 'revisionInsert' | 'revisionDelete' | 'revisionMoveFrom' | 'revisionMoveTo';
|
|
483
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
484
|
-
readonly localName: 'ins' | 'del' | 'moveFrom' | 'moveTo';
|
|
485
|
-
}
|
|
486
|
-
/**
|
|
487
|
-
* `w:bookmarkStart` — a ZERO-LENGTH point anchor (`@w:id`, `@w:name`).
|
|
488
|
-
*
|
|
489
|
-
* It takes no text offset and paints nothing; it only marks a position, which is what an
|
|
490
|
-
* internal hyperlink's `w:anchor` names. Split and join place it by that position, the
|
|
491
|
-
* behaviour `tree-op-split-anchors.test.ts` pins.
|
|
492
|
-
*/
|
|
493
|
-
interface OoxmlBookmarkStartNode extends OoxmlElementBase<readonly [], readonly OoxmlKnownNodeAttribute[]> {
|
|
494
|
-
readonly kind: 'bookmarkStart';
|
|
495
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
496
|
-
readonly localName: 'bookmarkStart';
|
|
497
|
-
}
|
|
498
|
-
/** `w:bookmarkEnd` — the closing point anchor (`@w:id`), zero-length like its start. */
|
|
499
|
-
interface OoxmlBookmarkEndNode extends OoxmlElementBase<readonly [], readonly OoxmlKnownNodeAttribute[]> {
|
|
500
|
-
readonly kind: 'bookmarkEnd';
|
|
501
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
502
|
-
readonly localName: 'bookmarkEnd';
|
|
503
|
-
}
|
|
504
|
-
/**
|
|
505
|
-
* A range marker: the move-range and comment-range boundaries.
|
|
506
|
-
*
|
|
507
|
-
* Three of the base types in this family disagree, and the disagreement is load-bearing:
|
|
508
|
-
*
|
|
509
|
-
* - `w:moveFromRangeStart` / `w:moveToRangeStart` are `CT_MoveBookmark` (§17.13.5.22/.26):
|
|
510
|
-
* `@w:name`, `@w:author`, and `@w:date` are all REQUIRED.
|
|
511
|
-
* - `w:moveFromRangeEnd` / `w:moveToRangeEnd` / `w:commentRangeStart` / `w:commentRangeEnd`
|
|
512
|
-
* are `CT_MarkupRange` (§17.13.5.21): `@w:id` only, with NO author and NO date. Requiring
|
|
513
|
-
* provenance here refuses valid files; writing it emits invalid XML.
|
|
514
|
-
*
|
|
515
|
-
* Two different join keys ride on these: `@w:name` pairs a `moveFrom` range with its
|
|
516
|
-
* `moveTo` range, while `@w:id` pairs a range start with its own range end. In a real
|
|
517
|
-
* document the two halves of a named pair carry different ids, so neither key substitutes
|
|
518
|
-
* for the other.
|
|
519
|
-
*/
|
|
520
|
-
interface OoxmlRangeMarkerNode extends OoxmlElementBase<readonly [], readonly OoxmlKnownNodeAttribute[]> {
|
|
521
|
-
readonly kind: 'moveFromRangeStart' | 'moveFromRangeEnd' | 'moveToRangeStart' | 'moveToRangeEnd' | 'commentRangeStart' | 'commentRangeEnd';
|
|
522
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
523
|
-
readonly localName: 'moveFromRangeStart' | 'moveFromRangeEnd' | 'moveToRangeStart' | 'moveToRangeEnd' | 'commentRangeStart' | 'commentRangeEnd';
|
|
524
|
-
}
|
|
525
|
-
/** `w:commentReference` — the in-run mark that carries the comment's anchor point. */
|
|
526
|
-
interface OoxmlCommentReferenceNode extends OoxmlElementBase<readonly [], readonly OoxmlKnownNodeAttribute[]> {
|
|
527
|
-
readonly kind: 'commentReference';
|
|
528
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
529
|
-
readonly localName: 'commentReference';
|
|
530
|
-
}
|
|
531
|
-
/** The `word/comments.xml` root (`CT_Comments`, §17.13.4.2). */
|
|
532
|
-
interface OoxmlCommentsNode extends OoxmlElementBase<readonly (OoxmlCommentNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
533
|
-
readonly kind: 'comments';
|
|
534
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
535
|
-
readonly localName: 'comments';
|
|
536
|
-
}
|
|
537
|
-
/**
|
|
538
|
-
* One comment (`CT_Comment`, §17.13.4.4) — `CT_TrackChange` plus `@w:initials`, holding
|
|
539
|
-
* block content. The block content is why a comment body is a story rather than a string.
|
|
540
|
-
*/
|
|
541
|
-
interface OoxmlCommentNode extends OoxmlElementBase<readonly (OoxmlParagraphNode | OoxmlTableNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
542
|
-
readonly kind: 'comment';
|
|
543
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
544
|
-
readonly localName: 'comment';
|
|
545
|
-
}
|
|
546
|
-
/** `w:r` — a run: text and atoms sharing one set of character properties. */
|
|
547
|
-
interface OoxmlRunNode extends OoxmlElementBase<readonly (OoxmlRunPropertiesNode | OoxmlTextElementNode | OoxmlDeletedTextNode | OoxmlTabNode | OoxmlHardBreakNode | OoxmlCommentReferenceNode | OoxmlFldCharNode | OoxmlInstrTextNode | OoxmlNoteReferenceNode | OoxmlNoteRefNode | OoxmlSeparatorNode | OoxmlContinuationSeparatorNode | OoxmlDrawingNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
548
|
-
readonly kind: 'run';
|
|
549
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
550
|
-
readonly localName: 'r';
|
|
551
|
-
}
|
|
552
|
-
/** `w:drawing` — run content only; exactly one typed inline or anchored child. */
|
|
553
|
-
interface OoxmlDrawingNode extends OoxmlElementBase<readonly (OoxmlInlineDrawingNode | OoxmlAnchoredDrawingNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
554
|
-
readonly kind: 'drawing';
|
|
555
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
556
|
-
readonly localName: 'drawing';
|
|
557
|
-
}
|
|
558
|
-
/** `wp:inline` / `wp:anchor` shared payload children. */
|
|
559
|
-
type OoxmlDrawingAnchorChild = OoxmlDrawingExtentNode | OoxmlDrawingEffectExtentNode | OoxmlDrawingDocPrNode | OoxmlDrawingGraphicFramePrNode | OoxmlDrawingGraphicNode | OoxmlDrawingSimplePosNode | OoxmlDrawingPositionHNode | OoxmlDrawingPositionVNode | OoxmlDrawingWrapNoneNode | OoxmlDrawingWrapSquareNode | OoxmlDrawingWrapTightNode | OoxmlDrawingWrapThroughNode | OoxmlDrawingWrapTopBottomNode | OoxmlGenericElementNode;
|
|
560
|
-
/** `wp:inline` (`CT_Inline`) — typed only under `w:drawing`. */
|
|
561
|
-
interface OoxmlInlineDrawingNode extends OoxmlElementBase<readonly OoxmlDrawingAnchorChild[], readonly OoxmlKnownNodeAttribute[]> {
|
|
562
|
-
readonly kind: 'inlineDrawing';
|
|
563
|
-
readonly namespaceUri: typeof WP_NAMESPACE_URI;
|
|
564
|
-
readonly localName: 'inline';
|
|
565
|
-
}
|
|
566
|
-
/** `wp:anchor` (`CT_Anchor`) — typed only under `w:drawing`. */
|
|
567
|
-
interface OoxmlAnchoredDrawingNode extends OoxmlElementBase<readonly OoxmlDrawingAnchorChild[], readonly OoxmlKnownNodeAttribute[]> {
|
|
568
|
-
readonly kind: 'anchoredDrawing';
|
|
569
|
-
readonly namespaceUri: typeof WP_NAMESPACE_URI;
|
|
570
|
-
readonly localName: 'anchor';
|
|
571
|
-
}
|
|
572
|
-
interface OoxmlDrawingExtentNode extends OoxmlElementBase<readonly [], readonly OoxmlKnownNodeAttribute[]> {
|
|
573
|
-
readonly kind: 'drawingExtent';
|
|
574
|
-
readonly namespaceUri: typeof WP_NAMESPACE_URI;
|
|
575
|
-
readonly localName: 'extent';
|
|
576
|
-
}
|
|
577
|
-
interface OoxmlDrawingEffectExtentNode extends OoxmlElementBase<readonly [], readonly OoxmlKnownNodeAttribute[]> {
|
|
578
|
-
readonly kind: 'drawingEffectExtent';
|
|
579
|
-
readonly namespaceUri: typeof WP_NAMESPACE_URI;
|
|
580
|
-
readonly localName: 'effectExtent';
|
|
581
|
-
}
|
|
582
|
-
interface OoxmlDrawingDocPrNode extends OoxmlElementBase<readonly OoxmlGenericElementNode[], readonly OoxmlKnownNodeAttribute[]> {
|
|
583
|
-
readonly kind: 'drawingDocPr';
|
|
584
|
-
readonly namespaceUri: typeof WP_NAMESPACE_URI;
|
|
585
|
-
readonly localName: 'docPr';
|
|
586
|
-
}
|
|
587
|
-
interface OoxmlDrawingGraphicFramePrNode extends OoxmlElementBase<readonly OoxmlGenericElementNode[], readonly OoxmlKnownNodeAttribute[]> {
|
|
588
|
-
readonly kind: 'drawingGraphicFramePr';
|
|
589
|
-
readonly namespaceUri: typeof WP_NAMESPACE_URI;
|
|
590
|
-
readonly localName: 'cNvGraphicFramePr';
|
|
591
|
-
}
|
|
592
|
-
interface OoxmlDrawingGraphicNode extends OoxmlElementBase<readonly (OoxmlDrawingGraphicDataNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
593
|
-
readonly kind: 'drawingGraphic';
|
|
594
|
-
readonly namespaceUri: typeof DRAWINGML_MAIN_NAMESPACE_URI;
|
|
595
|
-
readonly localName: 'graphic';
|
|
596
|
-
}
|
|
597
|
-
interface OoxmlDrawingGraphicDataNode extends OoxmlElementBase<readonly (OoxmlPictureNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
598
|
-
readonly kind: 'drawingGraphicData';
|
|
599
|
-
readonly namespaceUri: typeof DRAWINGML_MAIN_NAMESPACE_URI;
|
|
600
|
-
readonly localName: 'graphicData';
|
|
601
|
-
}
|
|
602
|
-
interface OoxmlDrawingSimplePosNode extends OoxmlElementBase<readonly [], readonly OoxmlKnownNodeAttribute[]> {
|
|
603
|
-
readonly kind: 'drawingSimplePos';
|
|
604
|
-
readonly namespaceUri: typeof WP_NAMESPACE_URI;
|
|
605
|
-
readonly localName: 'simplePos';
|
|
606
|
-
}
|
|
607
|
-
interface OoxmlDrawingPositionHNode extends OoxmlElementBase<readonly (OoxmlDrawingPositionAlignNode | OoxmlDrawingPositionOffsetNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
608
|
-
readonly kind: 'drawingPositionH';
|
|
609
|
-
readonly namespaceUri: typeof WP_NAMESPACE_URI;
|
|
610
|
-
readonly localName: 'positionH';
|
|
611
|
-
}
|
|
612
|
-
interface OoxmlDrawingPositionVNode extends OoxmlElementBase<readonly (OoxmlDrawingPositionAlignNode | OoxmlDrawingPositionOffsetNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
613
|
-
readonly kind: 'drawingPositionV';
|
|
614
|
-
readonly namespaceUri: typeof WP_NAMESPACE_URI;
|
|
615
|
-
readonly localName: 'positionV';
|
|
616
|
-
}
|
|
617
|
-
interface OoxmlDrawingPositionAlignNode extends OoxmlElementBase<readonly (OoxmlTextNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
618
|
-
readonly kind: 'drawingPositionAlign';
|
|
619
|
-
readonly namespaceUri: typeof WP_NAMESPACE_URI;
|
|
620
|
-
readonly localName: 'align';
|
|
621
|
-
}
|
|
622
|
-
interface OoxmlDrawingPositionOffsetNode extends OoxmlElementBase<readonly (OoxmlTextNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
623
|
-
readonly kind: 'drawingPositionOffset';
|
|
624
|
-
readonly namespaceUri: typeof WP_NAMESPACE_URI;
|
|
625
|
-
readonly localName: 'posOffset';
|
|
626
|
-
}
|
|
627
|
-
interface OoxmlDrawingWrapNoneNode extends OoxmlElementBase<readonly OoxmlGenericElementNode[], readonly OoxmlKnownNodeAttribute[]> {
|
|
628
|
-
readonly kind: 'drawingWrapNone';
|
|
629
|
-
readonly namespaceUri: typeof WP_NAMESPACE_URI;
|
|
630
|
-
readonly localName: 'wrapNone';
|
|
631
|
-
}
|
|
632
|
-
interface OoxmlDrawingWrapSquareNode extends OoxmlElementBase<readonly (OoxmlDrawingEffectExtentNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
633
|
-
readonly kind: 'drawingWrapSquare';
|
|
634
|
-
readonly namespaceUri: typeof WP_NAMESPACE_URI;
|
|
635
|
-
readonly localName: 'wrapSquare';
|
|
636
|
-
}
|
|
637
|
-
interface OoxmlDrawingWrapTightNode extends OoxmlElementBase<readonly (OoxmlDrawingWrapPolygonNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
638
|
-
readonly kind: 'drawingWrapTight';
|
|
639
|
-
readonly namespaceUri: typeof WP_NAMESPACE_URI;
|
|
640
|
-
readonly localName: 'wrapTight';
|
|
641
|
-
}
|
|
642
|
-
interface OoxmlDrawingWrapThroughNode extends OoxmlElementBase<readonly (OoxmlDrawingWrapPolygonNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
643
|
-
readonly kind: 'drawingWrapThrough';
|
|
644
|
-
readonly namespaceUri: typeof WP_NAMESPACE_URI;
|
|
645
|
-
readonly localName: 'wrapThrough';
|
|
646
|
-
}
|
|
647
|
-
interface OoxmlDrawingWrapTopBottomNode extends OoxmlElementBase<readonly (OoxmlDrawingEffectExtentNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
648
|
-
readonly kind: 'drawingWrapTopBottom';
|
|
649
|
-
readonly namespaceUri: typeof WP_NAMESPACE_URI;
|
|
650
|
-
readonly localName: 'wrapTopAndBottom';
|
|
651
|
-
}
|
|
652
|
-
interface OoxmlDrawingWrapPolygonNode extends OoxmlElementBase<readonly (OoxmlDrawingWrapPolygonStartNode | OoxmlDrawingWrapPolygonLineToNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
653
|
-
readonly kind: 'drawingWrapPolygon';
|
|
654
|
-
readonly namespaceUri: typeof WP_NAMESPACE_URI;
|
|
655
|
-
readonly localName: 'wrapPolygon';
|
|
656
|
-
}
|
|
657
|
-
interface OoxmlDrawingWrapPolygonStartNode extends OoxmlElementBase<readonly [], readonly OoxmlKnownNodeAttribute[]> {
|
|
658
|
-
readonly kind: 'drawingWrapPolygonStart';
|
|
659
|
-
readonly namespaceUri: typeof WP_NAMESPACE_URI;
|
|
660
|
-
readonly localName: 'start';
|
|
661
|
-
}
|
|
662
|
-
interface OoxmlDrawingWrapPolygonLineToNode extends OoxmlElementBase<readonly [], readonly OoxmlKnownNodeAttribute[]> {
|
|
663
|
-
readonly kind: 'drawingWrapPolygonLineTo';
|
|
664
|
-
readonly namespaceUri: typeof WP_NAMESPACE_URI;
|
|
665
|
-
readonly localName: 'lineTo';
|
|
666
|
-
}
|
|
667
|
-
/** `pic:pic` (`CT_Picture`) — typed only under picture `a:graphicData`. */
|
|
668
|
-
interface OoxmlPictureNode extends OoxmlElementBase<readonly (OoxmlPictureNvPicPrNode | OoxmlPictureBlipFillNode | OoxmlPictureShapePropertiesNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
669
|
-
readonly kind: 'picture';
|
|
670
|
-
readonly namespaceUri: typeof PIC_NAMESPACE_URI;
|
|
671
|
-
readonly localName: 'pic';
|
|
672
|
-
}
|
|
673
|
-
interface OoxmlPictureNvPicPrNode extends OoxmlElementBase<readonly OoxmlGenericElementNode[], readonly OoxmlKnownNodeAttribute[]> {
|
|
674
|
-
readonly kind: 'pictureNvPicPr';
|
|
675
|
-
readonly namespaceUri: typeof PIC_NAMESPACE_URI;
|
|
676
|
-
readonly localName: 'nvPicPr';
|
|
677
|
-
}
|
|
678
|
-
interface OoxmlPictureBlipFillNode extends OoxmlElementBase<readonly (OoxmlPictureBlipNode | OoxmlPictureSrcRectNode | OoxmlPictureStretchNode | OoxmlPictureTileNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
679
|
-
readonly kind: 'pictureBlipFill';
|
|
680
|
-
readonly namespaceUri: typeof PIC_NAMESPACE_URI;
|
|
681
|
-
readonly localName: 'blipFill';
|
|
682
|
-
}
|
|
683
|
-
interface OoxmlPictureBlipNode extends OoxmlElementBase<readonly [], readonly OoxmlKnownNodeAttribute[]> {
|
|
684
|
-
readonly kind: 'pictureBlip';
|
|
685
|
-
readonly namespaceUri: typeof DRAWINGML_MAIN_NAMESPACE_URI;
|
|
686
|
-
readonly localName: 'blip';
|
|
687
|
-
}
|
|
688
|
-
interface OoxmlPictureSrcRectNode extends OoxmlElementBase<readonly [], readonly OoxmlKnownNodeAttribute[]> {
|
|
689
|
-
readonly kind: 'pictureSrcRect';
|
|
690
|
-
readonly namespaceUri: typeof DRAWINGML_MAIN_NAMESPACE_URI;
|
|
691
|
-
readonly localName: 'srcRect';
|
|
692
|
-
}
|
|
693
|
-
interface OoxmlPictureStretchNode extends OoxmlElementBase<readonly OoxmlGenericElementNode[], readonly OoxmlKnownNodeAttribute[]> {
|
|
694
|
-
readonly kind: 'pictureStretch';
|
|
695
|
-
readonly namespaceUri: typeof DRAWINGML_MAIN_NAMESPACE_URI;
|
|
696
|
-
readonly localName: 'stretch';
|
|
697
|
-
}
|
|
698
|
-
interface OoxmlPictureTileNode extends OoxmlElementBase<readonly OoxmlGenericElementNode[], readonly OoxmlKnownNodeAttribute[]> {
|
|
699
|
-
readonly kind: 'pictureTile';
|
|
700
|
-
readonly namespaceUri: typeof DRAWINGML_MAIN_NAMESPACE_URI;
|
|
701
|
-
readonly localName: 'tile';
|
|
702
|
-
}
|
|
703
|
-
interface OoxmlPictureShapePropertiesNode extends OoxmlElementBase<readonly (OoxmlPictureTransformNode | OoxmlPicturePresetGeometryNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
704
|
-
readonly kind: 'pictureShapeProperties';
|
|
705
|
-
readonly namespaceUri: typeof PIC_NAMESPACE_URI;
|
|
706
|
-
readonly localName: 'spPr';
|
|
707
|
-
}
|
|
708
|
-
interface OoxmlPictureTransformNode extends OoxmlElementBase<readonly (OoxmlPictureTransformOffsetNode | OoxmlPictureTransformExtentNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
709
|
-
readonly kind: 'pictureTransform';
|
|
710
|
-
readonly namespaceUri: typeof DRAWINGML_MAIN_NAMESPACE_URI;
|
|
711
|
-
readonly localName: 'xfrm';
|
|
712
|
-
}
|
|
713
|
-
interface OoxmlPictureTransformOffsetNode extends OoxmlElementBase<readonly [], readonly OoxmlKnownNodeAttribute[]> {
|
|
714
|
-
readonly kind: 'pictureTransformOffset';
|
|
715
|
-
readonly namespaceUri: typeof DRAWINGML_MAIN_NAMESPACE_URI;
|
|
716
|
-
readonly localName: 'off';
|
|
717
|
-
}
|
|
718
|
-
interface OoxmlPictureTransformExtentNode extends OoxmlElementBase<readonly [], readonly OoxmlKnownNodeAttribute[]> {
|
|
719
|
-
readonly kind: 'pictureTransformExtent';
|
|
720
|
-
readonly namespaceUri: typeof DRAWINGML_MAIN_NAMESPACE_URI;
|
|
721
|
-
readonly localName: 'ext';
|
|
722
|
-
}
|
|
723
|
-
interface OoxmlPicturePresetGeometryNode extends OoxmlElementBase<readonly OoxmlGenericElementNode[], readonly OoxmlKnownNodeAttribute[]> {
|
|
724
|
-
readonly kind: 'picturePresetGeometry';
|
|
725
|
-
readonly namespaceUri: typeof DRAWINGML_MAIN_NAMESPACE_URI;
|
|
726
|
-
readonly localName: 'prstGeom';
|
|
727
|
-
}
|
|
728
|
-
/**
|
|
729
|
-
* `w:delText` (§17.3.3.7) — the text container a run uses once its content is deleted.
|
|
730
|
-
*
|
|
731
|
-
* Structurally identical to `w:t`, and deliberately a DIFFERENT kind: it must never flow
|
|
732
|
-
* as ordinary text, and rejecting the deletion that contains it turns it back into `w:t`.
|
|
733
|
-
*/
|
|
734
|
-
interface OoxmlDeletedTextNode extends OoxmlElementBase<readonly OoxmlTextNode[], readonly OoxmlKnownNodeAttribute[]> {
|
|
735
|
-
readonly kind: 'deletedText';
|
|
736
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
737
|
-
readonly localName: 'delText';
|
|
738
|
-
}
|
|
739
|
-
/**
|
|
740
|
-
* `w:rPr` — a run's character properties, whose children stay GENERIC.
|
|
741
|
-
*
|
|
742
|
-
* Deliberately unmodelled below this point: the property vocabulary is large and mostly
|
|
743
|
-
* uninteresting to layout, so carrying it verbatim preserves everything without the engine having
|
|
744
|
-
* to know what each element means.
|
|
745
|
-
*/
|
|
746
|
-
interface OoxmlRunPropertiesNode extends OoxmlElementBase<readonly OoxmlGenericElementNode[], readonly OoxmlKnownNodeAttribute[]> {
|
|
747
|
-
readonly kind: 'runProperties';
|
|
748
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
749
|
-
readonly localName: 'rPr';
|
|
750
|
-
}
|
|
751
|
-
/** `w:t` — the element holding a run's literal characters. */
|
|
752
|
-
interface OoxmlTextElementNode extends OoxmlElementBase<readonly OoxmlTextNode[], readonly OoxmlKnownNodeAttribute[]> {
|
|
753
|
-
readonly kind: 'text';
|
|
754
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
755
|
-
readonly localName: 't';
|
|
756
|
-
}
|
|
757
|
-
/** `w:pPr` — a paragraph's properties. Children stay generic, like `w:rPr`'s. */
|
|
758
|
-
interface OoxmlParagraphPropertiesNode extends OoxmlElementBase<readonly (OoxmlRunPropertiesNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
759
|
-
readonly kind: 'paragraphProperties';
|
|
760
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
761
|
-
readonly localName: 'pPr';
|
|
762
|
-
}
|
|
763
|
-
/** `w:tab` inside a run — one tab character as its own element. */
|
|
764
|
-
interface OoxmlTabNode extends OoxmlElementBase<readonly [], readonly OoxmlKnownNodeAttribute[]> {
|
|
765
|
-
readonly kind: 'tab';
|
|
766
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
767
|
-
readonly localName: 'tab';
|
|
768
|
-
}
|
|
769
|
-
/** `w:br` — a line, column or page break inside a run. */
|
|
770
|
-
interface OoxmlHardBreakNode extends OoxmlElementBase<readonly [], readonly OoxmlKnownNodeAttribute[]> {
|
|
771
|
-
readonly kind: 'hardBreak';
|
|
772
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
773
|
-
readonly localName: 'br';
|
|
774
|
-
}
|
|
775
|
-
/**
|
|
776
|
-
* Complex-field character (`w:fldChar`).
|
|
777
|
-
*
|
|
778
|
-
* Children stay generic so `w:ffData` (legacy form fields / macros) round-trips as inert
|
|
779
|
-
* payload and is never promoted to an executable surface. `@w:fldCharType`, `@w:dirty`,
|
|
780
|
-
* and `@w:fldLock` are preserved on `attributes`.
|
|
781
|
-
*/
|
|
782
|
-
interface OoxmlFldCharNode extends OoxmlElementBase<readonly OoxmlGenericElementNode[], readonly OoxmlKnownNodeAttribute[]> {
|
|
783
|
-
readonly kind: 'fldChar';
|
|
784
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
785
|
-
readonly localName: 'fldChar';
|
|
786
|
-
}
|
|
787
|
-
/**
|
|
788
|
-
* Field instruction text (`w:instrText`), same text-carrier shape as `w:t`.
|
|
789
|
-
*
|
|
790
|
-
* Instruction strings are never executed; layout may recognize allowlisted page-number
|
|
791
|
-
* keywords only.
|
|
792
|
-
*/
|
|
793
|
-
interface OoxmlInstrTextNode extends OoxmlElementBase<readonly OoxmlTextNode[], readonly OoxmlKnownNodeAttribute[]> {
|
|
794
|
-
readonly kind: 'instrText';
|
|
795
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
796
|
-
readonly localName: 'instrText';
|
|
797
|
-
}
|
|
798
|
-
/**
|
|
799
|
-
* Simple field (`w:fldSimple`) at paragraph content level.
|
|
800
|
-
*
|
|
801
|
-
* `@w:instr`, `@w:dirty`, and `@w:fldLock` round-trip on `attributes`. Cached result
|
|
802
|
-
* children stay structurally preserved; the field is one atomic addressable unit.
|
|
803
|
-
*/
|
|
804
|
-
interface OoxmlFldSimpleNode extends OoxmlElementBase<readonly (OoxmlRunNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
805
|
-
readonly kind: 'fldSimple';
|
|
806
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
807
|
-
readonly localName: 'fldSimple';
|
|
808
|
-
}
|
|
809
|
-
/**
|
|
810
|
-
* Footnotes part root (`w:footnotes`). Children are typed notes or preserved generics.
|
|
811
|
-
* Never a story root itself — each note body is its own story for layout.
|
|
812
|
-
*/
|
|
813
|
-
interface OoxmlFootnotesNode extends OoxmlElementBase<readonly (OoxmlNoteNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
814
|
-
readonly kind: 'footnotes';
|
|
815
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
816
|
-
readonly localName: 'footnotes';
|
|
817
|
-
}
|
|
818
|
-
/**
|
|
819
|
-
* Endnotes part root (`w:endnotes`). Same content model as {@link OoxmlFootnotesNode}.
|
|
820
|
-
*/
|
|
821
|
-
interface OoxmlEndnotesNode extends OoxmlElementBase<readonly (OoxmlNoteNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
822
|
-
readonly kind: 'endnotes';
|
|
823
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
824
|
-
readonly localName: 'endnotes';
|
|
825
|
-
}
|
|
826
|
-
/**
|
|
827
|
-
* One footnote or endnote (`w:footnote` / `w:endnote`).
|
|
828
|
-
*
|
|
829
|
-
* Discriminated by `localName`. `@w:id` and optional `@w:type` (`ST_FtnEdn`, including
|
|
830
|
-
* authored `normal`) live on `attributes`. Children are ordinary block content.
|
|
831
|
-
*/
|
|
832
|
-
interface OoxmlNoteNode extends OoxmlElementBase<readonly (OoxmlParagraphNode | OoxmlTableNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
833
|
-
readonly kind: 'note';
|
|
834
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
835
|
-
readonly localName: 'footnote' | 'endnote';
|
|
836
|
-
}
|
|
837
|
-
/**
|
|
838
|
-
* Body citation (`w:footnoteReference` / `w:endnoteReference`) as a typed run child.
|
|
839
|
-
* Display mark is derived — never stored as text. One UTF-16 atom in addressing.
|
|
840
|
-
*/
|
|
841
|
-
interface OoxmlNoteReferenceNode extends OoxmlElementBase<readonly [], readonly OoxmlKnownNodeAttribute[]> {
|
|
842
|
-
readonly kind: 'noteReference';
|
|
843
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
844
|
-
readonly localName: 'footnoteReference' | 'endnoteReference';
|
|
845
|
-
}
|
|
846
|
-
/**
|
|
847
|
-
* Auto mark inside a note body (`w:footnoteRef` / `w:endnoteRef`).
|
|
848
|
-
* One UTF-16 atom; display digit is derived at paint time.
|
|
849
|
-
*/
|
|
850
|
-
interface OoxmlNoteRefNode extends OoxmlElementBase<readonly [], readonly OoxmlKnownNodeAttribute[]> {
|
|
851
|
-
readonly kind: 'noteRef';
|
|
852
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
853
|
-
readonly localName: 'footnoteRef' | 'endnoteRef';
|
|
854
|
-
}
|
|
855
|
-
/** Run-inner separator rule (`w:separator`). One UTF-16 atom. */
|
|
856
|
-
interface OoxmlSeparatorNode extends OoxmlElementBase<readonly [], readonly OoxmlKnownNodeAttribute[]> {
|
|
857
|
-
readonly kind: 'separator';
|
|
858
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
859
|
-
readonly localName: 'separator';
|
|
860
|
-
}
|
|
861
|
-
/** Run-inner continuation separator (`w:continuationSeparator`). One UTF-16 atom. */
|
|
862
|
-
interface OoxmlContinuationSeparatorNode extends OoxmlElementBase<readonly [], readonly OoxmlKnownNodeAttribute[]> {
|
|
863
|
-
readonly kind: 'continuationSeparator';
|
|
864
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
865
|
-
readonly localName: 'continuationSeparator';
|
|
866
|
-
}
|
|
867
|
-
/**
|
|
868
|
-
* `w:sdt` — structured document tag (content control) at block, inline, row, or cell level.
|
|
869
|
-
*
|
|
870
|
-
* Placement is not a separate kind: the same element name appears in every `EG_*Content`
|
|
871
|
-
* group. Child shape is the union of those placements; parents admit the control wherever
|
|
872
|
-
* `generic` was previously accepted (see `isPreservedChild`). Identity is the node id —
|
|
873
|
-
* `w:id` inside `w:sdtPr` is optional, preserved when present, never fabricated here.
|
|
874
|
-
*/
|
|
875
|
-
interface OoxmlContentControlNode extends OoxmlElementBase<readonly (OoxmlContentControlPropertiesNode | OoxmlContentControlEndPropertiesNode | OoxmlContentControlContentNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
876
|
-
readonly kind: 'contentControl';
|
|
877
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
878
|
-
readonly localName: 'sdt';
|
|
879
|
-
}
|
|
880
|
-
/**
|
|
881
|
-
* `w:sdtPr` (`CT_SdtPr`) — schema-ordered properties. Unmodelled children (alias/tag/id/lock
|
|
882
|
-
* leaves with `w:val`, `w15:*`, empty type markers) stay `generic` in position. Typed
|
|
883
|
-
* payloads: dropdown/combo/listItem, date (+ leaves), text, dataBinding, `w14:checkbox`.
|
|
884
|
-
*/
|
|
885
|
-
interface OoxmlContentControlPropertiesNode extends OoxmlElementBase<readonly (OoxmlRunPropertiesNode | OoxmlContentControlDataBindingNode | OoxmlContentControlDropDownListNode | OoxmlContentControlComboBoxNode | OoxmlContentControlDateNode | OoxmlContentControlTextNode | OoxmlContentControlCheckboxNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
886
|
-
readonly kind: 'contentControlProperties';
|
|
887
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
888
|
-
readonly localName: 'sdtPr';
|
|
889
|
-
}
|
|
890
|
-
/** `w:sdtEndPr` — end-character properties; children are `w:rPr` or generic. */
|
|
891
|
-
interface OoxmlContentControlEndPropertiesNode extends OoxmlElementBase<readonly (OoxmlRunPropertiesNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
892
|
-
readonly kind: 'contentControlEndProperties';
|
|
893
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
894
|
-
readonly localName: 'sdtEndPr';
|
|
895
|
-
}
|
|
896
|
-
/**
|
|
897
|
-
* `w:sdtContent` — control contents for every placement. Block content is paragraphs/tables;
|
|
898
|
-
* inline content is runs/hyperlinks; row/cell content is rows/cells. Nested controls stay typed.
|
|
899
|
-
*/
|
|
900
|
-
interface OoxmlContentControlContentNode extends OoxmlElementBase<readonly OoxmlNode[], readonly OoxmlKnownNodeAttribute[]> {
|
|
901
|
-
readonly kind: 'contentControlContent';
|
|
902
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
903
|
-
readonly localName: 'sdtContent';
|
|
904
|
-
}
|
|
905
|
-
/** `w:dropDownList` — `@w:lastValue` plus typed `w:listItem` children. */
|
|
906
|
-
interface OoxmlContentControlDropDownListNode extends OoxmlElementBase<readonly (OoxmlContentControlListItemNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
907
|
-
readonly kind: 'contentControlDropDownList';
|
|
908
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
909
|
-
readonly localName: 'dropDownList';
|
|
910
|
-
}
|
|
911
|
-
/** `w:comboBox` — same payload shape as dropdown; free entry is an editing concern. */
|
|
912
|
-
interface OoxmlContentControlComboBoxNode extends OoxmlElementBase<readonly (OoxmlContentControlListItemNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
913
|
-
readonly kind: 'contentControlComboBox';
|
|
914
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
915
|
-
readonly localName: 'comboBox';
|
|
916
|
-
}
|
|
917
|
-
/** `w:listItem` — `@w:displayText` / `@w:value` as preserved attributes (not `w:val`). */
|
|
918
|
-
interface OoxmlContentControlListItemNode extends OoxmlElementBase<readonly [], readonly OoxmlKnownNodeAttribute[]> {
|
|
919
|
-
readonly kind: 'contentControlListItem';
|
|
920
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
921
|
-
readonly localName: 'listItem';
|
|
922
|
-
}
|
|
923
|
-
/**
|
|
924
|
-
* `w:date` — `@w:fullDate` plus typed dateFormat/lid/storeMappedDataAs/calendar leaves.
|
|
925
|
-
* Those leaves allow `w:val` (the only known kinds that do) so they are not demoted.
|
|
926
|
-
*/
|
|
927
|
-
interface OoxmlContentControlDateNode extends OoxmlElementBase<readonly (OoxmlContentControlDateFormatNode | OoxmlContentControlLidNode | OoxmlContentControlStoreMappedDataAsNode | OoxmlContentControlCalendarNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
928
|
-
readonly kind: 'contentControlDate';
|
|
929
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
930
|
-
readonly localName: 'date';
|
|
931
|
-
}
|
|
932
|
-
/** `w:dateFormat` — the picture string a date picker formats its value with. */
|
|
933
|
-
interface OoxmlContentControlDateFormatNode extends OoxmlElementBase<readonly [], readonly (OoxmlKnownNodeAttribute | OoxmlWmlValAttribute)[]> {
|
|
934
|
-
readonly kind: 'contentControlDateFormat';
|
|
935
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
936
|
-
readonly localName: 'dateFormat';
|
|
937
|
-
}
|
|
938
|
-
/** `w:lid` — the language id a date picker parses and formats under. */
|
|
939
|
-
interface OoxmlContentControlLidNode extends OoxmlElementBase<readonly [], readonly (OoxmlKnownNodeAttribute | OoxmlWmlValAttribute)[]> {
|
|
940
|
-
readonly kind: 'contentControlLid';
|
|
941
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
942
|
-
readonly localName: 'lid';
|
|
943
|
-
}
|
|
944
|
-
/** `w:storeMappedDataAs` — which representation a bound date is written to its XML part as. */
|
|
945
|
-
interface OoxmlContentControlStoreMappedDataAsNode extends OoxmlElementBase<readonly [], readonly (OoxmlKnownNodeAttribute | OoxmlWmlValAttribute)[]> {
|
|
946
|
-
readonly kind: 'contentControlStoreMappedDataAs';
|
|
947
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
948
|
-
readonly localName: 'storeMappedDataAs';
|
|
949
|
-
}
|
|
950
|
-
/** `w:calendar` — which calendar system a date picker uses (Gregorian, Hijri, …). */
|
|
951
|
-
interface OoxmlContentControlCalendarNode extends OoxmlElementBase<readonly [], readonly (OoxmlKnownNodeAttribute | OoxmlWmlValAttribute)[]> {
|
|
952
|
-
readonly kind: 'contentControlCalendar';
|
|
953
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
954
|
-
readonly localName: 'calendar';
|
|
955
|
-
}
|
|
956
|
-
/** `w:text` (`CT_SdtText`) — distinct from `w:t` (`kind: 'text'`). `@w:multiLine` preserved. */
|
|
957
|
-
interface OoxmlContentControlTextNode extends OoxmlElementBase<readonly [], readonly OoxmlKnownNodeAttribute[]> {
|
|
958
|
-
readonly kind: 'contentControlText';
|
|
959
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
960
|
-
readonly localName: 'text';
|
|
961
|
-
}
|
|
962
|
-
/**
|
|
963
|
-
* `w:dataBinding` — xpath / storeItemID / prefixMappings preserved as attributes.
|
|
964
|
-
* This tree never resolves or fetches the binding target.
|
|
965
|
-
*/
|
|
966
|
-
interface OoxmlContentControlDataBindingNode extends OoxmlElementBase<readonly [], readonly OoxmlKnownNodeAttribute[]> {
|
|
967
|
-
readonly kind: 'contentControlDataBinding';
|
|
968
|
-
readonly namespaceUri: typeof WML_NAMESPACE_URI;
|
|
969
|
-
readonly localName: 'dataBinding';
|
|
970
|
-
}
|
|
971
|
-
/**
|
|
972
|
-
* `w14:checkbox` — Microsoft extension, not an ECMA-376 type choice. Distinguishable from
|
|
973
|
-
* untyped rich-text controls that merely wrap a `w:sym`.
|
|
974
|
-
*/
|
|
975
|
-
interface OoxmlContentControlCheckboxNode extends OoxmlElementBase<readonly (OoxmlContentControlCheckedNode | OoxmlContentControlCheckedStateNode | OoxmlContentControlUncheckedStateNode | OoxmlGenericElementNode)[], readonly OoxmlKnownNodeAttribute[]> {
|
|
976
|
-
readonly kind: 'contentControlCheckbox';
|
|
977
|
-
readonly namespaceUri: typeof W14_NAMESPACE_URI;
|
|
978
|
-
readonly localName: 'checkbox';
|
|
979
|
-
}
|
|
980
|
-
/** `w14:checked` — a checkbox's recorded state, independent of the glyph drawn for it. */
|
|
981
|
-
interface OoxmlContentControlCheckedNode extends OoxmlElementBase<readonly [], readonly OoxmlKnownNodeAttribute[]> {
|
|
982
|
-
readonly kind: 'contentControlChecked';
|
|
983
|
-
readonly namespaceUri: typeof W14_NAMESPACE_URI;
|
|
984
|
-
readonly localName: 'checked';
|
|
985
|
-
}
|
|
986
|
-
/** `w14:checkedState` — the font and code point drawn when a checkbox is checked. */
|
|
987
|
-
interface OoxmlContentControlCheckedStateNode extends OoxmlElementBase<readonly [], readonly OoxmlKnownNodeAttribute[]> {
|
|
988
|
-
readonly kind: 'contentControlCheckedState';
|
|
989
|
-
readonly namespaceUri: typeof W14_NAMESPACE_URI;
|
|
990
|
-
readonly localName: 'checkedState';
|
|
991
|
-
}
|
|
992
|
-
/** `w14:uncheckedState` — the font and code point drawn when a checkbox is not checked. */
|
|
993
|
-
interface OoxmlContentControlUncheckedStateNode extends OoxmlElementBase<readonly [], readonly OoxmlKnownNodeAttribute[]> {
|
|
994
|
-
readonly kind: 'contentControlUncheckedState';
|
|
995
|
-
readonly namespaceUri: typeof W14_NAMESPACE_URI;
|
|
996
|
-
readonly localName: 'uncheckedState';
|
|
997
|
-
}
|
|
998
|
-
/**
|
|
999
|
-
* Any element the typed vocabulary does not cover — the other half of the preservation model.
|
|
1000
|
-
*
|
|
1001
|
-
* Also where a KNOWN element lands when it appears somewhere invalid: an element is demoted to
|
|
1002
|
-
* generic rather than rejected, so malformed or unfamiliar content is carried losslessly and
|
|
1003
|
-
* never locks editing.
|
|
1004
|
-
*/
|
|
1005
|
-
interface OoxmlGenericElementNode extends OoxmlElementBase<readonly OoxmlNode[]> {
|
|
1006
|
-
readonly kind: 'generic';
|
|
1007
|
-
}
|
|
1008
|
-
/** A literal text value. The only node kind with no children and no attributes. */
|
|
1009
|
-
interface OoxmlTextNode {
|
|
1010
|
-
readonly id: OoxmlNodeId;
|
|
1011
|
-
readonly kind: 'textValue';
|
|
1012
|
-
readonly value: string;
|
|
1013
|
-
}
|
|
1014
|
-
/** Every element node kind: the typed vocabulary plus the generic catch-all. */
|
|
1015
|
-
type OoxmlElement = OoxmlDocumentNode | OoxmlBodyNode | OoxmlParagraphNode | OoxmlRunNode | OoxmlHyperlinkNode | OoxmlBookmarkStartNode | OoxmlBookmarkEndNode | OoxmlRunPropertiesNode | OoxmlTextElementNode | OoxmlDeletedTextNode | OoxmlParagraphPropertiesNode | OoxmlTabNode | OoxmlHardBreakNode | OoxmlFldCharNode | OoxmlInstrTextNode | OoxmlFldSimpleNode | OoxmlFootnotesNode | OoxmlEndnotesNode | OoxmlNoteNode | OoxmlNoteReferenceNode | OoxmlNoteRefNode | OoxmlSeparatorNode | OoxmlContinuationSeparatorNode | OoxmlTableNode | OoxmlTableRowNode | OoxmlTableCellNode | OoxmlTableGridNode | OoxmlTablePropertiesNode | OoxmlRevisionContentNode | OoxmlRangeMarkerNode | OoxmlCommentReferenceNode | OoxmlCommentsNode | OoxmlCommentNode | OoxmlContentControlNode | OoxmlContentControlPropertiesNode | OoxmlContentControlEndPropertiesNode | OoxmlContentControlContentNode | OoxmlContentControlDropDownListNode | OoxmlContentControlComboBoxNode | OoxmlContentControlListItemNode | OoxmlContentControlDateNode | OoxmlContentControlDateFormatNode | OoxmlContentControlLidNode | OoxmlContentControlStoreMappedDataAsNode | OoxmlContentControlCalendarNode | OoxmlContentControlTextNode | OoxmlContentControlDataBindingNode | OoxmlContentControlCheckboxNode | OoxmlContentControlCheckedNode | OoxmlContentControlCheckedStateNode | OoxmlContentControlUncheckedStateNode | OoxmlDrawingNode | OoxmlInlineDrawingNode | OoxmlAnchoredDrawingNode | OoxmlDrawingExtentNode | OoxmlDrawingEffectExtentNode | OoxmlDrawingDocPrNode | OoxmlDrawingGraphicFramePrNode | OoxmlDrawingGraphicNode | OoxmlDrawingGraphicDataNode | OoxmlDrawingSimplePosNode | OoxmlDrawingPositionHNode | OoxmlDrawingPositionVNode | OoxmlDrawingPositionAlignNode | OoxmlDrawingPositionOffsetNode | OoxmlDrawingWrapNoneNode | OoxmlDrawingWrapSquareNode | OoxmlDrawingWrapTightNode | OoxmlDrawingWrapThroughNode | OoxmlDrawingWrapTopBottomNode | OoxmlDrawingWrapPolygonNode | OoxmlDrawingWrapPolygonStartNode | OoxmlDrawingWrapPolygonLineToNode | OoxmlPictureNode | OoxmlPictureNvPicPrNode | OoxmlPictureBlipFillNode | OoxmlPictureBlipNode | OoxmlPictureSrcRectNode | OoxmlPictureStretchNode | OoxmlPictureTileNode | OoxmlPictureShapePropertiesNode | OoxmlPictureTransformNode | OoxmlPictureTransformOffsetNode | OoxmlPictureTransformExtentNode | OoxmlPicturePresetGeometryNode | OoxmlGenericElementNode;
|
|
1016
|
-
/**
|
|
1017
|
-
* Any node in the canonical tree.
|
|
1018
|
-
*
|
|
1019
|
-
* Typed where layout needs structure, generic everywhere else — one tree carries a whole document
|
|
1020
|
-
* whether or not the engine understands every part of it.
|
|
1021
|
-
*/
|
|
1022
|
-
type OoxmlNode = OoxmlElement | OoxmlTextNode;
|
|
1023
|
-
/** One XML part of the package, parsed into a canonical tree. */
|
|
1024
|
-
interface OoxmlPart {
|
|
1025
|
-
readonly id: string;
|
|
1026
|
-
/** Canonical part name, e.g. `/word/document.xml`. */
|
|
1027
|
-
readonly name: string;
|
|
1028
|
-
readonly contentType: string;
|
|
1029
|
-
readonly root: OoxmlElement;
|
|
1030
|
-
}
|
|
1031
|
-
/** A part's identity without its tree — enough to enumerate a package cheaply. */
|
|
1032
|
-
interface OoxmlPartMetadata {
|
|
1033
|
-
readonly name: string;
|
|
1034
|
-
readonly contentType: string;
|
|
1035
|
-
}
|
|
1036
|
-
/**
|
|
1037
|
-
* Why a part could not be read into a tree.
|
|
1038
|
-
*
|
|
1039
|
-
* Widens the XML-level rejections with the tree-level ones. All of them describe the FILE, which
|
|
1040
|
-
* is why reading returns a result rather than throwing.
|
|
1041
|
-
*/
|
|
1042
|
-
type OoxmlReadRejection = XmlRejection | 'missing-root' | 'multiple-roots' | 'invalid-name' | 'invalid-namespace' | 'undeclared-prefix' | 'duplicate-expanded-attribute';
|
|
1043
|
-
/** A parsed part, or a typed refusal. Never throws — the input is untrusted by definition. */
|
|
1044
|
-
type OoxmlReadResult = {
|
|
1045
|
-
readonly ok: true;
|
|
1046
|
-
readonly part: OoxmlPart;
|
|
1047
|
-
} | {
|
|
1048
|
-
readonly ok: false;
|
|
1049
|
-
readonly reason: OoxmlReadRejection;
|
|
1050
|
-
};
|
|
1051
|
-
/**
|
|
1052
|
-
* The node-identity contract, written down as a type so it is checkable rather than merely
|
|
1053
|
-
* documented.
|
|
1054
|
-
*
|
|
1055
|
-
* Ids are deterministic from a normalized parse, retained through structural sharing, explicit on
|
|
1056
|
-
* replacement, and unique within a part. Everything that addresses nodes — ops, the caret, the
|
|
1057
|
-
* paraId bimap — depends on all four holding.
|
|
1058
|
-
*/
|
|
1059
|
-
interface OoxmlNodeIdentityRules {
|
|
1060
|
-
readonly initial: 'deterministic-structural-path-after-normalized-parse';
|
|
1061
|
-
readonly unchanged: 'retain-id-through-structural-sharing';
|
|
1062
|
-
readonly replacement: 'explicitly-retain-or-allocate';
|
|
1063
|
-
readonly uniqueness: 'unique-within-part';
|
|
1064
|
-
}
|
|
1065
|
-
/**
|
|
1066
|
-
* Identity policy for future immutable tree edits. This defines the boundary
|
|
1067
|
-
* without implementing task 2.4 edit primitives.
|
|
1068
|
-
*/
|
|
1069
|
-
declare const OOXML_NODE_IDENTITY_RULES: OoxmlNodeIdentityRules;
|
|
1070
|
-
/** What a tree invariant walk found wrong. Each names a rule the canonical tree must satisfy. */
|
|
1071
|
-
type OoxmlInvariantIssueCode = 'invalid-id' | 'duplicate-id' | 'invalid-name' | 'invalid-namespace' | 'invalid-qname' | 'duplicate-expanded-attribute' | 'invalid-xml-value' | 'known-node-invariant';
|
|
1072
|
-
/** One invariant violation, located by structural path and node id. */
|
|
1073
|
-
interface OoxmlInvariantIssue {
|
|
1074
|
-
readonly code: OoxmlInvariantIssueCode;
|
|
1075
|
-
readonly path: string;
|
|
1076
|
-
readonly nodeId?: string;
|
|
1077
|
-
}
|
|
1078
|
-
/** Whether a tree satisfies its invariants, listing every violation when it does not. */
|
|
1079
|
-
type OoxmlInvariantResult = {
|
|
1080
|
-
readonly ok: true;
|
|
1081
|
-
} | {
|
|
1082
|
-
readonly ok: false;
|
|
1083
|
-
readonly issues: readonly OoxmlInvariantIssue[];
|
|
1084
|
-
};
|
|
1085
|
-
/**
|
|
1086
|
-
* Read one XML part into the additive typed/generic foundation. Existing package
|
|
1087
|
-
* parsing and DocumentStore models intentionally remain unchanged until their
|
|
1088
|
-
* later migration tasks; this tree is not yet the repository's sole runtime authority.
|
|
1089
|
-
* Structural-path IDs are deterministic across normalized reopen. Preserving an
|
|
1090
|
-
* identity through moves and edits is deferred to PackageModel/DocumentStore integration.
|
|
1091
|
-
*/
|
|
1092
|
-
declare function readOoxmlPart(xml: string, metadata: OoxmlPartMetadata, limits?: XmlLimits): OoxmlReadResult;
|
|
1093
|
-
|
|
1094
|
-
/**
|
|
1095
|
-
* Why a zip was refused at the trust boundary.
|
|
1096
|
-
*
|
|
1097
|
-
* `too-large` and `too-many-entries` are the zip-bomb guards; `bad-name` catches path traversal —
|
|
1098
|
-
* an entry with `..` or a leading `/` is rejected rather than normalized.
|
|
1099
|
-
*/
|
|
1100
|
-
type ZipRejection = 'too-many-entries' | 'too-large' | 'bad-name' | 'inflate-error';
|
|
1101
|
-
/** Archive caps: entry count, total decompressed bytes, and the decompression ratio. */
|
|
1102
|
-
interface ZipLimits {
|
|
1103
|
-
readonly maxEntries: number;
|
|
1104
|
-
/** Max total UNCOMPRESSED bytes across the archive. */
|
|
1105
|
-
readonly maxTotalBytes: number;
|
|
1106
|
-
/** Max per-entry uncompressed:compressed ratio (zip-bomb guard). */
|
|
1107
|
-
readonly maxRatio?: number;
|
|
1108
|
-
}
|
|
1109
|
-
/** The archive caps in force when a host configures none. Conservative and finite. */
|
|
1110
|
-
declare const DEFAULT_ZIP_LIMITS: ZipLimits;
|
|
1111
|
-
/** The read entries, or the typed refusal. Never throws — the bytes are untrusted. */
|
|
1112
|
-
type ZipReadResult = {
|
|
1113
|
-
readonly ok: true;
|
|
1114
|
-
readonly entries: ReadonlyMap<string, Uint8Array>;
|
|
1115
|
-
} | {
|
|
1116
|
-
readonly ok: false;
|
|
1117
|
-
readonly reason: ZipRejection;
|
|
1118
|
-
readonly detail?: string;
|
|
1119
|
-
};
|
|
1120
|
-
/**
|
|
1121
|
-
* Inflate a ZIP archive with bounds + OPC name normalization. Entry name, count,
|
|
1122
|
-
* compression-ratio, and total-uncompressed-size limits are enforced BEFORE each
|
|
1123
|
-
* entry is decompressed (via fflate's pre-inflation filter), so a zip bomb or a
|
|
1124
|
-
* traversal name is rejected without ever being inflated. Keys are canonical part
|
|
1125
|
-
* names.
|
|
1126
|
-
*/
|
|
1127
|
-
declare function readZip(bytes: Uint8Array, limits?: ZipLimits): ZipReadResult;
|
|
1128
|
-
/** Deflate a set of canonical-part-name -> bytes into a ZIP archive. Every part name
|
|
1129
|
-
* is re-validated through the OPC normalization profile before writing, so a
|
|
1130
|
-
* traversal/encoded/normalized-alias name from an untrusted serialized model can
|
|
1131
|
-
* never be smuggled into a ZIP entry (write-side path-traversal guard). */
|
|
1132
|
-
declare function writeZip(entries: ReadonlyMap<string, Uint8Array>): Uint8Array;
|
|
1133
|
-
|
|
1134
|
-
/** Caps applied while loading a package: zip, XML, part count and relationship count. */
|
|
1135
|
-
interface OoxmlPackageLimits {
|
|
1136
|
-
readonly zip?: ZipLimits;
|
|
1137
|
-
readonly xml?: XmlLimits;
|
|
1138
|
-
/** Cap on parts converted into canonical trees (N/N+1 gate, not a soft target). */
|
|
1139
|
-
readonly maxXmlParts?: number;
|
|
1140
|
-
/** Cap on relationship records across every rels part. */
|
|
1141
|
-
readonly maxRelationships?: number;
|
|
1142
|
-
}
|
|
1143
|
-
/** The limits in force when a host configures none. Conservative and finite. */
|
|
1144
|
-
declare const DEFAULT_OOXML_PACKAGE_LIMITS: Required<Pick<OoxmlPackageLimits, 'maxXmlParts' | 'maxRelationships'>>;
|
|
1145
|
-
/**
|
|
1146
|
-
* An external relationship target. Retained verbatim as authored evidence, with the
|
|
1147
|
-
* sink-safety verdict alongside it. Never resolved against the package, never fetched.
|
|
1148
|
-
*/
|
|
1149
|
-
interface OoxmlExternalTarget {
|
|
1150
|
-
readonly ownerPart: string;
|
|
1151
|
-
readonly id: string;
|
|
1152
|
-
readonly type: string;
|
|
1153
|
-
readonly rawTarget: string;
|
|
1154
|
-
/** False when the target is not a safe sink (javascript:, file:, ...). Still not fetched. */
|
|
1155
|
-
readonly sinkSafe: boolean;
|
|
1156
|
-
}
|
|
1157
|
-
/**
|
|
1158
|
-
* A loaded package: every XML part as a canonical tree, plus the non-XML parts kept verbatim.
|
|
1159
|
-
*
|
|
1160
|
-
* The preservation model in one value. Modelled parts re-emit normalized; everything else is
|
|
1161
|
-
* byte-identical, which is why an unrecognized part never costs a document anything.
|
|
1162
|
-
*/
|
|
1163
|
-
interface OoxmlPackage {
|
|
1164
|
-
/** Canonical trees, keyed by canonical part name. Non-XML parts are absent by design. */
|
|
1165
|
-
readonly parts: ReadonlyMap<string, OoxmlPart>;
|
|
1166
|
-
/** Raw bytes of every entry, including the non-XML parts that have no tree. */
|
|
1167
|
-
readonly partBytes: ReadonlyMap<string, Uint8Array>;
|
|
1168
|
-
/** Internal relationships by owner part, in authored order. */
|
|
1169
|
-
readonly relationships: ReadonlyMap<string, readonly RelationshipRecord[]>;
|
|
1170
|
-
readonly externalTargets: readonly OoxmlExternalTarget[];
|
|
1171
|
-
readonly contentTypes: ContentTypeIndex;
|
|
1172
|
-
/** Canonical name of the part the root `officeDocument` relationship points at. */
|
|
1173
|
-
readonly mainDocumentPart: string;
|
|
1174
|
-
}
|
|
1175
|
-
/** Why a package could not be loaded. Every code describes the FILE, not the caller. */
|
|
1176
|
-
type OoxmlPackageRejection = ZipRejection | OoxmlReadRejection | 'no-content-types' | 'bad-content-types' | 'no-main-document' | 'bad-relationship-target' | 'duplicate-relationship-id' | 'too-many-relationships' | 'too-many-xml-parts';
|
|
1177
|
-
/** A loaded package, or a typed refusal. Never throws. */
|
|
1178
|
-
type OoxmlPackageResult = {
|
|
1179
|
-
readonly ok: true;
|
|
1180
|
-
readonly package: OoxmlPackage;
|
|
1181
|
-
} | {
|
|
1182
|
-
readonly ok: false;
|
|
1183
|
-
readonly reason: OoxmlPackageRejection;
|
|
1184
|
-
readonly detail?: string;
|
|
1185
|
-
};
|
|
1186
|
-
/**
|
|
1187
|
-
* Load an OPC package into canonical typed/generic OOXML trees.
|
|
1188
|
-
*
|
|
1189
|
-
* Fails closed on every limit, malformed name, unresolvable internal target, duplicate
|
|
1190
|
-
* relationship id, and XML rejection. An external relationship never causes a failure and
|
|
1191
|
-
* never causes a fetch: it is recorded with its sink-safety verdict for a later, explicitly
|
|
1192
|
-
* user-gated lane.
|
|
1193
|
-
*/
|
|
1194
|
-
/**
|
|
1195
|
-
* Load DOCX bytes into canonical trees, bounded at every step.
|
|
1196
|
-
*
|
|
1197
|
-
* THE trust boundary for a document. Composes the hardened primitives — zip limits and OPC name
|
|
1198
|
-
* normalization, content-type indexing, relationship validation, entity-free XML — into one
|
|
1199
|
-
* loader, and returns a typed rejection rather than throwing from inside a decoder.
|
|
1200
|
-
*/
|
|
1201
|
-
declare function readOoxmlPackage(bytes: Uint8Array, limits?: OoxmlPackageLimits): OoxmlPackageResult;
|
|
1202
|
-
/**
|
|
1203
|
-
* Serialize a canonical package back to DOCX bytes.
|
|
1204
|
-
*
|
|
1205
|
-
* Starts from the ORIGINAL entry bytes and overwrites only the parts held as trees. A part
|
|
1206
|
-
* the loader did not model — media, fonts, an XML part outside the modeled set — passes
|
|
1207
|
-
* through untouched, so round-tripping a document cannot lose a part the engine never
|
|
1208
|
-
* claimed to understand.
|
|
1209
|
-
*
|
|
1210
|
-
* The modeled parts are re-emitted NORMALIZED from the tree rather than patched as text.
|
|
1211
|
-
* That is the whole point of the canonical tree: correctness is judged by the two D9
|
|
1212
|
-
* oracles (the namespace-aware fingerprint and the save/reopen semantic digest), not by
|
|
1213
|
-
* byte equality, so a different-but-equivalent spelling is not a defect.
|
|
1214
|
-
*
|
|
1215
|
-
* `writeZip` re-validates every part name, so a name that became unsafe between load and
|
|
1216
|
-
* save cannot be smuggled into the archive.
|
|
1217
|
-
*/
|
|
1218
|
-
declare function writeOoxmlPackage(pkg: OoxmlPackage): Uint8Array;
|
|
1219
|
-
/** Replace one part's tree, returning a new package. Pure, like the tree edits themselves. */
|
|
1220
|
-
declare function withPart(pkg: OoxmlPackage, part: OoxmlPart): OoxmlPackage;
|
|
1221
|
-
|
|
1222
|
-
export { type OoxmlContentControlLidNode as $, type OoxmlAttribute as A, type ContentTypeIndex as B, type ContentTypeError as C, type ContentTypeRecords as D, DEFAULT_OOXML_PACKAGE_LIMITS as E, DEFAULT_ZIP_LIMITS as F, type DefaultRecord as G, type ImageRelationshipResolution as H, IMAGE_RELATIONSHIP_TYPE as I, type IndexResult as J, type NameResult as K, OOXML_NODE_IDENTITY_RULES as L, type OoxmlBodyNode as M, type NameRejection as N, type OoxmlPart as O, type OoxmlBookmarkEndNode as P, type OoxmlBookmarkStartNode as Q, type RelationshipRecord as R, type OoxmlContentControlCalendarNode as S, type OoxmlContentControlCheckboxNode as T, type OoxmlContentControlCheckedNode as U, type OoxmlContentControlCheckedStateNode as V, type OoxmlContentControlComboBoxNode as W, type OoxmlContentControlDataBindingNode as X, type OoxmlContentControlDateFormatNode as Y, type OoxmlContentControlDateNode as Z, type OoxmlContentControlDropDownListNode as _, type OoxmlNode as a, withPart as a$, type OoxmlContentControlListItemNode as a0, type OoxmlContentControlStoreMappedDataAsNode as a1, type OoxmlContentControlTextNode as a2, type OoxmlContentControlUncheckedStateNode as a3, type OoxmlDocumentNode as a4, type OoxmlExternalTarget as a5, type OoxmlGenericExtensionAttribute as a6, type OoxmlHyperlinkNode as a7, type OoxmlInvariantIssueCode as a8, type OoxmlKnownNodeAttribute as a9, type XmlResult as aA, type ZipLimits as aB, type ZipReadResult as aC, type ZipRejection as aD, asciiFold as aE, buildContentTypeIndex as aF, buildRelationshipSet as aG, childElements as aH, detectDuplicateNames as aI, extensionKey as aJ, findElement as aK, isContentRevisionKind as aL, isRangeMarkerKind as aM, isValidMime as aN, normalizePartName as aO, partNameKey as aP, readOnOffChild as aQ, readOoxmlPackage as aR, readOoxmlPart as aS, readXml as aT, readZip as aU, resolveContentType as aV, resolveImageRelationship as aW, resolveInternalTarget as aX, resolveRelationship as aY, textContent as aZ, validateExternalTarget as a_, type OoxmlNamespaceBinding as aa, type OoxmlNodeIdentityRules as ab, type OoxmlPackageResult as ac, type OoxmlParagraphPropertiesNode as ad, type OoxmlPartMetadata as ae, type OoxmlReadRejection as af, type OoxmlReadResult as ag, type OoxmlRunNode as ah, type OoxmlRunPropertiesNode as ai, type OoxmlTabNode as aj, type OoxmlTextElementNode as ak, type OoxmlTextNode as al, type OoxmlWmlValAttribute as am, type OoxmlXmlSpaceAttribute as an, type OverrideRecord as ao, type RelationshipError as ap, type RelationshipSetResult as aq, type ResolveResult as ar, type ResolvedRelationship as as, type TargetMode as at, WML_NAMESPACE_URI as au, XMLNS_NAMESPACE_URI as av, XML_NAMESPACE_URI as aw, type XmlLimits as ax, type XmlNode as ay, type XmlRejection as az, type OoxmlElement as b, writeOoxmlPackage as b0, writeZip as b1, type OoxmlPackage as c, type OoxmlParagraphNode as d, type OoxmlNoteNode as e, type OoxmlContinuationSeparatorNode as f, type OoxmlEndnotesNode as g, type OoxmlFootnotesNode as h, type OoxmlNoteRefNode as i, type OoxmlNoteReferenceNode as j, type OoxmlSeparatorNode as k, type OoxmlNodeId as l, type OoxmlGenericElementNode as m, type OoxmlPackageLimits as n, type OoxmlPackageRejection as o, type OoxmlContentControlNode as p, type OoxmlContentControlContentNode as q, type OoxmlDrawingNode as r, type OoxmlContentControlEndPropertiesNode as s, type OoxmlContentControlPropertiesNode as t, type OoxmlInvariantResult as u, type OoxmlInvariantIssue as v, type OoxmlHardBreakNode as w, type OoxmlFldCharNode as x, type OoxmlFldSimpleNode as y, type OoxmlInstrTextNode as z };
|