@jupyterlab/cell-toolbar 4.0.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cellmenu.d.ts +20 -0
- package/lib/cellmenu.js +68 -0
- package/lib/cellmenu.js.map +1 -0
- package/lib/celltoolbartracker.d.ts +74 -0
- package/lib/celltoolbartracker.js +280 -0
- package/lib/celltoolbartracker.js.map +1 -0
- package/lib/celltoolbarwidget.d.ts +9 -0
- package/lib/celltoolbarwidget.js +14 -0
- package/lib/celltoolbarwidget.js.map +1 -0
- package/lib/index.d.ts +6 -0
- package/lib/index.js +11 -0
- package/lib/index.js.map +1 -0
- package/lib/tokens.d.ts +25 -0
- package/lib/tokens.js +2 -0
- package/lib/tokens.js.map +1 -0
- package/lib/toolbarbutton.d.ts +56 -0
- package/lib/toolbarbutton.js +54 -0
- package/lib/toolbarbutton.js.map +1 -0
- package/lib/utils.d.ts +7 -0
- package/lib/utils.js +16 -0
- package/lib/utils.js.map +1 -0
- package/package.json +68 -0
- package/style/base.css +72 -0
- package/style/icons/addabove.svg +11 -0
- package/style/icons/addbelow.svg +11 -0
- package/style/icons/delete.svg +4 -0
- package/style/icons/duplicate.svg +4 -0
- package/style/icons/movedown.svg +3 -0
- package/style/icons/moveup.svg +3 -0
- package/style/index.css +14 -0
- package/style/index.js +14 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CommandRegistry } from '@lumino/commands';
|
|
2
|
+
import { Widget } from '@lumino/widgets';
|
|
3
|
+
import { ICellMenuItem } from './tokens';
|
|
4
|
+
/**
|
|
5
|
+
* Toolbar icon menu container
|
|
6
|
+
*/
|
|
7
|
+
export declare class CellMenu extends Widget {
|
|
8
|
+
constructor(commands: CommandRegistry, items: ICellMenuItem[]);
|
|
9
|
+
handleEvent(event: Event): void;
|
|
10
|
+
/**
|
|
11
|
+
* Handle `after-attach` messages for the widget.
|
|
12
|
+
*/
|
|
13
|
+
onAfterAttach(): void;
|
|
14
|
+
/**
|
|
15
|
+
* Handle `before-detach` messages for the widget.
|
|
16
|
+
*/
|
|
17
|
+
onBeforeDetach(): void;
|
|
18
|
+
protected _addButtons(items: ICellMenuItem[]): void;
|
|
19
|
+
private _commands;
|
|
20
|
+
}
|
package/lib/cellmenu.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/* -----------------------------------------------------------------------------
|
|
2
|
+
| Copyright (c) Jupyter Development Team.
|
|
3
|
+
| Distributed under the terms of the Modified BSD License.
|
|
4
|
+
|----------------------------------------------------------------------------*/
|
|
5
|
+
import { ToolbarButton } from '@jupyterlab/apputils';
|
|
6
|
+
import { LabIcon } from '@jupyterlab/ui-components';
|
|
7
|
+
import { each } from '@lumino/algorithm';
|
|
8
|
+
import { PanelLayout, Widget } from '@lumino/widgets';
|
|
9
|
+
const CELL_MENU_CLASS = 'jp-cell-menu';
|
|
10
|
+
/**
|
|
11
|
+
* Toolbar icon menu container
|
|
12
|
+
*/
|
|
13
|
+
export class CellMenu extends Widget {
|
|
14
|
+
constructor(commands, items) {
|
|
15
|
+
super();
|
|
16
|
+
this._commands = commands;
|
|
17
|
+
this.layout = new PanelLayout();
|
|
18
|
+
this.addClass(CELL_MENU_CLASS);
|
|
19
|
+
this._addButtons(items);
|
|
20
|
+
}
|
|
21
|
+
handleEvent(event) {
|
|
22
|
+
switch (event.type) {
|
|
23
|
+
case 'mousedown':
|
|
24
|
+
case 'click':
|
|
25
|
+
// Ensure the mouse event is not propagated on the cell.
|
|
26
|
+
event.stopPropagation();
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Handle `after-attach` messages for the widget.
|
|
32
|
+
*/
|
|
33
|
+
onAfterAttach() {
|
|
34
|
+
this.node.addEventListener('mousedown', this);
|
|
35
|
+
this.node.addEventListener('click', this);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Handle `before-detach` messages for the widget.
|
|
39
|
+
*/
|
|
40
|
+
onBeforeDetach() {
|
|
41
|
+
this.node.removeEventListener('mousedown', this);
|
|
42
|
+
this.node.removeEventListener('click', this);
|
|
43
|
+
}
|
|
44
|
+
_addButtons(items) {
|
|
45
|
+
each(this.children(), widget => {
|
|
46
|
+
widget.dispose();
|
|
47
|
+
});
|
|
48
|
+
const layout = this.layout;
|
|
49
|
+
items.forEach(entry => {
|
|
50
|
+
var _a, _b;
|
|
51
|
+
if (this._commands.hasCommand(entry.command)) {
|
|
52
|
+
layout.addWidget(new ToolbarButton({
|
|
53
|
+
icon: LabIcon.resolve({ icon: entry.icon }),
|
|
54
|
+
className: `jp-cell-${(_a = entry.cellType) !== null && _a !== void 0 ? _a : 'all'}`,
|
|
55
|
+
onClickWithEvent: (e) => {
|
|
56
|
+
// Prevent propagation of this event in case the command causes the
|
|
57
|
+
// current cell to move. If the cell moves and the event propagates to the
|
|
58
|
+
// new cell, this may have an effect on the new cell.
|
|
59
|
+
void this._commands.execute(entry.command);
|
|
60
|
+
e.stopPropagation();
|
|
61
|
+
},
|
|
62
|
+
tooltip: (_b = entry.tooltip) !== null && _b !== void 0 ? _b : this._commands.label(entry.command)
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=cellmenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cellmenu.js","sourceRoot":"","sources":["../src/cellmenu.ts"],"names":[],"mappings":"AAAA;;;+EAG+E;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGtD,MAAM,eAAe,GAAG,cAAc,CAAC;AAEvC;;GAEG;AACH,MAAM,O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,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;oBAC3C,SAAS,EAAE,WAAW,MAAA,KAAK,CAAC,QAAQ,mCAAI,KAAK,EAAE;oBAC/C,gBAAgB,EAAE,CAAC,CAAQ,EAAQ,EAAE;wBACnC,mEAAmE;wBACnE,0EAA0E;wBAC1E,qDAAqD;wBACrD,KAAK,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;wBAC3C,CAAC,CAAC,eAAe,EAAE,CAAC;oBACtB,CAAC;oBACD,OAAO,EAAE,MAAA,KAAK,CAAC,OAAO,mCAAI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC;iBAC9D,CAAC,CACH,CAAC;aACH;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CAGF"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { ICellModel } from '@jupyterlab/cells';
|
|
2
|
+
import { DocumentRegistry } from '@jupyterlab/docregistry';
|
|
3
|
+
import { Notebook, NotebookPanel } from '@jupyterlab/notebook';
|
|
4
|
+
import { IObservableList, IObservableUndoableList } from '@jupyterlab/observables';
|
|
5
|
+
import { ISettingRegistry } from '@jupyterlab/settingregistry';
|
|
6
|
+
import { LabIcon } from '@jupyterlab/ui-components';
|
|
7
|
+
import { CommandRegistry } from '@lumino/commands';
|
|
8
|
+
import { IDisposable } from '@lumino/disposable';
|
|
9
|
+
/**
|
|
10
|
+
* Icons for use in toolbar.
|
|
11
|
+
*
|
|
12
|
+
* These are copied from icon.ts, which is not part of the webpack bundle
|
|
13
|
+
* because nothing is imported from it.
|
|
14
|
+
*/
|
|
15
|
+
export declare const addAboveIcon: LabIcon;
|
|
16
|
+
export declare const addBelowIcon: LabIcon;
|
|
17
|
+
export declare const deleteIcon: LabIcon;
|
|
18
|
+
export declare const duplicateIcon: LabIcon;
|
|
19
|
+
export declare const moveDownIcon: LabIcon;
|
|
20
|
+
export declare const moveUpIcon: LabIcon;
|
|
21
|
+
/**
|
|
22
|
+
* Watch a notebook so that a cell toolbar appears on the active cell
|
|
23
|
+
*/
|
|
24
|
+
export declare class CellToolbarTracker implements IDisposable {
|
|
25
|
+
constructor(panel: NotebookPanel, commands: CommandRegistry, settings: ISettingRegistry.ISettings | null);
|
|
26
|
+
_onActiveCellChanged(notebook: Notebook): void;
|
|
27
|
+
get isDisposed(): boolean;
|
|
28
|
+
dispose(): void;
|
|
29
|
+
/**
|
|
30
|
+
* Callback to react to cells list changes
|
|
31
|
+
*
|
|
32
|
+
* @param cells List of notebook cells
|
|
33
|
+
* @param changed Modification of the list
|
|
34
|
+
*/
|
|
35
|
+
updateConnectedCells(cells: IObservableUndoableList<ICellModel>, changed: IObservableList.IChangedArgs<ICellModel>): void;
|
|
36
|
+
private _addToolbar;
|
|
37
|
+
private _getCell;
|
|
38
|
+
private _findToolbarWidgets;
|
|
39
|
+
private _removeToolbar;
|
|
40
|
+
/**
|
|
41
|
+
* Call back on settings changes
|
|
42
|
+
*/
|
|
43
|
+
private _onSettingsChanged;
|
|
44
|
+
private _changedEventCallback;
|
|
45
|
+
private _resizeEventCallback;
|
|
46
|
+
private _updateCellForToolbarOverlap;
|
|
47
|
+
private _cellToolbarOverlapsContents;
|
|
48
|
+
/**
|
|
49
|
+
* Check for overlap between rendered Markdown and the cell toolbar
|
|
50
|
+
*
|
|
51
|
+
* @param activeCell A rendered MarkdownCell
|
|
52
|
+
* @returns `true` if the first line of the output overlaps with the cell toolbar, `false` otherwise
|
|
53
|
+
*/
|
|
54
|
+
private _markdownOverlapsToolbar;
|
|
55
|
+
private _codeOverlapsToolbar;
|
|
56
|
+
private _cellEditorWidgetLeft;
|
|
57
|
+
private _cellEditorWidgetRight;
|
|
58
|
+
private _cellToolbarLeft;
|
|
59
|
+
private _commands;
|
|
60
|
+
private _isDisposed;
|
|
61
|
+
private _panel;
|
|
62
|
+
private _previousActiveCell;
|
|
63
|
+
private _settings;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Widget extension that creates a CellToolbarTracker each time a notebook is
|
|
67
|
+
* created.
|
|
68
|
+
*/
|
|
69
|
+
export declare class CellBarExtension implements DocumentRegistry.WidgetExtension {
|
|
70
|
+
constructor(commands: CommandRegistry, settings: ISettingRegistry.ISettings | null);
|
|
71
|
+
createNew(panel: NotebookPanel): IDisposable;
|
|
72
|
+
private _commands;
|
|
73
|
+
private _settings;
|
|
74
|
+
}
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import { LabIcon } from '@jupyterlab/ui-components';
|
|
2
|
+
import { each } from '@lumino/algorithm';
|
|
3
|
+
import { CellToolbarWidget } from './celltoolbarwidget';
|
|
4
|
+
import { EXTENSION_ID } from './tokens';
|
|
5
|
+
// icon svg import statements
|
|
6
|
+
import addAboveSvg from '../style/icons/addabove.svg';
|
|
7
|
+
import addBelowSvg from '../style/icons/addbelow.svg';
|
|
8
|
+
import deleteSvg from '../style/icons/delete.svg';
|
|
9
|
+
import duplicateSvg from '../style/icons/duplicate.svg';
|
|
10
|
+
import moveDownSvg from '../style/icons/movedown.svg';
|
|
11
|
+
import moveUpSvg from '../style/icons/moveup.svg';
|
|
12
|
+
const DEFAULT_LEFT_MENU = [];
|
|
13
|
+
/**
|
|
14
|
+
* Widget cell toolbar class
|
|
15
|
+
*/
|
|
16
|
+
const CELL_BAR_CLASS = 'jp-cell-bar';
|
|
17
|
+
/**
|
|
18
|
+
* Class for a cell whose contents overlap with the cell toolbar
|
|
19
|
+
*/
|
|
20
|
+
const TOOLBAR_OVERLAP_CLASS = 'jp-toolbar-overlap';
|
|
21
|
+
/**
|
|
22
|
+
* Icons for use in toolbar.
|
|
23
|
+
*
|
|
24
|
+
* These are copied from icon.ts, which is not part of the webpack bundle
|
|
25
|
+
* because nothing is imported from it.
|
|
26
|
+
*/
|
|
27
|
+
export const addAboveIcon = new LabIcon({
|
|
28
|
+
name: `${EXTENSION_ID}:add-above`,
|
|
29
|
+
svgstr: addAboveSvg
|
|
30
|
+
});
|
|
31
|
+
export const addBelowIcon = new LabIcon({
|
|
32
|
+
name: `${EXTENSION_ID}:add-below`,
|
|
33
|
+
svgstr: addBelowSvg
|
|
34
|
+
});
|
|
35
|
+
export const deleteIcon = new LabIcon({
|
|
36
|
+
name: `${EXTENSION_ID}:delete`,
|
|
37
|
+
svgstr: deleteSvg
|
|
38
|
+
});
|
|
39
|
+
export const duplicateIcon = new LabIcon({
|
|
40
|
+
name: `${EXTENSION_ID}:duplicate`,
|
|
41
|
+
svgstr: duplicateSvg
|
|
42
|
+
});
|
|
43
|
+
export const moveDownIcon = new LabIcon({
|
|
44
|
+
name: `${EXTENSION_ID}:move-down`,
|
|
45
|
+
svgstr: moveDownSvg
|
|
46
|
+
});
|
|
47
|
+
export const moveUpIcon = new LabIcon({
|
|
48
|
+
name: `${EXTENSION_ID}:move-up`,
|
|
49
|
+
svgstr: moveUpSvg
|
|
50
|
+
});
|
|
51
|
+
/**
|
|
52
|
+
* Watch a notebook so that a cell toolbar appears on the active cell
|
|
53
|
+
*/
|
|
54
|
+
export class CellToolbarTracker {
|
|
55
|
+
constructor(panel, commands, settings) {
|
|
56
|
+
this._isDisposed = false;
|
|
57
|
+
this._commands = commands;
|
|
58
|
+
this._panel = panel;
|
|
59
|
+
this._settings = settings;
|
|
60
|
+
this._previousActiveCell = this._panel.content.activeCell;
|
|
61
|
+
if (this._settings) {
|
|
62
|
+
this._onSettingsChanged();
|
|
63
|
+
this._settings.changed.connect(this._onSettingsChanged, this);
|
|
64
|
+
}
|
|
65
|
+
const notebookModel = this._panel.context.model;
|
|
66
|
+
const cells = notebookModel.cells;
|
|
67
|
+
cells.changed.connect(this.updateConnectedCells, this);
|
|
68
|
+
// Only add the toolbar to the notebook's active cell (if any) once it has fully rendered and been revealed.
|
|
69
|
+
panel.revealed.then(() => this._onActiveCellChanged(panel.content));
|
|
70
|
+
// Handle subsequent changes of active cell.
|
|
71
|
+
panel.content.activeCellChanged.connect(this._onActiveCellChanged, this);
|
|
72
|
+
}
|
|
73
|
+
_onActiveCellChanged(notebook) {
|
|
74
|
+
const activeCell = notebook.activeCell;
|
|
75
|
+
if (!activeCell) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (this._previousActiveCell !== null &&
|
|
79
|
+
this._previousActiveCell !== undefined) {
|
|
80
|
+
this._removeToolbar(this._previousActiveCell.model);
|
|
81
|
+
}
|
|
82
|
+
this._addToolbar(activeCell.model);
|
|
83
|
+
this._previousActiveCell = activeCell;
|
|
84
|
+
this._updateCellForToolbarOverlap(activeCell);
|
|
85
|
+
}
|
|
86
|
+
get isDisposed() {
|
|
87
|
+
return this._isDisposed;
|
|
88
|
+
}
|
|
89
|
+
dispose() {
|
|
90
|
+
var _a;
|
|
91
|
+
if (this.isDisposed) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
this._isDisposed = true;
|
|
95
|
+
if (this._settings) {
|
|
96
|
+
this._settings.changed.disconnect(this._onSettingsChanged, this);
|
|
97
|
+
}
|
|
98
|
+
const cells = (_a = this._panel) === null || _a === void 0 ? void 0 : _a.context.model.cells;
|
|
99
|
+
if (cells) {
|
|
100
|
+
cells.changed.disconnect(this.updateConnectedCells, this);
|
|
101
|
+
each(cells.iter(), model => this._removeToolbar(model));
|
|
102
|
+
}
|
|
103
|
+
this._panel = null;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Callback to react to cells list changes
|
|
107
|
+
*
|
|
108
|
+
* @param cells List of notebook cells
|
|
109
|
+
* @param changed Modification of the list
|
|
110
|
+
*/
|
|
111
|
+
updateConnectedCells(cells, changed) {
|
|
112
|
+
var _a;
|
|
113
|
+
const activeCell = (_a = this._panel) === null || _a === void 0 ? void 0 : _a.content.activeCell;
|
|
114
|
+
if (activeCell === null || activeCell === undefined) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (changed.oldValues.find(m => m === activeCell.model)) {
|
|
118
|
+
this._removeToolbar(activeCell.model);
|
|
119
|
+
this._addToolbar(activeCell.model);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
_addToolbar(model) {
|
|
123
|
+
var _a, _b;
|
|
124
|
+
const cell = this._getCell(model);
|
|
125
|
+
if (cell) {
|
|
126
|
+
const { leftMenu } = (_b = (_a = this._settings) === null || _a === void 0 ? void 0 : _a.composite) !== null && _b !== void 0 ? _b : {};
|
|
127
|
+
const leftMenu_ = leftMenu === null ? [] : leftMenu !== null && leftMenu !== void 0 ? leftMenu : DEFAULT_LEFT_MENU;
|
|
128
|
+
const toolbar = new CellToolbarWidget(this._commands, leftMenu_);
|
|
129
|
+
toolbar.addClass(CELL_BAR_CLASS);
|
|
130
|
+
cell.layout.insertWidget(0, toolbar);
|
|
131
|
+
// For rendered markdown, watch for resize events.
|
|
132
|
+
cell.displayChanged.connect(this._resizeEventCallback, this);
|
|
133
|
+
// Watch for changes in the cell's contents.
|
|
134
|
+
cell.model.contentChanged.connect(this._changedEventCallback, this);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
_getCell(model) {
|
|
138
|
+
var _a;
|
|
139
|
+
return (_a = this._panel) === null || _a === void 0 ? void 0 : _a.content.widgets.find(widget => widget.model === model);
|
|
140
|
+
}
|
|
141
|
+
_findToolbarWidgets(cell) {
|
|
142
|
+
const widgets = cell.layout.widgets;
|
|
143
|
+
// Search for header using the CSS class or use the first one if not found.
|
|
144
|
+
return widgets.filter(widget => widget.hasClass(CELL_BAR_CLASS)) || [];
|
|
145
|
+
}
|
|
146
|
+
_removeToolbar(model) {
|
|
147
|
+
const cell = this._getCell(model);
|
|
148
|
+
if (cell) {
|
|
149
|
+
this._findToolbarWidgets(cell).forEach(widget => widget.dispose());
|
|
150
|
+
// Attempt to remove the resize and changed event handlers.
|
|
151
|
+
cell.displayChanged.disconnect(this._resizeEventCallback, this);
|
|
152
|
+
cell.model.contentChanged.disconnect(this._changedEventCallback, this);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Call back on settings changes
|
|
157
|
+
*/
|
|
158
|
+
_onSettingsChanged() {
|
|
159
|
+
var _a;
|
|
160
|
+
// Reset toolbar when settings changes
|
|
161
|
+
const activeCell = (_a = this._panel) === null || _a === void 0 ? void 0 : _a.content.activeCell;
|
|
162
|
+
if (activeCell) {
|
|
163
|
+
this._removeToolbar(activeCell.model);
|
|
164
|
+
this._addToolbar(activeCell.model);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
_changedEventCallback() {
|
|
168
|
+
var _a;
|
|
169
|
+
const activeCell = (_a = this._panel) === null || _a === void 0 ? void 0 : _a.content.activeCell;
|
|
170
|
+
if (activeCell === null || activeCell === undefined) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
this._updateCellForToolbarOverlap(activeCell);
|
|
174
|
+
}
|
|
175
|
+
_resizeEventCallback() {
|
|
176
|
+
var _a;
|
|
177
|
+
const activeCell = (_a = this._panel) === null || _a === void 0 ? void 0 : _a.content.activeCell;
|
|
178
|
+
if (activeCell === null || activeCell === undefined) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
this._updateCellForToolbarOverlap(activeCell);
|
|
182
|
+
}
|
|
183
|
+
_updateCellForToolbarOverlap(activeCell) {
|
|
184
|
+
// Remove the "toolbar overlap" class from the cell, rendering the cell's toolbar
|
|
185
|
+
const activeCellElement = activeCell.node;
|
|
186
|
+
activeCellElement.classList.remove(TOOLBAR_OVERLAP_CLASS);
|
|
187
|
+
if (this._cellToolbarOverlapsContents(activeCell)) {
|
|
188
|
+
// Add the "toolbar overlap" class to the cell, completely concealing the toolbar,
|
|
189
|
+
// if the first line of the content overlaps with it at all
|
|
190
|
+
activeCellElement.classList.add(TOOLBAR_OVERLAP_CLASS);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
_cellToolbarOverlapsContents(activeCell) {
|
|
194
|
+
const cellType = activeCell.model.type;
|
|
195
|
+
// If the toolbar is too large for the current cell, hide it.
|
|
196
|
+
const cellLeft = this._cellEditorWidgetLeft(activeCell);
|
|
197
|
+
const cellRight = this._cellEditorWidgetRight(activeCell);
|
|
198
|
+
const toolbarLeft = this._cellToolbarLeft(activeCell);
|
|
199
|
+
if (toolbarLeft === null) {
|
|
200
|
+
return false;
|
|
201
|
+
}
|
|
202
|
+
// The toolbar should not take up more than 50% of the cell.
|
|
203
|
+
if ((cellLeft + cellRight) / 2 > toolbarLeft) {
|
|
204
|
+
return true;
|
|
205
|
+
}
|
|
206
|
+
if (cellType === 'markdown' && activeCell.rendered) {
|
|
207
|
+
// Check for overlap in rendered markdown content
|
|
208
|
+
return this._markdownOverlapsToolbar(activeCell);
|
|
209
|
+
}
|
|
210
|
+
// Check for overlap in code content
|
|
211
|
+
return this._codeOverlapsToolbar(activeCell);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Check for overlap between rendered Markdown and the cell toolbar
|
|
215
|
+
*
|
|
216
|
+
* @param activeCell A rendered MarkdownCell
|
|
217
|
+
* @returns `true` if the first line of the output overlaps with the cell toolbar, `false` otherwise
|
|
218
|
+
*/
|
|
219
|
+
_markdownOverlapsToolbar(activeCell) {
|
|
220
|
+
const markdownOutput = activeCell.inputArea; // Rendered markdown appears in the input area
|
|
221
|
+
// Get the rendered markdown as a widget.
|
|
222
|
+
const markdownOutputWidget = markdownOutput.renderedInput;
|
|
223
|
+
const markdownOutputElement = markdownOutputWidget.node;
|
|
224
|
+
const firstOutputElementChild = markdownOutputElement.firstElementChild;
|
|
225
|
+
if (firstOutputElementChild === null) {
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
228
|
+
// Temporarily set the element's max width so that the bounding client rectangle only encompasses the content.
|
|
229
|
+
const oldMaxWidth = firstOutputElementChild.style.maxWidth;
|
|
230
|
+
firstOutputElementChild.style.maxWidth = 'max-content';
|
|
231
|
+
const lineRight = firstOutputElementChild.getBoundingClientRect().right;
|
|
232
|
+
// Reinstate the old max width.
|
|
233
|
+
firstOutputElementChild.style.maxWidth = oldMaxWidth;
|
|
234
|
+
const toolbarLeft = this._cellToolbarLeft(activeCell);
|
|
235
|
+
return toolbarLeft === null ? false : lineRight > toolbarLeft;
|
|
236
|
+
}
|
|
237
|
+
_codeOverlapsToolbar(activeCell) {
|
|
238
|
+
const editorWidget = activeCell.editorWidget;
|
|
239
|
+
const editor = activeCell.editor;
|
|
240
|
+
if (editor.lineCount < 1) {
|
|
241
|
+
return false; // Nothing in the editor
|
|
242
|
+
}
|
|
243
|
+
const codeMirrorLines = editorWidget.node.getElementsByClassName('CodeMirror-line');
|
|
244
|
+
if (codeMirrorLines.length < 1) {
|
|
245
|
+
return false; // No lines present
|
|
246
|
+
}
|
|
247
|
+
const lineRight = codeMirrorLines[0].children[0] // First span under first pre
|
|
248
|
+
.getBoundingClientRect().right;
|
|
249
|
+
const toolbarLeft = this._cellToolbarLeft(activeCell);
|
|
250
|
+
return toolbarLeft === null ? false : lineRight > toolbarLeft;
|
|
251
|
+
}
|
|
252
|
+
_cellEditorWidgetLeft(activeCell) {
|
|
253
|
+
return activeCell.editorWidget.node.getBoundingClientRect().left;
|
|
254
|
+
}
|
|
255
|
+
_cellEditorWidgetRight(activeCell) {
|
|
256
|
+
return activeCell.editorWidget.node.getBoundingClientRect().right;
|
|
257
|
+
}
|
|
258
|
+
_cellToolbarLeft(activeCell) {
|
|
259
|
+
const toolbarWidgets = this._findToolbarWidgets(activeCell);
|
|
260
|
+
if (toolbarWidgets.length < 1) {
|
|
261
|
+
return null;
|
|
262
|
+
}
|
|
263
|
+
const activeCellToolbar = toolbarWidgets[0].node;
|
|
264
|
+
return activeCellToolbar.getBoundingClientRect().left;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Widget extension that creates a CellToolbarTracker each time a notebook is
|
|
269
|
+
* created.
|
|
270
|
+
*/
|
|
271
|
+
export class CellBarExtension {
|
|
272
|
+
constructor(commands, settings) {
|
|
273
|
+
this._commands = commands;
|
|
274
|
+
this._settings = settings;
|
|
275
|
+
}
|
|
276
|
+
createNew(panel) {
|
|
277
|
+
return new CellToolbarTracker(panel, this._commands, this._settings);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
//# sourceMappingURL=celltoolbartracker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"celltoolbartracker.js","sourceRoot":"","sources":["../src/celltoolbartracker.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAIzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAiB,MAAM,UAAU,CAAC;AAEvD,6BAA6B;AAC7B,OAAO,WAAW,MAAM,6BAA6B,CAAC;AACtD,OAAO,WAAW,MAAM,6BAA6B,CAAC;AACtD,OAAO,SAAS,MAAM,2BAA2B,CAAC;AAClD,OAAO,YAAY,MAAM,8BAA8B,CAAC;AACxD,OAAO,WAAW,MAAM,6BAA6B,CAAC;AACtD,OAAO,SAAS,MAAM,2BAA2B,CAAC;AAElD,MAAM,iBAAiB,GAAoB,EAAE,CAAC;AAE9C;;GAEG;AACH,MAAM,cAAc,GAAG,aAAa,CAAC;AAErC;;GAEG;AACH,MAAM,qBAAqB,GAAG,oBAAoB,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,OAAO,CAAC;IACtC,IAAI,EAAE,GAAG,YAAY,YAAY;IACjC,MAAM,EAAE,WAAW;CACpB,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,OAAO,CAAC;IACtC,IAAI,EAAE,GAAG,YAAY,YAAY;IACjC,MAAM,EAAE,WAAW;CACpB,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,OAAO,CA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AC;IACxD,CAAC;CAOF;AAED;;;GAGG;AACH,MAAM,OAAO,gBAAgB;IAC3B,YACE,QAAyB,EACzB,QAA2C;QAE3C,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAED,SAAS,CAAC,KAAoB;QAC5B,OAAO,IAAI,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IACvE,CAAC;CAIF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CommandRegistry } from '@lumino/commands';
|
|
2
|
+
import { Widget } from '@lumino/widgets';
|
|
3
|
+
import { ICellMenuItem } from './tokens';
|
|
4
|
+
/**
|
|
5
|
+
* Cell Toolbar Widget
|
|
6
|
+
*/
|
|
7
|
+
export declare class CellToolbarWidget extends Widget {
|
|
8
|
+
constructor(commands: CommandRegistry, menuItems: ICellMenuItem[]);
|
|
9
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PanelLayout, Widget } from '@lumino/widgets';
|
|
2
|
+
import { CellMenu } from './cellmenu';
|
|
3
|
+
/**
|
|
4
|
+
* Cell Toolbar Widget
|
|
5
|
+
*/
|
|
6
|
+
export class CellToolbarWidget extends Widget {
|
|
7
|
+
constructor(commands, menuItems) {
|
|
8
|
+
super();
|
|
9
|
+
this.layout = new PanelLayout();
|
|
10
|
+
this.addClass('jp-cell-toolbar');
|
|
11
|
+
this.layout.addWidget(new CellMenu(commands, menuItems));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=celltoolbarwidget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"celltoolbarwidget.js","sourceRoot":"","sources":["../src/celltoolbarwidget.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,MAAM;IAC3C,YAAY,QAAyB,EAAE,SAA0B;QAC/D,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;QAChC,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;QAEhC,IAAI,CAAC,MAAsB,CAAC,SAAS,CAAC,IAAI,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;IAC5E,CAAC;CACF"}
|
package/lib/index.d.ts
ADDED
package/lib/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* -----------------------------------------------------------------------------
|
|
2
|
+
| Copyright (c) Jupyter Development Team.
|
|
3
|
+
| Distributed under the terms of the Modified BSD License.
|
|
4
|
+
|----------------------------------------------------------------------------*/
|
|
5
|
+
/**
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
* @module cell-toolbar
|
|
8
|
+
*/
|
|
9
|
+
export { CellMenu } from './cellmenu';
|
|
10
|
+
export { CellBarExtension } from './celltoolbartracker';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;+EAG+E;AAC/E;;;GAGG;AACF,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC"}
|
package/lib/tokens.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { LabIcon } from '@jupyterlab/ui-components';
|
|
2
|
+
export declare const EXTENSION_ID = "@jupyterlab/cell-toolbar";
|
|
3
|
+
/**
|
|
4
|
+
* Menu action interface
|
|
5
|
+
*/
|
|
6
|
+
export interface ICellMenuItem {
|
|
7
|
+
/**
|
|
8
|
+
* Command to be triggered
|
|
9
|
+
*/
|
|
10
|
+
command: string;
|
|
11
|
+
/**
|
|
12
|
+
* Icon for the item
|
|
13
|
+
*/
|
|
14
|
+
icon: LabIcon | string;
|
|
15
|
+
/**
|
|
16
|
+
* Icon tooltip
|
|
17
|
+
*/
|
|
18
|
+
tooltip?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Type of cell it applies on
|
|
21
|
+
*
|
|
22
|
+
* Undefined if it applies on all cell types
|
|
23
|
+
*/
|
|
24
|
+
cellType?: 'code' | 'markdown' | 'raw';
|
|
25
|
+
}
|
package/lib/tokens.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,YAAY,GAAG,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ReactWidget } from '@jupyterlab/apputils';
|
|
2
|
+
import { LabIcon } from '@jupyterlab/ui-components';
|
|
3
|
+
/**
|
|
4
|
+
* Toggle button properties
|
|
5
|
+
*/
|
|
6
|
+
export interface IToggleButtonProps {
|
|
7
|
+
/**
|
|
8
|
+
* Button class name
|
|
9
|
+
*/
|
|
10
|
+
className?: (state: boolean) => string;
|
|
11
|
+
/**
|
|
12
|
+
* Button label
|
|
13
|
+
*/
|
|
14
|
+
label?: (state: boolean) => string;
|
|
15
|
+
/**
|
|
16
|
+
* Button icon
|
|
17
|
+
*/
|
|
18
|
+
icon?: (state: boolean) => LabIcon;
|
|
19
|
+
/**
|
|
20
|
+
* Button tooltip
|
|
21
|
+
*/
|
|
22
|
+
tooltip?: (state: boolean) => string;
|
|
23
|
+
/**
|
|
24
|
+
* Button callback
|
|
25
|
+
*/
|
|
26
|
+
onClick?: (state: boolean) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Button enabled status
|
|
29
|
+
*/
|
|
30
|
+
enabled?: (state: boolean) => boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Trigger the button on the actual onClick event rather than onMouseDown.
|
|
33
|
+
*
|
|
34
|
+
* See note in ToolbarButtonComponent below as to why the default is to
|
|
35
|
+
* trigger on onMouseDown.
|
|
36
|
+
*/
|
|
37
|
+
actualOnClick?: boolean;
|
|
38
|
+
}
|
|
39
|
+
export declare class ToggleButton extends ReactWidget {
|
|
40
|
+
protected props: IToggleButtonProps;
|
|
41
|
+
/**
|
|
42
|
+
* Creates a toolbar toggle button
|
|
43
|
+
*
|
|
44
|
+
* Initial state is false
|
|
45
|
+
*
|
|
46
|
+
* @param props props for underlying `ToolbarButton` component
|
|
47
|
+
*/
|
|
48
|
+
constructor(props?: IToggleButtonProps);
|
|
49
|
+
/**
|
|
50
|
+
* Toggled button state
|
|
51
|
+
*/
|
|
52
|
+
get toggled(): boolean;
|
|
53
|
+
set toggled(value: boolean);
|
|
54
|
+
render(): JSX.Element;
|
|
55
|
+
protected _toggled: boolean;
|
|
56
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/* -----------------------------------------------------------------------------
|
|
2
|
+
| Copyright (c) Jupyter Development Team.
|
|
3
|
+
| Distributed under the terms of the Modified BSD License.
|
|
4
|
+
|----------------------------------------------------------------------------*/
|
|
5
|
+
import { addToolbarButtonClass, ReactWidget, ToolbarButtonComponent } from '@jupyterlab/apputils';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
export class ToggleButton extends ReactWidget {
|
|
8
|
+
/**
|
|
9
|
+
* Creates a toolbar toggle button
|
|
10
|
+
*
|
|
11
|
+
* Initial state is false
|
|
12
|
+
*
|
|
13
|
+
* @param props props for underlying `ToolbarButton` component
|
|
14
|
+
*/
|
|
15
|
+
constructor(props = {}) {
|
|
16
|
+
super();
|
|
17
|
+
this.props = props;
|
|
18
|
+
this._toggled = false;
|
|
19
|
+
addToolbarButtonClass(this);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Toggled button state
|
|
23
|
+
*/
|
|
24
|
+
get toggled() {
|
|
25
|
+
return this._toggled;
|
|
26
|
+
}
|
|
27
|
+
set toggled(value) {
|
|
28
|
+
if (value !== this._toggled) {
|
|
29
|
+
this._toggled = value;
|
|
30
|
+
this.update();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
render() {
|
|
34
|
+
const p = {
|
|
35
|
+
className: this.props.className
|
|
36
|
+
? this.props.className(this.toggled)
|
|
37
|
+
: undefined,
|
|
38
|
+
label: this.props.label ? this.props.label(this.toggled) : undefined,
|
|
39
|
+
icon: this.props.icon ? this.props.icon(this.toggled) : undefined,
|
|
40
|
+
tooltip: this.props.tooltip
|
|
41
|
+
? this.props.tooltip(this.toggled)
|
|
42
|
+
: undefined,
|
|
43
|
+
onClick: this.props.onClick
|
|
44
|
+
? () => {
|
|
45
|
+
this.toggled = !this.toggled;
|
|
46
|
+
this.props.onClick(this.toggled);
|
|
47
|
+
}
|
|
48
|
+
: undefined,
|
|
49
|
+
enabled: this.props.enabled ? this.props.enabled(this.toggled) : undefined
|
|
50
|
+
};
|
|
51
|
+
return React.createElement(ToolbarButtonComponent, Object.assign({}, p));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=toolbarbutton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbarbutton.js","sourceRoot":"","sources":["../src/toolbarbutton.tsx"],"names":[],"mappings":"AAAA;;;+EAG+E;AAC/E,OAAO,EACL,qBAAqB,EACrB,WAAW,EACX,sBAAsB,EACvB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,MAAM,OAAO,CAAC;AAuC1B,MAAM,OAAO,YAAa,SAAQ,WAAW;IAC3C;;;;;;OAMG;IACH,YAAsB,QAA4B,EAAE;QAClD,KAAK,EAAE,CAAC;QADY,UAAK,GAAL,KAAK,CAAyB;QAwC1C,aAAQ,GAAG,KAAK,CAAC;QAtCzB,qBAAqB,CAAC,IAAI,CAAC,CAAC;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C,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS;SAC3E,CAAC;QACF,OAAO,oBAAC,sBAAsB,oBAAK,CAAC,EAAI,CAAC;IAC3C,CAAC;CAGF"}
|
package/lib/utils.d.ts
ADDED
package/lib/utils.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* -----------------------------------------------------------------------------
|
|
2
|
+
| Copyright (c) Jupyter Development Team.
|
|
3
|
+
| Distributed under the terms of the Modified BSD License.
|
|
4
|
+
|----------------------------------------------------------------------------*/
|
|
5
|
+
/**
|
|
6
|
+
* Get the value of a CSS variable
|
|
7
|
+
*
|
|
8
|
+
* @param name CSS variable name
|
|
9
|
+
* @returns The CSS variable value
|
|
10
|
+
*/
|
|
11
|
+
export function getCSSVar(name) {
|
|
12
|
+
return getComputedStyle(document.documentElement)
|
|
13
|
+
.getPropertyValue(name)
|
|
14
|
+
.trim();
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=utils.js.map
|
package/lib/utils.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;+EAG+E;AAC/E;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,OAAO,gBAAgB,CAAC,QAAQ,CAAC,eAAe,CAAC;SAC9C,gBAAgB,CAAC,IAAI,CAAC;SACtB,IAAI,EAAE,CAAC;AACZ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jupyterlab/cell-toolbar",
|
|
3
|
+
"version": "4.0.0-alpha.6",
|
|
4
|
+
"description": "Contextual cell toolbar adapted from jlab-enhanced-cell-toolbar",
|
|
5
|
+
"homepage": "https://github.com/jupyterlab/jupyterlab",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/jupyterlab/jupyterlab/issues"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/jupyterlab/jupyterlab.git"
|
|
12
|
+
},
|
|
13
|
+
"license": "BSD-3-Clause",
|
|
14
|
+
"author": "Project Jupyter",
|
|
15
|
+
"sideEffects": [
|
|
16
|
+
"style/**/*"
|
|
17
|
+
],
|
|
18
|
+
"main": "lib/index.js",
|
|
19
|
+
"types": "lib/index.d.ts",
|
|
20
|
+
"style": "style/index.css",
|
|
21
|
+
"directories": {
|
|
22
|
+
"lib": "lib",
|
|
23
|
+
"test": "test"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
|
|
27
|
+
"schema/*.json",
|
|
28
|
+
"style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}",
|
|
29
|
+
"style/index.js"
|
|
30
|
+
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsc -b",
|
|
33
|
+
"build:all": "npm run build",
|
|
34
|
+
"build:test": "tsc --build tsconfig.test.json",
|
|
35
|
+
"clean": "rimraf lib && rimraf tsconfig.tsbuildinfo",
|
|
36
|
+
"test": "jest",
|
|
37
|
+
"test:cov": "jest --collect-coverage",
|
|
38
|
+
"test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand",
|
|
39
|
+
"test:debug:watch": "node --inspect-brk node_modules/.bin/jest --runInBand --watch",
|
|
40
|
+
"watch": "tsc -b --watch"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@jupyterlab/apputils": "^4.0.0-alpha.6",
|
|
44
|
+
"@jupyterlab/cells": "^4.0.0-alpha.6",
|
|
45
|
+
"@jupyterlab/docregistry": "^4.0.0-alpha.6",
|
|
46
|
+
"@jupyterlab/notebook": "^4.0.0-alpha.6",
|
|
47
|
+
"@jupyterlab/observables": "^5.0.0-alpha.6",
|
|
48
|
+
"@jupyterlab/settingregistry": "^4.0.0-alpha.6",
|
|
49
|
+
"@jupyterlab/ui-components": "^4.0.0-alpha.21",
|
|
50
|
+
"@lumino/algorithm": "^1.9.1",
|
|
51
|
+
"@lumino/commands": "^1.20.0",
|
|
52
|
+
"@lumino/disposable": "^1.10.1",
|
|
53
|
+
"@lumino/widgets": "^1.31.1",
|
|
54
|
+
"react": "^17.0.1"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@jupyterlab/testutils": "^4.0.0-alpha.6",
|
|
58
|
+
"@types/jest": "^26.0.10",
|
|
59
|
+
"jest": "^26.4.2",
|
|
60
|
+
"rimraf": "~3.0.0",
|
|
61
|
+
"ts-jest": "^26.3.0",
|
|
62
|
+
"typescript": "~4.5.2"
|
|
63
|
+
},
|
|
64
|
+
"publishConfig": {
|
|
65
|
+
"access": "public"
|
|
66
|
+
},
|
|
67
|
+
"styleModule": "style/index.js"
|
|
68
|
+
}
|
package/style/base.css
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
.jp-cell-button .jp-icon3[fill] {
|
|
2
|
+
fill: var(--jp-inverse-layout-color4);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.jp-cell-button:hover .jp-icon3[fill] {
|
|
6
|
+
fill: var(--jp-inverse-layout-color2);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.jp-toolbar-overlap .jp-cell-toolbar {
|
|
10
|
+
display: none;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.jp-cell-toolbar {
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: row;
|
|
16
|
+
padding: 2px 0;
|
|
17
|
+
min-height: 25px;
|
|
18
|
+
z-index: 10;
|
|
19
|
+
position: absolute;
|
|
20
|
+
top: 5px;
|
|
21
|
+
right: 8px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/* Overrides for mobile view: Move cell toolbar up, don't hide it if it overlaps */
|
|
25
|
+
@media only screen and (max-width: 760px) {
|
|
26
|
+
.jp-toolbar-overlap .jp-cell-toolbar {
|
|
27
|
+
display: block;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.jp-cell-toolbar {
|
|
31
|
+
top: -5px;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.jp-cell-menu {
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: row;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.jp-cell-menu button.jp-ToolbarButtonComponent {
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.jp-cell-menu .jp-ToolbarButton button {
|
|
45
|
+
display: none;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.jp-cell-menu .jp-ToolbarButton .jp-cell-all,
|
|
49
|
+
.jp-CodeCell .jp-ToolbarButton .jp-cell-code,
|
|
50
|
+
.jp-MarkdownCell .jp-ToolbarButton .jp-cell-markdown,
|
|
51
|
+
.jp-RawCell .jp-ToolbarButton .jp-cell-raw {
|
|
52
|
+
display: block;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.jp-cell-toolbar .jp-Toolbar-spacer {
|
|
56
|
+
flex: 1 1 auto;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.jp-cell-mod-click {
|
|
60
|
+
cursor: pointer;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* Custom styling for rendered markdown cells so that cell toolbar is visible */
|
|
64
|
+
.jp-MarkdownOutput {
|
|
65
|
+
border-width: var(--jp-border-width);
|
|
66
|
+
border-color: transparent;
|
|
67
|
+
border-style: solid;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.jp-mod-active .jp-MarkdownOutput {
|
|
71
|
+
border-color: var(--jp-cell-editor-border-color);
|
|
72
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g clip-path="url(#clip0_137_19492)">
|
|
3
|
+
<path class="jp-icon3" d="M4.75 4.93066H6.625V6.80566C6.625 7.01191 6.79375 7.18066 7 7.18066C7.20625 7.18066 7.375 7.01191 7.375 6.80566V4.93066H9.25C9.45625 4.93066 9.625 4.76191 9.625 4.55566C9.625 4.34941 9.45625 4.18066 9.25 4.18066H7.375V2.30566C7.375 2.09941 7.20625 1.93066 7 1.93066C6.79375 1.93066 6.625 2.09941 6.625 2.30566V4.18066H4.75C4.54375 4.18066 4.375 4.34941 4.375 4.55566C4.375 4.76191 4.54375 4.93066 4.75 4.93066Z" fill="#616161" stroke="#616161" stroke-width="0.7"/>
|
|
4
|
+
</g>
|
|
5
|
+
<path class="jp-icon3" fill-rule="evenodd" clip-rule="evenodd" d="M11.5 9.5V11.5L2.5 11.5V9.5L11.5 9.5ZM12 8C12.5523 8 13 8.44772 13 9V12C13 12.5523 12.5523 13 12 13L2 13C1.44772 13 1 12.5523 1 12V9C1 8.44772 1.44771 8 2 8L12 8Z" fill="#616161"/>
|
|
6
|
+
<defs>
|
|
7
|
+
<clipPath id="clip0_137_19492">
|
|
8
|
+
<rect class="jp-icon3" width="6" height="6" fill="white" transform="matrix(-1 0 0 1 10 1.55566)"/>
|
|
9
|
+
</clipPath>
|
|
10
|
+
</defs>
|
|
11
|
+
</svg>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g clip-path="url(#clip0_137_19498)">
|
|
3
|
+
<path class="jp-icon3" d="M9.25 10.0693L7.375 10.0693L7.375 8.19434C7.375 7.98809 7.20625 7.81934 7 7.81934C6.79375 7.81934 6.625 7.98809 6.625 8.19434L6.625 10.0693L4.75 10.0693C4.54375 10.0693 4.375 10.2381 4.375 10.4443C4.375 10.6506 4.54375 10.8193 4.75 10.8193L6.625 10.8193L6.625 12.6943C6.625 12.9006 6.79375 13.0693 7 13.0693C7.20625 13.0693 7.375 12.9006 7.375 12.6943L7.375 10.8193L9.25 10.8193C9.45625 10.8193 9.625 10.6506 9.625 10.4443C9.625 10.2381 9.45625 10.0693 9.25 10.0693Z" fill="#616161" stroke="#616161" stroke-width="0.7"/>
|
|
4
|
+
</g>
|
|
5
|
+
<path class="jp-icon3" fill-rule="evenodd" clip-rule="evenodd" d="M2.5 5.5L2.5 3.5L11.5 3.5L11.5 5.5L2.5 5.5ZM2 7C1.44772 7 1 6.55228 1 6L1 3C1 2.44772 1.44772 2 2 2L12 2C12.5523 2 13 2.44772 13 3L13 6C13 6.55229 12.5523 7 12 7L2 7Z" fill="#616161"/>
|
|
6
|
+
<defs>
|
|
7
|
+
<clipPath id="clip0_137_19498">
|
|
8
|
+
<rect class="jp-icon3" width="6" height="6" fill="white" transform="matrix(1 1.74846e-07 1.74846e-07 -1 4 13.4443)"/>
|
|
9
|
+
</clipPath>
|
|
10
|
+
</defs>
|
|
11
|
+
</svg>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path class="jp-icon3" fill-rule="evenodd" clip-rule="evenodd" d="M2.79998 0.875H8.89582C9.20061 0.875 9.44998 1.13914 9.44998 1.46198C9.44998 1.78482 9.20061 2.04896 8.89582 2.04896H3.35415C3.04936 2.04896 2.79998 2.3131 2.79998 2.63594V9.67969C2.79998 10.0025 2.55061 10.2667 2.24582 10.2667C1.94103 10.2667 1.69165 10.0025 1.69165 9.67969V2.04896C1.69165 1.40328 2.1904 0.875 2.79998 0.875ZM5.36665 11.9V4.55H11.0833V11.9H5.36665ZM4.14165 4.14167C4.14165 3.69063 4.50728 3.325 4.95832 3.325H11.4917C11.9427 3.325 12.3083 3.69063 12.3083 4.14167V12.3083C12.3083 12.7594 11.9427 13.125 11.4917 13.125H4.95832C4.50728 13.125 4.14165 12.7594 4.14165 12.3083V4.14167Z" fill="#616161"/>
|
|
3
|
+
<path class="jp-icon3" d="M9.43574 8.26507H8.36431V9.3365C8.36431 9.45435 8.26788 9.55078 8.15002 9.55078C8.03217 9.55078 7.93574 9.45435 7.93574 9.3365V8.26507H6.86431C6.74645 8.26507 6.65002 8.16864 6.65002 8.05078C6.65002 7.93292 6.74645 7.8365 6.86431 7.8365H7.93574V6.76507C7.93574 6.64721 8.03217 6.55078 8.15002 6.55078C8.26788 6.55078 8.36431 6.64721 8.36431 6.76507V7.8365H9.43574C9.5536 7.8365 9.65002 7.93292 9.65002 8.05078C9.65002 8.16864 9.5536 8.26507 9.43574 8.26507Z" fill="#616161" stroke="#616161" stroke-width="0.5"/>
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path class="jp-icon3" d="M12.471 7.52899C12.7632 7.23684 12.7632 6.76316 12.471 6.47101V6.47101C12.179 6.17905 11.7057 6.17884 11.4135 6.47054L7.75 10.1275V1.75C7.75 1.33579 7.41421 1 7 1V1C6.58579 1 6.25 1.33579 6.25 1.75V10.1275L2.59726 6.46822C2.30338 6.17381 1.82641 6.17359 1.53226 6.46774V6.46774C1.2383 6.7617 1.2383 7.2383 1.53226 7.53226L6.29289 12.2929C6.68342 12.6834 7.31658 12.6834 7.70711 12.2929L12.471 7.52899Z" fill="#616161"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path class="jp-icon3" d="M1.52899 6.47101C1.23684 6.76316 1.23684 7.23684 1.52899 7.52899V7.52899C1.82095 7.82095 2.29426 7.82116 2.58649 7.52946L6.25 3.8725V12.25C6.25 12.6642 6.58579 13 7 13V13C7.41421 13 7.75 12.6642 7.75 12.25V3.8725L11.4027 7.53178C11.6966 7.82619 12.1736 7.82641 12.4677 7.53226V7.53226C12.7617 7.2383 12.7617 6.7617 12.4677 6.46774L7.70711 1.70711C7.31658 1.31658 6.68342 1.31658 6.29289 1.70711L1.52899 6.47101Z" fill="#616161"/>
|
|
3
|
+
</svg>
|
package/style/index.css
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*-----------------------------------------------------------------------------
|
|
2
|
+
| Copyright (c) Jupyter Development Team.
|
|
3
|
+
| Distributed under the terms of the Modified BSD License.
|
|
4
|
+
|----------------------------------------------------------------------------*/
|
|
5
|
+
|
|
6
|
+
/* This file was auto-generated by ensurePackage() in @jupyterlab/buildutils */
|
|
7
|
+
@import url('~@lumino/widgets/style/index.css');
|
|
8
|
+
@import url('~@jupyterlab/ui-components/style/index.css');
|
|
9
|
+
@import url('~@jupyterlab/apputils/style/index.css');
|
|
10
|
+
@import url('~@jupyterlab/docregistry/style/index.css');
|
|
11
|
+
@import url('~@jupyterlab/cells/style/index.css');
|
|
12
|
+
@import url('~@jupyterlab/notebook/style/index.css');
|
|
13
|
+
|
|
14
|
+
@import url('./base.css');
|
package/style/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*-----------------------------------------------------------------------------
|
|
2
|
+
| Copyright (c) Jupyter Development Team.
|
|
3
|
+
| Distributed under the terms of the Modified BSD License.
|
|
4
|
+
|----------------------------------------------------------------------------*/
|
|
5
|
+
|
|
6
|
+
/* This file was auto-generated by ensurePackage() in @jupyterlab/buildutils */
|
|
7
|
+
import '@lumino/widgets/style/index.js';
|
|
8
|
+
import '@jupyterlab/ui-components/style/index.js';
|
|
9
|
+
import '@jupyterlab/apputils/style/index.js';
|
|
10
|
+
import '@jupyterlab/docregistry/style/index.js';
|
|
11
|
+
import '@jupyterlab/cells/style/index.js';
|
|
12
|
+
import '@jupyterlab/notebook/style/index.js';
|
|
13
|
+
|
|
14
|
+
import './base.css';
|