/** * Link grammar for graph-like diagrams (class, component, use case, state …): * * A "1" <|--[#red,dashed]up-- "many" B : label > * * The scanner masks quoted strings and bracketed names first, then locates the * arrow body (`-`, `.`, `=`, `~` runs with optional `[style]` and direction) * and reads the heads glued to either side. No backtracking-heavy regexes. * @module syntax/arrows */ export type ArrowSpec = { /** * Left head token (`<|`, `*`, `o`, …). */ left: string | null; /** * Right head token (`|>`, `>`, …). */ right: string | null; lineStyle: "solid" | "dashed" | "dotted"; bold: boolean; hidden: boolean; color: string | null; thickness: number | null; direction: "up" | "down" | "left" | "right" | null; /** * Number of body characters (1 = short / horizontal). */ length: number; raw: string; }; export type LinkSpec = { /** * Raw left endpoint text. */ from: string; /** * Raw right endpoint text. */ to: string; /** * Quoted multiplicity near `from`. */ fromLabel: string | null; /** * Quoted multiplicity near `to`. */ toLabel: string | null; arrow: ArrowSpec; /** * Text after `:`. */ label: string | null; }; /** * Parse a link line. Returns null when no arrow is present. * @param {string} line Trimmed line. * @returns {LinkSpec | null} */ export declare function parseLink(line: string): LinkSpec | null; /** * Canvas head names for an arrow spec. * @param {ArrowSpec} arrow * @returns {{ start: string | null, end: string | null }} */ export declare function headsOf(arrow: ArrowSpec): { start: string | null; end: string | null; };