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.
- data/LICENSE +21 -21
- data/README.md +900 -900
- data/lib/flint.rb +17 -17
- data/stylesheets/_flint.scss +6 -6
- data/stylesheets/flint/config/_config.scss +83 -83
- data/stylesheets/flint/functions/_functions.scss +41 -41
- data/stylesheets/flint/functions/helpers/_helpers.scss +178 -178
- data/stylesheets/flint/functions/lib/_calc-breakpoint.scss +38 -38
- data/stylesheets/flint/functions/lib/_calc-margin.scss +31 -31
- data/stylesheets/flint/functions/lib/_calc-width.scss +44 -44
- data/stylesheets/flint/functions/lib/_exists.scss +21 -21
- data/stylesheets/flint/functions/lib/_fluid-width.scss +9 -9
- data/stylesheets/flint/functions/lib/_get-family-instance.scss +59 -59
- data/stylesheets/flint/functions/lib/_get-index.scss +14 -14
- data/stylesheets/flint/functions/lib/_get-instance-value.scss +19 -19
- data/stylesheets/flint/functions/lib/_get-substring.scss +23 -23
- data/stylesheets/flint/functions/lib/_get-value.scss +16 -16
- data/stylesheets/flint/functions/lib/_instance.scss +43 -43
- data/stylesheets/flint/functions/lib/_last.scss +8 -8
- data/stylesheets/flint/functions/lib/_list-to-string.scss +24 -24
- data/stylesheets/flint/functions/lib/_map-fetch.scss +33 -33
- data/stylesheets/flint/functions/lib/_next-index.scss +14 -14
- data/stylesheets/flint/functions/lib/_purge.scss +20 -20
- data/stylesheets/flint/functions/lib/_remove.scss +14 -14
- data/stylesheets/flint/functions/lib/_replace.scss +24 -24
- data/stylesheets/flint/functions/lib/_steal-key.scss +12 -12
- data/stylesheets/flint/functions/lib/_steal-values.scss +16 -16
- data/stylesheets/flint/functions/lib/_string-to-list.scss +84 -84
- data/stylesheets/flint/functions/lib/_string-to-number.scss +72 -72
- data/stylesheets/flint/functions/lib/_support-syntax-bem.scss +25 -25
- data/stylesheets/flint/functions/lib/_support-syntax.scss +28 -28
- data/stylesheets/flint/functions/lib/_types-in-list.scss +120 -120
- data/stylesheets/flint/functions/lib/_use-syntax.scss +11 -11
- data/stylesheets/flint/globals/_globals.scss +22 -22
- data/stylesheets/flint/mixins/_mixins.scss +7 -7
- data/stylesheets/flint/mixins/lib/_calculate.scss +765 -765
- data/stylesheets/flint/mixins/lib/_clearfix.scss +18 -18
- data/stylesheets/flint/mixins/lib/_main.scss +910 -911
- data/stylesheets/flint/mixins/lib/_new-instance.scss +26 -26
- data/stylesheets/flint/mixins/lib/_print-instance.scss +41 -41
- metadata +21 -15
- checksums.yaml +0 -7
@@ -1,24 +1,24 @@
|
|
1
|
-
// Gets substring from string
|
2
|
-
// -------------------------------------------------------------------------------
|
3
|
-
// @dependence `string-to-list()`
|
4
|
-
// -------------------------------------------------------------------------------
|
5
|
-
// @param $full-string [string] : string that contains substring
|
6
|
-
// @param $depth [number | string] : depth of substring
|
7
|
-
// -------------------------------------------------------------------------------
|
8
|
-
// @return [string]
|
9
|
-
|
10
|
-
@function get-substring($full-string, $depth) {
|
11
|
-
@if is-string($full-string) {
|
12
|
-
$get-substring: string-to-list($full-string);
|
13
|
-
|
14
|
-
@if $depth == "last" {
|
15
|
-
@return nth($get-substring, length($get-substring));
|
16
|
-
} @else if $depth == "first" {
|
17
|
-
@return nth($get-substring, 1);
|
18
|
-
} @else {
|
19
|
-
@return nth($get-substring, $depth);
|
20
|
-
}
|
21
|
-
} @else {
|
22
|
-
@return "You did not input a valid string: #{$full-string}";
|
23
|
-
}
|
1
|
+
// Gets substring from string
|
2
|
+
// -------------------------------------------------------------------------------
|
3
|
+
// @dependence `string-to-list()`
|
4
|
+
// -------------------------------------------------------------------------------
|
5
|
+
// @param $full-string [string] : string that contains substring
|
6
|
+
// @param $depth [number | string] : depth of substring
|
7
|
+
// -------------------------------------------------------------------------------
|
8
|
+
// @return [string]
|
9
|
+
|
10
|
+
@function get-substring($full-string, $depth) {
|
11
|
+
@if is-string($full-string) {
|
12
|
+
$get-substring: string-to-list($full-string);
|
13
|
+
|
14
|
+
@if $depth == "last" {
|
15
|
+
@return nth($get-substring, length($get-substring));
|
16
|
+
} @else if $depth == "first" {
|
17
|
+
@return nth($get-substring, 1);
|
18
|
+
} @else {
|
19
|
+
@return nth($get-substring, $depth);
|
20
|
+
}
|
21
|
+
} @else {
|
22
|
+
@return "You did not input a valid string: #{$full-string}";
|
23
|
+
}
|
24
24
|
}
|
@@ -1,16 +1,16 @@
|
|
1
|
-
// Get single value from key in instance map based on $selector::$key
|
2
|
-
// -------------------------------------------------------------------------------
|
3
|
-
// @dependence `map-fetch()`
|
4
|
-
// -------------------------------------------------------------------------------
|
5
|
-
// @param $key [string] : breakpoint key
|
6
|
-
// @param $value [string] : key of value
|
7
|
-
// -------------------------------------------------------------------------------
|
8
|
-
// @return [literal]
|
9
|
-
|
10
|
-
@function get-value($key, $value: null) {
|
11
|
-
@if $value == null {
|
12
|
-
@return map-fetch($flint, "config" $key);
|
13
|
-
} @else {
|
14
|
-
@return map-fetch($flint, "config" $key $value);
|
15
|
-
}
|
16
|
-
}
|
1
|
+
// Get single value from key in instance map based on $selector::$key
|
2
|
+
// -------------------------------------------------------------------------------
|
3
|
+
// @dependence `map-fetch()`
|
4
|
+
// -------------------------------------------------------------------------------
|
5
|
+
// @param $key [string] : breakpoint key
|
6
|
+
// @param $value [string] : key of value
|
7
|
+
// -------------------------------------------------------------------------------
|
8
|
+
// @return [literal]
|
9
|
+
|
10
|
+
@function get-value($key, $value: null) {
|
11
|
+
@if $value == null {
|
12
|
+
@return map-fetch($flint, "config" $key);
|
13
|
+
} @else {
|
14
|
+
@return map-fetch($flint, "config" $key $value);
|
15
|
+
}
|
16
|
+
}
|
@@ -1,44 +1,44 @@
|
|
1
|
-
// Keeps count of all instances with arguments, stores in global var
|
2
|
-
// -------------------------------------------------------------------------------
|
3
|
-
// @dependence `get-value()`
|
4
|
-
// -------------------------------------------------------------------------------
|
5
|
-
// @param $key [string] : computed breakpoint of instance
|
6
|
-
// @param $span [number] : computed span of instance
|
7
|
-
// @param $context [number] : computed context of instance
|
8
|
-
// @param $gutter [number] : computed gutter of instance
|
9
|
-
// @param $shift [number] : computed shift of instance
|
10
|
-
// @param $outputWidth [number] : computed width of instance
|
11
|
-
// @param $outputMarginRight [number] : computed right margin of instance
|
12
|
-
// @param $outputMarginLeft [number] : computed left margin of instance
|
13
|
-
// -------------------------------------------------------------------------------
|
14
|
-
// @return instance map
|
15
|
-
|
16
|
-
@function instance($key, $span, $context, $gutter, $shift, $outputWidth, $outputMarginRight, $outputMarginLeft) {
|
17
|
-
// Increase the instance count
|
18
|
-
$flint__instance-count: $flint__instance-count + 1 !global;
|
19
|
-
// Lets clean up the selector a bit...
|
20
|
-
$selector-string: selector_string();
|
21
|
-
$selector-list: string-to-list($selector-string);
|
22
|
-
$selector-cleaned: list-to-string($selector-list, " ");
|
23
|
-
|
24
|
-
$flint__instance: (
|
25
|
-
"#{$selector-cleaned}::#{$key}": (
|
26
|
-
"instance-count": #{$flint__instance-count},
|
27
|
-
"parent-selector": #{if(get-family-instance($key) != false, get-family-instance($key), none)},
|
28
|
-
"key": #{$key},
|
29
|
-
"breakpoint": #{get-value($key, breakpoint)},
|
30
|
-
"columns": #{get-value($key, columns)},
|
31
|
-
"span": #{$span},
|
32
|
-
"context": #{if($context == "auto", get-instance-value($key, "span"), $context)},
|
33
|
-
"gutter": #{$gutter},
|
34
|
-
"shift": #{$shift},
|
35
|
-
"output": (
|
36
|
-
"width": #{$outputWidth},
|
37
|
-
"margin-right": #{$outputMarginRight},
|
38
|
-
"margin-left": #{$outputMarginLeft},
|
39
|
-
),
|
40
|
-
),
|
41
|
-
);
|
42
|
-
|
43
|
-
@return map-merge($flint__instances, $flint__instance);
|
1
|
+
// Keeps count of all instances with arguments, stores in global var
|
2
|
+
// -------------------------------------------------------------------------------
|
3
|
+
// @dependence `get-value()`
|
4
|
+
// -------------------------------------------------------------------------------
|
5
|
+
// @param $key [string] : computed breakpoint of instance
|
6
|
+
// @param $span [number] : computed span of instance
|
7
|
+
// @param $context [number] : computed context of instance
|
8
|
+
// @param $gutter [number] : computed gutter of instance
|
9
|
+
// @param $shift [number] : computed shift of instance
|
10
|
+
// @param $outputWidth [number] : computed width of instance
|
11
|
+
// @param $outputMarginRight [number] : computed right margin of instance
|
12
|
+
// @param $outputMarginLeft [number] : computed left margin of instance
|
13
|
+
// -------------------------------------------------------------------------------
|
14
|
+
// @return instance map
|
15
|
+
|
16
|
+
@function instance($key, $span, $context, $gutter, $shift, $outputWidth, $outputMarginRight, $outputMarginLeft) {
|
17
|
+
// Increase the instance count
|
18
|
+
$flint__instance-count: $flint__instance-count + 1 !global;
|
19
|
+
// Lets clean up the selector a bit...
|
20
|
+
$selector-string: selector_string();
|
21
|
+
$selector-list: string-to-list($selector-string);
|
22
|
+
$selector-cleaned: list-to-string($selector-list, " ");
|
23
|
+
|
24
|
+
$flint__instance: (
|
25
|
+
"#{$selector-cleaned}::#{$key}": (
|
26
|
+
"instance-count": #{$flint__instance-count},
|
27
|
+
"parent-selector": #{if(get-family-instance($key) != false, get-family-instance($key), none)},
|
28
|
+
"key": #{$key},
|
29
|
+
"breakpoint": #{get-value($key, breakpoint)},
|
30
|
+
"columns": #{get-value($key, columns)},
|
31
|
+
"span": #{$span},
|
32
|
+
"context": #{if($context == "auto", get-instance-value($key, "span"), $context)},
|
33
|
+
"gutter": #{$gutter},
|
34
|
+
"shift": #{$shift},
|
35
|
+
"output": (
|
36
|
+
"width": #{$outputWidth},
|
37
|
+
"margin-right": #{$outputMarginRight},
|
38
|
+
"margin-left": #{$outputMarginLeft},
|
39
|
+
),
|
40
|
+
),
|
41
|
+
);
|
42
|
+
|
43
|
+
@return map-merge($flint__instances, $flint__instance);
|
44
44
|
}
|
@@ -1,9 +1,9 @@
|
|
1
|
-
// Get last item in list
|
2
|
-
// -------------------------------------------------------------------------------
|
3
|
-
// @param $list [list] : list
|
4
|
-
// -------------------------------------------------------------------------------
|
5
|
-
// @return [list]
|
6
|
-
|
7
|
-
@function last($list) {
|
8
|
-
@return nth($list, length($list));
|
1
|
+
// Get last item in list
|
2
|
+
// -------------------------------------------------------------------------------
|
3
|
+
// @param $list [list] : list
|
4
|
+
// -------------------------------------------------------------------------------
|
5
|
+
// @return [list]
|
6
|
+
|
7
|
+
@function last($list) {
|
8
|
+
@return nth($list, length($list));
|
9
9
|
}
|
@@ -1,25 +1,25 @@
|
|
1
|
-
// Joins all elements of $list with $glue
|
2
|
-
// -------------------------------------------------------------------------------
|
3
|
-
// @documentation http://sassylists.com/documentation/#to-string
|
4
|
-
// -------------------------------------------------------------------------------
|
5
|
-
// @param $list [list] : list
|
6
|
-
// @param $glue [string] : value to use as a join string
|
7
|
-
// -------------------------------------------------------------------------------
|
8
|
-
// @return [string]
|
9
|
-
|
10
|
-
@function list-to-string($list, $glue: "", $is-nested: false) {
|
11
|
-
$result: null;
|
12
|
-
$length: length($list);
|
13
|
-
|
14
|
-
@for $i from 1 through $length {
|
15
|
-
$n: nth($list, $i);
|
16
|
-
|
17
|
-
@if is-list($n) {
|
18
|
-
$result: $result#{list-to-string($n, $glue, true)};
|
19
|
-
} @else {
|
20
|
-
$result: if($i != length($list) or $is-nested, $result#{$n}#{$glue}, $result#{$n});
|
21
|
-
}
|
22
|
-
}
|
23
|
-
|
24
|
-
@return $result;
|
1
|
+
// Joins all elements of $list with $glue
|
2
|
+
// -------------------------------------------------------------------------------
|
3
|
+
// @documentation http://sassylists.com/documentation/#to-string
|
4
|
+
// -------------------------------------------------------------------------------
|
5
|
+
// @param $list [list] : list
|
6
|
+
// @param $glue [string] : value to use as a join string
|
7
|
+
// -------------------------------------------------------------------------------
|
8
|
+
// @return [string]
|
9
|
+
|
10
|
+
@function list-to-string($list, $glue: "", $is-nested: false) {
|
11
|
+
$result: null;
|
12
|
+
$length: length($list);
|
13
|
+
|
14
|
+
@for $i from 1 through $length {
|
15
|
+
$n: nth($list, $i);
|
16
|
+
|
17
|
+
@if is-list($n) {
|
18
|
+
$result: $result#{list-to-string($n, $glue, true)};
|
19
|
+
} @else {
|
20
|
+
$result: if($i != length($list) or $is-nested, $result#{$n}#{$glue}, $result#{$n});
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
@return $result;
|
25
25
|
}
|
@@ -1,33 +1,33 @@
|
|
1
|
-
// Fetch value from key in map
|
2
|
-
// -------------------------------------------------------------------------------
|
3
|
-
// @param $map [map] : map to fetch from
|
4
|
-
// @param $keys [string | list] : string of key, or list of strings
|
5
|
-
// -------------------------------------------------------------------------------
|
6
|
-
// @return fetched literal | false
|
7
|
-
|
8
|
-
@function map-fetch($map, $keys) {
|
9
|
-
$key: nth($keys, 1);
|
10
|
-
$length: length($keys);
|
11
|
-
$value: map-get($map, $key);
|
12
|
-
|
13
|
-
// check if the key was incorrect, meaning the map doesn't exist
|
14
|
-
@if $value == null {
|
15
|
-
@warn "Invalid arguments passed to function: map-fetch(#{$map}, #{$keys}). One or more of the keys do not exist.";
|
16
|
-
@return false;
|
17
|
-
}
|
18
|
-
|
19
|
-
@else {
|
20
|
-
@if $length > 1 {
|
21
|
-
$rest: ();
|
22
|
-
|
23
|
-
@for $i from 2 through $length {
|
24
|
-
$rest: append($rest, nth($keys, $i))
|
25
|
-
}
|
26
|
-
|
27
|
-
@return map-fetch($value, $rest);
|
28
|
-
|
29
|
-
} @else {
|
30
|
-
@return $value;
|
31
|
-
}
|
32
|
-
}
|
33
|
-
}
|
1
|
+
// Fetch value from key in map
|
2
|
+
// -------------------------------------------------------------------------------
|
3
|
+
// @param $map [map] : map to fetch from
|
4
|
+
// @param $keys [string | list] : string of key, or list of strings
|
5
|
+
// -------------------------------------------------------------------------------
|
6
|
+
// @return fetched literal | false
|
7
|
+
|
8
|
+
@function map-fetch($map, $keys) {
|
9
|
+
$key: nth($keys, 1);
|
10
|
+
$length: length($keys);
|
11
|
+
$value: map-get($map, $key);
|
12
|
+
|
13
|
+
// check if the key was incorrect, meaning the map doesn't exist
|
14
|
+
@if $value == null {
|
15
|
+
@warn "Invalid arguments passed to function: map-fetch(#{$map}, #{$keys}). One or more of the keys do not exist.";
|
16
|
+
@return false;
|
17
|
+
}
|
18
|
+
|
19
|
+
@else {
|
20
|
+
@if $length > 1 {
|
21
|
+
$rest: ();
|
22
|
+
|
23
|
+
@for $i from 2 through $length {
|
24
|
+
$rest: append($rest, nth($keys, $i))
|
25
|
+
}
|
26
|
+
|
27
|
+
@return map-fetch($value, $rest);
|
28
|
+
|
29
|
+
} @else {
|
30
|
+
@return $value;
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}
|
@@ -1,15 +1,15 @@
|
|
1
|
-
// Returns next indexed key based on passed index
|
2
|
-
// -------------------------------------------------------------------------------
|
3
|
-
// @param $index [number] : index
|
4
|
-
// -------------------------------------------------------------------------------
|
5
|
-
// @return [string] | null
|
6
|
-
|
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) {
|
10
|
-
@return $key;
|
11
|
-
}
|
12
|
-
} @else {
|
13
|
-
@return null;
|
14
|
-
}
|
1
|
+
// Returns next indexed key based on passed index
|
2
|
+
// -------------------------------------------------------------------------------
|
3
|
+
// @param $index [number] : index
|
4
|
+
// -------------------------------------------------------------------------------
|
5
|
+
// @return [string] | null
|
6
|
+
|
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) {
|
10
|
+
@return $key;
|
11
|
+
}
|
12
|
+
} @else {
|
13
|
+
@return null;
|
14
|
+
}
|
15
15
|
}
|
@@ -1,21 +1,21 @@
|
|
1
|
-
// Removes all false and null values from $list
|
2
|
-
// -------------------------------------------------------------------------------
|
3
|
-
// @documentation http://sassylists.com/documentation.html#purge
|
4
|
-
// -------------------------------------------------------------------------------
|
5
|
-
// @dependence `is-true()`
|
6
|
-
// -------------------------------------------------------------------------------
|
7
|
-
// @param $list [list] : list
|
8
|
-
// -------------------------------------------------------------------------------
|
9
|
-
// @return [list]
|
10
|
-
|
11
|
-
@function purge($list) {
|
12
|
-
$result: ();
|
13
|
-
|
14
|
-
@each $item in $list {
|
15
|
-
@if is-true($item) {
|
16
|
-
$result: append($result, $item, list-separator($list));
|
17
|
-
}
|
18
|
-
}
|
19
|
-
|
20
|
-
@return $result;
|
1
|
+
// Removes all false and null values from $list
|
2
|
+
// -------------------------------------------------------------------------------
|
3
|
+
// @documentation http://sassylists.com/documentation.html#purge
|
4
|
+
// -------------------------------------------------------------------------------
|
5
|
+
// @dependence `is-true()`
|
6
|
+
// -------------------------------------------------------------------------------
|
7
|
+
// @param $list [list] : list
|
8
|
+
// -------------------------------------------------------------------------------
|
9
|
+
// @return [list]
|
10
|
+
|
11
|
+
@function purge($list) {
|
12
|
+
$result: ();
|
13
|
+
|
14
|
+
@each $item in $list {
|
15
|
+
@if is-true($item) {
|
16
|
+
$result: append($result, $item, list-separator($list));
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
@return $result;
|
21
21
|
}
|
@@ -1,15 +1,15 @@
|
|
1
|
-
// Removes value(s) $value from $list
|
2
|
-
// -------------------------------------------------------------------------------
|
3
|
-
// @documentation http://sassylists.com/documentation/#remove
|
4
|
-
// -------------------------------------------------------------------------------
|
5
|
-
// @dependence `replace()`
|
6
|
-
// -------------------------------------------------------------------------------
|
7
|
-
// @param $list [list] : list
|
8
|
-
// @param $value [literal] : value to remove
|
9
|
-
// @param $recursive [bool] : enable / disable recursivity
|
10
|
-
// -------------------------------------------------------------------------------
|
11
|
-
// @return [list]
|
12
|
-
|
13
|
-
@function remove($list, $value) {
|
14
|
-
@return replace($list, $value, null);
|
1
|
+
// Removes value(s) $value from $list
|
2
|
+
// -------------------------------------------------------------------------------
|
3
|
+
// @documentation http://sassylists.com/documentation/#remove
|
4
|
+
// -------------------------------------------------------------------------------
|
5
|
+
// @dependence `replace()`
|
6
|
+
// -------------------------------------------------------------------------------
|
7
|
+
// @param $list [list] : list
|
8
|
+
// @param $value [literal] : value to remove
|
9
|
+
// @param $recursive [bool] : enable / disable recursivity
|
10
|
+
// -------------------------------------------------------------------------------
|
11
|
+
// @return [list]
|
12
|
+
|
13
|
+
@function remove($list, $value) {
|
14
|
+
@return replace($list, $value, null);
|
15
15
|
}
|
@@ -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 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 is-true($value), purge($list), $list);
|
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 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 is-true($value), purge($list), $list);
|
25
25
|
}
|