Sha256: 8b7b624a96909a57808b98241c4b6476967c1bfff4d694e1190ad9dfef1f256f

Contents?: true

Size: 1.95 KB

Versions: 394

Compression:

Stored size: 1.95 KB

Contents

@function _linear-positions-parser($pos) {
  $type: type-of(nth($pos, 1));
  $spec: null;
  $degree: null;
  $side: null;
  $corner: null;
  $length: length($pos);
  // Parse Side and corner positions
  @if ($length > 1) {
    @if nth($pos, 1) == "to" { // Newer syntax
      $side: nth($pos, 2);

      @if $length == 2 { // eg. to top
        // Swap for backwards compatability
        $degree: _position-flipper(nth($pos, 2));
      }
      @else if $length == 3 { // eg. to top left
        $corner: nth($pos, 3);
      }
    }
    @else if $length == 2 { // Older syntax ("top left")
      $side: _position-flipper(nth($pos, 1));
      $corner: _position-flipper(nth($pos, 2));
    }

    @if ("#{$side} #{$corner}" == "left top") or ("#{$side} #{$corner}" == "top left") {
      $degree: _position-flipper(#{$side}) _position-flipper(#{$corner});
    }
    @else if ("#{$side} #{$corner}" == "right top") or ("#{$side} #{$corner}" == "top right") {
      $degree: _position-flipper(#{$side}) _position-flipper(#{$corner});
    }
    @else if ("#{$side} #{$corner}" == "right bottom") or ("#{$side} #{$corner}" == "bottom right") {
      $degree: _position-flipper(#{$side}) _position-flipper(#{$corner});
    }
    @else if ("#{$side} #{$corner}" == "left bottom") or ("#{$side} #{$corner}" == "bottom left") {
      $degree: _position-flipper(#{$side}) _position-flipper(#{$corner});
    }
    $spec: to $side $corner;
  }
  @else if $length == 1 {
    // Swap for backwards compatability
    @if $type == string {
      $degree: $pos;
      $spec: to _position-flipper($pos);
    }
    @else {
      $degree: -270 - $pos; //rotate the gradient opposite from spec
      $spec: $pos;
    }
  }
  $degree: unquote($degree + ",");
  $spec:   unquote($spec + ",");
  @return $degree $spec;
}

@function _position-flipper($pos) {
 @return if($pos == left, right, null)
         if($pos == right, left, null)
         if($pos == top, bottom, null)
         if($pos == bottom, top, null);
}

Version data entries

394 entries across 383 versions & 17 rubygems

Version Path
daiblogs-0.1.0 assets/_sass/bourbon/helpers/_linear-positions-parser.scss
hanuman-0.3.0 _sass/bourbon/helpers/_linear-positions-parser.scss
hanuman-0.2.0 _sass/bourbon/helpers/_linear-positions-parser.scss
hanuman-0.1.0 _sass/bourbon/helpers/_linear-positions-parser.scss
wrgem-0.0.55 lib/generators/wrstart/template/vendor/assets/components/bourbon/dist/helpers/_linear-positions-parser.scss
wrgem-0.0.54 lib/generators/wrstart/template/vendor/assets/components/bourbon/dist/helpers/_linear-positions-parser.scss
wrgem-0.0.53 lib/generators/wrstart/template/vendor/assets/components/bourbon/dist/helpers/_linear-positions-parser.scss
wrgem-0.0.52 lib/generators/wrstart/template/vendor/assets/components/bourbon/dist/helpers/_linear-positions-parser.scss
wrgem-0.0.51 lib/generators/wrstart/template/vendor/assets/components/bourbon/dist/helpers/_linear-positions-parser.scss
moovui-0.1.4 app/assets/stylesheets/bourbon/helpers/_linear-positions-parser.scss
smock-0.1.268 app/assets/stylesheets/thirdparty/bourbon/helpers/_linear-positions-parser.scss
smock-0.1.267 app/assets/stylesheets/thirdparty/bourbon/helpers/_linear-positions-parser.scss
smock-0.1.266 app/assets/stylesheets/thirdparty/bourbon/helpers/_linear-positions-parser.scss
wrgem-0.0.50 lib/generators/wrstart/template/vendor/assets/components/bourbon/dist/helpers/_linear-positions-parser.scss
wrgem-0.0.49 lib/generators/wrstart/template/vendor/assets/components/bourbon/dist/helpers/_linear-positions-parser.scss
smock-0.1.265 app/assets/stylesheets/thirdparty/bourbon/helpers/_linear-positions-parser.scss
smock-0.1.264 app/assets/stylesheets/thirdparty/bourbon/helpers/_linear-positions-parser.scss
smock-0.1.263 app/assets/stylesheets/thirdparty/bourbon/helpers/_linear-positions-parser.scss
smock-0.1.262 app/assets/stylesheets/thirdparty/bourbon/helpers/_linear-positions-parser.scss
smock-0.1.261 app/assets/stylesheets/thirdparty/bourbon/helpers/_linear-positions-parser.scss