Skip to content

Draw the first Store screenshot as a generated hero (D-123) - #2

Merged
RyanEwen merged 2 commits into
mainfrom
store-hero
Nov 23, 2026
Merged

RyanEwen merged 2 commits into
mainfrom
store-hero

Conversation

@RyanEwen

Copy link
Copy Markdown
Collaborator

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 in listings.json.

split (ja-JP) brand-card (en-US)
split brand card

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 a hero block:

{
  "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.json carries heroHeadline (required; every missing locale is named before anything draws) and heroSubline (required for brand-card; all or none for split). copyFrom locales reuse their target's image. The name is the locale's title.

Rendering: resvg, not Chromium. devkit already resolves a pinned @resvg/resvg-js for devkit-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 --check would need Docker in every validate, including Windows CI with no Linux containers. With resvg, --check redraws 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.Segmenter for 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_DIR and --fetch-fonts serve 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.crop may 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.mjs so both commands share it; devkit-icons behaves as before.

Follow-ups outside devkit

These existing checks reject a hero entry today, so no app can adopt it until they change:

  • winui-app-kit check-listing.py requires exactly six fields per listing record, so heroHeadline fails it.
  • winui-app-kit render-screenshots.py, and Persistent's shots:check, treat the hero like a captured screenshot (sidecar rules, a {locale} path, the caption count).
  • The kit's scripts/devkit wrapper has no hero command and pins devkit v0.20.3.
  • Publishers must upload the per-locale first image and map copyFrom locales to their target's image.

Open questions

  • Same pixels across platforms is shown on Linux x64 only (WSL, and the same binary in CI). check:icons relies 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).
  • Persistent's tall flyout is small under the whole-window rule; the PoC suggested a visibly faded top crop, which this does not offer.
  • The lower part of a tall window sits in the bottom third, where Microsoft may overlay text.
  • The brand card's ghosted window bleeds off the canvas by design.
  • PrintStream's listing source is not yet in the locales shape.
  • Every app's --check needs 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.

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.
@RyanEwen
RyanEwen merged commit b299dee into main Nov 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant