@angular/material 20.1.0-next.2 → 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 (213) hide show
  1. package/autocomplete/_autocomplete-theme.scss +4 -4
  2. package/autocomplete/_m2-autocomplete.scss +10 -22
  3. package/badge/_badge-theme.scss +4 -4
  4. package/badge/_m2-badge.scss +49 -63
  5. package/bottom-sheet/_bottom-sheet-theme.scss +4 -4
  6. package/bottom-sheet/_m2-bottom-sheet.scss +16 -30
  7. package/button/_button-theme.scss +4 -4
  8. package/button/_fab-theme.scss +4 -4
  9. package/button/_icon-button-theme.scss +10 -8
  10. package/button/_m2-button.scss +135 -154
  11. package/button/_m2-fab.scss +60 -69
  12. package/button/_m2-icon-button.scss +30 -50
  13. package/button/_m3-button.scss +1 -2
  14. package/button/_m3-fab.scss +1 -2
  15. package/button/_m3-icon-button.scss +1 -2
  16. package/button-toggle/_button-toggle-theme.scss +4 -4
  17. package/button-toggle/_m2-button-toggle.scss +58 -75
  18. package/button-toggle/_m3-button-toggle.scss +1 -2
  19. package/card/_card-theme.scss +4 -4
  20. package/card/_m2-card.scss +30 -43
  21. package/checkbox/_checkbox-theme.scss +10 -8
  22. package/checkbox/_m2-checkbox.scss +30 -41
  23. package/checkbox/_m3-checkbox.scss +1 -2
  24. package/chips/_chips-theme.scss +10 -7
  25. package/chips/_m2-chip.scss +40 -54
  26. package/chips/_m3-chip.scss +1 -2
  27. package/core/_core-theme.scss +4 -4
  28. package/core/_m2-app.scss +11 -23
  29. package/core/m2/_theming.scss +8 -4
  30. package/core/option/_m2-optgroup.scss +13 -25
  31. package/core/option/_m2-option.scss +16 -23
  32. package/core/option/_optgroup-theme.scss +4 -4
  33. package/core/option/_option-theme.scss +6 -6
  34. package/core/ripple/_m2-ripple.scss +8 -20
  35. package/core/ripple/_ripple-theme.scss +4 -4
  36. package/core/selection/pseudo-checkbox/_m2-pseudo-checkbox.scss +14 -21
  37. package/core/selection/pseudo-checkbox/_pseudo-checkbox-theme.scss +8 -8
  38. package/core/theming/_definition.scss +3 -1
  39. package/core/tokens/_m2-utils.scss +14 -6
  40. package/core/tokens/m3/_theme.scss +1 -1
  41. package/datepicker/_datepicker-theme.scss +6 -6
  42. package/datepicker/_m2-datepicker.scss +26 -33
  43. package/dialog/_dialog-theme.scss +4 -4
  44. package/dialog/_m2-dialog.scss +34 -46
  45. package/divider/_divider-theme.scss +4 -4
  46. package/divider/_m2-divider.scss +10 -21
  47. package/expansion/_expansion-theme.scss +4 -4
  48. package/expansion/_m2-expansion.scss +51 -67
  49. package/expansion/_m3-expansion.scss +1 -2
  50. package/fesm2022/animation-DfMFjxHu.mjs.map +1 -1
  51. package/fesm2022/autocomplete/testing.mjs.map +1 -1
  52. package/fesm2022/autocomplete.mjs.map +1 -1
  53. package/fesm2022/badge/testing.mjs.map +1 -1
  54. package/fesm2022/badge.mjs.map +1 -1
  55. package/fesm2022/bottom-sheet/testing.mjs.map +1 -1
  56. package/fesm2022/bottom-sheet.mjs.map +1 -1
  57. package/fesm2022/button/testing.mjs.map +1 -1
  58. package/fesm2022/button-toggle/testing.mjs.map +1 -1
  59. package/fesm2022/button-toggle.mjs.map +1 -1
  60. package/fesm2022/button.mjs.map +1 -1
  61. package/fesm2022/card/testing.mjs.map +1 -1
  62. package/fesm2022/card.mjs.map +1 -1
  63. package/fesm2022/checkbox/testing.mjs.map +1 -1
  64. package/fesm2022/checkbox.mjs.map +1 -1
  65. package/fesm2022/chips/testing.mjs.map +1 -1
  66. package/fesm2022/chips.mjs.map +1 -1
  67. package/fesm2022/common-module-cKSwHniA.mjs.map +1 -1
  68. package/fesm2022/core/testing.mjs.map +1 -1
  69. package/fesm2022/core.mjs +1 -1
  70. package/fesm2022/core.mjs.map +1 -1
  71. package/fesm2022/date-formats-K6TQue-Y.mjs.map +1 -1
  72. package/fesm2022/date-range-input-harness-DEyfkeOs.mjs.map +1 -1
  73. package/fesm2022/datepicker/testing.mjs.map +1 -1
  74. package/fesm2022/datepicker.mjs.map +1 -1
  75. package/fesm2022/dialog/testing.mjs.map +1 -1
  76. package/fesm2022/dialog.mjs.map +1 -1
  77. package/fesm2022/divider/testing.mjs.map +1 -1
  78. package/fesm2022/divider.mjs.map +1 -1
  79. package/fesm2022/error-options-DCNQlTOA.mjs.map +1 -1
  80. package/fesm2022/error-state-Dtb1IHM-.mjs.map +1 -1
  81. package/fesm2022/expansion/testing.mjs.map +1 -1
  82. package/fesm2022/expansion.mjs.map +1 -1
  83. package/fesm2022/form-field/testing/control.mjs.map +1 -1
  84. package/fesm2022/form-field/testing.mjs.map +1 -1
  85. package/fesm2022/form-field-CFbrnFED.mjs.map +1 -1
  86. package/fesm2022/form-field.mjs.map +1 -1
  87. package/fesm2022/grid-list/testing.mjs.map +1 -1
  88. package/fesm2022/grid-list.mjs.map +1 -1
  89. package/fesm2022/icon/testing.mjs.map +1 -1
  90. package/fesm2022/icon-button-DxiIc1ex.mjs.map +1 -1
  91. package/fesm2022/icon-registry-CwOTJ7YM.mjs.map +1 -1
  92. package/fesm2022/icon.mjs.map +1 -1
  93. package/fesm2022/index-BFRo2fUq.mjs.map +1 -1
  94. package/fesm2022/index-DwiL-HGk.mjs.map +1 -1
  95. package/fesm2022/input/testing.mjs.map +1 -1
  96. package/fesm2022/input-harness-C5Msdc4-.mjs.map +1 -1
  97. package/fesm2022/input-value-accessor-D1GvPuqO.mjs.map +1 -1
  98. package/fesm2022/input.mjs.map +1 -1
  99. package/fesm2022/internal-form-field-D5iFxU6d.mjs.map +1 -1
  100. package/fesm2022/line-Bz5f9Cyx.mjs.map +1 -1
  101. package/fesm2022/list/testing.mjs.map +1 -1
  102. package/fesm2022/list.mjs.map +1 -1
  103. package/fesm2022/material.mjs.map +1 -1
  104. package/fesm2022/menu/testing.mjs.map +1 -1
  105. package/fesm2022/menu.mjs.map +1 -1
  106. package/fesm2022/module-B0CLRw5e.mjs.map +1 -1
  107. package/fesm2022/module-B62K-792.mjs.map +1 -1
  108. package/fesm2022/module-CWxMD37a.mjs.map +1 -1
  109. package/fesm2022/module-Ce6F7TNm.mjs.map +1 -1
  110. package/fesm2022/option-BzhYL_xC.mjs.map +1 -1
  111. package/fesm2022/option-harness-BFcc-M_4.mjs.map +1 -1
  112. package/fesm2022/paginator/testing.mjs.map +1 -1
  113. package/fesm2022/paginator.mjs.map +1 -1
  114. package/fesm2022/progress-bar/testing.mjs.map +1 -1
  115. package/fesm2022/progress-bar.mjs.map +1 -1
  116. package/fesm2022/progress-spinner/testing.mjs.map +1 -1
  117. package/fesm2022/progress-spinner.mjs.map +1 -1
  118. package/fesm2022/pseudo-checkbox-DDmgx3P4.mjs.map +1 -1
  119. package/fesm2022/pseudo-checkbox-module-4F8Up4PL.mjs.map +1 -1
  120. package/fesm2022/public-api-BoO5eSq-.mjs.map +1 -1
  121. package/fesm2022/radio/testing.mjs.map +1 -1
  122. package/fesm2022/radio.mjs.map +1 -1
  123. package/fesm2022/ripple-BYgV4oZC.mjs.map +1 -1
  124. package/fesm2022/ripple-loader-BnMiRtmT.mjs.map +1 -1
  125. package/fesm2022/select/testing.mjs.map +1 -1
  126. package/fesm2022/select.mjs.map +1 -1
  127. package/fesm2022/sidenav/testing.mjs.map +1 -1
  128. package/fesm2022/sidenav.mjs +2 -4
  129. package/fesm2022/sidenav.mjs.map +1 -1
  130. package/fesm2022/slide-toggle/testing.mjs.map +1 -1
  131. package/fesm2022/slide-toggle.mjs.map +1 -1
  132. package/fesm2022/slider/testing.mjs.map +1 -1
  133. package/fesm2022/slider.mjs.map +1 -1
  134. package/fesm2022/snack-bar/testing.mjs.map +1 -1
  135. package/fesm2022/snack-bar.mjs.map +1 -1
  136. package/fesm2022/sort/testing.mjs.map +1 -1
  137. package/fesm2022/sort.mjs.map +1 -1
  138. package/fesm2022/stepper/testing.mjs.map +1 -1
  139. package/fesm2022/stepper.mjs.map +1 -1
  140. package/fesm2022/structural-styles-CObeNzjn.mjs.map +1 -1
  141. package/fesm2022/table/testing.mjs.map +1 -1
  142. package/fesm2022/table.mjs.map +1 -1
  143. package/fesm2022/tabs/testing.mjs.map +1 -1
  144. package/fesm2022/tabs.mjs.map +1 -1
  145. package/fesm2022/timepicker/testing.mjs.map +1 -1
  146. package/fesm2022/timepicker.mjs.map +1 -1
  147. package/fesm2022/toolbar/testing.mjs.map +1 -1
  148. package/fesm2022/toolbar.mjs.map +1 -1
  149. package/fesm2022/tooltip/testing.mjs.map +1 -1
  150. package/fesm2022/tooltip.mjs.map +1 -1
  151. package/fesm2022/tree/testing.mjs.map +1 -1
  152. package/fesm2022/tree.mjs.map +1 -1
  153. package/form-field/_form-field-theme.scss +4 -4
  154. package/form-field/_m2-form-field.scss +125 -138
  155. package/form-field/_m3-form-field.scss +1 -2
  156. package/grid-list/_grid-list-theme.scss +4 -4
  157. package/grid-list/_m2-grid-list.scss +14 -25
  158. package/icon/_icon-theme.scss +4 -4
  159. package/icon/_m2-icon.scss +7 -21
  160. package/list/_list-theme.scss +14 -12
  161. package/list/_m2-list.scss +84 -98
  162. package/list/_m3-list.scss +1 -2
  163. package/menu/_m2-menu.scss +33 -46
  164. package/menu/_menu-theme.scss +4 -4
  165. package/package.json +2 -2
  166. package/paginator/_m2-paginator.scss +38 -57
  167. package/paginator/_m3-paginator.scss +1 -2
  168. package/paginator/_paginator-theme.scss +4 -4
  169. package/prebuilt-themes/deeppurple-amber.css +1 -1
  170. package/prebuilt-themes/indigo-pink.css +1 -1
  171. package/prebuilt-themes/pink-bluegrey.css +1 -1
  172. package/prebuilt-themes/purple-green.css +1 -1
  173. package/progress-bar/_m2-progress-bar.scss +11 -24
  174. package/progress-bar/_progress-bar-theme.scss +6 -6
  175. package/progress-spinner/_m2-progress-spinner.scss +9 -20
  176. package/progress-spinner/_progress-spinner-theme.scss +6 -6
  177. package/radio/_m2-radio.scss +30 -41
  178. package/radio/_m3-radio.scss +1 -2
  179. package/radio/_radio-theme.scss +6 -6
  180. package/schematics/ng-add/index.js +1 -1
  181. package/schematics/ng-generate/theme-color/schema.json +1 -1
  182. package/select/_m2-select.scss +23 -31
  183. package/select/_m3-select.scss +1 -2
  184. package/select/_select-theme.scss +6 -6
  185. package/sidenav/_m2-sidenav.scss +26 -36
  186. package/sidenav/_sidenav-theme.scss +4 -4
  187. package/slide-toggle/_m2-slide-toggle.scss +94 -113
  188. package/slide-toggle/_slide-toggle-theme.scss +6 -6
  189. package/slider/_m2-slider.scss +34 -52
  190. package/slider/_slider-theme.scss +4 -4
  191. package/snack-bar/_m2-snack-bar.scss +16 -36
  192. package/snack-bar/_snack-bar-theme.scss +4 -4
  193. package/sort/_m2-sort.scss +7 -18
  194. package/sort/_sort-theme.scss +4 -4
  195. package/stepper/_m2-stepper.scss +39 -54
  196. package/stepper/_m3-stepper.scss +1 -2
  197. package/stepper/_stepper-theme.scss +4 -4
  198. package/table/_m2-table.scss +54 -65
  199. package/table/_m3-table.scss +1 -2
  200. package/table/_table-theme.scss +4 -4
  201. package/tabs/_m2-tabs.scss +31 -47
  202. package/tabs/_m3-tabs.scss +1 -2
  203. package/tabs/_tabs-theme.scss +9 -9
  204. package/timepicker/_m2-timepicker.scss +10 -22
  205. package/timepicker/_timepicker-theme.scss +4 -4
  206. package/toolbar/_m2-toolbar.scss +26 -45
  207. package/toolbar/_m3-toolbar.scss +1 -2
  208. package/toolbar/_toolbar-theme.scss +4 -4
  209. package/tooltip/_m2-tooltip.scss +16 -33
  210. package/tooltip/_tooltip-theme.scss +4 -4
  211. package/tree/_m2-tree.scss +21 -39
  212. package/tree/_m3-tree.scss +1 -2
  213. package/tree/_tree-theme.scss +4 -4
@@ -5,7 +5,7 @@
5
5
  @use 'sass:map';
6
6
 
7
7
  @mixin base($theme) {
8
- $tokens: m2-progress-spinner.get-unthemable-tokens();
8
+ $tokens: map.get(m2-progress-spinner.get-tokens($theme), base);
9
9
  @if inspection.get-theme-version($theme) == 1 {
10
10
  $tokens: map.get(m3-progress-spinner.get-tokens($theme), base);
11
11
  }
@@ -17,7 +17,7 @@
17
17
  /// @param {Map} $theme The theme to generate color styles for.
18
18
  /// @param {String} $color-variant The color variant to use for the component (M3 only)
19
19
  @mixin color($theme, $color-variant: null) {
20
- $tokens: m2-progress-spinner.get-color-tokens($theme, primary);
20
+ $tokens: map.get(m2-progress-spinner.get-tokens($theme), color);
21
21
  @if inspection.get-theme-version($theme) == 1 {
22
22
  $tokens: map.get(m3-progress-spinner.get-tokens($theme, $color-variant), color);
23
23
  }
@@ -26,19 +26,19 @@
26
26
 
27
27
  @if inspection.get-theme-version($theme) != 1 {
28
28
  .mat-accent {
29
- $tokens: m2-progress-spinner.get-color-tokens($theme, secondary);
29
+ $tokens: m2-progress-spinner.private-get-color-palette-color-tokens($theme, secondary);
30
30
  @include token-utils.values($tokens);
31
31
  }
32
32
 
33
33
  .mat-warn {
34
- $tokens: m2-progress-spinner.get-color-tokens($theme, error);
34
+ $tokens: m2-progress-spinner.private-get-color-palette-color-tokens($theme, error);
35
35
  @include token-utils.values($tokens);
36
36
  }
37
37
  }
38
38
  }
39
39
 
40
40
  @mixin typography($theme) {
41
- $tokens: m2-progress-spinner.get-typography-tokens($theme);
41
+ $tokens: map.get(m2-progress-spinner.get-tokens($theme), typography);
42
42
  @if inspection.get-theme-version($theme) == 1 {
43
43
  $tokens: map.get(m3-progress-spinner.get-tokens($theme), typography);
44
44
  }
@@ -47,7 +47,7 @@
47
47
  }
48
48
 
49
49
  @mixin density($theme) {
50
- $tokens: m2-progress-spinner.get-density-tokens($theme);
50
+ $tokens: map.get(m2-progress-spinner.get-tokens($theme), density);
51
51
  @if inspection.get-theme-version($theme) == 1 {
52
52
  $tokens: map.get(m3-progress-spinner.get-tokens($theme), density);
53
53
  }
@@ -1,26 +1,43 @@
1
1
  @use 'sass:map';
2
2
  @use '../core/theming/theming';
3
- @use '../core/theming/inspection';
4
3
  @use '../core/tokens/m2-utils';
5
4
  @use '../core/tokens/m3-utils';
6
5
 
7
- // Tokens that can't be configured through Angular Material's current theming API,
8
- // but may be in a future version of the theming API.
9
- @function get-unthemable-tokens() {
6
+ @function get-tokens($theme) {
7
+ $system: m2-utils.get-system($theme);
8
+ $density-scale: theming.clamp-density(map.get($system, density-scale), -3);
9
+
10
10
  @return (
11
- radio-disabled-selected-icon-opacity: 0.38,
12
- radio-disabled-unselected-icon-opacity: 0.38,
13
- // This is specified both here and in the density tokens, because it
14
- // determines the size of the radio button itself and there are internal
15
- // tests who don't configure the theme correctly.
16
- radio-state-layer-size: 40px,
11
+ base: (
12
+ radio-disabled-selected-icon-opacity: 0.38,
13
+ radio-disabled-unselected-icon-opacity: 0.38,
14
+ // This is specified both here and in the density tokens, because it
15
+ // determines the size of the radio button itself and there are internal
16
+ // tests who don't configure the theme correctly.
17
+ radio-state-layer-size: 40px,
18
+ ),
19
+ color: private-get-color-palette-color-tokens($theme, secondary),
20
+ typography: (
21
+ radio-label-text-font: map.get($system, body-medium-font),
22
+ radio-label-text-line-height: map.get($system, body-medium-line-height),
23
+ radio-label-text-size: map.get($system, body-medium-size),
24
+ radio-label-text-tracking: map.get($system, body-medium-tracking),
25
+ radio-label-text-weight: map.get($system, body-medium-weight)
26
+ ),
27
+ density: (
28
+ radio-state-layer-size: map.get((
29
+ 0: 40px,
30
+ -1: 36px,
31
+ -2: 32px,
32
+ -3: 28px,
33
+ ), $density-scale),
34
+ radio-touch-target-display: if($density-scale < -1, none, block)
35
+ ),
17
36
  );
18
37
  }
19
38
 
20
39
  // Tokens that can be configured through Angular Material's color theming API.
21
- @function get-color-tokens($theme, $color-variant) {
22
- $system: m2-utils.get-system($theme);
23
- $is-dark: inspection.get-theme-type($theme) == dark;
40
+ @function private-get-color-palette-color-tokens($theme, $color-variant) {
24
41
  $system: m2-utils.get-system($theme);
25
42
  $system: m3-utils.replace-colors-with-variant($system, secondary, $color-variant);
26
43
  $disabled: m3-utils.color-with-opacity(map.get($system, on-surface), 38%);
@@ -42,31 +59,3 @@
42
59
  radio-unselected-pressed-icon-color: map.get($system, on-surface),
43
60
  );
44
61
  }
45
-
46
- // Tokens that can be configured through Angular Material's typography theming API.
47
- @function get-typography-tokens($theme) {
48
- $system: m2-utils.get-system($theme);
49
- @return (
50
- radio-label-text-font: map.get($system, body-medium-font),
51
- radio-label-text-line-height: map.get($system, body-medium-line-height),
52
- radio-label-text-size: map.get($system, body-medium-size),
53
- radio-label-text-tracking: map.get($system, body-medium-tracking),
54
- radio-label-text-weight: map.get($system, body-medium-weight)
55
- );
56
- }
57
-
58
- // Tokens that can be configured through Angular Material's density theming API.
59
- @function get-density-tokens($theme) {
60
- $scale: theming.clamp-density(inspection.get-theme-density($theme), -3);
61
-
62
- @return (
63
- // The diameter of the radio's ripple.
64
- radio-state-layer-size: map.get((
65
- 0: 40px,
66
- -1: 36px,
67
- -2: 32px,
68
- -3: 28px,
69
- ), $scale),
70
- radio-touch-target-display: if($scale < -1, none, block)
71
- );
72
- }
@@ -2,7 +2,6 @@
2
2
  @use 'sass:list';
3
3
  @use '../core/tokens/m3-utils';
4
4
  @use '../core/theming/theming';
5
- @use '../core/theming/inspection';
6
5
  @use '../core/tokens/m3';
7
6
 
8
7
  /// Generates custom tokens for the mat-radio.
@@ -41,7 +40,7 @@
41
40
  radio-label-text-tracking: map.get($system, body-medium-tracking),
42
41
  radio-label-text-weight: map.get($system, body-medium-weight),
43
42
  ),
44
- density: get-density-tokens(map.get($theme, inspection.$internals, density-scale)),
43
+ density: get-density-tokens(map.get($system, density-scale)),
45
44
  );
46
45
 
47
46
  // Temporary removal where color variants previously did not include the
@@ -9,7 +9,7 @@
9
9
  /// for the mat-radio.
10
10
  /// @param {Map} $theme The theme to generate base styles for.
11
11
  @mixin base($theme) {
12
- $tokens: m2-radio.get-unthemable-tokens();
12
+ $tokens: map.get(m2-radio.get-tokens($theme), base);
13
13
  @if inspection.get-theme-version($theme) == 1 {
14
14
  $tokens: map.get(m3-radio.get-tokens($theme), base);
15
15
  }
@@ -27,17 +27,17 @@
27
27
  } @else {
28
28
  .mat-mdc-radio-button {
29
29
  &.mat-primary {
30
- $tokens: m2-radio.get-color-tokens($theme, primary);
30
+ $tokens: m2-radio.private-get-color-palette-color-tokens($theme, primary);
31
31
  @include token-utils.values($tokens);
32
32
  }
33
33
 
34
34
  &.mat-accent {
35
- $tokens: m2-radio.get-color-tokens($theme, secondary);
35
+ $tokens: m2-radio.private-get-color-palette-color-tokens($theme, secondary);
36
36
  @include token-utils.values($tokens);
37
37
  }
38
38
 
39
39
  &.mat-warn {
40
- $tokens: m2-radio.get-color-tokens($theme, error);
40
+ $tokens: m2-radio.private-get-color-palette-color-tokens($theme, error);
41
41
  @include token-utils.values($tokens);
42
42
  }
43
43
  }
@@ -45,7 +45,7 @@
45
45
  }
46
46
 
47
47
  @mixin typography($theme) {
48
- $tokens: m2-radio.get-typography-tokens($theme);
48
+ $tokens: map.get(m2-radio.get-tokens($theme), typography);
49
49
  @if inspection.get-theme-version($theme) == 1 {
50
50
  $tokens: map.get(m3-radio.get-tokens($theme), typography);
51
51
  }
@@ -54,7 +54,7 @@
54
54
  }
55
55
 
56
56
  @mixin density($theme) {
57
- $tokens: m2-radio.get-density-tokens($theme);
57
+ $tokens: map.get(m2-radio.get-tokens($theme), density);
58
58
  @if inspection.get-theme-version($theme) == 1 {
59
59
  $tokens: map.get(m3-radio.get-tokens($theme), density);
60
60
  }
@@ -19,7 +19,7 @@ const package_config_1 = require("./package-config");
19
19
  * Note that the fallback version range does not use caret, but tilde because that is
20
20
  * the default for Angular framework dependencies in CLI projects.
21
21
  */
22
- const fallbackMaterialVersionRange = `~20.1.0-next.2`;
22
+ const fallbackMaterialVersionRange = `~20.1.0-rc.0`;
23
23
  /**
24
24
  * Schematic factory entry-point for the `ng-add` schematic. The ng-add schematic will be
25
25
  * automatically executed if developers run `ng add @angular/material`.
@@ -49,7 +49,7 @@
49
49
  "type": "boolean",
50
50
  "default": true,
51
51
  "description": "Whether to generate output file in scss or CSS",
52
- "x-prompt": "Do you want to generated file to be a scss file? This is the recommended way of setting up theming in your application. If not, a CSS file will be generated with all the system variables defined. (Leave blank to generate a scss file)"
52
+ "x-prompt": "Do you want the generated file to be a scss file? This is the recommended way of setting up theming in your application. If not, a CSS file will be generated with all the system variables defined. (Leave blank to generate a scss file)"
53
53
  }
54
54
  }
55
55
  }
@@ -1,20 +1,37 @@
1
1
  @use 'sass:map';
2
- @use '../core/theming/inspection';
3
2
  @use '../core/theming/theming';
4
3
  @use '../core/style/elevation';
5
4
  @use '../core/tokens/m2-utils';
6
5
  @use '../core/tokens/m3-utils';
7
6
 
8
- // Tokens that can't be configured through Angular Material's current theming API,
9
- // but may be in a future version of the theming API.
10
- @function get-unthemable-tokens() {
7
+ @function get-tokens($theme) {
8
+ $system: m2-utils.get-system($theme);
9
+ $density-scale: theming.clamp-density(map.get($system, density-scale), -2);
10
+
11
11
  @return (
12
- select-container-elevation-shadow: elevation.get-box-shadow(8),
12
+ base: (
13
+ select-container-elevation-shadow: elevation.get-box-shadow(8),
14
+ ),
15
+ color: private-get-color-palette-color-tokens($theme, primary),
16
+ typography: (
17
+ select-trigger-text-font: map.get($system, body-large-font),
18
+ select-trigger-text-line-height: map.get($system, body-large-line-height),
19
+ select-trigger-text-size: map.get($system, body-large-size),
20
+ select-trigger-text-tracking: map.get($system, body-large-tracking),
21
+ select-trigger-text-weight: map.get($system, body-large-weight)
22
+ ),
23
+ density: (
24
+ select-arrow-transform: map.get((
25
+ 0: translateY(-8px),
26
+ -1: translateY(-8px),
27
+ -2: none,
28
+ ), $density-scale),
29
+ ),
13
30
  );
14
31
  }
15
32
 
16
33
  // Tokens that can be configured through Angular Material's color theming API.
17
- @function get-color-tokens($theme, $color-variant) {
34
+ @function private-get-color-palette-color-tokens($theme, $color-variant) {
18
35
  $system: m2-utils.get-system($theme);
19
36
  $system: m3-utils.replace-colors-with-variant($system, primary, $color-variant);
20
37
  $disabled: m3-utils.color-with-opacity(map.get($system, on-surface), 38%);
@@ -30,28 +47,3 @@
30
47
  select-invalid-arrow-color: map.get($system, error),
31
48
  );
32
49
  }
33
-
34
- // Tokens that can be configured through Angular Material's typography theming API.
35
- @function get-typography-tokens($theme) {
36
- $system: m2-utils.get-system($theme);
37
- @return (
38
- select-trigger-text-font: map.get($system, body-large-font),
39
- select-trigger-text-line-height: map.get($system, body-large-line-height),
40
- select-trigger-text-size: map.get($system, body-large-size),
41
- select-trigger-text-tracking: map.get($system, body-large-tracking),
42
- select-trigger-text-weight: map.get($system, body-large-weight)
43
- );
44
- }
45
-
46
- // Tokens that can be configured through Angular Material's density theming API.
47
- @function get-density-tokens($theme) {
48
- $density-scale: theming.clamp-density(inspection.get-theme-density($theme), -2);
49
-
50
- @return (
51
- select-arrow-transform: map.get((
52
- 0: translateY(-8px),
53
- -1: translateY(-8px),
54
- -2: none,
55
- ), $density-scale),
56
- );
57
- }
@@ -3,7 +3,6 @@
3
3
  @use '../core/style/elevation';
4
4
  @use '../core/tokens/m3-utils';
5
5
  @use '../core/theming/theming';
6
- @use '../core/theming/inspection';
7
6
  @use '../core/tokens/m3';
8
7
 
9
8
  // The prefix used to generate the fully qualified name for tokens in this file.
@@ -40,7 +39,7 @@ $prefix: (mat, select);
40
39
  select-trigger-text-tracking: map.get($system, body-large-tracking),
41
40
  select-trigger-text-weight: map.get($system, body-large-weight),
42
41
  ),
43
- density: get-density-tokens(map.get($theme, inspection.$internals, density-scale)),
42
+ density: get-density-tokens(map.get($system, density-scale)),
44
43
  );
45
44
  }
46
45
 
@@ -9,7 +9,7 @@
9
9
  /// for the mat-select.
10
10
  /// @param {Map} $theme The theme to generate base styles for.
11
11
  @mixin base($theme) {
12
- $tokens: m2-select.get-unthemable-tokens();
12
+ $tokens: map.get(m2-select.get-tokens($theme), base);
13
13
  @if inspection.get-theme-version($theme) == 1 {
14
14
  $tokens: map.get(m3-select.get-tokens($theme), base);
15
15
  }
@@ -21,7 +21,7 @@
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: m2-select.get-color-tokens($theme, primary);
24
+ $tokens: map.get(m2-select.get-tokens($theme), color);
25
25
  @if inspection.get-theme-version($theme) == 1 {
26
26
  $tokens: map.get(m3-select.get-tokens($theme, $color-variant), color);
27
27
  }
@@ -30,19 +30,19 @@
30
30
 
31
31
  @if inspection.get-theme-version($theme) != 1 {
32
32
  .mat-mdc-form-field.mat-accent {
33
- $tokens: m2-select.get-color-tokens($theme, secondary);
33
+ $tokens: m2-select.private-get-color-palette-color-tokens($theme, secondary);
34
34
  @include token-utils.values($tokens);
35
35
  }
36
36
 
37
37
  .mat-mdc-form-field.mat-warn {
38
- $tokens: m2-select.get-color-tokens($theme, error);
38
+ $tokens: m2-select.private-get-color-palette-color-tokens($theme, error);
39
39
  @include token-utils.values($tokens);
40
40
  }
41
41
  }
42
42
  }
43
43
 
44
44
  @mixin typography($theme) {
45
- $tokens: m2-select.get-typography-tokens($theme);
45
+ $tokens: map.get(m2-select.get-tokens($theme), typography);
46
46
  @if inspection.get-theme-version($theme) == 1 {
47
47
  $tokens: map.get(m3-select.get-tokens($theme), typography);
48
48
  }
@@ -51,7 +51,7 @@
51
51
  }
52
52
 
53
53
  @mixin density($theme) {
54
- $tokens: m2-select.get-density-tokens($theme);
54
+ $tokens: map.get(m2-select.get-tokens($theme), density);
55
55
  @if inspection.get-theme-version($theme) == 1 {
56
56
  $tokens: map.get(m3-select.get-tokens($theme), density);
57
57
  }
@@ -6,48 +6,38 @@
6
6
  @use '../core/tokens/m2-utils';
7
7
  @use '../core/tokens/m3-utils';
8
8
 
9
- // Tokens that can't be configured through Angular Material's current theming API,
10
- // but may be in a future version of the theming API.
11
- @function get-unthemable-tokens() {
12
- @return (
13
- // Currently zero, but it appears to be relevant for M3.
14
- // See: https://m3.material.io/components/navigation-drawer/overview
15
- sidenav-container-shape: 0,
16
- sidenav-container-elevation-shadow: elevation.get-box-shadow(16),
17
- sidenav-container-width: auto,
18
- );
19
- }
20
-
21
- // Tokens that can be configured through Angular Material's color theming API.
22
- @function get-color-tokens($theme) {
9
+ @function get-tokens($theme) {
23
10
  $system: m2-utils.get-system($theme);
24
- $is-dark: inspection.get-theme-type($theme) == dark;
11
+ // TODO: Use system colors instead of checking theme type
12
+ $is-dark: false;
13
+ @if (meta.type-of($theme) == map and map.get($theme, color)) {
14
+ $is-dark: inspection.get-theme-type($theme) == dark;
15
+ }
25
16
  $scrim-opacity: 0.6;
26
17
  $scrim-color: m3-utils.color-with-opacity(map.get($system, surface), 60%);
27
18
  $fallback-scrim-color: if($is-dark, rgba(#fff, $scrim-opacity), rgba(#000, $scrim-opacity));
28
19
 
29
20
  @return (
30
- sidenav-container-divider-color: map.get($system, outline),
31
- sidenav-container-background-color: map.get($system, surface),
32
- sidenav-container-text-color: map.get($system, on-surface),
33
- sidenav-content-background-color: map.get($system, background),
34
- sidenav-content-text-color: map.get($system, on-surface),
21
+ base: (
22
+ sidenav-container-shape: 0,
23
+ sidenav-container-elevation-shadow: elevation.get-box-shadow(16),
24
+ sidenav-container-width: auto,
25
+ ),
26
+ color: (
27
+ sidenav-container-divider-color: map.get($system, outline),
28
+ sidenav-container-background-color: map.get($system, surface),
29
+ sidenav-container-text-color: map.get($system, on-surface),
30
+ sidenav-content-background-color: map.get($system, background),
31
+ sidenav-content-text-color: map.get($system, on-surface),
35
32
 
36
- // We use invert() here to have the darken the background color expected to be used.
37
- // If the background is light, we use a dark backdrop. If the background is dark, we
38
- // use a light backdrop. If the value isn't a color, Sass will throw an error so we
39
- // fall back to something generic.
40
- sidenav-scrim-color: if(meta.type-of($scrim-color) == color,
41
- color.invert($scrim-color), $fallback-scrim-color),
33
+ // We use invert() here to have the darken the background color expected to be used.
34
+ // If the background is light, we use a dark backdrop. If the background is dark, we
35
+ // use a light backdrop. If the value isn't a color, Sass will throw an error so we
36
+ // fall back to something generic.
37
+ sidenav-scrim-color: if(meta.type-of($scrim-color) == color,
38
+ color.invert($scrim-color), $fallback-scrim-color),
39
+ ),
40
+ typography: (),
41
+ density: (),
42
42
  );
43
43
  }
44
-
45
- // Tokens that can be configured through Angular Material's typography theming API.
46
- @function get-typography-tokens($theme) {
47
- @return ();
48
- }
49
-
50
- // Tokens that can be configured through Angular Material's density theming API.
51
- @function get-density-tokens($theme) {
52
- @return ();
53
- }
@@ -5,7 +5,7 @@
5
5
  @use './m3-sidenav';
6
6
 
7
7
  @mixin base($theme) {
8
- $tokens: m2-sidenav.get-unthemable-tokens();
8
+ $tokens: map.get(m2-sidenav.get-tokens($theme), base);
9
9
  @if inspection.get-theme-version($theme) == 1 {
10
10
  $tokens: map.get(m3-sidenav.get-tokens($theme), base);
11
11
  }
@@ -14,7 +14,7 @@
14
14
  }
15
15
 
16
16
  @mixin color($theme) {
17
- $tokens: m2-sidenav.get-color-tokens($theme);
17
+ $tokens: map.get(m2-sidenav.get-tokens($theme), color);
18
18
  @if inspection.get-theme-version($theme) == 1 {
19
19
  $tokens: map.get(m3-sidenav.get-tokens($theme), color);
20
20
  }
@@ -23,7 +23,7 @@
23
23
  }
24
24
 
25
25
  @mixin typography($theme) {
26
- $tokens: m2-sidenav.get-typography-tokens($theme);
26
+ $tokens: map.get(m2-sidenav.get-tokens($theme), typography);
27
27
  @if inspection.get-theme-version($theme) == 1 {
28
28
  $tokens: map.get(m3-sidenav.get-tokens($theme), typography);
29
29
  }
@@ -32,7 +32,7 @@
32
32
  }
33
33
 
34
34
  @mixin density($theme) {
35
- $tokens: m2-sidenav.get-density-tokens($theme);
35
+ $tokens: map.get(m2-sidenav.get-tokens($theme), density);
36
36
  @if inspection.get-theme-version($theme) == 1 {
37
37
  $tokens: map.get(m3-sidenav.get-tokens($theme), density);
38
38
  }