@mixin deprecate($subject, $instead: false) { @warn "\"#{$subject}\" DEPRECATED!#{if($instead, " Use instead: \"#{$instead}\"", '')}"; } @function isset($v) { @return $v != none and $v != false; } @function complex-isset($list, $l: length($list)) { $i: 1; @while $i <= $l and isset(nth($list, $i)) { $i: $i + 1; } @return $i > $l; } @function list-rtrim($list, $count: 1) { $r: (); $l: length($list) - $count; $i: 1; @while $i <= $l { $r: append($r, nth($list, $i)); $i: $i + 1; } @return $r; } @function complex-list($params) { $l: length($params); @if $l > 1 and nth($params, $l) == !important { $params: list-rtrim($params); $l: $l - 1; } @if $l < 4 { @if $l < 3 { $params: join($params, nth($params, 1)); } @if $l > 1 { $params: join($params, nth($params, 2)); } @else { $params: join($params, $params); } } @return $params; } @mixin complex-property($property, $params, $complex-params: false) { @if isset($params) { $l: length($params); @if $l == 1 or complex-isset($params) { #{$property}: $params; } @else { @if $l < 4 { $params: if(length($complex-params) >= 4, $complex-params, complex-list($params)); } $i: 0; @each $side in top, right, bottom, left { $i: $i + 1; $p: nth($params, $i); @if isset($p) { #{$property}-#{$side}: $p; } } } } } @function strip-px($v) { @return if(unit($v) == "px", $v / 1px, $v); } @function list-to-string($list, $separator: "") { $result: ""; $first: true; @each $cut in $list { @if $first { $first: false; $result: $cut; } @else { $result: "#{$result}#{$separator}#{$cut}" } } @return $result; } @function change-separator($list, $separator: comma) { $result: (); @each $value in $list { $result: append($result, $value, $separator); } @return $result; } @function compact-list($list, $separator: comma) { $result: (); @each $value in $list { @if isset($value) { $result: append($result, $value, $separator); } } @return $result; } @function hack-ie8($params) { @return unquote("#{$params}\0/"); } @function contains($list, $var) { @each $item in $list { @if $item == $var { @return true; } } @return false; } @function find-typed-item($list, $type, $default: false) { @each $item in $list { @if type-of($item) == $type { @return $item; } } @return $default; } @function find-color($list, $default: false) { @return find-typed-item($list, color, $default); }