Skip to content

fix(material-experimental/mdc-typography): strip typography properties #21878

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/material-experimental/mdc-helpers/_mdc-helpers.scss
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,11 @@ $mat-typography-2018-level-mappings: (
$mat-typography-2018-level-mappings, $mat-typography-2014-level-mappings);
$mdc-level: map-get(map-get($mappings, mat-to-mdc), $mat-level);

@return map-merge(
$result-with-nulls: map-merge(
if($mdc-level,
map-get($mdc-typography-styles, $mdc-level),
(
text-decoration: none,
text-transform: none,
-moz-osx-font-smoothing: grayscale,
-webkit-font-smoothing: antialiased
)),
Expand All @@ -113,9 +112,19 @@ $mat-typography-2018-level-mappings: (
letter-spacing: mat-letter-spacing($mat-config, $mat-level),
font-family: mat-font-family($mat-config, $mat-level),
// Angular Material doesn't use text-transform, so disable it.
text-transform: none,
text-transform: null,
),
()));

// We need to strip out any keys with a null value. Leaving them in will cause MDC to emit CSS
// variables with no fallback value, which breaks some builds.
$result: ();
@each $property, $value in $result-with-nulls {
@if $value != null {
$result: map-merge($result, ($property: $value));
}
}
@return $result;
}

// Converts an Angular Material typography config to an MDC one.
Expand Down