@bendyline/squisq 0.1.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (349) hide show
  1. package/dist/{themeLibrary-DySHPcgj.d.ts → Doc-1hmT1LZl.d.ts} +1 -42
  2. package/dist/MediaProvider-wpSe21B3.d.ts +66 -0
  3. package/dist/__tests__/animationUtils.test.d.ts +2 -0
  4. package/dist/__tests__/animationUtils.test.d.ts.map +1 -0
  5. package/dist/__tests__/animationUtils.test.js +60 -0
  6. package/dist/__tests__/animationUtils.test.js.map +1 -0
  7. package/dist/__tests__/contentContainer.test.d.ts +2 -0
  8. package/dist/__tests__/contentContainer.test.d.ts.map +1 -0
  9. package/dist/__tests__/contentContainer.test.js +234 -0
  10. package/dist/__tests__/contentContainer.test.js.map +1 -0
  11. package/dist/__tests__/contentExtractor.test.d.ts +2 -0
  12. package/dist/__tests__/contentExtractor.test.d.ts.map +1 -0
  13. package/dist/__tests__/contentExtractor.test.js +151 -0
  14. package/dist/__tests__/contentExtractor.test.js.map +1 -0
  15. package/dist/__tests__/geohash.test.d.ts +2 -0
  16. package/dist/__tests__/geohash.test.d.ts.map +1 -0
  17. package/dist/__tests__/geohash.test.js +87 -0
  18. package/dist/__tests__/geohash.test.js.map +1 -0
  19. package/dist/__tests__/getLayers.test.d.ts +2 -0
  20. package/dist/__tests__/getLayers.test.d.ts.map +1 -0
  21. package/dist/__tests__/getLayers.test.js +167 -0
  22. package/dist/__tests__/getLayers.test.js.map +1 -0
  23. package/dist/__tests__/haversine.test.d.ts +2 -0
  24. package/dist/__tests__/haversine.test.d.ts.map +1 -0
  25. package/dist/__tests__/haversine.test.js +56 -0
  26. package/dist/__tests__/haversine.test.js.map +1 -0
  27. package/dist/__tests__/localForageAdapter.test.d.ts +8 -0
  28. package/dist/__tests__/localForageAdapter.test.d.ts.map +1 -0
  29. package/dist/__tests__/localForageAdapter.test.js +130 -0
  30. package/dist/__tests__/localForageAdapter.test.js.map +1 -0
  31. package/dist/__tests__/markdown.test.d.ts +2 -0
  32. package/dist/__tests__/markdown.test.d.ts.map +1 -0
  33. package/dist/__tests__/markdown.test.js +654 -0
  34. package/dist/__tests__/markdown.test.js.map +1 -0
  35. package/dist/__tests__/markdownToDoc.test.d.ts +2 -0
  36. package/dist/__tests__/markdownToDoc.test.d.ts.map +1 -0
  37. package/dist/__tests__/markdownToDoc.test.js +313 -0
  38. package/dist/__tests__/markdownToDoc.test.js.map +1 -0
  39. package/dist/__tests__/seededRandom.test.d.ts +2 -0
  40. package/dist/__tests__/seededRandom.test.d.ts.map +1 -0
  41. package/dist/__tests__/seededRandom.test.js +125 -0
  42. package/dist/__tests__/seededRandom.test.js.map +1 -0
  43. package/dist/__tests__/slideshowGenerator.test.d.ts +2 -0
  44. package/dist/__tests__/slideshowGenerator.test.d.ts.map +1 -0
  45. package/dist/__tests__/slideshowGenerator.test.js +114 -0
  46. package/dist/__tests__/slideshowGenerator.test.js.map +1 -0
  47. package/dist/__tests__/storage.test.d.ts +2 -0
  48. package/dist/__tests__/storage.test.d.ts.map +1 -0
  49. package/dist/__tests__/storage.test.js +51 -0
  50. package/dist/__tests__/storage.test.js.map +1 -0
  51. package/dist/__tests__/templates.test.d.ts +2 -0
  52. package/dist/__tests__/templates.test.d.ts.map +1 -0
  53. package/dist/__tests__/templates.test.js +217 -0
  54. package/dist/__tests__/templates.test.js.map +1 -0
  55. package/dist/__tests__/timing.test.d.ts +2 -0
  56. package/dist/__tests__/timing.test.d.ts.map +1 -0
  57. package/dist/__tests__/timing.test.js +131 -0
  58. package/dist/__tests__/timing.test.js.map +1 -0
  59. package/dist/chunk-3E5F2XMR.js +129 -0
  60. package/dist/chunk-3E5F2XMR.js.map +1 -0
  61. package/dist/chunk-4CRBS35L.js +292 -0
  62. package/dist/chunk-4CRBS35L.js.map +1 -0
  63. package/dist/chunk-6YJPI6VI.js +35 -0
  64. package/dist/chunk-6YJPI6VI.js.map +1 -0
  65. package/dist/chunk-FVTQSNR7.js +100 -0
  66. package/dist/chunk-FVTQSNR7.js.map +1 -0
  67. package/dist/chunk-V543AI2F.js +1 -0
  68. package/dist/chunk-V543AI2F.js.map +1 -0
  69. package/dist/chunk-VP5SZTZ2.js +792 -0
  70. package/dist/chunk-VP5SZTZ2.js.map +1 -0
  71. package/dist/doc/docToMarkdown.d.ts +41 -0
  72. package/dist/doc/docToMarkdown.d.ts.map +1 -0
  73. package/dist/doc/docToMarkdown.js +88 -0
  74. package/dist/doc/docToMarkdown.js.map +1 -0
  75. package/dist/doc/getLayers.d.ts +65 -0
  76. package/dist/doc/getLayers.d.ts.map +1 -0
  77. package/dist/doc/getLayers.js +103 -0
  78. package/dist/doc/getLayers.js.map +1 -0
  79. package/dist/doc/index.d.ts +9 -3
  80. package/dist/doc/index.d.ts.map +1 -0
  81. package/dist/doc/index.js +6 -125
  82. package/dist/doc/index.js.map +1 -1
  83. package/dist/doc/markdownToDoc.d.ts +68 -0
  84. package/dist/doc/markdownToDoc.d.ts.map +1 -0
  85. package/dist/doc/markdownToDoc.js +225 -0
  86. package/dist/doc/markdownToDoc.js.map +1 -0
  87. package/dist/doc/templates/accentImage.d.ts +59 -0
  88. package/dist/doc/templates/accentImage.d.ts.map +1 -0
  89. package/dist/doc/templates/accentImage.js +275 -0
  90. package/dist/doc/templates/accentImage.js.map +1 -0
  91. package/dist/doc/templates/captionUtils.d.ts +20 -0
  92. package/dist/doc/templates/captionUtils.d.ts.map +1 -0
  93. package/dist/doc/templates/captionUtils.js +29 -0
  94. package/dist/doc/templates/captionUtils.js.map +1 -0
  95. package/dist/doc/templates/comparisonBar.d.ts +13 -0
  96. package/dist/doc/templates/comparisonBar.d.ts.map +1 -0
  97. package/dist/doc/templates/comparisonBar.js +127 -0
  98. package/dist/doc/templates/comparisonBar.js.map +1 -0
  99. package/dist/doc/templates/coverBlock.d.ts +51 -0
  100. package/dist/doc/templates/coverBlock.d.ts.map +1 -0
  101. package/dist/doc/templates/coverBlock.js +125 -0
  102. package/dist/doc/templates/coverBlock.js.map +1 -0
  103. package/dist/doc/templates/dateEvent.d.ts +15 -0
  104. package/dist/doc/templates/dateEvent.d.ts.map +1 -0
  105. package/dist/doc/templates/dateEvent.js +110 -0
  106. package/dist/doc/templates/dateEvent.js.map +1 -0
  107. package/dist/doc/templates/definitionCard.d.ts +13 -0
  108. package/dist/doc/templates/definitionCard.d.ts.map +1 -0
  109. package/dist/doc/templates/definitionCard.js +114 -0
  110. package/dist/doc/templates/definitionCard.js.map +1 -0
  111. package/dist/doc/templates/factCard.d.ts +15 -0
  112. package/dist/doc/templates/factCard.d.ts.map +1 -0
  113. package/dist/doc/templates/factCard.js +100 -0
  114. package/dist/doc/templates/factCard.js.map +1 -0
  115. package/dist/doc/templates/fullBleedQuote.d.ts +13 -0
  116. package/dist/doc/templates/fullBleedQuote.d.ts.map +1 -0
  117. package/dist/doc/templates/fullBleedQuote.js +54 -0
  118. package/dist/doc/templates/fullBleedQuote.js.map +1 -0
  119. package/dist/doc/templates/imageWithCaption.d.ts +13 -0
  120. package/dist/doc/templates/imageWithCaption.d.ts.map +1 -0
  121. package/dist/doc/templates/imageWithCaption.js +142 -0
  122. package/dist/doc/templates/imageWithCaption.js.map +1 -0
  123. package/dist/doc/templates/index.d.ts +104 -0
  124. package/dist/doc/templates/index.d.ts.map +1 -0
  125. package/dist/doc/templates/index.js +442 -0
  126. package/dist/doc/templates/index.js.map +1 -0
  127. package/dist/doc/templates/listBlock.d.ts +13 -0
  128. package/dist/doc/templates/listBlock.d.ts.map +1 -0
  129. package/dist/doc/templates/listBlock.js +89 -0
  130. package/dist/doc/templates/listBlock.js.map +1 -0
  131. package/dist/doc/templates/mapBlock.d.ts +17 -0
  132. package/dist/doc/templates/mapBlock.d.ts.map +1 -0
  133. package/dist/doc/templates/mapBlock.js +112 -0
  134. package/dist/doc/templates/mapBlock.js.map +1 -0
  135. package/dist/doc/templates/persistentLayers.d.ts +39 -0
  136. package/dist/doc/templates/persistentLayers.d.ts.map +1 -0
  137. package/dist/doc/templates/persistentLayers.js +447 -0
  138. package/dist/doc/templates/persistentLayers.js.map +1 -0
  139. package/dist/doc/templates/photoGrid.d.ts +20 -0
  140. package/dist/doc/templates/photoGrid.d.ts.map +1 -0
  141. package/dist/doc/templates/photoGrid.js +172 -0
  142. package/dist/doc/templates/photoGrid.js.map +1 -0
  143. package/dist/doc/templates/pullQuote.d.ts +13 -0
  144. package/dist/doc/templates/pullQuote.d.ts.map +1 -0
  145. package/dist/doc/templates/pullQuote.js +109 -0
  146. package/dist/doc/templates/pullQuote.js.map +1 -0
  147. package/dist/doc/templates/quoteBlock.d.ts +15 -0
  148. package/dist/doc/templates/quoteBlock.d.ts.map +1 -0
  149. package/dist/doc/templates/quoteBlock.js +97 -0
  150. package/dist/doc/templates/quoteBlock.js.map +1 -0
  151. package/dist/doc/templates/sectionHeader.d.ts +14 -0
  152. package/dist/doc/templates/sectionHeader.d.ts.map +1 -0
  153. package/dist/doc/templates/sectionHeader.js +96 -0
  154. package/dist/doc/templates/sectionHeader.js.map +1 -0
  155. package/dist/doc/templates/statHighlight.d.ts +15 -0
  156. package/dist/doc/templates/statHighlight.d.ts.map +1 -0
  157. package/dist/doc/templates/statHighlight.js +99 -0
  158. package/dist/doc/templates/statHighlight.js.map +1 -0
  159. package/dist/doc/templates/titleBlock.d.ts +13 -0
  160. package/dist/doc/templates/titleBlock.d.ts.map +1 -0
  161. package/dist/doc/templates/titleBlock.js +92 -0
  162. package/dist/doc/templates/titleBlock.js.map +1 -0
  163. package/dist/doc/templates/twoColumn.d.ts +15 -0
  164. package/dist/doc/templates/twoColumn.d.ts.map +1 -0
  165. package/dist/doc/templates/twoColumn.js +219 -0
  166. package/dist/doc/templates/twoColumn.js.map +1 -0
  167. package/dist/doc/templates/videoPullQuote.d.ts +20 -0
  168. package/dist/doc/templates/videoPullQuote.d.ts.map +1 -0
  169. package/dist/doc/templates/videoPullQuote.js +118 -0
  170. package/dist/doc/templates/videoPullQuote.js.map +1 -0
  171. package/dist/doc/templates/videoWithCaption.d.ts +20 -0
  172. package/dist/doc/templates/videoWithCaption.d.ts.map +1 -0
  173. package/dist/doc/templates/videoWithCaption.js +104 -0
  174. package/dist/doc/templates/videoWithCaption.js.map +1 -0
  175. package/dist/doc/utils/animationUtils.d.ts +34 -0
  176. package/dist/doc/utils/animationUtils.d.ts.map +1 -0
  177. package/dist/doc/utils/animationUtils.js +110 -0
  178. package/dist/doc/utils/animationUtils.js.map +1 -0
  179. package/dist/doc/utils/themeUtils.d.ts +55 -0
  180. package/dist/doc/utils/themeUtils.d.ts.map +1 -0
  181. package/dist/doc/utils/themeUtils.js +109 -0
  182. package/dist/doc/utils/themeUtils.js.map +1 -0
  183. package/dist/generate/contentExtractor.d.ts +112 -0
  184. package/dist/generate/contentExtractor.d.ts.map +1 -0
  185. package/dist/generate/contentExtractor.js +638 -0
  186. package/dist/generate/contentExtractor.js.map +1 -0
  187. package/dist/generate/index.d.ts +7 -0
  188. package/dist/generate/index.d.ts.map +1 -0
  189. package/dist/generate/index.js +4 -0
  190. package/dist/generate/index.js.map +1 -0
  191. package/dist/generate/slideshowGenerator.d.ts +72 -0
  192. package/dist/generate/slideshowGenerator.d.ts.map +1 -0
  193. package/dist/generate/slideshowGenerator.js +159 -0
  194. package/dist/generate/slideshowGenerator.js.map +1 -0
  195. package/dist/generate/templateMapper.d.ts +23 -0
  196. package/dist/generate/templateMapper.d.ts.map +1 -0
  197. package/dist/generate/templateMapper.js +114 -0
  198. package/dist/generate/templateMapper.js.map +1 -0
  199. package/dist/index.d.ts +9 -8
  200. package/dist/index.d.ts.map +1 -0
  201. package/dist/index.js +8 -216
  202. package/dist/index.js.map +1 -1
  203. package/dist/markdown/convert.d.ts +71 -0
  204. package/dist/markdown/convert.d.ts.map +1 -0
  205. package/dist/markdown/convert.js +746 -0
  206. package/dist/markdown/convert.js.map +1 -0
  207. package/dist/markdown/htmlParse.d.ts +26 -0
  208. package/dist/markdown/htmlParse.d.ts.map +1 -0
  209. package/dist/markdown/htmlParse.js +195 -0
  210. package/dist/markdown/htmlParse.js.map +1 -0
  211. package/dist/markdown/index.d.ts +19 -225
  212. package/dist/markdown/index.d.ts.map +1 -0
  213. package/dist/markdown/index.js +33 -32
  214. package/dist/markdown/index.js.map +1 -1
  215. package/dist/markdown/parse.d.ts +27 -0
  216. package/dist/markdown/parse.d.ts.map +1 -0
  217. package/dist/markdown/parse.js +90 -0
  218. package/dist/markdown/parse.js.map +1 -0
  219. package/dist/markdown/stringify.d.ts +32 -0
  220. package/dist/markdown/stringify.d.ts.map +1 -0
  221. package/dist/markdown/stringify.js +108 -0
  222. package/dist/markdown/stringify.js.map +1 -0
  223. package/dist/markdown/types.d.ts +496 -0
  224. package/dist/markdown/types.d.ts.map +1 -0
  225. package/dist/markdown/types.js +17 -0
  226. package/dist/markdown/types.js.map +1 -0
  227. package/dist/markdown/utils.d.ts +78 -0
  228. package/dist/markdown/utils.d.ts.map +1 -0
  229. package/dist/markdown/utils.js +149 -0
  230. package/dist/markdown/utils.js.map +1 -0
  231. package/dist/random/SeededRandom.d.ts +50 -0
  232. package/dist/random/SeededRandom.d.ts.map +1 -0
  233. package/dist/random/SeededRandom.js +115 -0
  234. package/dist/random/SeededRandom.js.map +1 -0
  235. package/dist/random/index.d.ts +2 -0
  236. package/dist/random/index.d.ts.map +1 -0
  237. package/dist/random/index.js +2 -0
  238. package/dist/random/index.js.map +1 -0
  239. package/dist/schemas/BlockTemplates.d.ts +583 -0
  240. package/dist/schemas/BlockTemplates.d.ts.map +1 -0
  241. package/dist/schemas/BlockTemplates.js +72 -0
  242. package/dist/schemas/BlockTemplates.js.map +1 -0
  243. package/dist/schemas/Doc.d.ts +411 -0
  244. package/dist/schemas/Doc.d.ts.map +1 -0
  245. package/dist/schemas/Doc.js +90 -0
  246. package/dist/schemas/Doc.js.map +1 -0
  247. package/dist/schemas/LayoutStrategy.d.ts +84 -0
  248. package/dist/schemas/LayoutStrategy.d.ts.map +1 -0
  249. package/dist/schemas/LayoutStrategy.js +123 -0
  250. package/dist/schemas/LayoutStrategy.js.map +1 -0
  251. package/dist/schemas/MediaProvider.d.ts +65 -0
  252. package/dist/schemas/MediaProvider.d.ts.map +1 -0
  253. package/dist/schemas/MediaProvider.js +13 -0
  254. package/dist/schemas/MediaProvider.js.map +1 -0
  255. package/dist/schemas/Theme.d.ts +163 -0
  256. package/dist/schemas/Theme.d.ts.map +1 -0
  257. package/dist/schemas/Theme.js +62 -0
  258. package/dist/schemas/Theme.js.map +1 -0
  259. package/dist/schemas/Types.d.ts +14 -0
  260. package/dist/schemas/Types.d.ts.map +1 -0
  261. package/dist/schemas/Types.js +5 -0
  262. package/dist/schemas/Types.js.map +1 -0
  263. package/dist/schemas/Viewport.d.ts +74 -0
  264. package/dist/schemas/Viewport.d.ts.map +1 -0
  265. package/dist/schemas/Viewport.js +63 -0
  266. package/dist/schemas/Viewport.js.map +1 -0
  267. package/dist/schemas/index.d.ts +10 -70
  268. package/dist/schemas/index.d.ts.map +1 -0
  269. package/dist/schemas/index.js +7 -60
  270. package/dist/schemas/index.js.map +1 -1
  271. package/dist/schemas/themeLibrary.d.ts +41 -0
  272. package/dist/schemas/themeLibrary.d.ts.map +1 -0
  273. package/dist/schemas/themeLibrary.js +466 -0
  274. package/dist/schemas/themeLibrary.js.map +1 -0
  275. package/dist/spatial/Geohash.d.ts +85 -0
  276. package/dist/spatial/Geohash.d.ts.map +1 -0
  277. package/dist/spatial/Geohash.js +142 -0
  278. package/dist/spatial/Geohash.js.map +1 -0
  279. package/dist/spatial/Haversine.d.ts +24 -0
  280. package/dist/spatial/Haversine.d.ts.map +1 -0
  281. package/dist/spatial/Haversine.js +48 -0
  282. package/dist/spatial/Haversine.js.map +1 -0
  283. package/dist/spatial/index.d.ts +3 -111
  284. package/dist/spatial/index.d.ts.map +1 -0
  285. package/dist/spatial/index.js +2 -24
  286. package/dist/spatial/index.js.map +1 -1
  287. package/dist/storage/ContentContainer.d.ts +87 -0
  288. package/dist/storage/ContentContainer.d.ts.map +1 -0
  289. package/dist/storage/ContentContainer.js +122 -0
  290. package/dist/storage/ContentContainer.js.map +1 -0
  291. package/dist/storage/LocalForageAdapter.d.ts +36 -0
  292. package/dist/storage/LocalForageAdapter.d.ts.map +1 -0
  293. package/dist/storage/LocalForageAdapter.js +82 -0
  294. package/dist/storage/LocalForageAdapter.js.map +1 -0
  295. package/dist/storage/LocalStorageAdapter.d.ts +16 -0
  296. package/dist/storage/LocalStorageAdapter.d.ts.map +1 -0
  297. package/dist/storage/LocalStorageAdapter.js +50 -0
  298. package/dist/storage/LocalStorageAdapter.js.map +1 -0
  299. package/dist/storage/MediaProviderFromContainer.d.ts +21 -0
  300. package/dist/storage/MediaProviderFromContainer.d.ts.map +1 -0
  301. package/dist/storage/MediaProviderFromContainer.js +79 -0
  302. package/dist/storage/MediaProviderFromContainer.js.map +1 -0
  303. package/dist/storage/MemoryStorageAdapter.d.ts +15 -0
  304. package/dist/storage/MemoryStorageAdapter.d.ts.map +1 -0
  305. package/dist/storage/MemoryStorageAdapter.js +34 -0
  306. package/dist/storage/MemoryStorageAdapter.js.map +1 -0
  307. package/dist/storage/Storage.d.ts +23 -0
  308. package/dist/storage/Storage.d.ts.map +1 -0
  309. package/dist/storage/Storage.js +9 -0
  310. package/dist/storage/Storage.js.map +1 -0
  311. package/dist/storage/index.d.ts +9 -91
  312. package/dist/storage/index.d.ts.map +1 -0
  313. package/dist/storage/index.js +5 -10
  314. package/dist/storage/index.js.map +1 -1
  315. package/dist/story/index.d.ts +3 -2
  316. package/dist/themeLibrary-DR1VRo-8.d.ts +44 -0
  317. package/dist/timing/index.d.ts +4 -0
  318. package/dist/timing/index.d.ts.map +1 -0
  319. package/dist/timing/index.js +3 -0
  320. package/dist/timing/index.js.map +1 -0
  321. package/dist/timing/narrationTiming.d.ts +54 -0
  322. package/dist/timing/narrationTiming.d.ts.map +1 -0
  323. package/dist/timing/narrationTiming.js +190 -0
  324. package/dist/timing/narrationTiming.js.map +1 -0
  325. package/dist/timing/readingTime.d.ts +54 -0
  326. package/dist/timing/readingTime.d.ts.map +1 -0
  327. package/dist/timing/readingTime.js +49 -0
  328. package/dist/timing/readingTime.js.map +1 -0
  329. package/package.json +17 -3
  330. package/src/__tests__/contentContainer.test.ts +282 -0
  331. package/src/__tests__/contentExtractor.test.ts +183 -0
  332. package/src/__tests__/seededRandom.test.ts +142 -0
  333. package/src/__tests__/slideshowGenerator.test.ts +128 -0
  334. package/src/__tests__/timing.test.ts +167 -0
  335. package/src/generate/contentExtractor.ts +808 -0
  336. package/src/generate/index.ts +21 -0
  337. package/src/generate/slideshowGenerator.ts +273 -0
  338. package/src/generate/templateMapper.ts +170 -0
  339. package/src/index.ts +3 -0
  340. package/src/random/SeededRandom.ts +127 -0
  341. package/src/random/index.ts +1 -0
  342. package/src/storage/ContentContainer.ts +200 -0
  343. package/src/storage/MediaProviderFromContainer.ts +92 -0
  344. package/src/storage/index.ts +3 -0
  345. package/src/timing/index.ts +17 -0
  346. package/src/timing/narrationTiming.ts +220 -0
  347. package/src/timing/readingTime.ts +94 -0
  348. package/dist/chunk-VJN7UB2Z.js +0 -145
  349. package/dist/chunk-VJN7UB2Z.js.map +0 -1
@@ -0,0 +1,123 @@
1
+ /**
2
+ * Layout Strategy
3
+ *
4
+ * Provides orientation-specific layout hints for slide templates.
5
+ * Templates use these hints to position content appropriately for
6
+ * different aspect ratios (landscape, portrait, square).
7
+ *
8
+ * Key adaptations by orientation:
9
+ * - Portrait: Larger relative text, stacked layouts instead of side-by-side
10
+ * - Square: Balanced layout with moderate adjustments
11
+ * - Landscape: Default/reference layout
12
+ */
13
+ import { calculateFontScale } from './Viewport.js';
14
+ /**
15
+ * Layout configurations by orientation.
16
+ */
17
+ const LAYOUT_CONFIGS = {
18
+ landscape: {
19
+ primaryY: '35%',
20
+ secondaryY: '55%',
21
+ tertiaryY: '75%',
22
+ titleScale: 1.0,
23
+ bodyScale: 1.0,
24
+ columnLeftX: '25%',
25
+ columnRightX: '75%',
26
+ columnTopY: '35%',
27
+ columnBottomY: '65%',
28
+ stackColumns: false,
29
+ maxTextWidth: '80%',
30
+ horizontalPadding: '10%',
31
+ captionY: '85%',
32
+ captionScale: 1.0,
33
+ },
34
+ portrait: {
35
+ // Content positioned higher for thumb-reach zone on mobile
36
+ primaryY: '25%',
37
+ secondaryY: '42%',
38
+ tertiaryY: '58%',
39
+ // Titles scale down for narrower width; body text scales up to fill vertical space
40
+ titleScale: 0.7,
41
+ bodyScale: 1.5,
42
+ // Stacked columns instead of side-by-side
43
+ columnLeftX: '50%',
44
+ columnRightX: '50%',
45
+ columnTopY: '30%',
46
+ columnBottomY: '55%',
47
+ stackColumns: true,
48
+ // Wider relative to viewport to use available space
49
+ maxTextWidth: '90%',
50
+ horizontalPadding: '5%',
51
+ captionY: '75%',
52
+ captionScale: 0.85,
53
+ },
54
+ square: {
55
+ primaryY: '30%',
56
+ secondaryY: '50%',
57
+ tertiaryY: '70%',
58
+ titleScale: 0.85,
59
+ bodyScale: 0.9,
60
+ columnLeftX: '25%',
61
+ columnRightX: '75%',
62
+ columnTopY: '35%',
63
+ columnBottomY: '65%',
64
+ stackColumns: false,
65
+ maxTextWidth: '85%',
66
+ horizontalPadding: '7.5%',
67
+ captionY: '82%',
68
+ captionScale: 0.9,
69
+ },
70
+ };
71
+ /**
72
+ * Get layout hints for a given orientation.
73
+ */
74
+ export function getLayoutHints(orientation) {
75
+ return LAYOUT_CONFIGS[orientation];
76
+ }
77
+ /**
78
+ * Calculate a scaled font size based on viewport and layout hints.
79
+ *
80
+ * @param basePx - Base font size in pixels (designed for 1920x1080)
81
+ * @param viewport - Target viewport configuration
82
+ * @param orientation - Viewport orientation
83
+ * @param isTitle - Whether this is title text (uses titleScale) or body (uses bodyScale)
84
+ */
85
+ export function scaledFontSize(basePx, viewport, orientation, isTitle = false) {
86
+ const fontScale = calculateFontScale(viewport);
87
+ const layout = getLayoutHints(orientation);
88
+ const typeScale = isTitle ? layout.titleScale : layout.bodyScale;
89
+ return Math.round(basePx * fontScale * typeScale);
90
+ }
91
+ /**
92
+ * Get position for two-column layout based on orientation.
93
+ * Returns { left: {x, y}, right: {x, y} } positions.
94
+ */
95
+ export function getTwoColumnPositions(orientation) {
96
+ const layout = getLayoutHints(orientation);
97
+ if (layout.stackColumns) {
98
+ // Portrait: stack vertically
99
+ return {
100
+ left: { x: '50%', y: layout.columnTopY },
101
+ right: { x: '50%', y: layout.columnBottomY },
102
+ };
103
+ }
104
+ // Landscape/square: side by side
105
+ return {
106
+ left: { x: layout.columnLeftX, y: '50%' },
107
+ right: { x: layout.columnRightX, y: '50%' },
108
+ };
109
+ }
110
+ /**
111
+ * Get safe text bounds for a given orientation.
112
+ * Returns margins to keep text away from edges.
113
+ */
114
+ export function getSafeTextBounds(orientation) {
115
+ const layout = getLayoutHints(orientation);
116
+ return {
117
+ left: layout.horizontalPadding,
118
+ right: layout.horizontalPadding,
119
+ top: '10%',
120
+ bottom: '10%',
121
+ };
122
+ }
123
+ //# sourceMappingURL=LayoutStrategy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LayoutStrategy.js","sourceRoot":"","sources":["../../src/schemas/LayoutStrategy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAoCnD;;GAEG;AACH,MAAM,cAAc,GAA6C;IAC/D,SAAS,EAAE;QACT,QAAQ,EAAE,KAAK;QACf,UAAU,EAAE,KAAK;QACjB,SAAS,EAAE,KAAK;QAChB,UAAU,EAAE,GAAG;QACf,SAAS,EAAE,GAAG;QACd,WAAW,EAAE,KAAK;QAClB,YAAY,EAAE,KAAK;QACnB,UAAU,EAAE,KAAK;QACjB,aAAa,EAAE,KAAK;QACpB,YAAY,EAAE,KAAK;QACnB,YAAY,EAAE,KAAK;QACnB,iBAAiB,EAAE,KAAK;QACxB,QAAQ,EAAE,KAAK;QACf,YAAY,EAAE,GAAG;KAClB;IACD,QAAQ,EAAE;QACR,2DA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GAAG,SAAS,GAAG,SAAS,CAAC,CAAC;AACpD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,WAAgC;IAIpE,MAAM,MAAM,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC;IAE3C,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;QACxB,6BAA6B;QAC7B,OAAO;YACL,IAAI,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,CAAC,UAAU,EAAE;YACxC,KAAK,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,CAAC,aAAa,EAAE;SAC7C,CAAC;IACJ,CAAC;IAED,iCAAiC;IACjC,OAAO;QACL,IAAI,EAAE,EAAE,CAAC,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,EAAE,KAAK,EAAE;QACzC,KAAK,EAAE,EAAE,CAAC,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC,EAAE,KAAK,EAAE;KAC5C,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,WAAgC;IAMhE,MAAM,MAAM,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC;IAC3C,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,iBAAiB;QAC9B,KAAK,EAAE,MAAM,CAAC,iBAAiB;QAC/B,GAAG,EAAE,KAAK;QACV,MAAM,EAAE,KAAK;KACd,CAAC;AACJ,CAAC"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * MediaProvider — abstract interface for resolving and managing media assets.
3
+ *
4
+ * Components (ImageLayer, VideoLayer, editor preview) use a MediaProvider to
5
+ * resolve relative media paths to displayable URLs and to manage media storage.
6
+ *
7
+ * This decouples the rendering layer from the storage backend:
8
+ * - In the dev site, a SlotStorage-backed provider serves blob URLs from IndexedDB
9
+ * - In production, a simple basePath provider constructs CDN URLs
10
+ * - In tests, a memory-backed provider returns data URIs
11
+ */
12
+ /**
13
+ * Metadata about a stored media asset.
14
+ */
15
+ export interface MediaEntry {
16
+ /** Filename (e.g., 'hero.jpg') */
17
+ name: string;
18
+ /** MIME type (e.g., 'image/jpeg') */
19
+ mimeType: string;
20
+ /** File size in bytes */
21
+ size: number;
22
+ }
23
+ /**
24
+ * Interface for resolving and managing media assets.
25
+ *
26
+ * All methods are async to support IndexedDB and other async storage backends.
27
+ * The `resolveUrl` method is the primary integration point for rendering
28
+ * components — it converts a relative media path into a displayable URL.
29
+ */
30
+ export interface MediaProvider {
31
+ /**
32
+ * Resolve a relative media path to a displayable URL.
33
+ *
34
+ * Returns a URL that can be used in <img src>, <video src>, etc.
35
+ * This may be a blob: URL, data: URL, or absolute HTTP URL depending
36
+ * on the provider implementation.
37
+ *
38
+ * @param relativePath - Relative path as stored in the document (e.g., 'hero.jpg')
39
+ * @returns Displayable URL, or the original path if resolution fails
40
+ */
41
+ resolveUrl(relativePath: string): Promise<string>;
42
+ /**
43
+ * List all media assets available in this provider's scope.
44
+ */
45
+ listMedia(): Promise<MediaEntry[]>;
46
+ /**
47
+ * Add a media asset. Returns the relative path to reference in documents.
48
+ *
49
+ * @param name - Filename for the asset (e.g., 'photo.jpg')
50
+ * @param data - Binary content (ArrayBuffer, Blob, or Uint8Array)
51
+ * @param mimeType - MIME type of the data
52
+ * @returns The relative path to use in document references
53
+ */
54
+ addMedia(name: string, data: ArrayBuffer | Blob | Uint8Array, mimeType: string): Promise<string>;
55
+ /**
56
+ * Remove a media asset by its relative path.
57
+ */
58
+ removeMedia(relativePath: string): Promise<void>;
59
+ /**
60
+ * Dispose of any held resources (e.g., revoke blob URLs).
61
+ * Call this when the provider is no longer needed.
62
+ */
63
+ dispose(): void;
64
+ }
65
+ //# sourceMappingURL=MediaProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MediaProvider.d.ts","sourceRoot":"","sources":["../../src/schemas/MediaProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;;;;;OASG;IACH,UAAU,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAElD;;OAEG;IACH,SAAS,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;IAEnC;;;;;;;OAOG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,UAAU,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEjG;;OAEG;IACH,WAAW,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjD;;;OAGG;IACH,OAAO,IAAI,IAAI,CAAC;CACjB"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * MediaProvider — abstract interface for resolving and managing media assets.
3
+ *
4
+ * Components (ImageLayer, VideoLayer, editor preview) use a MediaProvider to
5
+ * resolve relative media paths to displayable URLs and to manage media storage.
6
+ *
7
+ * This decouples the rendering layer from the storage backend:
8
+ * - In the dev site, a SlotStorage-backed provider serves blob URLs from IndexedDB
9
+ * - In production, a simple basePath provider constructs CDN URLs
10
+ * - In tests, a memory-backed provider returns data URIs
11
+ */
12
+ export {};
13
+ //# sourceMappingURL=MediaProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MediaProvider.js","sourceRoot":"","sources":["../../src/schemas/MediaProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
@@ -0,0 +1,163 @@
1
+ /**
2
+ * Theme System
3
+ *
4
+ * A Theme bundles color palette, typography, visual style, render-style
5
+ * algorithm, and per-block color schemes into one JSON-serializable object.
6
+ * Builders choose a theme from the built-in library or create a custom one
7
+ * via `createTheme(base, overrides)`.
8
+ *
9
+ * Design principles:
10
+ * - Fully JSON-serializable (no functions) — storable in config / APIs.
11
+ * - Doc carries an optional `themeId` pointer; resolution happens at render time.
12
+ * - `createTheme` deep-merges a base theme with partial overrides.
13
+ */
14
+ import type { LayoutHints } from './LayoutStrategy.js';
15
+ import type { AnimationType, TransitionType } from './Doc.js';
16
+ import type { PersistentLayerConfig } from './BlockTemplates.js';
17
+ /**
18
+ * Core color palette for a theme. Every color is a CSS color string.
19
+ */
20
+ export interface ThemeColorPalette {
21
+ /** Primary accent color */
22
+ primary: string;
23
+ /** Secondary accent color */
24
+ secondary: string;
25
+ /** Background color (typically dark) */
26
+ background: string;
27
+ /** Lighter background for contrast panels */
28
+ backgroundLight: string;
29
+ /** Main text color */
30
+ text: string;
31
+ /** Muted/secondary text color */
32
+ textMuted: string;
33
+ /** Highlight/emphasis color */
34
+ highlight: string;
35
+ /** Warning/alert color */
36
+ warning: string;
37
+ }
38
+ /**
39
+ * A named color scheme used by templates for per-block color variation
40
+ * (e.g., statHighlight or sectionHeader).
41
+ */
42
+ export interface ThemeColorScheme {
43
+ /** Background fill */
44
+ bg: string;
45
+ /** Primary text tint */
46
+ text: string;
47
+ /** Accent / secondary tint */
48
+ accent: string;
49
+ }
50
+ /**
51
+ * Typography settings for a theme.
52
+ */
53
+ export interface ThemeTypography {
54
+ /** Font family for body / description text */
55
+ bodyFontFamily: string;
56
+ /** Font family for titles and headings */
57
+ titleFontFamily: string;
58
+ /** Font family for code / monospaced text (optional) */
59
+ monoFontFamily?: string;
60
+ /** Multiplier applied to LayoutHints.titleScale (default 1.0) */
61
+ titleScale?: number;
62
+ /** Multiplier applied to LayoutHints.bodyScale (default 1.0) */
63
+ bodyScale?: number;
64
+ /** Default body line height (default 1.4) */
65
+ lineHeight?: number;
66
+ /** Default title line height */
67
+ titleLineHeight?: number;
68
+ /** Default title font weight */
69
+ titleWeight?: 'normal' | 'bold';
70
+ }
71
+ /**
72
+ * Global visual-style knobs that templates consult.
73
+ */
74
+ export interface ThemeStyle {
75
+ /** Default border radius for cards / shapes (px) */
76
+ borderRadius?: number;
77
+ /** Whether templates should default to text shadows */
78
+ textShadow?: boolean;
79
+ /** Darkness of overlay on image-backed blocks (0–1) */
80
+ overlayOpacity?: number;
81
+ /** Multiplier on all animation durations (1.0 = normal, <1 faster, >1 slower) */
82
+ animationSpeed?: number;
83
+ /** Default horizontal padding for text (percentage string, e.g. "5%") */
84
+ blockPadding?: string;
85
+ }
86
+ /**
87
+ * Render-style algorithm preset. Controls layout tweaks, default animations,
88
+ * transitions, and per-template behavioral hints.
89
+ */
90
+ export interface RenderStyle {
91
+ /** Identifier for this algorithmic approach (e.g. "documentary", "magazine") */
92
+ name: string;
93
+ /** Partial overrides merged onto the orientation-based LayoutHints */
94
+ layoutOverrides?: Partial<LayoutHints>;
95
+ /** Default entrance animation for text layers */
96
+ defaultTextAnimation?: AnimationType;
97
+ /** Default animation for background / image layers */
98
+ defaultImageAnimation?: AnimationType;
99
+ /** Whether to apply Ken Burns ambient motion to images by default */
100
+ ambientMotion?: boolean;
101
+ /** Default block-to-block transition */
102
+ defaultTransition?: {
103
+ type: TransitionType;
104
+ duration?: number;
105
+ };
106
+ /**
107
+ * Per-template behavioral hints. Keys are template names, values are
108
+ * string/number/boolean maps that templates can read to vary their output.
109
+ *
110
+ * @example
111
+ * ```
112
+ * { statHighlight: { entrance: 'dramatic' }, titleBlock: { showAccentLine: false } }
113
+ * ```
114
+ */
115
+ templateHints?: Record<string, Record<string, string | number | boolean>>;
116
+ }
117
+ /**
118
+ * A complete, JSON-serializable theme definition.
119
+ */
120
+ export interface Theme {
121
+ /** Unique identifier (e.g. "documentary") */
122
+ id: string;
123
+ /** Human-readable display name */
124
+ name: string;
125
+ /** Short description for theme pickers */
126
+ description?: string;
127
+ /** Color palette */
128
+ colors: ThemeColorPalette;
129
+ /** Typography settings */
130
+ typography: ThemeTypography;
131
+ /** Global visual-style knobs */
132
+ style: ThemeStyle;
133
+ /** Algorithmic render-style preset */
134
+ renderStyle: RenderStyle;
135
+ /**
136
+ * Named color schemes for per-block color variation.
137
+ * Templates reference these by name (e.g. "blue", "warm").
138
+ */
139
+ colorSchemes: Record<string, ThemeColorScheme>;
140
+ /** Optional persistent layers baked into the theme */
141
+ persistentLayers?: PersistentLayerConfig;
142
+ }
143
+ /**
144
+ * Recursively makes every property optional.
145
+ */
146
+ export type DeepPartial<T> = {
147
+ [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
148
+ };
149
+ /**
150
+ * Create a new theme by deep-merging overrides onto a base theme.
151
+ * The returned theme gets its own `id` if one is provided in overrides,
152
+ * otherwise keeps the base theme's `id` suffixed with "-custom".
153
+ *
154
+ * @example
155
+ * ```ts
156
+ * const myTheme = createTheme(THEMES.documentary, {
157
+ * colors: { primary: '#ff0000' },
158
+ * typography: { bodyFontFamily: '"Inter", sans-serif' },
159
+ * });
160
+ * ```
161
+ */
162
+ export declare function createTheme(base: Theme, overrides: DeepPartial<Theme>): Theme;
163
+ //# sourceMappingURL=Theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Theme.d.ts","sourceRoot":"","sources":["../../src/schemas/Theme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAMjE;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,2BAA2B;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,6BAA6B;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,wCAAwC;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,eAAe,EAAE,MAAM,CAAC;IACxB,sBAAs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,KAAK,EAAE,SAAS,EAAE,WAAW,CAAC,KAAK,CAAC,GAAG,KAAK,CAS7E"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Theme System
3
+ *
4
+ * A Theme bundles color palette, typography, visual style, render-style
5
+ * algorithm, and per-block color schemes into one JSON-serializable object.
6
+ * Builders choose a theme from the built-in library or create a custom one
7
+ * via `createTheme(base, overrides)`.
8
+ *
9
+ * Design principles:
10
+ * - Fully JSON-serializable (no functions) — storable in config / APIs.
11
+ * - Doc carries an optional `themeId` pointer; resolution happens at render time.
12
+ * - `createTheme` deep-merges a base theme with partial overrides.
13
+ */
14
+ // ============================================
15
+ // Helpers
16
+ // ============================================
17
+ /**
18
+ * Deep-merge `source` into `target`, returning a new object.
19
+ * Arrays are replaced wholesale (not concatenated).
20
+ */
21
+ function deepMerge(target, source) {
22
+ const result = { ...target };
23
+ for (const key of Object.keys(source)) {
24
+ const srcVal = source[key];
25
+ const tgtVal = target[key];
26
+ if (srcVal !== null &&
27
+ srcVal !== undefined &&
28
+ typeof srcVal === 'object' &&
29
+ !Array.isArray(srcVal) &&
30
+ tgtVal !== null &&
31
+ tgtVal !== undefined &&
32
+ typeof tgtVal === 'object' &&
33
+ !Array.isArray(tgtVal)) {
34
+ result[key] = deepMerge(tgtVal, srcVal);
35
+ }
36
+ else if (srcVal !== undefined) {
37
+ result[key] = srcVal;
38
+ }
39
+ }
40
+ return result;
41
+ }
42
+ /**
43
+ * Create a new theme by deep-merging overrides onto a base theme.
44
+ * The returned theme gets its own `id` if one is provided in overrides,
45
+ * otherwise keeps the base theme's `id` suffixed with "-custom".
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * const myTheme = createTheme(THEMES.documentary, {
50
+ * colors: { primary: '#ff0000' },
51
+ * typography: { bodyFontFamily: '"Inter", sans-serif' },
52
+ * });
53
+ * ```
54
+ */
55
+ export function createTheme(base, overrides) {
56
+ const merged = deepMerge(base, overrides);
57
+ if (!overrides.id && merged.id === base.id) {
58
+ merged.id = `${base.id}-custom`;
59
+ }
60
+ return merged;
61
+ }
62
+ //# sourceMappingURL=Theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Theme.js","sourceRoot":"","sources":["../../src/schemas/Theme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAsKH,+CAA+C;AAC/C,UAAU;AACV,+CAA+C;AAE/C;;;GAGG;AACH,SAAS,SAAS,CAAoC,MAAS,EAAE,MAAsB;IACrF,MAAM,MAAM,GAAG,EAAE,GAAG,MAAM,EAA6B,CAAC;IACxD,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACtC,MAAM,MAAM,GAAI,MAAkC,CAAC,GAAG,CAAC,CAAC;QACxD,MAAM,MAAM,GAAI,MAAkC,CAAC,GAAG,CAAC,CAAC;QACxD,IACE,MAAM,KAAK,IAAI;YACf,MAAM,KAAK,SAAS;YACpB,OAAO,MAAM,KAAK,QAAQ;YAC1B,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;YACtB,MAAM,KAAK,IAAI;YACf,MAAM,KAAK,SAAS;YACpB,OAAO,MAAM,KAAK,QAAQ;YAC1B,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EACtB,CAAC;YACD,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,CACrB,MAAiC,EACjC,MAA8C,CAC/C,CAAC;QACJ,CAAC;aAAM,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YAChC,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC;QACvB,CAAC;IACH,CAAC;IACD,OAAO,MAAW,CAAC;AACrB,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,WAAW,CAAC,IAAW,EAAE,SAA6B;IACpE,MAAM,MAAM,GAAG,SAAS,CACtB,IAA0C,EAC1C,SAAiD,CAC9B,CAAC;IACtB,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,MAAM,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,EAAE,CAAC;QAC3C,MAAM,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,EAAE,SAAS,CAAC;IAClC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Core geographic types shared across squisq.
3
+ */
4
+ export interface Coordinates {
5
+ lat: number;
6
+ lng: number;
7
+ }
8
+ export interface BoundingBox {
9
+ north: number;
10
+ south: number;
11
+ east: number;
12
+ west: number;
13
+ }
14
+ //# sourceMappingURL=Types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Types.d.ts","sourceRoot":"","sources":["../../src/schemas/Types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Core geographic types shared across squisq.
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=Types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Types.js","sourceRoot":"","sources":["../../src/schemas/Types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Viewport Configuration
3
+ *
4
+ * Defines viewport dimensions for doc rendering across different aspect ratios.
5
+ * Templates use this configuration to adapt their layouts appropriately.
6
+ *
7
+ * Supported aspect ratios:
8
+ * - landscape (16:9) - Default, standard video/presentation format
9
+ * - portrait (9:16) - Vertical video, mobile stories
10
+ * - square (1:1) - Social media posts
11
+ * - standard (4:3) - Legacy presentation format
12
+ */
13
+ /**
14
+ * Viewport configuration for doc rendering.
15
+ */
16
+ export interface ViewportConfig {
17
+ /** Canonical width in virtual pixels */
18
+ width: number;
19
+ /** Canonical height in virtual pixels */
20
+ height: number;
21
+ /** Human-readable name for debugging/display */
22
+ name: string;
23
+ }
24
+ /**
25
+ * Standard viewport presets for common aspect ratios.
26
+ */
27
+ export declare const VIEWPORT_PRESETS: {
28
+ /** 16:9 landscape (default, 1080p) */
29
+ readonly landscape: {
30
+ readonly width: 1920;
31
+ readonly height: 1080;
32
+ readonly name: "16:9 Landscape";
33
+ };
34
+ /** 9:16 portrait (vertical video, stories) */
35
+ readonly portrait: {
36
+ readonly width: 1080;
37
+ readonly height: 1920;
38
+ readonly name: "9:16 Portrait";
39
+ };
40
+ /** 1:1 square (social media) */
41
+ readonly square: {
42
+ readonly width: 1080;
43
+ readonly height: 1080;
44
+ readonly name: "1:1 Square";
45
+ };
46
+ /** 4:3 standard (legacy) */
47
+ readonly standard: {
48
+ readonly width: 1440;
49
+ readonly height: 1080;
50
+ readonly name: "4:3 Standard";
51
+ };
52
+ };
53
+ /**
54
+ * Viewport preset name.
55
+ */
56
+ export type ViewportPreset = keyof typeof VIEWPORT_PRESETS;
57
+ /**
58
+ * Viewport orientation derived from aspect ratio.
59
+ */
60
+ export type ViewportOrientation = 'landscape' | 'portrait' | 'square';
61
+ /**
62
+ * Get a viewport configuration from a preset name or return the config if already a ViewportConfig.
63
+ */
64
+ export declare function getViewport(viewport: ViewportPreset | ViewportConfig): ViewportConfig;
65
+ export declare function calculateFontScale(viewport: ViewportConfig): number;
66
+ /**
67
+ * Determine if viewport is landscape, portrait, or square.
68
+ */
69
+ export declare function getViewportOrientation(viewport: ViewportConfig): ViewportOrientation;
70
+ /**
71
+ * Get aspect ratio as a string (e.g., "16:9", "9:16", "1:1").
72
+ */
73
+ export declare function getAspectRatioString(viewport: ViewportConfig): string;
74
+ //# sourceMappingURL=Viewport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Viewport.d.ts","sourceRoot":"","sources":["../../src/schemas/Viewport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB;IAC3B,sCAAsC;;;;;;IAEtC,8CAA8C;;;;;;IAE9C,gCAAgC;;;;;;IAEhC,4BAA4B;;;;;;CAEpB,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,gBAAgB,CAAC;AAE3D;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG,UAAU,GAAG,QAAQ,CAAC;AAEtE;;GAEG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,cAAc,GAAG,cAAc,GAAG,cAAc,CAKrF;AASD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,CAKnE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,cAAc,GAAG,mBAAmB,CAKpF;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,CAIrE"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Viewport Configuration
3
+ *
4
+ * Defines viewport dimensions for doc rendering across different aspect ratios.
5
+ * Templates use this configuration to adapt their layouts appropriately.
6
+ *
7
+ * Supported aspect ratios:
8
+ * - landscape (16:9) - Default, standard video/presentation format
9
+ * - portrait (9:16) - Vertical video, mobile stories
10
+ * - square (1:1) - Social media posts
11
+ * - standard (4:3) - Legacy presentation format
12
+ */
13
+ /**
14
+ * Standard viewport presets for common aspect ratios.
15
+ */
16
+ export const VIEWPORT_PRESETS = {
17
+ /** 16:9 landscape (default, 1080p) */
18
+ landscape: { width: 1920, height: 1080, name: '16:9 Landscape' },
19
+ /** 9:16 portrait (vertical video, stories) */
20
+ portrait: { width: 1080, height: 1920, name: '9:16 Portrait' },
21
+ /** 1:1 square (social media) */
22
+ square: { width: 1080, height: 1080, name: '1:1 Square' },
23
+ /** 4:3 standard (legacy) */
24
+ standard: { width: 1440, height: 1080, name: '4:3 Standard' },
25
+ };
26
+ /**
27
+ * Get a viewport configuration from a preset name or return the config if already a ViewportConfig.
28
+ */
29
+ export function getViewport(viewport) {
30
+ if (typeof viewport === 'string') {
31
+ return VIEWPORT_PRESETS[viewport];
32
+ }
33
+ return viewport;
34
+ }
35
+ /**
36
+ * Calculate font scale factor for a viewport.
37
+ * Based on diagonal pixels relative to 1080p landscape reference.
38
+ * This ensures text remains readable across different viewport sizes.
39
+ */
40
+ const REFERENCE_DIAGONAL = Math.sqrt(1920 * 1920 + 1080 * 1080); // ~2203
41
+ export function calculateFontScale(viewport) {
42
+ const currentDiagonal = Math.sqrt(viewport.width * viewport.width + viewport.height * viewport.height);
43
+ return currentDiagonal / REFERENCE_DIAGONAL;
44
+ }
45
+ /**
46
+ * Determine if viewport is landscape, portrait, or square.
47
+ */
48
+ export function getViewportOrientation(viewport) {
49
+ const ratio = viewport.width / viewport.height;
50
+ // Allow small tolerance for "square" classification
51
+ if (Math.abs(ratio - 1) < 0.05)
52
+ return 'square';
53
+ return ratio > 1 ? 'landscape' : 'portrait';
54
+ }
55
+ /**
56
+ * Get aspect ratio as a string (e.g., "16:9", "9:16", "1:1").
57
+ */
58
+ export function getAspectRatioString(viewport) {
59
+ const gcd = (a, b) => (b === 0 ? a : gcd(b, a % b));
60
+ const divisor = gcd(viewport.width, viewport.height);
61
+ return `${viewport.width / divisor}:${viewport.height / divisor}`;
62
+ }
63
+ //# sourceMappingURL=Viewport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Viewport.js","sourceRoot":"","sources":["../../src/schemas/Viewport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAcH;;GAEG;AACH,MAAM,CAAC,MAAM,gBAA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