Fragiola

API: primitives (@fragiola/flow-react, @fragiola/flow-vue, @fragiola/flow-svelte, @fragiola/flow-angular)

ReconnectAnchor

Flow.ReconnectAnchor is the grab area at one end of an edge; with reconnection(), a press on it moves that end to another handle.

Flow.ReconnectAnchor renders an SVG circle at one end of its edge, inside Flow.Edge. With reconnection() (which needs connection()), a press on it moves that end: the connection line runs from the fixed end, and a drop on another handle runs edge.reconnect (the edge keeps its id); dropped nowhere or on a refused handle, it goes back. A press on the edge's stroke within reconnection({ radius }) of an end grabs it too, without an anchor. An edge with reconnectable: false cannot be moved; with reconnectable: "source" (or "target") only that end moves, and the anchor of the other end renders nothing (in Angular its element leaves the document).

Edge reconnect
Gallery
<Flow.Edge<Types> edge={edge}>
    <Flow.EdgePath />
    <Flow.ReconnectAnchor end="source" r={8} className="fill-transparent hover:stroke-blue-500" />
    <Flow.ReconnectAnchor end="target" r={8} className="fill-transparent hover:stroke-blue-500" />
</Flow.Edge>

It is transparent by default: give it its radius and look. While its edge is below the nodes (edges are drawn before them), an anchor lies under its node's handle, so the mouse grabs it beside the handle: a larger r, or a wider reconnection({ radius }), gives it more room there.

Props

ReconnectAnchorProps extends the common primitive props and every SVG attribute of a circle.

proptypedefaultdescription
end"source" | "target"requiredwhich end of the edge it moves
edgeIdstringthe enclosing Flow.Edge'sthe edge

State

ReconnectAnchorState, what className, style and render receive:

fieldtypedescription
edgeIdstringthe edge
end"source" | "target"the end it moves
pathEdgePaththe edge's path and ends
reconnectingbooleanthis edge's end is being moved

Data attributes

attributevalue
data-flow-part"reconnect-anchor"
data-flow-idthe edge's id
data-end"source" or "target"
data-reconnectingpresent while one of the edge's ends is moved

Structural style

cx / cy at the end, r 10 and fill="transparent" (attributes your props override), and pointer-events: all.