Repository navigation
v0.2.0
Cards
Focus can now render cards: share images such as Open Graph cards, GitHub social previews, and video thumbnails. Cards are built from HTML templates, filled with your package's name, description, and install command from composer.json, and the screenshots captured in the same run, so one composer focus keeps your documentation screenshots and share images in step.
return ScreenshotSuite::make()
->screenshots([/* ... */])
->cardTemplates('https://github.com/awcodes/focus-templates/tree/v1.0.0/dist')
->cards([
Card::make('social')
->template('two-up-wide')
->screenshots(['editor', 'picker'])
->sizes([Size::OpenGraph, Size::GitHubSocial]),
]);- Templates are plain built HTML. A template directory can come from any static site generator; elements with
data-focusattributes are filled with values and screenshots. Templates are served from a local origin with network access blocked, so cards render the same way every time. - Fixed canvases. A template declares its design size with
<meta name="focus:canvas" content="2560x1440">, and Focus draws it sharply at every card size, cropping the centre when the aspect ratio differs and warning when it does. - Templates from GitHub.
cardTemplates()accepts a local path or a GitHub reference. Refs are resolved to commits and cached, private repositories work withGITHUB_TOKEN, and offline runs use the cache. - CLI. Cards render after screenshots in the same browser, and a card whose screenshot failed is not rendered. New options:
--cards-only(no Workbench needed),--no-cards, and--refresh-templates.--onlyand--listinclude cards.
See the Cards documentation. awcodes/focus-templates is a complete example template repository built with Astro and Tailwind.
Upgrading
RunObserverhas two new methods,cardStarting()andcardFinished(). Implementations outside Focus need to add them.- A suite with only cards is now valid, and the
--onlyerror for an unknown name now reads "Unknown screenshot(s) or card(s)".
Nothing else changes for manifests without cards.
Full changelog: v0.1.1...v0.2.0