diff --git a/packages/renderers/runtime-policy/browser/runtime-policy.spec.ts b/packages/renderers/runtime-policy/browser/runtime-policy.spec.ts
index 0dead5b6..0d175605 100644
--- a/packages/renderers/runtime-policy/browser/runtime-policy.spec.ts
+++ b/packages/renderers/runtime-policy/browser/runtime-policy.spec.ts
@@ -205,8 +205,8 @@ test('deployment facts: agent, kernels, warnings and the policies covering each
/Unavailable on general: tcp_connect is not a kernel symbol there\./u,
)
const web = frame.locator('[data-entity-id="workload:StatefulSet:checkout:checkout-web"]')
- await expect(web.locator('.rp-chip.added.filled')).toContainText('protect-credentials')
- await expect(web.locator('.rp-chip.unchanged')).toContainText('egress-audit')
+ await expect(web.locator('.rp-chip[data-change="added"]')).toContainText('protect-credentials')
+ await expect(web.locator('.rp-chip:not([data-chip-change])')).toContainText('egress-audit')
await expect.poll(() => facts(renderer)).toContain('1 agent configuration changed')
await renderer.iframe.screenshot({path: test.info().outputPath('deployment.png')})
})
diff --git a/packages/renderers/runtime-policy/src/chips.tsx b/packages/renderers/runtime-policy/src/chips.tsx
index 37f719e4..854d1145 100644
--- a/packages/renderers/runtime-policy/src/chips.tsx
+++ b/packages/renderers/runtime-policy/src/chips.tsx
@@ -1,7 +1,8 @@
import {codeSpan} from '@githubnext/projections-schemas'
+import {Chip as KitChip} from '@githubnext/projections-renderer-kit/react'
import {proseOf, type Chip, type Item} from './model.js'
import {chipPrefix} from './prose.js'
-import {emphasisStyle, regionOf, type Frame} from './frame.js'
+import {regionOf, type Frame} from './frame.js'
import {Prose} from './breaks.js'
/** How a covering policy acts on a workload, as prose: its strongest effect, and the containers a container selector picks. */
@@ -55,43 +56,35 @@ export function Chips({
const own = chip.subject.row.status
const change =
frame.side === 'diff' ? chip.change : strength > 0 && (own === 'added' || own === 'removed') ? own : ('unchanged' as const)
- const word = change === 'added' ? 'Added' : change === 'removed' ? 'Removed' : undefined
// A chip of an added or removed row arrives or leaves with it: marked by its sign, not a second fill.
const filled = frame.side === 'diff' && change !== 'unchanged' && change !== ownerRegion
const prefix = chipPrefix(chip)
const follow = chip.data?.followChildren === true
return (
-
+ className="rp-chip"
+ id={chip.subject.row.id}
+ selected={selected}
+ onSelect={frame.props.onSelect}
+ change={change}
+ paint={filled}
+ sign={frame.side === 'diff'}
+ emphasis={change === 'unchanged' ? 0 : strength}
+ font="text"
+ label={
+ <>
+ {prefix && {prefix} }
+ {subjectProse(chip)}
+ {follow && and children}
+ {chip.kind === 'covers' && (
+
+ {coverage(chip)}
+
+ )}
+ >
+ }
+ />
)
})}
diff --git a/packages/renderers/runtime-policy/src/styles.css b/packages/renderers/runtime-policy/src/styles.css
index 26bb1b55..5eb6a25f 100644
--- a/packages/renderers/runtime-policy/src/styles.css
+++ b/packages/renderers/runtime-policy/src/styles.css
@@ -215,8 +215,7 @@
.rp-chip.pk-part:hover {
background-image: linear-gradient(var(--hover), var(--hover));
}
-.rp-row.pk-part.selected,
-.rp-chip.pk-part.selected {
+.rp-row.pk-part.selected {
background-image: linear-gradient(var(--pk-part-tint), var(--pk-part-tint));
}
/* A selected part also carries an accent bar on its leading edge, drawn as an image so a change edge stays. */
@@ -230,20 +229,13 @@
* Change regions are the kit's (pk-region with data-change): a fill and a
* same-hue edge, both following --emphasis. A changed row, a probe's own
* region and a changed hook lane are regions; rows inside one inherit it.
- * The change hue here only colors signs and chip edges.
+ * The change hue here only colors signs. Chips are the kit's (`Chip`).
*/
-:is(.rp-row, .rp-region, .rp-lane)[data-change],
-.rp-chip[data-change-hue] {
+:is(.rp-row, .rp-region, .rp-lane)[data-change] {
--change: var(--pk-change-ink);
--change-soft: var(--pk-region-fill);
--change-edge: var(--pk-region-edge);
}
-/* An unchanged chip is never emphasized; its hue is the neutral it mixes with. */
-.rp-chip:not([data-change-hue]) {
- --change: var(--muted);
- --change-soft: var(--raised);
- --change-edge: var(--divider);
-}
/* Removed content is struck once, wherever its region was marked. */
:is(.rp-row.departed, .rp-region.departed, .rp-lane.departed) :is(.rp-main, .rp-effect) {
color: var(--muted);
@@ -374,55 +366,15 @@
font-weight: var(--projections-font-weight-semibold);
}
-/* Chips: edged in their change's hue when they arrive or leave on their own. */
+/* Chips (the kit's `Chip`): edged in their change's hue when they arrive or leave on their own. */
.rp-chips {
display: flex;
flex-wrap: wrap;
gap: var(--projections-space-1);
min-width: 0;
}
-.rp-chip {
- appearance: none;
- position: relative;
- display: inline-flex;
- /* Its sign, prefix and label are labels (`pk-label`) in one font: centred, their capitals line up, in a taller chip too. */
- align-items: center;
- gap: 0.35em;
- max-width: 100%;
- padding: 0 var(--projections-label-padding-x);
- border: var(--projections-border-width) solid var(--divider);
- border-radius: var(--projections-radius-sm);
- background: var(--raised);
- color: var(--text);
- font: inherit;
- font-size: var(--projections-font-size-xs);
- line-height: var(--projections-line-height);
- text-align: left;
- cursor: pointer;
-}
-.rp-chip.filled {
- border-color: color-mix(in srgb, var(--change-edge) calc(var(--emphasis, 0) * 100%), var(--divider));
- background: color-mix(in srgb, var(--change-soft) calc(var(--emphasis, 0) * 100%), var(--raised));
-}
-.rp-chip-label {
- min-width: 0;
-}
-.rp-chip.removed .rp-chip-label {
- color: var(--muted);
- text-decoration: line-through;
-}
-.rp-chip-sign {
- flex: none;
- font-family: var(--font-mono);
- font-weight: var(--projections-font-weight-semibold);
- color: color-mix(in srgb, var(--change) calc(var(--emphasis, 0) * 100%), var(--muted));
-}
-/*
- * No nested change colors: a row's sign takes its change only when the row marks it itself, and a chip's when the
- * chip is filled; a row inside a changed region, or a chip arriving or leaving with its row, says so by its glyph.
- */
-.rp-row:not([data-change]) > .rp-sign,
-.rp-chip:not([data-change]) > .rp-chip-sign {
+/* No nested change colors: a row's sign takes its change only when the row marks it itself. */
+.rp-row:not([data-change]) > .rp-sign {
color: var(--muted);
}
diff --git a/packages/renderers/runtime-policy/test/runtime-policy.test.mjs b/packages/renderers/runtime-policy/test/runtime-policy.test.mjs
index c4fc6584..68514291 100644
--- a/packages/renderers/runtime-policy/test/runtime-policy.test.mjs
+++ b/packages/renderers/runtime-policy/test/runtime-policy.test.mjs
@@ -201,7 +201,7 @@ test('markup: identifiers are marked, effects are words, and status footers are
assert.doesNotMatch(diff, /[▲⇱⚠]/u, 'status is words, not glyphs')
assert.match(
diff,
- /class="rp-chip pk-part removed filled"[^>]*>−<\/span>Removed: <\/span>/u,
+ /class="pk-chip pk-part rp-chip" data-change="removed" data-chip-change="removed"[^>]*>−<\/span>Removed: <\/span>/u,
)
const quiet = renderToStaticMarkup(