| 1 |
@function _radial-gradient-parser($image) { |
| 2 |
@if $output-bourbon-deprecation-warnings == true { |
| 3 |
@warn "[Bourbon] [Deprecation] `_radial-gradient-parser` is " + |
| 4 |
"deprecated and will be removed in 5.0.0."; |
| 5 |
} |
| 6 |
|
| 7 |
$image: unquote($image); |
| 8 |
$gradients: (); |
| 9 |
$start: str-index($image, "("); |
| 10 |
$end: str-index($image, ","); |
| 11 |
$first-val: str-slice($image, $start + 1, $end - 1); |
| 12 |
|
| 13 |
$prefix: str-slice($image, 1, $start); |
| 14 |
$suffix: str-slice($image, $end, str-length($image)); |
| 15 |
|
| 16 |
$is-spec-syntax: str-index($first-val, "at"); |
| 17 |
|
| 18 |
@if $is-spec-syntax and $is-spec-syntax > 1 { |
| 19 |
$keyword: str-slice($first-val, 1, $is-spec-syntax - 2); |
| 20 |
$pos: str-slice($first-val, $is-spec-syntax + 3, str-length($first-val)); |
| 21 |
$pos: append($pos, $keyword, comma); |
| 22 |
|
| 23 |
$gradients: ( |
| 24 |
webkit-image: -webkit- + $prefix + $pos + $suffix, |
| 25 |
spec-image: $image |
| 26 |
); |
| 27 |
} |
| 28 |
|
| 29 |
@else if $is-spec-syntax == 1 { |
| 30 |
$pos: str-slice($first-val, $is-spec-syntax + 3, str-length($first-val)); |
| 31 |
|
| 32 |
$gradients: ( |
| 33 |
webkit-image: -webkit- + $prefix + $pos + $suffix, |
| 34 |
spec-image: $image |
| 35 |
); |
| 36 |
} |
| 37 |
|
| 38 |
@else if str-index($image, "cover") or str-index($image, "contain") { |
| 39 |
@warn "Radial-gradient needs to be updated to conform to latest spec."; |
| 40 |
|
| 41 |
$gradients: ( |
| 42 |
webkit-image: null, |
| 43 |
spec-image: $image |
| 44 |
); |
| 45 |
} |
| 46 |
|
| 47 |
@else { |
| 48 |
$gradients: ( |
| 49 |
webkit-image: -webkit- + $image, |
| 50 |
spec-image: $image |
| 51 |
); |
| 52 |
} |
| 53 |
|
| 54 |
@return $gradients; |
| 55 |
} |