@gitlab/ui 82.0.1 → 82.1.0
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/CHANGELOG.md +7 -0
- package/dist/directives/outside/outside.js +9 -17
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/package.json +1 -1
- package/src/directives/outside/outside.js +7 -11
- package/src/scss/gitlab_ui.scss +3 -0
- package/dist/directives/outside/get_event_like_time_stamp.js +0 -33
- package/src/directives/outside/LICENSE +0 -21
- package/src/directives/outside/get_event_like_time_stamp.js +0 -31
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [82.1.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v82.0.1...v82.1.0) (2024-06-20)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **CSS:** include design token CSS custom properties in gitlab_ui.scss ([1a8db73](https://gitlab.com/gitlab-org/gitlab-ui/commit/1a8db73bde228ef91ee86660515c180984bdeebf))
|
|
7
|
+
|
|
1
8
|
## [82.0.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v82.0.0...v82.0.1) (2024-06-19)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { getEventLikeTimeStamp } from './get_event_like_time_stamp';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
|
-
* Map<HTMLElement,
|
|
2
|
+
* Map<HTMLElement, Function>
|
|
5
3
|
*/
|
|
6
4
|
const callbacks = new Map();
|
|
7
5
|
|
|
@@ -11,17 +9,11 @@ const callbacks = new Map();
|
|
|
11
9
|
let listening = false;
|
|
12
10
|
let lastMousedown = null;
|
|
13
11
|
const globalListener = event => {
|
|
14
|
-
callbacks.forEach((
|
|
15
|
-
let {
|
|
16
|
-
bindTimeStamp,
|
|
17
|
-
callback
|
|
18
|
-
} = _ref;
|
|
12
|
+
callbacks.forEach((callback, element) => {
|
|
19
13
|
const originalEvent = lastMousedown || event;
|
|
20
14
|
if (
|
|
21
15
|
// Ignore events that aren't targeted outside the element
|
|
22
|
-
element.contains(originalEvent.target)
|
|
23
|
-
// Only consider events triggered after the directive was bound
|
|
24
|
-
event.timeStamp <= bindTimeStamp) {
|
|
16
|
+
element.contains(originalEvent.target)) {
|
|
25
17
|
return;
|
|
26
18
|
}
|
|
27
19
|
try {
|
|
@@ -47,6 +39,9 @@ const startListening = () => {
|
|
|
47
39
|
return;
|
|
48
40
|
}
|
|
49
41
|
document.addEventListener('mousedown', onMousedown);
|
|
42
|
+
// Added { capture: true } to prevent the behavior discussed in https://gitlab.com/gitlab-org/gitlab-ui/-/merge_requests/1686#note_412545027
|
|
43
|
+
// Ensures the event listener handles the event in the capturing phase, avoiding issues encountered previously.
|
|
44
|
+
// Cannot be tested with Jest or Cypress, but can be tested with Playwright in the future: https://gitlab.com/gitlab-org/gitlab-ui/-/merge_requests/4272#note_1947425384
|
|
50
45
|
document.addEventListener('click', globalListener, {
|
|
51
46
|
capture: true
|
|
52
47
|
});
|
|
@@ -61,11 +56,11 @@ const stopListening = () => {
|
|
|
61
56
|
document.removeEventListener('click', globalListener);
|
|
62
57
|
listening = false;
|
|
63
58
|
};
|
|
64
|
-
const bind = (el,
|
|
59
|
+
const bind = (el, _ref) => {
|
|
65
60
|
let {
|
|
66
61
|
value,
|
|
67
62
|
arg = 'click'
|
|
68
|
-
} =
|
|
63
|
+
} = _ref;
|
|
69
64
|
if (typeof value !== 'function') {
|
|
70
65
|
throw new Error(`[GlOutsideDirective] Value must be a function; got ${typeof value}!`);
|
|
71
66
|
}
|
|
@@ -87,10 +82,7 @@ const bind = (el, _ref2) => {
|
|
|
87
82
|
if (!listening) {
|
|
88
83
|
startListening();
|
|
89
84
|
}
|
|
90
|
-
callbacks.set(el,
|
|
91
|
-
bindTimeStamp: getEventLikeTimeStamp(),
|
|
92
|
-
callback: value
|
|
93
|
-
});
|
|
85
|
+
callbacks.set(el, value);
|
|
94
86
|
};
|
|
95
87
|
const unbind = el => {
|
|
96
88
|
callbacks.delete(el);
|