|
| 1 | +@use 'sass:map'; |
1 | 2 | @use '../core/style/sass-utils';
|
2 | 3 | @use '../core/theming/theming';
|
3 | 4 | @use '../core/theming/inspection';
|
4 | 5 | @use '../core/tokens/m2/mdc/circular-progress' as tokens-mdc-circular-progress;
|
5 | 6 | @use '@material/circular-progress/circular-progress-theme' as mdc-circular-progress-theme;
|
6 | 7 |
|
7 | 8 | @mixin base($theme) {
|
8 |
| - // Add default values for tokens not related to color, typography, or density. |
9 |
| - @include sass-utils.current-selector-or-root() { |
10 |
| - @include mdc-circular-progress-theme.theme( |
11 |
| - tokens-mdc-circular-progress.get-unthemable-tokens() |
12 |
| - ); |
| 9 | + @if inspection.get-theme-version($theme) == 1 { |
| 10 | + @include _theme-from-tokens(inspection.get-theme-tokens($theme, base)); |
| 11 | + } |
| 12 | + @else { |
| 13 | + // Add default values for tokens not related to color, typography, or density. |
| 14 | + @include sass-utils.current-selector-or-root() { |
| 15 | + @include mdc-circular-progress-theme.theme( |
| 16 | + tokens-mdc-circular-progress.get-unthemable-tokens() |
| 17 | + ); |
| 18 | + } |
13 | 19 | }
|
14 | 20 | }
|
15 | 21 |
|
16 | 22 | @mixin color($theme) {
|
17 |
| - $mdc-circular-progress-color-tokens: tokens-mdc-circular-progress.get-color-tokens($theme); |
| 23 | + @if inspection.get-theme-version($theme) == 1 { |
| 24 | + @include _theme-from-tokens(inspection.get-theme-tokens($theme, color)); |
| 25 | + } |
| 26 | + @else { |
| 27 | + $mdc-circular-progress-color-tokens: tokens-mdc-circular-progress.get-color-tokens($theme); |
18 | 28 |
|
19 |
| - @include sass-utils.current-selector-or-root() { |
20 |
| - @include mdc-circular-progress-theme.theme($mdc-circular-progress-color-tokens); |
| 29 | + @include sass-utils.current-selector-or-root() { |
| 30 | + @include mdc-circular-progress-theme.theme($mdc-circular-progress-color-tokens); |
21 | 31 |
|
22 |
| - .mat-accent { |
23 |
| - $color: inspection.get-theme-color($theme, accent); |
24 |
| - @include mdc-circular-progress-theme.theme((active-indicator-color: $color)); |
25 |
| - } |
| 32 | + .mat-accent { |
| 33 | + $color: inspection.get-theme-color($theme, accent); |
| 34 | + @include mdc-circular-progress-theme.theme((active-indicator-color: $color)); |
| 35 | + } |
26 | 36 |
|
27 |
| - .mat-warn { |
28 |
| - $color: inspection.get-theme-color($theme, warn); |
29 |
| - @include mdc-circular-progress-theme.theme((active-indicator-color: $color)); |
| 37 | + .mat-warn { |
| 38 | + $color: inspection.get-theme-color($theme, warn); |
| 39 | + @include mdc-circular-progress-theme.theme((active-indicator-color: $color)); |
| 40 | + } |
30 | 41 | }
|
31 | 42 | }
|
32 | 43 | }
|
33 | 44 |
|
34 |
| -@mixin typography($theme) {} |
| 45 | +@mixin typography($theme) { |
| 46 | +} |
35 | 47 |
|
36 |
| -@mixin density($theme) {} |
| 48 | +@mixin density($theme) { |
| 49 | +} |
37 | 50 |
|
38 | 51 | @mixin theme($theme) {
|
39 | 52 | @include theming.private-check-duplicate-theme-styles($theme, 'mat-progress-spinner') {
|
|
49 | 62 | }
|
50 | 63 | }
|
51 | 64 | }
|
| 65 | + |
| 66 | +@mixin _theme-from-tokens($tokens) { |
| 67 | + @if ($tokens != ()) { |
| 68 | + @include mdc-circular-progress-theme.theme( |
| 69 | + map.get($tokens, tokens-mdc-circular-progress.$prefix)); |
| 70 | + } |
| 71 | +} |
0 commit comments