@bendyline/squisq 0.1.1 → 1.0.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 (329) hide show
  1. package/README.md +85 -0
  2. package/dist/{themeLibrary-DySHPcgj.d.ts → Doc-1hmT1LZl.d.ts} +1 -42
  3. package/dist/__tests__/animationUtils.test.d.ts +2 -0
  4. package/dist/__tests__/animationUtils.test.d.ts.map +1 -0
  5. package/dist/__tests__/animationUtils.test.js +60 -0
  6. package/dist/__tests__/animationUtils.test.js.map +1 -0
  7. package/dist/__tests__/contentExtractor.test.d.ts +2 -0
  8. package/dist/__tests__/contentExtractor.test.d.ts.map +1 -0
  9. package/dist/__tests__/contentExtractor.test.js +151 -0
  10. package/dist/__tests__/contentExtractor.test.js.map +1 -0
  11. package/dist/__tests__/geohash.test.d.ts +2 -0
  12. package/dist/__tests__/geohash.test.d.ts.map +1 -0
  13. package/dist/__tests__/geohash.test.js +87 -0
  14. package/dist/__tests__/geohash.test.js.map +1 -0
  15. package/dist/__tests__/getLayers.test.d.ts +2 -0
  16. package/dist/__tests__/getLayers.test.d.ts.map +1 -0
  17. package/dist/__tests__/getLayers.test.js +167 -0
  18. package/dist/__tests__/getLayers.test.js.map +1 -0
  19. package/dist/__tests__/haversine.test.d.ts +2 -0
  20. package/dist/__tests__/haversine.test.d.ts.map +1 -0
  21. package/dist/__tests__/haversine.test.js +56 -0
  22. package/dist/__tests__/haversine.test.js.map +1 -0
  23. package/dist/__tests__/localForageAdapter.test.d.ts +8 -0
  24. package/dist/__tests__/localForageAdapter.test.d.ts.map +1 -0
  25. package/dist/__tests__/localForageAdapter.test.js +130 -0
  26. package/dist/__tests__/localForageAdapter.test.js.map +1 -0
  27. package/dist/__tests__/markdown.test.d.ts +2 -0
  28. package/dist/__tests__/markdown.test.d.ts.map +1 -0
  29. package/dist/__tests__/markdown.test.js +654 -0
  30. package/dist/__tests__/markdown.test.js.map +1 -0
  31. package/dist/__tests__/markdownToDoc.test.d.ts +2 -0
  32. package/dist/__tests__/markdownToDoc.test.d.ts.map +1 -0
  33. package/dist/__tests__/markdownToDoc.test.js +313 -0
  34. package/dist/__tests__/markdownToDoc.test.js.map +1 -0
  35. package/dist/__tests__/seededRandom.test.d.ts +2 -0
  36. package/dist/__tests__/seededRandom.test.d.ts.map +1 -0
  37. package/dist/__tests__/seededRandom.test.js +125 -0
  38. package/dist/__tests__/seededRandom.test.js.map +1 -0
  39. package/dist/__tests__/slideshowGenerator.test.d.ts +2 -0
  40. package/dist/__tests__/slideshowGenerator.test.d.ts.map +1 -0
  41. package/dist/__tests__/slideshowGenerator.test.js +114 -0
  42. package/dist/__tests__/slideshowGenerator.test.js.map +1 -0
  43. package/dist/__tests__/storage.test.d.ts +2 -0
  44. package/dist/__tests__/storage.test.d.ts.map +1 -0
  45. package/dist/__tests__/storage.test.js +51 -0
  46. package/dist/__tests__/storage.test.js.map +1 -0
  47. package/dist/__tests__/templates.test.d.ts +2 -0
  48. package/dist/__tests__/templates.test.d.ts.map +1 -0
  49. package/dist/__tests__/templates.test.js +217 -0
  50. package/dist/__tests__/templates.test.js.map +1 -0
  51. package/dist/__tests__/timing.test.d.ts +2 -0
  52. package/dist/__tests__/timing.test.d.ts.map +1 -0
  53. package/dist/__tests__/timing.test.js +131 -0
  54. package/dist/__tests__/timing.test.js.map +1 -0
  55. package/dist/chunk-3E5F2XMR.js +129 -0
  56. package/dist/chunk-3E5F2XMR.js.map +1 -0
  57. package/dist/chunk-6YJPI6VI.js +35 -0
  58. package/dist/chunk-6YJPI6VI.js.map +1 -0
  59. package/dist/chunk-FVTQSNR7.js +100 -0
  60. package/dist/chunk-FVTQSNR7.js.map +1 -0
  61. package/dist/chunk-V543AI2F.js +1 -0
  62. package/dist/chunk-V543AI2F.js.map +1 -0
  63. package/dist/chunk-VP5SZTZ2.js +792 -0
  64. package/dist/chunk-VP5SZTZ2.js.map +1 -0
  65. package/dist/doc/docToMarkdown.d.ts +41 -0
  66. package/dist/doc/docToMarkdown.d.ts.map +1 -0
  67. package/dist/doc/docToMarkdown.js +88 -0
  68. package/dist/doc/docToMarkdown.js.map +1 -0
  69. package/dist/doc/getLayers.d.ts +65 -0
  70. package/dist/doc/getLayers.d.ts.map +1 -0
  71. package/dist/doc/getLayers.js +103 -0
  72. package/dist/doc/getLayers.js.map +1 -0
  73. package/dist/doc/index.d.ts +9 -3
  74. package/dist/doc/index.d.ts.map +1 -0
  75. package/dist/doc/index.js +6 -125
  76. package/dist/doc/index.js.map +1 -1
  77. package/dist/doc/markdownToDoc.d.ts +68 -0
  78. package/dist/doc/markdownToDoc.d.ts.map +1 -0
  79. package/dist/doc/markdownToDoc.js +225 -0
  80. package/dist/doc/markdownToDoc.js.map +1 -0
  81. package/dist/doc/templates/accentImage.d.ts +59 -0
  82. package/dist/doc/templates/accentImage.d.ts.map +1 -0
  83. package/dist/doc/templates/accentImage.js +275 -0
  84. package/dist/doc/templates/accentImage.js.map +1 -0
  85. package/dist/doc/templates/captionUtils.d.ts +20 -0
  86. package/dist/doc/templates/captionUtils.d.ts.map +1 -0
  87. package/dist/doc/templates/captionUtils.js +29 -0
  88. package/dist/doc/templates/captionUtils.js.map +1 -0
  89. package/dist/doc/templates/comparisonBar.d.ts +13 -0
  90. package/dist/doc/templates/comparisonBar.d.ts.map +1 -0
  91. package/dist/doc/templates/comparisonBar.js +127 -0
  92. package/dist/doc/templates/comparisonBar.js.map +1 -0
  93. package/dist/doc/templates/coverBlock.d.ts +51 -0
  94. package/dist/doc/templates/coverBlock.d.ts.map +1 -0
  95. package/dist/doc/templates/coverBlock.js +125 -0
  96. package/dist/doc/templates/coverBlock.js.map +1 -0
  97. package/dist/doc/templates/dateEvent.d.ts +15 -0
  98. package/dist/doc/templates/dateEvent.d.ts.map +1 -0
  99. package/dist/doc/templates/dateEvent.js +110 -0
  100. package/dist/doc/templates/dateEvent.js.map +1 -0
  101. package/dist/doc/templates/definitionCard.d.ts +13 -0
  102. package/dist/doc/templates/definitionCard.d.ts.map +1 -0
  103. package/dist/doc/templates/definitionCard.js +114 -0
  104. package/dist/doc/templates/definitionCard.js.map +1 -0
  105. package/dist/doc/templates/factCard.d.ts +15 -0
  106. package/dist/doc/templates/factCard.d.ts.map +1 -0
  107. package/dist/doc/templates/factCard.js +100 -0
  108. package/dist/doc/templates/factCard.js.map +1 -0
  109. package/dist/doc/templates/fullBleedQuote.d.ts +13 -0
  110. package/dist/doc/templates/fullBleedQuote.d.ts.map +1 -0
  111. package/dist/doc/templates/fullBleedQuote.js +54 -0
  112. package/dist/doc/templates/fullBleedQuote.js.map +1 -0
  113. package/dist/doc/templates/imageWithCaption.d.ts +13 -0
  114. package/dist/doc/templates/imageWithCaption.d.ts.map +1 -0
  115. package/dist/doc/templates/imageWithCaption.js +142 -0
  116. package/dist/doc/templates/imageWithCaption.js.map +1 -0
  117. package/dist/doc/templates/index.d.ts +104 -0
  118. package/dist/doc/templates/index.d.ts.map +1 -0
  119. package/dist/doc/templates/index.js +442 -0
  120. package/dist/doc/templates/index.js.map +1 -0
  121. package/dist/doc/templates/listBlock.d.ts +13 -0
  122. package/dist/doc/templates/listBlock.d.ts.map +1 -0
  123. package/dist/doc/templates/listBlock.js +89 -0
  124. package/dist/doc/templates/listBlock.js.map +1 -0
  125. package/dist/doc/templates/mapBlock.d.ts +17 -0
  126. package/dist/doc/templates/mapBlock.d.ts.map +1 -0
  127. package/dist/doc/templates/mapBlock.js +112 -0
  128. package/dist/doc/templates/mapBlock.js.map +1 -0
  129. package/dist/doc/templates/persistentLayers.d.ts +39 -0
  130. package/dist/doc/templates/persistentLayers.d.ts.map +1 -0
  131. package/dist/doc/templates/persistentLayers.js +447 -0
  132. package/dist/doc/templates/persistentLayers.js.map +1 -0
  133. package/dist/doc/templates/photoGrid.d.ts +20 -0
  134. package/dist/doc/templates/photoGrid.d.ts.map +1 -0
  135. package/dist/doc/templates/photoGrid.js +172 -0
  136. package/dist/doc/templates/photoGrid.js.map +1 -0
  137. package/dist/doc/templates/pullQuote.d.ts +13 -0
  138. package/dist/doc/templates/pullQuote.d.ts.map +1 -0
  139. package/dist/doc/templates/pullQuote.js +109 -0
  140. package/dist/doc/templates/pullQuote.js.map +1 -0
  141. package/dist/doc/templates/quoteBlock.d.ts +15 -0
  142. package/dist/doc/templates/quoteBlock.d.ts.map +1 -0
  143. package/dist/doc/templates/quoteBlock.js +97 -0
  144. package/dist/doc/templates/quoteBlock.js.map +1 -0
  145. package/dist/doc/templates/sectionHeader.d.ts +14 -0
  146. package/dist/doc/templates/sectionHeader.d.ts.map +1 -0
  147. package/dist/doc/templates/sectionHeader.js +96 -0
  148. package/dist/doc/templates/sectionHeader.js.map +1 -0
  149. package/dist/doc/templates/statHighlight.d.ts +15 -0
  150. package/dist/doc/templates/statHighlight.d.ts.map +1 -0
  151. package/dist/doc/templates/statHighlight.js +99 -0
  152. package/dist/doc/templates/statHighlight.js.map +1 -0
  153. package/dist/doc/templates/titleBlock.d.ts +13 -0
  154. package/dist/doc/templates/titleBlock.d.ts.map +1 -0
  155. package/dist/doc/templates/titleBlock.js +92 -0
  156. package/dist/doc/templates/titleBlock.js.map +1 -0
  157. package/dist/doc/templates/twoColumn.d.ts +15 -0
  158. package/dist/doc/templates/twoColumn.d.ts.map +1 -0
  159. package/dist/doc/templates/twoColumn.js +219 -0
  160. package/dist/doc/templates/twoColumn.js.map +1 -0
  161. package/dist/doc/templates/videoPullQuote.d.ts +20 -0
  162. package/dist/doc/templates/videoPullQuote.d.ts.map +1 -0
  163. package/dist/doc/templates/videoPullQuote.js +118 -0
  164. package/dist/doc/templates/videoPullQuote.js.map +1 -0
  165. package/dist/doc/templates/videoWithCaption.d.ts +20 -0
  166. package/dist/doc/templates/videoWithCaption.d.ts.map +1 -0
  167. package/dist/doc/templates/videoWithCaption.js +104 -0
  168. package/dist/doc/templates/videoWithCaption.js.map +1 -0
  169. package/dist/doc/utils/animationUtils.d.ts +34 -0
  170. package/dist/doc/utils/animationUtils.d.ts.map +1 -0
  171. package/dist/doc/utils/animationUtils.js +110 -0
  172. package/dist/doc/utils/animationUtils.js.map +1 -0
  173. package/dist/doc/utils/themeUtils.d.ts +55 -0
  174. package/dist/doc/utils/themeUtils.d.ts.map +1 -0
  175. package/dist/doc/utils/themeUtils.js +109 -0
  176. package/dist/doc/utils/themeUtils.js.map +1 -0
  177. package/dist/generate/contentExtractor.d.ts +112 -0
  178. package/dist/generate/contentExtractor.d.ts.map +1 -0
  179. package/dist/generate/contentExtractor.js +638 -0
  180. package/dist/generate/contentExtractor.js.map +1 -0
  181. package/dist/generate/index.d.ts +7 -0
  182. package/dist/generate/index.d.ts.map +1 -0
  183. package/dist/generate/index.js +4 -0
  184. package/dist/generate/index.js.map +1 -0
  185. package/dist/generate/slideshowGenerator.d.ts +72 -0
  186. package/dist/generate/slideshowGenerator.d.ts.map +1 -0
  187. package/dist/generate/slideshowGenerator.js +159 -0
  188. package/dist/generate/slideshowGenerator.js.map +1 -0
  189. package/dist/generate/templateMapper.d.ts +23 -0
  190. package/dist/generate/templateMapper.d.ts.map +1 -0
  191. package/dist/generate/templateMapper.js +114 -0
  192. package/dist/generate/templateMapper.js.map +1 -0
  193. package/dist/index.d.ts +9 -8
  194. package/dist/index.d.ts.map +1 -0
  195. package/dist/index.js +8 -216
  196. package/dist/index.js.map +1 -1
  197. package/dist/markdown/convert.d.ts +71 -0
  198. package/dist/markdown/convert.d.ts.map +1 -0
  199. package/dist/markdown/convert.js +746 -0
  200. package/dist/markdown/convert.js.map +1 -0
  201. package/dist/markdown/htmlParse.d.ts +26 -0
  202. package/dist/markdown/htmlParse.d.ts.map +1 -0
  203. package/dist/markdown/htmlParse.js +195 -0
  204. package/dist/markdown/htmlParse.js.map +1 -0
  205. package/dist/markdown/index.d.ts +19 -225
  206. package/dist/markdown/index.d.ts.map +1 -0
  207. package/dist/markdown/index.js +33 -32
  208. package/dist/markdown/index.js.map +1 -1
  209. package/dist/markdown/parse.d.ts +27 -0
  210. package/dist/markdown/parse.d.ts.map +1 -0
  211. package/dist/markdown/parse.js +90 -0
  212. package/dist/markdown/parse.js.map +1 -0
  213. package/dist/markdown/stringify.d.ts +32 -0
  214. package/dist/markdown/stringify.d.ts.map +1 -0
  215. package/dist/markdown/stringify.js +108 -0
  216. package/dist/markdown/stringify.js.map +1 -0
  217. package/dist/markdown/types.d.ts +496 -0
  218. package/dist/markdown/types.d.ts.map +1 -0
  219. package/dist/markdown/types.js +17 -0
  220. package/dist/markdown/types.js.map +1 -0
  221. package/dist/markdown/utils.d.ts +78 -0
  222. package/dist/markdown/utils.d.ts.map +1 -0
  223. package/dist/markdown/utils.js +149 -0
  224. package/dist/markdown/utils.js.map +1 -0
  225. package/dist/random/SeededRandom.d.ts +50 -0
  226. package/dist/random/SeededRandom.d.ts.map +1 -0
  227. package/dist/random/SeededRandom.js +115 -0
  228. package/dist/random/SeededRandom.js.map +1 -0
  229. package/dist/random/index.d.ts +2 -0
  230. package/dist/random/index.d.ts.map +1 -0
  231. package/dist/random/index.js +2 -0
  232. package/dist/random/index.js.map +1 -0
  233. package/dist/schemas/BlockTemplates.d.ts +583 -0
  234. package/dist/schemas/BlockTemplates.d.ts.map +1 -0
  235. package/dist/schemas/BlockTemplates.js +72 -0
  236. package/dist/schemas/BlockTemplates.js.map +1 -0
  237. package/dist/schemas/Doc.d.ts +411 -0
  238. package/dist/schemas/Doc.d.ts.map +1 -0
  239. package/dist/schemas/Doc.js +90 -0
  240. package/dist/schemas/Doc.js.map +1 -0
  241. package/dist/schemas/LayoutStrategy.d.ts +84 -0
  242. package/dist/schemas/LayoutStrategy.d.ts.map +1 -0
  243. package/dist/schemas/LayoutStrategy.js +123 -0
  244. package/dist/schemas/LayoutStrategy.js.map +1 -0
  245. package/dist/schemas/MediaProvider.d.ts +65 -0
  246. package/dist/schemas/MediaProvider.d.ts.map +1 -0
  247. package/dist/schemas/MediaProvider.js +13 -0
  248. package/dist/schemas/MediaProvider.js.map +1 -0
  249. package/dist/schemas/Theme.d.ts +163 -0
  250. package/dist/schemas/Theme.d.ts.map +1 -0
  251. package/dist/schemas/Theme.js +62 -0
  252. package/dist/schemas/Theme.js.map +1 -0
  253. package/dist/schemas/Types.d.ts +14 -0
  254. package/dist/schemas/Types.d.ts.map +1 -0
  255. package/dist/schemas/Types.js +5 -0
  256. package/dist/schemas/Types.js.map +1 -0
  257. package/dist/schemas/Viewport.d.ts +74 -0
  258. package/dist/schemas/Viewport.d.ts.map +1 -0
  259. package/dist/schemas/Viewport.js +63 -0
  260. package/dist/schemas/Viewport.js.map +1 -0
  261. package/dist/schemas/index.d.ts +10 -70
  262. package/dist/schemas/index.d.ts.map +1 -0
  263. package/dist/schemas/index.js +7 -60
  264. package/dist/schemas/index.js.map +1 -1
  265. package/dist/schemas/themeLibrary.d.ts +41 -0
  266. package/dist/schemas/themeLibrary.d.ts.map +1 -0
  267. package/dist/schemas/themeLibrary.js +466 -0
  268. package/dist/schemas/themeLibrary.js.map +1 -0
  269. package/dist/spatial/Geohash.d.ts +85 -0
  270. package/dist/spatial/Geohash.d.ts.map +1 -0
  271. package/dist/spatial/Geohash.js +142 -0
  272. package/dist/spatial/Geohash.js.map +1 -0
  273. package/dist/spatial/Haversine.d.ts +24 -0
  274. package/dist/spatial/Haversine.d.ts.map +1 -0
  275. package/dist/spatial/Haversine.js +48 -0
  276. package/dist/spatial/Haversine.js.map +1 -0
  277. package/dist/spatial/index.d.ts +3 -111
  278. package/dist/spatial/index.d.ts.map +1 -0
  279. package/dist/spatial/index.js +2 -24
  280. package/dist/spatial/index.js.map +1 -1
  281. package/dist/storage/LocalForageAdapter.d.ts +36 -0
  282. package/dist/storage/LocalForageAdapter.d.ts.map +1 -0
  283. package/dist/storage/LocalForageAdapter.js +82 -0
  284. package/dist/storage/LocalForageAdapter.js.map +1 -0
  285. package/dist/storage/LocalStorageAdapter.d.ts +16 -0
  286. package/dist/storage/LocalStorageAdapter.d.ts.map +1 -0
  287. package/dist/storage/LocalStorageAdapter.js +50 -0
  288. package/dist/storage/LocalStorageAdapter.js.map +1 -0
  289. package/dist/storage/MemoryStorageAdapter.d.ts +15 -0
  290. package/dist/storage/MemoryStorageAdapter.d.ts.map +1 -0
  291. package/dist/storage/MemoryStorageAdapter.js +34 -0
  292. package/dist/storage/MemoryStorageAdapter.js.map +1 -0
  293. package/dist/storage/Storage.d.ts +23 -0
  294. package/dist/storage/Storage.d.ts.map +1 -0
  295. package/dist/storage/Storage.js +9 -0
  296. package/dist/storage/Storage.js.map +1 -0
  297. package/dist/storage/index.d.ts +6 -91
  298. package/dist/storage/index.d.ts.map +1 -0
  299. package/dist/storage/index.js +3 -10
  300. package/dist/storage/index.js.map +1 -1
  301. package/dist/story/index.d.ts +3 -2
  302. package/dist/themeLibrary-DR1VRo-8.d.ts +44 -0
  303. package/dist/timing/index.d.ts +4 -0
  304. package/dist/timing/index.d.ts.map +1 -0
  305. package/dist/timing/index.js +3 -0
  306. package/dist/timing/index.js.map +1 -0
  307. package/dist/timing/narrationTiming.d.ts +54 -0
  308. package/dist/timing/narrationTiming.d.ts.map +1 -0
  309. package/dist/timing/narrationTiming.js +190 -0
  310. package/dist/timing/narrationTiming.js.map +1 -0
  311. package/dist/timing/readingTime.d.ts +54 -0
  312. package/dist/timing/readingTime.d.ts.map +1 -0
  313. package/dist/timing/readingTime.js +49 -0
  314. package/dist/timing/readingTime.js.map +1 -0
  315. package/package.json +19 -5
  316. package/src/__tests__/contentExtractor.test.ts +183 -0
  317. package/src/__tests__/seededRandom.test.ts +142 -0
  318. package/src/__tests__/slideshowGenerator.test.ts +128 -0
  319. package/src/__tests__/timing.test.ts +167 -0
  320. package/src/generate/contentExtractor.ts +808 -0
  321. package/src/generate/index.ts +21 -0
  322. package/src/generate/slideshowGenerator.ts +273 -0
  323. package/src/generate/templateMapper.ts +170 -0
  324. package/src/index.ts +3 -0
  325. package/src/random/SeededRandom.ts +127 -0
  326. package/src/random/index.ts +1 -0
  327. package/src/timing/index.ts +17 -0
  328. package/src/timing/narrationTiming.ts +220 -0
  329. package/src/timing/readingTime.ts +94 -0
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Video With Caption Template
3
+ *
4
+ * Full-screen background video clip with text overlay. Mirrors the structure of
5
+ * imageWithCaption but uses a VideoLayer instead of an ImageLayer. The video
6
+ * plays muted — narration audio is the only sound track.
7
+ *
8
+ * Adapts caption positioning and font sizes for different viewports.
9
+ *
10
+ * This is shared code used by both site and efb-app doc renderers.
11
+ *
12
+ * Related Files:
13
+ * - shared/story/templates/imageWithCaption.ts — image equivalent
14
+ * - schemas/StoryScript.ts — VideoLayer type
15
+ * - site/src/components/story/layers/VideoLayer.tsx — rendering component
16
+ */
17
+ import { scaledFontSize } from '../../schemas/BlockTemplates.js';
18
+ import { cleanCaption } from './captionUtils.js';
19
+ export function videoWithCaption(input, context) {
20
+ const { videoSrc, posterSrc, videoAlt, clipStart, clipEnd, sourceDuration, caption: rawCaption, captionPosition = 'bottom', videoCredit, videoLicense, } = input;
21
+ const caption = rawCaption ? cleanCaption(rawCaption) : rawCaption;
22
+ const { theme, layout } = context;
23
+ const captionFontSize = scaledFontSize(36, context, false);
24
+ const creditFontSize = scaledFontSize(16, context, false);
25
+ const layers = [
26
+ // Background video clip
27
+ {
28
+ type: 'video',
29
+ id: 'bg-video',
30
+ content: {
31
+ src: videoSrc,
32
+ posterSrc,
33
+ alt: videoAlt,
34
+ fit: 'cover',
35
+ clipStart,
36
+ clipEnd,
37
+ sourceDuration,
38
+ credit: videoCredit,
39
+ license: videoLicense,
40
+ },
41
+ position: { x: 0, y: 0, width: '100%', height: '100%' },
42
+ },
43
+ ];
44
+ // Caption text at bottom with gradient for readability
45
+ if (caption) {
46
+ layers.push({
47
+ type: 'shape',
48
+ id: 'caption-gradient',
49
+ content: {
50
+ shape: 'rect',
51
+ fill: 'linear-gradient(0deg, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.3) 60%, transparent 100%)',
52
+ },
53
+ position: {
54
+ x: 0,
55
+ y: captionPosition === 'top' ? 0 : '65%',
56
+ width: '100%',
57
+ height: '35%',
58
+ },
59
+ });
60
+ const captionY = captionPosition === 'top' ? '15%' : captionPosition === 'center' ? '50%' : '82%';
61
+ layers.push({
62
+ type: 'text',
63
+ id: 'caption',
64
+ content: {
65
+ text: caption,
66
+ style: {
67
+ fontSize: captionFontSize,
68
+ color: theme.colors.text,
69
+ textAlign: 'center',
70
+ shadow: true,
71
+ },
72
+ },
73
+ position: {
74
+ x: '50%',
75
+ y: captionY,
76
+ anchor: 'center',
77
+ width: layout.maxTextWidth,
78
+ },
79
+ animation: { type: 'fadeIn', duration: 1.5, delay: 0.5 },
80
+ });
81
+ }
82
+ // Small credit text in bottom-right corner
83
+ if (videoCredit) {
84
+ layers.push({
85
+ type: 'text',
86
+ id: 'credit',
87
+ content: {
88
+ text: videoCredit,
89
+ style: {
90
+ fontSize: creditFontSize,
91
+ color: 'rgba(255, 255, 255, 0.5)',
92
+ textAlign: 'right',
93
+ },
94
+ },
95
+ position: {
96
+ x: '96%',
97
+ y: '96%',
98
+ anchor: 'bottom-right',
99
+ },
100
+ });
101
+ }
102
+ return layers;
103
+ }
104
+ //# sourceMappingURL=videoWithCaption.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"videoWithCaption.js","sourceRoot":"","sources":["../../../src/doc/templates/videoWithCaption.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,UAAU,gBAAgB,CAAC,KAA4B,EAAE,OAAwB;IACrF,MAAM,EACJ,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,SAAS,EACT,OAAO,EACP,cAAc,EACd,OAAO,EAAE,UAAU,EACnB,eAAe,GAAG,QAAQ,EAC1B,WAAW,EACX,YAAY,GACb,GAAG,KAAK,CAAC;IACV,MAAM,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,UAAU,CAAC,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F,MAAM,CAAC,IAAI,CAAC;YACV,IAAI,EAAE,MAAM;YACZ,EAAE,EAAE,SAAS;YACb,OAAO,EAAE;gBACP,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE;oBACL,QAAQ,EAAE,eAAe;oBACzB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI;oBACxB,SAAS,EAAE,QAAQ;oBACnB,MAAM,EAAE,IAAI;iBACb;aACF;YACD,QAAQ,EAAE;gBACR,CAAC,EAAE,KAAK;gBACR,CAAC,EAAE,QAAQ;gBACX,MAAM,EAAE,QAAQ;gBAChB,KAAK,EAAE,MAAM,CAAC,YAAY;aAC3B;YACD,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE;SACzD,CAAC,CAAC;IACL,CAAC;IAED,2CAA2C;IAC3C,IAAI,WAAW,EAAE,CAAC;QAChB,MAAM,CAAC,IAAI,CAAC;YACV,IAAI,EAAE,MAAM;YACZ,EAAE,EAAE,QAAQ;YACZ,OAAO,EAAE;gBACP,IAAI,EAAE,WAAW;gBACjB,KAAK,EAAE;oBACL,QAAQ,EAAE,cAAc;oBACxB,KAAK,EAAE,0BAA0B;oBACjC,SAAS,EAAE,OAAO;iBACnB;aACF;YACD,QAAQ,EAAE;gBACR,CAAC,EAAE,KAAK;gBACR,CAAC,EAAE,KAAK;gBACR,MAAM,EAAE,cAAc;aACvB;SACF,CAAC,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Animation Utilities
3
+ *
4
+ * Helper functions for mapping Doc animations to CSS classes and styles.
5
+ * Generates the appropriate animation class names and CSS custom properties
6
+ * for duration, delay, and easing.
7
+ *
8
+ * This is shared code used by both site and efb-app doc renderers.
9
+ */
10
+ import type { Animation, AnimationType, TransitionType } from '../../schemas/Doc.js';
11
+ interface AnimationResult {
12
+ /** CSS class name to apply */
13
+ className: string;
14
+ /** Inline styles for CSS custom properties */
15
+ style: Record<string, string>;
16
+ }
17
+ /**
18
+ * Get CSS class and styles for an animation.
19
+ */
20
+ export declare function getAnimationStyle(animation: Animation | undefined, _currentTime?: number): AnimationResult;
21
+ /**
22
+ * Get default duration for an animation type.
23
+ */
24
+ export declare function getDefaultAnimationDuration(type: AnimationType): number;
25
+ /**
26
+ * Get transition class for slide entry/exit.
27
+ */
28
+ export declare function getTransitionClass(type: TransitionType, entering: boolean): string;
29
+ /**
30
+ * Calculate animation progress (0-1) based on current time.
31
+ */
32
+ export declare function getAnimationProgress(animation: Animation, currentTime: number, slideDuration: number): number;
33
+ export {};
34
+ //# sourceMappingURL=animationUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"animationUtils.d.ts","sourceRoot":"","sources":["../../../src/doc/utils/animationUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAErF,UAAU,eAAe;IACvB,8BAA8B;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,SAAS,GAAG,SAAS,EAChC,YAAY,GAAE,MAAU,GACvB,eAAe,CASjB;AAuDD;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAiBvE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO,GAAG,MAAM,CAGlF;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,GACpB,MAAM,CAQR"}
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Animation Utilities
3
+ *
4
+ * Helper functions for mapping Doc animations to CSS classes and styles.
5
+ * Generates the appropriate animation class names and CSS custom properties
6
+ * for duration, delay, and easing.
7
+ *
8
+ * This is shared code used by both site and efb-app doc renderers.
9
+ */
10
+ /**
11
+ * Get CSS class and styles for an animation.
12
+ */
13
+ export function getAnimationStyle(animation, _currentTime = 0) {
14
+ if (!animation || animation.type === 'none') {
15
+ return { className: '', style: {} };
16
+ }
17
+ const className = getAnimationClassName(animation);
18
+ const style = getAnimationCSSVars(animation);
19
+ return { className, style };
20
+ }
21
+ /**
22
+ * Map animation type to CSS class name.
23
+ */
24
+ function getAnimationClassName(animation) {
25
+ const { type, direction, panDirection } = animation;
26
+ switch (type) {
27
+ case 'fadeIn':
28
+ return 'anim-fadeIn';
29
+ case 'fadeOut':
30
+ return 'anim-fadeOut';
31
+ case 'slowZoom':
32
+ // Slow zoom (Ken Burns style) has variants based on direction and pan
33
+ if (panDirection === 'left')
34
+ return 'anim-slowZoom-panLeft';
35
+ if (panDirection === 'right')
36
+ return 'anim-slowZoom-panRight';
37
+ if (direction === 'out')
38
+ return 'anim-slowZoom-out';
39
+ return 'anim-slowZoom-in';
40
+ case 'zoomIn':
41
+ return 'anim-zoomIn';
42
+ case 'zoomOut':
43
+ return 'anim-zoomOut';
44
+ case 'panLeft':
45
+ return 'anim-panLeft';
46
+ case 'panRight':
47
+ return 'anim-panRight';
48
+ case 'typewriter':
49
+ return 'anim-typewriter';
50
+ default:
51
+ return '';
52
+ }
53
+ }
54
+ /**
55
+ * Generate CSS custom properties for animation timing.
56
+ */
57
+ function getAnimationCSSVars(animation) {
58
+ const vars = {};
59
+ if (animation.duration !== undefined) {
60
+ vars['--anim-duration'] = `${animation.duration}s`;
61
+ }
62
+ if (animation.delay !== undefined) {
63
+ vars['--anim-delay'] = `${animation.delay}s`;
64
+ }
65
+ if (animation.easing) {
66
+ vars['--anim-easing'] = animation.easing;
67
+ }
68
+ return vars;
69
+ }
70
+ /**
71
+ * Get default duration for an animation type.
72
+ */
73
+ export function getDefaultAnimationDuration(type) {
74
+ switch (type) {
75
+ case 'slowZoom':
76
+ case 'panLeft':
77
+ case 'panRight':
78
+ return 8; // Long, slow animations
79
+ case 'typewriter':
80
+ return 3;
81
+ case 'fadeIn':
82
+ case 'fadeOut':
83
+ return 1;
84
+ case 'zoomIn':
85
+ case 'zoomOut':
86
+ return 0.5;
87
+ default:
88
+ return 1;
89
+ }
90
+ }
91
+ /**
92
+ * Get transition class for slide entry/exit.
93
+ */
94
+ export function getTransitionClass(type, entering) {
95
+ const mode = entering ? 'enter' : 'exit';
96
+ return `transition-${type}-${mode}`;
97
+ }
98
+ /**
99
+ * Calculate animation progress (0-1) based on current time.
100
+ */
101
+ export function getAnimationProgress(animation, currentTime, slideDuration) {
102
+ const delay = animation.delay || 0;
103
+ const duration = animation.duration || slideDuration;
104
+ if (currentTime < delay)
105
+ return 0;
106
+ if (currentTime >= delay + duration)
107
+ return 1;
108
+ return (currentTime - delay) / duration;
109
+ }
110
+ //# sourceMappingURL=animationUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"animationUtils.js","sourceRoot":"","sources":["../../../src/doc/utils/animationUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAWH;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAC/B,SAAgC,EAChC,eAAuB,CAAC;IAExB,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QAC5C,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IACtC,CAAC;IAED,MAAM,SAAS,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC;IACnD,MAAM,KAAK,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAE7C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;AAC9B,CAAC;AAED;;GAEG;AACH,SAAS,qBAAqB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M,UAAU,2BAA2B,CAAC,IAAmB;IAC7D,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,UAAU,CAAC;QAChB,KAAK,SAAS,CAAC;QACf,KAAK,UAAU;YACb,OAAO,CAAC,CAAC,CAAC,wBAAwB;QACpC,KAAK,YAAY;YACf,OAAO,CAAC,CAAC;QACX,KAAK,QAAQ,CAAC;QACd,KAAK,SAAS;YACZ,OAAO,CAAC,CAAC;QACX,KAAK,QAAQ,CAAC;QACd,KAAK,SAAS;YACZ,OAAO,GAAG,CAAC;QACb;YACE,OAAO,CAAC,CAAC;IACb,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAoB,EAAE,QAAiB;IACxE,MAAM,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;IACzC,OAAO,cAAc,IAAI,IAAI,IAAI,EAAE,CAAC;AACtC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAClC,SAAoB,EACpB,WAAmB,EACnB,aAAqB;IAErB,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,IAAI,CAAC,CAAC;IACnC,MAAM,QAAQ,GAAG,SAAS,CAAC,QAAQ,IAAI,aAAa,CAAC;IAErD,IAAI,WAAW,GAAG,KAAK;QAAE,OAAO,CAAC,CAAC;IAClC,IAAI,WAAW,IAAI,KAAK,GAAG,QAAQ;QAAE,OAAO,CAAC,CAAC;IAE9C,OAAO,CAAC,WAAW,GAAG,KAAK,CAAC,GAAG,QAAQ,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Theme Utilities
3
+ *
4
+ * Template-facing helpers that read from the Theme object on the
5
+ * TemplateContext. Templates call these instead of hard-coding style
6
+ * decisions, so the same template code adapts to any theme.
7
+ */
8
+ import type { TemplateContext } from '../../schemas/BlockTemplates.js';
9
+ import type { ThemeColorScheme } from '../../schemas/Theme.js';
10
+ import type { AnimationType } from '../../schemas/Doc.js';
11
+ /**
12
+ * Resolve a named color scheme from the theme, with a safe fallback.
13
+ * Templates call this instead of `COLOR_SCHEMES[name]`.
14
+ */
15
+ export declare function resolveColorScheme(context: TemplateContext, name: string | undefined): ThemeColorScheme;
16
+ /**
17
+ * Calculate a theme-aware scaled font size.
18
+ * Applies the theme's typography scale multipliers on top of the
19
+ * viewport-based font scale from LayoutStrategy.
20
+ *
21
+ * @param basePx Base font size designed for 1920×1080
22
+ * @param context Template context (includes fontScale, layout, theme)
23
+ * @param isTitle Whether this is title text (uses titleScale) or body (bodyScale)
24
+ */
25
+ export declare function themedFontSize(basePx: number, context: TemplateContext, isTitle?: boolean): number;
26
+ /**
27
+ * Scale an animation duration by the theme's animationSpeed multiplier.
28
+ * A speed of 1.0 returns the base duration unchanged.
29
+ */
30
+ export declare function scaleAnimationDuration(baseDuration: number, context: TemplateContext): number;
31
+ /**
32
+ * Get the theme's default animation type for a layer kind.
33
+ * Returns `undefined` when the theme doesn't specify one (template picks its own).
34
+ */
35
+ export declare function getDefaultAnimation(context: TemplateContext, layerType: 'text' | 'image'): AnimationType | undefined;
36
+ /**
37
+ * Whether the theme defaults to text shadows.
38
+ * Templates should consult this when choosing `shadow: true/false`.
39
+ */
40
+ export declare function shouldUseShadow(context: TemplateContext): boolean;
41
+ /**
42
+ * Get the theme's overlay opacity for image-backed blocks.
43
+ */
44
+ export declare function getOverlayOpacity(context: TemplateContext): number;
45
+ /**
46
+ * Read a per-template hint from the theme's renderStyle.
47
+ * Returns `fallback` when the hint isn't defined.
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * const entrance = getTemplateHint(context, 'statHighlight', 'entrance', 'subtle');
52
+ * ```
53
+ */
54
+ export declare function getTemplateHint<T extends string | number | boolean>(context: TemplateContext, templateName: string, key: string, fallback: T): T;
55
+ //# sourceMappingURL=themeUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"themeUtils.d.ts","sourceRoot":"","sources":["../../../src/doc/utils/themeUtils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,KAAK,EAAE,gBAAgB,EAAe,MAAM,wBAAwB,CAAC;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAa1D;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,eAAe,EACxB,IAAI,EAAE,MAAM,GAAG,SAAS,GACvB,gBAAgB,CAOlB;AAMD;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,eAAe,EACxB,OAAO,GAAE,OAAe,GACvB,MAAM,CAYR;AAMD;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,MAAM,CAG7F;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,eAAe,EACxB,SAAS,EAAE,MAAM,GAAG,OAAO,GAC1B,aAAa,GAAG,SAAS,CAG3B;AAMD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAEjE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAElE;AAMD;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,OAAO,EACjE,OAAO,EAAE,eAAe,EACxB,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,CAAC,GACV,CAAC,CAMH"}
@@ -0,0 +1,109 @@
1
+ /**
2
+ * Theme Utilities
3
+ *
4
+ * Template-facing helpers that read from the Theme object on the
5
+ * TemplateContext. Templates call these instead of hard-coding style
6
+ * decisions, so the same template code adapts to any theme.
7
+ */
8
+ // ============================================
9
+ // Color Scheme Resolution
10
+ // ============================================
11
+ /** Fallback color scheme when a name is not found in the theme. */
12
+ const FALLBACK_COLOR_SCHEME = {
13
+ bg: '#1a365d',
14
+ text: '#63b3ed',
15
+ accent: '#90cdf4',
16
+ };
17
+ /**
18
+ * Resolve a named color scheme from the theme, with a safe fallback.
19
+ * Templates call this instead of `COLOR_SCHEMES[name]`.
20
+ */
21
+ export function resolveColorScheme(context, name) {
22
+ const schemes = context.theme.colorSchemes;
23
+ if (name && name in schemes)
24
+ return schemes[name];
25
+ // Fall back to first defined scheme, then hard fallback
26
+ const keys = Object.keys(schemes);
27
+ if (keys.length > 0)
28
+ return schemes[keys[0]];
29
+ return FALLBACK_COLOR_SCHEME;
30
+ }
31
+ // ============================================
32
+ // Font Sizing
33
+ // ============================================
34
+ /**
35
+ * Calculate a theme-aware scaled font size.
36
+ * Applies the theme's typography scale multipliers on top of the
37
+ * viewport-based font scale from LayoutStrategy.
38
+ *
39
+ * @param basePx Base font size designed for 1920×1080
40
+ * @param context Template context (includes fontScale, layout, theme)
41
+ * @param isTitle Whether this is title text (uses titleScale) or body (bodyScale)
42
+ */
43
+ export function themedFontSize(basePx, context, isTitle = false) {
44
+ const { fontScale, layout, theme } = context;
45
+ // Base scale from viewport + orientation
46
+ const layoutScale = isTitle ? layout.titleScale : layout.bodyScale;
47
+ // Theme multiplier (defaults to 1.0 when not set)
48
+ const themeScale = isTitle
49
+ ? (theme.typography.titleScale ?? 1.0)
50
+ : (theme.typography.bodyScale ?? 1.0);
51
+ return Math.round(basePx * fontScale * layoutScale * themeScale);
52
+ }
53
+ // ============================================
54
+ // Animation Helpers
55
+ // ============================================
56
+ /**
57
+ * Scale an animation duration by the theme's animationSpeed multiplier.
58
+ * A speed of 1.0 returns the base duration unchanged.
59
+ */
60
+ export function scaleAnimationDuration(baseDuration, context) {
61
+ const speed = context.theme.style.animationSpeed ?? 1.0;
62
+ return baseDuration * speed;
63
+ }
64
+ /**
65
+ * Get the theme's default animation type for a layer kind.
66
+ * Returns `undefined` when the theme doesn't specify one (template picks its own).
67
+ */
68
+ export function getDefaultAnimation(context, layerType) {
69
+ const rs = context.theme.renderStyle;
70
+ return layerType === 'text' ? rs.defaultTextAnimation : rs.defaultImageAnimation;
71
+ }
72
+ // ============================================
73
+ // Style Helpers
74
+ // ============================================
75
+ /**
76
+ * Whether the theme defaults to text shadows.
77
+ * Templates should consult this when choosing `shadow: true/false`.
78
+ */
79
+ export function shouldUseShadow(context) {
80
+ return context.theme.style.textShadow ?? true;
81
+ }
82
+ /**
83
+ * Get the theme's overlay opacity for image-backed blocks.
84
+ */
85
+ export function getOverlayOpacity(context) {
86
+ return context.theme.style.overlayOpacity ?? 0.5;
87
+ }
88
+ // ============================================
89
+ // Template Hint Access
90
+ // ============================================
91
+ /**
92
+ * Read a per-template hint from the theme's renderStyle.
93
+ * Returns `fallback` when the hint isn't defined.
94
+ *
95
+ * @example
96
+ * ```ts
97
+ * const entrance = getTemplateHint(context, 'statHighlight', 'entrance', 'subtle');
98
+ * ```
99
+ */
100
+ export function getTemplateHint(context, templateName, key, fallback) {
101
+ const hints = context.theme.renderStyle.templateHints;
102
+ if (!hints)
103
+ return fallback;
104
+ const tplHints = hints[templateName];
105
+ if (!tplHints || !(key in tplHints))
106
+ return fallback;
107
+ return tplHints[key];
108
+ }
109
+ //# sourceMappingURL=themeUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"themeUtils.js","sourceRoot":"","sources":["../../../src/doc/utils/themeUtils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,+CAA+C;AAC/C,0BAA0B;AAC1B,+CAA+C;AAE/C,mEAAmE;AACnE,MAAM,qBAAqB,GAAqB;IAC9C,EAAE,EAAE,SAAS;IACb,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,SAAS;CAClB,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAwB,EACxB,IAAwB;IAExB,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,YA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AAwB,EACxB,SAA2B;IAE3B,MAAM,EAAE,GAAgB,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC;IAClD,OAAO,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,CAAC,qBAAqB,CAAC;AACnF,CAAC;AAED,+CAA+C;AAC/C,gBAAgB;AAChB,+CAA+C;AAE/C;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,OAAwB;IACtD,OAAO,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,IAAI,IAAI,CAAC;AAChD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAwB;IACxD,OAAO,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,IAAI,GAAG,CAAC;AACnD,CAAC;AAED,+CAA+C;AAC/C,uBAAuB;AACvB,+CAA+C;AAE/C;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAC7B,OAAwB,EACxB,YAAoB,EACpB,GAAW,EACX,QAAW;IAEX,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,aAAa,CAAC;IACtD,IAAI,CAAC,KAAK;QAAE,OAAO,QAAQ,CAAC;IAC5B,MAAM,QAAQ,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC;IACrC,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAC,GAAG,IAAI,QAAQ,CAAC;QAAE,OAAO,QAAQ,CAAC;IACrD,OAAO,QAAQ,CAAC,GAAG,CAAM,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Content Extractor
3
+ *
4
+ * Pattern-based extraction of compelling content from plain text.
5
+ * Identifies statistics, dates, quotes, comparisons, facts, impact lines,
6
+ * lists, and definitions that can be turned into slideshow slides.
7
+ *
8
+ * Extraction is purely regex-based — no AI calls, no runtime costs,
9
+ * deterministic and reproducible.
10
+ */
11
+ /** Kinds of content the extractor recognises. */
12
+ export type ExtractionType = 'stat' | 'date' | 'quote' | 'comparison' | 'fact' | 'impactLine' | 'list' | 'definition';
13
+ /** An extracted content element with source position. */
14
+ export interface ExtractedElement {
15
+ type: ExtractionType;
16
+ /** Full extracted text (usually the surrounding sentence). */
17
+ text: string;
18
+ /** Confidence score 0–1. */
19
+ confidence: number;
20
+ /** Character offset in the source text. */
21
+ sourcePosition: number;
22
+ /** Character offset where element ends. */
23
+ endPosition: number;
24
+ /** Type-specific structured payload. */
25
+ data: StatData | DateData | QuoteData | ComparisonData | FactData | ImpactLineData | ListData | DefinitionData;
26
+ }
27
+ export interface StatData {
28
+ type: 'stat';
29
+ value: string;
30
+ unit?: string;
31
+ description: string;
32
+ }
33
+ export interface DateData {
34
+ type: 'date';
35
+ date: string;
36
+ description: string;
37
+ mood?: 'neutral' | 'somber' | 'celebratory';
38
+ }
39
+ export interface QuoteData {
40
+ type: 'quote';
41
+ quote: string;
42
+ attribution?: string;
43
+ }
44
+ export interface ComparisonData {
45
+ type: 'comparison';
46
+ left: {
47
+ label: string;
48
+ sublabel?: string;
49
+ };
50
+ right: {
51
+ label: string;
52
+ sublabel?: string;
53
+ };
54
+ header?: string;
55
+ }
56
+ export interface FactData {
57
+ type: 'fact';
58
+ fact: string;
59
+ explanation?: string;
60
+ }
61
+ export interface ImpactLineData {
62
+ type: 'impactLine';
63
+ text: string;
64
+ }
65
+ export interface ListData {
66
+ type: 'list';
67
+ items: string[];
68
+ title?: string;
69
+ }
70
+ export interface DefinitionData {
71
+ type: 'definition';
72
+ term: string;
73
+ definition: string;
74
+ origin?: string;
75
+ }
76
+ /** Options for `extractContent`. */
77
+ export interface ExtractionOptions {
78
+ /** Minimum confidence threshold (default: 0.3). */
79
+ minConfidence?: number;
80
+ /** Which types to extract (default: all). */
81
+ types?: ExtractionType[];
82
+ /** Maximum extractions per type (default: unlimited). */
83
+ maxPerType?: number;
84
+ }
85
+ /** Result of `extractContent`. */
86
+ export interface ExtractionResult {
87
+ elements: ExtractedElement[];
88
+ sourceLength: number;
89
+ stats: {
90
+ statCount: number;
91
+ dateCount: number;
92
+ quoteCount: number;
93
+ comparisonCount: number;
94
+ factCount: number;
95
+ impactLineCount: number;
96
+ listCount: number;
97
+ definitionCount: number;
98
+ totalCount: number;
99
+ };
100
+ }
101
+ /**
102
+ * Extract compelling content from plain text.
103
+ *
104
+ * Call `stripMarkdown(text)` first if the input contains markdown.
105
+ */
106
+ export declare function extractContent(text: string, options?: ExtractionOptions): ExtractionResult;
107
+ /**
108
+ * Strip markdown formatting from text, returning plain prose.
109
+ * Call this before `extractContent` if the input is markdown.
110
+ */
111
+ export declare function stripMarkdown(markdown: string): string;
112
+ //# sourceMappingURL=contentExtractor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contentExtractor.d.ts","sourceRoot":"","sources":["../../src/generate/contentExtractor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,iDAAiD;AACjD,MAAM,MAAM,cAAc,GACtB,MAAM,GACN,MAAM,GACN,OAAO,GACP,YAAY,GACZ,MAAM,GACN,YAAY,GACZ,MAAM,GACN,YAAY,CAAC;AAEjB,yDAAyD;AACzD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,cAAc,CAAC;IACrB,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,cAAc,EAAE,MAAM,CAAC;IACvB,2CAA2C;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,wCAAwC;IACxC,IAAI,EACA,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,cAAc,GACd,QAAQ,GACR,cAAc,GACd,QAAQ,GACR,cAAc,CAAC;CACpB;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM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