bourbon 5.0.1 → 7.1.0
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.
- checksums.yaml +5 -5
- data/.circleci/config.yml +6 -16
- data/.hound.yml +4 -1
- data/.npmignore +2 -3
- data/.stylelintrc.json +3 -0
- data/.tool-versions +2 -1
- data/CHANGELOG.md +46 -3
- data/CONTRIBUTING.md +5 -1
- data/LICENSE.md +1 -1
- data/README.md +4 -20
- data/RELEASING.md +8 -11
- data/bourbon.gemspec +3 -4
- data/core/_bourbon.scss +2 -2
- data/core/bourbon/helpers/_scales.scss +16 -16
- data/core/bourbon/library/_contrast-switch.scss +3 -3
- data/core/bourbon/library/_font-face.scss +6 -6
- data/core/bourbon/library/_font-stacks.scss +2 -3
- data/core/bourbon/library/_hide-visually.scss +1 -1
- data/core/bourbon/library/_modular-scale.scss +7 -5
- data/core/bourbon/library/_overflow-wrap.scss +1 -0
- data/core/bourbon/library/_position.scss +4 -4
- data/core/bourbon/library/_shade.scss +1 -1
- data/core/bourbon/library/_size.scss +2 -2
- data/core/bourbon/library/_strip-unit.scss +3 -1
- data/core/bourbon/library/_timing-functions.scss +24 -26
- data/core/bourbon/library/_tint.scss +1 -1
- data/core/bourbon/library/_triangle.scss +6 -6
- data/core/bourbon/settings/_settings.scss +4 -4
- data/core/bourbon/utilities/_compact-shorthand.scss +9 -6
- data/core/bourbon/utilities/_contrast-ratio.scss +4 -2
- data/core/bourbon/utilities/_directional-property.scss +4 -6
- data/core/bourbon/utilities/_font-source-declaration.scss +10 -9
- data/core/bourbon/utilities/_gamma.scss +10 -5
- data/core/bourbon/utilities/_lightness.scss +5 -3
- data/core/bourbon/validators/_is-length.scss +8 -3
- data/core/bourbon/validators/_is-size.scss +1 -1
- data/lib/bourbon/version.rb +1 -1
- data/lib/bourbon.rb +6 -3
- data/package-lock.json +6636 -0
- data/package.json +8 -1
- data/spec/bourbon/library/font_face_spec_1.rb +2 -2
- data/spec/bourbon/library/font_face_spec_2.rb +2 -3
- data/spec/bourbon/library/font_face_spec_3.rb +1 -1
- data/spec/bourbon/library/font_stacks_spec.rb +4 -4
- data/spec/bourbon/utilities/font_source_declaration_spec.rb +4 -10
- data/spec/bourbon/utilities/gamma_spec.rb +1 -1
- data/spec/bourbon/utilities/lightness_spec.rb +1 -1
- data/spec/bourbon/validators/is_length_spec.rb +12 -0
- data/spec/fixtures/utilities/font-source-declaration.scss +1 -1
- data/spec/fixtures/validators/is-length.scss +8 -0
- data/spec/support/sass_support.rb +2 -2
- metadata +19 -39
- data/.ruby-version +0 -1
- data/.scss-lint.yml +0 -247
- data/bower.json +0 -39
- data/spec/bourbon/library/font_face_spec_4.rb +0 -17
- data/spec/fixtures/library/font-face-4.scss +0 -7
@@ -11,7 +11,7 @@
|
|
11
11
|
/// @property {color} contrast-switch-light-color [#fff]
|
12
12
|
/// Global light color for the `contrast-switch` function.
|
13
13
|
///
|
14
|
-
/// @property {list} global-font-file-formats [("
|
14
|
+
/// @property {list} global-font-file-formats [("woff2", "woff")]
|
15
15
|
/// Global font file formats for the `font-face` mixin.
|
16
16
|
///
|
17
17
|
/// @property {number (with unit)} modular-scale-base [1em]
|
@@ -30,7 +30,7 @@
|
|
30
30
|
$_bourbon-defaults: (
|
31
31
|
"contrast-switch-dark-color": #000,
|
32
32
|
"contrast-switch-light-color": #fff,
|
33
|
-
"global-font-file-formats": ("
|
33
|
+
"global-font-file-formats": ("woff2", "woff"),
|
34
34
|
"modular-scale-base": 1em,
|
35
35
|
"modular-scale-ratio": $major-third,
|
36
36
|
"rails-asset-pipeline": false,
|
@@ -48,7 +48,7 @@ $_bourbon-defaults: (
|
|
48
48
|
/// @property {color} contrast-switch-light-color [#fff]
|
49
49
|
/// Global light color for the `contrast-switch` function.
|
50
50
|
///
|
51
|
-
/// @property {list} global-font-file-formats [("
|
51
|
+
/// @property {list} global-font-file-formats [("woff2", "woff")]
|
52
52
|
/// Global font file formats for the `font-face` mixin.
|
53
53
|
///
|
54
54
|
/// @property {number (with unit)} modular-scale-base [1em]
|
@@ -66,7 +66,7 @@ $_bourbon-defaults: (
|
|
66
66
|
/// $bourbon: (
|
67
67
|
/// "contrast-switch-dark-color": #000,
|
68
68
|
/// "contrast-switch-light-color": #fff,
|
69
|
-
/// "global-font-file-formats": ("
|
69
|
+
/// "global-font-file-formats": ("woff2", "woff"),
|
70
70
|
/// "modular-scale-base": 1em,
|
71
71
|
/// "modular-scale-ratio": $major-third,
|
72
72
|
/// "rails-asset-pipeline": false,
|
@@ -1,7 +1,5 @@
|
|
1
1
|
@charset "UTF-8";
|
2
2
|
|
3
|
-
// scss-lint:disable ElsePlacement
|
4
|
-
|
5
3
|
/// Transforms shorthand to its shortest possible form.
|
6
4
|
///
|
7
5
|
/// @argument {list} $values
|
@@ -30,10 +28,15 @@
|
|
30
28
|
@if $c == 0 { $c: 0; }
|
31
29
|
@if $d == 0 { $d: 0; }
|
32
30
|
|
33
|
-
@if $a == $b and $a == $c and $a == $d {
|
34
|
-
|
35
|
-
@else if $
|
36
|
-
|
31
|
+
@if $a == $b and $a == $c and $a == $d {
|
32
|
+
$output: $a;
|
33
|
+
} @else if $a == $c and $b == $d {
|
34
|
+
$output: $a $b;
|
35
|
+
} @else if $b == $d {
|
36
|
+
$output: $a $b $c;
|
37
|
+
} @else {
|
38
|
+
$output: $a $b $c $d;
|
39
|
+
}
|
37
40
|
|
38
41
|
@return $output;
|
39
42
|
}
|
@@ -19,13 +19,15 @@
|
|
19
19
|
///
|
20
20
|
/// @access private
|
21
21
|
|
22
|
+
@use "sass:math";
|
23
|
+
|
22
24
|
@function _contrast-ratio($color-1, $color-2) {
|
23
25
|
$-local-lightness-1: _lightness($color-1) + 0.05;
|
24
26
|
$-local-lightness-2: _lightness($color-2) + 0.05;
|
25
27
|
|
26
28
|
@if $-local-lightness-1 > $-local-lightness-2 {
|
27
|
-
@return $-local-lightness-1
|
29
|
+
@return math.div($-local-lightness-1, $-local-lightness-2);
|
28
30
|
} @else {
|
29
|
-
@return $-local-lightness-2
|
31
|
+
@return math.div($-local-lightness-2, $-local-lightness-1);
|
30
32
|
}
|
31
33
|
}
|
@@ -1,7 +1,5 @@
|
|
1
1
|
@charset "UTF-8";
|
2
2
|
|
3
|
-
// scss-lint:disable SpaceAroundOperator
|
4
|
-
|
5
3
|
/// Builds directional properties by parsing CSS shorthand values. For example,
|
6
4
|
/// a value of `10px null` will output top and bottom directional properties,
|
7
5
|
/// but the `null` skips left and right from being output.
|
@@ -37,11 +35,11 @@
|
|
37
35
|
$suffix,
|
38
36
|
$values
|
39
37
|
) {
|
40
|
-
$top:
|
38
|
+
$top: $property + "-top" + if($suffix, "-#{$suffix}", "");
|
41
39
|
$bottom: $property + "-bottom" + if($suffix, "-#{$suffix}", "");
|
42
|
-
$left:
|
43
|
-
$right:
|
44
|
-
$all:
|
40
|
+
$left: $property + "-left" + if($suffix, "-#{$suffix}", "");
|
41
|
+
$right: $property + "-right" + if($suffix, "-#{$suffix}", "");
|
42
|
+
$all: $property + if($suffix, "-#{$suffix}", "");
|
45
43
|
|
46
44
|
$values: _compact-shorthand($values);
|
47
45
|
|
@@ -27,23 +27,24 @@
|
|
27
27
|
$src: ();
|
28
28
|
|
29
29
|
$formats-map: (
|
30
|
-
|
31
|
-
|
32
|
-
woff: "#{$file-path}.woff" format("woff"),
|
33
|
-
ttf: "#{$file-path}.ttf" format("truetype"),
|
34
|
-
svg: "#{$file-path}.svg##{$font-family}" format("svg"),
|
30
|
+
"woff2": "#{$file-path}.woff2" format("woff2"),
|
31
|
+
"woff": "#{$file-path}.woff" format("woff"),
|
35
32
|
);
|
36
33
|
|
37
|
-
@each $
|
38
|
-
@if _contains($
|
39
|
-
$
|
40
|
-
$
|
34
|
+
@each $format in $file-formats {
|
35
|
+
@if _contains(map-keys($formats-map), $format) {
|
36
|
+
$value: map-get($formats-map, $format);
|
37
|
+
$file-path: nth($value, 1);
|
38
|
+
$font-format: nth($value, 2);
|
41
39
|
|
42
40
|
@if $asset-pipeline == true {
|
43
41
|
$src: append($src, font-url($file-path) $font-format, comma);
|
44
42
|
} @else {
|
45
43
|
$src: append($src, url($file-path) $font-format, comma);
|
46
44
|
}
|
45
|
+
} @else {
|
46
|
+
@error "`#{$file-formats}` contains an unsupported font file format. " +
|
47
|
+
"Must be `woff` and/or `woff2`.";
|
47
48
|
}
|
48
49
|
}
|
49
50
|
|
@@ -2,8 +2,7 @@
|
|
2
2
|
|
3
3
|
/// Performs gamma correction on a single color channel.
|
4
4
|
///
|
5
|
-
/// Note that
|
6
|
-
/// is approximate.
|
5
|
+
/// Note that the calculation is approximate if a `pow()` is not available.
|
7
6
|
///
|
8
7
|
/// @argument {number (0-1)} $channel
|
9
8
|
///
|
@@ -11,11 +10,17 @@
|
|
11
10
|
///
|
12
11
|
/// @access private
|
13
12
|
|
13
|
+
@use "sass:math";
|
14
|
+
|
14
15
|
@function _gamma($channel) {
|
15
16
|
@if $channel < 0.03928 {
|
16
|
-
@return $channel
|
17
|
+
@return math.div($channel, 12.92);
|
17
18
|
} @else {
|
18
|
-
$c: ($channel + 0.055
|
19
|
-
@
|
19
|
+
$c: math.div($channel + 0.055, 1.055);
|
20
|
+
@if function-exists("pow") {
|
21
|
+
@return pow($c, 2.4);
|
22
|
+
} @else {
|
23
|
+
@return 0.56 * $c * $c * $c + 0.44 * $c * $c;
|
24
|
+
}
|
20
25
|
}
|
21
26
|
}
|
@@ -11,14 +11,16 @@
|
|
11
11
|
///
|
12
12
|
/// @access private
|
13
13
|
|
14
|
+
@use "sass:math";
|
15
|
+
|
14
16
|
@function _lightness($hex-color) {
|
15
17
|
$-local-red-raw: red(rgba($hex-color, 1));
|
16
18
|
$-local-green-raw: green(rgba($hex-color, 1));
|
17
19
|
$-local-blue-raw: blue(rgba($hex-color, 1));
|
18
20
|
|
19
|
-
$-local-red: _gamma($-local-red-raw
|
20
|
-
$-local-green: _gamma($-local-green-raw
|
21
|
-
$-local-blue: _gamma($-local-blue-raw
|
21
|
+
$-local-red: _gamma(math.div($-local-red-raw, 255));
|
22
|
+
$-local-green: _gamma(math.div($-local-green-raw, 255));
|
23
|
+
$-local-blue: _gamma(math.div($-local-blue-raw, 255));
|
22
24
|
|
23
25
|
@return $-local-red * 0.2126 + $-local-green * 0.7152 + $-local-blue * 0.0722;
|
24
26
|
}
|
@@ -9,7 +9,12 @@
|
|
9
9
|
/// @access private
|
10
10
|
|
11
11
|
@function _is-length($value) {
|
12
|
-
@return type-of($value) != "null"
|
13
|
-
|
14
|
-
|
12
|
+
@return type-of($value) != "null"
|
13
|
+
and (
|
14
|
+
str-slice($value + "", 1, 4) == "calc"
|
15
|
+
or str-slice($value + "", 1, 3) == "var"
|
16
|
+
or str-slice($value + "", 1, 3) == "env"
|
17
|
+
or index(auto inherit initial 0, $value)
|
18
|
+
or (type-of($value) == "number" and not(unitless($value)))
|
19
|
+
);
|
15
20
|
}
|
data/lib/bourbon/version.rb
CHANGED
data/lib/bourbon.rb
CHANGED
@@ -1,12 +1,15 @@
|
|
1
|
-
require "sass"
|
2
1
|
require "bourbon/generator"
|
3
2
|
|
4
3
|
module Bourbon
|
5
4
|
if defined?(Rails) && defined?(Rails::Engine)
|
6
5
|
class Engine < ::Rails::Engine
|
7
|
-
config.assets.paths << File.expand_path("
|
6
|
+
config.assets.paths << File.expand_path("../core", __dir__)
|
8
7
|
end
|
9
8
|
else
|
10
|
-
|
9
|
+
begin
|
10
|
+
require "sass"
|
11
|
+
Sass.load_paths << File.expand_path("../core", __dir__)
|
12
|
+
rescue LoadError
|
13
|
+
end
|
11
14
|
end
|
12
15
|
end
|