odf.js 0.0.0 → 1.1.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/LICENSE +21 -0
- package/dist/index.cjs +729 -0
- package/dist/index.d.cts +389 -0
- package/dist/index.d.ts +389 -0
- package/dist/index.js +683 -0
- package/package.json +86 -2
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/model/node.d.ts
|
|
3
|
+
declare const AttributeSchema: z.ZodObject<{
|
|
4
|
+
name: z.ZodString;
|
|
5
|
+
value: z.ZodString;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
type Attribute = z.infer<typeof AttributeSchema>;
|
|
8
|
+
declare const XmlTextSchema: z.ZodObject<{
|
|
9
|
+
type: z.ZodLiteral<"text">;
|
|
10
|
+
value: z.ZodString;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
type XmlText = z.infer<typeof XmlTextSchema>;
|
|
13
|
+
declare const XmlCdataSchema: z.ZodObject<{
|
|
14
|
+
type: z.ZodLiteral<"cdata">;
|
|
15
|
+
value: z.ZodString;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
type XmlCdata = z.infer<typeof XmlCdataSchema>;
|
|
18
|
+
declare const XmlCommentSchema: z.ZodObject<{
|
|
19
|
+
type: z.ZodLiteral<"comment">;
|
|
20
|
+
value: z.ZodString;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
type XmlComment = z.infer<typeof XmlCommentSchema>;
|
|
23
|
+
declare const XmlDeclarationSchema: z.ZodObject<{
|
|
24
|
+
type: z.ZodLiteral<"declaration">;
|
|
25
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
26
|
+
name: z.ZodString;
|
|
27
|
+
value: z.ZodString;
|
|
28
|
+
}, z.core.$strip>>;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
type XmlDeclaration = z.infer<typeof XmlDeclarationSchema>;
|
|
31
|
+
declare const XmlPiSchema: z.ZodObject<{
|
|
32
|
+
type: z.ZodLiteral<"pi">;
|
|
33
|
+
target: z.ZodString;
|
|
34
|
+
content: z.ZodString;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
type XmlPi = z.infer<typeof XmlPiSchema>;
|
|
37
|
+
interface XmlElement {
|
|
38
|
+
type: 'element';
|
|
39
|
+
tag: string;
|
|
40
|
+
attributes: Attribute[];
|
|
41
|
+
children: XmlNode[];
|
|
42
|
+
}
|
|
43
|
+
type XmlNode = XmlText | XmlCdata | XmlComment | XmlDeclaration | XmlPi | XmlElement;
|
|
44
|
+
declare function isXmlNode(value: unknown): value is XmlNode;
|
|
45
|
+
declare const XmlElementSchema: z.ZodObject<{
|
|
46
|
+
type: z.ZodLiteral<"element">;
|
|
47
|
+
tag: z.ZodString;
|
|
48
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
49
|
+
name: z.ZodString;
|
|
50
|
+
value: z.ZodString;
|
|
51
|
+
}, z.core.$strip>>;
|
|
52
|
+
children: z.ZodArray<z.ZodCustom<XmlNode, XmlNode>>;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
declare const XmlNodeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
55
|
+
type: z.ZodLiteral<"text">;
|
|
56
|
+
value: z.ZodString;
|
|
57
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
58
|
+
type: z.ZodLiteral<"cdata">;
|
|
59
|
+
value: z.ZodString;
|
|
60
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
61
|
+
type: z.ZodLiteral<"comment">;
|
|
62
|
+
value: z.ZodString;
|
|
63
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
64
|
+
type: z.ZodLiteral<"declaration">;
|
|
65
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
66
|
+
name: z.ZodString;
|
|
67
|
+
value: z.ZodString;
|
|
68
|
+
}, z.core.$strip>>;
|
|
69
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
70
|
+
type: z.ZodLiteral<"pi">;
|
|
71
|
+
target: z.ZodString;
|
|
72
|
+
content: z.ZodString;
|
|
73
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
74
|
+
type: z.ZodLiteral<"element">;
|
|
75
|
+
tag: z.ZodString;
|
|
76
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
77
|
+
name: z.ZodString;
|
|
78
|
+
value: z.ZodString;
|
|
79
|
+
}, z.core.$strip>>;
|
|
80
|
+
children: z.ZodArray<z.ZodCustom<XmlNode, XmlNode>>;
|
|
81
|
+
}, z.core.$strip>], "type">;
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region src/model/package.d.ts
|
|
84
|
+
declare const XmlPartSchema: z.ZodObject<{
|
|
85
|
+
kind: z.ZodLiteral<"xml">;
|
|
86
|
+
nodes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
87
|
+
type: z.ZodLiteral<"text">;
|
|
88
|
+
value: z.ZodString;
|
|
89
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
90
|
+
type: z.ZodLiteral<"cdata">;
|
|
91
|
+
value: z.ZodString;
|
|
92
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
93
|
+
type: z.ZodLiteral<"comment">;
|
|
94
|
+
value: z.ZodString;
|
|
95
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
96
|
+
type: z.ZodLiteral<"declaration">;
|
|
97
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
98
|
+
name: z.ZodString;
|
|
99
|
+
value: z.ZodString;
|
|
100
|
+
}, z.core.$strip>>;
|
|
101
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
102
|
+
type: z.ZodLiteral<"pi">;
|
|
103
|
+
target: z.ZodString;
|
|
104
|
+
content: z.ZodString;
|
|
105
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
106
|
+
type: z.ZodLiteral<"element">;
|
|
107
|
+
tag: z.ZodString;
|
|
108
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
109
|
+
name: z.ZodString;
|
|
110
|
+
value: z.ZodString;
|
|
111
|
+
}, z.core.$strip>>;
|
|
112
|
+
children: z.ZodArray<z.ZodCustom<XmlNode, XmlNode>>;
|
|
113
|
+
}, z.core.$strip>], "type">>;
|
|
114
|
+
}, z.core.$strip>;
|
|
115
|
+
type XmlPart = z.infer<typeof XmlPartSchema>;
|
|
116
|
+
declare const BinaryPartSchema: z.ZodObject<{
|
|
117
|
+
kind: z.ZodLiteral<"binary">;
|
|
118
|
+
base64: z.ZodString;
|
|
119
|
+
}, z.core.$strip>;
|
|
120
|
+
type BinaryPart = z.infer<typeof BinaryPartSchema>;
|
|
121
|
+
declare const PartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
122
|
+
kind: z.ZodLiteral<"xml">;
|
|
123
|
+
nodes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
124
|
+
type: z.ZodLiteral<"text">;
|
|
125
|
+
value: z.ZodString;
|
|
126
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
127
|
+
type: z.ZodLiteral<"cdata">;
|
|
128
|
+
value: z.ZodString;
|
|
129
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
130
|
+
type: z.ZodLiteral<"comment">;
|
|
131
|
+
value: z.ZodString;
|
|
132
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
133
|
+
type: z.ZodLiteral<"declaration">;
|
|
134
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
135
|
+
name: z.ZodString;
|
|
136
|
+
value: z.ZodString;
|
|
137
|
+
}, z.core.$strip>>;
|
|
138
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
139
|
+
type: z.ZodLiteral<"pi">;
|
|
140
|
+
target: z.ZodString;
|
|
141
|
+
content: z.ZodString;
|
|
142
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
143
|
+
type: z.ZodLiteral<"element">;
|
|
144
|
+
tag: z.ZodString;
|
|
145
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
146
|
+
name: z.ZodString;
|
|
147
|
+
value: z.ZodString;
|
|
148
|
+
}, z.core.$strip>>;
|
|
149
|
+
children: z.ZodArray<z.ZodCustom<XmlNode, XmlNode>>;
|
|
150
|
+
}, z.core.$strip>], "type">>;
|
|
151
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
152
|
+
kind: z.ZodLiteral<"binary">;
|
|
153
|
+
base64: z.ZodString;
|
|
154
|
+
}, z.core.$strip>], "kind">;
|
|
155
|
+
type Part = z.infer<typeof PartSchema>;
|
|
156
|
+
declare const PackageSchema: z.ZodObject<{
|
|
157
|
+
parts: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
158
|
+
kind: z.ZodLiteral<"xml">;
|
|
159
|
+
nodes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
160
|
+
type: z.ZodLiteral<"text">;
|
|
161
|
+
value: z.ZodString;
|
|
162
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
163
|
+
type: z.ZodLiteral<"cdata">;
|
|
164
|
+
value: z.ZodString;
|
|
165
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
166
|
+
type: z.ZodLiteral<"comment">;
|
|
167
|
+
value: z.ZodString;
|
|
168
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
169
|
+
type: z.ZodLiteral<"declaration">;
|
|
170
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
171
|
+
name: z.ZodString;
|
|
172
|
+
value: z.ZodString;
|
|
173
|
+
}, z.core.$strip>>;
|
|
174
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
175
|
+
type: z.ZodLiteral<"pi">;
|
|
176
|
+
target: z.ZodString;
|
|
177
|
+
content: z.ZodString;
|
|
178
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
179
|
+
type: z.ZodLiteral<"element">;
|
|
180
|
+
tag: z.ZodString;
|
|
181
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
182
|
+
name: z.ZodString;
|
|
183
|
+
value: z.ZodString;
|
|
184
|
+
}, z.core.$strip>>;
|
|
185
|
+
children: z.ZodArray<z.ZodCustom<XmlNode, XmlNode>>;
|
|
186
|
+
}, z.core.$strip>], "type">>;
|
|
187
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
188
|
+
kind: z.ZodLiteral<"binary">;
|
|
189
|
+
base64: z.ZodString;
|
|
190
|
+
}, z.core.$strip>], "kind">>;
|
|
191
|
+
}, z.core.$strip>;
|
|
192
|
+
type Package = z.infer<typeof PackageSchema>;
|
|
193
|
+
//#endregion
|
|
194
|
+
//#region src/codec.d.ts
|
|
195
|
+
declare const xmlCodec: z.ZodCodec<z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
196
|
+
type: z.ZodLiteral<"text">;
|
|
197
|
+
value: z.ZodString;
|
|
198
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
199
|
+
type: z.ZodLiteral<"cdata">;
|
|
200
|
+
value: z.ZodString;
|
|
201
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
202
|
+
type: z.ZodLiteral<"comment">;
|
|
203
|
+
value: z.ZodString;
|
|
204
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
205
|
+
type: z.ZodLiteral<"declaration">;
|
|
206
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
207
|
+
name: z.ZodString;
|
|
208
|
+
value: z.ZodString;
|
|
209
|
+
}, z.core.$strip>>;
|
|
210
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
211
|
+
type: z.ZodLiteral<"pi">;
|
|
212
|
+
target: z.ZodString;
|
|
213
|
+
content: z.ZodString;
|
|
214
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
215
|
+
type: z.ZodLiteral<"element">;
|
|
216
|
+
tag: z.ZodString;
|
|
217
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
218
|
+
name: z.ZodString;
|
|
219
|
+
value: z.ZodString;
|
|
220
|
+
}, z.core.$strip>>;
|
|
221
|
+
children: z.ZodArray<z.ZodCustom<XmlNode, XmlNode>>;
|
|
222
|
+
}, z.core.$strip>], "type">>>;
|
|
223
|
+
declare const packageCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, z.ZodObject<{
|
|
224
|
+
parts: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
225
|
+
kind: z.ZodLiteral<"xml">;
|
|
226
|
+
nodes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
227
|
+
type: z.ZodLiteral<"text">;
|
|
228
|
+
value: z.ZodString;
|
|
229
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
230
|
+
type: z.ZodLiteral<"cdata">;
|
|
231
|
+
value: z.ZodString;
|
|
232
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
233
|
+
type: z.ZodLiteral<"comment">;
|
|
234
|
+
value: z.ZodString;
|
|
235
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
236
|
+
type: z.ZodLiteral<"declaration">;
|
|
237
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
238
|
+
name: z.ZodString;
|
|
239
|
+
value: z.ZodString;
|
|
240
|
+
}, z.core.$strip>>;
|
|
241
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
242
|
+
type: z.ZodLiteral<"pi">;
|
|
243
|
+
target: z.ZodString;
|
|
244
|
+
content: z.ZodString;
|
|
245
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
246
|
+
type: z.ZodLiteral<"element">;
|
|
247
|
+
tag: z.ZodString;
|
|
248
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
249
|
+
name: z.ZodString;
|
|
250
|
+
value: z.ZodString;
|
|
251
|
+
}, z.core.$strip>>;
|
|
252
|
+
children: z.ZodArray<z.ZodCustom<XmlNode, XmlNode>>;
|
|
253
|
+
}, z.core.$strip>], "type">>;
|
|
254
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
255
|
+
kind: z.ZodLiteral<"binary">;
|
|
256
|
+
base64: z.ZodString;
|
|
257
|
+
}, z.core.$strip>], "kind">>;
|
|
258
|
+
}, z.core.$strip>>;
|
|
259
|
+
declare function decodePackage(bytes: Uint8Array<ArrayBuffer>): Package;
|
|
260
|
+
declare function encodePackage(pkg: Package): Uint8Array<ArrayBuffer>;
|
|
261
|
+
//#endregion
|
|
262
|
+
//#region src/package-io/read.d.ts
|
|
263
|
+
declare function parsePackage(bytes: Uint8Array<ArrayBuffer>): Package;
|
|
264
|
+
//#endregion
|
|
265
|
+
//#region src/package-io/write.d.ts
|
|
266
|
+
declare const MIMETYPE_PART = "mimetype";
|
|
267
|
+
declare const MANIFEST_PART = "META-INF/manifest.xml";
|
|
268
|
+
declare function serializePackage(pkg: Package): Uint8Array<ArrayBuffer>;
|
|
269
|
+
//#endregion
|
|
270
|
+
//#region src/xml/parse.d.ts
|
|
271
|
+
declare function parseXml(xml: string): XmlNode[];
|
|
272
|
+
//#endregion
|
|
273
|
+
//#region src/xml/build.d.ts
|
|
274
|
+
declare function buildXml(nodes: XmlNode[]): string;
|
|
275
|
+
//#endregion
|
|
276
|
+
//#region src/zip.d.ts
|
|
277
|
+
interface ZipEntry {
|
|
278
|
+
readonly bytes: Uint8Array<ArrayBuffer>;
|
|
279
|
+
readonly stored?: boolean;
|
|
280
|
+
}
|
|
281
|
+
declare function unzipPackage(bytes: Uint8Array<ArrayBuffer>): Record<string, Uint8Array<ArrayBuffer>>;
|
|
282
|
+
declare function zipPackage(entries: readonly (readonly [string, ZipEntry])[]): Uint8Array<ArrayBuffer>;
|
|
283
|
+
//#endregion
|
|
284
|
+
//#region src/util/base64.d.ts
|
|
285
|
+
declare function bytesToBase64(bytes: Uint8Array<ArrayBuffer>): string;
|
|
286
|
+
declare function base64ToBytes(b64: string): Uint8Array<ArrayBuffer>;
|
|
287
|
+
//#endregion
|
|
288
|
+
//#region src/ns.d.ts
|
|
289
|
+
declare const ODF_NAMESPACES: Readonly<{
|
|
290
|
+
office: "urn:oasis:names:tc:opendocument:xmlns:office:1.0";
|
|
291
|
+
style: "urn:oasis:names:tc:opendocument:xmlns:style:1.0";
|
|
292
|
+
text: "urn:oasis:names:tc:opendocument:xmlns:text:1.0";
|
|
293
|
+
table: "urn:oasis:names:tc:opendocument:xmlns:table:1.0";
|
|
294
|
+
draw: "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0";
|
|
295
|
+
fo: "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0";
|
|
296
|
+
svg: "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0";
|
|
297
|
+
xlink: "http://www.w3.org/1999/xlink";
|
|
298
|
+
dc: "http://purl.org/dc/elements/1.1/";
|
|
299
|
+
meta: "urn:oasis:names:tc:opendocument:xmlns:meta:1.0";
|
|
300
|
+
number: "urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0";
|
|
301
|
+
chart: "urn:oasis:names:tc:opendocument:xmlns:chart:1.0";
|
|
302
|
+
dr3d: "urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0";
|
|
303
|
+
math: "http://www.w3.org/1998/Math/MathML";
|
|
304
|
+
form: "urn:oasis:names:tc:opendocument:xmlns:form:1.0";
|
|
305
|
+
script: "urn:oasis:names:tc:opendocument:xmlns:script:1.0";
|
|
306
|
+
config: "urn:oasis:names:tc:opendocument:xmlns:config:1.0";
|
|
307
|
+
presentation: "urn:oasis:names:tc:opendocument:xmlns:presentation:1.0";
|
|
308
|
+
smil: "urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0";
|
|
309
|
+
anim: "urn:oasis:names:tc:opendocument:xmlns:animation:1.0";
|
|
310
|
+
xforms: "http://www.w3.org/2002/xforms";
|
|
311
|
+
xsd: "http://www.w3.org/2001/XMLSchema";
|
|
312
|
+
xsi: "http://www.w3.org/2001/XMLSchema-instance";
|
|
313
|
+
manifest: "urn:oasis:names:tc:opendocument:xmlns:manifest:1.0";
|
|
314
|
+
}>;
|
|
315
|
+
type OdfNamespacePrefix = keyof typeof ODF_NAMESPACES;
|
|
316
|
+
declare function xmlnsAttributes(prefixes: readonly OdfNamespacePrefix[]): Record<string, string>;
|
|
317
|
+
//#endregion
|
|
318
|
+
//#region src/media-type.d.ts
|
|
319
|
+
declare const ODF_MEDIA_TYPES: Readonly<{
|
|
320
|
+
odt: "application/vnd.oasis.opendocument.text";
|
|
321
|
+
ott: "application/vnd.oasis.opendocument.text-template";
|
|
322
|
+
ods: "application/vnd.oasis.opendocument.spreadsheet";
|
|
323
|
+
ots: "application/vnd.oasis.opendocument.spreadsheet-template";
|
|
324
|
+
odp: "application/vnd.oasis.opendocument.presentation";
|
|
325
|
+
otp: "application/vnd.oasis.opendocument.presentation-template";
|
|
326
|
+
odg: "application/vnd.oasis.opendocument.graphics";
|
|
327
|
+
otg: "application/vnd.oasis.opendocument.graphics-template";
|
|
328
|
+
odf: "application/vnd.oasis.opendocument.formula";
|
|
329
|
+
otf: "application/vnd.oasis.opendocument.formula-template";
|
|
330
|
+
odm: "application/vnd.oasis.opendocument.text-master";
|
|
331
|
+
otm: "application/vnd.oasis.opendocument.text-master-template";
|
|
332
|
+
odb: "application/vnd.oasis.opendocument.base";
|
|
333
|
+
}>;
|
|
334
|
+
type OdfExtension = keyof typeof ODF_MEDIA_TYPES;
|
|
335
|
+
declare function mediaTypeForExtension(extension: string): string | undefined;
|
|
336
|
+
//#endregion
|
|
337
|
+
//#region src/image/sniff.d.ts
|
|
338
|
+
type ImageFormat = 'png' | 'jpeg';
|
|
339
|
+
declare function sniffImageFormat(bytes: Uint8Array<ArrayBuffer>): ImageFormat | undefined;
|
|
340
|
+
//#endregion
|
|
341
|
+
//#region src/mimetype.d.ts
|
|
342
|
+
declare function readMimetype(pkg: Package): string | undefined;
|
|
343
|
+
declare function writeMimetype(pkg: Package, mediaType: string): void;
|
|
344
|
+
//#endregion
|
|
345
|
+
//#region src/xml/fragment.d.ts
|
|
346
|
+
declare function el(tag: string, attrs?: Record<string, string>, children?: XmlNode[]): XmlElement;
|
|
347
|
+
declare function txt(value: string): XmlText;
|
|
348
|
+
//#endregion
|
|
349
|
+
//#region src/xml/entities.d.ts
|
|
350
|
+
declare function encodeXmlText(value: string): string;
|
|
351
|
+
//#endregion
|
|
352
|
+
//#region src/manifest.d.ts
|
|
353
|
+
declare const ManifestEntrySchema: z.ZodObject<{
|
|
354
|
+
fullPath: z.ZodString;
|
|
355
|
+
mediaType: z.ZodString;
|
|
356
|
+
version: z.ZodOptional<z.ZodString>;
|
|
357
|
+
}, z.core.$strip>;
|
|
358
|
+
type ManifestEntry = z.infer<typeof ManifestEntrySchema>;
|
|
359
|
+
declare const ManifestSchema: z.ZodObject<{
|
|
360
|
+
version: z.ZodString;
|
|
361
|
+
entries: z.ZodArray<z.ZodObject<{
|
|
362
|
+
fullPath: z.ZodString;
|
|
363
|
+
mediaType: z.ZodString;
|
|
364
|
+
version: z.ZodOptional<z.ZodString>;
|
|
365
|
+
}, z.core.$strip>>;
|
|
366
|
+
}, z.core.$strip>;
|
|
367
|
+
type Manifest = z.infer<typeof ManifestSchema>;
|
|
368
|
+
declare const ManifestProblemSchema: z.ZodObject<{
|
|
369
|
+
severity: z.ZodEnum<{
|
|
370
|
+
error: "error";
|
|
371
|
+
warning: "warning";
|
|
372
|
+
}>;
|
|
373
|
+
message: z.ZodString;
|
|
374
|
+
path: z.ZodOptional<z.ZodString>;
|
|
375
|
+
}, z.core.$strip>;
|
|
376
|
+
type ManifestProblem = z.infer<typeof ManifestProblemSchema>;
|
|
377
|
+
declare function readManifest(pkg: Package): Manifest;
|
|
378
|
+
interface BuildManifestOptions {
|
|
379
|
+
documentMediaType?: string;
|
|
380
|
+
version?: string;
|
|
381
|
+
mediaTypeOverrides?: Readonly<Record<string, string>>;
|
|
382
|
+
}
|
|
383
|
+
declare function buildManifest(pkg: Package, options?: BuildManifestOptions): Manifest;
|
|
384
|
+
declare function writeManifest(pkg: Package, manifest: Manifest): void;
|
|
385
|
+
declare function syncManifest(pkg: Package, options?: BuildManifestOptions): void;
|
|
386
|
+
declare function validateManifest(pkg: Package): ManifestProblem[];
|
|
387
|
+
declare function setDocumentMediaType(pkg: Package, mediaType: string, version?: string): void;
|
|
388
|
+
//#endregion
|
|
389
|
+
export { type Attribute, AttributeSchema, type BinaryPart, BinaryPartSchema, type BuildManifestOptions, type ImageFormat, MANIFEST_PART, MIMETYPE_PART, type Manifest, type ManifestEntry, ManifestEntrySchema, type ManifestProblem, ManifestProblemSchema, ManifestSchema, ODF_MEDIA_TYPES, ODF_NAMESPACES, type OdfExtension, type OdfNamespacePrefix, type Package, PackageSchema, type Part, PartSchema, type XmlCdata, XmlCdataSchema, type XmlComment, XmlCommentSchema, type XmlDeclaration, XmlDeclarationSchema, type XmlElement, XmlElementSchema, type XmlNode, XmlNodeSchema, type XmlPart, XmlPartSchema, type XmlPi, XmlPiSchema, type XmlText, XmlTextSchema, type ZipEntry, base64ToBytes, buildManifest, buildXml, bytesToBase64, decodePackage, el, encodePackage, encodeXmlText, isXmlNode, mediaTypeForExtension, packageCodec, parsePackage, parseXml, readManifest, readMimetype, serializePackage, setDocumentMediaType, sniffImageFormat, syncManifest, txt, unzipPackage, validateManifest, writeManifest, writeMimetype, xmlCodec, xmlnsAttributes, zipPackage };
|