@stll/docx-core 0.39.1 → 0.40.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/archive-yBR7X-Qc.js +456 -0
- package/dist/{document-BkGU2ctn.d.ts → document-BWDHON3T.d.ts} +1 -47
- package/dist/{document-oU-dz9zs.js → document-NtScxyHH.js} +18 -36
- package/dist/docx_kernel_bg.wasm +0 -0
- package/dist/errors-Dm3jsb5q.d.ts +57 -0
- package/dist/format-DXPXB02u.js +378 -0
- package/dist/{href-2XSCK-T8.js → href-ogmJmncc.js} +2 -4
- package/dist/index.d.ts +1 -34
- package/dist/index.js +125 -228
- package/dist/model/document.d.ts +2 -2
- package/dist/model/document.js +1 -1
- package/dist/ops/documentOps.d.ts +1 -61
- package/dist/ops/documentOps.js +55 -108
- package/dist/{preservedMarkup-G8XjWhs2.d.ts → preservedMarkup-9L4lbGnE.d.ts} +0 -2
- package/dist/projection.d.ts +0 -4
- package/dist/projection.js +2 -4
- package/dist/schema/sequenceChildren.d.ts +1 -5
- package/dist/schema/sequenceChildren.js +1 -1
- package/dist/{sequenceChildren-9SUK1Tm1.js → sequenceChildren-CrMcryEF.js} +2 -4
- package/dist/zip/archive.d.ts +114 -0
- package/dist/zip/archive.js +3 -0
- package/dist/zip/stream.d.ts +30 -0
- package/dist/zip/stream.js +117 -0
- package/package.json +10 -6
- package/dist/zip/writeZipPart.d.ts +0 -12
- package/dist/zip/writeZipPart.js +0 -17
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
import { _ as ZipError, a as UINT16_SENTINEL, d as encodeEndOfCentralDirectory, f as encodeEntryName, g as toDosDateTime, h as isSafeZipPath, l as encodeCentralHeader, m as fromDosDateTime, p as encodeLocalHeader, r as FIXED_DOS_DATE_TIME, v as copyBytes, y as platformZipCodec } from "./format-DXPXB02u.js";
|
|
2
|
+
import { Result } from "better-result";
|
|
3
|
+
import { decodeText, encodeUtf8 } from "@stll/utf8-boundaries";
|
|
4
|
+
// src/zip/read.ts
|
|
5
|
+
/**
|
|
6
|
+
* Central-directory reading with every size an archive states about itself
|
|
7
|
+
* checked before anything is inflated.
|
|
8
|
+
*
|
|
9
|
+
* An archive is a set of claims written by whoever produced it: the entry
|
|
10
|
+
* count, each entry's sizes and offsets, the names. The reader accepts the
|
|
11
|
+
* archive only when the end record, the central directory and every local
|
|
12
|
+
* header agree, the entries occupy disjoint byte ranges inside the archive,
|
|
13
|
+
* and the declared sizes fit the limits. Inflation later stops at the
|
|
14
|
+
* declared size, so a size that passed here bounds every read.
|
|
15
|
+
*/
|
|
16
|
+
const MEBIBYTE = 1048576;
|
|
17
|
+
/**
|
|
18
|
+
* Defaults sized for office packages. A DEFLATE stream tops out near 1032:1;
|
|
19
|
+
* markup in real documents stays under 75:1.
|
|
20
|
+
*/
|
|
21
|
+
const ZIP_DEFAULT_READ_LIMITS = {
|
|
22
|
+
maxEntries: 1e4,
|
|
23
|
+
maxEntryBytes: 256 * MEBIBYTE,
|
|
24
|
+
maxTotalBytes: 512 * MEBIBYTE,
|
|
25
|
+
maxCompressionRatio: 200,
|
|
26
|
+
compressionRatioGraceBytes: 4 * MEBIBYTE
|
|
27
|
+
};
|
|
28
|
+
const fail = (reason, message, path) => Result.err(path === void 0 ? new ZipError({
|
|
29
|
+
message,
|
|
30
|
+
reason
|
|
31
|
+
}) : new ZipError({
|
|
32
|
+
message,
|
|
33
|
+
reason,
|
|
34
|
+
path
|
|
35
|
+
}));
|
|
36
|
+
const malformed = (message) => fail("malformed", message);
|
|
37
|
+
const toSafeNumber = (value) => value <= BigInt(Number.MAX_SAFE_INTEGER) ? Number(value) : null;
|
|
38
|
+
const findEndRecord = (bytes, view) => {
|
|
39
|
+
const earliest = Math.max(0, bytes.byteLength - 22 - UINT16_SENTINEL);
|
|
40
|
+
for (let offset = bytes.byteLength - 22; offset >= earliest; offset--) if (view.getUint32(offset, true) === 101010256 && offset + 22 + view.getUint16(offset + 20, true) === bytes.byteLength) return offset;
|
|
41
|
+
return -1;
|
|
42
|
+
};
|
|
43
|
+
const readZip64Directory = (view, end) => {
|
|
44
|
+
const locator = end - 20;
|
|
45
|
+
if (locator < 56 || view.getUint32(locator, true) !== 117853008) return malformed("Zip64 end locator is missing");
|
|
46
|
+
if (view.getUint32(locator + 4, true) !== 0 || view.getUint32(locator + 16, true) !== 1) return fail("unsupported", "Multi-disk archives are not supported");
|
|
47
|
+
const record = toSafeNumber(view.getBigUint64(locator + 8, true));
|
|
48
|
+
if (record === null || record + 56 !== locator || view.getUint32(record, true) !== 101075792 || view.getBigUint64(record + 4, true) !== BigInt(44)) return malformed("Zip64 end record is malformed");
|
|
49
|
+
if (view.getUint32(record + 16, true) !== 0 || view.getUint32(record + 20, true) !== 0) return fail("unsupported", "Multi-disk archives are not supported");
|
|
50
|
+
const diskCount = view.getBigUint64(record + 24, true);
|
|
51
|
+
const count = view.getBigUint64(record + 32, true);
|
|
52
|
+
const size = toSafeNumber(view.getBigUint64(record + 40, true));
|
|
53
|
+
const offset = toSafeNumber(view.getBigUint64(record + 48, true));
|
|
54
|
+
const entryCount = toSafeNumber(count);
|
|
55
|
+
if (diskCount !== count || size === null || offset === null || entryCount === null || offset + size !== record) return malformed("Zip64 end record disagrees with the central directory");
|
|
56
|
+
return Result.ok({
|
|
57
|
+
count: entryCount,
|
|
58
|
+
offset,
|
|
59
|
+
end: record
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
const readDirectory = (bytes, view) => {
|
|
63
|
+
const end = findEndRecord(bytes, view);
|
|
64
|
+
if (end === -1) return malformed("End of central directory is missing");
|
|
65
|
+
if (view.getUint16(end + 4, true) !== 0 || view.getUint16(end + 6, true) !== 0) return fail("unsupported", "Multi-disk archives are not supported");
|
|
66
|
+
const diskCount = view.getUint16(end + 8, true);
|
|
67
|
+
const count = view.getUint16(end + 10, true);
|
|
68
|
+
const size = view.getUint32(end + 12, true);
|
|
69
|
+
const offset = view.getUint32(end + 16, true);
|
|
70
|
+
const deferred = count === 65535 || diskCount === 65535 || size === 4294967295 || offset === 4294967295;
|
|
71
|
+
const hasLocator = end >= 20 && view.getUint32(end - 20, true) === 117853008;
|
|
72
|
+
if (deferred || hasLocator) {
|
|
73
|
+
const zip64 = readZip64Directory(view, end);
|
|
74
|
+
if (Result.isError(zip64)) return zip64;
|
|
75
|
+
const directory = zip64.value;
|
|
76
|
+
if (count !== 65535 && count !== directory.count || offset !== 4294967295 && offset !== directory.offset || size !== 4294967295 && size !== directory.end - directory.offset) return malformed("End records disagree");
|
|
77
|
+
return Result.ok(directory);
|
|
78
|
+
}
|
|
79
|
+
if (diskCount !== count || offset + size !== end) return malformed("End record disagrees with the central directory");
|
|
80
|
+
return Result.ok({
|
|
81
|
+
count,
|
|
82
|
+
offset,
|
|
83
|
+
end
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
const readZip64Extra = (view, start, end, fields) => {
|
|
87
|
+
let cursor = start;
|
|
88
|
+
let seen = false;
|
|
89
|
+
const resolved = { ...fields };
|
|
90
|
+
while (cursor < end) {
|
|
91
|
+
if (cursor + 4 > end) return malformed("Extra field is truncated");
|
|
92
|
+
const tag = view.getUint16(cursor, true);
|
|
93
|
+
const length = view.getUint16(cursor + 2, true);
|
|
94
|
+
const payload = cursor + 4;
|
|
95
|
+
if (payload + length > end) return malformed("Extra field is truncated");
|
|
96
|
+
if (tag === 1) {
|
|
97
|
+
if (seen) return malformed("Duplicate Zip64 extra field");
|
|
98
|
+
seen = true;
|
|
99
|
+
let field = payload;
|
|
100
|
+
for (const key of [
|
|
101
|
+
"uncompressedSize",
|
|
102
|
+
"compressedSize",
|
|
103
|
+
"localOffset"
|
|
104
|
+
]) {
|
|
105
|
+
if (fields[key] !== 4294967295) continue;
|
|
106
|
+
if (field + 8 > payload + length) return malformed("Zip64 extra field is truncated");
|
|
107
|
+
const value = toSafeNumber(view.getBigUint64(field, true));
|
|
108
|
+
if (value === null) return malformed("Zip64 size is out of range");
|
|
109
|
+
resolved[key] = value;
|
|
110
|
+
field += 8;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
cursor = payload + length;
|
|
114
|
+
}
|
|
115
|
+
if (!seen && (fields.uncompressedSize === 4294967295 || fields.compressedSize === 4294967295 || fields.localOffset === 4294967295)) return malformed("Zip64 extra field is missing");
|
|
116
|
+
return Result.ok(resolved);
|
|
117
|
+
};
|
|
118
|
+
const decodeName = (name) => {
|
|
119
|
+
const decoded = Result.try(() => decodeText(name, { fatal: true }));
|
|
120
|
+
return Result.isOk(decoded) ? decoded.value : null;
|
|
121
|
+
};
|
|
122
|
+
const LOCAL_FLAGS_THAT_MUST_AGREE = 9;
|
|
123
|
+
const bytesEqual = (left, right) => left.byteLength === right.byteLength && left.every((byte, index) => byte === right[index]);
|
|
124
|
+
const exceedsRatio = (inflated, compressed, limits) => inflated > limits.compressionRatioGraceBytes && inflated > compressed * limits.maxCompressionRatio;
|
|
125
|
+
/**
|
|
126
|
+
* Read and validate the archive's directory. Nothing is inflated; the
|
|
127
|
+
* returned entries carry the sizes every later inflation is held to.
|
|
128
|
+
*/
|
|
129
|
+
const readEntries = (bytes, { limits, isCompressionRatioExempt }) => {
|
|
130
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
131
|
+
const directory = readDirectory(bytes, view);
|
|
132
|
+
if (Result.isError(directory)) return directory;
|
|
133
|
+
const { count, offset: directoryStart, end: directoryEnd } = directory.value;
|
|
134
|
+
if (count > limits.maxEntries) return fail("too-many-entries", "Archive declares too many entries");
|
|
135
|
+
const entries = [];
|
|
136
|
+
const names = /* @__PURE__ */ new Set();
|
|
137
|
+
const spans = [];
|
|
138
|
+
let totalBytes = 0;
|
|
139
|
+
let cursor = directoryStart;
|
|
140
|
+
for (let index = 0; index < count; index++) {
|
|
141
|
+
if (cursor + 46 > directoryEnd || view.getUint32(cursor, true) !== 33639248) return malformed("Central directory record is malformed");
|
|
142
|
+
const flags = view.getUint16(cursor + 8, true);
|
|
143
|
+
const method = view.getUint16(cursor + 10, true);
|
|
144
|
+
const nameLength = view.getUint16(cursor + 28, true);
|
|
145
|
+
const extraLength = view.getUint16(cursor + 30, true);
|
|
146
|
+
const commentLength = view.getUint16(cursor + 32, true);
|
|
147
|
+
const nameStart = cursor + 46;
|
|
148
|
+
const extraStart = nameStart + nameLength;
|
|
149
|
+
const next = extraStart + extraLength + commentLength;
|
|
150
|
+
if (next > directoryEnd || nameLength === 0) return malformed("Central directory record is malformed");
|
|
151
|
+
if (view.getUint16(cursor + 34, true) !== 0) return fail("unsupported", "Multi-disk archives are not supported");
|
|
152
|
+
const name = bytes.subarray(nameStart, extraStart);
|
|
153
|
+
const path = decodeName(name);
|
|
154
|
+
if (path === null || !isSafeZipPath(path)) return fail("invalid-entry-name", "Archive contains an unsafe entry name");
|
|
155
|
+
if (names.has(path)) return fail("duplicate-entry", "Archive names an entry twice", path);
|
|
156
|
+
names.add(path);
|
|
157
|
+
if ((flags & 65) !== 0) return fail("unsupported", "Encrypted entries are not supported", path);
|
|
158
|
+
if (method !== 0 && method !== 8) return fail("unsupported", "Unsupported compression method", path);
|
|
159
|
+
const sizes = readZip64Extra(view, extraStart, extraStart + extraLength, {
|
|
160
|
+
uncompressedSize: view.getUint32(cursor + 24, true),
|
|
161
|
+
compressedSize: view.getUint32(cursor + 20, true),
|
|
162
|
+
localOffset: view.getUint32(cursor + 42, true)
|
|
163
|
+
});
|
|
164
|
+
if (Result.isError(sizes)) return sizes;
|
|
165
|
+
const { uncompressedSize, compressedSize, localOffset } = sizes.value;
|
|
166
|
+
if (method === 0 && compressedSize !== uncompressedSize) return malformed("Stored entry sizes disagree");
|
|
167
|
+
if (localOffset + 30 > directoryStart || view.getUint32(localOffset, true) !== 67324752) return malformed("Local header is missing");
|
|
168
|
+
const localFlags = view.getUint16(localOffset + 6, true);
|
|
169
|
+
const localNameLength = view.getUint16(localOffset + 26, true);
|
|
170
|
+
const localExtraLength = view.getUint16(localOffset + 28, true);
|
|
171
|
+
const dataOffset = localOffset + 30 + localNameLength + localExtraLength;
|
|
172
|
+
if (view.getUint16(localOffset + 8, true) !== method || (localFlags & LOCAL_FLAGS_THAT_MUST_AGREE) !== (flags & LOCAL_FLAGS_THAT_MUST_AGREE) || dataOffset + compressedSize > directoryStart || !bytesEqual(bytes.subarray(localOffset + 30, localOffset + 30 + localNameLength), name)) return malformed("Local header disagrees with the central directory");
|
|
173
|
+
if ((flags & 8) === 0) {
|
|
174
|
+
const localCrc = view.getUint32(localOffset + 14, true);
|
|
175
|
+
const localCompressed = view.getUint32(localOffset + 18, true);
|
|
176
|
+
const localUncompressed = view.getUint32(localOffset + 22, true);
|
|
177
|
+
if (localCrc !== view.getUint32(cursor + 16, true) || localCompressed !== 4294967295 && localCompressed !== compressedSize || localUncompressed !== 4294967295 && localUncompressed !== uncompressedSize) return malformed("Local header disagrees with the central directory");
|
|
178
|
+
}
|
|
179
|
+
spans.push({
|
|
180
|
+
start: localOffset,
|
|
181
|
+
end: dataOffset + compressedSize
|
|
182
|
+
});
|
|
183
|
+
if (path.endsWith("/")) {
|
|
184
|
+
if (uncompressedSize !== 0) return malformed("Directory entry has data");
|
|
185
|
+
cursor = next;
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
if (uncompressedSize > limits.maxEntryBytes) return fail("entry-too-large", "Archive entry is too large", path);
|
|
189
|
+
totalBytes += uncompressedSize;
|
|
190
|
+
if (totalBytes > limits.maxTotalBytes) return fail("total-too-large", "Archive expands beyond its limit");
|
|
191
|
+
if (method === 8 && !isCompressionRatioExempt(path) && exceedsRatio(uncompressedSize, compressedSize, limits)) return fail("compression-ratio", "Archive entry exceeds the compression ratio limit", path);
|
|
192
|
+
entries.push({
|
|
193
|
+
path,
|
|
194
|
+
name,
|
|
195
|
+
flags,
|
|
196
|
+
method,
|
|
197
|
+
dateTime: {
|
|
198
|
+
time: view.getUint16(cursor + 12, true),
|
|
199
|
+
date: view.getUint16(cursor + 14, true)
|
|
200
|
+
},
|
|
201
|
+
crc32: view.getUint32(cursor + 16, true),
|
|
202
|
+
compressedSize,
|
|
203
|
+
uncompressedSize,
|
|
204
|
+
dataOffset
|
|
205
|
+
});
|
|
206
|
+
cursor = next;
|
|
207
|
+
}
|
|
208
|
+
if (cursor !== directoryEnd) return malformed("Central directory size disagrees with its records");
|
|
209
|
+
if (exceedsRatio(totalBytes, bytes.byteLength, limits)) return fail("compression-ratio", "Archive exceeds the compression ratio limit");
|
|
210
|
+
spans.sort((left, right) => left.start - right.start);
|
|
211
|
+
for (let index = 1; index < spans.length; index++) if (spans[index].start < spans[index - 1].end) return malformed("Archive entries overlap");
|
|
212
|
+
return Result.ok(entries);
|
|
213
|
+
};
|
|
214
|
+
// src/zip/archive.ts
|
|
215
|
+
/**
|
|
216
|
+
* An editable ZIP archive held in memory.
|
|
217
|
+
*
|
|
218
|
+
* Reading parses and validates the central directory without inflating
|
|
219
|
+
* anything; each entry inflates on demand and stops at its declared size, so
|
|
220
|
+
* the limits checked at read bound every later read. Writing passes entries
|
|
221
|
+
* that were read and not replaced through as their original compressed
|
|
222
|
+
* bytes, and deflates only what changed.
|
|
223
|
+
*/
|
|
224
|
+
const DEFAULT_DEFLATE_LEVEL = 6;
|
|
225
|
+
const toEntryBytes = (data) => {
|
|
226
|
+
if (typeof data === "string") return encodeUtf8(data);
|
|
227
|
+
if (data instanceof ArrayBuffer) return new Uint8Array(data.slice(0));
|
|
228
|
+
return copyBytes(data);
|
|
229
|
+
};
|
|
230
|
+
const toSourceBytes = (input) => input instanceof ArrayBuffer ? new Uint8Array(input) : input;
|
|
231
|
+
var ArchiveEntry = class {
|
|
232
|
+
/** Entry name, a relative forward-slash path. */
|
|
233
|
+
path;
|
|
234
|
+
/** Inflated size in bytes. */
|
|
235
|
+
size;
|
|
236
|
+
/** Entry timestamp, read as UTC with two seconds of resolution. */
|
|
237
|
+
modified;
|
|
238
|
+
#stored;
|
|
239
|
+
#source;
|
|
240
|
+
#codec;
|
|
241
|
+
constructor(path, stored, archive) {
|
|
242
|
+
this.path = path;
|
|
243
|
+
this.size = stored.type === "source" ? stored.entry.uncompressedSize : stored.bytes.byteLength;
|
|
244
|
+
this.modified = fromDosDateTime(stored.type === "source" ? stored.entry.dateTime : stored.dateTime);
|
|
245
|
+
this.#stored = stored;
|
|
246
|
+
this.#source = archive.source;
|
|
247
|
+
this.#codec = archive.codec;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* The entry's bytes. A read entry inflates at most its declared size and
|
|
251
|
+
* must match its CRC-32; anything else rejects with a {@link ZipError}.
|
|
252
|
+
*/
|
|
253
|
+
async bytes() {
|
|
254
|
+
const stored = this.#stored;
|
|
255
|
+
if (stored.type === "data") return copyBytes(stored.bytes);
|
|
256
|
+
const { entry } = stored;
|
|
257
|
+
const raw = this.#source.subarray(entry.dataOffset, entry.dataOffset + entry.compressedSize);
|
|
258
|
+
let bytes;
|
|
259
|
+
if (entry.method === 0) bytes = copyBytes(raw);
|
|
260
|
+
else {
|
|
261
|
+
const outcome = await this.#codec.inflate(raw, {
|
|
262
|
+
size: entry.uncompressedSize,
|
|
263
|
+
crc32: entry.crc32
|
|
264
|
+
});
|
|
265
|
+
if (outcome.type === "overflow") throw new ZipError({
|
|
266
|
+
message: "Archive entry inflates past its declared size",
|
|
267
|
+
reason: "declared-size-exceeded",
|
|
268
|
+
path: entry.path
|
|
269
|
+
});
|
|
270
|
+
if (outcome.type === "corrupt") throw new ZipError({
|
|
271
|
+
message: "Archive entry data is corrupt",
|
|
272
|
+
reason: "corrupt-entry",
|
|
273
|
+
path: entry.path,
|
|
274
|
+
cause: outcome.cause
|
|
275
|
+
});
|
|
276
|
+
({bytes} = outcome);
|
|
277
|
+
}
|
|
278
|
+
if (this.#codec.crc32(bytes) !== entry.crc32) throw new ZipError({
|
|
279
|
+
message: "Archive entry fails its CRC-32 check",
|
|
280
|
+
reason: "corrupt-entry",
|
|
281
|
+
path: entry.path
|
|
282
|
+
});
|
|
283
|
+
return bytes;
|
|
284
|
+
}
|
|
285
|
+
/** The entry decoded as UTF-8, keeping any byte-order mark. */
|
|
286
|
+
async text() {
|
|
287
|
+
return decodeText(await this.bytes(), { ignoreBOM: true });
|
|
288
|
+
}
|
|
289
|
+
/** The entry's bytes in an `ArrayBuffer` of exactly their length. */
|
|
290
|
+
async arrayBuffer() {
|
|
291
|
+
return (await this.bytes()).buffer;
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
/** An editable, bounded, in-memory ZIP archive. */
|
|
295
|
+
var ZipArchive = class ZipArchive {
|
|
296
|
+
#entries = /* @__PURE__ */ new Map();
|
|
297
|
+
#codec;
|
|
298
|
+
#source = /* @__PURE__ */ new Uint8Array(0);
|
|
299
|
+
constructor(options = {}) {
|
|
300
|
+
this.#codec = options.codec ?? platformZipCodec();
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Read an archive. Rejects with a {@link ZipError} when the archive is
|
|
304
|
+
* malformed or exceeds a limit; entries inflate later, on demand. The
|
|
305
|
+
* archive keeps a reference to `input`, which must not change afterwards.
|
|
306
|
+
*/
|
|
307
|
+
static read(input, options = {}) {
|
|
308
|
+
const bytes = toSourceBytes(input);
|
|
309
|
+
const entries = readEntries(bytes, {
|
|
310
|
+
limits: {
|
|
311
|
+
...ZIP_DEFAULT_READ_LIMITS,
|
|
312
|
+
...options.limits
|
|
313
|
+
},
|
|
314
|
+
isCompressionRatioExempt: options.isCompressionRatioExempt ?? (() => false)
|
|
315
|
+
});
|
|
316
|
+
if (Result.isError(entries)) return Promise.reject(entries.error);
|
|
317
|
+
const archive = new ZipArchive(options.codec === void 0 ? {} : { codec: options.codec });
|
|
318
|
+
archive.#source = bytes;
|
|
319
|
+
for (const entry of entries.value) archive.#entries.set(entry.path, {
|
|
320
|
+
type: "source",
|
|
321
|
+
entry
|
|
322
|
+
});
|
|
323
|
+
return Promise.resolve(archive);
|
|
324
|
+
}
|
|
325
|
+
/** Entry names in archive order. */
|
|
326
|
+
paths() {
|
|
327
|
+
return [...this.#entries.keys()];
|
|
328
|
+
}
|
|
329
|
+
/** Entries in archive order. */
|
|
330
|
+
entries() {
|
|
331
|
+
return [...this.#entries].map(([path, stored]) => this.#wrap(path, stored));
|
|
332
|
+
}
|
|
333
|
+
/** Whether an entry named `path` exists. */
|
|
334
|
+
has(path) {
|
|
335
|
+
return this.#entries.has(path);
|
|
336
|
+
}
|
|
337
|
+
/** The entry named `path`, or `undefined`. */
|
|
338
|
+
entry(path) {
|
|
339
|
+
const stored = this.#entries.get(path);
|
|
340
|
+
return stored === void 0 ? void 0 : this.#wrap(path, stored);
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Add or replace one entry. A replaced entry keeps its position. No parent
|
|
344
|
+
* directory entries are created.
|
|
345
|
+
*/
|
|
346
|
+
set(path, data, options = {}) {
|
|
347
|
+
if (!isSafeZipPath(path) || path.endsWith("/")) throw new ZipError({
|
|
348
|
+
message: "Archive entry name must be a relative file path",
|
|
349
|
+
reason: "invalid-entry-name",
|
|
350
|
+
path
|
|
351
|
+
});
|
|
352
|
+
this.#entries.set(path, {
|
|
353
|
+
type: "data",
|
|
354
|
+
bytes: toEntryBytes(data),
|
|
355
|
+
compression: options.compression,
|
|
356
|
+
level: options.level,
|
|
357
|
+
dateTime: options.modified === void 0 ? FIXED_DOS_DATE_TIME : toDosDateTime(options.modified)
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* An independent copy: later edits to either archive leave the other
|
|
362
|
+
* unchanged. Entry content is shared, never copied, since it is immutable.
|
|
363
|
+
*/
|
|
364
|
+
clone() {
|
|
365
|
+
const copy = new ZipArchive({ codec: this.#codec });
|
|
366
|
+
copy.#source = this.#source;
|
|
367
|
+
for (const [path, stored] of this.#entries) copy.#entries.set(path, stored);
|
|
368
|
+
return copy;
|
|
369
|
+
}
|
|
370
|
+
/** Remove an entry; returns whether it existed. */
|
|
371
|
+
delete(path) {
|
|
372
|
+
return this.#entries.delete(path);
|
|
373
|
+
}
|
|
374
|
+
/** Write the archive. Entries read and not replaced keep their bytes. */
|
|
375
|
+
async generate({ compression = "deflate", level = DEFAULT_DEFLATE_LEVEL, modified } = {}) {
|
|
376
|
+
const dateTime = modified === void 0 ? void 0 : toDosDateTime(modified);
|
|
377
|
+
const prepared = await Promise.all([...this.#entries].map(async ([path, stored]) => await this.#prepare({
|
|
378
|
+
path,
|
|
379
|
+
stored,
|
|
380
|
+
compression,
|
|
381
|
+
level,
|
|
382
|
+
dateTime
|
|
383
|
+
})));
|
|
384
|
+
const locals = prepared.map(({ record }) => encodeLocalHeader(record));
|
|
385
|
+
let offset = 0;
|
|
386
|
+
const offsets = [];
|
|
387
|
+
for (const [index, { payload }] of prepared.entries()) {
|
|
388
|
+
offsets.push(offset);
|
|
389
|
+
offset += locals[index].byteLength + payload.byteLength;
|
|
390
|
+
}
|
|
391
|
+
const centrals = prepared.map(({ record }, index) => encodeCentralHeader(record, offsets[index]));
|
|
392
|
+
const directorySize = centrals.reduce((total, header) => total + header.byteLength, 0);
|
|
393
|
+
const end = encodeEndOfCentralDirectory({
|
|
394
|
+
entryCount: prepared.length,
|
|
395
|
+
offset,
|
|
396
|
+
size: directorySize
|
|
397
|
+
});
|
|
398
|
+
const output = new Uint8Array(offset + directorySize + end.byteLength);
|
|
399
|
+
let cursor = 0;
|
|
400
|
+
for (const [index, { payload }] of prepared.entries()) {
|
|
401
|
+
const local = locals[index];
|
|
402
|
+
output.set(local, cursor);
|
|
403
|
+
cursor += local.byteLength;
|
|
404
|
+
output.set(payload, cursor);
|
|
405
|
+
cursor += payload.byteLength;
|
|
406
|
+
}
|
|
407
|
+
for (const header of centrals) {
|
|
408
|
+
output.set(header, cursor);
|
|
409
|
+
cursor += header.byteLength;
|
|
410
|
+
}
|
|
411
|
+
output.set(end, cursor);
|
|
412
|
+
return output;
|
|
413
|
+
}
|
|
414
|
+
#wrap(path, stored) {
|
|
415
|
+
return new ArchiveEntry(path, stored, {
|
|
416
|
+
source: this.#source,
|
|
417
|
+
codec: this.#codec
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
async #prepare({ path, stored, compression, level, dateTime }) {
|
|
421
|
+
const name = encodeEntryName(path);
|
|
422
|
+
if (stored.type === "source") {
|
|
423
|
+
const { entry } = stored;
|
|
424
|
+
return {
|
|
425
|
+
record: {
|
|
426
|
+
name: name.bytes,
|
|
427
|
+
flags: name.flags,
|
|
428
|
+
method: entry.method,
|
|
429
|
+
dateTime: dateTime ?? entry.dateTime,
|
|
430
|
+
crc32: entry.crc32,
|
|
431
|
+
compressedSize: entry.compressedSize,
|
|
432
|
+
uncompressedSize: entry.uncompressedSize,
|
|
433
|
+
directory: false
|
|
434
|
+
},
|
|
435
|
+
payload: this.#source.subarray(entry.dataOffset, entry.dataOffset + entry.compressedSize)
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
const { bytes } = stored;
|
|
439
|
+
const deflate = (stored.compression ?? compression) === "deflate";
|
|
440
|
+
const payload = deflate ? await this.#codec.deflate(bytes, stored.level ?? level) : bytes;
|
|
441
|
+
return {
|
|
442
|
+
record: {
|
|
443
|
+
name: name.bytes,
|
|
444
|
+
flags: name.flags,
|
|
445
|
+
method: deflate ? 8 : 0,
|
|
446
|
+
dateTime: dateTime ?? stored.dateTime,
|
|
447
|
+
crc32: this.#codec.crc32(bytes),
|
|
448
|
+
compressedSize: payload.byteLength,
|
|
449
|
+
uncompressedSize: bytes.byteLength,
|
|
450
|
+
directory: false
|
|
451
|
+
},
|
|
452
|
+
payload
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
};
|
|
456
|
+
export { ZIP_DEFAULT_READ_LIMITS as n, ZipArchive as t };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { n as PreservedChild, r as PreservedMarkup, t as PreservedAttribute } from "./preservedMarkup-
|
|
2
|
-
//#region src/model/borderStyle.gen.d.ts
|
|
1
|
+
import { n as PreservedChild, r as PreservedMarkup, t as PreservedAttribute } from "./preservedMarkup-9L4lbGnE.js";
|
|
3
2
|
/**
|
|
4
3
|
* GENERATED FILE — do not edit.
|
|
5
4
|
*
|
|
@@ -19,8 +18,6 @@ import { n as PreservedChild, r as PreservedMarkup, t as PreservedAttribute } fr
|
|
|
19
18
|
declare const BORDER_STYLES: readonly ["nil", "none", "single", "thick", "double", "dotted", "dashed", "dotDash", "dotDotDash", "triple", "thinThickSmallGap", "thickThinSmallGap", "thinThickThinSmallGap", "thinThickMediumGap", "thickThinMediumGap", "thinThickThinMediumGap", "thinThickLargeGap", "thickThinLargeGap", "thinThickThinLargeGap", "wave", "doubleWave", "dashSmallGap", "dashDotStroked", "threeDEmboss", "threeDEngrave", "outset", "inset", "apples", "archedScallops", "babyPacifier", "babyRattle", "balloons3Colors", "balloonsHotAir", "basicBlackDashes", "basicBlackDots", "basicBlackSquares", "basicThinLines", "basicWhiteDashes", "basicWhiteDots", "basicWhiteSquares", "basicWideInline", "basicWideMidline", "basicWideOutline", "bats", "birds", "birdsFlight", "cabins", "cakeSlice", "candyCorn", "celticKnotwork", "certificateBanner", "chainLink", "champagneBottle", "checkedBarBlack", "checkedBarColor", "checkered", "christmasTree", "circlesLines", "circlesRectangles", "classicalWave", "clocks", "compass", "confetti", "confettiGrays", "confettiOutline", "confettiStreamers", "confettiWhite", "cornerTriangles", "couponCutoutDashes", "couponCutoutDots", "crazyMaze", "creaturesButterfly", "creaturesFish", "creaturesInsects", "creaturesLadyBug", "crossStitch", "cup", "decoArch", "decoArchColor", "decoBlocks", "diamondsGray", "doubleD", "doubleDiamonds", "earth1", "earth2", "earth3", "eclipsingSquares1", "eclipsingSquares2", "eggsBlack", "fans", "film", "firecrackers", "flowersBlockPrint", "flowersDaisies", "flowersModern1", "flowersModern2", "flowersPansy", "flowersRedRose", "flowersRoses", "flowersTeacup", "flowersTiny", "gems", "gingerbreadMan", "gradient", "handmade1", "handmade2", "heartBalloon", "heartGray", "hearts", "heebieJeebies", "holly", "houseFunky", "hypnotic", "iceCreamCones", "lightBulb", "lightning1", "lightning2", "mapPins", "mapleLeaf", "mapleMuffins", "marquee", "marqueeToothed", "moons", "mosaic", "musicNotes", "northwest", "ovals", "packages", "palmsBlack", "palmsColor", "paperClips", "papyrus", "partyFavor", "partyGlass", "pencils", "people", "peopleWaving", "peopleHats", "poinsettias", "postageStamp", "pumpkin1", "pushPinNote2", "pushPinNote1", "pyramids", "pyramidsAbove", "quadrants", "rings", "safari", "sawtooth", "sawtoothGray", "scaredCat", "seattle", "shadowedSquares", "sharksTeeth", "shorebirdTracks", "skyrocket", "snowflakeFancy", "snowflakes", "sombrero", "southwest", "stars", "starsTop", "stars3d", "starsBlack", "starsShadowed", "sun", "swirligig", "tornPaper", "tornPaperBlack", "trees", "triangleParty", "triangles", "triangle1", "triangle2", "triangleCircle1", "triangleCircle2", "shapes1", "shapes2", "twistedLines1", "twistedLines2", "vine", "waveline", "weavingAngles", "weavingBraid", "weavingRibbon", "weavingStrips", "whiteFlowers", "woodwork", "xIllusions", "zanyTriangles", "zigZag", "zigZagStitch", "custom"];
|
|
20
19
|
/** `w:val` on `CT_Border`: a border style the schema declares. */
|
|
21
20
|
type BorderStyle = (typeof BORDER_STYLES)[number];
|
|
22
|
-
//#endregion
|
|
23
|
-
//#region src/model/borderStyle.d.ts
|
|
24
21
|
/**
|
|
25
22
|
* A `w:val` the schema does not declare, kept exactly as the file spelled it.
|
|
26
23
|
*
|
|
@@ -54,8 +51,6 @@ declare const isBorderNil: (style: BorderStyleValue | undefined) => boolean;
|
|
|
54
51
|
* the value keeps it.
|
|
55
52
|
*/
|
|
56
53
|
declare const statesNoBorder: (style: BorderStyleValue | undefined) => boolean;
|
|
57
|
-
//#endregion
|
|
58
|
-
//#region src/model/themeColor.gen.d.ts
|
|
59
54
|
/**
|
|
60
55
|
* GENERATED FILE — do not edit.
|
|
61
56
|
*
|
|
@@ -78,8 +73,6 @@ declare const THEME_COLORS: readonly ["dark1", "light1", "dark2", "light2", "acc
|
|
|
78
73
|
type ThemeColor = "dark1" | "light1" | "dark2" | "light2" | "accent1" | "accent2" | "accent3" | "accent4" | "accent5" | "accent6" | "hyperlink" | "followedHyperlink" | "none" | "background1" | "text1" | "background2" | "text2";
|
|
79
74
|
type SchemeColorSlot = "dk1" | "lt1" | "dk2" | "lt2" | "accent1" | "accent2" | "accent3" | "accent4" | "accent5" | "accent6" | "hlink" | "folHlink";
|
|
80
75
|
type SchemeColorValue = "bg1" | "tx1" | "bg2" | "tx2" | "accent1" | "accent2" | "accent3" | "accent4" | "accent5" | "accent6" | "hlink" | "folHlink" | "phClr" | "dk1" | "lt1" | "dk2" | "lt2";
|
|
81
|
-
//#endregion
|
|
82
|
-
//#region src/model/themeColor.d.ts
|
|
83
76
|
/**
|
|
84
77
|
* The `a:schemeClr/@val` spelling of each theme colour.
|
|
85
78
|
*
|
|
@@ -166,8 +159,6 @@ declare const knownThemeColor: (value: ThemeColorValue) => ThemeColor | undefine
|
|
|
166
159
|
* a token the schema does not enumerate.
|
|
167
160
|
*/
|
|
168
161
|
declare const themeColorSlot: (value: ThemeColorValue) => SchemeColorSlot | undefined;
|
|
169
|
-
//#endregion
|
|
170
|
-
//#region src/model/colors.d.ts
|
|
171
162
|
/**
|
|
172
163
|
* Color value - can be direct RGB, theme reference, or auto
|
|
173
164
|
*/
|
|
@@ -242,8 +233,6 @@ type ShadingProperties = {
|
|
|
242
233
|
/** `CT_Shd` attributes this record has no field for; see {@link BorderSpec}. */
|
|
243
234
|
preservedAttributes?: PreservedAttribute[];
|
|
244
235
|
};
|
|
245
|
-
//#endregion
|
|
246
|
-
//#region src/model/ooxmlEnumerations.gen.d.ts
|
|
247
236
|
/**
|
|
248
237
|
* GENERATED FILE — do not edit.
|
|
249
238
|
*
|
|
@@ -338,8 +327,6 @@ declare const TEXT_DIRECTION_FLOW_BY_TOKEN: {
|
|
|
338
327
|
*/
|
|
339
328
|
declare const NUMBER_FORMATS: readonly ["decimal", "upperRoman", "lowerRoman", "upperLetter", "lowerLetter", "ordinal", "cardinalText", "ordinalText", "hex", "chicago", "ideographDigital", "japaneseCounting", "aiueo", "iroha", "decimalFullWidth", "decimalHalfWidth", "japaneseLegal", "japaneseDigitalTenThousand", "decimalEnclosedCircle", "decimalFullWidth2", "aiueoFullWidth", "irohaFullWidth", "decimalZero", "bullet", "ganada", "chosung", "decimalEnclosedFullstop", "decimalEnclosedParen", "decimalEnclosedCircleChinese", "ideographEnclosedCircle", "ideographTraditional", "ideographZodiac", "ideographZodiacTraditional", "taiwaneseCounting", "ideographLegalTraditional", "taiwaneseCountingThousand", "taiwaneseDigital", "chineseCounting", "chineseLegalSimplified", "chineseCountingThousand", "koreanDigital", "koreanCounting", "koreanLegal", "koreanDigital2", "vietnameseCounting", "russianLower", "russianUpper", "none", "numberInDash", "hebrew1", "hebrew2", "arabicAlpha", "arabicAbjad", "hindiVowels", "hindiConsonants", "hindiNumbers", "hindiCounting", "thaiLetters", "thaiNumbers", "thaiCounting", "bahtText", "dollarText", "custom"];
|
|
340
329
|
type NumberFormat = "decimal" | "upperRoman" | "lowerRoman" | "upperLetter" | "lowerLetter" | "ordinal" | "cardinalText" | "ordinalText" | "hex" | "chicago" | "ideographDigital" | "japaneseCounting" | "aiueo" | "iroha" | "decimalFullWidth" | "decimalHalfWidth" | "japaneseLegal" | "japaneseDigitalTenThousand" | "decimalEnclosedCircle" | "decimalFullWidth2" | "aiueoFullWidth" | "irohaFullWidth" | "decimalZero" | "bullet" | "ganada" | "chosung" | "decimalEnclosedFullstop" | "decimalEnclosedParen" | "decimalEnclosedCircleChinese" | "ideographEnclosedCircle" | "ideographTraditional" | "ideographZodiac" | "ideographZodiacTraditional" | "taiwaneseCounting" | "ideographLegalTraditional" | "taiwaneseCountingThousand" | "taiwaneseDigital" | "chineseCounting" | "chineseLegalSimplified" | "chineseCountingThousand" | "koreanDigital" | "koreanCounting" | "koreanLegal" | "koreanDigital2" | "vietnameseCounting" | "russianLower" | "russianUpper" | "none" | "numberInDash" | "hebrew1" | "hebrew2" | "arabicAlpha" | "arabicAbjad" | "hindiVowels" | "hindiConsonants" | "hindiNumbers" | "hindiCounting" | "thaiLetters" | "thaiNumbers" | "thaiCounting" | "bahtText" | "dollarText" | "custom";
|
|
341
|
-
//#endregion
|
|
342
|
-
//#region src/model/outlineLevel.d.ts
|
|
343
330
|
/**
|
|
344
331
|
* `w:outlineLvl`: nine heading levels and one reserved "not a heading".
|
|
345
332
|
*
|
|
@@ -389,8 +376,6 @@ declare const outlineLevelStatedValue: (outlineLevel: OutlineLevel) => number;
|
|
|
389
376
|
* cascade still has a tier left to ask.
|
|
390
377
|
*/
|
|
391
378
|
declare const headingLevelOf: (outlineLevel: OutlineLevel | null | undefined) => HeadingOutlineLevel | undefined;
|
|
392
|
-
//#endregion
|
|
393
|
-
//#region src/model/paragraphNumbering.d.ts
|
|
394
379
|
/**
|
|
395
380
|
* `w:numPr`: what a tier states about a paragraph's numbering, and what the
|
|
396
381
|
* cascade resolves that to.
|
|
@@ -514,8 +499,6 @@ declare const paragraphNumberingReferenceId: (numbering: ParagraphNumberingOverr
|
|
|
514
499
|
declare const sameStatedParagraphNumbering: (left: ParagraphNumberingOverride | undefined, right: ParagraphNumberingOverride | undefined) => boolean;
|
|
515
500
|
/** Whether two stated overrides render the same, an absent `w:ilvl` read as zero. */
|
|
516
501
|
declare const sameEffectiveParagraphNumbering: (left: ParagraphNumberingOverride | undefined, right: ParagraphNumberingOverride | undefined) => boolean;
|
|
517
|
-
//#endregion
|
|
518
|
-
//#region src/model/formatting.d.ts
|
|
519
502
|
/** Formatting journals retain an explicitly undefined own field. */
|
|
520
503
|
type OwnFieldPresence<Formatting> = { [Key in keyof Formatting]: Formatting[Key] | undefined; };
|
|
521
504
|
/**
|
|
@@ -1128,8 +1111,6 @@ type TableCellFormatting = {
|
|
|
1128
1111
|
*/
|
|
1129
1112
|
sourceXml?: string;
|
|
1130
1113
|
};
|
|
1131
|
-
//#endregion
|
|
1132
|
-
//#region src/model/lists.d.ts
|
|
1133
1114
|
/**
|
|
1134
1115
|
* What the marker renderer counts in: folio's own vocabulary, not the format's.
|
|
1135
1116
|
*
|
|
@@ -1345,8 +1326,6 @@ type NumberingDefinitions = {
|
|
|
1345
1326
|
/** Attributes of `w:numbering` the model has no field for. */
|
|
1346
1327
|
preservedAttributes?: PreservedAttribute[];
|
|
1347
1328
|
};
|
|
1348
|
-
//#endregion
|
|
1349
|
-
//#region src/model/presetLineDash.gen.d.ts
|
|
1350
1329
|
/**
|
|
1351
1330
|
* GENERATED FILE — do not edit.
|
|
1352
1331
|
*
|
|
@@ -1364,8 +1343,6 @@ type NumberingDefinitions = {
|
|
|
1364
1343
|
declare const PRESET_LINE_DASH_VALS: readonly ["solid", "dot", "dash", "lgDash", "dashDot", "lgDashDot", "lgDashDotDot", "sysDash", "sysDot", "sysDashDot", "sysDashDotDot"];
|
|
1365
1344
|
/** `a:prstDash@val`: a preset dash the schema declares. */
|
|
1366
1345
|
type PresetLineDashVal = (typeof PRESET_LINE_DASH_VALS)[number];
|
|
1367
|
-
//#endregion
|
|
1368
|
-
//#region src/model/presetLineDash.d.ts
|
|
1369
1346
|
/**
|
|
1370
1347
|
* A `@val` the schema does not declare, kept exactly as the file spelled it.
|
|
1371
1348
|
*
|
|
@@ -1386,8 +1363,6 @@ declare const isPresetLineDashVal: (value: string) => value is PresetLineDashVal
|
|
|
1386
1363
|
declare const presetLineDashFrom: (value: string) => PresetLineDashValue;
|
|
1387
1364
|
/** The token to write back, whether or not the schema declares it. */
|
|
1388
1365
|
declare const presetLineDashToken: (dash: PresetLineDashValue) => string;
|
|
1389
|
-
//#endregion
|
|
1390
|
-
//#region src/model/preview.d.ts
|
|
1391
1366
|
/**
|
|
1392
1367
|
* How a drawing with no image data is drawn, without drawing it.
|
|
1393
1368
|
*
|
|
@@ -1447,8 +1422,6 @@ type PreviewDescriptor = {
|
|
|
1447
1422
|
/** Already bounded by the shape and point caps, in paint order. */
|
|
1448
1423
|
readonly shapes: readonly PreviewShape[];
|
|
1449
1424
|
};
|
|
1450
|
-
//#endregion
|
|
1451
|
-
//#region src/model/relationshipId.d.ts
|
|
1452
1425
|
/**
|
|
1453
1426
|
* A relationship reference that names something.
|
|
1454
1427
|
*
|
|
@@ -1484,8 +1457,6 @@ declare const relationshipIdOf: (value: string | null | undefined) => Relationsh
|
|
|
1484
1457
|
* one where the refinement has stopped describing the type.
|
|
1485
1458
|
*/
|
|
1486
1459
|
declare const mintRelationshipId: (ordinal: number) => RelationshipId;
|
|
1487
|
-
//#endregion
|
|
1488
|
-
//#region src/model/content.d.ts
|
|
1489
1460
|
/**
|
|
1490
1461
|
* Plain text content
|
|
1491
1462
|
*/
|
|
@@ -3764,12 +3735,8 @@ type DocumentBody = {
|
|
|
3764
3735
|
/** Comments from comments.xml */
|
|
3765
3736
|
comments?: Comment[];
|
|
3766
3737
|
};
|
|
3767
|
-
//#endregion
|
|
3768
|
-
//#region src/model/runPropertyReview.d.ts
|
|
3769
3738
|
/** A run-property container has one pending formatting revision. */
|
|
3770
3739
|
declare const getSingularRunPropertyChange: (propertyChanges: readonly RunPropertyChange[] | undefined) => RunPropertyChange | undefined;
|
|
3771
|
-
//#endregion
|
|
3772
|
-
//#region src/model/canonical.d.ts
|
|
3773
3740
|
/** Set modeled comments while keeping an empty comments part out of the document model. */
|
|
3774
3741
|
declare const setDocumentBodyComments: (body: DocumentBody, comments: Comment[]) => void;
|
|
3775
3742
|
/**
|
|
@@ -3782,8 +3749,6 @@ declare const setDocumentBodyComments: (body: DocumentBody, comments: Comment[])
|
|
|
3782
3749
|
declare const finalizeParagraphFormatting: (formatting: ParagraphFormatting | undefined) => ParagraphFormatting | undefined;
|
|
3783
3750
|
/** Whether paragraph formatting states no modeled properties. */
|
|
3784
3751
|
declare const isCanonicallyEmptyParagraphFormatting: (formatting: ParagraphFormatting | undefined) => boolean;
|
|
3785
|
-
//#endregion
|
|
3786
|
-
//#region src/model/parseWarning.d.ts
|
|
3787
3752
|
/**
|
|
3788
3753
|
* What folio normalised to open a document, as data rather than as prose.
|
|
3789
3754
|
*
|
|
@@ -3913,8 +3878,6 @@ type ParseWarning = {
|
|
|
3913
3878
|
* thousand records. Occurrences past the cap are counted, not kept.
|
|
3914
3879
|
*/
|
|
3915
3880
|
declare const MAX_RETAINED_PARSE_WARNINGS_PER_CODE = 20;
|
|
3916
|
-
//#endregion
|
|
3917
|
-
//#region src/model/styles.d.ts
|
|
3918
3881
|
/**
|
|
3919
3882
|
* Style type
|
|
3920
3883
|
*/
|
|
@@ -4173,8 +4136,6 @@ type MediaFile = {
|
|
|
4173
4136
|
/** Data URL for direct use in src attributes */
|
|
4174
4137
|
dataUrl?: string;
|
|
4175
4138
|
};
|
|
4176
|
-
//#endregion
|
|
4177
|
-
//#region src/model/exhaustiveFields.d.ts
|
|
4178
4139
|
/**
|
|
4179
4140
|
* Compile-time totality over every field of a model type.
|
|
4180
4141
|
*
|
|
@@ -4190,12 +4151,8 @@ type MediaFile = {
|
|
|
4190
4151
|
* ```
|
|
4191
4152
|
*/
|
|
4192
4153
|
type ExhaustiveFields<Source, Classified extends keyof Source> = Exclude<keyof Source, Classified> extends never ? Source : never;
|
|
4193
|
-
//#endregion
|
|
4194
|
-
//#region src/model/numberingLevel.d.ts
|
|
4195
4154
|
/** Resolve only defined numbering levels; preserve unsupported source values elsewhere. */
|
|
4196
4155
|
declare const isNumberingLevel: (value: number) => boolean;
|
|
4197
|
-
//#endregion
|
|
4198
|
-
//#region src/model/numberingLevels.d.ts
|
|
4199
4156
|
type NumberingLevelResolution = {
|
|
4200
4157
|
kind: "level";
|
|
4201
4158
|
level: ListLevel;
|
|
@@ -4241,8 +4198,6 @@ declare const numberingLevelEntries: (definitions: NumberingDefinitions) => Numb
|
|
|
4241
4198
|
* current level's legal-numbering mode, `none`, and placeholder rendering.
|
|
4242
4199
|
*/
|
|
4243
4200
|
declare const levelShowsMarker: (definitions: NumberingDefinitions, numId: number, ilvl: number) => boolean;
|
|
4244
|
-
//#endregion
|
|
4245
|
-
//#region src/model/document.d.ts
|
|
4246
4201
|
/** OOXML default per §17.6.13 when `w:defaultTabStop` is absent. */
|
|
4247
4202
|
declare const DEFAULT_TAB_STOP_TWIPS = 720;
|
|
4248
4203
|
/**
|
|
@@ -4404,5 +4359,4 @@ declare const COMMENT_PART_RELATIONSHIPS: {
|
|
|
4404
4359
|
readonly target: "commentsExtended.xml";
|
|
4405
4360
|
};
|
|
4406
4361
|
};
|
|
4407
|
-
//#endregion
|
|
4408
4362
|
export { Column as $, UnrecognisedThemeColor as $i, TableContentCarrier as $n, TableCellBorders as $r, MoveFromRangeStart as $t, ThemeColorScheme as A, headingLevelOf as Ai, SdtEndProperties as An, PRESET_LINE_DASH_VALS as Ar, Hyperlink as At, finalizeParagraphFormatting as B, TEXT_DIRECTIONS as Bi, ShapeFill as Bn, ListRendering as Br, ImageWrap as Bt, Relationship as C, paragraphNumberingSlots as Ci, PropertyChangeInfo as Cn, PreviewDescriptor as Cr, FooterReference as Ct, StyleDefinitions as D, BODY_TEXT_OUTLINE_LEVEL as Di, Run as Dn, isPresetLineDashVal as Dr, HeaderFooter as Dt, Style as E, sameStatedParagraphNumbering as Ei, ReviewCarrier as En, UnrecognisedPresetLineDash as Er, FootnoteProperties as Et, MAX_RETAINED_PARSE_WARNINGS_PER_CODE as F, NumberFormat as Fi, SectionPropertyChange as Fn, LevelLegacy as Fr, ImageFrameLocks as Ft, BidiControl as G, TextDirection as Gi, SimpleField as Gn, EmphasisMark as Gr, InstrTextContent as Gt, setDocumentBodyComments as H, TEXT_DIRECTION_FLOW_BY_TOKEN as Hi, ShapeOutline as Hn, NumberingInstance as Hr, InlineSdt as Ht, PARSE_WARNING_CODES as I, PARAGRAPH_ALIGNMENTS as Ii, SectionStart as In, LevelOverride as Ir, ImagePadding as It, BlockSdt as J, ColorValue as Ji, TabContent as Jn, ParagraphFormatting as Jr, MarkupRangeMarker as Jt, BlockContent as K, TextDirectionFlow as Ki, SoftHyphenContent as Kn, FloatingTableProperties as Kr, LineNumberRestart as Kt, ParseWarning as L, ParagraphAlignment as Li, Shape as Ln, LevelSuffix as Lr, ImagePosition as Lt, ThemeFontScheme as M, outlineLevelFromStatedValue as Mi, SdtType as Mn, AbstractNumbering as Mr, Image as Mt, IMPORTED_ID_COLLISION_KINDS as N, outlineLevelStatedValue as Ni, Section as Nn, COUNTER_FORMATS as Nr, ImageCrop as Nt, StyleType as O, HeadingOutlineLevel as Oi, RunContent as On, presetLineDashFrom as Or, HeaderFooterType as Ot, ImportedIdCollisionKind as P, NUMBER_FORMATS as Pi, SectionProperties as Pn, CounterFormat as Pr, ImageDocPrLink as Pt, BreakContent as Q, ThemeColorValue as Qi, TableCellPropertyChange as Qn, TableBorders as Qr, MoveFromRangeEnd as Qt, ParseWarningCode as R, TABLE_ALIGNMENTS as Ri, ShapeAlternateContent as Rn, ListLevel as Rr, ImageSize as Rt, MediaFile as S, paragraphNumberingReferenceId as Si, PropertyChange as Sn, relationshipIdOf as Sr, FoldedListNumber as St, RelationshipType as T, sameEffectiveParagraphNumbering as Ti, REVIEW_CARRIERS as Tn, PresetLineDashValue as Tr, FootnotePosition as Tt, getSingularRunPropertyChange as U, TabStopAlignment as Ui, ShapeTextBody as Un, CellMargins as Ur, InlineWrapper as Ut, isCanonicallyEmptyParagraphFormatting as V, TEXT_DIRECTION_FLOWS as Vi, ShapeGeometryAdjustment as Vn, NumberingDefinitions as Vr, ImageWrapPolygon as Vt, BIDI_CONTROLS as W, TableAlignment as Wi, ShapeType as Wn, ConditionalFormatStyle as Wr, Insertion as Wt, BookmarkRangeMarker as X, SCHEME_COLOR_VALUE_BY_THEME_COLOR as Xi, TableCell as Xn, TabLeader as Xr, MoveBookmarkMarker as Xt, BookmarkEnd as Y, ShadingProperties as Yi, Table as Yn, SpacingExplicit as Yr, MathEquation as Yt, BookmarkStart as Z, THEME_COLOR_BY_SCHEME_COLOR_VALUE as Zi, TableCellBlock as Zn, TabStop as Zr, MoveFrom as Zt, DocDefaults as _, statesNoBorder as _a, isNumberingReference as _i, PositionalTab as _n, WrapPolygonPoint as _r, EndnotePosition as _t, DocumentSettings as a, themeColorToken as aa, TablePropertyExceptionFormatting as ai, NoteMarkerContent as an, TableRowPropertyChange as ar, DRAWING_RAW_XML_MODES as at, FontInfo as b, paragraphNumberingLevel as bi, PreservedInline as bn, RelationshipId as br, FieldCharContent as bt, NumberingLevelEntry as c, THEME_COLORS as ca, TextEffect as ci, PARAGRAPH_MARK_CHANGE_KINDS as cn, TextContent as cr, DocumentBackground as ct, numberingInstanceResolves as d, UnrecognisedBorderStyle as da, NO_NUMBERING_NUM_ID as di, Paragraph as dn, TrackedRunChange as dr, DrawingAnchor as dt, isSchemeColorValue as ea, TableCellFormatting as ei, MoveTo as en, TableCustomXmlWrapper as er, Comment as et, numberingLevelEntries as f, borderStyleFrom as fa, NO_PARAGRAPH_NUMBERING as fi, ParagraphContent as fn, TrackedRunContent as fr, DrawingContent as ft, ExhaustiveFields as g, isBorderStyle as ga, ResolvedParagraphNumbering as gi, PictureWatermark as gn, WrapDistances as gr, Endnote as gt, isNumberingLevel as h, isBorderNone as ha, ParagraphNumberingSlots as hi, ParagraphPropertyChange as hn, WrapDistanceSlots as hr, EffectExtentSlots as ht, Document as i, themeColorSlot as ia, TableMeasurement as ii, NonVisualDrawingNames as in, TableRow as ir, ComplexField as it, ThemeFont as j, headingOutlineLevel as ji, SdtProperties as jn, PresetLineDashVal as jr, INSERTION_SEAM_POLICIES as jt, Theme as k, OutlineLevel as ki, RunPropertyChange as kn, presetLineDashToken as kr, HeaderReference as kt, NumberingLevelResolution as l, ThemeColor as la, TextFormatting as li, PROPERTY_REVISION_KINDS as ln, TextWatermark as lr, DocumentBackgroundDrawing as lt, resolveNumberingLevel as m, isBorderNil as ma, ParagraphNumberingReference as mi, ParagraphMarkChangeKind as mn, Watermark as mr, DrawingRawXmlMode as mt, DEFAULT_TAB_STOP_TWIPS as n, knownThemeColor as na, TableGridChange as ni, MoveToRangeStart as nn, TablePropertyChange as nr, CommentRangeStart as nt, DocxConformanceClass as o, SchemeColorSlot as oa, TableRowFormatting as oi, NoteNumberRestart as on, TableStructuralChangeInfo as or, Deletion as ot, numberingLevelHasMarkerSlot as p, borderStyleToken as pa, ParagraphNumberingOverride as pi, ParagraphMarkChange as pn, VerticalAlign as pr, DrawingGroupChild as pt, BlockCustomXml as q, BorderSpec as qi, SymbolContent as qn, LineSpacingRule as qr, MAX_REVISION_ID as qt, DOCX_CONFORMANCE_CLASSES as r, readThemeColor as ra, TableLook as ri, NoBreakHyphenContent as rn, TablePropertyExceptionChange as rr, CommentReference as rt, DocxPackage as s, SchemeColorValue as sa, TableWidthType as si, NoteReferenceContent as sn, TextBox as sr, DisplacedByCustomXml as st, COMMENT_PART_RELATIONSHIPS as t, isThemeColor as ta, TableFormatting as ti, MoveToRangeEnd as tn, TablePreservedMarkup as tr, CommentRangeEnd as tt, levelShowsMarker as u, BorderStyleValue as ua, UnderlineStyle as ui, PageOrientation as un, TrackedChangeInfo as ur, DocumentBody as ut, EmbeddedFontRef as v, BORDER_STYLES as va, mergeParagraphNumbering as vi, PositionedBookmarkMarker as vn, isOoxmlSymbolCharacter as vr, EndnoteProperties as vt, RelationshipMap as w, resolveParagraphNumbering as wi, PropertyRevisionKind as wn, PreviewShape as wr, Footnote as wt, FontTable as x, paragraphNumberingReference as xi, PreservedXmlContent as xn, mintRelationshipId as xr, FieldType as xt, FontCharset as y, BorderStyle as ya, paragraphNumberingFromSlots as yi, PreservedBlock as yn, normalizeRevisionId as yr, Field as yt, ParseWarningLocation as z, TAB_STOP_ALIGNMENTS as zi, ShapeContent as zn, ListMarkerFormatting as zr, ImageTransform as zt };
|