Expand description
§Slint Node Editor Library
A flexible, generic Slint component library for building visual graph editors. Supports data flow diagrams, state machines, shader graphs, and any visual node-based interface.
§Features
- Generic Design - Works with any node and link data structures
- Trait-Based Architecture - Zero coupling via
NodeGeometryandLinkModeltraits - Callback-Based Computation - Delegates expensive operations to Rust for performance
- Opaque Pin IDs - Library never prescribes pin encoding; applications choose
- Extensible - Easy to customize pins, styling, node types, and behaviors
§Quick Start
This is a composition fragment. The compiled downstream quick start contains the Cargo manifest, build script, Slint UI and Rust host.
import { NodeEditor, BaseNode, Pin, PinTypes } from "@nodeeditor";
export component MainWindow inherits Window {
NodeEditor {
// Your nodes and links here
}
}§Core Components
These are Slint components, imported from @nodeeditor. Only the top-level
editor has a generated Rust counterpart (nodeeditor::NodeEditor); the
rest exist solely in .slint.
NodeEditor- Main graph editor componentBaseNode- Base component for creating custom nodesPin- Connection point componentLink- Bezier curve link componentBaseGroup/GroupSheet- Backing sheet behind a group of nodesMinimap- Bird’s-eye view component
§Accessibility
Library components include accessibility roles for screen readers and MCP
introspection. When creating custom node components, set accessible-label
to the node’s display title:
component MyNode inherits BaseNode {
in property <string> title;
accessible-label: title; // override default "Node <id>"
}§Rust Helpers
This crate provides Rust helper functions for common operations:
generate_grid_commands- Generate SVG path for grid renderinggenerate_bezier_path- Generate SVG path for bezier curvesfind_pin_at- Hit-test pins in a shared coordinate spacefind_link_route_at- Hit-test rendered link routes in a shared coordinate spaceGeometryCache- Cache node and pin geometry for fast lookupsselection- Resolve selection gestures and project the result into rowsGraphLogic- Helper for managing node graph stategroups- Node groups: membership, movement, collapse and bounds
§Limitations
One NodeEditor per window. The library uses Slint globals (ViewportState,
DragState, NodeEditorInternalCallbacks, etc.) for internal communication between
BaseNode/Pin components and the NodeEditor. Since Slint globals are
window-level singletons, only one NodeEditor instance per Window is
supported. Multiple editors in separate windows work fine. This limitation
will be lifted once Slint introduces component-scoped globals.
See the README for detailed documentation and examples.
Re-exports§
pub use nodeeditor::BoxSelectionModifier;pub use nodeeditor::GroupData;pub use nodeeditor::LinkCreationState;pub use nodeeditor::LinkData;pub use nodeeditor::LinkPath;pub use nodeeditor::MinimapNode;pub use nodeeditor::MinimapPosition;pub use grid::generate_grid_commands;pub use hit_test::distance_to_polyline;pub use hit_test::find_link_at;pub use hit_test::find_link_route_at;pub use hit_test::find_pin_at;pub use hit_test::links_in_selection_box;pub use hit_test::nodes_in_selection_box;pub use hit_test::BezierLinkRoute;pub use hit_test::LinkGeometry;pub use hit_test::LinkRoute;pub use hit_test::NodeGeometry;pub use hit_test::PinGeometry;pub use hit_test::PolylineLinkRoute;pub use hit_test::SimpleLinkGeometry;pub use hit_test::SimpleNodeGeometry;pub use path::generate_bezier_path;pub use path::generate_partial_bezier_path;pub use state::GeometryCache;pub use state::StoredPin;pub use controller::NodeEditorController;pub use graph::validate_and_normalize_link;pub use graph::BasicLinkValidator;pub use graph::CompositeValidator;pub use graph::GraphLogic;pub use graph::LinkModel;pub use graph::LinkValidator;pub use graph::MovableNode;pub use graph::NoDuplicatesValidator;pub use graph::NormalizedLink;pub use graph::SimpleLink;pub use graph::ValidationError;pub use graph::ValidationResult;pub use groups::Bounds;pub use groups::Dragged;pub use groups::GroupLogic;pub use groups::GroupMember;pub use groups::GroupModel;pub use layout::sugiyama_layout;pub use layout::sugiyama_layout_from_cache;pub use layout::Direction;pub use layout::NodePosition;pub use layout::RankAlignment;pub use layout::SugiyamaConfig;pub use links::LinkManager;pub use setup::NodeEditorSetup;pub use tracking::GeometryTracker;
Modules§
- controller
- High-level controller for node editor applications.
- graph
- grid
- groups
- Host-side group helpers.
- hit_
test - layout
- Sugiyama hierarchical graph layout.
- links
- Link management for the node editor.
- nodeeditor
- The Slint components, compiled as a library module.
- path
- selection
- Host-side selection helpers.
- setup
- Simplified setup helpers for NodeEditor with globals architecture.
- state
- tracking
- Convenience helpers for geometry tracking setup.
Macros§
- wire_
groups - Wire node groups for a host with one node model and one group model.
- wire_
node_ editor - Wire up all NodeEditor callbacks with a single macro call.
- wire_
selection - Wire the editor’s selection intents, using your model rows as the store.