@jupyterlab/application 4.0.0-alpha.2 → 4.0.0-alpha.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/shell.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { DocumentRegistry } from '@jupyterlab/docregistry';
2
2
  import { ITranslator } from '@jupyterlab/translation';
3
- import { IIterator } from '@lumino/algorithm';
4
3
  import { Token } from '@lumino/coreutils';
5
4
  import { Message } from '@lumino/messaging';
6
5
  import { ISignal } from '@lumino/signaling';
7
- import { DockLayout, DockPanel, FocusTracker, Widget } from '@lumino/widgets';
6
+ import { DockLayout, DockPanel, FocusTracker, TabBar, Widget } from '@lumino/widgets';
8
7
  import { JupyterFrontEnd } from './frontend';
8
+ import { LayoutRestorer } from './layoutrestorer';
9
9
  /**
10
10
  * The JupyterLab application shell token.
11
11
  */
@@ -32,14 +32,58 @@ export declare namespace ILabShell {
32
32
  */
33
33
  type IOptions = {
34
34
  /**
35
- * The application language translator.
35
+ * Whether the layout should wait to be restored before adding widgets or not.
36
+ *
37
+ * #### Notes
38
+ * It defaults to true
36
39
  */
37
- translator?: ITranslator;
40
+ waitForRestore?: boolean;
38
41
  };
39
42
  /**
40
43
  * An arguments object for the changed signals.
41
44
  */
42
45
  type IChangedArgs = FocusTracker.IChangedArgs<Widget>;
46
+ interface IConfig {
47
+ /**
48
+ * The method for hiding widgets in the dock panel.
49
+ *
50
+ * The default is `display`.
51
+ *
52
+ * Using `scale` will often increase performance as most browsers will not trigger style computation
53
+ * for the transform action.
54
+ *
55
+ * `contentVisibility` is only available in Chromium-based browsers.
56
+ */
57
+ hiddenMode: 'display' | 'scale' | 'contentVisibility';
58
+ }
59
+ /**
60
+ * Widget position
61
+ */
62
+ interface IWidgetPosition {
63
+ /**
64
+ * Widget area
65
+ */
66
+ area?: Area;
67
+ /**
68
+ * Widget opening options
69
+ */
70
+ options?: DocumentRegistry.IOpenOptions;
71
+ }
72
+ /**
73
+ * To-be-added widget and associated position
74
+ */
75
+ interface IDelayedWidget extends IWidgetPosition {
76
+ widget: Widget;
77
+ }
78
+ /**
79
+ * Mapping of widget type identifier and their user customized position
80
+ */
81
+ interface IUserLayout {
82
+ /**
83
+ * Widget customized position
84
+ */
85
+ [k: string]: IWidgetPosition;
86
+ }
43
87
  /**
44
88
  * The args for the current path change signal.
45
89
  */
@@ -169,13 +213,18 @@ export declare class LabShell extends Widget implements JupyterFrontEnd.IShell {
169
213
  */
170
214
  get activeWidget(): Widget | null;
171
215
  /**
172
- * A signal emitted when main area's current focus changes.
216
+ * Whether the add buttons for each main area tab bar are enabled.
173
217
  */
174
- get currentChanged(): ISignal<this, ILabShell.IChangedArgs>;
218
+ get addButtonEnabled(): boolean;
219
+ set addButtonEnabled(value: boolean);
175
220
  /**
176
- * A signal emitted when the shell/dock panel change modes (single/multiple document).
221
+ * A signal emitted when the add button on a main area tab bar is clicked.
177
222
  */
178
- get modeChanged(): ISignal<this, DockPanel.Mode>;
223
+ get addRequested(): ISignal<DockPanel, TabBar<Widget>>;
224
+ /**
225
+ * A signal emitted when main area's current focus changes.
226
+ */
227
+ get currentChanged(): ISignal<this, ILabShell.IChangedArgs>;
179
228
  /**
180
229
  * A signal emitted when the path of the current document changes.
181
230
  *
@@ -203,30 +252,76 @@ export declare class LabShell extends Widget implements JupyterFrontEnd.IShell {
203
252
  * `jp-mod-presentationMode` CSS class.
204
253
  */
205
254
  get presentationMode(): boolean;
206
- /**
207
- * Enable/disable presentation mode (`jp-mod-presentationMode` CSS class) with
208
- * a boolean.
209
- */
210
255
  set presentationMode(value: boolean);
211
256
  /**
212
257
  * The main dock area's user interface mode.
213
258
  */
214
259
  get mode(): DockPanel.Mode;
215
260
  set mode(mode: DockPanel.Mode);
261
+ /**
262
+ * A signal emitted when the shell/dock panel change modes (single/multiple document).
263
+ */
264
+ get modeChanged(): ISignal<this, DockPanel.Mode>;
216
265
  /**
217
266
  * Promise that resolves when state is first restored, returning layout
218
267
  * description.
219
268
  */
220
269
  get restored(): Promise<ILabShell.ILayout>;
270
+ get translator(): ITranslator;
271
+ set translator(value: ITranslator);
272
+ /**
273
+ * User customized shell layout.
274
+ */
275
+ get userLayout(): {
276
+ 'single-document': ILabShell.IUserLayout;
277
+ 'multiple-document': ILabShell.IUserLayout;
278
+ };
221
279
  /**
222
280
  * Activate a widget in its area.
223
281
  */
224
282
  activateById(id: string): void;
283
+ /**
284
+ * Activate the next Tab in the active TabBar.
285
+ */
225
286
  activateNextTab(): void;
287
+ /**
288
+ * Activate the previous Tab in the active TabBar.
289
+ */
226
290
  activatePreviousTab(): void;
291
+ /**
292
+ * Activate the next TabBar.
293
+ */
227
294
  activateNextTabBar(): void;
295
+ /**
296
+ * Activate the next TabBar.
297
+ */
228
298
  activatePreviousTabBar(): void;
299
+ /**
300
+ * Add a widget to the JupyterLab shell
301
+ *
302
+ * @param widget Widget
303
+ * @param area Area
304
+ * @param options Options
305
+ */
229
306
  add(widget: Widget, area?: ILabShell.Area, options?: DocumentRegistry.IOpenOptions): void;
307
+ /**
308
+ * Move a widget type to a new area.
309
+ *
310
+ * The type is determined from the `widget.id` and fallback to `widget.id`.
311
+ *
312
+ * #### Notes
313
+ * If `mode` is undefined, both mode are updated.
314
+ * The new layout is now persisted.
315
+ *
316
+ * @param widget Widget to move
317
+ * @param area New area
318
+ * @param mode Mode to change
319
+ * @returns The new user layout
320
+ */
321
+ move(widget: Widget, area: ILabShell.Area, mode?: DockPanel.Mode): {
322
+ 'single-document': ILabShell.IUserLayout;
323
+ 'multiple-document': ILabShell.IUserLayout;
324
+ };
230
325
  /**
231
326
  * Collapse the left area.
232
327
  */
@@ -277,9 +372,14 @@ export declare class LabShell extends Widget implements JupyterFrontEnd.IShell {
277
372
  */
278
373
  isEmpty(area: ILabShell.Area): boolean;
279
374
  /**
280
- * Restore the layout state for the application shell.
375
+ * Restore the layout state and configuration for the application shell.
376
+ *
377
+ * #### Notes
378
+ * This should only be called once.
281
379
  */
282
- restoreLayout(mode: DockPanel.Mode, layout: ILabShell.ILayout): void;
380
+ restoreLayout(mode: DockPanel.Mode, layoutRestorer: LayoutRestorer, configuration?: {
381
+ [m: string]: ILabShell.IUserLayout;
382
+ }): Promise<void>;
283
383
  /**
284
384
  * Save the dehydrated state of the application shell.
285
385
  */
@@ -296,10 +396,16 @@ export declare class LabShell extends Widget implements JupyterFrontEnd.IShell {
296
396
  * @param side Sidebar of interest
297
397
  */
298
398
  toggleSideTabBarVisibility(side: 'right' | 'left'): void;
399
+ /**
400
+ * Update the shell configuration.
401
+ *
402
+ * @param config Shell configuration
403
+ */
404
+ updateConfig(config: Partial<ILabShell.IConfig>): void;
299
405
  /**
300
406
  * Returns the widgets for an application area.
301
407
  */
302
- widgets(area?: ILabShell.Area): IIterator<Widget>;
408
+ widgets(area?: ILabShell.Area): IterableIterator<Widget>;
303
409
  /**
304
410
  * Handle `after-attach` messages for the application shell.
305
411
  */
@@ -413,6 +519,11 @@ export declare class LabShell extends Widget implements JupyterFrontEnd.IShell {
413
519
  private _skipLinkWidget;
414
520
  private _titleHandler;
415
521
  private _bottomPanel;
522
+ private _idTypeMap;
416
523
  private _mainOptionsCache;
417
524
  private _sideOptionsCache;
525
+ private _userLayout;
526
+ private _delayedWidget;
527
+ private _translator;
528
+ private _layoutRestorer;
418
529
  }