diff --git a/_css/bourbon/_bourbon-deprecated-upcoming.scss b/_css/bourbon/_bourbon-deprecated-upcoming.scss index 5332496d..f946b3b4 100644 --- a/_css/bourbon/_bourbon-deprecated-upcoming.scss +++ b/_css/bourbon/_bourbon-deprecated-upcoming.scss @@ -2,12 +2,7 @@ // These mixins/functions are deprecated // They will be removed in the next MAJOR version release //************************************************************************// -@mixin box-shadow ($shadows...) { - @include prefixer(box-shadow, $shadows, spec); - @warn "box-shadow is deprecated and will be removed in the next major version release"; -} - -@mixin background-size ($lengths...) { - @include prefixer(background-size, $lengths, spec); - @warn "background-size is deprecated and will be removed in the next major version release"; +@mixin inline-block { + display: inline-block; + @warn "inline-block mixin is deprecated and will be removed in the next major version release"; } diff --git a/_css/bourbon/_bourbon.scss b/_css/bourbon/_bourbon.scss index 53fbca87..eea6e21e 100644 --- a/_css/bourbon/_bourbon.scss +++ b/_css/bourbon/_bourbon.scss @@ -1,22 +1,36 @@ +// Settings +@import "settings/prefixer"; +@import "settings/px-to-em"; +@import "settings/asset-pipeline"; + // Custom Helpers -@import "helpers/deprecated-webkit-gradient"; +@import "helpers/convert-units"; @import "helpers/gradient-positions-parser"; +@import "helpers/is-num"; +@import "helpers/linear-angle-parser"; +@import "helpers/linear-gradient-parser"; @import "helpers/linear-positions-parser"; +@import "helpers/linear-side-corner-parser"; @import "helpers/radial-arg-parser"; @import "helpers/radial-positions-parser"; +@import "helpers/radial-gradient-parser"; @import "helpers/render-gradients"; @import "helpers/shape-size-stripper"; +@import "helpers/str-to-num"; // Custom Functions -@import "functions/compact"; +@import "functions/assign"; +@import "functions/color-lightness"; @import "functions/flex-grid"; +@import "functions/golden-ratio"; @import "functions/grid-width"; -@import "functions/linear-gradient"; @import "functions/modular-scale"; @import "functions/px-to-em"; -@import "functions/radial-gradient"; +@import "functions/px-to-rem"; +@import "functions/strip-units"; @import "functions/tint-shade"; @import "functions/transition-property-name"; +@import "functions/unpack"; // CSS3 Mixins @import "css3/animation"; @@ -27,12 +41,15 @@ @import "css3/border-image"; @import "css3/border-radius"; @import "css3/box-sizing"; +@import "css3/calc"; @import "css3/columns"; +@import "css3/filter"; @import "css3/flex-box"; @import "css3/font-face"; +@import "css3/font-feature-settings"; +@import "css3/hyphens"; @import "css3/hidpi-media-query"; @import "css3/image-rendering"; -@import "css3/inline-block"; @import "css3/keyframes"; @import "css3/linear-gradient"; @import "css3/perspective"; @@ -45,6 +62,8 @@ // Addons & other mixins @import "addons/button"; @import "addons/clearfix"; +@import "addons/directional-values"; +@import "addons/ellipsis"; @import "addons/font-family"; @import "addons/hide-text"; @import "addons/html5-input-types"; @@ -54,6 +73,7 @@ @import "addons/size"; @import "addons/timing-functions"; @import "addons/triangle"; +@import "addons/word-wrap"; // Soon to be deprecated Mixins @import "bourbon-deprecated-upcoming"; diff --git a/_css/bourbon/addons/_button.scss b/_css/bourbon/addons/_button.scss index 3ae393c0..14a89e48 100644 --- a/_css/bourbon/addons/_button.scss +++ b/_css/bourbon/addons/_button.scss @@ -1,38 +1,51 @@ -@mixin button ($style: simple, $base-color: #4294f0) { +@mixin button ($style: simple, $base-color: #4294f0, $text-size: inherit, $padding: 7px 18px) { - @if type-of($style) == color { + @if type-of($style) == string and type-of($base-color) == color { + @include buttonstyle($style, $base-color, $text-size, $padding); + } + + @if type-of($style) == string and type-of($base-color) == number { + $padding: $text-size; + $text-size: $base-color; + $base-color: #4294f0; + + @if $padding == inherit { + $padding: 7px 18px; + } + + @include buttonstyle($style, $base-color, $text-size, $padding); + } + + @if type-of($style) == color and type-of($base-color) == color { $base-color: $style; $style: simple; + @include buttonstyle($style, $base-color, $text-size, $padding); } - // Grayscale button - @if $base-color == grayscale($base-color) { - @if $style == simple { - @include simple($base-color, $grayscale: true); - } + @if type-of($style) == color and type-of($base-color) == number { + $padding: $text-size; + $text-size: $base-color; + $base-color: $style; + $style: simple; - @else if $style == shiny { - @include shiny($base-color, $grayscale: true); + @if $padding == inherit { + $padding: 7px 18px; } - @else if $style == pill { - @include pill($base-color, $grayscale: true); - } + @include buttonstyle($style, $base-color, $text-size, $padding); } - // Colored button - @else { - @if $style == simple { - @include simple($base-color); - } + @if type-of($style) == number { + $padding: $base-color; + $text-size: $style; + $base-color: #4294f0; + $style: simple; - @else if $style == shiny { - @include shiny($base-color); + @if $padding == #4294f0 { + $padding: 7px 18px; } - @else if $style == pill { - @include pill($base-color); - } + @include buttonstyle($style, $base-color, $text-size, $padding); } &:disabled { @@ -42,16 +55,55 @@ } +// Selector Style Button +//************************************************************************// +@mixin buttonstyle($type, $b-color, $t-size, $pad) { + // Grayscale button + @if $type == simple and $b-color == grayscale($b-color) { + @include simple($b-color, true, $t-size, $pad); + } + + @if $type == shiny and $b-color == grayscale($b-color) { + @include shiny($b-color, true, $t-size, $pad); + } + + @if $type == pill and $b-color == grayscale($b-color) { + @include pill($b-color, true, $t-size, $pad); + } + + @if $type == flat and $b-color == grayscale($b-color) { + @include flat($b-color, true, $t-size, $pad); + } + + // Colored button + @if $type == simple { + @include simple($b-color, false, $t-size, $pad); + } + + @else if $type == shiny { + @include shiny($b-color, false, $t-size, $pad); + } + + @else if $type == pill { + @include pill($b-color, false, $t-size, $pad); + } + + @else if $type == flat { + @include flat($b-color, false, $t-size, $pad); + } +} + + // Simple Button //************************************************************************// -@mixin simple($base-color, $grayscale: false) { +@mixin simple($base-color, $grayscale: false, $textsize: inherit, $padding: 7px 18px) { $color: hsl(0, 0, 100%); $border: adjust-color($base-color, $saturation: 9%, $lightness: -14%); $inset-shadow: adjust-color($base-color, $saturation: -8%, $lightness: 15%); $stop-gradient: adjust-color($base-color, $saturation: 9%, $lightness: -11%); $text-shadow: adjust-color($base-color, $saturation: 15%, $lightness: -18%); - @if lightness($base-color) > 70% { + @if is-light($base-color) { $color: hsl(0, 0, 20%); $text-shadow: adjust-color($base-color, $saturation: 10%, $lightness: 4%); } @@ -68,10 +120,10 @@ box-shadow: inset 0 1px 0 0 $inset-shadow; color: $color; display: inline-block; - font-size: 11px; + font-size: $textsize; font-weight: bold; @include linear-gradient ($base-color, $stop-gradient); - padding: 7px 18px; + padding: $padding; text-decoration: none; text-shadow: 0 1px 0 $text-shadow; background-clip: padding-box; @@ -92,7 +144,8 @@ @include linear-gradient ($base-color-hover, $stop-gradient-hover); } - &:active:not(:disabled) { + &:active:not(:disabled), + &:focus:not(:disabled) { $border-active: adjust-color($base-color, $saturation: 9%, $lightness: -14%); $inset-shadow-active: adjust-color($base-color, $saturation: 7%, $lightness: -17%); @@ -102,14 +155,14 @@ } border: 1px solid $border-active; - box-shadow: inset 0 0 8px 4px $inset-shadow-active, inset 0 0 8px 4px $inset-shadow-active, 0 1px 1px 0 #eee; + box-shadow: inset 0 0 8px 4px $inset-shadow-active, inset 0 0 8px 4px $inset-shadow-active; } } // Shiny Button //************************************************************************// -@mixin shiny($base-color, $grayscale: false) { +@mixin shiny($base-color, $grayscale: false, $textsize: inherit, $padding: 7px 18px) { $color: hsl(0, 0, 100%); $border: adjust-color($base-color, $red: -117, $green: -111, $blue: -81); $border-bottom: adjust-color($base-color, $red: -126, $green: -127, $blue: -122); @@ -119,7 +172,7 @@ $text-shadow: adjust-color($base-color, $red: -140, $green: -141, $blue: -114); $third-stop: adjust-color($base-color, $red: -86, $green: -75, $blue: -48); - @if lightness($base-color) > 70% { + @if is-light($base-color) { $color: hsl(0, 0, 20%); $text-shadow: adjust-color($base-color, $saturation: 10%, $lightness: 4%); } @@ -140,10 +193,10 @@ box-shadow: inset 0 1px 0 0 $inset-shadow; color: $color; display: inline-block; - font-size: 14px; + font-size: $textsize; font-weight: bold; @include linear-gradient(top, $base-color 0%, $second-stop 50%, $third-stop 50%, $fourth-stop 100%); - padding: 8px 20px; + padding: $padding; text-align: center; text-decoration: none; text-shadow: 0 -1px 1px $text-shadow; @@ -168,21 +221,22 @@ $fourth-stop-hover 100%); } - &:active:not(:disabled) { + &:active:not(:disabled), + &:focus:not(:disabled) { $inset-shadow-active: adjust-color($base-color, $red: -111, $green: -116, $blue: -122); @if $grayscale == true { $inset-shadow-active: grayscale($inset-shadow-active); } - box-shadow: inset 0 0 20px 0 $inset-shadow-active, 0 1px 0 #fff; + box-shadow: inset 0 0 20px 0 $inset-shadow-active; } } // Pill Button //************************************************************************// -@mixin pill($base-color, $grayscale: false) { +@mixin pill($base-color, $grayscale: false, $textsize: inherit, $padding: 7px 18px) { $color: hsl(0, 0, 100%); $border-bottom: adjust-color($base-color, $hue: 8, $saturation: -11%, $lightness: -26%); $border-sides: adjust-color($base-color, $hue: 4, $saturation: -21%, $lightness: -21%); @@ -191,7 +245,7 @@ $stop-gradient: adjust-color($base-color, $hue: 8, $saturation: 14%, $lightness: -10%); $text-shadow: adjust-color($base-color, $hue: 5, $saturation: -19%, $lightness: -15%); - @if lightness($base-color) > 70% { + @if is-light($base-color) { $color: hsl(0, 0, 20%); $text-shadow: adjust-color($base-color, $saturation: 10%, $lightness: 4%); } @@ -208,14 +262,14 @@ border: 1px solid $border-top; border-color: $border-top $border-sides $border-bottom; border-radius: 16px; - box-shadow: inset 0 1px 0 0 $inset-shadow, 0 1px 2px 0 #b3b3b3; + box-shadow: inset 0 1px 0 0 $inset-shadow; color: $color; display: inline-block; - font-size: 11px; + font-size: $textsize; font-weight: normal; line-height: 1; @include linear-gradient ($base-color, $stop-gradient); - padding: 5px 16px; + padding: $padding; text-align: center; text-decoration: none; text-shadow: 0 -1px 1px $text-shadow; @@ -249,7 +303,8 @@ background-clip: padding-box; } - &:active:not(:disabled) { + &:active:not(:disabled), + &:focus:not(:disabled) { $active-color: adjust-color($base-color, $hue: 4, $saturation: -12%, $lightness: -10%); $border-active: adjust-color($base-color, $hue: 6, $saturation: -2.5%, $lightness: -30%); $border-bottom-active: adjust-color($base-color, $hue: 11, $saturation: 6%, $lightness: -31%); @@ -267,7 +322,53 @@ background: $active-color; border: 1px solid $border-active; border-bottom: 1px solid $border-bottom-active; - box-shadow: inset 0 0 6px 3px $inset-shadow-active, 0 1px 0 0 #fff; + box-shadow: inset 0 0 6px 3px $inset-shadow-active; text-shadow: 0 -1px 1px $text-shadow-active; } } + + + +// Flat Button +//************************************************************************// +@mixin flat($base-color, $grayscale: false, $textsize: inherit, $padding: 7px 18px) { + $color: hsl(0, 0, 100%); + + @if is-light($base-color) { + $color: hsl(0, 0, 20%); + } + + background-color: $base-color; + border-radius: 3px; + border: none; + color: $color; + display: inline-block; + font-size: inherit; + font-weight: bold; + padding: 7px 18px; + text-decoration: none; + background-clip: padding-box; + + &:hover:not(:disabled){ + $base-color-hover: adjust-color($base-color, $saturation: 4%, $lightness: 5%); + + @if $grayscale == true { + $base-color-hover: grayscale($base-color-hover); + } + + background-color: $base-color-hover; + cursor: pointer; + } + + &:active:not(:disabled), + &:focus:not(:disabled) { + $base-color-active: adjust-color($base-color, $saturation: -4%, $lightness: -5%); + + @if $grayscale == true { + $base-color-active: grayscale($base-color-active); + } + + background-color: $base-color-active; + cursor: pointer; + } +} diff --git a/_css/bourbon/addons/_clearfix.scss b/_css/bourbon/addons/_clearfix.scss index ca9903cf..783cfbc7 100644 --- a/_css/bourbon/addons/_clearfix.scss +++ b/_css/bourbon/addons/_clearfix.scss @@ -1,4 +1,4 @@ -// Micro clearfix provides an easy way to contain floats without adding additional markup +// Modern micro clearfix provides an easy way to contain floats without adding additional markup. // // Example usage: // @@ -12,18 +12,12 @@ // } @mixin clearfix { - *zoom: 1; - - &:before, - &:after { - content: " "; - display: table; - } - &:after { - clear: both; + content:""; + display:table; + clear:both; } } // Acknowledgements -// Micro clearfix: [Nicolas Gallagher](http://nicolasgallagher.com/micro-clearfix-hack/) +// Beat *that* clearfix: [Thierry Koblentz](http://www.css-101.org/articles/clearfix/latest-new-clearfix-so-far.php) diff --git a/_css/bourbon/addons/_directional-values.scss b/_css/bourbon/addons/_directional-values.scss new file mode 100644 index 00000000..742f1031 --- /dev/null +++ b/_css/bourbon/addons/_directional-values.scss @@ -0,0 +1,111 @@ +// directional-property mixins are shorthands +// for writing properties like the following +// +// @include margin(null 0 10px); +// ------ +// margin-right: 0; +// margin-bottom: 10px; +// margin-left: 0; +// +// - or - +// +// @include border-style(dotted null); +// ------ +// border-top-style: dotted; +// border-bottom-style: dotted; +// +// ------ +// +// Note: You can also use false instead of null + +@function collapse-directionals($vals) { + $output: null; + + $A: nth( $vals, 1 ); + $B: if( length($vals) < 2, $A, nth($vals, 2)); + $C: if( length($vals) < 3, $A, nth($vals, 3)); + $D: if( length($vals) < 2, $A, nth($vals, if( length($vals) < 4, 2, 4) )); + + @if $A == 0 { $A: 0 } + @if $B == 0 { $B: 0 } + @if $C == 0 { $C: 0 } + @if $D == 0 { $D: 0 } + + @if $A == $B and $A == $C and $A == $D { $output: $A } + @else if $A == $C and $B == $D { $output: $A $B } + @else if $B == $D { $output: $A $B $C } + @else { $output: $A $B $C $D } + + @return $output; +} + +@function contains-falsy($list) { + @each $item in $list { + @if not $item { + @return true; + } + } + + @return false; +} + +@mixin directional-property($pre, $suf, $vals) { + // Property Names + $top: $pre + "-top" + if($suf, "-#{$suf}", ""); + $bottom: $pre + "-bottom" + if($suf, "-#{$suf}", ""); + $left: $pre + "-left" + if($suf, "-#{$suf}", ""); + $right: $pre + "-right" + if($suf, "-#{$suf}", ""); + $all: $pre + if($suf, "-#{$suf}", ""); + + $vals: collapse-directionals($vals); + + @if contains-falsy($vals) { + @if nth($vals, 1) { #{$top}: nth($vals, 1); } + + @if length($vals) == 1 { + @if nth($vals, 1) { #{$right}: nth($vals, 1); } + } @else { + @if nth($vals, 2) { #{$right}: nth($vals, 2); } + } + + // prop: top/bottom right/left + @if length($vals) == 2 { + @if nth($vals, 1) { #{$bottom}: nth($vals, 1); } + @if nth($vals, 2) { #{$left}: nth($vals, 2); } + + // prop: top right/left bottom + } @else if length($vals) == 3 { + @if nth($vals, 3) { #{$bottom}: nth($vals, 3); } + @if nth($vals, 2) { #{$left}: nth($vals, 2); } + + // prop: top right bottom left + } @else if length($vals) == 4 { + @if nth($vals, 3) { #{$bottom}: nth($vals, 3); } + @if nth($vals, 4) { #{$left}: nth($vals, 4); } + } + + // prop: top/right/bottom/left + } @else { + #{$all}: $vals; + } +} + +@mixin margin($vals...) { + @include directional-property(margin, false, $vals...); +} + +@mixin padding($vals...) { + @include directional-property(padding, false, $vals...); +} + +@mixin border-style($vals...) { + @include directional-property(border, style, $vals...); +} + +@mixin border-color($vals...) { + @include directional-property(border, color, $vals...); +} + +@mixin border-width($vals...) { + @include directional-property(border, width, $vals...); +} diff --git a/_css/bourbon/addons/_ellipsis.scss b/_css/bourbon/addons/_ellipsis.scss new file mode 100644 index 00000000..a8ea2a4a --- /dev/null +++ b/_css/bourbon/addons/_ellipsis.scss @@ -0,0 +1,7 @@ +@mixin ellipsis($width: 100%) { + display: inline-block; + max-width: $width; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} diff --git a/_css/bourbon/addons/_font-family.scss b/_css/bourbon/addons/_font-family.scss index df8a80dd..31f5d9ca 100644 --- a/_css/bourbon/addons/_font-family.scss +++ b/_css/bourbon/addons/_font-family.scss @@ -1,5 +1,5 @@ $georgia: Georgia, Cambria, "Times New Roman", Times, serif; -$helvetica: "Helvetica Neue", Helvetica, Arial, sans-serif; +$helvetica: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif; $lucida-grande: "Lucida Grande", Tahoma, Verdana, Arial, sans-serif; $monospace: "Bitstream Vera Sans Mono", Consolas, Courier, monospace; $verdana: Verdana, Geneva, sans-serif; diff --git a/_css/bourbon/addons/_hide-text.scss b/_css/bourbon/addons/_hide-text.scss index 68d4bf86..fc794381 100644 --- a/_css/bourbon/addons/_hide-text.scss +++ b/_css/bourbon/addons/_hide-text.scss @@ -1,5 +1,10 @@ @mixin hide-text { - color: transparent; - font: 0/0 a; - text-shadow: none; + overflow: hidden; + + &:before { + content: ""; + display: block; + width: 0; + height: 100%; + } } diff --git a/_css/bourbon/addons/_html5-input-types.scss b/_css/bourbon/addons/_html5-input-types.scss index b184382d..9e9324ae 100644 --- a/_css/bourbon/addons/_html5-input-types.scss +++ b/_css/bourbon/addons/_html5-input-types.scss @@ -20,29 +20,19 @@ $inputs-list: 'input[type="email"]', 'input[type="time"]', 'input[type="week"]'; -$unquoted-inputs-list: (); -@each $input-type in $inputs-list { - $unquoted-inputs-list: append($unquoted-inputs-list, unquote($input-type), comma); -} - -$all-text-inputs: $unquoted-inputs-list; - +// Bare inputs +//************************************************************************// +$all-text-inputs: assign-inputs($inputs-list); // Hover Pseudo-class //************************************************************************// -$all-text-inputs-hover: (); -@each $input-type in $unquoted-inputs-list { - $input-type-hover: $input-type + ":hover"; - $all-text-inputs-hover: append($all-text-inputs-hover, $input-type-hover, comma); -} +$all-text-inputs-hover: assign-inputs($inputs-list, hover); // Focus Pseudo-class //************************************************************************// -$all-text-inputs-focus: (); -@each $input-type in $unquoted-inputs-list { - $input-type-focus: $input-type + ":focus"; - $all-text-inputs-focus: append($all-text-inputs-focus, $input-type-focus, comma); -} +$all-text-inputs-focus: assign-inputs($inputs-list, focus); + + // You must use interpolation on the variable: // #{$all-text-inputs} @@ -54,3 +44,43 @@ $all-text-inputs-focus: (); // #{$all-text-inputs}, textarea { // border: 1px solid red; // } + + + +//************************************************************************// +// Generate a variable ($all-button-inputs) with a list of all html5 +// input types that have a button-based input, excluding button. +//************************************************************************// +$inputs-button-list: 'input[type="button"]', + 'input[type="reset"]', + 'input[type="submit"]'; + +// Bare inputs +//************************************************************************// +$all-button-inputs: assign-inputs($inputs-button-list); + +// Hover Pseudo-class +//************************************************************************// +$all-button-inputs-hover: assign-inputs($inputs-button-list, hover); + +// Focus Pseudo-class +//************************************************************************// +$all-button-inputs-focus: assign-inputs($inputs-button-list, focus); + +// Active Pseudo-class +//************************************************************************// +$all-button-inputs-active: assign-inputs($inputs-button-list, active); + + + +// You must use interpolation on the variable: +// #{$all-button-inputs} +// #{$all-button-inputs-hover} +// #{$all-button-inputs-focus} +// #{$all-button-inputs-active} + +// Example +//************************************************************************// +// #{$all-button-inputs}, button { +// border: 1px solid red; +// } diff --git a/_css/bourbon/addons/_position.scss b/_css/bourbon/addons/_position.scss index faad1cae..7de75182 100644 --- a/_css/bourbon/addons/_position.scss +++ b/_css/bourbon/addons/_position.scss @@ -1,10 +1,12 @@ -@mixin position ($position: relative, $coordinates: 0 0 0 0) { +@mixin position ($position: relative, $coordinates: null null null null) { @if type-of($position) == list { $coordinates: $position; $position: relative; } + $coordinates: unpack($coordinates); + $top: nth($coordinates, 1); $right: nth($coordinates, 2); $bottom: nth($coordinates, 3); @@ -12,31 +14,19 @@ position: $position; - @if $top == auto { - top: $top; - } - @else if not(unitless($top)) { + @if ($top and $top == auto) or (type-of($top) == number) { top: $top; } - @if $right == auto { - right: $right; - } - @else if not(unitless($right)) { + @if ($right and $right == auto) or (type-of($right) == number) { right: $right; } - @if $bottom == auto { - bottom: $bottom; - } - @else if not(unitless($bottom)) { + @if ($bottom and $bottom == auto) or (type-of($bottom) == number) { bottom: $bottom; } - @if $left == auto { - left: $left; - } - @else if not(unitless($left)) { + @if ($left and $left == auto) or (type-of($left) == number) { left: $left; } } diff --git a/_css/bourbon/addons/_prefixer.scss b/_css/bourbon/addons/_prefixer.scss index 6bfd23a1..c32f5027 100644 --- a/_css/bourbon/addons/_prefixer.scss +++ b/_css/bourbon/addons/_prefixer.scss @@ -1,11 +1,7 @@ //************************************************************************// // Example: @include prefixer(border-radius, $radii, webkit ms spec); //************************************************************************// -$prefix-for-webkit: true !default; -$prefix-for-mozilla: true !default; -$prefix-for-microsoft: true !default; -$prefix-for-opera: true !default; -$prefix-for-spec: true !default; // required for keyframe mixin +// Variables located in /settings/_prefixer.scss @mixin prefixer ($property, $value, $prefixes) { @each $prefix in $prefixes { @@ -41,9 +37,9 @@ $prefix-for-spec: true !default; // required for keyframe mixin } @mixin disable-prefix-for-all() { - $prefix-for-webkit: false; - $prefix-for-mozilla: false; - $prefix-for-microsoft: false; - $prefix-for-opera: false; - $prefix-for-spec: false; + $prefix-for-webkit: false !global; + $prefix-for-mozilla: false !global; + $prefix-for-microsoft: false !global; + $prefix-for-opera: false !global; + $prefix-for-spec: false !global; } diff --git a/_css/bourbon/addons/_retina-image.scss b/_css/bourbon/addons/_retina-image.scss index ed300715..3995c197 100644 --- a/_css/bourbon/addons/_retina-image.scss +++ b/_css/bourbon/addons/_retina-image.scss @@ -1,28 +1,27 @@ -@mixin retina-image($filename, $background-size, $extension: png, $retina-filename: null, $asset-pipeline: false) { +@mixin retina-image($filename, $background-size, $extension: png, $retina-filename: null, $retina-suffix: _2x, $asset-pipeline: $asset-pipeline) { @if $asset-pipeline { - background-image: image_url($filename + "." + $extension); + background-image: image-url("#{$filename}.#{$extension}"); } @else { - background-image: url($filename + "." + $extension); + background-image: url("#{$filename}.#{$extension}"); } @include hidpi { - @if $asset-pipeline { @if $retina-filename { - background-image: image_url($retina-filename + "." + $extension); + background-image: image-url("#{$retina-filename}.#{$extension}"); } @else { - background-image: image_url($filename + "@2x" + "." + $extension); + background-image: image-url("#{$filename}#{$retina-suffix}.#{$extension}"); } } @else { @if $retina-filename { - background-image: url($retina-filename + "." + $extension); + background-image: url("#{$retina-filename}.#{$extension}"); } @else { - background-image: url($filename + "@2x" + "." + $extension); + background-image: url("#{$filename}#{$retina-suffix}.#{$extension}"); } } diff --git a/_css/bourbon/addons/_size.scss b/_css/bourbon/addons/_size.scss index 342e41b7..a8653799 100644 --- a/_css/bourbon/addons/_size.scss +++ b/_css/bourbon/addons/_size.scss @@ -1,44 +1,16 @@ @mixin size($size) { - @if length($size) == 1 { - @if $size == auto { - width: $size; - height: $size; - } + $height: nth($size, 1); + $width: $height; - @else if unitless($size) { - width: $size + px; - height: $size + px; - } - - @else if not(unitless($size)) { - width: $size; - height: $size; - } - } - - // Width x Height - @if length($size) == 2 { - $width: nth($size, 1); + @if length($size) > 1 { $height: nth($size, 2); + } - @if $width == auto { - width: $width; - } - @else if not(unitless($width)) { - width: $width; - } - @else if unitless($width) { - width: $width + px; - } + @if $height == auto or (type-of($height) == number and not unitless($height)) { + height: $height; + } - @if $height == auto { - height: $height; - } - @else if not(unitless($height)) { - height: $height; - } - @else if unitless($height) { - height: $height + px; - } + @if $width == auto or (type-of($width) == number and not unitless($width)) { + width: $width; } } diff --git a/_css/bourbon/addons/_timing-functions.scss b/_css/bourbon/addons/_timing-functions.scss index 51b24109..5ecc6f9d 100644 --- a/_css/bourbon/addons/_timing-functions.scss +++ b/_css/bourbon/addons/_timing-functions.scss @@ -1,5 +1,5 @@ // CSS cubic-bezier timing functions. Timing functions courtesy of jquery.easie (github.com/jaukia/easie) -// Timing functions are the same as demo'ed here: http://jqueryui.com/demos/effect/easing.html +// Timing functions are the same as demo'ed here: http://jqueryui.com/resources/demos/effect/easing.html // EASE IN $ease-in-quad: cubic-bezier(0.550, 0.085, 0.680, 0.530); diff --git a/_css/bourbon/addons/_triangle.scss b/_css/bourbon/addons/_triangle.scss index 0e02aca2..573954e4 100644 --- a/_css/bourbon/addons/_triangle.scss +++ b/_css/bourbon/addons/_triangle.scss @@ -2,44 +2,82 @@ height: 0; width: 0; + $width: nth($size, 1); + $height: nth($size, length($size)); + + $foreground-color: nth($color, 1); + $background-color: if(length($color) == 2, nth($color, 2), transparent); + @if ($direction == up) or ($direction == down) or ($direction == right) or ($direction == left) { - border-color: transparent; - border-style: solid; - border-width: $size / 2; + + $width: $width / 2; + $height: if(length($size) > 1, $height, $height/2); @if $direction == up { - border-bottom-color: $color; + border-left: $width solid $background-color; + border-right: $width solid $background-color; + border-bottom: $height solid $foreground-color; } @else if $direction == right { - border-left-color: $color; + border-top: $width solid $background-color; + border-bottom: $width solid $background-color; + border-left: $height solid $foreground-color; } @else if $direction == down { - border-top-color: $color; + border-left: $width solid $background-color; + border-right: $width solid $background-color; + border-top: $height solid $foreground-color; } @else if $direction == left { - border-right-color: $color; + border-top: $width solid $background-color; + border-bottom: $width solid $background-color; + border-right: $height solid $foreground-color; } } @else if ($direction == up-right) or ($direction == up-left) { - border-top: $size solid $color; + border-top: $height solid $foreground-color; @if $direction == up-right { - border-left: $size solid transparent; + border-left: $width solid $background-color; } @else if $direction == up-left { - border-right: $size solid transparent; + border-right: $width solid $background-color; } } @else if ($direction == down-right) or ($direction == down-left) { - border-bottom: $size solid $color; + border-bottom: $height solid $foreground-color; @if $direction == down-right { - border-left: $size solid transparent; + border-left: $width solid $background-color; } @else if $direction == down-left { - border-right: $size solid transparent; + border-right: $width solid $background-color; } } + + @else if ($direction == inset-up) { + border-width: $height $width; + border-style: solid; + border-color: $background-color $background-color $foreground-color; + } + + @else if ($direction == inset-down) { + border-width: $height $width; + border-style: solid; + border-color: $foreground-color $background-color $background-color; + } + + @else if ($direction == inset-right) { + border-width: $width $height; + border-style: solid; + border-color: $background-color $background-color $background-color $foreground-color; + } + + @else if ($direction == inset-left) { + border-width: $width $height; + border-style: solid; + border-color: $background-color $foreground-color $background-color $background-color; + } } diff --git a/_css/bourbon/addons/_word-wrap.scss b/_css/bourbon/addons/_word-wrap.scss new file mode 100644 index 00000000..9734a597 --- /dev/null +++ b/_css/bourbon/addons/_word-wrap.scss @@ -0,0 +1,8 @@ +@mixin word-wrap($wrap: break-word) { + word-wrap: $wrap; + + @if $wrap == break-word { + overflow-wrap: break-word; + word-break: break-all; + } +} diff --git a/_css/bourbon/css3/_background-image.scss b/_css/bourbon/css3/_background-image.scss index 17016b91..6abe88be 100644 --- a/_css/bourbon/css3/_background-image.scss +++ b/_css/bourbon/css3/_background-image.scss @@ -4,45 +4,39 @@ //************************************************************************// @mixin background-image($images...) { - background-image: _add-prefix($images, webkit); - background-image: _add-prefix($images); -} + $webkit-images: (); + $spec-images: (); + + @each $image in $images { + $webkit-image: (); + $spec-image: (); + + @if (type-of($image) == string) { + $url-str: str-slice($image, 0, 3); + $gradient-type: str-slice($image, 0, 6); -@function _add-prefix($images, $vendor: false) { - $images-prefixed: (); - $gradient-positions: false; - @for $i from 1 through length($images) { - $type: type-of(nth($images, $i)); // Get type of variable - List or String - - // If variable is a list - Gradient - @if $type == list { - $gradient-type: nth(nth($images, $i), 1); // linear or radial - $gradient-pos: null; - $gradient-args: null; - - @if ($gradient-type == linear) or ($gradient-type == radial) { - $gradient-pos: nth(nth($images, $i), 2); // Get gradient position - $gradient-args: nth(nth($images, $i), 3); // Get actual gradient (red, blue) + @if $url-str == "url" { + $webkit-image: $image; + $spec-image: $image; } - @else { - $gradient-args: nth(nth($images, $i), 2); // Get actual gradient (red, blue) + + @else if $gradient-type == "linear" { + $gradients: _linear-gradient-parser($image); + $webkit-image: map-get($gradients, webkit-image); + $spec-image: map-get($gradients, spec-image); } - $gradient-positions: _gradient-positions-parser($gradient-type, $gradient-pos); - $gradient: _render-gradients($gradient-positions, $gradient-args, $gradient-type, $vendor); - $images-prefixed: append($images-prefixed, $gradient, comma); - } - // If variable is a string - Image - @else if $type == string { - $images-prefixed: join($images-prefixed, nth($images, $i), comma); + @else if $gradient-type == "radial" { + $gradients: _radial-gradient-parser($image); + $webkit-image: map-get($gradients, webkit-image); + $spec-image: map-get($gradients, spec-image); + } } + + $webkit-images: append($webkit-images, $webkit-image, comma); + $spec-images: append($spec-images, $spec-image, comma); } - @return $images-prefixed; -} -//Examples: - //@include background-image(linear-gradient(top, orange, red)); - //@include background-image(radial-gradient(50% 50%, cover circle, orange, red)); - //@include background-image(url("/images/a.png"), linear-gradient(orange, red)); - //@include background-image(url("image.png"), linear-gradient(orange, red), url("image.png")); - //@include background-image(linear-gradient(hsla(0, 100%, 100%, 0.25) 0%, hsla(0, 100%, 100%, 0.08) 50%, transparent 50%), linear-gradient(orange, red)); + background-image: $webkit-images; + background-image: $spec-images; +} diff --git a/_css/bourbon/css3/_background.scss b/_css/bourbon/css3/_background.scss index 766d5d32..9bce9308 100644 --- a/_css/bourbon/css3/_background.scss +++ b/_css/bourbon/css3/_background.scss @@ -3,101 +3,53 @@ // notation. //************************************************************************// -@mixin background( - $background-1 , $background-2: false, - $background-3: false, $background-4: false, - $background-5: false, $background-6: false, - $background-7: false, $background-8: false, - $background-9: false, $background-10: false, - $fallback: false -) { - $backgrounds: compact($background-1, $background-2, - $background-3, $background-4, - $background-5, $background-6, - $background-7, $background-8, - $background-9, $background-10); +@mixin background($backgrounds...) { + $webkit-backgrounds: (); + $spec-backgrounds: (); - $fallback-color: false; - @if (type-of($fallback) == color) or ($fallback == "transparent") { - $fallback-color: $fallback; - } - @else { - $fallback-color: _extract-background-color($backgrounds); - } - - @if $fallback-color { - background-color: $fallback-color; - } - background: _background-add-prefix($backgrounds, webkit); - background: _background-add-prefix($backgrounds); -} - -@function _extract-background-color($backgrounds) { - $final-bg-layer: nth($backgrounds, length($backgrounds)); - @if type-of($final-bg-layer) == list { - @for $i from 1 through length($final-bg-layer) { - $value: nth($final-bg-layer, $i); - @if type-of($value) == color { - @return $value; - } - } - } - @return false; -} - -@function _background-add-prefix($backgrounds, $vendor: false) { - $backgrounds-prefixed: (); + @each $background in $backgrounds { + $webkit-background: (); + $spec-background: (); + $background-type: type-of($background); - @for $i from 1 through length($backgrounds) { - $shorthand: nth($backgrounds, $i); // Get member for current index - $type: type-of($shorthand); // Get type of variable - List (gradient) or String (image) + @if $background-type == string or list { + $background-str: if($background-type == list, nth($background, 1), $background); - // If shorthand is a list (gradient) - @if $type == list { - $first-member: nth($shorthand, 1); // Get first member of shorthand + $url-str: str-slice($background-str, 0, 3); + $gradient-type: str-slice($background-str, 0, 6); - // Linear Gradient - @if index(linear radial, nth($first-member, 1)) { - $gradient-type: nth($first-member, 1); // linear || radial - $gradient-args: false; - $gradient-positions: false; - $shorthand-start: false; - @if type-of($first-member) == list { // Linear gradient plus additional shorthand values - lg(red,orange)repeat,... - $gradient-positions: nth($first-member, 2); - $gradient-args: nth($first-member, 3); - $shorthand-start: 2; - } - @else { // Linear gradient only - lg(red,orange),... - $gradient-positions: nth($shorthand, 2); - $gradient-args: nth($shorthand, 3); // Get gradient (red, blue) - } + @if $url-str == "url" { + $webkit-background: $background; + $spec-background: $background; + } - $gradient-positions: _gradient-positions-parser($gradient-type, $gradient-positions); - $gradient: _render-gradients($gradient-positions, $gradient-args, $gradient-type, $vendor); + @else if $gradient-type == "linear" { + $gradients: _linear-gradient-parser("#{$background}"); + $webkit-background: map-get($gradients, webkit-image); + $spec-background: map-get($gradients, spec-image); + } - // Append any additional shorthand args to gradient - @if $shorthand-start { - @for $j from $shorthand-start through length($shorthand) { - $gradient: join($gradient, nth($shorthand, $j), space); - } - } - $backgrounds-prefixed: append($backgrounds-prefixed, $gradient, comma); + @else if $gradient-type == "radial" { + $gradients: _radial-gradient-parser("#{$background}"); + $webkit-background: map-get($gradients, webkit-image); + $spec-background: map-get($gradients, spec-image); } - // Image with additional properties + @else { - $backgrounds-prefixed: append($backgrounds-prefixed, $shorthand, comma); + $webkit-background: $background; + $spec-background: $background; } } - // If shorthand is a simple string (color or image) - @else if $type == string { - $backgrounds-prefixed: join($backgrounds-prefixed, $shorthand, comma); + + @else { + $webkit-background: $background; + $spec-background: $background; } + + $webkit-backgrounds: append($webkit-backgrounds, $webkit-background, comma); + $spec-backgrounds: append($spec-backgrounds, $spec-background, comma); } - @return $backgrounds-prefixed; -} -//Examples: - //@include background(linear-gradient(top, orange, red)); - //@include background(radial-gradient(circle at 40% 40%, orange, red)); - //@include background(url("/images/a.png") no-repeat, linear-gradient(orange, red)); - //@include background(url("image.png") center center, linear-gradient(orange, red), url("image.png")); + background: $webkit-backgrounds; + background: $spec-backgrounds; +} diff --git a/_css/bourbon/css3/_border-image.scss b/_css/bourbon/css3/_border-image.scss index 1fff212d..e338c2dc 100644 --- a/_css/bourbon/css3/_border-image.scss +++ b/_css/bourbon/css3/_border-image.scss @@ -1,48 +1,53 @@ -@mixin border-image($images) { - -webkit-border-image: _border-add-prefix($images, webkit); - -moz-border-image: _border-add-prefix($images, moz); - -o-border-image: _border-add-prefix($images, o); - border-image: _border-add-prefix($images); -} +@mixin border-image($borders...) { + $webkit-borders: (); + $spec-borders: (); + + @each $border in $borders { + $webkit-border: (); + $spec-border: (); + $border-type: type-of($border); + + @if $border-type == string or list { + $border-str: if($border-type == list, nth($border, 1), $border); + + $url-str: str-slice($border-str, 0, 3); + $gradient-type: str-slice($border-str, 0, 6); + + @if $url-str == "url" { + $webkit-border: $border; + $spec-border: $border; + } + + @else if $gradient-type == "linear" { + $gradients: _linear-gradient-parser("#{$border}"); + $webkit-border: map-get($gradients, webkit-image); + $spec-border: map-get($gradients, spec-image); + } + + @else if $gradient-type == "radial" { + $gradients: _radial-gradient-parser("#{$border}"); + $webkit-border: map-get($gradients, webkit-image); + $spec-border: map-get($gradients, spec-image); + } -@function _border-add-prefix($images, $vendor: false) { - $border-image: null; - $images-type: type-of(nth($images, 1)); - $first-var: nth(nth($images, 1), 1); // Get type of Gradient (Linear || radial) - - // If input is a gradient - @if $images-type == string { - @if ($first-var == "linear") or ($first-var == "radial") { - $gradient-type: nth($images, 1); // Get type of gradient (linear || radial) - $gradient-pos: nth($images, 2); // Get gradient position - $gradient-args: nth($images, 3); // Get actual gradient (red, blue) - $gradient-positions: _gradient-positions-parser($gradient-type, $gradient-pos); - $border-image: _render-gradients($gradient-positions, $gradient-args, $gradient-type, $vendor); + @else { + $webkit-border: $border; + $spec-border: $border; + } } - // If input is a URL + @else { - $border-image: $images; - } - } - // If input is gradient or url + additional args - @else if $images-type == list { - $type: type-of(nth($images, 1)); // Get type of variable - List or String - - // If variable is a list - Gradient - @if $type == list { - $gradient: nth($images, 1); - $gradient-type: nth($gradient, 1); // Get type of gradient (linear || radial) - $gradient-pos: nth($gradient, 2); // Get gradient position - $gradient-args: nth($gradient, 3); // Get actual gradient (red, blue) - $gradient-positions: _gradient-positions-parser($gradient-type, $gradient-pos); - $border-image: _render-gradients($gradient-positions, $gradient-args, $gradient-type, $vendor); - - @for $i from 2 through length($images) { - $border-image: append($border-image, nth($images, $i)); - } + $webkit-border: $border; + $spec-border: $border; } + + $webkit-borders: append($webkit-borders, $webkit-border, comma); + $spec-borders: append($spec-borders, $spec-border, comma); } - @return $border-image; + + -webkit-border-image: $webkit-borders; + border-image: $spec-borders; + border-style: solid; } //Examples: @@ -52,4 +57,3 @@ // @include border-image(linear-gradient(45deg, orange, yellow) stretch); // @include border-image(linear-gradient(45deg, orange, yellow) 20 30 40 50 stretch round); // @include border-image(radial-gradient(top, cover, orange, yellow, orange)); - diff --git a/_css/bourbon/css3/_calc.scss b/_css/bourbon/css3/_calc.scss new file mode 100644 index 00000000..94d7e4ce --- /dev/null +++ b/_css/bourbon/css3/_calc.scss @@ -0,0 +1,4 @@ +@mixin calc($property, $value) { + #{$property}: -webkit-calc(#{$value}); + #{$property}: calc(#{$value}); +} diff --git a/_css/bourbon/css3/_columns.scss b/_css/bourbon/css3/_columns.scss index 42274a4e..96f601c1 100644 --- a/_css/bourbon/css3/_columns.scss +++ b/_css/bourbon/css3/_columns.scss @@ -15,7 +15,7 @@ @mixin column-fill($arg: auto) { // auto || length - @include prefixer(columns-fill, $arg, webkit moz spec); + @include prefixer(column-fill, $arg, webkit moz spec); } @mixin column-rule($arg) { diff --git a/_css/bourbon/css3/_filter.scss b/_css/bourbon/css3/_filter.scss new file mode 100644 index 00000000..8560d776 --- /dev/null +++ b/_css/bourbon/css3/_filter.scss @@ -0,0 +1,5 @@ +@mixin filter($function: none) { + // [= 1 { - @include prefixer(transition, $properties, webkit moz spec); + // Fix for vendor-prefix transform property + $needs-prefixes: false; + $webkit: (); + $moz: (); + $spec: (); + + // Create lists for vendor-prefixed transform + @each $list in $properties { + @if nth($list, 1) == "transform" { + $needs-prefixes: true; + $list1: -webkit-transform; + $list2: -moz-transform; + $list3: (); + + @each $var in $list { + $list3: join($list3, $var); + + @if $var != "transform" { + $list1: join($list1, $var); + $list2: join($list2, $var); + } + } + + $webkit: append($webkit, $list1); + $moz: append($moz, $list2); + $spec: append($spec, $list3); + } + + // Create lists for non-prefixed transition properties + @else { + $webkit: append($webkit, $list, comma); + $moz: append($moz, $list, comma); + $spec: append($spec, $list, comma); + } } + @if $needs-prefixes { + -webkit-transition: $webkit; + -moz-transition: $moz; + transition: $spec; + } @else { - $properties: all 0.15s ease-out 0; - @include prefixer(transition, $properties, webkit moz spec); + @if length($properties) >= 1 { + @include prefixer(transition, $properties, webkit moz spec); + } + + @else { + $properties: all 0.15s ease-out 0s; + @include prefixer(transition, $properties, webkit moz spec); + } } } diff --git a/_css/bourbon/functions/_assign.scss b/_css/bourbon/functions/_assign.scss new file mode 100644 index 00000000..9a1db93e --- /dev/null +++ b/_css/bourbon/functions/_assign.scss @@ -0,0 +1,11 @@ +@function assign-inputs($inputs, $pseudo: null) { + $list : (); + + @each $input in $inputs { + $input: unquote($input); + $input: if($pseudo, $input + ":" + $pseudo, $input); + $list: append($list, $input, comma); + } + + @return $list; +} \ No newline at end of file diff --git a/_css/bourbon/functions/_color-lightness.scss b/_css/bourbon/functions/_color-lightness.scss new file mode 100644 index 00000000..8c6df4e2 --- /dev/null +++ b/_css/bourbon/functions/_color-lightness.scss @@ -0,0 +1,13 @@ +// Programatically determines whether a color is light or dark +// Returns a boolean +// More details here http://robots.thoughtbot.com/closer-look-color-lightness + +@function is-light($hex-color) { + $-local-red: red(rgba($hex-color, 1.0)); + $-local-green: green(rgba($hex-color, 1.0)); + $-local-blue: blue(rgba($hex-color, 1.0)); + + $-local-lightness: ($-local-red * 0.2126 + $-local-green * 0.7152 + $-local-blue * 0.0722) / 255; + + @return $-local-lightness > .6; +} diff --git a/_css/bourbon/functions/_compact.scss b/_css/bourbon/functions/_compact.scss deleted file mode 100644 index 871500e3..00000000 --- a/_css/bourbon/functions/_compact.scss +++ /dev/null @@ -1,11 +0,0 @@ -// Remove `false` values from a list - -@function compact($vars...) { - $list: (); - @each $var in $vars { - @if $var { - $list: append($list, $var, comma); - } - } - @return $list; -} diff --git a/_css/bourbon/functions/_golden-ratio.scss b/_css/bourbon/functions/_golden-ratio.scss new file mode 100644 index 00000000..463d14a0 --- /dev/null +++ b/_css/bourbon/functions/_golden-ratio.scss @@ -0,0 +1,3 @@ +@function golden-ratio($value, $increment) { + @return modular-scale($value, $increment, $golden) +} diff --git a/_css/bourbon/functions/_linear-gradient.scss b/_css/bourbon/functions/_linear-gradient.scss deleted file mode 100644 index c8454d83..00000000 --- a/_css/bourbon/functions/_linear-gradient.scss +++ /dev/null @@ -1,13 +0,0 @@ -@function linear-gradient($pos, $gradients...) { - $type: linear; - $pos-type: type-of(nth($pos, 1)); - - // if $pos doesn't exist, fix $gradient - @if ($pos-type == color) or (nth($pos, 1) == "transparent") { - $gradients: zip($pos $gradients); - $pos: false; - } - - $type-gradient: $type, $pos, $gradients; - @return $type-gradient; -} diff --git a/_css/bourbon/functions/_modular-scale.scss b/_css/bourbon/functions/_modular-scale.scss index dddccb52..afc59eb9 100644 --- a/_css/bourbon/functions/_modular-scale.scss +++ b/_css/bourbon/functions/_modular-scale.scss @@ -1,40 +1,66 @@ +// Scaling Variables +$golden: 1.618; +$minor-second: 1.067; +$major-second: 1.125; +$minor-third: 1.2; +$major-third: 1.25; +$perfect-fourth: 1.333; +$augmented-fourth: 1.414; +$perfect-fifth: 1.5; +$minor-sixth: 1.6; +$major-sixth: 1.667; +$minor-seventh: 1.778; +$major-seventh: 1.875; +$octave: 2; +$major-tenth: 2.5; +$major-eleventh: 2.667; +$major-twelfth: 3; +$double-octave: 4; + @function modular-scale($value, $increment, $ratio) { + $v1: nth($value, 1); + $v2: nth($value, length($value)); + $value: $v1; + + // scale $v2 to just above $v1 + @while $v2 > $v1 { + $v2: ($v2 / $ratio); // will be off-by-1 + } + @while $v2 < $v1 { + $v2: ($v2 * $ratio); // will fix off-by-1 + } + + // check AFTER scaling $v2 to prevent double-counting corner-case + $double-stranded: $v2 > $v1; + @if $increment > 0 { @for $i from 1 through $increment { - $value: ($value * $ratio); + @if $double-stranded and ($v1 * $ratio) > $v2 { + $value: $v2; + $v2: ($v2 * $ratio); + } @else { + $v1: ($v1 * $ratio); + $value: $v1; + } } } @if $increment < 0 { - $increment: abs($increment); - @for $i from 1 through $increment { - $value: ($value / $ratio); + // adjust $v2 to just below $v1 + @if $double-stranded { + $v2: ($v2 / $ratio); + } + + @for $i from $increment through -1 { + @if $double-stranded and ($v1 / $ratio) < $v2 { + $value: $v2; + $v2: ($v2 / $ratio); + } @else { + $v1: ($v1 / $ratio); + $value: $v1; + } } } @return $value; } - -// div { -// Increment Up GR with positive value -// font-size: modular-scale(14px, 1, 1.618); // returns: 22.652px -// -// Increment Down GR with negative value -// font-size: modular-scale(14px, -1, 1.618); // returns: 8.653px -// -// Can be used with ceil(round up) or floor(round down) -// font-size: floor( modular-scale(14px, 1, 1.618) ); // returns: 22px -// font-size: ceil( modular-scale(14px, 1, 1.618) ); // returns: 23px -// } -// -// modularscale.com - -@function golden-ratio($value, $increment) { - @return modular-scale($value, $increment, 1.618) -} - -// div { -// font-size: golden-ratio(14px, 1); // returns: 22.652px -// } -// -// goldenratiocalculator.com diff --git a/_css/bourbon/functions/_px-to-em.scss b/_css/bourbon/functions/_px-to-em.scss index 2eb1031c..4832245e 100644 --- a/_css/bourbon/functions/_px-to-em.scss +++ b/_css/bourbon/functions/_px-to-em.scss @@ -2,7 +2,12 @@ // eg. for a relational value of 12px write em(12) when the parent is 16px // if the parent is another value say 24px write em(12, 24) -@function em($pxval, $base: 16) { +@function em($pxval, $base: $em-base) { + @if not unitless($pxval) { + $pxval: strip-units($pxval); + } + @if not unitless($base) { + $base: strip-units($base); + } @return ($pxval / $base) * 1em; } - diff --git a/_css/bourbon/functions/_px-to-rem.scss b/_css/bourbon/functions/_px-to-rem.scss new file mode 100644 index 00000000..96b244e4 --- /dev/null +++ b/_css/bourbon/functions/_px-to-rem.scss @@ -0,0 +1,15 @@ +// Convert pixels to rems +// eg. for a relational value of 12px write rem(12) +// Assumes $em-base is the font-size of + +@function rem($pxval) { + @if not unitless($pxval) { + $pxval: strip-units($pxval); + } + + $base: $em-base; + @if not unitless($base) { + $base: strip-units($base); + } + @return ($pxval / $base) * 1rem; +} diff --git a/_css/bourbon/functions/_radial-gradient.scss b/_css/bourbon/functions/_radial-gradient.scss deleted file mode 100644 index 75584060..00000000 --- a/_css/bourbon/functions/_radial-gradient.scss +++ /dev/null @@ -1,23 +0,0 @@ -// This function is required and used by the background-image mixin. -@function radial-gradient($G1, $G2, - $G3: false, $G4: false, - $G5: false, $G6: false, - $G7: false, $G8: false, - $G9: false, $G10: false, - $pos: null, - $shape-size: null) { - - $data: _radial-arg-parser($G1, $G2, $pos, $shape-size); - $G1: nth($data, 1); - $G2: nth($data, 2); - $pos: nth($data, 3); - $shape-size: nth($data, 4); - - $type: radial; - $gradient: compact($G1, $G2, $G3, $G4, $G5, $G6, $G7, $G8, $G9, $G10); - - $type-gradient: $type, $shape-size $pos, $gradient; - @return $type-gradient; -} - - diff --git a/_css/bourbon/functions/_strip-units.scss b/_css/bourbon/functions/_strip-units.scss new file mode 100644 index 00000000..6afc6e60 --- /dev/null +++ b/_css/bourbon/functions/_strip-units.scss @@ -0,0 +1,5 @@ +// Srtips the units from a value. e.g. 12px -> 12 + +@function strip-units($val) { + @return ($val / ($val * 0 + 1)); +} diff --git a/_css/bourbon/functions/_unpack.scss b/_css/bourbon/functions/_unpack.scss new file mode 100644 index 00000000..37759636 --- /dev/null +++ b/_css/bourbon/functions/_unpack.scss @@ -0,0 +1,17 @@ +// Convert shorthand to the 4-value syntax + +@function unpack($shorthand) { + @if length($shorthand) == 1 { + @return nth($shorthand, 1) nth($shorthand, 1) nth($shorthand, 1) nth($shorthand, 1); + } + @else if length($shorthand) == 2 { + @return nth($shorthand, 1) nth($shorthand, 2) nth($shorthand, 1) nth($shorthand, 2); + } + @else if length($shorthand) == 3 { + @return nth($shorthand, 1) nth($shorthand, 2) nth($shorthand, 3) nth($shorthand, 2); + } + @else { + @return $shorthand; + } +} + diff --git a/_css/bourbon/helpers/_convert-units.scss b/_css/bourbon/helpers/_convert-units.scss new file mode 100644 index 00000000..3443db39 --- /dev/null +++ b/_css/bourbon/helpers/_convert-units.scss @@ -0,0 +1,15 @@ +//************************************************************************// +// Helper function for str-to-num fn. +// Source: http://sassmeister.com/gist/9647408 +//************************************************************************// +@function _convert-units($number, $unit) { + $strings: 'px' 'cm' 'mm' '%' 'ch' 'pica' 'in' 'em' 'rem' 'pt' 'pc' 'ex' 'vw' 'vh' 'vmin' 'vmax', 'deg', 'rad', 'grad', 'turn'; + $units: 1px 1cm 1mm 1% 1ch 1pica 1in 1em 1rem 1pt 1pc 1ex 1vw 1vh 1vmin 1vmax, 1deg, 1rad, 1grad, 1turn; + $index: index($strings, $unit); + + @if not $index { + @warn "Unknown unit `#{$unit}`."; + @return false; + } + @return $number * nth($units, $index); +} diff --git a/_css/bourbon/helpers/_deprecated-webkit-gradient.scss b/_css/bourbon/helpers/_deprecated-webkit-gradient.scss deleted file mode 100644 index cd17e283..00000000 --- a/_css/bourbon/helpers/_deprecated-webkit-gradient.scss +++ /dev/null @@ -1,39 +0,0 @@ -// Render Deprecated Webkit Gradient - Linear || Radial -//************************************************************************// -@function _deprecated-webkit-gradient($type, - $deprecated-pos1, $deprecated-pos2, - $full, - $deprecated-radius1: false, $deprecated-radius2: false) { - $gradient-list: (); - $gradient: false; - $full-length: length($full); - $percentage: false; - $gradient-type: $type; - - @for $i from 1 through $full-length { - $gradient: nth($full, $i); - - @if length($gradient) == 2 { - $color-stop: color-stop(nth($gradient, 2), nth($gradient, 1)); - $gradient-list: join($gradient-list, $color-stop, comma); - } - @else if $gradient != null { - @if $i == $full-length { - $percentage: 100%; - } - @else { - $percentage: ($i - 1) * (100 / ($full-length - 1)) + "%"; - } - $color-stop: color-stop(unquote($percentage), $gradient); - $gradient-list: join($gradient-list, $color-stop, comma); - } - } - - @if $type == radial { - $gradient: -webkit-gradient(radial, $deprecated-pos1, $deprecated-radius1, $deprecated-pos2, $deprecated-radius2, $gradient-list); - } - @else if $type == linear { - $gradient: -webkit-gradient(linear, $deprecated-pos1, $deprecated-pos2, $gradient-list); - } - @return $gradient; -} diff --git a/_css/bourbon/helpers/_is-num.scss b/_css/bourbon/helpers/_is-num.scss new file mode 100644 index 00000000..71459e14 --- /dev/null +++ b/_css/bourbon/helpers/_is-num.scss @@ -0,0 +1,8 @@ +//************************************************************************// +// Helper for linear-gradient-parser +//************************************************************************// +@function _is-num($char) { + $values: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9' 0 1 2 3 4 5 6 7 8 9; + $index: index($values, $char); + @return if($index, true, false); +} diff --git a/_css/bourbon/helpers/_linear-angle-parser.scss b/_css/bourbon/helpers/_linear-angle-parser.scss new file mode 100644 index 00000000..e0401ed8 --- /dev/null +++ b/_css/bourbon/helpers/_linear-angle-parser.scss @@ -0,0 +1,25 @@ +// Private function for linear-gradient-parser +@function _linear-angle-parser($image, $first-val, $prefix, $suffix) { + $offset: null; + $unit-short: str-slice($first-val, str-length($first-val) - 2, str-length($first-val)); + $unit-long: str-slice($first-val, str-length($first-val) - 3, str-length($first-val)); + + @if ($unit-long == "grad") or + ($unit-long == "turn") { + $offset: if($unit-long == "grad", -100grad * 3, -0.75turn); + } + + @else if ($unit-short == "deg") or + ($unit-short == "rad") { + $offset: if($unit-short == "deg", -90 * 3, 1.6rad); + } + + @if $offset { + $num: _str-to-num($first-val); + + @return ( + webkit-image: -webkit- + $prefix + ($offset - $num) + $suffix, + spec-image: $image + ); + } +} diff --git a/_css/bourbon/helpers/_linear-gradient-parser.scss b/_css/bourbon/helpers/_linear-gradient-parser.scss new file mode 100644 index 00000000..12bcdcda --- /dev/null +++ b/_css/bourbon/helpers/_linear-gradient-parser.scss @@ -0,0 +1,41 @@ +@function _linear-gradient-parser($image) { + $image: unquote($image); + $gradients: (); + $start: str-index($image, "("); + $end: str-index($image, ","); + $first-val: str-slice($image, $start + 1, $end - 1); + + $prefix: str-slice($image, 0, $start); + $suffix: str-slice($image, $end, str-length($image)); + + $has-multiple-vals: str-index($first-val, " "); + $has-single-position: unquote(_position-flipper($first-val) + ""); + $has-angle: _is-num(str-slice($first-val, 0, 0)); + + @if $has-multiple-vals { + $gradients: _linear-side-corner-parser($image, $first-val, $prefix, $suffix, $has-multiple-vals); + } + + @else if $has-single-position != "" { + $pos: unquote($has-single-position + ""); + + $gradients: ( + webkit-image: -webkit- + $image, + spec-image: $prefix + "to " + $pos + $suffix + ); + } + + @else if $has-angle { + // Rotate degree for webkit + $gradients: _linear-angle-parser($image, $first-val, $prefix, $suffix); + } + + @else { + $gradients: ( + webkit-image: -webkit- + $image, + spec-image: $image + ); + } + + @return $gradients; +} diff --git a/_css/bourbon/helpers/_linear-side-corner-parser.scss b/_css/bourbon/helpers/_linear-side-corner-parser.scss new file mode 100644 index 00000000..86ad88fb --- /dev/null +++ b/_css/bourbon/helpers/_linear-side-corner-parser.scss @@ -0,0 +1,31 @@ +// Private function for linear-gradient-parser +@function _linear-side-corner-parser($image, $first-val, $prefix, $suffix, $has-multiple-vals) { + $val-1: str-slice($first-val, 0, $has-multiple-vals - 1 ); + $val-2: str-slice($first-val, $has-multiple-vals + 1, str-length($first-val)); + $val-3: null; + $has-val-3: str-index($val-2, " "); + + @if $has-val-3 { + $val-3: str-slice($val-2, $has-val-3 + 1, str-length($val-2)); + $val-2: str-slice($val-2, 0, $has-val-3 - 1); + } + + $pos: _position-flipper($val-1) _position-flipper($val-2) _position-flipper($val-3); + $pos: unquote($pos + ""); + + // Use old spec for webkit + @if $val-1 == "to" { + @return ( + webkit-image: -webkit- + $prefix + $pos + $suffix, + spec-image: $image + ); + } + + // Bring the code up to spec + @else { + @return ( + webkit-image: -webkit- + $image, + spec-image: $prefix + "to " + $pos + $suffix + ); + } +} diff --git a/_css/bourbon/helpers/_radial-arg-parser.scss b/_css/bourbon/helpers/_radial-arg-parser.scss index 3466695b..a3a3704a 100644 --- a/_css/bourbon/helpers/_radial-arg-parser.scss +++ b/_css/bourbon/helpers/_radial-arg-parser.scss @@ -22,7 +22,7 @@ $pos: $pos nth($value, $i); } } - $G1: false; + $G1: null; } // If not spec calculate correct values @@ -38,7 +38,7 @@ $pos: $value; @if $pos == $G1 { - $G1: false; + $G1: null; } } @@ -55,11 +55,11 @@ $shape-size: $value; @if $value == $G1 { - $G1: false; + $G1: null; } @else if $value == $G2 { - $G2: false; + $G2: null; } } } diff --git a/_css/bourbon/helpers/_radial-gradient-parser.scss b/_css/bourbon/helpers/_radial-gradient-parser.scss new file mode 100644 index 00000000..6dde50f0 --- /dev/null +++ b/_css/bourbon/helpers/_radial-gradient-parser.scss @@ -0,0 +1,50 @@ +@function _radial-gradient-parser($image) { + $image: unquote($image); + $gradients: (); + $start: str-index($image, "("); + $end: str-index($image, ","); + $first-val: str-slice($image, $start + 1, $end - 1); + + $prefix: str-slice($image, 0, $start); + $suffix: str-slice($image, $end, str-length($image)); + + $is-spec-syntax: str-index($first-val, "at"); + + @if $is-spec-syntax and $is-spec-syntax > 1 { + $keyword: str-slice($first-val, 1, $is-spec-syntax - 2); + $pos: str-slice($first-val, $is-spec-syntax + 3, str-length($first-val)); + $pos: append($pos, $keyword, comma); + + $gradients: ( + webkit-image: -webkit- + $prefix + $pos + $suffix, + spec-image: $image + ) + } + + @else if $is-spec-syntax == 1 { + $pos: str-slice($first-val, $is-spec-syntax + 3, str-length($first-val)); + + $gradients: ( + webkit-image: -webkit- + $prefix + $pos + $suffix, + spec-image: $image + ) + } + + @else if str-index($image, "cover") or str-index($image, "contain") { + @warn "Radial-gradient needs to be updated to conform to latest spec."; + + $gradients: ( + webkit-image: null, + spec-image: $image + ) + } + + @else { + $gradients: ( + webkit-image: -webkit- + $image, + spec-image: $image + ) + } + + @return $gradients; +} diff --git a/_css/bourbon/helpers/_str-to-num.scss b/_css/bourbon/helpers/_str-to-num.scss new file mode 100644 index 00000000..b3d61682 --- /dev/null +++ b/_css/bourbon/helpers/_str-to-num.scss @@ -0,0 +1,50 @@ +//************************************************************************// +// Helper function for linear/radial-gradient-parsers. +// Source: http://sassmeister.com/gist/9647408 +//************************************************************************// +@function _str-to-num($string) { + // Matrices + $strings: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9'; + $numbers: 0 1 2 3 4 5 6 7 8 9; + + // Result + $result: 0; + $divider: 0; + $minus: false; + + // Looping through all characters + @for $i from 1 through str-length($string) { + $character: str-slice($string, $i, $i); + $index: index($strings, $character); + + @if $character == '-' { + $minus: true; + } + + @else if $character == '.' { + $divider: 1; + } + + @else { + @if not $index { + $result: if($minus, $result * -1, $result); + @return _convert-units($result, str-slice($string, $i)); + } + + $number: nth($numbers, $index); + + @if $divider == 0 { + $result: $result * 10; + } + + @else { + // Move the decimal dot to the left + $divider: $divider * 10; + $number: $number / $divider; + } + + $result: $result + $number; + } + } + @return if($minus, $result * -1, $result); +} diff --git a/_css/bourbon/settings/_asset-pipeline.scss b/_css/bourbon/settings/_asset-pipeline.scss new file mode 100644 index 00000000..d481a6af --- /dev/null +++ b/_css/bourbon/settings/_asset-pipeline.scss @@ -0,0 +1 @@ +$asset-pipeline: false !default; diff --git a/_css/bourbon/settings/_prefixer.scss b/_css/bourbon/settings/_prefixer.scss new file mode 100644 index 00000000..ecab49fb --- /dev/null +++ b/_css/bourbon/settings/_prefixer.scss @@ -0,0 +1,6 @@ +// Variable settings for /addons/prefixer.scss +$prefix-for-webkit: true !default; +$prefix-for-mozilla: true !default; +$prefix-for-microsoft: true !default; +$prefix-for-opera: true !default; +$prefix-for-spec: true !default; // required for keyframe mixin diff --git a/_css/bourbon/settings/_px-to-em.scss b/_css/bourbon/settings/_px-to-em.scss new file mode 100644 index 00000000..f2f9a3e8 --- /dev/null +++ b/_css/bourbon/settings/_px-to-em.scss @@ -0,0 +1 @@ +$em-base: 16px !default;