@angular/cdk 9.1.2 → 9.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/a11y/focus-monitor/focus-monitor.d.ts +42 -2
- package/a11y/index.metadata.json +1 -1
- package/bundles/cdk-a11y.umd.js +107 -75
- package/bundles/cdk-a11y.umd.js.map +1 -1
- package/bundles/cdk-a11y.umd.min.js +7 -7
- package/bundles/cdk-a11y.umd.min.js.map +1 -1
- package/bundles/cdk-clipboard.umd.js +1 -1
- package/bundles/cdk-clipboard.umd.js.map +1 -1
- package/bundles/cdk-clipboard.umd.min.js +1 -1
- package/bundles/cdk-clipboard.umd.min.js.map +1 -1
- package/bundles/cdk-coercion.umd.js +0 -1
- package/bundles/cdk-coercion.umd.js.map +1 -1
- package/bundles/cdk-coercion.umd.min.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.js +121 -95
- package/bundles/cdk-drag-drop.umd.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.min.js +15 -8
- package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
- package/bundles/cdk-overlay.umd.js +2 -1
- package/bundles/cdk-overlay.umd.js.map +1 -1
- package/bundles/cdk-overlay.umd.min.js +4 -4
- package/bundles/cdk-overlay.umd.min.js.map +1 -1
- package/bundles/cdk-platform.umd.js +11 -0
- package/bundles/cdk-platform.umd.js.map +1 -1
- package/bundles/cdk-platform.umd.min.js +6 -6
- package/bundles/cdk-platform.umd.min.js.map +1 -1
- package/bundles/cdk-scrolling.umd.js +41 -10
- package/bundles/cdk-scrolling.umd.js.map +1 -1
- package/bundles/cdk-scrolling.umd.min.js +8 -8
- package/bundles/cdk-scrolling.umd.min.js.map +1 -1
- package/bundles/cdk-table.umd.js +58 -27
- package/bundles/cdk-table.umd.js.map +1 -1
- package/bundles/cdk-table.umd.min.js +12 -5
- package/bundles/cdk-table.umd.min.js.map +1 -1
- package/bundles/cdk-testing-protractor.umd.js +15 -9
- package/bundles/cdk-testing-protractor.umd.js.map +1 -1
- package/bundles/cdk-testing-protractor.umd.min.js +2 -2
- package/bundles/cdk-testing-protractor.umd.min.js.map +1 -1
- package/bundles/cdk-testing-testbed.umd.js +15 -9
- package/bundles/cdk-testing-testbed.umd.js.map +1 -1
- package/bundles/cdk-testing-testbed.umd.min.js +8 -8
- package/bundles/cdk-testing-testbed.umd.min.js.map +1 -1
- package/bundles/cdk-text-field.umd.js +21 -6
- package/bundles/cdk-text-field.umd.js.map +1 -1
- package/bundles/cdk-text-field.umd.min.js +3 -3
- package/bundles/cdk-text-field.umd.min.js.map +1 -1
- package/bundles/cdk-tree.umd.js +8 -4
- 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/coercion/array.d.ts +1 -0
- package/drag-drop/client-rect.d.ts +31 -0
- package/drag-drop/directives/config.d.ts +1 -0
- package/drag-drop/directives/drop-list.d.ts +4 -3
- package/drag-drop/drag-ref.d.ts +4 -0
- package/drag-drop/index.metadata.json +1 -1
- package/esm2015/a11y/focus-monitor/focus-monitor.js +163 -76
- package/esm2015/a11y/focus-trap/configurable-focus-trap-factory.js +3 -3
- package/esm2015/a11y/focus-trap/focus-trap.js +1 -1
- package/esm2015/a11y/high-contrast-mode/high-contrast-mode-detector.js +8 -4
- package/esm2015/a11y/live-announcer/live-announcer.js +1 -1
- package/esm2015/a11y/public-api.js +2 -2
- package/esm2015/bidi/directionality.js +1 -1
- package/esm2015/clipboard/pending-copy.js +3 -3
- package/esm2015/coercion/array.js +1 -2
- package/esm2015/drag-drop/client-rect.js +75 -0
- package/esm2015/drag-drop/directives/config.js +3 -1
- package/esm2015/drag-drop/directives/drag.js +3 -2
- package/esm2015/drag-drop/directives/drop-list.js +24 -18
- package/esm2015/drag-drop/drag-drop.js +1 -1
- package/esm2015/drag-drop/drag-ref.js +61 -25
- package/esm2015/drag-drop/drop-list-ref.js +15 -82
- package/esm2015/layout/breakpoints-observer.js +1 -1
- package/esm2015/overlay/position/flexible-connected-position-strategy.js +3 -2
- package/esm2015/overlay/position/overlay-position-builder.js +1 -1
- package/esm2015/platform/features/shadow-dom.js +16 -1
- package/esm2015/platform/public-api.js +2 -2
- package/esm2015/scrolling/scroll-dispatcher.js +38 -5
- package/esm2015/scrolling/viewport-ruler.js +44 -5
- package/esm2015/table/cell.js +18 -8
- package/esm2015/table/public-api.js +3 -2
- package/esm2015/table/row.js +24 -8
- package/esm2015/table/table.js +26 -12
- package/esm2015/table/text-column.js +3 -26
- package/esm2015/table/tokens.js +44 -0
- package/esm2015/testing/protractor/protractor-harness-environment.js +13 -8
- package/esm2015/testing/testbed/testbed-harness-environment.js +16 -10
- package/esm2015/text-field/autosize.js +38 -4
- package/esm2015/tree/padding.js +9 -10
- package/esm2015/version.js +1 -1
- package/esm5/a11y/focus-monitor/focus-monitor.js +87 -56
- package/esm5/a11y/focus-trap/configurable-focus-trap-factory.js +3 -3
- package/esm5/a11y/focus-trap/focus-trap.js +1 -1
- package/esm5/a11y/high-contrast-mode/high-contrast-mode-detector.js +7 -4
- package/esm5/a11y/live-announcer/live-announcer.js +1 -1
- package/esm5/bidi/directionality.js +1 -1
- package/esm5/clipboard/pending-copy.js +2 -2
- package/esm5/coercion/array.js +1 -2
- package/esm5/drag-drop/client-rect.js +60 -0
- package/esm5/drag-drop/directives/config.js +1 -1
- package/esm5/drag-drop/directives/drag.js +3 -2
- package/esm5/drag-drop/directives/drop-list.js +13 -10
- package/esm5/drag-drop/drag-drop.js +1 -1
- package/esm5/drag-drop/drag-ref.js +39 -21
- package/esm5/drag-drop/drop-list-ref.js +13 -67
- package/esm5/layout/breakpoints-observer.js +1 -1
- package/esm5/overlay/position/flexible-connected-position-strategy.js +3 -2
- package/esm5/overlay/position/overlay-position-builder.js +1 -1
- package/esm5/platform/features/shadow-dom.js +11 -1
- package/esm5/scrolling/scroll-dispatcher.js +21 -5
- package/esm5/scrolling/viewport-ruler.js +24 -5
- package/esm5/table/cell.js +13 -8
- package/esm5/table/public-api.js +2 -1
- package/esm5/table/row.js +21 -11
- package/esm5/table/table.js +16 -11
- package/esm5/table/text-column.js +3 -4
- package/esm5/table/tokens.js +16 -0
- package/esm5/testing/protractor/protractor-harness-environment.js +17 -11
- package/esm5/testing/testbed/testbed-harness-environment.js +17 -11
- package/esm5/text-field/autosize.js +20 -4
- package/esm5/tree/padding.js +9 -5
- package/esm5/version.js +1 -1
- package/fesm2015/a11y.js +190 -103
- package/fesm2015/a11y.js.map +1 -1
- package/fesm2015/cdk.js +1 -1
- package/fesm2015/cdk.js.map +1 -1
- package/fesm2015/clipboard.js +2 -2
- package/fesm2015/clipboard.js.map +1 -1
- package/fesm2015/coercion.js +0 -1
- package/fesm2015/coercion.js.map +1 -1
- package/fesm2015/drag-drop.js +174 -123
- package/fesm2015/drag-drop.js.map +1 -1
- package/fesm2015/overlay.js +2 -1
- package/fesm2015/overlay.js.map +1 -1
- package/fesm2015/platform.js +16 -1
- package/fesm2015/platform.js.map +1 -1
- package/fesm2015/scrolling.js +76 -7
- package/fesm2015/scrolling.js.map +1 -1
- package/fesm2015/table.js +98 -49
- package/fesm2015/table.js.map +1 -1
- package/fesm2015/testing/protractor.js +13 -8
- package/fesm2015/testing/protractor.js.map +1 -1
- package/fesm2015/testing/testbed.js +15 -9
- package/fesm2015/testing/testbed.js.map +1 -1
- package/fesm2015/text-field.js +37 -3
- package/fesm2015/text-field.js.map +1 -1
- package/fesm2015/tree.js +8 -9
- package/fesm2015/tree.js.map +1 -1
- package/fesm5/a11y.js +107 -76
- package/fesm5/a11y.js.map +1 -1
- package/fesm5/cdk.js +1 -1
- package/fesm5/cdk.js.map +1 -1
- package/fesm5/clipboard.js +1 -1
- package/fesm5/clipboard.js.map +1 -1
- package/fesm5/coercion.js +0 -1
- package/fesm5/coercion.js.map +1 -1
- package/fesm5/drag-drop.js +122 -96
- package/fesm5/drag-drop.js.map +1 -1
- package/fesm5/overlay.js +2 -1
- package/fesm5/overlay.js.map +1 -1
- package/fesm5/platform.js +11 -1
- package/fesm5/platform.js.map +1 -1
- package/fesm5/scrolling.js +39 -7
- package/fesm5/scrolling.js.map +1 -1
- package/fesm5/table.js +59 -29
- package/fesm5/table.js.map +1 -1
- package/fesm5/testing/protractor.js +17 -11
- package/fesm5/testing/protractor.js.map +1 -1
- package/fesm5/testing/testbed.js +16 -10
- package/fesm5/testing/testbed.js.map +1 -1
- package/fesm5/text-field.js +19 -3
- package/fesm5/text-field.js.map +1 -1
- package/fesm5/tree.js +8 -4
- package/fesm5/tree.js.map +1 -1
- package/package.json +1 -1
- package/platform/features/shadow-dom.d.ts +2 -0
- package/platform/index.metadata.json +1 -1
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-update/upgrade-rules/class-names-rule.js +3 -1
- package/schematics/utils/ast/ng-module-imports.js +3 -2
- package/scrolling/index.metadata.json +1 -1
- package/scrolling/scroll-dispatcher.d.ts +9 -1
- package/scrolling/viewport-ruler.d.ts +9 -1
- package/table/cell.d.ts +2 -0
- package/table/index.metadata.json +1 -1
- package/table/public-api.d.ts +1 -0
- package/table/row.d.ts +6 -3
- package/table/table.d.ts +2 -0
- package/table/text-column.d.ts +2 -13
- package/table/tokens.d.ts +25 -0
- package/testing/protractor/protractor-harness-environment.d.ts +10 -3
- package/testing/testbed/testbed-harness-environment.d.ts +12 -4
- package/text-field/autosize.d.ts +9 -1
- package/text-field/index.metadata.json +1 -1
- package/tree/index.metadata.json +1 -1
- package/tree/padding.d.ts +6 -2
package/fesm2015/a11y.js
CHANGED
|
@@ -2653,6 +2653,31 @@ if (false) {
|
|
|
2653
2653
|
CdkAriaLive.prototype._ngZone;
|
|
2654
2654
|
}
|
|
2655
2655
|
|
|
2656
|
+
/**
|
|
2657
|
+
* @fileoverview added by tsickle
|
|
2658
|
+
* Generated from: src/cdk/a11y/fake-mousedown.ts
|
|
2659
|
+
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2660
|
+
*/
|
|
2661
|
+
/**
|
|
2662
|
+
* @license
|
|
2663
|
+
* Copyright Google LLC All Rights Reserved.
|
|
2664
|
+
*
|
|
2665
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
2666
|
+
* found in the LICENSE file at https://angular.io/license
|
|
2667
|
+
*/
|
|
2668
|
+
/**
|
|
2669
|
+
* Screenreaders will often fire fake mousedown events when a focusable element
|
|
2670
|
+
* is activated using the keyboard. We can typically distinguish between these faked
|
|
2671
|
+
* mousedown events and real mousedown events using the "buttons" property. While
|
|
2672
|
+
* real mousedowns will indicate the mouse button that was pressed (e.g. "1" for
|
|
2673
|
+
* the left mouse button), faked mousedowns will usually set the property value to 0.
|
|
2674
|
+
* @param {?} event
|
|
2675
|
+
* @return {?}
|
|
2676
|
+
*/
|
|
2677
|
+
function isFakeMousedownFromScreenReader(event) {
|
|
2678
|
+
return event.buttons === 0;
|
|
2679
|
+
}
|
|
2680
|
+
|
|
2656
2681
|
/**
|
|
2657
2682
|
* @fileoverview added by tsickle
|
|
2658
2683
|
* Generated from: src/cdk/a11y/focus-monitor/focus-monitor.ts
|
|
@@ -2675,6 +2700,34 @@ if (false) {
|
|
|
2675
2700
|
*/
|
|
2676
2701
|
FocusOptions.prototype.preventScroll;
|
|
2677
2702
|
}
|
|
2703
|
+
/** @enum {number} */
|
|
2704
|
+
const FocusMonitorDetectionMode = {
|
|
2705
|
+
/**
|
|
2706
|
+
* Any mousedown, keydown, or touchstart event that happened in the previous
|
|
2707
|
+
* tick or the current tick will be used to assign a focus event's origin (to
|
|
2708
|
+
* either mouse, keyboard, or touch). This is the default option.
|
|
2709
|
+
*/
|
|
2710
|
+
IMMEDIATE: 0,
|
|
2711
|
+
/**
|
|
2712
|
+
* A focus event's origin is always attributed to the last corresponding
|
|
2713
|
+
* mousedown, keydown, or touchstart event, no matter how long ago it occured.
|
|
2714
|
+
*/
|
|
2715
|
+
EVENTUAL: 1,
|
|
2716
|
+
};
|
|
2717
|
+
/**
|
|
2718
|
+
* Injectable service-level options for FocusMonitor.
|
|
2719
|
+
* @record
|
|
2720
|
+
*/
|
|
2721
|
+
function FocusMonitorOptions() { }
|
|
2722
|
+
if (false) {
|
|
2723
|
+
/** @type {?|undefined} */
|
|
2724
|
+
FocusMonitorOptions.prototype.detectionMode;
|
|
2725
|
+
}
|
|
2726
|
+
/**
|
|
2727
|
+
* InjectionToken for FocusMonitorOptions.
|
|
2728
|
+
* @type {?}
|
|
2729
|
+
*/
|
|
2730
|
+
const FOCUS_MONITOR_DEFAULT_OPTIONS = new InjectionToken('cdk-focus-monitor-default-options');
|
|
2678
2731
|
/**
|
|
2679
2732
|
* Event listener options that enable capturing and also
|
|
2680
2733
|
* mark the listener as passive if the browser supports it.
|
|
@@ -2691,8 +2744,12 @@ class FocusMonitor {
|
|
|
2691
2744
|
/**
|
|
2692
2745
|
* @param {?} _ngZone
|
|
2693
2746
|
* @param {?} _platform
|
|
2747
|
+
* @param {?} document
|
|
2748
|
+
* @param {?} options
|
|
2694
2749
|
*/
|
|
2695
|
-
constructor(_ngZone, _platform
|
|
2750
|
+
constructor(_ngZone, _platform,
|
|
2751
|
+
/** @breaking-change 11.0.0 make document required */
|
|
2752
|
+
document, options) {
|
|
2696
2753
|
this._ngZone = _ngZone;
|
|
2697
2754
|
this._platform = _platform;
|
|
2698
2755
|
/**
|
|
@@ -2728,13 +2785,18 @@ class FocusMonitor {
|
|
|
2728
2785
|
* Needs to be an arrow function in order to preserve the context when it gets bound.
|
|
2729
2786
|
*/
|
|
2730
2787
|
this._documentMousedownListener = (/**
|
|
2788
|
+
* @param {?} event
|
|
2731
2789
|
* @return {?}
|
|
2732
2790
|
*/
|
|
2733
|
-
() => {
|
|
2791
|
+
(event) => {
|
|
2734
2792
|
// On mousedown record the origin only if there is not touch
|
|
2735
2793
|
// target, since a mousedown can happen as a result of a touch event.
|
|
2736
2794
|
if (!this._lastTouchTarget) {
|
|
2737
|
-
|
|
2795
|
+
// In some cases screen readers fire fake `mousedown` events instead of `keydown`.
|
|
2796
|
+
// Resolve the focus source to `keyboard` if we detect one of them.
|
|
2797
|
+
/** @type {?} */
|
|
2798
|
+
const source = isFakeMousedownFromScreenReader(event) ? 'keyboard' : 'mouse';
|
|
2799
|
+
this._setOriginForCurrentEventQueue(source);
|
|
2738
2800
|
}
|
|
2739
2801
|
});
|
|
2740
2802
|
/**
|
|
@@ -2777,6 +2839,26 @@ class FocusMonitor {
|
|
|
2777
2839
|
*/
|
|
2778
2840
|
() => this._windowFocused = false));
|
|
2779
2841
|
});
|
|
2842
|
+
/**
|
|
2843
|
+
* Event listener for `focus` and 'blur' events on the document.
|
|
2844
|
+
* Needs to be an arrow function in order to preserve the context when it gets bound.
|
|
2845
|
+
*/
|
|
2846
|
+
this._documentFocusAndBlurListener = (/**
|
|
2847
|
+
* @param {?} event
|
|
2848
|
+
* @return {?}
|
|
2849
|
+
*/
|
|
2850
|
+
(event) => {
|
|
2851
|
+
/** @type {?} */
|
|
2852
|
+
const target = (/** @type {?} */ (event.target));
|
|
2853
|
+
/** @type {?} */
|
|
2854
|
+
const handler = event.type === 'focus' ? this._onFocus : this._onBlur;
|
|
2855
|
+
// We need to walk up the ancestor chain in order to support `checkChildren`.
|
|
2856
|
+
for (let el = target; el; el = el.parentElement) {
|
|
2857
|
+
handler.call(this, event, el);
|
|
2858
|
+
}
|
|
2859
|
+
});
|
|
2860
|
+
this._document = document;
|
|
2861
|
+
this._detectionMode = (options === null || options === void 0 ? void 0 : options.detectionMode) || 0 /* IMMEDIATE */;
|
|
2780
2862
|
}
|
|
2781
2863
|
/**
|
|
2782
2864
|
* @param {?} element
|
|
@@ -2793,50 +2875,18 @@ class FocusMonitor {
|
|
|
2793
2875
|
// Check if we're already monitoring this element.
|
|
2794
2876
|
if (this._elementInfo.has(nativeElement)) {
|
|
2795
2877
|
/** @type {?} */
|
|
2796
|
-
|
|
2878
|
+
const cachedInfo = this._elementInfo.get(nativeElement);
|
|
2797
2879
|
(/** @type {?} */ (cachedInfo)).checkChildren = checkChildren;
|
|
2798
2880
|
return (/** @type {?} */ (cachedInfo)).subject.asObservable();
|
|
2799
2881
|
}
|
|
2800
2882
|
// Create monitored element info.
|
|
2801
2883
|
/** @type {?} */
|
|
2802
|
-
|
|
2803
|
-
unlisten: (/**
|
|
2804
|
-
* @return {?}
|
|
2805
|
-
*/
|
|
2806
|
-
() => { }),
|
|
2884
|
+
const info = {
|
|
2807
2885
|
checkChildren: checkChildren,
|
|
2808
2886
|
subject: new Subject()
|
|
2809
2887
|
};
|
|
2810
2888
|
this._elementInfo.set(nativeElement, info);
|
|
2811
2889
|
this._incrementMonitoredElementCount();
|
|
2812
|
-
// Start listening. We need to listen in capture phase since focus events don't bubble.
|
|
2813
|
-
/** @type {?} */
|
|
2814
|
-
let focusListener = (/**
|
|
2815
|
-
* @param {?} event
|
|
2816
|
-
* @return {?}
|
|
2817
|
-
*/
|
|
2818
|
-
(event) => this._onFocus(event, nativeElement));
|
|
2819
|
-
/** @type {?} */
|
|
2820
|
-
let blurListener = (/**
|
|
2821
|
-
* @param {?} event
|
|
2822
|
-
* @return {?}
|
|
2823
|
-
*/
|
|
2824
|
-
(event) => this._onBlur(event, nativeElement));
|
|
2825
|
-
this._ngZone.runOutsideAngular((/**
|
|
2826
|
-
* @return {?}
|
|
2827
|
-
*/
|
|
2828
|
-
() => {
|
|
2829
|
-
nativeElement.addEventListener('focus', focusListener, true);
|
|
2830
|
-
nativeElement.addEventListener('blur', blurListener, true);
|
|
2831
|
-
}));
|
|
2832
|
-
// Create an unlisten function for later.
|
|
2833
|
-
info.unlisten = (/**
|
|
2834
|
-
* @return {?}
|
|
2835
|
-
*/
|
|
2836
|
-
() => {
|
|
2837
|
-
nativeElement.removeEventListener('focus', focusListener, true);
|
|
2838
|
-
nativeElement.removeEventListener('blur', blurListener, true);
|
|
2839
|
-
});
|
|
2840
2890
|
return info.subject.asObservable();
|
|
2841
2891
|
}
|
|
2842
2892
|
/**
|
|
@@ -2849,7 +2899,6 @@ class FocusMonitor {
|
|
|
2849
2899
|
/** @type {?} */
|
|
2850
2900
|
const elementInfo = this._elementInfo.get(nativeElement);
|
|
2851
2901
|
if (elementInfo) {
|
|
2852
|
-
elementInfo.unlisten();
|
|
2853
2902
|
elementInfo.subject.complete();
|
|
2854
2903
|
this._setClasses(nativeElement);
|
|
2855
2904
|
this._elementInfo.delete(nativeElement);
|
|
@@ -2883,6 +2932,24 @@ class FocusMonitor {
|
|
|
2883
2932
|
*/
|
|
2884
2933
|
(_info, element) => this.stopMonitoring(element)));
|
|
2885
2934
|
}
|
|
2935
|
+
/**
|
|
2936
|
+
* Access injected document if available or fallback to global document reference
|
|
2937
|
+
* @private
|
|
2938
|
+
* @return {?}
|
|
2939
|
+
*/
|
|
2940
|
+
_getDocument() {
|
|
2941
|
+
return this._document || document;
|
|
2942
|
+
}
|
|
2943
|
+
/**
|
|
2944
|
+
* Use defaultView of injected document if available or fallback to global window reference
|
|
2945
|
+
* @private
|
|
2946
|
+
* @return {?}
|
|
2947
|
+
*/
|
|
2948
|
+
_getWindow() {
|
|
2949
|
+
/** @type {?} */
|
|
2950
|
+
const doc = this._getDocument();
|
|
2951
|
+
return doc.defaultView || window;
|
|
2952
|
+
}
|
|
2886
2953
|
/**
|
|
2887
2954
|
* @private
|
|
2888
2955
|
* @param {?} element
|
|
@@ -2898,6 +2965,31 @@ class FocusMonitor {
|
|
|
2898
2965
|
element.classList.remove(className);
|
|
2899
2966
|
}
|
|
2900
2967
|
}
|
|
2968
|
+
/**
|
|
2969
|
+
* @private
|
|
2970
|
+
* @param {?} event
|
|
2971
|
+
* @return {?}
|
|
2972
|
+
*/
|
|
2973
|
+
_getFocusOrigin(event) {
|
|
2974
|
+
// If we couldn't detect a cause for the focus event, it's due to one of three reasons:
|
|
2975
|
+
// 1) The window has just regained focus, in which case we want to restore the focused state of
|
|
2976
|
+
// the element from before the window blurred.
|
|
2977
|
+
// 2) It was caused by a touch event, in which case we mark the origin as 'touch'.
|
|
2978
|
+
// 3) The element was programmatically focused, in which case we should mark the origin as
|
|
2979
|
+
// 'program'.
|
|
2980
|
+
if (this._origin) {
|
|
2981
|
+
return this._origin;
|
|
2982
|
+
}
|
|
2983
|
+
if (this._windowFocused && this._lastFocusOrigin) {
|
|
2984
|
+
return this._lastFocusOrigin;
|
|
2985
|
+
}
|
|
2986
|
+
else if (this._wasCausedByTouch(event)) {
|
|
2987
|
+
return 'touch';
|
|
2988
|
+
}
|
|
2989
|
+
else {
|
|
2990
|
+
return 'program';
|
|
2991
|
+
}
|
|
2992
|
+
}
|
|
2901
2993
|
/**
|
|
2902
2994
|
* Sets the focus classes on the element based on the given focus origin.
|
|
2903
2995
|
* @private
|
|
@@ -2906,18 +2998,15 @@ class FocusMonitor {
|
|
|
2906
2998
|
* @return {?}
|
|
2907
2999
|
*/
|
|
2908
3000
|
_setClasses(element, origin) {
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
this._toggleClass(element, 'cdk-keyboard-focused', origin === 'keyboard');
|
|
2915
|
-
this._toggleClass(element, 'cdk-mouse-focused', origin === 'mouse');
|
|
2916
|
-
this._toggleClass(element, 'cdk-program-focused', origin === 'program');
|
|
2917
|
-
}
|
|
3001
|
+
this._toggleClass(element, 'cdk-focused', !!origin);
|
|
3002
|
+
this._toggleClass(element, 'cdk-touch-focused', origin === 'touch');
|
|
3003
|
+
this._toggleClass(element, 'cdk-keyboard-focused', origin === 'keyboard');
|
|
3004
|
+
this._toggleClass(element, 'cdk-mouse-focused', origin === 'mouse');
|
|
3005
|
+
this._toggleClass(element, 'cdk-program-focused', origin === 'program');
|
|
2918
3006
|
}
|
|
2919
3007
|
/**
|
|
2920
3008
|
* Sets the origin and schedules an async function to clear it at the end of the event queue.
|
|
3009
|
+
* If the detection mode is 'eventual', the origin is never cleared.
|
|
2921
3010
|
* @private
|
|
2922
3011
|
* @param {?} origin The origin to set.
|
|
2923
3012
|
* @return {?}
|
|
@@ -2928,13 +3017,15 @@ class FocusMonitor {
|
|
|
2928
3017
|
*/
|
|
2929
3018
|
() => {
|
|
2930
3019
|
this._origin = origin;
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
3020
|
+
if (this._detectionMode === 0 /* IMMEDIATE */) {
|
|
3021
|
+
// Sometimes the focus origin won't be valid in Firefox because Firefox seems to focus *one*
|
|
3022
|
+
// tick after the interaction event fired. To ensure the focus origin is always correct,
|
|
3023
|
+
// the focus origin will be determined at the beginning of the next tick.
|
|
3024
|
+
this._originTimeoutId = setTimeout((/**
|
|
3025
|
+
* @return {?}
|
|
3026
|
+
*/
|
|
3027
|
+
() => this._origin = null), 1);
|
|
3028
|
+
}
|
|
2938
3029
|
}));
|
|
2939
3030
|
}
|
|
2940
3031
|
/**
|
|
@@ -2989,25 +3080,8 @@ class FocusMonitor {
|
|
|
2989
3080
|
if (!elementInfo || (!elementInfo.checkChildren && element !== event.target)) {
|
|
2990
3081
|
return;
|
|
2991
3082
|
}
|
|
2992
|
-
// If we couldn't detect a cause for the focus event, it's due to one of three reasons:
|
|
2993
|
-
// 1) The window has just regained focus, in which case we want to restore the focused state of
|
|
2994
|
-
// the element from before the window blurred.
|
|
2995
|
-
// 2) It was caused by a touch event, in which case we mark the origin as 'touch'.
|
|
2996
|
-
// 3) The element was programmatically focused, in which case we should mark the origin as
|
|
2997
|
-
// 'program'.
|
|
2998
3083
|
/** @type {?} */
|
|
2999
|
-
|
|
3000
|
-
if (!origin) {
|
|
3001
|
-
if (this._windowFocused && this._lastFocusOrigin) {
|
|
3002
|
-
origin = this._lastFocusOrigin;
|
|
3003
|
-
}
|
|
3004
|
-
else if (this._wasCausedByTouch(event)) {
|
|
3005
|
-
origin = 'touch';
|
|
3006
|
-
}
|
|
3007
|
-
else {
|
|
3008
|
-
origin = 'program';
|
|
3009
|
-
}
|
|
3010
|
-
}
|
|
3084
|
+
const origin = this._getFocusOrigin(event);
|
|
3011
3085
|
this._setClasses(element, origin);
|
|
3012
3086
|
this._emitOrigin(elementInfo.subject, origin);
|
|
3013
3087
|
this._lastFocusOrigin = origin;
|
|
@@ -3055,6 +3129,12 @@ class FocusMonitor {
|
|
|
3055
3129
|
* @return {?}
|
|
3056
3130
|
*/
|
|
3057
3131
|
() => {
|
|
3132
|
+
/** @type {?} */
|
|
3133
|
+
const document = this._getDocument();
|
|
3134
|
+
/** @type {?} */
|
|
3135
|
+
const window = this._getWindow();
|
|
3136
|
+
document.addEventListener('focus', this._documentFocusAndBlurListener, captureEventListenerOptions);
|
|
3137
|
+
document.addEventListener('blur', this._documentFocusAndBlurListener, captureEventListenerOptions);
|
|
3058
3138
|
document.addEventListener('keydown', this._documentKeydownListener, captureEventListenerOptions);
|
|
3059
3139
|
document.addEventListener('mousedown', this._documentMousedownListener, captureEventListenerOptions);
|
|
3060
3140
|
document.addEventListener('touchstart', this._documentTouchstartListener, captureEventListenerOptions);
|
|
@@ -3069,6 +3149,12 @@ class FocusMonitor {
|
|
|
3069
3149
|
_decrementMonitoredElementCount() {
|
|
3070
3150
|
// Unregister global listeners when last element is unmonitored.
|
|
3071
3151
|
if (!--this._monitoredElementCount) {
|
|
3152
|
+
/** @type {?} */
|
|
3153
|
+
const document = this._getDocument();
|
|
3154
|
+
/** @type {?} */
|
|
3155
|
+
const window = this._getWindow();
|
|
3156
|
+
document.removeEventListener('focus', this._documentFocusAndBlurListener, captureEventListenerOptions);
|
|
3157
|
+
document.removeEventListener('blur', this._documentFocusAndBlurListener, captureEventListenerOptions);
|
|
3072
3158
|
document.removeEventListener('keydown', this._documentKeydownListener, captureEventListenerOptions);
|
|
3073
3159
|
document.removeEventListener('mousedown', this._documentMousedownListener, captureEventListenerOptions);
|
|
3074
3160
|
document.removeEventListener('touchstart', this._documentTouchstartListener, captureEventListenerOptions);
|
|
@@ -3086,9 +3172,11 @@ FocusMonitor.decorators = [
|
|
|
3086
3172
|
/** @nocollapse */
|
|
3087
3173
|
FocusMonitor.ctorParameters = () => [
|
|
3088
3174
|
{ type: NgZone },
|
|
3089
|
-
{ type: Platform }
|
|
3175
|
+
{ type: Platform },
|
|
3176
|
+
{ type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [DOCUMENT,] }] },
|
|
3177
|
+
{ type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [FOCUS_MONITOR_DEFAULT_OPTIONS,] }] }
|
|
3090
3178
|
];
|
|
3091
|
-
/** @nocollapse */ FocusMonitor.ɵprov = ɵɵdefineInjectable({ factory: function FocusMonitor_Factory() { return new FocusMonitor(ɵɵinject(NgZone), ɵɵinject(Platform)); }, token: FocusMonitor, providedIn: "root" });
|
|
3179
|
+
/** @nocollapse */ 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" });
|
|
3092
3180
|
if (false) {
|
|
3093
3181
|
/**
|
|
3094
3182
|
* The focus origin that the next focus event is a result of.
|
|
@@ -3144,6 +3232,13 @@ if (false) {
|
|
|
3144
3232
|
* @private
|
|
3145
3233
|
*/
|
|
3146
3234
|
FocusMonitor.prototype._monitoredElementCount;
|
|
3235
|
+
/**
|
|
3236
|
+
* The specified detection mode, used for attributing the origin of a focus
|
|
3237
|
+
* event.
|
|
3238
|
+
* @type {?}
|
|
3239
|
+
* @private
|
|
3240
|
+
*/
|
|
3241
|
+
FocusMonitor.prototype._detectionMode;
|
|
3147
3242
|
/**
|
|
3148
3243
|
* Event listener for `keydown` events on the document.
|
|
3149
3244
|
* Needs to be an arrow function in order to preserve the context when it gets bound.
|
|
@@ -3172,6 +3267,19 @@ if (false) {
|
|
|
3172
3267
|
* @private
|
|
3173
3268
|
*/
|
|
3174
3269
|
FocusMonitor.prototype._windowFocusListener;
|
|
3270
|
+
/**
|
|
3271
|
+
* Used to reference correct document/window
|
|
3272
|
+
* @type {?}
|
|
3273
|
+
* @protected
|
|
3274
|
+
*/
|
|
3275
|
+
FocusMonitor.prototype._document;
|
|
3276
|
+
/**
|
|
3277
|
+
* Event listener for `focus` and 'blur' events on the document.
|
|
3278
|
+
* Needs to be an arrow function in order to preserve the context when it gets bound.
|
|
3279
|
+
* @type {?}
|
|
3280
|
+
* @private
|
|
3281
|
+
*/
|
|
3282
|
+
FocusMonitor.prototype._documentFocusAndBlurListener;
|
|
3175
3283
|
/**
|
|
3176
3284
|
* @type {?}
|
|
3177
3285
|
* @private
|
|
@@ -3249,31 +3357,6 @@ if (false) {
|
|
|
3249
3357
|
CdkMonitorFocus.prototype._focusMonitor;
|
|
3250
3358
|
}
|
|
3251
3359
|
|
|
3252
|
-
/**
|
|
3253
|
-
* @fileoverview added by tsickle
|
|
3254
|
-
* Generated from: src/cdk/a11y/fake-mousedown.ts
|
|
3255
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
3256
|
-
*/
|
|
3257
|
-
/**
|
|
3258
|
-
* @license
|
|
3259
|
-
* Copyright Google LLC All Rights Reserved.
|
|
3260
|
-
*
|
|
3261
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
3262
|
-
* found in the LICENSE file at https://angular.io/license
|
|
3263
|
-
*/
|
|
3264
|
-
/**
|
|
3265
|
-
* Screenreaders will often fire fake mousedown events when a focusable element
|
|
3266
|
-
* is activated using the keyboard. We can typically distinguish between these faked
|
|
3267
|
-
* mousedown events and real mousedown events using the "buttons" property. While
|
|
3268
|
-
* real mousedowns will indicate the mouse button that was pressed (e.g. "1" for
|
|
3269
|
-
* the left mouse button), faked mousedowns will usually set the property value to 0.
|
|
3270
|
-
* @param {?} event
|
|
3271
|
-
* @return {?}
|
|
3272
|
-
*/
|
|
3273
|
-
function isFakeMousedownFromScreenReader(event) {
|
|
3274
|
-
return event.buttons === 0;
|
|
3275
|
-
}
|
|
3276
|
-
|
|
3277
3360
|
/**
|
|
3278
3361
|
* @fileoverview added by tsickle
|
|
3279
3362
|
* Generated from: src/cdk/a11y/high-contrast-mode/high-contrast-mode-detector.ts
|
|
@@ -3338,11 +3421,15 @@ class HighContrastModeDetector {
|
|
|
3338
3421
|
this._document.body.appendChild(testElement);
|
|
3339
3422
|
// Get the computed style for the background color, collapsing spaces to normalize between
|
|
3340
3423
|
// browsers. Once we get this color, we no longer need the test element. Access the `window`
|
|
3341
|
-
// via the document so we can fake it in tests.
|
|
3424
|
+
// via the document so we can fake it in tests. Note that we have extra null checks, because
|
|
3425
|
+
// this logic will likely run during app bootstrap and throwing can break the entire app.
|
|
3426
|
+
/** @type {?} */
|
|
3427
|
+
const documentWindow = this._document.defaultView || window;
|
|
3342
3428
|
/** @type {?} */
|
|
3343
|
-
const
|
|
3429
|
+
const computedStyle = (documentWindow && documentWindow.getComputedStyle) ?
|
|
3430
|
+
documentWindow.getComputedStyle(testElement) : null;
|
|
3344
3431
|
/** @type {?} */
|
|
3345
|
-
const computedColor = (
|
|
3432
|
+
const computedColor = (computedStyle && computedStyle.backgroundColor || '').replace(/ /g, '');
|
|
3346
3433
|
this._document.body.removeChild(testElement);
|
|
3347
3434
|
switch (computedColor) {
|
|
3348
3435
|
case 'rgb(0,0,0)': return 2 /* WHITE_ON_BLACK */;
|
|
@@ -3432,5 +3519,5 @@ A11yModule.ctorParameters = () => [
|
|
|
3432
3519
|
* Generated bundle index. Do not edit.
|
|
3433
3520
|
*/
|
|
3434
3521
|
|
|
3435
|
-
export { A11yModule, ActiveDescendantKeyManager, AriaDescriber, CDK_DESCRIBEDBY_HOST_ATTRIBUTE, CDK_DESCRIBEDBY_ID_PREFIX, CdkAriaLive, CdkMonitorFocus, CdkTrapFocus, ConfigurableFocusTrap, ConfigurableFocusTrapFactory, EventListenerFocusTrapInertStrategy, FOCUS_TRAP_INERT_STRATEGY, FocusKeyManager, FocusMonitor, FocusTrap, FocusTrapFactory, HighContrastModeDetector, InteractivityChecker, LIVE_ANNOUNCER_DEFAULT_OPTIONS, LIVE_ANNOUNCER_ELEMENT_TOKEN, LIVE_ANNOUNCER_ELEMENT_TOKEN_FACTORY, ListKeyManager, LiveAnnouncer, MESSAGES_CONTAINER_ID, TOUCH_BUFFER_MS, isFakeMousedownFromScreenReader, FocusTrapManager as ɵangular_material_src_cdk_a11y_a11y_a, ConfigurableFocusTrapConfig as ɵangular_material_src_cdk_a11y_a11y_b };
|
|
3522
|
+
export { A11yModule, ActiveDescendantKeyManager, AriaDescriber, CDK_DESCRIBEDBY_HOST_ATTRIBUTE, CDK_DESCRIBEDBY_ID_PREFIX, CdkAriaLive, CdkMonitorFocus, CdkTrapFocus, ConfigurableFocusTrap, ConfigurableFocusTrapFactory, EventListenerFocusTrapInertStrategy, FOCUS_MONITOR_DEFAULT_OPTIONS, FOCUS_TRAP_INERT_STRATEGY, FocusKeyManager, FocusMonitor, FocusTrap, FocusTrapFactory, HighContrastModeDetector, InteractivityChecker, LIVE_ANNOUNCER_DEFAULT_OPTIONS, LIVE_ANNOUNCER_ELEMENT_TOKEN, LIVE_ANNOUNCER_ELEMENT_TOKEN_FACTORY, ListKeyManager, LiveAnnouncer, MESSAGES_CONTAINER_ID, TOUCH_BUFFER_MS, isFakeMousedownFromScreenReader, FocusTrapManager as ɵangular_material_src_cdk_a11y_a11y_a, ConfigurableFocusTrapConfig as ɵangular_material_src_cdk_a11y_a11y_b };
|
|
3436
3523
|
//# sourceMappingURL=a11y.js.map
|