diff --git a/changelog.d/417-behaviour-changes.md b/changelog.d/417-behaviour-changes.md new file mode 100644 index 000000000..cf7da5e2c --- /dev/null +++ b/changelog.d/417-behaviour-changes.md @@ -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. diff --git a/changelog.d/417.md b/changelog.d/417.md new file mode 100644 index 000000000..8d1dfdb93 --- /dev/null +++ b/changelog.d/417.md @@ -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). diff --git a/docs/guides/change-emphasis.md b/docs/guides/change-emphasis.md index 52085a34a..3daf20265 100644 --- a/docs/guides/change-emphasis.md +++ b/docs/guides/change-emphasis.md @@ -3,18 +3,23 @@ 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. @@ -22,18 +27,18 @@ 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 @@ -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 --scenario --only neutral-endpoints`. diff --git a/docs/guides/develop-a-renderer.md b/docs/guides/develop-a-renderer.md index aedbddb9b..5c7d7edbc 100644 --- a/docs/guides/develop-a-renderer.md +++ b/docs/guides/develop-a-renderer.md @@ -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 @@ -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. diff --git a/docs/reference/renderer-kit.md b/docs/reference/renderer-kit.md index 0f8f8f29a..7de69e122 100644 --- a/docs/reference/renderer-kit.md +++ b/docs/reference/renderer-kit.md @@ -2430,6 +2430,32 @@ How `categoryPalette` assigns colors beyond its defaults. | `distinct` | `"distinct"?: false \| true` | Choose each free slot to be as far as possible from every color already used (OKLab, in both themes), rather than by its preferred slot: for categories with no conventional color, such as entity kinds, so no two look alike. | | `pinned` | `"pinned"?: ReadonlyMap` | Categories whose color is set (a definition's kind colors), by key: they keep it, and the rest keep clear of it. | +### `Pane` + +```ts +type Pane = "after" | "before" +``` + +One held pane of side by side or swipe (`RendererProps.pane`): the revision it shows. + +### `paneChange` + +```ts +paneChange(change: C, pane: "after" | "before" | undefined): "unchanged" | C +``` + +The change a value or item shows in a held pane (`paneShows`), else unchanged; outside a pane, its own change. + +### `paneShows` + +```ts +paneShows(change: "added" | "modified" | "removed" | "renamed" | "unchanged" | { "renamed"?: false | true | undefined; "status": ChangeStatus; "varied"?: Array | undefined }, pane: Pane): false | true +``` + +Whether a held pane marks a change: each pane marks only the changes on its side. Before marks what was removed, +changed or renamed; After what was added, changed or renamed. Nothing else is marked, and unchanged items are neutral +in both, so a removed item is marked only in Before and an added one only in After. + ### `parseStageCover` ```ts @@ -3300,9 +3326,10 @@ it), rises over the start of the window, then follows the host's highlighting, which is exactly 0 at both endpoints. Earlier steps never pre-tint later changes. Rows no step places use the host's highlighting. A held pane of side by side or swipe (`pane`) is a static comparison, not a -moment of the transition: every change it shows follows the host's -highlighting alike, so Before marks its removals as After marks its -additions. +moment of the transition, so the neutral endpoints of the animation don't +apply to it: every change on its side (`paneShows`) follows the host's +highlighting alike, so Before marks its removals and changes as After marks +its additions and changes, and the other side's changes show none. ### `stepEnds` @@ -4105,7 +4132,8 @@ Chip(__0: ChipProps): Element One small item as a pill: an optional category dot, its label (monospace by default) and trailing content, in a neutral edge. A changed chip is painted in its change's hue (fading with `emphasis`), struck through when removed, and can carry its sign and a status tab; assistive technology hears its change in words. With `id` and `onSelect` -it is a button that selects the item. +it is a button that selects the item. In a held pane it is painted only for its side's changes (`paneShows`), with +no sign and nothing struck through. ### `ChipProps` @@ -4130,7 +4158,7 @@ Props of `Chip`. | `onSelect` | `"onSelect"?: undefined \| { (id: string): void }` | Selects the chip's item (`RendererProps.onSelect`). | | `paint` | `"paint"?: false \| true \| undefined` | Paints the change: the chip's edge and fill in its hue (the default). Turn it off for a chip that arrives or leaves with an item already marked around it, so change colors never nest; its sign and words still say it. | | `selected` | `"selected"?: false \| true \| undefined` | Whether the host has selected the chip's item (`RendererProps.selectedId`). | -| `sign` | `"sign"?: false \| true \| undefined` | Puts the change's sign (`+`, `−`, `~`) before the label, as a diff does. | +| `sign` | `"sign"?: false \| true \| undefined` | Puts the change's sign (`+`, `−`, `~`) before the label, as a diff does; never in a held pane. | | `status` | `"status"?: undefined \| { "renamed"?: false \| true \| undefined; "status": ChangeStatus; "varied"?: Array \| undefined }` | A status tab hanging under the chip (`StatusTab`), for its change in words; keep its room with ``. The chip reserves the tab's width from `status`, so the chip's width doesn't change as the tab fades in or out. Pass `status` to every chip in a comparison at every progress, including the endpoints: either the item's change row or `{status: 'unchanged'}` (which reserves nothing and shows no tab). Passing `status` only while a change is visible makes the chip narrow when the tab disappears. | | `tone` | `"tone"?: "default" \| "flag" \| "quiet" \| undefined` | How much the chip asks for attention apart from its change (`Tone`). | | `unit` | `"unit"?: false \| true \| undefined` | Marks the chip as a ring unit of its own (`data-projections-unit`), for a chip that is an item. By default a selectable chip is a part (`pk-part`) of the unit around it. | @@ -4294,8 +4322,10 @@ EntityCard(__0: EntityCardProps): Element One entity as a card: a unit the host rings on hover, focus and selection, a button that selects it, its name and identifier, and (given `change`) its change status in words, in a footer band across its bottom whose space is always -reserved, as a graph card's is. In the progress modes its edge takes -the change's hue as the step emphasizes it; in diff mode (`mark`) it is filled and edged like any kit region. +reserved, as a graph card's is. A changed card is a change region in every mode, as a graph card is: its edge, fill +and band in its change's hue. In diff mode (`mark`) at the host's highlighting; in a transition as its step +emphasizes it (`emphasis`, 0 at both endpoints); in a held pane at the host's highlighting, only for a change on its +side (`paneShows`: Before marks removals and changes, After additions and changes). ### `EntityCardProps` @@ -4308,7 +4338,7 @@ Props of `EntityCard`: one entity's card, its selection and its change. | Member | Signature | Description | |---|---|---| | `aside` | `"aside"?: ReactNode` | A muted fact at the end of the card's first line (the `meta` role), such as a timeout ("40 min"). | -| `change` | `"change"?: { "renamed"?: false \| true \| undefined; "status": ChangeStatus }` | The row, for its change status: stated in words in the footer, in proportion to `emphasis`. | +| `change` | `"change"?: { "renamed"?: false \| true \| undefined; "status": ChangeStatus }` | The row, for its change status: stated in words in the footer, and its edge and fill in its hue, in proportion to `emphasis` (in a held pane, only for a change on its side). | | `children` | `"children"?: ReactNode` | Relationships and fields, below the name. | | `emphasis` | `"emphasis"?: number` | The host's emphasis for this change (`props.emphasis(row)`): 0 at both endpoints and before its step. | | `holdsChanges` | `"holdsChanges"?: false \| true` | Changes are drawn inside it that no `data-change` marks (a nested renderer's frame): the card is drawn neutral (`pk-holds-changes`), so change colors never nest. | @@ -4331,7 +4361,8 @@ Fact(__0: { "change"?: ChangeClassification; "children"?: ReactNode; "emphasis"? One row of `Facts`: its label, its value and, optionally, a muted note after the value (`meta`: "and 8 run steps"), so a count or a note sits beside a label rather than alone on a line. A row that arrives or leaves as a whole takes -`change`: its label is marked in the change's hue, struck through when it leaves, and said in words. +`change`: its label is marked in the change's hue, struck through when it leaves, and said in words. In a held pane +it is marked only on its side (`paneShows`), and never struck through. ### `Facts` @@ -4474,7 +4505,7 @@ Everything but the renderer props is optional; the defaults draw every entity as | `detail` | `"detail"?: undefined \| { (entity: Entity): string \| undefined }` | A short code identifier drawn in monospace at the right of a card's kind line, such as a package version. When it differs between revisions, the two crossfade with the card's own step; in the diff, a modified card shows `was → now`, or, when only one revision has a detail, strikes it where it went away and marks it new where it appeared. | | `diff` | `"diff": false \| true` | Whether the host presents this comparison in `diff` mode: one static frame showing both subjects, with no progress (`progress` stays 1 and `schedule` is empty). Draw the renderer's own static comparison; `highlighting` is the host's change emphasis for it (1 unless the host turned highlighting off). | | `direction` | `"direction": -1 \| 1` | The host's playback direction (`ProgressPayload.direction`): 1 toward After, -1 back toward Before. Always 1 for an extraction and in diff mode. `schedule` is already ordered for the direction the transition presents. | -| `emphasis` | `"emphasis": EmphasisOf` | A change's emphasis now: 0 until its comparison step begins, then the host's highlighting; in a held pane, the host's highlighting (see `stepEmphasis`). Pass the row ID as the second argument when the object passed has none. | +| `emphasis` | `"emphasis": EmphasisOf` | A change's emphasis now: 0 until its comparison step begins, then the host's highlighting; in a held pane, the host's highlighting for a change on its side and 0 for the other side's (see `stepEmphasis`). Pass the row ID as the second argument when the object passed has none. | | `environment` | `"environment": RendererEnvironment` | The host's current theme, motion preference, locale and pane: `init`'s, or a later `environment`'s. | | `filtered` | `"filtered"?: false \| true \| undefined` | Whether the host has said what it shows (its filter, and with it the scope). Until it does, every item is drawn, provisionally: a canvas that moves between layouts of the scope doesn't move from that one, so the first scope the host chooses is drawn at once rather than pared down to. Undefined where no host filter is wired (treat it as said). | | `focus` | `"focus"?: undefined \| { "ids": ReadonlySet; "label": string }` | Entity rows to bring forward, for example what depends on the selection: other cards and relationships recede. `label` says what is highlighted, for people who don't see the graph, in a strip under it. Passing `focus`, as `undefined` while nothing is focused, keeps that strip from the start, so a focus never refits the graph. | @@ -4492,7 +4523,7 @@ Everything but the renderer props is optional; the defaults draw every entity as | `onSelect` | `"onSelect": { (id: null \| string): void }` | Selects an item, as the person activating it: activating the selected item again clears the selection, as an `aria-pressed` toggle does, and `null` clears it. The shell also clears the selection when the person clicks the renderer's background, and toggles an item when they click its element anywhere outside a control. | | `options` | `"options": RendererOptions` | The host's latest `options`, such as `showRelationships`; empty until it sends any. | | `orientation` | `"orientation"?: "horizontal" \| "vertical"` | The layers' direction: `vertical` (the default) runs top to bottom, `horizontal` left to right. | -| `pane` | `"pane": "after" \| "before" \| undefined` | Set while this frame is one held pane of side by side or swipe (`RendererEnvironment.pane`): it shows only that revision, which the host labels, so leave out narration of the transition such as step captions. | +| `pane` | `"pane": "after" \| "before" \| undefined` | Set while this frame is one held pane of side by side or swipe (`RendererEnvironment.pane`): it shows only that revision, which the host labels, so leave out narration of the transition such as step captions. A pane is a static comparison that marks only its side's changes (`paneShows`); the kit's components read it (`useHeldPane`). | | `progress` | `"progress": number` | 0 (before) to 1 (after); always 1 for an extraction. | | `prose` | `"prose"?: undefined \| { (entity: Entity): false \| true }` | Cards whose label is human language rather than an identifier (for example a summary card), drawn in sans. | | `reducedMotion` | `"reducedMotion": false \| true` | Whether the person prefers reduced motion: present each frame without decorative movement. | @@ -4562,6 +4593,16 @@ Props of `Group`: only `title` and `children` are required. | `title` | `"title": ReactNode` | What the group holds, in a few words or as a code name. | | `titleFont` | `"titleFont"?: "code" \| "text"` | The title's font: `code` for a title that is code (a command, a kind, a path or another identifier), drawn in the monospace font and marked as an identifier; `text` (the default) for a title in human words, in the UI font. | +### `HeldPane` + +```ts +HeldPane(props: ProviderProps<"after" | "before" | undefined>): ReactNode +``` + +The held pane of side by side or swipe this frame shows (`RendererProps.pane`), undefined in the diff, an animated +transition or a single extraction. The kit's change marks read it, so a pane marks only its side's changes, each +value as that side has it, in its change's hue, with no signs and nothing struck through. + ### `Icon` ```ts @@ -4655,7 +4696,8 @@ A grid over two axes, as a table: the axes' names in its corner (`os × compiler edge, and each cell what `cell(row, column)` returns: by default a small mark that something is there, with its whole name (or `present`) as a tooltip and for assistive technology, so a cell never repeats its headings. A cell with nothing (`null`) is vacant, on the kit's hatch. A value, row, column or cell that arrives or leaves is a kit change region, struck -through when it leaves, fading with `emphasis` (or the item's around it). Leave out `columns` for a single list of +through when it leaves, fading with `emphasis` (or the item's around it); a held pane marks only its side's changes +(`paneShows`), struck through nowhere. Leave out `columns` for a single list of cells along `rows`: down the side, or with `across`, in one row under the values. `caption` names the grid when several stand together (one per further dimension). @@ -4831,7 +4873,7 @@ Everything a kit renderer component receives for one host state. | `declareNouns` | `"declareNouns": { (nouns: Readonly> \| undefined \| { (kind: string, collection: "entities" \| "relationships"): SummaryKindCount \| SummaryNoun \| false \| undefined }): void }` | Names the document's kinds in the host's summary bar, replacing `MountOptions.nouns` (see `useSummaryNouns`). The shell counts every kind and posts the summary itself; without nouns, the host words kinds from their names. | | `diff` | `"diff": false \| true` | Whether the host presents this comparison in `diff` mode: one static frame showing both subjects, with no progress (`progress` stays 1 and `schedule` is empty). Draw the renderer's own static comparison; `highlighting` is the host's change emphasis for it (1 unless the host turned highlighting off). | | `direction` | `"direction": -1 \| 1` | The host's playback direction (`ProgressPayload.direction`): 1 toward After, -1 back toward Before. Always 1 for an extraction and in diff mode. `schedule` is already ordered for the direction the transition presents. | -| `emphasis` | `"emphasis": EmphasisOf` | A change's emphasis now: 0 until its comparison step begins, then the host's highlighting; in a held pane, the host's highlighting (see `stepEmphasis`). Pass the row ID as the second argument when the object passed has none. | +| `emphasis` | `"emphasis": EmphasisOf` | A change's emphasis now: 0 until its comparison step begins, then the host's highlighting; in a held pane, the host's highlighting for a change on its side and 0 for the other side's (see `stepEmphasis`). Pass the row ID as the second argument when the object passed has none. | | `environment` | `"environment": RendererEnvironment` | The host's current theme, motion preference, locale and pane: `init`'s, or a later `environment`'s. | | `filtered` | `"filtered"?: false \| true \| undefined` | Whether the host has said what it shows (its filter, and with it the scope). Until it does, every item is drawn, provisionally: a canvas that moves between layouts of the scope doesn't move from that one, so the first scope the host chooses is drawn at once rather than pared down to. Undefined where no host filter is wired (treat it as said). | | `focusRequest` | `"focusRequest": RendererFocus \| undefined` | Where the host wants the opening view (`InitPayload.focus`), or a comparison's changes while the host shows changes only; undefined for the renderer's own choice. The shell scrolls the first focused item of a list into view itself; a renderer that places its own view (`useStageZoom`) frames what it names. | @@ -4844,7 +4886,7 @@ Everything a kit renderer component receives for one host state. | `onOpen` | `"onOpen": { (path: string, line?: number \| undefined): void }` | Ask the host to navigate to source evidence; the host decides. | | `onSelect` | `"onSelect": { (id: null \| string): void }` | Selects an item, as the person activating it: activating the selected item again clears the selection, as an `aria-pressed` toggle does, and `null` clears it. The shell also clears the selection when the person clicks the renderer's background, and toggles an item when they click its element anywhere outside a control. | | `options` | `"options": RendererOptions` | The host's latest `options`, such as `showRelationships`; empty until it sends any. | -| `pane` | `"pane": "after" \| "before" \| undefined` | Set while this frame is one held pane of side by side or swipe (`RendererEnvironment.pane`): it shows only that revision, which the host labels, so leave out narration of the transition such as step captions. | +| `pane` | `"pane": "after" \| "before" \| undefined` | Set while this frame is one held pane of side by side or swipe (`RendererEnvironment.pane`): it shows only that revision, which the host labels, so leave out narration of the transition such as step captions. A pane is a static comparison that marks only its side's changes (`paneShows`); the kit's components read it (`useHeldPane`). | | `progress` | `"progress": number` | 0 (before) to 1 (after); always 1 for an extraction. | | `reducedMotion` | `"reducedMotion": false \| true` | Whether the person prefers reduced motion: present each frame without decorative movement. | | `rendererName` | `"rendererName": string` | Definition renderer name the host matched, for example `graph-horizontal`. | @@ -4976,7 +5018,8 @@ SvgValueChange(__0: { "after": string; "anchor"?: "end" | "middle" | "start"; "b `ValueChange` inside SVG: one text line at `x`, `y` (the baseline) with the old value struck through in the removed hue, an arrow, then the new value in the added hue. Pass identifier attributes (the SDK's -`identifier`) for code values such as versions. +`identifier`) for code values such as versions. A held pane draws only its +side's value, in the modified hue. ### `Swatch` @@ -5155,6 +5198,14 @@ The frame's width and the host window's height, CSS px, as the host last reporte until it has. A content-sized frame lies in its host's scrolling page, so the window's height bounds how tall a stage that pans and zooms should ask to be (see `useFitScale`). +### `useHeldPane` + +```ts +useHeldPane(): "after" | "before" | undefined +``` + +The held pane this frame shows (`HeldPane`), or undefined. + ### `useLegend` ```ts @@ -5371,7 +5422,7 @@ and set it. Spread them: ` ( /** * An entry as lines of a section's list. In the diff, arriving or leaving entries take their sign and hue, and one * changed in place reads old → new: the same text at every emphasis, whose hue follows it. A side-by-side pane draws its - * own revision's entries, marked while emphasized, one changed in place in the pane's hue. + * own revision's entries, each in its change's hue (one changed in place in the modified hue), with no signs and + * nothing struck: the kit's `ValueList` draws a held pane so. */ -function items(entry: Entry, side: Side, marked: boolean): ValueItem[] { - const diff = side === 'diff' - if (diff && entry.mark === 'modified' && entry.was !== undefined) { +function items(entry: Entry, side: Side): ValueItem[] { + if (side === 'diff' && entry.mark === 'modified' && entry.was !== undefined) { // Too long to read as old → new on one line: the old entry leaves and the new one arrives, a line each. if (entry.was.length + entry.text.length > inlineChange) { return [ @@ -62,9 +62,7 @@ function items(entry: Entry, side: Side, marked: boolean): ValueItem[] { } return [{key: entry.key, label: {entry.text}, was: {entry.was}, change: 'modified'}] } - const mark = entry.mark === 'modified' && !diff ? (side === 'before' ? 'removed' : 'added') : entry.mark - const change = (diff || marked) && (mark === 'added' || mark === 'removed') ? mark : 'unchanged' - return [{key: entry.key, label: {entry.text}, change}] + return [{key: entry.key, label: {entry.text}, change: entry.mark}] } function SectionRow({section, strength, frame}: {section: Section; strength: number; frame: Frame}) { @@ -80,12 +78,7 @@ function SectionRow({section, strength, frame}: {section: Section; strength: num
{shown.length ? ( - items(entry, frame.side, strength > 0.01))} - label={section.spec.title} - layout="stack" - sign={frame.side === 'diff'} - /> + items(entry, frame.side))} label={section.spec.title} layout="stack" /> ) : ( {section.spec.empty} )} diff --git a/packages/renderers/agentic-workflows/test/agentic-workflows.test.mjs b/packages/renderers/agentic-workflows/test/agentic-workflows.test.mjs index 4087907b7..d5a64629d 100644 --- a/packages/renderers/agentic-workflows/test/agentic-workflows.test.mjs +++ b/packages/renderers/agentic-workflows/test/agentic-workflows.test.mjs @@ -4,6 +4,7 @@ import {readFileSync} from 'node:fs' import {createElement} from 'react' import {renderToStaticMarkup} from 'react-dom/server' import {comparisonModel, extractionModel, stepEmphasis} from '@githubnext/projections-renderer-kit' +import {HeldPane} from '@githubnext/projections-renderer-kit/react' import {createRulesRuntime} from '@githubnext/projections-comparator-runtime' import {buildModel, entries, findingsOf} from '../node_modules/.cache/test/model.js' import {agenticWorkflowsFacts} from '../node_modules/.cache/test/summary.js' @@ -247,13 +248,19 @@ test('a card says what changed beyond its entries: engine, strict mode, lock, de for (const text of ['was copilot, now claude', 'was strict mode on, now strict mode off', 'was Lock current, now Lock stale']) { assert.ok(meta.replaceAll('→', '').includes(text), `${text} in ${meta}`) } - // Side by side, an entry changed in place takes its pane's hue while highlighted. + // Side by side, an entry changed in place is its pane's own, in the modified hue in both panes, with no sign. const pane = progress => renderToStaticMarkup( - createElement(AgenticWorkflowsView, props(model, {...init, comparisonMode: 'side-by-side'}, {diff: false, progress})), + createElement( + HeldPane, + {value: progress < 0.5 ? 'before' : 'after'}, + createElement(AgenticWorkflowsView, props(model, {...init, comparisonMode: 'side-by-side'}, {diff: false, progress})), + ), ) - assert.match(pane(0), /data-change="removed"[^>]*>(?:(?!<\/li>).)*timeout/u) - assert.match(pane(1), /data-change="added"[^>]*>(?:(?!<\/li>).)*timeout/u) + for (const progress of [0, 1]) { + assert.match(pane(progress), /data-change="modified"[^>]*>(?:(?!<\/li>).)*timeout/u) + assert.doesNotMatch(pane(progress), /pk-value-sign| { diff --git a/packages/renderers/api/browser/api.spec.ts b/packages/renderers/api/browser/api.spec.ts index c0a56ca86..4c44fb86e 100644 --- a/packages/renderers/api/browser/api.spec.ts +++ b/packages/renderers/api/browser/api.spec.ts @@ -174,7 +174,9 @@ test('without highlighting the diff keeps its content and layout and drops only expect((await tints()).backgrounds).toEqual([]) }) -test('side-by-side panes list each revision; with highlighting each marks its own side', async ({page}) => { +test("side-by-side panes list each revision; with highlighting each marks its own side's changes in their hue, with no sign", async ({ + page, +}) => { for (const [progress, document] of [ [0, before], [1, after], @@ -205,9 +207,9 @@ test('side-by-side panes list each revision; with highlighting each marks its ow highlighting: 1, }) expect(await rows(start.frame.locator('.api-view'))).toEqual([ - {id: 'hello', status: ['Modified'], lines: ['removed:hello(): string'], runs: []}, + {id: 'hello', status: ['Modified'], lines: ['modified:hello(): string'], runs: []}, {id: 'legacy', status: ['Removed'], lines: ['removed:legacy(): void'], runs: []}, - {id: 'parse', status: ['Modified'], lines: ['removed:parse(text: string): Node'], runs: []}, + {id: 'parse', status: ['Modified'], lines: ['modified:parse(text: string): Node'], runs: []}, {id: 'stable', status: [], lines: ['plain:stable(): void'], runs: []}, ]) const end = await openRenderer(page, { @@ -220,7 +222,9 @@ test('side-by-side panes list each revision; with highlighting each marks its ow highlighting: 1, }) const hello = (await rows(end.frame.locator('.api-view'))).find(row => row.id === 'hello') - expect(hello).toEqual({id: 'hello', status: ['Modified'], lines: ['added:hello(name: string): string'], runs: ['mark:name: string']}) + expect(hello).toEqual({id: 'hello', status: ['Modified'], lines: ['modified:hello(name: string): string'], runs: ['mark:name: string']}) + // A pane draws no sign in its gutter. + await expect(end.frame.locator('.api-line-mark')).toHaveCount(0) }) test('selecting a declaration reports it and reflects the host selection', async ({page}) => { diff --git a/packages/renderers/api/src/signature-view.tsx b/packages/renderers/api/src/signature-view.tsx index d2c8a5094..d8b7e9da5 100644 --- a/packages/renderers/api/src/signature-view.tsx +++ b/packages/renderers/api/src/signature-view.tsx @@ -1,20 +1,22 @@ import {useMemo, type ReactNode} from 'react' import type {Entity} from '@githubnext/projections-schemas' import {identifier, keyed, type EntityChange} from '@githubnext/projections-renderer-sdk/presentation' +import {classifyChange, type ChangeClassification} from '@githubnext/projections-renderer-kit' import {Fact, Facts, Text} from '@githubnext/projections-renderer-kit/react' import {dataChanges} from './model.js' import {signatureLayout, signatureOf, signatureSegments, signatureTokens, type Segment, type Side, type Token} from './signature.js' -type Tone = 'added' | 'removed' -const toneMarks: Record = {added: '+', removed: '−'} +type Tone = Exclude +const toneMarks: Partial> = {added: '+', removed: '−'} -/** One signature line; a toned line carries a `+` or `−` marker in its gutter. */ -function Line({tone, children}: {tone?: Tone | undefined; children: ReactNode}) { +/** One signature line; a diff's added or removed line carries a `+` or `−` marker in its gutter. */ +function Line({tone, signed = true, children}: {tone?: Tone | undefined; signed?: boolean; children: ReactNode}) { + const mark = signed && tone ? toneMarks[tone] : undefined return (
-      {tone && (
+      {mark && (
         
       )}
       {children}
@@ -79,8 +81,10 @@ export function DiffSignature({row}: {row: EntityChange}) {
 
 /**
  * One revision's signature, as a side-by-side pane or an extraction shows it.
- * With emphasis, a changed signature is this side's line of a split diff,
- * marking what the other revision lacks when most of it survives.
+ * With emphasis, a changed signature is tinted in its change's hue (a pane
+ * marks only its side's changes: removed in Before, added in After, modified
+ * in both), with no sign, marking what the other revision lacks when most of
+ * it survives.
  */
 export function RevisionSignature({row, side, emphasized}: {row: EntityChange; side: Side; emphasized: boolean}) {
   const own = signatureOf(row[side]!)
@@ -91,9 +95,13 @@ export function RevisionSignature({row, side, emphasized}: {row: EntityChange{own}
-  return {tokens ?  : own}
+  const change = classifyChange(row)
+  if (!emphasized || otherSignature === own || change === 'unchanged') return {own}
+  return (
+    
+      {tokens ?  : own}
+    
+  )
 }
 
 /** Above this many changed fields, a row lists these and counts the rest. */
diff --git a/packages/renderers/api/test/api.test.mjs b/packages/renderers/api/test/api.test.mjs
index e44527928..e5bc2be8e 100644
--- a/packages/renderers/api/test/api.test.mjs
+++ b/packages/renderers/api/test/api.test.mjs
@@ -288,7 +288,7 @@ test('without highlighting the diff keeps its content and footers and drops only
   )
 })
 
-test('side-by-side panes list each revision; with highlighting each marks its side of the changes', async () => {
+test("side-by-side panes list each revision; with highlighting each marks its side's changes in their hue", async () => {
   const model = await comparison()
   const alone = extraction => render(props(extractionModel(extraction), {comparing: false, highlighting: 0}))
   const pane = (progress, highlighting) => render(props(model, {progress, highlighting}))
@@ -303,14 +303,16 @@ test('side-by-side panes list each revision; with highlighting each marks its si
   assert.equal(statusOf(end.added), 'Added')
   assert.match(start.legacy, /class="api-signature pk-label removed"/u)
   assert.match(end.added, /class="api-signature pk-label added"/u)
+  // A changed signature is in the modified hue in both panes, with no sign: each its side's own, marking what it adds.
   assert.match(
     start.greet,
-    /class="api-signature pk-label removed" data-change-hue="removed" data-projections-identifier="">.*greet\(<\/span>\): string<\/span>/u,
+    /class="api-signature pk-label modified" data-change-hue="modified" data-projections-identifier="">greet\(<\/span>\): string<\/span>/u,
   )
   assert.match(
     end.greet,
-    /class="api-signature pk-label added" data-change-hue="added" data-projections-identifier="">.*name: string<\/mark>/u,
+    /class="api-signature pk-label modified" data-change-hue="modified" data-projections-identifier="">.*name: string<\/mark>/u,
   )
+  assert.ok(![start.greet, end.greet, start.legacy, end.added].some(row => row.includes('api-line-mark')), 'a pane draws no sign')
   assert.ok(!start.parse.includes('; frame: Frame})
       holdsChanges={changed && row.status === 'modified' && (frame.side === 'diff' || strength > 0.01)}
     >
       
-      {view?.kind === 'grid' && }
+      {view?.kind === 'grid' && }
     
   )
 }
diff --git a/packages/renderers/github-actions/src/matrix.tsx b/packages/renderers/github-actions/src/matrix.tsx
index 27ec71356..3c346f280 100644
--- a/packages/renderers/github-actions/src/matrix.tsx
+++ b/packages/renderers/github-actions/src/matrix.tsx
@@ -33,15 +33,15 @@ function own(cell: GridCell) {
 }
 
 /** One run as a matrix cell: a mark, or what tells it apart, with its whole name for a pointer and screen readers. */
-function cellOf(cell: GridCell | null, frame: Frame, strength: number): MatrixCell | null {
+function cellOf(cell: GridCell | null, frame: Frame): MatrixCell | null {
   if (!cell) return null
   const content = own(cell)
-  return {change: shownMark(cell.mark, frame, strength), title: runName(cell) || 'run', ...(content ? {content} : {})}
+  return {change: shownMark(cell.mark, frame), title: runName(cell) || 'run', ...(content ? {content} : {})}
 }
 
 /** A run `include` adds of its own: what tells it apart, in a quiet cell, its whole name on hover. */
-function Cell({cell, frame, strength}: {cell: GridCell; frame: Frame; strength: number}) {
-  const shown = shownMark(cell.mark, frame, strength)
+function Cell({cell, frame}: {cell: GridCell; frame: Frame}) {
+  const shown = shownMark(cell.mark, frame)
   return (
     
       {own(cell)}
@@ -53,10 +53,10 @@ function Cell({cell, frame, strength}: {cell: GridCell; frame: Frame; strength:
   )
 }
 
-const axisOf = (axis: Axis, frame: Frame, strength: number): MatrixAxis => ({
+const axisOf = (axis: Axis, frame: Frame): MatrixAxis => ({
   name: axis.key,
   code: true,
-  values: axis.values.map(value => ({key: value.text, change: shownMark(value.mark, frame, strength)})),
+  values: axis.values.map(value => ({key: value.text, change: shownMark(value.mark, frame)})),
 })
 
 function Grid({
@@ -64,14 +64,12 @@ function Grid({
   rows,
   columns,
   frame,
-  strength,
   job,
 }: {
   panel: Panel
   rows?: Axis | undefined
   columns?: Axis | undefined
   frame: Frame
-  strength: number
   job: string
 }) {
   // A lone dimension lies as the axes put it: across, in one row under its values, unless it's the runner, whose long
@@ -87,7 +85,7 @@ function Grid({
     if (!rows) return line.get(row) ?? null
     return column === undefined ? ([...line.values()][0] ?? null) : (line.get(column) ?? null)
   }
-  const shown = shownMark(panel.mark, frame, strength)
+  const shown = shownMark(panel.mark, frame)
   const caption =
     panel.title.length > 0 ? (
       
@@ -105,10 +103,10 @@ function Grid({
   return (
      cellOf(find(row, column), frame, strength)}
+      cell={(row, column) => cellOf(find(row, column), frame)}
       vacant="No run: this combination is excluded"
       {...(caption ? {caption} : {})}
     />
@@ -116,22 +114,12 @@ function Grid({
 }
 
 /** A matrix's runs: a grid (or one per combination of its further dimensions), then any runs `include` adds alone. */
-export function Runs({
-  view,
-  frame,
-  strength,
-  job,
-}: {
-  view: Extract
-  frame: Frame
-  strength: number
-  job: string
-}) {
+export function Runs({view, frame, job}: {view: Extract; frame: Frame; job: string}) {
   if (!view.panels.length && !view.extra.length) return null
   return (
     
{view.panels.map(panel => ( - + ))} {view.extra.length > 0 && (
@@ -139,7 +127,7 @@ export function Runs({
    {view.extra.map(cell => (
  • - +
  • ))}
diff --git a/packages/renderers/github-actions/src/values.tsx b/packages/renderers/github-actions/src/values.tsx index a71821373..55f3e5104 100644 --- a/packages/renderers/github-actions/src/values.tsx +++ b/packages/renderers/github-actions/src/values.tsx @@ -1,9 +1,12 @@ // What every card reads (the frame) and how it writes values: plain text, identifiers in monospace, each change in its // hue with its sign, struck through when it leaves, old → new when it changes in place. No pills: a card reads as text. +// A side-by-side pane draws its side's values only, in their hue, with no signs and nothing struck: the kit's marks +// (`ValueMark`, `ValueList`) do that for a held pane, so these take the same props in every mode. import type {ReactNode} from 'react' import {Fact, ValueChange, ValueList, ValueMark, type RendererProps, type ValueItem} from '@githubnext/projections-renderer-kit/react' import type {Entity} from '@githubnext/projections-schemas' import {identifier, type EntityChange} from '@githubnext/projections-renderer-sdk/presentation' +import {paneChange} from '@githubnext/projections-renderer-kit' import type {Entry, Mark, Side} from './model.js' /** What every card reads: the host's props, the revision shown and how strongly a change shows. */ @@ -15,11 +18,8 @@ export interface Frame { strength: (row: EntityChange) => number } -/** A mark as this frame shows it: the diff marks everything; a side-by-side pane tints only while emphasized. */ -export function shownMark(mark: Mark, frame: Frame, strength: number): Mark { - if (frame.side === 'diff') return mark - return strength <= 0.01 ? 'unchanged' : mark -} +/** A mark as this frame shows it: the diff marks everything; a side-by-side pane only its side's (`paneChange`). */ +export const shownMark = (mark: Mark, frame: Frame): Mark => paneChange(mark, frame.props.pane) /** Text as code (an identifier, a path, a value) or as words. */ export const code = (text: string) => ( @@ -33,14 +33,10 @@ const words: Partial> = {added: 'added: ', removed: 'remove /** A shown mark in words, for assistive technology: what color and dashes say. */ export const spoken = (mark: Mark) => (mark === 'unchanged' ? '' : (words[mark] ?? 'changed: ')) -/** How strongly a change shows in this frame: the diff follows the host's highlighting, a pane the job's emphasis. */ -const emphasisIn = (frame: Frame, strength: number) => (frame.side === 'diff' ? frame.props.highlighting : strength) - -/** One value, marked (the kit's `ValueMark`): its sign in the diff (a pane hides it), its change in words. */ -export function Value({mark, frame, strength, children}: {mark: Mark; frame: Frame; strength: number; children: ReactNode}) { - const shown = shownMark(mark, frame, strength) +/** One value, marked (the kit's `ValueMark`): its sign (none in a pane), its change in words, at the job's emphasis. */ +export function Value({mark, strength, children}: {mark: Mark; frame: Frame; strength: number; children: ReactNode}) { return ( - + {children} ) @@ -93,10 +89,11 @@ export function Values({ /** The list's accessible name. */ label: string }) { + // A pane's entries are already its side's; the kit shows a modified item's own value there, old → new in the diff. const values: ValueItem[] = items.map(entry => frame.side === 'diff' && entry.mark === 'modified' && entry.was !== undefined ? {key: entry.key, label: render(entry.text), was: render(entry.was), change: 'modified'} - : {key: entry.key, label: render(entry.text), change: shownMark(entry.mark, frame, strength)}, + : {key: entry.key, label: render(entry.text), change: entry.mark}, ) return ( ) } @@ -126,13 +122,13 @@ export function Single({ before?: string | undefined after?: string | undefined frame: Frame - /** The job's emphasis: a pane tints a value that differs from the other revision only while it's emphasized. */ + /** The job's emphasis, which the value's change follows. */ strength: number render: (text: string) => ReactNode }) { const shown = frame.side === 'before' ? before : after - // A pane tints a value that differs only while the change shows; at rest it reads as with nothing to compare. - if (frame.side !== 'diff' && before !== after && shown !== undefined && strength > 0.01) { + // A pane marks a value that differs from the other revision in its hue: its side's own value, as the kit's marks do. + if (frame.side !== 'diff' && before !== after && shown !== undefined) { const other = frame.side === 'before' ? after : before const mark: Mark = other === undefined ? (frame.side === 'before' ? 'removed' : 'added') : 'modified' return ( @@ -145,7 +141,7 @@ export function Single({ if (before === undefined || after === undefined) { const text = before ?? after ?? '' return ( - + {render(text)} ) diff --git a/packages/renderers/harness/browser/pane-marks.spec.ts b/packages/renderers/harness/browser/pane-marks.spec.ts new file mode 100644 index 000000000..61c6abb60 --- /dev/null +++ b/packages/renderers/harness/browser/pane-marks.spec.ts @@ -0,0 +1,50 @@ +import {expect, test} from '@playwright/test' +import {openStage} from '@githubnext/projections-renderer-testing/playwright' +import type {PaneMark} from '@githubnext/projections-renderer-testing' +import {harnessInspector} from '@githubnext/projections-renderer-harness/playwright' + +/** + * The probe behind `pane-marks`: an item's status words, the change hues of its edge all the way round, and those of + * the band across it behind its words. A tinted band on a neutral edge (or a stripe beside it) is what the check fails; + * a badge holding the words is no band. + */ +test("the pane-marks probe reads a card's edge and band, and a held pane's cards carry them in one hue", async ({page}, info) => { + test.skip(info.project.name !== 'chromium-desktop', 'One engine shows the probe works; the checks run in every one.') + const stage = await openStage(page, harnessInspector(), { + scenario: 'github-actions/pipeline', + progress: 1, + pane: 'after', + highlighting: 1, + }) + await stage.measure('settle') + const marks = await stage.measure('paneMarks') + // The kit's cards in a held pane: each changed card's edge and band in its own hue, and nothing removed in After. + expect(marks.length).toBeGreaterThan(0) + for (const mark of marks.filter(found => found.card)) { + expect(mark.edge, mark.element).toEqual(mark.band) + expect(mark.words, mark.element).not.toContain('Removed') + } + await stage.frame.locator('body').evaluate(body => { + const fixture = document.createElement('div') + const green = 'var(--projections-color-added)' + const band = (tint: string) => + `
Added
` + fixture.innerHTML = ` +
+

stripe

${band(green)} +
+
+

region

${band(green)} +
+
+

holds changes Modified

+
` + body.prepend(fixture) + }) + const fixtures = new Map( + (await stage.measure('paneMarks')).filter(mark => mark.id.startsWith('fixture-')).map(mark => [mark.id, mark]), + ) + expect(fixtures.get('fixture-stripe')).toMatchObject({card: true, words: ['Added'], edge: [], band: ['added']}) + expect(fixtures.get('fixture-region')).toMatchObject({words: ['Added'], edge: ['added'], band: ['added']}) + expect(fixtures.get('fixture-badge')).toMatchObject({words: ['Modified'], edge: [], band: []}) +}) diff --git a/packages/renderers/kit/src/emphasis.ts b/packages/renderers/kit/src/emphasis.ts index e2442921e..f90494920 100644 --- a/packages/renderers/kit/src/emphasis.ts +++ b/packages/renderers/kit/src/emphasis.ts @@ -181,6 +181,25 @@ export function edgePresence(edge: EntityChange, progress: number) return entityPresence(edge, progress) } +/** One held pane of side by side or swipe (`RendererProps.pane`): the revision it shows. */ +export type Pane = 'before' | 'after' + +/** + * Whether a held pane marks a change: each pane marks only the changes on its side. Before marks what was removed, + * changed or renamed; After what was added, changed or renamed. Nothing else is marked, and unchanged items are neutral + * in both, so a removed item is marked only in Before and an added one only in After. + */ +export function paneShows(change: ChangeClassification | Classifiable, pane: Pane): boolean { + const classified = typeof change === 'string' ? change : isChanged(change) ? classifyChange(change) : 'unchanged' + if (classified === 'unchanged') return false + return pane === 'before' ? classified !== 'added' : classified !== 'removed' +} + +/** The change a value or item shows in a held pane (`paneShows`), else unchanged; outside a pane, its own change. */ +export function paneChange(change: C, pane: Pane | undefined): C | 'unchanged' { + return pane === undefined || paneShows(change, pane) ? change : 'unchanged' +} + /** Step-scoped emphasis for one row: pass the row, and its row ID when the row object has none. */ export type EmphasisOf = (change: Classifiable & {id?: string}, id?: string) => number @@ -192,19 +211,16 @@ export type EmphasisOf = (change: Classifiable & {id?: string}, id?: string) => * highlighting, which is exactly 0 at both endpoints. Earlier steps never * pre-tint later changes. Rows no step places use the host's highlighting. * A held pane of side by side or swipe (`pane`) is a static comparison, not a - * moment of the transition: every change it shows follows the host's - * highlighting alike, so Before marks its removals as After marks its - * additions. + * moment of the transition, so the neutral endpoints of the animation don't + * apply to it: every change on its side (`paneShows`) follows the host's + * highlighting alike, so Before marks its removals and changes as After marks + * its additions and changes, and the other side's changes show none. */ -export function stepEmphasis( - schedule: readonly ScheduledStep[], - progress: number, - highlighting: number, - pane?: 'before' | 'after', -): EmphasisOf { +export function stepEmphasis(schedule: readonly ScheduledStep[], progress: number, highlighting: number, pane?: Pane): EmphasisOf { const stepOf = new Map() if (!pane) for (const step of schedule) for (const id of [...step.entities, ...step.relationships]) stepOf.set(id, step) return (change, id = change.id) => { + if (pane && !paneShows(change, pane)) return 0 const strength = presentedEmphasis(change, highlighting) return strength && id !== undefined ? strength * emphasisRise(stepOf.get(id), progress) : strength } diff --git a/packages/renderers/kit/src/react.ts b/packages/renderers/kit/src/react.ts index 8f315b91e..3e7498f0e 100644 --- a/packages/renderers/kit/src/react.ts +++ b/packages/renderers/kit/src/react.ts @@ -17,6 +17,8 @@ export { usePaintGate, usePaintHold, useSelectable, + HeldPane, + useHeldPane, } from './react/shell/frame.js' export * from './react/select-control.js' export * from './react/components.js' diff --git a/packages/renderers/kit/src/react/chip.tsx b/packages/renderers/kit/src/react/chip.tsx index d95d7808b..251c39edf 100644 --- a/packages/renderers/kit/src/react/chip.tsx +++ b/packages/renderers/kit/src/react/chip.tsx @@ -2,11 +2,11 @@ // status tab under it, and `Chips`, a wrapping list of them that keeps room for those tabs. import {Children, type ReactNode} from 'react' import {identifier as identifierAttributes} from '@githubnext/projections-renderer-sdk/presentation' -import {classifyChange, describeChange, statusLabels, type ChangeClassification} from '../emphasis.js' +import {classifyChange, describeChange, paneChange, statusLabels, type ChangeClassification} from '../emphasis.js' import type {StatusChange} from '../svg-status.js' import {toneAttributes, type Tone} from '../tone.js' import {StatusTab} from './status-tab.js' -import {useSelectable} from './shell/frame.js' +import {useHeldPane, useSelectable} from './shell/frame.js' const signs: Partial> = {added: '+', removed: '−', modified: '~', renamed: '~'} @@ -23,7 +23,7 @@ export interface ChipProps { * leaves with an item already marked around it, so change colors never nest; its sign and words still say it. */ paint?: boolean | undefined - /** Puts the change's sign (`+`, `−`, `~`) before the label, as a diff does. */ + /** Puts the change's sign (`+`, `−`, `~`) before the label, as a diff does; never in a held pane. */ sign?: boolean | undefined /** * How strongly the change is shown (`RendererProps.emphasis`), 0 to 1: the hue and the status tab fade with it. Left @@ -72,14 +72,15 @@ export interface ChipProps { * One small item as a pill: an optional category dot, its label (monospace by default) and trailing content, in a * neutral edge. A changed chip is painted in its change's hue (fading with `emphasis`), struck through when removed, * and can carry its sign and a status tab; assistive technology hears its change in words. With `id` and `onSelect` - * it is a button that selects the item. + * it is a button that selects the item. In a held pane it is painted only for its side's changes (`paneShows`), with + * no sign and nothing struck through. */ export function Chip({ label, font = 'code', - change = 'unchanged', + change: own = 'unchanged', paint = true, - sign = false, + sign: signed = false, emphasis, status, dot, @@ -93,6 +94,9 @@ export function Chip({ description, className, }: ChipProps) { + const pane = useHeldPane() + const change = paneChange(own, pane) + const sign = signed && !pane const changed = change !== 'unchanged' // What assistive technology hears: the status tab's words when there is one (it is hidden from it), else the change. const said = status && classifyChange(status) !== 'unchanged' ? describeChange(status) : changed ? statusLabels[change] : undefined @@ -104,6 +108,8 @@ export function Chip({ className: classes, ...(painted ? {'data-change': change} : {}), ...(changed ? {'data-chip-change': change} : {}), + // A held pane shows one revision: what it marks is in its hue, never struck through (chips.css). + ...(pane ? {'data-pane': pane} : {}), ...(id !== undefined ? {'data-entity-id': id} : {}), ...(unit ? {'data-projections-unit': ''} : {}), // Without its own emphasis, a chip's status tab fades with the item's around it, as its paint does. diff --git a/packages/renderers/kit/src/react/diff-components.tsx b/packages/renderers/kit/src/react/diff-components.tsx index fdbce8475..4c3d06b14 100644 --- a/packages/renderers/kit/src/react/diff-components.tsx +++ b/packages/renderers/kit/src/react/diff-components.tsx @@ -1,6 +1,20 @@ import type {ReactNode} from 'react' import {identifier as identifierAttributes} from '@githubnext/projections-renderer-sdk/presentation' +import {statusLabels, type ChangeClassification, type Pane} from '../emphasis.js' import {Chip, Chips} from './chip.js' +import {useHeldPane} from './shell/frame.js' + +const present = (value: ReactNode) => value !== undefined && value !== null && value !== false + +/** + * A value change as a held pane shows it: only its side's value, in its change's hue (modified when both sides have + * one, else removed in Before or added in After), or nothing when its side has none. + */ +function paneValue(before: ReactNode, after: ReactNode, pane: Pane): {value: ReactNode; change: ChangeClassification} | undefined { + const value = pane === 'before' ? before : after + if (!present(value)) return undefined + return {value, change: present(before) && present(after) ? 'modified' : pane === 'before' ? 'removed' : 'added'} +} /** * A value that changed: the old one struck through in a removed pill, then @@ -10,7 +24,8 @@ import {Chip, Chips} from './chip.js' * version), in the monospace font. `variant="text"` draws the same change as * text, with no pills: the old value struck through in the removed hue, an * arrow, then the new one in the added hue (always on one line); use it in - * key-value lists and running text, where pills would be loud. + * key-value lists and running text, where pills would be loud. A held pane shows only its side's value, in its + * change's hue (modified when both sides have one), struck through nowhere. */ export function ValueChange({ before, @@ -28,8 +43,23 @@ export function ValueChange({ variant?: 'pills' | 'text' className?: string }) { - const has = (value: ReactNode) => value !== undefined && value !== null && value !== false + const has = present const label = code ? identifierAttributes : {} + const pane = useHeldPane() + if (pane && variant === 'pills') { + const shown = paneValue(before, after, pane) + if (!shown) return null + return ( + + + {statusLabels[shown.change]}: + + {shown.value} + + + + ) + } if (variant === 'text') { const text = (value: ReactNode) => (has(value) ? {value} : undefined) return @@ -113,7 +143,8 @@ export function ChangePills({ * `ValueChange` inside SVG: one text line at `x`, `y` (the baseline) with * the old value struck through in the removed hue, an arrow, then the new * value in the added hue. Pass identifier attributes (the SDK's - * `identifier`) for code values such as versions. + * `identifier`) for code values such as versions. A held pane draws only its + * side's value, in the modified hue. */ export function SvgValueChange({ before, @@ -131,6 +162,16 @@ export function SvgValueChange({ anchor?: 'start' | 'middle' | 'end' className?: string } & Record<`data-${string}`, string>) { + const pane = useHeldPane() + if (pane) { + return ( + + + {pane === 'before' ? before : after} + + + ) + } return ( {before} @@ -142,10 +183,24 @@ export function SvgValueChange({ /** * A value that changed in place, as text: the old one struck through in the removed hue, an arrow, then the new one - * in the added hue, with no pills. `ValueChange variant="text"` is this. + * in the added hue, with no pills. `ValueChange variant="text"` is this. A held pane shows only its side's value, in + * its change's hue (modified when both sides have one), struck through nowhere. */ export function ValueText({before, after, className}: {before?: ReactNode; after?: ReactNode; className?: string}) { - const has = (value: ReactNode) => value !== undefined && value !== null && value !== false + const has = present + const pane = useHeldPane() + if (pane) { + const shown = paneValue(before, after, pane) + if (!shown) return null + return ( + + + {statusLabels[shown.change]}: + {shown.value} + + + ) + } return ( {has(before) && ( diff --git a/packages/renderers/kit/src/react/facts.tsx b/packages/renderers/kit/src/react/facts.tsx index c261d5ff1..3d9348f86 100644 --- a/packages/renderers/kit/src/react/facts.tsx +++ b/packages/renderers/kit/src/react/facts.tsx @@ -2,13 +2,16 @@ // arrive, leave or change, marked inline in their change's hue rather than each drawn as a pill (`ValueList`). import type {ReactNode} from 'react' import {identifier as identifierAttributes} from '@githubnext/projections-renderer-sdk/presentation' -import {statusLabels, type ChangeClassification} from '../emphasis.js' +import {paneChange, statusLabels, type ChangeClassification} from '../emphasis.js' import {ValueChange, ValueText} from './diff-components.js' import {Chip, Chips} from './chip.js' -import {useSelectable} from './shell/frame.js' +import {useHeldPane, useSelectable} from './shell/frame.js' const signs: Partial> = {added: '+', removed: '−', modified: '~', renamed: '~'} +/** The element a change is set in outside a held pane: struck through (`del`) when it leaves, `ins` when it arrives. */ +const markTags: Partial> = {removed: 'del', added: 'ins'} + const hasContent = (value: ReactNode) => value !== undefined && value !== null && value !== false && value !== '' const emphasisStyle = (emphasis: number | undefined) => @@ -42,7 +45,8 @@ export function Facts({ /** * One row of `Facts`: its label, its value and, optionally, a muted note after the value (`meta`: "and 8 run steps"), * so a count or a note sits beside a label rather than alone on a line. A row that arrives or leaves as a whole takes - * `change`: its label is marked in the change's hue, struck through when it leaves, and said in words. + * `change`: its label is marked in the change's hue, struck through when it leaves, and said in words. In a held pane + * it is marked only on its side (`paneShows`), and never struck through. */ export function Fact({ label, @@ -58,14 +62,17 @@ export function Fact({ /** How strongly `change` shows, 0 to 1; left out, the row follows the `--emphasis` of the item around it. */ emphasis?: number }) { - const changed = change !== 'unchanged' - const Label = change === 'removed' ? 'del' : change === 'added' ? 'ins' : 'span' + const pane = useHeldPane() + const shown = paneChange(change, pane) + const changed = shown !== 'unchanged' + // A held pane shows one revision: its changes in their hue, never struck through (`del`) or underlined (`ins`). + const Label = markTags[pane ? 'unchanged' : shown] ?? 'span' return (
{changed ? ( -
{changed ? ( -
diff --git a/packages/renderers/kit/src/react/shell/props.ts b/packages/renderers/kit/src/react/shell/props.ts index 751f8d6e1..a7204bb00 100644 --- a/packages/renderers/kit/src/react/shell/props.ts +++ b/packages/renderers/kit/src/react/shell/props.ts @@ -54,7 +54,8 @@ export interface RendererProps .pk-diff-shape { fill: color-mix(in srgb, var(--pk-region-fill) calc(var(--emphasis, 1) * 100%), var(--raised)); @@ -12,7 +12,7 @@ .pk [data-change='removed'] > .pk-diff-shape { stroke-dasharray: 5 3; } -.pk [data-change='removed'] .pk-diff-text { +.pk:not([data-pane]) [data-change='removed'] .pk-diff-text { color: var(--muted); fill: var(--muted); text-decoration: line-through; @@ -83,6 +83,10 @@ .pk-svg-now { fill: var(--green); } +/* A held pane's side of an SVG value change: that side's value alone, in its change's hue, struck through nowhere. */ +.pk-svg-own { + fill: var(--pk-change-ink); +} /* A diff card's field changes (GraphCanvas `changedFields`). */ .node-field-key, .node-field-value { diff --git a/packages/renderers/kit/styles/layout.css b/packages/renderers/kit/styles/layout.css index a129d8926..c9d664b87 100644 --- a/packages/renderers/kit/styles/layout.css +++ b/packages/renderers/kit/styles/layout.css @@ -181,34 +181,26 @@ .pk .pk-entity-card { --emphasis: 0; --change: var(--border); + /* A changed card's tint, laid over its surface (below): none on an unchanged one, painted the same way. */ + --pk-card-tint: transparent; display: flex; flex-direction: column; min-width: 0; border: var(--projections-border-width) solid var(--border-strong); border-radius: var(--projections-radius-sm); - background: var(--canvas); + background: linear-gradient(var(--pk-card-tint), var(--pk-card-tint)) var(--canvas); } -/* A changed card that is a change region (`pk-region`) takes its edge's hue on its own border, one line, not beside it. */ +/* + * A changed card is a change region (`pk-region`) in every mode, the diff's, a transition's and a held pane's alike: its + * edge's hue on its own border, one line, not beside it, and its tint laid over the card's own surface, both fading with + * `--emphasis` to the plain card's. A card drawn neutral (nesting.css) keeps its surface. + */ .pk .pk-entity-card.pk-region[data-change] { + --pk-card-tint: color-mix(in srgb, var(--pk-region-fill) var(--pk-region-amount), transparent); border-color: color-mix(in srgb, var(--pk-region-edge) var(--pk-region-amount), var(--border-strong)); + background: linear-gradient(var(--pk-card-tint), var(--pk-card-tint)) var(--canvas); box-shadow: none; } -/* The change's hue on the card's leading edge, drawn inside it, so emphasis never overlaps a neighbour. */ -.pk .pk-entity-card:not(.pk-region) { - box-shadow: inset 3px 0 0 color-mix(in srgb, var(--change) calc(var(--emphasis) * 100%), transparent); -} -.pk .pk-entity-card[data-status='added'] { - --change: var(--green); -} -.pk .pk-entity-card[data-status='removed'] { - --change: var(--red); -} -.pk .pk-entity-card[data-status='modified'] { - --change: var(--amber); -} -.pk .pk-entity-card:is([data-status='renamed'], [data-status='moved'], [data-status='unchanged']) { - --change: var(--violet); -} /* Hover, keyboard focus and selection rings are the renderer SDK's, on the card's own element. */ .pk .pk-entity-card-select { display: flex; @@ -299,7 +291,7 @@ .pk-entity-card:is( .pk-holds-changes, .pk-mixed-change, - :is([data-change], [data-status]):has(:is([data-change]:not(.pk-status-tab), .pk-svg-was, .pk-svg-now)) + :is([data-change], [data-status]):has(:is([data-change]:not(.pk-status-tab), .pk-svg-was, .pk-svg-now, .pk-svg-own)) ) { --pk-region-fill: transparent; --pk-region-edge: var(--border-emphasis); diff --git a/packages/renderers/kit/styles/matrix.css b/packages/renderers/kit/styles/matrix.css index 4a0a6d1ae..1950e6105 100644 --- a/packages/renderers/kit/styles/matrix.css +++ b/packages/renderers/kit/styles/matrix.css @@ -89,7 +89,7 @@ .pk .pk-matrix .pk-matrix-cell.pk-region[data-change='removed'] { box-shadow: inset 0 0 0 var(--stroke) color-mix(in srgb, var(--border) calc((1 - var(--emphasis, 1)) * 100%), transparent); } -.pk .pk-matrix [data-change='removed'] .pk-diff-text { +.pk:not([data-pane]) .pk-matrix [data-change='removed'] .pk-diff-text { color: color-mix(in srgb, var(--muted) calc(var(--emphasis, 1) * 100%), var(--text)); text-decoration: line-through color-mix(in srgb, currentColor calc(var(--emphasis, 1) * 100%), transparent); } diff --git a/packages/renderers/kit/styles/nesting.css b/packages/renderers/kit/styles/nesting.css index 7201b63c1..b8acd1b80 100644 --- a/packages/renderers/kit/styles/nesting.css +++ b/packages/renderers/kit/styles/nesting.css @@ -8,8 +8,8 @@ */ .pk :is( - :is([data-change], [data-status]):has(:is([data-change]:not(.pk-status-tab), .pk-svg-was, .pk-svg-now)), - .graph-node:has(:is([data-change], .pk-svg-was, .pk-svg-now)), + :is([data-change], [data-status]):has(:is([data-change]:not(.pk-status-tab), .pk-svg-was, .pk-svg-now, .pk-svg-own)), + .graph-node:has(:is([data-change], .pk-svg-was, .pk-svg-now, .pk-svg-own)), .pk-holds-changes ) { --pk-region-fill: transparent; @@ -24,12 +24,14 @@ * card changed two ways (`mixedChange`: renamed and changed) is drawn so too, its status words each in their own hue. */ .pk - :is(.graph-node:has(:is([data-change], .pk-svg-was, .pk-svg-now)), .pk-holds-changes, .pk-mixed-change) + :is(.graph-node:has(:is([data-change], .pk-svg-was, .pk-svg-now, .pk-svg-own)), .pk-holds-changes, .pk-mixed-change) > :is(.node-emphasis, .node-footer-rule) { fill: none; stroke: var(--border-emphasis); } -.pk :is(.graph-node:has(:is([data-change], .pk-svg-was, .pk-svg-now)), .pk-holds-changes, .pk-mixed-change) > .node-footer-band { +.pk + :is(.graph-node:has(:is([data-change], .pk-svg-was, .pk-svg-now, .pk-svg-own)), .pk-holds-changes, .pk-mixed-change) + > .node-footer-band { fill: var(--recessed); } /* @@ -41,8 +43,8 @@ } .pk :is( - :is([data-change], [data-status]):has(:is([data-change]:not(.pk-status-tab), .pk-svg-was, .pk-svg-now)), - .graph-node:has(:is([data-change], .pk-svg-was, .pk-svg-now)), + :is([data-change], [data-status]):has(:is([data-change]:not(.pk-status-tab), .pk-svg-was, .pk-svg-now, .pk-svg-own)), + .graph-node:has(:is([data-change], .pk-svg-was, .pk-svg-now, .pk-svg-own)), .pk-holds-changes, .pk-group:has(:is([data-change], [data-status])) ) { diff --git a/packages/renderers/kit/test/facts.test.mjs b/packages/renderers/kit/test/facts.test.mjs index 392e3bd4a..f9875fa16 100644 --- a/packages/renderers/kit/test/facts.test.mjs +++ b/packages/renderers/kit/test/facts.test.mjs @@ -2,7 +2,7 @@ import {test} from 'node:test' import assert from 'node:assert/strict' import {createElement} from 'react' import {renderToStaticMarkup} from 'react-dom/server' -import {Fact, Facts, Field, Fields, ValueChange, ValueList, ValueMark} from '../dist/react.js' +import {Chip, EntityCard, Fact, Facts, Field, Fields, HeldPane, ValueChange, ValueList, ValueMark} from '../dist/react.js' import {plain} from './markup.mjs' const html = element => renderToStaticMarkup(element) @@ -100,3 +100,69 @@ test('one value marks its own change, or is the value alone', () => { 'Removed: a', ) }) + +test("a held pane shows each value as its side has it, in its change's hue, with no sign and nothing struck through", () => { + const inPane = (pane, element) => html(createElement(HeldPane, {value: pane}, element)) + const items = [ + {key: 'a', label: 'checkout@v5'}, + {key: 'b', label: 'setup-node@v5', change: 'added'}, + {key: 'c', label: 'cache@v3', change: 'removed'}, + {key: 'd', label: 'upload@v4', was: 'upload@v3', change: 'modified'}, + ] + const before = inPane('before', createElement(ValueList, {label: 'Steps', items})) + const after = inPane('after', createElement(ValueList, {label: 'Steps', items})) + for (const markup of [before, after]) assert.doesNotMatch(markup, /Modified: <\/span>upload@v4<\/span>/u) + assert.equal( + inPane('before', createElement(ValueMark, {change: 'removed', sign: true}, 'a')), + 'Removed: a', + ) + assert.equal(inPane('after', createElement(ValueMark, {change: 'removed'}, 'a')), 'a') + assert.equal( + plain(inPane('before', createElement(Fact, {label: 'Container', change: 'removed'}, 'node:22'))), + 'Removed: Containernode:22', + ) + // A changed value shows its side's value only, in the modified hue; a side without one shows nothing. + const text = inPane('before', createElement(ValueChange, {before: '8.x', after: '10.x', variant: 'text'})) + assert.match(text, //u) + assert.equal(plain(text), 'Modified: 8.x') + assert.match( + inPane('after', createElement(ValueChange, {before: '8.x', after: '10.x'})), + //u, + ) + assert.equal(inPane('before', createElement(ValueChange, {after: '10.x'})), '') + const chip = inPane('before', createElement(Chip, {label: 'gone', change: 'removed', sign: true})) + assert.match(chip, /data-change="removed" data-chip-change="removed" data-pane="before"/u) + assert.doesNotMatch(chip, /pk-chip-sign/u) + assert.doesNotMatch(inPane('before', createElement(Chip, {label: 'new', change: 'added'})), /data-change/u) +}) + +test('a changed card is a change region in every mode: the diff, a transition and its side of a held pane', () => { + const card = (change, pane, emphasis = 1) => + html( + createElement( + HeldPane, + {value: pane}, + createElement(EntityCard, {id: 'job', label: 'job', selected: false, onSelect: () => undefined, change, emphasis}), + ), + ) + const added = {status: 'added'} + assert.match( + card(added, 'after'), + /class="pk-entity-card pk-frame pk-region" data-entity-id="job"[^>]* data-status="added" data-change="added"/u, + ) + // A transition's card is the same region, at its step's emphasis; at none (an endpoint) it is an unchanged card. + assert.match(card(added, undefined, 0.5), /class="pk-entity-card pk-frame pk-region"[^>]* data-change="added" style="--emphasis:0.5"/u) + assert.match( + card(added, undefined, 0), + /^
  • /u, + ) + // A pane never marks the other side's change, and an unchanged card is no region. + const opening = markup => /^]*>/u.exec(markup)[0] + assert.doesNotMatch(opening(card({status: 'removed'}, 'after')), /pk-region|data-change/u) + assert.doesNotMatch(opening(card({status: 'unchanged'}, 'after')), /pk-region|data-change/u) + assert.match(card({status: 'modified'}, 'before'), /data-change="modified"/u) +}) diff --git a/packages/renderers/kit/test/group.test.mjs b/packages/renderers/kit/test/group.test.mjs index 725c6a6f7..26e13202c 100644 --- a/packages/renderers/kit/test/group.test.mjs +++ b/packages/renderers/kit/test/group.test.mjs @@ -71,7 +71,8 @@ test('in a comparison the status states the change in proportion to emphasis, an inline(file), ) const css = inline('react.css') - assert.match(css, /\.pk \[data-change='removed'\] \.pk-diff-text \{[^}]*text-decoration: line-through/u) + // Outside a held pane: a pane shows Before as it is, its removals in their hue, struck through nowhere. + assert.match(css, /\.pk:not\(\[data-pane\]\) \[data-change='removed'\] \.pk-diff-text \{[^}]*text-decoration: line-through/u) }) test('a group that presents an item is its unit, and its title is the button that selects it', () => { diff --git a/packages/renderers/kit/test/layout.test.mjs b/packages/renderers/kit/test/layout.test.mjs index 043a4b2f1..e88d61e2d 100644 --- a/packages/renderers/kit/test/layout.test.mjs +++ b/packages/renderers/kit/test/layout.test.mjs @@ -1187,7 +1187,8 @@ test('a card leads with its title, its kind above it, a subtitle under it and an card, /Matrix job<\/span>40 min<\/span><\/span>build<\/span><\/span><\/span>6 runs<\/span>/u, ) - // Given a change, it shows status in a band at its foot, framed; renamed and changed, it is drawn neutral. + // Given a change, it shows status in a band at its foot, framed; renamed and changed, it is drawn neutral (a region + // whose hues `pk-mixed-change` drains). const changed = renderToStaticMarkup( createElement(EntityCard, { id: 'b', @@ -1198,7 +1199,7 @@ test('a card leads with its title, its kind above it, a subtitle under it and an emphasis: 1, }), ) - assert.match(changed, /