|
| 1 | +@use 'sass:map'; |
1 | 2 | @use '../core/theming/theming'; |
2 | 3 | @use '../core/theming/inspection'; |
3 | 4 | @use '../core/typography/typography'; |
4 | 5 | @use '../core/tokens/m2/mat/grid-list' as tokens-mat-grid-list; |
5 | 6 | @use '../core/style/sass-utils'; |
6 | 7 | @use '../core/tokens/token-utils'; |
7 | 8 |
|
8 | | -@mixin base($theme) {} |
| 9 | +@mixin base($theme) { |
| 10 | + @if inspection.get-theme-version($theme) == 1 { |
| 11 | + @include _theme-from-tokens(inspection.get-theme-tokens($theme, base)); |
| 12 | + } |
| 13 | + @else {} |
| 14 | +} |
9 | 15 |
|
10 | 16 | // Include this empty mixin for consistency with the other components. |
11 | | -@mixin color($theme) {} |
| 17 | +@mixin color($theme) { |
| 18 | + @if inspection.get-theme-version($theme) == 1 { |
| 19 | + @include _theme-from-tokens(inspection.get-theme-tokens($theme, color)); |
| 20 | + } |
| 21 | + @else {} |
| 22 | +} |
12 | 23 |
|
13 | 24 | @mixin typography($theme) { |
14 | | - @include sass-utils.current-selector-or-root() { |
15 | | - @include token-utils.create-token-values(tokens-mat-grid-list.$prefix, |
16 | | - tokens-mat-grid-list.get-typography-tokens($theme)); |
| 25 | + @if inspection.get-theme-version($theme) == 1 { |
| 26 | + @include _theme-from-tokens(inspection.get-theme-tokens($theme, typography)); |
| 27 | + } |
| 28 | + @else { |
| 29 | + @include sass-utils.current-selector-or-root() { |
| 30 | + @include token-utils.create-token-values(tokens-mat-grid-list.$prefix, |
| 31 | + tokens-mat-grid-list.get-typography-tokens($theme)); |
| 32 | + } |
17 | 33 | } |
18 | 34 | } |
19 | 35 |
|
20 | | -@mixin density($theme) {} |
| 36 | +@mixin density($theme) { |
| 37 | + @if inspection.get-theme-version($theme) == 1 { |
| 38 | + @include _theme-from-tokens(inspection.get-theme-tokens($theme, density)); |
| 39 | + } |
| 40 | + @else {} |
| 41 | +} |
21 | 42 |
|
22 | 43 | @mixin theme($theme) { |
23 | 44 | @include theming.private-check-duplicate-theme-styles($theme, 'mat-grid-list') { |
24 | | - @include base($theme); |
25 | | - @if inspection.theme-has($theme, color) { |
26 | | - @include color($theme); |
27 | | - } |
28 | | - @if inspection.theme-has($theme, density) { |
29 | | - @include density($theme); |
| 45 | + @if inspection.get-theme-version($theme) == 1 { |
| 46 | + @include _theme-from-tokens(inspection.get-theme-tokens($theme)); |
30 | 47 | } |
31 | | - @if inspection.theme-has($theme, typography) { |
32 | | - @include typography($theme); |
| 48 | + @else { |
| 49 | + @include base($theme); |
| 50 | + @if inspection.theme-has($theme, color) { |
| 51 | + @include color($theme); |
| 52 | + } |
| 53 | + @if inspection.theme-has($theme, density) { |
| 54 | + @include density($theme); |
| 55 | + } |
| 56 | + @if inspection.theme-has($theme, typography) { |
| 57 | + @include typography($theme); |
| 58 | + } |
33 | 59 | } |
34 | 60 | } |
35 | 61 | } |
| 62 | + |
| 63 | +@mixin _theme-from-tokens($tokens) { |
| 64 | + @if ($tokens != ()) { |
| 65 | + @include token-utils.create-token-values( |
| 66 | + tokens-mat-grid-list.$prefix, map.get($tokens, tokens-mat-grid-list.$prefix)); |
| 67 | + } |
| 68 | +} |
0 commit comments