export interface FramePosition { aspectRatio: number; realIndex: number; virtualIndex: number; realBottom: number; virtualBottom: number; height: number; width: number; } export declare abstract class BaseMasonryGrid { /** * Container element that holds the grid. */ protected container: HTMLElement; /** * Grid gap value in pixels. * -1 means that the gap is not calculated or set. */ protected gap: number; /** * Width of the frame in pixels. * -1 means that the width is not calculated or set. */ protected frameWidth: number; /** * Width of the container in pixels. * -1 means that the width is not calculated or set. */ protected containerWidth: number; /** * Number of columns in the grid. * -1 means that the number of columns is not calculated or set. */ protected columnsCount: number; /** * Aspect ratio of the container. * -1 means that the aspect ratio is not calculated or set. */ protected containerAspectRatio: number; /** * Map of frames positions. * Key is the frame element, value is the FramePosition object. */ protected framesPositionsMap: WeakMap; /** * Resize observer to observe changes in the container and marker size. */ protected resizeObserver: ResizeObserver; /** * Mutation observer to observe changes in the container's children. */ protected mutationObserver: MutationObserver; /** * Marker element to observe column width changes. */ protected marker: HTMLElement; constructor( /** * Container element that holds the grid. */ container: HTMLElement); /** * Resize the height of the container based on the current width and aspect ratio. * If the aspect ratio is not set, the height will be removed. * Aspect ratio should be set while reflowing the grid. */ protected resizeHeight(): void; /** * Get the aspect ratio of the frame based on its width and height. * @param element - The frame element to calculate the aspect ratio for. * @returns The aspect ratio of the frame as a number (height / width). */ protected getFrameAspectRatio(element: HTMLElement): number; /** * Get the position of the frame in the grid. * @param element - The frame element to get the position for. * @param i - The real index of the frame in the grid. * @param offset - The offset from the top of the container in pixels. * @returns An object containing the position of the frame in the grid. */ protected getFramePosition(element: HTMLElement, i: number, offset: number): FramePosition; /** * Get the position of the frame in the grid and cache it. * @param element - The frame element to get the position for. * @param i - The real index of the frame in the grid. * @param offset - The offset from the top of the container in pixels. * @returns An object containing the position of the frame in the grid. */ protected getFramePositionAndCache(element: HTMLElement, i: number, offset: number): FramePosition; /** * Get the cached position of the frame in the grid and scale it to the current frame width. * If the frame position is not cached or the index does not match, return null. * @param element - The frame element to get the position for. * @param i - The real index of the frame in the grid. * @returns An object containing the scaled position of the frame in the grid or null if not found. */ protected getCachedScaledFramePosition(element: HTMLElement, i: number, framesCount: number): FramePosition | null; /** * Reflow the grid. * @param isMutation - Whether the reflow is triggered by a mutation (e.g. adding/removing frames). */ protected abstract reflow(isMutation?: boolean): void; /** * Destroy the MasonryGrid instance. */ destroy(): void; } //# sourceMappingURL=BaseMasonryGrid.d.ts.map