_radial-arg-parser.scss 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. @function _radial-arg-parser($G1, $G2, $pos, $shape-size) {
  2. @each $value in $G1, $G2 {
  3. $first-val: nth($value, 1);
  4. $pos-type: type-of($first-val);
  5. $spec-at-index: null;
  6. // Determine if spec was passed to mixin
  7. @if type-of($value) == list {
  8. $spec-at-index: if(index($value, at), index($value, at), false);
  9. }
  10. @if $spec-at-index {
  11. @if $spec-at-index > 1 {
  12. @for $i from 1 through ($spec-at-index - 1) {
  13. $shape-size: $shape-size nth($value, $i);
  14. }
  15. @for $i from ($spec-at-index + 1) through length($value) {
  16. $pos: $pos nth($value, $i);
  17. }
  18. }
  19. @else if $spec-at-index == 1 {
  20. @for $i from ($spec-at-index + 1) through length($value) {
  21. $pos: $pos nth($value, $i);
  22. }
  23. }
  24. $G1: null;
  25. }
  26. // If not spec calculate correct values
  27. @else {
  28. @if ($pos-type != color) or ($first-val != "transparent") {
  29. @if ($pos-type == number)
  30. or ($first-val == "center")
  31. or ($first-val == "top")
  32. or ($first-val == "right")
  33. or ($first-val == "bottom")
  34. or ($first-val == "left") {
  35. $pos: $value;
  36. @if $pos == $G1 {
  37. $G1: null;
  38. }
  39. }
  40. @else if
  41. ($first-val == "ellipse")
  42. or ($first-val == "circle")
  43. or ($first-val == "closest-side")
  44. or ($first-val == "closest-corner")
  45. or ($first-val == "farthest-side")
  46. or ($first-val == "farthest-corner")
  47. or ($first-val == "contain")
  48. or ($first-val == "cover") {
  49. $shape-size: $value;
  50. @if $value == $G1 {
  51. $G1: null;
  52. }
  53. @else if $value == $G2 {
  54. $G2: null;
  55. }
  56. }
  57. }
  58. }
  59. }
  60. @return $G1, $G2, $pos, $shape-size;
  61. }