@jupyterlab/application
Version:
JupyterLab - Application
93 lines (92 loc) • 2.61 kB
TypeScript
import { SemanticCommand } from '@jupyterlab/apputils';
import { TranslationBundle } from '@jupyterlab/translation';
import { CommandRegistry } from '@lumino/commands';
import { JupyterFrontEnd } from './frontend';
export interface ISemanticCommandDefault {
/**
* Default command id to execute if no command is enabled
*/
execute?: string;
/**
* Default command label
*/
label?: string;
/**
* Default command caption
*/
caption?: string;
/**
* Whether the default command is enabled.
*/
isEnabled?: boolean;
/**
* Whether the default command is toggled.
*/
isToggled?: boolean;
/**
* Whether the default command is visible.
*/
isVisible?: boolean;
}
/**
* Semantic command(s) options
*/
export interface ISemanticCommandOptions {
/**
* Semantic command ID
*/
id: string;
/**
* Application command registry
*/
commands: CommandRegistry;
/**
* Application shell
*/
shell: JupyterFrontEnd.IShell;
/**
* Semantic commands
*/
semanticCommands: SemanticCommand | SemanticCommand[];
/**
* Default commands options
*
* It will be used if the enabled command is not defining one
* or if no command is enabled.
*/
default?: ISemanticCommandDefault;
/**
* Override commands options
*
* It will override the enabled command attribute.
*/
overrides?: Omit<CommandRegistry.ICommandOptions, 'execute'>;
/**
* Domain specific translation object.
*/
trans?: TranslationBundle;
}
/**
* Add a semantic commands to the application and take care
* of setting up the command changed signal.
*
* @param options Semantic command options
*/
export declare function addSemanticCommand(options: ISemanticCommandOptions): void;
/**
* Create the command options from the given semantic commands list
* and the given default values.
*
* @param app Jupyter Application
* @param semanticCommands Single semantic command or a list of commands
* @param defaultValues Default values
* @param trans Translation bundle
* @returns Command options
*
* @deprecated Please use {@link addSemanticCommand}. This function will
* be removed of the public API in JupyterLab 5.
*/
export declare function createSemanticCommand(app: JupyterFrontEnd | {
commands: CommandRegistry;
shell: JupyterFrontEnd.IShell;
}, semanticCommands: SemanticCommand | SemanticCommand[], defaultValues: ISemanticCommandDefault, trans: TranslationBundle): CommandRegistry.ICommandOptions;