Debian Codegraph @

debian/missing-sources/bourbon/app/assets/stylesheets/helpers/_linear-positions-parser.scss

raw
1 @function _linear-positions-parser($pos) {
2 @if $output-bourbon-deprecation-warnings == true {
3 @warn "[Bourbon] [Deprecation] `_linear-positions-parser` is " +
4 "deprecated and will be removed in 5.0.0.";
5 }
6
7 $user-deprecation-warnings-setting: $output-bourbon-deprecation-warnings;
8 $output-bourbon-deprecation-warnings: false !global;
9
10 $type: type-of(nth($pos, 1));
11 $spec: null;
12 $degree: null;
13 $side: null;
14 $corner: null;
15 $length: length($pos);
16 // Parse Side and corner positions
17 @if ($length > 1) {
18 @if nth($pos, 1) == "to" { // Newer syntax
19 $side: nth($pos, 2);
20
21 @if $length == 2 { // eg. to top
22 // Swap for backwards compatibility
23 $degree: _position-flipper(nth($pos, 2));
24 }
25 @else if $length == 3 { // eg. to top left
26 $corner: nth($pos, 3);
27 }
28 }
29 @else if $length == 2 { // Older syntax ("top left")
30 $side: _position-flipper(nth($pos, 1));
31 $corner: _position-flipper(nth($pos, 2));
32 }
33
34 @if ("#{$side} #{$corner}" == "left top") or ("#{$side} #{$corner}" == "top left") {
35 $degree: _position-flipper(#{$side}) _position-flipper(#{$corner});
36 }
37 @else if ("#{$side} #{$corner}" == "right top") or ("#{$side} #{$corner}" == "top right") {
38 $degree: _position-flipper(#{$side}) _position-flipper(#{$corner});
39 }
40 @else if ("#{$side} #{$corner}" == "right bottom") or ("#{$side} #{$corner}" == "bottom right") {
41 $degree: _position-flipper(#{$side}) _position-flipper(#{$corner});
42 }
43 @else if ("#{$side} #{$corner}" == "left bottom") or ("#{$side} #{$corner}" == "bottom left") {
44 $degree: _position-flipper(#{$side}) _position-flipper(#{$corner});
45 }
46 $spec: to $side $corner;
47 }
48 @else if $length == 1 {
49 // Swap for backwards compatibility
50 @if $type == string {
51 $degree: $pos;
52 $spec: to _position-flipper($pos);
53 }
54 @else {
55 $degree: -270 - $pos; //rotate the gradient opposite from spec
56 $spec: $pos;
57 }
58 }
59 $degree: unquote($degree + ",");
60 $spec: unquote($spec + ",");
61
62 $output-bourbon-deprecation-warnings: $user-deprecation-warnings-setting !global;
63
64 @return $degree $spec;
65 }
66
67 @function _position-flipper($pos) {
68 @if $output-bourbon-deprecation-warnings == true {
69 @warn "[Bourbon] [Deprecation] `_position-flipper` is " +
70 "deprecated and will be removed in 5.0.0.";
71 }
72
73 @return if($pos == left, right, null)
74 if($pos == right, left, null)
75 if($pos == top, bottom, null)
76 if($pos == bottom, top, null);
77 }