import type { Context } from './context'; /** * The `ShortcutManager` API lets you store and manage [keyboard shortcut contexts](@/guides/navigation/keyboard-shortcuts/keyboard-shortcuts.md#keyboard-shortcut-contexts) ([`ShortcutContext`](@/api/shortcutContext.md)). * * Each `ShortcutManager` object: * - Stores and manages its own set of keyboard shortcut contexts. * - Listens to the [`KeyboardEvent`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent) events and runs actions for them. * * @alias ShortcutManager * @class ShortcutManager * @param {object} options The manager's options * @param {EventTarget} options.ownerWindow A starting `window` element * @param {Function} options.handleEvent `(event, scope) => boolean` -- whether the active context's shortcut pipeline * may run. `scope` is `'table'` or `'global'` from the active {@link ShortcutContext}. Global-scoped contexts are * also evaluated when this returns `false` (see `dispatchGlobalShortcutsWhenTableBlocked` in the recorder). * @param {Function} options.beforeKeyDown A hook fired before the `keydown` event is handled. You can use it to [block a keyboard shortcut's actions](@/guides/navigation/keyboard-shortcuts/keyboard-shortcuts.md#block-a-keyboard-shortcut-s-actions). * @param {Function} options.afterKeyDown A hook fired after the `keydown` event is handled */ export interface ShortcutManager { addContext(contextName: string, scope?: string): Context; getActiveContextName(): string; getContext(contextName: string): Context | undefined; getOrCreateContext(contextName: string, scope?: string): Context; setActiveContextName(contextName: string): void; hasEventShortcut(contextName: string, event: KeyboardEvent): boolean; isCtrlPressed(): boolean; releasePressedKeys(): void; destroy(): void; } export declare const createShortcutManager: ({ ownerWindow, handleEvent, beforeKeyDown, afterKeyDown }: { ownerWindow: EventTarget; handleEvent: (event: KeyboardEvent, scope: string) => boolean; beforeKeyDown: (event: KeyboardEvent) => void; afterKeyDown: (event: KeyboardEvent) => void; }) => ShortcutManager;