feat(nodes): give a source its own icon and colour - #35
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
viewerannotation, 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
sourceannotation 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:
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).