@enact/spotlight 4.6.2 → 4.7.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/Accelerator/Accelerator.js +36 -13
- package/CHANGELOG.md +14 -0
- package/README.md +2 -2
- package/SpotlightContainerDecorator/SpotlightContainer.js +1 -2
- package/SpotlightContainerDecorator/SpotlightContainerDecorator.js +6 -0
- package/SpotlightContainerDecorator/tests/SpotlightContainerDecorator-specs.js +37 -20
- package/SpotlightContainerDecorator/useSpotlightContainer.js +0 -1
- package/SpotlightRootDecorator/SpotlightRootDecorator.js +10 -1
- package/Spottable/Spottable.js +8 -1
- package/package.json +3 -3
- package/src/container.js +6 -1
- package/src/spotlight.js +2 -1
|
@@ -31,6 +31,17 @@ function Accelerator() {
|
|
|
31
31
|
var _this = this;
|
|
32
32
|
var frequency = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [3, 3, 3, 2, 2, 2, 1];
|
|
33
33
|
_classCallCheck(this, Accelerator);
|
|
34
|
+
/**
|
|
35
|
+
* Called with the current keydown event and callback, which will be called when the event is
|
|
36
|
+
* allowed through.
|
|
37
|
+
*
|
|
38
|
+
* @function
|
|
39
|
+
* @param {Object} event - The current event to validate.
|
|
40
|
+
* @param {Function} callback - The callback to execute.
|
|
41
|
+
* @returns {Boolean} `true` if the event was consumed by processKey and callback was not called
|
|
42
|
+
* @public
|
|
43
|
+
* @memberof spotlight/Accelerator.Accelerator.prototype
|
|
44
|
+
*/
|
|
34
45
|
this.processKey = function (event, callback) {
|
|
35
46
|
switch (event.type) {
|
|
36
47
|
case 'keydown':
|
|
@@ -68,6 +79,14 @@ function Accelerator() {
|
|
|
68
79
|
return callback(event);
|
|
69
80
|
}
|
|
70
81
|
};
|
|
82
|
+
/**
|
|
83
|
+
* Resets the Accelerator instance to the default values.
|
|
84
|
+
*
|
|
85
|
+
* @function
|
|
86
|
+
* @returns {undefined}
|
|
87
|
+
* @public
|
|
88
|
+
* @memberof spotlight/Accelerator.Accelerator.prototype
|
|
89
|
+
*/
|
|
71
90
|
this.reset = function () {
|
|
72
91
|
_this.skipped = 0;
|
|
73
92
|
_this.time = 0;
|
|
@@ -75,9 +94,25 @@ function Accelerator() {
|
|
|
75
94
|
_this.canceled = false;
|
|
76
95
|
_this.accelerating = false;
|
|
77
96
|
};
|
|
97
|
+
/**
|
|
98
|
+
* Cancels the Accelerator.
|
|
99
|
+
*
|
|
100
|
+
* @function
|
|
101
|
+
* @returns {undefined}
|
|
102
|
+
* @public
|
|
103
|
+
* @memberof spotlight/Accelerator.Accelerator.prototype
|
|
104
|
+
*/
|
|
78
105
|
this.cancel = function () {
|
|
79
106
|
_this.canceled = true;
|
|
80
107
|
};
|
|
108
|
+
/**
|
|
109
|
+
* Verifies that the Accelerator is active.
|
|
110
|
+
*
|
|
111
|
+
* @function
|
|
112
|
+
* @returns {Boolean} `true` if the Accelerator is active; otherwise, `false`.
|
|
113
|
+
* @public
|
|
114
|
+
* @memberof spotlight/Accelerator.Accelerator.prototype
|
|
115
|
+
*/
|
|
81
116
|
this.isAccelerating = function () {
|
|
82
117
|
return _this.accelerating;
|
|
83
118
|
};
|
|
@@ -130,19 +165,7 @@ function Accelerator() {
|
|
|
130
165
|
* @public
|
|
131
166
|
*/
|
|
132
167
|
this.frequency = frequency;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Called with the current keydown event and callback, which will be called when the event is
|
|
137
|
-
* allowed through.
|
|
138
|
-
*
|
|
139
|
-
* @function
|
|
140
|
-
* @param {Object} event - The current event to validate.
|
|
141
|
-
* @param {Function} callback - The callback to execute.
|
|
142
|
-
* @returns {Boolean} `true` if the event was consumed by processKey and callback was not called
|
|
143
|
-
* @public
|
|
144
|
-
* @memberof spotlight/Accelerator.Accelerator.prototype
|
|
145
|
-
*/);
|
|
168
|
+
});
|
|
146
169
|
exports.Accelerator = Accelerator;
|
|
147
170
|
var _default = Accelerator;
|
|
148
171
|
exports["default"] = _default;
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
The following is a curated list of changes in the Enact spotlight module, newest changes on the top.
|
|
4
4
|
|
|
5
|
+
## [4.7.1] - 2023-06-02
|
|
6
|
+
|
|
7
|
+
No significant changes.
|
|
8
|
+
|
|
9
|
+
## [4.5.3] - 2023-04-06
|
|
10
|
+
|
|
11
|
+
No significant changes.
|
|
12
|
+
|
|
13
|
+
## [4.7.0] - 2023-04-25
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- `spotlight` to show the focus effect when pointer mode is changed to `false` while an app is loading
|
|
18
|
+
|
|
5
19
|
## [4.6.2] - 2023-03-09
|
|
6
20
|
|
|
7
21
|
No significant changes.
|
package/README.md
CHANGED
|
@@ -30,8 +30,8 @@ See the [docs](docs/) for more information.
|
|
|
30
30
|
|
|
31
31
|
## Additional Information
|
|
32
32
|
|
|
33
|
-
When using `@enact/
|
|
34
|
-
|
|
33
|
+
When using `@enact/sandstone`, the `SpotlightRootDecorator` is applied automatically by
|
|
34
|
+
`@enact/sandstone/ThemeDecorator`.
|
|
35
35
|
|
|
36
36
|
## Acknowledgments
|
|
37
37
|
|
|
@@ -20,14 +20,13 @@ var isNewPointerPosition = function isNewPointerPosition(ev) {
|
|
|
20
20
|
return (0, _pointer.hasPointerMoved)(ev.clientX, ev.clientY);
|
|
21
21
|
};
|
|
22
22
|
var SpotlightContainer = /*#__PURE__*/function () {
|
|
23
|
-
// set up context and props so we can use handle binding
|
|
24
|
-
|
|
25
23
|
function SpotlightContainer(_ref) {
|
|
26
24
|
var _this = this;
|
|
27
25
|
var containerConfig = _ref.containerConfig,
|
|
28
26
|
navigableFilter = _ref.navigableFilter,
|
|
29
27
|
preserveId = _ref.preserveId;
|
|
30
28
|
_classCallCheck(this, SpotlightContainer);
|
|
29
|
+
// set up context and props so we can use handle binding
|
|
31
30
|
this.context = {};
|
|
32
31
|
this.props = {};
|
|
33
32
|
this.navigableFilter = function (elem) {
|
|
@@ -19,6 +19,12 @@ var _useSpotlightContainer = _interopRequireDefault(require("./useSpotlightConta
|
|
|
19
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
20
|
var _excluded = ["navigableFilter", "preserveId"],
|
|
21
21
|
_excluded2 = ["spotlightDisabled", "spotlightId", "spotlightMuted", "spotlightRestrict"];
|
|
22
|
+
/**
|
|
23
|
+
* A component for managing groups of spottable components.
|
|
24
|
+
*
|
|
25
|
+
* @module spotlight/SpotlightContainerDecorator
|
|
26
|
+
* @exports SpotlightContainerDecorator
|
|
27
|
+
*/
|
|
22
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
29
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
24
30
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -9,6 +9,8 @@ var _spotlight = _interopRequireDefault(require("../../src/spotlight"));
|
|
|
9
9
|
var _ElementPrototype = _interopRequireDefault(require("./Element.prototype.closest"));
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
13
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
12
14
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
13
15
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
14
16
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -32,21 +34,26 @@ describe('SpotlightContainerDecorator', function () {
|
|
|
32
34
|
_spotlight["default"].setActiveContainer(null);
|
|
33
35
|
(0, _pointer.updatePointerPosition)(0, 0);
|
|
34
36
|
});
|
|
35
|
-
test('should set itself as the active container on mouse enter', function () {
|
|
37
|
+
test('should set itself as the active container on mouse enter', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
36
38
|
var Component = (0, _SpotlightContainerDecorator["default"])(Div);
|
|
39
|
+
var user = _userEvent["default"].setup();
|
|
37
40
|
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
38
41
|
"data-testid": testId,
|
|
39
42
|
spotlightId: "test-container"
|
|
40
43
|
}));
|
|
41
44
|
var component = _react.screen.getByTestId(testId);
|
|
42
|
-
|
|
45
|
+
yield user.pointer({
|
|
46
|
+
target: component,
|
|
47
|
+
coords: hoverPosition
|
|
48
|
+
});
|
|
43
49
|
var expected = 'test-container';
|
|
44
50
|
var actual = _spotlight["default"].getActiveContainer();
|
|
45
51
|
expect(actual).toBe(expected);
|
|
46
|
-
});
|
|
47
|
-
test('should set active container to parent container on mouse leave', function () {
|
|
52
|
+
}));
|
|
53
|
+
test('should set active container to parent container on mouse leave', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
48
54
|
var Component = (0, _SpotlightContainerDecorator["default"])(Div);
|
|
49
55
|
var node = document.createElement('div');
|
|
56
|
+
var user = _userEvent["default"].setup();
|
|
50
57
|
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
51
58
|
spotlightId: "outer-container",
|
|
52
59
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
@@ -59,18 +66,25 @@ describe('SpotlightContainerDecorator', function () {
|
|
|
59
66
|
var component = _react.screen.getByTestId(testId);
|
|
60
67
|
|
|
61
68
|
// set inner-container as active
|
|
62
|
-
|
|
69
|
+
yield user.pointer({
|
|
70
|
+
target: component,
|
|
71
|
+
coords: hoverPosition
|
|
72
|
+
});
|
|
63
73
|
(0, _pointer.updatePointerPosition)(0, 1);
|
|
64
74
|
|
|
65
75
|
// leave inner-container
|
|
66
|
-
|
|
76
|
+
yield user.pointer({
|
|
77
|
+
target: component.parentNode,
|
|
78
|
+
coords: unhoverPosition
|
|
79
|
+
});
|
|
67
80
|
var expected = 'outer-container';
|
|
68
81
|
var actual = _spotlight["default"].getActiveContainer();
|
|
69
82
|
expect(actual).toBe(expected);
|
|
70
|
-
});
|
|
71
|
-
test('should not set active container on mouse leave if another container is active', function () {
|
|
83
|
+
}));
|
|
84
|
+
test('should not set active container on mouse leave if another container is active', /*#__PURE__*/_asyncToGenerator(function* () {
|
|
72
85
|
var Component = (0, _SpotlightContainerDecorator["default"])(Div);
|
|
73
86
|
var node = document.createElement('div');
|
|
87
|
+
var user = _userEvent["default"].setup();
|
|
74
88
|
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(Component, {
|
|
75
89
|
spotlightId: "outer-container",
|
|
76
90
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
@@ -85,23 +99,26 @@ describe('SpotlightContainerDecorator', function () {
|
|
|
85
99
|
var component = _react.screen.getByTestId(testId);
|
|
86
100
|
|
|
87
101
|
// set inner-container as active
|
|
88
|
-
|
|
102
|
+
yield user.pointer({
|
|
103
|
+
target: component,
|
|
104
|
+
coords: hoverPosition
|
|
105
|
+
});
|
|
89
106
|
(0, _pointer.updatePointerPosition)(0, 1);
|
|
90
107
|
|
|
91
108
|
// set another container to be active
|
|
92
109
|
_spotlight["default"].setActiveContainer('self-only-container');
|
|
93
110
|
|
|
94
111
|
// leave inner-container
|
|
95
|
-
|
|
112
|
+
yield user.unhover(component);
|
|
96
113
|
var expected = 'self-only-container';
|
|
97
114
|
var actual = _spotlight["default"].getActiveContainer();
|
|
98
115
|
expect(actual).toBe(expected);
|
|
99
|
-
});
|
|
116
|
+
}));
|
|
100
117
|
test('should forward onFocusCapture events', function () {
|
|
101
118
|
var spy = jest.fn();
|
|
102
119
|
var focus;
|
|
103
|
-
var Component = (0, _SpotlightContainerDecorator["default"])(function (
|
|
104
|
-
var onFocusCapture =
|
|
120
|
+
var Component = (0, _SpotlightContainerDecorator["default"])(function (_ref4) {
|
|
121
|
+
var onFocusCapture = _ref4.onFocusCapture;
|
|
105
122
|
focus = onFocusCapture;
|
|
106
123
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {});
|
|
107
124
|
});
|
|
@@ -115,8 +132,8 @@ describe('SpotlightContainerDecorator', function () {
|
|
|
115
132
|
test('should suppress onFocusCapture events when spotlightDisabled', function () {
|
|
116
133
|
var spy = jest.fn();
|
|
117
134
|
var focus;
|
|
118
|
-
var Component = (0, _SpotlightContainerDecorator["default"])(function (
|
|
119
|
-
var onFocusCapture =
|
|
135
|
+
var Component = (0, _SpotlightContainerDecorator["default"])(function (_ref5) {
|
|
136
|
+
var onFocusCapture = _ref5.onFocusCapture;
|
|
120
137
|
focus = onFocusCapture;
|
|
121
138
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {});
|
|
122
139
|
});
|
|
@@ -141,8 +158,8 @@ describe('SpotlightContainerDecorator', function () {
|
|
|
141
158
|
test('should forward onBlurCapture events', function () {
|
|
142
159
|
var spy = jest.fn();
|
|
143
160
|
var _blur;
|
|
144
|
-
var Component = (0, _SpotlightContainerDecorator["default"])(function (
|
|
145
|
-
var onBlurCapture =
|
|
161
|
+
var Component = (0, _SpotlightContainerDecorator["default"])(function (_ref6) {
|
|
162
|
+
var onBlurCapture = _ref6.onBlurCapture;
|
|
146
163
|
_blur = onBlurCapture;
|
|
147
164
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {});
|
|
148
165
|
});
|
|
@@ -169,9 +186,9 @@ describe('SpotlightContainerDecorator', function () {
|
|
|
169
186
|
var spy = jest.fn();
|
|
170
187
|
var _blur2;
|
|
171
188
|
var focus;
|
|
172
|
-
var Component = (0, _SpotlightContainerDecorator["default"])(function (
|
|
173
|
-
var onBlurCapture =
|
|
174
|
-
onFocusCapture =
|
|
189
|
+
var Component = (0, _SpotlightContainerDecorator["default"])(function (_ref7) {
|
|
190
|
+
var onBlurCapture = _ref7.onBlurCapture,
|
|
191
|
+
onFocusCapture = _ref7.onFocusCapture;
|
|
175
192
|
_blur2 = onBlurCapture;
|
|
176
193
|
focus = onFocusCapture;
|
|
177
194
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {});
|
|
@@ -27,7 +27,13 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
27
27
|
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
28
28
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
29
29
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
30
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
30
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /**
|
|
31
|
+
* Exports the {@link spotlight/SpotlightRootDecorator.SpotlightRootDecorator}
|
|
32
|
+
* higher-order component.
|
|
33
|
+
*
|
|
34
|
+
* @module spotlight/SpotlightRootDecorator
|
|
35
|
+
* @exports SpotlightRootDecorator
|
|
36
|
+
*/
|
|
31
37
|
var input = {
|
|
32
38
|
activated: false,
|
|
33
39
|
applied: false,
|
|
@@ -120,6 +126,7 @@ var SpotlightRootDecorator = (0, _hoc["default"])(defaultConfig, function (confi
|
|
|
120
126
|
_this.applyInputType();
|
|
121
127
|
}
|
|
122
128
|
};
|
|
129
|
+
// For key input
|
|
123
130
|
_this.handleKeyDown = function (ev) {
|
|
124
131
|
var keyCode = ev.keyCode;
|
|
125
132
|
if ((0, _keymap.is)('enter', keyCode) && _this.containerNode.classList.contains('spotlight-input-touch')) {
|
|
@@ -133,12 +140,14 @@ var SpotlightRootDecorator = (0, _hoc["default"])(defaultConfig, function (confi
|
|
|
133
140
|
_this.applyInputType();
|
|
134
141
|
}, 0);
|
|
135
142
|
};
|
|
143
|
+
// For mouse input
|
|
136
144
|
_this.handlePointerMove = function (ev) {
|
|
137
145
|
if (ev.pointerType === 'mouse') {
|
|
138
146
|
setInputType('mouse');
|
|
139
147
|
_this.applyInputType();
|
|
140
148
|
}
|
|
141
149
|
};
|
|
150
|
+
// For touch input
|
|
142
151
|
_this.handlePointerOver = function (ev) {
|
|
143
152
|
if (ev.pointerType === 'touch') {
|
|
144
153
|
setInputType('touch');
|
package/Spottable/Spottable.js
CHANGED
|
@@ -27,6 +27,13 @@ var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
|
27
27
|
var _useSpottable = require("./useSpottable");
|
|
28
28
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
29
29
|
var _excluded = ["className", "disabled", "handleForceUpdate", "onSpotlightDisappear", "onSpotlightDown", "onSpotlightLeft", "onSpotlightRight", "onSpotlightUp", "selectionKeys", "spotlightDisabled", "spotlightId", "spotRef"];
|
|
30
|
+
/**
|
|
31
|
+
* Adds spottability to components.
|
|
32
|
+
*
|
|
33
|
+
* @module spotlight/Spottable
|
|
34
|
+
* @exports Spottable
|
|
35
|
+
* @exports spottableClass
|
|
36
|
+
*/
|
|
30
37
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
31
38
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
32
39
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -240,7 +247,7 @@ var Spottable = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
240
247
|
*/
|
|
241
248
|
spotlightId: _propTypes2["default"].string,
|
|
242
249
|
/*
|
|
243
|
-
* Called with a reference to
|
|
250
|
+
* Called with a reference to spottable component
|
|
244
251
|
*
|
|
245
252
|
* @type {Object|Function}
|
|
246
253
|
* @private
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enact/spotlight",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.7.1",
|
|
4
4
|
"description": "A focus management library",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@enact/core": "^4.
|
|
27
|
+
"@enact/core": "^4.7.1",
|
|
28
28
|
"classnames": "^2.3.2",
|
|
29
29
|
"prop-types": "^15.8.1",
|
|
30
|
-
"ramda": "^0.
|
|
30
|
+
"ramda": "^0.29.0",
|
|
31
31
|
"react": "^18.2.0",
|
|
32
32
|
"react-dom": "^18.2.0",
|
|
33
33
|
"warning": "^4.0.3"
|
package/src/container.js
CHANGED
|
@@ -47,7 +47,12 @@ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread n
|
|
|
47
47
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
48
48
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
49
49
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
50
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
50
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } /**
|
|
51
|
+
* Exports methods and members for creating and maintaining spotlight containers.
|
|
52
|
+
*
|
|
53
|
+
* @module spotlight/container
|
|
54
|
+
* @private
|
|
55
|
+
*/
|
|
51
56
|
var containerAttribute = 'data-spotlight-id';
|
|
52
57
|
exports.containerAttribute = containerAttribute;
|
|
53
58
|
var containerConfigs = new Map();
|
package/src/spotlight.js
CHANGED
|
@@ -141,10 +141,11 @@ var Spotlight = function () {
|
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
function focusElement(elem, containerIds, fromPointer) {
|
|
144
|
+
var _window$PalmSystem$cu;
|
|
144
145
|
if (!elem) {
|
|
145
146
|
return false;
|
|
146
147
|
}
|
|
147
|
-
if ((0, _pointer.getPointerMode)() && !fromPointer) {
|
|
148
|
+
if ((0, _pointer.getPointerMode)() && !fromPointer && typeof window !== 'undefined' && (!window.PalmSystem || (_window$PalmSystem$cu = window.PalmSystem.cursor) !== null && _window$PalmSystem$cu !== void 0 && _window$PalmSystem$cu.visibility)) {
|
|
148
149
|
(0, _container.setContainerLastFocusedElement)(elem, containerIds);
|
|
149
150
|
return false;
|
|
150
151
|
}
|