@kensio/colophon 2.13.0 → 2.14.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.
- package/README.md +14 -3
- package/dist/config/defaults.d.ts +77 -6
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +69 -6
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +2 -0
- package/dist/config/index.js.map +1 -1
- package/dist/config/resolve.d.ts +13 -0
- package/dist/config/resolve.d.ts.map +1 -1
- package/dist/config/resolve.js +14 -8
- package/dist/config/resolve.js.map +1 -1
- package/dist/config/safe-area.d.ts +27 -0
- package/dist/config/safe-area.d.ts.map +1 -0
- package/dist/config/safe-area.js +81 -0
- package/dist/config/safe-area.js.map +1 -0
- package/dist/config/size.d.ts.map +1 -1
- package/dist/config/size.js +1 -0
- package/dist/config/size.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/fonts/bundled.d.ts +38 -0
- package/dist/fonts/bundled.d.ts.map +1 -0
- package/dist/fonts/bundled.js +29 -0
- package/dist/fonts/bundled.js.map +1 -0
- package/dist/fonts/index.d.ts +1 -0
- package/dist/fonts/index.d.ts.map +1 -1
- package/dist/fonts/index.js +1 -0
- package/dist/fonts/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/measure/faces.d.ts.map +1 -1
- package/dist/measure/faces.js +29 -5
- package/dist/measure/faces.js.map +1 -1
- package/dist/measure/index.d.ts.map +1 -1
- package/dist/measure/index.js +0 -0
- package/dist/measure/index.js.map +1 -1
- package/dist/platform/bundled-fonts.browser.d.ts +16 -0
- package/dist/platform/bundled-fonts.browser.d.ts.map +1 -0
- package/dist/platform/bundled-fonts.browser.js +17 -0
- package/dist/platform/bundled-fonts.browser.js.map +1 -0
- package/dist/platform/bundled-fonts.node.d.ts +18 -0
- package/dist/platform/bundled-fonts.node.d.ts.map +1 -0
- package/dist/platform/bundled-fonts.node.js +49 -0
- package/dist/platform/bundled-fonts.node.js.map +1 -0
- package/dist/render/rasterise.d.ts.map +1 -1
- package/dist/render/rasterise.js +8 -3
- package/dist/render/rasterise.js.map +1 -1
- package/dist/templates/article/index.js +1 -1
- package/dist/templates/article/index.js.map +1 -1
- package/dist/templates/banner/badge.d.ts +8 -1
- package/dist/templates/banner/badge.d.ts.map +1 -1
- package/dist/templates/banner/badge.js +8 -4
- package/dist/templates/banner/badge.js.map +1 -1
- package/dist/templates/banner/index.d.ts.map +1 -1
- package/dist/templates/banner/index.js +10 -25
- package/dist/templates/banner/index.js.map +1 -1
- package/dist/templates/bottom.d.ts +1 -1
- package/dist/templates/bottom.d.ts.map +1 -1
- package/dist/templates/bottom.js +5 -5
- package/dist/templates/bottom.js.map +1 -1
- package/dist/templates/card/index.d.ts.map +1 -1
- package/dist/templates/card/index.js +9 -25
- package/dist/templates/card/index.js.map +1 -1
- package/dist/templates/cover/index.d.ts +21 -0
- package/dist/templates/cover/index.d.ts.map +1 -0
- package/dist/templates/cover/index.js +67 -0
- package/dist/templates/cover/index.js.map +1 -0
- package/dist/templates/cover/lines.d.ts +21 -0
- package/dist/templates/cover/lines.d.ts.map +1 -0
- package/dist/templates/cover/lines.js +73 -0
- package/dist/templates/cover/lines.js.map +1 -0
- package/dist/templates/cover/lockup.d.ts +47 -0
- package/dist/templates/cover/lockup.d.ts.map +1 -0
- package/dist/templates/cover/lockup.js +71 -0
- package/dist/templates/cover/lockup.js.map +1 -0
- package/dist/templates/docs/index.js +3 -3
- package/dist/templates/docs/index.js.map +1 -1
- package/dist/templates/event/index.js +3 -3
- package/dist/templates/event/index.js.map +1 -1
- package/dist/templates/footer.d.ts +3 -0
- package/dist/templates/footer.d.ts.map +1 -1
- package/dist/templates/footer.js +16 -1
- package/dist/templates/footer.js.map +1 -1
- package/dist/templates/frame.d.ts +27 -3
- package/dist/templates/frame.d.ts.map +1 -1
- package/dist/templates/frame.js +19 -7
- package/dist/templates/frame.js.map +1 -1
- package/dist/templates/index.d.ts +1 -0
- package/dist/templates/index.d.ts.map +1 -1
- package/dist/templates/index.js +3 -0
- package/dist/templates/index.js.map +1 -1
- package/dist/templates/logo.d.ts +6 -2
- package/dist/templates/logo.d.ts.map +1 -1
- package/dist/templates/logo.js +10 -6
- package/dist/templates/logo.js.map +1 -1
- package/dist/templates/photo/index.d.ts.map +1 -1
- package/dist/templates/photo/index.js +9 -4
- package/dist/templates/photo/index.js.map +1 -1
- package/dist/templates/quote/index.js +2 -2
- package/dist/templates/quote/index.js.map +1 -1
- package/dist/templates/release/index.js +3 -3
- package/dist/templates/release/index.js.map +1 -1
- package/dist/templates/stat/index.js +3 -3
- package/dist/templates/stat/index.js.map +1 -1
- package/dist/templates/thumbnail/index.js +3 -3
- package/dist/templates/thumbnail/index.js.map +1 -1
- package/dist/templates/wordmark/index.js +2 -2
- package/dist/templates/wordmark/index.js.map +1 -1
- package/dist/types.d.ts +49 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/validate/collect.d.ts.map +1 -1
- package/dist/validate/collect.js +2 -1
- package/dist/validate/collect.js.map +1 -1
- package/dist/validate/keys.d.ts +2 -0
- package/dist/validate/keys.d.ts.map +1 -1
- package/dist/validate/keys.js +9 -0
- package/dist/validate/keys.js.map +1 -1
- package/dist/validate/overrides.d.ts.map +1 -1
- package/dist/validate/overrides.js +2 -1
- package/dist/validate/overrides.js.map +1 -1
- package/fonts/JetBrainsMono-LICENSE.txt +93 -0
- package/fonts/JetBrainsMono_400Regular.ttf +0 -0
- package/fonts/JetBrainsMono_700Bold.ttf +0 -0
- package/fonts/Outfit-LICENSE.txt +93 -0
- package/fonts/Outfit_400Regular.ttf +0 -0
- package/fonts/Outfit_500Medium.ttf +0 -0
- package/fonts/Outfit_600SemiBold.ttf +0 -0
- package/fonts/Outfit_700Bold.ttf +0 -0
- package/fonts/Outfit_800ExtraBold.ttf +0 -0
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -40,9 +40,10 @@ pnpm add @kensio/colophon
|
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
`@resvg/resvg-js` rasterises the SVG to PNG, and `shiki` provides the grammars
|
|
43
|
-
and themes for the `code` template. No headless browser is involved.
|
|
44
|
-
|
|
45
|
-
everywhere
|
|
43
|
+
and themes for the `code` template. No headless browser is involved. Outfit and
|
|
44
|
+
JetBrains Mono ship with the package and are used by default, so a build renders
|
|
45
|
+
the same image everywhere without configuring anything; point `fonts` at your
|
|
46
|
+
own files to use those instead.
|
|
46
47
|
|
|
47
48
|
## Quick start
|
|
48
49
|
|
|
@@ -201,6 +202,16 @@ gallery stays in sync.
|
|
|
201
202
|
<sub><code>thumbnail</code> · 1280×720 · title grown to fill the frame, texture scaled up</sub>
|
|
202
203
|
</td>
|
|
203
204
|
</tr>
|
|
205
|
+
<tr>
|
|
206
|
+
<td>
|
|
207
|
+
<img src="docs/samples/cover-x.png" alt="cover template, 3:1" width="100%" /><br />
|
|
208
|
+
<sub><code>cover</code> · 3:1 · profile header, kept clear of X's avatar corner</sub>
|
|
209
|
+
</td>
|
|
210
|
+
<td>
|
|
211
|
+
<img src="docs/samples/cover-youtube.png" alt="cover template, 16:9" width="100%" /><br />
|
|
212
|
+
<sub><code>cover</code> · 16:9 · same layout in YouTube's centred safe area</sub>
|
|
213
|
+
</td>
|
|
214
|
+
</tr>
|
|
204
215
|
</table>
|
|
205
216
|
|
|
206
217
|
### Themes
|
|
@@ -18,14 +18,26 @@ export declare const DEFAULT_TEXTURE_SCALE = 1;
|
|
|
18
18
|
* Named output-size presets covering the common social-image standards. Each
|
|
19
19
|
* `name` becomes the filename suffix (e.g. `my-post-og.png`).
|
|
20
20
|
*
|
|
21
|
+
* The first group are share images, made once per post:
|
|
22
|
+
*
|
|
21
23
|
* - `og`: 1.91:1, the Open Graph standard (`og:image`). Facebook, LinkedIn,
|
|
22
24
|
* Slack, Discord, WhatsApp, Mastodon, and the usual `twitter:image` reuse.
|
|
23
25
|
* - `square`: 1:1, X/Twitter `summary` card and a universal fallback.
|
|
24
26
|
* - `twitter`: 2:1, X/Twitter `summary_large_image` card.
|
|
25
27
|
* - `pinterest`: 2:3 tall pin.
|
|
26
28
|
* - `thumbnail`: 16:9, the size YouTube asks video thumbnails to be uploaded
|
|
27
|
-
* at
|
|
28
|
-
*
|
|
29
|
+
* at, carrying a {@link SizeOverrides.textureScale} for the reason that
|
|
30
|
+
* field gives.
|
|
31
|
+
*
|
|
32
|
+
* The rest are profile covers, made once for a site rather than once per post,
|
|
33
|
+
* so `config.extra` is the usual way to declare one. Each carries the
|
|
34
|
+
* {@link SafeArea} for the platform it is named after, which is what keeps the
|
|
35
|
+
* text out of the avatar and out of whatever that platform crops. Where those
|
|
36
|
+
* numbers come from, and how much to trust each of them, is in
|
|
37
|
+
* `docs/configuration/cover-images`.
|
|
38
|
+
*
|
|
39
|
+
* None of the covers is in `DEFAULT_SIZES`: a cover is not something a build
|
|
40
|
+
* should start making for every post because the package was upgraded.
|
|
29
41
|
*/
|
|
30
42
|
export declare const SIZE_PRESETS: {
|
|
31
43
|
readonly og: {
|
|
@@ -54,6 +66,61 @@ export declare const SIZE_PRESETS: {
|
|
|
54
66
|
readonly height: 720;
|
|
55
67
|
readonly textureScale: 3;
|
|
56
68
|
};
|
|
69
|
+
readonly xCover: {
|
|
70
|
+
readonly name: "x-cover";
|
|
71
|
+
readonly width: 1500;
|
|
72
|
+
readonly height: 500;
|
|
73
|
+
readonly safeArea: {
|
|
74
|
+
readonly top: 0.12;
|
|
75
|
+
readonly right: 0.06;
|
|
76
|
+
readonly bottom: 0.12;
|
|
77
|
+
readonly left: 0.25;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
readonly linkedinCover: {
|
|
81
|
+
readonly name: "linkedin-cover";
|
|
82
|
+
readonly width: 1584;
|
|
83
|
+
readonly height: 396;
|
|
84
|
+
readonly safeArea: {
|
|
85
|
+
readonly top: 0.1;
|
|
86
|
+
readonly right: 0.2;
|
|
87
|
+
readonly bottom: 0.1;
|
|
88
|
+
readonly left: 0.28;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
readonly linkedinPageCover: {
|
|
92
|
+
readonly name: "linkedin-page-cover";
|
|
93
|
+
readonly width: 4200;
|
|
94
|
+
readonly height: 700;
|
|
95
|
+
readonly safeArea: {
|
|
96
|
+
readonly top: 0.14;
|
|
97
|
+
readonly right: 0.12;
|
|
98
|
+
readonly bottom: 0.14;
|
|
99
|
+
readonly left: 0.22;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
readonly blueskyCover: {
|
|
103
|
+
readonly name: "bluesky-cover";
|
|
104
|
+
readonly width: 3000;
|
|
105
|
+
readonly height: 1000;
|
|
106
|
+
readonly safeArea: {
|
|
107
|
+
readonly top: 0.15;
|
|
108
|
+
readonly right: 0.1;
|
|
109
|
+
readonly bottom: 0.15;
|
|
110
|
+
readonly left: 0.22;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
readonly youtubeCover: {
|
|
114
|
+
readonly name: "youtube-cover";
|
|
115
|
+
readonly width: 2560;
|
|
116
|
+
readonly height: 1440;
|
|
117
|
+
readonly safeArea: {
|
|
118
|
+
readonly top: number;
|
|
119
|
+
readonly right: number;
|
|
120
|
+
readonly bottom: number;
|
|
121
|
+
readonly left: number;
|
|
122
|
+
};
|
|
123
|
+
};
|
|
57
124
|
};
|
|
58
125
|
/**
|
|
59
126
|
* Default output sizes: the Open Graph landscape plus a square. Between them
|
|
@@ -61,11 +128,15 @@ export declare const SIZE_PRESETS: {
|
|
|
61
128
|
*/
|
|
62
129
|
export declare const DEFAULT_SIZES: readonly OutputSize[];
|
|
63
130
|
/**
|
|
64
|
-
* Default font stack, used when no fonts are configured.
|
|
65
|
-
*
|
|
66
|
-
*
|
|
131
|
+
* Default font stack, used when no fonts are configured.
|
|
132
|
+
*
|
|
133
|
+
* Outfit ships with the package, so this resolves to a real file rather than
|
|
134
|
+
* to whatever the machine happens to have: the same words come out the same
|
|
135
|
+
* width on a laptop, in CI and in a container, without a project configuring
|
|
136
|
+
* anything. The families behind it are the fallback for a character Outfit
|
|
137
|
+
* does not cover, which is most of what is not Latin.
|
|
67
138
|
*/
|
|
68
|
-
export declare const DEFAULT_FONT_FAMILY = "
|
|
139
|
+
export declare const DEFAULT_FONT_FAMILY = "Outfit, \"Helvetica Neue\", Helvetica, Arial, sans-serif";
|
|
69
140
|
/**
|
|
70
141
|
* Default zlib level for the rendered PNG: the strongest there is.
|
|
71
142
|
*
|
|
@@ -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,+BAA+B,IAAI,CAAC;AAEjD;;GAEG;AACH,eAAO,MAAM,qBAAqB,IAAI,CAAC;
|
|
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,+BAA+B,IAAI,CAAC;AAEjD;;GAEG;AACH,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAevC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;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,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BAAmB,6DAC0B,CAAC;AAE3D;;;;;;;;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"}
|
package/dist/config/defaults.js
CHANGED
|
@@ -13,18 +13,42 @@ export const DEFAULT_THUMBNAIL_TEXTURE_SCALE = 3;
|
|
|
13
13
|
* The texture scale everything else is drawn at, which is to say, unchanged.
|
|
14
14
|
*/
|
|
15
15
|
export const DEFAULT_TEXTURE_SCALE = 1;
|
|
16
|
+
/**
|
|
17
|
+
* YouTube's safe area, as insets of the banner it is uploaded on.
|
|
18
|
+
*
|
|
19
|
+
* This is the one platform that publishes the figure rather than leaving it to
|
|
20
|
+
* be worked out: 1546x423 centred on a 2560x1440 upload, so the insets are
|
|
21
|
+
* `(2560 - 1546) / 2 / 2560` and `(1440 - 423) / 2 / 1440`. They are written
|
|
22
|
+
* out because the arithmetic is the evidence. The same fractions turn up as
|
|
23
|
+
* 1235x338 on the 2048x1152 minimum upload, which is what says a safe area
|
|
24
|
+
* belongs in fractions rather than pixels.
|
|
25
|
+
*/
|
|
26
|
+
const YOUTUBE_SAFE_X = (2560 - 1546) / 2 / 2560;
|
|
27
|
+
const YOUTUBE_SAFE_Y = (1440 - 423) / 2 / 1440;
|
|
16
28
|
/**
|
|
17
29
|
* Named output-size presets covering the common social-image standards. Each
|
|
18
30
|
* `name` becomes the filename suffix (e.g. `my-post-og.png`).
|
|
19
31
|
*
|
|
32
|
+
* The first group are share images, made once per post:
|
|
33
|
+
*
|
|
20
34
|
* - `og`: 1.91:1, the Open Graph standard (`og:image`). Facebook, LinkedIn,
|
|
21
35
|
* Slack, Discord, WhatsApp, Mastodon, and the usual `twitter:image` reuse.
|
|
22
36
|
* - `square`: 1:1, X/Twitter `summary` card and a universal fallback.
|
|
23
37
|
* - `twitter`: 2:1, X/Twitter `summary_large_image` card.
|
|
24
38
|
* - `pinterest`: 2:3 tall pin.
|
|
25
39
|
* - `thumbnail`: 16:9, the size YouTube asks video thumbnails to be uploaded
|
|
26
|
-
* at
|
|
27
|
-
*
|
|
40
|
+
* at, carrying a {@link SizeOverrides.textureScale} for the reason that
|
|
41
|
+
* field gives.
|
|
42
|
+
*
|
|
43
|
+
* The rest are profile covers, made once for a site rather than once per post,
|
|
44
|
+
* so `config.extra` is the usual way to declare one. Each carries the
|
|
45
|
+
* {@link SafeArea} for the platform it is named after, which is what keeps the
|
|
46
|
+
* text out of the avatar and out of whatever that platform crops. Where those
|
|
47
|
+
* numbers come from, and how much to trust each of them, is in
|
|
48
|
+
* `docs/configuration/cover-images`.
|
|
49
|
+
*
|
|
50
|
+
* None of the covers is in `DEFAULT_SIZES`: a cover is not something a build
|
|
51
|
+
* should start making for every post because the package was upgraded.
|
|
28
52
|
*/
|
|
29
53
|
export const SIZE_PRESETS = {
|
|
30
54
|
og: { name: "og", width: 1200, height: 630 },
|
|
@@ -37,6 +61,41 @@ export const SIZE_PRESETS = {
|
|
|
37
61
|
height: 720,
|
|
38
62
|
textureScale: DEFAULT_THUMBNAIL_TEXTURE_SCALE,
|
|
39
63
|
},
|
|
64
|
+
xCover: {
|
|
65
|
+
name: "x-cover",
|
|
66
|
+
width: 1500,
|
|
67
|
+
height: 500,
|
|
68
|
+
safeArea: { top: 0.12, right: 0.06, bottom: 0.12, left: 0.25 },
|
|
69
|
+
},
|
|
70
|
+
linkedinCover: {
|
|
71
|
+
name: "linkedin-cover",
|
|
72
|
+
width: 1584,
|
|
73
|
+
height: 396,
|
|
74
|
+
safeArea: { top: 0.1, right: 0.2, bottom: 0.1, left: 0.28 },
|
|
75
|
+
},
|
|
76
|
+
linkedinPageCover: {
|
|
77
|
+
name: "linkedin-page-cover",
|
|
78
|
+
width: 4200,
|
|
79
|
+
height: 700,
|
|
80
|
+
safeArea: { top: 0.14, right: 0.12, bottom: 0.14, left: 0.22 },
|
|
81
|
+
},
|
|
82
|
+
blueskyCover: {
|
|
83
|
+
name: "bluesky-cover",
|
|
84
|
+
width: 3000,
|
|
85
|
+
height: 1000,
|
|
86
|
+
safeArea: { top: 0.15, right: 0.1, bottom: 0.15, left: 0.22 },
|
|
87
|
+
},
|
|
88
|
+
youtubeCover: {
|
|
89
|
+
name: "youtube-cover",
|
|
90
|
+
width: 2560,
|
|
91
|
+
height: 1440,
|
|
92
|
+
safeArea: {
|
|
93
|
+
top: YOUTUBE_SAFE_Y,
|
|
94
|
+
right: YOUTUBE_SAFE_X,
|
|
95
|
+
bottom: YOUTUBE_SAFE_Y,
|
|
96
|
+
left: YOUTUBE_SAFE_X,
|
|
97
|
+
},
|
|
98
|
+
},
|
|
40
99
|
};
|
|
41
100
|
/**
|
|
42
101
|
* Default output sizes: the Open Graph landscape plus a square. Between them
|
|
@@ -47,11 +106,15 @@ export const DEFAULT_SIZES = [
|
|
|
47
106
|
SIZE_PRESETS.square,
|
|
48
107
|
];
|
|
49
108
|
/**
|
|
50
|
-
* Default font stack, used when no fonts are configured.
|
|
51
|
-
*
|
|
52
|
-
*
|
|
109
|
+
* Default font stack, used when no fonts are configured.
|
|
110
|
+
*
|
|
111
|
+
* Outfit ships with the package, so this resolves to a real file rather than
|
|
112
|
+
* to whatever the machine happens to have: the same words come out the same
|
|
113
|
+
* width on a laptop, in CI and in a container, without a project configuring
|
|
114
|
+
* anything. The families behind it are the fallback for a character Outfit
|
|
115
|
+
* does not cover, which is most of what is not Latin.
|
|
53
116
|
*/
|
|
54
|
-
export const DEFAULT_FONT_FAMILY = "
|
|
117
|
+
export const DEFAULT_FONT_FAMILY = 'Outfit, "Helvetica Neue", Helvetica, Arial, sans-serif';
|
|
55
118
|
/**
|
|
56
119
|
* Default zlib level for the rendered PNG: the strongest there is.
|
|
57
120
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../src/config/defaults.ts"],"names":[],"mappings":"AAOA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC;AAEjD;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAEvC
|
|
1
|
+
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../src/config/defaults.ts"],"names":[],"mappings":"AAOA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC;AAEjD;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAEvC;;;;;;;;;GASG;AACH,MAAM,cAAc,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;AAChD,MAAM,cAAc,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;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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sources":["../../src/config/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EAErB,cAAc,EACf,MAAM,aAAa,CAAC;
|
|
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;AAerB,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,CAwCxE"}
|
package/dist/config/index.js
CHANGED
|
@@ -9,6 +9,7 @@ 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";
|
|
12
|
+
import { resolveSafeArea } from "./safe-area.js";
|
|
12
13
|
import { defaultBackground, resolveBackground, resolveCode, resolveColors, resolveCompressionLevel, resolveSizes, shouldLoadSystemFonts, } from "./resolve.js";
|
|
13
14
|
export { DEFAULT_CODE_FONT_FAMILY, DEFAULT_CODE_STYLE, DEFAULT_COLORS, DEFAULT_COMPRESSION_LEVEL, DEFAULT_FONT_FAMILY, DEFAULT_FORMAT, DEFAULT_QUALITY, DEFAULT_SIZES, SIZE_PRESETS, } from "./defaults.js";
|
|
14
15
|
/**
|
|
@@ -50,6 +51,7 @@ export function resolveConfig(input = {}) {
|
|
|
50
51
|
background: resolveBackground(config.background) ?? defaultBackground(colors),
|
|
51
52
|
texture: resolveTexture(config.texture, colors),
|
|
52
53
|
textureScale: resolveTextureScale(config.textureScale),
|
|
54
|
+
safeArea: resolveSafeArea(config.safeArea),
|
|
53
55
|
fonts,
|
|
54
56
|
systemFonts: shouldLoadSystemFonts(config.systemFonts, fonts),
|
|
55
57
|
// A project that supplies one font should not have to name it twice.
|
package/dist/config/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,0DAA0D;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAO1E,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,uBAAuB,EACvB,YAAY,EACZ,qBAAqB,GACtB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,cAAc,EACd,yBAAyB,EACzB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,aAAa,EACb,YAAY,GACb,MAAM,eAAe,CAAC;AAEvB;;;;G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W,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;QACvD,4EAA4E;QAC5E,uEAAuE;QACvE,wEAAwE;QACxE,uCAAuC;QACvC,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,iBAAiB;QAClD,gBAAgB,EAAE,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"}
|
package/dist/config/resolve.d.ts
CHANGED
|
@@ -36,6 +36,19 @@ export declare function resolveCompressionLevel(level: number | undefined): numb
|
|
|
36
36
|
* Whether to load the machine's own fonts. Configured fonts are meant to make
|
|
37
37
|
* the output the same everywhere, so supplying any turns system fonts off
|
|
38
38
|
* unless the project asks for them back.
|
|
39
|
+
*
|
|
40
|
+
* A project that configures none still gets them, even though the package now
|
|
41
|
+
* bundles fonts of its own. What the bundled ones give is a Latin face that is
|
|
42
|
+
* the same everywhere, and they cover nothing else: a Japanese or Arabic title
|
|
43
|
+
* on a project that has configured no fonts has only the machine's own to be
|
|
44
|
+
* drawn in, and turning them off by default would render it as nothing at all.
|
|
45
|
+
* So the rule is unchanged and the bundled fonts sit in front of the system
|
|
46
|
+
* ones rather than in place of them.
|
|
47
|
+
*
|
|
48
|
+
* `systemFonts: false` with no fonts configured used to be an error, on the
|
|
49
|
+
* grounds that it left nothing to render with. The bundled fonts are what it
|
|
50
|
+
* leaves now, and that pairing is the whole way to ask for a build that does
|
|
51
|
+
* not depend on the machine without supplying font files, so it is allowed.
|
|
39
52
|
*/
|
|
40
53
|
export declare function shouldLoadSystemFonts(systemFonts: boolean | undefined, fonts: readonly FontSource[]): boolean;
|
|
41
54
|
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -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;AASrB;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,WAAW,GAAG,SAAS,GAC9B,QAAQ,CAAC,WAAW,CAAC,CAWvB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,UAAU,GAAG,SAAS,GACjC,UAAU,GAAG,SAAS,CASxB;AAED,uEAAuE;AACvE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,UAAU,CAS3E;AAED,yDAAyD;AACzD,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC,CAE5E;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,SAAS,UAAU,EAAE,GAAG,SAAS,GACvC,SAAS,UAAU,EAAE,CAgBvB;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAazE;AAED
|
|
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;AASrB;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,WAAW,GAAG,SAAS,GAC9B,QAAQ,CAAC,WAAW,CAAC,CAWvB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,UAAU,GAAG,SAAS,GACjC,UAAU,GAAG,SAAS,CASxB;AAED,uEAAuE;AACvE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,UAAU,CAS3E;AAED,yDAAyD;AACzD,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC,CAE5E;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,SAAS,UAAU,EAAE,GAAG,SAAS,GACvC,SAAS,UAAU,EAAE,CAgBvB;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAazE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,OAAO,GAAG,SAAS,EAChC,KAAK,EAAE,SAAS,UAAU,EAAE,GAC3B,OAAO,CAET"}
|
package/dist/config/resolve.js
CHANGED
|
@@ -87,15 +87,21 @@ export function resolveCompressionLevel(level) {
|
|
|
87
87
|
* Whether to load the machine's own fonts. Configured fonts are meant to make
|
|
88
88
|
* the output the same everywhere, so supplying any turns system fonts off
|
|
89
89
|
* unless the project asks for them back.
|
|
90
|
+
*
|
|
91
|
+
* A project that configures none still gets them, even though the package now
|
|
92
|
+
* bundles fonts of its own. What the bundled ones give is a Latin face that is
|
|
93
|
+
* the same everywhere, and they cover nothing else: a Japanese or Arabic title
|
|
94
|
+
* on a project that has configured no fonts has only the machine's own to be
|
|
95
|
+
* drawn in, and turning them off by default would render it as nothing at all.
|
|
96
|
+
* So the rule is unchanged and the bundled fonts sit in front of the system
|
|
97
|
+
* ones rather than in place of them.
|
|
98
|
+
*
|
|
99
|
+
* `systemFonts: false` with no fonts configured used to be an error, on the
|
|
100
|
+
* grounds that it left nothing to render with. The bundled fonts are what it
|
|
101
|
+
* leaves now, and that pairing is the whole way to ask for a build that does
|
|
102
|
+
* not depend on the machine without supplying font files, so it is allowed.
|
|
90
103
|
*/
|
|
91
104
|
export function shouldLoadSystemFonts(systemFonts, fonts) {
|
|
92
|
-
|
|
93
|
-
return fonts.length === 0;
|
|
94
|
-
}
|
|
95
|
-
if (!systemFonts && fonts.length === 0) {
|
|
96
|
-
throw new Error("systemFonts is false and no fonts are configured, so no text could be" +
|
|
97
|
-
" rendered. Add fonts, or leave systemFonts unset.");
|
|
98
|
-
}
|
|
99
|
-
return systemFonts;
|
|
105
|
+
return systemFonts ?? fonts.length === 0;
|
|
100
106
|
}
|
|
101
107
|
//# sourceMappingURL=resolve.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../src/config/resolve.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,yBAAyB,EACzB,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;IA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AC;QACD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,uBAAuB,CAAC,KAAyB;IAC/D,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,yBAAyB,CAAC;IACnC,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QAC3D,MAAM,IAAI,KAAK,CACb,4BAA4B,MAAM,CAAC,KAAK,CAAC,gCAAgC;YACvE,gEAAgE,CACnE,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,qBAAqB,CACnC,WAAgC,EAChC,KAA4B;IAE5B,OAAO,WAAW,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Rect } from "../layout/index.js";
|
|
2
|
+
import type { Dimensions, SafeArea } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* A safe area with every edge filled in.
|
|
5
|
+
*
|
|
6
|
+
* Opposing edges are checked together as well as separately, since two
|
|
7
|
+
* fractions that are each perfectly reasonable can still meet in the middle.
|
|
8
|
+
*/
|
|
9
|
+
export declare function resolveSafeArea(safeArea: SafeArea | undefined): Required<SafeArea>;
|
|
10
|
+
/**
|
|
11
|
+
* The safe area as a rectangle of the image it applies to.
|
|
12
|
+
*
|
|
13
|
+
* Sides are fractions of the width and the top and bottom are fractions of the
|
|
14
|
+
* height, so that one safe area describes the same crop whatever proportions
|
|
15
|
+
* the image has. A safe area of nothing returns the whole image, which is what
|
|
16
|
+
* makes this free to apply unconditionally.
|
|
17
|
+
*
|
|
18
|
+
* Both edges are rounded and the size taken from the difference, rather than
|
|
19
|
+
* rounding the two insets and subtracting them. It is the same sum until an
|
|
20
|
+
* inset lands on a half: YouTube's is `(1440 - 423) / 2`, so rounding the
|
|
21
|
+
* insets sends 508.5 up at the top and again at the bottom and gives back a
|
|
22
|
+
* band 422 tall where the platform published 423. Rounding a position is
|
|
23
|
+
* asking where an edge goes, which is the question; rounding an inset twice
|
|
24
|
+
* asks it once too often.
|
|
25
|
+
*/
|
|
26
|
+
export declare function safeRect(dimensions: Dimensions, safeArea: Required<SafeArea>): Rect;
|
|
27
|
+
//# sourceMappingURL=safe-area.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safe-area.d.ts","sourceRoot":"","sources":["../../src/config/safe-area.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AA4CxD;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,QAAQ,GAAG,SAAS,GAC7B,QAAQ,CAAC,QAAQ,CAAC,CAgBpB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,QAAQ,CACtB,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAC3B,IAAI,CAWN"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/** An image with none of it cropped away, which is what most of them are. */
|
|
2
|
+
const wholeImage = {
|
|
3
|
+
top: 0,
|
|
4
|
+
right: 0,
|
|
5
|
+
bottom: 0,
|
|
6
|
+
left: 0,
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* One edge of a safe area, checked.
|
|
10
|
+
*
|
|
11
|
+
* The values are hand-written fractions and a percentage typed as one is the
|
|
12
|
+
* slip to expect: `left: 25` insets a 1500px header by 37500px, which collapses
|
|
13
|
+
* the content area to nothing and draws an image with no text on it. That is a
|
|
14
|
+
* mistake nobody spots by looking at the output, since an empty banner looks
|
|
15
|
+
* like a banner whose title the frontmatter forgot.
|
|
16
|
+
*/
|
|
17
|
+
function resolveEdge(value, edge) {
|
|
18
|
+
if (value === undefined) {
|
|
19
|
+
return 0;
|
|
20
|
+
}
|
|
21
|
+
if (!Number.isFinite(value) || value < 0 || value >= 1) {
|
|
22
|
+
throw new Error(`Invalid safeArea.${edge} ${String(value)}; expected a fraction of the` +
|
|
23
|
+
` image from 0 (no inset) up to but not including 1.`);
|
|
24
|
+
}
|
|
25
|
+
return value;
|
|
26
|
+
}
|
|
27
|
+
/** Check that the two insets along one axis leave something between them. */
|
|
28
|
+
function assertAxis(start, end, edges) {
|
|
29
|
+
if (start + end >= 1) {
|
|
30
|
+
throw new Error(`Invalid safeArea: ${edges} inset by ${String(start)} and ${String(end)}` +
|
|
31
|
+
` leave no room between them.`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A safe area with every edge filled in.
|
|
36
|
+
*
|
|
37
|
+
* Opposing edges are checked together as well as separately, since two
|
|
38
|
+
* fractions that are each perfectly reasonable can still meet in the middle.
|
|
39
|
+
*/
|
|
40
|
+
export function resolveSafeArea(safeArea) {
|
|
41
|
+
if (safeArea === undefined) {
|
|
42
|
+
return wholeImage;
|
|
43
|
+
}
|
|
44
|
+
const resolved = {
|
|
45
|
+
top: resolveEdge(safeArea.top, "top"),
|
|
46
|
+
right: resolveEdge(safeArea.right, "right"),
|
|
47
|
+
bottom: resolveEdge(safeArea.bottom, "bottom"),
|
|
48
|
+
left: resolveEdge(safeArea.left, "left"),
|
|
49
|
+
};
|
|
50
|
+
assertAxis(resolved.top, resolved.bottom, "top and bottom");
|
|
51
|
+
assertAxis(resolved.left, resolved.right, "left and right");
|
|
52
|
+
return resolved;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The safe area as a rectangle of the image it applies to.
|
|
56
|
+
*
|
|
57
|
+
* Sides are fractions of the width and the top and bottom are fractions of the
|
|
58
|
+
* height, so that one safe area describes the same crop whatever proportions
|
|
59
|
+
* the image has. A safe area of nothing returns the whole image, which is what
|
|
60
|
+
* makes this free to apply unconditionally.
|
|
61
|
+
*
|
|
62
|
+
* Both edges are rounded and the size taken from the difference, rather than
|
|
63
|
+
* rounding the two insets and subtracting them. It is the same sum until an
|
|
64
|
+
* inset lands on a half: YouTube's is `(1440 - 423) / 2`, so rounding the
|
|
65
|
+
* insets sends 508.5 up at the top and again at the bottom and gives back a
|
|
66
|
+
* band 422 tall where the platform published 423. Rounding a position is
|
|
67
|
+
* asking where an edge goes, which is the question; rounding an inset twice
|
|
68
|
+
* asks it once too often.
|
|
69
|
+
*/
|
|
70
|
+
export function safeRect(dimensions, safeArea) {
|
|
71
|
+
const { width, height } = dimensions;
|
|
72
|
+
const x = Math.round(width * safeArea.left);
|
|
73
|
+
const y = Math.round(height * safeArea.top);
|
|
74
|
+
return {
|
|
75
|
+
x,
|
|
76
|
+
y,
|
|
77
|
+
width: Math.round(width * (1 - safeArea.right)) - x,
|
|
78
|
+
height: Math.round(height * (1 - safeArea.bottom)) - y,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=safe-area.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safe-area.js","sourceRoot":"","sources":["../../src/config/safe-area.ts"],"names":[],"mappings":"AAGA,6EAA6E;AAC7E,MAAM,UAAU,GAAuB;IACrC,GAAG,EAAE,CAAC;IACN,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;IACT,IAAI,EAAE,CAAC;CACR,CAAC;AAEF;;;;;;;;GAQG;AACH,SAAS,WAAW,CAAC,KAAyB,EAAE,IAAY;IAC1D,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,CAAC,CAAC;IACX,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GA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AM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;IACrC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC5C,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;IAE5C,OAAO;QACL,CAAC;QACD,CAAC;QACD,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC;QACnD,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC;KACvD,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,
|
|
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,CAqBhB"}
|
package/dist/config/size.js
CHANGED
|
@@ -51,6 +51,7 @@ export function resolveConfigForSize(config, size) {
|
|
|
51
51
|
...(size.textureScale !== undefined && {
|
|
52
52
|
textureScale: size.textureScale,
|
|
53
53
|
}),
|
|
54
|
+
...(size.safeArea !== undefined && { safeArea: size.safeArea }),
|
|
54
55
|
...(size.code !== undefined && { code: { ...base.code, ...size.code } }),
|
|
55
56
|
...(size.background !== undefined && { background: size.background }),
|
|
56
57
|
...(size.fontFamily !== undefined && { fontFamily: size.fontFamily }),
|
package/dist/config/size.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"size.js","sourceRoot":"","sources":["../../src/config/size.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C;;;;;;;;;;;GAWG;AACH,SAAS,WAAW,CAClB,IAA6B,EAC7B,KAA4B,EAC5B,SAA+B;IAE/B,OAAO,EAAE,GAAG,CAAC,IAAI,IAAI,YAAY,CAAC,KAAK,CAAC,IAAI,cAAc,CAAC,EAAE,GAAG,SAAS,EAAE,CAAC;AAC9E,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,oBAAoB,CAClC,MAAkC,EAClC,IAAgB;IAEhB,MAAM,IAAI,GAAG,MAAM,IAAI,EAAE,CAAC;IAE1B,OAAO,aAAa,CAAC;QACnB,GAAG,IAAI;QACP,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;QACtD,GAAG,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,IAAI;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,E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,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"}
|
package/dist/core/index.d.ts
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* honours. Importing this entry point from Node gets the Node halves and works
|
|
23
23
|
* as the root entry point does.
|
|
24
24
|
*/
|
|
25
|
-
export type { Background, Badge, BrandColors, CodeStyle, ColophonConfig, ContentOptions, Dimensions, FontSource, GradientStop, ImageSource, MeasureText, MetaImageProps, MeshBlob, OutputFormat, OutputSize, Rasteriser, RenderedMetaImage, ResolvedConfig, Template, TemplateContext, Texture, TextStyle, ThemeName, WarningHandler, } from "../types.js";
|
|
25
|
+
export type { Background, Badge, BrandColors, CodeStyle, ColophonConfig, ContentOptions, Dimensions, FontSource, GradientStop, ImageSource, MeasureText, MetaImageProps, MeshBlob, OutputFormat, OutputSize, Rasteriser, RenderedMetaImage, ResolvedConfig, SafeArea, Template, TemplateContext, Texture, TextStyle, ThemeName, WarningHandler, } from "../types.js";
|
|
26
26
|
export { DEFAULT_CODE_FONT_FAMILY, DEFAULT_CODE_STYLE, DEFAULT_COLORS, DEFAULT_FONT_FAMILY, DEFAULT_SIZES, defineConfig, resolveConfig, SIZE_PRESETS, } from "../config/index.js";
|
|
27
27
|
export { resolveConfigForSize } from "../config/size.js";
|
|
28
28
|
export { buildSvg } from "../render/svg.js";
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG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B,GAClB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAoDA,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,YAAY,EACZ,aAAa,EACb,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,YAAY,GACb,MAAM,uBAAuB,CAAC;AAE/B,8EAA8E;AAC9E,4EAA4E;AAC5E,yEAAyE;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,4EAA4E;AAC5E,+EAA+E;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EACL,MAAM,EACN,UAAU,EACV,aAAa,EACb,eAAe,GAChB,MAAM,uBAAuB,CAAC;AAE/B,+EAA+E;AAC/E,kEAAkE;AAClE,OAAO,EACL,cAAc,EACd,UAAU,EACV,WAAW,EACX,YAAY,EACZ,iBAAiB,GAClB,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { FontSource } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* One font that ships with the package: always a file, and always with its
|
|
4
|
+
* family declared. Narrower than {@link FontSource} because both of those are
|
|
5
|
+
* true of every one of them, and a caller that has to prove a `path` is there
|
|
6
|
+
* before reading it would be proving something this module already knows.
|
|
7
|
+
*/
|
|
8
|
+
export type BundledFont = Extract<FontSource, {
|
|
9
|
+
readonly path: string;
|
|
10
|
+
}> & {
|
|
11
|
+
readonly family: string;
|
|
12
|
+
};
|
|
13
|
+
export { bundledFonts } from "../platform/bundled-fonts.node.js";
|
|
14
|
+
/**
|
|
15
|
+
* The fonts a build actually renders with: the project's own, and the ones
|
|
16
|
+
* that ship with the package behind them.
|
|
17
|
+
*
|
|
18
|
+
* The bundled fonts go last so that a project supplying its own is never
|
|
19
|
+
* argued with. Two things read the order and both keep the behaviour they had:
|
|
20
|
+
* `fallbackFamily` takes the first declared family, and the bundled fonts
|
|
21
|
+
* declare none, so a project's own font is still what resvg falls back to;
|
|
22
|
+
* and `faceFor` measures against the first face when system fonts are off,
|
|
23
|
+
* which is still the project's own where there is one and Outfit where there
|
|
24
|
+
* is not.
|
|
25
|
+
*
|
|
26
|
+
* This is deliberately not folded into `ResolvedConfig.fonts`. That field
|
|
27
|
+
* means what the project supplied, which is what makes it worth showing in an
|
|
28
|
+
* error message, and three things read it on that understanding: the rebuild
|
|
29
|
+
* stamp hashes it, `shouldLoadSystemFonts` counts it, and `fontFamily` takes
|
|
30
|
+
* its default from it. The bundled fonts change only when the package version
|
|
31
|
+
* does, and the version is in the stamp already.
|
|
32
|
+
*
|
|
33
|
+
* A custom {@link Rasteriser} that resolves font files itself wants this
|
|
34
|
+
* rather than `config.fonts`, or it will draw without the fonts the measurer
|
|
35
|
+
* measured with.
|
|
36
|
+
*/
|
|
37
|
+
export declare function withBundledFonts(fonts: readonly FontSource[]): readonly FontSource[];
|
|
38
|
+
//# sourceMappingURL=bundled.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundled.d.ts","sourceRoot":"","sources":["../../src/fonts/bundled.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,UAAU,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG;IACzE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,SAAS,UAAU,EAAE,GAC3B,SAAS,UAAU,EAAE,CAEvB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { bundledFonts } from "../platform/bundled-fonts.node.js";
|
|
2
|
+
export { bundledFonts } from "../platform/bundled-fonts.node.js";
|
|
3
|
+
/**
|
|
4
|
+
* The fonts a build actually renders with: the project's own, and the ones
|
|
5
|
+
* that ship with the package behind them.
|
|
6
|
+
*
|
|
7
|
+
* The bundled fonts go last so that a project supplying its own is never
|
|
8
|
+
* argued with. Two things read the order and both keep the behaviour they had:
|
|
9
|
+
* `fallbackFamily` takes the first declared family, and the bundled fonts
|
|
10
|
+
* declare none, so a project's own font is still what resvg falls back to;
|
|
11
|
+
* and `faceFor` measures against the first face when system fonts are off,
|
|
12
|
+
* which is still the project's own where there is one and Outfit where there
|
|
13
|
+
* is not.
|
|
14
|
+
*
|
|
15
|
+
* This is deliberately not folded into `ResolvedConfig.fonts`. That field
|
|
16
|
+
* means what the project supplied, which is what makes it worth showing in an
|
|
17
|
+
* error message, and three things read it on that understanding: the rebuild
|
|
18
|
+
* stamp hashes it, `shouldLoadSystemFonts` counts it, and `fontFamily` takes
|
|
19
|
+
* its default from it. The bundled fonts change only when the package version
|
|
20
|
+
* does, and the version is in the stamp already.
|
|
21
|
+
*
|
|
22
|
+
* A custom {@link Rasteriser} that resolves font files itself wants this
|
|
23
|
+
* rather than `config.fonts`, or it will draw without the fonts the measurer
|
|
24
|
+
* measured with.
|
|
25
|
+
*/
|
|
26
|
+
export function withBundledFonts(fonts) {
|
|
27
|
+
return [...fonts, ...bundledFonts()];
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=bundled.js.map
|