@bendyline/squisq-formats 1.2.3 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-33YRFXZZ.js +1187 -0
- package/dist/chunk-33YRFXZZ.js.map +1 -0
- package/dist/{chunk-EUQQYBZZ.js → chunk-ERZ627GR.js} +4 -4
- package/dist/chunk-ERZ627GR.js.map +1 -0
- package/dist/{chunk-MEZF76JA.js → chunk-UDS45KUJ.js} +68 -25
- package/dist/chunk-UDS45KUJ.js.map +1 -0
- package/dist/{chunk-NGWHV77G.js → chunk-VN2KEOYB.js} +7 -6
- package/dist/chunk-VN2KEOYB.js.map +1 -0
- package/dist/container/index.d.ts +7 -5
- package/dist/container/index.js +39 -70
- package/dist/container/index.js.map +1 -1
- package/dist/docx/index.d.ts +128 -15
- package/dist/docx/index.js +17 -22
- package/dist/docx/index.js.map +1 -1
- package/dist/epub/index.d.ts +66 -11
- package/dist/epub/index.js +10 -18
- package/dist/epub/index.js.map +1 -1
- package/dist/html/index.d.ts +278 -9
- package/dist/html/index.js +26 -137
- package/dist/html/index.js.map +1 -1
- package/dist/index.d.ts +9 -38
- package/dist/index.js +62 -37
- package/dist/index.js.map +1 -1
- package/dist/ooxml/index.d.ts +353 -14
- package/dist/ooxml/index.js +116 -22
- package/dist/ooxml/index.js.map +1 -1
- package/dist/pdf/index.d.ts +143 -17
- package/dist/pdf/index.js +16 -25
- package/dist/pdf/index.js.map +1 -1
- package/dist/pptx/index.d.ts +83 -8
- package/dist/pptx/index.js +14 -34
- package/dist/pptx/index.js.map +1 -1
- package/dist/xlsx/index.d.ts +12 -9
- package/dist/xlsx/index.js +12 -44
- package/dist/xlsx/index.js.map +1 -1
- package/package.json +3 -2
- package/src/__tests__/html.test.ts +82 -4
- package/src/__tests__/pdfExport.test.ts +1 -1
- package/src/__tests__/plainHtml.test.ts +372 -0
- package/src/__tests__/plainHtmlBundle.test.ts +235 -0
- package/src/docx/export.ts +163 -22
- package/src/epub/export.ts +3 -3
- package/src/html/docsHtmlBundle.ts +369 -0
- package/src/html/htmlTemplate.ts +40 -0
- package/src/html/index.ts +32 -3
- package/src/html/plainHtml.ts +736 -0
- package/src/html/plainHtmlBundle.ts +419 -0
- package/src/pptx/export.ts +10 -9
- package/dist/__tests__/container.test.d.ts +0 -8
- package/dist/__tests__/container.test.d.ts.map +0 -1
- package/dist/__tests__/container.test.js +0 -147
- package/dist/__tests__/container.test.js.map +0 -1
- package/dist/__tests__/docxExport.test.d.ts +0 -8
- package/dist/__tests__/docxExport.test.d.ts.map +0 -1
- package/dist/__tests__/docxExport.test.js +0 -383
- package/dist/__tests__/docxExport.test.js.map +0 -1
- package/dist/__tests__/docxImport.test.d.ts +0 -8
- package/dist/__tests__/docxImport.test.d.ts.map +0 -1
- package/dist/__tests__/docxImport.test.js +0 -309
- package/dist/__tests__/docxImport.test.js.map +0 -1
- package/dist/__tests__/epub.test.d.ts +0 -8
- package/dist/__tests__/epub.test.d.ts.map +0 -1
- package/dist/__tests__/epub.test.js +0 -472
- package/dist/__tests__/epub.test.js.map +0 -1
- package/dist/__tests__/html.test.d.ts +0 -8
- package/dist/__tests__/html.test.d.ts.map +0 -1
- package/dist/__tests__/html.test.js +0 -243
- package/dist/__tests__/html.test.js.map +0 -1
- package/dist/__tests__/ooxml.test.d.ts +0 -5
- package/dist/__tests__/ooxml.test.d.ts.map +0 -1
- package/dist/__tests__/ooxml.test.js +0 -152
- package/dist/__tests__/ooxml.test.js.map +0 -1
- package/dist/__tests__/pdfExport.test.d.ts +0 -8
- package/dist/__tests__/pdfExport.test.d.ts.map +0 -1
- package/dist/__tests__/pdfExport.test.js +0 -275
- package/dist/__tests__/pdfExport.test.js.map +0 -1
- package/dist/__tests__/pdfImport.test.d.ts +0 -11
- package/dist/__tests__/pdfImport.test.d.ts.map +0 -1
- package/dist/__tests__/pdfImport.test.js +0 -254
- package/dist/__tests__/pdfImport.test.js.map +0 -1
- package/dist/__tests__/roundTrip.test.d.ts +0 -7
- package/dist/__tests__/roundTrip.test.d.ts.map +0 -1
- package/dist/__tests__/roundTrip.test.js +0 -173
- package/dist/__tests__/roundTrip.test.js.map +0 -1
- package/dist/chunk-EUQQYBZZ.js.map +0 -1
- package/dist/chunk-MEZF76JA.js.map +0 -1
- package/dist/chunk-NGWHV77G.js.map +0 -1
- package/dist/chunk-UM5V2XZG.js +0 -242
- package/dist/chunk-UM5V2XZG.js.map +0 -1
- package/dist/container/index.d.ts.map +0 -1
- package/dist/docx/export.d.ts +0 -69
- package/dist/docx/export.d.ts.map +0 -1
- package/dist/docx/export.js +0 -854
- package/dist/docx/export.js.map +0 -1
- package/dist/docx/import.d.ts +0 -65
- package/dist/docx/import.d.ts.map +0 -1
- package/dist/docx/import.js +0 -779
- package/dist/docx/import.js.map +0 -1
- package/dist/docx/index.d.ts.map +0 -1
- package/dist/docx/styles.d.ts +0 -68
- package/dist/docx/styles.d.ts.map +0 -1
- package/dist/docx/styles.js +0 -125
- package/dist/docx/styles.js.map +0 -1
- package/dist/epub/export.d.ts +0 -72
- package/dist/epub/export.d.ts.map +0 -1
- package/dist/epub/export.js +0 -698
- package/dist/epub/export.js.map +0 -1
- package/dist/epub/index.d.ts.map +0 -1
- package/dist/html/htmlTemplate.d.ts +0 -70
- package/dist/html/htmlTemplate.d.ts.map +0 -1
- package/dist/html/htmlTemplate.js +0 -239
- package/dist/html/htmlTemplate.js.map +0 -1
- package/dist/html/imageUtils.d.ts +0 -29
- package/dist/html/imageUtils.d.ts.map +0 -1
- package/dist/html/imageUtils.js +0 -63
- package/dist/html/imageUtils.js.map +0 -1
- package/dist/html/index.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/ooxml/index.d.ts.map +0 -1
- package/dist/ooxml/namespaces.d.ts +0 -77
- package/dist/ooxml/namespaces.d.ts.map +0 -1
- package/dist/ooxml/namespaces.js +0 -104
- package/dist/ooxml/namespaces.js.map +0 -1
- package/dist/ooxml/reader.d.ts +0 -52
- package/dist/ooxml/reader.d.ts.map +0 -1
- package/dist/ooxml/reader.js +0 -190
- package/dist/ooxml/reader.js.map +0 -1
- package/dist/ooxml/types.d.ts +0 -82
- package/dist/ooxml/types.d.ts.map +0 -1
- package/dist/ooxml/types.js +0 -9
- package/dist/ooxml/types.js.map +0 -1
- package/dist/ooxml/writer.d.ts +0 -71
- package/dist/ooxml/writer.d.ts.map +0 -1
- package/dist/ooxml/writer.js +0 -200
- package/dist/ooxml/writer.js.map +0 -1
- package/dist/ooxml/xmlUtils.d.ts +0 -76
- package/dist/ooxml/xmlUtils.d.ts.map +0 -1
- package/dist/ooxml/xmlUtils.js +0 -108
- package/dist/ooxml/xmlUtils.js.map +0 -1
- package/dist/pdf/export.d.ts +0 -56
- package/dist/pdf/export.d.ts.map +0 -1
- package/dist/pdf/export.js +0 -768
- package/dist/pdf/export.js.map +0 -1
- package/dist/pdf/import.d.ts +0 -94
- package/dist/pdf/import.d.ts.map +0 -1
- package/dist/pdf/import.js +0 -796
- package/dist/pdf/import.js.map +0 -1
- package/dist/pdf/index.d.ts.map +0 -1
- package/dist/pdf/styles.d.ts +0 -142
- package/dist/pdf/styles.d.ts.map +0 -1
- package/dist/pdf/styles.js +0 -145
- package/dist/pdf/styles.js.map +0 -1
- package/dist/pptx/export.d.ts +0 -75
- package/dist/pptx/export.d.ts.map +0 -1
- package/dist/pptx/export.js +0 -722
- package/dist/pptx/export.js.map +0 -1
- package/dist/pptx/index.d.ts.map +0 -1
- package/dist/pptx/styles.d.ts +0 -54
- package/dist/pptx/styles.d.ts.map +0 -1
- package/dist/pptx/styles.js +0 -73
- package/dist/pptx/styles.js.map +0 -1
- package/dist/pptx/templates.d.ts +0 -24
- package/dist/pptx/templates.d.ts.map +0 -1
- package/dist/pptx/templates.js +0 -158
- package/dist/pptx/templates.js.map +0 -1
- package/dist/xlsx/index.d.ts.map +0 -1
package/dist/ooxml/index.d.ts
CHANGED
|
@@ -1,22 +1,361 @@
|
|
|
1
|
+
import JSZip from 'jszip';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
|
-
*
|
|
4
|
+
* OOXML Types
|
|
3
5
|
*
|
|
4
|
-
* Shared
|
|
5
|
-
*
|
|
6
|
-
*
|
|
6
|
+
* Shared type definitions for all Office Open XML formats (DOCX, PPTX, XLSX).
|
|
7
|
+
* These model the common structural elements of the OOXML package format:
|
|
8
|
+
* ZIP archive, relationships, content types, and core properties.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* An opened OOXML package — wraps the JSZip archive plus parsed
|
|
13
|
+
* structural metadata (content types, root relationships).
|
|
14
|
+
*/
|
|
15
|
+
interface OoxmlPackage {
|
|
16
|
+
/** The underlying JSZip archive */
|
|
17
|
+
zip: JSZip;
|
|
18
|
+
/** Parsed [Content_Types].xml entries */
|
|
19
|
+
contentTypes: ContentTypeMap;
|
|
20
|
+
/** Root-level relationships (_rels/.rels) */
|
|
21
|
+
rootRelationships: Relationship[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Content type map built from [Content_Types].xml.
|
|
25
|
+
* Maps part paths → content type strings plus extension defaults.
|
|
26
|
+
*/
|
|
27
|
+
interface ContentTypeMap {
|
|
28
|
+
/** Explicit overrides: partName → contentType */
|
|
29
|
+
overrides: Map<string, string>;
|
|
30
|
+
/** Default extensions: extension → contentType */
|
|
31
|
+
defaults: Map<string, string>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* An OOXML relationship entry (from any _rels/*.rels file).
|
|
35
|
+
*/
|
|
36
|
+
interface Relationship {
|
|
37
|
+
/** Relationship ID (e.g., "rId1") */
|
|
38
|
+
id: string;
|
|
39
|
+
/** Relationship type URI (e.g., "http://...officedocument/...") */
|
|
40
|
+
type: string;
|
|
41
|
+
/** Target path or URL */
|
|
42
|
+
target: string;
|
|
43
|
+
/** "Internal" (default) or "External" for hyperlinks */
|
|
44
|
+
targetMode?: 'Internal' | 'External';
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Document core properties from docProps/core.xml (Dublin Core metadata).
|
|
48
|
+
*/
|
|
49
|
+
interface CoreProperties {
|
|
50
|
+
title?: string;
|
|
51
|
+
subject?: string;
|
|
52
|
+
creator?: string;
|
|
53
|
+
keywords?: string;
|
|
54
|
+
description?: string;
|
|
55
|
+
lastModifiedBy?: string;
|
|
56
|
+
revision?: string;
|
|
57
|
+
created?: string;
|
|
58
|
+
modified?: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* A part (file) that will be written into an OOXML package.
|
|
62
|
+
*/
|
|
63
|
+
interface PackagePart {
|
|
64
|
+
/** Path within the ZIP (e.g., "word/document.xml") */
|
|
65
|
+
path: string;
|
|
66
|
+
/** XML or text content (mutually exclusive with binaryContent) */
|
|
67
|
+
content?: string;
|
|
68
|
+
/** Binary content (mutually exclusive with content) */
|
|
69
|
+
binaryContent?: ArrayBuffer | Uint8Array;
|
|
70
|
+
/** MIME content type for [Content_Types].xml */
|
|
71
|
+
contentType: string;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* A relationship to be written into a _rels/*.rels file.
|
|
75
|
+
* `sourcePart` identifies which part the relationship belongs to.
|
|
76
|
+
* Use "" (empty string) for root-level relationships (_rels/.rels).
|
|
77
|
+
*/
|
|
78
|
+
interface PendingRelationship {
|
|
79
|
+
/** The part this relationship belongs to ("" for root) */
|
|
80
|
+
sourcePart: string;
|
|
81
|
+
/** The relationship entry */
|
|
82
|
+
relationship: Relationship;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* OOXML Package Reader
|
|
87
|
+
*
|
|
88
|
+
* Opens OOXML archives (.docx, .pptx, .xlsx) and parses their
|
|
89
|
+
* structural metadata: [Content_Types].xml, relationships, and
|
|
90
|
+
* core properties.
|
|
91
|
+
*
|
|
92
|
+
* Uses JSZip to unzip and the browser's DOMParser to parse XML.
|
|
93
|
+
*/
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Open an OOXML package from raw data.
|
|
97
|
+
*
|
|
98
|
+
* Parses the ZIP archive, [Content_Types].xml, and root relationships.
|
|
99
|
+
*
|
|
100
|
+
* @param data - The raw .docx/.pptx/.xlsx file as ArrayBuffer or Blob
|
|
101
|
+
* @returns A parsed OoxmlPackage
|
|
102
|
+
*/
|
|
103
|
+
declare function openPackage(data: ArrayBuffer | Blob): Promise<OoxmlPackage>;
|
|
104
|
+
/**
|
|
105
|
+
* Parse relationships for a specific part.
|
|
106
|
+
*
|
|
107
|
+
* @param pkg - The OOXML package (or the zip directly)
|
|
108
|
+
* @param partPath - The part path (e.g., "word/document.xml").
|
|
109
|
+
* Use "" for root-level relationships (_rels/.rels).
|
|
110
|
+
* @returns Array of relationship entries
|
|
111
|
+
*/
|
|
112
|
+
declare function getPartRelationships(pkg: OoxmlPackage, partPath: string): Promise<Relationship[]>;
|
|
113
|
+
/**
|
|
114
|
+
* Extract an XML part from the package and parse it as a DOM Document.
|
|
115
|
+
*
|
|
116
|
+
* @param pkg - The OOXML package
|
|
117
|
+
* @param partPath - Path within the archive (e.g., "word/document.xml")
|
|
118
|
+
* @returns Parsed XML Document, or null if the part doesn't exist
|
|
119
|
+
*/
|
|
120
|
+
declare function getPartXml(pkg: OoxmlPackage, partPath: string): Promise<Document | null>;
|
|
121
|
+
/**
|
|
122
|
+
* Extract a binary part from the package (e.g., an image from word/media/).
|
|
123
|
+
*
|
|
124
|
+
* @param pkg - The OOXML package
|
|
125
|
+
* @param partPath - Path within the archive
|
|
126
|
+
* @returns The binary content, or null if the part doesn't exist
|
|
127
|
+
*/
|
|
128
|
+
declare function getPartBinary(pkg: OoxmlPackage, partPath: string): Promise<ArrayBuffer | null>;
|
|
129
|
+
/**
|
|
130
|
+
* Parse core document properties from docProps/core.xml.
|
|
131
|
+
*
|
|
132
|
+
* @param pkg - The OOXML package
|
|
133
|
+
* @returns Parsed core properties (all fields optional)
|
|
134
|
+
*/
|
|
135
|
+
declare function getCoreProperties(pkg: OoxmlPackage): Promise<CoreProperties>;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* OOXML Package Writer
|
|
139
|
+
*
|
|
140
|
+
* Builds OOXML archives (.docx, .pptx, .xlsx) from parts.
|
|
141
|
+
* Handles automatic generation of [Content_Types].xml and
|
|
142
|
+
* _rels/*.rels files from the registered parts and relationships.
|
|
143
|
+
*/
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Mutable builder for constructing an OOXML package.
|
|
147
|
+
*
|
|
148
|
+
* Add parts, relationships, and core properties, then call `toBlob()`
|
|
149
|
+
* or `toArrayBuffer()` to produce the final ZIP archive.
|
|
7
150
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
151
|
+
* @example
|
|
152
|
+
* ```ts
|
|
153
|
+
* const builder = createPackage();
|
|
154
|
+
* builder.addPart('word/document.xml', documentXml, CONTENT_TYPE_DOCX_DOCUMENT);
|
|
155
|
+
* builder.addRelationship('', {
|
|
156
|
+
* id: 'rId1',
|
|
157
|
+
* type: REL_OFFICE_DOCUMENT,
|
|
158
|
+
* target: 'word/document.xml',
|
|
159
|
+
* });
|
|
160
|
+
* const blob = await builder.toBlob();
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
interface OoxmlPackageBuilder {
|
|
164
|
+
/**
|
|
165
|
+
* Add an XML or text part to the package.
|
|
166
|
+
*
|
|
167
|
+
* @param path - Path within the archive (e.g., "word/document.xml")
|
|
168
|
+
* @param content - XML string content
|
|
169
|
+
* @param contentType - MIME content type for [Content_Types].xml
|
|
170
|
+
*/
|
|
171
|
+
addPart(path: string, content: string, contentType: string): void;
|
|
172
|
+
/**
|
|
173
|
+
* Add a binary part to the package (e.g., an image).
|
|
174
|
+
*
|
|
175
|
+
* @param path - Path within the archive (e.g., "word/media/image1.png")
|
|
176
|
+
* @param data - Binary content
|
|
177
|
+
* @param contentType - MIME content type (e.g., "image/png")
|
|
178
|
+
*/
|
|
179
|
+
addBinaryPart(path: string, data: ArrayBuffer | Uint8Array, contentType: string): void;
|
|
180
|
+
/**
|
|
181
|
+
* Register a relationship.
|
|
182
|
+
*
|
|
183
|
+
* @param sourcePart - The part this relationship belongs to (e.g., "word/document.xml").
|
|
184
|
+
* Use "" (empty string) for root-level relationships (_rels/.rels).
|
|
185
|
+
* @param rel - The relationship entry
|
|
186
|
+
*/
|
|
187
|
+
addRelationship(sourcePart: string, rel: Relationship): void;
|
|
188
|
+
/**
|
|
189
|
+
* Set core document properties (docProps/core.xml).
|
|
190
|
+
* Calling this multiple times overwrites previous values.
|
|
191
|
+
*/
|
|
192
|
+
setCoreProperties(props: CoreProperties): void;
|
|
193
|
+
/**
|
|
194
|
+
* Assemble the final OOXML package as a Blob.
|
|
195
|
+
* Generates [Content_Types].xml and all _rels/*.rels files automatically.
|
|
196
|
+
*/
|
|
197
|
+
toBlob(): Promise<Blob>;
|
|
198
|
+
/**
|
|
199
|
+
* Assemble the final OOXML package as an ArrayBuffer.
|
|
200
|
+
*/
|
|
201
|
+
toArrayBuffer(): Promise<ArrayBuffer>;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Create a new OOXML package builder.
|
|
205
|
+
*/
|
|
206
|
+
declare function createPackage(): OoxmlPackageBuilder;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* XML Utility Functions
|
|
210
|
+
*
|
|
211
|
+
* Lightweight helpers for generating well-formed XML strings.
|
|
212
|
+
* Used by all OOXML writers (DOCX, PPTX, XLSX) to construct
|
|
213
|
+
* part content without a heavy DOM library.
|
|
214
|
+
*/
|
|
215
|
+
/**
|
|
216
|
+
* XML declaration for the start of every OOXML part.
|
|
217
|
+
*/
|
|
218
|
+
declare function xmlDeclaration(): string;
|
|
219
|
+
/**
|
|
220
|
+
* Escape a string for safe inclusion in XML text content or attribute values.
|
|
221
|
+
*
|
|
222
|
+
* Handles the five predefined XML entities:
|
|
223
|
+
* - & → &
|
|
224
|
+
* - < → <
|
|
225
|
+
* - > → >
|
|
226
|
+
* - " → "
|
|
227
|
+
* - ' → '
|
|
228
|
+
*/
|
|
229
|
+
declare function escapeXml(text: string): string;
|
|
230
|
+
/**
|
|
231
|
+
* Build an XML attribute string from a key-value record.
|
|
232
|
+
* Only includes entries where the value is defined and non-empty.
|
|
233
|
+
*
|
|
234
|
+
* @example
|
|
235
|
+
* ```ts
|
|
236
|
+
* attrString({ 'w:val': 'Heading1', 'w:eastAsia': undefined })
|
|
237
|
+
* // ' w:val="Heading1"'
|
|
238
|
+
* ```
|
|
239
|
+
*/
|
|
240
|
+
declare function attrString(attrs?: Record<string, string | undefined>): string;
|
|
241
|
+
/**
|
|
242
|
+
* Build a self-closing XML element: `<tag attr="val"/>`.
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* ```ts
|
|
246
|
+
* selfClosingElement('w:b')
|
|
247
|
+
* // '<w:b/>'
|
|
248
|
+
*
|
|
249
|
+
* selfClosingElement('w:pStyle', { 'w:val': 'Heading1' })
|
|
250
|
+
* // '<w:pStyle w:val="Heading1"/>'
|
|
251
|
+
* ```
|
|
252
|
+
*/
|
|
253
|
+
declare function selfClosingElement(tag: string, attrs?: Record<string, string | undefined>): string;
|
|
254
|
+
/**
|
|
255
|
+
* Build an XML element with children: `<tag attr="val">...children...</tag>`.
|
|
256
|
+
* Children are concatenated directly (no extra whitespace).
|
|
10
257
|
*
|
|
11
258
|
* @example
|
|
12
259
|
* ```ts
|
|
13
|
-
*
|
|
260
|
+
* xmlElement('w:p', {},
|
|
261
|
+
* xmlElement('w:r', {},
|
|
262
|
+
* xmlElement('w:t', {}, 'Hello')
|
|
263
|
+
* )
|
|
264
|
+
* )
|
|
265
|
+
* // '<w:p><w:r><w:t>Hello</w:t></w:r></w:p>'
|
|
14
266
|
* ```
|
|
15
267
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
268
|
+
declare function xmlElement(tag: string, attrs?: Record<string, string | undefined>, ...children: string[]): string;
|
|
269
|
+
/**
|
|
270
|
+
* Build an XML text element: `<tag attr="val">escaped text</tag>`.
|
|
271
|
+
* The text value is XML-escaped automatically.
|
|
272
|
+
*
|
|
273
|
+
* This is a convenience for the common pattern of wrapping text in an element,
|
|
274
|
+
* where you want automatic escaping (unlike `xmlElement` which takes raw children).
|
|
275
|
+
*
|
|
276
|
+
* @example
|
|
277
|
+
* ```ts
|
|
278
|
+
* textElement('w:t', { 'xml:space': 'preserve' }, 'Hello & world')
|
|
279
|
+
* // '<w:t xml:space="preserve">Hello & world</w:t>'
|
|
280
|
+
* ```
|
|
281
|
+
*/
|
|
282
|
+
declare function textElement(tag: string, attrs?: Record<string, string | undefined>, text?: string): string;
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* OOXML Namespace Constants
|
|
286
|
+
*
|
|
287
|
+
* All Office Open XML namespace URIs used across DOCX, PPTX, and XLSX.
|
|
288
|
+
* Organized by category for easy reference.
|
|
289
|
+
*/
|
|
290
|
+
/** Relationships namespace (used in _rels/*.rels files) */
|
|
291
|
+
declare const NS_RELATIONSHIPS = "http://schemas.openxmlformats.org/package/2006/relationships";
|
|
292
|
+
/** Content Types namespace ([Content_Types].xml) */
|
|
293
|
+
declare const NS_CONTENT_TYPES = "http://schemas.openxmlformats.org/package/2006/content-types";
|
|
294
|
+
/** Relationship type: Office document (main part) */
|
|
295
|
+
declare const REL_OFFICE_DOCUMENT = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument";
|
|
296
|
+
/** Relationship type: Core properties */
|
|
297
|
+
declare const REL_CORE_PROPERTIES = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";
|
|
298
|
+
/** Relationship type: Extended properties (app.xml) */
|
|
299
|
+
declare const REL_EXTENDED_PROPERTIES = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties";
|
|
300
|
+
/** Relationship type: Styles */
|
|
301
|
+
declare const REL_STYLES = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles";
|
|
302
|
+
/** Relationship type: Numbering */
|
|
303
|
+
declare const REL_NUMBERING = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering";
|
|
304
|
+
/** Relationship type: Font table */
|
|
305
|
+
declare const REL_FONT_TABLE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable";
|
|
306
|
+
/** Relationship type: Settings */
|
|
307
|
+
declare const REL_SETTINGS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings";
|
|
308
|
+
/** Relationship type: Hyperlink */
|
|
309
|
+
declare const REL_HYPERLINK = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink";
|
|
310
|
+
/** Relationship type: Image */
|
|
311
|
+
declare const REL_IMAGE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image";
|
|
312
|
+
/** Relationship type: Footnotes */
|
|
313
|
+
declare const REL_FOOTNOTES = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes";
|
|
314
|
+
/** Relationship type: Theme */
|
|
315
|
+
declare const REL_THEME = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme";
|
|
316
|
+
/** WordprocessingML main namespace (w:) */
|
|
317
|
+
declare const NS_WML = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
|
|
318
|
+
/** PresentationML main namespace (p:) */
|
|
319
|
+
declare const NS_PML = "http://schemas.openxmlformats.org/presentationml/2006/main";
|
|
320
|
+
/** SpreadsheetML main namespace */
|
|
321
|
+
declare const NS_SML = "http://schemas.openxmlformats.org/spreadsheetml/2006/main";
|
|
322
|
+
/** DrawingML main namespace (a:) */
|
|
323
|
+
declare const NS_DRAWINGML = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
324
|
+
/** DrawingML WordprocessingML drawing namespace (wp:) */
|
|
325
|
+
declare const NS_WP_DRAWING = "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing";
|
|
326
|
+
/** DrawingML picture namespace (pic:) */
|
|
327
|
+
declare const NS_PICTURE = "http://schemas.openxmlformats.org/drawingml/2006/picture";
|
|
328
|
+
/** Dublin Core elements namespace */
|
|
329
|
+
declare const NS_DC = "http://purl.org/dc/elements/1.1/";
|
|
330
|
+
/** Dublin Core terms namespace */
|
|
331
|
+
declare const NS_DCTERMS = "http://purl.org/dc/terms/";
|
|
332
|
+
/** Core properties namespace */
|
|
333
|
+
declare const NS_CORE_PROPERTIES = "http://schemas.openxmlformats.org/package/2006/metadata/core-properties";
|
|
334
|
+
/** XML Schema Instance namespace */
|
|
335
|
+
declare const NS_XSI = "http://www.w3.org/2001/XMLSchema-instance";
|
|
336
|
+
/** Markup Compatibility namespace (mc:) */
|
|
337
|
+
declare const NS_MC = "http://schemas.openxmlformats.org/markup-compatibility/2006";
|
|
338
|
+
/** Office relationships namespace (r:) */
|
|
339
|
+
declare const NS_R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
340
|
+
declare const CONTENT_TYPE_RELATIONSHIPS = "application/vnd.openxmlformats-package.relationships+xml";
|
|
341
|
+
declare const CONTENT_TYPE_CORE_PROPERTIES = "application/vnd.openxmlformats-package.core-properties+xml";
|
|
342
|
+
declare const CONTENT_TYPE_DOCX_DOCUMENT = "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml";
|
|
343
|
+
declare const CONTENT_TYPE_DOCX_STYLES = "application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml";
|
|
344
|
+
declare const CONTENT_TYPE_DOCX_NUMBERING = "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml";
|
|
345
|
+
declare const CONTENT_TYPE_DOCX_SETTINGS = "application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml";
|
|
346
|
+
declare const CONTENT_TYPE_DOCX_FONT_TABLE = "application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml";
|
|
347
|
+
declare const CONTENT_TYPE_DOCX_FOOTNOTES = "application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml";
|
|
348
|
+
declare const CONTENT_TYPE_PPTX_PRESENTATION = "application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml";
|
|
349
|
+
declare const CONTENT_TYPE_PPTX_SLIDE = "application/vnd.openxmlformats-officedocument.presentationml.slide+xml";
|
|
350
|
+
declare const CONTENT_TYPE_PPTX_SLIDE_LAYOUT = "application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml";
|
|
351
|
+
declare const CONTENT_TYPE_PPTX_SLIDE_MASTER = "application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml";
|
|
352
|
+
declare const CONTENT_TYPE_PPTX_THEME = "application/vnd.openxmlformats-officedocument.theme+xml";
|
|
353
|
+
/** Relationship type: Slide */
|
|
354
|
+
declare const REL_SLIDE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide";
|
|
355
|
+
/** Relationship type: Slide layout */
|
|
356
|
+
declare const REL_SLIDE_LAYOUT = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout";
|
|
357
|
+
/** Relationship type: Slide master */
|
|
358
|
+
declare const REL_SLIDE_MASTER = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster";
|
|
359
|
+
declare const CONTENT_TYPE_XLSX_WORKBOOK = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml";
|
|
360
|
+
|
|
361
|
+
export { CONTENT_TYPE_CORE_PROPERTIES, CONTENT_TYPE_DOCX_DOCUMENT, CONTENT_TYPE_DOCX_FONT_TABLE, CONTENT_TYPE_DOCX_FOOTNOTES, CONTENT_TYPE_DOCX_NUMBERING, CONTENT_TYPE_DOCX_SETTINGS, CONTENT_TYPE_DOCX_STYLES, CONTENT_TYPE_PPTX_PRESENTATION, CONTENT_TYPE_PPTX_SLIDE, CONTENT_TYPE_PPTX_SLIDE_LAYOUT, CONTENT_TYPE_PPTX_SLIDE_MASTER, CONTENT_TYPE_PPTX_THEME, CONTENT_TYPE_RELATIONSHIPS, CONTENT_TYPE_XLSX_WORKBOOK, type ContentTypeMap, type CoreProperties, NS_CONTENT_TYPES, NS_CORE_PROPERTIES, NS_DC, NS_DCTERMS, NS_DRAWINGML, NS_MC, NS_PICTURE, NS_PML, NS_R, NS_RELATIONSHIPS, NS_SML, NS_WML, NS_WP_DRAWING, NS_XSI, type OoxmlPackage, type OoxmlPackageBuilder, type PackagePart, type PendingRelationship, REL_CORE_PROPERTIES, REL_EXTENDED_PROPERTIES, REL_FONT_TABLE, REL_FOOTNOTES, REL_HYPERLINK, REL_IMAGE, REL_NUMBERING, REL_OFFICE_DOCUMENT, REL_SETTINGS, REL_SLIDE, REL_SLIDE_LAYOUT, REL_SLIDE_MASTER, REL_STYLES, REL_THEME, type Relationship, attrString, createPackage, escapeXml, getCoreProperties, getPartBinary, getPartRelationships, getPartXml, openPackage, selfClosingElement, textElement, xmlDeclaration, xmlElement };
|
package/dist/ooxml/index.js
CHANGED
|
@@ -1,23 +1,117 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
import {
|
|
2
|
+
getCoreProperties,
|
|
3
|
+
getPartBinary,
|
|
4
|
+
getPartRelationships,
|
|
5
|
+
getPartXml,
|
|
6
|
+
openPackage
|
|
7
|
+
} from "../chunk-YN5HFCEW.js";
|
|
8
|
+
import {
|
|
9
|
+
CONTENT_TYPE_CORE_PROPERTIES,
|
|
10
|
+
CONTENT_TYPE_DOCX_DOCUMENT,
|
|
11
|
+
CONTENT_TYPE_DOCX_FONT_TABLE,
|
|
12
|
+
CONTENT_TYPE_DOCX_FOOTNOTES,
|
|
13
|
+
CONTENT_TYPE_DOCX_NUMBERING,
|
|
14
|
+
CONTENT_TYPE_DOCX_SETTINGS,
|
|
15
|
+
CONTENT_TYPE_DOCX_STYLES,
|
|
16
|
+
CONTENT_TYPE_PPTX_PRESENTATION,
|
|
17
|
+
CONTENT_TYPE_PPTX_SLIDE,
|
|
18
|
+
CONTENT_TYPE_PPTX_SLIDE_LAYOUT,
|
|
19
|
+
CONTENT_TYPE_PPTX_SLIDE_MASTER,
|
|
20
|
+
CONTENT_TYPE_PPTX_THEME,
|
|
21
|
+
CONTENT_TYPE_RELATIONSHIPS,
|
|
22
|
+
CONTENT_TYPE_XLSX_WORKBOOK,
|
|
23
|
+
NS_CONTENT_TYPES,
|
|
24
|
+
NS_CORE_PROPERTIES,
|
|
25
|
+
NS_DC,
|
|
26
|
+
NS_DCTERMS,
|
|
27
|
+
NS_DRAWINGML,
|
|
28
|
+
NS_MC,
|
|
29
|
+
NS_PICTURE,
|
|
30
|
+
NS_PML,
|
|
31
|
+
NS_R,
|
|
32
|
+
NS_RELATIONSHIPS,
|
|
33
|
+
NS_SML,
|
|
34
|
+
NS_WML,
|
|
35
|
+
NS_WP_DRAWING,
|
|
36
|
+
NS_XSI,
|
|
37
|
+
REL_CORE_PROPERTIES,
|
|
38
|
+
REL_EXTENDED_PROPERTIES,
|
|
39
|
+
REL_FONT_TABLE,
|
|
40
|
+
REL_FOOTNOTES,
|
|
41
|
+
REL_HYPERLINK,
|
|
42
|
+
REL_IMAGE,
|
|
43
|
+
REL_NUMBERING,
|
|
44
|
+
REL_OFFICE_DOCUMENT,
|
|
45
|
+
REL_SETTINGS,
|
|
46
|
+
REL_SLIDE,
|
|
47
|
+
REL_SLIDE_LAYOUT,
|
|
48
|
+
REL_SLIDE_MASTER,
|
|
49
|
+
REL_STYLES,
|
|
50
|
+
REL_THEME,
|
|
51
|
+
createPackage
|
|
52
|
+
} from "../chunk-7DEUGIOO.js";
|
|
53
|
+
import {
|
|
54
|
+
attrString,
|
|
55
|
+
escapeXml,
|
|
56
|
+
selfClosingElement,
|
|
57
|
+
textElement,
|
|
58
|
+
xmlDeclaration,
|
|
59
|
+
xmlElement
|
|
60
|
+
} from "../chunk-U4MRIFKL.js";
|
|
61
|
+
export {
|
|
62
|
+
CONTENT_TYPE_CORE_PROPERTIES,
|
|
63
|
+
CONTENT_TYPE_DOCX_DOCUMENT,
|
|
64
|
+
CONTENT_TYPE_DOCX_FONT_TABLE,
|
|
65
|
+
CONTENT_TYPE_DOCX_FOOTNOTES,
|
|
66
|
+
CONTENT_TYPE_DOCX_NUMBERING,
|
|
67
|
+
CONTENT_TYPE_DOCX_SETTINGS,
|
|
68
|
+
CONTENT_TYPE_DOCX_STYLES,
|
|
69
|
+
CONTENT_TYPE_PPTX_PRESENTATION,
|
|
70
|
+
CONTENT_TYPE_PPTX_SLIDE,
|
|
71
|
+
CONTENT_TYPE_PPTX_SLIDE_LAYOUT,
|
|
72
|
+
CONTENT_TYPE_PPTX_SLIDE_MASTER,
|
|
73
|
+
CONTENT_TYPE_PPTX_THEME,
|
|
74
|
+
CONTENT_TYPE_RELATIONSHIPS,
|
|
75
|
+
CONTENT_TYPE_XLSX_WORKBOOK,
|
|
76
|
+
NS_CONTENT_TYPES,
|
|
77
|
+
NS_CORE_PROPERTIES,
|
|
78
|
+
NS_DC,
|
|
79
|
+
NS_DCTERMS,
|
|
80
|
+
NS_DRAWINGML,
|
|
81
|
+
NS_MC,
|
|
82
|
+
NS_PICTURE,
|
|
83
|
+
NS_PML,
|
|
84
|
+
NS_R,
|
|
85
|
+
NS_RELATIONSHIPS,
|
|
86
|
+
NS_SML,
|
|
87
|
+
NS_WML,
|
|
88
|
+
NS_WP_DRAWING,
|
|
89
|
+
NS_XSI,
|
|
90
|
+
REL_CORE_PROPERTIES,
|
|
91
|
+
REL_EXTENDED_PROPERTIES,
|
|
92
|
+
REL_FONT_TABLE,
|
|
93
|
+
REL_FOOTNOTES,
|
|
94
|
+
REL_HYPERLINK,
|
|
95
|
+
REL_IMAGE,
|
|
96
|
+
REL_NUMBERING,
|
|
97
|
+
REL_OFFICE_DOCUMENT,
|
|
98
|
+
REL_SETTINGS,
|
|
99
|
+
REL_SLIDE,
|
|
100
|
+
REL_SLIDE_LAYOUT,
|
|
101
|
+
REL_SLIDE_MASTER,
|
|
102
|
+
REL_STYLES,
|
|
103
|
+
REL_THEME,
|
|
104
|
+
attrString,
|
|
105
|
+
createPackage,
|
|
106
|
+
escapeXml,
|
|
107
|
+
getCoreProperties,
|
|
108
|
+
getPartBinary,
|
|
109
|
+
getPartRelationships,
|
|
110
|
+
getPartXml,
|
|
111
|
+
openPackage,
|
|
112
|
+
selfClosingElement,
|
|
113
|
+
textElement,
|
|
114
|
+
xmlDeclaration,
|
|
115
|
+
xmlElement
|
|
116
|
+
};
|
|
23
117
|
//# sourceMappingURL=index.js.map
|
package/dist/ooxml/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|