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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .change-hues.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Change hues that renderers built on the kit name themselves, intended (tools/scripts/check-change-hues.mjs, run by
# npm run check:change-hues). A change is colored through the kit's change marks; an entry is for a hue that is
# categorical rather than a change. Each entry excuses its file and says why. An entry that no longer matches fails.
allow: []
Comment thread
agorischek marked this conversation as resolved.
Resolved
4 changes: 4 additions & 0 deletions .dollarlint.toml
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ schema = "https://www.schemastore.org/github-workflow.json#/definitions/normalJo
file = ".portability.yaml"
schema = "./packages/schemas/internal/portability.json"

[[schemas.associations]]
file = ".change-hues.yaml"
schema = "./packages/schemas/internal/change-hues.json"

[[schemas.associations]]
file = "packages/engine/verified/verus.toml"
schema = "./packages/schemas/internal/verus.json"
Expand Down
9 changes: 9 additions & 0 deletions docs/guides/develop-a-renderer.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,15 @@ what broke and where), or skipped:
their card or row. Nested parts should be tinted rather than outlined.
- **No change colors inside change colors** — Color only the innermost changed
elements. A container that displays changes inside it stays neutral.
- **Change hues only through the kit** — A renderer built on the kit never names
a change hue (`--green`, `--red-soft`, `--projections-color-added`, …). It
marks the item with its change (`changeMark`: `data-change`, or `pk-region`),
or a part of one (a value's old and new text, an inserted word) with
`data-change-hue`, and reads `--pk-change-ink`, `--pk-change-strong`,
`--pk-change-highlight`, `--pk-region-fill` or `--pk-region-edge`, which
follow the kit's nesting rule. `npm run check:change-hues` holds this
repository's renderers to it; a hue that is categorical rather than a change
is a reasoned entry in `.change-hues.yaml`.
- **Rounded edges drawn over their contents** — A rounded, bordered box whose
fills reach its corners draws its border again over them (the kit's
`pk-frame`, or a `Group`), so its corners are never thinner than its sides.
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"check:boundaries": "node --test tools/scripts/engine-contracts.test.mjs && node tools/scripts/check-boundaries.mjs",
"check:casing": "node tools/scripts/check-casing.mjs",
"check:portability": "node --test tools/scripts/check-portability.test.mjs && node tools/scripts/check-portability.mjs",
"check:change-hues": "node --test tools/scripts/check-change-hues.test.mjs && node tools/scripts/check-change-hues.mjs",
"check:lockfile": "node tools/scripts/lockfile-registry.mjs",
"check:advisories": "node tools/scripts/osv-scan.mjs --allow RUSTSEC-2020-0163 --allow RUSTSEC-2026-0543 --allow RUSTSEC-2026-0555 --allow RUSTSEC-2026-0559 --allow GHSA-fc5q-39xc-vjpf",
"check:readmes": "node tools/cli/src/bin.ts check --only readmes",
Expand All @@ -61,7 +62,7 @@
"check:versions": "node tools/cli/src/bin.ts version",
"considered": "node tools/scripts/considered.mjs",
"check": "npm run check:no-test && npm test",
"check:no-test": "npm run check:boundaries && npm run check:casing && npm run check:portability && npm run check:readmes && npm run check:links && npm run check:icons && npm run check:considered && npm run check:machines && npm run check:tsdoc && npm run check:versions && npm run check:lockfile && npm run format:check && npm run build && npm run check:notices && npm run check:comparators && npm run typecheck && npm run lint",
"check:no-test": "npm run check:boundaries && npm run check:casing && npm run check:portability && npm run check:change-hues && npm run check:readmes && npm run check:links && npm run check:icons && npm run check:considered && npm run check:machines && npm run check:tsdoc && npm run check:versions && npm run check:lockfile && npm run format:check && npm run build && npm run check:notices && npm run check:comparators && npm run typecheck && npm run lint",
"storybook": "npm run storybook --workspace @githubnext/projections-storybook",
"docs:generate": "node tools/scripts/reference-docs.mjs",
"docs:check": "node tools/scripts/reference-docs.mjs --check",
Expand Down
8 changes: 7 additions & 1 deletion packages/renderers/agentic-workflows/src/card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ function Directions({directions, strength}: {directions: readonly Direction[]; s
return (
<span className="aw-directions">
{directions.map(direction => (
<span key={direction} className="aw-direction" data-direction={direction} style={{opacity: Math.min(1, strength)}}>
<span
key={direction}
className="aw-direction"
data-direction={direction}
{...(direction === 'widened' ? {'data-change-hue': 'modified'} : {})}
style={{opacity: Math.min(1, strength)}}
>
<Icon name={direction === 'widened' ? 'warning' : direction === 'narrowed' ? 'info' : 'changed'} className="aw-icon" />
{directionWords[direction]}
</span>
Expand Down
7 changes: 6 additions & 1 deletion packages/renderers/agentic-workflows/src/matrix.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ function Row({item, view, frame}: {item: WorkflowItem; view: AgenticModel; frame
category.columns.map(column => {
const value = cell(item, category, column, frame)
return (
<td key={`${category.section}:${column.key}`} className="aw-matrix-cell" data-cell={value}>
<td
key={`${category.section}:${column.key}`}
className="aw-matrix-cell"
data-cell={value}
{...(value === 'added' || value === 'removed' ? {'data-change-hue': value} : {})}
>
<span className="aw-matrix-glyph" aria-hidden="true">
<span className="pk-label">{glyphs[value]}</span>
</span>
Expand Down
12 changes: 4 additions & 8 deletions packages/renderers/agentic-workflows/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
gap: var(--projections-space-1);
}
.aw-direction[data-direction='widened'] {
color: var(--amber-strong);
color: var(--pk-change-strong);
}
.aw-direction[data-direction='narrowed'],
.aw-direction[data-direction='changed'] {
Expand Down Expand Up @@ -268,13 +268,9 @@
color: var(--muted);
}
/* An arriving or leaving capability: its sign, in its hue as the change is emphasized. */
.aw-matrix-cell[data-cell='added'] {
background: color-mix(in srgb, var(--green-soft) calc(var(--emphasis, 0) * 100%), transparent);
color: color-mix(in srgb, var(--green-strong) calc(var(--emphasis, 0) * 100%), var(--text));
}
.aw-matrix-cell[data-cell='removed'] {
background: color-mix(in srgb, var(--red-soft) calc(var(--emphasis, 0) * 100%), transparent);
color: color-mix(in srgb, var(--red-strong) calc(var(--emphasis, 0) * 100%), var(--text));
.aw-matrix-cell[data-change-hue] {
background: color-mix(in srgb, var(--pk-region-fill) calc(var(--emphasis, 0) * 100%), transparent);
color: color-mix(in srgb, var(--pk-change-strong) calc(var(--emphasis, 0) * 100%), var(--text));
}
.aw-matrix-workflow:hover {
background-image: linear-gradient(var(--hover), var(--hover));
Expand Down
10 changes: 7 additions & 3 deletions packages/renderers/api/src/signature-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const toneMarks: Record<Tone, string> = {added: '+', removed: '−'}
/** One signature line; a toned line carries a `+` or `−` marker in its gutter. */
function Line({tone, children}: {tone?: Tone | undefined; children: ReactNode}) {
return (
<pre className={`api-signature pk-label${tone ? ` ${tone}` : ''}`} {...identifier}>
<pre className={`api-signature pk-label${tone ? ` ${tone}` : ''}`} {...(tone ? {'data-change-hue': tone} : {})} {...identifier}>
{tone && (
<span className="api-line-mark pk-label" aria-hidden="true">
{toneMarks[tone]}
Expand All @@ -29,9 +29,13 @@ function Marked({tokens}: {tokens: Token[]}) {

const segmentElement = (segment: Segment, index: number) =>
segment.kind === 'removed' ? (
<del key={index}>{segment.text}</del>
<del key={index} data-change-hue="removed">
{segment.text}
</del>
) : segment.kind === 'added' ? (
<ins key={index}>{segment.text}</ins>
<ins key={index} data-change-hue="added">
{segment.text}
</ins>
) : (
<span key={index}>{segment.text}</span>
)
Expand Down
27 changes: 8 additions & 19 deletions packages/renderers/api/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -150,27 +150,16 @@

/* Change emphasis: line tints, run highlights and colored markers. Without highlighting the same content stays, neutral. */
/* A tinted line always has its edge in the same hue (the kit's change-region pairing), never a fill alone. */
[data-highlighting='on'] .api-signature.added {
background: var(--green-soft);
box-shadow: inset 0 0 0 var(--projections-border-width) var(--green-border);
[data-highlighting='on'] .api-signature[data-change-hue] {
background: var(--pk-region-fill);
box-shadow: inset 0 0 0 var(--projections-border-width) var(--pk-region-edge);
}
[data-highlighting='on'] .api-signature.removed {
background: var(--red-soft);
box-shadow: inset 0 0 0 var(--projections-border-width) var(--red-border);
[data-highlighting='on'] .api-signature[data-change-hue] .api-line-mark {
color: var(--pk-change-ink);
}
[data-highlighting='on'] .api-signature.added .api-line-mark {
color: var(--green);
}
[data-highlighting='on'] .api-signature.removed .api-line-mark {
color: var(--red);
}
[data-highlighting='on'] .api-signature.added mark,
[data-highlighting='on'] .api-signature ins {
background: var(--green-highlight);
}
[data-highlighting='on'] .api-signature.removed mark,
[data-highlighting='on'] .api-signature del {
background: var(--red-highlight);
[data-highlighting='on'] .api-signature[data-change-hue] mark,
[data-highlighting='on'] .api-signature :is(ins, del) {
background: var(--pk-change-highlight);
}
/* Changed runs never rest on color alone: removed text is struck, added and marked text underlined. */
.api-signature :is(ins, mark) {
Expand Down
17 changes: 10 additions & 7 deletions packages/renderers/api/test/api.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -140,23 +140,23 @@ test('the diff renders every change with its status footer and signature diff, a
assert.equal(statusOf(rows.added), 'Added')
assert.match(
rows.added,
/class="api-signature pk-label added" data-projections-identifier=""><span class="api-line-mark pk-label" aria-hidden="true">\+<\/span>added\(\): void/u,
/class="api-signature pk-label added" data-change-hue="added" data-projections-identifier=""><span class="api-line-mark pk-label" aria-hidden="true">\+<\/span>added\(\): void/u,
)
assert.equal(statusOf(rows.legacy), 'Removed')
assert.match(
rows.legacy,
/class="api-signature pk-label removed" data-projections-identifier=""><span class="api-line-mark pk-label" aria-hidden="true">−<\/span>legacy\(\): void/u,
/class="api-signature pk-label removed" data-change-hue="removed" data-projections-identifier=""><span class="api-line-mark pk-label" aria-hidden="true">−<\/span>legacy\(\): void/u,
)
assert.equal(statusOf(rows.greet), 'Modified')
assert.match(
rows.greet,
/<pre class="api-signature pk-label" data-projections-identifier=""><span>greet\(<\/span><ins>name: string<\/ins><span>\): string<\/span><\/pre>/u,
/<pre class="api-signature pk-label" data-projections-identifier=""><span>greet\(<\/span><ins data-change-hue="added">name: string<\/ins><span>\): string<\/span><\/pre>/u,
)
assert.match(rows.greet, /Signature changed from “greet\(\): string” to “greet\(name: string\): string”/u)
// A rewritten signature splits into a removed line above an added one.
assert.match(
rows.parse,
/class="api-signature pk-label removed" data-projections-identifier="">.*>parse\(text: string\): Node<\/pre><pre class="api-signature pk-label added" data-projections-identifier="">.*>tokenize\(input: Buffer\): Token\[\]<\/pre>/u,
/class="api-signature pk-label removed" data-change-hue="removed" data-projections-identifier="">.*>parse\(text: string\): Node<\/pre><pre class="api-signature pk-label added" data-change-hue="added" data-projections-identifier="">.*>tokenize\(input: Buffer\): Token\[\]<\/pre>/u,
)
assert.ok(!rows.stable.includes('pk-status') && !rows.stable.includes('<del') && !rows.stable.includes('<ins'))
// The unchanged row still reserves its footer, so every row has the same rhythm.
Expand All @@ -173,7 +173,7 @@ test('a renamed declaration shows its previous label and its renamed signature',
rows.getJson,
/Previously <\/span><span data-projections-identifier="" class="pk-identifier pk-truncate" title="fetchJson"><del>fetchJson<\/del><\/span>/u,
)
assert.match(rows.getJson, /<del>fetchJson<\/del><ins>getJson<\/ins>/u)
assert.match(rows.getJson, /<del data-change-hue="removed">fetchJson<\/del><ins data-change-hue="added">getJson<\/ins>/u)
// Side-by-side, the before pane names it as the before revision did, under its row ID.
assert.match(rowsOf(render(props(model, {progress: 0, highlighting: 0}))).getJson, />fetchJson<\/button>/u)
})
Expand Down Expand Up @@ -272,9 +272,12 @@ test('side-by-side panes list each revision; with highlighting each marks its si
assert.match(end.added, /class="api-signature pk-label added"/u)
assert.match(
start.greet,
/class="api-signature pk-label removed" data-projections-identifier="">.*<span>greet\(<\/span><span>\): string<\/span>/u,
/class="api-signature pk-label removed" data-change-hue="removed" data-projections-identifier="">.*<span>greet\(<\/span><span>\): string<\/span>/u,
)
assert.match(
end.greet,
/class="api-signature pk-label added" data-change-hue="added" data-projections-identifier="">.*<mark>name: string<\/mark>/u,
)
assert.match(end.greet, /class="api-signature pk-label added" data-projections-identifier="">.*<mark>name: string<\/mark>/u)
assert.ok(!start.parse.includes('<mark'), 'a rewrite is not marked run by run')
assert.ok(!start.stable.includes('pk-status') && !end.stable.includes('<mark'))
})
Expand Down
20 changes: 7 additions & 13 deletions packages/renderers/code-statistics/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,8 @@ button.stat-hit:hover {
font-size: var(--projections-font-size-xs);
font-variant-numeric: tabular-nums;
}
.stat-delta-label.added {
color: var(--green);
}
.stat-delta-label.removed {
color: var(--red);
.stat-delta-label[data-change] {
color: var(--pk-change-ink);
}

.statistics-share {
Expand Down Expand Up @@ -248,11 +245,8 @@ button.stat-hit:hover {
* (fill and same-hue edge, scaled by --emphasis); inside the bar the lines gained are edged in the added hue and the
* lines lost are a dashed ghost in the removed hue, so a row says both what changed and by how much.
*/
.statistics-view .stat-diff-delta.added {
color: color-mix(in srgb, var(--green) calc(var(--emphasis, 1) * 100%), var(--text));
}
.statistics-view .stat-diff-delta.removed {
color: color-mix(in srgb, var(--red) calc(var(--emphasis, 1) * 100%), var(--text));
.statistics-view .stat-diff-delta[data-change] {
color: color-mix(in srgb, var(--pk-change-ink) calc(var(--emphasis, 1) * 100%), var(--text));
}
.stat-diff-value {
display: grid;
Expand Down Expand Up @@ -286,12 +280,12 @@ button.stat-hit:hover {
/* A selected changed row keeps its change edge: the SDK's selection ring draws over it. */
/* Gained lines: the bar's own colour and hatch, edged in the added hue. */
.stat-gain.diff {
box-shadow: inset 0 0 0 var(--stroke-strong) var(--green);
box-shadow: inset 0 0 0 var(--stroke-strong) var(--pk-change-ink);
}
/* Lost lines: a hatched ghost in the removed hue with a dashed edge, where the Before bar ended. */
.stat-loss.diff {
background: repeating-linear-gradient(135deg, var(--red-border) 0 1.5px, transparent 1.5px 5px), var(--red-soft);
border-color: var(--red);
background: repeating-linear-gradient(135deg, var(--pk-region-edge) 0 1.5px, transparent 1.5px 5px), var(--pk-region-fill);
border-color: var(--pk-change-ink);
}

.statistics-share.diff .stat-rings {
Expand Down
31 changes: 5 additions & 26 deletions packages/renderers/database/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -239,17 +239,8 @@
background: var(--accent-soft);
}
/* A marker whose constraint changes takes the change's color while emphasized; the row's status cell names it. */
.database-key[data-change='added'] {
color: color-mix(in srgb, var(--green) calc(var(--emphasis) * 100%), var(--muted));
}
.database-key[data-change='removed'] {
color: color-mix(in srgb, var(--red) calc(var(--emphasis) * 100%), var(--muted));
}
.database-key[data-change='modified'] {
color: color-mix(in srgb, var(--amber) calc(var(--emphasis) * 100%), var(--muted));
}
.database-key[data-change='renamed'] {
color: color-mix(in srgb, var(--violet) calc(var(--emphasis) * 100%), var(--muted));
.database-key[data-change] {
color: color-mix(in srgb, var(--pk-change-ink) calc(var(--emphasis) * 100%), var(--muted));
}
/* An enum is a card of its values. */
:is(.database-value, .database-measure-row.value) .database-rowtext code.database-value-name {
Expand Down Expand Up @@ -416,21 +407,9 @@
max-width: 100%;
}
/* Change tints follow the host's highlighting through --emphasis, so they are gone at both endpoints. */
.database-tag.added {
border-color: color-mix(in srgb, var(--green-border) calc(var(--emphasis) * 100%), var(--divider));
background: color-mix(in srgb, var(--green-soft) calc(var(--emphasis) * 100%), var(--raised));
}
.database-tag.removed {
border-color: color-mix(in srgb, var(--red-border) calc(var(--emphasis) * 100%), var(--divider));
background: color-mix(in srgb, var(--red-soft) calc(var(--emphasis) * 100%), var(--raised));
}
.database-tag.modified {
border-color: color-mix(in srgb, var(--amber-border) calc(var(--emphasis) * 100%), var(--divider));
background: color-mix(in srgb, var(--amber-soft) calc(var(--emphasis) * 100%), var(--raised));
}
.database-tag.renamed {
border-color: color-mix(in srgb, var(--violet-border) calc(var(--emphasis) * 100%), var(--divider));
background: color-mix(in srgb, var(--violet-soft) calc(var(--emphasis) * 100%), var(--raised));
.database-tag[data-change-hue] {
border-color: color-mix(in srgb, var(--pk-region-edge) calc(var(--emphasis) * 100%), var(--divider));
background: color-mix(in srgb, var(--pk-region-fill) calc(var(--emphasis) * 100%), var(--raised));
}
.database-tag-label {
display: inline-grid;
Expand Down
1 change: 1 addition & 0 deletions packages/renderers/database/src/tags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ function TagPill({tag, slot, props, diff}: {tag: FrameTag; slot: TagSlot | undef
aria-pressed={props.selectedId === id}
onClick={() => props.onSelect(id)}
className={`${tagClass} ${classifyChange(tag.change)}${props.selectedId === id ? ' selected' : ''}`}
{...(classifyChange(tag.change) === 'unchanged' ? {} : {'data-change-hue': classifyChange(tag.change)})}
style={{'--emphasis': emphasis} as CSSProperties}
{...(diff ? changeMark(tag.change) : {})}
{...(former ? {title: `${shown} (was ${former})`} : {})}
Expand Down
3 changes: 3 additions & 0 deletions packages/renderers/dependency-injection/src/diff-lines.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ const lineClass: Record<DiTextLine['role'], string> = {
}

const toneClass = {was: 'di-was', arrow: 'di-arrow', now: 'di-now'} as const
/** The change hue of a tone's text (the kit's change variables): the old value removed, the new one added. */
const toneHue = {was: 'removed', now: 'added'} as const

/**
* One line of a diff card's text, from the text column or ending at the card's right inset: code in the monospace
Expand All @@ -25,6 +27,7 @@ export function DiLine({line, top, lifetime}: {line: DiTextLine; top: number; li
const span = (piece: DiSpan, index: number) => {
const attributes = {
...(piece.tone ? {className: toneClass[piece.tone]} : {}),
...(piece.tone && piece.tone !== 'arrow' ? {'data-change-hue': toneHue[piece.tone]} : {}),
...(piece.code && !allCode ? identifier : {}),
}
return Object.keys(attributes).length ? (
Expand Down
4 changes: 2 additions & 2 deletions packages/renderers/dependency-injection/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,11 @@
}
/* The old value struck through in the removed hue, then the new one in the added hue; plain with highlighting off. */
.di-was {
fill: color-mix(in srgb, var(--red) calc(var(--emphasis, 1) * 100%), var(--muted));
fill: color-mix(in srgb, var(--pk-change-ink) calc(var(--emphasis, 1) * 100%), var(--muted));
text-decoration: line-through;
}
.di-now {
fill: color-mix(in srgb, var(--green) calc(var(--emphasis, 1) * 100%), var(--text));
fill: color-mix(in srgb, var(--pk-change-ink) calc(var(--emphasis, 1) * 100%), var(--text));
}
.di-dependency-sign {
font-family: var(--font-mono);
Expand Down
Loading
Loading