Debian Codegraph @

review/api/commands.api.md

raw
1 ## API Report File for "@lumino/commands"
2
3 > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
5 ```ts
6
7 import { IDisposable } from '@lumino/disposable';
8 import { ISignal } from '@lumino/signaling';
9 import { ReadonlyJSONObject } from '@lumino/coreutils';
10 import { ReadonlyPartialJSONObject } from '@lumino/coreutils';
11 import { VirtualElement } from '@lumino/virtualdom';
12
13 // @public
14 export class CommandRegistry {
15 addCommand(id: string, options: CommandRegistry.ICommandOptions): IDisposable;
16 addKeyBinding(options: CommandRegistry.IKeyBindingOptions): IDisposable;
17 caption(id: string, args?: ReadonlyPartialJSONObject): string;
18 className(id: string, args?: ReadonlyPartialJSONObject): string;
19 get commandChanged(): ISignal<this, CommandRegistry.ICommandChangedArgs>;
20 get commandExecuted(): ISignal<this, CommandRegistry.ICommandExecutedArgs>;
21 dataset(id: string, args?: ReadonlyPartialJSONObject): CommandRegistry.Dataset;
22 describedBy(id: string, args?: ReadonlyPartialJSONObject): Promise<CommandRegistry.Description>;
23 execute(id: string, args?: ReadonlyPartialJSONObject): Promise<any>;
24 hasCommand(id: string): boolean;
25 holdKeyBindingExecution(event: KeyboardEvent, permission: Promise<boolean>): void;
26 icon(id: string, args?: ReadonlyPartialJSONObject): VirtualElement.IRenderer | undefined;
27 iconClass(id: string, args?: ReadonlyPartialJSONObject): string;
28 iconLabel(id: string, args?: ReadonlyPartialJSONObject): string;
29 isEnabled(id: string, args?: ReadonlyPartialJSONObject): boolean;
30 isToggleable(id: string, args?: ReadonlyJSONObject): boolean;
31 isToggled(id: string, args?: ReadonlyPartialJSONObject): boolean;
32 isVisible(id: string, args?: ReadonlyPartialJSONObject): boolean;
33 get keyBindingChanged(): ISignal<this, CommandRegistry.IKeyBindingChangedArgs>;
34 get keyBindings(): ReadonlyArray<CommandRegistry.IKeyBinding>;
35 label(id: string, args?: ReadonlyPartialJSONObject): string;
36 listCommands(): string[];
37 mnemonic(id: string, args?: ReadonlyPartialJSONObject): number;
38 notifyCommandChanged(id?: string): void;
39 processKeydownEvent(event: KeyboardEvent): void;
40 processKeyupEvent(event: KeyboardEvent): void;
41 usage(id: string, args?: ReadonlyPartialJSONObject): string;
42 }
43
44 // @public
45 export namespace CommandRegistry {
46 export type CommandFunc<T> = (args: ReadonlyPartialJSONObject) => T;
47 export type Dataset = {
48 readonly [key: string]: string;
49 };
50 export type Description = {
51 args: ReadonlyJSONObject | null;
52 };
53 export function formatKeystroke(keystroke: string | readonly string[]): string;
54 export interface ICommandChangedArgs {
55 readonly id: string | undefined;
56 readonly type: 'added' | 'removed' | 'changed' | 'many-changed';
57 }
58 export interface ICommandExecutedArgs {
59 readonly args: ReadonlyPartialJSONObject;
60 readonly id: string;
61 readonly result: Promise<any>;
62 }
63 export interface ICommandOptions {
64 caption?: string | CommandFunc<string>;
65 className?: string | CommandFunc<string>;
66 dataset?: Dataset | CommandFunc<Dataset>;
67 describedBy?: Partial<Description> | CommandFunc<Partial<Description> | Promise<Partial<Description>>>;
68 execute: CommandFunc<any | Promise<any>>;
69 icon?: VirtualElement.IRenderer | undefined | CommandFunc<VirtualElement.IRenderer | undefined>;
70 iconClass?: string | CommandFunc<string>;
71 iconLabel?: string | CommandFunc<string>;
72 isEnabled?: CommandFunc<boolean>;
73 isToggleable?: boolean;
74 isToggled?: CommandFunc<boolean>;
75 isVisible?: CommandFunc<boolean>;
76 label?: string | CommandFunc<string>;
77 mnemonic?: number | CommandFunc<number>;
78 usage?: string | CommandFunc<string>;
79 }
80 export interface IKeyBinding {
81 readonly args: ReadonlyPartialJSONObject;
82 readonly command: string;
83 readonly keys: ReadonlyArray<string>;
84 readonly preventDefault?: boolean;
85 readonly selector: string;
86 }
87 export interface IKeyBindingChangedArgs {
88 readonly binding: IKeyBinding;
89 readonly type: 'added' | 'removed';
90 }
91 export interface IKeyBindingOptions {
92 args?: ReadonlyPartialJSONObject;
93 command: string;
94 keys: string[];
95 linuxKeys?: string[];
96 macKeys?: string[];
97 preventDefault?: boolean;
98 selector: string;
99 winKeys?: string[];
100 }
101 export interface IKeystrokeParts {
102 alt: boolean;
103 cmd: boolean;
104 ctrl: boolean;
105 key: string;
106 shift: boolean;
107 }
108 export function isModifierKeyPressed(event: KeyboardEvent): boolean;
109 export function keystrokeForKeydownEvent(event: KeyboardEvent): string;
110 export function normalizeKeys(options: IKeyBindingOptions): string[];
111 export function normalizeKeystroke(keystroke: string): string;
112 export function parseKeystroke(keystroke: string): IKeystrokeParts;
113 }
114
115 // (No @packageDocumentation comment for this package)
116
117 ```