.talos-graph is the frame around a node graph, not the graph itself. It gives
you the void with its ambient dot grid, a toolbar, a zoom cluster, a minimap, a
time scrubber and collapsible side panels. You draw the nodes and edges on a
<canvas> or <svg> in .talos-graph__stage, reading the talos tokens with
getComputedStyle so the drawing stays on palette. Lives in talos-graph.css
(in all.css); it needs talos.css and talos-forms.css (.talos-range,
.talos-input).
Default — the full chrome
<main class="talos-graph" style="height:100vh">
<canvas class="talos-graph__stage"></canvas>
<div class="talos-graph__toolbar">
<input class="talos-input" type="search" placeholder="Find a node">
<button class="talos-flag" aria-pressed="true">operator</button>
</div>
<div class="talos-graph__zoom">
<button class="talos-button talos-button--xs" type="button" aria-label="Zoom in">+</button>
<button class="talos-button talos-button--xs" type="button" aria-label="Zoom out">−</button>
<span class="talos-graph__readout">100%</span>
</div>
<div class="talos-graph__minimap"><canvas></canvas></div>
<div class="talos-graph__scrubber">
<button class="talos-button talos-button--xs">Play</button>
<input class="talos-range" type="range" aria-label="Time">
<span class="talos-graph__time">18-11 11:40</span>
</div>
<aside class="talos-graph__panel">
<button class="talos-graph__panel-head" aria-expanded="true">
<span class="talos-hud">Runs</span><span class="talos-flag">4</span>
</button>
<div class="talos-graph__panel-body">…</div>
</aside>
<aside class="talos-graph__panel talos-graph__panel--start" data-collapsed>…</aside>
</main>
Give .talos-graph a height; every overlay is absolutely positioned inside it.
The minimap, scrubber and panels ride the chamfer engine. The right panel sits
below the toolbar and above the minimap; .talos-graph__panel--start docks a
second one on the left edge, clear of the zoom cluster. The panel is
min(22rem, 40vw) wide by default; the demo narrows it to fit this column.
Panels — fold to the head row
.talos-graph__panel-head is the panel’s fold button: a slug, a HUD title and a
count flag. Set [data-collapsed] on the panel to fold it to that row (the body
hides, the panel shrinks to its head) and keep aria-expanded on the button in
step. In the demo above the left Filters panel is folded and the right
Runs panel is open.
Camera — the grid stays in world space
graph.style.setProperty("--talos-graph-zoom", camera.scale);
graph.style.setProperty("--talos-graph-x", `${camera.x}px`);
graph.style.setProperty("--talos-graph-y", `${camera.y}px`);
Set --talos-graph-zoom (the current scale) and --talos-graph-x /
--talos-graph-y (the pan offset) on .talos-graph as the camera moves. The dot
grid scales and shifts with them, so it reads as the floor the graph sits on
rather than a texture on the screen. .is-panning and .is-pointing on the root
set the grab and pointer cursors.
Classes
| Class | Role |
|---|---|
.talos-graph | root; --talos-graph-zoom, --talos-graph-x, --talos-graph-y |
.talos-graph__stage | the drawing surface (canvas or svg), inset 0 |
.talos-graph__toolbar | top overlay row (search, toggle flags) |
.talos-graph__zoom / __readout | vertical zoom buttons / scale readout |
.talos-graph__minimap | chamfered corner overview (holds a canvas) |
.talos-graph__scrubber / __time | bottom time bar with .talos-range / time readout |
.talos-graph__panel | right side panel; [data-collapsed] folds it |
.talos-graph__panel--start | the panel docked on the left edge |
.talos-graph__panel-head / __panel-body | fold button row / scrolling body |
.is-panning / .is-pointing | grab / pointer cursor on the stage |