@angular/material 21.0.0-next.9 → 21.0.0-rc.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/core/tokens/_classes.scss +1 -1
- package/core/tokens/m2/_md-sys-color.scss +17 -17
- package/fesm2022/_animation-chunk.mjs +10 -16
- package/fesm2022/_animation-chunk.mjs.map +1 -1
- package/fesm2022/_date-formats-chunk.mjs +68 -164
- package/fesm2022/_date-formats-chunk.mjs.map +1 -1
- package/fesm2022/_date-range-input-harness-chunk.mjs +284 -463
- package/fesm2022/_date-range-input-harness-chunk.mjs.map +1 -1
- package/fesm2022/_error-options-chunk.mjs +56 -19
- package/fesm2022/_error-options-chunk.mjs.map +1 -1
- package/fesm2022/_error-state-chunk.mjs +24 -31
- package/fesm2022/_error-state-chunk.mjs.map +1 -1
- package/fesm2022/_form-field-chunk.mjs +1224 -1017
- package/fesm2022/_form-field-chunk.mjs.map +1 -1
- package/fesm2022/_icon-button-chunk.mjs +243 -187
- package/fesm2022/_icon-button-chunk.mjs.map +1 -1
- package/fesm2022/_icon-registry-chunk.mjs +350 -575
- package/fesm2022/_icon-registry-chunk.mjs.map +1 -1
- package/fesm2022/_input-harness-chunk.mjs +56 -107
- package/fesm2022/_input-harness-chunk.mjs.map +1 -1
- package/fesm2022/_input-value-accessor-chunk.mjs +0 -6
- package/fesm2022/_input-value-accessor-chunk.mjs.map +1 -1
- package/fesm2022/_internal-form-field-chunk.mjs +59 -19
- package/fesm2022/_internal-form-field-chunk.mjs.map +1 -1
- package/fesm2022/_line-chunk.mjs +83 -43
- package/fesm2022/_line-chunk.mjs.map +1 -1
- package/fesm2022/_option-chunk.mjs +348 -311
- package/fesm2022/_option-chunk.mjs.map +1 -1
- package/fesm2022/_option-harness-chunk.mjs +23 -39
- package/fesm2022/_option-harness-chunk.mjs.map +1 -1
- package/fesm2022/_option-module-chunk.mjs +36 -10
- package/fesm2022/_option-module-chunk.mjs.map +1 -1
- package/fesm2022/_pseudo-checkbox-chunk.mjs +79 -44
- package/fesm2022/_pseudo-checkbox-chunk.mjs.map +1 -1
- package/fesm2022/_pseudo-checkbox-module-chunk.mjs +36 -10
- package/fesm2022/_pseudo-checkbox-module-chunk.mjs.map +1 -1
- package/fesm2022/_public-api-chunk.mjs +71 -134
- package/fesm2022/_public-api-chunk.mjs.map +1 -1
- package/fesm2022/_ripple-chunk.mjs +504 -600
- package/fesm2022/_ripple-chunk.mjs.map +1 -1
- package/fesm2022/_ripple-loader-chunk.mjs +120 -138
- package/fesm2022/_ripple-loader-chunk.mjs.map +1 -1
- package/fesm2022/_ripple-module-chunk.mjs +36 -10
- package/fesm2022/_ripple-module-chunk.mjs.map +1 -1
- package/fesm2022/_structural-styles-chunk.mjs +37 -10
- package/fesm2022/_structural-styles-chunk.mjs.map +1 -1
- package/fesm2022/_tooltip-chunk.mjs +811 -888
- package/fesm2022/_tooltip-chunk.mjs.map +1 -1
- package/fesm2022/autocomplete-testing.mjs +62 -86
- package/fesm2022/autocomplete-testing.mjs.map +1 -1
- package/fesm2022/autocomplete.mjs +965 -1126
- package/fesm2022/autocomplete.mjs.map +1 -1
- package/fesm2022/badge-testing.mjs +38 -54
- package/fesm2022/badge-testing.mjs.map +1 -1
- package/fesm2022/badge.mjs +321 -272
- package/fesm2022/badge.mjs.map +1 -1
- package/fesm2022/bottom-sheet-testing.mjs +10 -24
- package/fesm2022/bottom-sheet-testing.mjs.map +1 -1
- package/fesm2022/bottom-sheet.mjs +349 -344
- package/fesm2022/bottom-sheet.mjs.map +1 -1
- package/fesm2022/button-testing.mjs +60 -94
- package/fesm2022/button-testing.mjs.map +1 -1
- package/fesm2022/button-toggle-testing.mjs +76 -125
- package/fesm2022/button-toggle-testing.mjs.map +1 -1
- package/fesm2022/button-toggle.mjs +752 -662
- package/fesm2022/button-toggle.mjs.map +1 -1
- package/fesm2022/button.mjs +263 -158
- package/fesm2022/button.mjs.map +1 -1
- package/fesm2022/card-testing.mjs +19 -33
- package/fesm2022/card-testing.mjs.map +1 -1
- package/fesm2022/card.mjs +576 -272
- package/fesm2022/card.mjs.map +1 -1
- package/fesm2022/checkbox-testing.mjs +71 -123
- package/fesm2022/checkbox-testing.mjs.map +1 -1
- package/fesm2022/checkbox.mjs +515 -477
- package/fesm2022/checkbox.mjs.map +1 -1
- package/fesm2022/chips-testing.mjs +201 -344
- package/fesm2022/chips-testing.mjs.map +1 -1
- package/fesm2022/chips.mjs +2552 -2289
- package/fesm2022/chips.mjs.map +1 -1
- package/fesm2022/core-testing.mjs +14 -28
- package/fesm2022/core-testing.mjs.map +1 -1
- package/fesm2022/core.mjs +357 -328
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/datepicker-testing.mjs +15 -25
- package/fesm2022/datepicker-testing.mjs.map +1 -1
- package/fesm2022/datepicker.mjs +4826 -4563
- package/fesm2022/datepicker.mjs.map +1 -1
- package/fesm2022/dialog-testing.mjs +93 -129
- package/fesm2022/dialog-testing.mjs.map +1 -1
- package/fesm2022/dialog.mjs +810 -829
- package/fesm2022/dialog.mjs.map +1 -1
- package/fesm2022/divider-testing.mjs +10 -11
- package/fesm2022/divider-testing.mjs.map +1 -1
- package/fesm2022/divider.mjs +119 -43
- package/fesm2022/divider.mjs.map +1 -1
- package/fesm2022/expansion-testing.mjs +74 -130
- package/fesm2022/expansion-testing.mjs.map +1 -1
- package/fesm2022/expansion.mjs +703 -515
- package/fesm2022/expansion.mjs.map +1 -1
- package/fesm2022/form-field-testing-control.mjs +16 -33
- package/fesm2022/form-field-testing-control.mjs.map +1 -1
- package/fesm2022/form-field-testing.mjs +118 -179
- package/fesm2022/form-field-testing.mjs.map +1 -1
- package/fesm2022/form-field.mjs +36 -10
- package/fesm2022/form-field.mjs.map +1 -1
- package/fesm2022/grid-list-testing.mjs +65 -113
- package/fesm2022/grid-list-testing.mjs.map +1 -1
- package/fesm2022/grid-list.mjs +559 -494
- package/fesm2022/grid-list.mjs.map +1 -1
- package/fesm2022/icon-testing.mjs +148 -127
- package/fesm2022/icon-testing.mjs.map +1 -1
- package/fesm2022/icon.mjs +325 -351
- package/fesm2022/icon.mjs.map +1 -1
- package/fesm2022/input-testing.mjs +59 -99
- package/fesm2022/input-testing.mjs.map +1 -1
- package/fesm2022/input.mjs +457 -520
- package/fesm2022/input.mjs.map +1 -1
- package/fesm2022/list-testing.mjs +251 -434
- package/fesm2022/list-testing.mjs.map +1 -1
- package/fesm2022/list.mjs +1522 -1204
- package/fesm2022/list.mjs.map +1 -1
- package/fesm2022/material.mjs +0 -5
- package/fesm2022/material.mjs.map +1 -1
- package/fesm2022/menu-testing.mjs +159 -228
- package/fesm2022/menu-testing.mjs.map +1 -1
- package/fesm2022/menu.mjs +1338 -1343
- package/fesm2022/menu.mjs.map +1 -1
- package/fesm2022/paginator-testing.mjs +55 -79
- package/fesm2022/paginator-testing.mjs.map +1 -1
- package/fesm2022/paginator.mjs +381 -309
- package/fesm2022/paginator.mjs.map +1 -1
- package/fesm2022/progress-bar-testing.mjs +12 -21
- package/fesm2022/progress-bar-testing.mjs.map +1 -1
- package/fesm2022/progress-bar.mjs +224 -169
- package/fesm2022/progress-bar.mjs.map +1 -1
- package/fesm2022/progress-spinner-testing.mjs +13 -23
- package/fesm2022/progress-spinner-testing.mjs.map +1 -1
- package/fesm2022/progress-spinner.mjs +235 -160
- package/fesm2022/progress-spinner.mjs.map +1 -1
- package/fesm2022/radio-testing.mjs +133 -208
- package/fesm2022/radio-testing.mjs.map +1 -1
- package/fesm2022/radio.mjs +712 -679
- package/fesm2022/radio.mjs.map +1 -1
- package/fesm2022/select-testing.mjs +83 -117
- package/fesm2022/select-testing.mjs.map +1 -1
- package/fesm2022/select.mjs +1116 -1246
- package/fesm2022/select.mjs.map +1 -1
- package/fesm2022/sidenav-testing.mjs +54 -120
- package/fesm2022/sidenav-testing.mjs.map +1 -1
- package/fesm2022/sidenav.mjs +1078 -995
- package/fesm2022/sidenav.mjs.map +1 -1
- package/fesm2022/slide-toggle-testing.mjs +57 -92
- package/fesm2022/slide-toggle-testing.mjs.map +1 -1
- package/fesm2022/slide-toggle.mjs +369 -279
- package/fesm2022/slide-toggle.mjs.map +1 -1
- package/fesm2022/slider-testing.mjs +90 -138
- package/fesm2022/slider-testing.mjs.map +1 -1
- package/fesm2022/slider.mjs +1651 -1716
- package/fesm2022/slider.mjs.map +1 -1
- package/fesm2022/snack-bar-testing.mjs +40 -87
- package/fesm2022/snack-bar-testing.mjs.map +1 -1
- package/fesm2022/snack-bar.mjs +763 -714
- package/fesm2022/snack-bar.mjs.map +1 -1
- package/fesm2022/sort-testing.mjs +45 -66
- package/fesm2022/sort-testing.mjs.map +1 -1
- package/fesm2022/sort.mjs +419 -344
- package/fesm2022/sort.mjs.map +1 -1
- package/fesm2022/stepper-testing.mjs +78 -154
- package/fesm2022/stepper-testing.mjs.map +1 -1
- package/fesm2022/stepper.mjs +790 -498
- package/fesm2022/stepper.mjs.map +1 -1
- package/fesm2022/table-testing.mjs +120 -213
- package/fesm2022/table-testing.mjs.map +1 -1
- package/fesm2022/table.mjs +1026 -684
- package/fesm2022/table.mjs.map +1 -1
- package/fesm2022/tabs-testing.mjs +125 -197
- package/fesm2022/tabs-testing.mjs.map +1 -1
- package/fesm2022/tabs.mjs +2351 -2028
- package/fesm2022/tabs.mjs.map +1 -1
- package/fesm2022/timepicker-testing.mjs +113 -172
- package/fesm2022/timepicker-testing.mjs.map +1 -1
- package/fesm2022/timepicker.mjs +1019 -826
- package/fesm2022/timepicker.mjs.map +1 -1
- package/fesm2022/toolbar-testing.mjs +16 -27
- package/fesm2022/toolbar-testing.mjs.map +1 -1
- package/fesm2022/toolbar.mjs +163 -78
- package/fesm2022/toolbar.mjs.map +1 -1
- package/fesm2022/tooltip-testing.mjs +41 -52
- package/fesm2022/tooltip-testing.mjs.map +1 -1
- package/fesm2022/tooltip.mjs +36 -10
- package/fesm2022/tooltip.mjs.map +1 -1
- package/fesm2022/tree-testing.mjs +86 -162
- package/fesm2022/tree-testing.mjs.map +1 -1
- package/fesm2022/tree.mjs +638 -466
- package/fesm2022/tree.mjs.map +1 -1
- package/package.json +2 -2
- package/schematics/ng-add/index.js +1 -1
- package/types/expansion.d.ts +4 -2
- package/types/menu-testing.d.ts +2 -0
- package/types/select.d.ts +1 -1
- package/types/timepicker.d.ts +1 -0
|
@@ -6,635 +6,539 @@ import { coerceElement } from '@angular/cdk/coercion';
|
|
|
6
6
|
import { _CdkPrivateStyleLoader } from '@angular/cdk/private';
|
|
7
7
|
import { _animationsDisabled } from './_animation-chunk.mjs';
|
|
8
8
|
|
|
9
|
-
/** Possible states for a ripple element. */
|
|
10
9
|
var RippleState;
|
|
11
10
|
(function (RippleState) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
RippleState[RippleState["FADING_IN"] = 0] = "FADING_IN";
|
|
12
|
+
RippleState[RippleState["VISIBLE"] = 1] = "VISIBLE";
|
|
13
|
+
RippleState[RippleState["FADING_OUT"] = 2] = "FADING_OUT";
|
|
14
|
+
RippleState[RippleState["HIDDEN"] = 3] = "HIDDEN";
|
|
16
15
|
})(RippleState || (RippleState = {}));
|
|
17
|
-
/**
|
|
18
|
-
* Reference to a previously launched ripple element.
|
|
19
|
-
*/
|
|
20
16
|
class RippleRef {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
this.element = element;
|
|
36
|
-
this.config = config;
|
|
37
|
-
this._animationForciblyDisabledThroughCss = _animationForciblyDisabledThroughCss;
|
|
38
|
-
}
|
|
39
|
-
/** Fades out the ripple element. */
|
|
40
|
-
fadeOut() {
|
|
41
|
-
this._renderer.fadeOutRipple(this);
|
|
42
|
-
}
|
|
17
|
+
_renderer;
|
|
18
|
+
element;
|
|
19
|
+
config;
|
|
20
|
+
_animationForciblyDisabledThroughCss;
|
|
21
|
+
state = RippleState.HIDDEN;
|
|
22
|
+
constructor(_renderer, element, config, _animationForciblyDisabledThroughCss = false) {
|
|
23
|
+
this._renderer = _renderer;
|
|
24
|
+
this.element = element;
|
|
25
|
+
this.config = config;
|
|
26
|
+
this._animationForciblyDisabledThroughCss = _animationForciblyDisabledThroughCss;
|
|
27
|
+
}
|
|
28
|
+
fadeOut() {
|
|
29
|
+
this._renderer.fadeOutRipple(this);
|
|
30
|
+
}
|
|
43
31
|
}
|
|
44
32
|
|
|
45
|
-
/** Options used to bind a passive capturing event. */
|
|
46
33
|
const passiveCapturingEventOptions$1 = normalizePassiveListenerOptions({
|
|
47
|
-
|
|
48
|
-
|
|
34
|
+
passive: true,
|
|
35
|
+
capture: true
|
|
49
36
|
});
|
|
50
|
-
/** Manages events through delegation so that as few event handlers as possible are bound. */
|
|
51
37
|
class RippleEventManager {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
handlers.forEach(handler => handler.handleEvent(event));
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
};
|
|
38
|
+
_events = new Map();
|
|
39
|
+
addHandler(ngZone, name, element, handler) {
|
|
40
|
+
const handlersForEvent = this._events.get(name);
|
|
41
|
+
if (handlersForEvent) {
|
|
42
|
+
const handlersForElement = handlersForEvent.get(element);
|
|
43
|
+
if (handlersForElement) {
|
|
44
|
+
handlersForElement.add(handler);
|
|
45
|
+
} else {
|
|
46
|
+
handlersForEvent.set(element, new Set([handler]));
|
|
47
|
+
}
|
|
48
|
+
} else {
|
|
49
|
+
this._events.set(name, new Map([[element, new Set([handler])]]));
|
|
50
|
+
ngZone.runOutsideAngular(() => {
|
|
51
|
+
document.addEventListener(name, this._delegateEventHandler, passiveCapturingEventOptions$1);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
removeHandler(name, element, handler) {
|
|
56
|
+
const handlersForEvent = this._events.get(name);
|
|
57
|
+
if (!handlersForEvent) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const handlersForElement = handlersForEvent.get(element);
|
|
61
|
+
if (!handlersForElement) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
handlersForElement.delete(handler);
|
|
65
|
+
if (handlersForElement.size === 0) {
|
|
66
|
+
handlersForEvent.delete(element);
|
|
67
|
+
}
|
|
68
|
+
if (handlersForEvent.size === 0) {
|
|
69
|
+
this._events.delete(name);
|
|
70
|
+
document.removeEventListener(name, this._delegateEventHandler, passiveCapturingEventOptions$1);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
_delegateEventHandler = event => {
|
|
74
|
+
const target = _getEventTarget(event);
|
|
75
|
+
if (target) {
|
|
76
|
+
this._events.get(event.type)?.forEach((handlers, element) => {
|
|
77
|
+
if (element === target || element.contains(target)) {
|
|
78
|
+
handlers.forEach(handler => handler.handleEvent(event));
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
};
|
|
102
83
|
}
|
|
103
84
|
|
|
104
|
-
/**
|
|
105
|
-
* Default ripple animation configuration for ripples without an explicit
|
|
106
|
-
* animation config specified.
|
|
107
|
-
*/
|
|
108
85
|
const defaultRippleAnimationConfig = {
|
|
109
|
-
|
|
110
|
-
|
|
86
|
+
enterDuration: 225,
|
|
87
|
+
exitDuration: 150
|
|
111
88
|
};
|
|
112
|
-
/**
|
|
113
|
-
* Timeout for ignoring mouse events. Mouse events will be temporary ignored after touch
|
|
114
|
-
* events to avoid synthetic mouse events.
|
|
115
|
-
*/
|
|
116
89
|
const ignoreMouseEventsTimeout = 800;
|
|
117
|
-
/** Options used to bind a passive capturing event. */
|
|
118
90
|
const passiveCapturingEventOptions = normalizePassiveListenerOptions({
|
|
119
|
-
|
|
120
|
-
|
|
91
|
+
passive: true,
|
|
92
|
+
capture: true
|
|
121
93
|
});
|
|
122
|
-
/** Events that signal that the pointer is down. */
|
|
123
94
|
const pointerDownEvents = ['mousedown', 'touchstart'];
|
|
124
|
-
/** Events that signal that the pointer is up. */
|
|
125
95
|
const pointerUpEvents = ['mouseup', 'mouseleave', 'touchend', 'touchcancel'];
|
|
126
96
|
class _MatRippleStylesLoader {
|
|
127
|
-
|
|
128
|
-
|
|
97
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
98
|
+
minVersion: "12.0.0",
|
|
99
|
+
version: "20.2.0-next.2",
|
|
100
|
+
ngImport: i0,
|
|
101
|
+
type: _MatRippleStylesLoader,
|
|
102
|
+
deps: [],
|
|
103
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
104
|
+
});
|
|
105
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
106
|
+
minVersion: "14.0.0",
|
|
107
|
+
version: "20.2.0-next.2",
|
|
108
|
+
type: _MatRippleStylesLoader,
|
|
109
|
+
isStandalone: true,
|
|
110
|
+
selector: "ng-component",
|
|
111
|
+
host: {
|
|
112
|
+
attributes: {
|
|
113
|
+
"mat-ripple-style-loader": ""
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
ngImport: i0,
|
|
117
|
+
template: '',
|
|
118
|
+
isInline: true,
|
|
119
|
+
styles: [".mat-ripple{overflow:hidden;position:relative}.mat-ripple:not(:empty){transform:translateZ(0)}.mat-ripple.mat-ripple-unbounded{overflow:visible}.mat-ripple-element{position:absolute;border-radius:50%;pointer-events:none;transition:opacity,transform 0ms cubic-bezier(0, 0, 0.2, 1);transform:scale3d(0, 0, 0);background-color:var(--mat-ripple-color, color-mix(in srgb, var(--mat-sys-on-surface) 10%, transparent))}@media(forced-colors: active){.mat-ripple-element{display:none}}.cdk-drag-preview .mat-ripple-element,.cdk-drag-placeholder .mat-ripple-element{display:none}\n"],
|
|
120
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
121
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
122
|
+
});
|
|
129
123
|
}
|
|
130
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
124
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
125
|
+
minVersion: "12.0.0",
|
|
126
|
+
version: "20.2.0-next.2",
|
|
127
|
+
ngImport: i0,
|
|
128
|
+
type: _MatRippleStylesLoader,
|
|
129
|
+
decorators: [{
|
|
130
|
+
type: Component,
|
|
131
|
+
args: [{
|
|
132
|
+
template: '',
|
|
133
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
134
|
+
encapsulation: ViewEncapsulation.None,
|
|
135
|
+
host: {
|
|
136
|
+
'mat-ripple-style-loader': ''
|
|
137
|
+
},
|
|
138
|
+
styles: [".mat-ripple{overflow:hidden;position:relative}.mat-ripple:not(:empty){transform:translateZ(0)}.mat-ripple.mat-ripple-unbounded{overflow:visible}.mat-ripple-element{position:absolute;border-radius:50%;pointer-events:none;transition:opacity,transform 0ms cubic-bezier(0, 0, 0.2, 1);transform:scale3d(0, 0, 0);background-color:var(--mat-ripple-color, color-mix(in srgb, var(--mat-sys-on-surface) 10%, transparent))}@media(forced-colors: active){.mat-ripple-element{display:none}}.cdk-drag-preview .mat-ripple-element,.cdk-drag-placeholder .mat-ripple-element{display:none}\n"]
|
|
139
|
+
}]
|
|
140
|
+
}]
|
|
141
|
+
});
|
|
141
142
|
class RippleRenderer {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
// end listener because `transitionend` doesn't fire if there is no transition.
|
|
277
|
-
if (animationForciblyDisabledThroughCss || !enterDuration) {
|
|
278
|
-
this._finishRippleTransition(rippleRef);
|
|
279
|
-
}
|
|
280
|
-
return rippleRef;
|
|
281
|
-
}
|
|
282
|
-
/** Fades out a ripple reference. */
|
|
283
|
-
fadeOutRipple(rippleRef) {
|
|
284
|
-
// For ripples already fading out or hidden, this should be a noop.
|
|
285
|
-
if (rippleRef.state === RippleState.FADING_OUT || rippleRef.state === RippleState.HIDDEN) {
|
|
286
|
-
return;
|
|
287
|
-
}
|
|
288
|
-
const rippleEl = rippleRef.element;
|
|
289
|
-
const animationConfig = { ...defaultRippleAnimationConfig, ...rippleRef.config.animation };
|
|
290
|
-
// This starts the fade-out transition and will fire the transition end listener that
|
|
291
|
-
// removes the ripple element from the DOM.
|
|
292
|
-
rippleEl.style.transitionDuration = `${animationConfig.exitDuration}ms`;
|
|
293
|
-
rippleEl.style.opacity = '0';
|
|
294
|
-
rippleRef.state = RippleState.FADING_OUT;
|
|
295
|
-
// In case there is no fade-out transition duration, we need to manually call the
|
|
296
|
-
// transition end listener because `transitionend` doesn't fire if there is no transition.
|
|
297
|
-
if (rippleRef._animationForciblyDisabledThroughCss || !animationConfig.exitDuration) {
|
|
298
|
-
this._finishRippleTransition(rippleRef);
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
/** Fades out all currently active ripples. */
|
|
302
|
-
fadeOutAll() {
|
|
303
|
-
this._getActiveRipples().forEach(ripple => ripple.fadeOut());
|
|
304
|
-
}
|
|
305
|
-
/** Fades out all currently active non-persistent ripples. */
|
|
306
|
-
fadeOutAllNonPersistent() {
|
|
307
|
-
this._getActiveRipples().forEach(ripple => {
|
|
308
|
-
if (!ripple.config.persistent) {
|
|
309
|
-
ripple.fadeOut();
|
|
310
|
-
}
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
/** Sets up the trigger event listeners */
|
|
314
|
-
setupTriggerEvents(elementOrElementRef) {
|
|
315
|
-
const element = coerceElement(elementOrElementRef);
|
|
316
|
-
if (!this._platform.isBrowser || !element || element === this._triggerElement) {
|
|
317
|
-
return;
|
|
318
|
-
}
|
|
319
|
-
// Remove all previously registered event listeners from the trigger element.
|
|
320
|
-
this._removeTriggerEvents();
|
|
321
|
-
this._triggerElement = element;
|
|
322
|
-
// Use event delegation for the trigger events since they're
|
|
323
|
-
// set up during creation and are performance-sensitive.
|
|
324
|
-
pointerDownEvents.forEach(type => {
|
|
325
|
-
RippleRenderer._eventManager.addHandler(this._ngZone, type, element, this);
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
|
-
/**
|
|
329
|
-
* Handles all registered events.
|
|
330
|
-
* @docs-private
|
|
331
|
-
*/
|
|
332
|
-
handleEvent(event) {
|
|
333
|
-
if (event.type === 'mousedown') {
|
|
334
|
-
this._onMousedown(event);
|
|
335
|
-
}
|
|
336
|
-
else if (event.type === 'touchstart') {
|
|
337
|
-
this._onTouchStart(event);
|
|
338
|
-
}
|
|
339
|
-
else {
|
|
340
|
-
this._onPointerUp();
|
|
341
|
-
}
|
|
342
|
-
// If pointer-up events haven't been registered yet, do so now.
|
|
343
|
-
// We do this on-demand in order to reduce the total number of event listeners
|
|
344
|
-
// registered by the ripples, which speeds up the rendering time for large UIs.
|
|
345
|
-
if (!this._pointerUpEventsRegistered) {
|
|
346
|
-
// The events for hiding the ripple are bound directly on the trigger, because:
|
|
347
|
-
// 1. Some of them occur frequently (e.g. `mouseleave`) and any advantage we get from
|
|
348
|
-
// delegation will be diminished by having to look through all the data structures often.
|
|
349
|
-
// 2. They aren't as performance-sensitive, because they're bound only after the user
|
|
350
|
-
// has interacted with an element.
|
|
351
|
-
this._ngZone.runOutsideAngular(() => {
|
|
352
|
-
pointerUpEvents.forEach(type => {
|
|
353
|
-
this._triggerElement.addEventListener(type, this, passiveCapturingEventOptions);
|
|
354
|
-
});
|
|
355
|
-
});
|
|
356
|
-
this._pointerUpEventsRegistered = true;
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
/** Method that will be called if the fade-in or fade-in transition completed. */
|
|
360
|
-
_finishRippleTransition(rippleRef) {
|
|
361
|
-
if (rippleRef.state === RippleState.FADING_IN) {
|
|
362
|
-
this._startFadeOutTransition(rippleRef);
|
|
363
|
-
}
|
|
364
|
-
else if (rippleRef.state === RippleState.FADING_OUT) {
|
|
365
|
-
this._destroyRipple(rippleRef);
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
/**
|
|
369
|
-
* Starts the fade-out transition of the given ripple if it's not persistent and the pointer
|
|
370
|
-
* is not held down anymore.
|
|
371
|
-
*/
|
|
372
|
-
_startFadeOutTransition(rippleRef) {
|
|
373
|
-
const isMostRecentTransientRipple = rippleRef === this._mostRecentTransientRipple;
|
|
374
|
-
const { persistent } = rippleRef.config;
|
|
375
|
-
rippleRef.state = RippleState.VISIBLE;
|
|
376
|
-
// When the timer runs out while the user has kept their pointer down, we want to
|
|
377
|
-
// keep only the persistent ripples and the latest transient ripple. We do this,
|
|
378
|
-
// because we don't want stacked transient ripples to appear after their enter
|
|
379
|
-
// animation has finished.
|
|
380
|
-
if (!persistent && (!isMostRecentTransientRipple || !this._isPointerDown)) {
|
|
381
|
-
rippleRef.fadeOut();
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
/** Destroys the given ripple by removing it from the DOM and updating its state. */
|
|
385
|
-
_destroyRipple(rippleRef) {
|
|
386
|
-
const eventListeners = this._activeRipples.get(rippleRef) ?? null;
|
|
387
|
-
this._activeRipples.delete(rippleRef);
|
|
388
|
-
// Clear out the cached bounding rect if we have no more ripples.
|
|
389
|
-
if (!this._activeRipples.size) {
|
|
390
|
-
this._containerRect = null;
|
|
391
|
-
}
|
|
392
|
-
// If the current ref is the most recent transient ripple, unset it
|
|
393
|
-
// avoid memory leaks.
|
|
394
|
-
if (rippleRef === this._mostRecentTransientRipple) {
|
|
395
|
-
this._mostRecentTransientRipple = null;
|
|
396
|
-
}
|
|
397
|
-
rippleRef.state = RippleState.HIDDEN;
|
|
398
|
-
if (eventListeners !== null) {
|
|
399
|
-
rippleRef.element.removeEventListener('transitionend', eventListeners.onTransitionEnd);
|
|
400
|
-
rippleRef.element.removeEventListener('transitioncancel', eventListeners.onTransitionCancel);
|
|
401
|
-
if (eventListeners.fallbackTimer !== null) {
|
|
402
|
-
clearTimeout(eventListeners.fallbackTimer);
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
rippleRef.element.remove();
|
|
406
|
-
}
|
|
407
|
-
/** Function being called whenever the trigger is being pressed using mouse. */
|
|
408
|
-
_onMousedown(event) {
|
|
409
|
-
// Screen readers will fire fake mouse events for space/enter. Skip launching a
|
|
410
|
-
// ripple in this case for consistency with the non-screen-reader experience.
|
|
411
|
-
const isFakeMousedown = isFakeMousedownFromScreenReader(event);
|
|
412
|
-
const isSyntheticEvent = this._lastTouchStartEvent &&
|
|
413
|
-
Date.now() < this._lastTouchStartEvent + ignoreMouseEventsTimeout;
|
|
414
|
-
if (!this._target.rippleDisabled && !isFakeMousedown && !isSyntheticEvent) {
|
|
415
|
-
this._isPointerDown = true;
|
|
416
|
-
this.fadeInRipple(event.clientX, event.clientY, this._target.rippleConfig);
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
/** Function being called whenever the trigger is being pressed using touch. */
|
|
420
|
-
_onTouchStart(event) {
|
|
421
|
-
if (!this._target.rippleDisabled && !isFakeTouchstartFromScreenReader(event)) {
|
|
422
|
-
// Some browsers fire mouse events after a `touchstart` event. Those synthetic mouse
|
|
423
|
-
// events will launch a second ripple if we don't ignore mouse events for a specific
|
|
424
|
-
// time after a touchstart event.
|
|
425
|
-
this._lastTouchStartEvent = Date.now();
|
|
426
|
-
this._isPointerDown = true;
|
|
427
|
-
// Use `changedTouches` so we skip any touches where the user put
|
|
428
|
-
// their finger down, but used another finger to tap the element again.
|
|
429
|
-
const touches = event.changedTouches;
|
|
430
|
-
// According to the typings the touches should always be defined, but in some cases
|
|
431
|
-
// the browser appears to not assign them in tests which leads to flakes.
|
|
432
|
-
if (touches) {
|
|
433
|
-
for (let i = 0; i < touches.length; i++) {
|
|
434
|
-
this.fadeInRipple(touches[i].clientX, touches[i].clientY, this._target.rippleConfig);
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
/** Function being called whenever the trigger is being released. */
|
|
440
|
-
_onPointerUp() {
|
|
441
|
-
if (!this._isPointerDown) {
|
|
442
|
-
return;
|
|
443
|
-
}
|
|
444
|
-
this._isPointerDown = false;
|
|
445
|
-
// Fade-out all ripples that are visible and not persistent.
|
|
446
|
-
this._getActiveRipples().forEach(ripple => {
|
|
447
|
-
// By default, only ripples that are completely visible will fade out on pointer release.
|
|
448
|
-
// If the `terminateOnPointerUp` option is set, ripples that still fade in will also fade out.
|
|
449
|
-
const isVisible = ripple.state === RippleState.VISIBLE ||
|
|
450
|
-
(ripple.config.terminateOnPointerUp && ripple.state === RippleState.FADING_IN);
|
|
451
|
-
if (!ripple.config.persistent && isVisible) {
|
|
452
|
-
ripple.fadeOut();
|
|
453
|
-
}
|
|
143
|
+
_target;
|
|
144
|
+
_ngZone;
|
|
145
|
+
_platform;
|
|
146
|
+
_containerElement;
|
|
147
|
+
_triggerElement;
|
|
148
|
+
_isPointerDown = false;
|
|
149
|
+
_activeRipples = new Map();
|
|
150
|
+
_mostRecentTransientRipple;
|
|
151
|
+
_lastTouchStartEvent;
|
|
152
|
+
_pointerUpEventsRegistered = false;
|
|
153
|
+
_containerRect;
|
|
154
|
+
static _eventManager = new RippleEventManager();
|
|
155
|
+
constructor(_target, _ngZone, elementOrElementRef, _platform, injector) {
|
|
156
|
+
this._target = _target;
|
|
157
|
+
this._ngZone = _ngZone;
|
|
158
|
+
this._platform = _platform;
|
|
159
|
+
if (_platform.isBrowser) {
|
|
160
|
+
this._containerElement = coerceElement(elementOrElementRef);
|
|
161
|
+
}
|
|
162
|
+
if (injector) {
|
|
163
|
+
injector.get(_CdkPrivateStyleLoader).load(_MatRippleStylesLoader);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
fadeInRipple(x, y, config = {}) {
|
|
167
|
+
const containerRect = this._containerRect = this._containerRect || this._containerElement.getBoundingClientRect();
|
|
168
|
+
const animationConfig = {
|
|
169
|
+
...defaultRippleAnimationConfig,
|
|
170
|
+
...config.animation
|
|
171
|
+
};
|
|
172
|
+
if (config.centered) {
|
|
173
|
+
x = containerRect.left + containerRect.width / 2;
|
|
174
|
+
y = containerRect.top + containerRect.height / 2;
|
|
175
|
+
}
|
|
176
|
+
const radius = config.radius || distanceToFurthestCorner(x, y, containerRect);
|
|
177
|
+
const offsetX = x - containerRect.left;
|
|
178
|
+
const offsetY = y - containerRect.top;
|
|
179
|
+
const enterDuration = animationConfig.enterDuration;
|
|
180
|
+
const ripple = document.createElement('div');
|
|
181
|
+
ripple.classList.add('mat-ripple-element');
|
|
182
|
+
ripple.style.left = `${offsetX - radius}px`;
|
|
183
|
+
ripple.style.top = `${offsetY - radius}px`;
|
|
184
|
+
ripple.style.height = `${radius * 2}px`;
|
|
185
|
+
ripple.style.width = `${radius * 2}px`;
|
|
186
|
+
if (config.color != null) {
|
|
187
|
+
ripple.style.backgroundColor = config.color;
|
|
188
|
+
}
|
|
189
|
+
ripple.style.transitionDuration = `${enterDuration}ms`;
|
|
190
|
+
this._containerElement.appendChild(ripple);
|
|
191
|
+
const computedStyles = window.getComputedStyle(ripple);
|
|
192
|
+
const userTransitionProperty = computedStyles.transitionProperty;
|
|
193
|
+
const userTransitionDuration = computedStyles.transitionDuration;
|
|
194
|
+
const animationForciblyDisabledThroughCss = userTransitionProperty === 'none' || userTransitionDuration === '0s' || userTransitionDuration === '0s, 0s' || containerRect.width === 0 && containerRect.height === 0;
|
|
195
|
+
const rippleRef = new RippleRef(this, ripple, config, animationForciblyDisabledThroughCss);
|
|
196
|
+
ripple.style.transform = 'scale3d(1, 1, 1)';
|
|
197
|
+
rippleRef.state = RippleState.FADING_IN;
|
|
198
|
+
if (!config.persistent) {
|
|
199
|
+
this._mostRecentTransientRipple = rippleRef;
|
|
200
|
+
}
|
|
201
|
+
let eventListeners = null;
|
|
202
|
+
if (!animationForciblyDisabledThroughCss && (enterDuration || animationConfig.exitDuration)) {
|
|
203
|
+
this._ngZone.runOutsideAngular(() => {
|
|
204
|
+
const onTransitionEnd = () => {
|
|
205
|
+
if (eventListeners) {
|
|
206
|
+
eventListeners.fallbackTimer = null;
|
|
207
|
+
}
|
|
208
|
+
clearTimeout(fallbackTimer);
|
|
209
|
+
this._finishRippleTransition(rippleRef);
|
|
210
|
+
};
|
|
211
|
+
const onTransitionCancel = () => this._destroyRipple(rippleRef);
|
|
212
|
+
const fallbackTimer = setTimeout(onTransitionCancel, enterDuration + 100);
|
|
213
|
+
ripple.addEventListener('transitionend', onTransitionEnd);
|
|
214
|
+
ripple.addEventListener('transitioncancel', onTransitionCancel);
|
|
215
|
+
eventListeners = {
|
|
216
|
+
onTransitionEnd,
|
|
217
|
+
onTransitionCancel,
|
|
218
|
+
fallbackTimer
|
|
219
|
+
};
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
this._activeRipples.set(rippleRef, eventListeners);
|
|
223
|
+
if (animationForciblyDisabledThroughCss || !enterDuration) {
|
|
224
|
+
this._finishRippleTransition(rippleRef);
|
|
225
|
+
}
|
|
226
|
+
return rippleRef;
|
|
227
|
+
}
|
|
228
|
+
fadeOutRipple(rippleRef) {
|
|
229
|
+
if (rippleRef.state === RippleState.FADING_OUT || rippleRef.state === RippleState.HIDDEN) {
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
const rippleEl = rippleRef.element;
|
|
233
|
+
const animationConfig = {
|
|
234
|
+
...defaultRippleAnimationConfig,
|
|
235
|
+
...rippleRef.config.animation
|
|
236
|
+
};
|
|
237
|
+
rippleEl.style.transitionDuration = `${animationConfig.exitDuration}ms`;
|
|
238
|
+
rippleEl.style.opacity = '0';
|
|
239
|
+
rippleRef.state = RippleState.FADING_OUT;
|
|
240
|
+
if (rippleRef._animationForciblyDisabledThroughCss || !animationConfig.exitDuration) {
|
|
241
|
+
this._finishRippleTransition(rippleRef);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
fadeOutAll() {
|
|
245
|
+
this._getActiveRipples().forEach(ripple => ripple.fadeOut());
|
|
246
|
+
}
|
|
247
|
+
fadeOutAllNonPersistent() {
|
|
248
|
+
this._getActiveRipples().forEach(ripple => {
|
|
249
|
+
if (!ripple.config.persistent) {
|
|
250
|
+
ripple.fadeOut();
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
setupTriggerEvents(elementOrElementRef) {
|
|
255
|
+
const element = coerceElement(elementOrElementRef);
|
|
256
|
+
if (!this._platform.isBrowser || !element || element === this._triggerElement) {
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
this._removeTriggerEvents();
|
|
260
|
+
this._triggerElement = element;
|
|
261
|
+
pointerDownEvents.forEach(type => {
|
|
262
|
+
RippleRenderer._eventManager.addHandler(this._ngZone, type, element, this);
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
handleEvent(event) {
|
|
266
|
+
if (event.type === 'mousedown') {
|
|
267
|
+
this._onMousedown(event);
|
|
268
|
+
} else if (event.type === 'touchstart') {
|
|
269
|
+
this._onTouchStart(event);
|
|
270
|
+
} else {
|
|
271
|
+
this._onPointerUp();
|
|
272
|
+
}
|
|
273
|
+
if (!this._pointerUpEventsRegistered) {
|
|
274
|
+
this._ngZone.runOutsideAngular(() => {
|
|
275
|
+
pointerUpEvents.forEach(type => {
|
|
276
|
+
this._triggerElement.addEventListener(type, this, passiveCapturingEventOptions);
|
|
454
277
|
});
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
278
|
+
});
|
|
279
|
+
this._pointerUpEventsRegistered = true;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
_finishRippleTransition(rippleRef) {
|
|
283
|
+
if (rippleRef.state === RippleState.FADING_IN) {
|
|
284
|
+
this._startFadeOutTransition(rippleRef);
|
|
285
|
+
} else if (rippleRef.state === RippleState.FADING_OUT) {
|
|
286
|
+
this._destroyRipple(rippleRef);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
_startFadeOutTransition(rippleRef) {
|
|
290
|
+
const isMostRecentTransientRipple = rippleRef === this._mostRecentTransientRipple;
|
|
291
|
+
const {
|
|
292
|
+
persistent
|
|
293
|
+
} = rippleRef.config;
|
|
294
|
+
rippleRef.state = RippleState.VISIBLE;
|
|
295
|
+
if (!persistent && (!isMostRecentTransientRipple || !this._isPointerDown)) {
|
|
296
|
+
rippleRef.fadeOut();
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
_destroyRipple(rippleRef) {
|
|
300
|
+
const eventListeners = this._activeRipples.get(rippleRef) ?? null;
|
|
301
|
+
this._activeRipples.delete(rippleRef);
|
|
302
|
+
if (!this._activeRipples.size) {
|
|
303
|
+
this._containerRect = null;
|
|
304
|
+
}
|
|
305
|
+
if (rippleRef === this._mostRecentTransientRipple) {
|
|
306
|
+
this._mostRecentTransientRipple = null;
|
|
307
|
+
}
|
|
308
|
+
rippleRef.state = RippleState.HIDDEN;
|
|
309
|
+
if (eventListeners !== null) {
|
|
310
|
+
rippleRef.element.removeEventListener('transitionend', eventListeners.onTransitionEnd);
|
|
311
|
+
rippleRef.element.removeEventListener('transitioncancel', eventListeners.onTransitionCancel);
|
|
312
|
+
if (eventListeners.fallbackTimer !== null) {
|
|
313
|
+
clearTimeout(eventListeners.fallbackTimer);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
rippleRef.element.remove();
|
|
317
|
+
}
|
|
318
|
+
_onMousedown(event) {
|
|
319
|
+
const isFakeMousedown = isFakeMousedownFromScreenReader(event);
|
|
320
|
+
const isSyntheticEvent = this._lastTouchStartEvent && Date.now() < this._lastTouchStartEvent + ignoreMouseEventsTimeout;
|
|
321
|
+
if (!this._target.rippleDisabled && !isFakeMousedown && !isSyntheticEvent) {
|
|
322
|
+
this._isPointerDown = true;
|
|
323
|
+
this.fadeInRipple(event.clientX, event.clientY, this._target.rippleConfig);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
_onTouchStart(event) {
|
|
327
|
+
if (!this._target.rippleDisabled && !isFakeTouchstartFromScreenReader(event)) {
|
|
328
|
+
this._lastTouchStartEvent = Date.now();
|
|
329
|
+
this._isPointerDown = true;
|
|
330
|
+
const touches = event.changedTouches;
|
|
331
|
+
if (touches) {
|
|
332
|
+
for (let i = 0; i < touches.length; i++) {
|
|
333
|
+
this.fadeInRipple(touches[i].clientX, touches[i].clientY, this._target.rippleConfig);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
_onPointerUp() {
|
|
339
|
+
if (!this._isPointerDown) {
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
this._isPointerDown = false;
|
|
343
|
+
this._getActiveRipples().forEach(ripple => {
|
|
344
|
+
const isVisible = ripple.state === RippleState.VISIBLE || ripple.config.terminateOnPointerUp && ripple.state === RippleState.FADING_IN;
|
|
345
|
+
if (!ripple.config.persistent && isVisible) {
|
|
346
|
+
ripple.fadeOut();
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
_getActiveRipples() {
|
|
351
|
+
return Array.from(this._activeRipples.keys());
|
|
352
|
+
}
|
|
353
|
+
_removeTriggerEvents() {
|
|
354
|
+
const trigger = this._triggerElement;
|
|
355
|
+
if (trigger) {
|
|
356
|
+
pointerDownEvents.forEach(type => RippleRenderer._eventManager.removeHandler(type, trigger, this));
|
|
357
|
+
if (this._pointerUpEventsRegistered) {
|
|
358
|
+
pointerUpEvents.forEach(type => trigger.removeEventListener(type, this, passiveCapturingEventOptions));
|
|
359
|
+
this._pointerUpEventsRegistered = false;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
470
363
|
}
|
|
471
|
-
/**
|
|
472
|
-
* Returns the distance from the point (x, y) to the furthest corner of a rectangle.
|
|
473
|
-
*/
|
|
474
364
|
function distanceToFurthestCorner(x, y, rect) {
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
365
|
+
const distX = Math.max(Math.abs(x - rect.left), Math.abs(x - rect.right));
|
|
366
|
+
const distY = Math.max(Math.abs(y - rect.top), Math.abs(y - rect.bottom));
|
|
367
|
+
return Math.sqrt(distX * distX + distY * distY);
|
|
478
368
|
}
|
|
479
369
|
|
|
480
|
-
/** Injection token that can be used to specify the global ripple options. */
|
|
481
370
|
const MAT_RIPPLE_GLOBAL_OPTIONS = new InjectionToken('mat-ripple-global-options');
|
|
482
371
|
class MatRipple {
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
this.
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
this.
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.0-next.2", type: MatRipple, isStandalone: true, selector: "[mat-ripple], [matRipple]", inputs: { color: ["matRippleColor", "color"], unbounded: ["matRippleUnbounded", "unbounded"], centered: ["matRippleCentered", "centered"], radius: ["matRippleRadius", "radius"], animation: ["matRippleAnimation", "animation"], disabled: ["matRippleDisabled", "disabled"], trigger: ["matRippleTrigger", "trigger"] }, host: { properties: { "class.mat-ripple-unbounded": "unbounded" }, classAttribute: "mat-ripple" }, exportAs: ["matRipple"], ngImport: i0 });
|
|
372
|
+
_elementRef = inject(ElementRef);
|
|
373
|
+
_animationsDisabled = _animationsDisabled();
|
|
374
|
+
color;
|
|
375
|
+
unbounded;
|
|
376
|
+
centered;
|
|
377
|
+
radius = 0;
|
|
378
|
+
animation;
|
|
379
|
+
get disabled() {
|
|
380
|
+
return this._disabled;
|
|
381
|
+
}
|
|
382
|
+
set disabled(value) {
|
|
383
|
+
if (value) {
|
|
384
|
+
this.fadeOutAllNonPersistent();
|
|
385
|
+
}
|
|
386
|
+
this._disabled = value;
|
|
387
|
+
this._setupTriggerEventsIfEnabled();
|
|
388
|
+
}
|
|
389
|
+
_disabled = false;
|
|
390
|
+
get trigger() {
|
|
391
|
+
return this._trigger || this._elementRef.nativeElement;
|
|
392
|
+
}
|
|
393
|
+
set trigger(trigger) {
|
|
394
|
+
this._trigger = trigger;
|
|
395
|
+
this._setupTriggerEventsIfEnabled();
|
|
396
|
+
}
|
|
397
|
+
_trigger;
|
|
398
|
+
_rippleRenderer;
|
|
399
|
+
_globalOptions;
|
|
400
|
+
_isInitialized = false;
|
|
401
|
+
constructor() {
|
|
402
|
+
const ngZone = inject(NgZone);
|
|
403
|
+
const platform = inject(Platform);
|
|
404
|
+
const globalOptions = inject(MAT_RIPPLE_GLOBAL_OPTIONS, {
|
|
405
|
+
optional: true
|
|
406
|
+
});
|
|
407
|
+
const injector = inject(Injector);
|
|
408
|
+
this._globalOptions = globalOptions || {};
|
|
409
|
+
this._rippleRenderer = new RippleRenderer(this, ngZone, this._elementRef, platform, injector);
|
|
410
|
+
}
|
|
411
|
+
ngOnInit() {
|
|
412
|
+
this._isInitialized = true;
|
|
413
|
+
this._setupTriggerEventsIfEnabled();
|
|
414
|
+
}
|
|
415
|
+
ngOnDestroy() {
|
|
416
|
+
this._rippleRenderer._removeTriggerEvents();
|
|
417
|
+
}
|
|
418
|
+
fadeOutAll() {
|
|
419
|
+
this._rippleRenderer.fadeOutAll();
|
|
420
|
+
}
|
|
421
|
+
fadeOutAllNonPersistent() {
|
|
422
|
+
this._rippleRenderer.fadeOutAllNonPersistent();
|
|
423
|
+
}
|
|
424
|
+
get rippleConfig() {
|
|
425
|
+
return {
|
|
426
|
+
centered: this.centered,
|
|
427
|
+
radius: this.radius,
|
|
428
|
+
color: this.color,
|
|
429
|
+
animation: {
|
|
430
|
+
...this._globalOptions.animation,
|
|
431
|
+
...(this._animationsDisabled ? {
|
|
432
|
+
enterDuration: 0,
|
|
433
|
+
exitDuration: 0
|
|
434
|
+
} : {}),
|
|
435
|
+
...this.animation
|
|
436
|
+
},
|
|
437
|
+
terminateOnPointerUp: this._globalOptions.terminateOnPointerUp
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
get rippleDisabled() {
|
|
441
|
+
return this.disabled || !!this._globalOptions.disabled;
|
|
442
|
+
}
|
|
443
|
+
_setupTriggerEventsIfEnabled() {
|
|
444
|
+
if (!this.disabled && this._isInitialized) {
|
|
445
|
+
this._rippleRenderer.setupTriggerEvents(this.trigger);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
launch(configOrX, y = 0, config) {
|
|
449
|
+
if (typeof configOrX === 'number') {
|
|
450
|
+
return this._rippleRenderer.fadeInRipple(configOrX, y, {
|
|
451
|
+
...this.rippleConfig,
|
|
452
|
+
...config
|
|
453
|
+
});
|
|
454
|
+
} else {
|
|
455
|
+
return this._rippleRenderer.fadeInRipple(0, 0, {
|
|
456
|
+
...this.rippleConfig,
|
|
457
|
+
...configOrX
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
462
|
+
minVersion: "12.0.0",
|
|
463
|
+
version: "20.2.0-next.2",
|
|
464
|
+
ngImport: i0,
|
|
465
|
+
type: MatRipple,
|
|
466
|
+
deps: [],
|
|
467
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
468
|
+
});
|
|
469
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
470
|
+
minVersion: "14.0.0",
|
|
471
|
+
version: "20.2.0-next.2",
|
|
472
|
+
type: MatRipple,
|
|
473
|
+
isStandalone: true,
|
|
474
|
+
selector: "[mat-ripple], [matRipple]",
|
|
475
|
+
inputs: {
|
|
476
|
+
color: ["matRippleColor", "color"],
|
|
477
|
+
unbounded: ["matRippleUnbounded", "unbounded"],
|
|
478
|
+
centered: ["matRippleCentered", "centered"],
|
|
479
|
+
radius: ["matRippleRadius", "radius"],
|
|
480
|
+
animation: ["matRippleAnimation", "animation"],
|
|
481
|
+
disabled: ["matRippleDisabled", "disabled"],
|
|
482
|
+
trigger: ["matRippleTrigger", "trigger"]
|
|
483
|
+
},
|
|
484
|
+
host: {
|
|
485
|
+
properties: {
|
|
486
|
+
"class.mat-ripple-unbounded": "unbounded"
|
|
487
|
+
},
|
|
488
|
+
classAttribute: "mat-ripple"
|
|
489
|
+
},
|
|
490
|
+
exportAs: ["matRipple"],
|
|
491
|
+
ngImport: i0
|
|
492
|
+
});
|
|
605
493
|
}
|
|
606
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
494
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
495
|
+
minVersion: "12.0.0",
|
|
496
|
+
version: "20.2.0-next.2",
|
|
497
|
+
ngImport: i0,
|
|
498
|
+
type: MatRipple,
|
|
499
|
+
decorators: [{
|
|
500
|
+
type: Directive,
|
|
501
|
+
args: [{
|
|
502
|
+
selector: '[mat-ripple], [matRipple]',
|
|
503
|
+
exportAs: 'matRipple',
|
|
504
|
+
host: {
|
|
505
|
+
'class': 'mat-ripple',
|
|
506
|
+
'[class.mat-ripple-unbounded]': 'unbounded'
|
|
507
|
+
}
|
|
508
|
+
}]
|
|
509
|
+
}],
|
|
510
|
+
ctorParameters: () => [],
|
|
511
|
+
propDecorators: {
|
|
512
|
+
color: [{
|
|
513
|
+
type: Input,
|
|
514
|
+
args: ['matRippleColor']
|
|
515
|
+
}],
|
|
516
|
+
unbounded: [{
|
|
517
|
+
type: Input,
|
|
518
|
+
args: ['matRippleUnbounded']
|
|
519
|
+
}],
|
|
520
|
+
centered: [{
|
|
521
|
+
type: Input,
|
|
522
|
+
args: ['matRippleCentered']
|
|
523
|
+
}],
|
|
524
|
+
radius: [{
|
|
525
|
+
type: Input,
|
|
526
|
+
args: ['matRippleRadius']
|
|
527
|
+
}],
|
|
528
|
+
animation: [{
|
|
529
|
+
type: Input,
|
|
530
|
+
args: ['matRippleAnimation']
|
|
531
|
+
}],
|
|
532
|
+
disabled: [{
|
|
533
|
+
type: Input,
|
|
534
|
+
args: ['matRippleDisabled']
|
|
535
|
+
}],
|
|
536
|
+
trigger: [{
|
|
537
|
+
type: Input,
|
|
538
|
+
args: ['matRippleTrigger']
|
|
539
|
+
}]
|
|
540
|
+
}
|
|
541
|
+
});
|
|
638
542
|
|
|
639
543
|
export { MAT_RIPPLE_GLOBAL_OPTIONS, MatRipple, RippleRef, RippleRenderer, RippleState, defaultRippleAnimationConfig };
|
|
640
544
|
//# sourceMappingURL=_ripple-chunk.mjs.map
|