@angular/material 20.1.0-next.0 → 20.1.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (243) hide show
  1. package/_index.scss +1 -2
  2. package/autocomplete/_autocomplete-theme.scss +28 -37
  3. package/autocomplete/_m2-autocomplete.scss +5 -2
  4. package/badge/_badge-theme.scss +35 -44
  5. package/badge/_m2-badge.scss +3 -2
  6. package/bottom-sheet/_bottom-sheet-theme.scss +28 -40
  7. package/bottom-sheet/_m2-bottom-sheet.scss +12 -11
  8. package/button/_button-theme.scss +37 -55
  9. package/button/_fab-theme.scss +42 -56
  10. package/button/_icon-button-theme.scss +30 -48
  11. package/button/_m2-button.scss +60 -59
  12. package/button/_m2-fab.scss +19 -15
  13. package/button/_m2-icon-button.scss +7 -5
  14. package/button/testing/index.d.ts +1 -0
  15. package/button-toggle/_button-toggle-theme.scss +29 -44
  16. package/button-toggle/_m2-button-toggle.scss +11 -17
  17. package/card/_card-theme.scss +28 -36
  18. package/card/_m2-card.scss +12 -14
  19. package/checkbox/_checkbox-theme.scss +35 -50
  20. package/checkbox/_m2-checkbox.scss +8 -8
  21. package/chips/_chips-theme.scss +24 -30
  22. package/chips/_m2-chip.scss +12 -28
  23. package/core/_core-theme.scss +48 -67
  24. package/core/focus-indicators/_private.scss +2 -5
  25. package/core/m2/_theming.scss +68 -113
  26. package/core/option/_m2-optgroup.scss +10 -7
  27. package/core/option/_m2-option.scss +13 -11
  28. package/core/option/_optgroup-theme.scss +28 -30
  29. package/core/option/_option-theme.scss +35 -34
  30. package/core/ripple/_m2-ripple.scss +6 -10
  31. package/core/ripple/_ripple-theme.scss +28 -33
  32. package/core/selection/pseudo-checkbox/_m2-pseudo-checkbox.scss +2 -3
  33. package/core/selection/pseudo-checkbox/_pseudo-checkbox-theme.scss +55 -45
  34. package/core/theming/_all-theme.scss +38 -42
  35. package/core/theming/_definition.scss +20 -13
  36. package/core/theming/_inspection.scss +0 -12
  37. package/core/theming/_m2-inspection.scss +0 -33
  38. package/core/theming/_theming.scss +4 -172
  39. package/core/tokens/_m2-utils.scss +5 -75
  40. package/core/tokens/_m3-system.scss +11 -9
  41. package/core/tokens/_m3-utils.scss +2 -14
  42. package/core/tokens/_token-utils.scss +7 -27
  43. package/core/tokens/m2/_index.scss +6 -0
  44. package/core/tokens/m2/_md-sys-color.scss +123 -0
  45. package/core/tokens/m2/_md-sys-elevation.scss +16 -0
  46. package/core/tokens/m2/_md-sys-motion.scss +36 -0
  47. package/core/tokens/m2/_md-sys-shape.scss +22 -0
  48. package/core/tokens/m2/_md-sys-state.scss +15 -0
  49. package/core/tokens/m2/_md-sys-typescale.scss +68 -0
  50. package/core/tokens/m3/_md-sys-color.scss +2 -2
  51. package/core/tokens/m3/_md-sys-typescale.scss +1 -1
  52. package/core/tokens/m3/_theme.scss +14 -26
  53. package/datepicker/_datepicker-theme.scss +47 -87
  54. package/datepicker/_m2-datepicker.scss +33 -123
  55. package/datepicker/index.d.ts +1 -1
  56. package/dialog/_dialog-theme.scss +28 -34
  57. package/dialog/_m2-dialog.scss +17 -17
  58. package/divider/_divider-theme.scss +28 -30
  59. package/divider/_m2-divider.scss +4 -2
  60. package/expansion/_expansion-theme.scss +28 -39
  61. package/expansion/_m2-expansion.scss +11 -10
  62. package/expansion/_m3-expansion.scss +2 -0
  63. package/fesm2022/animation-DfMFjxHu.mjs.map +1 -1
  64. package/fesm2022/autocomplete/testing.mjs.map +1 -1
  65. package/fesm2022/autocomplete.mjs +1 -1
  66. package/fesm2022/autocomplete.mjs.map +1 -1
  67. package/fesm2022/badge/testing.mjs.map +1 -1
  68. package/fesm2022/badge.mjs.map +1 -1
  69. package/fesm2022/bottom-sheet/testing.mjs.map +1 -1
  70. package/fesm2022/bottom-sheet.mjs.map +1 -1
  71. package/fesm2022/button/testing.mjs +7 -4
  72. package/fesm2022/button/testing.mjs.map +1 -1
  73. package/fesm2022/button-toggle/testing.mjs.map +1 -1
  74. package/fesm2022/button-toggle.mjs.map +1 -1
  75. package/fesm2022/button.mjs +2 -2
  76. package/fesm2022/button.mjs.map +1 -1
  77. package/fesm2022/card/testing.mjs.map +1 -1
  78. package/fesm2022/card.mjs.map +1 -1
  79. package/fesm2022/checkbox/testing.mjs.map +1 -1
  80. package/fesm2022/checkbox.mjs.map +1 -1
  81. package/fesm2022/chips/testing.mjs.map +1 -1
  82. package/fesm2022/chips.mjs +1 -1
  83. package/fesm2022/chips.mjs.map +1 -1
  84. package/fesm2022/common-module-cKSwHniA.mjs.map +1 -1
  85. package/fesm2022/core/testing.mjs.map +1 -1
  86. package/fesm2022/core.mjs +1 -1
  87. package/fesm2022/core.mjs.map +1 -1
  88. package/fesm2022/date-formats-K6TQue-Y.mjs.map +1 -1
  89. package/fesm2022/date-range-input-harness-DEyfkeOs.mjs.map +1 -1
  90. package/fesm2022/datepicker/testing.mjs.map +1 -1
  91. package/fesm2022/datepicker.mjs +1 -1
  92. package/fesm2022/datepicker.mjs.map +1 -1
  93. package/fesm2022/dialog/testing.mjs.map +1 -1
  94. package/fesm2022/dialog.mjs.map +1 -1
  95. package/fesm2022/divider/testing.mjs.map +1 -1
  96. package/fesm2022/divider.mjs.map +1 -1
  97. package/fesm2022/error-options-DCNQlTOA.mjs.map +1 -1
  98. package/fesm2022/error-state-Dtb1IHM-.mjs.map +1 -1
  99. package/fesm2022/expansion/testing.mjs.map +1 -1
  100. package/fesm2022/expansion.mjs +2 -2
  101. package/fesm2022/expansion.mjs.map +1 -1
  102. package/fesm2022/form-field/testing/control.mjs.map +1 -1
  103. package/fesm2022/form-field/testing.mjs.map +1 -1
  104. package/fesm2022/{form-field-C9DZXojn.mjs → form-field-CFbrnFED.mjs} +3 -3
  105. package/fesm2022/form-field-CFbrnFED.mjs.map +1 -0
  106. package/fesm2022/form-field.mjs +2 -2
  107. package/fesm2022/form-field.mjs.map +1 -1
  108. package/fesm2022/grid-list/testing.mjs.map +1 -1
  109. package/fesm2022/grid-list.mjs.map +1 -1
  110. package/fesm2022/icon/testing.mjs.map +1 -1
  111. package/fesm2022/icon-button-DxiIc1ex.mjs.map +1 -1
  112. package/fesm2022/icon-registry-CwOTJ7YM.mjs.map +1 -1
  113. package/fesm2022/icon.mjs.map +1 -1
  114. package/fesm2022/index-BFRo2fUq.mjs.map +1 -1
  115. package/fesm2022/index-DwiL-HGk.mjs.map +1 -1
  116. package/fesm2022/input/testing.mjs.map +1 -1
  117. package/fesm2022/input-harness-C5Msdc4-.mjs.map +1 -1
  118. package/fesm2022/input-value-accessor-D1GvPuqO.mjs.map +1 -1
  119. package/fesm2022/input.mjs +3 -27
  120. package/fesm2022/input.mjs.map +1 -1
  121. package/fesm2022/internal-form-field-D5iFxU6d.mjs.map +1 -1
  122. package/fesm2022/line-Bz5f9Cyx.mjs.map +1 -1
  123. package/fesm2022/list/testing.mjs.map +1 -1
  124. package/fesm2022/list.mjs.map +1 -1
  125. package/fesm2022/material.mjs.map +1 -1
  126. package/fesm2022/menu/testing.mjs +97 -13
  127. package/fesm2022/menu/testing.mjs.map +1 -1
  128. package/fesm2022/menu.mjs +343 -122
  129. package/fesm2022/menu.mjs.map +1 -1
  130. package/fesm2022/{module-BDiw_nWS.mjs → module-B0CLRw5e.mjs} +3 -3
  131. package/fesm2022/module-B0CLRw5e.mjs.map +1 -0
  132. package/fesm2022/{module-DzZHEh7B.mjs → module-B62K-792.mjs} +2 -2
  133. package/fesm2022/module-B62K-792.mjs.map +1 -0
  134. package/fesm2022/module-CWxMD37a.mjs.map +1 -1
  135. package/fesm2022/module-Ce6F7TNm.mjs.map +1 -1
  136. package/fesm2022/option-BzhYL_xC.mjs.map +1 -1
  137. package/fesm2022/option-harness-BFcc-M_4.mjs.map +1 -1
  138. package/fesm2022/paginator/testing.mjs.map +1 -1
  139. package/fesm2022/paginator.mjs +3 -3
  140. package/fesm2022/paginator.mjs.map +1 -1
  141. package/fesm2022/progress-bar/testing.mjs.map +1 -1
  142. package/fesm2022/progress-bar.mjs.map +1 -1
  143. package/fesm2022/progress-spinner/testing.mjs.map +1 -1
  144. package/fesm2022/progress-spinner.mjs.map +1 -1
  145. package/fesm2022/pseudo-checkbox-DDmgx3P4.mjs.map +1 -1
  146. package/fesm2022/pseudo-checkbox-module-4F8Up4PL.mjs.map +1 -1
  147. package/fesm2022/public-api-BoO5eSq-.mjs.map +1 -1
  148. package/fesm2022/radio/testing.mjs.map +1 -1
  149. package/fesm2022/radio.mjs.map +1 -1
  150. package/fesm2022/ripple-BYgV4oZC.mjs.map +1 -1
  151. package/fesm2022/ripple-loader-BnMiRtmT.mjs.map +1 -1
  152. package/fesm2022/select/testing.mjs.map +1 -1
  153. package/fesm2022/select.mjs +3 -3
  154. package/fesm2022/select.mjs.map +1 -1
  155. package/fesm2022/sidenav/testing.mjs.map +1 -1
  156. package/fesm2022/sidenav.mjs.map +1 -1
  157. package/fesm2022/slide-toggle/testing.mjs.map +1 -1
  158. package/fesm2022/slide-toggle.mjs +2 -2
  159. package/fesm2022/slide-toggle.mjs.map +1 -1
  160. package/fesm2022/slider/testing.mjs.map +1 -1
  161. package/fesm2022/slider.mjs +2 -2
  162. package/fesm2022/slider.mjs.map +1 -1
  163. package/fesm2022/snack-bar/testing.mjs.map +1 -1
  164. package/fesm2022/snack-bar.mjs +2 -2
  165. package/fesm2022/snack-bar.mjs.map +1 -1
  166. package/fesm2022/sort/testing.mjs.map +1 -1
  167. package/fesm2022/sort.mjs.map +1 -1
  168. package/fesm2022/stepper/testing.mjs.map +1 -1
  169. package/fesm2022/stepper.mjs.map +1 -1
  170. package/fesm2022/structural-styles-CObeNzjn.mjs.map +1 -1
  171. package/fesm2022/table/testing.mjs.map +1 -1
  172. package/fesm2022/table.mjs.map +1 -1
  173. package/fesm2022/tabs/testing.mjs.map +1 -1
  174. package/fesm2022/tabs.mjs.map +1 -1
  175. package/fesm2022/timepicker/testing.mjs.map +1 -1
  176. package/fesm2022/timepicker.mjs +1 -1
  177. package/fesm2022/timepicker.mjs.map +1 -1
  178. package/fesm2022/toolbar/testing.mjs.map +1 -1
  179. package/fesm2022/toolbar.mjs.map +1 -1
  180. package/fesm2022/tooltip/testing.mjs.map +1 -1
  181. package/fesm2022/tooltip.mjs.map +1 -1
  182. package/fesm2022/tree/testing.mjs.map +1 -1
  183. package/fesm2022/tree.mjs.map +1 -1
  184. package/form-field/_form-field-theme.scss +35 -51
  185. package/form-field/_m2-form-field.scss +23 -31
  186. package/grid-list/_grid-list-theme.scss +28 -28
  187. package/grid-list/_m2-grid-list.scss +7 -9
  188. package/icon/_icon-theme.scss +40 -41
  189. package/input/_input-theme.scss +1 -4
  190. package/input/index.d.ts +0 -11
  191. package/list/_list-theme.scss +55 -53
  192. package/list/_m2-list.scss +21 -35
  193. package/menu/_m2-menu.scss +18 -15
  194. package/menu/_menu-theme.scss +28 -33
  195. package/menu/index.d.ts +145 -61
  196. package/menu/testing/index.d.ts +50 -2
  197. package/package.json +2 -2
  198. package/paginator/_m2-paginator.scss +9 -9
  199. package/paginator/_paginator-theme.scss +28 -33
  200. package/prebuilt-themes/azure-blue.css +1 -1
  201. package/prebuilt-themes/cyan-orange.css +1 -1
  202. package/prebuilt-themes/deeppurple-amber.css +1 -1
  203. package/prebuilt-themes/indigo-pink.css +1 -1
  204. package/prebuilt-themes/magenta-violet.css +1 -1
  205. package/prebuilt-themes/pink-bluegrey.css +1 -1
  206. package/prebuilt-themes/purple-green.css +1 -1
  207. package/prebuilt-themes/rose-red.css +1 -1
  208. package/progress-bar/_progress-bar-theme.scss +35 -43
  209. package/progress-spinner/_progress-spinner-theme.scss +42 -43
  210. package/radio/_m2-radio.scss +6 -5
  211. package/radio/_m3-radio.scss +1 -1
  212. package/radio/_radio-theme.scss +33 -46
  213. package/schematics/ng-add/index.js +1 -1
  214. package/select/_m2-select.scss +10 -8
  215. package/select/_select-theme.scss +38 -48
  216. package/sidenav/_sidenav-theme.scss +28 -30
  217. package/slide-toggle/_m2-slide-toggle.scss +45 -58
  218. package/slide-toggle/_m3-slide-toggle.scss +1 -0
  219. package/slide-toggle/_slide-toggle-theme.scss +41 -79
  220. package/slider/_m2-slider.scss +33 -35
  221. package/slider/_slider-theme.scss +38 -45
  222. package/snack-bar/_m2-snack-bar.scss +5 -6
  223. package/snack-bar/_snack-bar-theme.scss +28 -31
  224. package/sort/_m2-sort.scss +5 -2
  225. package/sort/_sort-theme.scss +28 -33
  226. package/stepper/_m2-stepper.scss +10 -13
  227. package/stepper/_stepper-theme.scss +41 -49
  228. package/table/_m2-table.scss +23 -28
  229. package/table/_table-theme.scss +28 -36
  230. package/tabs/_m2-tabs.scss +11 -16
  231. package/tabs/_tabs-theme.scss +35 -43
  232. package/timepicker/_m2-timepicker.scss +5 -2
  233. package/timepicker/_timepicker-theme.scss +28 -46
  234. package/toolbar/_m2-toolbar.scss +10 -9
  235. package/toolbar/_toolbar-theme.scss +55 -46
  236. package/tooltip/_m2-tooltip.scss +5 -6
  237. package/tooltip/_tooltip-theme.scss +28 -37
  238. package/tree/_m2-tree.scss +9 -5
  239. package/tree/_tree-theme.scss +28 -38
  240. package/core/tokens/_format-tokens.scss +0 -5
  241. package/fesm2022/form-field-C9DZXojn.mjs.map +0 -1
  242. package/fesm2022/module-BDiw_nWS.mjs.map +0 -1
  243. package/fesm2022/module-DzZHEh7B.mjs.map +0 -1
@@ -1,8 +1,5 @@
1
1
  @use 'sass:map';
2
- @use 'sass:meta';
3
- @use 'sass:color';
4
2
  @use '../core/theming/inspection';
5
- @use '../core/m2/palette' as m2-palette;
6
3
  @use '../core/theming/theming';
7
4
  @use '../core/tokens/m2-utils';
8
5
  @use '../core/tokens/m3-utils';
@@ -40,38 +37,24 @@
40
37
  // Tokens that can be configured through Angular Material's color theming API.
41
38
  @function get-color-tokens($theme, $color-variant: null) {
42
39
  $system: m2-utils.get-system($theme);
43
- $foreground: null;
44
- $background: null;
45
- $state-layer-color: inspection.get-theme-color($theme, foreground, base);
40
+ $background: m3-utils.color-with-opacity(map.get($system, on-surface), 12%);
41
+ $foreground: map.get($system, on-surface);
46
42
 
47
- @if $color-variant == null {
48
- $is-dark: inspection.get-theme-type($theme) == dark;
49
- $grey-50: map.get(m2-palette.$grey-palette, 50);
50
- $grey-900: map.get(m2-palette.$grey-palette, 900);
51
- $foreground: if($is-dark, $grey-50, $grey-900);
52
-
53
- $surface: map.get($system, surface);
54
- $background: if(
55
- meta.type-of($state-layer-color) == color and meta.type-of($surface) == color,
56
- color.mix($state-layer-color, $surface, 12%),
57
- $state-layer-color
58
- );
59
- }
60
- @else {
43
+ @if $color-variant {
61
44
  $system: m3-utils.replace-colors-with-variant($system, primary, $color-variant);
62
-
63
45
  $background: map.get($system, primary);
64
46
  $foreground: map.get($system, on-primary);
65
47
  }
48
+
66
49
  @return (
67
50
  chip-disabled-label-text-color: $foreground,
68
51
  chip-elevated-container-color: $background,
69
52
  chip-elevated-disabled-container-color: $background,
70
53
  chip-elevated-selected-container-color: $background,
71
54
  chip-flat-disabled-selected-container-color: $background,
72
- chip-focus-state-layer-color: $state-layer-color,
55
+ chip-focus-state-layer-color: map.get($system, on-surface),
73
56
  chip-focus-state-layer-opacity: map.get($system, focus-state-layer-opacity),
74
- chip-hover-state-layer-color: $state-layer-color,
57
+ chip-hover-state-layer-color: map.get($system, on-surface),
75
58
  chip-label-text-color: $foreground,
76
59
  chip-selected-disabled-trailing-icon-color: $foreground,
77
60
  chip-selected-focus-state-layer-color: map.get($system, focus-state-layer-opacity),
@@ -89,12 +72,13 @@
89
72
 
90
73
  // Tokens that can be configured through Angular Material's typography theming API.
91
74
  @function get-typography-tokens($theme) {
75
+ $system: m2-utils.get-system($theme);
92
76
  @return (
93
- chip-label-text-font: inspection.get-theme-typography($theme, body-2, font-family),
94
- chip-label-text-line-height: inspection.get-theme-typography($theme, body-2, line-height),
95
- chip-label-text-size: inspection.get-theme-typography($theme, body-2, font-size),
96
- chip-label-text-tracking: inspection.get-theme-typography($theme, body-2, letter-spacing),
97
- chip-label-text-weight: inspection.get-theme-typography($theme, body-2, font-weight)
77
+ chip-label-text-font: map.get($system, body-medium-font),
78
+ chip-label-text-line-height: map.get($system, body-medium-line-height),
79
+ chip-label-text-size: map.get($system, body-medium-size),
80
+ chip-label-text-tracking: map.get($system, body-medium-tracking),
81
+ chip-label-text-weight: map.get($system, body-medium-weight)
98
82
  );
99
83
  }
100
84
 
@@ -1,10 +1,8 @@
1
- @use './theming/theming';
2
1
  @use './theming/inspection';
3
2
  @use './ripple/ripple-theme';
4
3
  @use './option/option-theme';
5
4
  @use './option/optgroup-theme';
6
5
  @use './selection/pseudo-checkbox/pseudo-checkbox-theme';
7
- @use './style/sass-utils';
8
6
  @use './typography/typography';
9
7
  @use './tokens/token-utils';
10
8
  @use './m2-app';
@@ -16,71 +14,59 @@
16
14
  @use 'sass:map';
17
15
 
18
16
  @mixin base($theme) {
17
+ $tokens: m2-app.get-unthemable-tokens();
19
18
  @if inspection.get-theme-version($theme) == 1 {
20
- @include token-utils.create-token-values(map.get(m3-app.get-tokens($theme), base));
21
- @include token-utils.create-token-values(map.get(m3-ripple.get-tokens($theme), base));
22
- @include token-utils.create-token-values(map.get(m3-option.get-tokens($theme), base));
23
- @include token-utils.create-token-values(map.get(m3-optgroup.get-tokens($theme), base));
24
- @include token-utils.create-token-values(map.get(m3-pseudo-checkbox.get-tokens($theme), base));
25
- } @else {
26
- @include ripple-theme.base($theme);
27
- @include option-theme.base($theme);
28
- @include optgroup-theme.base($theme);
29
- @include pseudo-checkbox-theme.base($theme);
30
- @include sass-utils.current-selector-or-root() {
31
- @include token-utils.create-token-values-mixed(m2-app.get-unthemable-tokens());
32
- }
19
+ $tokens: map.get(m3-app.get-tokens($theme), base);
33
20
  }
21
+
22
+ @include token-utils.values($tokens);
23
+
24
+ @include ripple-theme.base($theme);
25
+ @include option-theme.base($theme);
26
+ @include optgroup-theme.base($theme);
27
+ @include pseudo-checkbox-theme.base($theme);
34
28
  }
35
29
 
36
30
  @mixin color($theme) {
31
+ $tokens: m2-app.get-color-tokens($theme);
37
32
  @if inspection.get-theme-version($theme) == 1 {
38
- @include token-utils.create-token-values(map.get(m3-app.get-tokens($theme), color));
39
- @include token-utils.create-token-values(map.get(m3-ripple.get-tokens($theme), color));
40
- @include token-utils.create-token-values(map.get(m3-option.get-tokens($theme), color));
41
- @include token-utils.create-token-values(map.get(m3-optgroup.get-tokens($theme), color));
42
- @include token-utils.create-token-values(map.get(m3-pseudo-checkbox.get-tokens($theme), color));
43
- } @else {
44
- @include ripple-theme.color($theme);
45
- @include option-theme.color($theme);
46
- @include optgroup-theme.color($theme);
47
- @include pseudo-checkbox-theme.color($theme);
48
- @include sass-utils.current-selector-or-root() {
49
- @include token-utils.create-token-values-mixed(m2-app.get-color-tokens($theme));
50
- }
33
+ $tokens: map.get(m3-app.get-tokens($theme), color);
51
34
  }
35
+
36
+ @include token-utils.values($tokens);
37
+
38
+ @include ripple-theme.color($theme);
39
+ @include option-theme.color($theme);
40
+ @include optgroup-theme.color($theme);
41
+ @include pseudo-checkbox-theme.color($theme);
52
42
  }
53
43
 
54
44
  @mixin typography($theme) {
45
+ $tokens: m2-app.get-typography-tokens($theme);
55
46
  @if inspection.get-theme-version($theme) == 1 {
56
- @include token-utils.create-token-values(map.get(m3-app.get-tokens($theme), typography));
57
- @include token-utils.create-token-values(map.get(m3-ripple.get-tokens($theme), typography));
58
- @include token-utils.create-token-values(map.get(m3-option.get-tokens($theme), typography));
59
- @include token-utils.create-token-values(map.get(m3-optgroup.get-tokens($theme), typography));
60
- @include token-utils.create-token-values(
61
- map.get(m3-pseudo-checkbox.get-tokens($theme), typography));
62
- } @else {
63
- @include option-theme.typography($theme);
64
- @include optgroup-theme.typography($theme);
65
- @include pseudo-checkbox-theme.typography($theme);
66
- @include ripple-theme.typography($theme);
47
+ $tokens: map.get(m3-app.get-tokens($theme), typography);
67
48
  }
49
+
50
+ @include token-utils.values($tokens);
51
+
52
+ @include ripple-theme.typography($theme);
53
+ @include option-theme.typography($theme);
54
+ @include optgroup-theme.typography($theme);
55
+ @include pseudo-checkbox-theme.typography($theme);
68
56
  }
69
57
 
70
58
  @mixin density($theme) {
59
+ $tokens: m2-app.get-density-tokens($theme);
71
60
  @if inspection.get-theme-version($theme) == 1 {
72
- @include token-utils.create-token-values(map.get(m3-app.get-tokens($theme), density));
73
- @include token-utils.create-token-values(map.get(m3-ripple.get-tokens($theme), density));
74
- @include token-utils.create-token-values(map.get(m3-option.get-tokens($theme), density));
75
- @include token-utils.create-token-values(map.get(m3-optgroup.get-tokens($theme), density));
76
- @include token-utils.create-token-values(
77
- map.get(m3-pseudo-checkbox.get-tokens($theme), density));
78
- } @else {
79
- @include option-theme.density($theme);
80
- @include optgroup-theme.density($theme);
81
- @include pseudo-checkbox-theme.density($theme);
82
- @include ripple-theme.density($theme);
61
+ $tokens: map.get(m3-app.get-tokens($theme), density);
83
62
  }
63
+
64
+ @include token-utils.values($tokens);
65
+
66
+ @include ripple-theme.density($theme);
67
+ @include option-theme.density($theme);
68
+ @include optgroup-theme.density($theme);
69
+ @include pseudo-checkbox-theme.density($theme);
84
70
  }
85
71
 
86
72
  @function _define-overrides() {
@@ -119,26 +105,21 @@
119
105
 
120
106
  // Mixin that renders all of the core styles that depend on the theme.
121
107
  @mixin theme($theme) {
122
- // Wrap the sub-theme includes in the duplicate theme styles mixin. This ensures that
123
- // there won't be multiple warnings. e.g. if `mat-core-theme` reports a warning, then
124
- // the imported themes (such as `mat-ripple-theme`) should not report again.
125
- @include theming.private-check-duplicate-theme-styles($theme, 'mat-core') {
126
- @if inspection.get-theme-version($theme) == 1 {
127
- @include base($theme);
108
+ @if inspection.get-theme-version($theme) == 1 {
109
+ @include base($theme);
110
+ @include color($theme);
111
+ @include density($theme);
112
+ @include typography($theme);
113
+ } @else {
114
+ @include base($theme);
115
+ @if inspection.theme-has($theme, color) {
128
116
  @include color($theme);
117
+ }
118
+ @if inspection.theme-has($theme, density) {
129
119
  @include density($theme);
120
+ }
121
+ @if inspection.theme-has($theme, typography) {
130
122
  @include typography($theme);
131
- } @else {
132
- @include base($theme);
133
- @if inspection.theme-has($theme, color) {
134
- @include color($theme);
135
- }
136
- @if inspection.theme-has($theme, density) {
137
- @include density($theme);
138
- }
139
- @if inspection.theme-has($theme, typography) {
140
- @include typography($theme);
141
- }
142
123
  }
143
124
  }
144
125
  }
@@ -2,7 +2,6 @@
2
2
  @use 'sass:meta';
3
3
  @use '@angular/cdk';
4
4
  @use '../style/layout-common';
5
- @use '../theming/theming';
6
5
  @use '../theming/inspection';
7
6
 
8
7
  // Private sass variables that will be used as reference throughout component stylesheets.
@@ -104,10 +103,8 @@ $default-border-radius: 4px;
104
103
  @include _customize-focus-indicators((border-color: $theme-or-color));
105
104
  }
106
105
  @else {
107
- @include theming.private-check-duplicate-theme-styles($theme-or-color, 'mat-focus-indicators') {
108
- @if inspection.theme-has($theme-or-color, color) {
109
- @include strong-focus-indicators-color($theme-or-color);
110
- }
106
+ @if inspection.theme-has($theme-or-color, color) {
107
+ @include strong-focus-indicators-color($theme-or-color);
111
108
  }
112
109
  }
113
110
  }
@@ -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,83 +114,52 @@
113
114
  @return $theme;
114
115
  }
115
116
 
116
- // Creates a light-themed color configuration from the specified
117
- // primary, accent and warn palettes.
118
- @function _mat-create-light-color-config($primary, $accent, $warn: null) {
119
- $warn: if($warn != null, $warn, define-palette(palette.$red-palette));
120
- @return (
117
+ @function _define-system($primary, $accent, $warn, $is-dark, $typography) {
118
+ $palettes: (
121
119
  primary: $primary,
122
120
  accent: $accent,
123
121
  warn: $warn,
124
- is-dark: false,
125
- foreground: palette.$light-theme-foreground-palette,
126
- background: palette.$light-theme-background-palette,
127
- system: (
128
- surface: white,
129
- surface-variant: #f6f6f6,
130
- on-surface: rgba(black, 0.87),
131
- on-surface-variant: rgba(black, 0.54),
132
- background: map.get(palette.$grey-palette, 50),
133
- inverse-surface: map.get(palette.$grey-palette, 800),
134
- inverse-on-surface: white,
135
- outline: rgba(black, 0.12),
136
- outline-variant: rgba(black, 0.38),
137
- hover-state-layer-opacity: 0.04,
138
- focus-state-layer-opacity: 0.12,
139
- pressed-state-layer-opacity: 0.12,
140
- shadow: black,
141
- primary: map.get($primary, default),
142
- on-primary: map.get($primary, default-contrast),
143
- secondary: map.get($accent, default),
144
- on-secondary: map.get($accent, default-contrast),
145
- error: map.get($warn, default),
146
- on-error: map.get($warn, default-contrast),
147
- ),
148
122
  );
123
+
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: ();
132
+ @each $map in ($sys-color, $sys-state, $sys-typography) {
133
+ $system: map.merge($system, $map);
134
+ }
135
+
136
+ @return $system;
149
137
  }
150
138
 
151
- // Creates a dark-themed color configuration from the specified
139
+ // Creates a color configuration from the specified
152
140
  // primary, accent and warn palettes.
153
- @function _mat-create-dark-color-config($primary, $accent, $warn: null) {
141
+ @function _mat-create-color-config($primary, $accent, $warn: null, $is-dark) {
154
142
  $warn: if($warn != null, $warn, define-palette(palette.$red-palette));
143
+ $foreground:
144
+ if($is-dark, palette.$dark-theme-foreground-palette, palette.$light-theme-foreground-palette);
145
+ $background:
146
+ if($is-dark, palette.$dark-theme-background-palette, palette.$light-theme-background-palette);
147
+
155
148
  @return (
156
149
  primary: $primary,
157
150
  accent: $accent,
158
151
  warn: $warn,
159
- is-dark: true,
160
- foreground: palette.$dark-theme-foreground-palette,
161
- background: palette.$dark-theme-background-palette,
162
- system: (
163
- surface: map.get(palette.$grey-palette, 800),
164
- surface-variant: #4a4a4a,
165
- on-surface: white,
166
- on-surface-variant: rgba(white, 0.7),
167
- background: #303030,
168
- inverse-surface: white,
169
- inverse-on-surface: rgba(black, 0.87),
170
- outline: rgba(white, 0.12),
171
- outline-variant: rgba(white, 0.38),
172
- hover-state-layer-opacity: 0.04,
173
- focus-state-layer-opacity: 0.12,
174
- pressed-state-layer-opacity: 0.12,
175
- shadow: black,
176
- primary: map.get($primary, default),
177
- on-primary: map.get($primary, default-contrast),
178
- secondary: map.get($accent, default),
179
- on-secondary: map.get($accent, default-contrast),
180
- error: map.get($warn, default),
181
- on-error: map.get($warn, default-contrast),
182
- ),
152
+ is-dark: $is-dark,
153
+ foreground: $foreground,
154
+ background: $background,
183
155
  );
184
156
  }
185
157
 
186
- // TODO: Remove legacy API and rename `$primary` below to `$config`. Currently it cannot be renamed
187
- // as it would break existing apps that set the parameter by name.
188
-
189
- /// Creates a container object for a light theme to be given to individual component theme mixins.
158
+ /// Creates a container object for a theme to be given to individual component theme mixins.
190
159
  /// @param {Map} $primary The theme configuration object.
191
160
  /// @returns {Map} A complete Angular Material theme map.
192
- @function define-light-theme($primary, $accent: null, $warn: define-palette(palette.$red-palette)) {
161
+ @function _define-theme(
162
+ $primary, $accent: null, $warn: define-palette(palette.$red-palette), $is-dark) {
193
163
  // This function creates a container object for the individual component theme mixins. Consumers
194
164
  // can construct such an object by calling this function, or by building the object manually.
195
165
  // There are two possible ways to invoke this function in order to create such an object:
@@ -206,13 +176,21 @@
206
176
  @if $accent != null {
207
177
  @warn theming.$private-legacy-theme-warning;
208
178
  $theme: _mat-validate-theme(
209
- (
210
- _is-legacy-theme: true,
211
- color: _mat-create-light-color-config($primary, $accent, $warn),
212
- )
179
+ (
180
+ _is-legacy-theme: true,
181
+ color: _mat-create-color-config($primary, $accent, $warn, $is-dark),
182
+ )
213
183
  );
214
184
 
215
- @return _internalize-theme(theming.private-create-backwards-compatibility-theme($theme));
185
+ $theme: _internalize-theme(theming.private-create-backwards-compatibility-theme($theme));
186
+ $system: _define-system(
187
+ $primary: $primary,
188
+ $accent: $accent,
189
+ $warn: $warn,
190
+ $is-dark: $is-dark,
191
+ $typography: ());
192
+ $theme: map.set($theme, _mat-system, $system);
193
+ @return $theme;
216
194
  }
217
195
  // If the map pattern is used (1), we just pass-through the configurations for individual
218
196
  // parts of the theming system, but update the `color` configuration if set. As explained
@@ -224,15 +202,33 @@
224
202
  $accent: map.get($color-settings, accent);
225
203
  $warn: map.get($color-settings, warn);
226
204
  $result: map.merge(
227
- $result,
228
- (
229
- color: _mat-create-light-color-config($primary, $accent, $warn),
230
- )
205
+ $result,
206
+ (
207
+ color: _mat-create-color-config($primary, $accent, $warn, $is-dark),
208
+ )
231
209
  );
232
210
  }
233
- @return _internalize-theme(
234
- theming.private-create-backwards-compatibility-theme(_mat-validate-theme($result))
211
+ $theme: _internalize-theme(
212
+ theming.private-create-backwards-compatibility-theme(_mat-validate-theme($result))
235
213
  );
214
+ $system: _define-system(
215
+ $primary: map.get($result, primary) or map.get($result, color, primary) or (),
216
+ $accent: map.get($result, accent) or map.get($result, color, accent) or (),
217
+ $warn: map.get($result, warn) or map.get($result, color, warn) or (),
218
+ $is-dark: $is-dark,
219
+ $typography: map.get($result, typography) or ());
220
+ $theme: map.set($theme, _mat-system, $system);
221
+ @return $theme;
222
+ }
223
+
224
+ // TODO: Remove legacy API and rename `$primary` below to `$config`. Currently it cannot be renamed
225
+ // as it would break existing apps that set the parameter by name.
226
+
227
+ /// Creates a container object for a light theme to be given to individual component theme mixins.
228
+ /// @param {Map} $primary The theme configuration object.
229
+ /// @returns {Map} A complete Angular Material theme map.
230
+ @function define-light-theme($primary, $accent: null, $warn: define-palette(palette.$red-palette)) {
231
+ @return _define-theme($primary, $accent, $warn, false);
236
232
  }
237
233
 
238
234
  // TODO: Remove legacy API and rename below `$primary` to `$config`. Currently it cannot be renamed
@@ -242,48 +238,7 @@
242
238
  /// @param {Map} $primary The theme configuration object.
243
239
  /// @returns {Map} A complete Angular Material theme map.
244
240
  @function define-dark-theme($primary, $accent: null, $warn: define-palette(palette.$red-palette)) {
245
- // This function creates a container object for the individual component theme mixins. Consumers
246
- // can construct such an object by calling this function, or by building the object manually.
247
- // There are two possible ways to invoke this function in order to create such an object:
248
- //
249
- // (1) Passing in a map that holds optional configurations for individual parts of the
250
- // theming system. For `color` configurations, the function only expects the palettes
251
- // for `primary` and `accent` (and optionally `warn`). The function will expand the
252
- // shorthand into an actual configuration that can be consumed in `-color` mixins.
253
- // (2) Legacy pattern: Passing in the palettes as parameters. This is not as flexible
254
- // as passing in a configuration map because only the `color` system can be configured.
255
- //
256
- // If the legacy pattern is used, we generate a container object only with a dark-themed
257
- // configuration for the `color` theming part.
258
- @if $accent != null {
259
- @warn theming.$private-legacy-theme-warning;
260
- $theme: _mat-validate-theme(
261
- (
262
- _is-legacy-theme: true,
263
- color: _mat-create-dark-color-config($primary, $accent, $warn),
264
- )
265
- );
266
- @return _internalize-theme(theming.private-create-backwards-compatibility-theme($theme));
267
- }
268
- // If the map pattern is used (1), we just pass-through the configurations for individual
269
- // parts of the theming system, but update the `color` configuration if set. As explained
270
- // above, the color shorthand will be expanded to an actual dark-themed color configuration.
271
- $result: $primary;
272
- @if map.get($primary, color) {
273
- $color-settings: map.get($primary, color);
274
- $primary: map.get($color-settings, primary);
275
- $accent: map.get($color-settings, accent);
276
- $warn: map.get($color-settings, warn);
277
- $result: map.merge(
278
- $result,
279
- (
280
- color: _mat-create-dark-color-config($primary, $accent, $warn),
281
- )
282
- );
283
- }
284
- @return _internalize-theme(
285
- theming.private-create-backwards-compatibility-theme(_mat-validate-theme($result))
286
- );
241
+ @return _define-theme($primary, $accent, $warn, true);
287
242
  }
288
243
 
289
244
  /// Gets the color configuration from the given theme or configuration.
@@ -1,4 +1,5 @@
1
- @use '../theming/inspection';
1
+ @use '../tokens/m2-utils';
2
+ @use 'sass:map';
2
3
 
3
4
  // Tokens that can't be configured through Angular Material's current theming API,
4
5
  // but may be in a future version of the theming API.
@@ -8,19 +9,21 @@
8
9
 
9
10
  // Tokens that can be configured through Angular Material's color theming API.
10
11
  @function get-color-tokens($theme) {
12
+ $system: m2-utils.get-system($theme);
11
13
  @return (
12
- optgroup-label-text-color: inspection.get-theme-color($theme, system, on-surface),
14
+ optgroup-label-text-color: map.get($system, on-surface),
13
15
  );
14
16
  }
15
17
 
16
18
  // Tokens that can be configured through Angular Material's typography theming API.
17
19
  @function get-typography-tokens($theme) {
20
+ $system: m2-utils.get-system($theme);
18
21
  @return (
19
- optgroup-label-text-font: inspection.get-theme-typography($theme, body-1, font-family),
20
- optgroup-label-text-line-height: inspection.get-theme-typography($theme, body-1, line-height),
21
- optgroup-label-text-size: inspection.get-theme-typography($theme, body-1, font-size),
22
- optgroup-label-text-tracking: inspection.get-theme-typography($theme, body-1, letter-spacing),
23
- optgroup-label-text-weight: inspection.get-theme-typography($theme, body-1, font-weight)
22
+ optgroup-label-text-font: map.get($system, body-large-font),
23
+ optgroup-label-text-line-height: map.get($system, body-large-line-height),
24
+ optgroup-label-text-size: map.get($system, body-large-size),
25
+ optgroup-label-text-tracking: map.get($system, body-large-tracking),
26
+ optgroup-label-text-weight: map.get($system, body-large-weight)
24
27
  );
25
28
  }
26
29
 
@@ -12,28 +12,30 @@
12
12
  // Tokens that can be configured through Angular Material's color theming API.
13
13
  @function get-color-tokens($theme, $color-variant) {
14
14
  $is-dark: inspection.get-theme-type($theme) == dark;
15
- $active-state-layer-color: inspection.get-theme-color($theme, foreground, base,
16
- if($is-dark, 0.08, 0.04));
17
15
  $system: m2-utils.get-system($theme);
18
16
  $system: m3-utils.replace-colors-with-variant($system, primary, $color-variant);
19
17
 
20
18
  @return (
21
19
  option-selected-state-label-text-color: map.get($system, primary),
22
- option-label-text-color: inspection.get-theme-color($theme, system, on-surface),
23
- option-hover-state-layer-color: $active-state-layer-color,
24
- option-focus-state-layer-color: $active-state-layer-color,
25
- option-selected-state-layer-color: $active-state-layer-color,
20
+ option-label-text-color: map.get($system, on-surface),
21
+ option-hover-state-layer-color: m3-utils.color-with-opacity(
22
+ map.get($system, on-surface), map.get($system, hover-state-layer-opacity)),
23
+ option-focus-state-layer-color: m3-utils.color-with-opacity(
24
+ map.get($system, on-surface), map.get($system, focus-state-layer-opacity)),
25
+ option-selected-state-layer-color: m3-utils.color-with-opacity(
26
+ map.get($system, on-surface), map.get($system, pressed-state-layer-opacity)),
26
27
  );
27
28
  }
28
29
 
29
30
  // Tokens that can be configured through Angular Material's typography theming API.
30
31
  @function get-typography-tokens($theme) {
32
+ $system: m2-utils.get-system($theme);
31
33
  @return (
32
- option-label-text-font: inspection.get-theme-typography($theme, body-1, font-family),
33
- option-label-text-line-height: inspection.get-theme-typography($theme, body-1, line-height),
34
- option-label-text-size: inspection.get-theme-typography($theme, body-1, font-size),
35
- option-label-text-tracking: inspection.get-theme-typography($theme, body-1, letter-spacing),
36
- option-label-text-weight: inspection.get-theme-typography($theme, body-1, font-weight)
34
+ option-label-text-font: map.get($system, body-large-font),
35
+ option-label-text-line-height: map.get($system, body-large-line-height),
36
+ option-label-text-size: map.get($system, body-large-size),
37
+ option-label-text-tracking: map.get($system, body-large-tracking),
38
+ option-label-text-weight: map.get($system, body-large-weight)
37
39
  );
38
40
  }
39
41
 
@@ -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: m2-optgroup.get-unthemable-tokens();
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: m2-optgroup.get-color-tokens($theme);
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: m2-optgroup.get-typography-tokens($theme);
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: m2-optgroup.get-density-tokens($theme);
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
  }