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.
- checksums.yaml +4 -4
- data/README.md +86 -72
- data/lib/flint.rb +2 -2
- data/stylesheets/_flint.scss +3 -3
- data/stylesheets/flint/config/_config.scss +9 -9
- data/stylesheets/flint/functions/helpers/_helpers.scss +37 -31
- data/stylesheets/flint/functions/lib/_calc-breakpoint.scss +14 -11
- data/stylesheets/flint/functions/lib/_calc-margin.scss +13 -13
- data/stylesheets/flint/functions/lib/_calc-width.scss +13 -13
- data/stylesheets/flint/functions/lib/_exists.scss +3 -3
- data/stylesheets/flint/functions/lib/_fluid-width.scss +3 -3
- data/stylesheets/flint/functions/lib/_get-family-instance.scss +3 -3
- data/stylesheets/flint/functions/lib/_get-index.scss +3 -3
- data/stylesheets/flint/functions/lib/_get-instance-value.scss +7 -7
- data/stylesheets/flint/functions/lib/_get-substring.scss +3 -3
- data/stylesheets/flint/functions/lib/_get-value.scss +7 -7
- data/stylesheets/flint/functions/lib/_instance.scss +10 -10
- data/stylesheets/flint/functions/lib/_last.scss +2 -2
- data/stylesheets/flint/functions/lib/_list-to-string.scss +3 -3
- data/stylesheets/flint/functions/lib/_map-fetch.scss +5 -6
- data/stylesheets/flint/functions/lib/_next-index.scss +6 -6
- data/stylesheets/flint/functions/lib/_purge.scss +2 -2
- data/stylesheets/flint/functions/lib/_remove.scss +4 -4
- data/stylesheets/flint/functions/lib/_replace.scss +4 -4
- data/stylesheets/flint/functions/lib/_steal-key.scss +4 -4
- data/stylesheets/flint/functions/lib/_steal-values.scss +3 -3
- data/stylesheets/flint/functions/lib/_string-to-list.scss +4 -4
- data/stylesheets/flint/functions/lib/_string-to-number.scss +3 -3
- data/stylesheets/flint/mixins/lib/_clearfix.scss +3 -2
- data/stylesheets/flint/mixins/lib/_flint-calculate.scss +115 -115
- data/stylesheets/flint/mixins/lib/_flint-main.scss +174 -141
- data/stylesheets/flint/mixins/lib/_new-instance.scss +9 -9
- data/stylesheets/flint/mixins/lib/_print-instance.scss +4 -4
- 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 [
|
7
|
-
// @param $key [
|
8
|
-
// @param $i [
|
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
|
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 [
|
7
|
-
// @param $span [
|
8
|
-
// @param $context [
|
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
|
10
|
+
// @return calculated value | false
|
11
11
|
|
12
|
-
@function calc-margin($key, $span, $context:
|
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 ==
|
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 [
|
7
|
-
// @param $span [
|
8
|
-
// @param $context [
|
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
|
10
|
+
// @return calculated value | false
|
11
11
|
|
12
|
-
@function calc-width($key, $span, $context:
|
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 ==
|
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 [
|
4
|
-
// @param $value [
|
3
|
+
// @param $map [map] : map that contains $value
|
4
|
+
// @param $value [string] : key to search for
|
5
5
|
// -------------------------------------------------------------------------------
|
6
|
-
// @return [
|
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 [
|
4
|
-
// @param $context [
|
3
|
+
// @param $target [integer] : target
|
4
|
+
// @param $context [integer] : context
|
5
5
|
// -------------------------------------------------------------------------------
|
6
|
-
// @return [
|
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 [
|
10
|
+
// @param $key [string] : breakpoint key to search for matching instance
|
11
11
|
// -------------------------------------------------------------------------------
|
12
|
-
// @return
|
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 [
|
5
|
+
// @param $key [string] : breakpoint key
|
6
6
|
// -------------------------------------------------------------------------------
|
7
|
-
// @return [
|
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
|
5
|
+
// @warning : all values @returned are strings and must be converted with `to-number()`
|
6
6
|
// -------------------------------------------------------------------------------
|
7
|
-
// @param $key [
|
8
|
-
// @param $value [
|
9
|
-
// @param $deep [
|
7
|
+
// @param $key [string] : key
|
8
|
+
// @param $value [integer] : value
|
9
|
+
// @param $deep [integer] : fetch deep value
|
10
10
|
// -------------------------------------------------------------------------------
|
11
|
-
// @return [
|
11
|
+
// @return [string]
|
12
12
|
|
13
|
-
@function get-instance-value($key, $value, $deep:
|
14
|
-
@if $deep ==
|
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 [
|
6
|
-
// @param $depth [
|
5
|
+
// @param $full-string [string] : string that contains substring
|
6
|
+
// @param $depth [integer | string] : depth of substring
|
7
7
|
// -------------------------------------------------------------------------------
|
8
|
-
// @return [
|
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 [
|
6
|
-
// @param $value [
|
5
|
+
// @param $key [string] : breakpoint key
|
6
|
+
// @param $value [string] : fetch value
|
7
7
|
// -------------------------------------------------------------------------------
|
8
|
-
// @return
|
8
|
+
// @return fetched value
|
9
9
|
|
10
|
-
@function get-value($key, $value:
|
11
|
-
@if $value ==
|
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 [
|
6
|
-
// @param $span [
|
7
|
-
// @param $context [
|
8
|
-
// @param $gutter [
|
9
|
-
// @param $shift [
|
10
|
-
// @param $outputWidth [
|
11
|
-
// @param $outputMarginRight [
|
12
|
-
// @param $outputMarginLeft [
|
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
|
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 [
|
3
|
+
// @param $list [list] : list
|
4
4
|
// -------------------------------------------------------------------------------
|
5
|
-
// @return [
|
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 [
|
6
|
-
// @param $glue [
|
5
|
+
// @param $list [list] : list
|
6
|
+
// @param $glue [string] : value to use as a join string
|
7
7
|
// -------------------------------------------------------------------------------
|
8
|
-
// @return [
|
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 [
|
6
|
-
// @param $n [
|
5
|
+
// @param $i [map] : map
|
6
|
+
// @param $n [list] : keys
|
7
7
|
// -------------------------------------------------------------------------------
|
8
|
-
// @return
|
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
|
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
|
1
|
+
// Returns next indexed key based on passed index
|
2
2
|
// -------------------------------------------------------------------------------
|
3
|
-
// @param $index [
|
3
|
+
// @param $index [integer] : index
|
4
4
|
// -------------------------------------------------------------------------------
|
5
|
-
// @return [
|
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
|
13
|
+
@return null;
|
14
14
|
}
|
15
15
|
}
|
@@ -4,9 +4,9 @@
|
|
4
4
|
// -------------------------------------------------------------------------------
|
5
5
|
// @dependence `is-true()`
|
6
6
|
// -------------------------------------------------------------------------------
|
7
|
-
// @param $list [
|
7
|
+
// @param $list [list] : list
|
8
8
|
// -------------------------------------------------------------------------------
|
9
|
-
// @return [
|
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 [
|
8
|
-
// @param $value [
|
9
|
-
// @param $recursive [
|
7
|
+
// @param $list [list] : list
|
8
|
+
// @param $value [literal] : value to remove
|
9
|
+
// @param $recursive [bool] : enable / disable recursivity
|
10
10
|
// -------------------------------------------------------------------------------
|
11
|
-
// @return [
|
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 [
|
6
|
-
// @param $old [
|
7
|
-
// @param $value [
|
5
|
+
// @param $list [list] : list
|
6
|
+
// @param $old [literal] : value to replace
|
7
|
+
// @param $value [literal] : new value for $old
|
8
8
|
// -------------------------------------------------------------------------------
|
9
|
-
// @return [
|
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 [
|
3
|
+
// @param $index [integer] : index of key
|
4
4
|
// -------------------------------------------------------------------------------
|
5
|
-
// @return [
|
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 [
|
7
|
-
// @param $value [
|
6
|
+
// @param $index [integer] : index of breakpoint key in config
|
7
|
+
// @param $value [integer] : value
|
8
8
|
// -------------------------------------------------------------------------------
|
9
|
-
// @return [
|
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) {
|