From fe1e3e35fe4a0ea0007a90fd47cd0651f6085b4a Mon Sep 17 00:00:00 2001 From: David Hill <1879069+iamdavidhill@users.noreply.github.com> Date: Thu, 5 Nov 2026 18:50:20 -0600 Subject: [PATCH] feat(site): bring services/site up to date with the latest site work (#62219) --- services/site/DESIGN.md | 1 + .../site/src/component/font/cover-title.tsx | 82 ++-- .../site/src/component/font/typewriter.tsx | 22 +- .../site/src/component/site/arcade/arcade.css | 5 + .../site/src/component/site/arcade/arcade.tsx | 204 +++++++-- .../site/src/component/site/arcade/chrome.css | 113 ++++- .../site/src/component/site/arcade/chrome.tsx | 58 ++- .../src/component/site/arcade/geometry.ts | 16 +- .../site/src/component/site/arcade/layers.css | 13 + .../site/src/component/site/design-mode.tsx | 2 +- services/site/src/component/site/doc-list.css | 368 +++++++++++++++++ .../site/src/component/site/github-link.css | 13 +- .../site/src/component/site/github-link.tsx | 26 ++ .../site/src/component/site/logo-wall.tsx | 2 +- .../site/src/component/site/on-this-page.css | 59 ++- .../site/src/component/site/phone-menu.css | 168 ++++++++ .../site/src/component/site/phone-menu.tsx | 52 +++ .../src/component/site/preload-settings.ts | 4 +- .../site/src/component/site/product-list.css | 60 ++- .../site/src/component/site/product-list.tsx | 10 +- services/site/src/component/site/products.css | 21 + services/site/src/component/site/products.tsx | 4 +- services/site/src/component/site/settings.ts | 4 +- services/site/src/component/site/site.css | 176 +++----- services/site/src/component/site/site.tsx | 52 +-- .../src/component/site/voice/voice-mode.css | 77 +++- services/site/src/config.ts | 2 +- services/site/src/i18n/ar.ts | 4 +- services/site/src/i18n/br.ts | 4 +- services/site/src/i18n/content/ar.ts | 2 +- services/site/src/i18n/content/br.ts | 2 +- services/site/src/i18n/content/da.ts | 2 +- services/site/src/i18n/content/de.ts | 2 +- services/site/src/i18n/content/es.ts | 2 +- services/site/src/i18n/content/fr.ts | 2 +- services/site/src/i18n/content/it.ts | 2 +- services/site/src/i18n/content/ja.ts | 2 +- services/site/src/i18n/content/ko.ts | 2 +- services/site/src/i18n/content/no.ts | 2 +- services/site/src/i18n/content/pl.ts | 2 +- services/site/src/i18n/content/ru.ts | 2 +- services/site/src/i18n/content/th.ts | 2 +- services/site/src/i18n/content/tr.ts | 2 +- services/site/src/i18n/content/uk.ts | 2 +- services/site/src/i18n/content/zh.ts | 2 +- services/site/src/i18n/content/zht.ts | 2 +- services/site/src/i18n/da.ts | 4 +- services/site/src/i18n/de.ts | 4 +- services/site/src/i18n/en.ts | 4 +- services/site/src/i18n/es.ts | 4 +- services/site/src/i18n/fr.ts | 4 +- services/site/src/i18n/it.ts | 4 +- services/site/src/i18n/ja.ts | 4 +- services/site/src/i18n/ko.ts | 4 +- services/site/src/i18n/no.ts | 4 +- services/site/src/i18n/pl.ts | 4 +- services/site/src/i18n/ru.ts | 4 +- services/site/src/i18n/stamps/ar.json | 6 +- services/site/src/i18n/stamps/br.json | 6 +- services/site/src/i18n/stamps/da.json | 6 +- services/site/src/i18n/stamps/de.json | 6 +- services/site/src/i18n/stamps/es.json | 6 +- services/site/src/i18n/stamps/fr.json | 6 +- services/site/src/i18n/stamps/it.json | 6 +- services/site/src/i18n/stamps/ja.json | 6 +- services/site/src/i18n/stamps/ko.json | 6 +- services/site/src/i18n/stamps/no.json | 6 +- services/site/src/i18n/stamps/pl.json | 6 +- services/site/src/i18n/stamps/ru.json | 6 +- services/site/src/i18n/stamps/th.json | 6 +- services/site/src/i18n/stamps/tr.json | 6 +- services/site/src/i18n/stamps/uk.json | 6 +- services/site/src/i18n/stamps/zh.json | 6 +- services/site/src/i18n/stamps/zht.json | 6 +- services/site/src/i18n/th.ts | 4 +- services/site/src/i18n/tr.ts | 4 +- services/site/src/i18n/uk.ts | 4 +- services/site/src/i18n/zh.ts | 4 +- services/site/src/i18n/zht.ts | 4 +- services/site/src/routes/brand/index.css | 44 +- services/site/src/routes/font/index.css | 64 ++- services/site/src/routes/index.css | 7 +- services/site/src/routes/legal/index.tsx | 1 + services/site/src/routes/legal/legal.css | 391 ++---------------- services/site/src/routes/press/index.css | 6 +- services/site/src/routes/press/index.tsx | 25 +- .../site/src/routes/press/media-gallery.css | 12 +- 87 files changed, 1580 insertions(+), 792 deletions(-) create mode 100644 services/site/src/component/site/doc-list.css create mode 100644 services/site/src/component/site/github-link.tsx create mode 100644 services/site/src/component/site/phone-menu.css create mode 100644 services/site/src/component/site/phone-menu.tsx diff --git a/services/site/DESIGN.md b/services/site/DESIGN.md index 217c9c5312e..5fa963e1cea 100644 --- a/services/site/DESIGN.md +++ b/services/site/DESIGN.md @@ -93,6 +93,7 @@ To add a rule, add one line under its group. Mark a rule that is still being dec - Make tap targets at least 44px on coarse pointers (`tap-targets.css`). - Close menus on Escape, an outside click and a choice, and return focus to the trigger. → [Language picker](/dev/components#language-picker) - Test platform UI with the device preview's `_device` parameter, not a narrow window. → [ProductAction](/dev/components#product-action) +- On phones the 404 arcade centres the cabinet and has no Insert coin or Back button: a tap on the coin inserts it, and the site's own GitHub mark, menu button and sheet (`phone-menu.tsx`) sit in the top bar beside the logo. ## Motion diff --git a/services/site/src/component/font/cover-title.tsx b/services/site/src/component/font/cover-title.tsx index 3b1c8cdeea9..b779aa50cd5 100644 --- a/services/site/src/component/font/cover-title.tsx +++ b/services/site/src/component/font/cover-title.tsx @@ -13,7 +13,8 @@ const HEIGHT = 7 + TOP + BOTTOM // Phase budgets in milliseconds; each phase's moves share its budget in proportion to length. const PHASES = { metrics: 420, grids: 620, outlines: 820, fill: 760, shade: 380 } -const SETTLE = 220 +// After the last move the plot settles: the pen, readout and counter fade out and the guides dim. +const SETTLE = 360 // The shade: the ink at the page's paper shade opacity. const SHADE_ALPHA = 0.22 @@ -170,7 +171,9 @@ export function CoverTitle() { let md = 16 let dpr = 1 let palette: Palette = { ink: "#141414", blue: "#3b5cf6", faint: "#bbb" } - let started: number | undefined + let elapsed = reduced ? END : 0 + let last: number | undefined + let played = false let frame = 0 const layout = () => { @@ -226,14 +229,14 @@ export function CoverTitle() { for (const [col, row] of buildOrder(WORD[letter] as Letter)) context.fillRect(X(letter * 5 + col), Y(row), md, md) } - const ticks = (letter: number) => { + const ticks = (letter: number, label: boolean) => { const y = Y(7) + Math.round(md * 0.55) context.fillRect(X(letter * 5), y, X(letter * 5 + 4) - X(letter * 5), 1) for (let col = 0; col <= 4; col++) { const x = Math.min(X(letter * 5 + col), X(letter * 5 + 4) - 1) context.fillRect(x, y - Math.round(md * 0.18), 1, Math.round(md * 0.36) + 1) } - context.fillText("4 × 120u", X(letter * 5), y + Math.round(md * 0.25) + 10 * dpr) + if (label) context.fillText("4 × 120u", X(letter * 5), y + Math.round(md * 0.25) + 10 * dpr) } const registration = () => { @@ -255,13 +258,17 @@ export function CoverTitle() { } const draw = (t: number) => { - const done = t >= END + // 0 while plotting, easing to 1 over the settle (an ease-out quint), so nothing snaps at the end. + const settle = 1 - (1 - Math.min(1, Math.max(0, (t - program.end) / SETTLE))) ** 5 + const fade = (to: number) => 1 + (to - 1) * settle context.clearRect(0, 0, canvas.width, canvas.height) context.font = `${10 * dpr}px "OpenTUI Mono", "OpenTUI Mono Menlo", ui-monospace, monospace` context.textBaseline = "alphabetic" + // On a narrow canvas the module label is wider than a letter, so only the first letter carries it. + const everyLabel = context.measureText("4 × 120u").width + 4 * dpr <= 5 * md // Registration marks: always there, faint once the plot is done. - context.globalAlpha = done ? 0.5 : 1 + context.globalAlpha = fade(0.5) context.fillStyle = palette.blue registration() context.globalAlpha = 1 @@ -282,18 +289,18 @@ export function CoverTitle() { ] if (move.kind === "metric" || move.kind === "grid" || move.kind === "outline") { context.fillStyle = move.kind === "outline" ? palette.blue : palette.faint - context.globalAlpha = done && move.kind !== "outline" ? 0.55 : 1 - // Outlines vanish under the ink once a letter is filled; the grid and metrics stay faint. - if (!(done && move.kind === "outline")) hairline(move.from, move.to, progress) + // Outlines fade under the ink once the plot is done; the grid and metrics stay faint. + context.globalAlpha = fade(move.kind === "outline" ? 0 : 0.55) + hairline(move.from, move.to, progress) context.globalAlpha = 1 segments += progress === 1 ? 1 : 0 travelled += length(move) * progress pen = { at, down: true } } if (move.kind === "travel") { - if (!done && move.phase === phase) { + if (move.phase === phase && settle < 1) { context.fillStyle = palette.blue - context.globalAlpha = 0.45 + context.globalAlpha = 0.45 * fade(0) hairline(move.from, move.to, progress, true) context.globalAlpha = 1 } @@ -308,8 +315,8 @@ export function CoverTitle() { if (progress === 1) { filled.add(move.letter) context.fillStyle = palette.blue - context.globalAlpha = done ? 0.6 : 1 - ticks(move.letter) + context.globalAlpha = fade(0.6) + ticks(move.letter, everyLabel || move.letter === 0) context.globalAlpha = 1 } else if (shown > 0) { const [col, row] = order[shown - 1] @@ -334,7 +341,8 @@ export function CoverTitle() { context.fillStyle = palette.ink for (const letter of filled) fillLetter(letter) - if (done || !pen) return + if (settle === 1 || !pen) return + context.globalAlpha = fade(0) // The pen: a filled square when down, an open one when up; its position in font units beside it. const px = X(pen.at[0]) const py = Y(pen.at[1]) @@ -361,32 +369,50 @@ export function CoverTitle() { canvas.height - Math.round(md * 0.35), ) context.textAlign = "left" + context.globalAlpha = 1 } + // The plot's own clock: it advances only while frames run, so pausing off screen resumes in place. const tick = (now: number) => { - started ??= now - const t = now - started - draw(t) - frame = t < END ? requestAnimationFrame(tick) : 0 + // A long gap (a background tab) resumes where it left off instead of skipping ahead. + elapsed += last === undefined ? 0 : Math.min(now - last, 100) + last = now + draw(elapsed) + frame = elapsed < END ? requestAnimationFrame(tick) : 0 + } + const resume = () => { + if (reduced || frame || elapsed >= END) return + last = undefined + frame = requestAnimationFrame(tick) } const play = () => { if (reduced) return cancelAnimationFrame(frame) - started = undefined - frame = requestAnimationFrame(tick) + frame = 0 + played = true + elapsed = 0 + resume() } layout() - draw(reduced ? END : 0) + draw(elapsed) + // The readout and labels are canvas text: start once the mono font is in, so they don't swap faces mid-plot. + const fontReady = document.fonts.load(`${10 * dpr}px "OpenTUI Mono"`).catch(() => undefined) + // Starts once most of the title is in view, and pauses whenever it leaves the screen. const observer = new IntersectionObserver( ([entry]) => { - if (!entry.isIntersecting) return - observer.disconnect() - if (reduced) return draw(END) - play() + if (!entry.isIntersecting) { + cancelAnimationFrame(frame) + frame = 0 + return + } + if (played) return resume() + if (entry.intersectionRatio < 0.6) return + played = true + void fontReady.then(play) }, - { threshold: 0.6 }, + { threshold: [0, 0.6] }, ) observer.observe(root) root.addEventListener("click", play) @@ -396,13 +422,13 @@ export function CoverTitle() { if (root.clientWidth === width) return width = root.clientWidth layout() - if (!frame) draw(END) + if (!frame) draw(elapsed) }) resize.observe(root) const repaint = () => { layout() - if (!frame) draw(END) + if (!frame) draw(elapsed) } const site = root.closest("[data-site]") const themeObserver = new MutationObserver(repaint) diff --git a/services/site/src/component/font/typewriter.tsx b/services/site/src/component/font/typewriter.tsx index d3c35f8dbfc..067a3e118f2 100644 --- a/services/site/src/component/font/typewriter.tsx +++ b/services/site/src/component/font/typewriter.tsx @@ -493,6 +493,17 @@ export function Typewriter() { }) }) + const claim = () => ( + <> + A TYPEFACE WITH{" "} + + {fontContent.combinations.base} + {fontContent.combinations.exponent} + {" "} + POSSIBLE COMBINATIONS + + ) + return (

{fontContent.title}

@@ -514,16 +525,11 @@ export function Typewriter() { {/* The server renders the starting wordmark, so the hero is never empty before hydration. */}
-

- A TYPEFACE WITH{" "} - - {fontContent.combinations.base} - {fontContent.combinations.exponent} - {" "} - POSSIBLE COMBINATIONS -

+

{claim()}

) - // Keyboard, reduced motion and the touch "Insert coin" button: the camera flies the coin in. + // Keyboard, reduced motion and the touch "Insert coin" button: the camera flies the coin in. A + // phone stays on the room shot, where the token goes in as it does from a tap. function keyboardInsert() { + if (phone()) return phoneInsert() unlockAudio() loadFront() loadCoin() if (reduced()) return insert() setPhase("inserting") coin.layer = "front" - // A phone stays on the room shot: the token flies straight to the slot. - if (phone()) { - tween({ lift: 1.3, tiltX: 10, spin: 0 }, 300) - later(300, () => tween({ at: slot, lift: 1, turnY: 60 }, 600)) - later(950, insert) - return - } tween({ lift: 1.6, tiltX: 10, spin: 0 }, 300) go(views().door, 2.6) later(900, () => tween({ at: slot, lift: 1, turnY: 60 }, 500)) diff --git a/services/site/src/component/site/arcade/chrome.css b/services/site/src/component/site/arcade/chrome.css index 6f926ec1205..1d5f74e64be 100644 --- a/services/site/src/component/site/arcade/chrome.css +++ b/services/site/src/component/site/arcade/chrome.css @@ -13,6 +13,8 @@ --text: light-dark(hsl(0, 0%, 32%), hsl(0, 0%, 72%)); --text-weak: light-dark(hsl(0, 0%, 40%), hsl(0, 0%, 56%)); --text-weaker: light-dark(hsl(0, 0%, 72%), hsl(0, 0%, 32%)); + --text-muted: light-dark(hsl(0, 0%, 45%), hsl(0, 0%, 49%)); + --fs-large: 18px; --border: light-dark(hsl(0, 0%, 88%), hsl(0, 0%, 18%)); --link-dark: #4f8bff; --link: light-dark(#3b5cf6, var(--link-dark)); @@ -42,9 +44,11 @@ --bracket-bearing: calc(var(--mono-size) * 0.154); /* Nav numbers "1": the ink of "[1]", which the logo's box spans. */ --bracket-ink: calc(var(--mono-size) * 1.492); - /* Settings › Logo size 20×25 (the default): the mark is 20×25, its row starts at --edge, and the + /* Settings › Logo size 20×25 (the default): the mark is 20×25, centred in the 4:5 box that spans + "[1]"'s ink as on the site (site.css › --logo-inset), so it sits at (25, 25) on every page; the nav follows 8px further below it than the row sits below the top. */ - --top: var(--edge); + --logo-inset: round(calc((var(--bracket-ink) - 20px) / 2), 1px); + --top: calc(var(--edge) + var(--logo-inset)); --logo-height: 25px; --logo-gap: calc(var(--edge) + 8px); /* Where the logo mark and the nav's ink start: the sound switch sits this far from the left and @@ -55,6 +59,8 @@ @media (max-width: 60rem) { --arcade-inset: calc(var(--edge) + 2px); + /* The site's mobile type scale (site.css), for the menu sheet. */ + --fs-large: 19px; } [data-slot="title"] { @@ -136,7 +142,7 @@ display: block; width: 20px; height: 25px; - margin-inline-start: round(up, var(--bracket-bearing), 1px / 64); + margin-inline-start: calc(round(up, var(--bracket-bearing), 1px / 64) + var(--logo-inset)); } path[data-slot="inner"] { @@ -153,7 +159,7 @@ } } - nav { + [data-slot="sidebar"] nav { font-size: var(--mono-size); line-height: 20px; @@ -233,9 +239,106 @@ margin: 3px 2px 2px; } - nav { + [data-slot="sidebar"] nav { display: none; } + + /* Over the phone bar, which takes the page colour while its menu is open. */ + [data-slot="sidebar"] { + z-index: 13; + } + } +} + +/* Small screens: the site's top-bar GitHub mark and menu button (github-link.css, phone-menu.css) in + the 56px bar the logo is centred in, at the site's sizes and spacing, over the scene. The menu + sheet covers the scene below the bar, and the bar takes the page colour with it (at once on open, + with the sheet's 120ms fade on close), as on the site. `html` and the doubled scope outrank + site.css's own [data-site] rules once the Settings panel loads it. */ +html [data-component="arcade-chrome"] [data-site][data-slot="phone-bar"] { + display: none; +} + +@media (max-width: 60rem) { + html [data-component="arcade-chrome"] [data-site][data-slot="phone-bar"] { + position: fixed; + top: 0; + inset-inline: 0; + z-index: 12; + display: flex; + align-items: center; + justify-content: flex-end; + height: calc(var(--topbar-height) + env(safe-area-inset-top, 0px)); + min-height: 0; + padding: env(safe-area-inset-top, 0px) calc(var(--edge) + env(safe-area-inset-right, 0px)) 0 + calc(var(--edge) + env(safe-area-inset-left, 0px)); + background: none; + pointer-events: none; + + &::before { + content: ""; + position: absolute; + inset: 0; + background: var(--bg); + opacity: 0; + transition: opacity 120ms var(--ease-out); + } + + &:has([data-component="menu-toggle"][aria-expanded="true"])::before { + opacity: 1; + transition: none; + } + + > :is([data-component="github-link"], [data-component="menu-toggle"]), + [data-component="site-menu-sheet"][data-open] { + pointer-events: auto; + } + + [data-component="github-link"] { + margin-inline-end: 0.5rem; + + &:focus-visible { + outline: 2px solid var(--link); + outline-offset: -2px; + } + } + + [data-component="menu-toggle"] { + padding: 0; + font: inherit; + color: inherit; + background: none; + border: 0; + cursor: pointer; + + &:focus-visible { + outline: 2px solid var(--link); + outline-offset: -2px; + } + } + + a { + text-decoration: none; + } + + ul { + margin: 0; + padding: 0; + list-style: none; + } + + /* The site's touch targets (tap-targets.css): a 44px GitHub link, and the same press. */ + @media (pointer: coarse) { + --github-size: 2.75rem; + + > :is([data-component="github-link"], [data-component="menu-toggle"]) { + transition: transform 160ms var(--ease-out); + + &:active { + transform: scale(0.94); + } + } + } } } diff --git a/services/site/src/component/site/arcade/chrome.tsx b/services/site/src/component/site/arcade/chrome.tsx index 8b39fdd8f16..6a33ca3ea80 100644 --- a/services/site/src/component/site/arcade/chrome.tsx +++ b/services/site/src/component/site/arcade/chrome.tsx @@ -18,7 +18,10 @@ import { useViewportCover } from "~/lib/viewport" import { LiveMeta } from "~/component/head-meta" import { siteLinks } from "../links" import { navCustomItems, navSavedLabel, navSequence } from "../nav-order" +import { GitHubLink } from "../github-link" +import { ExternalArrow, NewTab } from "../icons" import { LogoIcon } from "../marks" +import { MenuSheet, MenuToggle } from "../phone-menu" import { monoFontLatin } from "../mono-fonts" import { SiteSearch } from "../search" import { loadSiteSettings, siteSettings } from "../settings" @@ -33,6 +36,9 @@ const SettingsPanel = import.meta.env.DEV ? lazy(() => import("./settings")) : u // (and with it this overlay). const [settings, setSettings] = createSignal(false) let settingsLoaded = false +// Whether the small-screen menu sheet is open: the scene (arcade.tsx) ignores input and goes quiet under it. +const [arcadeMenu, setArcadeMenu] = createSignal(false) +export { arcadeMenu } /** * The page around an arcade 404 scene, shared by every version of it: the site's own logo mark and @@ -55,6 +61,7 @@ export function ArcadeChrome(props: { settingsRows?: () => JSX.Element }) { href: siteSettings.productNavDemo === "on" && item.demo ? item.demo : item.href, label: navSavedLabel(entry(item.id), language.locale()) ?? item.label, external: "external" in item && !!item.external, + arrow: "arrow" in item && !!item.arrow, company: "company" in item, })), ...navCustomItems(siteSettings.navConfig), @@ -65,6 +72,7 @@ export function ArcadeChrome(props: { settingsRows?: () => JSX.Element }) { }) let settingsButton: HTMLButtonElement | undefined + let menuButton: HTMLButtonElement | undefined // The tone script set the grade on before first paint; keep it in step with Settings. createEffect(() => { @@ -90,6 +98,22 @@ export function ArcadeChrome(props: { settingsRows?: () => JSX.Element }) { } document.addEventListener("keydown", shortcut) onCleanup(() => document.removeEventListener("keydown", shortcut)) + // The menu closes on Escape (focus back on its button) and once the sidebar is back, as on the site. + const escape = (event: KeyboardEvent) => { + if (event.key !== "Escape" || !arcadeMenu()) return + event.preventDefault() + setArcadeMenu(false) + menuButton?.focus() + } + const wide = matchMedia("(min-width: 60.0625rem)") + const closeMenu = () => setArcadeMenu(false) + document.addEventListener("keydown", escape) + wide.addEventListener("change", closeMenu) + onCleanup(() => { + document.removeEventListener("keydown", escape) + wide.removeEventListener("change", closeMenu) + setArcadeMenu(false) + }) }) const close = () => { @@ -133,7 +157,39 @@ export function ArcadeChrome(props: { settingsRows?: () => JSX.Element }) { - + {/* Small screens: the site's top-bar GitHub mark and menu (phone-menu.tsx), on the logo's row. */} +
+ + (menuButton = element)} + open={arcadeMenu()} + onToggle={() => setArcadeMenu(!arcadeMenu())} + /> + setArcadeMenu(false)}> + + {(item, index) => ( +
  • + + + {item.label} + + + + + + + +
  • + )} +
    +
    +
    + {/* Under the open menu the scene's own controls leave the tab order (arcade.tsx does the stage). */} +
    + +
    {/* The site's tools need the [data-site] scope; the logo and nav above stay outside it so the site's stylesheet (loaded with the Settings panel) never restyles them. */}
    diff --git a/services/site/src/component/site/arcade/geometry.ts b/services/site/src/component/site/arcade/geometry.ts index b45f5495213..601a8ea14fb 100644 --- a/services/site/src/component/site/arcade/geometry.ts +++ b/services/site/src/component/site/arcade/geometry.ts @@ -78,13 +78,23 @@ export const frontGlass: Quad = [ { x: glass.x, y: glass.y + glass.h }, ] +/** The cabinet's centre line in the room shot, in its pixels (layers.css centres the first paint on it too). */ +export const cabinetCentre = 1355 + // Camera framings, as world rectangles to fit into the viewport. export const framing = { sceneWide: scene, - // Portrait phones crop the room to the cabinet and the token beside it (full height, so it covers). + // Portrait phones crop the room to the cabinet and the token beside it (full height, so it covers), + // centred on the cabinet: its body (layers.json › cabinet, 1133 to 1577 px) and its glass share x 1355. sceneTall: (() => { - const a = fromScene(1045, 0) - const b = fromScene(1755, 1536) + const a = fromScene(cabinetCentre - 355, 0) + const b = fromScene(cabinetCentre + 355, 1536) + return { x: a.x, y: a.y, w: b.x - a.x, h: b.y - a.y } + })(), + // Landscape phones: the widest crop centred on the cabinet (the room's left edge to as far right). + sceneCentred: (() => { + const a = fromScene(0, 0) + const b = fromScene(cabinetCentre * 2, 1536) return { x: a.x, y: a.y, w: b.x - a.x, h: b.y - a.y } })(), door: { x: 1110, y: 3290, w: 840, h: 900 }, diff --git a/services/site/src/component/site/arcade/layers.css b/services/site/src/component/site/arcade/layers.css index f22d51dfc73..97b60a76f07 100644 --- a/services/site/src/component/site/arcade/layers.css +++ b/services/site/src/component/site/arcade/layers.css @@ -61,5 +61,18 @@ height: auto; aspect-ratio: 2752 / 1536; translate: -50% -50%; + + /* Portrait (arcade.tsx's height > 1.1 × width): the camera's sceneTall framing, the 710 px around the + cabinet's centre line (geometry.ts › cabinetCentre, 1355 px), so hydrating does not move the room. */ + @media (max-aspect-ratio: 10 / 11) { + width: max(100% * 2752 / 710, var(--arcade-frame-height, 100svh) * 2752 / 1536); + translate: calc(-1355 / 2752 * 100%) -50%; + } + + /* Landscape phones (phone.ts): sceneCentred, the room's left edge to as far right of the cabinet. */ + @media (hover: none) and (pointer: coarse) and (max-height: 37.4375rem) and (min-aspect-ratio: 10 / 11) { + width: max(100% * 2752 / 2710, var(--arcade-frame-height, 100svh) * 2752 / 1536); + translate: calc(-1355 / 2752 * 100%) -50%; + } } } diff --git a/services/site/src/component/site/design-mode.tsx b/services/site/src/component/site/design-mode.tsx index 25151633122..d5a45c4858b 100644 --- a/services/site/src/component/site/design-mode.tsx +++ b/services/site/src/component/site/design-mode.tsx @@ -109,7 +109,7 @@ export const copyVariants = { label: "Logo row label", lines: 1, options: [ - "Trusted by 16M+ developers", + "Trusted by 22M+ developers", "Trusted worldwide", "Trusted by", "Used and trusted by developers", diff --git a/services/site/src/component/site/doc-list.css b/services/site/src/component/site/doc-list.css new file mode 100644 index 00000000000..13950051df2 --- /dev/null +++ b/services/site/src/component/site/doc-list.css @@ -0,0 +1,368 @@ +/* The document list: rows of whole-row links (title, description, dates), with the hover style from + Settings › Legal row hover. Shared by the legal index and the Press page's project list, so the two + look and behave the same. */ +[data-site] [data-component="legal-list"] { + display: flex; + flex-direction: column; + gap: 0.5rem; + + a { + position: relative; + display: flex; + flex-direction: column; + gap: 0.25rem; + padding: 1rem; + margin-inline: -1rem; + text-decoration: none; + color: var(--text); + outline: 2px solid transparent; + outline-offset: 0; + transition: + background-color 150ms ease, + border-color 150ms ease; + + &:focus-visible { + outline-color: var(--link); + } + } + + /* A step under the group headings (title size), so the list reads as one level beneath them. */ + [data-slot="title"] { + font-family: var(--font-mono); + font-size: var(--mono-size); + color: var(--text-strong); + } + + [data-slot="description"], + [data-slot="dates"] { + font-size: var(--body-size); + line-height: 1.5; + color: var(--text); + } + + /* Metadata (dates, "Pending legal review"): a step smaller than the description, and muted. */ + [data-slot="dates"] { + font-size: var(--fs-meta); + color: var(--text-weak); + + /* Phones: the effective date and the last change on their own lines, with no middot. */ + @media (max-width: 60rem) { + > span { + display: block; + } + + [data-slot="separator"] { + display: none; + } + } + } + + /* Touch: no long-press link preview over the rows (title and description run together in it). */ + @media (hover: none) { + a { + -webkit-touch-callout: none; + } + } + + /* Rows answer hover in the style Settings › Legal row hover picks; never in the menu blue. The + arrow and the bar are hidden until a style shows them. */ + &:is([data-style="rows"], [data-style="grouped"]) { + a { + padding-inline-end: 3.5rem; + } + + [data-slot="title"] { + color: var(--text-strong); + text-decoration: underline; + text-decoration-thickness: 1px; + text-underline-offset: 0.2em; + text-decoration-color: transparent; + transition: + color 150ms ease, + text-decoration-color 150ms ease; + } + + [data-slot="arrow"] { + position: absolute; + top: 1rem; + inset-inline-end: 1.25rem; + color: var(--text-strong); + opacity: 0; + translate: -0.375rem 0; + transition: + opacity 150ms ease, + translate 200ms var(--ease-out); + } + + /* The bar and the hairline are drawn by the link itself. */ + a::before { + content: ""; + position: absolute; + opacity: 0; + transition: opacity 150ms ease; + } + + a:focus-visible [data-slot="title"] { + color: var(--text-strong); + } + + @media (hover: hover) and (pointer: fine) { + a:hover [data-slot="title"] { + color: var(--text-strong); + } + } + + a:active [data-slot="title"] { + color: var(--text-strong); + } + } + + &[data-hover="title"] a:focus-visible [data-slot="title"] { + text-decoration-color: currentColor; + } + + @media (hover: hover) and (pointer: fine) { + &[data-hover="title"] a:hover [data-slot="title"] { + text-decoration-color: currentColor; + } + } + + &[data-hover="title"] a:active [data-slot="title"] { + text-decoration-color: currentColor; + } + + &[data-hover="arrow"] a:focus-visible [data-slot="arrow"] { + opacity: 1; + translate: 0 0; + } + + @media (hover: hover) and (pointer: fine) { + &[data-hover="arrow"] a:hover [data-slot="arrow"] { + opacity: 1; + translate: 0 0; + } + } + + &[data-hover="arrow"] a:active [data-slot="arrow"] { + opacity: 1; + translate: 0 0; + } + + /* "grey": the menus' hover in neutral grey whatever Menu color is: a light tint and a mid-grey + bar on the left edge. No arrow. */ + &[data-hover="grey"] a:focus-visible { + background: var(--bg-weak); + } + + @media (hover: hover) and (pointer: fine) { + &[data-hover="grey"] a:hover { + background: var(--bg-weak); + } + } + + &[data-hover="grey"] a:active { + background: var(--bg-weak); + } + + &[data-hover="grey"] a::before { + top: 0; + bottom: 0; + inset-inline-start: 0; + width: 2px; + background: light-dark(hsl(0, 0%, 50%), hsl(0, 0%, 46%)); + } + + &[data-hover="grey"] a:focus-visible::before { + opacity: 1; + } + + @media (hover: hover) and (pointer: fine) { + &[data-hover="grey"] a:hover::before { + opacity: 1; + } + } + + &[data-hover="grey"] a:active::before { + opacity: 1; + } + + &[data-hover="bar"] a::before { + top: 1rem; + bottom: 1rem; + inset-inline-start: 0; + width: 2px; + background: var(--menu-bar); + } + + &[data-hover="lift"] a::before { + inset-inline-start: 1rem; + inset-inline-end: 1rem; + bottom: 0; + height: 1px; + background: var(--border-strong); + } + + &:is([data-hover="bar"], [data-hover="lift"]) a:focus-visible::before { + opacity: 1; + } + + @media (hover: hover) and (pointer: fine) { + &:is([data-hover="bar"], [data-hover="lift"]) a:hover::before { + opacity: 1; + } + } + + &:is([data-hover="bar"], [data-hover="lift"]) a:active::before { + opacity: 1; + } + + &[data-hover="lift"] a:focus-visible [data-slot="description"] { + color: var(--text); + } + + @media (hover: hover) and (pointer: fine) { + &[data-hover="lift"] a:hover [data-slot="description"] { + color: var(--text); + } + } + + /* Cards: two columns of tinted cards; the date sits at the bottom. */ + &[data-style="cards"], + &[data-style="tiles"] { + display: grid; + grid-template-columns: repeat(2, minmax(0, 1fr)); + gap: var(--gutter); + + li { + display: flex; + } + + a { + flex: 1; + margin: 0; + padding: 1.25rem; + gap: 0.5rem; + background: var(--bg-weak); + border: 1px solid transparent; + + @media (hover: hover) and (pointer: fine) { + &:hover { + background: var(--bg-weaker); + } + } + + &:active { + background: var(--bg-weaker); + } + } + + [data-slot="dates"] { + margin-top: auto; + padding-top: 0.75rem; + } + } + + /* Tiles: taller, with a document glyph above the title. */ + &[data-style="tiles"] { + grid-template-columns: repeat(3, minmax(0, 1fr)); + + a { + min-height: 15rem; + padding: 1.5rem; + background: none; + border-color: var(--border); + + @media (hover: hover) and (pointer: fine) { + &:hover { + background: var(--bg-weak); + border-color: var(--border-strong); + } + } + + &:active { + background: var(--bg-weak); + border-color: var(--border-strong); + } + } + + [data-slot="glyph"] { + margin-bottom: 1rem; + color: var(--text-weak); + } + } + + /* Compact: title and date on one line; the description shows on hover and focus. */ + &[data-style="compact list"] { + gap: 0; + + a { + display: grid; + grid-template-columns: minmax(0, 1fr) auto; + column-gap: 1.5rem; + align-items: baseline; + padding-block: 0.75rem; + + @media (hover: hover) and (pointer: fine) { + &:hover { + background: var(--bg-weaker); + } + } + + &:active { + background: var(--bg-weaker); + } + } + + [data-slot="description"] { + grid-column: 1 / -1; + grid-row: 2; + display: none; + padding-top: 0.25rem; + } + + [data-slot="dates"] { + grid-column: 2; + grid-row: 1; + text-align: end; + } + + a:focus-visible [data-slot="description"] { + display: block; + } + + @media (hover: hover) and (pointer: fine) { + a:hover [data-slot="description"] { + display: block; + } + } + + @media (hover: none), (pointer: coarse) { + [data-slot="description"] { + display: block; + } + } + } + + @media (max-width: 40rem) { + &:is([data-style="cards"], [data-style="tiles"]) { + grid-template-columns: minmax(0, 1fr); + } + + &[data-style="compact list"] a { + grid-template-columns: minmax(0, 1fr); + + [data-slot="dates"] { + grid-column: 1; + grid-row: auto; + text-align: start; + } + } + } +} + +/* A new-tab arrow after a title: the nav's 6px arrow, 6px after the text, on its line. */ +[data-site] [data-component="legal-list"] [data-slot="title"]:has(> [data-slot="external"]) { + display: inline-flex; + align-items: center; + gap: 6px; +} diff --git a/services/site/src/component/site/github-link.css b/services/site/src/component/site/github-link.css index 465227efdc4..39817ea5767 100644 --- a/services/site/src/component/site/github-link.css +++ b/services/site/src/component/site/github-link.css @@ -14,7 +14,7 @@ --github-right: calc(0.75rem + (4.5rem - var(--github-size)) / 2 + env(safe-area-inset-right, 0px)); } - /* The link is the full 40px target. No backing: over a dark or light surface it takes that + /* The link is the full 40px target round the 20px mark. No backing: over a dark or light surface it takes that scheme's ink instead (below). */ [data-component="github-link"] { --github-mark: 20px; @@ -26,6 +26,17 @@ border-radius: 50%; color: var(--text-strong); cursor: pointer; + + svg { + width: var(--github-mark); + height: var(--github-mark); + } + + /* Phones and tablets: a 24px mark in the top bar and in the bare pages' corner (the font page), + still centred in its 44px target. */ + @media (max-width: 60rem) { + --github-mark: 24px; + } } /* The fixed marks (the GitHub mark, the product pages' chevrons beside it, the /font logo) take diff --git a/services/site/src/component/site/github-link.tsx b/services/site/src/component/site/github-link.tsx new file mode 100644 index 00000000000..9c09d9b4d92 --- /dev/null +++ b/services/site/src/component/site/github-link.tsx @@ -0,0 +1,26 @@ +import "./github-link.css" +import { useI18n } from "~/context/i18n" +import { useLanguage } from "~/context/language" +import { GitHubMark } from "./icons" +import { siteLinks } from "./links" + +/** + * The repo, as a GitHub mark: fixed in the top-right corner beside the sidebar (and at every width on + * bare pages), in the top bar on small screens (site.tsx), and in the 404 arcade's phone bar. + */ +export function GitHubLink(props: { owner: "corner" | "topbar" }) { + const i18n = useI18n() + const language = useLanguage() + return ( + + + + ) +} diff --git a/services/site/src/component/site/logo-wall.tsx b/services/site/src/component/site/logo-wall.tsx index 214929130a3..7a327f82ac5 100644 --- a/services/site/src/component/site/logo-wall.tsx +++ b/services/site/src/component/site/logo-wall.tsx @@ -341,7 +341,7 @@ function fitRule(id: string, label: string) { return `@container (width < calc(${width}em + 24px)){${at}>[data-slot="long"]{display:none}${at}>[data-slot="short"]{display:inline}}` } -/** The label's text with its number ("16M+", "16 Mio.+", "1,600万") kept on one line. */ +/** The label's text with its number ("22M+", "22 Mio.+", "2,200万") kept on one line. */ function LabelText(props: { text: string }) { const parts = () => props.text.split(/(\d[\d,.]*(?:\s?(?:Mio\.|万|萬|만|ล้าน|M))?\+?)/) return {(part, index) => (index() % 2 ? {part} : part)} diff --git a/services/site/src/component/site/on-this-page.css b/services/site/src/component/site/on-this-page.css index 0356b99ed6f..d75eecb40a1 100644 --- a/services/site/src/component/site/on-this-page.css +++ b/services/site/src/component/site/on-this-page.css @@ -106,6 +106,11 @@ [data-site] { --section-gap: 72px; --heading-gap: 24px; + + /* Phones: 2px more under each title (David, 6 Nov), like the home sections (site.css). */ + @media (max-width: 40rem) { + --heading-gap: 26px; + } } [data-site] :is(h2, h3)[data-component="section-heading"][id] { @@ -134,13 +139,12 @@ /* "Contents" on phones: a disclosure above the first section, in place of the hidden aside. It sticks under the top bar, or under the lowest sticky bar the page has above it (--contents-top: the legal pages' --anchor-top, less its 1rem, is the bottom of their breadcrumb band and Document / History - tabs), in the page colour, so the sections scroll behind it. Only its top rule shows at rest (the - next section's own divider closes it); while it is stuck the top rule gives way to a hairline at - its bottom edge (the bar above has its own). + tabs), in the page colour, so the sections scroll behind it. Its row is as tall as an accordion + row (--row-height, site.css), with one edge-to-edge line above and one below. Open, the list drops over the page instead of pushing it down, and scrolls when it is longer than the window. Sticky positioning only, so nothing moves when it pins. */ [data-site] { - --contents-height: 2.75rem; + --contents-height: var(--row-height); --contents-top: calc(var(--anchor-top, calc(var(--topbar-height) + env(safe-area-inset-top, 0px) + 1rem)) - 1rem); } @@ -163,10 +167,9 @@ display: flex; align-items: center; justify-content: space-between; + position: relative; + z-index: 1; min-height: var(--contents-height); - /* A rule above and a hairline below, at rest and pinned. */ - border-top: 1px solid var(--border); - box-shadow: 0 1px 0 var(--border); font-family: var(--font-mono); font-size: var(--fs-small); color: var(--text-strong); @@ -217,14 +220,39 @@ z-index: 8; display: block; background: var(--bg); - container-type: scroll-state; - /* Stuck, the bar above already has its own bottom edge, so the top rule gives way to one at the - bottom. */ - @container scroll-state(stuck: top) { - summary { - border-top-color: transparent; - box-shadow: 0 1px 0 var(--border); + /* One line above the bar and one below, each across the whole screen. The top line sits on the + row above the bar: stuck, that row is the top bar's own bottom hairline, which paints over it, + so there's only ever one line there and nothing moves when the bar sticks. */ + summary::before, + summary::after { + content: ""; + position: absolute; + inset-inline: calc(-1 * var(--edge)); + height: 1px; + background: var(--border); + pointer-events: none; + } + + summary::before { + top: -1px; + } + + summary::after { + top: 100%; + } + + /* The bar follows the page's direction, even inside an English-only document on a right-to-left + page (legal), so its chevron stays on the menu button's side. */ + html[dir="rtl"] & { + direction: rtl; + } + + /* Phones: the chevron is centred under the menu button in the top bar (34px in from the screen + edge), like the accordions' plus. */ + @media (max-width: 40rem) { + summary [data-slot="chevron"] { + margin-inline-end: calc(34px - var(--edge) - 6px); } } @@ -245,8 +273,9 @@ padding-inline: var(--edge); } + /* Each row of the open list is as tall as the bar (--row-height). */ a { - --rail-pad: 11px; + --rail-pad: calc((var(--contents-height) - 1lh) / 2); padding-inline-start: 0; font-size: var(--body-size); diff --git a/services/site/src/component/site/phone-menu.css b/services/site/src/component/site/phone-menu.css new file mode 100644 index 00000000000..6ad8ca25801 --- /dev/null +++ b/services/site/src/component/site/phone-menu.css @@ -0,0 +1,168 @@ +/* The small-screen menu (phone-menu.tsx): the menu button and the sheet it opens. Shared by the + site's top bar (site.tsx) and the 404 arcade (arcade/chrome.tsx), which renders without site.css. */ +[data-site] { + [data-component="site-menu-sheet"] { + display: none; + } + + @media (max-width: 60rem) { + /* Two lines that turn into an X. The lines end on the page edge; the button extends past it + so the tap target is 44px square. */ + [data-component="menu-toggle"] { + position: relative; + width: 2.75rem; + height: 2.75rem; + margin-inline-end: -0.75rem; + + [data-slot="line"] { + position: absolute; + inset-inline-start: 0.75rem; + inset-inline-end: 0.75rem; + top: calc(50% - 0.5px); + height: 1px; + background: var(--text-strong); + transition: transform 200ms var(--ease-out); + + &:first-child { + transform: translateY(-4.5px); + } + + &:last-child { + transform: translateY(4.5px); + } + } + + &[aria-expanded="true"] [data-slot="line"] { + &:first-child { + transform: rotate(45deg); + } + + &:last-child { + transform: rotate(-45deg); + } + } + } + + /* Covers the page under the header. It appears at once, as one surface with the bar, and its + rows rise in with a short stagger: each fades in and moves up 6px over 200ms on the strong + ease-out, 25ms after the one before, the delay capped at 100ms so the reveal ends by 300ms. + Closing is a quicker 120ms fade without stagger. Closed, it stays in place but hidden, and + every value is a transition, so a tap mid-reveal turns it around from where it is. */ + [data-component="site-menu-sheet"] { + --menu-close: 120ms; + + position: fixed; + inset: calc(var(--topbar-height) + env(safe-area-inset-top, 0px)) 0 0; + z-index: 9; + display: block; + visibility: hidden; + transition: visibility 0s linear var(--menu-close); + + [data-slot="backdrop"] { + position: absolute; + inset: 0; + background: var(--bg); + opacity: 0; + transition: opacity var(--menu-close) var(--ease-out); + } + + [data-slot="panel"] { + position: relative; + max-height: 100%; + overflow-y: auto; + overscroll-behavior: contain; + padding: 0.5rem calc(var(--edge) + env(safe-area-inset-right, 0px)) + calc(1.5rem + env(safe-area-inset-bottom, 0px)) calc(var(--edge) + env(safe-area-inset-left, 0px)); + font-family: var(--font-mono); + /* The sheet's one job is this list: a step above the body copy, like a native menu. */ + font-size: var(--fs-large); + line-height: 24px; + } + + [data-slot="panel"] > ul > li { + opacity: 0; + translate: 0 6px; + transition: + opacity var(--menu-close) var(--ease-out), + translate var(--menu-close) var(--ease-out); + } + + a { + display: flex; + align-items: center; + gap: 0.625rem; + min-height: 3.25rem; + color: var(--text); + transition: color 150ms ease; + + &[aria-current="page"] { + color: var(--text-strong); + } + + &:active { + color: var(--text-strong); + } + } + + /* --text-muted, not --text-faint: 4.5:1 at this size. */ + [data-slot="index"] { + color: var(--text-muted); + } + + a[aria-current="page"] [data-slot="index"] { + color: var(--text-strong); + } + + /* Touch has no hover to reveal the arrow, so it always shows, 6px after the label. */ + [data-slot="external"] { + flex-shrink: 0; + margin-inline-start: calc(6px - 0.625rem); + translate: 0 -2px; + } + + &[data-open] { + visibility: visible; + transition: visibility 0s; + + [data-slot="backdrop"] { + opacity: 1; + transition: none; + } + + [data-slot="panel"] > ul > li { + --row: 4; + + opacity: 1; + translate: none; + transition-duration: 200ms; + transition-delay: calc(var(--row) * 25ms); + + &:nth-child(1) { + --row: 0; + } + + &:nth-child(2) { + --row: 1; + } + + &:nth-child(3) { + --row: 2; + } + + &:nth-child(4) { + --row: 3; + } + } + } + + /* Reduced motion: the rows appear with a short fade, all at once and without moving. */ + @media (prefers-reduced-motion: reduce) { + [data-slot="panel"] > ul > li, + &[data-open] [data-slot="panel"] > ul > li { + translate: none; + transition: opacity var(--menu-close) ease; + } + } + } + } +} diff --git a/services/site/src/component/site/phone-menu.tsx b/services/site/src/component/site/phone-menu.tsx new file mode 100644 index 00000000000..3c2332a3e13 --- /dev/null +++ b/services/site/src/component/site/phone-menu.tsx @@ -0,0 +1,52 @@ +import "./phone-menu.css" +import type { JSX } from "solid-js" +import { useI18n } from "~/context/i18n" + +/** + * The small-screen header's menu button and the sheet it opens, shared by the site's top bar + * (site.tsx) and the 404 arcade (arcade/chrome.tsx). The caller owns the open state, Escape and + * returning focus to the button; the sheet closes itself on its backdrop and on a chosen link. + */ +export function MenuToggle(props: { open: boolean; onToggle: () => void; ref?: (element: HTMLButtonElement) => void }) { + const i18n = useI18n() + return ( + + ) +} + +export function MenuSheet(props: { + open: boolean + onClose: () => void + children: JSX.Element + listRef?: (element: HTMLUListElement) => void + sortable?: boolean +}) { + const i18n = useI18n() + return ( +