Skip to content

Commit 762a537

Browse files
mmalerbaandrewseguin
authored andcommitted
fix(material-experimental/mdc-typography): strip typography properties (#21878)
* fix(material-experimental/mdc-typography): strip typography properties with null value * fixup! fix(material-experimental/mdc-typography): strip typography properties with null value (cherry picked from commit 07eb0f7)
1 parent 6097190 commit 762a537

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/material-experimental/mdc-helpers/_mdc-helpers.scss

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,11 @@ $mat-typography-2018-level-mappings: (
9696
$mat-typography-2018-level-mappings, $mat-typography-2014-level-mappings);
9797
$mdc-level: map-get(map-get($mappings, mat-to-mdc), $mat-level);
9898

99-
@return map-merge(
99+
$result-with-nulls: map-merge(
100100
if($mdc-level,
101101
map-get($mdc-typography-styles, $mdc-level),
102102
(
103103
text-decoration: none,
104-
text-transform: none,
105104
-moz-osx-font-smoothing: grayscale,
106105
-webkit-font-smoothing: antialiased
107106
)),
@@ -113,9 +112,19 @@ $mat-typography-2018-level-mappings: (
113112
letter-spacing: mat-letter-spacing($mat-config, $mat-level),
114113
font-family: mat-font-family($mat-config, $mat-level),
115114
// Angular Material doesn't use text-transform, so disable it.
116-
text-transform: none,
115+
text-transform: null,
117116
),
118117
()));
118+
119+
// We need to strip out any keys with a null value. Leaving them in will cause MDC to emit CSS
120+
// variables with no fallback value, which breaks some builds.
121+
$result: ();
122+
@each $property, $value in $result-with-nulls {
123+
@if $value != null {
124+
$result: map-merge($result, ($property: $value));
125+
}
126+
}
127+
@return $result;
119128
}
120129

121130
// Converts an Angular Material typography config to an MDC one.

0 commit comments

Comments
 (0)