|
30 | 30 | @return 2; |
31 | 31 | } |
32 | 32 |
|
33 | | -@mixin set-properties($properties, $map, $index, $sign) { |
| 33 | +@mixin set-properties($properties, $map, $index, $sign, $is-multiple: false) { |
34 | 34 | $keys: map-keys($map); |
35 | 35 |
|
36 | 36 | @each $property in $properties { |
37 | 37 | $value: map-get($map, nth($keys, $index)); |
38 | | - #{$property}: #{$sign}#{$value}; |
| 38 | + @if not($is-multiple) { |
| 39 | + #{$property}: #{$sign}#{$value}; |
| 40 | + } @else { |
| 41 | + $single-value: map-get($value, $property); |
| 42 | + |
| 43 | + @if $single-value { |
| 44 | + #{$property}: #{$sign}#{$single-value}; |
| 45 | + } |
| 46 | + } |
39 | 47 | } |
40 | 48 | } |
41 | 49 |
|
|
63 | 71 |
|
64 | 72 | // Scalable |
65 | 73 | // ------------------------------------------ |
66 | | -@mixin scalable($properties, $sscss-map, $global-interpolation: false, $is-negation: false) { |
| 74 | +@mixin scalable($properties, $sscss-map, $global-interpolation: false, $is-negation: false, $is-multiple: false) { |
67 | 75 | $map: get-scalabe-map($sscss-map); |
68 | 76 | $keys: map-keys($map); |
69 | 77 | $length: length($keys); |
70 | 78 | $sign: get-sign($is-negation); |
71 | 79 | $is-interpolation: is-interpolation($sscss-map, $global-interpolation); |
72 | 80 | $start-id: get-start-id($is-interpolation); |
73 | 81 |
|
74 | | - @include set-properties($properties, $map, 1, $sign); |
| 82 | + @include set-properties($properties, $map, 1, $sign, $is-multiple); |
75 | 83 |
|
76 | 84 | @if ($length >= $start-id + 1) { |
77 | 85 | @for $i from $start-id through ($length - 1) { |
78 | 86 | $breakpointFrom: nth($keys, $i); |
79 | 87 | $breakpointTo: nth($keys, ($i + 1)); |
| 88 | + |
80 | 89 | $valueFrom: map-get($map, $breakpointFrom); |
81 | 90 | $valueTo: map-get($map, $breakpointTo); |
82 | 91 |
|
| 92 | + @if ($is-multiple) { |
| 93 | + $valueFrom: map-get($map, $breakpointFrom); |
| 94 | + $valueTo: map-get($map, $breakpointTo); |
| 95 | + } |
| 96 | + |
83 | 97 | @media (min-width: $breakpointFrom) { |
84 | 98 | @if ($is-interpolation and $valueFrom != $valueTo) { |
85 | 99 | @each $property in $properties { |
86 | | - $linear-map: ($breakpointFrom: $valueFrom, $breakpointTo: $valueTo); |
87 | | - #{$property}: linear-interpolation($linear-map, $is-negation); |
| 100 | + @if not($is-multiple) { |
| 101 | + $linear-map: ($breakpointFrom: $valueFrom, $breakpointTo: $valueTo); |
| 102 | + #{$property}: linear-interpolation($linear-map, $is-negation); |
| 103 | + } @else { |
| 104 | + @if ($global-interpolation) { |
| 105 | + $linear-map: ($breakpointFrom: map-get($valueFrom, $property), $breakpointTo: map-get($valueTo, $property)); |
| 106 | + #{$property}: linear-interpolation($linear-map, $is-negation); |
| 107 | + } @else { |
| 108 | + $single-value: map-get($valueFrom, $property); |
| 109 | + |
| 110 | + @if $single-value { |
| 111 | + #{$property}: #{$sign}#{$single-value}; |
| 112 | + } |
| 113 | + } |
| 114 | + } |
88 | 115 | } |
89 | 116 | } @else { |
90 | 117 | @each $property in $properties { |
91 | | - #{$property}: #{$sign}#{$valueFrom}; |
| 118 | + @if not($is-multiple) { |
| 119 | + #{$property}: #{$sign}#{$valueFrom}; |
| 120 | + } @else { |
| 121 | + $single-value: map-get($valueFrom, $property); |
| 122 | + |
| 123 | + @if $single-value { |
| 124 | + #{$property}: #{$sign}#{$single-value}; |
| 125 | + } |
| 126 | + } |
92 | 127 | } |
93 | 128 | } |
94 | 129 | } |
95 | 130 | } |
96 | 131 | } |
97 | 132 |
|
98 | 133 | @media (min-width: nth($keys, $length)) { |
99 | | - @include set-properties($properties, $map, $length, $sign); |
| 134 | + @include set-properties($properties, $map, $length, $sign, $is-multiple); |
100 | 135 | } |
101 | 136 | } |
102 | 137 |
|
|
0 commit comments