UNPKG

2.49 kBTypeScriptView Raw
1import { Token } from '@lumino/coreutils';
2import { IDisposable } from '@lumino/disposable';
3import { Message } from '@lumino/messaging';
4import { CommandPalette, Panel } from '@lumino/widgets';
5/**
6 * The command palette token.
7 */
8export declare const ICommandPalette: Token<ICommandPalette>;
9/**
10 * The options for creating a command palette item.
11 */
12export interface IPaletteItem extends CommandPalette.IItemOptions {
13}
14/**
15 * The interface for a Jupyter Lab command palette.
16 */
17export interface ICommandPalette {
18 /**
19 * The placeholder text of the command palette's search input.
20 */
21 placeholder: string;
22 /**
23 * Activate the command palette for user input.
24 */
25 activate(): void;
26 /**
27 * Add a command item to the command palette.
28 *
29 * @param options - The options for creating the command item.
30 *
31 * @returns A disposable that will remove the item from the palette.
32 */
33 addItem(options: IPaletteItem): IDisposable;
34}
35/**
36 * Wrap the command palette in a modal to make it more usable.
37 */
38export declare class ModalCommandPalette extends Panel {
39 constructor(options: ModalCommandPalette.IOptions);
40 get palette(): CommandPalette;
41 set palette(value: CommandPalette);
42 attach(): void;
43 detach(): void;
44 /**
45 * Hide the modal command palette and reset its search.
46 */
47 hideAndReset(): void;
48 /**
49 * Handle incoming events.
50 */
51 handleEvent(event: Event): void;
52 /**
53 * Find the element with search icon group.
54 */
55 protected get searchIconGroup(): HTMLDivElement | undefined;
56 /**
57 * Create element with search icon group.
58 */
59 protected createSearchIconGroup(): HTMLDivElement;
60 /**
61 * A message handler invoked on an `'after-attach'` message.
62 */
63 protected onAfterAttach(msg: Message): void;
64 /**
65 * A message handler invoked on an `'after-detach'` message.
66 */
67 protected onAfterDetach(msg: Message): void;
68 protected onBeforeHide(msg: Message): void;
69 protected onAfterShow(msg: Message): void;
70 /**
71 * A message handler invoked on an `'activate-request'` message.
72 */
73 protected onActivateRequest(msg: Message): void;
74 /**
75 * Handle the `'keydown'` event for the widget.
76 */
77 protected _evtKeydown(event: KeyboardEvent): void;
78 private _commandPalette;
79}
80export declare namespace ModalCommandPalette {
81 interface IOptions {
82 commandPalette: CommandPalette;
83 }
84}