Skip to main content

NodeGraphStore

Struct NodeGraphStore 

Source
pub struct NodeGraphStore { /* private fields */ }
Expand description

Minimal B-layer store.

This is intentionally headless-safe and does not depend on fret-ui.

Implementations§

Source§

impl NodeGraphStore

Source

pub fn apply_auto_pan( &mut self, request: AutoPanRequest, ) -> Option<AutoPanOutcome>

Applies one auto-pan frame through normal viewport view-state publication.

Source

pub fn apply_selection_auto_pan( &mut self, request: SelectionAutoPanRequest, ) -> Option<AutoPanOutcome>

Applies one selection-drag auto-pan frame through normal viewport publication.

Source§

impl NodeGraphStore

Source

pub fn binding_query(&self) -> BindingQueryResult

Reads renderer-neutral binding facts for the current store state.

Source

pub fn binding_query_with_options( &self, options: BindingQueryOptions, ) -> BindingQueryResult

Reads renderer-neutral binding facts with explicit geometry options.

Source

pub fn layout_context_with_binding_pins(&self) -> LayoutContext

Builds layout context and pins nodes with resolvable binding geometry.

Source§

impl NodeGraphStore

Source

pub fn plan_connect_edge(&self, request: ConnectEdgeRequest) -> ConnectPlan

Plans connecting two existing ports against the resolved interaction policy.

Source

pub fn apply_connect_edge( &mut self, request: ConnectEdgeRequest, ) -> Result<Option<DispatchOutcome>, ConnectEdgeError>

Commits a connect request through normal store dispatch.

Source§

impl NodeGraphStore

Source

pub fn plan_reconnect_edge(&self, request: ReconnectEdgeRequest) -> ConnectPlan

Plans reconnecting one endpoint of an existing edge against the resolved interaction policy.

Source

pub fn apply_reconnect_edge( &mut self, request: ReconnectEdgeRequest, ) -> Result<Option<DispatchOutcome>, ReconnectEdgeError>

Commits a reconnect request through normal store dispatch.

Source§

impl NodeGraphStore

Source

pub fn plan_create_node_from_schema( &self, registry: &NodeRegistry, request: CreateNodeRequest, ) -> Result<NodeInstantiation, NodeInstantiationError>

Instantiates a schema node without mutating the store.

Source

pub fn apply_create_node_from_schema( &mut self, registry: &NodeRegistry, request: CreateNodeRequest, ) -> Result<CreateNodeOutcome, CreateNodeError>

Instantiates and commits a schema node through the normal store dispatch path.

Source§

impl NodeGraphStore

Source

pub fn plan_delete_selection(&self) -> DeletePlan

Plans deletion for the store’s current node/edge selection.

Source

pub fn plan_delete_selection_for_key(&self, key: KeyCode) -> Option<DeletePlan>

Plans deletion for the current selection when the configured delete key matches.

Source

pub fn plan_delete_elements(&self, elements: &DeleteElements) -> DeletePlan

Plans deletion for explicit node/edge ids through the store’s resolved interaction policy.

Source

pub fn prepare_delete_selection( &self, ) -> Result<Option<PreDeleteRequest>, DeleteSelectionError>

Prepares the current selection for an adapter-owned async pre-delete hook.

Source

pub fn prepare_delete_selection_for_key( &self, key: KeyCode, ) -> Result<Option<PreDeleteRequest>, DeleteSelectionError>

Prepares a key-gated selection delete for an adapter-owned async pre-delete hook.

Source

pub fn apply_delete_selection( &mut self, ) -> Result<Option<DispatchOutcome>, DeleteSelectionError>

Commits deletion for the current node/edge selection through normal store dispatch.

Source

pub fn apply_delete_selection_for_key( &mut self, key: KeyCode, ) -> Result<Option<DispatchOutcome>, DeleteSelectionError>

Commits deletion for the current selection when the configured delete key matches.

Source

pub fn apply_pre_delete_resolution( &mut self, request: &PreDeleteRequest, resolution: PreDeleteResolution, ) -> Result<Option<DispatchOutcome>, DeleteSelectionError>

Applies an adapter-owned pre-delete hook result through normal delete policy and dispatch.

Source

pub fn apply_delete_elements( &mut self, elements: DeleteElements, ) -> Result<Option<DispatchOutcome>, DeleteSelectionError>

Commits explicit node/edge ids through normal delete policy and store dispatch.

Source§

impl NodeGraphStore

Source

pub fn plan_node_drag(&self, request: NodeDragRequest) -> Option<NodeDragPlan>

Plans a node drag update against the store’s current selection and interaction state.

Source

pub fn plan_node_nudge( &self, request: NodeNudgeRequest, ) -> Option<NodeNudgePlan>

Plans a keyboard nudge update against the store’s current selection and interaction state.

Source

pub fn apply_node_drag( &mut self, request: NodeDragRequest, ) -> Result<Option<DispatchOutcome>, DispatchError>

Commits a node drag update through the normal store dispatch path.

This records normal graph history for the committed update. Higher-level drag sessions that need preview/final-commit semantics should build on top of the planning API.

Source

pub fn apply_node_nudge( &mut self, request: NodeNudgeRequest, ) -> Result<Option<DispatchOutcome>, DispatchError>

Commits a keyboard nudge update through the normal store dispatch path.

Source§

impl NodeGraphStore

Source

pub fn resolve_pointer_session_claim( &self, input: PointerSessionClaimInput, ) -> PointerSessionClaimOutcome

Resolves which high-level session should own a normalized pointer drag.

Source

pub fn apply_node_drag_session( &mut self, session: NodeDragSession, ) -> Result<NodeDragSessionOutcome, DispatchError>

Applies a full node-drag gesture session through gesture events and normal store dispatch.

Source

pub fn apply_connect_edge_session( &mut self, session: ConnectEdgeSession, ) -> Result<ConnectSessionOutcome, ConnectEdgeError>

Applies a full connect gesture session through gesture events and normal store dispatch.

Source

pub fn apply_viewport_drag_pan_session( &mut self, session: ViewportDragPanSession, ) -> Result<ViewportGestureSessionOutcome, ViewportGestureRejection>

Applies a full viewport drag-pan gesture session through gesture events and view-state.

Source§

impl NodeGraphStore

Source

pub fn apply_keyboard_intent( &mut self, intent: KeyboardIntent, ) -> Result<Option<KeyboardActionOutcome>, KeyboardActionError>

Applies a normalized keyboard intent through the store’s headless runtime helpers.

Source§

impl NodeGraphStore

Source

pub fn layout_context(&self) -> LayoutContext

Builds a layout context from non-persisted runtime facts already known by this store.

Source

pub fn plan_layout( &self, request: &LayoutEngineRequest, registry: &LayoutEngineRegistry, ) -> Result<LayoutResult, LayoutError>

Runs a selected layout engine for the current graph without mutating the store.

Source

pub fn layout_transaction( &self, request: &LayoutEngineRequest, registry: &LayoutEngineRegistry, ) -> Result<GraphTransaction, LayoutError>

Runs a selected layout engine and returns the transaction that would move changed nodes.

Source

pub fn apply_layout( &mut self, request: &LayoutEngineRequest, registry: &LayoutEngineRegistry, ) -> Result<LayoutApplyOutcome, LayoutApplyError>

Runs a selected layout engine and commits the resulting transaction through normal dispatch.

Source

pub fn plan_dugong_layout( &self, request: &LayoutRequest, ) -> Result<LayoutResult, LayoutError>

Runs dugong layout for the current graph without mutating the store.

Source

pub fn dugong_layout_transaction( &self, request: &LayoutRequest, ) -> Result<GraphTransaction, LayoutError>

Runs dugong layout and returns the transaction that would move changed nodes.

Source

pub fn apply_dugong_layout( &mut self, request: &LayoutRequest, ) -> Result<DugongLayoutApplyOutcome, DugongLayoutApplyError>

Runs dugong layout and commits the resulting transaction through normal store dispatch.

Source§

impl NodeGraphStore

Source

pub fn report_node_measurement( &mut self, measurement: NodeMeasurement, ) -> Result<NodeMeasurementOutcome, NodeMeasurementError>

Applies non-persisted renderer measurements for one node.

Source

pub fn clear_node_measurement(&mut self, node: NodeId) -> NodeMeasurementOutcome

Clears non-persisted measurements for one node.

Source

pub fn node_measurement(&self, node: NodeId) -> Option<NodeMeasurement>

Reads the current non-persisted measurement facts for one node.

Source

pub fn layout_facts_query( &self, viewport_size: CanvasSize, ) -> LayoutFactsQueryResult

Reads the adapter-facing layout facts for the current store state.

Source

pub fn connection_target_candidates_from_layout_facts( &self, ) -> Vec<ConnectionTargetCandidate>

Builds renderer-neutral connection target candidates from reported handle measurements.

Source

pub fn resolve_connection_target_from_layout_facts( &self, pointer: CanvasPoint, from: ConnectionHandleRef, ) -> ResolvedConnectionTarget

Resolves a connection target using the handle inventory previously reported by adapters.

Source

pub fn edge_position_from_layout_facts( &self, edge: EdgeId, ) -> Option<EdgePosition>

Resolves edge endpoint geometry from graph endpoints plus reported measurement facts.

Source§

impl NodeGraphStore

Source

pub fn group_render_order(&self) -> Vec<GroupId>

Resolves the current group render order using the store’s view-state and editor config.

Source

pub fn node_render_order(&self) -> Vec<NodeId>

Resolves the current node render order using the store’s view-state and editor config.

Source

pub fn edge_render_order(&self) -> Vec<EdgeId>

Resolves the current edge render order using the store’s view-state and editor config.

Source

pub fn rendering_query(&self, viewport_size: CanvasSize) -> RenderingQueryResult

Resolves all renderer-facing order and visibility lists for the current store state.

Source§

impl NodeGraphStore

Source

pub fn plan_node_resize( &self, request: NodeResizeRequest, ) -> Option<NodeResizePlan>

Plans a node resize update against the store’s current graph.

Source

pub fn apply_node_resize( &mut self, request: NodeResizeRequest, ) -> Result<Option<DispatchOutcome>, DispatchError>

Commits a node resize update through the normal store dispatch path.

Source

pub fn plan_node_pointer_resize( &self, request: NodePointerResizeRequest, ) -> Option<NodeResizePlan>

Plans a pointer-driven node resize update against the store’s current graph.

Source

pub fn apply_node_pointer_resize( &mut self, request: NodePointerResizeRequest, ) -> Result<Option<DispatchOutcome>, DispatchError>

Commits a pointer-driven node resize update through the normal store dispatch path.

Source

pub fn start_node_resize_session(&mut self, session: NodeResizeSession)

Emits the start event for a headless pointer-driven node resize session.

Source

pub fn apply_node_resize_session_update( &mut self, session: NodeResizeSession, request: NodeResizeSessionUpdateRequest, ) -> Result<Option<NodeResizeSessionUpdateOutcome>, DispatchError>

Commits one pointer-driven session update and emits the derived resize update event.

Source

pub fn finish_node_resize_session( &mut self, session: NodeResizeSession, pointer: CanvasPoint, outcome: NodeResizeEndOutcome, )

Emits the end event for a headless pointer-driven node resize session.

Source

pub fn apply_node_resize_session( &mut self, session: NodeResizeSession, request: NodeResizeSessionUpdateRequest, ) -> Result<NodeResizeSessionOutcome, DispatchError>

Runs a one-update pointer resize session through start, commit/update, and end events.

Source§

impl NodeGraphStore

Source

pub fn apply_node_pointer_down( &mut self, input: NodePointerDownInput, ) -> NodePointerDownDecision

Applies the selection portion of a node pointer-down decision.

Source

pub fn apply_node_drag_start_selection( &mut self, input: NodeDragStartSelectionInput, ) -> NodeDragStartSelectionAction

Applies XyFlow-compatible selection behavior for a node-drag start.

Source

pub fn resolve_node_pointer_down( &self, input: NodePointerDownInput, ) -> NodePointerDownDecision

Resolves the node pointer-down decision against current graph, selection, and interaction.

Source§

impl NodeGraphStore

Source

pub fn apply_selection_box( &mut self, input: SelectionBoxInput, ) -> SelectionBoxResult

Applies a canvas-space marquee selection box to the store view-state.

Source§

impl NodeGraphStore

Source

pub fn dispatch_transaction( &mut self, tx: &GraphTransaction, ) -> Result<DispatchOutcome, DispatchError>

Applies a transaction and records it in history.

This mirrors the UI loop contract: the store applies edits to a scratch graph first and only commits on success (so rejected profile validations do not partially mutate state).

Source

pub fn dispatch_transaction_with_profile( &mut self, tx: &GraphTransaction, profile: &mut dyn GraphProfile, ) -> Result<DispatchOutcome, ApplyPipelineError>

Dispatches a transaction using an externally-owned profile pipeline.

This is intended for UI integration where the profile is owned by the presenter layer.

Source§

impl NodeGraphStore

Source

pub fn emit_gesture(&mut self, event: NodeGraphGestureEvent)

Emits a transient gesture event for adapter layers that own pointer/keyboard gestures.

Source§

impl NodeGraphStore

Source

pub fn undo(&mut self) -> Result<Option<DispatchOutcome>, DispatchError>

Undoes the last committed transaction.

Source

pub fn undo_with_profile( &mut self, profile: &mut dyn GraphProfile, ) -> Result<Option<DispatchOutcome>, ApplyPipelineError>

Undoes the last committed transaction using an externally-owned profile pipeline.

Source

pub fn redo(&mut self) -> Result<Option<DispatchOutcome>, DispatchError>

Redoes the last undone transaction.

Source

pub fn redo_with_profile( &mut self, profile: &mut dyn GraphProfile, ) -> Result<Option<DispatchOutcome>, ApplyPipelineError>

Redoes the last undone transaction using an externally-owned profile pipeline.

Source§

impl NodeGraphStore

Source

pub fn subscribe( &mut self, f: impl for<'a> FnMut(NodeGraphStoreEvent<'a>) + 'static, ) -> SubscriptionToken

Subscribes to store events (graph commits + view-state changes).

This is the minimal B-layer equivalent of XyFlow’s store subscriptions.

Source

pub fn subscribe_selector<T>( &mut self, selector: impl for<'a> Fn(NodeGraphStoreSnapshot<'a>) -> T + 'static, on_change: impl FnMut(&T) + 'static, ) -> SubscriptionToken
where T: PartialEq + 'static,

Subscribes to a derived projection of store state and only fires when the derived value changes (by PartialEq).

This is the B-layer “selector subscription” pattern used by XyFlow.

Source

pub fn subscribe_selector_diff<T>( &mut self, selector: impl for<'a> Fn(NodeGraphStoreSnapshot<'a>) -> T + 'static, on_change: impl FnMut(&T, &T) + 'static, ) -> SubscriptionToken
where T: PartialEq + 'static,

Subscribes to a derived projection and receives both the previous and next values.

Source

pub fn unsubscribe(&mut self, token: SubscriptionToken) -> bool

Removes a subscription.

Source§

impl NodeGraphStore

Source§

impl NodeGraphStore

Source

pub fn graph(&self) -> &Graph

Source

pub fn graph_revision(&self) -> u64

Source

pub fn layout_facts_revision(&self) -> u64

Source

pub fn lookups(&self) -> &NodeGraphLookups

Source

pub fn replace_graph(&mut self, graph: Graph)

Replaces the entire graph document.

This is a controlled-mode helper: callers that own graph state can swap the document without going through transactions (e.g. loading a file, switching tabs).

This emits a document replacement event, not a graph commit. Selection is sanitized against the new graph.

Source

pub fn replace_document( &mut self, graph: Graph, view_state: NodeGraphViewState, editor_config: NodeGraphEditorConfig, )

Replaces the entire document snapshot in one atomic store update.

This is the full document reset path: graph, view state, editor config, lookups, revision, and undo/redo history are updated together, then one DocumentReplaced event is emitted.

Source§

impl NodeGraphStore

Source

pub fn history(&self) -> &GraphHistory

Source

pub fn clear_history(&mut self)

Source

pub fn can_undo(&self) -> bool

Source

pub fn can_redo(&self) -> bool

Source§

impl NodeGraphStore

Source

pub fn view_state(&self) -> &NodeGraphViewState

Source

pub fn replace_view_state(&mut self, view_state: NodeGraphViewState)

Replaces the full view-state payload.

This is the controlled-mode counterpart of set_viewport/set_selection.

Source

pub fn update_view_state(&mut self, f: impl FnOnce(&mut NodeGraphViewState))

Mutates view-state in place and emits derived ViewChange events.

Source

pub fn set_viewport(&mut self, pan: CanvasPoint, zoom: f32)

Sets the viewport (pan/zoom) and notifies subscribers.

Source

pub fn apply_viewport_pan( &mut self, request: ViewportPanRequest, ) -> Option<ViewportTransform>

Applies a normalized drag-pan request through normal view-state publication.

Source

pub fn apply_viewport_pan_constrained( &mut self, request: ViewportPanRequest, viewport_size: CanvasSize, ) -> Option<ViewportTransform>

Applies a drag-pan request while honoring configured translate extents.

Source

pub fn apply_viewport_zoom( &mut self, request: ViewportZoomRequest, ) -> Option<ViewportTransform>

Applies a normalized anchored zoom request through normal view-state publication.

Source

pub fn apply_viewport_zoom_constrained( &mut self, request: ViewportZoomRequest, viewport_size: CanvasSize, ) -> Option<ViewportTransform>

Applies an anchored zoom request while honoring configured translate extents.

Source

pub fn set_selection( &mut self, nodes: Vec<NodeId>, edges: Vec<EdgeId>, groups: Vec<GroupId>, )

Sets selection state and notifies subscribers.

Source§

impl NodeGraphStore

Source

pub fn new( graph: Graph, view_state: NodeGraphViewState, editor_config: NodeGraphEditorConfig, ) -> Self

Creates a store with an explicit editor configuration payload.

Source

pub fn with_profile( graph: Graph, view_state: NodeGraphViewState, editor_config: NodeGraphEditorConfig, profile: Box<dyn GraphProfile>, ) -> Self

Creates a store with a profile pipeline (apply -> concretize -> validate).

Source

pub fn with_middleware(self, middleware: impl NodeGraphStoreMiddleware) -> Self

Source§

impl NodeGraphStore

Source

pub fn dispatch_changes( &mut self, changes: &NodeGraphChanges, ) -> Result<DispatchOutcome, DispatchChangesError>

Applies XyFlow-style changes by converting them to a reversible transaction.

Trait Implementations§

Source§

impl Debug for NodeGraphStore

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.