_skel.scss 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  1. // skel.scss v3.0.1 | (c) skel.io | MIT licensed */
  2. // Vars.
  3. /// Breakpoints.
  4. /// @var {list}
  5. $breakpoints: () !global;
  6. /// Vendor prefixes.
  7. /// @var {list}
  8. $vendor-prefixes: (
  9. '-moz-',
  10. '-webkit-',
  11. '-ms-',
  12. ''
  13. );
  14. /// Properties that should be vendorized.
  15. /// @var {list}
  16. $vendor-properties: (
  17. 'align-content',
  18. 'align-items',
  19. 'align-self',
  20. 'animation',
  21. 'animation-delay',
  22. 'animation-direction',
  23. 'animation-duration',
  24. 'animation-fill-mode',
  25. 'animation-iteration-count',
  26. 'animation-name',
  27. 'animation-play-state',
  28. 'animation-timing-function',
  29. 'appearance',
  30. 'backface-visibility',
  31. 'box-sizing',
  32. 'filter',
  33. 'flex',
  34. 'flex-basis',
  35. 'flex-direction',
  36. 'flex-flow',
  37. 'flex-grow',
  38. 'flex-shrink',
  39. 'flex-wrap',
  40. 'justify-content',
  41. 'order',
  42. 'perspective',
  43. 'pointer-events',
  44. 'transform',
  45. 'transform-origin',
  46. 'transform-style',
  47. 'transition',
  48. 'transition-delay',
  49. 'transition-duration',
  50. 'transition-property',
  51. 'transition-timing-function',
  52. 'user-select'
  53. );
  54. /// Values that should be vendorized.
  55. /// @var {list}
  56. $vendor-values: (
  57. 'filter',
  58. 'flex',
  59. 'linear-gradient',
  60. 'radial-gradient',
  61. 'transform'
  62. );
  63. // Functions.
  64. /// Removes a specific item from a list.
  65. /// @author Hugo Giraudel
  66. /// @param {list} $list List.
  67. /// @param {integer} $index Index.
  68. /// @return {list} Updated list.
  69. @function remove-nth($list, $index) {
  70. $result: null;
  71. @if type-of($index) != number {
  72. @warn "$index: #{quote($index)} is not a number for `remove-nth`.";
  73. }
  74. @else if $index == 0 {
  75. @warn "List index 0 must be a non-zero integer for `remove-nth`.";
  76. }
  77. @else if abs($index) > length($list) {
  78. @warn "List index is #{$index} but list is only #{length($list)} item long for `remove-nth`.";
  79. }
  80. @else {
  81. $result: ();
  82. $index: if($index < 0, length($list) + $index + 1, $index);
  83. @for $i from 1 through length($list) {
  84. @if $i != $index {
  85. $result: append($result, nth($list, $i));
  86. }
  87. }
  88. }
  89. @return $result;
  90. }
  91. /// Replaces a substring within another string.
  92. /// @author Hugo Giraudel
  93. /// @param {string} $string String.
  94. /// @param {string} $search Substring.
  95. /// @param {string} $replace Replacement.
  96. /// @return {string} Updated string.
  97. @function str-replace($string, $search, $replace: '') {
  98. $index: str-index($string, $search);
  99. @if $index {
  100. @return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
  101. }
  102. @return $string;
  103. }
  104. /// Replaces a substring within each string in a list.
  105. /// @param {list} $strings List of strings.
  106. /// @param {string} $search Substring.
  107. /// @param {string} $replace Replacement.
  108. /// @return {list} Updated list of strings.
  109. @function str-replace-all($strings, $search, $replace: '') {
  110. @each $string in $strings {
  111. $strings: set-nth($strings, index($strings, $string), str-replace($string, $search, $replace));
  112. }
  113. @return $strings;
  114. }
  115. /// Gets a value from a map.
  116. /// @author Hugo Giraudel
  117. /// @param {map} $map Map.
  118. /// @param {string} $keys Key(s).
  119. /// @return {string} Value.
  120. @function val($map, $keys...) {
  121. @if nth($keys, 1) == null {
  122. $keys: remove-nth($keys, 1);
  123. }
  124. @each $key in $keys {
  125. $map: map-get($map, $key);
  126. }
  127. @return $map;
  128. }
  129. // Mixins.
  130. /// Sets the global box model.
  131. /// @param {string} $model Model (default is content).
  132. @mixin boxModel($model: 'content') {
  133. $x: $model + '-box';
  134. *, *:before, *:after {
  135. -moz-box-sizing: #{$x};
  136. -webkit-box-sizing: #{$x};
  137. box-sizing: #{$x};
  138. }
  139. }
  140. /// Wraps @content in a @media block using a given breakpoint.
  141. /// @param {string} $breakpoint Breakpoint.
  142. /// @param {map} $queries Additional queries.
  143. @mixin breakpoint($breakpoint: null, $queries: null) {
  144. $query: 'screen';
  145. // Breakpoint.
  146. @if $breakpoint and map-has-key($breakpoints, $breakpoint) {
  147. $query: $query + ' and ' + map-get($breakpoints, $breakpoint);
  148. }
  149. // Queries.
  150. @if $queries {
  151. @each $k, $v in $queries {
  152. $query: $query + ' and (' + $k + ':' + $v + ')';
  153. }
  154. }
  155. @media #{$query} {
  156. @content;
  157. }
  158. }
  159. /// Wraps @content in a @media block targeting a specific orientation.
  160. /// @param {string} $orientation Orientation.
  161. @mixin orientation($orientation) {
  162. @media screen and (orientation: #{$orientation}) {
  163. @content;
  164. }
  165. }
  166. /// Utility mixin for containers.
  167. /// @param {mixed} $width Width.
  168. @mixin containers($width) {
  169. // Locked?
  170. $lock: false;
  171. @if length($width) == 2 {
  172. $width: nth($width, 1);
  173. $lock: true;
  174. }
  175. // Modifiers.
  176. .container.\31 25\25 { width: 100%; max-width: $width * 1.25; min-width: $width; }
  177. .container.\37 5\25 { width: $width * 0.75; }
  178. .container.\35 0\25 { width: $width * 0.5; }
  179. .container.\32 5\25 { width: $width * 0.25; }
  180. // Main class.
  181. .container {
  182. @if $lock {
  183. width: $width !important;
  184. }
  185. @else {
  186. width: $width;
  187. }
  188. }
  189. }
  190. /// Utility mixin for grid.
  191. /// @param {list} $gutters Column and row gutters (default is 40px).
  192. /// @param {string} $breakpointName Optional breakpoint name.
  193. @mixin grid($gutters: 40px, $breakpointName: null) {
  194. // Gutters.
  195. @include grid-gutters($gutters);
  196. @include grid-gutters($gutters, \32 00\25, 2);
  197. @include grid-gutters($gutters, \31 50\25, 1.5);
  198. @include grid-gutters($gutters, \35 0\25, 0.5);
  199. @include grid-gutters($gutters, \32 5\25, 0.25);
  200. // Cells.
  201. $x: '';
  202. @if $breakpointName {
  203. $x: '\\28' + $breakpointName + '\\29';
  204. }
  205. .\31 2u#{$x}, .\31 2u\24#{$x} { width: 100%; clear: none; margin-left: 0; }
  206. .\31 1u#{$x}, .\31 1u\24#{$x} { width: 91.6666666667%; clear: none; margin-left: 0; }
  207. .\31 0u#{$x}, .\31 0u\24#{$x} { width: 83.3333333333%; clear: none; margin-left: 0; }
  208. .\39 u#{$x}, .\39 u\24#{$x} { width: 75%; clear: none; margin-left: 0; }
  209. .\38 u#{$x}, .\38 u\24#{$x} { width: 66.6666666667%; clear: none; margin-left: 0; }
  210. .\37 u#{$x}, .\37 u\24#{$x} { width: 58.3333333333%; clear: none; margin-left: 0; }
  211. .\36 u#{$x}, .\36 u\24#{$x} { width: 50%; clear: none; margin-left: 0; }
  212. .\35 u#{$x}, .\35 u\24#{$x} { width: 41.6666666667%; clear: none; margin-left: 0; }
  213. .\34 u#{$x}, .\34 u\24#{$x} { width: 33.3333333333%; clear: none; margin-left: 0; }
  214. .\33 u#{$x}, .\33 u\24#{$x} { width: 25%; clear: none; margin-left: 0; }
  215. .\32 u#{$x}, .\32 u\24#{$x} { width: 16.6666666667%; clear: none; margin-left: 0; }
  216. .\31 u#{$x}, .\31 u\24#{$x} { width: 8.3333333333%; clear: none; margin-left: 0; }
  217. .\31 2u\24#{$x} + *,
  218. .\31 1u\24#{$x} + *,
  219. .\31 0u\24#{$x} + *,
  220. .\39 u\24#{$x} + *,
  221. .\38 u\24#{$x} + *,
  222. .\37 u\24#{$x} + *,
  223. .\36 u\24#{$x} + *,
  224. .\35 u\24#{$x} + *,
  225. .\34 u\24#{$x} + *,
  226. .\33 u\24#{$x} + *,
  227. .\32 u\24#{$x} + *,
  228. .\31 u\24#{$x} + * {
  229. clear: left;
  230. }
  231. .\-11u#{$x} { margin-left: 91.6666666667% }
  232. .\-10u#{$x} { margin-left: 83.3333333333% }
  233. .\-9u#{$x} { margin-left: 75% }
  234. .\-8u#{$x} { margin-left: 66.6666666667% }
  235. .\-7u#{$x} { margin-left: 58.3333333333% }
  236. .\-6u#{$x} { margin-left: 50% }
  237. .\-5u#{$x} { margin-left: 41.6666666667% }
  238. .\-4u#{$x} { margin-left: 33.3333333333% }
  239. .\-3u#{$x} { margin-left: 25% }
  240. .\-2u#{$x} { margin-left: 16.6666666667% }
  241. .\-1u#{$x} { margin-left: 8.3333333333% }
  242. }
  243. /// Utility mixin for grid.
  244. /// @param {list} $gutters Gutters.
  245. /// @param {string} $class Optional class name.
  246. /// @param {integer} $multiplier Multiplier (default is 1).
  247. @mixin grid-gutters($gutters, $class: null, $multiplier: 1) {
  248. // Expand gutters if it's not a list.
  249. @if length($gutters) == 1 {
  250. $gutters: ($gutters, 0);
  251. }
  252. // Get column and row gutter values.
  253. $c: nth($gutters, 1);
  254. $r: nth($gutters, 2);
  255. // Get class (if provided).
  256. $x: '';
  257. @if $class {
  258. $x: '.' + $class;
  259. }
  260. // Default.
  261. .row#{$x} > * { padding: ($r * $multiplier) 0 0 ($c * $multiplier); }
  262. .row#{$x} { margin: ($r * $multiplier * -1) 0 -1px ($c * $multiplier * -1); }
  263. // Uniform.
  264. .row.uniform#{$x} > * { padding: ($c * $multiplier) 0 0 ($c * $multiplier); }
  265. .row.uniform#{$x} { margin: ($c * $multiplier * -1) 0 -1px ($c * $multiplier * -1); }
  266. }
  267. /// Wraps @content in vendorized keyframe blocks.
  268. /// @param {string} $name Name.
  269. @mixin keyframes($name) {
  270. @-moz-keyframes #{$name} { @content; }
  271. @-webkit-keyframes #{$name} { @content; }
  272. @-ms-keyframes #{$name} { @content; }
  273. @keyframes #{$name} { @content; }
  274. }
  275. ///
  276. /// Sets breakpoints.
  277. /// @param {map} $x Breakpoints.
  278. ///
  279. @mixin skel-breakpoints($x: ()) {
  280. $breakpoints: $x !global;
  281. }
  282. ///
  283. /// Initializes layout module.
  284. /// @param {map} config Config.
  285. ///
  286. @mixin skel-layout($config: ()) {
  287. // Config.
  288. $configPerBreakpoint: ();
  289. $z: map-get($config, 'breakpoints');
  290. @if $z {
  291. $configPerBreakpoint: $z;
  292. }
  293. // Reset.
  294. $x: map-get($config, 'reset');
  295. @if $x {
  296. /* Reset */
  297. @include reset($x);
  298. }
  299. // Box model.
  300. $x: map-get($config, 'boxModel');
  301. @if $x {
  302. /* Box Model */
  303. @include boxModel($x);
  304. }
  305. // Containers.
  306. $containers: map-get($config, 'containers');
  307. @if $containers {
  308. /* Containers */
  309. .container {
  310. margin-left: auto;
  311. margin-right: auto;
  312. }
  313. // Use default is $containers is just "true".
  314. @if $containers == true {
  315. $containers: 960px;
  316. }
  317. // Apply base.
  318. @include containers($containers);
  319. // Apply per-breakpoint.
  320. @each $name in map-keys($breakpoints) {
  321. // Get/use breakpoint setting if it exists.
  322. $x: map-get($configPerBreakpoint, $name);
  323. // Per-breakpoint config exists?
  324. @if $x {
  325. $y: map-get($x, 'containers');
  326. // Setting exists? Use it.
  327. @if $y {
  328. $containers: $y;
  329. }
  330. }
  331. // Create @media block.
  332. @media screen and #{map-get($breakpoints, $name)} {
  333. @include containers($containers);
  334. }
  335. }
  336. }
  337. // Grid.
  338. $grid: map-get($config, 'grid');
  339. @if $grid {
  340. /* Grid */
  341. // Use defaults if $grid is just "true".
  342. @if $grid == true {
  343. $grid: ();
  344. }
  345. // Sub-setting: Gutters.
  346. $grid-gutters: 40px;
  347. $x: map-get($grid, 'gutters');
  348. @if $x {
  349. $grid-gutters: $x;
  350. }
  351. // Rows.
  352. .row {
  353. border-bottom: solid 1px transparent;
  354. -moz-box-sizing: border-box;
  355. -webkit-box-sizing: border-box;
  356. box-sizing: border-box;
  357. }
  358. .row > * {
  359. float: left;
  360. -moz-box-sizing: border-box;
  361. -webkit-box-sizing: border-box;
  362. box-sizing: border-box;
  363. }
  364. .row:after, .row:before {
  365. content: '';
  366. display: block;
  367. clear: both;
  368. height: 0;
  369. }
  370. .row.uniform > * > :first-child {
  371. margin-top: 0;
  372. }
  373. .row.uniform > * > :last-child {
  374. margin-bottom: 0;
  375. }
  376. // Gutters (0%).
  377. @include grid-gutters($grid-gutters, \30 \25, 0);
  378. // Apply base.
  379. @include grid($grid-gutters);
  380. // Apply per-breakpoint.
  381. @each $name in map-keys($breakpoints) {
  382. // Get/use breakpoint setting if it exists.
  383. $x: map-get($configPerBreakpoint, $name);
  384. // Per-breakpoint config exists?
  385. @if $x {
  386. $y: map-get($x, 'grid');
  387. // Setting exists?
  388. @if $y {
  389. // Sub-setting: Gutters.
  390. $x: map-get($y, 'gutters');
  391. @if $x {
  392. $grid-gutters: $x;
  393. }
  394. }
  395. }
  396. // Create @media block.
  397. @media screen and #{map-get($breakpoints, $name)} {
  398. @include grid($grid-gutters, $name);
  399. }
  400. }
  401. }
  402. }
  403. /// Resets browser styles.
  404. /// @param {string} $mode Mode (default is 'normalize').
  405. @mixin reset($mode: 'normalize') {
  406. @if $mode == 'normalize' {
  407. // normalize.css v3.0.2 | MIT License | git.io/normalize
  408. html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}
  409. }
  410. @else if $mode == 'full' {
  411. // meyerweb.com/eric/tools/css/reset v2.0 | 20110126 | License: none (public domain)
  412. html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline;}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block;}body{line-height:1;}ol,ul{list-style:none;}blockquote,q{quotes:none;}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none;}table{border-collapse:collapse;border-spacing:0;}body{-webkit-text-size-adjust:none}
  413. }
  414. }
  415. /// Vendorizes a declaration's property and/or value(s).
  416. /// @param {string} $property Property.
  417. /// @param {mixed} $value String/list of value(s).
  418. @mixin vendor($property, $value) {
  419. // Determine if property should expand.
  420. $expandProperty: index($vendor-properties, $property);
  421. // Determine if value should expand (and if so, add '-prefix-' placeholder).
  422. $expandValue: false;
  423. @each $x in $value {
  424. @each $y in $vendor-values {
  425. @if $y == str-slice($x, 1, str-length($y)) {
  426. $value: set-nth($value, index($value, $x), '-prefix-' + $x);
  427. $expandValue: true;
  428. }
  429. }
  430. }
  431. // Expand property?
  432. @if $expandProperty {
  433. @each $vendor in $vendor-prefixes {
  434. #{$vendor}#{$property}: #{str-replace-all($value, '-prefix-', $vendor)};
  435. }
  436. }
  437. // Expand just the value?
  438. @elseif $expandValue {
  439. @each $vendor in $vendor-prefixes {
  440. #{$property}: #{str-replace-all($value, '-prefix-', $vendor)};
  441. }
  442. }
  443. // Neither? Treat them as a normal declaration.
  444. @else {
  445. #{$property}: #{$value};
  446. }
  447. }