|
7 | 7 | @use '../../list/get/get.map.function' as list-get-map;
|
8 | 8 | @use '../../list/has/has.number.function' as list-has-number;
|
9 | 9 | @use '../../list/list.first.function' as list-first;
|
| 10 | +@use '../../list/list.indexes.function' as list-indexes; |
10 | 11 | @use '../../list/list.insert-nth.function' as list-insert-nth;
|
| 12 | +@use '../../list/list.nth.function' as list-nth; |
11 | 13 | @use '../../list/list.to-map.function' as list-to-map;
|
12 | 14 | @use '../../list/remove/remove.map.function' as list-remove-map;
|
| 15 | +@use '../../list/remove/remove.nth.function' as list-remove-nth; |
13 | 16 | @use '../../map/map.pick.function' as map-pick;
|
| 17 | +@use '../../map/map.update.function' as map-update; |
| 18 | +@use '../../string/string.replace.function' as string-replace; |
| 19 | +@use '../../string/string.unquote.function' as string-unquote; |
14 | 20 |
|
15 | 21 | // Module functions.
|
16 | 22 | @use 'adjustment/adjustment.has.function';
|
| 23 | +@use 'indicator/indicator.remove.function' as indicator-remove; |
| 24 | +@use 'indicator/indicator.retrieve.function' as indicator-retrieve; |
17 | 25 |
|
18 | 26 | // Status: DONE
|
19 | 27 | // The `color.name-retrieve()` function returns a map with attributes obtained from `$name`.
|
|
27 | 35 | $result: ();
|
28 | 36 | $separator: list.separator($name);
|
29 | 37 |
|
| 38 | + // Input name. |
| 39 | + $result: map.set($result, input-name, $name); |
| 40 | + |
30 | 41 | // Check whether `$name` contains adjustment.
|
31 | 42 | @if adjustment.has($name) {
|
32 | 43 | // Get `map` from `$name`.
|
|
59 | 70 | }
|
60 | 71 |
|
61 | 72 | // Create map from `$attributes`.
|
62 |
| - $result: map.set(list-to-map.to-map($name, (name: list string), $attributes...), separator, $separator); |
| 73 | + $result: map.merge($result, list-to-map.to-map($name, (name: list string), $attributes...)); |
| 74 | + $result: map.set($result, separator, $separator); |
63 | 75 | }
|
64 |
| - |
65 |
| - // No adjustments. |
66 | 76 | } @else {
|
67 |
| - $result: (name: $name, separator: $separator); |
| 77 | + // No adjustments. |
| 78 | + $result: map.merge($result, (name: $name, separator: $separator)); |
| 79 | + } |
| 80 | + |
| 81 | + // Name has property. |
| 82 | + $property-index: list-indexes.indexes(map.get($result, name), all, '~=', ':'); |
| 83 | + @if $property-index { |
| 84 | + $property: string-unquote.unquote(string-replace.replace(indicator-retrieve.retrieve(map.get($result, name), ':'), 'first', ':', '')); |
| 85 | + $no-property-name: indicator-remove.remove(map.get($result, name), ':'); |
| 86 | + $result: map-update.update($result, ( |
| 87 | + property: $property, |
| 88 | + property-name: ($property: indicator-remove.remove(map.get($result, input-name), ':')), |
| 89 | + no-property-name: $no-property-name, |
| 90 | + )); |
68 | 91 | }
|
69 | 92 |
|
70 | 93 | // If `$model` is set to name set retrieved adjustment to key of color name.
|
|
120 | 143 |
|
121 | 144 | // `$model`
|
122 | 145 | // @debug retrieve((primary dark, '*' 5%, '-' 0.2), $model: name); // (primary dark: (lightness: "*" 5%, alpha: "-" 0.2, separator: comma))
|
| 146 | + |
| 147 | +// Retrieve color property. |
| 148 | +// @debug retrieve(primary dark ':color'); |
| 149 | +// @debug retrieve((primary dark ':color', 5%)); |
| 150 | +// @debug retrieve((primary dark ':color') 5%); |
0 commit comments