UNPKG

mermaid

Version:

Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.

29 lines (28 loc) • 1.63 kB
import type { Edge, Node } from '../../types.js'; export type ElkDirection = 'RIGHT' | 'LEFT' | 'DOWN' | 'UP'; type MarkerPosition = 'start' | 'end'; export declare function markerExtent(arrowType: string, position: MarkerPosition, margin: boolean): number; /** * The distance ELK leaves between `ports` implicit ports on a side `side` long, when the node * keeps its default port alignment. */ export declare function elkPortGap(side: number, ports: number, cornerMargin: number): number; export type EdgeEnds = Pick<Edge, 'start' | 'end' | 'arrowTypeStart' | 'arrowTypeEnd' | 'look' | 'animate' | 'animation' | 'cssCompiledStyles'> & { /** ELK was handed the edge from its end to its start, so it meets each node on the other side. */ layoutReversed?: boolean; }; interface SpreadContext { /** The direction the layout around a node runs in, which fixes the side its edges meet. */ directionOf: (nodeId: string) => ElkDirection; /** `elk.spacing.portsSurrounding`: the margin ELK keeps free at each end of a side. */ cornerMargin: number; } /** * The ids of the nodes whose attachment points ELK should spread across the side. * * ELK gives every edge end a port, an open link as much as an arrow, and spaces them * `elkPortGap` apart. This names the nodes where that falls below the width of the arrowheads * on a side, so a diagram without such a node is laid out exactly as before. */ export declare function nodesToSpreadPorts(nodes: readonly Pick<Node, 'id' | 'isGroup' | 'width' | 'height'>[], edges: readonly EdgeEnds[], { directionOf, cornerMargin }: SpreadContext): Set<string>; export {};