You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

127 lines
4.2 KiB

  1. /*!
  2. * Copyright (c) 2017. tom@axisj.com
  3. * - github.com/thomasjang
  4. * - www.axisj.com
  5. */
  6. $hack_ie67: '.';
  7. @mixin placeholder($color: $input-color-placeholder) {
  8. // Firefox
  9. &::-moz-placeholder {
  10. color: $color;
  11. opacity: 1; // Override Firefox's unusual default opacity; see https://github.com/twbs/bootstrap/pull/11526
  12. }
  13. &:-ms-input-placeholder {
  14. color: $color;
  15. }
  16. // Internet Explorer 10+
  17. &::-webkit-input-placeholder {
  18. color: $color;
  19. }
  20. // Safari and Chrome
  21. }
  22. @mixin prefixer($property, $value, $prefixes) {
  23. @each $prefix in $prefixes {
  24. @if $prefix == webkit {
  25. @if $prefix-for-webkit {
  26. -webkit-#{$property}: $value;
  27. }
  28. } @else if $prefix == moz {
  29. @if $prefix-for-mozilla {
  30. -moz-#{$property}: $value;
  31. }
  32. } @else if $prefix == ms {
  33. @if $prefix-for-microsoft {
  34. -ms-#{$property}: $value;
  35. }
  36. } @else if $prefix == o {
  37. @if $prefix-for-opera {
  38. -o-#{$property}: $value;
  39. }
  40. } @else if $prefix == spec {
  41. @if $prefix-for-spec {
  42. #{$property}: $value;
  43. }
  44. } @else {
  45. @warn "Unrecognized prefix: #{$prefix}";
  46. }
  47. }
  48. }
  49. @mixin box-shadow($shadows...) {
  50. @include prefixer(box-shadow, $shadows, spec);
  51. }
  52. @mixin background-size($lengths...) {
  53. @include prefixer(background-size, $lengths, spec);
  54. }
  55. @mixin ax-border-radius($border-radius, $direction:"", $adjust:0) {
  56. @if (type_of($border-radius) == "list") {
  57. @if ($direction == "") {
  58. border-top-left-radius: nth($border-radius, 1)+$adjust;
  59. border-top-right-radius: nth($border-radius, 2)+$adjust;
  60. border-bottom-right-radius: nth($border-radius, 3)+$adjust;
  61. border-bottom-left-radius: nth($border-radius, 4)+$adjust;
  62. } @else if ($direction == "top") {
  63. border-top-left-radius: nth($border-radius, 1)+$adjust;
  64. border-top-right-radius: nth($border-radius, 2)+$adjust;
  65. } @else if ($direction == "bottom") {
  66. border-bottom-right-radius: nth($border-radius, 3)+$adjust;
  67. border-bottom-left-radius: nth($border-radius, 4)+$adjust;
  68. } @else if ($direction == "left") {
  69. border-top-left-radius: nth($border-radius, 1)+$adjust;
  70. border-bottom-left-radius: nth($border-radius, 4)+$adjust;
  71. } @else if ($direction == "right") {
  72. border-top-right-radius: nth($border-radius, 2)+$adjust;
  73. border-bottom-right-radius: nth($border-radius, 3)+$adjust;
  74. }
  75. } @else {
  76. @if ($direction == "") {
  77. border-radius: $border-radius+$adjust;
  78. } @else if ($direction == "top") {
  79. border-top-left-radius: $border-radius+$adjust;
  80. border-top-right-radius: $border-radius+$adjust;
  81. } @else if ($direction == "bottom") {
  82. border-bottom-left-radius: $border-radius+$adjust;
  83. border-bottom-right-radius: $border-radius+$adjust;
  84. } @else if ($direction == "left") {
  85. border-top-left-radius: $border-radius+$adjust;
  86. border-bottom-left-radius: $border-radius+$adjust;
  87. } @else if ($direction == "right") {
  88. border-top-right-radius: $border-radius+$adjust;
  89. border-bottom-right-radius: $border-radius+$adjust;
  90. }
  91. }
  92. }
  93. @mixin ax-background($pos, $g1: null, $g2: null) {
  94. $pos-type: type-of(nth($pos, 1));
  95. // If $pos is missing from mixin, reassign vars and add default position
  96. @if ($pos-type == color) or (nth($pos, 1) == "transparent") {
  97. $g2: $g1;
  98. $g1: $pos;
  99. $pos: to top;
  100. } @else if ($g1 == null) {
  101. $g1: $pos;
  102. $pos: to top;
  103. }
  104. // @debug($g1);
  105. @if (length($g1) == 2) {
  106. $g2: nth($g1, 2);
  107. $g1: nth($g1, 1);
  108. @include linear-gradient($pos, $g1, $g2);
  109. } @else if (length($g1) == 3) {
  110. @include linear-gradient(nth($g1, 1), nth($g1, 2), nth($g1, 3));
  111. } @else {
  112. @if (type_of(nth($g2, 1)) == color) {
  113. $g2: nth($g2, 1);
  114. }
  115. @include linear-gradient($pos, $g1, $g2);
  116. }
  117. }