@angular/material 17.0.0-next.0 → 17.0.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. package/_index.scss +3 -4
  2. package/autocomplete/_autocomplete-theme.scss +12 -18
  3. package/autocomplete/index.d.ts +15 -24
  4. package/badge/_badge-theme.scss +15 -27
  5. package/badge/index.d.ts +9 -17
  6. package/bottom-sheet/_bottom-sheet-theme.scss +13 -22
  7. package/button/_button-base.scss +3 -3
  8. package/button/_button-theme-private.scss +3 -2
  9. package/button/_button-theme.scss +18 -25
  10. package/button/_fab-theme.scss +31 -49
  11. package/button/_icon-button-theme.scss +19 -26
  12. package/button/index.d.ts +22 -31
  13. package/button-toggle/_button-toggle-theme.scss +17 -28
  14. package/button-toggle/index.d.ts +15 -18
  15. package/card/_card-theme.scss +27 -38
  16. package/checkbox/_checkbox-theme.scss +28 -45
  17. package/checkbox/index.d.ts +21 -27
  18. package/chips/_chips-theme.scss +18 -56
  19. package/core/_core-theme.scss +24 -39
  20. package/core/color/_all-color.scss +7 -15
  21. package/core/density/private/_all-density.scss +34 -39
  22. package/core/focus-indicators/_focus-indicators-theme.scss +6 -8
  23. package/core/focus-indicators/_private.scss +22 -26
  24. package/core/index.d.ts +7 -11
  25. package/core/mdc-helpers/_mdc-helpers.scss +19 -22
  26. package/core/option/_optgroup-theme.scss +13 -23
  27. package/core/option/_option-theme.scss +23 -37
  28. package/core/ripple/_ripple-theme.scss +6 -10
  29. package/core/selection/pseudo-checkbox/_pseudo-checkbox-theme.scss +17 -24
  30. package/core/style/_form-common.scss +7 -7
  31. package/core/style/_private.scss +5 -7
  32. package/core/style/_sass-utils.scss +7 -0
  33. package/core/testing/index.d.ts +2 -1
  34. package/core/theming/_all-theme.scss +41 -41
  35. package/core/theming/_inspection.scss +133 -59
  36. package/core/theming/_m2-inspection.scss +268 -0
  37. package/core/theming/_theming.scss +59 -20
  38. package/core/tokens/m2/mat/_autocomplete.scss +5 -8
  39. package/core/tokens/m2/mat/_badge.scss +12 -15
  40. package/core/tokens/m2/mat/_bottom-sheet.scss +11 -17
  41. package/core/tokens/m2/mat/_card.scss +15 -21
  42. package/core/tokens/m2/mat/_datepicker.scss +28 -38
  43. package/core/tokens/m2/mat/_divider.scss +5 -8
  44. package/core/tokens/m2/mat/_expansion.scss +24 -28
  45. package/core/tokens/m2/mat/_form-field.scss +21 -25
  46. package/core/tokens/m2/mat/_grid-list.scss +8 -8
  47. package/core/tokens/m2/mat/_icon.scss +3 -3
  48. package/core/tokens/m2/mat/_legacy-button-toggle.scss +15 -19
  49. package/core/tokens/m2/mat/_menu.scss +12 -17
  50. package/core/tokens/m2/mat/_optgroup.scss +12 -17
  51. package/core/tokens/m2/mat/_option.scss +16 -28
  52. package/core/tokens/m2/mat/_paginator.scss +16 -18
  53. package/core/tokens/m2/mat/_radio.scss +7 -10
  54. package/core/tokens/m2/mat/_select.scss +15 -29
  55. package/core/tokens/m2/mat/_sidenav.scss +12 -14
  56. package/core/tokens/m2/mat/_slide-toggle.scss +9 -17
  57. package/core/tokens/m2/mat/_slider.scss +5 -5
  58. package/core/tokens/m2/mat/_snack-bar.scss +7 -8
  59. package/core/tokens/m2/mat/_standard-button-toggle.scss +23 -22
  60. package/core/tokens/m2/mat/_stepper.scss +30 -33
  61. package/core/tokens/m2/mat/_tab-header-with-background.scss +6 -8
  62. package/core/tokens/m2/mat/_tab-header.scss +13 -18
  63. package/core/tokens/m2/mat/_table.scss +19 -23
  64. package/core/tokens/m2/mat/_toolbar.scss +12 -16
  65. package/core/tokens/m2/mdc/_checkbox.scss +21 -20
  66. package/core/tokens/m2/mdc/_chip.scss +38 -24
  67. package/core/tokens/m2/mdc/_circular-progress.scss +5 -6
  68. package/core/tokens/m2/mdc/_dialog.scss +16 -30
  69. package/core/tokens/m2/mdc/_elevated-card.scss +6 -9
  70. package/core/tokens/m2/mdc/_extended-fab.scss +8 -17
  71. package/core/tokens/m2/mdc/_fab.scss +6 -7
  72. package/core/tokens/m2/mdc/_filled-text-field.scss +16 -22
  73. package/core/tokens/m2/mdc/_icon-button.scss +3 -3
  74. package/core/tokens/m2/mdc/_linear-progress.scss +9 -10
  75. package/core/tokens/m2/mdc/_list.scss +44 -42
  76. package/core/tokens/m2/mdc/_outlined-card.scss +7 -10
  77. package/core/tokens/m2/mdc/_outlined-text-field.scss +14 -20
  78. package/core/tokens/m2/mdc/_plain-tooltip.scss +9 -22
  79. package/core/tokens/m2/mdc/_radio.scss +11 -11
  80. package/core/tokens/m2/mdc/_slider.scss +16 -23
  81. package/core/tokens/m2/mdc/_snack-bar.scss +10 -23
  82. package/core/tokens/m2/mdc/_switch.scss +16 -19
  83. package/core/tokens/m2/mdc/_tab-indicator.scss +5 -8
  84. package/core/tokens/m2/mdc/_tab.scss +5 -4
  85. package/core/typography/_all-typography.scss +44 -47
  86. package/core/typography/_definition.scss +258 -0
  87. package/core/typography/_property-getters.scss +63 -0
  88. package/core/typography/_typography-utils.scss +9 -69
  89. package/core/typography/_typography.scss +38 -494
  90. package/core/typography/_versioning.scss +91 -0
  91. package/datepicker/_datepicker-theme.scss +20 -34
  92. package/datepicker/index.d.ts +3 -3
  93. package/dialog/_dialog-theme.scss +22 -23
  94. package/dialog/_mdc-dialog-structure-overrides.scss +12 -10
  95. package/dialog/index.d.ts +2 -0
  96. package/divider/_divider-theme.scss +12 -18
  97. package/esm2022/autocomplete/autocomplete-trigger.mjs +5 -17
  98. package/esm2022/autocomplete/autocomplete.mjs +23 -50
  99. package/esm2022/badge/badge.mjs +11 -29
  100. package/esm2022/button/button-base.mjs +32 -27
  101. package/esm2022/button/button.mjs +6 -6
  102. package/esm2022/button/fab.mjs +23 -31
  103. package/esm2022/button/icon-button.mjs +6 -6
  104. package/esm2022/button/testing/button-harness.mjs +3 -3
  105. package/esm2022/button-toggle/button-toggle.mjs +25 -33
  106. package/esm2022/checkbox/checkbox.mjs +32 -39
  107. package/esm2022/core/option/optgroup.mjs +10 -11
  108. package/esm2022/core/option/option.mjs +6 -6
  109. package/esm2022/core/testing/option-harness.mjs +3 -3
  110. package/esm2022/core/version.mjs +1 -1
  111. package/esm2022/datepicker/calendar.mjs +1 -1
  112. package/esm2022/datepicker/datepicker-base.mjs +2 -2
  113. package/esm2022/datepicker/datepicker-toggle.mjs +1 -1
  114. package/esm2022/datepicker/month-view.mjs +2 -2
  115. package/esm2022/datepicker/multi-year-view.mjs +2 -2
  116. package/esm2022/datepicker/year-view.mjs +2 -2
  117. package/esm2022/dialog/dialog-container.mjs +16 -3
  118. package/esm2022/form-field/form-field.mjs +3 -3
  119. package/esm2022/menu/menu-item.mjs +15 -11
  120. package/esm2022/menu/menu.mjs +9 -22
  121. package/esm2022/paginator/paginator.mjs +1 -1
  122. package/esm2022/select/select.mjs +3 -3
  123. package/esm2022/slide-toggle/slide-toggle.mjs +33 -37
  124. package/esm2022/slider/slider-input.mjs +19 -9
  125. package/esm2022/slider/slider.mjs +2 -2
  126. package/esm2022/snack-bar/simple-snack-bar.mjs +1 -1
  127. package/esm2022/tabs/tab-group.mjs +3 -3
  128. package/expansion/_expansion-theme.scss +16 -24
  129. package/fesm2022/autocomplete.mjs +25 -63
  130. package/fesm2022/autocomplete.mjs.map +1 -1
  131. package/fesm2022/badge.mjs +11 -28
  132. package/fesm2022/badge.mjs.map +1 -1
  133. package/fesm2022/button/testing.mjs +2 -2
  134. package/fesm2022/button/testing.mjs.map +1 -1
  135. package/fesm2022/button-toggle.mjs +25 -32
  136. package/fesm2022/button-toggle.mjs.map +1 -1
  137. package/fesm2022/button.mjs +59 -61
  138. package/fesm2022/button.mjs.map +1 -1
  139. package/fesm2022/checkbox.mjs +31 -38
  140. package/fesm2022/checkbox.mjs.map +1 -1
  141. package/fesm2022/core/testing.mjs +2 -2
  142. package/fesm2022/core/testing.mjs.map +1 -1
  143. package/fesm2022/core.mjs +14 -13
  144. package/fesm2022/core.mjs.map +1 -1
  145. package/fesm2022/datepicker.mjs +6 -6
  146. package/fesm2022/datepicker.mjs.map +1 -1
  147. package/fesm2022/dialog.mjs +15 -2
  148. package/fesm2022/dialog.mjs.map +1 -1
  149. package/fesm2022/form-field.mjs +2 -2
  150. package/fesm2022/form-field.mjs.map +1 -1
  151. package/fesm2022/menu.mjs +23 -31
  152. package/fesm2022/menu.mjs.map +1 -1
  153. package/fesm2022/paginator.mjs +1 -1
  154. package/fesm2022/paginator.mjs.map +1 -1
  155. package/fesm2022/select.mjs +2 -2
  156. package/fesm2022/select.mjs.map +1 -1
  157. package/fesm2022/slide-toggle.mjs +33 -36
  158. package/fesm2022/slide-toggle.mjs.map +1 -1
  159. package/fesm2022/slider.mjs +20 -10
  160. package/fesm2022/slider.mjs.map +1 -1
  161. package/fesm2022/snack-bar.mjs +1 -1
  162. package/fesm2022/snack-bar.mjs.map +1 -1
  163. package/fesm2022/tabs.mjs +2 -2
  164. package/fesm2022/tabs.mjs.map +1 -1
  165. package/form-field/_form-field-density.scss +3 -4
  166. package/form-field/_form-field-focus-overlay.scss +1 -1
  167. package/form-field/_form-field-sizing.scss +1 -1
  168. package/form-field/_form-field-theme.scss +24 -34
  169. package/grid-list/_grid-list-theme.scss +12 -19
  170. package/icon/_icon-theme.scss +17 -25
  171. package/input/_input-theme.scss +11 -23
  172. package/list/_list-theme.scss +27 -42
  173. package/menu/_menu-theme.scss +13 -22
  174. package/menu/index.d.ts +12 -18
  175. package/package.json +2 -2
  176. package/paginator/_paginator-theme.scss +15 -24
  177. package/prebuilt-themes/deeppurple-amber.css +1 -1
  178. package/prebuilt-themes/indigo-pink.css +1 -1
  179. package/prebuilt-themes/pink-bluegrey.css +1 -1
  180. package/prebuilt-themes/purple-green.css +1 -1
  181. package/progress-bar/_progress-bar-theme.scss +17 -24
  182. package/progress-spinner/_progress-spinner-theme.scss +18 -24
  183. package/radio/_radio-theme.scss +23 -38
  184. package/schematics/ng-add/index.js +1 -1
  185. package/schematics/ng-add/index.mjs +1 -1
  186. package/schematics/ng-generate/mdc-migration/index_bundled.js +44 -44
  187. package/schematics/ng-generate/mdc-migration/index_bundled.js.map +1 -1
  188. package/schematics/ng-update/index_bundled.js +25 -25
  189. package/select/_select-theme.scss +17 -31
  190. package/sidenav/_sidenav-theme.scss +12 -18
  191. package/slide-toggle/_slide-toggle-theme.scss +23 -40
  192. package/slide-toggle/index.d.ts +20 -23
  193. package/slider/_slider-theme.scss +25 -42
  194. package/snack-bar/_snack-bar-theme.scss +17 -26
  195. package/sort/_sort-theme.scss +13 -22
  196. package/stepper/_stepper-theme.scss +16 -34
  197. package/table/_table-theme.scss +14 -25
  198. package/tabs/_tabs-theme.scss +31 -45
  199. package/toolbar/_toolbar-theme.scss +22 -31
  200. package/tooltip/_tooltip-theme.scss +15 -23
  201. package/tree/_tree-theme.scss +20 -29
  202. package/button-toggle/_button-toggle-variables.scss +0 -16
  203. package/core/typography/_typography-deprecated.scss +0 -39
  204. package/paginator/_paginator-variables.scss +0 -15
@@ -5,6 +5,9 @@
5
5
  @use 'palette';
6
6
  @use '../density/private/compatibility';
7
7
 
8
+ // Whether to enable compatibility with legacy methods for accessing theme information.
9
+ $theme-legacy-inspection-api-compatibility: true !default;
10
+
8
11
  // Whether duplication warnings should be disabled. Warnings enabled by default.
9
12
  $theme-ignore-duplication-warnings: false !default;
10
13
 
@@ -21,11 +24,6 @@ $_legacy-theme-warning: 'Angular Material themes should be created from a map co
21
24
  'palette values for "primary", "accent", and "warn". ' +
22
25
  'See https://material.angular.io/guide/theming for more information.';
23
26
 
24
- // Flag whether theme config getter functions should warn if a key is expected to exist but not
25
- // present in the config. This can be transformed internally in Google to ensure all clients have
26
- // comprehensive theme configurations.
27
- $_enable-strict-theme-config: false;
28
-
29
27
  // Flag whether to disable theme definitions copying color values to the top-level theme config.
30
28
  // This copy is to preserve backwards compatibility.
31
29
  $_disable-color-backwards-compatibility: false;
@@ -184,10 +182,10 @@ $_emitted-base: () !default;
184
182
  // configuration for the `color` theming part.
185
183
  @if $accent != null {
186
184
  @warn $_legacy-theme-warning;
187
- @return private-create-backwards-compatibility-theme(_mat-validate-theme((
185
+ @return _internalize-theme(private-create-backwards-compatibility-theme(_mat-validate-theme((
188
186
  _is-legacy-theme: true,
189
187
  color: _mat-create-light-color-config($primary, $accent, $warn),
190
- )));
188
+ ))));
191
189
  }
192
190
  // If the map pattern is used (1), we just pass-through the configurations for individual
193
191
  // parts of the theming system, but update the `color` configuration if set. As explained
@@ -200,7 +198,8 @@ $_emitted-base: () !default;
200
198
  $warn: map.get($color-settings, warn);
201
199
  $result: map.merge($result, (color: _mat-create-light-color-config($primary, $accent, $warn)));
202
200
  }
203
- @return private-create-backwards-compatibility-theme(_mat-validate-theme($result));
201
+ @return _internalize-theme(
202
+ private-create-backwards-compatibility-theme(_mat-validate-theme($result)));
204
203
  }
205
204
 
206
205
  // TODO: Remove legacy API and rename below `$primary` to `$config`. Currently it cannot be renamed
@@ -225,10 +224,10 @@ $_emitted-base: () !default;
225
224
  // configuration for the `color` theming part.
226
225
  @if $accent != null {
227
226
  @warn $_legacy-theme-warning;
228
- @return private-create-backwards-compatibility-theme(_mat-validate-theme((
227
+ @return _internalize-theme(private-create-backwards-compatibility-theme(_mat-validate-theme((
229
228
  _is-legacy-theme: true,
230
229
  color: _mat-create-dark-color-config($primary, $accent, $warn),
231
- )));
230
+ ))));
232
231
  }
233
232
  // If the map pattern is used (1), we just pass-through the configurations for individual
234
233
  // parts of the theming system, but update the `color` configuration if set. As explained
@@ -241,7 +240,8 @@ $_emitted-base: () !default;
241
240
  $warn: map.get($color-settings, warn);
242
241
  $result: map.merge($result, (color: _mat-create-dark-color-config($primary, $accent, $warn)));
243
242
  }
244
- @return private-create-backwards-compatibility-theme(_mat-validate-theme($result));
243
+ @return _internalize-theme(
244
+ private-create-backwards-compatibility-theme(_mat-validate-theme($result)));
245
245
  }
246
246
 
247
247
  /// Gets the color configuration from the given theme or configuration.
@@ -265,9 +265,6 @@ $_emitted-base: () !default;
265
265
  @if map.has-key($theme, color) {
266
266
  @return map.get($theme, color);
267
267
  }
268
- @else if ($_enable-strict-theme-config) {
269
- @error 'Angular Material theme configuration is missing a "color" value';
270
- }
271
268
  @return $default;
272
269
  }
273
270
 
@@ -287,9 +284,6 @@ $_emitted-base: () !default;
287
284
  @if map.has-key($theme-or-config, density) {
288
285
  @return map.get($theme-or-config, density);
289
286
  }
290
- @else if ($_enable-strict-theme-config) {
291
- @error 'Angular Material theme configuration is missing a "density" value';
292
- }
293
287
  @return $default;
294
288
  }
295
289
 
@@ -310,9 +304,6 @@ $_emitted-base: () !default;
310
304
  @if (map.has-key($theme-or-config, typography)) {
311
305
  @return map.get($theme-or-config, typography);
312
306
  }
313
- @else if ($_enable-strict-theme-config) {
314
- @error 'Angular Material theme configuration is missing a "typography" value';
315
- }
316
307
  @return $default;
317
308
  }
318
309
 
@@ -595,3 +586,51 @@ $_internals: _mat-theming-internals-do-not-access;
595
586
  }
596
587
  @return $density-scale;
597
588
  }
589
+
590
+ /// Copies the given theme object and nests it within itself under a secret key and replaces the
591
+ /// original map keys with error values. This allows the inspection API which is aware of the secret
592
+ /// key to access the real values, but attempts to directly access the map will result in errors.
593
+ /// @param {Map} $theme The theme map.
594
+ @function _internalize-theme($theme) {
595
+ @if map.has-key($theme, $_internals) {
596
+ @return $theme;
597
+ }
598
+ $internalized-theme: (
599
+ $_internals: (
600
+ theme-version: 0,
601
+ m2-config: $theme
602
+ )
603
+ );
604
+ @if ($theme-legacy-inspection-api-compatibility) {
605
+ @return map.merge($theme, $internalized-theme);
606
+ }
607
+ $error-theme:
608
+ _replace-values-with-errors($theme, 'Theme may only be accessed via theme inspection API');
609
+ @return map.merge($error-theme, $internalized-theme);
610
+ }
611
+
612
+ /// Replaces concrete CSS values with errors in a theme object.
613
+ /// Errors are represented as a map `(ERROR: <message>)`. Because maps are not valid CSS values,
614
+ /// the Sass will not compile if the user tries to use any of the error theme values in their CSS.
615
+ /// Users will see a message about `(ERROR: <message>)` not being a valid CSS value. Using the
616
+ /// message, that winds up getting shown, we can help explain to users why they're getting the
617
+ /// error.
618
+ /// @param {*} $value The theme value to replace with errors.
619
+ /// @param {String} $message The error message to sow users.
620
+ /// @return {Map} A version of $value where concrete CSS values have been replaced with errors
621
+ @function _replace-values-with-errors($value, $message) {
622
+ $value-type: meta.type-of($value);
623
+ @if $value-type == 'map' {
624
+ @each $k, $v in $value {
625
+ $value: map.set($value, $k, _replace-values-with-errors($v, $message));
626
+ }
627
+ @return $value;
628
+ }
629
+ @else if $value-type == 'list' and list.length($value) > 0 {
630
+ @for $i from 1 through list.length() {
631
+ $value: list.set-nth($value, $i, _replace-values-with-errors(list.nth($value, $i), $message));
632
+ }
633
+ @return $value;
634
+ }
635
+ @return (ERROR: $message);
636
+ }
@@ -1,6 +1,5 @@
1
- @use 'sass:map';
2
1
  @use '../../token-utils';
3
- @use '../../../theming/theming';
2
+ @use '../../../theming/inspection';
4
3
  @use '../../../style/sass-utils';
5
4
 
6
5
  // The prefix used to generate the fully qualified name for tokens in this file.
@@ -13,21 +12,19 @@ $prefix: (mat, autocomplete);
13
12
  }
14
13
 
15
14
  // Tokens that can be configured through Angular Material's color theming API.
16
- @function get-color-tokens($config) {
17
- $background: map.get($config, background);
18
-
15
+ @function get-color-tokens($theme) {
19
16
  @return (
20
- background-color: theming.get-color-from-palette($background, card)
17
+ background-color: inspection.get-theme-color($theme, background, card)
21
18
  );
22
19
  }
23
20
 
24
21
  // Tokens that can be configured through Angular Material's typography theming API.
25
- @function get-typography-tokens($config) {
22
+ @function get-typography-tokens($theme) {
26
23
  @return ();
27
24
  }
28
25
 
29
26
  // Tokens that can be configured through Angular Material's density theming API.
30
- @function get-density-tokens($config) {
27
+ @function get-density-tokens($theme) {
31
28
  @return ();
32
29
  }
33
30
 
@@ -2,8 +2,7 @@
2
2
  @use 'sass:map';
3
3
  @use 'sass:color';
4
4
  @use '../../token-utils';
5
- @use '../../../typography/typography-utils';
6
- @use '../../../theming/theming';
5
+ @use '../../../theming/inspection';
7
6
  @use '../../../style/sass-utils';
8
7
 
9
8
  // The prefix used to generate the fully qualified name for tokens in this file.
@@ -16,12 +15,10 @@ $prefix: (mat, badge);
16
15
  }
17
16
 
18
17
  // Tokens that can be configured through Angular Material's color theming API.
19
- @function get-color-tokens($config) {
20
- $foreground: map.get($config, foreground);
21
- $background: map.get($config, background);
22
- $primary-color-tokens: private-get-color-palette-color-tokens(map.get($config, primary));
23
- $app-background: theming.get-color-from-palette($background, 'background');
24
- $disabled-background: theming.get-color-from-palette($foreground, disabled-button);
18
+ @function get-color-tokens($theme) {
19
+ $primary-color-tokens: private-get-color-palette-color-tokens($theme, primary);
20
+ $app-background: inspection.get-theme-color($theme, background, background);
21
+ $disabled-background: inspection.get-theme-color($theme, foreground, disabled-button);
25
22
 
26
23
  // The disabled color usually has some kind of opacity, but because the badge is overlayed
27
24
  // on top of something else, it won't look good if it's opaque. If it is a color *type*,
@@ -36,24 +33,24 @@ $prefix: (mat, badge);
36
33
 
37
34
  @return map.merge($primary-color-tokens, (
38
35
  disabled-state-background-color: $disabled-background,
39
- disabled-state-text-color: theming.get-color-from-palette($foreground, disabled-text),
36
+ disabled-state-text-color: inspection.get-theme-color($theme, foreground, disabled-text),
40
37
  ));
41
38
  }
42
39
 
43
40
  // Generates the tokens used to theme the badge based on a palette.
44
- @function private-get-color-palette-color-tokens($palette) {
41
+ @function private-get-color-palette-color-tokens($theme, $palette-name: primary) {
45
42
  @return (
46
- background-color: theming.get-color-from-palette($palette),
47
- text-color: theming.get-color-from-palette($palette, default-contrast),
43
+ background-color: inspection.get-theme-color($theme, $palette-name),
44
+ text-color: inspection.get-theme-color($theme, $palette-name, default-contrast),
48
45
  );
49
46
  }
50
47
 
51
48
  // Tokens that can be configured through Angular Material's typography theming API.
52
- @function get-typography-tokens($config) {
49
+ @function get-typography-tokens($theme) {
53
50
  $base-size: 12px;
54
51
 
55
52
  @return (
56
- text-font: typography-utils.font-family($config),
53
+ text-font: inspection.get-theme-typography($theme, body-2, font-family),
57
54
  text-size: $base-size,
58
55
  text-weight: 600,
59
56
  small-size-text-size: $base-size * 0.75,
@@ -62,7 +59,7 @@ $prefix: (mat, badge);
62
59
  }
63
60
 
64
61
  // Tokens that can be configured through Angular Material's density theming API.
65
- @function get-density-tokens($config) {
62
+ @function get-density-tokens($theme) {
66
63
  @return ();
67
64
  }
68
65
 
@@ -1,7 +1,5 @@
1
- @use 'sass:map';
2
1
  @use '../../token-utils';
3
- @use '../../../typography/typography-utils';
4
- @use '../../../theming/theming';
2
+ @use '../../../theming/inspection';
5
3
  @use '../../../style/sass-utils';
6
4
 
7
5
  // The prefix used to generate the fully qualified name for tokens in this file.
@@ -17,30 +15,26 @@ $prefix: (mat, bottom-sheet);
17
15
  }
18
16
 
19
17
  // Tokens that can be configured through Angular Material's color theming API.
20
- @function get-color-tokens($config) {
21
- $foreground: map.get($config, foreground);
22
- $background: map.get($config, background);
23
-
18
+ @function get-color-tokens($theme) {
24
19
  @return (
25
- container-text-color: theming.get-color-from-palette($foreground, text),
26
- container-background-color: theming.get-color-from-palette($background, dialog),
20
+ container-text-color: inspection.get-theme-color($theme, foreground, text),
21
+ container-background-color: inspection.get-theme-color($theme, background, dialog),
27
22
  );
28
23
  }
29
24
 
30
25
  // Tokens that can be configured through Angular Material's typography theming API.
31
- @function get-typography-tokens($config) {
26
+ @function get-typography-tokens($theme) {
32
27
  @return (
33
- container-text-font: typography-utils.font-family($config, body-1) or
34
- typography-utils.font-family($config),
35
- container-text-line-height: typography-utils.line-height($config, body-1),
36
- container-text-size: typography-utils.font-size($config, body-1),
37
- container-text-tracking: typography-utils.letter-spacing($config, body-1),
38
- container-text-weight: typography-utils.font-weight($config, body-1),
28
+ container-text-font: inspection.get-theme-typography($theme, body-2, font-family),
29
+ container-text-line-height: inspection.get-theme-typography($theme, body-2, line-height),
30
+ container-text-size: inspection.get-theme-typography($theme, body-2, font-size),
31
+ container-text-tracking: inspection.get-theme-typography($theme, body-2, letter-spacing),
32
+ container-text-weight: inspection.get-theme-typography($theme, body-2, font-weight),
39
33
  );
40
34
  }
41
35
 
42
36
  // Tokens that can be configured through Angular Material's density theming API.
43
- @function get-density-tokens($config) {
37
+ @function get-density-tokens($theme) {
44
38
  @return ();
45
39
  }
46
40
 
@@ -1,7 +1,5 @@
1
- @use 'sass:map';
2
1
  @use '../../token-utils';
3
- @use '../../../theming/theming';
4
- @use '../../../typography/typography-utils';
2
+ @use '../../../theming/inspection';
5
3
  @use '../../../style/sass-utils';
6
4
 
7
5
  // The prefix used to generate the fully qualified name for tokens in this file.
@@ -14,45 +12,41 @@ $prefix: (mat, card);
14
12
  }
15
13
 
16
14
  // Tokens that can be configured through Angular Material's color theming API.
17
- @function get-color-tokens($config) {
18
- $foreground: map.get($config, foreground);
19
-
15
+ @function get-color-tokens($theme) {
20
16
  @return (
21
17
  // Text color of the card's subtitle.
22
- subtitle-text-color: theming.get-color-from-palette($foreground, secondary-text),
18
+ subtitle-text-color: inspection.get-theme-color($theme, foreground, secondary-text),
23
19
  );
24
20
  }
25
21
 
26
22
  // Tokens that can be configured through Angular Material's typography theming API.
27
- @function get-typography-tokens($config) {
23
+ @function get-typography-tokens($theme) {
28
24
  @return (
29
25
  // Font family of the card's title.
30
- title-text-font: typography-utils.font-family($config, headline-6)
31
- or typography-utils.font-family($config),
26
+ title-text-font: inspection.get-theme-typography($theme, headline-6, font-family),
32
27
  // Line height of the card's title.
33
- title-text-line-height: typography-utils.line-height($config, headline-6),
28
+ title-text-line-height: inspection.get-theme-typography($theme, headline-6, line-height),
34
29
  // Font size of the card's title.
35
- title-text-size: typography-utils.font-size($config, headline-6),
30
+ title-text-size: inspection.get-theme-typography($theme, headline-6, font-size),
36
31
  // Letter spacing of the card's title.
37
- title-text-tracking: typography-utils.letter-spacing($config, headline-6),
32
+ title-text-tracking: inspection.get-theme-typography($theme, headline-6, letter-spacing),
38
33
  // Font weight of the card's title.
39
- title-text-weight: typography-utils.font-weight($config, headline-6),
34
+ title-text-weight: inspection.get-theme-typography($theme, headline-6, font-weight),
40
35
  // Font family of the card's subtitle.
41
- subtitle-text-font: typography-utils.font-family($config, subtitle-2)
42
- or typography-utils.font-family($config),
36
+ subtitle-text-font: inspection.get-theme-typography($theme, subtitle-2, font-family),
43
37
  // Line height of the card's subtitle.
44
- subtitle-text-line-height: typography-utils.line-height($config, subtitle-2),
38
+ subtitle-text-line-height: inspection.get-theme-typography($theme, subtitle-2, line-height),
45
39
  // Font size of the card's subtitle.
46
- subtitle-text-size: typography-utils.font-size($config, subtitle-2),
40
+ subtitle-text-size: inspection.get-theme-typography($theme, subtitle-2, font-size),
47
41
  // Letter spacing of the card's subtitle.
48
- subtitle-text-tracking: typography-utils.letter-spacing($config, subtitle-2),
42
+ subtitle-text-tracking: inspection.get-theme-typography($theme, subtitle-2, letter-spacing),
49
43
  // Font weight of the card's subtitle.
50
- subtitle-text-weight: typography-utils.font-weight($config, subtitle-2),
44
+ subtitle-text-weight: inspection.get-theme-typography($theme, subtitle-2, font-weight),
51
45
  );
52
46
  }
53
47
 
54
48
  // Tokens that can be configured through Angular Material's density theming API.
55
- @function get-density-tokens($config) {
49
+ @function get-density-tokens($theme) {
56
50
  @return ();
57
51
  }
58
52
 
@@ -1,10 +1,8 @@
1
1
  @use 'sass:color';
2
- @use 'sass:map';
3
2
  @use 'sass:meta';
4
3
  @use 'sass:math';
5
4
  @use '../../token-utils';
6
- @use '../../../theming/theming';
7
- @use '../../../typography/typography-utils';
5
+ @use '../../../theming/inspection';
8
6
  @use '../../../style/sass-utils';
9
7
 
10
8
  // The prefix used to generate the fully qualified name for tokens in this file.
@@ -36,23 +34,20 @@ $private-default-overlap-color: #a8dab5;
36
34
  }
37
35
 
38
36
  // Tokens that can be configured through Angular Material's color theming API.
39
- @function get-color-tokens($config) {
40
- $foreground: map.get($config, foreground);
41
- $background: map.get($config, background);
42
- $primary: map.get($config, primary);
43
- $inactive-icon-color: theming.get-color-from-palette($foreground, icon);
44
- $text-color: theming.get-color-from-palette($foreground, text);
45
- $secondary-text-color: theming.get-color-from-palette($foreground, secondary-text);
46
- $disabled-text-color: theming.get-color-from-palette($foreground, disabled-text);
47
- $divider-color: theming.get-color-from-palette($foreground, divider);
48
- $hint-text-color: theming.get-color-from-palette($foreground, hint-text);
37
+ @function get-color-tokens($theme) {
38
+ $inactive-icon-color: inspection.get-theme-color($theme, foreground, icon);
39
+ $text-color: inspection.get-theme-color($theme, foreground, text);
40
+ $secondary-text-color: inspection.get-theme-color($theme, foreground, secondary-text);
41
+ $disabled-text-color: inspection.get-theme-color($theme, foreground, disabled-text);
42
+ $divider-color: inspection.get-theme-color($theme, foreground, divider);
43
+ $hint-text-color: inspection.get-theme-color($theme, foreground, hint-text);
49
44
  $preview-outline-color: $divider-color;
50
45
  $today-disabled-outline-color: null;
51
46
 
52
- $primary-color: theming.get-color-from-palette(map.get($config, primary));
47
+ $primary-color: inspection.get-theme-color($theme, primary);
53
48
  $range-tokens: get-range-color-tokens(private-get-range-background-color($primary-color));
54
- $calendar-tokens: private-get-calendar-color-palette-color-tokens($config, primary);
55
- $toggle-tokens: private-get-toggle-color-palette-color-tokens($config, primary);
49
+ $calendar-tokens: private-get-calendar-color-palette-color-tokens($theme, primary);
50
+ $toggle-tokens: private-get-toggle-color-palette-color-tokens($theme, primary);
56
51
 
57
52
  // The divider color is set under the assumption that it'll be used
58
53
  // for a solid border, but because we're using a dashed border for the
@@ -90,31 +85,30 @@ $private-default-overlap-color: #a8dab5;
90
85
  range-input-disabled-state-separator-color: $disabled-text-color,
91
86
  range-input-disabled-state-text-color: $disabled-text-color,
92
87
 
93
- calendar-container-background-color: theming.get-color-from-palette($background, card),
88
+ calendar-container-background-color: inspection.get-theme-color($theme, background, card),
94
89
  calendar-container-text-color: $text-color,
95
90
  ));
96
91
  }
97
92
 
98
93
  // Tokens that can be configured through Angular Material's typography theming API.
99
- @function get-typography-tokens($config) {
100
- $fallback-font: typography-utils.font-family($config);
101
-
94
+ @function get-typography-tokens($theme) {
102
95
  @return (
103
96
  // TODO(crisbeto): the typography tokens for other components set every typography dimension of
104
97
  // an element (e.g. size, weight, line height, letter spacing). These tokens only set the values
105
98
  // that were set in the previous theming API to reduce the amount of subtle screenshot
106
99
  // differences. We should look into introducing the other tokens in a follow-up.
107
- calendar-text-font: $fallback-font,
100
+ calendar-text-font: inspection.get-theme-typography($theme, body-1, font-family),
108
101
  calendar-text-size: 13px, // TODO(crisbeto): this doesn't appear to affect anything
109
102
 
110
- calendar-body-label-text-size: typography-utils.font-size($config, button),
111
- calendar-body-label-text-weight: typography-utils.font-weight($config, button),
103
+ calendar-body-label-text-size: inspection.get-theme-typography($theme, button, font-size),
104
+ calendar-body-label-text-weight: inspection.get-theme-typography($theme, button, font-weight),
112
105
 
113
- calendar-period-button-text-size: typography-utils.font-size($config, button),
114
- calendar-period-button-text-weight: typography-utils.font-weight($config, button),
106
+ calendar-period-button-text-size: inspection.get-theme-typography($theme, button, font-size),
107
+ calendar-period-button-text-weight: inspection.get-theme-typography(
108
+ $theme, button, font-weight),
115
109
 
116
110
  calendar-header-text-size: 11px,
117
- calendar-header-text-weight: typography-utils.font-weight($config, body-1),
111
+ calendar-header-text-weight: inspection.get-theme-typography($theme, body-1, font-weight),
118
112
  );
119
113
  }
120
114
 
@@ -133,19 +127,17 @@ $private-default-overlap-color: #a8dab5;
133
127
  );
134
128
  }
135
129
 
136
- @function private-get-calendar-color-palette-color-tokens($config, $palette-name) {
137
- $foreground: map.get($config, foreground);
138
- $palette: map.get($config, $palette-name);
139
- $palette-color: theming.get-color-from-palette($palette);
140
- $default-contrast: theming.get-color-from-palette($palette, default-contrast);
141
- $active-background-color: theming.get-color-from-palette($palette, 0.3);
130
+ @function private-get-calendar-color-palette-color-tokens($theme, $palette-name) {
131
+ $palette-color: inspection.get-theme-color($theme, $palette-name);
132
+ $default-contrast: inspection.get-theme-color($theme, $palette-name, default-contrast);
133
+ $active-background-color: sass-utils.safe-color-change($palette-color, $alpha: 0.3);
142
134
  $active-disabled-color: null;
143
135
 
144
136
  @if (meta.type-of($palette-color) == color) {
145
137
  $active-disabled-color: color.adjust($palette-color, $alpha: -$_selected-fade-amount);
146
138
  }
147
139
  @else {
148
- $active-disabled-color: theming.get-color-from-palette($foreground, disabled-button);
140
+ $active-disabled-color: inspection.get-theme-color($theme, foreground, disabled-button);
149
141
  }
150
142
 
151
143
  @return (
@@ -158,17 +150,15 @@ $private-default-overlap-color: #a8dab5;
158
150
  );
159
151
  }
160
152
 
161
- @function private-get-toggle-color-palette-color-tokens($config, $palette-name) {
162
- $palette: map.get($config, $palette-name);
163
-
153
+ @function private-get-toggle-color-palette-color-tokens($theme, $palette-name) {
164
154
  @return (
165
- toggle-active-state-icon-color: theming.get-color-from-palette($palette, text),
155
+ toggle-active-state-icon-color: inspection.get-theme-color($theme, $palette-name, text),
166
156
  );
167
157
  }
168
158
 
169
159
 
170
160
  // Tokens that can be configured through Angular Material's density theming API.
171
- @function get-density-tokens($config) {
161
+ @function get-density-tokens($theme) {
172
162
  @return ();
173
163
  }
174
164
 
@@ -1,6 +1,5 @@
1
- @use 'sass:map';
2
1
  @use '../../token-utils';
3
- @use '../../../theming/theming';
2
+ @use '../../../theming/inspection';
4
3
  @use '../../../style/sass-utils';
5
4
 
6
5
  // The prefix used to generate the fully qualified name for tokens in this file.
@@ -15,21 +14,19 @@ $prefix: (mat, divider);
15
14
  }
16
15
 
17
16
  // Tokens that can be configured through Angular Material's color theming API.
18
- @function get-color-tokens($config) {
19
- $foreground: map.get($config, foreground);
20
-
17
+ @function get-color-tokens($theme) {
21
18
  @return (
22
- color: theming.get-color-from-palette($foreground, divider)
19
+ color: inspection.get-theme-color($theme, foreground, divider)
23
20
  );
24
21
  }
25
22
 
26
23
  // Tokens that can be configured through Angular Material's typography theming API.
27
- @function get-typography-tokens($config) {
24
+ @function get-typography-tokens($theme) {
28
25
  @return ();
29
26
  }
30
27
 
31
28
  // Tokens that can be configured through Angular Material's density theming API.
32
- @function get-density-tokens($config) {
29
+ @function get-density-tokens($theme) {
33
30
  @return ();
34
31
  }
35
32
 
@@ -1,8 +1,8 @@
1
1
  @use 'sass:map';
2
2
  @use '../../token-utils';
3
3
  @use '../../../theming/theming';
4
+ @use '../../../theming/inspection';
4
5
  @use '../../../style/sass-utils';
5
- @use '../../../typography/typography-utils';
6
6
 
7
7
  // The prefix used to generate the fully qualified name for tokens in this file.
8
8
  $prefix: (mat, expansion);
@@ -16,49 +16,45 @@ $prefix: (mat, expansion);
16
16
  }
17
17
 
18
18
  // Tokens that can be configured through Angular Material's color theming API.
19
- @function get-color-tokens($config) {
20
- $foreground: map.get($config, foreground);
21
- $background: map.get($config, background);
22
-
19
+ @function get-color-tokens($theme) {
23
20
  @return (
24
- container-background-color: theming.get-color-from-palette($background, card),
25
- container-text-color: theming.get-color-from-palette($foreground, text),
26
- actions-divider-color: theming.get-color-from-palette($foreground, divider),
27
- header-hover-state-layer-color: theming.get-color-from-palette($background, hover),
28
- header-focus-state-layer-color: theming.get-color-from-palette($background, hover),
29
- header-disabled-state-text-color: theming.get-color-from-palette($foreground, disabled-button),
30
- header-text-color: theming.get-color-from-palette($foreground, text),
31
- header-description-color: theming.get-color-from-palette($foreground, secondary-text),
32
- header-indicator-color: theming.get-color-from-palette($foreground, secondary-text),
21
+ container-background-color: inspection.get-theme-color($theme, background, card),
22
+ container-text-color: inspection.get-theme-color($theme, foreground, text),
23
+ actions-divider-color: inspection.get-theme-color($theme, foreground, divider),
24
+ header-hover-state-layer-color: inspection.get-theme-color($theme, background, hover),
25
+ header-focus-state-layer-color: inspection.get-theme-color($theme, background, hover),
26
+ header-disabled-state-text-color: inspection.get-theme-color(
27
+ $theme, foreground, disabled-button),
28
+ header-text-color: inspection.get-theme-color($theme, foreground, text),
29
+ header-description-color: inspection.get-theme-color($theme, foreground, secondary-text),
30
+ header-indicator-color: inspection.get-theme-color($theme, foreground, secondary-text),
33
31
  );
34
32
  }
35
33
 
36
34
  // Tokens that can be configured through Angular Material's typography theming API.
37
- @function get-typography-tokens($config) {
38
- $fallback-font-family: typography-utils.font-family($config);
39
-
35
+ @function get-typography-tokens($theme) {
40
36
  @return (
41
- header-text-font: typography-utils.font-family($config, subheading-1) or $fallback-font-family,
42
- header-text-size: typography-utils.font-size($config, subheading-1),
43
- header-text-weight: typography-utils.font-weight($config, subheading-1),
37
+ header-text-font: inspection.get-theme-typography($theme, subtitle-2, font-family),
38
+ header-text-size: inspection.get-theme-typography($theme, subtitle-2, font-size),
39
+ header-text-weight: inspection.get-theme-typography($theme, subtitle-2, font-weight),
44
40
 
45
41
  // TODO(crisbeto): these two properties weren't set at all before the introduction of tokens,
46
42
  // but it's inconsistent not to provide them since the container sets all of them. Eventually
47
- // we should change the values to use come from `subheading-1`.
43
+ // we should change the values to use come from `subtitle-2`.
48
44
  header-text-line-height: inherit,
49
45
  header-text-tracking: inherit,
50
46
 
51
- container-text-font: typography-utils.font-family($config, body-1) or $fallback-font-family,
52
- container-text-line-height: typography-utils.line-height($config, body-1),
53
- container-text-size: typography-utils.font-size($config, body-1),
54
- container-text-tracking: typography-utils.letter-spacing($config, body-1),
55
- container-text-weight: typography-utils.font-weight($config, body-1),
47
+ container-text-font: inspection.get-theme-typography($theme, body-2, font-family),
48
+ container-text-line-height: inspection.get-theme-typography($theme, body-2, line-height),
49
+ container-text-size: inspection.get-theme-typography($theme, body-2, font-size),
50
+ container-text-tracking: inspection.get-theme-typography($theme, body-2, letter-spacing),
51
+ container-text-weight: inspection.get-theme-typography($theme, body-2, font-weight),
56
52
  );
57
53
  }
58
54
 
59
55
  // Tokens that can be configured through Angular Material's density theming API.
60
- @function get-density-tokens($config) {
61
- $scale: theming.clamp-density($config, -3);
56
+ @function get-density-tokens($theme) {
57
+ $scale: theming.clamp-density(inspection.get-theme-density($theme), -3);
62
58
  $collapsed-scale: (
63
59
  0: 48px,
64
60
  -1: 44px,