// Custom edge that renders association / composition / constraint variants. // - association: solid line with arrow // - composition: solid line with diamond marker at the source side // - constraint: dashed line, no arrow "use client"; import { BaseEdge, EdgeLabelRenderer, getBezierPath, type EdgeProps } from "@xyflow/react"; import type { AssociationKind } from "../../../lib/sysml/model"; export interface SysmlEdgeData extends Record { label?: string; kind: AssociationKind; } export function SysmlEdge(props: EdgeProps) { const { sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, data, markerEnd, markerStart } = props; const d = (data ?? {}) as SysmlEdgeData; const kind = d.kind ?? "association"; const [edgePath, labelX, labelY] = getBezierPath({ sourceX, sourceY, sourcePosition, targetX, targetY, targetPosition, curvature: 0.25, }); const isConstraint = kind === "constraintApplies"; return ( <> {d.label && (
{d.label}
)} ); }