flint-gs 1.7.1 → 1.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +21 -21
- data/README.md +906 -906
- data/lib/flint.rb +67 -77
- data/stylesheets/_flint.scss +6 -6
- data/stylesheets/flint/config/_config.scss +83 -83
- data/stylesheets/flint/functions/_functions.scss +40 -41
- data/stylesheets/flint/functions/helpers/_helpers.scss +181 -181
- data/stylesheets/flint/functions/lib/_calc-breakpoint.scss +33 -33
- data/stylesheets/flint/functions/lib/_calc-margin.scss +57 -57
- data/stylesheets/flint/functions/lib/_calc-width.scss +50 -50
- data/stylesheets/flint/functions/lib/_exists.scss +22 -22
- data/stylesheets/flint/functions/lib/_fluid-width.scss +10 -10
- data/stylesheets/flint/functions/lib/_get-index.scss +13 -13
- data/stylesheets/flint/functions/lib/_get-instance-value.scss +17 -17
- data/stylesheets/flint/functions/lib/_get-value.scss +14 -14
- data/stylesheets/flint/functions/lib/_has-family-instance.scss +74 -74
- data/stylesheets/flint/functions/lib/_instance.scss +46 -46
- data/stylesheets/flint/functions/lib/_last.scss +9 -9
- data/stylesheets/flint/functions/lib/_list-to-string.scss +25 -25
- data/stylesheets/flint/functions/lib/_map-fetch.scss +30 -30
- data/stylesheets/flint/functions/lib/_next-index.scss +15 -15
- data/stylesheets/flint/functions/lib/_purge.scss +19 -19
- data/stylesheets/flint/functions/lib/_remove.scss +13 -13
- data/stylesheets/flint/functions/lib/_replace-substring.scss +34 -34
- data/stylesheets/flint/functions/lib/_replace.scss +25 -25
- data/stylesheets/flint/functions/lib/_steal-key.scss +13 -13
- data/stylesheets/flint/functions/lib/_steal-values.scss +14 -14
- data/stylesheets/flint/functions/lib/_string-to-list.scss +90 -90
- data/stylesheets/flint/functions/lib/_support-syntax-bem.scss +31 -31
- data/stylesheets/flint/functions/lib/_support-syntax.scss +28 -28
- data/stylesheets/flint/functions/lib/_types-in-list.scss +119 -119
- data/stylesheets/flint/functions/lib/_use-syntax.scss +14 -14
- data/stylesheets/flint/globals/_globals.scss +38 -38
- data/stylesheets/flint/mixins/_mixins.scss +7 -7
- data/stylesheets/flint/mixins/lib/_calculate.scss +571 -571
- data/stylesheets/flint/mixins/lib/_clearfix.scss +19 -19
- data/stylesheets/flint/mixins/lib/_main.scss +935 -935
- data/stylesheets/flint/mixins/lib/_new-instance.scss +27 -27
- data/stylesheets/flint/mixins/lib/_print-instance.scss +42 -42
- metadata +16 -23
- data/stylesheets/flint/functions/lib/_string-to-number.scss +0 -77
@@ -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 flint-exists($map, $value){
|
9
|
-
|
10
|
-
@if flint-is-map($map) {
|
11
|
-
@if map-has-key($map, $value) {
|
12
|
-
@return true;
|
13
|
-
}
|
14
|
-
@each $key, $i in $map {
|
15
|
-
@if flint-exists($i, $value) {
|
16
|
-
@return true;
|
17
|
-
}
|
18
|
-
}
|
19
|
-
}
|
20
|
-
|
21
|
-
@return false;
|
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 flint-exists($map, $value){
|
9
|
+
|
10
|
+
@if flint-is-map($map) {
|
11
|
+
@if map-has-key($map, $value) {
|
12
|
+
@return true;
|
13
|
+
}
|
14
|
+
@each $key, $i in $map {
|
15
|
+
@if flint-exists($i, $value) {
|
16
|
+
@return true;
|
17
|
+
}
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
@return false;
|
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 flint-fluid-width($target, $context) {
|
9
|
-
@return ($target / $context) * 100%;
|
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 flint-fluid-width($target, $context) {
|
9
|
+
@return ($target / $context) * 100%;
|
10
|
+
}
|
@@ -1,13 +1,13 @@
|
|
1
|
-
// Gets the index of the passed key
|
2
|
-
// -------------------------------------------------------------------------------
|
3
|
-
// @param $key [string] : breakpoint key
|
4
|
-
// -------------------------------------------------------------------------------
|
5
|
-
// @return [number]
|
6
|
-
|
7
|
-
@function flint-get-index($key) {
|
8
|
-
@for $i from 1 through (length(flint-map-fetch($flint, "config")) - 1) {
|
9
|
-
@if flint-steal-key($i) == $key {
|
10
|
-
@return $i;
|
11
|
-
}
|
12
|
-
}
|
13
|
-
}
|
1
|
+
// Gets the index of the passed key
|
2
|
+
// -------------------------------------------------------------------------------
|
3
|
+
// @param $key [string] : breakpoint key
|
4
|
+
// -------------------------------------------------------------------------------
|
5
|
+
// @return [number]
|
6
|
+
|
7
|
+
@function flint-get-index($key) {
|
8
|
+
@for $i from 1 through (length(flint-map-fetch($flint, "config")) - 1) {
|
9
|
+
@if flint-steal-key($i) == $key {
|
10
|
+
@return $i;
|
11
|
+
}
|
12
|
+
}
|
13
|
+
}
|
@@ -1,17 +1,17 @@
|
|
1
|
-
// Get single value from key in instance map based on $selector::$key
|
2
|
-
// -------------------------------------------------------------------------------
|
3
|
-
// @warning : all values returned are strings and must be converted with `flint-to-number()`
|
4
|
-
// -------------------------------------------------------------------------------
|
5
|
-
// @param $key [string] : key
|
6
|
-
// @param $value [number] : value
|
7
|
-
// @param $deep [number] : fetch deep value
|
8
|
-
// -------------------------------------------------------------------------------
|
9
|
-
// @return [string]
|
10
|
-
|
11
|
-
@function flint-get-instance-value($key, $value, $deep: null) {
|
12
|
-
@if $deep == null {
|
13
|
-
@return flint-map-fetch($flint__instances, flint-has-family-instance($key) $value);
|
14
|
-
} @else {
|
15
|
-
@return flint-map-fetch($flint__instances, flint-has-family-instance($key) $value $deep);
|
16
|
-
}
|
17
|
-
}
|
1
|
+
// Get single value from key in instance map based on $selector::$key
|
2
|
+
// -------------------------------------------------------------------------------
|
3
|
+
// @warning : all values returned are strings and must be converted with `flint-to-number()`
|
4
|
+
// -------------------------------------------------------------------------------
|
5
|
+
// @param $key [string] : key
|
6
|
+
// @param $value [number] : value
|
7
|
+
// @param $deep [number] : fetch deep value
|
8
|
+
// -------------------------------------------------------------------------------
|
9
|
+
// @return [string]
|
10
|
+
|
11
|
+
@function flint-get-instance-value($key, $value, $deep: null) {
|
12
|
+
@if $deep == null {
|
13
|
+
@return flint-map-fetch($flint__instances, flint-has-family-instance($key) $value);
|
14
|
+
} @else {
|
15
|
+
@return flint-map-fetch($flint__instances, flint-has-family-instance($key) $value $deep);
|
16
|
+
}
|
17
|
+
}
|
@@ -1,14 +1,14 @@
|
|
1
|
-
// Get single value from key in instance map based on $selector::$key
|
2
|
-
// -------------------------------------------------------------------------------
|
3
|
-
// @param $key [string] : breakpoint key
|
4
|
-
// @param $value [string] : key of value
|
5
|
-
// -------------------------------------------------------------------------------
|
6
|
-
// @return [literal]
|
7
|
-
|
8
|
-
@function flint-get-value($key, $value: null) {
|
9
|
-
@if $value == null {
|
10
|
-
@return flint-map-fetch($flint, "config" $key);
|
11
|
-
} @else {
|
12
|
-
@return flint-map-fetch($flint, "config" $key $value);
|
13
|
-
}
|
14
|
-
}
|
1
|
+
// Get single value from key in instance map based on $selector::$key
|
2
|
+
// -------------------------------------------------------------------------------
|
3
|
+
// @param $key [string] : breakpoint key
|
4
|
+
// @param $value [string] : key of value
|
5
|
+
// -------------------------------------------------------------------------------
|
6
|
+
// @return [literal]
|
7
|
+
|
8
|
+
@function flint-get-value($key, $value: null) {
|
9
|
+
@if $value == null {
|
10
|
+
@return flint-map-fetch($flint, "config" $key);
|
11
|
+
} @else {
|
12
|
+
@return flint-map-fetch($flint, "config" $key $value);
|
13
|
+
}
|
14
|
+
}
|
@@ -1,74 +1,74 @@
|
|
1
|
-
// Checks if instance flint-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 flint-has-family-instance($key: flint-get-value("settings", "default"), $syntax: $flint__support-syntax) {
|
9
|
-
$selector-string: selector_string();
|
10
|
-
|
11
|
-
// Check if instance result had been cached
|
12
|
-
@if map-has-key($flint__cached-instances, "#{$selector-string}") {
|
13
|
-
// Get cached instance
|
14
|
-
$cached-instance: map-get($flint__cached-instances, "#{$selector-string}");
|
15
|
-
// Return with current key
|
16
|
-
@return "#{$cached-instance}::#{$key}";
|
17
|
-
}
|
18
|
-
|
19
|
-
// Check for syntax support, try to find instance using it
|
20
|
-
@if $syntax {
|
21
|
-
|
22
|
-
$selector-list: flint-use-syntax($selector-string);
|
23
|
-
$length: length($selector-list);
|
24
|
-
|
25
|
-
// Loop through transformed selectors
|
26
|
-
@for $i from 1 through $length {
|
27
|
-
|
28
|
-
// Check flint-last selector in list
|
29
|
-
@if flint-exists($flint__instances, "#{flint-last($selector-list)}::#{$key}") {
|
30
|
-
|
31
|
-
// Cache result
|
32
|
-
$flint__cached-instances: map-merge($flint__cached-instances, ("#{$selector-string}": "#{flint-last($selector-list)}"));
|
33
|
-
|
34
|
-
// Return the matching instance key
|
35
|
-
@return "#{flint-last($selector-list)}::#{$key}";
|
36
|
-
|
37
|
-
} @else {
|
38
|
-
|
39
|
-
// Else, flint-remove the flint-last selector and loop again
|
40
|
-
$selector-list: flint-remove($selector-list, flint-last($selector-list));
|
41
|
-
|
42
|
-
}
|
43
|
-
}
|
44
|
-
|
45
|
-
// Search for a parent instance normally
|
46
|
-
@return flint-has-family-instance($key, null);
|
47
|
-
|
48
|
-
} @else {
|
49
|
-
$selector-list: flint-string-to-list($selector-string);
|
50
|
-
$length: length($selector-list);
|
51
|
-
|
52
|
-
// Loop through length of list of selectors
|
53
|
-
@for $i from 1 through $length {
|
54
|
-
|
55
|
-
// Make sure that we're not counting the current selector string
|
56
|
-
@if flint-exists($flint__instances, "#{flint-list-to-string($selector-list, ' ')}::#{$key}") and $selector-string != flint-list-to-string($selector-list, " ") {
|
57
|
-
|
58
|
-
// Cache result
|
59
|
-
$flint__cached-instances: map-merge($flint__cached-instances, ("#{$selector-string}": "#{flint-list-to-string($selector-list, ' ')}"));
|
60
|
-
|
61
|
-
// Return the matching instance key
|
62
|
-
@return "#{flint-list-to-string($selector-list, ' ')}::#{$key}";
|
63
|
-
|
64
|
-
} @else {
|
65
|
-
|
66
|
-
// Else, flint-remove the flint-last selector and loop again
|
67
|
-
$selector-list: flint-remove($selector-list, flint-last($selector-list));
|
68
|
-
|
69
|
-
}
|
70
|
-
}
|
71
|
-
|
72
|
-
@return false;
|
73
|
-
}
|
74
|
-
}
|
1
|
+
// Checks if instance flint-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 flint-has-family-instance($key: flint-get-value("settings", "default"), $syntax: $flint__support-syntax) {
|
9
|
+
$selector-string: selector_string();
|
10
|
+
|
11
|
+
// Check if instance result had been cached
|
12
|
+
@if map-has-key($flint__cached-instances, "#{$selector-string}") {
|
13
|
+
// Get cached instance
|
14
|
+
$cached-instance: map-get($flint__cached-instances, "#{$selector-string}");
|
15
|
+
// Return with current key
|
16
|
+
@return "#{$cached-instance}::#{$key}";
|
17
|
+
}
|
18
|
+
|
19
|
+
// Check for syntax support, try to find instance using it
|
20
|
+
@if $syntax {
|
21
|
+
|
22
|
+
$selector-list: flint-use-syntax($selector-string);
|
23
|
+
$length: length($selector-list);
|
24
|
+
|
25
|
+
// Loop through transformed selectors
|
26
|
+
@for $i from 1 through $length {
|
27
|
+
|
28
|
+
// Check flint-last selector in list
|
29
|
+
@if flint-exists($flint__instances, "#{flint-last($selector-list)}::#{$key}") {
|
30
|
+
|
31
|
+
// Cache result
|
32
|
+
$flint__cached-instances: map-merge($flint__cached-instances, ("#{$selector-string}": "#{flint-last($selector-list)}"));
|
33
|
+
|
34
|
+
// Return the matching instance key
|
35
|
+
@return "#{flint-last($selector-list)}::#{$key}";
|
36
|
+
|
37
|
+
} @else {
|
38
|
+
|
39
|
+
// Else, flint-remove the flint-last selector and loop again
|
40
|
+
$selector-list: flint-remove($selector-list, flint-last($selector-list));
|
41
|
+
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
// Search for a parent instance normally
|
46
|
+
@return flint-has-family-instance($key, null);
|
47
|
+
|
48
|
+
} @else {
|
49
|
+
$selector-list: flint-string-to-list($selector-string);
|
50
|
+
$length: length($selector-list);
|
51
|
+
|
52
|
+
// Loop through length of list of selectors
|
53
|
+
@for $i from 1 through $length {
|
54
|
+
|
55
|
+
// Make sure that we're not counting the current selector string
|
56
|
+
@if flint-exists($flint__instances, "#{flint-list-to-string($selector-list, ' ')}::#{$key}") and $selector-string != flint-list-to-string($selector-list, " ") {
|
57
|
+
|
58
|
+
// Cache result
|
59
|
+
$flint__cached-instances: map-merge($flint__cached-instances, ("#{$selector-string}": "#{flint-list-to-string($selector-list, ' ')}"));
|
60
|
+
|
61
|
+
// Return the matching instance key
|
62
|
+
@return "#{flint-list-to-string($selector-list, ' ')}::#{$key}";
|
63
|
+
|
64
|
+
} @else {
|
65
|
+
|
66
|
+
// Else, flint-remove the flint-last selector and loop again
|
67
|
+
$selector-list: flint-remove($selector-list, flint-last($selector-list));
|
68
|
+
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
@return false;
|
73
|
+
}
|
74
|
+
}
|
@@ -1,46 +1,46 @@
|
|
1
|
-
// Keeps count of all instances with arguments, stores in global var
|
2
|
-
// -------------------------------------------------------------------------------
|
3
|
-
// @dependence `flint-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 $output-width [number] : computed width of instance
|
11
|
-
// @param $output-margin-right [number] : computed right margin of instance
|
12
|
-
// @param $output-margin-left [number] : computed left margin of instance
|
13
|
-
// -------------------------------------------------------------------------------
|
14
|
-
// @return instance map
|
15
|
-
|
16
|
-
@function flint-instance($key, $span, $context, $gutter, $shift, $output-width, $output-margin-right, $output-margin-left) {
|
17
|
-
|
18
|
-
// Increase the instance count
|
19
|
-
$flint__instance-count: $flint__instance-count + 1 !global;
|
20
|
-
|
21
|
-
// Lets clean up the selector a bit...
|
22
|
-
$selector-string: selector_string();
|
23
|
-
$selector-list: flint-string-to-list($selector-string);
|
24
|
-
$selector-cleaned: flint-list-to-string($selector-list, " ");
|
25
|
-
|
26
|
-
$flint__instance: (
|
27
|
-
"#{$selector-cleaned}::#{$key}": (
|
28
|
-
"instance-count":
|
29
|
-
"parent-selector":
|
30
|
-
"key":
|
31
|
-
"breakpoint":
|
32
|
-
"columns":
|
33
|
-
"span":
|
34
|
-
"context":
|
35
|
-
"gutter":
|
36
|
-
"shift":
|
37
|
-
"output": (
|
38
|
-
"width":
|
39
|
-
"margin-right":
|
40
|
-
"margin-left":
|
41
|
-
)
|
42
|
-
)
|
43
|
-
);
|
44
|
-
|
45
|
-
@return map-merge($flint__instances, $flint__instance);
|
46
|
-
}
|
1
|
+
// Keeps count of all instances with arguments, stores in global var
|
2
|
+
// -------------------------------------------------------------------------------
|
3
|
+
// @dependence `flint-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 $output-width [number] : computed width of instance
|
11
|
+
// @param $output-margin-right [number] : computed right margin of instance
|
12
|
+
// @param $output-margin-left [number] : computed left margin of instance
|
13
|
+
// -------------------------------------------------------------------------------
|
14
|
+
// @return instance map
|
15
|
+
|
16
|
+
@function flint-instance($key, $span, $context, $gutter, $shift, $output-width, $output-margin-right, $output-margin-left) {
|
17
|
+
|
18
|
+
// Increase the instance count
|
19
|
+
$flint__instance-count: $flint__instance-count + 1 !global;
|
20
|
+
|
21
|
+
// Lets clean up the selector a bit...
|
22
|
+
$selector-string: selector_string();
|
23
|
+
$selector-list: flint-string-to-list($selector-string);
|
24
|
+
$selector-cleaned: flint-list-to-string($selector-list, " ");
|
25
|
+
|
26
|
+
$flint__instance: (
|
27
|
+
"#{$selector-cleaned}::#{$key}": (
|
28
|
+
"instance-count": $flint__instance-count,
|
29
|
+
"parent-selector": if(flint-has-family-instance($key) != false, flint-has-family-instance($key), none),
|
30
|
+
"key": $key,
|
31
|
+
"breakpoint": flint-get-value($key, "breakpoint"),
|
32
|
+
"columns": flint-get-value($key, "columns"),
|
33
|
+
"span": $span,
|
34
|
+
"context": if($context == "auto", flint-get-instance-value($key, "span"), $context),
|
35
|
+
"gutter": $gutter,
|
36
|
+
"shift": $shift,
|
37
|
+
"output": (
|
38
|
+
"width": $output-width,
|
39
|
+
"margin-right": $output-margin-right,
|
40
|
+
"margin-left": $output-margin-left
|
41
|
+
)
|
42
|
+
)
|
43
|
+
);
|
44
|
+
|
45
|
+
@return map-merge($flint__instances, $flint__instance);
|
46
|
+
}
|
@@ -1,9 +1,9 @@
|
|
1
|
-
// Get last item in list
|
2
|
-
// -------------------------------------------------------------------------------
|
3
|
-
// @param $list [list] : list
|
4
|
-
// -------------------------------------------------------------------------------
|
5
|
-
// @return [list]
|
6
|
-
|
7
|
-
@function flint-last($list) {
|
8
|
-
@return nth($list, length($list));
|
9
|
-
}
|
1
|
+
// Get last item in list
|
2
|
+
// -------------------------------------------------------------------------------
|
3
|
+
// @param $list [list] : list
|
4
|
+
// -------------------------------------------------------------------------------
|
5
|
+
// @return [list]
|
6
|
+
|
7
|
+
@function flint-last($list) {
|
8
|
+
@return nth($list, length($list));
|
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 flint-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 flint-is-list($n) {
|
18
|
-
$result: $result#{flint-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
|
-
}
|
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 flint-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 flint-is-list($n) {
|
18
|
+
$result: $result#{flint-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
|
+
}
|
@@ -1,30 +1,30 @@
|
|
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 flint-map-fetch($map, $keys) {
|
9
|
-
$key: nth($keys, 1);
|
10
|
-
$length: length($keys);
|
11
|
-
$value: map-get($map, $key);
|
12
|
-
|
13
|
-
@if $value != null {
|
14
|
-
@if $length > 1 {
|
15
|
-
$rest: ();
|
16
|
-
|
17
|
-
@for $i from 2 through $length {
|
18
|
-
$rest: append($rest, nth($keys, $i))
|
19
|
-
}
|
20
|
-
|
21
|
-
@return flint-map-fetch($value, $rest);
|
22
|
-
|
23
|
-
} @else {
|
24
|
-
@return $value;
|
25
|
-
}
|
26
|
-
} @else {
|
27
|
-
@warn "Invalid arguments passed to function: flint-map-fetch(#{$map}, #{$keys}). One or more of the keys do not exist.";
|
28
|
-
@return false;
|
29
|
-
}
|
30
|
-
}
|
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 flint-map-fetch($map, $keys) {
|
9
|
+
$key: nth($keys, 1);
|
10
|
+
$length: length($keys);
|
11
|
+
$value: map-get($map, $key);
|
12
|
+
|
13
|
+
@if $value != null {
|
14
|
+
@if $length > 1 {
|
15
|
+
$rest: ();
|
16
|
+
|
17
|
+
@for $i from 2 through $length {
|
18
|
+
$rest: append($rest, nth($keys, $i))
|
19
|
+
}
|
20
|
+
|
21
|
+
@return flint-map-fetch($value, $rest);
|
22
|
+
|
23
|
+
} @else {
|
24
|
+
@return $value;
|
25
|
+
}
|
26
|
+
} @else {
|
27
|
+
@warn "Invalid arguments passed to function: flint-map-fetch(#{$map}, #{$keys}). One or more of the keys do not exist.";
|
28
|
+
@return false;
|
29
|
+
}
|
30
|
+
}
|
@@ -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 flint-next-index($index) {
|
8
|
-
@if $index != (length(flint-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
|
-
}
|
1
|
+
// Returns next indexed key based on passed index
|
2
|
+
// -------------------------------------------------------------------------------
|
3
|
+
// @param $index [number] : index
|
4
|
+
// -------------------------------------------------------------------------------
|
5
|
+
// @return [string] | null
|
6
|
+
|
7
|
+
@function flint-next-index($index) {
|
8
|
+
@if $index != (length(flint-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
|
+
}
|
@@ -1,19 +1,19 @@
|
|
1
|
-
// Removes all false and null values from $list
|
2
|
-
// -------------------------------------------------------------------------------
|
3
|
-
// @documentation http://sassylists.com/documentation.html#purge
|
4
|
-
// -------------------------------------------------------------------------------
|
5
|
-
// @param $list [list] : list
|
6
|
-
// -------------------------------------------------------------------------------
|
7
|
-
// @return [list]
|
8
|
-
|
9
|
-
@function flint-purge($list) {
|
10
|
-
$result: ();
|
11
|
-
|
12
|
-
@each $item in $list {
|
13
|
-
@if flint-is-true($item) {
|
14
|
-
$result: append($result, $item, list-separator($list));
|
15
|
-
}
|
16
|
-
}
|
17
|
-
|
18
|
-
@return $result;
|
19
|
-
}
|
1
|
+
// Removes all false and null values from $list
|
2
|
+
// -------------------------------------------------------------------------------
|
3
|
+
// @documentation http://sassylists.com/documentation.html#purge
|
4
|
+
// -------------------------------------------------------------------------------
|
5
|
+
// @param $list [list] : list
|
6
|
+
// -------------------------------------------------------------------------------
|
7
|
+
// @return [list]
|
8
|
+
|
9
|
+
@function flint-purge($list) {
|
10
|
+
$result: ();
|
11
|
+
|
12
|
+
@each $item in $list {
|
13
|
+
@if flint-is-true($item) {
|
14
|
+
$result: append($result, $item, list-separator($list));
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
@return $result;
|
19
|
+
}
|
@@ -1,13 +1,13 @@
|
|
1
|
-
// Remove $value from $list
|
2
|
-
// -------------------------------------------------------------------------------
|
3
|
-
// @documentation http://sassylists.com/documentation/#remove
|
4
|
-
// -------------------------------------------------------------------------------
|
5
|
-
// @param $list [list] : list
|
6
|
-
// @param $value [literal] : value to flint-remove
|
7
|
-
// @param $recursive [bool] : enable / disable recursivity
|
8
|
-
// -------------------------------------------------------------------------------
|
9
|
-
// @return [list]
|
10
|
-
|
11
|
-
@function flint-remove($list, $value) {
|
12
|
-
@return flint-replace($list, $value, null);
|
13
|
-
}
|
1
|
+
// Remove $value from $list
|
2
|
+
// -------------------------------------------------------------------------------
|
3
|
+
// @documentation http://sassylists.com/documentation/#remove
|
4
|
+
// -------------------------------------------------------------------------------
|
5
|
+
// @param $list [list] : list
|
6
|
+
// @param $value [literal] : value to flint-remove
|
7
|
+
// @param $recursive [bool] : enable / disable recursivity
|
8
|
+
// -------------------------------------------------------------------------------
|
9
|
+
// @return [list]
|
10
|
+
|
11
|
+
@function flint-remove($list, $value) {
|
12
|
+
@return flint-replace($list, $value, null);
|
13
|
+
}
|