@kensio/colophon 2.4.0 → 2.6.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 +139 -13
- package/dist/astro/index.d.ts +49 -0
- package/dist/astro/index.d.ts.map +1 -0
- package/dist/astro/index.js +42 -0
- package/dist/astro/index.js.map +1 -0
- package/dist/background/gradient.d.ts +12 -0
- package/dist/background/gradient.d.ts.map +1 -0
- package/dist/background/gradient.js +21 -0
- package/dist/background/gradient.js.map +1 -0
- package/dist/background/image.d.ts +14 -0
- package/dist/background/image.d.ts.map +1 -0
- package/dist/background/image.js +36 -0
- package/dist/background/image.js.map +1 -0
- package/dist/{background.d.ts → background/index.d.ts} +5 -5
- package/dist/background/index.d.ts.map +1 -0
- package/dist/background/index.js +27 -0
- package/dist/background/index.js.map +1 -0
- package/dist/background/mesh.d.ts +12 -0
- package/dist/background/mesh.d.ts.map +1 -0
- package/dist/background/mesh.js +43 -0
- package/dist/background/mesh.js.map +1 -0
- package/dist/cli/args/command.d.ts +13 -0
- package/dist/cli/args/command.d.ts.map +1 -0
- package/dist/cli/args/command.js +22 -0
- package/dist/cli/args/command.js.map +1 -0
- package/dist/cli/args/index.d.ts +28 -0
- package/dist/cli/args/index.d.ts.map +1 -0
- package/dist/cli/args/index.js +75 -0
- package/dist/cli/args/index.js.map +1 -0
- package/dist/cli/args/switches.d.ts +18 -0
- package/dist/cli/args/switches.d.ts.map +1 -0
- package/dist/cli/args/switches.js +42 -0
- package/dist/cli/args/switches.js.map +1 -0
- package/dist/cli/args/usage.d.ts +3 -0
- package/dist/cli/args/usage.d.ts.map +1 -0
- package/dist/cli/args/usage.js +34 -0
- package/dist/cli/args/usage.js.map +1 -0
- package/dist/cli/args/values.d.ts +11 -0
- package/dist/cli/args/values.d.ts.map +1 -0
- package/dist/cli/args/values.js +29 -0
- package/dist/cli/args/values.js.map +1 -0
- package/dist/cli/build.d.ts +10 -0
- package/dist/cli/build.d.ts.map +1 -0
- package/dist/cli/build.js +41 -0
- package/dist/cli/build.js.map +1 -0
- package/dist/cli/eject/adapters.d.ts +20 -0
- package/dist/cli/eject/adapters.d.ts.map +1 -0
- package/dist/cli/eject/adapters.js +29 -0
- package/dist/cli/eject/adapters.js.map +1 -0
- package/dist/cli/eject/astro.d.ts +13 -0
- package/dist/cli/eject/astro.d.ts.map +1 -0
- package/dist/cli/eject/astro.js +35 -0
- package/dist/cli/eject/astro.js.map +1 -0
- package/dist/cli/eject/hugo.d.ts +19 -0
- package/dist/cli/eject/hugo.d.ts.map +1 -0
- package/dist/cli/eject/hugo.js +127 -0
- package/dist/cli/eject/hugo.js.map +1 -0
- package/dist/cli/eject/index.d.ts +15 -0
- package/dist/cli/eject/index.d.ts.map +1 -0
- package/dist/cli/eject/index.js +46 -0
- package/dist/cli/eject/index.js.map +1 -0
- package/dist/cli/index.js +25 -20
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init/fs.d.ts +5 -0
- package/dist/cli/init/fs.d.ts.map +1 -0
- package/dist/cli/init/fs.js +19 -0
- package/dist/cli/init/fs.js.map +1 -0
- package/dist/cli/init/guess.d.ts +9 -0
- package/dist/cli/init/guess.d.ts.map +1 -0
- package/dist/cli/init/guess.js +27 -0
- package/dist/cli/init/guess.js.map +1 -0
- package/dist/cli/init/index.d.ts +11 -0
- package/dist/cli/init/index.d.ts.map +1 -0
- package/dist/cli/init/index.js +36 -0
- package/dist/cli/init/index.js.map +1 -0
- package/dist/cli/init/module.d.ts +12 -0
- package/dist/cli/init/module.d.ts.map +1 -0
- package/dist/cli/init/module.js +45 -0
- package/dist/cli/init/module.js.map +1 -0
- package/dist/cli/init/scaffold.d.ts +10 -0
- package/dist/cli/init/scaffold.d.ts.map +1 -0
- package/dist/cli/init/scaffold.js +52 -0
- package/dist/cli/init/scaffold.js.map +1 -0
- package/dist/cli/message.d.ts +7 -0
- package/dist/cli/message.d.ts.map +1 -0
- package/dist/cli/message.js +9 -0
- package/dist/cli/message.js.map +1 -0
- package/dist/cli/preview/index.d.ts +13 -0
- package/dist/cli/preview/index.d.ts.map +1 -0
- package/dist/cli/preview/index.js +27 -0
- package/dist/cli/preview/index.js.map +1 -0
- package/dist/cli/preview/open.d.ts +10 -0
- package/dist/cli/preview/open.d.ts.map +1 -0
- package/dist/cli/preview/open.js +32 -0
- package/dist/cli/preview/open.js.map +1 -0
- package/dist/cli/preview/render.d.ts +23 -0
- package/dist/cli/preview/render.d.ts.map +1 -0
- package/dist/cli/preview/render.js +40 -0
- package/dist/cli/preview/render.js.map +1 -0
- package/dist/cli/preview/root.d.ts +17 -0
- package/dist/cli/preview/root.d.ts.map +1 -0
- package/dist/cli/preview/root.js +22 -0
- package/dist/cli/preview/root.js.map +1 -0
- package/dist/cli/preview/size.d.ts +7 -0
- package/dist/cli/preview/size.d.ts.map +1 -0
- package/dist/cli/preview/size.js +13 -0
- package/dist/cli/preview/size.js.map +1 -0
- package/dist/cli/report.d.ts +6 -0
- package/dist/cli/report.d.ts.map +1 -0
- package/dist/cli/report.js +23 -0
- package/dist/cli/report.js.map +1 -0
- package/dist/cli/watch/filter.d.ts +14 -0
- package/dist/cli/watch/filter.d.ts.map +1 -0
- package/dist/cli/watch/filter.js +16 -0
- package/dist/cli/watch/filter.js.map +1 -0
- package/dist/cli/watch/index.d.ts +27 -0
- package/dist/cli/watch/index.d.ts.map +1 -0
- package/dist/cli/watch/index.js +38 -0
- package/dist/cli/watch/index.js.map +1 -0
- package/dist/cli/watch/queue.d.ts +24 -0
- package/dist/cli/watch/queue.d.ts.map +1 -0
- package/dist/cli/watch/queue.js +57 -0
- package/dist/cli/watch/queue.js.map +1 -0
- package/dist/config/defaults.d.ts +39 -1
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +38 -0
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/index.d.ts +2 -2
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +27 -6
- package/dist/config/index.js.map +1 -1
- package/dist/config/output.d.ts +26 -0
- package/dist/config/output.d.ts.map +1 -0
- package/dist/config/output.js +45 -0
- package/dist/config/output.js.map +1 -0
- package/dist/config/resolve.d.ts +10 -0
- package/dist/config/resolve.d.ts.map +1 -1
- package/dist/config/resolve.js +20 -1
- package/dist/config/resolve.js.map +1 -1
- package/dist/config/size.d.ts +6 -0
- package/dist/config/size.d.ts.map +1 -1
- package/dist/config/size.js +20 -8
- package/dist/config/size.js.map +1 -1
- package/dist/content/index.d.ts +1 -0
- package/dist/content/index.d.ts.map +1 -1
- package/dist/content/index.js +1 -0
- package/dist/content/index.js.map +1 -1
- package/dist/content/read.d.ts +15 -0
- package/dist/content/read.d.ts.map +1 -0
- package/dist/content/read.js +36 -0
- package/dist/content/read.js.map +1 -0
- package/dist/content/walk.d.ts.map +1 -1
- package/dist/content/walk.js +4 -30
- package/dist/content/walk.js.map +1 -1
- package/dist/core/index.d.ts +37 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +13 -0
- package/dist/core/index.js.map +1 -0
- package/dist/encode/fit.d.ts +16 -0
- package/dist/encode/fit.d.ts.map +1 -0
- package/dist/encode/fit.js +23 -0
- package/dist/encode/fit.js.map +1 -0
- package/dist/encode/format.d.ts +12 -0
- package/dist/encode/format.d.ts.map +1 -0
- package/dist/encode/format.js +40 -0
- package/dist/encode/format.js.map +1 -0
- package/dist/encode/index.d.ts +14 -0
- package/dist/encode/index.d.ts.map +1 -0
- package/dist/encode/index.js +52 -0
- package/dist/encode/index.js.map +1 -0
- package/dist/encode/sharp.d.ts +19 -0
- package/dist/encode/sharp.d.ts.map +1 -0
- package/dist/encode/sharp.js +57 -0
- package/dist/encode/sharp.js.map +1 -0
- package/dist/encode/warn.d.ts +10 -0
- package/dist/encode/warn.d.ts.map +1 -0
- package/dist/encode/warn.js +31 -0
- package/dist/encode/warn.js.map +1 -0
- package/dist/fonts/resolve.d.ts.map +1 -1
- package/dist/fonts/resolve.js +2 -8
- package/dist/fonts/resolve.js.map +1 -1
- package/dist/generate/index.d.ts +4 -0
- package/dist/generate/index.d.ts.map +1 -1
- package/dist/generate/index.js +10 -4
- package/dist/generate/index.js.map +1 -1
- package/dist/generate/options.d.ts +11 -1
- package/dist/generate/options.d.ts.map +1 -1
- package/dist/generate/options.js.map +1 -1
- package/dist/generate/output-path.d.ts +6 -2
- package/dist/generate/output-path.d.ts.map +1 -1
- package/dist/generate/output-path.js +7 -2
- package/dist/generate/output-path.js.map +1 -1
- package/dist/generate/plan.d.ts.map +1 -1
- package/dist/generate/plan.js +3 -3
- package/dist/generate/plan.js.map +1 -1
- package/dist/generate/render-image.d.ts +6 -0
- package/dist/generate/render-image.d.ts.map +1 -1
- package/dist/generate/render-image.js +14 -4
- package/dist/generate/render-image.js.map +1 -1
- package/dist/image/index.d.ts +3 -1
- package/dist/image/index.d.ts.map +1 -1
- package/dist/image/index.js +4 -3
- package/dist/image/index.js.map +1 -1
- package/dist/image/jpeg.d.ts +5 -4
- package/dist/image/jpeg.d.ts.map +1 -1
- package/dist/image/jpeg.js +13 -36
- package/dist/image/jpeg.js.map +1 -1
- package/dist/image/load.d.ts.map +1 -1
- package/dist/image/load.js +4 -15
- package/dist/image/load.js.map +1 -1
- package/dist/image/resolve.d.ts.map +1 -1
- package/dist/image/resolve.js +2 -8
- package/dist/image/resolve.js.map +1 -1
- package/dist/image/uri.d.ts.map +1 -1
- package/dist/image/uri.js +2 -3
- package/dist/image/uri.js.map +1 -1
- package/dist/index.d.ts +10 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -4
- package/dist/index.js.map +1 -1
- package/dist/jpeg/index.d.ts +10 -0
- package/dist/jpeg/index.d.ts.map +1 -0
- package/dist/jpeg/index.js +2 -0
- package/dist/jpeg/index.js.map +1 -0
- package/dist/jpeg/segments.d.ts +32 -0
- package/dist/jpeg/segments.d.ts.map +1 -0
- package/dist/jpeg/segments.js +66 -0
- package/dist/jpeg/segments.js.map +1 -0
- package/dist/layout/draw.d.ts +20 -0
- package/dist/layout/draw.d.ts.map +1 -0
- package/dist/layout/draw.js +32 -0
- package/dist/layout/draw.js.map +1 -0
- package/dist/layout/extent.d.ts +19 -0
- package/dist/layout/extent.d.ts.map +1 -0
- package/dist/layout/extent.js +24 -0
- package/dist/layout/extent.js.map +1 -0
- package/dist/layout/index.d.ts +7 -4
- package/dist/layout/index.d.ts.map +1 -1
- package/dist/layout/index.js +5 -3
- package/dist/layout/index.js.map +1 -1
- package/dist/layout/lines.d.ts +0 -17
- package/dist/layout/lines.d.ts.map +1 -1
- package/dist/layout/lines.js +2 -35
- package/dist/layout/lines.js.map +1 -1
- package/dist/measure/faces.d.ts.map +1 -1
- package/dist/measure/faces.js +8 -2
- package/dist/measure/faces.js.map +1 -1
- package/dist/meta/index.d.ts +1 -0
- package/dist/meta/index.d.ts.map +1 -1
- package/dist/meta/index.js +1 -0
- package/dist/meta/index.js.map +1 -1
- package/dist/meta/path.d.ts +24 -0
- package/dist/meta/path.d.ts.map +1 -0
- package/dist/meta/path.js +41 -0
- package/dist/meta/path.js.map +1 -0
- package/dist/meta/tags.d.ts.map +1 -1
- package/dist/meta/tags.js +6 -1
- package/dist/meta/tags.js.map +1 -1
- package/dist/placement/index.d.ts +7 -2
- package/dist/placement/index.d.ts.map +1 -1
- package/dist/placement/index.js +9 -3
- package/dist/placement/index.js.map +1 -1
- package/dist/placement/relative.d.ts +8 -3
- package/dist/placement/relative.d.ts.map +1 -1
- package/dist/placement/relative.js +12 -5
- package/dist/placement/relative.js.map +1 -1
- package/dist/platform/base64.d.ts +13 -0
- package/dist/platform/base64.d.ts.map +1 -0
- package/dist/platform/base64.js +35 -0
- package/dist/platform/base64.js.map +1 -0
- package/dist/platform/rasteriser.browser.d.ts +16 -0
- package/dist/platform/rasteriser.browser.d.ts.map +1 -0
- package/dist/platform/rasteriser.browser.js +20 -0
- package/dist/platform/rasteriser.browser.js.map +1 -0
- package/dist/platform/rasteriser.node.d.ts +2 -0
- package/dist/platform/rasteriser.node.d.ts.map +1 -0
- package/dist/platform/rasteriser.node.js +2 -0
- package/dist/platform/rasteriser.node.js.map +1 -0
- package/dist/platform/read-file.browser.d.ts +17 -0
- package/dist/platform/read-file.browser.d.ts.map +1 -0
- package/dist/platform/read-file.browser.js +23 -0
- package/dist/platform/read-file.browser.js.map +1 -0
- package/dist/platform/read-file.node.d.ts +19 -0
- package/dist/platform/read-file.node.d.ts.map +1 -0
- package/dist/platform/read-file.node.js +31 -0
- package/dist/platform/read-file.node.js.map +1 -0
- package/dist/png/chunk.d.ts +23 -0
- package/dist/png/chunk.d.ts.map +1 -0
- package/dist/png/chunk.js +48 -0
- package/dist/png/chunk.js.map +1 -0
- package/dist/png/index.d.ts +13 -0
- package/dist/png/index.d.ts.map +1 -0
- package/dist/png/index.js +3 -0
- package/dist/png/index.js.map +1 -0
- package/dist/png/recompress.d.ts +23 -0
- package/dist/png/recompress.d.ts.map +1 -0
- package/dist/png/recompress.js +81 -0
- package/dist/png/recompress.js.map +1 -0
- package/dist/props.d.ts +11 -0
- package/dist/props.d.ts.map +1 -1
- package/dist/props.js +16 -0
- package/dist/props.js.map +1 -1
- package/dist/render/image.d.ts +20 -0
- package/dist/render/image.d.ts.map +1 -0
- package/dist/render/image.js +29 -0
- package/dist/render/image.js.map +1 -0
- package/dist/render/index.d.ts +2 -1
- package/dist/render/index.d.ts.map +1 -1
- package/dist/render/index.js +5 -4
- package/dist/render/index.js.map +1 -1
- package/dist/render/png.d.ts +14 -4
- package/dist/render/png.d.ts.map +1 -1
- package/dist/render/png.js +22 -23
- package/dist/render/png.js.map +1 -1
- package/dist/render/rasterise.d.ts +15 -0
- package/dist/render/rasterise.d.ts.map +1 -0
- package/dist/render/rasterise.js +34 -0
- package/dist/render/rasterise.js.map +1 -0
- package/dist/render/svg.d.ts.map +1 -1
- package/dist/render/svg.js +10 -2
- package/dist/render/svg.js.map +1 -1
- package/dist/sign/base64url.d.ts +16 -0
- package/dist/sign/base64url.d.ts.map +1 -0
- package/dist/sign/base64url.js +24 -0
- package/dist/sign/base64url.js.map +1 -0
- package/dist/sign/index.d.ts +49 -0
- package/dist/sign/index.d.ts.map +1 -0
- package/dist/sign/index.js +133 -0
- package/dist/sign/index.js.map +1 -0
- package/dist/stamp/carrier/index.d.ts +7 -0
- package/dist/stamp/carrier/index.d.ts.map +1 -0
- package/dist/stamp/carrier/index.js +27 -0
- package/dist/stamp/carrier/index.js.map +1 -0
- package/dist/stamp/carrier/isobmff.d.ts +7 -0
- package/dist/stamp/carrier/isobmff.d.ts.map +1 -0
- package/dist/stamp/carrier/isobmff.js +55 -0
- package/dist/stamp/carrier/isobmff.js.map +1 -0
- package/dist/stamp/carrier/jpeg.d.ts +4 -0
- package/dist/stamp/carrier/jpeg.d.ts.map +1 -0
- package/dist/stamp/carrier/jpeg.js +76 -0
- package/dist/stamp/carrier/jpeg.js.map +1 -0
- package/dist/stamp/carrier/png.d.ts +7 -0
- package/dist/stamp/carrier/png.d.ts.map +1 -0
- package/dist/stamp/carrier/png.js +50 -0
- package/dist/stamp/carrier/png.js.map +1 -0
- package/dist/stamp/carrier/riff.d.ts +4 -0
- package/dist/stamp/carrier/riff.d.ts.map +1 -0
- package/dist/stamp/carrier/riff.js +54 -0
- package/dist/stamp/carrier/riff.js.map +1 -0
- package/dist/stamp/carrier/types.d.ts +25 -0
- package/dist/stamp/carrier/types.d.ts.map +1 -0
- package/dist/stamp/carrier/types.js +2 -0
- package/dist/stamp/carrier/types.js.map +1 -0
- package/dist/stamp/chunk.d.ts +0 -2
- package/dist/stamp/chunk.d.ts.map +1 -1
- package/dist/stamp/chunk.js +10 -18
- package/dist/stamp/chunk.js.map +1 -1
- package/dist/stamp/config-digest.d.ts +18 -0
- package/dist/stamp/config-digest.d.ts.map +1 -1
- package/dist/stamp/config-digest.js +25 -0
- package/dist/stamp/config-digest.js.map +1 -1
- package/dist/stamp/index.d.ts +2 -2
- package/dist/stamp/index.d.ts.map +1 -1
- package/dist/stamp/index.js +2 -2
- package/dist/stamp/index.js.map +1 -1
- package/dist/stamp/payload.d.ts +28 -0
- package/dist/stamp/payload.d.ts.map +1 -0
- package/dist/stamp/payload.js +42 -0
- package/dist/stamp/payload.js.map +1 -0
- package/dist/stamp/read.d.ts +5 -4
- package/dist/stamp/read.d.ts.map +1 -1
- package/dist/stamp/read.js +26 -43
- package/dist/stamp/read.js.map +1 -1
- package/dist/stamp/window.d.ts +11 -0
- package/dist/stamp/window.d.ts.map +1 -0
- package/dist/stamp/window.js +11 -0
- package/dist/stamp/window.js.map +1 -0
- package/dist/stamp/write.d.ts +21 -0
- package/dist/stamp/write.d.ts.map +1 -0
- package/dist/stamp/write.js +31 -0
- package/dist/stamp/write.js.map +1 -0
- package/dist/templates/article/bottom.d.ts +15 -0
- package/dist/templates/article/bottom.d.ts.map +1 -0
- package/dist/templates/article/bottom.js +61 -0
- package/dist/templates/article/bottom.js.map +1 -0
- package/dist/templates/article/index.d.ts +12 -0
- package/dist/templates/article/index.d.ts.map +1 -0
- package/dist/templates/article/index.js +42 -0
- package/dist/templates/article/index.js.map +1 -0
- package/dist/templates/article/lines.d.ts +27 -0
- package/dist/templates/article/lines.d.ts.map +1 -0
- package/dist/templates/article/lines.js +53 -0
- package/dist/templates/article/lines.js.map +1 -0
- package/dist/templates/article/tags.d.ts +25 -0
- package/dist/templates/article/tags.d.ts.map +1 -0
- package/dist/templates/article/tags.js +63 -0
- package/dist/templates/article/tags.js.map +1 -0
- package/dist/templates/attribution.d.ts +2 -6
- package/dist/templates/attribution.d.ts.map +1 -1
- package/dist/templates/attribution.js +8 -22
- package/dist/templates/attribution.js.map +1 -1
- package/dist/templates/banner/badge-props.d.ts +16 -0
- package/dist/templates/banner/badge-props.d.ts.map +1 -0
- package/dist/templates/banner/badge-props.js +58 -0
- package/dist/templates/banner/badge-props.js.map +1 -0
- package/dist/templates/banner/index.d.ts.map +1 -1
- package/dist/templates/banner/index.js +6 -4
- package/dist/templates/banner/index.js.map +1 -1
- package/dist/templates/banner/version.d.ts.map +1 -1
- package/dist/templates/banner/version.js +4 -4
- package/dist/templates/banner/version.js.map +1 -1
- package/dist/templates/bottom.d.ts +23 -0
- package/dist/templates/bottom.d.ts.map +1 -0
- package/dist/templates/bottom.js +37 -0
- package/dist/templates/bottom.js.map +1 -0
- package/dist/templates/byline.d.ts +19 -0
- package/dist/templates/byline.d.ts.map +1 -0
- package/dist/templates/byline.js +45 -0
- package/dist/templates/byline.js.map +1 -0
- package/dist/templates/code/clip.js +1 -1
- package/dist/templates/code/clip.js.map +1 -1
- package/dist/templates/code/fit.js +1 -1
- package/dist/templates/code/fit.js.map +1 -1
- package/dist/templates/code/warn.d.ts +1 -1
- package/dist/templates/code/warn.d.ts.map +1 -1
- package/dist/templates/code/warn.js +2 -2
- package/dist/templates/code/warn.js.map +1 -1
- package/dist/templates/docs/chrome.d.ts +17 -0
- package/dist/templates/docs/chrome.d.ts.map +1 -0
- package/dist/templates/docs/chrome.js +44 -0
- package/dist/templates/docs/chrome.js.map +1 -0
- package/dist/templates/docs/crumbs.d.ts +14 -0
- package/dist/templates/docs/crumbs.d.ts.map +1 -0
- package/dist/templates/docs/crumbs.js +32 -0
- package/dist/templates/docs/crumbs.js.map +1 -0
- package/dist/templates/docs/index.d.ts +13 -0
- package/dist/templates/docs/index.d.ts.map +1 -0
- package/dist/templates/docs/index.js +47 -0
- package/dist/templates/docs/index.js.map +1 -0
- package/dist/templates/docs/lines.d.ts +14 -0
- package/dist/templates/docs/lines.d.ts.map +1 -0
- package/dist/templates/docs/lines.js +29 -0
- package/dist/templates/docs/lines.js.map +1 -0
- package/dist/templates/event/index.d.ts +12 -0
- package/dist/templates/event/index.d.ts.map +1 -0
- package/dist/templates/event/index.js +59 -0
- package/dist/templates/event/index.js.map +1 -0
- package/dist/templates/event/lines.d.ts +14 -0
- package/dist/templates/event/lines.d.ts.map +1 -0
- package/dist/templates/event/lines.js +29 -0
- package/dist/templates/event/lines.js.map +1 -0
- package/dist/templates/event/plate.d.ts +16 -0
- package/dist/templates/event/plate.d.ts.map +1 -0
- package/dist/templates/event/plate.js +36 -0
- package/dist/templates/event/plate.js.map +1 -0
- package/dist/templates/frame.d.ts +68 -0
- package/dist/templates/frame.d.ts.map +1 -0
- package/dist/templates/frame.js +63 -0
- package/dist/templates/frame.js.map +1 -0
- package/dist/templates/index.d.ts +9 -0
- package/dist/templates/index.d.ts.map +1 -1
- package/dist/templates/index.js +27 -0
- package/dist/templates/index.js.map +1 -1
- package/dist/templates/photo/index.d.ts +17 -0
- package/dist/templates/photo/index.d.ts.map +1 -0
- package/dist/templates/photo/index.js +51 -0
- package/dist/templates/photo/index.js.map +1 -0
- package/dist/templates/photo/lines.d.ts +21 -0
- package/dist/templates/photo/lines.d.ts.map +1 -0
- package/dist/templates/photo/lines.js +36 -0
- package/dist/templates/photo/lines.js.map +1 -0
- package/dist/templates/pill.d.ts +33 -0
- package/dist/templates/pill.d.ts.map +1 -0
- package/dist/templates/pill.js +50 -0
- package/dist/templates/pill.js.map +1 -0
- package/dist/templates/portrait.d.ts +40 -0
- package/dist/templates/portrait.d.ts.map +1 -0
- package/dist/templates/portrait.js +56 -0
- package/dist/templates/portrait.js.map +1 -0
- package/dist/templates/quote/index.d.ts +11 -0
- package/dist/templates/quote/index.d.ts.map +1 -0
- package/dist/templates/quote/index.js +60 -0
- package/dist/templates/quote/index.js.map +1 -0
- package/dist/templates/quote/lines.d.ts +24 -0
- package/dist/templates/quote/lines.d.ts.map +1 -0
- package/dist/templates/quote/lines.js +35 -0
- package/dist/templates/quote/lines.js.map +1 -0
- package/dist/templates/quote/mark.d.ts +13 -0
- package/dist/templates/quote/mark.d.ts.map +1 -0
- package/dist/templates/quote/mark.js +39 -0
- package/dist/templates/quote/mark.js.map +1 -0
- package/dist/templates/quote/speaker.d.ts +18 -0
- package/dist/templates/quote/speaker.d.ts.map +1 -0
- package/dist/templates/quote/speaker.js +41 -0
- package/dist/templates/quote/speaker.js.map +1 -0
- package/dist/templates/release/block.d.ts +8 -0
- package/dist/templates/release/block.d.ts.map +1 -0
- package/dist/templates/release/block.js +16 -0
- package/dist/templates/release/block.js.map +1 -0
- package/dist/templates/release/changes.d.ts +23 -0
- package/dist/templates/release/changes.d.ts.map +1 -0
- package/dist/templates/release/changes.js +45 -0
- package/dist/templates/release/changes.js.map +1 -0
- package/dist/templates/release/index.d.ts +11 -0
- package/dist/templates/release/index.d.ts.map +1 -0
- package/dist/templates/release/index.js +55 -0
- package/dist/templates/release/index.js.map +1 -0
- package/dist/templates/release/lines.d.ts +21 -0
- package/dist/templates/release/lines.d.ts.map +1 -0
- package/dist/templates/release/lines.js +36 -0
- package/dist/templates/release/lines.js.map +1 -0
- package/dist/templates/stat/index.d.ts +11 -0
- package/dist/templates/stat/index.d.ts.map +1 -0
- package/dist/templates/stat/index.js +43 -0
- package/dist/templates/stat/index.js.map +1 -0
- package/dist/templates/stat/lines.d.ts +23 -0
- package/dist/templates/stat/lines.d.ts.map +1 -0
- package/dist/templates/stat/lines.js +47 -0
- package/dist/templates/stat/lines.js.map +1 -0
- package/dist/templates/terminal/index.d.ts +16 -0
- package/dist/templates/terminal/index.d.ts.map +1 -0
- package/dist/templates/terminal/index.js +62 -0
- package/dist/templates/terminal/index.js.map +1 -0
- package/dist/templates/terminal/session.d.ts +17 -0
- package/dist/templates/terminal/session.d.ts.map +1 -0
- package/dist/templates/terminal/session.js +86 -0
- package/dist/templates/terminal/session.js.map +1 -0
- package/dist/templates/terminal/window.d.ts +14 -0
- package/dist/templates/terminal/window.d.ts.map +1 -0
- package/dist/templates/terminal/window.js +84 -0
- package/dist/templates/terminal/window.js.map +1 -0
- package/dist/templates/version.d.ts +16 -0
- package/dist/templates/version.d.ts.map +1 -0
- package/dist/templates/version.js +23 -0
- package/dist/templates/version.js.map +1 -0
- package/dist/templates/wordmark/index.d.ts +13 -0
- package/dist/templates/wordmark/index.d.ts.map +1 -0
- package/dist/templates/wordmark/index.js +53 -0
- package/dist/templates/wordmark/index.js.map +1 -0
- package/dist/templates/wordmark/lines.d.ts +22 -0
- package/dist/templates/wordmark/lines.d.ts.map +1 -0
- package/dist/templates/wordmark/lines.js +61 -0
- package/dist/templates/wordmark/lines.js.map +1 -0
- package/dist/templates/wordmark/mark.d.ts +16 -0
- package/dist/templates/wordmark/mark.d.ts.map +1 -0
- package/dist/templates/wordmark/mark.js +30 -0
- package/dist/templates/wordmark/mark.js.map +1 -0
- package/dist/text/clamp.d.ts +12 -0
- package/dist/text/clamp.d.ts.map +1 -0
- package/dist/text/clamp.js +41 -0
- package/dist/text/clamp.js.map +1 -0
- package/dist/text/ellipsis.d.ts +3 -0
- package/dist/text/ellipsis.d.ts.map +1 -0
- package/dist/text/ellipsis.js +3 -0
- package/dist/text/ellipsis.js.map +1 -0
- package/dist/text/index.d.ts +2 -0
- package/dist/text/index.d.ts.map +1 -1
- package/dist/text/index.js +2 -0
- package/dist/text/index.js.map +1 -1
- package/dist/texture/grain.d.ts +17 -0
- package/dist/texture/grain.d.ts.map +1 -0
- package/dist/texture/grain.js +29 -0
- package/dist/texture/grain.js.map +1 -0
- package/dist/texture/index.d.ts +11 -0
- package/dist/texture/index.d.ts.map +1 -0
- package/dist/texture/index.js +20 -0
- package/dist/texture/index.js.map +1 -0
- package/dist/texture/pattern.d.ts +17 -0
- package/dist/texture/pattern.d.ts.map +1 -0
- package/dist/texture/pattern.js +45 -0
- package/dist/texture/pattern.js.map +1 -0
- package/dist/texture/resolve.d.ts +16 -0
- package/dist/texture/resolve.d.ts.map +1 -0
- package/dist/texture/resolve.js +20 -0
- package/dist/texture/resolve.js.map +1 -0
- package/dist/theme/index.d.ts +27 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +41 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/theme/presets.d.ts +38 -0
- package/dist/theme/presets.d.ts.map +1 -0
- package/dist/theme/presets.js +150 -0
- package/dist/theme/presets.js.map +1 -0
- package/dist/types.d.ts +281 -10
- package/dist/types.d.ts.map +1 -1
- package/dist/validate/background.d.ts +12 -0
- package/dist/validate/background.d.ts.map +1 -0
- package/dist/validate/background.js +53 -0
- package/dist/validate/background.js.map +1 -0
- package/dist/validate/collect.d.ts +9 -0
- package/dist/validate/collect.d.ts.map +1 -0
- package/dist/validate/collect.js +35 -0
- package/dist/validate/collect.js.map +1 -0
- package/dist/validate/index.d.ts.map +1 -1
- package/dist/validate/index.js +2 -20
- package/dist/validate/index.js.map +1 -1
- package/dist/validate/keys.d.ts +22 -0
- package/dist/validate/keys.d.ts.map +1 -1
- package/dist/validate/keys.js +69 -0
- package/dist/validate/keys.js.map +1 -1
- package/dist/validate/overrides.d.ts.map +1 -1
- package/dist/validate/overrides.js +5 -1
- package/dist/validate/overrides.js.map +1 -1
- package/dist/validate/texture.d.ts +11 -0
- package/dist/validate/texture.d.ts.map +1 -0
- package/dist/validate/texture.js +34 -0
- package/dist/validate/texture.js.map +1 -0
- package/dist/validate/values.d.ts +16 -10
- package/dist/validate/values.d.ts.map +1 -1
- package/dist/validate/values.js +31 -44
- package/dist/validate/values.js.map +1 -1
- package/package.json +16 -2
- package/dist/background.d.ts.map +0 -1
- package/dist/background.js +0 -65
- package/dist/background.js.map +0 -1
- package/dist/cli/args.d.ts +0 -14
- package/dist/cli/args.d.ts.map +0 -1
- package/dist/cli/args.js +0 -67
- package/dist/cli/args.js.map +0 -1
- package/dist/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -102
- package/dist/cli.js.map +0 -1
- package/dist/config.d.ts +0 -95
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -208
- package/dist/config.js.map +0 -1
- package/dist/fonts.d.ts +0 -18
- package/dist/fonts.d.ts.map +0 -1
- package/dist/fonts.js +0 -102
- package/dist/fonts.js.map +0 -1
- package/dist/generate.d.ts +0 -63
- package/dist/generate.d.ts.map +0 -1
- package/dist/generate.js +0 -109
- package/dist/generate.js.map +0 -1
- package/dist/highlight.d.ts +0 -75
- package/dist/highlight.d.ts.map +0 -1
- package/dist/highlight.js +0 -137
- package/dist/highlight.js.map +0 -1
- package/dist/render.d.ts +0 -24
- package/dist/render.d.ts.map +0 -1
- package/dist/render.js +0 -77
- package/dist/render.js.map +0 -1
- package/dist/stamp.d.ts +0 -29
- package/dist/stamp.d.ts.map +0 -1
- package/dist/stamp.js +0 -198
- package/dist/stamp.js.map +0 -1
- package/dist/templates/banner.d.ts +0 -9
- package/dist/templates/banner.d.ts.map +0 -1
- package/dist/templates/banner.js +0 -115
- package/dist/templates/banner.js.map +0 -1
- package/dist/templates/card.d.ts +0 -7
- package/dist/templates/card.d.ts.map +0 -1
- package/dist/templates/card.js +0 -72
- package/dist/templates/card.js.map +0 -1
- package/dist/templates/code.d.ts +0 -12
- package/dist/templates/code.d.ts.map +0 -1
- package/dist/templates/code.js +0 -275
- package/dist/templates/code.js.map +0 -1
- package/dist/templates/measure.d.ts +0 -11
- package/dist/templates/measure.d.ts.map +0 -1
- package/dist/templates/measure.js +0 -11
- package/dist/templates/measure.js.map +0 -1
- package/dist/templates/props.d.ts +0 -7
- package/dist/templates/props.d.ts.map +0 -1
- package/dist/templates/props.js +0 -17
- package/dist/templates/props.js.map +0 -1
- package/dist/templates/text.d.ts +0 -37
- package/dist/templates/text.d.ts.map +0 -1
- package/dist/templates/text.js +0 -26
- package/dist/templates/text.js.map +0 -1
- package/dist/text/stack.d.ts +0 -24
- package/dist/text/stack.d.ts.map +0 -1
- package/dist/text/stack.js +0 -18
- package/dist/text/stack.js.map +0 -1
- package/dist/text.d.ts +0 -56
- package/dist/text.d.ts.map +0 -1
- package/dist/text.js +0 -78
- package/dist/text.js.map +0 -1
- package/dist/validate/sizes.d.ts +0 -9
- package/dist/validate/sizes.d.ts.map +0 -1
- package/dist/validate/sizes.js +0 -27
- package/dist/validate/sizes.js.map +0 -1
- package/dist/validate.d.ts +0 -15
- package/dist/validate.d.ts.map +0 -1
- package/dist/validate.js +0 -300
- package/dist/validate.js.map +0 -1
package/README.md
CHANGED
|
@@ -24,6 +24,8 @@ work.
|
|
|
24
24
|
frontmatter with real VS Code theme colours.
|
|
25
25
|
- **Configurable branding.** Colours, gradient, fonts, footer and badge come from
|
|
26
26
|
config, not from any one site's stylesheet.
|
|
27
|
+
- **Themes.** Eight named looks, or your own colours with a mesh, grain, a dot
|
|
28
|
+
grid or ruled lines over them.
|
|
27
29
|
- **Multiple sizes from one input.** A 1:1 square and a 1.91:1 landscape by
|
|
28
30
|
default, or whatever set you configure.
|
|
29
31
|
- **Manifest and meta tags.** A JSON record of what was generated, and the Open
|
|
@@ -70,6 +72,8 @@ export default defineConfig({
|
|
|
70
72
|
});
|
|
71
73
|
```
|
|
72
74
|
|
|
75
|
+
`colophon init` writes that file for you, guessing where your content lives.
|
|
76
|
+
|
|
73
77
|
Run it over a content tree:
|
|
74
78
|
|
|
75
79
|
```bash
|
|
@@ -78,7 +82,12 @@ colophon content --config colophon.config.ts
|
|
|
78
82
|
|
|
79
83
|
For every file that declares `meta_img_props`, Colophon writes one PNG per
|
|
80
84
|
output size next to it, named `<slug>-<size>.png`, so `post/index.md` produces
|
|
81
|
-
`post/post-og.png` and `post/post-square.png`.
|
|
85
|
+
`post/post-og.png` and `post/post-square.png`. Set `format` to `webp`, `jpeg` or
|
|
86
|
+
`avif` for a quarter of the bytes.
|
|
87
|
+
|
|
88
|
+
While tuning a template, `colophon preview <file>` renders one post and opens
|
|
89
|
+
it, `--watch` rebuilds on every change, and `--dry-run` reports what would
|
|
90
|
+
change without writing anything.
|
|
82
91
|
|
|
83
92
|
There is also a programmatic API. `renderMetaImages` takes props and config and
|
|
84
93
|
returns rendered bytes, and `generate` ties walking, rendering and writing
|
|
@@ -89,20 +98,27 @@ together.
|
|
|
89
98
|
Full documentation is in [`docs/`](./docs/).
|
|
90
99
|
|
|
91
100
|
- [Getting started](./docs/getting-started/ "Install, frontmatter, config and the CLI")
|
|
101
|
+
- [The command line](./docs/cli/ "Every command and flag, including init, preview, eject, dry runs and watching")
|
|
92
102
|
- [Templates](./docs/templates/ "The built-in layouts and how to register your own")
|
|
93
103
|
- [The code template](./docs/code-template/ "Syntax-highlighted code images")
|
|
104
|
+
- [Astro](./docs/astro/ "The integration and the meta tags component")
|
|
105
|
+
- [The browser-safe core](./docs/core/ "Running the template layer outside Node")
|
|
94
106
|
- [The layout toolkit](./docs/layout/ "The primitives templates are built from")
|
|
107
|
+
- [Themes and background treatments](./docs/configuration/themes/ "Named looks, meshes, grain, dots and rules")
|
|
95
108
|
- [Logos and photographs](./docs/configuration/images/ "Branding an image with a logo, avatar or background photo")
|
|
96
109
|
- [Configuration](./docs/configuration/ "Every option, and what happens to an unknown one")
|
|
110
|
+
- [Output formats](./docs/configuration/formats/ "WebP, JPEG and AVIF, quality, size caps and the SVG source")
|
|
111
|
+
- [File size](./docs/configuration/compression/ "How hard the rendered PNGs are compressed, and what it costs")
|
|
97
112
|
- [Rebuilds](./docs/rebuilds/ "How Colophon decides what to render again")
|
|
98
113
|
- [Programmatic use](./docs/programmatic-use/ "The API behind the CLI")
|
|
99
114
|
- [Upgrading](./docs/upgrading/ "The breaking changes in 2.0 and 3.0")
|
|
100
115
|
|
|
101
116
|
## Sample output
|
|
102
117
|
|
|
103
|
-
These are generated by [`scripts/gen-samples.ts`](scripts/gen-samples.ts)
|
|
104
|
-
|
|
105
|
-
updated PNGs so this
|
|
118
|
+
These are generated by [`scripts/gen-samples.ts`](scripts/gen-samples.ts) from
|
|
119
|
+
the sample list in [`test/samples.ts`](test/samples.ts). Run `pnpm samples` to
|
|
120
|
+
regenerate them after changing a template, then commit the updated PNGs so this
|
|
121
|
+
gallery stays in sync.
|
|
106
122
|
|
|
107
123
|
<table>
|
|
108
124
|
<tr>
|
|
@@ -135,19 +151,129 @@ updated PNGs so this gallery stays in sync.
|
|
|
135
151
|
<sub><code>code</code> · 1200×630 · TypeScript, <code>night-owl</code></sub>
|
|
136
152
|
</td>
|
|
137
153
|
</tr>
|
|
154
|
+
<tr>
|
|
155
|
+
<td>
|
|
156
|
+
<img src="docs/samples/article-wide.png" alt="article template, landscape" width="100%" /><br />
|
|
157
|
+
<sub><code>article</code> · 1200×630 · tags, headline, byline and avatar</sub>
|
|
158
|
+
</td>
|
|
159
|
+
<td>
|
|
160
|
+
<img src="docs/samples/terminal-wide.png" alt="terminal template, landscape" width="100%" /><br />
|
|
161
|
+
<sub><code>terminal</code> · 1200×630 · a command and its output</sub>
|
|
162
|
+
</td>
|
|
163
|
+
</tr>
|
|
164
|
+
<tr>
|
|
165
|
+
<td>
|
|
166
|
+
<img src="docs/samples/quote-square.png" alt="quote template, square" width="100%" /><br />
|
|
167
|
+
<sub><code>quote</code> · 1200×1200 · pull quote with attribution</sub>
|
|
168
|
+
</td>
|
|
169
|
+
<td>
|
|
170
|
+
<img src="docs/samples/release-square.png" alt="release template, square" width="100%" /><br />
|
|
171
|
+
<sub><code>release</code> · 1200×1200 · version and headline changes</sub>
|
|
172
|
+
</td>
|
|
173
|
+
</tr>
|
|
174
|
+
<tr>
|
|
175
|
+
<td>
|
|
176
|
+
<img src="docs/samples/stat-square.png" alt="stat template, square" width="100%" /><br />
|
|
177
|
+
<sub><code>stat</code> · 1200×1200 · one figure and a caption</sub>
|
|
178
|
+
</td>
|
|
179
|
+
<td>
|
|
180
|
+
<img src="docs/samples/event-square.png" alt="event template, square" width="100%" /><br />
|
|
181
|
+
<sub><code>event</code> · 1200×1200 · date, title and location</sub>
|
|
182
|
+
</td>
|
|
183
|
+
</tr>
|
|
184
|
+
<tr>
|
|
185
|
+
<td>
|
|
186
|
+
<img src="docs/samples/photo-wide.png" alt="photo template, landscape" width="100%" /><br />
|
|
187
|
+
<sub><code>photo</code> · 1200×630 · the post's own photograph, scrimmed</sub>
|
|
188
|
+
</td>
|
|
189
|
+
<td>
|
|
190
|
+
<img src="docs/samples/wordmark-wide.png" alt="wordmark template, landscape" width="100%" /><br />
|
|
191
|
+
<sub><code>wordmark</code> · 1200×630 · logo, name and tagline</sub>
|
|
192
|
+
</td>
|
|
193
|
+
</tr>
|
|
194
|
+
<tr>
|
|
195
|
+
<td>
|
|
196
|
+
<img src="docs/samples/docs-wide.png" alt="docs template, landscape" width="100%" /><br />
|
|
197
|
+
<sub><code>docs</code> · 1200×630 · breadcrumb, title and summary</sub>
|
|
198
|
+
</td>
|
|
199
|
+
<td></td>
|
|
200
|
+
</tr>
|
|
201
|
+
</table>
|
|
202
|
+
|
|
203
|
+
### Themes
|
|
204
|
+
|
|
205
|
+
One line of config each: `theme: "midnight"`. See
|
|
206
|
+
[Themes and background treatments](./docs/configuration/themes/) for what a
|
|
207
|
+
theme sets and how to override part of one.
|
|
208
|
+
|
|
209
|
+
<table>
|
|
210
|
+
<tr>
|
|
211
|
+
<td width="25%">
|
|
212
|
+
<img src="docs/samples/theme-midnight.png" alt="midnight theme" width="100%" /><br />
|
|
213
|
+
<sub><code>midnight</code></sub>
|
|
214
|
+
</td>
|
|
215
|
+
<td width="25%">
|
|
216
|
+
<img src="docs/samples/theme-aurora.png" alt="aurora theme" width="100%" /><br />
|
|
217
|
+
<sub><code>aurora</code></sub>
|
|
218
|
+
</td>
|
|
219
|
+
<td width="25%">
|
|
220
|
+
<img src="docs/samples/theme-ember.png" alt="ember theme" width="100%" /><br />
|
|
221
|
+
<sub><code>ember</code></sub>
|
|
222
|
+
</td>
|
|
223
|
+
<td width="25%">
|
|
224
|
+
<img src="docs/samples/theme-forest.png" alt="forest theme" width="100%" /><br />
|
|
225
|
+
<sub><code>forest</code></sub>
|
|
226
|
+
</td>
|
|
227
|
+
</tr>
|
|
228
|
+
<tr>
|
|
229
|
+
<td>
|
|
230
|
+
<img src="docs/samples/theme-bloom.png" alt="bloom theme" width="100%" /><br />
|
|
231
|
+
<sub><code>bloom</code></sub>
|
|
232
|
+
</td>
|
|
233
|
+
<td>
|
|
234
|
+
<img src="docs/samples/theme-slate.png" alt="slate theme" width="100%" /><br />
|
|
235
|
+
<sub><code>slate</code></sub>
|
|
236
|
+
</td>
|
|
237
|
+
<td>
|
|
238
|
+
<img src="docs/samples/theme-paper.png" alt="paper theme" width="100%" /><br />
|
|
239
|
+
<sub><code>paper</code></sub>
|
|
240
|
+
</td>
|
|
241
|
+
<td>
|
|
242
|
+
<img src="docs/samples/theme-sandstone.png" alt="sandstone theme" width="100%" /><br />
|
|
243
|
+
<sub><code>sandstone</code></sub>
|
|
244
|
+
</td>
|
|
245
|
+
</tr>
|
|
138
246
|
</table>
|
|
139
247
|
|
|
140
248
|
## Development
|
|
141
249
|
|
|
142
|
-
| Script | What it does
|
|
143
|
-
| --------------------------------- |
|
|
144
|
-
| `pnpm build` | Compile to `dist/`.
|
|
145
|
-
| `pnpm test`, `pnpm test:coverage` | Run Vitest.
|
|
146
|
-
| `pnpm lint` | ESLint and Prettier check.
|
|
147
|
-
| `pnpm fmt` | Auto-fix.
|
|
148
|
-
| `pnpm samples` | Regenerate the sample images into `docs/samples/`.
|
|
149
|
-
| `pnpm
|
|
150
|
-
| `pnpm
|
|
250
|
+
| Script | What it does |
|
|
251
|
+
| --------------------------------- | ---------------------------------------------------------------------------- |
|
|
252
|
+
| `pnpm build` | Compile to `dist/`. |
|
|
253
|
+
| `pnpm test`, `pnpm test:coverage` | Run Vitest. |
|
|
254
|
+
| `pnpm lint` | ESLint and Prettier check. |
|
|
255
|
+
| `pnpm fmt` | Auto-fix. |
|
|
256
|
+
| `pnpm samples` | Regenerate the sample images into `docs/samples/`. |
|
|
257
|
+
| `pnpm baselines` | Re-record the visual regression baselines in `test/baselines/`. |
|
|
258
|
+
| `pnpm fta` | [FTA](https://ftaproject.dev) scores, failing on any file 50 or above. |
|
|
259
|
+
| `pnpm check` | Format, FTA, typecheck, build and test with coverage. Run before committing. |
|
|
260
|
+
|
|
261
|
+
### Visual regression
|
|
262
|
+
|
|
263
|
+
Templates are pictures, so `pnpm test` renders every sample and compares it
|
|
264
|
+
against a committed baseline in `test/baselines/`. A change to a template shows
|
|
265
|
+
up as a failure naming how far the image moved, and writes what it rendered to
|
|
266
|
+
`test/.visual/` so you can open the two side by side. CI uploads the same
|
|
267
|
+
images as an artifact when the check fails.
|
|
268
|
+
|
|
269
|
+
When the change was the point, run `pnpm baselines` and commit the new PNGs with
|
|
270
|
+
it. The diff is then the before and after, which is the review the check exists
|
|
271
|
+
to make possible.
|
|
272
|
+
|
|
273
|
+
The baselines are rendered with font files rather than whatever the machine has
|
|
274
|
+
installed, and at a fraction of the width they are laid out at, which keeps them
|
|
275
|
+
reproducible anywhere and small enough to live in the repository. The gallery
|
|
276
|
+
above is rendered separately, as a project would render it.
|
|
151
277
|
|
|
152
278
|
## License
|
|
153
279
|
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { GenerateOptions } from "../generate/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* The shape Astro wants an integration to be.
|
|
4
|
+
*
|
|
5
|
+
* Declared here rather than imported from `astro`, so that installing Colophon
|
|
6
|
+
* does not drag a framework in and a project on any Astro version can use this
|
|
7
|
+
* one. It is structural: what matters is that the object fits where an
|
|
8
|
+
* integration goes, and a zero-argument hook fits a slot expecting one that
|
|
9
|
+
* takes the build's context.
|
|
10
|
+
*/
|
|
11
|
+
export interface AstroIntegration {
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly hooks: {
|
|
14
|
+
readonly "astro:config:setup": () => Promise<void>;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/** What the integration needs, which is what `generate` needs. */
|
|
18
|
+
export type ColophonIntegrationOptions = GenerateOptions;
|
|
19
|
+
/**
|
|
20
|
+
* Render the site's meta images as part of an Astro build.
|
|
21
|
+
*
|
|
22
|
+
* ```js
|
|
23
|
+
* // astro.config.mjs
|
|
24
|
+
* import colophon from "@kensio/colophon/astro";
|
|
25
|
+
*
|
|
26
|
+
* export default defineConfig({
|
|
27
|
+
* integrations: [
|
|
28
|
+
* colophon({
|
|
29
|
+
* contentDir: "src/content",
|
|
30
|
+
* config: { manifest: "src/data/colophon.json", footer: "example.com" },
|
|
31
|
+
* }),
|
|
32
|
+
* ],
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* It runs on `astro:config:setup`, which is the one hook that fires for
|
|
37
|
+
* `astro dev` as well as `astro build`, and which runs before anything is
|
|
38
|
+
* rendered. Both matter: the manifest has to be on disk before a page that
|
|
39
|
+
* reads it is built, and a dev server should show the images the build will
|
|
40
|
+
* produce rather than whatever the last build left behind.
|
|
41
|
+
*
|
|
42
|
+
* Running on every dev start sounds expensive and is not, because of the
|
|
43
|
+
* rebuild stamps: a second run reads the content tree, compares digests and
|
|
44
|
+
* renders nothing. The manifest is rewritten either way, being a small file
|
|
45
|
+
* describing images that are already there. Only the first run in a session
|
|
46
|
+
* pays for rendering, and only for the images that changed.
|
|
47
|
+
*/
|
|
48
|
+
export default function colophon(options: ColophonIntegrationOptions): AstroIntegration;
|
|
49
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/astro/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE;QAGd,QAAQ,CAAC,oBAAoB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;KACpD,CAAC;CACH;AAED,kEAAkE;AAClE,MAAM,MAAM,0BAA0B,GAAG,eAAe,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAC9B,OAAO,EAAE,0BAA0B,GAClC,gBAAgB,CAUlB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { generate } from "../generate/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Render the site's meta images as part of an Astro build.
|
|
4
|
+
*
|
|
5
|
+
* ```js
|
|
6
|
+
* // astro.config.mjs
|
|
7
|
+
* import colophon from "@kensio/colophon/astro";
|
|
8
|
+
*
|
|
9
|
+
* export default defineConfig({
|
|
10
|
+
* integrations: [
|
|
11
|
+
* colophon({
|
|
12
|
+
* contentDir: "src/content",
|
|
13
|
+
* config: { manifest: "src/data/colophon.json", footer: "example.com" },
|
|
14
|
+
* }),
|
|
15
|
+
* ],
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* It runs on `astro:config:setup`, which is the one hook that fires for
|
|
20
|
+
* `astro dev` as well as `astro build`, and which runs before anything is
|
|
21
|
+
* rendered. Both matter: the manifest has to be on disk before a page that
|
|
22
|
+
* reads it is built, and a dev server should show the images the build will
|
|
23
|
+
* produce rather than whatever the last build left behind.
|
|
24
|
+
*
|
|
25
|
+
* Running on every dev start sounds expensive and is not, because of the
|
|
26
|
+
* rebuild stamps: a second run reads the content tree, compares digests and
|
|
27
|
+
* renders nothing. The manifest is rewritten either way, being a small file
|
|
28
|
+
* describing images that are already there. Only the first run in a session
|
|
29
|
+
* pays for rendering, and only for the images that changed.
|
|
30
|
+
*/
|
|
31
|
+
export default function colophon(options) {
|
|
32
|
+
return {
|
|
33
|
+
name: "@kensio/colophon",
|
|
34
|
+
hooks: {
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
36
|
+
"astro:config:setup": async () => {
|
|
37
|
+
await generate(options);
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/astro/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAwBhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAC9B,OAAmC;IAEnC,OAAO;QACL,IAAI,EAAE,kBAAkB;QACxB,KAAK,EAAE;YACL,gEAAgE;YAChE,oBAAoB,EAAE,KAAK,IAAmB,EAAE;gBAC9C,MAAM,QAAQ,CAAC,OAAO,CAAC,CAAC;YAC1B,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Background, Dimensions } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* A linear gradient across the whole image: a `<defs>` block holding the
|
|
4
|
+
* gradient under the given `id`, and a rect filled with it.
|
|
5
|
+
*
|
|
6
|
+
* The coordinates are object-bounding-box units, so the default runs corner to
|
|
7
|
+
* corner whatever the image's proportions are.
|
|
8
|
+
*/
|
|
9
|
+
export declare function gradientBackground(background: Extract<Background, {
|
|
10
|
+
readonly type: "gradient";
|
|
11
|
+
}>, dimensions: Dimensions, id: string): string;
|
|
12
|
+
//# sourceMappingURL=gradient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gradient.d.ts","sourceRoot":"","sources":["../../src/background/gradient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE1D;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,EAC9D,UAAU,EAAE,UAAU,EACtB,EAAE,EAAE,MAAM,GACT,MAAM,CAgBR"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A linear gradient across the whole image: a `<defs>` block holding the
|
|
3
|
+
* gradient under the given `id`, and a rect filled with it.
|
|
4
|
+
*
|
|
5
|
+
* The coordinates are object-bounding-box units, so the default runs corner to
|
|
6
|
+
* corner whatever the image's proportions are.
|
|
7
|
+
*/
|
|
8
|
+
export function gradientBackground(background, dimensions, id) {
|
|
9
|
+
const { width, height } = dimensions;
|
|
10
|
+
const from = background.from ?? { x: 0, y: 0 };
|
|
11
|
+
const to = background.to ?? { x: 1, y: 1 };
|
|
12
|
+
const stops = background.stops
|
|
13
|
+
.map((stop) => `<stop offset="${stop.offset}" stop-color="${stop.color}"/>`)
|
|
14
|
+
.join("");
|
|
15
|
+
return (`<defs>` +
|
|
16
|
+
`<linearGradient id="${id}" x1="${String(from.x)}" y1="${String(from.y)}"` +
|
|
17
|
+
` x2="${String(to.x)}" y2="${String(to.y)}">${stops}</linearGradient>` +
|
|
18
|
+
`</defs>` +
|
|
19
|
+
`<rect width="${String(width)}" height="${String(height)}" fill="url(#${id})"/>`);
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=gradient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gradient.js","sourceRoot":"","sources":["../../src/background/gradient.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAChC,UAA8D,EAC9D,UAAsB,EACtB,EAAU;IAEV,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;IACrC,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IAC/C,MAAM,EAAE,GAAG,UAAU,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IAE3C,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK;SAC3B,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,iBAAiB,IAAI,CAAC,MAAM,iBAAiB,IAAI,CAAC,KAAK,KAAK,CAAC;SAC3E,IAAI,CAAC,EAAE,CAAC,CAAC;IAEZ,OAAO,CACL,QAAQ;QACR,uBAAuB,EAAE,SAAS,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG;QAC1E,QAAQ,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,mBAAmB;QACtE,SAAS;QACT,gBAAgB,MAAM,CAAC,KAAK,CAAC,aAAa,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,CACjF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Rect } from "../layout/index.js";
|
|
2
|
+
import type { Background, ImageAsset } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* A photograph behind the text: the backdrop, the picture, and the wash over
|
|
5
|
+
* it that keeps the text readable.
|
|
6
|
+
*
|
|
7
|
+
* The scrim is on by default and has to be turned off rather than on. Text
|
|
8
|
+
* over an unshaded photo is the failure this would otherwise ship with, and it
|
|
9
|
+
* is not one an author notices unless they look at every image.
|
|
10
|
+
*/
|
|
11
|
+
export declare function imageBackground(background: Extract<Background, {
|
|
12
|
+
readonly type: "image";
|
|
13
|
+
}>, area: Rect, id: string, asset: ImageAsset | undefined): string;
|
|
14
|
+
//# sourceMappingURL=image.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../src/background/image.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAS,MAAM,aAAa,CAAC;AAgBjE;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,EAC3D,IAAI,EAAE,IAAI,EACV,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,UAAU,GAAG,SAAS,GAC5B,MAAM,CAkBR"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { box, image as imageElement, scrim } from "../layout/index.js";
|
|
2
|
+
/** Behind a background image, and either side of one that is `contain`ed. */
|
|
3
|
+
const defaultBackdrop = "#000000";
|
|
4
|
+
/**
|
|
5
|
+
* How heavily the default scrim shades, top and bottom.
|
|
6
|
+
*
|
|
7
|
+
* It starts at a quarter rather than at nothing, because a template is free to
|
|
8
|
+
* put its text anywhere and a wash that only darkens the bottom leaves a
|
|
9
|
+
* centred title sitting on whatever the middle of the photograph happens to
|
|
10
|
+
* be. Shading the whole picture a little and the bottom a lot covers both, and
|
|
11
|
+
* a project that wants the picture untouched at the top sets `from: 0`.
|
|
12
|
+
*/
|
|
13
|
+
const defaultScrim = { from: 0.25, to: 0.65 };
|
|
14
|
+
/**
|
|
15
|
+
* A photograph behind the text: the backdrop, the picture, and the wash over
|
|
16
|
+
* it that keeps the text readable.
|
|
17
|
+
*
|
|
18
|
+
* The scrim is on by default and has to be turned off rather than on. Text
|
|
19
|
+
* over an unshaded photo is the failure this would otherwise ship with, and it
|
|
20
|
+
* is not one an author notices unless they look at every image.
|
|
21
|
+
*/
|
|
22
|
+
export function imageBackground(background, area, id, asset) {
|
|
23
|
+
const backdrop = box(area, { fill: background.color ?? defaultBackdrop });
|
|
24
|
+
if (asset === undefined) {
|
|
25
|
+
return backdrop;
|
|
26
|
+
}
|
|
27
|
+
const shade = background.scrim ?? {};
|
|
28
|
+
return (backdrop +
|
|
29
|
+
imageElement(area, asset.href, { fit: background.fit ?? "cover" }) +
|
|
30
|
+
scrim(area, `${id}-scrim`, {
|
|
31
|
+
...(shade.color !== undefined && { color: shade.color }),
|
|
32
|
+
from: shade.from ?? defaultScrim.from,
|
|
33
|
+
to: shade.to ?? defaultScrim.to,
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.js","sourceRoot":"","sources":["../../src/background/image.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,KAAK,IAAI,YAAY,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAGvE,6EAA6E;AAC7E,MAAM,eAAe,GAAG,SAAS,CAAC;AAElC;;;;;;;;GAQG;AACH,MAAM,YAAY,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AAE9C;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAC7B,UAA2D,EAC3D,IAAU,EACV,EAAU,EACV,KAA6B;IAE7B,MAAM,QAAQ,GAAG,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,UAAU,CAAC,KAAK,IAAI,eAAe,EAAE,CAAC,CAAC;IAE1E,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,MAAM,KAAK,GAAU,UAAU,CAAC,KAAK,IAAI,EAAE,CAAC;IAE5C,OAAO,CACL,QAAQ;QACR,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,UAAU,CAAC,GAAG,IAAI,OAAO,EAAE,CAAC;QAClE,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE;YACzB,GAAG,CAAC,KAAK,CAAC,KAAK,KAAK,SAAS,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;YACxD,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,YAAY,CAAC,IAAI;YACrC,EAAE,EAAE,KAAK,CAAC,EAAE,IAAI,YAAY,CAAC,EAAE;SAChC,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Background, Dimensions, ImageAsset } from "
|
|
1
|
+
import type { Background, Dimensions, ImageAsset } from "../types.js";
|
|
2
2
|
/**
|
|
3
|
-
* Render a full-bleed background as SVG.
|
|
4
|
-
* block
|
|
5
|
-
*
|
|
3
|
+
* Render a full-bleed background as SVG. Gradients and meshes emit a `<defs>`
|
|
4
|
+
* block naming their fills after the given `id`, followed by the rects that
|
|
5
|
+
* use them; a solid colour is just the rect.
|
|
6
6
|
*
|
|
7
7
|
* A background image has to be read before it can be drawn, which is the
|
|
8
8
|
* renderer's job. Called without one, an image background is the colour behind
|
|
@@ -10,4 +10,4 @@ import type { Background, Dimensions, ImageAsset } from "./types.js";
|
|
|
10
10
|
* reference to something that is not there.
|
|
11
11
|
*/
|
|
12
12
|
export declare function backgroundSvg(background: Background, dimensions: Dimensions, id: string, asset?: ImageAsset): string;
|
|
13
|
-
//# sourceMappingURL=
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/background/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAKtE;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC3B,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,EACtB,EAAE,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,UAAU,GACjB,MAAM,CAqBR"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { gradientBackground } from "./gradient.js";
|
|
2
|
+
import { imageBackground } from "./image.js";
|
|
3
|
+
import { meshBackground } from "./mesh.js";
|
|
4
|
+
/**
|
|
5
|
+
* Render a full-bleed background as SVG. Gradients and meshes emit a `<defs>`
|
|
6
|
+
* block naming their fills after the given `id`, followed by the rects that
|
|
7
|
+
* use them; a solid colour is just the rect.
|
|
8
|
+
*
|
|
9
|
+
* A background image has to be read before it can be drawn, which is the
|
|
10
|
+
* renderer's job. Called without one, an image background is the colour behind
|
|
11
|
+
* it, so a caller assembling an SVG by hand gets a plain image rather than a
|
|
12
|
+
* reference to something that is not there.
|
|
13
|
+
*/
|
|
14
|
+
export function backgroundSvg(background, dimensions, id, asset) {
|
|
15
|
+
const { width, height } = dimensions;
|
|
16
|
+
if (background.type === "solid") {
|
|
17
|
+
return `<rect width="${String(width)}" height="${String(height)}" fill="${background.color}"/>`;
|
|
18
|
+
}
|
|
19
|
+
if (background.type === "image") {
|
|
20
|
+
return imageBackground(background, { x: 0, y: 0, width, height }, id, asset);
|
|
21
|
+
}
|
|
22
|
+
if (background.type === "mesh") {
|
|
23
|
+
return meshBackground(background, dimensions, id);
|
|
24
|
+
}
|
|
25
|
+
return gradientBackground(background, dimensions, id);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/background/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa,CAC3B,UAAsB,EACtB,UAAsB,EACtB,EAAU,EACV,KAAkB;IAElB,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;IAErC,IAAI,UAAU,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAChC,OAAO,gBAAgB,MAAM,CAAC,KAAK,CAAC,aAAa,MAAM,CAAC,MAAM,CAAC,WAAW,UAAU,CAAC,KAAK,KAAK,CAAC;IAClG,CAAC;IAED,IAAI,UAAU,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAChC,OAAO,eAAe,CACpB,UAAU,EACV,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAC7B,EAAE,EACF,KAAK,CACN,CAAC;IACJ,CAAC;IAED,IAAI,UAAU,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QAC/B,OAAO,cAAc,CAAC,UAAU,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC;IACpD,CAAC;IAED,OAAO,kBAAkB,CAAC,UAAU,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Background, Dimensions } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Soft blobs of colour over a flat base, which is what a linear gradient
|
|
4
|
+
* cannot do: colour that moves in more than one direction at once.
|
|
5
|
+
*
|
|
6
|
+
* Every blob covers the whole image and is mostly transparent, so they are
|
|
7
|
+
* drawn in the order they were given and the later ones sit over the earlier.
|
|
8
|
+
*/
|
|
9
|
+
export declare function meshBackground(background: Extract<Background, {
|
|
10
|
+
readonly type: "mesh";
|
|
11
|
+
}>, dimensions: Dimensions, id: string): string;
|
|
12
|
+
//# sourceMappingURL=mesh.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mesh.d.ts","sourceRoot":"","sources":["../../src/background/mesh.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAY,MAAM,aAAa,CAAC;AAsCpE;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,EAC1D,UAAU,EAAE,UAAU,EACtB,EAAE,EAAE,MAAM,GACT,MAAM,CAYR"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** Radius of a blob that does not name one, as a fraction of the longer side. */
|
|
2
|
+
const defaultRadius = 0.7;
|
|
3
|
+
/**
|
|
4
|
+
* One blob: a radial fade from its colour to nothing, and a rect filled with
|
|
5
|
+
* it. A rect rather than a circle because the fade reaches the edge of the
|
|
6
|
+
* image on at least one side of most blobs, and a circle would clip it there.
|
|
7
|
+
*
|
|
8
|
+
* The gradient is in user space rather than in bounding-box units, so the fade
|
|
9
|
+
* stays circular. In bounding-box units it would take the proportions of the
|
|
10
|
+
* rect it fills, which is the whole image, and a landscape image would stretch
|
|
11
|
+
* every blob into an ellipse.
|
|
12
|
+
*/
|
|
13
|
+
function blobSvg(blob, dimensions, id) {
|
|
14
|
+
const { width, height } = dimensions;
|
|
15
|
+
const radius = (blob.radius ?? defaultRadius) * Math.max(width, height);
|
|
16
|
+
const opacity = blob.opacity ?? 1;
|
|
17
|
+
const def = `<radialGradient id="${id}" gradientUnits="userSpaceOnUse"` +
|
|
18
|
+
` cx="${String((blob.x ?? 0.5) * width)}"` +
|
|
19
|
+
` cy="${String((blob.y ?? 0.5) * height)}" r="${String(radius)}">` +
|
|
20
|
+
`<stop offset="0%" stop-color="${blob.color}" stop-opacity="${String(opacity)}"/>` +
|
|
21
|
+
`<stop offset="100%" stop-color="${blob.color}" stop-opacity="0"/>` +
|
|
22
|
+
`</radialGradient>`;
|
|
23
|
+
return {
|
|
24
|
+
def,
|
|
25
|
+
rect: `<rect width="${String(width)}" height="${String(height)}" fill="url(#${id})"/>`,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Soft blobs of colour over a flat base, which is what a linear gradient
|
|
30
|
+
* cannot do: colour that moves in more than one direction at once.
|
|
31
|
+
*
|
|
32
|
+
* Every blob covers the whole image and is mostly transparent, so they are
|
|
33
|
+
* drawn in the order they were given and the later ones sit over the earlier.
|
|
34
|
+
*/
|
|
35
|
+
export function meshBackground(background, dimensions, id) {
|
|
36
|
+
const { width, height } = dimensions;
|
|
37
|
+
const blobs = background.blobs.map((blob, index) => blobSvg(blob, dimensions, `${id}-blob-${String(index)}`));
|
|
38
|
+
return (`<defs>${blobs.map((blob) => blob.def).join("")}</defs>` +
|
|
39
|
+
`<rect width="${String(width)}" height="${String(height)}" fill="${background.color}"/>${blobs
|
|
40
|
+
.map((blob) => blob.rect)
|
|
41
|
+
.join("")}`);
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=mesh.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mesh.js","sourceRoot":"","sources":["../../src/background/mesh.ts"],"names":[],"mappings":"AAEA,iFAAiF;AACjF,MAAM,aAAa,GAAG,GAAG,CAAC;AAE1B;;;;;;;;;GASG;AACH,SAAS,OAAO,CACd,IAAc,EACd,UAAsB,EACtB,EAAU;IAEV,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;IACrC,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,aAAa,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACxE,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,CAAC,CAAC;IAElC,MAAM,GAAG,GACP,uBAAuB,EAAE,kCAAkC;QAC3D,QAAQ,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG;QAC1C,QAAQ,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,GAAG,MAAM,CAAC,QAAQ,MAAM,CAAC,MAAM,CAAC,IAAI;QAClE,iCAAiC,IAAI,CAAC,KAAK,mBAAmB,MAAM,CAAC,OAAO,CAAC,KAAK;QAClF,mCAAmC,IAAI,CAAC,KAAK,sBAAsB;QACnE,mBAAmB,CAAC;IAEtB,OAAO;QACL,GAAG;QACH,IAAI,EAAE,gBAAgB,MAAM,CAAC,KAAK,CAAC,aAAa,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM;KACvF,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,UAA0D,EAC1D,UAAsB,EACtB,EAAU;IAEV,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;IACrC,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CACjD,OAAO,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,SAAS,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CACzD,CAAC;IAEF,OAAO,CACL,SAAS,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,SAAS;QACxD,gBAAgB,MAAM,CAAC,KAAK,CAAC,aAAa,MAAM,CAAC,MAAM,CAAC,WAAW,UAAU,CAAC,KAAK,MAAM,KAAK;aAC3F,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC;aACxB,IAAI,CAAC,EAAE,CAAC,EAAE,CACd,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** What the CLI has been asked to do. */
|
|
2
|
+
export type CliCommand = "generate" | "init" | "preview" | "eject";
|
|
3
|
+
/**
|
|
4
|
+
* Read the command out of the first argument.
|
|
5
|
+
*
|
|
6
|
+
* It is a command only where it names one: `colophon content` has always meant
|
|
7
|
+
* "build this tree", so a bare positional stays the content directory, and a
|
|
8
|
+
* subcommand is an addition to that rather than a replacement for it. The cost
|
|
9
|
+
* is that a content directory called `init` or `preview` has to be written as
|
|
10
|
+
* `./init`, which is worth saying in the help text and no more.
|
|
11
|
+
*/
|
|
12
|
+
export declare function commandOf(first: string | undefined): CliCommand;
|
|
13
|
+
//# sourceMappingURL=command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../src/cli/args/command.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;AAYnE;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,CAE/D"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The commands that are named on the command line. `generate` is not among
|
|
3
|
+
* them because it is what a run with no command does.
|
|
4
|
+
*/
|
|
5
|
+
const named = {
|
|
6
|
+
init: "init",
|
|
7
|
+
preview: "preview",
|
|
8
|
+
eject: "eject",
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Read the command out of the first argument.
|
|
12
|
+
*
|
|
13
|
+
* It is a command only where it names one: `colophon content` has always meant
|
|
14
|
+
* "build this tree", so a bare positional stays the content directory, and a
|
|
15
|
+
* subcommand is an addition to that rather than a replacement for it. The cost
|
|
16
|
+
* is that a content directory called `init` or `preview` has to be written as
|
|
17
|
+
* `./init`, which is worth saying in the help text and no more.
|
|
18
|
+
*/
|
|
19
|
+
export function commandOf(first) {
|
|
20
|
+
return (first === undefined ? undefined : named[first]) ?? "generate";
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../../src/cli/args/command.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,KAAK,GAAyC;IAClD,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;CACf,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,UAAU,SAAS,CAAC,KAAyB;IACjD,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,UAAU,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { CliCommand } from "./command.js";
|
|
2
|
+
export type { CliCommand } from "./command.js";
|
|
3
|
+
export { usage } from "./usage.js";
|
|
4
|
+
/**
|
|
5
|
+
* The parsed command line.
|
|
6
|
+
*/
|
|
7
|
+
export interface CliArgs {
|
|
8
|
+
readonly command: CliCommand;
|
|
9
|
+
/**
|
|
10
|
+
* The content tree to build. `undefined` where the run named none, which
|
|
11
|
+
* `generate` reads as the default and `init` as an invitation to guess.
|
|
12
|
+
*/
|
|
13
|
+
readonly contentDir: string | undefined;
|
|
14
|
+
/** The post `preview` renders. */
|
|
15
|
+
readonly file: string | undefined;
|
|
16
|
+
/** What `eject` writes, naming the generator it is for. */
|
|
17
|
+
readonly adapter: string | undefined;
|
|
18
|
+
readonly configPath: string | undefined;
|
|
19
|
+
readonly overwrite: boolean;
|
|
20
|
+
readonly dryRun: boolean;
|
|
21
|
+
readonly watch: boolean;
|
|
22
|
+
readonly concurrency: number | undefined;
|
|
23
|
+
/** Which configured size `preview` renders. */
|
|
24
|
+
readonly size: string | undefined;
|
|
25
|
+
}
|
|
26
|
+
/** Read the command line into the options each command takes. */
|
|
27
|
+
export declare function parseCliArgs(argv: readonly string[]): CliArgs;
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/args/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAM/C,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,kCAAkC;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,2DAA2D;IAC3D,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,+CAA+C;IAC/C,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC;AA2CD,iEAAiE;AACjE,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAyC7D"}
|