From cc0d8c6703864ac39d1ec2b09dd2aee1b1238250 Mon Sep 17 00:00:00 2001 From: Alex Gorischek Date: Wed, 2 Dec 2026 14:41:51 -0800 Subject: [PATCH 1/2] Agentic workflows and GitHub Actions on the kit's quiet text, and the starter's field changes as text Agentic workflow sections list entries as text, one per line, changes marked inline; an entry too long to read as old -> new reads as the old one leaving and the new one arriving. GitHub Actions draws its cards with the kit's header slots, Facts, ValueList and Slot, and its matrix with MatrixGrid. The custom renderer starter shows a changed field as ValueChange variant="text". Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- changelog.d/adopt-typography.md | 5 + packages/cli/templates/renderer/src/diff.tsx | 2 +- .../renderers/agentic-workflows/src/card.tsx | 33 ++-- .../agentic-workflows/src/styles.css | 5 +- .../browser/github-actions.spec.ts | 14 +- .../renderers/github-actions/src/header.tsx | 31 +-- packages/renderers/github-actions/src/job.tsx | 17 +- .../renderers/github-actions/src/matrix.tsx | 168 ++++++++--------- .../renderers/github-actions/src/styles.css | 178 ++---------------- .../github-actions/src/summary-line.tsx | 9 +- .../renderers/github-actions/src/text.tsx | 5 +- .../renderers/github-actions/src/trigger.tsx | 28 ++- .../renderers/github-actions/src/values.tsx | 77 +++----- .../test/github-actions.test.mjs | 16 +- 14 files changed, 202 insertions(+), 386 deletions(-) create mode 100644 changelog.d/adopt-typography.md diff --git a/changelog.d/adopt-typography.md b/changelog.d/adopt-typography.md new file mode 100644 index 000000000..f9368848c --- /dev/null +++ b/changelog.d/adopt-typography.md @@ -0,0 +1,5 @@ +--- +section: renderers +--- + +- **Agentic workflows and GitHub Actions switch to plain text**. Agentic workflow sections list entries one per line with added, removed, and changed items marked inline instead of as pills; changes too long for one old → new line split into separate removed and added lines. The GitHub Actions renderer uses the kit's header slots, `Facts`, `ValueList`, and `Slot` for cards, and `MatrixGrid` for its matrix. The custom renderer starter shows a changed field as text instead of two pills. diff --git a/packages/cli/templates/renderer/src/diff.tsx b/packages/cli/templates/renderer/src/diff.tsx index 762bd65eb..c72179318 100644 --- a/packages/cli/templates/renderer/src/diff.tsx +++ b/packages/cli/templates/renderer/src/diff.tsx @@ -97,7 +97,7 @@ export function DiffView(props: RendererProps) { {field ? ( diff --git a/packages/renderers/agentic-workflows/src/card.tsx b/packages/renderers/agentic-workflows/src/card.tsx index 25e27868e..8a72a998b 100644 --- a/packages/renderers/agentic-workflows/src/card.tsx +++ b/packages/renderers/agentic-workflows/src/card.tsx @@ -1,5 +1,5 @@ import {classifyChange, isChanged} from '@githubnext/projections-renderer-kit' -import {ChangePills, EntityCard, Icon, Prose, ValueChange, type PillItem} from '@githubnext/projections-renderer-kit/react' +import {EntityCard, Icon, Prose, ValueChange, ValueList, type ValueItem} from '@githubnext/projections-renderer-kit/react' import type {ReactNode} from 'react' import {dataOf} from './sections.js' import {asText, facts, lockText} from './facts.js' @@ -35,34 +35,32 @@ function Directions({directions, strength}: {directions: readonly Direction[]; s ) } -/** An entry's text as one run, so its words and code spans wrap together inside a pill. */ +/** An entry's text as one run, so its words and code spans wrap together. */ +/** The longest old and new text, together, that reads as one old → new line; longer ones read as two lines. */ +const inlineChange = 48 + const Words = ({children}: {children: string}) => ( {children} ) -/** The longest old and new text, together, that reads as one old → new pill; longer ones read as two pills. */ -const inlineChange = 48 - /** - * An entry as pills. In the diff, arriving or leaving entries take the pill's sign and hue, and one changed in place - * reads old → new, or, when that is too long for a line, as the old pill leaving and the new one arriving: the same - * pills at every emphasis, whose hue follows it. A side-by-side pane draws its own revision's entries, tinted while - * emphasized, one changed in place in the pane's hue (its pills' signs are hidden, so emphasis never moves anything). + * 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. */ -function pills(entry: Entry, side: Side, marked: boolean): PillItem[] { +function items(entry: Entry, side: Side, marked: boolean): ValueItem[] { const diff = side === 'diff' if (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 [ {key: `${entry.key}|was`, label: {entry.was}, change: 'removed'}, {key: entry.key, label: {entry.text}, change: 'added'}, ] } - return [ - {key: entry.key, label: {entry.was}} after={{entry.text}} />}, - ] + 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' @@ -82,7 +80,12 @@ function SectionRow({section, strength, frame}: {section: Section; strength: num
{shown.length ? ( - pills(entry, frame.side, strength > 0.01))} label={section.spec.title} /> + items(entry, frame.side, strength > 0.01))} + label={section.spec.title} + layout="stack" + sign={frame.side === 'diff'} + /> ) : ( {section.spec.empty} )} @@ -93,7 +96,7 @@ function SectionRow({section, strength, frame}: {section: Section; strength: num /** One fact of the meta line: in the diff, a fact that changed reads old → new. */ function Fact({was, now}: {was: ReactNode; now: ReactNode}) { - return was === undefined ? <>{now} : + return was === undefined ? <>{now} : } /** diff --git a/packages/renderers/agentic-workflows/src/styles.css b/packages/renderers/agentic-workflows/src/styles.css index 9667f8900..07c269d16 100644 --- a/packages/renderers/agentic-workflows/src/styles.css +++ b/packages/renderers/agentic-workflows/src/styles.css @@ -28,10 +28,7 @@ color: var(--muted); } /* A side-by-side pane tints the entries that differ from the other revision, without the diff's signs. */ -.aw-view:not([data-side='diff']) .pk-chip-sign { - display: none; -} -/* An entry's words and code spans wrap as one run inside its pill. */ +/* An entry's words and code spans wrap as one run. */ .aw-words { display: inline; min-width: 0; diff --git a/packages/renderers/github-actions/browser/github-actions.spec.ts b/packages/renderers/github-actions/browser/github-actions.spec.ts index e264d3614..79107d449 100644 --- a/packages/renderers/github-actions/browser/github-actions.spec.ts +++ b/packages/renderers/github-actions/browser/github-actions.spec.ts @@ -63,7 +63,7 @@ test('one revision draws the start, every job and the matrix as a grid of named const read = await layout(renderer) expect(read.cards.map(card => card.id).toSorted()).toEqual(['job:analyze', 'job:build', 'trigger:on']) expect(read.arrows).toBe(2) - const runs = renderer.frame.locator('[data-entity-id="job:build"] .gha-run') + const runs = renderer.frame.locator('[data-entity-id="job:build"] .pk-matrix-cell') await expect(runs).toHaveCount(6) await expect(runs.first()).toHaveAttribute('title', 'Build on windows-latest for 10.0 TransparentCompiler') await expect(renderer.frame.locator('[data-entity-id="trigger:on"]')).toContainText('nightly') @@ -74,17 +74,17 @@ test('the diff reads a matrix losing a dimension’s values as columns leaving, const renderer = await open(page, fixture('matrix/before'), fixture('matrix/after'), 'diff') await layout(renderer) const build = renderer.frame.locator('[data-entity-id="job:build"]') - await expect(build.locator('thead .gha-axis-value[data-change="removed"]')).toHaveCount(4) - await expect(build.locator('.gha-run[data-change="removed"]')).toHaveCount(12) - await expect(build.locator('.gha-run:not([data-change])')).toHaveCount(6) + await expect(build.locator('thead .pk-matrix-value[data-change="removed"]')).toHaveCount(4) + await expect(build.locator('.pk-matrix-cell[data-change="removed"]')).toHaveCount(12) + await expect(build.locator('.pk-matrix-cell:not([data-change])')).toHaveCount(6) const outline = await build - .locator('.gha-run[data-change="removed"]') + .locator('.pk-matrix-cell[data-change="removed"]') .first() .evaluate(cell => getComputedStyle(cell).outlineStyle) expect(outline).toBe('dashed') // Only removal is dashed: what stays, and an excluded gap, never is. const kept = await build - .locator('.gha-run:not([data-change])') + .locator('.pk-matrix-cell:not([data-change])') .first() .evaluate(cell => getComputedStyle(cell).outlineStyle) expect(kept).not.toBe('dashed') @@ -96,7 +96,7 @@ test('a pipeline’s needs are arrows, and its diff marks the jobs and needs tha expect(read.cards).toHaveLength(10) await expect(renderer.frame.locator('[data-entity-id="job:sign"][data-change="added"]')).toHaveCount(1) await expect(renderer.frame.locator('.gha-arrow[data-change="removed"]')).toHaveCount(2) - await expect(renderer.frame.locator('[data-entity-id="job:test"] .gha-vacant')).toHaveCount(1) + await expect(renderer.frame.locator('[data-entity-id="job:test"] .pk-matrix-cell[data-vacant]')).toHaveCount(1) await expect(renderer.frame.locator('[data-entity-id="job:build"] .gha-expression')).toContainText('fromJSON') }) diff --git a/packages/renderers/github-actions/src/header.tsx b/packages/renderers/github-actions/src/header.tsx index 2aad23595..c0f7670ad 100644 --- a/packages/renderers/github-actions/src/header.tsx +++ b/packages/renderers/github-actions/src/header.tsx @@ -1,26 +1,13 @@ -// A card's header, by role: its kind above, its name as the title, then a muted line of what sums it up. +// A card's subtitle: what sums it up, each part after a middot, for the kit card's `subtitle` slot. import type {ReactNode} from 'react' -/** The card's label: the kind (muted, small) above the title, as the graph's cards draw kind over name. */ -export function Title({kind, children}: {kind: string; children: ReactNode}) { - return ( - <> - {kind} - {children} - - ) -} - /** What sums the card up, under its title, each part after a middot: `6 runs · fail-fast off · times out after 40 min`. */ -export function Subtitle({parts}: {parts: readonly {key: string; node: ReactNode}[]}) { - if (!parts.length) return null - return ( -

- {parts.map(part => ( - - {part.node} - - ))} -

- ) +export function subtitle(parts: readonly {key: string; node: ReactNode}[]): ReactNode { + if (!parts.length) return undefined + return parts.map((part, index) => ( + + {index > 0 && ' · '} + {part.node} + + )) } diff --git a/packages/renderers/github-actions/src/job.tsx b/packages/renderers/github-actions/src/job.tsx index bc1581266..bc1275cb5 100644 --- a/packages/renderers/github-actions/src/job.tsx +++ b/packages/renderers/github-actions/src/job.tsx @@ -3,7 +3,7 @@ // its condition, environment, container and services), then its matrix's runs. import type {ReactNode} from 'react' import {classifyChange, isChanged} from '@githubnext/projections-renderer-kit' -import {EntityCard} from '@githubnext/projections-renderer-kit/react' +import {EntityCard, Facts as FactList} from '@githubnext/projections-renderer-kit/react' import type {Entity} from '@githubnext/projections-schemas' import {identifier, type EntityChange} from '@githubnext/projections-renderer-sdk/presentation' import {entries, hasExpression, jobData, revision, shortRef, type JobData} from './model.js' @@ -12,7 +12,7 @@ import {runnerKey} from './runs.js' import {Row, Single, Values, type Frame} from './values.js' import {Spelled, Template} from './text.js' import {Runs} from './matrix.js' -import {Subtitle, Title} from './header.js' +import {subtitle} from './header.js' import {MatrixFacts, plural, summary} from './summary-line.js' interface Item { @@ -83,7 +83,7 @@ function Steps({before, after, frame, strength}: {before: JobData; after: JobDat const words = (count: number) => (count > 0 ? `${items.length ? 'and ' : ''}${plural(count, 'run step', 'run steps')}` : undefined) return ( - {items.length > 0 && } + {items.length > 0 && } {counts && ( text} /> @@ -112,7 +112,7 @@ function Facts({ const items = entries(read(before), read(after), frame.side) return items.length ? ( - + ) : null } @@ -125,7 +125,7 @@ function Facts({ ) : null } return ( -
+ {single('Calls', job => job.uses, spelled)} {list('Runs on', runnerItems, runner)} @@ -137,7 +137,7 @@ function Facts({ {single('Environment', job => job.environment, spelled)} {single('Container', job => job.container, spelled)} {list('Services', job => job.services.map(name => ({key: name, text: name})))} -
+ ) } @@ -177,7 +177,9 @@ export function JobCard({row, frame}: {row: EntityChange; frame: Frame}) return ( {name}} + kind={kind(shown)} + label={name} + subtitle={subtitle(summary(view, before, after, frame, marked))} {...(entity.label !== key ? {identifier: key} : {})} selected={frame.props.selectedId === row.id} onSelect={frame.props.onSelect} @@ -188,7 +190,6 @@ export function JobCard({row, frame}: {row: EntityChange; frame: Frame}) // A modified job says what changed inside it; while it shows, the card stays neutral so change colors never nest. holdsChanges={changed && row.status === 'modified' && (frame.side === 'diff' || strength > 0.01)} > - {view?.kind === 'grid' && } diff --git a/packages/renderers/github-actions/src/matrix.tsx b/packages/renderers/github-actions/src/matrix.tsx index 9adefecb6..7dbe63cb1 100644 --- a/packages/renderers/github-actions/src/matrix.tsx +++ b/packages/renderers/github-actions/src/matrix.tsx @@ -1,42 +1,25 @@ -// A matrix: its run count and policy, the values every run shares, then its runs as a grid (or grids), and any runs -// `include` adds on their own. Dimension names are words, in the muted sans; values are monospace. +// A matrix: its runs as a grid (or grids) on the kit's `MatrixGrid`, each heading once and each run a mark or only what +// its row and column don't say, then any runs `include` adds on their own. Dimension names are words; values are code. import {identifier} from '@githubnext/projections-renderer-sdk/presentation' -import type {Axis, AxisValue, GridCell, MatrixView, Panel} from './grid.js' +import {MatrixGrid, type MatrixAxis, type MatrixCell} from '@githubnext/projections-renderer-kit/react' +import type {Axis, GridCell, MatrixView, Panel} from './grid.js' import {shownMark, spoken, type Frame} from './values.js' import {Spelled} from './text.js' /** A mark as the attribute that colors it, with the kit's change tokens. */ const changeAttribute = (mark: string) => (mark !== 'unchanged' ? {'data-change': mark} : {}) -function Header({value, frame, strength}: {value: AxisValue; frame: Frame; strength: number}) { - const shown = shownMark(value.mark, frame, strength) - return ( - - - {shown !== 'unchanged' && {spoken(shown)}} - {value.text} - - - ) -} +/** A run's whole name: its evaluated name (and Before's, when it changed), else what tells it apart. */ +const runName = (cell: GridCell) => + cell.name !== undefined ? `${cell.name}${cell.wasName !== undefined ? ` (was ${cell.wasName})` : ''}` : cell.label -/** One run: a quiet cell that says only what its row and column don't, its whole name on hover. */ -function Cell({cell, frame, strength}: {cell: GridCell | null; frame: Frame; strength: number}) { - if (!cell) { - return ( - - No run - - ) - } - const name = cell.name !== undefined ? `${cell.name}${cell.wasName !== undefined ? ` (was ${cell.wasName})` : ''}` : cell.label - // A run its row and column fully name shows a small mark, drawn as the cell's own background. - const marked = !cell.label && cell.runner === undefined - const shown = shownMark(cell.mark, frame, strength) +/** What a run shows beyond its row and column: its own values and the runner it asks for, if any. */ +function own(cell: GridCell) { + if (!cell.label && cell.runner === undefined) return undefined return ( - + {cell.label && ( - + )} @@ -45,91 +28,88 @@ function Cell({cell, frame, strength}: {cell: GridCell | null; frame: Frame; str )} + + ) +} + +/** 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 { + if (!cell) return null + const content = own(cell) + return {change: shownMark(cell.mark, frame, strength), 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) + return ( + + {own(cell)} {spoken(shown)} - {name || 'run'} + {runName(cell) || 'run'} ) } +const axisOf = (axis: Axis, frame: Frame, strength: number): MatrixAxis => ({ + name: axis.key, + code: true, + values: axis.values.map(value => ({key: value.text, change: shownMark(value.mark, frame, strength)})), +}) + function Grid({ panel, rows, columns, frame, strength, + job, }: { panel: Panel rows?: Axis | undefined columns?: Axis | undefined frame: Frame strength: number + job: string }) { - const values = new Map(rows?.values.map(value => [value.text, value])) + // One dimension across lays its values down the side instead. + const side = rows ?? columns + if (!side) return null + const across = rows ? columns : undefined + const cells = new Map(panel.rows.map(row => [row.key, new Map(row.cells.map(item => [item.key, item.cell]))])) + // With one dimension, a row holds one run: its row's only cell. + const find = (row: string, column: string | undefined) => { + const line = rows ? cells.get(row) : cells.get(panel.rows[0]?.key ?? '') + if (!line) return null + 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 caption = + panel.title.length > 0 ? ( + + {shown !== 'unchanged' && {spoken(shown)}} + {panel.title.map(item => ( + + {item.key}{' '} + + {item.value.text} + + + ))} + + ) : undefined return ( -
- {panel.title.length > 0 && ( -
- {shown !== 'unchanged' && {spoken(shown)}} - {panel.title.map(item => ( - - {item.key}{' '} - - {item.value.text} - - - ))} -
- )} - - {/* One axis across: its name over the values; two: both names in the corner (`os × compiler`). */} - {columns && !rows && } - {columns && ( - - - {rows && ( - - )} - {columns.values.map(value => ( - - ))} - - - )} - - {!columns && rows && ( - - - - )} - {panel.rows.map(row => { - const value = values.get(row.key) - return ( - - {rows && value && ( - - )} - {row.cells.map(item => ( - - ))} - - ) - })} - -
{columns.key}
- {rows.key} × {columns.key} - -
-
- {rows.key} -
-
-
- -
-
+ cellOf(find(row, column), frame, strength)} + vacant="No run: this combination is excluded" + {...(caption ? {caption} : {})} + /> ) } @@ -149,11 +129,11 @@ export function Runs({ return (
{view.panels.map(panel => ( - + ))} {view.extra.length > 0 && (
- {view.panels.length > 0 && Added by include} + {view.panels.length > 0 && Added by include}
    {view.extra.map(cell => (
  • diff --git a/packages/renderers/github-actions/src/styles.css b/packages/renderers/github-actions/src/styles.css index 232b6400e..5b6cd2c6c 100644 --- a/packages/renderers/github-actions/src/styles.css +++ b/packages/renderers/github-actions/src/styles.css @@ -52,31 +52,6 @@ .gha-node .pk-entity-card-select { padding-top: var(--projections-space-3); } -/* The kind above the title, as graph cards draw it; the title one step up from the body and semibold. */ -.gha-node .pk-entity-card-label { - display: flex; - flex-direction: column; - gap: 2px; -} -.gha-kind { - color: var(--muted); - font-size: var(--projections-font-size-xs); - font-weight: var(--projections-font-weight-normal); -} -.gha-title { - font-size: var(--projections-font-size); - line-height: var(--projections-line-height-tight); -} -.gha-subtitle { - margin: var(--projections-space-1) 0 0; - padding: 0 var(--projections-space-3); - color: var(--muted); - font-size: var(--projections-font-size-xs); -} -.gha-subtitle-part + .gha-subtitle-part::before { - content: '·'; - margin: 0 var(--projections-space-2); -} /* * A card keeps its surface in every state: a change's tint is layered over it, never put in its place (a card that * holds its changes drains the tint to transparent, which would otherwise show the stage through it). @@ -134,13 +109,6 @@ .gha-quiet { color: var(--muted); } -.gha-dimension { - color: var(--muted); - font-family: var(--projections-font-family); - font-size: var(--projections-font-size-xs); - font-weight: var(--projections-font-weight-normal); - text-align: start; -} /* What only a run can evaluate: kept as written, set apart in the muted ink, never as a change. */ .gha-expression { color: var(--muted); @@ -151,86 +119,23 @@ font-family: var(--projections-font-family); font-size: inherit; } -.gha-placeholder { - color: var(--muted); - font-family: var(--font-mono); - font-size: calc(1em - 1px); -} .gha-note { color: var(--muted); font-size: var(--projections-font-size-xs); } -.gha-values + .gha-note { +.pk-value-list + .gha-note { margin-left: var(--projections-space-1); } .gha-pair-key { color: var(--muted); } -/* Facts: name and value on one baseline, the names in a column of their own. */ +/* Facts (the kit's `Facts`, which sets them in from the card's sides): at a readable width, the runs a step below. */ .gha-facts { - display: grid; - grid-template-columns: max-content minmax(0, 1fr); - gap: var(--projections-space-1) var(--projections-space-3); - align-items: baseline; max-width: 44rem; - margin: 0; - padding: var(--projections-space-3); } -.gha-fact { - display: contents; -} -.gha-fact > dt { - color: var(--muted); -} -.gha-fact > dd { - margin: 0; - min-width: 0; -} - -/* A list of values: comma-separated on a line, or one per line. */ -.gha-values { - display: inline; -} -.gha-values[data-separator='comma']:not(.gha-list) > .gha-item + .gha-item::before { - content: ', '; - color: var(--muted); -} -.gha-values[data-separator='dot'] > .gha-item + .gha-item::before { - content: ' · '; - color: var(--muted); -} -.gha-list { - display: flex; - flex-direction: column; - gap: 2px; -} -.gha-list > .gha-values { - display: contents; -} -.gha-value { - text-decoration: none; -} -/* A value that arrives or leaves: its change's ink on the text, a sign before it; one that leaves is struck through. */ -/* Arriving: in the change's ink, after its sign. Leaving: struck through in its ink. */ -.gha-value[data-change-hue] { - color: color-mix(in srgb, var(--pk-change-ink) calc(var(--emphasis, 1) * 100%), currentcolor); -} -del.gha-value { - text-decoration: line-through; -} -.gha-sign { - margin-right: 2px; - font-family: var(--font-mono); -} -.gha-value-change { - display: inline-flex; - flex-wrap: wrap; - align-items: baseline; - gap: 0 var(--projections-space-1); -} -.gha-arrow-text { - color: var(--muted); +.gha-facts + .gha-matrix { + margin-top: var(--projections-space-3); } /* Events: each event's name, then its filters, indented under it. */ @@ -268,55 +173,21 @@ del.gha-value { margin: 0 var(--projections-space-3) var(--projections-space-3); } -/* A grid of runs: dimension names in words, values in monospace, each run a small quiet region. */ -.gha-panel { - margin: 0; - border-radius: var(--projections-radius-sm); -} -.gha-panel.pk-region[data-change='removed'] { - box-shadow: none; - outline: var(--stroke) dashed color-mix(in srgb, var(--pk-region-edge) calc(var(--emphasis, 1) * 100%), transparent); - outline-offset: var(--projections-space-1); -} +/* A matrix's caption (one grid of several), a change region when its combination arrives or leaves. */ .gha-panel-title { - margin: 0 0 var(--projections-space-1); -} -.gha-grid { - border-collapse: separate; - border-spacing: var(--projections-space-1); - margin: 0; -} -.gha-grid th { - padding: 0 var(--projections-space-2) 0 0; - font-weight: var(--projections-font-weight-normal); - text-align: start; - vertical-align: middle; - white-space: nowrap; -} -.gha-grid thead th { - padding-bottom: 2px; -} -.gha-grid caption { - padding-bottom: 2px; -} -.gha-grid td { - padding: 0; - vertical-align: middle; -} -/* A value flush with its dimension's name; a changed one takes a small region whose inset never moves its text. */ -.gha-axis-value { - display: inline-flex; border-radius: var(--projections-radius-sm); } -.gha-axis-value[data-change] { - margin: 0 calc(-1 * var(--projections-space-1)); - padding: 0 var(--projections-space-1); -} -/* Column values sit centered over their cells; row values start the line. */ -.gha-grid thead th:not(.gha-dimension) { - padding: 0 var(--projections-space-2) 2px; - text-align: center; +/* What a run shows beyond its row and column: its own values, then its runner, quieter. */ +.gha-run-own { + display: flex; + flex-direction: column; + align-items: center; + gap: 2px; + font-family: var(--font-mono); + font-size: calc(1em - 1px); + line-height: var(--projections-line-height-tight); } +/* A run `include` adds of its own, beside the grids. */ .gha-run { display: flex; flex-direction: column; @@ -335,26 +206,11 @@ del.gha-value { line-height: var(--projections-line-height-tight); white-space: nowrap; } -/* A run its row and column fully name: a small mark, its name on hover. */ -/* A run its row and column fully name: a small mark, drawn as the cell's background so it centres at any zoom. */ -.gha-run-marked { - background-image: radial-gradient(circle, var(--subtle) 2.5px, transparent 3px); - background-position: center; - background-repeat: no-repeat; -} -.gha-run-marked[data-change] { - background-image: radial-gradient(circle, var(--pk-change-ink) 2.5px, transparent 3px); -} .gha-run-runner { color: var(--muted); } -/* No run here: an excluded combination, on the kit's vacant hatch (a fill, never an edge). */ -.gha-run.gha-vacant { - background: var(--pk-vacant); - box-shadow: none; -} -/* Removed regions are dashed, and only they are. */ -.gha-matrix .pk-region[data-change='removed']:not(.gha-panel) { +/* Removed runs `include` adds are dashed, and only they are. */ +.gha-extra .pk-region[data-change='removed'] { box-shadow: none; outline: var(--stroke) dashed color-mix(in srgb, var(--pk-region-edge) calc(var(--emphasis, 1) * 100%), transparent); outline-offset: calc(-1 * var(--stroke)); diff --git a/packages/renderers/github-actions/src/summary-line.tsx b/packages/renderers/github-actions/src/summary-line.tsx index 980607a2e..1fabbeaf0 100644 --- a/packages/renderers/github-actions/src/summary-line.tsx +++ b/packages/renderers/github-actions/src/summary-line.tsx @@ -38,7 +38,7 @@ export function MatrixFacts({view, frame, strength}: {view: MatrixView | undefin if (view.kind === 'exceeds') { return ( - {' '} + {' '} more than {view.limit} runs, not expanded ) @@ -51,7 +51,7 @@ export function MatrixFacts({view, frame, strength}: {view: MatrixView | undefin })) return ( - + ) } @@ -73,7 +73,10 @@ export function summary(view: MatrixView | undefined, before: JobData, after: Jo }) } if (view && view.policy.length > 0) { - parts.push({key: 'policy', node: {text}} />}) + parts.push({ + key: 'policy', + node: {text}} label="Policy" />, + }) } if (timeout(before) !== undefined || timeout(after) !== undefined) { parts.push({ diff --git a/packages/renderers/github-actions/src/text.tsx b/packages/renderers/github-actions/src/text.tsx index 6617314a4..555c53666 100644 --- a/packages/renderers/github-actions/src/text.tsx +++ b/packages/renderers/github-actions/src/text.tsx @@ -1,5 +1,6 @@ // Text that may hold expressions: what a run evaluates is drawn as code, never guessed. import {identifier} from '@githubnext/projections-renderer-sdk/presentation' +import {Slot} from '@githubnext/projections-renderer-kit/react' import {hasExpression} from './model.js' /** A text cut where `pattern` (with one capture group) matches, each part with its offset, which keys it. */ @@ -41,9 +42,9 @@ export function Template({text}: {text: string}) { {parts(text, placeholder).map(part => { const key = part.match ? /matrix\.([\w-]+)/u.exec(part.text)?.[1] : undefined return key !== undefined ? ( - + {key} - + ) : ( ) diff --git a/packages/renderers/github-actions/src/trigger.tsx b/packages/renderers/github-actions/src/trigger.tsx index 15c67df07..852288c9d 100644 --- a/packages/renderers/github-actions/src/trigger.tsx +++ b/packages/renderers/github-actions/src/trigger.tsx @@ -5,7 +5,6 @@ import type {Entity} from '@githubnext/projections-schemas' import type {EntityChange} from '@githubnext/projections-renderer-sdk/presentation' import {entries, triggerEvents, type Entry, type TriggerEvent} from './model.js' import {code, Single, Value, Values, type Frame} from './values.js' -import {Title} from './header.js' /** Filters in words. */ const filterWords: Readonly> = { @@ -77,7 +76,7 @@ function Event({ return items.length ? (
    {filterWords[key] ?? key} - +
    ) : null })} @@ -100,20 +99,19 @@ export function TriggerCard({row, frame}: {row: EntityChange; frame: Fra return ( - {row.before && row.after && before.workflow !== after.workflow ? ( - text} - /> - ) : ( - (shown.workflow ?? 'Workflow') - )} - + row.before && row.after && before.workflow !== after.workflow ? ( + text} + /> + ) : ( + (shown.workflow ?? 'Workflow') + ) } selected={frame.props.selectedId === row.id} onSelect={frame.props.onSelect} diff --git a/packages/renderers/github-actions/src/values.tsx b/packages/renderers/github-actions/src/values.tsx index 7533eaf9d..a71821373 100644 --- a/packages/renderers/github-actions/src/values.tsx +++ b/packages/renderers/github-actions/src/values.tsx @@ -1,11 +1,10 @@ // 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. import type {ReactNode} from 'react' -import type {RendererProps} from '@githubnext/projections-renderer-kit/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 type {Entry, Mark, Side} from './model.js' -import type {Style} from './stage.js' /** What every card reads: the host's props, the revision shown and how strongly a change shows. */ export interface Frame { @@ -29,49 +28,27 @@ export const code = (text: string) => ( ) -const signs: Partial> = {added: '+', removed: '−'} const words: Partial> = {added: 'added: ', removed: 'removed: '} /** A shown mark in words, for assistive technology: what color and dashes say. */ export const spoken = (mark: Mark) => (mark === 'unchanged' ? '' : (words[mark] ?? 'changed: ')) -/** One value, marked: its sign in the diff (a pane hides it), its change in words for assistive technology. */ +/** 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) - if (shown === 'unchanged') return {children} - const Tag = shown === 'removed' ? 'del' : shown === 'added' ? 'ins' : 'span' - // The diff always marks a change; with highlighting off its hue fades to neutral. - const style: Style = {'--emphasis': frame.side === 'diff' ? frame.props.highlighting : strength} return ( - - {spoken(shown)} - {frame.side === 'diff' && signs[shown] !== undefined && ( - - )} + {children} - + ) } -/** A value that changed in place: the old one struck through, then the new one. */ +/** A value that changed in place, as text: the old one struck through, then the new one. */ export function Changed({before, after}: {before: ReactNode; after: ReactNode}) { - return ( - - - was - {before} - - - - , now - {after} - - - ) + return } /** One entry as it reads in this frame: old → new in the diff when it changed in place, else marked. */ @@ -96,14 +73,15 @@ export function EntryValue({ ) } -/** Entries as text: on one line, comma-separated, or one per line. */ +/** Entries as text (the kit's `ValueList`): on one line, comma-separated, or one per line. */ export function Values({ items, frame, strength, - render, + render = code, list = false, separator = ',', + label, }: { items: readonly Entry[] frame: Frame @@ -112,26 +90,29 @@ export function Values({ list?: boolean /** Between items on a line: a comma, or a middot for pairs that hold spaces of their own. */ separator?: ',' | '·' + /** The list's accessible name. */ + label: string }) { + 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)}, + ) return ( - - {items.map(entry => ( - - - - ))} - + ) } -/** One fact of a card: its name, then its value, on one baseline. */ +/** One fact of a card (the kit's `Fact`): its name, then its value, on one baseline. */ export function Row({title, children}: {title: string; children: ReactNode}) { - return ( -
    -
    {title}
    -
    {children}
    -
    - ) + return {children} } /** One value that may change: old → new in the diff, the side's own in a pane. */ diff --git a/packages/renderers/github-actions/test/github-actions.test.mjs b/packages/renderers/github-actions/test/github-actions.test.mjs index 1d4cd0495..83bc993a6 100644 --- a/packages/renderers/github-actions/test/github-actions.test.mjs +++ b/packages/renderers/github-actions/test/github-actions.test.mjs @@ -148,7 +148,7 @@ test('cards say what starts the workflow, what each job runs on and uses, and it assert.match(build, /6 runs/u) assert.match(build, /title="Build on macos-15 for 10.0 TransparentCompiler"/u) // The name only a run can spell is shown as its pattern, the matrix values as placeholders. - assert.match(build, /class="gha-placeholder"[^>]*>os]*>os { @@ -273,7 +273,7 @@ test('filters keep every pattern in order: a repeated one can leave, and a reord const row = model.entities.find(item => item.id === 'trigger:on') const markup = renderToStaticMarkup(createElement(TriggerCard, {row, frame})) const marked = tag => - [...markup.matchAll(new RegExp(`<${tag} class="gha-value"[^>]*>.*?]*>([^<]*)`, 'gu'))].map(match => match[1]) + [...markup.matchAll(new RegExp(`<${tag} class="pk-value-mark"[^>]*>.*?]*>([^<]*)`, 'gu'))].map(match => match[1]) assert.deepEqual(marked('del'), ['main', 'nightly', 'src/**']) assert.deepEqual(marked('ins'), ['nightly', 'main']) }) @@ -284,9 +284,10 @@ test('with highlighting off the diff still marks a change, its hue faded to neut 0, ) const row = model.entities.find(item => item.id === 'trigger:on') + const markup = renderToStaticMarkup(createElement(TriggerCard, {row, frame})) assert.match( - renderToStaticMarkup(createElement(TriggerCard, {row, frame})), - //u, + markup, + /
      ]*style="--emphasis:0">
    • .*?/u, ) }) @@ -309,9 +310,12 @@ test('a matrix diff says in words which runs and values leave', async () => { const markup = renderToStaticMarkup(createElement(JobCard, {row: model.entities.find(item => item.id === 'job:build'), frame})) assert.match( markup, - /]*>removed: <\/span>/u, + /Removed: <\/span>/u, + ) + assert.match( + markup, + /]* data-change="removed">(?:Removed: /u, ) - assert.match(markup, /data-change="removed"[^>]*>(?:(?!<\/span><\/span>).)*removed: /u) }) /** A laid-out graph: a trigger over job `a` (the arrow's end at 200, off the trigger's middle), and `b` beside it. */ From 045ef346a0bc248b36180084eacf8ea3bb069b48 Mon Sep 17 00:00:00 2001 From: Alex Gorischek Date: Wed, 2 Dec 2026 21:01:58 -0800 Subject: [PATCH 2/2] Value signs stay, muted, with highlighting off; a removed include run is struck through; the agentic-workflows suite reads value marks Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- docs/guides/renderer-kit-type.md | 13 +++++++------ .../browser/agentic-workflows.spec.ts | 19 +++++++++++-------- .../renderers/github-actions/src/matrix.tsx | 2 +- packages/renderers/kit/styles/facts.css | 7 ++++--- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/docs/guides/renderer-kit-type.md b/docs/guides/renderer-kit-type.md index 87a58247c..15fd77fda 100644 --- a/docs/guides/renderer-kit-type.md +++ b/docs/guides/renderer-kit-type.md @@ -42,12 +42,13 @@ and `Field` are the same list with `labelFont="code"` for raw data keys. `separator="dot"`) and wrapping between items, or stacked one per line (`layout="stack"`). Added items appear in the added hue after `+`, removed items are struck through in the removed hue after `−`, and changed items show the old -value (`was`) struck through, an arrow, and the new value. Marks fade with -`emphasis` (inheriting the surrounding item's when omitted) and are announced in -words. Items are unboxed by default; `display="chips"` renders them as chips -(`ChangePills`) for small or selectable sets. `ValueMark` marks one value the -same way, and `ValueChange variant="text"` renders a single value change without -pills. +value (`was`) struck through, an arrow, and the new value. The hue and +strikethrough fade with `emphasis`, which inherits from the surrounding item +when omitted. At zero emphasis, the sign stays visible in a muted color, as it +does on a chip. Marks are announced in words to assistive technology. Items are +unboxed by default; `display="chips"` renders them as chips (`ChangePills`) for +small or selectable sets. `ValueMark` marks one value the same way, and +`ValueChange variant="text"` renders a single value change without pills. ## Quiet text pieces diff --git a/packages/renderers/agentic-workflows/browser/agentic-workflows.spec.ts b/packages/renderers/agentic-workflows/browser/agentic-workflows.spec.ts index 16ee1e618..d5b8ce666 100644 --- a/packages/renderers/agentic-workflows/browser/agentic-workflows.spec.ts +++ b/packages/renderers/agentic-workflows/browser/agentic-workflows.spec.ts @@ -86,13 +86,16 @@ test('the diff draws each workflow once in its group, with each section’s dire const card = renderer.frame.locator(`[data-entity-id="${bot}"]`) const section = (id: string) => card.locator(`.aw-section[data-section="${id}"]`) await expect(section('loads').locator('.aw-direction')).toHaveText('Widened') - await expect(section('loads').locator('.pk-chip[data-change="removed"]')).toContainText('skills/check-links') - await expect(section('repos').locator('.pk-chip[data-change="added"]')).toHaveText(/octo-org\/docs-site/u) - // A limit that moves reads old → new: in one pill when short, as the old pill leaving and the new arriving when not. + await expect(section('loads').locator('.pk-value-mark[data-change="removed"]')).toContainText('skills/check-links') + await expect(section('repos').locator('.pk-value-mark[data-change="added"]')).toHaveText(/octo-org\/docs-site/u) + // Entries are text marked inline, each with its sign, not chips. + await expect(section('repos').locator('.pk-value-mark[data-change="added"] .pk-value-sign')).toHaveText('+') + await expect(card.locator('.pk-chip')).toHaveCount(0) + // A limit that moves reads old → new: on one line when short, as the old value leaving and the new arriving when not. const examples = renderer.frame.locator('[data-entity-id="workflow:.github/workflows/docs-bot-examples.md"]') await expect(examples.locator('.aw-section[data-section="budgets"] .pk-value-change')).toHaveText(/60 min.*30 min/u) - await expect(section('budgets').locator('.pk-chip[data-change="removed"]')).toHaveText(/2,000/u) - await expect(section('budgets').locator('.pk-chip[data-change="added"]')).toHaveText(/5,000/u) + await expect(section('budgets').locator('.pk-value-mark[data-change="removed"]')).toHaveText(/2,000/u) + await expect(section('budgets').locator('.pk-value-mark[data-change="added"]')).toHaveText(/5,000/u) // A lock state that changes reads old → new on the card's meta line. const lock = renderer.frame.locator(`[data-entity-id="${triage}"] .aw-meta .pk-value-change`) await expect(lock.locator('[data-change="removed"] .aw-lock')).toHaveText('Lock current') @@ -106,8 +109,8 @@ test('side by side, each pane draws its own revision without the diff’s signs, const renderer = await open(page, {comparison, mode: 'after'}) await layout(renderer) const card = renderer.frame.locator(`[data-entity-id="${bot}"]`) - await expect(card.locator('.aw-section[data-section="loads"] .pk-chip')).not.toContainText(['check-links']) - await expect(card.locator('.pk-chip-sign').first()).toBeHidden() + await expect(card.locator('.aw-section[data-section="loads"] .pk-value-item')).not.toContainText(['check-links']) + await expect(card.locator('.pk-value-sign')).toHaveCount(0) await renderer.seek(1, {highlighting: 0}) await expect(card.locator('.aw-direction')).toHaveCount(0) }) @@ -118,7 +121,7 @@ test('the default comparator still marks every entry, without directions', async await expect.poll(() => facts(renderer)).toEqual(['1 lock file out of date']) const card = renderer.frame.locator(`[data-entity-id="${bot}"]`) await expect(card.locator('.aw-direction')).toHaveCount(0) - await expect(card.locator('.pk-chip[data-change="added"]').first()).toBeVisible() + await expect(card.locator('.pk-value-mark[data-change="added"]').first()).toBeVisible() }) test('the matrix marks capabilities that arrive and leave, and selects a workflow from its row', async ({page}) => { diff --git a/packages/renderers/github-actions/src/matrix.tsx b/packages/renderers/github-actions/src/matrix.tsx index 7dbe63cb1..7ae461567 100644 --- a/packages/renderers/github-actions/src/matrix.tsx +++ b/packages/renderers/github-actions/src/matrix.tsx @@ -19,7 +19,7 @@ function own(cell: GridCell) { return ( {cell.label && ( - + )} diff --git a/packages/renderers/kit/styles/facts.css b/packages/renderers/kit/styles/facts.css index 58284469b..fd14eff6b 100644 --- a/packages/renderers/kit/styles/facts.css +++ b/packages/renderers/kit/styles/facts.css @@ -2,8 +2,8 @@ * Facts (`Facts`, `Fact`, and `Fields` on the same rules): a key-value list, the labels muted in a column of their own * so every value starts at the same place, each row on one baseline. Value lists (`ValueList`) and text value changes * (`ValueChange variant="text"`): values as text, a changed one marked inline in its change's hue (`--pk-change-ink`) - * with its sign, struck through when it leaves, all fading with `--emphasis` so a change at an endpoint reads plain. No - * value is boxed. + * with its sign, struck through when it leaves. The hue and strike fade with `--emphasis`, so a change at an endpoint + * reads plain; the sign stays, muted. No value is boxed. */ .pk .pk-facts { display: grid; @@ -79,11 +79,12 @@ text-decoration: line-through; text-decoration-color: color-mix(in srgb, currentcolor calc(var(--emphasis, 1) * 100%), transparent); } +/* A sign stays when highlighting is off, muted, as a chip's does, so a change never rests on its hue and strike alone. */ .pk .pk-value-sign { margin-inline-end: 2px; font-family: var(--font-mono); font-weight: var(--projections-font-weight-semibold); - opacity: var(--emphasis, 1); + color: color-mix(in srgb, var(--pk-change-ink) calc(var(--emphasis, 1) * 100%), var(--muted)); } .pk .pk-value-change[data-variant='text'] { display: inline;