@angular/material 17.0.0-next.0 → 17.0.0-next.1

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 (110) hide show
  1. package/_index.scss +2 -2
  2. package/button/_button-base.scss +3 -3
  3. package/button/_button-theme-private.scss +3 -2
  4. package/button/_button-theme.scss +18 -25
  5. package/button/_fab-theme.scss +31 -49
  6. package/button/_icon-button-theme.scss +19 -26
  7. package/button/index.d.ts +22 -31
  8. package/card/_card-theme.scss +27 -38
  9. package/checkbox/_checkbox-theme.scss +28 -45
  10. package/core/_core-theme.scss +24 -39
  11. package/core/mdc-helpers/_mdc-helpers.scss +19 -22
  12. package/core/option/_optgroup-theme.scss +13 -23
  13. package/core/option/_option-theme.scss +23 -37
  14. package/core/ripple/_ripple-theme.scss +6 -10
  15. package/core/selection/pseudo-checkbox/_pseudo-checkbox-theme.scss +17 -24
  16. package/core/style/_private.scss +3 -3
  17. package/core/style/_sass-utils.scss +7 -0
  18. package/core/theming/_inspection.scss +87 -60
  19. package/core/theming/_m2-inspection.scss +211 -0
  20. package/core/theming/_theming.scss +59 -6
  21. package/core/tokens/m2/mat/_card.scss +15 -21
  22. package/core/tokens/m2/mat/_form-field.scss +21 -25
  23. package/core/tokens/m2/mat/_optgroup.scss +12 -17
  24. package/core/tokens/m2/mat/_option.scss +16 -28
  25. package/core/tokens/m2/mat/_paginator.scss +16 -18
  26. package/core/tokens/m2/mat/_radio.scss +7 -10
  27. package/core/tokens/m2/mat/_slide-toggle.scss +9 -17
  28. package/core/tokens/m2/mat/_slider.scss +5 -5
  29. package/core/tokens/m2/mdc/_checkbox.scss +21 -20
  30. package/core/tokens/m2/mdc/_elevated-card.scss +6 -9
  31. package/core/tokens/m2/mdc/_extended-fab.scss +8 -17
  32. package/core/tokens/m2/mdc/_fab.scss +6 -7
  33. package/core/tokens/m2/mdc/_filled-text-field.scss +16 -22
  34. package/core/tokens/m2/mdc/_icon-button.scss +1 -1
  35. package/core/tokens/m2/mdc/_linear-progress.scss +9 -10
  36. package/core/tokens/m2/mdc/_list.scss +44 -42
  37. package/core/tokens/m2/mdc/_outlined-card.scss +7 -10
  38. package/core/tokens/m2/mdc/_outlined-text-field.scss +14 -20
  39. package/core/tokens/m2/mdc/_radio.scss +11 -11
  40. package/core/tokens/m2/mdc/_slider.scss +16 -23
  41. package/core/tokens/m2/mdc/_switch.scss +16 -19
  42. package/core/typography/_definition.scss +258 -0
  43. package/core/typography/_property-getters.scss +63 -0
  44. package/core/typography/_typography-utils.scss +9 -69
  45. package/core/typography/_typography.scss +10 -343
  46. package/core/typography/_versioning.scss +86 -0
  47. package/datepicker/index.d.ts +3 -3
  48. package/dialog/_dialog-theme.scss +10 -0
  49. package/esm2022/autocomplete/autocomplete.mjs +1 -1
  50. package/esm2022/button/button-base.mjs +32 -27
  51. package/esm2022/button/button.mjs +6 -6
  52. package/esm2022/button/fab.mjs +23 -31
  53. package/esm2022/button/icon-button.mjs +6 -6
  54. package/esm2022/button/testing/button-harness.mjs +3 -3
  55. package/esm2022/core/version.mjs +1 -1
  56. package/esm2022/datepicker/calendar.mjs +1 -1
  57. package/esm2022/datepicker/datepicker-base.mjs +2 -2
  58. package/esm2022/datepicker/datepicker-toggle.mjs +1 -1
  59. package/esm2022/datepicker/month-view.mjs +2 -2
  60. package/esm2022/datepicker/multi-year-view.mjs +2 -2
  61. package/esm2022/datepicker/year-view.mjs +2 -2
  62. package/esm2022/dialog/dialog-container.mjs +2 -2
  63. package/esm2022/form-field/form-field.mjs +3 -3
  64. package/esm2022/paginator/paginator.mjs +1 -1
  65. package/esm2022/select/select.mjs +3 -3
  66. package/esm2022/slider/slider-input.mjs +19 -9
  67. package/esm2022/slider/slider.mjs +2 -2
  68. package/esm2022/snack-bar/simple-snack-bar.mjs +1 -1
  69. package/fesm2022/autocomplete.mjs.map +1 -1
  70. package/fesm2022/button/testing.mjs +2 -2
  71. package/fesm2022/button/testing.mjs.map +1 -1
  72. package/fesm2022/button.mjs +59 -61
  73. package/fesm2022/button.mjs.map +1 -1
  74. package/fesm2022/core.mjs +1 -1
  75. package/fesm2022/core.mjs.map +1 -1
  76. package/fesm2022/datepicker.mjs +6 -6
  77. package/fesm2022/datepicker.mjs.map +1 -1
  78. package/fesm2022/dialog.mjs +2 -2
  79. package/fesm2022/dialog.mjs.map +1 -1
  80. package/fesm2022/form-field.mjs +2 -2
  81. package/fesm2022/form-field.mjs.map +1 -1
  82. package/fesm2022/paginator.mjs +1 -1
  83. package/fesm2022/paginator.mjs.map +1 -1
  84. package/fesm2022/select.mjs +2 -2
  85. package/fesm2022/select.mjs.map +1 -1
  86. package/fesm2022/slider.mjs +20 -10
  87. package/fesm2022/slider.mjs.map +1 -1
  88. package/fesm2022/snack-bar.mjs +1 -1
  89. package/fesm2022/snack-bar.mjs.map +1 -1
  90. package/form-field/_form-field-density.scss +3 -4
  91. package/form-field/_form-field-focus-overlay.scss +1 -1
  92. package/form-field/_form-field-theme.scss +24 -34
  93. package/input/_input-theme.scss +11 -23
  94. package/list/_list-theme.scss +26 -41
  95. package/package.json +2 -2
  96. package/paginator/_paginator-theme.scss +15 -24
  97. package/prebuilt-themes/deeppurple-amber.css +1 -1
  98. package/prebuilt-themes/indigo-pink.css +1 -1
  99. package/prebuilt-themes/pink-bluegrey.css +1 -1
  100. package/prebuilt-themes/purple-green.css +1 -1
  101. package/progress-bar/_progress-bar-theme.scss +17 -24
  102. package/progress-spinner/_progress-spinner-theme.scss +3 -3
  103. package/radio/_radio-theme.scss +23 -38
  104. package/schematics/ng-add/index.js +1 -1
  105. package/schematics/ng-add/index.mjs +1 -1
  106. package/slide-toggle/_slide-toggle-theme.scss +23 -40
  107. package/slider/_slider-theme.scss +25 -42
  108. package/snack-bar/_snack-bar-theme.scss +2 -2
  109. package/button-toggle/_button-toggle-variables.scss +0 -16
  110. package/paginator/_paginator-variables.scss +0 -15
@@ -10,9 +10,9 @@
10
10
  @use '@material/card/elevated-card-theme' as mdc-elevated-card-theme;
11
11
  @use '@material/card/outlined-card-theme' as mdc-outlined-card-theme;
12
12
 
13
- @mixin base($config-or-theme) {
14
- @if inspection.get-theme-version($config-or-theme) == 1 {
15
- @include _theme-from-tokens(inspection.get-theme-tokens($config-or-theme, base));
13
+ @mixin base($theme) {
14
+ @if inspection.get-theme-version($theme) == 1 {
15
+ @include _theme-from-tokens(inspection.get-theme-tokens($theme, base));
16
16
  }
17
17
  @else {
18
18
  @include sass-utils.current-selector-or-root() {
@@ -24,24 +24,22 @@
24
24
  }
25
25
  }
26
26
 
27
- @mixin color($config-or-theme) {
28
- $config: theming.get-color-config($config-or-theme);
29
-
30
- @if inspection.get-theme-version($config-or-theme) == 1 {
31
- @include _theme-from-tokens(inspection.get-theme-tokens($config-or-theme, color));
27
+ @mixin color($theme) {
28
+ @if inspection.get-theme-version($theme) == 1 {
29
+ @include _theme-from-tokens(inspection.get-theme-tokens($theme, color));
32
30
  }
33
31
  @else {
34
32
  $mdc-elevated-card-color-tokens: token-utils.resolve-elevation(
35
- tokens-mdc-elevated-card.get-color-tokens($config),
33
+ tokens-mdc-elevated-card.get-color-tokens($theme),
36
34
  container-elevation,
37
35
  container-shadow-color
38
36
  );
39
37
  $mdc-outlined-card-color-tokens: token-utils.resolve-elevation(
40
- tokens-mdc-outlined-card.get-color-tokens($config),
38
+ tokens-mdc-outlined-card.get-color-tokens($theme),
41
39
  container-elevation,
42
40
  container-shadow-color,
43
41
  );
44
- $mat-card-color-tokens: tokens-mat-card.get-color-tokens($config);
42
+ $mat-card-color-tokens: tokens-mat-card.get-color-tokens($theme);
45
43
 
46
44
  // Add values for card tokens.
47
45
  @include sass-utils.current-selector-or-root() {
@@ -52,17 +50,14 @@
52
50
  }
53
51
  }
54
52
 
55
- @mixin typography($config-or-theme) {
56
- $config: typography.private-typography-to-2018-config(
57
- theming.get-typography-config($config-or-theme));
58
-
59
- @if inspection.get-theme-version($config-or-theme) == 1 {
60
- @include _theme-from-tokens(inspection.get-theme-tokens($config-or-theme, typography));
53
+ @mixin typography($theme) {
54
+ @if inspection.get-theme-version($theme) == 1 {
55
+ @include _theme-from-tokens(inspection.get-theme-tokens($theme, typography));
61
56
  }
62
57
  @else {
63
- $mdc-elevated-card-typography-tokens: tokens-mdc-elevated-card.get-typography-tokens($config);
64
- $mdc-outlined-card-typography-tokens: tokens-mdc-outlined-card.get-typography-tokens($config);
65
- $mat-card-typography-tokens: tokens-mat-card.get-typography-tokens($config);
58
+ $mdc-elevated-card-typography-tokens: tokens-mdc-elevated-card.get-typography-tokens($theme);
59
+ $mdc-outlined-card-typography-tokens: tokens-mdc-outlined-card.get-typography-tokens($theme);
60
+ $mat-card-typography-tokens: tokens-mat-card.get-typography-tokens($theme);
66
61
 
67
62
  // Add values for card tokens.
68
63
  @include sass-utils.current-selector-or-root() {
@@ -74,16 +69,14 @@
74
69
  }
75
70
  }
76
71
 
77
- @mixin density($config-or-theme) {
78
- $density-scale: theming.get-density-config($config-or-theme);
79
-
80
- @if inspection.get-theme-version($config-or-theme) == 1 {
81
- @include _theme-from-tokens(inspection.get-theme-tokens($config-or-theme, density));
72
+ @mixin density($theme) {
73
+ @if inspection.get-theme-version($theme) == 1 {
74
+ @include _theme-from-tokens(inspection.get-theme-tokens($theme, density));
82
75
  }
83
76
  @else {
84
- $mdc-elevated-card-density-tokens: tokens-mdc-elevated-card.get-density-tokens($density-scale);
85
- $mdc-outlined-card-density-tokens: tokens-mdc-outlined-card.get-density-tokens($density-scale);
86
- $mat-card-density-tokens: tokens-mat-card.get-density-tokens($density-scale);
77
+ $mdc-elevated-card-density-tokens: tokens-mdc-elevated-card.get-density-tokens($theme);
78
+ $mdc-outlined-card-density-tokens: tokens-mdc-outlined-card.get-density-tokens($theme);
79
+ $mat-card-density-tokens: tokens-mat-card.get-density-tokens($theme);
87
80
 
88
81
  // Add values for card tokens.
89
82
  @include sass-utils.current-selector-or-root() {
@@ -102,19 +95,15 @@
102
95
  @include _theme-from-tokens(inspection.get-theme-tokens($theme));
103
96
  }
104
97
  @else {
105
- $color: theming.get-color-config($theme);
106
- $density: theming.get-density-config($theme);
107
- $typography: theming.get-typography-config($theme);
108
-
109
98
  @include base($theme);
110
- @if $color != null {
111
- @include color($color);
99
+ @if inspection.theme-has($theme, color) {
100
+ @include color($theme);
112
101
  }
113
- @if $density != null {
114
- @include density($density);
102
+ @if inspection.theme-has($theme, density) {
103
+ @include density($theme);
115
104
  }
116
- @if $typography != null {
117
- @include typography($typography);
105
+ @if inspection.theme-has($theme, typography) {
106
+ @include typography($theme);
118
107
  }
119
108
  }
120
109
  }
@@ -8,9 +8,9 @@
8
8
  @use '../core/mdc-helpers/mdc-helpers';
9
9
  @use '../core/tokens/m2/mdc/checkbox' as tokens-mdc-checkbox;
10
10
 
11
- @mixin base($config-or-theme) {
12
- @if inspection.get-theme-version($config-or-theme) == 1 {
13
- @include _theme-from-tokens(inspection.get-theme-tokens($config-or-theme, base));
11
+ @mixin base($theme) {
12
+ @if inspection.get-theme-version($theme) == 1 {
13
+ @include _theme-from-tokens(inspection.get-theme-tokens($theme, base));
14
14
  }
15
15
  @else {
16
16
  @include sass-utils.current-selector-or-root() {
@@ -19,59 +19,48 @@
19
19
  }
20
20
  }
21
21
 
22
- @mixin color($config-or-theme) {
23
- $config: theming.get-color-config($config-or-theme);
24
-
25
- @if inspection.get-theme-version($config-or-theme) == 1 {
26
- @include _theme-from-tokens(inspection.get-theme-tokens($config-or-theme, color));
22
+ @mixin color($theme) {
23
+ @if inspection.get-theme-version($theme) == 1 {
24
+ @include _theme-from-tokens(inspection.get-theme-tokens($theme, color));
27
25
  }
28
26
  @else {
29
- $primary: map.get($config, primary);
30
- $warn: map.get($config, warn);
31
- $foreground: map.get($config, foreground);
32
-
33
27
  @include sass-utils.current-selector-or-root() {
34
- @include mdc-checkbox-theme.theme(tokens-mdc-checkbox.get-color-tokens($config));
28
+ @include mdc-checkbox-theme.theme(tokens-mdc-checkbox.get-color-tokens($theme));
35
29
  }
36
30
 
37
31
  .mat-mdc-checkbox {
38
32
  &.mat-primary {
39
- $primary-config: map.merge($config, (accent: $primary));
40
- @include mdc-checkbox-theme.theme(tokens-mdc-checkbox.get-color-tokens($primary-config));
33
+ @include mdc-checkbox-theme.theme(tokens-mdc-checkbox.get-color-tokens($theme, primary));
41
34
  }
42
35
 
43
36
  &.mat-warn {
44
- $warn-config: map.merge($config, (accent: $warn));
45
- @include mdc-checkbox-theme.theme(tokens-mdc-checkbox.get-color-tokens($warn-config));
37
+ @include mdc-checkbox-theme.theme(tokens-mdc-checkbox.get-color-tokens($theme, warn));
46
38
  }
47
39
 
48
- @include mdc-helpers.using-mdc-theme($config) {
40
+ @include mdc-helpers.using-mdc-theme($theme) {
49
41
  // TODO(mmalerba): Switch to static-styles, theme-styles, and theme once they're available.
50
42
  @include mdc-form-field.core-styles($query: mdc-helpers.$mdc-theme-styles-query);
51
43
  }
52
44
 
53
45
  &.mat-mdc-checkbox-disabled label {
54
46
  // MDC should set the disabled color on the label, but doesn't, so we do it here instead.
55
- color: theming.get-color-from-palette($foreground, disabled-text);
47
+ color: inspection.get-theme-color($theme, foreground, disabled-text);
56
48
  }
57
49
  }
58
50
  }
59
51
  }
60
52
 
61
- @mixin typography($config-or-theme) {
62
- $config: typography.private-typography-to-2018-config(
63
- theming.get-typography-config($config-or-theme));
64
-
65
- @if inspection.get-theme-version($config-or-theme) == 1 {
66
- @include _theme-from-tokens(inspection.get-theme-tokens($config-or-theme, typography));
53
+ @mixin typography($theme) {
54
+ @if inspection.get-theme-version($theme) == 1 {
55
+ @include _theme-from-tokens(inspection.get-theme-tokens($theme, typography));
67
56
  }
68
57
  @else {
69
58
  @include sass-utils.current-selector-or-root() {
70
- @include mdc-checkbox-theme.theme(tokens-mdc-checkbox.get-typography-tokens($config));
59
+ @include mdc-checkbox-theme.theme(tokens-mdc-checkbox.get-typography-tokens($theme));
71
60
  }
72
61
 
73
62
  .mat-mdc-checkbox {
74
- @include mdc-helpers.using-mdc-typography($config) {
63
+ @include mdc-helpers.using-mdc-typography($theme) {
75
64
  // TODO(mmalerba): Switch to static-styles, theme-styles, and theme once they're available.
76
65
  @include mdc-form-field.core-styles($query: mdc-helpers.$mdc-typography-styles-query);
77
66
  }
@@ -79,15 +68,15 @@
79
68
  }
80
69
  }
81
70
 
82
- @mixin density($config-or-theme) {
83
- $density-scale: theming.get-density-config($config-or-theme);
71
+ @mixin density($theme) {
72
+ $density-scale: inspection.get-theme-density($theme);
84
73
 
85
- @if inspection.get-theme-version($config-or-theme) == 1 {
86
- @include _theme-from-tokens(inspection.get-theme-tokens($config-or-theme, density));
74
+ @if inspection.get-theme-version($theme) == 1 {
75
+ @include _theme-from-tokens(inspection.get-theme-tokens($theme, density));
87
76
  }
88
77
  @else {
89
78
  @include sass-utils.current-selector-or-root() {
90
- @include mdc-checkbox-theme.theme(tokens-mdc-checkbox.get-density-tokens($density-scale));
79
+ @include mdc-checkbox-theme.theme(tokens-mdc-checkbox.get-density-tokens($theme));
91
80
  }
92
81
 
93
82
  @include mdc-helpers.if-touch-targets-unsupported($density-scale) {
@@ -98,27 +87,21 @@
98
87
  }
99
88
  }
100
89
 
101
- @mixin theme($theme-or-color-config) {
102
- $theme: theming.private-legacy-get-theme($theme-or-color-config);
103
-
90
+ @mixin theme($theme) {
104
91
  @include theming.private-check-duplicate-theme-styles($theme, 'mat-checkbox') {
105
92
  @if inspection.get-theme-version($theme) == 1 {
106
93
  @include _theme-from-tokens(inspection.get-theme-tokens($theme));
107
94
  }
108
95
  @else {
109
- $color: theming.get-color-config($theme);
110
- $density: theming.get-density-config($theme);
111
- $typography: theming.get-typography-config($theme);
112
-
113
96
  @include base($theme);
114
- @if $color != null {
115
- @include color($color);
97
+ @if inspection.theme-has($theme, color) {
98
+ @include color($theme);
116
99
  }
117
- @if $density != null {
118
- @include density($density);
100
+ @if inspection.theme-has($theme, density) {
101
+ @include density($theme);
119
102
  }
120
- @if $typography != null {
121
- @include typography($typography);
103
+ @if inspection.theme-has($theme, typography) {
104
+ @include typography($theme);
122
105
  }
123
106
  }
124
107
  }
@@ -1,5 +1,5 @@
1
- @use 'sass:map';
2
- @use 'theming/theming';
1
+ @use './theming/theming';
2
+ @use './theming/inspection';
3
3
  @use './style/private';
4
4
  @use './ripple/ripple-theme';
5
5
  @use './option/option-theme';
@@ -8,23 +8,18 @@
8
8
  @use './style/elevation';
9
9
  @use './typography/typography';
10
10
 
11
- @mixin color($config-or-theme) {
12
- $config: theming.get-color-config($config-or-theme);
13
-
14
- @include ripple-theme.color($config);
15
- @include option-theme.color($config);
16
- @include optgroup-theme.color($config);
17
- @include pseudo-checkbox-theme.color($config);
11
+ @mixin color($theme) {
12
+ @include ripple-theme.color($theme);
13
+ @include option-theme.color($theme);
14
+ @include optgroup-theme.color($theme);
15
+ @include pseudo-checkbox-theme.color($theme);
18
16
 
19
17
  // Wrapper element that provides the theme background when the user's content isn't
20
18
  // inside of a `mat-sidenav-container`. Note that we need to exclude the ampersand
21
19
  // selector in case the mixin is included at the top level.
22
20
  .mat-app-background#{if(&, ', &.mat-app-background', '')} {
23
- $background: map.get($config, background);
24
- $foreground: map.get($config, foreground);
25
-
26
- background-color: theming.get-color-from-palette($background, background);
27
- color: theming.get-color-from-palette($foreground, text);
21
+ background-color: inspection.get-theme-color($theme, background, background);
22
+ color: inspection.get-theme-color($theme, foreground, text);
28
23
  }
29
24
 
30
25
  // Provides external CSS classes for each elevation value. Each CSS class is formatted as
@@ -35,7 +30,7 @@
35
30
  // We need the `mat-mdc-elevation-specific`, because some MDC mixins
36
31
  // come with elevation baked in and we don't have a way of removing it.
37
32
  .#{$selector}, .mat-mdc-elevation-specific.#{$selector} {
38
- @include private.private-theme-elevation($zValue, $config);
33
+ @include private.private-theme-elevation($zValue, $theme);
39
34
  }
40
35
  }
41
36
 
@@ -47,46 +42,36 @@
47
42
  }
48
43
  }
49
44
 
50
- @mixin typography($config-or-theme) {
51
- $config: typography.private-typography-to-2018-config(
52
- theming.get-typography-config($config-or-theme));
53
-
54
- @include option-theme.typography($config);
55
- @include optgroup-theme.typography($config);
56
- @include pseudo-checkbox-theme.typography($config);
45
+ @mixin typography($theme) {
46
+ @include option-theme.typography($theme);
47
+ @include optgroup-theme.typography($theme);
48
+ @include pseudo-checkbox-theme.typography($theme);
57
49
  // TODO(mmalerba): add typography mixin for this.
58
50
  // @include ripple-theme.typography($config);
59
51
  }
60
52
 
61
- @mixin density($config-or-theme) {
62
- $density-scale: theming.get-density-config($config-or-theme);
63
-
64
- @include option-theme.density($density-scale);
65
- @include optgroup-theme.density($density-scale);
53
+ @mixin density($theme) {
54
+ @include option-theme.density($theme);
55
+ @include optgroup-theme.density($theme);
66
56
  // TODO(mmalerba): add density mixins for these.
67
57
  // @include ripple-theme.density($density-scale);
68
58
  // @include pseudo-checkbox-theme.density($density-scale);
69
59
  }
70
60
 
71
61
  // Mixin that renders all of the core styles that depend on the theme.
72
- @mixin theme($theme-or-color-config) {
73
- $theme: theming.private-legacy-get-theme($theme-or-color-config);
62
+ @mixin theme($theme) {
74
63
  // Wrap the sub-theme includes in the duplicate theme styles mixin. This ensures that
75
64
  // there won't be multiple warnings. e.g. if `mat-core-theme` reports a warning, then
76
65
  // the imported themes (such as `mat-ripple-theme`) should not report again.
77
66
  @include theming.private-check-duplicate-theme-styles($theme, 'mat-core') {
78
- $color: theming.get-color-config($theme);
79
- $density: theming.get-density-config($theme);
80
- $typography: theming.get-typography-config($theme);
81
-
82
- @if $color != null {
83
- @include color($color);
67
+ @if inspection.theme-has($theme, color) {
68
+ @include color($theme);
84
69
  }
85
- @if $density != null {
86
- @include density($density);
70
+ @if inspection.theme-has($theme, density) {
71
+ @include density($theme);
87
72
  }
88
- @if $typography != null {
89
- @include typography($typography);
73
+ @if inspection.theme-has($theme, typography) {
74
+ @include typography($theme);
90
75
  }
91
76
  }
92
77
  }
@@ -1,9 +1,7 @@
1
1
  // TODO(mmalerba): this file should be split into separate cohesive partials for things like
2
2
  // "theming", "typography", "core".
3
-
4
- @use '../theming/theming';
3
+ @use '../theming/inspection';
5
4
  @use '../typography/typography';
6
- @use '../typography/typography-utils';
7
5
  @use '@material/feature-targeting' as mdc-feature-targeting;
8
6
  @use '@material/typography' as mdc-typography;
9
7
  @use '@material/theme/theme-color' as mdc-theme-color;
@@ -36,7 +34,7 @@ $mat-typography-mdc-level-mappings: (
36
34
  );
37
35
 
38
36
  // Converts an Angular Material typography level config to an MDC one.
39
- @function typography-level-config-to-mdc($mat-config, $mat-level) {
37
+ @function typography-level-config-to-mdc($theme, $mat-level) {
40
38
  $mdc-level: map.get($mat-typography-mdc-level-mappings, $mat-level);
41
39
 
42
40
  $result-with-nulls: map.merge(
@@ -49,11 +47,11 @@ $mat-typography-mdc-level-mappings: (
49
47
  )),
50
48
  if($mat-level,
51
49
  (
52
- font-size: typography-utils.font-size($mat-config, $mat-level),
53
- line-height: typography-utils.line-height($mat-config, $mat-level),
54
- font-weight: typography-utils.font-weight($mat-config, $mat-level),
55
- letter-spacing: typography-utils.letter-spacing($mat-config, $mat-level),
56
- font-family: typography-utils.font-family($mat-config, $mat-level),
50
+ font-size: inspection.get-theme-typography($theme, $mat-level, font-size),
51
+ line-height: inspection.get-theme-typography($theme, $mat-level, line-height),
52
+ font-weight: inspection.get-theme-typography($theme, $mat-level, font-weight),
53
+ letter-spacing: inspection.get-theme-typography($theme, $mat-level, letter-spacing),
54
+ font-family: inspection.get-theme-typography($theme, $mat-level, font-family),
57
55
  // Angular Material doesn't use text-transform, so disable it.
58
56
  text-transform: none,
59
57
  ),
@@ -71,13 +69,13 @@ $mat-typography-mdc-level-mappings: (
71
69
  }
72
70
 
73
71
  // Converts an Angular Material typography config to an MDC one.
74
- @function typography-config-to-mdc($mat-config) {
72
+ @function typography-config-to-mdc($theme) {
75
73
  $mdc-config: ();
76
74
 
77
75
  @each $mat-level, $mdc-level in $mat-typography-mdc-level-mappings {
78
76
  $mdc-config: map.merge(
79
77
  $mdc-config,
80
- ($mdc-level: typography-level-config-to-mdc($mat-config, $mat-level)));
78
+ ($mdc-level: typography-level-config-to-mdc($theme, $mat-level)));
81
79
  }
82
80
 
83
81
  @return $mdc-config;
@@ -100,12 +98,11 @@ $mat-typography-mdc-level-mappings: (
100
98
 
101
99
  // Configures MDC's global variables to reflect the given theme, applies the given styles,
102
100
  // then resets the global variables to prevent unintended side effects.
103
- @mixin using-mdc-theme($config) {
104
- $primary: theming.get-color-from-palette(map.get($config, primary));
105
- $accent: theming.get-color-from-palette(map.get($config, accent));
106
- $warn: theming.get-color-from-palette(map.get($config, warn));
107
- $background-palette: map.get($config, background);
108
- $is-dark: map.get($config, is-dark);
101
+ @mixin using-mdc-theme($theme) {
102
+ $primary: inspection.get-theme-color($theme, primary);
103
+ $accent: inspection.get-theme-color($theme, accent);
104
+ $warn: inspection.get-theme-color($theme, warn);
105
+ $is-dark: inspection.get-theme-type($theme) == dark;
109
106
 
110
107
  // Save the original values.
111
108
  $orig-primary: mdc-theme-color.$primary;
@@ -126,8 +123,8 @@ $mat-typography-mdc-level-mappings: (
126
123
  mdc-theme-color.$secondary: $accent;
127
124
  mdc-theme-color.$on-secondary:
128
125
  if(variable-safe-contrast-tone(mdc-theme-color.$secondary, $is-dark) == 'dark', #000, #fff);
129
- mdc-theme-color.$background: theming.get-color-from-palette($background-palette, background);
130
- mdc-theme-color.$surface: theming.get-color-from-palette($background-palette, card);
126
+ mdc-theme-color.$background: inspection.get-theme-color($theme, background, background);
127
+ mdc-theme-color.$surface: inspection.get-theme-color($theme, background, card);
131
128
  mdc-theme-color.$on-surface:
132
129
  if(variable-safe-contrast-tone(mdc-theme-color.$surface, $is-dark) == 'dark', #000, #fff);
133
130
  mdc-theme-color.$error: $warn;
@@ -193,13 +190,13 @@ $mat-typography-mdc-level-mappings: (
193
190
 
194
191
  // Configures MDC's global variables to reflect the given typography config,
195
192
  // applies the given styles, then resets the global variables to prevent unintended side effects.
196
- @mixin using-mdc-typography($config) {
193
+ @mixin using-mdc-typography($theme) {
197
194
  // Save the original values.
198
195
  $orig-mdc-typography-styles: mdc-typography.$styles;
199
196
 
200
197
  // Set new values based on the given Angular Material typography configuration.
201
- @if $config {
202
- mdc-typography.$styles: typography-config-to-mdc($config);
198
+ @if inspection.theme-has($theme, typography) {
199
+ mdc-typography.$styles: typography-config-to-mdc($theme);
203
200
  }
204
201
 
205
202
  // Apply given rules.
@@ -3,46 +3,36 @@
3
3
  @use '../style/sass-utils';
4
4
 
5
5
  @use '../theming/theming';
6
+ @use '../theming/inspection';
6
7
  @use '../typography/typography';
7
8
 
8
- @mixin color($config-or-theme) {
9
- $config: theming.get-color-config($config-or-theme);
10
-
9
+ @mixin color($theme) {
11
10
  @include sass-utils.current-selector-or-root() {
12
11
  @include token-utils.create-token-values(tokens-mat-optgroup.$prefix,
13
- tokens-mat-optgroup.get-color-tokens($config));
12
+ tokens-mat-optgroup.get-color-tokens($theme));
14
13
  }
15
14
  }
16
15
 
17
- @mixin typography($config-or-theme) {
18
- $config: typography.private-typography-to-2018-config(
19
- theming.get-typography-config($config-or-theme));
20
-
16
+ @mixin typography($theme) {
21
17
  @include sass-utils.current-selector-or-root() {
22
18
  @include token-utils.create-token-values(tokens-mat-optgroup.$prefix,
23
- tokens-mat-optgroup.get-typography-tokens($config));
19
+ tokens-mat-optgroup.get-typography-tokens($theme));
24
20
  }
25
21
  }
26
22
 
27
- @mixin density($config-or-theme) {
28
- $density-scale: theming.get-density-config($config-or-theme);
23
+ @mixin density($theme) {
29
24
  }
30
25
 
31
- @mixin theme($theme-or-color-config) {
32
- $theme: theming.private-legacy-get-theme($theme-or-color-config);
26
+ @mixin theme($theme) {
33
27
  @include theming.private-check-duplicate-theme-styles($theme, 'mat-optgroup') {
34
- $color: theming.get-color-config($theme);
35
- $density: theming.get-density-config($theme);
36
- $typography: theming.get-typography-config($theme);
37
-
38
- @if $color != null {
39
- @include color($color);
28
+ @if inspection.theme-has($theme, color) {
29
+ @include color($theme);
40
30
  }
41
- @if $density != null {
42
- @include density($density);
31
+ @if inspection.theme-has($theme, density) {
32
+ @include density($theme);
43
33
  }
44
- @if $typography != null {
45
- @include typography($typography);
34
+ @if inspection.theme-has($theme, typography) {
35
+ @include typography($theme);
46
36
  }
47
37
  }
48
38
  }
@@ -1,62 +1,48 @@
1
- @use 'sass:map';
2
1
  @use '../tokens/m2/mat/option' as tokens-mat-option;
3
2
  @use '../tokens/token-utils';
4
3
  @use '../style/sass-utils';
5
4
 
6
5
  @use '../theming/theming';
6
+ @use '../theming/inspection';
7
7
  @use '../typography/typography';
8
- @use '../mdc-helpers/mdc-helpers';
9
8
 
10
- @mixin color($config-or-theme) {
11
- $config: theming.get-color-config($config-or-theme);
12
-
13
- @include mdc-helpers.using-mdc-theme($config) {
14
- @include sass-utils.current-selector-or-root() {
15
- @include token-utils.create-token-values(tokens-mat-option.$prefix,
16
- tokens-mat-option.get-color-tokens($config));
17
- }
9
+ @mixin color($theme) {
10
+ @include sass-utils.current-selector-or-root() {
11
+ @include token-utils.create-token-values(tokens-mat-option.$prefix,
12
+ tokens-mat-option.get-color-tokens($theme));
13
+ }
18
14
 
19
- .mat-accent {
20
- @include token-utils.create-token-values(tokens-mat-option.$prefix,
21
- tokens-mat-option.private-get-color-palette-color-tokens(map.get($config, accent)));
22
- }
15
+ .mat-accent {
16
+ @include token-utils.create-token-values(tokens-mat-option.$prefix,
17
+ tokens-mat-option.get-color-tokens($theme, accent));
18
+ }
23
19
 
24
- .mat-warn {
25
- @include token-utils.create-token-values(tokens-mat-option.$prefix,
26
- tokens-mat-option.private-get-color-palette-color-tokens(map.get($config, warn)));
27
- }
20
+ .mat-warn {
21
+ @include token-utils.create-token-values(tokens-mat-option.$prefix,
22
+ tokens-mat-option.get-color-tokens($theme, warn));
28
23
  }
29
24
  }
30
25
 
31
- @mixin typography($config-or-theme) {
32
- $config: typography.private-typography-to-2018-config(
33
- theming.get-typography-config($config-or-theme));
34
-
26
+ @mixin typography($theme) {
35
27
  @include sass-utils.current-selector-or-root() {
36
28
  @include token-utils.create-token-values(tokens-mat-option.$prefix,
37
- tokens-mat-option.get-typography-tokens($config));
29
+ tokens-mat-option.get-typography-tokens($theme));
38
30
  }
39
31
  }
40
32
 
41
- @mixin density($config-or-theme) {
42
- $density-scale: theming.get-density-config($config-or-theme);
33
+ @mixin density($theme) {
43
34
  }
44
35
 
45
- @mixin theme($theme-or-color-config) {
46
- $theme: theming.private-legacy-get-theme($theme-or-color-config);
36
+ @mixin theme($theme) {
47
37
  @include theming.private-check-duplicate-theme-styles($theme, 'mat-option') {
48
- $color: theming.get-color-config($theme);
49
- $density: theming.get-density-config($theme);
50
- $typography: theming.get-typography-config($theme);
51
-
52
- @if $color != null {
53
- @include color($color);
38
+ @if inspection.theme-has($theme, color) {
39
+ @include color($theme);
54
40
  }
55
- @if $density != null {
56
- @include density($density);
41
+ @if inspection.theme-has($theme, density) {
42
+ @include density($theme);
57
43
  }
58
- @if $typography != null {
59
- @include typography($typography);
44
+ @if inspection.theme-has($theme, typography) {
45
+ @include typography($theme);
60
46
  }
61
47
  }
62
48
  }
@@ -1,12 +1,10 @@
1
- @use 'sass:map';
2
1
  @use 'sass:meta';
3
2
  @use '../theming/theming';
3
+ @use '../theming/inspection';
4
4
 
5
5
  // Colors for the ripple elements.
6
- @mixin color($config-or-theme) {
7
- $config: theming.get-color-config($config-or-theme);
8
- $foreground: map.get($config, foreground);
9
- $foreground-base: map.get($foreground, base);
6
+ @mixin color($theme) {
7
+ $foreground-base: inspection.get-theme-color($theme, foreground, base);
10
8
  $color-opacity: 0.1;
11
9
 
12
10
  .mat-ripple-element {
@@ -22,12 +20,10 @@
22
20
  }
23
21
  }
24
22
 
25
- @mixin theme($theme-or-color-config) {
26
- $theme: theming.private-legacy-get-theme($theme-or-color-config);
23
+ @mixin theme($theme) {
27
24
  @include theming.private-check-duplicate-theme-styles($theme, 'mat-ripple') {
28
- $color: theming.get-color-config($theme);
29
- @if $color != null {
30
- @include color($color);
25
+ @if inspection.theme-has($theme, color) {
26
+ @include color($theme);
31
27
  }
32
28
  }
33
29
  }