UNPKG

2.37 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 getDefaultShortcuts(): Shortcuts | AddonShortcutDefaults;
11 getAddonsShortcuts(): AddonShortcuts;
12 getAddonsShortcutLabels(): AddonShortcutLabels;
13 getAddonsShortcutDefaults(): AddonShortcutDefaults;
14 setShortcuts(shortcuts: Shortcuts): Promise<Shortcuts>;
15 setShortcut(action: Action, value: KeyCollection): Promise<KeyCollection>;
16 setAddonShortcut(addon: string, shortcut: AddonShortcut): Promise<AddonShortcut>;
17 restoreAllDefaultShortcuts(): Promise<Shortcuts>;
18 restoreDefaultShortcut(action: Action): Promise<KeyCollection>;
19 handleKeydownEvent(event: Event): void;
20 handleShortcutFeature(feature: Action): void;
21}
22export declare type KeyCollection = string[];
23export interface Shortcuts {
24 fullScreen: KeyCollection;
25 togglePanel: KeyCollection;
26 panelPosition: KeyCollection;
27 toggleNav: KeyCollection;
28 toolbar: KeyCollection;
29 search: KeyCollection;
30 focusNav: KeyCollection;
31 focusIframe: KeyCollection;
32 focusPanel: KeyCollection;
33 prevComponent: KeyCollection;
34 nextComponent: KeyCollection;
35 prevStory: KeyCollection;
36 nextStory: KeyCollection;
37 shortcutsPage: KeyCollection;
38 aboutPage: KeyCollection;
39 escape: KeyCollection;
40 collapseAll: KeyCollection;
41 expandAll: KeyCollection;
42}
43export declare type Action = keyof Shortcuts;
44interface AddonShortcut {
45 label: string;
46 defaultShortcut: KeyCollection;
47 actionName: string;
48 showInMenu?: boolean;
49 action: (...args: any[]) => any;
50}
51declare type AddonShortcuts = Record<string, AddonShortcut>;
52declare type AddonShortcutLabels = Record<string, string>;
53declare type AddonShortcutDefaults = Record<string, KeyCollection>;
54export declare const defaultShortcuts: Shortcuts;
55export interface Event extends KeyboardEvent {
56 target: {
57 tagName: string;
58 addEventListener(): void;
59 removeEventListener(): boolean;
60 dispatchEvent(event: Event): boolean;
61 getAttribute(attr: string): string | null;
62 };
63}
64export declare const init: ModuleFn;
65export {};