UNPKG

5.99 kBTypeScriptView Raw
1import { IRenderMime } from '@jupyterlab/rendermime-interfaces';
2import { Token } from '@lumino/coreutils';
3import { JupyterFrontEnd, JupyterFrontEndPlugin } from './frontend';
4import { ILabShell } from './shell';
5import { LabStatus } from './status';
6/**
7 * JupyterLab is the main application class. It is instantiated once and shared.
8 */
9export declare class JupyterLab extends JupyterFrontEnd<ILabShell> {
10 /**
11 * Construct a new JupyterLab object.
12 */
13 constructor(options?: JupyterLab.IOptions);
14 /**
15 * The name of the JupyterLab application.
16 */
17 readonly name: string;
18 /**
19 * A namespace/prefix plugins may use to denote their provenance.
20 */
21 readonly namespace: string;
22 /**
23 * A list of all errors encountered when registering plugins.
24 */
25 readonly registerPluginErrors: Array<Error>;
26 /**
27 * Promise that resolves when state is first restored, returning layout
28 * description.
29 */
30 readonly restored: Promise<void>;
31 /**
32 * The application busy and dirty status signals and flags.
33 */
34 readonly status: LabStatus;
35 /**
36 * The version of the JupyterLab application.
37 */
38 readonly version: string;
39 /**
40 * The JupyterLab application information dictionary.
41 */
42 get info(): JupyterLab.IInfo;
43 /**
44 * The JupyterLab application paths dictionary.
45 */
46 get paths(): JupyterFrontEnd.IPaths;
47 /**
48 * Promise that resolves when all the plugins are activated, including the deferred.
49 */
50 get allPluginsActivated(): Promise<void>;
51 /**
52 * Register plugins from a plugin module.
53 *
54 * @param mod - The plugin module to register.
55 */
56 registerPluginModule(mod: JupyterLab.IPluginModule): void;
57 /**
58 * Register the plugins from multiple plugin modules.
59 *
60 * @param mods - The plugin modules to register.
61 */
62 registerPluginModules(mods: JupyterLab.IPluginModule[]): void;
63 /**
64 * Override keydown handling to prevent command shortcuts from preventing user input.
65 *
66 * This introduces a slight delay to the command invocation, but no delay to user input.
67 */
68 protected evtKeydown(keyDownEvent: KeyboardEvent): void;
69 private _info;
70 private _paths;
71 private _allPluginsActivated;
72}
73/**
74 * The namespace for `JupyterLab` class statics.
75 */
76export declare namespace JupyterLab {
77 /**
78 * The options used to initialize a JupyterLab object.
79 */
80 export interface IOptions extends Partial<JupyterFrontEnd.IOptions<ILabShell>>, Partial<IInfo> {
81 paths?: Partial<JupyterFrontEnd.IPaths>;
82 }
83 /**
84 * The layout restorer token.
85 */
86 export const IInfo: Token<IInfo>;
87 /**
88 * The information about a JupyterLab application.
89 */
90 export interface IInfo {
91 /**
92 * Whether the application is in dev mode.
93 */
94 readonly devMode: boolean;
95 /**
96 * The collection of deferred extension patterns and matched extensions.
97 */
98 readonly deferred: {
99 patterns: string[];
100 matches: string[];
101 };
102 /**
103 * The collection of disabled extension patterns and matched extensions.
104 */
105 readonly disabled: {
106 patterns: string[];
107 matches: string[];
108 };
109 /**
110 * The mime renderer extensions.
111 */
112 readonly mimeExtensions: IRenderMime.IExtensionModule[];
113 /**
114 * The information about available plugins.
115 */
116 readonly availablePlugins: IPluginInfo[];
117 /**
118 * Whether files are cached on the server.
119 */
120 readonly filesCached: boolean;
121 /**
122 * Every periodic network polling should be paused while this is set
123 * to `false`. Extensions should use this value to decide whether to proceed
124 * with the polling.
125 * The extensions may also set this value to `false` if there is no need to
126 * fetch anything from the server backend basing on some conditions
127 * (e.g. when an error message dialog is displayed).
128 * At the same time, the extensions are responsible for setting this value
129 * back to `true`.
130 */
131 isConnected: boolean;
132 }
133 export interface IToken extends Readonly<Pick<Token<any>, 'name' | 'description'>> {
134 }
135 /**
136 * A readonly subset of lumino plugin bundle (excluding activation function,
137 * service, and state information, and runtime token details).
138 */
139 interface ILuminoPluginData extends Readonly<Pick<JupyterFrontEndPlugin<void>, 'id' | 'description' | 'autoStart'>> {
140 /**
141 * The types of required services for the plugin, or `[]`.
142 */
143 readonly requires: IToken[];
144 /**
145 * The types of optional services for the the plugin, or `[]`.
146 */
147 readonly optional: IToken[];
148 /**
149 * The type of service provided by the plugin, or `null`.
150 */
151 readonly provides: IToken | null;
152 }
153 /**
154 * A subset of plugin bundle enriched with JupyterLab extension metadata.
155 */
156 export interface IPluginInfo extends ILuminoPluginData {
157 /**
158 * The name of the extension which provides the plugin.
159 */
160 extension: string;
161 /**
162 * Whether the plugin is enabled.
163 */
164 enabled: boolean;
165 }
166 /**
167 * The default JupyterLab application info.
168 */
169 export const defaultInfo: IInfo;
170 /**
171 * The default JupyterLab application paths.
172 */
173 export const defaultPaths: JupyterFrontEnd.IPaths;
174 /**
175 * The interface for a module that exports a plugin or plugins as
176 * the default value.
177 */
178 export interface IPluginModule {
179 /**
180 * The default export.
181 */
182 default: JupyterFrontEndPlugin<any, any, any> | JupyterFrontEndPlugin<any, any, any>[];
183 }
184 export {};
185}