UNPKG

9.34 kBTypeScriptView Raw
1import { IChangedArgs } from '@jupyterlab/coreutils';
2import { IRenderMime } from '@jupyterlab/rendermime-interfaces';
3import { ISettingRegistry } from '@jupyterlab/settingregistry';
4import { Token } from '@lumino/coreutils';
5import { IDisposable } from '@lumino/disposable';
6import { ISignal } from '@lumino/signaling';
7import { CommandPalette, Widget } from '@lumino/widgets';
8import { ISessionContext } from './sessioncontext';
9/**
10 * The command palette token.
11 */
12export declare const ICommandPalette: Token<ICommandPalette>;
13/**
14 * The options for creating a command palette item.
15 */
16export interface IPaletteItem extends CommandPalette.IItemOptions {
17}
18/**
19 * The interface for a Jupyter Lab command palette.
20 */
21export interface ICommandPalette {
22 /**
23 * The placeholder text of the command palette's search input.
24 */
25 placeholder: string;
26 /**
27 * Activate the command palette for user input.
28 */
29 activate(): void;
30 /**
31 * Add a command item to the command palette.
32 *
33 * @param options - The options for creating the command item.
34 *
35 * @returns A disposable that will remove the item from the palette.
36 */
37 addItem(options: IPaletteItem): IDisposable;
38}
39/**
40 * The kernel status indicator model.
41 */
42export declare const IKernelStatusModel: Token<IKernelStatusModel>;
43/**
44 * Kernel status indicator model.
45 */
46export interface IKernelStatusModel {
47 /**
48 * Add a session context provider.
49 *
50 * A provider will receive the currently active widget and must return the
51 * associated session context if it can or null otherwise.
52 */
53 addSessionProvider: (provider: (widget: Widget | null) => ISessionContext | null) => void;
54}
55/**
56 * An interface for the session context dialogs.
57 */
58export interface ISessionContextDialogs extends ISessionContext.IDialogs {
59}
60/**
61 * The session context dialogs token.
62 */
63export declare const ISessionContextDialogs: Token<ISessionContext.IDialogs>;
64/**
65 * The theme manager token.
66 */
67export declare const IThemeManager: Token<IThemeManager>;
68/**
69 * An interface for a theme manager.
70 */
71export interface IThemeManager {
72 /**
73 * Get the name of the current theme.
74 */
75 readonly theme: string | null;
76 /**
77 * Get the name of the preferred light theme.
78 */
79 readonly preferredLightTheme?: string | undefined;
80 /**
81 * Get the name of the preferred dark theme.
82 */
83 readonly preferredDarkTheme?: string | undefined;
84 /**
85 * Get the name of the preferred theme.
86 */
87 readonly preferredTheme?: string | null | undefined;
88 /**
89 * The names of the registered themes.
90 */
91 readonly themes: ReadonlyArray<string>;
92 /**
93 * Get the names of the registered light themes.
94 */
95 readonly lightThemes?: ReadonlyArray<string> | undefined;
96 /**
97 * Get the names of the registered dark themes.
98 */
99 readonly darkThemes?: ReadonlyArray<string> | undefined;
100 /**
101 * A signal fired when the application theme changes.
102 */
103 readonly themeChanged: ISignal<this, IChangedArgs<string, string | null>>;
104 /**
105 * Load a theme CSS file by path.
106 *
107 * @param path - The path of the file to load.
108 */
109 loadCSS(path: string): Promise<void>;
110 /**
111 * Register a theme with the theme manager.
112 *
113 * @param theme - The theme to register.
114 *
115 * @returns A disposable that can be used to unregister the theme.
116 */
117 register(theme: IThemeManager.ITheme): IDisposable;
118 /**
119 * Set the current theme.
120 */
121 setTheme(name: string): Promise<void>;
122 /**
123 * Test whether a given theme is light.
124 */
125 isLight(name: string): boolean;
126 /**
127 * Test whether a given theme styles scrollbars,
128 * and if the user has scrollbar styling enabled.
129 */
130 themeScrollbars(name: string): boolean;
131 /**
132 * Get display name for theme.
133 */
134 getDisplayName(name: string): string;
135}
136/**
137 * A namespace for the `IThemeManager` sub-types.
138 */
139export declare namespace IThemeManager {
140 /**
141 * An interface for a theme.
142 */
143 interface ITheme {
144 /**
145 * The unique identifier name of the theme.
146 */
147 name: string;
148 /**
149 * The display name of the theme.
150 */
151 displayName?: string;
152 /**
153 * Whether the theme is light or dark. Downstream authors
154 * of extensions can use this information to customize their
155 * UI depending upon the current theme.
156 */
157 isLight: boolean;
158 /**
159 * Whether the theme includes styling for the scrollbar.
160 * If set to false, this theme will leave the native scrollbar untouched.
161 */
162 themeScrollbars?: boolean;
163 /**
164 * Load the theme.
165 *
166 * @returns A promise that resolves when the theme has loaded.
167 */
168 load(): Promise<void>;
169 /**
170 * Unload the theme.
171 *
172 * @returns A promise that resolves when the theme has unloaded.
173 */
174 unload(): Promise<void>;
175 }
176}
177/**
178 * The sanitizer token.
179 */
180export declare const ISanitizer: Token<IRenderMime.ISanitizer>;
181/**
182 * @deprecated since v4 use {@link IRenderMime.ISanitizer}
183 */
184export type ISanitizer = IRenderMime.ISanitizer;
185/**
186 * The namespace for `ISanitizer` related interfaces.
187 */
188export declare namespace ISanitizer {
189 /**
190 * The options used to sanitize.
191 *
192 * @deprecated in v4 use {@link IRenderMime.ISanitizerOptions}
193 */
194 type IOptions = IRenderMime.ISanitizerOptions;
195}
196/**
197 * The main menu token.
198 */
199export declare const ISplashScreen: Token<ISplashScreen>;
200/**
201 * The interface for an application splash screen.
202 */
203export interface ISplashScreen {
204 /**
205 * Show the application splash screen.
206 *
207 * @param light - Whether to show the light splash screen or the dark one.
208 *
209 * @returns A disposable used to clear the splash screen.
210 */
211 show(light?: boolean): IDisposable;
212}
213/**
214 * The default window resolver token.
215 */
216export declare const IWindowResolver: Token<IWindowResolver>;
217/**
218 * The description of a window name resolver.
219 */
220export interface IWindowResolver {
221 /**
222 * A window name to use as a handle among shared resources.
223 */
224 readonly name: string;
225}
226/**
227 * The namespace for `IToolbarWidgetRegistry` related interfaces
228 */
229export declare namespace ToolbarRegistry {
230 /**
231 * Interface of item to be inserted in a toolbar
232 */
233 interface IToolbarItem extends IRenderMime.IToolbarItem {
234 }
235 /**
236 * Interface describing a toolbar item widget
237 */
238 interface IWidget extends ISettingRegistry.IToolbarItem {
239 }
240 /**
241 * Options to set up the toolbar widget registry
242 */
243 interface IOptions {
244 /**
245 * Default toolbar widget factory
246 *
247 * The factory is receiving 3 arguments:
248 * @param widgetFactory The widget factory name that creates the toolbar
249 * @param widget The newly widget containing the toolbar
250 * @param toolbarItem The toolbar item definition
251 * @returns The widget to be inserted in the toolbar.
252 */
253 defaultFactory: (widgetFactory: string, widget: Widget, toolbarItem: IWidget) => Widget;
254 }
255}
256/**
257 * Toolbar widget registry interface
258 */
259export interface IToolbarWidgetRegistry {
260 /**
261 * Add a new toolbar item factory
262 *
263 * @param widgetFactory The widget factory name that creates the toolbar
264 * @param toolbarItemName The unique toolbar item
265 * @param factory The factory function that receives the widget containing the toolbar and returns the toolbar widget.
266 * @returns The previously defined factory
267 */
268 addFactory<T extends Widget = Widget>(widgetFactory: string, toolbarItemName: string, factory: (main: T) => Widget): ((main: T) => Widget) | undefined;
269 /**
270 * Default toolbar item factory
271 */
272 defaultFactory: (widgetFactory: string, widget: Widget, toolbarItem: ToolbarRegistry.IWidget) => Widget;
273 /**
274 * Create a toolbar item widget
275 *
276 * @param widgetFactory The widget factory name that creates the toolbar
277 * @param widget The newly widget containing the toolbar
278 * @param toolbarItem The toolbar item definition
279 * @returns The widget to be inserted in the toolbar.
280 */
281 createWidget(widgetFactory: string, widget: Widget, toolbarItem: ToolbarRegistry.IWidget): Widget;
282 /**
283 * Register a new toolbar item factory
284 *
285 * @param widgetFactory The widget factory name that creates the toolbar
286 * @param toolbarItemName The unique toolbar item
287 * @param factory The factory function that receives the widget containing the toolbar and returns the toolbar widget.
288 * @returns The previously defined factory
289 *
290 * @deprecated since v4 use `addFactory` instead
291 */
292 registerFactory<T extends Widget = Widget>(widgetFactory: string, toolbarItemName: string, factory: (main: T) => Widget): ((main: T) => Widget) | undefined;
293 /**
294 * A signal emitted when a factory widget has been added.
295 */
296 readonly factoryAdded: ISignal<this, string>;
297}
298/**
299 * The toolbar registry token.
300 */
301export declare const IToolbarWidgetRegistry: Token<IToolbarWidgetRegistry>;
302
\No newline at end of file