@kensio/colophon 2.4.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.
- package/README.md +48 -0
- package/dist/background/gradient.d.ts +12 -0
- package/dist/background/gradient.d.ts.map +1 -0
- package/dist/background/gradient.js +21 -0
- package/dist/background/gradient.js.map +1 -0
- package/dist/background/image.d.ts +14 -0
- package/dist/background/image.d.ts.map +1 -0
- package/dist/background/image.js +36 -0
- package/dist/background/image.js.map +1 -0
- package/dist/background/index.d.ts +13 -0
- package/dist/background/index.d.ts.map +1 -0
- package/dist/background/index.js +27 -0
- package/dist/background/index.js.map +1 -0
- package/dist/background/mesh.d.ts +12 -0
- package/dist/background/mesh.d.ts.map +1 -0
- package/dist/background/mesh.js +43 -0
- package/dist/background/mesh.js.map +1 -0
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +9 -2
- package/dist/config/index.js.map +1 -1
- package/dist/config/size.d.ts +6 -0
- package/dist/config/size.d.ts.map +1 -1
- package/dist/config/size.js +20 -8
- package/dist/config/size.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/render/svg.d.ts.map +1 -1
- package/dist/render/svg.js +9 -2
- package/dist/render/svg.js.map +1 -1
- package/dist/stamp/config-digest.d.ts.map +1 -1
- package/dist/stamp/config-digest.js +1 -0
- package/dist/stamp/config-digest.js.map +1 -1
- package/dist/templates/banner/badge-props.d.ts +16 -0
- package/dist/templates/banner/badge-props.d.ts.map +1 -0
- package/dist/templates/banner/badge-props.js +58 -0
- package/dist/templates/banner/badge-props.js.map +1 -0
- package/dist/templates/banner/index.d.ts.map +1 -1
- package/dist/templates/banner/index.js +6 -4
- package/dist/templates/banner/index.js.map +1 -1
- package/dist/texture/grain.d.ts +17 -0
- package/dist/texture/grain.d.ts.map +1 -0
- package/dist/texture/grain.js +29 -0
- package/dist/texture/grain.js.map +1 -0
- package/dist/texture/index.d.ts +11 -0
- package/dist/texture/index.d.ts.map +1 -0
- package/dist/texture/index.js +20 -0
- package/dist/texture/index.js.map +1 -0
- package/dist/texture/pattern.d.ts +17 -0
- package/dist/texture/pattern.d.ts.map +1 -0
- package/dist/texture/pattern.js +45 -0
- package/dist/texture/pattern.js.map +1 -0
- package/dist/texture/resolve.d.ts +16 -0
- package/dist/texture/resolve.d.ts.map +1 -0
- package/dist/texture/resolve.js +20 -0
- package/dist/texture/resolve.js.map +1 -0
- package/dist/theme/index.d.ts +27 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +41 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/theme/presets.d.ts +38 -0
- package/dist/theme/presets.d.ts.map +1 -0
- package/dist/theme/presets.js +150 -0
- package/dist/theme/presets.js.map +1 -0
- package/dist/types.d.ts +123 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/validate/background.d.ts +12 -0
- package/dist/validate/background.d.ts.map +1 -0
- package/dist/validate/background.js +53 -0
- package/dist/validate/background.js.map +1 -0
- package/dist/validate/collect.d.ts +9 -0
- package/dist/validate/collect.d.ts.map +1 -0
- package/dist/validate/collect.js +34 -0
- package/dist/validate/collect.js.map +1 -0
- package/dist/validate/index.d.ts.map +1 -1
- package/dist/validate/index.js +2 -20
- package/dist/validate/index.js.map +1 -1
- package/dist/validate/keys.d.ts +16 -0
- package/dist/validate/keys.d.ts.map +1 -1
- package/dist/validate/keys.js +52 -0
- package/dist/validate/keys.js.map +1 -1
- package/dist/validate/overrides.d.ts.map +1 -1
- package/dist/validate/overrides.js +5 -1
- package/dist/validate/overrides.js.map +1 -1
- package/dist/validate/texture.d.ts +11 -0
- package/dist/validate/texture.d.ts.map +1 -0
- package/dist/validate/texture.js +34 -0
- package/dist/validate/texture.js.map +1 -0
- package/dist/validate/values.d.ts +10 -10
- package/dist/validate/values.d.ts.map +1 -1
- package/dist/validate/values.js +21 -45
- package/dist/validate/values.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,6 +24,8 @@ work.
|
|
|
24
24
|
frontmatter with real VS Code theme colours.
|
|
25
25
|
- **Configurable branding.** Colours, gradient, fonts, footer and badge come from
|
|
26
26
|
config, not from any one site's stylesheet.
|
|
27
|
+
- **Themes.** Eight named looks, or your own colours with a mesh, grain, a dot
|
|
28
|
+
grid or ruled lines over them.
|
|
27
29
|
- **Multiple sizes from one input.** A 1:1 square and a 1.91:1 landscape by
|
|
28
30
|
default, or whatever set you configure.
|
|
29
31
|
- **Manifest and meta tags.** A JSON record of what was generated, and the Open
|
|
@@ -92,6 +94,7 @@ Full documentation is in [`docs/`](./docs/).
|
|
|
92
94
|
- [Templates](./docs/templates/ "The built-in layouts and how to register your own")
|
|
93
95
|
- [The code template](./docs/code-template/ "Syntax-highlighted code images")
|
|
94
96
|
- [The layout toolkit](./docs/layout/ "The primitives templates are built from")
|
|
97
|
+
- [Themes and background treatments](./docs/configuration/themes/ "Named looks, meshes, grain, dots and rules")
|
|
95
98
|
- [Logos and photographs](./docs/configuration/images/ "Branding an image with a logo, avatar or background photo")
|
|
96
99
|
- [Configuration](./docs/configuration/ "Every option, and what happens to an unknown one")
|
|
97
100
|
- [Rebuilds](./docs/rebuilds/ "How Colophon decides what to render again")
|
|
@@ -137,6 +140,51 @@ updated PNGs so this gallery stays in sync.
|
|
|
137
140
|
</tr>
|
|
138
141
|
</table>
|
|
139
142
|
|
|
143
|
+
### Themes
|
|
144
|
+
|
|
145
|
+
One line of config each: `theme: "midnight"`. See
|
|
146
|
+
[Themes and background treatments](./docs/configuration/themes/) for what a
|
|
147
|
+
theme sets and how to override part of one.
|
|
148
|
+
|
|
149
|
+
<table>
|
|
150
|
+
<tr>
|
|
151
|
+
<td width="25%">
|
|
152
|
+
<img src="docs/samples/theme-midnight.png" alt="midnight theme" width="100%" /><br />
|
|
153
|
+
<sub><code>midnight</code></sub>
|
|
154
|
+
</td>
|
|
155
|
+
<td width="25%">
|
|
156
|
+
<img src="docs/samples/theme-aurora.png" alt="aurora theme" width="100%" /><br />
|
|
157
|
+
<sub><code>aurora</code></sub>
|
|
158
|
+
</td>
|
|
159
|
+
<td width="25%">
|
|
160
|
+
<img src="docs/samples/theme-ember.png" alt="ember theme" width="100%" /><br />
|
|
161
|
+
<sub><code>ember</code></sub>
|
|
162
|
+
</td>
|
|
163
|
+
<td width="25%">
|
|
164
|
+
<img src="docs/samples/theme-forest.png" alt="forest theme" width="100%" /><br />
|
|
165
|
+
<sub><code>forest</code></sub>
|
|
166
|
+
</td>
|
|
167
|
+
</tr>
|
|
168
|
+
<tr>
|
|
169
|
+
<td>
|
|
170
|
+
<img src="docs/samples/theme-bloom.png" alt="bloom theme" width="100%" /><br />
|
|
171
|
+
<sub><code>bloom</code></sub>
|
|
172
|
+
</td>
|
|
173
|
+
<td>
|
|
174
|
+
<img src="docs/samples/theme-slate.png" alt="slate theme" width="100%" /><br />
|
|
175
|
+
<sub><code>slate</code></sub>
|
|
176
|
+
</td>
|
|
177
|
+
<td>
|
|
178
|
+
<img src="docs/samples/theme-paper.png" alt="paper theme" width="100%" /><br />
|
|
179
|
+
<sub><code>paper</code></sub>
|
|
180
|
+
</td>
|
|
181
|
+
<td>
|
|
182
|
+
<img src="docs/samples/theme-sandstone.png" alt="sandstone theme" width="100%" /><br />
|
|
183
|
+
<sub><code>sandstone</code></sub>
|
|
184
|
+
</td>
|
|
185
|
+
</tr>
|
|
186
|
+
</table>
|
|
187
|
+
|
|
140
188
|
## Development
|
|
141
189
|
|
|
142
190
|
| Script | What it does |
|
|
@@ -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,EACd,UAAsB,EACtB,EAAU;IAEV,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;IACrC,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,aAAa,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACxE,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,CAAC,CAAC;IAElC,MAAM,GAAG,GACP,uBAAuB,EAAE,kCAAkC;QAC3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
CHANGED
|
@@ -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(
|
|
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":"
|
|
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"}
|
package/dist/config/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { resolveFonts } from "../fonts/index.js";
|
|
2
2
|
import { resolveOptionalImage } from "../image/index.js";
|
|
3
3
|
import { builtinTemplates } from "../templates/index.js";
|
|
4
|
+
import { applyTheme } from "../theme/index.js";
|
|
5
|
+
import { resolveTexture } from "../texture/index.js";
|
|
4
6
|
import { validateConfig } from "../validate/index.js";
|
|
5
7
|
import { DEFAULT_FONT_FAMILY } from "./defaults.js";
|
|
6
8
|
import { defaultBackground, resolveBackground, resolveCode, resolveColors, resolveSizes, shouldLoadSystemFonts, } from "./resolve.js";
|
|
@@ -31,13 +33,18 @@ export function defineConfig(config) {
|
|
|
31
33
|
* written against a different version of the package is a build error rather
|
|
32
34
|
* than a set of images quietly rendered with the defaults.
|
|
33
35
|
*/
|
|
34
|
-
export function resolveConfig(
|
|
35
|
-
validateConfig(
|
|
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);
|
|
36
42
|
const colors = resolveColors(config.colors);
|
|
37
43
|
const fonts = resolveFonts(config.fonts);
|
|
38
44
|
return {
|
|
39
45
|
colors,
|
|
40
46
|
background: resolveBackground(config.background) ?? defaultBackground(colors),
|
|
47
|
+
texture: resolveTexture(config.texture, colors),
|
|
41
48
|
fonts,
|
|
42
49
|
systemFonts: shouldLoadSystemFonts(config.systemFonts, fonts),
|
|
43
50
|
// 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,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;
|
|
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,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;A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AqE;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"}
|
package/dist/config/size.d.ts
CHANGED
|
@@ -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,
|
|
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"}
|
package/dist/config/size.js
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
|
+
import { themePalette } from "../theme/index.js";
|
|
1
2
|
import { DEFAULT_COLORS } from "./defaults.js";
|
|
2
3
|
import { resolveConfig } from "./index.js";
|
|
3
4
|
/**
|
|
4
5
|
* Merge a size's colour overrides onto the config's.
|
|
5
6
|
*
|
|
6
|
-
* A size may name any single shade, so the merge starts from
|
|
7
|
-
*
|
|
8
|
-
* instead would hand `resolveColors` a lone `foreground`, and its
|
|
9
|
-
* bare `brand` colours the whole gradient would then flatten the
|
|
10
|
-
* gradient, so a size asking only for darker text would silently lose
|
|
7
|
+
* A size may name any single shade, so the merge starts from a full palette:
|
|
8
|
+
* the config's, else the theme in force, else the neutral default. Starting
|
|
9
|
+
* from nothing instead would hand `resolveColors` a lone `foreground`, and its
|
|
10
|
+
* rule that a bare `brand` colours the whole gradient would then flatten the
|
|
11
|
+
* default gradient, so a size asking only for darker text would silently lose
|
|
12
|
+
* it. Taking the theme's palette matters for the same reason: without it a
|
|
13
|
+
* size changing one shade of a themed config would drop the other three back
|
|
14
|
+
* to the default indigo.
|
|
11
15
|
*/
|
|
12
|
-
function mergeColors(base, overrides) {
|
|
13
|
-
return { ...(base ?? DEFAULT_COLORS), ...overrides };
|
|
16
|
+
function mergeColors(base, theme, overrides) {
|
|
17
|
+
return { ...(base ?? themePalette(theme) ?? DEFAULT_COLORS), ...overrides };
|
|
14
18
|
}
|
|
15
19
|
/**
|
|
16
20
|
* Apply a size's own overrides to a config and resolve the result: the config
|
|
@@ -28,14 +32,22 @@ function mergeColors(base, overrides) {
|
|
|
28
32
|
* different keys, so half of one over half of another is not a background at
|
|
29
33
|
* all, and `badge` carries a required `text` that a partial override could not
|
|
30
34
|
* supply.
|
|
35
|
+
*
|
|
36
|
+
* A size's `theme` replaces the config's, and then applies exactly as it would
|
|
37
|
+
* at the top level: as defaults, under anything the config names outright. So
|
|
38
|
+
* a config with its own `background` keeps it whatever theme a size asks for,
|
|
39
|
+
* and a size wanting the whole look of one has the same answer a config does,
|
|
40
|
+
* which is to stop naming the fields it wants the theme to fill in.
|
|
31
41
|
*/
|
|
32
42
|
export function resolveConfigForSize(config, size) {
|
|
33
43
|
const base = config ?? {};
|
|
34
44
|
return resolveConfig({
|
|
35
45
|
...base,
|
|
46
|
+
...(size.theme !== undefined && { theme: size.theme }),
|
|
36
47
|
...(size.colors !== undefined && {
|
|
37
|
-
colors: mergeColors(base.colors, size.colors),
|
|
48
|
+
colors: mergeColors(base.colors, size.theme ?? base.theme, size.colors),
|
|
38
49
|
}),
|
|
50
|
+
...(size.texture !== undefined && { texture: size.texture }),
|
|
39
51
|
...(size.code !== undefined && { code: { ...base.code, ...size.code } }),
|
|
40
52
|
...(size.background !== undefined && { background: size.background }),
|
|
41
53
|
...(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":"
|
|
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,YA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,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;KACpD,CAAC,CAAC;AACL,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export type { Background, Badge, BrandColors, CodeStyle, ColophonConfig, ColophonConfigFactory, ColophonConfigInput, ContentFile, ContentOptions, Dimensions, ExtraImage, FontSource, GradientStop, Manifest, ManifestImage, ManifestPage, MetaImageProps, MeasureText, MetaTag, MetaTagOptions, OutputSize, Placement, PropsFromFrontmatter, RenderedMetaImage, SlugStrategy, SizeOverrides, ResolvedConfig, Template, TemplateContext, TextStyle, WarningHandler, } from "./types.js";
|
|
1
|
+
export type { Background, Badge, BrandColors, CodeStyle, ColophonConfig, ColophonConfigFactory, ColophonConfigInput, ContentFile, ContentOptions, Dimensions, ExtraImage, FontSource, GradientStop, Manifest, ManifestImage, ManifestPage, MeshBlob, MetaImageProps, MeasureText, MetaTag, MetaTagOptions, OutputSize, Placement, PropsFromFrontmatter, RenderedMetaImage, SlugStrategy, SizeOverrides, ResolvedConfig, Template, TemplateContext, Texture, TextStyle, ThemeName, WarningHandler, } from "./types.js";
|
|
2
2
|
export { DEFAULT_CODE_FONT_FAMILY, DEFAULT_CODE_STYLE, DEFAULT_COLORS, DEFAULT_FONT_FAMILY, DEFAULT_SIZES, defineConfig, resolveConfig, SIZE_PRESETS, } from "./config/index.js";
|
|
3
3
|
export { resolveConfigForSize } from "./config/size.js";
|
|
4
|
-
export { backgroundSvg } from "./background.js";
|
|
4
|
+
export { backgroundSvg } from "./background/index.js";
|
|
5
|
+
export { textureSvg } from "./texture/index.js";
|
|
5
6
|
export { buildSvg, renderMetaImages, renderSvgToPng } from "./render/index.js";
|
|
6
7
|
export { bannerTemplate, builtinTemplates, cardTemplate, codeTemplate, } from "./templates/index.js";
|
|
7
8
|
export { dedent, expandTabs, highlightCode, resolveLanguage, } from "./highlight/index.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,KAAK,EACL,WAAW,EACX,SAAS,EACT,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACnB,WAAW,EACX,cAAc,EACd,UAAU,EACV,UAAU,EACV,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,cAAc,EACd,WAAW,EACX,OAAO,EACP,cAAc,EACd,UAAU,EACV,SAAS,EACT,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,QAAQ,EACR,eAAe,EACf,SAAS,EACT,cAAc,GACf,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,YAAY,EACZ,aAAa,EACb,YAAY,GACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,KAAK,EACL,WAAW,EACX,SAAS,EACT,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACnB,WAAW,EACX,cAAc,EACd,UAAU,EACV,UAAU,EACV,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,cAAc,EACd,WAAW,EACX,OAAO,EACP,cAAc,EACd,UAAU,EACV,SAAS,EACT,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,cAAc,EACd,QAAQ,EACR,eAAe,EACf,OAAO,EACP,SAAS,EACT,SAAS,EACT,cAAc,GACf,MAAM,YAAY,CAAC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,GAAG,EACH,KAAK,EACL,KAAK,GACN,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,KAAK,EACL,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,UAAU,EACV,MAAM,EACN,UAAU,EACV,UAAU,EACV,IAAI,EACJ,OAAO,EACP,YAAY,EACZ,IAAI,EACJ,WAAW,EACX,WAAW,EACX,SAAS,EACT,QAAQ,GACT,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC7E,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { DEFAULT_CODE_FONT_FAMILY, DEFAULT_CODE_STYLE, DEFAULT_COLORS, DEFAULT_FONT_FAMILY, DEFAULT_SIZES, defineConfig, resolveConfig, SIZE_PRESETS, } from "./config/index.js";
|
|
2
2
|
export { resolveConfigForSize } from "./config/size.js";
|
|
3
|
-
export { backgroundSvg } from "./background.js";
|
|
3
|
+
export { backgroundSvg } from "./background/index.js";
|
|
4
|
+
export { textureSvg } from "./texture/index.js";
|
|
4
5
|
export { buildSvg, renderMetaImages, renderSvgToPng } from "./render/index.js";
|
|
5
6
|
export { bannerTemplate, builtinTemplates, cardTemplate, codeTemplate, } from "./templates/index.js";
|
|
6
7
|
export { dedent, expandTabs, highlightCode, resolveLanguage, } from "./highlight/index.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file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AAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/render/svg.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svg.d.ts","sourceRoot":"","sources":["../../src/render/svg.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"svg.d.ts","sourceRoot":"","sources":["../../src/render/svg.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAM9E;;;;;;;;GAQG;AACH,wBAAsB,QAAQ,CAC5B,KAAK,EAAE,cAAc,EACrB,MAAM,EAAE,cAAc,EACtB,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,MAAM,CAAC,CAkCjB"}
|
package/dist/render/svg.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { backgroundSvg } from "../background.js";
|
|
1
|
+
import { backgroundSvg } from "../background/index.js";
|
|
2
2
|
import { loadImages } from "../image/index.js";
|
|
3
3
|
import { createMeasurer } from "../measure/index.js";
|
|
4
|
+
import { textureSvg } from "../texture/index.js";
|
|
4
5
|
import { selectTemplate } from "./template.js";
|
|
5
6
|
const backgroundId = "colophon-bg";
|
|
7
|
+
const textureId = "colophon-texture";
|
|
6
8
|
/**
|
|
7
9
|
* Build the complete SVG document for one image: the enclosing `<svg>` root,
|
|
8
10
|
* the config-driven background, and the template's foreground content.
|
|
@@ -19,6 +21,11 @@ export async function buildSvg(props, config, dimensions) {
|
|
|
19
21
|
loadImages(config, props),
|
|
20
22
|
]);
|
|
21
23
|
const background = backgroundSvg(config.background, dimensions, backgroundId, images.background);
|
|
24
|
+
// Over the background and under the template, so that a treatment gives the
|
|
25
|
+
// background some surface without ever coming between text and reader.
|
|
26
|
+
const texture = config.texture === undefined
|
|
27
|
+
? ""
|
|
28
|
+
: textureSvg(config.texture, dimensions, textureId);
|
|
22
29
|
const body = await template.render({
|
|
23
30
|
props,
|
|
24
31
|
config,
|
|
@@ -30,6 +37,6 @@ export async function buildSvg(props, config, dimensions) {
|
|
|
30
37
|
const { width, height } = dimensions;
|
|
31
38
|
return (`<svg width="${String(width)}" height="${String(height)}"` +
|
|
32
39
|
` viewBox="0 0 ${String(width)} ${String(height)}"` +
|
|
33
|
-
` xmlns="http://www.w3.org/2000/svg">${background}${body}</svg>`);
|
|
40
|
+
` xmlns="http://www.w3.org/2000/svg">${background}${texture}${body}</svg>`);
|
|
34
41
|
}
|
|
35
42
|
//# sourceMappingURL=svg.js.map
|
package/dist/render/svg.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svg.js","sourceRoot":"","sources":["../../src/render/svg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,
|
|
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,MAAM,CAAC,IAAI;QACjB,MAAM,EAAE,MAAM,CAAC,MAAM;KACtB,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-digest.d.ts","sourceRoot":"","sources":["../../src/stamp/config-digest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAIV,cAAc,EACf,MAAM,aAAa,CAAC;AA6CrB;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"config-digest.d.ts","sourceRoot":"","sources":["../../src/stamp/config-digest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAIV,cAAc,EACf,MAAM,aAAa,CAAC;AA6CrB;;;;;;;GAOG;AACH,wBA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AC,SAAS,CAAC,CAAC,CAAC,MAAM,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAEzE,OAAO,MAAM,CACX,eAAe,CAAC;QACd,OAAO,EAAE,MAAM,cAAc,EAAE;QAC/B,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,UAAU,EAAE,MAAM,gBAAgB,CAAC,MAAM,CAAC,UAAU,CAAC;QACrD,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,KAAK;QACL,IAAI;QACJ,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,IAAI,EAAE,MAAM,CAAC,IAAI;KAClB,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Badge, MetaImageProps, ResolvedConfig } from "../../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* The badge to draw: the one the post declares, or the configured one where it
|
|
4
|
+
* declares nothing.
|
|
5
|
+
*
|
|
6
|
+
* A badge in config is the same badge on every image a site renders, and a
|
|
7
|
+
* post the badge does not describe has no other way to be rid of it. `false`
|
|
8
|
+
* is that way out, and an object is the same door in the other direction, so a
|
|
9
|
+
* post can carry a badge of its own without the config knowing about it.
|
|
10
|
+
*
|
|
11
|
+
* Anything else is a mistake in the frontmatter. It is reported and the
|
|
12
|
+
* configured badge is drawn, which leaves the post with the image it would
|
|
13
|
+
* have had if it had said nothing at all.
|
|
14
|
+
*/
|
|
15
|
+
export declare function badgeFor(props: MetaImageProps, config: ResolvedConfig): Badge | undefined;
|
|
16
|
+
//# sourceMappingURL=badge-props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"badge-props.d.ts","sourceRoot":"","sources":["../../../src/templates/banner/badge-props.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAgC5E;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,cAAc,EACrB,MAAM,EAAE,cAAc,GACrB,KAAK,GAAG,SAAS,CA6BnB"}
|