SassyJSON 1.0.10 → 1.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -0
- data/lib/SassyJSON.rb +1 -1
- data/stylesheets/decode/helpers/color/_color.scss +14 -9
- data/stylesheets/decode/helpers/color/_get-color-value.scss +4 -0
- data/stylesheets/decode/helpers/color/_hex.scss +2 -1
- data/stylesheets/decode/helpers/color/_hsl.scss +4 -3
- data/stylesheets/decode/helpers/color/_rgb.scss +3 -2
- data/stylesheets/decode/helpers/number/_find-digits.scss +2 -1
- data/stylesheets/decode/helpers/number/_find-exponent.scss +9 -2
- data/stylesheets/decode/helpers/number/_find-integer.scss +2 -1
- data/stylesheets/decode/helpers/string/_length.scss +4 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b252de6ac6970e21a3b2cdcdfecbc263064be64d
|
4
|
+
data.tar.gz: 98888fa1e6ace45183f65b96809eb4945a211376
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed3b1b5469126f55682340b2f0957ff2bcc13faa9c289a280e35c3a4c97c960627b50941378dd1dfa1c5e611719627be10151946b849e91762d94e54cad492b0
|
7
|
+
data.tar.gz: c319e4e58baa7e2cd4316a227ac2809eb6a9ae67fb9e413ad537e65298b81d18b5c97c13358d2afa94216d02ce9274b9e10cedb709a6aedb87ba596c666e94b1
|
data/CHANGELOG.md
CHANGED
data/lib/SassyJSON.rb
CHANGED
@@ -5,7 +5,7 @@ Compass::Frameworks.register('SassyJSON', :path => extension_path)
|
|
5
5
|
# Version is a number. If a version contains alphas, it will be created as a prerelease version
|
6
6
|
# Date is in the form of YYYY-MM-DD
|
7
7
|
module SassyJSON
|
8
|
-
VERSION = "1.0.
|
8
|
+
VERSION = "1.0.11"
|
9
9
|
DATE = "2014-01-23"
|
10
10
|
end
|
11
11
|
|
@@ -9,32 +9,37 @@
|
|
9
9
|
@return $string;
|
10
10
|
}
|
11
11
|
|
12
|
-
$string: to-lower-case($string);
|
13
|
-
$
|
14
|
-
$
|
12
|
+
$string-lower: to-lower-case($string);
|
13
|
+
$colors: transparent black silver gray white maroon red purple fuchsia green lime olive yellow navy blue teal aqua aliceblue antiquewhite aqua aquamarine azure beige bisque black blanchedalmond blue blueviolet brown burlywood cadetblue chartreuse chocolate coral cornflowerblue cornsilk crimson cyan darkblue darkcyan darkgoldenrod darkgray darkgreen darkgrey darkkhaki darkmagenta darkolivegreen darkorange darkorchid darkred darksalmon darkseagreen darkslateblue darkslategray darkslategrey darkturquoise darkviolet deeppink deepskyblue dimgray dimgrey dodgerblue firebrick floralwhite forestgreen fuchsia gainsboro ghostwhite gold goldenrod gray green greenyellow grey honeydew hotpink indianred indigo ivory khaki lavender lavenderblush lawngreen lemonchiffon lightblue lightcoral lightcyan lightgoldenrodyellow lightgray lightgreen lightgrey lightpink lightsalmon lightseagreen lightskyblue lightslategray lightslategrey lightsteelblue lightyellow lime limegreen linen magenta maroon mediumaquamarine mediumblue mediumorchid mediumpurple mediumseagreen mediumslateblue mediumspringgreen mediumturquoise mediumvioletred midnightblue mintcream mistyrose moccasin navajowhite navy oldlace olive olivedrab orange orangered orchid palegoldenrod palegreen paleturquoise palevioletred papayawhip peachpuff peru pink plum powderblue purple red rosybrown royalblue saddlebrown salmon sandybrown seagreen seashell sienna silver skyblue slateblue slategray slategrey snow springgreen steelblue tan teal thistle tomato turquoise violet wheat white whitesmoke yellow yellowgreen;
|
14
|
+
$keywords: ();
|
15
|
+
|
16
|
+
// Filling $keywords with stringified color keywords
|
17
|
+
@each $color in $colors {
|
18
|
+
$keywords: append($keywords, $color + "");
|
19
|
+
}
|
15
20
|
|
16
21
|
// Deal with inherit keyword
|
17
|
-
@if $string == "inherit" {
|
22
|
+
@if $string-lower == "inherit" {
|
18
23
|
@return unquote($string);
|
19
24
|
}
|
20
25
|
|
21
26
|
// Deal with color keywords
|
22
|
-
@if index($keywords, $string) {
|
23
|
-
@return nth($colors, index($keywords, $string));
|
27
|
+
@if index($keywords, $string-lower) {
|
28
|
+
@return nth($colors, index($keywords, $string-lower));
|
24
29
|
}
|
25
30
|
|
26
31
|
// Deal with hexadecimal triplets
|
27
|
-
@else if str-slice($string, 1, 1) == '#' {
|
32
|
+
@else if str-slice($string-lower, 1, 1) == '#' {
|
28
33
|
@return _from-hex($string);
|
29
34
|
}
|
30
35
|
|
31
36
|
// Deal with rgb(a) colors
|
32
|
-
@else if str-slice($string, 1, 3) == 'rgb' {
|
37
|
+
@else if str-slice($string-lower, 1, 3) == 'rgb' {
|
33
38
|
@return _from-rgb($string);
|
34
39
|
}
|
35
40
|
|
36
41
|
// Deal with hsl(a) colors
|
37
|
-
@else if str-slice($string, 1, 3) == 'hsl' {
|
42
|
+
@else if str-slice($string-lower, 1, 3) == 'hsl' {
|
38
43
|
@return _from-hsl($string);
|
39
44
|
}
|
40
45
|
|
@@ -6,10 +6,14 @@
|
|
6
6
|
|
7
7
|
@function _get-color-value($string) {
|
8
8
|
$first: str-slice($string, 1, 1);
|
9
|
+
|
10
|
+
// Pad <1 values with a leading 0
|
9
11
|
@if $first == '.' {
|
10
12
|
$string: '0' + $string;
|
11
13
|
}
|
14
|
+
|
12
15
|
$last: str-slice($string, -1, -1);
|
16
|
+
|
13
17
|
@return if(
|
14
18
|
$last == '%',
|
15
19
|
nth(_json-decode--number(str-slice($string, 1, -2), 2), 2) * 1%,
|
@@ -5,6 +5,7 @@
|
|
5
5
|
// @return [color|string] string or hex color depending on the match
|
6
6
|
|
7
7
|
@function _from-hex($string) {
|
8
|
+
$string-lower: to-lower-case($string);
|
8
9
|
$r: ""; $g: ""; $b: "";
|
9
10
|
$hex: "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "a" "b" "c" "d" "e" "f";
|
10
11
|
$length: str-length($string);
|
@@ -17,7 +18,7 @@
|
|
17
18
|
|
18
19
|
// Loop from the second character (omitting #)
|
19
20
|
@for $i from 2 through $length {
|
20
|
-
$c:
|
21
|
+
$c: str-slice($string-lower, $i, $i);
|
21
22
|
|
22
23
|
// If wrong character, return
|
23
24
|
@if not index($hex, $c) {
|
@@ -6,12 +6,13 @@
|
|
6
6
|
|
7
7
|
@function _from-hsl($string) {
|
8
8
|
$frags: ();
|
9
|
-
$
|
10
|
-
$
|
9
|
+
$string-lower: to-lower-case($string);
|
10
|
+
$is-alpha: str-slice($string-lower, 4, 4) == 'a';
|
11
11
|
$length: str-length($string);
|
12
|
+
$start: str-index($string, "(");
|
12
13
|
|
13
14
|
@for $i from $start through $length {
|
14
|
-
$token: str-slice($string, $i, $i);
|
15
|
+
$token: str-slice($string-lower, $i, $i);
|
15
16
|
@if $token == ' ' {
|
16
17
|
// @continue;
|
17
18
|
}
|
@@ -5,13 +5,14 @@
|
|
5
5
|
// @return [color|string] string or rgb(a) color depending on the match
|
6
6
|
|
7
7
|
@function _from-rgb($string) {
|
8
|
+
$string-lower: to-lower-case($string);
|
8
9
|
$frags: ();
|
9
|
-
$is-alpha: str-slice($string, 4, 4) == 'a';
|
10
|
+
$is-alpha: str-slice($string-lower, 4, 4) == 'a';
|
10
11
|
$start: str-index($string, "(");
|
11
12
|
$length: str-length($string);
|
12
13
|
|
13
14
|
@for $i from $start through $length {
|
14
|
-
$token: str-slice($string, $i, $i);
|
15
|
+
$token: str-slice($string-lower, $i, $i);
|
15
16
|
@if $token == ' ' {
|
16
17
|
// @continue;
|
17
18
|
}
|
@@ -8,13 +8,14 @@
|
|
8
8
|
// @return [list|false] (new pointer, parsed number)
|
9
9
|
|
10
10
|
@function _find-digits($source, $pointer) {
|
11
|
+
$source: to-lower-case($source);
|
11
12
|
$length: str-length($source);
|
12
13
|
$numbers: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9';
|
13
14
|
$result: null;
|
14
15
|
$runs: 1;
|
15
16
|
|
16
17
|
@while $pointer <= $length {
|
17
|
-
$token:
|
18
|
+
$token: str-slice($source, $pointer, $pointer);
|
18
19
|
$index: index($numbers, $token);
|
19
20
|
|
20
21
|
@if $token == '.' {
|
@@ -8,22 +8,29 @@
|
|
8
8
|
// @return [list|false] (new pointer, parsed number)
|
9
9
|
|
10
10
|
@function _find-exponent($source, $pointer) {
|
11
|
+
$source: to-lower-case($source);
|
11
12
|
$length: str-length($source);
|
12
13
|
$numbers: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9';
|
13
14
|
$result: null;
|
14
|
-
$minus:
|
15
|
+
$minus: null;
|
15
16
|
|
16
17
|
@while $pointer <= $length {
|
17
|
-
$token:
|
18
|
+
$token: str-slice($source, $pointer, $pointer);
|
18
19
|
$index: index($numbers, $token);
|
19
20
|
|
20
21
|
@if $token == 'e' {
|
21
22
|
// @continue;
|
22
23
|
}
|
23
24
|
@else if $token == '-' {
|
25
|
+
@if $minus != null {
|
26
|
+
@return _throw("Unexpected token `-`.", $pointer);
|
27
|
+
}
|
24
28
|
$minus: true;
|
25
29
|
}
|
26
30
|
@else if $token == '+' {
|
31
|
+
@if $minus != null {
|
32
|
+
@return _throw("Unexpected token `+`.", $pointer);
|
33
|
+
}
|
27
34
|
$minus: false;
|
28
35
|
}
|
29
36
|
@else if $index and $index > 0 {
|
@@ -8,12 +8,13 @@
|
|
8
8
|
// @return [list|false] (new pointer, parsed number)
|
9
9
|
|
10
10
|
@function _find-integer($source, $pointer) {
|
11
|
+
$source: to-lower-case($source);
|
11
12
|
$length: str-length($source);
|
12
13
|
$numbers: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9';
|
13
14
|
$result: 0;
|
14
15
|
|
15
16
|
@while $pointer <= $length {
|
16
|
-
$token:
|
17
|
+
$token: str-slice($source, $pointer, $pointer);
|
17
18
|
$index: index($numbers, $token);
|
18
19
|
|
19
20
|
@if $token == '-' {
|
@@ -5,6 +5,10 @@
|
|
5
5
|
// @return [number|string] string or number, depending on the match
|
6
6
|
|
7
7
|
@function _length($string) {
|
8
|
+
@if type-of($string) == number {
|
9
|
+
@return $string;
|
10
|
+
}
|
11
|
+
|
8
12
|
$strings: 'px' 'cm' 'mm' '%' 'ch' 'pica' 'in' 'em' 'rem' 'pt' 'pc' 'ex' 'vw' 'vh' 'vmin' 'vmax';
|
9
13
|
$units: 1px 1cm 1mm 1% 1ch 1pica 1in 1em 1rem 1pt 1pc 1ex 1vw 1vh 1vmin 1vmax;
|
10
14
|
$number: "";
|