@instructure/ui-dom-utils 8.25.1-snapshot-10 → 8.25.1-snapshot-15
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 +1 -1
- package/es/InputModeListener.js +35 -32
- package/lib/InputModeListener.js +35 -32
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [8.25.1-snapshot-
|
|
6
|
+
## [8.25.1-snapshot-15](https://github.com/instructure/instructure-ui/compare/v8.25.0...v8.25.1-snapshot-15) (2022-06-23)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @instructure/ui-dom-utils
|
|
9
9
|
|
package/es/InputModeListener.js
CHANGED
|
@@ -31,32 +31,45 @@ export const MODES = {
|
|
|
31
31
|
|
|
32
32
|
class InputModeListenerImpl {
|
|
33
33
|
constructor() {
|
|
34
|
-
|
|
35
|
-
this.
|
|
36
|
-
|
|
34
|
+
this._listeners = [];
|
|
35
|
+
this._initialized = false;
|
|
36
|
+
this._mode = MODES.keyboard;
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
_mode = MODES.keyboard;
|
|
41
|
-
onInitialPointerMove = event => {
|
|
42
|
-
var _event$target, _event$target$nodeNam;
|
|
38
|
+
this.onInitialPointerMove = event => {
|
|
39
|
+
var _event$target, _event$target$nodeNam;
|
|
43
40
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
41
|
+
// Work around a Safari quirk that fires a mousemove on <html> whenever the
|
|
42
|
+
// window blurs, even if you're tabbing out of the page. ¯\_(ツ)_/¯
|
|
43
|
+
if ((event === null || event === void 0 ? void 0 : (_event$target = event.target) === null || _event$target === void 0 ? void 0 : (_event$target$nodeNam = _event$target.nodeName) === null || _event$target$nodeNam === void 0 ? void 0 : _event$target$nodeNam.toLowerCase()) === 'html') {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
49
46
|
|
|
50
|
-
|
|
47
|
+
this._mode = MODES.pointer;
|
|
51
48
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
this.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
49
|
+
this._listeners.forEach(listener => listener.remove());
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
this.onKeyDown = () => {
|
|
53
|
+
this._mode = MODES.keyboard;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
this.onPointerDown = () => {
|
|
57
|
+
this._mode = MODES.pointer;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
this.init = () => {
|
|
61
|
+
if (!canUseDOM || this._initialized) return;
|
|
62
|
+
addEventListener(document, 'keydown', this.onKeyDown, true);
|
|
63
|
+
addEventListener(document, 'mousedown', this.onPointerDown, true);
|
|
64
|
+
addEventListener(document, 'pointerdown', this.onPointerDown, true);
|
|
65
|
+
addEventListener(document, 'touchstart', this.onPointerDown, true);
|
|
66
|
+
this.addInitialPointerMoveListeners();
|
|
67
|
+
this._initialized = true;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
warn(false, `[InputModeListener] is deprecated and will be removed in version 7.0.0. Use addInputModeListener instead.`);
|
|
71
|
+
this.init();
|
|
72
|
+
}
|
|
60
73
|
|
|
61
74
|
addInitialPointerMoveListeners() {
|
|
62
75
|
this._listeners.push(addEventListener(document, 'mousemove', this.onInitialPointerMove, true));
|
|
@@ -78,16 +91,6 @@ class InputModeListenerImpl {
|
|
|
78
91
|
this._listeners.push(addEventListener(document, 'touchend', this.onInitialPointerMove, true));
|
|
79
92
|
}
|
|
80
93
|
|
|
81
|
-
init = () => {
|
|
82
|
-
if (!canUseDOM || this._initialized) return;
|
|
83
|
-
addEventListener(document, 'keydown', this.onKeyDown, true);
|
|
84
|
-
addEventListener(document, 'mousedown', this.onPointerDown, true);
|
|
85
|
-
addEventListener(document, 'pointerdown', this.onPointerDown, true);
|
|
86
|
-
addEventListener(document, 'touchstart', this.onPointerDown, true);
|
|
87
|
-
this.addInitialPointerMoveListeners();
|
|
88
|
-
this._initialized = true;
|
|
89
|
-
};
|
|
90
|
-
|
|
91
94
|
get mode() {
|
|
92
95
|
this.init();
|
|
93
96
|
return this._mode;
|
package/lib/InputModeListener.js
CHANGED
|
@@ -42,32 +42,45 @@ exports.MODES = MODES;
|
|
|
42
42
|
|
|
43
43
|
class InputModeListenerImpl {
|
|
44
44
|
constructor() {
|
|
45
|
-
|
|
46
|
-
this.
|
|
47
|
-
|
|
45
|
+
this._listeners = [];
|
|
46
|
+
this._initialized = false;
|
|
47
|
+
this._mode = MODES.keyboard;
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
_mode = MODES.keyboard;
|
|
52
|
-
onInitialPointerMove = event => {
|
|
53
|
-
var _event$target, _event$target$nodeNam;
|
|
49
|
+
this.onInitialPointerMove = event => {
|
|
50
|
+
var _event$target, _event$target$nodeNam;
|
|
54
51
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
52
|
+
// Work around a Safari quirk that fires a mousemove on <html> whenever the
|
|
53
|
+
// window blurs, even if you're tabbing out of the page. ¯\_(ツ)_/¯
|
|
54
|
+
if ((event === null || event === void 0 ? void 0 : (_event$target = event.target) === null || _event$target === void 0 ? void 0 : (_event$target$nodeNam = _event$target.nodeName) === null || _event$target$nodeNam === void 0 ? void 0 : _event$target$nodeNam.toLowerCase()) === 'html') {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
60
57
|
|
|
61
|
-
|
|
58
|
+
this._mode = MODES.pointer;
|
|
62
59
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
this.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
60
|
+
this._listeners.forEach(listener => listener.remove());
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
this.onKeyDown = () => {
|
|
64
|
+
this._mode = MODES.keyboard;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
this.onPointerDown = () => {
|
|
68
|
+
this._mode = MODES.pointer;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
this.init = () => {
|
|
72
|
+
if (!_canUseDOM.canUseDOM || this._initialized) return;
|
|
73
|
+
(0, _addEventListener.addEventListener)(document, 'keydown', this.onKeyDown, true);
|
|
74
|
+
(0, _addEventListener.addEventListener)(document, 'mousedown', this.onPointerDown, true);
|
|
75
|
+
(0, _addEventListener.addEventListener)(document, 'pointerdown', this.onPointerDown, true);
|
|
76
|
+
(0, _addEventListener.addEventListener)(document, 'touchstart', this.onPointerDown, true);
|
|
77
|
+
this.addInitialPointerMoveListeners();
|
|
78
|
+
this._initialized = true;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
(0, _console.logWarn)(false, `[InputModeListener] is deprecated and will be removed in version 7.0.0. Use addInputModeListener instead.`);
|
|
82
|
+
this.init();
|
|
83
|
+
}
|
|
71
84
|
|
|
72
85
|
addInitialPointerMoveListeners() {
|
|
73
86
|
this._listeners.push((0, _addEventListener.addEventListener)(document, 'mousemove', this.onInitialPointerMove, true));
|
|
@@ -89,16 +102,6 @@ class InputModeListenerImpl {
|
|
|
89
102
|
this._listeners.push((0, _addEventListener.addEventListener)(document, 'touchend', this.onInitialPointerMove, true));
|
|
90
103
|
}
|
|
91
104
|
|
|
92
|
-
init = () => {
|
|
93
|
-
if (!_canUseDOM.canUseDOM || this._initialized) return;
|
|
94
|
-
(0, _addEventListener.addEventListener)(document, 'keydown', this.onKeyDown, true);
|
|
95
|
-
(0, _addEventListener.addEventListener)(document, 'mousedown', this.onPointerDown, true);
|
|
96
|
-
(0, _addEventListener.addEventListener)(document, 'pointerdown', this.onPointerDown, true);
|
|
97
|
-
(0, _addEventListener.addEventListener)(document, 'touchstart', this.onPointerDown, true);
|
|
98
|
-
this.addInitialPointerMoveListeners();
|
|
99
|
-
this._initialized = true;
|
|
100
|
-
};
|
|
101
|
-
|
|
102
105
|
get mode() {
|
|
103
106
|
this.init();
|
|
104
107
|
return this._mode;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-dom-utils",
|
|
3
|
-
"version": "8.25.1-snapshot-
|
|
3
|
+
"version": "8.25.1-snapshot-15",
|
|
4
4
|
"description": "A DOM utility library made by Instructure Inc.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
},
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@instructure/ui-babel-preset": "8.25.1-snapshot-
|
|
26
|
-
"@instructure/ui-test-utils": "8.25.1-snapshot-
|
|
25
|
+
"@instructure/ui-babel-preset": "8.25.1-snapshot-15",
|
|
26
|
+
"@instructure/ui-test-utils": "8.25.1-snapshot-15"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@babel/runtime": "^7.13.10",
|
|
30
|
-
"@instructure/console": "8.25.1-snapshot-
|
|
31
|
-
"@instructure/shared-types": "8.25.1-snapshot-
|
|
30
|
+
"@instructure/console": "8.25.1-snapshot-15",
|
|
31
|
+
"@instructure/shared-types": "8.25.1-snapshot-15"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"react": ">=16.8 <=17",
|