/** * rgui core — auto-layout by graph optimization on connections. * * Layered (Sugiyama-lite) layout: longest-path layering from sources, * barycenter ordering to reduce crossings, grid-snapped positions. * Pinned nodes keep their positions — the layout flows around them. */ import { type Graph } from "./graph.js"; export interface LayoutOptions { /** horizontal gap between layers (world units) */ gapX?: number; /** vertical gap between nodes in a layer (world units) */ gapY?: number; /** grid step to snap positions to */ gridStep?: number; /** layout origin (top-left of the arrangement) */ origin?: { x: number; y: number; }; } /** Pure: returns new positions for every non-pinned node. */ export declare function layoutGraph(graph: Graph, opts?: LayoutOptions): Map; export interface DenseLayoutOptions { /** Main-grid step. Every returned coordinate and size is a multiple of it. */ gridStep?: number; /** Empty main-grid cells between non-contracted blocks (default 1). */ gapCells?: number; /** Deterministic barycentric relaxation passes (default 8). */ relaxationPasses?: number; /** Snapped top-left origin of the arrangement. */ origin?: { x: number; y: number; }; } export interface DenseLayoutRect { x: number; y: number; w: number; h: number; } export interface DenseLayoutResult { /** Snapped geometry for every graph node; applying it is host-owned. */ nodes: Map; /** Maximal direct chains, including singleton blocks, in deterministic order. */ chains: string[][]; } /** * Dense, deterministic workflow layout. * * A directed A→B edge contracts iff A has exactly one distinct outgoing * graph neighbor (B) and B has exactly one distinct incoming graph neighbor * (A). A may have incoming edges and B may have outgoing edges, so the rule * builds maximal direct chains while every fan-in/fan-out boundary remains * separated by at least one main-grid cell. Parallel port edges do not alter * the distinct-neighbor degree. Cycles have no valid all-left-to-right layout; * a cycle is cut deterministically at its lexicographically smallest member. * * Pure: sizes are snapped upward, positions are snapped, and returned boxes * never overlap (contracted neighbors may touch flush at an edge). */ export declare function layoutDenseGraph(graph: Graph, opts?: DenseLayoutOptions): DenseLayoutResult; //# sourceMappingURL=layout.d.ts.map