import { FormContext } from "../components/LajiForm";
export type KeyFunctions = {
    [fnName: string]: (e: KeyboardEvent, options: any) => boolean | void;
};
interface ShortcutKey {
    fn: string;
    target?: string;
    [param: string]: any;
}
export type ShortcutKeys = Record<string, ShortcutKey>;
export interface InternalKeyHandler extends ShortcutKey {
    conditions: ((e: KeyboardEvent) => boolean)[];
}
type InternalKeyHandlers = InternalKeyHandler[];
/**
 *
 * A service for adding key listeners. Key events are handled in a custom event handling system, which allows many useful
 * features like listening to DOM document root, fine grained control over the order of event bubbling etc and passing any
 * needed data to the event handler.
 *
 * When initialized, it adds a global keydown listener to the document which handles the LajiForm key shortcuts defined in
 * uiSchema["ui:shortcuts"].
 *
 **/
export default class KeyhandlerService {
    shortcuts: ShortcutKeys;
    private keyHandlers;
    private keyHandlerTargets;
    private keyHandleListeners;
    private keyHandleIdFunctions;
    private blocked;
    private formContext;
    private globalEventsRootHandler;
    private globalEventHandlers;
    constructor(formContext: FormContext);
    initialize(): void;
    destroy(): void;
    block(): void;
    unblock(): void;
    setShortcuts(shortcuts: ShortcutKeys | undefined, keyFunctions: KeyFunctions): void;
    setFormContext(formContext: FormContext): void;
    getKeyHandlers(shortcuts?: ShortcutKeys): InternalKeyHandlers;
    addKeyHandler: (id: string, keyFunctions: KeyFunctions, additionalParams?: any) => void;
    removeKeyHandler: (_id: string, _keyFunctions: {
        [fnName: string]: () => boolean | void;
    }) => void;
    onKeyDown(e: KeyboardEvent): void;
    /**
     * Global event handlers are listened for the whole DOM document. React can't listen to events on document level, hence this is useful.
     **/
    addGlobalEventHandler(name: string, fn: React.EventHandler<any>): void;
    removeGlobalEventHandler(name: string, fn: React.EventHandler<any>): void;
    private handleKeysWith;
}
export {};
