@kensio/colophon 2.3.0 → 2.5.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 (361) hide show
  1. package/README.md +107 -798
  2. package/dist/background/gradient.d.ts +12 -0
  3. package/dist/background/gradient.d.ts.map +1 -0
  4. package/dist/background/gradient.js +21 -0
  5. package/dist/background/gradient.js.map +1 -0
  6. package/dist/background/image.d.ts +14 -0
  7. package/dist/background/image.d.ts.map +1 -0
  8. package/dist/background/image.js +36 -0
  9. package/dist/background/image.js.map +1 -0
  10. package/dist/background/index.d.ts +13 -0
  11. package/dist/background/index.d.ts.map +1 -0
  12. package/dist/background/index.js +27 -0
  13. package/dist/background/index.js.map +1 -0
  14. package/dist/background/mesh.d.ts +12 -0
  15. package/dist/background/mesh.d.ts.map +1 -0
  16. package/dist/background/mesh.js +43 -0
  17. package/dist/background/mesh.js.map +1 -0
  18. package/dist/background.d.ts +7 -2
  19. package/dist/background.d.ts.map +1 -1
  20. package/dist/background.js +44 -1
  21. package/dist/background.js.map +1 -1
  22. package/dist/cli/args.d.ts +1 -1
  23. package/dist/cli/args.d.ts.map +1 -1
  24. package/dist/cli/args.js +1 -1
  25. package/dist/cli/config.d.ts +1 -1
  26. package/dist/cli/config.js +1 -1
  27. package/dist/config/defaults.d.ts +8 -7
  28. package/dist/config/defaults.d.ts.map +1 -1
  29. package/dist/config/defaults.js +8 -8
  30. package/dist/config/defaults.js.map +1 -1
  31. package/dist/config/index.d.ts +1 -1
  32. package/dist/config/index.d.ts.map +1 -1
  33. package/dist/config/index.js +14 -5
  34. package/dist/config/index.js.map +1 -1
  35. package/dist/config/resolve.d.ts +7 -0
  36. package/dist/config/resolve.d.ts.map +1 -1
  37. package/dist/config/resolve.js +16 -0
  38. package/dist/config/resolve.js.map +1 -1
  39. package/dist/config/size.d.ts +7 -1
  40. package/dist/config/size.d.ts.map +1 -1
  41. package/dist/config/size.js +22 -9
  42. package/dist/config/size.js.map +1 -1
  43. package/dist/content/props.d.ts +2 -2
  44. package/dist/content/props.js +2 -2
  45. package/dist/content/slug.d.ts +5 -5
  46. package/dist/content/slug.js +6 -6
  47. package/dist/content/slug.js.map +1 -1
  48. package/dist/content/walk.d.ts +1 -1
  49. package/dist/content/walk.js +1 -1
  50. package/dist/fonts/index.d.ts +3 -2
  51. package/dist/fonts/index.d.ts.map +1 -1
  52. package/dist/fonts/index.js +3 -2
  53. package/dist/fonts/index.js.map +1 -1
  54. package/dist/fonts/resolve.js +1 -1
  55. package/dist/generate/extra.js +4 -4
  56. package/dist/generate/extra.js.map +1 -1
  57. package/dist/generate/options.d.ts +1 -1
  58. package/dist/generate/outputs.d.ts +4 -4
  59. package/dist/generate/outputs.js +4 -4
  60. package/dist/highlight/language.d.ts +2 -3
  61. package/dist/highlight/language.d.ts.map +1 -1
  62. package/dist/highlight/language.js +3 -4
  63. package/dist/highlight/language.js.map +1 -1
  64. package/dist/highlight/normalise.d.ts +2 -2
  65. package/dist/highlight/normalise.js +2 -2
  66. package/dist/image/index.d.ts +18 -0
  67. package/dist/image/index.d.ts.map +1 -0
  68. package/dist/image/index.js +42 -0
  69. package/dist/image/index.js.map +1 -0
  70. package/dist/image/jpeg.d.ts +10 -0
  71. package/dist/image/jpeg.d.ts.map +1 -0
  72. package/dist/image/jpeg.js +57 -0
  73. package/dist/image/jpeg.js.map +1 -0
  74. package/dist/image/load.d.ts +4 -0
  75. package/dist/image/load.d.ts.map +1 -0
  76. package/dist/image/load.js +60 -0
  77. package/dist/image/load.js.map +1 -0
  78. package/dist/image/media.d.ts +10 -0
  79. package/dist/image/media.d.ts.map +1 -0
  80. package/dist/image/media.js +37 -0
  81. package/dist/image/media.js.map +1 -0
  82. package/dist/image/resolve.d.ts +13 -0
  83. package/dist/image/resolve.d.ts.map +1 -0
  84. package/dist/image/resolve.js +38 -0
  85. package/dist/image/resolve.js.map +1 -0
  86. package/dist/image/size.d.ts +22 -0
  87. package/dist/image/size.d.ts.map +1 -0
  88. package/dist/image/size.js +60 -0
  89. package/dist/image/size.js.map +1 -0
  90. package/dist/image/svg.d.ts +12 -0
  91. package/dist/image/svg.d.ts.map +1 -0
  92. package/dist/image/svg.js +61 -0
  93. package/dist/image/svg.js.map +1 -0
  94. package/dist/image/uri.d.ts +9 -0
  95. package/dist/image/uri.d.ts.map +1 -0
  96. package/dist/image/uri.js +22 -0
  97. package/dist/image/uri.js.map +1 -0
  98. package/dist/index.d.ts +8 -3
  99. package/dist/index.d.ts.map +1 -1
  100. package/dist/index.js +7 -2
  101. package/dist/index.js.map +1 -1
  102. package/dist/layout/block.d.ts +37 -0
  103. package/dist/layout/block.d.ts.map +1 -0
  104. package/dist/layout/block.js +26 -0
  105. package/dist/layout/block.js.map +1 -0
  106. package/dist/layout/box.d.ts +20 -0
  107. package/dist/layout/box.d.ts.map +1 -0
  108. package/dist/layout/box.js +61 -0
  109. package/dist/layout/box.js.map +1 -0
  110. package/dist/layout/distribute.d.ts +15 -0
  111. package/dist/layout/distribute.d.ts.map +1 -0
  112. package/dist/layout/distribute.js +30 -0
  113. package/dist/layout/distribute.js.map +1 -0
  114. package/dist/layout/image.d.ts +42 -0
  115. package/dist/layout/image.d.ts.map +1 -0
  116. package/dist/layout/image.js +34 -0
  117. package/dist/layout/image.js.map +1 -0
  118. package/dist/layout/index.d.ts +40 -0
  119. package/dist/layout/index.d.ts.map +1 -0
  120. package/dist/layout/index.js +30 -0
  121. package/dist/layout/index.js.map +1 -0
  122. package/dist/layout/lines.d.ts +45 -0
  123. package/dist/layout/lines.d.ts.map +1 -0
  124. package/dist/layout/lines.js +71 -0
  125. package/dist/layout/lines.js.map +1 -0
  126. package/dist/layout/measure.d.ts +11 -0
  127. package/dist/layout/measure.d.ts.map +1 -0
  128. package/dist/layout/measure.js +11 -0
  129. package/dist/layout/measure.js.map +1 -0
  130. package/dist/layout/panel.d.ts +20 -0
  131. package/dist/layout/panel.d.ts.map +1 -0
  132. package/dist/layout/panel.js +22 -0
  133. package/dist/layout/panel.js.map +1 -0
  134. package/dist/layout/row.d.ts +15 -0
  135. package/dist/layout/row.d.ts.map +1 -0
  136. package/dist/layout/row.js +20 -0
  137. package/dist/layout/row.js.map +1 -0
  138. package/dist/layout/scrim.d.ts +23 -0
  139. package/dist/layout/scrim.d.ts.map +1 -0
  140. package/dist/layout/scrim.js +38 -0
  141. package/dist/layout/scrim.js.map +1 -0
  142. package/dist/layout/stack.d.ts +14 -0
  143. package/dist/layout/stack.d.ts.map +1 -0
  144. package/dist/layout/stack.js +19 -0
  145. package/dist/layout/stack.js.map +1 -0
  146. package/dist/layout/types.d.ts +49 -0
  147. package/dist/layout/types.d.ts.map +1 -0
  148. package/dist/layout/types.js +2 -0
  149. package/dist/layout/types.js.map +1 -0
  150. package/dist/manifest/build.d.ts +1 -1
  151. package/dist/manifest/build.js +1 -1
  152. package/dist/manifest/index.d.ts +1 -1
  153. package/dist/manifest/index.js +1 -1
  154. package/dist/manifest/order.d.ts +1 -1
  155. package/dist/manifest/order.js +1 -1
  156. package/dist/manifest/page.d.ts +2 -2
  157. package/dist/manifest/page.js +3 -3
  158. package/dist/measure/estimate.d.ts +10 -0
  159. package/dist/measure/estimate.d.ts.map +1 -0
  160. package/dist/measure/estimate.js +58 -0
  161. package/dist/measure/estimate.js.map +1 -0
  162. package/dist/measure/faces.d.ts +15 -0
  163. package/dist/measure/faces.d.ts.map +1 -0
  164. package/dist/measure/faces.js +70 -0
  165. package/dist/measure/faces.js.map +1 -0
  166. package/dist/measure/index.d.ts +16 -0
  167. package/dist/measure/index.d.ts.map +1 -0
  168. package/dist/measure/index.js +0 -0
  169. package/dist/measure/index.js.map +1 -0
  170. package/dist/measure/runs.d.ts +17 -0
  171. package/dist/measure/runs.d.ts.map +1 -0
  172. package/dist/measure/runs.js +39 -0
  173. package/dist/measure/runs.js.map +1 -0
  174. package/dist/measure/select.d.ts +13 -0
  175. package/dist/measure/select.d.ts.map +1 -0
  176. package/dist/measure/select.js +47 -0
  177. package/dist/measure/select.js.map +1 -0
  178. package/dist/meta/tags.d.ts +6 -6
  179. package/dist/meta/tags.js +6 -6
  180. package/dist/meta/url.d.ts +4 -4
  181. package/dist/meta/url.js +4 -4
  182. package/dist/placement/check.d.ts +1 -1
  183. package/dist/placement/check.js +1 -1
  184. package/dist/placement/index.js +1 -1
  185. package/dist/placement/relative.d.ts +3 -3
  186. package/dist/placement/relative.js +3 -3
  187. package/dist/pool.d.ts +2 -2
  188. package/dist/pool.js +3 -3
  189. package/dist/pool.js.map +1 -1
  190. package/dist/props.d.ts +7 -0
  191. package/dist/props.d.ts.map +1 -0
  192. package/dist/props.js +17 -0
  193. package/dist/props.js.map +1 -0
  194. package/dist/render/svg.d.ts +4 -2
  195. package/dist/render/svg.d.ts.map +1 -1
  196. package/dist/render/svg.js +28 -6
  197. package/dist/render/svg.js.map +1 -1
  198. package/dist/stamp/config-digest.d.ts.map +1 -1
  199. package/dist/stamp/config-digest.js +21 -1
  200. package/dist/stamp/config-digest.js.map +1 -1
  201. package/dist/stamp/index.js +2 -2
  202. package/dist/stamp/index.js.map +1 -1
  203. package/dist/stamp/read.d.ts +1 -1
  204. package/dist/stamp/read.js +4 -4
  205. package/dist/templates/attribution.d.ts +17 -0
  206. package/dist/templates/attribution.d.ts.map +1 -0
  207. package/dist/templates/attribution.js +39 -0
  208. package/dist/templates/attribution.js.map +1 -0
  209. package/dist/templates/banner/badge-props.d.ts +16 -0
  210. package/dist/templates/banner/badge-props.d.ts.map +1 -0
  211. package/dist/templates/banner/badge-props.js +58 -0
  212. package/dist/templates/banner/badge-props.js.map +1 -0
  213. package/dist/templates/banner/badge.d.ts.map +1 -1
  214. package/dist/templates/banner/badge.js +3 -6
  215. package/dist/templates/banner/badge.js.map +1 -1
  216. package/dist/templates/banner/index.d.ts +3 -0
  217. package/dist/templates/banner/index.d.ts.map +1 -1
  218. package/dist/templates/banner/index.js +41 -37
  219. package/dist/templates/banner/index.js.map +1 -1
  220. package/dist/templates/banner/lines.d.ts +7 -12
  221. package/dist/templates/banner/lines.d.ts.map +1 -1
  222. package/dist/templates/banner/lines.js +23 -34
  223. package/dist/templates/banner/lines.js.map +1 -1
  224. package/dist/templates/banner/version.d.ts +9 -0
  225. package/dist/templates/banner/version.d.ts.map +1 -0
  226. package/dist/templates/banner/version.js +21 -0
  227. package/dist/templates/banner/version.js.map +1 -0
  228. package/dist/templates/card/index.d.ts +4 -1
  229. package/dist/templates/card/index.d.ts.map +1 -1
  230. package/dist/templates/card/index.js +37 -25
  231. package/dist/templates/card/index.js.map +1 -1
  232. package/dist/templates/card/lines.d.ts +17 -13
  233. package/dist/templates/card/lines.d.ts.map +1 -1
  234. package/dist/templates/card/lines.js +24 -20
  235. package/dist/templates/card/lines.js.map +1 -1
  236. package/dist/templates/code/chrome.d.ts +7 -3
  237. package/dist/templates/code/chrome.d.ts.map +1 -1
  238. package/dist/templates/code/chrome.js +12 -11
  239. package/dist/templates/code/chrome.js.map +1 -1
  240. package/dist/templates/code/clip.d.ts +1 -1
  241. package/dist/templates/code/clip.js +1 -1
  242. package/dist/templates/code/fit.d.ts +2 -2
  243. package/dist/templates/code/fit.d.ts.map +1 -1
  244. package/dist/templates/code/fit.js +4 -4
  245. package/dist/templates/code/fit.js.map +1 -1
  246. package/dist/templates/code/index.d.ts.map +1 -1
  247. package/dist/templates/code/index.js +7 -6
  248. package/dist/templates/code/index.js.map +1 -1
  249. package/dist/templates/code/layout.d.ts +1 -1
  250. package/dist/templates/code/layout.d.ts.map +1 -1
  251. package/dist/templates/code/layout.js +6 -6
  252. package/dist/templates/code/layout.js.map +1 -1
  253. package/dist/templates/code/panel.d.ts +13 -0
  254. package/dist/templates/code/panel.d.ts.map +1 -1
  255. package/dist/templates/code/panel.js +34 -2
  256. package/dist/templates/code/panel.js.map +1 -1
  257. package/dist/templates/code/plate.d.ts +3 -1
  258. package/dist/templates/code/plate.d.ts.map +1 -1
  259. package/dist/templates/code/plate.js +11 -9
  260. package/dist/templates/code/plate.js.map +1 -1
  261. package/dist/templates/code/spans.js +1 -1
  262. package/dist/templates/code/spans.js.map +1 -1
  263. package/dist/templates/code/width.d.ts +10 -0
  264. package/dist/templates/code/width.d.ts.map +1 -0
  265. package/dist/templates/code/width.js +26 -0
  266. package/dist/templates/code/width.js.map +1 -0
  267. package/dist/templates/footer.d.ts +8 -0
  268. package/dist/templates/footer.d.ts.map +1 -1
  269. package/dist/templates/footer.js +11 -1
  270. package/dist/templates/footer.js.map +1 -1
  271. package/dist/templates/index.d.ts +1 -1
  272. package/dist/templates/index.d.ts.map +1 -1
  273. package/dist/templates/index.js +1 -1
  274. package/dist/templates/index.js.map +1 -1
  275. package/dist/templates/logo.d.ts +15 -0
  276. package/dist/templates/logo.d.ts.map +1 -0
  277. package/dist/templates/logo.js +30 -0
  278. package/dist/templates/logo.js.map +1 -0
  279. package/dist/templates/measure.d.ts +11 -0
  280. package/dist/templates/measure.d.ts.map +1 -0
  281. package/dist/templates/measure.js +11 -0
  282. package/dist/templates/measure.js.map +1 -0
  283. package/dist/templates/props.d.ts +2 -2
  284. package/dist/templates/props.js +2 -2
  285. package/dist/templates/text.d.ts +37 -0
  286. package/dist/templates/text.d.ts.map +1 -0
  287. package/dist/templates/text.js +26 -0
  288. package/dist/templates/text.js.map +1 -0
  289. package/dist/text/break.d.ts +11 -0
  290. package/dist/text/break.d.ts.map +1 -0
  291. package/dist/text/break.js +30 -0
  292. package/dist/text/break.js.map +1 -0
  293. package/dist/text/fit.d.ts +30 -0
  294. package/dist/text/fit.d.ts.map +1 -0
  295. package/dist/text/fit.js +29 -0
  296. package/dist/text/fit.js.map +1 -0
  297. package/dist/text/index.d.ts +5 -3
  298. package/dist/text/index.d.ts.map +1 -1
  299. package/dist/text/index.js +3 -2
  300. package/dist/text/index.js.map +1 -1
  301. package/dist/text/wrap.d.ts +17 -7
  302. package/dist/text/wrap.d.ts.map +1 -1
  303. package/dist/text/wrap.js +25 -17
  304. package/dist/text/wrap.js.map +1 -1
  305. package/dist/texture/grain.d.ts +17 -0
  306. package/dist/texture/grain.d.ts.map +1 -0
  307. package/dist/texture/grain.js +29 -0
  308. package/dist/texture/grain.js.map +1 -0
  309. package/dist/texture/index.d.ts +11 -0
  310. package/dist/texture/index.d.ts.map +1 -0
  311. package/dist/texture/index.js +20 -0
  312. package/dist/texture/index.js.map +1 -0
  313. package/dist/texture/pattern.d.ts +17 -0
  314. package/dist/texture/pattern.d.ts.map +1 -0
  315. package/dist/texture/pattern.js +45 -0
  316. package/dist/texture/pattern.js.map +1 -0
  317. package/dist/texture/resolve.d.ts +16 -0
  318. package/dist/texture/resolve.d.ts.map +1 -0
  319. package/dist/texture/resolve.js +20 -0
  320. package/dist/texture/resolve.js.map +1 -0
  321. package/dist/theme/index.d.ts +27 -0
  322. package/dist/theme/index.d.ts.map +1 -0
  323. package/dist/theme/index.js +41 -0
  324. package/dist/theme/index.js.map +1 -0
  325. package/dist/theme/presets.d.ts +38 -0
  326. package/dist/theme/presets.d.ts.map +1 -0
  327. package/dist/theme/presets.js +150 -0
  328. package/dist/theme/presets.js.map +1 -0
  329. package/dist/types.d.ts +281 -46
  330. package/dist/types.d.ts.map +1 -1
  331. package/dist/validate/background.d.ts +12 -0
  332. package/dist/validate/background.d.ts.map +1 -0
  333. package/dist/validate/background.js +53 -0
  334. package/dist/validate/background.js.map +1 -0
  335. package/dist/validate/collect.d.ts +9 -0
  336. package/dist/validate/collect.d.ts.map +1 -0
  337. package/dist/validate/collect.js +34 -0
  338. package/dist/validate/collect.js.map +1 -0
  339. package/dist/validate/index.d.ts +1 -1
  340. package/dist/validate/index.d.ts.map +1 -1
  341. package/dist/validate/index.js +3 -20
  342. package/dist/validate/index.js.map +1 -1
  343. package/dist/validate/keys.d.ts +35 -2
  344. package/dist/validate/keys.d.ts.map +1 -1
  345. package/dist/validate/keys.js +92 -3
  346. package/dist/validate/keys.js.map +1 -1
  347. package/dist/validate/overrides.d.ts.map +1 -1
  348. package/dist/validate/overrides.js +5 -1
  349. package/dist/validate/overrides.js.map +1 -1
  350. package/dist/validate/suggest.d.ts.map +1 -1
  351. package/dist/validate/suggest.js +21 -3
  352. package/dist/validate/suggest.js.map +1 -1
  353. package/dist/validate/texture.d.ts +11 -0
  354. package/dist/validate/texture.d.ts.map +1 -0
  355. package/dist/validate/texture.js +34 -0
  356. package/dist/validate/texture.js.map +1 -0
  357. package/dist/validate/values.d.ts +10 -10
  358. package/dist/validate/values.d.ts.map +1 -1
  359. package/dist/validate/values.js +21 -31
  360. package/dist/validate/values.js.map +1 -1
  361. package/package.json +7 -1
@@ -0,0 +1,12 @@
1
+ import type { Background, Dimensions } from "../types.js";
2
+ /**
3
+ * A linear gradient across the whole image: a `<defs>` block holding the
4
+ * gradient under the given `id`, and a rect filled with it.
5
+ *
6
+ * The coordinates are object-bounding-box units, so the default runs corner to
7
+ * corner whatever the image's proportions are.
8
+ */
9
+ export declare function gradientBackground(background: Extract<Background, {
10
+ readonly type: "gradient";
11
+ }>, dimensions: Dimensions, id: string): string;
12
+ //# sourceMappingURL=gradient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gradient.d.ts","sourceRoot":"","sources":["../../src/background/gradient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE1D;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,EAC9D,UAAU,EAAE,UAAU,EACtB,EAAE,EAAE,MAAM,GACT,MAAM,CAgBR"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * A linear gradient across the whole image: a `<defs>` block holding the
3
+ * gradient under the given `id`, and a rect filled with it.
4
+ *
5
+ * The coordinates are object-bounding-box units, so the default runs corner to
6
+ * corner whatever the image's proportions are.
7
+ */
8
+ export function gradientBackground(background, dimensions, id) {
9
+ const { width, height } = dimensions;
10
+ const from = background.from ?? { x: 0, y: 0 };
11
+ const to = background.to ?? { x: 1, y: 1 };
12
+ const stops = background.stops
13
+ .map((stop) => `<stop offset="${stop.offset}" stop-color="${stop.color}"/>`)
14
+ .join("");
15
+ return (`<defs>` +
16
+ `<linearGradient id="${id}" x1="${String(from.x)}" y1="${String(from.y)}"` +
17
+ ` x2="${String(to.x)}" y2="${String(to.y)}">${stops}</linearGradient>` +
18
+ `</defs>` +
19
+ `<rect width="${String(width)}" height="${String(height)}" fill="url(#${id})"/>`);
20
+ }
21
+ //# sourceMappingURL=gradient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gradient.js","sourceRoot":"","sources":["../../src/background/gradient.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAChC,UAA8D,EAC9D,UAAsB,EACtB,EAAU;IAEV,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;IACrC,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IAC/C,MAAM,EAAE,GAAG,UAAU,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IAE3C,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK;SAC3B,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,iBAAiB,IAAI,CAAC,MAAM,iBAAiB,IAAI,CAAC,KAAK,KAAK,CAAC;SAC3E,IAAI,CAAC,EAAE,CAAC,CAAC;IAEZ,OAAO,CACL,QAAQ;QACR,uBAAuB,EAAE,SAAS,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG;QAC1E,QAAQ,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,mBAAmB;QACtE,SAAS;QACT,gBAAgB,MAAM,CAAC,KAAK,CAAC,aAAa,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,CACjF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { Rect } from "../layout/index.js";
2
+ import type { Background, ImageAsset } from "../types.js";
3
+ /**
4
+ * A photograph behind the text: the backdrop, the picture, and the wash over
5
+ * it that keeps the text readable.
6
+ *
7
+ * The scrim is on by default and has to be turned off rather than on. Text
8
+ * over an unshaded photo is the failure this would otherwise ship with, and it
9
+ * is not one an author notices unless they look at every image.
10
+ */
11
+ export declare function imageBackground(background: Extract<Background, {
12
+ readonly type: "image";
13
+ }>, area: Rect, id: string, asset: ImageAsset | undefined): string;
14
+ //# sourceMappingURL=image.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../src/background/image.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAS,MAAM,aAAa,CAAC;AAgBjE;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,EAC3D,IAAI,EAAE,IAAI,EACV,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,UAAU,GAAG,SAAS,GAC5B,MAAM,CAkBR"}
@@ -0,0 +1,36 @@
1
+ import { box, image as imageElement, scrim } from "../layout/index.js";
2
+ /** Behind a background image, and either side of one that is `contain`ed. */
3
+ const defaultBackdrop = "#000000";
4
+ /**
5
+ * How heavily the default scrim shades, top and bottom.
6
+ *
7
+ * It starts at a quarter rather than at nothing, because a template is free to
8
+ * put its text anywhere and a wash that only darkens the bottom leaves a
9
+ * centred title sitting on whatever the middle of the photograph happens to
10
+ * be. Shading the whole picture a little and the bottom a lot covers both, and
11
+ * a project that wants the picture untouched at the top sets `from: 0`.
12
+ */
13
+ const defaultScrim = { from: 0.25, to: 0.65 };
14
+ /**
15
+ * A photograph behind the text: the backdrop, the picture, and the wash over
16
+ * it that keeps the text readable.
17
+ *
18
+ * The scrim is on by default and has to be turned off rather than on. Text
19
+ * over an unshaded photo is the failure this would otherwise ship with, and it
20
+ * is not one an author notices unless they look at every image.
21
+ */
22
+ export function imageBackground(background, area, id, asset) {
23
+ const backdrop = box(area, { fill: background.color ?? defaultBackdrop });
24
+ if (asset === undefined) {
25
+ return backdrop;
26
+ }
27
+ const shade = background.scrim ?? {};
28
+ return (backdrop +
29
+ imageElement(area, asset.href, { fit: background.fit ?? "cover" }) +
30
+ scrim(area, `${id}-scrim`, {
31
+ ...(shade.color !== undefined && { color: shade.color }),
32
+ from: shade.from ?? defaultScrim.from,
33
+ to: shade.to ?? defaultScrim.to,
34
+ }));
35
+ }
36
+ //# sourceMappingURL=image.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image.js","sourceRoot":"","sources":["../../src/background/image.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,KAAK,IAAI,YAAY,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAGvE,6EAA6E;AAC7E,MAAM,eAAe,GAAG,SAAS,CAAC;AAElC;;;;;;;;GAQG;AACH,MAAM,YAAY,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AAE9C;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAC7B,UAA2D,EAC3D,IAAU,EACV,EAAU,EACV,KAA6B;IAE7B,MAAM,QAAQ,GAAG,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,UAAU,CAAC,KAAK,IAAI,eAAe,EAAE,CAAC,CAAC;IAE1E,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,MAAM,KAAK,GAAU,UAAU,CAAC,KAAK,IAAI,EAAE,CAAC;IAE5C,OAAO,CACL,QAAQ;QACR,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,UAAU,CAAC,GAAG,IAAI,OAAO,EAAE,CAAC;QAClE,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE;YACzB,GAAG,CAAC,KAAK,CAAC,KAAK,KAAK,SAAS,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;YACxD,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,YAAY,CAAC,IAAI;YACrC,EAAE,EAAE,KAAK,CAAC,EAAE,IAAI,YAAY,CAAC,EAAE;SAChC,CAAC,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { Background, Dimensions, ImageAsset } from "../types.js";
2
+ /**
3
+ * Render a full-bleed background as SVG. Gradients and meshes emit a `<defs>`
4
+ * block naming their fills after the given `id`, followed by the rects that
5
+ * use them; a solid colour is just the rect.
6
+ *
7
+ * A background image has to be read before it can be drawn, which is the
8
+ * renderer's job. Called without one, an image background is the colour behind
9
+ * it, so a caller assembling an SVG by hand gets a plain image rather than a
10
+ * reference to something that is not there.
11
+ */
12
+ export declare function backgroundSvg(background: Background, dimensions: Dimensions, id: string, asset?: ImageAsset): string;
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/background/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAKtE;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC3B,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,EACtB,EAAE,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,UAAU,GACjB,MAAM,CAqBR"}
@@ -0,0 +1,27 @@
1
+ import { gradientBackground } from "./gradient.js";
2
+ import { imageBackground } from "./image.js";
3
+ import { meshBackground } from "./mesh.js";
4
+ /**
5
+ * Render a full-bleed background as SVG. Gradients and meshes emit a `<defs>`
6
+ * block naming their fills after the given `id`, followed by the rects that
7
+ * use them; a solid colour is just the rect.
8
+ *
9
+ * A background image has to be read before it can be drawn, which is the
10
+ * renderer's job. Called without one, an image background is the colour behind
11
+ * it, so a caller assembling an SVG by hand gets a plain image rather than a
12
+ * reference to something that is not there.
13
+ */
14
+ export function backgroundSvg(background, dimensions, id, asset) {
15
+ const { width, height } = dimensions;
16
+ if (background.type === "solid") {
17
+ return `<rect width="${String(width)}" height="${String(height)}" fill="${background.color}"/>`;
18
+ }
19
+ if (background.type === "image") {
20
+ return imageBackground(background, { x: 0, y: 0, width, height }, id, asset);
21
+ }
22
+ if (background.type === "mesh") {
23
+ return meshBackground(background, dimensions, id);
24
+ }
25
+ return gradientBackground(background, dimensions, id);
26
+ }
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/background/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa,CAC3B,UAAsB,EACtB,UAAsB,EACtB,EAAU,EACV,KAAkB;IAElB,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;IAErC,IAAI,UAAU,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAChC,OAAO,gBAAgB,MAAM,CAAC,KAAK,CAAC,aAAa,MAAM,CAAC,MAAM,CAAC,WAAW,UAAU,CAAC,KAAK,KAAK,CAAC;IAClG,CAAC;IAED,IAAI,UAAU,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAChC,OAAO,eAAe,CACpB,UAAU,EACV,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAC7B,EAAE,EACF,KAAK,CACN,CAAC;IACJ,CAAC;IAED,IAAI,UAAU,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QAC/B,OAAO,cAAc,CAAC,UAAU,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC;IACpD,CAAC;IAED,OAAO,kBAAkB,CAAC,UAAU,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC;AACxD,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { Background, Dimensions } from "../types.js";
2
+ /**
3
+ * Soft blobs of colour over a flat base, which is what a linear gradient
4
+ * cannot do: colour that moves in more than one direction at once.
5
+ *
6
+ * Every blob covers the whole image and is mostly transparent, so they are
7
+ * drawn in the order they were given and the later ones sit over the earlier.
8
+ */
9
+ export declare function meshBackground(background: Extract<Background, {
10
+ readonly type: "mesh";
11
+ }>, dimensions: Dimensions, id: string): string;
12
+ //# sourceMappingURL=mesh.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mesh.d.ts","sourceRoot":"","sources":["../../src/background/mesh.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAY,MAAM,aAAa,CAAC;AAsCpE;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,EAC1D,UAAU,EAAE,UAAU,EACtB,EAAE,EAAE,MAAM,GACT,MAAM,CAYR"}
@@ -0,0 +1,43 @@
1
+ /** Radius of a blob that does not name one, as a fraction of the longer side. */
2
+ const defaultRadius = 0.7;
3
+ /**
4
+ * One blob: a radial fade from its colour to nothing, and a rect filled with
5
+ * it. A rect rather than a circle because the fade reaches the edge of the
6
+ * image on at least one side of most blobs, and a circle would clip it there.
7
+ *
8
+ * The gradient is in user space rather than in bounding-box units, so the fade
9
+ * stays circular. In bounding-box units it would take the proportions of the
10
+ * rect it fills, which is the whole image, and a landscape image would stretch
11
+ * every blob into an ellipse.
12
+ */
13
+ function blobSvg(blob, dimensions, id) {
14
+ const { width, height } = dimensions;
15
+ const radius = (blob.radius ?? defaultRadius) * Math.max(width, height);
16
+ const opacity = blob.opacity ?? 1;
17
+ const def = `<radialGradient id="${id}" gradientUnits="userSpaceOnUse"` +
18
+ ` cx="${String((blob.x ?? 0.5) * width)}"` +
19
+ ` cy="${String((blob.y ?? 0.5) * height)}" r="${String(radius)}">` +
20
+ `<stop offset="0%" stop-color="${blob.color}" stop-opacity="${String(opacity)}"/>` +
21
+ `<stop offset="100%" stop-color="${blob.color}" stop-opacity="0"/>` +
22
+ `</radialGradient>`;
23
+ return {
24
+ def,
25
+ rect: `<rect width="${String(width)}" height="${String(height)}" fill="url(#${id})"/>`,
26
+ };
27
+ }
28
+ /**
29
+ * Soft blobs of colour over a flat base, which is what a linear gradient
30
+ * cannot do: colour that moves in more than one direction at once.
31
+ *
32
+ * Every blob covers the whole image and is mostly transparent, so they are
33
+ * drawn in the order they were given and the later ones sit over the earlier.
34
+ */
35
+ export function meshBackground(background, dimensions, id) {
36
+ const { width, height } = dimensions;
37
+ const blobs = background.blobs.map((blob, index) => blobSvg(blob, dimensions, `${id}-blob-${String(index)}`));
38
+ return (`<defs>${blobs.map((blob) => blob.def).join("")}</defs>` +
39
+ `<rect width="${String(width)}" height="${String(height)}" fill="${background.color}"/>${blobs
40
+ .map((blob) => blob.rect)
41
+ .join("")}`);
42
+ }
43
+ //# sourceMappingURL=mesh.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mesh.js","sourceRoot":"","sources":["../../src/background/mesh.ts"],"names":[],"mappings":"AAEA,iFAAiF;AACjF,MAAM,aAAa,GAAG,GAAG,CAAC;AAE1B;;;;;;;;;GASG;AACH,SAAS,OAAO,CACd,IAAc,EAC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,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,SAAS;QACxD,gBAAgB,MAAM,CAAC,KAAK,CAAC,aAAa,MAAM,CAAC,MAAM,CAAC,WAAW,UAAU,CAAC,KAAK,MAAM,KAAK;aAC3F,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC;aACxB,IAAI,CAAC,EAAE,CAAC,EAAE,CACd,CAAC;AACJ,CAAC"}
@@ -1,8 +1,13 @@
1
- import type { Background, Dimensions } from "./types.js";
1
+ import type { Background, Dimensions, ImageAsset } from "./types.js";
2
2
  /**
3
3
  * Render a full-bleed background as SVG. For a gradient, this emits a `<defs>`
4
4
  * block with a `<linearGradient>` (using the given `id`) followed by a filled
5
5
  * rect; for a solid colour it emits just the rect.
6
+ *
7
+ * A background image has to be read before it can be drawn, which is the
8
+ * renderer's job. Called without one, an image background is the colour behind
9
+ * it, so a caller assembling an SVG by hand gets a plain image rather than a
10
+ * reference to something that is not there.
6
11
  */
7
- export declare function backgroundSvg(background: Background, dimensions: Dimensions, id: string): string;
12
+ export declare function backgroundSvg(background: Background, dimensions: Dimensions, id: string, asset?: ImageAsset): string;
8
13
  //# sourceMappingURL=background.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"background.d.ts","sourceRoot":"","sources":["../src/background.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEzD;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,EACtB,EAAE,EAAE,MAAM,GACT,MAAM,CAqBR"}
1
+ {"version":3,"file":"background.d.ts","sourceRoot":"","sources":["../src/background.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAS,MAAM,YAAY,CAAC;AAiD5E;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC3B,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,EACtB,EAAE,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,UAAU,GACjB,MAAM,CA8BR"}
@@ -1,13 +1,56 @@
1
+ import { box, image as imageElement, scrim } from "./layout/index.js";
2
+ /** Behind a background image, and either side of one that is `contain`ed. */
3
+ const defaultBackdrop = "#000000";
4
+ /**
5
+ * How heavily the default scrim shades, top and bottom.
6
+ *
7
+ * It starts at a quarter rather than at nothing, because a template is free to
8
+ * put its text anywhere and a wash that only darkens the bottom leaves a
9
+ * centred title sitting on whatever the middle of the photograph happens to
10
+ * be. Shading the whole picture a little and the bottom a lot covers both, and
11
+ * a project that wants the picture untouched at the top sets `from: 0`.
12
+ */
13
+ const defaultScrim = { from: 0.25, to: 0.65 };
14
+ /**
15
+ * A photograph behind the text: the backdrop, the picture, and the wash over
16
+ * it that keeps the text readable.
17
+ *
18
+ * The scrim is on by default and has to be turned off rather than on. Text
19
+ * over an unshaded photo is the failure this would otherwise ship with, and it
20
+ * is not one an author notices unless they look at every image.
21
+ */
22
+ function imageBackground(background, area, id, asset) {
23
+ const backdrop = box(area, { fill: background.color ?? defaultBackdrop });
24
+ if (asset === undefined) {
25
+ return backdrop;
26
+ }
27
+ const shade = background.scrim ?? {};
28
+ return (backdrop +
29
+ imageElement(area, asset.href, { fit: background.fit ?? "cover" }) +
30
+ scrim(area, `${id}-scrim`, {
31
+ ...(shade.color !== undefined && { color: shade.color }),
32
+ from: shade.from ?? defaultScrim.from,
33
+ to: shade.to ?? defaultScrim.to,
34
+ }));
35
+ }
1
36
  /**
2
37
  * Render a full-bleed background as SVG. For a gradient, this emits a `<defs>`
3
38
  * block with a `<linearGradient>` (using the given `id`) followed by a filled
4
39
  * rect; for a solid colour it emits just the rect.
40
+ *
41
+ * A background image has to be read before it can be drawn, which is the
42
+ * renderer's job. Called without one, an image background is the colour behind
43
+ * it, so a caller assembling an SVG by hand gets a plain image rather than a
44
+ * reference to something that is not there.
5
45
  */
6
- export function backgroundSvg(background, dimensions, id) {
46
+ export function backgroundSvg(background, dimensions, id, asset) {
7
47
  const { width, height } = dimensions;
8
48
  if (background.type === "solid") {
9
49
  return `<rect width="${String(width)}" height="${String(height)}" fill="${background.color}"/>`;
10
50
  }
51
+ if (background.type === "image") {
52
+ return imageBackground(background, { x: 0, y: 0, width, height }, id, asset);
53
+ }
11
54
  const from = background.from ?? { x: 0, y: 0 };
12
55
  const to = background.to ?? { x: 1, y: 1 };
13
56
  const stops = background.stops
@@ -1 +1 @@
1
- {"version":3,"file":"background.js","sourceRoot":"","sources":["../src/background.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAC3B,UAAsB,EACtB,UAAsB,EACtB,EAAU;IAEV,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;IAErC,IAAI,UAAU,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAChC,OAAO,gBAAgB,MAAM,CAAC,KAAK,CAAC,aAAa,MAAM,CAAC,MAAM,CAAC,WAAW,UAAU,CAAC,KAAK,KAAK,CAAC;IAClG,CAAC;IAED,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IAC/C,MAAM,EAAE,GAAG,UAAU,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IAE3C,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK;SAC3B,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,iBAAiB,IAAI,CAAC,MAAM,iBAAiB,IAAI,CAAC,KAAK,KAAK,CAAC;SAC3E,IAAI,CAAC,EAAE,CAAC,CAAC;IAEZ,OAAO,CACL,QAAQ;QACR,uBAAuB,EAAE,SAAS,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC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,QAAQ,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,mBAAmB;QACtE,SAAS;QACT,gBAAgB,MAAM,CAAC,KAAK,CAAC,aAAa,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,CACjF,CAAC;AACJ,CAAC"}
@@ -8,7 +8,7 @@ export interface CliArgs {
8
8
  readonly concurrency: number | undefined;
9
9
  }
10
10
  /** Help text for `--help`, and for a run that asks for nothing else. */
11
- export declare const usage = "colophon \u2014 generate social meta images from frontmatter\n\nUsage:\n colophon [contentDir] [options]\n\nImages carry a stamp of the props, config and size they came from, so a rebuild\nrenders only the ones that have actually changed.\n\nOptions:\n -c, --config <path> Load a config module. Its default export is either a\n ColophonConfig or a function (async or not) returning\n one, for a config that has to compute something.\n -f, --force Re-render every image, ignoring the stamps\n -o, --overwrite Alias for --force\n --concurrency <n> How many images to render at once\n -h, --help Show this help\n\nDefaults:\n contentDir content\n --concurrency one per available CPU";
11
+ export declare const usage = "colophon: generate social meta images from frontmatter\n\nUsage:\n colophon [contentDir] [options]\n\nImages carry a stamp of the props, config and size they came from, so a rebuild\nrenders only the ones that have actually changed.\n\nOptions:\n -c, --config <path> Load a config module. Its default export is either a\n ColophonConfig or a function (async or not) returning\n one, for a config that has to compute something.\n -f, --force Re-render every image, ignoring the stamps\n -o, --overwrite Alias for --force\n --concurrency <n> How many images to render at once\n -h, --help Show this help\n\nDefaults:\n contentDir content\n --concurrency one per available CPU";
12
12
  /** Read the command line into the options `generate` takes. */
13
13
  export declare function parseCliArgs(argv: readonly string[]): CliArgs;
14
14
  //# sourceMappingURL=args.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../../src/cli/args.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1C;AAED,wEAAwE;AACxE,eAAO,MAAM,KAAK,sxBAmB4B,CAAC;AAwB/C,+DAA+D;AAC/D,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CA4B7D"}
1
+ {"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../../src/cli/args.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1C;AAED,wEAAwE;AACxE,eAAO,MAAM,KAAK,gxBAmB4B,CAAC;AAwB/C,+DAA+D;AAC/D,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CA4B7D"}
package/dist/cli/args.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /** Help text for `--help`, and for a run that asks for nothing else. */
2
- export const usage = `colophon generate social meta images from frontmatter
2
+ export const usage = `colophon: generate social meta images from frontmatter
3
3
 
4
4
  Usage:
5
5
  colophon [contentDir] [options]
@@ -5,7 +5,7 @@ import type { ColophonConfig } from "../types.js";
5
5
  * The default export may be the config itself or a function returning one,
6
6
  * possibly async. A config that has to compute something cannot be written as
7
7
  * a literal, and without the function form such a project has to abandon the
8
- * CLI and call `generate` from a script of its own reimplementing the
8
+ * CLI and call `generate` from a script of its own, reimplementing the
9
9
  * reporting the CLI already does along the way.
10
10
  */
11
11
  export declare function loadConfig(configPath: string | undefined): Promise<ColophonConfig | undefined>;
@@ -22,7 +22,7 @@ function assertConfig(value, source) {
22
22
  * The default export may be the config itself or a function returning one,
23
23
  * possibly async. A config that has to compute something cannot be written as
24
24
  * a literal, and without the function form such a project has to abandon the
25
- * CLI and call `generate` from a script of its own reimplementing the
25
+ * CLI and call `generate` from a script of its own, reimplementing the
26
26
  * reporting the CLI already does along the way.
27
27
  */
28
28
  export async function loadConfig(configPath) {
@@ -3,11 +3,11 @@ import type { BrandColors, CodeStyle, OutputSize } from "../types.js";
3
3
  * Named output-size presets covering the common social-image standards. Each
4
4
  * `name` becomes the filename suffix (e.g. `my-post-og.png`).
5
5
  *
6
- * - `og` 1.91:1, the Open Graph standard (`og:image`): Facebook, LinkedIn,
6
+ * - `og`: 1.91:1, the Open Graph standard (`og:image`). Facebook, LinkedIn,
7
7
  * Slack, Discord, WhatsApp, Mastodon, and the usual `twitter:image` reuse.
8
- * - `square` 1:1, X/Twitter `summary` card and a universal fallback.
9
- * - `twitter` 2:1, X/Twitter `summary_large_image` card.
10
- * - `pinterest` 2:3 tall pin.
8
+ * - `square`: 1:1, X/Twitter `summary` card and a universal fallback.
9
+ * - `twitter`: 2:1, X/Twitter `summary_large_image` card.
10
+ * - `pinterest`: 2:3 tall pin.
11
11
  */
12
12
  export declare const SIZE_PRESETS: {
13
13
  readonly og: {
@@ -51,9 +51,10 @@ export declare const DEFAULT_COLORS: Required<BrandColors>;
51
51
  */
52
52
  export declare const DEFAULT_CODE_FONT_FAMILY = "\"JetBrains Mono\", \"Source Code Pro\", \"DejaVu Sans Mono\", Menlo, Consolas, monospace";
53
53
  /**
54
- * Default `code` template styling. `charWidthRatio` and `lineHeight` drive the
55
- * monospace grid the snippet is laid out on; the font-size bounds are
56
- * fractions of the image width so they hold at every output size.
54
+ * Default `code` template styling. `lineHeight` sets the monospace grid the
55
+ * snippet is laid out on, along with the character width, which is measured
56
+ * from the font rather than configured. The font-size bounds are fractions of
57
+ * the image width so they hold at every output size.
57
58
  *
58
59
  * `minFontScale` of `0.025` is roughly 30px on a 1200px-wide image, which
59
60
  * still reads when a feed shows that image at half size. A snippet too long to
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/config/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEtE;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY;;iBACjB,IAAI,EAAE,IAAI;iBAAE,KAAK,EAAE,IAAI;iBAAE,MAAM,EAAE,GAAG;;;iBAChC,IAAI,EAAE,QAAQ;iBAAE,KAAK,EAAE,IAAI;iBAAE,MAAM,EAAE,IAAI;;;iBACxC,IAAI,EAAE,SAAS;iBAAE,KAAK,EAAE,IAAI;iBAAE,MAAM,EAAE,GAAG;;;iBACvC,IAAI,EAAE,WAAW;iBAAE,KAAK,EAAE,IAAI;iBAAE,MAAM,EAAE,IAAI;;CACZ,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,SAAS,UAAU,EAG9C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,iCAAiC,CAAC;AAElE,wEAAwE;AACxE,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAKhD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,8FACkD,CAAC;AAExF;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,SAAS,CASlD,CAAC"}
1
+ {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/config/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEtE;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY;;iBACjB,IAAI,EAAE,IAAI;iBAAE,KAAK,EAAE,IAAI;iBAAE,MAAM,EAAE,GAAG;;;iBAChC,IAAI,EAAE,QAAQ;iBAAE,KAAK,EAAE,IAAI;iBAAE,MAAM,EAAE,IAAI;;;iBACxC,IAAI,EAAE,SAAS;iBAAE,KAAK,EAAE,IAAI;iBAAE,MAAM,EAAE,GAAG;;;iBACvC,IAAI,EAAE,WAAW;iBAAE,KAAK,EAAE,IAAI;iBAAE,MAAM,EAAE,IAAI;;CACZ,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,SAAS,UAAU,EAG9C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,iCAAiC,CAAC;AAElE,wEAAwE;AACxE,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAKhD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,8FACkD,CAAC;AAExF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,SAAS,CAQlD,CAAC"}
@@ -2,11 +2,11 @@
2
2
  * Named output-size presets covering the common social-image standards. Each
3
3
  * `name` becomes the filename suffix (e.g. `my-post-og.png`).
4
4
  *
5
- * - `og` 1.91:1, the Open Graph standard (`og:image`): Facebook, LinkedIn,
5
+ * - `og`: 1.91:1, the Open Graph standard (`og:image`). Facebook, LinkedIn,
6
6
  * Slack, Discord, WhatsApp, Mastodon, and the usual `twitter:image` reuse.
7
- * - `square` 1:1, X/Twitter `summary` card and a universal fallback.
8
- * - `twitter` 2:1, X/Twitter `summary_large_image` card.
9
- * - `pinterest` 2:3 tall pin.
7
+ * - `square`: 1:1, X/Twitter `summary` card and a universal fallback.
8
+ * - `twitter`: 2:1, X/Twitter `summary_large_image` card.
9
+ * - `pinterest`: 2:3 tall pin.
10
10
  */
11
11
  export const SIZE_PRESETS = {
12
12
  og: { name: "og", width: 1200, height: 630 },
@@ -42,9 +42,10 @@ export const DEFAULT_COLORS = {
42
42
  */
43
43
  export const DEFAULT_CODE_FONT_FAMILY = '"JetBrains Mono", "Source Code Pro", "DejaVu Sans Mono", Menlo, Consolas, monospace';
44
44
  /**
45
- * Default `code` template styling. `charWidthRatio` and `lineHeight` drive the
46
- * monospace grid the snippet is laid out on; the font-size bounds are
47
- * fractions of the image width so they hold at every output size.
45
+ * Default `code` template styling. `lineHeight` sets the monospace grid the
46
+ * snippet is laid out on, along with the character width, which is measured
47
+ * from the font rather than configured. The font-size bounds are fractions of
48
+ * the image width so they hold at every output size.
48
49
  *
49
50
  * `minFontScale` of `0.025` is roughly 30px on a 1200px-wide image, which
50
51
  * still reads when a feed shows that image at half size. A snippet too long to
@@ -54,7 +55,6 @@ export const DEFAULT_CODE_FONT_FAMILY = '"JetBrains Mono", "Source Code Pro", "D
54
55
  export const DEFAULT_CODE_STYLE = {
55
56
  theme: "github-dark",
56
57
  fontFamily: DEFAULT_CODE_FONT_FAMILY,
57
- charWidthRatio: 0.6,
58
58
  lineHeight: 1.55,
59
59
  tabSize: 2,
60
60
  cornerScale: 0.025,
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../src/config/defaults.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE;IAC5C,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;IACrD,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE;IACtD,SAAS,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;CACd,CAAC;AAEhD;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAA0B;IAClD,YAAY,CAAC,EAAE;IACf,YAAY,CAAC,MAAM;CACpB,CAAC;AAEF;;;;GAIG;A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,8BAA8B,CAAC;AAElE,wEAAwE;AACxE,MAAM,CAAC,MAAM,cAAc,GAA0B;IACnD,KAAK,EAAE,SAAS;IAChB,SAAS,EAAE,SAAS;IACpB,SAAS,EAAE,SAAS;IACpB,UAAU,EAAE,SAAS;CACtB,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GACnC,qFAAqF,CAAC;AAExF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAwB;IACrD,KAAK,EAAE,aAAa;IACpB,UAAU,EAAE,wBAAwB;IACpC,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE,CAAC;IACV,WAAW,EAAE,KAAK;IAClB,YAAY,EAAE,KAAK;IACnB,YAAY,EAAE,KAAK;CACpB,CAAC"}
@@ -18,5 +18,5 @@ export declare function defineConfig(factory: ColophonConfigFactory): ColophonCo
18
18
  * written against a different version of the package is a build error rather
19
19
  * than a set of images quietly rendered with the defaults.
20
20
  */
21
- export declare function resolveConfig(config?: ColophonConfig): ResolvedConfig;
21
+ export declare function resolveConfig(input?: ColophonConfig): ResolvedConfig;
22
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EAErB,cAAc,EACf,MAAM,aAAa,CAAC;AAWrB,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,YAAY,GACb,MAAM,eAAe,CAAC;AAcvB;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc,CAAC;AACrE;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,qBAAqB,GAC7B,qBAAqB,CAAC;AAUzB;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,MAAM,GAAE,cAAmB,GAAG,cAAc,CAoBzE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EAErB,cAAc,EACf,MAAM,aAAa,CAAC;AAYrB,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,YAAY,GACb,MAAM,eAAe,CAAC;AAcvB;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc,CAAC;AACrE;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,qBAAqB,GAC7B,qBAAqB,CAAC;AAUzB;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,GAAE,cAAmB,GAAG,cAAc,CA2BxE"}
@@ -1,12 +1,15 @@
1
1
  import { resolveFonts } from "../fonts/index.js";
2
+ import { resolveOptionalImage } from "../image/index.js";
2
3
  import { builtinTemplates } from "../templates/index.js";
4
+ import { applyTheme } from "../theme/index.js";
5
+ import { resolveTexture } from "../texture/index.js";
3
6
  import { validateConfig } from "../validate/index.js";
4
7
  import { DEFAULT_FONT_FAMILY } from "./defaults.js";
5
- import { defaultBackground, resolveCode, resolveColors, resolveSizes, shouldLoadSystemFonts, } from "./resolve.js";
8
+ import { defaultBackground, resolveBackground, resolveCode, resolveColors, resolveSizes, shouldLoadSystemFonts, } from "./resolve.js";
6
9
  export { DEFAULT_CODE_FONT_FAMILY, DEFAULT_CODE_STYLE, DEFAULT_COLORS, DEFAULT_FONT_FAMILY, DEFAULT_SIZES, SIZE_PRESETS, } from "./defaults.js";
7
10
  /**
8
11
  * Default warning handler. Colophon runs at build time, so a compromise the
9
- * renderer had to make belongs in the build log by default silence is opt-in
12
+ * renderer had to make belongs in the build log by default. Silence is opt-in
10
13
  * via `config.onWarning`.
11
14
  */
12
15
  function warnToConsole(message) {
@@ -30,19 +33,25 @@ export function defineConfig(config) {
30
33
  * written against a different version of the package is a build error rather
31
34
  * than a set of images quietly rendered with the defaults.
32
35
  */
33
- export function resolveConfig(config = {}) {
34
- validateConfig(config);
36
+ export function resolveConfig(input = {}) {
37
+ validateConfig(input);
38
+ // The theme is folded in before anything is resolved, so the rest of this
39
+ // sees a config that happens to name a background and a palette, and nothing
40
+ // downstream has to know a theme was involved.
41
+ const config = applyTheme(input);
35
42
  const colors = resolveColors(config.colors);
36
43
  const fonts = resolveFonts(config.fonts);
37
44
  return {
38
45
  colors,
39
- background: config.background ?? defaultBackground(colors),
46
+ background: resolveBackground(config.background) ?? defaultBackground(colors),
47
+ texture: resolveTexture(config.texture, colors),
40
48
  fonts,
41
49
  systemFonts: shouldLoadSystemFonts(config.systemFonts, fonts),
42
50
  // A project that supplies one font should not have to name it twice.
43
51
  fontFamily: config.fontFamily ?? fonts[0]?.family ?? DEFAULT_FONT_FAMILY,
44
52
  footer: config.footer,
45
53
  badge: config.badge,
54
+ logo: resolveOptionalImage(config.logo, "logo"),
46
55
  code: resolveCode(config.code),
47
56
  onWarning: config.onWarning ?? warnToConsole,
48
57
  sizes: resolveSizes(config.sizes),
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAOzD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,YAAY,EACZ,qBAAqB,GACtB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,YAAY,GACb,MAAM,eAAe,CAAC;AAEvB;;;;GAIG;AACH,SAAS,aAAa,CAAC,O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,CAAC;QAC/C,KAAK;QACL,WAAW,EAAE,qBAAqB,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC;QAC7D,qEAAqE;QACrE,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,MAAM,IAAI,mBAAmB;QACxE,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,IAAI,EAAE,oBAAoB,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC;QAC/C,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC;QAC9B,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,aAAa;QAC5C,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC;QACjC,SAAS,EAAE,EAAE,GAAG,gBAAgB,EAAE,GAAG,MAAM,CAAC,SAAS,EAAE;KACxD,CAAC;AACJ,CAAC"}
@@ -6,6 +6,13 @@ import type { Background, BrandColors, CodeStyle, FontSource, OutputSize } from
6
6
  * than mixing in the neutral defaults, which would clash.
7
7
  */
8
8
  export declare function resolveColors(colors: BrandColors | undefined): Required<BrandColors>;
9
+ /**
10
+ * Check a background's image up front, the way `fonts` and `logo` are checked.
11
+ * A background that cannot be read is every image in the build rendered as a
12
+ * flat colour, which is a failure worth hearing about before the build runs
13
+ * rather than after looking at the output.
14
+ */
15
+ export declare function resolveBackground(background: Background | undefined): Background | undefined;
9
16
  /** The gradient a config with no background of its own is drawn on. */
10
17
  export declare function defaultBackground(colors: Required<BrandColors>): Background;
11
18
  /** Fill in the `code` styling a project did not name. */
@@ -1 +1 @@
1
- {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/config/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,SAAS,EACT,UAAU,EACV,UAAU,EACX,MAAM,aAAa,CAAC;AAOrB;;;;;GAKG;AACH,wBAAgB,aA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CAgBvB;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,OAAO,GAAG,SAAS,EAChC,KAAK,EAAE,SAAS,UAAU,EAAE,GAC3B,OAAO,CAaT"}
@@ -1,3 +1,4 @@
1
+ import { resolveImageSource } from "../image/index.js";
1
2
  import { DEFAULT_CODE_STYLE, DEFAULT_COLORS, DEFAULT_SIZES, } from "./defaults.js";
2
3
  /**
3
4
  * Fill in the palette a project did not name.
@@ -16,6 +17,21 @@ export function resolveColors(colors) {
16
17
  foreground: colors.foreground ?? DEFAULT_COLORS.foreground,
17
18
  };
18
19
  }
20
+ /**
21
+ * Check a background's image up front, the way `fonts` and `logo` are checked.
22
+ * A background that cannot be read is every image in the build rendered as a
23
+ * flat colour, which is a failure worth hearing about before the build runs
24
+ * rather than after looking at the output.
25
+ */
26
+ export function resolveBackground(background) {
27
+ if (background?.type !== "image") {
28
+ return background;
29
+ }
30
+ return {
31
+ ...background,
32
+ source: resolveImageSource(background.source, "background.source"),
33
+ };
34
+ }
19
35
  /** The gradient a config with no background of its own is drawn on. */
20
36
  export function defaultBackground(colors) {
21
37
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../src/config/resolve.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,aAAa,GACd,MAAM,eAAe,CAAC;AAEvB;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAC3B,MAA+B;IAE/B,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC,KAAK;QAC3C,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC,KAAK;QAC3C,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,cAAc,CAAC,UAAU;KAC3D,CA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C,KAAK,EAAE;YACtC,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,SAAS,EAAE;SAC5C;KACF,CAAC;AACJ,CAAC;AAED,yDAAyD;AACzD,MAAM,UAAU,WAAW,CAAC,IAA2B;IACrD,OAAO,EAAE,GAAG,kBAAkB,EAAE,GAAG,IAAI,EAAE,CAAC;AAC5C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAC1B,KAAwC;IAExC,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9C,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CACb,+BAA+B,IAAI,CAAC,IAAI,iEAAiE,CAC1G,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CACnC,WAAgC,EAChC,KAA4B;IAE5B,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED,IAAI,CAAC,WAAW,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CACb,uEAAuE;YACrE,mDAAmD,CACtD,CAAC;IACJ,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC"}
@@ -5,7 +5,7 @@ import type { ColophonConfig, OutputSize, ResolvedConfig } from "../types.js";
5
5
  *
6
6
  * The overrides are folded into the user config and the whole thing resolved
7
7
  * again, rather than patched onto an already-resolved config, so that anything
8
- * derived stays consistent a size that overrides `colors.brand` gets the
8
+ * derived stays consistent. A size that overrides `colors.brand` gets the
9
9
  * default gradient rebuilt around its brand, exactly as a config setting the
10
10
  * same colour at the top level would.
11
11
  *
@@ -15,6 +15,12 @@ import type { ColophonConfig, OutputSize, ResolvedConfig } from "../types.js";
15
15
  * different keys, so half of one over half of another is not a background at
16
16
  * all, and `badge` carries a required `text` that a partial override could not
17
17
  * supply.
18
+ *
19
+ * A size's `theme` replaces the config's, and then applies exactly as it would
20
+ * at the top level: as defaults, under anything the config names outright. So
21
+ * a config with its own `background` keeps it whatever theme a size asks for,
22
+ * and a size wanting the whole look of one has the same answer a config does,
23
+ * which is to stop naming the fields it wants the theme to fill in.
18
24
  */
19
25
  export declare function resolveConfigForSize(config: ColophonConfig | undefined, size: OutputSize): ResolvedConfig;
20
26
  //# sourceMappingURL=size.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"size.d.ts","sourceRoot":"","sources":["../../src/config/size.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,cAAc,EACd,UAAU,EACV,cAAc,EACf,MAAM,aAAa,CAAC;AAoBrB;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,cAAc,GAAG,SAAS,EAClC,IAAI,EAAE,UAAU,GACf,cAAc,CAchB"}
1
+ {"version":3,"file":"size.d.ts","sourceRoot":"","sources":["../../src/config/size.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,cAAc,EACd,UAAU,EACV,cAAc,EAEf,MAAM,aAAa,CAAC;AAyBrB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,cAAc,GAAG,SAAS,EAClC,IAAI,EAAE,UAAU,GACf,cAAc,CAiBhB"}