@jupyterlab/apputils 0.19.1-alpha.0 → 0.19.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/LICENSE +34 -0
- package/lib/clientsession.d.ts +443 -443
- package/lib/clientsession.js +883 -883
- package/lib/clipboard.d.ts +33 -33
- package/lib/clipboard.js +88 -88
- package/lib/commandlinker.d.ts +121 -121
- package/lib/commandlinker.js +175 -175
- package/lib/commandpalette.d.ts +33 -33
- package/lib/commandpalette.js +12 -12
- package/lib/dialog.d.ts +357 -357
- package/lib/dialog.js +540 -540
- package/lib/domutils.d.ts +13 -13
- package/lib/domutils.js +28 -28
- package/lib/hoverbox.d.ts +82 -82
- package/lib/hoverbox.js +101 -101
- package/lib/iframe.d.ts +14 -14
- package/lib/iframe.js +45 -45
- package/lib/index.d.ts +19 -19
- package/lib/index.js +26 -26
- package/lib/instancetracker.d.ts +278 -278
- package/lib/instancetracker.js +318 -318
- package/lib/mainareawidget.d.ts +108 -108
- package/lib/mainareawidget.js +184 -184
- package/lib/sanitizer.d.ts +44 -44
- package/lib/sanitizer.js +913 -913
- package/lib/spinner.d.ts +15 -15
- package/lib/spinner.js +30 -30
- package/lib/splash.d.ts +19 -19
- package/lib/splash.js +10 -10
- package/lib/styling.d.ts +27 -27
- package/lib/styling.js +92 -92
- package/lib/thememanager.d.ts +141 -141
- package/lib/thememanager.js +238 -238
- package/lib/toolbar.d.ts +178 -178
- package/lib/toolbar.js +515 -515
- package/lib/vdom.d.ts +90 -90
- package/lib/vdom.js +130 -130
- package/lib/windowresolver.d.ts +37 -37
- package/lib/windowresolver.js +173 -173
- package/package.json +9 -6
package/lib/domutils.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The namespace for DOM utilities.
|
|
3
|
-
*/
|
|
4
|
-
export declare namespace DOMUtils {
|
|
5
|
-
/**
|
|
6
|
-
* Get the index of the node at a client position, or `-1`.
|
|
7
|
-
*/
|
|
8
|
-
function hitTestNodes(nodes: HTMLElement[] | HTMLCollection, x: number, y: number): number;
|
|
9
|
-
/**
|
|
10
|
-
* Find the first element matching a class name.
|
|
11
|
-
*/
|
|
12
|
-
function findElement(parent: HTMLElement, className: string): HTMLElement;
|
|
13
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* The namespace for DOM utilities.
|
|
3
|
+
*/
|
|
4
|
+
export declare namespace DOMUtils {
|
|
5
|
+
/**
|
|
6
|
+
* Get the index of the node at a client position, or `-1`.
|
|
7
|
+
*/
|
|
8
|
+
function hitTestNodes(nodes: HTMLElement[] | HTMLCollection, x: number, y: number): number;
|
|
9
|
+
/**
|
|
10
|
+
* Find the first element matching a class name.
|
|
11
|
+
*/
|
|
12
|
+
function findElement(parent: HTMLElement, className: string): HTMLElement;
|
|
13
|
+
}
|
package/lib/domutils.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright (c) Jupyter Development Team.
|
|
3
|
-
// Distributed under the terms of the Modified BSD License.
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
const algorithm_1 = require("@phosphor/algorithm");
|
|
6
|
-
const domutils_1 = require("@phosphor/domutils");
|
|
7
|
-
/**
|
|
8
|
-
* The namespace for DOM utilities.
|
|
9
|
-
*/
|
|
10
|
-
var DOMUtils;
|
|
11
|
-
(function (DOMUtils) {
|
|
12
|
-
/**
|
|
13
|
-
* Get the index of the node at a client position, or `-1`.
|
|
14
|
-
*/
|
|
15
|
-
function hitTestNodes(nodes, x, y) {
|
|
16
|
-
return algorithm_1.ArrayExt.findFirstIndex(nodes, node => {
|
|
17
|
-
return domutils_1.ElementExt.hitTest(node, x, y);
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
DOMUtils.hitTestNodes = hitTestNodes;
|
|
21
|
-
/**
|
|
22
|
-
* Find the first element matching a class name.
|
|
23
|
-
*/
|
|
24
|
-
function findElement(parent, className) {
|
|
25
|
-
return parent.querySelector(`.${className}`);
|
|
26
|
-
}
|
|
27
|
-
DOMUtils.findElement = findElement;
|
|
28
|
-
})(DOMUtils = exports.DOMUtils || (exports.DOMUtils = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) Jupyter Development Team.
|
|
3
|
+
// Distributed under the terms of the Modified BSD License.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
const algorithm_1 = require("@phosphor/algorithm");
|
|
6
|
+
const domutils_1 = require("@phosphor/domutils");
|
|
7
|
+
/**
|
|
8
|
+
* The namespace for DOM utilities.
|
|
9
|
+
*/
|
|
10
|
+
var DOMUtils;
|
|
11
|
+
(function (DOMUtils) {
|
|
12
|
+
/**
|
|
13
|
+
* Get the index of the node at a client position, or `-1`.
|
|
14
|
+
*/
|
|
15
|
+
function hitTestNodes(nodes, x, y) {
|
|
16
|
+
return algorithm_1.ArrayExt.findFirstIndex(nodes, node => {
|
|
17
|
+
return domutils_1.ElementExt.hitTest(node, x, y);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
DOMUtils.hitTestNodes = hitTestNodes;
|
|
21
|
+
/**
|
|
22
|
+
* Find the first element matching a class name.
|
|
23
|
+
*/
|
|
24
|
+
function findElement(parent, className) {
|
|
25
|
+
return parent.querySelector(`.${className}`);
|
|
26
|
+
}
|
|
27
|
+
DOMUtils.findElement = findElement;
|
|
28
|
+
})(DOMUtils = exports.DOMUtils || (exports.DOMUtils = {}));
|
package/lib/hoverbox.d.ts
CHANGED
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A namespace for `HoverBox` members.
|
|
3
|
-
*/
|
|
4
|
-
export declare namespace HoverBox {
|
|
5
|
-
/**
|
|
6
|
-
* Options for setting the geometry of a hovering node and its anchor node.
|
|
7
|
-
*/
|
|
8
|
-
interface IOptions {
|
|
9
|
-
/**
|
|
10
|
-
* The referent anchor rectangle to which the hover box is bound.
|
|
11
|
-
*
|
|
12
|
-
* #### Notes
|
|
13
|
-
* In an editor context, this value will typically be the cursor's
|
|
14
|
-
* coordinate position, which can be retrieved via calling the
|
|
15
|
-
* `getCoordinateForPosition` method.
|
|
16
|
-
*/
|
|
17
|
-
anchor: ClientRect;
|
|
18
|
-
/**
|
|
19
|
-
* The node that hosts the anchor.
|
|
20
|
-
*
|
|
21
|
-
* #### Notes
|
|
22
|
-
* The visibility of the anchor rectangle within this host node is the
|
|
23
|
-
* heuristic that determines whether the hover box ought to be visible.
|
|
24
|
-
*/
|
|
25
|
-
host: HTMLElement;
|
|
26
|
-
/**
|
|
27
|
-
* The maximum height of a hover box.
|
|
28
|
-
*
|
|
29
|
-
* #### Notes
|
|
30
|
-
* This value is only used if a CSS max-height attribute is not set for the
|
|
31
|
-
* hover box. It is a fallback value.
|
|
32
|
-
*/
|
|
33
|
-
maxHeight: number;
|
|
34
|
-
/**
|
|
35
|
-
* The minimum height of a hover box.
|
|
36
|
-
*/
|
|
37
|
-
minHeight: number;
|
|
38
|
-
/**
|
|
39
|
-
* The hover box node.
|
|
40
|
-
*/
|
|
41
|
-
node: HTMLElement;
|
|
42
|
-
/**
|
|
43
|
-
* Optional pixel offset values added to where the hover box should render.
|
|
44
|
-
*
|
|
45
|
-
* #### Notes
|
|
46
|
-
* This option is useful for passing in values that may pertain to CSS
|
|
47
|
-
* borders or padding in cases where the text inside the hover box may need
|
|
48
|
-
* to align with the text of the referent editor.
|
|
49
|
-
*
|
|
50
|
-
* Because the hover box calculation may render a box either above or below
|
|
51
|
-
* the cursor, the `vertical` offset accepts `above` and `below` values for
|
|
52
|
-
* the different render modes.
|
|
53
|
-
*/
|
|
54
|
-
offset?: {
|
|
55
|
-
horizontal?: number;
|
|
56
|
-
vertical?: {
|
|
57
|
-
above?: number;
|
|
58
|
-
below?: number;
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* If space is available both above and below the anchor, denote which
|
|
63
|
-
* location is privileged. Use forceBelow and forceAbove to mandate where
|
|
64
|
-
* hover box should render relative to anchor.
|
|
65
|
-
*
|
|
66
|
-
* #### Notes
|
|
67
|
-
* The default value is `'below'`.
|
|
68
|
-
*/
|
|
69
|
-
privilege?: 'above' | 'below' | 'forceAbove' | 'forceBelow';
|
|
70
|
-
/**
|
|
71
|
-
* If the style of the node has already been computed, it can be passed into
|
|
72
|
-
* the hover box for geometry calculation.
|
|
73
|
-
*/
|
|
74
|
-
style?: CSSStyleDeclaration;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Set the visible dimensions of a hovering box anchored to an editor cursor.
|
|
78
|
-
*
|
|
79
|
-
* @param options - The hover box geometry calculation options.
|
|
80
|
-
*/
|
|
81
|
-
function setGeometry(options: IOptions): void;
|
|
82
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* A namespace for `HoverBox` members.
|
|
3
|
+
*/
|
|
4
|
+
export declare namespace HoverBox {
|
|
5
|
+
/**
|
|
6
|
+
* Options for setting the geometry of a hovering node and its anchor node.
|
|
7
|
+
*/
|
|
8
|
+
interface IOptions {
|
|
9
|
+
/**
|
|
10
|
+
* The referent anchor rectangle to which the hover box is bound.
|
|
11
|
+
*
|
|
12
|
+
* #### Notes
|
|
13
|
+
* In an editor context, this value will typically be the cursor's
|
|
14
|
+
* coordinate position, which can be retrieved via calling the
|
|
15
|
+
* `getCoordinateForPosition` method.
|
|
16
|
+
*/
|
|
17
|
+
anchor: ClientRect;
|
|
18
|
+
/**
|
|
19
|
+
* The node that hosts the anchor.
|
|
20
|
+
*
|
|
21
|
+
* #### Notes
|
|
22
|
+
* The visibility of the anchor rectangle within this host node is the
|
|
23
|
+
* heuristic that determines whether the hover box ought to be visible.
|
|
24
|
+
*/
|
|
25
|
+
host: HTMLElement;
|
|
26
|
+
/**
|
|
27
|
+
* The maximum height of a hover box.
|
|
28
|
+
*
|
|
29
|
+
* #### Notes
|
|
30
|
+
* This value is only used if a CSS max-height attribute is not set for the
|
|
31
|
+
* hover box. It is a fallback value.
|
|
32
|
+
*/
|
|
33
|
+
maxHeight: number;
|
|
34
|
+
/**
|
|
35
|
+
* The minimum height of a hover box.
|
|
36
|
+
*/
|
|
37
|
+
minHeight: number;
|
|
38
|
+
/**
|
|
39
|
+
* The hover box node.
|
|
40
|
+
*/
|
|
41
|
+
node: HTMLElement;
|
|
42
|
+
/**
|
|
43
|
+
* Optional pixel offset values added to where the hover box should render.
|
|
44
|
+
*
|
|
45
|
+
* #### Notes
|
|
46
|
+
* This option is useful for passing in values that may pertain to CSS
|
|
47
|
+
* borders or padding in cases where the text inside the hover box may need
|
|
48
|
+
* to align with the text of the referent editor.
|
|
49
|
+
*
|
|
50
|
+
* Because the hover box calculation may render a box either above or below
|
|
51
|
+
* the cursor, the `vertical` offset accepts `above` and `below` values for
|
|
52
|
+
* the different render modes.
|
|
53
|
+
*/
|
|
54
|
+
offset?: {
|
|
55
|
+
horizontal?: number;
|
|
56
|
+
vertical?: {
|
|
57
|
+
above?: number;
|
|
58
|
+
below?: number;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* If space is available both above and below the anchor, denote which
|
|
63
|
+
* location is privileged. Use forceBelow and forceAbove to mandate where
|
|
64
|
+
* hover box should render relative to anchor.
|
|
65
|
+
*
|
|
66
|
+
* #### Notes
|
|
67
|
+
* The default value is `'below'`.
|
|
68
|
+
*/
|
|
69
|
+
privilege?: 'above' | 'below' | 'forceAbove' | 'forceBelow';
|
|
70
|
+
/**
|
|
71
|
+
* If the style of the node has already been computed, it can be passed into
|
|
72
|
+
* the hover box for geometry calculation.
|
|
73
|
+
*/
|
|
74
|
+
style?: CSSStyleDeclaration;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Set the visible dimensions of a hovering box anchored to an editor cursor.
|
|
78
|
+
*
|
|
79
|
+
* @param options - The hover box geometry calculation options.
|
|
80
|
+
*/
|
|
81
|
+
function setGeometry(options: IOptions): void;
|
|
82
|
+
}
|
package/lib/hoverbox.js
CHANGED
|
@@ -1,101 +1,101 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright (c) Jupyter Development Team.
|
|
3
|
-
// Distributed under the terms of the Modified BSD License.
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
/**
|
|
6
|
-
* The class name added to all hover boxes.
|
|
7
|
-
*/
|
|
8
|
-
const HOVERBOX_CLASS = 'jp-HoverBox';
|
|
9
|
-
/**
|
|
10
|
-
* The class name added to a hovering node that is scrolled out of view.
|
|
11
|
-
*/
|
|
12
|
-
const OUTOFVIEW_CLASS = 'jp-mod-outofview';
|
|
13
|
-
/**
|
|
14
|
-
* A namespace for `HoverBox` members.
|
|
15
|
-
*/
|
|
16
|
-
var HoverBox;
|
|
17
|
-
(function (HoverBox) {
|
|
18
|
-
/**
|
|
19
|
-
* Set the visible dimensions of a hovering box anchored to an editor cursor.
|
|
20
|
-
*
|
|
21
|
-
* @param options - The hover box geometry calculation options.
|
|
22
|
-
*/
|
|
23
|
-
function setGeometry(options) {
|
|
24
|
-
const { anchor, host, node, privilege } = options;
|
|
25
|
-
// Add hover box class if it does not exist.
|
|
26
|
-
node.classList.add(HOVERBOX_CLASS);
|
|
27
|
-
// Hide the hover box before querying the DOM for the anchor coordinates.
|
|
28
|
-
node.classList.add(OUTOFVIEW_CLASS);
|
|
29
|
-
// If the current coordinates are not visible, bail.
|
|
30
|
-
if (!host.contains(document.elementFromPoint(anchor.left, anchor.top))) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
// Clear any previously set max-height.
|
|
34
|
-
node.style.maxHeight = '';
|
|
35
|
-
// Clear any programmatically set margin-top.
|
|
36
|
-
node.style.marginTop = '';
|
|
37
|
-
// Make sure the node is visible so that its dimensions can be queried.
|
|
38
|
-
node.classList.remove(OUTOFVIEW_CLASS);
|
|
39
|
-
const style = options.style || window.getComputedStyle(node);
|
|
40
|
-
const innerHeight = window.innerHeight;
|
|
41
|
-
const spaceAbove = anchor.top;
|
|
42
|
-
const spaceBelow = innerHeight - anchor.bottom;
|
|
43
|
-
const marginTop = parseInt(style.marginTop, 10) || 0;
|
|
44
|
-
const minHeight = parseInt(style.minHeight, 10) || options.minHeight;
|
|
45
|
-
let maxHeight = parseInt(style.maxHeight, 10) || options.maxHeight;
|
|
46
|
-
// Determine whether to render above or below; check privilege.
|
|
47
|
-
const renderBelow = privilege === 'forceAbove'
|
|
48
|
-
? false
|
|
49
|
-
: privilege === 'forceBelow'
|
|
50
|
-
? true
|
|
51
|
-
: privilege === 'above'
|
|
52
|
-
? spaceAbove < maxHeight && spaceAbove < spaceBelow
|
|
53
|
-
: spaceBelow >= maxHeight || spaceBelow >= spaceAbove;
|
|
54
|
-
if (renderBelow) {
|
|
55
|
-
maxHeight = Math.min(spaceBelow - marginTop, maxHeight);
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
maxHeight = Math.min(spaceAbove, maxHeight);
|
|
59
|
-
// If the box renders above the text, its top margin is irrelevant.
|
|
60
|
-
node.style.marginTop = '0px';
|
|
61
|
-
}
|
|
62
|
-
node.style.maxHeight = `${maxHeight}px`;
|
|
63
|
-
// Make sure the box ought to be visible.
|
|
64
|
-
const withinBounds = maxHeight > minHeight &&
|
|
65
|
-
(spaceBelow >= minHeight || spaceAbove >= minHeight);
|
|
66
|
-
if (!withinBounds) {
|
|
67
|
-
node.classList.add(OUTOFVIEW_CLASS);
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
// Position the box vertically.
|
|
71
|
-
const offsetAbove = (options.offset &&
|
|
72
|
-
options.offset.vertical &&
|
|
73
|
-
options.offset.vertical.above) ||
|
|
74
|
-
0;
|
|
75
|
-
const offsetBelow = (options.offset &&
|
|
76
|
-
options.offset.vertical &&
|
|
77
|
-
options.offset.vertical.below) ||
|
|
78
|
-
0;
|
|
79
|
-
const top = renderBelow
|
|
80
|
-
? innerHeight - spaceBelow + offsetBelow
|
|
81
|
-
: spaceAbove - node.getBoundingClientRect().height + offsetAbove;
|
|
82
|
-
node.style.top = `${Math.floor(top)}px`;
|
|
83
|
-
// Position the box horizontally.
|
|
84
|
-
const offsetHorizontal = (options.offset && options.offset.horizontal) || 0;
|
|
85
|
-
let left = anchor.left + offsetHorizontal;
|
|
86
|
-
node.style.left = `${Math.ceil(left)}px`;
|
|
87
|
-
node.style.width = 'auto';
|
|
88
|
-
// Expand the menu width by the scrollbar size, if present.
|
|
89
|
-
if (node.scrollHeight >= maxHeight) {
|
|
90
|
-
node.style.width = `${2 * node.offsetWidth - node.clientWidth}`;
|
|
91
|
-
node.scrollTop = 0;
|
|
92
|
-
}
|
|
93
|
-
// Move left to fit in the window.
|
|
94
|
-
let right = node.getBoundingClientRect().right;
|
|
95
|
-
if (right > window.innerWidth) {
|
|
96
|
-
left -= right - window.innerWidth;
|
|
97
|
-
node.style.left = `${Math.ceil(left)}px`;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
HoverBox.setGeometry = setGeometry;
|
|
101
|
-
})(HoverBox = exports.HoverBox || (exports.HoverBox = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) Jupyter Development Team.
|
|
3
|
+
// Distributed under the terms of the Modified BSD License.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
/**
|
|
6
|
+
* The class name added to all hover boxes.
|
|
7
|
+
*/
|
|
8
|
+
const HOVERBOX_CLASS = 'jp-HoverBox';
|
|
9
|
+
/**
|
|
10
|
+
* The class name added to a hovering node that is scrolled out of view.
|
|
11
|
+
*/
|
|
12
|
+
const OUTOFVIEW_CLASS = 'jp-mod-outofview';
|
|
13
|
+
/**
|
|
14
|
+
* A namespace for `HoverBox` members.
|
|
15
|
+
*/
|
|
16
|
+
var HoverBox;
|
|
17
|
+
(function (HoverBox) {
|
|
18
|
+
/**
|
|
19
|
+
* Set the visible dimensions of a hovering box anchored to an editor cursor.
|
|
20
|
+
*
|
|
21
|
+
* @param options - The hover box geometry calculation options.
|
|
22
|
+
*/
|
|
23
|
+
function setGeometry(options) {
|
|
24
|
+
const { anchor, host, node, privilege } = options;
|
|
25
|
+
// Add hover box class if it does not exist.
|
|
26
|
+
node.classList.add(HOVERBOX_CLASS);
|
|
27
|
+
// Hide the hover box before querying the DOM for the anchor coordinates.
|
|
28
|
+
node.classList.add(OUTOFVIEW_CLASS);
|
|
29
|
+
// If the current coordinates are not visible, bail.
|
|
30
|
+
if (!host.contains(document.elementFromPoint(anchor.left, anchor.top))) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
// Clear any previously set max-height.
|
|
34
|
+
node.style.maxHeight = '';
|
|
35
|
+
// Clear any programmatically set margin-top.
|
|
36
|
+
node.style.marginTop = '';
|
|
37
|
+
// Make sure the node is visible so that its dimensions can be queried.
|
|
38
|
+
node.classList.remove(OUTOFVIEW_CLASS);
|
|
39
|
+
const style = options.style || window.getComputedStyle(node);
|
|
40
|
+
const innerHeight = window.innerHeight;
|
|
41
|
+
const spaceAbove = anchor.top;
|
|
42
|
+
const spaceBelow = innerHeight - anchor.bottom;
|
|
43
|
+
const marginTop = parseInt(style.marginTop, 10) || 0;
|
|
44
|
+
const minHeight = parseInt(style.minHeight, 10) || options.minHeight;
|
|
45
|
+
let maxHeight = parseInt(style.maxHeight, 10) || options.maxHeight;
|
|
46
|
+
// Determine whether to render above or below; check privilege.
|
|
47
|
+
const renderBelow = privilege === 'forceAbove'
|
|
48
|
+
? false
|
|
49
|
+
: privilege === 'forceBelow'
|
|
50
|
+
? true
|
|
51
|
+
: privilege === 'above'
|
|
52
|
+
? spaceAbove < maxHeight && spaceAbove < spaceBelow
|
|
53
|
+
: spaceBelow >= maxHeight || spaceBelow >= spaceAbove;
|
|
54
|
+
if (renderBelow) {
|
|
55
|
+
maxHeight = Math.min(spaceBelow - marginTop, maxHeight);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
maxHeight = Math.min(spaceAbove, maxHeight);
|
|
59
|
+
// If the box renders above the text, its top margin is irrelevant.
|
|
60
|
+
node.style.marginTop = '0px';
|
|
61
|
+
}
|
|
62
|
+
node.style.maxHeight = `${maxHeight}px`;
|
|
63
|
+
// Make sure the box ought to be visible.
|
|
64
|
+
const withinBounds = maxHeight > minHeight &&
|
|
65
|
+
(spaceBelow >= minHeight || spaceAbove >= minHeight);
|
|
66
|
+
if (!withinBounds) {
|
|
67
|
+
node.classList.add(OUTOFVIEW_CLASS);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
// Position the box vertically.
|
|
71
|
+
const offsetAbove = (options.offset &&
|
|
72
|
+
options.offset.vertical &&
|
|
73
|
+
options.offset.vertical.above) ||
|
|
74
|
+
0;
|
|
75
|
+
const offsetBelow = (options.offset &&
|
|
76
|
+
options.offset.vertical &&
|
|
77
|
+
options.offset.vertical.below) ||
|
|
78
|
+
0;
|
|
79
|
+
const top = renderBelow
|
|
80
|
+
? innerHeight - spaceBelow + offsetBelow
|
|
81
|
+
: spaceAbove - node.getBoundingClientRect().height + offsetAbove;
|
|
82
|
+
node.style.top = `${Math.floor(top)}px`;
|
|
83
|
+
// Position the box horizontally.
|
|
84
|
+
const offsetHorizontal = (options.offset && options.offset.horizontal) || 0;
|
|
85
|
+
let left = anchor.left + offsetHorizontal;
|
|
86
|
+
node.style.left = `${Math.ceil(left)}px`;
|
|
87
|
+
node.style.width = 'auto';
|
|
88
|
+
// Expand the menu width by the scrollbar size, if present.
|
|
89
|
+
if (node.scrollHeight >= maxHeight) {
|
|
90
|
+
node.style.width = `${2 * node.offsetWidth - node.clientWidth}`;
|
|
91
|
+
node.scrollTop = 0;
|
|
92
|
+
}
|
|
93
|
+
// Move left to fit in the window.
|
|
94
|
+
let right = node.getBoundingClientRect().right;
|
|
95
|
+
if (right > window.innerWidth) {
|
|
96
|
+
left -= right - window.innerWidth;
|
|
97
|
+
node.style.left = `${Math.ceil(left)}px`;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
HoverBox.setGeometry = setGeometry;
|
|
101
|
+
})(HoverBox = exports.HoverBox || (exports.HoverBox = {}));
|
package/lib/iframe.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Widget } from '@phosphor/widgets';
|
|
2
|
-
/**
|
|
3
|
-
* A phosphor widget which wraps an IFrame.
|
|
4
|
-
*/
|
|
5
|
-
export declare class IFrame extends Widget {
|
|
6
|
-
/**
|
|
7
|
-
* Create a new IFrame widget.
|
|
8
|
-
*/
|
|
9
|
-
constructor();
|
|
10
|
-
/**
|
|
11
|
-
* The url of the IFrame.
|
|
12
|
-
*/
|
|
13
|
-
url: string;
|
|
14
|
-
}
|
|
1
|
+
import { Widget } from '@phosphor/widgets';
|
|
2
|
+
/**
|
|
3
|
+
* A phosphor widget which wraps an IFrame.
|
|
4
|
+
*/
|
|
5
|
+
export declare class IFrame extends Widget {
|
|
6
|
+
/**
|
|
7
|
+
* Create a new IFrame widget.
|
|
8
|
+
*/
|
|
9
|
+
constructor();
|
|
10
|
+
/**
|
|
11
|
+
* The url of the IFrame.
|
|
12
|
+
*/
|
|
13
|
+
url: string;
|
|
14
|
+
}
|
package/lib/iframe.js
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright (c) Jupyter Development Team.
|
|
3
|
-
// Distributed under the terms of the Modified BSD License.
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
const widgets_1 = require("@phosphor/widgets");
|
|
6
|
-
/**
|
|
7
|
-
* A phosphor widget which wraps an IFrame.
|
|
8
|
-
*/
|
|
9
|
-
class IFrame extends widgets_1.Widget {
|
|
10
|
-
/**
|
|
11
|
-
* Create a new IFrame widget.
|
|
12
|
-
*/
|
|
13
|
-
constructor() {
|
|
14
|
-
super({ node: Private.createNode() });
|
|
15
|
-
this.addClass('jp-IFrame');
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* The url of the IFrame.
|
|
19
|
-
*/
|
|
20
|
-
get url() {
|
|
21
|
-
return this.node.querySelector('iframe').getAttribute('src') || '';
|
|
22
|
-
}
|
|
23
|
-
set url(url) {
|
|
24
|
-
this.node.querySelector('iframe').setAttribute('src', url);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.IFrame = IFrame;
|
|
28
|
-
/**
|
|
29
|
-
* A namespace for private data.
|
|
30
|
-
*/
|
|
31
|
-
var Private;
|
|
32
|
-
(function (Private) {
|
|
33
|
-
/**
|
|
34
|
-
* Create the main content node of an iframe widget.
|
|
35
|
-
*/
|
|
36
|
-
function createNode() {
|
|
37
|
-
let node = document.createElement('div');
|
|
38
|
-
let iframe = document.createElement('iframe');
|
|
39
|
-
iframe.style.height = '100%';
|
|
40
|
-
iframe.style.width = '100%';
|
|
41
|
-
node.appendChild(iframe);
|
|
42
|
-
return node;
|
|
43
|
-
}
|
|
44
|
-
Private.createNode = createNode;
|
|
45
|
-
})(Private || (Private = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) Jupyter Development Team.
|
|
3
|
+
// Distributed under the terms of the Modified BSD License.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
const widgets_1 = require("@phosphor/widgets");
|
|
6
|
+
/**
|
|
7
|
+
* A phosphor widget which wraps an IFrame.
|
|
8
|
+
*/
|
|
9
|
+
class IFrame extends widgets_1.Widget {
|
|
10
|
+
/**
|
|
11
|
+
* Create a new IFrame widget.
|
|
12
|
+
*/
|
|
13
|
+
constructor() {
|
|
14
|
+
super({ node: Private.createNode() });
|
|
15
|
+
this.addClass('jp-IFrame');
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The url of the IFrame.
|
|
19
|
+
*/
|
|
20
|
+
get url() {
|
|
21
|
+
return this.node.querySelector('iframe').getAttribute('src') || '';
|
|
22
|
+
}
|
|
23
|
+
set url(url) {
|
|
24
|
+
this.node.querySelector('iframe').setAttribute('src', url);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.IFrame = IFrame;
|
|
28
|
+
/**
|
|
29
|
+
* A namespace for private data.
|
|
30
|
+
*/
|
|
31
|
+
var Private;
|
|
32
|
+
(function (Private) {
|
|
33
|
+
/**
|
|
34
|
+
* Create the main content node of an iframe widget.
|
|
35
|
+
*/
|
|
36
|
+
function createNode() {
|
|
37
|
+
let node = document.createElement('div');
|
|
38
|
+
let iframe = document.createElement('iframe');
|
|
39
|
+
iframe.style.height = '100%';
|
|
40
|
+
iframe.style.width = '100%';
|
|
41
|
+
node.appendChild(iframe);
|
|
42
|
+
return node;
|
|
43
|
+
}
|
|
44
|
+
Private.createNode = createNode;
|
|
45
|
+
})(Private || (Private = {}));
|
package/lib/index.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import '../style/index.css';
|
|
2
|
-
export * from './clientsession';
|
|
3
|
-
export * from './clipboard';
|
|
4
|
-
export * from './commandlinker';
|
|
5
|
-
export * from './commandpalette';
|
|
6
|
-
export * from './dialog';
|
|
7
|
-
export * from './domutils';
|
|
8
|
-
export * from './hoverbox';
|
|
9
|
-
export * from './iframe';
|
|
10
|
-
export * from './instancetracker';
|
|
11
|
-
export * from './mainareawidget';
|
|
12
|
-
export * from './sanitizer';
|
|
13
|
-
export * from './spinner';
|
|
14
|
-
export * from './splash';
|
|
15
|
-
export * from './styling';
|
|
16
|
-
export * from './thememanager';
|
|
17
|
-
export * from './toolbar';
|
|
18
|
-
export * from './vdom';
|
|
19
|
-
export * from './windowresolver';
|
|
1
|
+
import '../style/index.css';
|
|
2
|
+
export * from './clientsession';
|
|
3
|
+
export * from './clipboard';
|
|
4
|
+
export * from './commandlinker';
|
|
5
|
+
export * from './commandpalette';
|
|
6
|
+
export * from './dialog';
|
|
7
|
+
export * from './domutils';
|
|
8
|
+
export * from './hoverbox';
|
|
9
|
+
export * from './iframe';
|
|
10
|
+
export * from './instancetracker';
|
|
11
|
+
export * from './mainareawidget';
|
|
12
|
+
export * from './sanitizer';
|
|
13
|
+
export * from './spinner';
|
|
14
|
+
export * from './splash';
|
|
15
|
+
export * from './styling';
|
|
16
|
+
export * from './thememanager';
|
|
17
|
+
export * from './toolbar';
|
|
18
|
+
export * from './vdom';
|
|
19
|
+
export * from './windowresolver';
|