UNPKG

3.48 kBTypeScriptView Raw
1import { ISessionContext, Printing } from '@jupyterlab/apputils';
2import { DocumentRegistry, DocumentWidget } from '@jupyterlab/docregistry';
3import { ITranslator } from '@jupyterlab/translation';
4import { Token } from '@lumino/coreutils';
5import { INotebookModel } from './model';
6import { Notebook, StaticNotebook } from './widget';
7/**
8 * A widget that hosts a notebook toolbar and content area.
9 *
10 * #### Notes
11 * The widget keeps the document metadata in sync with the current
12 * kernel on the context.
13 */
14export declare class NotebookPanel extends DocumentWidget<Notebook, INotebookModel> {
15 /**
16 * Construct a new notebook panel.
17 */
18 constructor(options: DocumentWidget.IOptions<Notebook, INotebookModel>);
19 _onSave(sender: DocumentRegistry.Context, state: DocumentRegistry.SaveState): void;
20 /**
21 * The session context used by the panel.
22 */
23 get sessionContext(): ISessionContext;
24 /**
25 * The model for the widget.
26 */
27 get model(): INotebookModel | null;
28 /**
29 * Update the options for the current notebook panel.
30 *
31 * @param config new options to set
32 */
33 setConfig(config: NotebookPanel.IConfig): void;
34 /**
35 * Set URI fragment identifier.
36 */
37 setFragment(fragment: string): void;
38 /**
39 * Dispose of the resources used by the widget.
40 */
41 dispose(): void;
42 /**
43 * Prints the notebook by converting to HTML with nbconvert.
44 */
45 [Printing.symbol](): () => Promise<void>;
46 /**
47 * Handle a fully rendered signal notebook.
48 */
49 private _onFullyRendered;
50 /**
51 * Handle a change in the kernel by updating the document metadata.
52 */
53 private _onKernelChanged;
54 private _onSessionStatusChanged;
55 /**
56 * Update the kernel language.
57 */
58 private _updateLanguage;
59 /**
60 * Update the kernel spec.
61 */
62 private _updateSpec;
63 translator: ITranslator;
64 private _trans;
65 /**
66 * Whether we are currently in a series of autorestarts we have already
67 * notified the user about.
68 */
69 private _autorestarting;
70}
71/**
72 * A namespace for `NotebookPanel` statics.
73 */
74export declare namespace NotebookPanel {
75 /**
76 * Notebook config interface for NotebookPanel
77 */
78 interface IConfig {
79 /**
80 * A config object for cell editors
81 */
82 editorConfig: StaticNotebook.IEditorConfig;
83 /**
84 * A config object for notebook widget
85 */
86 notebookConfig: StaticNotebook.INotebookConfig;
87 /**
88 * Whether to shut down the kernel when closing the panel or not
89 */
90 kernelShutdown: boolean;
91 }
92 /**
93 * A content factory interface for NotebookPanel.
94 */
95 interface IContentFactory extends Notebook.IContentFactory {
96 /**
97 * Create a new content area for the panel.
98 */
99 createNotebook(options: Notebook.IOptions): Notebook;
100 }
101 /**
102 * The default implementation of an `IContentFactory`.
103 */
104 class ContentFactory extends Notebook.ContentFactory implements IContentFactory {
105 /**
106 * Create a new content area for the panel.
107 */
108 createNotebook(options: Notebook.IOptions): Notebook;
109 }
110 /**
111 * Default content factory for the notebook panel.
112 */
113 const defaultContentFactory: ContentFactory;
114 /**
115 * The notebook renderer token.
116 */
117 const IContentFactory: Token<IContentFactory>;
118}