flint-gs 1.7.1 → 1.7.2

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. checksums.yaml +7 -0
  2. data/LICENSE +21 -21
  3. data/README.md +906 -906
  4. data/lib/flint.rb +67 -77
  5. data/stylesheets/_flint.scss +6 -6
  6. data/stylesheets/flint/config/_config.scss +83 -83
  7. data/stylesheets/flint/functions/_functions.scss +40 -41
  8. data/stylesheets/flint/functions/helpers/_helpers.scss +181 -181
  9. data/stylesheets/flint/functions/lib/_calc-breakpoint.scss +33 -33
  10. data/stylesheets/flint/functions/lib/_calc-margin.scss +57 -57
  11. data/stylesheets/flint/functions/lib/_calc-width.scss +50 -50
  12. data/stylesheets/flint/functions/lib/_exists.scss +22 -22
  13. data/stylesheets/flint/functions/lib/_fluid-width.scss +10 -10
  14. data/stylesheets/flint/functions/lib/_get-index.scss +13 -13
  15. data/stylesheets/flint/functions/lib/_get-instance-value.scss +17 -17
  16. data/stylesheets/flint/functions/lib/_get-value.scss +14 -14
  17. data/stylesheets/flint/functions/lib/_has-family-instance.scss +74 -74
  18. data/stylesheets/flint/functions/lib/_instance.scss +46 -46
  19. data/stylesheets/flint/functions/lib/_last.scss +9 -9
  20. data/stylesheets/flint/functions/lib/_list-to-string.scss +25 -25
  21. data/stylesheets/flint/functions/lib/_map-fetch.scss +30 -30
  22. data/stylesheets/flint/functions/lib/_next-index.scss +15 -15
  23. data/stylesheets/flint/functions/lib/_purge.scss +19 -19
  24. data/stylesheets/flint/functions/lib/_remove.scss +13 -13
  25. data/stylesheets/flint/functions/lib/_replace-substring.scss +34 -34
  26. data/stylesheets/flint/functions/lib/_replace.scss +25 -25
  27. data/stylesheets/flint/functions/lib/_steal-key.scss +13 -13
  28. data/stylesheets/flint/functions/lib/_steal-values.scss +14 -14
  29. data/stylesheets/flint/functions/lib/_string-to-list.scss +90 -90
  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 -119
  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 +16 -23
  42. data/stylesheets/flint/functions/lib/_string-to-number.scss +0 -77
@@ -1,34 +1,34 @@
1
- // Replace substring
2
- // -------------------------------------------------------------------------------
3
- // @param $string [string] : string that contains substring
4
- // @param $substring [string] : substring to replace
5
- // @param $new-substring [string] : new string to replace sub with
6
- // -------------------------------------------------------------------------------
7
- // @return [string]
8
-
9
- @function flint-replace-substring($string, $substring, $new-substring: " ") {
10
-
11
- // Use Ruby function if available
12
- @if $flint__use-ruby-functions {
13
- @return replace_substring($string, $substring, $new-substring);
14
- } @else {
15
- // Loop through length of string
16
- @for $i from 1 through str-length($string) {
17
- // Get index and length of substring
18
- $sub-index: str-index($string, $substring);
19
- $sub-length: str-length($substring);
20
-
21
- // If count is index of substring
22
- @if $i == $sub-index {
23
- // Slice string to exclude substring
24
- $string-before: str-slice($string, 1, $i - 1);
25
- $string-after: str-slice($string, $i + $sub-length, str-length($string));
26
- // Create new string
27
- $string: $string-before + $new-substring + $string-after;
28
- }
29
-
30
- }
31
-
32
- @return $string;
33
- }
34
- }
1
+ // Replace substring
2
+ // -------------------------------------------------------------------------------
3
+ // @param $string [string] : string that contains substring
4
+ // @param $substring [string] : substring to replace
5
+ // @param $new-substring [string] : new string to replace sub with
6
+ // -------------------------------------------------------------------------------
7
+ // @return [string]
8
+
9
+ @function flint-replace-substring($string, $substring, $new-substring: " ") {
10
+
11
+ // Use Ruby function if available
12
+ @if $flint__use-ruby-functions {
13
+ @return replace_substring($string, $substring, $new-substring);
14
+ } @else {
15
+ // Loop through length of string
16
+ @for $i from 1 through str-length($string) {
17
+ // Get index and length of substring
18
+ $sub-index: str-index($string, $substring);
19
+ $sub-length: str-length($substring);
20
+
21
+ // If count is index of substring
22
+ @if $i == $sub-index {
23
+ // Slice string to exclude substring
24
+ $string-before: str-slice($string, 1, $i - 1);
25
+ $string-after: str-slice($string, $i + $sub-length, str-length($string));
26
+ // Create new string
27
+ $string: $string-before + $new-substring + $string-after;
28
+ }
29
+
30
+ }
31
+
32
+ @return $string;
33
+ }
34
+ }
@@ -1,25 +1,25 @@
1
- // Replaces $old by $new in $list
2
- // -------------------------------------------------------------------------------
3
- // @documentation http://sassylists.com/documentation.html#replace
4
- // -------------------------------------------------------------------------------
5
- // @param $list [list] : list
6
- // @param $old [literal] : value to replace
7
- // @param $value [literal] : new value for $old
8
- // -------------------------------------------------------------------------------
9
- // @return [list]
10
-
11
- @function flint-replace($list, $old, $value) {
12
- $running: true;
13
-
14
- @while $running {
15
- $index: index($list, $old);
16
-
17
- @if not $index {
18
- $running: false;
19
- } @else {
20
- $list: set-nth($list, $index, $value);
21
- }
22
- }
23
-
24
- @return if(not flint-is-true($value), flint-purge($list), $list);
25
- }
1
+ // Replaces $old by $new in $list
2
+ // -------------------------------------------------------------------------------
3
+ // @documentation http://sassylists.com/documentation.html#replace
4
+ // -------------------------------------------------------------------------------
5
+ // @param $list [list] : list
6
+ // @param $old [literal] : value to replace
7
+ // @param $value [literal] : new value for $old
8
+ // -------------------------------------------------------------------------------
9
+ // @return [list]
10
+
11
+ @function flint-replace($list, $old, $value) {
12
+ $running: true;
13
+
14
+ @while $running {
15
+ $index: index($list, $old);
16
+
17
+ @if not $index {
18
+ $running: false;
19
+ } @else {
20
+ $list: set-nth($list, $index, $value);
21
+ }
22
+ }
23
+
24
+ @return if(not flint-is-true($value), flint-purge($list), $list);
25
+ }
@@ -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 flint-steal-key($index) {
8
- @for $n from 1 through (length(flint-map-fetch($flint, "config")) - 1) {
9
- @each $key in nth(map-get($flint, "config"), $index) {
10
- @return $key;
11
- }
12
- }
13
- }
1
+ // Steal key based on index number
2
+ //--------------------------------------------------------------------------------
3
+ // @param $index [number] : index of key
4
+ // -------------------------------------------------------------------------------
5
+ // @return [string]
6
+
7
+ @function flint-steal-key($index) {
8
+ @for $n from 1 through (length(flint-map-fetch($flint, "config")) - 1) {
9
+ @each $key in nth(map-get($flint, "config"), $index) {
10
+ @return $key;
11
+ }
12
+ }
13
+ }
@@ -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,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
+ }