mermaid
Version:
Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.
24 lines (23 loc) • 1.44 kB
TypeScript
import type { Node } from '../../types.js';
import { type GridLayoutConfigNormalized, type GridResolvedPlacement, type GridLayoutData, type GridCellStack } from './types.js';
export declare function buildGridSourceOrder(nodes: Node[]): Map<string, number>;
/**
* Normalizes public grid options, applying defaults to unsupported spacing and rendering values.
* Placement objects become occurrence arrays; authored coordinates remain unchanged so
* placement resolution can reject invalid values rather than silently moving nodes.
*/
export declare function readGridConfig(data: GridLayoutData): GridLayoutConfigNormalized;
/**
* Warns about unknown placement targets and entries exceeding the number of matching nodes.
* Matches authored placement IDs when available, otherwise emitted IDs; does not mutate the map.
*/
export declare function validateGridPlacementMap(items: Iterable<Node>, config: GridLayoutConfigNormalized): void;
/**
* Assigns sibling nodes to cells in source order, reserving explicit cells before auto-placement.
* Repeated authored IDs consume successive map entries. Explicit cell occupants form stacks,
* but conflicting vertical alignments throw `GRID_CELL_ALIGNMENT_CONFLICT`.
*/
export declare function resolveGridPlacements(items: Node[], sourceOrder: Map<string, number>, config: GridLayoutConfigNormalized): {
placements: GridResolvedPlacement[];
cells: Map<string, GridCellStack>;
};