/** * Normalize all coordinate inputs to canonical 0-based `{col, row}` * form, AND fill in missing node positions for nodes that omitted them. * * Coordinates reach us in one of four public shapes (all 1-based): * * - A1 string: "A1", "B3", "aa100" (via `normPos`) * - tuple: [1, 1] * - named: { col: 1, row: 1 } * - (waypoint): fractional tuple / named — 1-based too * * Internally gridgram stores `GridPos` as 0-based (so `A1` is * `{col: 0, row: 0}`) because every piece of layout math reads `.col` / * `.row` as a plain cell index. * * Two normalizations happen here: * * 1. Input-form → canonical object + 1-based → 0-based shift. * 2. Auto-positioning — nodes without `pos` get successive * coordinates starting at (0, 0). col increments along row 0; * when `columns` is set explicitly, wraps into the next row. * Explicit positions are kept as-is and don't move the auto * counter. * * All helpers are pure. */ import type { ConnectorDef, GridPos, GridPosInput, NodeDef, NoteDef, RegionDef, NormalizedConnectorDef, NormalizedNodeDef, NormalizedNoteDef, NormalizedRegionDef, WayPoint, WayPointInput } from './types.js'; /** * Coerce any `GridPosInput` to its canonical 0-based `{col, row}` * object. Throws with a readable message if the input is malformed * (bad A1 address, non-integer for tuple/object, col or row < 1). */ export declare function normPos(p: GridPosInput): GridPos; /** * Coerce any `WayPointInput` to its canonical 0-based `{col, row}` * object. Waypoints may be fractional (e.g. 1.5) but must still be * ≥ 1 in user-facing 1-based coordinates — a waypoint "before A1" * is not meaningful on the grid. */ export declare function normWayPoint(p: WayPointInput): WayPoint; /** Normalise + auto-fill positions for every node. */ export declare function assignAutoPositions(nodes: NodeDef[], columns?: number): NormalizedNodeDef[]; /** Normalise input-form waypoints inside connectors. */ export declare function normalizeConnectorWaypoints(connectors: ConnectorDef[]): NormalizedConnectorDef[]; /** Normalise input-form positions inside notes. */ export declare function normalizeNotes(notes: NoteDef[]): NormalizedNoteDef[]; /** Normalise input-form span endpoints inside regions. */ export declare function normalizeRegions(regions: RegionDef[]): NormalizedRegionDef[]; //# sourceMappingURL=auto-position.d.ts.map