|
1 | | -@use 'sass:map'; |
2 | | -@use 'theming/theming'; |
| 1 | +@use './theming/theming'; |
| 2 | +@use './theming/inspection'; |
3 | 3 | @use './style/private'; |
4 | 4 | @use './ripple/ripple-theme'; |
5 | 5 | @use './option/option-theme'; |
|
8 | 8 | @use './style/elevation'; |
9 | 9 | @use './typography/typography'; |
10 | 10 |
|
11 | | -@mixin color($config-or-theme) { |
12 | | - $config: theming.get-color-config($config-or-theme); |
13 | | - |
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); |
| 11 | +@mixin color($theme) { |
| 12 | + @include ripple-theme.color($theme); |
| 13 | + @include option-theme.color($theme); |
| 14 | + @include optgroup-theme.color($theme); |
| 15 | + @include pseudo-checkbox-theme.color($theme); |
18 | 16 |
|
19 | 17 | // Wrapper element that provides the theme background when the user's content isn't |
20 | 18 | // inside of a `mat-sidenav-container`. Note that we need to exclude the ampersand |
21 | 19 | // selector in case the mixin is included at the top level. |
22 | 20 | .mat-app-background#{if(&, ', &.mat-app-background', '')} { |
23 | | - $background: map.get($config, background); |
24 | | - $foreground: map.get($config, foreground); |
25 | | - |
26 | | - background-color: theming.get-color-from-palette($background, background); |
27 | | - color: theming.get-color-from-palette($foreground, text); |
| 21 | + background-color: inspection.get-theme-color($theme, background, background); |
| 22 | + color: inspection.get-theme-color($theme, foreground, text); |
28 | 23 | } |
29 | 24 |
|
30 | 25 | // Provides external CSS classes for each elevation value. Each CSS class is formatted as |
|
35 | 30 | // We need the `mat-mdc-elevation-specific`, because some MDC mixins |
36 | 31 | // come with elevation baked in and we don't have a way of removing it. |
37 | 32 | .#{$selector}, .mat-mdc-elevation-specific.#{$selector} { |
38 | | - @include private.private-theme-elevation($zValue, $config); |
| 33 | + @include private.private-theme-elevation($zValue, $theme); |
39 | 34 | } |
40 | 35 | } |
41 | 36 |
|
|
47 | 42 | } |
48 | 43 | } |
49 | 44 |
|
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); |
| 45 | +@mixin typography($theme) { |
| 46 | + @include option-theme.typography($theme); |
| 47 | + @include optgroup-theme.typography($theme); |
| 48 | + @include pseudo-checkbox-theme.typography($theme); |
57 | 49 | // TODO(mmalerba): add typography mixin for this. |
58 | 50 | // @include ripple-theme.typography($config); |
59 | 51 | } |
60 | 52 |
|
61 | | -@mixin density($config-or-theme) { |
62 | | - $density-scale: theming.get-density-config($config-or-theme); |
63 | | - |
64 | | - @include option-theme.density($density-scale); |
65 | | - @include optgroup-theme.density($density-scale); |
| 53 | +@mixin density($theme) { |
| 54 | + @include option-theme.density($theme); |
| 55 | + @include optgroup-theme.density($theme); |
66 | 56 | // TODO(mmalerba): add density mixins for these. |
67 | 57 | // @include ripple-theme.density($density-scale); |
68 | 58 | // @include pseudo-checkbox-theme.density($density-scale); |
69 | 59 | } |
70 | 60 |
|
71 | 61 | // Mixin that renders all of the core styles that depend on the theme. |
72 | | -@mixin theme($theme-or-color-config) { |
73 | | - $theme: theming.private-legacy-get-theme($theme-or-color-config); |
| 62 | +@mixin theme($theme) { |
74 | 63 | // Wrap the sub-theme includes in the duplicate theme styles mixin. This ensures that |
75 | 64 | // there won't be multiple warnings. e.g. if `mat-core-theme` reports a warning, then |
76 | 65 | // the imported themes (such as `mat-ripple-theme`) should not report again. |
77 | 66 | @include theming.private-check-duplicate-theme-styles($theme, 'mat-core') { |
78 | | - $color: theming.get-color-config($theme); |
79 | | - $density: theming.get-density-config($theme); |
80 | | - $typography: theming.get-typography-config($theme); |
81 | | - |
82 | | - @if $color != null { |
83 | | - @include color($color); |
| 67 | + @if inspection.theme-has($theme, color) { |
| 68 | + @include color($theme); |
84 | 69 | } |
85 | | - @if $density != null { |
86 | | - @include density($density); |
| 70 | + @if inspection.theme-has($theme, density) { |
| 71 | + @include density($theme); |
87 | 72 | } |
88 | | - @if $typography != null { |
89 | | - @include typography($typography); |
| 73 | + @if inspection.theme-has($theme, typography) { |
| 74 | + @include typography($theme); |
90 | 75 | } |
91 | 76 | } |
92 | 77 | } |
0 commit comments