flint-gs 1.6.0 → 1.6.1

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 (42) hide show
  1. data/LICENSE +21 -21
  2. data/README.md +900 -900
  3. data/lib/flint.rb +17 -17
  4. data/stylesheets/_flint.scss +6 -6
  5. data/stylesheets/flint/config/_config.scss +83 -83
  6. data/stylesheets/flint/functions/_functions.scss +41 -41
  7. data/stylesheets/flint/functions/helpers/_helpers.scss +178 -178
  8. data/stylesheets/flint/functions/lib/_calc-breakpoint.scss +38 -38
  9. data/stylesheets/flint/functions/lib/_calc-margin.scss +31 -31
  10. data/stylesheets/flint/functions/lib/_calc-width.scss +44 -44
  11. data/stylesheets/flint/functions/lib/_exists.scss +21 -21
  12. data/stylesheets/flint/functions/lib/_fluid-width.scss +9 -9
  13. data/stylesheets/flint/functions/lib/_get-family-instance.scss +59 -59
  14. data/stylesheets/flint/functions/lib/_get-index.scss +14 -14
  15. data/stylesheets/flint/functions/lib/_get-instance-value.scss +19 -19
  16. data/stylesheets/flint/functions/lib/_get-substring.scss +23 -23
  17. data/stylesheets/flint/functions/lib/_get-value.scss +16 -16
  18. data/stylesheets/flint/functions/lib/_instance.scss +43 -43
  19. data/stylesheets/flint/functions/lib/_last.scss +8 -8
  20. data/stylesheets/flint/functions/lib/_list-to-string.scss +24 -24
  21. data/stylesheets/flint/functions/lib/_map-fetch.scss +33 -33
  22. data/stylesheets/flint/functions/lib/_next-index.scss +14 -14
  23. data/stylesheets/flint/functions/lib/_purge.scss +20 -20
  24. data/stylesheets/flint/functions/lib/_remove.scss +14 -14
  25. data/stylesheets/flint/functions/lib/_replace.scss +24 -24
  26. data/stylesheets/flint/functions/lib/_steal-key.scss +12 -12
  27. data/stylesheets/flint/functions/lib/_steal-values.scss +16 -16
  28. data/stylesheets/flint/functions/lib/_string-to-list.scss +84 -84
  29. data/stylesheets/flint/functions/lib/_string-to-number.scss +72 -72
  30. data/stylesheets/flint/functions/lib/_support-syntax-bem.scss +25 -25
  31. data/stylesheets/flint/functions/lib/_support-syntax.scss +28 -28
  32. data/stylesheets/flint/functions/lib/_types-in-list.scss +120 -120
  33. data/stylesheets/flint/functions/lib/_use-syntax.scss +11 -11
  34. data/stylesheets/flint/globals/_globals.scss +22 -22
  35. data/stylesheets/flint/mixins/_mixins.scss +7 -7
  36. data/stylesheets/flint/mixins/lib/_calculate.scss +765 -765
  37. data/stylesheets/flint/mixins/lib/_clearfix.scss +18 -18
  38. data/stylesheets/flint/mixins/lib/_main.scss +910 -911
  39. data/stylesheets/flint/mixins/lib/_new-instance.scss +26 -26
  40. data/stylesheets/flint/mixins/lib/_print-instance.scss +41 -41
  41. metadata +21 -15
  42. checksums.yaml +0 -7
@@ -1,13 +1,13 @@
1
- // Steal key based on index number
2
- //--------------------------------------------------------------------------------
3
- // @param $index [number] : index of key
4
- // -------------------------------------------------------------------------------
5
- // @return [string]
6
-
7
- @function steal-key($index) {
8
- @for $n from 1 through (length(map-fetch($flint, "config")) - 1) {
9
- @each $key in nth(map-get($flint, "config"), $index) {
10
- @return $key;
11
- }
12
- }
1
+ // Steal key based on index number
2
+ //--------------------------------------------------------------------------------
3
+ // @param $index [number] : index of key
4
+ // -------------------------------------------------------------------------------
5
+ // @return [string]
6
+
7
+ @function steal-key($index) {
8
+ @for $n from 1 through (length(map-fetch($flint, "config")) - 1) {
9
+ @each $key in nth(map-get($flint, "config"), $index) {
10
+ @return $key;
11
+ }
12
+ }
13
13
  }
@@ -1,17 +1,17 @@
1
- // Steal value based on index number
2
- // -------------------------------------------------------------------------------
3
- // @dependence `map-fetch()`
4
- // @dependence `get-value()`
5
- // -------------------------------------------------------------------------------
6
- // @param $index [number] : index of breakpoint key in config
7
- // @param $value [number] : value
8
- // -------------------------------------------------------------------------------
9
- // @return [number]
10
-
11
- @function steal-values($index, $value) {
12
- @for $n from 1 through (length(map-fetch($flint, config)) - 1) {
13
- @each $key in nth(map-get($flint, config), $index) {
14
- @return get-value($key, $value);
15
- }
16
- }
1
+ // Steal value based on index number
2
+ // -------------------------------------------------------------------------------
3
+ // @dependence `map-fetch()`
4
+ // @dependence `get-value()`
5
+ // -------------------------------------------------------------------------------
6
+ // @param $index [number] : index of breakpoint key in config
7
+ // @param $value [number] : value
8
+ // -------------------------------------------------------------------------------
9
+ // @return [number]
10
+
11
+ @function steal-values($index, $value) {
12
+ @for $n from 1 through (length(map-fetch($flint, config)) - 1) {
13
+ @each $key in nth(map-get($flint, config), $index) {
14
+ @return get-value($key, $value);
15
+ }
16
+ }
17
17
  }
@@ -1,84 +1,84 @@
1
- // Turns string into a flat list
2
- // -------------------------------------------------------------------------------
3
- // @param $string [string] : string
4
- // @param $find [string] : item to find which separates substrings (default is single space [" "])
5
- // @param $ignore [string] : removes remaining string beyond item (default is comma [","])
6
- // -------------------------------------------------------------------------------
7
- // @return [list] | error
8
-
9
- @function string-to-list($string, $find: " ", $ignore: ",") {
10
- @if is-string($string) {
11
- $string-list: ();
12
- $space-indexes: ();
13
- $ignore-remainder: ();
14
- $length: str-length($string);
15
-
16
- // Find ignore separator, and remove remainder of string beyond that point
17
- @for $i from 1 through $length {
18
- $slice: str-slice($string, $i, $i);
19
- @if $slice == $ignore {
20
- $ignore-remainder: append($ignore-remainder, $i - 1, "comma");
21
- }
22
- }
23
-
24
- // Redefine string and length
25
- @if length($ignore-remainder) >= 1 {
26
- $string: str-slice($string, 1, nth($ignore-remainder, 1));
27
- $length: str-length($string);
28
- }
29
-
30
- // Find all spaces and their indices by looking over each character in string
31
- @for $i from 1 through $length {
32
- $slice: str-slice($string, $i, $i);
33
- @if $slice == $find {
34
- $space-indexes: append($space-indexes, $i, "comma");
35
- }
36
- }
37
-
38
- // Check if there are any spaces
39
- @if length($space-indexes) >= 1 {
40
-
41
- // Keep a count of number of spaces
42
- $count: 1;
43
-
44
- // Loop through each space
45
- @each $space in $space-indexes {
46
-
47
- // If is initial count, grab first substring and store in list
48
- @if $count == 1 {
49
- $matched-string: str-slice($string, 0, ($space - 1));
50
-
51
- @if $matched-string != "" {
52
- $string-list: append($string-list, $matched-string, "comma");
53
- }
54
- // Else, add a little math to make up for the spaces to do the same
55
- } @else {
56
- $matched-string: str-slice($string, (nth($space-indexes, ($count - 1)) + 1), ($space - 1));
57
-
58
- @if $matched-string != "" {
59
- $string-list: append($string-list, $matched-string, "comma");
60
- }
61
- }
62
-
63
- // Increase count
64
- $count: $count + 1;
65
- }
66
-
67
- // Now grab that last selector
68
- $last-space: nth($space-indexes, length($space-indexes));
69
- $matched-string: str-slice($string, ($last-space + 1), $length);
70
- $string-list: append($string-list, $matched-string, "comma");
71
-
72
- // Finally, return comma separated list of selectors
73
- @return $string-list;
74
- } @else {
75
-
76
- // Else, just return the string as a single item list
77
- $string-list: append($string-list, $string);
78
-
79
- @return $string-list;
80
- }
81
- } @else {
82
- @return "You did not input a valid string: #{$string}";
83
- }
84
- }
1
+ // Turns string into a flat list
2
+ // -------------------------------------------------------------------------------
3
+ // @param $string [string] : string
4
+ // @param $find [string] : item to find which separates substrings (default is single space [" "])
5
+ // @param $ignore [string] : removes remaining string beyond item (default is comma [","])
6
+ // -------------------------------------------------------------------------------
7
+ // @return [list] | error
8
+
9
+ @function string-to-list($string, $find: " ", $ignore: ",") {
10
+ @if is-string($string) {
11
+ $string-list: ();
12
+ $space-indexes: ();
13
+ $ignore-remainder: ();
14
+ $length: str-length($string);
15
+
16
+ // Find ignore separator, and remove remainder of string beyond that point
17
+ @for $i from 1 through $length {
18
+ $slice: str-slice($string, $i, $i);
19
+ @if $slice == $ignore {
20
+ $ignore-remainder: append($ignore-remainder, $i - 1, "comma");
21
+ }
22
+ }
23
+
24
+ // Redefine string and length
25
+ @if length($ignore-remainder) >= 1 {
26
+ $string: str-slice($string, 1, nth($ignore-remainder, 1));
27
+ $length: str-length($string);
28
+ }
29
+
30
+ // Find all spaces and their indices by looking over each character in string
31
+ @for $i from 1 through $length {
32
+ $slice: str-slice($string, $i, $i);
33
+ @if $slice == $find {
34
+ $space-indexes: append($space-indexes, $i, "comma");
35
+ }
36
+ }
37
+
38
+ // Check if there are any spaces
39
+ @if length($space-indexes) >= 1 {
40
+
41
+ // Keep a count of number of spaces
42
+ $count: 1;
43
+
44
+ // Loop through each space
45
+ @each $space in $space-indexes {
46
+
47
+ // If is initial count, grab first substring and store in list
48
+ @if $count == 1 {
49
+ $matched-string: str-slice($string, 0, ($space - 1));
50
+
51
+ @if $matched-string != "" {
52
+ $string-list: append($string-list, $matched-string, "comma");
53
+ }
54
+ // Else, add a little math to make up for the spaces to do the same
55
+ } @else {
56
+ $matched-string: str-slice($string, (nth($space-indexes, ($count - 1)) + 1), ($space - 1));
57
+
58
+ @if $matched-string != "" {
59
+ $string-list: append($string-list, $matched-string, "comma");
60
+ }
61
+ }
62
+
63
+ // Increase count
64
+ $count: $count + 1;
65
+ }
66
+
67
+ // Now grab that last selector
68
+ $last-space: nth($space-indexes, length($space-indexes));
69
+ $matched-string: str-slice($string, ($last-space + 1), $length);
70
+ $string-list: append($string-list, $matched-string, "comma");
71
+
72
+ // Finally, return comma separated list of selectors
73
+ @return $string-list;
74
+ } @else {
75
+
76
+ // Else, just return the string as a single item list
77
+ $string-list: append($string-list, $string);
78
+
79
+ @return $string-list;
80
+ }
81
+ } @else {
82
+ @return "You did not input a valid string: #{$string}";
83
+ }
84
+ }
@@ -1,73 +1,73 @@
1
- // Converts number[unit] string into value
2
- // -------------------------------------------------------------------------------
3
- // @documentation http://hugogiraudel.com/2014/01/15/sass-string-to-number/
4
- // -------------------------------------------------------------------------------
5
- // @param $number [string] : number
6
- // @param $unit [string] : unit
7
- // -------------------------------------------------------------------------------
8
- // @return [number]
9
-
10
- @function num-length($number, $unit) {
11
- $strings: 'px' 'cm' 'mm' '%' 'ch' 'pica' 'in' 'em' 'rem' 'pt' 'pc' 'ex' 'vw' 'vh' 'vmin' 'vmax';
12
- $units: 1px 1cm 1mm 1% 1ch 1pica 1in 1em 1rem 1pt 1pc 1ex 1vw 1vh 1vmin 1vmax;
13
- $index: index($strings, $unit);
14
-
15
- @if not $index {
16
- @warn "Unknown unit `#{$unit}`.";
17
- @return false;
18
- }
19
-
20
- @return $number * nth($units, $index);
21
- }
22
-
23
- // Converts number to string
24
- // -------------------------------------------------------------------------------
25
- // @documentation http://hugogiraudel.com/2014/01/15/sass-string-to-number/
26
- // -------------------------------------------------------------------------------
27
- // @dependence `num-length()`
28
- // -------------------------------------------------------------------------------
29
- // @param $string [String] : string
30
- // -------------------------------------------------------------------------------
31
- // @return [Value]
32
-
33
- @function to-number($string) {
34
- // Matrices
35
- $strings: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9';
36
- $numbers: 0 1 2 3 4 5 6 7 8 9;
37
-
38
- // Result
39
- $result: 0;
40
- $divider: 0;
41
- $minus: false;
42
-
43
- // Looping through all characters
44
- @for $i from 1 through str-length($string) {
45
- $character: str-slice($string, $i, $i);
46
- $index: index($strings, $character);
47
-
48
- @if $character == '-' {
49
- $minus: true;
50
- } @else if $character == '.' {
51
- $divider: 1;
52
- } @else {
53
-
54
- @if not $index {
55
- $result: if($minus, $result * -1, $result);
56
- @return num-length($result, str-slice($string, $i));
57
- }
58
-
59
- $number: nth($numbers, $index);
60
-
61
- @if $divider == 0 {
62
- $result: $result * 10;
63
- } @else {
64
- // Move the decimal dot to the left
65
- $divider: $divider * 10;
66
- $number: $number / $divider;
67
- }
68
- $result: $result + $number;
69
- }
70
- }
71
-
72
- @return if($minus, $result * -1, $result);
1
+ // Converts number[unit] string into value
2
+ // -------------------------------------------------------------------------------
3
+ // @documentation http://hugogiraudel.com/2014/01/15/sass-string-to-number/
4
+ // -------------------------------------------------------------------------------
5
+ // @param $number [string] : number
6
+ // @param $unit [string] : unit
7
+ // -------------------------------------------------------------------------------
8
+ // @return [number]
9
+
10
+ @function num-length($number, $unit) {
11
+ $strings: 'px' 'cm' 'mm' '%' 'ch' 'pica' 'in' 'em' 'rem' 'pt' 'pc' 'ex' 'vw' 'vh' 'vmin' 'vmax';
12
+ $units: 1px 1cm 1mm 1% 1ch 1pica 1in 1em 1rem 1pt 1pc 1ex 1vw 1vh 1vmin 1vmax;
13
+ $index: index($strings, $unit);
14
+
15
+ @if not $index {
16
+ @warn "Unknown unit `#{$unit}`.";
17
+ @return false;
18
+ }
19
+
20
+ @return $number * nth($units, $index);
21
+ }
22
+
23
+ // Converts number to string
24
+ // -------------------------------------------------------------------------------
25
+ // @documentation http://hugogiraudel.com/2014/01/15/sass-string-to-number/
26
+ // -------------------------------------------------------------------------------
27
+ // @dependence `num-length()`
28
+ // -------------------------------------------------------------------------------
29
+ // @param $string [String] : string
30
+ // -------------------------------------------------------------------------------
31
+ // @return [Value]
32
+
33
+ @function to-number($string) {
34
+ // Matrices
35
+ $strings: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9';
36
+ $numbers: 0 1 2 3 4 5 6 7 8 9;
37
+
38
+ // Result
39
+ $result: 0;
40
+ $divider: 0;
41
+ $minus: false;
42
+
43
+ // Looping through all characters
44
+ @for $i from 1 through str-length($string) {
45
+ $character: str-slice($string, $i, $i);
46
+ $index: index($strings, $character);
47
+
48
+ @if $character == '-' {
49
+ $minus: true;
50
+ } @else if $character == '.' {
51
+ $divider: 1;
52
+ } @else {
53
+
54
+ @if not $index {
55
+ $result: if($minus, $result * -1, $result);
56
+ @return num-length($result, str-slice($string, $i));
57
+ }
58
+
59
+ $number: nth($numbers, $index);
60
+
61
+ @if $divider == 0 {
62
+ $result: $result * 10;
63
+ } @else {
64
+ // Move the decimal dot to the left
65
+ $divider: $divider * 10;
66
+ $number: $number / $divider;
67
+ }
68
+ $result: $result + $number;
69
+ }
70
+ }
71
+
72
+ @return if($minus, $result * -1, $result);
73
73
  }
@@ -1,25 +1,25 @@
1
- // Support BEM syntax
2
- // -------------------------------------------------------------------------------
3
- // @param $selectors [string] : string of selectors to parse
4
- // -------------------------------------------------------------------------------
5
- // @return [string] : parsed list of selectors according to syntax
6
-
7
- @function support-syntax-bem($selectors) {
8
- $selectors: string-to-list($selectors, "_");
9
- $parent: nth($selectors, 1);
10
- $selector-list: ($parent);
11
-
12
- // Loop over each selector and build list of selectors
13
- @each $selector in $selectors {
14
- // Make sure current selector is not the parent
15
- @if $selector != $parent {
16
- // Save to selector list
17
- $selector-list: append($selector-list, ($parent + "__" + $selector), "comma");
18
- // Define new parent
19
- $parent: $parent + "__" + $selector;
20
- }
21
- }
22
-
23
- // Return the list of transformed selectors
24
- @return $selector-list;
25
- }
1
+ // Support BEM syntax
2
+ // -------------------------------------------------------------------------------
3
+ // @param $selectors [string] : string of selectors to parse
4
+ // -------------------------------------------------------------------------------
5
+ // @return [string] : parsed list of selectors according to syntax
6
+
7
+ @function support-syntax-bem($selectors) {
8
+ $selectors: string-to-list($selectors, "_");
9
+ $parent: nth($selectors, 1);
10
+ $selector-list: ($parent);
11
+
12
+ // Loop over each selector and build list of selectors
13
+ @each $selector in $selectors {
14
+ // Make sure current selector is not the parent
15
+ @if $selector != $parent {
16
+ // Save to selector list
17
+ $selector-list: append($selector-list, ($parent + "__" + $selector), "comma");
18
+ // Define new parent
19
+ $parent: $parent + "__" + $selector;
20
+ }
21
+ }
22
+
23
+ // Return the list of transformed selectors
24
+ @return $selector-list;
25
+ }
@@ -1,28 +1,28 @@
1
- // Support syntax
2
- // -------------------------------------------------------------------------------
3
- // @param $syntax [string] : alias of syntax to support
4
- // @param $selectors [string] : string of selectors to parse
5
- // -------------------------------------------------------------------------------
6
- // @return [list] : list of parsed selectors according to syntax
7
-
8
- @function support-syntax($syntax, $selectors) {
9
- $syntax: to-lower-case($syntax);
10
-
11
- // Make sure syntax is supported
12
- // ----
13
- @if function-exists(support-syntax-#{$syntax}) {
14
-
15
- // Support syntax
16
- // ----
17
- // @warning : be sure you have created a custom function to support an unknown syntax
18
- // ----
19
- @return call("support-syntax-#{$syntax}", $selectors);
20
-
21
- } @else {
22
-
23
- // Throw error if the syntax does not exist and a function to call cannot be found
24
- @warn "You did not pass a valid syntax to `support-syntax`: #{$syntax}. Either specify a custom `support-syntax-<syntax>` function to call, or use one of the offically supported syntaxes.";
25
- @return null;
26
-
27
- }
28
- }
1
+ // Support syntax
2
+ // -------------------------------------------------------------------------------
3
+ // @param $syntax [string] : alias of syntax to support
4
+ // @param $selectors [string] : string of selectors to parse
5
+ // -------------------------------------------------------------------------------
6
+ // @return [list] : list of parsed selectors according to syntax
7
+
8
+ @function support-syntax($syntax, $selectors) {
9
+ $syntax: to-lower-case($syntax);
10
+
11
+ // Make sure syntax is supported
12
+ // ----
13
+ @if function-exists(support-syntax-#{$syntax}) {
14
+
15
+ // Support syntax
16
+ // ----
17
+ // @warning : be sure you have created a custom function to support an unknown syntax
18
+ // ----
19
+ @return call("support-syntax-#{$syntax}", $selectors);
20
+
21
+ } @else {
22
+
23
+ // Throw error if the syntax does not exist and a function to call cannot be found
24
+ @warn "You did not pass a valid syntax to `support-syntax`: #{$syntax}. Either specify a custom `support-syntax-<syntax>` function to call, or use one of the offically supported syntaxes.";
25
+ @return null;
26
+
27
+ }
28
+ }