@enact/spotlight 4.7.8 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Accelerator/Accelerator.js +4 -6
- package/CHANGELOG.md +16 -0
- package/Pause/Pause.js +4 -6
- package/Pause/tests/Pause-specs.js +2 -2
- package/README.md +1 -1
- package/SpotlightContainerDecorator/SpotlightContainer.js +6 -8
- package/SpotlightContainerDecorator/SpotlightContainerDecorator.js +9 -12
- package/SpotlightContainerDecorator/tests/SpotlightContainerDecorator-specs.js +4 -4
- package/SpotlightContainerDecorator/tests/useSpotlightContainer-specs.js +4 -4
- package/SpotlightContainerDecorator/useSpotlightContainer.js +2 -2
- package/SpotlightRootDecorator/SpotlightRootDecorator.js +17 -19
- package/SpotlightRootDecorator/tests/SpotlightRootDecorator-specs.js +4 -4
- package/Spottable/Spottable.js +8 -10
- package/Spottable/SpottableCore.js +5 -8
- package/Spottable/tests/Spottable-specs.js +4 -4
- package/Spottable/tests/useSpot-specs.js +6 -6
- package/Spottable/useSpottable.js +6 -8
- package/package.json +5 -4
- package/src/container.js +25 -41
- 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 +98 -98
- package/src/tests/container-specs.js +21 -22
- package/src/tests/spotlight-specs.js +5 -6
- package/src/tests/target-specs.js +14 -16
- package/src/tests/utils.js +15 -26
- package/src/utils.js +3 -7
|
@@ -16,11 +16,11 @@ 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
|
-
function _toPropertyKey(
|
|
23
|
-
function _toPrimitive(
|
|
22
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
23
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
24
24
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
25
25
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
26
26
|
var ENTER_KEY = 13;
|
|
@@ -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.
|
|
3
|
+
"version": "4.8.0",
|
|
4
4
|
"description": "A focus management library",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"main": "src/spotlight.js",
|
|
12
12
|
"scripts": {
|
|
13
13
|
"clean": "enact clean",
|
|
14
|
+
"interlink": "npm link ../core",
|
|
14
15
|
"lint": "enact lint --strict",
|
|
15
16
|
"test": "enact test",
|
|
16
17
|
"test-json": "enact test --json",
|
|
@@ -24,10 +25,10 @@
|
|
|
24
25
|
}
|
|
25
26
|
},
|
|
26
27
|
"dependencies": {
|
|
27
|
-
"@enact/core": "^4.
|
|
28
|
-
"classnames": "^2.
|
|
28
|
+
"@enact/core": "^4.8.0",
|
|
29
|
+
"classnames": "^2.5.1",
|
|
29
30
|
"prop-types": "^15.8.1",
|
|
30
|
-
"ramda": "^0.29.
|
|
31
|
+
"ramda": "^0.29.1",
|
|
31
32
|
"react": "^18.2.0",
|
|
32
33
|
"react-dom": "^18.2.0",
|
|
33
34
|
"warning": "^4.0.3"
|
package/src/container.js
CHANGED
|
@@ -37,31 +37,29 @@ 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
|
-
function _toPropertyKey(
|
|
44
|
-
function _toPrimitive(
|
|
43
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
44
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
45
45
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
46
46
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
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
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
var containerAttribute = 'data-spotlight-id';
|
|
57
|
-
exports.containerAttribute = containerAttribute;
|
|
51
|
+
* Exports methods and members for creating and maintaining spotlight containers.
|
|
52
|
+
*
|
|
53
|
+
* @module spotlight/container
|
|
54
|
+
* @private
|
|
55
|
+
*/
|
|
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;
|