flint-gs 2.3.6 → 2.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +21 -21
- data/README.md +99 -98
- data/lib/flint-gs.rb +8 -0
- data/lib/flint.rb +22 -16
- data/lib/flint/functions.rb +99 -99
- data/lib/flint/version.rb +3 -3
- data/stylesheets/_flint.scss +7 -7
- data/stylesheets/flint/config/_config.scss +56 -56
- data/stylesheets/flint/functions/_functions.scss +48 -48
- data/stylesheets/flint/functions/helpers/_helpers.scss +229 -229
- data/stylesheets/flint/functions/lib/_calc-breakpoint.scss +47 -47
- data/stylesheets/flint/functions/lib/_calc-width.scss +70 -70
- data/stylesheets/flint/functions/lib/_fluid-width.scss +15 -15
- data/stylesheets/flint/functions/lib/_get-index.scss +21 -21
- data/stylesheets/flint/functions/lib/_get-instance-value.scss +15 -15
- data/stylesheets/flint/functions/lib/_get-value.scss +14 -14
- data/stylesheets/flint/functions/lib/_has-family-instance.scss +84 -84
- data/stylesheets/flint/functions/lib/_html-encode.scss +14 -14
- data/stylesheets/flint/functions/lib/_instance.scss +48 -48
- data/stylesheets/flint/functions/lib/_last.scss +14 -14
- data/stylesheets/flint/functions/lib/_list-to-str.scss +38 -38
- data/stylesheets/flint/functions/lib/_map-fetch.scss +31 -31
- data/stylesheets/flint/functions/lib/_next-index.scss +14 -14
- data/stylesheets/flint/functions/lib/_purge.scss +24 -24
- data/stylesheets/flint/functions/lib/_remove.scss +18 -18
- data/stylesheets/flint/functions/lib/_replace.scss +30 -30
- data/stylesheets/flint/functions/lib/_steal-key.scss +32 -32
- data/stylesheets/flint/functions/lib/_steal-values.scss +15 -15
- data/stylesheets/flint/functions/lib/_str-replace.scss +39 -39
- data/stylesheets/flint/functions/lib/_str-to-list.scss +89 -89
- data/stylesheets/flint/functions/lib/_support-syntax-bem.scss +37 -37
- data/stylesheets/flint/functions/lib/_support-syntax.scss +31 -31
- data/stylesheets/flint/functions/lib/_types-in-list.scss +76 -76
- data/stylesheets/flint/functions/lib/_use-syntax.scss +22 -22
- data/stylesheets/flint/globals/_globals.scss +122 -122
- data/stylesheets/flint/mixins/_mixins.scss +11 -11
- data/stylesheets/flint/mixins/lib/_box-sizing.scss +18 -18
- data/stylesheets/flint/mixins/lib/_calculate.scss +241 -241
- data/stylesheets/flint/mixins/lib/_clearfix.scss +29 -29
- data/stylesheets/flint/mixins/lib/_container.scss +45 -45
- data/stylesheets/flint/mixins/lib/_grid-overlay.scss +73 -73
- data/stylesheets/flint/mixins/lib/_main.scss +1057 -1057
- data/stylesheets/flint/mixins/lib/_new-instance.scss +28 -28
- data/stylesheets/flint/mixins/lib/_print-instance.scss +44 -44
- data/tests/config.rb +22 -34
- data/tests/input/functions/_functions.scss +47 -47
- data/tests/input/functions/helpers/_helpers.scss +437 -437
- data/tests/input/functions/lib/_calc-breakpoint.scss +62 -62
- data/tests/input/functions/lib/_calc-width.scss +195 -195
- data/tests/input/functions/lib/_fluid-width.scss +32 -32
- data/tests/input/functions/lib/_get-index.scss +31 -31
- data/tests/input/functions/lib/_get-instance-value.scss +72 -72
- data/tests/input/functions/lib/_get-value.scss +28 -28
- data/tests/input/functions/lib/_has-family-instance.scss +35 -35
- data/tests/input/functions/lib/_instance.scss +187 -187
- data/tests/input/functions/lib/_last.scss +18 -18
- data/tests/input/functions/lib/_list-to-str.scss +28 -28
- data/tests/input/functions/lib/_map-fetch.scss +34 -34
- data/tests/input/functions/lib/_next-index.scss +24 -24
- data/tests/input/functions/lib/_purge.scss +14 -14
- data/tests/input/functions/lib/_remove.scss +14 -14
- data/tests/input/functions/lib/_replace.scss +14 -14
- data/tests/input/functions/lib/_steal-key.scss +19 -19
- data/tests/input/functions/lib/_steal-values.scss +16 -16
- data/tests/input/functions/lib/_str-replace.scss +14 -14
- data/tests/input/functions/lib/_str-to-list.scss +28 -28
- data/tests/input/functions/lib/_support-syntax-bem.scss +14 -14
- data/tests/input/functions/lib/_support-syntax.scss +21 -21
- data/tests/input/functions/lib/_types-in-list.scss +50 -50
- data/tests/input/functions/lib/_use-syntax.scss +14 -14
- data/tests/input/output.scss +250 -250
- data/tests/output/output.css +3499 -3499
- data/tests/tests.html +110 -110
- metadata +12 -212
- data/tests/bootcamp/CHANGELOG.md +0 -70
- data/tests/bootcamp/CONTRIBUTING.md +0 -72
- data/tests/bootcamp/Gruntfile.coffee +0 -34
- data/tests/bootcamp/LICENSE.md +0 -7
- data/tests/bootcamp/README.md +0 -52
- data/tests/bootcamp/bower.json +0 -15
- data/tests/bootcamp/dist/_bootcamp.scss +0 -46
- data/tests/bootcamp/dist/bootcamp.coffee +0 -101
- data/tests/bootcamp/dist/core/functions/_actual.scss +0 -3
- data/tests/bootcamp/dist/core/functions/_error.scss +0 -29
- data/tests/bootcamp/dist/core/functions/_expect.scss +0 -6
- data/tests/bootcamp/dist/core/functions/_not-to.scss +0 -5
- data/tests/bootcamp/dist/core/functions/_should.scss +0 -6
- data/tests/bootcamp/dist/core/functions/_to.scss +0 -5
- data/tests/bootcamp/dist/core/mixins/_describe.scss +0 -31
- data/tests/bootcamp/dist/core/mixins/_it.scss +0 -31
- data/tests/bootcamp/dist/core/mixins/_runner.scss +0 -28
- data/tests/bootcamp/dist/core/mixins/_should.scss +0 -46
- data/tests/bootcamp/dist/core/mixins/_xdescribe.scss +0 -9
- data/tests/bootcamp/dist/core/mixins/_xit.scss +0 -9
- data/tests/bootcamp/dist/core/variables/_helpers.scss +0 -5
- data/tests/bootcamp/dist/core/variables/_settings.scss +0 -2
- data/tests/bootcamp/dist/core/variables/_should.scss +0 -6
- data/tests/bootcamp/dist/core/variables/_trackers.scss +0 -6
- data/tests/bootcamp/dist/lib/_sassyjson.scss +0 -1075
- data/tests/bootcamp/dist/matchers/_be.scss +0 -3
- data/tests/bootcamp/dist/matchers/_equal.scss +0 -3
- data/tests/bootcamp/dist/matchers/lists/_be-empty.scss +0 -3
- data/tests/bootcamp/dist/matchers/lists/_be-longer-than.scss +0 -3
- data/tests/bootcamp/dist/matchers/lists/_be-shorter-than.scss +0 -3
- data/tests/bootcamp/dist/matchers/lists/_contain.scss +0 -3
- data/tests/bootcamp/dist/matchers/lists/_deep-contain.scss +0 -3
- data/tests/bootcamp/dist/matchers/lists/_deep-equal.scss +0 -47
- data/tests/bootcamp/dist/matchers/lists/_have-length-of.scss +0 -3
- data/tests/bootcamp/dist/matchers/numbers/_be-close-to.scss +0 -12
- data/tests/bootcamp/dist/matchers/numbers/_be-greater-than.scss +0 -12
- data/tests/bootcamp/dist/matchers/numbers/_be-less-than.scss +0 -12
- data/tests/bootcamp/dist/matchers/types/_be-falsy.scss +0 -3
- data/tests/bootcamp/dist/matchers/types/_be-null.scss +0 -3
- data/tests/bootcamp/dist/matchers/types/_be-truthy.scss +0 -3
- data/tests/bootcamp/dist/matchers/types/_have-type-of.scss +0 -3
- data/tests/bootcamp/dist/utils/_contain.scss +0 -15
- data/tests/bootcamp/dist/utils/_equal.scss +0 -23
- data/tests/bootcamp/dist/utils/_list-join.scss +0 -35
- data/tests/bootcamp/dist/utils/_power.scss +0 -15
- data/tests/bootcamp/package.json +0 -63
- data/tests/bootcamp/tasks/bootcamp.coffee +0 -83
- data/tests/bootcamp/test/core/functions/_actual.scss +0 -10
- data/tests/bootcamp/test/core/functions/_expect.scss +0 -6
- data/tests/bootcamp/test/core/functions/_not-to.scss +0 -5
- data/tests/bootcamp/test/core/functions/_should.scss +0 -10
- data/tests/bootcamp/test/core/functions/_to.scss +0 -5
- data/tests/bootcamp/test/core/mixins/_describe.scss +0 -11
- data/tests/bootcamp/test/core/mixins/_it.scss +0 -5
- data/tests/bootcamp/test/core/mixins/_should.scss +0 -5
- data/tests/bootcamp/test/core/mixins/_xdescribe.scss +0 -28
- data/tests/bootcamp/test/core/mixins/_xit.scss +0 -12
- data/tests/bootcamp/test/matchers/_be.scss +0 -90
- data/tests/bootcamp/test/matchers/_equal.scss +0 -33
- data/tests/bootcamp/test/matchers/lists/_be-empty.scss +0 -12
- data/tests/bootcamp/test/matchers/lists/_be-longer-than.scss +0 -29
- data/tests/bootcamp/test/matchers/lists/_be-shorter-than.scss +0 -29
- data/tests/bootcamp/test/matchers/lists/_contain.scss +0 -39
- data/tests/bootcamp/test/matchers/lists/_deep-contain.scss +0 -51
- data/tests/bootcamp/test/matchers/lists/_deep-equal.scss +0 -151
- data/tests/bootcamp/test/matchers/lists/_have-length-of.scss +0 -31
- data/tests/bootcamp/test/matchers/numbers/_be-close-to.scss +0 -24
- data/tests/bootcamp/test/matchers/numbers/_be-greater-than.scss +0 -16
- data/tests/bootcamp/test/matchers/numbers/_be-less-than.scss +0 -16
- data/tests/bootcamp/test/matchers/types/_be-falsy.scss +0 -14
- data/tests/bootcamp/test/matchers/types/_be-null.scss +0 -13
- data/tests/bootcamp/test/matchers/types/_be-truthy.scss +0 -13
- data/tests/bootcamp/test/matchers/types/_have-type-of.scss +0 -17
- data/tests/bootcamp/test/specs.scss +0 -45
- data/tests/bootcamp/test/utils/_contain.scss +0 -41
- data/tests/bootcamp/test/utils/_equal.scss +0 -79
- data/tests/bootcamp/test/utils/_list-join.scss +0 -39
- data/tests/bootcamp/test/utils/_power.scss +0 -13
- data/tests/sass-prof.log +0 -0
@@ -1,47 +1,47 @@
|
|
1
|
-
///
|
2
|
-
/// Calculate breakpoint query
|
3
|
-
///
|
4
|
-
/// @access private
|
5
|
-
///
|
6
|
-
/// @param {String} $type - type of query to get
|
7
|
-
/// @param {String} $key - key of breakpoint
|
8
|
-
/// @param {Number} $i - index of current breakpoint
|
9
|
-
///
|
10
|
-
/// @return {Number} - breakpoint value
|
11
|
-
///
|
12
|
-
/// @group Internal Functions
|
13
|
-
///
|
14
|
-
@function flint-calc-breakpoint($type, $key, $i) {
|
15
|
-
|
16
|
-
@if $type == "alias" {
|
17
|
-
|
18
|
-
@if flint-get-value("settings", "grid") == "fixed" {
|
19
|
-
@if flint-is-lowest-breakpoint($key) {
|
20
|
-
@return 0;
|
21
|
-
} @else {
|
22
|
-
@return flint-get-value("breakpoints", $key, "breakpoint");
|
23
|
-
}
|
24
|
-
} @else if flint-get-value("settings", "grid") == "fluid" {
|
25
|
-
@return flint-get-value("breakpoints", $key, "breakpoint");
|
26
|
-
}
|
27
|
-
|
28
|
-
} @else if $type == "next" {
|
29
|
-
|
30
|
-
@if flint-is-lowest-breakpoint($key) {
|
31
|
-
@return 0;
|
32
|
-
} @else {
|
33
|
-
@return flint-get-value("breakpoints", flint-steal-key(($i + 1)), "breakpoint");
|
34
|
-
}
|
35
|
-
|
36
|
-
} @else if $type == "prev" {
|
37
|
-
|
38
|
-
@if flint-is-highest-breakpoint($key) {
|
39
|
-
@return flint-get-value("breakpoints", $key, "breakpoint");
|
40
|
-
} @else {
|
41
|
-
@return flint-get-value("breakpoints", flint-steal-key(($i - 1)), "breakpoint");
|
42
|
-
}
|
43
|
-
|
44
|
-
}
|
45
|
-
|
46
|
-
@return false;
|
47
|
-
}
|
1
|
+
///
|
2
|
+
/// Calculate breakpoint query
|
3
|
+
///
|
4
|
+
/// @access private
|
5
|
+
///
|
6
|
+
/// @param {String} $type - type of query to get
|
7
|
+
/// @param {String} $key - key of breakpoint
|
8
|
+
/// @param {Number} $i - index of current breakpoint
|
9
|
+
///
|
10
|
+
/// @return {Number} - breakpoint value
|
11
|
+
///
|
12
|
+
/// @group Internal Functions
|
13
|
+
///
|
14
|
+
@function flint-calc-breakpoint($type, $key, $i) {
|
15
|
+
|
16
|
+
@if $type == "alias" {
|
17
|
+
|
18
|
+
@if flint-get-value("settings", "grid") == "fixed" {
|
19
|
+
@if flint-is-lowest-breakpoint($key) {
|
20
|
+
@return 0;
|
21
|
+
} @else {
|
22
|
+
@return flint-get-value("breakpoints", $key, "breakpoint");
|
23
|
+
}
|
24
|
+
} @else if flint-get-value("settings", "grid") == "fluid" {
|
25
|
+
@return flint-get-value("breakpoints", $key, "breakpoint");
|
26
|
+
}
|
27
|
+
|
28
|
+
} @else if $type == "next" {
|
29
|
+
|
30
|
+
@if flint-is-lowest-breakpoint($key) {
|
31
|
+
@return 0;
|
32
|
+
} @else {
|
33
|
+
@return flint-get-value("breakpoints", flint-steal-key(($i + 1)), "breakpoint");
|
34
|
+
}
|
35
|
+
|
36
|
+
} @else if $type == "prev" {
|
37
|
+
|
38
|
+
@if flint-is-highest-breakpoint($key) {
|
39
|
+
@return flint-get-value("breakpoints", $key, "breakpoint");
|
40
|
+
} @else {
|
41
|
+
@return flint-get-value("breakpoints", flint-steal-key(($i - 1)), "breakpoint");
|
42
|
+
}
|
43
|
+
|
44
|
+
}
|
45
|
+
|
46
|
+
@return false;
|
47
|
+
}
|
@@ -1,70 +1,70 @@
|
|
1
|
-
///
|
2
|
-
/// Calculate width
|
3
|
-
///
|
4
|
-
/// @access private
|
5
|
-
///
|
6
|
-
/// @param {String} $key - key of breakpoint
|
7
|
-
/// @param {Number} $span - span value of element
|
8
|
-
/// @param {Number|String} $context [null] - context value of element
|
9
|
-
/// @param {Number} $deduct [null] - subtract value out of final width
|
10
|
-
///
|
11
|
-
/// @return {Map} - map of target and context result
|
12
|
-
///
|
13
|
-
/// @group Internal Functions
|
14
|
-
///
|
15
|
-
@function flint-calc-width($key, $span, $context: null, $deduct: null) {
|
16
|
-
$result: ();
|
17
|
-
|
18
|
-
// Check to see if value has been cached
|
19
|
-
@if map-has-key($flint-cached-values, "#{$key, $span, $context, $deduct}::width") and $context != "auto" {
|
20
|
-
@return map-get($flint-cached-values, "#{$key, $span, $context, $deduct}::width");
|
21
|
-
}
|
22
|
-
|
23
|
-
@if $span == "container" {
|
24
|
-
|
25
|
-
$result: flint-get-value("breakpoints", $key, "breakpoint");
|
26
|
-
|
27
|
-
} @else if $context == "auto" {
|
28
|
-
|
29
|
-
//
|
30
|
-
// Check if instance maps are enabled
|
31
|
-
//
|
32
|
-
@if not flint-get-value("settings", "instance-maps") {
|
33
|
-
@if not $flint-development-mode {
|
34
|
-
@error "Instance maps are disabled. Automatic context is not available. Enable `instance-maps` in the config to continue.";
|
35
|
-
} @else {
|
36
|
-
@warn "Instance maps are disabled. Automatic context is not available. Enable `instance-maps` in the config to continue.";
|
37
|
-
}
|
38
|
-
}
|
39
|
-
|
40
|
-
@if flint-has-family-instance($key) {
|
41
|
-
$result: map-merge($result, ("target": ((flint-get-instance-value($key, "internal", "width") / flint-get-instance-value($key, "span") * $span) - if($deduct, $deduct, 0))));
|
42
|
-
$result: map-merge($result, ("context": flint-get-instance-value($key, "internal", "width")));
|
43
|
-
} @else {
|
44
|
-
@if not $flint-development-mode {
|
45
|
-
@error "You set context to `#{$context}`, but a parent instance could not be found for `#{nth(&, 1) + '::' + $key}`";
|
46
|
-
} @else {
|
47
|
-
@return false;
|
48
|
-
}
|
49
|
-
}
|
50
|
-
|
51
|
-
} @else {
|
52
|
-
|
53
|
-
$result: map-merge($result, ("target": ((flint-get-value("breakpoints", $key, "breakpoint") / flint-get-value("breakpoints", $key, "columns") * $span) - if($deduct, $deduct, 0))));
|
54
|
-
|
55
|
-
@if $context {
|
56
|
-
$result: map-merge($result, ("context": flint-get-value("breakpoints", $key, "breakpoint") / flint-get-value("breakpoints", $key, "columns") * $context));
|
57
|
-
} @else {
|
58
|
-
$result: map-merge($result, ("context": flint-get-value("breakpoints", $key, "breakpoint")));
|
59
|
-
}
|
60
|
-
|
61
|
-
}
|
62
|
-
|
63
|
-
// Save result to cache
|
64
|
-
@if $context != "auto" {
|
65
|
-
$flint-cached-values: map-merge($flint-cached-values, ("#{$key, $span, $context, $deduct}::width": $result)) !global;
|
66
|
-
}
|
67
|
-
|
68
|
-
// Return result
|
69
|
-
@return $result;
|
70
|
-
}
|
1
|
+
///
|
2
|
+
/// Calculate width
|
3
|
+
///
|
4
|
+
/// @access private
|
5
|
+
///
|
6
|
+
/// @param {String} $key - key of breakpoint
|
7
|
+
/// @param {Number} $span - span value of element
|
8
|
+
/// @param {Number|String} $context [null] - context value of element
|
9
|
+
/// @param {Number} $deduct [null] - subtract value out of final width
|
10
|
+
///
|
11
|
+
/// @return {Map} - map of target and context result
|
12
|
+
///
|
13
|
+
/// @group Internal Functions
|
14
|
+
///
|
15
|
+
@function flint-calc-width($key, $span, $context: null, $deduct: null) {
|
16
|
+
$result: ();
|
17
|
+
|
18
|
+
// Check to see if value has been cached
|
19
|
+
@if map-has-key($flint-cached-values, "#{$key, $span, $context, $deduct}::width") and $context != "auto" {
|
20
|
+
@return map-get($flint-cached-values, "#{$key, $span, $context, $deduct}::width");
|
21
|
+
}
|
22
|
+
|
23
|
+
@if $span == "container" {
|
24
|
+
|
25
|
+
$result: flint-get-value("breakpoints", $key, "breakpoint");
|
26
|
+
|
27
|
+
} @else if $context == "auto" {
|
28
|
+
|
29
|
+
//
|
30
|
+
// Check if instance maps are enabled
|
31
|
+
//
|
32
|
+
@if not flint-get-value("settings", "instance-maps") {
|
33
|
+
@if not $flint-development-mode {
|
34
|
+
@error "Instance maps are disabled. Automatic context is not available. Enable `instance-maps` in the config to continue.";
|
35
|
+
} @else {
|
36
|
+
@warn "Instance maps are disabled. Automatic context is not available. Enable `instance-maps` in the config to continue.";
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
@if flint-has-family-instance($key) {
|
41
|
+
$result: map-merge($result, ("target": ((flint-get-instance-value($key, "internal", "width") / flint-get-instance-value($key, "span") * $span) - if($deduct, $deduct, 0))));
|
42
|
+
$result: map-merge($result, ("context": flint-get-instance-value($key, "internal", "width")));
|
43
|
+
} @else {
|
44
|
+
@if not $flint-development-mode {
|
45
|
+
@error "You set context to `#{$context}`, but a parent instance could not be found for `#{nth(&, 1) + '::' + $key}`";
|
46
|
+
} @else {
|
47
|
+
@return false;
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
} @else {
|
52
|
+
|
53
|
+
$result: map-merge($result, ("target": ((flint-get-value("breakpoints", $key, "breakpoint") / flint-get-value("breakpoints", $key, "columns") * $span) - if($deduct, $deduct, 0))));
|
54
|
+
|
55
|
+
@if $context {
|
56
|
+
$result: map-merge($result, ("context": flint-get-value("breakpoints", $key, "breakpoint") / flint-get-value("breakpoints", $key, "columns") * $context));
|
57
|
+
} @else {
|
58
|
+
$result: map-merge($result, ("context": flint-get-value("breakpoints", $key, "breakpoint")));
|
59
|
+
}
|
60
|
+
|
61
|
+
}
|
62
|
+
|
63
|
+
// Save result to cache
|
64
|
+
@if $context != "auto" {
|
65
|
+
$flint-cached-values: map-merge($flint-cached-values, ("#{$key, $span, $context, $deduct}::width": $result)) !global;
|
66
|
+
}
|
67
|
+
|
68
|
+
// Return result
|
69
|
+
@return $result;
|
70
|
+
}
|
@@ -1,15 +1,15 @@
|
|
1
|
-
///
|
2
|
-
/// Convert fixed to fluid width
|
3
|
-
///
|
4
|
-
/// @access private
|
5
|
-
///
|
6
|
-
/// @param {Number} $target
|
7
|
-
/// @param {Number} $context
|
8
|
-
///
|
9
|
-
/// @return {Number}
|
10
|
-
///
|
11
|
-
/// @group Internal Functions
|
12
|
-
///
|
13
|
-
@function flint-fluid-width($target, $context) {
|
14
|
-
@return ($target / $context) * 100%;
|
15
|
-
}
|
1
|
+
///
|
2
|
+
/// Convert fixed to fluid width
|
3
|
+
///
|
4
|
+
/// @access private
|
5
|
+
///
|
6
|
+
/// @param {Number} $target
|
7
|
+
/// @param {Number} $context
|
8
|
+
///
|
9
|
+
/// @return {Number}
|
10
|
+
///
|
11
|
+
/// @group Internal Functions
|
12
|
+
///
|
13
|
+
@function flint-fluid-width($target, $context) {
|
14
|
+
@return ($target / $context) * 100%;
|
15
|
+
}
|
@@ -1,21 +1,21 @@
|
|
1
|
-
///
|
2
|
-
/// Gets the index of the passed key
|
3
|
-
///
|
4
|
-
/// @access private
|
5
|
-
///
|
6
|
-
/// @param {String} $key - breakpoint key
|
7
|
-
///
|
8
|
-
/// @return {Number}
|
9
|
-
///
|
10
|
-
/// @group Internal Functions
|
11
|
-
///
|
12
|
-
@function flint-get-index($key) {
|
13
|
-
|
14
|
-
@for $i from 1 through length(map-keys(flint-get-value("breakpoints"))) {
|
15
|
-
@if flint-steal-key($i) == $key {
|
16
|
-
@return $i;
|
17
|
-
}
|
18
|
-
}
|
19
|
-
|
20
|
-
@return false;
|
21
|
-
}
|
1
|
+
///
|
2
|
+
/// Gets the index of the passed key
|
3
|
+
///
|
4
|
+
/// @access private
|
5
|
+
///
|
6
|
+
/// @param {String} $key - breakpoint key
|
7
|
+
///
|
8
|
+
/// @return {Number}
|
9
|
+
///
|
10
|
+
/// @group Internal Functions
|
11
|
+
///
|
12
|
+
@function flint-get-index($key) {
|
13
|
+
|
14
|
+
@for $i from 1 through length(map-keys(flint-get-value("breakpoints"))) {
|
15
|
+
@if flint-steal-key($i) == $key {
|
16
|
+
@return $i;
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
@return false;
|
21
|
+
}
|
@@ -1,15 +1,15 @@
|
|
1
|
-
///
|
2
|
-
/// Get single value from key in instance map based on $selector::$key
|
3
|
-
///
|
4
|
-
/// @access private
|
5
|
-
///
|
6
|
-
/// @param {String} $key - breakpoint key to pass to instance method
|
7
|
-
/// @param {ArgList} $values - list of keys to fetch value from
|
8
|
-
///
|
9
|
-
/// @return {*}
|
10
|
-
///
|
11
|
-
/// @group Internal Functions
|
12
|
-
///
|
13
|
-
@function flint-get-instance-value($key, $values...) {
|
14
|
-
@return flint-map-fetch($flint-instances, flint-has-family-instance($key), $values...);
|
15
|
-
}
|
1
|
+
///
|
2
|
+
/// Get single value from key in instance map based on $selector::$key
|
3
|
+
///
|
4
|
+
/// @access private
|
5
|
+
///
|
6
|
+
/// @param {String} $key - breakpoint key to pass to instance method
|
7
|
+
/// @param {ArgList} $values - list of keys to fetch value from
|
8
|
+
///
|
9
|
+
/// @return {*}
|
10
|
+
///
|
11
|
+
/// @group Internal Functions
|
12
|
+
///
|
13
|
+
@function flint-get-instance-value($key, $values...) {
|
14
|
+
@return flint-map-fetch($flint-instances, flint-has-family-instance($key), $values...);
|
15
|
+
}
|
@@ -1,14 +1,14 @@
|
|
1
|
-
///
|
2
|
-
/// Get single value from configuration map
|
3
|
-
///
|
4
|
-
/// @access private
|
5
|
-
///
|
6
|
-
/// @param {ArgList} $keys - list of keys to fetch value from
|
7
|
-
///
|
8
|
-
/// @return {*}
|
9
|
-
///
|
10
|
-
/// @group Internal Functions
|
11
|
-
///
|
12
|
-
@function flint-get-value($keys...) {
|
13
|
-
@return flint-map-fetch($flint, $keys...);
|
14
|
-
}
|
1
|
+
///
|
2
|
+
/// Get single value from configuration map
|
3
|
+
///
|
4
|
+
/// @access private
|
5
|
+
///
|
6
|
+
/// @param {ArgList} $keys - list of keys to fetch value from
|
7
|
+
///
|
8
|
+
/// @return {*}
|
9
|
+
///
|
10
|
+
/// @group Internal Functions
|
11
|
+
///
|
12
|
+
@function flint-get-value($keys...) {
|
13
|
+
@return flint-map-fetch($flint, $keys...);
|
14
|
+
}
|
@@ -1,84 +1,84 @@
|
|
1
|
-
///
|
2
|
-
/// Checks if instance exists in selector familiy tree, falls back from current selector
|
3
|
-
///
|
4
|
-
/// @access private
|
5
|
-
///
|
6
|
-
/// @param {String} $key - breakpoint key to search for matching instance
|
7
|
-
/// @param {String} $syntax - searches for instance using passed syntax parser
|
8
|
-
///
|
9
|
-
/// @return {String|False} instance selector
|
10
|
-
///
|
11
|
-
/// @group Internal Functions
|
12
|
-
///
|
13
|
-
@function flint-has-family-instance($key: flint-get-value("settings", "default"), $syntax: $flint-support-syntax) {
|
14
|
-
$selector: nth(&, 1);
|
15
|
-
|
16
|
-
@if not $key or not $selector {
|
17
|
-
@return false;
|
18
|
-
}
|
19
|
-
|
20
|
-
// Check if instance result had been cached
|
21
|
-
@if map-has-key($flint-cached-instances, "#{$selector}") {
|
22
|
-
// Get cached instance
|
23
|
-
$cached-instance: map-get($flint-cached-instances, "#{$selector}");
|
24
|
-
// Return with current key
|
25
|
-
@return "#{$cached-instance}::#{$key}";
|
26
|
-
}
|
27
|
-
|
28
|
-
// Check for syntax support, try to find instance using it
|
29
|
-
@if $syntax {
|
30
|
-
|
31
|
-
$parsed-selector: flint-use-syntax($selector);
|
32
|
-
$length: length($parsed-selector);
|
33
|
-
|
34
|
-
// Loop through transformed selectors
|
35
|
-
@for $i from 1 through $length {
|
36
|
-
|
37
|
-
// Check last selector in list
|
38
|
-
@if map-has-key($flint-instances, "#{flint-last($parsed-selector)}::#{$key}") {
|
39
|
-
|
40
|
-
// Cache result
|
41
|
-
$flint-cached-instances: map-merge($flint-cached-instances, ("#{$selector}": "#{flint-last($parsed-selector)}")) !global;
|
42
|
-
|
43
|
-
// Return the matching instance key
|
44
|
-
@return "#{flint-last($parsed-selector)}::#{$key}";
|
45
|
-
|
46
|
-
} @else {
|
47
|
-
|
48
|
-
// Else, remove the last selector and loop again
|
49
|
-
$parsed-selector: flint-remove($parsed-selector, flint-last($parsed-selector));
|
50
|
-
|
51
|
-
}
|
52
|
-
}
|
53
|
-
|
54
|
-
// Search for a parent instance normally
|
55
|
-
@return flint-has-family-instance($key, null);
|
56
|
-
|
57
|
-
} @else {
|
58
|
-
$selector-list: $selector;
|
59
|
-
$length: length($selector-list);
|
60
|
-
|
61
|
-
// Loop through length of list of selectors
|
62
|
-
@for $i from 1 through $length {
|
63
|
-
$selector-string: flint-list-to-str($selector-list, " ");
|
64
|
-
|
65
|
-
// Make sure that we're not counting the current selector set
|
66
|
-
@if map-has-key($flint-instances, "#{$selector-string}::#{$key}") and $selector != $selector-list {
|
67
|
-
|
68
|
-
// Cache result
|
69
|
-
$flint-cached-instances: map-merge($flint-cached-instances, ("#{$selector}": "#{$selector-string}")) !global;
|
70
|
-
|
71
|
-
// Return the matching instance key
|
72
|
-
@return "#{$selector-string}::#{$key}";
|
73
|
-
|
74
|
-
} @else {
|
75
|
-
|
76
|
-
// Else, remove the last selector and loop again
|
77
|
-
$selector-list: flint-remove($selector-list, flint-last($selector-list));
|
78
|
-
|
79
|
-
}
|
80
|
-
}
|
81
|
-
|
82
|
-
@return false;
|
83
|
-
}
|
84
|
-
}
|
1
|
+
///
|
2
|
+
/// Checks if instance exists in selector familiy tree, falls back from current selector
|
3
|
+
///
|
4
|
+
/// @access private
|
5
|
+
///
|
6
|
+
/// @param {String} $key - breakpoint key to search for matching instance
|
7
|
+
/// @param {String} $syntax - searches for instance using passed syntax parser
|
8
|
+
///
|
9
|
+
/// @return {String|False} instance selector
|
10
|
+
///
|
11
|
+
/// @group Internal Functions
|
12
|
+
///
|
13
|
+
@function flint-has-family-instance($key: flint-get-value("settings", "default"), $syntax: $flint-support-syntax) {
|
14
|
+
$selector: nth(&, 1);
|
15
|
+
|
16
|
+
@if not $key or not $selector {
|
17
|
+
@return false;
|
18
|
+
}
|
19
|
+
|
20
|
+
// Check if instance result had been cached
|
21
|
+
@if map-has-key($flint-cached-instances, "#{$selector}") {
|
22
|
+
// Get cached instance
|
23
|
+
$cached-instance: map-get($flint-cached-instances, "#{$selector}");
|
24
|
+
// Return with current key
|
25
|
+
@return "#{$cached-instance}::#{$key}";
|
26
|
+
}
|
27
|
+
|
28
|
+
// Check for syntax support, try to find instance using it
|
29
|
+
@if $syntax {
|
30
|
+
|
31
|
+
$parsed-selector: flint-use-syntax($selector);
|
32
|
+
$length: length($parsed-selector);
|
33
|
+
|
34
|
+
// Loop through transformed selectors
|
35
|
+
@for $i from 1 through $length {
|
36
|
+
|
37
|
+
// Check last selector in list
|
38
|
+
@if map-has-key($flint-instances, "#{flint-last($parsed-selector)}::#{$key}") {
|
39
|
+
|
40
|
+
// Cache result
|
41
|
+
$flint-cached-instances: map-merge($flint-cached-instances, ("#{$selector}": "#{flint-last($parsed-selector)}")) !global;
|
42
|
+
|
43
|
+
// Return the matching instance key
|
44
|
+
@return "#{flint-last($parsed-selector)}::#{$key}";
|
45
|
+
|
46
|
+
} @else {
|
47
|
+
|
48
|
+
// Else, remove the last selector and loop again
|
49
|
+
$parsed-selector: flint-remove($parsed-selector, flint-last($parsed-selector));
|
50
|
+
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
// Search for a parent instance normally
|
55
|
+
@return flint-has-family-instance($key, null);
|
56
|
+
|
57
|
+
} @else {
|
58
|
+
$selector-list: $selector;
|
59
|
+
$length: length($selector-list);
|
60
|
+
|
61
|
+
// Loop through length of list of selectors
|
62
|
+
@for $i from 1 through $length {
|
63
|
+
$selector-string: flint-list-to-str($selector-list, " ");
|
64
|
+
|
65
|
+
// Make sure that we're not counting the current selector set
|
66
|
+
@if map-has-key($flint-instances, "#{$selector-string}::#{$key}") and $selector != $selector-list {
|
67
|
+
|
68
|
+
// Cache result
|
69
|
+
$flint-cached-instances: map-merge($flint-cached-instances, ("#{$selector}": "#{$selector-string}")) !global;
|
70
|
+
|
71
|
+
// Return the matching instance key
|
72
|
+
@return "#{$selector-string}::#{$key}";
|
73
|
+
|
74
|
+
} @else {
|
75
|
+
|
76
|
+
// Else, remove the last selector and loop again
|
77
|
+
$selector-list: flint-remove($selector-list, flint-last($selector-list));
|
78
|
+
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
82
|
+
@return false;
|
83
|
+
}
|
84
|
+
}
|