@jupyterlab/apputils 4.0.0-alpha.3 → 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/hoverbox.js DELETED
@@ -1,100 +0,0 @@
1
- // Copyright (c) Jupyter Development Team.
2
- // Distributed under the terms of the Modified BSD License.
3
- /**
4
- * The class name added to all hover boxes.
5
- */
6
- const HOVERBOX_CLASS = 'jp-HoverBox';
7
- /**
8
- * The class name added to a hovering node that is scrolled out of view.
9
- */
10
- const OUTOFVIEW_CLASS = 'jp-mod-outofview';
11
- /**
12
- * A namespace for `HoverBox` members.
13
- */
14
- export var HoverBox;
15
- (function (HoverBox) {
16
- /**
17
- * Set the visible dimensions of a hovering box anchored to an editor cursor.
18
- *
19
- * @param options - The hover box geometry calculation options.
20
- */
21
- function setGeometry(options) {
22
- const { anchor, host, node, privilege } = options;
23
- // Add hover box class if it does not exist.
24
- node.classList.add(HOVERBOX_CLASS);
25
- // Hide the hover box before querying the DOM for the anchor coordinates.
26
- node.classList.add(OUTOFVIEW_CLASS);
27
- // If the current coordinates are not visible, bail.
28
- if (!host.contains(document.elementFromPoint(anchor.left, anchor.top))) {
29
- return;
30
- }
31
- // Clear any previously set max-height.
32
- node.style.maxHeight = '';
33
- // Clear any programmatically set margin-top.
34
- node.style.marginTop = '';
35
- // Make sure the node is visible so that its dimensions can be queried.
36
- node.classList.remove(OUTOFVIEW_CLASS);
37
- const style = options.style || window.getComputedStyle(node);
38
- const innerHeight = window.innerHeight;
39
- const spaceAbove = anchor.top;
40
- const spaceBelow = innerHeight - anchor.bottom;
41
- const marginTop = parseInt(style.marginTop, 10) || 0;
42
- const minHeight = parseInt(style.minHeight, 10) || options.minHeight;
43
- let maxHeight = parseInt(style.maxHeight, 10) || options.maxHeight;
44
- // Determine whether to render above or below; check privilege.
45
- const renderBelow = privilege === 'forceAbove'
46
- ? false
47
- : privilege === 'forceBelow'
48
- ? true
49
- : privilege === 'above'
50
- ? spaceAbove < maxHeight && spaceAbove < spaceBelow
51
- : spaceBelow >= maxHeight || spaceBelow >= spaceAbove;
52
- if (renderBelow) {
53
- maxHeight = Math.min(spaceBelow - marginTop, maxHeight);
54
- }
55
- else {
56
- maxHeight = Math.min(spaceAbove, maxHeight);
57
- // If the box renders above the text, its top margin is irrelevant.
58
- node.style.marginTop = '0px';
59
- }
60
- node.style.maxHeight = `${maxHeight}px`;
61
- // Make sure the box ought to be visible.
62
- const withinBounds = maxHeight > minHeight &&
63
- (spaceBelow >= minHeight || spaceAbove >= minHeight);
64
- if (!withinBounds) {
65
- node.classList.add(OUTOFVIEW_CLASS);
66
- return;
67
- }
68
- // Position the box vertically.
69
- const offsetAbove = (options.offset &&
70
- options.offset.vertical &&
71
- options.offset.vertical.above) ||
72
- 0;
73
- const offsetBelow = (options.offset &&
74
- options.offset.vertical &&
75
- options.offset.vertical.below) ||
76
- 0;
77
- const top = renderBelow
78
- ? innerHeight - spaceBelow + offsetBelow
79
- : spaceAbove - node.getBoundingClientRect().height + offsetAbove;
80
- node.style.top = `${Math.floor(top)}px`;
81
- // Position the box horizontally.
82
- const offsetHorizontal = (options.offset && options.offset.horizontal) || 0;
83
- let left = anchor.left + offsetHorizontal;
84
- node.style.left = `${Math.ceil(left)}px`;
85
- node.style.width = 'auto';
86
- // Expand the menu width by the scrollbar size, if present.
87
- if (node.scrollHeight >= maxHeight) {
88
- node.style.width = `${2 * node.offsetWidth - node.clientWidth}`;
89
- node.scrollTop = 0;
90
- }
91
- // Move left to fit in the window.
92
- const right = node.getBoundingClientRect().right;
93
- if (right > window.innerWidth) {
94
- left -= right - window.innerWidth;
95
- node.style.left = `${Math.ceil(left)}px`;
96
- }
97
- }
98
- HoverBox.setGeometry = setGeometry;
99
- })(HoverBox || (HoverBox = {}));
100
- //# sourceMappingURL=hoverbox.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hoverbox.js","sourceRoot":"","sources":["../src/hoverbox.ts"],"names":[],"mappings":"A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AAC,IAAI,CAAC,IAAI,CAAC;SAC1C;IACH,CAAC;IAhGe,oBAAW,cAgG1B,CAAA;AACH,CAAC,EAnLgB,QAAQ,KAAR,QAAQ,QAmLxB"}
@@ -1,13 +0,0 @@
1
- /*-----------------------------------------------------------------------------
2
- | Copyright (c) 2014-2016, Jupyter Development Team.
3
- |
4
- | Distributed under the terms of the Modified BSD License.
5
- |----------------------------------------------------------------------------*/
6
-
7
- .jp-HoverBox {
8
- position: fixed;
9
- }
10
-
11
- .jp-HoverBox.jp-mod-outofview {
12
- display: none;
13
- }