@kensio/colophon 2.5.0 → 2.6.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 (622) hide show
  1. package/README.md +91 -13
  2. package/dist/astro/index.d.ts +49 -0
  3. package/dist/astro/index.d.ts.map +1 -0
  4. package/dist/astro/index.js +42 -0
  5. package/dist/astro/index.js.map +1 -0
  6. package/dist/cli/args/command.d.ts +13 -0
  7. package/dist/cli/args/command.d.ts.map +1 -0
  8. package/dist/cli/args/command.js +22 -0
  9. package/dist/cli/args/command.js.map +1 -0
  10. package/dist/cli/args/index.d.ts +28 -0
  11. package/dist/cli/args/index.d.ts.map +1 -0
  12. package/dist/cli/args/index.js +75 -0
  13. package/dist/cli/args/index.js.map +1 -0
  14. package/dist/cli/args/switches.d.ts +18 -0
  15. package/dist/cli/args/switches.d.ts.map +1 -0
  16. package/dist/cli/args/switches.js +42 -0
  17. package/dist/cli/args/switches.js.map +1 -0
  18. package/dist/cli/args/usage.d.ts +3 -0
  19. package/dist/cli/args/usage.d.ts.map +1 -0
  20. package/dist/cli/args/usage.js +34 -0
  21. package/dist/cli/args/usage.js.map +1 -0
  22. package/dist/cli/args/values.d.ts +11 -0
  23. package/dist/cli/args/values.d.ts.map +1 -0
  24. package/dist/cli/args/values.js +29 -0
  25. package/dist/cli/args/values.js.map +1 -0
  26. package/dist/cli/build.d.ts +10 -0
  27. package/dist/cli/build.d.ts.map +1 -0
  28. package/dist/cli/build.js +41 -0
  29. package/dist/cli/build.js.map +1 -0
  30. package/dist/cli/eject/adapters.d.ts +20 -0
  31. package/dist/cli/eject/adapters.d.ts.map +1 -0
  32. package/dist/cli/eject/adapters.js +29 -0
  33. package/dist/cli/eject/adapters.js.map +1 -0
  34. package/dist/cli/eject/astro.d.ts +13 -0
  35. package/dist/cli/eject/astro.d.ts.map +1 -0
  36. package/dist/cli/eject/astro.js +35 -0
  37. package/dist/cli/eject/astro.js.map +1 -0
  38. package/dist/cli/eject/hugo.d.ts +19 -0
  39. package/dist/cli/eject/hugo.d.ts.map +1 -0
  40. package/dist/cli/eject/hugo.js +127 -0
  41. package/dist/cli/eject/hugo.js.map +1 -0
  42. package/dist/cli/eject/index.d.ts +15 -0
  43. package/dist/cli/eject/index.d.ts.map +1 -0
  44. package/dist/cli/eject/index.js +46 -0
  45. package/dist/cli/eject/index.js.map +1 -0
  46. package/dist/cli/index.js +25 -20
  47. package/dist/cli/index.js.map +1 -1
  48. package/dist/cli/init/fs.d.ts +5 -0
  49. package/dist/cli/init/fs.d.ts.map +1 -0
  50. package/dist/cli/init/fs.js +19 -0
  51. package/dist/cli/init/fs.js.map +1 -0
  52. package/dist/cli/init/guess.d.ts +9 -0
  53. package/dist/cli/init/guess.d.ts.map +1 -0
  54. package/dist/cli/init/guess.js +27 -0
  55. package/dist/cli/init/guess.js.map +1 -0
  56. package/dist/cli/init/index.d.ts +11 -0
  57. package/dist/cli/init/index.d.ts.map +1 -0
  58. package/dist/cli/init/index.js +36 -0
  59. package/dist/cli/init/index.js.map +1 -0
  60. package/dist/cli/init/module.d.ts +12 -0
  61. package/dist/cli/init/module.d.ts.map +1 -0
  62. package/dist/cli/init/module.js +45 -0
  63. package/dist/cli/init/module.js.map +1 -0
  64. package/dist/cli/init/scaffold.d.ts +10 -0
  65. package/dist/cli/init/scaffold.d.ts.map +1 -0
  66. package/dist/cli/init/scaffold.js +52 -0
  67. package/dist/cli/init/scaffold.js.map +1 -0
  68. package/dist/cli/message.d.ts +7 -0
  69. package/dist/cli/message.d.ts.map +1 -0
  70. package/dist/cli/message.js +9 -0
  71. package/dist/cli/message.js.map +1 -0
  72. package/dist/cli/preview/index.d.ts +13 -0
  73. package/dist/cli/preview/index.d.ts.map +1 -0
  74. package/dist/cli/preview/index.js +27 -0
  75. package/dist/cli/preview/index.js.map +1 -0
  76. package/dist/cli/preview/open.d.ts +10 -0
  77. package/dist/cli/preview/open.d.ts.map +1 -0
  78. package/dist/cli/preview/open.js +32 -0
  79. package/dist/cli/preview/open.js.map +1 -0
  80. package/dist/cli/preview/render.d.ts +23 -0
  81. package/dist/cli/preview/render.d.ts.map +1 -0
  82. package/dist/cli/preview/render.js +40 -0
  83. package/dist/cli/preview/render.js.map +1 -0
  84. package/dist/cli/preview/root.d.ts +17 -0
  85. package/dist/cli/preview/root.d.ts.map +1 -0
  86. package/dist/cli/preview/root.js +22 -0
  87. package/dist/cli/preview/root.js.map +1 -0
  88. package/dist/cli/preview/size.d.ts +7 -0
  89. package/dist/cli/preview/size.d.ts.map +1 -0
  90. package/dist/cli/preview/size.js +13 -0
  91. package/dist/cli/preview/size.js.map +1 -0
  92. package/dist/cli/report.d.ts +6 -0
  93. package/dist/cli/report.d.ts.map +1 -0
  94. package/dist/cli/report.js +23 -0
  95. package/dist/cli/report.js.map +1 -0
  96. package/dist/cli/watch/filter.d.ts +14 -0
  97. package/dist/cli/watch/filter.d.ts.map +1 -0
  98. package/dist/cli/watch/filter.js +16 -0
  99. package/dist/cli/watch/filter.js.map +1 -0
  100. package/dist/cli/watch/index.d.ts +27 -0
  101. package/dist/cli/watch/index.d.ts.map +1 -0
  102. package/dist/cli/watch/index.js +38 -0
  103. package/dist/cli/watch/index.js.map +1 -0
  104. package/dist/cli/watch/queue.d.ts +24 -0
  105. package/dist/cli/watch/queue.d.ts.map +1 -0
  106. package/dist/cli/watch/queue.js +57 -0
  107. package/dist/cli/watch/queue.js.map +1 -0
  108. package/dist/config/defaults.d.ts +39 -1
  109. package/dist/config/defaults.d.ts.map +1 -1
  110. package/dist/config/defaults.js +38 -0
  111. package/dist/config/defaults.js.map +1 -1
  112. package/dist/config/index.d.ts +1 -1
  113. package/dist/config/index.d.ts.map +1 -1
  114. package/dist/config/index.js +18 -4
  115. package/dist/config/index.js.map +1 -1
  116. package/dist/config/output.d.ts +26 -0
  117. package/dist/config/output.d.ts.map +1 -0
  118. package/dist/config/output.js +45 -0
  119. package/dist/config/output.js.map +1 -0
  120. package/dist/config/resolve.d.ts +10 -0
  121. package/dist/config/resolve.d.ts.map +1 -1
  122. package/dist/config/resolve.js +20 -1
  123. package/dist/config/resolve.js.map +1 -1
  124. package/dist/content/index.d.ts +1 -0
  125. package/dist/content/index.d.ts.map +1 -1
  126. package/dist/content/index.js +1 -0
  127. package/dist/content/index.js.map +1 -1
  128. package/dist/content/read.d.ts +15 -0
  129. package/dist/content/read.d.ts.map +1 -0
  130. package/dist/content/read.js +36 -0
  131. package/dist/content/read.js.map +1 -0
  132. package/dist/content/walk.d.ts.map +1 -1
  133. package/dist/content/walk.js +4 -30
  134. package/dist/content/walk.js.map +1 -1
  135. package/dist/core/index.d.ts +37 -0
  136. package/dist/core/index.d.ts.map +1 -0
  137. package/dist/core/index.js +13 -0
  138. package/dist/core/index.js.map +1 -0
  139. package/dist/encode/fit.d.ts +16 -0
  140. package/dist/encode/fit.d.ts.map +1 -0
  141. package/dist/encode/fit.js +23 -0
  142. package/dist/encode/fit.js.map +1 -0
  143. package/dist/encode/format.d.ts +12 -0
  144. package/dist/encode/format.d.ts.map +1 -0
  145. package/dist/encode/format.js +40 -0
  146. package/dist/encode/format.js.map +1 -0
  147. package/dist/encode/index.d.ts +14 -0
  148. package/dist/encode/index.d.ts.map +1 -0
  149. package/dist/encode/index.js +52 -0
  150. package/dist/encode/index.js.map +1 -0
  151. package/dist/encode/sharp.d.ts +19 -0
  152. package/dist/encode/sharp.d.ts.map +1 -0
  153. package/dist/encode/sharp.js +57 -0
  154. package/dist/encode/sharp.js.map +1 -0
  155. package/dist/encode/warn.d.ts +10 -0
  156. package/dist/encode/warn.d.ts.map +1 -0
  157. package/dist/encode/warn.js +31 -0
  158. package/dist/encode/warn.js.map +1 -0
  159. package/dist/fonts/resolve.d.ts.map +1 -1
  160. package/dist/fonts/resolve.js +2 -8
  161. package/dist/fonts/resolve.js.map +1 -1
  162. package/dist/generate/index.d.ts +4 -0
  163. package/dist/generate/index.d.ts.map +1 -1
  164. package/dist/generate/index.js +10 -4
  165. package/dist/generate/index.js.map +1 -1
  166. package/dist/generate/options.d.ts +11 -1
  167. package/dist/generate/options.d.ts.map +1 -1
  168. package/dist/generate/options.js.map +1 -1
  169. package/dist/generate/output-path.d.ts +6 -2
  170. package/dist/generate/output-path.d.ts.map +1 -1
  171. package/dist/generate/output-path.js +7 -2
  172. package/dist/generate/output-path.js.map +1 -1
  173. package/dist/generate/plan.d.ts.map +1 -1
  174. package/dist/generate/plan.js +3 -3
  175. package/dist/generate/plan.js.map +1 -1
  176. package/dist/generate/render-image.d.ts +6 -0
  177. package/dist/generate/render-image.d.ts.map +1 -1
  178. package/dist/generate/render-image.js +14 -4
  179. package/dist/generate/render-image.js.map +1 -1
  180. package/dist/image/index.d.ts +3 -1
  181. package/dist/image/index.d.ts.map +1 -1
  182. package/dist/image/index.js +4 -3
  183. package/dist/image/index.js.map +1 -1
  184. package/dist/image/jpeg.d.ts +5 -4
  185. package/dist/image/jpeg.d.ts.map +1 -1
  186. package/dist/image/jpeg.js +13 -36
  187. package/dist/image/jpeg.js.map +1 -1
  188. package/dist/image/load.d.ts.map +1 -1
  189. package/dist/image/load.js +4 -15
  190. package/dist/image/load.js.map +1 -1
  191. package/dist/image/resolve.d.ts.map +1 -1
  192. package/dist/image/resolve.js +2 -8
  193. package/dist/image/resolve.js.map +1 -1
  194. package/dist/image/uri.d.ts.map +1 -1
  195. package/dist/image/uri.js +2 -3
  196. package/dist/image/uri.js.map +1 -1
  197. package/dist/index.d.ts +8 -4
  198. package/dist/index.d.ts.map +1 -1
  199. package/dist/index.js +10 -3
  200. package/dist/index.js.map +1 -1
  201. package/dist/jpeg/index.d.ts +10 -0
  202. package/dist/jpeg/index.d.ts.map +1 -0
  203. package/dist/jpeg/index.js +2 -0
  204. package/dist/jpeg/index.js.map +1 -0
  205. package/dist/jpeg/segments.d.ts +32 -0
  206. package/dist/jpeg/segments.d.ts.map +1 -0
  207. package/dist/jpeg/segments.js +66 -0
  208. package/dist/jpeg/segments.js.map +1 -0
  209. package/dist/layout/draw.d.ts +20 -0
  210. package/dist/layout/draw.d.ts.map +1 -0
  211. package/dist/layout/draw.js +32 -0
  212. package/dist/layout/draw.js.map +1 -0
  213. package/dist/layout/extent.d.ts +19 -0
  214. package/dist/layout/extent.d.ts.map +1 -0
  215. package/dist/layout/extent.js +24 -0
  216. package/dist/layout/extent.js.map +1 -0
  217. package/dist/layout/index.d.ts +7 -4
  218. package/dist/layout/index.d.ts.map +1 -1
  219. package/dist/layout/index.js +5 -3
  220. package/dist/layout/index.js.map +1 -1
  221. package/dist/layout/lines.d.ts +0 -17
  222. package/dist/layout/lines.d.ts.map +1 -1
  223. package/dist/layout/lines.js +2 -35
  224. package/dist/layout/lines.js.map +1 -1
  225. package/dist/measure/faces.d.ts.map +1 -1
  226. package/dist/measure/faces.js +8 -2
  227. package/dist/measure/faces.js.map +1 -1
  228. package/dist/meta/index.d.ts +1 -0
  229. package/dist/meta/index.d.ts.map +1 -1
  230. package/dist/meta/index.js +1 -0
  231. package/dist/meta/index.js.map +1 -1
  232. package/dist/meta/path.d.ts +24 -0
  233. package/dist/meta/path.d.ts.map +1 -0
  234. package/dist/meta/path.js +41 -0
  235. package/dist/meta/path.js.map +1 -0
  236. package/dist/meta/tags.d.ts.map +1 -1
  237. package/dist/meta/tags.js +6 -1
  238. package/dist/meta/tags.js.map +1 -1
  239. package/dist/placement/index.d.ts +7 -2
  240. package/dist/placement/index.d.ts.map +1 -1
  241. package/dist/placement/index.js +9 -3
  242. package/dist/placement/index.js.map +1 -1
  243. package/dist/placement/relative.d.ts +8 -3
  244. package/dist/placement/relative.d.ts.map +1 -1
  245. package/dist/placement/relative.js +12 -5
  246. package/dist/placement/relative.js.map +1 -1
  247. package/dist/platform/base64.d.ts +13 -0
  248. package/dist/platform/base64.d.ts.map +1 -0
  249. package/dist/platform/base64.js +35 -0
  250. package/dist/platform/base64.js.map +1 -0
  251. package/dist/platform/rasteriser.browser.d.ts +16 -0
  252. package/dist/platform/rasteriser.browser.d.ts.map +1 -0
  253. package/dist/platform/rasteriser.browser.js +20 -0
  254. package/dist/platform/rasteriser.browser.js.map +1 -0
  255. package/dist/platform/rasteriser.node.d.ts +2 -0
  256. package/dist/platform/rasteriser.node.d.ts.map +1 -0
  257. package/dist/platform/rasteriser.node.js +2 -0
  258. package/dist/platform/rasteriser.node.js.map +1 -0
  259. package/dist/platform/read-file.browser.d.ts +17 -0
  260. package/dist/platform/read-file.browser.d.ts.map +1 -0
  261. package/dist/platform/read-file.browser.js +23 -0
  262. package/dist/platform/read-file.browser.js.map +1 -0
  263. package/dist/platform/read-file.node.d.ts +19 -0
  264. package/dist/platform/read-file.node.d.ts.map +1 -0
  265. package/dist/platform/read-file.node.js +31 -0
  266. package/dist/platform/read-file.node.js.map +1 -0
  267. package/dist/png/chunk.d.ts +23 -0
  268. package/dist/png/chunk.d.ts.map +1 -0
  269. package/dist/png/chunk.js +48 -0
  270. package/dist/png/chunk.js.map +1 -0
  271. package/dist/png/index.d.ts +13 -0
  272. package/dist/png/index.d.ts.map +1 -0
  273. package/dist/png/index.js +3 -0
  274. package/dist/png/index.js.map +1 -0
  275. package/dist/png/recompress.d.ts +23 -0
  276. package/dist/png/recompress.d.ts.map +1 -0
  277. package/dist/png/recompress.js +81 -0
  278. package/dist/png/recompress.js.map +1 -0
  279. package/dist/props.d.ts +11 -0
  280. package/dist/props.d.ts.map +1 -1
  281. package/dist/props.js +16 -0
  282. package/dist/props.js.map +1 -1
  283. package/dist/render/image.d.ts +20 -0
  284. package/dist/render/image.d.ts.map +1 -0
  285. package/dist/render/image.js +29 -0
  286. package/dist/render/image.js.map +1 -0
  287. package/dist/render/index.d.ts +2 -1
  288. package/dist/render/index.d.ts.map +1 -1
  289. package/dist/render/index.js +5 -4
  290. package/dist/render/index.js.map +1 -1
  291. package/dist/render/png.d.ts +14 -4
  292. package/dist/render/png.d.ts.map +1 -1
  293. package/dist/render/png.js +22 -23
  294. package/dist/render/png.js.map +1 -1
  295. package/dist/render/rasterise.d.ts +15 -0
  296. package/dist/render/rasterise.d.ts.map +1 -0
  297. package/dist/render/rasterise.js +34 -0
  298. package/dist/render/rasterise.js.map +1 -0
  299. package/dist/render/svg.d.ts.map +1 -1
  300. package/dist/render/svg.js +1 -0
  301. package/dist/render/svg.js.map +1 -1
  302. package/dist/sign/base64url.d.ts +16 -0
  303. package/dist/sign/base64url.d.ts.map +1 -0
  304. package/dist/sign/base64url.js +24 -0
  305. package/dist/sign/base64url.js.map +1 -0
  306. package/dist/sign/index.d.ts +49 -0
  307. package/dist/sign/index.d.ts.map +1 -0
  308. package/dist/sign/index.js +133 -0
  309. package/dist/sign/index.js.map +1 -0
  310. package/dist/stamp/carrier/index.d.ts +7 -0
  311. package/dist/stamp/carrier/index.d.ts.map +1 -0
  312. package/dist/stamp/carrier/index.js +27 -0
  313. package/dist/stamp/carrier/index.js.map +1 -0
  314. package/dist/stamp/carrier/isobmff.d.ts +7 -0
  315. package/dist/stamp/carrier/isobmff.d.ts.map +1 -0
  316. package/dist/stamp/carrier/isobmff.js +55 -0
  317. package/dist/stamp/carrier/isobmff.js.map +1 -0
  318. package/dist/stamp/carrier/jpeg.d.ts +4 -0
  319. package/dist/stamp/carrier/jpeg.d.ts.map +1 -0
  320. package/dist/stamp/carrier/jpeg.js +76 -0
  321. package/dist/stamp/carrier/jpeg.js.map +1 -0
  322. package/dist/stamp/carrier/png.d.ts +7 -0
  323. package/dist/stamp/carrier/png.d.ts.map +1 -0
  324. package/dist/stamp/carrier/png.js +50 -0
  325. package/dist/stamp/carrier/png.js.map +1 -0
  326. package/dist/stamp/carrier/riff.d.ts +4 -0
  327. package/dist/stamp/carrier/riff.d.ts.map +1 -0
  328. package/dist/stamp/carrier/riff.js +54 -0
  329. package/dist/stamp/carrier/riff.js.map +1 -0
  330. package/dist/stamp/carrier/types.d.ts +25 -0
  331. package/dist/stamp/carrier/types.d.ts.map +1 -0
  332. package/dist/stamp/carrier/types.js +2 -0
  333. package/dist/stamp/carrier/types.js.map +1 -0
  334. package/dist/stamp/chunk.d.ts +0 -2
  335. package/dist/stamp/chunk.d.ts.map +1 -1
  336. package/dist/stamp/chunk.js +10 -18
  337. package/dist/stamp/chunk.js.map +1 -1
  338. package/dist/stamp/config-digest.d.ts +18 -0
  339. package/dist/stamp/config-digest.d.ts.map +1 -1
  340. package/dist/stamp/config-digest.js +24 -0
  341. package/dist/stamp/config-digest.js.map +1 -1
  342. package/dist/stamp/index.d.ts +2 -2
  343. package/dist/stamp/index.d.ts.map +1 -1
  344. package/dist/stamp/index.js +2 -2
  345. package/dist/stamp/index.js.map +1 -1
  346. package/dist/stamp/payload.d.ts +28 -0
  347. package/dist/stamp/payload.d.ts.map +1 -0
  348. package/dist/stamp/payload.js +42 -0
  349. package/dist/stamp/payload.js.map +1 -0
  350. package/dist/stamp/read.d.ts +5 -4
  351. package/dist/stamp/read.d.ts.map +1 -1
  352. package/dist/stamp/read.js +26 -43
  353. package/dist/stamp/read.js.map +1 -1
  354. package/dist/stamp/window.d.ts +11 -0
  355. package/dist/stamp/window.d.ts.map +1 -0
  356. package/dist/stamp/window.js +11 -0
  357. package/dist/stamp/window.js.map +1 -0
  358. package/dist/stamp/write.d.ts +21 -0
  359. package/dist/stamp/write.d.ts.map +1 -0
  360. package/dist/stamp/write.js +31 -0
  361. package/dist/stamp/write.js.map +1 -0
  362. package/dist/templates/article/bottom.d.ts +15 -0
  363. package/dist/templates/article/bottom.d.ts.map +1 -0
  364. package/dist/templates/article/bottom.js +61 -0
  365. package/dist/templates/article/bottom.js.map +1 -0
  366. package/dist/templates/article/index.d.ts +12 -0
  367. package/dist/templates/article/index.d.ts.map +1 -0
  368. package/dist/templates/article/index.js +42 -0
  369. package/dist/templates/article/index.js.map +1 -0
  370. package/dist/templates/article/lines.d.ts +27 -0
  371. package/dist/templates/article/lines.d.ts.map +1 -0
  372. package/dist/templates/article/lines.js +53 -0
  373. package/dist/templates/article/lines.js.map +1 -0
  374. package/dist/templates/article/tags.d.ts +25 -0
  375. package/dist/templates/article/tags.d.ts.map +1 -0
  376. package/dist/templates/article/tags.js +63 -0
  377. package/dist/templates/article/tags.js.map +1 -0
  378. package/dist/templates/attribution.d.ts +2 -6
  379. package/dist/templates/attribution.d.ts.map +1 -1
  380. package/dist/templates/attribution.js +8 -22
  381. package/dist/templates/attribution.js.map +1 -1
  382. package/dist/templates/banner/version.d.ts.map +1 -1
  383. package/dist/templates/banner/version.js +4 -4
  384. package/dist/templates/banner/version.js.map +1 -1
  385. package/dist/templates/bottom.d.ts +23 -0
  386. package/dist/templates/bottom.d.ts.map +1 -0
  387. package/dist/templates/bottom.js +37 -0
  388. package/dist/templates/bottom.js.map +1 -0
  389. package/dist/templates/byline.d.ts +19 -0
  390. package/dist/templates/byline.d.ts.map +1 -0
  391. package/dist/templates/byline.js +45 -0
  392. package/dist/templates/byline.js.map +1 -0
  393. package/dist/templates/code/clip.js +1 -1
  394. package/dist/templates/code/clip.js.map +1 -1
  395. package/dist/templates/code/fit.js +1 -1
  396. package/dist/templates/code/fit.js.map +1 -1
  397. package/dist/templates/code/warn.d.ts +1 -1
  398. package/dist/templates/code/warn.d.ts.map +1 -1
  399. package/dist/templates/code/warn.js +2 -2
  400. package/dist/templates/code/warn.js.map +1 -1
  401. package/dist/templates/docs/chrome.d.ts +17 -0
  402. package/dist/templates/docs/chrome.d.ts.map +1 -0
  403. package/dist/templates/docs/chrome.js +44 -0
  404. package/dist/templates/docs/chrome.js.map +1 -0
  405. package/dist/templates/docs/crumbs.d.ts +14 -0
  406. package/dist/templates/docs/crumbs.d.ts.map +1 -0
  407. package/dist/templates/docs/crumbs.js +32 -0
  408. package/dist/templates/docs/crumbs.js.map +1 -0
  409. package/dist/templates/docs/index.d.ts +13 -0
  410. package/dist/templates/docs/index.d.ts.map +1 -0
  411. package/dist/templates/docs/index.js +47 -0
  412. package/dist/templates/docs/index.js.map +1 -0
  413. package/dist/templates/docs/lines.d.ts +14 -0
  414. package/dist/templates/docs/lines.d.ts.map +1 -0
  415. package/dist/templates/docs/lines.js +29 -0
  416. package/dist/templates/docs/lines.js.map +1 -0
  417. package/dist/templates/event/index.d.ts +12 -0
  418. package/dist/templates/event/index.d.ts.map +1 -0
  419. package/dist/templates/event/index.js +59 -0
  420. package/dist/templates/event/index.js.map +1 -0
  421. package/dist/templates/event/lines.d.ts +14 -0
  422. package/dist/templates/event/lines.d.ts.map +1 -0
  423. package/dist/templates/event/lines.js +29 -0
  424. package/dist/templates/event/lines.js.map +1 -0
  425. package/dist/templates/event/plate.d.ts +16 -0
  426. package/dist/templates/event/plate.d.ts.map +1 -0
  427. package/dist/templates/event/plate.js +36 -0
  428. package/dist/templates/event/plate.js.map +1 -0
  429. package/dist/templates/frame.d.ts +68 -0
  430. package/dist/templates/frame.d.ts.map +1 -0
  431. package/dist/templates/frame.js +63 -0
  432. package/dist/templates/frame.js.map +1 -0
  433. package/dist/templates/index.d.ts +9 -0
  434. package/dist/templates/index.d.ts.map +1 -1
  435. package/dist/templates/index.js +27 -0
  436. package/dist/templates/index.js.map +1 -1
  437. package/dist/templates/photo/index.d.ts +17 -0
  438. package/dist/templates/photo/index.d.ts.map +1 -0
  439. package/dist/templates/photo/index.js +51 -0
  440. package/dist/templates/photo/index.js.map +1 -0
  441. package/dist/templates/photo/lines.d.ts +21 -0
  442. package/dist/templates/photo/lines.d.ts.map +1 -0
  443. package/dist/templates/photo/lines.js +36 -0
  444. package/dist/templates/photo/lines.js.map +1 -0
  445. package/dist/templates/pill.d.ts +33 -0
  446. package/dist/templates/pill.d.ts.map +1 -0
  447. package/dist/templates/pill.js +50 -0
  448. package/dist/templates/pill.js.map +1 -0
  449. package/dist/templates/portrait.d.ts +40 -0
  450. package/dist/templates/portrait.d.ts.map +1 -0
  451. package/dist/templates/portrait.js +56 -0
  452. package/dist/templates/portrait.js.map +1 -0
  453. package/dist/templates/quote/index.d.ts +11 -0
  454. package/dist/templates/quote/index.d.ts.map +1 -0
  455. package/dist/templates/quote/index.js +60 -0
  456. package/dist/templates/quote/index.js.map +1 -0
  457. package/dist/templates/quote/lines.d.ts +24 -0
  458. package/dist/templates/quote/lines.d.ts.map +1 -0
  459. package/dist/templates/quote/lines.js +35 -0
  460. package/dist/templates/quote/lines.js.map +1 -0
  461. package/dist/templates/quote/mark.d.ts +13 -0
  462. package/dist/templates/quote/mark.d.ts.map +1 -0
  463. package/dist/templates/quote/mark.js +39 -0
  464. package/dist/templates/quote/mark.js.map +1 -0
  465. package/dist/templates/quote/speaker.d.ts +18 -0
  466. package/dist/templates/quote/speaker.d.ts.map +1 -0
  467. package/dist/templates/quote/speaker.js +41 -0
  468. package/dist/templates/quote/speaker.js.map +1 -0
  469. package/dist/templates/release/block.d.ts +8 -0
  470. package/dist/templates/release/block.d.ts.map +1 -0
  471. package/dist/templates/release/block.js +16 -0
  472. package/dist/templates/release/block.js.map +1 -0
  473. package/dist/templates/release/changes.d.ts +23 -0
  474. package/dist/templates/release/changes.d.ts.map +1 -0
  475. package/dist/templates/release/changes.js +45 -0
  476. package/dist/templates/release/changes.js.map +1 -0
  477. package/dist/templates/release/index.d.ts +11 -0
  478. package/dist/templates/release/index.d.ts.map +1 -0
  479. package/dist/templates/release/index.js +55 -0
  480. package/dist/templates/release/index.js.map +1 -0
  481. package/dist/templates/release/lines.d.ts +21 -0
  482. package/dist/templates/release/lines.d.ts.map +1 -0
  483. package/dist/templates/release/lines.js +36 -0
  484. package/dist/templates/release/lines.js.map +1 -0
  485. package/dist/templates/stat/index.d.ts +11 -0
  486. package/dist/templates/stat/index.d.ts.map +1 -0
  487. package/dist/templates/stat/index.js +43 -0
  488. package/dist/templates/stat/index.js.map +1 -0
  489. package/dist/templates/stat/lines.d.ts +23 -0
  490. package/dist/templates/stat/lines.d.ts.map +1 -0
  491. package/dist/templates/stat/lines.js +47 -0
  492. package/dist/templates/stat/lines.js.map +1 -0
  493. package/dist/templates/terminal/index.d.ts +16 -0
  494. package/dist/templates/terminal/index.d.ts.map +1 -0
  495. package/dist/templates/terminal/index.js +62 -0
  496. package/dist/templates/terminal/index.js.map +1 -0
  497. package/dist/templates/terminal/session.d.ts +17 -0
  498. package/dist/templates/terminal/session.d.ts.map +1 -0
  499. package/dist/templates/terminal/session.js +86 -0
  500. package/dist/templates/terminal/session.js.map +1 -0
  501. package/dist/templates/terminal/window.d.ts +14 -0
  502. package/dist/templates/terminal/window.d.ts.map +1 -0
  503. package/dist/templates/terminal/window.js +84 -0
  504. package/dist/templates/terminal/window.js.map +1 -0
  505. package/dist/templates/version.d.ts +16 -0
  506. package/dist/templates/version.d.ts.map +1 -0
  507. package/dist/templates/version.js +23 -0
  508. package/dist/templates/version.js.map +1 -0
  509. package/dist/templates/wordmark/index.d.ts +13 -0
  510. package/dist/templates/wordmark/index.d.ts.map +1 -0
  511. package/dist/templates/wordmark/index.js +53 -0
  512. package/dist/templates/wordmark/index.js.map +1 -0
  513. package/dist/templates/wordmark/lines.d.ts +22 -0
  514. package/dist/templates/wordmark/lines.d.ts.map +1 -0
  515. package/dist/templates/wordmark/lines.js +61 -0
  516. package/dist/templates/wordmark/lines.js.map +1 -0
  517. package/dist/templates/wordmark/mark.d.ts +16 -0
  518. package/dist/templates/wordmark/mark.d.ts.map +1 -0
  519. package/dist/templates/wordmark/mark.js +30 -0
  520. package/dist/templates/wordmark/mark.js.map +1 -0
  521. package/dist/text/clamp.d.ts +12 -0
  522. package/dist/text/clamp.d.ts.map +1 -0
  523. package/dist/text/clamp.js +41 -0
  524. package/dist/text/clamp.js.map +1 -0
  525. package/dist/text/ellipsis.d.ts +3 -0
  526. package/dist/text/ellipsis.d.ts.map +1 -0
  527. package/dist/text/ellipsis.js +3 -0
  528. package/dist/text/ellipsis.js.map +1 -0
  529. package/dist/text/index.d.ts +2 -0
  530. package/dist/text/index.d.ts.map +1 -1
  531. package/dist/text/index.js +2 -0
  532. package/dist/text/index.js.map +1 -1
  533. package/dist/types.d.ts +158 -6
  534. package/dist/types.d.ts.map +1 -1
  535. package/dist/validate/collect.d.ts.map +1 -1
  536. package/dist/validate/collect.js +2 -1
  537. package/dist/validate/collect.js.map +1 -1
  538. package/dist/validate/keys.d.ts +6 -0
  539. package/dist/validate/keys.d.ts.map +1 -1
  540. package/dist/validate/keys.js +17 -0
  541. package/dist/validate/keys.js.map +1 -1
  542. package/dist/validate/values.d.ts +6 -0
  543. package/dist/validate/values.d.ts.map +1 -1
  544. package/dist/validate/values.js +12 -1
  545. package/dist/validate/values.js.map +1 -1
  546. package/package.json +16 -2
  547. package/dist/background.d.ts +0 -13
  548. package/dist/background.d.ts.map +0 -1
  549. package/dist/background.js +0 -65
  550. package/dist/background.js.map +0 -1
  551. package/dist/cli/args.d.ts +0 -14
  552. package/dist/cli/args.d.ts.map +0 -1
  553. package/dist/cli/args.js +0 -67
  554. package/dist/cli/args.js.map +0 -1
  555. package/dist/cli.d.ts +0 -3
  556. package/dist/cli.d.ts.map +0 -1
  557. package/dist/cli.js +0 -102
  558. package/dist/cli.js.map +0 -1
  559. package/dist/config.d.ts +0 -95
  560. package/dist/config.d.ts.map +0 -1
  561. package/dist/config.js +0 -208
  562. package/dist/config.js.map +0 -1
  563. package/dist/fonts.d.ts +0 -18
  564. package/dist/fonts.d.ts.map +0 -1
  565. package/dist/fonts.js +0 -102
  566. package/dist/fonts.js.map +0 -1
  567. package/dist/generate.d.ts +0 -63
  568. package/dist/generate.d.ts.map +0 -1
  569. package/dist/generate.js +0 -109
  570. package/dist/generate.js.map +0 -1
  571. package/dist/highlight.d.ts +0 -75
  572. package/dist/highlight.d.ts.map +0 -1
  573. package/dist/highlight.js +0 -137
  574. package/dist/highlight.js.map +0 -1
  575. package/dist/render.d.ts +0 -24
  576. package/dist/render.d.ts.map +0 -1
  577. package/dist/render.js +0 -77
  578. package/dist/render.js.map +0 -1
  579. package/dist/stamp.d.ts +0 -29
  580. package/dist/stamp.d.ts.map +0 -1
  581. package/dist/stamp.js +0 -198
  582. package/dist/stamp.js.map +0 -1
  583. package/dist/templates/banner.d.ts +0 -9
  584. package/dist/templates/banner.d.ts.map +0 -1
  585. package/dist/templates/banner.js +0 -115
  586. package/dist/templates/banner.js.map +0 -1
  587. package/dist/templates/card.d.ts +0 -7
  588. package/dist/templates/card.d.ts.map +0 -1
  589. package/dist/templates/card.js +0 -72
  590. package/dist/templates/card.js.map +0 -1
  591. package/dist/templates/code.d.ts +0 -12
  592. package/dist/templates/code.d.ts.map +0 -1
  593. package/dist/templates/code.js +0 -275
  594. package/dist/templates/code.js.map +0 -1
  595. package/dist/templates/measure.d.ts +0 -11
  596. package/dist/templates/measure.d.ts.map +0 -1
  597. package/dist/templates/measure.js +0 -11
  598. package/dist/templates/measure.js.map +0 -1
  599. package/dist/templates/props.d.ts +0 -7
  600. package/dist/templates/props.d.ts.map +0 -1
  601. package/dist/templates/props.js +0 -17
  602. package/dist/templates/props.js.map +0 -1
  603. package/dist/templates/text.d.ts +0 -37
  604. package/dist/templates/text.d.ts.map +0 -1
  605. package/dist/templates/text.js +0 -26
  606. package/dist/templates/text.js.map +0 -1
  607. package/dist/text/stack.d.ts +0 -24
  608. package/dist/text/stack.d.ts.map +0 -1
  609. package/dist/text/stack.js +0 -18
  610. package/dist/text/stack.js.map +0 -1
  611. package/dist/text.d.ts +0 -56
  612. package/dist/text.d.ts.map +0 -1
  613. package/dist/text.js +0 -78
  614. package/dist/text.js.map +0 -1
  615. package/dist/validate/sizes.d.ts +0 -9
  616. package/dist/validate/sizes.d.ts.map +0 -1
  617. package/dist/validate/sizes.js +0 -27
  618. package/dist/validate/sizes.js.map +0 -1
  619. package/dist/validate.d.ts +0 -15
  620. package/dist/validate.d.ts.map +0 -1
  621. package/dist/validate.js +0 -300
  622. package/dist/validate.js.map +0 -1
@@ -0,0 +1,62 @@
1
+ import { optionalString } from "../../props.js";
2
+ import { codeFooter } from "../code/chrome.js";
3
+ import { blockColumns } from "../code/fit.js";
4
+ import { fitSnippet } from "../code/layout.js";
5
+ import { layoutPanel } from "../code/panel.js";
6
+ import { hugPanel, panelSvg } from "../code/plate.js";
7
+ import { codeBody } from "../code/spans.js";
8
+ import { warnIfTruncated } from "../code/warn.js";
9
+ import { charWidthRatio } from "../code/width.js";
10
+ import { hasFooter } from "../footer.js";
11
+ import { terminalSession } from "./session.js";
12
+ import { barHeight, titleBar } from "./window.js";
13
+ /**
14
+ * A command and what it printed, in a terminal window.
15
+ *
16
+ * Reads `command`, `output`, an optional `prompt` (`$` by default) and an
17
+ * optional `title` for the window bar. What separates it from the `code`
18
+ * template is the chrome: the same text on a plain panel is a snippet, and in
19
+ * a window it is something somebody ran.
20
+ *
21
+ * Almost all of it is the `code` template underneath, down to the character
22
+ * grid, the fitting and the truncation warning, so everything under
23
+ * `config.code` applies here too: the monospace family, the line height, the
24
+ * syntax theme the window takes its colours from, and the font-size bounds.
25
+ */
26
+ export const terminalTemplate = {
27
+ name: "terminal",
28
+ async render({ props, config, dimensions, measure }) {
29
+ const { width, height } = dimensions;
30
+ const footerFs = Math.round(height * 0.032);
31
+ const session = await terminalSession(props, config);
32
+ const available = layoutPanel(dimensions, config, 0, footerFs, false, hasFooter(config));
33
+ // The bar is measured against the space the window was allotted rather
34
+ // than against the window it ends up as, so that the room reserved for it
35
+ // and the bar that is drawn are the same height.
36
+ const bar = barHeight(available.width);
37
+ const fitted = fitSnippet(session, { ...available, y: available.y + bar, height: available.height - bar }, width, config, charWidthRatio(measure, config.code.fontFamily));
38
+ warnIfTruncated(config, dimensions, {
39
+ dropped: session.lines.length - fitted.lines.length,
40
+ clipped: fitted.clipped,
41
+ }, session.lines.length, "terminal session");
42
+ const body = fitted.lines.length * fitted.step;
43
+ const window = hugPanel(available, {
44
+ width: blockColumns(fitted.lines) * fitted.charWidth + fitted.padding * 2,
45
+ height: bar + body + fitted.padding * 2,
46
+ });
47
+ const shadow = Math.max(1, Math.round(Math.min(width, height) * 0.01));
48
+ return (panelSvg(window, session.background, shadow) +
49
+ titleBar(window, bar, optionalString(props.title) ?? "", config, measure) +
50
+ codeBody(fitted.lines, {
51
+ originX: window.x + fitted.padding,
52
+ originY: window.y + bar + (window.height - bar - body) / 2,
53
+ fontSize: fitted.fontSize,
54
+ charWidth: fitted.charWidth,
55
+ step: fitted.step,
56
+ fontFamily: config.code.fontFamily,
57
+ foreground: session.foreground,
58
+ }) +
59
+ codeFooter(dimensions, footerFs, config));
60
+ },
61
+ };
62
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/terminal/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAa;IACxC,IAAI,EAAE,UAAU;IAChB,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE;QACjD,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;QACrC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC;QAC5C,MAAM,OAAO,GAAG,MAAM,eAAe,CA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AAC,GAAG,IAAI,CAAC,CAAC,CAAC;QAEvE,OAAO,CACL,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC;YAC5C,QAAQ,CACN,MAAM,EACN,GAAG,EACH,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,EACjC,MAAM,EACN,OAAO,CACR;YACD,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE;gBACrB,OAAO,EAAE,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,OAAO;gBAClC,OAAO,EAAE,MAAM,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;gBAC1D,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,SAAS,EAAE,MAAM,CAAC,SAAS;gBAC3B,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU;gBAClC,UAAU,EAAE,OAAO,CAAC,UAAU;aAC/B,CAAC;YACF,UAAU,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC,CACzC,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { HighlightedCode } from "../../highlight/index.js";
2
+ import type { MetaImageProps, ResolvedConfig } from "../../types.js";
3
+ /**
4
+ * The session as one grid of lines: the commands, then what they printed.
5
+ *
6
+ * The commands go through the syntax highlighter as shell, which is what makes
7
+ * a flag look like a flag and a string look like a string. The output does
8
+ * not: it is whatever the program printed, and a shell grammar run over it
9
+ * would colour arbitrary words for reasons the reader cannot see. It is set in
10
+ * the theme's own foreground, a little faded, which is the difference a
11
+ * terminal shows between what you typed and what came back.
12
+ *
13
+ * Both are on one grid so that the whole session is fitted, clipped and drawn
14
+ * by the same code the `code` template uses.
15
+ */
16
+ export declare function terminalSession(props: MetaImageProps, config: ResolvedConfig): Promise<HighlightedCode>;
17
+ //# sourceMappingURL=session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/templates/terminal/session.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAa,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3E,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAiDrE;;;;;;;;;;;;GAYG;AACH,wBAAsB,eAAe,CACnC,KAAK,EAAE,cAAc,EACrB,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,eAAe,CAAC,CAoC1B"}
@@ -0,0 +1,86 @@
1
+ import { expandTabs, highlightCode } from "../../highlight/index.js";
2
+ import { optionalString } from "../../props.js";
3
+ /** How faint the output is against the command that produced it. */
4
+ const outputOpacity = 0.68;
5
+ /** What goes in front of a command when the post names no prompt. */
6
+ const defaultPrompt = "$";
7
+ /** One line of output: no grammar, no colour of its own, just dimmer. */
8
+ function outputLine(text, tabSize) {
9
+ return [
10
+ {
11
+ text: expandTabs(text, tabSize),
12
+ column: 0,
13
+ color: undefined,
14
+ opacity: outputOpacity,
15
+ bold: false,
16
+ italic: false,
17
+ },
18
+ ];
19
+ }
20
+ /** The prompt itself, in the site's accent colour. */
21
+ function promptToken(prompt, accent) {
22
+ return {
23
+ text: prompt,
24
+ column: 0,
25
+ color: accent,
26
+ opacity: undefined,
27
+ bold: true,
28
+ italic: false,
29
+ };
30
+ }
31
+ /** The width of the widest line, in characters. */
32
+ function widest(lines) {
33
+ let longest = 0;
34
+ for (const tokens of lines) {
35
+ const last = tokens.at(-1);
36
+ if (last !== undefined) {
37
+ longest = Math.max(longest, last.column + last.text.length);
38
+ }
39
+ }
40
+ return longest;
41
+ }
42
+ /**
43
+ * The session as one grid of lines: the commands, then what they printed.
44
+ *
45
+ * The commands go through the syntax highlighter as shell, which is what makes
46
+ * a flag look like a flag and a string look like a string. The output does
47
+ * not: it is whatever the program printed, and a shell grammar run over it
48
+ * would colour arbitrary words for reasons the reader cannot see. It is set in
49
+ * the theme's own foreground, a little faded, which is the difference a
50
+ * terminal shows between what you typed and what came back.
51
+ *
52
+ * Both are on one grid so that the whole session is fitted, clipped and drawn
53
+ * by the same code the `code` template uses.
54
+ */
55
+ export async function terminalSession(props, config) {
56
+ const prompt = optionalString(props["prompt"]) ?? defaultPrompt;
57
+ const command = optionalString(props["command"]) ?? "";
58
+ const output = optionalString(props["output"]) ?? "";
59
+ const { tabSize } = config.code;
60
+ const highlighted = await highlightCode(command, {
61
+ language: "bash",
62
+ theme: optionalString(props["theme"]) ?? config.code.theme,
63
+ tabSize,
64
+ });
65
+ // Every line of the command block gets its own prompt, since a block of them
66
+ // is a run of commands typed one after another, which is what a terminal
67
+ // shows. A blank line between two of them does not: a prompt with nothing
68
+ // after it reads as a command that was never typed.
69
+ const indent = prompt === "" ? 0 : prompt.length + 1;
70
+ const commands = highlighted.lines.map((tokens) => [
71
+ ...(indent === 0 || tokens.length === 0
72
+ ? []
73
+ : [promptToken(prompt, config.colors.brandWarm)]),
74
+ ...tokens.map((token) => ({ ...token, column: token.column + indent })),
75
+ ]);
76
+ const printed = output === ""
77
+ ? []
78
+ : output
79
+ .replaceAll("\r\n", "\n")
80
+ .replace(/\n+$/, "")
81
+ .split("\n")
82
+ .map((line) => outputLine(line, tabSize));
83
+ const lines = [...(command === "" ? [] : commands), ...printed];
84
+ return { ...highlighted, lines, longestLine: widest(lines) };
85
+ }
86
+ //# sourceMappingURL=session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.js","sourceRoot":"","sources":["../../../src/templates/terminal/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAErE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,oEAAoE;AACpE,MAAM,aAAa,GAAG,IAAI,CAAC;AAE3B,qEAAqE;AACrE,MAAM,aAAa,GAAG,GAAG,CAAC;AAE1B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CAAC;IAElD,MAAM,KAAK,GAAG,CAAC,GAAG,CAAC,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,GAAG,OAAO,CAAC,CAAC;IAEhE,OAAO,EAAE,GAAG,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;AAC/D,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { MeasureText, ResolvedConfig } from "../../types.js";
2
+ import type { Panel } from "../code/panel.js";
3
+ /** How tall the title bar is on a window of this width. */
4
+ export declare function barHeight(windowWidth: number): number;
5
+ /**
6
+ * The bar across the top of the window: a lighter band, the buttons, and the
7
+ * title in the middle of what is left.
8
+ *
9
+ * The band is white at low opacity rather than a colour of its own, so it
10
+ * lifts whatever the code theme's background happens to be instead of having
11
+ * to be chosen against it.
12
+ */
13
+ export declare function titleBar(window: Panel, height: number, title: string, config: ResolvedConfig, measure: MeasureText): string;
14
+ //# sourceMappingURL=window.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../../../src/templates/terminal/window.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAiB9C,2DAA2D;AAC3D,wBAAgB,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAErD;AAwBD;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CACtB,MAAM,EAAE,KAAK,EACb,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,WAAW,GACnB,MAAM,CA6BR"}
@@ -0,0 +1,84 @@
1
+ import { baselineFor, box, clampLine, measureIn, textElement, } from "../../layout/index.js";
2
+ /** The title bar's height, as a fraction of the window's width. */
3
+ const barScale = 0.055;
4
+ /** The buttons' diameter, as a fraction of the bar's height. */
5
+ const buttonScale = 0.26;
6
+ /**
7
+ * The three buttons, in the colours every reader has seen on a window.
8
+ *
9
+ * They are not the site's colours and are not meant to be. The point of the
10
+ * chrome is that the image is recognised as a terminal before a word of it is
11
+ * read, and these are what does the recognising.
12
+ */
13
+ const buttons = ["#ff5f57", "#febc2e", "#28c840"];
14
+ /** How tall the title bar is on a window of this width. */
15
+ export function barHeight(windowWidth) {
16
+ return Math.round(windowWidth * barScale);
17
+ }
18
+ /**
19
+ * A rectangle with its top corners rounded and its bottom ones square, which
20
+ * is the shape of a title bar sitting in the top of a rounded window.
21
+ *
22
+ * It has to be one shape rather than a rounded rectangle with a square one
23
+ * over its bottom half, which is the obvious way to do it and the wrong one:
24
+ * the band is drawn at low opacity, so anywhere the two overlapped would be
25
+ * painted twice and come out as a lighter block with a curve through it.
26
+ */
27
+ function roundedTop(rect, radius) {
28
+ const { x, y, width, height } = rect;
29
+ const r = Math.min(radius, Math.round(width / 2), height);
30
+ return (`M${String(x)} ${String(y + r)}` +
31
+ `a${String(r)} ${String(r)} 0 0 1 ${String(r)} ${String(-r)}` +
32
+ `h${String(width - r * 2)}` +
33
+ `a${String(r)} ${String(r)} 0 0 1 ${String(r)} ${String(r)}` +
34
+ `v${String(height - r)}h${String(-width)}z`);
35
+ }
36
+ /**
37
+ * The bar across the top of the window: a lighter band, the buttons, and the
38
+ * title in the middle of what is left.
39
+ *
40
+ * The band is white at low opacity rather than a colour of its own, so it
41
+ * lifts whatever the code theme's background happens to be instead of having
42
+ * to be chosen against it.
43
+ */
44
+ export function titleBar(window, height, title, config, measure) {
45
+ const { radius } = window;
46
+ const diameter = Math.round(height * buttonScale);
47
+ const gap = Math.round(diameter * 1.7);
48
+ const left = window.x + Math.round(height * 0.6);
49
+ const middle = window.y + Math.round(height / 2);
50
+ const band = `<path d="${roundedTop({ x: window.x, y: window.y, width: window.width, height }, radius)}"` +
51
+ ` fill="#ffffff" fill-opacity="0.07"/>${box({ x: window.x, y: window.y + height, width: window.width, height: 1 }, { fill: "#ffffff", fillOpacity: 0.1 })}`;
52
+ const lights = buttons
53
+ .map((fill, index) => box({
54
+ x: left + index * gap,
55
+ y: middle - Math.round(diameter / 2),
56
+ width: diameter,
57
+ height: diameter,
58
+ }, { radius: Math.round(diameter / 2), fill }))
59
+ .join("");
60
+ return band + lights + windowTitle(title, window, height, config, measure);
61
+ }
62
+ /**
63
+ * The window's title, centred in the bar. It is cut to the room between the
64
+ * buttons and the far edge, taking the buttons' width off both sides so that
65
+ * it stays centred in the bar rather than in what the buttons left.
66
+ */
67
+ function windowTitle(title, window, height, config, measure) {
68
+ if (title === "") {
69
+ return "";
70
+ }
71
+ const fontSize = Math.round(height * 0.42);
72
+ const reserved = Math.round(height * 2.4);
73
+ return textElement(clampLine(title, window.width - reserved * 2, measureIn(measure, config.fontFamily, 600), fontSize), {
74
+ x: Math.round(window.x + window.width / 2),
75
+ y: baselineFor(window.y + (height - fontSize) / 2, fontSize),
76
+ fontFamily: config.fontFamily,
77
+ fontSize,
78
+ fontWeight: 600,
79
+ fill: "#ffffff",
80
+ fillOpacity: 0.6,
81
+ anchor: "middle",
82
+ });
83
+ }
84
+ //# sourceMappingURL=window.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"window.js","sourceRoot":"","sources":["../../../src/templates/terminal/window.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,GAAG,EACH,SAAS,EACT,SAAS,EACT,WAAW,GACZ,MAAM,uBAAuB,CAAC;AAK/B,mEAAmE;AACnE,MAAM,QAAQ,GAAG,KAAK,CAAC;AAEvB,gEAAgE;AAChE,MAAM,WAAW,GAAG,IAAI,CAAC;AAEzB;;;;;;GAMG;AACH,MAAM,OAAO,GAAsB,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AAErE,2DAA2D;AAC3D,MAAM,UAAU,SAAS,CAAC,WAAmB;IAC3C,OAAO,IAAI,C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AAc,EACd,MAAsB,EACtB,OAAoB;IAEpB,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;QACjB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC;IAE1C,OAAO,WAAW,CAChB,SAAS,CACP,KAAK,EACL,MAAM,CAAC,KAAK,GAAG,QAAQ,GAAG,CAAC,EAC3B,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC,EAC1C,QAAQ,CACT,EACD;QACE,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC;QAC1C,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC;QAC5D,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,QAAQ;QACR,UAAU,EAAE,GAAG;QACf,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,GAAG;QAChB,MAAM,EAAE,QAAQ;KACjB,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The version as it is drawn, or nothing where the post named none.
3
+ *
4
+ * A `v` goes in front, since that is how a release is written down nearly
5
+ * everywhere a reader will have seen one, but only where the post has not
6
+ * written one itself. Frontmatter is hand-typed and both `1.2.0` and `v1.2.0`
7
+ * are what somebody means by the same release, so the alternative is an image
8
+ * that says `vv1.2.0`.
9
+ *
10
+ * Any leading `v` counts, not only one in front of a digit, since `vNext` and
11
+ * `v2.0` are the same kind of label and nothing here validates a version
12
+ * anyway. The cost is that a version that genuinely starts with a `v` and is
13
+ * not a prefix goes unprefixed, and no such version has ever been written.
14
+ */
15
+ export declare function versionLabel(value: unknown): string | undefined;
16
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/templates/version.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAQ/D"}
@@ -0,0 +1,23 @@
1
+ import { optionalString } from "../props.js";
2
+ /**
3
+ * The version as it is drawn, or nothing where the post named none.
4
+ *
5
+ * A `v` goes in front, since that is how a release is written down nearly
6
+ * everywhere a reader will have seen one, but only where the post has not
7
+ * written one itself. Frontmatter is hand-typed and both `1.2.0` and `v1.2.0`
8
+ * are what somebody means by the same release, so the alternative is an image
9
+ * that says `vv1.2.0`.
10
+ *
11
+ * Any leading `v` counts, not only one in front of a digit, since `vNext` and
12
+ * `v2.0` are the same kind of label and nothing here validates a version
13
+ * anyway. The cost is that a version that genuinely starts with a `v` and is
14
+ * not a prefix goes unprefixed, and no such version has ever been written.
15
+ */
16
+ export function versionLabel(value) {
17
+ const version = optionalString(value);
18
+ if (version === undefined || version === "") {
19
+ return undefined;
20
+ }
21
+ return version.startsWith("v") ? version : `v${version}`;
22
+ }
23
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/templates/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,MAAM,OAAO,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;IAEtC,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,EAAE,EAAE,CAAC;QAC5C,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,EAAE,CAAC;AAC3D,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { Template } from "../../types.js";
2
+ /**
3
+ * The logo above the name and its tagline, for a homepage or a repository
4
+ * preview: the image a project uses when the thing being shared is the project
5
+ * itself rather than a post.
6
+ *
7
+ * The mark is part of the centred group rather than pinned to the top corner
8
+ * as it is elsewhere, since here it is the subject of the image. A project
9
+ * with no logo configured gets the name and tagline alone, which is the same
10
+ * layout with nothing above it.
11
+ */
12
+ export declare const wordmarkTemplate: Template;
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/wordmark/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAmB,MAAM,gBAAgB,CAAC;AAShE;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,EAAE,QAmD9B,CAAC"}
@@ -0,0 +1,53 @@
1
+ import { linesHeight, stack } from "../../layout/index.js";
2
+ import { drawSlot, footerLine } from "../bottom.js";
3
+ import { contentArea, gapAfter, imageFrame } from "../frame.js";
4
+ import { wordmarkLines } from "./lines.js";
5
+ import { markElement, markHeight } from "./mark.js";
6
+ /** How the lines of the name and tagline are stacked. */
7
+ const lineHeight = 1.2;
8
+ /**
9
+ * The logo above the name and its tagline, for a homepage or a repository
10
+ * preview: the image a project uses when the thing being shared is the project
11
+ * itself rather than a post.
12
+ *
13
+ * The mark is part of the centred group rather than pinned to the top corner
14
+ * as it is elsewhere, since here it is the subject of the image. A project
15
+ * with no logo configured gets the name and tagline alone, which is the same
16
+ * layout with nothing above it.
17
+ */
18
+ export const wordmarkTemplate = {
19
+ name: "wordmark",
20
+ render({ props, config, dimensions, measure, logo, avatar, }) {
21
+ const { width, height } = dimensions;
22
+ const frame = imageFrame(dimensions, config, avatar, {
23
+ padScale: 0.09,
24
+ });
25
+ const area = contentArea(frame);
26
+ const lines = wordmarkLines(props, {
27
+ measure,
28
+ fontFamily: config.fontFamily,
29
+ contentWidth: area.width,
30
+ nameFs: Math.round(height * 0.11),
31
+ taglineFs: Math.round(height * 0.045),
32
+ height,
33
+ });
34
+ const mark = markHeight(logo, height);
35
+ const [markSlot, textSlot] = stack([
36
+ { size: mark },
37
+ {
38
+ size: linesHeight(lines, lineHeight),
39
+ gapBefore: gapAfter(mark, Math.round(height * 0.055)),
40
+ },
41
+ ], area);
42
+ const body = drawSlot(lines, textSlot, {
43
+ fontFamily: config.fontFamily,
44
+ fill: config.colors.foreground,
45
+ lineHeight,
46
+ anchor: "middle",
47
+ });
48
+ return (markElement(logo, markSlot) +
49
+ body +
50
+ footerLine(config, frame, width, avatar, measure, "middle"));
51
+ },
52
+ };
53
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/wordmark/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEpD,yDAAyD;AACzD,MAAM,UAAU,GAAG,GAAG,CAAC;AAEvB;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAa;IACxC,IAAI,EAAE,UAAU;IAChB,MAAM,CAAC,EACL,KAAK,EACL,MAAM,EACN,UAAU,EACV,OAAO,EACP,IAAI,EACJ,MAAM,GACU;QAChB,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;QACrC,MAAM,KAAK,GAAG,UAAU,CAAC,UAAU,EAAE,MAAM,EA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ps } from "../../types.js";
3
+ /** The space the wordmark's text has, and how to measure it into it. */
4
+ export interface WordmarkText {
5
+ readonly measure: MeasureText;
6
+ readonly fontFamily: string;
7
+ readonly contentWidth: number;
8
+ readonly nameFs: number;
9
+ readonly taglineFs: number;
10
+ readonly height: number;
11
+ }
12
+ /**
13
+ * The name, then the tagline under it.
14
+ *
15
+ * The name is one line however small that has to make it, because a product
16
+ * name broken across two stops looking like a wordmark. A scoped package name,
17
+ * which is the case this template exists for, is exactly the string that would
18
+ * otherwise be broken up: it is one long word, so wrapping it splits it
19
+ * mid-word rather than at the slash.
20
+ */
21
+ export declare function wordmarkLines(props: MetaImageProps, text: WordmarkText): TextLine[];
22
+ //# sourceMappingURL=lines.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lines.d.ts","sourceRoot":"","sources":["../../../src/templates/wordmark/lines.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAOtD,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAWlE,wEAAwE;AACxE,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAuCD;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,cAAc,EACrB,IAAI,EAAE,YAAY,GACjB,QAAQ,EAAE,CAeZ"}
@@ -0,0 +1,61 @@
1
+ import { blockLines, clampLine, measureIn, optionalString, } from "../../layout/index.js";
2
+ const maxNameLines = 1;
3
+ const maxTaglineLines = 2;
4
+ /** The weight the name is both drawn at and measured at, which have to agree. */
5
+ const nameWeight = 800;
6
+ const nameFloor = 0.45;
7
+ const taglineFloor = 0.8;
8
+ /**
9
+ * The name as one line: shrunk until it fits, and cut with an ellipsis when
10
+ * even the floor is not small enough.
11
+ *
12
+ * Wrapping is what the fitting would otherwise do at that point, and a name
13
+ * with no spaces in it wraps mid-word. A cut says the name goes on; a name
14
+ * broken across two lines looks like the name.
15
+ */
16
+ function nameLines(props, text) {
17
+ const { measure, fontFamily, contentWidth } = text;
18
+ const name = optionalString(props.title) ?? "";
19
+ const [line] = blockLines(name, measure, fontFamily, {
20
+ maxWidth: contentWidth,
21
+ maxLines: maxNameLines,
22
+ fontSize: text.nameFs,
23
+ floor: nameFloor,
24
+ fontWeight: nameWeight,
25
+ opacity: 1,
26
+ });
27
+ if (line === undefined || line.text === name) {
28
+ return line === undefined ? [] : [line];
29
+ }
30
+ return [
31
+ {
32
+ ...line,
33
+ text: clampLine(name, contentWidth, measureIn(measure, fontFamily, nameWeight), line.fontSize),
34
+ },
35
+ ];
36
+ }
37
+ /**
38
+ * The name, then the tagline under it.
39
+ *
40
+ * The name is one line however small that has to make it, because a product
41
+ * name broken across two stops looking like a wordmark. A scoped package name,
42
+ * which is the case this template exists for, is exactly the string that would
43
+ * otherwise be broken up: it is one long word, so wrapping it splits it
44
+ * mid-word rather than at the slash.
45
+ */
46
+ export function wordmarkLines(props, text) {
47
+ const { measure, fontFamily, contentWidth } = text;
48
+ return [
49
+ ...nameLines(props, text),
50
+ ...blockLines(props.subtitle, measure, fontFamily, {
51
+ maxWidth: contentWidth,
52
+ maxLines: maxTaglineLines,
53
+ fontSize: text.taglineFs,
54
+ floor: taglineFloor,
55
+ fontWeight: 500,
56
+ opacity: 0.85,
57
+ gapBefore: Math.round(text.height * 0.035),
58
+ }),
59
+ ];
60
+ }
61
+ //# sourceMappingURL=lines.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lines.js","sourceRoot":"","sources":["../../../src/templates/wordmark/lines.ts"],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AAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;IAEnD,OAAO;QACL,GAAG,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC;QACzB,GAAG,UAAU,CAAC,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE;YACjD,QAAQ,EAAE,YAAY;YACtB,QAAQ,EAAE,eAAe;YACzB,QAAQ,EAAE,IAAI,CAAC,SAAS;YACxB,KAAK,EAAE,YAAY;YACnB,UAAU,EAAE,GAAG;YACf,OAAO,EAAE,IAAI;YACb,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;SAC3C,CAAC;KACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { Rect } from "../../layout/index.js";
2
+ import type { ImageAsset } from "../../types.js";
3
+ /**
4
+ * How tall the mark is drawn, or nothing at all where the project configured
5
+ * no logo, which is what takes the mark and the gap under it out of the stack.
6
+ */
7
+ export declare function markHeight(logo: ImageAsset | undefined, imageHeight: number): number;
8
+ /**
9
+ * The mark, centred in the slot the stack gave it.
10
+ *
11
+ * Its width comes from the height it was allotted and the proportions of the
12
+ * file, as it does in the corner of every other template, so one logo works on
13
+ * a square and a landscape alike.
14
+ */
15
+ export declare function markElement(logo: ImageAsset | undefined, slot: Rect | undefined): string;
16
+ //# sourceMappingURL=mark.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mark.d.ts","sourceRoot":"","sources":["../../../src/templates/wordmark/mark.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAKjD;;;GAGG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,UAAU,GAAG,SAAS,EAC5B,WAAW,EAAE,MAAM,GAClB,MAAM,CAER;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,UAAU,GAAG,SAAS,EAC5B,IAAI,EAAE,IAAI,GAAG,SAAS,GACrB,MAAM,CAiBR"}
@@ -0,0 +1,30 @@
1
+ import { image } from "../../layout/index.js";
2
+ /** The mark's height, as a fraction of the image's. */
3
+ const markScale = 0.2;
4
+ /**
5
+ * How tall the mark is drawn, or nothing at all where the project configured
6
+ * no logo, which is what takes the mark and the gap under it out of the stack.
7
+ */
8
+ export function markHeight(logo, imageHeight) {
9
+ return logo === undefined ? 0 : Math.round(imageHeight * markScale);
10
+ }
11
+ /**
12
+ * The mark, centred in the slot the stack gave it.
13
+ *
14
+ * Its width comes from the height it was allotted and the proportions of the
15
+ * file, as it does in the corner of every other template, so one logo works on
16
+ * a square and a landscape alike.
17
+ */
18
+ export function markElement(logo, slot) {
19
+ if (logo === undefined || slot === undefined || slot.height === 0) {
20
+ return "";
21
+ }
22
+ const width = Math.round(slot.height * logo.aspect);
23
+ return image({
24
+ x: Math.round(slot.x + (slot.width - width) / 2),
25
+ y: slot.y,
26
+ width,
27
+ height: slot.height,
28
+ }, logo.href, { fit: "contain" });
29
+ }
30
+ //# sourceMappingURL=mark.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mark.js","sourceRoot":"","sources":["../../../src/templates/wordmark/mark.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAI9C,uDAAuD;AACvD,MAAM,SAAS,GAAG,GAAG,CAAC;AAEtB;;;GAGG;AACH,MAAM,UAAU,UAAU,CACxB,IAA4B,EAC5B,WAAmB;IAEnB,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,SAAS,CAAC,CAAC;AACtE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CACzB,IAA4B,EAC5B,IAAsB;IAEtB,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAClE,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;IAEpD,OAAO,KAAK,CACV;QACE,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;QAChD,CAAC,EAAE,IAAI,CAAC,CAAC;QACT,KAAK;QACL,MAAM,EAAE,IAAI,CAAC,MAAM;KACpB,EACD,IAAI,CAAC,IAAI,EACT,EAAE,GAAG,EAAE,SAAS,EAAE,CACnB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { MeasureAt } from "./fit.js";
2
+ /**
3
+ * Cut one line to the width it has, marking the cut with an ellipsis.
4
+ *
5
+ * This is what a line that may not wrap does instead of wrapping: a bullet in
6
+ * a list of changes, a breadcrumb, a window title. Shrinking is the better
7
+ * answer wherever there is room for it, which is what `fitText` is for and why
8
+ * most text goes through that instead. A line set alongside others at the same
9
+ * size cannot shrink on its own without looking like a mistake.
10
+ */
11
+ export declare function clampLine(text: string, maxWidth: number, measure: MeasureAt, fontSize: number): string;
12
+ //# sourceMappingURL=clamp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clamp.d.ts","sourceRoot":"","sources":["../../src/text/clamp.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,SAAS,EAClB,QAAQ,EAAE,MAAM,GACf,MAAM,CA8BR"}
@@ -0,0 +1,41 @@
1
+ import { ellipsis } from "./ellipsis.js";
2
+ /**
3
+ * Cut one line to the width it has, marking the cut with an ellipsis.
4
+ *
5
+ * This is what a line that may not wrap does instead of wrapping: a bullet in
6
+ * a list of changes, a breadcrumb, a window title. Shrinking is the better
7
+ * answer wherever there is room for it, which is what `fitText` is for and why
8
+ * most text goes through that instead. A line set alongside others at the same
9
+ * size cannot shrink on its own without looking like a mistake.
10
+ */
11
+ export function clampLine(text, maxWidth, measure, fontSize) {
12
+ const full = measure(text, fontSize);
13
+ if (full <= maxWidth || text === "") {
14
+ return text;
15
+ }
16
+ const isWithin = (length) => measure(text.slice(0, length) + ellipsis, fontSize) <= maxWidth;
17
+ // Start from what the width would be if every character were as wide as the
18
+ // average, then walk to the real answer. A proportional face makes that a
19
+ // guess rather than a result, so it is corrected in both directions. The
20
+ // floor of nought is what stops a caller with no room left, which is a width
21
+ // that has come out negative, reaching `slice` with a negative length and
22
+ // being cut from the wrong end.
23
+ let kept = Math.max(0, Math.min(text.length, Math.floor((text.length * maxWidth) / full)));
24
+ while (kept < text.length && isWithin(kept + 1)) {
25
+ kept += 1;
26
+ }
27
+ while (kept > 0 && !isWithin(kept)) {
28
+ kept -= 1;
29
+ }
30
+ return withoutSplitPair(text.slice(0, kept)).trimEnd() + ellipsis;
31
+ }
32
+ /**
33
+ * Drop a trailing lone surrogate, which is what cutting by string index does
34
+ * to a character outside the basic plane: an emoji in a changelog entry is two
35
+ * units long, and half of one is not a character at all. Escaping it would put
36
+ * an unpaired surrogate in the document.
37
+ */
38
+ function withoutSplitPair(text) {
39
+ return /[\uD800-\uDBFF]$/.test(text) ? text.slice(0, -1) : text;
40
+ }
41
+ //# sourceMappingURL=clamp.js.map