@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,613 +0,0 @@
1
- /**
2
- * Timeline Template
3
- *
4
- * Renders one or more left-to-right tracks with positioned event markers,
5
- * callout stems/text, and optional branch links. It deliberately composes
6
- * existing shape/path/text layers so every current render/export surface can
7
- * display timelines without a timeline-specific React layer.
8
- */
9
-
10
- import type { Layer, PathLayer, ShapeLayer, TextLayer } from '../../schemas/Doc.js';
11
- import type {
12
- TemplateContext,
13
- TimelineBlockInput,
14
- TimelineTemplateEvent,
15
- TimelineTemplateLink,
16
- TimelineTemplateTrack,
17
- } from '../../schemas/BlockTemplates.js';
18
- import { withAlpha } from '../../schemas/colorUtils.js';
19
- import {
20
- getThemeFont,
21
- resolveColorScheme,
22
- shouldUseShadow,
23
- themedFontSize,
24
- themedSurfaceGradient,
25
- } from '../utils/themeUtils.js';
26
- import { createBackgroundLayer, estimateTextHeight } from './captionUtils.js';
27
-
28
- type EventPoint = {
29
- event: TimelineTemplateEvent;
30
- trackIndex: number;
31
- eventIndex: number;
32
- x: number;
33
- y: number;
34
- };
35
-
36
- const clamp01 = (value: number): number => Math.max(0, Math.min(1, value));
37
- const clamp = (value: number, min: number, max: number): number =>
38
- Math.max(min, Math.min(max, value));
39
-
40
- function safeId(value: string): string {
41
- return value.replace(/[^a-zA-Z0-9_-]+/g, '-').replace(/^-+|-+$/g, '') || 'item';
42
- }
43
-
44
- /** Defensive coercion for untyped `templateData` merged into the input. */
45
- function coerceTracks(raw: unknown): TimelineTemplateTrack[] {
46
- if (!Array.isArray(raw)) return [];
47
- const tracks: TimelineTemplateTrack[] = [];
48
-
49
- raw.forEach((candidate, trackIndex) => {
50
- if (typeof candidate !== 'object' || candidate === null) return;
51
- const record = candidate as Record<string, unknown>;
52
- const id =
53
- typeof record.id === 'string' && record.id.trim()
54
- ? record.id.trim()
55
- : `track-${trackIndex + 1}`;
56
- const events: TimelineTemplateEvent[] = [];
57
-
58
- if (Array.isArray(record.events)) {
59
- record.events.forEach((eventCandidate, eventIndex) => {
60
- if (typeof eventCandidate !== 'object' || eventCandidate === null) return;
61
- const event = eventCandidate as Record<string, unknown>;
62
- if (typeof event.label !== 'string') return;
63
- const position =
64
- typeof event.position === 'number' ? event.position : Number(event.position);
65
- if (!Number.isFinite(position)) return;
66
- const eventId =
67
- typeof event.id === 'string' && event.id.trim()
68
- ? event.id.trim()
69
- : `${id}-event-${eventIndex + 1}`;
70
- const side = event.side === 'above' || event.side === 'below' ? event.side : undefined;
71
- const descriptionSide =
72
- event.descriptionSide === 'above' || event.descriptionSide === 'below'
73
- ? event.descriptionSide
74
- : undefined;
75
- const marker =
76
- event.marker === 'filled' || event.marker === 'hollow' || event.marker === 'diamond'
77
- ? event.marker
78
- : undefined;
79
- events.push({
80
- id: eventId,
81
- label: event.label,
82
- position: clamp01(position),
83
- ...(typeof event.description === 'string' && event.description.trim()
84
- ? { description: event.description.trim() }
85
- : {}),
86
- ...(side ? { side } : {}),
87
- ...(descriptionSide ? { descriptionSide } : {}),
88
- ...(event.callout === false ? { callout: false } : {}),
89
- ...(marker ? { marker } : {}),
90
- });
91
- });
92
- }
93
-
94
- tracks.push({
95
- id,
96
- ...(typeof record.label === 'string' && record.label.trim()
97
- ? { label: record.label.trim() }
98
- : {}),
99
- ...(typeof record.endLabel === 'string' && record.endLabel.trim()
100
- ? { endLabel: record.endLabel.trim() }
101
- : {}),
102
- events,
103
- });
104
- });
105
-
106
- return tracks;
107
- }
108
-
109
- function coerceLinks(raw: unknown, eventIds: ReadonlySet<string>): TimelineTemplateLink[] {
110
- if (!Array.isArray(raw)) return [];
111
- const links: TimelineTemplateLink[] = [];
112
- for (const candidate of raw) {
113
- if (typeof candidate !== 'object' || candidate === null) continue;
114
- const link = candidate as Record<string, unknown>;
115
- if (typeof link.source !== 'string' || typeof link.target !== 'string') continue;
116
- if (!eventIds.has(link.source) || !eventIds.has(link.target) || link.source === link.target)
117
- continue;
118
- links.push({
119
- source: link.source,
120
- target: link.target,
121
- ...(typeof link.label === 'string' && link.label.trim() ? { label: link.label.trim() } : {}),
122
- });
123
- }
124
- return links;
125
- }
126
-
127
- function diamondLayer(
128
- id: string,
129
- x: number,
130
- y: number,
131
- radius: number,
132
- color: string,
133
- delay: number,
134
- ): PathLayer {
135
- return {
136
- type: 'path',
137
- id,
138
- content: {
139
- d: `M ${x} ${y - radius} L ${x + radius} ${y} L ${x} ${y + radius} L ${x - radius} ${y} Z`,
140
- fill: color,
141
- stroke: color,
142
- strokeWidth: 2,
143
- },
144
- position: { x: x - radius, y: y - radius, width: radius * 2, height: radius * 2 },
145
- animation: { type: 'zoomIn', duration: 0.35, delay },
146
- };
147
- }
148
-
149
- function branchPath(source: EventPoint, target: EventPoint, bend: number): string {
150
- if (Math.abs(source.y - target.y) < 1) {
151
- const sourceSide = source.event.side ?? (source.eventIndex % 2 === 0 ? 'above' : 'below');
152
- // Route on the side opposite the source callout so the arch does not run
153
- // through its stem/label stack.
154
- const direction = sourceSide === 'above' ? 1 : -1;
155
- const controlY = source.y + direction * bend;
156
- return `M ${source.x} ${source.y} C ${source.x} ${controlY}, ${target.x} ${controlY}, ${target.x} ${target.y}`;
157
- }
158
- const midY = (source.y + target.y) / 2;
159
- return `M ${source.x} ${source.y} C ${source.x} ${midY}, ${target.x} ${midY}, ${target.x} ${target.y}`;
160
- }
161
-
162
- export function timelineBlock(input: TimelineBlockInput, context: TemplateContext): Layer[] {
163
- const { theme, viewport } = context;
164
- const colors = resolveColorScheme(context, input.colorScheme);
165
- const tracks = coerceTracks(input.tracks);
166
- const layers: Layer[] = [createBackgroundLayer('bg', themedSurfaceGradient(context, 165))];
167
-
168
- const titleFontSize = themedFontSize(44, context, true);
169
- const trackFontSize = themedFontSize(22, context, false);
170
- const baseEventFontSize = themedFontSize(24, context, false);
171
- const baseDescriptionFontSize = themedFontSize(17, context, false);
172
-
173
- if (input.title) {
174
- layers.push({
175
- type: 'text',
176
- id: 'timeline-title',
177
- content: {
178
- text: input.title,
179
- style: {
180
- fontSize: titleFontSize,
181
- fontFamily: getThemeFont(context, 'title'),
182
- fontWeight: 'bold',
183
- color: theme.colors.text,
184
- textAlign: 'center',
185
- shadow: shouldUseShadow(context),
186
- },
187
- },
188
- position: { x: '50%', y: Math.max(50, titleFontSize * 1.2), width: '82%', anchor: 'center' },
189
- animation: { type: 'fadeIn', duration: 0.7 },
190
- });
191
- }
192
-
193
- if (tracks.length === 0) {
194
- layers.push({
195
- type: 'text',
196
- id: 'timeline-empty',
197
- content: {
198
- text: input.title ? 'No timeline events' : 'Empty timeline',
199
- style: {
200
- fontSize: themedFontSize(36, context, true),
201
- fontFamily: getThemeFont(context, 'title'),
202
- color: theme.colors.textMuted,
203
- textAlign: 'center',
204
- },
205
- },
206
- position: { x: '50%', y: '50%', width: '80%', anchor: 'center' },
207
- });
208
- return layers;
209
- }
210
-
211
- const hasTrackLabels = tracks.some((track) => !!track.label);
212
- const outerMargin = Math.max(48, viewport.width * 0.065);
213
- const labelWidth = hasTrackLabels ? Math.min(280, viewport.width * 0.18) : 0;
214
- const axisStartX = outerMargin + labelWidth;
215
- const axisEndX = viewport.width - outerMargin;
216
- const axisWidth = Math.max(1, axisEndX - axisStartX);
217
- const contentTop = input.title
218
- ? Math.max(titleFontSize * 2.2, viewport.height * 0.2)
219
- : viewport.height * 0.09;
220
- const contentBottom = viewport.height * 0.91;
221
- const availableHeight = Math.max(1, contentBottom - contentTop);
222
- const trackBand = availableHeight / tracks.length;
223
- const markerRadius = Math.max(6, Math.min(11, Math.min(viewport.width, viewport.height) / 105));
224
- const trackColor = withAlpha(colors.text ?? theme.colors.primary, 0.72);
225
- const accentColor = colors.accent ?? theme.colors.primary;
226
- const branchColor = withAlpha(accentColor, 0.78);
227
- const calloutColor = withAlpha(theme.colors.text, 0.48);
228
- const maxCalloutEvents = Math.max(
229
- 1,
230
- ...tracks.map((track) => track.events.filter((event) => event.callout !== false).length),
231
- );
232
- // Alternate/opposite-side callouts can safely use more width than a naive
233
- // `axisWidth / total markers` split (dense cadence markers have no text).
234
- const calloutWidth = Math.max(
235
- Math.min(150, viewport.width * 0.2),
236
- Math.min(330, (axisWidth / Math.min(maxCalloutEvents, 4)) * 0.86),
237
- );
238
- // Theme font scaling intentionally grows in portrait, but timeline cards
239
- // get narrower there. Cap callout typography against the physical viewport
240
- // so labels wrap instead of degenerating to a few characters per line.
241
- const minViewportScale = Math.min(viewport.width, viewport.height) / 1080;
242
- const eventFontSize = Math.min(baseEventFontSize, 24 * minViewportScale);
243
- const descriptionFontSize = Math.min(baseDescriptionFontSize, 17 * minViewportScale);
244
- const trackMarkerRadii = tracks.map((track) => {
245
- const positions = track.events.map((event) => clamp01(event.position)).sort((a, b) => a - b);
246
- let minGapPx = Number.POSITIVE_INFINITY;
247
- for (let index = 1; index < positions.length; index++) {
248
- minGapPx = Math.min(minGapPx, (positions[index] - positions[index - 1]) * axisWidth);
249
- }
250
- return Number.isFinite(minGapPx)
251
- ? Math.min(markerRadius, Math.max(3, minGapPx * 0.32))
252
- : markerRadius;
253
- });
254
- const eventPoints: EventPoint[] = [];
255
- // Links resolve duplicate public/template-data ids deterministically to
256
- // their first event, while every event still receives its own marker and
257
- // callout layers.
258
- const eventPointById = new Map<string, EventPoint>();
259
-
260
- tracks.forEach((track, trackIndex) => {
261
- const y = contentTop + trackBand * (trackIndex + 0.5);
262
- const trackDelay = 0.12 + trackIndex * 0.12;
263
- const trackId = safeId(track.id);
264
-
265
- const line: PathLayer = {
266
- type: 'path',
267
- id: `timeline-track-${trackId}-${trackIndex}`,
268
- content: {
269
- d: `M ${axisStartX} ${y} L ${axisEndX} ${y}`,
270
- stroke: trackColor,
271
- strokeWidth: Math.max(2, markerRadius * 0.32),
272
- fill: 'none',
273
- endMarker: 'arrow',
274
- },
275
- position: { x: axisStartX, y: y - markerRadius, width: axisWidth, height: markerRadius * 2 },
276
- animation: { type: 'fadeIn', duration: 0.65, delay: trackDelay },
277
- };
278
- layers.push(line);
279
-
280
- if (track.label) {
281
- const label: TextLayer = {
282
- type: 'text',
283
- id: `timeline-track-label-${trackId}-${trackIndex}`,
284
- content: {
285
- text: track.label,
286
- style: {
287
- fontSize: trackFontSize,
288
- fontFamily: getThemeFont(context, 'body'),
289
- fontWeight: 'bold',
290
- color: theme.colors.textMuted,
291
- textAlign: 'right',
292
- },
293
- },
294
- position: {
295
- x: outerMargin + labelWidth / 2 - 16,
296
- y,
297
- width: Math.max(1, labelWidth - 32),
298
- anchor: 'center',
299
- },
300
- animation: { type: 'fadeIn', duration: 0.5, delay: trackDelay },
301
- };
302
- layers.push(label);
303
- }
304
-
305
- if (track.endLabel) {
306
- layers.push({
307
- type: 'text',
308
- id: `timeline-track-end-label-${trackId}-${trackIndex}`,
309
- content: {
310
- text: track.endLabel,
311
- style: {
312
- fontSize: descriptionFontSize,
313
- fontFamily: getThemeFont(context, 'body'),
314
- color: theme.colors.textMuted,
315
- textAlign: 'left',
316
- maxLines: 2,
317
- },
318
- },
319
- position: {
320
- x: axisEndX + markerRadius * 1.6,
321
- y: y - descriptionFontSize * 0.7,
322
- width: Math.max(48, outerMargin - markerRadius * 2),
323
- anchor: 'top-left',
324
- },
325
- animation: { type: 'fadeIn', duration: 0.5, delay: trackDelay },
326
- });
327
- }
328
-
329
- track.events.forEach((event, eventIndex) => {
330
- const point = {
331
- event,
332
- trackIndex,
333
- eventIndex,
334
- x: axisStartX + axisWidth * clamp01(event.position),
335
- y,
336
- } satisfies EventPoint;
337
- eventPoints.push(point);
338
- if (!eventPointById.has(event.id)) eventPointById.set(event.id, point);
339
- });
340
- });
341
-
342
- // Branches sit behind markers and callouts so their endpoints disappear
343
- // cleanly beneath the event dots.
344
- const links = coerceLinks(input.links, new Set(eventPointById.keys()));
345
- links.forEach((link, linkIndex) => {
346
- const source = eventPointById.get(link.source);
347
- const target = eventPointById.get(link.target);
348
- if (!source || !target) return;
349
- const bend = Math.min(90, Math.max(42, trackBand * 0.28));
350
- layers.push({
351
- type: 'path',
352
- id: `timeline-link-${safeId(link.source)}-${safeId(link.target)}-${linkIndex}`,
353
- content: {
354
- d: branchPath(source, target, bend),
355
- stroke: branchColor,
356
- strokeWidth: Math.max(2, markerRadius * 0.26),
357
- fill: 'none',
358
- endMarker: 'arrow',
359
- },
360
- position: { x: 0, y: 0, width: '100%', height: '100%' },
361
- animation: { type: 'fadeIn', duration: 0.6, delay: 0.45 + linkIndex * 0.08 },
362
- });
363
-
364
- if (link.label) {
365
- const sameTrack = source.trackIndex === target.trackIndex;
366
- const linkLabelWidth = Math.min(
367
- 320,
368
- Math.max(150, link.label.length * descriptionFontSize * 0.55 + 24),
369
- );
370
- const linkLabelHeight = Math.min(
371
- descriptionFontSize * 1.25 * 2 + 8,
372
- estimateTextHeight(link.label, descriptionFontSize, linkLabelWidth, 1.25) + 8,
373
- );
374
- let linkLabelX = (source.x + target.x) / 2;
375
- const sameTrackSourceSide =
376
- source.event.side ?? (source.eventIndex % 2 === 0 ? 'above' : 'below');
377
- const sameTrackDirection = sameTrackSourceSide === 'above' ? 1 : -1;
378
- let linkLabelY = sameTrack
379
- ? source.y + sameTrackDirection * (bend + descriptionFontSize * 0.6)
380
- : (source.y + target.y) / 2;
381
- if (!sameTrack) {
382
- // Offset perpendicular to the branch so vertical/cross-track paths do
383
- // not run through their labels. Choose the sign that stays in-frame.
384
- const dx = target.x - source.x;
385
- const dy = target.y - source.y;
386
- const length = Math.max(1, Math.hypot(dx, dy));
387
- const offset = linkLabelWidth * 0.56;
388
- const candidateX = linkLabelX + (-dy / length) * offset;
389
- const candidateY = linkLabelY + (dx / length) * offset;
390
- const fits =
391
- candidateX >= linkLabelWidth / 2 + 8 &&
392
- candidateX <= viewport.width - linkLabelWidth / 2 - 8 &&
393
- candidateY >= descriptionFontSize * 1.5 &&
394
- candidateY <= viewport.height - 12;
395
- const sign = fits ? 1 : -1;
396
- linkLabelX += sign * (-dy / length) * offset;
397
- linkLabelY += sign * (dx / length) * offset;
398
- }
399
- linkLabelX = clamp(
400
- linkLabelX,
401
- linkLabelWidth / 2 + 8,
402
- viewport.width - linkLabelWidth / 2 - 8,
403
- );
404
- linkLabelY = clamp(linkLabelY, descriptionFontSize * 1.5, viewport.height - 12);
405
- layers.push({
406
- type: 'text',
407
- id: `timeline-link-label-${linkIndex}`,
408
- content: {
409
- text: link.label,
410
- style: {
411
- fontSize: descriptionFontSize,
412
- fontFamily: getThemeFont(context, 'body'),
413
- color: theme.colors.textMuted,
414
- textAlign: 'center',
415
- background: theme.colors.background,
416
- backgroundOpacity: 0.88,
417
- padding: 4,
418
- maxLines: 2,
419
- verticalAlign: 'middle',
420
- },
421
- },
422
- position: {
423
- x: linkLabelX,
424
- y: linkLabelY,
425
- width: linkLabelWidth,
426
- height: linkLabelHeight,
427
- anchor: 'center',
428
- },
429
- animation: { type: 'fadeIn', duration: 0.5, delay: 0.55 + linkIndex * 0.08 },
430
- });
431
- }
432
- });
433
-
434
- const stemLength = Math.min(78, Math.max(34, trackBand * 0.2));
435
-
436
- for (const point of eventPoints) {
437
- const { event, trackIndex, eventIndex, x, y } = point;
438
- const side = event.side ?? (eventIndex % 2 === 0 ? 'above' : 'below');
439
- const direction = side === 'above' ? -1 : 1;
440
- const stemEndY = y + direction * stemLength;
441
- const delay = 0.28 + trackIndex * 0.12 + eventIndex * 0.07;
442
- const eventLayerId = `${safeId(event.id)}-${trackIndex}-${eventIndex}`;
443
- const pointMarkerRadius = trackMarkerRadii[trackIndex] ?? markerRadius;
444
- const calloutX = clamp(x, calloutWidth / 2 + 8, viewport.width - calloutWidth / 2 - 8);
445
-
446
- const addStem = (stemId: string, endY: number, stemDelay: number): void => {
447
- layers.push({
448
- type: 'path',
449
- id: stemId,
450
- content: {
451
- d: `M ${x} ${y} L ${calloutX} ${endY}`,
452
- stroke: calloutColor,
453
- strokeWidth: Math.max(1, markerRadius * 0.18),
454
- fill: 'none',
455
- },
456
- position: {
457
- x: Math.min(x, calloutX),
458
- y: Math.min(y, endY),
459
- width: Math.max(2, Math.abs(calloutX - x)),
460
- height: Math.max(2, Math.abs(endY - y)),
461
- },
462
- animation: { type: 'fadeIn', duration: 0.4, delay: stemDelay },
463
- });
464
- };
465
-
466
- if (event.callout !== false) {
467
- addStem(`timeline-stem-${eventLayerId}`, stemEndY, delay);
468
- const descriptionSide = event.descriptionSide ?? side;
469
- if (event.description && descriptionSide !== side) {
470
- const descriptionDirection = descriptionSide === 'above' ? -1 : 1;
471
- addStem(
472
- `timeline-description-stem-${eventLayerId}`,
473
- y + descriptionDirection * stemLength,
474
- delay + 0.03,
475
- );
476
- }
477
- }
478
-
479
- const marker = event.marker ?? 'filled';
480
- if (marker === 'diamond') {
481
- layers.push(
482
- diamondLayer(
483
- `timeline-marker-${eventLayerId}`,
484
- x,
485
- y,
486
- pointMarkerRadius,
487
- accentColor,
488
- delay,
489
- ),
490
- );
491
- } else {
492
- const dot: ShapeLayer = {
493
- type: 'shape',
494
- id: `timeline-marker-${eventLayerId}`,
495
- content: {
496
- shape: 'circle',
497
- fill: marker === 'hollow' ? theme.colors.background : accentColor,
498
- stroke: accentColor,
499
- strokeWidth: Math.max(1.5, pointMarkerRadius * 0.28),
500
- },
501
- position: {
502
- x: x - pointMarkerRadius,
503
- y: y - pointMarkerRadius,
504
- width: pointMarkerRadius * 2,
505
- height: pointMarkerRadius * 2,
506
- },
507
- animation: { type: 'zoomIn', duration: 0.35, delay },
508
- };
509
- layers.push(dot);
510
- }
511
-
512
- if (event.callout !== false) {
513
- const labelLineHeight = 1.2;
514
- const labelHeight = Math.min(
515
- estimateTextHeight(event.label, eventFontSize, calloutWidth, labelLineHeight),
516
- eventFontSize * labelLineHeight * 2,
517
- );
518
- const labelLines = Math.max(1, Math.round(labelHeight / (eventFontSize * labelLineHeight)));
519
- const unclampedLabelY =
520
- direction > 0
521
- ? stemEndY + eventFontSize * 0.9
522
- : stemEndY - (labelLines - 1) * eventFontSize * labelLineHeight - eventFontSize * 0.9;
523
- const labelY = clamp(
524
- unclampedLabelY,
525
- eventFontSize,
526
- viewport.height - (labelLines - 1) * eventFontSize * labelLineHeight - 12,
527
- );
528
- layers.push({
529
- type: 'text',
530
- id: `timeline-event-label-${eventLayerId}`,
531
- content: {
532
- text: event.label,
533
- style: {
534
- fontSize: eventFontSize,
535
- fontFamily: getThemeFont(context, 'body'),
536
- fontWeight: 'bold',
537
- color: theme.colors.text,
538
- textAlign: 'center',
539
- lineHeight: labelLineHeight,
540
- shadow: shouldUseShadow(context),
541
- maxLines: 2,
542
- },
543
- },
544
- position: { x: calloutX, y: labelY, width: calloutWidth, anchor: 'center' },
545
- animation: { type: 'fadeIn', duration: 0.5, delay: delay + 0.08 },
546
- });
547
-
548
- if (event.description) {
549
- const descriptionSide = event.descriptionSide ?? side;
550
- const descriptionDirection = descriptionSide === 'above' ? -1 : 1;
551
- const descriptionLineHeight = 1.25;
552
- const descriptionMaxLines = context.orientation === 'portrait' ? 6 : 4;
553
- const descriptionHeight = Math.min(
554
- estimateTextHeight(
555
- event.description,
556
- descriptionFontSize,
557
- calloutWidth,
558
- descriptionLineHeight,
559
- ),
560
- descriptionFontSize * descriptionLineHeight * descriptionMaxLines,
561
- );
562
- const descriptionLines = Math.max(
563
- 1,
564
- Math.round(descriptionHeight / (descriptionFontSize * descriptionLineHeight)),
565
- );
566
- const descriptionStemEndY = y + descriptionDirection * stemLength;
567
- let descriptionY: number;
568
- if (descriptionSide !== side) {
569
- descriptionY =
570
- descriptionDirection > 0
571
- ? descriptionStemEndY + descriptionFontSize * 0.9
572
- : descriptionStemEndY -
573
- (descriptionLines - 1) * descriptionFontSize * descriptionLineHeight -
574
- descriptionFontSize * 0.9;
575
- } else if (descriptionDirection > 0) {
576
- descriptionY =
577
- labelY + labelLines * eventFontSize * labelLineHeight + descriptionFontSize * 0.45;
578
- } else {
579
- descriptionY =
580
- labelY -
581
- descriptionLines * descriptionFontSize * descriptionLineHeight -
582
- descriptionFontSize * 0.45;
583
- }
584
- descriptionY = clamp(
585
- descriptionY,
586
- descriptionFontSize,
587
- viewport.height -
588
- (descriptionLines - 1) * descriptionFontSize * descriptionLineHeight -
589
- 12,
590
- );
591
- layers.push({
592
- type: 'text',
593
- id: `timeline-event-description-${eventLayerId}`,
594
- content: {
595
- text: event.description,
596
- style: {
597
- fontSize: descriptionFontSize,
598
- fontFamily: getThemeFont(context, 'body'),
599
- color: theme.colors.textMuted,
600
- textAlign: 'center',
601
- lineHeight: descriptionLineHeight,
602
- maxLines: descriptionMaxLines,
603
- },
604
- },
605
- position: { x: calloutX, y: descriptionY, width: calloutWidth, anchor: 'center' },
606
- animation: { type: 'fadeIn', duration: 0.5, delay: delay + 0.14 },
607
- });
608
- }
609
- }
610
- }
611
-
612
- return layers;
613
- }