@kensio/colophon 2.2.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 -265
- 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 +14 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +67 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/config.d.ts +12 -0
- package/dist/cli/config.d.ts.map +1 -0
- package/dist/cli/config.js +43 -0
- package/dist/cli/config.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +35 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli.js +34 -6
- package/dist/cli.js.map +1 -1
- package/dist/config/defaults.d.ts +65 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/defaults.js +64 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/index.d.ts +22 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +54 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/resolve.d.ts +31 -0
- package/dist/config/resolve.d.ts.map +1 -0
- package/dist/config/resolve.js +82 -0
- package/dist/config/resolve.js.map +1 -0
- package/dist/config/size.d.ts +20 -0
- package/dist/config/size.d.ts.map +1 -0
- package/dist/config/size.js +47 -0
- package/dist/config/size.js.map +1 -0
- package/dist/config.d.ts +27 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +78 -2
- package/dist/config.js.map +1 -1
- package/dist/content/index.d.ts +5 -51
- package/dist/content/index.d.ts.map +1 -1
- package/dist/content/index.js +3 -115
- package/dist/content/index.js.map +1 -1
- package/dist/content/props.d.ts +15 -0
- package/dist/content/props.d.ts.map +1 -0
- package/dist/content/props.js +71 -0
- package/dist/content/props.js.map +1 -0
- package/dist/content/slug.d.ts +23 -0
- package/dist/content/slug.d.ts.map +1 -0
- package/dist/content/slug.js +52 -0
- package/dist/content/slug.js.map +1 -0
- package/dist/content/walk.d.ts +17 -0
- package/dist/content/walk.d.ts.map +1 -0
- package/dist/content/walk.js +57 -0
- package/dist/content/walk.js.map +1 -0
- package/dist/fonts/index.d.ts +11 -0
- package/dist/fonts/index.d.ts.map +1 -0
- package/dist/fonts/index.js +12 -0
- package/dist/fonts/index.js.map +1 -0
- package/dist/fonts/materialise.d.ts +7 -0
- package/dist/fonts/materialise.d.ts.map +1 -0
- package/dist/fonts/materialise.js +47 -0
- package/dist/fonts/materialise.js.map +1 -0
- package/dist/fonts/resolve.d.ts +7 -0
- package/dist/fonts/resolve.d.ts.map +1 -0
- package/dist/fonts/resolve.js +50 -0
- package/dist/fonts/resolve.js.map +1 -0
- package/dist/fonts.d.ts +18 -0
- package/dist/fonts.d.ts.map +1 -0
- package/dist/fonts.js +102 -0
- package/dist/fonts.js.map +1 -0
- package/dist/generate/extra.d.ts +16 -0
- package/dist/generate/extra.d.ts.map +1 -0
- package/dist/generate/extra.js +60 -0
- package/dist/generate/extra.js.map +1 -0
- package/dist/generate/index.d.ts +19 -0
- package/dist/generate/index.d.ts.map +1 -0
- package/dist/generate/index.js +46 -0
- package/dist/generate/index.js.map +1 -0
- package/dist/generate/job.d.ts +35 -0
- package/dist/generate/job.d.ts.map +1 -0
- package/dist/generate/job.js +2 -0
- package/dist/generate/job.js.map +1 -0
- package/dist/generate/options.d.ts +56 -0
- package/dist/generate/options.d.ts.map +1 -0
- package/dist/generate/options.js +17 -0
- package/dist/generate/options.js.map +1 -0
- package/dist/generate/output-path.d.ts +12 -0
- package/dist/generate/output-path.d.ts.map +1 -0
- package/dist/generate/output-path.js +18 -0
- package/dist/generate/output-path.js.map +1 -0
- package/dist/generate/outputs.d.ts +28 -0
- package/dist/generate/outputs.d.ts.map +1 -0
- package/dist/generate/outputs.js +71 -0
- package/dist/generate/outputs.js.map +1 -0
- package/dist/generate/plan.d.ts +21 -0
- package/dist/generate/plan.d.ts.map +1 -0
- package/dist/generate/plan.js +72 -0
- package/dist/generate/plan.js.map +1 -0
- package/dist/generate/render-image.d.ts +11 -0
- package/dist/generate/render-image.d.ts.map +1 -0
- package/dist/generate/render-image.js +27 -0
- package/dist/generate/render-image.js.map +1 -0
- package/dist/generate.d.ts +27 -6
- package/dist/generate.d.ts.map +1 -1
- package/dist/generate.js +69 -15
- package/dist/generate.js.map +1 -1
- package/dist/highlight/color.d.ts +9 -0
- package/dist/highlight/color.d.ts.map +1 -0
- package/dist/highlight/color.js +15 -0
- package/dist/highlight/color.js.map +1 -0
- package/dist/highlight/grid.d.ts +14 -0
- package/dist/highlight/grid.d.ts.map +1 -0
- package/dist/highlight/grid.js +36 -0
- package/dist/highlight/grid.js.map +1 -0
- package/dist/highlight/index.d.ts +12 -0
- package/dist/highlight/index.d.ts.map +1 -0
- package/dist/highlight/index.js +31 -0
- package/dist/highlight/index.js.map +1 -0
- package/dist/highlight/language.d.ts +13 -0
- package/dist/highlight/language.d.ts.map +1 -0
- package/dist/highlight/language.js +41 -0
- package/dist/highlight/language.js.map +1 -0
- package/dist/highlight/normalise.d.ts +17 -0
- package/dist/highlight/normalise.d.ts.map +1 -0
- package/dist/highlight/normalise.js +37 -0
- package/dist/highlight/normalise.js.map +1 -0
- package/dist/highlight/types.d.ts +40 -0
- package/dist/highlight/types.d.ts.map +1 -0
- package/dist/highlight/types.js +2 -0
- package/dist/highlight/types.js.map +1 -0
- 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 +19 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -5
- 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 +14 -0
- package/dist/manifest/build.d.ts.map +1 -0
- package/dist/manifest/build.js +43 -0
- package/dist/manifest/build.js.map +1 -0
- package/dist/manifest/index.d.ts +27 -0
- package/dist/manifest/index.d.ts.map +1 -0
- package/dist/manifest/index.js +31 -0
- package/dist/manifest/index.js.map +1 -0
- package/dist/manifest/order.d.ts +12 -0
- package/dist/manifest/order.d.ts.map +1 -0
- package/dist/manifest/order.js +17 -0
- package/dist/manifest/order.js.map +1 -0
- package/dist/manifest/page.d.ts +24 -0
- package/dist/manifest/page.d.ts.map +1 -0
- package/dist/manifest/page.js +55 -0
- package/dist/manifest/page.js.map +1 -0
- 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/html.d.ts +14 -0
- package/dist/meta/html.d.ts.map +1 -0
- package/dist/meta/html.js +24 -0
- package/dist/meta/html.js.map +1 -0
- package/dist/meta/index.d.ts +11 -0
- package/dist/meta/index.d.ts.map +1 -0
- package/dist/meta/index.js +11 -0
- package/dist/meta/index.js.map +1 -0
- package/dist/meta/tags.d.ts +21 -0
- package/dist/meta/tags.d.ts.map +1 -0
- package/dist/meta/tags.js +72 -0
- package/dist/meta/tags.js.map +1 -0
- package/dist/meta/url.d.ts +15 -0
- package/dist/meta/url.d.ts.map +1 -0
- package/dist/meta/url.js +34 -0
- package/dist/meta/url.js.map +1 -0
- package/dist/placement/check.d.ts +16 -0
- package/dist/placement/check.d.ts.map +1 -0
- package/dist/placement/check.js +40 -0
- package/dist/placement/check.js.map +1 -0
- package/dist/placement/index.d.ts +29 -0
- package/dist/placement/index.d.ts.map +1 -0
- package/dist/placement/index.js +61 -0
- package/dist/placement/index.js.map +1 -0
- package/dist/placement/relative.d.ts +31 -0
- package/dist/placement/relative.d.ts.map +1 -0
- package/dist/placement/relative.js +53 -0
- package/dist/placement/relative.js.map +1 -0
- package/dist/pool.d.ts +18 -0
- package/dist/pool.d.ts.map +1 -0
- package/dist/pool.js +56 -0
- package/dist/pool.js.map +1 -0
- 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/index.d.ts +10 -0
- package/dist/render/index.d.ts.map +1 -0
- package/dist/render/index.js +27 -0
- package/dist/render/index.js.map +1 -0
- package/dist/render/png.d.ts +10 -0
- package/dist/render/png.d.ts.map +1 -0
- package/dist/render/png.js +30 -0
- package/dist/render/png.js.map +1 -0
- package/dist/render/svg.d.ts +12 -0
- package/dist/render/svg.d.ts.map +1 -0
- package/dist/render/svg.js +35 -0
- package/dist/render/svg.js.map +1 -0
- package/dist/render/template.d.ts +9 -0
- package/dist/render/template.d.ts.map +1 -0
- package/dist/render/template.js +17 -0
- package/dist/render/template.js.map +1 -0
- package/dist/render.d.ts +6 -2
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +31 -10
- package/dist/render.js.map +1 -1
- package/dist/stamp/chunk.d.ts +16 -0
- package/dist/stamp/chunk.d.ts.map +1 -0
- package/dist/stamp/chunk.js +46 -0
- package/dist/stamp/chunk.js.map +1 -0
- package/dist/stamp/config-digest.d.ts +11 -0
- package/dist/stamp/config-digest.d.ts.map +1 -0
- package/dist/stamp/config-digest.js +62 -0
- package/dist/stamp/config-digest.js.map +1 -0
- package/dist/stamp/digest.d.ts +8 -0
- package/dist/stamp/digest.d.ts.map +1 -0
- package/dist/stamp/digest.js +20 -0
- package/dist/stamp/digest.js.map +1 -0
- package/dist/stamp/index.d.ts +20 -0
- package/dist/stamp/index.d.ts.map +1 -0
- package/dist/stamp/index.js +40 -0
- package/dist/stamp/index.js.map +1 -0
- package/dist/stamp/read.d.ts +7 -0
- package/dist/stamp/read.d.ts.map +1 -0
- package/dist/stamp/read.js +62 -0
- package/dist/stamp/read.js.map +1 -0
- package/dist/stamp.d.ts +29 -0
- package/dist/stamp.d.ts.map +1 -0
- package/dist/stamp.js +198 -0
- package/dist/stamp.js.map +1 -0
- 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 +7 -0
- package/dist/templates/banner/badge.d.ts.map +1 -0
- package/dist/templates/banner/badge.js +21 -0
- package/dist/templates/banner/badge.js.map +1 -0
- package/dist/templates/banner/index.d.ts +12 -0
- package/dist/templates/banner/index.d.ts.map +1 -0
- package/dist/templates/banner/index.js +68 -0
- package/dist/templates/banner/index.js.map +1 -0
- package/dist/templates/banner/lines.d.ts +22 -0
- package/dist/templates/banner/lines.d.ts.map +1 -0
- package/dist/templates/banner/lines.js +35 -0
- package/dist/templates/banner/lines.js.map +1 -0
- 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 +10 -0
- package/dist/templates/card/index.d.ts.map +1 -0
- package/dist/templates/card/index.js +55 -0
- package/dist/templates/card/index.js.map +1 -0
- package/dist/templates/card/lines.d.ts +21 -0
- package/dist/templates/card/lines.d.ts.map +1 -0
- package/dist/templates/card/lines.js +36 -0
- package/dist/templates/card/lines.js.map +1 -0
- package/dist/templates/code/chrome.d.ts +13 -0
- package/dist/templates/code/chrome.d.ts.map +1 -0
- package/dist/templates/code/chrome.js +33 -0
- package/dist/templates/code/chrome.js.map +1 -0
- package/dist/templates/code/clip.d.ts +18 -0
- package/dist/templates/code/clip.d.ts.map +1 -0
- package/dist/templates/code/clip.js +44 -0
- package/dist/templates/code/clip.js.map +1 -0
- package/dist/templates/code/ellipsis.d.ts +3 -0
- package/dist/templates/code/ellipsis.d.ts.map +1 -0
- package/dist/templates/code/ellipsis.js +3 -0
- package/dist/templates/code/ellipsis.js.map +1 -0
- package/dist/templates/code/fit.d.ts +27 -0
- package/dist/templates/code/fit.d.ts.map +1 -0
- package/dist/templates/code/fit.js +59 -0
- package/dist/templates/code/fit.js.map +1 -0
- package/dist/templates/code/index.d.ts +12 -0
- package/dist/templates/code/index.d.ts.map +1 -0
- package/dist/templates/code/index.js +65 -0
- package/dist/templates/code/index.js.map +1 -0
- package/dist/templates/code/layout.d.ts +21 -0
- package/dist/templates/code/layout.d.ts.map +1 -0
- package/dist/templates/code/layout.js +21 -0
- package/dist/templates/code/layout.js.map +1 -0
- package/dist/templates/code/panel.d.ts +30 -0
- package/dist/templates/code/panel.d.ts.map +1 -0
- package/dist/templates/code/panel.js +52 -0
- package/dist/templates/code/panel.js.map +1 -0
- package/dist/templates/code/plate.d.ts +17 -0
- package/dist/templates/code/plate.d.ts.map +1 -0
- package/dist/templates/code/plate.js +34 -0
- package/dist/templates/code/plate.js.map +1 -0
- package/dist/templates/code/spans.d.ts +19 -0
- package/dist/templates/code/spans.d.ts.map +1 -0
- package/dist/templates/code/spans.js +36 -0
- package/dist/templates/code/spans.js.map +1 -0
- package/dist/templates/code/warn.d.ts +11 -0
- package/dist/templates/code/warn.d.ts.map +1 -0
- package/dist/templates/code/warn.js +24 -0
- package/dist/templates/code/warn.js.map +1 -0
- 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 +29 -0
- package/dist/templates/footer.d.ts.map +1 -0
- package/dist/templates/footer.js +35 -0
- package/dist/templates/footer.js.map +1 -0
- package/dist/templates/index.d.ts +4 -4
- package/dist/templates/index.d.ts.map +1 -1
- package/dist/templates/index.js +7 -7
- 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/element.d.ts +18 -0
- package/dist/text/element.d.ts.map +1 -0
- package/dist/text/element.js +19 -0
- package/dist/text/element.js.map +1 -0
- package/dist/text/escape.d.ts +5 -0
- package/dist/text/escape.d.ts.map +1 -0
- package/dist/text/escape.js +12 -0
- package/dist/text/escape.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 +9 -0
- package/dist/text/index.d.ts.map +1 -0
- package/dist/text/index.js +6 -0
- package/dist/text/index.js.map +1 -0
- package/dist/text/stack.d.ts +24 -0
- package/dist/text/stack.d.ts.map +1 -0
- package/dist/text/stack.js +18 -0
- package/dist/text/stack.js.map +1 -0
- package/dist/text/wrap.d.ts +22 -0
- package/dist/text/wrap.d.ts.map +1 -0
- package/dist/text/wrap.js +41 -0
- package/dist/text/wrap.js.map +1 -0
- package/dist/types.d.ts +458 -18
- package/dist/types.d.ts.map +1 -1
- package/dist/validate/check.d.ts +13 -0
- package/dist/validate/check.d.ts.map +1 -0
- package/dist/validate/check.js +34 -0
- package/dist/validate/check.js.map +1 -0
- package/dist/validate/index.d.ts +15 -0
- package/dist/validate/index.d.ts.map +1 -0
- package/dist/validate/index.js +42 -0
- package/dist/validate/index.js.map +1 -0
- package/dist/validate/keys.d.ts +75 -0
- package/dist/validate/keys.d.ts.map +1 -0
- package/dist/validate/keys.js +203 -0
- package/dist/validate/keys.js.map +1 -0
- package/dist/validate/overrides.d.ts +5 -0
- package/dist/validate/overrides.d.ts.map +1 -0
- package/dist/validate/overrides.js +43 -0
- package/dist/validate/overrides.js.map +1 -0
- package/dist/validate/placement.d.ts +10 -0
- package/dist/validate/placement.d.ts.map +1 -0
- package/dist/validate/placement.js +38 -0
- package/dist/validate/placement.js.map +1 -0
- package/dist/validate/sizes.d.ts +9 -0
- package/dist/validate/sizes.d.ts.map +1 -0
- package/dist/validate/sizes.js +27 -0
- package/dist/validate/sizes.js.map +1 -0
- package/dist/validate/suggest.d.ts +10 -0
- package/dist/validate/suggest.d.ts.map +1 -0
- package/dist/validate/suggest.js +73 -0
- package/dist/validate/suggest.js.map +1 -0
- package/dist/validate/values.d.ts +21 -0
- package/dist/validate/values.d.ts.map +1 -0
- package/dist/validate/values.js +71 -0
- package/dist/validate/values.js.map +1 -0
- package/dist/validate.d.ts +15 -0
- package/dist/validate.d.ts.map +1 -0
- package/dist/validate.js +300 -0
- package/dist/validate.js.map +1 -0
- package/package.json +19 -6
package/dist/types.d.ts
CHANGED
|
@@ -9,8 +9,10 @@ export interface Dimensions {
|
|
|
9
9
|
* A named output size. The `name` identifies the size in output filenames
|
|
10
10
|
* (e.g. `og`, `square`) and must be unique within a config, so every
|
|
11
11
|
* generated image gets a distinct, descriptive filename.
|
|
12
|
+
*
|
|
13
|
+
* A size may also carry {@link SizeOverrides}, applied only when rendering it.
|
|
12
14
|
*/
|
|
13
|
-
export interface OutputSize {
|
|
15
|
+
export interface OutputSize extends SizeOverrides {
|
|
14
16
|
readonly name: string;
|
|
15
17
|
readonly width: number;
|
|
16
18
|
readonly height: number;
|
|
@@ -24,7 +26,37 @@ export interface GradientStop {
|
|
|
24
26
|
readonly color: string;
|
|
25
27
|
}
|
|
26
28
|
/**
|
|
27
|
-
*
|
|
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.
|
|
28
60
|
*
|
|
29
61
|
* Gradient coordinates use SVG object-bounding-box units (0–1); the default
|
|
30
62
|
* runs diagonally from the top-left `(0, 0)` to the bottom-right `(1, 1)`.
|
|
@@ -43,10 +75,41 @@ export type Background = {
|
|
|
43
75
|
readonly x: number;
|
|
44
76
|
readonly y: number;
|
|
45
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;
|
|
46
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
|
+
}
|
|
47
110
|
/**
|
|
48
111
|
* Brand colours used to derive the default gradient and text colour. All are
|
|
49
|
-
* configurable per project
|
|
112
|
+
* configurable per project, and nothing here is tied to a specific site.
|
|
50
113
|
*/
|
|
51
114
|
export interface BrandColors {
|
|
52
115
|
readonly brand: string;
|
|
@@ -75,14 +138,11 @@ export interface Badge {
|
|
|
75
138
|
export interface CodeStyle {
|
|
76
139
|
/** Shiki theme name, e.g. `github-dark`, `monokai`, `catppuccin-mocha`. */
|
|
77
140
|
readonly theme?: string;
|
|
78
|
-
/** Monospace font stack. Must resolve to a font available to `sharp`. */
|
|
79
|
-
readonly fontFamily?: string;
|
|
80
141
|
/**
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
* such as Consolas want ~`0.55`.
|
|
142
|
+
* Monospace font stack. Must resolve to a configured font, or to an
|
|
143
|
+
* installed one when `systemFonts` is on.
|
|
84
144
|
*/
|
|
85
|
-
readonly
|
|
145
|
+
readonly fontFamily?: string;
|
|
86
146
|
/** Line advance as a multiple of the font size. Default `1.55`. */
|
|
87
147
|
readonly lineHeight?: number;
|
|
88
148
|
/** Spaces a tab expands to before layout. Default `2`. */
|
|
@@ -92,14 +152,39 @@ export interface CodeStyle {
|
|
|
92
152
|
/** Upper bound on the auto-fitted font size, as a fraction of image width. */
|
|
93
153
|
readonly maxFontScale?: number;
|
|
94
154
|
/**
|
|
95
|
-
* Lower bound on the auto-fitted font size, as a fraction of image width
|
|
96
|
-
*
|
|
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
|
|
97
157
|
* to fit at this size is truncated with an ellipsis rather than shrunk into
|
|
98
158
|
* illegibility, so raising this trades lines of code for readability and
|
|
99
159
|
* lowering it does the reverse.
|
|
100
160
|
*/
|
|
101
161
|
readonly minFontScale?: number;
|
|
102
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* A font to load into the rasteriser, given either as a file path or as the
|
|
165
|
+
* font's bytes. Supply one entry per font file: weight and style are read from
|
|
166
|
+
* the file itself, so a bold and a regular face are two entries, and the SVG's
|
|
167
|
+
* `font-weight` picks between them.
|
|
168
|
+
*
|
|
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`,
|
|
171
|
+
* which saves repeating the name for the common single-font case.
|
|
172
|
+
*/
|
|
173
|
+
export type FontSource = {
|
|
174
|
+
readonly family?: string;
|
|
175
|
+
/**
|
|
176
|
+
* Path to a `.ttf`, `.otf`, `.ttc` or `.otc` file, resolved from the
|
|
177
|
+
* current working directory when relative.
|
|
178
|
+
*/
|
|
179
|
+
readonly path: string;
|
|
180
|
+
} | {
|
|
181
|
+
readonly family?: string;
|
|
182
|
+
/**
|
|
183
|
+
* The font file's bytes, for fonts loaded from a bundle or fetched at
|
|
184
|
+
* build time rather than read from disk.
|
|
185
|
+
*/
|
|
186
|
+
readonly data: Uint8Array;
|
|
187
|
+
};
|
|
103
188
|
/**
|
|
104
189
|
* Image properties, typically read from a post's frontmatter. The schema is
|
|
105
190
|
* intentionally open: templates read whatever fields they understand, so a
|
|
@@ -111,15 +196,236 @@ export interface MetaImageProps {
|
|
|
111
196
|
readonly title?: string;
|
|
112
197
|
readonly subtitle?: string;
|
|
113
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;
|
|
114
205
|
readonly [key: string]: unknown;
|
|
115
206
|
}
|
|
116
207
|
/**
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
208
|
+
* Build image props from a post's whole frontmatter, so a project can use the
|
|
209
|
+
* fields it already has rather than adding a props block to every file.
|
|
210
|
+
*
|
|
211
|
+
* Return `undefined` to leave a post without images. That is the filter for
|
|
212
|
+
* drafts, section indexes and anything else in the tree that is not a page
|
|
213
|
+
* worth sharing. Without it, mapping frontmatter would mean an image for every
|
|
214
|
+
* markdown file there is. It only settles posts that say nothing for
|
|
215
|
+
* themselves, though: one declaring a props block is rendered either way, since
|
|
216
|
+
* asking for an image outright beats a blanket rule.
|
|
217
|
+
*
|
|
218
|
+
* The returned fields need not be complete: they are merged under whatever the
|
|
219
|
+
* post declares explicitly, and a missing template falls back to
|
|
220
|
+
* {@link ContentOptions.defaultTemplate}.
|
|
221
|
+
*/
|
|
222
|
+
export type PropsFromFrontmatter = (frontmatter: Record<string, unknown>) => Record<string, unknown> | undefined;
|
|
223
|
+
/**
|
|
224
|
+
* How a post's slug, the base name for its images, is derived from its path
|
|
225
|
+
* when the frontmatter does not declare one.
|
|
226
|
+
*
|
|
227
|
+
* - `basename`: the filename without extension, or the parent directory for
|
|
228
|
+
* `index.*`. Suits page bundles, where the image sits beside the content.
|
|
229
|
+
* - `route`: the whole path without extension, with `index.*` standing for its
|
|
230
|
+
* directory, so `services/iam/index.md` becomes `services/iam` and a root
|
|
231
|
+
* `index.md` becomes `index`. Suits a site addressed by route.
|
|
232
|
+
*/
|
|
233
|
+
export type SlugStrategy = "basename" | "route";
|
|
234
|
+
/**
|
|
235
|
+
* How to read image props out of a content tree. Every field is optional.
|
|
236
|
+
*
|
|
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.
|
|
241
|
+
*/
|
|
242
|
+
export interface ContentOptions {
|
|
243
|
+
/** Frontmatter key holding the image props object. Default `meta_img_props`. */
|
|
244
|
+
readonly propsKey?: string;
|
|
245
|
+
/** Field within the props object naming the template. Default `template`. */
|
|
246
|
+
readonly templateField?: string;
|
|
247
|
+
/** Template to use when the template field is absent. */
|
|
248
|
+
readonly defaultTemplate?: string;
|
|
249
|
+
/**
|
|
250
|
+
* Derive props from a post's existing frontmatter, for a site whose posts
|
|
251
|
+
* already carry the fields an image needs under different names. An explicit
|
|
252
|
+
* props object still wins field by field, so per-post overrides keep working.
|
|
253
|
+
*/
|
|
254
|
+
readonly props?: PropsFromFrontmatter;
|
|
255
|
+
/**
|
|
256
|
+
* Top-level frontmatter field to read the post slug from (used as the base
|
|
257
|
+
* filename). Default `slug`; falls back to the file/directory name.
|
|
258
|
+
*/
|
|
259
|
+
readonly slugField?: string;
|
|
260
|
+
/**
|
|
261
|
+
* How to derive a slug from a post's path when its frontmatter declares
|
|
262
|
+
* none. Default `basename`.
|
|
263
|
+
*/
|
|
264
|
+
readonly slugStrategy?: SlugStrategy;
|
|
265
|
+
/** File extensions to include. Default `.md` and `.markdown`. */
|
|
266
|
+
readonly extensions?: readonly string[];
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* A discovered content file with the image props read from its frontmatter.
|
|
270
|
+
*
|
|
271
|
+
* It lives here rather than with the walker so that {@link Placement} can name
|
|
272
|
+
* it without the config module depending on the content module, for the reason
|
|
273
|
+
* {@link ContentOptions} does.
|
|
274
|
+
*/
|
|
275
|
+
export interface ContentFile {
|
|
276
|
+
/** Path relative to the walk `dir`. */
|
|
277
|
+
readonly contentPath: string;
|
|
278
|
+
/** Absolute path on disk. */
|
|
279
|
+
readonly absolutePath: string;
|
|
280
|
+
/** Base filename for this post's images (frontmatter slug, or path-derived). */
|
|
281
|
+
readonly slug: string;
|
|
282
|
+
readonly props: MetaImageProps;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Where an image is written, and the URL it is served at once it is.
|
|
286
|
+
*
|
|
287
|
+
* `outputPath` alone says where the bytes go and nothing about how anyone
|
|
288
|
+
* reaches them, so every site ends up rebuilding that mapping in its own
|
|
289
|
+
* templates, from information Colophon had at generate time and threw away.
|
|
290
|
+
*
|
|
291
|
+
* - `beside-content`: next to the post, which is the page-bundle convention
|
|
292
|
+
* and what Colophon has always done. Still the default.
|
|
293
|
+
* - `public-dir`: gathered into one directory, as Astro, Eleventy and Vite
|
|
294
|
+
* expect. A slug carrying directories keeps them underneath it.
|
|
295
|
+
* - `custom`: for a site whose mapping is its own, such as images under a
|
|
296
|
+
* dated directory.
|
|
297
|
+
*
|
|
298
|
+
* `urlBase` is what makes a URL: it is prefixed to the image's path under the
|
|
299
|
+
* root that placed it, and without one there is no URL, because no directory
|
|
300
|
+
* on disk says by itself how it is served. It can be a site-relative path
|
|
301
|
+
* (`/og`) or an absolute one, for images served from a CDN.
|
|
302
|
+
*
|
|
303
|
+
* `hash` puts a digest of the image's inputs in its filename, so that changing
|
|
304
|
+
* a post gives its image a URL nobody has cached yet. It is opt-in because it
|
|
305
|
+
* also means the filename moves whenever the image does, which not every setup
|
|
306
|
+
* wants. `custom` has no say in it: a placement naming its own paths is the
|
|
307
|
+
* one that can hash them itself.
|
|
308
|
+
*/
|
|
309
|
+
export type Placement = {
|
|
310
|
+
readonly strategy: "beside-content";
|
|
311
|
+
readonly urlBase?: string;
|
|
312
|
+
readonly hash?: boolean;
|
|
313
|
+
} | {
|
|
314
|
+
readonly strategy: "public-dir";
|
|
315
|
+
/** Directory to gather images into, relative to the working directory. */
|
|
316
|
+
readonly dir: string;
|
|
317
|
+
readonly urlBase?: string;
|
|
318
|
+
readonly hash?: boolean;
|
|
319
|
+
} | {
|
|
320
|
+
readonly strategy: "custom";
|
|
321
|
+
readonly path: (file: ContentFile, size: OutputSize) => string;
|
|
322
|
+
/** Omit for images that are written but not served. */
|
|
323
|
+
readonly url?: (file: ContentFile, size: OutputSize) => string | undefined;
|
|
324
|
+
};
|
|
325
|
+
/**
|
|
326
|
+
* One image in the manifest.
|
|
327
|
+
*
|
|
328
|
+
* The dimensions are the ones it was actually rendered at, which is the point:
|
|
329
|
+
* sites hardcode 1200 and 630 into their meta tags because nothing told them
|
|
330
|
+
* otherwise, and a size they later change leaves the tags behind.
|
|
331
|
+
*/
|
|
332
|
+
export interface ManifestImage {
|
|
333
|
+
/** Absent where the placement knows no URL. See {@link Placement}. */
|
|
334
|
+
readonly url?: string;
|
|
335
|
+
readonly width: number;
|
|
336
|
+
readonly height: number;
|
|
337
|
+
}
|
|
338
|
+
/** One page's images, keyed by output size name. */
|
|
339
|
+
export interface ManifestPage {
|
|
340
|
+
readonly images: Readonly<Record<string, ManifestImage>>;
|
|
341
|
+
/**
|
|
342
|
+
* The name of the most landscape image, by aspect ratio, with ties going to
|
|
343
|
+
* the first size configured. It is what a `summary_large_image` card wants,
|
|
344
|
+
* and picking it is a check every site currently writes for itself.
|
|
345
|
+
*/
|
|
346
|
+
readonly widest: string;
|
|
347
|
+
/** Alt text, from the props' title. Absent for a page that has no title. */
|
|
348
|
+
readonly alt?: string;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* What a build generated, for the site to read back: a JSON file listing every
|
|
352
|
+
* page's images, their URLs and the dimensions they were rendered at.
|
|
353
|
+
*
|
|
354
|
+
* Without it a site reconstructs all of that in template code, globbing for
|
|
355
|
+
* `*-og.png` to find the landscape variant, or writing image paths back into
|
|
356
|
+
* each post's frontmatter. All of it is known while generating.
|
|
357
|
+
*
|
|
358
|
+
* Pages are keyed by slug, which is what a site addresses a page by: with
|
|
359
|
+
* `slugStrategy: "route"` that is the route itself.
|
|
360
|
+
*/
|
|
361
|
+
export interface Manifest {
|
|
362
|
+
/** Schema version, so a reader can tell what it is holding. */
|
|
363
|
+
readonly version: 1;
|
|
364
|
+
readonly pages: Readonly<Record<string, ManifestPage>>;
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* One `<meta>` tag, as the attributes it carries.
|
|
368
|
+
*
|
|
369
|
+
* Open Graph names its tags with `property` and Twitter with `name`, which is
|
|
370
|
+
* a distinction sites get wrong routinely. Keeping them apart in the type
|
|
371
|
+
* means a component can spread a tag with `<meta {...tag} />` and be right
|
|
372
|
+
* either way.
|
|
373
|
+
*/
|
|
374
|
+
export type MetaTag = {
|
|
375
|
+
readonly property: string;
|
|
376
|
+
readonly content: string;
|
|
377
|
+
} | {
|
|
378
|
+
readonly name: string;
|
|
379
|
+
readonly content: string;
|
|
380
|
+
};
|
|
381
|
+
/** Options for {@link MetaTag} generation. */
|
|
382
|
+
export interface MetaTagOptions {
|
|
383
|
+
/**
|
|
384
|
+
* Absolute base for a site-relative image URL, e.g. `https://example.com`.
|
|
385
|
+
*
|
|
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
|
|
388
|
+
* `urlBase` said, which is usually site-relative. A URL that is already
|
|
389
|
+
* absolute is left alone, so a CDN base needs nothing here.
|
|
390
|
+
*/
|
|
391
|
+
readonly baseUrl?: string;
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
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.
|
|
121
398
|
*/
|
|
122
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;
|
|
123
429
|
/**
|
|
124
430
|
* Everything a template needs to produce its SVG foreground content.
|
|
125
431
|
*/
|
|
@@ -127,15 +433,32 @@ export interface TemplateContext {
|
|
|
127
433
|
readonly props: MetaImageProps;
|
|
128
434
|
readonly config: ResolvedConfig;
|
|
129
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;
|
|
130
453
|
}
|
|
131
454
|
/**
|
|
132
455
|
* A registered template. `render` returns the SVG *foreground* content (text,
|
|
133
456
|
* badges, etc.) for the given dimensions; the background and the enclosing
|
|
134
457
|
* `<svg>` root are added by the renderer.
|
|
135
458
|
*
|
|
136
|
-
* Rendering may be asynchronous
|
|
137
|
-
* demand
|
|
138
|
-
* 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.
|
|
139
462
|
*/
|
|
140
463
|
export interface Template {
|
|
141
464
|
readonly name: string;
|
|
@@ -149,11 +472,35 @@ export interface ColophonConfig {
|
|
|
149
472
|
readonly colors?: BrandColors;
|
|
150
473
|
/** Explicit background, overriding the gradient derived from `colors`. */
|
|
151
474
|
readonly background?: Background;
|
|
475
|
+
/**
|
|
476
|
+
* Fonts to load into the rasteriser, so the output does not depend on what
|
|
477
|
+
* the build machine happens to have installed. Supplying any font turns
|
|
478
|
+
* {@link ColophonConfig.systemFonts} off by default, which is the point:
|
|
479
|
+
* a laptop, CI and a Docker image then render the same image.
|
|
480
|
+
*/
|
|
481
|
+
readonly fonts?: readonly FontSource[];
|
|
482
|
+
/**
|
|
483
|
+
* Whether to also load the machine's installed fonts. Defaults to `true`
|
|
484
|
+
* when no `fonts` are configured (nothing else would render) and `false`
|
|
485
|
+
* when they are. Turn it on alongside `fonts` to fall back to system fonts
|
|
486
|
+
* for families you have not supplied, at the cost of determinism.
|
|
487
|
+
*/
|
|
488
|
+
readonly systemFonts?: boolean;
|
|
489
|
+
/**
|
|
490
|
+
* Font stack for template text. Defaults to the `family` of the first
|
|
491
|
+
* configured font, or to `DEFAULT_FONT_FAMILY` when there is none.
|
|
492
|
+
*/
|
|
152
493
|
readonly fontFamily?: string;
|
|
153
494
|
/** Footer text drawn along the bottom edge. Omit (the default) for none. */
|
|
154
495
|
readonly footer?: string;
|
|
155
496
|
/** Corner badge for the `banner` template. Omit (the default) for none. */
|
|
156
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;
|
|
157
504
|
/** Styling for the `code` template. */
|
|
158
505
|
readonly code?: CodeStyle;
|
|
159
506
|
/**
|
|
@@ -168,6 +515,95 @@ export interface ColophonConfig {
|
|
|
168
515
|
readonly sizes?: readonly OutputSize[];
|
|
169
516
|
/** Extra templates, merged over (and able to override) the built-ins. */
|
|
170
517
|
readonly templates?: Readonly<Record<string, Template>>;
|
|
518
|
+
/**
|
|
519
|
+
* How to read props out of the content tree. Used by `generate` and the CLI;
|
|
520
|
+
* the render core never sees it.
|
|
521
|
+
*/
|
|
522
|
+
readonly content?: ContentOptions;
|
|
523
|
+
/**
|
|
524
|
+
* Where images are written and what URL they end up at. Defaults to
|
|
525
|
+
* `beside-content`, which is what Colophon did before there was a choice.
|
|
526
|
+
*/
|
|
527
|
+
readonly placement?: Placement;
|
|
528
|
+
/**
|
|
529
|
+
* Where to write a {@link Manifest} of everything the build generated,
|
|
530
|
+
* relative to the working directory. Omit (the default) to write none.
|
|
531
|
+
*
|
|
532
|
+
* Somewhere the site reads data from: `data/colophon.json` for Hugo,
|
|
533
|
+
* `src/data/` for Astro, `_data/` for Eleventy and Jekyll.
|
|
534
|
+
*/
|
|
535
|
+
readonly manifest?: string;
|
|
536
|
+
/**
|
|
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.
|
|
540
|
+
*/
|
|
541
|
+
readonly extra?: readonly ExtraImage[];
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* A function a config module may export instead of a config object, so that a
|
|
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.
|
|
547
|
+
*
|
|
548
|
+
* It takes no arguments. Anything it might be handed is either already on the
|
|
549
|
+
* command line or a decision the config itself is making.
|
|
550
|
+
*/
|
|
551
|
+
export type ColophonConfigFactory = () => ColophonConfig | Promise<ColophonConfig>;
|
|
552
|
+
/** What a config module's default export may be. */
|
|
553
|
+
export type ColophonConfigInput = ColophonConfig | ColophonConfigFactory;
|
|
554
|
+
/**
|
|
555
|
+
* Config an {@link OutputSize} may override for itself.
|
|
556
|
+
*
|
|
557
|
+
* Some settings only make sense per size: `code.minFontScale` is the clearest
|
|
558
|
+
* case, because a 1:1 square and a 1.91:1 landscape have very different amounts
|
|
559
|
+
* of vertical room for the same snippet. Without this the only way to vary one
|
|
560
|
+
* is a `generate` pass per size, which walks and parses the whole content tree
|
|
561
|
+
* again for each.
|
|
562
|
+
*
|
|
563
|
+
* Only what a template reads while drawing is overridable. `fonts`,
|
|
564
|
+
* `systemFonts` and `templates` are shared build inputs rather than part of the
|
|
565
|
+
* picture. `onWarning` is where messages go rather than what they say, and
|
|
566
|
+
* `sizes` inside a size would be nonsense.
|
|
567
|
+
*/
|
|
568
|
+
export interface SizeOverrides {
|
|
569
|
+
/**
|
|
570
|
+
* Merged over the config's `colors`, so a size can change one shade on its
|
|
571
|
+
* own. `brand` is optional here precisely because the rest are kept.
|
|
572
|
+
*/
|
|
573
|
+
readonly colors?: Partial<BrandColors>;
|
|
574
|
+
/** Replaces the config's background outright. See the note on merging. */
|
|
575
|
+
readonly background?: Background;
|
|
576
|
+
readonly fontFamily?: string;
|
|
577
|
+
readonly footer?: string;
|
|
578
|
+
readonly badge?: Badge;
|
|
579
|
+
/** Replaces the config's logo, for a size that wants a different mark. */
|
|
580
|
+
readonly logo?: ImageSource;
|
|
581
|
+
/** Merged over the config's `code`, so a size can change one setting. */
|
|
582
|
+
readonly code?: CodeStyle;
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* A single image that is not tied to a content file: props, somewhere to write
|
|
586
|
+
* it, and the size to draw it at.
|
|
587
|
+
*
|
|
588
|
+
* The alternative is a script that calls `renderMetaImages` and writes the
|
|
589
|
+
* bytes itself, which is a lot of machinery for one card, and which keeps
|
|
590
|
+
* neither the rebuild stamps nor the build log a content image gets.
|
|
591
|
+
*/
|
|
592
|
+
export interface ExtraImage {
|
|
593
|
+
readonly props: MetaImageProps;
|
|
594
|
+
/**
|
|
595
|
+
* Where to write the PNG, resolved from the current working directory when
|
|
596
|
+
* relative. This image has no post to sit beside, so there is nothing to
|
|
597
|
+
* derive a path from and `generate`'s `outputPath` is not consulted.
|
|
598
|
+
*/
|
|
599
|
+
readonly output: string;
|
|
600
|
+
/**
|
|
601
|
+
* The size to render at, {@link SizeOverrides} and all. An inline size is
|
|
602
|
+
* how a one-off image gets its own footer or palette without a whole entry
|
|
603
|
+
* in `sizes`. Defaults to the first configured size, since a one-off card
|
|
604
|
+
* usually wants to match the site's primary share format.
|
|
605
|
+
*/
|
|
606
|
+
readonly size?: OutputSize;
|
|
171
607
|
}
|
|
172
608
|
/**
|
|
173
609
|
* Fully-resolved configuration with all defaults applied.
|
|
@@ -175,9 +611,13 @@ export interface ColophonConfig {
|
|
|
175
611
|
export interface ResolvedConfig {
|
|
176
612
|
readonly colors: Required<BrandColors>;
|
|
177
613
|
readonly background: Background;
|
|
614
|
+
/** Configured fonts, with every `path` made absolute. */
|
|
615
|
+
readonly fonts: readonly FontSource[];
|
|
616
|
+
readonly systemFonts: boolean;
|
|
178
617
|
readonly fontFamily: string;
|
|
179
618
|
readonly footer: string | undefined;
|
|
180
619
|
readonly badge: Badge | undefined;
|
|
620
|
+
readonly logo: ImageSource | undefined;
|
|
181
621
|
readonly code: Required<CodeStyle>;
|
|
182
622
|
readonly onWarning: WarningHandler;
|
|
183
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.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,UAAW,SAAQ,aAAa;IAC/C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,yDAAyD;IACzD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;GAUG;AACH,MAAM,MAAM,WAAW,GACnB;IACE,yDAAyD;IACzD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB,GACD;IACE;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B,CAAC;AAEN,4EAA4E;AAC5E,MAAM,WAAW,KAAK;IACpB,yBAAyB;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,mDAAmD;IACnD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,sDAAsD;IACtD,QAAQ,CAAC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C,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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Whether a value is a plain object, and so has keys worth checking. */
|
|
2
|
+
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
3
|
+
/** Whether a value is a list, and so has entries worth checking. */
|
|
4
|
+
export declare function isList(value: unknown): value is readonly unknown[];
|
|
5
|
+
/**
|
|
6
|
+
* Report every key of one config object that is not a known option. Anything
|
|
7
|
+
* that is not an object is left alone: the shape of a value is the type
|
|
8
|
+
* checker's business, and there are no keys to judge either way.
|
|
9
|
+
*/
|
|
10
|
+
export declare function checkKeys(value: unknown, path: string, known: readonly string[], problems: string[]): void;
|
|
11
|
+
/** Check every entry of a list, naming each by its index. */
|
|
12
|
+
export declare function checkEach(values: unknown, path: string, known: readonly string[], problems: string[]): void;
|
|
13
|
+
//# sourceMappingURL=check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/validate/check.ts"],"names":[],"mappings":"AAEA,yEAAyE;AACzE,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE;AAED,oEAAoE;AACpE,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,OAAO,EAAE,CAElE;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,QAAQ,EAAE,MAAM,EAAE,GACjB,IAAI,CAYN;AAED,6DAA6D;AAC7D,wBAAgB,SAAS,CACvB,MAAM,EAAE,OAAO,EACf,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,QAAQ,EAAE,MAAM,EAAE,GACjB,IAAI,CAQN"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { describeUnknownOption } from "./suggest.js";
|
|
2
|
+
/** Whether a value is a plain object, and so has keys worth checking. */
|
|
3
|
+
export function isRecord(value) {
|
|
4
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5
|
+
}
|
|
6
|
+
/** Whether a value is a list, and so has entries worth checking. */
|
|
7
|
+
export function isList(value) {
|
|
8
|
+
return Array.isArray(value);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Report every key of one config object that is not a known option. Anything
|
|
12
|
+
* that is not an object is left alone: the shape of a value is the type
|
|
13
|
+
* checker's business, and there are no keys to judge either way.
|
|
14
|
+
*/
|
|
15
|
+
export function checkKeys(value, path, known, problems) {
|
|
16
|
+
if (!isRecord(value)) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
for (const key of Object.keys(value)) {
|
|
20
|
+
if (!known.includes(key)) {
|
|
21
|
+
problems.push(describeUnknownOption(path === "" ? key : `${path}.${key}`, key, known));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/** Check every entry of a list, naming each by its index. */
|
|
26
|
+
export function checkEach(values, path, known, problems) {
|
|
27
|
+
if (!isList(values)) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
for (const [index, value] of values.entries()) {
|
|
31
|
+
checkKeys(value, `${path}[${String(index)}]`, known, problems);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../src/validate/check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD,yEAAyE;AACzE,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,oEAAoE;AACpE,MAAM,UAAU,MAAM,CAAC,KAAc;IACnC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS,CACvB,KAAc,EACd,IAAY,EACZ,KAAwB,EACxB,QAAkB;IAElB,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO;IACT,CAAC;IAED,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACrC,IAAI,CAAC,KAAK,CAAC,QAAQ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