@kensio/colophon 2.3.0 → 2.4.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 +62 -801
- package/dist/background.d.ts +7 -2
- package/dist/background.d.ts.map +1 -1
- package/dist/background.js +44 -1
- package/dist/background.js.map +1 -1
- package/dist/cli/args.d.ts +1 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +1 -1
- package/dist/cli/config.d.ts +1 -1
- package/dist/cli/config.js +1 -1
- package/dist/config/defaults.d.ts +8 -7
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +8 -8
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +5 -3
- package/dist/config/index.js.map +1 -1
- package/dist/config/resolve.d.ts +7 -0
- package/dist/config/resolve.d.ts.map +1 -1
- package/dist/config/resolve.js +16 -0
- package/dist/config/resolve.js.map +1 -1
- package/dist/config/size.d.ts +1 -1
- package/dist/config/size.d.ts.map +1 -1
- package/dist/config/size.js +3 -2
- package/dist/config/size.js.map +1 -1
- package/dist/content/props.d.ts +2 -2
- package/dist/content/props.js +2 -2
- package/dist/content/slug.d.ts +5 -5
- package/dist/content/slug.js +6 -6
- package/dist/content/slug.js.map +1 -1
- package/dist/content/walk.d.ts +1 -1
- package/dist/content/walk.js +1 -1
- package/dist/fonts/index.d.ts +3 -2
- package/dist/fonts/index.d.ts.map +1 -1
- package/dist/fonts/index.js +3 -2
- package/dist/fonts/index.js.map +1 -1
- package/dist/fonts/resolve.js +1 -1
- package/dist/generate/extra.js +4 -4
- package/dist/generate/extra.js.map +1 -1
- package/dist/generate/options.d.ts +1 -1
- package/dist/generate/outputs.d.ts +4 -4
- package/dist/generate/outputs.js +4 -4
- package/dist/highlight/language.d.ts +2 -3
- package/dist/highlight/language.d.ts.map +1 -1
- package/dist/highlight/language.js +3 -4
- package/dist/highlight/language.js.map +1 -1
- package/dist/highlight/normalise.d.ts +2 -2
- package/dist/highlight/normalise.js +2 -2
- package/dist/image/index.d.ts +18 -0
- package/dist/image/index.d.ts.map +1 -0
- package/dist/image/index.js +42 -0
- package/dist/image/index.js.map +1 -0
- package/dist/image/jpeg.d.ts +10 -0
- package/dist/image/jpeg.d.ts.map +1 -0
- package/dist/image/jpeg.js +57 -0
- package/dist/image/jpeg.js.map +1 -0
- package/dist/image/load.d.ts +4 -0
- package/dist/image/load.d.ts.map +1 -0
- package/dist/image/load.js +60 -0
- package/dist/image/load.js.map +1 -0
- package/dist/image/media.d.ts +10 -0
- package/dist/image/media.d.ts.map +1 -0
- package/dist/image/media.js +37 -0
- package/dist/image/media.js.map +1 -0
- package/dist/image/resolve.d.ts +13 -0
- package/dist/image/resolve.d.ts.map +1 -0
- package/dist/image/resolve.js +38 -0
- package/dist/image/resolve.js.map +1 -0
- package/dist/image/size.d.ts +22 -0
- package/dist/image/size.d.ts.map +1 -0
- package/dist/image/size.js +60 -0
- package/dist/image/size.js.map +1 -0
- package/dist/image/svg.d.ts +12 -0
- package/dist/image/svg.d.ts.map +1 -0
- package/dist/image/svg.js +61 -0
- package/dist/image/svg.js.map +1 -0
- package/dist/image/uri.d.ts +9 -0
- package/dist/image/uri.d.ts.map +1 -0
- package/dist/image/uri.js +22 -0
- package/dist/image/uri.js.map +1 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/layout/block.d.ts +37 -0
- package/dist/layout/block.d.ts.map +1 -0
- package/dist/layout/block.js +26 -0
- package/dist/layout/block.js.map +1 -0
- package/dist/layout/box.d.ts +20 -0
- package/dist/layout/box.d.ts.map +1 -0
- package/dist/layout/box.js +61 -0
- package/dist/layout/box.js.map +1 -0
- package/dist/layout/distribute.d.ts +15 -0
- package/dist/layout/distribute.d.ts.map +1 -0
- package/dist/layout/distribute.js +30 -0
- package/dist/layout/distribute.js.map +1 -0
- package/dist/layout/image.d.ts +42 -0
- package/dist/layout/image.d.ts.map +1 -0
- package/dist/layout/image.js +34 -0
- package/dist/layout/image.js.map +1 -0
- package/dist/layout/index.d.ts +40 -0
- package/dist/layout/index.d.ts.map +1 -0
- package/dist/layout/index.js +30 -0
- package/dist/layout/index.js.map +1 -0
- package/dist/layout/lines.d.ts +45 -0
- package/dist/layout/lines.d.ts.map +1 -0
- package/dist/layout/lines.js +71 -0
- package/dist/layout/lines.js.map +1 -0
- package/dist/layout/measure.d.ts +11 -0
- package/dist/layout/measure.d.ts.map +1 -0
- package/dist/layout/measure.js +11 -0
- package/dist/layout/measure.js.map +1 -0
- package/dist/layout/panel.d.ts +20 -0
- package/dist/layout/panel.d.ts.map +1 -0
- package/dist/layout/panel.js +22 -0
- package/dist/layout/panel.js.map +1 -0
- package/dist/layout/row.d.ts +15 -0
- package/dist/layout/row.d.ts.map +1 -0
- package/dist/layout/row.js +20 -0
- package/dist/layout/row.js.map +1 -0
- package/dist/layout/scrim.d.ts +23 -0
- package/dist/layout/scrim.d.ts.map +1 -0
- package/dist/layout/scrim.js +38 -0
- package/dist/layout/scrim.js.map +1 -0
- package/dist/layout/stack.d.ts +14 -0
- package/dist/layout/stack.d.ts.map +1 -0
- package/dist/layout/stack.js +19 -0
- package/dist/layout/stack.js.map +1 -0
- package/dist/layout/types.d.ts +49 -0
- package/dist/layout/types.d.ts.map +1 -0
- package/dist/layout/types.js +2 -0
- package/dist/layout/types.js.map +1 -0
- package/dist/manifest/build.d.ts +1 -1
- package/dist/manifest/build.js +1 -1
- package/dist/manifest/index.d.ts +1 -1
- package/dist/manifest/index.js +1 -1
- package/dist/manifest/order.d.ts +1 -1
- package/dist/manifest/order.js +1 -1
- package/dist/manifest/page.d.ts +2 -2
- package/dist/manifest/page.js +3 -3
- package/dist/measure/estimate.d.ts +10 -0
- package/dist/measure/estimate.d.ts.map +1 -0
- package/dist/measure/estimate.js +58 -0
- package/dist/measure/estimate.js.map +1 -0
- package/dist/measure/faces.d.ts +15 -0
- package/dist/measure/faces.d.ts.map +1 -0
- package/dist/measure/faces.js +70 -0
- package/dist/measure/faces.js.map +1 -0
- package/dist/measure/index.d.ts +16 -0
- package/dist/measure/index.d.ts.map +1 -0
- package/dist/measure/index.js +0 -0
- package/dist/measure/index.js.map +1 -0
- package/dist/measure/runs.d.ts +17 -0
- package/dist/measure/runs.d.ts.map +1 -0
- package/dist/measure/runs.js +39 -0
- package/dist/measure/runs.js.map +1 -0
- package/dist/measure/select.d.ts +13 -0
- package/dist/measure/select.d.ts.map +1 -0
- package/dist/measure/select.js +47 -0
- package/dist/measure/select.js.map +1 -0
- package/dist/meta/tags.d.ts +6 -6
- package/dist/meta/tags.js +6 -6
- package/dist/meta/url.d.ts +4 -4
- package/dist/meta/url.js +4 -4
- package/dist/placement/check.d.ts +1 -1
- package/dist/placement/check.js +1 -1
- package/dist/placement/index.js +1 -1
- package/dist/placement/relative.d.ts +3 -3
- package/dist/placement/relative.js +3 -3
- package/dist/pool.d.ts +2 -2
- package/dist/pool.js +3 -3
- package/dist/pool.js.map +1 -1
- package/dist/props.d.ts +7 -0
- package/dist/props.d.ts.map +1 -0
- package/dist/props.js +17 -0
- package/dist/props.js.map +1 -0
- package/dist/render/svg.d.ts +4 -2
- package/dist/render/svg.d.ts.map +1 -1
- package/dist/render/svg.js +19 -4
- package/dist/render/svg.js.map +1 -1
- package/dist/stamp/config-digest.d.ts.map +1 -1
- package/dist/stamp/config-digest.js +20 -1
- package/dist/stamp/config-digest.js.map +1 -1
- package/dist/stamp/index.js +2 -2
- package/dist/stamp/index.js.map +1 -1
- package/dist/stamp/read.d.ts +1 -1
- package/dist/stamp/read.js +4 -4
- package/dist/templates/attribution.d.ts +17 -0
- package/dist/templates/attribution.d.ts.map +1 -0
- package/dist/templates/attribution.js +39 -0
- package/dist/templates/attribution.js.map +1 -0
- package/dist/templates/banner/badge.d.ts.map +1 -1
- package/dist/templates/banner/badge.js +3 -6
- package/dist/templates/banner/badge.js.map +1 -1
- package/dist/templates/banner/index.d.ts +3 -0
- package/dist/templates/banner/index.d.ts.map +1 -1
- package/dist/templates/banner/index.js +37 -35
- package/dist/templates/banner/index.js.map +1 -1
- package/dist/templates/banner/lines.d.ts +7 -12
- package/dist/templates/banner/lines.d.ts.map +1 -1
- package/dist/templates/banner/lines.js +23 -34
- package/dist/templates/banner/lines.js.map +1 -1
- package/dist/templates/banner/version.d.ts +9 -0
- package/dist/templates/banner/version.d.ts.map +1 -0
- package/dist/templates/banner/version.js +21 -0
- package/dist/templates/banner/version.js.map +1 -0
- package/dist/templates/card/index.d.ts +4 -1
- package/dist/templates/card/index.d.ts.map +1 -1
- package/dist/templates/card/index.js +37 -25
- package/dist/templates/card/index.js.map +1 -1
- package/dist/templates/card/lines.d.ts +17 -13
- package/dist/templates/card/lines.d.ts.map +1 -1
- package/dist/templates/card/lines.js +24 -20
- package/dist/templates/card/lines.js.map +1 -1
- package/dist/templates/code/chrome.d.ts +7 -3
- package/dist/templates/code/chrome.d.ts.map +1 -1
- package/dist/templates/code/chrome.js +12 -11
- package/dist/templates/code/chrome.js.map +1 -1
- package/dist/templates/code/clip.d.ts +1 -1
- package/dist/templates/code/clip.js +1 -1
- package/dist/templates/code/fit.d.ts +2 -2
- package/dist/templates/code/fit.d.ts.map +1 -1
- package/dist/templates/code/fit.js +4 -4
- package/dist/templates/code/fit.js.map +1 -1
- package/dist/templates/code/index.d.ts.map +1 -1
- package/dist/templates/code/index.js +7 -6
- package/dist/templates/code/index.js.map +1 -1
- package/dist/templates/code/layout.d.ts +1 -1
- package/dist/templates/code/layout.d.ts.map +1 -1
- package/dist/templates/code/layout.js +6 -6
- package/dist/templates/code/layout.js.map +1 -1
- package/dist/templates/code/panel.d.ts +13 -0
- package/dist/templates/code/panel.d.ts.map +1 -1
- package/dist/templates/code/panel.js +34 -2
- package/dist/templates/code/panel.js.map +1 -1
- package/dist/templates/code/plate.d.ts +3 -1
- package/dist/templates/code/plate.d.ts.map +1 -1
- package/dist/templates/code/plate.js +11 -9
- package/dist/templates/code/plate.js.map +1 -1
- package/dist/templates/code/spans.js +1 -1
- package/dist/templates/code/spans.js.map +1 -1
- package/dist/templates/code/width.d.ts +10 -0
- package/dist/templates/code/width.d.ts.map +1 -0
- package/dist/templates/code/width.js +26 -0
- package/dist/templates/code/width.js.map +1 -0
- package/dist/templates/footer.d.ts +8 -0
- package/dist/templates/footer.d.ts.map +1 -1
- package/dist/templates/footer.js +11 -1
- package/dist/templates/footer.js.map +1 -1
- package/dist/templates/index.d.ts +1 -1
- package/dist/templates/index.d.ts.map +1 -1
- package/dist/templates/index.js +1 -1
- package/dist/templates/index.js.map +1 -1
- package/dist/templates/logo.d.ts +15 -0
- package/dist/templates/logo.d.ts.map +1 -0
- package/dist/templates/logo.js +30 -0
- package/dist/templates/logo.js.map +1 -0
- package/dist/templates/measure.d.ts +11 -0
- package/dist/templates/measure.d.ts.map +1 -0
- package/dist/templates/measure.js +11 -0
- package/dist/templates/measure.js.map +1 -0
- package/dist/templates/props.d.ts +2 -2
- package/dist/templates/props.js +2 -2
- package/dist/templates/text.d.ts +37 -0
- package/dist/templates/text.d.ts.map +1 -0
- package/dist/templates/text.js +26 -0
- package/dist/templates/text.js.map +1 -0
- package/dist/text/break.d.ts +11 -0
- package/dist/text/break.d.ts.map +1 -0
- package/dist/text/break.js +30 -0
- package/dist/text/break.js.map +1 -0
- package/dist/text/fit.d.ts +30 -0
- package/dist/text/fit.d.ts.map +1 -0
- package/dist/text/fit.js +29 -0
- package/dist/text/fit.js.map +1 -0
- package/dist/text/index.d.ts +5 -3
- package/dist/text/index.d.ts.map +1 -1
- package/dist/text/index.js +3 -2
- package/dist/text/index.js.map +1 -1
- package/dist/text/wrap.d.ts +17 -7
- package/dist/text/wrap.d.ts.map +1 -1
- package/dist/text/wrap.js +25 -17
- package/dist/text/wrap.js.map +1 -1
- package/dist/types.d.ts +161 -45
- package/dist/types.d.ts.map +1 -1
- package/dist/validate/index.d.ts +1 -1
- package/dist/validate/index.d.ts.map +1 -1
- package/dist/validate/index.js +3 -2
- package/dist/validate/index.js.map +1 -1
- package/dist/validate/keys.d.ts +19 -2
- package/dist/validate/keys.d.ts.map +1 -1
- package/dist/validate/keys.js +40 -3
- package/dist/validate/keys.js.map +1 -1
- package/dist/validate/suggest.d.ts.map +1 -1
- package/dist/validate/suggest.js +21 -3
- package/dist/validate/suggest.js.map +1 -1
- package/dist/validate/values.d.ts +2 -2
- package/dist/validate/values.d.ts.map +1 -1
- package/dist/validate/values.js +17 -3
- package/dist/validate/values.js.map +1 -1
- package/package.json +7 -1
package/dist/types.d.ts
CHANGED
|
@@ -26,7 +26,37 @@ export interface GradientStop {
|
|
|
26
26
|
readonly color: string;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* A raster or SVG image to draw into a generated one, given either as a file
|
|
30
|
+
* path or as its bytes. It mirrors {@link FontSource}, and for the same
|
|
31
|
+
* reasons: a path is checked when the config is resolved rather than when the
|
|
32
|
+
* image is drawn, and the bytes are what the rebuild stamp hashes, so replacing
|
|
33
|
+
* a logo at the same path re-renders everything drawn with it.
|
|
34
|
+
*
|
|
35
|
+
* PNG, JPEG, GIF, WebP and SVG are understood. Text inside an SVG is not
|
|
36
|
+
* rendered, because a nested document is drawn without the fonts the build
|
|
37
|
+
* loaded; convert it to paths first, or use a raster image.
|
|
38
|
+
*/
|
|
39
|
+
export type ImageSource = {
|
|
40
|
+
/** Resolved from the working directory when relative. */
|
|
41
|
+
readonly path: string;
|
|
42
|
+
} | {
|
|
43
|
+
/**
|
|
44
|
+
* The image file's bytes. The format is read from them, so there is
|
|
45
|
+
* nothing to declare and nothing to get wrong.
|
|
46
|
+
*/
|
|
47
|
+
readonly data: Uint8Array;
|
|
48
|
+
};
|
|
49
|
+
/** A wash of colour over a background image, so that text stays legible. */
|
|
50
|
+
export interface Scrim {
|
|
51
|
+
/** Defaults to black. */
|
|
52
|
+
readonly color?: string;
|
|
53
|
+
/** Opacity at the top edge. Defaults to `0.25`. */
|
|
54
|
+
readonly from?: number;
|
|
55
|
+
/** Opacity at the bottom edge. Defaults to `0.65`. */
|
|
56
|
+
readonly to?: number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Background fill for an image: a flat colour, a linear gradient, or a photo.
|
|
30
60
|
*
|
|
31
61
|
* Gradient coordinates use SVG object-bounding-box units (0–1); the default
|
|
32
62
|
* runs diagonally from the top-left `(0, 0)` to the bottom-right `(1, 1)`.
|
|
@@ -45,10 +75,41 @@ export type Background = {
|
|
|
45
75
|
readonly x: number;
|
|
46
76
|
readonly y: number;
|
|
47
77
|
};
|
|
78
|
+
} | {
|
|
79
|
+
readonly type: "image";
|
|
80
|
+
readonly source: ImageSource;
|
|
81
|
+
/**
|
|
82
|
+
* `cover` fills the image and crops the overflow, which is what a photo
|
|
83
|
+
* behind a headline wants. `contain` fits the whole picture in and shows
|
|
84
|
+
* `color` in what is left over.
|
|
85
|
+
*/
|
|
86
|
+
readonly fit?: "cover" | "contain";
|
|
87
|
+
/** Behind the image, and either side of a `contain` fit. */
|
|
88
|
+
readonly color?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Defaults to a gentle shade towards the bottom. A photograph is light
|
|
91
|
+
* and dark wherever it likes, and white text over a bright sky cannot be
|
|
92
|
+
* read, so this is what makes the difference between a designed image and
|
|
93
|
+
* text sitting on a picture. Set `to: 0` for none.
|
|
94
|
+
*/
|
|
95
|
+
readonly scrim?: Scrim;
|
|
48
96
|
};
|
|
97
|
+
/**
|
|
98
|
+
* An image that has been loaded and is ready to draw: the `data:` URI a
|
|
99
|
+
* template hands to `image`, and the shape of the picture behind it.
|
|
100
|
+
*/
|
|
101
|
+
export interface ImageAsset {
|
|
102
|
+
readonly href: string;
|
|
103
|
+
/**
|
|
104
|
+
* Width divided by height. `1` where the format is one whose dimensions
|
|
105
|
+
* cannot be read, so a template reserves a square and the picture sits
|
|
106
|
+
* inside it rather than being stretched.
|
|
107
|
+
*/
|
|
108
|
+
readonly aspect: number;
|
|
109
|
+
}
|
|
49
110
|
/**
|
|
50
111
|
* Brand colours used to derive the default gradient and text colour. All are
|
|
51
|
-
* configurable per project
|
|
112
|
+
* configurable per project, and nothing here is tied to a specific site.
|
|
52
113
|
*/
|
|
53
114
|
export interface BrandColors {
|
|
54
115
|
readonly brand: string;
|
|
@@ -82,12 +143,6 @@ export interface CodeStyle {
|
|
|
82
143
|
* installed one when `systemFonts` is on.
|
|
83
144
|
*/
|
|
84
145
|
readonly fontFamily?: string;
|
|
85
|
-
/**
|
|
86
|
-
* Glyph advance width as a fraction of the font size. `0.6` matches most
|
|
87
|
-
* monospace faces (Source Code Pro, Menlo, DejaVu Sans Mono); narrower faces
|
|
88
|
-
* such as Consolas want ~`0.55`.
|
|
89
|
-
*/
|
|
90
|
-
readonly charWidthRatio?: number;
|
|
91
146
|
/** Line advance as a multiple of the font size. Default `1.55`. */
|
|
92
147
|
readonly lineHeight?: number;
|
|
93
148
|
/** Spaces a tab expands to before layout. Default `2`. */
|
|
@@ -97,8 +152,8 @@ export interface CodeStyle {
|
|
|
97
152
|
/** Upper bound on the auto-fitted font size, as a fraction of image width. */
|
|
98
153
|
readonly maxFontScale?: number;
|
|
99
154
|
/**
|
|
100
|
-
* Lower bound on the auto-fitted font size, as a fraction of image width
|
|
101
|
-
*
|
|
155
|
+
* Lower bound on the auto-fitted font size, as a fraction of image width.
|
|
156
|
+
* Width, because that is what a feed scales a share image to. Code too long
|
|
102
157
|
* to fit at this size is truncated with an ellipsis rather than shrunk into
|
|
103
158
|
* illegibility, so raising this trades lines of code for readability and
|
|
104
159
|
* lowering it does the reverse.
|
|
@@ -111,8 +166,8 @@ export interface CodeStyle {
|
|
|
111
166
|
* the file itself, so a bold and a regular face are two entries, and the SVG's
|
|
112
167
|
* `font-weight` picks between them.
|
|
113
168
|
*
|
|
114
|
-
* `family` is optional and does not affect matching
|
|
115
|
-
* font file does that. When given on the first font it seeds `fontFamily`,
|
|
169
|
+
* `family` is optional and does not affect matching, since the family name in
|
|
170
|
+
* the font file does that. When given on the first font it seeds `fontFamily`,
|
|
116
171
|
* which saves repeating the name for the common single-font case.
|
|
117
172
|
*/
|
|
118
173
|
export type FontSource = {
|
|
@@ -141,6 +196,12 @@ export interface MetaImageProps {
|
|
|
141
196
|
readonly title?: string;
|
|
142
197
|
readonly subtitle?: string;
|
|
143
198
|
readonly version?: string | number;
|
|
199
|
+
/**
|
|
200
|
+
* An author photo, as a path to an image file or its `data:` URI. Named here
|
|
201
|
+
* with the other well-known props because the renderer has to load it before
|
|
202
|
+
* a template can draw it, which it cannot do for a prop it does not know.
|
|
203
|
+
*/
|
|
204
|
+
readonly avatar?: string;
|
|
144
205
|
readonly [key: string]: unknown;
|
|
145
206
|
}
|
|
146
207
|
/**
|
|
@@ -149,7 +210,7 @@ export interface MetaImageProps {
|
|
|
149
210
|
*
|
|
150
211
|
* Return `undefined` to leave a post without images. That is the filter for
|
|
151
212
|
* drafts, section indexes and anything else in the tree that is not a page
|
|
152
|
-
* worth sharing
|
|
213
|
+
* worth sharing. Without it, mapping frontmatter would mean an image for every
|
|
153
214
|
* markdown file there is. It only settles posts that say nothing for
|
|
154
215
|
* themselves, though: one declaring a props block is rendered either way, since
|
|
155
216
|
* asking for an image outright beats a blanket rule.
|
|
@@ -160,7 +221,7 @@ export interface MetaImageProps {
|
|
|
160
221
|
*/
|
|
161
222
|
export type PropsFromFrontmatter = (frontmatter: Record<string, unknown>) => Record<string, unknown> | undefined;
|
|
162
223
|
/**
|
|
163
|
-
* How a post's slug
|
|
224
|
+
* How a post's slug, the base name for its images, is derived from its path
|
|
164
225
|
* when the frontmatter does not declare one.
|
|
165
226
|
*
|
|
166
227
|
* - `basename`: the filename without extension, or the parent directory for
|
|
@@ -173,10 +234,10 @@ export type SlugStrategy = "basename" | "route";
|
|
|
173
234
|
/**
|
|
174
235
|
* How to read image props out of a content tree. Every field is optional.
|
|
175
236
|
*
|
|
176
|
-
* This is the host-project half of the job
|
|
177
|
-
* their frontmatter
|
|
178
|
-
* a template is handed
|
|
179
|
-
*
|
|
237
|
+
* This is the host-project half of the job, finding posts and understanding
|
|
238
|
+
* their frontmatter. It is deliberately absent from {@link ResolvedConfig},
|
|
239
|
+
* which is what a template is handed, and where the props came from is none of
|
|
240
|
+
* a template's business.
|
|
180
241
|
*/
|
|
181
242
|
export interface ContentOptions {
|
|
182
243
|
/** Frontmatter key holding the image props object. Default `meta_img_props`. */
|
|
@@ -225,14 +286,14 @@ export interface ContentFile {
|
|
|
225
286
|
*
|
|
226
287
|
* `outputPath` alone says where the bytes go and nothing about how anyone
|
|
227
288
|
* reaches them, so every site ends up rebuilding that mapping in its own
|
|
228
|
-
* templates
|
|
289
|
+
* templates, from information Colophon had at generate time and threw away.
|
|
229
290
|
*
|
|
230
291
|
* - `beside-content`: next to the post, which is the page-bundle convention
|
|
231
292
|
* and what Colophon has always done. Still the default.
|
|
232
293
|
* - `public-dir`: gathered into one directory, as Astro, Eleventy and Vite
|
|
233
294
|
* expect. A slug carrying directories keeps them underneath it.
|
|
234
|
-
* - `custom`: for a site whose mapping is its own
|
|
235
|
-
* directory
|
|
295
|
+
* - `custom`: for a site whose mapping is its own, such as images under a
|
|
296
|
+
* dated directory.
|
|
236
297
|
*
|
|
237
298
|
* `urlBase` is what makes a URL: it is prefixed to the image's path under the
|
|
238
299
|
* root that placed it, and without one there is no URL, because no directory
|
|
@@ -269,7 +330,7 @@ export type Placement = {
|
|
|
269
330
|
* otherwise, and a size they later change leaves the tags behind.
|
|
270
331
|
*/
|
|
271
332
|
export interface ManifestImage {
|
|
272
|
-
/** Absent where the placement knows no URL
|
|
333
|
+
/** Absent where the placement knows no URL. See {@link Placement}. */
|
|
273
334
|
readonly url?: string;
|
|
274
335
|
readonly width: number;
|
|
275
336
|
readonly height: number;
|
|
@@ -290,7 +351,7 @@ export interface ManifestPage {
|
|
|
290
351
|
* What a build generated, for the site to read back: a JSON file listing every
|
|
291
352
|
* page's images, their URLs and the dimensions they were rendered at.
|
|
292
353
|
*
|
|
293
|
-
* Without it a site reconstructs all of that in template code
|
|
354
|
+
* Without it a site reconstructs all of that in template code, globbing for
|
|
294
355
|
* `*-og.png` to find the landscape variant, or writing image paths back into
|
|
295
356
|
* each post's frontmatter. All of it is known while generating.
|
|
296
357
|
*
|
|
@@ -307,7 +368,7 @@ export interface Manifest {
|
|
|
307
368
|
*
|
|
308
369
|
* Open Graph names its tags with `property` and Twitter with `name`, which is
|
|
309
370
|
* a distinction sites get wrong routinely. Keeping them apart in the type
|
|
310
|
-
* means a component can spread a tag
|
|
371
|
+
* means a component can spread a tag with `<meta {...tag} />` and be right
|
|
311
372
|
* either way.
|
|
312
373
|
*/
|
|
313
374
|
export type MetaTag = {
|
|
@@ -322,20 +383,49 @@ export interface MetaTagOptions {
|
|
|
322
383
|
/**
|
|
323
384
|
* Absolute base for a site-relative image URL, e.g. `https://example.com`.
|
|
324
385
|
*
|
|
325
|
-
* Open Graph wants an absolute URL
|
|
326
|
-
* relative one against
|
|
386
|
+
* Open Graph wants an absolute URL, since a crawler has no page to resolve a
|
|
387
|
+
* relative one against. A manifest records whatever the placement's
|
|
327
388
|
* `urlBase` said, which is usually site-relative. A URL that is already
|
|
328
389
|
* absolute is left alone, so a CDN base needs nothing here.
|
|
329
390
|
*/
|
|
330
391
|
readonly baseUrl?: string;
|
|
331
392
|
}
|
|
332
393
|
/**
|
|
333
|
-
* Reports something a template had to compromise on
|
|
334
|
-
*
|
|
335
|
-
* having even when the input did not quite fit, but the author
|
|
336
|
-
* about it rather than discover it in someone else's timeline.
|
|
394
|
+
* Reports something a template had to compromise on, so far only code
|
|
395
|
+
* truncated to stay legible. Rendering carries on regardless, since a share
|
|
396
|
+
* image is worth having even when the input did not quite fit, but the author
|
|
397
|
+
* should hear about it rather than discover it in someone else's timeline.
|
|
337
398
|
*/
|
|
338
399
|
export type WarningHandler = (message: string) => void;
|
|
400
|
+
/**
|
|
401
|
+
* How a run of text is drawn, as far as its width is concerned. Style that
|
|
402
|
+
* cannot move a glyph's advance, such as colour, is not here.
|
|
403
|
+
*/
|
|
404
|
+
export interface TextStyle {
|
|
405
|
+
/** CSS-style stack, matched against the configured fonts in order. */
|
|
406
|
+
readonly fontFamily: string;
|
|
407
|
+
readonly fontSize: number;
|
|
408
|
+
/** Defaults to `400`. The nearest weight in the family is measured. */
|
|
409
|
+
readonly fontWeight?: number;
|
|
410
|
+
/**
|
|
411
|
+
* Advance width to assume, as a fraction of the font size, when no
|
|
412
|
+
* configured font matches the stack and the width has to be guessed.
|
|
413
|
+
*
|
|
414
|
+
* The default suits proportional text. A caller drawing monospace passes its
|
|
415
|
+
* own, because the same guess would be far too narrow for a face whose every
|
|
416
|
+
* glyph is as wide as an `M`.
|
|
417
|
+
*/
|
|
418
|
+
readonly fallbackRatio?: number;
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* The width, in pixels, that `text` occupies when drawn in `style`.
|
|
422
|
+
*
|
|
423
|
+
* Exact where the style resolves to a font the build loaded, since then the
|
|
424
|
+
* glyph advances are read from the file the rasteriser is drawing with.
|
|
425
|
+
* Estimated otherwise, which is the best there is when the text will be drawn
|
|
426
|
+
* in whichever font the machine happens to have.
|
|
427
|
+
*/
|
|
428
|
+
export type MeasureText = (text: string, style: TextStyle) => number;
|
|
339
429
|
/**
|
|
340
430
|
* Everything a template needs to produce its SVG foreground content.
|
|
341
431
|
*/
|
|
@@ -343,15 +433,32 @@ export interface TemplateContext {
|
|
|
343
433
|
readonly props: MetaImageProps;
|
|
344
434
|
readonly config: ResolvedConfig;
|
|
345
435
|
readonly dimensions: Dimensions;
|
|
436
|
+
/**
|
|
437
|
+
* Measures text in the fonts this build is rendering with, so a template can
|
|
438
|
+
* wrap and fit its text to the space it has rather than guessing.
|
|
439
|
+
*/
|
|
440
|
+
readonly measure: MeasureText;
|
|
441
|
+
/**
|
|
442
|
+
* The configured logo, loaded and ready to draw, or `undefined` where there
|
|
443
|
+
* is none. Reading the file is the renderer's job rather than the template's,
|
|
444
|
+
* so that a template stays a synchronous function over values it was handed.
|
|
445
|
+
*
|
|
446
|
+
* Present and possibly undefined, as `footer` and `badge` are on a resolved
|
|
447
|
+
* config: a context is built once and handed over whole, and a field that is
|
|
448
|
+
* sometimes absent makes every construction of one a conditional.
|
|
449
|
+
*/
|
|
450
|
+
readonly logo: ImageAsset | undefined;
|
|
451
|
+
/** The same for a post's `avatar` prop. */
|
|
452
|
+
readonly avatar: ImageAsset | undefined;
|
|
346
453
|
}
|
|
347
454
|
/**
|
|
348
455
|
* A registered template. `render` returns the SVG *foreground* content (text,
|
|
349
456
|
* badges, etc.) for the given dimensions; the background and the enclosing
|
|
350
457
|
* `<svg>` root are added by the renderer.
|
|
351
458
|
*
|
|
352
|
-
* Rendering may be asynchronous
|
|
353
|
-
* demand
|
|
354
|
-
* synchronous and just return a string.
|
|
459
|
+
* Rendering may be asynchronous, since the `code` template loads syntax
|
|
460
|
+
* grammars on demand, so `render` can return a promise. Simple templates can
|
|
461
|
+
* stay synchronous and just return a string.
|
|
355
462
|
*/
|
|
356
463
|
export interface Template {
|
|
357
464
|
readonly name: string;
|
|
@@ -376,7 +483,7 @@ export interface ColophonConfig {
|
|
|
376
483
|
* Whether to also load the machine's installed fonts. Defaults to `true`
|
|
377
484
|
* when no `fonts` are configured (nothing else would render) and `false`
|
|
378
485
|
* when they are. Turn it on alongside `fonts` to fall back to system fonts
|
|
379
|
-
* for families you have not supplied
|
|
486
|
+
* for families you have not supplied, at the cost of determinism.
|
|
380
487
|
*/
|
|
381
488
|
readonly systemFonts?: boolean;
|
|
382
489
|
/**
|
|
@@ -388,6 +495,12 @@ export interface ColophonConfig {
|
|
|
388
495
|
readonly footer?: string;
|
|
389
496
|
/** Corner badge for the `banner` template. Omit (the default) for none. */
|
|
390
497
|
readonly badge?: Badge;
|
|
498
|
+
/**
|
|
499
|
+
* A logo to draw in the corner, which is most of what branding an image
|
|
500
|
+
* means. Where it goes is the template's business; how big it is comes from
|
|
501
|
+
* the image's own proportions and the size being drawn.
|
|
502
|
+
*/
|
|
503
|
+
readonly logo?: ImageSource;
|
|
391
504
|
/** Styling for the `code` template. */
|
|
392
505
|
readonly code?: CodeStyle;
|
|
393
506
|
/**
|
|
@@ -421,16 +534,16 @@ export interface ColophonConfig {
|
|
|
421
534
|
*/
|
|
422
535
|
readonly manifest?: string;
|
|
423
536
|
/**
|
|
424
|
-
* One-off images that belong to the project rather than to any post
|
|
425
|
-
* package card
|
|
426
|
-
* skipped or re-rendered on the same stamps.
|
|
537
|
+
* One-off images that belong to the project rather than to any post, such as
|
|
538
|
+
* a package card or a repository social preview. Rendered by the same build,
|
|
539
|
+
* and skipped or re-rendered on the same stamps.
|
|
427
540
|
*/
|
|
428
541
|
readonly extra?: readonly ExtraImage[];
|
|
429
542
|
}
|
|
430
543
|
/**
|
|
431
544
|
* A function a config module may export instead of a config object, so that a
|
|
432
|
-
* config which has to compute something
|
|
433
|
-
* own stylesheet,
|
|
545
|
+
* config which has to compute something, such as brand colours read out of the
|
|
546
|
+
* site's own stylesheet, can still be a config module rather than a script.
|
|
434
547
|
*
|
|
435
548
|
* It takes no arguments. Anything it might be handed is either already on the
|
|
436
549
|
* command line or a decision the config itself is making.
|
|
@@ -449,20 +562,22 @@ export type ColophonConfigInput = ColophonConfig | ColophonConfigFactory;
|
|
|
449
562
|
*
|
|
450
563
|
* Only what a template reads while drawing is overridable. `fonts`,
|
|
451
564
|
* `systemFonts` and `templates` are shared build inputs rather than part of the
|
|
452
|
-
* picture
|
|
453
|
-
* inside a size would be nonsense.
|
|
565
|
+
* picture. `onWarning` is where messages go rather than what they say, and
|
|
566
|
+
* `sizes` inside a size would be nonsense.
|
|
454
567
|
*/
|
|
455
568
|
export interface SizeOverrides {
|
|
456
569
|
/**
|
|
457
570
|
* Merged over the config's `colors`, so a size can change one shade on its
|
|
458
|
-
* own
|
|
571
|
+
* own. `brand` is optional here precisely because the rest are kept.
|
|
459
572
|
*/
|
|
460
573
|
readonly colors?: Partial<BrandColors>;
|
|
461
|
-
/** Replaces the config's background outright
|
|
574
|
+
/** Replaces the config's background outright. See the note on merging. */
|
|
462
575
|
readonly background?: Background;
|
|
463
576
|
readonly fontFamily?: string;
|
|
464
577
|
readonly footer?: string;
|
|
465
578
|
readonly badge?: Badge;
|
|
579
|
+
/** Replaces the config's logo, for a size that wants a different mark. */
|
|
580
|
+
readonly logo?: ImageSource;
|
|
466
581
|
/** Merged over the config's `code`, so a size can change one setting. */
|
|
467
582
|
readonly code?: CodeStyle;
|
|
468
583
|
}
|
|
@@ -471,7 +586,7 @@ export interface SizeOverrides {
|
|
|
471
586
|
* it, and the size to draw it at.
|
|
472
587
|
*
|
|
473
588
|
* The alternative is a script that calls `renderMetaImages` and writes the
|
|
474
|
-
* bytes itself, which is a lot of machinery for one card
|
|
589
|
+
* bytes itself, which is a lot of machinery for one card, and which keeps
|
|
475
590
|
* neither the rebuild stamps nor the build log a content image gets.
|
|
476
591
|
*/
|
|
477
592
|
export interface ExtraImage {
|
|
@@ -483,7 +598,7 @@ export interface ExtraImage {
|
|
|
483
598
|
*/
|
|
484
599
|
readonly output: string;
|
|
485
600
|
/**
|
|
486
|
-
* The size to render at, {@link SizeOverrides} and all
|
|
601
|
+
* The size to render at, {@link SizeOverrides} and all. An inline size is
|
|
487
602
|
* how a one-off image gets its own footer or palette without a whole entry
|
|
488
603
|
* in `sizes`. Defaults to the first configured size, since a one-off card
|
|
489
604
|
* usually wants to match the site's primary share format.
|
|
@@ -502,6 +617,7 @@ export interface ResolvedConfig {
|
|
|
502
617
|
readonly fontFamily: string;
|
|
503
618
|
readonly footer: string | undefined;
|
|
504
619
|
readonly badge: Badge | undefined;
|
|
620
|
+
readonly logo: ImageSource | undefined;
|
|
505
621
|
readonly code: Required<CodeStyle>;
|
|
506
622
|
readonly onWarning: WarningHandler;
|
|
507
623
|
readonly sizes: readonly OutputSize[];
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.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AAU,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC;IACvC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,yDAAyD;IACzD,QAAQ,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,CAAC;IACtC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;IACnC,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,CAAC;IACtC,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;CACxD;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB"}
|
package/dist/validate/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import type { ColophonConfig } from "../types.js";
|
|
|
8
8
|
* correctly is describing images nobody is rendering.
|
|
9
9
|
*
|
|
10
10
|
* Only the closed parts of the config are checked. The names in `templates`
|
|
11
|
-
* are the project's own, and a post's props are open by design
|
|
11
|
+
* are the project's own, and a post's props are open by design, so a template
|
|
12
12
|
* reads whatever fields it understands.
|
|
13
13
|
*/
|
|
14
14
|
export declare function validateConfig(config: ColophonConfig): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validate/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validate/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAelD;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAwC3D"}
|
package/dist/validate/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { checkEach, checkKeys } from "./check.js";
|
|
2
|
-
import { badgeKeys, codeKeys, colorKeys, configKeys, contentKeys, fontKeys, } from "./keys.js";
|
|
2
|
+
import { badgeKeys, codeKeys, colorKeys, configKeys, contentKeys, fontKeys, imageSourceKeys, } from "./keys.js";
|
|
3
3
|
import { checkExtras, checkSizes } from "./overrides.js";
|
|
4
4
|
import { checkPlacement } from "./placement.js";
|
|
5
5
|
import { checkBackground, checkSlugStrategy } from "./values.js";
|
|
@@ -12,7 +12,7 @@ import { checkBackground, checkSlugStrategy } from "./values.js";
|
|
|
12
12
|
* correctly is describing images nobody is rendering.
|
|
13
13
|
*
|
|
14
14
|
* Only the closed parts of the config are checked. The names in `templates`
|
|
15
|
-
* are the project's own, and a post's props are open by design
|
|
15
|
+
* are the project's own, and a post's props are open by design, so a template
|
|
16
16
|
* reads whatever fields it understands.
|
|
17
17
|
*/
|
|
18
18
|
export function validateConfig(config) {
|
|
@@ -22,6 +22,7 @@ export function validateConfig(config) {
|
|
|
22
22
|
checkKeys(config, "", configKeys, problems);
|
|
23
23
|
checkKeys(raw.colors, "colors", colorKeys, problems);
|
|
24
24
|
checkKeys(raw.badge, "badge", badgeKeys, problems);
|
|
25
|
+
checkKeys(raw.logo, "logo", imageSourceKeys, problems);
|
|
25
26
|
checkKeys(raw.code, "code", codeKeys, problems);
|
|
26
27
|
checkKeys(raw.content, "content", contentKeys, problems);
|
|
27
28
|
checkSlugStrategy(raw.content, problems);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/validate/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EACL,SAAS,EACT,QAAQ,EACR,SAAS,EACT,UAAU,EACV,WAAW,EACX,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/validate/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EACL,SAAS,EACT,QAAQ,EACR,SAAS,EACT,UAAU,EACV,WAAW,EACX,QAAQ,EACR,eAAe,GAChB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEjE;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,cAAc,CAAC,MAAsB;IACnD,2EAA2E;IAC3E,MAAM,GAAG,GAAG,MAWX,CAAC;IACF,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,SAAS,CAAC,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;IAC5C,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IACrD,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IACnD,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE,QAAQ,CAAC,CAAC;IACvD,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAChD,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;IACzD,iBAAiB,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACzC,UAAU,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAChC,WAAW,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IACjC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAClD,eAAe,CAAC,GAAG,CAAC,UAAU,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC;IACxD,cAAc,CAAC,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAExC,MAAM,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,GAAG,QAAQ,CAAC;IAElC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO;IACT,CAAC;IAED,MAAM,IAAI,KAAK,CACb,IAAI,CAAC,MAAM,KAAK,CAAC;QACf,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,oBAAoB,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACjF,CAAC;AACJ,CAAC"}
|
package/dist/validate/keys.d.ts
CHANGED
|
@@ -12,8 +12,9 @@ export declare const customPlacementKeys: readonly string[];
|
|
|
12
12
|
* variant it was guessed to be.
|
|
13
13
|
*
|
|
14
14
|
* Two of the names are hyphenated because they are values a user writes in a
|
|
15
|
-
* config
|
|
16
|
-
* as keys is what keeps the list exhaustive, which is the whole
|
|
15
|
+
* config rather than identifiers, and the casing rule is about identifiers.
|
|
16
|
+
* Keeping them as keys is what keeps the list exhaustive, which is the whole
|
|
17
|
+
* point of it.
|
|
17
18
|
*/
|
|
18
19
|
export declare const placementStrategies: readonly string[];
|
|
19
20
|
/** One ad hoc image declared in config. */
|
|
@@ -36,6 +37,22 @@ export declare const sizeKeys: readonly string[];
|
|
|
36
37
|
export declare const fontKeys: string[];
|
|
37
38
|
/** Keys of a solid background. */
|
|
38
39
|
export declare const solidBackgroundKeys: readonly string[];
|
|
40
|
+
/** Keys of a background that draws a picture. */
|
|
41
|
+
export declare const imageBackgroundKeys: readonly string[];
|
|
42
|
+
/**
|
|
43
|
+
* The fits an image background accepts, as values rather than keys. `image`
|
|
44
|
+
* draws anything that is not `cover` as `contain`, so a mistyped `crop` would
|
|
45
|
+
* quietly change how every image in the build is cropped.
|
|
46
|
+
*/
|
|
47
|
+
export declare const backgroundFits: readonly string[];
|
|
48
|
+
/** Keys of the wash over a background image. */
|
|
49
|
+
export declare const scrimKeys: readonly string[];
|
|
50
|
+
/**
|
|
51
|
+
* Both image-source variants at once, for the same reason {@link fontKeys}
|
|
52
|
+
* takes both: which of `path` and `data` a source may carry is a question
|
|
53
|
+
* `image/resolve.ts` has a better message for than a key list does.
|
|
54
|
+
*/
|
|
55
|
+
export declare const imageSourceKeys: string[];
|
|
39
56
|
/** Keys of a gradient background. */
|
|
40
57
|
export declare const gradientBackgroundKeys: readonly string[];
|
|
41
58
|
/** Keys of one gradient stop. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../src/validate/keys.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../src/validate/keys.ts"],"names":[],"mappings":"AA+CA,gCAAgC;AAChC,eAAO,MAAM,UAAU,mBAiBrB,CAAC;AAEH,kEAAkE;AAClE,eAAO,MAAM,iBAAiB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true,
|
|
21
|
+
logo: true,
|
|
21
22
|
code: true,
|
|
22
23
|
onWarning: true,
|
|
23
24
|
sizes: true,
|
|
@@ -52,8 +53,9 @@ export const customPlacementKeys = knownKeys({
|
|
|
52
53
|
* variant it was guessed to be.
|
|
53
54
|
*
|
|
54
55
|
* Two of the names are hyphenated because they are values a user writes in a
|
|
55
|
-
* config
|
|
56
|
-
* as keys is what keeps the list exhaustive, which is the whole
|
|
56
|
+
* config rather than identifiers, and the casing rule is about identifiers.
|
|
57
|
+
* Keeping them as keys is what keeps the list exhaustive, which is the whole
|
|
58
|
+
* point of it.
|
|
57
59
|
*/
|
|
58
60
|
export const placementStrategies = knownKeys({
|
|
59
61
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
@@ -95,7 +97,6 @@ export const badgeKeys = knownKeys({
|
|
|
95
97
|
export const codeKeys = knownKeys({
|
|
96
98
|
theme: true,
|
|
97
99
|
fontFamily: true,
|
|
98
|
-
charWidthRatio: true,
|
|
99
100
|
lineHeight: true,
|
|
100
101
|
tabSize: true,
|
|
101
102
|
cornerScale: true,
|
|
@@ -112,6 +113,7 @@ export const sizeKeys = knownKeys({
|
|
|
112
113
|
fontFamily: true,
|
|
113
114
|
footer: true,
|
|
114
115
|
badge: true,
|
|
116
|
+
logo: true,
|
|
115
117
|
code: true,
|
|
116
118
|
});
|
|
117
119
|
/**
|
|
@@ -130,6 +132,40 @@ export const solidBackgroundKeys = knownKeys({
|
|
|
130
132
|
type: true,
|
|
131
133
|
color: true,
|
|
132
134
|
});
|
|
135
|
+
/** Keys of a background that draws a picture. */
|
|
136
|
+
export const imageBackgroundKeys = knownKeys({
|
|
137
|
+
type: true,
|
|
138
|
+
source: true,
|
|
139
|
+
fit: true,
|
|
140
|
+
color: true,
|
|
141
|
+
scrim: true,
|
|
142
|
+
});
|
|
143
|
+
/**
|
|
144
|
+
* The fits an image background accepts, as values rather than keys. `image`
|
|
145
|
+
* draws anything that is not `cover` as `contain`, so a mistyped `crop` would
|
|
146
|
+
* quietly change how every image in the build is cropped.
|
|
147
|
+
*/
|
|
148
|
+
export const backgroundFits = knownKeys({
|
|
149
|
+
cover: true,
|
|
150
|
+
contain: true,
|
|
151
|
+
});
|
|
152
|
+
/** Keys of the wash over a background image. */
|
|
153
|
+
export const scrimKeys = knownKeys({
|
|
154
|
+
color: true,
|
|
155
|
+
from: true,
|
|
156
|
+
to: true,
|
|
157
|
+
});
|
|
158
|
+
/**
|
|
159
|
+
* Both image-source variants at once, for the same reason {@link fontKeys}
|
|
160
|
+
* takes both: which of `path` and `data` a source may carry is a question
|
|
161
|
+
* `image/resolve.ts` has a better message for than a key list does.
|
|
162
|
+
*/
|
|
163
|
+
export const imageSourceKeys = [
|
|
164
|
+
...new Set([
|
|
165
|
+
...knownKeys({ path: true }),
|
|
166
|
+
...knownKeys({ data: true }),
|
|
167
|
+
]),
|
|
168
|
+
];
|
|
133
169
|
/** Keys of a gradient background. */
|
|
134
170
|
export const gradientBackgroundKeys = knownKeys({
|
|
135
171
|
type: true,
|
|
@@ -153,6 +189,7 @@ export const gradientPointKeys = knownKeys({ x: true, y: true });
|
|
|
153
189
|
export const backgroundTypes = knownKeys({
|
|
154
190
|
solid: true,
|
|
155
191
|
gradient: true,
|
|
192
|
+
image: true,
|
|
156
193
|
});
|
|
157
194
|
/**
|
|
158
195
|
* The slug strategies, for the same reason as {@link backgroundTypes}:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../../src/validate/keys.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../../src/validate/keys.ts"],"names":[],"mappings":"AAiBA;;;;;;;GAOG;AACH,SAAS,SAAS,CAAI,KAA4B;IAChD,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC;AAoBD,gCAAgC;AAChC,MAAM,CAAC,MAAM,UAAU,GAAG,SAAS,CAAiB;IAClD,MAAM,EAAE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ACtD,MAAM,EAAE,IAAI;IACZ,KAAK,EAAE,IAAI;CACZ,CAAC,CAAC;AAEH,mDAAmD;AACnD,MAAM,CAAC,MAAM,iBAAiB,GAAG,SAAS,CAAgB,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;AAEhF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,SAAS,CAAsC;IAC5E,KAAK,EAAE,IAAI;IACX,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE,IAAI;CACZ,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,SAAS,CAAgC;IACrE,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE,IAAI;CACZ,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suggest.d.ts","sourceRoot":"","sources":["../../src/validate/suggest.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"suggest.d.ts","sourceRoot":"","sources":["../../src/validate/suggest.ts"],"names":[],"mappings":"AAqDA;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,SAAS,MAAM,EAAE,GACvB,MAAM,GAAG,SAAS,CAmBpB;AAED,gFAAgF;AAChF,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,SAAS,MAAM,EAAE,GACvB,MAAM,CAcR"}
|