@angular/material 17.0.0-next.1 → 17.0.0-next.3

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 (119) hide show
  1. package/_index.scss +1 -2
  2. package/autocomplete/_autocomplete-theme.scss +12 -18
  3. package/autocomplete/index.d.ts +19 -26
  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-toggle/_button-toggle-theme.scss +17 -28
  8. package/button-toggle/index.d.ts +15 -18
  9. package/checkbox/index.d.ts +21 -27
  10. package/chips/_chips-theme.scss +18 -56
  11. package/core/color/_all-color.scss +7 -15
  12. package/core/density/private/_all-density.scss +34 -39
  13. package/core/focus-indicators/_focus-indicators-theme.scss +6 -8
  14. package/core/focus-indicators/_private.scss +22 -26
  15. package/core/index.d.ts +7 -11
  16. package/core/style/_form-common.scss +7 -7
  17. package/core/style/_private.scss +2 -4
  18. package/core/testing/index.d.ts +2 -1
  19. package/core/theming/_all-theme.scss +41 -41
  20. package/core/theming/_inspection.scss +47 -0
  21. package/core/theming/_m2-inspection.scss +57 -0
  22. package/core/theming/_theming.scss +0 -14
  23. package/core/tokens/m2/mat/_autocomplete.scss +5 -8
  24. package/core/tokens/m2/mat/_badge.scss +12 -15
  25. package/core/tokens/m2/mat/_bottom-sheet.scss +11 -17
  26. package/core/tokens/m2/mat/_datepicker.scss +28 -38
  27. package/core/tokens/m2/mat/_divider.scss +5 -8
  28. package/core/tokens/m2/mat/_expansion.scss +24 -28
  29. package/core/tokens/m2/mat/_grid-list.scss +8 -8
  30. package/core/tokens/m2/mat/_icon.scss +3 -3
  31. package/core/tokens/m2/mat/_legacy-button-toggle.scss +15 -19
  32. package/core/tokens/m2/mat/_menu.scss +12 -17
  33. package/core/tokens/m2/mat/_select.scss +15 -29
  34. package/core/tokens/m2/mat/_sidenav.scss +12 -14
  35. package/core/tokens/m2/mat/_snack-bar.scss +7 -8
  36. package/core/tokens/m2/mat/_standard-button-toggle.scss +23 -22
  37. package/core/tokens/m2/mat/_stepper.scss +30 -33
  38. package/core/tokens/m2/mat/_tab-header-with-background.scss +6 -8
  39. package/core/tokens/m2/mat/_tab-header.scss +13 -18
  40. package/core/tokens/m2/mat/_table.scss +19 -23
  41. package/core/tokens/m2/mat/_toolbar.scss +12 -16
  42. package/core/tokens/m2/mdc/_chip.scss +38 -24
  43. package/core/tokens/m2/mdc/_circular-progress.scss +5 -6
  44. package/core/tokens/m2/mdc/_dialog.scss +16 -30
  45. package/core/tokens/m2/mdc/_icon-button.scss +2 -2
  46. package/core/tokens/m2/mdc/_plain-tooltip.scss +9 -22
  47. package/core/tokens/m2/mdc/_snack-bar.scss +10 -23
  48. package/core/tokens/m2/mdc/_tab-indicator.scss +5 -8
  49. package/core/tokens/m2/mdc/_tab.scss +5 -4
  50. package/core/typography/_all-typography.scss +44 -47
  51. package/core/typography/_typography.scss +32 -155
  52. package/core/typography/_versioning.scss +7 -2
  53. package/datepicker/_datepicker-theme.scss +20 -34
  54. package/dialog/_dialog-theme.scss +14 -25
  55. package/dialog/_mdc-dialog-structure-overrides.scss +12 -10
  56. package/dialog/index.d.ts +2 -0
  57. package/divider/_divider-theme.scss +12 -18
  58. package/esm2022/autocomplete/autocomplete-trigger.mjs +13 -19
  59. package/esm2022/autocomplete/autocomplete.mjs +23 -50
  60. package/esm2022/badge/badge.mjs +11 -29
  61. package/esm2022/button-toggle/button-toggle.mjs +25 -33
  62. package/esm2022/checkbox/checkbox.mjs +32 -39
  63. package/esm2022/core/option/optgroup.mjs +10 -11
  64. package/esm2022/core/option/option.mjs +6 -6
  65. package/esm2022/core/testing/option-harness.mjs +3 -3
  66. package/esm2022/core/version.mjs +1 -1
  67. package/esm2022/dialog/dialog-container.mjs +16 -3
  68. package/esm2022/menu/menu-item.mjs +15 -11
  69. package/esm2022/menu/menu.mjs +9 -22
  70. package/esm2022/slide-toggle/slide-toggle.mjs +33 -37
  71. package/esm2022/tabs/tab-group.mjs +3 -3
  72. package/expansion/_expansion-theme.scss +16 -24
  73. package/fesm2022/autocomplete.mjs +33 -65
  74. package/fesm2022/autocomplete.mjs.map +1 -1
  75. package/fesm2022/badge.mjs +11 -28
  76. package/fesm2022/badge.mjs.map +1 -1
  77. package/fesm2022/button-toggle.mjs +25 -32
  78. package/fesm2022/button-toggle.mjs.map +1 -1
  79. package/fesm2022/checkbox.mjs +31 -38
  80. package/fesm2022/checkbox.mjs.map +1 -1
  81. package/fesm2022/core/testing.mjs +2 -2
  82. package/fesm2022/core/testing.mjs.map +1 -1
  83. package/fesm2022/core.mjs +14 -13
  84. package/fesm2022/core.mjs.map +1 -1
  85. package/fesm2022/dialog.mjs +15 -2
  86. package/fesm2022/dialog.mjs.map +1 -1
  87. package/fesm2022/menu.mjs +23 -31
  88. package/fesm2022/menu.mjs.map +1 -1
  89. package/fesm2022/slide-toggle.mjs +33 -36
  90. package/fesm2022/slide-toggle.mjs.map +1 -1
  91. package/fesm2022/tabs.mjs +2 -2
  92. package/fesm2022/tabs.mjs.map +1 -1
  93. package/form-field/_form-field-sizing.scss +1 -1
  94. package/grid-list/_grid-list-theme.scss +12 -19
  95. package/icon/_icon-theme.scss +17 -25
  96. package/list/_list-theme.scss +1 -1
  97. package/menu/_menu-theme.scss +13 -22
  98. package/menu/index.d.ts +12 -18
  99. package/package.json +2 -2
  100. package/prebuilt-themes/deeppurple-amber.css +1 -1
  101. package/prebuilt-themes/indigo-pink.css +1 -1
  102. package/prebuilt-themes/pink-bluegrey.css +1 -1
  103. package/prebuilt-themes/purple-green.css +1 -1
  104. package/progress-spinner/_progress-spinner-theme.scss +16 -22
  105. package/schematics/ng-add/index.js +1 -1
  106. package/schematics/ng-add/index.mjs +1 -1
  107. package/schematics/ng-generate/mdc-migration/index_bundled.js.map +1 -1
  108. package/select/_select-theme.scss +17 -31
  109. package/sidenav/_sidenav-theme.scss +12 -18
  110. package/slide-toggle/index.d.ts +20 -23
  111. package/snack-bar/_snack-bar-theme.scss +15 -24
  112. package/sort/_sort-theme.scss +13 -22
  113. package/stepper/_stepper-theme.scss +16 -34
  114. package/table/_table-theme.scss +14 -25
  115. package/tabs/_tabs-theme.scss +31 -45
  116. package/toolbar/_toolbar-theme.scss +22 -31
  117. package/tooltip/_tooltip-theme.scss +15 -23
  118. package/tree/_tree-theme.scss +20 -29
  119. package/core/typography/_typography-deprecated.scss +0 -39
@@ -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,22 +12,21 @@ $prefix: (mat, tab-header-with-background);
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
- $primary: map.get($config, primary);
15
+ @function get-color-tokens($theme, $palette-name: primary) {
18
16
 
19
17
  @return (
20
- background-color: theming.get-color-from-palette($primary, default),
21
- foreground-color: theming.get-color-from-palette($primary, default-contrast),
18
+ background-color: inspection.get-theme-color($theme, $palette-name, default),
19
+ foreground-color: inspection.get-theme-color($theme, $palette-name, default-contrast),
22
20
  );
23
21
  }
24
22
 
25
23
  // Tokens that can be configured through Angular Material's typography theming API.
26
- @function get-typography-tokens($config) {
24
+ @function get-typography-tokens($theme) {
27
25
  @return ();
28
26
  }
29
27
 
30
28
  // Tokens that can be configured through Angular Material's density theming API.
31
- @function get-density-tokens($config) {
29
+ @function get-density-tokens($theme) {
32
30
  @return ();
33
31
  }
34
32
 
@@ -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,16 +12,14 @@ $prefix: (mat, tab-header);
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
- $is-dark: map.get($config, is-dark);
19
- $foreground: map.get($config, foreground);
20
- $primary: map.get($config, primary);
15
+ @function get-color-tokens($theme, $palette-name: primary) {
16
+ $is-dark: inspection.get-theme-type($theme) == dark;
21
17
  $inactive-label-text-color: rgba(if($is-dark, #fff, #000), 0.6);
22
- $active-label-text-color: theming.get-color-from-palette($primary, default);
23
- $ripple-color: theming.get-color-from-palette($primary, default);
18
+ $active-label-text-color: inspection.get-theme-color($theme, $palette-name, default);
19
+ $ripple-color: inspection.get-theme-color($theme, $palette-name, default);
24
20
 
25
21
  @return (
26
- disabled-ripple-color: theming.get-color-from-palette($foreground, disabled),
22
+ disabled-ripple-color: inspection.get-theme-color($theme, foreground, disabled),
27
23
  pagination-icon-color: if($is-dark, #fff, #000),
28
24
 
29
25
  // Note: MDC has equivalents of these tokens, but they lead to much higher selector specificity.
@@ -43,20 +39,19 @@ $prefix: (mat, tab-header);
43
39
  }
44
40
 
45
41
  // Tokens that can be configured through Angular Material's typography theming API.
46
- @function get-typography-tokens($config) {
42
+ @function get-typography-tokens($theme) {
47
43
  @return (
48
44
  // Note: MDC has equivalents of these tokens, but they lead to much higher selector specificity.
49
- label-text-font:
50
- typography-utils.font-family($config, button) or typography-utils.font-family($config),
51
- label-text-size: typography-utils.font-size($config, button),
52
- label-text-tracking: typography-utils.letter-spacing($config, button),
53
- label-text-line-height: typography-utils.line-height($config, button),
54
- label-text-weight: typography-utils.font-weight($config, button),
45
+ label-text-font: inspection.get-theme-typography($theme, button, font-family),
46
+ label-text-size: inspection.get-theme-typography($theme, button, font-size),
47
+ label-text-tracking: inspection.get-theme-typography($theme, button, letter-spacing),
48
+ label-text-line-height: inspection.get-theme-typography($theme, button, line-height),
49
+ label-text-weight: inspection.get-theme-typography($theme, button, font-weight),
55
50
  );
56
51
  }
57
52
 
58
53
  // Tokens that can be configured through Angular Material's density theming API.
59
- @function get-density-tokens($config) {
54
+ @function get-density-tokens($theme) {
60
55
  @return ();
61
56
  }
62
57
 
@@ -1,6 +1,6 @@
1
1
  @use 'sass:map';
2
2
  @use '../../../theming/theming';
3
- @use '../../../typography/typography-utils';
3
+ @use '../../../theming/inspection';
4
4
  @use '../../token-utils';
5
5
  @use '../../../style/sass-utils';
6
6
 
@@ -16,34 +16,30 @@ $prefix: (mat, table);
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
- background-color: theming.get-color-from-palette($background, 'card'),
21
+ background-color: inspection.get-theme-color($theme, background, 'card'),
25
22
 
26
- header-headline-color: theming.get-color-from-palette($foreground, text),
27
- row-item-label-text-color: theming.get-color-from-palette($foreground, text),
28
- row-item-outline-color: theming.get-color-from-palette($foreground, divider),
23
+ header-headline-color: inspection.get-theme-color($theme, foreground, text),
24
+ row-item-label-text-color: inspection.get-theme-color($theme, foreground, text),
25
+ row-item-outline-color: inspection.get-theme-color($theme, foreground, divider),
29
26
  );
30
27
  }
31
28
 
32
29
  // Tokens that can be configured through Angular Material's typography theming API.
33
- @function get-typography-tokens($config) {
34
- $fallback-font: typography-utils.font-family($config);
35
- $cell-font-family: typography-utils.font-family($config, body-2) or $fallback-font;
36
- $cell-line-height: typography-utils.line-height($config, body-2);
37
- $cell-font-size: typography-utils.font-size($config, body-2);
38
- $cell-font-weight: typography-utils.font-weight($config, body-2);
39
- $cell-letter-spacing: typography-utils.letter-spacing($config, body-2);
30
+ @function get-typography-tokens($theme) {
31
+ $cell-font-family: inspection.get-theme-typography($theme, body-2, font-family);
32
+ $cell-line-height: inspection.get-theme-typography($theme, body-2, line-height);
33
+ $cell-font-size: inspection.get-theme-typography($theme, body-2, font-size);
34
+ $cell-font-weight: inspection.get-theme-typography($theme, body-2, font-weight);
35
+ $cell-letter-spacing: inspection.get-theme-typography($theme, body-2, letter-spacing);
40
36
 
41
37
  @return (
42
- header-headline-font: typography-utils.font-family($config, subtitle-2) or $fallback-font,
43
- header-headline-line-height: typography-utils.line-height($config, subtitle-2),
44
- header-headline-size: typography-utils.font-size($config, subtitle-2),
45
- header-headline-weight: typography-utils.font-weight($config, subtitle-2),
46
- header-headline-tracking: typography-utils.letter-spacing($config, subtitle-2),
38
+ header-headline-font: inspection.get-theme-typography($theme, subtitle-2, font-family),
39
+ header-headline-line-height: inspection.get-theme-typography($theme, subtitle-2, line-height),
40
+ header-headline-size: inspection.get-theme-typography($theme, subtitle-2, font-size),
41
+ header-headline-weight: inspection.get-theme-typography($theme, subtitle-2, font-weight),
42
+ header-headline-tracking: inspection.get-theme-typography($theme, subtitle-2, letter-spacing),
47
43
 
48
44
  // Plain cells and footer cells have the same typography.
49
45
  row-item-label-text-font: $cell-font-family,
@@ -61,8 +57,8 @@ $prefix: (mat, table);
61
57
  }
62
58
 
63
59
  // Tokens that can be configured through Angular Material's density theming API.
64
- @function get-density-tokens($config) {
65
- $scale: theming.clamp-density($config, -4);
60
+ @function get-density-tokens($theme) {
61
+ $scale: theming.clamp-density(inspection.get-theme-density($theme), -4);
66
62
  $header-scale: (
67
63
  0: 56px,
68
64
  -1: 52px,
@@ -1,7 +1,7 @@
1
1
  @use 'sass:map';
2
2
  @use '../../token-utils';
3
- @use '../../../typography/typography-utils';
4
3
  @use '../../../theming/theming';
4
+ @use '../../../theming/inspection';
5
5
  @use '../../../style/sass-utils';
6
6
 
7
7
  // The prefix used to generate the fully qualified name for tokens in this file.
@@ -14,31 +14,27 @@ $prefix: (mat, toolbar);
14
14
  }
15
15
 
16
16
  // 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
- $background: map.get($config, background);
20
-
17
+ @function get-color-tokens($theme) {
21
18
  @return private-get-color-palette-color-tokens(
22
- $background-color: theming.get-color-from-palette($background, app-bar),
23
- $text-color: theming.get-color-from-palette($foreground, text),
19
+ $background-color: inspection.get-theme-color($theme, background, app-bar),
20
+ $text-color: inspection.get-theme-color($theme, foreground, text),
24
21
  );
25
22
  }
26
23
 
27
24
  // Tokens that can be configured through Angular Material's typography theming API.
28
- @function get-typography-tokens($config) {
25
+ @function get-typography-tokens($theme) {
29
26
  @return (
30
- title-text-font: typography-utils.font-family($config, title) or
31
- typography-utils.font-family($config),
32
- title-text-line-height: typography-utils.line-height($config, title),
33
- title-text-size: typography-utils.font-size($config, title),
34
- title-text-tracking: typography-utils.letter-spacing($config, title),
35
- title-text-weight: typography-utils.font-weight($config, title),
27
+ title-text-font: inspection.get-theme-typography($theme, headline-6, font-family),
28
+ title-text-line-height: inspection.get-theme-typography($theme, headline-6, line-height),
29
+ title-text-size: inspection.get-theme-typography($theme, headline-6, font-size),
30
+ title-text-tracking: inspection.get-theme-typography($theme, headline-6, letter-spacing),
31
+ title-text-weight: inspection.get-theme-typography($theme, headline-6, font-weight),
36
32
  );
37
33
  }
38
34
 
39
35
  // Tokens that can be configured through Angular Material's density theming API.
40
- @function get-density-tokens($config) {
41
- $density-scale: theming.clamp-density($config, -3);
36
+ @function get-density-tokens($theme) {
37
+ $density-scale: theming.clamp-density(inspection.get-theme-density($theme), -3);
42
38
  $standard-scale: (
43
39
  0: 64px,
44
40
  -1: 60px,
@@ -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
 
@@ -50,12 +50,12 @@ $prefix: (mdc, icon-button);
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,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
 
@@ -26,42 +23,32 @@ $prefix: (mdc, plain-tooltip);
26
23
  }
27
24
 
28
25
  // Tokens that can be configured through Angular Material's color theming API.
29
- @function get-color-tokens($config) {
30
- $background: map.get($config, background);
26
+ @function get-color-tokens($theme) {
31
27
 
32
28
  @return (
33
29
  // Color of the tooltip container.
34
- container-color: theming.get-color-from-palette($background, tooltip),
30
+ container-color: inspection.get-theme-color($theme, background, tooltip),
35
31
  // Color of the tooltip text.
36
32
  supporting-text-color: #fff,
37
33
  );
38
34
  }
39
35
 
40
36
  // Tokens that can be configured through Angular Material's typography theming API.
41
- @function get-typography-tokens($config) {
42
- // TODO(amysorto): The earlier implementation of the tooltip used MDC's APIs to create the
43
- // typography tokens. As a result, we unintentionally allowed `null` typography configs to be
44
- // passed in. Since there a lot of apps that now depend on this pattern, we need this temporary
45
- // fallback.
46
- @if ($config == null) {
47
- $config: mdc-helpers.private-fallback-typography-from-mdc();
48
- }
49
-
37
+ @function get-typography-tokens($theme) {
50
38
  @return (
51
39
  // Font for the tooltip text.
52
- supporting-text-font: typography-utils.font-family($config, caption)
53
- or typography-utils.font-family($config),
40
+ supporting-text-font: inspection.get-theme-typography($theme, caption, font-family),
54
41
  // Font size for the tooltip text.
55
- supporting-text-size: typography-utils.font-size($config, caption),
42
+ supporting-text-size: inspection.get-theme-typography($theme, caption, font-size),
56
43
  // Font weight of the tooltip text.
57
- supporting-text-weight: typography-utils.font-weight($config, caption),
44
+ supporting-text-weight: inspection.get-theme-typography($theme, caption, font-weight),
58
45
  // Tracking (space between letters) of the tooltip text.
59
- supporting-text-tracking: typography-utils.letter-spacing($config, caption),
46
+ supporting-text-tracking: inspection.get-theme-typography($theme, caption, letter-spacing),
60
47
  );
61
48
  }
62
49
 
63
50
  // Tokens that can be configured through Angular Material's density theming API.
64
- @function get-density-tokens($config) {
51
+ @function get-density-tokens($theme) {
65
52
  @return ();
66
53
  }
67
54
 
@@ -1,10 +1,7 @@
1
- @use 'sass:map';
2
1
  @use 'sass:meta';
3
2
  @use 'sass:color';
4
- @use '../../../theming/theming';
3
+ @use '../../../theming/inspection';
5
4
  @use '../../token-utils';
6
- @use '../../../typography/typography-utils';
7
- @use '../../../mdc-helpers/mdc-helpers';
8
5
  @use '../../../style/sass-utils';
9
6
 
10
7
  // The prefix used to generate the fully qualified name for tokens in this file.
@@ -58,10 +55,9 @@ $prefix: (mdc, snackbar);
58
55
  }
59
56
 
60
57
  // Tokens that can be configured through Angular Material's color theming API.
61
- @function get-color-tokens($config) {
62
- $background-palette: map.get($config, background);
63
- $is-dark: map.get($config, is-dark);
64
- $surface: theming.get-color-from-palette($background-palette, card);
58
+ @function get-color-tokens($theme) {
59
+ $is-dark: inspection.get-theme-type($theme) == dark;
60
+ $surface: inspection.get-theme-color($theme, background, card);
65
61
 
66
62
  @return (
67
63
  container-color: if(meta.type-of($surface) == color,
@@ -71,26 +67,17 @@ $prefix: (mdc, snackbar);
71
67
  }
72
68
 
73
69
  // Tokens that can be configured through Angular Material's typography theming API.
74
- @function get-typography-tokens($config) {
75
- // TODO(crisbeto): The earlier implementation of the snack bar used MDC's APIs to create the
76
- // typography tokens. As a result, we unintentionally allowed `null` typography configs to be
77
- // passed in. Since there a lot of apps that now depend on this pattern, we need this temporary
78
- // fallback.
79
- @if ($config == null) {
80
- $config: mdc-helpers.private-fallback-typography-from-mdc();
81
- }
82
-
70
+ @function get-typography-tokens($theme) {
83
71
  @return (
84
- supporting-text-font: typography-utils.font-family($config, body-2)
85
- or typography-utils.font-family($config),
86
- supporting-text-line-height: typography-utils.line-height($config, body-2),
87
- supporting-text-size: typography-utils.font-size($config, body-2),
88
- supporting-text-weight: typography-utils.font-weight($config, body-2),
72
+ supporting-text-font: inspection.get-theme-typography($theme, body-2, font-family),
73
+ supporting-text-line-height: inspection.get-theme-typography($theme, body-2, line-height),
74
+ supporting-text-size: inspection.get-theme-typography($theme, body-2, font-size),
75
+ supporting-text-weight: inspection.get-theme-typography($theme, body-2, font-weight),
89
76
  );
90
77
  }
91
78
 
92
79
  // Tokens that can be configured through Angular Material's density theming API.
93
- @function get-density-tokens($config) {
80
+ @function get-density-tokens($theme) {
94
81
  @return ();
95
82
  }
96
83
 
@@ -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
 
@@ -21,21 +20,19 @@ $prefix: (mdc, tab-indicator);
21
20
  }
22
21
 
23
22
  // Tokens that can be configured through Angular Material's color theming API.
24
- @function get-color-tokens($config) {
25
- $primary: map.get($config, primary);
26
-
23
+ @function get-color-tokens($theme, $palette-name: primary) {
27
24
  @return (
28
- active-indicator-color: theming.get-color-from-palette($primary, default),
25
+ active-indicator-color: inspection.get-theme-color($theme, $palette-name, default),
29
26
  );
30
27
  }
31
28
 
32
29
  // Tokens that can be configured through Angular Material's typography theming API.
33
- @function get-typography-tokens($config) {
30
+ @function get-typography-tokens($theme) {
34
31
  @return ();
35
32
  }
36
33
 
37
34
  // Tokens that can be configured through Angular Material's density theming API.
38
- @function get-density-tokens($config) {
35
+ @function get-density-tokens($theme) {
39
36
  @return ();
40
37
  }
41
38
 
@@ -1,5 +1,6 @@
1
1
  @use 'sass:map';
2
2
  @use '../../../theming/theming';
3
+ @use '../../../theming/inspection';
3
4
  @use '../../../style/sass-utils';
4
5
  @use '../../token-utils';
5
6
 
@@ -50,18 +51,18 @@ $prefix: (mdc, tab);
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
+ @function get-color-tokens($theme, $palette-name: primary) {
54
55
  @return ();
55
56
  }
56
57
 
57
58
  // Tokens that can be configured through Angular Material's typography theming API.
58
- @function get-typography-tokens($config) {
59
+ @function get-typography-tokens($theme) {
59
60
  @return ();
60
61
  }
61
62
 
62
63
  // Tokens that can be configured through Angular Material's density theming API.
63
- @function get-density-tokens($config) {
64
- $scale: theming.clamp-density($config, -4);
64
+ @function get-density-tokens($theme) {
65
+ $scale: theming.clamp-density(inspection.get-theme-density($theme), -4);
65
66
 
66
67
  @return (
67
68
  container-height: map.get((