flint-gs 1.6.0 → 1.6.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 +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,39 +1,39 @@
1
- // Calculate from-to breakpoints
2
- // -------------------------------------------------------------------------------
3
- // @dependence `map-fetch()`
4
- // @dependence `get-value()`
5
- // @dependence `steal-key()`
6
- // @dependence `is-highest-breakpoint()`
7
- // @dependence `is-lowest-breakpoint()`
8
- // -------------------------------------------------------------------------------
9
- // @param $n [string] : how to calculate breakpoint
10
- // @param $key [string] : key of breakpoint
11
- // @param $i [number] : index of current breakpoint
12
- // -------------------------------------------------------------------------------
13
- // @return calculated value
14
-
15
- @function calc-breakpoint($n, $key, $i) {
16
- @if $n == "alias" {
17
- @if get-value("settings", "grid") == "fixed" {
18
- @if is-lowest-breakpoint($key) {
19
- @return 0;
20
- } @else {
21
- @return get-value($key, "breakpoint");
22
- }
23
- } @else if get-value("settings", "grid") == "fluid" {
24
- @return get-value($key, "breakpoint");
25
- }
26
- } @else if $n == "next" {
27
- @if is-lowest-breakpoint($key) {
28
- @return 0;
29
- } @else {
30
- @return get-value(steal-key(($i + 1)), "breakpoint");
31
- }
32
- } @else if $n == "prev" {
33
- @if is-highest-breakpoint($key) {
34
- @return get-value($key, "breakpoint");
35
- } @else {
36
- @return get-value(steal-key(($i - 1)), "breakpoint");
37
- }
38
- }
1
+ // Calculate from-to breakpoints
2
+ // -------------------------------------------------------------------------------
3
+ // @dependence `map-fetch()`
4
+ // @dependence `get-value()`
5
+ // @dependence `steal-key()`
6
+ // @dependence `is-highest-breakpoint()`
7
+ // @dependence `is-lowest-breakpoint()`
8
+ // -------------------------------------------------------------------------------
9
+ // @param $n [string] : how to calculate breakpoint
10
+ // @param $key [string] : key of breakpoint
11
+ // @param $i [number] : index of current breakpoint
12
+ // -------------------------------------------------------------------------------
13
+ // @return calculated value
14
+
15
+ @function calc-breakpoint($n, $key, $i) {
16
+ @if $n == "alias" {
17
+ @if get-value("settings", "grid") == "fixed" {
18
+ @if is-lowest-breakpoint($key) {
19
+ @return 0;
20
+ } @else {
21
+ @return get-value($key, "breakpoint");
22
+ }
23
+ } @else if get-value("settings", "grid") == "fluid" {
24
+ @return get-value($key, "breakpoint");
25
+ }
26
+ } @else if $n == "next" {
27
+ @if is-lowest-breakpoint($key) {
28
+ @return 0;
29
+ } @else {
30
+ @return get-value(steal-key(($i + 1)), "breakpoint");
31
+ }
32
+ } @else if $n == "prev" {
33
+ @if is-highest-breakpoint($key) {
34
+ @return get-value($key, "breakpoint");
35
+ } @else {
36
+ @return get-value(steal-key(($i - 1)), "breakpoint");
37
+ }
38
+ }
39
39
  }
@@ -1,32 +1,32 @@
1
- // Calculate margin
2
- // -------------------------------------------------------------------------------
3
- // @dependence `get-value()`
4
- // @dependence `fluid-width()`
5
- // -------------------------------------------------------------------------------
6
- // @param $key [string] : key for lookup
7
- // @param $span [number] : span value of element
8
- // @param $context [number] : context value of element
9
- // -------------------------------------------------------------------------------
10
- // @return calculated value | false
11
-
12
- @function calc-margin($key, $span, $context: null) {
13
- @if get-value("settings", "grid") == "fluid" {
14
- @if $key == "container" or $span == "container" {
15
- @return 0;
16
- } @else if $context == null {
17
- @return fluid-width(get-value("settings", "gutter"), get-value($key, "breakpoint"));
18
- } @else if $context <= get-value($key, "columns") {
19
- @return fluid-width(get-value("settings", "gutter"), ((get-value($key, "breakpoint") / get-value($key, "columns") * $context)));
20
- } @else {
21
- @return fluid-width(get-value("settings", "gutter") / get-value($key, "columns") * $context, ((get-value($key, "breakpoint") / get-value($key, "columns") * $context)));
22
- }
23
- } @if get-value("settings", "grid") == "fixed" {
24
- @if $key == "container" or $span == "container" {
25
- @return 0;
26
- } @else {
27
- @return get-value("settings", "gutter");
28
- }
29
- } @else {
30
- @return false;
31
- }
1
+ // Calculate margin
2
+ // -------------------------------------------------------------------------------
3
+ // @dependence `get-value()`
4
+ // @dependence `fluid-width()`
5
+ // -------------------------------------------------------------------------------
6
+ // @param $key [string] : key for lookup
7
+ // @param $span [number] : span value of element
8
+ // @param $context [number] : context value of element
9
+ // -------------------------------------------------------------------------------
10
+ // @return calculated value | false
11
+
12
+ @function calc-margin($key, $span, $context: null) {
13
+ @if get-value("settings", "grid") == "fluid" {
14
+ @if $key == "container" or $span == "container" {
15
+ @return 0;
16
+ } @else if $context == null {
17
+ @return fluid-width(get-value("settings", "gutter"), get-value($key, "breakpoint"));
18
+ } @else if $context <= get-value($key, "columns") {
19
+ @return fluid-width(get-value("settings", "gutter"), ((get-value($key, "breakpoint") / get-value($key, "columns") * $context)));
20
+ } @else {
21
+ @return fluid-width(get-value("settings", "gutter") / get-value($key, "columns") * $context, ((get-value($key, "breakpoint") / get-value($key, "columns") * $context)));
22
+ }
23
+ } @if get-value("settings", "grid") == "fixed" {
24
+ @if $key == "container" or $span == "container" {
25
+ @return 0;
26
+ } @else {
27
+ @return get-value("settings", "gutter");
28
+ }
29
+ } @else {
30
+ @return false;
31
+ }
32
32
  }
@@ -1,44 +1,44 @@
1
- // Calculate width
2
- // -------------------------------------------------------------------------------
3
- // @dependence `get-value()`
4
- // @dependence `fluid-width()`
5
- // -------------------------------------------------------------------------------
6
- // @param $key [string] : key for lookup
7
- // @param $span [number] : span value of element
8
- // @param $context [number] : context value of element
9
- // -------------------------------------------------------------------------------
10
- // @return calculated value | false
11
-
12
- @function calc-width($key, $span, $context: null) {
13
- @if get-value("settings", "grid") == "fluid" {
14
-
15
- @if $key == "container" or $span == "container" {
16
-
17
- @return fluid-width(get-value($key, "breakpoint"), get-value($key, "breakpoint"));
18
-
19
- } @else if $context == null {
20
-
21
- @return fluid-width((get-value($key, "breakpoint") / get-value($key, "columns") * $span), get-value($key, "breakpoint"));
22
-
23
- } @else {
24
-
25
- @return fluid-width((get-value($key, "breakpoint") / get-value($key, "columns") * $span), ((get-value($key, "breakpoint") / get-value($key, "columns") * $context)));
26
-
27
- }
28
-
29
- } @if get-value("settings", "grid") == "fixed" {
30
-
31
- @if $key == "container" or $span == "container" {
32
-
33
- @return get-value($key, "breakpoint");
34
-
35
- } @else {
36
-
37
- @return get-value($key, "breakpoint") / get-value($key, "columns") * $span;
38
-
39
- }
40
-
41
- } @else {
42
- @return false;
43
- }
44
- }
1
+ // Calculate width
2
+ // -------------------------------------------------------------------------------
3
+ // @dependence `get-value()`
4
+ // @dependence `fluid-width()`
5
+ // -------------------------------------------------------------------------------
6
+ // @param $key [string] : key for lookup
7
+ // @param $span [number] : span value of element
8
+ // @param $context [number] : context value of element
9
+ // -------------------------------------------------------------------------------
10
+ // @return calculated value | false
11
+
12
+ @function calc-width($key, $span, $context: null) {
13
+ @if get-value("settings", "grid") == "fluid" {
14
+
15
+ @if $key == "container" or $span == "container" {
16
+
17
+ @return fluid-width(get-value($key, "breakpoint"), get-value($key, "breakpoint"));
18
+
19
+ } @else if $context == null {
20
+
21
+ @return fluid-width((get-value($key, "breakpoint") / get-value($key, "columns") * $span), get-value($key, "breakpoint"));
22
+
23
+ } @else {
24
+
25
+ @return fluid-width((get-value($key, "breakpoint") / get-value($key, "columns") * $span), ((get-value($key, "breakpoint") / get-value($key, "columns") * $context)));
26
+
27
+ }
28
+
29
+ } @if get-value("settings", "grid") == "fixed" {
30
+
31
+ @if $key == "container" or $span == "container" {
32
+
33
+ @return get-value($key, "breakpoint");
34
+
35
+ } @else {
36
+
37
+ @return get-value($key, "breakpoint") / get-value($key, "columns") * $span;
38
+
39
+ }
40
+
41
+ } @else {
42
+ @return false;
43
+ }
44
+ }
@@ -1,22 +1,22 @@
1
- // Check if key exists in map
2
- //--------------------------------------------------------------------------------
3
- // @param $map [map] : map that contains $value
4
- // @param $value [string] : key to search for
5
- // -------------------------------------------------------------------------------
6
- // @return [bool]
7
-
8
- @function exists($map, $value){
9
-
10
- @if is-map($map) {
11
- @if map-has-key($map, $value) {
12
- @return true;
13
- }
14
- @each $key, $i in $map {
15
- @if exists($i, $value) {
16
- @return true;
17
- }
18
- }
19
- }
20
-
21
- @return false;
1
+ // Check if key exists in map
2
+ //--------------------------------------------------------------------------------
3
+ // @param $map [map] : map that contains $value
4
+ // @param $value [string] : key to search for
5
+ // -------------------------------------------------------------------------------
6
+ // @return [bool]
7
+
8
+ @function exists($map, $value){
9
+
10
+ @if is-map($map) {
11
+ @if map-has-key($map, $value) {
12
+ @return true;
13
+ }
14
+ @each $key, $i in $map {
15
+ @if exists($i, $value) {
16
+ @return true;
17
+ }
18
+ }
19
+ }
20
+
21
+ @return false;
22
22
  }
@@ -1,10 +1,10 @@
1
- // Convert fixed to fluid width
2
- //--------------------------------------------------------------------------------
3
- // @param $target [number] : target
4
- // @param $context [number] : context
5
- // -------------------------------------------------------------------------------
6
- // @return [number]
7
-
8
- @function fluid-width($target, $context) {
9
- @return ($target / $context) * 100%;
1
+ // Convert fixed to fluid width
2
+ //--------------------------------------------------------------------------------
3
+ // @param $target [number] : target
4
+ // @param $context [number] : context
5
+ // -------------------------------------------------------------------------------
6
+ // @return [number]
7
+
8
+ @function fluid-width($target, $context) {
9
+ @return ($target / $context) * 100%;
10
10
  }
@@ -1,59 +1,59 @@
1
- // Checks if instance exists in selector familiy tree, falls back from current selector
2
- // -------------------------------------------------------------------------------
3
- // @param $key [string] : breakpoint key to search for matching instance
4
- // @param $syntax [string | null] : searches for instance using passed syntax
5
- // -------------------------------------------------------------------------------
6
- // @return matching instance | false
7
-
8
- @function get-family-instance($key: get-value("settings", "default"), $syntax: $flint__support-syntax) {
9
- $selector-string: selector_string();
10
-
11
- // Check for syntax support, try to find instance using it
12
- @if $syntax {
13
- $selector-list: use-syntax($selector-string);
14
- $length: length($selector-list);
15
-
16
- // Loop through transformed selectors
17
- @for $i from 1 through $length {
18
-
19
- // Check last selector in list
20
- @if exists($flint__instances, "#{last($selector-list)}::#{$key}") {
21
-
22
- // Return the matching instance key
23
- @return "#{last($selector-list)}::#{$key}";
24
-
25
- } @else {
26
-
27
- // Else, remove the last selector and loop again
28
- $selector-list: remove($selector-list, last($selector-list));
29
-
30
- }
31
- }
32
-
33
- // Search for a parent instance normally
34
- @return get-family-instance($key, null);
35
-
36
- } @else {
37
- $selector-list: string-to-list($selector-string);
38
- $length: length($selector-list);
39
-
40
- // Loop through length of list of selectors
41
- @for $i from 1 through $length {
42
-
43
- // Make sure that we're not counting the current selector string
44
- @if exists($flint__instances, "#{list-to-string($selector-list, " ")}::#{$key}") and $selector-string != list-to-string($selector-list, " ") {
45
-
46
- // Return the matching instance key
47
- @return "#{list-to-string($selector-list, " ")}::#{$key}";
48
-
49
- } @else {
50
-
51
- // Else, remove the last selector and loop again
52
- $selector-list: remove($selector-list, last($selector-list));
53
-
54
- }
55
- }
56
-
57
- @return false;
58
- }
59
- }
1
+ // Checks if instance exists in selector familiy tree, falls back from current selector
2
+ // -------------------------------------------------------------------------------
3
+ // @param $key [string] : breakpoint key to search for matching instance
4
+ // @param $syntax [string | null] : searches for instance using passed syntax
5
+ // -------------------------------------------------------------------------------
6
+ // @return matching instance | false
7
+
8
+ @function get-family-instance($key: get-value("settings", "default"), $syntax: $flint__support-syntax) {
9
+ $selector-string: selector_string();
10
+
11
+ // Check for syntax support, try to find instance using it
12
+ @if $syntax {
13
+ $selector-list: use-syntax($selector-string);
14
+ $length: length($selector-list);
15
+
16
+ // Loop through transformed selectors
17
+ @for $i from 1 through $length {
18
+
19
+ // Check last selector in list
20
+ @if exists($flint__instances, "#{last($selector-list)}::#{$key}") {
21
+
22
+ // Return the matching instance key
23
+ @return "#{last($selector-list)}::#{$key}";
24
+
25
+ } @else {
26
+
27
+ // Else, remove the last selector and loop again
28
+ $selector-list: remove($selector-list, last($selector-list));
29
+
30
+ }
31
+ }
32
+
33
+ // Search for a parent instance normally
34
+ @return get-family-instance($key, null);
35
+
36
+ } @else {
37
+ $selector-list: string-to-list($selector-string);
38
+ $length: length($selector-list);
39
+
40
+ // Loop through length of list of selectors
41
+ @for $i from 1 through $length {
42
+
43
+ // Make sure that we're not counting the current selector string
44
+ @if exists($flint__instances, "#{list-to-string($selector-list, " ")}::#{$key}") and $selector-string != list-to-string($selector-list, " ") {
45
+
46
+ // Return the matching instance key
47
+ @return "#{list-to-string($selector-list, " ")}::#{$key}";
48
+
49
+ } @else {
50
+
51
+ // Else, remove the last selector and loop again
52
+ $selector-list: remove($selector-list, last($selector-list));
53
+
54
+ }
55
+ }
56
+
57
+ @return false;
58
+ }
59
+ }
@@ -1,15 +1,15 @@
1
- // Gets the index of the passed key
2
- // -------------------------------------------------------------------------------
3
- // @dependence `steal-key()`
4
- // -------------------------------------------------------------------------------
5
- // @param $key [string] : breakpoint key
6
- // -------------------------------------------------------------------------------
7
- // @return [number]
8
-
9
- @function get-index($key) {
10
- @for $i from 1 through (length(map-fetch($flint, "config")) - 1) {
11
- @if steal-key($i) == $key {
12
- @return $i;
13
- }
14
- }
1
+ // Gets the index of the passed key
2
+ // -------------------------------------------------------------------------------
3
+ // @dependence `steal-key()`
4
+ // -------------------------------------------------------------------------------
5
+ // @param $key [string] : breakpoint key
6
+ // -------------------------------------------------------------------------------
7
+ // @return [number]
8
+
9
+ @function get-index($key) {
10
+ @for $i from 1 through (length(map-fetch($flint, "config")) - 1) {
11
+ @if steal-key($i) == $key {
12
+ @return $i;
13
+ }
14
+ }
15
15
  }
@@ -1,19 +1,19 @@
1
- // Get single value from key in instance map based on $selector::$key
2
- // -------------------------------------------------------------------------------
3
- // @dependence `map-fetch()`
4
- // -------------------------------------------------------------------------------
5
- // @warning : all values @returned are strings and must be converted with `to-number()`
6
- // -------------------------------------------------------------------------------
7
- // @param $key [string] : key
8
- // @param $value [number] : value
9
- // @param $deep [number] : fetch deep value
10
- // -------------------------------------------------------------------------------
11
- // @return [string]
12
-
13
- @function get-instance-value($key, $value, $deep: null) {
14
- @if $deep == null {
15
- @return map-fetch($flint__instances, get-family-instance($key) $value);
16
- } @else {
17
- @return map-fetch($flint__instances, get-family-instance($key) $value $deep);
18
- }
19
- }
1
+ // Get single value from key in instance map based on $selector::$key
2
+ // -------------------------------------------------------------------------------
3
+ // @dependence `map-fetch()`
4
+ // -------------------------------------------------------------------------------
5
+ // @warning : all values @returned are strings and must be converted with `to-number()`
6
+ // -------------------------------------------------------------------------------
7
+ // @param $key [string] : key
8
+ // @param $value [number] : value
9
+ // @param $deep [number] : fetch deep value
10
+ // -------------------------------------------------------------------------------
11
+ // @return [string]
12
+
13
+ @function get-instance-value($key, $value, $deep: null) {
14
+ @if $deep == null {
15
+ @return map-fetch($flint__instances, get-family-instance($key) $value);
16
+ } @else {
17
+ @return map-fetch($flint__instances, get-family-instance($key) $value $deep);
18
+ }
19
+ }