@angular/material 20.1.0-next.1 → 20.1.0-rc.0

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 (164) hide show
  1. package/_index.scss +1 -2
  2. package/autocomplete/_autocomplete-theme.scss +28 -37
  3. package/autocomplete/_m2-autocomplete.scss +10 -22
  4. package/badge/_badge-theme.scss +35 -44
  5. package/badge/_m2-badge.scss +46 -59
  6. package/bottom-sheet/_bottom-sheet-theme.scss +28 -40
  7. package/bottom-sheet/_m2-bottom-sheet.scss +16 -33
  8. package/button/_button-theme.scss +37 -55
  9. package/button/_fab-theme.scss +42 -56
  10. package/button/_icon-button-theme.scss +33 -49
  11. package/button/_m2-button.scss +135 -158
  12. package/button/_m2-fab.scss +60 -69
  13. package/button/_m2-icon-button.scss +30 -50
  14. package/button/_m3-button.scss +1 -2
  15. package/button/_m3-fab.scss +1 -2
  16. package/button/_m3-icon-button.scss +1 -2
  17. package/button/testing/index.d.ts +1 -0
  18. package/button-toggle/_button-toggle-theme.scss +29 -44
  19. package/button-toggle/_m2-button-toggle.scss +58 -81
  20. package/button-toggle/_m3-button-toggle.scss +1 -2
  21. package/card/_card-theme.scss +28 -36
  22. package/card/_m2-card.scss +30 -45
  23. package/checkbox/_checkbox-theme.scss +37 -50
  24. package/checkbox/_m2-checkbox.scss +30 -40
  25. package/checkbox/_m3-checkbox.scss +1 -2
  26. package/chips/_chips-theme.scss +27 -30
  27. package/chips/_m2-chip.scss +40 -53
  28. package/chips/_m3-chip.scss +1 -2
  29. package/core/_core-theme.scss +48 -67
  30. package/core/_m2-app.scss +11 -23
  31. package/core/focus-indicators/_private.scss +2 -5
  32. package/core/m2/_theming.scss +36 -41
  33. package/core/option/_m2-optgroup.scss +13 -25
  34. package/core/option/_m2-option.scss +16 -22
  35. package/core/option/_optgroup-theme.scss +28 -30
  36. package/core/option/_option-theme.scss +35 -34
  37. package/core/ripple/_m2-ripple.scss +8 -20
  38. package/core/ripple/_ripple-theme.scss +28 -33
  39. package/core/selection/pseudo-checkbox/_m2-pseudo-checkbox.scss +14 -21
  40. package/core/selection/pseudo-checkbox/_pseudo-checkbox-theme.scss +55 -45
  41. package/core/theming/_all-theme.scss +38 -42
  42. package/core/theming/_definition.scss +22 -13
  43. package/core/theming/_inspection.scss +0 -12
  44. package/core/theming/_m2-inspection.scss +0 -33
  45. package/core/theming/_theming.scss +4 -172
  46. package/core/tokens/_m2-utils.scss +16 -68
  47. package/core/tokens/_m3-utils.scss +2 -14
  48. package/core/tokens/_token-utils.scss +7 -27
  49. package/core/tokens/m2/_index.scss +6 -0
  50. package/core/tokens/m2/_md-sys-color.scss +123 -0
  51. package/core/tokens/m2/_md-sys-elevation.scss +16 -0
  52. package/core/tokens/m2/_md-sys-motion.scss +36 -0
  53. package/core/tokens/m2/_md-sys-shape.scss +22 -0
  54. package/core/tokens/m2/_md-sys-state.scss +15 -0
  55. package/core/tokens/m2/_md-sys-typescale.scss +68 -0
  56. package/core/tokens/m3/_md-sys-color.scss +2 -2
  57. package/core/tokens/m3/_md-sys-typescale.scss +1 -1
  58. package/core/tokens/m3/_theme.scss +14 -26
  59. package/datepicker/_datepicker-theme.scss +38 -40
  60. package/datepicker/_m2-datepicker.scss +26 -40
  61. package/dialog/_dialog-theme.scss +28 -34
  62. package/dialog/_m2-dialog.scss +34 -48
  63. package/divider/_divider-theme.scss +28 -30
  64. package/divider/_m2-divider.scss +10 -21
  65. package/expansion/_expansion-theme.scss +28 -39
  66. package/expansion/_m2-expansion.scss +52 -67
  67. package/expansion/_m3-expansion.scss +3 -2
  68. package/fesm2022/autocomplete.mjs +1 -1
  69. package/fesm2022/button/testing.mjs +7 -4
  70. package/fesm2022/button/testing.mjs.map +1 -1
  71. package/fesm2022/chips.mjs +1 -1
  72. package/fesm2022/core.mjs +1 -1
  73. package/fesm2022/core.mjs.map +1 -1
  74. package/fesm2022/datepicker.mjs +1 -1
  75. package/fesm2022/expansion.mjs +2 -2
  76. package/fesm2022/expansion.mjs.map +1 -1
  77. package/fesm2022/{form-field-C9DZXojn.mjs → form-field-CFbrnFED.mjs} +3 -3
  78. package/fesm2022/{form-field-C9DZXojn.mjs.map → form-field-CFbrnFED.mjs.map} +1 -1
  79. package/fesm2022/form-field.mjs +2 -2
  80. package/fesm2022/input.mjs +3 -27
  81. package/fesm2022/input.mjs.map +1 -1
  82. package/fesm2022/menu/testing.mjs +97 -13
  83. package/fesm2022/menu/testing.mjs.map +1 -1
  84. package/fesm2022/menu.mjs +343 -122
  85. package/fesm2022/menu.mjs.map +1 -1
  86. package/fesm2022/{module-BDiw_nWS.mjs → module-B0CLRw5e.mjs} +3 -3
  87. package/fesm2022/{module-BDiw_nWS.mjs.map → module-B0CLRw5e.mjs.map} +1 -1
  88. package/fesm2022/{module-DzZHEh7B.mjs → module-B62K-792.mjs} +2 -2
  89. package/fesm2022/{module-DzZHEh7B.mjs.map → module-B62K-792.mjs.map} +1 -1
  90. package/fesm2022/paginator.mjs +3 -3
  91. package/fesm2022/select.mjs +3 -3
  92. package/fesm2022/sidenav.mjs +2 -4
  93. package/fesm2022/sidenav.mjs.map +1 -1
  94. package/fesm2022/slide-toggle.mjs +2 -2
  95. package/fesm2022/slide-toggle.mjs.map +1 -1
  96. package/fesm2022/snack-bar.mjs +2 -2
  97. package/fesm2022/timepicker.mjs +1 -1
  98. package/form-field/_form-field-theme.scss +35 -51
  99. package/form-field/_m2-form-field.scss +125 -146
  100. package/form-field/_m3-form-field.scss +1 -2
  101. package/grid-list/_grid-list-theme.scss +28 -28
  102. package/grid-list/_m2-grid-list.scss +16 -29
  103. package/icon/_icon-theme.scss +40 -41
  104. package/icon/_m2-icon.scss +7 -21
  105. package/input/_input-theme.scss +1 -4
  106. package/input/index.d.ts +0 -11
  107. package/list/_list-theme.scss +57 -53
  108. package/list/_m2-list.scss +84 -108
  109. package/list/_m3-list.scss +1 -2
  110. package/menu/_m2-menu.scss +33 -46
  111. package/menu/_menu-theme.scss +28 -33
  112. package/menu/index.d.ts +145 -61
  113. package/menu/testing/index.d.ts +50 -2
  114. package/package.json +2 -2
  115. package/paginator/_m2-paginator.scss +38 -58
  116. package/paginator/_m3-paginator.scss +1 -2
  117. package/paginator/_paginator-theme.scss +28 -33
  118. package/prebuilt-themes/deeppurple-amber.css +1 -1
  119. package/prebuilt-themes/indigo-pink.css +1 -1
  120. package/prebuilt-themes/pink-bluegrey.css +1 -1
  121. package/prebuilt-themes/purple-green.css +1 -1
  122. package/progress-bar/_m2-progress-bar.scss +11 -24
  123. package/progress-bar/_progress-bar-theme.scss +35 -43
  124. package/progress-spinner/_m2-progress-spinner.scss +9 -20
  125. package/progress-spinner/_progress-spinner-theme.scss +42 -43
  126. package/radio/_m2-radio.scss +30 -40
  127. package/radio/_m3-radio.scss +1 -2
  128. package/radio/_radio-theme.scss +33 -46
  129. package/schematics/ng-add/index.js +1 -1
  130. package/schematics/ng-generate/theme-color/schema.json +1 -1
  131. package/select/_m2-select.scss +23 -30
  132. package/select/_m3-select.scss +1 -2
  133. package/select/_select-theme.scss +38 -51
  134. package/sidenav/_m2-sidenav.scss +26 -36
  135. package/sidenav/_sidenav-theme.scss +28 -30
  136. package/slide-toggle/_m2-slide-toggle.scss +111 -143
  137. package/slide-toggle/_m3-slide-toggle.scss +1 -0
  138. package/slide-toggle/_slide-toggle-theme.scss +42 -80
  139. package/slider/_m2-slider.scss +34 -55
  140. package/slider/_slider-theme.scss +38 -45
  141. package/snack-bar/_m2-snack-bar.scss +16 -36
  142. package/snack-bar/_snack-bar-theme.scss +28 -31
  143. package/sort/_m2-sort.scss +7 -18
  144. package/sort/_sort-theme.scss +28 -33
  145. package/stepper/_m2-stepper.scss +39 -57
  146. package/stepper/_m3-stepper.scss +1 -2
  147. package/stepper/_stepper-theme.scss +41 -49
  148. package/table/_m2-table.scss +54 -72
  149. package/table/_m3-table.scss +1 -2
  150. package/table/_table-theme.scss +28 -36
  151. package/tabs/_m2-tabs.scss +31 -46
  152. package/tabs/_m3-tabs.scss +1 -2
  153. package/tabs/_tabs-theme.scss +41 -49
  154. package/timepicker/_m2-timepicker.scss +10 -22
  155. package/timepicker/_timepicker-theme.scss +28 -46
  156. package/toolbar/_m2-toolbar.scss +26 -46
  157. package/toolbar/_m3-toolbar.scss +1 -2
  158. package/toolbar/_toolbar-theme.scss +55 -46
  159. package/tooltip/_m2-tooltip.scss +16 -34
  160. package/tooltip/_tooltip-theme.scss +28 -37
  161. package/tree/_m2-tree.scss +21 -38
  162. package/tree/_m3-tree.scss +1 -2
  163. package/tree/_tree-theme.scss +28 -38
  164. package/core/tokens/_format-tokens.scss +0 -5
@@ -3,6 +3,7 @@
3
3
  @use 'sass:meta';
4
4
  @use 'sass:color';
5
5
  @use '../theming/theming';
6
+ @use '../tokens/m2';
6
7
  @use './palette';
7
8
 
8
9
  /// Extracts a color from a palette or throws an error if it doesn't exist.
@@ -113,45 +114,26 @@
113
114
  @return $theme;
114
115
  }
115
116
 
116
- @function _define-system($primary, $accent, $warn, $is-dark) {
117
- $system: (
118
- primary: map.get($primary, default),
119
- on-primary: map.get($primary, default-contrast),
120
- secondary: map.get($accent, default),
121
- on-secondary: map.get($accent, default-contrast),
122
- error: map.get($warn, default),
123
- on-error: map.get($warn, default-contrast),
124
- shadow: black,
125
- hover-state-layer-opacity: 0.04,
126
- focus-state-layer-opacity: 0.12,
127
- pressed-state-layer-opacity: 0.12,
117
+ @function _define-system($primary, $accent, $warn, $is-dark, $typography, $density-scale) {
118
+ $palettes: (
119
+ primary: $primary,
120
+ accent: $accent,
121
+ warn: $warn,
128
122
  );
129
123
 
130
- @if $is-dark {
131
- @return map.merge($system, (
132
- surface: map.get(palette.$grey-palette, 800),
133
- surface-variant: #4a4a4a,
134
- on-surface: white,
135
- on-surface-variant: rgba(white, 0.7),
136
- background: #303030,
137
- inverse-surface: white,
138
- inverse-on-surface: rgba(black, 0.87),
139
- outline: rgba(white, 0.12),
140
- outline-variant: rgba(white, 0.38),
141
- ));
142
- } @else {
143
- @return map.merge($system, (
144
- surface: white,
145
- surface-variant: #f6f6f6,
146
- on-surface: rgba(black, 0.87),
147
- on-surface-variant: rgba(black, 0.54),
148
- background: map.get(palette.$grey-palette, 50),
149
- inverse-surface: map.get(palette.$grey-palette, 800),
150
- inverse-on-surface: white,
151
- outline: rgba(black, 0.12),
152
- outline-variant: rgba(black, 0.38),
153
- ));
124
+ $sys-color: if(
125
+ $is-dark,
126
+ m2.md-sys-color-values-dark($palettes),
127
+ m2.md-sys-color-values-light($palettes));
128
+ $sys-state: m2.md-sys-state-values();
129
+ $sys-typography: m2.md-sys-typescale-values($typography);
130
+
131
+ $system: (density-scale: $density-scale);
132
+ @each $map in ($sys-color, $sys-state, $sys-typography) {
133
+ $system: map.merge($system, $map);
154
134
  }
135
+
136
+ @return $system;
155
137
  }
156
138
 
157
139
  // Creates a color configuration from the specified
@@ -201,7 +183,15 @@
201
183
  );
202
184
 
203
185
  $theme: _internalize-theme(theming.private-create-backwards-compatibility-theme($theme));
204
- $theme: map.set($theme, _mat-system, _define-system($primary, $accent, $warn, $is-dark));
186
+ $system: _define-system(
187
+ $primary: $primary,
188
+ $accent: $accent,
189
+ $warn: $warn,
190
+ $is-dark: $is-dark,
191
+ $typography: (),
192
+ $density-scale: 0
193
+ );
194
+ $theme: map.set($theme, _mat-system, $system);
205
195
  @return $theme;
206
196
  }
207
197
  // If the map pattern is used (1), we just pass-through the configurations for individual
@@ -223,10 +213,15 @@
223
213
  $theme: _internalize-theme(
224
214
  theming.private-create-backwards-compatibility-theme(_mat-validate-theme($result))
225
215
  );
226
- $primary: map.get($result, primary) or map.get($result, color, primary) or ();
227
- $accent: map.get($result, accent) or map.get($result, color, accent) or ();
228
- $warn: map.get($result, warn) or map.get($result, color, warn) or ();
229
- $theme: map.set($theme, _mat-system, _define-system($primary, $accent, $warn, $is-dark));
216
+ $system: _define-system(
217
+ $primary: map.get($result, primary) or map.get($result, color, primary) or (),
218
+ $accent: map.get($result, accent) or map.get($result, color, accent) or (),
219
+ $warn: map.get($result, warn) or map.get($result, color, warn) or (),
220
+ $is-dark: $is-dark,
221
+ $typography: map.get($result, typography) or (),
222
+ $density-scale: map.get($result, density),
223
+ );
224
+ $theme: map.set($theme, _mat-system, $system);
230
225
  @return $theme;
231
226
  }
232
227
 
@@ -1,33 +1,21 @@
1
- @use '../theming/inspection';
2
1
  @use '../tokens/m2-utils';
3
2
  @use 'sass:map';
4
3
 
5
- // Tokens that can't be configured through Angular Material's current theming API,
6
- // but may be in a future version of the theming API.
7
- @function get-unthemable-tokens() {
8
- @return ();
9
- }
10
-
11
- // Tokens that can be configured through Angular Material's color theming API.
12
- @function get-color-tokens($theme) {
4
+ @function get-tokens($theme) {
13
5
  $system: m2-utils.get-system($theme);
14
- @return (
15
- optgroup-label-text-color: map.get($system, on-surface),
16
- );
17
- }
18
6
 
19
- // Tokens that can be configured through Angular Material's typography theming API.
20
- @function get-typography-tokens($theme) {
21
7
  @return (
22
- optgroup-label-text-font: inspection.get-theme-typography($theme, body-1, font-family),
23
- optgroup-label-text-line-height: inspection.get-theme-typography($theme, body-1, line-height),
24
- optgroup-label-text-size: inspection.get-theme-typography($theme, body-1, font-size),
25
- optgroup-label-text-tracking: inspection.get-theme-typography($theme, body-1, letter-spacing),
26
- optgroup-label-text-weight: inspection.get-theme-typography($theme, body-1, font-weight)
8
+ base: (),
9
+ color: (
10
+ optgroup-label-text-color: map.get($system, on-surface),
11
+ ),
12
+ typography: (
13
+ optgroup-label-text-font: map.get($system, body-large-font),
14
+ optgroup-label-text-line-height: map.get($system, body-large-line-height),
15
+ optgroup-label-text-size: map.get($system, body-large-size),
16
+ optgroup-label-text-tracking: map.get($system, body-large-tracking),
17
+ optgroup-label-text-weight: map.get($system, body-large-weight)
18
+ ),
19
+ density: (),
27
20
  );
28
21
  }
29
-
30
- // Tokens that can be configured through Angular Material's density theming API.
31
- @function get-density-tokens($theme) {
32
- @return ();
33
- }
@@ -1,17 +1,26 @@
1
- @use '../theming/inspection';
2
1
  @use 'sass:map';
3
2
  @use '../tokens/m2-utils';
4
3
  @use '../tokens/m3-utils';
5
4
 
6
- // Tokens that can't be configured through Angular Material's current theming API,
7
- // but may be in a future version of the theming API.
8
- @function get-unthemable-tokens() {
9
- @return ();
5
+ @function get-tokens($theme) {
6
+ $system: m2-utils.get-system($theme);
7
+
8
+ @return (
9
+ base: (),
10
+ color: private-get-color-palette-color-tokens($theme, primary),
11
+ typography: (
12
+ option-label-text-font: map.get($system, body-large-font),
13
+ option-label-text-line-height: map.get($system, body-large-line-height),
14
+ option-label-text-size: map.get($system, body-large-size),
15
+ option-label-text-tracking: map.get($system, body-large-tracking),
16
+ option-label-text-weight: map.get($system, body-large-weight)
17
+ ),
18
+ density: (),
19
+ );
10
20
  }
11
21
 
12
22
  // Tokens that can be configured through Angular Material's color theming API.
13
- @function get-color-tokens($theme, $color-variant) {
14
- $is-dark: inspection.get-theme-type($theme) == dark;
23
+ @function private-get-color-palette-color-tokens($theme, $color-variant) {
15
24
  $system: m2-utils.get-system($theme);
16
25
  $system: m3-utils.replace-colors-with-variant($system, primary, $color-variant);
17
26
 
@@ -27,18 +36,3 @@
27
36
  );
28
37
  }
29
38
 
30
- // Tokens that can be configured through Angular Material's typography theming API.
31
- @function get-typography-tokens($theme) {
32
- @return (
33
- option-label-text-font: inspection.get-theme-typography($theme, body-1, font-family),
34
- option-label-text-line-height: inspection.get-theme-typography($theme, body-1, line-height),
35
- option-label-text-size: inspection.get-theme-typography($theme, body-1, font-size),
36
- option-label-text-tracking: inspection.get-theme-typography($theme, body-1, letter-spacing),
37
- option-label-text-weight: inspection.get-theme-typography($theme, body-1, font-weight)
38
- );
39
- }
40
-
41
- // Tokens that can be configured through Angular Material's density theming API.
42
- @function get-density-tokens($theme) {
43
- @return ();
44
- }
@@ -2,43 +2,43 @@
2
2
  @use './m2-optgroup';
3
3
  @use './m3-optgroup';
4
4
  @use '../tokens/token-utils';
5
- @use '../style/sass-utils';
6
- @use '../theming/theming';
7
5
  @use '../theming/inspection';
8
6
  @use '../typography/typography';
9
7
 
10
8
  @mixin base($theme) {
9
+ $tokens: map.get(m2-optgroup.get-tokens($theme), base);
11
10
  @if inspection.get-theme-version($theme) == 1 {
12
- @include token-utils.create-token-values(map.get(m3-optgroup.get-tokens($theme), base));
13
- } @else {
11
+ $tokens: map.get(m3-optgroup.get-tokens($theme), base);
14
12
  }
13
+
14
+ @include token-utils.values($tokens);
15
15
  }
16
16
 
17
17
  @mixin color($theme) {
18
+ $tokens: map.get(m2-optgroup.get-tokens($theme), color);
18
19
  @if inspection.get-theme-version($theme) == 1 {
19
- @include token-utils.create-token-values(map.get(m3-optgroup.get-tokens($theme), color));
20
- } @else {
21
- @include sass-utils.current-selector-or-root() {
22
- @include token-utils.create-token-values-mixed(m2-optgroup.get-color-tokens($theme));
23
- }
20
+ $tokens: map.get(m3-optgroup.get-tokens($theme), color);
24
21
  }
22
+
23
+ @include token-utils.values($tokens);
25
24
  }
26
25
 
27
26
  @mixin typography($theme) {
27
+ $tokens: map.get(m2-optgroup.get-tokens($theme), typography);
28
28
  @if inspection.get-theme-version($theme) == 1 {
29
- @include token-utils.create-token-values(map.get(m3-optgroup.get-tokens($theme), typography));
30
- } @else {
31
- @include sass-utils.current-selector-or-root() {
32
- @include token-utils.create-token-values-mixed(m2-optgroup.get-typography-tokens($theme));
33
- }
29
+ $tokens: map.get(m3-optgroup.get-tokens($theme), typography);
34
30
  }
31
+
32
+ @include token-utils.values($tokens);
35
33
  }
36
34
 
37
35
  @mixin density($theme) {
36
+ $tokens: map.get(m2-optgroup.get-tokens($theme), density);
38
37
  @if inspection.get-theme-version($theme) == 1 {
39
- @include token-utils.create-token-values(map.get(m3-optgroup.get-tokens($theme), base));
40
- } @else {
38
+ $tokens: map.get(m3-optgroup.get-tokens($theme), density);
41
39
  }
40
+
41
+ @include token-utils.values($tokens);
42
42
  }
43
43
 
44
44
  /// Defines the tokens that will be available in the `overrides` mixin and for docs extraction.
@@ -56,23 +56,21 @@
56
56
  }
57
57
 
58
58
  @mixin theme($theme) {
59
- @include theming.private-check-duplicate-theme-styles($theme, 'mat-optgroup') {
60
- @if inspection.get-theme-version($theme) == 1 {
61
- @include base($theme);
59
+ @if inspection.get-theme-version($theme) == 1 {
60
+ @include base($theme);
61
+ @include color($theme);
62
+ @include density($theme);
63
+ @include typography($theme);
64
+ } @else {
65
+ @include base($theme);
66
+ @if inspection.theme-has($theme, color) {
62
67
  @include color($theme);
68
+ }
69
+ @if inspection.theme-has($theme, density) {
63
70
  @include density($theme);
71
+ }
72
+ @if inspection.theme-has($theme, typography) {
64
73
  @include typography($theme);
65
- } @else {
66
- @include base($theme);
67
- @if inspection.theme-has($theme, color) {
68
- @include color($theme);
69
- }
70
- @if inspection.theme-has($theme, density) {
71
- @include density($theme);
72
- }
73
- @if inspection.theme-has($theme, typography) {
74
- @include typography($theme);
75
- }
76
74
  }
77
75
  }
78
76
  }
@@ -1,8 +1,6 @@
1
1
  @use './m2-option';
2
2
  @use './m3-option';
3
3
  @use '../tokens/token-utils';
4
- @use '../style/sass-utils';
5
- @use '../theming/theming';
6
4
  @use '../theming/inspection';
7
5
  @use '../typography/typography';
8
6
  @use 'sass:map';
@@ -11,30 +9,34 @@
11
9
  /// for the mat-option.
12
10
  /// @param {Map} $theme The theme to generate base styles for.
13
11
  @mixin base($theme) {
12
+ $tokens: map.get(m2-option.get-tokens($theme), base);
14
13
  @if inspection.get-theme-version($theme) == 1 {
15
- @include token-utils.create-token-values(map.get(m3-option.get-tokens($theme), base));
16
- } @else {
14
+ $tokens: map.get(m3-option.get-tokens($theme), base);
17
15
  }
16
+
17
+ @include token-utils.values($tokens);
18
18
  }
19
19
 
20
20
  /// Outputs color theme styles for the mat-option.
21
21
  /// @param {Map} $theme The theme to generate color styles for.
22
22
  /// @param {String} $color-variant The color variant to use for the component (M3 only)
23
23
  @mixin color($theme, $color-variant: null) {
24
+ $tokens: map.get(m2-option.get-tokens($theme), color);
24
25
  @if inspection.get-theme-version($theme) == 1 {
25
- @include token-utils.create-token-values(
26
- map.get(m3-option.get-tokens($theme, $color-variant), color));
27
- } @else {
28
- @include sass-utils.current-selector-or-root() {
29
- @include token-utils.create-token-values-mixed(m2-option.get-color-tokens($theme, primary));
30
- }
26
+ $tokens: map.get(m3-option.get-tokens($theme, $color-variant), color);
27
+ }
28
+
29
+ @include token-utils.values($tokens);
31
30
 
31
+ @if inspection.get-theme-version($theme) != 1 {
32
32
  .mat-accent {
33
- @include token-utils.create-token-values-mixed(m2-option.get-color-tokens($theme, secondary));
33
+ $tokens: m2-option.private-get-color-palette-color-tokens($theme, secondary);
34
+ @include token-utils.values($tokens);
34
35
  }
35
36
 
36
37
  .mat-warn {
37
- @include token-utils.create-token-values-mixed(m2-option.get-color-tokens($theme, error));
38
+ $tokens: m2-option.private-get-color-palette-color-tokens($theme, error);
39
+ @include token-utils.values($tokens);
38
40
  }
39
41
  }
40
42
  }
@@ -42,22 +44,23 @@
42
44
  /// Outputs typography theme styles for the mat-option.
43
45
  /// @param {Map} $theme The theme to generate typography styles for.
44
46
  @mixin typography($theme) {
47
+ $tokens: map.get(m2-option.get-tokens($theme), typography);
45
48
  @if inspection.get-theme-version($theme) == 1 {
46
- @include token-utils.create-token-values(map.get(m3-option.get-tokens($theme), typography));
47
- } @else {
48
- @include sass-utils.current-selector-or-root() {
49
- @include token-utils.create-token-values-mixed(m2-option.get-typography-tokens($theme));
50
- }
49
+ $tokens: map.get(m3-option.get-tokens($theme), typography);
51
50
  }
51
+
52
+ @include token-utils.values($tokens);
52
53
  }
53
54
 
54
55
  /// Outputs density theme styles for the mat-option.
55
56
  /// @param {Map} $theme The theme to generate density styles for.
56
57
  @mixin density($theme) {
58
+ $tokens: map.get(m2-option.get-tokens($theme), density);
57
59
  @if inspection.get-theme-version($theme) == 1 {
58
- @include token-utils.create-token-values(map.get(m3-option.get-tokens($theme), density));
59
- } @else {
60
+ $tokens: map.get(m3-option.get-tokens($theme), density);
60
61
  }
62
+
63
+ @include token-utils.values($tokens);
61
64
  }
62
65
 
63
66
  /// Defines the tokens that will be available in the `overrides` mixin and for docs extraction.
@@ -80,23 +83,21 @@
80
83
  /// @param {Map} $theme The theme to generate styles for.
81
84
  /// @param {String} $color-variant The color variant to use for the component (M3 only)
82
85
  @mixin theme($theme, $color-variant: null) {
83
- @include theming.private-check-duplicate-theme-styles($theme, 'mat-option') {
84
- @if inspection.get-theme-version($theme) == 1 {
85
- @include base($theme);
86
- @include color($theme, $color-variant);
86
+ @if inspection.get-theme-version($theme) == 1 {
87
+ @include base($theme);
88
+ @include color($theme, $color-variant);
89
+ @include density($theme);
90
+ @include typography($theme);
91
+ } @else {
92
+ @include base($theme);
93
+ @if inspection.theme-has($theme, color) {
94
+ @include color($theme);
95
+ }
96
+ @if inspection.theme-has($theme, density) {
87
97
  @include density($theme);
98
+ }
99
+ @if inspection.theme-has($theme, typography) {
88
100
  @include typography($theme);
89
- } @else {
90
- @include base($theme);
91
- @if inspection.theme-has($theme, color) {
92
- @include color($theme);
93
- }
94
- @if inspection.theme-has($theme, density) {
95
- @include density($theme);
96
- }
97
- @if inspection.theme-has($theme, typography) {
98
- @include typography($theme);
99
- }
100
101
  }
101
102
  }
102
103
  }
@@ -2,28 +2,16 @@
2
2
  @use '../tokens/m2-utils';
3
3
  @use '../tokens/m3-utils';
4
4
 
5
- // Tokens that can't be configured through Angular Material's current theming API,
6
- // but may be in a future version of the theming API.
7
- @function get-unthemable-tokens() {
8
- @return ();
9
- }
10
-
11
- // Tokens that can be configured through Angular Material's color theming API.
12
- @function get-color-tokens($theme) {
5
+ @function get-tokens($theme) {
13
6
  $system: m2-utils.get-system($theme);
14
7
 
15
8
  @return (
16
- ripple-color: m3-utils.color-with-opacity(
17
- map.get($system, on-surface), map.get($system, pressed-state-layer-opacity)),
9
+ base: (),
10
+ color: (
11
+ ripple-color: m3-utils.color-with-opacity(
12
+ map.get($system, on-surface), map.get($system, pressed-state-layer-opacity)),
13
+ ),
14
+ typography: (),
15
+ density: (),
18
16
  );
19
17
  }
20
-
21
- // Tokens that can be configured through Angular Material's typography theming API.
22
- @function get-typography-tokens($theme) {
23
- @return ();
24
- }
25
-
26
- // Tokens that can be configured through Angular Material's density theming API.
27
- @function get-density-tokens($theme) {
28
- @return ();
29
- }
@@ -2,45 +2,42 @@
2
2
  @use './m2-ripple';
3
3
  @use './m3-ripple';
4
4
  @use '../tokens/token-utils';
5
- @use '../style/sass-utils';
6
- @use '../theming/theming';
7
5
  @use '../theming/inspection';
8
6
 
9
7
  @mixin base($theme) {
8
+ $tokens: map.get(m2-ripple.get-tokens($theme), base);
10
9
  @if inspection.get-theme-version($theme) == 1 {
11
- @include token-utils.create-token-values(map.get(m3-ripple.get-tokens($theme), base));
12
- } @else {
10
+ $tokens: map.get(m3-ripple.get-tokens($theme), base);
13
11
  }
12
+
13
+ @include token-utils.values($tokens);
14
14
  }
15
15
 
16
16
  @mixin color($theme) {
17
+ $tokens: map.get(m2-ripple.get-tokens($theme), color);
17
18
  @if inspection.get-theme-version($theme) == 1 {
18
- @include token-utils.create-token-values(map.get(m3-ripple.get-tokens($theme), color));
19
- } @else {
20
- @include sass-utils.current-selector-or-root() {
21
- @include token-utils.create-token-values-mixed(m2-ripple.get-color-tokens($theme));
22
- }
19
+ $tokens: map.get(m3-ripple.get-tokens($theme), color);
23
20
  }
21
+
22
+ @include token-utils.values($tokens);
24
23
  }
25
24
 
26
25
  @mixin typography($theme) {
26
+ $tokens: map.get(m2-ripple.get-tokens($theme), typography);
27
27
  @if inspection.get-theme-version($theme) == 1 {
28
- @include token-utils.create-token-values(map.get(m3-ripple.get-tokens($theme), typography));
29
- } @else {
30
- @include sass-utils.current-selector-or-root() {
31
- @include token-utils.create-token-values-mixed(m2-ripple.get-typography-tokens($theme));
32
- }
28
+ $tokens: map.get(m3-ripple.get-tokens($theme), typography);
33
29
  }
30
+
31
+ @include token-utils.values($tokens);
34
32
  }
35
33
 
36
34
  @mixin density($theme) {
35
+ $tokens: map.get(m2-ripple.get-tokens($theme), density);
37
36
  @if inspection.get-theme-version($theme) == 1 {
38
- @include token-utils.create-token-values(map.get(m3-ripple.get-tokens($theme), density));
39
- } @else {
40
- @include sass-utils.current-selector-or-root() {
41
- @include token-utils.create-token-values-mixed(m2-ripple.get-density-tokens($theme));
42
- }
37
+ $tokens: map.get(m3-ripple.get-tokens($theme), density);
43
38
  }
39
+
40
+ @include token-utils.values($tokens);
44
41
  }
45
42
 
46
43
  /// Defines the tokens that will be available in the `overrides` mixin and for docs extraction.
@@ -58,23 +55,21 @@
58
55
  }
59
56
 
60
57
  @mixin theme($theme) {
61
- @include theming.private-check-duplicate-theme-styles($theme, 'mat-ripple') {
62
- @if inspection.get-theme-version($theme) == 1 {
63
- @include base($theme);
58
+ @if inspection.get-theme-version($theme) == 1 {
59
+ @include base($theme);
60
+ @include color($theme);
61
+ @include density($theme);
62
+ @include typography($theme);
63
+ } @else {
64
+ @include base($theme);
65
+ @if inspection.theme-has($theme, color) {
64
66
  @include color($theme);
67
+ }
68
+ @if inspection.theme-has($theme, density) {
65
69
  @include density($theme);
70
+ }
71
+ @if inspection.theme-has($theme, typography) {
66
72
  @include typography($theme);
67
- } @else {
68
- @include base($theme);
69
- @if inspection.theme-has($theme, color) {
70
- @include color($theme);
71
- }
72
- @if inspection.theme-has($theme, density) {
73
- @include density($theme);
74
- }
75
- @if inspection.theme-has($theme, typography) {
76
- @include typography($theme);
77
- }
78
73
  }
79
74
  }
80
75
  }
@@ -1,18 +1,18 @@
1
- @use '../../theming/inspection';
2
1
  @use 'sass:map';
3
2
  @use '../../tokens/m2-utils';
4
3
  @use '../../tokens/m3-utils';
5
4
 
6
- // Tokens that can't be configured through Angular Material's current theming API,
7
- // but may be in a future version of the theming API.
8
- @function get-unthemable-tokens() {
9
- @return ();
5
+ @function get-tokens($theme) {
6
+ @return (
7
+ base: (),
8
+ color: private-get-color-palette-color-tokens($theme, secondary),
9
+ typography: (),
10
+ density: (),
11
+ );
10
12
  }
11
13
 
12
14
  // Tokens that can be configured through Angular Material's color theming API.
13
- @function get-color-tokens($theme, $color-variant) {
14
- $is-dark: inspection.get-theme-type($theme) == dark;
15
- $disabled-color: if($is-dark, #686868, #b0b0b0);
15
+ @function private-get-color-palette-color-tokens($theme, $color-variant) {
16
16
  $system: m2-utils.get-system($theme);
17
17
  $system: m3-utils.replace-colors-with-variant($system, secondary, $color-variant);
18
18
 
@@ -21,19 +21,12 @@
21
21
  pseudo-checkbox-full-selected-checkmark-color: map.get($system, background),
22
22
  pseudo-checkbox-full-unselected-icon-color: map.get($system, on-surface-variant),
23
23
  pseudo-checkbox-full-disabled-selected-checkmark-color: map.get($system, background),
24
- pseudo-checkbox-full-disabled-unselected-icon-color: $disabled-color,
25
- pseudo-checkbox-full-disabled-selected-icon-color: $disabled-color,
24
+ pseudo-checkbox-full-disabled-unselected-icon-color:
25
+ m3-utils.color-with-opacity(map.get($system, on-surface), 38%),
26
+ pseudo-checkbox-full-disabled-selected-icon-color:
27
+ m3-utils.color-with-opacity(map.get($system, on-surface), 38%),
26
28
  pseudo-checkbox-minimal-selected-checkmark-color: map.get($system, secondary),
27
- pseudo-checkbox-minimal-disabled-selected-checkmark-color: if($is-dark, #686868, #b0b0b0),
29
+ pseudo-checkbox-minimal-disabled-selected-checkmark-color:
30
+ m3-utils.color-with-opacity(map.get($system, on-surface), 38%),
28
31
  );
29
32
  }
30
-
31
- // Tokens that can be configured through Angular Material's typography theming API.
32
- @function get-typography-tokens($theme) {
33
- @return ();
34
- }
35
-
36
- // Tokens that can be configured through Angular Material's density theming API.
37
- @function get-density-tokens($theme) {
38
- @return ();
39
- }