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

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 (110) hide show
  1. package/_index.scss +2 -2
  2. package/button/_button-base.scss +3 -3
  3. package/button/_button-theme-private.scss +3 -2
  4. package/button/_button-theme.scss +18 -25
  5. package/button/_fab-theme.scss +31 -49
  6. package/button/_icon-button-theme.scss +19 -26
  7. package/button/index.d.ts +22 -31
  8. package/card/_card-theme.scss +27 -38
  9. package/checkbox/_checkbox-theme.scss +28 -45
  10. package/core/_core-theme.scss +24 -39
  11. package/core/mdc-helpers/_mdc-helpers.scss +19 -22
  12. package/core/option/_optgroup-theme.scss +13 -23
  13. package/core/option/_option-theme.scss +23 -37
  14. package/core/ripple/_ripple-theme.scss +6 -10
  15. package/core/selection/pseudo-checkbox/_pseudo-checkbox-theme.scss +17 -24
  16. package/core/style/_private.scss +3 -3
  17. package/core/style/_sass-utils.scss +7 -0
  18. package/core/theming/_inspection.scss +87 -60
  19. package/core/theming/_m2-inspection.scss +211 -0
  20. package/core/theming/_theming.scss +59 -6
  21. package/core/tokens/m2/mat/_card.scss +15 -21
  22. package/core/tokens/m2/mat/_form-field.scss +21 -25
  23. package/core/tokens/m2/mat/_optgroup.scss +12 -17
  24. package/core/tokens/m2/mat/_option.scss +16 -28
  25. package/core/tokens/m2/mat/_paginator.scss +16 -18
  26. package/core/tokens/m2/mat/_radio.scss +7 -10
  27. package/core/tokens/m2/mat/_slide-toggle.scss +9 -17
  28. package/core/tokens/m2/mat/_slider.scss +5 -5
  29. package/core/tokens/m2/mdc/_checkbox.scss +21 -20
  30. package/core/tokens/m2/mdc/_elevated-card.scss +6 -9
  31. package/core/tokens/m2/mdc/_extended-fab.scss +8 -17
  32. package/core/tokens/m2/mdc/_fab.scss +6 -7
  33. package/core/tokens/m2/mdc/_filled-text-field.scss +16 -22
  34. package/core/tokens/m2/mdc/_icon-button.scss +1 -1
  35. package/core/tokens/m2/mdc/_linear-progress.scss +9 -10
  36. package/core/tokens/m2/mdc/_list.scss +44 -42
  37. package/core/tokens/m2/mdc/_outlined-card.scss +7 -10
  38. package/core/tokens/m2/mdc/_outlined-text-field.scss +14 -20
  39. package/core/tokens/m2/mdc/_radio.scss +11 -11
  40. package/core/tokens/m2/mdc/_slider.scss +16 -23
  41. package/core/tokens/m2/mdc/_switch.scss +16 -19
  42. package/core/typography/_definition.scss +258 -0
  43. package/core/typography/_property-getters.scss +63 -0
  44. package/core/typography/_typography-utils.scss +9 -69
  45. package/core/typography/_typography.scss +10 -343
  46. package/core/typography/_versioning.scss +86 -0
  47. package/datepicker/index.d.ts +3 -3
  48. package/dialog/_dialog-theme.scss +10 -0
  49. package/esm2022/autocomplete/autocomplete.mjs +1 -1
  50. package/esm2022/button/button-base.mjs +32 -27
  51. package/esm2022/button/button.mjs +6 -6
  52. package/esm2022/button/fab.mjs +23 -31
  53. package/esm2022/button/icon-button.mjs +6 -6
  54. package/esm2022/button/testing/button-harness.mjs +3 -3
  55. package/esm2022/core/version.mjs +1 -1
  56. package/esm2022/datepicker/calendar.mjs +1 -1
  57. package/esm2022/datepicker/datepicker-base.mjs +2 -2
  58. package/esm2022/datepicker/datepicker-toggle.mjs +1 -1
  59. package/esm2022/datepicker/month-view.mjs +2 -2
  60. package/esm2022/datepicker/multi-year-view.mjs +2 -2
  61. package/esm2022/datepicker/year-view.mjs +2 -2
  62. package/esm2022/dialog/dialog-container.mjs +2 -2
  63. package/esm2022/form-field/form-field.mjs +3 -3
  64. package/esm2022/paginator/paginator.mjs +1 -1
  65. package/esm2022/select/select.mjs +3 -3
  66. package/esm2022/slider/slider-input.mjs +19 -9
  67. package/esm2022/slider/slider.mjs +2 -2
  68. package/esm2022/snack-bar/simple-snack-bar.mjs +1 -1
  69. package/fesm2022/autocomplete.mjs.map +1 -1
  70. package/fesm2022/button/testing.mjs +2 -2
  71. package/fesm2022/button/testing.mjs.map +1 -1
  72. package/fesm2022/button.mjs +59 -61
  73. package/fesm2022/button.mjs.map +1 -1
  74. package/fesm2022/core.mjs +1 -1
  75. package/fesm2022/core.mjs.map +1 -1
  76. package/fesm2022/datepicker.mjs +6 -6
  77. package/fesm2022/datepicker.mjs.map +1 -1
  78. package/fesm2022/dialog.mjs +2 -2
  79. package/fesm2022/dialog.mjs.map +1 -1
  80. package/fesm2022/form-field.mjs +2 -2
  81. package/fesm2022/form-field.mjs.map +1 -1
  82. package/fesm2022/paginator.mjs +1 -1
  83. package/fesm2022/paginator.mjs.map +1 -1
  84. package/fesm2022/select.mjs +2 -2
  85. package/fesm2022/select.mjs.map +1 -1
  86. package/fesm2022/slider.mjs +20 -10
  87. package/fesm2022/slider.mjs.map +1 -1
  88. package/fesm2022/snack-bar.mjs +1 -1
  89. package/fesm2022/snack-bar.mjs.map +1 -1
  90. package/form-field/_form-field-density.scss +3 -4
  91. package/form-field/_form-field-focus-overlay.scss +1 -1
  92. package/form-field/_form-field-theme.scss +24 -34
  93. package/input/_input-theme.scss +11 -23
  94. package/list/_list-theme.scss +26 -41
  95. package/package.json +2 -2
  96. package/paginator/_paginator-theme.scss +15 -24
  97. package/prebuilt-themes/deeppurple-amber.css +1 -1
  98. package/prebuilt-themes/indigo-pink.css +1 -1
  99. package/prebuilt-themes/pink-bluegrey.css +1 -1
  100. package/prebuilt-themes/purple-green.css +1 -1
  101. package/progress-bar/_progress-bar-theme.scss +17 -24
  102. package/progress-spinner/_progress-spinner-theme.scss +3 -3
  103. package/radio/_radio-theme.scss +23 -38
  104. package/schematics/ng-add/index.js +1 -1
  105. package/schematics/ng-add/index.mjs +1 -1
  106. package/slide-toggle/_slide-toggle-theme.scss +23 -40
  107. package/slider/_slider-theme.scss +25 -42
  108. package/snack-bar/_snack-bar-theme.scss +2 -2
  109. package/button-toggle/_button-toggle-variables.scss +0 -16
  110. package/paginator/_paginator-variables.scss +0 -15
@@ -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,7 +43,7 @@ $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
  );
@@ -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
 
@@ -1,6 +1,5 @@
1
1
  @use 'sass:map';
2
- @use '../../../theming/theming';
3
- @use '../../../typography/typography-utils';
2
+ @use '../../../theming/inspection';
4
3
  @use '../../../style/sass-utils';
5
4
  @use '../../token-utils';
6
5
 
@@ -83,96 +82,99 @@ $prefix: (mdc, list);
83
82
  }
84
83
 
85
84
  // Tokens that can be configured through Angular Material's color theming API.
86
- @function get-color-tokens($config) {
87
- $foreground: map.get($config, foreground);
88
- $is-dark: map.get($config, is-dark);
89
- $foreground-base: theming.get-color-from-palette($foreground, base);
90
- $text-icon-on-background:
91
- theming.get-color-from-palette($foreground, base, if($is-dark, 0.5, 0.38));
85
+ @function get-color-tokens($theme) {
86
+ $is-dark: inspection.get-theme-type($theme) == dark;
87
+ $foreground-base: inspection.get-theme-color($theme, foreground, base);
88
+ $foreground-text: inspection.get-theme-color($theme, foreground, text);
89
+ $foreground-secondary-text: inspection.get-theme-color($theme, foreground, secondary-text);
90
+ $foreground-hint-text: inspection.get-theme-color($theme, foreground, hint-text);
91
+ $text-icon-on-background: sass-utils.safe-color-change(
92
+ $foreground-base, $alpha: if($is-dark, 0.5, 0.38));
92
93
 
93
94
  @return (
94
95
  // Text color of the list item primary text.
95
- list-item-label-text-color: theming.get-color-from-palette($foreground, text),
96
+ list-item-label-text-color: $foreground-text,
96
97
  // Text color of the list item supporting text.
97
- list-item-supporting-text-color: theming.get-color-from-palette($foreground, secondary-text),
98
+ list-item-supporting-text-color: $foreground-secondary-text,
98
99
  // Color of the list item's leading icon.
99
100
  list-item-leading-icon-color: $text-icon-on-background,
100
101
  // Text color of the list item's trailing text.
101
- list-item-trailing-supporting-text-color: theming.get-color-from-palette(
102
- $foreground, hint-text),
102
+ list-item-trailing-supporting-text-color: $foreground-hint-text,
103
103
  // Color of the list item's trailing icon.
104
104
  list-item-trailing-icon-color: $text-icon-on-background,
105
105
  // Color of the list item's trailing icon when the item is selected.
106
106
  list-item-selected-trailing-icon-color: $text-icon-on-background,
107
107
  // Text color of the list item's primary text when the item is disabled.
108
- list-item-disabled-label-text-color: theming.get-color-from-palette($foreground, base),
108
+ list-item-disabled-label-text-color: $foreground-base,
109
109
  // Color of the list item's leading icon when the item is disabled.
110
- list-item-disabled-leading-icon-color: theming.get-color-from-palette($foreground, base),
110
+ list-item-disabled-leading-icon-color: $foreground-base,
111
111
  // Color of the list item's trailing icon when the item is disabled.
112
- list-item-disabled-trailing-icon-color: theming.get-color-from-palette($foreground, base),
112
+ list-item-disabled-trailing-icon-color: $foreground-base,
113
113
  // Color of the list item's primary text when the item is being hovered.
114
- list-item-hover-label-text-color: theming.get-color-from-palette($foreground, text),
114
+ list-item-hover-label-text-color: $foreground-text,
115
115
  // Color of the list item's leading icon when the item is being hovered.
116
116
  list-item-hover-leading-icon-color: $text-icon-on-background,
117
117
  // Color of the list item's trailing icon when the item is being hovered.
118
118
  list-item-hover-trailing-icon-color: $text-icon-on-background,
119
119
  // Color of the list item's primary text when the item is focused.
120
- list-item-focus-label-text-color: theming.get-color-from-palette($foreground, text),
120
+ list-item-focus-label-text-color: $foreground-text,
121
121
  // Color of the list item's overlay when the item is hovered.
122
- list-item-hover-state-layer-color: theming.get-color-from-palette($foreground, base),
122
+ list-item-hover-state-layer-color: $foreground-base,
123
123
  // Opacity of the list item's overlay when the item is hovered.
124
124
  list-item-hover-state-layer-opacity: if($is-dark, 0.08, 0.04),
125
125
  // Color of the list item's overlay when the item is focused.
126
- list-item-focus-state-layer-color: theming.get-color-from-palette($foreground, base),
126
+ list-item-focus-state-layer-color: $foreground-base,
127
127
  // Opacity of the list item's overlay when the item is focused.
128
128
  list-item-focus-state-layer-opacity: if($is-dark, 0.24, 0.12),
129
129
  );
130
130
  }
131
131
 
132
132
  // Tokens that can be configured through Angular Material's typography theming API.
133
- @function get-typography-tokens($config) {
133
+ @function get-typography-tokens($theme) {
134
134
  @return (
135
135
  // Font family of the list item primary text.
136
- list-item-label-text-font: typography-utils.font-family($config, body-1)
137
- or typography-utils.font-family($config),
136
+ list-item-label-text-font: inspection.get-theme-typography($theme, body-1, font-family),
138
137
  // Line height of the list item primary text.
139
- list-item-label-text-line-height: typography-utils.line-height($config, body-1),
138
+ list-item-label-text-line-height: inspection.get-theme-typography($theme, body-1, line-height),
140
139
  // Font size of the list item primary text.
141
- list-item-label-text-size: typography-utils.font-size($config, body-1),
140
+ list-item-label-text-size: inspection.get-theme-typography($theme, body-1, font-size),
142
141
  // Letter spacing of the list item primary text.
143
- list-item-label-text-tracking: typography-utils.letter-spacing($config, body-1),
142
+ list-item-label-text-tracking: inspection.get-theme-typography($theme, body-1, letter-spacing),
144
143
  // Font weight of the list item primary text.
145
- list-item-label-text-weight: typography-utils.font-weight($config, body-1),
144
+ list-item-label-text-weight: inspection.get-theme-typography($theme, body-1, font-weight),
146
145
  // Font family of the list item supporting text.
147
- list-item-supporting-text-font: typography-utils.font-family($config, body-2)
148
- or typography-utils.font-family($config),
146
+ list-item-supporting-text-font: inspection.get-theme-typography($theme, body-2, font-family),
149
147
  // Line height of the list item supporting text.
150
- list-item-supporting-text-line-height: typography-utils.line-height($config, body-2),
148
+ list-item-supporting-text-line-height:inspection.get-theme-typography(
149
+ $theme, body-2, line-height),
151
150
  // Font size of the list item supporting text.
152
- list-item-supporting-text-size: typography-utils.font-size($config, body-2),
151
+ list-item-supporting-text-size: inspection.get-theme-typography($theme, body-2, font-size),
153
152
  // Letter spacing of the list item supporting text.
154
- list-item-supporting-text-tracking: typography-utils.letter-spacing($config, body-2),
153
+ list-item-supporting-text-tracking: inspection.get-theme-typography(
154
+ $theme, body-2, letter-spacing),
155
155
  // Font weight of the list item supporting text.
156
- list-item-supporting-text-weight: typography-utils.font-weight($config, body-2),
156
+ list-item-supporting-text-weight: inspection.get-theme-typography($theme, body-2, font-weight),
157
157
  // Font family of the list item's trailing text.
158
- list-item-trailing-supporting-text-font: typography-utils.font-family($config, caption)
159
- or typography-utils.font-family($config),
158
+ list-item-trailing-supporting-text-font: inspection.get-theme-typography(
159
+ $theme, caption, font-family),
160
160
  // Line height of the list item's trailing text.
161
- list-item-trailing-supporting-text-line-height: typography-utils.line-height(
162
- $config, caption),
161
+ list-item-trailing-supporting-text-line-height: inspection.get-theme-typography(
162
+ $theme, caption, line-height),
163
163
  // Font size of the list item's trailing text.
164
- list-item-trailing-supporting-text-size: typography-utils.font-size($config, caption),
164
+ list-item-trailing-supporting-text-size: inspection.get-theme-typography(
165
+ $theme, caption, font-size),
165
166
  // Letter spacing color of the list item's trailing text.
166
- list-item-trailing-supporting-text-tracking: typography-utils.letter-spacing(
167
- $config, caption),
167
+ list-item-trailing-supporting-text-tracking: inspection.get-theme-typography(
168
+ $theme, caption, letter-spacing),
168
169
  // Font weight of the list item's trailing text.
169
- list-item-trailing-supporting-text-weight: typography-utils.font-weight($config, caption),
170
+ list-item-trailing-supporting-text-weight: inspection.get-theme-typography(
171
+ $theme, caption, font-weight),
170
172
  );
171
173
  }
172
174
 
173
175
  // Tokens that can be configured through Angular Material's density theming API.
174
- @function get-density-tokens($config) {
175
- $scale: theming.clamp-density($config, -5);
176
+ @function get-density-tokens($theme) {
177
+ $scale: inspection.get-theme-density($theme);
176
178
 
177
179
  @return (
178
180
  // Height of one line list items.
@@ -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
 
@@ -51,16 +50,14 @@ $prefix: (mdc, outlined-card);
51
50
  }
52
51
 
53
52
  // Tokens that can be configured through Angular Material's color theming API.
54
- @function get-color-tokens($config) {
55
- $background: map.get($config, background);
56
- $foreground: map.get($config, foreground);
57
- $elevation: theming.get-color-from-palette($foreground, elevation);
53
+ @function get-color-tokens($theme) {
54
+ $elevation: inspection.get-theme-color($theme, foreground, elevation);
58
55
 
59
56
  @return (
60
57
  // The background color of the card.
61
- container-color: theming.get-color-from-palette($background, card),
58
+ container-color: inspection.get-theme-color($theme, background, card),
62
59
  // The border color of the card.
63
- outline-color: theming.get-color-from-palette($foreground, base, 0.12),
60
+ outline-color: rgba(inspection.get-theme-color($theme, foreground, base), 0.12),
64
61
  // The elevation level of the card.
65
62
  // (Part of the color tokens because it needs to be combined with the shadow color to generate
66
63
  // the final box-shadow).
@@ -71,12 +68,12 @@ $prefix: (mdc, outlined-card);
71
68
  }
72
69
 
73
70
  // Tokens that can be configured through Angular Material's typography theming API.
74
- @function get-typography-tokens($config) {
71
+ @function get-typography-tokens($theme) {
75
72
  @return ();
76
73
  }
77
74
 
78
75
  // Tokens that can be configured through Angular Material's density theming API.
79
- @function get-density-tokens($config) {
76
+ @function get-density-tokens($theme) {
80
77
  @return ();
81
78
  }
82
79
 
@@ -1,7 +1,6 @@
1
1
  @use 'sass:map';
2
- @use '../../../theming/theming';
2
+ @use '../../../theming/inspection';
3
3
  @use '../../../style/sass-utils';
4
- @use '../../../typography/typography-utils';
5
4
  @use '../../token-utils';
6
5
 
7
6
  // The prefix used to generate the fully qualified name for tokens in this file.
@@ -87,13 +86,11 @@ $prefix: (mdc, outlined-text-field);
87
86
  }
88
87
 
89
88
  // Tokens that can be configured through Angular Material's color theming API.
90
- @function get-color-tokens($config) {
91
- $foreground: map.get($config, foreground);
92
- $warn: map.get($config, warn);
93
- $is-dark: map.get($config, is-dark);
89
+ @function get-color-tokens($theme) {
90
+ $is-dark: inspection.get-theme-type($theme) == dark;
94
91
  $on-surface: if($is-dark, #fff, #000);
95
- $warn-color: theming.get-color-from-palette($warn);
96
- $color-tokens: private-get-color-palette-color-tokens($config, primary);
92
+ $warn-color: inspection.get-theme-color($theme, warn);
93
+ $color-tokens: private-get-color-palette-color-tokens($theme, primary);
97
94
 
98
95
  @return map.merge($color-tokens, (
99
96
  label-text-color: rgba($on-surface, 0.6),
@@ -118,31 +115,28 @@ $prefix: (mdc, outlined-text-field);
118
115
  }
119
116
 
120
117
  // Generates the mapping for the properties that change based on the text field color.
121
- @function private-get-color-palette-color-tokens($config, $palette-name) {
122
- $palette: map.get($config, $palette-name);
123
- $palette-color: theming.get-color-from-palette($palette);
118
+ @function private-get-color-palette-color-tokens($theme, $palette-name) {
119
+ $palette-color: inspection.get-theme-color($theme, $palette-name);
124
120
 
125
121
  @return (
126
122
  caret-color: $palette-color,
127
123
  focus-outline-color: $palette-color,
128
- focus-label-text-color: theming.get-color-from-palette($palette, default, 0.87),
124
+ focus-label-text-color: sass-utils.safe-color-change($palette-color, $alpha: 0.87),
129
125
  );
130
126
  }
131
127
 
132
128
  // Tokens that can be configured through Angular Material's typography theming API.
133
- @function get-typography-tokens($config) {
134
- $fallback-font-family: typography-utils.font-family($config);
135
-
129
+ @function get-typography-tokens($theme) {
136
130
  @return (
137
- label-text-font: typography-utils.font-family($config, body-1) or $fallback-font-family,
138
- label-text-size: typography-utils.font-size($config, body-1),
139
- label-text-tracking: typography-utils.letter-spacing($config, body-1),
140
- label-text-weight: typography-utils.font-weight($config, body-1),
131
+ label-text-font: inspection.get-theme-typography($theme, body-1, font-family),
132
+ label-text-size: inspection.get-theme-typography($theme, body-1, font-size),
133
+ label-text-tracking: inspection.get-theme-typography($theme, body-1, letter-spacing),
134
+ label-text-weight: inspection.get-theme-typography($theme, body-1, font-weight),
141
135
  );
142
136
  }
143
137
 
144
138
  // Tokens that can be configured through Angular Material's density theming API.
145
- @function get-density-tokens($config) {
139
+ @function get-density-tokens($theme) {
146
140
  @return ();
147
141
  }
148
142
 
@@ -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
 
@@ -41,10 +42,9 @@ $prefix: (mdc, radio);
41
42
  }
42
43
 
43
44
  // Tokens that can be configured through Angular Material's color theming API.
44
- @function get-color-tokens($config) {
45
- $accent: map.get($config, accent);
46
- $is-dark: map.get($config, is-dark);
47
- $accent-color: theming.get-color-from-palette($accent, default);
45
+ @function get-color-tokens($theme, $palette-name: accent) {
46
+ $is-dark: inspection.get-theme-type($theme) == dark;
47
+ $palette-color: inspection.get-theme-color($theme, $palette-name, default);
48
48
  $on-surface: if($is-dark, #fff, #000);
49
49
  $icon-color: theming.get-color-from-palette(palette.$gray-palette, if($is-dark, 200, 900));
50
50
 
@@ -54,21 +54,21 @@ $prefix: (mdc, radio);
54
54
  unselected-hover-icon-color: $icon-color,
55
55
  unselected-icon-color: rgba($on-surface, 0.54),
56
56
  unselected-pressed-icon-color: rgba($on-surface, 0.54),
57
- selected-focus-icon-color: $accent-color,
58
- selected-hover-icon-color: $accent-color,
59
- selected-icon-color: $accent-color,
60
- selected-pressed-icon-color: $accent-color,
57
+ selected-focus-icon-color: $palette-color,
58
+ selected-hover-icon-color: $palette-color,
59
+ selected-icon-color: $palette-color,
60
+ selected-pressed-icon-color: $palette-color,
61
61
  );
62
62
  }
63
63
 
64
64
  // Tokens that can be configured through Angular Material's typography theming API.
65
- @function get-typography-tokens($config) {
65
+ @function get-typography-tokens($theme) {
66
66
  @return ();
67
67
  }
68
68
 
69
69
  // Tokens that can be configured through Angular Material's density theming API.
70
- @function get-density-tokens($config) {
71
- $scale: theming.clamp-density($config, -3);
70
+ @function get-density-tokens($theme) {
71
+ $scale: theming.clamp-density(inspection.get-theme-density($theme), -3);
72
72
 
73
73
  @return (
74
74
  // The diameter of the radio's ripple.
@@ -1,8 +1,8 @@
1
1
  @use 'sass:map';
2
- @use '../../../theming/theming';
2
+ @use '../../../theming/inspection';
3
3
  @use '../../token-utils';
4
+ @use '../../../style/elevation';
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: (mdc, slider);
@@ -56,15 +56,13 @@ $prefix: (mdc, slider);
56
56
  }
57
57
 
58
58
  // Tokens that can be configured through Angular Material's color theming API.
59
- @function get-color-tokens($config) {
60
- $foreground: map.get($config, foreground);
61
- $elevation: theming.get-color-from-palette($foreground, elevation);
62
- $is-dark: map.get($config, is-dark);
59
+ @function get-color-tokens($theme) {
60
+ $elevation: inspection.get-theme-color($theme, foreground, elevation);
61
+ $is-dark: inspection.get-theme-type($theme) == dark;
63
62
  $on-surface: if($is-dark, #fff, #000);
64
63
 
65
64
  // The default for tokens that rely on the theme will use the primary palette
66
- $primary: map.get($config, primary);
67
- $theme-color-tokens: private-get-color-palette-color-tokens($primary);
65
+ $theme-color-tokens: private-get-color-palette-color-tokens($theme, primary);
68
66
 
69
67
  @return map.merge(
70
68
  $theme-color-tokens,
@@ -94,9 +92,9 @@ $prefix: (mdc, slider);
94
92
  }
95
93
 
96
94
  // Generates tokens for the slider properties that change based on the theme.
97
- @function private-get-color-palette-color-tokens($color-palette) {
98
- $color: theming.get-color-from-palette($color-palette);
99
- $on-color: map.get($color-palette, default-contrast);
95
+ @function private-get-color-palette-color-tokens($theme, $palette-name) {
96
+ $color: inspection.get-theme-color($theme, $palette-name);
97
+ $on-color: inspection.get-theme-color($theme, $palette-name, default-contrast);
100
98
 
101
99
  @return (
102
100
  // Color of handle.
@@ -117,28 +115,23 @@ $prefix: (mdc, slider);
117
115
  }
118
116
 
119
117
  // Tokens that can be configured through Angular Material's typography theming API.
120
- @function get-typography-tokens($config) {
121
- @if ($config == null) {
122
- $config: mdc-helpers.private-fallback-typography-from-mdc();
123
- }
124
-
118
+ @function get-typography-tokens($theme) {
125
119
  @return (
126
120
  // Font for label text.
127
- label-label-text-font: typography-utils.font-family($config, subtitle-2)
128
- or typography-utils.font-family($config),
121
+ label-label-text-font: inspection.get-theme-typography($theme, subtitle-2, font-family),
129
122
  // Font size of label text.
130
- label-label-text-size: typography-utils.font-size($config, subtitle-2),
123
+ label-label-text-size: inspection.get-theme-typography($theme, subtitle-2, font-size),
131
124
  // Line height of label text.
132
- label-label-text-line-height: typography-utils.line-height($config, subtitle-2),
125
+ label-label-text-line-height: inspection.get-theme-typography($theme, subtitle-2, line-height),
133
126
  // Letter spacing of label text.
134
- label-label-text-tracking: typography-utils.letter-spacing($config, subtitle-2),
127
+ label-label-text-tracking: inspection.get-theme-typography($theme, subtitle-2, letter-spacing),
135
128
  // Font weight of label text.
136
- label-label-text-weight: typography-utils.font-weight($config, subtitle-2),
129
+ label-label-text-weight: inspection.get-theme-typography($theme, subtitle-2, font-weight),
137
130
  );
138
131
  }
139
132
 
140
133
  // Tokens that can be configured through Angular Material's density theming API.
141
- @function get-density-tokens($config) {
134
+ @function get-density-tokens($theme) {
142
135
  @return ();
143
136
  }
144
137