@angular/cdk 9.2.1 → 9.2.2
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/a11y/focus-monitor/focus-monitor.d.ts +10 -3
- package/a11y/high-contrast-mode/high-contrast-mode-detector.d.ts +2 -2
- package/a11y/index.metadata.json +1 -1
- package/bundles/cdk-a11y.umd.js +62 -27
- package/bundles/cdk-a11y.umd.js.map +1 -1
- package/bundles/cdk-a11y.umd.min.js +12 -5
- package/bundles/cdk-a11y.umd.min.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.js +193 -109
- package/bundles/cdk-drag-drop.umd.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.min.js +17 -10
- package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
- package/bundles/cdk-overlay.umd.js.map +1 -1
- package/bundles/cdk-platform.umd.js +3 -1
- package/bundles/cdk-platform.umd.js.map +1 -1
- package/bundles/cdk-platform.umd.min.js +4 -4
- package/bundles/cdk-platform.umd.min.js.map +1 -1
- package/bundles/cdk-scrolling.umd.js +18 -3
- package/bundles/cdk-scrolling.umd.js.map +1 -1
- package/bundles/cdk-scrolling.umd.min.js +2 -2
- package/bundles/cdk-scrolling.umd.min.js.map +1 -1
- package/bundles/cdk-testing-testbed.umd.js +62 -10
- package/bundles/cdk-testing-testbed.umd.js.map +1 -1
- package/bundles/cdk-testing-testbed.umd.min.js +5 -5
- package/bundles/cdk-testing-testbed.umd.min.js.map +1 -1
- package/bundles/cdk-tree.umd.js +1 -0
- package/bundles/cdk-tree.umd.js.map +1 -1
- package/bundles/cdk-tree.umd.min.js +1 -1
- package/bundles/cdk-tree.umd.min.js.map +1 -1
- package/bundles/cdk.umd.js +1 -1
- package/bundles/cdk.umd.js.map +1 -1
- package/bundles/cdk.umd.min.js +1 -1
- package/bundles/cdk.umd.min.js.map +1 -1
- package/drag-drop/drag-ref.d.ts +4 -2
- package/drag-drop/drop-list-ref.d.ts +9 -8
- package/drag-drop/index.metadata.json +1 -1
- package/drag-drop/parent-position-tracker.d.ts +31 -0
- package/drag-drop/public-api.d.ts +1 -1
- package/esm2015/a11y/aria-describer/aria-reference.js +6 -6
- package/esm2015/a11y/focus-monitor/focus-monitor.js +84 -26
- package/esm2015/a11y/high-contrast-mode/high-contrast-mode-detector.js +3 -3
- package/esm2015/drag-drop/drag-drop-module.js +3 -1
- package/esm2015/drag-drop/drag-ref.js +55 -35
- package/esm2015/drag-drop/drop-list-ref.js +115 -124
- package/esm2015/drag-drop/parent-position-tracker.js +141 -0
- package/esm2015/drag-drop/public-api.js +1 -1
- package/esm2015/overlay/position/flexible-connected-position-strategy.js +1 -1
- package/esm2015/platform/features/shadow-dom.js +4 -2
- package/esm2015/scrolling/public-api.js +2 -2
- package/esm2015/scrolling/scrolling-module.js +15 -4
- package/esm2015/testing/testbed/fake-events/dispatch-events.js +11 -4
- package/esm2015/testing/testbed/fake-events/event-objects.js +37 -3
- package/esm2015/testing/testbed/unit-test-element.js +13 -2
- package/esm2015/tree/tree.js +2 -1
- package/esm2015/version.js +1 -1
- package/esm5/a11y/aria-describer/aria-reference.js +6 -6
- package/esm5/a11y/focus-monitor/focus-monitor.js +57 -22
- package/esm5/a11y/high-contrast-mode/high-contrast-mode-detector.js +3 -3
- package/esm5/drag-drop/drag-drop-module.js +3 -1
- package/esm5/drag-drop/drag-ref.js +39 -26
- package/esm5/drag-drop/drop-list-ref.js +85 -86
- package/esm5/drag-drop/parent-position-tracker.js +74 -0
- package/esm5/drag-drop/public-api.js +1 -1
- package/esm5/overlay/position/flexible-connected-position-strategy.js +1 -1
- package/esm5/platform/features/shadow-dom.js +4 -2
- package/esm5/scrolling/scrolling-module.js +19 -4
- package/esm5/testing/testbed/fake-events/dispatch-events.js +15 -7
- package/esm5/testing/testbed/fake-events/event-objects.js +43 -5
- package/esm5/testing/testbed/unit-test-element.js +10 -3
- package/esm5/tree/tree.js +2 -1
- package/esm5/version.js +1 -1
- package/fesm2015/a11y.js +90 -32
- package/fesm2015/a11y.js.map +1 -1
- package/fesm2015/cdk.js +1 -1
- package/fesm2015/cdk.js.map +1 -1
- package/fesm2015/drag-drop.js +302 -158
- package/fesm2015/drag-drop.js.map +1 -1
- package/fesm2015/overlay.js.map +1 -1
- package/fesm2015/platform.js +3 -1
- package/fesm2015/platform.js.map +1 -1
- package/fesm2015/scrolling.js +15 -4
- package/fesm2015/scrolling.js.map +1 -1
- package/fesm2015/testing/testbed.js +56 -4
- package/fesm2015/testing/testbed.js.map +1 -1
- package/fesm2015/tree.js +1 -0
- package/fesm2015/tree.js.map +1 -1
- package/fesm5/a11y.js +63 -28
- package/fesm5/a11y.js.map +1 -1
- package/fesm5/cdk.js +1 -1
- package/fesm5/cdk.js.map +1 -1
- package/fesm5/drag-drop.js +195 -111
- package/fesm5/drag-drop.js.map +1 -1
- package/fesm5/overlay.js.map +1 -1
- package/fesm5/platform.js +3 -1
- package/fesm5/platform.js.map +1 -1
- package/fesm5/scrolling.js +18 -4
- package/fesm5/scrolling.js.map +1 -1
- package/fesm5/testing/testbed.js +63 -11
- package/fesm5/testing/testbed.js.map +1 -1
- package/fesm5/tree.js +1 -0
- package/fesm5/tree.js.map +1 -1
- package/overlay/position/flexible-connected-position-strategy.d.ts +1 -1
- package/package.json +1 -1
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-update/devkit-file-system.d.ts +29 -0
- package/schematics/ng-update/devkit-file-system.js +67 -0
- package/schematics/ng-update/devkit-migration-rule.d.ts +25 -0
- package/schematics/ng-update/devkit-migration-rule.js +152 -0
- package/schematics/ng-update/devkit-migration.d.ts +37 -0
- package/schematics/ng-update/devkit-migration.js +29 -0
- package/schematics/ng-update/index.js +7 -7
- package/schematics/ng-update/{upgrade-rules/attribute-selectors-rule.d.ts → migrations/attribute-selectors.d.ts} +6 -6
- package/schematics/ng-update/migrations/attribute-selectors.js +76 -0
- package/schematics/ng-update/{upgrade-rules/class-inheritance-rule.d.ts → migrations/class-inheritance.d.ts} +6 -6
- package/schematics/ng-update/migrations/class-inheritance.js +67 -0
- package/schematics/ng-update/{upgrade-rules/class-names-rule.d.ts → migrations/class-names.d.ts} +6 -6
- package/schematics/ng-update/migrations/class-names.js +98 -0
- package/schematics/ng-update/{upgrade-rules/constructor-signature-rule.d.ts → migrations/constructor-signature.d.ts} +6 -6
- package/schematics/ng-update/migrations/constructor-signature.js +144 -0
- package/schematics/ng-update/{upgrade-rules/css-selectors-rule.d.ts → migrations/css-selectors.d.ts} +6 -6
- package/schematics/ng-update/migrations/css-selectors.js +83 -0
- package/schematics/ng-update/{upgrade-rules/element-selectors-rule.d.ts → migrations/element-selectors.d.ts} +6 -6
- package/schematics/ng-update/migrations/element-selectors.js +74 -0
- package/schematics/ng-update/{upgrade-rules/input-names-rule.d.ts → migrations/input-names.d.ts} +6 -6
- package/schematics/ng-update/migrations/input-names.js +69 -0
- package/schematics/ng-update/{upgrade-rules/method-call-arguments-rule.d.ts → migrations/method-call-arguments.d.ts} +6 -6
- package/schematics/ng-update/migrations/method-call-arguments.js +70 -0
- package/schematics/ng-update/{upgrade-rules/misc-template-rule.d.ts → migrations/misc-template.d.ts} +6 -6
- package/schematics/ng-update/migrations/misc-template.js +47 -0
- package/schematics/ng-update/{upgrade-rules/output-names-rule.d.ts → migrations/output-names.d.ts} +6 -6
- package/schematics/ng-update/migrations/output-names.js +56 -0
- package/schematics/ng-update/{upgrade-rules/property-names-rule.d.ts → migrations/property-names.d.ts} +6 -6
- package/schematics/ng-update/migrations/property-names.js +56 -0
- package/schematics/ng-update/public-api.d.ts +3 -2
- package/schematics/ng-update/public-api.js +5 -4
- package/schematics/ng-update/upgrade-data.d.ts +7 -8
- package/schematics/ng-update/upgrade-data.js +6 -7
- package/schematics/update-tool/component-resource-collector.d.ts +3 -1
- package/schematics/update-tool/component-resource-collector.js +8 -8
- package/schematics/update-tool/file-system.d.ts +38 -0
- package/schematics/update-tool/file-system.js +20 -0
- package/schematics/update-tool/index.d.ts +41 -11
- package/schematics/update-tool/index.js +135 -106
- package/schematics/update-tool/logger.d.ts +16 -0
- package/schematics/update-tool/logger.js +27 -0
- package/schematics/update-tool/{migration-rule.d.ts → migration.d.ts} +23 -45
- package/schematics/update-tool/migration.js +76 -0
- package/schematics/update-tool/public-api.d.ts +5 -4
- package/schematics/update-tool/public-api.js +6 -6
- package/schematics/update-tool/update-recorder.d.ts +14 -0
- package/schematics/update-tool/update-recorder.js +20 -0
- package/schematics/update-tool/utils/parse-tsconfig.js +1 -1
- package/schematics/update-tool/version-changes.js +3 -4
- package/scrolling/index.metadata.json +1 -1
- package/scrolling/scrolling-module.d.ts +2 -0
- package/testing/testbed/fake-events/dispatch-events.d.ts +8 -3
- package/testing/testbed/fake-events/event-objects.d.ts +12 -1
- package/tree/index.metadata.json +1 -1
- package/schematics/ng-update/upgrade-rules/attribute-selectors-rule.js +0 -76
- package/schematics/ng-update/upgrade-rules/class-inheritance-rule.js +0 -67
- package/schematics/ng-update/upgrade-rules/class-names-rule.js +0 -98
- package/schematics/ng-update/upgrade-rules/constructor-signature-rule.js +0 -144
- package/schematics/ng-update/upgrade-rules/css-selectors-rule.js +0 -83
- package/schematics/ng-update/upgrade-rules/element-selectors-rule.js +0 -74
- package/schematics/ng-update/upgrade-rules/index.d.ts +0 -22
- package/schematics/ng-update/upgrade-rules/index.js +0 -116
- package/schematics/ng-update/upgrade-rules/input-names-rule.js +0 -69
- package/schematics/ng-update/upgrade-rules/method-call-arguments-rule.js +0 -70
- package/schematics/ng-update/upgrade-rules/misc-template-rule.js +0 -47
- package/schematics/ng-update/upgrade-rules/output-names-rule.js +0 -56
- package/schematics/ng-update/upgrade-rules/property-names-rule.js +0 -56
- package/schematics/update-tool/migration-rule.js +0 -101
package/fesm5/a11y.js
CHANGED
|
@@ -5,7 +5,7 @@ import { Subject, Subscription, of } from 'rxjs';
|
|
|
5
5
|
import { hasModifierKey, A, Z, ZERO, NINE, LEFT_ARROW, RIGHT_ARROW, UP_ARROW, DOWN_ARROW, TAB } from '@angular/cdk/keycodes';
|
|
6
6
|
import { tap, debounceTime, filter, map, take } from 'rxjs/operators';
|
|
7
7
|
import { coerceBooleanProperty, coerceElement } from '@angular/cdk/coercion';
|
|
8
|
-
import { Platform, normalizePassiveListenerOptions, PlatformModule } from '@angular/cdk/platform';
|
|
8
|
+
import { Platform, normalizePassiveListenerOptions, _getShadowRoot, PlatformModule } from '@angular/cdk/platform';
|
|
9
9
|
import { ContentObserver, ObserversModule } from '@angular/cdk/observers';
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -15,8 +15,8 @@ import { ContentObserver, ObserversModule } from '@angular/cdk/observers';
|
|
|
15
15
|
* Use of this source code is governed by an MIT-style license that can be
|
|
16
16
|
* found in the LICENSE file at https://angular.io/license
|
|
17
17
|
*/
|
|
18
|
-
/** IDs are
|
|
19
|
-
var
|
|
18
|
+
/** IDs are delimited by an empty space, as per the spec. */
|
|
19
|
+
var ID_DELIMITER = ' ';
|
|
20
20
|
/**
|
|
21
21
|
* Adds the given ID to the specified ARIA attribute on an element.
|
|
22
22
|
* Used for attributes such as aria-labelledby, aria-owns, etc.
|
|
@@ -27,7 +27,7 @@ function addAriaReferencedId(el, attr, id) {
|
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
ids.push(id.trim());
|
|
30
|
-
el.setAttribute(attr, ids.join(
|
|
30
|
+
el.setAttribute(attr, ids.join(ID_DELIMITER));
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* Removes the given ID from the specified ARIA attribute on an element.
|
|
@@ -37,7 +37,7 @@ function removeAriaReferencedId(el, attr, id) {
|
|
|
37
37
|
var ids = getAriaReferenceIds(el, attr);
|
|
38
38
|
var filteredIds = ids.filter(function (val) { return val != id.trim(); });
|
|
39
39
|
if (filteredIds.length) {
|
|
40
|
-
el.setAttribute(attr, filteredIds.join(
|
|
40
|
+
el.setAttribute(attr, filteredIds.join(ID_DELIMITER));
|
|
41
41
|
}
|
|
42
42
|
else {
|
|
43
43
|
el.removeAttribute(attr);
|
|
@@ -48,7 +48,7 @@ function removeAriaReferencedId(el, attr, id) {
|
|
|
48
48
|
* Used for attributes such as aria-labelledby, aria-owns, etc.
|
|
49
49
|
*/
|
|
50
50
|
function getAriaReferenceIds(el, attr) {
|
|
51
|
-
// Get string array of all individual ids (whitespace
|
|
51
|
+
// Get string array of all individual ids (whitespace delimited) in the attribute value
|
|
52
52
|
return (el.getAttribute(attr) || '').match(/\S+/g) || [];
|
|
53
53
|
}
|
|
54
54
|
|
|
@@ -1742,6 +1742,13 @@ var FocusMonitor = /** @class */ (function () {
|
|
|
1742
1742
|
this._elementInfo = new Map();
|
|
1743
1743
|
/** The number of elements currently being monitored. */
|
|
1744
1744
|
this._monitoredElementCount = 0;
|
|
1745
|
+
/**
|
|
1746
|
+
* Keeps track of the root nodes to which we've currently bound a focus/blur handler,
|
|
1747
|
+
* as well as the number of monitored elements that they contain. We have to treat focus/blur
|
|
1748
|
+
* handlers differently from the rest of the events, because the browser won't emit events
|
|
1749
|
+
* to the document when focus moves inside of a shadow root.
|
|
1750
|
+
*/
|
|
1751
|
+
this._rootNodeFocusListenerCount = new Map();
|
|
1745
1752
|
/**
|
|
1746
1753
|
* Event listener for `keydown` events on the document.
|
|
1747
1754
|
* Needs to be an arrow function in order to preserve the context when it gets bound.
|
|
@@ -1776,10 +1783,7 @@ var FocusMonitor = /** @class */ (function () {
|
|
|
1776
1783
|
if (_this._touchTimeoutId != null) {
|
|
1777
1784
|
clearTimeout(_this._touchTimeoutId);
|
|
1778
1785
|
}
|
|
1779
|
-
|
|
1780
|
-
// will have their `target` set to the shadow root. If available, use `composedPath` to
|
|
1781
|
-
// figure out the event target.
|
|
1782
|
-
_this._lastTouchTarget = event.composedPath ? event.composedPath()[0] : event.target;
|
|
1786
|
+
_this._lastTouchTarget = getTarget(event);
|
|
1783
1787
|
_this._touchTimeoutId = setTimeout(function () { return _this._lastTouchTarget = null; }, TOUCH_BUFFER_MS);
|
|
1784
1788
|
};
|
|
1785
1789
|
/**
|
|
@@ -1796,12 +1800,12 @@ var FocusMonitor = /** @class */ (function () {
|
|
|
1796
1800
|
* Event listener for `focus` and 'blur' events on the document.
|
|
1797
1801
|
* Needs to be an arrow function in order to preserve the context when it gets bound.
|
|
1798
1802
|
*/
|
|
1799
|
-
this.
|
|
1800
|
-
var target = event
|
|
1803
|
+
this._rootNodeFocusAndBlurListener = function (event) {
|
|
1804
|
+
var target = getTarget(event);
|
|
1801
1805
|
var handler = event.type === 'focus' ? _this._onFocus : _this._onBlur;
|
|
1802
1806
|
// We need to walk up the ancestor chain in order to support `checkChildren`.
|
|
1803
|
-
for (var
|
|
1804
|
-
handler.call(_this, event,
|
|
1807
|
+
for (var element = target; element; element = element.parentElement) {
|
|
1808
|
+
handler.call(_this, event, element);
|
|
1805
1809
|
}
|
|
1806
1810
|
};
|
|
1807
1811
|
this._document = document;
|
|
@@ -1814,6 +1818,10 @@ var FocusMonitor = /** @class */ (function () {
|
|
|
1814
1818
|
return of(null);
|
|
1815
1819
|
}
|
|
1816
1820
|
var nativeElement = coerceElement(element);
|
|
1821
|
+
// If the element is inside the shadow DOM, we need to bind our focus/blur listeners to
|
|
1822
|
+
// the shadow root, rather than the `document`, because the browser won't emit focus events
|
|
1823
|
+
// to the `document`, if focus is moving within the same shadow root.
|
|
1824
|
+
var rootNode = _getShadowRoot(nativeElement) || this._getDocument();
|
|
1817
1825
|
// Check if we're already monitoring this element.
|
|
1818
1826
|
if (this._elementInfo.has(nativeElement)) {
|
|
1819
1827
|
var cachedInfo = this._elementInfo.get(nativeElement);
|
|
@@ -1823,10 +1831,11 @@ var FocusMonitor = /** @class */ (function () {
|
|
|
1823
1831
|
// Create monitored element info.
|
|
1824
1832
|
var info = {
|
|
1825
1833
|
checkChildren: checkChildren,
|
|
1826
|
-
subject: new Subject()
|
|
1834
|
+
subject: new Subject(),
|
|
1835
|
+
rootNode: rootNode
|
|
1827
1836
|
};
|
|
1828
1837
|
this._elementInfo.set(nativeElement, info);
|
|
1829
|
-
this.
|
|
1838
|
+
this._registerGlobalListeners(info);
|
|
1830
1839
|
return info.subject.asObservable();
|
|
1831
1840
|
};
|
|
1832
1841
|
FocusMonitor.prototype.stopMonitoring = function (element) {
|
|
@@ -1836,7 +1845,7 @@ var FocusMonitor = /** @class */ (function () {
|
|
|
1836
1845
|
elementInfo.subject.complete();
|
|
1837
1846
|
this._setClasses(nativeElement);
|
|
1838
1847
|
this._elementInfo.delete(nativeElement);
|
|
1839
|
-
this.
|
|
1848
|
+
this._removeGlobalListeners(elementInfo);
|
|
1840
1849
|
}
|
|
1841
1850
|
};
|
|
1842
1851
|
FocusMonitor.prototype.focusVia = function (element, origin, options) {
|
|
@@ -1941,7 +1950,7 @@ var FocusMonitor = /** @class */ (function () {
|
|
|
1941
1950
|
// for the first focus event after the touchstart, and then the first blur event after that
|
|
1942
1951
|
// focus event. When that blur event fires we know that whatever follows is not a result of the
|
|
1943
1952
|
// touchstart.
|
|
1944
|
-
var focusTarget = event
|
|
1953
|
+
var focusTarget = getTarget(event);
|
|
1945
1954
|
return this._lastTouchTarget instanceof Node && focusTarget instanceof Node &&
|
|
1946
1955
|
(focusTarget === this._lastTouchTarget || focusTarget.contains(this._lastTouchTarget));
|
|
1947
1956
|
};
|
|
@@ -1958,7 +1967,7 @@ var FocusMonitor = /** @class */ (function () {
|
|
|
1958
1967
|
// If we are not counting child-element-focus as focused, make sure that the event target is the
|
|
1959
1968
|
// monitored element itself.
|
|
1960
1969
|
var elementInfo = this._elementInfo.get(element);
|
|
1961
|
-
if (!elementInfo || (!elementInfo.checkChildren && element !== event
|
|
1970
|
+
if (!elementInfo || (!elementInfo.checkChildren && element !== getTarget(event))) {
|
|
1962
1971
|
return;
|
|
1963
1972
|
}
|
|
1964
1973
|
var origin = this._getFocusOrigin(event);
|
|
@@ -1985,17 +1994,27 @@ var FocusMonitor = /** @class */ (function () {
|
|
|
1985
1994
|
FocusMonitor.prototype._emitOrigin = function (subject, origin) {
|
|
1986
1995
|
this._ngZone.run(function () { return subject.next(origin); });
|
|
1987
1996
|
};
|
|
1988
|
-
FocusMonitor.prototype.
|
|
1997
|
+
FocusMonitor.prototype._registerGlobalListeners = function (elementInfo) {
|
|
1989
1998
|
var _this = this;
|
|
1999
|
+
if (!this._platform.isBrowser) {
|
|
2000
|
+
return;
|
|
2001
|
+
}
|
|
2002
|
+
var rootNode = elementInfo.rootNode;
|
|
2003
|
+
var rootNodeFocusListeners = this._rootNodeFocusListenerCount.get(rootNode) || 0;
|
|
2004
|
+
if (!rootNodeFocusListeners) {
|
|
2005
|
+
this._ngZone.runOutsideAngular(function () {
|
|
2006
|
+
rootNode.addEventListener('focus', _this._rootNodeFocusAndBlurListener, captureEventListenerOptions);
|
|
2007
|
+
rootNode.addEventListener('blur', _this._rootNodeFocusAndBlurListener, captureEventListenerOptions);
|
|
2008
|
+
});
|
|
2009
|
+
}
|
|
2010
|
+
this._rootNodeFocusListenerCount.set(rootNode, rootNodeFocusListeners + 1);
|
|
1990
2011
|
// Register global listeners when first element is monitored.
|
|
1991
|
-
if (++this._monitoredElementCount
|
|
2012
|
+
if (++this._monitoredElementCount === 1) {
|
|
1992
2013
|
// Note: we listen to events in the capture phase so we
|
|
1993
2014
|
// can detect them even if the user stops propagation.
|
|
1994
2015
|
this._ngZone.runOutsideAngular(function () {
|
|
1995
2016
|
var document = _this._getDocument();
|
|
1996
2017
|
var window = _this._getWindow();
|
|
1997
|
-
document.addEventListener('focus', _this._documentFocusAndBlurListener, captureEventListenerOptions);
|
|
1998
|
-
document.addEventListener('blur', _this._documentFocusAndBlurListener, captureEventListenerOptions);
|
|
1999
2018
|
document.addEventListener('keydown', _this._documentKeydownListener, captureEventListenerOptions);
|
|
2000
2019
|
document.addEventListener('mousedown', _this._documentMousedownListener, captureEventListenerOptions);
|
|
2001
2020
|
document.addEventListener('touchstart', _this._documentTouchstartListener, captureEventListenerOptions);
|
|
@@ -2003,13 +2022,23 @@ var FocusMonitor = /** @class */ (function () {
|
|
|
2003
2022
|
});
|
|
2004
2023
|
}
|
|
2005
2024
|
};
|
|
2006
|
-
FocusMonitor.prototype.
|
|
2025
|
+
FocusMonitor.prototype._removeGlobalListeners = function (elementInfo) {
|
|
2026
|
+
var rootNode = elementInfo.rootNode;
|
|
2027
|
+
if (this._rootNodeFocusListenerCount.has(rootNode)) {
|
|
2028
|
+
var rootNodeFocusListeners = this._rootNodeFocusListenerCount.get(rootNode);
|
|
2029
|
+
if (rootNodeFocusListeners > 1) {
|
|
2030
|
+
this._rootNodeFocusListenerCount.set(rootNode, rootNodeFocusListeners - 1);
|
|
2031
|
+
}
|
|
2032
|
+
else {
|
|
2033
|
+
rootNode.removeEventListener('focus', this._rootNodeFocusAndBlurListener, captureEventListenerOptions);
|
|
2034
|
+
rootNode.removeEventListener('blur', this._rootNodeFocusAndBlurListener, captureEventListenerOptions);
|
|
2035
|
+
this._rootNodeFocusListenerCount.delete(rootNode);
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2007
2038
|
// Unregister global listeners when last element is unmonitored.
|
|
2008
2039
|
if (!--this._monitoredElementCount) {
|
|
2009
2040
|
var document_1 = this._getDocument();
|
|
2010
2041
|
var window_1 = this._getWindow();
|
|
2011
|
-
document_1.removeEventListener('focus', this._documentFocusAndBlurListener, captureEventListenerOptions);
|
|
2012
|
-
document_1.removeEventListener('blur', this._documentFocusAndBlurListener, captureEventListenerOptions);
|
|
2013
2042
|
document_1.removeEventListener('keydown', this._documentKeydownListener, captureEventListenerOptions);
|
|
2014
2043
|
document_1.removeEventListener('mousedown', this._documentMousedownListener, captureEventListenerOptions);
|
|
2015
2044
|
document_1.removeEventListener('touchstart', this._documentTouchstartListener, captureEventListenerOptions);
|
|
@@ -2033,6 +2062,12 @@ var FocusMonitor = /** @class */ (function () {
|
|
|
2033
2062
|
FocusMonitor.ɵprov = ɵɵdefineInjectable({ factory: function FocusMonitor_Factory() { return new FocusMonitor(ɵɵinject(NgZone), ɵɵinject(Platform), ɵɵinject(DOCUMENT, 8), ɵɵinject(FOCUS_MONITOR_DEFAULT_OPTIONS, 8)); }, token: FocusMonitor, providedIn: "root" });
|
|
2034
2063
|
return FocusMonitor;
|
|
2035
2064
|
}());
|
|
2065
|
+
/** Gets the target of an event, accounting for Shadow DOM. */
|
|
2066
|
+
function getTarget(event) {
|
|
2067
|
+
// If an event is bound outside the Shadow DOM, the `event.target` will
|
|
2068
|
+
// point to the shadow root so we have to use `composedPath` instead.
|
|
2069
|
+
return (event.composedPath ? event.composedPath()[0] : event.target);
|
|
2070
|
+
}
|
|
2036
2071
|
/**
|
|
2037
2072
|
* Directive that determines how a particular element was focused (via keyboard, mouse, touch, or
|
|
2038
2073
|
* programmatically) and adds corresponding classes to the element.
|
|
@@ -2085,7 +2120,7 @@ var WHITE_ON_BLACK_CSS_CLASS = 'cdk-high-contrast-white-on-black';
|
|
|
2085
2120
|
/** CSS class applied to the document body when in high-contrast mode. */
|
|
2086
2121
|
var HIGH_CONTRAST_MODE_ACTIVE_CSS_CLASS = 'cdk-high-contrast-active';
|
|
2087
2122
|
/**
|
|
2088
|
-
* Service to determine whether the browser is currently in a high-
|
|
2123
|
+
* Service to determine whether the browser is currently in a high-contrast-mode environment.
|
|
2089
2124
|
*
|
|
2090
2125
|
* Microsoft Windows supports an accessibility feature called "High Contrast Mode". This mode
|
|
2091
2126
|
* changes the appearance of all applications, including web applications, to dramatically increase
|
|
@@ -2100,7 +2135,7 @@ var HighContrastModeDetector = /** @class */ (function () {
|
|
|
2100
2135
|
this._platform = _platform;
|
|
2101
2136
|
this._document = document;
|
|
2102
2137
|
}
|
|
2103
|
-
/** Gets the current high-
|
|
2138
|
+
/** Gets the current high-contrast-mode for the page. */
|
|
2104
2139
|
HighContrastModeDetector.prototype.getHighContrastMode = function () {
|
|
2105
2140
|
if (!this._platform.isBrowser) {
|
|
2106
2141
|
return 0 /* NONE */;
|