Files
pipelines/web/graph.css
T
alan b00b434c5d web: clearer workflow graph labels, routes and kinds
- Gaps between stages are sized from the widest straight-route label, so a chip
  never reaches into either box; a source's forward routes fan across its side
  instead of sharing a 20px band.
- A label prefers the widest horizontal run that can hold it; when only a stub
  exists the chip moves onto the edge's longest run and sits beside a vertical
  one, keeping clear of both the box and the neighbouring label.
- Hovering a wire or its chip highlights the route and dims the rest.
- System-added routes (the parser's implicit error fallback) draw dotted with a
  legend entry, distinct from declared routes and executed state.
- Lanes are 34px apart, so a dense definition no longer doubles the canvas height.
- The graph opens expanded by default and remembers a collapse (graphPrefs.js).
2026-10-19 22:23:58 +01:00

261 lines
8.8 KiB
CSS

/* The workflow graph (P6): a mounted, pannable/zoomable canvas of stage nodes,
labelled outcome edges and the success/failure terminals, plus the definition
pane opened from a node. Hand-written, dark-first, no runtime dependency. */
.graph-host { margin-top: 8px; }
.graph-panel { display: grid; gap: 8px; }
.graph-panel.expanded .graph-viewport { height: 78vh; }
/* The run detail's Graph tab is the page: give the graph most of the body. */
.run-graph .graph-host { min-height: 0; }
.run-graph .graph-viewport { height: min(70vh, 900px); }
.graph-viewport {
position: relative;
height: 440px;
overflow: hidden;
border: 1px solid var(--border);
border-radius: var(--radius-card);
background: var(--surface);
cursor: grab;
/* A drag pans the graph instead of scrolling the page or selecting text. */
touch-action: none;
user-select: none;
}
.graph-viewport:active { cursor: grabbing; }
/* One transformed layer: pan/zoom only rewrite this element's transform. */
.graph-content { position: absolute; top: 0; left: 0; will-change: transform; }
.graph-edges { position: absolute; top: 0; left: 0; overflow: visible; pointer-events: none; }
.graph-edge-path {
stroke-width: 3;
stroke-linecap: round;
stroke-linejoin: round;
/* The canvas ignores the pointer so panning works; a wire takes the pointer
back on its own stroke only, which is what makes hover-highlighting work. */
pointer-events: stroke;
transition: opacity 120ms ease-out;
}
.graph-edge-path.not-executed { stroke-width: 2.5; stroke-dasharray: 14 10; }
/* A system-added route (implicit error fallback): dotted, not merely dashed. */
.graph-edge-path.fallback { stroke-dasharray: 2 8; stroke-linecap: round; }
.graph-edge-path.hot { stroke-width: 5; }
.graph-edges.has-hot .graph-edge-path:not(.hot) { opacity: 0.3; }
.graph-arrowhead path { fill: var(--text); fill: context-stroke; }
.graph-node-layer, .graph-label-layer { position: absolute; top: 0; left: 0; }
.graph-label-layer { pointer-events: none; }
.graph-edge-label { pointer-events: auto; transition: opacity 120ms ease-out; }
.graph-node {
position: absolute;
display: flex;
align-items: center;
justify-content: center;
padding: 6px 8px;
border: 1px solid var(--border);
border-radius: var(--radius-card);
background: var(--surface-2);
color: var(--text);
font: inherit;
font-size: 13px;
font-weight: 600;
text-align: center;
overflow-wrap: anywhere;
cursor: pointer;
}
.graph-node:hover { border-color: var(--color-border-strong); }
.graph-node.selected { border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
/* Node fills convey type: model neutral, ntfy amber, other/custom green. */
.graph-node-ntfy {
background: color-mix(in srgb, var(--warn) 22%, var(--surface-2));
border-color: color-mix(in srgb, var(--warn) 42%, var(--border));
}
.graph-node-custom {
background: color-mix(in srgb, var(--ok) 18%, var(--surface-2));
border-color: color-mix(in srgb, var(--ok) 38%, var(--border));
}
/* Terminals are pills tinted by outcome, so they read as endpoints, not stages. */
.graph-node-terminal-success,
.graph-node-terminal-failure { border-radius: 999px; }
.graph-node-terminal-success {
background: color-mix(in srgb, var(--ok) 30%, var(--surface-2));
border-color: var(--ok);
color: var(--ok);
}
.graph-node-terminal-failure {
background: color-mix(in srgb, var(--bad) 30%, var(--surface-2));
border-color: var(--bad);
color: var(--bad);
}
/* Not executed (R5 only): hollow, dashed and muted, never a faded fill. */
.graph-node.not-executed {
background: transparent;
border-style: dashed;
color: var(--muted);
}
.graph-edge-label {
position: absolute;
transform: translate(-50%, -100%);
padding: 1px 6px;
border: 1px solid var(--border);
border-radius: 999px;
background: var(--surface-2);
color: var(--muted);
font-size: 11px;
white-space: nowrap;
}
.graph-edge-label.fallback { border-style: dotted; }
/* A label on a vertical run sits beside it, centred on the wire's midpoint. */
.graph-edge-label.vertical { transform: translate(-50%, -50%); }
.graph-edge-label.hot {
border-color: var(--accent);
color: var(--color-text);
background: var(--color-surface-2);
}
.graph-label-layer.has-hot .graph-edge-label:not(.hot) { opacity: 0.45; }
.graph-controls { position: absolute; top: 8px; right: 8px; z-index: 2; display: flex; gap: 6px; }
.graph-control {
padding: 4px 10px;
border: 1px solid var(--border);
border-radius: var(--radius-control);
background: var(--surface);
color: var(--text);
font-size: 12px;
}
.graph-control:hover { border-color: var(--color-border-strong); }
/* The run-mode legend (R5), pinned top-start opposite the Fit/expand controls.
A solid, arrowed swatch means "executed"; a dashed, arrowless one "not
executed". Never shown for the definition-only view. */
.graph-legend {
position: absolute;
top: 8px;
left: 8px;
z-index: 2;
display: flex;
gap: 8px;
align-items: center;
padding: 4px 8px;
border: 1px solid var(--border);
border-radius: var(--radius-control);
background: color-mix(in srgb, var(--surface) 85%, transparent);
font-size: 12px;
color: var(--muted);
}
.graph-legend-entry { display: inline-flex; gap: 6px; align-items: center; }
.graph-legend-swatch {
position: relative;
width: 26px;
border-top: 3px solid var(--muted);
}
.graph-legend-swatch.executed { border-top-color: var(--text); }
/* A small filled arrowhead on the executed swatch, matching the drawn head. */
.graph-legend-swatch.executed::after {
content: "";
position: absolute;
top: -6px;
right: -1px;
border-left: 7px solid var(--text);
border-top: 4px solid transparent;
border-bottom: 4px solid transparent;
}
.graph-legend-swatch.not-executed { border-top-style: dashed; }
.graph-legend-swatch.fallback { border-top: 2px dotted var(--muted); }
/* The live active stage (R5): a ring around the node plus a soft glow, pulsing
while the run executes and static when the user prefers reduced motion. */
.graph-node.active {
border-color: var(--accent);
box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 40%, transparent);
}
.graph-node.active.pulsing { animation: graph-halo-pulse 1.6s ease-in-out infinite; }
@keyframes graph-halo-pulse {
0%,
100% { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent); }
50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent) 20%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
.graph-node.active.pulsing { animation: none; }
}
/* The live elapsed-time badge on the active node. */
.graph-elapsed {
position: absolute;
bottom: -9px;
right: 6px;
padding: 0 5px;
border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
border-radius: 999px;
background: var(--surface);
color: var(--accent);
font-size: 10px;
font-weight: 600;
line-height: 16px;
}
/* The definition pane opened from a node click. */
.graph-pane {
display: grid;
gap: 8px;
padding: 8px 12px;
border: 1px solid var(--border);
border-radius: var(--radius-card);
background: var(--surface);
/* A deep-linked stage is revealed with scrollIntoView; keep its head clear of
the sticky top bar instead of hiding it underneath. */
scroll-margin-top: 70px;
}
.graph-pane[hidden] { display: none; }
.graph-pane-head { display: flex; align-items: center; gap: 8px; }
.graph-pane-title { margin: 0; font-size: 15px; }
.graph-type-chip {
padding: 2px 8px;
border: 1px solid var(--border);
border-radius: 999px;
background: var(--surface-2);
color: var(--accent);
font-size: 11px;
}
.graph-pane-close { margin-left: auto; padding: 3px 10px; font-size: 12px; }
.graph-pane-empty { margin: 0; }
.graph-section-toggle {
display: flex;
gap: 8px;
align-items: center;
width: 100%;
padding: 8px 10px;
border: 0;
border-radius: var(--radius-control);
background: var(--surface-2);
color: var(--text);
font-weight: 600;
text-align: left;
}
.graph-section-body { display: grid; gap: 6px; padding: 8px 2px 0; }
.graph-field { display: grid; grid-template-columns: minmax(120px, 200px) 1fr; gap: 8px; align-items: baseline; }
.graph-field-label { color: var(--muted); font-size: 12px; }
.graph-field-value { font-size: 13px; overflow-wrap: anywhere; }
.graph-field-block { grid-template-columns: 1fr; }
.graph-block {
margin: 4px 0 0;
padding: 8px 10px;
max-height: 260px;
overflow: auto;
border: 1px solid var(--border);
border-radius: var(--radius-control);
background: var(--surface-2);
color: var(--text);
font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
white-space: pre-wrap;
word-break: break-word;
}
/* The waiting / canceled / interrupted hues are set once above, next to the
other status chips, so RunStatusPalette stays the single source of truth for
every status word. */
.chip-unknown { color: #bec9c5; border-color: #bec9c5; }