Skip to content

Commit 7bdebf4

Browse files
committed
undo rearranging core theme mixins, since it broke some things
1 parent 1e01de2 commit 7bdebf4

File tree

7 files changed

+48
-73
lines changed

7 files changed

+48
-73
lines changed

src/material-experimental/mdc-core/_core-theme.scss

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,40 @@
55
}
66

77
@mixin typography($config-or-theme) {
8-
@include mat.core-typography($config-or-theme);
8+
$config: mat.private-typography-to-2018-config(
9+
mat.get-typography-config($config-or-theme));
10+
11+
@include mat.option-typography($config-or-theme);
12+
@include mat.optgroup-typography($config-or-theme);
913
}
1014

1115
@mixin density($config-or-theme) {
12-
@include mat.core-density($config-or-theme);
16+
$density-scale: mat.get-density-config($config-or-theme);
17+
18+
@include mat.private-option-density($density-scale);
19+
@include mat.private-optgroup-density($density-scale);
1320
}
1421

1522
// Mixin that renders all of the core styles that depend on the theme.
1623
@mixin theme($theme-or-color-config) {
17-
@include mat.core-theme($theme-or-color-config);
24+
$theme: mat.private-legacy-get-theme($theme-or-color-config);
25+
26+
// Wrap the sub-theme includes in the duplicate theme styles mixin. This ensures that
27+
// there won't be multiple warnings. e.g. if `mat-mdc-core-theme` reports a warning, then
28+
// the imported themes (such as `mat-ripple-theme`) should not report again.
29+
@include mat.private-check-duplicate-theme-styles($theme, 'mat-mdc-core') {
30+
$color: mat.get-color-config($theme);
31+
$density: mat.get-density-config($theme);
32+
$typography: mat.get-typography-config($theme);
33+
34+
@if $color != null {
35+
@include color($color);
36+
}
37+
@if $density != null {
38+
@include density($density);
39+
}
40+
@if $typography != null {
41+
@include typography($typography);
42+
}
43+
}
1844
}

src/material/_index.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
@forward './legacy-core/typography/all-typography' show all-legacy-component-typographies;
6060

6161
// Component themes
62-
@forward './core/core-theme' as core-* show core-color, core-theme, core-typography, core-density;
62+
@forward './core/core-theme' as core-* show core-color, core-theme;
6363
@forward './legacy-core/core-theme' as legacy-core-* show legacy-core-color, legacy-core-theme;
6464
@forward './core/ripple/ripple-theme' as ripple-* show ripple-color, ripple-theme;
6565
@forward './legacy-core/option/option-theme' as legacy-option-* show legacy-option-color,

src/material/core/_core-theme.scss

Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,10 @@
66
@use './option/optgroup-theme';
77
@use './selection/pseudo-checkbox/pseudo-checkbox-theme';
88
@use './style/elevation';
9-
@use './typography/typography';
109

1110
@mixin color($config-or-theme) {
1211
$config: theming.get-color-config($config-or-theme);
1312

14-
@include ripple-theme.color($config);
15-
@include option-theme.color($config);
16-
@include optgroup-theme.color($config);
17-
@include pseudo-checkbox-theme.color($config);
18-
1913
// Wrapper element that provides the theme background when the user's content isn't
2014
// inside of a `mat-sidenav-container`. Note that we need to exclude the ampersand
2115
// selector in case the mixin is included at the top level.
@@ -47,46 +41,22 @@
4741
}
4842
}
4943

50-
@mixin typography($config-or-theme) {
51-
$config: typography.private-typography-to-2018-config(
52-
theming.get-typography-config($config-or-theme));
53-
54-
@include option-theme.typography($config);
55-
@include optgroup-theme.typography($config);
56-
@include pseudo-checkbox-theme.typography($config);
57-
// TODO(mmalerba): add typography mixin for this.
58-
// @include ripple-theme.typography($config);
59-
}
60-
61-
@mixin density($config-or-theme) {
62-
$density-scale: theming.get-color-config($config-or-theme);
63-
64-
@include option-theme.density($density-scale);
65-
@include optgroup-theme.density($density-scale);
66-
// TODO(mmalerba): add density mixins for these.
67-
// @include ripple-theme.density($density-scale);
68-
// @include pseudo-checkbox-theme.density($density-scale);
69-
}
70-
7144
// Mixin that renders all of the core styles that depend on the theme.
7245
@mixin theme($theme-or-color-config) {
7346
$theme: theming.private-legacy-get-theme($theme-or-color-config);
7447
// Wrap the sub-theme includes in the duplicate theme styles mixin. This ensures that
7548
// there won't be multiple warnings. e.g. if `mat-core-theme` reports a warning, then
7649
// the imported themes (such as `mat-ripple-theme`) should not report again.
7750
@include theming.private-check-duplicate-theme-styles($theme, 'mat-core') {
51+
@include ripple-theme.theme($theme);
52+
@include option-theme.theme($theme);
53+
@include optgroup-theme.theme($theme);
54+
@include pseudo-checkbox-theme.theme($theme);
55+
7856
$color: theming.get-color-config($theme);
79-
$density: theming.get-density-config($theme);
80-
$typography: theming.get-typography-config($theme);
8157

8258
@if $color != null {
8359
@include color($color);
8460
}
85-
@if $density != null {
86-
@include density($density);
87-
}
88-
@if $typography != null {
89-
@include typography($typography);
90-
}
9161
}
9262
}

src/material/core/density/private/_all-density.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
@use '../../../input/input-theme';
1616
@use '../../../autocomplete/autocomplete-theme';
1717
@use '../../../checkbox/checkbox-theme';
18-
@use '../../../core/core-theme';
18+
@use '../../../core/option/option-theme';
19+
@use '../../../core/option/optgroup-theme';
1920
@use '../../../select/select-theme';
2021
@use '../../../dialog/dialog-theme';
2122
@use '../../../chips/chips-theme';
@@ -57,7 +58,8 @@
5758
@include progress-bar-theme.density($config);
5859
@include tooltip-theme.density($config);
5960
@include input-theme.density($config);
60-
@include core-theme.density($config);
61+
@include option-theme.density($config);
62+
@include optgroup-theme.density($config);
6163
@include select-theme.density($config);
6264
@include checkbox-theme.density($config);
6365
@include autocomplete-theme.density($config);

src/material/core/theming/_all-theme.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// Import all the theming functionality.
22
@use '../core-theme';
3+
@use '../option/optgroup-theme';
4+
@use '../option/option-theme';
35
@use '../../autocomplete/autocomplete-theme';
46
@use '../../badge/badge-theme';
57
@use '../../bottom-sheet/bottom-sheet-theme';
@@ -76,6 +78,8 @@
7678
@include list-theme.theme($theme-or-color-config);
7779
@include paginator-theme.theme($theme-or-color-config);
7880
@include tabs-theme.theme($theme-or-color-config);
81+
@include optgroup-theme.theme($theme-or-color-config);
82+
@include option-theme.theme($theme-or-color-config);
7983
@include checkbox-theme.theme($theme-or-color-config);
8084
@include button-theme.theme($theme-or-color-config);
8185
@include icon-button-theme.theme($theme-or-color-config);

src/material/core/typography/_all-typography.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@
3333
@use '../../toolbar/toolbar-theme';
3434
@use '../../tooltip/tooltip-theme';
3535
@use '../../snack-bar/snack-bar-theme';
36+
@use '../option/option-theme';
37+
@use '../option/optgroup-theme';
3638
@use '../../form-field/form-field-theme';
3739
@use '../../tree/tree-theme';
3840
@use '../theming/theming';
39-
@use '../core-theme';
4041

4142
@mixin private-all-unmigrated-component-typographies($config) {
4243
@include badge-theme.typography($config);
@@ -73,9 +74,10 @@
7374
// mixin that is transitively loaded by the `all-theme` file, imports `all-typography` which
7475
// would then load `all-theme` again. This ultimately results a circular dependency.
7576
@include private-all-unmigrated-component-typographies($config);
76-
@include core-theme.typography($config);
7777
@include card-theme.typography($config);
7878
@include progress-bar-theme.typography($config);
79+
@include option-theme.typography($config);
80+
@include optgroup-theme.typography($config);
7981
@include tooltip-theme.typography($config);
8082
@include form-field-theme.typography($config);
8183
@include input-theme.typography($config);

src/material/legacy-core/_core-theme.scss

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,13 @@
1-
@use 'sass:map';
21
@use '../core/theming/theming';
32
@use '../core/core-theme';
43
@use '../core/ripple/ripple-theme';
54
@use '../core/selection/pseudo-checkbox/pseudo-checkbox-theme';
65
@use './option/option-theme';
76
@use './option/optgroup-theme';
8-
@use '../core/style/elevation';
9-
@use '../core/style/private';
107

118
@mixin color($config-or-theme) {
129
$config: theming.get-color-config($config-or-theme);
13-
14-
// Wrapper element that provides the theme background when the user's content isn't
15-
// inside of a `mat-sidenav-container`. Note that we need to exclude the ampersand
16-
// selector in case the mixin is included at the top level.
17-
.mat-app-background#{if(&, ', &.mat-app-background', '')} {
18-
$background: map.get($config, background);
19-
$foreground: map.get($config, foreground);
20-
21-
background-color: theming.get-color-from-palette($background, background);
22-
color: theming.get-color-from-palette($foreground, text);
23-
}
24-
25-
// Provides external CSS classes for each elevation value. Each CSS class is formatted as
26-
// `mat-elevation-z$zValue` where `$zValue` corresponds to the z-space to which the element is
27-
// elevated.
28-
@for $zValue from 0 through 24 {
29-
.#{elevation.$prefix}#{$zValue} {
30-
@include private.private-theme-elevation($zValue, $config);
31-
}
32-
}
33-
34-
// Marker that is used to determine whether the user has added a theme to their page.
35-
@at-root {
36-
.mat-theme-loaded-marker {
37-
display: none;
38-
}
39-
}
10+
@include core-theme.color($config-or-theme);
4011
}
4112

4213
// Mixin that renders all of the core styles that depend on the theme.

0 commit comments

Comments
 (0)