Repository navigation
Renderers: concentric nested radii, and a group's border stays whole around its corners - #82
agorischek wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The corner checks can falsely fail correctly rendered elements by replacing valid zero CSS radii with SVG attribute values and using unscaled radii and border widths for transformed HTML targets.
2 open issues
What changed in this PR
This PR refines rounded borders across the renderer kit and built-in renderers, building on the earlier one-line-per-boundary changes. It keeps nested fills and change outlines concentric with their containers.
Changes:
- Adjust group clipping, header radii and text-diff bottom corners to preserve border thickness.
- Align graph change outlines and status bands with each card’s rounded shape.
- Add screenshot-based corner measurements, browser regression tests and documentation.
| File | Description |
|---|---|
packages/renderers/text-diff/src/styles.css |
Round scrolling bodies and final rows to match their cards. |
packages/renderers/testing/README.md |
Document the corner measurement helper and its limits. |
packages/renderers/testing/playwright/index.ts |
Export corner testing helpers. |
packages/renderers/testing/playwright/corners/analyze.ts |
Analyze border thickness and stray paint from corner screenshots. |
packages/renderers/testing/playwright/corners.ts |
Capture corner geometry and screenshots, then report failures. |
packages/renderers/kit/styles/layout.css |
Add inner radii and supported overflow clipping for groups. |
packages/renderers/kit/styles/graph.css |
Make change outlines concentric and define card clipping radii. |
packages/renderers/kit/src/react/graph-canvas/group-node.tsx |
Reduce the fallback outline radius by its inset. |
packages/renderers/kit/src/react/graph-canvas/cards.tsx |
Remove the fixed-radius footer path helper. |
packages/renderers/kit/src/react/graph-canvas/card-change.tsx |
Clip status bands to card shapes and adjust outline radii. |
packages/renderers/harness/browser/corners.spec.ts |
Add representative light/dark checks and a negative regression case. |
docs/reference/renderer-kit.md |
Update API descriptions for card radii and clipping. |
docs/guides/renderer-kit-components.md |
Explain group clipping and concentric inner corners. |
Review effort: Balanced
|
The Operations CLI card the user saw on :4395 (storefront-platform Tables (0d82f6e). |
…ole around its corners A group's header band was square, so it covered the inside of the border's top curve, where the border thinned to nothing (the runtime-policy Network card on the blog). It takes the group's inner radius now (--pk-group-inner-radius, the radius less the border), as a renderer's last row or band does at the bottom: text diff's last line and its scrolling body follow the card's curve, so a changed line's edge turns the corner with it. The group clips with overflow: clip and the border's width as its margin where the browser has that margin: the clip-path wasn't snapped to whole pixels as the border is, and cut off half the bottom border of a group with a fractional height. WebKit keeps the clip-path. Graph and DI cards: the change edge's CSS radius is the card's less its inset, concentric with the card's border, and the status band is clipped to the card's own shape rather than drawn with a fixed 6-unit radius under an 8-px card, which poked out past its corners. cornerReport (renderer testing) measures a box's corners in pixels: the border's thickness around each curve against its sides, a third colour in it, and paint outside the curve. The harness checks representative cards with it, in both engines and both color modes. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…s on the box Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…nd hovered cornerBox reads an element's solid outline where it has no border (a database card's inset edge), and takes the width of a frame its contents draw (a data table's scroll box, whose heading and rows draw its lines). The harness checks a data table's frame and a database card's corners at rest and with their first and bottom rows selected and hovered, light and dark, and that a data table's square heading is caught. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
7051884 to
00cf737
Compare



The user, about the runtime-policy Network card on the blog: "We need to be more careful about our border radii."
Each crop is a corner at 4× (2× device scale, enlarged), light and dark, before and after.
What was wrong, and the fix
A group's header band covered its border's curve. The band had square corners. Since #61, a group clips at its outer edge, so its children aren't clipped inside the border, and the band painted over the inside of the border's curve. The border thinned to about 0.1 px at 45°. The band now takes the group's inner radius (
--pk-group-inner-radius: the radius less the border), so it's concentric with the border.A change run at a group's bottom corner lost its edge around the curve. Text diff's last changed line and its scrolling body had square corners. The group's curve cut the run's edge off, so no border showed around the corner. The body's bottom corners are now the card's own, so it clips to the card's curve. The last line, each side of a split pair, and the gutter take the inner radius.
A group with a fractional height lost half its bottom border. The browser snaps a border to whole pixels, but it doesn't snap a
clip-path. Where the browser supportsoverflow-clip-margin, a group now clips withoverflow: clipand the border's width as its margin. That's the same outer edge, snapped together with the border. WebKit lacks the margin and keeps theclip-path.Graph and DI change cards weren't concentric. CSS sets the cards'
rxto the theme radius (8), which overrides the kit's 6-unit attributes. Two things followed:Now the change edge's radius is the card's less its inset, and the band is clipped to the card's own CSS-rounded shape (
node-card-shape).The corner check
cornerReport(page, target)in@githubnext/projections-renderer-testing/playwright(documented in the testing README under "Corners in pixels") measures a box's corners from screenshots, not from box metrics. It walks rays across each curve and sorts every pixel by its fit to the outside, the border and the inside colour. It fails when:It finds each side where it's actually painted, so whole-pixel snapping doesn't skew it, and it scrolls a tall box so both pairs of corners get measured. It takes an element or a stroked SVG
rect, and skips dashed outlines.harness/browser/corners.spec.tsuses it on four representative corners (the runtime-policy panel, the text-diff group, the agentic-workflows group and a DI change card), in light and dark, in Chromium and WebKit. A negative case restores the square header and confirms the report catches it.Audit
I ran the check, at 4×, on every bordered rounded element (up to three per class) in every built-in scenario, light and dark.
database-tag, where the status tab hangs under the tag's corner by design (Kit StatusTab: joined at its tag's left, flush with a tag no wider than it #55);The graph canvas is also rasterized below the device scale, so its strokes measure soft, and the representative spec uses crisp content. The
apirenderer is untouched, because the Changes work owns it.Checks
tools check --fastcorners.specin Chromium and WebKit