From 16b6395fe2a4ca6dc481b2b59e14d87ed1e668c7 Mon Sep 17 00:00:00 2001 From: ZingerLittleBee <6970999@gmail.com> Date: Sun, 22 Nov 2026 11:35:11 +0800 Subject: [PATCH 1/9] feat(landing): pan captures sideways on narrow screens On a phone a capture was enlarged and cut at its frame's right edge, with no way to see the rest. Its frame now runs off the right of the screen and pans sideways, like the row of phones. The scene layer moves into the frame so it pans with the capture, and a capture stops growing once the column is wider than a phone. --- .../src/components/sections/dashboards.astro | 2 +- .../src/components/sections/hero.astro | 2 +- .../src/components/sections/ip-quality.astro | 2 +- apps/landing/src/components/shot.astro | 84 ++++++++++++------- apps/landing/src/scripts/motion/stage.ts | 4 +- apps/landing/src/styles/global.css | 48 +++++++++-- apps/landing/src/styles/motion.css | 6 +- 7 files changed, 100 insertions(+), 48 deletions(-) diff --git a/apps/landing/src/components/sections/dashboards.astro b/apps/landing/src/components/sections/dashboards.astro index 30611c48..38ca61aa 100644 --- a/apps/landing/src/components/sections/dashboards.astro +++ b/apps/landing/src/components/sections/dashboards.astro @@ -25,7 +25,7 @@ const copy = landingCopy[lang].dash name="dashboard" lang={lang} sizes="(max-width: 900px) calc(100vw - 40px), min(64vw, 800px)" - mobile={{ zoom: 1.9, ratio: '1 / 1' }} + mobile={{ zoom: 1.9, ratio: 1 }} />
diff --git a/apps/landing/src/components/sections/hero.astro b/apps/landing/src/components/sections/hero.astro index efaf98a1..a507bd80 100644 --- a/apps/landing/src/components/sections/hero.astro +++ b/apps/landing/src/components/sections/hero.astro @@ -52,7 +52,7 @@ const headline = [hero.h1a, hero.h1b].join(lang === 'zh' ? '' : ' ') name="fleet" lang={lang} sizes="min(100vw - 40px, 1240px)" - mobile={{ zoom: 2.3, shiftX: 0.185, ratio: '5 / 6' }} + mobile={{ zoom: 2.3, shiftX: 0.185, ratio: 5 / 6 }} eager /> diff --git a/apps/landing/src/components/sections/ip-quality.astro b/apps/landing/src/components/sections/ip-quality.astro index a6d20a74..5995d695 100644 --- a/apps/landing/src/components/sections/ip-quality.astro +++ b/apps/landing/src/components/sections/ip-quality.astro @@ -23,7 +23,7 @@ const copy = landingCopy[lang].ipq
- +
diff --git a/apps/landing/src/components/shot.astro b/apps/landing/src/components/shot.astro index 1e5f52b4..397a650b 100644 --- a/apps/landing/src/components/shot.astro +++ b/apps/landing/src/components/shot.astro @@ -10,15 +10,19 @@ interface Props { eager?: boolean lang: Lang /** - * How a narrow screen shows the capture: `zoom` times larger than fitted, starting `shiftX` of its width in from - * the left, in a frame of `ratio` (width / height) or as tall as the enlarged capture. + * How a narrow screen shows the capture: `zoom` times the width of the column, so it runs off the right of the + * screen and pans sideways. It starts `shiftX` of its width in from the left. With `ratio`, its frame is cut to + * the height of a box as wide as the column with that width over height; without, it is as tall as the capture. */ - mobile?: { ratio?: string; shiftX?: number; zoom: number } + mobile?: { ratio?: number; shiftX?: number; zoom: number } name: ShotName /** The frame's layout width as a `sizes` value. */ sizes: string } +/** The widest column a capture is enlarged against: past a phone's width it has grown enough to read. */ +const PAN_COLUMN = 400 + const { eager = false, lang, mobile, name } = Astro.props const files = import.meta.glob('../assets/shots/*.webp', { eager: true, import: 'default' }) @@ -41,36 +45,52 @@ const widths = [640, 960, 1440, 1920].filter((width) => width < light.width) const picture = await themedPicture(light, file('dark'), [...widths, light.width]) // On a narrow screen an enlarged capture is laid out wider than the viewport, so it needs a larger source. const sizes = mobile - ? `(max-width: 640px) calc(${mobile.zoom} * (100vw - 40px)), ${Astro.props.sizes}` + ? `(max-width: 640px) calc(${mobile.zoom} * min(100vw - 40px, ${PAN_COLUMN}px)), ${Astro.props.sizes}` : Astro.props.sizes -const zoomStyle = mobile - ? `--zoom: ${mobile.zoom}; --shift-x: ${mobile.shiftX ?? 0}; --ratio: ${mobile.ratio ?? 'auto'}` - : undefined + +/** The narrow layout as the stylesheet takes it: the frame against the column, the capture against the frame. */ +function pan({ ratio, shiftX = 0, zoom }: NonNullable): string { + const kept = 1 - shiftX + const round = (value: number): number => Math.round(value * 1000) / 1000 + return [ + `--pan-scale: ${round(zoom * kept)}`, + `--pan-column: ${PAN_COLUMN}px`, + `--pan-capture: ${round(100 / kept)}%`, + `--pan-shift: ${round((-100 * shiftX) / kept)}%`, + `--pan-aspect: ${ratio ? round(zoom * kept * ratio) : 'auto'}` + ].join('; ') +} --- -
- - { - picture.sources.map((source) => ( - - )) - } - {landingCopy[lang].shots[name]} - +
+
+ + { + picture.sources.map((source) => ( + + )) + } + {landingCopy[lang].shots[name]} + +
diff --git a/apps/landing/src/scripts/motion/stage.ts b/apps/landing/src/scripts/motion/stage.ts index 8905d2bf..cffa9344 100644 --- a/apps/landing/src/scripts/motion/stage.ts +++ b/apps/landing/src/scripts/motion/stage.ts @@ -161,7 +161,9 @@ export function overlay(figure: HTMLElement, className: string, groundAt: [numbe } const layer = el('div', `overlay ${className}`) layer.setAttribute('aria-hidden', 'true') - figure.append(layer) + // The frame, not the figure: on a narrow screen the figure is the strip the frame pans in. + const frame = figure.querySelector('.shot-frame') ?? figure + frame.append(layer) watch(figure, (visible) => layer.toggleAttribute('data-visible', visible), 0) let settle: () => void diff --git a/apps/landing/src/styles/global.css b/apps/landing/src/styles/global.css index 44390edd..ea210b42 100644 --- a/apps/landing/src/styles/global.css +++ b/apps/landing/src/styles/global.css @@ -768,7 +768,8 @@ h3 { /* ---------- Product captures ---------- */ -.shot { +/* The frame around a capture. Scenes lay their layer over it. */ +.shot-frame { position: relative; overflow: hidden; background: var(--surface); @@ -787,18 +788,34 @@ h3 { } /* - * A whole window shrunk to a phone's width is unreadable. On a narrow screen a capture that sets --zoom is shown - * that many times larger, cut to its top left corner, or to the column --shift-x (a fraction of its width) starts. + * A whole window shrunk to a phone's width is unreadable. On a narrow screen a capture keeps a readable size + * instead: its frame is wider than the screen, runs off the right edge, and pans sideways like the row of phones. + * The figure is the strip it pans in, from one edge of the screen to the other. */ @media (max-width: 640px) { - .shot-zoom { - aspect-ratio: var(--ratio, auto); + .shot-pan { + display: flex; + padding: 4px var(--gutter) 32px; + margin: -4px calc(-1 * var(--gutter)) -32px; + overflow-x: auto; + overscroll-behavior-x: contain; + scrollbar-width: none; + } + + /* The strip cuts a shadow where it ends, so the shadow stays inside its padding. */ + .shot-pan .shot-frame { + flex: none; + width: max(100%, var(--pan-scale) * min(100%, var(--pan-column))); + aspect-ratio: var(--pan-aspect); + box-shadow: + 0 1px 2px light-dark(rgb(22 24 60 / 0.05), rgb(0 0 0 / 0.4)), + 0 12px 28px -14px light-dark(rgb(22 24 60 / 0.2), rgb(0 0 0 / 0.6)); } - .shot-zoom img { - width: calc(var(--zoom) * 100%); + .shot-pan img { + width: var(--pan-capture); max-width: none; - margin-left: calc(var(--zoom) * var(--shift-x, 0) * -100%); + margin-left: var(--pan-shift); } } @@ -917,7 +934,7 @@ section[id] { } /* The capture under the command is its result, so the two share one frame. */ -.grant + .shot { +.grant + .shot .shot-frame { border-radius: 0 0 var(--r-l) var(--r-l); } @@ -984,6 +1001,19 @@ section[id] { } } +/* Where the capture pans on its own, the command and the capture each get a whole frame. */ +@media (max-width: 640px) { + .grant { + margin-bottom: 16px; + border-bottom: 1px solid var(--cmd-line); + border-radius: var(--r-l); + } + + .grant + .shot .shot-frame { + border-radius: var(--r-l); + } +} + /* ---------- iOS ---------- */ .ios-grid { diff --git a/apps/landing/src/styles/motion.css b/apps/landing/src/styles/motion.css index 30b75b3b..9561548e 100644 --- a/apps/landing/src/styles/motion.css +++ b/apps/landing/src/styles/motion.css @@ -324,9 +324,9 @@ @media (max-width: 640px) { /* Follow the enlarged, shifted capture a narrow screen shows. */ - .shot-zoom > .overlay { - inset: 0 auto auto calc(var(--zoom) * var(--shift-x, 0) * -100%); - width: calc(var(--zoom) * 100%); + .shot-pan .overlay { + inset: 0 auto auto var(--pan-shift); + width: var(--pan-capture); height: auto; aspect-ratio: var(--capture-ratio); } From 02285a93bf17404ec26ccb39f9cb2382d5f36432 Mon Sep 17 00:00:00 2001 From: ZingerLittleBee <6970999@gmail.com> Date: Sun, 22 Nov 2026 11:35:11 +0800 Subject: [PATCH 2/9] fix(landing): keep the header from colliding on phones At 360px the docs link ran into the language switch, and at 320px the install button left the screen. Up to 560px the theme toggle now sits in the footer and the GitHub icon is dropped. At 340px and below the docs link goes too. --- apps/landing/src/components/footer.astro | 10 +++++- apps/landing/src/styles/global.css | 45 ++++++++++++++++++++++-- 2 files changed, 51 insertions(+), 4 deletions(-) diff --git a/apps/landing/src/components/footer.astro b/apps/landing/src/components/footer.astro index b6c8d936..8d265409 100644 --- a/apps/landing/src/components/footer.astro +++ b/apps/landing/src/components/footer.astro @@ -1,5 +1,7 @@ --- +import Moon from '@lucide/astro/icons/moon' import Radar from '@lucide/astro/icons/radar' +import Sun from '@lucide/astro/icons/sun' import { landingCopy } from '@/i18n/copy' import { homePath, type Lang } from '@/lib/site' @@ -30,6 +32,12 @@ const copy = landingCopy[lang].footer - + diff --git a/apps/landing/src/styles/global.css b/apps/landing/src/styles/global.css index ea210b42..b2cf61a5 100644 --- a/apps/landing/src/styles/global.css +++ b/apps/landing/src/styles/global.css @@ -425,8 +425,27 @@ h3 { } } -@media (max-width: 420px) { - .header .tool-github { +/* A phone's bar holds the logo, the docs, the other language and the install button. The theme toggle moves to + the footer, and GitHub is already linked from the hero. */ +@media (max-width: 560px) { + .header-bar { + gap: 8px; + } + + .header .tool-github, + .header [data-theme-toggle] { + display: none; + } + + .header .btn { + padding-inline: 12px; + margin-left: 4px; + } +} + +/* The narrowest phones lose the docs link too: the footer has it. */ +@media (max-width: 340px) { + .nav { display: none; } } @@ -1619,12 +1638,32 @@ section[id] { color: var(--ink); } -.footer-legal { +.footer-end { + display: flex; + gap: 16px; + align-items: center; + justify-content: space-between; margin-top: 16px; +} + +.footer-legal { font-size: 0.875rem; color: var(--ink-3); } +/* Shown where the header has no room for its own. */ +.footer .tool { + display: none; + flex: none; + margin-right: -8px; +} + +@media (max-width: 560px) { + .footer .tool { + display: inline-flex; + } +} + /* ---------- Not found ---------- */ .lost { From bc559278b360dfe90a569bd0d6aab32cf826de57 Mon Sep 17 00:00:00 2001 From: ZingerLittleBee <6970999@gmail.com> Date: Sun, 22 Nov 2026 11:35:12 +0800 Subject: [PATCH 3/9] fix(landing): break install commands between arguments On a narrow screen the installer URL broke inside a name, and --server-url broke after its hyphens, which reads as another argument. --- apps/landing/src/components/command.astro | 23 ++++++++++++++++++++++- apps/landing/src/styles/global.css | 6 ++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/apps/landing/src/components/command.astro b/apps/landing/src/components/command.astro index e373c570..50247aed 100644 --- a/apps/landing/src/components/command.astro +++ b/apps/landing/src/components/command.astro @@ -14,11 +14,32 @@ const copy = landingCopy[lang].hero // The installer URL is the longest and least interesting part of a command, so it is dimmed. const url = /https:\/\/\S+/.exec(command)?.[0] ?? '' const [before, after = ''] = url ? command.split(`${url} `, 2) : [command] + +function escapeHtml(text: string): string { + return text.replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>') +} + +/** Each argument in one piece: a line that breaks after a hyphen of `--server-url` reads as another argument. */ +function words(text: string): string { + return text + .split(' ') + .map((word) => (word ? `${escapeHtml(word)}` : '')) + .join(' ') +} + +/** A narrow screen breaks the URL after a slash of its path rather than in the middle of a name. */ +function breakable(address: string): string { + const [scheme, rest = ''] = address.split('://') + return `${escapeHtml(scheme)}://${rest.split('/').map(escapeHtml).join('/')}` +} + +// Built as one string: the command keeps its white space, so the markup must not add any. +const html = `${words(before)}${breakable(url)} ${words(after)}` ---
- {before}{url}{' '}{after} +