@enact/spotlight 4.7.5 → 4.7.7
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 +2 -4
- package/CHANGELOG.md +8 -0
- package/Pause/Pause.d.ts +1 -2
- package/Pause/Pause.js +2 -4
- package/SpotlightContainerDecorator/SpotlightContainer.js +4 -6
- package/SpotlightContainerDecorator/SpotlightContainerDecorator.d.ts +2 -2
- package/SpotlightContainerDecorator/SpotlightContainerDecorator.js +5 -8
- package/SpotlightContainerDecorator/tests/SpotlightContainerDecorator-specs.js +2 -2
- package/SpotlightContainerDecorator/tests/useSpotlightContainer-specs.js +2 -2
- package/SpotlightContainerDecorator/useSpotlightContainer.js +1 -2
- package/SpotlightRootDecorator/SpotlightRootDecorator.d.ts +2 -2
- package/SpotlightRootDecorator/SpotlightRootDecorator.js +4 -6
- package/SpotlightRootDecorator/tests/SpotlightRootDecorator-specs.js +2 -2
- package/Spottable/Spottable.d.ts +2 -2
- package/Spottable/Spottable.js +4 -6
- package/Spottable/SpottableCore.js +3 -6
- package/Spottable/tests/Spottable-specs.js +2 -2
- package/Spottable/tests/useSpot-specs.js +2 -2
- package/Spottable/useSpottable.js +4 -6
- package/package.json +2 -2
- package/src/container.js +18 -34
- package/src/inputType.js +6 -11
- package/src/navigate.js +1 -2
- package/src/pointer.js +8 -15
- package/src/spotlight.js +3 -6
- package/src/target.js +96 -95
- package/src/tests/utils.js +12 -22
- package/src/utils.js +3 -6
|
@@ -19,7 +19,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
19
19
|
* @class Accelerator
|
|
20
20
|
* @memberof spotlight/Accelerator
|
|
21
21
|
*/
|
|
22
|
-
var Accelerator = /*#__PURE__*/_createClass(
|
|
22
|
+
var Accelerator = exports.Accelerator = /*#__PURE__*/_createClass(
|
|
23
23
|
/**
|
|
24
24
|
* @constructor
|
|
25
25
|
* @param {Number[]} frequency - Controls the frequency with which the acceleration will
|
|
@@ -166,6 +166,4 @@ function Accelerator() {
|
|
|
166
166
|
*/
|
|
167
167
|
this.frequency = frequency;
|
|
168
168
|
});
|
|
169
|
-
exports
|
|
170
|
-
var _default = Accelerator;
|
|
171
|
-
exports["default"] = _default;
|
|
169
|
+
var _default = exports["default"] = Accelerator;
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
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.7] - 2023-11-09
|
|
6
|
+
|
|
7
|
+
No significant changes.
|
|
8
|
+
|
|
9
|
+
## [4.7.6] - 2023-09-20
|
|
10
|
+
|
|
11
|
+
No significant changes.
|
|
12
|
+
|
|
5
13
|
## [4.7.5] - 2023-09-12
|
|
6
14
|
|
|
7
15
|
No significant changes.
|
package/Pause/Pause.d.ts
CHANGED
package/Pause/Pause.js
CHANGED
|
@@ -82,7 +82,7 @@ function isPaused() {
|
|
|
82
82
|
* @memberof spotlight/Pause
|
|
83
83
|
* @public
|
|
84
84
|
*/
|
|
85
|
-
var Pause = /*#__PURE__*/function () {
|
|
85
|
+
var Pause = exports.Pause = /*#__PURE__*/function () {
|
|
86
86
|
/**
|
|
87
87
|
* Accepts a name for the instance
|
|
88
88
|
*
|
|
@@ -151,6 +151,4 @@ var Pause = /*#__PURE__*/function () {
|
|
|
151
151
|
}]);
|
|
152
152
|
return Pause;
|
|
153
153
|
}();
|
|
154
|
-
exports
|
|
155
|
-
var _default = Pause;
|
|
156
|
-
exports["default"] = _default;
|
|
154
|
+
var _default = exports["default"] = Pause;
|
|
@@ -8,8 +8,8 @@ var _handle = require("@enact/core/handle");
|
|
|
8
8
|
var _pointer = require("../src/pointer");
|
|
9
9
|
var _spotlight = _interopRequireDefault(require("../src/spotlight"));
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
function ownKeys(
|
|
12
|
-
function _objectSpread(
|
|
11
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
13
|
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; }
|
|
14
14
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
15
15
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
@@ -19,7 +19,7 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
|
|
|
19
19
|
var isNewPointerPosition = function isNewPointerPosition(ev) {
|
|
20
20
|
return (0, _pointer.hasPointerMoved)(ev.clientX, ev.clientY);
|
|
21
21
|
};
|
|
22
|
-
var SpotlightContainer = /*#__PURE__*/function () {
|
|
22
|
+
var SpotlightContainer = exports.SpotlightContainer = /*#__PURE__*/function () {
|
|
23
23
|
function SpotlightContainer(_ref) {
|
|
24
24
|
var _this = this;
|
|
25
25
|
var containerConfig = _ref.containerConfig,
|
|
@@ -146,6 +146,4 @@ var SpotlightContainer = /*#__PURE__*/function () {
|
|
|
146
146
|
}]);
|
|
147
147
|
return SpotlightContainer;
|
|
148
148
|
}();
|
|
149
|
-
exports
|
|
150
|
-
var _default = SpotlightContainer;
|
|
151
|
-
exports["default"] = _default;
|
|
149
|
+
var _default = exports["default"] = SpotlightContainer;
|
|
@@ -86,11 +86,11 @@ indicates there should be no restrictions when 5-way navigating the container.
|
|
|
86
86
|
}
|
|
87
87
|
export function SpotlightContainerDecorator<P>(
|
|
88
88
|
config: SpotlightContainerDecoratorConfig,
|
|
89
|
-
Component: React.ComponentType<P> | string
|
|
89
|
+
Component: React.ComponentType<P> | string,
|
|
90
90
|
): React.ComponentType<P & SpotlightContainerDecoratorProps>;
|
|
91
91
|
|
|
92
92
|
export function SpotlightContainerDecorator<P>(
|
|
93
|
-
Component: React.ComponentType<P> | string
|
|
93
|
+
Component: React.ComponentType<P> | string,
|
|
94
94
|
): React.ComponentType<P & SpotlightContainerDecoratorProps>;
|
|
95
95
|
|
|
96
96
|
export default SpotlightContainerDecorator;
|
|
@@ -38,8 +38,8 @@ function _possibleConstructorReturn(self, call) { if (call && (typeof call === "
|
|
|
38
38
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
39
39
|
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; } }
|
|
40
40
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
41
|
-
function ownKeys(
|
|
42
|
-
function _objectSpread(
|
|
41
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
42
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
43
43
|
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; }
|
|
44
44
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
45
45
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
@@ -63,7 +63,7 @@ var containerHandlers = {
|
|
|
63
63
|
* @memberof spotlight/SpotlightContainerDecorator
|
|
64
64
|
* @public
|
|
65
65
|
*/
|
|
66
|
-
var spotlightDefaultClass = 'spottable-default';
|
|
66
|
+
var spotlightDefaultClass = exports.spotlightDefaultClass = 'spottable-default';
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* Default config for {@link spotlight/SpotlightContainerDecorator.SpotlightContainerDecorator}
|
|
@@ -71,7 +71,6 @@ var spotlightDefaultClass = 'spottable-default';
|
|
|
71
71
|
* @memberof spotlight/SpotlightContainerDecorator.SpotlightContainerDecorator
|
|
72
72
|
* @hocconfig
|
|
73
73
|
*/
|
|
74
|
-
exports.spotlightDefaultClass = spotlightDefaultClass;
|
|
75
74
|
var defaultConfig = {
|
|
76
75
|
/**
|
|
77
76
|
* When `true`, allows focus to move outside the container to the next spottable element when
|
|
@@ -194,7 +193,7 @@ var defaultConfig = {
|
|
|
194
193
|
* @memberof spotlight/SpotlightContainerDecorator
|
|
195
194
|
* @hoc
|
|
196
195
|
*/
|
|
197
|
-
var SpotlightContainerDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
196
|
+
var SpotlightContainerDecorator = exports.SpotlightContainerDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
198
197
|
var navigableFilter = config.navigableFilter,
|
|
199
198
|
preserveId = config.preserveId,
|
|
200
199
|
containerConfig = _objectWithoutProperties(config, _excluded);
|
|
@@ -289,6 +288,4 @@ var SpotlightContainerDecorator = (0, _hoc["default"])(defaultConfig, function (
|
|
|
289
288
|
return SpotlightContainerDecoratorAdapter;
|
|
290
289
|
}(_react.Component);
|
|
291
290
|
});
|
|
292
|
-
exports
|
|
293
|
-
var _default = SpotlightContainerDecorator;
|
|
294
|
-
exports["default"] = _default;
|
|
291
|
+
var _default = exports["default"] = SpotlightContainerDecorator;
|
|
@@ -11,8 +11,8 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
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
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); }); }; }
|
|
14
|
-
function ownKeys(
|
|
15
|
-
function _objectSpread(
|
|
14
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
16
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; }
|
|
17
17
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
18
18
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
@@ -8,8 +8,8 @@ var _spotlight = _interopRequireDefault(require("../../src/spotlight"));
|
|
|
8
8
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
9
|
var _excluded = ["containerConfig", "preserveId", "spotlightDisabled", "spotlightId", "spotlightMuted", "spotlightRestrict"];
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
function ownKeys(
|
|
12
|
-
function _objectSpread(
|
|
11
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
13
|
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; }
|
|
14
14
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
15
15
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
@@ -12,11 +12,11 @@ export interface SpotlightRootDecoratorConfig extends Object {
|
|
|
12
12
|
export interface SpotlightRootDecoratorProps {}
|
|
13
13
|
export function SpotlightRootDecorator<P>(
|
|
14
14
|
config: SpotlightRootDecoratorConfig,
|
|
15
|
-
Component: React.ComponentType<P> | string
|
|
15
|
+
Component: React.ComponentType<P> | string,
|
|
16
16
|
): React.ComponentType<P & SpotlightRootDecoratorProps>;
|
|
17
17
|
|
|
18
18
|
export function SpotlightRootDecorator<P>(
|
|
19
|
-
Component: React.ComponentType<P> | string
|
|
19
|
+
Component: React.ComponentType<P> | string,
|
|
20
20
|
): React.ComponentType<P & SpotlightRootDecoratorProps>;
|
|
21
21
|
|
|
22
22
|
export default SpotlightRootDecorator;
|
|
@@ -33,8 +33,8 @@ var _spotlight = _interopRequireDefault(require("../src/spotlight"));
|
|
|
33
33
|
require("../styles/debug.less");
|
|
34
34
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
35
35
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
36
|
-
function ownKeys(
|
|
37
|
-
function _objectSpread(
|
|
36
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
37
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
38
38
|
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; }
|
|
39
39
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
40
40
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
@@ -89,7 +89,7 @@ var defaultConfig = {
|
|
|
89
89
|
* @returns {Function} SpotlightRootDecorator
|
|
90
90
|
* @hoc
|
|
91
91
|
*/
|
|
92
|
-
var SpotlightRootDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
92
|
+
var SpotlightRootDecorator = exports.SpotlightRootDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
93
93
|
var _class;
|
|
94
94
|
var noAutoFocus = config.noAutoFocus;
|
|
95
95
|
return _class = /*#__PURE__*/function (_Component) {
|
|
@@ -214,6 +214,4 @@ var SpotlightRootDecorator = (0, _hoc["default"])(defaultConfig, function (confi
|
|
|
214
214
|
return _class;
|
|
215
215
|
}(_react.Component), _class.displayName = 'SpotlightRootDecorator', _class;
|
|
216
216
|
});
|
|
217
|
-
exports
|
|
218
|
-
var _default = SpotlightRootDecorator;
|
|
219
|
-
exports["default"] = _default;
|
|
217
|
+
var _default = exports["default"] = SpotlightRootDecorator;
|
|
@@ -4,8 +4,8 @@ require("@testing-library/jest-dom");
|
|
|
4
4
|
var _react = require("@testing-library/react");
|
|
5
5
|
var _SpotlightRootDecorator = require("../SpotlightRootDecorator");
|
|
6
6
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
-
function ownKeys(
|
|
8
|
-
function _objectSpread(
|
|
7
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
8
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
9
9
|
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; }
|
|
10
10
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
11
11
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
package/Spottable/Spottable.d.ts
CHANGED
|
@@ -65,11 +65,11 @@ unset and the control is spottable.
|
|
|
65
65
|
}
|
|
66
66
|
export function Spottable<P>(
|
|
67
67
|
config: SpottableConfig,
|
|
68
|
-
Component: React.ComponentType<P> | string
|
|
68
|
+
Component: React.ComponentType<P> | string,
|
|
69
69
|
): React.ComponentType<P & SpottableProps>;
|
|
70
70
|
|
|
71
71
|
export function Spottable<P>(
|
|
72
|
-
Component: React.ComponentType<P> | string
|
|
72
|
+
Component: React.ComponentType<P> | string,
|
|
73
73
|
): React.ComponentType<P & SpottableProps>;
|
|
74
74
|
|
|
75
75
|
export default Spottable;
|
package/Spottable/Spottable.js
CHANGED
|
@@ -47,8 +47,8 @@ function _possibleConstructorReturn(self, call) { if (call && (typeof call === "
|
|
|
47
47
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
48
48
|
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; } }
|
|
49
49
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
50
|
-
function ownKeys(
|
|
51
|
-
function _objectSpread(
|
|
50
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
51
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
52
52
|
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; }
|
|
53
53
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
54
54
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
@@ -122,7 +122,7 @@ var defaultConfig = {
|
|
|
122
122
|
* @hoc
|
|
123
123
|
* @returns {Function} Spottable
|
|
124
124
|
*/
|
|
125
|
-
var Spottable = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
125
|
+
var Spottable = exports.Spottable = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
126
126
|
var emulateMouse = config.emulateMouse;
|
|
127
127
|
function SpottableBase(props) {
|
|
128
128
|
var className = props.className,
|
|
@@ -304,6 +304,4 @@ var Spottable = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
304
304
|
}(_react.Component);
|
|
305
305
|
return Spottable;
|
|
306
306
|
});
|
|
307
|
-
exports
|
|
308
|
-
var _default = Spottable;
|
|
309
|
-
exports["default"] = _default;
|
|
307
|
+
var _default = exports["default"] = Spottable;
|
|
@@ -21,8 +21,7 @@ var REMOTE_OK_KEY = 16777221;
|
|
|
21
21
|
* @memberof spotlight/Spottable
|
|
22
22
|
* @public
|
|
23
23
|
*/
|
|
24
|
-
var spottableClass = 'spottable';
|
|
25
|
-
exports.spottableClass = spottableClass;
|
|
24
|
+
var spottableClass = exports.spottableClass = 'spottable';
|
|
26
25
|
var isKeyboardAccessible = function isKeyboardAccessible(node) {
|
|
27
26
|
if (!node) return false;
|
|
28
27
|
var name = node.nodeName.toUpperCase();
|
|
@@ -38,7 +37,7 @@ var lastSelectTarget = null;
|
|
|
38
37
|
|
|
39
38
|
// Should we prevent select being passed through
|
|
40
39
|
var selectCancelled = false;
|
|
41
|
-
var SpottableCore = /*#__PURE__*/function () {
|
|
40
|
+
var SpottableCore = exports.SpottableCore = /*#__PURE__*/function () {
|
|
42
41
|
function SpottableCore(_ref) {
|
|
43
42
|
var _this = this;
|
|
44
43
|
var emulateMouse = _ref.emulateMouse;
|
|
@@ -238,6 +237,4 @@ var SpottableCore = /*#__PURE__*/function () {
|
|
|
238
237
|
}]);
|
|
239
238
|
return SpottableCore;
|
|
240
239
|
}();
|
|
241
|
-
exports
|
|
242
|
-
var _default = SpottableCore;
|
|
243
|
-
exports["default"] = _default;
|
|
240
|
+
var _default = exports["default"] = SpottableCore;
|
|
@@ -5,8 +5,8 @@ var _react = require("@testing-library/react");
|
|
|
5
5
|
var _Spottable = _interopRequireDefault(require("../Spottable"));
|
|
6
6
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
7
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
8
|
-
function ownKeys(
|
|
9
|
-
function _objectSpread(
|
|
8
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
9
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
10
10
|
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; }
|
|
11
11
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
12
12
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
@@ -24,8 +24,8 @@ function _possibleConstructorReturn(self, call) { if (call && (typeof call === "
|
|
|
24
24
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
25
25
|
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; } }
|
|
26
26
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
27
|
-
function ownKeys(
|
|
28
|
-
function _objectSpread(
|
|
27
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
28
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
29
29
|
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; }
|
|
30
30
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
31
31
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
@@ -16,8 +16,8 @@ var _react = require("react");
|
|
|
16
16
|
var _SpottableCore = require("./SpottableCore");
|
|
17
17
|
var _excluded = ["spotRef", "emulateMouse", "selectionKeys", "spotlightDisabled"];
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
-
function ownKeys(
|
|
20
|
-
function _objectSpread(
|
|
19
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
20
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
21
21
|
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; }
|
|
22
22
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
23
23
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
@@ -74,7 +74,7 @@ var REMOTE_OK_KEY = 16777221;
|
|
|
74
74
|
* @private
|
|
75
75
|
*/
|
|
76
76
|
|
|
77
|
-
var useSpottable = function useSpottable() {
|
|
77
|
+
var useSpottable = exports.useSpottable = function useSpottable() {
|
|
78
78
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
79
79
|
spotRef = _ref.spotRef,
|
|
80
80
|
emulateMouse = _ref.emulateMouse,
|
|
@@ -121,6 +121,4 @@ var useSpottable = function useSpottable() {
|
|
|
121
121
|
onMouseLeave: hook.handleLeave
|
|
122
122
|
};
|
|
123
123
|
};
|
|
124
|
-
exports
|
|
125
|
-
var _default = useSpottable;
|
|
126
|
-
exports["default"] = _default;
|
|
124
|
+
var _default = exports["default"] = useSpottable;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enact/spotlight",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.7",
|
|
4
4
|
"description": "A focus management library",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@enact/core": "^4.7.
|
|
27
|
+
"@enact/core": "^4.7.7",
|
|
28
28
|
"classnames": "^2.3.2",
|
|
29
29
|
"prop-types": "^15.8.1",
|
|
30
30
|
"ramda": "^0.29.0",
|
package/src/container.js
CHANGED
|
@@ -37,8 +37,8 @@ var _intersection = _interopRequireDefault(require("ramda/src/intersection"));
|
|
|
37
37
|
var _last = _interopRequireDefault(require("ramda/src/last"));
|
|
38
38
|
var _utils = require("./utils");
|
|
39
39
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
40
|
-
function ownKeys(
|
|
41
|
-
function _objectSpread(
|
|
40
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
41
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
42
42
|
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; }
|
|
43
43
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
44
44
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
@@ -53,15 +53,13 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
53
53
|
* @module spotlight/container
|
|
54
54
|
* @private
|
|
55
55
|
*/
|
|
56
|
-
var containerAttribute = 'data-spotlight-id';
|
|
57
|
-
exports.containerAttribute = containerAttribute;
|
|
56
|
+
var containerAttribute = exports.containerAttribute = 'data-spotlight-id';
|
|
58
57
|
var containerConfigs = new Map();
|
|
59
58
|
var containerKey = 'spotlightId';
|
|
60
59
|
var disabledKey = 'spotlightContainerDisabled';
|
|
61
60
|
var containerPrefix = 'container-';
|
|
62
61
|
var containerSelector = '[data-spotlight-container]';
|
|
63
|
-
var rootContainerId = 'spotlightRootDecorator';
|
|
64
|
-
exports.rootContainerId = rootContainerId;
|
|
62
|
+
var rootContainerId = exports.rootContainerId = 'spotlightRootDecorator';
|
|
65
63
|
var reverseDirections = {
|
|
66
64
|
'left': 'right',
|
|
67
65
|
'up': 'down',
|
|
@@ -197,7 +195,7 @@ var mapContainers = function mapContainers(node, fn) {
|
|
|
197
195
|
* @memberof spotlight/container
|
|
198
196
|
* @private
|
|
199
197
|
*/
|
|
200
|
-
var getContainerConfig = function getContainerConfig(id) {
|
|
198
|
+
var getContainerConfig = exports.getContainerConfig = function getContainerConfig(id) {
|
|
201
199
|
return containerConfigs.get(id);
|
|
202
200
|
};
|
|
203
201
|
|
|
@@ -210,8 +208,7 @@ var getContainerConfig = function getContainerConfig(id) {
|
|
|
210
208
|
* @memberof spotlight/container
|
|
211
209
|
* @private
|
|
212
210
|
*/
|
|
213
|
-
exports.
|
|
214
|
-
var isContainer = function isContainer(nodeOrId) {
|
|
211
|
+
var isContainer = exports.isContainer = function isContainer(nodeOrId) {
|
|
215
212
|
if (typeof nodeOrId === 'string') {
|
|
216
213
|
return containerConfigs.has(nodeOrId);
|
|
217
214
|
}
|
|
@@ -227,7 +224,6 @@ var isContainer = function isContainer(nodeOrId) {
|
|
|
227
224
|
* @memberof spotlight/container
|
|
228
225
|
* @private
|
|
229
226
|
*/
|
|
230
|
-
exports.isContainer = isContainer;
|
|
231
227
|
var isContainerEnabled = function isContainerEnabled(node) {
|
|
232
228
|
return mapContainers(node, function (container) {
|
|
233
229
|
return container.dataset[disabledKey] !== 'true';
|
|
@@ -243,7 +239,7 @@ var isContainerEnabled = function isContainerEnabled(node) {
|
|
|
243
239
|
* @memberof spotlight/container
|
|
244
240
|
* @private
|
|
245
241
|
*/
|
|
246
|
-
var getContainerId = function getContainerId(node) {
|
|
242
|
+
var getContainerId = exports.getContainerId = function getContainerId(node) {
|
|
247
243
|
return node.dataset[containerKey];
|
|
248
244
|
};
|
|
249
245
|
|
|
@@ -256,7 +252,6 @@ var getContainerId = function getContainerId(node) {
|
|
|
256
252
|
* @memberof spotlight/container
|
|
257
253
|
* @private
|
|
258
254
|
*/
|
|
259
|
-
exports.getContainerId = getContainerId;
|
|
260
255
|
var getContainerSelector = function getContainerSelector(node) {
|
|
261
256
|
if (isContainerNode(node)) {
|
|
262
257
|
return "[".concat(containerAttribute, "=\"").concat(getContainerId(node), "\"]");
|
|
@@ -289,7 +284,7 @@ var getSubContainerSelector = function getSubContainerSelector(node) {
|
|
|
289
284
|
* @memberof spotlight/container
|
|
290
285
|
* @private
|
|
291
286
|
*/
|
|
292
|
-
var getContainerNode = function getContainerNode(containerId) {
|
|
287
|
+
var getContainerNode = exports.getContainerNode = function getContainerNode(containerId) {
|
|
293
288
|
if (!containerId) {
|
|
294
289
|
return null;
|
|
295
290
|
} else if (containerId === rootContainerId) {
|
|
@@ -309,7 +304,6 @@ var getContainerNode = function getContainerNode(containerId) {
|
|
|
309
304
|
* @memberof spotlight/container
|
|
310
305
|
* @private
|
|
311
306
|
*/
|
|
312
|
-
exports.getContainerNode = getContainerNode;
|
|
313
307
|
var navigableFilter = function navigableFilter(node, containerId) {
|
|
314
308
|
var nodeStyle = node && (0, _snapshot.isWindowReady)() && window.getComputedStyle(node);
|
|
315
309
|
var config = getContainerConfig(containerId);
|
|
@@ -357,7 +351,7 @@ var getOwnedNodes = function getOwnedNodes(node, selector) {
|
|
|
357
351
|
* @memberof spotlight/container
|
|
358
352
|
* @public
|
|
359
353
|
*/
|
|
360
|
-
var getSpottableDescendants = function getSpottableDescendants(containerId) {
|
|
354
|
+
var getSpottableDescendants = exports.getSpottableDescendants = function getSpottableDescendants(containerId) {
|
|
361
355
|
var node = getContainerNode(containerId);
|
|
362
356
|
|
|
363
357
|
// if it's falsy or is a disabled container, return an empty set
|
|
@@ -390,8 +384,7 @@ var getSpottableDescendants = function getSpottableDescendants(containerId) {
|
|
|
390
384
|
* @memberof spotlight/container
|
|
391
385
|
* @private
|
|
392
386
|
*/
|
|
393
|
-
exports.
|
|
394
|
-
var getDeepSpottableDescendants = function getDeepSpottableDescendants(containerId, excludedContainers) {
|
|
387
|
+
var getDeepSpottableDescendants = exports.getDeepSpottableDescendants = function getDeepSpottableDescendants(containerId, excludedContainers) {
|
|
395
388
|
return getSpottableDescendants(containerId).map(function (n) {
|
|
396
389
|
if (isContainer(n)) {
|
|
397
390
|
var id = getContainerId(n);
|
|
@@ -414,8 +407,7 @@ var getDeepSpottableDescendants = function getDeepSpottableDescendants(container
|
|
|
414
407
|
* @memberof spotlight/container
|
|
415
408
|
* @private
|
|
416
409
|
*/
|
|
417
|
-
exports.
|
|
418
|
-
var isContainer5WayHoldable = function isContainer5WayHoldable(containerId) {
|
|
410
|
+
var isContainer5WayHoldable = exports.isContainer5WayHoldable = function isContainer5WayHoldable(containerId) {
|
|
419
411
|
var config = getContainerConfig(containerId);
|
|
420
412
|
return config && config.continue5WayHold || false;
|
|
421
413
|
};
|
|
@@ -430,7 +422,6 @@ var isContainer5WayHoldable = function isContainer5WayHoldable(containerId) {
|
|
|
430
422
|
* @memberof spotlight/container
|
|
431
423
|
* @private
|
|
432
424
|
*/
|
|
433
|
-
exports.isContainer5WayHoldable = isContainer5WayHoldable;
|
|
434
425
|
function getContainersForNode(node) {
|
|
435
426
|
var containers = mapContainers(node, getContainerId);
|
|
436
427
|
containers.unshift(rootContainerId);
|
|
@@ -525,7 +516,7 @@ var mergeConfig = function mergeConfig(current, updated) {
|
|
|
525
516
|
* @memberof spotlight/container
|
|
526
517
|
* @public
|
|
527
518
|
*/
|
|
528
|
-
var configureContainer = function configureContainer() {
|
|
519
|
+
var configureContainer = exports.configureContainer = function configureContainer() {
|
|
529
520
|
var containerId, config;
|
|
530
521
|
if (typeof (arguments.length <= 0 ? undefined : arguments[0]) === 'object') {
|
|
531
522
|
config = arguments.length <= 0 ? undefined : arguments[0];
|
|
@@ -557,8 +548,7 @@ var configureContainer = function configureContainer() {
|
|
|
557
548
|
* @memberof spotlight/container
|
|
558
549
|
* @public
|
|
559
550
|
*/
|
|
560
|
-
exports.
|
|
561
|
-
var addContainer = function addContainer() {
|
|
551
|
+
var addContainer = exports.addContainer = function addContainer() {
|
|
562
552
|
var containerId = configureContainer.apply(void 0, arguments);
|
|
563
553
|
var config = getContainerConfig(containerId);
|
|
564
554
|
config.active = true;
|
|
@@ -574,8 +564,7 @@ var addContainer = function addContainer() {
|
|
|
574
564
|
* @memberof spotlight/container
|
|
575
565
|
* @public
|
|
576
566
|
*/
|
|
577
|
-
exports.
|
|
578
|
-
var removeContainer = function removeContainer(containerId) {
|
|
567
|
+
var removeContainer = exports.removeContainer = function removeContainer(containerId) {
|
|
579
568
|
containerConfigs["delete"](containerId);
|
|
580
569
|
};
|
|
581
570
|
|
|
@@ -586,8 +575,7 @@ var removeContainer = function removeContainer(containerId) {
|
|
|
586
575
|
* @memberof spotlight/container
|
|
587
576
|
* @public
|
|
588
577
|
*/
|
|
589
|
-
exports.
|
|
590
|
-
var removeAllContainers = function removeAllContainers() {
|
|
578
|
+
var removeAllContainers = exports.removeAllContainers = function removeAllContainers() {
|
|
591
579
|
containerConfigs.clear();
|
|
592
580
|
};
|
|
593
581
|
|
|
@@ -600,8 +588,7 @@ var removeAllContainers = function removeAllContainers() {
|
|
|
600
588
|
* @memberof spotlight/container
|
|
601
589
|
* @public
|
|
602
590
|
*/
|
|
603
|
-
exports.
|
|
604
|
-
var configureDefaults = function configureDefaults(config) {
|
|
591
|
+
var configureDefaults = exports.configureDefaults = function configureDefaults(config) {
|
|
605
592
|
GlobalConfig = mergeConfig(GlobalConfig, config);
|
|
606
593
|
};
|
|
607
594
|
|
|
@@ -616,8 +603,7 @@ var configureDefaults = function configureDefaults(config) {
|
|
|
616
603
|
* @memberof spotlight/container
|
|
617
604
|
* @public
|
|
618
605
|
*/
|
|
619
|
-
exports.
|
|
620
|
-
var isNavigable = function isNavigable(node, containerId, verify) {
|
|
606
|
+
var isNavigable = exports.isNavigable = function isNavigable(node, containerId, verify) {
|
|
621
607
|
if (!node ||
|
|
622
608
|
// jsdom reports all nodes as having no size so we must skip this condition in our tests
|
|
623
609
|
process.env.NODE_ENV !== 'test' && node.offsetWidth <= 0 && node.offsetHeight <= 0) {
|
|
@@ -641,8 +627,7 @@ var isNavigable = function isNavigable(node, containerId, verify) {
|
|
|
641
627
|
* @memberof spotlight/container
|
|
642
628
|
* @private
|
|
643
629
|
*/
|
|
644
|
-
exports.
|
|
645
|
-
var getAllContainerIds = function getAllContainerIds() {
|
|
630
|
+
var getAllContainerIds = exports.getAllContainerIds = function getAllContainerIds() {
|
|
646
631
|
var ids = [];
|
|
647
632
|
var keys = containerConfigs.keys();
|
|
648
633
|
|
|
@@ -666,7 +651,6 @@ var getAllContainerIds = function getAllContainerIds() {
|
|
|
666
651
|
* @memberof spotlight/container
|
|
667
652
|
* @public
|
|
668
653
|
*/
|
|
669
|
-
exports.getAllContainerIds = getAllContainerIds;
|
|
670
654
|
function getContainerDefaultElement(containerId, preferredEnterTo) {
|
|
671
655
|
var config = getContainerConfig(containerId);
|
|
672
656
|
var defaultElementSelector = config && config.defaultElement;
|
package/src/inputType.js
CHANGED
|
@@ -20,17 +20,15 @@ var input = {
|
|
|
20
20
|
touch: false
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
-
var activateInputType = function activateInputType(activated) {
|
|
23
|
+
var activateInputType = exports.activateInputType = function activateInputType(activated) {
|
|
24
24
|
input.activated = activated;
|
|
25
25
|
};
|
|
26
|
-
exports.
|
|
27
|
-
var getInputType = function getInputType() {
|
|
26
|
+
var getInputType = exports.getInputType = function getInputType() {
|
|
28
27
|
return Object.keys(input.types).find(function (type) {
|
|
29
28
|
return input.types[type];
|
|
30
29
|
});
|
|
31
30
|
};
|
|
32
|
-
exports.
|
|
33
|
-
var setInputType = function setInputType(inputType) {
|
|
31
|
+
var setInputType = exports.setInputType = function setInputType(inputType) {
|
|
34
32
|
if (Object.prototype.hasOwnProperty.call(input.types, inputType) && !input.types[inputType]) {
|
|
35
33
|
Object.keys(input.types).map(function (type) {
|
|
36
34
|
input.types[type] = false;
|
|
@@ -39,18 +37,15 @@ var setInputType = function setInputType(inputType) {
|
|
|
39
37
|
input.applied = false;
|
|
40
38
|
}
|
|
41
39
|
};
|
|
42
|
-
exports.
|
|
43
|
-
var applyInputTypeToNode = function applyInputTypeToNode(node) {
|
|
40
|
+
var applyInputTypeToNode = exports.applyInputTypeToNode = function applyInputTypeToNode(node) {
|
|
44
41
|
Object.keys(input.types).map(function (type) {
|
|
45
42
|
node.classList.toggle('spotlight-input-' + type, input.types[type]);
|
|
46
43
|
});
|
|
47
44
|
input.applied = true;
|
|
48
45
|
};
|
|
49
|
-
exports.
|
|
50
|
-
var getInputInfo = function getInputInfo() {
|
|
46
|
+
var getInputInfo = exports.getInputInfo = function getInputInfo() {
|
|
51
47
|
return {
|
|
52
48
|
activated: input.activated,
|
|
53
49
|
applied: input.applied
|
|
54
50
|
};
|
|
55
|
-
};
|
|
56
|
-
exports.getInputInfo = getInputInfo;
|
|
51
|
+
};
|
package/src/navigate.js
CHANGED
package/src/pointer.js
CHANGED
|
@@ -29,7 +29,7 @@ var _pointerMode = true;
|
|
|
29
29
|
* @memberof spotlight/pointer
|
|
30
30
|
* @private
|
|
31
31
|
*/
|
|
32
|
-
var setPointerMode = function setPointerMode(pointerMode) {
|
|
32
|
+
var setPointerMode = exports.setPointerMode = function setPointerMode(pointerMode) {
|
|
33
33
|
_pointerMode = pointerMode;
|
|
34
34
|
};
|
|
35
35
|
|
|
@@ -40,13 +40,11 @@ var setPointerMode = function setPointerMode(pointerMode) {
|
|
|
40
40
|
* @memberof spotlight/pointer
|
|
41
41
|
* @private
|
|
42
42
|
*/
|
|
43
|
-
exports.
|
|
44
|
-
var getPointerMode = function getPointerMode() {
|
|
43
|
+
var getPointerMode = exports.getPointerMode = function getPointerMode() {
|
|
45
44
|
return _pointerMode;
|
|
46
45
|
};
|
|
47
46
|
|
|
48
47
|
// Cached pointer position
|
|
49
|
-
exports.getPointerMode = getPointerMode;
|
|
50
48
|
var _pointerX = null;
|
|
51
49
|
var _pointerY = null;
|
|
52
50
|
|
|
@@ -60,7 +58,7 @@ var _pointerY = null;
|
|
|
60
58
|
* @memberof spotlight/pointer
|
|
61
59
|
* @private
|
|
62
60
|
*/
|
|
63
|
-
var hasPointerMoved = function hasPointerMoved(x, y) {
|
|
61
|
+
var hasPointerMoved = exports.hasPointerMoved = function hasPointerMoved(x, y) {
|
|
64
62
|
return x !== _pointerX || y !== _pointerY;
|
|
65
63
|
};
|
|
66
64
|
|
|
@@ -75,8 +73,7 @@ var hasPointerMoved = function hasPointerMoved(x, y) {
|
|
|
75
73
|
* @memberof spotlight/pointer
|
|
76
74
|
* @private
|
|
77
75
|
*/
|
|
78
|
-
exports.
|
|
79
|
-
var updatePointerPosition = function updatePointerPosition(x, y) {
|
|
76
|
+
var updatePointerPosition = exports.updatePointerPosition = function updatePointerPosition(x, y) {
|
|
80
77
|
// Chrome emits mousemove on scroll, but client coordinates do not change.
|
|
81
78
|
if (hasPointerMoved(x, y)) {
|
|
82
79
|
setPointerMode(true);
|
|
@@ -94,8 +91,7 @@ var updatePointerPosition = function updatePointerPosition(x, y) {
|
|
|
94
91
|
* @memberof spotlight/pointer
|
|
95
92
|
* @private
|
|
96
93
|
*/
|
|
97
|
-
exports.
|
|
98
|
-
var getLastPointerPosition = function getLastPointerPosition() {
|
|
94
|
+
var getLastPointerPosition = exports.getLastPointerPosition = function getLastPointerPosition() {
|
|
99
95
|
return {
|
|
100
96
|
x: _pointerX,
|
|
101
97
|
y: _pointerY
|
|
@@ -106,7 +102,6 @@ var getLastPointerPosition = function getLastPointerPosition() {
|
|
|
106
102
|
// following directional key event to fire, and to prevent momentary spotting of the last
|
|
107
103
|
// focused item - needs to be a value large enough to account for the potentially-trailing
|
|
108
104
|
// event, but not too large that another unrelated event can be fired inside the window
|
|
109
|
-
exports.getLastPointerPosition = getLastPointerPosition;
|
|
110
105
|
var hidePointerJob = new _util.Job(function (callback) {
|
|
111
106
|
setPointerMode(false);
|
|
112
107
|
if (callback) {
|
|
@@ -125,7 +120,7 @@ var hidePointerJob = new _util.Job(function (callback) {
|
|
|
125
120
|
* @memberof spotlight/pointer
|
|
126
121
|
* @private
|
|
127
122
|
*/
|
|
128
|
-
var notifyPointerMove = function notifyPointerMove(current, target, x, y) {
|
|
123
|
+
var notifyPointerMove = exports.notifyPointerMove = function notifyPointerMove(current, target, x, y) {
|
|
129
124
|
var priorPointerMode = getPointerMode();
|
|
130
125
|
if (updatePointerPosition(x, y)) {
|
|
131
126
|
// if we're entering pointer mode and the target element isn't within the currently
|
|
@@ -149,8 +144,7 @@ var notifyPointerMove = function notifyPointerMove(current, target, x, y) {
|
|
|
149
144
|
* @memberof spotlight/pointer
|
|
150
145
|
* @private
|
|
151
146
|
*/
|
|
152
|
-
exports.
|
|
153
|
-
var notifyKeyDown = function notifyKeyDown(keyCode, callback) {
|
|
147
|
+
var notifyKeyDown = exports.notifyKeyDown = function notifyKeyDown(keyCode, callback) {
|
|
154
148
|
var _window$webOSSystem;
|
|
155
149
|
var webOSSystem = (_window$webOSSystem = window.webOSSystem) !== null && _window$webOSSystem !== void 0 ? _window$webOSSystem : window.PalmSystem;
|
|
156
150
|
|
|
@@ -165,5 +159,4 @@ var notifyKeyDown = function notifyKeyDown(keyCode, callback) {
|
|
|
165
159
|
setPointerMode(false);
|
|
166
160
|
}
|
|
167
161
|
return false;
|
|
168
|
-
};
|
|
169
|
-
exports.notifyKeyDown = notifyKeyDown;
|
|
162
|
+
};
|
package/src/spotlight.js
CHANGED
|
@@ -52,10 +52,9 @@ var isUp = (0, _keymap.is)('up');
|
|
|
52
52
|
* @returns {String|false} - One of `'up'`, `'down'`, `'left'`, `'right'` or `false` if not a direction key
|
|
53
53
|
* @public
|
|
54
54
|
*/
|
|
55
|
-
var getDirection = function getDirection(keyCode) {
|
|
55
|
+
var getDirection = exports.getDirection = function getDirection(keyCode) {
|
|
56
56
|
return isDown(keyCode) && 'down' || isLeft(keyCode) && 'left' || isRight(keyCode) && 'right' || isUp(keyCode) && 'up';
|
|
57
57
|
};
|
|
58
|
-
exports.getDirection = getDirection;
|
|
59
58
|
var SpotlightAccelerator = new _Accelerator["default"]();
|
|
60
59
|
|
|
61
60
|
/**
|
|
@@ -78,7 +77,7 @@ var SpotlightAccelerator = new _Accelerator["default"]();
|
|
|
78
77
|
* @memberof spotlight
|
|
79
78
|
* @public
|
|
80
79
|
*/
|
|
81
|
-
var Spotlight = function () {
|
|
80
|
+
var Spotlight = exports.Spotlight = function () {
|
|
82
81
|
'use strict';
|
|
83
82
|
|
|
84
83
|
/*
|
|
@@ -808,6 +807,4 @@ var Spotlight = function () {
|
|
|
808
807
|
};
|
|
809
808
|
return exports;
|
|
810
809
|
}();
|
|
811
|
-
exports
|
|
812
|
-
var _default = Spotlight;
|
|
813
|
-
exports["default"] = _default;
|
|
810
|
+
var _default = exports["default"] = Spotlight;
|
package/src/target.js
CHANGED
|
@@ -16,8 +16,8 @@ var _container = require("./container");
|
|
|
16
16
|
var _navigate = _interopRequireDefault(require("./navigate"));
|
|
17
17
|
var _utils = require("./utils");
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
-
function ownKeys(
|
|
20
|
-
function _objectSpread(
|
|
19
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
20
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
21
21
|
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; }
|
|
22
22
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
23
23
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
@@ -157,51 +157,52 @@ function getTargetInContainerByDirectionFromPosition(direction, containerId, pos
|
|
|
157
157
|
var elementRects = filterRects((0, _utils.getRects)(elements), boundingRect);
|
|
158
158
|
var next = null;
|
|
159
159
|
var _loop = function _loop() {
|
|
160
|
-
|
|
160
|
+
var overlappingContainerId = getContainerContainingRect(elementRects, positionRect);
|
|
161
161
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
162
|
+
// if the pointer is within a container that is a candidate element, we need to ignore container
|
|
163
|
+
// `enterTo` preferences and retrieve its spottable descendants and try to navigate to them.
|
|
164
|
+
if (overlappingContainerId) {
|
|
165
|
+
next = getTargetInContainerByDirectionFromPosition(direction, overlappingContainerId, positionRect, elementContainerIds, boundingRect);
|
|
166
|
+
if (!next) {
|
|
167
|
+
// filter out the container and try again
|
|
168
|
+
elementRects = elementRects.filter(function (rect) {
|
|
169
|
+
return rect.element.dataset.spotlightId !== overlappingContainerId;
|
|
170
|
+
});
|
|
171
|
+
return 0; // continue
|
|
172
|
+
}
|
|
173
173
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
174
|
+
// found a target so break out and return
|
|
175
|
+
return 1; // break
|
|
176
|
+
}
|
|
177
177
|
|
|
178
|
-
|
|
179
|
-
|
|
178
|
+
// try to navigate from position to one of the candidates in containerId
|
|
179
|
+
next = (0, _navigate["default"])(positionRect, direction, elementRects, (0, _container.getContainerConfig)(containerId));
|
|
180
180
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
181
|
+
// if we match a container, recurse into it
|
|
182
|
+
if (next && (0, _container.isContainer)(next)) {
|
|
183
|
+
var nextContainerId = next.dataset.spotlightId;
|
|
184
184
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
185
|
+
// need to cache this reference so we can filter it out later if necessary
|
|
186
|
+
var lastNavigated = next;
|
|
187
|
+
next = getTargetInContainerByDirectionFromPosition(direction, nextContainerId, positionRect, elementContainerIds, getOverflowContainerRect(nextContainerId) || boundingRect);
|
|
188
|
+
if (!next) {
|
|
189
|
+
// filter out the container and try again
|
|
190
|
+
elementRects = elementRects.filter(function (rect) {
|
|
191
|
+
return rect.element !== lastNavigated;
|
|
192
|
+
});
|
|
193
|
+
return 0; // continue
|
|
194
|
+
}
|
|
194
195
|
}
|
|
195
|
-
}
|
|
196
196
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
197
|
+
// If we've met every condition and haven't explicitly retried the search via `continue`,
|
|
198
|
+
// break out and return
|
|
199
|
+
return 1; // break
|
|
200
|
+
},
|
|
201
|
+
_ret;
|
|
201
202
|
while (elementRects.length > 0) {
|
|
202
|
-
|
|
203
|
-
if (_ret ===
|
|
204
|
-
if (_ret ===
|
|
203
|
+
_ret = _loop();
|
|
204
|
+
if (_ret === 0) continue;
|
|
205
|
+
if (_ret === 1) break;
|
|
205
206
|
}
|
|
206
207
|
return next;
|
|
207
208
|
}
|
|
@@ -227,69 +228,70 @@ function getTargetInContainerByDirectionFromElement(direction, containerId, elem
|
|
|
227
228
|
var elementRects = filterRects((0, _utils.getRects)(elements), boundingRect);
|
|
228
229
|
var next = null;
|
|
229
230
|
var _loop2 = function _loop2() {
|
|
230
|
-
|
|
231
|
+
var overlappingContainerId = getContainerContainingRect(elementRects, elementRect);
|
|
231
232
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
233
|
+
// if the next element is a container AND the current element is *visually* contained within
|
|
234
|
+
// one of the candidate elements, we need to ignore container `enterTo` preferences and
|
|
235
|
+
// retrieve its spottable descendants and try to navigate to them.
|
|
236
|
+
if (overlappingContainerId) {
|
|
237
|
+
next = getTargetInContainerByDirectionFromElement(direction, overlappingContainerId, element, elementRect, elementContainerIds, boundingRect);
|
|
238
|
+
if (!next) {
|
|
239
|
+
// filter out the container and try again
|
|
240
|
+
elementRects = elementRects.filter(function (rect) {
|
|
241
|
+
return rect.element.dataset.spotlightId !== overlappingContainerId;
|
|
242
|
+
});
|
|
243
|
+
return 0; // continue
|
|
244
|
+
}
|
|
244
245
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
246
|
+
// found a target so break out and return
|
|
247
|
+
return 1; // break
|
|
248
|
+
}
|
|
248
249
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
250
|
+
// If one of the downstream containers is configured for partition, we use that
|
|
251
|
+
// container's bounds as the partition rect for navigation.
|
|
252
|
+
var partitionContainer = elementContainerIds.slice(elementContainerIds.indexOf(containerId) + 1).find(function (id) {
|
|
253
|
+
var cfg = (0, _container.getContainerConfig)(id);
|
|
254
|
+
return cfg && cfg.partition;
|
|
255
|
+
});
|
|
256
|
+
var partitionRect = elementRect;
|
|
257
|
+
if (partitionContainer) {
|
|
258
|
+
partitionRect = (0, _utils.getContainerRect)(partitionContainer);
|
|
259
|
+
}
|
|
259
260
|
|
|
260
|
-
|
|
261
|
-
|
|
261
|
+
// try to navigate from element to one of the candidates in containerId
|
|
262
|
+
next = (0, _navigate["default"])(elementRect, direction, elementRects, (0, _container.getContainerConfig)(containerId), partitionRect);
|
|
262
263
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
264
|
+
// if we match a container,
|
|
265
|
+
if (next && (0, _container.isContainer)(next)) {
|
|
266
|
+
var nextContainerId = next.dataset.spotlightId;
|
|
266
267
|
|
|
267
|
-
|
|
268
|
-
|
|
268
|
+
// need to cache this reference so we can filter it out later if necessary
|
|
269
|
+
var lastNavigated = next;
|
|
269
270
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
271
|
+
// and it is restricted, return its target
|
|
272
|
+
if (isRestrictedContainer(nextContainerId)) {
|
|
273
|
+
next = getTargetByContainer(nextContainerId);
|
|
274
|
+
} else {
|
|
275
|
+
// otherwise, recurse into it
|
|
276
|
+
next = getTargetInContainerByDirectionFromElement(direction, nextContainerId, element, elementRect, elementContainerIds, getOverflowContainerRect(nextContainerId) || boundingRect);
|
|
277
|
+
}
|
|
278
|
+
if (!next) {
|
|
279
|
+
elementRects = elementRects.filter(function (rect) {
|
|
280
|
+
return rect.element !== lastNavigated;
|
|
281
|
+
});
|
|
282
|
+
return 0; // continue
|
|
283
|
+
}
|
|
282
284
|
}
|
|
283
|
-
}
|
|
284
285
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
286
|
+
// If we've met every condition and haven't explicitly retried the search via `continue`,
|
|
287
|
+
// break out and return
|
|
288
|
+
return 1; // break
|
|
289
|
+
},
|
|
290
|
+
_ret2;
|
|
289
291
|
while (elementRects.length > 0) {
|
|
290
|
-
|
|
291
|
-
if (_ret2 ===
|
|
292
|
-
if (_ret2 ===
|
|
292
|
+
_ret2 = _loop2();
|
|
293
|
+
if (_ret2 === 0) continue;
|
|
294
|
+
if (_ret2 === 1) break;
|
|
293
295
|
}
|
|
294
296
|
return next;
|
|
295
297
|
}
|
|
@@ -425,7 +427,6 @@ var getNearestTargetInContainerFromPosition = function getNearestTargetInContain
|
|
|
425
427
|
});
|
|
426
428
|
return targets[0].target;
|
|
427
429
|
};
|
|
428
|
-
var getNearestTargetFromPosition = function getNearestTargetFromPosition(position, containerId) {
|
|
430
|
+
var getNearestTargetFromPosition = exports.getNearestTargetFromPosition = function getNearestTargetFromPosition(position, containerId) {
|
|
429
431
|
return getNavigableTarget(document.elementFromPoint(position.x, position.y)) || getNearestTargetInContainerFromPosition(position, containerId);
|
|
430
|
-
};
|
|
431
|
-
exports.getNearestTargetFromPosition = getNearestTargetFromPosition;
|
|
432
|
+
};
|
package/src/tests/utils.js
CHANGED
|
@@ -7,14 +7,13 @@ exports.testScenario = exports.spottable = exports.someSpottablesAndContainers =
|
|
|
7
7
|
var _ramda = _interopRequireDefault(require("ramda"));
|
|
8
8
|
var _container = require("../container");
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
10
|
-
function ownKeys(
|
|
11
|
-
function _objectSpread(
|
|
10
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
12
|
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; }
|
|
13
13
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
14
14
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
15
|
-
var join = _ramda["default"].unapply(_ramda["default"].join('\n'));
|
|
16
|
-
exports.
|
|
17
|
-
var testScenario = function testScenario(scenario, callback) {
|
|
15
|
+
var join = exports.join = _ramda["default"].unapply(_ramda["default"].join('\n'));
|
|
16
|
+
var testScenario = exports.testScenario = function testScenario(scenario, callback) {
|
|
18
17
|
return function () {
|
|
19
18
|
var rootId = 'test-root';
|
|
20
19
|
var html = join("<div id=\"".concat(rootId, "\">"), scenario, '</div>');
|
|
@@ -28,12 +27,10 @@ var testScenario = function testScenario(scenario, callback) {
|
|
|
28
27
|
}
|
|
29
28
|
};
|
|
30
29
|
};
|
|
31
|
-
exports.testScenario = testScenario;
|
|
32
30
|
var _id = 1;
|
|
33
|
-
var generateContainerId = function generateContainerId() {
|
|
31
|
+
var generateContainerId = exports.generateContainerId = function generateContainerId() {
|
|
34
32
|
return "".concat(_container.containerAttribute, "=").concat(_id++);
|
|
35
33
|
};
|
|
36
|
-
exports.generateContainerId = generateContainerId;
|
|
37
34
|
var coerceProps = function coerceProps(v) {
|
|
38
35
|
if (typeof v === 'object') {
|
|
39
36
|
return v;
|
|
@@ -43,7 +40,7 @@ var coerceProps = function coerceProps(v) {
|
|
|
43
40
|
};
|
|
44
41
|
}
|
|
45
42
|
};
|
|
46
|
-
var node = function node(props) {
|
|
43
|
+
var node = exports.node = function node(props) {
|
|
47
44
|
var children = '';
|
|
48
45
|
var attributes = '';
|
|
49
46
|
var tag = 'div';
|
|
@@ -62,25 +59,18 @@ var node = function node(props) {
|
|
|
62
59
|
});
|
|
63
60
|
return "<".concat(tag, " ").concat(attributes, ">").concat(children, "</").concat(tag, ">");
|
|
64
61
|
};
|
|
65
|
-
exports.
|
|
66
|
-
var spottable = function spottable(props) {
|
|
62
|
+
var spottable = exports.spottable = function spottable(props) {
|
|
67
63
|
return node(_objectSpread({
|
|
68
64
|
className: 'spottable'
|
|
69
65
|
}, coerceProps(props)));
|
|
70
66
|
};
|
|
71
|
-
exports.
|
|
72
|
-
var container = function container(props) {
|
|
67
|
+
var container = exports.container = function container(props) {
|
|
73
68
|
var _objectSpread2;
|
|
74
69
|
return node(_objectSpread((_objectSpread2 = {}, _defineProperty(_objectSpread2, _container.containerAttribute, _id++), _defineProperty(_objectSpread2, 'data-spotlight-container', true), _objectSpread2), coerceProps(props)));
|
|
75
70
|
};
|
|
76
71
|
|
|
77
72
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
78
|
-
exports.
|
|
79
|
-
var
|
|
80
|
-
exports.
|
|
81
|
-
var
|
|
82
|
-
exports.someSpottables = someSpottables;
|
|
83
|
-
var someContainers = someNodes(container);
|
|
84
|
-
exports.someContainers = someContainers;
|
|
85
|
-
var someSpottablesAndContainers = _ramda["default"].converge(_ramda["default"].concat, [someSpottables, someContainers]);
|
|
86
|
-
exports.someSpottablesAndContainers = someSpottablesAndContainers;
|
|
73
|
+
var someNodes = exports.someNodes = _ramda["default"].useWith(_ramda["default"].compose(_ramda["default"].join('\n'), _ramda["default"].map), [_ramda["default"].identity, _ramda["default"].range(0)]);
|
|
74
|
+
var someSpottables = exports.someSpottables = someNodes(spottable);
|
|
75
|
+
var someContainers = exports.someContainers = someNodes(container);
|
|
76
|
+
var someSpottablesAndContainers = exports.someSpottablesAndContainers = _ramda["default"].converge(_ramda["default"].concat, [someSpottables, someContainers]);
|
package/src/utils.js
CHANGED
|
@@ -23,7 +23,7 @@ var elementMatchesSelector = function elementMatchesSelector(selector) {
|
|
|
23
23
|
if (typeof window === 'object') {
|
|
24
24
|
elementMatchesSelector = window.Element.prototype.matches || window.Element.prototype.matchesSelector || window.Element.prototype.mozMatchesSelector || window.Element.prototype.webkitMatchesSelector || window.Element.prototype.msMatchesSelector || window.Element.prototype.oMatchesSelector || elementMatchesSelector;
|
|
25
25
|
}
|
|
26
|
-
var matchSelector = (0, _curry["default"])(function (selector, elem) {
|
|
26
|
+
var matchSelector = exports.matchSelector = (0, _curry["default"])(function (selector, elem) {
|
|
27
27
|
if (typeof selector === 'string') {
|
|
28
28
|
return elementMatchesSelector.call(elem, selector);
|
|
29
29
|
} else if (typeof selector === 'object' && selector.length) {
|
|
@@ -33,7 +33,6 @@ var matchSelector = (0, _curry["default"])(function (selector, elem) {
|
|
|
33
33
|
}
|
|
34
34
|
return false;
|
|
35
35
|
});
|
|
36
|
-
exports.matchSelector = matchSelector;
|
|
37
36
|
function parseSelector(selector) {
|
|
38
37
|
var result = [];
|
|
39
38
|
try {
|
|
@@ -77,14 +76,12 @@ var testIntersection = function testIntersection(type, containerRect, elementRec
|
|
|
77
76
|
|
|
78
77
|
return true;
|
|
79
78
|
};
|
|
80
|
-
var intersects = (0, _curry["default"])(function (containerRect, elementRect) {
|
|
79
|
+
var intersects = exports.intersects = (0, _curry["default"])(function (containerRect, elementRect) {
|
|
81
80
|
return testIntersection('intersects', containerRect, elementRect);
|
|
82
81
|
});
|
|
83
|
-
exports.
|
|
84
|
-
var contains = (0, _curry["default"])(function (containerRect, elementRect) {
|
|
82
|
+
var contains = exports.contains = (0, _curry["default"])(function (containerRect, elementRect) {
|
|
85
83
|
return testIntersection('contains', containerRect, elementRect);
|
|
86
84
|
});
|
|
87
|
-
exports.contains = contains;
|
|
88
85
|
function getRect(elem) {
|
|
89
86
|
var cr = elem.getBoundingClientRect();
|
|
90
87
|
var rect = {
|