Skip to content

Commit ca83d31

Browse files
authored
refactor: remove duplicate theme style warnings (angular#31361)
* refactor: remove duplicate theme style warnings * refactor: lint * refactor: lint and tests
1 parent 4df402e commit ca83d31

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+564
-1154
lines changed

src/material-experimental/column-resize/_column-resize-theme.scss

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,13 @@
141141
@mixin density($theme) {}
142142

143143
@mixin theme($theme) {
144-
@include mat.private-check-duplicate-theme-styles($theme, 'mat-column-resize') {
145-
@if mat.theme-has($theme, color) {
146-
@include color($theme);
147-
}
148-
@if mat.theme-has($theme, density) {
149-
@include density($theme);
150-
}
151-
@if mat.theme-has($theme, typography) {
152-
@include typography($theme);
153-
}
144+
@if mat.theme-has($theme, color) {
145+
@include color($theme);
146+
}
147+
@if mat.theme-has($theme, density) {
148+
@include density($theme);
149+
}
150+
@if mat.theme-has($theme, typography) {
151+
@include typography($theme);
154152
}
155153
}

src/material-experimental/popover-edit/_popover-edit-theme.scss

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,13 @@
154154
@mixin density($theme) {}
155155

156156
@mixin theme($theme) {
157-
@include mat.private-check-duplicate-theme-styles($theme, 'mat-popover-edit') {
158-
@if mat.theme-has($theme, color) {
159-
@include color($theme);
160-
}
161-
@if mat.theme-has($theme, density) {
162-
@include density($theme);
163-
}
164-
@if mat.theme-has($theme, typography) {
165-
@include typography($theme);
166-
}
157+
@if mat.theme-has($theme, color) {
158+
@include color($theme);
159+
}
160+
@if mat.theme-has($theme, density) {
161+
@include density($theme);
162+
}
163+
@if mat.theme-has($theme, typography) {
164+
@include typography($theme);
167165
}
168166
}
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
@use '@angular/material' as mat;
2-
31
@mixin theme($theme) {
4-
@include mat.private-check-duplicate-theme-styles($theme, 'mat-selection');
52
}
63

74
@mixin typography($theme) {}

src/material/_index.scss

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@
2323

2424
// Private/Internal
2525
@forward './core/density/private/all-density' show all-component-densities;
26-
@forward './core/theming/theming' show private-check-duplicate-theme-styles,
27-
private-legacy-get-theme, private-is-theme-object;
26+
@forward './core/theming/theming' show private-legacy-get-theme, private-is-theme-object;
2827
@forward './core/style/private' show private-theme-elevation;
2928
@forward './core/style/vendor-prefixes' as private-* show private-user-select;
3029
@forward './core/style/variables' as private-* show $private-swift-ease-in-duration,

src/material/autocomplete/_autocomplete-theme.scss

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
@use 'sass:map';
2-
@use '../core/theming/theming';
32
@use '../core/theming/inspection';
43
@use '../core/typography/typography';
54
@use '../core/tokens/token-utils';
@@ -57,23 +56,21 @@
5756
}
5857

5958
@mixin theme($theme) {
60-
@include theming.private-check-duplicate-theme-styles($theme, 'mat-autocomplete') {
61-
@if inspection.get-theme-version($theme) == 1 {
62-
@include base($theme);
59+
@if inspection.get-theme-version($theme) == 1 {
60+
@include base($theme);
61+
@include color($theme);
62+
@include density($theme);
63+
@include typography($theme);
64+
} @else {
65+
@include base($theme);
66+
@if inspection.theme-has($theme, color) {
6367
@include color($theme);
68+
}
69+
@if inspection.theme-has($theme, density) {
6470
@include density($theme);
71+
}
72+
@if inspection.theme-has($theme, typography) {
6573
@include typography($theme);
66-
} @else {
67-
@include base($theme);
68-
@if inspection.theme-has($theme, color) {
69-
@include color($theme);
70-
}
71-
@if inspection.theme-has($theme, density) {
72-
@include density($theme);
73-
}
74-
@if inspection.theme-has($theme, typography) {
75-
@include typography($theme);
76-
}
7774
}
7875
}
7976
}

src/material/badge/_badge-theme.scss

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
@use '../core/theming/inspection';
2-
@use '../core/theming/theming';
32
@use '../core/tokens/token-utils';
43
@use '../core/typography/typography';
54
@use './m2-badge';
@@ -87,23 +86,21 @@
8786
/// @param {Map} $theme The theme to generate styles for.
8887
/// @param {String} $color-variant The color variant to use for the component
8988
@mixin theme($theme, $color-variant: null) {
90-
@include theming.private-check-duplicate-theme-styles($theme, 'mat-badge') {
91-
@if inspection.get-theme-version($theme) == 1 {
92-
@include base($theme);
93-
@include color($theme, $color-variant);
89+
@if inspection.get-theme-version($theme) == 1 {
90+
@include base($theme);
91+
@include color($theme, $color-variant);
92+
@include density($theme);
93+
@include typography($theme);
94+
} @else {
95+
@include base($theme);
96+
@if inspection.theme-has($theme, color) {
97+
@include color($theme);
98+
}
99+
@if inspection.theme-has($theme, density) {
94100
@include density($theme);
101+
}
102+
@if inspection.theme-has($theme, typography) {
95103
@include typography($theme);
96-
} @else {
97-
@include base($theme);
98-
@if inspection.theme-has($theme, color) {
99-
@include color($theme);
100-
}
101-
@if inspection.theme-has($theme, density) {
102-
@include density($theme);
103-
}
104-
@if inspection.theme-has($theme, typography) {
105-
@include typography($theme);
106-
}
107104
}
108105
}
109106
}

src/material/bottom-sheet/_bottom-sheet-theme.scss

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
@use 'sass:map';
22
@use '../core/typography/typography';
3-
@use '../core/theming/theming';
43
@use '../core/theming/inspection';
54
@use '../core/tokens/token-utils';
65
@use './m2-bottom-sheet';
@@ -57,23 +56,21 @@
5756
}
5857

5958
@mixin theme($theme) {
60-
@include theming.private-check-duplicate-theme-styles($theme, 'mat-bottom-sheet') {
61-
@if inspection.get-theme-version($theme) == 1 {
62-
@include base($theme);
59+
@if inspection.get-theme-version($theme) == 1 {
60+
@include base($theme);
61+
@include color($theme);
62+
@include density($theme);
63+
@include typography($theme);
64+
} @else {
65+
@include base($theme);
66+
@if inspection.theme-has($theme, color) {
6367
@include color($theme);
68+
}
69+
@if inspection.theme-has($theme, density) {
6470
@include density($theme);
71+
}
72+
@if inspection.theme-has($theme, typography) {
6573
@include typography($theme);
66-
} @else {
67-
@include base($theme);
68-
@if inspection.theme-has($theme, color) {
69-
@include color($theme);
70-
}
71-
@if inspection.theme-has($theme, density) {
72-
@include density($theme);
73-
}
74-
@if inspection.theme-has($theme, typography) {
75-
@include typography($theme);
76-
}
7774
}
7875
}
7976
}

src/material/button-toggle/_button-toggle-theme.scss

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
@use '../core/theming/inspection';
2-
@use '../core/theming/theming';
32
@use '../core/tokens/token-utils';
43
@use '../core/typography/typography';
54
@use './m2-button-toggle';
@@ -74,23 +73,21 @@
7473
/// @param {String} $color-variant: The color variant to use for the button toggle: primary,
7574
/// secondary, tertiary, or error (If not specified, default secondary color will be used).
7675
@mixin theme($theme, $color-variant: null) {
77-
@include theming.private-check-duplicate-theme-styles($theme, 'mat-button-toggle') {
78-
@if inspection.get-theme-version($theme) == 1 {
79-
@include base($theme);
80-
@include color($theme, $color-variant);
76+
@if inspection.get-theme-version($theme) == 1 {
77+
@include base($theme);
78+
@include color($theme, $color-variant);
79+
@include density($theme);
80+
@include typography($theme);
81+
} @else {
82+
@include base($theme);
83+
@if inspection.theme-has($theme, color) {
84+
@include color($theme);
85+
}
86+
@if inspection.theme-has($theme, density) {
8187
@include density($theme);
88+
}
89+
@if inspection.theme-has($theme, typography) {
8290
@include typography($theme);
83-
} @else {
84-
@include base($theme);
85-
@if inspection.theme-has($theme, color) {
86-
@include color($theme);
87-
}
88-
@if inspection.theme-has($theme, density) {
89-
@include density($theme);
90-
}
91-
@if inspection.theme-has($theme, typography) {
92-
@include typography($theme);
93-
}
9491
}
9592
}
9693
}

src/material/button/_button-theme.scss

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
@use '../core/theming/inspection';
2-
@use '../core/theming/theming';
32
@use '../core/tokens/token-utils';
43
@use '../core/typography/typography';
54
@use './m2-button';
@@ -94,23 +93,21 @@
9493
/// @param {String} $color-variant: The color variant to use for the button: primary, secondary,
9594
// tertiary, or error (If not specified, default primary color will be used).
9695
@mixin theme($theme, $color-variant: null) {
97-
@include theming.private-check-duplicate-theme-styles($theme, 'mat-button') {
98-
@if inspection.get-theme-version($theme) == 1 {
99-
@include base($theme);
100-
@include color($theme, $color-variant);
96+
@if inspection.get-theme-version($theme) == 1 {
97+
@include base($theme);
98+
@include color($theme, $color-variant);
99+
@include density($theme);
100+
@include typography($theme);
101+
} @else {
102+
@include base($theme);
103+
@if inspection.theme-has($theme, color) {
104+
@include color($theme);
105+
}
106+
@if inspection.theme-has($theme, density) {
101107
@include density($theme);
108+
}
109+
@if inspection.theme-has($theme, typography) {
102110
@include typography($theme);
103-
} @else {
104-
@include base($theme);
105-
@if inspection.theme-has($theme, color) {
106-
@include color($theme);
107-
}
108-
@if inspection.theme-has($theme, density) {
109-
@include density($theme);
110-
}
111-
@if inspection.theme-has($theme, typography) {
112-
@include typography($theme);
113-
}
114111
}
115112
}
116113
}

src/material/button/_fab-theme.scss

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
@use '../core/theming/theming';
21
@use '../core/theming/inspection';
32
@use './m2-fab';
43
@use './m3-fab';
@@ -92,23 +91,21 @@
9291
/// @param {Map} $theme The theme to generate styles for.
9392
/// @param {String} $color-variant: The color variant to use for the fab
9493
@mixin theme($theme, $color-variant: null) {
95-
@include theming.private-check-duplicate-theme-styles($theme, 'mat-fab') {
96-
@if inspection.get-theme-version($theme) == 1 {
97-
@include base($theme);
98-
@include color($theme, $color-variant);
94+
@if inspection.get-theme-version($theme) == 1 {
95+
@include base($theme);
96+
@include color($theme, $color-variant);
97+
@include density($theme);
98+
@include typography($theme);
99+
} @else {
100+
@include base($theme);
101+
@if inspection.theme-has($theme, color) {
102+
@include color($theme);
103+
}
104+
@if inspection.theme-has($theme, density) {
99105
@include density($theme);
106+
}
107+
@if inspection.theme-has($theme, typography) {
100108
@include typography($theme);
101-
} @else {
102-
@include base($theme);
103-
@if inspection.theme-has($theme, color) {
104-
@include color($theme);
105-
}
106-
@if inspection.theme-has($theme, density) {
107-
@include density($theme);
108-
}
109-
@if inspection.theme-has($theme, typography) {
110-
@include typography($theme);
111-
}
112109
}
113110
}
114111
}

src/material/button/_icon-button-theme.scss

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
@use './m2-icon-button';
44
@use './m3-icon-button';
55
@use '../core/tokens/token-utils';
6-
@use '../core/theming/theming';
76
@use '../core/theming/inspection';
87

98
@mixin base($theme) {
@@ -125,7 +124,6 @@
125124
/// @param {String} $color-variant: The color variant to use for the button: primary,
126125
// secondary, tertiary, or error.
127126
@mixin theme($theme, $color-variant: null) {
128-
@include theming.private-check-duplicate-theme-styles($theme, 'mat-icon-button') {
129127
@if inspection.get-theme-version($theme) == 1 {
130128
@include base($theme);
131129
@include color($theme, $color-variant);
@@ -141,7 +139,6 @@
141139
}
142140
@if inspection.theme-has($theme, typography) {
143141
@include typography($theme);
144-
}
145142
}
146143
}
147144
}

src/material/card/_card-theme.scss

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
@use 'sass:map';
2-
@use '../core/theming/theming';
32
@use '../core/theming/inspection';
43
@use '../core/typography/typography';
54
@use '../core/tokens/token-utils';
@@ -57,23 +56,21 @@
5756
}
5857

5958
@mixin theme($theme) {
60-
@include theming.private-check-duplicate-theme-styles($theme, 'mat-card') {
61-
@if inspection.get-theme-version($theme) == 1 {
62-
@include base($theme);
59+
@if inspection.get-theme-version($theme) == 1 {
60+
@include base($theme);
61+
@include color($theme);
62+
@include density($theme);
63+
@include typography($theme);
64+
} @else {
65+
@include base($theme);
66+
@if inspection.theme-has($theme, color) {
6367
@include color($theme);
68+
}
69+
@if inspection.theme-has($theme, density) {
6470
@include density($theme);
71+
}
72+
@if inspection.theme-has($theme, typography) {
6573
@include typography($theme);
66-
} @else {
67-
@include base($theme);
68-
@if inspection.theme-has($theme, color) {
69-
@include color($theme);
70-
}
71-
@if inspection.theme-has($theme, density) {
72-
@include density($theme);
73-
}
74-
@if inspection.theme-has($theme, typography) {
75-
@include typography($theme);
76-
}
7774
}
7875
}
7976
}

0 commit comments

Comments
 (0)