sammy 0.0.12 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +7 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +40 -0
- data/LICENSE +23 -0
- data/README.md +94 -3
- data/Rakefile +9 -0
- data/app/assets/stylesheets/_sammy.scss +56 -0
- data/app/assets/stylesheets/addons/_button.scss +273 -0
- data/app/assets/stylesheets/addons/_clearfix.scss +29 -0
- data/app/assets/stylesheets/addons/_font-family.scss +5 -0
- data/app/assets/stylesheets/addons/_hide-text.scss +5 -0
- data/app/assets/stylesheets/addons/_html5-input-types.scss +56 -0
- data/app/assets/stylesheets/addons/_position.scss +42 -0
- data/app/assets/stylesheets/addons/_prefixer.scss +49 -0
- data/app/assets/stylesheets/addons/_retina-image.scss +32 -0
- data/app/assets/stylesheets/addons/_size.scss +44 -0
- data/app/assets/stylesheets/addons/_timing-functions.scss +32 -0
- data/app/assets/stylesheets/addons/_triangle.scss +45 -0
- data/app/assets/stylesheets/css3/_animation.scss +52 -0
- data/app/assets/stylesheets/css3/_appearance.scss +3 -0
- data/app/assets/stylesheets/css3/_backface-visibility.scss +6 -0
- data/app/assets/stylesheets/css3/_background-image.scss +48 -0
- data/app/assets/stylesheets/css3/_background.scss +103 -0
- data/app/assets/stylesheets/css3/_border-image.scss +53 -0
- data/app/assets/stylesheets/css3/_border-radius.scss +22 -0
- data/app/assets/stylesheets/css3/_box-sizing.scss +4 -0
- data/app/assets/stylesheets/css3/_columns.scss +47 -0
- data/app/assets/stylesheets/css3/_flex-box.scss +52 -0
- data/app/assets/stylesheets/css3/_font-face.scss +23 -0
- data/app/assets/stylesheets/css3/_hidpi-media-query.scss +10 -0
- data/app/assets/stylesheets/css3/_image-rendering.scss +13 -0
- data/app/assets/stylesheets/css3/_inline-block.scss +8 -0
- data/app/assets/stylesheets/css3/_keyframes.scss +41 -0
- data/app/assets/stylesheets/css3/_linear-gradient.scss +41 -0
- data/app/assets/stylesheets/css3/_perspective.scss +8 -0
- data/app/assets/stylesheets/css3/_placeholder.scss +29 -0
- data/app/assets/stylesheets/css3/_radial-gradient.scss +44 -0
- data/app/assets/stylesheets/css3/_transform.scss +15 -0
- data/app/assets/stylesheets/css3/_transition.scss +34 -0
- data/app/assets/stylesheets/css3/_user-select.scss +3 -0
- data/app/assets/stylesheets/functions/_compact.scss +11 -0
- data/app/assets/stylesheets/functions/_flex-grid.scss +39 -0
- data/app/assets/stylesheets/functions/_grid-width.scss +13 -0
- data/app/assets/stylesheets/functions/_linear-gradient.scss +13 -0
- data/app/assets/stylesheets/functions/_modular-scale.scss +40 -0
- data/app/assets/stylesheets/functions/_px-to-em.scss +8 -0
- data/app/assets/stylesheets/functions/_radial-gradient.scss +23 -0
- data/app/assets/stylesheets/functions/_tint-shade.scss +9 -0
- data/app/assets/stylesheets/functions/_transition-property-name.scss +22 -0
- data/app/assets/stylesheets/helpers/_deprecated-webkit-gradient.scss +39 -0
- data/app/assets/stylesheets/helpers/_gradient-positions-parser.scss +13 -0
- data/app/assets/stylesheets/helpers/_linear-positions-parser.scss +64 -0
- data/app/assets/stylesheets/helpers/_radial-arg-parser.scss +69 -0
- data/app/assets/stylesheets/helpers/_radial-positions-parser.scss +18 -0
- data/app/assets/stylesheets/helpers/_render-gradients.scss +26 -0
- data/app/assets/stylesheets/helpers/_shape-size-stripper.scss +10 -0
- data/bin/sammy +6 -0
- data/lib/sammy.rb +27 -9
- data/lib/sammy/date.rb +3 -0
- data/lib/sammy/engine.rb +5 -0
- data/lib/sammy/generator.rb +80 -0
- data/lib/sammy/version.rb +3 -0
- data/lib/tasks/install.rake +20 -0
- data/sammy.gemspec +31 -0
- metadata +117 -88
- data/stylesheets/_sammy.sass +0 -3
- data/stylesheets/sammy/_animations.scss +0 -35
- data/stylesheets/sammy/_css3.scss +0 -3
- data/stylesheets/sammy/_shared.scss +0 -2
- data/stylesheets/sammy/_utilities.scss +0 -1
- data/stylesheets/sammy/animations/_attention-seekers.scss +0 -7
- data/stylesheets/sammy/animations/_bouncing-entrances.scss +0 -5
- data/stylesheets/sammy/animations/_bouncing-exits.scss +0 -5
- data/stylesheets/sammy/animations/_fading-entrances.scss +0 -12
- data/stylesheets/sammy/animations/_fading-exits.scss +0 -12
- data/stylesheets/sammy/animations/_flippers.scss +0 -5
- data/stylesheets/sammy/animations/_rotating-entrances.scss +0 -5
- data/stylesheets/sammy/animations/_rotating-exits.scss +0 -5
- data/stylesheets/sammy/animations/_specials.scss +0 -3
- data/stylesheets/sammy/animations/attention-seekers/_bounce.scss +0 -30
- data/stylesheets/sammy/animations/attention-seekers/_flash.scss +0 -28
- data/stylesheets/sammy/animations/attention-seekers/_pulse.scss +0 -28
- data/stylesheets/sammy/animations/attention-seekers/_shake.scss +0 -34
- data/stylesheets/sammy/animations/attention-seekers/_swing.scss +0 -30
- data/stylesheets/sammy/animations/attention-seekers/_tada.scss +0 -34
- data/stylesheets/sammy/animations/attention-seekers/_wobble.scss +0 -32
- data/stylesheets/sammy/animations/bouncing-entrances/_bounceIn.scss +0 -37
- data/stylesheets/sammy/animations/bouncing-entrances/_bounceInDown.scss +0 -37
- data/stylesheets/sammy/animations/bouncing-entrances/_bounceInLeft.scss +0 -37
- data/stylesheets/sammy/animations/bouncing-entrances/_bounceInRight.scss +0 -37
- data/stylesheets/sammy/animations/bouncing-entrances/_bounceInUp.scss +0 -37
- data/stylesheets/sammy/animations/bouncing-exits/_bounceOut.scss +0 -37
- data/stylesheets/sammy/animations/bouncing-exits/_bounceOutDown.scss +0 -34
- data/stylesheets/sammy/animations/bouncing-exits/_bounceOutLeft.scss +0 -34
- data/stylesheets/sammy/animations/bouncing-exits/_bounceOutRight.scss +0 -34
- data/stylesheets/sammy/animations/bouncing-exits/_bounceOutUp.scss +0 -34
- data/stylesheets/sammy/animations/fading-entrances/_fadeIn.scss +0 -25
- data/stylesheets/sammy/animations/fading-entrances/_fadeInDown.scss +0 -31
- data/stylesheets/sammy/animations/fading-entrances/_fadeInDownBig.scss +0 -31
- data/stylesheets/sammy/animations/fading-entrances/_fadeInLeft.scss +0 -31
- data/stylesheets/sammy/animations/fading-entrances/_fadeInLeftBig.scss +0 -31
- data/stylesheets/sammy/animations/fading-entrances/_fadeInRight.scss +0 -31
- data/stylesheets/sammy/animations/fading-entrances/_fadeInRightBig.scss +0 -31
- data/stylesheets/sammy/animations/fading-entrances/_fadeInUp.scss +0 -31
- data/stylesheets/sammy/animations/fading-entrances/_fadeInUpBig.scss +0 -31
- data/stylesheets/sammy/animations/fading-exits/_fadeOut.scss +0 -25
- data/stylesheets/sammy/animations/fading-exits/_fadeOutDown.scss +0 -31
- data/stylesheets/sammy/animations/fading-exits/_fadeOutDownBig.scss +0 -31
- data/stylesheets/sammy/animations/fading-exits/_fadeOutLeft.scss +0 -31
- data/stylesheets/sammy/animations/fading-exits/_fadeOutLeftBig.scss +0 -31
- data/stylesheets/sammy/animations/fading-exits/_fadeOutRight.scss +0 -31
- data/stylesheets/sammy/animations/fading-exits/_fadeOutRightBig.scss +0 -31
- data/stylesheets/sammy/animations/fading-exits/_fadeOutUp.scss +0 -31
- data/stylesheets/sammy/animations/fading-exits/_fadeOutUpBig.scss +0 -31
- data/stylesheets/sammy/animations/flippers/_flip.scss +0 -44
- data/stylesheets/sammy/animations/flippers/_flipInX.scss +0 -38
- data/stylesheets/sammy/animations/flippers/_flipInY.scss +0 -38
- data/stylesheets/sammy/animations/flippers/_flipOutX.scss +0 -32
- data/stylesheets/sammy/animations/flippers/_flipOutY.scss +0 -32
- data/stylesheets/sammy/animations/rotating-entrances/_rotateIn.scss +0 -33
- data/stylesheets/sammy/animations/rotating-entrances/_rotateInDownLeft.scss +0 -33
- data/stylesheets/sammy/animations/rotating-entrances/_rotateInDownRight.scss +0 -33
- data/stylesheets/sammy/animations/rotating-entrances/_rotateInUpLeft.scss +0 -33
- data/stylesheets/sammy/animations/rotating-entrances/_rotateInUpRight.scss +0 -33
- data/stylesheets/sammy/animations/rotating-exits/_rotateOut.scss +0 -33
- data/stylesheets/sammy/animations/rotating-exits/_rotateOutDownLeft.scss +0 -33
- data/stylesheets/sammy/animations/rotating-exits/_rotateOutDownRight.scss +0 -33
- data/stylesheets/sammy/animations/rotating-exits/_rotateOutUpLeft.scss +0 -33
- data/stylesheets/sammy/animations/rotating-exits/_rotateOutUpRight.scss +0 -33
- data/stylesheets/sammy/animations/specials/_hinge.scss +0 -48
- data/stylesheets/sammy/animations/specials/_rollIn.scss +0 -33
- data/stylesheets/sammy/animations/specials/_rollOut.scss +0 -33
- data/stylesheets/sammy/css3/_animation.scss +0 -75
- data/stylesheets/sammy/css3/_backface-visibility.scss +0 -14
- data/stylesheets/sammy/css3/_transform.scss +0 -27
- data/stylesheets/sammy/css3/animation/_animation-delay.scss +0 -18
- data/stylesheets/sammy/css3/animation/_animation-direction.scss +0 -18
- data/stylesheets/sammy/css3/animation/_animation-duration.scss +0 -17
- data/stylesheets/sammy/css3/animation/_animation-fill-mode.scss +0 -18
- data/stylesheets/sammy/css3/animation/_animation-iteration-count.scss +0 -18
- data/stylesheets/sammy/css3/animation/_animation-name.scss +0 -18
- data/stylesheets/sammy/css3/animation/_animation-play-state.scss +0 -18
- data/stylesheets/sammy/css3/animation/_animation-timing-function.scss +0 -18
- data/stylesheets/sammy/utilities/_mixins.scss +0 -12
- data/templates/sammy/manifest.rb +0 -0
@@ -0,0 +1,44 @@
|
|
1
|
+
// Requires Sass 3.1+
|
2
|
+
@mixin radial-gradient($G1, $G2,
|
3
|
+
$G3: false, $G4: false,
|
4
|
+
$G5: false, $G6: false,
|
5
|
+
$G7: false, $G8: false,
|
6
|
+
$G9: false, $G10: false,
|
7
|
+
$pos: null,
|
8
|
+
$shape-size: null,
|
9
|
+
$deprecated-pos1: center center,
|
10
|
+
$deprecated-pos2: center center,
|
11
|
+
$deprecated-radius1: 0,
|
12
|
+
$deprecated-radius2: 460,
|
13
|
+
$fallback: false) {
|
14
|
+
|
15
|
+
$data: _radial-arg-parser($G1, $G2, $pos, $shape-size);
|
16
|
+
$G1: nth($data, 1);
|
17
|
+
$G2: nth($data, 2);
|
18
|
+
$pos: nth($data, 3);
|
19
|
+
$shape-size: nth($data, 4);
|
20
|
+
|
21
|
+
$full: compact($G1, $G2, $G3, $G4, $G5, $G6, $G7, $G8, $G9, $G10);
|
22
|
+
|
23
|
+
// Strip deprecated cover/contain for spec
|
24
|
+
$shape-size-spec: _shape-size-stripper($shape-size);
|
25
|
+
|
26
|
+
// Set $G1 as the default fallback color
|
27
|
+
$first-color: nth($full, 1);
|
28
|
+
$fallback-color: nth($first-color, 1);
|
29
|
+
|
30
|
+
@if (type-of($fallback) == color) or ($fallback == "transparent") {
|
31
|
+
$fallback-color: $fallback;
|
32
|
+
}
|
33
|
+
|
34
|
+
// Add Commas and spaces
|
35
|
+
$shape-size: if($shape-size, '#{$shape-size}, ', null);
|
36
|
+
$pos: if($pos, '#{$pos}, ', null);
|
37
|
+
$pos-spec: if($pos, 'at #{$pos}', null);
|
38
|
+
$shape-size-spec: if(($shape-size-spec != ' ') and ($pos == null), '#{$shape-size-spec}, ', '#{$shape-size-spec} ');
|
39
|
+
|
40
|
+
background-color: $fallback-color;
|
41
|
+
background-image: _deprecated-webkit-gradient(radial, $deprecated-pos1, $deprecated-pos2, $full, $deprecated-radius1, $deprecated-radius2); // Safari <= 5.0 && IOS 4
|
42
|
+
background-image: -webkit-radial-gradient(unquote(#{$pos}#{$shape-size}#{$full}));
|
43
|
+
background-image: unquote("radial-gradient(#{$shape-size-spec}#{$pos-spec}#{$full})");
|
44
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
@mixin transform($property: none) {
|
2
|
+
// none | <transform-function>
|
3
|
+
@include prefixer(transform, $property, webkit moz ms o spec);
|
4
|
+
}
|
5
|
+
|
6
|
+
@mixin transform-origin($axes: 50%) {
|
7
|
+
// x-axis - left | center | right | length | %
|
8
|
+
// y-axis - top | center | bottom | length | %
|
9
|
+
// z-axis - length
|
10
|
+
@include prefixer(transform-origin, $axes, webkit moz ms o spec);
|
11
|
+
}
|
12
|
+
|
13
|
+
@mixin transform-style ($style: flat) {
|
14
|
+
@include prefixer(transform-style, $style, webkit moz ms o spec);
|
15
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
// Shorthand mixin. Supports multiple parentheses-deliminated values for each variable.
|
2
|
+
// Example: @include transition (all, 2.0s, ease-in-out);
|
3
|
+
// @include transition ((opacity, width), (1.0s, 2.0s), ease-in, (0, 2s));
|
4
|
+
// @include transition ($property:(opacity, width), $delay: (1.5s, 2.5s));
|
5
|
+
|
6
|
+
@mixin transition ($properties...) {
|
7
|
+
@if length($properties) >= 1 {
|
8
|
+
@include prefixer(transition, $properties, webkit moz spec);
|
9
|
+
}
|
10
|
+
|
11
|
+
@else {
|
12
|
+
$properties: all 0.15s ease-out 0;
|
13
|
+
@include prefixer(transition, $properties, webkit moz spec);
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
@mixin transition-property ($properties...) {
|
18
|
+
-webkit-transition-property: transition-property-names($properties, 'webkit');
|
19
|
+
-moz-transition-property: transition-property-names($properties, 'moz');
|
20
|
+
transition-property: transition-property-names($properties, false);
|
21
|
+
}
|
22
|
+
|
23
|
+
@mixin transition-duration ($times...) {
|
24
|
+
@include prefixer(transition-duration, $times, webkit moz spec);
|
25
|
+
}
|
26
|
+
|
27
|
+
@mixin transition-timing-function ($motions...) {
|
28
|
+
// ease | linear | ease-in | ease-out | ease-in-out | cubic-bezier()
|
29
|
+
@include prefixer(transition-timing-function, $motions, webkit moz spec);
|
30
|
+
}
|
31
|
+
|
32
|
+
@mixin transition-delay ($times...) {
|
33
|
+
@include prefixer(transition-delay, $times, webkit moz spec);
|
34
|
+
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
// Flexible grid
|
2
|
+
@function flex-grid($columns, $container-columns: $fg-max-columns) {
|
3
|
+
$width: $columns * $fg-column + ($columns - 1) * $fg-gutter;
|
4
|
+
$container-width: $container-columns * $fg-column + ($container-columns - 1) * $fg-gutter;
|
5
|
+
@return percentage($width / $container-width);
|
6
|
+
}
|
7
|
+
|
8
|
+
// Flexible gutter
|
9
|
+
@function flex-gutter($container-columns: $fg-max-columns, $gutter: $fg-gutter) {
|
10
|
+
$container-width: $container-columns * $fg-column + ($container-columns - 1) * $fg-gutter;
|
11
|
+
@return percentage($gutter / $container-width);
|
12
|
+
}
|
13
|
+
|
14
|
+
// The $fg-column, $fg-gutter and $fg-max-columns variables must be defined in your base stylesheet to properly use the flex-grid function.
|
15
|
+
// This function takes the fluid grid equation (target / context = result) and uses columns to help define each.
|
16
|
+
//
|
17
|
+
// The calculation presumes that your column structure will be missing the last gutter:
|
18
|
+
//
|
19
|
+
// -- column -- gutter -- column -- gutter -- column
|
20
|
+
//
|
21
|
+
// $fg-column: 60px; // Column Width
|
22
|
+
// $fg-gutter: 25px; // Gutter Width
|
23
|
+
// $fg-max-columns: 12; // Total Columns For Main Container
|
24
|
+
//
|
25
|
+
// div {
|
26
|
+
// width: flex-grid(4); // returns (315px / 995px) = 31.65829%;
|
27
|
+
// margin-left: flex-gutter(); // returns (25px / 995px) = 2.51256%;
|
28
|
+
//
|
29
|
+
// p {
|
30
|
+
// width: flex-grid(2, 4); // returns (145px / 315px) = 46.031746%;
|
31
|
+
// float: left;
|
32
|
+
// margin: flex-gutter(4); // returns (25px / 315px) = 7.936508%;
|
33
|
+
// }
|
34
|
+
//
|
35
|
+
// blockquote {
|
36
|
+
// float: left;
|
37
|
+
// width: flex-grid(2, 4); // returns (145px / 315px) = 46.031746%;
|
38
|
+
// }
|
39
|
+
// }
|
@@ -0,0 +1,13 @@
|
|
1
|
+
@function grid-width($n) {
|
2
|
+
@return $n * $gw-column + ($n - 1) * $gw-gutter;
|
3
|
+
}
|
4
|
+
|
5
|
+
// The $gw-column and $gw-gutter variables must be defined in your base stylesheet to properly use the grid-width function.
|
6
|
+
//
|
7
|
+
// $gw-column: 100px; // Column Width
|
8
|
+
// $gw-gutter: 40px; // Gutter Width
|
9
|
+
//
|
10
|
+
// div {
|
11
|
+
// width: grid-width(4); // returns 520px;
|
12
|
+
// margin-left: $gw-gutter; // returns 40px;
|
13
|
+
// }
|
@@ -0,0 +1,13 @@
|
|
1
|
+
@function linear-gradient($pos, $gradients...) {
|
2
|
+
$type: linear;
|
3
|
+
$pos-type: type-of(nth($pos, 1));
|
4
|
+
|
5
|
+
// if $pos doesn't exist, fix $gradient
|
6
|
+
@if ($pos-type == color) or (nth($pos, 1) == "transparent") {
|
7
|
+
$gradients: zip($pos $gradients);
|
8
|
+
$pos: false;
|
9
|
+
}
|
10
|
+
|
11
|
+
$type-gradient: $type, $pos, $gradients;
|
12
|
+
@return $type-gradient;
|
13
|
+
}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
@function modular-scale($value, $increment, $ratio) {
|
2
|
+
@if $increment > 0 {
|
3
|
+
@for $i from 1 through $increment {
|
4
|
+
$value: ($value * $ratio);
|
5
|
+
}
|
6
|
+
}
|
7
|
+
|
8
|
+
@if $increment < 0 {
|
9
|
+
$increment: abs($increment);
|
10
|
+
@for $i from 1 through $increment {
|
11
|
+
$value: ($value / $ratio);
|
12
|
+
}
|
13
|
+
}
|
14
|
+
|
15
|
+
@return $value;
|
16
|
+
}
|
17
|
+
|
18
|
+
// div {
|
19
|
+
// Increment Up GR with positive value
|
20
|
+
// font-size: modular-scale(14px, 1, 1.618); // returns: 22.652px
|
21
|
+
//
|
22
|
+
// Increment Down GR with negative value
|
23
|
+
// font-size: modular-scale(14px, -1, 1.618); // returns: 8.653px
|
24
|
+
//
|
25
|
+
// Can be used with ceil(round up) or floor(round down)
|
26
|
+
// font-size: floor( modular-scale(14px, 1, 1.618) ); // returns: 22px
|
27
|
+
// font-size: ceil( modular-scale(14px, 1, 1.618) ); // returns: 23px
|
28
|
+
// }
|
29
|
+
//
|
30
|
+
// modularscale.com
|
31
|
+
|
32
|
+
@function golden-ratio($value, $increment) {
|
33
|
+
@return modular-scale($value, $increment, 1.618)
|
34
|
+
}
|
35
|
+
|
36
|
+
// div {
|
37
|
+
// font-size: golden-ratio(14px, 1); // returns: 22.652px
|
38
|
+
// }
|
39
|
+
//
|
40
|
+
// goldenratiocalculator.com
|
@@ -0,0 +1,23 @@
|
|
1
|
+
// This function is required and used by the background-image mixin.
|
2
|
+
@function radial-gradient($G1, $G2,
|
3
|
+
$G3: false, $G4: false,
|
4
|
+
$G5: false, $G6: false,
|
5
|
+
$G7: false, $G8: false,
|
6
|
+
$G9: false, $G10: false,
|
7
|
+
$pos: null,
|
8
|
+
$shape-size: null) {
|
9
|
+
|
10
|
+
$data: _radial-arg-parser($G1, $G2, $pos, $shape-size);
|
11
|
+
$G1: nth($data, 1);
|
12
|
+
$G2: nth($data, 2);
|
13
|
+
$pos: nth($data, 3);
|
14
|
+
$shape-size: nth($data, 4);
|
15
|
+
|
16
|
+
$type: radial;
|
17
|
+
$gradient: compact($G1, $G2, $G3, $G4, $G5, $G6, $G7, $G8, $G9, $G10);
|
18
|
+
|
19
|
+
$type-gradient: $type, $shape-size $pos, $gradient;
|
20
|
+
@return $type-gradient;
|
21
|
+
}
|
22
|
+
|
23
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
// Return vendor-prefixed property names if appropriate
|
2
|
+
// Example: transition-property-names((transform, color, background), moz) -> -moz-transform, color, background
|
3
|
+
//************************************************************************//
|
4
|
+
@function transition-property-names($props, $vendor: false) {
|
5
|
+
$new-props: ();
|
6
|
+
|
7
|
+
@each $prop in $props {
|
8
|
+
$new-props: append($new-props, transition-property-name($prop, $vendor), comma);
|
9
|
+
}
|
10
|
+
|
11
|
+
@return $new-props;
|
12
|
+
}
|
13
|
+
|
14
|
+
@function transition-property-name($prop, $vendor: false) {
|
15
|
+
// put other properties that need to be prefixed here aswell
|
16
|
+
@if $vendor and $prop == transform {
|
17
|
+
@return unquote('-'+$vendor+'-'+$prop);
|
18
|
+
}
|
19
|
+
@else {
|
20
|
+
@return $prop;
|
21
|
+
}
|
22
|
+
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
// Render Deprecated Webkit Gradient - Linear || Radial
|
2
|
+
//************************************************************************//
|
3
|
+
@function _deprecated-webkit-gradient($type,
|
4
|
+
$deprecated-pos1, $deprecated-pos2,
|
5
|
+
$full,
|
6
|
+
$deprecated-radius1: false, $deprecated-radius2: false) {
|
7
|
+
$gradient-list: ();
|
8
|
+
$gradient: false;
|
9
|
+
$full-length: length($full);
|
10
|
+
$percentage: false;
|
11
|
+
$gradient-type: $type;
|
12
|
+
|
13
|
+
@for $i from 1 through $full-length {
|
14
|
+
$gradient: nth($full, $i);
|
15
|
+
|
16
|
+
@if length($gradient) == 2 {
|
17
|
+
$color-stop: color-stop(nth($gradient, 2), nth($gradient, 1));
|
18
|
+
$gradient-list: join($gradient-list, $color-stop, comma);
|
19
|
+
}
|
20
|
+
@else if $gradient != null {
|
21
|
+
@if $i == $full-length {
|
22
|
+
$percentage: 100%;
|
23
|
+
}
|
24
|
+
@else {
|
25
|
+
$percentage: ($i - 1) * (100 / ($full-length - 1)) + "%";
|
26
|
+
}
|
27
|
+
$color-stop: color-stop(unquote($percentage), $gradient);
|
28
|
+
$gradient-list: join($gradient-list, $color-stop, comma);
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
@if $type == radial {
|
33
|
+
$gradient: -webkit-gradient(radial, $deprecated-pos1, $deprecated-radius1, $deprecated-pos2, $deprecated-radius2, $gradient-list);
|
34
|
+
}
|
35
|
+
@else if $type == linear {
|
36
|
+
$gradient: -webkit-gradient(linear, $deprecated-pos1, $deprecated-pos2, $gradient-list);
|
37
|
+
}
|
38
|
+
@return $gradient;
|
39
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
@function _gradient-positions-parser($gradient-type, $gradient-positions) {
|
2
|
+
@if $gradient-positions
|
3
|
+
and ($gradient-type == linear)
|
4
|
+
and (type-of($gradient-positions) != color) {
|
5
|
+
$gradient-positions: _linear-positions-parser($gradient-positions);
|
6
|
+
}
|
7
|
+
@else if $gradient-positions
|
8
|
+
and ($gradient-type == radial)
|
9
|
+
and (type-of($gradient-positions) != color) {
|
10
|
+
$gradient-positions: _radial-positions-parser($gradient-positions);
|
11
|
+
}
|
12
|
+
@return $gradient-positions;
|
13
|
+
}
|
@@ -0,0 +1,64 @@
|
|
1
|
+
@function _linear-positions-parser($pos) {
|
2
|
+
$type: type-of(nth($pos, 1));
|
3
|
+
$spec: null;
|
4
|
+
$degree: null;
|
5
|
+
$side: null;
|
6
|
+
$corner: null;
|
7
|
+
$length: length($pos);
|
8
|
+
// Parse Side and corner positions
|
9
|
+
@if ($length > 1) {
|
10
|
+
@if nth($pos, 1) == "to" { // Newer syntax
|
11
|
+
$side: nth($pos, 2);
|
12
|
+
|
13
|
+
@if $length == 2 { // eg. to top
|
14
|
+
// Swap for backwards compatability
|
15
|
+
$degree: _position-flipper(nth($pos, 2));
|
16
|
+
}
|
17
|
+
@else if $length == 3 { // eg. to top left
|
18
|
+
$corner: nth($pos, 3);
|
19
|
+
}
|
20
|
+
}
|
21
|
+
@else if $length == 2 { // Older syntax ("top left")
|
22
|
+
$side: _position-flipper(nth($pos, 1));
|
23
|
+
$corner: _position-flipper(nth($pos, 2));
|
24
|
+
}
|
25
|
+
|
26
|
+
@if ("#{$side} #{$corner}" == "left top") or ("#{$side} #{$corner}" == "top left") {
|
27
|
+
$degree: _position-flipper(#{$side}) _position-flipper(#{$corner});
|
28
|
+
}
|
29
|
+
@else if ("#{$side} #{$corner}" == "right top") or ("#{$side} #{$corner}" == "top right") {
|
30
|
+
$degree: _position-flipper(#{$side}) _position-flipper(#{$corner});
|
31
|
+
}
|
32
|
+
@else if ("#{$side} #{$corner}" == "right bottom") or ("#{$side} #{$corner}" == "bottom right") {
|
33
|
+
$degree: _position-flipper(#{$side}) _position-flipper(#{$corner});
|
34
|
+
}
|
35
|
+
@else if ("#{$side} #{$corner}" == "left bottom") or ("#{$side} #{$corner}" == "bottom left") {
|
36
|
+
$degree: _position-flipper(#{$side}) _position-flipper(#{$corner});
|
37
|
+
}
|
38
|
+
@else {
|
39
|
+
@warn "Incorrect gradient syntax";
|
40
|
+
}
|
41
|
+
$spec: to $side $corner;
|
42
|
+
}
|
43
|
+
@else if $length == 1 {
|
44
|
+
// Swap for backwards compatability
|
45
|
+
@if $type == string {
|
46
|
+
$degree: $pos;
|
47
|
+
$spec: to _position-flipper($pos);
|
48
|
+
}
|
49
|
+
@else {
|
50
|
+
$degree: -270 - $pos; //rotate the gradient opposite from spec
|
51
|
+
$spec: $pos;
|
52
|
+
}
|
53
|
+
}
|
54
|
+
$degree: unquote($degree + ",");
|
55
|
+
$spec: unquote($spec + ",");
|
56
|
+
@return $degree $spec;
|
57
|
+
}
|
58
|
+
|
59
|
+
@function _position-flipper($pos) {
|
60
|
+
@return if($pos == left, right, null)
|
61
|
+
if($pos == right, left, null)
|
62
|
+
if($pos == top, bottom, null)
|
63
|
+
if($pos == bottom, top, null);
|
64
|
+
}
|
@@ -0,0 +1,69 @@
|
|
1
|
+
@function _radial-arg-parser($G1, $G2, $pos, $shape-size) {
|
2
|
+
@each $value in $G1, $G2 {
|
3
|
+
$first-val: nth($value, 1);
|
4
|
+
$pos-type: type-of($first-val);
|
5
|
+
$spec-at-index: null;
|
6
|
+
|
7
|
+
// Determine if spec was passed to mixin
|
8
|
+
@if type-of($value) == list {
|
9
|
+
$spec-at-index: if(index($value, at), index($value, at), false);
|
10
|
+
}
|
11
|
+
@if $spec-at-index {
|
12
|
+
@if $spec-at-index > 1 {
|
13
|
+
@for $i from 1 through ($spec-at-index - 1) {
|
14
|
+
$shape-size: $shape-size nth($value, $i);
|
15
|
+
}
|
16
|
+
@for $i from ($spec-at-index + 1) through length($value) {
|
17
|
+
$pos: $pos nth($value, $i);
|
18
|
+
}
|
19
|
+
}
|
20
|
+
@else if $spec-at-index == 1 {
|
21
|
+
@for $i from ($spec-at-index + 1) through length($value) {
|
22
|
+
$pos: $pos nth($value, $i);
|
23
|
+
}
|
24
|
+
}
|
25
|
+
$G1: false;
|
26
|
+
}
|
27
|
+
|
28
|
+
// If not spec calculate correct values
|
29
|
+
@else {
|
30
|
+
@if ($pos-type != color) or ($first-val != "transparent") {
|
31
|
+
@if ($pos-type == number)
|
32
|
+
or ($first-val == "center")
|
33
|
+
or ($first-val == "top")
|
34
|
+
or ($first-val == "right")
|
35
|
+
or ($first-val == "bottom")
|
36
|
+
or ($first-val == "left") {
|
37
|
+
|
38
|
+
$pos: $value;
|
39
|
+
|
40
|
+
@if $pos == $G1 {
|
41
|
+
$G1: false;
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
@else if
|
46
|
+
($first-val == "ellipse")
|
47
|
+
or ($first-val == "circle")
|
48
|
+
or ($first-val == "closest-side")
|
49
|
+
or ($first-val == "closest-corner")
|
50
|
+
or ($first-val == "farthest-side")
|
51
|
+
or ($first-val == "farthest-corner")
|
52
|
+
or ($first-val == "contain")
|
53
|
+
or ($first-val == "cover") {
|
54
|
+
|
55
|
+
$shape-size: $value;
|
56
|
+
|
57
|
+
@if $value == $G1 {
|
58
|
+
$G1: false;
|
59
|
+
}
|
60
|
+
|
61
|
+
@else if $value == $G2 {
|
62
|
+
$G2: false;
|
63
|
+
}
|
64
|
+
}
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}
|
68
|
+
@return $G1, $G2, $pos, $shape-size;
|
69
|
+
}
|