Skip to main content

Crate facett_core

Crate facett_core 

Source
Expand description

facett-core — the visual kernel. Render a node/edge Scene into egui. Source-agnostic: build a Scene from anything (Arrow rows, a graph, a DAG), hand it here, get pixels. The CPU painter is the reference; a wgpu fast path (GPU viewport-cull + indirect draw, seeded from katana-osm’s osm-viewer) lands behind this same draw() call — consumers don’t change.

Re-exports§

pub use a11y::Semantics;
pub use a11y::node as a11y_node;
pub use a11y::stable_id;
pub use caps::FacetCaps;
pub use clip::ArrowColumnRef;
pub use clip::ClipKind;
pub use clip::ClipPayload;
pub use clip::CopySource;
pub use clip::PasteTarget;
pub use clipboard::ClipAction;
pub use deckfx::DeckFx;
pub use deckfx::DeckRaven;
pub use look::Action;
pub use look::KeyMap;
pub use look::Palette;
pub use nav::Dir4;
pub use nav::Navigable;
pub use nav::nearest_in_direction;
pub use rabbit::Rabbit;
pub use rabbit::RabbitMesh;
pub use rabbit::rabbit_mesh;
pub use rabbit::rabbit_outline;
pub use scroll_engine::SmoothScroll;
pub use theme::Theme;
pub use theme::set_theme;
pub use theme::theme;
pub use look::Theme as LookTheme;

Modules§

a11y
facett-core::a11y — the FC-4 enabler. One helper that makes a custom-painted element appear in the AccessKit tree.
caps
Uniform capability model — every Facet returns a small FacetCaps descriptor so a host (the FacetDeck, korp, nornir) can treat all components uniformly: query “is this scalable?”, “copyable?”, “searchable?” without knowing the concrete type. See .nornir/design/capability-model.md.
clip
Cross-facet typed copy/paste (§16) — the trait + payload machinery so copy/paste carries full typed data between facett components, not just text. A process-wide transfer registry holds the last typed ClipPayload so a paste target gets the richest representation the source offered; on copy we also mirror Text/TSV to the OS clipboard for external apps.
clipboard
Uniform clipboard — cut / copy / paste routed the same way for every Facet. egui delivers the OS clipboard gesture as semantic events (egui::Event::Copy/Cut/Paste), which a focused TextEdit consumes first — so a form field handles its own copy and the facet-level copy only fires when the facet body is the clipboard target. The deck drains these events once per frame (poll) and makes the single OS-touching write (put); facets stay pure (copy/cut return the text). See .nornir/design/clipboard.md.
deckfx
Deck-level effects + theming — wires the theme palettes and the effects bloom/raven into the FacetDeck as opt-in, host-controllable features.
edges
Graph edge rendering (§18) — straight, spline (cubic Bézier / Catmull-Rom sampled), and fat/soft (variable width, feathered) edges, with widths/softness from the theme. Device = crisp hairlines, no glow (gated by EffectsPolicy). The sampling is pure so the path is snapshot-stable.
effects
effects — motion + bloom for the facett look. Pure egui, glow backend only: everything here paints with layered alpha shapes on an egui::Painter, so it works without a custom GPU shader.
focus
Focus hints, pane revolver, and form groups (§13 FOC-3/FOC-4 + FORM-*). All off-by-default, themed, and deterministic (no ambient time): the hint labels are a pure function of the focusables; the revolver transform is a pure function of (progress, target, viewport); form navigation is pure rect geometry reusing nav::nearest_in_direction. Built on egui focus (Memory::request_focus/move_focus) at the call site.
harness
Headless test harness — fire up a Facet, inject data, render it offscreen, and capture what it drew: its state_json + a vertex count (a “it drew something” proxy) + a stderr activity trail. No display, no GPU. This is the basis of facett’s auto test matrix, and mirrors nornir viz’s NORNIR_VIZ_STATE introspection — every component is observable from outside.
labels3d
3D label “gyro” stabilization (§19) — fix labels bobbing while the scene rotates. The label’s 3D anchor is projected to screen space, then the text is drawn billboarded (upright, camera-facing) — never rotated with the scene (GYRO-1). Vertical jitter is eliminated by stable sub-pixel placement (consistent rounding) + optional temporal smoothing of the projected anchor (GYRO-2). The galley is cached once per label by the caller (no per-frame relayout).
look
facett look & feel (the work-order architecture, §3) — one Theme struct that fully describes a coherent, fast, fully-themeable look across every facett component, shipped as three presets: Windows, macOS, Device (effects-off, rugged/military). The Theme is the single source of truth: Theme::apply installs a complete egui::Style (visuals + spacing + scroll) plus the text scale in one call, and also publishes the derived legacy crate::Theme palette so the existing custom-painted components follow with no per-component wiring (COH-1).
nav
Shared spatial navigation + focus (§13 FOC-2, §14 NAV-1) — the one pan/zoom model (Navigable) reused by map/graph/plot/canvas, and the one spatial focus rule (nearest_in_direction) reused by pane and form navigation (COH-3). Pan/zoom is expressed as an egui::emath::TSTransform (scale + offset), so a host can also use it to transform an overlaid guest layer (§5 CMP-4).
overlay
Composability & overlays (§5) + glass / masks (§20) — render any facett component into an arbitrary sub-Rect/layer of any other (a dataframe pinned over a map, a HUD over video), clipped by a mask, with optional glass gated by EffectsPolicy.
rabbit
The znippy rabbit — facett’s synthetic/test mascot, as reusable parametric geometry. znippy ships no logo asset, so the rabbit is generated here: a friendly sitting-rabbit silhouette (rounded body + head + two upright ears + an eye dot), built from deterministic arcs in a normalised [-1, 1]² design box (x right, y up). No RNG, no per-frame randomness — two calls produce byte-identical geometry, so the wgpu/CPU snapshots stay stable.
scroll_engine
CygnusEd smooth-scroll engine (§11) — pixel-by-pixel, sub-pixel soft scrolling with momentum/acceleration, à la the Amiga editor’s jerkyless feel. The scroll offset is decoupled from row height (renderers paint at a fractional pixel offset + clip), and the whole thing is deterministic under an injected clock (advance(dt)), so snapshots reproduce exactly (FC-7 / P0-5). Reusable by text, console, and the dataframe grid (SCRL-3).
testmatrix
The functional-status → nornir test-matrix bridge (feature testmatrix).
theme
Theming. A palette the custom-painted components (graph/depgraph/map) read from the egui context, plus matching egui Visuals for the standard widgets (pop/table/pipeline). Call set_theme once on the context and every facet follows. Ships a Theme::default look, a Theme::sci_fi neon-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 with Theme::ALL / Theme::by_name to build a picker.
trace
Structured event trace — the machine-readable sibling of harness::trail.

Structs§

Edge
A directed edge between node indices.
FacetDeck
A tabbed set of Facets — the reusable multi-component shell. Draws a tab bar + the active facet, and composes every facet’s state_json under its title, so the whole-app introspection contract is free. korp/nornir can build their window from a FacetDeck instead of hand-rolling tabs + the state dump.
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).

Enums§

Layout
Node placement strategy.

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 Scene into ui — the reusable render primitive. Empty scenes show empty_hint. Labels render when the node count is small enough to read.
hash_color
A stable, bright-ish colour from a string (FNV-1a). Handy default node colour.