export declare enum TrackSizeType { Pixel = "px", Percentage = "%", Fraction = "fr" } export interface GridTrackSize { amount?: number; sizeType: TrackSizeType; asString: () => string; } /** * Names for the grid line (i.e. represented in css as [name1 name2 ... nameN] */ export interface GridLineNames { names: Array; asString: () => string; } /** * The css grid-track which holds the names of the grid-lines to the left of the * track and the size of the track */ export interface GridTrack { lineNames?: GridLineNames; track: GridTrackSize; } /** * The css grid-template-row or grid-template-column holding the track-list (which * hold the names of the grid-line to the left of the track), the names of the * last grid-line (optional), a function for calculating the track sizes given * the container (width or height) dimension and (row or column) gap size, and a * function for converting the grid-template to a string that can be handed * directly to a css grid-template-row or grid-template-column. */ export interface GridTrackTemplate { trackList: Array; lastLineNames?: GridLineNames; trackSizes: (containerDimension: number, gap?: number) => Array; asString: () => string; } export declare const emptyGridTrackTemplate: () => GridTrackTemplate; /** * Interface defining the grid-template-row or grid-template-column builder. You can create the * builder with the [gridTrackTemplateBuilder](#gridTrackTemplateBuilder) function. */ export interface GridTrackTemplateBuilder { readonly template: GridTrackTemplate; addTrack: (track: GridTrackSize, lineNames?: GridLineNames) => GridTrackTemplateBuilder; repeatFor: (times: number, ...track: Array) => GridTrackTemplateBuilder; build: (lastLineNames?: GridLineNames) => GridTrackTemplate; } /** * Creates a new grid */ export declare function gridTrackTemplateBuilder(): GridTrackTemplateBuilder; export declare function withLineNames(...names: string[]): GridLineNames; export declare function withGridTrack(gridTrackSize: GridTrackSize, ...names: string[]): GridTrack; export declare function withPixels(pixels: number): GridTrackSize; export declare function withPercentage(percentage: number): GridTrackSize; export declare function withFraction(fraction: number): GridTrackSize; /** * Calculates the cell dimension (width or height) from the track size, correcting for gaps added for * spanned dimension (rows or columns). The returned dimension (width or height) is the dimension of * contents of the cell, after applying the row or column gaps. * @param containerSize The dimension of the parent container * @param dimension The row or column index of the cell * @param gap The row or column gap * @param spanned The number of rows or columns which the cell spans * @param gridTrackTemplate The row or column grid-track template defining the tracks * @return The width or height of the cell, after accounting for the row or column gap */ export declare function cellDimensionFor(containerSize: number, dimension: number, gap: number, spanned: number, gridTrackTemplate: GridTrackTemplate): number; /** * Attempts to resolve the row or column index for the specified index or grid line-name. When the * identifier is a number, then that is returned as the index (a simple passthrough). When the identifier * is a string, then the attempts to find the index that holds the name, and uses that. * @param identifier The identifier is either the row or column index, or a grid line-name * @param template The css-grid track template represented by the [GridTrackTemplate](#GridTrackTemplate) * @return The row or column number in the grid, or 0 if not found */ export declare function trackIndexFor(identifier: number | string, template: GridTrackTemplate): number; /** * Returns an array that holds the grid line-names for the grid-template-rows or grid-template-columns * @param template The grid-template-row or grid-template-column * @return an array that holds the grid line-names */ export declare function gridLineNamesFor(template: GridTrackTemplate): Array; //# sourceMappingURL=gridTemplates.d.ts.map