|
3 | 3 | @use '../map';
|
4 | 4 | @use '../selector';
|
5 | 5 |
|
| 6 | +// Functions. |
| 7 | +@use '../color/functions/name/name.retrieve.function' as *; |
| 8 | + |
6 | 9 | // Status: DONE
|
7 | 10 | // The `variant.create()` creates a variant built from `$value`.
|
8 | 11 | // @param `$value` A list or string type to create a variant.
|
9 | 12 | // @param `$modifier`
|
10 | 13 | // @returns The returned value is a variant of map type where (class: value).
|
11 |
| -@function create($value, $modifier: null) { |
| 14 | +@function create($value, $modifier: null, $type: null) { |
12 | 15 | $result: ();
|
13 | 16 | @if type-of($value) == map {
|
14 | 17 | @each $name, $side-variant in $value {
|
|
31 | 34 | @if type-of($value) == list {
|
32 | 35 | // Remove !important.
|
33 | 36 | $key: list.remove-value($key, !important);
|
34 |
| - @if list.separator($key) == comma { |
35 |
| - $key: list.nth($key, 1); |
36 |
| - } @else if list.separator($key) == space and list.has-list($key) { |
37 |
| - $key: list.remove-list($key); |
| 37 | + |
| 38 | + // FEATURE: Color variant. |
| 39 | + @if $type == color { |
| 40 | + $key: map.get(retrieve($key), name); |
| 41 | + } @else { |
| 42 | + // FEATURE: Check key. |
| 43 | + @if list.separator($key) == comma { |
| 44 | + $key: list.nth($key, 1); |
| 45 | + } @else if list.separator($key) == space and list.has-list($key) { |
| 46 | + $key: list.remove-list($key); |
| 47 | + } |
38 | 48 | }
|
39 | 49 | }
|
40 | 50 |
|
|
80 | 90 | // @debug create((secondary (color '!important', dark, light)));
|
81 | 91 | // @debug create((secondary (color, (dark, -30%), (light, 60%))));
|
82 | 92 |
|
| 93 | +// @debug create((accent, (color, [(light, 30%), (dark, 50%)], dark, light))); |
| 94 | + |
83 | 95 | //
|
84 | 96 | // @debug create((medium: 1px solid red, large: 2px solid blue)); // ((): ((): (medium: 1px solid red)))
|
85 | 97 | // @debug create(((top, right): (medium: 1px solid red, large: 2px solid blue))); // ((): ((top, right): (medium: 1px solid red, large: 2px solid blue)))
|
|
0 commit comments