@enact/spotlight 3.4.9-experimental-3 → 3.4.9-experimental-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/{build/Accelerator → Accelerator}/Accelerator.d.ts +0 -0
- package/Accelerator/Accelerator.js +149 -156
- package/CHANGELOG.md +22 -0
- package/{build/Pause → Pause}/Pause.d.ts +0 -0
- package/Pause/Pause.js +102 -80
- package/Pause/tests/Pause-specs.js +65 -97
- package/SpotlightContainerDecorator/SpotlightContainer.js +175 -140
- package/{build/SpotlightContainerDecorator → SpotlightContainerDecorator}/SpotlightContainerDecorator.d.ts +0 -0
- package/SpotlightContainerDecorator/SpotlightContainerDecorator.js +222 -176
- package/SpotlightContainerDecorator/tests/Element.prototype.closest.js +44 -40
- package/SpotlightContainerDecorator/tests/SpotlightContainerDecorator-specs.js +221 -210
- package/SpotlightContainerDecorator/tests/useSpotlightContainer-specs.js +150 -243
- package/SpotlightContainerDecorator/useSpotlightContainer.js +47 -28
- package/{build/SpotlightRootDecorator → SpotlightRootDecorator}/SpotlightRootDecorator.d.ts +0 -0
- package/SpotlightRootDecorator/SpotlightRootDecorator.js +206 -111
- package/{build/Spottable → Spottable}/Spottable.d.ts +0 -0
- package/Spottable/Spottable.js +448 -410
- package/Spottable/tests/Spottable-specs.js +90 -117
- package/package.json +3 -2
- package/src/container.js +718 -653
- package/src/navigate.js +406 -491
- package/src/pointer.js +86 -78
- package/{build/src → src}/spotlight.d.ts +0 -0
- package/src/spotlight.js +846 -885
- package/src/target.js +448 -474
- package/src/tests/container-specs.js +643 -1251
- package/src/tests/navigate-specs.js +77 -134
- package/src/tests/pointer-specs.js +126 -182
- package/src/tests/spotlight-specs.js +103 -133
- package/src/tests/target-specs.js +597 -960
- package/src/tests/utils.js +89 -67
- package/src/utils.js +155 -158
- package/build/Accelerator/Accelerator.js +0 -162
- package/build/Accelerator/package.json +0 -3
- package/build/CHANGELOG.md +0 -838
- package/build/Pause/Pause.js +0 -164
- package/build/Pause/package.json +0 -3
- package/build/Pause/tests/Pause-specs.js +0 -65
- package/build/README.md +0 -61
- package/build/SpotlightContainerDecorator/SpotlightContainer.js +0 -176
- package/build/SpotlightContainerDecorator/SpotlightContainerDecorator.js +0 -282
- package/build/SpotlightContainerDecorator/package.json +0 -3
- package/build/SpotlightContainerDecorator/tests/Element.prototype.closest.js +0 -45
- package/build/SpotlightContainerDecorator/tests/SpotlightContainerDecorator-specs.js +0 -221
- package/build/SpotlightContainerDecorator/tests/useSpotlightContainer-specs.js +0 -160
- package/build/SpotlightContainerDecorator/useSpotlightContainer.js +0 -133
- package/build/SpotlightRootDecorator/SpotlightRootDecorator.js +0 -189
- package/build/SpotlightRootDecorator/package.json +0 -3
- package/build/Spottable/Spottable.js +0 -491
- package/build/Spottable/package.json +0 -3
- package/build/Spottable/tests/Spottable-specs.js +0 -90
- package/build/package-lock.json +0 -229
- package/build/package.json +0 -28
- package/build/src/container.js +0 -1201
- package/build/src/navigate.js +0 -419
- package/build/src/pointer.js +0 -183
- package/build/src/spotlight.js +0 -896
- package/build/src/target.js +0 -507
- package/build/src/tests/container-specs.js +0 -653
- package/build/src/tests/navigate-specs.js +0 -87
- package/build/src/tests/pointer-specs.js +0 -130
- package/build/src/tests/spotlight-specs.js +0 -112
- package/build/src/tests/target-specs.js +0 -614
- package/build/src/tests/utils.js +0 -104
- package/build/src/utils.js +0 -180
- package/build/styles/debug.less +0 -97
- package/build/styles/mixins.less +0 -63
- package/docs/index.md +0 -364
|
@@ -1,97 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
test(
|
|
69
|
-
'should not report paused when the global Spotlight is paused',
|
|
70
|
-
() => {
|
|
71
|
-
const subject = new Pause();
|
|
72
|
-
|
|
73
|
-
pause();
|
|
74
|
-
subject.pause();
|
|
75
|
-
|
|
76
|
-
const expected = NOT_PAUSED;
|
|
77
|
-
const actual = subject.isPaused() ? PAUSED : NOT_PAUSED;
|
|
78
|
-
|
|
79
|
-
resume();
|
|
80
|
-
|
|
81
|
-
expect(actual).toBe(expected);
|
|
82
|
-
}
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
test('should allow the global Spotlight to resume', () => {
|
|
86
|
-
const subject = new Pause();
|
|
87
|
-
|
|
88
|
-
subject.pause();
|
|
89
|
-
resume();
|
|
90
|
-
|
|
91
|
-
const expected = NOT_PAUSED;
|
|
92
|
-
const actual = isPaused() ? PAUSED : NOT_PAUSED;
|
|
93
|
-
|
|
94
|
-
expect(actual).toBe(expected);
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
});
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _Pause = _interopRequireWildcard(require("../Pause"));
|
|
4
|
+
|
|
5
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
6
|
+
|
|
7
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
8
|
+
|
|
9
|
+
var PAUSED = 'Paused';
|
|
10
|
+
var NOT_PAUSED = 'Not Paused';
|
|
11
|
+
describe('Pause', function () {
|
|
12
|
+
test('should pause spotlight', function () {
|
|
13
|
+
var subject = new _Pause["default"]();
|
|
14
|
+
subject.pause();
|
|
15
|
+
var expected = PAUSED;
|
|
16
|
+
var actual = (0, _Pause.isPaused)() ? PAUSED : NOT_PAUSED;
|
|
17
|
+
subject.resume();
|
|
18
|
+
expect(actual).toBe(expected);
|
|
19
|
+
});
|
|
20
|
+
test('should resume spotlight', function () {
|
|
21
|
+
var subject = new _Pause["default"]();
|
|
22
|
+
subject.pause();
|
|
23
|
+
subject.resume();
|
|
24
|
+
var expected = NOT_PAUSED;
|
|
25
|
+
var actual = (0, _Pause.isPaused)() ? PAUSED : NOT_PAUSED;
|
|
26
|
+
expect(actual).toBe(expected);
|
|
27
|
+
});
|
|
28
|
+
test('should not resume spotlight when another Paused instance is in control', function () {
|
|
29
|
+
var subject = new _Pause["default"]();
|
|
30
|
+
var another = new _Pause["default"]();
|
|
31
|
+
another.pause();
|
|
32
|
+
subject.pause();
|
|
33
|
+
var expected = PAUSED;
|
|
34
|
+
var actual = (0, _Pause.isPaused)() ? PAUSED : NOT_PAUSED;
|
|
35
|
+
another.resume();
|
|
36
|
+
expect(actual).toBe(expected);
|
|
37
|
+
});
|
|
38
|
+
test('should not report paused when another Paused instance is in control', function () {
|
|
39
|
+
var subject = new _Pause["default"]();
|
|
40
|
+
var another = new _Pause["default"]();
|
|
41
|
+
another.pause();
|
|
42
|
+
subject.pause();
|
|
43
|
+
var expected = NOT_PAUSED;
|
|
44
|
+
var actual = subject.isPaused() ? PAUSED : NOT_PAUSED;
|
|
45
|
+
another.resume();
|
|
46
|
+
expect(actual).toBe(expected);
|
|
47
|
+
});
|
|
48
|
+
test('should not report paused when the global Spotlight is paused', function () {
|
|
49
|
+
var subject = new _Pause["default"]();
|
|
50
|
+
(0, _Pause.pause)();
|
|
51
|
+
subject.pause();
|
|
52
|
+
var expected = NOT_PAUSED;
|
|
53
|
+
var actual = subject.isPaused() ? PAUSED : NOT_PAUSED;
|
|
54
|
+
(0, _Pause.resume)();
|
|
55
|
+
expect(actual).toBe(expected);
|
|
56
|
+
});
|
|
57
|
+
test('should allow the global Spotlight to resume', function () {
|
|
58
|
+
var subject = new _Pause["default"]();
|
|
59
|
+
subject.pause();
|
|
60
|
+
(0, _Pause.resume)();
|
|
61
|
+
var expected = NOT_PAUSED;
|
|
62
|
+
var actual = (0, _Pause.isPaused)() ? PAUSED : NOT_PAUSED;
|
|
63
|
+
expect(actual).toBe(expected);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
@@ -1,141 +1,176 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
// Used to indicate that we want to stop propagation on blur events that occur as a
|
|
33
|
-
// result of this component imperatively blurring itself on focus when spotlightDisabled
|
|
34
|
-
this.shouldPreventBlur = false;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
get attributes () {
|
|
38
|
-
return this.attr;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
setProps (props) {
|
|
42
|
-
const {disabled, id, muted, restrict} = props;
|
|
43
|
-
this.props = props;
|
|
44
|
-
|
|
45
|
-
if (this.id == null || (id && this.id !== id)) {
|
|
46
|
-
if (this.id) {
|
|
47
|
-
this.releaseContainer(this.id);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
this.id = Spotlight.add({
|
|
51
|
-
...this.config,
|
|
52
|
-
id,
|
|
53
|
-
restrict,
|
|
54
|
-
navigableFilter: this.navigableFilter
|
|
55
|
-
});
|
|
56
|
-
this.preserveId = this.canPreserveId && this.id === id;
|
|
57
|
-
} else {
|
|
58
|
-
Spotlight.set(this.id, {restrict});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
this.attr['data-spotlight-id'] = this.id;
|
|
62
|
-
this.attr['data-spotlight-container-disabled'] = disabled;
|
|
63
|
-
this.attr['data-spotlight-container-muted'] = muted;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
unload () {
|
|
67
|
-
this.releaseContainer();
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
releaseContainer () {
|
|
71
|
-
if (this.preserveId) {
|
|
72
|
-
Spotlight.unmount(this.id);
|
|
73
|
-
} else {
|
|
74
|
-
Spotlight.remove(this.id);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
navigableFilter = (elem) => {
|
|
79
|
-
// If the component to which this was applied specified a navigableFilter, run it
|
|
80
|
-
if (typeof this.filter === 'function') {
|
|
81
|
-
if (this.filter(elem) === false) {
|
|
82
|
-
return false;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return true;
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
silentBlur ({target}) {
|
|
90
|
-
this.shouldPreventBlur = true;
|
|
91
|
-
target.blur();
|
|
92
|
-
this.shouldPreventBlur = false;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
onBlurCapture = (ev) => {
|
|
96
|
-
if (this.shouldPreventBlur) {
|
|
97
|
-
stop(ev);
|
|
98
|
-
|
|
99
|
-
return false;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return true;
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
onFocusCapture = (ev) => {
|
|
106
|
-
if (this.props.disabled === true) {
|
|
107
|
-
stop(ev);
|
|
108
|
-
this.silentBlur(ev);
|
|
109
|
-
|
|
110
|
-
return false;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
return true;
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
onPointerEnter = handle(
|
|
117
|
-
isNewPointerPosition,
|
|
118
|
-
() => Spotlight.setActiveContainer(this.id)
|
|
119
|
-
).bindAs(this, 'onPointerEnter');
|
|
120
|
-
|
|
121
|
-
onPointerLeave = handle(
|
|
122
|
-
not(forProp('restrict', 'self-only')),
|
|
123
|
-
isNewPointerPosition,
|
|
124
|
-
(ev) => {
|
|
125
|
-
const parentContainer = ev.currentTarget.parentNode.closest('[data-spotlight-container]');
|
|
126
|
-
let activeContainer = Spotlight.getActiveContainer();
|
|
127
|
-
|
|
128
|
-
// if this container is wrapped by another and this is the currently active
|
|
129
|
-
// container, move the active container to the parent
|
|
130
|
-
if (parentContainer && activeContainer === this.id) {
|
|
131
|
-
activeContainer = parentContainer.dataset.spotlightId;
|
|
132
|
-
Spotlight.setActiveContainer(activeContainer);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
).bindAs(this, 'onPointerLeave');
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export default SpotlightContainer;
|
|
139
|
-
export {
|
|
140
|
-
SpotlightContainer
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SpotlightContainer = exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _handle = require("@enact/core/handle");
|
|
9
|
+
|
|
10
|
+
var _pointer = require("../src/pointer");
|
|
11
|
+
|
|
12
|
+
var _spotlight = _interopRequireDefault(require("../src/spotlight"));
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
+
|
|
16
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
17
|
+
|
|
18
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
19
|
+
|
|
20
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
21
|
+
|
|
22
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
23
|
+
|
|
24
|
+
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, descriptor.key, descriptor); } }
|
|
25
|
+
|
|
26
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
27
|
+
|
|
28
|
+
var isNewPointerPosition = function isNewPointerPosition(ev) {
|
|
29
|
+
return (0, _pointer.hasPointerMoved)(ev.clientX, ev.clientY);
|
|
141
30
|
};
|
|
31
|
+
|
|
32
|
+
var SpotlightContainer = /*#__PURE__*/function () {
|
|
33
|
+
// set up context and props so we can use handle binding
|
|
34
|
+
function SpotlightContainer(_ref) {
|
|
35
|
+
var _this = this;
|
|
36
|
+
|
|
37
|
+
var containerConfig = _ref.containerConfig,
|
|
38
|
+
navigableFilter = _ref.navigableFilter,
|
|
39
|
+
preserveId = _ref.preserveId;
|
|
40
|
+
|
|
41
|
+
_classCallCheck(this, SpotlightContainer);
|
|
42
|
+
|
|
43
|
+
this.context = {};
|
|
44
|
+
this.props = {};
|
|
45
|
+
|
|
46
|
+
this.navigableFilter = function (elem) {
|
|
47
|
+
// If the component to which this was applied specified a navigableFilter, run it
|
|
48
|
+
if (typeof _this.filter === 'function') {
|
|
49
|
+
if (_this.filter(elem) === false) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return true;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
this.onBlurCapture = function (ev) {
|
|
58
|
+
if (_this.shouldPreventBlur) {
|
|
59
|
+
(0, _handle.stop)(ev);
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return true;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
this.onFocusCapture = function (ev) {
|
|
67
|
+
if (_this.props.disabled === true) {
|
|
68
|
+
(0, _handle.stop)(ev);
|
|
69
|
+
|
|
70
|
+
_this.silentBlur(ev);
|
|
71
|
+
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return true;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
this.onPointerEnter = (0, _handle.handle)(isNewPointerPosition, function () {
|
|
79
|
+
return _spotlight["default"].setActiveContainer(_this.id);
|
|
80
|
+
}).bindAs(this, 'onPointerEnter');
|
|
81
|
+
this.onPointerLeave = (0, _handle.handle)((0, _handle.not)((0, _handle.forProp)('restrict', 'self-only')), isNewPointerPosition, function (ev) {
|
|
82
|
+
var parentContainer = ev.currentTarget.parentNode.closest('[data-spotlight-container]');
|
|
83
|
+
|
|
84
|
+
var activeContainer = _spotlight["default"].getActiveContainer(); // if this container is wrapped by another and this is the currently active
|
|
85
|
+
// container, move the active container to the parent
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
if (parentContainer && activeContainer === _this.id) {
|
|
89
|
+
activeContainer = parentContainer.dataset.spotlightId;
|
|
90
|
+
|
|
91
|
+
_spotlight["default"].setActiveContainer(activeContainer);
|
|
92
|
+
}
|
|
93
|
+
}).bindAs(this, 'onPointerLeave');
|
|
94
|
+
// spotlight id - set either via props or generated by Spotlight
|
|
95
|
+
this.id = null; // Preserve the spotlight id across instances when it is set via props and preserveId is set
|
|
96
|
+
|
|
97
|
+
this.canPreserveId = preserveId;
|
|
98
|
+
this.preserveId = false; // container config - set once when the container is added
|
|
99
|
+
|
|
100
|
+
this.config = containerConfig; // optional filter function to limit the spottable candidates for this container
|
|
101
|
+
|
|
102
|
+
this.filter = navigableFilter; // private hash of spotlight DOM attributes
|
|
103
|
+
|
|
104
|
+
this.attr = {
|
|
105
|
+
'data-spotlight-container': true
|
|
106
|
+
}; // Used to indicate that we want to stop propagation on blur events that occur as a
|
|
107
|
+
// result of this component imperatively blurring itself on focus when spotlightDisabled
|
|
108
|
+
|
|
109
|
+
this.shouldPreventBlur = false;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
_createClass(SpotlightContainer, [{
|
|
113
|
+
key: "setProps",
|
|
114
|
+
value: function setProps(props) {
|
|
115
|
+
var disabled = props.disabled,
|
|
116
|
+
id = props.id,
|
|
117
|
+
muted = props.muted,
|
|
118
|
+
restrict = props.restrict;
|
|
119
|
+
this.props = props;
|
|
120
|
+
|
|
121
|
+
if (this.id == null || id && this.id !== id) {
|
|
122
|
+
if (this.id) {
|
|
123
|
+
this.releaseContainer(this.id);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
this.id = _spotlight["default"].add(_objectSpread(_objectSpread({}, this.config), {}, {
|
|
127
|
+
id: id,
|
|
128
|
+
restrict: restrict,
|
|
129
|
+
navigableFilter: this.navigableFilter
|
|
130
|
+
}));
|
|
131
|
+
this.preserveId = this.canPreserveId && this.id === id;
|
|
132
|
+
} else {
|
|
133
|
+
_spotlight["default"].set(this.id, {
|
|
134
|
+
restrict: restrict
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
this.attr['data-spotlight-id'] = this.id;
|
|
139
|
+
this.attr['data-spotlight-container-disabled'] = disabled;
|
|
140
|
+
this.attr['data-spotlight-container-muted'] = muted;
|
|
141
|
+
}
|
|
142
|
+
}, {
|
|
143
|
+
key: "unload",
|
|
144
|
+
value: function unload() {
|
|
145
|
+
this.releaseContainer();
|
|
146
|
+
}
|
|
147
|
+
}, {
|
|
148
|
+
key: "releaseContainer",
|
|
149
|
+
value: function releaseContainer() {
|
|
150
|
+
if (this.preserveId) {
|
|
151
|
+
_spotlight["default"].unmount(this.id);
|
|
152
|
+
} else {
|
|
153
|
+
_spotlight["default"].remove(this.id);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}, {
|
|
157
|
+
key: "silentBlur",
|
|
158
|
+
value: function silentBlur(_ref2) {
|
|
159
|
+
var target = _ref2.target;
|
|
160
|
+
this.shouldPreventBlur = true;
|
|
161
|
+
target.blur();
|
|
162
|
+
this.shouldPreventBlur = false;
|
|
163
|
+
}
|
|
164
|
+
}, {
|
|
165
|
+
key: "attributes",
|
|
166
|
+
get: function get() {
|
|
167
|
+
return this.attr;
|
|
168
|
+
}
|
|
169
|
+
}]);
|
|
170
|
+
|
|
171
|
+
return SpotlightContainer;
|
|
172
|
+
}();
|
|
173
|
+
|
|
174
|
+
exports.SpotlightContainer = SpotlightContainer;
|
|
175
|
+
var _default = SpotlightContainer;
|
|
176
|
+
exports["default"] = _default;
|
|
File without changes
|