@angular/material 21.0.0-next.8 → 21.0.0-rc.0
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 +810 -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 -350
- 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 +125 -186
- 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/sort.d.ts +1 -1
- package/types/table-testing.d.ts +27 -1
- package/types/timepicker.d.ts +148 -128
package/fesm2022/icon.mjs
CHANGED
|
@@ -8,384 +8,358 @@ export { getMatIconFailedToSanitizeLiteralError, getMatIconFailedToSanitizeUrlEr
|
|
|
8
8
|
import '@angular/common/http';
|
|
9
9
|
import '@angular/platform-browser';
|
|
10
10
|
|
|
11
|
-
/** Injection token to be used to override the default options for `mat-icon`. */
|
|
12
11
|
const MAT_ICON_DEFAULT_OPTIONS = new InjectionToken('MAT_ICON_DEFAULT_OPTIONS');
|
|
13
|
-
/**
|
|
14
|
-
* Injection token used to provide the current location to `MatIcon`.
|
|
15
|
-
* Used to handle server-side rendering and to stub out during unit tests.
|
|
16
|
-
* @docs-private
|
|
17
|
-
*/
|
|
18
12
|
const MAT_ICON_LOCATION = new InjectionToken('mat-icon-location', {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
28
|
-
},
|
|
13
|
+
providedIn: 'root',
|
|
14
|
+
factory: () => {
|
|
15
|
+
const _document = inject(DOCUMENT);
|
|
16
|
+
const _location = _document ? _document.location : null;
|
|
17
|
+
return {
|
|
18
|
+
getPathname: () => _location ? _location.pathname + _location.search : ''
|
|
19
|
+
};
|
|
20
|
+
}
|
|
29
21
|
});
|
|
30
|
-
|
|
31
|
-
const funcIriAttributes = [
|
|
32
|
-
'clip-path',
|
|
33
|
-
'color-profile',
|
|
34
|
-
'src',
|
|
35
|
-
'cursor',
|
|
36
|
-
'fill',
|
|
37
|
-
'filter',
|
|
38
|
-
'marker',
|
|
39
|
-
'marker-start',
|
|
40
|
-
'marker-mid',
|
|
41
|
-
'marker-end',
|
|
42
|
-
'mask',
|
|
43
|
-
'stroke',
|
|
44
|
-
];
|
|
45
|
-
/** Selector that can be used to find all elements that are using a `FuncIRI`. */
|
|
22
|
+
const funcIriAttributes = ['clip-path', 'color-profile', 'src', 'cursor', 'fill', 'filter', 'marker', 'marker-start', 'marker-mid', 'marker-end', 'mask', 'stroke'];
|
|
46
23
|
const funcIriAttributeSelector = funcIriAttributes.map(attr => `[${attr}]`).join(', ');
|
|
47
|
-
/** Regex that can be used to extract the id out of a FuncIRI. */
|
|
48
24
|
const funcIriPattern = /^url\(['"]?#(.*?)['"]?\)$/;
|
|
49
|
-
/**
|
|
50
|
-
* Component to display an icon. It can be used in the following ways:
|
|
51
|
-
*
|
|
52
|
-
* - Specify the svgIcon input to load an SVG icon from a URL previously registered with the
|
|
53
|
-
* addSvgIcon, addSvgIconInNamespace, addSvgIconSet, or addSvgIconSetInNamespace methods of
|
|
54
|
-
* MatIconRegistry. If the svgIcon value contains a colon it is assumed to be in the format
|
|
55
|
-
* "[namespace]:[name]", if not the value will be the name of an icon in the default namespace.
|
|
56
|
-
* Examples:
|
|
57
|
-
* `<mat-icon svgIcon="left-arrow"></mat-icon>
|
|
58
|
-
* <mat-icon svgIcon="animals:cat"></mat-icon>`
|
|
59
|
-
*
|
|
60
|
-
* - Use a font ligature as an icon by putting the ligature text in the `fontIcon` attribute or the
|
|
61
|
-
* content of the `<mat-icon>` component. If you register a custom font class, don't forget to also
|
|
62
|
-
* include the special class `mat-ligature-font`. It is recommended to use the attribute alternative
|
|
63
|
-
* to prevent the ligature text to be selectable and to appear in search engine results.
|
|
64
|
-
* By default, the Material icons font is used as described at
|
|
65
|
-
* http://google.github.io/material-design-icons/#icon-font-for-the-web. You can specify an
|
|
66
|
-
* alternate font by setting the fontSet input to either the CSS class to apply to use the
|
|
67
|
-
* desired font, or to an alias previously registered with MatIconRegistry.registerFontClassAlias.
|
|
68
|
-
* Examples:
|
|
69
|
-
* `<mat-icon fontIcon="home"></mat-icon>
|
|
70
|
-
* <mat-icon>home</mat-icon>
|
|
71
|
-
* <mat-icon fontSet="myfont" fontIcon="sun"></mat-icon>
|
|
72
|
-
* <mat-icon fontSet="myfont">sun</mat-icon>`
|
|
73
|
-
*
|
|
74
|
-
* - Specify a font glyph to be included via CSS rules by setting the fontSet input to specify the
|
|
75
|
-
* font, and the fontIcon input to specify the icon. Typically the fontIcon will specify a
|
|
76
|
-
* CSS class which causes the glyph to be displayed via a :before selector, as in
|
|
77
|
-
* https://fontawesome-v4.github.io/examples/
|
|
78
|
-
* Example:
|
|
79
|
-
* `<mat-icon fontSet="fa" fontIcon="alarm"></mat-icon>`
|
|
80
|
-
*/
|
|
81
25
|
class MatIcon {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
26
|
+
_elementRef = inject(ElementRef);
|
|
27
|
+
_iconRegistry = inject(MatIconRegistry);
|
|
28
|
+
_location = inject(MAT_ICON_LOCATION);
|
|
29
|
+
_errorHandler = inject(ErrorHandler);
|
|
30
|
+
_defaultColor;
|
|
31
|
+
get color() {
|
|
32
|
+
return this._color || this._defaultColor;
|
|
33
|
+
}
|
|
34
|
+
set color(value) {
|
|
35
|
+
this._color = value;
|
|
36
|
+
}
|
|
37
|
+
_color;
|
|
38
|
+
inline = false;
|
|
39
|
+
get svgIcon() {
|
|
40
|
+
return this._svgIcon;
|
|
41
|
+
}
|
|
42
|
+
set svgIcon(value) {
|
|
43
|
+
if (value !== this._svgIcon) {
|
|
44
|
+
if (value) {
|
|
45
|
+
this._updateSvgIcon(value);
|
|
46
|
+
} else if (this._svgIcon) {
|
|
47
|
+
this._clearSvgElement();
|
|
48
|
+
}
|
|
49
|
+
this._svgIcon = value;
|
|
96
50
|
}
|
|
97
|
-
|
|
98
|
-
|
|
51
|
+
}
|
|
52
|
+
_svgIcon;
|
|
53
|
+
get fontSet() {
|
|
54
|
+
return this._fontSet;
|
|
55
|
+
}
|
|
56
|
+
set fontSet(value) {
|
|
57
|
+
const newValue = this._cleanupFontValue(value);
|
|
58
|
+
if (newValue !== this._fontSet) {
|
|
59
|
+
this._fontSet = newValue;
|
|
60
|
+
this._updateFontIconClasses();
|
|
99
61
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
62
|
+
}
|
|
63
|
+
_fontSet;
|
|
64
|
+
get fontIcon() {
|
|
65
|
+
return this._fontIcon;
|
|
66
|
+
}
|
|
67
|
+
set fontIcon(value) {
|
|
68
|
+
const newValue = this._cleanupFontValue(value);
|
|
69
|
+
if (newValue !== this._fontIcon) {
|
|
70
|
+
this._fontIcon = newValue;
|
|
71
|
+
this._updateFontIconClasses();
|
|
109
72
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
73
|
+
}
|
|
74
|
+
_fontIcon;
|
|
75
|
+
_previousFontSetClass = [];
|
|
76
|
+
_previousFontIconClass;
|
|
77
|
+
_svgName;
|
|
78
|
+
_svgNamespace;
|
|
79
|
+
_previousPath;
|
|
80
|
+
_elementsWithExternalReferences;
|
|
81
|
+
_currentIconFetch = Subscription.EMPTY;
|
|
82
|
+
constructor() {
|
|
83
|
+
const ariaHidden = inject(new HostAttributeToken('aria-hidden'), {
|
|
84
|
+
optional: true
|
|
85
|
+
});
|
|
86
|
+
const defaults = inject(MAT_ICON_DEFAULT_OPTIONS, {
|
|
87
|
+
optional: true
|
|
88
|
+
});
|
|
89
|
+
if (defaults) {
|
|
90
|
+
if (defaults.color) {
|
|
91
|
+
this.color = this._defaultColor = defaults.color;
|
|
92
|
+
}
|
|
93
|
+
if (defaults.fontSet) {
|
|
94
|
+
this.fontSet = defaults.fontSet;
|
|
95
|
+
}
|
|
120
96
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
get fontSet() {
|
|
124
|
-
return this._fontSet;
|
|
97
|
+
if (!ariaHidden) {
|
|
98
|
+
this._elementRef.nativeElement.setAttribute('aria-hidden', 'true');
|
|
125
99
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
this._updateFontIconClasses();
|
|
131
|
-
}
|
|
100
|
+
}
|
|
101
|
+
_splitIconName(iconName) {
|
|
102
|
+
if (!iconName) {
|
|
103
|
+
return ['', ''];
|
|
132
104
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
return
|
|
105
|
+
const parts = iconName.split(':');
|
|
106
|
+
switch (parts.length) {
|
|
107
|
+
case 1:
|
|
108
|
+
return ['', parts[0]];
|
|
109
|
+
case 2:
|
|
110
|
+
return parts;
|
|
111
|
+
default:
|
|
112
|
+
throw Error(`Invalid icon name: "${iconName}"`);
|
|
137
113
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
/** Keeps track of the current page path. */
|
|
151
|
-
_previousPath;
|
|
152
|
-
/** Keeps track of the elements and attributes that we've prefixed with the current path. */
|
|
153
|
-
_elementsWithExternalReferences;
|
|
154
|
-
/** Subscription to the current in-progress SVG icon request. */
|
|
155
|
-
_currentIconFetch = Subscription.EMPTY;
|
|
156
|
-
constructor() {
|
|
157
|
-
const ariaHidden = inject(new HostAttributeToken('aria-hidden'), { optional: true });
|
|
158
|
-
const defaults = inject(MAT_ICON_DEFAULT_OPTIONS, { optional: true });
|
|
159
|
-
if (defaults) {
|
|
160
|
-
if (defaults.color) {
|
|
161
|
-
this.color = this._defaultColor = defaults.color;
|
|
162
|
-
}
|
|
163
|
-
if (defaults.fontSet) {
|
|
164
|
-
this.fontSet = defaults.fontSet;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
// If the user has not explicitly set aria-hidden, mark the icon as hidden, as this is
|
|
168
|
-
// the right thing to do for the majority of icon use-cases.
|
|
169
|
-
if (!ariaHidden) {
|
|
170
|
-
this._elementRef.nativeElement.setAttribute('aria-hidden', 'true');
|
|
171
|
-
}
|
|
114
|
+
}
|
|
115
|
+
ngOnInit() {
|
|
116
|
+
this._updateFontIconClasses();
|
|
117
|
+
}
|
|
118
|
+
ngAfterViewChecked() {
|
|
119
|
+
const cachedElements = this._elementsWithExternalReferences;
|
|
120
|
+
if (cachedElements && cachedElements.size) {
|
|
121
|
+
const newPath = this._location.getPathname();
|
|
122
|
+
if (newPath !== this._previousPath) {
|
|
123
|
+
this._previousPath = newPath;
|
|
124
|
+
this._prependPathToReferences(newPath);
|
|
125
|
+
}
|
|
172
126
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
* the icon name. If the argument is falsy, returns an array of two empty strings.
|
|
179
|
-
* Throws an error if the name contains two or more ':' separators.
|
|
180
|
-
* Examples:
|
|
181
|
-
* `'social:cake' -> ['social', 'cake']
|
|
182
|
-
* 'penguin' -> ['', 'penguin']
|
|
183
|
-
* null -> ['', '']
|
|
184
|
-
* 'a:b:c' -> (throws Error)`
|
|
185
|
-
*/
|
|
186
|
-
_splitIconName(iconName) {
|
|
187
|
-
if (!iconName) {
|
|
188
|
-
return ['', ''];
|
|
189
|
-
}
|
|
190
|
-
const parts = iconName.split(':');
|
|
191
|
-
switch (parts.length) {
|
|
192
|
-
case 1:
|
|
193
|
-
return ['', parts[0]]; // Use default namespace.
|
|
194
|
-
case 2:
|
|
195
|
-
return parts;
|
|
196
|
-
default:
|
|
197
|
-
throw Error(`Invalid icon name: "${iconName}"`); // TODO: add an ngDevMode check
|
|
198
|
-
}
|
|
127
|
+
}
|
|
128
|
+
ngOnDestroy() {
|
|
129
|
+
this._currentIconFetch.unsubscribe();
|
|
130
|
+
if (this._elementsWithExternalReferences) {
|
|
131
|
+
this._elementsWithExternalReferences.clear();
|
|
199
132
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
133
|
+
}
|
|
134
|
+
_usingFontIcon() {
|
|
135
|
+
return !this.svgIcon;
|
|
136
|
+
}
|
|
137
|
+
_setSvgElement(svg) {
|
|
138
|
+
this._clearSvgElement();
|
|
139
|
+
const path = this._location.getPathname();
|
|
140
|
+
this._previousPath = path;
|
|
141
|
+
this._cacheChildrenWithExternalReferences(svg);
|
|
142
|
+
this._prependPathToReferences(path);
|
|
143
|
+
this._elementRef.nativeElement.appendChild(svg);
|
|
144
|
+
}
|
|
145
|
+
_clearSvgElement() {
|
|
146
|
+
const layoutElement = this._elementRef.nativeElement;
|
|
147
|
+
let childCount = layoutElement.childNodes.length;
|
|
148
|
+
if (this._elementsWithExternalReferences) {
|
|
149
|
+
this._elementsWithExternalReferences.clear();
|
|
204
150
|
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
// the browser doesn't have an API that will let us react on link clicks and
|
|
211
|
-
// we can't depend on the Angular router. The references need to be updated,
|
|
212
|
-
// because while most browsers don't care whether the URL is correct after
|
|
213
|
-
// the first render, Safari will break if the user navigates to a different
|
|
214
|
-
// page and the SVG isn't re-rendered.
|
|
215
|
-
if (newPath !== this._previousPath) {
|
|
216
|
-
this._previousPath = newPath;
|
|
217
|
-
this._prependPathToReferences(newPath);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
151
|
+
while (childCount--) {
|
|
152
|
+
const child = layoutElement.childNodes[childCount];
|
|
153
|
+
if (child.nodeType !== 1 || child.nodeName.toLowerCase() === 'svg') {
|
|
154
|
+
child.remove();
|
|
155
|
+
}
|
|
220
156
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
}
|
|
157
|
+
}
|
|
158
|
+
_updateFontIconClasses() {
|
|
159
|
+
if (!this._usingFontIcon()) {
|
|
160
|
+
return;
|
|
226
161
|
}
|
|
227
|
-
|
|
228
|
-
|
|
162
|
+
const elem = this._elementRef.nativeElement;
|
|
163
|
+
const fontSetClasses = (this.fontSet ? this._iconRegistry.classNameForFontAlias(this.fontSet).split(/ +/) : this._iconRegistry.getDefaultFontSetClass()).filter(className => className.length > 0);
|
|
164
|
+
this._previousFontSetClass.forEach(className => elem.classList.remove(className));
|
|
165
|
+
fontSetClasses.forEach(className => elem.classList.add(className));
|
|
166
|
+
this._previousFontSetClass = fontSetClasses;
|
|
167
|
+
if (this.fontIcon !== this._previousFontIconClass && !fontSetClasses.includes('mat-ligature-font')) {
|
|
168
|
+
if (this._previousFontIconClass) {
|
|
169
|
+
elem.classList.remove(this._previousFontIconClass);
|
|
170
|
+
}
|
|
171
|
+
if (this.fontIcon) {
|
|
172
|
+
elem.classList.add(this.fontIcon);
|
|
173
|
+
}
|
|
174
|
+
this._previousFontIconClass = this.fontIcon;
|
|
229
175
|
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
176
|
+
}
|
|
177
|
+
_cleanupFontValue(value) {
|
|
178
|
+
return typeof value === 'string' ? value.trim().split(' ')[0] : value;
|
|
179
|
+
}
|
|
180
|
+
_prependPathToReferences(path) {
|
|
181
|
+
const elements = this._elementsWithExternalReferences;
|
|
182
|
+
if (elements) {
|
|
183
|
+
elements.forEach((attrs, element) => {
|
|
184
|
+
attrs.forEach(attr => {
|
|
185
|
+
element.setAttribute(attr.name, `url('${path}#${attr.value}')`);
|
|
186
|
+
});
|
|
187
|
+
});
|
|
239
188
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
189
|
+
}
|
|
190
|
+
_cacheChildrenWithExternalReferences(element) {
|
|
191
|
+
const elementsWithFuncIri = element.querySelectorAll(funcIriAttributeSelector);
|
|
192
|
+
const elements = this._elementsWithExternalReferences = this._elementsWithExternalReferences || new Map();
|
|
193
|
+
for (let i = 0; i < elementsWithFuncIri.length; i++) {
|
|
194
|
+
funcIriAttributes.forEach(attr => {
|
|
195
|
+
const elementWithReference = elementsWithFuncIri[i];
|
|
196
|
+
const value = elementWithReference.getAttribute(attr);
|
|
197
|
+
const match = value ? value.match(funcIriPattern) : null;
|
|
198
|
+
if (match) {
|
|
199
|
+
let attributes = elements.get(elementWithReference);
|
|
200
|
+
if (!attributes) {
|
|
201
|
+
attributes = [];
|
|
202
|
+
elements.set(elementWithReference, attributes);
|
|
203
|
+
}
|
|
204
|
+
attributes.push({
|
|
205
|
+
name: attr,
|
|
206
|
+
value: match[1]
|
|
207
|
+
});
|
|
255
208
|
}
|
|
209
|
+
});
|
|
256
210
|
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
this.
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
elem.classList.add(this.fontIcon);
|
|
275
|
-
}
|
|
276
|
-
this._previousFontIconClass = this.fontIcon;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Cleans up a value to be used as a fontIcon or fontSet.
|
|
281
|
-
* Since the value ends up being assigned as a CSS class, we
|
|
282
|
-
* have to trim the value and omit space-separated values.
|
|
283
|
-
*/
|
|
284
|
-
_cleanupFontValue(value) {
|
|
285
|
-
return typeof value === 'string' ? value.trim().split(' ')[0] : value;
|
|
286
|
-
}
|
|
287
|
-
/**
|
|
288
|
-
* Prepends the current path to all elements that have an attribute pointing to a `FuncIRI`
|
|
289
|
-
* reference. This is required because WebKit browsers require references to be prefixed with
|
|
290
|
-
* the current path, if the page has a `base` tag.
|
|
291
|
-
*/
|
|
292
|
-
_prependPathToReferences(path) {
|
|
293
|
-
const elements = this._elementsWithExternalReferences;
|
|
294
|
-
if (elements) {
|
|
295
|
-
elements.forEach((attrs, element) => {
|
|
296
|
-
attrs.forEach(attr => {
|
|
297
|
-
element.setAttribute(attr.name, `url('${path}#${attr.value}')`);
|
|
298
|
-
});
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
/**
|
|
303
|
-
* Caches the children of an SVG element that have `url()`
|
|
304
|
-
* references that we need to prefix with the current path.
|
|
305
|
-
*/
|
|
306
|
-
_cacheChildrenWithExternalReferences(element) {
|
|
307
|
-
const elementsWithFuncIri = element.querySelectorAll(funcIriAttributeSelector);
|
|
308
|
-
const elements = (this._elementsWithExternalReferences =
|
|
309
|
-
this._elementsWithExternalReferences || new Map());
|
|
310
|
-
for (let i = 0; i < elementsWithFuncIri.length; i++) {
|
|
311
|
-
funcIriAttributes.forEach(attr => {
|
|
312
|
-
const elementWithReference = elementsWithFuncIri[i];
|
|
313
|
-
const value = elementWithReference.getAttribute(attr);
|
|
314
|
-
const match = value ? value.match(funcIriPattern) : null;
|
|
315
|
-
if (match) {
|
|
316
|
-
let attributes = elements.get(elementWithReference);
|
|
317
|
-
if (!attributes) {
|
|
318
|
-
attributes = [];
|
|
319
|
-
elements.set(elementWithReference, attributes);
|
|
320
|
-
}
|
|
321
|
-
attributes.push({ name: attr, value: match[1] });
|
|
322
|
-
}
|
|
323
|
-
});
|
|
324
|
-
}
|
|
211
|
+
}
|
|
212
|
+
_updateSvgIcon(rawName) {
|
|
213
|
+
this._svgNamespace = null;
|
|
214
|
+
this._svgName = null;
|
|
215
|
+
this._currentIconFetch.unsubscribe();
|
|
216
|
+
if (rawName) {
|
|
217
|
+
const [namespace, iconName] = this._splitIconName(rawName);
|
|
218
|
+
if (namespace) {
|
|
219
|
+
this._svgNamespace = namespace;
|
|
220
|
+
}
|
|
221
|
+
if (iconName) {
|
|
222
|
+
this._svgName = iconName;
|
|
223
|
+
}
|
|
224
|
+
this._currentIconFetch = this._iconRegistry.getNamedSvgIcon(iconName, namespace).pipe(take(1)).subscribe(svg => this._setSvgElement(svg), err => {
|
|
225
|
+
const errorMessage = `Error retrieving icon ${namespace}:${iconName}! ${err.message}`;
|
|
226
|
+
this._errorHandler.handleError(new Error(errorMessage));
|
|
227
|
+
});
|
|
325
228
|
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
|
|
229
|
+
}
|
|
230
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
231
|
+
minVersion: "12.0.0",
|
|
232
|
+
version: "20.2.0-next.2",
|
|
233
|
+
ngImport: i0,
|
|
234
|
+
type: MatIcon,
|
|
235
|
+
deps: [],
|
|
236
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
237
|
+
});
|
|
238
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
239
|
+
minVersion: "16.1.0",
|
|
240
|
+
version: "20.2.0-next.2",
|
|
241
|
+
type: MatIcon,
|
|
242
|
+
isStandalone: true,
|
|
243
|
+
selector: "mat-icon",
|
|
244
|
+
inputs: {
|
|
245
|
+
color: "color",
|
|
246
|
+
inline: ["inline", "inline", booleanAttribute],
|
|
247
|
+
svgIcon: "svgIcon",
|
|
248
|
+
fontSet: "fontSet",
|
|
249
|
+
fontIcon: "fontIcon"
|
|
250
|
+
},
|
|
251
|
+
host: {
|
|
252
|
+
attributes: {
|
|
253
|
+
"role": "img"
|
|
254
|
+
},
|
|
255
|
+
properties: {
|
|
256
|
+
"class": "color ? \"mat-\" + color : \"\"",
|
|
257
|
+
"attr.data-mat-icon-type": "_usingFontIcon() ? \"font\" : \"svg\"",
|
|
258
|
+
"attr.data-mat-icon-name": "_svgName || fontIcon",
|
|
259
|
+
"attr.data-mat-icon-namespace": "_svgNamespace || fontSet",
|
|
260
|
+
"attr.fontIcon": "_usingFontIcon() ? fontIcon : null",
|
|
261
|
+
"class.mat-icon-inline": "inline",
|
|
262
|
+
"class.mat-icon-no-color": "color !== \"primary\" && color !== \"accent\" && color !== \"warn\""
|
|
263
|
+
},
|
|
264
|
+
classAttribute: "mat-icon notranslate"
|
|
265
|
+
},
|
|
266
|
+
exportAs: ["matIcon"],
|
|
267
|
+
ngImport: i0,
|
|
268
|
+
template: '<ng-content></ng-content>',
|
|
269
|
+
isInline: true,
|
|
270
|
+
styles: ["mat-icon,mat-icon.mat-primary,mat-icon.mat-accent,mat-icon.mat-warn{color:var(--mat-icon-color, inherit)}.mat-icon{-webkit-user-select:none;user-select:none;background-repeat:no-repeat;display:inline-block;fill:currentColor;height:24px;width:24px;overflow:hidden}.mat-icon.mat-icon-inline{font-size:inherit;height:inherit;line-height:inherit;width:inherit}.mat-icon.mat-ligature-font[fontIcon]::before{content:attr(fontIcon)}[dir=rtl] .mat-icon-rtl-mirror{transform:scale(-1, 1)}.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-prefix .mat-icon,.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-suffix .mat-icon{display:block}.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-prefix .mat-icon-button .mat-icon,.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-suffix .mat-icon-button .mat-icon{margin:auto}\n"],
|
|
271
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
272
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
273
|
+
});
|
|
350
274
|
}
|
|
351
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
275
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
276
|
+
minVersion: "12.0.0",
|
|
277
|
+
version: "20.2.0-next.2",
|
|
278
|
+
ngImport: i0,
|
|
279
|
+
type: MatIcon,
|
|
280
|
+
decorators: [{
|
|
281
|
+
type: Component,
|
|
282
|
+
args: [{
|
|
283
|
+
template: '<ng-content></ng-content>',
|
|
284
|
+
selector: 'mat-icon',
|
|
285
|
+
exportAs: 'matIcon',
|
|
286
|
+
host: {
|
|
287
|
+
'role': 'img',
|
|
288
|
+
'class': 'mat-icon notranslate',
|
|
289
|
+
'[class]': 'color ? "mat-" + color : ""',
|
|
290
|
+
'[attr.data-mat-icon-type]': '_usingFontIcon() ? "font" : "svg"',
|
|
291
|
+
'[attr.data-mat-icon-name]': '_svgName || fontIcon',
|
|
292
|
+
'[attr.data-mat-icon-namespace]': '_svgNamespace || fontSet',
|
|
293
|
+
'[attr.fontIcon]': '_usingFontIcon() ? fontIcon : null',
|
|
294
|
+
'[class.mat-icon-inline]': 'inline',
|
|
295
|
+
'[class.mat-icon-no-color]': 'color !== "primary" && color !== "accent" && color !== "warn"'
|
|
296
|
+
},
|
|
297
|
+
encapsulation: ViewEncapsulation.None,
|
|
298
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
299
|
+
styles: ["mat-icon,mat-icon.mat-primary,mat-icon.mat-accent,mat-icon.mat-warn{color:var(--mat-icon-color, inherit)}.mat-icon{-webkit-user-select:none;user-select:none;background-repeat:no-repeat;display:inline-block;fill:currentColor;height:24px;width:24px;overflow:hidden}.mat-icon.mat-icon-inline{font-size:inherit;height:inherit;line-height:inherit;width:inherit}.mat-icon.mat-ligature-font[fontIcon]::before{content:attr(fontIcon)}[dir=rtl] .mat-icon-rtl-mirror{transform:scale(-1, 1)}.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-prefix .mat-icon,.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-suffix .mat-icon{display:block}.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-prefix .mat-icon-button .mat-icon,.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-suffix .mat-icon-button .mat-icon{margin:auto}\n"]
|
|
300
|
+
}]
|
|
301
|
+
}],
|
|
302
|
+
ctorParameters: () => [],
|
|
303
|
+
propDecorators: {
|
|
304
|
+
color: [{
|
|
305
|
+
type: Input
|
|
306
|
+
}],
|
|
307
|
+
inline: [{
|
|
308
|
+
type: Input,
|
|
309
|
+
args: [{
|
|
310
|
+
transform: booleanAttribute
|
|
311
|
+
}]
|
|
312
|
+
}],
|
|
313
|
+
svgIcon: [{
|
|
314
|
+
type: Input
|
|
315
|
+
}],
|
|
316
|
+
fontSet: [{
|
|
317
|
+
type: Input
|
|
318
|
+
}],
|
|
319
|
+
fontIcon: [{
|
|
320
|
+
type: Input
|
|
321
|
+
}]
|
|
322
|
+
}
|
|
323
|
+
});
|
|
376
324
|
|
|
377
325
|
class MatIconModule {
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
326
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
327
|
+
minVersion: "12.0.0",
|
|
328
|
+
version: "20.2.0-next.2",
|
|
329
|
+
ngImport: i0,
|
|
330
|
+
type: MatIconModule,
|
|
331
|
+
deps: [],
|
|
332
|
+
target: i0.ɵɵFactoryTarget.NgModule
|
|
333
|
+
});
|
|
334
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({
|
|
335
|
+
minVersion: "14.0.0",
|
|
336
|
+
version: "20.2.0-next.2",
|
|
337
|
+
ngImport: i0,
|
|
338
|
+
type: MatIconModule,
|
|
339
|
+
imports: [MatIcon],
|
|
340
|
+
exports: [MatIcon, BidiModule]
|
|
341
|
+
});
|
|
342
|
+
static ɵinj = i0.ɵɵngDeclareInjector({
|
|
343
|
+
minVersion: "12.0.0",
|
|
344
|
+
version: "20.2.0-next.2",
|
|
345
|
+
ngImport: i0,
|
|
346
|
+
type: MatIconModule,
|
|
347
|
+
imports: [BidiModule]
|
|
348
|
+
});
|
|
381
349
|
}
|
|
382
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
350
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
351
|
+
minVersion: "12.0.0",
|
|
352
|
+
version: "20.2.0-next.2",
|
|
353
|
+
ngImport: i0,
|
|
354
|
+
type: MatIconModule,
|
|
355
|
+
decorators: [{
|
|
356
|
+
type: NgModule,
|
|
357
|
+
args: [{
|
|
358
|
+
imports: [MatIcon],
|
|
359
|
+
exports: [MatIcon, BidiModule]
|
|
360
|
+
}]
|
|
361
|
+
}]
|
|
362
|
+
});
|
|
389
363
|
|
|
390
364
|
export { MAT_ICON_DEFAULT_OPTIONS, MAT_ICON_LOCATION, MatIcon, MatIconModule, MatIconRegistry };
|
|
391
365
|
//# sourceMappingURL=icon.mjs.map
|