1 | import type { ISessionContext, ISessionContextDialogs, IWidgetTracker } from '@jupyterlab/apputils';
|
2 | import type { Cell } from '@jupyterlab/cells';
|
3 | import type { ITranslator } from '@jupyterlab/translation';
|
4 | import { Token } from '@lumino/coreutils';
|
5 | import type { ISignal } from '@lumino/signaling';
|
6 | import type { Widget } from '@lumino/widgets';
|
7 | import type { KernelError } from './actions';
|
8 | import type { INotebookModel } from './model';
|
9 | import type { NotebookTools } from './notebooktools';
|
10 | import type { NotebookPanel } from './panel';
|
11 | import type { StaticNotebook } from './widget';
|
12 | import type { NotebookWidgetFactory } from './widgetfactory';
|
13 | /**
|
14 | * The notebook widget factory token.
|
15 | */
|
16 | export declare const INotebookWidgetFactory: Token<NotebookWidgetFactory.IFactory>;
|
17 | /**
|
18 | * The notebook tools token.
|
19 | */
|
20 | export declare const INotebookTools: Token<INotebookTools>;
|
21 | /**
|
22 | * The interface for notebook metadata tools.
|
23 | */
|
24 | export interface INotebookTools extends Widget {
|
25 | activeNotebookPanel: NotebookPanel | null;
|
26 | activeCell: Cell | null;
|
27 | selectedCells: Cell[];
|
28 | addItem(options: NotebookTools.IAddOptions): void;
|
29 | addSection(options: NotebookTools.IAddSectionOptions): void;
|
30 | }
|
31 | /**
|
32 | * The namespace for NotebookTools class statics.
|
33 | */
|
34 | export declare namespace INotebookTools {
|
35 | /**
|
36 | * The options used to add an item to the notebook tools.
|
37 | */
|
38 | interface IAddOptions {
|
39 | /**
|
40 | * The tool to add to the notebook tools area.
|
41 | */
|
42 | tool: ITool;
|
43 | /**
|
44 | * The section to which the tool should be added.
|
45 | */
|
46 | section: 'advanced' | string;
|
47 | /**
|
48 | * The rank order of the widget among its siblings.
|
49 | */
|
50 | rank?: number;
|
51 | }
|
52 | /**
|
53 | * The options used to add a section to the notebook tools.
|
54 | */
|
55 | interface IAddSectionOptions {
|
56 | /**
|
57 | * The name of the new section.
|
58 | */
|
59 | sectionName: string;
|
60 | /**
|
61 | * The tool to add to the notebook tools area.
|
62 | */
|
63 | tool?: INotebookTools.ITool;
|
64 | /**
|
65 | * The label of the new section.
|
66 | */
|
67 | label?: string;
|
68 | /**
|
69 | * The rank order of the section among its siblings.
|
70 | */
|
71 | rank?: number;
|
72 | }
|
73 | interface ITool extends Widget {
|
74 | /**
|
75 | * The notebook tools object.
|
76 | */
|
77 | notebookTools: INotebookTools;
|
78 | }
|
79 | }
|
80 | /**
|
81 | * The notebook tracker token.
|
82 | */
|
83 | export declare const INotebookTracker: Token<INotebookTracker>;
|
84 | /**
|
85 | * An object that tracks notebook widgets.
|
86 | */
|
87 | export interface INotebookTracker extends IWidgetTracker<NotebookPanel> {
|
88 | /**
|
89 | * The currently focused cell.
|
90 | *
|
91 | * #### Notes
|
92 | * If there is no cell with the focus, then this value is `null`.
|
93 | */
|
94 | readonly activeCell: Cell | null;
|
95 | /**
|
96 | * A signal emitted when the current active cell changes.
|
97 | *
|
98 | * #### Notes
|
99 | * If there is no cell with the focus, then `null` will be emitted.
|
100 | */
|
101 | readonly activeCellChanged: ISignal<this, Cell | null>;
|
102 | /**
|
103 | * A signal emitted when the selection state changes.
|
104 | */
|
105 | readonly selectionChanged: ISignal<this, void>;
|
106 | }
|
107 | /**
|
108 | * Notebook cell executor namespace
|
109 | */
|
110 | export declare namespace INotebookCellExecutor {
|
111 | /**
|
112 | * Execution options for notebook cell executor.
|
113 | */
|
114 | interface IRunCellOptions {
|
115 | /**
|
116 | * Cell to execute
|
117 | */
|
118 | cell: Cell;
|
119 | /**
|
120 | * Notebook to which the cell belongs
|
121 | */
|
122 | notebook: INotebookModel;
|
123 | /**
|
124 | * Notebook widget configuration
|
125 | */
|
126 | notebookConfig: StaticNotebook.INotebookConfig;
|
127 | /**
|
128 | * A callback to notify a cell completed execution.
|
129 | */
|
130 | onCellExecuted: (args: {
|
131 | cell: Cell;
|
132 | success: boolean;
|
133 | error?: KernelError | null;
|
134 | }) => void;
|
135 | /**
|
136 | * A callback to notify that a cell execution is scheduled.
|
137 | */
|
138 | onCellExecutionScheduled: (args: {
|
139 | cell: Cell;
|
140 | }) => void;
|
141 | /**
|
142 | * Document session context
|
143 | */
|
144 | sessionContext?: ISessionContext;
|
145 | /**
|
146 | * Session dialogs
|
147 | */
|
148 | sessionDialogs?: ISessionContextDialogs;
|
149 | /**
|
150 | * Application translator
|
151 | */
|
152 | translator?: ITranslator;
|
153 | }
|
154 | }
|
155 | /**
|
156 | * Notebook cell executor interface
|
157 | */
|
158 | export interface INotebookCellExecutor {
|
159 | /**
|
160 | * Execute a cell.
|
161 | *
|
162 | * @param options Cell execution options
|
163 | */
|
164 | runCell(options: INotebookCellExecutor.IRunCellOptions): Promise<boolean>;
|
165 | }
|
166 | /**
|
167 | * The notebook cell executor token.
|
168 | */
|
169 | export declare const INotebookCellExecutor: Token<INotebookCellExecutor>;
|