|
69 | 69 | @return map-merge($config, (font-family: $font-family));
|
70 | 70 | }
|
71 | 71 |
|
| 72 | +// Whether a config is for the Material Design 2018 typography system. |
| 73 | +@function mat-private-typography-is-2018-config($config) { |
| 74 | + @return map-get($config, headline-1) != null; |
| 75 | +} |
| 76 | + |
| 77 | +// Given a config for either the 2014 or 2018 Material Design typography system, |
| 78 | +// produces a normalized typography config for the 2014 Material Design typography system. |
| 79 | +// 2014 - https://material.io/archive/guidelines/style/typography.html#typography-styles |
| 80 | +// 2018 - https://material.io/design/typography/the-type-system.html#type-scale |
| 81 | +@function mat-typography-normalized-config($config) { |
| 82 | + @if mat-private-typography-is-2018-config($config) { |
| 83 | + @return mat-typography-config( |
| 84 | + $display-3: map-get($config, display-1), |
| 85 | + $display-2: map-get($config, display-2), |
| 86 | + $display-1: map-get($config, display-3), |
| 87 | + $headline: map-get($config, headline-4), |
| 88 | + $title: map-get($config, subtitle-1), |
| 89 | + $subheading-2: map-get($config, subhead-1), |
| 90 | + $subheading-1: map-get($config, subhead-2), |
| 91 | + $body-2: map-get($config, body-1), |
| 92 | + $body-1: map-get($config, body-2), |
| 93 | + $caption: map-get($config, caption), |
| 94 | + $button: map-get($config, button), |
| 95 | + ); |
| 96 | + } |
| 97 | + @return $config; |
| 98 | +} |
| 99 | + |
72 | 100 | // Adds the base typography styles, based on a config.
|
73 | 101 | /* stylelint-disable-next-line material/theme-mixin-api */
|
74 | 102 | @mixin mat-base-typography($config, $selector: '.mat-typography') {
|
|
0 commit comments