import { GridLength, type GridLengthInput } from './GridLength'; import { RowDefinition } from './RowDefinition'; /** * Describes the object form of a single row definition input. * * The `height` property is required and accepts any `GridLengthInput` * shorthand or a `GridLength` instance. The optional `minHeight` and * `maxHeight` constrain the resolved track height in pixels/DIPs. * * @example * ```ts * const row: IRowDefinitionInput = { * height: '2*', * minHeight: 40, * maxHeight: 200, * }; * ``` * * @public */ export interface IRowDefinitionInput { /** * The height specification for this row. * * Accepts a `GridLengthInput` shorthand (`number`, `'auto'`, * `'*'`, `` `${number}*` ``) or a `GridLength` instance. * * @public */ height: GridLengthInput | GridLength; /** * The minimum height of this row in pixels/DIPs. * Must be non-negative. Defaults to `0` when omitted. * * @public */ minHeight?: number; /** * The maximum height of this row in pixels/DIPs. * Must be non-negative and `≥ minHeight`. * Defaults to `Number.MAX_SAFE_INTEGER` when omitted. * * @public */ maxHeight?: number; } /** * Accepted input for a single row track. * * | Form | Example | Meaning | * |-----------------------------|--------------------------------------------------|------------------------------------------| * | `number` | `100` | Fixed height in pixels/DIPs. | * | `'auto'` | `'auto'` | Content-based sizing. | * | `'*'` / `` `${number}*` `` | `'*'`, `'2*'`, `'0.5*'` | Star (proportional) sizing. | * | object | `{ height: '2*', minHeight: 40, maxHeight: 200 }` | Full definition with optional min/max. | * * Bare `string` is **not** accepted - only the exact literal forms listed * above pass compile-time validation. * * @public */ export type RowDefinitionInput = GridLengthInput | IRowDefinitionInput; /** * A space-separated string of `GridLengthInput` tokens that can be * used as an HTML attribute value to define row tracks. * * Each token must be one of: * - A non-negative number (pixels/DIPs), e.g. `"100"` * - `"auto"` for content-based sizing * - `"*"` or `"n*"` for star (proportional) sizing, e.g. `"2*"` * * Tokens are separated by whitespace. * * @example * ```html * * ``` * * @public */ export type RowDefinitionsString = string & { readonly __brand?: 'RowDefinitionsString'; }; /** * Row track definitions for a grid layout. * * Accepts either an array of `RowDefinitionInput` entries (for * programmatic / Lit property binding usage) or a space-separated * `RowDefinitionsString` (for plain HTML attribute usage). * * The array length (or number of tokens) determines the number of * rows; each entry defines the sizing of the corresponding row track. * * @example * Array form (JavaScript / Lit property binding): * ```ts * const rows: RowDefinitions = [ * 'auto', // content-sized * '*', // 1 star (proportional) * '2*', // 2 stars (proportional) * 100, // 100 px fixed * { height: '0.5*', minHeight: 40, maxHeight: 200 } * ]; * ``` * * @example * String form (HTML attribute): * ```html * * ``` * * @public */ export type RowDefinitions = Array | RowDefinitionsString; /** * @public */ export declare namespace RowDefinitions { /** * Parses a `RowDefinitions` value (array or space-separated * string) into validated `RowDefinition` instances. * * When `self` is a `string`, it is first split on whitespace into * individual tokens, each of which must be a valid * `GridLengthInput` literal (`number`, `'auto'`, `'*'`, * `` `${number}*` ``). * * When `self` is an array, each element is validated strictly: * - Numbers must be non-negative (absolute pixel sizing). * - String literals are parsed via `parseGridLength`. * - Object entries must carry a valid `height` and optional * non-negative `minHeight` / `maxHeight` where `minHeight ≤ maxHeight`. * * @public * @param self The raw definitions to parse. * @returns An array of fully validated `RowDefinition` instances. * @throws {Error} If any entry is invalid. */ function parse(self: RowDefinitions): Array; /** * Parses a space-separated string of grid-length tokens into an * array of `RowDefinitionInput` values. * * Each whitespace-delimited token is interpreted as a * `GridLengthInput`: a non-negative number (pixels), `"auto"`, * `"*"`, or `"n*"` (star sizing). * * @example * ```ts * RowDefinitions.fromString('auto * 100'); * // → ['auto', '*', 100] * ``` * * @public * @param value The space-separated definition string. * @returns An array of parsed `RowDefinitionInput` values. * @throws {Error} If the string is empty or any token is invalid. */ function fromString(value: RowDefinitionsString): Array; /** * Serializes a `RowDefinitions` value into a space-separated * string suitable for use as an HTML attribute value. * * Each entry is converted to its shortest `GridLength` string * representation via `GridLength.toString`. Object entries * (with `minHeight`/`maxHeight`) are serialized using their `height` * component only, as min/max constraints cannot be expressed in the * string format. * * @example * ```ts * RowDefinitions.toString(['auto', '*', 100]); * // → 'auto * 100' * ``` * * @public * @param self The definitions to serialize. * @returns A space-separated string representation. */ function toString(self: RowDefinitions): RowDefinitionsString; } //# sourceMappingURL=RowDefinitions.d.ts.map