@bendyline/squisq 1.0.1 → 1.1.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.
Files changed (236) hide show
  1. package/dist/ContentContainer-DNx460y8.d.ts +88 -0
  2. package/dist/{Doc-1hmT1LZl.d.ts → Doc-Cvt2lyzn.d.ts} +56 -4
  3. package/dist/MediaProvider-wpSe21B3.d.ts +66 -0
  4. package/dist/__tests__/contentContainer.test.d.ts +2 -0
  5. package/dist/__tests__/contentContainer.test.d.ts.map +1 -0
  6. package/dist/__tests__/contentContainer.test.js +234 -0
  7. package/dist/__tests__/contentContainer.test.js.map +1 -0
  8. package/dist/__tests__/markdownToDoc.test.js +75 -0
  9. package/dist/__tests__/markdownToDoc.test.js.map +1 -1
  10. package/dist/{chunk-PJ7AODIM.js → chunk-3WBJAZZ5.js} +394 -52
  11. package/dist/chunk-3WBJAZZ5.js.map +1 -0
  12. package/dist/chunk-4CRBS35L.js +292 -0
  13. package/dist/chunk-4CRBS35L.js.map +1 -0
  14. package/dist/{chunk-6YJPI6VI.js → chunk-4X3JQXNM.js} +1 -1
  15. package/dist/{chunk-S4F2RY37.js → chunk-CORGFIFU.js} +1 -1
  16. package/dist/chunk-CORGFIFU.js.map +1 -0
  17. package/dist/chunk-DNJKBAI7.js +1 -0
  18. package/dist/chunk-DNJKBAI7.js.map +1 -0
  19. package/dist/{chunk-VP5SZTZ2.js → chunk-MIBRIRGJ.js} +2 -139
  20. package/dist/chunk-MIBRIRGJ.js.map +1 -0
  21. package/dist/{chunk-URU6QMLY.js → chunk-NJLL5XYC.js} +15 -8
  22. package/dist/chunk-NJLL5XYC.js.map +1 -0
  23. package/dist/chunk-OFU53HI7.js +165 -0
  24. package/dist/chunk-OFU53HI7.js.map +1 -0
  25. package/dist/chunk-TSG2OSE6.js +145 -0
  26. package/dist/chunk-TSG2OSE6.js.map +1 -0
  27. package/dist/{chunk-O5HCIUAD.js → chunk-TVPKD76V.js} +81 -187
  28. package/dist/chunk-TVPKD76V.js.map +1 -0
  29. package/dist/contentExtractor-BNfVJV2U.d.ts +113 -0
  30. package/dist/doc/audioMapping.d.ts +36 -0
  31. package/dist/doc/audioMapping.d.ts.map +1 -0
  32. package/dist/doc/audioMapping.js +279 -0
  33. package/dist/doc/audioMapping.js.map +1 -0
  34. package/dist/doc/index.d.ts +1 -0
  35. package/dist/doc/index.d.ts.map +1 -1
  36. package/dist/doc/index.js +1 -0
  37. package/dist/doc/index.js.map +1 -1
  38. package/dist/doc/markdownToDoc.d.ts.map +1 -1
  39. package/dist/doc/markdownToDoc.js +126 -1
  40. package/dist/doc/markdownToDoc.js.map +1 -1
  41. package/dist/doc/templates/comparisonBar.d.ts.map +1 -1
  42. package/dist/doc/templates/comparisonBar.js +23 -5
  43. package/dist/doc/templates/comparisonBar.js.map +1 -1
  44. package/dist/doc/templates/coverBlock.d.ts.map +1 -1
  45. package/dist/doc/templates/coverBlock.js +3 -0
  46. package/dist/doc/templates/coverBlock.js.map +1 -1
  47. package/dist/doc/templates/dateEvent.d.ts.map +1 -1
  48. package/dist/doc/templates/dateEvent.js +4 -0
  49. package/dist/doc/templates/dateEvent.js.map +1 -1
  50. package/dist/doc/templates/definitionCard.d.ts.map +1 -1
  51. package/dist/doc/templates/definitionCard.js +4 -1
  52. package/dist/doc/templates/definitionCard.js.map +1 -1
  53. package/dist/doc/templates/factCard.d.ts.map +1 -1
  54. package/dist/doc/templates/factCard.js +4 -0
  55. package/dist/doc/templates/factCard.js.map +1 -1
  56. package/dist/doc/templates/fullBleedQuote.d.ts.map +1 -1
  57. package/dist/doc/templates/fullBleedQuote.js +2 -1
  58. package/dist/doc/templates/fullBleedQuote.js.map +1 -1
  59. package/dist/doc/templates/imageWithCaption.d.ts.map +1 -1
  60. package/dist/doc/templates/imageWithCaption.js +4 -0
  61. package/dist/doc/templates/imageWithCaption.js.map +1 -1
  62. package/dist/doc/templates/listBlock.d.ts.map +1 -1
  63. package/dist/doc/templates/listBlock.js +3 -0
  64. package/dist/doc/templates/listBlock.js.map +1 -1
  65. package/dist/doc/templates/mapBlock.d.ts.map +1 -1
  66. package/dist/doc/templates/mapBlock.js +3 -0
  67. package/dist/doc/templates/mapBlock.js.map +1 -1
  68. package/dist/doc/templates/photoGrid.d.ts.map +1 -1
  69. package/dist/doc/templates/photoGrid.js +3 -0
  70. package/dist/doc/templates/photoGrid.js.map +1 -1
  71. package/dist/doc/templates/pullQuote.d.ts.map +1 -1
  72. package/dist/doc/templates/pullQuote.js +4 -0
  73. package/dist/doc/templates/pullQuote.js.map +1 -1
  74. package/dist/doc/templates/quoteBlock.d.ts.map +1 -1
  75. package/dist/doc/templates/quoteBlock.js +4 -0
  76. package/dist/doc/templates/quoteBlock.js.map +1 -1
  77. package/dist/doc/templates/sectionHeader.d.ts.map +1 -1
  78. package/dist/doc/templates/sectionHeader.js +3 -2
  79. package/dist/doc/templates/sectionHeader.js.map +1 -1
  80. package/dist/doc/templates/statHighlight.d.ts.map +1 -1
  81. package/dist/doc/templates/statHighlight.js +4 -1
  82. package/dist/doc/templates/statHighlight.js.map +1 -1
  83. package/dist/doc/templates/titleBlock.d.ts.map +1 -1
  84. package/dist/doc/templates/titleBlock.js +3 -0
  85. package/dist/doc/templates/titleBlock.js.map +1 -1
  86. package/dist/doc/templates/twoColumn.d.ts.map +1 -1
  87. package/dist/doc/templates/twoColumn.js +7 -1
  88. package/dist/doc/templates/twoColumn.js.map +1 -1
  89. package/dist/doc/templates/videoPullQuote.d.ts.map +1 -1
  90. package/dist/doc/templates/videoPullQuote.js +4 -0
  91. package/dist/doc/templates/videoPullQuote.js.map +1 -1
  92. package/dist/doc/templates/videoWithCaption.d.ts.map +1 -1
  93. package/dist/doc/templates/videoWithCaption.js +3 -0
  94. package/dist/doc/templates/videoWithCaption.js.map +1 -1
  95. package/dist/doc/utils/themeUtils.d.ts +9 -0
  96. package/dist/doc/utils/themeUtils.d.ts.map +1 -1
  97. package/dist/doc/utils/themeUtils.js +26 -0
  98. package/dist/doc/utils/themeUtils.js.map +1 -1
  99. package/dist/markdown/convert.d.ts.map +1 -1
  100. package/dist/markdown/convert.js +16 -7
  101. package/dist/markdown/convert.js.map +1 -1
  102. package/dist/markdown/types.d.ts +4 -2
  103. package/dist/markdown/types.d.ts.map +1 -1
  104. package/dist/schemas/BlockTemplates.d.ts +2 -2
  105. package/dist/schemas/BlockTemplates.d.ts.map +1 -1
  106. package/dist/schemas/BlockTemplates.js +2 -2
  107. package/dist/schemas/BlockTemplates.js.map +1 -1
  108. package/dist/schemas/Doc.d.ts +52 -0
  109. package/dist/schemas/Doc.d.ts.map +1 -1
  110. package/dist/schemas/Doc.js.map +1 -1
  111. package/dist/schemas/themeLibrary.d.ts +2 -2
  112. package/dist/schemas/themeLibrary.d.ts.map +1 -1
  113. package/dist/schemas/themeLibrary.js +91 -26
  114. package/dist/schemas/themeLibrary.js.map +1 -1
  115. package/dist/storage/ContentContainer.d.ts +87 -0
  116. package/dist/storage/ContentContainer.d.ts.map +1 -0
  117. package/dist/storage/ContentContainer.js +122 -0
  118. package/dist/storage/ContentContainer.js.map +1 -0
  119. package/dist/storage/MediaProviderFromContainer.d.ts +21 -0
  120. package/dist/storage/MediaProviderFromContainer.d.ts.map +1 -0
  121. package/dist/storage/MediaProviderFromContainer.js +79 -0
  122. package/dist/storage/MediaProviderFromContainer.js.map +1 -0
  123. package/dist/storage/index.d.ts +3 -0
  124. package/dist/storage/index.d.ts.map +1 -1
  125. package/dist/storage/index.js +2 -0
  126. package/dist/storage/index.js.map +1 -1
  127. package/dist/story/index.d.ts +50 -5
  128. package/dist/story/index.js +15 -5
  129. package/dist/{themeLibrary-DR1VRo-8.d.ts → themeLibrary-VOHfPzRB.d.ts} +3 -3
  130. package/dist/transform/applyTransform.d.ts +22 -0
  131. package/dist/transform/applyTransform.d.ts.map +1 -0
  132. package/dist/transform/applyTransform.js +68 -0
  133. package/dist/transform/applyTransform.js.map +1 -0
  134. package/dist/transform/blockAnalyzer.d.ts +48 -0
  135. package/dist/transform/blockAnalyzer.d.ts.map +1 -0
  136. package/dist/transform/blockAnalyzer.js +135 -0
  137. package/dist/transform/blockAnalyzer.js.map +1 -0
  138. package/dist/transform/index.d.ts +6 -0
  139. package/dist/transform/index.d.ts.map +1 -0
  140. package/dist/transform/index.js +4 -0
  141. package/dist/transform/index.js.map +1 -0
  142. package/dist/transform/registry.d.ts +19 -0
  143. package/dist/transform/registry.d.ts.map +1 -0
  144. package/dist/transform/registry.js +41 -0
  145. package/dist/transform/registry.js.map +1 -0
  146. package/dist/transform/styles/dataDriven.d.ts +4 -0
  147. package/dist/transform/styles/dataDriven.d.ts.map +1 -0
  148. package/dist/transform/styles/dataDriven.js +15 -0
  149. package/dist/transform/styles/dataDriven.js.map +1 -0
  150. package/dist/transform/styles/documentary.d.ts +4 -0
  151. package/dist/transform/styles/documentary.d.ts.map +1 -0
  152. package/dist/transform/styles/documentary.js +15 -0
  153. package/dist/transform/styles/documentary.js.map +1 -0
  154. package/dist/transform/styles/index.d.ts +6 -0
  155. package/dist/transform/styles/index.d.ts.map +1 -0
  156. package/dist/transform/styles/index.js +6 -0
  157. package/dist/transform/styles/index.js.map +1 -0
  158. package/dist/transform/styles/magazine.d.ts +4 -0
  159. package/dist/transform/styles/magazine.d.ts.map +1 -0
  160. package/dist/transform/styles/magazine.js +15 -0
  161. package/dist/transform/styles/magazine.js.map +1 -0
  162. package/dist/transform/styles/minimal.d.ts +4 -0
  163. package/dist/transform/styles/minimal.d.ts.map +1 -0
  164. package/dist/transform/styles/minimal.js +15 -0
  165. package/dist/transform/styles/minimal.js.map +1 -0
  166. package/dist/transform/styles/narrative.d.ts +4 -0
  167. package/dist/transform/styles/narrative.d.ts.map +1 -0
  168. package/dist/transform/styles/narrative.js +15 -0
  169. package/dist/transform/styles/narrative.js.map +1 -0
  170. package/dist/transform/templateSelector.d.ts +30 -0
  171. package/dist/transform/templateSelector.d.ts.map +1 -0
  172. package/dist/transform/templateSelector.js +218 -0
  173. package/dist/transform/templateSelector.js.map +1 -0
  174. package/dist/transform/timingAllocator.d.ts +21 -0
  175. package/dist/transform/timingAllocator.d.ts.map +1 -0
  176. package/dist/transform/timingAllocator.js +111 -0
  177. package/dist/transform/timingAllocator.js.map +1 -0
  178. package/dist/transform/types.d.ts +86 -0
  179. package/dist/transform/types.d.ts.map +1 -0
  180. package/dist/transform/types.js +9 -0
  181. package/dist/transform/types.js.map +1 -0
  182. package/dist/{types-DHiv_Pnm.d.ts → types-DYAzisMG.d.ts} +4 -2
  183. package/package.json +6 -1
  184. package/src/__tests__/contentContainer.test.ts +282 -0
  185. package/src/__tests__/markdownToDoc.test.ts +96 -0
  186. package/src/doc/audioMapping.ts +346 -0
  187. package/src/doc/index.ts +1 -0
  188. package/src/doc/markdownToDoc.ts +136 -2
  189. package/src/doc/templates/comparisonBar.ts +23 -5
  190. package/src/doc/templates/coverBlock.ts +3 -0
  191. package/src/doc/templates/dateEvent.ts +4 -0
  192. package/src/doc/templates/definitionCard.ts +4 -1
  193. package/src/doc/templates/factCard.ts +4 -0
  194. package/src/doc/templates/fullBleedQuote.ts +2 -1
  195. package/src/doc/templates/imageWithCaption.ts +4 -0
  196. package/src/doc/templates/listBlock.ts +3 -0
  197. package/src/doc/templates/mapBlock.ts +3 -0
  198. package/src/doc/templates/photoGrid.ts +3 -0
  199. package/src/doc/templates/pullQuote.ts +4 -0
  200. package/src/doc/templates/quoteBlock.ts +4 -0
  201. package/src/doc/templates/sectionHeader.ts +3 -2
  202. package/src/doc/templates/statHighlight.ts +4 -1
  203. package/src/doc/templates/titleBlock.ts +3 -0
  204. package/src/doc/templates/twoColumn.ts +7 -1
  205. package/src/doc/templates/videoPullQuote.ts +4 -0
  206. package/src/doc/templates/videoWithCaption.ts +3 -0
  207. package/src/doc/utils/themeUtils.ts +29 -0
  208. package/src/markdown/convert.ts +17 -7
  209. package/src/markdown/types.ts +4 -2
  210. package/src/schemas/BlockTemplates.ts +2 -2
  211. package/src/schemas/Doc.ts +60 -0
  212. package/src/schemas/themeLibrary.ts +95 -26
  213. package/src/storage/ContentContainer.ts +200 -0
  214. package/src/storage/MediaProviderFromContainer.ts +92 -0
  215. package/src/storage/index.ts +3 -0
  216. package/src/transform/applyTransform.ts +83 -0
  217. package/src/transform/blockAnalyzer.ts +181 -0
  218. package/src/transform/index.ts +20 -0
  219. package/src/transform/registry.ts +47 -0
  220. package/src/transform/styles/dataDriven.ts +16 -0
  221. package/src/transform/styles/documentary.ts +16 -0
  222. package/src/transform/styles/index.ts +5 -0
  223. package/src/transform/styles/magazine.ts +16 -0
  224. package/src/transform/styles/minimal.ts +16 -0
  225. package/src/transform/styles/narrative.ts +16 -0
  226. package/src/transform/templateSelector.ts +294 -0
  227. package/src/transform/timingAllocator.ts +126 -0
  228. package/src/transform/types.ts +105 -0
  229. package/dist/chunk-O5HCIUAD.js.map +0 -1
  230. package/dist/chunk-PJ7AODIM.js.map +0 -1
  231. package/dist/chunk-S4F2RY37.js.map +0 -1
  232. package/dist/chunk-URU6QMLY.js.map +0 -1
  233. package/dist/chunk-VJN7UB2Z.js +0 -145
  234. package/dist/chunk-VJN7UB2Z.js.map +0 -1
  235. package/dist/chunk-VP5SZTZ2.js.map +0 -1
  236. /package/dist/{chunk-6YJPI6VI.js.map → chunk-4X3JQXNM.js.map} +0 -0
@@ -19,11 +19,32 @@ import type { Theme, ThemeColorScheme } from './Theme.js';
19
19
  // Shared constants
20
20
  // ============================================
21
21
 
22
- const SERIF = '"PT Serif", Georgia, "Times New Roman", serif';
23
- const SANS = '"Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif';
24
- const MONO = '"JetBrains Mono", "Fira Code", "Consolas", monospace';
25
- const MERRIWEATHER = '"Merriweather", Georgia, "Times New Roman", serif';
26
- const GEORGIA = 'Georgia, "Times New Roman", serif';
22
+ // ── Font stacks ──────────────────────────────────────────────────
23
+ // Each stack lists the recommended Google Font first (works when the
24
+ // wrapping site loads it), then degrades to safe system fonts.
25
+ // Squisq itself does NOT load Google Fonts.
26
+
27
+ /** System fonts only — no external dependencies. */
28
+ const SYSTEM_SANS = 'system-ui, -apple-system, "Segoe UI", Roboto, sans-serif';
29
+ const SYSTEM_SERIF = 'Georgia, "Times New Roman", serif';
30
+ const SYSTEM_MONO = 'Consolas, "Courier New", monospace';
31
+
32
+ /** Theme-specific stacks with Google Font leads. */
33
+ const PLAYFAIR = '"Playfair Display", Georgia, serif';
34
+ const SOURCE_SERIF = '"Source Serif 4", "PT Serif", Georgia, serif';
35
+ const INTER = '"Inter", "Segoe UI", Roboto, sans-serif';
36
+ const OSWALD = '"Oswald", Impact, "Arial Black", sans-serif';
37
+ const ROBOTO = '"Roboto", "Segoe UI", Arial, sans-serif';
38
+ const MERRIWEATHER = '"Merriweather", Georgia, serif';
39
+ const LORA = '"Lora", "Merriweather", Georgia, serif';
40
+ const JETBRAINS_MONO = '"JetBrains Mono", "Fira Code", Consolas, monospace';
41
+ const IBM_PLEX_SANS = '"IBM Plex Sans", "Segoe UI", Roboto, sans-serif';
42
+ const DM_SERIF = '"DM Serif Display", Georgia, serif';
43
+ const DM_SANS = '"DM Sans", "Segoe UI", Roboto, sans-serif';
44
+ const CORMORANT = '"Cormorant Garamond", Garamond, Georgia, serif';
45
+ const CRIMSON = '"Crimson Text", Georgia, serif';
46
+ const PT_SERIF = '"PT Serif", Georgia, serif';
47
+ const HANKEN_GROTESK = '"Hanken Grotesk", system-ui, sans-serif';
27
48
 
28
49
  /** Standard 6-scheme set used by the documentary theme (migrated from old COLOR_SCHEMES). */
29
50
  const CLASSIC_COLOR_SCHEMES: Record<string, ThemeColorScheme> = {
@@ -36,13 +57,60 @@ const CLASSIC_COLOR_SCHEMES: Record<string, ThemeColorScheme> = {
36
57
  };
37
58
 
38
59
  // ============================================
39
- // 1. Documentary (default — migrated from old DEFAULT_THEME)
60
+ // 1. Standard (default — safe system fonts, no external dependencies)
61
+ // ============================================
62
+
63
+ const standard: Theme = {
64
+ id: 'standard',
65
+ name: 'Standard',
66
+ description: 'Clean and safe. System fonts only — no external font dependencies.',
67
+ colors: {
68
+ primary: '#3182ce',
69
+ secondary: '#4a5568',
70
+ background: '#1a202c',
71
+ backgroundLight: '#2d3748',
72
+ text: '#f7fafc',
73
+ textMuted: '#a0aec0',
74
+ highlight: '#4299e1',
75
+ warning: '#fc8181',
76
+ },
77
+ typography: {
78
+ bodyFontFamily: SYSTEM_SANS,
79
+ titleFontFamily: SYSTEM_SERIF,
80
+ monoFontFamily: SYSTEM_MONO,
81
+ titleWeight: 'bold',
82
+ },
83
+ style: {
84
+ textShadow: true,
85
+ overlayOpacity: 0.45,
86
+ animationSpeed: 1.0,
87
+ },
88
+ renderStyle: {
89
+ name: 'standard',
90
+ defaultTextAnimation: 'fadeIn',
91
+ defaultImageAnimation: 'slowZoom',
92
+ ambientMotion: true,
93
+ defaultTransition: { type: 'fade', duration: 0.7 },
94
+ },
95
+ colorSchemes: CLASSIC_COLOR_SCHEMES,
96
+ persistentLayers: {
97
+ bottomLayers: [
98
+ {
99
+ template: 'gradientBackground',
100
+ config: { type: 'gradientBackground', preset: 'dark-vignette' },
101
+ },
102
+ ],
103
+ },
104
+ };
105
+
106
+ // ============================================
107
+ // 2. Documentary
40
108
  // ============================================
41
109
 
42
110
  const documentary: Theme = {
43
111
  id: 'documentary',
44
112
  name: 'Documentary',
45
- description: 'Classic dark cinematic look with serif typography. The original Squisq style.',
113
+ description: 'Classic dark cinematic look with elegant serif typography.',
46
114
  colors: {
47
115
  primary: '#3d5a80',
48
116
  secondary: '#63b3ed',
@@ -54,8 +122,8 @@ const documentary: Theme = {
54
122
  warning: '#fc8181',
55
123
  },
56
124
  typography: {
57
- bodyFontFamily: SERIF,
58
- titleFontFamily: SERIF,
125
+ bodyFontFamily: SOURCE_SERIF,
126
+ titleFontFamily: PLAYFAIR,
59
127
  titleWeight: 'bold',
60
128
  },
61
129
  style: {
@@ -100,8 +168,8 @@ const minimalist: Theme = {
100
168
  warning: '#e53e3e',
101
169
  },
102
170
  typography: {
103
- bodyFontFamily: SANS,
104
- titleFontFamily: SANS,
171
+ bodyFontFamily: INTER,
172
+ titleFontFamily: INTER,
105
173
  titleWeight: 'bold',
106
174
  lineHeight: 1.6,
107
175
  },
@@ -149,8 +217,8 @@ const bold: Theme = {
149
217
  warning: '#fc8181',
150
218
  },
151
219
  typography: {
152
- bodyFontFamily: SANS,
153
- titleFontFamily: SANS,
220
+ bodyFontFamily: ROBOTO,
221
+ titleFontFamily: OSWALD,
154
222
  titleWeight: 'bold',
155
223
  titleScale: 1.15,
156
224
  bodyScale: 1.0,
@@ -201,7 +269,7 @@ const morningLight: Theme = {
201
269
  warning: '#c53030',
202
270
  },
203
271
  typography: {
204
- bodyFontFamily: MERRIWEATHER,
272
+ bodyFontFamily: LORA,
205
273
  titleFontFamily: MERRIWEATHER,
206
274
  titleWeight: 'bold',
207
275
  lineHeight: 1.7,
@@ -247,9 +315,9 @@ const techDark: Theme = {
247
315
  warning: '#ff5252',
248
316
  },
249
317
  typography: {
250
- bodyFontFamily: SANS,
251
- titleFontFamily: MONO,
252
- monoFontFamily: MONO,
318
+ bodyFontFamily: IBM_PLEX_SANS,
319
+ titleFontFamily: JETBRAINS_MONO,
320
+ monoFontFamily: JETBRAINS_MONO,
253
321
  titleWeight: 'bold',
254
322
  titleScale: 0.9,
255
323
  lineHeight: 1.5,
@@ -299,8 +367,8 @@ const magazine: Theme = {
299
367
  warning: '#fc8181',
300
368
  },
301
369
  typography: {
302
- bodyFontFamily: SANS,
303
- titleFontFamily: GEORGIA,
370
+ bodyFontFamily: DM_SANS,
371
+ titleFontFamily: DM_SERIF,
304
372
  titleWeight: 'bold',
305
373
  titleScale: 1.05,
306
374
  lineHeight: 1.5,
@@ -347,8 +415,8 @@ const cinematic: Theme = {
347
415
  warning: '#fc8181',
348
416
  },
349
417
  typography: {
350
- bodyFontFamily: SERIF,
351
- titleFontFamily: SERIF,
418
+ bodyFontFamily: CRIMSON,
419
+ titleFontFamily: CORMORANT,
352
420
  titleWeight: 'bold',
353
421
  lineHeight: 1.5,
354
422
  titleLineHeight: 1.2,
@@ -405,8 +473,8 @@ const warmEarth: Theme = {
405
473
  warning: '#e53e3e',
406
474
  },
407
475
  typography: {
408
- bodyFontFamily: GEORGIA,
409
- titleFontFamily: GEORGIA,
476
+ bodyFontFamily: HANKEN_GROTESK,
477
+ titleFontFamily: PT_SERIF,
410
478
  titleWeight: 'bold',
411
479
  lineHeight: 1.6,
412
480
  },
@@ -448,6 +516,7 @@ const warmEarth: Theme = {
448
516
  * All built-in themes, keyed by id.
449
517
  */
450
518
  export const THEMES: Record<string, Theme> = {
519
+ standard,
451
520
  documentary,
452
521
  minimalist,
453
522
  bold,
@@ -459,10 +528,10 @@ export const THEMES: Record<string, Theme> = {
459
528
  };
460
529
 
461
530
  /** The default theme id. */
462
- export const DEFAULT_THEME_ID = 'documentary';
531
+ export const DEFAULT_THEME_ID = 'standard';
463
532
 
464
- /** The default theme (documentarymigrated from old DEFAULT_THEME). */
465
- export const DEFAULT_THEME: Theme = documentary;
533
+ /** The default theme (standardsafe system fonts, no external dependencies). */
534
+ export const DEFAULT_THEME: Theme = standard;
466
535
 
467
536
  /**
468
537
  * Resolve a theme by id. Returns the default theme when `id` is
@@ -0,0 +1,200 @@
1
+ /**
2
+ * ContentContainer — virtual file system for document containers.
3
+ *
4
+ * A Squisq document is more than just markdown: it's a container of files
5
+ * including the primary markdown document, images, audio, timing data, and
6
+ * other media. ContentContainer provides an abstract async file system
7
+ * interface for reading, writing, and listing these files.
8
+ *
9
+ * Paths are forward-slash separated strings relative to the container root
10
+ * (e.g., 'images/hero.jpg', 'index.md'). No leading slash.
11
+ *
12
+ * Implementations:
13
+ * - MemoryContentContainer — in-memory Map (for zip import, tests, transient use)
14
+ * - SlotContentContainer — backed by IndexedDB slot storage (in the site package)
15
+ */
16
+
17
+ /**
18
+ * Metadata about a file in a ContentContainer.
19
+ */
20
+ export interface ContentEntry {
21
+ /** Relative path within the container (e.g., 'images/hero.jpg') */
22
+ path: string;
23
+ /** MIME type (e.g., 'image/jpeg') */
24
+ mimeType: string;
25
+ /** File size in bytes */
26
+ size: number;
27
+ }
28
+
29
+ /**
30
+ * Abstract async file system for document containers.
31
+ *
32
+ * All paths are forward-slash separated, relative to the container root,
33
+ * with no leading slash. Example: 'images/hero.jpg', 'index.md'.
34
+ */
35
+ export interface ContentContainer {
36
+ /** Read a file's binary content. Returns null if the file does not exist. */
37
+ readFile(path: string): Promise<ArrayBuffer | null>;
38
+
39
+ /** Write a file. Creates or overwrites. */
40
+ writeFile(path: string, data: ArrayBuffer | Uint8Array, mimeType?: string): Promise<void>;
41
+
42
+ /** Remove a file. No-op if the file does not exist. */
43
+ removeFile(path: string): Promise<void>;
44
+
45
+ /**
46
+ * List files in the container.
47
+ * @param prefix — Optional path prefix to filter by (e.g., 'images/')
48
+ */
49
+ listFiles(prefix?: string): Promise<ContentEntry[]>;
50
+
51
+ /** Check whether a file exists. */
52
+ exists(path: string): Promise<boolean>;
53
+
54
+ /**
55
+ * Find the primary markdown document path.
56
+ *
57
+ * Discovery order: index.md → doc.md → document.md → first *.md at root.
58
+ * Returns null if no markdown file is found at the root level.
59
+ */
60
+ getDocumentPath(): Promise<string | null>;
61
+
62
+ /**
63
+ * Convenience: read the primary markdown document as a UTF-8 string.
64
+ * Returns null if no markdown file is found.
65
+ */
66
+ readDocument(): Promise<string | null>;
67
+
68
+ /**
69
+ * Convenience: write a markdown document.
70
+ * @param markdown — The markdown content
71
+ * @param filename — Filename to use (defaults to 'index.md')
72
+ */
73
+ writeDocument(markdown: string, filename?: string): Promise<void>;
74
+ }
75
+
76
+ // ============================================
77
+ // Well-known markdown filenames in priority order
78
+ // ============================================
79
+
80
+ const MARKDOWN_PRIORITY = ['index.md', 'doc.md', 'document.md'];
81
+
82
+ /**
83
+ * Find the primary markdown path from a list of file entries.
84
+ * Exported for reuse by other ContentContainer implementations.
85
+ */
86
+ export function findDocumentPath(entries: ContentEntry[]): string | null {
87
+ // Only consider root-level files (no '/' in path)
88
+ const rootFiles = entries.filter((e) => !e.path.includes('/'));
89
+
90
+ for (const name of MARKDOWN_PRIORITY) {
91
+ if (rootFiles.some((e) => e.path.toLowerCase() === name)) {
92
+ return name;
93
+ }
94
+ }
95
+
96
+ // Fallback: first .md file at root
97
+ const firstMd = rootFiles.find((e) => e.path.toLowerCase().endsWith('.md'));
98
+ return firstMd?.path ?? null;
99
+ }
100
+
101
+ // ============================================
102
+ // MemoryContentContainer
103
+ // ============================================
104
+
105
+ interface MemoryFile {
106
+ data: ArrayBuffer;
107
+ mimeType: string;
108
+ }
109
+
110
+ /**
111
+ * In-memory ContentContainer backed by a Map.
112
+ *
113
+ * Used for zip import (deserialize into memory), tests, and transient operations.
114
+ */
115
+ export class MemoryContentContainer implements ContentContainer {
116
+ private files = new Map<string, MemoryFile>();
117
+
118
+ async readFile(path: string): Promise<ArrayBuffer | null> {
119
+ return this.files.get(path)?.data ?? null;
120
+ }
121
+
122
+ async writeFile(path: string, data: ArrayBuffer | Uint8Array, mimeType?: string): Promise<void> {
123
+ const buffer = data instanceof ArrayBuffer ? data : data.slice().buffer;
124
+ this.files.set(path, {
125
+ data: buffer,
126
+ mimeType: mimeType ?? guessMimeType(path),
127
+ });
128
+ }
129
+
130
+ async removeFile(path: string): Promise<void> {
131
+ this.files.delete(path);
132
+ }
133
+
134
+ async listFiles(prefix?: string): Promise<ContentEntry[]> {
135
+ const entries: ContentEntry[] = [];
136
+ for (const [path, file] of this.files) {
137
+ if (prefix && !path.startsWith(prefix)) continue;
138
+ entries.push({
139
+ path,
140
+ mimeType: file.mimeType,
141
+ size: file.data.byteLength,
142
+ });
143
+ }
144
+ return entries;
145
+ }
146
+
147
+ async exists(path: string): Promise<boolean> {
148
+ return this.files.has(path);
149
+ }
150
+
151
+ async getDocumentPath(): Promise<string | null> {
152
+ return findDocumentPath(await this.listFiles());
153
+ }
154
+
155
+ async readDocument(): Promise<string | null> {
156
+ const docPath = await this.getDocumentPath();
157
+ if (!docPath) return null;
158
+ const data = await this.readFile(docPath);
159
+ if (!data) return null;
160
+ return new TextDecoder().decode(data);
161
+ }
162
+
163
+ async writeDocument(markdown: string, filename?: string): Promise<void> {
164
+ const name = filename ?? 'index.md';
165
+ const data = new TextEncoder().encode(markdown);
166
+ await this.writeFile(name, data, 'text/markdown');
167
+ }
168
+ }
169
+
170
+ // ============================================
171
+ // MIME type guessing
172
+ // ============================================
173
+
174
+ const EXTENSION_MIME_MAP: Record<string, string> = {
175
+ '.md': 'text/markdown',
176
+ '.txt': 'text/plain',
177
+ '.json': 'application/json',
178
+ '.jpg': 'image/jpeg',
179
+ '.jpeg': 'image/jpeg',
180
+ '.png': 'image/png',
181
+ '.gif': 'image/gif',
182
+ '.svg': 'image/svg+xml',
183
+ '.webp': 'image/webp',
184
+ '.avif': 'image/avif',
185
+ '.mp4': 'video/mp4',
186
+ '.webm': 'video/webm',
187
+ '.mp3': 'audio/mpeg',
188
+ '.wav': 'audio/wav',
189
+ '.ogg': 'audio/ogg',
190
+ '.css': 'text/css',
191
+ '.html': 'text/html',
192
+ '.js': 'application/javascript',
193
+ };
194
+
195
+ function guessMimeType(path: string): string {
196
+ const dot = path.lastIndexOf('.');
197
+ if (dot === -1) return 'application/octet-stream';
198
+ const ext = path.slice(dot).toLowerCase();
199
+ return EXTENSION_MIME_MAP[ext] ?? 'application/octet-stream';
200
+ }
@@ -0,0 +1,92 @@
1
+ /**
2
+ * MediaProviderFromContainer — bridges ContentContainer to MediaProvider.
3
+ *
4
+ * Creates a MediaProvider that resolves relative paths by reading binary data
5
+ * from a ContentContainer and generating blob URLs. Blob URLs are cached and
6
+ * revoked on dispose().
7
+ *
8
+ * This allows any ContentContainer (memory, slot-backed, zip-loaded) to be
9
+ * used with existing rendering components (DocPlayer, ImageLayer, VideoLayer)
10
+ * that consume MediaProvider.
11
+ */
12
+
13
+ import type { MediaProvider, MediaEntry } from '../schemas/MediaProvider.js';
14
+ import type { ContentContainer } from './ContentContainer.js';
15
+
16
+ /**
17
+ * Create a MediaProvider backed by a ContentContainer.
18
+ *
19
+ * @param container — The ContentContainer to read/write media from
20
+ * @returns A MediaProvider that resolves paths to blob URLs
21
+ */
22
+ export function createMediaProviderFromContainer(container: ContentContainer): MediaProvider {
23
+ const blobUrlCache = new Map<string, string>();
24
+
25
+ return {
26
+ async resolveUrl(relativePath: string): Promise<string> {
27
+ const cached = blobUrlCache.get(relativePath);
28
+ if (cached) return cached;
29
+
30
+ const data = await container.readFile(relativePath);
31
+ if (!data) return relativePath;
32
+
33
+ const entries = await container.listFiles();
34
+ const entry = entries.find((e) => e.path === relativePath);
35
+ const mimeType = entry?.mimeType ?? 'application/octet-stream';
36
+
37
+ const blob = new Blob([data], { type: mimeType });
38
+ const url = URL.createObjectURL(blob);
39
+ blobUrlCache.set(relativePath, url);
40
+ return url;
41
+ },
42
+
43
+ async listMedia(): Promise<MediaEntry[]> {
44
+ const entries = await container.listFiles();
45
+ return entries
46
+ .filter((e) => !e.path.toLowerCase().endsWith('.md'))
47
+ .map((e) => ({
48
+ name: e.path,
49
+ mimeType: e.mimeType,
50
+ size: e.size,
51
+ }));
52
+ },
53
+
54
+ async addMedia(
55
+ name: string,
56
+ data: ArrayBuffer | Blob | Uint8Array,
57
+ mimeType: string,
58
+ ): Promise<string> {
59
+ // Invalidate any cached blob URL for this path before overwriting
60
+ const cached = blobUrlCache.get(name);
61
+ if (cached) {
62
+ URL.revokeObjectURL(cached);
63
+ blobUrlCache.delete(name);
64
+ }
65
+
66
+ let buffer: ArrayBuffer | Uint8Array;
67
+ if (data instanceof Blob) {
68
+ buffer = await data.arrayBuffer();
69
+ } else {
70
+ buffer = data;
71
+ }
72
+ await container.writeFile(name, buffer, mimeType);
73
+ return name;
74
+ },
75
+
76
+ async removeMedia(relativePath: string): Promise<void> {
77
+ const cached = blobUrlCache.get(relativePath);
78
+ if (cached) {
79
+ URL.revokeObjectURL(cached);
80
+ blobUrlCache.delete(relativePath);
81
+ }
82
+ await container.removeFile(relativePath);
83
+ },
84
+
85
+ dispose(): void {
86
+ for (const url of blobUrlCache.values()) {
87
+ URL.revokeObjectURL(url);
88
+ }
89
+ blobUrlCache.clear();
90
+ },
91
+ };
92
+ }
@@ -3,3 +3,6 @@ export { MemoryStorageAdapter } from './MemoryStorageAdapter.js';
3
3
  export { LocalStorageAdapter } from './LocalStorageAdapter.js';
4
4
  export { LocalForageAdapter } from './LocalForageAdapter.js';
5
5
  export type { LocalForageAdapterOptions } from './LocalForageAdapter.js';
6
+ export type { ContentContainer, ContentEntry } from './ContentContainer.js';
7
+ export { MemoryContentContainer, findDocumentPath } from './ContentContainer.js';
8
+ export { createMediaProviderFromContainer } from './MediaProviderFromContainer.js';
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Apply Transform
3
+ *
4
+ * Main entry point for the transform module. Takes a Doc and a style,
5
+ * analyzes block content, selects extractions to promote, and returns
6
+ * a new Doc with blocks optimized for visual presentation.
7
+ *
8
+ * The input Doc is never mutated — a fresh Doc is always returned.
9
+ */
10
+
11
+ import type { Doc } from '../schemas/Doc.js';
12
+ import type { TransformStyleId, TransformOptions, TransformResult } from './types.js';
13
+ import { resolveTransformStyle } from './registry.js';
14
+ import { analyzeBlocks, extractDocImages } from './blockAnalyzer.js';
15
+ import { selectAndBuild } from './templateSelector.js';
16
+ import { allocateTiming } from './timingAllocator.js';
17
+ import { hashString } from '../random/SeededRandom.js';
18
+
19
+ /**
20
+ * Apply a transform style to a Doc, producing a new Doc with blocks
21
+ * optimized for visual presentation.
22
+ *
23
+ * @param doc - The source Doc (not mutated).
24
+ * @param styleId - Registered transform style id (e.g. 'documentary', 'magazine').
25
+ * @param options - Optional seed, images, theme override.
26
+ * @returns TransformResult with the new Doc and stats.
27
+ */
28
+ export function applyTransform(
29
+ doc: Doc,
30
+ styleId: TransformStyleId,
31
+ options?: TransformOptions,
32
+ ): TransformResult {
33
+ const baseConfig = resolveTransformStyle(styleId);
34
+ const config = options?.overrides
35
+ ? { ...baseConfig, ...options.overrides, id: baseConfig.id }
36
+ : baseConfig;
37
+
38
+ const seed = options?.seed ?? hashString(doc.articleId || 'transform');
39
+
40
+ // Use provided images or auto-extract from the doc's markdown content
41
+ const images = options?.images ?? extractDocImages(doc.blocks);
42
+
43
+ // 1. Analyze blocks
44
+ const analyzed = analyzeBlocks(doc.blocks, {
45
+ minConfidence: config.minConfidence,
46
+ types: config.preferredTypes,
47
+ });
48
+
49
+ // If no blocks have meaningful content, return the doc unchanged
50
+ const hasContent = analyzed.some((ab) => ab.bodyWordCount >= 5);
51
+ if (!hasContent) {
52
+ return {
53
+ doc: { ...doc },
54
+ stats: {
55
+ totalInputBlocks: doc.blocks.length,
56
+ transformedBlocks: 0,
57
+ insertedBlocks: 0,
58
+ },
59
+ };
60
+ }
61
+
62
+ // 2. Select extractions and build template blocks
63
+ const selection = selectAndBuild(analyzed, config, images, seed);
64
+
65
+ // 3. Allocate timing across the new block sequence
66
+ const timedBlocks = allocateTiming(selection.blocks, doc.duration);
67
+
68
+ // 4. Assemble the output Doc
69
+ const transformedDoc: Doc = {
70
+ ...doc,
71
+ blocks: timedBlocks,
72
+ themeId: options?.themeId ?? doc.themeId,
73
+ };
74
+
75
+ return {
76
+ doc: transformedDoc,
77
+ stats: {
78
+ totalInputBlocks: doc.blocks.length,
79
+ transformedBlocks: selection.transformedCount,
80
+ insertedBlocks: selection.insertedCount,
81
+ },
82
+ };
83
+ }