@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,282 +0,0 @@
1
- /**
2
- * HTML Template Generation for SquisqPlayer Exports
3
- *
4
- * Generates complete, self-contained HTML documents that load the SquisqPlayer
5
- * IIFE bundle and render a Doc as either an interactive slideshow or a static
6
- * scrollable document.
7
- *
8
- * Two variants:
9
- * 1. **Inline** — All JS, CSS, and images are embedded in the HTML (single file).
10
- * 2. **External** — JS is referenced via `<script src>`, images via relative paths.
11
- */
12
- import { arrayBufferToBase64DataUrl, inferMimeType } from './imageUtils.js';
13
- // ── Image Path Collection ──────────────────────────────────────────
14
- /**
15
- * Collect all relative image paths referenced in a Doc's layers and template blocks.
16
- * Returns a Set of unique relative paths that need to be resolved.
17
- */
18
- export function collectImagePaths(doc) {
19
- const paths = new Set();
20
- function addIfRelative(src) {
21
- if (!src ||
22
- src.startsWith('data:') ||
23
- src.startsWith('blob:') ||
24
- src.startsWith('http://') ||
25
- src.startsWith('https://')) {
26
- return;
27
- }
28
- paths.add(src);
29
- }
30
- function scanLayers(layers) {
31
- if (!layers)
32
- return;
33
- for (const layer of layers) {
34
- if (layer.type === 'image')
35
- addIfRelative(layer.content.src);
36
- if (layer.type === 'video') {
37
- addIfRelative(layer.content.src);
38
- addIfRelative(layer.content.posterSrc);
39
- }
40
- if (layer.type === 'map')
41
- addIfRelative(layer.content.staticSrc);
42
- }
43
- }
44
- function scanBlock(block) {
45
- scanLayers(block.layers);
46
- if (block.contents)
47
- scanMarkdownNodes(block.contents, addIfRelative);
48
- if (block.children)
49
- block.children.forEach(scanBlock);
50
- }
51
- // Scan all blocks
52
- doc.blocks.forEach(scanBlock);
53
- // Scan start block hero
54
- if (doc.startBlock?.heroSrc)
55
- addIfRelative(doc.startBlock.heroSrc);
56
- // Scan persistent layers
57
- if (doc.persistentLayers) {
58
- for (const pl of doc.persistentLayers.bottomLayers ?? []) {
59
- if ('src' in pl && typeof pl.src === 'string')
60
- addIfRelative(pl.src);
61
- }
62
- for (const pl of doc.persistentLayers.topLayers ?? []) {
63
- if ('src' in pl && typeof pl.src === 'string')
64
- addIfRelative(pl.src);
65
- }
66
- }
67
- // Scan template block fields that reference images
68
- for (const block of doc.blocks) {
69
- scanTemplateImageFields(block, paths);
70
- }
71
- return paths;
72
- }
73
- /**
74
- * Walk markdown body nodes for image references. Catches both shorthand
75
- * `![alt](url)` (type `image`, `url` field) and raw HTML `<img src>` tags
76
- * (type `htmlBlock`/`htmlInline`, `htmlChildren` sub-tree) — the latter is
77
- * how the WYSIWYG editor round-trips resized images, since markdown
78
- * shorthand has no width syntax.
79
- */
80
- function scanMarkdownNodes(nodes, visit) {
81
- for (const node of nodes) {
82
- if (!node || typeof node !== 'object')
83
- continue;
84
- const n = node;
85
- if (n.type === 'image' && typeof n.url === 'string') {
86
- visit(n.url);
87
- }
88
- if ((n.type === 'htmlBlock' || n.type === 'htmlInline') && Array.isArray(n.htmlChildren)) {
89
- scanHtmlNodes(n.htmlChildren, visit);
90
- }
91
- if (Array.isArray(n.children)) {
92
- scanMarkdownNodes(n.children, visit);
93
- }
94
- }
95
- }
96
- /** Walk a parsed HTML sub-tree for `<img>` src attributes. */
97
- function scanHtmlNodes(nodes, visit) {
98
- for (const node of nodes) {
99
- if (!node || typeof node !== 'object')
100
- continue;
101
- const n = node;
102
- if (n.type !== 'htmlElement')
103
- continue;
104
- if (n.tagName === 'img') {
105
- const attrs = n.attributes;
106
- if (attrs && typeof attrs.src === 'string')
107
- visit(attrs.src);
108
- }
109
- if (Array.isArray(n.children)) {
110
- scanHtmlNodes(n.children, visit);
111
- }
112
- }
113
- }
114
- /**
115
- * Recursively scan any object for known image-bearing field names.
116
- */
117
- function scanTemplateImageFields(obj, paths) {
118
- if (!obj || typeof obj !== 'object')
119
- return;
120
- const imageFieldNames = [
121
- 'imageSrc',
122
- 'src',
123
- 'heroSrc',
124
- 'backgroundImage',
125
- 'posterSrc',
126
- 'staticSrc',
127
- 'videoSrc',
128
- 'thumbnailSrc',
129
- ];
130
- for (const key of imageFieldNames) {
131
- const val = obj[key];
132
- if (typeof val === 'string' && val && !val.startsWith('data:') && !val.startsWith('http')) {
133
- paths.add(val);
134
- }
135
- // Handle nested objects like { src: '...' }
136
- if (val && typeof val === 'object' && !Array.isArray(val)) {
137
- scanTemplateImageFields(val, paths);
138
- }
139
- }
140
- // Handle arrays (e.g., images: [{ src: '...' }])
141
- if (Array.isArray(obj)) {
142
- for (const item of obj) {
143
- if (item && typeof item === 'object') {
144
- scanTemplateImageFields(item, paths);
145
- }
146
- }
147
- }
148
- // Recurse into known array/object fields
149
- for (const key of ['images', 'accentImage', 'backgroundVideo', 'children', 'blocks']) {
150
- const val = obj[key];
151
- if (Array.isArray(val)) {
152
- for (const item of val) {
153
- if (item && typeof item === 'object') {
154
- scanTemplateImageFields(item, paths);
155
- }
156
- }
157
- }
158
- else if (val && typeof val === 'object') {
159
- scanTemplateImageFields(val, paths);
160
- }
161
- }
162
- }
163
- // ── HTML Generation ────────────────────────────────────────────────
164
- /**
165
- * Escape a string for safe embedding in a `<script>` tag.
166
- * Prevents `</script>` from closing the tag prematurely.
167
- */
168
- function escapeForScript(str) {
169
- return str.replace(/<\/(script)/gi, '<\\/$1');
170
- }
171
- /**
172
- * Generate a complete inline HTML document with all JS and images embedded.
173
- *
174
- * @param doc - The Doc to render
175
- * @param options - Export options
176
- * @returns Complete HTML string
177
- */
178
- export function generateInlineHtml(doc, options) {
179
- const { playerScript, images, mode = 'slideshow', title = 'Squisq Document', autoPlay = false, themeId, } = options;
180
- // Apply theme to doc if specified (the SquisqPlayer respects doc.themeId at render time)
181
- if (themeId) {
182
- doc = { ...doc, themeId };
183
- }
184
- // Build base64 image map
185
- const imageMap = {};
186
- if (images) {
187
- for (const [path, buffer] of images.entries()) {
188
- const mimeType = inferMimeType(path);
189
- imageMap[path] = arrayBufferToBase64DataUrl(buffer, mimeType);
190
- }
191
- }
192
- const docJson = escapeForScript(JSON.stringify(doc));
193
- const imageMapJson = escapeForScript(JSON.stringify(imageMap));
194
- return `<!DOCTYPE html>
195
- <html lang="en">
196
- <head>
197
- <meta charset="UTF-8">
198
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
199
- <title>${escapeHtml(title)}</title>
200
- <style>
201
- *,*::before,*::after{box-sizing:border-box}
202
- html,body{margin:0;padding:0;height:100%;background:#1a1a2e;color:#e0e0e0;font-family:system-ui,-apple-system,sans-serif}
203
- #squisq-root{width:100%;height:100%;display:flex;align-items:center;justify-content:center}
204
- ${mode === 'static' ? '#squisq-root{align-items:flex-start;overflow-y:auto;background:#fff;color:#1f2937}' : ''}
205
- </style>
206
- </head>
207
- <body>
208
- <div id="squisq-root"></div>
209
- <script>${escapeForScript(playerScript)}</script>
210
- <script>
211
- (function(){
212
- var doc = JSON.parse(${JSON.stringify(docJson)});
213
- var images = JSON.parse(${JSON.stringify(imageMapJson)});
214
- SquisqPlayer.mount(document.getElementById("squisq-root"), doc, {
215
- mode: ${JSON.stringify(mode)},
216
- images: images,
217
- autoPlay: ${JSON.stringify(autoPlay)},
218
- basePath: "."
219
- });
220
- })();
221
- </script>
222
- </body>
223
- </html>`;
224
- }
225
- /**
226
- * Generate an HTML document that references external JS and image files.
227
- * Used for ZIP exports where files sit alongside the HTML.
228
- *
229
- * @param doc - The Doc to render (image/audio paths should already be rewritten to relative)
230
- * @param options - Export options (playerScript is not embedded, referenced via src)
231
- * @returns Complete HTML string
232
- */
233
- export function generateExternalHtml(doc, options) {
234
- const { playerScriptPath, imagePathMap, audioPathMap, mode = 'slideshow', title = 'Squisq Document', autoPlay = false, } = options;
235
- const docJson = escapeForScript(JSON.stringify(doc));
236
- const imageMapJson = imagePathMap ? escapeForScript(JSON.stringify(imagePathMap)) : '{}';
237
- const audioMapJson = audioPathMap ? escapeForScript(JSON.stringify(audioPathMap)) : 'null';
238
- return `<!DOCTYPE html>
239
- <html lang="en">
240
- <head>
241
- <meta charset="UTF-8">
242
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
243
- <title>${escapeHtml(title)}</title>
244
- <style>
245
- *,*::before,*::after{box-sizing:border-box}
246
- html,body{margin:0;padding:0;height:100%;background:#1a1a2e;color:#e0e0e0;font-family:system-ui,-apple-system,sans-serif}
247
- #squisq-root{width:100%;height:100%;display:flex;align-items:center;justify-content:center}
248
- ${mode === 'static' ? '#squisq-root{align-items:flex-start;overflow-y:auto;background:#fff;color:#1f2937}' : ''}
249
- </style>
250
- </head>
251
- <body>
252
- <div id="squisq-root"></div>
253
- <script src="${escapeHtml(playerScriptPath)}"></script>
254
- <script>
255
- (function(){
256
- var doc = JSON.parse(${JSON.stringify(docJson)});
257
- var images = JSON.parse(${JSON.stringify(imageMapJson)});
258
- var audio = ${audioMapJson};
259
- SquisqPlayer.mount(document.getElementById("squisq-root"), doc, {
260
- mode: ${JSON.stringify(mode)},
261
- images: images,
262
- audio: audio,
263
- autoPlay: ${JSON.stringify(autoPlay)},
264
- basePath: "."
265
- });
266
- })();
267
- </script>
268
- </body>
269
- </html>`;
270
- }
271
- /**
272
- * Escape HTML special characters to prevent injection.
273
- */
274
- function escapeHtml(str) {
275
- return str
276
- .replace(/&/g, '&amp;')
277
- .replace(/</g, '&lt;')
278
- .replace(/>/g, '&gt;')
279
- .replace(/"/g, '&quot;')
280
- .replace(/'/g, '&#39;');
281
- }
282
- //# sourceMappingURL=htmlTemplate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"htmlTemplate.js","sourceRoot":"","sources":["../../src/html/htmlTemplate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,0BAA0B,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAuC5E,sEAAsE;AAEtE;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAQ;IACxC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAEhC,SAAS,aAAa,CAAC,GAAuB;QAC5C,IACE,CAAC,GAAG;YACJ,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC;YACvB,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC;YACvB,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC;YACzB,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,EAC1B,CAAC;YACD,OAAO;QACT,CAAC;QACD,KAAK,CAAC,GAAG,CAAC,GAAG,C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29 +0,0 @@
1
- /**
2
- * Image Utilities for HTML Export
3
- *
4
- * Browser-compatible helpers for converting image data to base64 data URIs
5
- * and inferring MIME types from filenames.
6
- */
7
- /**
8
- * Infer a MIME type from a filename's extension.
9
- * Returns 'application/octet-stream' for unknown types.
10
- */
11
- export declare function inferMimeType(filename: string): string;
12
- /**
13
- * Convert an ArrayBuffer to a base64-encoded data URI string.
14
- *
15
- * @param buffer - The binary image data
16
- * @param mimeType - MIME type (e.g., 'image/jpeg'). If not provided, defaults to
17
- * 'application/octet-stream'.
18
- * @returns A `data:` URI string
19
- */
20
- export declare function arrayBufferToBase64DataUrl(buffer: ArrayBuffer, mimeType: string): string;
21
- /**
22
- * Extract the filename from a path or URL (strips directory and query).
23
- *
24
- * @example
25
- * extractFilename('images/hero.jpg') // 'hero.jpg'
26
- * extractFilename('https://example.com/photo.png?v=2') // 'photo.png'
27
- */
28
- export declare function extractFilename(path: string): string;
29
- //# sourceMappingURL=imageUtils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"imageUtils.d.ts","sourceRoot":"","sources":["../../src/html/imageUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAoBH;;;GAGG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAGtD;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAQxF;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMpD"}
@@ -1,63 +0,0 @@
1
- /**
2
- * Image Utilities for HTML Export
3
- *
4
- * Browser-compatible helpers for converting image data to base64 data URIs
5
- * and inferring MIME types from filenames.
6
- */
7
- /** Map of file extensions to MIME types */
8
- const MIME_MAP = {
9
- jpg: 'image/jpeg',
10
- jpeg: 'image/jpeg',
11
- png: 'image/png',
12
- gif: 'image/gif',
13
- webp: 'image/webp',
14
- svg: 'image/svg+xml',
15
- ico: 'image/x-icon',
16
- bmp: 'image/bmp',
17
- avif: 'image/avif',
18
- mp3: 'audio/mpeg',
19
- wav: 'audio/wav',
20
- ogg: 'audio/ogg',
21
- mp4: 'video/mp4',
22
- webm: 'video/webm',
23
- };
24
- /**
25
- * Infer a MIME type from a filename's extension.
26
- * Returns 'application/octet-stream' for unknown types.
27
- */
28
- export function inferMimeType(filename) {
29
- const ext = filename.split('.').pop()?.toLowerCase() ?? '';
30
- return MIME_MAP[ext] ?? 'application/octet-stream';
31
- }
32
- /**
33
- * Convert an ArrayBuffer to a base64-encoded data URI string.
34
- *
35
- * @param buffer - The binary image data
36
- * @param mimeType - MIME type (e.g., 'image/jpeg'). If not provided, defaults to
37
- * 'application/octet-stream'.
38
- * @returns A `data:` URI string
39
- */
40
- export function arrayBufferToBase64DataUrl(buffer, mimeType) {
41
- const bytes = new Uint8Array(buffer);
42
- let binary = '';
43
- for (let i = 0; i < bytes.length; i++) {
44
- binary += String.fromCharCode(bytes[i]);
45
- }
46
- const base64 = btoa(binary);
47
- return `data:${mimeType};base64,${base64}`;
48
- }
49
- /**
50
- * Extract the filename from a path or URL (strips directory and query).
51
- *
52
- * @example
53
- * extractFilename('images/hero.jpg') // 'hero.jpg'
54
- * extractFilename('https://example.com/photo.png?v=2') // 'photo.png'
55
- */
56
- export function extractFilename(path) {
57
- // Strip query/hash
58
- const clean = path.split('?')[0].split('#')[0];
59
- // Get last segment
60
- const parts = clean.split('/');
61
- return parts[parts.length - 1] || path;
62
- }
63
- //# sourceMappingURL=imageUtils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"imageUtils.js","sourceRoot":"","sources":["../../src/html/imageUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,2CAA2C;AAC3C,MAAM,QAAQ,GAA2B;IACvC,GAAG,EAAE,YAAY;IACjB,IAAI,EAAE,YAAY;IAClB,GAAG,EAAE,WAAW;IAChB,GAAG,EAAE,WAAW;IACh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E,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -1,79 +0,0 @@
1
- /**
2
- * Plain HTML Export — semantic, player-free
3
- *
4
- * Renders a MarkdownDocument to a self-contained HTML string. Unlike
5
- * `docToHtml` (which bundles the SquisqPlayer IIFE and renders SVG block
6
- * cards), this output is what a reader-mode tool would produce: semantic
7
- * `<h1>`/`<p>`/`<ul>`/etc. with a small embedded stylesheet, no JS, no
8
- * runtime path-rewriting. Drives both the "Page" preview tab in the
9
- * editor and the plain-style branch of the export dialog so what users
10
- * see live matches the file they download.
11
- *
12
- * Image URLs default to the markdown's own paths. Pass `images` to
13
- * substitute a different value per source URL — typically pre-resolved
14
- * blob URLs (live preview) or data URIs (single-file export).
15
- */
16
- import type { MarkdownDocument } from '@bendyline/squisq/markdown';
17
- import type { Theme } from '@bendyline/squisq/schemas';
18
- export interface PlainHtmlExportOptions {
19
- /** Document title — populates `<title>` and is HTML-escaped. */
20
- title?: string;
21
- /**
22
- * Substitution map for image `src` URLs. Keys are the URL exactly as
23
- * it appears in the markdown source; values are the URL to emit in
24
- * the rendered `<img src>`. URLs not present in the map fall through
25
- * unchanged (so external `https://…` references still work).
26
- */
27
- images?: Map<string, string>;
28
- /**
29
- * Substitution map for anchor `href` URLs. Keys are the URL exactly
30
- * as it appears in the markdown source (e.g. `'resume.md'`,
31
- * `'resume.md#experience'`); values are the URL to emit. URLs not in
32
- * the map pass through unchanged. Used by the recursive bundle
33
- * exporter to rewrite `.md` references to `.html` so a static export
34
- * of a linked document tree is internally browsable.
35
- */
36
- links?: Map<string, string>;
37
- /**
38
- * Optional Squisq theme. When provided, the rendered page uses the
39
- * theme's colors and typography, and any Google-hosted fonts the
40
- * theme references are loaded via a `<link>` to fonts.googleapis.com
41
- * so the face renders correctly without host preloads.
42
- *
43
- * When omitted, the function falls back (in order) to {@link themeId}
44
- * and then to `doc.frontmatter.themeId` — so an authored
45
- * `themeId: warm-earth` in the doc's frontmatter styles the export
46
- * automatically, without the caller having to wire theme resolution
47
- * themselves.
48
- */
49
- theme?: Theme;
50
- /**
51
- * Optional theme id (e.g. `'warm-earth'`, `'gezellig'`). Convenient
52
- * for hosts whose export dialog tracks themes by id — they can pass
53
- * the id straight through instead of resolving to a `Theme` object.
54
- * When both `theme` and `themeId` are provided, `theme` wins.
55
- */
56
- themeId?: string;
57
- /**
58
- * Optional FontAwesome CSS text to inline into the rendered page,
59
- * replacing the default cross-origin `<link>` to cdnjs. Required for
60
- * sandboxed iframe previews where tracking prevention or stricter
61
- * origin policies can silently drop cross-origin font fetches —
62
- * inlining keeps the icons resolvable purely from same-origin
63
- * resources. Hosts typically gather this string by scraping
64
- * `document.styleSheets` for `@font-face` rules whose family starts
65
- * with `"Font Awesome"`. The CDN `<link>` is only emitted when this
66
- * option is not provided.
67
- */
68
- iconsCss?: string;
69
- }
70
- /**
71
- * Render a parsed markdown document as a complete, semantic HTML page.
72
- *
73
- * When `options.theme` is provided, the output adopts the theme's
74
- * colors and typography. Google-hosted fonts referenced by the theme
75
- * are loaded via a single `<link>` to fonts.googleapis.com so the page
76
- * renders consistently when opened standalone.
77
- */
78
- export declare function markdownDocToPlainHtml(doc: MarkdownDocument, options?: PlainHtmlExportOptions): string;
79
- //# sourceMappingURL=plainHtml.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plainHtml.d.ts","sourceRoot":"","sources":["../../src/html/plainHtml.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAA0B,MAAM,4BAA4B,CAAC;AAC3F,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAKvD,MAAM,WAAW,sBAAsB;IACrC,gEAAgE;IAChE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,MAAM,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IACd;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAcD;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,gBAAgB,EACrB,OAAO,GAAE,sBAA2B,GACnC,MAAM,CA0CR"}