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).
This commit is contained in:
2026-10-19 22:23:58 +01:00
parent 1eaedf5c53
commit b00b434c5d
8 changed files with 313 additions and 58 deletions
+32
View File
@@ -0,0 +1,32 @@
// The graph expansion preference: expanded by default, a collapse remembered.
import { test } from "node:test";
import assert from "node:assert/strict";
import { GRAPH_EXPANDED_KEY, readGraphExpanded, writeGraphExpanded } from "../src/graphPrefs.js";
function fakeStorage(initial = {}) {
const values = new Map(Object.entries(initial));
return {
getItem: (key) => (values.has(key) ? values.get(key) : null),
setItem: (key, value) => values.set(key, String(value)),
values,
};
}
test("the graph is expanded when nothing was stored", () => {
assert.equal(readGraphExpanded(fakeStorage()), true);
});
test("a collapse survives and expands again on request", () => {
const storage = fakeStorage();
writeGraphExpanded(false, storage);
assert.equal(storage.values.get(GRAPH_EXPANDED_KEY), "0");
assert.equal(readGraphExpanded(storage), false);
writeGraphExpanded(true, storage);
assert.equal(readGraphExpanded(storage), true);
});
test("storage failures fall back to the expanded default", () => {
const broken = { getItem() { throw new Error("denied"); }, setItem() { throw new Error("denied"); } };
assert.equal(readGraphExpanded(broken), true);
assert.doesNotThrow(() => writeGraphExpanded(false, broken));
});