Headless graph query helpers for connectors, selections, and navigation.
Summary
Functions
Returns a directed adjacency projection keyed by source item id.
Returns the number of active connector drafts in an assigned draft map.
Returns a map of item id to all connectors touching that item.
Returns a map of {item_id, port_name} to connectors touching that port.
Returns all connectors touching item_id.
Returns all connectors touching port_name on item_id.
Returns true when adding a connector from from_id to to_id would create a cycle.
Returns connectors that target item_id.
Returns ordered item ids reachable from a graph navigation anchor.
Returns connectors that start from item_id.
Returns true when connector_id is selected in the given graph selection.
Returns true when item_id is selected in the given graph selection.
Types
@type connector_source() :: LivePanels.Canvas.State.t() | [LivePanels.Item.t()]
@type direction() :: :incoming | :outgoing | :connected
Functions
@spec adjacency(connector_source()) :: %{optional(String.t()) => [String.t()]}
Returns a directed adjacency projection keyed by source item id.
Duplicate target ids are collapsed while preserving first-seen connector order.
@spec connector_draft_count(map() | term()) :: non_neg_integer()
Returns the number of active connector drafts in an assigned draft map.
@spec connectors_by_item(connector_source()) :: %{ optional(String.t()) => [LivePanels.Item.t()] }
Returns a map of item id to all connectors touching that item.
@spec connectors_by_port(connector_source()) :: %{ optional({String.t(), String.t() | nil}) => [LivePanels.Item.t()] }
Returns a map of {item_id, port_name} to connectors touching that port.
@spec connectors_for_item(connector_source(), String.t()) :: [LivePanels.Item.t()]
Returns all connectors touching item_id.
@spec connectors_for_port(connector_source(), String.t(), String.t() | atom()) :: [ LivePanels.Item.t() ]
Returns all connectors touching port_name on item_id.
@spec creates_cycle?(connector_source(), String.t(), String.t()) :: boolean()
Returns true when adding a connector from from_id to to_id would create a cycle.
@spec incoming_connectors(connector_source(), String.t()) :: [LivePanels.Item.t()]
Returns connectors that target item_id.
@spec outgoing_connectors(connector_source(), String.t()) :: [LivePanels.Item.t()]
Returns connectors that start from item_id.
@spec selected_connector?(LivePanels.Canvas.Selection.t(), String.t()) :: boolean()
Returns true when connector_id is selected in the given graph selection.
@spec selected_item?(LivePanels.Canvas.Selection.t(), String.t()) :: boolean()
Returns true when item_id is selected in the given graph selection.