flint-gs 1.7.0 → 1.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/LICENSE +21 -21
  2. data/README.md +906 -906
  3. data/lib/flint.rb +77 -77
  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 +181 -187
  8. data/stylesheets/flint/functions/lib/_calc-breakpoint.scss +33 -33
  9. data/stylesheets/flint/functions/lib/_calc-margin.scss +57 -57
  10. data/stylesheets/flint/functions/lib/_calc-width.scss +50 -50
  11. data/stylesheets/flint/functions/lib/_exists.scss +22 -22
  12. data/stylesheets/flint/functions/lib/_fluid-width.scss +10 -10
  13. data/stylesheets/flint/functions/lib/_get-index.scss +13 -13
  14. data/stylesheets/flint/functions/lib/_get-instance-value.scss +17 -17
  15. data/stylesheets/flint/functions/lib/_get-value.scss +14 -14
  16. data/stylesheets/flint/functions/lib/_has-family-instance.scss +74 -74
  17. data/stylesheets/flint/functions/lib/_instance.scss +46 -46
  18. data/stylesheets/flint/functions/lib/_last.scss +9 -9
  19. data/stylesheets/flint/functions/lib/_list-to-string.scss +25 -25
  20. data/stylesheets/flint/functions/lib/_map-fetch.scss +30 -30
  21. data/stylesheets/flint/functions/lib/_next-index.scss +15 -15
  22. data/stylesheets/flint/functions/lib/_purge.scss +19 -19
  23. data/stylesheets/flint/functions/lib/_remove.scss +13 -13
  24. data/stylesheets/flint/functions/lib/_replace-substring.scss +34 -34
  25. data/stylesheets/flint/functions/lib/_replace.scss +25 -25
  26. data/stylesheets/flint/functions/lib/_steal-key.scss +13 -13
  27. data/stylesheets/flint/functions/lib/_steal-values.scss +14 -14
  28. data/stylesheets/flint/functions/lib/_string-to-list.scss +90 -90
  29. data/stylesheets/flint/functions/lib/_string-to-number.scss +77 -77
  30. data/stylesheets/flint/functions/lib/_support-syntax-bem.scss +31 -31
  31. data/stylesheets/flint/functions/lib/_support-syntax.scss +28 -28
  32. data/stylesheets/flint/functions/lib/_types-in-list.scss +119 -120
  33. data/stylesheets/flint/functions/lib/_use-syntax.scss +14 -14
  34. data/stylesheets/flint/globals/_globals.scss +38 -38
  35. data/stylesheets/flint/mixins/_mixins.scss +7 -7
  36. data/stylesheets/flint/mixins/lib/_calculate.scss +571 -571
  37. data/stylesheets/flint/mixins/lib/_clearfix.scss +19 -19
  38. data/stylesheets/flint/mixins/lib/_main.scss +935 -935
  39. data/stylesheets/flint/mixins/lib/_new-instance.scss +27 -27
  40. data/stylesheets/flint/mixins/lib/_print-instance.scss +42 -42
  41. metadata +22 -16
  42. checksums.yaml +0 -7
@@ -1,14 +1,14 @@
1
- // Steal value based on index number
2
- // -------------------------------------------------------------------------------
3
- // @param $index [number] : index of breakpoint key in config
4
- // @param $value [number] : value
5
- // -------------------------------------------------------------------------------
6
- // @return [number]
7
-
8
- @function flint-steal-values($index, $value) {
9
- @for $n from 1 through (length(flint-map-fetch($flint, config)) - 1) {
10
- @each $key in nth(map-get($flint, config), $index) {
11
- @return flint-get-value($key, $value);
12
- }
13
- }
14
- }
1
+ // Steal value based on index number
2
+ // -------------------------------------------------------------------------------
3
+ // @param $index [number] : index of breakpoint key in config
4
+ // @param $value [number] : value
5
+ // -------------------------------------------------------------------------------
6
+ // @return [number]
7
+
8
+ @function flint-steal-values($index, $value) {
9
+ @for $n from 1 through (length(flint-map-fetch($flint, config)) - 1) {
10
+ @each $key in nth(map-get($flint, config), $index) {
11
+ @return flint-get-value($key, $value);
12
+ }
13
+ }
14
+ }
@@ -1,90 +1,90 @@
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 flint-string-to-list($string, $find: " ", $ignore: ",") {
10
- @if flint-is-string($string) {
11
-
12
- // Use Ruby function if available
13
- @if $flint__use-ruby-functions {
14
- @return string_to_list($string, $find, $ignore);
15
- } @else {
16
- $string-list: ();
17
- $space-indexes: ();
18
- $ignore-remainder: ();
19
- $length: str-length($string);
20
-
21
- // Find ignore separator, and flint-remove remainder of string beyond that point
22
- @for $i from 1 through $length {
23
- $slice: str-slice($string, $i, $i);
24
- @if $slice == $ignore {
25
- $ignore-remainder: append($ignore-remainder, $i - 1, "comma");
26
- }
27
- }
28
-
29
- // Redefine string and length
30
- @if length($ignore-remainder) >= 1 {
31
- $string: str-slice($string, 1, nth($ignore-remainder, 1));
32
- $length: str-length($string);
33
- }
34
-
35
- // Find all spaces and their indices by looking over each character in string
36
- @for $i from 1 through $length {
37
- $slice: str-slice($string, $i, $i);
38
- @if $slice == $find {
39
- $space-indexes: append($space-indexes, $i, "comma");
40
- }
41
- }
42
-
43
- // Check if there are any spaces
44
- @if length($space-indexes) >= 1 {
45
-
46
- // Keep a count of number of spaces
47
- $count: 1;
48
-
49
- // Loop through each space
50
- @each $space in $space-indexes {
51
-
52
- // If is initial count, grab first substring and store in list
53
- @if $count == 1 {
54
- $matched-string: str-slice($string, 0, ($space - 1));
55
-
56
- @if $matched-string != "" {
57
- $string-list: append($string-list, $matched-string, "comma");
58
- }
59
- // Else, add a little math to make up for the spaces to do the same
60
- } @else {
61
- $matched-string: str-slice($string, (nth($space-indexes, ($count - 1)) + 1), ($space - 1));
62
-
63
- @if $matched-string != "" {
64
- $string-list: append($string-list, $matched-string, "comma");
65
- }
66
- }
67
-
68
- // Increase count
69
- $count: $count + 1;
70
- }
71
-
72
- // Now grab that last selector
73
- $flint-last-space: nth($space-indexes, length($space-indexes));
74
- $matched-string: str-slice($string, ($flint-last-space + 1), $length);
75
- $string-list: append($string-list, $matched-string, "comma");
76
-
77
- // Finally, return comma separated list of selectors
78
- @return $string-list;
79
- } @else {
80
-
81
- // Else, just return the string as a single item list
82
- $string-list: append($string-list, $string);
83
-
84
- @return $string-list;
85
- }
86
- } @else {
87
- @return "You did not input a valid string: #{$string}";
88
- }
89
- }
90
- }
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 flint-string-to-list($string, $find: " ", $ignore: ",") {
10
+ @if flint-is-string($string) {
11
+
12
+ // Use Ruby function if available
13
+ @if $flint__use-ruby-functions {
14
+ @return string_to_list($string, $find, $ignore);
15
+ } @else {
16
+ $string-list: ();
17
+ $space-indexes: ();
18
+ $ignore-remainder: ();
19
+ $length: str-length($string);
20
+
21
+ // Find ignore separator, and flint-remove remainder of string beyond that point
22
+ @for $i from 1 through $length {
23
+ $slice: str-slice($string, $i, $i);
24
+ @if $slice == $ignore {
25
+ $ignore-remainder: append($ignore-remainder, $i - 1, "comma");
26
+ }
27
+ }
28
+
29
+ // Redefine string and length
30
+ @if length($ignore-remainder) >= 1 {
31
+ $string: str-slice($string, 1, nth($ignore-remainder, 1));
32
+ $length: str-length($string);
33
+ }
34
+
35
+ // Find all spaces and their indices by looking over each character in string
36
+ @for $i from 1 through $length {
37
+ $slice: str-slice($string, $i, $i);
38
+ @if $slice == $find {
39
+ $space-indexes: append($space-indexes, $i, "comma");
40
+ }
41
+ }
42
+
43
+ // Check if there are any spaces
44
+ @if length($space-indexes) >= 1 {
45
+
46
+ // Keep a count of number of spaces
47
+ $count: 1;
48
+
49
+ // Loop through each space
50
+ @each $space in $space-indexes {
51
+
52
+ // If is initial count, grab first substring and store in list
53
+ @if $count == 1 {
54
+ $matched-string: str-slice($string, 0, ($space - 1));
55
+
56
+ @if $matched-string != "" {
57
+ $string-list: append($string-list, $matched-string, "comma");
58
+ }
59
+ // Else, add a little math to make up for the spaces to do the same
60
+ } @else {
61
+ $matched-string: str-slice($string, (nth($space-indexes, ($count - 1)) + 1), ($space - 1));
62
+
63
+ @if $matched-string != "" {
64
+ $string-list: append($string-list, $matched-string, "comma");
65
+ }
66
+ }
67
+
68
+ // Increase count
69
+ $count: $count + 1;
70
+ }
71
+
72
+ // Now grab that last selector
73
+ $flint-last-space: nth($space-indexes, length($space-indexes));
74
+ $matched-string: str-slice($string, ($flint-last-space + 1), $length);
75
+ $string-list: append($string-list, $matched-string, "comma");
76
+
77
+ // Finally, return comma separated list of selectors
78
+ @return $string-list;
79
+ } @else {
80
+
81
+ // Else, just return the string as a single item list
82
+ $string-list: append($string-list, $string);
83
+
84
+ @return $string-list;
85
+ }
86
+ } @else {
87
+ @return "You did not input a valid string: #{$string}";
88
+ }
89
+ }
90
+ }
@@ -1,77 +1,77 @@
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 flint-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 string to number
24
- // -------------------------------------------------------------------------------
25
- // @documentation http://hugogiraudel.com/2014/01/15/sass-string-to-number/
26
- // -------------------------------------------------------------------------------
27
- // @param $string [string] : string
28
- // -------------------------------------------------------------------------------
29
- // @return [number]
30
-
31
- @function flint-to-number($string) {
32
- // Use Ruby function if available
33
- @if $flint__use-ruby-functions {
34
- @return string_to_number($string);
35
- } @else {
36
- // Matrices
37
- $strings: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9';
38
- $numbers: 0 1 2 3 4 5 6 7 8 9;
39
-
40
- // Result
41
- $result: 0;
42
- $divider: 0;
43
- $minus: false;
44
-
45
- // Looping through all characters
46
- @for $i from 1 through str-length($string) {
47
- $character: str-slice($string, $i, $i);
48
- $index: index($strings, $character);
49
-
50
- @if $character == '-' {
51
- $minus: true;
52
- } @else if $character == '.' {
53
- $divider: 1;
54
- } @else {
55
-
56
- @if not $index {
57
- $result: if($minus, $result * -1, $result);
58
- @return flint-num-length($result, str-slice($string, $i));
59
- }
60
-
61
- $number: nth($numbers, $index);
62
-
63
- @if $divider == 0 {
64
- $result: $result * 10;
65
- } @else {
66
- // Move the decimal dot to the left
67
- $divider: $divider * 10;
68
- $number: $number / $divider;
69
- }
70
-
71
- $result: $result + $number;
72
- }
73
- }
74
-
75
- @return if($minus, $result * -1, $result);
76
- }
77
- }
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 flint-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 string to number
24
+ // -------------------------------------------------------------------------------
25
+ // @documentation http://hugogiraudel.com/2014/01/15/sass-string-to-number/
26
+ // -------------------------------------------------------------------------------
27
+ // @param $string [string] : string
28
+ // -------------------------------------------------------------------------------
29
+ // @return [number]
30
+
31
+ @function flint-to-number($string) {
32
+ // Use Ruby function if available
33
+ @if $flint__use-ruby-functions {
34
+ @return string_to_number($string);
35
+ } @else {
36
+ // Matrices
37
+ $strings: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9';
38
+ $numbers: 0 1 2 3 4 5 6 7 8 9;
39
+
40
+ // Result
41
+ $result: 0;
42
+ $divider: 0;
43
+ $minus: false;
44
+
45
+ // Looping through all characters
46
+ @for $i from 1 through str-length($string) {
47
+ $character: str-slice($string, $i, $i);
48
+ $index: index($strings, $character);
49
+
50
+ @if $character == '-' {
51
+ $minus: true;
52
+ } @else if $character == '.' {
53
+ $divider: 1;
54
+ } @else {
55
+
56
+ @if not $index {
57
+ $result: if($minus, $result * -1, $result);
58
+ @return flint-num-length($result, str-slice($string, $i));
59
+ }
60
+
61
+ $number: nth($numbers, $index);
62
+
63
+ @if $divider == 0 {
64
+ $result: $result * 10;
65
+ } @else {
66
+ // Move the decimal dot to the left
67
+ $divider: $divider * 10;
68
+ $number: $number / $divider;
69
+ }
70
+
71
+ $result: $result + $number;
72
+ }
73
+ }
74
+
75
+ @return if($minus, $result * -1, $result);
76
+ }
77
+ }
@@ -1,31 +1,31 @@
1
- // Support BEM syntax
2
- // -------------------------------------------------------------------------------
3
- // @param $selectors [string] : string of selectors to parse
4
- // -------------------------------------------------------------------------------
5
- // @return [list] : parsed list of selectors according to syntax
6
-
7
- @function flint-support-syntax-bem($selectors) {
8
- // Clean up selector, remove double underscores for spaces
9
- // add psudeo character to differentiate selectors
10
- $selectors: flint-replace-substring($selectors, "__", "/");
11
- // Parse string to list
12
- $selectors: flint-string-to-list($selectors, "/");
13
- // Define top-most parent of selector
14
- $parent: nth($selectors, 1);
15
- // Create new list of parsed selectors
16
- $selector-list: ($parent);
17
-
18
- // Loop over each selector and build list of selectors
19
- @each $selector in $selectors {
20
- // Make sure current selector is not the parent
21
- @if $selector != $parent {
22
- // Save to selector list
23
- $selector-list: append($selector-list, ($parent + "__" + $selector), "comma");
24
- // Define new parent
25
- $parent: $parent + "__" + $selector;
26
- }
27
- }
28
-
29
- // Return the list of parsed selectors
30
- @return $selector-list;
31
- }
1
+ // Support BEM syntax
2
+ // -------------------------------------------------------------------------------
3
+ // @param $selectors [string] : string of selectors to parse
4
+ // -------------------------------------------------------------------------------
5
+ // @return [list] : parsed list of selectors according to syntax
6
+
7
+ @function flint-support-syntax-bem($selectors) {
8
+ // Clean up selector, remove double underscores for spaces
9
+ // add psudeo character to differentiate selectors
10
+ $selectors: flint-replace-substring($selectors, "__", "/");
11
+ // Parse string to list
12
+ $selectors: flint-string-to-list($selectors, "/");
13
+ // Define top-most parent of selector
14
+ $parent: nth($selectors, 1);
15
+ // Create new list of parsed selectors
16
+ $selector-list: ($parent);
17
+
18
+ // Loop over each selector and build list of selectors
19
+ @each $selector in $selectors {
20
+ // Make sure current selector is not the parent
21
+ @if $selector != $parent {
22
+ // Save to selector list
23
+ $selector-list: append($selector-list, ($parent + "__" + $selector), "comma");
24
+ // Define new parent
25
+ $parent: $parent + "__" + $selector;
26
+ }
27
+ }
28
+
29
+ // Return the list of parsed selectors
30
+ @return $selector-list;
31
+ }
@@ -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 flint-support-syntax($syntax, $selectors) {
9
- $syntax: to-lower-case($syntax);
10
-
11
- // Make sure syntax is supported
12
- // ----
13
- @if function-exists("flint-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("flint-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 `flint-support-syntax`: #{$syntax}. Either specify a custom `flint-support-syntax-<syntax>` function to call, or use one of the offically supported syntaxes. For more info, please visit the docs.";
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 flint-support-syntax($syntax, $selectors) {
9
+ $syntax: to-lower-case($syntax);
10
+
11
+ // Make sure syntax is supported
12
+ // ----
13
+ @if function-exists("flint-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("flint-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 `flint-support-syntax`: #{$syntax}. Either specify a custom `flint-support-syntax-<syntax>` function to call, or use one of the offically supported syntaxes. For more info, please visit the docs.";
25
+ @return null;
26
+
27
+ }
28
+ }