Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog.d/417-behaviour-changes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
section: behaviour-changes
---

- **`neutral-endpoints` and `quiet-endpoints` run only in animated mode, and a new `pane-marks` check holds side-by-side panes** (#417). A renderer without animated mode now skips both endpoint checks, since a held pane is a static comparison. `status-text` expects Before to name its removals and changes, and After its additions and changes; before, Before was only expected to name removals. The new `pane-marks` check loads each held pane with highlighting. It fails when Before marks something added or After something removed, or when a changed card's border and the band behind its status words aren't in the same hue, such as a tinted band on a neutral border. A custom renderer that draws its own cards can fail it. The kit's `EntityCard` and graph cards pass.
5 changes: 5 additions & 0 deletions changelog.d/417.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
section: renderer-authors
---

- **A side-by-side or swipe pane marks only its side's changes, with the diff's vocabulary** (#417). Before marks removed and modified items, After added and modified ones, and unchanged items are neutral in both. `props.emphasis(row)` in a held pane is the host's highlighting for a change on its side and 0 for the other side's (`paneShows`, `paneChange`). The kit's components read the held pane (`useHeldPane`, and `data-pane` on the `.pk` root): `EntityCard` draws a changed card as a change region in every mode, with its border, tint and band in its change's hue rather than a leading stripe; and `ValueMark`, `ValueList`, `Fact`, `ValueChange`, `ValueText`, `SvgValueChange`, `Chip` and `MatrixGrid` show only the pane's own value in its change's hue (a modified value in the modified hue in both panes), with no sign and no strikethrough, whatever `sign` says. Pass them the same `change`, `sign` and `emphasis` in every mode, and drop special cases such as `sign={side === 'diff'}` or tinting a pane only while emphasized. See [Comparison modes](docs/guides/change-emphasis.md#comparison-modes).
68 changes: 50 additions & 18 deletions docs/guides/change-emphasis.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,42 @@
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
The 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.
- **Neutral endpoints** (`neutral-endpoints`): in animated mode, 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. Only the animated transition has endpoints: a renderer
without animated mode skips it.
- **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).
renderer with side by side but no animation, in each pane (Before names its
removals and changes, After its additions and changes).
- **Each pane marks its own side** (`pane-marks`): in side by side and swipe,
each pane marks only its side's changes, and a changed card's border, band and
tint share one hue (see [Comparison modes](#comparison-modes)).
- **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: 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; 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.
and in a held side-by-side or swipe pane the host's highlighting for the
changes on its side (`paneShows`) and 0 for the other side's. 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. A held
pane gets the host's highlighting, 1 unless the person turned it off. Use it
everywhere: in the diff, the transition and the panes.
2. **Don't special-case panes.** Pass the kit's components the same `change`,
`sign` and `emphasis` in every mode: in a held pane they mark only the pane's
side, and draw values without signs or strikethrough (see
[Comparison modes](#comparison-modes)). A renderer that draws its own marks
reads the pane from `props.pane` and filters with `paneChange`.
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
Expand Down Expand Up @@ -100,6 +105,33 @@ function Pill({props, row}: {props: RendererProps; row: Row}) {
}
```

## Comparison modes

One vocabulary of change serves every mode: a changed card has its status
border, status band and tint in its change's hue (`EntityCard` and the graph
cards are change regions, `pk-region`, in every mode), and a changed value is in
its change's hue (`ValueMark`, `ValueList`, `Fact`, `ValueChange`, `Chip`). A
green card means added everywhere. The modes differ in what they mark and how a
value reads:

- **Diff**: every change. A changed value reads `old → new`, with signs (`+`,
`−`, `~`) and the old value struck through.
- **Side by side** and **swipe**: each pane marks only its side's changes.
Before marks removed and modified items, After added and modified ones, and
unchanged items are neutral in both, so a removed item is marked only in
Before and an added one only in After. A changed value shows only its side's
value, highlighted in the change's hue, with no sign and nothing struck
through. A pane is a static comparison, so the neutral endpoints don't apply
to it.
- **Animated**: each change while its step plays, as the diff draws it, fading
with the step's emphasis to neutral at progress 0 and 1.

The kit does this from the held pane the shell provides (`HeldPane`, read with
`useHeldPane`): `stepEmphasis` gives the other side's changes no emphasis, and
the value components show the pane's own value in its hue. Containers that hold
changes stay neutral in every mode (the `nested-accents` rule), and no sign is
drawn in a held pane, a chip's included, whatever `sign` says.

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 <id> --scenario <id> --only neutral-endpoints`.
35 changes: 32 additions & 3 deletions docs/guides/develop-a-renderer.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,30 @@ kit's [diff mode helpers](renderer-kit.md#diff-mode) (`diffModel`, `changeMark`,
and `ValueChange`), then layer side-by-side and animated modes on top of the
same view.

### Comparison modes

Every mode speaks one vocabulary of change, drawn by the same kit primitives: a
changed card's status border, its status band and its tint (`EntityCard`, a
graph card, `pk-region`), and a changed value's hue (`ValueMark`, `ValueList`,
`Fact`). A green card means added in every mode. The modes differ only in which
changes they mark and how they show a value:

- **Diff** marks every change, and shows a changed value as `old → new`, with
signs and the old value struck through.
- **Side by side** (and swipe) marks in each pane only its own side's changes:
Before its removed and modified items, After its added and modified ones;
unchanged items are neutral in both. A changed value shows only its side's
value, in the change's hue, with no sign and no strikethrough.
- **Animated** marks each change while its step plays, as the diff draws it, and
nothing at progress 0 and 1: its endpoints are neutral.

The neutral endpoints apply only to the animated transition. A held pane is a
static comparison of its revision, so it never goes neutral. The kit's
components read the held pane (`RendererProps.pane`, or `useHeldPane`) and draw
it this way, so pass them the same `change`, `sign` and `emphasis`
(`props.emphasis(row)`) in every mode rather than special-casing panes. See
[change emphasis](change-emphasis.md#comparison-modes).

Skip drawing your own summary line. The host's summary bar already counts each
kind and its changes using the domain vocabulary and facts you provide via
`nouns` and `facts` (see the kit's
Expand Down Expand Up @@ -213,9 +237,14 @@ what broke and where), or skipped:
identical to an unchanged comparison of After, and nothing may be clipped at
either full or phone width. Affordances, selection, status text, and layout
stability are verified in diff mode as well.
- **Neutral endpoints** — At progress 0 and 1, nothing should be emphasized.
Every entity should look the same as it would in an unchanged comparison of
that revision.
- **Neutral endpoints** — In animated mode, at progress 0 and 1, nothing should
be emphasized. Every entity should look the same as it would in an unchanged
comparison of that revision. A renderer without animated mode skips it: its
panes are static comparisons.
- **Each pane marks its own side's changes** — In side by side (and swipe),
Before marks only its removals and changes and After only its additions and
changes, and a changed card's border, band and tint share its change's hue, as
in the diff: never a tinted band on a neutral border.
- **No motion inside step holds** — Around every hold you report via
`client.steps(ends)`, nothing should move or fade while progress remains in
that hold.
Expand Down
Loading
Loading