@expofp/floorplan
Version:
Interactive floor plan library for expos and events
30 lines • 1.41 kB
TypeScript
import type { Logo } from '@expofp/schema';
import type { Exhibitor } from '../../store/ExhibitorStore.js';
import { type ImageUrls } from '../../utils/loadImagesInBatches.js';
export interface LoadedLogo {
/** The URL that actually loaded — the scaled variant or the full logo. */
src: string;
/** `naturalWidth / naturalHeight`; `NaN` for an SVG without intrinsic size. */
aspectRatio: number;
}
/**
* The URLs to try for one logo. The device policy picks whether to load a
* scaled variant at all, but this bar never goes below `small`: a `tiny` logo
* blurs in 40–44 px tiles on 2–3× screens. `preferred` is skipped when it
* equals the fallback, so a broken logo is not requested twice.
*/
export declare function logoUrls(logo: Logo): ImageUrls;
/**
* Preloads logos in batches over a growing prefix of `items`. The first batch
* starts on mount; `loadMore` requests the next one. A logo that fails to load
* is absent from `loaded`.
* @param items - Exhibitors in rotation order. Must be stable across renders.
* @param batchSize - Logos per batch.
* @returns What loaded, how many leading items were attempted, and `loadMore`.
*/
export declare function useLogoPreload(items: readonly Exhibitor[], batchSize: number): {
loaded: ReadonlyMap<number, LoadedLogo>;
attempted: number;
loadMore: () => void;
};
//# sourceMappingURL=use-logo-preload.d.ts.map