diff --git a/CHANGELOG.md b/CHANGELOG.md index f8dd73d..ba32148 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 1.2.4 + +- Update Bourbon to [v4.0.2](https://github.com/thoughtbot/bourbon/releases/tag/v4.0.2) + # 1.2.3 - The [position mixin](http://bourbon.io/docs/#position) now accepts `null`. Ex: `@include position(relative, 0px null null 100px);` diff --git a/assets/stylesheets/_bourbon-deprecated-upcoming.scss b/assets/stylesheets/_bourbon-deprecated-upcoming.scss index 5332496..535eb61 100644 --- a/assets/stylesheets/_bourbon-deprecated-upcoming.scss +++ b/assets/stylesheets/_bourbon-deprecated-upcoming.scss @@ -1,13 +1,402 @@ -//************************************************************************// -// 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"; +// The following features have been deprecated and will be removed in the next MAJOR version release + +@mixin inline-block { + display: inline-block; + + @warn "The inline-block mixin is deprecated and will be removed in the next major version release"; +} + +@mixin button ($style: simple, $base-color: #4294f0, $text-size: inherit, $padding: 7px 18px) { + + @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); + } + + @if type-of($style) == color and type-of($base-color) == number { + $padding: $text-size; + $text-size: $base-color; + $base-color: $style; + $style: simple; + + @if $padding == inherit { + $padding: 7px 18px; + } + + @include buttonstyle($style, $base-color, $text-size, $padding); + } + + @if type-of($style) == number { + $padding: $base-color; + $text-size: $style; + $base-color: #4294f0; + $style: simple; + + @if $padding == #4294f0 { + $padding: 7px 18px; + } + + @include buttonstyle($style, $base-color, $text-size, $padding); + } + + &:disabled { + opacity: 0.5; + cursor: not-allowed; + } + + @warn "The button mixin is deprecated and will be removed in the next major version release"; +} + +// 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, $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 is-light($base-color) { + $color: hsl(0, 0, 20%); + $text-shadow: adjust-color($base-color, $saturation: 10%, $lightness: 4%); + } + + @if $grayscale == true { + $border: grayscale($border); + $inset-shadow: grayscale($inset-shadow); + $stop-gradient: grayscale($stop-gradient); + $text-shadow: grayscale($text-shadow); + } + + border: 1px solid $border; + border-radius: 3px; + box-shadow: inset 0 1px 0 0 $inset-shadow; + color: $color; + display: inline-block; + font-size: $textsize; + font-weight: bold; + @include linear-gradient ($base-color, $stop-gradient); + padding: $padding; + text-decoration: none; + text-shadow: 0 1px 0 $text-shadow; + background-clip: padding-box; + + &:hover:not(:disabled) { + $base-color-hover: adjust-color($base-color, $saturation: -4%, $lightness: -5%); + $inset-shadow-hover: adjust-color($base-color, $saturation: -7%, $lightness: 5%); + $stop-gradient-hover: adjust-color($base-color, $saturation: 8%, $lightness: -14%); + + @if $grayscale == true { + $base-color-hover: grayscale($base-color-hover); + $inset-shadow-hover: grayscale($inset-shadow-hover); + $stop-gradient-hover: grayscale($stop-gradient-hover); + } + + box-shadow: inset 0 1px 0 0 $inset-shadow-hover; + cursor: pointer; + @include linear-gradient ($base-color-hover, $stop-gradient-hover); + } + + &: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%); + + @if $grayscale == true { + $border-active: grayscale($border-active); + $inset-shadow-active: grayscale($inset-shadow-active); + } + + border: 1px solid $border-active; + 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, $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); + $fourth-stop: adjust-color($base-color, $red: -79, $green: -70, $blue: -46); + $inset-shadow: adjust-color($base-color, $red: 37, $green: 29, $blue: 12); + $second-stop: adjust-color($base-color, $red: -56, $green: -50, $blue: -33); + $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 is-light($base-color) { + $color: hsl(0, 0, 20%); + $text-shadow: adjust-color($base-color, $saturation: 10%, $lightness: 4%); + } + + @if $grayscale == true { + $border: grayscale($border); + $border-bottom: grayscale($border-bottom); + $fourth-stop: grayscale($fourth-stop); + $inset-shadow: grayscale($inset-shadow); + $second-stop: grayscale($second-stop); + $text-shadow: grayscale($text-shadow); + $third-stop: grayscale($third-stop); + } + + border: 1px solid $border; + border-bottom: 1px solid $border-bottom; + border-radius: 5px; + box-shadow: inset 0 1px 0 0 $inset-shadow; + color: $color; + display: inline-block; + font-size: $textsize; + font-weight: bold; + @include linear-gradient(top, $base-color 0%, $second-stop 50%, $third-stop 50%, $fourth-stop 100%); + padding: $padding; + text-align: center; + text-decoration: none; + text-shadow: 0 -1px 1px $text-shadow; + + &:hover:not(:disabled) { + $first-stop-hover: adjust-color($base-color, $red: -13, $green: -15, $blue: -18); + $second-stop-hover: adjust-color($base-color, $red: -66, $green: -62, $blue: -51); + $third-stop-hover: adjust-color($base-color, $red: -93, $green: -85, $blue: -66); + $fourth-stop-hover: adjust-color($base-color, $red: -86, $green: -80, $blue: -63); + + @if $grayscale == true { + $first-stop-hover: grayscale($first-stop-hover); + $second-stop-hover: grayscale($second-stop-hover); + $third-stop-hover: grayscale($third-stop-hover); + $fourth-stop-hover: grayscale($fourth-stop-hover); + } + + cursor: pointer; + @include linear-gradient(top, $first-stop-hover 0%, + $second-stop-hover 50%, + $third-stop-hover 50%, + $fourth-stop-hover 100%); + } + + &: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; + } +} + +// Pill Button +@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%); + $border-top: adjust-color($base-color, $hue: -1, $saturation: -30%, $lightness: -15%); + $inset-shadow: adjust-color($base-color, $hue: -1, $saturation: -1%, $lightness: 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 is-light($base-color) { + $color: hsl(0, 0, 20%); + $text-shadow: adjust-color($base-color, $saturation: 10%, $lightness: 4%); + } + + @if $grayscale == true { + $border-bottom: grayscale($border-bottom); + $border-sides: grayscale($border-sides); + $border-top: grayscale($border-top); + $inset-shadow: grayscale($inset-shadow); + $stop-gradient: grayscale($stop-gradient); + $text-shadow: grayscale($text-shadow); + } + + 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; + color: $color; + display: inline-block; + font-size: $textsize; + font-weight: normal; + line-height: 1; + @include linear-gradient ($base-color, $stop-gradient); + padding: $padding; + text-align: center; + text-decoration: none; + text-shadow: 0 -1px 1px $text-shadow; + background-clip: padding-box; + + &:hover:not(:disabled) { + $base-color-hover: adjust-color($base-color, $lightness: -4.5%); + $border-bottom: adjust-color($base-color, $hue: 8, $saturation: 13.5%, $lightness: -32%); + $border-sides: adjust-color($base-color, $hue: 4, $saturation: -2%, $lightness: -27%); + $border-top: adjust-color($base-color, $hue: -1, $saturation: -17%, $lightness: -21%); + $inset-shadow-hover: adjust-color($base-color, $saturation: -1%, $lightness: 3%); + $stop-gradient-hover: adjust-color($base-color, $hue: 8, $saturation: -4%, $lightness: -15.5%); + $text-shadow-hover: adjust-color($base-color, $hue: 5, $saturation: -5%, $lightness: -22%); + + @if $grayscale == true { + $base-color-hover: grayscale($base-color-hover); + $border-bottom: grayscale($border-bottom); + $border-sides: grayscale($border-sides); + $border-top: grayscale($border-top); + $inset-shadow-hover: grayscale($inset-shadow-hover); + $stop-gradient-hover: grayscale($stop-gradient-hover); + $text-shadow-hover: grayscale($text-shadow-hover); + } + + border: 1px solid $border-top; + border-color: $border-top $border-sides $border-bottom; + box-shadow: inset 0 1px 0 0 $inset-shadow-hover; + cursor: pointer; + @include linear-gradient ($base-color-hover, $stop-gradient-hover); + text-shadow: 0 -1px 1px $text-shadow-hover; + background-clip: padding-box; + } + + &: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%); + $inset-shadow-active: adjust-color($base-color, $hue: 9, $saturation: 2%, $lightness: -21.5%); + $text-shadow-active: adjust-color($base-color, $hue: 5, $saturation: -12%, $lightness: -21.5%); + + @if $grayscale == true { + $active-color: grayscale($active-color); + $border-active: grayscale($border-active); + $border-bottom-active: grayscale($border-bottom-active); + $inset-shadow-active: grayscale($inset-shadow-active); + $text-shadow-active: grayscale($text-shadow-active); + } + + 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; + 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: $textsize; + font-weight: bold; + padding: $padding; + 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; + } +} + +// Flexible grid +@function flex-grid($columns, $container-columns: $fg-max-columns) { + $width: $columns * $fg-column + ($columns - 1) * $fg-gutter; + $container-width: $container-columns * $fg-column + ($container-columns - 1) * $fg-gutter; + @return percentage($width / $container-width); + + @warn "The flex-grid function is deprecated and will be removed in the next major version release"; +} + +// Flexible gutter +@function flex-gutter($container-columns: $fg-max-columns, $gutter: $fg-gutter) { + $container-width: $container-columns * $fg-column + ($container-columns - 1) * $fg-gutter; + @return percentage($gutter / $container-width); + + @warn "The flex-gutter function is deprecated and will be removed in the next major version release"; +} + +@function grid-width($n) { + @return $n * $gw-column + ($n - 1) * $gw-gutter; + + @warn "The grid-width function is deprecated and will be removed in the next major version release"; +} + +@function golden-ratio($value, $increment) { + @return modular-scale($increment, $value, $ratio: $golden); + + @warn "The golden-ratio function is deprecated and will be removed in the next major version release. Please use the modular-scale function, instead."; } diff --git a/assets/stylesheets/_bourbon.scss b/assets/stylesheets/_bourbon.scss index 5120bc6..e1e6829 100644 --- a/assets/stylesheets/_bourbon.scss +++ b/assets/stylesheets/_bourbon.scss @@ -1,29 +1,41 @@ +/* Bourbon 4.0.2 + * http://bourbon.io + * Copyright 2011-2014 thoughtbot, inc. + * MIT License */ + // Settings @import "settings/prefixer"; @import "settings/px-to-em"; +@import "settings/asset-pipeline"; // Custom Helpers +@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/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/contains"; +@import "functions/is-length"; +@import "functions/is-size"; @import "functions/px-to-em"; @import "functions/px-to-rem"; -@import "functions/radial-gradient"; @import "functions/strip-units"; @import "functions/tint-shade"; @import "functions/transition-property-name"; @import "functions/unpack"; +@import "functions/modular-scale"; // CSS3 Mixins @import "css3/animation"; @@ -40,21 +52,21 @@ @import "css3/flex-box"; @import "css3/font-face"; @import "css3/font-feature-settings"; -@import "css3/hyphens"; @import "css3/hidpi-media-query"; +@import "css3/hyphens"; @import "css3/image-rendering"; -@import "css3/inline-block"; @import "css3/keyframes"; @import "css3/linear-gradient"; @import "css3/perspective"; +@import "css3/placeholder"; @import "css3/radial-gradient"; +@import "css3/selection"; +@import "css3/text-decoration"; @import "css3/transform"; @import "css3/transition"; @import "css3/user-select"; -@import "css3/placeholder"; // Addons & other mixins -@import "addons/button"; @import "addons/clearfix"; @import "addons/directional-values"; @import "addons/ellipsis"; diff --git a/assets/stylesheets/addons/_button.scss b/assets/stylesheets/addons/_button.scss deleted file mode 100644 index 14a89e4..0000000 --- a/assets/stylesheets/addons/_button.scss +++ /dev/null @@ -1,374 +0,0 @@ -@mixin button ($style: simple, $base-color: #4294f0, $text-size: inherit, $padding: 7px 18px) { - - @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); - } - - @if type-of($style) == color and type-of($base-color) == number { - $padding: $text-size; - $text-size: $base-color; - $base-color: $style; - $style: simple; - - @if $padding == inherit { - $padding: 7px 18px; - } - - @include buttonstyle($style, $base-color, $text-size, $padding); - } - - @if type-of($style) == number { - $padding: $base-color; - $text-size: $style; - $base-color: #4294f0; - $style: simple; - - @if $padding == #4294f0 { - $padding: 7px 18px; - } - - @include buttonstyle($style, $base-color, $text-size, $padding); - } - - &:disabled { - opacity: 0.5; - cursor: not-allowed; - } -} - - -// 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, $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 is-light($base-color) { - $color: hsl(0, 0, 20%); - $text-shadow: adjust-color($base-color, $saturation: 10%, $lightness: 4%); - } - - @if $grayscale == true { - $border: grayscale($border); - $inset-shadow: grayscale($inset-shadow); - $stop-gradient: grayscale($stop-gradient); - $text-shadow: grayscale($text-shadow); - } - - border: 1px solid $border; - border-radius: 3px; - box-shadow: inset 0 1px 0 0 $inset-shadow; - color: $color; - display: inline-block; - font-size: $textsize; - font-weight: bold; - @include linear-gradient ($base-color, $stop-gradient); - padding: $padding; - text-decoration: none; - text-shadow: 0 1px 0 $text-shadow; - background-clip: padding-box; - - &:hover:not(:disabled) { - $base-color-hover: adjust-color($base-color, $saturation: -4%, $lightness: -5%); - $inset-shadow-hover: adjust-color($base-color, $saturation: -7%, $lightness: 5%); - $stop-gradient-hover: adjust-color($base-color, $saturation: 8%, $lightness: -14%); - - @if $grayscale == true { - $base-color-hover: grayscale($base-color-hover); - $inset-shadow-hover: grayscale($inset-shadow-hover); - $stop-gradient-hover: grayscale($stop-gradient-hover); - } - - box-shadow: inset 0 1px 0 0 $inset-shadow-hover; - cursor: pointer; - @include linear-gradient ($base-color-hover, $stop-gradient-hover); - } - - &: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%); - - @if $grayscale == true { - $border-active: grayscale($border-active); - $inset-shadow-active: grayscale($inset-shadow-active); - } - - border: 1px solid $border-active; - 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, $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); - $fourth-stop: adjust-color($base-color, $red: -79, $green: -70, $blue: -46); - $inset-shadow: adjust-color($base-color, $red: 37, $green: 29, $blue: 12); - $second-stop: adjust-color($base-color, $red: -56, $green: -50, $blue: -33); - $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 is-light($base-color) { - $color: hsl(0, 0, 20%); - $text-shadow: adjust-color($base-color, $saturation: 10%, $lightness: 4%); - } - - @if $grayscale == true { - $border: grayscale($border); - $border-bottom: grayscale($border-bottom); - $fourth-stop: grayscale($fourth-stop); - $inset-shadow: grayscale($inset-shadow); - $second-stop: grayscale($second-stop); - $text-shadow: grayscale($text-shadow); - $third-stop: grayscale($third-stop); - } - - border: 1px solid $border; - border-bottom: 1px solid $border-bottom; - border-radius: 5px; - box-shadow: inset 0 1px 0 0 $inset-shadow; - color: $color; - display: inline-block; - font-size: $textsize; - font-weight: bold; - @include linear-gradient(top, $base-color 0%, $second-stop 50%, $third-stop 50%, $fourth-stop 100%); - padding: $padding; - text-align: center; - text-decoration: none; - text-shadow: 0 -1px 1px $text-shadow; - - &:hover:not(:disabled) { - $first-stop-hover: adjust-color($base-color, $red: -13, $green: -15, $blue: -18); - $second-stop-hover: adjust-color($base-color, $red: -66, $green: -62, $blue: -51); - $third-stop-hover: adjust-color($base-color, $red: -93, $green: -85, $blue: -66); - $fourth-stop-hover: adjust-color($base-color, $red: -86, $green: -80, $blue: -63); - - @if $grayscale == true { - $first-stop-hover: grayscale($first-stop-hover); - $second-stop-hover: grayscale($second-stop-hover); - $third-stop-hover: grayscale($third-stop-hover); - $fourth-stop-hover: grayscale($fourth-stop-hover); - } - - cursor: pointer; - @include linear-gradient(top, $first-stop-hover 0%, - $second-stop-hover 50%, - $third-stop-hover 50%, - $fourth-stop-hover 100%); - } - - &: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; - } -} - - -// Pill Button -//************************************************************************// -@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%); - $border-top: adjust-color($base-color, $hue: -1, $saturation: -30%, $lightness: -15%); - $inset-shadow: adjust-color($base-color, $hue: -1, $saturation: -1%, $lightness: 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 is-light($base-color) { - $color: hsl(0, 0, 20%); - $text-shadow: adjust-color($base-color, $saturation: 10%, $lightness: 4%); - } - - @if $grayscale == true { - $border-bottom: grayscale($border-bottom); - $border-sides: grayscale($border-sides); - $border-top: grayscale($border-top); - $inset-shadow: grayscale($inset-shadow); - $stop-gradient: grayscale($stop-gradient); - $text-shadow: grayscale($text-shadow); - } - - 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; - color: $color; - display: inline-block; - font-size: $textsize; - font-weight: normal; - line-height: 1; - @include linear-gradient ($base-color, $stop-gradient); - padding: $padding; - text-align: center; - text-decoration: none; - text-shadow: 0 -1px 1px $text-shadow; - background-clip: padding-box; - - &:hover:not(:disabled) { - $base-color-hover: adjust-color($base-color, $lightness: -4.5%); - $border-bottom: adjust-color($base-color, $hue: 8, $saturation: 13.5%, $lightness: -32%); - $border-sides: adjust-color($base-color, $hue: 4, $saturation: -2%, $lightness: -27%); - $border-top: adjust-color($base-color, $hue: -1, $saturation: -17%, $lightness: -21%); - $inset-shadow-hover: adjust-color($base-color, $saturation: -1%, $lightness: 3%); - $stop-gradient-hover: adjust-color($base-color, $hue: 8, $saturation: -4%, $lightness: -15.5%); - $text-shadow-hover: adjust-color($base-color, $hue: 5, $saturation: -5%, $lightness: -22%); - - @if $grayscale == true { - $base-color-hover: grayscale($base-color-hover); - $border-bottom: grayscale($border-bottom); - $border-sides: grayscale($border-sides); - $border-top: grayscale($border-top); - $inset-shadow-hover: grayscale($inset-shadow-hover); - $stop-gradient-hover: grayscale($stop-gradient-hover); - $text-shadow-hover: grayscale($text-shadow-hover); - } - - border: 1px solid $border-top; - border-color: $border-top $border-sides $border-bottom; - box-shadow: inset 0 1px 0 0 $inset-shadow-hover; - cursor: pointer; - @include linear-gradient ($base-color-hover, $stop-gradient-hover); - text-shadow: 0 -1px 1px $text-shadow-hover; - background-clip: padding-box; - } - - &: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%); - $inset-shadow-active: adjust-color($base-color, $hue: 9, $saturation: 2%, $lightness: -21.5%); - $text-shadow-active: adjust-color($base-color, $hue: 5, $saturation: -12%, $lightness: -21.5%); - - @if $grayscale == true { - $active-color: grayscale($active-color); - $border-active: grayscale($border-active); - $border-bottom-active: grayscale($border-bottom-active); - $inset-shadow-active: grayscale($inset-shadow-active); - $text-shadow-active: grayscale($text-shadow-active); - } - - 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; - 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/assets/stylesheets/addons/_clearfix.scss b/assets/stylesheets/addons/_clearfix.scss index 783cfbc..54223e4 100644 --- a/assets/stylesheets/addons/_clearfix.scss +++ b/assets/stylesheets/addons/_clearfix.scss @@ -1,23 +1,18 @@ -// Modern micro clearfix provides an easy way to contain floats without adding additional markup. +// The clearfix mixin provides an easy way to contain floats // // Example usage: -// -// // Contain all floats within .wrapper -// .wrapper { -// @include clearfix; -// .content, -// .sidebar { -// float : left; -// } -// } +// .wrapper { +// @include clearfix; +// } @mixin clearfix { - &:after { - content:""; - display:table; - clear:both; + &::after { + clear: both; + content: ""; + display: table; } } -// Acknowledgements -// Beat *that* clearfix: [Thierry Koblentz](http://www.css-101.org/articles/clearfix/latest-new-clearfix-so-far.php) +// Acknowledgements: +// Thierry Koblentz, cssmojo +// http://goo.gl/AQWvyH diff --git a/assets/stylesheets/addons/_ellipsis.scss b/assets/stylesheets/addons/_ellipsis.scss index a8ea2a4..b8a5271 100644 --- a/assets/stylesheets/addons/_ellipsis.scss +++ b/assets/stylesheets/addons/_ellipsis.scss @@ -4,4 +4,5 @@ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; + word-wrap: normal; } diff --git a/assets/stylesheets/addons/_hide-text.scss b/assets/stylesheets/addons/_hide-text.scss index fc79438..5e89dd6 100644 --- a/assets/stylesheets/addons/_hide-text.scss +++ b/assets/stylesheets/addons/_hide-text.scss @@ -1,7 +1,9 @@ -@mixin hide-text { +@mixin hide-text($height: 1em) { + height: $height; + line-height: 1.5; overflow: hidden; - &:before { + &::before { content: ""; display: block; width: 0; diff --git a/assets/stylesheets/addons/_html5-input-types.scss b/assets/stylesheets/addons/_html5-input-types.scss index 8428e4e..9e9324a 100644 --- a/assets/stylesheets/addons/_html5-input-types.scss +++ b/assets/stylesheets/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} @@ -65,37 +55,23 @@ $inputs-button-list: 'input[type="button"]', 'input[type="reset"]', 'input[type="submit"]'; -$unquoted-inputs-button-list: (); -@each $input-type in $inputs-button-list { - $unquoted-inputs-button-list: append($unquoted-inputs-button-list, unquote($input-type), comma); -} - -$all-button-inputs: $unquoted-inputs-button-list; - +// Bare inputs +//************************************************************************// +$all-button-inputs: assign-inputs($inputs-button-list); // Hover Pseudo-class //************************************************************************// -$all-button-inputs-hover: (); -@each $input-type in $unquoted-inputs-button-list { - $input-type-hover: $input-type + ":hover"; - $all-button-inputs-hover: append($all-button-inputs-hover, $input-type-hover, comma); -} +$all-button-inputs-hover: assign-inputs($inputs-button-list, hover); // Focus Pseudo-class //************************************************************************// -$all-button-inputs-focus: (); -@each $input-type in $unquoted-inputs-button-list { - $input-type-focus: $input-type + ":focus"; - $all-button-inputs-focus: append($all-button-inputs-focus, $input-type-focus, comma); -} +$all-button-inputs-focus: assign-inputs($inputs-button-list, focus); // Active Pseudo-class //************************************************************************// -$all-button-inputs-active: (); -@each $input-type in $unquoted-inputs-button-list { - $input-type-active: $input-type + ":active"; - $all-button-inputs-active: append($all-button-inputs-active, $input-type-active, comma); -} +$all-button-inputs-active: assign-inputs($inputs-button-list, active); + + // You must use interpolation on the variable: // #{$all-button-inputs} diff --git a/assets/stylesheets/addons/_prefixer.scss b/assets/stylesheets/addons/_prefixer.scss index bac1aed..c32f502 100644 --- a/assets/stylesheets/addons/_prefixer.scss +++ b/assets/stylesheets/addons/_prefixer.scss @@ -37,9 +37,9 @@ } @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/assets/stylesheets/addons/_retina-image.scss b/assets/stylesheets/addons/_retina-image.scss index 7931bd1..3995c19 100644 --- a/assets/stylesheets/addons/_retina-image.scss +++ b/assets/stylesheets/addons/_retina-image.scss @@ -1,4 +1,4 @@ -@mixin retina-image($filename, $background-size, $extension: png, $retina-filename: null, $retina-suffix: _2x, $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}"); } diff --git a/assets/stylesheets/addons/_size.scss b/assets/stylesheets/addons/_size.scss index 342e41b..0dd9e30 100644 --- a/assets/stylesheets/addons/_size.scss +++ b/assets/stylesheets/addons/_size.scss @@ -1,44 +1,26 @@ -@mixin size($size) { - @if length($size) == 1 { - @if $size == auto { - width: $size; - height: $size; - } +// Set `width` and `height` in a single statement - @else if unitless($size) { - width: $size + px; - height: $size + px; - } +@mixin size($value) { + $width: nth($value, 1); + $height: $width; - @else if not(unitless($size)) { - width: $size; - height: $size; - } + @if length($value) > 1 { + $height: nth($value, 2); } - // Width x Height - @if length($size) == 2 { - $width: nth($size, 1); - $height: nth($size, 2); + @if is-size($height) { + height: $height; + } + + @else { + @warn "`#{$height}` is not a valid length for the `$height` parameter in the `size` mixin."; + } - @if $width == auto { - width: $width; - } - @else if not(unitless($width)) { - width: $width; - } - @else if unitless($width) { - width: $width + px; - } + @if is-size($width) { + width: $width; + } - @if $height == auto { - height: $height; - } - @else if not(unitless($height)) { - height: $height; - } - @else if unitless($height) { - height: $height + px; - } + @else { + @warn "`#{$width}` is not a valid length for the `$width` parameter in the `size` mixin."; } } diff --git a/assets/stylesheets/addons/_timing-functions.scss b/assets/stylesheets/addons/_timing-functions.scss index 51b2410..5ecc6f9 100644 --- a/assets/stylesheets/addons/_timing-functions.scss +++ b/assets/stylesheets/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/assets/stylesheets/addons/_triangle.scss b/assets/stylesheets/addons/_triangle.scss index 3b29e2c..573954e 100644 --- a/assets/stylesheets/addons/_triangle.scss +++ b/assets/stylesheets/addons/_triangle.scss @@ -6,10 +6,7 @@ $height: nth($size, length($size)); $foreground-color: nth($color, 1); - $background-color: transparent !default; - @if (length($color) == 2) { - $background-color: nth($color, 2); - } + $background-color: if(length($color) == 2, nth($color, 2), transparent); @if ($direction == up) or ($direction == down) or ($direction == right) or ($direction == left) { diff --git a/assets/stylesheets/css3/_background-image.scss b/assets/stylesheets/css3/_background-image.scss index 17016b9..6abe88b 100644 --- a/assets/stylesheets/css3/_background-image.scss +++ b/assets/stylesheets/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/assets/stylesheets/css3/_background.scss b/assets/stylesheets/css3/_background.scss index 975f0a6..4f32c70 100644 --- a/assets/stylesheets/css3/_background.scss +++ b/assets/stylesheets/css3/_background.scss @@ -3,101 +3,53 @@ // notation. //************************************************************************// -@mixin background( - $background-1 , $background-2: null, - $background-3: null, $background-4: null, - $background-5: null, $background-6: null, - $background-7: null, $background-8: null, - $background-9: null, $background-10: null, - $fallback: null -) { - $backgrounds: $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 $background-type == 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/assets/stylesheets/css3/_border-image.scss b/assets/stylesheets/css3/_border-image.scss index e552ee4..e338c2d 100644 --- a/assets/stylesheets/css3/_border-image.scss +++ b/assets/stylesheets/css3/_border-image.scss @@ -1,49 +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); - border-style: solid; -} +@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: @@ -53,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/assets/stylesheets/css3/_border-radius.scss b/assets/stylesheets/css3/_border-radius.scss index 7c17190..1f5832b 100644 --- a/assets/stylesheets/css3/_border-radius.scss +++ b/assets/stylesheets/css3/_border-radius.scss @@ -1,22 +1,22 @@ -//************************************************************************// -// Shorthand Border-radius mixins -//************************************************************************// +// Border Radius (Shorthand) +// Provides a shorthand syntax to target and add border radii to both corners on one side of a box + @mixin border-top-radius($radii) { - @include prefixer(border-top-left-radius, $radii, spec); - @include prefixer(border-top-right-radius, $radii, spec); + border-top-left-radius: $radii; + border-top-right-radius: $radii; } -@mixin border-bottom-radius($radii) { - @include prefixer(border-bottom-left-radius, $radii, spec); - @include prefixer(border-bottom-right-radius, $radii, spec); +@mixin border-right-radius($radii) { + border-bottom-right-radius: $radii; + border-top-right-radius: $radii; } -@mixin border-left-radius($radii) { - @include prefixer(border-top-left-radius, $radii, spec); - @include prefixer(border-bottom-left-radius, $radii, spec); +@mixin border-bottom-radius($radii) { + border-bottom-left-radius: $radii; + border-bottom-right-radius: $radii; } -@mixin border-right-radius($radii) { - @include prefixer(border-top-right-radius, $radii, spec); - @include prefixer(border-bottom-right-radius, $radii, spec); +@mixin border-left-radius($radii) { + border-bottom-left-radius: $radii; + border-top-left-radius: $radii; } diff --git a/assets/stylesheets/css3/_flex-box.scss b/assets/stylesheets/css3/_flex-box.scss index b48476e..2157dd7 100644 --- a/assets/stylesheets/css3/_flex-box.scss +++ b/assets/stylesheets/css3/_flex-box.scss @@ -64,34 +64,34 @@ // 2011 - display (flexbox | inline-flexbox) // 2012 - display (flex | inline-flex) @mixin display($value) { -// flex | inline-flex - @if $value == "flex" { - // 2009 - display: -webkit-box; - display: -moz-box; - display: box; - - // 2012 - display: -webkit-flex; - display: -moz-flex; - display: -ms-flexbox; // 2011 (IE 10) - display: flex; - } - - @elseif $value == "inline-flex" { - display: -webkit-inline-box; - display: -moz-inline-box; - display: inline-box; - - display: -webkit-inline-flex; - display: -moz-inline-flex; - display: -ms-inline-flexbox; - display: inline-flex; - } - - @else { - display: $value; - } +// flex | inline-flex + @if $value == "flex" { + // 2009 + display: -webkit-box; + display: -moz-box; + display: box; + + // 2012 + display: -webkit-flex; + display: -moz-flex; + display: -ms-flexbox; // 2011 (IE 10) + display: flex; + } + + @elseif $value == "inline-flex" { + display: -webkit-inline-box; + display: -moz-inline-box; + display: inline-box; + + display: -webkit-inline-flex; + display: -moz-inline-flex; + display: -ms-inline-flexbox; + display: inline-flex; + } + + @else { + display: $value; + } } // 2009 - box-flex (integer) @@ -99,56 +99,56 @@ // 2012 - flex (integer integer width) @mixin flex($value) { - // Grab flex-grow for older browsers. - $flex-grow: nth($value, 1); + // Grab flex-grow for older browsers. + $flex-grow: nth($value, 1); - // 2009 - @include prefixer(box-flex, $flex-grow, webkit moz spec); + // 2009 + @include prefixer(box-flex, $flex-grow, webkit moz spec); - // 2011 (IE 10), 2012 - @include prefixer(flex, $value, webkit moz ms spec); + // 2011 (IE 10), 2012 + @include prefixer(flex, $value, webkit moz ms spec); } // 2009 - box-orient ( horizontal | vertical | inline-axis | block-axis) -// - box-direction (normal | reverse) +// - box-direction (normal | reverse) // 2011 - flex-direction (row | row-reverse | column | column-reverse) // 2012 - flex-direction (row | row-reverse | column | column-reverse) @mixin flex-direction($value: row) { - // Alt values. - $value-2009: $value; - $value-2011: $value; - $direction: "normal"; + // Alt values. + $value-2009: $value; + $value-2011: $value; + $direction: "normal"; - @if $value == row { - $value-2009: horizontal; - } + @if $value == row { + $value-2009: horizontal; + } - @elseif $value == "row-reverse" { - $value-2009: horizontal; - $direction: reverse; - } + @elseif $value == "row-reverse" { + $value-2009: horizontal; + $direction: reverse; + } - @elseif $value == column { - $value-2009: vertical; - } + @elseif $value == column { + $value-2009: vertical; + } - @elseif $value == "column-reverse" { - $value-2009: vertical; - $direction: reverse; - } + @elseif $value == "column-reverse" { + $value-2009: vertical; + $direction: reverse; + } - // 2009 - @include prefixer(box-orient, $value-2009, webkit moz spec); - @if $direction == "reverse" { - @include prefixer(box-direction, $direction, webkit moz spec); - } + // 2009 + @include prefixer(box-orient, $value-2009, webkit moz spec); + @if $direction == "reverse" { + @include prefixer(box-direction, $direction, webkit moz spec); + } - // 2012 - @include prefixer(flex-direction, $value, webkit moz spec); + // 2012 + @include prefixer(flex-direction, $value, webkit moz spec); - // 2011 (IE 10) - -ms-flex-direction: $value; + // 2011 (IE 10) + -ms-flex-direction: $value; } // 2009 - box-lines (single | multiple) @@ -156,94 +156,94 @@ // 2012 - flex-wrap (nowrap | wrap | wrap-reverse) @mixin flex-wrap($value: nowrap) { - // Alt values. - $alt-value: $value; - @if $value == nowrap { - $alt-value: single; - } + // Alt values + $alt-value: $value; + @if $value == nowrap { + $alt-value: single; + } - @elseif $value == wrap { - $alt-value: multiple; - } + @elseif $value == wrap { + $alt-value: multiple; + } - @elseif $value == "wrap-reverse" { - $alt-value: multiple; - } + @elseif $value == "wrap-reverse" { + $alt-value: multiple; + } - @include prefixer(box-lines, $alt-value, webkit moz spec); - @include prefixer(flex-wrap, $value, webkit moz ms spec); + @include prefixer(box-lines, $alt-value, webkit moz spec); + @include prefixer(flex-wrap, $value, webkit moz ms spec); } // 2009 - TODO: parse values into flex-direction/flex-wrap // 2011 - TODO: parse values into flex-direction/flex-wrap // 2012 - flex-flow (flex-direction || flex-wrap) @mixin flex-flow($value) { - @include prefixer(flex-flow, $value, webkit moz spec); + @include prefixer(flex-flow, $value, webkit moz spec); } // 2009 - box-ordinal-group (integer) // 2011 - flex-order (integer) // 2012 - order (integer) @mixin order($int: 0) { - // 2009 - @include prefixer(box-ordinal-group, $int, webkit moz spec); + // 2009 + @include prefixer(box-ordinal-group, $int, webkit moz spec); - // 2012 - @include prefixer(order, $int, webkit moz spec); + // 2012 + @include prefixer(order, $int, webkit moz spec); - // 2011 (IE 10) - -ms-flex-order: $int; + // 2011 (IE 10) + -ms-flex-order: $int; } // 2012 - flex-grow (number) @mixin flex-grow($number: 0) { - @include prefixer(flex-grow, $number, webkit moz spec); - -ms-flex-positive: $number; + @include prefixer(flex-grow, $number, webkit moz spec); + -ms-flex-positive: $number; } // 2012 - flex-shrink (number) @mixin flex-shrink($number: 1) { - @include prefixer(flex-shrink, $number, webkit moz spec); - -ms-flex-negative: $number; + @include prefixer(flex-shrink, $number, webkit moz spec); + -ms-flex-negative: $number; } // 2012 - flex-basis (number) @mixin flex-basis($width: auto) { - @include prefixer(flex-basis, $width, webkit moz spec); - -ms-flex-preferred-size: $width; + @include prefixer(flex-basis, $width, webkit moz spec); + -ms-flex-preferred-size: $width; } // 2009 - box-pack (start | end | center | justify) // 2011 - flex-pack (start | end | center | justify) // 2012 - justify-content (flex-start | flex-end | center | space-between | space-around) -@mixin justify-content ($value: flex-start) { +@mixin justify-content($value: flex-start) { - // Alt values. - $alt-value: $value; - @if $value == "flex-start" { - $alt-value: start; - } + // Alt values. + $alt-value: $value; + @if $value == "flex-start" { + $alt-value: start; + } - @elseif $value == "flex-end" { - $alt-value: end; - } + @elseif $value == "flex-end" { + $alt-value: end; + } - @elseif $value == "space-between" { - $alt-value: justify; - } + @elseif $value == "space-between" { + $alt-value: justify; + } - @elseif $value == "space-around" { - $alt-value: center; - } + @elseif $value == "space-around" { + $alt-value: distribute; + } - // 2009 - @include prefixer(box-pack, $alt-value, webkit moz spec); + // 2009 + @include prefixer(box-pack, $alt-value, webkit moz spec); - // 2012 - @include prefixer(justify-content, $value, webkit moz ms o spec); + // 2012 + @include prefixer(justify-content, $value, webkit moz ms o spec); - // 2011 (IE 10) - -ms-flex-pack: $alt-value; + // 2011 (IE 10) + -ms-flex-pack: $alt-value; } // 2009 - box-align (start | end | center | baseline | stretch) @@ -251,71 +251,70 @@ // 2012 - align-items (flex-start | flex-end | center | baseline | stretch) @mixin align-items($value: stretch) { - $alt-value: $value; + $alt-value: $value; - @if $value == "flex-start" { - $alt-value: start; - } + @if $value == "flex-start" { + $alt-value: start; + } - @elseif $value == "flex-end" { - $alt-value: end; - } + @elseif $value == "flex-end" { + $alt-value: end; + } - // 2009 - @include prefixer(box-align, $alt-value, webkit moz spec); + // 2009 + @include prefixer(box-align, $alt-value, webkit moz spec); - // 2012 - @include prefixer(align-items, $value, webkit moz ms o spec); - - // 2011 (IE 10) - -ms-flex-align: $alt-value; + // 2012 + @include prefixer(align-items, $value, webkit moz ms o spec); + + // 2011 (IE 10) + -ms-flex-align: $alt-value; } // 2011 - flex-item-align (auto | start | end | center | baseline | stretch) // 2012 - align-self (auto | flex-start | flex-end | center | baseline | stretch) @mixin align-self($value: auto) { - $value-2011: $value; - @if $value == "flex-start" { - $value-2011: start; - } + $value-2011: $value; + @if $value == "flex-start" { + $value-2011: start; + } - @elseif $value == "flex-end" { - $value-2011: end; - } + @elseif $value == "flex-end" { + $value-2011: end; + } - // 2012 - @include prefixer(align-self, $value, webkit moz spec); + // 2012 + @include prefixer(align-self, $value, webkit moz spec); - // 2011 (IE 10) - -ms-flex-item-align: $value-2011; + // 2011 (IE 10) + -ms-flex-item-align: $value-2011; } // 2011 - flex-line-pack (start | end | center | justify | distribute | stretch) // 2012 - align-content (flex-start | flex-end | center | space-between | space-around | stretch) @mixin align-content($value: stretch) { - $value-2011: $value; - @if $value == "flex-start" { - $value-2011: start; - } + $value-2011: $value; + @if $value == "flex-start" { + $value-2011: start; + } - @elseif $value == "flex-end" { - $value-2011: end; - } + @elseif $value == "flex-end" { + $value-2011: end; + } - @elseif $value == "space-between" { - $value-2011: justify; - } + @elseif $value == "space-between" { + $value-2011: justify; + } - @elseif $value == "space-around" { - $value-2011: distribute; - } + @elseif $value == "space-around" { + $value-2011: distribute; + } - // 2012 - @include prefixer(align-content, $value, webkit moz spec); + // 2012 + @include prefixer(align-content, $value, webkit moz spec); - // 2011 (IE 10) - -ms-flex-line-pack: $value-2011; + // 2011 (IE 10) + -ms-flex-line-pack: $value-2011; } - diff --git a/assets/stylesheets/css3/_font-face.scss b/assets/stylesheets/css3/_font-face.scss index 029ee8f..e54c755 100644 --- a/assets/stylesheets/css3/_font-face.scss +++ b/assets/stylesheets/css3/_font-face.scss @@ -1,23 +1,30 @@ // Order of the includes matters, and it is: normal, bold, italic, bold+italic. -@mixin font-face($font-family, $file-path, $weight: normal, $style: normal, $asset-pipeline: false ) { +@mixin font-face( + $font-family, + $file-path, + $weight: normal, + $style: normal, + $asset-pipeline: $asset-pipeline, + $file-formats: eot woff ttf svg) { + + $font-url-prefix: font-url-prefixer($asset-pipeline); + @font-face { font-family: $font-family; font-weight: $weight; font-style: $style; - @if $asset-pipeline == true { - src: font-url('#{$file-path}.eot'); - src: font-url('#{$file-path}.eot?#iefix') format('embedded-opentype'), - font-url('#{$file-path}.woff') format('woff'), - font-url('#{$file-path}.ttf') format('truetype'), - font-url('#{$file-path}.svg##{$font-family}') format('svg'); - } @else { - src: url('#{$file-path}.eot'); - src: url('#{$file-path}.eot?#iefix') format('embedded-opentype'), - url('#{$file-path}.woff') format('woff'), - url('#{$file-path}.ttf') format('truetype'), - url('#{$file-path}.svg##{$font-family}') format('svg'); + @if contains($file-formats, eot) { + src: "#{$font-url-prefix}('#{$file-path}.eot') format('embedded-opentype')"; } + + src: font-source-declaration( + $font-family, + $file-path, + $asset-pipeline, + $file-formats, + $font-url-prefix + ); } } diff --git a/assets/stylesheets/css3/_hidpi-media-query.scss b/assets/stylesheets/css3/_hidpi-media-query.scss index 111e400..c2825ea 100644 --- a/assets/stylesheets/css3/_hidpi-media-query.scss +++ b/assets/stylesheets/css3/_hidpi-media-query.scss @@ -3,8 +3,8 @@ @media only screen and (-webkit-min-device-pixel-ratio: $ratio), only screen and (min--moz-device-pixel-ratio: $ratio), only screen and (-o-min-device-pixel-ratio: #{$ratio}/1), - only screen and (min-resolution: #{round($ratio*96)}dpi), - only screen and (min-resolution: #{$ratio}dppx) { + only screen and (min-resolution: round($ratio * 96dpi)), + only screen and (min-resolution: $ratio * 1dppx) { @content; } } diff --git a/assets/stylesheets/css3/_inline-block.scss b/assets/stylesheets/css3/_inline-block.scss deleted file mode 100644 index 3272a00..0000000 --- a/assets/stylesheets/css3/_inline-block.scss +++ /dev/null @@ -1,8 +0,0 @@ -// Legacy support for inline-block in IE7 (maybe IE6) -@mixin inline-block { - display: inline-block; - vertical-align: baseline; - zoom: 1; - *display: inline; - *vertical-align: auto; -} diff --git a/assets/stylesheets/css3/_keyframes.scss b/assets/stylesheets/css3/_keyframes.scss index cc12be7..e34616a 100644 --- a/assets/stylesheets/css3/_keyframes.scss +++ b/assets/stylesheets/css3/_keyframes.scss @@ -8,24 +8,24 @@ @if $original-prefix-for-webkit { @include disable-prefix-for-all(); - $prefix-for-webkit: true; + $prefix-for-webkit: true !global; @-webkit-keyframes #{$name} { @content; } } @if $original-prefix-for-mozilla { @include disable-prefix-for-all(); - $prefix-for-mozilla: true; + $prefix-for-mozilla: true !global; @-moz-keyframes #{$name} { @content; } } - $prefix-for-webkit: $original-prefix-for-webkit; - $prefix-for-mozilla: $original-prefix-for-mozilla; - $prefix-for-microsoft: $original-prefix-for-microsoft; - $prefix-for-opera: $original-prefix-for-opera; - $prefix-for-spec: $original-prefix-for-spec; + $prefix-for-webkit: $original-prefix-for-webkit !global; + $prefix-for-mozilla: $original-prefix-for-mozilla !global; + $prefix-for-microsoft: $original-prefix-for-microsoft !global; + $prefix-for-opera: $original-prefix-for-opera !global; + $prefix-for-spec: $original-prefix-for-spec !global; @if $original-prefix-for-spec { @keyframes #{$name} { diff --git a/assets/stylesheets/css3/_selection.scss b/assets/stylesheets/css3/_selection.scss new file mode 100644 index 0000000..c9447d1 --- /dev/null +++ b/assets/stylesheets/css3/_selection.scss @@ -0,0 +1,14 @@ +@mixin selection($for-parent: false) { + $before-colons: ""; + + @if $for-parent { + $before-colons: "&" + } + + #{$before-colons}::selection { + @content; + } + #{$before-colons}::-moz-selection { + @content; + } +} \ No newline at end of file diff --git a/assets/stylesheets/css3/_text-decoration.scss b/assets/stylesheets/css3/_text-decoration.scss new file mode 100644 index 0000000..9222746 --- /dev/null +++ b/assets/stylesheets/css3/_text-decoration.scss @@ -0,0 +1,19 @@ +@mixin text-decoration($value) { +// || || + @include prefixer(text-decoration, $value, moz); +} + +@mixin text-decoration-line($line: none) { +// none || underline || overline || line-through + @include prefixer(text-decoration-line, $line, moz); +} + +@mixin text-decoration-style($style: solid) { +// solid || double || dotted || dashed || wavy + @include prefixer(text-decoration-style, $style, moz webkit); +} + +@mixin text-decoration-color($color: currentColor) { +// currentColor || + @include prefixer(text-decoration-color, $color, moz); +} diff --git a/assets/stylesheets/functions/_assign.scss b/assets/stylesheets/functions/_assign.scss new file mode 100644 index 0000000..9a1db93 --- /dev/null +++ b/assets/stylesheets/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/assets/stylesheets/functions/_contains.scss b/assets/stylesheets/functions/_contains.scss new file mode 100644 index 0000000..557dedd --- /dev/null +++ b/assets/stylesheets/functions/_contains.scss @@ -0,0 +1,5 @@ +// Test a Sass list to see if it contains a defined value + +@function contains($list, $value) { + @return not not index($list, $value); +} diff --git a/assets/stylesheets/functions/_flex-grid.scss b/assets/stylesheets/functions/_flex-grid.scss deleted file mode 100644 index 3bbd866..0000000 --- a/assets/stylesheets/functions/_flex-grid.scss +++ /dev/null @@ -1,39 +0,0 @@ -// Flexible grid -@function flex-grid($columns, $container-columns: $fg-max-columns) { - $width: $columns * $fg-column + ($columns - 1) * $fg-gutter; - $container-width: $container-columns * $fg-column + ($container-columns - 1) * $fg-gutter; - @return percentage($width / $container-width); -} - -// Flexible gutter -@function flex-gutter($container-columns: $fg-max-columns, $gutter: $fg-gutter) { - $container-width: $container-columns * $fg-column + ($container-columns - 1) * $fg-gutter; - @return percentage($gutter / $container-width); -} - -// The $fg-column, $fg-gutter and $fg-max-columns variables must be defined in your base stylesheet to properly use the flex-grid function. -// This function takes the fluid grid equation (target / context = result) and uses columns to help define each. -// -// The calculation presumes that your column structure will be missing the last gutter: -// -// -- column -- gutter -- column -- gutter -- column -// -// $fg-column: 60px; // Column Width -// $fg-gutter: 25px; // Gutter Width -// $fg-max-columns: 12; // Total Columns For Main Container -// -// div { -// width: flex-grid(4); // returns (315px / 995px) = 31.65829%; -// margin-left: flex-gutter(); // returns (25px / 995px) = 2.51256%; -// -// p { -// width: flex-grid(2, 4); // returns (145px / 315px) = 46.031746%; -// float: left; -// margin: flex-gutter(4); // returns (25px / 315px) = 7.936508%; -// } -// -// blockquote { -// float: left; -// width: flex-grid(2, 4); // returns (145px / 315px) = 46.031746%; -// } -// } \ No newline at end of file diff --git a/assets/stylesheets/functions/_golden-ratio.scss b/assets/stylesheets/functions/_golden-ratio.scss deleted file mode 100644 index 463d14a..0000000 --- a/assets/stylesheets/functions/_golden-ratio.scss +++ /dev/null @@ -1,3 +0,0 @@ -@function golden-ratio($value, $increment) { - @return modular-scale($value, $increment, $golden) -} diff --git a/assets/stylesheets/functions/_grid-width.scss b/assets/stylesheets/functions/_grid-width.scss deleted file mode 100644 index 8e63d83..0000000 --- a/assets/stylesheets/functions/_grid-width.scss +++ /dev/null @@ -1,13 +0,0 @@ -@function grid-width($n) { - @return $n * $gw-column + ($n - 1) * $gw-gutter; -} - -// The $gw-column and $gw-gutter variables must be defined in your base stylesheet to properly use the grid-width function. -// -// $gw-column: 100px; // Column Width -// $gw-gutter: 40px; // Gutter Width -// -// div { -// width: grid-width(4); // returns 520px; -// margin-left: $gw-gutter; // returns 40px; -// } diff --git a/assets/stylesheets/functions/_is-length.scss b/assets/stylesheets/functions/_is-length.scss new file mode 100644 index 0000000..2e5f81d --- /dev/null +++ b/assets/stylesheets/functions/_is-length.scss @@ -0,0 +1,7 @@ +// Check for a valid length + +@function is-length($value) { + @return contains(0 "auto" "initial" "inherit", $value) + or type-of($value) == "number" and not unitless($value) + or str-slice($value + "", 1, 4) == "calc"; +} diff --git a/assets/stylesheets/functions/_is-size.scss b/assets/stylesheets/functions/_is-size.scss new file mode 100644 index 0000000..360a235 --- /dev/null +++ b/assets/stylesheets/functions/_is-size.scss @@ -0,0 +1,6 @@ +// Check for a valid size + +@function is-size($value) { + @return is-length($value) + or contains("fill" "fit-content" "min-content" "max-content", $value); +} diff --git a/assets/stylesheets/functions/_linear-gradient.scss b/assets/stylesheets/functions/_linear-gradient.scss deleted file mode 100644 index c8454d8..0000000 --- a/assets/stylesheets/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/assets/stylesheets/functions/_modular-scale.scss b/assets/stylesheets/functions/_modular-scale.scss index afc59eb..20fa388 100644 --- a/assets/stylesheets/functions/_modular-scale.scss +++ b/assets/stylesheets/functions/_modular-scale.scss @@ -17,7 +17,10 @@ $major-eleventh: 2.667; $major-twelfth: 3; $double-octave: 4; -@function modular-scale($value, $increment, $ratio) { +$modular-scale-ratio: $perfect-fourth !default; +$modular-scale-base: em($em-base) !default; + +@function modular-scale($increment, $value: $modular-scale-base, $ratio: $modular-scale-ratio) { $v1: nth($value, 1); $v2: nth($value, length($value)); $value: $v1; diff --git a/assets/stylesheets/functions/_radial-gradient.scss b/assets/stylesheets/functions/_radial-gradient.scss deleted file mode 100644 index 4466a9c..0000000 --- a/assets/stylesheets/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: null, $G4: null, - $G5: null, $G6: null, - $G7: null, $G8: null, - $G9: null, $G10: null, - $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: $G1, $G2, $G3, $G4, $G5, $G6, $G7, $G8, $G9, $G10; - - $type-gradient: $type, $shape-size $pos, $gradient; - @return $type-gradient; -} - - diff --git a/assets/stylesheets/helpers/_convert-units.scss b/assets/stylesheets/helpers/_convert-units.scss new file mode 100644 index 0000000..3443db3 --- /dev/null +++ b/assets/stylesheets/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/assets/stylesheets/helpers/_font-source-declaration.scss b/assets/stylesheets/helpers/_font-source-declaration.scss new file mode 100644 index 0000000..1cb9f66 --- /dev/null +++ b/assets/stylesheets/helpers/_font-source-declaration.scss @@ -0,0 +1,35 @@ +// Used for creating the source string for fonts using @font-face + +@function font-url-prefixer($asset-pipeline) { + @if $asset-pipeline == true { + @return font-url; + } @else { + @return url; + } +} + +@function font-source-declaration( + $font-family, + $file-path, + $asset-pipeline, + $file-formats, + $font-url) { + + $src: null; + + $formats-map: ( + eot: "#{$font-url}('#{$file-path}.eot?#iefix') format('embedded-opentype')", + woff2: "#{$font-url}('#{$file-path}.woff2') format('woff2')", + woff: "#{$font-url}('#{$file-path}.woff') format('woff')", + ttf: "#{$font-url}('#{$file-path}.ttf') format('ttf')", + svg: "#{$font-url}('#{$file-path}.svg##{$font-family}') format('svg')" + ); + + @each $format, $file-path in $formats-map { + @if contains($file-formats, $format) { + $src: append($src, $file-path, comma); + } + } + + @return $src; +} diff --git a/assets/stylesheets/helpers/_is-num.scss b/assets/stylesheets/helpers/_is-num.scss new file mode 100644 index 0000000..71459e1 --- /dev/null +++ b/assets/stylesheets/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/assets/stylesheets/helpers/_linear-angle-parser.scss b/assets/stylesheets/helpers/_linear-angle-parser.scss new file mode 100644 index 0000000..e0401ed --- /dev/null +++ b/assets/stylesheets/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/assets/stylesheets/helpers/_linear-gradient-parser.scss b/assets/stylesheets/helpers/_linear-gradient-parser.scss new file mode 100644 index 0000000..12bcdcd --- /dev/null +++ b/assets/stylesheets/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/assets/stylesheets/helpers/_linear-side-corner-parser.scss b/assets/stylesheets/helpers/_linear-side-corner-parser.scss new file mode 100644 index 0000000..86ad88f --- /dev/null +++ b/assets/stylesheets/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/assets/stylesheets/helpers/_radial-gradient-parser.scss b/assets/stylesheets/helpers/_radial-gradient-parser.scss new file mode 100644 index 0000000..6dde50f --- /dev/null +++ b/assets/stylesheets/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/assets/stylesheets/helpers/_str-to-num.scss b/assets/stylesheets/helpers/_str-to-num.scss new file mode 100644 index 0000000..b3d6168 --- /dev/null +++ b/assets/stylesheets/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/assets/stylesheets/settings/_asset-pipeline.scss b/assets/stylesheets/settings/_asset-pipeline.scss new file mode 100644 index 0000000..d481a6a --- /dev/null +++ b/assets/stylesheets/settings/_asset-pipeline.scss @@ -0,0 +1 @@ +$asset-pipeline: false !default; diff --git a/package.json b/package.json index bbd41c0..8968ff9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "node-bourbon", - "version": "1.2.3", + "version": "1.2.4", "description": "node-sass port of thoughtbot's Bourbon library", "main": "index.js", "scripts": {