Fragiola

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

EdgePath

Flow.EdgePath is an edge's SVG path, its d computed by the engine from the edge's type and ends, unfilled and styled by you.

Flow.EdgePath renders an SVG path inside Flow.Edge whose d is the engine's (edge-path-by, recomputed when its nodes move or are measured), with fill="none". It is the default child of Flow.Edge. Give it its stroke in your style, through data-selected for the selected look.

<Flow.Edge<Types> edge={edge}>
    {/* a wide transparent path: a bigger press target */}
    <Flow.EdgePath className="stroke-transparent stroke-[16]" />
    <Flow.EdgePath className="stroke-gray-400 stroke-2 data-selected:stroke-blue-500" />
</Flow.Edge>

A d of your own draws an app type: read the ends from state.path (render gets the state) or from useEdge.

<Flow.EdgePath
    render={(props, state) => {
        const { source, target } = state.path;
        const mid = (source.y + target.y) / 2;
        return <path {...props} d={`M${source.x},${source.y} V${mid} H${target.x} V${target.y}`} />;
    }}
/>

Props

EdgePathProps extends the common primitive props and every SVG attribute of a path.

proptypedefaultdescription
edgeIdstringthe enclosing Flow.Edge'sthe edge

State

EdgePathState, what className, style and render receive:

fieldtypedescription
edgeIdstringthe edge
pathEdgePaththe path, its label point and its ends
selectedbooleanthe edge is selected

Data attributes

attributevalue
data-flow-part"edge-path"
data-flow-idthe edge's id
data-selectedpresent while the edge is selected
data-animatedpresent while the edge's animated flag is set
data-reconnectingpresent while one of its ends is moved

Structural style

None: d and fill="none" are attributes your props override.