import { KeyCombo, KeyboardPeripheral } from "./KeyboardCombinations.ts"; import { BaseKeyboardPeripheralEvent, KeyboardEventData } from "../modules/Peripherals.ts"; import { ReadiumWindow } from "../helpers/dom.ts"; export type KeyHandler = (event: KeyboardEvent) => void; export type ActivityEventDispatcher = (event: KeyboardPeripheralEvent) => void; export interface KeyboardPeripheralEvent extends BaseKeyboardPeripheralEvent, KeyboardEventData { type: string; } export interface KeyComboWithHandler extends KeyCombo { handler?: (event: KeyboardEvent) => void; } export declare class KeyCombinationManager { /** * Checks if the given keyboard event matches any of the provided key combinations */ match(event: KeyboardEvent, combos: KeyCombo[]): boolean; private matchesCombo; private matchesModifier; /** * Creates an event handler that will call the provided handler when any of the key combinations match */ createKeyHandler(combos: KeyCombo[], handler: KeyHandler): (event: KeyboardEvent) => void; /** * Creates a standardized activity event for keyboard shortcuts */ private createActivityEvent; /** * Creates handlers for keyboard shortcuts with centralized activity event dispatch */ createKeyboardHandlers(targetFrameSrc: string, shortcuts: KeyboardPeripheral[], dispatcher: ActivityEventDispatcher, wnd?: ReadiumWindow): KeyComboWithHandler[]; /** * Creates a unified keyboard event handler that processes all shortcuts */ createUnifiedHandler(targetFrameSrc: string, shortcuts: KeyboardPeripheral[], dispatcher: ActivityEventDispatcher, wnd?: ReadiumWindow): (event: KeyboardEvent) => void; }