@ng-matero/extensions 20.1.1 → 20.2.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 (45) hide show
  1. package/_index.scss +0 -1
  2. package/alert/_alert-theme.scss +19 -28
  3. package/alert/_m2-alert.scss +34 -51
  4. package/colorpicker/_colorpicker-theme.scss +24 -31
  5. package/colorpicker/_m2-colorpicker.scss +12 -35
  6. package/column-resize/index.d.ts +0 -1
  7. package/core/index.d.ts +1 -2
  8. package/core/tokens/_m2-utils.scss +17 -100
  9. package/core/tokens/_token-utils.scss +7 -27
  10. package/datetimepicker/_datetimepicker-theme.scss +24 -48
  11. package/datetimepicker/_m2-datetimepicker.scss +81 -131
  12. package/datetimepicker/_m3-datetimepicker.scss +18 -15
  13. package/datetimepicker/index.d.ts +10 -28
  14. package/drawer/_drawer-theme.scss +17 -26
  15. package/drawer/_m2-drawer.scss +12 -34
  16. package/fesm2022/mtxButton.mjs +13 -2
  17. package/fesm2022/mtxButton.mjs.map +1 -1
  18. package/fesm2022/mtxColumnResize.mjs +1 -1
  19. package/fesm2022/mtxColumnResize.mjs.map +1 -1
  20. package/fesm2022/mtxCore.mjs.map +1 -1
  21. package/fesm2022/mtxDatetimepicker.mjs +4 -4
  22. package/fesm2022/mtxDatetimepicker.mjs.map +1 -1
  23. package/fesm2022/mtxTooltip.mjs.map +1 -1
  24. package/grid/_grid-theme.scss +17 -26
  25. package/grid/_m2-grid.scss +37 -56
  26. package/loader/_loader-theme.scss +17 -26
  27. package/loader/_m2-loader.scss +9 -32
  28. package/package.json +28 -28
  29. package/popover/_m2-popover.scss +15 -37
  30. package/popover/_popover-theme.scss +16 -24
  31. package/prebuilt-themes/deeppurple-amber.css +1 -1
  32. package/prebuilt-themes/indigo-pink.css +1 -1
  33. package/prebuilt-themes/pink-bluegrey.css +1 -1
  34. package/prebuilt-themes/purple-green.css +1 -1
  35. package/progress/_m2-progress.scss +29 -44
  36. package/progress/_progress-theme.scss +17 -26
  37. package/select/_m2-select.scss +40 -67
  38. package/select/_m3-select.scss +2 -1
  39. package/select/_select-theme.scss +22 -29
  40. package/split/_m2-split.scss +13 -34
  41. package/split/_split-theme.scss +21 -30
  42. package/tooltip/_m2-tooltip.scss +18 -43
  43. package/tooltip/_tooltip-theme.scss +16 -21
  44. package/tooltip/index.d.ts +2 -2
  45. package/core/tokens/_m2-tokens.scss +0 -71
@@ -1,53 +1,38 @@
1
1
  @use 'sass:map';
2
+ @use 'sass:meta';
2
3
  @use '@angular/material' as mat;
3
4
  @use '../core/tokens/m2-utils';
5
+ @use '../core/tokens/m3-utils';
4
6
 
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
- progress-container-shape: 4px,
10
- );
11
- }
7
+ @function get-tokens($theme) {
8
+ $system: m2-utils.get-system($theme);
12
9
 
13
- // Tokens that can be configured through Angular Material's color theming API.
14
- @function get-color-tokens($theme) {
15
- $is-dark: mat.get-theme-type($theme) == dark;
16
-
17
- @return (
18
- progress-track-color: mat.get-theme-color($theme, background, hover),
19
- progress-indicator-color: mat.get-theme-color($theme, foreground, divider),
20
- progress-text-color: mat.get-theme-color($theme, foreground, text),
21
- progress-info-indicator-color: mat.m2-get-color-from-palette(mat.$m2-blue-palette, if($is-dark, 900, 500)),
22
- progress-info-text-color: white,
23
- progress-success-indicator-color: mat.m2-get-color-from-palette(mat.$m2-green-palette, if($is-dark, 900, 500)),
24
- progress-success-text-color: white,
25
- progress-warning-indicator-color: mat.m2-get-color-from-palette(mat.$m2-orange-palette, if($is-dark, 900, 500)),
26
- progress-warning-text-color: white,
27
- progress-danger-indicator-color: mat.m2-get-color-from-palette(mat.$m2-red-palette, if($is-dark, 900, 500)),
28
- progress-danger-text-color: white,
29
- );
30
- }
10
+ $is-dark: false;
11
+ @if meta.type-of($theme) == 'map' {
12
+ $is-dark: mat.get-theme-type($theme) == dark;
13
+ }
31
14
 
32
- // Tokens that can be configured through Angular Material's typography theming API.
33
- @function get-typography-tokens($theme) {
34
15
  @return (
35
- progress-text-size: 12px,
36
- );
37
- }
38
-
39
- // Tokens that can be configured through Angular Material's density theming API.
40
- @function get-density-tokens($theme) {
41
- @return ();
42
- }
43
-
44
- // Combines the tokens generated by the above functions into a single map with placeholder values.
45
- // This is used to create token slots.
46
- @function get-token-slots() {
47
- @return mat.private-deep-merge-all(
48
- get-unthemable-tokens(),
49
- get-color-tokens(m2-utils.$placeholder-color-config),
50
- get-typography-tokens(m2-utils.$placeholder-typography-config),
51
- get-density-tokens(m2-utils.$placeholder-density-config)
16
+ base: (
17
+ progress-container-shape: 4px,
18
+ ),
19
+ color: (
20
+ progress-track-color: m3-utils.color-with-opacity(
21
+ map.get($system, on-surface), map.get($system, hover-state-layer-opacity)),
22
+ progress-indicator-color: map.get($system, outline),
23
+ progress-text-color: map.get($system, on-surface),
24
+ progress-info-indicator-color: mat.m2-get-color-from-palette(mat.$m2-blue-palette, if($is-dark, 900, 500)),
25
+ progress-info-text-color: white,
26
+ progress-success-indicator-color: mat.m2-get-color-from-palette(mat.$m2-green-palette, if($is-dark, 900, 500)),
27
+ progress-success-text-color: white,
28
+ progress-warning-indicator-color: mat.m2-get-color-from-palette(mat.$m2-orange-palette, if($is-dark, 900, 500)),
29
+ progress-warning-text-color: white,
30
+ progress-danger-indicator-color: mat.m2-get-color-from-palette(mat.$m2-red-palette, if($is-dark, 900, 500)),
31
+ progress-danger-text-color: white,
32
+ ),
33
+ typography: (
34
+ progress-text-size: 12px,
35
+ ),
36
+ density: ()
52
37
  );
53
38
  }
@@ -5,47 +5,39 @@
5
5
  @use './m3-progress';
6
6
 
7
7
  @mixin base($theme) {
8
+ $tokens: map.get(m2-progress.get-tokens($theme), base);
8
9
  @if mat.get-theme-version($theme) == 1 {
9
- @include token-utils.create-token-values(map.get(m3-progress.get-tokens($theme), base));
10
- }
11
- @else {
12
- @include mat.private-current-selector-or-root() {
13
- @include token-utils.create-token-values-mixed(m2-progress.get-unthemable-tokens());
14
- }
10
+ $tokens: map.get(m3-progress.get-tokens($theme), base);
15
11
  }
12
+
13
+ @include token-utils.values($tokens);
16
14
  }
17
15
 
18
16
  @mixin color($theme) {
17
+ $tokens: map.get(m2-progress.get-tokens($theme), color);
19
18
  @if mat.get-theme-version($theme) == 1 {
20
- @include token-utils.create-token-values(map.get(m3-progress.get-tokens($theme), color));
21
- }
22
- @else {
23
- @include mat.private-current-selector-or-root() {
24
- @include token-utils.create-token-values(m2-progress.get-color-tokens($theme));
25
- }
19
+ $tokens: map.get(m3-progress.get-tokens($theme), color);
26
20
  }
21
+
22
+ @include token-utils.values($tokens);
27
23
  }
28
24
 
29
25
  @mixin typography($theme) {
26
+ $tokens: map.get(m2-progress.get-tokens($theme), typography);
30
27
  @if mat.get-theme-version($theme) == 1 {
31
- @include token-utils.create-token-values(map.get(m3-progress.get-tokens($theme), typography));
32
- }
33
- @else {
34
- @include mat.private-current-selector-or-root() {
35
- @include token-utils.create-token-values(m2-progress.get-typography-tokens($theme));
36
- }
28
+ $tokens: map.get(m3-progress.get-tokens($theme), typography);
37
29
  }
30
+
31
+ @include token-utils.values($tokens);
38
32
  }
39
33
 
40
34
  @mixin density($theme) {
35
+ $tokens: map.get(m2-progress.get-tokens($theme), density);
41
36
  @if mat.get-theme-version($theme) == 1 {
42
- @include token-utils.create-token-values(map.get(m3-progress.get-tokens($theme), density));
43
- }
44
- @else {
45
- @include mat.private-current-selector-or-root() {
46
- @include token-utils.create-token-values-mixed(m2-progress.get-density-tokens($theme));
47
- }
37
+ $tokens: map.get(m3-progress.get-tokens($theme), density);
48
38
  }
39
+
40
+ @include token-utils.values($tokens);
49
41
  }
50
42
 
51
43
  /// Defines the tokens that will be available in the `overrides` mixin and for docs extraction.
@@ -68,8 +60,7 @@
68
60
  @include color($theme);
69
61
  @include density($theme);
70
62
  @include typography($theme);
71
- }
72
- @else {
63
+ } @else {
73
64
  @include base($theme);
74
65
  @if mat.theme-has($theme, color) {
75
66
  @include color($theme);
@@ -1,79 +1,52 @@
1
1
  @use 'sass:map';
2
- @use 'sass:math';
3
- @use '@angular/material' as mat;
4
2
  @use '../core/tokens/m2-utils';
3
+ @use '../core/tokens/m3-utils';
5
4
  @use '../core/style/elevation';
6
5
 
7
- // Generates the tokens used to theme the option based on a palette.
8
- @function private-get-color-palette-color-tokens($theme, $palette-name) {
6
+ @function get-tokens($theme) {
9
7
  @return (
10
- select-option-selected-state-text-color: mat.get-theme-color($theme, $palette-name),
11
- );
12
- }
13
-
14
- // Tokens that can't be configured through Angular Material's current theming API,
15
- // but may be in a future version of the theming API.
16
- @function get-unthemable-tokens() {
17
- @return (
18
- select-container-shape: 4px,
19
- select-container-elevation-shadow: elevation.get-box-shadow(8),
8
+ base: (
9
+ select-container-shape: 4px,
10
+ select-container-elevation-shadow: elevation.get-box-shadow(8),
11
+ ),
12
+ color: private-get-color-palette-color-tokens($theme, primary),
13
+ typography: (),
14
+ density: ()
20
15
  );
21
16
  }
22
17
 
23
18
  // Tokens that can be configured through Angular Material's color theming API.
24
- @function get-color-tokens($theme) {
25
- $text-color: mat.get-theme-color($theme, foreground, text);
26
- $hint-text-color: mat.get-theme-color($theme, foreground, hint-text);
27
- $secondary-text-color: mat.get-theme-color($theme, foreground, secondary-text);
28
- $disabled-text-color: mat.get-theme-color($theme, foreground, disabled-text);
29
- $divider-color: mat.get-theme-color($theme, foreground, divider);
30
- $hover-color: mat.get-theme-color($theme, background, hover);
31
- $palette-tokens: private-get-color-palette-color-tokens($theme, primary);
32
-
33
- @return map.merge($palette-tokens, (
34
- select-container-text-color: $text-color,
35
- select-placeholder-text-color: $hint-text-color,
36
- select-disabled-text-color: $hint-text-color,
37
-
38
- select-multiple-value-background-color: mat.get-theme-color($theme, background, unselected-chip),
39
- select-multiple-value-outline-color: $divider-color,
40
- select-multiple-value-disabled-outline-color: mat.get-theme-color($theme, foreground, divider, 0.06),
41
- select-multiple-value-icon-hover-background-color: $divider-color,
42
-
43
- select-clear-icon-color: $secondary-text-color,
44
- select-clear-icon-hover-color: mat.get-theme-color($theme, warn),
45
-
46
- select-enabled-arrow-color: $secondary-text-color,
47
- select-disabled-arrow-color: $disabled-text-color,
48
- select-invalid-arrow-color: mat.get-theme-color($theme, warn),
19
+ @function private-get-color-palette-color-tokens($theme, $color-variant) {
20
+ $system: m2-utils.get-system($theme);
21
+ $system: m3-utils.replace-colors-with-variant($system, primary, $color-variant);
49
22
 
50
- select-panel-background-color: mat.get-theme-color($theme, background, card),
51
- select-panel-divider-color: $divider-color,
52
- select-optgroup-label-text-color: $secondary-text-color,
53
- select-option-label-text-color: $text-color,
54
- select-option-selected-state-background-color: $hover-color,
55
- select-option-hover-state-background-color: $hover-color,
56
- select-option-disabled-state-text-color: $hint-text-color,
57
- ));
58
- }
59
-
60
- // Tokens that can be configured through Angular Material's typography theming API.
61
- @function get-typography-tokens($theme) {
62
- @return ();
63
- }
64
-
65
- // Tokens that can be configured through Angular Material's density theming API.
66
- @function get-density-tokens($theme) {
67
- @return ();
68
- }
69
-
70
- // Combines the tokens generated by the above functions into a single map with placeholder values.
71
- // This is used to create token slots.
72
- @function get-token-slots() {
73
- @return mat.private-deep-merge-all(
74
- get-unthemable-tokens(),
75
- get-color-tokens(m2-utils.$placeholder-color-config),
76
- get-typography-tokens(m2-utils.$placeholder-typography-config),
77
- get-density-tokens(m2-utils.$placeholder-density-config)
23
+ @return (
24
+ select-container-text-color: map.get($system, on-surface),
25
+ select-placeholder-text-color: m3-utils.color-with-opacity(map.get($system, on-surface), 38%),
26
+ select-disabled-text-color: m3-utils.color-with-opacity(map.get($system, on-surface), 38%),
27
+
28
+ select-multiple-value-background-color: map.get($system, outline),
29
+ select-multiple-value-outline-color: map.get($system, outline),
30
+ select-multiple-value-disabled-outline-color: m3-utils.color-with-opacity(map.get($system, outline), 38%),
31
+ select-multiple-value-icon-hover-background-color: map.get($system, outline),
32
+
33
+ select-clear-icon-color: map.get($system, on-surface-variant),
34
+ select-clear-icon-hover-color: map.get($system, error),
35
+
36
+ select-enabled-arrow-color: map.get($system, on-surface-variant),
37
+ select-disabled-arrow-color: m3-utils.color-with-opacity(map.get($system, on-surface), 38%),
38
+ select-invalid-arrow-color: map.get($system, error),
39
+
40
+ select-panel-background-color: map.get($system, surface),
41
+ select-panel-divider-color: map.get($system, outline),
42
+ select-optgroup-label-text-color: map.get($system, on-surface-variant),
43
+ select-option-label-text-color: map.get($system, on-surface),
44
+ select-option-selected-state-text-color: map.get($system, primary),
45
+ select-option-selected-state-background-color: m3-utils.color-with-opacity(
46
+ map.get($system, on-surface), map.get($system, hover-state-layer-opacity)),
47
+ select-option-hover-state-background-color: m3-utils.color-with-opacity(
48
+ map.get($system, on-surface), map.get($system, hover-state-layer-opacity)),
49
+ select-option-disabled-state-text-color: m3-utils.color-with-opacity(map.get($system, on-surface), 38%),
78
50
  );
79
51
  }
52
+
@@ -35,7 +35,8 @@
35
35
  select-option-label-text-color: map.get($system, on-surface),
36
36
  select-option-selected-state-background-color: map.get($system, secondary-container),
37
37
  select-option-selected-state-text-color: map.get($system, on-surface),
38
- select-option-hover-state-background-color: m3-utils.color-with-opacity(map.get($system, on-surface), map.get($system,hover-state-layer-opacity)),
38
+ select-option-hover-state-background-color: m3-utils.color-with-opacity(
39
+ map.get($system, on-surface), map.get($system,hover-state-layer-opacity)),
39
40
  select-option-disabled-state-text-color: m3-utils.color-with-opacity(map.get($system, on-surface), 38%),
40
41
  ),
41
42
  typography: (),
@@ -5,59 +5,53 @@
5
5
  @use './m3-select';
6
6
 
7
7
  @mixin base($theme) {
8
+ $tokens: map.get(m2-select.get-tokens($theme), base);
8
9
  @if mat.get-theme-version($theme) == 1 {
9
- @include token-utils.create-token-values(map.get(m3-select.get-tokens($theme), base));
10
- }
11
- @else {
12
- @include mat.private-current-selector-or-root() {
13
- @include token-utils.create-token-values-mixed(m2-select.get-unthemable-tokens());
14
- }
10
+ $tokens: map.get(m3-select.get-tokens($theme), base);
15
11
  }
12
+
13
+ @include token-utils.values($tokens);
16
14
  }
17
15
 
18
16
  @mixin color($theme, $color-variant: null) {
17
+ $tokens: map.get(m2-select.get-tokens($theme), color);
19
18
  @if mat.get-theme-version($theme) == 1 {
20
- @include token-utils.create-token-values(map.get(m3-select.get-tokens($theme, $color-variant), color));
19
+ $tokens: map.get(m3-select.get-tokens($theme, $color-variant), color);
21
20
  }
22
- @else {
23
- @include mat.private-current-selector-or-root() {
24
- @include token-utils.create-token-values-mixed(m2-select.get-color-tokens($theme));
25
- }
26
21
 
22
+ @include token-utils.values($tokens);
23
+
24
+ @if mat.get-theme-version($theme) != 1 {
27
25
  .ng-dropdown-panel {
28
26
  &.mat-accent {
29
- $accent-tokens: m2-select.private-get-color-palette-color-tokens($theme, accent);
30
- @include token-utils.create-token-values-mixed($accent-tokens);
27
+ $tokens: m2-select.private-get-color-palette-color-tokens($theme, secondary);
28
+ @include token-utils.values($tokens);
31
29
  }
32
30
 
33
31
  &.mat-warn {
34
- $warn-tokens: m2-select.private-get-color-palette-color-tokens($theme, warn);
35
- @include token-utils.create-token-values-mixed($warn-tokens);
32
+ $tokens: m2-select.private-get-color-palette-color-tokens($theme, error);
33
+ @include token-utils.values($tokens);
36
34
  }
37
35
  }
38
36
  }
39
37
  }
40
38
 
41
39
  @mixin typography($theme) {
40
+ $tokens: map.get(m2-select.get-tokens($theme), typography);
42
41
  @if mat.get-theme-version($theme) == 1 {
43
- @include token-utils.create-token-values(map.get(m3-select.get-tokens($theme), typography));
44
- }
45
- @else {
46
- @include mat.private-current-selector-or-root() {
47
- @include token-utils.create-token-values-mixed(m2-select.get-typography-tokens($theme));
48
- }
42
+ $tokens: map.get(m3-select.get-tokens($theme), typography);
49
43
  }
44
+
45
+ @include token-utils.values($tokens);
50
46
  }
51
47
 
52
48
  @mixin density($theme) {
49
+ $tokens: map.get(m2-select.get-tokens($theme), density);
53
50
  @if mat.get-theme-version($theme) == 1 {
54
- @include token-utils.create-token-values(map.get(m3-select.get-tokens($theme), density));
55
- }
56
- @else {
57
- @include mat.private-current-selector-or-root() {
58
- @include token-utils.create-token-values-mixed(m2-select.get-density-tokens($theme));
59
- }
51
+ $tokens: map.get(m3-select.get-tokens($theme), density);
60
52
  }
53
+
54
+ @include token-utils.values($tokens);
61
55
  }
62
56
 
63
57
  /// Defines the tokens that will be available in the `overrides` mixin and for docs extraction.
@@ -80,8 +74,7 @@
80
74
  @include color($theme, $color-variant);
81
75
  @include density($theme);
82
76
  @include typography($theme);
83
- }
84
- @else {
77
+ } @else {
85
78
  @include base($theme);
86
79
  @if mat.theme-has($theme, color) {
87
80
  @include color($theme);
@@ -3,45 +3,24 @@
3
3
  @use 'sass:meta';
4
4
  @use '@angular/material' as mat;
5
5
  @use '../core/tokens/m2-utils';
6
+ @use '../core/tokens/m3-utils';
6
7
 
7
- @function private-get-color-palette-color-tokens($theme, $palette-name) {
8
+ @function get-tokens($theme) {
8
9
  @return (
9
- split-gutter-hover-state-background-color: mat.get-theme-color($theme, $palette-name, text),
10
+ base: (),
11
+ color: private-get-color-palette-color-tokens($theme, primary),
12
+ typography: (),
13
+ density: ()
10
14
  );
11
15
  }
12
16
 
13
- // Tokens that can't be configured through Angular Material's current theming API,
14
- // but may be in a future version of the theming API.
15
- @function get-unthemable-tokens() {
16
- @return ();
17
- }
18
-
19
17
  // Tokens that can be configured through Angular Material's color theming API.
20
- @function get-color-tokens($theme) {
21
- $gutter-tokens: private-get-color-palette-color-tokens($theme, primary);
22
-
23
- @return mat.private-merge-all($gutter-tokens, (
24
- split-gutter-background-color: mat.get-theme-color($theme, foreground, divider),
25
- ));
26
- }
27
-
28
- // Tokens that can be configured through Angular Material's typography theming API.
29
- @function get-typography-tokens($theme) {
30
- @return ();
31
- }
32
-
33
- // Tokens that can be configured through Angular Material's density theming API.
34
- @function get-density-tokens($theme) {
35
- @return ();
36
- }
18
+ @function private-get-color-palette-color-tokens($theme, $color-variant) {
19
+ $system: m2-utils.get-system($theme);
20
+ $system: m3-utils.replace-colors-with-variant($system, primary, $color-variant);
37
21
 
38
- // Combines the tokens generated by the above functions into a single map with placeholder values.
39
- // This is used to create token slots.
40
- @function get-token-slots() {
41
- @return mat.private-deep-merge-all(
42
- get-unthemable-tokens(),
43
- get-color-tokens(m2-utils.$placeholder-color-config),
44
- get-typography-tokens(m2-utils.$placeholder-typography-config),
45
- get-density-tokens(m2-utils.$placeholder-density-config)
46
- );
22
+ @return (
23
+ split-gutter-background-color: map.get($system, outline),
24
+ split-gutter-hover-state-background-color: map.get($system, primary),
25
+ )
47
26
  }
@@ -5,59 +5,51 @@
5
5
  @use './m3-split';
6
6
 
7
7
  @mixin base($theme) {
8
+ $tokens: map.get(m2-split.get-tokens($theme), base);
8
9
  @if mat.get-theme-version($theme) == 1 {
9
- @include token-utils.create-token-values(map.get(m3-split.get-tokens($theme), base));
10
- }
11
- @else {
12
- @include mat.private-current-selector-or-root() {
13
- @include token-utils.create-token-values-mixed(m2-split.get-unthemable-tokens());
14
- }
10
+ $tokens: map.get(m3-split.get-tokens($theme), base);
15
11
  }
16
12
  }
17
13
 
18
14
  @mixin color($theme, $color-variant: null) {
15
+ $tokens: map.get(m2-split.get-tokens($theme), color);
19
16
  @if mat.get-theme-version($theme) == 1 {
20
- @include token-utils.create-token-values(map.get(m3-split.get-tokens($theme, $color-variant), color));
17
+ $tokens: map.get(m3-split.get-tokens($theme, $color-variant), color);
21
18
  }
22
- @else {
23
- @include mat.private-current-selector-or-root() {
24
- @include token-utils.create-token-values-mixed(m2-split.get-color-tokens($theme));
25
- }
26
19
 
27
- .mtx-split>.mtx-split-gutter {
20
+ @include token-utils.values($tokens);
21
+
22
+ @if mat.get-theme-version($theme) != 1 {
23
+ .mtx-split > .mtx-split-gutter {
28
24
  &.mat-accent:hover {
29
- $accent-tokens: m2-split.private-get-color-palette-color-tokens($theme, accent);
30
- @include token-utils.create-token-values-mixed($accent-tokens);
25
+ $tokens: m2-split.private-get-color-palette-color-tokens($theme, secondary);
26
+ @include token-utils.values($tokens);
31
27
  }
32
28
 
33
29
  &.mat-warn:hover {
34
- $warn-tokens: m2-split.private-get-color-palette-color-tokens($theme, warn);
35
- @include token-utils.create-token-values-mixed($warn-tokens);
30
+ $tokens: m2-split.private-get-color-palette-color-tokens($theme, error);
31
+ @include token-utils.values($tokens);
36
32
  }
37
33
  }
38
34
  }
39
35
  }
40
36
 
41
37
  @mixin typography($theme) {
38
+ $tokens: map.get(m2-split.get-tokens($theme), typography);
42
39
  @if mat.get-theme-version($theme) == 1 {
43
- @include token-utils.create-token-values(map.get(m3-split.get-tokens($theme), typography));
44
- }
45
- @else {
46
- @include mat.private-current-selector-or-root() {
47
- @include token-utils.create-token-values-mixed(m2-split.get-typography-tokens($theme));
48
- }
40
+ $tokens: map.get(m3-split.get-tokens($theme), typography);
49
41
  }
42
+
43
+ @include token-utils.values($tokens);
50
44
  }
51
45
 
52
46
  @mixin density($theme) {
47
+ $tokens: map.get(m2-split.get-tokens($theme), density);
53
48
  @if mat.get-theme-version($theme) == 1 {
54
- @include token-utils.create-token-values(map.get(m3-split.get-tokens($theme), density));
55
- }
56
- @else {
57
- @include mat.private-current-selector-or-root() {
58
- @include token-utils.create-token-values-mixed(m2-split.get-density-tokens($theme));
59
- }
49
+ $tokens: map.get(m3-split.get-tokens($theme), density);
60
50
  }
51
+
52
+ @include token-utils.values($tokens);
61
53
  }
62
54
 
63
55
  /// Defines the tokens that will be available in the `overrides` mixin and for docs extraction.
@@ -80,8 +72,7 @@
80
72
  @include color($theme, $color-variant);
81
73
  @include density($theme);
82
74
  @include typography($theme);
83
- }
84
- @else {
75
+ } @else {
85
76
  @include base($theme);
86
77
  @if mat.theme-has($theme, color) {
87
78
  @include color($theme);
@@ -1,50 +1,25 @@
1
- @use '@angular/material' as mat;
1
+ @use 'sass:map';
2
2
  @use '../core/tokens/m2-utils';
3
3
 
4
- // Tokens that can't be configured through Angular Material's current theming API,
5
- // but may be in a future version of the theming API.
6
- //
7
- // Tokens that are available in MDC, but not used in Angular Material should be mapped to `null`.
8
- // `null` indicates that we are intentionally choosing not to emit a slot or value for the token in
9
- // our CSS.
10
- @function get-unthemable-tokens() {
11
- @return (
12
- tooltip-container-shape: 4px,
13
- tooltip-supporting-text-line-height: 16px,
14
- );
15
- }
16
-
17
- // Tokens that can be configured through Angular Material's color theming API.
18
- @function get-color-tokens($theme) {
19
-
20
- @return (
21
- tooltip-container-color: mat.get-theme-color($theme, background, tooltip),
22
- tooltip-supporting-text-color: #fff,
23
- );
24
- }
4
+ @function get-tokens($theme) {
5
+ $system: m2-utils.get-system($theme);
25
6
 
26
- // Tokens that can be configured through Angular Material's typography theming API.
27
- @function get-typography-tokens($theme) {
28
7
  @return (
29
- tooltip-supporting-text-font: mat.get-theme-typography($theme, caption, font-family),
30
- tooltip-supporting-text-size: mat.get-theme-typography($theme, caption, font-size),
31
- tooltip-supporting-text-weight: mat.get-theme-typography($theme, caption, font-weight),
32
- tooltip-supporting-text-tracking: mat.get-theme-typography($theme, caption, letter-spacing),
8
+ base: (
9
+ tooltip-container-shape: 4px,
10
+ tooltip-supporting-text-line-height: 16px,
11
+ ),
12
+ color: (
13
+ tooltip-container-color: map.get($system, inverse-surface),
14
+ tooltip-supporting-text-color: map.get($system, inverse-on-surface),
15
+ ),
16
+ typography: (
17
+ tooltip-supporting-text-font: map.get($system, body-small-font),
18
+ tooltip-supporting-text-size: map.get($system, body-small-size),
19
+ tooltip-supporting-text-weight: map.get($system, body-small-weight),
20
+ tooltip-supporting-text-tracking: map.get($system, body-small-tracking),
21
+ ),
22
+ density: (),
33
23
  );
34
24
  }
35
25
 
36
- // Tokens that can be configured through Angular Material's density theming API.
37
- @function get-density-tokens($theme) {
38
- @return ();
39
- }
40
-
41
- // Combines the tokens generated by the above functions into a single map with placeholder values.
42
- // This is used to create token slots.
43
- @function get-token-slots() {
44
- @return mat.private-deep-merge-all(
45
- get-unthemable-tokens(),
46
- get-color-tokens(m2-utils.$placeholder-color-config),
47
- get-typography-tokens(m2-utils.$placeholder-typography-config),
48
- get-density-tokens(m2-utils.$placeholder-density-config)
49
- );
50
- }
@@ -5,44 +5,39 @@
5
5
  @use './m3-tooltip';
6
6
 
7
7
  @mixin base($theme) {
8
+ $tokens: map.get(m2-tooltip.get-tokens($theme), base);
8
9
  @if mat.get-theme-version($theme) == 1 {
9
- @include token-utils.create-token-values(map.get(m3-tooltip.get-tokens($theme), base));
10
- } @else {
11
- // Add default values for tokens not related to color, typography, or density.
12
- @include mat.private-current-selector-or-root() {
13
- @include token-utils.create-token-values-mixed(m2-tooltip.get-unthemable-tokens());
14
- }
10
+ $tokens: map.get(m3-tooltip.get-tokens($theme), base);
15
11
  }
12
+
13
+ @include token-utils.values($tokens);
16
14
  }
17
15
 
18
16
  @mixin color($theme) {
17
+ $tokens: map.get(m2-tooltip.get-tokens($theme), color);
19
18
  @if mat.get-theme-version($theme) == 1 {
20
- @include token-utils.create-token-values(map.get(m3-tooltip.get-tokens($theme), color));
21
- } @else {
22
- @include mat.private-current-selector-or-root() {
23
- @include token-utils.create-token-values-mixed(m2-tooltip.get-color-tokens($theme));
24
- }
19
+ $tokens: map.get(m3-tooltip.get-tokens($theme), color);
25
20
  }
21
+
22
+ @include token-utils.values($tokens);
26
23
  }
27
24
 
28
25
  @mixin typography($theme) {
26
+ $tokens: map.get(m2-tooltip.get-tokens($theme), typography);
29
27
  @if mat.get-theme-version($theme) == 1 {
30
- @include token-utils.create-token-values(map.get(m3-tooltip.get-tokens($theme), typography));
31
- } @else {
32
- @include mat.private-current-selector-or-root() {
33
- @include token-utils.create-token-values-mixed(m2-tooltip.get-typography-tokens($theme));
34
- }
28
+ $tokens: map.get(m3-tooltip.get-tokens($theme), typography);
35
29
  }
30
+
31
+ @include token-utils.values($tokens);
36
32
  }
37
33
 
38
34
  @mixin density($theme) {
35
+ $tokens: map.get(m2-tooltip.get-tokens($theme), density);
39
36
  @if mat.get-theme-version($theme) == 1 {
40
- @include token-utils.create-token-values(map.get(m3-tooltip.get-tokens($theme), density));
41
- } @else {
42
- @include mat.private-current-selector-or-root() {
43
- @include token-utils.create-token-values-mixed(m2-tooltip.get-density-tokens($theme));
44
- }
37
+ $tokens: map.get(m3-tooltip.get-tokens($theme), density);
45
38
  }
39
+
40
+ @include token-utils.values($tokens);
46
41
  }
47
42
 
48
43
  /// Defines the tokens that will be available in the `overrides` mixin and for docs extraction.