From 13a2503f296c21b6047c1b36135c391c446c3c33 Mon Sep 17 00:00:00 2001 From: Alex Gorischek Date: Mon, 30 Nov 2026 20:37:54 -0800 Subject: [PATCH 1/3] Renderer kit guide: change emphasis and the checks, a recipe Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- docs/guides/renderer-kit.md | 73 +++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/docs/guides/renderer-kit.md b/docs/guides/renderer-kit.md index 42195f46..35461610 100644 --- a/docs/guides/renderer-kit.md +++ b/docs/guides/renderer-kit.md @@ -323,6 +323,79 @@ Two companion pages cover the rest of the kit: - [Renderer kit components](renderer-kit-components.md) covers presentation helpers, item rings, layout primitives, and data tables. +## Change emphasis and the checks + +Three renderer checks read how an item shows its change, and they pull in +different directions until you see the one rule behind them: **each item has one +emphasis, between 0 and 1, and everything that shows its change (color, status +words, a status tab) follows it.** + +- **Neutral endpoints** (`neutral-endpoints`): at progress 0 and 1 every item is + painted exactly as in an unchanged comparison of that revision. The check + compares every painted part of the item, so an extra empty element counts too. +- **Change status as text** (`status-text`): with highlighting on, every change + is named in words: in the diff; after each step when animated; and, for a + renderer with side by side but no animation, at progress 0 (Before names + removals) and 1 (After names additions and changes). +- **No layout shift** (`stable-layout`): turning highlighting on or off moves or + resizes nothing, in the diff and through the transition. + +The recipe: + +1. **Take the emphasis from the shell.** `props.emphasis(row, id)` is the + step-scoped emphasis: 0 at both endpoints of the animation, the host's + highlighting once a change's step begins, and the host's highlighting + directly in a held side-by-side or swipe pane. Use it in the diff and, if the + renderer animates, everywhere. +2. **Without animated mode, use `presentedEmphasis` outside the diff.** The + checks present a side-by-side-only renderer's two panes as progress 0 and 1 + with highlighting on, so its Before must name removals at progress 0, where a + step-scoped emphasis is still 0. `presentedEmphasis(row, props.highlighting)` + is the host's highlighting for every changed row; at the endpoints of a plain + load the host's highlighting is 0, so the item stays neutral there. The + built-in `api`, `agentic-workflows` and `runtime-policy` renderers do this. +3. **Show status only above 0.01, in room that is always there.** Draw status + words and tabs only when the emphasis is above 0.01 (the kit's components + already do). Reserve their room for every item alike, changed or not, so + showing them moves nothing. Mount a `StatusTab` in every pill, as the + `database` renderer's tags do, and let it draw nothing at 0, never only in + changed pills: its room (`.pk-status-tab-room`) is part of what the pill + paints, so mounting it only where something changed makes an endpoint differ + from an unchanged comparison. +4. **Let emphasis change paint, never boxes.** Fade color and words with it (the + kit's `--emphasis` custom property on the item, `edgePaint` for lines); keep + borders, padding and sizes the same at every emphasis. + +```tsx +import type {Entity} from '@githubnext/projections/schemas' +import type {EntityChange} from '@githubnext/projections/renderer' +import {isChanged, presentedEmphasis} from '@githubnext/projections/kit' +import {StatusTab, type RendererProps} from '@githubnext/projections/kit/react' + +type Row = EntityChange & {label: string} + +// This renderer declares comparisonModes: ['diff', 'side-by-side'], no animated. +function emphasisOf(props: RendererProps, row: Row): number { + if (!props.comparing || !isChanged(row)) return 0 + return props.diff ? props.emphasis(row, row.id) : presentedEmphasis(row, props.highlighting) +} + +function Pill({props, row}: {props: RendererProps; row: Row}) { + const emphasis = emphasisOf(props, row) + return ( + + ) +} +``` + +When `neutral-endpoints` fails, its message names the property that changed, or +the part one side draws and the other doesn't. Run just that check while you fix +it: `projections check -p --scenario --only neutral-endpoints`. + ## Diff mode In diff mode (`props.diff`), your renderer draws a single static comparison: one From 2c3ea03bb7bae38b53b4f8634391dce9fa336bc8 Mon Sep 17 00:00:00 2001 From: Alex Gorischek Date: Mon, 30 Nov 2026 20:39:03 -0800 Subject: [PATCH 2/3] Change emphasis recipe on its own page, linked from the kit and renderer guides Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- docs/README.md | 3 +- docs/guides/change-emphasis.md | 75 ++++++++++++++++++++++++++++++ docs/guides/develop-a-renderer.md | 4 ++ docs/guides/renderer-kit.md | 77 +------------------------------ 4 files changed, 83 insertions(+), 76 deletions(-) create mode 100644 docs/guides/change-emphasis.md diff --git a/docs/README.md b/docs/README.md index 22215e25..86aeab4a 100644 --- a/docs/README.md +++ b/docs/README.md @@ -55,7 +55,8 @@ the same tasks: [explore](agents/explore.md), [install](agents/install.md), [develop a renderer](guides/develop-a-renderer.md), the [renderer kit guide](guides/renderer-kit.md) (including [graphs](guides/renderer-kit-graphs.md) and - [components](guides/renderer-kit-components.md)), and the + [components](guides/renderer-kit-components.md) and + [change emphasis](guides/change-emphasis.md)), and the [renderer SDK guide](guides/renderer-sdk.md). When you need API details, check the [renderer kit API](reference/renderer-kit.md), the [renderer SDK API](reference/renderer-sdk.md), diff --git a/docs/guides/change-emphasis.md b/docs/guides/change-emphasis.md new file mode 100644 index 00000000..2b435568 --- /dev/null +++ b/docs/guides/change-emphasis.md @@ -0,0 +1,75 @@ +# Change emphasis and the checks + +How a renderer shows each item's change so that the renderer checks agree with +it. It assumes the [renderer kit](renderer-kit.md). + +Three renderer checks read how an item shows its change, and they pull in +different directions until you see the one rule behind them: **each item has one +emphasis, between 0 and 1, and everything that shows its change (color, status +words, a status tab) follows it.** + +- **Neutral endpoints** (`neutral-endpoints`): at progress 0 and 1 every item is + painted exactly as in an unchanged comparison of that revision. The check + compares every painted part of the item, so an extra empty element counts too. +- **Change status as text** (`status-text`): with highlighting on, every change + is named in words: in the diff; after each step when animated; and, for a + renderer with side by side but no animation, at progress 0 (Before names + removals) and 1 (After names additions and changes). +- **No layout shift** (`stable-layout`): turning highlighting on or off moves or + resizes nothing, in the diff and through the transition. + +The recipe: + +1. **Take the emphasis from the shell.** `props.emphasis(row, id)` is the + step-scoped emphasis: 0 at both endpoints of the animation, the host's + highlighting once a change's step begins, and the host's highlighting + directly in a held side-by-side or swipe pane. Use it in the diff and, if the + renderer animates, everywhere. +2. **Without animated mode, use `presentedEmphasis` outside the diff.** The + checks present a side-by-side-only renderer's two panes as progress 0 and 1 + with highlighting on, so its Before must name removals at progress 0, where a + step-scoped emphasis is still 0. `presentedEmphasis(row, props.highlighting)` + is the host's highlighting for every changed row; at the endpoints of a plain + load the host's highlighting is 0, so the item stays neutral there. The + built-in `api`, `agentic-workflows` and `runtime-policy` renderers do this. +3. **Show status only above 0.01, in room that is always there.** Draw status + words and tabs only when the emphasis is above 0.01 (the kit's components + already do). Reserve their room for every item alike, changed or not, so + showing them moves nothing. Mount a `StatusTab` in every pill, as the + `database` renderer's tags do, and let it draw nothing at 0, never only in + changed pills: its room (`.pk-status-tab-room`) is part of what the pill + paints, so mounting it only where something changed makes an endpoint differ + from an unchanged comparison. +4. **Let emphasis change paint, never boxes.** Fade color and words with it (the + kit's `--emphasis` custom property on the item, `edgePaint` for lines); keep + borders, padding and sizes the same at every emphasis. + +```tsx +import type {Entity} from '@githubnext/projections/schemas' +import type {EntityChange} from '@githubnext/projections/renderer' +import {isChanged, presentedEmphasis} from '@githubnext/projections/kit' +import {StatusTab, type RendererProps} from '@githubnext/projections/kit/react' + +type Row = EntityChange & {label: string} + +// This renderer declares comparisonModes: ['diff', 'side-by-side'], no animated. +function emphasisOf(props: RendererProps, row: Row): number { + if (!props.comparing || !isChanged(row)) return 0 + return props.diff ? props.emphasis(row, row.id) : presentedEmphasis(row, props.highlighting) +} + +function Pill({props, row}: {props: RendererProps; row: Row}) { + const emphasis = emphasisOf(props, row) + return ( + + ) +} +``` + +When `neutral-endpoints` fails, its message names the property that changed, or +the part one side draws and the other doesn't. Run just that check while you fix +it: `projections check -p --scenario --only neutral-endpoints`. diff --git a/docs/guides/develop-a-renderer.md b/docs/guides/develop-a-renderer.md index 9283409e..df0b8c00 100644 --- a/docs/guides/develop-a-renderer.md +++ b/docs/guides/develop-a-renderer.md @@ -279,6 +279,10 @@ These checks work on any renderer that marks entities with `data-entity-id` and units with `data-projections-unit`, which the SDK's interaction helpers add for you. +Neutral endpoints, change status as text and no layout shift all read how an +item shows its change; [Change emphasis and the checks](change-emphasis.md) is +the recipe that passes all three. + ## 4. Test it in CI You can run the exact same checks in Playwright inside the real host frame using diff --git a/docs/guides/renderer-kit.md b/docs/guides/renderer-kit.md index 35461610..0a9440c2 100644 --- a/docs/guides/renderer-kit.md +++ b/docs/guides/renderer-kit.md @@ -117,8 +117,8 @@ via `client.error`), and passes `RendererProps` to your component: - `progress`, `highlighting`, and `direction` — Current host playback position (single extractions pass 1, 0, 1). - `emphasis(row, id?)` — Change emphasis for a row (`stepEmphasis`): 0 until its - own step begins, then the host's highlighting (or the host's highlighting - directly inside a held pane). + step begins, then the host's highlighting (directly, in a held pane); see + [change emphasis](change-emphasis.md) for the recipe the checks hold it to. - `schedule` — Comparison steps mapped onto the progress axis for the active direction. - `rendererName` — `init.projection.renderer`, useful when one bundle serves @@ -323,79 +323,6 @@ Two companion pages cover the rest of the kit: - [Renderer kit components](renderer-kit-components.md) covers presentation helpers, item rings, layout primitives, and data tables. -## Change emphasis and the checks - -Three renderer checks read how an item shows its change, and they pull in -different directions until you see the one rule behind them: **each item has one -emphasis, between 0 and 1, and everything that shows its change (color, status -words, a status tab) follows it.** - -- **Neutral endpoints** (`neutral-endpoints`): at progress 0 and 1 every item is - painted exactly as in an unchanged comparison of that revision. The check - compares every painted part of the item, so an extra empty element counts too. -- **Change status as text** (`status-text`): with highlighting on, every change - is named in words: in the diff; after each step when animated; and, for a - renderer with side by side but no animation, at progress 0 (Before names - removals) and 1 (After names additions and changes). -- **No layout shift** (`stable-layout`): turning highlighting on or off moves or - resizes nothing, in the diff and through the transition. - -The recipe: - -1. **Take the emphasis from the shell.** `props.emphasis(row, id)` is the - step-scoped emphasis: 0 at both endpoints of the animation, the host's - highlighting once a change's step begins, and the host's highlighting - directly in a held side-by-side or swipe pane. Use it in the diff and, if the - renderer animates, everywhere. -2. **Without animated mode, use `presentedEmphasis` outside the diff.** The - checks present a side-by-side-only renderer's two panes as progress 0 and 1 - with highlighting on, so its Before must name removals at progress 0, where a - step-scoped emphasis is still 0. `presentedEmphasis(row, props.highlighting)` - is the host's highlighting for every changed row; at the endpoints of a plain - load the host's highlighting is 0, so the item stays neutral there. The - built-in `api`, `agentic-workflows` and `runtime-policy` renderers do this. -3. **Show status only above 0.01, in room that is always there.** Draw status - words and tabs only when the emphasis is above 0.01 (the kit's components - already do). Reserve their room for every item alike, changed or not, so - showing them moves nothing. Mount a `StatusTab` in every pill, as the - `database` renderer's tags do, and let it draw nothing at 0, never only in - changed pills: its room (`.pk-status-tab-room`) is part of what the pill - paints, so mounting it only where something changed makes an endpoint differ - from an unchanged comparison. -4. **Let emphasis change paint, never boxes.** Fade color and words with it (the - kit's `--emphasis` custom property on the item, `edgePaint` for lines); keep - borders, padding and sizes the same at every emphasis. - -```tsx -import type {Entity} from '@githubnext/projections/schemas' -import type {EntityChange} from '@githubnext/projections/renderer' -import {isChanged, presentedEmphasis} from '@githubnext/projections/kit' -import {StatusTab, type RendererProps} from '@githubnext/projections/kit/react' - -type Row = EntityChange & {label: string} - -// This renderer declares comparisonModes: ['diff', 'side-by-side'], no animated. -function emphasisOf(props: RendererProps, row: Row): number { - if (!props.comparing || !isChanged(row)) return 0 - return props.diff ? props.emphasis(row, row.id) : presentedEmphasis(row, props.highlighting) -} - -function Pill({props, row}: {props: RendererProps; row: Row}) { - const emphasis = emphasisOf(props, row) - return ( - - ) -} -``` - -When `neutral-endpoints` fails, its message names the property that changed, or -the part one side draws and the other doesn't. Run just that check while you fix -it: `projections check -p --scenario --only neutral-endpoints`. - ## Diff mode In diff mode (`props.diff`), your renderer draws a single static comparison: one From a2410e9b0598e4118838adfd23db89d48ce5d1a0 Mon Sep 17 00:00:00 2001 From: Alex Gorischek Date: Mon, 30 Nov 2026 21:08:22 -0800 Subject: [PATCH 3/3] Change emphasis: endpoints are neutral under automatic highlighting; the pill's accessible name and layout Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- docs/guides/change-emphasis.md | 59 ++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 14 deletions(-) diff --git a/docs/guides/change-emphasis.md b/docs/guides/change-emphasis.md index 2b435568..c1cc3fd3 100644 --- a/docs/guides/change-emphasis.md +++ b/docs/guides/change-emphasis.md @@ -21,17 +21,19 @@ words, a status tab) follows it.** The recipe: 1. **Take the emphasis from the shell.** `props.emphasis(row, id)` is the - step-scoped emphasis: 0 at both endpoints of the animation, the host's - highlighting once a change's step begins, and the host's highlighting - directly in a held side-by-side or swipe pane. Use it in the diff and, if the - renderer animates, everywhere. + step-scoped emphasis: the host's highlighting once a change's step begins, + and the host's highlighting directly in a held side-by-side or swipe pane. + With automatic highlighting, the default and what `neutral-endpoints` loads, + the host's highlighting is 0 at both endpoints of the animation, so the + emphasis is too; a person who turns highlighting on sees changes there, as + they asked. Use it in the diff and, if the renderer animates, everywhere. 2. **Without animated mode, use `presentedEmphasis` outside the diff.** The checks present a side-by-side-only renderer's two panes as progress 0 and 1 with highlighting on, so its Before must name removals at progress 0, where a step-scoped emphasis is still 0. `presentedEmphasis(row, props.highlighting)` - is the host's highlighting for every changed row; at the endpoints of a plain - load the host's highlighting is 0, so the item stays neutral there. The - built-in `api`, `agentic-workflows` and `runtime-policy` renderers do this. + is the host's highlighting for every changed row; with automatic highlighting + it is 0 at the endpoints, so the item stays neutral there. The built-in + `api`, `agentic-workflows` and `runtime-policy` renderers do this. 3. **Show status only above 0.01, in room that is always there.** Draw status words and tabs only when the emphasis is above 0.01 (the kit's components already do). Reserve their room for every item alike, changed or not, so @@ -39,7 +41,13 @@ The recipe: `database` renderer's tags do, and let it draw nothing at 0, never only in changed pills: its room (`.pk-status-tab-room`) is part of what the pill paints, so mounting it only where something changed makes an endpoint differ - from an unchanged comparison. + from an unchanged comparison. The tab hangs below the pill, so the pill is + positioned (`position: relative`) and every pill has room below it as tall as + `--pk-tab-height`, and is at least as wide as its tab (`StatusTab`'s + `measure` draws it at full width for measuring). The `database` renderer's + tags (`packages/renderers/database/src/tags.tsx`) measure and lay them out + this way. The tab is hidden from assistive technology, so the pill's + accessible name says its status too, at the same emphasis. 4. **Let emphasis change paint, never boxes.** Fade color and words with it (the kit's `--emphasis` custom property on the item, `edgePaint` for lines); keep borders, padding and sizes the same at every emphasis. @@ -47,7 +55,7 @@ The recipe: ```tsx import type {Entity} from '@githubnext/projections/schemas' import type {EntityChange} from '@githubnext/projections/renderer' -import {isChanged, presentedEmphasis} from '@githubnext/projections/kit' +import {describeChange, isChanged, presentedEmphasis} from '@githubnext/projections/kit' import {StatusTab, type RendererProps} from '@githubnext/projections/kit/react' type Row = EntityChange & {label: string} @@ -61,15 +69,38 @@ function emphasisOf(props: RendererProps, row: Row): number { function Pill({props, row}: {props: RendererProps; row: Row}) { const emphasis = emphasisOf(props, row) return ( - +
+ +
) } ``` +```css +/* Each pill keeps room for its tab below it, changed or not, so nothing moves when status appears. */ +.my-pill-slot { + display: flex; + flex-direction: column; +} +.my-pill-slot::after { + content: ''; + height: calc(var(--pk-tab-height) - var(--projections-border-width)); +} +/* The tab hangs off the pill. */ +.my-pill { + position: relative; +} +``` + When `neutral-endpoints` fails, its message names the property that changed, or the part one side draws and the other doesn't. Run just that check while you fix it: `projections check -p --scenario --only neutral-endpoints`.