bourbon 5.0.0.beta.5 → 5.0.0.beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -0
  3. data/CHANGELOG.md +9 -1
  4. data/CONTRIBUTING.md +1 -0
  5. data/RELEASING.md +7 -4
  6. data/bourbon.gemspec +6 -6
  7. data/bower.json +1 -1
  8. data/circle.yml +6 -0
  9. data/core/_bourbon.scss +7 -3
  10. data/core/bourbon/helpers/_buttons-list.scss +14 -0
  11. data/core/bourbon/helpers/_text-inputs-list.scss +26 -0
  12. data/core/bourbon/library/_border-radius.scss +55 -18
  13. data/core/bourbon/library/_buttons.scss +56 -32
  14. data/core/bourbon/library/_contrast-switch.scss +14 -3
  15. data/core/bourbon/library/_font-face.scss +21 -16
  16. data/core/bourbon/library/_hide-visually.scss +1 -1
  17. data/core/bourbon/library/_margin.scss +15 -6
  18. data/core/bourbon/library/_modular-scale.scss +3 -3
  19. data/core/bourbon/library/_padding.scss +13 -4
  20. data/core/bourbon/library/_prefixer.scss +1 -1
  21. data/core/bourbon/library/_shade.scss +6 -1
  22. data/core/bourbon/library/_size.scss +2 -2
  23. data/core/bourbon/library/_text-inputs.scss +91 -53
  24. data/core/bourbon/{helpers → library}/_timing-functions.scss +0 -0
  25. data/core/bourbon/library/_tint.scss +6 -1
  26. data/core/bourbon/library/_triangle.scss +3 -0
  27. data/core/bourbon/library/_value-prefixer.scss +38 -0
  28. data/core/bourbon/settings/_settings.scss +11 -1
  29. data/core/bourbon/utilities/{_bourbon-get-setting.scss → _retrieve-bourbon-setting.scss} +2 -2
  30. data/core/bourbon/validators/_is-color.scss +13 -0
  31. data/lib/bourbon/version.rb +1 -1
  32. data/package.json +1 -1
  33. data/spec/bourbon/library/prefixer_spec.rb +34 -0
  34. data/spec/bourbon/utilities/{bourbon_get_setting_spec.rb → retrieve_bourbon_setting_spec.rb} +2 -2
  35. data/spec/fixtures/library/prefixer.scss +13 -0
  36. data/spec/fixtures/utilities/assign-inputs.scss +4 -4
  37. data/spec/fixtures/utilities/{bourbon-get-setting.scss → retrieve-bourbon-setting.scss} +2 -2
  38. metadata +29 -20
@@ -54,7 +54,7 @@
54
54
  padding: 0;
55
55
  position: absolute;
56
56
  width: 1px;
57
- } @elseif $toggle == "unhide" {
57
+ } @else if $toggle == "unhide" {
58
58
  clip: auto;
59
59
  clip-path: none;
60
60
  height: auto;
@@ -7,15 +7,24 @@
7
7
  /// List of margin values, defined as CSS shorthand.
8
8
  ///
9
9
  /// @example scss
10
- /// .element {
11
- /// @include margin(null 10px 3em 20vh);
10
+ /// .element-one {
11
+ /// @include margin(null auto);
12
+ /// }
13
+ ///
14
+ /// .element-two {
15
+ /// @include margin(10px 3em 20vh null);
12
16
  /// }
13
17
  ///
14
18
  /// @example css
15
- /// .element {
16
- /// margin-bottom: 3em;
17
- /// margin-left: 20vh;
18
- /// margin-right: 10px;
19
+ /// .element-one {
20
+ /// margin-left: auto;
21
+ /// margin-right: auto;
22
+ /// }
23
+ ///
24
+ /// .element-two {
25
+ /// margin-bottom: 20vh;
26
+ /// margin-right: 3em;
27
+ /// margin-top: 10px;
19
28
  /// }
20
29
  ///
21
30
  /// @require {mixin} _directional-property
@@ -57,12 +57,12 @@
57
57
  /// font-size: 1.728em;
58
58
  /// }
59
59
  ///
60
- /// @require {function} _bourbon-get-setting
60
+ /// @require {function} _retrieve-bourbon-setting
61
61
 
62
62
  @function modular-scale(
63
63
  $increment,
64
- $value: _bourbon-get-setting("modular-scale-base"),
65
- $ratio: _bourbon-get-setting("modular-scale-ratio")
64
+ $value: _retrieve-bourbon-setting("modular-scale-base"),
65
+ $ratio: _retrieve-bourbon-setting("modular-scale-ratio")
66
66
  ) {
67
67
 
68
68
  $v1: nth($value, 1);
@@ -7,15 +7,24 @@
7
7
  /// List of padding values, defined as CSS shorthand.
8
8
  ///
9
9
  /// @example scss
10
- /// .element {
11
- /// @include padding(12vh null 10px 5%);
10
+ /// .element-one {
11
+ /// @include padding(null 1rem);
12
+ /// }
13
+ ///
14
+ /// .element-two {
15
+ /// @include padding(10vh null 10px 5%);
12
16
  /// }
13
17
  ///
14
18
  /// @example css
15
- /// .element {
19
+ /// .element-one {
20
+ /// padding-left: 1rem;
21
+ /// padding-right: 1rem;
22
+ /// }
23
+ ///
24
+ /// .element-two {
16
25
  /// padding-bottom: 10px;
17
26
  /// padding-left: 5%;
18
- /// padding-top: 12vh;
27
+ /// padding-top: 10vh;
19
28
  /// }
20
29
  ///
21
30
  /// @require {mixin} _directional-property
@@ -13,7 +13,7 @@
13
13
  ///
14
14
  /// @example scss
15
15
  /// .element {
16
- /// @include prefixer(appearance, none, webkit moz);
16
+ /// @include prefixer(appearance, none, ("webkit", "moz"));
17
17
  /// }
18
18
  ///
19
19
  /// @example css
@@ -24,5 +24,10 @@
24
24
  $percent
25
25
  ) {
26
26
 
27
- @return mix(#000, $color, $percent);
27
+ @if not _is-color($color) {
28
+ @error "`#{$color}` is not a valid color for the `$color` argument in " +
29
+ "the `shade` mixin.";
30
+ } @else {
31
+ @return mix(#000, $color, $percent);
32
+ }
28
33
  }
@@ -36,14 +36,14 @@
36
36
  @if _is-size($height) {
37
37
  height: $height;
38
38
  } @else {
39
- @error "`#{$height}` is not a valid length for the `$height` parameter " +
39
+ @error "`#{$height}` is not a valid length for the `$height` argument " +
40
40
  "in the `size` mixin.";
41
41
  }
42
42
 
43
43
  @if _is-size($width) {
44
44
  width: $width;
45
45
  } @else {
46
- @error "`#{$width}` is not a valid length for the `$width` parameter " +
46
+ @error "`#{$width}` is not a valid length for the `$width` argument " +
47
47
  "in the `size` mixin.";
48
48
  }
49
49
  }
@@ -1,13 +1,19 @@
1
1
  @charset "UTF-8";
2
2
 
3
- /// Generates variables for all text-based inputs. Please note that you must use
4
- /// interpolation on the variable: `#{$all-text-inputs}`.
5
- ///
3
+ ////
6
4
  /// @type list
7
5
  ///
6
+ /// @require {function} _assign-inputs
7
+ ///
8
+ /// @require {variable} $_text-inputs-list
9
+ ////
10
+
11
+ /// A list of all _text-based_ HTML inputs. Please note that you must
12
+ /// interpolate the variable (`#{}`) to use it as a selector.
13
+ ///
8
14
  /// @example scss
9
15
  /// #{$all-text-inputs} {
10
- /// border: 1px solid #f00;
16
+ /// border: 1px solid #ccc;
11
17
  /// }
12
18
  ///
13
19
  /// @example css
@@ -27,13 +33,49 @@
27
33
  /// [type='week'],
28
34
  /// input:not([type]),
29
35
  /// textarea {
30
- /// border: 1px solid #f00;
36
+ /// border: 1px solid #ccc;
31
37
  /// }
38
+
39
+ $all-text-inputs: _assign-inputs($_text-inputs-list);
40
+
41
+ /// A list of all _text-based_ HTML inputs with the `:active` pseudo-class
42
+ /// applied. Please note that you must interpolate the variable (`#{}`) to use
43
+ /// it as a selector.
32
44
  ///
33
45
  /// @example scss
34
- /// #{$all-text-inputs-focus},
35
- /// #{$all-text-inputs-hover} {
36
- /// border: 1px solid #0f0;
46
+ /// #{$all-text-inputs-active} {
47
+ /// border: 1px solid #aaa;
48
+ /// }
49
+ ///
50
+ /// @example css
51
+ /// [type='color']:active,
52
+ /// [type='date']:active,
53
+ /// [type='datetime']:active,
54
+ /// [type='datetime-local']:active,
55
+ /// [type='email']:active,
56
+ /// [type='month']:active,
57
+ /// [type='number']:active,
58
+ /// [type='password']:active,
59
+ /// [type='search']:active,
60
+ /// [type='tel']:active,
61
+ /// [type='text']:active,
62
+ /// [type='time']:active,
63
+ /// [type='url']:active,
64
+ /// [type='week']:active,
65
+ /// input:not([type]):active,
66
+ /// textarea:active {
67
+ /// border: 1px solid #aaa;
68
+ /// }
69
+
70
+ $all-text-inputs-active: _assign-inputs($_text-inputs-list, active);
71
+
72
+ /// A list of all _text-based_ HTML inputs with the `:focus` pseudo-class
73
+ /// applied. Please note that you must interpolate the variable (`#{}`) to use
74
+ /// it as a selector.
75
+ ///
76
+ /// @example scss
77
+ /// #{$all-text-inputs-focus} {
78
+ /// border: 1px solid #1565c0;
37
79
  /// }
38
80
  ///
39
81
  /// @example css
@@ -52,7 +94,22 @@
52
94
  /// [type='url']:focus,
53
95
  /// [type='week']:focus,
54
96
  /// input:not([type]):focus,
55
- /// textarea:focus,
97
+ /// textarea:focus {
98
+ /// border: 1px solid #1565c0;
99
+ /// }
100
+
101
+ $all-text-inputs-focus: _assign-inputs($_text-inputs-list, focus);
102
+
103
+ /// A list of all _text-based_ HTML inputs with the `:hover` pseudo-class
104
+ /// applied. Please note that you must interpolate the variable (`#{}`) to use
105
+ /// it as a selector.
106
+ ///
107
+ /// @example scss
108
+ /// #{$all-text-inputs-hover} {
109
+ /// border: 1px solid #aaa;
110
+ /// }
111
+ ///
112
+ /// @example css
56
113
  /// [type='color']:hover,
57
114
  /// [type='date']:hover,
58
115
  /// [type='datetime']:hover,
@@ -69,57 +126,38 @@
69
126
  /// [type='week']:hover,
70
127
  /// input:not([type]):hover,
71
128
  /// textarea:hover {
72
- /// border: 1px solid #0f0;
129
+ /// border: 1px solid #aaa;
73
130
  /// }
131
+
132
+ $all-text-inputs-hover: _assign-inputs($_text-inputs-list, hover);
133
+
134
+ /// A list of all _text-based_ HTML inputs with the `:invalid` pseudo-class
135
+ /// applied. Please note that you must interpolate the variable (`#{}`) to use
136
+ /// it as a selector.
74
137
  ///
75
138
  /// @example scss
76
- /// #{$all-text-inputs-active} {
139
+ /// #{$all-text-inputs-invalid} {
77
140
  /// border: 1px solid #00f;
78
141
  /// }
79
142
  ///
80
143
  /// @example css
81
- /// [type='color']:active,
82
- /// [type='date']:active,
83
- /// [type='datetime']:active,
84
- /// [type='datetime-local']:active,
85
- /// [type='email']:active,
86
- /// [type='month']:active,
87
- /// [type='number']:active,
88
- /// [type='password']:active,
89
- /// [type='search']:active,
90
- /// [type='tel']:active,
91
- /// [type='text']:active,
92
- /// [type='time']:active,
93
- /// [type='url']:active,
94
- /// [type='week']:active,
95
- /// input:not([type]):active,
96
- /// textarea:active {
144
+ /// [type='color']:invalid,
145
+ /// [type='date']:invalid,
146
+ /// [type='datetime']:invalid,
147
+ /// [type='datetime-local']:invalid,
148
+ /// [type='email']:invalid,
149
+ /// [type='month']:invalid,
150
+ /// [type='number']:invalid,
151
+ /// [type='password']:invalid,
152
+ /// [type='search']:invalid,
153
+ /// [type='tel']:invalid,
154
+ /// [type='text']:invalid,
155
+ /// [type='time']:invalid,
156
+ /// [type='url']:invalid,
157
+ /// [type='week']:invalid,
158
+ /// input:not([type]):invalid,
159
+ /// textarea:invalid {
97
160
  /// border: 1px solid #00f;
98
161
  /// }
99
- ///
100
- /// @require {function} _assign-inputs
101
-
102
- $text-inputs-list: (
103
- "[type='color']",
104
- "[type='date']",
105
- "[type='datetime']",
106
- "[type='datetime-local']",
107
- "[type='email']",
108
- "[type='month']",
109
- "[type='number']",
110
- "[type='password']",
111
- "[type='search']",
112
- "[type='tel']",
113
- "[type='text']",
114
- "[type='time']",
115
- "[type='url']",
116
- "[type='week']",
117
- "input:not([type])",
118
- "textarea",
119
- );
120
162
 
121
- $all-text-inputs: _assign-inputs($text-inputs-list);
122
- $all-text-inputs-active: _assign-inputs($text-inputs-list, active);
123
- $all-text-inputs-focus: _assign-inputs($text-inputs-list, focus);
124
- $all-text-inputs-hover: _assign-inputs($text-inputs-list, hover);
125
- $all-text-inputs-invalid: _assign-inputs($text-inputs-list, invalid);
163
+ $all-text-inputs-invalid: _assign-inputs($_text-inputs-list, invalid);
@@ -24,5 +24,10 @@
24
24
  $percent
25
25
  ) {
26
26
 
27
- @return mix(#fff, $color, $percent);
27
+ @if not _is-color($color) {
28
+ @error "`#{$color}` is not a valid color for the `$color` argument in " +
29
+ "the `tint` mixin.";
30
+ } @else {
31
+ @return mix(#fff, $color, $percent);
32
+ }
28
33
  }
@@ -45,6 +45,9 @@
45
45
  ) {
46
46
  @error "Direction must be `up`, `up-right`, `right`, `down-right`, " +
47
47
  "`down`, `down-left`, `left` or `up-left`.";
48
+ } @else if not _is-color($color) {
49
+ @error "`#{$color}` is not a valid color for the `$color` argument in " +
50
+ "the `triangle` mixin.";
48
51
  } @else {
49
52
  border-style: solid;
50
53
  height: 0;
@@ -0,0 +1,38 @@
1
+ @charset "UTF-8";
2
+
3
+ /// Generates vendor prefixes for values.
4
+ ///
5
+ /// @argument {string} $property
6
+ /// Property to use.
7
+ ///
8
+ /// @argument {string} $value
9
+ /// Value to prefix.
10
+ ///
11
+ /// @argument {list} $prefixes
12
+ /// Vendor prefixes to output.
13
+ ///
14
+ /// @example scss
15
+ /// .element {
16
+ /// @include value-prefixer(cursor, grab, ("webkit", "moz"));
17
+ /// }
18
+ ///
19
+ /// @example css
20
+ /// .element {
21
+ /// cursor: -webkit-grab;
22
+ /// cursor: -moz-grab;
23
+ /// cursor: grab;
24
+ /// }
25
+ ///
26
+ /// @author Matthew Tobiasz
27
+
28
+ @mixin value-prefixer(
29
+ $property,
30
+ $value,
31
+ $prefixes: ()
32
+ ) {
33
+
34
+ @each $prefix in $prefixes {
35
+ #{$property}: #{"-" + $prefix + "-" + $value};
36
+ }
37
+ #{$property}: $value;
38
+ }
@@ -34,8 +34,18 @@ $_bourbon-defaults: (
34
34
  "rails-asset-pipeline": false,
35
35
  );
36
36
 
37
- /// User overrides of Bourbon configuration settings
37
+ /// User overrides of Bourbon configuration settings.
38
38
  ///
39
39
  /// @type map
40
+ ///
41
+ /// @example scss
42
+ /// $bourbon: (
43
+ /// "contrast-switch-dark-color": #000,
44
+ /// "contrast-switch-light-color": #fff,
45
+ /// "global-font-file-formats": ("ttf", "woff2", "woff"),
46
+ /// "modular-scale-base": 1em,
47
+ /// "modular-scale-ratio": $major-third,
48
+ /// "rails-asset-pipeline": false,
49
+ /// );
40
50
 
41
51
  $bourbon: () !default;
@@ -7,10 +7,10 @@
7
7
  /// @return {boolean | color | list | number | string}
8
8
  ///
9
9
  /// @example scss
10
- /// _bourbon-get-setting(rails-asset-pipeline)
10
+ /// _retrieve-bourbon-setting(rails-asset-pipeline)
11
11
  ///
12
12
  /// @access private
13
13
 
14
- @function _bourbon-get-setting($setting) {
14
+ @function _retrieve-bourbon-setting($setting) {
15
15
  @return map-get(map-merge($_bourbon-defaults, $bourbon), $setting);
16
16
  }
@@ -0,0 +1,13 @@
1
+ @charset "UTF-8";
2
+
3
+ /// Checks for a valid CSS color.
4
+ ///
5
+ /// @argument {string} $color
6
+ ///
7
+ /// @return {boolean}
8
+ ///
9
+ /// @access private
10
+
11
+ @function _is-color($color) {
12
+ @return (type-of($color) == color) or ($color == "currentColor");
13
+ }
@@ -1,3 +1,3 @@
1
1
  module Bourbon
2
- VERSION = "5.0.0.beta.5"
2
+ VERSION = "5.0.0.beta.6"
3
3
  end
@@ -29,5 +29,5 @@
29
29
  "scripts": {
30
30
  "test": "bundle exec rake"
31
31
  },
32
- "version": "5.0.0-beta.5"
32
+ "version": "5.0.0-beta.6"
33
33
  }
@@ -0,0 +1,34 @@
1
+ require "spec_helper"
2
+
3
+ describe "prefixer" do
4
+ before(:all) do
5
+ ParserSupport.parse_file("library/prefixer")
6
+ end
7
+
8
+ context "called with no prefixes" do
9
+ it "outputs the spec" do
10
+ rule = "appearance: none;"
11
+
12
+ expect(".prefix").to have_ruleset(rule)
13
+ end
14
+ end
15
+
16
+ context "called with one prefix" do
17
+ it "applies the prefix to the property" do
18
+ rule = "-webkit-appearance: none; " +
19
+ "appearance: none;"
20
+
21
+ expect(".prefix--webkit").to have_ruleset(rule)
22
+ end
23
+ end
24
+
25
+ context "called with multiple prefixes" do
26
+ it "applies the prefixes to the property" do
27
+ rule = "-moz-appearance: none; " +
28
+ "-ms-appearance: none; " +
29
+ "appearance: none;"
30
+
31
+ expect(".prefix--moz-ms").to have_ruleset(rule)
32
+ end
33
+ end
34
+ end