@bendyline/squisq-formats 1.3.0 → 1.4.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.
Files changed (224) hide show
  1. package/dist/chunk-6M7Z25LA.js +46 -0
  2. package/dist/chunk-6M7Z25LA.js.map +1 -0
  3. package/dist/{chunk-S3Y7H2BK.js → chunk-APSIAEXL.js} +9 -8
  4. package/dist/chunk-APSIAEXL.js.map +1 -0
  5. package/dist/{chunk-UDS45KUJ.js → chunk-BJQIJ4S4.js} +36 -52
  6. package/dist/chunk-BJQIJ4S4.js.map +1 -0
  7. package/dist/{chunk-33YRFXZZ.js → chunk-CRTC6DEX.js} +259 -13
  8. package/dist/chunk-CRTC6DEX.js.map +1 -0
  9. package/dist/chunk-FMOIGA5T.js +201 -0
  10. package/dist/chunk-FMOIGA5T.js.map +1 -0
  11. package/dist/{chunk-VN2KEOYB.js → chunk-I2GFTEOV.js} +321 -91
  12. package/dist/chunk-I2GFTEOV.js.map +1 -0
  13. package/dist/chunk-JBNVE2GV.js +116 -0
  14. package/dist/chunk-JBNVE2GV.js.map +1 -0
  15. package/dist/chunk-L53YIGYS.js +141 -0
  16. package/dist/chunk-L53YIGYS.js.map +1 -0
  17. package/dist/{chunk-ERZ627GR.js → chunk-ON232HJR.js} +11 -26
  18. package/dist/chunk-ON232HJR.js.map +1 -0
  19. package/dist/chunk-PN52A5AA.js +32 -0
  20. package/dist/chunk-PN52A5AA.js.map +1 -0
  21. package/dist/{chunk-7DEUGIOO.js → chunk-QSE7EWE7.js} +12 -87
  22. package/dist/chunk-QSE7EWE7.js.map +1 -0
  23. package/dist/container/index.d.ts +7 -5
  24. package/dist/container/index.js +39 -70
  25. package/dist/container/index.js.map +1 -1
  26. package/dist/csv/index.d.ts +37 -0
  27. package/dist/csv/index.js +13 -0
  28. package/dist/csv/index.js.map +1 -0
  29. package/dist/docx/index.d.ts +128 -15
  30. package/dist/docx/index.js +19 -22
  31. package/dist/docx/index.js.map +1 -1
  32. package/dist/epub/index.d.ts +66 -11
  33. package/dist/epub/index.js +11 -18
  34. package/dist/epub/index.js.map +1 -1
  35. package/dist/html/index.d.ts +315 -15
  36. package/dist/html/index.js +32 -165
  37. package/dist/html/index.js.map +1 -1
  38. package/dist/index.d.ts +10 -38
  39. package/dist/index.js +80 -37
  40. package/dist/index.js.map +1 -1
  41. package/dist/ooxml/index.d.ts +353 -14
  42. package/dist/ooxml/index.js +116 -22
  43. package/dist/ooxml/index.js.map +1 -1
  44. package/dist/pdf/index.d.ts +143 -17
  45. package/dist/pdf/index.js +16 -25
  46. package/dist/pdf/index.js.map +1 -1
  47. package/dist/pptx/index.d.ts +98 -21
  48. package/dist/pptx/index.js +18 -34
  49. package/dist/pptx/index.js.map +1 -1
  50. package/dist/xlsx/index.d.ts +29 -25
  51. package/dist/xlsx/index.js +13 -44
  52. package/dist/xlsx/index.js.map +1 -1
  53. package/package.json +7 -2
  54. package/src/__tests__/csvImport.test.ts +51 -0
  55. package/src/__tests__/exportThemeReconciliation.test.ts +87 -0
  56. package/src/__tests__/htmlImport.test.ts +57 -0
  57. package/src/__tests__/plainHtml.test.ts +31 -0
  58. package/src/__tests__/pptxExport.test.ts +138 -0
  59. package/src/__tests__/pptxImport.test.ts +70 -0
  60. package/src/__tests__/roundTripMatrix.fixtures.ts +86 -0
  61. package/src/__tests__/roundTripMatrix.helpers.ts +154 -0
  62. package/src/__tests__/roundTripMatrix.test.ts +136 -0
  63. package/src/__tests__/xlsxImport.test.ts +80 -0
  64. package/src/csv/index.ts +165 -0
  65. package/src/docx/export.ts +27 -44
  66. package/src/docx/import.ts +1 -2
  67. package/src/epub/export.ts +10 -27
  68. package/src/html/import.ts +297 -0
  69. package/src/html/index.ts +4 -0
  70. package/src/html/plainHtml.ts +66 -16
  71. package/src/index.ts +10 -3
  72. package/src/ooxml/namespaces.ts +3 -0
  73. package/src/pdf/export.ts +10 -5
  74. package/src/pdf/import.ts +1 -1
  75. package/src/pptx/export.ts +225 -85
  76. package/src/pptx/import.ts +156 -0
  77. package/src/pptx/index.ts +10 -28
  78. package/src/shared/inlineRuns.ts +99 -0
  79. package/src/shared/text.ts +41 -0
  80. package/src/xlsx/import.ts +159 -0
  81. package/src/xlsx/index.ts +11 -28
  82. package/dist/__tests__/container.test.d.ts +0 -8
  83. package/dist/__tests__/container.test.d.ts.map +0 -1
  84. package/dist/__tests__/container.test.js +0 -147
  85. package/dist/__tests__/container.test.js.map +0 -1
  86. package/dist/__tests__/docxExport.test.d.ts +0 -8
  87. package/dist/__tests__/docxExport.test.d.ts.map +0 -1
  88. package/dist/__tests__/docxExport.test.js +0 -383
  89. package/dist/__tests__/docxExport.test.js.map +0 -1
  90. package/dist/__tests__/docxImport.test.d.ts +0 -8
  91. package/dist/__tests__/docxImport.test.d.ts.map +0 -1
  92. package/dist/__tests__/docxImport.test.js +0 -309
  93. package/dist/__tests__/docxImport.test.js.map +0 -1
  94. package/dist/__tests__/epub.test.d.ts +0 -8
  95. package/dist/__tests__/epub.test.d.ts.map +0 -1
  96. package/dist/__tests__/epub.test.js +0 -472
  97. package/dist/__tests__/epub.test.js.map +0 -1
  98. package/dist/__tests__/html.test.d.ts +0 -8
  99. package/dist/__tests__/html.test.d.ts.map +0 -1
  100. package/dist/__tests__/html.test.js +0 -317
  101. package/dist/__tests__/html.test.js.map +0 -1
  102. package/dist/__tests__/ooxml.test.d.ts +0 -5
  103. package/dist/__tests__/ooxml.test.d.ts.map +0 -1
  104. package/dist/__tests__/ooxml.test.js +0 -152
  105. package/dist/__tests__/ooxml.test.js.map +0 -1
  106. package/dist/__tests__/pdfExport.test.d.ts +0 -8
  107. package/dist/__tests__/pdfExport.test.d.ts.map +0 -1
  108. package/dist/__tests__/pdfExport.test.js +0 -275
  109. package/dist/__tests__/pdfExport.test.js.map +0 -1
  110. package/dist/__tests__/pdfImport.test.d.ts +0 -11
  111. package/dist/__tests__/pdfImport.test.d.ts.map +0 -1
  112. package/dist/__tests__/pdfImport.test.js +0 -254
  113. package/dist/__tests__/pdfImport.test.js.map +0 -1
  114. package/dist/__tests__/plainHtml.test.d.ts +0 -5
  115. package/dist/__tests__/plainHtml.test.d.ts.map +0 -1
  116. package/dist/__tests__/plainHtml.test.js +0 -327
  117. package/dist/__tests__/plainHtml.test.js.map +0 -1
  118. package/dist/__tests__/plainHtmlBundle.test.d.ts +0 -11
  119. package/dist/__tests__/plainHtmlBundle.test.d.ts.map +0 -1
  120. package/dist/__tests__/plainHtmlBundle.test.js +0 -210
  121. package/dist/__tests__/plainHtmlBundle.test.js.map +0 -1
  122. package/dist/__tests__/roundTrip.test.d.ts +0 -7
  123. package/dist/__tests__/roundTrip.test.d.ts.map +0 -1
  124. package/dist/__tests__/roundTrip.test.js +0 -173
  125. package/dist/__tests__/roundTrip.test.js.map +0 -1
  126. package/dist/chunk-33YRFXZZ.js.map +0 -1
  127. package/dist/chunk-67KIJHV2.js +0 -21
  128. package/dist/chunk-67KIJHV2.js.map +0 -1
  129. package/dist/chunk-7DEUGIOO.js.map +0 -1
  130. package/dist/chunk-ERZ627GR.js.map +0 -1
  131. package/dist/chunk-S3Y7H2BK.js.map +0 -1
  132. package/dist/chunk-UDS45KUJ.js.map +0 -1
  133. package/dist/chunk-VN2KEOYB.js.map +0 -1
  134. package/dist/chunk-YN5HFCEW.js +0 -120
  135. package/dist/chunk-YN5HFCEW.js.map +0 -1
  136. package/dist/container/index.d.ts.map +0 -1
  137. package/dist/docx/export.d.ts +0 -69
  138. package/dist/docx/export.d.ts.map +0 -1
  139. package/dist/docx/export.js +0 -985
  140. package/dist/docx/export.js.map +0 -1
  141. package/dist/docx/import.d.ts +0 -65
  142. package/dist/docx/import.d.ts.map +0 -1
  143. package/dist/docx/import.js +0 -779
  144. package/dist/docx/import.js.map +0 -1
  145. package/dist/docx/index.d.ts.map +0 -1
  146. package/dist/docx/styles.d.ts +0 -68
  147. package/dist/docx/styles.d.ts.map +0 -1
  148. package/dist/docx/styles.js +0 -125
  149. package/dist/docx/styles.js.map +0 -1
  150. package/dist/epub/export.d.ts +0 -72
  151. package/dist/epub/export.d.ts.map +0 -1
  152. package/dist/epub/export.js +0 -698
  153. package/dist/epub/export.js.map +0 -1
  154. package/dist/epub/index.d.ts.map +0 -1
  155. package/dist/html/docsHtmlBundle.d.ts +0 -53
  156. package/dist/html/docsHtmlBundle.d.ts.map +0 -1
  157. package/dist/html/docsHtmlBundle.js +0 -299
  158. package/dist/html/docsHtmlBundle.js.map +0 -1
  159. package/dist/html/htmlTemplate.d.ts +0 -70
  160. package/dist/html/htmlTemplate.d.ts.map +0 -1
  161. package/dist/html/htmlTemplate.js +0 -282
  162. package/dist/html/htmlTemplate.js.map +0 -1
  163. package/dist/html/imageUtils.d.ts +0 -29
  164. package/dist/html/imageUtils.d.ts.map +0 -1
  165. package/dist/html/imageUtils.js +0 -63
  166. package/dist/html/imageUtils.js.map +0 -1
  167. package/dist/html/index.d.ts.map +0 -1
  168. package/dist/html/plainHtml.d.ts +0 -79
  169. package/dist/html/plainHtml.d.ts.map +0 -1
  170. package/dist/html/plainHtml.js +0 -614
  171. package/dist/html/plainHtml.js.map +0 -1
  172. package/dist/html/plainHtmlBundle.d.ts +0 -93
  173. package/dist/html/plainHtmlBundle.d.ts.map +0 -1
  174. package/dist/html/plainHtmlBundle.js +0 -357
  175. package/dist/html/plainHtmlBundle.js.map +0 -1
  176. package/dist/index.d.ts.map +0 -1
  177. package/dist/ooxml/index.d.ts.map +0 -1
  178. package/dist/ooxml/namespaces.d.ts +0 -77
  179. package/dist/ooxml/namespaces.d.ts.map +0 -1
  180. package/dist/ooxml/namespaces.js +0 -104
  181. package/dist/ooxml/namespaces.js.map +0 -1
  182. package/dist/ooxml/reader.d.ts +0 -52
  183. package/dist/ooxml/reader.d.ts.map +0 -1
  184. package/dist/ooxml/reader.js +0 -190
  185. package/dist/ooxml/reader.js.map +0 -1
  186. package/dist/ooxml/types.d.ts +0 -82
  187. package/dist/ooxml/types.d.ts.map +0 -1
  188. package/dist/ooxml/types.js +0 -9
  189. package/dist/ooxml/types.js.map +0 -1
  190. package/dist/ooxml/writer.d.ts +0 -71
  191. package/dist/ooxml/writer.d.ts.map +0 -1
  192. package/dist/ooxml/writer.js +0 -200
  193. package/dist/ooxml/writer.js.map +0 -1
  194. package/dist/ooxml/xmlUtils.d.ts +0 -76
  195. package/dist/ooxml/xmlUtils.d.ts.map +0 -1
  196. package/dist/ooxml/xmlUtils.js +0 -108
  197. package/dist/ooxml/xmlUtils.js.map +0 -1
  198. package/dist/pdf/export.d.ts +0 -56
  199. package/dist/pdf/export.d.ts.map +0 -1
  200. package/dist/pdf/export.js +0 -768
  201. package/dist/pdf/export.js.map +0 -1
  202. package/dist/pdf/import.d.ts +0 -94
  203. package/dist/pdf/import.d.ts.map +0 -1
  204. package/dist/pdf/import.js +0 -796
  205. package/dist/pdf/import.js.map +0 -1
  206. package/dist/pdf/index.d.ts.map +0 -1
  207. package/dist/pdf/styles.d.ts +0 -142
  208. package/dist/pdf/styles.d.ts.map +0 -1
  209. package/dist/pdf/styles.js +0 -145
  210. package/dist/pdf/styles.js.map +0 -1
  211. package/dist/pptx/export.d.ts +0 -75
  212. package/dist/pptx/export.d.ts.map +0 -1
  213. package/dist/pptx/export.js +0 -724
  214. package/dist/pptx/export.js.map +0 -1
  215. package/dist/pptx/index.d.ts.map +0 -1
  216. package/dist/pptx/styles.d.ts +0 -54
  217. package/dist/pptx/styles.d.ts.map +0 -1
  218. package/dist/pptx/styles.js +0 -73
  219. package/dist/pptx/styles.js.map +0 -1
  220. package/dist/pptx/templates.d.ts +0 -24
  221. package/dist/pptx/templates.d.ts.map +0 -1
  222. package/dist/pptx/templates.js +0 -158
  223. package/dist/pptx/templates.js.map +0 -1
  224. package/dist/xlsx/index.d.ts.map +0 -1
@@ -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
@@ -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,4BAA4B,EAC5B,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAsE1D;;GAEG;AACH,MAAM,UAAU,aAAa;IAC3B,MAAM,KAAK,GAAkB,EAAE,CAAC;IAChC,MAAM,aAAa,GAA0B,EAAE,CAAC;IAChD,IAAI,SAAqC,CAAC;IAE1C,OAAO;QACL,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,WAAW;YAChC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC;QAC7C,CAAC;QAED,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW;YACnC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;QACzD,CAAC;QAED,eAAe,CAAC,UAAU,EAAE,GAAG;YAC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C/C,CAAC;AAED,SAAS,aAAa,CAAC,QAAgB;IACrC,MAAM,SAAS,GAAG,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAC5C,IAAI,SAAS,KAAK,CAAC,CAAC,EAAE,CAAC;QACrB,OAAO,SAAS,QAAQ,OAAO,CAAC;IAClC,CAAC;IACD,MAAM,GAAG,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;IAC7C,MAAM,IAAI,GAAG,QAAQ,CAAC,SAAS,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;IAC/C,OAAO,GAAG,GAAG,UAAU,IAAI,OAAO,CAAC;AACrC,CAAC;AAED,SAAS,0BAA0B,CAAC,OAA8B;IAChE,MAAM,OAAO,GAAG,IAAI,GAAG,EAA0B,CAAC;IAClD,KAAK,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,IAAI,OAAO,EAAE,CAAC;QACnD,IAAI,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,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"}
@@ -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
- * - & → &amp;
17
- * - < → &lt;
18
- * - > → &gt;
19
- * - " → &quot;
20
- * - ' → &apos;
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 &amp; 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"}
@@ -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
- * - & → &amp;
19
- * - < → &lt;
20
- * - > → &gt;
21
- * - " → &quot;
22
- * - ' → &apos;
23
- */
24
- export function escapeXml(text) {
25
- return text
26
- .replace(/&/g, '&amp;')
27
- .replace(/</g, '&lt;')
28
- .replace(/>/g, '&gt;')
29
- .replace(/"/g, '&quot;')
30
- .replace(/'/g, '&apos;');
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 &amp; 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
- //# sourceMappingURL=xmlUtils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"xmlUtils.js","sourceRoot":"","sources":["../../src/ooxml/xmlUtils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,UAAU,cAAc;IAC5B,OAAO,yDAAyD,CAAC;AACnE,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,OAAO,IAAI;SACR,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC;SACvB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC7B,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,UAAU,CAAC,KAA0C;IACnE,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IACtB,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACjD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;YACxC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,KAAK,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACxB,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,kBAAkB,CAChC,GAAW,EACX,KAA0C;IAE1C,OAAO,IAAI,GAAG,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC;AACzC,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,UAAU,CACxB,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"}
@@ -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
@@ -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"}