@angular/material 17.0.0-next.0 → 17.0.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 (204) hide show
  1. package/_index.scss +3 -4
  2. package/autocomplete/_autocomplete-theme.scss +12 -18
  3. package/autocomplete/index.d.ts +15 -24
  4. package/badge/_badge-theme.scss +15 -27
  5. package/badge/index.d.ts +9 -17
  6. package/bottom-sheet/_bottom-sheet-theme.scss +13 -22
  7. package/button/_button-base.scss +3 -3
  8. package/button/_button-theme-private.scss +3 -2
  9. package/button/_button-theme.scss +18 -25
  10. package/button/_fab-theme.scss +31 -49
  11. package/button/_icon-button-theme.scss +19 -26
  12. package/button/index.d.ts +22 -31
  13. package/button-toggle/_button-toggle-theme.scss +17 -28
  14. package/button-toggle/index.d.ts +15 -18
  15. package/card/_card-theme.scss +27 -38
  16. package/checkbox/_checkbox-theme.scss +28 -45
  17. package/checkbox/index.d.ts +21 -27
  18. package/chips/_chips-theme.scss +18 -56
  19. package/core/_core-theme.scss +24 -39
  20. package/core/color/_all-color.scss +7 -15
  21. package/core/density/private/_all-density.scss +34 -39
  22. package/core/focus-indicators/_focus-indicators-theme.scss +6 -8
  23. package/core/focus-indicators/_private.scss +22 -26
  24. package/core/index.d.ts +7 -11
  25. package/core/mdc-helpers/_mdc-helpers.scss +19 -22
  26. package/core/option/_optgroup-theme.scss +13 -23
  27. package/core/option/_option-theme.scss +23 -37
  28. package/core/ripple/_ripple-theme.scss +6 -10
  29. package/core/selection/pseudo-checkbox/_pseudo-checkbox-theme.scss +17 -24
  30. package/core/style/_form-common.scss +7 -7
  31. package/core/style/_private.scss +5 -7
  32. package/core/style/_sass-utils.scss +7 -0
  33. package/core/testing/index.d.ts +2 -1
  34. package/core/theming/_all-theme.scss +41 -41
  35. package/core/theming/_inspection.scss +133 -59
  36. package/core/theming/_m2-inspection.scss +268 -0
  37. package/core/theming/_theming.scss +59 -20
  38. package/core/tokens/m2/mat/_autocomplete.scss +5 -8
  39. package/core/tokens/m2/mat/_badge.scss +12 -15
  40. package/core/tokens/m2/mat/_bottom-sheet.scss +11 -17
  41. package/core/tokens/m2/mat/_card.scss +15 -21
  42. package/core/tokens/m2/mat/_datepicker.scss +28 -38
  43. package/core/tokens/m2/mat/_divider.scss +5 -8
  44. package/core/tokens/m2/mat/_expansion.scss +24 -28
  45. package/core/tokens/m2/mat/_form-field.scss +21 -25
  46. package/core/tokens/m2/mat/_grid-list.scss +8 -8
  47. package/core/tokens/m2/mat/_icon.scss +3 -3
  48. package/core/tokens/m2/mat/_legacy-button-toggle.scss +15 -19
  49. package/core/tokens/m2/mat/_menu.scss +12 -17
  50. package/core/tokens/m2/mat/_optgroup.scss +12 -17
  51. package/core/tokens/m2/mat/_option.scss +16 -28
  52. package/core/tokens/m2/mat/_paginator.scss +16 -18
  53. package/core/tokens/m2/mat/_radio.scss +7 -10
  54. package/core/tokens/m2/mat/_select.scss +15 -29
  55. package/core/tokens/m2/mat/_sidenav.scss +12 -14
  56. package/core/tokens/m2/mat/_slide-toggle.scss +9 -17
  57. package/core/tokens/m2/mat/_slider.scss +5 -5
  58. package/core/tokens/m2/mat/_snack-bar.scss +7 -8
  59. package/core/tokens/m2/mat/_standard-button-toggle.scss +23 -22
  60. package/core/tokens/m2/mat/_stepper.scss +30 -33
  61. package/core/tokens/m2/mat/_tab-header-with-background.scss +6 -8
  62. package/core/tokens/m2/mat/_tab-header.scss +13 -18
  63. package/core/tokens/m2/mat/_table.scss +19 -23
  64. package/core/tokens/m2/mat/_toolbar.scss +12 -16
  65. package/core/tokens/m2/mdc/_checkbox.scss +21 -20
  66. package/core/tokens/m2/mdc/_chip.scss +38 -24
  67. package/core/tokens/m2/mdc/_circular-progress.scss +5 -6
  68. package/core/tokens/m2/mdc/_dialog.scss +16 -30
  69. package/core/tokens/m2/mdc/_elevated-card.scss +6 -9
  70. package/core/tokens/m2/mdc/_extended-fab.scss +8 -17
  71. package/core/tokens/m2/mdc/_fab.scss +6 -7
  72. package/core/tokens/m2/mdc/_filled-text-field.scss +16 -22
  73. package/core/tokens/m2/mdc/_icon-button.scss +3 -3
  74. package/core/tokens/m2/mdc/_linear-progress.scss +9 -10
  75. package/core/tokens/m2/mdc/_list.scss +44 -42
  76. package/core/tokens/m2/mdc/_outlined-card.scss +7 -10
  77. package/core/tokens/m2/mdc/_outlined-text-field.scss +14 -20
  78. package/core/tokens/m2/mdc/_plain-tooltip.scss +9 -22
  79. package/core/tokens/m2/mdc/_radio.scss +11 -11
  80. package/core/tokens/m2/mdc/_slider.scss +16 -23
  81. package/core/tokens/m2/mdc/_snack-bar.scss +10 -23
  82. package/core/tokens/m2/mdc/_switch.scss +16 -19
  83. package/core/tokens/m2/mdc/_tab-indicator.scss +5 -8
  84. package/core/tokens/m2/mdc/_tab.scss +5 -4
  85. package/core/typography/_all-typography.scss +44 -47
  86. package/core/typography/_definition.scss +258 -0
  87. package/core/typography/_property-getters.scss +63 -0
  88. package/core/typography/_typography-utils.scss +9 -69
  89. package/core/typography/_typography.scss +38 -494
  90. package/core/typography/_versioning.scss +91 -0
  91. package/datepicker/_datepicker-theme.scss +20 -34
  92. package/datepicker/index.d.ts +3 -3
  93. package/dialog/_dialog-theme.scss +22 -23
  94. package/dialog/_mdc-dialog-structure-overrides.scss +12 -10
  95. package/dialog/index.d.ts +2 -0
  96. package/divider/_divider-theme.scss +12 -18
  97. package/esm2022/autocomplete/autocomplete-trigger.mjs +5 -17
  98. package/esm2022/autocomplete/autocomplete.mjs +23 -50
  99. package/esm2022/badge/badge.mjs +11 -29
  100. package/esm2022/button/button-base.mjs +32 -27
  101. package/esm2022/button/button.mjs +6 -6
  102. package/esm2022/button/fab.mjs +23 -31
  103. package/esm2022/button/icon-button.mjs +6 -6
  104. package/esm2022/button/testing/button-harness.mjs +3 -3
  105. package/esm2022/button-toggle/button-toggle.mjs +25 -33
  106. package/esm2022/checkbox/checkbox.mjs +32 -39
  107. package/esm2022/core/option/optgroup.mjs +10 -11
  108. package/esm2022/core/option/option.mjs +6 -6
  109. package/esm2022/core/testing/option-harness.mjs +3 -3
  110. package/esm2022/core/version.mjs +1 -1
  111. package/esm2022/datepicker/calendar.mjs +1 -1
  112. package/esm2022/datepicker/datepicker-base.mjs +2 -2
  113. package/esm2022/datepicker/datepicker-toggle.mjs +1 -1
  114. package/esm2022/datepicker/month-view.mjs +2 -2
  115. package/esm2022/datepicker/multi-year-view.mjs +2 -2
  116. package/esm2022/datepicker/year-view.mjs +2 -2
  117. package/esm2022/dialog/dialog-container.mjs +16 -3
  118. package/esm2022/form-field/form-field.mjs +3 -3
  119. package/esm2022/menu/menu-item.mjs +15 -11
  120. package/esm2022/menu/menu.mjs +9 -22
  121. package/esm2022/paginator/paginator.mjs +1 -1
  122. package/esm2022/select/select.mjs +3 -3
  123. package/esm2022/slide-toggle/slide-toggle.mjs +33 -37
  124. package/esm2022/slider/slider-input.mjs +19 -9
  125. package/esm2022/slider/slider.mjs +2 -2
  126. package/esm2022/snack-bar/simple-snack-bar.mjs +1 -1
  127. package/esm2022/tabs/tab-group.mjs +3 -3
  128. package/expansion/_expansion-theme.scss +16 -24
  129. package/fesm2022/autocomplete.mjs +25 -63
  130. package/fesm2022/autocomplete.mjs.map +1 -1
  131. package/fesm2022/badge.mjs +11 -28
  132. package/fesm2022/badge.mjs.map +1 -1
  133. package/fesm2022/button/testing.mjs +2 -2
  134. package/fesm2022/button/testing.mjs.map +1 -1
  135. package/fesm2022/button-toggle.mjs +25 -32
  136. package/fesm2022/button-toggle.mjs.map +1 -1
  137. package/fesm2022/button.mjs +59 -61
  138. package/fesm2022/button.mjs.map +1 -1
  139. package/fesm2022/checkbox.mjs +31 -38
  140. package/fesm2022/checkbox.mjs.map +1 -1
  141. package/fesm2022/core/testing.mjs +2 -2
  142. package/fesm2022/core/testing.mjs.map +1 -1
  143. package/fesm2022/core.mjs +14 -13
  144. package/fesm2022/core.mjs.map +1 -1
  145. package/fesm2022/datepicker.mjs +6 -6
  146. package/fesm2022/datepicker.mjs.map +1 -1
  147. package/fesm2022/dialog.mjs +15 -2
  148. package/fesm2022/dialog.mjs.map +1 -1
  149. package/fesm2022/form-field.mjs +2 -2
  150. package/fesm2022/form-field.mjs.map +1 -1
  151. package/fesm2022/menu.mjs +23 -31
  152. package/fesm2022/menu.mjs.map +1 -1
  153. package/fesm2022/paginator.mjs +1 -1
  154. package/fesm2022/paginator.mjs.map +1 -1
  155. package/fesm2022/select.mjs +2 -2
  156. package/fesm2022/select.mjs.map +1 -1
  157. package/fesm2022/slide-toggle.mjs +33 -36
  158. package/fesm2022/slide-toggle.mjs.map +1 -1
  159. package/fesm2022/slider.mjs +20 -10
  160. package/fesm2022/slider.mjs.map +1 -1
  161. package/fesm2022/snack-bar.mjs +1 -1
  162. package/fesm2022/snack-bar.mjs.map +1 -1
  163. package/fesm2022/tabs.mjs +2 -2
  164. package/fesm2022/tabs.mjs.map +1 -1
  165. package/form-field/_form-field-density.scss +3 -4
  166. package/form-field/_form-field-focus-overlay.scss +1 -1
  167. package/form-field/_form-field-sizing.scss +1 -1
  168. package/form-field/_form-field-theme.scss +24 -34
  169. package/grid-list/_grid-list-theme.scss +12 -19
  170. package/icon/_icon-theme.scss +17 -25
  171. package/input/_input-theme.scss +11 -23
  172. package/list/_list-theme.scss +27 -42
  173. package/menu/_menu-theme.scss +13 -22
  174. package/menu/index.d.ts +12 -18
  175. package/package.json +2 -2
  176. package/paginator/_paginator-theme.scss +15 -24
  177. package/prebuilt-themes/deeppurple-amber.css +1 -1
  178. package/prebuilt-themes/indigo-pink.css +1 -1
  179. package/prebuilt-themes/pink-bluegrey.css +1 -1
  180. package/prebuilt-themes/purple-green.css +1 -1
  181. package/progress-bar/_progress-bar-theme.scss +17 -24
  182. package/progress-spinner/_progress-spinner-theme.scss +18 -24
  183. package/radio/_radio-theme.scss +23 -38
  184. package/schematics/ng-add/index.js +1 -1
  185. package/schematics/ng-add/index.mjs +1 -1
  186. package/schematics/ng-generate/mdc-migration/index_bundled.js +44 -44
  187. package/schematics/ng-generate/mdc-migration/index_bundled.js.map +1 -1
  188. package/schematics/ng-update/index_bundled.js +25 -25
  189. package/select/_select-theme.scss +17 -31
  190. package/sidenav/_sidenav-theme.scss +12 -18
  191. package/slide-toggle/_slide-toggle-theme.scss +23 -40
  192. package/slide-toggle/index.d.ts +20 -23
  193. package/slider/_slider-theme.scss +25 -42
  194. package/snack-bar/_snack-bar-theme.scss +17 -26
  195. package/sort/_sort-theme.scss +13 -22
  196. package/stepper/_stepper-theme.scss +16 -34
  197. package/table/_table-theme.scss +14 -25
  198. package/tabs/_tabs-theme.scss +31 -45
  199. package/toolbar/_toolbar-theme.scss +22 -31
  200. package/tooltip/_tooltip-theme.scss +15 -23
  201. package/tree/_tree-theme.scss +20 -29
  202. package/button-toggle/_button-toggle-variables.scss +0 -16
  203. package/core/typography/_typography-deprecated.scss +0 -39
  204. package/paginator/_paginator-variables.scss +0 -15
@@ -1,9 +1,8 @@
1
1
  @use 'sass:map';
2
2
  @use '../../token-utils';
3
3
  @use '../../../style/sass-utils';
4
- @use '../../../theming/theming';
4
+ @use '../../../theming/inspection';
5
5
  @use '../../../theming/palette';
6
- @use '../../../typography/typography-utils';
7
6
 
8
7
  // The prefix used to generate the fully qualified name for tokens in this file.
9
8
  $prefix: (mat, form-field);
@@ -15,17 +14,16 @@ $prefix: (mat, form-field);
15
14
  }
16
15
 
17
16
  // Tokens that can be configured through Angular Material's color theming API.
18
- @function get-color-tokens($config) {
19
- $warn: map.get($config, warn);
20
- $is-dark: map.get($config, is-dark);
17
+ @function get-color-tokens($theme) {
18
+ $is-dark: inspection.get-theme-type($theme) == dark;
21
19
  $on-surface: if($is-dark, #fff, #000);
22
- $color-tokens: private-get-color-palette-color-tokens($config, primary);
20
+ $color-tokens: private-get-color-palette-color-tokens($theme, primary);
23
21
 
24
22
  @return map.merge($color-tokens, (
25
23
  // MDC has a token for the enabled placeholder, but not for the disabled one.
26
24
  disabled-input-text-placeholder-color: rgba($on-surface, 0.38),
27
25
  state-layer-color: rgba($on-surface, 0.87),
28
- error-text-color: theming.get-color-from-palette($warn),
26
+ error-text-color: inspection.get-theme-color($theme, warn),
29
27
 
30
28
  // On dark themes we set the native `select` color to some shade of white,
31
29
  // however the color propagates to all of the `option` elements, which are
@@ -48,27 +46,25 @@ $prefix: (mat, form-field);
48
46
  }
49
47
 
50
48
  // Generates the mapping for the properties that change based on the form field color.
51
- @function private-get-color-palette-color-tokens($config, $palette-name) {
52
- $palette: map.get($config, $palette-name);
49
+ @function private-get-color-palette-color-tokens($theme, $palette-name) {
50
+ $palette-color: inspection.get-theme-color($theme, $palette-name);
53
51
 
54
52
  @return (
55
- focus-select-arrow-color: theming.get-color-from-palette($palette, default, 0.87),
53
+ focus-select-arrow-color: sass-utils.safe-color-change($palette-color, $alpha: 0.87),
56
54
  );
57
55
  }
58
56
 
59
57
  // Tokens that can be configured through Angular Material's typography theming API.
60
- @function get-typography-tokens($config) {
61
- $fallback-font-family: typography-utils.font-family($config);
62
-
58
+ @function get-typography-tokens($theme) {
63
59
  @return (
64
60
  // MDC uses `subtitle1` for the input value, placeholder and floating label. The spec
65
61
  // shows `body1` for text fields though, so we manually override the typography.
66
62
  // Note: Form controls inherit the typography from the parent form field.
67
- container-text-font: typography-utils.font-family($config, body-1) or $fallback-font-family,
68
- container-text-line-height: typography-utils.line-height($config, body-1),
69
- container-text-size: typography-utils.font-size($config, body-1),
70
- container-text-tracking: typography-utils.letter-spacing($config, body-1),
71
- container-text-weight: typography-utils.font-weight($config, body-1),
63
+ container-text-font: inspection.get-theme-typography($theme, body-1, font-family),
64
+ container-text-line-height: inspection.get-theme-typography($theme, body-1, line-height),
65
+ container-text-size: inspection.get-theme-typography($theme, body-1, font-size),
66
+ container-text-tracking: inspection.get-theme-typography($theme, body-1, letter-spacing),
67
+ container-text-weight: inspection.get-theme-typography($theme, body-1, font-weight),
72
68
 
73
69
  // In the container styles, we updated the floating label to use the `body-1` typography level.
74
70
  // The MDC notched outline overrides this accidentally (only when the label floats) to a
@@ -78,18 +74,18 @@ $prefix: (mat, form-field);
78
74
  // https://github.com/material-components/material-components-web/blob/master/packages/mdc-notched-outline/_mixins.scss#L272-L292.
79
75
  // This is why we can't use their `label-text-populated-size` token and we have to declare
80
76
  // our own version of it.
81
- outlined-label-text-populated-size: typography-utils.font-size($config, body-1),
77
+ outlined-label-text-populated-size: inspection.get-theme-typography($theme, body-1, font-size),
82
78
 
83
- subscript-text-font: typography-utils.font-family($config, caption) or $fallback-font-family,
84
- subscript-text-line-height: typography-utils.line-height($config, caption),
85
- subscript-text-size: typography-utils.font-size($config, caption),
86
- subscript-text-tracking: typography-utils.letter-spacing($config, caption),
87
- subscript-text-weight: typography-utils.font-weight($config, caption),
79
+ subscript-text-font: inspection.get-theme-typography($theme, caption, font-family),
80
+ subscript-text-line-height: inspection.get-theme-typography($theme, caption, line-height),
81
+ subscript-text-size: inspection.get-theme-typography($theme, caption, font-size),
82
+ subscript-text-tracking: inspection.get-theme-typography($theme, caption, letter-spacing),
83
+ subscript-text-weight: inspection.get-theme-typography($theme, caption, font-weight),
88
84
  );
89
85
  }
90
86
 
91
87
  // Tokens that can be configured through Angular Material's density theming API.
92
- @function get-density-tokens($config) {
88
+ @function get-density-tokens($theme) {
93
89
  @return ();
94
90
  }
95
91
 
@@ -1,5 +1,5 @@
1
1
  @use '../../token-utils';
2
- @use '../../../typography/typography-utils';
2
+ @use '../../../theming/inspection';
3
3
  @use '../../../style/sass-utils';
4
4
 
5
5
  // The prefix used to generate the fully qualified name for tokens in this file.
@@ -12,25 +12,25 @@ $prefix: (mat, grid-list);
12
12
  }
13
13
 
14
14
  // Tokens that can be configured through Angular Material's color theming API.
15
- @function get-color-tokens($config) {
15
+ @function get-color-tokens($theme) {
16
16
  @return ();
17
17
  }
18
18
 
19
19
  // Tokens that can be configured through Angular Material's typography theming API.
20
- @function get-typography-tokens($config) {
20
+ @function get-typography-tokens($theme) {
21
21
  @return (
22
22
  // TODO(crisbeto): other components have tokens for all typography dimensions.
23
23
  // Here we only set the font size to maintain the same appearance as the pre-tokens
24
24
  // theming API. Consider adding more tokens for letter spacing, font weight etc.
25
- tile-header-primary-text-size: typography-utils.font-size($config, body-1),
26
- tile-header-secondary-text-size: typography-utils.font-size($config, caption),
27
- tile-footer-primary-text-size: typography-utils.font-size($config, body-1),
28
- tile-footer-secondary-text-size: typography-utils.font-size($config, caption),
25
+ tile-header-primary-text-size: inspection.get-theme-typography($theme, body-2, font-size),
26
+ tile-header-secondary-text-size: inspection.get-theme-typography($theme, caption, font-size),
27
+ tile-footer-primary-text-size: inspection.get-theme-typography($theme, body-2, font-size),
28
+ tile-footer-secondary-text-size: inspection.get-theme-typography($theme, caption, font-size),
29
29
  );
30
30
  }
31
31
 
32
32
  // Tokens that can be configured through Angular Material's density theming API.
33
- @function get-density-tokens($config) {
33
+ @function get-density-tokens($theme) {
34
34
  @return ();
35
35
  }
36
36
 
@@ -11,18 +11,18 @@ $prefix: (mat, icon);
11
11
  }
12
12
 
13
13
  // Tokens that can be configured through Angular Material's color theming API.
14
- @function get-color-tokens($config) {
14
+ @function get-color-tokens($theme) {
15
15
  // Default the icon to `inherit` so it matches the text around it.
16
16
  @return private-get-icon-color-tokens(inherit);
17
17
  }
18
18
 
19
19
  // Tokens that can be configured through Angular Material's typography theming API.
20
- @function get-typography-tokens($config) {
20
+ @function get-typography-tokens($theme) {
21
21
  @return ();
22
22
  }
23
23
 
24
24
  // Tokens that can be configured through Angular Material's density theming API.
25
- @function get-density-tokens($config) {
25
+ @function get-density-tokens($theme) {
26
26
  @return ();
27
27
  }
28
28
 
@@ -1,7 +1,5 @@
1
- @use 'sass:map';
2
1
  @use '../../token-utils';
3
- @use '../../../typography/typography-utils';
4
- @use '../../../theming/theming';
2
+ @use '../../../theming/inspection';
5
3
  @use '../../../style/sass-utils';
6
4
 
7
5
  // The prefix used to generate the fully qualified name for tokens in this file.
@@ -18,36 +16,34 @@ $prefix: (mat, legacy-button-toggle);
18
16
  }
19
17
 
20
18
  // Tokens that can be configured through Angular Material's color theming API.
21
- @function get-color-tokens($config) {
22
- $foreground: map.get($config, foreground);
23
- $background: map.get($config, background);
24
-
19
+ @function get-color-tokens($theme) {
25
20
  @return (
26
- text-color: theming.get-color-from-palette($foreground, hint-text),
27
- state-layer-color: theming.get-color-from-palette($background, focused-button),
28
- selected-state-text-color: theming.get-color-from-palette($foreground, secondary-text),
29
- selected-state-background-color: theming.get-color-from-palette($background, selected-button),
30
- disabled-state-text-color: theming.get-color-from-palette($foreground, disabled-button),
31
- disabled-state-background-color:
32
- theming.get-color-from-palette($background, disabled-button-toggle),
33
- disabled-selected-state-background-color:
34
- theming.get-color-from-palette($background, selected-disabled-button)
21
+ text-color: inspection.get-theme-color($theme, foreground, hint-text),
22
+ state-layer-color: inspection.get-theme-color($theme, background, focused-button),
23
+ selected-state-text-color: inspection.get-theme-color($theme, foreground, secondary-text),
24
+ selected-state-background-color: inspection.get-theme-color(
25
+ $theme, background, selected-button),
26
+ disabled-state-text-color: inspection.get-theme-color($theme, foreground, disabled-button),
27
+ disabled-state-background-color: inspection.get-theme-color(
28
+ $theme, background, disabled-button-toggle),
29
+ disabled-selected-state-background-color: inspection.get-theme-color(
30
+ $theme, background, selected-disabled-button)
35
31
  );
36
32
  }
37
33
 
38
34
  // Tokens that can be configured through Angular Material's typography theming API.
39
- @function get-typography-tokens($config) {
35
+ @function get-typography-tokens($theme) {
40
36
  @return (
41
37
  // TODO(crisbeto): other components have tokens for all typography dimensions (font weight,
42
38
  // letter spacing etc). The button toggle only has the font to match what it had in the
43
39
  // old theming API and to reduce internal breakages. We should introduce more typography
44
40
  // tokens at some point.
45
- text-font: typography-utils.font-family($config),
41
+ text-font: inspection.get-theme-typography($theme, body-1, font-family),
46
42
  );
47
43
  }
48
44
 
49
45
  // Tokens that can be configured through Angular Material's density theming API.
50
- @function get-density-tokens($config) {
46
+ @function get-density-tokens($theme) {
51
47
  @return ();
52
48
  }
53
49
 
@@ -1,8 +1,6 @@
1
- @use 'sass:map';
2
1
  @use '../../token-utils';
3
- @use '../../../theming/theming';
2
+ @use '../../../theming/inspection';
4
3
  @use '../../../style/sass-utils';
5
- @use '../../../typography/typography-utils';
6
4
 
7
5
  // The prefix used to generate the fully qualified name for tokens in this file.
8
6
  $prefix: (mat, menu);
@@ -16,37 +14,34 @@ $prefix: (mat, menu);
16
14
  }
17
15
 
18
16
  // Tokens that can be configured through Angular Material's color theming API.
19
- @function get-color-tokens($config) {
20
- $is-dark: map.get($config, is-dark);
21
- $foreground: map.get($config, foreground);
22
- $background: map.get($config, background);
17
+ @function get-color-tokens($theme) {
18
+ $is-dark: inspection.get-theme-type($theme) == dark;
23
19
  $on-surface: if($is-dark, #fff, #000);
24
20
  $active-state-layer-color: rgba($on-surface, if($is-dark, 0.08, 0.04));
25
- $text-color: theming.get-color-from-palette($foreground, text);
21
+ $text-color: inspection.get-theme-color($theme, foreground, text);
26
22
 
27
23
  @return (
28
24
  item-label-text-color: $text-color,
29
25
  item-icon-color: $text-color,
30
26
  item-hover-state-layer-color: $active-state-layer-color,
31
27
  item-focus-state-layer-color: $active-state-layer-color,
32
- container-color: theming.get-color-from-palette($background, card),
28
+ container-color: inspection.get-theme-color($theme, background, card),
33
29
  );
34
30
  }
35
31
 
36
32
  // Tokens that can be configured through Angular Material's typography theming API.
37
- @function get-typography-tokens($config) {
33
+ @function get-typography-tokens($theme) {
38
34
  @return (
39
- item-label-text-font:
40
- typography-utils.font-family($config, body-1) or typography-utils.font-family($config),
41
- item-label-text-size: typography-utils.font-size($config, body-1),
42
- item-label-text-tracking: typography-utils.letter-spacing($config, body-1),
43
- item-label-text-line-height: typography-utils.line-height($config, body-1),
44
- item-label-text-weight: typography-utils.font-weight($config, body-1),
35
+ item-label-text-font: inspection.get-theme-typography($theme, body-1, font-family),
36
+ item-label-text-size: inspection.get-theme-typography($theme, body-1, font-size),
37
+ item-label-text-tracking: inspection.get-theme-typography($theme, body-1, letter-spacing),
38
+ item-label-text-line-height: inspection.get-theme-typography($theme, body-1, line-height),
39
+ item-label-text-weight: inspection.get-theme-typography($theme, body-1, font-weight),
45
40
  );
46
41
  }
47
42
 
48
43
  // Tokens that can be configured through Angular Material's density theming API.
49
- @function get-density-tokens($config) {
44
+ @function get-density-tokens($theme) {
50
45
  @return ();
51
46
  }
52
47
 
@@ -1,8 +1,6 @@
1
- @use 'sass:map';
2
1
  @use '../../token-utils';
3
- @use '../../../theming/theming';
2
+ @use '../../../theming/inspection';
4
3
  @use '../../../style/sass-utils';
5
- @use '../../../typography/typography-utils';
6
4
  @use '../../../mdc-helpers/mdc-helpers';
7
5
 
8
6
  // The prefix used to generate the fully qualified name for tokens in this file.
@@ -15,36 +13,33 @@ $prefix: (mat, optgroup);
15
13
  }
16
14
 
17
15
  // Tokens that can be configured through Angular Material's color theming API.
18
- @function get-color-tokens($config) {
19
- $foreground: map.get($config, foreground);
20
-
16
+ @function get-color-tokens($theme) {
21
17
  @return (
22
- label-text-color: theming.get-color-from-palette($foreground, text),
18
+ label-text-color: inspection.get-theme-color($theme, foreground, text),
23
19
  );
24
20
  }
25
21
 
26
22
  // Tokens that can be configured through Angular Material's typography theming API.
27
- @function get-typography-tokens($config) {
23
+ @function get-typography-tokens($theme) {
28
24
  // TODO(crisbeto): The earlier implementation of the option used MDC's APIs to create the
29
25
  // typography tokens. As a result, we unintentionally allowed `null` typography configs to be
30
26
  // passed in. Since there a lot of apps that now depend on this pattern, we need this temporary
31
27
  // fallback.
32
- @if ($config == null) {
33
- $config: mdc-helpers.private-fallback-typography-from-mdc();
28
+ @if ($theme == null) {
29
+ $theme: mdc-helpers.private-fallback-typography-from-mdc();
34
30
  }
35
31
 
36
32
  @return (
37
- label-text-font: typography-utils.font-family($config, body-1) or
38
- typography-utils.font-family($config),
39
- label-text-line-height: typography-utils.line-height($config, body-1),
40
- label-text-size: typography-utils.font-size($config, body-1),
41
- label-text-tracking: typography-utils.letter-spacing($config, body-1),
42
- label-text-weight: typography-utils.font-weight($config, body-1)
33
+ label-text-font: inspection.get-theme-typography($theme, body-1, font-family),
34
+ label-text-line-height: inspection.get-theme-typography($theme, body-1, line-height),
35
+ label-text-size: inspection.get-theme-typography($theme, body-1, font-size),
36
+ label-text-tracking: inspection.get-theme-typography($theme, body-1, letter-spacing),
37
+ label-text-weight: inspection.get-theme-typography($theme, body-1, font-weight)
43
38
  );
44
39
  }
45
40
 
46
41
  // Tokens that can be configured through Angular Material's density theming API.
47
- @function get-density-tokens($config) {
42
+ @function get-density-tokens($theme) {
48
43
  @return ();
49
44
  }
50
45
 
@@ -1,8 +1,6 @@
1
- @use 'sass:map';
2
1
  @use '../../token-utils';
3
- @use '../../../theming/theming';
2
+ @use '../../../theming/inspection';
4
3
  @use '../../../style/sass-utils';
5
- @use '../../../typography/typography-utils';
6
4
  @use '../../../mdc-helpers/mdc-helpers';
7
5
 
8
6
  // The prefix used to generate the fully qualified name for tokens in this file.
@@ -15,51 +13,41 @@ $prefix: (mat, option);
15
13
  }
16
14
 
17
15
  // Tokens that can be configured through Angular Material's color theming API.
18
- @function get-color-tokens($config) {
19
- $is-dark: map.get($config, is-dark);
20
- $foreground: map.get($config, foreground);
21
- $primary: map.get($config, primary);
16
+ @function get-color-tokens($theme, $palette-name: primary) {
17
+ $is-dark: inspection.get-theme-type($theme) == dark;
22
18
  $on-surface: if($is-dark, #fff, #000);
23
19
  $active-state-layer-color: rgba($on-surface, if($is-dark, 0.08, 0.04));
24
- $palette-tokens: private-get-color-palette-color-tokens($primary);
25
20
 
26
- @return map.merge($palette-tokens, (
27
- label-text-color: theming.get-color-from-palette($foreground, text),
21
+ @return (
22
+ selected-state-label-text-color: inspection.get-theme-color($theme, $palette-name),
23
+ label-text-color: inspection.get-theme-color($theme, foreground, text),
28
24
  hover-state-layer-color: $active-state-layer-color,
29
25
  focus-state-layer-color: $active-state-layer-color,
30
26
  selected-state-layer-color: $active-state-layer-color,
31
- ));
27
+ );
32
28
  }
33
29
 
34
30
  // Tokens that can be configured through Angular Material's typography theming API.
35
- @function get-typography-tokens($config) {
31
+ @function get-typography-tokens($theme) {
36
32
  // TODO(crisbeto): The earlier implementation of the option used MDC's APIs to create the
37
33
  // typography tokens. As a result, we unintentionally allowed `null` typography configs to be
38
34
  // passed in. Since there a lot of apps that now depend on this pattern, we need this temporary
39
35
  // fallback.
40
- @if ($config == null) {
41
- $config: mdc-helpers.private-fallback-typography-from-mdc();
36
+ @if ($theme == null) {
37
+ $theme: mdc-helpers.private-fallback-typography-from-mdc();
42
38
  }
43
39
 
44
40
  @return (
45
- label-text-font: typography-utils.font-family($config, body-1) or
46
- typography-utils.font-family($config),
47
- label-text-line-height: typography-utils.line-height($config, body-1),
48
- label-text-size: typography-utils.font-size($config, body-1),
49
- label-text-tracking: typography-utils.letter-spacing($config, body-1),
50
- label-text-weight: typography-utils.font-weight($config, body-1)
51
- );
52
- }
53
-
54
- // Generates the tokens used to theme the option based on a palette.
55
- @function private-get-color-palette-color-tokens($palette) {
56
- @return (
57
- selected-state-label-text-color: theming.get-color-from-palette($palette),
41
+ label-text-font: inspection.get-theme-typography($theme, body-1, font-family),
42
+ label-text-line-height: inspection.get-theme-typography($theme, body-1, line-height),
43
+ label-text-size: inspection.get-theme-typography($theme, body-1, font-size),
44
+ label-text-tracking: inspection.get-theme-typography($theme, body-1, letter-spacing),
45
+ label-text-weight: inspection.get-theme-typography($theme, body-1, font-weight)
58
46
  );
59
47
  }
60
48
 
61
49
  // Tokens that can be configured through Angular Material's density theming API.
62
- @function get-density-tokens($config) {
50
+ @function get-density-tokens($theme) {
63
51
  @return ();
64
52
  }
65
53
 
@@ -1,7 +1,7 @@
1
1
  @use 'sass:map';
2
2
  @use '../../token-utils';
3
- @use '../../../typography/typography-utils';
4
3
  @use '../../../theming/theming';
4
+ @use '../../../theming/inspection';
5
5
  @use '../../../style/sass-utils';
6
6
 
7
7
  // The prefix used to generate the fully qualified name for tokens in this file.
@@ -14,34 +14,32 @@ $prefix: (mat, paginator);
14
14
  }
15
15
 
16
16
  // Tokens that can be configured through Angular Material's color theming API.
17
- @function get-color-tokens($config) {
18
- $foreground: map.get($config, foreground);
19
- $background: map.get($config, background);
17
+ @function get-color-tokens($theme) {
18
+ $foreground-base: inspection.get-theme-color($theme, foreground, base);
20
19
 
21
20
  @return (
22
- container-text-color: theming.get-color-from-palette($foreground, base, 0.87),
23
- container-background-color: theming.get-color-from-palette($background, card),
24
- enabled-icon-color: theming.get-color-from-palette($foreground, base, 0.54),
25
- disabled-icon-color: theming.get-color-from-palette($foreground, base, 0.12),
21
+ container-text-color: sass-utils.safe-color-change($foreground-base, $alpha: 0.87),
22
+ container-background-color: inspection.get-theme-color($theme, background, card),
23
+ enabled-icon-color: sass-utils.safe-color-change($foreground-base, $alpha: 0.54),
24
+ disabled-icon-color: sass-utils.safe-color-change($foreground-base, $alpha: 0.12),
26
25
  );
27
26
  }
28
27
 
29
28
  // Tokens that can be configured through Angular Material's typography theming API.
30
- @function get-typography-tokens($config) {
29
+ @function get-typography-tokens($theme) {
31
30
  @return (
32
- container-text-font: typography-utils.font-family($config, caption) or
33
- typography-utils.font-family($config),
34
- container-text-line-height: typography-utils.line-height($config, caption),
35
- container-text-size: typography-utils.font-size($config, caption),
36
- container-text-tracking: typography-utils.letter-spacing($config, caption),
37
- container-text-weight: typography-utils.font-weight($config, caption),
38
- select-trigger-text-size: typography-utils.font-size($config, caption),
31
+ container-text-font: inspection.get-theme-typography($theme, caption, font-family),
32
+ container-text-line-height: inspection.get-theme-typography($theme, caption, line-height),
33
+ container-text-size: inspection.get-theme-typography($theme, caption, font-size),
34
+ container-text-tracking: inspection.get-theme-typography($theme, caption, letter-spacing),
35
+ container-text-weight: inspection.get-theme-typography($theme, caption, font-weight),
36
+ select-trigger-text-size: inspection.get-theme-typography($theme, caption, font-size),
39
37
  );
40
38
  }
41
39
 
42
40
  // Tokens that can be configured through Angular Material's density theming API.
43
- @function get-density-tokens($config) {
44
- $density-scale: theming.clamp-density($config, -3);
41
+ @function get-density-tokens($theme) {
42
+ $density-scale: theming.clamp-density(inspection.get-theme-density($theme), -3);
45
43
  $size-scale: (
46
44
  0: 56px,
47
45
  -1: 52px,
@@ -1,6 +1,5 @@
1
- @use 'sass:map';
2
1
  @use '../../token-utils';
3
- @use '../../../theming/theming';
2
+ @use '../../../theming/inspection';
4
3
  @use '../../../style/sass-utils';
5
4
 
6
5
  // The prefix used to generate the fully qualified name for tokens in this file.
@@ -13,25 +12,23 @@ $prefix: (mat, radio);
13
12
  }
14
13
 
15
14
  // Tokens that can be configured through Angular Material's color theming API.
16
- @function get-color-tokens($config) {
17
- $foreground: map.get($config, foreground);
18
- $is-dark: map.get($config, is-dark);
19
- $accent: map.get($config, accent);
15
+ @function get-color-tokens($theme, $palette-name: accent) {
16
+ $is-dark: inspection.get-theme-type($theme) == dark;
20
17
 
21
18
  @return (
22
19
  ripple-color: if($is-dark, #fff, #000),
23
- checked-ripple-color: theming.get-color-from-palette($accent, default),
24
- disabled-label-color: theming.get-color-from-palette($foreground, disabled-text),
20
+ checked-ripple-color: inspection.get-theme-color($theme, $palette-name, default),
21
+ disabled-label-color: inspection.get-theme-color($theme, foreground, disabled-text),
25
22
  );
26
23
  }
27
24
 
28
25
  // Tokens that can be configured through Angular Material's typography theming API.
29
- @function get-typography-tokens($config) {
26
+ @function get-typography-tokens($theme) {
30
27
  @return ();
31
28
  }
32
29
 
33
30
  // Tokens that can be configured through Angular Material's density theming API.
34
- @function get-density-tokens($config) {
31
+ @function get-density-tokens($theme) {
35
32
  @return ();
36
33
  }
37
34
 
@@ -1,8 +1,5 @@
1
- @use 'sass:map';
2
1
  @use '../../token-utils';
3
- @use '../../../typography/typography-utils';
4
- @use '../../../mdc-helpers/mdc-helpers';
5
- @use '../../../theming/theming';
2
+ @use '../../../theming/inspection';
6
3
  @use '../../../style/sass-utils';
7
4
 
8
5
  // The prefix used to generate the fully qualified name for tokens in this file.
@@ -15,48 +12,37 @@ $prefix: (mat, select);
15
12
  }
16
13
 
17
14
  // Tokens that can be configured through Angular Material's color theming API.
18
- @function get-color-tokens($config) {
19
- $is-dark: map.get($config, is-dark);
20
- $foreground: map.get($config, foreground);
21
- $background: map.get($config, background);
22
- $primary: map.get($config, primary);
23
- $warn: map.get($config, warn);
15
+ @function get-color-tokens($theme, $palette-name: primary) {
16
+ $is-dark: inspection.get-theme-type($theme) == dark;
24
17
  $on-surface: if($is-dark, #fff, #000);
25
18
 
26
19
  @return (
27
- panel-background-color: theming.get-color-from-palette($background, card),
20
+ panel-background-color: inspection.get-theme-color($theme, background, card),
28
21
  enabled-trigger-text-color: rgba($on-surface, 0.87),
29
22
  disabled-trigger-text-color: rgba($on-surface, 0.38),
30
23
  placeholder-text-color: rgba($on-surface, 0.6),
31
24
  enabled-arrow-color: rgba($on-surface, 0.54),
32
25
  disabled-arrow-color: rgba($on-surface, 0.38),
33
- focused-arrow-color: theming.get-color-from-palette($primary, default, 0.87),
34
- invalid-arrow-color: theming.get-color-from-palette($warn, default, 0.87),
26
+ focused-arrow-color: sass-utils.safe-color-change(
27
+ inspection.get-theme-color($theme, $palette-name, default), $alpha: 0.87),
28
+ invalid-arrow-color: sass-utils.safe-color-change(
29
+ inspection.get-theme-color($theme, warn, default), $alpha: 0.87),
35
30
  );
36
31
  }
37
32
 
38
33
  // Tokens that can be configured through Angular Material's typography theming API.
39
- @function get-typography-tokens($config) {
40
- // TODO(crisbeto): The earlier implementation of the select used MDC's APIs to create the
41
- // typography tokens. As a result, we unintentionally allowed `null` typography configs to be
42
- // passed in. Since there a lot of apps that now depend on this pattern, we need this temporary
43
- // fallback.
44
- @if ($config == null) {
45
- $config: mdc-helpers.private-fallback-typography-from-mdc();
46
- }
47
-
34
+ @function get-typography-tokens($theme) {
48
35
  @return (
49
- trigger-text-font: typography-utils.font-family($config, body-1) or
50
- typography-utils.font-family($config),
51
- trigger-text-line-height: typography-utils.line-height($config, body-1),
52
- trigger-text-size: typography-utils.font-size($config, body-1),
53
- trigger-text-tracking: typography-utils.letter-spacing($config, body-1),
54
- trigger-text-weight: typography-utils.font-weight($config, body-1)
36
+ trigger-text-font: inspection.get-theme-typography($theme, body-1, font-family),
37
+ trigger-text-line-height: inspection.get-theme-typography($theme, body-1, line-height),
38
+ trigger-text-size: inspection.get-theme-typography($theme, body-1, font-size),
39
+ trigger-text-tracking: inspection.get-theme-typography($theme, body-1, letter-spacing),
40
+ trigger-text-weight: inspection.get-theme-typography($theme, body-1, font-weight)
55
41
  );
56
42
  }
57
43
 
58
44
  // Tokens that can be configured through Angular Material's density theming API.
59
- @function get-density-tokens($config) {
45
+ @function get-density-tokens($theme) {
60
46
  @return ();
61
47
  }
62
48