Handle data structure for LiveFlow.
A handle is a connection point on a node that allows edges to be connected. Handles can be either source (output) or target (input).
Fields
:id- Optional unique identifier within the node:type- Handle type::sourceor:target:position- Position on the node::top,:bottom,:left,:right:connectable- Whether this handle accepts connections:connect_type- Optional type constraint atom (e.g.,:data,:control):style- Custom inline styles:class- Custom CSS classes
Examples
iex> LiveFlow.Handle.new(:source, :bottom)
%LiveFlow.Handle{type: :source, position: :bottom}
iex> LiveFlow.Handle.new(:target, :top, id: "input-1")
%LiveFlow.Handle{id: "input-1", type: :target, position: :top}
Summary
Functions
Returns the effective ID for the handle.
Creates a new handle with the given type and position.
Creates a source handle (output).
Checks if the handle is a source (output).
Creates a target handle (input).
Checks if the handle is a target (input).
Types
Functions
Returns the effective ID for the handle.
If no ID is set, returns the type as a string.
Creates a new handle with the given type and position.
Options
:id- Handle ID (default:nil, will use type as identifier):connectable- Whether connectable (default:true):connect_type- Type constraint atom for validation (default:nil):style- Custom inline styles:class- Custom CSS classes
Examples
iex> LiveFlow.Handle.new(:source, :right)
%LiveFlow.Handle{type: :source, position: :right}
iex> LiveFlow.Handle.new(:target, :left, id: "in", connectable: false)
%LiveFlow.Handle{id: "in", type: :target, position: :left, connectable: false}
Creates a source handle (output).
Checks if the handle is a source (output).
Creates a target handle (input).
Checks if the handle is a target (input).