|
1 | 1 | @use '../../material/core/theming/theming'; |
| 2 | +@use '../../material/core/typography/typography'; |
2 | 3 | @use './option/option-theme'; |
3 | 4 | @use './option/optgroup-theme'; |
4 | 5 | @use './elevation'; |
5 | 6 |
|
| 7 | + |
| 8 | +@mixin color($config-or-theme) { |
| 9 | + $config: theming.get-color-config($config-or-theme); |
| 10 | + |
| 11 | + @include option-theme.color($config); |
| 12 | + @include optgroup-theme.color($config); |
| 13 | + |
| 14 | + @if $config != null { |
| 15 | + // Provides external CSS classes for each elevation value. Each CSS class is formatted as |
| 16 | + // `mat-mdc-elevation-z$zValue` where `$zValue` corresponds to the z-space to which the |
| 17 | + // element is elevated. |
| 18 | + @for $zValue from 0 through 24 { |
| 19 | + $selector: elevation.$prefix + $zValue; |
| 20 | + // We need the `mat-mdc-elevation-specific`, because some MDC mixins |
| 21 | + // come with elevation baked in and we don't have a way of removing it. |
| 22 | + .#{$selector}, .mat-mdc-elevation-specific.#{$selector} { |
| 23 | + @include elevation.private-theme-elevation($zValue, $config); |
| 24 | + } |
| 25 | + } |
| 26 | + } |
| 27 | +} |
| 28 | + |
| 29 | +@mixin typography($config-or-theme) { |
| 30 | + $config: typography.private-typography-to-2018-config( |
| 31 | + theming.get-typography-config($config-or-theme)); |
| 32 | + |
| 33 | + @include option-theme.typography($config-or-theme); |
| 34 | + @include optgroup-theme.typography($config-or-theme); |
| 35 | +} |
| 36 | + |
| 37 | +@mixin density($config-or-theme) { |
| 38 | + $density-scale: theming.get-density-config($config-or-theme); |
| 39 | + |
| 40 | + @include option-theme.density($density-scale); |
| 41 | + @include optgroup-theme.density($density-scale); |
| 42 | +} |
| 43 | + |
6 | 44 | // Mixin that renders all of the core styles that depend on the theme. |
7 | 45 | @mixin theme($theme-or-color-config) { |
8 | 46 | $theme: theming.private-legacy-get-theme($theme-or-color-config); |
|
12 | 50 | // the imported themes (such as `mat-ripple-theme`) should not report again. |
13 | 51 | @include theming.private-check-duplicate-theme-styles($theme, 'mat-mdc-core') { |
14 | 52 | $color: theming.get-color-config($theme); |
15 | | - |
16 | | - @include option-theme.theme($theme); |
17 | | - @include optgroup-theme.theme($theme); |
| 53 | + $density: theming.get-density-config($theme); |
| 54 | + $typography: theming.get-typography-config($theme); |
18 | 55 |
|
19 | 56 | @if $color != null { |
20 | | - // Provides external CSS classes for each elevation value. Each CSS class is formatted as |
21 | | - // `mat-mdc-elevation-z$zValue` where `$zValue` corresponds to the z-space to which the |
22 | | - // element is elevated. |
23 | | - @for $zValue from 0 through 24 { |
24 | | - $selector: elevation.$prefix + $zValue; |
25 | | - // We need the `mat-mdc-elevation-specific`, because some MDC mixins |
26 | | - // come with elevation baked in and we don't have a way of removing it. |
27 | | - .#{$selector}, .mat-mdc-elevation-specific.#{$selector} { |
28 | | - @include elevation.private-theme-elevation($zValue, $color); |
29 | | - } |
30 | | - } |
| 57 | + @include color($color); |
| 58 | + } |
| 59 | + @if $density != null { |
| 60 | + @include density($density); |
| 61 | + } |
| 62 | + @if $typography != null { |
| 63 | + @include typography($typography); |
31 | 64 | } |
32 | 65 | } |
33 | 66 | } |
0 commit comments