Two of the three motion gaps mara flagged on the swarm-ui jobs graph (the third, node status changes as a tree of nesting divs rather than a node-link diagram, has no edges to animate today — see the issue thread for that scoping correction). - New node mount: .jg-node gets a fade+slide-in keyframe. No JS change needed — Preact only creates a new .jg-node DOM node when its key (the node id) is genuinely new, so this only plays on first appearance, not every fetch re-render. - State change flash: NodeView tracks each node's previous state via a ref; on a real change it adds .jg-state-flash to the glyph span (removed on animationend), driving a scale pulse. Both follow the same three-rule motion-guard shape as Shell.css's shell-page-enter / LinksMenu.css's links-menu-popover-enter.
190 lines
4.4 KiB
CSS
190 lines
4.4 KiB
CSS
/* jobq-graph.css — styles for the `JobqGraph` Preact component
|
|
(`./JobqGraph.jsx`), rendered into light DOM under `.jg-root`.
|
|
`@import` this from a page-level CSS file (dashboard) or a
|
|
component-level one (swarm-ui), matching how every other
|
|
`@hive/shared` stylesheet is consumed — see JobqGraph.jsx's top comment
|
|
for why this file is never imported from JS. Theme custom properties
|
|
(--fg, --red, ...) are plain inherited custom properties here, same as
|
|
any other light-DOM rule. */
|
|
|
|
.jg-root {
|
|
display: block;
|
|
font-family: inherit;
|
|
font-size: inherit;
|
|
color: var(--fg);
|
|
}
|
|
|
|
.jg-filter {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
gap: 0.15em 0.9em;
|
|
margin: 0 0 0.5em;
|
|
font-size: 0.85em;
|
|
}
|
|
|
|
.jg-filter-label {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.3em;
|
|
color: var(--muted);
|
|
cursor: pointer;
|
|
user-select: none;
|
|
}
|
|
.jg-filter-label:has(input:checked) {
|
|
color: var(--fg);
|
|
}
|
|
|
|
.jg-body {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.15em;
|
|
}
|
|
|
|
/* Mount-triggered fade+slide, not a state transition — Preact only
|
|
creates a new `.jg-node` DOM node when its `key` (the node id) is
|
|
genuinely new, so this only plays once per node, the first time it
|
|
appears in a fetched snapshot. Same shape as Shell.css's
|
|
`shell-page-enter` / LinksMenu.css's `links-menu-popover-enter` —
|
|
see either for the three-rule motion-guard this mirrors. */
|
|
.jg-node {
|
|
margin: 0;
|
|
animation: jg-node-enter 160ms ease;
|
|
}
|
|
@keyframes jg-node-enter {
|
|
from {
|
|
opacity: 0;
|
|
transform: translateY(-0.2em);
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
transform: none;
|
|
}
|
|
}
|
|
@media (prefers-reduced-motion: reduce) {
|
|
.jg-node {
|
|
animation: none;
|
|
}
|
|
}
|
|
:root[data-motion='reduce'] .jg-node {
|
|
animation: none;
|
|
}
|
|
:root[data-motion='allow'] .jg-node {
|
|
animation: jg-node-enter 160ms ease;
|
|
}
|
|
|
|
/* Nested groups indent + get a guide line, rather than a hand-rolled
|
|
connector-glyph tree — cheaper to build and reads fine at any depth. */
|
|
.jg-node .jg-node {
|
|
margin-left: 1.1em;
|
|
padding-left: 0.6em;
|
|
border-left: 1px solid var(--muted);
|
|
margin-top: 0.15em;
|
|
}
|
|
|
|
.jg-row {
|
|
display: flex;
|
|
align-items: baseline;
|
|
gap: 0.35em;
|
|
flex-wrap: wrap;
|
|
}
|
|
|
|
.jg-state {
|
|
font-weight: bold;
|
|
min-width: 1.2em;
|
|
text-align: center;
|
|
}
|
|
.jg-state-pending { color: var(--muted); }
|
|
.jg-state-running { color: var(--cyan); }
|
|
.jg-state-finishing { color: var(--cyan); opacity: 0.75; }
|
|
.jg-state-done { color: var(--green); }
|
|
.jg-state-failed { color: var(--red); }
|
|
.jg-state-cancelled { color: var(--muted); text-decoration: line-through; }
|
|
.jg-state-skipped { color: var(--muted); opacity: 0.5; }
|
|
|
|
/* Short-lived pulse applied by `NodeView` (JobqGraph.tsx) exactly when
|
|
a node's own `state` value changes on an existing DOM node — a mount
|
|
keyframe (`.jg-node`'s `jg-node-enter`, above) doesn't retrigger for
|
|
this case since the node isn't remounting, just updating. Class is
|
|
removed on `animationend` (see NodeView), so the scale never gets
|
|
stuck applied. */
|
|
.jg-state-flash {
|
|
animation: jg-state-flash 350ms ease;
|
|
}
|
|
@keyframes jg-state-flash {
|
|
from {
|
|
transform: scale(1.6);
|
|
}
|
|
to {
|
|
transform: none;
|
|
}
|
|
}
|
|
@media (prefers-reduced-motion: reduce) {
|
|
.jg-state-flash {
|
|
animation: none;
|
|
}
|
|
}
|
|
:root[data-motion='reduce'] .jg-state-flash {
|
|
animation: none;
|
|
}
|
|
:root[data-motion='allow'] .jg-state-flash {
|
|
animation: jg-state-flash 350ms ease;
|
|
}
|
|
|
|
.jg-label {
|
|
color: var(--fg);
|
|
}
|
|
|
|
.jg-cancel-btn {
|
|
margin-left: auto;
|
|
background: transparent;
|
|
border: 1px solid var(--muted);
|
|
color: var(--muted);
|
|
border-radius: 999px;
|
|
width: 1.4em;
|
|
height: 1.4em;
|
|
font-size: 0.8em;
|
|
line-height: 1;
|
|
padding: 0;
|
|
cursor: pointer;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
transition: color 0.15s ease, border-color 0.15s ease;
|
|
}
|
|
.jg-cancel-btn:hover,
|
|
.jg-cancel-btn:focus-visible {
|
|
color: var(--red);
|
|
border-color: var(--red);
|
|
outline: none;
|
|
}
|
|
|
|
.jg-data {
|
|
margin: 0.1em 0 0 1.6em;
|
|
font-size: 0.85em;
|
|
color: var(--muted);
|
|
display: grid;
|
|
grid-template-columns: auto 1fr;
|
|
gap: 0 0.5em;
|
|
}
|
|
.jg-data dt { font-weight: 600; }
|
|
.jg-data dd { margin: 0; word-break: break-word; }
|
|
|
|
.jg-waits-on {
|
|
margin: 0.1em 0 0 1.6em;
|
|
font-size: 0.85em;
|
|
color: var(--cyan);
|
|
}
|
|
|
|
.jg-error {
|
|
color: var(--red);
|
|
font-size: 0.85em;
|
|
margin: 0.2em 0 0.2em 1.6em;
|
|
white-space: pre-wrap;
|
|
}
|
|
|
|
.jg-empty,
|
|
.jg-error-msg {
|
|
color: var(--muted);
|
|
font-style: italic;
|
|
margin: 0;
|
|
}
|