@@ -20,6 +20,11 @@ $_legacy-theme-warning: 'Angular Material themes should be created from a map co
20
20
' palette values for "primary", "accent", and "warn". ' +
21
21
' See https://material.angular.io/guide/theming for more information.' ;
22
22
23
+ // Flag whether theme config getter functions should warn if a key is expected to exist but not
24
+ // present in the config. This can be transformed internally in Google to ensure all clients have
25
+ // comprehensive theme configurations.
26
+ $_enable-strict-theme-config : false;
27
+
23
28
// These variable are not intended to be overridden externally. They use `!default` to
24
29
// avoid being reset every time this file is imported.
25
30
$_emitted-color : () !default ;
@@ -255,6 +260,9 @@ $_emitted-density: () !default;
255
260
@if map .has-key ($theme , color ) {
256
261
@return map .get ($theme , color );
257
262
}
263
+ @else if ($_enable-strict-theme-config ) {
264
+ @error ' Angular Material theme configuration is missing a "color" value' ;
265
+ }
258
266
@return $default ;
259
267
}
260
268
@@ -274,6 +282,9 @@ $_emitted-density: () !default;
274
282
@if map .has-key ($theme-or-config , density ) {
275
283
@return map .get ($theme-or-config , density );
276
284
}
285
+ @else if ($_enable-strict-theme-config ) {
286
+ @error ' Angular Material theme configuration is missing a "density" value' ;
287
+ }
277
288
@return $default ;
278
289
}
279
290
@@ -294,6 +305,9 @@ $_emitted-density: () !default;
294
305
@if (map .has-key ($theme-or-config , typography )) {
295
306
@return map .get ($theme-or-config , typography );
296
307
}
308
+ @else if ($_enable-strict-theme-config ) {
309
+ @error ' Angular Material theme configuration is missing a "typography" value' ;
310
+ }
297
311
@return $default ;
298
312
}
299
313
0 commit comments