From c08a28f85f417db53d177ce3340352aabb7ca474 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 28 Sep 2026 02:38:22 +0000 Subject: [PATCH] chore(site): remove the temporary viewport readout Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01MRL8Z7p5CWKsXXXoi2mRG8 --- site/src/scripts/hero-story/story.ts | 3 -- site/src/scripts/hero-story/viewport-probe.ts | 49 ------------------- 2 files changed, 52 deletions(-) delete mode 100644 site/src/scripts/hero-story/viewport-probe.ts diff --git a/site/src/scripts/hero-story/story.ts b/site/src/scripts/hero-story/story.ts index 82a5abc..8948571 100644 --- a/site/src/scripts/hero-story/story.ts +++ b/site/src/scripts/hero-story/story.ts @@ -699,9 +699,6 @@ export function mountStory(root: HTMLElement) { const clear = () => Math.max(0, canvas.clientHeight - dvh.offsetHeight) // The visible height changes with the toolbar: refit. const fitOver = () => (geom = '') - // ?viewport shows what this browser reports about its viewport. - if (new URLSearchParams(location.search).has('viewport')) - void import('./viewport-probe').then((m) => m.probe(canvas, next)) visualViewport?.addEventListener('resize', fitOver) addEventListener('resize', fitOver) diff --git a/site/src/scripts/hero-story/viewport-probe.ts b/site/src/scripts/hero-story/viewport-probe.ts deleted file mode 100644 index d19c7a1..0000000 --- a/site/src/scripts/hero-story/viewport-probe.ts +++ /dev/null @@ -1,49 +0,0 @@ -// A readout of what the browser reports about its viewport, for tuning the -// story on devices we can't run here (iPhone Safari's floating toolbar). -// Open the page with ?viewport and screenshot it. -export function probe(stage: HTMLElement, next: HTMLElement) { - const box = document.createElement('pre') - Object.assign(box.style, { - position: 'fixed', - top: '8px', - right: '8px', - zIndex: '9999', - margin: '0', - padding: '6px 8px', - borderRadius: '6px', - background: 'rgba(0,0,0,0.78)', - color: '#7ff', - font: '11px/1.35 ui-monospace, monospace', - pointerEvents: 'none', - }) - // Elements sized in each viewport unit, and one padded by the safe area. - const unit = (css: string) => { - const el = document.createElement('div') - el.style.cssText = `position:absolute;left:0;top:0;width:0;visibility:hidden;${css}` - document.body.append(el) - return el - } - const svh = unit('height:100svh') - const dvh = unit('height:100dvh') - const lvh = unit('height:100lvh') - const safe = unit('height:0;padding-bottom:env(safe-area-inset-bottom)') - document.body.append(box) - const r = (n: number) => Math.round(n) - const show = () => { - const vv = visualViewport - box.textContent = [ - `screen ${screen.width}x${screen.height}`, - `inner ${innerWidth}x${innerHeight}`, - `client ${document.documentElement.clientHeight}`, - `vv h${r(vv?.height ?? 0)} top${r(vv?.offsetTop ?? 0)} x${vv?.scale.toFixed(2)}`, - `svh/dvh/lvh ${svh.offsetHeight}/${dvh.offsetHeight}/${lvh.offsetHeight}`, - `safe-bot ${safe.offsetHeight}`, - `stage top${r(stage.getBoundingClientRect().top)} h${stage.clientHeight}`, - `clear ${Math.max(0, stage.clientHeight - dvh.offsetHeight)}`, - `next bottom${r(next.getBoundingClientRect().bottom)}`, - `scrollY ${r(scrollY)}`, - ].join('\n') - } - show() - setInterval(show, 400) -}