bourbon 3.2.4 → 4.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +6 -6
  3. data/.npmignore +9 -11
  4. data/Gemfile.lock +49 -0
  5. data/{LICENSE.md → LICENSE} +10 -8
  6. data/app/assets/stylesheets/_bourbon-deprecated-upcoming.scss +3 -8
  7. data/app/assets/stylesheets/_bourbon.scss +9 -12
  8. data/app/assets/stylesheets/addons/_directional-values.scss +8 -5
  9. data/app/assets/stylesheets/addons/_html5-input-types.scss +15 -39
  10. data/app/assets/stylesheets/addons/_position.scss +5 -5
  11. data/app/assets/stylesheets/addons/_prefixer.scss +5 -5
  12. data/app/assets/stylesheets/addons/_rem.scss +33 -0
  13. data/app/assets/stylesheets/addons/_retina-image.scss +1 -1
  14. data/app/assets/stylesheets/addons/_size.scss +9 -37
  15. data/app/assets/stylesheets/addons/_timing-functions.scss +1 -1
  16. data/app/assets/stylesheets/addons/_triangle.scss +0 -1
  17. data/app/assets/stylesheets/css3/_background-image.scss +29 -35
  18. data/app/assets/stylesheets/css3/_background.scss +37 -85
  19. data/app/assets/stylesheets/css3/_border-image.scss +45 -42
  20. data/app/assets/stylesheets/css3/_flex-box.scss +14 -14
  21. data/app/assets/stylesheets/css3/_font-face.scss +1 -1
  22. data/app/assets/stylesheets/css3/_keyframes.scss +7 -7
  23. data/app/assets/stylesheets/functions/_assign.scss +11 -0
  24. data/app/assets/stylesheets/functions/_color-lightness.scss +5 -5
  25. data/app/assets/stylesheets/helpers/_convert-units.scss +15 -0
  26. data/app/assets/stylesheets/helpers/_is-num.scss +8 -0
  27. data/app/assets/stylesheets/helpers/_linear-angle-parser.scss +25 -0
  28. data/app/assets/stylesheets/helpers/_linear-gradient-parser.scss +41 -0
  29. data/app/assets/stylesheets/helpers/_linear-side-corner-parser.scss +31 -0
  30. data/app/assets/stylesheets/helpers/_radial-gradient-parser.scss +50 -0
  31. data/app/assets/stylesheets/helpers/_render-gradients.scss +2 -2
  32. data/app/assets/stylesheets/helpers/_str-to-num.scss +50 -0
  33. data/bourbon.gemspec +2 -2
  34. data/bower.json +6 -23
  35. data/dist/_bourbon-deprecated-upcoming.scss +3 -8
  36. data/dist/_bourbon.scss +9 -12
  37. data/dist/addons/_directional-values.scss +8 -5
  38. data/dist/addons/_html5-input-types.scss +15 -39
  39. data/dist/addons/_position.scss +5 -5
  40. data/dist/addons/_prefixer.scss +5 -5
  41. data/dist/addons/_rem.scss +33 -0
  42. data/dist/addons/_retina-image.scss +1 -1
  43. data/dist/addons/_size.scss +9 -37
  44. data/dist/addons/_timing-functions.scss +1 -1
  45. data/dist/addons/_triangle.scss +0 -1
  46. data/dist/css3/_background-image.scss +29 -35
  47. data/dist/css3/_background.scss +37 -85
  48. data/dist/css3/_border-image.scss +45 -42
  49. data/dist/css3/_flex-box.scss +14 -14
  50. data/dist/css3/_font-face.scss +1 -1
  51. data/dist/css3/_keyframes.scss +7 -7
  52. data/dist/functions/_assign.scss +11 -0
  53. data/dist/functions/_color-lightness.scss +5 -5
  54. data/dist/helpers/_convert-units.scss +15 -0
  55. data/dist/helpers/_is-num.scss +8 -0
  56. data/dist/helpers/_linear-angle-parser.scss +25 -0
  57. data/dist/helpers/_linear-gradient-parser.scss +41 -0
  58. data/dist/helpers/_linear-side-corner-parser.scss +31 -0
  59. data/dist/helpers/_radial-gradient-parser.scss +50 -0
  60. data/dist/helpers/_render-gradients.scss +2 -2
  61. data/dist/helpers/_str-to-num.scss +50 -0
  62. data/lib/bourbon/version.rb +1 -1
  63. data/package.json +14 -18
  64. data/readme.md +96 -0
  65. metadata +38 -33
  66. data/README.md +0 -126
  67. data/app/assets/stylesheets/addons/_word-wrap.scss +0 -8
  68. data/app/assets/stylesheets/css3/_inline-block.scss +0 -8
  69. data/app/assets/stylesheets/functions/_linear-gradient.scss +0 -13
  70. data/app/assets/stylesheets/functions/_px-to-rem.scss +0 -15
  71. data/app/assets/stylesheets/functions/_radial-gradient.scss +0 -23
  72. data/app/assets/stylesheets/settings/_asset-pipeline.scss +0 -1
  73. data/dist/addons/_word-wrap.scss +0 -8
  74. data/dist/css3/_inline-block.scss +0 -8
  75. data/dist/functions/_linear-gradient.scss +0 -13
  76. data/dist/functions/_px-to-rem.scss +0 -15
  77. data/dist/functions/_radial-gradient.scss +0 -23
  78. data/dist/settings/_asset-pipeline.scss +0 -1
@@ -20,29 +20,19 @@ $inputs-list: 'input[type="email"]',
20
20
  'input[type="time"]',
21
21
  'input[type="week"]';
22
22
 
23
- $unquoted-inputs-list: ();
24
- @each $input-type in $inputs-list {
25
- $unquoted-inputs-list: append($unquoted-inputs-list, unquote($input-type), comma);
26
- }
27
-
28
- $all-text-inputs: $unquoted-inputs-list;
29
-
23
+ // Bare inputs
24
+ //************************************************************************//
25
+ $all-text-inputs: assign-inputs($inputs-list);
30
26
 
31
27
  // Hover Pseudo-class
32
28
  //************************************************************************//
33
- $all-text-inputs-hover: ();
34
- @each $input-type in $unquoted-inputs-list {
35
- $input-type-hover: $input-type + ":hover";
36
- $all-text-inputs-hover: append($all-text-inputs-hover, $input-type-hover, comma);
37
- }
29
+ $all-text-inputs-hover: assign-inputs($inputs-list, hover);
38
30
 
39
31
  // Focus Pseudo-class
40
32
  //************************************************************************//
41
- $all-text-inputs-focus: ();
42
- @each $input-type in $unquoted-inputs-list {
43
- $input-type-focus: $input-type + ":focus";
44
- $all-text-inputs-focus: append($all-text-inputs-focus, $input-type-focus, comma);
45
- }
33
+ $all-text-inputs-focus: assign-inputs($inputs-list, focus);
34
+
35
+
46
36
 
47
37
  // You must use interpolation on the variable:
48
38
  // #{$all-text-inputs}
@@ -65,37 +55,23 @@ $inputs-button-list: 'input[type="button"]',
65
55
  'input[type="reset"]',
66
56
  'input[type="submit"]';
67
57
 
68
- $unquoted-inputs-button-list: ();
69
- @each $input-type in $inputs-button-list {
70
- $unquoted-inputs-button-list: append($unquoted-inputs-button-list, unquote($input-type), comma);
71
- }
72
-
73
- $all-button-inputs: $unquoted-inputs-button-list;
74
-
58
+ // Bare inputs
59
+ //************************************************************************//
60
+ $all-button-inputs: assign-inputs($inputs-button-list);
75
61
 
76
62
  // Hover Pseudo-class
77
63
  //************************************************************************//
78
- $all-button-inputs-hover: ();
79
- @each $input-type in $unquoted-inputs-button-list {
80
- $input-type-hover: $input-type + ":hover";
81
- $all-button-inputs-hover: append($all-button-inputs-hover, $input-type-hover, comma);
82
- }
64
+ $all-button-inputs-hover: assign-inputs($inputs-button-list, hover);
83
65
 
84
66
  // Focus Pseudo-class
85
67
  //************************************************************************//
86
- $all-button-inputs-focus: ();
87
- @each $input-type in $unquoted-inputs-button-list {
88
- $input-type-focus: $input-type + ":focus";
89
- $all-button-inputs-focus: append($all-button-inputs-focus, $input-type-focus, comma);
90
- }
68
+ $all-button-inputs-focus: assign-inputs($inputs-button-list, focus);
91
69
 
92
70
  // Active Pseudo-class
93
71
  //************************************************************************//
94
- $all-button-inputs-active: ();
95
- @each $input-type in $unquoted-inputs-button-list {
96
- $input-type-active: $input-type + ":active";
97
- $all-button-inputs-active: append($all-button-inputs-active, $input-type-active, comma);
98
- }
72
+ $all-button-inputs-active: assign-inputs($inputs-button-list, active);
73
+
74
+
99
75
 
100
76
  // You must use interpolation on the variable:
101
77
  // #{$all-button-inputs}
@@ -1,4 +1,4 @@
1
- @mixin position ($position: relative, $coordinates: 0 0 0 0) {
1
+ @mixin position ($position: relative, $coordinates: null null null null) {
2
2
 
3
3
  @if type-of($position) == list {
4
4
  $coordinates: $position;
@@ -14,19 +14,19 @@
14
14
 
15
15
  position: $position;
16
16
 
17
- @if ($top and $top == auto) or (type-of($top) == number and not(unitless($top))) {
17
+ @if ($top and $top == auto) or (type-of($top) == number) {
18
18
  top: $top;
19
19
  }
20
20
 
21
- @if ($right and $right == auto) or (type-of($right) == number and not(unitless($right))) {
21
+ @if ($right and $right == auto) or (type-of($right) == number) {
22
22
  right: $right;
23
23
  }
24
24
 
25
- @if ($bottom and $bottom == auto) or (type-of($bottom) == number and not(unitless($bottom))) {
25
+ @if ($bottom and $bottom == auto) or (type-of($bottom) == number) {
26
26
  bottom: $bottom;
27
27
  }
28
28
 
29
- @if ($left and $left == auto) or (type-of($left) == number and not(unitless($left))) {
29
+ @if ($left and $left == auto) or (type-of($left) == number) {
30
30
  left: $left;
31
31
  }
32
32
  }
@@ -37,9 +37,9 @@
37
37
  }
38
38
 
39
39
  @mixin disable-prefix-for-all() {
40
- $prefix-for-webkit: false;
41
- $prefix-for-mozilla: false;
42
- $prefix-for-microsoft: false;
43
- $prefix-for-opera: false;
44
- $prefix-for-spec: false;
40
+ $prefix-for-webkit: false !global;
41
+ $prefix-for-mozilla: false !global;
42
+ $prefix-for-microsoft: false !global;
43
+ $prefix-for-opera: false !global;
44
+ $prefix-for-spec: false !global;
45
45
  }
@@ -0,0 +1,33 @@
1
+ @mixin rem($property, $size, $base: $em-base) {
2
+ @if not unitless($base) {
3
+ $base: strip-units($base);
4
+ }
5
+
6
+ $unitless_values: ();
7
+ @each $num in $size {
8
+ @if not unitless($num) {
9
+ @if unit($num) == "em" {
10
+ $num: $num * $base;
11
+ }
12
+
13
+ $num: strip-units($num);
14
+ }
15
+
16
+ $unitless_values: append($unitless_values, $num);
17
+ }
18
+ $size: $unitless_values;
19
+
20
+ $pixel_values: ();
21
+ $rem_values: ();
22
+ @each $value in $size {
23
+ $pixel_value: $value * 1px;
24
+ $pixel_values: append($pixel_values, $pixel_value);
25
+
26
+ $rem_value: ($value / $base) * 1rem;
27
+ $rem_values: append($rem_values, $rem_value);
28
+ }
29
+
30
+ #{$property}: $pixel_values;
31
+ #{$property}: $rem_values;
32
+ }
33
+
@@ -1,4 +1,4 @@
1
- @mixin retina-image($filename, $background-size, $extension: png, $retina-filename: null, $retina-suffix: _2x, $asset-pipeline: $asset-pipeline) {
1
+ @mixin retina-image($filename, $background-size, $extension: png, $retina-filename: null, $retina-suffix: _2x, $asset-pipeline: false) {
2
2
  @if $asset-pipeline {
3
3
  background-image: image-url("#{$filename}.#{$extension}");
4
4
  }
@@ -1,44 +1,16 @@
1
1
  @mixin size($size) {
2
- @if length($size) == 1 {
3
- @if $size == auto {
4
- width: $size;
5
- height: $size;
6
- }
2
+ $height: nth($size, 1);
3
+ $width: $height;
7
4
 
8
- @else if unitless($size) {
9
- width: $size + px;
10
- height: $size + px;
11
- }
12
-
13
- @else if not(unitless($size)) {
14
- width: $size;
15
- height: $size;
16
- }
17
- }
18
-
19
- // Width x Height
20
- @if length($size) == 2 {
21
- $width: nth($size, 1);
5
+ @if length($size) > 1 {
22
6
  $height: nth($size, 2);
7
+ }
23
8
 
24
- @if $width == auto {
25
- width: $width;
26
- }
27
- @else if not(unitless($width)) {
28
- width: $width;
29
- }
30
- @else if unitless($width) {
31
- width: $width + px;
32
- }
9
+ @if $height == auto or (type-of($height) == number and not unitless($height)) {
10
+ height: $height;
11
+ }
33
12
 
34
- @if $height == auto {
35
- height: $height;
36
- }
37
- @else if not(unitless($height)) {
38
- height: $height;
39
- }
40
- @else if unitless($height) {
41
- height: $height + px;
42
- }
13
+ @if $width == auto or (type-of($height) == number and not unitless($width)) {
14
+ width: $width;
43
15
  }
44
16
  }
@@ -1,5 +1,5 @@
1
1
  // CSS cubic-bezier timing functions. Timing functions courtesy of jquery.easie (github.com/jaukia/easie)
2
- // Timing functions are the same as demo'ed here: http://jqueryui.com/resources/demos/effect/easing.html
2
+ // Timing functions are the same as demo'ed here: http://jqueryui.com/demos/effect/easing.html
3
3
 
4
4
  // EASE IN
5
5
  $ease-in-quad: cubic-bezier(0.550, 0.085, 0.680, 0.530);
@@ -14,7 +14,6 @@
14
14
  @if ($direction == up) or ($direction == down) or ($direction == right) or ($direction == left) {
15
15
 
16
16
  $width: $width / 2;
17
- $height: if(length($size) > 1, $height, $height/2);
18
17
 
19
18
  @if $direction == up {
20
19
  border-left: $width solid $background-color;
@@ -4,45 +4,39 @@
4
4
  //************************************************************************//
5
5
 
6
6
  @mixin background-image($images...) {
7
- background-image: _add-prefix($images, webkit);
8
- background-image: _add-prefix($images);
9
- }
7
+ $webkit-images: ();
8
+ $spec-images: ();
9
+
10
+ @each $image in $images {
11
+ $webkit-image: ();
12
+ $spec-image: ();
13
+
14
+ @if (type-of($image) == string) {
15
+ $url-str: str-slice($image, 0, 3);
16
+ $gradient-type: str-slice($image, 0, 6);
10
17
 
11
- @function _add-prefix($images, $vendor: false) {
12
- $images-prefixed: ();
13
- $gradient-positions: false;
14
- @for $i from 1 through length($images) {
15
- $type: type-of(nth($images, $i)); // Get type of variable - List or String
16
-
17
- // If variable is a list - Gradient
18
- @if $type == list {
19
- $gradient-type: nth(nth($images, $i), 1); // linear or radial
20
- $gradient-pos: null;
21
- $gradient-args: null;
22
-
23
- @if ($gradient-type == linear) or ($gradient-type == radial) {
24
- $gradient-pos: nth(nth($images, $i), 2); // Get gradient position
25
- $gradient-args: nth(nth($images, $i), 3); // Get actual gradient (red, blue)
18
+ @if $url-str == "url" {
19
+ $webkit-image: $image;
20
+ $spec-image: $image;
26
21
  }
27
- @else {
28
- $gradient-args: nth(nth($images, $i), 2); // Get actual gradient (red, blue)
22
+
23
+ @else if $gradient-type == "linear" {
24
+ $gradients: _linear-gradient-parser($image);
25
+ $webkit-image: map-get($gradients, webkit-image);
26
+ $spec-image: map-get($gradients, spec-image);
29
27
  }
30
28
 
31
- $gradient-positions: _gradient-positions-parser($gradient-type, $gradient-pos);
32
- $gradient: _render-gradients($gradient-positions, $gradient-args, $gradient-type, $vendor);
33
- $images-prefixed: append($images-prefixed, $gradient, comma);
34
- }
35
- // If variable is a string - Image
36
- @else if $type == string {
37
- $images-prefixed: join($images-prefixed, nth($images, $i), comma);
29
+ @else if $gradient-type == "radial" {
30
+ $gradients: _radial-gradient-parser($image);
31
+ $webkit-image: map-get($gradients, webkit-image);
32
+ $spec-image: map-get($gradients, spec-image);
33
+ }
38
34
  }
35
+
36
+ $webkit-images: append($webkit-images, $webkit-image, comma);
37
+ $spec-images: append($spec-images, $spec-image, comma);
39
38
  }
40
- @return $images-prefixed;
41
- }
42
39
 
43
- //Examples:
44
- //@include background-image(linear-gradient(top, orange, red));
45
- //@include background-image(radial-gradient(50% 50%, cover circle, orange, red));
46
- //@include background-image(url("/images/a.png"), linear-gradient(orange, red));
47
- //@include background-image(url("image.png"), linear-gradient(orange, red), url("image.png"));
48
- //@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));
40
+ background-image: $webkit-images;
41
+ background-image: $spec-images;
42
+ }
@@ -3,101 +3,53 @@
3
3
  // notation.
4
4
  //************************************************************************//
5
5
 
6
- @mixin background(
7
- $background-1 , $background-2: null,
8
- $background-3: null, $background-4: null,
9
- $background-5: null, $background-6: null,
10
- $background-7: null, $background-8: null,
11
- $background-9: null, $background-10: null,
12
- $fallback: null
13
- ) {
14
- $backgrounds: $background-1, $background-2,
15
- $background-3, $background-4,
16
- $background-5, $background-6,
17
- $background-7, $background-8,
18
- $background-9, $background-10;
6
+ @mixin background($backgrounds...) {
7
+ $webkit-backgrounds: ();
8
+ $spec-backgrounds: ();
19
9
 
20
- $fallback-color: false;
21
- @if (type-of($fallback) == color) or ($fallback == "transparent") {
22
- $fallback-color: $fallback;
23
- }
24
- @else {
25
- $fallback-color: _extract-background-color($backgrounds);
26
- }
27
-
28
- @if $fallback-color {
29
- background-color: $fallback-color;
30
- }
31
- background: _background-add-prefix($backgrounds, webkit);
32
- background: _background-add-prefix($backgrounds);
33
- }
34
-
35
- @function _extract-background-color($backgrounds) {
36
- $final-bg-layer: nth($backgrounds, length($backgrounds));
37
- @if type-of($final-bg-layer) == list {
38
- @for $i from 1 through length($final-bg-layer) {
39
- $value: nth($final-bg-layer, $i);
40
- @if type-of($value) == color {
41
- @return $value;
42
- }
43
- }
44
- }
45
- @return false;
46
- }
47
-
48
- @function _background-add-prefix($backgrounds, $vendor: false) {
49
- $backgrounds-prefixed: ();
10
+ @each $background in $backgrounds {
11
+ $webkit-background: ();
12
+ $spec-background: ();
13
+ $background-type: type-of($background);
50
14
 
51
- @for $i from 1 through length($backgrounds) {
52
- $shorthand: nth($backgrounds, $i); // Get member for current index
53
- $type: type-of($shorthand); // Get type of variable - List (gradient) or String (image)
15
+ @if $background-type == string or list {
16
+ $background-str: if($background-type == list, nth($background, 1), $background);
54
17
 
55
- // If shorthand is a list (gradient)
56
- @if $type == list {
57
- $first-member: nth($shorthand, 1); // Get first member of shorthand
18
+ $url-str: str-slice($background-str, 0, 3);
19
+ $gradient-type: str-slice($background-str, 0, 6);
58
20
 
59
- // Linear Gradient
60
- @if index(linear radial, nth($first-member, 1)) {
61
- $gradient-type: nth($first-member, 1); // linear || radial
62
- $gradient-args: false;
63
- $gradient-positions: false;
64
- $shorthand-start: false;
65
- @if type-of($first-member) == list { // Linear gradient plus additional shorthand values - lg(red,orange)repeat,...
66
- $gradient-positions: nth($first-member, 2);
67
- $gradient-args: nth($first-member, 3);
68
- $shorthand-start: 2;
69
- }
70
- @else { // Linear gradient only - lg(red,orange),...
71
- $gradient-positions: nth($shorthand, 2);
72
- $gradient-args: nth($shorthand, 3); // Get gradient (red, blue)
73
- }
21
+ @if $url-str == "url" {
22
+ $webkit-background: $background;
23
+ $spec-background: $background;
24
+ }
74
25
 
75
- $gradient-positions: _gradient-positions-parser($gradient-type, $gradient-positions);
76
- $gradient: _render-gradients($gradient-positions, $gradient-args, $gradient-type, $vendor);
26
+ @else if $gradient-type == "linear" {
27
+ $gradients: _linear-gradient-parser("#{$background}");
28
+ $webkit-background: map-get($gradients, webkit-image);
29
+ $spec-background: map-get($gradients, spec-image);
30
+ }
77
31
 
78
- // Append any additional shorthand args to gradient
79
- @if $shorthand-start {
80
- @for $j from $shorthand-start through length($shorthand) {
81
- $gradient: join($gradient, nth($shorthand, $j), space);
82
- }
83
- }
84
- $backgrounds-prefixed: append($backgrounds-prefixed, $gradient, comma);
32
+ @else if $gradient-type == "radial" {
33
+ $gradients: _radial-gradient-parser("#{$background}");
34
+ $webkit-background: map-get($gradients, webkit-image);
35
+ $spec-background: map-get($gradients, spec-image);
85
36
  }
86
- // Image with additional properties
37
+
87
38
  @else {
88
- $backgrounds-prefixed: append($backgrounds-prefixed, $shorthand, comma);
39
+ $webkit-background: $background;
40
+ $spec-background: $background;
89
41
  }
90
42
  }
91
- // If shorthand is a simple string (color or image)
92
- @else if $type == string {
93
- $backgrounds-prefixed: join($backgrounds-prefixed, $shorthand, comma);
43
+
44
+ @else {
45
+ $webkit-background: $background;
46
+ $spec-background: $background;
94
47
  }
48
+
49
+ $webkit-backgrounds: append($webkit-backgrounds, $webkit-background, comma);
50
+ $spec-backgrounds: append($spec-backgrounds, $spec-background, comma);
95
51
  }
96
- @return $backgrounds-prefixed;
97
- }
98
52
 
99
- //Examples:
100
- //@include background(linear-gradient(top, orange, red));
101
- //@include background(radial-gradient(circle at 40% 40%, orange, red));
102
- //@include background(url("/images/a.png") no-repeat, linear-gradient(orange, red));
103
- //@include background(url("image.png") center center, linear-gradient(orange, red), url("image.png"));
53
+ background: $webkit-backgrounds;
54
+ background: $spec-backgrounds;
55
+ }