flint-gs 1.6.5 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -13
- data/lib/flint.rb +64 -4
- data/stylesheets/flint/config/_config.scss +3 -3
- data/stylesheets/flint/functions/_functions.scss +1 -1
- data/stylesheets/flint/functions/helpers/_helpers.scss +32 -23
- data/stylesheets/flint/functions/lib/_calc-breakpoint.scss +11 -11
- data/stylesheets/flint/functions/lib/_calc-margin.scss +40 -12
- data/stylesheets/flint/functions/lib/_calc-width.scss +21 -12
- data/stylesheets/flint/functions/lib/_exists.scss +6 -6
- data/stylesheets/flint/functions/lib/_fluid-width.scss +2 -2
- data/stylesheets/flint/functions/lib/_get-index.scss +3 -3
- data/stylesheets/flint/functions/lib/_get-instance-value.scss +4 -4
- data/stylesheets/flint/functions/lib/_get-value.scss +3 -3
- data/stylesheets/flint/functions/lib/_has-family-instance.scss +74 -0
- data/stylesheets/flint/functions/lib/_instance.scss +17 -15
- data/stylesheets/flint/functions/lib/_last.scss +2 -2
- data/stylesheets/flint/functions/lib/_list-to-string.scss +4 -4
- data/stylesheets/flint/functions/lib/_map-fetch.scss +6 -9
- data/stylesheets/flint/functions/lib/_next-index.scss +3 -3
- data/stylesheets/flint/functions/lib/_purge.scss +2 -2
- data/stylesheets/flint/functions/lib/_remove.scss +4 -4
- data/stylesheets/flint/functions/lib/_replace-substring.scss +21 -15
- data/stylesheets/flint/functions/lib/_replace.scss +3 -3
- data/stylesheets/flint/functions/lib/_steal-key.scss +3 -3
- data/stylesheets/flint/functions/lib/_steal-values.scss +3 -3
- data/stylesheets/flint/functions/lib/_string-to-list.scss +63 -57
- data/stylesheets/flint/functions/lib/_string-to-number.scss +42 -38
- data/stylesheets/flint/functions/lib/_support-syntax-bem.scss +3 -3
- data/stylesheets/flint/functions/lib/_support-syntax.scss +4 -4
- data/stylesheets/flint/functions/lib/_types-in-list.scss +3 -3
- data/stylesheets/flint/functions/lib/_use-syntax.scss +3 -3
- data/stylesheets/flint/globals/_globals.scss +20 -4
- data/stylesheets/flint/mixins/lib/_calculate.scss +368 -563
- data/stylesheets/flint/mixins/lib/_clearfix.scss +7 -7
- data/stylesheets/flint/mixins/lib/_main.scss +244 -244
- data/stylesheets/flint/mixins/lib/_new-instance.scss +20 -20
- data/stylesheets/flint/mixins/lib/_print-instance.scss +14 -14
- metadata +3 -3
- data/stylesheets/flint/functions/lib/_get-family-instance.scss +0 -59
@@ -6,36 +6,45 @@
|
|
6
6
|
// -------------------------------------------------------------------------------
|
7
7
|
// @return calculated value | false
|
8
8
|
|
9
|
-
@function calc-width($key, $span, $context: null) {
|
10
|
-
|
9
|
+
@function flint-calc-width($key, $span, $context: null) {
|
10
|
+
$result: false;
|
11
11
|
|
12
|
+
// Check to see if value has been cached
|
13
|
+
@if map-has-key($flint__cached-values, "#{$key, $span, $context}::width") and $context != "auto" {
|
14
|
+
@return map-get($flint__cached-values, "#{$key, $span, $context}::width");
|
15
|
+
}
|
16
|
+
|
17
|
+
@if flint-get-value("settings", "grid") == "fluid" {
|
12
18
|
@if $key == "container" or $span == "container" {
|
13
19
|
|
14
|
-
|
20
|
+
$result: flint-fluid-width(flint-get-value($key, "breakpoint"), flint-get-value($key, "breakpoint"));
|
15
21
|
|
16
22
|
} @else if $context == null {
|
17
23
|
|
18
|
-
|
24
|
+
$result: flint-fluid-width((flint-get-value($key, "breakpoint") / flint-get-value($key, "columns") * $span), flint-get-value($key, "breakpoint"));
|
19
25
|
|
20
26
|
} @else {
|
21
27
|
|
22
|
-
|
28
|
+
$result: flint-fluid-width((flint-get-value($key, "breakpoint") / flint-get-value($key, "columns") * $span), ((flint-get-value($key, "breakpoint") / flint-get-value($key, "columns") * $context)));
|
23
29
|
|
24
30
|
}
|
25
|
-
|
26
|
-
} @if get-value("settings", "grid") == "fixed" {
|
27
|
-
|
31
|
+
} @if flint-get-value("settings", "grid") == "fixed" {
|
28
32
|
@if $key == "container" or $span == "container" {
|
29
33
|
|
30
|
-
|
34
|
+
$result: flint-get-value($key, "breakpoint");
|
31
35
|
|
32
36
|
} @else {
|
33
37
|
|
34
|
-
|
38
|
+
$result: flint-get-value($key, "breakpoint") / flint-get-value($key, "columns") * $span;
|
35
39
|
|
36
40
|
}
|
41
|
+
}
|
37
42
|
|
38
|
-
|
39
|
-
|
43
|
+
// Save result to cache
|
44
|
+
@if $context != "auto" {
|
45
|
+
$flint__cached-values: map-merge($flint__cached-values, ("#{$key, $span, $context}::width": $result));
|
40
46
|
}
|
47
|
+
|
48
|
+
// Return result
|
49
|
+
@return $result;
|
41
50
|
}
|
@@ -5,18 +5,18 @@
|
|
5
5
|
// -------------------------------------------------------------------------------
|
6
6
|
// @return [bool]
|
7
7
|
|
8
|
-
@function exists($map, $value){
|
9
|
-
|
10
|
-
@if is-map($map) {
|
8
|
+
@function flint-exists($map, $value){
|
9
|
+
|
10
|
+
@if flint-is-map($map) {
|
11
11
|
@if map-has-key($map, $value) {
|
12
12
|
@return true;
|
13
13
|
}
|
14
14
|
@each $key, $i in $map {
|
15
|
-
@if exists($i, $value) {
|
15
|
+
@if flint-exists($i, $value) {
|
16
16
|
@return true;
|
17
17
|
}
|
18
18
|
}
|
19
|
-
}
|
19
|
+
}
|
20
20
|
|
21
21
|
@return false;
|
22
|
-
}
|
22
|
+
}
|
@@ -4,9 +4,9 @@
|
|
4
4
|
// -------------------------------------------------------------------------------
|
5
5
|
// @return [number]
|
6
6
|
|
7
|
-
@function get-index($key) {
|
8
|
-
@for $i from 1 through (length(map-fetch($flint, "config")) - 1) {
|
9
|
-
@if steal-key($i) == $key {
|
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
10
|
@return $i;
|
11
11
|
}
|
12
12
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
// Get single value from key in instance map based on $selector::$key
|
2
2
|
// -------------------------------------------------------------------------------
|
3
|
-
// @warning : all values
|
3
|
+
// @warning : all values returned are strings and must be converted with `flint-to-number()`
|
4
4
|
// -------------------------------------------------------------------------------
|
5
5
|
// @param $key [string] : key
|
6
6
|
// @param $value [number] : value
|
@@ -8,10 +8,10 @@
|
|
8
8
|
// -------------------------------------------------------------------------------
|
9
9
|
// @return [string]
|
10
10
|
|
11
|
-
@function get-instance-value($key, $value, $deep: null) {
|
11
|
+
@function flint-get-instance-value($key, $value, $deep: null) {
|
12
12
|
@if $deep == null {
|
13
|
-
@return map-fetch($flint__instances,
|
13
|
+
@return flint-map-fetch($flint__instances, flint-has-family-instance($key) $value);
|
14
14
|
} @else {
|
15
|
-
@return map-fetch($flint__instances,
|
15
|
+
@return flint-map-fetch($flint__instances, flint-has-family-instance($key) $value $deep);
|
16
16
|
}
|
17
17
|
}
|
@@ -5,10 +5,10 @@
|
|
5
5
|
// -------------------------------------------------------------------------------
|
6
6
|
// @return [literal]
|
7
7
|
|
8
|
-
@function get-value($key, $value: null) {
|
8
|
+
@function flint-get-value($key, $value: null) {
|
9
9
|
@if $value == null {
|
10
|
-
@return map-fetch($flint, "config" $key);
|
10
|
+
@return flint-map-fetch($flint, "config" $key);
|
11
11
|
} @else {
|
12
|
-
@return map-fetch($flint, "config" $key $value);
|
12
|
+
@return flint-map-fetch($flint, "config" $key $value);
|
13
13
|
}
|
14
14
|
}
|
@@ -0,0 +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,41 +1,43 @@
|
|
1
1
|
// Keeps count of all instances with arguments, stores in global var
|
2
2
|
// -------------------------------------------------------------------------------
|
3
|
-
// @dependence `get-value()`
|
3
|
+
// @dependence `flint-get-value()`
|
4
4
|
// -------------------------------------------------------------------------------
|
5
5
|
// @param $key [string] : computed breakpoint of instance
|
6
6
|
// @param $span [number] : computed span of instance
|
7
7
|
// @param $context [number] : computed context of instance
|
8
8
|
// @param $gutter [number] : computed gutter of instance
|
9
9
|
// @param $shift [number] : computed shift of instance
|
10
|
-
// @param $
|
11
|
-
// @param $
|
12
|
-
// @param $
|
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
13
|
// -------------------------------------------------------------------------------
|
14
14
|
// @return instance map
|
15
15
|
|
16
|
-
@function instance($key, $span, $context, $gutter, $shift, $
|
17
|
-
|
16
|
+
@function flint-instance($key, $span, $context, $gutter, $shift, $output-width, $output-margin-right, $output-margin-left) {
|
17
|
+
|
18
|
+
// Increase the instance count
|
18
19
|
$flint__instance-count: $flint__instance-count + 1 !global;
|
20
|
+
|
19
21
|
// Lets clean up the selector a bit...
|
20
22
|
$selector-string: selector_string();
|
21
|
-
$selector-list: string-to-list($selector-string);
|
22
|
-
$selector-cleaned: list-to-string($selector-list, " ");
|
23
|
+
$selector-list: flint-string-to-list($selector-string);
|
24
|
+
$selector-cleaned: flint-list-to-string($selector-list, " ");
|
23
25
|
|
24
26
|
$flint__instance: (
|
25
27
|
"#{$selector-cleaned}::#{$key}": (
|
26
28
|
"instance-count": #{$flint__instance-count},
|
27
|
-
"parent-selector": #{if(
|
29
|
+
"parent-selector": #{if(flint-has-family-instance($key) != false, flint-has-family-instance($key), none)},
|
28
30
|
"key": #{$key},
|
29
|
-
"breakpoint": #{get-value($key, breakpoint)},
|
30
|
-
"columns": #{get-value($key, columns)},
|
31
|
+
"breakpoint": #{flint-get-value($key, "breakpoint")},
|
32
|
+
"columns": #{flint-get-value($key, "columns")},
|
31
33
|
"span": #{$span},
|
32
|
-
"context": #{if($context == "auto", get-instance-value($key, "span"), $context)},
|
34
|
+
"context": #{if($context == "auto", flint-get-instance-value($key, "span"), $context)},
|
33
35
|
"gutter": #{$gutter},
|
34
36
|
"shift": #{$shift},
|
35
37
|
"output": (
|
36
|
-
"width": #{$
|
37
|
-
"margin-right": #{$
|
38
|
-
"margin-left": #{$
|
38
|
+
"width": #{$output-width},
|
39
|
+
"margin-right": #{$output-margin-right},
|
40
|
+
"margin-left": #{$output-margin-left}
|
39
41
|
)
|
40
42
|
)
|
41
43
|
);
|
@@ -7,19 +7,19 @@
|
|
7
7
|
// -------------------------------------------------------------------------------
|
8
8
|
// @return [string]
|
9
9
|
|
10
|
-
@function list-to-string($list, $glue: "", $is-nested: false) {
|
10
|
+
@function flint-list-to-string($list, $glue: "", $is-nested: false) {
|
11
11
|
$result: null;
|
12
12
|
$length: length($list);
|
13
13
|
|
14
14
|
@for $i from 1 through $length {
|
15
15
|
$n: nth($list, $i);
|
16
16
|
|
17
|
-
@if is-list($n) {
|
18
|
-
$result: $result#{list-to-string($n, $glue, true)};
|
17
|
+
@if flint-is-list($n) {
|
18
|
+
$result: $result#{flint-list-to-string($n, $glue, true)};
|
19
19
|
} @else {
|
20
20
|
$result: if($i != length($list) or $is-nested, $result#{$n}#{$glue}, $result#{$n});
|
21
21
|
}
|
22
22
|
}
|
23
23
|
|
24
24
|
@return $result;
|
25
|
-
}
|
25
|
+
}
|
@@ -5,18 +5,12 @@
|
|
5
5
|
// -------------------------------------------------------------------------------
|
6
6
|
// @return fetched literal | false
|
7
7
|
|
8
|
-
@function map-fetch($map, $keys) {
|
8
|
+
@function flint-map-fetch($map, $keys) {
|
9
9
|
$key: nth($keys, 1);
|
10
10
|
$length: length($keys);
|
11
11
|
$value: map-get($map, $key);
|
12
12
|
|
13
|
-
|
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 {
|
13
|
+
@if $value != null {
|
20
14
|
@if $length > 1 {
|
21
15
|
$rest: ();
|
22
16
|
|
@@ -24,10 +18,13 @@
|
|
24
18
|
$rest: append($rest, nth($keys, $i))
|
25
19
|
}
|
26
20
|
|
27
|
-
@return map-fetch($value, $rest);
|
21
|
+
@return flint-map-fetch($value, $rest);
|
28
22
|
|
29
23
|
} @else {
|
30
24
|
@return $value;
|
31
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;
|
32
29
|
}
|
33
30
|
}
|
@@ -4,12 +4,12 @@
|
|
4
4
|
// -------------------------------------------------------------------------------
|
5
5
|
// @return [string] | null
|
6
6
|
|
7
|
-
@function next-index($index) {
|
8
|
-
@if $index != (length(map-fetch($flint, "config")) - 1) {
|
7
|
+
@function flint-next-index($index) {
|
8
|
+
@if $index != (length(flint-map-fetch($flint, "config")) - 1) {
|
9
9
|
@each $key in nth(map-get($flint, "config"), $index + 1) {
|
10
10
|
@return $key;
|
11
11
|
}
|
12
12
|
} @else {
|
13
13
|
@return null;
|
14
14
|
}
|
15
|
-
}
|
15
|
+
}
|
@@ -6,11 +6,11 @@
|
|
6
6
|
// -------------------------------------------------------------------------------
|
7
7
|
// @return [list]
|
8
8
|
|
9
|
-
@function purge($list) {
|
9
|
+
@function flint-purge($list) {
|
10
10
|
$result: ();
|
11
11
|
|
12
12
|
@each $item in $list {
|
13
|
-
@if is-true($item) {
|
13
|
+
@if flint-is-true($item) {
|
14
14
|
$result: append($result, $item, list-separator($list));
|
15
15
|
}
|
16
16
|
}
|
@@ -1,13 +1,13 @@
|
|
1
|
-
//
|
1
|
+
// Remove $value from $list
|
2
2
|
// -------------------------------------------------------------------------------
|
3
3
|
// @documentation http://sassylists.com/documentation/#remove
|
4
4
|
// -------------------------------------------------------------------------------
|
5
5
|
// @param $list [list] : list
|
6
|
-
// @param $value [literal] : value to remove
|
6
|
+
// @param $value [literal] : value to flint-remove
|
7
7
|
// @param $recursive [bool] : enable / disable recursivity
|
8
8
|
// -------------------------------------------------------------------------------
|
9
9
|
// @return [list]
|
10
10
|
|
11
|
-
@function remove($list, $value) {
|
12
|
-
@return replace($list, $value, null);
|
11
|
+
@function flint-remove($list, $value) {
|
12
|
+
@return flint-replace($list, $value, null);
|
13
13
|
}
|
@@ -6,23 +6,29 @@
|
|
6
6
|
// -------------------------------------------------------------------------------
|
7
7
|
// @return [string]
|
8
8
|
|
9
|
-
@function replace-substring($string, $substring, $new-substring: " ") {
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
9
|
+
@function flint-replace-substring($string, $substring, $new-substring: " ") {
|
10
|
+
|
11
|
+
// Use Ruby function if available
|
12
|
+
@if $flint__use-ruby-functions {
|
13
|
+
@return replace_substring($string, $substring, $new-substring);
|
14
|
+
} @else {
|
15
|
+
// Loop through length of string
|
16
|
+
@for $i from 1 through str-length($string) {
|
17
|
+
// Get index and length of substring
|
18
|
+
$sub-index: str-index($string, $substring);
|
19
|
+
$sub-length: str-length($substring);
|
20
|
+
|
21
|
+
// If count is index of substring
|
22
|
+
@if $i == $sub-index {
|
23
|
+
// Slice string to exclude substring
|
24
|
+
$string-before: str-slice($string, 1, $i - 1);
|
25
|
+
$string-after: str-slice($string, $i + $sub-length, str-length($string));
|
26
|
+
// Create new string
|
27
|
+
$string: $string-before + $new-substring + $string-after;
|
28
|
+
}
|
15
29
|
|
16
|
-
// If count is index of substring
|
17
|
-
@if $i == $sub-index {
|
18
|
-
// Slice string to exclude substring
|
19
|
-
$string-before: str-slice($string, 1, $i - 1);
|
20
|
-
$string-after: str-slice($string, $i + $sub-length, str-length($string));
|
21
|
-
// Create new string
|
22
|
-
$string: $string-before + $new-substring + $string-after;
|
23
30
|
}
|
24
31
|
|
32
|
+
@return $string;
|
25
33
|
}
|
26
|
-
|
27
|
-
@return $string;
|
28
34
|
}
|