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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/_index.scss +1 -2
  2. package/autocomplete/_autocomplete-theme.scss +28 -37
  3. package/autocomplete/_m2-autocomplete.scss +10 -22
  4. package/badge/_badge-theme.scss +35 -44
  5. package/badge/_m2-badge.scss +46 -59
  6. package/bottom-sheet/_bottom-sheet-theme.scss +28 -40
  7. package/bottom-sheet/_m2-bottom-sheet.scss +16 -33
  8. package/button/_button-theme.scss +37 -55
  9. package/button/_fab-theme.scss +42 -56
  10. package/button/_icon-button-theme.scss +33 -49
  11. package/button/_m2-button.scss +135 -158
  12. package/button/_m2-fab.scss +60 -69
  13. package/button/_m2-icon-button.scss +30 -50
  14. package/button/_m3-button.scss +1 -2
  15. package/button/_m3-fab.scss +1 -2
  16. package/button/_m3-icon-button.scss +1 -2
  17. package/button/testing/index.d.ts +1 -0
  18. package/button-toggle/_button-toggle-theme.scss +29 -44
  19. package/button-toggle/_m2-button-toggle.scss +58 -81
  20. package/button-toggle/_m3-button-toggle.scss +1 -2
  21. package/card/_card-theme.scss +28 -36
  22. package/card/_m2-card.scss +30 -45
  23. package/checkbox/_checkbox-theme.scss +37 -50
  24. package/checkbox/_m2-checkbox.scss +30 -40
  25. package/checkbox/_m3-checkbox.scss +1 -2
  26. package/chips/_chips-theme.scss +27 -30
  27. package/chips/_m2-chip.scss +40 -53
  28. package/chips/_m3-chip.scss +1 -2
  29. package/core/_core-theme.scss +48 -67
  30. package/core/_m2-app.scss +11 -23
  31. package/core/focus-indicators/_private.scss +2 -5
  32. package/core/m2/_theming.scss +36 -41
  33. package/core/option/_m2-optgroup.scss +13 -25
  34. package/core/option/_m2-option.scss +16 -22
  35. package/core/option/_optgroup-theme.scss +28 -30
  36. package/core/option/_option-theme.scss +35 -34
  37. package/core/ripple/_m2-ripple.scss +8 -20
  38. package/core/ripple/_ripple-theme.scss +28 -33
  39. package/core/selection/pseudo-checkbox/_m2-pseudo-checkbox.scss +14 -21
  40. package/core/selection/pseudo-checkbox/_pseudo-checkbox-theme.scss +55 -45
  41. package/core/theming/_all-theme.scss +38 -42
  42. package/core/theming/_definition.scss +22 -13
  43. package/core/theming/_inspection.scss +0 -12
  44. package/core/theming/_m2-inspection.scss +0 -33
  45. package/core/theming/_theming.scss +4 -172
  46. package/core/tokens/_m2-utils.scss +16 -68
  47. package/core/tokens/_m3-utils.scss +2 -14
  48. package/core/tokens/_token-utils.scss +7 -27
  49. package/core/tokens/m2/_index.scss +6 -0
  50. package/core/tokens/m2/_md-sys-color.scss +123 -0
  51. package/core/tokens/m2/_md-sys-elevation.scss +16 -0
  52. package/core/tokens/m2/_md-sys-motion.scss +36 -0
  53. package/core/tokens/m2/_md-sys-shape.scss +22 -0
  54. package/core/tokens/m2/_md-sys-state.scss +15 -0
  55. package/core/tokens/m2/_md-sys-typescale.scss +68 -0
  56. package/core/tokens/m3/_md-sys-color.scss +2 -2
  57. package/core/tokens/m3/_md-sys-typescale.scss +1 -1
  58. package/core/tokens/m3/_theme.scss +14 -26
  59. package/datepicker/_datepicker-theme.scss +38 -40
  60. package/datepicker/_m2-datepicker.scss +26 -40
  61. package/dialog/_dialog-theme.scss +28 -34
  62. package/dialog/_m2-dialog.scss +34 -48
  63. package/divider/_divider-theme.scss +28 -30
  64. package/divider/_m2-divider.scss +10 -21
  65. package/expansion/_expansion-theme.scss +28 -39
  66. package/expansion/_m2-expansion.scss +52 -67
  67. package/expansion/_m3-expansion.scss +3 -2
  68. package/fesm2022/autocomplete.mjs +1 -1
  69. package/fesm2022/button/testing.mjs +7 -4
  70. package/fesm2022/button/testing.mjs.map +1 -1
  71. package/fesm2022/chips.mjs +1 -1
  72. package/fesm2022/core.mjs +1 -1
  73. package/fesm2022/core.mjs.map +1 -1
  74. package/fesm2022/datepicker.mjs +1 -1
  75. package/fesm2022/expansion.mjs +2 -2
  76. package/fesm2022/expansion.mjs.map +1 -1
  77. package/fesm2022/{form-field-C9DZXojn.mjs → form-field-CFbrnFED.mjs} +3 -3
  78. package/fesm2022/{form-field-C9DZXojn.mjs.map → form-field-CFbrnFED.mjs.map} +1 -1
  79. package/fesm2022/form-field.mjs +2 -2
  80. package/fesm2022/input.mjs +3 -27
  81. package/fesm2022/input.mjs.map +1 -1
  82. package/fesm2022/menu/testing.mjs +97 -13
  83. package/fesm2022/menu/testing.mjs.map +1 -1
  84. package/fesm2022/menu.mjs +343 -122
  85. package/fesm2022/menu.mjs.map +1 -1
  86. package/fesm2022/{module-BDiw_nWS.mjs → module-B0CLRw5e.mjs} +3 -3
  87. package/fesm2022/{module-BDiw_nWS.mjs.map → module-B0CLRw5e.mjs.map} +1 -1
  88. package/fesm2022/{module-DzZHEh7B.mjs → module-B62K-792.mjs} +2 -2
  89. package/fesm2022/{module-DzZHEh7B.mjs.map → module-B62K-792.mjs.map} +1 -1
  90. package/fesm2022/paginator.mjs +3 -3
  91. package/fesm2022/select.mjs +3 -3
  92. package/fesm2022/sidenav.mjs +2 -4
  93. package/fesm2022/sidenav.mjs.map +1 -1
  94. package/fesm2022/slide-toggle.mjs +2 -2
  95. package/fesm2022/slide-toggle.mjs.map +1 -1
  96. package/fesm2022/snack-bar.mjs +2 -2
  97. package/fesm2022/timepicker.mjs +1 -1
  98. package/form-field/_form-field-theme.scss +35 -51
  99. package/form-field/_m2-form-field.scss +125 -146
  100. package/form-field/_m3-form-field.scss +1 -2
  101. package/grid-list/_grid-list-theme.scss +28 -28
  102. package/grid-list/_m2-grid-list.scss +16 -29
  103. package/icon/_icon-theme.scss +40 -41
  104. package/icon/_m2-icon.scss +7 -21
  105. package/input/_input-theme.scss +1 -4
  106. package/input/index.d.ts +0 -11
  107. package/list/_list-theme.scss +57 -53
  108. package/list/_m2-list.scss +84 -108
  109. package/list/_m3-list.scss +1 -2
  110. package/menu/_m2-menu.scss +33 -46
  111. package/menu/_menu-theme.scss +28 -33
  112. package/menu/index.d.ts +145 -61
  113. package/menu/testing/index.d.ts +50 -2
  114. package/package.json +2 -2
  115. package/paginator/_m2-paginator.scss +38 -58
  116. package/paginator/_m3-paginator.scss +1 -2
  117. package/paginator/_paginator-theme.scss +28 -33
  118. package/prebuilt-themes/deeppurple-amber.css +1 -1
  119. package/prebuilt-themes/indigo-pink.css +1 -1
  120. package/prebuilt-themes/pink-bluegrey.css +1 -1
  121. package/prebuilt-themes/purple-green.css +1 -1
  122. package/progress-bar/_m2-progress-bar.scss +11 -24
  123. package/progress-bar/_progress-bar-theme.scss +35 -43
  124. package/progress-spinner/_m2-progress-spinner.scss +9 -20
  125. package/progress-spinner/_progress-spinner-theme.scss +42 -43
  126. package/radio/_m2-radio.scss +30 -40
  127. package/radio/_m3-radio.scss +1 -2
  128. package/radio/_radio-theme.scss +33 -46
  129. package/schematics/ng-add/index.js +1 -1
  130. package/schematics/ng-generate/theme-color/schema.json +1 -1
  131. package/select/_m2-select.scss +23 -30
  132. package/select/_m3-select.scss +1 -2
  133. package/select/_select-theme.scss +38 -51
  134. package/sidenav/_m2-sidenav.scss +26 -36
  135. package/sidenav/_sidenav-theme.scss +28 -30
  136. package/slide-toggle/_m2-slide-toggle.scss +111 -143
  137. package/slide-toggle/_m3-slide-toggle.scss +1 -0
  138. package/slide-toggle/_slide-toggle-theme.scss +42 -80
  139. package/slider/_m2-slider.scss +34 -55
  140. package/slider/_slider-theme.scss +38 -45
  141. package/snack-bar/_m2-snack-bar.scss +16 -36
  142. package/snack-bar/_snack-bar-theme.scss +28 -31
  143. package/sort/_m2-sort.scss +7 -18
  144. package/sort/_sort-theme.scss +28 -33
  145. package/stepper/_m2-stepper.scss +39 -57
  146. package/stepper/_m3-stepper.scss +1 -2
  147. package/stepper/_stepper-theme.scss +41 -49
  148. package/table/_m2-table.scss +54 -72
  149. package/table/_m3-table.scss +1 -2
  150. package/table/_table-theme.scss +28 -36
  151. package/tabs/_m2-tabs.scss +31 -46
  152. package/tabs/_m3-tabs.scss +1 -2
  153. package/tabs/_tabs-theme.scss +41 -49
  154. package/timepicker/_m2-timepicker.scss +10 -22
  155. package/timepicker/_timepicker-theme.scss +28 -46
  156. package/toolbar/_m2-toolbar.scss +26 -46
  157. package/toolbar/_m3-toolbar.scss +1 -2
  158. package/toolbar/_toolbar-theme.scss +55 -46
  159. package/tooltip/_m2-tooltip.scss +16 -34
  160. package/tooltip/_tooltip-theme.scss +28 -37
  161. package/tree/_m2-tree.scss +21 -38
  162. package/tree/_m3-tree.scss +1 -2
  163. package/tree/_tree-theme.scss +28 -38
  164. package/core/tokens/_format-tokens.scss +0 -5
@@ -1,32 +1,44 @@
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
- //
10
- // Tokens that are available in MDC, but not used in Angular Material should be mapped to `null`.
11
- // `null` indicates that we are intentionally choosing not to emit a slot or value for the token in
12
- // our CSS.
13
- @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), -4);
9
+
14
10
  @return (
15
- // This is specified both here and in the density tokens, because it determines the size of the
16
- // tab itself and there are internal tests who don't configure the theme correctly.
17
- tab-container-height: 48px,
18
- // For some period of time, the MDC tabs removed the divider. This has been added back in
19
- // and will be present in M3.
20
- tab-divider-color: transparent,
21
- tab-divider-height: 0,
22
- tab-active-indicator-height: 2px,
23
- // Currently set to zero, but used by the gmat styles to make the indicator rounded.
24
- tab-active-indicator-shape: 0,
11
+ base: (
12
+ // This is specified both here and in the density tokens, because it determines the size of
13
+ // the tab itself and there are internal tests who don't configure the theme correctly.
14
+ tab-container-height: 48px,
15
+ tab-divider-color: transparent,
16
+ tab-divider-height: 0,
17
+ tab-active-indicator-height: 2px,
18
+ tab-active-indicator-shape: 0,
19
+ ),
20
+ color: private-get-color-palette-color-tokens($theme, primary),
21
+ typography: (
22
+ tab-label-text-font: map.get($system, label-small-font),
23
+ tab-label-text-size: map.get($system, label-small-size),
24
+ tab-label-text-tracking: map.get($system, label-small-tracking),
25
+ tab-label-text-line-height: map.get($system, label-small-line-height),
26
+ tab-label-text-weight: map.get($system, label-small-weight),
27
+ ),
28
+ density: (
29
+ tab-container-height: map.get((
30
+ 0: 48px,
31
+ -1: 44px,
32
+ -2: 40px,
33
+ -3: 36px,
34
+ -4: 32px,
35
+ ), $density-scale),
36
+ ),
25
37
  );
26
38
  }
27
39
 
28
40
  // Tokens that can be configured through Angular Material's color theming API.
29
- @function get-color-tokens($theme, $color-variant, $exclude: ()) {
41
+ @function private-get-color-palette-color-tokens($theme, $color-variant, $exclude: ()) {
30
42
  $system: m2-utils.get-system($theme);
31
43
  $system: m3-utils.replace-colors-with-variant($system, primary, $color-variant);
32
44
 
@@ -54,30 +66,3 @@
54
66
 
55
67
  @return $tokens;
56
68
  }
57
-
58
- // Tokens that can be configured through Angular Material's typography theming API.
59
- @function get-typography-tokens($theme) {
60
- @return (
61
- // Note: MDC has equivalents of these tokens, but they lead to much higher selector specificity.
62
- tab-label-text-font: inspection.get-theme-typography($theme, button, font-family),
63
- tab-label-text-size: inspection.get-theme-typography($theme, button, font-size),
64
- tab-label-text-tracking: inspection.get-theme-typography($theme, button, letter-spacing),
65
- tab-label-text-line-height: inspection.get-theme-typography($theme, button, line-height),
66
- tab-label-text-weight: inspection.get-theme-typography($theme, button, font-weight),
67
- );
68
- }
69
-
70
- // Tokens that can be configured through Angular Material's density theming API.
71
- @function get-density-tokens($theme) {
72
- $scale: theming.clamp-density(inspection.get-theme-density($theme), -4);
73
-
74
- @return (
75
- tab-container-height: map.get((
76
- 0: 48px,
77
- -1: 44px,
78
- -2: 40px,
79
- -3: 36px,
80
- -4: 32px,
81
- ), $scale),
82
- );
83
- }
@@ -2,7 +2,6 @@
2
2
  @use 'sass:map';
3
3
  @use 'sass:list';
4
4
  @use '../core/theming/theming';
5
- @use '../core/theming/inspection';
6
5
  @use '../core/tokens/m3';
7
6
 
8
7
  /// Generates the tokens for MDC tab
@@ -44,7 +43,7 @@
44
43
  tab-label-text-tracking: map.get($system, title-small-tracking),
45
44
  tab-label-text-weight: map.get($system, title-small-weight),
46
45
  ),
47
- density: get-density-tokens(map.get($theme, inspection.$internals, density-scale)),
46
+ density: get-density-tokens(map.get($system, density-scale)),
48
47
  );
49
48
  }
50
49
 
@@ -1,23 +1,17 @@
1
- @use '../core/style/sass-utils';
2
1
  @use './m2-tabs';
3
2
  @use './m3-tabs';
4
- @use '../core/theming/theming';
5
3
  @use '../core/theming/inspection';
6
4
  @use '../core/typography/typography';
7
5
  @use '../core/tokens/token-utils';
8
6
  @use 'sass:map';
9
7
 
10
- /// Outputs base theme styles (styles not dependent on the color, typography, or density settings)
11
- /// for the mat-tab.
12
- /// @param {Map} $theme The theme to generate base styles for.
13
8
  @mixin base($theme) {
9
+ $tokens: map.get(m2-tabs.get-tokens($theme), base);
14
10
  @if inspection.get-theme-version($theme) == 1 {
15
- @include token-utils.create-token-values(map.get(m3-tabs.get-tokens($theme), base));
16
- } @else {
17
- @include sass-utils.current-selector-or-root() {
18
- @include token-utils.create-token-values-mixed(m2-tabs.get-unthemable-tokens());
19
- }
11
+ $tokens: map.get(m3-tabs.get-tokens($theme), base);
20
12
  }
13
+
14
+ @include token-utils.values($tokens);
21
15
  }
22
16
 
23
17
  /// Outputs color theme styles for the mat-tab.
@@ -25,48 +19,48 @@
25
19
  /// @param {String} $color-variant The color variant to use for the component (M3 only)
26
20
  @mixin color($theme, $color-variant: null) {
27
21
  @if inspection.get-theme-version($theme) == 1 {
28
- @include token-utils.create-token-values(
29
- map.get(m3-tabs.get-tokens($theme, $color-variant), color));
22
+ $tokens: map.get(m3-tabs.get-tokens($theme, $color-variant), color);
23
+ @include token-utils.values($tokens);
30
24
  } @else {
31
25
  .mat-mdc-tab-group,
32
26
  .mat-mdc-tab-nav-bar {
33
- @include token-utils.create-token-values-mixed(
34
- m2-tabs.get-color-tokens($theme, primary,
27
+ @include token-utils.values(
28
+ m2-tabs.private-get-color-palette-color-tokens($theme, primary,
35
29
  $exclude: (tab-background-color, tab-foreground-color)));
36
30
 
37
31
  &.mat-accent {
38
- @include token-utils.create-token-values-mixed(
39
- m2-tabs.get-color-tokens($theme, secondary,
32
+ @include token-utils.values(
33
+ m2-tabs.private-get-color-palette-color-tokens($theme, secondary,
40
34
  $exclude: (tab-background-color, tab-foreground-color)));
41
35
  }
42
36
 
43
37
  &.mat-warn {
44
- @include token-utils.create-token-values-mixed(
45
- m2-tabs.get-color-tokens($theme, error,
38
+ @include token-utils.values(
39
+ m2-tabs.private-get-color-palette-color-tokens($theme, error,
46
40
  $exclude: (tab-background-color, tab-foreground-color)));
47
41
  }
48
42
 
49
43
  &.mat-background-primary {
50
- $tokens: m2-tabs.get-color-tokens($theme, primary);
51
- @include token-utils.create-token-values-mixed((
52
- tab-background-color: map.get($tokens, background-color),
53
- tab-foreground-color: map.get($tokens, foreground-color)
44
+ $tokens: m2-tabs.private-get-color-palette-color-tokens($theme, primary);
45
+ @include token-utils.values((
46
+ tab-background-color: map.get($tokens, tab-background-color),
47
+ tab-foreground-color: map.get($tokens, tab-foreground-color)
54
48
  ));
55
49
  }
56
50
 
57
51
  &.mat-background-accent {
58
- $tokens: m2-tabs.get-color-tokens($theme, secondary);
59
- @include token-utils.create-token-values-mixed((
60
- tab-background-color: map.get($tokens, background-color),
61
- tab-foreground-color: map.get($tokens, foreground-color),
52
+ $tokens: m2-tabs.private-get-color-palette-color-tokens($theme, secondary);
53
+ @include token-utils.values((
54
+ tab-background-color: map.get($tokens, tab-background-color),
55
+ tab-foreground-color: map.get($tokens, tab-foreground-color),
62
56
  ));
63
57
  }
64
58
 
65
59
  &.mat-background-warn {
66
- $tokens: m2-tabs.get-color-tokens($theme, error);
67
- @include token-utils.create-token-values-mixed((
68
- tab-background-color: map.get($tokens, background-color),
69
- tab-foreground-color: map.get($tokens, foreground-color),
60
+ $tokens: m2-tabs.private-get-color-palette-color-tokens($theme, error);
61
+ @include token-utils.values((
62
+ tab-background-color: map.get($tokens, tab-background-color),
63
+ tab-foreground-color: map.get($tokens, tab-foreground-color),
70
64
  ));
71
65
  }
72
66
  }
@@ -77,10 +71,10 @@
77
71
  /// @param {Map} $theme The theme to generate typography styles for.
78
72
  @mixin typography($theme) {
79
73
  @if inspection.get-theme-version($theme) == 1 {
80
- @include token-utils.create-token-values(map.get(m3-tabs.get-tokens($theme), typography));
74
+ @include token-utils.values(map.get(m3-tabs.get-tokens($theme), typography));
81
75
  } @else {
82
76
  .mat-mdc-tab-header {
83
- @include token-utils.create-token-values-mixed(m2-tabs.get-typography-tokens($theme));
77
+ @include token-utils.values(map.get(m2-tabs.get-tokens($theme), typography));
84
78
  }
85
79
  }
86
80
  }
@@ -89,10 +83,10 @@
89
83
  /// @param {Map} $theme The theme to generate density styles for.
90
84
  @mixin density($theme) {
91
85
  @if inspection.get-theme-version($theme) == 1 {
92
- @include token-utils.create-token-values(map.get(m3-tabs.get-tokens($theme), density));
86
+ @include token-utils.values(map.get(m3-tabs.get-tokens($theme), density));
93
87
  } @else {
94
88
  .mat-mdc-tab-header {
95
- @include token-utils.create-token-values-mixed(m2-tabs.get-density-tokens($theme));
89
+ @include token-utils.values(map.get(m2-tabs.get-tokens($theme), density));
96
90
  }
97
91
  }
98
92
  }
@@ -117,23 +111,21 @@
117
111
  /// @param {Map} $theme The theme to generate styles for.
118
112
  /// @param {String} $color-variant The color variant to use for the component (M3 only)
119
113
  @mixin theme($theme, $color-variant: null) {
120
- @include theming.private-check-duplicate-theme-styles($theme, 'mat-tabs') {
121
- @if inspection.get-theme-version($theme) == 1 {
122
- @include base($theme);
123
- @include color($theme, $color-variant);
114
+ @if inspection.get-theme-version($theme) == 1 {
115
+ @include base($theme);
116
+ @include color($theme, $color-variant);
117
+ @include density($theme);
118
+ @include typography($theme);
119
+ } @else {
120
+ @include base($theme);
121
+ @if inspection.theme-has($theme, color) {
122
+ @include color($theme);
123
+ }
124
+ @if inspection.theme-has($theme, density) {
124
125
  @include density($theme);
126
+ }
127
+ @if inspection.theme-has($theme, typography) {
125
128
  @include typography($theme);
126
- } @else {
127
- @include base($theme);
128
- @if inspection.theme-has($theme, color) {
129
- @include color($theme);
130
- }
131
- @if inspection.theme-has($theme, density) {
132
- @include density($theme);
133
- }
134
- @if inspection.theme-has($theme, typography) {
135
- @include typography($theme);
136
- }
137
129
  }
138
130
  }
139
131
  }
@@ -2,30 +2,18 @@
2
2
  @use '../core/tokens/m2-utils';
3
3
  @use 'sass:map';
4
4
 
5
- // Tokens that can't be configured through Angular Material's current theming API,
6
- // but may be in a future version of the theming API.
7
- @function get-unthemable-tokens() {
8
- @return (
9
- timepicker-container-shape: 4px,
10
- timepicker-container-elevation-shadow: elevation.get-box-shadow(8),
11
- );
12
- }
13
-
14
- // Tokens that can be configured through Angular Material's color theming API.
15
- @function get-color-tokens($theme) {
5
+ @function get-tokens($theme) {
16
6
  $system: m2-utils.get-system($theme);
17
7
 
18
8
  @return (
19
- timepicker-container-background-color: map.get($system, surface)
9
+ base: (
10
+ timepicker-container-shape: 4px,
11
+ timepicker-container-elevation-shadow: elevation.get-box-shadow(8),
12
+ ),
13
+ color: (
14
+ timepicker-container-background-color: map.get($system, surface)
15
+ ),
16
+ typography: (),
17
+ density: (),
20
18
  );
21
19
  }
22
-
23
- // Tokens that can be configured through Angular Material's typography theming API.
24
- @function get-typography-tokens($theme) {
25
- @return ();
26
- }
27
-
28
- // Tokens that can be configured through Angular Material's density theming API.
29
- @function get-density-tokens($theme) {
30
- @return ();
31
- }
@@ -1,60 +1,44 @@
1
1
  @use 'sass:map';
2
- @use '../core/theming/theming';
3
2
  @use '../core/theming/inspection';
4
3
  @use '../core/typography/typography';
5
- @use '../core/style/sass-utils';
6
4
  @use './m2-timepicker';
7
5
  @use './m3-timepicker';
8
6
  @use '../core/tokens/token-utils';
9
7
 
10
- /// Outputs base theme styles (styles not dependent on the color, typography, or density settings)
11
- /// for the mat-timepicker.
12
- /// @param {Map} $theme The theme to generate base styles for.
13
8
  @mixin base($theme) {
9
+ $tokens: map.get(m2-timepicker.get-tokens($theme), base);
14
10
  @if inspection.get-theme-version($theme) == 1 {
15
- @include token-utils.create-token-values(map.get(m3-timepicker.get-tokens($theme), base));
16
- } @else {
17
- @include sass-utils.current-selector-or-root() {
18
- @include token-utils.create-token-values-mixed(m2-timepicker.get-unthemable-tokens());
19
- }
11
+ $tokens: map.get(m3-timepicker.get-tokens($theme), base);
20
12
  }
13
+
14
+ @include token-utils.values($tokens);
21
15
  }
22
16
 
23
- /// Outputs color theme styles for the mat-timepicker.
24
- /// @param {Map} $theme The theme to generate color styles for.
25
17
  @mixin color($theme) {
18
+ $tokens: map.get(m2-timepicker.get-tokens($theme), color);
26
19
  @if inspection.get-theme-version($theme) == 1 {
27
- @include token-utils.create-token-values(
28
- map.get(m3-timepicker.get-tokens($theme), color));
29
- } @else {
30
- @include sass-utils.current-selector-or-root() {
31
- @include token-utils.create-token-values-mixed(m2-timepicker.get-color-tokens($theme));
32
- }
20
+ $tokens: map.get(m3-timepicker.get-tokens($theme), color);
33
21
  }
22
+
23
+ @include token-utils.values($tokens);
34
24
  }
35
25
 
36
- /// Outputs typography theme styles for the mat-timepicker.
37
- /// @param {Map} $theme The theme to generate typography styles for.
38
26
  @mixin typography($theme) {
27
+ $tokens: map.get(m2-timepicker.get-tokens($theme), typography);
39
28
  @if inspection.get-theme-version($theme) == 1 {
40
- @include token-utils.create-token-values(map.get(m3-timepicker.get-tokens($theme), typography));
41
- } @else {
42
- @include sass-utils.current-selector-or-root() {
43
- @include token-utils.create-token-values-mixed(m2-timepicker.get-typography-tokens($theme));
44
- }
29
+ $tokens: map.get(m3-timepicker.get-tokens($theme), typography);
45
30
  }
31
+
32
+ @include token-utils.values($tokens);
46
33
  }
47
34
 
48
- /// Outputs density theme styles for the mat-timepicker.
49
- /// @param {Map} $theme The theme to generate density styles for.
50
35
  @mixin density($theme) {
36
+ $tokens: map.get(m2-timepicker.get-tokens($theme), density);
51
37
  @if inspection.get-theme-version($theme) == 1 {
52
- @include token-utils.create-token-values(map.get(m3-timepicker.get-tokens($theme), density));
53
- } @else {
54
- @include sass-utils.current-selector-or-root() {
55
- @include token-utils.create-token-values-mixed(m2-timepicker.get-density-tokens($theme));
56
- }
38
+ $tokens: map.get(m3-timepicker.get-tokens($theme), density);
57
39
  }
40
+
41
+ @include token-utils.values($tokens);
58
42
  }
59
43
 
60
44
  /// Defines the tokens that will be available in the `overrides` mixin and for docs extraction.
@@ -77,23 +61,21 @@
77
61
  /// @param {Map} $theme The theme to generate styles for.
78
62
  /// @param {String} $color-variant The color variant to use for the component
79
63
  @mixin theme($theme, $color-variant: null) {
80
- @include theming.private-check-duplicate-theme-styles($theme, 'mat-timepicker') {
81
- @if inspection.get-theme-version($theme) == 1 {
82
- @include base($theme);
64
+ @if inspection.get-theme-version($theme) == 1 {
65
+ @include base($theme);
66
+ @include color($theme);
67
+ @include density($theme);
68
+ @include typography($theme);
69
+ } @else {
70
+ @include base($theme);
71
+ @if inspection.theme-has($theme, color) {
83
72
  @include color($theme);
73
+ }
74
+ @if inspection.theme-has($theme, density) {
84
75
  @include density($theme);
76
+ }
77
+ @if inspection.theme-has($theme, typography) {
85
78
  @include typography($theme);
86
- } @else {
87
- @include base($theme);
88
- @if inspection.theme-has($theme, color) {
89
- @include color($theme);
90
- }
91
- @if inspection.theme-has($theme, density) {
92
- @include density($theme);
93
- }
94
- @if inspection.theme-has($theme, typography) {
95
- @include typography($theme);
96
- }
97
79
  }
98
80
  }
99
81
  }
@@ -1,56 +1,36 @@
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
 
6
- // Tokens that can't be configured through Angular Material's current theming API,
7
- // but may be in a future version of the theming API.
8
- @function get-unthemable-tokens() {
9
- @return ();
10
- }
11
-
12
- // Tokens that can be configured through Angular Material's color theming API.
13
- @function get-color-tokens($theme) {
5
+ @function get-tokens($theme) {
14
6
  $system: m2-utils.get-system($theme);
15
- @return private-get-color-palette-color-tokens(
16
- $background-color: map.get($system, surface),
17
- $text-color: map.get($system, on-surface),
18
- );
19
- }
20
-
21
- // Tokens that can be configured through Angular Material's typography theming API.
22
- @function get-typography-tokens($theme) {
23
- @return (
24
- toolbar-title-text-font: inspection.get-theme-typography($theme, headline-6, font-family),
25
- toolbar-title-text-line-height:
26
- inspection.get-theme-typography($theme, headline-6, line-height),
27
- toolbar-title-text-size: inspection.get-theme-typography($theme, headline-6, font-size),
28
- toolbar-title-text-tracking:
29
- inspection.get-theme-typography($theme, headline-6, letter-spacing),
30
- toolbar-title-text-weight: inspection.get-theme-typography($theme, headline-6, font-weight),
31
- );
32
- }
33
-
34
- // Tokens that can be configured through Angular Material's density theming API.
35
- @function get-density-tokens($theme) {
36
- $density-scale: theming.clamp-density(inspection.get-theme-density($theme), -3);
37
- $standard-scale: (
38
- 0: 64px,
39
- -1: 60px,
40
- -2: 56px,
41
- -3: 52px,
42
- );
43
-
44
- $mobile-scale: (
45
- 0: 56px,
46
- -1: 52px,
47
- -2: 48px,
48
- -3: 44px,
49
- );
7
+ $density-scale: theming.clamp-density(map.get($system, density-scale), -3);
50
8
 
51
9
  @return (
52
- toolbar-standard-height: map.get($standard-scale, $density-scale),
53
- toolbar-mobile-height: map.get($mobile-scale, $density-scale),
10
+ base: (),
11
+ color: private-get-color-palette-color-tokens(
12
+ map.get($system, surface), map.get($system, on-surface)),
13
+ typography: (
14
+ toolbar-title-text-font: map.get($system, title-small-font),
15
+ toolbar-title-text-line-height: map.get($system, title-small-line-height),
16
+ toolbar-title-text-size: map.get($system, title-small-size),
17
+ toolbar-title-text-tracking: map.get($system, title-small-tracking),
18
+ toolbar-title-text-weight: map.get($system, title-small-weight),
19
+ ),
20
+ density: (
21
+ toolbar-standard-height: map.get((
22
+ 0: 64px,
23
+ -1: 60px,
24
+ -2: 56px,
25
+ -3: 52px,
26
+ ), $density-scale),
27
+ toolbar-mobile-height: map.get((
28
+ 0: 56px,
29
+ -1: 52px,
30
+ -2: 48px,
31
+ -3: 44px,
32
+ ), $density-scale),
33
+ ),
54
34
  );
55
35
  }
56
36
 
@@ -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-toolbar.
@@ -26,7 +25,7 @@
26
25
  toolbar-title-text-tracking: map.get($system, title-large-tracking),
27
26
  toolbar-title-text-weight: map.get($system, title-large-weight),
28
27
  ),
29
- density: get-density-tokens(map.get($theme, inspection.$internals, density-scale)),
28
+ density: get-density-tokens(map.get($system, density-scale)),
30
29
  );
31
30
  }
32
31
 
@@ -1,70 +1,81 @@
1
1
  @use 'sass:map';
2
- @use '../core/style/sass-utils';
3
2
  @use '../core/theming/inspection';
4
- @use '../core/theming/theming';
5
3
  @use '../core/tokens/token-utils';
6
4
  @use '../core/typography/typography';
7
5
  @use './m2-toolbar';
8
6
  @use './m3-toolbar';
9
7
 
10
8
  @mixin _palette-styles($theme, $palette-name) {
11
- @include token-utils.create-token-values-mixed(
12
- m2-toolbar.private-get-color-palette-color-tokens(
13
- $background-color: inspection.get-theme-color($theme, $palette-name),
14
- $text-color: inspection.get-theme-color($theme, $palette-name, default-contrast)
15
- )
9
+ $tokens: m2-toolbar.private-get-color-palette-color-tokens(
10
+ $background-color: inspection.get-theme-color($theme, $palette-name),
11
+ $text-color: inspection.get-theme-color($theme, $palette-name, default-contrast)
16
12
  );
13
+ @include token-utils.values($tokens);
17
14
  }
18
15
 
19
16
  @mixin base($theme) {
17
+ $tokens: map.get(m2-toolbar.get-tokens($theme), base);
18
+ @if inspection.get-theme-version($theme) == 1 {
19
+ $tokens: map.get(m3-toolbar.get-tokens($theme), base);
20
+ }
21
+
22
+ @include token-utils.values($tokens);
20
23
  }
21
24
 
22
25
  @mixin color($theme) {
26
+ $tokens: map.get(m2-toolbar.get-tokens($theme), color);
23
27
  @if inspection.get-theme-version($theme) == 1 {
24
- @include token-utils.create-token-values(map.get(m3-toolbar.get-tokens($theme), color));
25
- } @else {
26
- @include sass-utils.current-selector-or-root() {
27
- @include token-utils.create-token-values-mixed(m2-toolbar.get-color-tokens($theme));
28
- }
28
+ $tokens: map.get(m3-toolbar.get-tokens($theme), color);
29
+ }
30
+
31
+ @include token-utils.values($tokens);
29
32
 
33
+ @if inspection.get-theme-version($theme) != 1 {
30
34
  .mat-toolbar {
31
35
  &.mat-primary {
32
- @include _palette-styles($theme, primary);
36
+ $tokens: m2-toolbar.private-get-color-palette-color-tokens(
37
+ $background-color: inspection.get-theme-color($theme, primary),
38
+ $text-color: inspection.get-theme-color($theme, primary, default-contrast)
39
+ );
40
+ @include token-utils.values($tokens);
33
41
  }
34
42
 
35
43
  &.mat-accent {
36
- @include _palette-styles($theme, accent);
44
+ $tokens: m2-toolbar.private-get-color-palette-color-tokens(
45
+ $background-color: inspection.get-theme-color($theme, accent),
46
+ $text-color: inspection.get-theme-color($theme, accent, default-contrast)
47
+ );
48
+ @include token-utils.values($tokens);
37
49
  }
38
50
 
39
51
  &.mat-warn {
40
- @include _palette-styles($theme, warn);
52
+ $tokens: m2-toolbar.private-get-color-palette-color-tokens(
53
+ $background-color: inspection.get-theme-color($theme, warn),
54
+ $text-color: inspection.get-theme-color($theme, warn, default-contrast)
55
+ );
56
+ @include token-utils.values($tokens);
41
57
  }
42
58
  }
43
59
  }
44
60
  }
45
61
 
46
- @mixin typography($theme) {
47
- @if inspection.get-theme-version($theme) == 1 {
48
- @include token-utils.create-token-values(map.get(m3-toolbar.get-tokens($theme), typography));
49
- } @else {
50
- // TODO(mmalerba): Stop calling this and resolve resulting screen diffs.
51
- $theme: inspection.private-get-typography-back-compat-theme($theme);
52
-
53
- @include sass-utils.current-selector-or-root() {
54
- @include token-utils.create-token-values-mixed(m2-toolbar.get-typography-tokens($theme));
62
+ @mixin typography($theme) {
63
+ $tokens: map.get(m2-toolbar.get-tokens($theme), typography);
64
+ @if inspection.get-theme-version($theme) == 1 {
65
+ $tokens: map.get(m3-toolbar.get-tokens($theme), typography);
55
66
  }
67
+
68
+ @include token-utils.values($tokens);
56
69
  }
57
- }
58
70
 
59
- @mixin density($theme) {
60
- @if inspection.get-theme-version($theme) == 1 {
61
- @include token-utils.create-token-values(map.get(m3-toolbar.get-tokens($theme), density));
62
- } @else {
63
- @include sass-utils.current-selector-or-root() {
64
- @include token-utils.create-token-values-mixed(m2-toolbar.get-density-tokens($theme));
71
+ @mixin density($theme) {
72
+ $tokens: map.get(m2-toolbar.get-tokens($theme), density);
73
+ @if inspection.get-theme-version($theme) == 1 {
74
+ $tokens: map.get(m3-toolbar.get-tokens($theme), density);
65
75
  }
76
+
77
+ @include token-utils.values($tokens);
66
78
  }
67
- }
68
79
 
69
80
  /// Defines the tokens that will be available in the `overrides` mixin and for docs extraction.
70
81
  @function _define-overrides() {
@@ -83,23 +94,21 @@
83
94
  }
84
95
 
85
96
  @mixin theme($theme) {
86
- @include theming.private-check-duplicate-theme-styles($theme, 'mat-toolbar') {
87
- @if inspection.get-theme-version($theme) == 1 {
88
- @include base($theme);
97
+ @if inspection.get-theme-version($theme) == 1 {
98
+ @include base($theme);
99
+ @include color($theme);
100
+ @include density($theme);
101
+ @include typography($theme);
102
+ } @else {
103
+ @include base($theme);
104
+ @if inspection.theme-has($theme, color) {
89
105
  @include color($theme);
106
+ }
107
+ @if inspection.theme-has($theme, density) {
90
108
  @include density($theme);
109
+ }
110
+ @if inspection.theme-has($theme, typography) {
91
111
  @include typography($theme);
92
- } @else {
93
- @include base($theme);
94
- @if inspection.theme-has($theme, color) {
95
- @include color($theme);
96
- }
97
- @if inspection.theme-has($theme, density) {
98
- @include density($theme);
99
- }
100
- @if inspection.theme-has($theme, typography) {
101
- @include typography($theme);
102
- }
103
112
  }
104
113
  }
105
114
  }