|
1 |
| -@use 'sass:map'; |
2 | 1 | @use '../core/theming/theming';
|
3 | 2 | @use '../core/theming/inspection';
|
4 | 3 | @use '../core/tokens/m2/mat/icon' as tokens-mat-icon;
|
|
11 | 10 | @include token-utils.create-token-values(tokens-mat-icon.$prefix, $tokens);
|
12 | 11 | }
|
13 | 12 |
|
| 13 | +/// Outputs base theme styles (styles not dependent on the color, typography, or density settings) |
| 14 | +/// for the mat-icon. |
| 15 | +/// @param {Map} $theme The theme to generate base styles for. |
14 | 16 | @mixin base($theme) {
|
15 | 17 | @if inspection.get-theme-version($theme) == 1 {
|
16 | 18 | @include _theme-from-tokens(inspection.get-theme-tokens($theme, base));
|
17 | 19 | }
|
18 | 20 | @else {}
|
19 | 21 | }
|
20 | 22 |
|
21 |
| -@mixin color($theme) { |
| 23 | +/// Outputs color theme styles for the mat-icon. |
| 24 | +/// @param {Map} $theme The theme to generate color styles for. |
| 25 | +/// @param {ArgList} Additional optional arguments (only supported for M3 themes): |
| 26 | +/// $color-variant: The color variant to use for the icon: primary, secondary, tertiary, or error |
| 27 | +/// (If not specified, default neutral color will be used). |
| 28 | +@mixin color($theme, $options...) { |
22 | 29 | @if inspection.get-theme-version($theme) == 1 {
|
23 |
| - @include _theme-from-tokens(inspection.get-theme-tokens($theme, color)); |
| 30 | + @include _theme-from-tokens(inspection.get-theme-tokens($theme, color), $options...); |
24 | 31 | }
|
25 | 32 | @else {
|
26 | 33 | @include sass-utils.current-selector-or-root() {
|
|
44 | 51 | }
|
45 | 52 | }
|
46 | 53 |
|
| 54 | +/// Outputs typography theme styles for the mat-icon. |
| 55 | +/// @param {Map} $theme The theme to generate typography styles for. |
47 | 56 | @mixin typography($theme) {
|
48 | 57 | @if inspection.get-theme-version($theme) == 1 {
|
49 | 58 | @include _theme-from-tokens(inspection.get-theme-tokens($theme, typography));
|
50 | 59 | }
|
51 | 60 | @else {}
|
52 | 61 | }
|
53 | 62 |
|
| 63 | +/// Outputs density theme styles for the mat-icon. |
| 64 | +/// @param {Map} $theme The theme to generate density styles for. |
54 | 65 | @mixin density($theme) {
|
55 | 66 | @if inspection.get-theme-version($theme) == 1 {
|
56 | 67 | @include _theme-from-tokens(inspection.get-theme-tokens($theme, density));
|
57 | 68 | }
|
58 | 69 | @else {}
|
59 | 70 | }
|
60 | 71 |
|
61 |
| -@mixin theme($theme) { |
| 72 | +/// Outputs all (base, color, typography, and density) theme styles for the mat-icon. |
| 73 | +/// @param {Map} $theme The theme to generate styles for. |
| 74 | +/// @param {ArgList} Additional optional arguments (only supported for M3 themes): |
| 75 | +/// $color-variant: The color variant to use for the icon: primary, secondary, tertiary, or error |
| 76 | +/// (If not specified, default neutral color will be used). |
| 77 | +@mixin theme($theme, $options...) { |
62 | 78 | @include theming.private-check-duplicate-theme-styles($theme, 'mat-icon') {
|
63 | 79 | @if inspection.get-theme-version($theme) == 1 {
|
64 |
| - @include _theme-from-tokens(inspection.get-theme-tokens($theme)); |
| 80 | + @include _theme-from-tokens(inspection.get-theme-tokens($theme), $options...); |
65 | 81 | }
|
66 | 82 | @else {
|
67 | 83 | @include base($theme);
|
|
78 | 94 | }
|
79 | 95 | }
|
80 | 96 |
|
81 |
| -@mixin _theme-from-tokens($tokens) { |
82 |
| - @if ($tokens != ()) { |
83 |
| - @include token-utils.create-token-values( |
84 |
| - tokens-mat-icon.$prefix, map.get($tokens, tokens-mat-icon.$prefix)); |
85 |
| - } |
| 97 | +@mixin _theme-from-tokens($tokens, $options...) { |
| 98 | + $mat-icon-tokens: token-utils.get-tokens-for($tokens, tokens-mat-icon.$prefix, $options...); |
| 99 | + @include token-utils.create-token-values(tokens-mat-icon.$prefix, $mat-icon-tokens); |
86 | 100 | }
|
0 commit comments