@angular/material 17.1.0-next.2 → 17.1.0-next.3
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/button/_button-base.scss +14 -2
- package/button/_button-theme.scss +11 -11
- package/button/_fab-theme.scss +1 -8
- package/button/index.d.ts +31 -2
- package/core/index.d.ts +6 -2
- package/core/tokens/m2/mat/_fab.scss +3 -0
- package/core/tokens/m2/mat/_filled-button.scss +3 -0
- package/core/tokens/m2/mat/_icon-button.scss +3 -0
- package/core/tokens/m2/mat/_outlined-button.scss +3 -0
- package/core/tokens/m2/mat/_protected-button.scss +3 -0
- package/core/tokens/m2/mat/_tab-header.scss +6 -1
- package/core/tokens/m2/mat/_text-button.scss +3 -0
- package/core/tokens/m2/mdc/_filled-button.scss +7 -6
- package/core/tokens/m2/mdc/_outlined-button.scss +7 -7
- package/core/tokens/m2/mdc/_protected-button.scss +7 -6
- package/core/tokens/m2/mdc/_text-button.scss +7 -8
- package/esm2022/button/button-base.mjs +41 -14
- package/esm2022/button/button.mjs +5 -5
- package/esm2022/button/fab.mjs +9 -9
- package/esm2022/button/icon-button.mjs +5 -5
- package/esm2022/button/public-api.mjs +2 -1
- package/esm2022/button/testing/button-harness.mjs +4 -3
- package/esm2022/chips/chip-listbox.mjs +2 -3
- package/esm2022/chips/chip.mjs +2 -1
- package/esm2022/core/private/ripple-loader.mjs +27 -9
- package/esm2022/core/version.mjs +1 -1
- package/esm2022/tabs/tab-group.mjs +11 -2
- package/esm2022/tabs/tab-header.mjs +3 -3
- package/esm2022/tabs/tab-nav-bar/tab-nav-bar.mjs +3 -3
- package/fesm2022/button/testing.mjs +3 -2
- package/fesm2022/button/testing.mjs.map +1 -1
- package/fesm2022/button.mjs +57 -30
- package/fesm2022/button.mjs.map +1 -1
- package/fesm2022/chips.mjs +2 -2
- package/fesm2022/chips.mjs.map +1 -1
- package/fesm2022/core.mjs +27 -9
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/tabs.mjs +14 -5
- package/fesm2022/tabs.mjs.map +1 -1
- package/package.json +2 -2
- package/prebuilt-themes/deeppurple-amber.css +1 -1
- package/prebuilt-themes/indigo-pink.css +1 -1
- package/prebuilt-themes/pink-bluegrey.css +1 -1
- package/prebuilt-themes/purple-green.css +1 -1
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
- package/tabs/_tabs-common.scss +20 -1
- package/tabs/index.d.ts +5 -1
package/fesm2022/core.mjs
CHANGED
|
@@ -14,7 +14,7 @@ import { ANIMATION_MODULE_TYPE } from '@angular/platform-browser/animations';
|
|
|
14
14
|
import { ENTER, SPACE, hasModifierKey } from '@angular/cdk/keycodes';
|
|
15
15
|
|
|
16
16
|
/** Current version of Angular Material. */
|
|
17
|
-
const VERSION = new Version('17.1.0-next.
|
|
17
|
+
const VERSION = new Version('17.1.0-next.3');
|
|
18
18
|
|
|
19
19
|
/** @docs-private */
|
|
20
20
|
class AnimationCurves {
|
|
@@ -1768,6 +1768,8 @@ const matRippleDisabled = 'mat-ripple-loader-disabled';
|
|
|
1768
1768
|
*
|
|
1769
1769
|
* This service allows us to avoid eagerly creating & attaching MatRipples.
|
|
1770
1770
|
* It works by creating & attaching a ripple only when a component is first interacted with.
|
|
1771
|
+
*
|
|
1772
|
+
* @docs-private
|
|
1771
1773
|
*/
|
|
1772
1774
|
class MatRippleLoader {
|
|
1773
1775
|
constructor() {
|
|
@@ -1776,6 +1778,7 @@ class MatRippleLoader {
|
|
|
1776
1778
|
this._globalRippleOptions = inject(MAT_RIPPLE_GLOBAL_OPTIONS, { optional: true });
|
|
1777
1779
|
this._platform = inject(Platform);
|
|
1778
1780
|
this._ngZone = inject(NgZone);
|
|
1781
|
+
this._hosts = new Map();
|
|
1779
1782
|
/** Handles creating and attaching component internals when a component it is initially interacted with. */
|
|
1780
1783
|
this._onInteraction = (event) => {
|
|
1781
1784
|
if (!(event.target instanceof HTMLElement)) {
|
|
@@ -1785,7 +1788,7 @@ class MatRippleLoader {
|
|
|
1785
1788
|
// TODO(wagnermaciel): Consider batching these events to improve runtime performance.
|
|
1786
1789
|
const element = eventTarget.closest(`[${matRippleUninitialized}]`);
|
|
1787
1790
|
if (element) {
|
|
1788
|
-
this.
|
|
1791
|
+
this._createRipple(element);
|
|
1789
1792
|
}
|
|
1790
1793
|
};
|
|
1791
1794
|
this._ngZone.runOutsideAngular(() => {
|
|
@@ -1795,6 +1798,10 @@ class MatRippleLoader {
|
|
|
1795
1798
|
});
|
|
1796
1799
|
}
|
|
1797
1800
|
ngOnDestroy() {
|
|
1801
|
+
const hosts = this._hosts.keys();
|
|
1802
|
+
for (const host of hosts) {
|
|
1803
|
+
this.destroyRipple(host);
|
|
1804
|
+
}
|
|
1798
1805
|
for (const event of rippleInteractionEvents) {
|
|
1799
1806
|
this._document?.removeEventListener(event, this._onInteraction, eventListenerOptions);
|
|
1800
1807
|
}
|
|
@@ -1822,14 +1829,12 @@ class MatRippleLoader {
|
|
|
1822
1829
|
}
|
|
1823
1830
|
/** Returns the ripple instance for the given host element. */
|
|
1824
1831
|
getRipple(host) {
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
}
|
|
1828
|
-
return this.createRipple(host);
|
|
1832
|
+
const ripple = this._hosts.get(host);
|
|
1833
|
+
return ripple || this._createRipple(host);
|
|
1829
1834
|
}
|
|
1830
1835
|
/** Sets the disabled state on the ripple instance corresponding to the given host element. */
|
|
1831
1836
|
setDisabled(host, disabled) {
|
|
1832
|
-
const ripple = host
|
|
1837
|
+
const ripple = this._hosts.get(host);
|
|
1833
1838
|
// If the ripple has already been instantiated, just disable it.
|
|
1834
1839
|
if (ripple) {
|
|
1835
1840
|
ripple.disabled = disabled;
|
|
@@ -1845,10 +1850,14 @@ class MatRippleLoader {
|
|
|
1845
1850
|
}
|
|
1846
1851
|
}
|
|
1847
1852
|
/** Creates a MatRipple and appends it to the given element. */
|
|
1848
|
-
|
|
1853
|
+
_createRipple(host) {
|
|
1849
1854
|
if (!this._document) {
|
|
1850
1855
|
return;
|
|
1851
1856
|
}
|
|
1857
|
+
const existingRipple = this._hosts.get(host);
|
|
1858
|
+
if (existingRipple) {
|
|
1859
|
+
return existingRipple;
|
|
1860
|
+
}
|
|
1852
1861
|
// Create the ripple element.
|
|
1853
1862
|
host.querySelector('.mat-ripple')?.remove();
|
|
1854
1863
|
const rippleEl = this._document.createElement('span');
|
|
@@ -1865,7 +1874,16 @@ class MatRippleLoader {
|
|
|
1865
1874
|
}
|
|
1866
1875
|
attachRipple(host, ripple) {
|
|
1867
1876
|
host.removeAttribute(matRippleUninitialized);
|
|
1868
|
-
host
|
|
1877
|
+
this._hosts.set(host, ripple);
|
|
1878
|
+
}
|
|
1879
|
+
destroyRipple(host) {
|
|
1880
|
+
const ripple = this._hosts.get(host);
|
|
1881
|
+
if (ripple) {
|
|
1882
|
+
// Since this directive is created manually, it needs to be destroyed manually too.
|
|
1883
|
+
// tslint:disable-next-line:no-lifecycle-invocation
|
|
1884
|
+
ripple.ngOnDestroy();
|
|
1885
|
+
this._hosts.delete(host);
|
|
1886
|
+
}
|
|
1869
1887
|
}
|
|
1870
1888
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.0-next.2", ngImport: i0, type: MatRippleLoader, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1871
1889
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.0-next.2", ngImport: i0, type: MatRippleLoader, providedIn: 'root' }); }
|