import { AnyDecision, StringOrFunction } from '@moxb/util'; import { KeyboardAction, KeyboardShortcutGroup, KeyboardShortcutsManager } from './KeyboardShortcutsManager'; export interface KeyboardShortGroupOptions { readonly id: string; /** * If label is a function it assumes that the function returns a translated label. * If label is a string, the assumption is that this is the default translation and the translation key is `id.label` */ label?: StringOrFunction; /** * Note: you can either specify a `disabled` or an `enabled` function! * * @returns {boolean} `true` if the the element should be disabled */ disabled?(): AnyDecision; /** * Note: you can either specify a `disabled` or an `enabled` function! * @returns {boolean} `false` if the element should be disabled */ enabled?(): AnyDecision; /** * Must be a non changing list */ readonly shortcuts: KeyboardAction[]; } export declare class KeyboardShortcutGroupImpl implements KeyboardShortcutGroup { private readonly impl; readonly id: string; readonly shortcuts: KeyboardAction[]; constructor(impl: KeyboardShortGroupOptions); get label(): string | undefined; get enabled(): boolean; } /** * The implementation of a keyboard bind function -- typically something like mousetrap */ export interface ShortcutBinder { bind(key: string, action: () => void): void; unbind(key: string): void; } export declare class KeyboardActionDecorator implements KeyboardAction { private readonly action; constructor(action: KeyboardAction); get label(): string | undefined; protected getLabel(): string | undefined; get keyboardShortcuts(): string[]; protected getKeyboardShortcuts(): string[]; get enabled(): boolean; protected getEnabled(): boolean; fire(): void; } export declare class KeyboardShortcutsManagerImpl implements KeyboardShortcutsManager { private readonly binder; private readonly _shortcuts; private readonly keyboardMap; /** * * @param binder */ constructor(binder: ShortcutBinder); registerKeyboardShortcuts(shortcuts: KeyboardShortcutGroup): void; unregisterKeyboardShortcuts(shortcuts: KeyboardShortcutGroup): void; get shortcuts(): KeyboardShortcutGroup[]; get actionMd(): string; }