@jupyterlab/cells 4.0.0-beta.2 → 4.0.0-rc.1
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/resizeHandle.d.ts +17 -6
- package/lib/resizeHandle.js +36 -17
- package/lib/resizeHandle.js.map +1 -1
- package/lib/searchprovider.js +2 -2
- package/lib/searchprovider.js.map +1 -1
- package/package.json +22 -22
- package/src/resizeHandle.ts +47 -30
- package/src/searchprovider.ts +7 -3
package/lib/resizeHandle.d.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { Widget } from '@lumino/widgets';
|
|
2
1
|
import { Message } from '@lumino/messaging';
|
|
2
|
+
import { Widget } from '@lumino/widgets';
|
|
3
3
|
/**
|
|
4
4
|
* A handle that allows to change input/output proportions in side-by-side mode.
|
|
5
5
|
*/
|
|
6
6
|
export declare class ResizeHandle extends Widget {
|
|
7
7
|
protected targetNode: HTMLElement;
|
|
8
|
-
private _isActive;
|
|
9
|
-
private _isDragging;
|
|
10
|
-
private _protectedWidth;
|
|
11
8
|
constructor(targetNode: HTMLElement);
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Dispose the resizer handle.
|
|
11
|
+
*/
|
|
12
|
+
dispose(): void;
|
|
14
13
|
/**
|
|
15
14
|
* Handle the DOM events for the widget.
|
|
16
15
|
*
|
|
@@ -18,4 +17,16 @@ export declare class ResizeHandle extends Widget {
|
|
|
18
17
|
*
|
|
19
18
|
*/
|
|
20
19
|
handleEvent(event: Event): void;
|
|
20
|
+
/**
|
|
21
|
+
* Handle `after-attach` messages.
|
|
22
|
+
*/
|
|
23
|
+
protected onAfterAttach(msg: Message): void;
|
|
24
|
+
/**
|
|
25
|
+
* Handle `before-detach` messages.
|
|
26
|
+
*/
|
|
27
|
+
protected onBeforeDetach(msg: Message): void;
|
|
28
|
+
private _resize;
|
|
29
|
+
private _isActive;
|
|
30
|
+
private _isDragging;
|
|
31
|
+
private _resizer;
|
|
21
32
|
}
|
package/lib/resizeHandle.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Jupyter Development Team.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
+
import { Throttler } from '@lumino/polling';
|
|
5
6
|
import { Widget } from '@lumino/widgets';
|
|
6
7
|
const RESIZE_HANDLE_CLASS = 'jp-CellResizeHandle';
|
|
7
8
|
const CELL_RESIZED_CLASS = 'jp-mod-resizedCell';
|
|
@@ -14,18 +15,15 @@ export class ResizeHandle extends Widget {
|
|
|
14
15
|
this.targetNode = targetNode;
|
|
15
16
|
this._isActive = false;
|
|
16
17
|
this._isDragging = false;
|
|
17
|
-
this._protectedWidth = 10;
|
|
18
18
|
this.addClass(RESIZE_HANDLE_CLASS);
|
|
19
|
+
this._resizer = new Throttler(event => this._resize(event), 50);
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
super.onAfterAttach(msg);
|
|
27
|
-
this.node.removeEventListener('dblclick', this);
|
|
28
|
-
this.node.removeEventListener('mousedown', this);
|
|
21
|
+
/**
|
|
22
|
+
* Dispose the resizer handle.
|
|
23
|
+
*/
|
|
24
|
+
dispose() {
|
|
25
|
+
this._resizer.dispose();
|
|
26
|
+
super.dispose();
|
|
29
27
|
}
|
|
30
28
|
/**
|
|
31
29
|
* Handle the DOM events for the widget.
|
|
@@ -55,14 +53,9 @@ export class ResizeHandle extends Widget {
|
|
|
55
53
|
window.addEventListener('mouseup', this);
|
|
56
54
|
break;
|
|
57
55
|
case 'mousemove': {
|
|
58
|
-
if (
|
|
59
|
-
|
|
56
|
+
if (this._isActive && this._isDragging) {
|
|
57
|
+
void this._resizer.invoke(event);
|
|
60
58
|
}
|
|
61
|
-
const targetRect = this.targetNode.getBoundingClientRect();
|
|
62
|
-
const width = targetRect.width - this._protectedWidth * 2;
|
|
63
|
-
const position = event.clientX - targetRect.x - this._protectedWidth;
|
|
64
|
-
const outputRatio = width / position - 1;
|
|
65
|
-
document.documentElement.style.setProperty('--jp-side-by-side-output-size', `${outputRatio}fr`);
|
|
66
59
|
break;
|
|
67
60
|
}
|
|
68
61
|
case 'mouseup':
|
|
@@ -74,5 +67,31 @@ export class ResizeHandle extends Widget {
|
|
|
74
67
|
break;
|
|
75
68
|
}
|
|
76
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Handle `after-attach` messages.
|
|
72
|
+
*/
|
|
73
|
+
onAfterAttach(msg) {
|
|
74
|
+
this.node.addEventListener('dblclick', this);
|
|
75
|
+
this.node.addEventListener('mousedown', this);
|
|
76
|
+
super.onAfterAttach(msg);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Handle `before-detach` messages.
|
|
80
|
+
*/
|
|
81
|
+
onBeforeDetach(msg) {
|
|
82
|
+
this.node.removeEventListener('dblclick', this);
|
|
83
|
+
this.node.removeEventListener('mousedown', this);
|
|
84
|
+
super.onBeforeDetach(msg);
|
|
85
|
+
}
|
|
86
|
+
_resize(event) {
|
|
87
|
+
// Gate the output size ratio between {0.05, 50} as sensible defaults.
|
|
88
|
+
const { width, x } = this.targetNode.getBoundingClientRect();
|
|
89
|
+
const position = event.clientX - x;
|
|
90
|
+
const ratio = width / position - 1;
|
|
91
|
+
if (0 < ratio) {
|
|
92
|
+
const normalized = Math.max(Math.min(Math.abs(ratio), 50), 0.05);
|
|
93
|
+
document.documentElement.style.setProperty('--jp-side-by-side-output-size', `${normalized}fr`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
77
96
|
}
|
|
78
97
|
//# sourceMappingURL=resizeHandle.js.map
|
package/lib/resizeHandle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resizeHandle.js","sourceRoot":"","sources":["../src/resizeHandle.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":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,CAAC,mBAAmB,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QACjD,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC;IAEO,OAAO,CAAC,KAAiB;QAC/B,sEAAsE;QACtE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,qBAAqB,EAAE,CAAC;QAC7D,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC;QACnC,MAAM,KAAK,GAAG,KAAK,GAAG,QAAQ,GAAG,CAAC,CAAC;QACnC,IAAI,CAAC,GAAG,KAAK,EAAE;YACb,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;YACjE,QAAQ,CAAC,eAAe,CAAC,KAAK,CAAC,WAAW,CACxC,+BAA+B,EAC/B,GAAG,UAAU,IAAI,CAClB,CAAC;SACH;IACH,CAAC;CAKF"}
|
package/lib/searchprovider.js
CHANGED
|
@@ -92,13 +92,13 @@ class CodeCellSearchProvider extends CellSearchProvider {
|
|
|
92
92
|
*
|
|
93
93
|
* @returns The next match if there is one.
|
|
94
94
|
*/
|
|
95
|
-
async highlightNext(loop,
|
|
95
|
+
async highlightNext(loop, options) {
|
|
96
96
|
if (this.matchesCount === 0 || !this.isActive) {
|
|
97
97
|
this.currentIndex = null;
|
|
98
98
|
}
|
|
99
99
|
else {
|
|
100
100
|
if (this.currentProviderIndex === -1) {
|
|
101
|
-
const match = await super.highlightNext(true,
|
|
101
|
+
const match = await super.highlightNext(true, options);
|
|
102
102
|
if (match) {
|
|
103
103
|
this.currentIndex = this.cmHandler.currentIndex;
|
|
104
104
|
return match;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"searchprovider.js","sourceRoot":"","sources":["../src/searchprovider.ts"],"names":[],"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CAIF;AAED;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CACtC,IAAsB;IAEtB,IAAI,IAAI,CAAC,aAAa,EAAE,EAAE;QACxB,OAAO,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC;KACrC;IAED,QAAQ,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;QACvB,KAAK,MAAM;YACT,OAAO,IAAI,sBAAsB,CAAC,IAAI,CAAC,CAAC;QAC1C,KAAK,UAAU;YACb,OAAO,IAAI,0BAA0B,CAAC,IAAI,CAAC,CAAC;QAC9C;YACE,OAAO,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC;KACvC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupyterlab/cells",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-rc.1",
|
|
4
4
|
"description": "JupyterLab - Notebook Cells",
|
|
5
5
|
"homepage": "https://github.com/jupyterlab/jupyterlab",
|
|
6
6
|
"bugs": {
|
|
@@ -46,34 +46,34 @@
|
|
|
46
46
|
"@codemirror/state": "^6.2.0",
|
|
47
47
|
"@codemirror/view": "^6.9.6",
|
|
48
48
|
"@jupyter/ydoc": "^1.0.2",
|
|
49
|
-
"@jupyterlab/apputils": "^4.0.0-
|
|
50
|
-
"@jupyterlab/attachments": "^4.0.0-
|
|
51
|
-
"@jupyterlab/codeeditor": "^4.0.0-
|
|
52
|
-
"@jupyterlab/codemirror": "^4.0.0-
|
|
53
|
-
"@jupyterlab/coreutils": "^6.0.0-
|
|
54
|
-
"@jupyterlab/documentsearch": "^4.0.0-
|
|
55
|
-
"@jupyterlab/filebrowser": "^4.0.0-
|
|
56
|
-
"@jupyterlab/nbformat": "^4.0.0-
|
|
57
|
-
"@jupyterlab/observables": "^5.0.0-
|
|
58
|
-
"@jupyterlab/outputarea": "^4.0.0-
|
|
59
|
-
"@jupyterlab/rendermime": "^4.0.0-
|
|
60
|
-
"@jupyterlab/services": "^7.0.0-
|
|
61
|
-
"@jupyterlab/toc": "^6.0.0-
|
|
62
|
-
"@jupyterlab/translation": "^4.0.0-
|
|
63
|
-
"@jupyterlab/ui-components": "^4.0.0-
|
|
49
|
+
"@jupyterlab/apputils": "^4.0.0-rc.1",
|
|
50
|
+
"@jupyterlab/attachments": "^4.0.0-rc.1",
|
|
51
|
+
"@jupyterlab/codeeditor": "^4.0.0-rc.1",
|
|
52
|
+
"@jupyterlab/codemirror": "^4.0.0-rc.1",
|
|
53
|
+
"@jupyterlab/coreutils": "^6.0.0-rc.1",
|
|
54
|
+
"@jupyterlab/documentsearch": "^4.0.0-rc.1",
|
|
55
|
+
"@jupyterlab/filebrowser": "^4.0.0-rc.1",
|
|
56
|
+
"@jupyterlab/nbformat": "^4.0.0-rc.1",
|
|
57
|
+
"@jupyterlab/observables": "^5.0.0-rc.1",
|
|
58
|
+
"@jupyterlab/outputarea": "^4.0.0-rc.1",
|
|
59
|
+
"@jupyterlab/rendermime": "^4.0.0-rc.1",
|
|
60
|
+
"@jupyterlab/services": "^7.0.0-rc.1",
|
|
61
|
+
"@jupyterlab/toc": "^6.0.0-rc.1",
|
|
62
|
+
"@jupyterlab/translation": "^4.0.0-rc.1",
|
|
63
|
+
"@jupyterlab/ui-components": "^4.0.0-rc.1",
|
|
64
64
|
"@lumino/algorithm": "^2.0.0",
|
|
65
|
-
"@lumino/coreutils": "^2.1.
|
|
65
|
+
"@lumino/coreutils": "^2.1.1",
|
|
66
66
|
"@lumino/domutils": "^2.0.0",
|
|
67
|
-
"@lumino/dragdrop": "^2.1.
|
|
67
|
+
"@lumino/dragdrop": "^2.1.1",
|
|
68
68
|
"@lumino/messaging": "^2.0.0",
|
|
69
|
-
"@lumino/polling": "^2.1.
|
|
70
|
-
"@lumino/signaling": "^2.1.
|
|
69
|
+
"@lumino/polling": "^2.1.1",
|
|
70
|
+
"@lumino/signaling": "^2.1.1",
|
|
71
71
|
"@lumino/virtualdom": "^2.0.0",
|
|
72
|
-
"@lumino/widgets": "^2.1.
|
|
72
|
+
"@lumino/widgets": "^2.1.1",
|
|
73
73
|
"react": "^18.2.0"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@jupyterlab/testing": "^4.0.0-
|
|
76
|
+
"@jupyterlab/testing": "^4.0.0-rc.1",
|
|
77
77
|
"@types/jest": "^29.2.0",
|
|
78
78
|
"@types/react": "^18.0.26",
|
|
79
79
|
"jest": "^29.2.0",
|
package/src/resizeHandle.ts
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { Widget } from '@lumino/widgets';
|
|
7
6
|
import { Message } from '@lumino/messaging';
|
|
7
|
+
import { Throttler } from '@lumino/polling';
|
|
8
|
+
import { Widget } from '@lumino/widgets';
|
|
8
9
|
|
|
9
10
|
const RESIZE_HANDLE_CLASS = 'jp-CellResizeHandle';
|
|
10
11
|
|
|
@@ -14,25 +15,18 @@ const CELL_RESIZED_CLASS = 'jp-mod-resizedCell';
|
|
|
14
15
|
* A handle that allows to change input/output proportions in side-by-side mode.
|
|
15
16
|
*/
|
|
16
17
|
export class ResizeHandle extends Widget {
|
|
17
|
-
private _isActive: boolean = false;
|
|
18
|
-
private _isDragging: boolean = false;
|
|
19
|
-
private _protectedWidth = 10;
|
|
20
|
-
|
|
21
18
|
constructor(protected targetNode: HTMLElement) {
|
|
22
19
|
super();
|
|
23
20
|
this.addClass(RESIZE_HANDLE_CLASS);
|
|
21
|
+
this._resizer = new Throttler(event => this._resize(event), 50);
|
|
24
22
|
}
|
|
25
23
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
protected onAfterDetach(msg: Message) {
|
|
33
|
-
super.onAfterAttach(msg);
|
|
34
|
-
this.node.removeEventListener('dblclick', this);
|
|
35
|
-
this.node.removeEventListener('mousedown', this);
|
|
24
|
+
/**
|
|
25
|
+
* Dispose the resizer handle.
|
|
26
|
+
*/
|
|
27
|
+
dispose(): void {
|
|
28
|
+
this._resizer.dispose();
|
|
29
|
+
super.dispose();
|
|
36
30
|
}
|
|
37
31
|
|
|
38
32
|
/**
|
|
@@ -66,22 +60,9 @@ export class ResizeHandle extends Widget {
|
|
|
66
60
|
window.addEventListener('mouseup', this);
|
|
67
61
|
break;
|
|
68
62
|
case 'mousemove': {
|
|
69
|
-
if (
|
|
70
|
-
|
|
63
|
+
if (this._isActive && this._isDragging) {
|
|
64
|
+
void this._resizer.invoke(event as MouseEvent);
|
|
71
65
|
}
|
|
72
|
-
const targetRect = this.targetNode.getBoundingClientRect();
|
|
73
|
-
|
|
74
|
-
const width = targetRect.width - this._protectedWidth * 2;
|
|
75
|
-
const position =
|
|
76
|
-
(event as MouseEvent).clientX - targetRect.x - this._protectedWidth;
|
|
77
|
-
|
|
78
|
-
const outputRatio = width / position - 1;
|
|
79
|
-
|
|
80
|
-
document.documentElement.style.setProperty(
|
|
81
|
-
'--jp-side-by-side-output-size',
|
|
82
|
-
`${outputRatio}fr`
|
|
83
|
-
);
|
|
84
|
-
|
|
85
66
|
break;
|
|
86
67
|
}
|
|
87
68
|
case 'mouseup':
|
|
@@ -93,4 +74,40 @@ export class ResizeHandle extends Widget {
|
|
|
93
74
|
break;
|
|
94
75
|
}
|
|
95
76
|
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Handle `after-attach` messages.
|
|
80
|
+
*/
|
|
81
|
+
protected onAfterAttach(msg: Message) {
|
|
82
|
+
this.node.addEventListener('dblclick', this);
|
|
83
|
+
this.node.addEventListener('mousedown', this);
|
|
84
|
+
super.onAfterAttach(msg);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Handle `before-detach` messages.
|
|
89
|
+
*/
|
|
90
|
+
protected onBeforeDetach(msg: Message) {
|
|
91
|
+
this.node.removeEventListener('dblclick', this);
|
|
92
|
+
this.node.removeEventListener('mousedown', this);
|
|
93
|
+
super.onBeforeDetach(msg);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
private _resize(event: MouseEvent): void {
|
|
97
|
+
// Gate the output size ratio between {0.05, 50} as sensible defaults.
|
|
98
|
+
const { width, x } = this.targetNode.getBoundingClientRect();
|
|
99
|
+
const position = event.clientX - x;
|
|
100
|
+
const ratio = width / position - 1;
|
|
101
|
+
if (0 < ratio) {
|
|
102
|
+
const normalized = Math.max(Math.min(Math.abs(ratio), 50), 0.05);
|
|
103
|
+
document.documentElement.style.setProperty(
|
|
104
|
+
'--jp-side-by-side-output-size',
|
|
105
|
+
`${normalized}fr`
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
private _isActive = false;
|
|
111
|
+
private _isDragging = false;
|
|
112
|
+
private _resizer: Throttler<void, void, [MouseEvent]>;
|
|
96
113
|
}
|
package/src/searchprovider.ts
CHANGED
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
// Distributed under the terms of the Modified BSD License.
|
|
3
3
|
|
|
4
4
|
import { CodeEditor } from '@jupyterlab/codeeditor';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
CodeMirrorEditor,
|
|
7
|
+
EditorSearchProvider,
|
|
8
|
+
IHighlightAdjacentMatchOptions
|
|
9
|
+
} from '@jupyterlab/codemirror';
|
|
6
10
|
import { signalToPromise } from '@jupyterlab/coreutils';
|
|
7
11
|
import {
|
|
8
12
|
GenericSearchProvider,
|
|
@@ -125,13 +129,13 @@ class CodeCellSearchProvider extends CellSearchProvider {
|
|
|
125
129
|
*/
|
|
126
130
|
async highlightNext(
|
|
127
131
|
loop?: boolean,
|
|
128
|
-
|
|
132
|
+
options?: IHighlightAdjacentMatchOptions
|
|
129
133
|
): Promise<ISearchMatch | undefined> {
|
|
130
134
|
if (this.matchesCount === 0 || !this.isActive) {
|
|
131
135
|
this.currentIndex = null;
|
|
132
136
|
} else {
|
|
133
137
|
if (this.currentProviderIndex === -1) {
|
|
134
|
-
const match = await super.highlightNext(true,
|
|
138
|
+
const match = await super.highlightNext(true, options);
|
|
135
139
|
if (match) {
|
|
136
140
|
this.currentIndex = this.cmHandler.currentIndex;
|
|
137
141
|
return match;
|