Repository navigation
Draw the first Store screenshot as a generated hero (D-123) - #2
Merged
Merged
Conversation
devkit-store-hero draws a listing's first screenshot in every listing locale, in the split layout (brand panel and headline beside the app's real window or flyout, whole and enlarged) or the brand card (icon, name, headline and subline over the brand gradient, with the window faded behind). A hero block on the first entry of store-assets/manifest.json names the layout, capture, icon and colours; each locale's heroHeadline and heroSubline come from listings.json, and a locale without a headline fails before anything draws. --check redraws in memory and compares pixels. It draws with resvg, as devkit-icons does, and Noto Sans fonts pinned by SHA-256 and downloaded once into a per-user cache, so the same inputs give the same pixels on every machine with no Docker. The resvg loader moves to src/resvg.mjs so both commands share it.
With "fade": "bottom", hero.crop may cut the window's bottom edge, keeping its top and sides whole, and the split layout fades the UI out toward the cut so it reads as continuing. Every other cut is still refused, as is a fade on the brand card, without a crop, or on a crop that cuts nothing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
devkit-store-hero, the shared renderer for D-123 and LIST-8's first-image rule: each Store listing's first screenshot becomes a generated hero, drawn in every listing locale from a raw capture, the app's icon and colours, and a headline inlistings.json.split(ja-JP)brand-card(en-US)The samples are committed under
docs/examples/store-hero/, built from synthetic captures so devkit stays free of app names; a test fails when they drift from what devkit draws. The README embeds them, so they need the maintainer's approval like any other screenshot.Design note
Config. The hero is the first entry of a store's list in
store-assets/manifest.json, with aheroblock:{ "file": "screenshots/{locale}/00-hero-dark.png", "source": "raw/microsoft/00-flyout-dark.png", "theme": "dark", "hero": { "layout": "split", "icon": "assets/generated/icon-256.png", "primary": "#6366F1", "accent": "#22C55E", "crop": [x, y, w, h] }, "caption": "...", "alt": "..." }Each full locale in
<store>/listings.jsoncarriesheroHeadline(required; every missing locale is named before anything draws) andheroSubline(required forbrand-card; all or none forsplit).copyFromlocales reuse their target's image. The name is the locale'stitle.Rendering: resvg, not Chromium. devkit already resolves a pinned
@resvg/resvg-jsfordevkit-icons, and the kit's wrapper already installs it, so the hero adds no renderer. Chromium in Docker would lay text out with less code, but its pixels vary by version and host, so--checkwould need Docker in everyvalidate, including Windows CI with no Linux containers. With resvg,--checkredraws in memory and compares decoded pixels (not file bytes, since Node's zlib may compress differently by CPU). The cost is line breaking done in devkit:Intl.Segmenterfor word boundaries (Japanese and Chinese included), balanced lines, and the headline stepped down from its preferred size until it fits above the bottom third, failing with the locale's name below the smallest size that reads on a 320 x 180 search card.Fonts. Segoe UI ships only with Windows, so heroes use Noto Sans, and Noto Sans CJK JP or SC for Japanese and Simplified Chinese (whole text, because resvg's fallback ignores weight and turned bold CJK headlines regular). The six files (about 27 MB, OFL) are too big to ship to every app, so they are downloaded once from the upstream Noto repositories, checked against pinned SHA-256 hashes, and cached per user;
DEVKIT_FONTS_DIRand--fetch-fontsserve CI caches and offline use. CI here caches them so the render tests run.Policy and safe area. The enlarged UI is always the whole window from the capture's sidecar;
hero.cropmay widen it and is refused if it would cut the window (policy 10.1). A 200% capture draws at its logical size from twice the pixels, and a plain run says when a 100% capture is enlarged enough to look soft. The headline stays in the top two-thirds.Output. One PNG per locale at the manifest's
size(1366 x 768 by default, up to 3840 x 2160), 8-bit RGB with unfiltered rows, the format winui-app-kit's screenshot renderer writes.The resvg loader moves to
src/resvg.mjsso both commands share it;devkit-iconsbehaves as before.Follow-ups outside devkit
These existing checks reject a hero entry today, so no app can adopt it until they change:
check-listing.pyrequires exactly six fields per listing record, soheroHeadlinefails it.render-screenshots.py, and Persistent'sshots:check, treat the hero like a captured screenshot (sidecar rules, a{locale}path, the caption count).scripts/devkitwrapper has noherocommand and pins devkit v0.20.3.copyFromlocales to their target's image.Open questions
check:iconsrelies on it for shapes; heroes add text, blur and image scaling. Japanese and Chinese breaks also follow Node's ICU (identical on Node 22 and 24 today).localesshape.--checkneeds the fonts: network once, or a cache.Release notes are left for the version bump, as with earlier features.
AI disclosure: this pull request and the related code were written with the assistance of AI.