@kensio/colophon 2.12.0 → 2.13.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 (66) hide show
  1. package/README.md +4 -1
  2. package/dist/config/defaults.d.ts +24 -0
  3. package/dist/config/defaults.d.ts.map +1 -1
  4. package/dist/config/defaults.js +24 -0
  5. package/dist/config/defaults.js.map +1 -1
  6. package/dist/config/index.d.ts.map +1 -1
  7. package/dist/config/index.js +2 -1
  8. package/dist/config/index.js.map +1 -1
  9. package/dist/config/size.d.ts.map +1 -1
  10. package/dist/config/size.js +3 -0
  11. package/dist/config/size.js.map +1 -1
  12. package/dist/layout/fill.d.ts +32 -0
  13. package/dist/layout/fill.d.ts.map +1 -0
  14. package/dist/layout/fill.js +34 -0
  15. package/dist/layout/fill.js.map +1 -0
  16. package/dist/layout/index.d.ts +4 -2
  17. package/dist/layout/index.d.ts.map +1 -1
  18. package/dist/layout/index.js +2 -1
  19. package/dist/layout/index.js.map +1 -1
  20. package/dist/render/svg.js +1 -1
  21. package/dist/render/svg.js.map +1 -1
  22. package/dist/templates/index.d.ts +1 -0
  23. package/dist/templates/index.d.ts.map +1 -1
  24. package/dist/templates/index.js +3 -0
  25. package/dist/templates/index.js.map +1 -1
  26. package/dist/templates/thumbnail/index.d.ts +21 -0
  27. package/dist/templates/thumbnail/index.d.ts.map +1 -0
  28. package/dist/templates/thumbnail/index.js +68 -0
  29. package/dist/templates/thumbnail/index.js.map +1 -0
  30. package/dist/templates/thumbnail/lines.d.ts +38 -0
  31. package/dist/templates/thumbnail/lines.d.ts.map +1 -0
  32. package/dist/templates/thumbnail/lines.js +76 -0
  33. package/dist/templates/thumbnail/lines.js.map +1 -0
  34. package/dist/text/fill.d.ts +34 -0
  35. package/dist/text/fill.d.ts.map +1 -0
  36. package/dist/text/fill.js +57 -0
  37. package/dist/text/fill.js.map +1 -0
  38. package/dist/text/fit.d.ts.map +1 -1
  39. package/dist/text/fit.js +2 -6
  40. package/dist/text/fit.js.map +1 -1
  41. package/dist/text/index.d.ts +2 -0
  42. package/dist/text/index.d.ts.map +1 -1
  43. package/dist/text/index.js +1 -0
  44. package/dist/text/index.js.map +1 -1
  45. package/dist/text/step.d.ts +13 -0
  46. package/dist/text/step.d.ts.map +1 -0
  47. package/dist/text/step.js +17 -0
  48. package/dist/text/step.js.map +1 -0
  49. package/dist/text/unbroken.d.ts +22 -0
  50. package/dist/text/unbroken.d.ts.map +1 -0
  51. package/dist/text/unbroken.js +29 -0
  52. package/dist/text/unbroken.js.map +1 -0
  53. package/dist/texture/index.d.ts +14 -2
  54. package/dist/texture/index.d.ts.map +1 -1
  55. package/dist/texture/index.js +22 -3
  56. package/dist/texture/index.js.map +1 -1
  57. package/dist/texture/resolve.d.ts +10 -0
  58. package/dist/texture/resolve.d.ts.map +1 -1
  59. package/dist/texture/resolve.js +15 -0
  60. package/dist/texture/resolve.js.map +1 -1
  61. package/dist/types.d.ts +28 -0
  62. package/dist/types.d.ts.map +1 -1
  63. package/dist/validate/keys.d.ts.map +1 -1
  64. package/dist/validate/keys.js +2 -0
  65. package/dist/validate/keys.js.map +1 -1
  66. package/package.json +1 -1
package/README.md CHANGED
@@ -196,7 +196,10 @@ gallery stays in sync.
196
196
  <img src="docs/samples/docs-wide.png" alt="docs template, landscape" width="100%" /><br />
197
197
  <sub><code>docs</code> · 1200×630 · breadcrumb, title and summary</sub>
198
198
  </td>
199
- <td></td>
199
+ <td>
200
+ <img src="docs/samples/thumbnail-video.png" alt="thumbnail template, 16:9" width="100%" /><br />
201
+ <sub><code>thumbnail</code> · 1280×720 · title grown to fill the frame, texture scaled up</sub>
202
+ </td>
200
203
  </tr>
201
204
  </table>
202
205
 
@@ -1,4 +1,19 @@
1
1
  import type { BrandColors, CodeStyle, OutputFormat, OutputSize } from "../types.js";
2
+ /**
3
+ * How much larger a texture is drawn on the `thumbnail` preset.
4
+ *
5
+ * A thumbnail is uploaded at 1280 wide and shown at somewhere between about
6
+ * 360 and 170, so a dot grid at its default 44px spacing arrives at the reader
7
+ * about 10px apart, which is not a texture any more but a slightly dirty
8
+ * background. Three is the factor for the largest of those, and it is the
9
+ * conservative choice: a treatment that is a little too coarse still reads as
10
+ * a treatment, where one that is too fine reads as nothing at all.
11
+ */
12
+ export declare const DEFAULT_THUMBNAIL_TEXTURE_SCALE = 3;
13
+ /**
14
+ * The texture scale everything else is drawn at, which is to say, unchanged.
15
+ */
16
+ export declare const DEFAULT_TEXTURE_SCALE = 1;
2
17
  /**
3
18
  * Named output-size presets covering the common social-image standards. Each
4
19
  * `name` becomes the filename suffix (e.g. `my-post-og.png`).
@@ -8,6 +23,9 @@ import type { BrandColors, CodeStyle, OutputFormat, OutputSize } from "../types.
8
23
  * - `square`: 1:1, X/Twitter `summary` card and a universal fallback.
9
24
  * - `twitter`: 2:1, X/Twitter `summary_large_image` card.
10
25
  * - `pinterest`: 2:3 tall pin.
26
+ * - `thumbnail`: 16:9, the size YouTube asks video thumbnails to be uploaded
27
+ * at. It is the one preset carrying an override of its own, for the reason
28
+ * {@link SizeOverrides.textureScale} gives.
11
29
  */
12
30
  export declare const SIZE_PRESETS: {
13
31
  readonly og: {
@@ -30,6 +48,12 @@ export declare const SIZE_PRESETS: {
30
48
  readonly width: 1000;
31
49
  readonly height: 1500;
32
50
  };
51
+ readonly thumbnail: {
52
+ readonly name: "thumbnail";
53
+ readonly width: 1280;
54
+ readonly height: 720;
55
+ readonly textureScale: 3;
56
+ };
33
57
  };
34
58
  /**
35
59
  * Default output sizes: the Open Graph landscape plus a square. Between them
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/config/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EACT,YAAY,EACZ,UAAU,EACX,MAAM,aAAa,CAAC;AAErB;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY;;iBACjB,IAAI,EAAE,IAAI;iBAAE,KAAK,EAAE,IAAI;iBA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;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;;;iBAEvD,IAAI,EAAE,WAAW;iBACjB,KAAK,EAAE,IAAI;iBACX,MAAM,EAAE,GAAG;iBACX,YAAY;;CAE+B,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,SAAS,UAAU,EAG9C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,iCAAiC,CAAC;AAElE;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,YAAoB,CAAC;AAElD;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC;;;;;GAKG;AACH,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC;;;;;GAKG;AACH,eAAO,MAAM,YAAY,KAAK,CAAC;AAE/B,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,CAalD,CAAC"}
@@ -1,3 +1,18 @@
1
+ /**
2
+ * How much larger a texture is drawn on the `thumbnail` preset.
3
+ *
4
+ * A thumbnail is uploaded at 1280 wide and shown at somewhere between about
5
+ * 360 and 170, so a dot grid at its default 44px spacing arrives at the reader
6
+ * about 10px apart, which is not a texture any more but a slightly dirty
7
+ * background. Three is the factor for the largest of those, and it is the
8
+ * conservative choice: a treatment that is a little too coarse still reads as
9
+ * a treatment, where one that is too fine reads as nothing at all.
10
+ */
11
+ export const DEFAULT_THUMBNAIL_TEXTURE_SCALE = 3;
12
+ /**
13
+ * The texture scale everything else is drawn at, which is to say, unchanged.
14
+ */
15
+ export const DEFAULT_TEXTURE_SCALE = 1;
1
16
  /**
2
17
  * Named output-size presets covering the common social-image standards. Each
3
18
  * `name` becomes the filename suffix (e.g. `my-post-og.png`).
@@ -7,12 +22,21 @@
7
22
  * - `square`: 1:1, X/Twitter `summary` card and a universal fallback.
8
23
  * - `twitter`: 2:1, X/Twitter `summary_large_image` card.
9
24
  * - `pinterest`: 2:3 tall pin.
25
+ * - `thumbnail`: 16:9, the size YouTube asks video thumbnails to be uploaded
26
+ * at. It is the one preset carrying an override of its own, for the reason
27
+ * {@link SizeOverrides.textureScale} gives.
10
28
  */
11
29
  export const SIZE_PRESETS = {
12
30
  og: { name: "og", width: 1200, height: 630 },
13
31
  square: { name: "square", width: 1200, height: 1200 },
14
32
  twitter: { name: "twitter", width: 1200, height: 600 },
15
33
  pinterest: { name: "pinterest", width: 1000, height: 1500 },
34
+ thumbnail: {
35
+ name: "thumbnail",
36
+ width: 1280,
37
+ height: 720,
38
+ textureScale: DEFAULT_THUMBNAIL_TEXTURE_SCALE,
39
+ },
16
40
  };
17
41
  /**
18
42
  * Default output sizes: the Open Graph landscape plus a square. Between them
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../src/config/defaults.ts"],"names":[],"mappings":"AAOA;;;;;;;;;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,E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AAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAElC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC;AAE/B,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;IACnB,WAAW,EAAE,KAAK;IAClB,MAAM,EAAE,MAAM;IACd,YAAY,EAAE,CAAC;IACf,WAAW,EAAE,SAAS;IACtB,aAAa,EAAE,IAAI;CACpB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EAErB,cAAc,EACf,MAAM,aAAa,CAAC;AAcrB,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,cAAc,EACd,yBAAyB,EACzB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,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,CAsCxE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EAErB,cAAc,EACf,MAAM,aAAa,CAAC;AAcrB,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,cAAc,EACd,yBAAyB,EACzB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,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,CAuCxE"}
@@ -5,7 +5,7 @@ import { resolveOptionalImage } from "../image/index.js";
5
5
  import { defaultRasteriser } from "../platform/rasteriser.node.js";
6
6
  import { builtinTemplates } from "../templates/index.js";
7
7
  import { applyTheme } from "../theme/index.js";
8
- import { resolveTexture } from "../texture/index.js";
8
+ import { resolveTexture, resolveTextureScale } from "../texture/index.js";
9
9
  import { validateConfig } from "../validate/index.js";
10
10
  import { DEFAULT_FONT_FAMILY, DEFAULT_FORMAT } from "./defaults.js";
11
11
  import { resolveMaxBytes, resolveQuality } from "./output.js";
@@ -49,6 +49,7 @@ export function resolveConfig(input = {}) {
49
49
  colors,
50
50
  background: resolveBackground(config.background) ?? defaultBackground(colors),
51
51
  texture: resolveTexture(config.texture, colors),
52
+ textureScale: resolveTextureScale(config.textureScale),
52
53
  fonts,
53
54
  systemFonts: shouldLoadSystemFonts(config.systemFonts, fonts),
54
55
  // A project that supplies one font should not have to name it twice.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,0DAA0D;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AAE,uBAAuB,CAAC,MAAM,CAAC,gBAAgB,CAAC;QAClE,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,KAAK;QAClC,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,cAAc;QACvC,OAAO,EAAE,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC;QACvC,QAAQ,EAAE,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC;QAC1C,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,KAAK;KACjC,CAAC;AACJ,CAAC"}
@@ -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,EAEf,MAAM,aAAa,CAAC;AAyBrB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,cAAc,GAAG,SAAS,EAClC,IAAI,EAAE,UAAU,GACf,cAAc,CAiBhB"}
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,CAoBhB"}
@@ -48,6 +48,9 @@ export function resolveConfigForSize(config, size) {
48
48
  colors: mergeColors(base.colors, size.theme ?? base.theme, size.colors),
49
49
  }),
50
50
  ...(size.texture !== undefined && { texture: size.texture }),
51
+ ...(size.textureScale !== undefined && {
52
+ textureScale: size.textureScale,
53
+ }),
51
54
  ...(size.code !== undefined && { code: { ...base.code, ...size.code } }),
52
55
  ...(size.background !== undefined && { background: size.background }),
53
56
  ...(size.fontFamily !== undefined && { fontFamily: size.fontFamily }),
@@ -1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AI;YAC/B,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC;SACxE,CAAC;QACF,GAAG,CAAC,IAAI,CAAC,OAAO,KAAK,SAAS,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;QAC5D,GAAG,CAAC,IAAI,CAAC,YAAY,KAAK,SAAS,IAAI;YACrC,YAAY,EAAE,IAAI,CAAC,YAAY;SAChC,CAAC;QACF,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;QACxE,GAAG,CAAC,IAAI,CAAC,UAAU,KAAK,SAAS,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC;QACrE,GAAG,CAAC,IAAI,CAAC,UAAU,KAAK,SAAS,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC;QACrE,GAAG,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;QACzD,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;QACtD,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;KACpD,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,32 @@
1
+ import type { MeasureText } from "../types.js";
2
+ import type { TextLine } from "./block.js";
3
+ /** One group of a template's text, and the box it has to fill. */
4
+ export interface FilledBlock {
5
+ readonly maxWidth: number;
6
+ readonly maxHeight: number;
7
+ /** The advance used both to fit the lines and to draw them, so they agree. */
8
+ readonly lineHeight: number;
9
+ /** The largest size to try, which short text ends up drawn at. */
10
+ readonly maxFontSize: number;
11
+ /** The size below which the text is cut rather than shrunk any further. */
12
+ readonly minFontSize: number;
13
+ readonly fontWeight: number;
14
+ readonly opacity: number;
15
+ /** Space inserted before the group's first line, to separate it from the last. */
16
+ readonly gapBefore?: number;
17
+ }
18
+ /**
19
+ * Fit one group of a template's text to a box, and return its lines.
20
+ *
21
+ * The sibling of `blockLines`, for the layouts where the text is the picture
22
+ * rather than a heading in it. Both take a prop that may not be there and give
23
+ * back nothing at all when it is missing; what differs is what decides the
24
+ * size. See {@link fillText} for which of the two a layout wants.
25
+ *
26
+ * `lineHeight` is here rather than left to `drawLines` because the fitting has
27
+ * to know it: how tall a block of lines is is what the search is measuring
28
+ * against. Pass the same value to both, or the block that was fitted is not
29
+ * the block that gets drawn.
30
+ */
31
+ export declare function fillLines(value: unknown, measure: MeasureText, fontFamily: string, block: FilledBlock): TextLine[];
32
+ //# sourceMappingURL=fill.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fill.d.ts","sourceRoot":"","sources":["../../src/layout/fill.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAG3C,kEAAkE;AAClE,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,8EAA8E;IAC9E,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,kEAAkE;IAClE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,2EAA2E;IAC3E,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,kFAAkF;IAClF,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,WAAW,GACjB,QAAQ,EAAE,CAqBZ"}
@@ -0,0 +1,34 @@
1
+ import { optionalString } from "../props.js";
2
+ import { fillText } from "../text/index.js";
3
+ import { measureIn } from "./measure.js";
4
+ /**
5
+ * Fit one group of a template's text to a box, and return its lines.
6
+ *
7
+ * The sibling of `blockLines`, for the layouts where the text is the picture
8
+ * rather than a heading in it. Both take a prop that may not be there and give
9
+ * back nothing at all when it is missing; what differs is what decides the
10
+ * size. See {@link fillText} for which of the two a layout wants.
11
+ *
12
+ * `lineHeight` is here rather than left to `drawLines` because the fitting has
13
+ * to know it: how tall a block of lines is is what the search is measuring
14
+ * against. Pass the same value to both, or the block that was fitted is not
15
+ * the block that gets drawn.
16
+ */
17
+ export function fillLines(value, measure, fontFamily, block) {
18
+ const fitted = fillText(optionalString(value) ?? "", measureIn(measure, fontFamily, block.fontWeight), {
19
+ maxWidth: block.maxWidth,
20
+ maxHeight: block.maxHeight,
21
+ lineHeight: block.lineHeight,
22
+ maxFontSize: block.maxFontSize,
23
+ minFontSize: block.minFontSize,
24
+ });
25
+ return fitted.lines.map((text, index) => ({
26
+ text,
27
+ fontSize: fitted.fontSize,
28
+ fontWeight: block.fontWeight,
29
+ opacity: block.opacity,
30
+ ...(index === 0 &&
31
+ block.gapBefore !== undefined && { gapBefore: block.gapBefore }),
32
+ }));
33
+ }
34
+ //# sourceMappingURL=fill.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fill.js","sourceRoot":"","sources":["../../src/layout/fill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAkBzC;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,SAAS,CACvB,KAAc,EACd,OAAoB,EACpB,UAAkB,EAClB,KAAkB;IAElB,MAAM,MAAM,GAAe,QAAQ,CACjC,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,EAC3B,SAAS,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,EAChD;QACE,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,WAAW,EAAE,KAAK,CAAC,WAAW;KAC/B,CACF,CAAC;IAEF,OAAO,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QACxC,IAAI;QACJ,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,GAAG,CAAC,KAAK,KAAK,CAAC;YACb,KAAK,CAAC,SAAS,KAAK,SAAS,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;KACnE,CAAC,CAAC,CAAC;AACN,CAAC"}
@@ -30,6 +30,8 @@ export type { StackedRect } from "./stack.js";
30
30
  export type { Align, BoxStyle, Extent, Placed, Rect, Span } from "./types.js";
31
31
  export { blockLines } from "./block.js";
32
32
  export type { StyledBlock, TextBlock, TextLine } from "./block.js";
33
+ export { fillLines } from "./fill.js";
34
+ export type { FilledBlock } from "./fill.js";
33
35
  export { lineExtents, linesHeight } from "./extent.js";
34
36
  export { drawLines } from "./draw.js";
35
37
  export type { LinesStyle } from "./draw.js";
@@ -37,7 +39,7 @@ export { baselineFor, placeLines } from "./lines.js";
37
39
  export type { PlacedLine } from "./lines.js";
38
40
  export { measureIn } from "./measure.js";
39
41
  export { optionalString, stringList } from "../props.js";
40
- export { clampLine, escapeXml, fitText, textElement, wrapText, } from "../text/index.js";
41
- export type { FitOptions, FittedText, MeasureAt, MeasureLine, TextAttributes, } from "../text/index.js";
42
+ export { clampLine, escapeXml, fillText, fitText, textElement, wrapText, } from "../text/index.js";
43
+ export type { FillOptions, FitOptions, FittedText, MeasureAt, MeasureLine, TextAttributes, } from "../text/index.js";
42
44
  export type { Dimensions, MeasureText, MetaImageProps, ResolvedConfig, Template, TemplateContext, TextStyle, } from "../types.js";
43
45
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,YAAY,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,YAAY,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,EACd,cAAc,EACd,QAAQ,EACR,eAAe,EACf,SAAS,GACV,MAAM,aAAa,CAAC"}
@@ -23,10 +23,11 @@ export { row } from "./row.js";
23
23
  export { scrim } from "./scrim.js";
24
24
  export { stack } from "./stack.js";
25
25
  export { blockLines } from "./block.js";
26
+ export { fillLines } from "./fill.js";
26
27
  export { lineExtents, linesHeight } from "./extent.js";
27
28
  export { drawLines } from "./draw.js";
28
29
  export { baselineFor, placeLines } from "./lines.js";
29
30
  export { measureIn } from "./measure.js";
30
31
  export { optionalString, stringList } from "../props.js";
31
- export { clampLine, escapeXml, fitText, textElement, wrapText, } from "../text/index.js";
32
+ export { clampLine, escapeXml, fillText, fitText, textElement, wrapText, } from "../text/index.js";
32
33
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAInC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAErD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EACL,SAAS,EACT,SAAS,EACT,OAAO,EACP,WAAW,EACX,QAAQ,GACT,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAInC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAErD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EACL,SAAS,EACT,SAAS,EACT,QAAQ,EACR,OAAO,EACP,WAAW,EACX,QAAQ,GACT,MAAM,kBAAkB,CAAC"}
@@ -25,7 +25,7 @@ export async function buildSvg(props, config, dimensions) {
25
25
  // background some surface without ever coming between text and reader.
26
26
  const texture = config.texture === undefined
27
27
  ? ""
28
- : textureSvg(config.texture, dimensions, textureId);
28
+ : textureSvg(config.texture, dimensions, textureId, config.textureScale);
29
29
  const body = await template.render({
30
30
  props,
31
31
  config,
@@ -1 +1 @@
1
- {"version":3,"file":"svg.js","sourceRoot":"","sources":["../../src/render/svg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,MAAM,YAAY,GAAG,aAAa,CAAC;AACnC,MAAM,SAAS,GAAG,kBAAkB,CAAC;AAErC;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,KAAqB,EACrB,MAAsB,EACtB,UAAsB;IAEtB,MAAM,QAAQ,GAAG,cAAc,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IACxD,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC1C,cAAc,CAAC,MAAM,CAAC;QACtB,UAAU,CAAC,MAAM,EAAE,KAAK,CAAC;KAC1B,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,aAAa,CAC9B,MAAM,CAAC,UAAU,EACjB,UAAU,EACV,YAAY,EACZ,MAAM,CAAC,UAAU,CAClB,CAAC;IACF,4EAA4E;IAC5E,uEAAuE;IACvE,MAAM,OAAO,GACX,MAAM,CAAC,OAAO,KAAK,SAAS;QAC1B,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;IACxD,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;QACjC,KAAK;QACL,MAAM;QACN,UAAU;QACV,OAAO;QACP,IAAI,EAAE,MAA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MAAM,CAAC,UAAU,CAClB,CAAC;IACF,4EAA4E;IAC5E,uEAAuE;IACvE,MAAM,OAAO,GACX,MAAM,CAAC,OAAO,KAAK,SAAS;QAC1B,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;IAC7E,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;QACjC,KAAK;QACL,MAAM;QACN,UAAU;QACV,OAAO;QACP,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,OAAO,EAAE,MAAM,CAAC,OAAO;KACxB,CAAC,CAAC;IACH,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;IAErC,OAAO,CACL,eAAe,MAAM,CAAC,KAAK,CAAC,aAAa,MAAM,CAAC,MAAM,CAAC,GAAG;QAC1D,iBAAiB,MAAM,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG;QACnD,uCAAuC,UAAU,GAAG,OAAO,GAAG,IAAI,QAAQ,CAC3E,CAAC;AACJ,CAAC"}
@@ -15,6 +15,7 @@ export { quoteTemplate } from "./quote/index.js";
15
15
  export { releaseTemplate } from "./release/index.js";
16
16
  export { statTemplate } from "./stat/index.js";
17
17
  export { terminalTemplate } from "./terminal/index.js";
18
+ export { thumbnailTemplate } from "./thumbnail/index.js";
18
19
  export { wordmarkTemplate } from "./wordmark/index.js";
19
20
  export { optionalString } from "../props.js";
20
21
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAc5C;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,MA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AAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
@@ -9,6 +9,7 @@ import { quoteTemplate } from "./quote/index.js";
9
9
  import { releaseTemplate } from "./release/index.js";
10
10
  import { statTemplate } from "./stat/index.js";
11
11
  import { terminalTemplate } from "./terminal/index.js";
12
+ import { thumbnailTemplate } from "./thumbnail/index.js";
12
13
  import { wordmarkTemplate } from "./wordmark/index.js";
13
14
  /**
14
15
  * Templates registered out of the box. Projects can add to or override these
@@ -26,6 +27,7 @@ export const builtinTemplates = {
26
27
  [releaseTemplate.name]: releaseTemplate,
27
28
  [statTemplate.name]: statTemplate,
28
29
  [terminalTemplate.name]: terminalTemplate,
30
+ [thumbnailTemplate.name]: thumbnailTemplate,
29
31
  [wordmarkTemplate.name]: wordmarkTemplate,
30
32
  };
31
33
  export { articleTemplate } from "./article/index.js";
@@ -39,6 +41,7 @@ export { quoteTemplate } from "./quote/index.js";
39
41
  export { releaseTemplate } from "./release/index.js";
40
42
  export { statTemplate } from "./stat/index.js";
41
43
  export { terminalTemplate } from "./terminal/index.js";
44
+ export { thumbnailTemplate } from "./thumbnail/index.js";
42
45
  export { wordmarkTemplate } from "./wordmark/index.js";
43
46
  export { optionalString } from "../props.js";
44
47
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/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BAAkB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { Template } from "../../types.js";
2
+ /**
3
+ * A video thumbnail: one title, set as large as it will go, with an optional
4
+ * line under it.
5
+ *
6
+ * It is meant for YouTube, whose own recommendation is 1280x720, and
7
+ * `SIZE_PRESETS.thumbnail` is that size. What makes it a template of its own
8
+ * rather than a `card` at other proportions is where it is looked at. A share
9
+ * image is seen more or less at the size it was rendered; a thumbnail is seen
10
+ * in a list, a sidebar or a phone, at something between a third and a sixth of
11
+ * it. So the title is grown to fill the frame rather than set at a fraction of
12
+ * the height, there is one text field by default rather than three, and the
13
+ * margins are tighter than elsewhere.
14
+ *
15
+ * Everything the other centred templates draw is still drawn: the logo above,
16
+ * the footer along the bottom. Both are worth having on a channel's images,
17
+ * and a size can drop the footer with `footer: ""` where the title should have
18
+ * the whole frame.
19
+ */
20
+ export declare const thumbnailTemplate: Template;
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/thumbnail/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAmB,MAAM,gBAAgB,CAAC;AAoBhE;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,iBAAiB,EAAE,QAsD/B,CAAC"}
@@ -0,0 +1,68 @@
1
+ import { linesHeight, stack } from "../../layout/index.js";
2
+ import { drawSlot, footerLine } from "../bottom.js";
3
+ import { contentArea, imageFrame, markRoom } from "../frame.js";
4
+ import { logoElement, logoRect } from "../logo.js";
5
+ import { subtitleGap, subtitleLineHeight, subtitleRoom, thumbnailSubtitle, thumbnailTitle, titleLineHeight, } from "./lines.js";
6
+ /**
7
+ * The margin, as a fraction of the width. Tighter than any of the other
8
+ * centred layouts, because the room the margins give back is the whole point
9
+ * of this one.
10
+ */
11
+ const padScale = 0.055;
12
+ /**
13
+ * A video thumbnail: one title, set as large as it will go, with an optional
14
+ * line under it.
15
+ *
16
+ * It is meant for YouTube, whose own recommendation is 1280x720, and
17
+ * `SIZE_PRESETS.thumbnail` is that size. What makes it a template of its own
18
+ * rather than a `card` at other proportions is where it is looked at. A share
19
+ * image is seen more or less at the size it was rendered; a thumbnail is seen
20
+ * in a list, a sidebar or a phone, at something between a third and a sixth of
21
+ * it. So the title is grown to fill the frame rather than set at a fraction of
22
+ * the height, there is one text field by default rather than three, and the
23
+ * margins are tighter than elsewhere.
24
+ *
25
+ * Everything the other centred templates draw is still drawn: the logo above,
26
+ * the footer along the bottom. Both are worth having on a channel's images,
27
+ * and a size can drop the footer with `footer: ""` where the title should have
28
+ * the whole frame.
29
+ */
30
+ export const thumbnailTemplate = {
31
+ name: "thumbnail",
32
+ render({ props, config, dimensions, measure, logo, avatar, }) {
33
+ const { width, height } = dimensions;
34
+ const frame = imageFrame(dimensions, config, avatar, { padScale });
35
+ const { pad } = frame;
36
+ const mark = logoRect(logo, dimensions, pad, "middle");
37
+ const area = contentArea(frame, markRoom(mark?.height, pad / 2));
38
+ const text = {
39
+ measure,
40
+ fontFamily: config.fontFamily,
41
+ contentWidth: area.width,
42
+ contentHeight: area.height,
43
+ height,
44
+ };
45
+ const subtitle = thumbnailSubtitle(props, text);
46
+ const title = thumbnailTitle(props, text, subtitleRoom(subtitle, height));
47
+ const [titleSlot, subtitleSlot] = stack([
48
+ { size: linesHeight(title, titleLineHeight) },
49
+ {
50
+ size: linesHeight(subtitle, subtitleLineHeight),
51
+ gapBefore: subtitle.length === 0 ? 0 : subtitleGap(height),
52
+ },
53
+ ], area);
54
+ const style = {
55
+ fontFamily: config.fontFamily,
56
+ fill: config.colors.foreground,
57
+ anchor: "middle",
58
+ };
59
+ return (logoElement(logo, mark) +
60
+ drawSlot(title, titleSlot, { ...style, lineHeight: titleLineHeight }) +
61
+ drawSlot(subtitle, subtitleSlot, {
62
+ ...style,
63
+ lineHeight: subtitleLineHeight,
64
+ }) +
65
+ footerLine(config, frame, width, avatar, measure, "middle"));
66
+ },
67
+ };
68
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/thumbnail/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,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,eAAe,GAChB,MAAM,YAAY,CAAC;AAEpB;;;;GAIG;AACH,MAAM,QAAQ,GAAG,KAAK,CAAC;AAEvB;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAa;IACzC,IAAI,EAAE,WAAW;IACjB,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,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AC,KAAK,EAAE,SAAS,EAAE,EAAE,GAAG,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,CAAC;YACrE,QAAQ,CAAC,QAAQ,EAAE,YAAY,EAAE;gBAC/B,GAAG,KAAK;gBACR,UAAU,EAAE,kBAAkB;aAC/B,CAAC;YACF,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAC5D,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -0,0 +1,38 @@
1
+ import type { TextLine } from "../../layout/index.js";
2
+ import type { MeasureText, MetaImageProps } from "../../types.js";
3
+ /** How tightly the title's own lines are stacked. */
4
+ export declare const titleLineHeight = 1.08;
5
+ /** And the subtitle's, which is set at a readable size rather than a large one. */
6
+ export declare const subtitleLineHeight = 1.25;
7
+ /** The space the thumbnail's text has, and how to measure text into it. */
8
+ export interface ThumbnailText {
9
+ readonly measure: MeasureText;
10
+ readonly fontFamily: string;
11
+ readonly contentWidth: number;
12
+ readonly contentHeight: number;
13
+ readonly height: number;
14
+ }
15
+ /** The gap between the title and the subtitle under it. */
16
+ export declare function subtitleGap(height: number): number;
17
+ /**
18
+ * The optional second line: a series name, a channel, the episode number.
19
+ *
20
+ * It is fitted first because the title takes whatever height it leaves, which
21
+ * is the order this layout is built in: the title is the picture, and what is
22
+ * under it is a caption on it.
23
+ */
24
+ export declare function thumbnailSubtitle(props: MetaImageProps, text: ThumbnailText): TextLine[];
25
+ /**
26
+ * The title, grown until it fills the room the subtitle left it.
27
+ *
28
+ * This is the one built-in whose text is sized by the box rather than by the
29
+ * image, and the format is the reason. Everything else here is drawn to be read
30
+ * at something near the size it was rendered at, where a heading that swelled
31
+ * to fill its space would stop looking like a heading. A video thumbnail is
32
+ * seen in a list at a fraction of that size, so the only thing on it that
33
+ * matters is that the words are as large as they can be.
34
+ */
35
+ export declare function thumbnailTitle(props: MetaImageProps, text: ThumbnailText, subtitleRoom: number): TextLine[];
36
+ /** The room the subtitle takes, including the gap above it, or none at all. */
37
+ export declare function subtitleRoom(lines: readonly TextLine[], height: number): number;
38
+ //# sourceMappingURL=lines.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lines.d.ts","sourceRoot":"","sources":["../../../src/templates/thumbnail/lines.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAElE,qDAAqD;AACrD,eAAO,MAAM,eAAe,OAAO,CAAC;AAEpC,mFAAmF;AACnF,eAAO,MAAM,kBAAkB,OAAO,CAAC;AA6BvC,2EAA2E;AAC3E,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,2DAA2D;AAC3D,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,cAAc,EACrB,IAAI,EAAE,aAAa,GAClB,QAAQ,EAAE,CASZ;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,cAAc,EACrB,IAAI,EAAE,aAAa,EACnB,YAAY,EAAE,MAAM,GACnB,QAAQ,EAAE,CAUZ;AAED,+EAA+E;AAC/E,wBAAgB,YAAY,CAC1B,KAAK,EAAE,SAAS,QAAQ,EAAE,EAC1B,MAAM,EAAE,MAAM,GACb,MAAM,CAIR"}
@@ -0,0 +1,76 @@
1
+ import { blockLines, fillLines, linesHeight } from "../../layout/index.js";
2
+ /** How tightly the title's own lines are stacked. */
3
+ export const titleLineHeight = 1.08;
4
+ /** And the subtitle's, which is set at a readable size rather than a large one. */
5
+ export const subtitleLineHeight = 1.25;
6
+ const maxSubtitleLines = 2;
7
+ const subtitleFloor = 0.8;
8
+ /**
9
+ * The title's ceiling, as a fraction of the image's height.
10
+ *
11
+ * Nothing longer than a word or two ever reaches it, since the width runs out
12
+ * first: at 16:9 a two-word title settles around 0.45 of the height on its own.
13
+ * What the ceiling is for is the one-word case, where the width would allow
14
+ * something enormous, and half the height is where a single word stops reading
15
+ * as writing and starts reading as a graphic.
16
+ */
17
+ const maxTitleScale = 0.5;
18
+ /**
19
+ * And its floor, below which the title is cut instead.
20
+ *
21
+ * Around 90px at 720 tall. A thumbnail is shown at something like a third of
22
+ * the width it was rendered at, so this is roughly the smallest text a reader
23
+ * scrolling past can still take in, and a title that will not fit at it is one
24
+ * with too much in it for the format.
25
+ */
26
+ const minTitleScale = 0.125;
27
+ /** The subtitle's size, which does not change with how long the title is. */
28
+ const subtitleScale = 0.055;
29
+ /** The gap between the title and the subtitle under it. */
30
+ export function subtitleGap(height) {
31
+ return Math.round(height * 0.035);
32
+ }
33
+ /**
34
+ * The optional second line: a series name, a channel, the episode number.
35
+ *
36
+ * It is fitted first because the title takes whatever height it leaves, which
37
+ * is the order this layout is built in: the title is the picture, and what is
38
+ * under it is a caption on it.
39
+ */
40
+ export function thumbnailSubtitle(props, text) {
41
+ return blockLines(props.subtitle, text.measure, text.fontFamily, {
42
+ maxWidth: text.contentWidth,
43
+ maxLines: maxSubtitleLines,
44
+ fontSize: Math.round(text.height * subtitleScale),
45
+ floor: subtitleFloor,
46
+ fontWeight: 600,
47
+ opacity: 0.85,
48
+ });
49
+ }
50
+ /**
51
+ * The title, grown until it fills the room the subtitle left it.
52
+ *
53
+ * This is the one built-in whose text is sized by the box rather than by the
54
+ * image, and the format is the reason. Everything else here is drawn to be read
55
+ * at something near the size it was rendered at, where a heading that swelled
56
+ * to fill its space would stop looking like a heading. A video thumbnail is
57
+ * seen in a list at a fraction of that size, so the only thing on it that
58
+ * matters is that the words are as large as they can be.
59
+ */
60
+ export function thumbnailTitle(props, text, subtitleRoom) {
61
+ return fillLines(props.title, text.measure, text.fontFamily, {
62
+ maxWidth: text.contentWidth,
63
+ maxHeight: Math.max(1, text.contentHeight - subtitleRoom),
64
+ lineHeight: titleLineHeight,
65
+ maxFontSize: Math.round(text.height * maxTitleScale),
66
+ minFontSize: Math.round(text.height * minTitleScale),
67
+ fontWeight: 800,
68
+ opacity: 1,
69
+ });
70
+ }
71
+ /** The room the subtitle takes, including the gap above it, or none at all. */
72
+ export function subtitleRoom(lines, height) {
73
+ const stacked = linesHeight(lines, subtitleLineHeight);
74
+ return stacked === 0 ? 0 : stacked + subtitleGap(height);
75
+ }
76
+ //# sourceMappingURL=lines.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lines.js","sourceRoot":"","sources":["../../../src/templates/thumbnail/lines.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAG3E,qDAAqD;AACrD,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC;AAEpC,mFAAmF;AACnF,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAEvC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAC3B,MAAM,aAAa,GAAG,GAAG,CAAC;AAE1B;;;;;;;;GAQG;AACH,MAAM,aAAa,GAAG,GAAG,CAAC;AAE1B;;;;;;;GAOG;AACH,MAAM,aAAa,GAAG,KAAK,CAAC;AAE5B,6EAA6E;AAC7E,MAAM,aAAa,GAAG,KAAK,CAAC;AAW5B,2DAA2D;AAC3D,MAAM,UAAU,WAAW,CAAC,MAAc;IACxC,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC;AACpC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAC/B,KAAqB,EACrB,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