import type { Credit, DataSource } from "../data-door.ts"; import { type SourceBook, type SourceBookOptions } from "./book.ts"; /** What an element tells its host about the last drawn frame. */ export interface DoorFrame { /** The package's own credits, with how many marks each gave (`ownCredit`). */ own(): readonly Credit[]; /** How many marks or tiles each of the book's sources gave, by id. */ used(): ReadonlyMap; } export interface DoorHost { readonly book: SourceBook; /** The sources set by a page, in the order added. */ sources(): readonly DataSource[]; /** Replaces every source: all are checked first, and if one is refused nothing changes and the `TypeError` is thrown. */ setSources(list: readonly unknown[]): void; /** The credits of the last drawn frame, the package's own first. */ credits(): Credit[]; /** Fires `chikyu-creditschange` when the set of credited sources changed since the last call (not at each draw). */ announce(): void; } /** * Makes the door of one element. * * @param target - The element: it gets `chikyu-creditschange`. * @param frame - What the last drawn frame held. * @param options - The kinds of source the element draws. * @param redraw - Asked for when a source was added, removed or switched, or its records were read. * @returns The host. */ export declare function createDoorHost(target: EventTarget, frame: DoorFrame, options: SourceBookOptions, redraw: () => void): DoorHost;