Repository navigation
fix(web): keep the packages grid inside the page; add italic Inter and font preloads - #4347
Conversation
…d font preloads The packages index's third card column ran past the viewport: plain 1fr grid tracks and the card's flex command box couldn't shrink below the longest install command. Use minmax(0, 1fr) tracks and min-width: 0 on the command box, which already scrolls. Add the latin italic Inter face, so italics are no longer synthesized, and preload the two main woff2 files on every site (a FontPreload component in the layouts and a Starlight Head override for guides and api). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
rev1-r3 review @ 515cd1c: code APPROVE (final sign-off after PR CI, and after any baseline refresh is confirmed images-only)
If the visual-baseline refresh pushes new images to this branch, send me the head and I'll confirm the delta is images only. |
Review @ 515cd1c: APPROVE on content (web). Merge gated on PR CI and the baselines that change
INFO: the override copies Starlight's Baselines: after CI, refresh only the ones that change, as you planned. The bot's refresh commit runs no checks, so push an empty commit afterwards for CI on the final head. |
Manually triggered baseline refresh via .github/workflows/refresh-visual-baselines.yml targeting branch peter/web-fonts-followup. Run when an intentional content/layout change makes the visual-regression check fail. The new PNG(s) under web/tests/visual-baselines/ are now the expected rendering.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
rev1-r3 re-review @ 802c5ab: code APPROVE (final sign-off after PR CI on this head) The delta since
|
|
Re-ack @ 802c5ab: APPROVE. Since 515cd1c there are two commits: the bot's |
|
rev1-r3 review @ 802c5ab: APPROVE (final; PR CI checked) PR CI on this head: 20 pass, 2 skipped, 0 failing or pending, with |
Summary
A follow-up to #4341 with three small changes.
1. The packages index grid stays inside the page. The third card column ran past the viewport edge, visible in the
packages-indexbaseline both before and after #4341. There were two causes:repeat(3, 1fr)tracks areminmax(auto, 1fr), so a column can't shrink below its content's min-content width..installflex row, where the<code>box haswhite-space: nowrap; overflow-x: auto. But a flex item's defaultmin-width: autolet the longest command (wheels packages add wheels-legacy-adapter) set the card's minimum width.The fix:
sites/packages/src/pages/index.astro: grid tracks becomeminmax(0, 1fr)at all three breakpoints.sites/packages/src/components/PackageCard.astro:.install codegetsmin-width: 0, so the command scrolls inside its box instead of widening the card.2. Italic Inter face (rev1-r1's note on #4341). The guides use italics, which were synthesized from the upright face.
inter-latin-wght-italic.woff2(52 KB) comes from@fontsource-variable/inter@5.3.0, the same release as the existing files: the shipped normal face is SHA-256-identical to that package's. It gets a matching@font-face(font-style: italic,font-weight: 100 900, swap, Latinunicode-range).3. Preloads for the two main font files (also from rev1-r1's notes):
packages/ui/src/components/FontPreload.astro: emits<link rel="preload" as="font" type="font/woff2" crossorigin>for the normal Inter and JetBrains Mono files. It uses?urlimports, so the hrefs are the same hashed, base-prefixed assets the@font-facerules load. The italic face loads on demand.BaseLayout.astroincludes it right after the viewport meta.Headoverride (packages/ui/src/components/starlight/Head.astro) renders Starlight's head tags exactly as its ownHeaddoes (Astro.locals.starlightRoute.head), plus the preloads. It renders them directly because@wheels-dev/uican't import@astrojs/starlight/components/Head.astrowithout depending on Starlight; the build fails to resolve it. It's registered in bothastro.config.mjsfiles.The diff is minimal on purpose (26 changed lines across 9 files, plus 3 new files). The packages-site files were never Prettier-formatted, so I edited them by hand instead of reformatting them.
Verification
pnpm build(all sites). Every site's builtindex.htmlcarries both preloads, for examplehref="/_astro/inter-latin-wght-normal.Dx4kXJAl.woff2", matching the@font-faceURL. On guides and API, each page keeps its<title>and description/og tags, so Starlight's head tags still render.@font-face{font-family:Inter;font-style:italic;…}.WHEELS_DOCS_BASE=/wheels/guides/, the preloads are/wheels/guides/_astro/…woff2.prettier --checkis clean on the new and Prettier-formatted files.packages-indexbaseline should change (the grid fix), and pages with italic text may change too. After CI, I'll check the diffs and refresh only the baselines that change.🤖 Generated with Claude Code