import { Emitter } from "./emitter.mjs"; import type { CloseReason, Item, PencereEvents, PencereOptions } from "./types.mjs"; export interface PencereState { readonly items: readonly T[]; readonly index: number; readonly isOpen: boolean; } export declare class Pencere { readonly events: Emitter>; private items; private loop; private currentIndex; private opened; private readonly controlled; constructor(options: PencereOptions); /** Whether the state machine is in controlled (external) mode. */ get isControlled(): boolean; get state(): PencereState; get item(): T; setItems(items: T[]): void; open(index?: number): Promise; close(reason?: CloseReason): Promise; goTo(index: number): Promise; /** * Commit an open in controlled mode. Consumers call this from * their `requestOpen` listener after their external store has * applied the change. No-op in uncontrolled mode — uncontrolled * `open()` already commits synchronously. */ commitOpen(index: number): void; /** Commit a navigation in controlled mode. */ commitChange(index: number): void; /** Commit a close in controlled mode. */ commitClose(reason?: CloseReason): void; /** * Advance to the next slide. At the last index with `loop: false`, * resolves as a silent no-op — no `change` event is emitted and * no error is thrown. Consumers that need to detect the boundary * should check `state.index === state.items.length - 1` first, or * disable their Next button at the edge (as the DOM viewer does). */ next(): Promise; /** * Step to the previous slide. At index 0 with `loop: false`, * resolves as a silent no-op — same contract as `next()`. */ prev(): Promise; destroy(): void; }