UNPKG

3.63 kBTypeScriptView Raw
1import { ISessionContextDialogs } from '@jupyterlab/apputils';
2import { IEditorMimeTypeService } from '@jupyterlab/codeeditor';
3import { ABCWidgetFactory, DocumentRegistry } from '@jupyterlab/docregistry';
4import { IRenderMimeRegistry } from '@jupyterlab/rendermime';
5import { ITranslator } from '@jupyterlab/translation';
6import { INotebookModel } from './model';
7import { NotebookPanel } from './panel';
8import { StaticNotebook } from './widget';
9/**
10 * A widget factory for notebook panels.
11 */
12export declare class NotebookWidgetFactory extends ABCWidgetFactory<NotebookPanel, INotebookModel> {
13 /**
14 * Construct a new notebook widget factory.
15 *
16 * @param options - The options used to construct the factory.
17 */
18 constructor(options: NotebookWidgetFactory.IOptions<NotebookPanel>);
19 readonly rendermime: IRenderMimeRegistry;
20 /**
21 * The content factory used by the widget factory.
22 */
23 readonly contentFactory: NotebookPanel.IContentFactory;
24 /**
25 * The service used to look up mime types.
26 */
27 readonly mimeTypeService: IEditorMimeTypeService;
28 /**
29 * A configuration object for cell editor settings.
30 */
31 get editorConfig(): StaticNotebook.IEditorConfig;
32 set editorConfig(value: StaticNotebook.IEditorConfig);
33 /**
34 * A configuration object for notebook settings.
35 */
36 get notebookConfig(): StaticNotebook.INotebookConfig;
37 set notebookConfig(value: StaticNotebook.INotebookConfig);
38 /**
39 * Create a new widget.
40 *
41 * #### Notes
42 * The factory will start the appropriate kernel.
43 */
44 protected createNewWidget(context: DocumentRegistry.IContext<INotebookModel>, source?: NotebookPanel): NotebookPanel;
45 /**
46 * Default factory for toolbar items to be added after the widget is created.
47 */
48 protected defaultToolbarFactory(widget: NotebookPanel): DocumentRegistry.IToolbarItem[];
49 private _editorConfig;
50 private _notebookConfig;
51 private _sessionDialogs;
52}
53/**
54 * The namespace for `NotebookWidgetFactory` statics.
55 */
56export declare namespace NotebookWidgetFactory {
57 /**
58 * The options used to construct a `NotebookWidgetFactory`.
59 */
60 interface IOptions<T extends NotebookPanel> extends DocumentRegistry.IWidgetFactoryOptions<T> {
61 rendermime: IRenderMimeRegistry;
62 /**
63 * A notebook panel content factory.
64 */
65 contentFactory: NotebookPanel.IContentFactory;
66 /**
67 * The service used to look up mime types.
68 */
69 mimeTypeService: IEditorMimeTypeService;
70 /**
71 * The notebook cell editor configuration.
72 */
73 editorConfig?: StaticNotebook.IEditorConfig;
74 /**
75 * The notebook configuration.
76 */
77 notebookConfig?: StaticNotebook.INotebookConfig;
78 /**
79 * The session context dialogs.
80 */
81 sessionDialogs?: ISessionContextDialogs;
82 /**
83 * The application language translator.
84 */
85 translator?: ITranslator;
86 }
87 /**
88 * The interface for a notebook widget factory.
89 */
90 interface IFactory extends DocumentRegistry.IWidgetFactory<NotebookPanel, INotebookModel> {
91 /**
92 * A configuration object for cell editor settings.
93 */
94 editorConfig: StaticNotebook.IEditorConfig;
95 /**
96 * A configuration object for notebook settings.
97 */
98 notebookConfig: StaticNotebook.INotebookConfig;
99 /**
100 * Whether the kernel should be shutdown when the widget is closed.
101 */
102 shutdownOnClose: boolean;
103 }
104}