@docx-editor.dev/core 2.7.0 → 2.9.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 +5 -6
- package/dist/automation.d.ts +5 -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-2RDMWJPF.cjs +2 -0
- package/dist/chunk-5VC5HGJA.js +2 -0
- package/dist/chunk-A2JIBG75.js +1 -0
- package/dist/chunk-DKMKH77K.cjs +5 -0
- package/dist/chunk-DTQPINIM.js +15 -0
- package/dist/chunk-HHFMXG25.js +2 -0
- package/dist/chunk-IEXDXWTA.cjs +1 -0
- package/dist/chunk-IMMAG4QP.cjs +10 -0
- package/dist/chunk-KBCC66CI.js +5 -0
- package/dist/chunk-P5YSGSYC.cjs +15 -0
- package/dist/chunk-Q66ZJFRE.js +18 -0
- package/dist/chunk-TP4EHWEX.cjs +18 -0
- package/dist/chunk-VUJGPCPU.js +10 -0
- package/dist/chunk-XMHWBL3K.cjs +2 -0
- package/dist/contracts/document.d.cts +25 -3
- package/dist/contracts/document.d.ts +25 -3
- package/dist/contracts/editor.d.cts +10 -10
- package/dist/contracts/editor.d.ts +10 -10
- package/dist/contracts/interaction.d.cts +9 -9
- package/dist/contracts/interaction.d.ts +9 -9
- package/dist/contracts/modules.d.cts +6 -5
- package/dist/contracts/modules.d.ts +6 -5
- package/dist/contracts/types.d.cts +101 -1
- package/dist/contracts/types.d.ts +101 -1
- package/dist/{custom-node-writes-BpOBjNzo.d.ts → custom-node-writes-7ERv0f_X.d.cts} +25 -11
- package/dist/{custom-node-writes-C_AlNvds.d.cts → custom-node-writes-QyVZdTUA.d.ts} +25 -11
- package/dist/{editor-CXaGlcUa.d.cts → editor-CojjwMmF.d.cts} +78 -67
- package/dist/{editor-C--WWCBA.d.ts → editor-PUlv5Pp7.d.ts} +78 -67
- package/dist/editor.cjs +1 -1
- package/dist/editor.css +124 -14
- package/dist/editor.d.cts +68 -36
- package/dist/editor.d.ts +68 -36
- package/dist/editor.js +1 -1
- package/dist/{hf-references-BdjsQNE_.d.ts → hf-references-Dvk6De4Q.d.cts} +1 -2
- package/dist/{hf-references-CgEOSw3i.d.cts → hf-references-z5Y4N1ab.d.ts} +1 -2
- package/dist/{image-resources-Bkmu1Jei.d.cts → image-resources-DQOiwOuE.d.cts} +2 -2
- package/dist/{image-resources-BWd5u-op.d.ts → image-resources-eZqD_-vC.d.ts} +2 -2
- package/dist/{index-QsE1xXyT.d.cts → index-DGPSeLI0.d.cts} +1632 -1435
- package/dist/{index-DW0TsrYl.d.ts → index-oN-v8DQ5.d.ts} +1632 -1435
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +19 -19
- package/dist/index.d.ts +19 -19
- package/dist/index.js +1 -1
- package/dist/layout.cjs +1 -1
- package/dist/layout.d.cts +545 -336
- package/dist/layout.d.ts +545 -336
- package/dist/layout.js +1 -1
- package/dist/{note-nodes-BPSTVDMr.d.ts → note-nodes-BNCANoGN.d.ts} +1 -1
- package/dist/{note-nodes-C6DLxlvj.d.cts → note-nodes-DL-Au22P.d.cts} +1 -1
- package/dist/note-properties-CQlxjic_.d.cts +67 -0
- package/dist/note-properties-jvnw_DGG.d.ts +67 -0
- package/dist/omml-equation-BD-LsmWE.d.cts +84 -0
- package/dist/omml-equation-Dd3mBep-.d.ts +84 -0
- package/dist/{ooxml-tree-BU0e3DVi.d.ts → ooxml-package-CdEy9ufK.d.cts} +352 -1
- package/dist/{ooxml-tree-BU0e3DVi.d.cts → ooxml-package-CdEy9ufK.d.ts} +352 -1
- package/dist/output.cjs +1 -1
- package/dist/output.d.cts +9 -8
- package/dist/output.d.ts +9 -8
- package/dist/output.js +1 -1
- package/dist/{protocol-CD7slqvl.d.cts → protocol-C7ahrdUx.d.ts} +28 -4
- package/dist/{protocol-DsbfgBwA.d.ts → protocol-UuZOcOp7.d.cts} +28 -4
- package/dist/{review-support-Cr2n7f1-.d.ts → review-items-D5SPFtsO.d.ts} +49 -102
- package/dist/{review-support-oQrX6Xu3.d.cts → review-items-DpsqTHio.d.cts} +49 -102
- package/dist/review-reads-B2Ji3fVU.d.ts +176 -0
- package/dist/review-reads-CP106AHp.d.cts +176 -0
- package/dist/{revision-projection-UKqvPa4-.d.ts → revision-projection-CILpvv4M.d.ts} +1 -1
- package/dist/{revision-projection-WzlQGBJx.d.cts → revision-projection-Cc4wz30g.d.cts} +1 -1
- package/dist/{semantic-cell-selection-C8RC0VnN.d.ts → semantic-cell-selection-BWhVAk5B.d.ts} +16 -4
- package/dist/{semantic-cell-selection-CQOgvtbT.d.cts → semantic-cell-selection-DJPjBWzf.d.cts} +16 -4
- package/dist/{semantic-interaction-f4GyBQ_1.d.cts → semantic-interaction-BjOcDB06.d.cts} +14 -2
- package/dist/{semantic-interaction-C45D_oG2.d.ts → semantic-interaction-Cca1-X_a.d.ts} +14 -2
- package/dist/{semantic-paint-DUkGLJ_L.d.ts → semantic-paint-CufpIQFw.d.ts} +7 -7
- package/dist/{semantic-paint-BUt0ePEW.d.cts → semantic-paint-Ur7pAINj.d.cts} +7 -7
- package/dist/{semantic-records-DoW_xNgJ.d.ts → semantic-records-C3Z76KeN.d.cts} +77 -31
- package/dist/{semantic-records-CuT3Wsd-.d.cts → semantic-records-Cc1MJrhM.d.ts} +77 -31
- package/dist/{shaped-measurer-CakZ7g1s.d.ts → shaped-measurer-CYSK20E2.d.cts} +2 -4
- package/dist/{shaped-measurer-CDcHzjhf.d.cts → shaped-measurer-CwlTPDJO.d.ts} +2 -4
- package/dist/store.cjs +1 -1
- package/dist/store.d.cts +90 -18
- package/dist/store.d.ts +90 -18
- package/dist/store.js +1 -1
- package/dist/{tree-op-types-fZgbrR5F.d.ts → tree-op-types-B0-sCtw-.d.cts} +79 -10
- package/dist/{tree-op-types-QujrzgCz.d.cts → tree-op-types-XMVsJSpe.d.ts} +79 -10
- package/dist/{tree-session-5UWKAQ41.d.cts → tree-session-D945D43B.d.cts} +45 -19
- package/dist/{tree-session--6LDTNjR.d.ts → tree-session-DBJgmdmc.d.ts} +45 -19
- package/dist/{tree-store-Dy9FZ1pa.d.ts → tree-store-C6vc8E_2.d.cts} +14 -3
- package/dist/{tree-store-DhYIACNE.d.cts → tree-store-ClA-qng4.d.ts} +14 -3
- package/package.json +2 -2
- package/dist/chunk-32HTRN7R.js +0 -10
- package/dist/chunk-42PRWWVE.js +0 -2
- package/dist/chunk-BRBRYJKE.cjs +0 -2
- package/dist/chunk-DTR64XCS.cjs +0 -2
- package/dist/chunk-EMQSFPJO.cjs +0 -15
- package/dist/chunk-GBK7Z6F4.cjs +0 -5
- package/dist/chunk-GPJXQDHC.js +0 -2
- package/dist/chunk-JLSB6KNZ.js +0 -5
- package/dist/chunk-LEV2X47E.cjs +0 -18
- package/dist/chunk-NDTLLSG7.js +0 -1
- package/dist/chunk-O4VILLOM.cjs +0 -1
- package/dist/chunk-OB6JFVYA.js +0 -15
- package/dist/chunk-QTUZFJ4O.js +0 -18
- package/dist/chunk-UE7KTQLK.js +0 -2
- package/dist/chunk-WC3LI6FC.cjs +0 -10
- package/dist/chunk-XRDTD4X3.cjs +0 -2
- package/dist/content-control-walk-CbTqHq6O.d.cts +0 -56
- package/dist/content-control-walk-D06GijR0.d.ts +0 -56
- package/dist/ooxml-package-CR5us6ad.d.cts +0 -354
- package/dist/ooxml-package-D_CtywTW.d.ts +0 -354
- package/dist/review-reads-C5E7u-pt.d.ts +0 -432
- package/dist/review-reads-ChgUq41I.d.cts +0 -432
|
@@ -1,3 +1,226 @@
|
|
|
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
|
+
|
|
1
224
|
/**
|
|
2
225
|
* One parsed XML node, preserving significant order, whitespace and raw lexical values.
|
|
3
226
|
*
|
|
@@ -868,4 +1091,132 @@ type OoxmlInvariantResult = {
|
|
|
868
1091
|
*/
|
|
869
1092
|
declare function readOoxmlPart(xml: string, metadata: OoxmlPartMetadata, limits?: XmlLimits): OoxmlReadResult;
|
|
870
1093
|
|
|
871
|
-
|
|
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 };
|
package/dist/output.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunk2RDMWJPF_cjs=require('./chunk-2RDMWJPF.cjs');require('./chunk-TP4EHWEX.cjs'),require('./chunk-XMHWBL3K.cjs'),require('./chunk-IMMAG4QP.cjs');Object.defineProperty(exports,"DEFAULT_FIELD_SHADING",{enumerable:true,get:function(){return chunk2RDMWJPF_cjs.h}});Object.defineProperty(exports,"paintSelectionOverlay",{enumerable:true,get:function(){return chunk2RDMWJPF_cjs.l}});Object.defineProperty(exports,"paintSemanticLayout",{enumerable:true,get:function(){return chunk2RDMWJPF_cjs.j}});
|
package/dist/output.d.cts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { R as ReviewAuthorInfo } from './semantic-paint-
|
|
2
|
-
export { D as DEFAULT_FIELD_SHADING, F as FieldShadingMode, P as PaintOptions, a as RevisionAuthorAssignments, b as RevisionAuthorStyle, c as RevisionStyles, p as paintSemanticLayout } from './semantic-paint-
|
|
3
|
-
import { S as SemanticLayout } from './semantic-records-
|
|
4
|
-
import './image-resources-
|
|
5
|
-
import './tree-op-types-
|
|
6
|
-
import './
|
|
7
|
-
import './ooxml-package-
|
|
8
|
-
import './revision-projection-
|
|
1
|
+
import { R as ReviewAuthorInfo } from './semantic-paint-Ur7pAINj.cjs';
|
|
2
|
+
export { D as DEFAULT_FIELD_SHADING, F as FieldShadingMode, P as PaintOptions, a as RevisionAuthorAssignments, b as RevisionAuthorStyle, c as RevisionStyles, p as paintSemanticLayout } from './semantic-paint-Ur7pAINj.cjs';
|
|
3
|
+
import { S as SemanticLayout } from './semantic-records-C3Z76KeN.cjs';
|
|
4
|
+
import './image-resources-DQOiwOuE.cjs';
|
|
5
|
+
import './tree-op-types-B0-sCtw-.cjs';
|
|
6
|
+
import './contracts/types.cjs';
|
|
7
|
+
import './ooxml-package-CdEy9ufK.cjs';
|
|
8
|
+
import './revision-projection-Cc4wz30g.cjs';
|
|
9
|
+
import './omml-equation-BD-LsmWE.cjs';
|
|
9
10
|
|
|
10
11
|
/** A rectangle in page-content coordinates, on a named page. */
|
|
11
12
|
interface OverlayRect {
|
package/dist/output.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { R as ReviewAuthorInfo } from './semantic-paint-
|
|
2
|
-
export { D as DEFAULT_FIELD_SHADING, F as FieldShadingMode, P as PaintOptions, a as RevisionAuthorAssignments, b as RevisionAuthorStyle, c as RevisionStyles, p as paintSemanticLayout } from './semantic-paint-
|
|
3
|
-
import { S as SemanticLayout } from './semantic-records-
|
|
4
|
-
import './image-resources-
|
|
5
|
-
import './tree-op-types-
|
|
6
|
-
import './
|
|
7
|
-
import './ooxml-package-
|
|
8
|
-
import './revision-projection-
|
|
1
|
+
import { R as ReviewAuthorInfo } from './semantic-paint-CufpIQFw.js';
|
|
2
|
+
export { D as DEFAULT_FIELD_SHADING, F as FieldShadingMode, P as PaintOptions, a as RevisionAuthorAssignments, b as RevisionAuthorStyle, c as RevisionStyles, p as paintSemanticLayout } from './semantic-paint-CufpIQFw.js';
|
|
3
|
+
import { S as SemanticLayout } from './semantic-records-Cc1MJrhM.js';
|
|
4
|
+
import './image-resources-eZqD_-vC.js';
|
|
5
|
+
import './tree-op-types-XMVsJSpe.js';
|
|
6
|
+
import './contracts/types.js';
|
|
7
|
+
import './ooxml-package-CdEy9ufK.js';
|
|
8
|
+
import './revision-projection-CILpvv4M.js';
|
|
9
|
+
import './omml-equation-Dd3mBep-.js';
|
|
9
10
|
|
|
10
11
|
/** A rectangle in page-content coordinates, on a named page. */
|
|
11
12
|
interface OverlayRect {
|
package/dist/output.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{h as DEFAULT_FIELD_SHADING,
|
|
1
|
+
export{h as DEFAULT_FIELD_SHADING,l as paintSelectionOverlay,j as paintSemanticLayout}from'./chunk-HHFMXG25.js';import'./chunk-Q66ZJFRE.js';import'./chunk-WU7PUTVA.js';import'./chunk-5VC5HGJA.js';import'./chunk-VUJGPCPU.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { H as HeaderFooterVariant } from './hf-references-
|
|
2
|
-
import { N as NoteKind } from './note-nodes-
|
|
1
|
+
import { H as HeaderFooterVariant } from './hf-references-z5Y4N1ab.js';
|
|
2
|
+
import { N as NoteKind } from './note-nodes-BNCANoGN.js';
|
|
3
3
|
|
|
4
4
|
/** Alignment as this protocol publishes it. `Mixed`/`Unknown` are read-only answers. */
|
|
5
5
|
type AutomationAlignment = 'Mixed' | 'Unknown' | 'Left' | 'Centered' | 'Right' | 'Justified';
|
|
@@ -203,6 +203,8 @@ type AutomationParagraphRef = {
|
|
|
203
203
|
interface AutomationSearchOptions {
|
|
204
204
|
readonly matchCase?: boolean;
|
|
205
205
|
readonly matchWholeWord?: boolean;
|
|
206
|
+
/** Text view to search. `allMarkup` preserves the historical behavior. */
|
|
207
|
+
readonly projection?: AutomationTextProjection;
|
|
206
208
|
/** Not supported; `true` is refused. Punctuation-insensitive matching is not implemented. */
|
|
207
209
|
readonly ignorePunct?: boolean;
|
|
208
210
|
/** Not supported; `true` is refused. Whitespace-insensitive matching is not implemented. */
|
|
@@ -212,6 +214,13 @@ interface AutomationSearchOptions {
|
|
|
212
214
|
/** Tighten the result cap. Clamped to the engine's own limit; never raised past it. */
|
|
213
215
|
readonly limit?: number;
|
|
214
216
|
}
|
|
217
|
+
/**
|
|
218
|
+
* Which revision text an automation read exposes.
|
|
219
|
+
*
|
|
220
|
+
* `allMarkup` includes pending insertions, deletions, and both sides of replacements. `original`
|
|
221
|
+
* matches Word's Original review view: deletions remain visible and insertions are hidden.
|
|
222
|
+
*/
|
|
223
|
+
type AutomationTextProjection = 'allMarkup' | 'original';
|
|
215
224
|
/** Where a selection lands. `start`/`end` collapse it to one edge of the span. */
|
|
216
225
|
type AutomationSelectionMode = 'select' | 'start' | 'end';
|
|
217
226
|
/**
|
|
@@ -256,11 +265,13 @@ type AutomationOperation =
|
|
|
256
265
|
| {
|
|
257
266
|
readonly op: 'getText';
|
|
258
267
|
readonly target: AutomationHandle;
|
|
268
|
+
readonly projection?: AutomationTextProjection;
|
|
259
269
|
}
|
|
260
270
|
/** Text between two endpoints, with a carriage return at every paragraph mark crossed. */
|
|
261
271
|
| {
|
|
262
272
|
readonly op: 'getSpanText';
|
|
263
273
|
readonly span: AutomationSpanRef;
|
|
274
|
+
readonly projection?: AutomationTextProjection;
|
|
264
275
|
}
|
|
265
276
|
/**
|
|
266
277
|
* A paragraph's own identity as the DOCUMENT writes it (`w14:paraId`).
|
|
@@ -312,6 +323,17 @@ type AutomationOperation =
|
|
|
312
323
|
readonly span: AutomationSpanRef;
|
|
313
324
|
readonly text: string;
|
|
314
325
|
}
|
|
326
|
+
/**
|
|
327
|
+
* Replace a story's complete block structure with fresh plain paragraphs.
|
|
328
|
+
*
|
|
329
|
+
* This is the fresh-document operation. It removes tables, content controls, paragraph-level
|
|
330
|
+
* section marks, comments, and revisions. A body's final page-level section properties survive.
|
|
331
|
+
*/
|
|
332
|
+
| {
|
|
333
|
+
readonly op: 'replaceStoryBlocks';
|
|
334
|
+
readonly body: AutomationHandle;
|
|
335
|
+
readonly paragraphs: readonly string[];
|
|
336
|
+
}
|
|
315
337
|
/**
|
|
316
338
|
* Insert a paragraph beside another one. Answers the NEW paragraph's handle.
|
|
317
339
|
*
|
|
@@ -464,6 +486,7 @@ type AutomationOperation =
|
|
|
464
486
|
| {
|
|
465
487
|
readonly op: 'getNoteText';
|
|
466
488
|
readonly note: AutomationHandle;
|
|
489
|
+
readonly projection?: AutomationTextProjection;
|
|
467
490
|
}
|
|
468
491
|
/** Whether a note is a footnote or an endnote. */
|
|
469
492
|
| {
|
|
@@ -887,6 +910,7 @@ type AutomationOperation =
|
|
|
887
910
|
| {
|
|
888
911
|
readonly op: 'getContentControlText';
|
|
889
912
|
readonly contentControl: AutomationHandle;
|
|
913
|
+
readonly projection?: AutomationTextProjection;
|
|
890
914
|
}
|
|
891
915
|
/** The paragraphs the control holds, in reading order. Empty for an inline control's own. */
|
|
892
916
|
| {
|
|
@@ -1010,7 +1034,7 @@ type AutomationOperationKind = AutomationOperation['op'];
|
|
|
1010
1034
|
/** Operations that read. They never open a transaction. */
|
|
1011
1035
|
declare const AUTOMATION_QUERY_OPERATIONS: readonly ["getDocument", "getBody", "getParagraphs", "getSpanParagraphs", "getText", "getSpanText", "getParagraphId", "search", "getFont", "getParagraphFormat", "getStyle", "getSections", "getPageSetup", "getFurniture", "getNotes", "getNoteBody", "getNoteText", "getNoteKind", "getLists", "getListId", "getListById", "getListParagraphs", "getParagraphList", "getListLevel", "getHyperlink", "getBookmarks", "getBookmarkName", "getBookmarkRange", "getComments", "getCommentReplies", "getCommentId", "getCommentAuthor", "getCommentDate", "getCommentText", "getCommentRange", "getCommentResolved", "getRevisions", "getRevisionType", "getRevisionAuthor", "getRevisionDate", "getRevisionRange", "getContentControls", "getContentControlById", "getContentControlsByTag", "getContentControlsByTitle", "getContentControlTag", "getContentControlTitle", "getContentControlFileId", "getContentControlSubtype", "getContentControlLock", "getContentControlIsBound", "getContentControlPlaceholderShown", "getContentControlTemporary", "getContentControlText", "getContentControlParagraphs", "getContentControlRange"];
|
|
1012
1036
|
/** Operations that write. Every one of these goes through the single transaction path. */
|
|
1013
|
-
declare const AUTOMATION_COMMAND_OPERATIONS: readonly ["insertText", "replaceSpan", "insertParagraph", "splitParagraph", "deleteParagraph", "selectSpan", "selectBookmark", "setFont", "setParagraphFormat", "setStyle", "setPageSetup", "deleteNote", "setListLevel", "insertListParagraph", "setHyperlink", "insertComment", "setCommentResolved", "replyToComment", "deleteComment", "acceptRevision", "rejectRevision", "acceptAllRevisions", "rejectAllRevisions", "setContentControlValue", "setContentControlProperties", "deleteContentControl", "insertContentControlText", "insertContentControl", "insertCustomNode"];
|
|
1037
|
+
declare const AUTOMATION_COMMAND_OPERATIONS: readonly ["insertText", "replaceSpan", "replaceStoryBlocks", "insertParagraph", "splitParagraph", "deleteParagraph", "selectSpan", "selectBookmark", "setFont", "setParagraphFormat", "setStyle", "setPageSetup", "deleteNote", "setListLevel", "insertListParagraph", "setHyperlink", "insertComment", "setCommentResolved", "replyToComment", "deleteComment", "acceptRevision", "rejectRevision", "acceptAllRevisions", "rejectAllRevisions", "setContentControlValue", "setContentControlProperties", "deleteContentControl", "insertContentControlText", "insertContentControl", "insertCustomNode"];
|
|
1014
1038
|
/**
|
|
1015
1039
|
* Commands that commit as a PACKAGE transaction and therefore share a batch with nothing.
|
|
1016
1040
|
*
|
|
@@ -1331,4 +1355,4 @@ interface AutomationHost {
|
|
|
1331
1355
|
dispose(): void;
|
|
1332
1356
|
}
|
|
1333
1357
|
|
|
1334
|
-
export { type AutomationCapabilities as A, type AutomationParagraphFormatRead as B, type AutomationParagraphFormatWrite as C, type AutomationParagraphRef as D, type AutomationPoint as E, type AutomationSaveResult as F, type AutomationSearchOptions as G, type AutomationSelectionMode as H, type AutomationSpan as I, type AutomationSpanRef as J, type
|
|
1358
|
+
export { type AutomationCapabilities as A, type AutomationParagraphFormatRead as B, type AutomationParagraphFormatWrite as C, type AutomationParagraphRef as D, type AutomationPoint as E, type AutomationSaveResult as F, type AutomationSearchOptions as G, type AutomationSelectionMode as H, type AutomationSpan as I, type AutomationSpanRef as J, type AutomationTextProjection as K, type AutomationUnsubscribe as L, type AutomationValue as M, isAutomationCommand as N, isSolitaryAutomationCommand as O, type AutomationHost as a, AUTOMATION_COMMAND_OPERATIONS as b, AUTOMATION_QUERY_OPERATIONS as c, AUTOMATION_SOLITARY_OPERATIONS as d, type AutomationAlignment as e, type AutomationBatchRequest as f, type AutomationBatchResponse as g, type AutomationChangeEvent as h, type AutomationContentControlLock as i, type AutomationContentControlRangeLocation as j, type AutomationContentControlScope as k, type AutomationContentControlSubtype as l, type AutomationContentControlValue as m, type AutomationError as n, type AutomationErrorCode as o, type AutomationFontRead as p, type AutomationFontWrite as q, type AutomationHandle as r, type AutomationHandleRef as s, type AutomationObjectKind as t, type AutomationOperation as u, type AutomationOperationKind as v, type AutomationOperationResult as w, type AutomationPageOrientation as x, type AutomationPageSetupRead as y, type AutomationPageSetupWrite as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { H as HeaderFooterVariant } from './hf-references-
|
|
2
|
-
import { N as NoteKind } from './note-nodes-
|
|
1
|
+
import { H as HeaderFooterVariant } from './hf-references-Dvk6De4Q.cjs';
|
|
2
|
+
import { N as NoteKind } from './note-nodes-DL-Au22P.cjs';
|
|
3
3
|
|
|
4
4
|
/** Alignment as this protocol publishes it. `Mixed`/`Unknown` are read-only answers. */
|
|
5
5
|
type AutomationAlignment = 'Mixed' | 'Unknown' | 'Left' | 'Centered' | 'Right' | 'Justified';
|
|
@@ -203,6 +203,8 @@ type AutomationParagraphRef = {
|
|
|
203
203
|
interface AutomationSearchOptions {
|
|
204
204
|
readonly matchCase?: boolean;
|
|
205
205
|
readonly matchWholeWord?: boolean;
|
|
206
|
+
/** Text view to search. `allMarkup` preserves the historical behavior. */
|
|
207
|
+
readonly projection?: AutomationTextProjection;
|
|
206
208
|
/** Not supported; `true` is refused. Punctuation-insensitive matching is not implemented. */
|
|
207
209
|
readonly ignorePunct?: boolean;
|
|
208
210
|
/** Not supported; `true` is refused. Whitespace-insensitive matching is not implemented. */
|
|
@@ -212,6 +214,13 @@ interface AutomationSearchOptions {
|
|
|
212
214
|
/** Tighten the result cap. Clamped to the engine's own limit; never raised past it. */
|
|
213
215
|
readonly limit?: number;
|
|
214
216
|
}
|
|
217
|
+
/**
|
|
218
|
+
* Which revision text an automation read exposes.
|
|
219
|
+
*
|
|
220
|
+
* `allMarkup` includes pending insertions, deletions, and both sides of replacements. `original`
|
|
221
|
+
* matches Word's Original review view: deletions remain visible and insertions are hidden.
|
|
222
|
+
*/
|
|
223
|
+
type AutomationTextProjection = 'allMarkup' | 'original';
|
|
215
224
|
/** Where a selection lands. `start`/`end` collapse it to one edge of the span. */
|
|
216
225
|
type AutomationSelectionMode = 'select' | 'start' | 'end';
|
|
217
226
|
/**
|
|
@@ -256,11 +265,13 @@ type AutomationOperation =
|
|
|
256
265
|
| {
|
|
257
266
|
readonly op: 'getText';
|
|
258
267
|
readonly target: AutomationHandle;
|
|
268
|
+
readonly projection?: AutomationTextProjection;
|
|
259
269
|
}
|
|
260
270
|
/** Text between two endpoints, with a carriage return at every paragraph mark crossed. */
|
|
261
271
|
| {
|
|
262
272
|
readonly op: 'getSpanText';
|
|
263
273
|
readonly span: AutomationSpanRef;
|
|
274
|
+
readonly projection?: AutomationTextProjection;
|
|
264
275
|
}
|
|
265
276
|
/**
|
|
266
277
|
* A paragraph's own identity as the DOCUMENT writes it (`w14:paraId`).
|
|
@@ -312,6 +323,17 @@ type AutomationOperation =
|
|
|
312
323
|
readonly span: AutomationSpanRef;
|
|
313
324
|
readonly text: string;
|
|
314
325
|
}
|
|
326
|
+
/**
|
|
327
|
+
* Replace a story's complete block structure with fresh plain paragraphs.
|
|
328
|
+
*
|
|
329
|
+
* This is the fresh-document operation. It removes tables, content controls, paragraph-level
|
|
330
|
+
* section marks, comments, and revisions. A body's final page-level section properties survive.
|
|
331
|
+
*/
|
|
332
|
+
| {
|
|
333
|
+
readonly op: 'replaceStoryBlocks';
|
|
334
|
+
readonly body: AutomationHandle;
|
|
335
|
+
readonly paragraphs: readonly string[];
|
|
336
|
+
}
|
|
315
337
|
/**
|
|
316
338
|
* Insert a paragraph beside another one. Answers the NEW paragraph's handle.
|
|
317
339
|
*
|
|
@@ -464,6 +486,7 @@ type AutomationOperation =
|
|
|
464
486
|
| {
|
|
465
487
|
readonly op: 'getNoteText';
|
|
466
488
|
readonly note: AutomationHandle;
|
|
489
|
+
readonly projection?: AutomationTextProjection;
|
|
467
490
|
}
|
|
468
491
|
/** Whether a note is a footnote or an endnote. */
|
|
469
492
|
| {
|
|
@@ -887,6 +910,7 @@ type AutomationOperation =
|
|
|
887
910
|
| {
|
|
888
911
|
readonly op: 'getContentControlText';
|
|
889
912
|
readonly contentControl: AutomationHandle;
|
|
913
|
+
readonly projection?: AutomationTextProjection;
|
|
890
914
|
}
|
|
891
915
|
/** The paragraphs the control holds, in reading order. Empty for an inline control's own. */
|
|
892
916
|
| {
|
|
@@ -1010,7 +1034,7 @@ type AutomationOperationKind = AutomationOperation['op'];
|
|
|
1010
1034
|
/** Operations that read. They never open a transaction. */
|
|
1011
1035
|
declare const AUTOMATION_QUERY_OPERATIONS: readonly ["getDocument", "getBody", "getParagraphs", "getSpanParagraphs", "getText", "getSpanText", "getParagraphId", "search", "getFont", "getParagraphFormat", "getStyle", "getSections", "getPageSetup", "getFurniture", "getNotes", "getNoteBody", "getNoteText", "getNoteKind", "getLists", "getListId", "getListById", "getListParagraphs", "getParagraphList", "getListLevel", "getHyperlink", "getBookmarks", "getBookmarkName", "getBookmarkRange", "getComments", "getCommentReplies", "getCommentId", "getCommentAuthor", "getCommentDate", "getCommentText", "getCommentRange", "getCommentResolved", "getRevisions", "getRevisionType", "getRevisionAuthor", "getRevisionDate", "getRevisionRange", "getContentControls", "getContentControlById", "getContentControlsByTag", "getContentControlsByTitle", "getContentControlTag", "getContentControlTitle", "getContentControlFileId", "getContentControlSubtype", "getContentControlLock", "getContentControlIsBound", "getContentControlPlaceholderShown", "getContentControlTemporary", "getContentControlText", "getContentControlParagraphs", "getContentControlRange"];
|
|
1012
1036
|
/** Operations that write. Every one of these goes through the single transaction path. */
|
|
1013
|
-
declare const AUTOMATION_COMMAND_OPERATIONS: readonly ["insertText", "replaceSpan", "insertParagraph", "splitParagraph", "deleteParagraph", "selectSpan", "selectBookmark", "setFont", "setParagraphFormat", "setStyle", "setPageSetup", "deleteNote", "setListLevel", "insertListParagraph", "setHyperlink", "insertComment", "setCommentResolved", "replyToComment", "deleteComment", "acceptRevision", "rejectRevision", "acceptAllRevisions", "rejectAllRevisions", "setContentControlValue", "setContentControlProperties", "deleteContentControl", "insertContentControlText", "insertContentControl", "insertCustomNode"];
|
|
1037
|
+
declare const AUTOMATION_COMMAND_OPERATIONS: readonly ["insertText", "replaceSpan", "replaceStoryBlocks", "insertParagraph", "splitParagraph", "deleteParagraph", "selectSpan", "selectBookmark", "setFont", "setParagraphFormat", "setStyle", "setPageSetup", "deleteNote", "setListLevel", "insertListParagraph", "setHyperlink", "insertComment", "setCommentResolved", "replyToComment", "deleteComment", "acceptRevision", "rejectRevision", "acceptAllRevisions", "rejectAllRevisions", "setContentControlValue", "setContentControlProperties", "deleteContentControl", "insertContentControlText", "insertContentControl", "insertCustomNode"];
|
|
1014
1038
|
/**
|
|
1015
1039
|
* Commands that commit as a PACKAGE transaction and therefore share a batch with nothing.
|
|
1016
1040
|
*
|
|
@@ -1331,4 +1355,4 @@ interface AutomationHost {
|
|
|
1331
1355
|
dispose(): void;
|
|
1332
1356
|
}
|
|
1333
1357
|
|
|
1334
|
-
export { type AutomationCapabilities as A, type AutomationParagraphFormatRead as B, type AutomationParagraphFormatWrite as C, type AutomationParagraphRef as D, type AutomationPoint as E, type AutomationSaveResult as F, type AutomationSearchOptions as G, type AutomationSelectionMode as H, type AutomationSpan as I, type AutomationSpanRef as J, type
|
|
1358
|
+
export { type AutomationCapabilities as A, type AutomationParagraphFormatRead as B, type AutomationParagraphFormatWrite as C, type AutomationParagraphRef as D, type AutomationPoint as E, type AutomationSaveResult as F, type AutomationSearchOptions as G, type AutomationSelectionMode as H, type AutomationSpan as I, type AutomationSpanRef as J, type AutomationTextProjection as K, type AutomationUnsubscribe as L, type AutomationValue as M, isAutomationCommand as N, isSolitaryAutomationCommand as O, type AutomationHost as a, AUTOMATION_COMMAND_OPERATIONS as b, AUTOMATION_QUERY_OPERATIONS as c, AUTOMATION_SOLITARY_OPERATIONS as d, type AutomationAlignment as e, type AutomationBatchRequest as f, type AutomationBatchResponse as g, type AutomationChangeEvent as h, type AutomationContentControlLock as i, type AutomationContentControlRangeLocation as j, type AutomationContentControlScope as k, type AutomationContentControlSubtype as l, type AutomationContentControlValue as m, type AutomationError as n, type AutomationErrorCode as o, type AutomationFontRead as p, type AutomationFontWrite as q, type AutomationHandle as r, type AutomationHandleRef as s, type AutomationObjectKind as t, type AutomationOperation as u, type AutomationOperationKind as v, type AutomationOperationResult as w, type AutomationPageOrientation as x, type AutomationPageSetupRead as y, type AutomationPageSetupWrite as z };
|