@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
@@ -1,6 +1,7 @@
1
1
  @use 'sass:map';
2
2
  @use '../../../theming/palette';
3
3
  @use '../../../theming/theming';
4
+ @use '../../../theming/inspection';
4
5
  @use '../../../style/sass-utils';
5
6
  @use '../../token-utils';
6
7
  @use '@material/theme/theme-color' as mdc-theme-color;
@@ -50,15 +51,15 @@ $prefix: (mdc, checkbox);
50
51
  }
51
52
 
52
53
  // Tokens that can be configured through Angular Material's color theming API.
53
- @function get-color-tokens($config) {
54
- $foreground: map.get($config, foreground);
55
- $accent: map.get($config, accent);
56
- $is-dark: map.get($config, is-dark);
57
- $foreground-base: theming.get-color-from-palette($foreground, base);
58
- $accent-default: theming.get-color-from-palette($accent, default);
59
- $disabled-color: theming.get-color-from-palette($foreground, base, 0.38);
60
- $selected-color: theming.get-color-from-palette($accent);
61
- $border-color: theming.get-color-from-palette($foreground, base, 0.54);
54
+ @function get-color-tokens($theme, $palette-name: accent) {
55
+ $is-dark: inspection.get-theme-type($theme) == dark;
56
+ $foreground-base: inspection.get-theme-color($theme, foreground, base);
57
+ $palette-default: inspection.get-theme-color($theme, $palette-name, default);
58
+ $disabled-color: sass-utils.safe-color-change(
59
+ inspection.get-theme-color($theme, foreground, base), $alpha: 0.38);
60
+ $palette-selected: inspection.get-theme-color($theme, $palette-name);
61
+ $border-color: sass-utils.safe-color-change(
62
+ inspection.get-theme-color($theme, foreground, base), $alpha: 0.54);
62
63
  $active-border-color:
63
64
  theming.get-color-from-palette(palette.$gray-palette, if($is-dark, 200, 900));
64
65
 
@@ -68,15 +69,15 @@ $prefix: (mdc, checkbox);
68
69
  // The color of the checkbox border when the checkbox is unselected and disabled.
69
70
  disabled-unselected-icon-color: $disabled-color,
70
71
  // The color of the checkmark when the checkbox is selected.
71
- selected-checkmark-color: _contrast-tone($selected-color, $is-dark),
72
+ selected-checkmark-color: _contrast-tone($palette-selected, $is-dark),
72
73
  // The color of the checkbox fill when the checkbox is selected and focused.
73
- selected-focus-icon-color: $selected-color,
74
+ selected-focus-icon-color: $palette-selected,
74
75
  // The color of the checkbox fill when the checkbox is selected and hovered.
75
- selected-hover-icon-color: $selected-color,
76
+ selected-hover-icon-color: $palette-selected,
76
77
  // The color of the checkbox fill when the checkbox is selected.
77
- selected-icon-color: $selected-color,
78
+ selected-icon-color: $palette-selected,
78
79
  // The color of the checkbox fill when the checkbox is selected an pressed.
79
- selected-pressed-icon-color: $selected-color,
80
+ selected-pressed-icon-color: $palette-selected,
80
81
  // The color of the checkbox border when the checkbox is unselected and focused.
81
82
  unselected-focus-icon-color: $active-border-color,
82
83
  // The color of the checkbox border when the checkbox is unselected and hovered.
@@ -86,11 +87,11 @@ $prefix: (mdc, checkbox);
86
87
  // The color of the checkbox border when the checkbox is unselected and pressed.
87
88
  unselected-pressed-icon-color: $border-color,
88
89
  // The color of the ripple when the checkbox is selected and focused.
89
- selected-focus-state-layer-color: $accent-default,
90
+ selected-focus-state-layer-color: $palette-default,
90
91
  // The color of the ripple when the checkbox is selected and hovered.
91
- selected-hover-state-layer-color: $accent-default,
92
+ selected-hover-state-layer-color: $palette-default,
92
93
  // The color of the ripple when the checkbox is selected and pressed.
93
- selected-pressed-state-layer-color: $accent-default,
94
+ selected-pressed-state-layer-color: $palette-default,
94
95
  // The color of the ripple when the checkbox is unselected and focused.
95
96
  unselected-focus-state-layer-color: $foreground-base,
96
97
  // The color of the ripple when the checkbox is unselected and hovered.
@@ -101,13 +102,13 @@ $prefix: (mdc, checkbox);
101
102
  }
102
103
 
103
104
  // Tokens that can be configured through Angular Material's typography theming API.
104
- @function get-typography-tokens($config) {
105
+ @function get-typography-tokens($theme) {
105
106
  @return ();
106
107
  }
107
108
 
108
109
  // Tokens that can be configured through Angular Material's density theming API.
109
- @function get-density-tokens($config) {
110
- $scale: theming.clamp-density($config, -3);
110
+ @function get-density-tokens($theme) {
111
+ $scale: theming.clamp-density(inspection.get-theme-density($theme), -3);
111
112
 
112
113
  @return (
113
114
  // The diameter of the checkbox's ripple.
@@ -1,9 +1,12 @@
1
+ @use 'sass:color';
1
2
  @use 'sass:map';
3
+ @use 'sass:meta';
2
4
  @use '../../token-utils';
3
5
  @use '../../../mdc-helpers/mdc-helpers';
4
6
  @use '../../../style/sass-utils';
5
7
  @use '../../../theming/theming';
6
- @use '../../../typography/typography-utils';
8
+ @use '../../../theming/inspection';
9
+ @use '../../../theming/palette';
7
10
 
8
11
  // The prefix used to generate the fully qualified name for tokens in this file.
9
12
  $prefix: (mdc, chip);
@@ -228,14 +231,34 @@ $prefix: (mdc, chip);
228
231
  }
229
232
 
230
233
  // Tokens that can be configured through Angular Material's color theming API.
231
- @function get-color-tokens($config) {
232
- $palette: map.get($config, primary);
234
+ @function get-color-tokens($theme, $palette-name: null) {
235
+ $foreground: null;
236
+ $background: null;
237
+ $state-layer-color: inspection.get-theme-color($theme, foreground, base);
238
+ $state-layer-opacity: 0.12; // 0.12 is a common value in Material Design for opacity.
233
239
 
234
- $background: theming.get-color-from-palette($palette);
235
- $foreground: theming.get-color-from-palette($palette, default-contrast);
240
+ @if $palette-name == null {
241
+ $is-dark: inspection.get-theme-type($theme) == dark;
242
+ $grey-50: map.get(palette.$grey-palette, 50);
243
+ $grey-900: map.get(palette.$grey-palette, 900);
244
+ $foreground: if($is-dark, $grey-50, $grey-900);
236
245
 
237
- $state-layer-color: theming.get-color-from-palette(map.get($config, foreground), base);
238
- $state-layer-opacity: 0.12; // 0.12 is a common value in Material Design for opacity.
246
+ $surface: inspection.get-theme-color($theme, background, card);
247
+ $on-surface: if(
248
+ mdc-helpers.variable-safe-contrast-tone($surface, $is-dark) == 'dark',
249
+ #000,
250
+ #fff
251
+ );
252
+ $background: if(
253
+ meta.type-of($on-surface) == color and meta.type-of($surface) == color,
254
+ color.mix($on-surface, $surface, 12%),
255
+ $on-surface
256
+ );
257
+ }
258
+ @else {
259
+ $background: inspection.get-theme-color($theme, $palette-name);
260
+ $foreground: inspection.get-theme-color($theme, $palette-name, default-contrast);
261
+ }
239
262
 
240
263
  @return (
241
264
  // The text color of a disabled chip.
@@ -264,33 +287,24 @@ $prefix: (mdc, chip);
264
287
  }
265
288
 
266
289
  // Tokens that can be configured through Angular Material's typography theming API.
267
- @function get-typography-tokens($config) {
268
- // TODO(wagnermaciel): The earlier implementation of the chip used MDC's APIs to create the
269
- // typography tokens. As a result, we unintentionally allowed `null` typography configs to be
270
- // passed in. Since there a lot of apps that now depend on this pattern, we need this temporary
271
- // fallback.
272
- @if ($config == null) {
273
- $config: mdc-helpers.private-fallback-typography-from-mdc();
274
- }
275
-
290
+ @function get-typography-tokens($theme) {
276
291
  @return (
277
292
  // The font family of the chip text.
278
- label-text-font: typography-utils.font-family($config, body-2) or
279
- typography-utils.font-family($config),
293
+ label-text-font: inspection.get-theme-typography($theme, body-2, font-family),
280
294
  // The line height of the chip text.
281
- label-text-line-height: typography-utils.line-height($config, body-2),
295
+ label-text-line-height: inspection.get-theme-typography($theme, body-2, line-height),
282
296
  // The font size of the chip text.
283
- label-text-size: typography-utils.font-size($config, body-2),
297
+ label-text-size: inspection.get-theme-typography($theme, body-2, font-size),
284
298
  // The letter spacing of the chip label.
285
- label-text-tracking: typography-utils.letter-spacing($config, body-2),
299
+ label-text-tracking: inspection.get-theme-typography($theme, body-2, letter-spacing),
286
300
  // The font weight of the chip text.
287
- label-text-weight: typography-utils.font-weight($config, body-2)
301
+ label-text-weight: inspection.get-theme-typography($theme, body-2, font-weight)
288
302
  );
289
303
  }
290
304
 
291
305
  // Tokens that can be configured through Angular Material's density theming API.
292
- @function get-density-tokens($config) {
293
- $scale: theming.clamp-density($config, -2);
306
+ @function get-density-tokens($theme) {
307
+ $scale: theming.clamp-density(inspection.get-theme-density($theme), -2);
294
308
  @return (
295
309
  // The height of the chip.
296
310
  container-height:
@@ -1,5 +1,4 @@
1
- @use 'sass:map';
2
- @use '../../../theming/theming';
1
+ @use '../../../theming/inspection';
3
2
  @use '../../../style/sass-utils';
4
3
  @use '../../token-utils';
5
4
 
@@ -33,20 +32,20 @@ $prefix: (mdc, circular-progress);
33
32
  }
34
33
 
35
34
  // Tokens that can be configured through Angular Material's color theming API.
36
- @function get-color-tokens($config) {
35
+ @function get-color-tokens($theme) {
37
36
  @return (
38
37
  // The color of the progress spinner's active indicator.
39
- active-indicator-color: theming.get-color-from-palette(map.get($config, primary))
38
+ active-indicator-color: inspection.get-theme-color($theme, primary)
40
39
  );
41
40
  }
42
41
 
43
42
  // Tokens that can be configured through Angular Material's typography theming API.
44
- @function get-typography-tokens($config) {
43
+ @function get-typography-tokens($theme) {
45
44
  @return ();
46
45
  }
47
46
 
48
47
  // Tokens that can be configured through Angular Material's density theming API.
49
- @function get-density-tokens($config) {
48
+ @function get-density-tokens($theme) {
50
49
  @return ();
51
50
  }
52
51
 
@@ -1,7 +1,4 @@
1
- @use 'sass:map';
2
- @use '../../../theming/theming';
3
- @use '../../../typography/typography-utils';
4
- @use '../../../mdc-helpers/mdc-helpers';
1
+ @use '../../../theming/inspection';
5
2
  @use '../../../style/sass-utils';
6
3
  @use '../../token-utils';
7
4
 
@@ -56,14 +53,13 @@ $prefix: (mdc, dialog);
56
53
  }
57
54
 
58
55
  // Tokens that can be configured through Angular Material's color theming API.
59
- @function get-color-tokens($config) {
60
- $is-dark: map.get($config, 'is-dark');
61
- $background: map.get($config, background);
56
+ @function get-color-tokens($theme) {
57
+ $is-dark: inspection.get-theme-type($theme) == dark;
62
58
  $on-surface: if($is-dark, #fff, #000);
63
59
 
64
60
  @return (
65
61
  // Background color of the container.
66
- container-color: theming.get-color-from-palette($background, dialog),
62
+ container-color: inspection.get-theme-color($theme, background, dialog),
67
63
  // Color of the dialog header.
68
64
  subhead-color: rgba($on-surface, 0.87),
69
65
  // Color of the dialog body text.
@@ -72,35 +68,25 @@ $prefix: (mdc, dialog);
72
68
  }
73
69
 
74
70
  // Tokens that can be configured through Angular Material's typography theming API.
75
- @function get-typography-tokens($config) {
76
- // TODO(crisbeto): The earlier implementation of the dialog used MDC's APIs to create the
77
- // typography tokens. As a result, we unintentionally allowed `null` typography configs to be
78
- // passed in. Since there a lot of apps that now depend on this pattern, we need this temporary
79
- // fallback.
80
- @if ($config == null) {
81
- $config: mdc-helpers.private-fallback-typography-from-mdc();
82
- }
83
-
71
+ @function get-typography-tokens($theme) {
84
72
  @return (
85
73
  // Typography of the dialog header.
86
- subhead-font: typography-utils.font-family($config, headline-6)
87
- or typography-utils.font-family($config),
88
- subhead-line-height: typography-utils.line-height($config, headline-6),
89
- subhead-size: typography-utils.font-size($config, headline-6),
90
- subhead-weight: typography-utils.font-weight($config, headline-6),
91
- subhead-tracking: typography-utils.letter-spacing($config, headline-6),
74
+ subhead-font: inspection.get-theme-typography($theme, headline-6, font-family),
75
+ subhead-line-height: inspection.get-theme-typography($theme, headline-6, line-height),
76
+ subhead-size: inspection.get-theme-typography($theme, headline-6, font-size),
77
+ subhead-weight: inspection.get-theme-typography($theme, headline-6, font-weight),
78
+ subhead-tracking: inspection.get-theme-typography($theme, headline-6, letter-spacing),
92
79
  // Typography of the dialog body text.
93
- supporting-text-font: typography-utils.font-family($config, body-1)
94
- or typography-utils.font-family($config),
95
- supporting-text-line-height: typography-utils.line-height($config, body-1),
96
- supporting-text-size: typography-utils.font-size($config, body-1),
97
- supporting-text-weight: typography-utils.font-weight($config, body-1),
98
- supporting-text-tracking: typography-utils.letter-spacing($config, body-1),
80
+ supporting-text-font: inspection.get-theme-typography($theme, body-1, font-family),
81
+ supporting-text-line-height: inspection.get-theme-typography($theme, body-1, line-height),
82
+ supporting-text-size: inspection.get-theme-typography($theme, body-1, font-size),
83
+ supporting-text-weight: inspection.get-theme-typography($theme, body-1, font-weight),
84
+ supporting-text-tracking: inspection.get-theme-typography($theme, body-1, letter-spacing),
99
85
  );
100
86
  }
101
87
 
102
88
  // Tokens that can be configured through Angular Material's density theming API.
103
- @function get-density-tokens($config) {
89
+ @function get-density-tokens($theme) {
104
90
  @return ();
105
91
  }
106
92
 
@@ -1,6 +1,5 @@
1
- @use 'sass:map';
2
1
  @use '../../../style/elevation';
3
- @use '../../../theming/theming';
2
+ @use '../../../theming/inspection';
4
3
  @use '../../../style/sass-utils';
5
4
  @use '../../token-utils';
6
5
 
@@ -45,14 +44,12 @@ $prefix: (mdc, elevated-card);
45
44
  }
46
45
 
47
46
  // Tokens that can be configured through Angular Material's color theming API.
48
- @function get-color-tokens($config) {
49
- $background: map.get($config, background);
50
- $foreground: map.get($config, foreground);
51
- $elevation: theming.get-color-from-palette($foreground, elevation);
47
+ @function get-color-tokens($theme) {
48
+ $elevation: inspection.get-theme-color($theme, foreground, elevation);
52
49
 
53
50
  @return (
54
51
  // The background color of the card.
55
- container-color: theming.get-color-from-palette($background, card),
52
+ container-color: inspection.get-theme-color($theme, background, card),
56
53
  // The elevation level of the card.
57
54
  // (Part of the color tokens because it needs to be combined with the shadow color to generate
58
55
  // the final box-shadow).
@@ -63,12 +60,12 @@ $prefix: (mdc, elevated-card);
63
60
  }
64
61
 
65
62
  // Tokens that can be configured through Angular Material's typography theming API.
66
- @function get-typography-tokens($config) {
63
+ @function get-typography-tokens($theme) {
67
64
  @return ();
68
65
  }
69
66
 
70
67
  // Tokens that can be configured through Angular Material's density theming API.
71
- @function get-density-tokens($config) {
68
+ @function get-density-tokens($theme) {
72
69
  @return ();
73
70
  }
74
71
 
@@ -1,6 +1,5 @@
1
- @use '../../../mdc-helpers/mdc-helpers';
2
1
  @use '../../token-utils';
3
- @use '../../../typography/typography-utils';
2
+ @use '../../../theming/inspection';
4
3
 
5
4
  @use 'sass:map';
6
5
 
@@ -45,30 +44,22 @@ $prefix: (mdc, extended-fab);
45
44
  }
46
45
 
47
46
  // Tokens that can be configured through Angular Material's color theming API.
48
- @function get-color-tokens($config) {
47
+ @function get-color-tokens($theme) {
49
48
  @return ();
50
49
  }
51
50
 
52
51
  // Tokens that can be configured through Angular Material's typography theming API.
53
- @function get-typography-tokens($config) {
54
- // TODO(wagnermaciel): The earlier implementation of the snack bar used MDC's APIs to create the
55
- // typography tokens. As a result, we unintentionally allowed `null` typography configs to be
56
- // passed in. Since there a lot of apps that now depend on this pattern, we need this temporary
57
- // fallback.
58
- @if ($config == null) {
59
- $config: mdc-helpers.private-fallback-typography-from-mdc();
60
- }
52
+ @function get-typography-tokens($theme) {
61
53
  @return (
62
- label-text-font: typography-utils.font-family($config, button) or
63
- typography-utils.font-family($config),
64
- label-text-size: typography-utils.font-size($config, button),
65
- label-text-tracking: typography-utils.letter-spacing($config, button),
66
- label-text-weight: typography-utils.font-weight($config, button)
54
+ label-text-font: inspection.get-theme-typography($theme, button, font-family),
55
+ label-text-size: inspection.get-theme-typography($theme, button, font-size),
56
+ label-text-tracking: inspection.get-theme-typography($theme, button, letter-spacing),
57
+ label-text-weight: inspection.get-theme-typography($theme, button, font-weight)
67
58
  );
68
59
  }
69
60
 
70
61
  // Tokens that can be configured through Angular Material's density theming API.
71
- @function get-density-tokens($config) {
62
+ @function get-density-tokens($theme) {
72
63
  @return ();
73
64
  }
74
65
 
@@ -1,4 +1,4 @@
1
- @use '../../../theming/theming';
1
+ @use '../../../theming/inspection';
2
2
  @use '../../token-utils';
3
3
 
4
4
  @use 'sass:map';
@@ -55,21 +55,20 @@ $ripple-target: '.mdc-fab__ripple';
55
55
  }
56
56
 
57
57
  // Tokens that can be configured through Angular Material's color theming API.
58
- @function get-color-tokens($config) {
59
- $primary: map.get($config, primary);
60
- $surface: theming.get-color-from-palette($primary, default);
61
- $on-surface: theming.get-color-from-palette($primary, default-contrast);
58
+ @function get-color-tokens($theme) {
59
+ $surface: inspection.get-theme-color($theme, primary, default);
60
+ $on-surface: inspection.get-theme-color($theme, primary, default-contrast);
62
61
 
63
62
  @return (container-color: $surface, icon-color: $on-surface);
64
63
  }
65
64
 
66
65
  // Tokens that can be configured through Angular Material's typography theming API.
67
- @function get-typography-tokens($config) {
66
+ @function get-typography-tokens($theme) {
68
67
  @return ();
69
68
  }
70
69
 
71
70
  // Tokens that can be configured through Angular Material's density theming API.
72
- @function get-density-tokens($config) {
71
+ @function get-density-tokens($theme) {
73
72
  @return ();
74
73
  }
75
74
 
@@ -1,9 +1,8 @@
1
1
  @use 'sass:color';
2
2
  @use 'sass:map';
3
3
  @use 'sass:meta';
4
- @use '../../../theming/theming';
4
+ @use '../../../theming/inspection';
5
5
  @use '../../../style/sass-utils';
6
- @use '../../../typography/typography-utils';
7
6
  @use '../../token-utils';
8
7
 
9
8
  // The prefix used to generate the fully qualified name for tokens in this file.
@@ -93,15 +92,12 @@ $prefix: (mdc, filled-text-field);
93
92
  }
94
93
 
95
94
  // Tokens that can be configured through Angular Material's color theming API.
96
- @function get-color-tokens($config) {
97
- $foreground: map.get($config, foreground);
98
- $background: map.get($config, background);
99
- $warn: map.get($config, warn);
100
- $is-dark: map.get($config, is-dark);
101
- $surface: theming.get-color-from-palette($background, card);
95
+ @function get-color-tokens($theme) {
96
+ $is-dark: inspection.get-theme-type($theme) == dark;
97
+ $surface: inspection.get-theme-color($theme, background, card);
102
98
  $on-surface: if($is-dark, #fff, #000);
103
- $warn-color: theming.get-color-from-palette($warn);
104
- $color-tokens: private-get-color-palette-color-tokens($config, primary);
99
+ $warn-color: inspection.get-theme-color($theme, warn);
100
+ $color-tokens: private-get-color-palette-color-tokens($theme, primary);
105
101
 
106
102
  @return map.merge($color-tokens, (
107
103
  container-color: _variable-safe-mix($on-surface, $surface, 4%),
@@ -135,31 +131,29 @@ $prefix: (mdc, filled-text-field);
135
131
  }
136
132
 
137
133
  // Generates the mapping for the properties that change based on the text field color.
138
- @function private-get-color-palette-color-tokens($config, $palette-name) {
139
- $palette: map.get($config, $palette-name);
140
- $palette-color: theming.get-color-from-palette($palette);
134
+ @function private-get-color-palette-color-tokens($theme, $palette-name) {
135
+ $palette: map.get($theme, $palette-name);
136
+ $palette-color: inspection.get-theme-color($theme, $palette-name);
141
137
 
142
138
  @return (
143
139
  caret-color: $palette-color,
144
140
  focus-active-indicator-color: $palette-color,
145
- focus-label-text-color: theming.get-color-from-palette($palette, default, 0.87),
141
+ focus-label-text-color: sass-utils.safe-color-change($palette-color, $alpha: 0.87),
146
142
  );
147
143
  }
148
144
 
149
145
  // Tokens that can be configured through Angular Material's typography theming API.
150
- @function get-typography-tokens($config) {
151
- $fallback-font-family: typography-utils.font-family($config);
152
-
146
+ @function get-typography-tokens($theme) {
153
147
  @return (
154
- label-text-font: typography-utils.font-family($config, body-1) or $fallback-font-family,
155
- label-text-size: typography-utils.font-size($config, body-1),
156
- label-text-tracking: typography-utils.letter-spacing($config, body-1),
157
- label-text-weight: typography-utils.font-weight($config, body-1),
148
+ label-text-font: inspection.get-theme-typography($theme, body-1, font-family),
149
+ label-text-size: inspection.get-theme-typography($theme, body-1, font-size),
150
+ label-text-tracking: inspection.get-theme-typography($theme, body-1, letter-spacing),
151
+ label-text-weight: inspection.get-theme-typography($theme, body-1, font-weight),
158
152
  );
159
153
  }
160
154
 
161
155
  // Tokens that can be configured through Angular Material's density theming API.
162
- @function get-density-tokens($config) {
156
+ @function get-density-tokens($theme) {
163
157
  @return ();
164
158
  }
165
159
 
@@ -43,19 +43,19 @@ $prefix: (mdc, icon-button);
43
43
  }
44
44
 
45
45
  // Tokens that can be configured through Angular Material's color theming API.
46
- @function get-color-tokens($config) {
46
+ @function get-color-tokens($theme) {
47
47
  @return (
48
48
  icon-color: inherit,
49
49
  );
50
50
  }
51
51
 
52
52
  // Tokens that can be configured through Angular Material's typography theming API.
53
- @function get-typography-tokens($config) {
53
+ @function get-typography-tokens($theme) {
54
54
  @return ();
55
55
  }
56
56
 
57
57
  // Tokens that can be configured through Angular Material's density theming API.
58
- @function get-density-tokens($config) {
58
+ @function get-density-tokens($theme) {
59
59
  @return ();
60
60
  }
61
61
 
@@ -1,8 +1,7 @@
1
- @use '../../../theming/theming';
1
+ @use '../../../theming/inspection';
2
2
  @use '../../../style/sass-utils';
3
3
  @use '../../token-utils';
4
4
  @use 'sass:color';
5
- @use 'sass:map';
6
5
  @use 'sass:meta';
7
6
 
8
7
  // The prefix used to generate the fully qualified name for tokens in this file.
@@ -27,26 +26,26 @@ $prefix: (mdc, linear-progress);
27
26
  }
28
27
 
29
28
  // Tokens that can be configured through Angular Material's color theming API.
30
- @function get-color-tokens($config) {
31
- $primary: theming.get-color-from-palette(map.get($config, primary));
29
+ @function get-color-tokens($theme, $palette-name: primary) {
30
+ $palette-color: inspection.get-theme-color($theme, $palette-name);
32
31
  @return (
33
32
  // The color of the progress bar's active section.
34
- active-indicator-color: $primary,
33
+ active-indicator-color: $palette-color,
35
34
  track-color: if(
36
- meta.type-of($primary) == color,
37
- color.adjust($primary, $alpha: -0.75),
38
- $primary
35
+ meta.type-of($palette-color) == color,
36
+ color.adjust($palette-color, $alpha: -0.75),
37
+ $palette-color
39
38
  )
40
39
  );
41
40
  }
42
41
 
43
42
  // Tokens that can be configured through Angular Material's typography theming API.
44
- @function get-typography-tokens($config) {
43
+ @function get-typography-tokens($theme) {
45
44
  @return ();
46
45
  }
47
46
 
48
47
  // Tokens that can be configured through Angular Material's density theming API.
49
- @function get-density-tokens($config) {
48
+ @function get-density-tokens($theme) {
50
49
  @return ();
51
50
  }
52
51