1 | import { Cell } from '@jupyterlab/cells';
|
2 | import { CodeEditor, JSONEditor } from '@jupyterlab/codeeditor';
|
3 | import { ObservableJSON } from '@jupyterlab/observables';
|
4 | import { ITranslator } from '@jupyterlab/translation';
|
5 | import { ReadonlyPartialJSONValue } from '@lumino/coreutils';
|
6 | import { ConflatableMessage, Message } from '@lumino/messaging';
|
7 | import { Widget } from '@lumino/widgets';
|
8 | import { NotebookPanel } from './panel';
|
9 | import { INotebookTools, INotebookTracker } from './tokens';
|
10 | declare class RankedPanel<T extends Widget = Widget> extends Widget {
|
11 | constructor();
|
12 | addWidget(widget: Widget, rank: number): void;
|
13 | /**
|
14 | * Handle the removal of a child
|
15 | *
|
16 | */
|
17 | protected onChildRemoved(msg: Widget.ChildMessage): void;
|
18 | private _items;
|
19 | }
|
20 | /**
|
21 | * A widget that provides metadata tools.
|
22 | */
|
23 | export declare class NotebookTools extends Widget implements INotebookTools {
|
24 | |
25 |
|
26 |
|
27 | constructor(options: NotebookTools.IOptions);
|
28 | /**
|
29 | * The active cell widget.
|
30 | */
|
31 | get activeCell(): Cell | null;
|
32 | /**
|
33 | * The currently selected cells.
|
34 | */
|
35 | get selectedCells(): Cell[];
|
36 | /**
|
37 | * The current notebook.
|
38 | */
|
39 | get activeNotebookPanel(): NotebookPanel | null;
|
40 | /**
|
41 | * Add a cell tool item.
|
42 | */
|
43 | addItem(options: NotebookTools.IAddOptions): void;
|
44 | addSection(options: NotebookTools.IAddSectionOptions): void;
|
45 | /**
|
46 | * Handle a change to the notebook panel.
|
47 | */
|
48 | private _onActiveNotebookPanelChanged;
|
49 | /**
|
50 | * Handle a change to the active cell.
|
51 | */
|
52 | private _onActiveCellChanged;
|
53 | /**
|
54 | * Handle a change in the selection.
|
55 | */
|
56 | private _onSelectionChanged;
|
57 | /**
|
58 | * Handle a change in the active cell metadata.
|
59 | */
|
60 | private _onActiveNotebookPanelMetadataChanged;
|
61 | /**
|
62 | * Handle a change in the notebook model metadata.
|
63 | */
|
64 | private _onActiveCellMetadataChanged;
|
65 | private _toolChildren;
|
66 | translator: ITranslator;
|
67 | private _tools;
|
68 | private _tracker;
|
69 | private _prevActiveCell;
|
70 | private _prevActiveNotebookModel;
|
71 | }
|
72 | /**
|
73 | * The namespace for NotebookTools class statics.
|
74 | */
|
75 | export declare namespace NotebookTools {
|
76 | |
77 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 | type ReadonlyPartialJSONOptionValueArray = [
|
83 | ReadonlyPartialJSONValue | undefined,
|
84 | ReadonlyPartialJSONValue
|
85 | ][];
|
86 | |
87 |
|
88 |
|
89 | interface IToolPanel {
|
90 | |
91 |
|
92 |
|
93 | section: string;
|
94 | |
95 |
|
96 |
|
97 | panel: RankedPanel<NotebookTools.Tool>;
|
98 | |
99 |
|
100 |
|
101 | rank?: number | null;
|
102 | }
|
103 | |
104 |
|
105 |
|
106 | interface IOptions {
|
107 | |
108 |
|
109 |
|
110 | tracker: INotebookTracker;
|
111 | |
112 |
|
113 |
|
114 | translator?: ITranslator;
|
115 | }
|
116 | |
117 |
|
118 |
|
119 | interface IAddOptions {
|
120 | |
121 |
|
122 |
|
123 | tool: INotebookTools.ITool;
|
124 | |
125 |
|
126 |
|
127 | section: string;
|
128 | |
129 |
|
130 |
|
131 | rank?: number;
|
132 | }
|
133 | |
134 |
|
135 |
|
136 | interface IAddSectionOptions {
|
137 | |
138 |
|
139 |
|
140 | sectionName: string;
|
141 | |
142 |
|
143 |
|
144 | tool?: INotebookTools.ITool;
|
145 | |
146 |
|
147 |
|
148 | label?: string;
|
149 | |
150 |
|
151 |
|
152 | rank?: number;
|
153 | }
|
154 | |
155 |
|
156 |
|
157 | const ActiveNotebookPanelMessage: ConflatableMessage;
|
158 | |
159 |
|
160 |
|
161 | const ActiveCellMessage: ConflatableMessage;
|
162 | |
163 |
|
164 |
|
165 | const SelectionMessage: ConflatableMessage;
|
166 | |
167 |
|
168 |
|
169 | class Tool extends Widget implements INotebookTools.ITool {
|
170 | |
171 |
|
172 |
|
173 | notebookTools: INotebookTools;
|
174 | dispose(): void;
|
175 | |
176 |
|
177 |
|
178 |
|
179 |
|
180 | processMessage(msg: Message): void;
|
181 | |
182 |
|
183 |
|
184 |
|
185 |
|
186 |
|
187 | protected onActiveNotebookPanelChanged(msg: Message): void;
|
188 | |
189 |
|
190 |
|
191 |
|
192 |
|
193 |
|
194 | protected onActiveCellChanged(msg: Message): void;
|
195 | |
196 |
|
197 |
|
198 |
|
199 |
|
200 |
|
201 | protected onSelectionChanged(msg: Message): void;
|
202 | |
203 |
|
204 |
|
205 |
|
206 |
|
207 |
|
208 | protected onActiveCellMetadataChanged(msg: ObservableJSON.ChangeMessage): void;
|
209 | |
210 |
|
211 |
|
212 |
|
213 |
|
214 |
|
215 | protected onActiveNotebookPanelMetadataChanged(msg: ObservableJSON.ChangeMessage): void;
|
216 | }
|
217 | |
218 |
|
219 |
|
220 | class MetadataEditorTool extends Tool {
|
221 | |
222 |
|
223 |
|
224 | constructor(options: MetadataEditorTool.IOptions);
|
225 | /**
|
226 | * The editor used by the tool.
|
227 | */
|
228 | get editor(): JSONEditor;
|
229 | /**
|
230 | * Handle a change to the notebook.
|
231 | */
|
232 | protected onActiveNotebookPanelChanged(msg: Message): void;
|
233 | protected createEditor(): void;
|
234 | private _editor;
|
235 | private _editorLabel;
|
236 | private _editorFactory;
|
237 | }
|
238 | /**
|
239 | * The namespace for `MetadataEditorTool` static data.
|
240 | */
|
241 | namespace MetadataEditorTool {
|
242 | |
243 |
|
244 |
|
245 | interface IOptions {
|
246 | |
247 |
|
248 |
|
249 | editorFactory: CodeEditor.Factory;
|
250 | |
251 |
|
252 |
|
253 | label?: string;
|
254 | |
255 |
|
256 |
|
257 | collapsed?: boolean;
|
258 | |
259 |
|
260 |
|
261 | translator?: ITranslator;
|
262 | }
|
263 | }
|
264 | }
|
265 | export {};
|