@bendyline/squisq 2.1.0 → 2.3.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 (442) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE.md +24 -0
  3. package/README.md +8 -8
  4. package/dist/{ContentContainer-BXUlIf18.d.ts → ContentContainer-B2w9sUoL.d.ts} +15 -0
  5. package/dist/{Doc-DynJleo-.d.ts → Doc-COe-rPQB.d.ts} +7 -5
  6. package/dist/{ImageEditDoc-Ca4Tr9uN.d.ts → ImageEditDoc-dtKahVyD.d.ts} +1 -1
  7. package/dist/{annotationCoercion-Dr_DY9Hx.d.ts → annotationCoercion-PtRQhk5V.d.ts} +1 -1
  8. package/dist/{chunk-VWCJ2WXC.js → chunk-2ZWIXGAC.js} +0 -1
  9. package/dist/{chunk-VYFRI7R6.js → chunk-32R2RZAO.js} +72 -3
  10. package/dist/chunk-3IGPAPQ7.js +645 -0
  11. package/dist/{chunk-QE7TWGVT.js → chunk-4VOD55SX.js} +0 -1
  12. package/dist/{chunk-3E5F2XMR.js → chunk-67L6WRJN.js} +0 -1
  13. package/dist/{chunk-5DKBFXPY.js → chunk-6ECMNUIP.js} +26 -18
  14. package/dist/{chunk-DBS6RIFL.js → chunk-7N4G32LG.js} +0 -1
  15. package/dist/{chunk-JOQYPRDZ.js → chunk-7YEZFHLS.js} +10 -8
  16. package/dist/{chunk-2UQOHYE2.js → chunk-7ZAAICW4.js} +0 -1
  17. package/dist/{chunk-66QO7XFB.js → chunk-ACZOVWX3.js} +117 -7
  18. package/dist/{chunk-5J4HKRJF.js → chunk-BAOV476U.js} +0 -1
  19. package/dist/chunk-BCCXTMN5.js +699 -0
  20. package/dist/{chunk-JHZWYRSW.js → chunk-C33GTPUZ.js} +11 -4
  21. package/dist/{chunk-XNLB57UD.js → chunk-EK446BUE.js} +18 -2
  22. package/dist/{chunk-VR7UPJ7C.js → chunk-FCG3BIZN.js} +12 -1
  23. package/dist/{chunk-JI77MGAK.js → chunk-GIIOY6XR.js} +2178 -1291
  24. package/dist/{chunk-Q7LROV2H.js → chunk-NKNMGIIN.js} +0 -1
  25. package/dist/chunk-OPO5K4DZ.js +241 -0
  26. package/dist/{chunk-TUWMK62B.js → chunk-PUS54YU6.js} +45 -2
  27. package/dist/{chunk-OTKVFVL6.js → chunk-QNTQIEIV.js} +130 -47
  28. package/dist/{chunk-5UYI3RJB.js → chunk-QWCFK5FN.js} +55 -40
  29. package/dist/{chunk-GZY66SDN.js → chunk-R3KTTOMS.js} +0 -1
  30. package/dist/{chunk-ILWDXLUK.js → chunk-RS5AP3J4.js} +49 -10
  31. package/dist/{chunk-QUUPYOSP.js → chunk-SPTY4C6F.js} +136 -5
  32. package/dist/{chunk-4X3JQXNM.js → chunk-XOFT65EX.js} +1 -2
  33. package/dist/{chunk-FVTQSNR7.js → chunk-XRW6P7IF.js} +13 -5
  34. package/dist/{chunk-R2YZTCLO.js → chunk-ZQKZSJAX.js} +1 -2
  35. package/dist/doc/index.d.ts +311 -13
  36. package/dist/doc/index.js +25 -17
  37. package/dist/generate/index.d.ts +2 -2
  38. package/dist/generate/index.js +1 -3
  39. package/dist/icons/index.js +2 -4
  40. package/dist/icons/inlineIconMarker.js +1 -2
  41. package/dist/imageEdit/index.d.ts +48 -17
  42. package/dist/imageEdit/index.js +3 -4
  43. package/dist/index.d.ts +13 -13
  44. package/dist/index.js +67 -33
  45. package/dist/jsonForm/index.d.ts +10 -3
  46. package/dist/jsonForm/index.js +8 -7
  47. package/dist/markdown/index.d.ts +75 -11
  48. package/dist/markdown/index.js +32 -7
  49. package/dist/{materializePageSection-DDzubQXo.d.ts → materializePageSection-BSMOocve.d.ts} +2 -2
  50. package/dist/narration/index.d.ts +16 -3
  51. package/dist/narration/index.js +12 -14
  52. package/dist/random/index.d.ts +11 -2
  53. package/dist/random/index.js +1 -3
  54. package/dist/recommend/index.d.ts +1 -1
  55. package/dist/recommend/index.js +2 -4
  56. package/dist/schemas/index.d.ts +18 -6
  57. package/dist/schemas/index.js +7 -6
  58. package/dist/spatial/index.d.ts +2 -1
  59. package/dist/spatial/index.js +1 -2
  60. package/dist/storage/index.d.ts +4 -2
  61. package/dist/storage/index.js +1 -2
  62. package/dist/{themeLibrary-B72m0W1y.d.ts → themeLibrary-BUTWjufL.d.ts} +1 -1
  63. package/dist/timing/index.js +2 -4
  64. package/dist/transform/index.d.ts +3 -3
  65. package/dist/transform/index.js +6 -7
  66. package/dist/{types-C4kiRn_k.d.ts → types-8QjefM9J.d.ts} +38 -2
  67. package/dist/{types-BwMPl2CB.d.ts → types-CUNc9biN.d.ts} +24 -1
  68. package/dist/versions/index.d.ts +14 -11
  69. package/dist/versions/index.js +2 -3
  70. package/package.json +8 -3
  71. package/dist/chunk-2UQOHYE2.js.map +0 -1
  72. package/dist/chunk-3E5F2XMR.js.map +0 -1
  73. package/dist/chunk-4X3JQXNM.js.map +0 -1
  74. package/dist/chunk-5DKBFXPY.js.map +0 -1
  75. package/dist/chunk-5J4HKRJF.js.map +0 -1
  76. package/dist/chunk-5UYI3RJB.js.map +0 -1
  77. package/dist/chunk-66QO7XFB.js.map +0 -1
  78. package/dist/chunk-AMIR72JP.js +0 -380
  79. package/dist/chunk-AMIR72JP.js.map +0 -1
  80. package/dist/chunk-DBS6RIFL.js.map +0 -1
  81. package/dist/chunk-DNJKBAI7.js +0 -1
  82. package/dist/chunk-DNJKBAI7.js.map +0 -1
  83. package/dist/chunk-ET53IIEP.js +0 -1
  84. package/dist/chunk-ET53IIEP.js.map +0 -1
  85. package/dist/chunk-FVTQSNR7.js.map +0 -1
  86. package/dist/chunk-GZY66SDN.js.map +0 -1
  87. package/dist/chunk-ILWDXLUK.js.map +0 -1
  88. package/dist/chunk-JHZWYRSW.js.map +0 -1
  89. package/dist/chunk-JI77MGAK.js.map +0 -1
  90. package/dist/chunk-JOQYPRDZ.js.map +0 -1
  91. package/dist/chunk-OTKVFVL6.js.map +0 -1
  92. package/dist/chunk-PGGGKYWG.js +0 -1
  93. package/dist/chunk-PGGGKYWG.js.map +0 -1
  94. package/dist/chunk-Q7LROV2H.js.map +0 -1
  95. package/dist/chunk-QE7TWGVT.js.map +0 -1
  96. package/dist/chunk-QUUPYOSP.js.map +0 -1
  97. package/dist/chunk-R2GC6RLD.js +0 -344
  98. package/dist/chunk-R2GC6RLD.js.map +0 -1
  99. package/dist/chunk-R2YZTCLO.js.map +0 -1
  100. package/dist/chunk-S7A5D7ZJ.js +0 -174
  101. package/dist/chunk-S7A5D7ZJ.js.map +0 -1
  102. package/dist/chunk-TUWMK62B.js.map +0 -1
  103. package/dist/chunk-V543AI2F.js +0 -1
  104. package/dist/chunk-V543AI2F.js.map +0 -1
  105. package/dist/chunk-VR7UPJ7C.js.map +0 -1
  106. package/dist/chunk-VWCJ2WXC.js.map +0 -1
  107. package/dist/chunk-VYFRI7R6.js.map +0 -1
  108. package/dist/chunk-XNLB57UD.js.map +0 -1
  109. package/dist/chunk-ZLQKNOZQ.js +0 -1
  110. package/dist/chunk-ZLQKNOZQ.js.map +0 -1
  111. package/dist/doc/index.js.map +0 -1
  112. package/dist/generate/index.js.map +0 -1
  113. package/dist/icons/index.js.map +0 -1
  114. package/dist/icons/inlineIconMarker.js.map +0 -1
  115. package/dist/imageEdit/index.js.map +0 -1
  116. package/dist/index.js.map +0 -1
  117. package/dist/jsonForm/index.js.map +0 -1
  118. package/dist/markdown/index.js.map +0 -1
  119. package/dist/narration/index.js.map +0 -1
  120. package/dist/random/index.js.map +0 -1
  121. package/dist/recommend/index.js.map +0 -1
  122. package/dist/schemas/index.js.map +0 -1
  123. package/dist/spatial/index.js.map +0 -1
  124. package/dist/storage/index.js.map +0 -1
  125. package/dist/timing/index.js.map +0 -1
  126. package/dist/transform/index.js.map +0 -1
  127. package/dist/versions/index.js.map +0 -1
  128. package/src/__tests__/animationUtils.test.ts +0 -117
  129. package/src/__tests__/annotationCoercion.test.ts +0 -243
  130. package/src/__tests__/applyNarrationTiming.test.ts +0 -190
  131. package/src/__tests__/applyRenderStyle.test.ts +0 -146
  132. package/src/__tests__/asciiDiagramBattle.test.ts +0 -246
  133. package/src/__tests__/asciiDiagramDetect.test.ts +0 -162
  134. package/src/__tests__/asciiDiagramMapping.test.ts +0 -38
  135. package/src/__tests__/asciiDiagramParse.test.ts +0 -233
  136. package/src/__tests__/asciiDiagramPipeline.test.ts +0 -273
  137. package/src/__tests__/asciiDiagramRender.test.ts +0 -162
  138. package/src/__tests__/asciiDiagramRepair.test.ts +0 -84
  139. package/src/__tests__/asciiTimelineDetect.test.ts +0 -157
  140. package/src/__tests__/asciiTimelineParse.test.ts +0 -205
  141. package/src/__tests__/asciiTimelinePipeline.test.ts +0 -349
  142. package/src/__tests__/asciiTimelineRender.test.ts +0 -376
  143. package/src/__tests__/atmosphereLayers.test.ts +0 -108
  144. package/src/__tests__/attrTokens.test.ts +0 -167
  145. package/src/__tests__/colorUtils.test.ts +0 -112
  146. package/src/__tests__/contentContainer.test.ts +0 -325
  147. package/src/__tests__/contentExtractor.test.ts +0 -243
  148. package/src/__tests__/coverBlock.test.ts +0 -310
  149. package/src/__tests__/customTemplateSample.test.ts +0 -144
  150. package/src/__tests__/customTemplatesFrontmatter.test.ts +0 -221
  151. package/src/__tests__/customThemesFrontmatter.test.ts +0 -146
  152. package/src/__tests__/dataTable.test.ts +0 -145
  153. package/src/__tests__/diagramBlock.test.ts +0 -122
  154. package/src/__tests__/diagramLayout.test.ts +0 -134
  155. package/src/__tests__/diagramText.test.ts +0 -26
  156. package/src/__tests__/docToMarkdownMedia.test.ts +0 -83
  157. package/src/__tests__/drawing.test.ts +0 -109
  158. package/src/__tests__/drawingBlock.test.ts +0 -124
  159. package/src/__tests__/drawingLayout.test.ts +0 -171
  160. package/src/__tests__/fixtures/asciiDiagramBattle.ts +0 -512
  161. package/src/__tests__/fixtures/asciiDiagrams.ts +0 -287
  162. package/src/__tests__/fixtures/asciiTimelines.ts +0 -35
  163. package/src/__tests__/fixtures/treeviewFixtures.ts +0 -243
  164. package/src/__tests__/geohash.test.ts +0 -110
  165. package/src/__tests__/getLayers.test.ts +0 -243
  166. package/src/__tests__/getLayersFallback.test.ts +0 -103
  167. package/src/__tests__/haversine.test.ts +0 -63
  168. package/src/__tests__/iconResolve.test.ts +0 -122
  169. package/src/__tests__/imageEditExportSvg.test.ts +0 -70
  170. package/src/__tests__/imageEditState.test.ts +0 -74
  171. package/src/__tests__/imageEditVersions.test.ts +0 -243
  172. package/src/__tests__/inferDocumentTitle.test.ts +0 -50
  173. package/src/__tests__/inlineIconMarker.test.ts +0 -36
  174. package/src/__tests__/inputDescriptors.test.ts +0 -162
  175. package/src/__tests__/jsonForm.chooseControl.test.ts +0 -86
  176. package/src/__tests__/jsonForm.evaluateWhen.test.ts +0 -59
  177. package/src/__tests__/jsonForm.inferSchema.test.ts +0 -25
  178. package/src/__tests__/jsonForm.pointer.test.ts +0 -149
  179. package/src/__tests__/jsonForm.tokens.test.ts +0 -84
  180. package/src/__tests__/layoutBlock.test.ts +0 -83
  181. package/src/__tests__/layoutLayout.test.ts +0 -169
  182. package/src/__tests__/localForageAdapter.test.ts +0 -155
  183. package/src/__tests__/majorApiTypes.test.ts +0 -18
  184. package/src/__tests__/markdown.test.ts +0 -1009
  185. package/src/__tests__/markdownIcons.test.ts +0 -104
  186. package/src/__tests__/markdownSanitize.test.ts +0 -81
  187. package/src/__tests__/markdownToDoc.test.ts +0 -957
  188. package/src/__tests__/matchFontFamily.test.ts +0 -114
  189. package/src/__tests__/materializeBlockLayers.test.ts +0 -167
  190. package/src/__tests__/materializePageSections.test.ts +0 -404
  191. package/src/__tests__/materializeTestUtils.ts +0 -17
  192. package/src/__tests__/mediaAnnotations.test.ts +0 -91
  193. package/src/__tests__/mediaSchedule.test.ts +0 -118
  194. package/src/__tests__/narrationAlign.test.ts +0 -150
  195. package/src/__tests__/narrationFeatures.test.ts +0 -71
  196. package/src/__tests__/narrationNuclei.test.ts +0 -45
  197. package/src/__tests__/narrationPacing.test.ts +0 -189
  198. package/src/__tests__/narrationScript.test.ts +0 -149
  199. package/src/__tests__/narrationSessionRepro.test.ts +0 -62
  200. package/src/__tests__/narrationSidecar.test.ts +0 -88
  201. package/src/__tests__/narrationSyllables.test.ts +0 -65
  202. package/src/__tests__/narrationTestSignals.ts +0 -167
  203. package/src/__tests__/narrationVad.test.ts +0 -66
  204. package/src/__tests__/pageStyle.test.ts +0 -258
  205. package/src/__tests__/pandocAttrParse.test.ts +0 -187
  206. package/src/__tests__/recommendTemplates.test.ts +0 -183
  207. package/src/__tests__/resolveDocTheme.test.ts +0 -69
  208. package/src/__tests__/rootExports.test.ts +0 -61
  209. package/src/__tests__/scopedContentContainer.test.ts +0 -109
  210. package/src/__tests__/seededRandom.test.ts +0 -142
  211. package/src/__tests__/shapeGeometry.test.ts +0 -138
  212. package/src/__tests__/shapeVocabulary.test.ts +0 -133
  213. package/src/__tests__/storage.test.ts +0 -60
  214. package/src/__tests__/structuredData.test.ts +0 -249
  215. package/src/__tests__/surface.test.ts +0 -68
  216. package/src/__tests__/templateAnnotationParse.test.ts +0 -173
  217. package/src/__tests__/templateInputs.test.ts +0 -69
  218. package/src/__tests__/templateMetadata.test.ts +0 -32
  219. package/src/__tests__/templates.test.ts +0 -710
  220. package/src/__tests__/themeCompile.test.ts +0 -225
  221. package/src/__tests__/themeValidator.test.ts +0 -131
  222. package/src/__tests__/timing.test.ts +0 -167
  223. package/src/__tests__/transformProvenance.test.ts +0 -160
  224. package/src/__tests__/transformV2.test.ts +0 -163
  225. package/src/__tests__/transitionNormalize.test.ts +0 -61
  226. package/src/__tests__/treeviewBattle.test.ts +0 -76
  227. package/src/__tests__/treeviewDetect.test.ts +0 -168
  228. package/src/__tests__/treeviewParse.test.ts +0 -118
  229. package/src/__tests__/treeviewPipeline.test.ts +0 -183
  230. package/src/__tests__/treeviewRender.test.ts +0 -91
  231. package/src/__tests__/validateDoc.test.ts +0 -260
  232. package/src/__tests__/versions.test.ts +0 -459
  233. package/src/doc/annotationBlocks.ts +0 -117
  234. package/src/doc/applyNarrationTiming.ts +0 -244
  235. package/src/doc/asciiDiagram/chars.ts +0 -210
  236. package/src/doc/asciiDiagram/detect.ts +0 -175
  237. package/src/doc/asciiDiagram/index.ts +0 -38
  238. package/src/doc/asciiDiagram/mapping.ts +0 -225
  239. package/src/doc/asciiDiagram/parse.ts +0 -1095
  240. package/src/doc/asciiDiagram/render.ts +0 -963
  241. package/src/doc/asciiDiagram/repair.ts +0 -400
  242. package/src/doc/asciiDiagram/types.ts +0 -65
  243. package/src/doc/asciiTimeline/detect.ts +0 -138
  244. package/src/doc/asciiTimeline/index.ts +0 -26
  245. package/src/doc/asciiTimeline/mapping.ts +0 -43
  246. package/src/doc/asciiTimeline/parse.ts +0 -870
  247. package/src/doc/asciiTimeline/render.ts +0 -427
  248. package/src/doc/asciiTimeline/types.ts +0 -73
  249. package/src/doc/asciiTimeline/wrappedFlow.ts +0 -427
  250. package/src/doc/audioMapping.ts +0 -442
  251. package/src/doc/customTemplatesFrontmatter.ts +0 -273
  252. package/src/doc/customThemesFrontmatter.ts +0 -95
  253. package/src/doc/docToMarkdown.ts +0 -284
  254. package/src/doc/index.ts +0 -161
  255. package/src/doc/markdownToDoc.ts +0 -1054
  256. package/src/doc/materializeBlockLayers.ts +0 -465
  257. package/src/doc/mediaAnnotations.ts +0 -120
  258. package/src/doc/page/PageSection.ts +0 -174
  259. package/src/doc/page/materializePageSection.ts +0 -616
  260. package/src/doc/page/resolvePageBlock.ts +0 -108
  261. package/src/doc/page/sectionExtractors.ts +0 -466
  262. package/src/doc/pageCss.ts +0 -628
  263. package/src/doc/resolveDocTheme.ts +0 -56
  264. package/src/doc/standaloneAnnotation.ts +0 -58
  265. package/src/doc/structuredData.ts +0 -301
  266. package/src/doc/templateInputs.ts +0 -424
  267. package/src/doc/templates/__tests__/customTemplate.test.ts +0 -170
  268. package/src/doc/templates/__tests__/customTemplateRegistry.test.ts +0 -124
  269. package/src/doc/templates/__tests__/listBlock.test.ts +0 -64
  270. package/src/doc/templates/accentImage.ts +0 -362
  271. package/src/doc/templates/captionUtils.ts +0 -56
  272. package/src/doc/templates/comparisonBar.ts +0 -173
  273. package/src/doc/templates/coverBlock.ts +0 -255
  274. package/src/doc/templates/customTemplate.ts +0 -51
  275. package/src/doc/templates/dataTable.ts +0 -102
  276. package/src/doc/templates/dateEvent.ts +0 -147
  277. package/src/doc/templates/definitionCard.ts +0 -140
  278. package/src/doc/templates/diagramBlock.ts +0 -403
  279. package/src/doc/templates/diagramLayout.ts +0 -159
  280. package/src/doc/templates/drawingBlock.ts +0 -325
  281. package/src/doc/templates/drawingLayout.ts +0 -539
  282. package/src/doc/templates/factCard.ts +0 -146
  283. package/src/doc/templates/fallbackBlock.ts +0 -123
  284. package/src/doc/templates/featureBlock.ts +0 -209
  285. package/src/doc/templates/fullBleedQuote.ts +0 -83
  286. package/src/doc/templates/imageWithCaption.ts +0 -186
  287. package/src/doc/templates/index.ts +0 -642
  288. package/src/doc/templates/inputDescriptors.ts +0 -451
  289. package/src/doc/templates/layoutBlock.ts +0 -43
  290. package/src/doc/templates/layoutLayout.ts +0 -243
  291. package/src/doc/templates/listBlock.ts +0 -207
  292. package/src/doc/templates/mapBlock.ts +0 -138
  293. package/src/doc/templates/metadata.ts +0 -130
  294. package/src/doc/templates/persistentLayers.ts +0 -526
  295. package/src/doc/templates/photoGrid.ts +0 -190
  296. package/src/doc/templates/pullQuote.ts +0 -141
  297. package/src/doc/templates/quoteBlock.ts +0 -141
  298. package/src/doc/templates/registry.ts +0 -88
  299. package/src/doc/templates/sectionHeader.ts +0 -120
  300. package/src/doc/templates/statHighlight.ts +0 -146
  301. package/src/doc/templates/templateNames.ts +0 -22
  302. package/src/doc/templates/timelineBlock.ts +0 -613
  303. package/src/doc/templates/titleBlock.ts +0 -150
  304. package/src/doc/templates/tokens/__tests__/resolveTokens.test.ts +0 -487
  305. package/src/doc/templates/tokens/resolveTokens.ts +0 -453
  306. package/src/doc/templates/treeBlock.ts +0 -131
  307. package/src/doc/templates/twoColumn.ts +0 -263
  308. package/src/doc/templates/videoPullQuote.ts +0 -142
  309. package/src/doc/templates/videoWithCaption.ts +0 -135
  310. package/src/doc/treeview/chars.ts +0 -72
  311. package/src/doc/treeview/detect.ts +0 -145
  312. package/src/doc/treeview/index.ts +0 -30
  313. package/src/doc/treeview/mapping.ts +0 -95
  314. package/src/doc/treeview/parse.ts +0 -201
  315. package/src/doc/treeview/render.ts +0 -41
  316. package/src/doc/treeview/types.ts +0 -43
  317. package/src/doc/utils/animationUtils.ts +0 -399
  318. package/src/doc/utils/applyRenderStyle.ts +0 -106
  319. package/src/doc/utils/diagramText.ts +0 -78
  320. package/src/doc/utils/imageTreatment.ts +0 -70
  321. package/src/doc/utils/nearest.ts +0 -59
  322. package/src/doc/utils/shapeGeometry.ts +0 -614
  323. package/src/doc/utils/themeUtils.ts +0 -243
  324. package/src/doc/validate.ts +0 -575
  325. package/src/generate/contentExtractor.ts +0 -921
  326. package/src/generate/index.ts +0 -18
  327. package/src/generate/templateMapper.ts +0 -177
  328. package/src/icons/iconData.ts +0 -31
  329. package/src/icons/index.ts +0 -26
  330. package/src/icons/inlineIconMarker.ts +0 -73
  331. package/src/icons/resolve.ts +0 -139
  332. package/src/imageEdit/ImageEditVersionManager.ts +0 -73
  333. package/src/imageEdit/export.ts +0 -410
  334. package/src/imageEdit/index.ts +0 -72
  335. package/src/imageEdit/persistence.ts +0 -113
  336. package/src/imageEdit/state.ts +0 -112
  337. package/src/imageEdit/versionPaths.ts +0 -44
  338. package/src/imageEdit/versions.ts +0 -152
  339. package/src/index.ts +0 -15
  340. package/src/internal/immutable.ts +0 -58
  341. package/src/jsonForm/chooseControl.ts +0 -88
  342. package/src/jsonForm/evaluateWhen.ts +0 -59
  343. package/src/jsonForm/index.ts +0 -32
  344. package/src/jsonForm/inferSchema.ts +0 -25
  345. package/src/jsonForm/pointer.ts +0 -154
  346. package/src/jsonForm/tokens.ts +0 -78
  347. package/src/jsonForm/types.ts +0 -167
  348. package/src/markdown/annotationCoercion.ts +0 -295
  349. package/src/markdown/attrTokens.ts +0 -243
  350. package/src/markdown/convert.ts +0 -1353
  351. package/src/markdown/htmlParse.ts +0 -212
  352. package/src/markdown/index.ts +0 -152
  353. package/src/markdown/parse.ts +0 -103
  354. package/src/markdown/sanitize.ts +0 -318
  355. package/src/markdown/stringify.ts +0 -207
  356. package/src/markdown/types.ts +0 -710
  357. package/src/markdown/utils.ts +0 -459
  358. package/src/narration/align.ts +0 -514
  359. package/src/narration/features.ts +0 -231
  360. package/src/narration/index.ts +0 -86
  361. package/src/narration/nuclei.ts +0 -118
  362. package/src/narration/pacing.ts +0 -211
  363. package/src/narration/script.ts +0 -239
  364. package/src/narration/session.ts +0 -100
  365. package/src/narration/sidecar.ts +0 -187
  366. package/src/narration/syllables.ts +0 -85
  367. package/src/narration/trace.ts +0 -50
  368. package/src/narration/types.ts +0 -299
  369. package/src/narration/vad.ts +0 -131
  370. package/src/ngeohash.d.ts +0 -11
  371. package/src/random/SeededRandom.ts +0 -127
  372. package/src/random/index.ts +0 -1
  373. package/src/recommend/index.ts +0 -16
  374. package/src/recommend/numberHighlight.ts +0 -25
  375. package/src/recommend/templates.ts +0 -393
  376. package/src/schemas/BlockTemplates.ts +0 -1046
  377. package/src/schemas/CustomTemplates.ts +0 -126
  378. package/src/schemas/Doc.ts +0 -1073
  379. package/src/schemas/ImageEditDoc.ts +0 -102
  380. package/src/schemas/LayoutStrategy.ts +0 -178
  381. package/src/schemas/Media.ts +0 -179
  382. package/src/schemas/MediaProvider.ts +0 -70
  383. package/src/schemas/PageStyle.ts +0 -213
  384. package/src/schemas/Theme.ts +0 -413
  385. package/src/schemas/Transitions.ts +0 -224
  386. package/src/schemas/Types.ts +0 -15
  387. package/src/schemas/Viewport.ts +0 -91
  388. package/src/schemas/colorUtils.ts +0 -219
  389. package/src/schemas/fontStacks.ts +0 -339
  390. package/src/schemas/index.ts +0 -31
  391. package/src/schemas/pageStyleDefaults.ts +0 -204
  392. package/src/schemas/themeCompile.ts +0 -244
  393. package/src/schemas/themeConstants.ts +0 -2
  394. package/src/schemas/themeLibrary.ts +0 -60
  395. package/src/schemas/themeValidator.ts +0 -609
  396. package/src/schemas/themes/bold.json +0 -77
  397. package/src/schemas/themes/cinematic.json +0 -143
  398. package/src/schemas/themes/documentary.json +0 -125
  399. package/src/schemas/themes/gezellig.json +0 -123
  400. package/src/schemas/themes/index.ts +0 -53
  401. package/src/schemas/themes/magazine.json +0 -126
  402. package/src/schemas/themes/minimalist.json +0 -74
  403. package/src/schemas/themes/morning-light.json +0 -117
  404. package/src/schemas/themes/standard-dark.json +0 -109
  405. package/src/schemas/themes/standard.json +0 -98
  406. package/src/schemas/themes/tech-dark.json +0 -143
  407. package/src/schemas/themes/warm-earth.json +0 -74
  408. package/src/spatial/Geohash.ts +0 -196
  409. package/src/spatial/Haversine.ts +0 -59
  410. package/src/spatial/index.ts +0 -2
  411. package/src/storage/ContentContainer.ts +0 -220
  412. package/src/storage/LocalForageAdapter.ts +0 -103
  413. package/src/storage/LocalStorageAdapter.ts +0 -57
  414. package/src/storage/MediaProviderFromContainer.ts +0 -92
  415. package/src/storage/MemoryStorageAdapter.ts +0 -37
  416. package/src/storage/ScopedContentContainer.ts +0 -143
  417. package/src/storage/Storage.ts +0 -28
  418. package/src/storage/index.ts +0 -9
  419. package/src/timing/index.ts +0 -17
  420. package/src/timing/narrationTiming.ts +0 -220
  421. package/src/timing/readingTime.ts +0 -94
  422. package/src/transform/applyTransform.ts +0 -122
  423. package/src/transform/blockAnalyzer.ts +0 -181
  424. package/src/transform/index.ts +0 -23
  425. package/src/transform/registry.ts +0 -217
  426. package/src/transform/styles/dataDriven.ts +0 -18
  427. package/src/transform/styles/documentary.ts +0 -18
  428. package/src/transform/styles/index.ts +0 -5
  429. package/src/transform/styles/magazine.ts +0 -19
  430. package/src/transform/styles/minimal.ts +0 -18
  431. package/src/transform/styles/narrative.ts +0 -19
  432. package/src/transform/templateSelector.ts +0 -389
  433. package/src/transform/timingAllocator.ts +0 -257
  434. package/src/transform/types.ts +0 -158
  435. package/src/versions/DocumentVersionManager.ts +0 -70
  436. package/src/versions/gitignore.ts +0 -34
  437. package/src/versions/index.ts +0 -56
  438. package/src/versions/operations.ts +0 -144
  439. package/src/versions/paths.ts +0 -51
  440. package/src/versions/snapshotStore.ts +0 -202
  441. package/src/versions/timestamp.ts +0 -48
  442. package/src/versions/types.ts +0 -93
@@ -1,1046 +0,0 @@
1
- /**
2
- * Block Templates Schema
3
- *
4
- * Defines a template system for AI-generated doc blocks. Instead of
5
- * specifying low-level layers, positions, and animations, AI can use
6
- * high-level templates like "title" or "statHighlight" with simple
7
- * content parameters.
8
- *
9
- * Templates are expanded into full Block structures at render time,
10
- * ensuring consistent styling and reducing AI generation errors.
11
- *
12
- * Template Types:
13
- * - title: Doc intro with title + subtitle
14
- * - sectionHeader: Colored section divider
15
- * - statHighlight: Big number/stat with description
16
- * - quote: Large centered quote
17
- * - factCard: Key fact with explanation
18
- * - twoColumn: Side-by-side comparison
19
- * - dateEvent: Timeline-style date + description
20
- * - imageWithCaption: Image with text overlay
21
- */
22
-
23
- import type { Layer, Block, Transition, MapTileStyle, MapMarker, MarkerStyle } from './Doc.js';
24
- import type { ViewportConfig, ViewportOrientation } from './Viewport.js';
25
- import type { LayoutHints } from './LayoutStrategy.js';
26
- import type { Theme } from './Theme.js';
27
- import { VIEWPORT_PRESETS, getViewportOrientation, calculateFontScale } from './Viewport.js';
28
- import { getLayoutHints, scaledFontSize as scaleFontSize } from './LayoutStrategy.js';
29
-
30
- /**
31
- * Name of a color scheme defined in the active theme's `colorSchemes` map.
32
- * Templates reference schemes by name (e.g. 'blue', 'green') and the theme
33
- * resolves them to actual colors at render time via `resolveColorScheme()`.
34
- */
35
- export type ColorScheme = string;
36
-
37
- /**
38
- * Default font family for doc text.
39
- * PT Serif provides a classic, readable appearance for documentary-style content.
40
- * Used as a fallback in TextLayer when no font is specified.
41
- */
42
- export const DEFAULT_DOC_FONT = 'system-ui, -apple-system, "Segoe UI", Roboto, sans-serif';
43
-
44
- /**
45
- * Default font family for titles.
46
- */
47
- export const DEFAULT_TITLE_FONT = 'Georgia, "Times New Roman", serif';
48
-
49
- // ============================================
50
- // Accent Image System
51
- // ============================================
52
-
53
- /**
54
- * Position options for accent images on text-based blocks.
55
- * Accents are tasteful image additions that complement rather than overwhelm text.
56
- */
57
- export type AccentPosition =
58
- | 'left-strip' // Vertical strip on left (25-30% width), text shifts right
59
- | 'right-strip' // Vertical strip on right (25-30% width), text shifts left
60
- | 'bottom-strip' // Horizontal strip at bottom (25-30% height), text shifts up
61
- | 'corner-inset'; // Small inset image in corner with vignette edge
62
-
63
- /**
64
- * Accent image configuration for text-based blocks.
65
- * When present, the template adjusts layout to accommodate the image tastefully.
66
- */
67
- export interface AccentImage {
68
- /** Path to image file (relative to article media dir) */
69
- src: string;
70
- /** Alt text for accessibility */
71
- alt: string;
72
- /** Where to position the accent image */
73
- position: AccentPosition;
74
- /** Ambient motion effect (subtle Ken Burns) */
75
- ambientMotion?: 'zoomIn' | 'zoomOut' | 'panLeft' | 'panRight';
76
- /** Photo credit / artist name */
77
- credit?: string;
78
- /** License identifier (e.g., 'CC BY-SA 4.0') */
79
- license?: string;
80
- }
81
-
82
- // ============================================
83
- // Template Input Types
84
- // ============================================
85
-
86
- /**
87
- * Base properties shared by all template blocks.
88
- */
89
- interface BaseTemplateBlock {
90
- /** Unique block ID */
91
- id: string;
92
- /** Block duration in seconds */
93
- duration: number;
94
- /** Which audio segment this block belongs to */
95
- audioSegment: number;
96
- /** Entry transition */
97
- transition?: Transition;
98
- /** Show doc's bottom layers (default: true) */
99
- useBottomLayer?: boolean;
100
- /** Show doc's top layers (default: true) */
101
- useTopLayer?: boolean;
102
- /**
103
- * Start time within the audio segment when this content is spoken.
104
- * Used to sync the block appearance with the narration.
105
- * If not provided, blocks are distributed evenly across the segment.
106
- */
107
- sourceStartTime?: number;
108
- /**
109
- * Duration of the spoken content this block represents.
110
- * Used with sourceStartTime to precisely position the block.
111
- */
112
- sourceDuration?: number;
113
- /**
114
- * Transform provenance: the id of the source Block this template block
115
- * was derived from. Lets narration timing (and any per-source styling)
116
- * be remapped onto transformed/summarized docs.
117
- */
118
- sourceBlockId?: string;
119
- /** All source block ids when the block summarizes more than one. */
120
- sourceBlockIds?: string[];
121
- /**
122
- * Char offset of the extraction inside the source block's plain text.
123
- * Provenance only — NOT a time (see sourceStartTime for seconds).
124
- */
125
- sourceCharOffset?: number;
126
- /**
127
- * Per-block override for the theme's photographic image grade
128
- * (`theme.style.imageTreatment`). `'none'` opts this block's imagery out;
129
- * a treatment type forces that grade regardless of the theme.
130
- */
131
- imageTreatment?: 'none' | 'mono' | 'duotone' | 'warm' | 'cool';
132
- }
133
-
134
- /**
135
- * Title block - doc intro with large title and subtitle.
136
- */
137
- export interface TitleBlockInput extends BaseTemplateBlock {
138
- template: 'title';
139
- /** Main title text */
140
- title: string;
141
- /** Subtitle or tagline (supports \n for line breaks) */
142
- subtitle?: string;
143
- /** Background color (defaults to theme primary) */
144
- backgroundColor?: string;
145
- }
146
-
147
- /**
148
- * Section header - section title card with optional background image.
149
- * Displays the section title prominently, optionally over an image.
150
- */
151
- export interface SectionHeaderInput extends BaseTemplateBlock {
152
- template: 'sectionHeader';
153
- /** Section title */
154
- title: string;
155
- /** Color scheme for the section (used for fallback background) */
156
- colorScheme?: ColorScheme;
157
- /** Optional background image path */
158
- imageSrc?: string;
159
- /** Alt text for background image */
160
- imageAlt?: string;
161
- /** Ambient motion for background image */
162
- ambientMotion?: 'zoomIn' | 'zoomOut' | 'panLeft' | 'panRight';
163
- }
164
-
165
- /**
166
- * Stat highlight - big number with description and optional detail.
167
- */
168
- export interface StatHighlightInput extends BaseTemplateBlock {
169
- template: 'statHighlight';
170
- /** The statistic (e.g., "89%", "2x", "7 miles") */
171
- stat: string;
172
- /** Description of what the stat means */
173
- description: string;
174
- /** Additional detail or context */
175
- detail?: string;
176
- /** Color scheme for the stat */
177
- colorScheme?: ColorScheme;
178
- /** Optional accent image to complement the text */
179
- accentImage?: AccentImage;
180
- }
181
-
182
- /**
183
- * Quote block - large centered quote text.
184
- */
185
- export interface QuoteBlockInput extends BaseTemplateBlock {
186
- template: 'quote';
187
- /** The quote text (supports \n for line breaks) */
188
- quote: string;
189
- /** Attribution (author, source) */
190
- attribution?: string;
191
- /** Optional accent image to complement the text */
192
- accentImage?: AccentImage;
193
- }
194
-
195
- /**
196
- * Fact card - key fact with explanation.
197
- */
198
- export interface FactCardInput extends BaseTemplateBlock {
199
- template: 'factCard';
200
- /** The main fact or statement */
201
- fact: string;
202
- /** Explanation or context */
203
- explanation: string;
204
- /** Optional source citation */
205
- source?: string;
206
- /** Optional accent image to complement the text */
207
- accentImage?: AccentImage;
208
- }
209
-
210
- /**
211
- * Two column - side-by-side comparison.
212
- */
213
- export interface TwoColumnInput extends BaseTemplateBlock {
214
- template: 'twoColumn';
215
- /** Left column content */
216
- left: {
217
- label: string;
218
- sublabel?: string;
219
- };
220
- /** Right column content */
221
- right: {
222
- label: string;
223
- sublabel?: string;
224
- };
225
- /** Optional header above columns */
226
- header?: string;
227
- /** Color schemes for left and right */
228
- leftColor?: ColorScheme;
229
- rightColor?: ColorScheme;
230
- }
231
-
232
- /**
233
- * Date event - timeline-style date with description.
234
- */
235
- export interface DateEventInput extends BaseTemplateBlock {
236
- template: 'dateEvent';
237
- /** The date (e.g., "July 14, 1974") */
238
- date: string;
239
- /** Description of what happened (supports \n) */
240
- description: string;
241
- /** Optional footer text */
242
- footer?: string;
243
- /** Mood: 'neutral', 'somber', 'celebratory' */
244
- mood?: 'neutral' | 'somber' | 'celebratory';
245
- /** Optional accent image to complement the text */
246
- accentImage?: AccentImage;
247
- }
248
-
249
- /**
250
- * Image with caption - background image with text overlay.
251
- */
252
- export interface ImageWithCaptionInput extends BaseTemplateBlock {
253
- template: 'imageWithCaption';
254
- /** Path to image file */
255
- imageSrc: string;
256
- /** Alt text for accessibility */
257
- imageAlt: string;
258
- /** Caption text */
259
- caption?: string;
260
- /** Caption position */
261
- captionPosition?: 'bottom' | 'top' | 'center';
262
- /** Ambient motion effect: slow zoom or pan for visual interest */
263
- ambientMotion?: 'zoomIn' | 'zoomOut' | 'panLeft' | 'panRight';
264
- /** When true, style caption as a title (larger, centered, prominent) */
265
- isTitle?: boolean;
266
- /** Optional subtitle shown below the title (only when isTitle is true) */
267
- subtitle?: string;
268
- /** Photo credit / artist name */
269
- imageCredit?: string;
270
- /** License identifier (e.g., 'CC BY-SA 4.0') */
271
- imageLicense?: string;
272
- }
273
-
274
- /**
275
- * Shared fields for left/right feature blocks. A "feature" pairs an
276
- * image on one side of the block with a title and body paragraph on
277
- * the other — a common editorial layout for product highlights,
278
- * profile callouts, or section intros.
279
- */
280
- interface FeatureInputBase extends BaseTemplateBlock {
281
- /** Path to the feature image. */
282
- imageSrc: string;
283
- /** Alt text for accessibility. */
284
- imageAlt?: string;
285
- /**
286
- * Explicit display width of the image, in pixels (typically pulled
287
- * from a `<img width>` attribute when the WYSIWYG editor resized it).
288
- * When set, the renderer treats the image as a sized asset and
289
- * centers it inside its half with padding instead of stretching it
290
- * to fill the cell.
291
- */
292
- imageWidth?: number;
293
- /** Explicit display height of the image, in pixels. */
294
- imageHeight?: number;
295
- /** Heading / title text shown next to the image. */
296
- title?: string;
297
- /** Body text shown below the title. */
298
- body?: string;
299
- }
300
-
301
- /**
302
- * Left feature — image on the left, title + body stacked on the right.
303
- */
304
- export interface LeftFeatureInput extends FeatureInputBase {
305
- template: 'leftFeature';
306
- }
307
-
308
- /**
309
- * Right feature — image on the right, title + body stacked on the left.
310
- */
311
- export interface RightFeatureInput extends FeatureInputBase {
312
- template: 'rightFeature';
313
- }
314
-
315
- /**
316
- * Map block - geographic map showing article location.
317
- *
318
- * Displays a map centered on given coordinates with optional title,
319
- * caption, and markers. Great for establishing geographic context.
320
- * See docs/MAP_TILES.md for available tile styles and attribution.
321
- */
322
- export interface MapBlockInput extends BaseTemplateBlock {
323
- template: 'map';
324
- /** Map center coordinates */
325
- center: {
326
- lat: number;
327
- lng: number;
328
- };
329
- /** Zoom level (4-16, typically 8-12 for regional context) */
330
- zoom: number;
331
- /** Map tile style (default: 'terrain') */
332
- mapStyle?: MapTileStyle;
333
- /** Optional title overlay at top */
334
- title?: string;
335
- /** Optional caption at bottom */
336
- caption?: string;
337
- /** Optional markers to show on map */
338
- markers?: MapMarker[];
339
- /** Ambient motion effect: slow zoom or pan for visual interest */
340
- ambientMotion?: 'zoomIn' | 'zoomOut' | 'panLeft' | 'panRight';
341
- /** Pre-rendered static image path (set by prerender-maps command) */
342
- staticSrc?: string;
343
- }
344
-
345
- /**
346
- * Full-bleed quote - dramatic short text filling the viewport.
347
- * Like a movie title card. For short, punchy sentences < 60 chars.
348
- */
349
- export interface FullBleedQuoteInput extends BaseTemplateBlock {
350
- template: 'fullBleedQuote';
351
- /** Short dramatic text (< 60 chars recommended) */
352
- text: string;
353
- /** Color scheme for text tint */
354
- colorScheme?: ColorScheme;
355
- }
356
-
357
- /**
358
- * List block - 3-5 items stacked vertically with subtle numbering.
359
- * Good for enumerations like "things to see" or "key features".
360
- */
361
- export interface ListBlockInput extends BaseTemplateBlock {
362
- template: 'list';
363
- /** List items (3-5 recommended) */
364
- items: string[];
365
- /** Optional header above the list */
366
- title?: string;
367
- /** Color scheme for numbering accents */
368
- colorScheme?: ColorScheme;
369
- /** Optional accent image */
370
- accentImage?: AccentImage;
371
- }
372
-
373
- /**
374
- * Tree block — renders a hierarchical filesystem-style treeview from an
375
- * ASCII tree fence (file trees, dependency trees, outlines). The nested
376
- * `items` arrive via `templateData`, derived from the fence by the pipeline
377
- * (peer to how `diagram` receives `nodes`/`edges`).
378
- */
379
- export interface TreeBlockInput extends BaseTemplateBlock {
380
- template: 'tree';
381
- /** Nested tree items (usually via `templateData.items`). */
382
- items?: TreeTemplateItem[];
383
- /** Optional title above the tree. */
384
- title?: string;
385
- /** Color scheme for folder rows / icons. */
386
- colorScheme?: ColorScheme;
387
- }
388
-
389
- /** One node supplied via `templateData.items` (mirrors `TreeLayerItem`). */
390
- export interface TreeTemplateItem {
391
- id: string;
392
- label: string;
393
- isDir?: boolean;
394
- comment?: string;
395
- children: TreeTemplateItem[];
396
- }
397
-
398
- /**
399
- * One point on a timeline track. Event positions are normalized across the
400
- * whole timeline (0 = left edge, 1 = right edge) so events on separate tracks
401
- * remain horizontally comparable.
402
- */
403
- export interface TimelineTemplateEvent {
404
- /** Stable id used by cross-track branch links. */
405
- id: string;
406
- /** Short label displayed next to the event dot. */
407
- label: string;
408
- /** Optional longer callout text. */
409
- description?: string;
410
- /** Normalized horizontal position; renderers clamp values to 0..1. */
411
- position: number;
412
- /** Preferred callout placement. Defaults to alternating above/below. */
413
- side?: 'above' | 'below';
414
- /** Description placement when it should sit opposite the event label. */
415
- descriptionSide?: 'above' | 'below';
416
- /** False renders the point only (useful for dense cadence tracks). */
417
- callout?: boolean;
418
- /** Dot treatment. Defaults to `filled`. */
419
- marker?: 'filled' | 'hollow' | 'diamond';
420
- }
421
-
422
- /** A horizontal timeline lane with zero or more positioned events. */
423
- export interface TimelineTemplateTrack {
424
- id: string;
425
- /** Optional label displayed to the left of the track. */
426
- label?: string;
427
- /** Optional label displayed after the track's terminal arrow. */
428
- endLabel?: string;
429
- events: TimelineTemplateEvent[];
430
- }
431
-
432
- /**
433
- * A branch or relationship between two events. Source and target resolve
434
- * against event ids globally, so links may cross tracks.
435
- */
436
- export interface TimelineTemplateLink {
437
- source: string;
438
- target: string;
439
- /** Optional text displayed near the branch path. */
440
- label?: string;
441
- }
442
-
443
- /**
444
- * Timeline block - renders one or more horizontal tracks with event dots,
445
- * text callouts, and optional branches between events.
446
- */
447
- export interface TimelineBlockInput extends BaseTemplateBlock {
448
- template: 'timeline';
449
- /** Tracks and their events (usually supplied through `templateData`). */
450
- tracks?: TimelineTemplateTrack[];
451
- /** Optional branch/cross-track links between event ids. */
452
- links?: TimelineTemplateLink[];
453
- /** Optional title above the timeline. */
454
- title?: string;
455
- /** Color scheme for tracks, markers, and branch links. */
456
- colorScheme?: ColorScheme;
457
- }
458
-
459
- /**
460
- * Photo grid - 2-4 images in a tiled layout.
461
- * Used when multiple images are available for visual variety.
462
- */
463
- export interface PhotoGridInput extends BaseTemplateBlock {
464
- template: 'photoGrid';
465
- /** Images to display (2-4) */
466
- images: { src: string; alt: string; credit?: string; license?: string }[];
467
- /** Optional caption below the grid */
468
- caption?: string;
469
- /** Ambient motion effect for the largest image */
470
- ambientMotion?: 'zoomIn' | 'zoomOut' | 'panLeft' | 'panRight';
471
- }
472
-
473
- /**
474
- * Definition card - dictionary-style term with definition.
475
- * Large term at top, definition below, optional origin note.
476
- */
477
- export interface DefinitionCardInput extends BaseTemplateBlock {
478
- template: 'definitionCard';
479
- /** The term being defined */
480
- term: string;
481
- /** The definition text */
482
- definition: string;
483
- /** Optional etymology or origin note */
484
- origin?: string;
485
- /** Color scheme for term accent */
486
- colorScheme?: ColorScheme;
487
- /** Optional accent image */
488
- accentImage?: AccentImage;
489
- }
490
-
491
- /**
492
- * Comparison bar - two horizontal bars showing relative numeric values.
493
- * Good for side-by-side numeric comparisons with visual weight.
494
- */
495
- export interface ComparisonBarInput extends BaseTemplateBlock {
496
- template: 'comparisonBar';
497
- /** Left bar label */
498
- leftLabel: string;
499
- /** Left bar numeric value */
500
- leftValue: number;
501
- /** Right bar label */
502
- rightLabel: string;
503
- /** Right bar numeric value */
504
- rightValue: number;
505
- /** Unit label (e.g., "km", "people") */
506
- unit?: string;
507
- /** Color scheme */
508
- colorScheme?: ColorScheme;
509
- }
510
-
511
- /**
512
- * Pull quote - quote text over a full-bleed background image with dark overlay.
513
- * Cinematic alternative to quoteBlock when a high-quality image is available.
514
- */
515
- export interface PullQuoteInput extends BaseTemplateBlock {
516
- template: 'pullQuote';
517
- /** Quote text */
518
- text: string;
519
- /** Optional attribution */
520
- attribution?: string;
521
- /** Background image (fills entire viewport) */
522
- backgroundImage: { src: string; alt: string; credit?: string; license?: string };
523
- /** Ambient motion for background image */
524
- ambientMotion?: 'zoomIn' | 'zoomOut' | 'panLeft' | 'panRight';
525
- }
526
-
527
- /**
528
- * Video with caption - background video clip with text overlay.
529
- * Plays a short clip from a source video, always muted (narration is the audio track).
530
- * Mirrors ImageWithCaptionInput but with video-specific fields.
531
- */
532
- export interface VideoWithCaptionInput extends BaseTemplateBlock {
533
- template: 'videoWithCaption';
534
- /** Path to video file */
535
- videoSrc: string;
536
- /** Path to poster frame (shown before video loads) */
537
- posterSrc?: string;
538
- /** Alt text for accessibility */
539
- videoAlt: string;
540
- /** Start time within source video (seconds) */
541
- clipStart: number;
542
- /** End time within source video (seconds) */
543
- clipEnd: number;
544
- /** Source video total duration (for validation) */
545
- sourceDuration?: number;
546
- /** Caption text overlay */
547
- caption?: string;
548
- /** Caption position */
549
- captionPosition?: 'bottom' | 'top' | 'center';
550
- /** Video credit / artist name */
551
- videoCredit?: string;
552
- /** License identifier */
553
- videoLicense?: string;
554
- }
555
-
556
- /**
557
- * Video pull quote - quote text over a video clip background with dark overlay.
558
- * Cinematic alternative to pullQuote when a video clip is available.
559
- */
560
- export interface VideoPullQuoteInput extends BaseTemplateBlock {
561
- template: 'videoPullQuote';
562
- /** Quote text */
563
- text: string;
564
- /** Optional attribution */
565
- attribution?: string;
566
- /** Background video clip */
567
- backgroundVideo: {
568
- src: string;
569
- posterSrc?: string;
570
- alt: string;
571
- clipStart: number;
572
- clipEnd: number;
573
- credit?: string;
574
- license?: string;
575
- };
576
- }
577
-
578
- /**
579
- * One diagram node supplied via `templateData.nodes` (canvas units, the
580
- * same coordinate space as `Block.x`/`Block.y`). This is the data-driven
581
- * alternative to child headings — used when a diagram is derived from an
582
- * ASCII-art fence.
583
- */
584
- export interface DiagramTemplateNode {
585
- id: string;
586
- /** Display label; may contain `\n` for multi-line labels. */
587
- label: string;
588
- x: number;
589
- y: number;
590
- /** Per-node width override in canvas units (defaults to the standard card width). */
591
- w?: number;
592
- /** Per-node height override in canvas units. */
593
- h?: number;
594
- /** Id of the node visually containing this one; containers draw behind their children. */
595
- container?: string;
596
- }
597
-
598
- /** A position along one side of a diagram node, normalized from 0 to 1. */
599
- export interface DiagramEdgeAnchor {
600
- side: 'top' | 'right' | 'bottom' | 'left';
601
- /** Left→right on horizontal sides; top→bottom on vertical sides. */
602
- offset: number;
603
- }
604
-
605
- /** An edge for `DiagramTemplateNode` lists. `directed` defaults to true. */
606
- export interface DiagramTemplateEdge {
607
- source: string;
608
- target: string;
609
- /** Edge label rendered at the midpoint. */
610
- label?: string;
611
- /** False suppresses the end arrowhead (a plain connecting line). */
612
- directed?: boolean;
613
- /** Optional authored attachment on the source node. */
614
- sourceAnchor?: DiagramEdgeAnchor;
615
- /** Optional authored attachment on the target node. */
616
- targetAnchor?: DiagramEdgeAnchor;
617
- /** Per-edge path routing; ASCII-derived edges use orthogonal routing. */
618
- routing?: 'straight' | 'orthogonal' | 'curved';
619
- }
620
-
621
- /**
622
- * Diagram block - renders a node-and-edge diagram.
623
- *
624
- * Two data sources, in precedence order:
625
- * 1. Child headings (`context.children`) — each child is a node positioned
626
- * by its `x`/`y` and connected by its `connectsTo` (legacy authored form).
627
- * 2. `nodes`/`edges` on this input (usually via `templateData`, derived
628
- * from an ASCII-art diagram fence in the block body).
629
- * Per-diagram options on this input control overall appearance.
630
- */
631
- export interface DiagramBlockInput extends BaseTemplateBlock {
632
- template: 'diagram';
633
- /** Optional diagram title displayed above the canvas. */
634
- title?: string;
635
- /** Color scheme for nodes and edges. */
636
- colorScheme?: ColorScheme;
637
- /** Node shape style (default: 'rounded'). */
638
- nodeShape?: 'rounded' | 'rect' | 'pill';
639
- /** Edge routing (default: 'curved'). */
640
- edgeStyle?: 'curved' | 'straight' | 'orthogonal';
641
- /** Marker at each edge's start (default: 'none'). */
642
- startStyle?: MarkerStyle;
643
- /** Marker at each edge's end (default: 'arrow'). */
644
- endStyle?: MarkerStyle;
645
- /** Edge line style (default: 'solid'). */
646
- lineStyle?: 'solid' | 'dashed' | 'dotted';
647
- /** Data-driven node list; used only when the block has no children. */
648
- nodes?: DiagramTemplateNode[];
649
- /** Edges for `nodes`. */
650
- edges?: DiagramTemplateEdge[];
651
- }
652
-
653
- /**
654
- * Free-form 2D canvas block (`layout`). Like `drawing`/`diagram`, the
655
- * `layout` template is a children-driven container: each child heading is
656
- * one absolutely-positioned layer (`{[text …]}` / `{[rectangle …]}` /
657
- * `{[image …]}`), read from `context.children`. A text box's content is the
658
- * child's body markdown. Backed by the `layoutBlock` template.
659
- *
660
- * (Legacy documents stored layers as a base64-JSON `layers=` param on the
661
- * heading; the editor auto-migrates those to child sub-blocks on first edit.)
662
- */
663
- export interface RawLayersInput extends BaseTemplateBlock {
664
- template: 'layout';
665
- }
666
-
667
- /**
668
- * Drawing block — renders child headings as free-form shapes on a canvas.
669
- *
670
- * Like `diagram`, the drawing template reads its content from the parent
671
- * block's `children` (passed via `context.children`). Each child heading
672
- * is a shape: its `{[shape …]}` annotation names the primitive
673
- * (`rectangle`/`rect`, `circle`, `line`, `arrow`, `path`, `text`) and
674
- * carries geometry/style as params; its `{#id}` makes it referenceable;
675
- * its heading text is the shape label and its body text an optional
676
- * sublabel. Connectors (`line`/`arrow` with `from`/`to`) join shapes by id.
677
- *
678
- * Coordinates are author-defined units; the template fits the bounding box
679
- * of all shapes to the viewport (same scaling as `diagram`), so authors
680
- * don't have to think in absolute pixels.
681
- *
682
- * Legacy drawings authored visually persist their `Layer[]` as a base64
683
- * `layers="…"` Pandoc param instead of children; the template decodes and
684
- * returns those directly when no children are present (see `drawingBlock`).
685
- */
686
- export interface DrawingBlockInput extends BaseTemplateBlock {
687
- template: 'drawing';
688
- /** Optional title displayed above the canvas. */
689
- title?: string;
690
- /** Color scheme for shapes that don't pin their own fill/stroke. */
691
- colorScheme?: ColorScheme;
692
- /** Default fill for shapes that don't specify one (default: 'none'). */
693
- fill?: string;
694
- /** Default stroke for shapes that don't specify one (default: theme text). */
695
- stroke?: string;
696
- }
697
-
698
- /**
699
- * Data table - renders a themed table with headers and rows.
700
- * Ideal for structured data, comparisons, and reference information.
701
- */
702
- export interface DataTableInput extends BaseTemplateBlock {
703
- template: 'dataTable';
704
- /** Optional title displayed above the table */
705
- title?: string;
706
- /** Header cell values */
707
- headers: string[];
708
- /** Data rows (array of cell value arrays) */
709
- rows: string[][];
710
- /** Per-column alignment */
711
- align?: (('left' | 'right' | 'center') | null)[];
712
- /** Color scheme for the table header */
713
- colorScheme?: ColorScheme;
714
- }
715
-
716
- /**
717
- * Union of all template block types.
718
- */
719
- export type TemplateBlock =
720
- | TitleBlockInput
721
- | SectionHeaderInput
722
- | StatHighlightInput
723
- | QuoteBlockInput
724
- | FactCardInput
725
- | TwoColumnInput
726
- | DateEventInput
727
- | ImageWithCaptionInput
728
- | LeftFeatureInput
729
- | RightFeatureInput
730
- | MapBlockInput
731
- | FullBleedQuoteInput
732
- | ListBlockInput
733
- | PhotoGridInput
734
- | DefinitionCardInput
735
- | ComparisonBarInput
736
- | PullQuoteInput
737
- | VideoWithCaptionInput
738
- | VideoPullQuoteInput
739
- | DataTableInput
740
- | DiagramBlockInput
741
- | TreeBlockInput
742
- | TimelineBlockInput
743
- | DrawingBlockInput
744
- | RawLayersInput;
745
-
746
- /**
747
- * A block can be either a raw Block or a TemplateBlock.
748
- */
749
- export type DocBlock = Block | TemplateBlock;
750
-
751
- /**
752
- * Check if a block is a template block.
753
- */
754
- export function isTemplateBlock(block: DocBlock): block is TemplateBlock {
755
- return 'template' in block && typeof block.template === 'string';
756
- }
757
-
758
- // ============================================
759
- // Template Function Type
760
- // ============================================
761
-
762
- /**
763
- * Template context passed to template functions.
764
- * Includes viewport information for multi-aspect ratio support.
765
- */
766
- export interface TemplateContext {
767
- /** Full theme (colors, typography, style, renderStyle, colorSchemes) */
768
- theme: Theme;
769
- /** Block index in the doc */
770
- blockIndex: number;
771
- /** Total number of blocks */
772
- totalBlocks: number;
773
- /** Target viewport configuration */
774
- viewport: ViewportConfig;
775
- /** Computed font scale factor for this viewport */
776
- fontScale: number;
777
- /** Viewport orientation (landscape, portrait, square) */
778
- orientation: ViewportOrientation;
779
- /** Layout hints for this orientation */
780
- layout: LayoutHints;
781
- /**
782
- * The block's direct children (set by `materializeBlockLayers` when the block has
783
- * `children`). Most templates ignore this; aggregate templates like
784
- * `diagram` consume it to render each child as part of their output.
785
- */
786
- children?: Block[];
787
- /**
788
- * The source block being expanded. Used by user-defined custom
789
- * templates so the token resolver can substitute `{title}`,
790
- * `{content}`, `{children}`, and `{image:N}` against the block's
791
- * data at render time. Built-in templates ignore this and rely on
792
- * their typed `input` parameters instead.
793
- */
794
- block?: Block;
795
- }
796
-
797
- /**
798
- * Create a template context with viewport-derived values.
799
- */
800
- export function createTemplateContext(
801
- theme: Theme,
802
- blockIndex: number,
803
- totalBlocks: number,
804
- viewport: ViewportConfig = VIEWPORT_PRESETS.landscape,
805
- ): TemplateContext {
806
- const orientation = getViewportOrientation(viewport);
807
- // Theme renderStyle may override individual layout hints (e.g. a theme
808
- // that wants a lower primaryY across every template).
809
- const overrides = theme.renderStyle.layoutOverrides;
810
- const baseLayout = getLayoutHints(orientation);
811
- return {
812
- theme,
813
- blockIndex,
814
- totalBlocks,
815
- viewport,
816
- fontScale: calculateFontScale(viewport),
817
- orientation,
818
- layout: overrides ? { ...baseLayout, ...overrides } : baseLayout,
819
- };
820
- }
821
-
822
- /**
823
- * Calculate a scaled font size for the given context.
824
- * Use this in templates to ensure text scales appropriately.
825
- *
826
- * @param basePx - Base font size in pixels (designed for 1920x1080)
827
- * @param context - Template context with viewport info
828
- * @param isTitle - Whether this is title text (larger scale) or body text
829
- */
830
- export function scaledFontSize(
831
- basePx: number,
832
- context: TemplateContext,
833
- isTitle: boolean = false,
834
- ): number {
835
- return scaleFontSize(basePx, context.viewport, context.orientation, isTitle);
836
- }
837
-
838
- /**
839
- * Template function signature.
840
- * Takes template input and returns layers array.
841
- */
842
- export type TemplateFunction<T extends TemplateBlock> = (
843
- input: T,
844
- context: TemplateContext,
845
- ) => Layer[];
846
-
847
- /**
848
- * Registry of all template functions.
849
- */
850
- export type TemplateRegistry = {
851
- [K in TemplateBlock['template']]: TemplateFunction<Extract<TemplateBlock, { template: K }>>;
852
- };
853
-
854
- // ============================================
855
- // Persistent Layer System
856
- // ============================================
857
-
858
- /**
859
- * Configuration for persistent doc-wide layers.
860
- * Bottom layers render behind all block content, top layers on top.
861
- */
862
- export interface PersistentLayerConfig {
863
- /** Layers rendered behind all block content */
864
- bottomLayers?: PersistentLayer[];
865
- /** Layers rendered on top of all block content */
866
- topLayers?: PersistentLayer[];
867
- }
868
-
869
- /**
870
- * A persistent layer - either a template or raw Layer.
871
- */
872
- export type PersistentLayer = PersistentLayerTemplate | Layer;
873
-
874
- /**
875
- * Check if a persistent layer is a template.
876
- */
877
- export function isPersistentLayerTemplate(
878
- layer: PersistentLayer,
879
- ): layer is PersistentLayerTemplate {
880
- return 'template' in layer && typeof layer.template === 'string';
881
- }
882
-
883
- /**
884
- * Template-based persistent layer for easy configuration.
885
- */
886
- export interface PersistentLayerTemplate {
887
- template: PersistentLayerTemplateType;
888
- config: PersistentLayerTemplateConfig;
889
- }
890
-
891
- /**
892
- * Available persistent layer template types.
893
- */
894
- export type PersistentLayerTemplateType =
895
- | 'solidBackground' // Solid color fill
896
- | 'gradientBackground' // CSS gradient or preset
897
- | 'imageBackground' // Blurred/faded hero image
898
- | 'patternBackground' // Subtle pattern (dots, grid, diagonal, noise/grain)
899
- | 'vignette' // Soft radial edge darkening (top layer)
900
- | 'ambientGradient' // Slowly drifting surface gradient (bottom layer)
901
- | 'titleCaption' // Article title in corner
902
- | 'cornerBranding' // Logo or text badge
903
- | 'progressIndicator'; // Bar/dots showing position
904
-
905
- /**
906
- * Union of all persistent layer template configs.
907
- */
908
- export type PersistentLayerTemplateConfig =
909
- | SolidBackgroundConfig
910
- | GradientBackgroundConfig
911
- | ImageBackgroundConfig
912
- | PatternBackgroundConfig
913
- | VignetteConfig
914
- | AmbientGradientConfig
915
- | TitleCaptionConfig
916
- | CornerBrandingConfig
917
- | ProgressIndicatorConfig;
918
-
919
- // ============================================
920
- // Background Layer Configs
921
- // ============================================
922
-
923
- /**
924
- * Solid color background.
925
- */
926
- export interface SolidBackgroundConfig {
927
- type: 'solidBackground';
928
- /** CSS color value */
929
- color: string;
930
- }
931
-
932
- /**
933
- * Gradient background (CSS gradient or preset).
934
- */
935
- export interface GradientBackgroundConfig {
936
- type: 'gradientBackground';
937
- /** Custom CSS gradient string */
938
- gradient?: string;
939
- /** Preset gradient name */
940
- preset?: 'dark-vignette' | 'radial-dark' | 'warm-sunset' | 'cool-blue' | 'earth-tones';
941
- }
942
-
943
- /**
944
- * Image background (blurred/faded hero image).
945
- */
946
- export interface ImageBackgroundConfig {
947
- type: 'imageBackground';
948
- /** Path to image file */
949
- src: string;
950
- /** Blur radius in pixels (0-20) */
951
- blur?: number;
952
- /** Opacity (0-1) */
953
- opacity?: number;
954
- /** Ambient motion effect */
955
- ambientMotion?: 'zoomIn' | 'zoomOut' | 'panLeft' | 'panRight';
956
- }
957
-
958
- /**
959
- * Pattern background (subtle repeating pattern).
960
- */
961
- export interface PatternBackgroundConfig {
962
- type: 'patternBackground';
963
- /** Pattern type */
964
- pattern: 'dots' | 'grid' | 'diagonal' | 'noise';
965
- /** Pattern color */
966
- color?: string;
967
- /** Pattern opacity (0-1) */
968
- opacity?: number;
969
- /** Pattern scale multiplier */
970
- scale?: number;
971
- }
972
-
973
- /**
974
- * Soft radial vignette (top layer) — transparent center darkening toward
975
- * the frame edges. The classic film-look framing device.
976
- */
977
- export interface VignetteConfig {
978
- type: 'vignette';
979
- /** Edge darkness 0-1 (default 0.3). */
980
- strength?: number;
981
- /** Vignette color (default black). */
982
- color?: string;
983
- }
984
-
985
- /**
986
- * Slowly drifting surface gradient (bottom layer). Colors default to the
987
- * theme's surface family at expansion time.
988
- */
989
- export interface AmbientGradientConfig {
990
- type: 'ambientGradient';
991
- /** Gradient start color. */
992
- from?: string;
993
- /** Gradient end color. */
994
- to?: string;
995
- /** Drift loop duration in seconds (default 40). */
996
- duration?: number;
997
- }
998
-
999
- // ============================================
1000
- // Overlay Layer Configs
1001
- // ============================================
1002
-
1003
- /**
1004
- * Title caption overlay (article title in corner).
1005
- */
1006
- export interface TitleCaptionConfig {
1007
- type: 'titleCaption';
1008
- /** Title text */
1009
- title: string;
1010
- /** Subtitle text (e.g., short URL like "qual..la/slug") */
1011
- subtitle?: string;
1012
- /** Position on screen */
1013
- position: 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right';
1014
- /** Font size in pixels (default: 18) */
1015
- fontSize?: number;
1016
- /** Show thumbnail alongside title */
1017
- showThumbnail?: boolean;
1018
- /** Thumbnail image path */
1019
- thumbnailSrc?: string;
1020
- }
1021
-
1022
- /**
1023
- * Corner branding overlay (logo or text badge).
1024
- */
1025
- export interface CornerBrandingConfig {
1026
- type: 'cornerBranding';
1027
- /** Text content or image path */
1028
- content: string;
1029
- /** Position on screen */
1030
- position: 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right';
1031
- /** Whether content is an image path (vs text) */
1032
- isImage?: boolean;
1033
- }
1034
-
1035
- /**
1036
- * Progress indicator overlay (bar or dots showing position).
1037
- */
1038
- export interface ProgressIndicatorConfig {
1039
- type: 'progressIndicator';
1040
- /** Indicator style */
1041
- style: 'bar' | 'dots' | 'fraction';
1042
- /** Position on screen */
1043
- position: 'bottom' | 'top';
1044
- /** Indicator color */
1045
- color?: string;
1046
- }