UNPKG

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