Skip to content

Commit a9e6f3e

Browse files
committed
remove theme mixin explicit normalization
1 parent eae5e47 commit a9e6f3e

File tree

10 files changed

+22
-25
lines changed

10 files changed

+22
-25
lines changed

.stylelintrc.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@
148148
{
149149
"files": [
150150
"**/_card-theme.scss",
151-
"**/_checkbox-theme.scss",
152151
"**/_core-theme.scss",
153152
"**/_form-field-theme.scss",
154153
"**/_optgroup-theme.scss",

src/material/checkbox/_checkbox-theme.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
@use '../core/mdc-helpers/mdc-helpers';
99
@use '../core/tokens/m2/mdc/checkbox' as tokens-mdc-checkbox;
1010

11-
@mixin base($theme) {
11+
@mixin base($config-or-theme) {
1212
@if inspection.get-theme-version($config-or-theme) == 1 {
1313
@include _theme-from-tokens(inspection.get-theme-tokens($config-or-theme, base));
1414
}
@@ -19,7 +19,7 @@
1919
}
2020
}
2121

22-
@mixin color($theme) {
22+
@mixin color($config-or-theme) {
2323
$config: theming.get-color-config($config-or-theme);
2424

2525
@if inspection.get-theme-version($config-or-theme) == 1 {
@@ -58,7 +58,7 @@
5858
}
5959
}
6060

61-
@mixin typography($theme) {
61+
@mixin typography($config-or-theme) {
6262
$config: typography.private-typography-to-2018-config(
6363
theming.get-typography-config($config-or-theme));
6464

@@ -79,7 +79,7 @@
7979
}
8080
}
8181

82-
@mixin density($theme) {
82+
@mixin density($config-or-theme) {
8383
$density-scale: theming.get-density-config($config-or-theme);
8484

8585
@if inspection.get-theme-version($config-or-theme) == 1 {

src/material/core/_core-theme.scss

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@
5959
}
6060

6161
// Mixin that renders all of the core styles that depend on the theme.
62-
@mixin theme($theme-or-color-config) {
63-
$theme: theming.private-legacy-get-theme($theme-or-color-config);
62+
@mixin theme($theme) {
6463
// Wrap the sub-theme includes in the duplicate theme styles mixin. This ensures that
6564
// there won't be multiple warnings. e.g. if `mat-core-theme` reports a warning, then
6665
// the imported themes (such as `mat-ripple-theme`) should not report again.

src/material/core/option/_optgroup-theme.scss

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@
2323
@mixin density($theme) {
2424
}
2525

26-
@mixin theme($theme-or-color-config) {
27-
$theme: theming.private-legacy-get-theme($theme-or-color-config);
26+
@mixin theme($theme) {
2827
@include theming.private-check-duplicate-theme-styles($theme, 'mat-optgroup') {
2928
@if inspection.theme-has($theme, color) {
3029
@include color($theme);

src/material/core/option/_option-theme.scss

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,16 @@
3333
@mixin density($theme) {
3434
}
3535

36-
@mixin theme($theme-or-color-config) {
37-
$theme: theming.private-legacy-get-theme($theme-or-color-config);
36+
@mixin theme($theme) {
3837
@include theming.private-check-duplicate-theme-styles($theme, 'mat-option') {
39-
$color: theming.get-color-config($theme);
40-
$density: theming.get-density-config($theme);
41-
$typography: theming.get-typography-config($theme);
42-
4338
@if inspection.theme-has($theme, color) {
4439
@include color($theme);
4540
}
4641
@if inspection.theme-has($theme, density) {
47-
@include density($density);
42+
@include density($theme);
4843
}
4944
@if inspection.theme-has($theme, typography) {
50-
@include typography($typography);
45+
@include typography($theme);
5146
}
5247
}
5348
}

src/material/core/ripple/_ripple-theme.scss

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
}
2121
}
2222

23-
@mixin theme($theme-or-color-config) {
24-
$theme: theming.private-legacy-get-theme($theme-or-color-config);
23+
@mixin theme($theme) {
2524
@include theming.private-check-duplicate-theme-styles($theme, 'mat-ripple') {
2625
@if inspection.theme-has($theme, color) {
2726
@include color($theme);

src/material/core/selection/pseudo-checkbox/_pseudo-checkbox-theme.scss

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

7777
@mixin _density($theme) {}
7878

79-
@mixin theme($theme-or-color-config) {
80-
$theme: theming.private-legacy-get-theme($theme-or-color-config);
79+
@mixin theme($theme) {
8180
@include theming.private-check-duplicate-theme-styles($theme, 'mat-pseudo-checkbox') {
8281
@if inspection.theme-has($theme, color) {
8382
@include color($theme);

src/material/core/theming/_m2-inspection.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,21 @@ $_typography-properties: (font, font-family, line-height, font-size, letter-spac
137137
@return true;
138138
}
139139
@if $system == color {
140+
@if not theming.private-is-theme-object($theme) {
141+
@return map.has-key($theme, primary);
142+
}
140143
@return theming.get-color-config($theme) != null;
141144
}
142145
@if $system == typography {
146+
@if not theming.private-is-theme-object($theme) {
147+
@return map.has-key($theme, body-1);
148+
}
143149
@return theming.get-typography-config($theme) != null;
144150
}
145151
@if $system == density {
152+
@if not theming.private-is-theme-object($theme) {
153+
@return $theme == minimum or $theme == maximum or meta.type-of($theme) == 'number';
154+
}
146155
@return theming.get-density-config($theme) != null;
147156
}
148157
@error 'Valid systems are: base, color, typography, density. Got:' $system;

src/material/form-field/_form-field-theme.scss

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@
5555
@include form-field-density.private-form-field-density($theme);
5656
}
5757

58-
@mixin theme($theme-or-color-config) {
59-
$theme: theming.private-legacy-get-theme($theme-or-color-config);
58+
@mixin theme($theme) {
6059
@include theming.private-check-duplicate-theme-styles($theme, 'mat-form-field') {
6160
@if inspection.theme-has($theme, color) {
6261
@include color($theme);

src/material/progress-bar/_progress-bar-theme.scss

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

4949
@mixin density($theme) {}
5050

51-
@mixin theme($theme-or-color-config) {
52-
$theme: theming.private-legacy-get-theme($theme-or-color-config);
51+
@mixin theme($theme) {
5352
@include theming.private-check-duplicate-theme-styles($theme, 'mat-progress-bar') {
5453
@include base($theme);
5554
@if inspection.theme-has($theme, color) {

0 commit comments

Comments
 (0)