UNPKG

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