@ng-matero/extensions 20.1.1 → 20.2.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 (50) hide show
  1. package/_index.scss +0 -1
  2. package/alert/_alert-theme.scss +18 -27
  3. package/alert/_m2-alert.scss +34 -51
  4. package/colorpicker/_colorpicker-theme.scss +23 -30
  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/_m3-system.scss +11 -9
  10. package/core/tokens/_token-utils.scss +7 -27
  11. package/datetimepicker/_datetimepicker-theme.scss +23 -47
  12. package/datetimepicker/_m2-datetimepicker.scss +81 -131
  13. package/datetimepicker/_m3-datetimepicker.scss +18 -15
  14. package/datetimepicker/index.d.ts +10 -28
  15. package/drawer/_drawer-theme.scss +17 -26
  16. package/drawer/_m2-drawer.scss +12 -34
  17. package/fesm2022/mtxButton.mjs +13 -2
  18. package/fesm2022/mtxButton.mjs.map +1 -1
  19. package/fesm2022/mtxColumnResize.mjs +1 -1
  20. package/fesm2022/mtxColumnResize.mjs.map +1 -1
  21. package/fesm2022/mtxCore.mjs.map +1 -1
  22. package/fesm2022/mtxDatetimepicker.mjs +4 -4
  23. package/fesm2022/mtxDatetimepicker.mjs.map +1 -1
  24. package/fesm2022/mtxTooltip.mjs.map +1 -1
  25. package/grid/_grid-theme.scss +17 -26
  26. package/grid/_m2-grid.scss +37 -56
  27. package/loader/_loader-theme.scss +17 -26
  28. package/loader/_m2-loader.scss +9 -32
  29. package/package.json +18 -18
  30. package/popover/_m2-popover.scss +15 -37
  31. package/popover/_popover-theme.scss +16 -24
  32. package/prebuilt-themes/azure-blue.css +1 -1
  33. package/prebuilt-themes/cyan-orange.css +1 -1
  34. package/prebuilt-themes/deeppurple-amber.css +1 -1
  35. package/prebuilt-themes/indigo-pink.css +1 -1
  36. package/prebuilt-themes/magenta-violet.css +1 -1
  37. package/prebuilt-themes/pink-bluegrey.css +1 -1
  38. package/prebuilt-themes/purple-green.css +1 -1
  39. package/prebuilt-themes/rose-red.css +1 -1
  40. package/progress/_m2-progress.scss +29 -44
  41. package/progress/_progress-theme.scss +17 -26
  42. package/select/_m2-select.scss +40 -67
  43. package/select/_m3-select.scss +2 -1
  44. package/select/_select-theme.scss +22 -29
  45. package/split/_m2-split.scss +13 -34
  46. package/split/_split-theme.scss +21 -30
  47. package/tooltip/_m2-tooltip.scss +18 -43
  48. package/tooltip/_tooltip-theme.scss +16 -21
  49. package/tooltip/index.d.ts +2 -2
  50. package/core/tokens/_m2-tokens.scss +0 -71
package/_index.scss CHANGED
@@ -27,7 +27,6 @@ tooltip-color, tooltip-typography, tooltip-density, tooltip-base, tooltip-overri
27
27
  define-density;
28
28
  @forward './core/theming/color-api-backwards-compatibility' show color-variants-backwards-compatibility;
29
29
 
30
- @forward './core/tokens/m2-tokens' show m2-tokens-from-theme;
31
30
  @forward './core/tokens/m3-system' show system-level-colors,
32
31
  system-level-typography, system-level-elevation, system-level-shape,
33
32
  system-level-motion, system-level-state, theme, theme-overrides;
@@ -5,47 +5,39 @@
5
5
  @use './m3-alert';
6
6
 
7
7
  @mixin base($theme) {
8
+ $tokens: map.get(m2-alert.get-tokens($theme), base);
8
9
  @if mat.get-theme-version($theme) == 1 {
9
- @include token-utils.create-token-values(map.get(m3-alert.get-tokens($theme), base));
10
- }
11
- @else {
12
- @include mat.private-current-selector-or-root() {
13
- @include token-utils.create-token-values-mixed(m2-alert.get-unthemable-tokens());
14
- }
10
+ $tokens: map.get(m3-alert.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-alert.get-tokens($theme), color);
19
18
  @if mat.get-theme-version($theme) == 1 {
20
- @include token-utils.create-token-values(map.get(m3-alert.get-tokens($theme), color));
21
- }
22
- @else {
23
- @include mat.private-current-selector-or-root() {
24
- @include token-utils.create-token-values-mixed(m2-alert.get-color-tokens($theme));
25
- }
19
+ $tokens: map.get(m3-alert.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-alert.get-tokens($theme), typography);
30
27
  @if mat.get-theme-version($theme) == 1 {
31
- @include token-utils.create-token-values(map.get(m3-alert.get-tokens($theme), typography));
32
- }
33
- @else {
34
- @include mat.private-current-selector-or-root() {
35
- @include token-utils.create-token-values-mixed(m2-alert.get-typography-tokens($theme));
36
- }
28
+ $tokens: map.get(m3-alert.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-alert.get-tokens($theme), density);
41
36
  @if mat.get-theme-version($theme) == 1 {
42
- @include token-utils.create-token-values(map.get(m3-alert.get-tokens($theme), density));
43
- }
44
- @else {
45
- @include mat.private-current-selector-or-root() {
46
- @include token-utils.create-token-values-mixed(m2-alert.get-density-tokens($theme));
47
- }
37
+ $tokens: map.get(m3-alert.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.
@@ -53,7 +45,7 @@
53
45
  @return (
54
46
  (
55
47
  namespace: alert,
56
- tokens: token-utils.get-overrides(m3-alert.get-tokens(), alert),
48
+ tokens: token-utils.get-overrides(m3-alert.get-tokens(), alert)
57
49
  ),
58
50
  );
59
51
  }
@@ -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,59 +1,42 @@
1
1
  @use 'sass:map';
2
+ @use 'sass:meta';
2
3
  @use '@angular/material' as mat;
3
4
  @use '../core/tokens/m2-utils';
4
5
 
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
- alert-container-shape: 4px,
10
- );
11
- }
6
+ @function get-tokens($theme) {
7
+ $system: m2-utils.get-system($theme);
12
8
 
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;
9
+ $is-dark: false;
10
+ @if meta.type-of($theme) == 'map' {
11
+ $is-dark: mat.get-theme-type($theme) == dark;
12
+ }
16
13
 
17
14
  @return (
18
- alert-outline-color: transparent,
19
- alert-background-color: mat.m2-get-color-from-palette(mat.$m2-gray-palette, if($is-dark, 900, 100)),
20
- alert-text-color: mat.get-theme-color($theme, foreground, text),
21
-
22
- alert-info-outline-color: transparent,
23
- alert-info-background-color: mat.m2-get-color-from-palette(mat.$m2-blue-palette, if($is-dark, 900, 100)),
24
- alert-info-text-color: mat.get-theme-color($theme, foreground, text),
25
-
26
- alert-success-outline-color: transparent,
27
- alert-success-background-color: mat.m2-get-color-from-palette(mat.$m2-green-palette, if($is-dark, 900, 100)),
28
- alert-success-text-color: mat.get-theme-color($theme, foreground, text),
29
-
30
- alert-warning-outline-color: transparent,
31
- alert-warning-background-color: mat.m2-get-color-from-palette(mat.$m2-amber-palette, if($is-dark, 900, 100)),
32
- alert-warning-text-color: mat.get-theme-color($theme, foreground, text),
33
-
34
- alert-danger-outline-color: transparent,
35
- alert-danger-background-color: mat.m2-get-color-from-palette(mat.$m2-red-palette, if($is-dark, 900, 100)),
36
- alert-danger-text-color: mat.get-theme-color($theme, foreground, text),
37
- );
38
- }
39
-
40
- // Tokens that can be configured through Angular Material's typography theming API.
41
- @function get-typography-tokens($theme) {
42
- @return ();
43
- }
44
-
45
- // Tokens that can be configured through Angular Material's density theming API.
46
- @function get-density-tokens($theme) {
47
- @return ();
48
- }
49
-
50
- // Combines the tokens generated by the above functions into a single map with placeholder values.
51
- // This is used to create token slots.
52
- @function get-token-slots() {
53
- @return mat.private-deep-merge-all(
54
- get-unthemable-tokens(),
55
- get-color-tokens(m2-utils.$placeholder-color-config),
56
- get-typography-tokens(m2-utils.$placeholder-typography-config),
57
- get-density-tokens(m2-utils.$placeholder-density-config)
58
- );
15
+ base: (
16
+ alert-container-shape: 4px,
17
+ ),
18
+ color: (
19
+ alert-outline-color: transparent,
20
+ alert-background-color: mat.m2-get-color-from-palette(mat.$m2-gray-palette, if($is-dark, 900, 100)),
21
+ alert-text-color: map.get($system, on-surface),
22
+
23
+ alert-info-outline-color: transparent,
24
+ alert-info-background-color: mat.m2-get-color-from-palette(mat.$m2-blue-palette, if($is-dark, 900, 100)),
25
+ alert-info-text-color: map.get($system, on-surface),
26
+
27
+ alert-success-outline-color: transparent,
28
+ alert-success-background-color: mat.m2-get-color-from-palette(mat.$m2-green-palette, if($is-dark, 900, 100)),
29
+ alert-success-text-color: map.get($system, on-surface),
30
+
31
+ alert-warning-outline-color: transparent,
32
+ alert-warning-background-color: mat.m2-get-color-from-palette(mat.$m2-amber-palette, if($is-dark, 900, 100)),
33
+ alert-warning-text-color: map.get($system, on-surface),
34
+
35
+ alert-danger-outline-color: transparent,
36
+ alert-danger-background-color: mat.m2-get-color-from-palette(mat.$m2-red-palette, if($is-dark, 900, 100)),
37
+ alert-danger-text-color: map.get($system, on-surface),
38
+ ),
39
+ typography: (),
40
+ density: ()
41
+ )
59
42
  }
@@ -6,59 +6,53 @@
6
6
  @use './m3-colorpicker';
7
7
 
8
8
  @mixin base($theme) {
9
+ $tokens: map.get(m2-colorpicker.get-tokens($theme), base);
9
10
  @if mat.get-theme-version($theme) == 1 {
10
- @include token-utils.create-token-values(map.get(m3-colorpicker.get-tokens($theme), base));
11
- }
12
- @else {
13
- @include mat.private-current-selector-or-root() {
14
- @include token-utils.create-token-values-mixed(m2-colorpicker.get-unthemable-tokens());
15
- }
11
+ $tokens: map.get(m3-colorpicker.get-tokens($theme), base);
16
12
  }
13
+
14
+ @include token-utils.values($tokens);
17
15
  }
18
16
 
19
17
  @mixin color($theme, $color-variant: null) {
18
+ $tokens: map.get(m2-colorpicker.get-tokens($theme), color);
20
19
  @if mat.get-theme-version($theme) == 1 {
21
- @include token-utils.create-token-values(map.get(m3-colorpicker.get-tokens($theme), color));
20
+ $tokens: map.get(m3-colorpicker.get-tokens($theme, $color-variant), color);
22
21
  }
23
- @else {
24
- @include mat.private-current-selector-or-root() {
25
- @include token-utils.create-token-values-mixed(m2-colorpicker.get-color-tokens($theme));
26
- }
27
22
 
23
+ @include token-utils.values($tokens);
24
+
25
+ @if mat.get-theme-version($theme) != 1 {
28
26
  .mtx-colorpicker-toggle-active {
29
27
  &.mat-accent {
30
- $accent-tokens: m2-colorpicker.private-get-toggle-color-palette-color-tokens($theme, accent);
31
- @include token-utils.create-token-values-mixed($accent-tokens);
28
+ $tokens: m2-colorpicker.private-get-color-palette-color-tokens($theme, secondary);
29
+ @include token-utils.values($tokens);
32
30
  }
33
31
 
34
32
  &.mat-warn {
35
- $warn-tokens: m2-colorpicker.private-get-toggle-color-palette-color-tokens($theme, warn);
36
- @include token-utils.create-token-values-mixed($warn-tokens);
33
+ $tokens: m2-colorpicker.private-get-color-palette-color-tokens($theme, error);
34
+ @include token-utils.values($tokens);
37
35
  }
38
36
  }
39
37
  }
40
38
  }
41
39
 
42
40
  @mixin typography($theme) {
41
+ $tokens: map.get(m2-colorpicker.get-tokens($theme), typography);
43
42
  @if mat.get-theme-version($theme) == 1 {
44
- @include token-utils.create-token-values(map.get(m3-colorpicker.get-tokens($theme), typography));
45
- }
46
- @else {
47
- @include mat.private-current-selector-or-root() {
48
- @include token-utils.create-token-values-mixed(m2-colorpicker.get-typography-tokens($theme));
49
- }
43
+ $tokens: map.get(m3-colorpicker.get-tokens($theme), typography);
50
44
  }
45
+
46
+ @include token-utils.values($tokens);
51
47
  }
52
48
 
53
49
  @mixin density($theme) {
50
+ $tokens: map.get(m2-colorpicker.get-tokens($theme), density);
54
51
  @if mat.get-theme-version($theme) == 1 {
55
- @include token-utils.create-token-values(map.get(m3-colorpicker.get-tokens($theme), density));
56
- }
57
- @else {
58
- @include mat.private-current-selector-or-root() {
59
- @include token-utils.create-token-values-mixed(m2-colorpicker.get-density-tokens($theme));
60
- }
52
+ $tokens: map.get(m3-colorpicker.get-tokens($theme), density);
61
53
  }
54
+
55
+ @include token-utils.values($tokens);
62
56
  }
63
57
 
64
58
  /// Defines the tokens that will be available in the `overrides` mixin and for docs extraction.
@@ -66,7 +60,7 @@
66
60
  @return (
67
61
  (
68
62
  namespace: colorpicker,
69
- tokens: token-utils.get-overrides(m3-colorpicker.get-tokens(), colorpicker),
63
+ tokens: token-utils.get-overrides(m3-colorpicker.get-tokens(), colorpicker)
70
64
  ),
71
65
  );
72
66
  }
@@ -81,8 +75,7 @@
81
75
  @include color($theme, $color-variant);
82
76
  @include density($theme);
83
77
  @include typography($theme);
84
- }
85
- @else {
78
+ } @else {
86
79
  @include base($theme);
87
80
  @if mat.theme-has($theme, color) {
88
81
  @include color($theme);
@@ -1,47 +1,24 @@
1
1
  @use 'sass:color';
2
2
  @use 'sass:map';
3
- @use '@angular/material' as mat;
4
3
  @use '../core/tokens/m2-utils';
4
+ @use '../core/tokens/m3-utils';
5
5
 
6
- @function private-get-toggle-color-palette-color-tokens($theme, $palette-name) {
6
+ @function get-tokens($theme) {
7
7
  @return (
8
- colorpicker-toggle-active-state-icon-color: mat.get-theme-color($theme, $palette-name, text),
8
+ base: (),
9
+ color: private-get-color-palette-color-tokens($theme, primary),
10
+ typography: (),
11
+ density: ()
9
12
  );
10
13
  }
11
14
 
12
- // Tokens that can't be configured through Angular Material's current theming API,
13
- // but may be in a future version of the theming API.
14
- @function get-unthemable-tokens() {
15
- @return ();
16
- }
17
-
18
15
  // Tokens that can be configured through Angular Material's color theming API.
19
- @function get-color-tokens($theme) {
20
- $inactive-icon-color: mat.get-theme-color($theme, foreground, icon);
21
- $toggle-tokens: private-get-toggle-color-palette-color-tokens($theme, primary);
16
+ @function private-get-color-palette-color-tokens($theme, $color-variant) {
17
+ $system: m2-utils.get-system($theme);
18
+ $system: m3-utils.replace-colors-with-variant($system, primary, $color-variant);
22
19
 
23
- @return mat.private-merge-all($toggle-tokens, (
24
- colorpicker-toggle-icon-color: $inactive-icon-color
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
- }
37
-
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)
20
+ @return (
21
+ colorpicker-toggle-active-state-icon-color: map.get($system, primary),
22
+ colorpicker-toggle-icon-color: map.get($system, on-surface-variant)
46
23
  );
47
24
  }
@@ -233,7 +233,6 @@ declare const _COALESCED_STYLE_SCHEDULER: InjectionToken<_CoalescedStyleSchedule
233
233
  declare class _CoalescedStyleScheduler {
234
234
  private _currentSchedule;
235
235
  private _ngZone;
236
- constructor(...args: unknown[]);
237
236
  /**
238
237
  * Schedules the specified task to run at the end of the current VM turn.
239
238
  */
package/core/index.d.ts CHANGED
@@ -85,8 +85,7 @@ declare abstract class DatetimeAdapter<D> extends DateAdapter<D> {
85
85
  }
86
86
 
87
87
  declare class NativeDatetimeAdapter extends DatetimeAdapter<Date> {
88
- /** Inserted by Angular inject() migration for backwards compatibility */
89
- constructor(...args: unknown[]);
88
+ constructor();
90
89
  clone(date: Date): Date;
91
90
  getHour(date: Date): number;
92
91
  getMinute(date: Date): number;
@@ -1,108 +1,25 @@
1
- @use 'sass:color';
2
- @use 'sass:math';
1
+ @use 'sass:map';
3
2
  @use 'sass:meta';
4
3
  @use '@angular/material' as mat;
5
- @use '../m2/typography';
6
4
 
7
- $_placeholder-color-palette: mat.m2-define-palette(mat.$m2-red-palette);
8
-
9
- // Indicates whether we're building internally. Used for backwards compatibility.
10
- $private-is-internal-build: false;
11
-
12
- // Placeholder color config that can be passed to token getter functions when generating token
13
- // slots.
14
- $placeholder-color-config: (
15
- primary: $_placeholder-color-palette,
16
- accent: $_placeholder-color-palette,
17
- warn: $_placeholder-color-palette,
18
- is-dark: false,
19
- foreground: mat.$m2-light-theme-foreground-palette,
20
- background: mat.$m2-light-theme-background-palette,
21
- );
22
-
23
- $_placeholder-typography-level-config: typography.typography-config-level-from-mdc(body1);
24
-
25
- // Placeholder typography config that can be passed to token getter functions when generating token
26
- // slots.
27
- $placeholder-typography-config: (
28
- font-family: 'Roboto, sans-serif',
29
- headline-1: $_placeholder-typography-level-config,
30
- headline-2: $_placeholder-typography-level-config,
31
- headline-3: $_placeholder-typography-level-config,
32
- headline-4: $_placeholder-typography-level-config,
33
- headline-5: $_placeholder-typography-level-config,
34
- headline-6: $_placeholder-typography-level-config,
35
- subtitle-1: $_placeholder-typography-level-config,
36
- subtitle-2: $_placeholder-typography-level-config,
37
- body-1: $_placeholder-typography-level-config,
38
- body-2: $_placeholder-typography-level-config,
39
- caption: $_placeholder-typography-level-config,
40
- button: $_placeholder-typography-level-config,
41
- overline: $_placeholder-typography-level-config,
42
- subheading-1: $_placeholder-typography-level-config,
43
- title: $_placeholder-typography-level-config,
44
- );
45
-
46
- // Placeholder density config that can be passed to token getter functions when generating token
47
- // slots.
48
- $placeholder-density-config: 0;
49
-
50
- /// Inherited function from MDC that computes which contrast tone to use on top of a color.
51
- /// This is used only in a narrow set of use cases when generating M2 button tokens to maintain
52
- /// backwards compatibility.
53
- /// @param {Color} $value Color for which we're calculating the contrast tone.
54
- /// @param {Boolean} $is-dark Whether the current theme is dark.
55
- /// @return {Map} Either `dark` or `light`.
56
- @function contrast-tone($value, $is-dark) {
57
- @if ($value =='dark') {
58
- @return 'light';
59
- }
60
-
61
- @if ($value =='light') {
62
- @return 'dark';
63
- }
64
-
65
- // Fallback if the app is using a non-color palette (e.g. CSS variable based).
66
- @if (meta.type-of($value) !='color') {
67
- @return if($is-dark, 'light', 'dark');
68
- }
69
-
70
- $minimum-contrast: 3.1;
71
- $light-contrast: _contrast($value, #fff);
72
- $dark-contrast: _contrast($value, rgb(0, 0, 0, 0.87));
73
-
74
- @if ($light-contrast < $minimum-contrast) and ($dark-contrast > $light-contrast) {
75
- @return 'dark';
5
+ // Gets the theme's system values as a flat map.
6
+ @function get-system($theme) {
7
+ @if meta.type-of($theme) == map {
8
+ $system: map.get($theme, _mat-system);
9
+ @if $system {
10
+ @return $system;
11
+ }
12
+
13
+ // If the $theme is a typography-config, convert it to a system map.
14
+ @if map.has-key($theme, body-1) {
15
+ @return mat.m2-md-sys-typescale-values($theme);
16
+ }
76
17
  }
77
18
 
78
- @return 'light';
79
- }
80
-
81
- @function _linear-channel-value($channel-value) {
82
- $normalized-channel-value: math.div($channel-value, 255);
83
-
84
- @if ($normalized-channel-value < 0.03928) {
85
- @return math.div($normalized-channel-value, 12.92);
19
+ // If the $theme is a density scale, convert it to a system map.
20
+ @if meta.type-of($theme) == 'number' or $theme == minimum or $theme == maximum {
21
+ @return (density-scale: $theme);
86
22
  }
87
23
 
88
- @return math.pow(math.div($normalized-channel-value + 0.055, 1.055), 2.4);
89
- }
90
-
91
- // Calculate the luminance for a color.
92
- // See https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests
93
- @function _luminance($color) {
94
- $red: _linear-channel-value(color.red($color));
95
- $green: _linear-channel-value(color.green($color));
96
- $blue: _linear-channel-value(color.blue($color));
97
-
98
- @return 0.2126 * $red + 0.7152 * $green + 0.0722 * $blue;
99
- }
100
-
101
- // Calculate the contrast ratio between two colors.
102
- // See https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests
103
- @function _contrast($back, $front) {
104
- $back-lum: _luminance($back) + 0.05;
105
- $fore-lum: _luminance($front) + 0.05;
106
-
107
- @return math.div(math.max($back-lum, $fore-lum), math.min($back-lum, $fore-lum));
24
+ @return ();
108
25
  }
@@ -1,5 +1,6 @@
1
1
  @use 'sass:map';
2
2
  @use 'sass:meta';
3
+ @use '@angular/material' as mat;
3
4
  @use '../../alert/m3-alert';
4
5
  @use '../../colorpicker/m3-colorpicker';
5
6
  @use '../../datetimepicker/m3-datetimepicker';
@@ -183,7 +184,7 @@
183
184
  m3.md-sys-shape-values(),
184
185
  m3.md-sys-state-values());
185
186
 
186
- & {
187
+ @include mat.private-current-selector-or-root {
187
188
  @each $name, $value in $overrides {
188
189
  @if (map.has-key($sys-names, $name)) {
189
190
  --#{$prefix}-#{$name}: #{map.get($overrides, $name)};
@@ -209,7 +210,7 @@
209
210
  $sys-colors: map.set($sys-colors, neutral-variant20, map.get($palettes, neutral-variant, 20));
210
211
  $sys-colors: map.set($sys-colors, neutral10, map.get($palettes, neutral, 10));
211
212
 
212
- & {
213
+ @include mat.private-current-selector-or-root {
213
214
  @each $name, $value in $sys-colors {
214
215
  --#{$prefix}-#{$name}: #{map.get($overrides, $name) or $value};
215
216
  }
@@ -248,7 +249,7 @@
248
249
  typography-system-variables-prefix) or definition.$system-level-prefix;
249
250
  }
250
251
 
251
- & {
252
+ @include mat.private-current-selector-or-root {
252
253
  @each $name, $value in m3.md-sys-typescale-values($font-definition) {
253
254
  --#{$prefix}-#{$name}: #{map.get($overrides, $name) or $value};
254
255
  }
@@ -259,18 +260,19 @@
259
260
  $shadow-color: map.get(
260
261
  $theme, definition.$internals, palettes, neutral, 0);
261
262
 
262
- @each $name, $value in m3.md-sys-elevation-values() {
263
- $level: map.get($overrides, $name) or $value;
264
- $value: elevation.get-box-shadow($level, $shadow-color);
265
263
 
266
- & {
264
+ @include mat.private-current-selector-or-root {
265
+ @each $name, $value in m3.md-sys-elevation-values() {
266
+ $level: map.get($overrides, $name) or $value;
267
+ $value: elevation.get-box-shadow($level, $shadow-color);
268
+
267
269
  --#{$prefix}-#{$name}: #{$value};
268
270
  }
269
271
  }
270
272
  }
271
273
 
272
274
  @mixin system-level-shape($theme: (), $overrides: (), $prefix: definition.$system-level-prefix) {
273
- & {
275
+ @include mat.private-current-selector-or-root {
274
276
  @each $name, $value in m3.md-sys-shape-values() {
275
277
  --#{$prefix}-#{$name}: #{map.get($overrides, $name) or $value};
276
278
  }
@@ -278,7 +280,7 @@
278
280
  }
279
281
 
280
282
  @mixin system-level-state($theme: (), $overrides: (), $prefix: definition.$system-level-prefix) {
281
- & {
283
+ @include mat.private-current-selector-or-root {
282
284
  @each $name, $value in m3.md-sys-state-values() {
283
285
  --#{$prefix}-#{$name}: #{map.get($overrides, $name) or $value};
284
286
  }
@@ -69,32 +69,12 @@
69
69
  @return _create-var(--mtx-#{$token}, $sys-fallback);
70
70
  }
71
71
 
72
- // Outputs a map of tokens.
73
- @mixin create-token-values($tokens) {
74
- @include _create-token-values-internal($tokens, false);
75
- }
76
-
77
- // Outputs a map of tokens under a specific prefix in scenarios where tokens may be mixed with
78
- // other declarations (e.g. M2 themes). Used to avoid https://sass-lang.com/documentation/breaking-changes/mixed-decls/
79
- @mixin create-token-values-mixed($tokens) {
80
- @include _create-token-values-internal($tokens, true);
81
- }
82
-
83
- @mixin _create-token-values-internal($tokens, $in-place) {
84
- @if ($tokens != null) {
85
- @if ($in-place) {
86
- & {
87
- @each $key, $value in $tokens {
88
- @if $value != null {
89
- --mtx-#{$key}: #{$value};
90
- }
91
- }
92
- }
93
- } @else {
94
- @each $key, $value in $tokens {
95
- @if $value != null {
96
- --mtx-#{$key}: #{$value};
97
- }
72
+ // Outputs a map of token values as CSS variable definitions.
73
+ @mixin values($tokens) {
74
+ @include mat.private-current-selector-or-root() {
75
+ @each $key, $value in $tokens {
76
+ @if $value != null {
77
+ --mtx-#{$key}: #{$value};
98
78
  }
99
79
  }
100
80
  }
@@ -125,7 +105,7 @@
125
105
  $namespace: list.nth($data, 1);
126
106
  $name: list.nth($data, 2);
127
107
  $prefixed-name: $namespace + '-' + $name;
128
- @include create-token-values(($prefixed-name: $value));
108
+ @include values(($prefixed-name: $value));
129
109
  } @else {
130
110
  @error #{'Invalid token name `'}#{$name}#{'`. '}#{'Valid tokens are: '}#{$all-names};
131
111
  }