@bendyline/squisq 0.1.2 → 1.1.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 (349) hide show
  1. package/dist/{themeLibrary-DySHPcgj.d.ts → Doc-1hmT1LZl.d.ts} +1 -42
  2. package/dist/MediaProvider-wpSe21B3.d.ts +66 -0
  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__/contentContainer.test.d.ts +2 -0
  8. package/dist/__tests__/contentContainer.test.d.ts.map +1 -0
  9. package/dist/__tests__/contentContainer.test.js +234 -0
  10. package/dist/__tests__/contentContainer.test.js.map +1 -0
  11. package/dist/__tests__/contentExtractor.test.d.ts +2 -0
  12. package/dist/__tests__/contentExtractor.test.d.ts.map +1 -0
  13. package/dist/__tests__/contentExtractor.test.js +151 -0
  14. package/dist/__tests__/contentExtractor.test.js.map +1 -0
  15. package/dist/__tests__/geohash.test.d.ts +2 -0
  16. package/dist/__tests__/geohash.test.d.ts.map +1 -0
  17. package/dist/__tests__/geohash.test.js +87 -0
  18. package/dist/__tests__/geohash.test.js.map +1 -0
  19. package/dist/__tests__/getLayers.test.d.ts +2 -0
  20. package/dist/__tests__/getLayers.test.d.ts.map +1 -0
  21. package/dist/__tests__/getLayers.test.js +167 -0
  22. package/dist/__tests__/getLayers.test.js.map +1 -0
  23. package/dist/__tests__/haversine.test.d.ts +2 -0
  24. package/dist/__tests__/haversine.test.d.ts.map +1 -0
  25. package/dist/__tests__/haversine.test.js +56 -0
  26. package/dist/__tests__/haversine.test.js.map +1 -0
  27. package/dist/__tests__/localForageAdapter.test.d.ts +8 -0
  28. package/dist/__tests__/localForageAdapter.test.d.ts.map +1 -0
  29. package/dist/__tests__/localForageAdapter.test.js +130 -0
  30. package/dist/__tests__/localForageAdapter.test.js.map +1 -0
  31. package/dist/__tests__/markdown.test.d.ts +2 -0
  32. package/dist/__tests__/markdown.test.d.ts.map +1 -0
  33. package/dist/__tests__/markdown.test.js +654 -0
  34. package/dist/__tests__/markdown.test.js.map +1 -0
  35. package/dist/__tests__/markdownToDoc.test.d.ts +2 -0
  36. package/dist/__tests__/markdownToDoc.test.d.ts.map +1 -0
  37. package/dist/__tests__/markdownToDoc.test.js +313 -0
  38. package/dist/__tests__/markdownToDoc.test.js.map +1 -0
  39. package/dist/__tests__/seededRandom.test.d.ts +2 -0
  40. package/dist/__tests__/seededRandom.test.d.ts.map +1 -0
  41. package/dist/__tests__/seededRandom.test.js +125 -0
  42. package/dist/__tests__/seededRandom.test.js.map +1 -0
  43. package/dist/__tests__/slideshowGenerator.test.d.ts +2 -0
  44. package/dist/__tests__/slideshowGenerator.test.d.ts.map +1 -0
  45. package/dist/__tests__/slideshowGenerator.test.js +114 -0
  46. package/dist/__tests__/slideshowGenerator.test.js.map +1 -0
  47. package/dist/__tests__/storage.test.d.ts +2 -0
  48. package/dist/__tests__/storage.test.d.ts.map +1 -0
  49. package/dist/__tests__/storage.test.js +51 -0
  50. package/dist/__tests__/storage.test.js.map +1 -0
  51. package/dist/__tests__/templates.test.d.ts +2 -0
  52. package/dist/__tests__/templates.test.d.ts.map +1 -0
  53. package/dist/__tests__/templates.test.js +217 -0
  54. package/dist/__tests__/templates.test.js.map +1 -0
  55. package/dist/__tests__/timing.test.d.ts +2 -0
  56. package/dist/__tests__/timing.test.d.ts.map +1 -0
  57. package/dist/__tests__/timing.test.js +131 -0
  58. package/dist/__tests__/timing.test.js.map +1 -0
  59. package/dist/chunk-3E5F2XMR.js +129 -0
  60. package/dist/chunk-3E5F2XMR.js.map +1 -0
  61. package/dist/chunk-4CRBS35L.js +292 -0
  62. package/dist/chunk-4CRBS35L.js.map +1 -0
  63. package/dist/chunk-6YJPI6VI.js +35 -0
  64. package/dist/chunk-6YJPI6VI.js.map +1 -0
  65. package/dist/chunk-FVTQSNR7.js +100 -0
  66. package/dist/chunk-FVTQSNR7.js.map +1 -0
  67. package/dist/chunk-V543AI2F.js +1 -0
  68. package/dist/chunk-V543AI2F.js.map +1 -0
  69. package/dist/chunk-VP5SZTZ2.js +792 -0
  70. package/dist/chunk-VP5SZTZ2.js.map +1 -0
  71. package/dist/doc/docToMarkdown.d.ts +41 -0
  72. package/dist/doc/docToMarkdown.d.ts.map +1 -0
  73. package/dist/doc/docToMarkdown.js +88 -0
  74. package/dist/doc/docToMarkdown.js.map +1 -0
  75. package/dist/doc/getLayers.d.ts +65 -0
  76. package/dist/doc/getLayers.d.ts.map +1 -0
  77. package/dist/doc/getLayers.js +103 -0
  78. package/dist/doc/getLayers.js.map +1 -0
  79. package/dist/doc/index.d.ts +9 -3
  80. package/dist/doc/index.d.ts.map +1 -0
  81. package/dist/doc/index.js +6 -125
  82. package/dist/doc/index.js.map +1 -1
  83. package/dist/doc/markdownToDoc.d.ts +68 -0
  84. package/dist/doc/markdownToDoc.d.ts.map +1 -0
  85. package/dist/doc/markdownToDoc.js +225 -0
  86. package/dist/doc/markdownToDoc.js.map +1 -0
  87. package/dist/doc/templates/accentImage.d.ts +59 -0
  88. package/dist/doc/templates/accentImage.d.ts.map +1 -0
  89. package/dist/doc/templates/accentImage.js +275 -0
  90. package/dist/doc/templates/accentImage.js.map +1 -0
  91. package/dist/doc/templates/captionUtils.d.ts +20 -0
  92. package/dist/doc/templates/captionUtils.d.ts.map +1 -0
  93. package/dist/doc/templates/captionUtils.js +29 -0
  94. package/dist/doc/templates/captionUtils.js.map +1 -0
  95. package/dist/doc/templates/comparisonBar.d.ts +13 -0
  96. package/dist/doc/templates/comparisonBar.d.ts.map +1 -0
  97. package/dist/doc/templates/comparisonBar.js +127 -0
  98. package/dist/doc/templates/comparisonBar.js.map +1 -0
  99. package/dist/doc/templates/coverBlock.d.ts +51 -0
  100. package/dist/doc/templates/coverBlock.d.ts.map +1 -0
  101. package/dist/doc/templates/coverBlock.js +125 -0
  102. package/dist/doc/templates/coverBlock.js.map +1 -0
  103. package/dist/doc/templates/dateEvent.d.ts +15 -0
  104. package/dist/doc/templates/dateEvent.d.ts.map +1 -0
  105. package/dist/doc/templates/dateEvent.js +110 -0
  106. package/dist/doc/templates/dateEvent.js.map +1 -0
  107. package/dist/doc/templates/definitionCard.d.ts +13 -0
  108. package/dist/doc/templates/definitionCard.d.ts.map +1 -0
  109. package/dist/doc/templates/definitionCard.js +114 -0
  110. package/dist/doc/templates/definitionCard.js.map +1 -0
  111. package/dist/doc/templates/factCard.d.ts +15 -0
  112. package/dist/doc/templates/factCard.d.ts.map +1 -0
  113. package/dist/doc/templates/factCard.js +100 -0
  114. package/dist/doc/templates/factCard.js.map +1 -0
  115. package/dist/doc/templates/fullBleedQuote.d.ts +13 -0
  116. package/dist/doc/templates/fullBleedQuote.d.ts.map +1 -0
  117. package/dist/doc/templates/fullBleedQuote.js +54 -0
  118. package/dist/doc/templates/fullBleedQuote.js.map +1 -0
  119. package/dist/doc/templates/imageWithCaption.d.ts +13 -0
  120. package/dist/doc/templates/imageWithCaption.d.ts.map +1 -0
  121. package/dist/doc/templates/imageWithCaption.js +142 -0
  122. package/dist/doc/templates/imageWithCaption.js.map +1 -0
  123. package/dist/doc/templates/index.d.ts +104 -0
  124. package/dist/doc/templates/index.d.ts.map +1 -0
  125. package/dist/doc/templates/index.js +442 -0
  126. package/dist/doc/templates/index.js.map +1 -0
  127. package/dist/doc/templates/listBlock.d.ts +13 -0
  128. package/dist/doc/templates/listBlock.d.ts.map +1 -0
  129. package/dist/doc/templates/listBlock.js +89 -0
  130. package/dist/doc/templates/listBlock.js.map +1 -0
  131. package/dist/doc/templates/mapBlock.d.ts +17 -0
  132. package/dist/doc/templates/mapBlock.d.ts.map +1 -0
  133. package/dist/doc/templates/mapBlock.js +112 -0
  134. package/dist/doc/templates/mapBlock.js.map +1 -0
  135. package/dist/doc/templates/persistentLayers.d.ts +39 -0
  136. package/dist/doc/templates/persistentLayers.d.ts.map +1 -0
  137. package/dist/doc/templates/persistentLayers.js +447 -0
  138. package/dist/doc/templates/persistentLayers.js.map +1 -0
  139. package/dist/doc/templates/photoGrid.d.ts +20 -0
  140. package/dist/doc/templates/photoGrid.d.ts.map +1 -0
  141. package/dist/doc/templates/photoGrid.js +172 -0
  142. package/dist/doc/templates/photoGrid.js.map +1 -0
  143. package/dist/doc/templates/pullQuote.d.ts +13 -0
  144. package/dist/doc/templates/pullQuote.d.ts.map +1 -0
  145. package/dist/doc/templates/pullQuote.js +109 -0
  146. package/dist/doc/templates/pullQuote.js.map +1 -0
  147. package/dist/doc/templates/quoteBlock.d.ts +15 -0
  148. package/dist/doc/templates/quoteBlock.d.ts.map +1 -0
  149. package/dist/doc/templates/quoteBlock.js +97 -0
  150. package/dist/doc/templates/quoteBlock.js.map +1 -0
  151. package/dist/doc/templates/sectionHeader.d.ts +14 -0
  152. package/dist/doc/templates/sectionHeader.d.ts.map +1 -0
  153. package/dist/doc/templates/sectionHeader.js +96 -0
  154. package/dist/doc/templates/sectionHeader.js.map +1 -0
  155. package/dist/doc/templates/statHighlight.d.ts +15 -0
  156. package/dist/doc/templates/statHighlight.d.ts.map +1 -0
  157. package/dist/doc/templates/statHighlight.js +99 -0
  158. package/dist/doc/templates/statHighlight.js.map +1 -0
  159. package/dist/doc/templates/titleBlock.d.ts +13 -0
  160. package/dist/doc/templates/titleBlock.d.ts.map +1 -0
  161. package/dist/doc/templates/titleBlock.js +92 -0
  162. package/dist/doc/templates/titleBlock.js.map +1 -0
  163. package/dist/doc/templates/twoColumn.d.ts +15 -0
  164. package/dist/doc/templates/twoColumn.d.ts.map +1 -0
  165. package/dist/doc/templates/twoColumn.js +219 -0
  166. package/dist/doc/templates/twoColumn.js.map +1 -0
  167. package/dist/doc/templates/videoPullQuote.d.ts +20 -0
  168. package/dist/doc/templates/videoPullQuote.d.ts.map +1 -0
  169. package/dist/doc/templates/videoPullQuote.js +118 -0
  170. package/dist/doc/templates/videoPullQuote.js.map +1 -0
  171. package/dist/doc/templates/videoWithCaption.d.ts +20 -0
  172. package/dist/doc/templates/videoWithCaption.d.ts.map +1 -0
  173. package/dist/doc/templates/videoWithCaption.js +104 -0
  174. package/dist/doc/templates/videoWithCaption.js.map +1 -0
  175. package/dist/doc/utils/animationUtils.d.ts +34 -0
  176. package/dist/doc/utils/animationUtils.d.ts.map +1 -0
  177. package/dist/doc/utils/animationUtils.js +110 -0
  178. package/dist/doc/utils/animationUtils.js.map +1 -0
  179. package/dist/doc/utils/themeUtils.d.ts +55 -0
  180. package/dist/doc/utils/themeUtils.d.ts.map +1 -0
  181. package/dist/doc/utils/themeUtils.js +109 -0
  182. package/dist/doc/utils/themeUtils.js.map +1 -0
  183. package/dist/generate/contentExtractor.d.ts +112 -0
  184. package/dist/generate/contentExtractor.d.ts.map +1 -0
  185. package/dist/generate/contentExtractor.js +638 -0
  186. package/dist/generate/contentExtractor.js.map +1 -0
  187. package/dist/generate/index.d.ts +7 -0
  188. package/dist/generate/index.d.ts.map +1 -0
  189. package/dist/generate/index.js +4 -0
  190. package/dist/generate/index.js.map +1 -0
  191. package/dist/generate/slideshowGenerator.d.ts +72 -0
  192. package/dist/generate/slideshowGenerator.d.ts.map +1 -0
  193. package/dist/generate/slideshowGenerator.js +159 -0
  194. package/dist/generate/slideshowGenerator.js.map +1 -0
  195. package/dist/generate/templateMapper.d.ts +23 -0
  196. package/dist/generate/templateMapper.d.ts.map +1 -0
  197. package/dist/generate/templateMapper.js +114 -0
  198. package/dist/generate/templateMapper.js.map +1 -0
  199. package/dist/index.d.ts +9 -8
  200. package/dist/index.d.ts.map +1 -0
  201. package/dist/index.js +8 -216
  202. package/dist/index.js.map +1 -1
  203. package/dist/markdown/convert.d.ts +71 -0
  204. package/dist/markdown/convert.d.ts.map +1 -0
  205. package/dist/markdown/convert.js +746 -0
  206. package/dist/markdown/convert.js.map +1 -0
  207. package/dist/markdown/htmlParse.d.ts +26 -0
  208. package/dist/markdown/htmlParse.d.ts.map +1 -0
  209. package/dist/markdown/htmlParse.js +195 -0
  210. package/dist/markdown/htmlParse.js.map +1 -0
  211. package/dist/markdown/index.d.ts +19 -225
  212. package/dist/markdown/index.d.ts.map +1 -0
  213. package/dist/markdown/index.js +33 -32
  214. package/dist/markdown/index.js.map +1 -1
  215. package/dist/markdown/parse.d.ts +27 -0
  216. package/dist/markdown/parse.d.ts.map +1 -0
  217. package/dist/markdown/parse.js +90 -0
  218. package/dist/markdown/parse.js.map +1 -0
  219. package/dist/markdown/stringify.d.ts +32 -0
  220. package/dist/markdown/stringify.d.ts.map +1 -0
  221. package/dist/markdown/stringify.js +108 -0
  222. package/dist/markdown/stringify.js.map +1 -0
  223. package/dist/markdown/types.d.ts +496 -0
  224. package/dist/markdown/types.d.ts.map +1 -0
  225. package/dist/markdown/types.js +17 -0
  226. package/dist/markdown/types.js.map +1 -0
  227. package/dist/markdown/utils.d.ts +78 -0
  228. package/dist/markdown/utils.d.ts.map +1 -0
  229. package/dist/markdown/utils.js +149 -0
  230. package/dist/markdown/utils.js.map +1 -0
  231. package/dist/random/SeededRandom.d.ts +50 -0
  232. package/dist/random/SeededRandom.d.ts.map +1 -0
  233. package/dist/random/SeededRandom.js +115 -0
  234. package/dist/random/SeededRandom.js.map +1 -0
  235. package/dist/random/index.d.ts +2 -0
  236. package/dist/random/index.d.ts.map +1 -0
  237. package/dist/random/index.js +2 -0
  238. package/dist/random/index.js.map +1 -0
  239. package/dist/schemas/BlockTemplates.d.ts +583 -0
  240. package/dist/schemas/BlockTemplates.d.ts.map +1 -0
  241. package/dist/schemas/BlockTemplates.js +72 -0
  242. package/dist/schemas/BlockTemplates.js.map +1 -0
  243. package/dist/schemas/Doc.d.ts +411 -0
  244. package/dist/schemas/Doc.d.ts.map +1 -0
  245. package/dist/schemas/Doc.js +90 -0
  246. package/dist/schemas/Doc.js.map +1 -0
  247. package/dist/schemas/LayoutStrategy.d.ts +84 -0
  248. package/dist/schemas/LayoutStrategy.d.ts.map +1 -0
  249. package/dist/schemas/LayoutStrategy.js +123 -0
  250. package/dist/schemas/LayoutStrategy.js.map +1 -0
  251. package/dist/schemas/MediaProvider.d.ts +65 -0
  252. package/dist/schemas/MediaProvider.d.ts.map +1 -0
  253. package/dist/schemas/MediaProvider.js +13 -0
  254. package/dist/schemas/MediaProvider.js.map +1 -0
  255. package/dist/schemas/Theme.d.ts +163 -0
  256. package/dist/schemas/Theme.d.ts.map +1 -0
  257. package/dist/schemas/Theme.js +62 -0
  258. package/dist/schemas/Theme.js.map +1 -0
  259. package/dist/schemas/Types.d.ts +14 -0
  260. package/dist/schemas/Types.d.ts.map +1 -0
  261. package/dist/schemas/Types.js +5 -0
  262. package/dist/schemas/Types.js.map +1 -0
  263. package/dist/schemas/Viewport.d.ts +74 -0
  264. package/dist/schemas/Viewport.d.ts.map +1 -0
  265. package/dist/schemas/Viewport.js +63 -0
  266. package/dist/schemas/Viewport.js.map +1 -0
  267. package/dist/schemas/index.d.ts +10 -70
  268. package/dist/schemas/index.d.ts.map +1 -0
  269. package/dist/schemas/index.js +7 -60
  270. package/dist/schemas/index.js.map +1 -1
  271. package/dist/schemas/themeLibrary.d.ts +41 -0
  272. package/dist/schemas/themeLibrary.d.ts.map +1 -0
  273. package/dist/schemas/themeLibrary.js +466 -0
  274. package/dist/schemas/themeLibrary.js.map +1 -0
  275. package/dist/spatial/Geohash.d.ts +85 -0
  276. package/dist/spatial/Geohash.d.ts.map +1 -0
  277. package/dist/spatial/Geohash.js +142 -0
  278. package/dist/spatial/Geohash.js.map +1 -0
  279. package/dist/spatial/Haversine.d.ts +24 -0
  280. package/dist/spatial/Haversine.d.ts.map +1 -0
  281. package/dist/spatial/Haversine.js +48 -0
  282. package/dist/spatial/Haversine.js.map +1 -0
  283. package/dist/spatial/index.d.ts +3 -111
  284. package/dist/spatial/index.d.ts.map +1 -0
  285. package/dist/spatial/index.js +2 -24
  286. package/dist/spatial/index.js.map +1 -1
  287. package/dist/storage/ContentContainer.d.ts +87 -0
  288. package/dist/storage/ContentContainer.d.ts.map +1 -0
  289. package/dist/storage/ContentContainer.js +122 -0
  290. package/dist/storage/ContentContainer.js.map +1 -0
  291. package/dist/storage/LocalForageAdapter.d.ts +36 -0
  292. package/dist/storage/LocalForageAdapter.d.ts.map +1 -0
  293. package/dist/storage/LocalForageAdapter.js +82 -0
  294. package/dist/storage/LocalForageAdapter.js.map +1 -0
  295. package/dist/storage/LocalStorageAdapter.d.ts +16 -0
  296. package/dist/storage/LocalStorageAdapter.d.ts.map +1 -0
  297. package/dist/storage/LocalStorageAdapter.js +50 -0
  298. package/dist/storage/LocalStorageAdapter.js.map +1 -0
  299. package/dist/storage/MediaProviderFromContainer.d.ts +21 -0
  300. package/dist/storage/MediaProviderFromContainer.d.ts.map +1 -0
  301. package/dist/storage/MediaProviderFromContainer.js +79 -0
  302. package/dist/storage/MediaProviderFromContainer.js.map +1 -0
  303. package/dist/storage/MemoryStorageAdapter.d.ts +15 -0
  304. package/dist/storage/MemoryStorageAdapter.d.ts.map +1 -0
  305. package/dist/storage/MemoryStorageAdapter.js +34 -0
  306. package/dist/storage/MemoryStorageAdapter.js.map +1 -0
  307. package/dist/storage/Storage.d.ts +23 -0
  308. package/dist/storage/Storage.d.ts.map +1 -0
  309. package/dist/storage/Storage.js +9 -0
  310. package/dist/storage/Storage.js.map +1 -0
  311. package/dist/storage/index.d.ts +9 -91
  312. package/dist/storage/index.d.ts.map +1 -0
  313. package/dist/storage/index.js +5 -10
  314. package/dist/storage/index.js.map +1 -1
  315. package/dist/story/index.d.ts +3 -2
  316. package/dist/themeLibrary-DR1VRo-8.d.ts +44 -0
  317. package/dist/timing/index.d.ts +4 -0
  318. package/dist/timing/index.d.ts.map +1 -0
  319. package/dist/timing/index.js +3 -0
  320. package/dist/timing/index.js.map +1 -0
  321. package/dist/timing/narrationTiming.d.ts +54 -0
  322. package/dist/timing/narrationTiming.d.ts.map +1 -0
  323. package/dist/timing/narrationTiming.js +190 -0
  324. package/dist/timing/narrationTiming.js.map +1 -0
  325. package/dist/timing/readingTime.d.ts +54 -0
  326. package/dist/timing/readingTime.d.ts.map +1 -0
  327. package/dist/timing/readingTime.js +49 -0
  328. package/dist/timing/readingTime.js.map +1 -0
  329. package/package.json +17 -3
  330. package/src/__tests__/contentContainer.test.ts +282 -0
  331. package/src/__tests__/contentExtractor.test.ts +183 -0
  332. package/src/__tests__/seededRandom.test.ts +142 -0
  333. package/src/__tests__/slideshowGenerator.test.ts +128 -0
  334. package/src/__tests__/timing.test.ts +167 -0
  335. package/src/generate/contentExtractor.ts +808 -0
  336. package/src/generate/index.ts +21 -0
  337. package/src/generate/slideshowGenerator.ts +273 -0
  338. package/src/generate/templateMapper.ts +170 -0
  339. package/src/index.ts +3 -0
  340. package/src/random/SeededRandom.ts +127 -0
  341. package/src/random/index.ts +1 -0
  342. package/src/storage/ContentContainer.ts +200 -0
  343. package/src/storage/MediaProviderFromContainer.ts +92 -0
  344. package/src/storage/index.ts +3 -0
  345. package/src/timing/index.ts +17 -0
  346. package/src/timing/narrationTiming.ts +220 -0
  347. package/src/timing/readingTime.ts +94 -0
  348. package/dist/chunk-VJN7UB2Z.js +0 -145
  349. package/dist/chunk-VJN7UB2Z.js.map +0 -1
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Markdown → Doc Conversion
3
+ *
4
+ * Converts a MarkdownDocument into a hierarchical Doc whose Block tree
5
+ * mirrors the heading structure of the markdown. Every heading (H1–H6)
6
+ * becomes a Block; body content between headings populates `contents`;
7
+ * sub-headings nest as `children`.
8
+ *
9
+ * This enables using BlockTemplates to supply alternate visualizations
10
+ * for each section of a markdown document.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import { parseMarkdown } from '@bendyline/squisq/markdown';
15
+ * import { markdownToDoc } from '@bendyline/squisq/doc';
16
+ *
17
+ * const md = parseMarkdown('# Intro\n\nHello world\n\n## Details\n\nMore text');
18
+ * const doc = markdownToDoc(md);
19
+ * // doc.blocks[0].sourceHeading.depth === 1 ("# Intro")
20
+ * // doc.blocks[0].contents → [paragraph("Hello world")]
21
+ * // doc.blocks[0].children[0].sourceHeading.depth === 2 ("## Details")
22
+ * ```
23
+ */
24
+ import type { Doc, Block } from '../schemas/Doc.js';
25
+ import type { MarkdownDocument, MarkdownHeading } from '../markdown/types.js';
26
+ /**
27
+ * Options for markdownToDoc().
28
+ */
29
+ export interface MarkdownToDocOptions {
30
+ /** Article ID for the generated Doc. Default: 'markdown-doc' */
31
+ articleId?: string;
32
+ /** Default template name for heading blocks. Default: 'sectionHeader' */
33
+ defaultTemplate?: string;
34
+ /** Default duration per block in seconds. Default: 5 */
35
+ defaultDuration?: number;
36
+ /** Custom ID generator. Receives the heading node and its index. */
37
+ generateId?: (heading: MarkdownHeading, index: number) => string;
38
+ }
39
+ /**
40
+ * Convert a MarkdownDocument into a Doc with a heading-driven Block hierarchy.
41
+ *
42
+ * **Algorithm:**
43
+ * 1. Walk the document's top-level children sequentially
44
+ * 2. Each MarkdownHeading starts a new block at its depth level
45
+ * 3. Non-heading nodes accumulate as `contents` on the current block
46
+ * 4. Sub-headings (deeper depth) nest as `children` of the current block
47
+ * 5. Same-level or shallower headings close the current block and start a sibling/ancestor
48
+ * 6. Content before the first heading goes into a "preamble" block with no sourceHeading
49
+ *
50
+ * @param markdownDoc - A parsed MarkdownDocument
51
+ * @param options - Conversion options
52
+ * @returns A Doc whose blocks mirror the markdown heading structure
53
+ */
54
+ export declare function markdownToDoc(markdownDoc: MarkdownDocument, options?: MarkdownToDocOptions): Doc;
55
+ /**
56
+ * Flatten a nested block tree into a depth-first ordered array.
57
+ * Useful for calculating sequential timing or iterating all blocks.
58
+ */
59
+ export declare function flattenBlocks(blocks: Block[]): Block[];
60
+ /**
61
+ * Count the total number of blocks in a nested tree (including children at all levels).
62
+ */
63
+ export declare function countBlocks(blocks: Block[]): number;
64
+ /**
65
+ * Get the heading depth for a block. Returns 0 for preamble blocks (no heading).
66
+ */
67
+ export declare function getBlockDepth(block: Block): number;
68
+ //# sourceMappingURL=markdownToDoc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdownToDoc.d.ts","sourceRoot":"","sources":["../../src/doc/markdownToDoc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAqB,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAOjG;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,yEAAyE;IACzE,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,wDAAwD;IACxD,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,oEAAoE;IACpE,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;CAClE;AAiDD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,CAAC,WAAW,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,GAAG,CA6HhG;AAMD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,CAStD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CASnD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAElD"}
@@ -0,0 +1,225 @@
1
+ /**
2
+ * Markdown → Doc Conversion
3
+ *
4
+ * Converts a MarkdownDocument into a hierarchical Doc whose Block tree
5
+ * mirrors the heading structure of the markdown. Every heading (H1–H6)
6
+ * becomes a Block; body content between headings populates `contents`;
7
+ * sub-headings nest as `children`.
8
+ *
9
+ * This enables using BlockTemplates to supply alternate visualizations
10
+ * for each section of a markdown document.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import { parseMarkdown } from '@bendyline/squisq/markdown';
15
+ * import { markdownToDoc } from '@bendyline/squisq/doc';
16
+ *
17
+ * const md = parseMarkdown('# Intro\n\nHello world\n\n## Details\n\nMore text');
18
+ * const doc = markdownToDoc(md);
19
+ * // doc.blocks[0].sourceHeading.depth === 1 ("# Intro")
20
+ * // doc.blocks[0].contents → [paragraph("Hello world")]
21
+ * // doc.blocks[0].children[0].sourceHeading.depth === 2 ("## Details")
22
+ * ```
23
+ */
24
+ import { extractPlainText } from '../markdown/utils.js';
25
+ // ============================================
26
+ // ID Generation
27
+ // ============================================
28
+ /**
29
+ * Convert text to a URL-friendly slug.
30
+ * "Getting Started & More" → "getting-started-more"
31
+ */
32
+ const SLUG_NON_WORD_RE = /[^\w\s-]/g;
33
+ const SLUG_SPACES_RE = /[\s_]+/g;
34
+ const SLUG_MULTI_HYPHEN_RE = /-+/g;
35
+ const SLUG_TRIM_HYPHEN_RE = /^-|-$/g;
36
+ function slugify(text) {
37
+ return (text
38
+ .toLowerCase()
39
+ .replace(SLUG_NON_WORD_RE, '') // Remove non-word chars (except spaces and hyphens)
40
+ .replace(SLUG_SPACES_RE, '-') // Replace spaces/underscores with hyphens
41
+ .replace(SLUG_MULTI_HYPHEN_RE, '-') // Collapse multiple hyphens
42
+ .replace(SLUG_TRIM_HYPHEN_RE, '') || // Trim leading/trailing hyphens
43
+ 'block'); // Fallback for empty result
44
+ }
45
+ /**
46
+ * Creates an ID generator that produces unique slugified IDs.
47
+ * Appends -2, -3, etc. for duplicate headings.
48
+ */
49
+ function createIdGenerator() {
50
+ const used = new Map();
51
+ return (heading, _index) => {
52
+ const text = extractPlainText(heading);
53
+ const base = slugify(text);
54
+ const count = used.get(base) ?? 0;
55
+ used.set(base, count + 1);
56
+ if (count === 0)
57
+ return base;
58
+ return `${base}-${count + 1}`;
59
+ };
60
+ }
61
+ // ============================================
62
+ // Core Conversion
63
+ // ============================================
64
+ /**
65
+ * Convert a MarkdownDocument into a Doc with a heading-driven Block hierarchy.
66
+ *
67
+ * **Algorithm:**
68
+ * 1. Walk the document's top-level children sequentially
69
+ * 2. Each MarkdownHeading starts a new block at its depth level
70
+ * 3. Non-heading nodes accumulate as `contents` on the current block
71
+ * 4. Sub-headings (deeper depth) nest as `children` of the current block
72
+ * 5. Same-level or shallower headings close the current block and start a sibling/ancestor
73
+ * 6. Content before the first heading goes into a "preamble" block with no sourceHeading
74
+ *
75
+ * @param markdownDoc - A parsed MarkdownDocument
76
+ * @param options - Conversion options
77
+ * @returns A Doc whose blocks mirror the markdown heading structure
78
+ */
79
+ export function markdownToDoc(markdownDoc, options) {
80
+ const articleId = options?.articleId ?? 'markdown-doc';
81
+ const defaultTemplate = options?.defaultTemplate ?? 'sectionHeader';
82
+ const defaultDuration = options?.defaultDuration ?? 5;
83
+ const generateId = options?.generateId ?? createIdGenerator();
84
+ const rootBlocks = [];
85
+ let headingIndex = 0;
86
+ // Stack tracks the nesting context: each entry is a block and its heading depth.
87
+ // We push when we go deeper, pop when we come back up.
88
+ const stack = [];
89
+ // Accumulator for content nodes that appear before any heading (preamble)
90
+ // or between the current heading and the next heading/sub-heading.
91
+ let pendingContents = [];
92
+ let currentBlock = null;
93
+ function flushContents() {
94
+ if (currentBlock && pendingContents.length > 0) {
95
+ currentBlock.contents = (currentBlock.contents ?? []).concat(pendingContents);
96
+ pendingContents = [];
97
+ }
98
+ }
99
+ function makeBlock(heading) {
100
+ const id = heading ? generateId(heading, headingIndex++) : 'preamble';
101
+ // Use template from annotation if present, otherwise fall back to default
102
+ const annotation = heading?.templateAnnotation;
103
+ const template = annotation?.template ?? (heading ? defaultTemplate : undefined);
104
+ const block = {
105
+ id,
106
+ startTime: 0,
107
+ duration: defaultDuration,
108
+ audioSegment: 0,
109
+ template,
110
+ ...(heading ? { sourceHeading: heading } : {}),
111
+ };
112
+ // Propagate key-value params from annotation to templateOverrides
113
+ if (annotation?.params) {
114
+ block.templateOverrides = annotation.params;
115
+ }
116
+ return block;
117
+ }
118
+ for (const node of markdownDoc.children) {
119
+ if (node.type === 'heading') {
120
+ const heading = node;
121
+ const depth = heading.depth;
122
+ // Flush any accumulated content to the current block
123
+ flushContents();
124
+ // Create the new block for this heading
125
+ const newBlock = makeBlock(heading);
126
+ if (stack.length === 0) {
127
+ // If there's a preamble block with no heading, push it first
128
+ if (currentBlock && !currentBlock.sourceHeading) {
129
+ rootBlocks.push(currentBlock);
130
+ }
131
+ // This is a root-level block (or the first heading)
132
+ rootBlocks.push(newBlock);
133
+ stack.push({ block: newBlock, depth });
134
+ }
135
+ else {
136
+ // Find where this heading fits in the hierarchy
137
+ // Pop blocks from the stack until we find a parent with lower depth
138
+ while (stack.length > 0 && stack[stack.length - 1].depth >= depth) {
139
+ stack.pop();
140
+ }
141
+ if (stack.length === 0) {
142
+ // Same level as root or shallower — new root block
143
+ rootBlocks.push(newBlock);
144
+ stack.push({ block: newBlock, depth });
145
+ }
146
+ else {
147
+ // Deeper — child of the current stack top
148
+ const parent = stack[stack.length - 1].block;
149
+ if (!parent.children)
150
+ parent.children = [];
151
+ parent.children.push(newBlock);
152
+ stack.push({ block: newBlock, depth });
153
+ }
154
+ }
155
+ currentBlock = newBlock;
156
+ }
157
+ else {
158
+ // Non-heading block node — accumulate as content
159
+ if (!currentBlock) {
160
+ // Content before any heading → create preamble block
161
+ currentBlock = makeBlock(null);
162
+ }
163
+ pendingContents.push(node);
164
+ }
165
+ }
166
+ // Flush remaining content
167
+ flushContents();
168
+ // If we only had preamble content (no headings at all), push it
169
+ if (currentBlock && !currentBlock.sourceHeading && !rootBlocks.includes(currentBlock)) {
170
+ rootBlocks.push(currentBlock);
171
+ }
172
+ // Calculate basic timing
173
+ const allBlocks = flattenBlocks(rootBlocks);
174
+ let currentTime = 0;
175
+ for (const block of allBlocks) {
176
+ block.startTime = currentTime;
177
+ currentTime += block.duration;
178
+ }
179
+ return {
180
+ articleId,
181
+ duration: currentTime,
182
+ blocks: rootBlocks,
183
+ audio: {
184
+ segments: [],
185
+ },
186
+ ...(markdownDoc.frontmatter ? { frontmatter: markdownDoc.frontmatter } : {}),
187
+ };
188
+ }
189
+ // ============================================
190
+ // Utilities
191
+ // ============================================
192
+ /**
193
+ * Flatten a nested block tree into a depth-first ordered array.
194
+ * Useful for calculating sequential timing or iterating all blocks.
195
+ */
196
+ export function flattenBlocks(blocks) {
197
+ const result = [];
198
+ for (const block of blocks) {
199
+ result.push(block);
200
+ if (block.children) {
201
+ result.push(...flattenBlocks(block.children));
202
+ }
203
+ }
204
+ return result;
205
+ }
206
+ /**
207
+ * Count the total number of blocks in a nested tree (including children at all levels).
208
+ */
209
+ export function countBlocks(blocks) {
210
+ let count = 0;
211
+ for (const block of blocks) {
212
+ count += 1;
213
+ if (block.children) {
214
+ count += countBlocks(block.children);
215
+ }
216
+ }
217
+ return count;
218
+ }
219
+ /**
220
+ * Get the heading depth for a block. Returns 0 for preamble blocks (no heading).
221
+ */
222
+ export function getBlockDepth(block) {
223
+ return block.sourceHeading?.depth ?? 0;
224
+ }
225
+ //# sourceMappingURL=markdownToDoc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdownToDoc.js","sourceRoot":"","sources":["../../src/doc/markdownToDoc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAuBxD,+CAA+C;AAC/C,gBAAgB;AAChB,+CAA+C;AAE/C;;;GAGG;AACH,MAAM,gBAAgB,GAAG,WAAW,CAAC;AACrC,MAAM,cAAc,GAAG,SAAS,CAAC;AACjC,MAAM,oBAAoB,GAAG,KAAK,CAAC;AACnC,MAAM,mBAAmB,GAAG,QAAQ,CAAC;AAErC,SAAS,OAAO,CAAC,IAAY;IAC3B,OAAO,CACL,IAAI;SACD,WAAW,EAAE;SACb,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC,oDAAoD;SAClF,OAAO,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC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M,MAAM,GAAY,EAAE,CAAC;IAC3B,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACnB,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;YACnB,MAAM,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,MAAe;IACzC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,KAAK,IAAI,CAAC,CAAC;QACX,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;YACnB,KAAK,IAAI,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,KAAY;IACxC,OAAO,KAAK,CAAC,aAAa,EAAE,KAAK,IAAI,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Accent Image Utility
3
+ *
4
+ * Creates image layers and layout adjustments for accent images on text-based slides.
5
+ * Accent images are tasteful additions that complement text without overwhelming it.
6
+ *
7
+ * Layout patterns:
8
+ * - left-strip: 35% width vertical strip on left, text area shifted to right 65%
9
+ * - right-strip: 35% width vertical strip on right, text area shifted to left 65%
10
+ * - bottom-strip: 35% height horizontal strip at bottom, text area in upper 65%
11
+ * - corner-inset: Small 25% corner image with gradient vignette
12
+ *
13
+ * This is shared code used by both site and efb-app doc renderers.
14
+ */
15
+ import type { Layer, Animation } from '../../schemas/Doc.js';
16
+ import type { AccentImage, AccentPosition } from '../../schemas/BlockTemplates.js';
17
+ /**
18
+ * Layout adjustments when an accent image is present.
19
+ * Templates use these values to reposition their text content.
20
+ */
21
+ export interface AccentLayout {
22
+ /** X offset for text center (e.g., '64%' for left-strip) */
23
+ textCenterX: string;
24
+ /** Width available for text content */
25
+ textWidth: string;
26
+ /** Y offset adjustment for vertical positioning */
27
+ textYAdjust: number;
28
+ /** Whether to adjust Y positions (for bottom-strip) */
29
+ adjustY: boolean;
30
+ }
31
+ /**
32
+ * Default layout when no accent image is present.
33
+ */
34
+ export declare const DEFAULT_LAYOUT: AccentLayout;
35
+ /**
36
+ * Map ambientMotion values to proper Ken Burns animations.
37
+ * Uses slowZoom variants which provide smooth pan/zoom without opacity changes.
38
+ * Supports both standard values ('zoomIn', 'panLeft', etc.) and legacy
39
+ * aliases ('in', 'out', 'left', 'right') for backward compatibility.
40
+ *
41
+ * @param motion - The ambient motion value (e.g., 'zoomIn', 'panLeft')
42
+ * @param duration - Optional animation duration in seconds
43
+ */
44
+ export declare function mapAmbientMotion(motion: string | undefined, duration?: number): Animation | undefined;
45
+ /**
46
+ * Get layout adjustments based on accent position.
47
+ */
48
+ export declare function getAccentLayout(position: AccentPosition): AccentLayout;
49
+ /**
50
+ * Create layers for an accent image.
51
+ * Returns the image layer and any overlay/gradient layers needed.
52
+ */
53
+ export declare function createAccentLayers(accent: AccentImage, slideId: string): Layer[];
54
+ /**
55
+ * Adjust a Y position value based on accent layout.
56
+ * Used by templates to shift content when bottom-strip is present.
57
+ */
58
+ export declare function adjustY(originalY: string | number, layout: AccentLayout): string;
59
+ //# sourceMappingURL=accentImage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accentImage.d.ts","sourceRoot":"","sources":["../../../src/doc/templates/accentImage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,KAAK,EAA0B,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACrF,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAInF;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,4DAA4D;IAC5D,WAAW,EAAE,MAAM,CAAC;IACpB,uCAAuC;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,mDAAmD;IACnD,WAAW,EAAE,MAAM,CAAC;IACpB,uDAAuD;IACvD,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,YAK5B,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,QAAQ,CAAC,EAAE,MAAM,GAChB,SAAS,GAAG,SAAS,CAmBvB;AASD;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,cAAc,GAAG,YAAY,CAiCtE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,EAAE,CA2BhF;AAmKD;;;GAGG;AACH,wBAAgB,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,MAAM,CAgBhF"}
@@ -0,0 +1,275 @@
1
+ /**
2
+ * Accent Image Utility
3
+ *
4
+ * Creates image layers and layout adjustments for accent images on text-based slides.
5
+ * Accent images are tasteful additions that complement text without overwhelming it.
6
+ *
7
+ * Layout patterns:
8
+ * - left-strip: 35% width vertical strip on left, text area shifted to right 65%
9
+ * - right-strip: 35% width vertical strip on right, text area shifted to left 65%
10
+ * - bottom-strip: 35% height horizontal strip at bottom, text area in upper 65%
11
+ * - corner-inset: Small 25% corner image with gradient vignette
12
+ *
13
+ * This is shared code used by both site and efb-app doc renderers.
14
+ */
15
+ const PERCENTAGE_RE = /^(\d+(?:\.\d+)?)\s*%?$/;
16
+ /**
17
+ * Default layout when no accent image is present.
18
+ */
19
+ export const DEFAULT_LAYOUT = {
20
+ textCenterX: '50%',
21
+ textWidth: '85%',
22
+ textYAdjust: 0,
23
+ adjustY: false,
24
+ };
25
+ /**
26
+ * Map ambientMotion values to proper Ken Burns animations.
27
+ * Uses slowZoom variants which provide smooth pan/zoom without opacity changes.
28
+ * Supports both standard values ('zoomIn', 'panLeft', etc.) and legacy
29
+ * aliases ('in', 'out', 'left', 'right') for backward compatibility.
30
+ *
31
+ * @param motion - The ambient motion value (e.g., 'zoomIn', 'panLeft')
32
+ * @param duration - Optional animation duration in seconds
33
+ */
34
+ export function mapAmbientMotion(motion, duration) {
35
+ if (!motion)
36
+ return undefined;
37
+ const base = duration !== undefined ? { duration } : {};
38
+ switch (motion) {
39
+ case 'zoomIn':
40
+ case 'in':
41
+ return { type: 'slowZoom', direction: 'in', ...base };
42
+ case 'zoomOut':
43
+ case 'out':
44
+ return { type: 'slowZoom', direction: 'out', ...base };
45
+ case 'panLeft':
46
+ case 'left':
47
+ return { type: 'slowZoom', panDirection: 'left', ...base };
48
+ case 'panRight':
49
+ case 'right':
50
+ return { type: 'slowZoom', panDirection: 'right', ...base };
51
+ default:
52
+ return undefined;
53
+ }
54
+ }
55
+ /**
56
+ * Accent strip width/height as percentage.
57
+ * 35% gives the image enough presence to complement the text without overwhelming it.
58
+ */
59
+ const STRIP_SIZE = 35;
60
+ const STRIP_SIZE_PCT = `${STRIP_SIZE}%`;
61
+ /**
62
+ * Get layout adjustments based on accent position.
63
+ */
64
+ export function getAccentLayout(position) {
65
+ switch (position) {
66
+ case 'left-strip':
67
+ return {
68
+ textCenterX: `${50 + STRIP_SIZE / 2}%`, // Shift center right
69
+ textWidth: `${100 - STRIP_SIZE - 8}%`, // Leave margin
70
+ textYAdjust: 0,
71
+ adjustY: false,
72
+ };
73
+ case 'right-strip':
74
+ return {
75
+ textCenterX: `${50 - STRIP_SIZE / 2}%`, // Shift center left
76
+ textWidth: `${100 - STRIP_SIZE - 8}%`,
77
+ textYAdjust: 0,
78
+ adjustY: false,
79
+ };
80
+ case 'bottom-strip':
81
+ return {
82
+ textCenterX: '50%',
83
+ textWidth: '85%',
84
+ textYAdjust: -10, // Shift content up by 10%
85
+ adjustY: true,
86
+ };
87
+ case 'corner-inset':
88
+ return {
89
+ textCenterX: '45%', // Slight shift to avoid corner
90
+ textWidth: '70%',
91
+ textYAdjust: 0,
92
+ adjustY: false,
93
+ };
94
+ default:
95
+ return DEFAULT_LAYOUT;
96
+ }
97
+ }
98
+ /**
99
+ * Create layers for an accent image.
100
+ * Returns the image layer and any overlay/gradient layers needed.
101
+ */
102
+ export function createAccentLayers(accent, slideId) {
103
+ const layers = [];
104
+ const { src, alt, position, ambientMotion, credit, license } = accent;
105
+ switch (position) {
106
+ case 'left-strip':
107
+ layers.push(createStripImage(src, alt, 'left', slideId, ambientMotion, credit, license));
108
+ layers.push(createStripGradient('left', slideId));
109
+ break;
110
+ case 'right-strip':
111
+ layers.push(createStripImage(src, alt, 'right', slideId, ambientMotion, credit, license));
112
+ layers.push(createStripGradient('right', slideId));
113
+ break;
114
+ case 'bottom-strip':
115
+ layers.push(createBottomStripImage(src, alt, slideId, ambientMotion, credit, license));
116
+ layers.push(createBottomStripGradient(slideId));
117
+ break;
118
+ case 'corner-inset':
119
+ layers.push(createCornerInsetImage(src, alt, slideId, ambientMotion, credit, license));
120
+ layers.push(createCornerVignette(slideId));
121
+ break;
122
+ }
123
+ return layers;
124
+ }
125
+ /**
126
+ * Create a vertical strip image layer.
127
+ */
128
+ function createStripImage(src, alt, side, slideId, ambientMotion, credit, license) {
129
+ return {
130
+ type: 'image',
131
+ id: `${slideId}-accent-img`,
132
+ content: {
133
+ src,
134
+ alt,
135
+ fit: 'cover',
136
+ credit,
137
+ license,
138
+ },
139
+ position: {
140
+ x: side === 'left' ? 0 : `${100 - STRIP_SIZE}%`,
141
+ y: 0,
142
+ width: STRIP_SIZE_PCT,
143
+ height: '100%',
144
+ },
145
+ animation: mapAmbientMotion(ambientMotion, 15),
146
+ };
147
+ }
148
+ /**
149
+ * Create a gradient overlay for strip images (fades to background).
150
+ */
151
+ function createStripGradient(side, slideId) {
152
+ // Gradient from transparent to background color at the edge
153
+ const gradientId = side === 'left' ? 'accent-gradient-left' : 'accent-gradient-right';
154
+ return {
155
+ type: 'shape',
156
+ id: `${slideId}-accent-fade`,
157
+ content: {
158
+ shape: 'rect',
159
+ // SVG gradient will be handled by the renderer
160
+ // Using a semi-transparent overlay as fallback
161
+ fill: `url(#${gradientId})`,
162
+ },
163
+ position: {
164
+ x: side === 'left' ? `${STRIP_SIZE - 8}%` : `${100 - STRIP_SIZE}%`,
165
+ y: 0,
166
+ width: '10%',
167
+ height: '100%',
168
+ },
169
+ };
170
+ }
171
+ /**
172
+ * Create a horizontal bottom strip image layer.
173
+ */
174
+ function createBottomStripImage(src, alt, slideId, ambientMotion, credit, license) {
175
+ return {
176
+ type: 'image',
177
+ id: `${slideId}-accent-img`,
178
+ content: {
179
+ src,
180
+ alt,
181
+ fit: 'cover',
182
+ credit,
183
+ license,
184
+ },
185
+ position: {
186
+ x: 0,
187
+ y: `${100 - STRIP_SIZE}%`,
188
+ width: '100%',
189
+ height: STRIP_SIZE_PCT,
190
+ },
191
+ animation: mapAmbientMotion(ambientMotion, 15),
192
+ };
193
+ }
194
+ /**
195
+ * Create a gradient overlay for bottom strip (fades up to background).
196
+ */
197
+ function createBottomStripGradient(slideId) {
198
+ return {
199
+ type: 'shape',
200
+ id: `${slideId}-accent-fade`,
201
+ content: {
202
+ shape: 'rect',
203
+ fill: 'url(#accent-gradient-bottom)',
204
+ },
205
+ position: {
206
+ x: 0,
207
+ y: `${100 - STRIP_SIZE - 8}%`,
208
+ width: '100%',
209
+ height: '12%',
210
+ },
211
+ };
212
+ }
213
+ /**
214
+ * Create a corner inset image layer.
215
+ */
216
+ function createCornerInsetImage(src, alt, slideId, ambientMotion, credit, license) {
217
+ return {
218
+ type: 'image',
219
+ id: `${slideId}-accent-img`,
220
+ content: {
221
+ src,
222
+ alt,
223
+ fit: 'cover',
224
+ credit,
225
+ license,
226
+ },
227
+ position: {
228
+ x: '70%',
229
+ y: '60%',
230
+ width: '28%',
231
+ height: '38%',
232
+ anchor: 'top-left',
233
+ },
234
+ animation: mapAmbientMotion(ambientMotion, 15) ?? { type: 'fadeIn', duration: 2, delay: 0.5 },
235
+ };
236
+ }
237
+ /**
238
+ * Create a vignette overlay around corner inset.
239
+ */
240
+ function createCornerVignette(slideId) {
241
+ return {
242
+ type: 'shape',
243
+ id: `${slideId}-accent-vignette`,
244
+ content: {
245
+ shape: 'rect',
246
+ fill: 'url(#accent-vignette-corner)',
247
+ borderRadius: 8,
248
+ },
249
+ position: {
250
+ x: '69%',
251
+ y: '59%',
252
+ width: '30%',
253
+ height: '40%',
254
+ },
255
+ };
256
+ }
257
+ /**
258
+ * Adjust a Y position value based on accent layout.
259
+ * Used by templates to shift content when bottom-strip is present.
260
+ */
261
+ export function adjustY(originalY, layout) {
262
+ if (!layout.adjustY || layout.textYAdjust === 0) {
263
+ return typeof originalY === 'number' ? `${originalY}%` : originalY;
264
+ }
265
+ // Parse percentage value
266
+ const yStr = typeof originalY === 'number' ? `${originalY}` : originalY;
267
+ const match = yStr.match(PERCENTAGE_RE);
268
+ if (match) {
269
+ const yValue = parseFloat(match[1]);
270
+ const adjusted = Math.max(5, yValue + layout.textYAdjust);
271
+ return `${adjusted}%`;
272
+ }
273
+ return yStr;
274
+ }
275
+ //# sourceMappingURL=accentImage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accentImage.js","sourceRoot":"","sources":["../../../src/doc/templates/accentImage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH,MAAM,aAAa,GAAG,wBAAwB,CAAC;AAiB/C;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAiB;IAC1C,WAAW,EAAE,KAAK;IAClB,SAAS,EAAE,KAAK;IAChB,WAAW,EAAE,CAAC;IACd,OAAO,EAAE,KAAK;CACf,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAC9B,MAA0B,EAC1B,QAAiB;IAEjB,IAAI,CAAC,MAAM;QAAE,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