@bendyline/squisq 2.0.1 → 2.2.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 (438) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE.md +24 -0
  3. package/dist/{ContentContainer-BXUlIf18.d.ts → ContentContainer-B2w9sUoL.d.ts} +15 -0
  4. package/dist/{Doc-ylqWKDc_.d.ts → Doc-BubIpWsp.d.ts} +160 -3
  5. package/dist/{ImageEditDoc-D828IXJ1.d.ts → ImageEditDoc-CGxk5CHc.d.ts} +1 -1
  6. package/dist/{annotationCoercion-Dr_DY9Hx.d.ts → annotationCoercion-PtRQhk5V.d.ts} +1 -1
  7. package/dist/chunk-2L55443L.js +0 -0
  8. package/dist/chunk-2ZWIXGAC.js +214 -0
  9. package/dist/{chunk-2PWOO4ZE.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-X6DUONGT.js → chunk-7ARJZYQY.js} +280 -128
  15. package/dist/{chunk-DBS6RIFL.js → chunk-7N4G32LG.js} +0 -1
  16. package/dist/{chunk-JOQYPRDZ.js → chunk-7YEZFHLS.js} +10 -8
  17. package/dist/{chunk-2UQOHYE2.js → chunk-7ZAAICW4.js} +0 -1
  18. package/dist/{chunk-66QO7XFB.js → chunk-ACZOVWX3.js} +117 -7
  19. package/dist/{chunk-5J4HKRJF.js → chunk-BAOV476U.js} +0 -1
  20. package/dist/chunk-BCCXTMN5.js +699 -0
  21. package/dist/{chunk-W4O2TX5I.js → chunk-C33GTPUZ.js} +579 -4
  22. package/dist/{chunk-MMPBOUK7.js → chunk-CB45YGAM.js} +7 -2
  23. package/dist/{chunk-CY2R2VPR.js → chunk-DYPMOPIW.js} +18 -2
  24. package/dist/{chunk-VR7UPJ7C.js → chunk-FCG3BIZN.js} +12 -1
  25. package/dist/{chunk-5UYI3RJB.js → chunk-FDYDYL77.js} +54 -40
  26. package/dist/{chunk-TFJVXUHH.js → chunk-I2O6W7DX.js} +1513 -79
  27. package/dist/{chunk-Q7LROV2H.js → chunk-NKNMGIIN.js} +0 -1
  28. package/dist/chunk-OPO5K4DZ.js +241 -0
  29. package/dist/{chunk-TUWMK62B.js → chunk-PUS54YU6.js} +45 -2
  30. package/dist/chunk-QKPXHDLR.js +0 -0
  31. package/dist/{chunk-GZY66SDN.js → chunk-R3KTTOMS.js} +0 -1
  32. package/dist/{chunk-PXLVXTLW.js → chunk-RS5AP3J4.js} +72 -15
  33. package/dist/chunk-WV5ARNDA.js +0 -0
  34. package/dist/{chunk-4X3JQXNM.js → chunk-XOFT65EX.js} +1 -2
  35. package/dist/{chunk-FVTQSNR7.js → chunk-XRW6P7IF.js} +13 -5
  36. package/dist/chunk-XWNNA3KE.js +0 -0
  37. package/dist/chunk-YZNGMV3G.js +0 -0
  38. package/dist/{chunk-R2YZTCLO.js → chunk-ZQKZSJAX.js} +1 -2
  39. package/dist/doc/index.d.ts +166 -12
  40. package/dist/doc/index.js +36 -17
  41. package/dist/generate/index.d.ts +2 -2
  42. package/dist/generate/index.js +2 -3
  43. package/dist/icons/index.js +3 -4
  44. package/dist/icons/inlineIconMarker.js +1 -2
  45. package/dist/imageEdit/index.d.ts +48 -17
  46. package/dist/imageEdit/index.js +3 -4
  47. package/dist/index.d.ts +13 -12
  48. package/dist/index.js +118 -33
  49. package/dist/jsonForm/index.d.ts +10 -3
  50. package/dist/jsonForm/index.js +8 -7
  51. package/dist/markdown/index.d.ts +75 -11
  52. package/dist/markdown/index.js +32 -7
  53. package/dist/materializePageSection-wSLA2A1g.d.ts +223 -0
  54. package/dist/narration/index.d.ts +16 -3
  55. package/dist/narration/index.js +13 -14
  56. package/dist/random/index.d.ts +11 -2
  57. package/dist/random/index.js +2 -3
  58. package/dist/recommend/index.d.ts +1 -1
  59. package/dist/recommend/index.js +3 -4
  60. package/dist/schemas/index.d.ts +31 -6
  61. package/dist/schemas/index.js +43 -6
  62. package/dist/spatial/index.d.ts +2 -1
  63. package/dist/spatial/index.js +1 -2
  64. package/dist/storage/index.d.ts +4 -2
  65. package/dist/storage/index.js +1 -2
  66. package/dist/{themeLibrary-RjVgLpUi.d.ts → themeLibrary-DU9mUmVl.d.ts} +1 -1
  67. package/dist/timing/index.js +3 -4
  68. package/dist/transform/index.d.ts +9 -10
  69. package/dist/transform/index.js +6 -7
  70. package/dist/{types-C4kiRn_k.d.ts → types-8QjefM9J.d.ts} +38 -2
  71. package/dist/{types-BwMPl2CB.d.ts → types-CUNc9biN.d.ts} +24 -1
  72. package/dist/versions/index.d.ts +14 -11
  73. package/dist/versions/index.js +2 -3
  74. package/package.json +4 -2
  75. package/dist/chunk-2PWOO4ZE.js.map +0 -1
  76. package/dist/chunk-2UQOHYE2.js.map +0 -1
  77. package/dist/chunk-3E5F2XMR.js.map +0 -1
  78. package/dist/chunk-4X3JQXNM.js.map +0 -1
  79. package/dist/chunk-5DKBFXPY.js.map +0 -1
  80. package/dist/chunk-5J4HKRJF.js.map +0 -1
  81. package/dist/chunk-5UYI3RJB.js.map +0 -1
  82. package/dist/chunk-66QO7XFB.js.map +0 -1
  83. package/dist/chunk-AMIR72JP.js +0 -380
  84. package/dist/chunk-AMIR72JP.js.map +0 -1
  85. package/dist/chunk-CY2R2VPR.js.map +0 -1
  86. package/dist/chunk-DBS6RIFL.js.map +0 -1
  87. package/dist/chunk-DNJKBAI7.js +0 -1
  88. package/dist/chunk-DNJKBAI7.js.map +0 -1
  89. package/dist/chunk-ET53IIEP.js +0 -1
  90. package/dist/chunk-ET53IIEP.js.map +0 -1
  91. package/dist/chunk-FVJUUTEM.js +0 -74
  92. package/dist/chunk-FVJUUTEM.js.map +0 -1
  93. package/dist/chunk-FVTQSNR7.js.map +0 -1
  94. package/dist/chunk-GZY66SDN.js.map +0 -1
  95. package/dist/chunk-JOQYPRDZ.js.map +0 -1
  96. package/dist/chunk-MMPBOUK7.js.map +0 -1
  97. package/dist/chunk-PGGGKYWG.js +0 -1
  98. package/dist/chunk-PGGGKYWG.js.map +0 -1
  99. package/dist/chunk-PXLVXTLW.js.map +0 -1
  100. package/dist/chunk-Q7LROV2H.js.map +0 -1
  101. package/dist/chunk-QE7TWGVT.js.map +0 -1
  102. package/dist/chunk-R2GC6RLD.js +0 -344
  103. package/dist/chunk-R2GC6RLD.js.map +0 -1
  104. package/dist/chunk-R2YZTCLO.js.map +0 -1
  105. package/dist/chunk-S7A5D7ZJ.js +0 -174
  106. package/dist/chunk-S7A5D7ZJ.js.map +0 -1
  107. package/dist/chunk-TFJVXUHH.js.map +0 -1
  108. package/dist/chunk-TUWMK62B.js.map +0 -1
  109. package/dist/chunk-V543AI2F.js +0 -1
  110. package/dist/chunk-V543AI2F.js.map +0 -1
  111. package/dist/chunk-VR7UPJ7C.js.map +0 -1
  112. package/dist/chunk-W4O2TX5I.js.map +0 -1
  113. package/dist/chunk-X6DUONGT.js.map +0 -1
  114. package/dist/chunk-ZLQKNOZQ.js +0 -1
  115. package/dist/chunk-ZLQKNOZQ.js.map +0 -1
  116. package/dist/doc/index.js.map +0 -1
  117. package/dist/generate/index.js.map +0 -1
  118. package/dist/icons/index.js.map +0 -1
  119. package/dist/icons/inlineIconMarker.js.map +0 -1
  120. package/dist/imageEdit/index.js.map +0 -1
  121. package/dist/index.js.map +0 -1
  122. package/dist/jsonForm/index.js.map +0 -1
  123. package/dist/markdown/index.js.map +0 -1
  124. package/dist/narration/index.js.map +0 -1
  125. package/dist/random/index.js.map +0 -1
  126. package/dist/recommend/index.js.map +0 -1
  127. package/dist/schemas/index.js.map +0 -1
  128. package/dist/spatial/index.js.map +0 -1
  129. package/dist/storage/index.js.map +0 -1
  130. package/dist/timing/index.js.map +0 -1
  131. package/dist/transform/index.js.map +0 -1
  132. package/dist/versions/index.js.map +0 -1
  133. package/src/__tests__/animationUtils.test.ts +0 -117
  134. package/src/__tests__/annotationCoercion.test.ts +0 -243
  135. package/src/__tests__/applyNarrationTiming.test.ts +0 -190
  136. package/src/__tests__/applyRenderStyle.test.ts +0 -146
  137. package/src/__tests__/asciiDiagramBattle.test.ts +0 -246
  138. package/src/__tests__/asciiDiagramDetect.test.ts +0 -162
  139. package/src/__tests__/asciiDiagramMapping.test.ts +0 -38
  140. package/src/__tests__/asciiDiagramParse.test.ts +0 -233
  141. package/src/__tests__/asciiDiagramPipeline.test.ts +0 -273
  142. package/src/__tests__/asciiDiagramRender.test.ts +0 -162
  143. package/src/__tests__/asciiDiagramRepair.test.ts +0 -84
  144. package/src/__tests__/asciiTimelineDetect.test.ts +0 -157
  145. package/src/__tests__/asciiTimelineParse.test.ts +0 -205
  146. package/src/__tests__/asciiTimelinePipeline.test.ts +0 -349
  147. package/src/__tests__/asciiTimelineRender.test.ts +0 -376
  148. package/src/__tests__/atmosphereLayers.test.ts +0 -108
  149. package/src/__tests__/attrTokens.test.ts +0 -167
  150. package/src/__tests__/colorUtils.test.ts +0 -112
  151. package/src/__tests__/contentContainer.test.ts +0 -325
  152. package/src/__tests__/contentExtractor.test.ts +0 -243
  153. package/src/__tests__/coverBlock.test.ts +0 -310
  154. package/src/__tests__/customTemplateSample.test.ts +0 -144
  155. package/src/__tests__/customTemplatesFrontmatter.test.ts +0 -221
  156. package/src/__tests__/customThemesFrontmatter.test.ts +0 -146
  157. package/src/__tests__/dataTable.test.ts +0 -145
  158. package/src/__tests__/diagramBlock.test.ts +0 -122
  159. package/src/__tests__/diagramLayout.test.ts +0 -134
  160. package/src/__tests__/diagramText.test.ts +0 -26
  161. package/src/__tests__/docToMarkdownMedia.test.ts +0 -83
  162. package/src/__tests__/drawing.test.ts +0 -109
  163. package/src/__tests__/drawingBlock.test.ts +0 -124
  164. package/src/__tests__/drawingLayout.test.ts +0 -171
  165. package/src/__tests__/fixtures/asciiDiagramBattle.ts +0 -512
  166. package/src/__tests__/fixtures/asciiDiagrams.ts +0 -287
  167. package/src/__tests__/fixtures/asciiTimelines.ts +0 -35
  168. package/src/__tests__/fixtures/treeviewFixtures.ts +0 -243
  169. package/src/__tests__/geohash.test.ts +0 -110
  170. package/src/__tests__/getLayers.test.ts +0 -243
  171. package/src/__tests__/getLayersFallback.test.ts +0 -103
  172. package/src/__tests__/haversine.test.ts +0 -63
  173. package/src/__tests__/iconResolve.test.ts +0 -122
  174. package/src/__tests__/imageEditExportSvg.test.ts +0 -70
  175. package/src/__tests__/imageEditState.test.ts +0 -74
  176. package/src/__tests__/imageEditVersions.test.ts +0 -243
  177. package/src/__tests__/inferDocumentTitle.test.ts +0 -50
  178. package/src/__tests__/inlineIconMarker.test.ts +0 -36
  179. package/src/__tests__/inputDescriptors.test.ts +0 -162
  180. package/src/__tests__/jsonForm.chooseControl.test.ts +0 -86
  181. package/src/__tests__/jsonForm.evaluateWhen.test.ts +0 -59
  182. package/src/__tests__/jsonForm.inferSchema.test.ts +0 -25
  183. package/src/__tests__/jsonForm.pointer.test.ts +0 -149
  184. package/src/__tests__/jsonForm.tokens.test.ts +0 -84
  185. package/src/__tests__/layoutBlock.test.ts +0 -83
  186. package/src/__tests__/layoutLayout.test.ts +0 -169
  187. package/src/__tests__/localForageAdapter.test.ts +0 -155
  188. package/src/__tests__/majorApiTypes.test.ts +0 -18
  189. package/src/__tests__/markdown.test.ts +0 -1009
  190. package/src/__tests__/markdownIcons.test.ts +0 -104
  191. package/src/__tests__/markdownSanitize.test.ts +0 -81
  192. package/src/__tests__/markdownToDoc.test.ts +0 -957
  193. package/src/__tests__/matchFontFamily.test.ts +0 -114
  194. package/src/__tests__/materializeBlockLayers.test.ts +0 -135
  195. package/src/__tests__/materializeTestUtils.ts +0 -17
  196. package/src/__tests__/mediaAnnotations.test.ts +0 -91
  197. package/src/__tests__/mediaSchedule.test.ts +0 -118
  198. package/src/__tests__/narrationAlign.test.ts +0 -150
  199. package/src/__tests__/narrationFeatures.test.ts +0 -71
  200. package/src/__tests__/narrationNuclei.test.ts +0 -45
  201. package/src/__tests__/narrationPacing.test.ts +0 -189
  202. package/src/__tests__/narrationScript.test.ts +0 -149
  203. package/src/__tests__/narrationSessionRepro.test.ts +0 -62
  204. package/src/__tests__/narrationSidecar.test.ts +0 -88
  205. package/src/__tests__/narrationSyllables.test.ts +0 -65
  206. package/src/__tests__/narrationTestSignals.ts +0 -167
  207. package/src/__tests__/narrationVad.test.ts +0 -66
  208. package/src/__tests__/pandocAttrParse.test.ts +0 -187
  209. package/src/__tests__/recommendTemplates.test.ts +0 -183
  210. package/src/__tests__/resolveDocTheme.test.ts +0 -69
  211. package/src/__tests__/rootExports.test.ts +0 -61
  212. package/src/__tests__/scopedContentContainer.test.ts +0 -109
  213. package/src/__tests__/seededRandom.test.ts +0 -142
  214. package/src/__tests__/shapeGeometry.test.ts +0 -138
  215. package/src/__tests__/shapeVocabulary.test.ts +0 -133
  216. package/src/__tests__/storage.test.ts +0 -60
  217. package/src/__tests__/structuredData.test.ts +0 -249
  218. package/src/__tests__/surface.test.ts +0 -68
  219. package/src/__tests__/templateAnnotationParse.test.ts +0 -160
  220. package/src/__tests__/templateInputs.test.ts +0 -69
  221. package/src/__tests__/templateMetadata.test.ts +0 -32
  222. package/src/__tests__/templates.test.ts +0 -710
  223. package/src/__tests__/themeCompile.test.ts +0 -225
  224. package/src/__tests__/themeValidator.test.ts +0 -131
  225. package/src/__tests__/timing.test.ts +0 -167
  226. package/src/__tests__/transformProvenance.test.ts +0 -160
  227. package/src/__tests__/transformV2.test.ts +0 -163
  228. package/src/__tests__/transitionNormalize.test.ts +0 -61
  229. package/src/__tests__/treeviewBattle.test.ts +0 -76
  230. package/src/__tests__/treeviewDetect.test.ts +0 -168
  231. package/src/__tests__/treeviewParse.test.ts +0 -118
  232. package/src/__tests__/treeviewPipeline.test.ts +0 -183
  233. package/src/__tests__/treeviewRender.test.ts +0 -91
  234. package/src/__tests__/validateDoc.test.ts +0 -260
  235. package/src/__tests__/versions.test.ts +0 -459
  236. package/src/doc/annotationBlocks.ts +0 -117
  237. package/src/doc/applyNarrationTiming.ts +0 -244
  238. package/src/doc/asciiDiagram/chars.ts +0 -210
  239. package/src/doc/asciiDiagram/detect.ts +0 -175
  240. package/src/doc/asciiDiagram/index.ts +0 -38
  241. package/src/doc/asciiDiagram/mapping.ts +0 -225
  242. package/src/doc/asciiDiagram/parse.ts +0 -1095
  243. package/src/doc/asciiDiagram/render.ts +0 -963
  244. package/src/doc/asciiDiagram/repair.ts +0 -400
  245. package/src/doc/asciiDiagram/types.ts +0 -65
  246. package/src/doc/asciiTimeline/detect.ts +0 -138
  247. package/src/doc/asciiTimeline/index.ts +0 -26
  248. package/src/doc/asciiTimeline/mapping.ts +0 -43
  249. package/src/doc/asciiTimeline/parse.ts +0 -870
  250. package/src/doc/asciiTimeline/render.ts +0 -427
  251. package/src/doc/asciiTimeline/types.ts +0 -73
  252. package/src/doc/asciiTimeline/wrappedFlow.ts +0 -427
  253. package/src/doc/audioMapping.ts +0 -442
  254. package/src/doc/customTemplatesFrontmatter.ts +0 -273
  255. package/src/doc/customThemesFrontmatter.ts +0 -95
  256. package/src/doc/docToMarkdown.ts +0 -284
  257. package/src/doc/index.ts +0 -127
  258. package/src/doc/markdownToDoc.ts +0 -1054
  259. package/src/doc/materializeBlockLayers.ts +0 -304
  260. package/src/doc/mediaAnnotations.ts +0 -120
  261. package/src/doc/resolveDocTheme.ts +0 -56
  262. package/src/doc/standaloneAnnotation.ts +0 -58
  263. package/src/doc/structuredData.ts +0 -301
  264. package/src/doc/templateInputs.ts +0 -423
  265. package/src/doc/templates/__tests__/customTemplate.test.ts +0 -170
  266. package/src/doc/templates/__tests__/customTemplateRegistry.test.ts +0 -124
  267. package/src/doc/templates/__tests__/listBlock.test.ts +0 -64
  268. package/src/doc/templates/accentImage.ts +0 -362
  269. package/src/doc/templates/captionUtils.ts +0 -56
  270. package/src/doc/templates/comparisonBar.ts +0 -173
  271. package/src/doc/templates/coverBlock.ts +0 -255
  272. package/src/doc/templates/customTemplate.ts +0 -51
  273. package/src/doc/templates/dataTable.ts +0 -102
  274. package/src/doc/templates/dateEvent.ts +0 -147
  275. package/src/doc/templates/definitionCard.ts +0 -140
  276. package/src/doc/templates/diagramBlock.ts +0 -403
  277. package/src/doc/templates/diagramLayout.ts +0 -159
  278. package/src/doc/templates/drawingBlock.ts +0 -325
  279. package/src/doc/templates/drawingLayout.ts +0 -539
  280. package/src/doc/templates/factCard.ts +0 -146
  281. package/src/doc/templates/fallbackBlock.ts +0 -123
  282. package/src/doc/templates/featureBlock.ts +0 -209
  283. package/src/doc/templates/fullBleedQuote.ts +0 -83
  284. package/src/doc/templates/imageWithCaption.ts +0 -186
  285. package/src/doc/templates/index.ts +0 -642
  286. package/src/doc/templates/inputDescriptors.ts +0 -451
  287. package/src/doc/templates/layoutBlock.ts +0 -43
  288. package/src/doc/templates/layoutLayout.ts +0 -243
  289. package/src/doc/templates/listBlock.ts +0 -207
  290. package/src/doc/templates/mapBlock.ts +0 -138
  291. package/src/doc/templates/metadata.ts +0 -130
  292. package/src/doc/templates/persistentLayers.ts +0 -526
  293. package/src/doc/templates/photoGrid.ts +0 -190
  294. package/src/doc/templates/pullQuote.ts +0 -141
  295. package/src/doc/templates/quoteBlock.ts +0 -141
  296. package/src/doc/templates/registry.ts +0 -88
  297. package/src/doc/templates/sectionHeader.ts +0 -120
  298. package/src/doc/templates/statHighlight.ts +0 -146
  299. package/src/doc/templates/templateNames.ts +0 -22
  300. package/src/doc/templates/timelineBlock.ts +0 -613
  301. package/src/doc/templates/titleBlock.ts +0 -150
  302. package/src/doc/templates/tokens/__tests__/resolveTokens.test.ts +0 -487
  303. package/src/doc/templates/tokens/resolveTokens.ts +0 -453
  304. package/src/doc/templates/treeBlock.ts +0 -131
  305. package/src/doc/templates/twoColumn.ts +0 -263
  306. package/src/doc/templates/videoPullQuote.ts +0 -142
  307. package/src/doc/templates/videoWithCaption.ts +0 -135
  308. package/src/doc/treeview/chars.ts +0 -72
  309. package/src/doc/treeview/detect.ts +0 -145
  310. package/src/doc/treeview/index.ts +0 -30
  311. package/src/doc/treeview/mapping.ts +0 -95
  312. package/src/doc/treeview/parse.ts +0 -201
  313. package/src/doc/treeview/render.ts +0 -41
  314. package/src/doc/treeview/types.ts +0 -43
  315. package/src/doc/utils/animationUtils.ts +0 -399
  316. package/src/doc/utils/applyRenderStyle.ts +0 -106
  317. package/src/doc/utils/diagramText.ts +0 -78
  318. package/src/doc/utils/imageTreatment.ts +0 -70
  319. package/src/doc/utils/nearest.ts +0 -59
  320. package/src/doc/utils/shapeGeometry.ts +0 -614
  321. package/src/doc/utils/themeUtils.ts +0 -243
  322. package/src/doc/validate.ts +0 -575
  323. package/src/generate/contentExtractor.ts +0 -921
  324. package/src/generate/index.ts +0 -18
  325. package/src/generate/templateMapper.ts +0 -177
  326. package/src/icons/iconData.ts +0 -31
  327. package/src/icons/index.ts +0 -26
  328. package/src/icons/inlineIconMarker.ts +0 -73
  329. package/src/icons/resolve.ts +0 -139
  330. package/src/imageEdit/ImageEditVersionManager.ts +0 -73
  331. package/src/imageEdit/export.ts +0 -410
  332. package/src/imageEdit/index.ts +0 -72
  333. package/src/imageEdit/persistence.ts +0 -113
  334. package/src/imageEdit/state.ts +0 -112
  335. package/src/imageEdit/versionPaths.ts +0 -44
  336. package/src/imageEdit/versions.ts +0 -152
  337. package/src/index.ts +0 -15
  338. package/src/internal/immutable.ts +0 -58
  339. package/src/jsonForm/chooseControl.ts +0 -88
  340. package/src/jsonForm/evaluateWhen.ts +0 -59
  341. package/src/jsonForm/index.ts +0 -32
  342. package/src/jsonForm/inferSchema.ts +0 -25
  343. package/src/jsonForm/pointer.ts +0 -154
  344. package/src/jsonForm/tokens.ts +0 -78
  345. package/src/jsonForm/types.ts +0 -167
  346. package/src/markdown/annotationCoercion.ts +0 -295
  347. package/src/markdown/attrTokens.ts +0 -243
  348. package/src/markdown/convert.ts +0 -1353
  349. package/src/markdown/htmlParse.ts +0 -212
  350. package/src/markdown/index.ts +0 -152
  351. package/src/markdown/parse.ts +0 -103
  352. package/src/markdown/sanitize.ts +0 -318
  353. package/src/markdown/stringify.ts +0 -207
  354. package/src/markdown/types.ts +0 -710
  355. package/src/markdown/utils.ts +0 -459
  356. package/src/narration/align.ts +0 -514
  357. package/src/narration/features.ts +0 -231
  358. package/src/narration/index.ts +0 -86
  359. package/src/narration/nuclei.ts +0 -118
  360. package/src/narration/pacing.ts +0 -211
  361. package/src/narration/script.ts +0 -239
  362. package/src/narration/session.ts +0 -100
  363. package/src/narration/sidecar.ts +0 -187
  364. package/src/narration/syllables.ts +0 -85
  365. package/src/narration/trace.ts +0 -50
  366. package/src/narration/types.ts +0 -299
  367. package/src/narration/vad.ts +0 -131
  368. package/src/ngeohash.d.ts +0 -11
  369. package/src/random/SeededRandom.ts +0 -127
  370. package/src/random/index.ts +0 -1
  371. package/src/recommend/index.ts +0 -16
  372. package/src/recommend/numberHighlight.ts +0 -25
  373. package/src/recommend/templates.ts +0 -393
  374. package/src/schemas/BlockTemplates.ts +0 -1046
  375. package/src/schemas/CustomTemplates.ts +0 -126
  376. package/src/schemas/Doc.ts +0 -1052
  377. package/src/schemas/ImageEditDoc.ts +0 -102
  378. package/src/schemas/LayoutStrategy.ts +0 -178
  379. package/src/schemas/Media.ts +0 -179
  380. package/src/schemas/MediaProvider.ts +0 -70
  381. package/src/schemas/Theme.ts +0 -406
  382. package/src/schemas/Transitions.ts +0 -224
  383. package/src/schemas/Types.ts +0 -15
  384. package/src/schemas/Viewport.ts +0 -91
  385. package/src/schemas/colorUtils.ts +0 -219
  386. package/src/schemas/fontStacks.ts +0 -339
  387. package/src/schemas/index.ts +0 -29
  388. package/src/schemas/themeCompile.ts +0 -237
  389. package/src/schemas/themeConstants.ts +0 -2
  390. package/src/schemas/themeLibrary.ts +0 -60
  391. package/src/schemas/themeValidator.ts +0 -426
  392. package/src/schemas/themes/bold.json +0 -48
  393. package/src/schemas/themes/cinematic.json +0 -111
  394. package/src/schemas/themes/documentary.json +0 -96
  395. package/src/schemas/themes/gezellig.json +0 -93
  396. package/src/schemas/themes/index.ts +0 -53
  397. package/src/schemas/themes/magazine.json +0 -89
  398. package/src/schemas/themes/minimalist.json +0 -45
  399. package/src/schemas/themes/morning-light.json +0 -85
  400. package/src/schemas/themes/standard-dark.json +0 -85
  401. package/src/schemas/themes/standard.json +0 -74
  402. package/src/schemas/themes/tech-dark.json +0 -101
  403. package/src/schemas/themes/warm-earth.json +0 -50
  404. package/src/spatial/Geohash.ts +0 -196
  405. package/src/spatial/Haversine.ts +0 -59
  406. package/src/spatial/index.ts +0 -2
  407. package/src/storage/ContentContainer.ts +0 -220
  408. package/src/storage/LocalForageAdapter.ts +0 -103
  409. package/src/storage/LocalStorageAdapter.ts +0 -57
  410. package/src/storage/MediaProviderFromContainer.ts +0 -92
  411. package/src/storage/MemoryStorageAdapter.ts +0 -37
  412. package/src/storage/ScopedContentContainer.ts +0 -143
  413. package/src/storage/Storage.ts +0 -28
  414. package/src/storage/index.ts +0 -9
  415. package/src/timing/index.ts +0 -17
  416. package/src/timing/narrationTiming.ts +0 -220
  417. package/src/timing/readingTime.ts +0 -94
  418. package/src/transform/applyTransform.ts +0 -122
  419. package/src/transform/blockAnalyzer.ts +0 -181
  420. package/src/transform/index.ts +0 -23
  421. package/src/transform/registry.ts +0 -198
  422. package/src/transform/styles/dataDriven.ts +0 -17
  423. package/src/transform/styles/documentary.ts +0 -17
  424. package/src/transform/styles/index.ts +0 -5
  425. package/src/transform/styles/magazine.ts +0 -18
  426. package/src/transform/styles/minimal.ts +0 -17
  427. package/src/transform/styles/narrative.ts +0 -18
  428. package/src/transform/templateSelector.ts +0 -389
  429. package/src/transform/timingAllocator.ts +0 -257
  430. package/src/transform/types.ts +0 -151
  431. package/src/versions/DocumentVersionManager.ts +0 -70
  432. package/src/versions/gitignore.ts +0 -34
  433. package/src/versions/index.ts +0 -56
  434. package/src/versions/operations.ts +0 -144
  435. package/src/versions/paths.ts +0 -51
  436. package/src/versions/snapshotStore.ts +0 -202
  437. package/src/versions/timestamp.ts +0 -48
  438. package/src/versions/types.ts +0 -93
@@ -1,1052 +0,0 @@
1
- /**
2
- * Doc Schema
3
- *
4
- * Defines the JSON format for AI-scriptable visual docs that accompany
5
- * audio narration. A Doc describes a sequence of animated blocks
6
- * with text overlays, images, and transitions synchronized to audio.
7
- *
8
- * The format is designed to be:
9
- * 1. AI-generatable - Claude can create scripts from article content
10
- * 2. Browser-renderable - SVG + CSS animations (ES2015 compatible)
11
- * 3. Video-exportable - Frame-by-frame capture via Playwright
12
- *
13
- * Timing: Blocks are timed to match narration audio segments. Each article
14
- * has 3-6 MP3 files (intro + sections), and blocks are grouped by segment.
15
- */
16
-
17
- import type { Transition } from './Transitions.js';
18
- export type { Transition, TransitionType, TransitionDirection } from './Transitions.js';
19
-
20
- // ============================================
21
- // Core Types
22
- // ============================================
23
-
24
- /**
25
- * A directed connection from one block to another.
26
- *
27
- * Populated from a heading's Pandoc-style `{connectsTo=…}` attribute
28
- * (e.g. `## Step 1 {#step1 connectsTo=foo:flow,bar}`). Each item is
29
- * `target` or `target:type`. Used by diagram-style layouts that draw
30
- * edges between blocks.
31
- */
32
- export interface BlockConnection {
33
- /** Target block id (matches another block's `id`). */
34
- target: string;
35
- /** Optional connection type/label (e.g., "flow", "requires"). */
36
- type?: string;
37
- }
38
-
39
- /**
40
- * Configuration for the Start/resting block shown before playback begins.
41
- */
42
- export interface StartBlockConfig {
43
- /** Hero image path (relative to article media). When omitted, a theme-driven background is used. */
44
- heroSrc?: string;
45
- /** Alt text for the hero image */
46
- heroAlt?: string;
47
- /** Title to display over the hero */
48
- title: string;
49
- /** Optional subtitle */
50
- subtitle?: string;
51
- /** Ambient motion for the hero image */
52
- ambientMotion?: 'zoomIn' | 'zoomOut' | 'panLeft' | 'panRight';
53
- /** Photo credit / artist name for the hero image */
54
- heroCredit?: string;
55
- /** License identifier for the hero image */
56
- heroLicense?: string;
57
- }
58
-
59
- /**
60
- * A structural problem detected while converting or validating a document.
61
- *
62
- * Diagnostics ride on `Doc.diagnostics` so any consumer — the editor, the
63
- * CLI `validate` command, or an agent re-parsing its own output — gets the
64
- * same feedback without watching the console. Conversion never throws for
65
- * content problems; it degrades gracefully and records a diagnostic.
66
- */
67
- export interface DocDiagnostic {
68
- /** `error` = the author's intent could not be honored (e.g. unparseable
69
- * data fence); `warning` = something looks wrong but rendering proceeds
70
- * with a fallback (e.g. unknown template name); `info` = nothing is
71
- * broken, but the author may want to know (e.g. a redundant annotation). */
72
- severity: 'error' | 'warning' | 'info';
73
- /** Stable machine-readable code (e.g. `unknown-template`, `duplicate-id`,
74
- * `unresolved-connection`, `data-fence-parse`, `missing-asset`). */
75
- code: string;
76
- /** Human-readable description, including a suggestion when one exists. */
77
- message: string;
78
- /** Id of the block the problem belongs to, when attributable. */
79
- blockId?: string;
80
- /** 1-based line number in the markdown source, when known. */
81
- line?: number;
82
- }
83
-
84
- /**
85
- * A complete visual doc for an article.
86
- */
87
- export interface Doc {
88
- /** Article ID this doc belongs to */
89
- articleId: string;
90
-
91
- /** Total duration in seconds (sum of all audio segments) */
92
- duration: number;
93
-
94
- /** Ordered list of blocks */
95
- blocks: Block[];
96
-
97
- /** Audio track configuration */
98
- audio: AudioTrack;
99
-
100
- /** Caption track for closed captions (generated by postprocess-doc) */
101
- captions?: CaptionTrack;
102
-
103
- /**
104
- * Start/resting block shown before playback begins.
105
- * Displays hero image with title - acts as a "poster" for the doc.
106
- * The player shows this until the user starts playback.
107
- */
108
- startBlock?: StartBlockConfig;
109
-
110
- /**
111
- * Persistent layers rendered on every block (behind and/or on top of content).
112
- * Used for consistent branding overlays, background gradients, etc.
113
- */
114
- persistentLayers?: import('./BlockTemplates.js').PersistentLayerConfig;
115
-
116
- /**
117
- * Optional theme identifier. Resolved at render time via `resolveTheme()`.
118
- * When omitted, the renderer uses the default theme ('documentary').
119
- */
120
- themeId?: string;
121
-
122
- /** Optional metadata */
123
- meta?: {
124
- generatedAt?: string;
125
- generatedBy?: string;
126
- version?: number;
127
- };
128
-
129
- /**
130
- * YAML frontmatter from the source markdown.
131
- * Carries rendering hints like `document-render-as` and custom metadata.
132
- */
133
- frontmatter?: Record<string, unknown>;
134
-
135
- /**
136
- * User-defined block templates inlined into this doc.
137
- *
138
- * Populated from the markdown frontmatter key
139
- * `squisq-custom-templates`. The template-expansion pipeline
140
- * (`expandDocBlocks` in `doc/templates/index.ts`) merges these into
141
- * the registry before walking blocks, so a heading annotated
142
- * `{[myhero]}` resolves against a doc-defined template named `myhero`.
143
- *
144
- * Library templates (stored in localStorage on the editor side) are
145
- * NOT auto-loaded here — applying a library template to a block
146
- * copies its definition into this list so the doc remains
147
- * self-sufficient for SSR and export.
148
- */
149
- customTemplates?: import('./CustomTemplates.js').CustomTemplateDefinition[];
150
-
151
- /**
152
- * User-defined themes inlined into this doc.
153
- *
154
- * The theme analog of {@link Doc.customTemplates}. Populated from the
155
- * markdown frontmatter key `squisq-custom-themes`. Exactly one is active
156
- * at a time — selected by id via `squisq-theme` / {@link Doc.themeId},
157
- * the doc-level counterpart of a block's `{[name]}` template annotation —
158
- * but the payload is a list so a doc can carry a small catalog and stay
159
- * self-sufficient for SSR / export. `resolveThemeForDoc(doc, id)` resolves
160
- * against this list first (pure, doc-scoped) before built-ins, mirroring
161
- * how `buildRegistry` resolves custom templates.
162
- */
163
- customThemes?: import('./Theme.js').Theme[];
164
-
165
- /**
166
- * Structural problems found while building this doc (unknown templates,
167
- * unparseable data fences, duplicate ids, unresolved connections, …).
168
- * Populated by `markdownToDoc()`; extended by `validateMarkdownDoc()`.
169
- * Absent when the document is clean.
170
- */
171
- diagnostics?: DocDiagnostic[];
172
-
173
- /**
174
- * Document-spanning timed media (e.g. a full-length narration MP3/MP4),
175
- * authored as a media annotation in the preamble (before the first
176
- * heading) with `anchor=document`. Each clip is timed from the document
177
- * start and may play across every block. See `resolveMediaSchedule`.
178
- */
179
- documentMedia?: import('./Media.js').MediaClip[];
180
- }
181
-
182
- /**
183
- * A single block in the doc.
184
- *
185
- * Blocks can be flat (audio-synced timeline) or nested (markdown-driven hierarchy).
186
- * When derived from markdown, a block corresponds to a heading section:
187
- * - `sourceHeading` references the original MarkdownHeading node
188
- * - `contents` holds the body markdown between this heading and the next
189
- * - `children` holds sub-heading blocks (e.g., H2s under an H1)
190
- *
191
- * Four adjacent fields carry template information — do not confuse them:
192
- * - `template` — the *resolved* template id this block renders with.
193
- * - `templateOverrides` — raw `{[…]}` inline params (always strings).
194
- * - `templateData` — structured inputs from a data fence / GFM table
195
- * (parsed types, not strings).
196
- * - `sourceAnnotation.template` — the raw *requested* template name for a
197
- * standalone-annotation block (before alias resolution).
198
- * Merge order at render time: template defaults → `templateData` →
199
- * `templateOverrides`.
200
- */
201
- export interface Block {
202
- /** Unique identifier for this block.
203
- * Defaults to a slug derived from the heading text. May be overridden by
204
- * a Pandoc-style `{#custom-id}` attribute on the heading. */
205
- id: string;
206
-
207
- /** When this block appears (seconds from start).
208
- * Overridden by a heading attribute `startTime=…` when present. */
209
- startTime: number;
210
-
211
- /** How long this block is visible (seconds).
212
- * Overridden by a heading attribute `duration=…` when present. */
213
- duration: number;
214
-
215
- /** Which audio segment this block belongs to (0-indexed) */
216
- audioSegment: number;
217
-
218
- /**
219
- * Transform provenance: the source block id this block was derived
220
- * from (see `BaseTemplateBlock.sourceBlockId`). Present on blocks a
221
- * transform produced; lets a persisted transformed Doc keep its typed
222
- * link back to the source content.
223
- */
224
- sourceBlockId?: string;
225
- /** All source block ids when this block summarizes several. */
226
- sourceBlockIds?: string[];
227
- /** Char offset of the extraction inside the source block's plain text. */
228
- sourceCharOffset?: number;
229
-
230
- /**
231
- * Pre-computed visual layers, rendered back-to-front.
232
- *
233
- * Optional — template-derived blocks typically omit this and compute
234
- * layers on demand via `materializeBlockLayers()` from `@bendyline/squisq/doc`.
235
- * Raw blocks (e.g., hand-crafted by AI) may provide layers directly.
236
- */
237
- layers?: Layer[];
238
-
239
- /** Entry transition from previous block */
240
- transition?: Transition;
241
-
242
- /** Resolved template id this block renders with (see the quartet note above). */
243
- template?: string;
244
-
245
- /**
246
- * True when `template` was chosen by content-aware auto-picking
247
- * (`markdownToDoc`'s `autoTemplates`) rather than authored. Ephemeral:
248
- * `docToMarkdown` does not materialize auto-picked templates as heading
249
- * annotations, keeping the markdown round-trip lossless.
250
- */
251
- autoTemplate?: boolean;
252
-
253
- /**
254
- * True when this block was produced from a *standalone* `{[templateName …]}`
255
- * annotation paragraph in another block's body (rather than from a heading).
256
- * Such blocks have no `sourceHeading`; `docToMarkdown` re-emits their
257
- * annotation as a synthesized paragraph before their `contents` so the
258
- * markdown round-trips. See `annotationBlocks.ts`.
259
- *
260
- * Presence-marker: only ever `true` (never `false`). Test with
261
- * `block.standaloneAnnotation` presence, not as a boolean toggle.
262
- */
263
- standaloneAnnotation?: true;
264
-
265
- /**
266
- * The annotation a standalone block was built from — the raw (un-resolved)
267
- * template name and its params, in author order. Round-tripped by
268
- * `docToMarkdown` (via `serializeAnnotation`) and read by validation as the
269
- * raw requested template name (symmetric with
270
- * `sourceHeading.templateAnnotation`). Present only when
271
- * `standaloneAnnotation` is true.
272
- */
273
- sourceAnnotation?: { template?: string; params?: Record<string, string> };
274
-
275
- /**
276
- * Display title for template rendering.
277
- * Extracted from the sourceHeading when the block is created by markdownToDoc().
278
- * Templates like sectionHeader and titleBlock read this for their title layer.
279
- */
280
- title?: string;
281
-
282
- // ── Markdown-driven hierarchy (optional) ──
283
-
284
- /**
285
- * Nested sub-blocks (heading hierarchy).
286
- * When a doc is derived from markdown, sub-headings within this
287
- * heading's section become child blocks. For example, H2 blocks
288
- * under an H1 block appear here.
289
- */
290
- children?: Block[];
291
-
292
- /**
293
- * Markdown body content for this block's section.
294
- * Contains the block-level markdown nodes (paragraphs, lists, code,
295
- * blockquotes, etc.) that appear between this heading and the next
296
- * heading or sub-heading. Empty for pure structural blocks.
297
- */
298
- contents?: import('../markdown/types.js').MarkdownBlockNode[];
299
-
300
- /**
301
- * Reference to the MarkdownHeading node that created this block.
302
- * Present when the block was derived from markdown via markdownToDoc().
303
- * Enables round-tripping back to markdown and provides heading depth.
304
- * Absent for the preamble block (content before the first heading).
305
- */
306
- sourceHeading?: import('../markdown/types.js').MarkdownHeading;
307
-
308
- /**
309
- * Template overrides extracted from a heading's `{[templateName key=value]}`
310
- * annotation. Only carries template-specific params (e.g. `colorScheme=blue`).
311
- * Block-level metadata lives in `x` / `y` / `connectsTo` / `metadata` and is
312
- * sourced from the Pandoc-style `{#id .class key=value}` attribute block instead.
313
- */
314
- templateOverrides?: Record<string, string>;
315
-
316
- /**
317
- * Structured template inputs sourced from the block's body content:
318
- * a ```json data / ```yaml data fence under the heading, or — for the
319
- * `dataTable` template — the first GFM table in the section. Unlike
320
- * `templateOverrides` (always strings), values here keep their parsed
321
- * types (arrays, numbers, nested objects). Merge order at render time:
322
- * template defaults → `templateData` → `templateOverrides`.
323
- */
324
- templateData?: Record<string, unknown>;
325
-
326
- // ── Block-level metadata from Pandoc-style `{#id .class key=value}` ──
327
-
328
- /**
329
- * X coordinate for diagram-style positioning (in author-defined units).
330
- * Sourced from a heading attribute `x=…`.
331
- */
332
- x?: number;
333
-
334
- /**
335
- * Y coordinate for diagram-style positioning (in author-defined units).
336
- * Sourced from a heading attribute `y=…`.
337
- */
338
- y?: number;
339
-
340
- /**
341
- * Outgoing connections to other blocks, by id. Sourced from a heading
342
- * attribute `connectsTo=target1,target2:type,target3`.
343
- */
344
- connectsTo?: BlockConnection[];
345
-
346
- /**
347
- * CSS-style class tokens from a heading's Pandoc attribute (e.g. `{.important .v2}`).
348
- * Parsed and stored; downstream consumers may use them for styling or filtering.
349
- */
350
- classes?: string[];
351
-
352
- /**
353
- * Free-form metadata for heading attribute keys outside the typed registry
354
- * (anything that isn't `x` / `y` / `connectsTo` / `startTime` / `duration`).
355
- * Values are raw strings exactly as authored.
356
- */
357
- metadata?: Record<string, string>;
358
-
359
- /**
360
- * Timed media clips attached to this block, authored as body-level
361
- * `{[audio …]}` / `{[video …]}` annotations. Each clip is timed relative
362
- * to this block's `startTime` (via `startAt`) and optionally spills past
363
- * the block's end. See `MediaClip` / `resolveMediaSchedule`.
364
- */
365
- media?: import('./Media.js').MediaClip[];
366
- }
367
-
368
- // ============================================
369
- // Layer Types
370
- // ============================================
371
-
372
- /**
373
- * A visual element within a block.
374
- * Layers are composited back-to-front (first layer is background).
375
- */
376
- export type Layer =
377
- | ImageLayer
378
- | TextLayer
379
- | ShapeLayer
380
- | PathLayer
381
- | MapLayer
382
- | VideoLayer
383
- | TableLayer
384
- | TreeLayer;
385
-
386
- interface BaseLayer {
387
- /** Unique identifier for this layer */
388
- id: string;
389
-
390
- /** Position and size */
391
- position: Position;
392
-
393
- /** Animation to apply */
394
- animation?: Animation;
395
- }
396
-
397
- /**
398
- * Photographic treatment applied to an image layer — a theme-level "grade"
399
- * so the same photo looks native in every theme. Rendered as CSS filter
400
- * functions, which behave identically in the browser player and headless
401
- * frame capture (video/still export).
402
- */
403
- export interface ImageTreatment {
404
- /**
405
- * mono: desaturate toward archival black & white.
406
- * duotone: single-hue tint (hue taken from `color`).
407
- * warm / cool: gentle temperature grade.
408
- */
409
- type: 'none' | 'mono' | 'duotone' | 'warm' | 'cool';
410
- /** Blend strength 0..1. Default 0.6. */
411
- strength?: number;
412
- /** Duotone tint color (themes default this to their primary). */
413
- color?: string;
414
- }
415
-
416
- /**
417
- * Image layer - displays an image with optional Ken Burns effect.
418
- */
419
- export interface ImageLayer extends BaseLayer {
420
- type: 'image';
421
- content: {
422
- /** Path to image file (relative to article media dir) */
423
- src: string;
424
- /** Alt text for accessibility */
425
- alt: string;
426
- /** How to fit image in bounds */
427
- fit?: 'cover' | 'contain' | 'fill';
428
- /** Photo credit / artist name */
429
- credit?: string;
430
- /** License identifier (e.g., 'CC BY-SA 4.0') */
431
- license?: string;
432
- /** Theme-derived photographic grade (see ImageTreatment). */
433
- treatment?: ImageTreatment;
434
- /** Gaussian blur radius in px (background/atmosphere imagery). */
435
- blur?: number;
436
- };
437
- }
438
-
439
- /**
440
- * Text layer - displays text with styling.
441
- */
442
- export interface TextLayer extends BaseLayer {
443
- type: 'text';
444
- content: {
445
- /**
446
- * Plain text (supports \n for line breaks). Source of truth for plain
447
- * consumers — PDF/markdown export, search, accessibility — and the SVG
448
- * `<text>` fallback. When `html` is set, this is its plain-text
449
- * projection and must be kept in sync.
450
- */
451
- text: string;
452
- /**
453
- * Optional sanitized **inline** HTML for rich formatting (bold/italic/
454
- * links, and — for layout textboxes — headings/lists). When present the
455
- * renderer draws it via `<foreignObject>` instead of SVG `<text>`. Treated
456
- * as untrusted and re-sanitized at render time. See `RichTextLayer` in
457
- * `@bendyline/squisq-react`.
458
- */
459
- html?: string;
460
- /** Text styling */
461
- style: TextStyle;
462
- };
463
- }
464
-
465
- /**
466
- * A two-stop linear gradient fill, shared by shape/path fills and text
467
- * backgrounds. When present it overrides the solid `fill` color.
468
- *
469
- * `angle` is in degrees: 0 = top→bottom, 90 = left→right, increasing
470
- * clockwise. Defaults to 0. Rendered as an SVG `<linearGradient>` in
471
- * objectBoundingBox units so it scales with the layer's box.
472
- */
473
- export interface LinearGradient {
474
- from: string;
475
- to: string;
476
- angle?: number;
477
- }
478
-
479
- /** Border line style, mapped to an SVG stroke-dasharray by the renderer. */
480
- export type BorderStyle = 'solid' | 'dashed' | 'dotted';
481
-
482
- /**
483
- * Shape layer - simple geometric shapes for visual accents.
484
- */
485
- /**
486
- * Repeating SVG pattern fill for a shape (dots, grid, diagonal lines).
487
- * Rendered as a native `<pattern>` def — fully vector and export-safe.
488
- */
489
- export interface ShapePattern {
490
- kind: 'dots' | 'grid' | 'diagonal';
491
- /** Pattern ink color. */
492
- color: string;
493
- /** Tile size in px (default 24). */
494
- size?: number;
495
- /** Pattern opacity 0–1 (default 1; tint via a translucent color or this). */
496
- opacity?: number;
497
- }
498
-
499
- /**
500
- * Procedural filter applied to a shape. `noise` renders static film grain
501
- * via SVG feTurbulence — deliberately not animated so frame capture and
502
- * the live player agree.
503
- */
504
- export interface ShapeFilter {
505
- type: 'noise';
506
- /** feTurbulence base frequency (default 0.8 — fine grain). */
507
- baseFrequency?: number;
508
- /** Grain opacity 0–1 (default 0.05). */
509
- opacity?: number;
510
- }
511
-
512
- export interface ShapeLayer extends BaseLayer {
513
- type: 'shape';
514
- content: {
515
- /** Shape type */
516
- shape: 'rect' | 'circle' | 'line';
517
- /** Fill color (CSS color or 'none') */
518
- fill?: string;
519
- /** Fill opacity 0–1 (applies to solid and gradient fills). */
520
- fillOpacity?: number;
521
- /** Gradient fill; overrides `fill` when set. */
522
- gradient?: LinearGradient;
523
- /** Repeating pattern fill; overrides `fill`/`gradient` when set. */
524
- pattern?: ShapePattern;
525
- /** Procedural filter (film grain). */
526
- filter?: ShapeFilter;
527
- /** Stroke color */
528
- stroke?: string;
529
- /** Stroke width in pixels */
530
- strokeWidth?: number;
531
- /** Border line style (solid/dashed/dotted). Default solid. */
532
- borderStyle?: BorderStyle;
533
- /** Corner radius for rect */
534
- borderRadius?: number;
535
- };
536
- }
537
-
538
- /**
539
- * End-of-line marker style for a path/connector endpoint.
540
- * `arrow` is a filled triangle (the classic arrowhead); `open` is a stroked
541
- * V; `diamond`/`circle`/`square` are filled glyphs; `none` draws nothing.
542
- */
543
- export type MarkerStyle = 'none' | 'arrow' | 'open' | 'diamond' | 'circle' | 'square';
544
-
545
- /**
546
- * Path layer - renders an SVG `<path>` for arbitrary curves, connectors,
547
- * arrows, or filled regions. Used by the diagram template for edges
548
- * between nodes, the drawing template for non-rect/circle/line shapes, and
549
- * available to any template that needs a custom geometry.
550
- *
551
- * The `position` field carries the layer's bounding box (so animations
552
- * and clipping work the same as for other layers), but the actual
553
- * geometry is encoded in the `d` attribute using absolute SVG path
554
- * coordinates relative to the block viewport.
555
- */
556
- export interface PathLayer extends BaseLayer {
557
- type: 'path';
558
- content: {
559
- /** SVG path `d` attribute (e.g. "M 10 10 L 90 90"). Absolute viewBox coords. */
560
- d: string;
561
- /**
562
- * Named shape kind (e.g. `'diamond'`, `'star'`, `'arrow-right'`) for
563
- * path layers that represent one of Squisq's standard shapes. When
564
- * set, the renderer re-derives `d` from the layer's `position` box
565
- * (resolved against the viewport) instead of using the stored `d` —
566
- * so the shape moves, resizes, and adapts to any aspect ratio like
567
- * the native rect/circle/line layers do. Plain paths (connectors,
568
- * freehand) leave this unset and keep their absolute `d`.
569
- */
570
- shapeKind?: string;
571
- /** Stroke color (default: theme text color). */
572
- stroke?: string;
573
- /** Stroke width in pixels (default: 2). */
574
- strokeWidth?: number;
575
- /** Optional fill color (default: 'none' — pure connectors). */
576
- fill?: string;
577
- /** Fill opacity 0–1 (applies to solid and gradient fills). */
578
- fillOpacity?: number;
579
- /** Gradient fill; overrides `fill` when set. */
580
- gradient?: LinearGradient;
581
- /**
582
- * Border line style (solid/dashed/dotted). A convenience over
583
- * `dasharray` for named shapes; when set the renderer derives the
584
- * dash pattern from it (scaled by stroke width).
585
- */
586
- borderStyle?: BorderStyle;
587
- /** Optional stroke dash pattern (SVG `stroke-dasharray` syntax). */
588
- dasharray?: string;
589
- /** Marker at the path start. */
590
- startMarker?: MarkerStyle;
591
- /** Marker at the path end. */
592
- endMarker?: MarkerStyle;
593
- };
594
- }
595
-
596
- /**
597
- * Map layer - displays a geographic map with optional markers.
598
- *
599
- * Maps are rendered as composite tile images from free tile providers.
600
- * Supported styles use open-source/free tiles requiring attribution.
601
- */
602
- export interface MapLayer extends BaseLayer {
603
- type: 'map';
604
- content: {
605
- /** Center coordinates for the map */
606
- center: {
607
- lat: number;
608
- lng: number;
609
- };
610
- /** Zoom level (0-18, typically 8-14 for doc blocks) */
611
- zoom: number;
612
- /** Map tile style */
613
- style: MapTileStyle;
614
- /** Optional markers to display on the map */
615
- markers?: MapMarker[];
616
- /** Pre-rendered static image path (for video export reliability) */
617
- staticSrc?: string;
618
- /** Show attribution text (default: true) */
619
- showAttribution?: boolean;
620
- };
621
- }
622
-
623
- /**
624
- * Video layer - displays a short video clip, always muted (narration provides audio).
625
- *
626
- * Rendered via an HTML5 <video> element inside <foreignObject>, similar to how
627
- * ImageLayer uses <img> for Ken Burns effects. clipStart/clipEnd define the window
628
- * within the source video to play. During Playwright frame capture (seekTo mode),
629
- * the video is seeked programmatically rather than playing in real time.
630
- */
631
- export interface VideoLayer extends BaseLayer {
632
- type: 'video';
633
- content: {
634
- /** Path to video file (relative to article media dir) */
635
- src: string;
636
- /** Path to poster frame (shown before video loads / during seek) */
637
- posterSrc?: string;
638
- /** Alt text for accessibility */
639
- alt: string;
640
- /** How to fit video in bounds */
641
- fit?: 'cover' | 'contain' | 'fill';
642
- /** Start time within the source video (seconds) */
643
- clipStart: number;
644
- /** End time within the source video (seconds) */
645
- clipEnd: number;
646
- /** Total source video duration (for validation) */
647
- sourceDuration?: number;
648
- /**
649
- * Seconds into the owning block before this video begins playing
650
- * (the block-relative `startAt`). Default 0 — plays from block start.
651
- */
652
- startAt?: number;
653
- /**
654
- * When true, the video keeps playing past the block's end (the
655
- * playback scheduler re-homes it to the player level). Default false.
656
- */
657
- spillover?: boolean;
658
- /** Video credit / artist name */
659
- credit?: string;
660
- /** License identifier (e.g., 'CC BY-SA 4.0') */
661
- license?: string;
662
- };
663
- }
664
-
665
- /**
666
- * Table layer - renders a data table with themed styling.
667
- * Uses foreignObject inside SVG for HTML-based table layout.
668
- */
669
- export interface TableLayer extends BaseLayer {
670
- type: 'table';
671
- content: {
672
- /** Header cell values */
673
- headers: string[];
674
- /** Data rows (array of cell value arrays) */
675
- rows: string[][];
676
- /** Per-column alignment */
677
- align?: (('left' | 'right' | 'center') | null)[];
678
- /** Visual styling */
679
- style: TableLayerStyle;
680
- };
681
- }
682
-
683
- /**
684
- * Styling options for a TableLayer.
685
- */
686
- export interface TableLayerStyle {
687
- /** Header row background color */
688
- headerBackground: string;
689
- /** Header row text color */
690
- headerColor: string;
691
- /** Body cell background color */
692
- cellBackground: string;
693
- /** Body cell text color */
694
- cellColor: string;
695
- /** Border/divider color */
696
- borderColor: string;
697
- /** Font size in pixels */
698
- fontSize: number;
699
- /** Font family */
700
- fontFamily?: string;
701
- /** Header font family (falls back to fontFamily) */
702
- headerFontFamily?: string;
703
- /** Corner radius for the table container */
704
- borderRadius?: number;
705
- }
706
-
707
- /**
708
- * One node in a `TreeLayer` — a JSON-serializable hierarchy item (mirrors
709
- * the treeview codec's `TreeItem`). Rendered as an indented filesystem-style
710
- * row with a folder/file icon and connector rails.
711
- */
712
- export interface TreeLayerItem {
713
- id: string;
714
- label: string;
715
- /** True renders a folder (container) icon; else a file (leaf) icon. */
716
- isDir?: boolean;
717
- /** Trailing comment shown muted after the label. */
718
- comment?: string;
719
- children: TreeLayerItem[];
720
- }
721
-
722
- /**
723
- * A hierarchical treeview rendered as interactive HTML inside a
724
- * `<foreignObject>` (like `TableLayer`): folder/file icons, connector
725
- * rails, and collapse chevrons. Interactive (collapse/expand) in the live
726
- * React player; captured fully-expanded and static in frame/PDF export.
727
- */
728
- export interface TreeLayer extends BaseLayer {
729
- type: 'tree';
730
- content: {
731
- items: TreeLayerItem[];
732
- style: TreeLayerStyle;
733
- };
734
- }
735
-
736
- /** Styling options for a TreeLayer. */
737
- export interface TreeLayerStyle {
738
- /** Leaf (file) row text color. */
739
- rowColor: string;
740
- /** Container (folder) row text color. */
741
- dirColor: string;
742
- /** Connector rail / branch color. */
743
- connectorColor: string;
744
- /** Icon color. */
745
- iconColor: string;
746
- /** Muted comment color. */
747
- commentColor: string;
748
- /** Font size in pixels. */
749
- fontSize: number;
750
- /** Row label font family. */
751
- fontFamily?: string;
752
- /** Monospace font for the connector rails. */
753
- monoFontFamily?: string;
754
- /** Indent step per depth level, in pixels. */
755
- indentPx: number;
756
- /** FontAwesome icon token for containers (default `folder`). */
757
- folderIcon?: string;
758
- /** FontAwesome icon token for leaves (default `file`). */
759
- fileIcon?: string;
760
- }
761
-
762
- /**
763
- * Available map tile styles from free/open-source providers.
764
- */
765
- export type MapTileStyle =
766
- | 'terrain' // OpenTopoMap - topographic/terrain (default)
767
- | 'satellite' // ESRI World Imagery
768
- | 'road' // OpenStreetMap standard
769
- | 'toner' // Stadia Toner (high contrast B&W)
770
- | 'watercolor'; // Stadia Watercolor (artistic)
771
-
772
- /**
773
- * A marker to display on the map.
774
- */
775
- export interface MapMarker {
776
- /** Marker latitude */
777
- lat: number;
778
- /** Marker longitude */
779
- lng: number;
780
- /** Optional label text */
781
- label?: string;
782
- /** Marker color (CSS color, default: #ef4444) */
783
- color?: string;
784
- /** Marker icon type */
785
- icon?: 'pin' | 'circle' | 'star';
786
- }
787
-
788
- // ============================================
789
- // Position & Styling
790
- // ============================================
791
-
792
- /**
793
- * Position and dimensions for a layer.
794
- * Values can be pixels (number) or percentages (string like "50%").
795
- */
796
- export interface Position {
797
- /** X position (pixels or percentage) */
798
- x: number | string;
799
- /** Y position (pixels or percentage) */
800
- y: number | string;
801
- /** Width (pixels or percentage) */
802
- width?: number | string;
803
- /** Height (pixels or percentage) */
804
- height?: number | string;
805
- /** Anchor point for positioning */
806
- anchor?: 'center' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
807
- }
808
-
809
- /**
810
- * Text styling options.
811
- */
812
- export interface TextStyle {
813
- /** Font size in pixels */
814
- fontSize: number;
815
- /** Font family (defaults to system sans-serif) */
816
- fontFamily?: string;
817
- /** Font weight */
818
- fontWeight?: 'normal' | 'bold';
819
- /** Font style. Also the inherited baseline for rich `content.html`. */
820
- fontStyle?: 'normal' | 'italic';
821
- /** Text color (CSS color) */
822
- color: string;
823
- /** Horizontal text alignment within the layer's position box. */
824
- textAlign?: 'left' | 'center' | 'right';
825
- /**
826
- * Vertical alignment of the text within the layer's position box.
827
- * Requires a `position.height` to have an effect. When omitted, the
828
- * vertical baseline is derived from `position.anchor` (legacy behavior).
829
- */
830
- verticalAlign?: 'top' | 'middle' | 'bottom';
831
- /** Line height multiplier */
832
- lineHeight?: number;
833
- /** Add drop shadow for readability over images */
834
- shadow?: boolean;
835
- /** Background color for text box */
836
- background?: string;
837
- /** Background opacity 0–1 (applies to solid and gradient backgrounds). */
838
- backgroundOpacity?: number;
839
- /** Gradient background; overrides `background` when set. */
840
- backgroundGradient?: LinearGradient;
841
- /** Border (stroke) color for the text box. */
842
- borderColor?: string;
843
- /** Border width in pixels. A border renders when > 0 and a color is set. */
844
- borderWidth?: number;
845
- /** Border line style (solid/dashed/dotted). Default solid. */
846
- borderStyle?: BorderStyle;
847
- /** Padding around text (pixels) */
848
- padding?: number;
849
- /** Maximum number of lines before truncation (adds "..." to last line) */
850
- maxLines?: number;
851
- }
852
-
853
- // ============================================
854
- // Animation & Transitions
855
- // ============================================
856
-
857
- /**
858
- * Animation to apply to a layer.
859
- */
860
- export interface Animation {
861
- /** Animation type */
862
- type: AnimationType;
863
- /** Duration in seconds (defaults to layer's block duration) */
864
- duration?: number;
865
- /** Delay before animation starts (seconds) */
866
- delay?: number;
867
- /** CSS easing function */
868
- easing?: string;
869
- /** For Ken Burns: zoom direction */
870
- direction?: 'in' | 'out';
871
- /** For pan animations: pan direction */
872
- panDirection?: 'left' | 'right' | 'up' | 'down';
873
- }
874
-
875
- /**
876
- * Available animation types.
877
- */
878
- export type AnimationType =
879
- | 'none'
880
- | 'fadeIn'
881
- | 'fadeOut'
882
- | 'slowZoom' // Slow zoom with optional pan
883
- | 'zoomIn'
884
- | 'zoomOut'
885
- | 'panLeft'
886
- | 'panRight'
887
- | 'typewriter'; // Text appears letter by letter
888
-
889
- // ============================================
890
- // Audio Configuration
891
- // ============================================
892
-
893
- /**
894
- * Audio track configuration.
895
- * Articles have multiple MP3 segments (intro + sections).
896
- */
897
- export interface AudioTrack {
898
- /** Audio segments in playback order */
899
- segments: AudioSegment[];
900
- }
901
-
902
- // ============================================
903
- // Captions
904
- // ============================================
905
-
906
- /**
907
- * A single word with precise timing, used for word-level highlighting
908
- * in social-style captions. Populated from TTS timing data when available.
909
- */
910
- export interface CaptionWord {
911
- /** The word text */
912
- text: string;
913
- /** Start time in seconds (relative to doc start) */
914
- startTime: number;
915
- /** End time in seconds */
916
- endTime: number;
917
- }
918
-
919
- /**
920
- * A single caption phrase to display during playback.
921
- */
922
- export interface CaptionPhrase {
923
- /** The text to display */
924
- text: string;
925
- /** Start time in seconds (relative to doc start) */
926
- startTime: number;
927
- /** End time in seconds */
928
- endTime: number;
929
- /** Which audio segment this caption belongs to (0-indexed) */
930
- audioSegment: number;
931
- /**
932
- * Optional per-word timing from TTS timing data.
933
- * When present, enables precise word-level highlighting in social
934
- * caption style. When absent, word timing is interpolated evenly
935
- * across the phrase duration.
936
- */
937
- words?: CaptionWord[];
938
- }
939
-
940
- /**
941
- * Caption track for a doc.
942
- */
943
- export interface CaptionTrack {
944
- /** Caption phrases in chronological order */
945
- phrases: CaptionPhrase[];
946
- /** When the captions were generated. Optional so that conversion stays
947
- * deterministic — `markdownToDoc()` only sets it when the caller
948
- * supplies a timestamp via `captionsGeneratedAt`. */
949
- generatedAt?: string;
950
- /** Algorithm version for regeneration detection */
951
- version: number;
952
- }
953
-
954
- /**
955
- * A single audio segment (one MP3 file).
956
- */
957
- export interface AudioSegment {
958
- /** Path to MP3 file (relative to article media dir) */
959
- src: string;
960
- /** Segment name (e.g., "intro", "history") */
961
- name: string;
962
- /** Duration in seconds */
963
- duration: number;
964
- /** Start time in overall timeline (calculated) */
965
- startTime: number;
966
- }
967
-
968
- // ============================================
969
- // Audio Timing Data (from TTS)
970
- // ============================================
971
-
972
- /**
973
- * A single word-level timing bookmark from TTS synthesis.
974
- * Used for precise audio-to-content mapping and word-level caption sync.
975
- */
976
- export interface AudioBookmark {
977
- /** Unique identifier (e.g., "word-0", "word-1") */
978
- id: string;
979
- /** Timestamp in seconds from audio start */
980
- time: number;
981
- /** Character offset in the source text */
982
- charOffset: number;
983
- /** The word text at this position */
984
- textFragment?: string;
985
- }
986
-
987
- /**
988
- * Timing data for an audio segment, typically from a `.timing.json` file
989
- * generated alongside TTS audio. Contains the source text and per-word
990
- * timing bookmarks for precise content matching and caption sync.
991
- */
992
- export interface AudioTimingData {
993
- /** The normalized plain text that was synthesized */
994
- sourceText: string;
995
- /** Word-level timing bookmarks */
996
- bookmarks: AudioBookmark[];
997
- /** Total audio duration in seconds */
998
- duration: number;
999
- }
1000
-
1001
- // ============================================
1002
- // Helper Functions
1003
- // ============================================
1004
-
1005
- /**
1006
- * Calculate total duration from audio segments.
1007
- */
1008
- export function calculateDuration(audio: AudioTrack): number {
1009
- return audio.segments.reduce((sum, seg) => sum + seg.duration, 0);
1010
- }
1011
-
1012
- /**
1013
- * Find which audio segment is playing at a given time.
1014
- */
1015
- export function getSegmentAtTime(audio: AudioTrack, time: number): number {
1016
- let elapsed = 0;
1017
- for (let i = 0; i < audio.segments.length; i++) {
1018
- elapsed += audio.segments[i].duration;
1019
- if (time < elapsed) return i;
1020
- }
1021
- return audio.segments.length - 1;
1022
- }
1023
-
1024
- /**
1025
- * Find which block should be visible at a given time.
1026
- */
1027
- export function getBlockAtTime(blocks: Block[], time: number): Block | null {
1028
- for (let i = blocks.length - 1; i >= 0; i--) {
1029
- const block = blocks[i];
1030
- if (time >= block.startTime && time < block.startTime + block.duration) {
1031
- return block;
1032
- }
1033
- }
1034
- return blocks[0] || null;
1035
- }
1036
-
1037
- /**
1038
- * Find the caption phrase that should be displayed at a given time.
1039
- */
1040
- export function getCaptionAtTime(
1041
- captions: CaptionTrack | undefined,
1042
- time: number,
1043
- ): CaptionPhrase | null {
1044
- if (!captions || !captions.phrases.length) return null;
1045
-
1046
- for (const phrase of captions.phrases) {
1047
- if (time >= phrase.startTime && time < phrase.endTime) {
1048
- return phrase;
1049
- }
1050
- }
1051
- return null;
1052
- }