flint-gs 1.7.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +21 -21
- data/README.md +906 -906
- data/lib/flint.rb +77 -77
- 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 +181 -187
- 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/_string-to-number.scss +77 -77
- 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 -120
- 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 +22 -16
- checksums.yaml +0 -7
@@ -1,33 +1,33 @@
|
|
1
|
-
// Calculate from-to breakpoints
|
2
|
-
// -------------------------------------------------------------------------------
|
3
|
-
// @param $n [string] : how to calculate breakpoint
|
4
|
-
// @param $key [string] : key of breakpoint
|
5
|
-
// @param $i [number] : index of current breakpoint
|
6
|
-
// -------------------------------------------------------------------------------
|
7
|
-
// @return calculated value
|
8
|
-
|
9
|
-
@function flint-calc-breakpoint($n, $key, $i) {
|
10
|
-
@if $n == "alias" {
|
11
|
-
@if flint-get-value("settings", "grid") == "fixed" {
|
12
|
-
@if flint-is-lowest-breakpoint($key) {
|
13
|
-
@return 0;
|
14
|
-
} @else {
|
15
|
-
@return flint-get-value($key, "breakpoint");
|
16
|
-
}
|
17
|
-
} @else if flint-get-value("settings", "grid") == "fluid" {
|
18
|
-
@return flint-get-value($key, "breakpoint");
|
19
|
-
}
|
20
|
-
} @else if $n == "next" {
|
21
|
-
@if flint-is-lowest-breakpoint($key) {
|
22
|
-
@return 0;
|
23
|
-
} @else {
|
24
|
-
@return flint-get-value(flint-steal-key(($i + 1)), "breakpoint");
|
25
|
-
}
|
26
|
-
} @else if $n == "prev" {
|
27
|
-
@if flint-is-highest-breakpoint($key) {
|
28
|
-
@return flint-get-value($key, "breakpoint");
|
29
|
-
} @else {
|
30
|
-
@return flint-get-value(flint-steal-key(($i - 1)), "breakpoint");
|
31
|
-
}
|
32
|
-
}
|
33
|
-
}
|
1
|
+
// Calculate from-to breakpoints
|
2
|
+
// -------------------------------------------------------------------------------
|
3
|
+
// @param $n [string] : how to calculate breakpoint
|
4
|
+
// @param $key [string] : key of breakpoint
|
5
|
+
// @param $i [number] : index of current breakpoint
|
6
|
+
// -------------------------------------------------------------------------------
|
7
|
+
// @return calculated value
|
8
|
+
|
9
|
+
@function flint-calc-breakpoint($n, $key, $i) {
|
10
|
+
@if $n == "alias" {
|
11
|
+
@if flint-get-value("settings", "grid") == "fixed" {
|
12
|
+
@if flint-is-lowest-breakpoint($key) {
|
13
|
+
@return 0;
|
14
|
+
} @else {
|
15
|
+
@return flint-get-value($key, "breakpoint");
|
16
|
+
}
|
17
|
+
} @else if flint-get-value("settings", "grid") == "fluid" {
|
18
|
+
@return flint-get-value($key, "breakpoint");
|
19
|
+
}
|
20
|
+
} @else if $n == "next" {
|
21
|
+
@if flint-is-lowest-breakpoint($key) {
|
22
|
+
@return 0;
|
23
|
+
} @else {
|
24
|
+
@return flint-get-value(flint-steal-key(($i + 1)), "breakpoint");
|
25
|
+
}
|
26
|
+
} @else if $n == "prev" {
|
27
|
+
@if flint-is-highest-breakpoint($key) {
|
28
|
+
@return flint-get-value($key, "breakpoint");
|
29
|
+
} @else {
|
30
|
+
@return flint-get-value(flint-steal-key(($i - 1)), "breakpoint");
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}
|
@@ -1,57 +1,57 @@
|
|
1
|
-
// Calculate margin
|
2
|
-
// -------------------------------------------------------------------------------
|
3
|
-
// @param $key [string] : key for lookup
|
4
|
-
// @param $span [number] : span value of element
|
5
|
-
// @param $context [number] : context value of element
|
6
|
-
// -------------------------------------------------------------------------------
|
7
|
-
// @return calculated value | false
|
8
|
-
|
9
|
-
@function flint-calc-margin($key, $span, $context: null) {
|
10
|
-
$result: false;
|
11
|
-
|
12
|
-
// Check to see if value has been cached
|
13
|
-
@if map-has-key($flint__cached-values, "#{$key, $span, $context}::margin") and $context != "auto" {
|
14
|
-
@return map-get($flint__cached-values, "#{$key, $span, $context}::margin");
|
15
|
-
}
|
16
|
-
|
17
|
-
@if flint-get-value("settings", "grid") == "fluid" {
|
18
|
-
|
19
|
-
@if $key == "container" or $span == "container" {
|
20
|
-
|
21
|
-
$result: 0;
|
22
|
-
|
23
|
-
} @else if $context == null {
|
24
|
-
|
25
|
-
$result: flint-fluid-width(flint-get-value("settings", "gutter"), flint-get-value($key, "breakpoint"));
|
26
|
-
|
27
|
-
} @else if $context <= flint-get-value($key, "columns") {
|
28
|
-
|
29
|
-
$result: flint-fluid-width(flint-get-value("settings", "gutter"), ((flint-get-value($key, "breakpoint") / flint-get-value($key, "columns") * $context)));
|
30
|
-
|
31
|
-
} @else {
|
32
|
-
|
33
|
-
$result: flint-fluid-width(flint-get-value("settings", "gutter") / flint-get-value($key, "columns") * $context, ((flint-get-value($key, "breakpoint") / flint-get-value($key, "columns") * $context)));
|
34
|
-
|
35
|
-
}
|
36
|
-
|
37
|
-
} @if flint-get-value("settings", "grid") == "fixed" {
|
38
|
-
|
39
|
-
@if $key == "container" or $span == "container" {
|
40
|
-
|
41
|
-
$result: 0;
|
42
|
-
|
43
|
-
} @else {
|
44
|
-
|
45
|
-
$result: flint-get-value("settings", "gutter");
|
46
|
-
}
|
47
|
-
|
48
|
-
}
|
49
|
-
|
50
|
-
// Save result to cache
|
51
|
-
@if $context != "auto" {
|
52
|
-
$flint__cached-values: map-merge($flint__cached-values, ("#{$key, $span, $context}::margin": $result));
|
53
|
-
}
|
54
|
-
|
55
|
-
// Return result
|
56
|
-
@return $result;
|
57
|
-
}
|
1
|
+
// Calculate margin
|
2
|
+
// -------------------------------------------------------------------------------
|
3
|
+
// @param $key [string] : key for lookup
|
4
|
+
// @param $span [number] : span value of element
|
5
|
+
// @param $context [number] : context value of element
|
6
|
+
// -------------------------------------------------------------------------------
|
7
|
+
// @return calculated value | false
|
8
|
+
|
9
|
+
@function flint-calc-margin($key, $span, $context: null) {
|
10
|
+
$result: false;
|
11
|
+
|
12
|
+
// Check to see if value has been cached
|
13
|
+
@if map-has-key($flint__cached-values, "#{$key, $span, $context}::margin") and $context != "auto" {
|
14
|
+
@return map-get($flint__cached-values, "#{$key, $span, $context}::margin");
|
15
|
+
}
|
16
|
+
|
17
|
+
@if flint-get-value("settings", "grid") == "fluid" {
|
18
|
+
|
19
|
+
@if $key == "container" or $span == "container" {
|
20
|
+
|
21
|
+
$result: 0;
|
22
|
+
|
23
|
+
} @else if $context == null {
|
24
|
+
|
25
|
+
$result: flint-fluid-width(flint-get-value("settings", "gutter"), flint-get-value($key, "breakpoint"));
|
26
|
+
|
27
|
+
} @else if $context <= flint-get-value($key, "columns") {
|
28
|
+
|
29
|
+
$result: flint-fluid-width(flint-get-value("settings", "gutter"), ((flint-get-value($key, "breakpoint") / flint-get-value($key, "columns") * $context)));
|
30
|
+
|
31
|
+
} @else {
|
32
|
+
|
33
|
+
$result: flint-fluid-width(flint-get-value("settings", "gutter") / flint-get-value($key, "columns") * $context, ((flint-get-value($key, "breakpoint") / flint-get-value($key, "columns") * $context)));
|
34
|
+
|
35
|
+
}
|
36
|
+
|
37
|
+
} @if flint-get-value("settings", "grid") == "fixed" {
|
38
|
+
|
39
|
+
@if $key == "container" or $span == "container" {
|
40
|
+
|
41
|
+
$result: 0;
|
42
|
+
|
43
|
+
} @else {
|
44
|
+
|
45
|
+
$result: flint-get-value("settings", "gutter");
|
46
|
+
}
|
47
|
+
|
48
|
+
}
|
49
|
+
|
50
|
+
// Save result to cache
|
51
|
+
@if $context != "auto" {
|
52
|
+
$flint__cached-values: map-merge($flint__cached-values, ("#{$key, $span, $context}::margin": $result));
|
53
|
+
}
|
54
|
+
|
55
|
+
// Return result
|
56
|
+
@return $result;
|
57
|
+
}
|
@@ -1,50 +1,50 @@
|
|
1
|
-
// Calculate width
|
2
|
-
// -------------------------------------------------------------------------------
|
3
|
-
// @param $key [string] : key for lookup
|
4
|
-
// @param $span [number] : span value of element
|
5
|
-
// @param $context [number] : context value of element
|
6
|
-
// -------------------------------------------------------------------------------
|
7
|
-
// @return calculated value | false
|
8
|
-
|
9
|
-
@function flint-calc-width($key, $span, $context: null) {
|
10
|
-
$result: false;
|
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" {
|
18
|
-
@if $key == "container" or $span == "container" {
|
19
|
-
|
20
|
-
$result: flint-fluid-width(flint-get-value($key, "breakpoint"), flint-get-value($key, "breakpoint"));
|
21
|
-
|
22
|
-
} @else if $context == null {
|
23
|
-
|
24
|
-
$result: flint-fluid-width((flint-get-value($key, "breakpoint") / flint-get-value($key, "columns") * $span), flint-get-value($key, "breakpoint"));
|
25
|
-
|
26
|
-
} @else {
|
27
|
-
|
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)));
|
29
|
-
|
30
|
-
}
|
31
|
-
} @if flint-get-value("settings", "grid") == "fixed" {
|
32
|
-
@if $key == "container" or $span == "container" {
|
33
|
-
|
34
|
-
$result: flint-get-value($key, "breakpoint");
|
35
|
-
|
36
|
-
} @else {
|
37
|
-
|
38
|
-
$result: flint-get-value($key, "breakpoint") / flint-get-value($key, "columns") * $span;
|
39
|
-
|
40
|
-
}
|
41
|
-
}
|
42
|
-
|
43
|
-
// Save result to cache
|
44
|
-
@if $context != "auto" {
|
45
|
-
$flint__cached-values: map-merge($flint__cached-values, ("#{$key, $span, $context}::width": $result));
|
46
|
-
}
|
47
|
-
|
48
|
-
// Return result
|
49
|
-
@return $result;
|
50
|
-
}
|
1
|
+
// Calculate width
|
2
|
+
// -------------------------------------------------------------------------------
|
3
|
+
// @param $key [string] : key for lookup
|
4
|
+
// @param $span [number] : span value of element
|
5
|
+
// @param $context [number] : context value of element
|
6
|
+
// -------------------------------------------------------------------------------
|
7
|
+
// @return calculated value | false
|
8
|
+
|
9
|
+
@function flint-calc-width($key, $span, $context: null) {
|
10
|
+
$result: false;
|
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" {
|
18
|
+
@if $key == "container" or $span == "container" {
|
19
|
+
|
20
|
+
$result: flint-fluid-width(flint-get-value($key, "breakpoint"), flint-get-value($key, "breakpoint"));
|
21
|
+
|
22
|
+
} @else if $context == null {
|
23
|
+
|
24
|
+
$result: flint-fluid-width((flint-get-value($key, "breakpoint") / flint-get-value($key, "columns") * $span), flint-get-value($key, "breakpoint"));
|
25
|
+
|
26
|
+
} @else {
|
27
|
+
|
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)));
|
29
|
+
|
30
|
+
}
|
31
|
+
} @if flint-get-value("settings", "grid") == "fixed" {
|
32
|
+
@if $key == "container" or $span == "container" {
|
33
|
+
|
34
|
+
$result: flint-get-value($key, "breakpoint");
|
35
|
+
|
36
|
+
} @else {
|
37
|
+
|
38
|
+
$result: flint-get-value($key, "breakpoint") / flint-get-value($key, "columns") * $span;
|
39
|
+
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
// Save result to cache
|
44
|
+
@if $context != "auto" {
|
45
|
+
$flint__cached-values: map-merge($flint__cached-values, ("#{$key, $span, $context}::width": $result));
|
46
|
+
}
|
47
|
+
|
48
|
+
// Return result
|
49
|
+
@return $result;
|
50
|
+
}
|
@@ -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
|
+
}
|