@expofp/floorplan
Version:
Interactive floor plan library for expos and events
43 lines • 1.69 kB
TypeScript
import { type LogoPage } from './logo-page.js';
export interface LogoRotationOptions<T> {
/** Candidates in rotation order. */
items: readonly T[];
/** False until the first preload batch settles; nothing is laid out before. */
ready: boolean;
widthOf: (item: T) => number | undefined;
/** The width tiles may fill, measured from the strip. */
measureWidth: () => number;
spacing: number;
/** Changes whenever the page's inputs do; a change re-lays out the current page. */
layoutKey: string;
paused: boolean;
delayMs: number;
debounceMs: number;
}
export interface LaidOutPage<T> extends LogoPage<T> {
/** The width this page was fitted to. */
maxWidth: number;
/**
* Grows with every rotation but not with a re-layout. Keying tiles by it
* fades a new page in whole while a resize keeps the tiles it can.
*/
seq: number;
}
export interface LogoRotation<T> {
/** The current page, or null before the first one. */
page: LaidOutPage<T> | null;
/**
* Counts layout passes, including re-layouts that leave `page` as it was.
* After a new pass the page reflects the inputs as of that pass.
*/
pass: number;
}
/**
* Shows one page of logos at a time and advances every `delayMs`. A change of
* `layoutKey` rebuilds the current page in place; a page that already holds
* every loaded logo, or none, does not rotate.
* @param options - See {@link LogoRotationOptions}.
* @returns The current page and the layout pass it is current for.
*/
export declare function useLogoRotation<T>(options: LogoRotationOptions<T>): LogoRotation<T>;
//# sourceMappingURL=use-logo-rotation.d.ts.map