From 8f3cbcf11356807762145b817d11f660a63480aa Mon Sep 17 00:00:00 2001 From: Alex Gorischek Date: Wed, 2 Dec 2026 13:16:14 -0800 Subject: [PATCH 1/5] Renderer workbench: the view is a card on the gutter, like the Inspector's Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .../host/inspector/browser/fixtures.spec.ts | 60 ++++++++++++++++++- .../inspector/src/fixtures/workbench/body.tsx | 7 +-- packages/host/inspector/src/styles.css | 4 ++ 3 files changed, 66 insertions(+), 5 deletions(-) diff --git a/packages/host/inspector/browser/fixtures.spec.ts b/packages/host/inspector/browser/fixtures.spec.ts index 86e6fb568..8514ad610 100644 --- a/packages/host/inspector/browser/fixtures.spec.ts +++ b/packages/host/inspector/browser/fixtures.spec.ts @@ -1,4 +1,4 @@ -import {test as base, expect, type Page} from '@playwright/test' +import {test as base, expect, type Locator, type Page} from '@playwright/test' import {copyFile, mkdtemp, mkdir, readFile, rm, writeFile} from 'node:fs/promises' import {tmpdir} from 'node:os' import {join, resolve} from 'node:path' @@ -199,3 +199,61 @@ test('fixtures and renderer bundles reload live when their files change', async await sidebar(page) await expect(page.locator('[data-scenario="cases/platform"]')).toContainText('Unavailable', reload) }) + +test('the view is a card on the gutter, like the Explorer and the panel', async ({page, fixtures}, testInfo) => { + test.skip(testInfo.project.name !== 'chromium-desktop', 'One project covers the geometry') + await page.setViewportSize({width: 1440, height: 900}) + await page.goto(at(fixtures, 'cases/platform')) + await expect(page.locator('.ph[data-mode="comparison"][data-renderer-status="ready"]')).toBeVisible() + const gutter = 8 + const box = async (locator: Locator) => (await locator.boundingBox())! + const look = (locator: Locator) => + locator.evaluate(element => { + const style = getComputedStyle(element) + return { + radius: style.borderTopLeftRadius, + border: `${style.borderTopWidth} ${style.borderTopStyle} ${style.borderTopColor}`, + surface: style.backgroundColor, + } + }) + const view = page.locator('.pi-view.pi-card') + const explorer = page.getByRole('complementary', {name: 'Explorer'}) + const panel = page.getByRole('region', {name: 'Panel'}) + const toggle = (name: RegExp) => page.locator('.pi-titlebar').getByRole('button', {name}) + if (!(await explorer.count())) await toggle(/^Show .* sidebar$/u).click() + if (!(await panel.count())) await toggle(/^Show panel$/u).click() + // One radius, border and surface, and the view's own chrome flat inside; what it holds is clipped to its corners. + expect(await look(view)).toEqual(await look(explorer)) + expect(await look(view)).toEqual(await look(panel)) + await expect(view).toHaveCSS('overflow', 'hidden') + await expect(page.locator('.ph-toolbar').first()).toHaveCSS('border-top-left-radius', '0px') + // One gutter from the Explorer, the panel and the window's edge. + let card = await box(view) + const side = await box(explorer) + expect(Math.round(card.x - (side.x + side.width))).toBe(gutter) + expect(Math.round(card.y)).toBe(Math.round(side.y)) + expect(Math.round(1440 - (card.x + card.width))).toBe(gutter) + expect(Math.round((await box(panel)).y - (card.y + card.height))).toBe(gutter) + // The renderer's frame and the summary bar stay inside the card. + for (const inside of [view.locator('iframe').first(), view.locator('.ph-stage-foot').first()]) { + if (!(await inside.isVisible())) continue + const inner = await box(inside) + expect(inner.x).toBeGreaterThanOrEqual(card.x) + expect(inner.y).toBeGreaterThanOrEqual(card.y) + expect(inner.x + inner.width).toBeLessThanOrEqual(card.x + card.width + 0.5) + expect(inner.y + inner.height).toBeLessThanOrEqual(card.y + card.height + 0.5) + } + // With the sidebar and panel closed, one gutter from the window's edge and the status bar. + await toggle(/^Hide .* sidebar$/u).click() + await toggle(/^Hide panel$/u).click() + await expect(panel).toHaveCount(0) + card = await box(view) + expect(Math.round(card.x)).toBe(gutter) + expect(Math.round((await box(page.locator('.pi-statusbar'))).y - (card.y + card.height))).toBe(gutter) + // At a device width the card is that wide (and its border), centred, with a dashed edge. + await page.getByRole('radiogroup', {name: 'Viewport'}).getByRole('radio', {name: 'Phone'}).click() + await expect(view).toHaveCSS('border-top-style', 'dashed') + card = await box(view) + expect(Math.round(card.width)).toBe(392) + expect(Math.abs(card.x + card.width / 2 - 720)).toBeLessThanOrEqual(1) +}) diff --git a/packages/host/inspector/src/fixtures/workbench/body.tsx b/packages/host/inspector/src/fixtures/workbench/body.tsx index 3ed1b32c6..0934ce242 100644 --- a/packages/host/inspector/src/fixtures/workbench/body.tsx +++ b/packages/host/inspector/src/fixtures/workbench/body.tsx @@ -81,11 +81,10 @@ export function WorkbenchBody({ )} {scenario && subject && ( + // The view is a card on the gutter like the Inspector's, its flat chrome inside; at a device width the card + // narrows to that width, centred, with a dashed edge.
diff --git a/packages/host/inspector/src/styles.css b/packages/host/inspector/src/styles.css index 716bf2737..97de9271e 100644 --- a/packages/host/inspector/src/styles.css +++ b/packages/host/inspector/src/styles.css @@ -30,6 +30,10 @@ body { border-radius: calc(var(--pj-radius) - 2px); background-color: var(--pj-surface-canvas); } +/* The renderer workbench at a tablet or phone width: the view's card is that wide, and its dashed edge says so. */ +.pi-shell .pi-card.pi-viewport:not([data-viewport='desktop']) { + border-style: dashed; +} /* The title bar's three columns: each side wide enough for the wider side's content, so the centre is centred. */ .pi-shell .pi-titlebar-grid { grid-template-columns: minmax(var(--pi-side, 0px), 1fr) minmax(0, auto) minmax(var(--pi-side, 0px), 1fr); From bb1f3a15786aed7ae1189611dc8021b327f48dd0 Mon Sep 17 00:00:00 2001 From: Alex Gorischek Date: Wed, 2 Dec 2026 13:41:50 -0800 Subject: [PATCH 2/5] Fixtures spec: no non-null assertion Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- packages/host/inspector/browser/fixtures.spec.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/host/inspector/browser/fixtures.spec.ts b/packages/host/inspector/browser/fixtures.spec.ts index 8514ad610..12ff107dc 100644 --- a/packages/host/inspector/browser/fixtures.spec.ts +++ b/packages/host/inspector/browser/fixtures.spec.ts @@ -206,7 +206,11 @@ test('the view is a card on the gutter, like the Explorer and the panel', async await page.goto(at(fixtures, 'cases/platform')) await expect(page.locator('.ph[data-mode="comparison"][data-renderer-status="ready"]')).toBeVisible() const gutter = 8 - const box = async (locator: Locator) => (await locator.boundingBox())! + const box = async (locator: Locator) => { + const found = await locator.boundingBox() + if (!found) throw new Error('No box: the element is hidden') + return found + } const look = (locator: Locator) => locator.evaluate(element => { const style = getComputedStyle(element) From cc2cfdb81026a5d00aad92a87eda88ee03368881 Mon Sep 17 00:00:00 2001 From: Alex Gorischek Date: Wed, 2 Dec 2026 13:44:06 -0800 Subject: [PATCH 3/5] Changelog fragment Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- changelog.d/280.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelog.d/280.md diff --git a/changelog.d/280.md b/changelog.d/280.md new file mode 100644 index 000000000..bb08f514d --- /dev/null +++ b/changelog.d/280.md @@ -0,0 +1,5 @@ +--- +section: viewer +--- + +- **The renderer workbench shows the view as a card** (#280). In the fixtures workbench (`projections-renderer-workbench`), the Explorer sidebar and bottom panel were already rounded cards with an 8px gutter, while the view (the stage with its toolbar and the renderer) sat flush against them. Now the view is a card too, with the same radius, border and surface, spaced one gutter from its neighbours. Its toolbar sits flat inside, and the renderer frame and floating summary bar clip to its rounded corners. At the tablet or phone viewport width, the card narrows to that width, centred, with a dashed edge like the old frame. From 52770374a1d5ef83bcf31e797e3097d73fa0d3d7 Mon Sep 17 00:00:00 2001 From: Alex Gorischek Date: Wed, 2 Dec 2026 14:25:03 -0800 Subject: [PATCH 4/5] The view shrinks with its card: no embedded minimum height inside it Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- packages/host/inspector/browser/fixtures.spec.ts | 10 ++++++++++ packages/host/inspector/src/styles.css | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/packages/host/inspector/browser/fixtures.spec.ts b/packages/host/inspector/browser/fixtures.spec.ts index 12ff107dc..65f8a371c 100644 --- a/packages/host/inspector/browser/fixtures.spec.ts +++ b/packages/host/inspector/browser/fixtures.spec.ts @@ -247,6 +247,16 @@ test('the view is a card on the gutter, like the Explorer and the panel', async expect(inner.x + inner.width).toBeLessThanOrEqual(card.x + card.width + 0.5) expect(inner.y + inner.height).toBeLessThanOrEqual(card.y + card.height + 0.5) } + // A panel at its tallest leaves the view short: the view shrinks with its card, its foot (the summary bar) in view. + const handle = page.getByRole('separator', {name: 'Resize panel'}) + await handle.focus() + for (let step = 0; step < 10; step++) await handle.press('Shift+ArrowUp') + await expect.poll(async () => Math.round((await box(panel)).height)).toBe(640) + card = await box(view) + const ph = await box(view.locator('.ph').first()) + expect(ph.y + ph.height).toBeLessThanOrEqual(card.y + card.height + 0.5) + const foot = view.locator('.ph-stage-foot').first() + if (await foot.isVisible()) expect((await box(foot)).y + (await box(foot)).height).toBeLessThanOrEqual(card.y + card.height + 0.5) // With the sidebar and panel closed, one gutter from the window's edge and the status bar. await toggle(/^Hide .* sidebar$/u).click() await toggle(/^Hide panel$/u).click() diff --git a/packages/host/inspector/src/styles.css b/packages/host/inspector/src/styles.css index 97de9271e..f330ca699 100644 --- a/packages/host/inspector/src/styles.css +++ b/packages/host/inspector/src/styles.css @@ -30,6 +30,11 @@ body { border-radius: calc(var(--pj-radius) - 2px); background-color: var(--pj-surface-canvas); } +/* The view fills its card and shrinks with it (a taller panel, a shorter window): the card clips, so a view kept at its + embedded minimum height would lose its foot, the summary bar included, with no way to scroll to it. */ +.pi-shell .pi-view.pi-card > .pj-root.ph[data-fill] { + min-height: 0; +} /* The renderer workbench at a tablet or phone width: the view's card is that wide, and its dashed edge says so. */ .pi-shell .pi-card.pi-viewport:not([data-viewport='desktop']) { border-style: dashed; From 49e42608e7e0013c596837ad9260ede76b79fd69 Mon Sep 17 00:00:00 2001 From: Alex Gorischek Date: Wed, 2 Dec 2026 14:52:45 -0800 Subject: [PATCH 5/5] Fixtures spec: gutter and width from the page, wait for the toggles; say which view is a .pi-viewport Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .../host/inspector/browser/fixtures.spec.ts | 17 ++++++++++++----- packages/host/inspector/src/styles.css | 3 ++- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/packages/host/inspector/browser/fixtures.spec.ts b/packages/host/inspector/browser/fixtures.spec.ts index 65f8a371c..ee133b964 100644 --- a/packages/host/inspector/browser/fixtures.spec.ts +++ b/packages/host/inspector/browser/fixtures.spec.ts @@ -202,10 +202,14 @@ test('fixtures and renderer bundles reload live when their files change', async test('the view is a card on the gutter, like the Explorer and the panel', async ({page, fixtures}, testInfo) => { test.skip(testInfo.project.name !== 'chromium-desktop', 'One project covers the geometry') - await page.setViewportSize({width: 1440, height: 900}) + const width = 1440 + await page.setViewportSize({width, height: 900}) await page.goto(at(fixtures, 'cases/platform')) await expect(page.locator('.ph[data-mode="comparison"][data-renderer-status="ready"]')).toBeVisible() - const gutter = 8 + const gutter = await page + .locator('.pi-shell') + .evaluate(element => Number.parseFloat(getComputedStyle(element).getPropertyValue('--pi-gutter'))) + expect(gutter).toBeGreaterThan(0) const box = async (locator: Locator) => { const found = await locator.boundingBox() if (!found) throw new Error('No box: the element is hidden') @@ -226,6 +230,8 @@ test('the view is a card on the gutter, like the Explorer and the panel', async const toggle = (name: RegExp) => page.locator('.pi-titlebar').getByRole('button', {name}) if (!(await explorer.count())) await toggle(/^Show .* sidebar$/u).click() if (!(await panel.count())) await toggle(/^Show panel$/u).click() + await expect(explorer).toBeVisible() + await expect(panel).toBeVisible() // One radius, border and surface, and the view's own chrome flat inside; what it holds is clipped to its corners. expect(await look(view)).toEqual(await look(explorer)) expect(await look(view)).toEqual(await look(panel)) @@ -236,7 +242,7 @@ test('the view is a card on the gutter, like the Explorer and the panel', async const side = await box(explorer) expect(Math.round(card.x - (side.x + side.width))).toBe(gutter) expect(Math.round(card.y)).toBe(Math.round(side.y)) - expect(Math.round(1440 - (card.x + card.width))).toBe(gutter) + expect(Math.round(width - (card.x + card.width))).toBe(gutter) expect(Math.round((await box(panel)).y - (card.y + card.height))).toBe(gutter) // The renderer's frame and the summary bar stay inside the card. for (const inside of [view.locator('iframe').first(), view.locator('.ph-stage-foot').first()]) { @@ -260,6 +266,7 @@ test('the view is a card on the gutter, like the Explorer and the panel', async // With the sidebar and panel closed, one gutter from the window's edge and the status bar. await toggle(/^Hide .* sidebar$/u).click() await toggle(/^Hide panel$/u).click() + await expect(explorer).toHaveCount(0) await expect(panel).toHaveCount(0) card = await box(view) expect(Math.round(card.x)).toBe(gutter) @@ -268,6 +275,6 @@ test('the view is a card on the gutter, like the Explorer and the panel', async await page.getByRole('radiogroup', {name: 'Viewport'}).getByRole('radio', {name: 'Phone'}).click() await expect(view).toHaveCSS('border-top-style', 'dashed') card = await box(view) - expect(Math.round(card.width)).toBe(392) - expect(Math.abs(card.x + card.width / 2 - 720)).toBeLessThanOrEqual(1) + expect(Math.round(card.width)).toBe(390 + 2) + expect(Math.abs(card.x + card.width / 2 - width / 2)).toBeLessThanOrEqual(1) }) diff --git a/packages/host/inspector/src/styles.css b/packages/host/inspector/src/styles.css index f330ca699..2e45a3ee8 100644 --- a/packages/host/inspector/src/styles.css +++ b/packages/host/inspector/src/styles.css @@ -35,7 +35,8 @@ body { .pi-shell .pi-view.pi-card > .pj-root.ph[data-fill] { min-height: 0; } -/* The renderer workbench at a tablet or phone width: the view's card is that wide, and its dashed edge says so. */ +/* The renderer workbench's view (only it is a `.pi-viewport`) at a tablet or phone width: the card is that wide, and + its dashed edge says so. */ .pi-shell .pi-card.pi-viewport:not([data-viewport='desktop']) { border-style: dashed; }