Expand description
facett-graph — the graph (node/edge) viewer component, on
facett_core. Build a Scene from a labelled edge list (the common
shape: a graph query, a dataflow DAG) and draw it. Source-agnostic — the
caller turns its Arrow/Cypher/whatever into edges first.
§FC contract (the canonical Elm split, FC-2 / FC-9)
Both facets in this crate — GraphView (the 2D node/edge skin) and
DepGraphView (the layered dep-DAG) — adopt the facett_core::Elm split:
GraphState/depgraph::DepGraphState— the complete observable, serializable, round-trippable interaction state. The bulk graph data (theScene/ thenodes+edges) is the input held on the struct —Color32is not serde-round-trippable and it is not the state a headless driver mutates, so it lives OUTSIDE the Model (mirrors how facett-grid keeps its Arrow data on the struct, not in itsGridState).Msg+update— the single mutation path (FC-2): a host/robot toggles the layout (GraphView) or selects/clears a node (DepGraphView); a headless driver (facett_core::harness) reaches the identical transitions.view— a pure paint (FC-9): reads&self, paints, and returns theMsgs the interactions produced; theimpl_facet_via_elm!bridge applies them.- Rich
state_json— the node/edge/label counts (and the dep-graph’s column depth) a driver reads are derived from the inputScene/nodes, not the interaction Model, so the macro is invoked in form 3 (custom_state_json) to publish those exact pre-migration keys instead of a plainserde(state()).
Modules§
- theme
- Theming. A palette the custom-painted components (graph/depgraph/map)
read from the egui context, plus matching egui
Visualsfor the standard widgets (pop/table/pipeline). Callset_themeonce on the context and every facet follows. Ships aTheme::defaultlook, aTheme::sci_fineon-on-near-black look, and a switchable family of striking palettes (Theme::nordic_aurora,Theme::cyberpunk_neon,Theme::amber_crt,Theme::deep_space,Theme::hugin_noir). Enumerate them withTheme::ALL/Theme::by_nameto build a picker.
Structs§
- DepEdge
- A directed edge
from → to, with the connecting items shown on the arrow. - DepGraph
State - The complete observable interaction state (FC-1 / FC-3) of a
DepGraphView: the drilled-in selection, keyed on the node’s stable label (FC-5) so a reorder/insert/delete can’t silently re-point it the way a list index would. Thenodes/edgesare input onDepGraphView, kept out of this Model. - DepGraph
View - The layered dep-graph viewer. Implements [
Facet]. - DepNode
- One node: a label, an optional sub-label (a sha, a version…), and a border colour (the consumer’s status policy).
- Edge
- A directed edge between node indices.
- Facet
Caps - What a Facet can do, so hosts treat every component uniformly. All-false by default: a facet opts in to each capability it actually honors.
- Graph
State - The complete observable interaction state (FC-1 / FC-3) of a
GraphView: the layout knob a host can toggle. The bulkSceneis input held onGraphView(not serde-round-trippable, not driver-mutated), so it is deliberately kept OUT of this Model — the derived node/edge/label counts a driver reads are published via the form-3state_jsoninstead. - Graph
View - A simple graph-view widget: a
Scene+ aLayout. ImplementsFacet, so it drops into aFacetDeckand exposesstate_jsonfor free. - Node
- A node: a label + a colour (the consumer picks the colour policy — hash by label, by status, …).
- Scene
- A drawable graph: nodes + edges (edges index into
nodes). - Theme
- The facett palette. All custom-painted colours come from here.
Enums§
- DepGraph
Effect - Side work as data (FC-8). The dep-graph does no I/O — every
Msgmutates only the in-memoryDepGraphState— so this is uninhabited on purpose. - DepGraph
Msg - A robot-/CLI-addressable control message (FC-2) — the named boundary a headless
driver (or a host) drives the graph through, the same effect a node-box click
produces. Applied by
DepGraphView::update. - Effect
- Side work as data (FC-8). The graph view does no I/O — every
Msgmutates only the in-memoryGraphState— so this is uninhabited on purpose. - Graph
Layout - A serde-round-trippable mirror of
Layout(which isCopybut neitherSerializenorDebug, so it cannot live in theGraphStateModel directly). TheMsgand the Model carry this; conversions to/from the coreLayoutkeep the painter and public API speaking the core type. - Layout
- Node placement strategy.
- Msg
- A robot-/CLI-addressable control message (FC-2) — the named boundary a headless
driver (or a host) drives the
GraphViewthrough. Applied byGraphView::update.
Traits§
- Facet
- The facett component contract. Every facet — graph, map, pipeline, table, the ported nornir viewers — implements this, so consumers (korp, nornir, …) compose them uniformly and get headless robot-testing for free.
Functions§
- draw
- Draw a
Sceneintoui— the reusable render primitive. Empty scenes showempty_hint. Labels render when the node count is small enough to read. - draw_
arrow - Line + arrowhead from
fromtoto(head pulled back by half a node width). - hash_
color - A stable, bright-ish colour from a string (FNV-1a). Handy default node colour.
- scene_
from_ labeled_ edges - Build a
Scenefrom a labelled edge list — each row is(src_id, dst_id, src_label, dst_label). Distinct ids become nodes, coloured per label (FNV-hashed). The reusable “graph from edges” adapter korp’s Graph and Pipelines views both want. - set_
theme - Store
themeon the context and apply its eguiVisuals. Call once per frame (cheap) or whenever the theme changes; every facet picks it up. - theme
- The theme stored on the ui’s context (or
Theme::defaultif none).