gpui_graph/lib.rs
1//! Force-directed network graph component for [GPUI](https://gpui.rs), built on
2//! [gpui-base](https://gpui-kit.com/base/).
3//!
4//! [`NetworkGraph`] is a stateful view (an `Entity`): it owns the layout,
5//! viewport, hover and selection state across frames. Create it with `cx.new`,
6//! feed it [`GraphData`] and subscribe to [`NetworkGraphEvent`]s. The host app
7//! owns data loading, panels and menus; it answers events such as
8//! [`NetworkGraphEvent::ContextMenu`] with its own UI.
9//!
10//! Call [`init`] once at startup to register the keyboard bindings (arrow keys
11//! move the selection, Enter activates, Escape clears, `=`/`-`/`0` zoom and
12//! fit, Shift-F10 opens the context menu). The graph is a tab stop.
13//!
14//! Colors follow the gpui-base [`Theme`](gpui_base::Theme) unless overridden
15//! with [`NetworkGraph::with_colors`].
16
17pub mod actions;
18mod geometry;
19mod layout;
20mod model;
21mod style;
22mod view;
23
24pub use actions::init;
25pub use layout::ForceConfig;
26pub use model::{Edge, GraphData, Node};
27pub use style::{ColorBy, GraphColors, LabelMode, NodeSizing, Palette};
28pub use view::{
29 CategoryInfo, GroupInfo, NetworkGraph, NetworkGraphEvent, Selection, TooltipBuilder,
30};