UNPKG

2.33 kBTypeScriptView Raw
1import { IWidgetTracker } from '@jupyterlab/apputils';
2import { Cell } from '@jupyterlab/cells';
3import { Token } from '@lumino/coreutils';
4import { ISignal } from '@lumino/signaling';
5import { Widget } from '@lumino/widgets';
6import { NotebookTools } from './notebooktools';
7import { NotebookPanel } from './panel';
8import { NotebookWidgetFactory } from './widgetfactory';
9/**
10 * The notebook widget factory token.
11 */
12export declare const INotebookWidgetFactory: Token<NotebookWidgetFactory.IFactory>;
13/**
14 * The notebook tools token.
15 */
16export declare const INotebookTools: Token<INotebookTools>;
17/**
18 * The interface for notebook metadata tools.
19 */
20export interface INotebookTools extends Widget {
21 activeNotebookPanel: NotebookPanel | null;
22 activeCell: Cell | null;
23 selectedCells: Cell[];
24 addItem(options: NotebookTools.IAddOptions): void;
25}
26/**
27 * The namespace for NotebookTools class statics.
28 */
29export declare namespace INotebookTools {
30 /**
31 * The options used to add an item to the notebook tools.
32 */
33 interface IAddOptions {
34 /**
35 * The tool to add to the notebook tools area.
36 */
37 tool: ITool;
38 /**
39 * The section to which the tool should be added.
40 */
41 section?: 'common' | 'advanced';
42 /**
43 * The rank order of the widget among its siblings.
44 */
45 rank?: number;
46 }
47 interface ITool extends Widget {
48 /**
49 * The notebook tools object.
50 */
51 notebookTools: INotebookTools;
52 }
53}
54/**
55 * The notebook tracker token.
56 */
57export declare const INotebookTracker: Token<INotebookTracker>;
58/**
59 * An object that tracks notebook widgets.
60 */
61export interface INotebookTracker extends IWidgetTracker<NotebookPanel> {
62 /**
63 * The currently focused cell.
64 *
65 * #### Notes
66 * If there is no cell with the focus, then this value is `null`.
67 */
68 readonly activeCell: Cell | null;
69 /**
70 * A signal emitted when the current active cell changes.
71 *
72 * #### Notes
73 * If there is no cell with the focus, then `null` will be emitted.
74 */
75 readonly activeCellChanged: ISignal<this, Cell | null>;
76 /**
77 * A signal emitted when the selection state changes.
78 */
79 readonly selectionChanged: ISignal<this, void>;
80}