import { ConstraintSolution, ConstraintSolverInterface, ConstraintViolation, Dimensions, LayoutConstraint } from './types'; /** * Layout constraint solver that handles complex layout requirements * using a priority-based relaxation algorithm. * * @example * ```typescript * const solver = new ConstraintSolver(); * solver.addConstraint({ * id: 'min-width-card', * type: 'min-width', * priority: 'strong', * params: { type: 'dimension', value: 200, unit: 'px' }, * active: true * }); * * const solution = solver.solve( * new Map([['card-1', { width: 150, height: 100 }]]), * { width: 800, height: 600 } * ); * ``` */ export declare class ConstraintSolver implements ConstraintSolverInterface { private readonly _constraints; private readonly _itemConstraints; constructor(); /** * Adds a new constraint to the solver. * * @param constraint - The constraint to add */ addConstraint(constraint: LayoutConstraint): void; /** * Removes a constraint from the solver. * * @param id - The constraint ID to remove */ removeConstraint(id: string): void; /** * Updates an existing constraint. * * @param id - The constraint ID to update * @param updates - Partial constraint updates */ updateConstraint(id: string, updates: Partial): void; /** * Solves the constraint system for the given items and container. * * @param items - Map of item IDs to their current dimensions * @param containerDimensions - Container dimensions * @returns The constraint solution */ solve(items: ReadonlyMap, containerDimensions: Dimensions): ConstraintSolution; /** * Validates a solution against all active constraints. * * @param solution - The solution to validate * @returns Array of constraint violations */ validate(solution: ConstraintSolution): readonly ConstraintViolation[]; /** * Clears all constraints from the solver. */ clear(): void; /** * Initializes the solver state from input items. */ private _initializeState; /** * Performs one iteration of the relaxation algorithm. */ private _iterate; /** * Applies a single constraint to an item. */ private _applyConstraint; /** * Applies minimum width constraint. */ private _applyMinWidth; /** * Applies maximum width constraint. */ private _applyMaxWidth; /** * Applies minimum height constraint. */ private _applyMinHeight; /** * Applies maximum height constraint. */ private _applyMaxHeight; /** * Applies aspect ratio constraint. */ private _applyAspectRatio; /** * Applies alignment constraint. */ private _applyAlignment; /** * Applies spacing constraint between items. */ private _applySpacing; /** * Applies ordering constraint. */ private _applyOrder; /** * Applies visibility constraint. */ private _applyVisibility; /** * Applies containment constraint. */ private _applyContainmentConstraint; /** * Ensures item stays within container bounds. */ private _applyContainment; /** * Resolves a value with unit to pixels. */ private _resolveValue; /** * Checks if a constraint applies to a specific item. */ private _constraintAppliesToItem; /** * Checks a single constraint and returns a violation if violated. */ private _checkConstraint; } /** * Creates a new ConstraintSolver instance. * * @returns A new ConstraintSolver instance */ export declare function createConstraintSolver(): ConstraintSolverInterface;