/** * Defines the resizing behavior of a grid track (column or row). * - `fluid`: The track size is calculated as a percentage of the container (using `fr` units). * - `static`: The track size is fixed in pixels or other absolute units. */ export type Mode = "fluid" | "static"; /** * Configuration for a grid track's size and constraints. */ export type SizeConstraint = { /** Minimum size in pixels. */ minSize?: number; /** Maximum size in pixels. */ maxSize?: number; /** Current size of the track. */ size: number; /** Resizing mode for this track. */ mode?: Mode; }; /** * Represents a size value, which can be a CSS string, a number (pixels), or a constraint object. */ export type Size = string | number | SizeConstraint; /** * Default configuration for grid columns and rows. */ export type GridDefaults = { /** Initial sizes for columns. */ defaultColumns?: Array; /** Initial sizes for rows. */ defaultRows?: Array; }; /** * Represents a single column in the grid. */ export type Column = { /** The 0-based index of the column. */ index: number; /** The size of the column (e.g., "1fr", "200px"). */ size: string | number; }; /** * Array of Column objects. */ export type Columns = Array; /** * Represents a single row in the grid. */ export type Row = { /** The 0-based index of the row. */ index: number; /** The size of the row. */ size: string | number; }; /** * Represents a grid entry with constraints but without the strict `size: number` requirement of `SizeConstraint`. * Used for internal state where size might be a string during initialization. */ export type GridEntry = Omit & { /** The 0-based index of the entry. */ index: number; /** The current size of the entry. */ size: string | number; }; /** * Array of Row objects. */ export type Rows = Array; /** * Represents the current state of the grid, including all columns and rows. */ export type GridState = { /** List of column states. */ columns: Array; /** List of row states. */ rows: Array; }; /** * Configuration object for initializing the grid. */ export type GridConfig = GridDefaults & { /** Number of columns. */ columns?: number; /** Number of rows. */ rows?: number; }; /** * Helper type for defining default values for grid tracks. */ export type DefaultValue = { /** Default sizes for columns. */ columns?: Array; /** Default sizes for rows. */ rows?: Array; };