mixins.scss 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. /**
  2. * @class Global_CSS
  3. */
  4. @import 'mixins/border';
  5. @import 'mixins/outline';
  6. @import 'mixins/font';
  7. @import 'mixins/font-icon';
  8. @import 'mixins/icon';
  9. @import 'mixins/transform';
  10. // Background property support for vendor prefixing within values.
  11. @mixin background(
  12. $background-1,
  13. $background-2: false,
  14. $background-3: false,
  15. $background-4: false,
  16. $background-5: false,
  17. $background-6: false,
  18. $background-7: false,
  19. $background-8: false,
  20. $background-9: false,
  21. $background-10: false
  22. ) {
  23. $backgrounds: compact($background-1, $background-2, $background-3, $background-4, $background-5, $background-6, $background-7, $background-8, $background-9, $background-10);
  24. $mult-bgs: -compass-list-size($backgrounds) > 1;
  25. $add-pie-bg: prefixed(-pie, $backgrounds) or $mult-bgs;
  26. @if $experimental-support-for-svg and prefixed(-svg, $backgrounds) {
  27. background: -svg($backgrounds);
  28. }
  29. @if $support-for-original-webkit-gradients and prefixed(-owg, $backgrounds) {
  30. background: -owg($backgrounds);
  31. }
  32. @if $experimental-support-for-webkit and prefixed(-webkit, $backgrounds) {
  33. background: -webkit($backgrounds);
  34. }
  35. @if $experimental-support-for-mozilla and prefixed(-moz, $backgrounds) {
  36. background: -moz($backgrounds);
  37. }
  38. @if $experimental-support-for-opera and prefixed(-o, $backgrounds) {
  39. background: -o($backgrounds);
  40. }
  41. // BEGIN PATCH
  42. // IE10 Supports linear-gradient but with a new syntax, Compass has deprecated -ms prefix support too soon
  43. // this patch brings -ms prefix support back to gradients. This should be removed when compass is updated with
  44. // proper support
  45. background: -ms-#{$backgrounds};
  46. // END PATCH
  47. @if $experimental-support-for-pie and $add-pie-bg {
  48. -pie-background: -pie($backgrounds);
  49. }
  50. background: $backgrounds;
  51. }
  52. @mixin background-image(
  53. $image-1,
  54. $image-2: false,
  55. $image-3: false,
  56. $image-4: false,
  57. $image-5: false,
  58. $image-6: false,
  59. $image-7: false,
  60. $image-8: false,
  61. $image-9: false,
  62. $image-10: false
  63. ) {
  64. $images: compact($image-1, $image-2, $image-3, $image-4, $image-5, $image-6, $image-7, $image-8, $image-9, $image-10);
  65. $add-pie-bg: prefixed(-pie, $images) or -compass-list-size($images) > 1;
  66. @if $experimental-support-for-svg and prefixed(-svg, $images) {
  67. background-image: -svg($images);
  68. background-size: 100%;
  69. }
  70. @if $support-for-original-webkit-gradients and prefixed(-owg, $images) {
  71. background-image: -owg($images);
  72. }
  73. @if $experimental-support-for-webkit and prefixed(-webkit, $images) {
  74. background-image: -webkit($images);
  75. }
  76. @if $experimental-support-for-mozilla and prefixed(-moz, $images) {
  77. background-image: -moz($images);
  78. }
  79. @if $experimental-support-for-opera and prefixed(-o, $images) {
  80. background-image: -o($images);
  81. }
  82. // BEGIN PATCH
  83. // IE10 Supports linear-gradient but with a new syntax, Compass has deprecated -ms prefix support too soon
  84. // this patch brings -ms prefix support back to gradients. This should be removed when compass is updated with
  85. // proper support
  86. background-image: -ms-#{$images};
  87. // END PATCH
  88. @if $experimental-support-for-pie and $add-pie-bg {
  89. @warn "PIE does not support background-image. Use @include background(#{$images}) instead."
  90. }
  91. }
  92. /**
  93. * Adds basic styles to :before or :after pseudo-elements.
  94. *
  95. * .my-element:after {
  96. * @include insertion(50px, 50px);
  97. * }
  98. *
  99. * @param {measurement} $width Height of pseudo-element.
  100. * @param {measurement} $height Height of pseudo-element.
  101. * @param {measurement} $top Top positioning of pseudo-element.
  102. * @param {measurement} $left Left positioning of pseudo-element.
  103. */
  104. @mixin insertion(
  105. $width: 30px,
  106. $height: 30px,
  107. $top: 0,
  108. $left: 0
  109. ) {
  110. content: '';
  111. position: absolute;
  112. width: $width;
  113. height: $height;
  114. top: $top;
  115. left: $left;
  116. }
  117. @mixin absolute-position($top: 0, $right: 0, $bottom: 0, $left: 0) {
  118. position: absolute;
  119. top: $top;
  120. right: $right;
  121. bottom: $bottom;
  122. left: $left;
  123. }
  124. @mixin absolute-fit {
  125. width: auto;
  126. height: auto;
  127. @include absolute-position;
  128. }
  129. @mixin st-box-shadow($shadow: none) {
  130. -webkit-box-shadow: $shadow;
  131. box-shadow: $shadow;
  132. }
  133. @mixin st-loading-spinner($spinner-size: 50px, $color: #ccc, $bar-width: 5px, $bar-height: 15px) {
  134. .x-loading-spinner {
  135. font-size: 250%;
  136. height: $spinner-size;
  137. width: $spinner-size;
  138. position: relative;
  139. -webkit-transform-origin: $spinner-size/2 $spinner-size/2;
  140. transform-origin: $spinner-size/2 $spinner-size/2;
  141. /* Shared Properties for all the bars */
  142. & > span,
  143. & > span:before,
  144. & > span:after {
  145. display: block;
  146. position: absolute;
  147. width: $bar-width;
  148. height: $bar-height;
  149. top: 0;
  150. -webkit-transform-origin: $bar-width/2 $spinner-size/2;
  151. transform-origin: $bar-width/2 $spinner-size/2;
  152. content: " ";
  153. }
  154. & > span {
  155. left: 50%;
  156. margin-left: -0.05em;
  157. &.x-loading-top {
  158. background-color: rgba($color, 0.99);
  159. }
  160. &.x-loading-top::after {
  161. background-color: rgba($color, 0.90);
  162. }
  163. &.x-loading-left::before {
  164. background-color: rgba($color, 0.80);
  165. }
  166. &.x-loading-left {
  167. background-color: rgba($color, 0.70);
  168. }
  169. &.x-loading-left::after {
  170. background-color: rgba($color, 0.60);
  171. }
  172. &.x-loading-bottom::before {
  173. background-color: rgba($color, 0.50);
  174. }
  175. &.x-loading-bottom {
  176. background-color: rgba($color, 0.40);
  177. }
  178. &.x-loading-bottom::after {
  179. background-color: rgba($color, 0.35);
  180. }
  181. &.x-loading-right::before {
  182. background-color: rgba($color, 0.30);
  183. }
  184. &.x-loading-right {
  185. background-color: rgba($color, 0.25);
  186. }
  187. &.x-loading-right::after {
  188. background-color: rgba($color, 0.20);
  189. }
  190. &.x-loading-top::before {
  191. background-color: rgba($color, 0.15);
  192. }
  193. }
  194. }
  195. /* Rotate each of the 4 Spans */
  196. .x-loading-spinner > span.x-loading-top {
  197. -webkit-transform: rotate(0deg);
  198. transform: rotate(0deg);
  199. }
  200. .x-loading-spinner > span.x-loading-right {
  201. -webkit-transform: rotate(90deg);
  202. transform: rotate(90deg);
  203. }
  204. .x-loading-spinner > span.x-loading-bottom {
  205. -webkit-transform: rotate(180deg);
  206. transform: rotate(180deg);
  207. }
  208. .x-loading-spinner > span.x-loading-left {
  209. -webkit-transform: rotate(270deg);
  210. transform: rotate(270deg);
  211. }
  212. /* These are the two lines that surround each of the 4 Span lines */
  213. .x-loading-spinner > span::before {
  214. -webkit-transform: rotate(30deg);
  215. transform: rotate(30deg);
  216. }
  217. .x-loading-spinner > span::after {
  218. -webkit-transform: rotate(-30deg);
  219. transform: rotate(-30deg);
  220. }
  221. /* Set Animation */
  222. .x-loading-spinner {
  223. -webkit-animation-name: x-loading-spinner-rotate;
  224. -webkit-animation-duration: .5s;
  225. -webkit-animation-iteration-count: infinite;
  226. -webkit-animation-timing-function: linear;
  227. animation-name: x-loading-spinner-rotate;
  228. animation-duration: .5s;
  229. animation-timing-function: linear;
  230. animation-iteration-count: infinite;
  231. }
  232. }
  233. @mixin font-family($name, $path, $font) {
  234. $path: $path + '/' + $font;
  235. @font-face {
  236. font-family: $name;
  237. src: url($path + '.eot');
  238. src: url($path + '.eot?#iefix') format('embedded-opentype'),
  239. url($path + '.woff') format('woff'),
  240. url($path + '.ttf') format('truetype');
  241. font-weight: normal;
  242. font-style: normal;
  243. }
  244. }
  245. @mixin icon-font($name, $font) {
  246. @include font-family($name, 'fonts', $font);
  247. }