flint-gs 1.3.5 → 1.3.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +86 -72
  3. data/lib/flint.rb +2 -2
  4. data/stylesheets/_flint.scss +3 -3
  5. data/stylesheets/flint/config/_config.scss +9 -9
  6. data/stylesheets/flint/functions/helpers/_helpers.scss +37 -31
  7. data/stylesheets/flint/functions/lib/_calc-breakpoint.scss +14 -11
  8. data/stylesheets/flint/functions/lib/_calc-margin.scss +13 -13
  9. data/stylesheets/flint/functions/lib/_calc-width.scss +13 -13
  10. data/stylesheets/flint/functions/lib/_exists.scss +3 -3
  11. data/stylesheets/flint/functions/lib/_fluid-width.scss +3 -3
  12. data/stylesheets/flint/functions/lib/_get-family-instance.scss +3 -3
  13. data/stylesheets/flint/functions/lib/_get-index.scss +3 -3
  14. data/stylesheets/flint/functions/lib/_get-instance-value.scss +7 -7
  15. data/stylesheets/flint/functions/lib/_get-substring.scss +3 -3
  16. data/stylesheets/flint/functions/lib/_get-value.scss +7 -7
  17. data/stylesheets/flint/functions/lib/_instance.scss +10 -10
  18. data/stylesheets/flint/functions/lib/_last.scss +2 -2
  19. data/stylesheets/flint/functions/lib/_list-to-string.scss +3 -3
  20. data/stylesheets/flint/functions/lib/_map-fetch.scss +5 -6
  21. data/stylesheets/flint/functions/lib/_next-index.scss +6 -6
  22. data/stylesheets/flint/functions/lib/_purge.scss +2 -2
  23. data/stylesheets/flint/functions/lib/_remove.scss +4 -4
  24. data/stylesheets/flint/functions/lib/_replace.scss +4 -4
  25. data/stylesheets/flint/functions/lib/_steal-key.scss +4 -4
  26. data/stylesheets/flint/functions/lib/_steal-values.scss +3 -3
  27. data/stylesheets/flint/functions/lib/_string-to-list.scss +4 -4
  28. data/stylesheets/flint/functions/lib/_string-to-number.scss +3 -3
  29. data/stylesheets/flint/mixins/lib/_clearfix.scss +3 -2
  30. data/stylesheets/flint/mixins/lib/_flint-calculate.scss +115 -115
  31. data/stylesheets/flint/mixins/lib/_flint-main.scss +174 -141
  32. data/stylesheets/flint/mixins/lib/_new-instance.scss +9 -9
  33. data/stylesheets/flint/mixins/lib/_print-instance.scss +4 -4
  34. metadata +2 -2
@@ -2,35 +2,38 @@
2
2
  // -------------------------------------------------------------------------------
3
3
  // @dependence `map-fetch()`
4
4
  // @dependence `get-value()`
5
+ // @dependence `steal-key()`
6
+ // @dependence `is-highest-breakpoint()`
7
+ // @dependence `is-lowest-breakpoint()`
5
8
  // -------------------------------------------------------------------------------
6
- // @param $n ["alias" | "prev" | "next"] : how to calculate breakpoint
7
- // @param $key [Value] : key of breakpoint
8
- // @param $i [Value] : index of current breakpoint
9
+ // @param $n [string] : how to calculate breakpoint
10
+ // @param $key [string] : key of breakpoint
11
+ // @param $i [integer] : index of current breakpoint
9
12
  // -------------------------------------------------------------------------------
10
- // @return [Value]
13
+ // @return calculated value
11
14
 
12
15
  @function calc-breakpoint($n, $key, $i) {
13
16
  @if $n == "alias" {
14
- @if get-value(settings, grid) == "fixed" {
17
+ @if get-value("settings", "grid") == "fixed" {
15
18
  @if is-lowest-breakpoint($key) {
16
19
  @return 0;
17
20
  } @else {
18
- @return get-value($key, breakpoint);
21
+ @return get-value($key, "breakpoint");
19
22
  }
20
- } @else if get-value(settings, grid) == "fluid" {
21
- @return get-value($key, breakpoint);
23
+ } @else if get-value("settings", "grid") == "fluid" {
24
+ @return get-value($key, "breakpoint");
22
25
  }
23
26
  } @else if $n == "next" {
24
27
  @if is-lowest-breakpoint($key) {
25
28
  @return 0;
26
29
  } @else {
27
- @return get-value(steal-key(($i + 1)), breakpoint);
30
+ @return get-value(steal-key(($i + 1)), "breakpoint");
28
31
  }
29
32
  } @else if $n == "prev" {
30
33
  @if is-highest-breakpoint($key) {
31
- @return get-value($key, breakpoint);
34
+ @return get-value($key, "breakpoint");
32
35
  } @else {
33
- @return get-value(steal-key(($i - 1)), breakpoint);
36
+ @return get-value(steal-key(($i - 1)), "breakpoint");
34
37
  }
35
38
  }
36
39
  }
@@ -3,28 +3,28 @@
3
3
  // @dependence `get-value()`
4
4
  // @dependence `fluid-width()`
5
5
  // -------------------------------------------------------------------------------
6
- // @param $key [Breakpoint | "container"] : key for lookup
7
- // @param $span [Value] : span of element
8
- // @param $context [Value] : context of element
6
+ // @param $key [string] : key for lookup
7
+ // @param $span [integer] : span value of element
8
+ // @param $context [integer] : context value of element
9
9
  // -------------------------------------------------------------------------------
10
- // @return [Value] | false
10
+ // @return calculated value | false
11
11
 
12
- @function calc-margin($key, $span, $context: NULL) {
13
- @if get-value(settings, grid) == "fluid" {
12
+ @function calc-margin($key, $span, $context: null) {
13
+ @if get-value("settings", "grid") == "fluid" {
14
14
  @if $key == "container" or $span == "container" {
15
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)));
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
20
  } @else {
21
- @return fluid-width(get-value(settings, gutter) / get-value($key, columns) * $context, ((get-value($key, breakpoint) / get-value($key, columns) * $context)));
21
+ @return fluid-width(get-value("settings", "gutter") / get-value($key, "columns") * $context, ((get-value($key, "breakpoint") / get-value($key, "columns") * $context)));
22
22
  }
23
- } @if get-value(settings, grid) == "fixed" {
23
+ } @if get-value("settings", "grid") == "fixed" {
24
24
  @if $key == "container" or $span == "container" {
25
25
  @return 0;
26
26
  } @else {
27
- @return get-value(settings, gutter);
27
+ @return get-value("settings", "gutter");
28
28
  }
29
29
  } @else {
30
30
  @return false;
@@ -3,26 +3,26 @@
3
3
  // @dependence `get-value()`
4
4
  // @dependence `fluid-width()`
5
5
  // -------------------------------------------------------------------------------
6
- // @param $key [Breakpoint | "container"] : how to calculate value
7
- // @param $span [Value] : span
8
- // @param $context [Value] : if context is needed
6
+ // @param $key [string] : key for lookup
7
+ // @param $span [integer] : span value of element
8
+ // @param $context [integer] : context value of element
9
9
  // -------------------------------------------------------------------------------
10
- // @return [Value] | false
10
+ // @return calculated value | false
11
11
 
12
- @function calc-width($key, $span, $context: NULL) {
13
- @if get-value(settings, grid) == "fluid" {
12
+ @function calc-width($key, $span, $context: null) {
13
+ @if get-value("settings", "grid") == "fluid" {
14
14
  @if $key == "container" or $span == "container" {
15
- @return fluid-width(get-value($key, breakpoint), get-value($key, breakpoint));
16
- } @else if $context == NULL {
17
- @return fluid-width((get-value($key, breakpoint) / get-value($key, columns) * $span), get-value($key, breakpoint));
15
+ @return fluid-width(get-value($key, "breakpoint"), get-value($key, "breakpoint"));
16
+ } @else if $context == null {
17
+ @return fluid-width((get-value($key, "breakpoint") / get-value($key, "columns") * $span), get-value($key, "breakpoint"));
18
18
  } @else {
19
- @return fluid-width((get-value($key, breakpoint) / get-value($key, columns) * $span), ((get-value($key, breakpoint) / get-value($key, columns) * $context)));
19
+ @return fluid-width((get-value($key, "breakpoint") / get-value($key, "columns") * $span), ((get-value($key, "breakpoint") / get-value($key, "columns") * $context)));
20
20
  }
21
- } @if get-value(settings, grid) == "fixed" {
21
+ } @if get-value("settings", "grid") == "fixed" {
22
22
  @if $key == "container" or $span == "container" {
23
- @return get-value($key, breakpoint);
23
+ @return get-value($key, "breakpoint");
24
24
  } @else {
25
- @return get-value($key, breakpoint) / get-value($key, columns) * $span;
25
+ @return get-value($key, "breakpoint") / get-value($key, "columns") * $span;
26
26
  }
27
27
  } @else {
28
28
  @return false;
@@ -1,9 +1,9 @@
1
1
  // Check if key exists in map
2
2
  //--------------------------------------------------------------------------------
3
- // @param $map [Map] : map that contains $value
4
- // @param $value [Map] : key to search for
3
+ // @param $map [map] : map that contains $value
4
+ // @param $value [string] : key to search for
5
5
  // -------------------------------------------------------------------------------
6
- // @return [Boolean]
6
+ // @return [bool]
7
7
 
8
8
  @function exists($map, $value){
9
9
 
@@ -1,9 +1,9 @@
1
1
  // Convert fixed to fluid width
2
2
  //--------------------------------------------------------------------------------
3
- // @param $target [Value] : target
4
- // @param $context [Value] : context
3
+ // @param $target [integer] : target
4
+ // @param $context [integer] : context
5
5
  // -------------------------------------------------------------------------------
6
- // @return [Value]
6
+ // @return [integer]
7
7
 
8
8
  @function fluid-width($target, $context) {
9
9
  @return ($target / $context) * 100%;
@@ -7,11 +7,11 @@
7
7
  // @dependence `exists()`
8
8
  // @dependence `remove()`
9
9
  // -------------------------------------------------------------------------------
10
- // @param $key [Breakpoint] : breakpoint key to search for matching instance
10
+ // @param $key [string] : breakpoint key to search for matching instance
11
11
  // -------------------------------------------------------------------------------
12
- // @return [Selectors] | false
12
+ // @return matching instance | false
13
13
 
14
- @function get-family-instance($key: get-value(settings, default)) {
14
+ @function get-family-instance($key: get-value("settings", "default")) {
15
15
  $selector-string: selector_string();
16
16
  $selector-list: string-to-list($selector-string);
17
17
  $length: length($selector-list);
@@ -2,12 +2,12 @@
2
2
  // -------------------------------------------------------------------------------
3
3
  // @dependence `steal-key()`
4
4
  // -------------------------------------------------------------------------------
5
- // @param $key [Breakpoint] : breakpoint key
5
+ // @param $key [string] : breakpoint key
6
6
  // -------------------------------------------------------------------------------
7
- // @return [Value]
7
+ // @return [integer]
8
8
 
9
9
  @function get-index($key) {
10
- @for $i from 1 through (length(map-fetch($flint, config)) - 1) {
10
+ @for $i from 1 through (length(map-fetch($flint, "config")) - 1) {
11
11
  @if steal-key($i) == $key {
12
12
  @return $i;
13
13
  }
@@ -2,16 +2,16 @@
2
2
  // -------------------------------------------------------------------------------
3
3
  // @dependence `map-fetch()`
4
4
  // -------------------------------------------------------------------------------
5
- // @warning : all [Values] @returned are strings and must be converted with `to-number()`
5
+ // @warning : all values @returned are strings and must be converted with `to-number()`
6
6
  // -------------------------------------------------------------------------------
7
- // @param $key [Breakpoint] : key
8
- // @param $value [Value] : value
9
- // @param $deep [Value] : fetch deep value
7
+ // @param $key [string] : key
8
+ // @param $value [integer] : value
9
+ // @param $deep [integer] : fetch deep value
10
10
  // -------------------------------------------------------------------------------
11
- // @return [Value]
11
+ // @return [string]
12
12
 
13
- @function get-instance-value($key, $value, $deep: NULL) {
14
- @if $deep == NULL {
13
+ @function get-instance-value($key, $value, $deep: null) {
14
+ @if $deep == null {
15
15
  @return map-fetch($flint__instances, get-family-instance($key) $value);
16
16
  } @else {
17
17
  @return map-fetch($flint__instances, get-family-instance($key) $value $deep);
@@ -2,10 +2,10 @@
2
2
  // -------------------------------------------------------------------------------
3
3
  // @dependence `string-to-list()`
4
4
  // -------------------------------------------------------------------------------
5
- // @param $full-string [String] : string that contains substring
6
- // @param $depth [Integer | "last | "first"] : depth of substring
5
+ // @param $full-string [string] : string that contains substring
6
+ // @param $depth [integer | string] : depth of substring
7
7
  // -------------------------------------------------------------------------------
8
- // @return [String]
8
+ // @return [string]
9
9
 
10
10
  @function get-substring($full-string, $depth) {
11
11
  @if is-string($full-string) {
@@ -2,15 +2,15 @@
2
2
  // -------------------------------------------------------------------------------
3
3
  // @dependence `map-fetch()`
4
4
  // -------------------------------------------------------------------------------
5
- // @param $key [Value] : breakpoint key
6
- // @param $value [Value] : fetch value
5
+ // @param $key [string] : breakpoint key
6
+ // @param $value [string] : fetch value
7
7
  // -------------------------------------------------------------------------------
8
- // @return [Value]
8
+ // @return fetched value
9
9
 
10
- @function get-value($key, $value: NULL) {
11
- @if $value == NULL {
12
- @return map-fetch($flint, config $key);
10
+ @function get-value($key, $value: null) {
11
+ @if $value == null {
12
+ @return map-fetch($flint, "config" $key);
13
13
  } @else {
14
- @return map-fetch($flint, config $key $value);
14
+ @return map-fetch($flint, "config" $key $value);
15
15
  }
16
16
  }
@@ -2,16 +2,16 @@
2
2
  // -------------------------------------------------------------------------------
3
3
  // @dependence `get-value()`
4
4
  // -------------------------------------------------------------------------------
5
- // @param $key [Breakpoint] : computed breakpoint of instance
6
- // @param $span [Value] : computed span of instance
7
- // @param $context [Value] : computed context of instance
8
- // @param $gutter [Value] : computed gutter of instance
9
- // @param $shift [Value] : computed shift of instance
10
- // @param $outputWidth [Value] : computed width of instance
11
- // @param $outputMarginRight [Value] : computed right margin of instance
12
- // @param $outputMarginLeft [Value] : computed left margin of instance
5
+ // @param $key [string] : computed breakpoint of instance
6
+ // @param $span [integer] : computed span of instance
7
+ // @param $context [integer] : computed context of instance
8
+ // @param $gutter [integer] : computed gutter of instance
9
+ // @param $shift [integer] : computed shift of instance
10
+ // @param $outputWidth [integer] : computed width of instance
11
+ // @param $outputMarginRight [integer] : computed right margin of instance
12
+ // @param $outputMarginLeft [integer] : computed left margin of instance
13
13
  // -------------------------------------------------------------------------------
14
- // @return [Value] | map
14
+ // @return instance map
15
15
 
16
16
  @function instance($key, $span, $context, $gutter, $shift, $outputWidth, $outputMarginRight, $outputMarginLeft) {
17
17
  // Increase the instance count
@@ -29,7 +29,7 @@
29
29
  "breakpoint": #{get-value($key, breakpoint)},
30
30
  "columns": #{get-value($key, columns)},
31
31
  "span": #{$span},
32
- "context": #{if($context == "auto", get-instance-value($key, span), $context)},
32
+ "context": #{if($context == "auto", get-instance-value($key, "span"), $context)},
33
33
  "gutter": #{$gutter},
34
34
  "shift": #{$shift},
35
35
  "output": (
@@ -1,8 +1,8 @@
1
1
  // Get last item in list
2
2
  // -------------------------------------------------------------------------------
3
- // @param $list [List] : list
3
+ // @param $list [list] : list
4
4
  // -------------------------------------------------------------------------------
5
- // @return [List]
5
+ // @return [list]
6
6
 
7
7
  @function last($list) {
8
8
  @return nth($list, length($list));
@@ -2,10 +2,10 @@
2
2
  // -------------------------------------------------------------------------------
3
3
  // @documentation http://sassylists.com/documentation/#to-string
4
4
  // -------------------------------------------------------------------------------
5
- // @param $list [List] : list
6
- // @param $glue [String] : value to use as a join string
5
+ // @param $list [list] : list
6
+ // @param $glue [string] : value to use as a join string
7
7
  // -------------------------------------------------------------------------------
8
- // @return [String]
8
+ // @return [string]
9
9
 
10
10
  @function list-to-string($list, $glue: "", $is-nested: false) {
11
11
  $result: null;
@@ -2,19 +2,18 @@
2
2
  // -------------------------------------------------------------------------------
3
3
  // @dependence `map-fetche()`
4
4
  // -------------------------------------------------------------------------------
5
- // @param $i [Map] : map
6
- // @param $n [Keys...] : keys
5
+ // @param $i [map] : map
6
+ // @param $n [list] : keys
7
7
  // -------------------------------------------------------------------------------
8
- // @return [Value] | false
8
+ // @return fetched value | false
9
9
 
10
10
  @function map-fetch($map, $keys) {
11
11
  $key: nth($keys, 1);
12
12
  $length: length($keys);
13
13
  $value: map-get($map, $key);
14
14
 
15
- // check if value equals NULL (meaning the @param was incorrect and the map doesn't exist)
16
-
17
- @if $value == NULL {
15
+ // check if value equals null (meaning the @param was incorrect and the map doesn't exist)
16
+ @if $value == null {
18
17
  @warn "Invalid arguments padded to function: `map-fetch(#{$map}, #{$keys})`";
19
18
  @return false;
20
19
  }
@@ -1,15 +1,15 @@
1
- // Returns next indexed key based on passed number
1
+ // Returns next indexed key based on passed index
2
2
  // -------------------------------------------------------------------------------
3
- // @param $index [Value] : index
3
+ // @param $index [integer] : index
4
4
  // -------------------------------------------------------------------------------
5
- // @return [Key] | NULL
5
+ // @return [string] | null
6
6
 
7
7
  @function next-index($index) {
8
- @if $index != (length(map-fetch($flint, config)) - 1) {
9
- @each $key in nth(map-get($flint, config), $index + 1) {
8
+ @if $index != (length(map-fetch($flint, "config")) - 1) {
9
+ @each $key in nth(map-get($flint, "config"), $index + 1) {
10
10
  @return $key;
11
11
  }
12
12
  } @else {
13
- @return NULL;
13
+ @return null;
14
14
  }
15
15
  }
@@ -4,9 +4,9 @@
4
4
  // -------------------------------------------------------------------------------
5
5
  // @dependence `is-true()`
6
6
  // -------------------------------------------------------------------------------
7
- // @param $list [List] : list
7
+ // @param $list [list] : list
8
8
  // -------------------------------------------------------------------------------
9
- // @return [List]
9
+ // @return [list]
10
10
 
11
11
  @function purge($list) {
12
12
  $result: ();
@@ -4,11 +4,11 @@
4
4
  // -------------------------------------------------------------------------------
5
5
  // @dependence `replace()`
6
6
  // -------------------------------------------------------------------------------
7
- // @param $list [List] : list
8
- // @param $value [Literal] : value to remove
9
- // @param $recursive [Boolean] : enable / disable recursivity
7
+ // @param $list [list] : list
8
+ // @param $value [literal] : value to remove
9
+ // @param $recursive [bool] : enable / disable recursivity
10
10
  // -------------------------------------------------------------------------------
11
- // @return [List]
11
+ // @return [list]
12
12
 
13
13
  @function remove($list, $value) {
14
14
  @return replace($list, $value, null);
@@ -2,11 +2,11 @@
2
2
  // -------------------------------------------------------------------------------
3
3
  // @documentation http://sassylists.com/documentation.html#replace
4
4
  // -------------------------------------------------------------------------------
5
- // @param $list [List] : list
6
- // @param $old [Literal] : value to replace
7
- // @param $value [Literal] : new value for $old
5
+ // @param $list [list] : list
6
+ // @param $old [literal] : value to replace
7
+ // @param $value [literal] : new value for $old
8
8
  // -------------------------------------------------------------------------------
9
- // @return [List]
9
+ // @return [list]
10
10
 
11
11
  @function replace($list, $old, $value) {
12
12
  $running: true;
@@ -1,12 +1,12 @@
1
1
  // Steal key based on index number
2
2
  //--------------------------------------------------------------------------------
3
- // @param $index [Integer] : index of key
3
+ // @param $index [integer] : index of key
4
4
  // -------------------------------------------------------------------------------
5
- // @return [Breakpoint]
5
+ // @return [string]
6
6
 
7
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) {
8
+ @for $n from 1 through (length(map-fetch($flint, "config")) - 1) {
9
+ @each $key in nth(map-get($flint, "config"), $index) {
10
10
  @return $key;
11
11
  }
12
12
  }
@@ -3,10 +3,10 @@
3
3
  // @dependence `map-fetch()`
4
4
  // @dependence `get-value()`
5
5
  // -------------------------------------------------------------------------------
6
- // @param $index [Value] : index of breakpoint key in config
7
- // @param $value [Value] : value
6
+ // @param $index [integer] : index of breakpoint key in config
7
+ // @param $value [integer] : value
8
8
  // -------------------------------------------------------------------------------
9
- // @return [Value]
9
+ // @return [integer]
10
10
 
11
11
  @function steal-values($index, $value) {
12
12
  @for $n from 1 through (length(map-fetch($flint, config)) - 1) {