import type { GridUnitType } from '../../../Types/GridUnitType'; /** * Represents the shape of a `GridLength` value. * * A `GridLength` describes the sizing behavior of a single grid track * (column or row). It pairs a numeric `value` * with a `type` that indicates how the value * is interpreted: * * | Type | Meaning | * |---------|----------------------------------------------------------| * | `pixel` | Fixed size in device-independent pixels (CSS px). | * | `auto` | Size is determined by the content of the track. | * | `star` | Remaining space is distributed proportionally by factor. | * * @public */ export interface IGridLength { /** * The numeric component of the grid length. * * - For `pixel` tracks this is the fixed size in pixels/DIPs. * - For `star` tracks this is the proportional factor (e.g. `2` in `2*`). * - For `auto` tracks this value is ignored (conventionally `1`). * * Must be non-negative. * * @public * @readonly */ get value(): number; /** * The unit type that determines how `value` is * interpreted. * * @public * @readonly */ get type(): GridUnitType; } /** * Accepted shorthand forms for specifying a grid track size. * * Use this type instead of bare `string` to get compile-time validation * of grid length values. * * | Input | Meaning | * |------------------|--------------------------------------------| * | `number` | Fixed size in pixels/DIPs. | * | `'auto'` | Content-based sizing. | * | `'*'` | 1 star (proportional). | * | `` `${n}*` `` | N stars (e.g. `'2*'`, `'0.5*'`). | * * @public */ export type GridLengthInput = number | 'auto' | '*' | `${number}*`; /** * Immutable value object that describes the sizing of a single grid track. * * Three sizing modes are supported: * * - **Absolute (pixel)** – a fixed size in device-independent pixels. * - **Auto** – the track sizes to fit its content. * - **Star** – remaining free space is distributed proportionally. * * Instances are created either via the constructor or through the * `parseGridLength` helper that accepts shorthand string / number * forms. * * @example * ```ts * const pixel = new GridLength(120, 'pixel'); // 120 px * const auto = new GridLength(1, 'auto'); // auto * const star = new GridLength(2, 'star'); // 2* * const oneStar = new GridLength(); // 1* (default) * ``` * * @public */ export declare class GridLength implements IGridLength { private readonly _value; private readonly _type; /** * Constructs a new instance of the `GridLength` class. * * @param value The numeric component. Must be non-negative. Defaults to `1`. * @param type The unit type. Defaults to `'star'`. * * @throws {Error} If `value` is negative. * * @public */ constructor(value?: number, type?: GridUnitType); /** * Gets the numeric component of this grid length. * * @public * @readonly */ get value(): number; /** * Gets the unit type of this grid length. * * @public * @readonly */ get type(): GridUnitType; /** * Returns `true` when the track uses absolute (pixel) sizing. * * @public * @readonly */ get isAbsolute(): boolean; /** * Returns `true` when the track uses automatic (content-based) sizing. * * @public * @readonly */ get isAuto(): boolean; /** * Returns `true` when the track uses star (proportional) sizing. * * @public * @readonly */ get isStar(): boolean; /** * Returns a human-readable string representation. * * @returns `"auto"` | `"{value}"` | `"{value}*"` (or `"*"` when value is 1). * * @public */ toString(): string; } /** * Parses a string or number into a `GridLength` instance. * * **Accepted formats** * * | Input | Result | * |----------------|-------------------------------| * | `120` | `GridLength(120, 'pixel')` | * | `"120"` | `GridLength(120, 'pixel')` | * | `"12.5"` | `GridLength(12.5, 'pixel')` | * | `"auto"` | `GridLength(1, 'auto')` | * | `"*"` | `GridLength(1, 'star')` | * | `"2*"` | `GridLength(2, 'star')` | * | `"0.5*"` | `GridLength(0.5, 'star')` | * * **Rejected inputs** – any CSS unit suffix (`px`, `em`, `%`, `fr`, …), * negative values, case variations like `"Auto"` or `"AUTO"`, or * otherwise unrecognized strings will throw. * * @public * @param value A number or string to parse. * @returns A new `GridLength` instance. * @throws {Error} When the input does not match any accepted format. * @throws {Error} When a negative value is encountered. */ export declare function parseGridLength(value: string | number): GridLength; //# sourceMappingURL=GridLength.d.ts.map