diff --git a/dist/_bourbon-deprecated-upcoming.scss b/dist/_bourbon-deprecated-upcoming.scss index f946b3b45..5332496d8 100644 --- a/dist/_bourbon-deprecated-upcoming.scss +++ b/dist/_bourbon-deprecated-upcoming.scss @@ -2,7 +2,12 @@ // These mixins/functions are deprecated // They 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"; +@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"; } diff --git a/dist/_bourbon.scss b/dist/_bourbon.scss index 64cb6ea82..ef74cb96e 100644 --- a/dist/_bourbon.scss +++ b/dist/_bourbon.scss @@ -3,29 +3,23 @@ @import "settings/px-to-em"; // 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/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"; @@ -48,6 +42,7 @@ @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"; diff --git a/dist/addons/_html5-input-types.scss b/dist/addons/_html5-input-types.scss index 9e9324ae0..8428e4e19 100644 --- a/dist/addons/_html5-input-types.scss +++ b/dist/addons/_html5-input-types.scss @@ -20,19 +20,29 @@ $inputs-list: 'input[type="email"]', 'input[type="time"]', 'input[type="week"]'; -// Bare inputs -//************************************************************************// -$all-text-inputs: assign-inputs($inputs-list); +$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; + // Hover Pseudo-class //************************************************************************// -$all-text-inputs-hover: assign-inputs($inputs-list, hover); +$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); +} // Focus Pseudo-class //************************************************************************// -$all-text-inputs-focus: assign-inputs($inputs-list, focus); - - +$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); +} // You must use interpolation on the variable: // #{$all-text-inputs} @@ -55,23 +65,37 @@ $inputs-button-list: 'input[type="button"]', 'input[type="reset"]', 'input[type="submit"]'; -// Bare inputs -//************************************************************************// -$all-button-inputs: assign-inputs($inputs-button-list); +$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; + // Hover Pseudo-class //************************************************************************// -$all-button-inputs-hover: assign-inputs($inputs-button-list, hover); +$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); +} // Focus Pseudo-class //************************************************************************// -$all-button-inputs-focus: assign-inputs($inputs-button-list, focus); +$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); +} // Active Pseudo-class //************************************************************************// -$all-button-inputs-active: assign-inputs($inputs-button-list, active); - - +$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); +} // You must use interpolation on the variable: // #{$all-button-inputs} diff --git a/dist/addons/_position.scss b/dist/addons/_position.scss index 7de75182b..aba34edcd 100644 --- a/dist/addons/_position.scss +++ b/dist/addons/_position.scss @@ -1,4 +1,4 @@ -@mixin position ($position: relative, $coordinates: null null null null) { +@mixin position ($position: relative, $coordinates: 0 0 0 0) { @if type-of($position) == list { $coordinates: $position; @@ -14,19 +14,19 @@ position: $position; - @if ($top and $top == auto) or (type-of($top) == number) { + @if ($top and $top == auto) or (type-of($top) == number and not unitless($top)) { top: $top; } - @if ($right and $right == auto) or (type-of($right) == number) { + @if ($right and $right == auto) or (type-of($right) == number and not unitless($right)) { right: $right; } - @if ($bottom and $bottom == auto) or (type-of($bottom) == number) { + @if ($bottom and $bottom == auto) or (type-of($bottom) == number and not unitless($bottom)) { bottom: $bottom; } - @if ($left and $left == auto) or (type-of($left) == number) { + @if ($left and $left == auto) or (type-of($left) == number and not unitless($left)) { left: $left; } } diff --git a/dist/addons/_prefixer.scss b/dist/addons/_prefixer.scss index c32f50275..bac1aed2c 100644 --- a/dist/addons/_prefixer.scss +++ b/dist/addons/_prefixer.scss @@ -37,9 +37,9 @@ } @mixin disable-prefix-for-all() { - $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; + $prefix-for-webkit: false; + $prefix-for-mozilla: false; + $prefix-for-microsoft: false; + $prefix-for-opera: false; + $prefix-for-spec: false; } diff --git a/dist/addons/_size.scss b/dist/addons/_size.scss index ac705e26c..342e41b79 100644 --- a/dist/addons/_size.scss +++ b/dist/addons/_size.scss @@ -1,16 +1,44 @@ @mixin size($size) { - $height: nth($size, 1); - $width: $height; + @if length($size) == 1 { + @if $size == auto { + width: $size; + height: $size; + } - @if length($size) > 1 { - $height: nth($size, 2); - } + @else if unitless($size) { + width: $size + px; + height: $size + px; + } - @if $height == auto or (type-of($height) == number and not unitless($height)) { - height: $height; + @else if not(unitless($size)) { + width: $size; + height: $size; + } } - @if $width == auto or (type-of($height) == number and not unitless($width)) { - width: $width; + // Width x Height + @if length($size) == 2 { + $width: nth($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 { + height: $height; + } + @else if not(unitless($height)) { + height: $height; + } + @else if unitless($height) { + height: $height + px; + } } } diff --git a/dist/css3/_background-image.scss b/dist/css3/_background-image.scss index 6abe88be9..17016b91b 100644 --- a/dist/css3/_background-image.scss +++ b/dist/css3/_background-image.scss @@ -4,39 +4,45 @@ //************************************************************************// @mixin background-image($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); + background-image: _add-prefix($images, webkit); + background-image: _add-prefix($images); +} - @if $url-str == "url" { - $webkit-image: $image; - $spec-image: $image; +@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) } - - @else if $gradient-type == "linear" { - $gradients: _linear-gradient-parser($image); - $webkit-image: map-get($gradients, webkit-image); - $spec-image: map-get($gradients, spec-image); + @else { + $gradient-args: nth(nth($images, $i), 2); // Get actual gradient (red, blue) } - @else if $gradient-type == "radial" { - $gradients: _radial-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); } - - $webkit-images: append($webkit-images, $webkit-image, comma); - $spec-images: append($spec-images, $spec-image, comma); } - - background-image: $webkit-images; - background-image: $spec-images; + @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)); diff --git a/dist/css3/_background.scss b/dist/css3/_background.scss index 9bce9308b..975f0a6e5 100644 --- a/dist/css3/_background.scss +++ b/dist/css3/_background.scss @@ -3,53 +3,101 @@ // notation. //************************************************************************// -@mixin background($backgrounds...) { - $webkit-backgrounds: (); - $spec-backgrounds: (); +@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; - @each $background in $backgrounds { - $webkit-background: (); - $spec-background: (); - $background-type: type-of($background); - - @if $background-type == string or list { - $background-str: if($background-type == list, nth($background, 1), $background); + $fallback-color: false; + @if (type-of($fallback) == color) or ($fallback == "transparent") { + $fallback-color: $fallback; + } + @else { + $fallback-color: _extract-background-color($backgrounds); + } - $url-str: str-slice($background-str, 0, 3); - $gradient-type: str-slice($background-str, 0, 6); + @if $fallback-color { + background-color: $fallback-color; + } + background: _background-add-prefix($backgrounds, webkit); + background: _background-add-prefix($backgrounds); +} - @if $url-str == "url" { - $webkit-background: $background; - $spec-background: $background; +@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; +} - @else if $gradient-type == "linear" { - $gradients: _linear-gradient-parser("#{$background}"); - $webkit-background: map-get($gradients, webkit-image); - $spec-background: map-get($gradients, spec-image); - } +@function _background-add-prefix($backgrounds, $vendor: false) { + $backgrounds-prefixed: (); - @else if $gradient-type == "radial" { - $gradients: _radial-gradient-parser("#{$background}"); - $webkit-background: map-get($gradients, webkit-image); - $spec-background: map-get($gradients, spec-image); - } + @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 shorthand is a list (gradient) + @if $type == list { + $first-member: nth($shorthand, 1); // Get first member of shorthand + + // 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) + } + $gradient-positions: _gradient-positions-parser($gradient-type, $gradient-positions); + $gradient: _render-gradients($gradient-positions, $gradient-args, $gradient-type, $vendor); + + // 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); + } + // Image with additional properties @else { - $webkit-background: $background; - $spec-background: $background; + $backgrounds-prefixed: append($backgrounds-prefixed, $shorthand, comma); } } - - @else { - $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); } - - $webkit-backgrounds: append($webkit-backgrounds, $webkit-background, comma); - $spec-backgrounds: append($spec-backgrounds, $spec-background, comma); } - - background: $webkit-backgrounds; - background: $spec-backgrounds; + @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")); diff --git a/dist/css3/_border-image.scss b/dist/css3/_border-image.scss index e338c2dcd..e552ee442 100644 --- a/dist/css3/_border-image.scss +++ b/dist/css3/_border-image.scss @@ -1,53 +1,49 @@ -@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); - } +@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; +} - @else { - $webkit-border: $border; - $spec-border: $border; - } +@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); } - + // If input is a URL @else { - $webkit-border: $border; - $spec-border: $border; + $border-image: $images; } - - $webkit-borders: append($webkit-borders, $webkit-border, comma); - $spec-borders: append($spec-borders, $spec-border, comma); } - - -webkit-border-image: $webkit-borders; - border-image: $spec-borders; - border-style: solid; + // 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)); + } + } + } + @return $border-image; } //Examples: @@ -57,3 +53,4 @@ // @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/dist/css3/_inline-block.scss b/dist/css3/_inline-block.scss new file mode 100644 index 000000000..3272a0010 --- /dev/null +++ b/dist/css3/_inline-block.scss @@ -0,0 +1,8 @@ +// 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/dist/css3/_keyframes.scss b/dist/css3/_keyframes.scss index e34616af9..cc12be79b 100644 --- a/dist/css3/_keyframes.scss +++ b/dist/css3/_keyframes.scss @@ -8,24 +8,24 @@ @if $original-prefix-for-webkit { @include disable-prefix-for-all(); - $prefix-for-webkit: true !global; + $prefix-for-webkit: true; @-webkit-keyframes #{$name} { @content; } } @if $original-prefix-for-mozilla { @include disable-prefix-for-all(); - $prefix-for-mozilla: true !global; + $prefix-for-mozilla: true; @-moz-keyframes #{$name} { @content; } } - $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; + $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; @if $original-prefix-for-spec { @keyframes #{$name} { diff --git a/dist/functions/_assign.scss b/dist/functions/_assign.scss deleted file mode 100644 index 9a1db93ef..000000000 --- a/dist/functions/_assign.scss +++ /dev/null @@ -1,11 +0,0 @@ -@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/dist/functions/_linear-gradient.scss b/dist/functions/_linear-gradient.scss new file mode 100644 index 000000000..c8454d83f --- /dev/null +++ b/dist/functions/_linear-gradient.scss @@ -0,0 +1,13 @@ +@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/dist/functions/_radial-gradient.scss b/dist/functions/_radial-gradient.scss new file mode 100644 index 000000000..4466a9c9a --- /dev/null +++ b/dist/functions/_radial-gradient.scss @@ -0,0 +1,23 @@ +// 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/dist/helpers/_convert-units.scss b/dist/helpers/_convert-units.scss deleted file mode 100644 index 3443db397..000000000 --- a/dist/helpers/_convert-units.scss +++ /dev/null @@ -1,15 +0,0 @@ -//************************************************************************// -// 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/dist/helpers/_is-num.scss b/dist/helpers/_is-num.scss deleted file mode 100644 index 71459e140..000000000 --- a/dist/helpers/_is-num.scss +++ /dev/null @@ -1,8 +0,0 @@ -//************************************************************************// -// 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/dist/helpers/_linear-angle-parser.scss b/dist/helpers/_linear-angle-parser.scss deleted file mode 100644 index e0401ed8d..000000000 --- a/dist/helpers/_linear-angle-parser.scss +++ /dev/null @@ -1,25 +0,0 @@ -// 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/dist/helpers/_linear-gradient-parser.scss b/dist/helpers/_linear-gradient-parser.scss deleted file mode 100644 index 12bcdcda8..000000000 --- a/dist/helpers/_linear-gradient-parser.scss +++ /dev/null @@ -1,41 +0,0 @@ -@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/dist/helpers/_linear-side-corner-parser.scss b/dist/helpers/_linear-side-corner-parser.scss deleted file mode 100644 index 86ad88fbb..000000000 --- a/dist/helpers/_linear-side-corner-parser.scss +++ /dev/null @@ -1,31 +0,0 @@ -// 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/dist/helpers/_radial-gradient-parser.scss b/dist/helpers/_radial-gradient-parser.scss deleted file mode 100644 index 6dde50f06..000000000 --- a/dist/helpers/_radial-gradient-parser.scss +++ /dev/null @@ -1,50 +0,0 @@ -@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/dist/helpers/_str-to-num.scss b/dist/helpers/_str-to-num.scss deleted file mode 100644 index b3d616824..000000000 --- a/dist/helpers/_str-to-num.scss +++ /dev/null @@ -1,50 +0,0 @@ -//************************************************************************// -// 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); -}