@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,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,
@@ -1,5 +1,5 @@
1
1
  @use '../../token-utils';
2
- @use '../../../typography/typography-utils';
2
+ @use '../../../theming/inspection';
3
3
  @use '../../../style/sass-utils';
4
4
 
5
5
  // The prefix used to generate the fully qualified name for tokens in this file.
@@ -12,25 +12,25 @@ $prefix: (mat, grid-list);
12
12
  }
13
13
 
14
14
  // Tokens that can be configured through Angular Material's color theming API.
15
- @function get-color-tokens($config) {
15
+ @function get-color-tokens($theme) {
16
16
  @return ();
17
17
  }
18
18
 
19
19
  // Tokens that can be configured through Angular Material's typography theming API.
20
- @function get-typography-tokens($config) {
20
+ @function get-typography-tokens($theme) {
21
21
  @return (
22
22
  // TODO(crisbeto): other components have tokens for all typography dimensions.
23
23
  // Here we only set the font size to maintain the same appearance as the pre-tokens
24
24
  // theming API. Consider adding more tokens for letter spacing, font weight etc.
25
- tile-header-primary-text-size: typography-utils.font-size($config, body-1),
26
- tile-header-secondary-text-size: typography-utils.font-size($config, caption),
27
- tile-footer-primary-text-size: typography-utils.font-size($config, body-1),
28
- tile-footer-secondary-text-size: typography-utils.font-size($config, caption),
25
+ tile-header-primary-text-size: inspection.get-theme-typography($theme, body-2, font-size),
26
+ tile-header-secondary-text-size: inspection.get-theme-typography($theme, caption, font-size),
27
+ tile-footer-primary-text-size: inspection.get-theme-typography($theme, body-2, font-size),
28
+ tile-footer-secondary-text-size: inspection.get-theme-typography($theme, caption, font-size),
29
29
  );
30
30
  }
31
31
 
32
32
  // Tokens that can be configured through Angular Material's density theming API.
33
- @function get-density-tokens($config) {
33
+ @function get-density-tokens($theme) {
34
34
  @return ();
35
35
  }
36
36
 
@@ -11,18 +11,18 @@ $prefix: (mat, icon);
11
11
  }
12
12
 
13
13
  // Tokens that can be configured through Angular Material's color theming API.
14
- @function get-color-tokens($config) {
14
+ @function get-color-tokens($theme) {
15
15
  // Default the icon to `inherit` so it matches the text around it.
16
16
  @return private-get-icon-color-tokens(inherit);
17
17
  }
18
18
 
19
19
  // Tokens that can be configured through Angular Material's typography theming API.
20
- @function get-typography-tokens($config) {
20
+ @function get-typography-tokens($theme) {
21
21
  @return ();
22
22
  }
23
23
 
24
24
  // Tokens that can be configured through Angular Material's density theming API.
25
- @function get-density-tokens($config) {
25
+ @function get-density-tokens($theme) {
26
26
  @return ();
27
27
  }
28
28
 
@@ -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.
@@ -18,36 +16,34 @@ $prefix: (mat, legacy-button-toggle);
18
16
  }
19
17
 
20
18
  // Tokens that can be configured through Angular Material's color theming API.
21
- @function get-color-tokens($config) {
22
- $foreground: map.get($config, foreground);
23
- $background: map.get($config, background);
24
-
19
+ @function get-color-tokens($theme) {
25
20
  @return (
26
- text-color: theming.get-color-from-palette($foreground, hint-text),
27
- state-layer-color: theming.get-color-from-palette($background, focused-button),
28
- selected-state-text-color: theming.get-color-from-palette($foreground, secondary-text),
29
- selected-state-background-color: theming.get-color-from-palette($background, selected-button),
30
- disabled-state-text-color: theming.get-color-from-palette($foreground, disabled-button),
31
- disabled-state-background-color:
32
- theming.get-color-from-palette($background, disabled-button-toggle),
33
- disabled-selected-state-background-color:
34
- theming.get-color-from-palette($background, selected-disabled-button)
21
+ text-color: inspection.get-theme-color($theme, foreground, hint-text),
22
+ state-layer-color: inspection.get-theme-color($theme, background, focused-button),
23
+ selected-state-text-color: inspection.get-theme-color($theme, foreground, secondary-text),
24
+ selected-state-background-color: inspection.get-theme-color(
25
+ $theme, background, selected-button),
26
+ disabled-state-text-color: inspection.get-theme-color($theme, foreground, disabled-button),
27
+ disabled-state-background-color: inspection.get-theme-color(
28
+ $theme, background, disabled-button-toggle),
29
+ disabled-selected-state-background-color: inspection.get-theme-color(
30
+ $theme, background, selected-disabled-button)
35
31
  );
36
32
  }
37
33
 
38
34
  // Tokens that can be configured through Angular Material's typography theming API.
39
- @function get-typography-tokens($config) {
35
+ @function get-typography-tokens($theme) {
40
36
  @return (
41
37
  // TODO(crisbeto): other components have tokens for all typography dimensions (font weight,
42
38
  // letter spacing etc). The button toggle only has the font to match what it had in the
43
39
  // old theming API and to reduce internal breakages. We should introduce more typography
44
40
  // tokens at some point.
45
- text-font: typography-utils.font-family($config),
41
+ text-font: inspection.get-theme-typography($theme, body-1, font-family),
46
42
  );
47
43
  }
48
44
 
49
45
  // Tokens that can be configured through Angular Material's density theming API.
50
- @function get-density-tokens($config) {
46
+ @function get-density-tokens($theme) {
51
47
  @return ();
52
48
  }
53
49
 
@@ -1,8 +1,6 @@
1
- @use 'sass:map';
2
1
  @use '../../token-utils';
3
- @use '../../../theming/theming';
2
+ @use '../../../theming/inspection';
4
3
  @use '../../../style/sass-utils';
5
- @use '../../../typography/typography-utils';
6
4
 
7
5
  // The prefix used to generate the fully qualified name for tokens in this file.
8
6
  $prefix: (mat, menu);
@@ -16,37 +14,34 @@ $prefix: (mat, menu);
16
14
  }
17
15
 
18
16
  // Tokens that can be configured through Angular Material's color theming API.
19
- @function get-color-tokens($config) {
20
- $is-dark: map.get($config, is-dark);
21
- $foreground: map.get($config, foreground);
22
- $background: map.get($config, background);
17
+ @function get-color-tokens($theme) {
18
+ $is-dark: inspection.get-theme-type($theme) == dark;
23
19
  $on-surface: if($is-dark, #fff, #000);
24
20
  $active-state-layer-color: rgba($on-surface, if($is-dark, 0.08, 0.04));
25
- $text-color: theming.get-color-from-palette($foreground, text);
21
+ $text-color: inspection.get-theme-color($theme, foreground, text);
26
22
 
27
23
  @return (
28
24
  item-label-text-color: $text-color,
29
25
  item-icon-color: $text-color,
30
26
  item-hover-state-layer-color: $active-state-layer-color,
31
27
  item-focus-state-layer-color: $active-state-layer-color,
32
- container-color: theming.get-color-from-palette($background, card),
28
+ container-color: inspection.get-theme-color($theme, background, card),
33
29
  );
34
30
  }
35
31
 
36
32
  // Tokens that can be configured through Angular Material's typography theming API.
37
- @function get-typography-tokens($config) {
33
+ @function get-typography-tokens($theme) {
38
34
  @return (
39
- item-label-text-font:
40
- typography-utils.font-family($config, body-1) or typography-utils.font-family($config),
41
- item-label-text-size: typography-utils.font-size($config, body-1),
42
- item-label-text-tracking: typography-utils.letter-spacing($config, body-1),
43
- item-label-text-line-height: typography-utils.line-height($config, body-1),
44
- item-label-text-weight: typography-utils.font-weight($config, body-1),
35
+ item-label-text-font: inspection.get-theme-typography($theme, body-1, font-family),
36
+ item-label-text-size: inspection.get-theme-typography($theme, body-1, font-size),
37
+ item-label-text-tracking: inspection.get-theme-typography($theme, body-1, letter-spacing),
38
+ item-label-text-line-height: inspection.get-theme-typography($theme, body-1, line-height),
39
+ item-label-text-weight: inspection.get-theme-typography($theme, body-1, font-weight),
45
40
  );
46
41
  }
47
42
 
48
43
  // Tokens that can be configured through Angular Material's density theming API.
49
- @function get-density-tokens($config) {
44
+ @function get-density-tokens($theme) {
50
45
  @return ();
51
46
  }
52
47
 
@@ -1,8 +1,5 @@
1
- @use 'sass:map';
2
1
  @use '../../token-utils';
3
- @use '../../../typography/typography-utils';
4
- @use '../../../mdc-helpers/mdc-helpers';
5
- @use '../../../theming/theming';
2
+ @use '../../../theming/inspection';
6
3
  @use '../../../style/sass-utils';
7
4
 
8
5
  // The prefix used to generate the fully qualified name for tokens in this file.
@@ -15,48 +12,37 @@ $prefix: (mat, select);
15
12
  }
16
13
 
17
14
  // Tokens that can be configured through Angular Material's color theming API.
18
- @function get-color-tokens($config) {
19
- $is-dark: map.get($config, is-dark);
20
- $foreground: map.get($config, foreground);
21
- $background: map.get($config, background);
22
- $primary: map.get($config, primary);
23
- $warn: map.get($config, warn);
15
+ @function get-color-tokens($theme, $palette-name: primary) {
16
+ $is-dark: inspection.get-theme-type($theme) == dark;
24
17
  $on-surface: if($is-dark, #fff, #000);
25
18
 
26
19
  @return (
27
- panel-background-color: theming.get-color-from-palette($background, card),
20
+ panel-background-color: inspection.get-theme-color($theme, background, card),
28
21
  enabled-trigger-text-color: rgba($on-surface, 0.87),
29
22
  disabled-trigger-text-color: rgba($on-surface, 0.38),
30
23
  placeholder-text-color: rgba($on-surface, 0.6),
31
24
  enabled-arrow-color: rgba($on-surface, 0.54),
32
25
  disabled-arrow-color: rgba($on-surface, 0.38),
33
- focused-arrow-color: theming.get-color-from-palette($primary, default, 0.87),
34
- invalid-arrow-color: theming.get-color-from-palette($warn, default, 0.87),
26
+ focused-arrow-color: sass-utils.safe-color-change(
27
+ inspection.get-theme-color($theme, $palette-name, default), $alpha: 0.87),
28
+ invalid-arrow-color: sass-utils.safe-color-change(
29
+ inspection.get-theme-color($theme, warn, default), $alpha: 0.87),
35
30
  );
36
31
  }
37
32
 
38
33
  // Tokens that can be configured through Angular Material's typography theming API.
39
- @function get-typography-tokens($config) {
40
- // TODO(crisbeto): The earlier implementation of the select used MDC's APIs to create the
41
- // typography tokens. As a result, we unintentionally allowed `null` typography configs to be
42
- // passed in. Since there a lot of apps that now depend on this pattern, we need this temporary
43
- // fallback.
44
- @if ($config == null) {
45
- $config: mdc-helpers.private-fallback-typography-from-mdc();
46
- }
47
-
34
+ @function get-typography-tokens($theme) {
48
35
  @return (
49
- trigger-text-font: typography-utils.font-family($config, body-1) or
50
- typography-utils.font-family($config),
51
- trigger-text-line-height: typography-utils.line-height($config, body-1),
52
- trigger-text-size: typography-utils.font-size($config, body-1),
53
- trigger-text-tracking: typography-utils.letter-spacing($config, body-1),
54
- trigger-text-weight: typography-utils.font-weight($config, body-1)
36
+ trigger-text-font: inspection.get-theme-typography($theme, body-1, font-family),
37
+ trigger-text-line-height: inspection.get-theme-typography($theme, body-1, line-height),
38
+ trigger-text-size: inspection.get-theme-typography($theme, body-1, font-size),
39
+ trigger-text-tracking: inspection.get-theme-typography($theme, body-1, letter-spacing),
40
+ trigger-text-weight: inspection.get-theme-typography($theme, body-1, font-weight)
55
41
  );
56
42
  }
57
43
 
58
44
  // Tokens that can be configured through Angular Material's density theming API.
59
- @function get-density-tokens($config) {
45
+ @function get-density-tokens($theme) {
60
46
  @return ();
61
47
  }
62
48
 
@@ -1,8 +1,7 @@
1
1
  @use 'sass:color';
2
- @use 'sass:map';
3
2
  @use 'sass:meta';
4
3
  @use '../../token-utils';
5
- @use '../../../theming/theming';
4
+ @use '../../../theming/inspection';
6
5
  @use '../../../style/sass-utils';
7
6
 
8
7
  // The prefix used to generate the fully qualified name for tokens in this file.
@@ -19,20 +18,19 @@ $prefix: (mat, sidenav);
19
18
  }
20
19
 
21
20
  // Tokens that can be configured through Angular Material's color theming API.
22
- @function get-color-tokens($config) {
23
- $is-dark: map.get($config, is-dark);
24
- $foreground: map.get($config, foreground);
25
- $background: map.get($config, background);
21
+ @function get-color-tokens($theme) {
22
+ $is-dark: inspection.get-theme-type($theme) == dark;
26
23
  $scrim-opacity: 0.6;
27
- $scrim-color: theming.get-color-from-palette($background, card, $scrim-opacity);
24
+ $scrim-color: sass-utils.safe-color-change(
25
+ inspection.get-theme-color($theme, background, card), $alpha: $scrim-opacity);
28
26
  $fallback-scrim-color: if($is-dark, rgba(#fff, $scrim-opacity), rgba(#000, $scrim-opacity));
29
27
 
30
28
  @return (
31
- container-divider-color: theming.get-color-from-palette($foreground, divider),
32
- container-background-color: theming.get-color-from-palette($background, dialog),
33
- container-text-color: theming.get-color-from-palette($foreground, text),
34
- content-background-color: theming.get-color-from-palette($background, background),
35
- content-text-color: theming.get-color-from-palette($foreground, text),
29
+ container-divider-color: inspection.get-theme-color($theme, foreground, divider),
30
+ container-background-color: inspection.get-theme-color($theme, background, dialog),
31
+ container-text-color: inspection.get-theme-color($theme, foreground, text),
32
+ content-background-color: inspection.get-theme-color($theme, background, background),
33
+ content-text-color: inspection.get-theme-color($theme, foreground, text),
36
34
 
37
35
  // We use invert() here to have the darken the background color expected to be used.
38
36
  // If the background is light, we use a dark backdrop. If the background is dark, we
@@ -44,12 +42,12 @@ $prefix: (mat, sidenav);
44
42
  }
45
43
 
46
44
  // Tokens that can be configured through Angular Material's typography theming API.
47
- @function get-typography-tokens($config) {
45
+ @function get-typography-tokens($theme) {
48
46
  @return ();
49
47
  }
50
48
 
51
49
  // Tokens that can be configured through Angular Material's density theming API.
52
- @function get-density-tokens($config) {
50
+ @function get-density-tokens($theme) {
53
51
  @return ();
54
52
  }
55
53
 
@@ -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,22 @@ $prefix: (mat, snack-bar);
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
- $is-dark: map.get($config, is-dark);
18
- $accent: map.get($config, accent);
15
+ @function get-color-tokens($theme) {
16
+ $is-dark: inspection.get-theme-type($theme) == dark;
19
17
 
20
18
  @return (
21
- button-color: if($is-dark, rgba(0, 0, 0, 0.87), theming.get-color-from-palette($accent, text))
19
+ button-color: if(
20
+ $is-dark, rgba(0, 0, 0, 0.87), inspection.get-theme-color($theme, accent, text))
22
21
  );
23
22
  }
24
23
 
25
24
  // Tokens that can be configured through Angular Material's typography theming API.
26
- @function get-typography-tokens($config) {
25
+ @function get-typography-tokens($theme) {
27
26
  @return ();
28
27
  }
29
28
 
30
29
  // Tokens that can be configured through Angular Material's density theming API.
31
- @function get-density-tokens($config) {
30
+ @function get-density-tokens($theme) {
32
31
  @return ();
33
32
  }
34
33
 
@@ -1,8 +1,8 @@
1
1
  @use 'sass:map';
2
2
  @use 'sass:meta';
3
3
  @use '../../token-utils';
4
- @use '../../../typography/typography-utils';
5
4
  @use '../../../theming/theming';
5
+ @use '../../../theming/inspection';
6
6
  @use '../../../style/sass-utils';
7
7
 
8
8
  // The prefix used to generate the fully qualified name for tokens in this file.
@@ -19,49 +19,50 @@ $prefix: (mat, standard-button-toggle);
19
19
  }
20
20
 
21
21
  // Tokens that can be configured through Angular Material's color theming API.
22
- @function get-color-tokens($config) {
23
- $foreground: map.get($config, foreground);
24
- $background: map.get($config, background);
25
- $theme-divider-color: theming.get-color-from-palette($foreground, divider);
22
+ @function get-color-tokens($theme) {
23
+ $theme-divider-color: inspection.get-theme-color($theme, foreground, divider);
26
24
 
27
25
  // By default the theme usually has an rgba color for the dividers, which can
28
26
  // stack up with the background of a button toggle. This can cause the border
29
27
  // of a selected toggle to look different from an deselected one. We use a solid
30
28
  // color to ensure that the border always stays the same.
31
- $divider-color: if(meta.type-of($theme-divider-color) == color,
32
- theming.private-rgba-to-hex($theme-divider-color, map.get($background, card)),
33
- $theme-divider-color
34
- );
29
+ $divider-color: if(
30
+ meta.type-of($theme-divider-color) == color,
31
+ theming.private-rgba-to-hex(
32
+ $theme-divider-color, inspection.get-theme-color($theme, background, card)),
33
+ $theme-divider-color);
35
34
 
36
35
  @return (
37
- text-color: theming.get-color-from-palette($foreground, text),
38
- background-color: theming.get-color-from-palette($background, card),
39
- state-layer-color: theming.get-color-from-palette($background, focused-button, 1),
40
- selected-state-background-color: theming.get-color-from-palette($background, selected-button),
41
- selected-state-text-color: theming.get-color-from-palette($foreground, text),
42
- disabled-state-text-color: theming.get-color-from-palette($foreground, disabled-button),
43
- disabled-state-background-color: theming.get-color-from-palette($background, card),
44
- disabled-selected-state-text-color: theming.get-color-from-palette($foreground, text),
36
+ text-color: inspection.get-theme-color($theme, foreground, text),
37
+ background-color: inspection.get-theme-color($theme, background, card),
38
+ state-layer-color: sass-utils.safe-color-change(
39
+ inspection.get-theme-color($theme, background, focused-button), $alpha: 1),
40
+ selected-state-background-color: inspection.get-theme-color(
41
+ $theme, background, selected-button),
42
+ selected-state-text-color: inspection.get-theme-color($theme, foreground, text),
43
+ disabled-state-text-color: inspection.get-theme-color($theme, foreground, disabled-button),
44
+ disabled-state-background-color: inspection.get-theme-color($theme, background, card),
45
+ disabled-selected-state-text-color: inspection.get-theme-color($theme, foreground, text),
45
46
  disabled-selected-state-background-color:
46
- theming.get-color-from-palette($background, selected-disabled-button),
47
+ inspection.get-theme-color($theme, background, selected-disabled-button),
47
48
  divider-color: $divider-color,
48
49
  );
49
50
  }
50
51
 
51
52
  // Tokens that can be configured through Angular Material's typography theming API.
52
- @function get-typography-tokens($config) {
53
+ @function get-typography-tokens($theme) {
53
54
  @return (
54
55
  // TODO(crisbeto): other components have tokens for all typography dimensions (font weight,
55
56
  // letter spacing etc). The button toggle only has the font to match what it had in the
56
57
  // old theming API and to reduce internal breakages. We should introduce more typography
57
58
  // tokens at some point.
58
- text-font: typography-utils.font-family($config),
59
+ text-font: inspection.get-theme-typography($theme, body-1, font-family),
59
60
  );
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
- $density-scale: theming.clamp-density($config, -4);
64
+ @function get-density-tokens($theme) {
65
+ $density-scale: theming.clamp-density(inspection.get-theme-density($theme), -4);
65
66
  $size-scale: (
66
67
  0: 48px,
67
68
  -1: 44px,
@@ -1,7 +1,7 @@
1
1
  @use 'sass:map';
2
2
  @use '../../token-utils';
3
3
  @use '../../../theming/theming';
4
- @use '../../../typography/typography-utils';
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,62 +14,59 @@ $prefix: (mat, stepper);
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
- $primary: map.get($config, primary);
21
- $warn: map.get($config, warn);
22
-
23
- @return map.merge(private-get-color-palette-color-tokens($primary), (
17
+ @function get-color-tokens($theme) {
18
+ @return map.merge(private-get-color-palette-color-tokens($theme, primary), (
24
19
  // Background for stepper container.
25
- container-color: theming.get-color-from-palette($background, card),
20
+ container-color: inspection.get-theme-color($theme, background, card),
26
21
  // Color of the line indicator connecting the steps.
27
- line-color: theming.get-color-from-palette($foreground, divider),
22
+ line-color: inspection.get-theme-color($theme, foreground, divider),
28
23
  // Background color of the header while hovered.
29
- header-hover-state-layer-color: theming.get-color-from-palette($background, hover),
24
+ header-hover-state-layer-color: inspection.get-theme-color($theme, background, hover),
30
25
  // Background color of the header while focused.
31
- header-focus-state-layer-color: theming.get-color-from-palette($background, hover),
26
+ header-focus-state-layer-color: inspection.get-theme-color($theme, background, hover),
32
27
  // Color of the text inside the step header.
33
- header-label-text-color: theming.get-color-from-palette($foreground, secondary-text),
28
+ header-label-text-color: inspection.get-theme-color($theme, foreground, secondary-text),
34
29
  // Color for the "optional" label in the step header.
35
- header-optional-label-text-color: theming.get-color-from-palette($foreground, secondary-text),
30
+ header-optional-label-text-color: inspection.get-theme-color(
31
+ $theme, foreground, secondary-text),
36
32
  // Color of the header text when a step is selected.
37
- header-selected-state-label-text-color: theming.get-color-from-palette($foreground, text),
33
+ header-selected-state-label-text-color: inspection.get-theme-color($theme, foreground, text),
38
34
  // Color of the header text when a step is in an error state.
39
- header-error-state-label-text-color: theming.get-color-from-palette($warn, text),
35
+ header-error-state-label-text-color: inspection.get-theme-color($theme, warn, text),
40
36
  // Background color of the header icon.
41
- header-icon-background-color: theming.get-color-from-palette($foreground, secondary-text),
37
+ header-icon-background-color: inspection.get-theme-color($theme, foreground, secondary-text),
42
38
  // Foreground color of the header icon in the error state.
43
- header-error-state-icon-foreground-color: theming.get-color-from-palette($warn, text),
39
+ header-error-state-icon-foreground-color: inspection.get-theme-color($theme, warn, text),
44
40
  // Background color of the header icon in the error state.
45
41
  header-error-state-icon-background-color: transparent,
46
42
  ));
47
43
  }
48
44
 
49
45
  // Tokens that can be configured through Angular Material's typography theming API.
50
- @function get-typography-tokens($config) {
46
+ @function get-typography-tokens($theme) {
51
47
  @return (
52
48
  // Font family of the entire stepper.
53
- container-text-font: typography-utils.font-family($config),
49
+ container-text-font: inspection.get-theme-typography($theme, body-2, font-family),
54
50
  // Font family of the text inside the step header.
55
- header-label-text-font: typography-utils.font-family($config, body-1) or
56
- typography-utils.font-family($config),
51
+ header-label-text-font: inspection.get-theme-typography($theme, body-2, font-family),
57
52
  // Size of the text inside the step header.
58
- header-label-text-size: typography-utils.font-size($config, body-1),
53
+ header-label-text-size: inspection.get-theme-typography($theme, body-2, font-size),
59
54
  // Weight of the text inside the step header.
60
- header-label-text-weight: typography-utils.font-weight($config, body-1),
55
+ header-label-text-weight: inspection.get-theme-typography($theme, body-2, font-weight),
61
56
  // Color of the header text when a step is in an error state.
62
- header-error-state-label-text-size: typography-utils.font-size($config, body-2),
57
+ header-error-state-label-text-size: inspection.get-theme-typography($theme, body-1, font-size),
63
58
  // Size of the header text in the selected state.
64
- header-selected-state-label-text-size: typography-utils.font-size($config, body-2),
59
+ header-selected-state-label-text-size: inspection.get-theme-typography(
60
+ $theme, body-1, font-size),
65
61
  // Weight of the header text in the selected state.
66
- header-selected-state-label-text-weight: typography-utils.font-weight($config, body-2),
62
+ header-selected-state-label-text-weight: inspection.get-theme-typography(
63
+ $theme, body-1, font-weight),
67
64
  );
68
65
  }
69
66
 
70
67
  // Tokens that can be configured through Angular Material's density theming API.
71
- @function get-density-tokens($config) {
72
- $scale: theming.clamp-density($config, -4);
68
+ @function get-density-tokens($theme) {
69
+ $scale: theming.clamp-density(inspection.get-theme-density($theme), -4);
73
70
  $height-config: (
74
71
  0: 72px,
75
72
  -1: 68px,
@@ -84,13 +81,13 @@ $prefix: (mat, stepper);
84
81
  }
85
82
 
86
83
  // Generates the tokens used to theme the stepper based on a palette.
87
- @function private-get-color-palette-color-tokens($palette) {
88
- $active-state-foreground: theming.get-color-from-palette($palette, default-contrast);
89
- $active-state-background: theming.get-color-from-palette($palette);
84
+ @function private-get-color-palette-color-tokens($theme, $palette-name) {
85
+ $active-state-foreground: inspection.get-theme-color($theme, $palette-name, default-contrast);
86
+ $active-state-background: inspection.get-theme-color($theme, $palette-name);
90
87
 
91
88
  @return (
92
89
  // Foreground color of the header icon.
93
- header-icon-foreground-color: theming.get-color-from-palette($palette, default-contrast),
90
+ header-icon-foreground-color: $active-state-foreground,
94
91
  // Background color of the header icon in the selected state.
95
92
  header-selected-state-icon-background-color: $active-state-background,
96
93
  // Foreground color of the header icon in the selected state.