UNPKG

5.72 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 private _info;
64 private _paths;
65 private _allPluginsActivated;
66}
67/**
68 * The namespace for `JupyterLab` class statics.
69 */
70export declare namespace JupyterLab {
71 /**
72 * The options used to initialize a JupyterLab object.
73 */
74 export interface IOptions extends Partial<JupyterFrontEnd.IOptions<ILabShell>>, Partial<IInfo> {
75 paths?: Partial<JupyterFrontEnd.IPaths>;
76 }
77 /**
78 * The layout restorer token.
79 */
80 export const IInfo: Token<IInfo>;
81 /**
82 * The information about a JupyterLab application.
83 */
84 export interface IInfo {
85 /**
86 * Whether the application is in dev mode.
87 */
88 readonly devMode: boolean;
89 /**
90 * The collection of deferred extension patterns and matched extensions.
91 */
92 readonly deferred: {
93 patterns: string[];
94 matches: string[];
95 };
96 /**
97 * The collection of disabled extension patterns and matched extensions.
98 */
99 readonly disabled: {
100 patterns: string[];
101 matches: string[];
102 };
103 /**
104 * The mime renderer extensions.
105 */
106 readonly mimeExtensions: IRenderMime.IExtensionModule[];
107 /**
108 * The information about available plugins.
109 */
110 readonly availablePlugins: IPluginInfo[];
111 /**
112 * Whether files are cached on the server.
113 */
114 readonly filesCached: boolean;
115 /**
116 * Every periodic network polling should be paused while this is set
117 * to `false`. Extensions should use this value to decide whether to proceed
118 * with the polling.
119 * The extensions may also set this value to `false` if there is no need to
120 * fetch anything from the server backend basing on some conditions
121 * (e.g. when an error message dialog is displayed).
122 * At the same time, the extensions are responsible for setting this value
123 * back to `true`.
124 */
125 isConnected: boolean;
126 }
127 interface IToken extends Readonly<Pick<Token<any>, 'name' | 'description'>> {
128 }
129 /**
130 * A readonly subset of lumino plugin bundle (excluding activation function,
131 * service, and state information, and runtime token details).
132 */
133 interface ILuminoPluginData extends Readonly<Pick<JupyterFrontEndPlugin<void>, 'id' | 'description' | 'autoStart'>> {
134 /**
135 * The types of required services for the plugin, or `[]`.
136 */
137 readonly requires: IToken[];
138 /**
139 * The types of optional services for the the plugin, or `[]`.
140 */
141 readonly optional: IToken[];
142 /**
143 * The type of service provided by the plugin, or `null`.
144 */
145 readonly provides: IToken | null;
146 }
147 /**
148 * A subset of plugin bundle enriched with JupyterLab extension metadata.
149 */
150 export interface IPluginInfo extends ILuminoPluginData {
151 /**
152 * The name of the extension which provides the plugin.
153 */
154 extension: string;
155 /**
156 * Whether the plugin is enabled.
157 */
158 enabled: boolean;
159 }
160 /**
161 * The default JupyterLab application info.
162 */
163 export const defaultInfo: IInfo;
164 /**
165 * The default JupyterLab application paths.
166 */
167 export const defaultPaths: JupyterFrontEnd.IPaths;
168 /**
169 * The interface for a module that exports a plugin or plugins as
170 * the default value.
171 */
172 export interface IPluginModule {
173 /**
174 * The default export.
175 */
176 default: JupyterFrontEndPlugin<any, any, any> | JupyterFrontEndPlugin<any, any, any>[];
177 }
178 export {};
179}