UNPKG

1.71 kBTypeScriptView Raw
1import { ModuleFn } from '../index';
2export declare const isMacLike: () => boolean;
3export declare const controlOrMetaKey: () => "meta" | "control";
4export declare function keys<O>(o: O): (keyof O)[];
5export interface SubState {
6 shortcuts: Shortcuts;
7}
8export interface SubAPI {
9 getShortcutKeys(): Shortcuts;
10 setShortcuts(shortcuts: Shortcuts): Promise<Shortcuts>;
11 setShortcut(action: Action, value: KeyCollection): Promise<KeyCollection>;
12 restoreAllDefaultShortcuts(): Promise<Shortcuts>;
13 restoreDefaultShortcut(action: Action): Promise<KeyCollection>;
14 handleKeydownEvent(event: Event): void;
15 handleShortcutFeature(feature: Action): void;
16}
17export declare type KeyCollection = string[];
18export interface Shortcuts {
19 fullScreen: KeyCollection;
20 togglePanel: KeyCollection;
21 panelPosition: KeyCollection;
22 toggleNav: KeyCollection;
23 toolbar: KeyCollection;
24 search: KeyCollection;
25 focusNav: KeyCollection;
26 focusIframe: KeyCollection;
27 focusPanel: KeyCollection;
28 prevComponent: KeyCollection;
29 nextComponent: KeyCollection;
30 prevStory: KeyCollection;
31 nextStory: KeyCollection;
32 shortcutsPage: KeyCollection;
33 aboutPage: KeyCollection;
34 escape: KeyCollection;
35 collapseAll: KeyCollection;
36 expandAll: KeyCollection;
37}
38export declare type Action = keyof Shortcuts;
39export declare const defaultShortcuts: Shortcuts;
40export interface Event extends KeyboardEvent {
41 target: {
42 tagName: string;
43 addEventListener(): void;
44 removeEventListener(): boolean;
45 dispatchEvent(event: Event): boolean;
46 getAttribute(attr: string): string | null;
47 };
48}
49export declare const init: ModuleFn;