|
1 | 1 | @use 'sass:map';
|
| 2 | +@use 'sass:string'; |
| 3 | +@use 'sass:meta'; |
2 | 4 |
|
3 | 5 | @function md-sys-typescale-values($config) {
|
4 | 6 | $sys-to-config: (
|
|
19 | 21 | title-small: headline-6,
|
20 | 22 | );
|
21 | 23 |
|
| 24 | + // If the config is based on an old 2014 version of the typography spec, then |
| 25 | + // use the old config keys to map to the new system tokens. |
| 26 | + @if (map.get($config, headline) != null) { |
| 27 | + $sys-to-config: ( |
| 28 | + body-large: subheading-1, |
| 29 | + body-medium: body-1, |
| 30 | + body-small: caption, |
| 31 | + display-large: display-4, |
| 32 | + display-medium: display-4, |
| 33 | + display-small: display-4, |
| 34 | + headline-large: display-3, |
| 35 | + headline-medium: display-2, |
| 36 | + headline-small: display-1, |
| 37 | + label-large: subheading-2, |
| 38 | + label-medium: body-2, |
| 39 | + label-small: button, |
| 40 | + title-large: headline, |
| 41 | + title-medium: headline, |
| 42 | + title-small: title, |
| 43 | + ); |
| 44 | + } |
| 45 | + |
22 | 46 | $typography: ();
|
23 | 47 | @each $sys-key, $config-key in $sys-to-config {
|
24 | 48 | $font: map.get($config, $config-key, font-family);
|
| 49 | + @if (meta.type-of($font) == 'string') { |
| 50 | + $font: string.unquote($font); |
| 51 | + } |
25 | 52 | $line-height: map.get($config, $config-key, line-height);
|
26 | 53 | $size: map.get($config, $config-key, font-size);
|
27 | 54 | $tracking: map.get($config, $config-key, letter-spacing);
|
|
0 commit comments