Skip to content

feat(nodes): give a source its own icon and colour - #35

Merged
endrix merged 1 commit into
mainfrom
feat/source-node-icon
Sep 3, 2026
Merged

endrix merged 1 commit into
mainfrom
feat/source-node-icon

Conversation

@endrix

@endrix endrix commented Sep 3, 2026

Copy link
Copy Markdown
Owner

A source node had neither an icon nor a colour of its own. It rendered as an unmarked external node in the viewer's accent — the node it is the opposite of.

Why it was the viewer's colour

A source carries the viewer annotation, because that is what makes double-click open its resource. Both the icon and the colour family were derived from that annotation — but it describes what opening does, not what the node is.

The exporter already emits a source annotation beside it, so both now key on that instead. A source and a viewer sit at opposite ends of a graph and are now told apart at a glance rather than by reading the label.

The glyph

A resource leaving its container — deliberately not a document. A source hands in a folder or a web resource as often as a file, and a page glyph would claim otherwise. I rendered it at its real 36px against the existing icons before settling on it.

Structure over specificity

The family is derived where the existing ones are (getNodeCssClasses / getHeaderCssClasses), not layered on top with a more specific selector. Both those functions decide it, so both had to learn it — the header is where the previous colour actually showed. This file has been through a specificity fight before; structure settled that one too.

Tests

12 across two files, mutation-checked:

mutation caught
icon: source not resolved 1 failed
icon: keyed on the openable annotation 1 failed
icon: loses one half of the glyph 1 failed
icon: path escapes the viewBox 1 failed
colour: header falls back to viewer 2 failed
colour: node falls back to viewer 2 failed
colour: viewer loses its own family 1 failed
colour: annotated node also called default 1 failed

Two survived the first pass. Dropping one of the glyph's two paths still rendered something, so the count is pinned with a comment saying why. And a mutation to the default-family guard turned out to mislabel a viewer as unannotated — which dims its icon — so the control now asserts that too.

Gates: typecheck 5/5, neutrality 4/4, full suite green (845 tests).

A source had neither. It showed as an unmarked external node in the
viewer's accent — the node it is the opposite of — because both the icon
and the colour family were derived from the annotation that makes a node
openable, which a source carries so double-click works. That annotation
says what opening does, not what the node is.

Both now key on the annotation that names the node, which the exporter
already emits beside it, so a source is told apart from a viewer at a
glance rather than by reading its label.

The glyph is a resource leaving its container, deliberately not a
document: a source hands in a folder or a web resource as often as a
file, and a page would claim otherwise.

The family is derived the way the existing ones are rather than layered
over them with a more specific selector — this file has been through a
specificity fight before, and structure settled it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant