@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/writer.js
DELETED
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OOXML Package Writer
|
|
3
|
-
*
|
|
4
|
-
* Builds OOXML archives (.docx, .pptx, .xlsx) from parts.
|
|
5
|
-
* Handles automatic generation of [Content_Types].xml and
|
|
6
|
-
* _rels/*.rels files from the registered parts and relationships.
|
|
7
|
-
*/
|
|
8
|
-
import JSZip from 'jszip';
|
|
9
|
-
import { NS_CONTENT_TYPES, NS_RELATIONSHIPS, NS_CORE_PROPERTIES, NS_DC, NS_DCTERMS, NS_XSI, CONTENT_TYPE_RELATIONSHIPS, CONTENT_TYPE_CORE_PROPERTIES, REL_CORE_PROPERTIES, } from './namespaces.js';
|
|
10
|
-
import { xmlDeclaration, escapeXml } from './xmlUtils.js';
|
|
11
|
-
/**
|
|
12
|
-
* Create a new OOXML package builder.
|
|
13
|
-
*/
|
|
14
|
-
export function createPackage() {
|
|
15
|
-
const parts = [];
|
|
16
|
-
const relationships = [];
|
|
17
|
-
let coreProps;
|
|
18
|
-
return {
|
|
19
|
-
addPart(path, content, contentType) {
|
|
20
|
-
parts.push({ path, content, contentType });
|
|
21
|
-
},
|
|
22
|
-
addBinaryPart(path, data, contentType) {
|
|
23
|
-
parts.push({ path, binaryContent: data, contentType });
|
|
24
|
-
},
|
|
25
|
-
addRelationship(sourcePart, rel) {
|
|
26
|
-
relationships.push({ sourcePart, relationship: rel });
|
|
27
|
-
},
|
|
28
|
-
setCoreProperties(props) {
|
|
29
|
-
coreProps = props;
|
|
30
|
-
},
|
|
31
|
-
async toBlob() {
|
|
32
|
-
const zip = assemble(parts, relationships, coreProps);
|
|
33
|
-
return zip.generateAsync({ type: 'blob' });
|
|
34
|
-
},
|
|
35
|
-
async toArrayBuffer() {
|
|
36
|
-
const zip = assemble(parts, relationships, coreProps);
|
|
37
|
-
return zip.generateAsync({ type: 'arraybuffer' });
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
// ============================================
|
|
42
|
-
// Assembly
|
|
43
|
-
// ============================================
|
|
44
|
-
/**
|
|
45
|
-
* Assemble a JSZip archive from parts, relationships, and core properties.
|
|
46
|
-
*/
|
|
47
|
-
function assemble(parts, relationships, coreProps) {
|
|
48
|
-
const zip = new JSZip();
|
|
49
|
-
// Write content parts
|
|
50
|
-
for (const part of parts) {
|
|
51
|
-
if (part.content !== undefined) {
|
|
52
|
-
zip.file(part.path, part.content);
|
|
53
|
-
}
|
|
54
|
-
else if (part.binaryContent !== undefined) {
|
|
55
|
-
zip.file(part.path, part.binaryContent);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
// Add core properties if set
|
|
59
|
-
if (coreProps) {
|
|
60
|
-
const coreXml = buildCorePropertiesXml(coreProps);
|
|
61
|
-
zip.file('docProps/core.xml', coreXml);
|
|
62
|
-
// Add relationship to core properties
|
|
63
|
-
relationships.push({
|
|
64
|
-
sourcePart: '',
|
|
65
|
-
relationship: {
|
|
66
|
-
id: `rId${relationships.length + 100}`,
|
|
67
|
-
type: REL_CORE_PROPERTIES,
|
|
68
|
-
target: 'docProps/core.xml',
|
|
69
|
-
},
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
// Build and write [Content_Types].xml
|
|
73
|
-
zip.file('[Content_Types].xml', buildContentTypesXml(parts, coreProps));
|
|
74
|
-
// Build and write _rels/*.rels files
|
|
75
|
-
const relsBySource = groupRelationshipsBySource(relationships);
|
|
76
|
-
for (const [sourcePart, rels] of relsBySource) {
|
|
77
|
-
const relsPath = sourcePart === '' ? '_rels/.rels' : buildRelsPath(sourcePart);
|
|
78
|
-
zip.file(relsPath, buildRelationshipsXml(rels));
|
|
79
|
-
}
|
|
80
|
-
return zip;
|
|
81
|
-
}
|
|
82
|
-
// ============================================
|
|
83
|
-
// [Content_Types].xml
|
|
84
|
-
// ============================================
|
|
85
|
-
function buildContentTypesXml(parts, coreProps) {
|
|
86
|
-
const lines = [xmlDeclaration()];
|
|
87
|
-
lines.push(`<Types xmlns="${NS_CONTENT_TYPES}">`);
|
|
88
|
-
// Default extension types
|
|
89
|
-
const extensionTypes = new Map();
|
|
90
|
-
extensionTypes.set('rels', CONTENT_TYPE_RELATIONSHIPS);
|
|
91
|
-
extensionTypes.set('xml', 'application/xml');
|
|
92
|
-
// Collect extensions from binary parts (e.g., png, jpeg)
|
|
93
|
-
for (const part of parts) {
|
|
94
|
-
if (part.binaryContent !== undefined) {
|
|
95
|
-
const ext = getExtension(part.path);
|
|
96
|
-
if (ext && !extensionTypes.has(ext)) {
|
|
97
|
-
extensionTypes.set(ext, part.contentType);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
for (const [ext, ct] of extensionTypes) {
|
|
102
|
-
lines.push(` <Default Extension="${escapeXml(ext)}" ContentType="${escapeXml(ct)}"/>`);
|
|
103
|
-
}
|
|
104
|
-
// Override entries for each XML part
|
|
105
|
-
for (const part of parts) {
|
|
106
|
-
if (part.content !== undefined) {
|
|
107
|
-
lines.push(` <Override PartName="/${escapeXml(part.path)}" ContentType="${escapeXml(part.contentType)}"/>`);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
// Core properties override
|
|
111
|
-
if (coreProps) {
|
|
112
|
-
lines.push(` <Override PartName="/docProps/core.xml" ContentType="${CONTENT_TYPE_CORE_PROPERTIES}"/>`);
|
|
113
|
-
}
|
|
114
|
-
lines.push('</Types>');
|
|
115
|
-
return lines.join('\n');
|
|
116
|
-
}
|
|
117
|
-
// ============================================
|
|
118
|
-
// Relationships XML
|
|
119
|
-
// ============================================
|
|
120
|
-
function buildRelationshipsXml(rels) {
|
|
121
|
-
const lines = [xmlDeclaration()];
|
|
122
|
-
lines.push(`<Relationships xmlns="${NS_RELATIONSHIPS}">`);
|
|
123
|
-
for (const rel of rels) {
|
|
124
|
-
const attrs = [
|
|
125
|
-
`Id="${escapeXml(rel.id)}"`,
|
|
126
|
-
`Type="${escapeXml(rel.type)}"`,
|
|
127
|
-
`Target="${escapeXml(rel.target)}"`,
|
|
128
|
-
];
|
|
129
|
-
if (rel.targetMode) {
|
|
130
|
-
attrs.push(`TargetMode="${escapeXml(rel.targetMode)}"`);
|
|
131
|
-
}
|
|
132
|
-
lines.push(` <Relationship ${attrs.join(' ')}/>`);
|
|
133
|
-
}
|
|
134
|
-
lines.push('</Relationships>');
|
|
135
|
-
return lines.join('\n');
|
|
136
|
-
}
|
|
137
|
-
// ============================================
|
|
138
|
-
// Core Properties XML
|
|
139
|
-
// ============================================
|
|
140
|
-
function buildCorePropertiesXml(props) {
|
|
141
|
-
const lines = [xmlDeclaration()];
|
|
142
|
-
lines.push(`<cp:coreProperties` +
|
|
143
|
-
` xmlns:cp="${NS_CORE_PROPERTIES}"` +
|
|
144
|
-
` xmlns:dc="${NS_DC}"` +
|
|
145
|
-
` xmlns:dcterms="${NS_DCTERMS}"` +
|
|
146
|
-
` xmlns:xsi="${NS_XSI}">`);
|
|
147
|
-
if (props.title)
|
|
148
|
-
lines.push(` <dc:title>${escapeXml(props.title)}</dc:title>`);
|
|
149
|
-
if (props.subject)
|
|
150
|
-
lines.push(` <dc:subject>${escapeXml(props.subject)}</dc:subject>`);
|
|
151
|
-
if (props.creator)
|
|
152
|
-
lines.push(` <dc:creator>${escapeXml(props.creator)}</dc:creator>`);
|
|
153
|
-
if (props.description)
|
|
154
|
-
lines.push(` <dc:description>${escapeXml(props.description)}</dc:description>`);
|
|
155
|
-
if (props.keywords)
|
|
156
|
-
lines.push(` <cp:keywords>${escapeXml(props.keywords)}</cp:keywords>`);
|
|
157
|
-
if (props.lastModifiedBy)
|
|
158
|
-
lines.push(` <cp:lastModifiedBy>${escapeXml(props.lastModifiedBy)}</cp:lastModifiedBy>`);
|
|
159
|
-
if (props.revision)
|
|
160
|
-
lines.push(` <cp:revision>${escapeXml(props.revision)}</cp:revision>`);
|
|
161
|
-
if (props.created) {
|
|
162
|
-
lines.push(` <dcterms:created xsi:type="dcterms:W3CDTF">${escapeXml(props.created)}</dcterms:created>`);
|
|
163
|
-
}
|
|
164
|
-
if (props.modified) {
|
|
165
|
-
lines.push(` <dcterms:modified xsi:type="dcterms:W3CDTF">${escapeXml(props.modified)}</dcterms:modified>`);
|
|
166
|
-
}
|
|
167
|
-
lines.push('</cp:coreProperties>');
|
|
168
|
-
return lines.join('\n');
|
|
169
|
-
}
|
|
170
|
-
// ============================================
|
|
171
|
-
// Helpers
|
|
172
|
-
// ============================================
|
|
173
|
-
function getExtension(path) {
|
|
174
|
-
const dot = path.lastIndexOf('.');
|
|
175
|
-
if (dot === -1)
|
|
176
|
-
return undefined;
|
|
177
|
-
return path.substring(dot + 1).toLowerCase();
|
|
178
|
-
}
|
|
179
|
-
function buildRelsPath(partPath) {
|
|
180
|
-
const lastSlash = partPath.lastIndexOf('/');
|
|
181
|
-
if (lastSlash === -1) {
|
|
182
|
-
return `_rels/${partPath}.rels`;
|
|
183
|
-
}
|
|
184
|
-
const dir = partPath.substring(0, lastSlash);
|
|
185
|
-
const file = partPath.substring(lastSlash + 1);
|
|
186
|
-
return `${dir}/_rels/${file}.rels`;
|
|
187
|
-
}
|
|
188
|
-
function groupRelationshipsBySource(pending) {
|
|
189
|
-
const grouped = new Map();
|
|
190
|
-
for (const { sourcePart, relationship } of pending) {
|
|
191
|
-
let list = grouped.get(sourcePart);
|
|
192
|
-
if (!list) {
|
|
193
|
-
list = [];
|
|
194
|
-
grouped.set(sourcePart, list);
|
|
195
|
-
}
|
|
196
|
-
list.push(relationship);
|
|
197
|
-
}
|
|
198
|
-
return grouped;
|
|
199
|
-
}
|
|
200
|
-
//# sourceMappingURL=writer.js.map
|
package/dist/ooxml/writer.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"writer.js","sourceRoot":"","sources":["../../src/ooxml/writer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,EACL,UAAU,EACV,MAAM,EACN,0BAA0B,EAC1B,4BAA4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AAC,CAAC;QACnC,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,IAAI,GAAG,EAAE,CAAC;YACV,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAChC,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC1B,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/ooxml/xmlUtils.d.ts
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* XML Utility Functions
|
|
3
|
-
*
|
|
4
|
-
* Lightweight helpers for generating well-formed XML strings.
|
|
5
|
-
* Used by all OOXML writers (DOCX, PPTX, XLSX) to construct
|
|
6
|
-
* part content without a heavy DOM library.
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* XML declaration for the start of every OOXML part.
|
|
10
|
-
*/
|
|
11
|
-
export declare function xmlDeclaration(): string;
|
|
12
|
-
/**
|
|
13
|
-
* Escape a string for safe inclusion in XML text content or attribute values.
|
|
14
|
-
*
|
|
15
|
-
* Handles the five predefined XML entities:
|
|
16
|
-
* - & → &
|
|
17
|
-
* - < → <
|
|
18
|
-
* - > → >
|
|
19
|
-
* - " → "
|
|
20
|
-
* - ' → '
|
|
21
|
-
*/
|
|
22
|
-
export declare function escapeXml(text: string): string;
|
|
23
|
-
/**
|
|
24
|
-
* Build an XML attribute string from a key-value record.
|
|
25
|
-
* Only includes entries where the value is defined and non-empty.
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```ts
|
|
29
|
-
* attrString({ 'w:val': 'Heading1', 'w:eastAsia': undefined })
|
|
30
|
-
* // ' w:val="Heading1"'
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
export declare function attrString(attrs?: Record<string, string | undefined>): string;
|
|
34
|
-
/**
|
|
35
|
-
* Build a self-closing XML element: `<tag attr="val"/>`.
|
|
36
|
-
*
|
|
37
|
-
* @example
|
|
38
|
-
* ```ts
|
|
39
|
-
* selfClosingElement('w:b')
|
|
40
|
-
* // '<w:b/>'
|
|
41
|
-
*
|
|
42
|
-
* selfClosingElement('w:pStyle', { 'w:val': 'Heading1' })
|
|
43
|
-
* // '<w:pStyle w:val="Heading1"/>'
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
46
|
-
export declare function selfClosingElement(tag: string, attrs?: Record<string, string | undefined>): string;
|
|
47
|
-
/**
|
|
48
|
-
* Build an XML element with children: `<tag attr="val">...children...</tag>`.
|
|
49
|
-
* Children are concatenated directly (no extra whitespace).
|
|
50
|
-
*
|
|
51
|
-
* @example
|
|
52
|
-
* ```ts
|
|
53
|
-
* xmlElement('w:p', {},
|
|
54
|
-
* xmlElement('w:r', {},
|
|
55
|
-
* xmlElement('w:t', {}, 'Hello')
|
|
56
|
-
* )
|
|
57
|
-
* )
|
|
58
|
-
* // '<w:p><w:r><w:t>Hello</w:t></w:r></w:p>'
|
|
59
|
-
* ```
|
|
60
|
-
*/
|
|
61
|
-
export declare function xmlElement(tag: string, attrs?: Record<string, string | undefined>, ...children: string[]): string;
|
|
62
|
-
/**
|
|
63
|
-
* Build an XML text element: `<tag attr="val">escaped text</tag>`.
|
|
64
|
-
* The text value is XML-escaped automatically.
|
|
65
|
-
*
|
|
66
|
-
* This is a convenience for the common pattern of wrapping text in an element,
|
|
67
|
-
* where you want automatic escaping (unlike `xmlElement` which takes raw children).
|
|
68
|
-
*
|
|
69
|
-
* @example
|
|
70
|
-
* ```ts
|
|
71
|
-
* textElement('w:t', { 'xml:space': 'preserve' }, 'Hello & world')
|
|
72
|
-
* // '<w:t xml:space="preserve">Hello & world</w:t>'
|
|
73
|
-
* ```
|
|
74
|
-
*/
|
|
75
|
-
export declare function textElement(tag: string, attrs?: Record<string, string | undefined>, text?: string): string;
|
|
76
|
-
//# sourceMappingURL=xmlUtils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"xmlUtils.d.ts","sourceRoot":"","sources":["../../src/ooxml/xmlUtils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAO9C;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM,CAS7E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,EACX,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GACzC,MAAM,CAER;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,CACxB,GAAG,EAAE,MAAM,EACX,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EAC1C,GAAG,QAAQ,EAAE,MAAM,EAAE,GACpB,MAAM,CAMR;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,MAAM,EACX,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EAC1C,IAAI,CAAC,EAAE,MAAM,GACZ,MAAM,CAKR"}
|
package/dist/ooxml/xmlUtils.js
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* XML Utility Functions
|
|
3
|
-
*
|
|
4
|
-
* Lightweight helpers for generating well-formed XML strings.
|
|
5
|
-
* Used by all OOXML writers (DOCX, PPTX, XLSX) to construct
|
|
6
|
-
* part content without a heavy DOM library.
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* XML declaration for the start of every OOXML part.
|
|
10
|
-
*/
|
|
11
|
-
export function xmlDeclaration() {
|
|
12
|
-
return '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Escape a string for safe inclusion in XML text content or attribute values.
|
|
16
|
-
*
|
|
17
|
-
* Handles the five predefined XML entities:
|
|
18
|
-
* - & → &
|
|
19
|
-
* - < → <
|
|
20
|
-
* - > → >
|
|
21
|
-
* - " → "
|
|
22
|
-
* - ' → '
|
|
23
|
-
*/
|
|
24
|
-
export function escapeXml(text) {
|
|
25
|
-
return text
|
|
26
|
-
.replace(/&/g, '&')
|
|
27
|
-
.replace(/</g, '<')
|
|
28
|
-
.replace(/>/g, '>')
|
|
29
|
-
.replace(/"/g, '"')
|
|
30
|
-
.replace(/'/g, ''');
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Build an XML attribute string from a key-value record.
|
|
34
|
-
* Only includes entries where the value is defined and non-empty.
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* ```ts
|
|
38
|
-
* attrString({ 'w:val': 'Heading1', 'w:eastAsia': undefined })
|
|
39
|
-
* // ' w:val="Heading1"'
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
export function attrString(attrs) {
|
|
43
|
-
if (!attrs)
|
|
44
|
-
return '';
|
|
45
|
-
const parts = [];
|
|
46
|
-
for (const [key, value] of Object.entries(attrs)) {
|
|
47
|
-
if (value !== undefined && value !== '') {
|
|
48
|
-
parts.push(` ${key}="${escapeXml(value)}"`);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return parts.join('');
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Build a self-closing XML element: `<tag attr="val"/>`.
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* ```ts
|
|
58
|
-
* selfClosingElement('w:b')
|
|
59
|
-
* // '<w:b/>'
|
|
60
|
-
*
|
|
61
|
-
* selfClosingElement('w:pStyle', { 'w:val': 'Heading1' })
|
|
62
|
-
* // '<w:pStyle w:val="Heading1"/>'
|
|
63
|
-
* ```
|
|
64
|
-
*/
|
|
65
|
-
export function selfClosingElement(tag, attrs) {
|
|
66
|
-
return `<${tag}${attrString(attrs)}/>`;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Build an XML element with children: `<tag attr="val">...children...</tag>`.
|
|
70
|
-
* Children are concatenated directly (no extra whitespace).
|
|
71
|
-
*
|
|
72
|
-
* @example
|
|
73
|
-
* ```ts
|
|
74
|
-
* xmlElement('w:p', {},
|
|
75
|
-
* xmlElement('w:r', {},
|
|
76
|
-
* xmlElement('w:t', {}, 'Hello')
|
|
77
|
-
* )
|
|
78
|
-
* )
|
|
79
|
-
* // '<w:p><w:r><w:t>Hello</w:t></w:r></w:p>'
|
|
80
|
-
* ```
|
|
81
|
-
*/
|
|
82
|
-
export function xmlElement(tag, attrs, ...children) {
|
|
83
|
-
const content = children.join('');
|
|
84
|
-
if (content === '') {
|
|
85
|
-
return selfClosingElement(tag, attrs);
|
|
86
|
-
}
|
|
87
|
-
return `<${tag}${attrString(attrs)}>${content}</${tag}>`;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Build an XML text element: `<tag attr="val">escaped text</tag>`.
|
|
91
|
-
* The text value is XML-escaped automatically.
|
|
92
|
-
*
|
|
93
|
-
* This is a convenience for the common pattern of wrapping text in an element,
|
|
94
|
-
* where you want automatic escaping (unlike `xmlElement` which takes raw children).
|
|
95
|
-
*
|
|
96
|
-
* @example
|
|
97
|
-
* ```ts
|
|
98
|
-
* textElement('w:t', { 'xml:space': 'preserve' }, 'Hello & world')
|
|
99
|
-
* // '<w:t xml:space="preserve">Hello & world</w:t>'
|
|
100
|
-
* ```
|
|
101
|
-
*/
|
|
102
|
-
export function textElement(tag, attrs, text) {
|
|
103
|
-
if (text === undefined || text === '') {
|
|
104
|
-
return selfClosingElement(tag, attrs);
|
|
105
|
-
}
|
|
106
|
-
return `<${tag}${attrString(attrs)}>${escapeXml(text)}</${tag}>`;
|
|
107
|
-
}
|
|
108
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B,GAAW,EACX,KAA0C,EAC1C,GAAG,QAAkB;IAErB,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClC,IAAI,OAAO,KAAK,EAAE,EAAE,CAAC;QACnB,OAAO,kBAAkB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,IAAI,GAAG,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,GAAG,GAAG,CAAC;AAC3D,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,WAAW,CACzB,GAAW,EACX,KAA0C,EAC1C,IAAa;IAEb,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,EAAE,EAAE,CAAC;QACtC,OAAO,kBAAkB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,IAAI,GAAG,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC;AACnE,CAAC"}
|
package/dist/pdf/export.d.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PDF Export
|
|
3
|
-
*
|
|
4
|
-
* Converts a squisq MarkdownDocument (or Doc) into a PDF file
|
|
5
|
-
* using pdf-lib. Generates paginated, styled output with support for
|
|
6
|
-
* headings, paragraphs, inline formatting, lists, code blocks,
|
|
7
|
-
* blockquotes, tables, thematic breaks, and hyperlinks.
|
|
8
|
-
*
|
|
9
|
-
* Uses only the 14 standard PDF fonts (no font embedding required),
|
|
10
|
-
* keeping output size small and rendering fast.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```ts
|
|
14
|
-
* import { parseMarkdown } from '@bendyline/squisq/markdown';
|
|
15
|
-
* import { markdownDocToPdf } from '@bendyline/squisq-formats/pdf';
|
|
16
|
-
*
|
|
17
|
-
* const md = parseMarkdown('# Hello\n\nWorld **bold** text');
|
|
18
|
-
* const buffer = await markdownDocToPdf(md);
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
import type { Doc } from '@bendyline/squisq/schemas';
|
|
22
|
-
import type { MarkdownDocument } from '@bendyline/squisq/markdown';
|
|
23
|
-
/** Page size presets. */
|
|
24
|
-
export type PdfPageSize = 'letter' | 'a4';
|
|
25
|
-
/**
|
|
26
|
-
* Options for PDF export.
|
|
27
|
-
*/
|
|
28
|
-
export interface PdfExportOptions {
|
|
29
|
-
/** Document title (PDF metadata). */
|
|
30
|
-
title?: string;
|
|
31
|
-
/** Document author (PDF metadata). */
|
|
32
|
-
author?: string;
|
|
33
|
-
/** Page size preset. Default: "letter". */
|
|
34
|
-
pageSize?: PdfPageSize;
|
|
35
|
-
/** Page margins in points. Default: 72 (1 inch). */
|
|
36
|
-
margin?: number;
|
|
37
|
-
/** Default body font size in points. Default: 11. */
|
|
38
|
-
defaultFontSize?: number;
|
|
39
|
-
/**
|
|
40
|
-
* Squisq theme ID to apply (e.g., 'documentary', 'cinematic').
|
|
41
|
-
* When set, overrides heading, text, and link colors with the theme palette.
|
|
42
|
-
* Font changes are not supported (pdf-lib uses standard 14 PDF fonts only).
|
|
43
|
-
*/
|
|
44
|
-
themeId?: string;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Convert a MarkdownDocument to a PDF ArrayBuffer.
|
|
48
|
-
*/
|
|
49
|
-
export declare function markdownDocToPdf(doc: MarkdownDocument, options?: PdfExportOptions): Promise<ArrayBuffer>;
|
|
50
|
-
/**
|
|
51
|
-
* Convert a squisq Doc to a PDF ArrayBuffer.
|
|
52
|
-
*
|
|
53
|
-
* Convenience wrapper: Doc → MarkdownDocument → PDF.
|
|
54
|
-
*/
|
|
55
|
-
export declare function docToPdf(doc: Doc, options?: PdfExportOptions): Promise<ArrayBuffer>;
|
|
56
|
-
//# sourceMappingURL=export.d.ts.map
|
package/dist/pdf/export.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../src/pdf/export.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAGrD,OAAO,KAAK,EACV,gBAAgB,EAyBjB,MAAM,4BAA4B,CAAC;AAqCpC,yBAAyB;AACzB,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,IAAI,CAAC;AAE1C;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,oDAAoD;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,gBAAgB,EACrB,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,WAAW,CAAC,CAetB;AAED;;;;GAIG;AACH,wBAAsB,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,WAAW,CAAC,CAG7F"}
|