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.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +13 -13
  3. data/lib/flint.rb +64 -4
  4. data/stylesheets/flint/config/_config.scss +3 -3
  5. data/stylesheets/flint/functions/_functions.scss +1 -1
  6. data/stylesheets/flint/functions/helpers/_helpers.scss +32 -23
  7. data/stylesheets/flint/functions/lib/_calc-breakpoint.scss +11 -11
  8. data/stylesheets/flint/functions/lib/_calc-margin.scss +40 -12
  9. data/stylesheets/flint/functions/lib/_calc-width.scss +21 -12
  10. data/stylesheets/flint/functions/lib/_exists.scss +6 -6
  11. data/stylesheets/flint/functions/lib/_fluid-width.scss +2 -2
  12. data/stylesheets/flint/functions/lib/_get-index.scss +3 -3
  13. data/stylesheets/flint/functions/lib/_get-instance-value.scss +4 -4
  14. data/stylesheets/flint/functions/lib/_get-value.scss +3 -3
  15. data/stylesheets/flint/functions/lib/_has-family-instance.scss +74 -0
  16. data/stylesheets/flint/functions/lib/_instance.scss +17 -15
  17. data/stylesheets/flint/functions/lib/_last.scss +2 -2
  18. data/stylesheets/flint/functions/lib/_list-to-string.scss +4 -4
  19. data/stylesheets/flint/functions/lib/_map-fetch.scss +6 -9
  20. data/stylesheets/flint/functions/lib/_next-index.scss +3 -3
  21. data/stylesheets/flint/functions/lib/_purge.scss +2 -2
  22. data/stylesheets/flint/functions/lib/_remove.scss +4 -4
  23. data/stylesheets/flint/functions/lib/_replace-substring.scss +21 -15
  24. data/stylesheets/flint/functions/lib/_replace.scss +3 -3
  25. data/stylesheets/flint/functions/lib/_steal-key.scss +3 -3
  26. data/stylesheets/flint/functions/lib/_steal-values.scss +3 -3
  27. data/stylesheets/flint/functions/lib/_string-to-list.scss +63 -57
  28. data/stylesheets/flint/functions/lib/_string-to-number.scss +42 -38
  29. data/stylesheets/flint/functions/lib/_support-syntax-bem.scss +3 -3
  30. data/stylesheets/flint/functions/lib/_support-syntax.scss +4 -4
  31. data/stylesheets/flint/functions/lib/_types-in-list.scss +3 -3
  32. data/stylesheets/flint/functions/lib/_use-syntax.scss +3 -3
  33. data/stylesheets/flint/globals/_globals.scss +20 -4
  34. data/stylesheets/flint/mixins/lib/_calculate.scss +368 -563
  35. data/stylesheets/flint/mixins/lib/_clearfix.scss +7 -7
  36. data/stylesheets/flint/mixins/lib/_main.scss +244 -244
  37. data/stylesheets/flint/mixins/lib/_new-instance.scss +20 -20
  38. data/stylesheets/flint/mixins/lib/_print-instance.scss +14 -14
  39. metadata +3 -3
  40. data/stylesheets/flint/functions/lib/_get-family-instance.scss +0 -59
@@ -8,7 +8,7 @@
8
8
  // -------------------------------------------------------------------------------
9
9
  // @return [list]
10
10
 
11
- @function replace($list, $old, $value) {
11
+ @function flint-replace($list, $old, $value) {
12
12
  $running: true;
13
13
 
14
14
  @while $running {
@@ -21,5 +21,5 @@
21
21
  }
22
22
  }
23
23
 
24
- @return if(not is-true($value), purge($list), $list);
25
- }
24
+ @return if(not flint-is-true($value), flint-purge($list), $list);
25
+ }
@@ -4,10 +4,10 @@
4
4
  // -------------------------------------------------------------------------------
5
5
  // @return [string]
6
6
 
7
- @function steal-key($index) {
8
- @for $n from 1 through (length(map-fetch($flint, "config")) - 1) {
7
+ @function flint-steal-key($index) {
8
+ @for $n from 1 through (length(flint-map-fetch($flint, "config")) - 1) {
9
9
  @each $key in nth(map-get($flint, "config"), $index) {
10
10
  @return $key;
11
11
  }
12
12
  }
13
- }
13
+ }
@@ -5,10 +5,10 @@
5
5
  // -------------------------------------------------------------------------------
6
6
  // @return [number]
7
7
 
8
- @function steal-values($index, $value) {
9
- @for $n from 1 through (length(map-fetch($flint, config)) - 1) {
8
+ @function flint-steal-values($index, $value) {
9
+ @for $n from 1 through (length(flint-map-fetch($flint, config)) - 1) {
10
10
  @each $key in nth(map-get($flint, config), $index) {
11
- @return get-value($key, $value);
11
+ @return flint-get-value($key, $value);
12
12
  }
13
13
  }
14
14
  }
@@ -6,79 +6,85 @@
6
6
  // -------------------------------------------------------------------------------
7
7
  // @return [list] | error
8
8
 
9
- @function string-to-list($string, $find: " ", $ignore: ",") {
10
- @if is-string($string) {
11
- $string-list: ();
12
- $space-indexes: ();
13
- $ignore-remainder: ();
14
- $length: str-length($string);
15
-
16
- // Find ignore separator, and remove remainder of string beyond that point
17
- @for $i from 1 through $length {
18
- $slice: str-slice($string, $i, $i);
19
- @if $slice == $ignore {
20
- $ignore-remainder: append($ignore-remainder, $i - 1, "comma");
21
- }
22
- }
9
+ @function flint-string-to-list($string, $find: " ", $ignore: ",") {
10
+ @if flint-is-string($string) {
23
11
 
24
- // Redefine string and length
25
- @if length($ignore-remainder) >= 1 {
26
- $string: str-slice($string, 1, nth($ignore-remainder, 1));
12
+ // Use Ruby function if available
13
+ @if $flint__use-ruby-functions {
14
+ @return string_to_list($string, $find, $ignore);
15
+ } @else {
16
+ $string-list: ();
17
+ $space-indexes: ();
18
+ $ignore-remainder: ();
27
19
  $length: str-length($string);
28
- }
29
20
 
30
- // Find all spaces and their indices by looking over each character in string
31
- @for $i from 1 through $length {
32
- $slice: str-slice($string, $i, $i);
33
- @if $slice == $find {
34
- $space-indexes: append($space-indexes, $i, "comma");
21
+ // Find ignore separator, and flint-remove remainder of string beyond that point
22
+ @for $i from 1 through $length {
23
+ $slice: str-slice($string, $i, $i);
24
+ @if $slice == $ignore {
25
+ $ignore-remainder: append($ignore-remainder, $i - 1, "comma");
26
+ }
27
+ }
28
+
29
+ // Redefine string and length
30
+ @if length($ignore-remainder) >= 1 {
31
+ $string: str-slice($string, 1, nth($ignore-remainder, 1));
32
+ $length: str-length($string);
33
+ }
34
+
35
+ // Find all spaces and their indices by looking over each character in string
36
+ @for $i from 1 through $length {
37
+ $slice: str-slice($string, $i, $i);
38
+ @if $slice == $find {
39
+ $space-indexes: append($space-indexes, $i, "comma");
40
+ }
35
41
  }
36
- }
37
42
 
38
- // Check if there are any spaces
39
- @if length($space-indexes) >= 1 {
43
+ // Check if there are any spaces
44
+ @if length($space-indexes) >= 1 {
40
45
 
41
- // Keep a count of number of spaces
42
- $count: 1;
46
+ // Keep a count of number of spaces
47
+ $count: 1;
43
48
 
44
- // Loop through each space
45
- @each $space in $space-indexes {
49
+ // Loop through each space
50
+ @each $space in $space-indexes {
46
51
 
47
- // If is initial count, grab first substring and store in list
48
- @if $count == 1 {
49
- $matched-string: str-slice($string, 0, ($space - 1));
52
+ // If is initial count, grab first substring and store in list
53
+ @if $count == 1 {
54
+ $matched-string: str-slice($string, 0, ($space - 1));
50
55
 
51
- @if $matched-string != "" {
52
- $string-list: append($string-list, $matched-string, "comma");
53
- }
54
- // Else, add a little math to make up for the spaces to do the same
55
- } @else {
56
- $matched-string: str-slice($string, (nth($space-indexes, ($count - 1)) + 1), ($space - 1));
56
+ @if $matched-string != "" {
57
+ $string-list: append($string-list, $matched-string, "comma");
58
+ }
59
+ // Else, add a little math to make up for the spaces to do the same
60
+ } @else {
61
+ $matched-string: str-slice($string, (nth($space-indexes, ($count - 1)) + 1), ($space - 1));
57
62
 
58
- @if $matched-string != "" {
59
- $string-list: append($string-list, $matched-string, "comma");
63
+ @if $matched-string != "" {
64
+ $string-list: append($string-list, $matched-string, "comma");
65
+ }
60
66
  }
61
- }
62
67
 
63
- // Increase count
64
- $count: $count + 1;
65
- }
68
+ // Increase count
69
+ $count: $count + 1;
70
+ }
66
71
 
67
- // Now grab that last selector
68
- $last-space: nth($space-indexes, length($space-indexes));
69
- $matched-string: str-slice($string, ($last-space + 1), $length);
70
- $string-list: append($string-list, $matched-string, "comma");
72
+ // Now grab that last selector
73
+ $flint-last-space: nth($space-indexes, length($space-indexes));
74
+ $matched-string: str-slice($string, ($flint-last-space + 1), $length);
75
+ $string-list: append($string-list, $matched-string, "comma");
71
76
 
72
- // Finally, return comma separated list of selectors
73
- @return $string-list;
74
- } @else {
77
+ // Finally, return comma separated list of selectors
78
+ @return $string-list;
79
+ } @else {
75
80
 
76
- // Else, just return the string as a single item list
77
- $string-list: append($string-list, $string);
81
+ // Else, just return the string as a single item list
82
+ $string-list: append($string-list, $string);
78
83
 
79
- @return $string-list;
84
+ @return $string-list;
85
+ }
86
+ } @else {
87
+ @return "You did not input a valid string: #{$string}";
80
88
  }
81
- } @else {
82
- @return "You did not input a valid string: #{$string}";
83
89
  }
84
90
  }
@@ -7,7 +7,7 @@
7
7
  // -------------------------------------------------------------------------------
8
8
  // @return [number]
9
9
 
10
- @function num-length($number, $unit) {
10
+ @function flint-num-length($number, $unit) {
11
11
  $strings: 'px' 'cm' 'mm' '%' 'ch' 'pica' 'in' 'em' 'rem' 'pt' 'pc' 'ex' 'vw' 'vh' 'vmin' 'vmax';
12
12
  $units: 1px 1cm 1mm 1% 1ch 1pica 1in 1em 1rem 1pt 1pc 1ex 1vw 1vh 1vmin 1vmax;
13
13
  $index: index($strings, $unit);
@@ -20,54 +20,58 @@
20
20
  @return $number * nth($units, $index);
21
21
  }
22
22
 
23
- // Converts number to string
23
+ // Converts string to number
24
24
  // -------------------------------------------------------------------------------
25
25
  // @documentation http://hugogiraudel.com/2014/01/15/sass-string-to-number/
26
26
  // -------------------------------------------------------------------------------
27
- // @dependence `num-length()`
27
+ // @param $string [string] : string
28
28
  // -------------------------------------------------------------------------------
29
- // @param $string [String] : string
30
- // -------------------------------------------------------------------------------
31
- // @return [Value]
29
+ // @return [number]
32
30
 
33
- @function to-number($string) {
34
- // Matrices
35
- $strings: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9';
36
- $numbers: 0 1 2 3 4 5 6 7 8 9;
31
+ @function flint-to-number($string) {
32
+ // Use Ruby function if available
33
+ @if $flint__use-ruby-functions {
34
+ @return string_to_number($string);
35
+ } @else {
36
+ // Matrices
37
+ $strings: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9';
38
+ $numbers: 0 1 2 3 4 5 6 7 8 9;
37
39
 
38
- // Result
39
- $result: 0;
40
- $divider: 0;
41
- $minus: false;
40
+ // Result
41
+ $result: 0;
42
+ $divider: 0;
43
+ $minus: false;
42
44
 
43
- // Looping through all characters
44
- @for $i from 1 through str-length($string) {
45
- $character: str-slice($string, $i, $i);
46
- $index: index($strings, $character);
45
+ // Looping through all characters
46
+ @for $i from 1 through str-length($string) {
47
+ $character: str-slice($string, $i, $i);
48
+ $index: index($strings, $character);
47
49
 
48
- @if $character == '-' {
49
- $minus: true;
50
- } @else if $character == '.' {
51
- $divider: 1;
52
- } @else {
50
+ @if $character == '-' {
51
+ $minus: true;
52
+ } @else if $character == '.' {
53
+ $divider: 1;
54
+ } @else {
53
55
 
54
- @if not $index {
55
- $result: if($minus, $result * -1, $result);
56
- @return num-length($result, str-slice($string, $i));
57
- }
56
+ @if not $index {
57
+ $result: if($minus, $result * -1, $result);
58
+ @return flint-num-length($result, str-slice($string, $i));
59
+ }
58
60
 
59
- $number: nth($numbers, $index);
61
+ $number: nth($numbers, $index);
60
62
 
61
- @if $divider == 0 {
62
- $result: $result * 10;
63
- } @else {
64
- // Move the decimal dot to the left
65
- $divider: $divider * 10;
66
- $number: $number / $divider;
63
+ @if $divider == 0 {
64
+ $result: $result * 10;
65
+ } @else {
66
+ // Move the decimal dot to the left
67
+ $divider: $divider * 10;
68
+ $number: $number / $divider;
69
+ }
70
+
71
+ $result: $result + $number;
67
72
  }
68
- $result: $result + $number;
69
73
  }
74
+
75
+ @return if($minus, $result * -1, $result);
70
76
  }
71
-
72
- @return if($minus, $result * -1, $result);
73
- }
77
+ }
@@ -4,12 +4,12 @@
4
4
  // -------------------------------------------------------------------------------
5
5
  // @return [list] : parsed list of selectors according to syntax
6
6
 
7
- @function support-syntax-bem($selectors) {
7
+ @function flint-support-syntax-bem($selectors) {
8
8
  // Clean up selector, remove double underscores for spaces
9
9
  // add psudeo character to differentiate selectors
10
- $selectors: replace-substring($selectors, "__", "/");
10
+ $selectors: flint-replace-substring($selectors, "__", "/");
11
11
  // Parse string to list
12
- $selectors: string-to-list($selectors, "/");
12
+ $selectors: flint-string-to-list($selectors, "/");
13
13
  // Define top-most parent of selector
14
14
  $parent: nth($selectors, 1);
15
15
  // Create new list of parsed selectors
@@ -5,23 +5,23 @@
5
5
  // -------------------------------------------------------------------------------
6
6
  // @return [list] : list of parsed selectors according to syntax
7
7
 
8
- @function support-syntax($syntax, $selectors) {
8
+ @function flint-support-syntax($syntax, $selectors) {
9
9
  $syntax: to-lower-case($syntax);
10
10
 
11
11
  // Make sure syntax is supported
12
12
  // ----
13
- @if function-exists(support-syntax-#{$syntax}) {
13
+ @if function-exists("flint-support-syntax-#{$syntax}") {
14
14
 
15
15
  // Support syntax
16
16
  // ----
17
17
  // @warning : be sure you have created a custom function to support an unknown syntax
18
18
  // ----
19
- @return call("support-syntax-#{$syntax}", $selectors);
19
+ @return call("flint-support-syntax-#{$syntax}", $selectors);
20
20
 
21
21
  } @else {
22
22
 
23
23
  // Throw error if the syntax does not exist and a function to call cannot be found
24
- @warn "You did not pass a valid syntax to `support-syntax`: #{$syntax}. Either specify a custom `support-syntax-<syntax>` function to call, or use one of the offically supported syntaxes. For more info, please visit the docs.";
24
+ @warn "You did not pass a valid syntax to `flint-support-syntax`: #{$syntax}. Either specify a custom `flint-support-syntax-<syntax>` function to call, or use one of the offically supported syntaxes. For more info, please visit the docs.";
25
25
  @return null;
26
26
 
27
27
  }
@@ -6,8 +6,8 @@
6
6
  // -------------------------------------------------------------------------------
7
7
  // @return [bool]
8
8
 
9
- @function types-in-list($list, $assert-types: null, $assert-length: null) {
10
- @if is-list($list) {
9
+ @function flint-types-in-list($list, $assert-types: null, $assert-length: null) {
10
+ @if flint-is-list($list) {
11
11
 
12
12
  // Assert types in list?
13
13
  // ----
@@ -26,7 +26,7 @@
26
26
 
27
27
  // List of asserted types?
28
28
  // ----
29
- @if is-list($assert-types) {
29
+ @if flint-is-list($assert-types) {
30
30
 
31
31
  // Make sure length of types match list
32
32
  // ----
@@ -1,12 +1,12 @@
1
- // Use global syntax set through `set-syntax` mixin
1
+ // Use global syntax
2
2
  // -------------------------------------------------------------------------------
3
3
  // @param $selectors [string] : string of selectors to transform
4
4
  // -------------------------------------------------------------------------------
5
5
  // @return [list] : list of transformed selectors according to syntax
6
6
 
7
- @function use-syntax($selectors) {
7
+ @function flint-use-syntax($selectors) {
8
8
  @if $flint__support-syntax {
9
- @return support-syntax($flint__support-syntax, $selectors);
9
+ @return flint-support-syntax($flint__support-syntax, $selectors);
10
10
  } @else {
11
11
  @warn "Support syntax is set to #{$flint__support-syntax}. Aborting mission.";
12
12
  @return false;
@@ -4,9 +4,9 @@ $flint__foundation: "nonexistant" !global;
4
4
 
5
5
  // Gather all keys, breakpoints and column counts
6
6
  // ----
7
- $flint__all__keys: get-all-keys() !global;
8
- $flint__all__breakpoints: get-all-breakpoints() !global;
9
- $flint__all__columns: get-all-columns() !global;
7
+ $flint__all__keys: flint-get-all-keys() !global;
8
+ $flint__all__breakpoints: flint-get-all-breakpoints() !global;
9
+ $flint__all__columns: flint-get-all-columns() !global;
10
10
 
11
11
  // Keep track of all instances of mixin
12
12
  // ----
@@ -19,4 +19,20 @@ $flint__base-font-size: 16px !global;
19
19
 
20
20
  // Global syntax support
21
21
  // ----
22
- $flint__support-syntax: if(exists($flint, "support-syntax"), get-value("settings", "support-syntax"), false) !global;
22
+ $flint__support-syntax: if(flint-exists($flint, "support-syntax"), flint-get-value("settings", "support-syntax"), false) !global;
23
+
24
+ // Use Ruby functions?
25
+ // ----
26
+ $flint__use-ruby-functions: if(flint-use-ruby-functions(), true, false) !global;
27
+
28
+ // Cached selector instance lists
29
+ // ----
30
+ $flint__cached-instances: () !global;
31
+
32
+ // Cached calculated values
33
+ // ----
34
+ $flint__cached-values: () !global;
35
+
36
+ // Chached calculation results
37
+ // ----
38
+ $flint__cache-results: () !global;
@@ -6,7 +6,7 @@
6
6
  // -------------------------------------------------------------------------------
7
7
  // @output outputs styles
8
8
 
9
- @mixin outputFlint ($width, $margin-right, $margin-left) {
9
+ @mixin flint-output($width, $margin-right, $margin-left) {
10
10
  width: $width;
11
11
  margin-right: $margin-right;
12
12
  margin-left: $margin-left;
@@ -15,752 +15,557 @@
15
15
 
16
16
  // Calculate widths, save all variables to instance
17
17
  // -------------------------------------------------------------------------------
18
- // @param $calcKey [string] : breakpoint key
19
- // @param $calcSpan [number] : span value
20
- // @param $calcContext [number] : context value
21
- // @param $calcGutter [number] : gutter value
22
- // @param $calcShift [number] : shift value
18
+ // @param $calc-key [string] : breakpoint key
19
+ // @param $calc-span [number] : span value
20
+ // @param $calc-context [number] : context value
21
+ // @param $calc-gutter [number] : gutter value
22
+ // @param $calc-shift [number] : shift value
23
23
  // @param $i [number] : index if variable length is > 1
24
24
  // -------------------------------------------------------------------------------
25
25
  // @output calculated styles
26
26
 
27
- @mixin calcFlint ($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $i: null) {
27
+ @mixin flint-calculate($calc-key, $calc-span, $calc-context, $calc-gutter, $calc-shift, $i: null) {
28
28
 
29
+ // Default values
30
+ $output-width: 0;
31
+ $output-margin-right: 0;
32
+ $output-margin-left: 0;
33
+
34
+ // Keep track of errors
35
+ $errors: false;
36
+
37
+ // Default value for cache search result
38
+ $cached: false;
39
+
40
+ // Check if any arguments are lists if called from loop
29
41
  @if $i != null {
30
42
 
31
- @if length($calcKey) > 1 {
32
- $calcKey: nth($calcKey, $i);
43
+ @if length($calc-key) > 1 {
44
+ $calc-key: nth($calc-key, $i);
33
45
  }
34
- @if length($calcSpan) > 1 {
35
- $calcSpan: nth($calcSpan, $i);
46
+ @if length($calc-span) > 1 {
47
+ $calc-span: nth($calc-span, $i);
36
48
  }
37
- @if length($calcContext) > 1 {
38
- $calcContext: nth($calcContext, $i);
49
+ @if length($calc-context) > 1 {
50
+ $calc-context: nth($calc-context, $i);
39
51
  }
40
- @if length($calcGutter) > 1 {
41
- $calcGutter: nth($calcGutter, $i);
52
+ @if length($calc-gutter) > 1 {
53
+ $calc-gutter: nth($calc-gutter, $i);
42
54
  }
43
- @if length($calcShift) > 1 {
44
- $calcShift: nth($calcShift, $i);
55
+ @if length($calc-shift) > 1 {
56
+ $calc-shift: nth($calc-shift, $i);
45
57
  }
46
58
 
47
59
  }
48
60
 
49
- // Hide if span is zero
50
- @if $calcSpan == 0 {
61
+ // Check for cached results
62
+ @if $calc-context != "auto" and $calc-span != 0 {
63
+ @if map-has-key($flint__cache-results, "#{$calc-key, $calc-span, $calc-context, $calc-gutter, $calc-shift, $i}") {
51
64
 
52
- $outputWidth: 0;
53
- $outputMarginRight: 0;
54
- $outputMarginLeft: 0;
65
+ // Get results
66
+ $output-width: nth(map-get($flint__cache-results, "#{$calc-key, $calc-span, $calc-context, $calc-gutter, $calc-shift, $i}"), 1);
67
+ $output-margin-right: nth(map-get($flint__cache-results, "#{$calc-key, $calc-span, $calc-context, $calc-gutter, $calc-shift, $i}"), 2);
68
+ $output-margin-left: nth(map-get($flint__cache-results, "#{$calc-key, $calc-span, $calc-context, $calc-gutter, $calc-shift, $i}"), 3);
69
+
70
+ // Declare successful search
71
+ $cached: true;
72
+ }
73
+ }
74
+
75
+ // Hide if span is zero
76
+ // ----
77
+ @if $calc-span == 0 {
55
78
 
56
79
  // First check if it's the default, so we don't hide the element on all breakpoints
57
- @if $calcKey == get-value("settings", "default") {
58
- @include _($calcKey) {
80
+ @if $calc-key == flint-get-value("settings", "default") {
81
+ @include _($calc-key) {
59
82
  display: none;
60
83
  }
61
84
  } @else {
62
85
  display: none;
63
86
  }
64
87
 
65
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
66
- @include debugPrintInstance($calcKey);
88
+ @include flint-new-instance($calc-key, $calc-span, $calc-context, $calc-gutter, $calc-shift, $output-width, $output-margin-right, $output-margin-left);
89
+ @include flint-debug-instance($calc-key);
67
90
 
68
91
  } @else {
69
92
 
70
- @if $calcShift != null and $calcContext == null {
93
+ // Only run through if cache search was unsuccessful
94
+ @if $cached == false {
71
95
 
72
- @if $calcGutter == null or $calcGutter == "normal" or $calcGutter == "default" or $calcGutter == "regular" and get-value("settings", "gutter") != false {
96
+ // Shift, no context
97
+ // ----
98
+ @if $calc-shift != null and $calc-context == null {
73
99
 
74
- // Save to variables for instance creation
75
- $outputWidth: (calc-width($calcKey, $calcSpan)) - ((calc-margin($calcKey, $calcSpan))*2);
76
- $outputMarginRight: calc-margin($calcKey, $calcSpan);
77
- $outputMarginLeft: ( if( $calcShift > 0,
78
- (calc-margin($calcKey, $calcSpan)) + (calc-width($calcKey, $calcShift)),
79
- (calc-margin($calcKey, -$calcSpan)) + (calc-width($calcKey, $calcShift))
80
- ));
100
+ @if $calc-gutter == null or $calc-gutter == "normal" or $calc-gutter == "default" or $calc-gutter == "regular" and flint-get-value("settings", "gutter") != false {
81
101
 
82
- // Output styles
83
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
84
- @content;
85
- }
102
+ // Save to variables for instance creation
103
+ $output-width: (flint-calc-width($calc-key, $calc-span)) - ((flint-calc-margin($calc-key, $calc-span))*2);
104
+ $output-margin-right: flint-calc-margin($calc-key, $calc-span);
105
+ $output-margin-left: ( if( $calc-shift > 0,
106
+ (flint-calc-margin($calc-key, $calc-span)) + (flint-calc-width($calc-key, $calc-shift)),
107
+ (flint-calc-margin($calc-key, -$calc-span)) + (flint-calc-width($calc-key, $calc-shift))
108
+ ));
86
109
 
87
- // Create new instance for memoization
88
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
110
+ } @else if $calc-gutter == "inside" and flint-get-value("settings", "gutter") != false {
89
111
 
90
- // If debug mode, print instance
91
- @include debugPrintInstance($calcKey);
112
+ $output-width: (flint-calc-width($calc-key, $calc-span)) - ((flint-calc-margin($calc-key, $calc-span))*4);
113
+ $output-margin-right: flint-calc-margin($calc-key, $calc-span);
114
+ $output-margin-left: ( if( $calc-shift > 0,
115
+ (flint-calc-margin($calc-key, $calc-span)) + (flint-calc-width($calc-key, $calc-shift)),
116
+ (flint-calc-margin($calc-key, -$calc-span)) + (flint-calc-width($calc-key, $calc-shift))
117
+ ));
92
118
 
93
- } @else if $calcGutter == "inside" and get-value("settings", "gutter") != false {
119
+ } @else if $calc-gutter == "alpha" or $calc-gutter == "no-left" or $calc-gutter == "first" and flint-get-value("settings", "gutter") != false {
94
120
 
95
- $outputWidth: (calc-width($calcKey, $calcSpan)) - ((calc-margin($calcKey, $calcSpan))*4);
96
- $outputMarginRight: calc-margin($calcKey, $calcSpan);
97
- $outputMarginLeft: ( if( $calcShift > 0,
98
- (calc-margin($calcKey, $calcSpan)) + (calc-width($calcKey, $calcShift)),
99
- (calc-margin($calcKey, -$calcSpan)) + (calc-width($calcKey, $calcShift))
100
- ));
121
+ $output-width: (flint-calc-width($calc-key, $calc-span)) - (flint-calc-margin($calc-key, $calc-span));
122
+ $output-margin-right: flint-calc-margin($calc-key, $calc-span);
123
+ $output-margin-left: ( if( $calc-shift > 0,
124
+ flint-calc-width($calc-key, $calc-shift),
125
+ flint-calc-width($calc-key, $calc-shift)
126
+ ));
101
127
 
102
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
103
- @content;
104
- }
128
+ } @else if $calc-gutter == "omega" or $calc-gutter == "no-right" or $calc-gutter == "flint-last" and flint-get-value("settings", "gutter") != false {
105
129
 
106
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
107
- @include debugPrintInstance($calcKey);
130
+ $output-width: (flint-calc-width($calc-key, $calc-span)) - ((flint-calc-margin($calc-key, $calc-span)));
131
+ $output-margin-right: 0;
132
+ $output-margin-left: ( if( $calc-shift > 0,
133
+ (flint-calc-margin($calc-key, $calc-span)) + (flint-calc-width($calc-key, $calc-shift)),
134
+ (flint-calc-margin($calc-key, -$calc-span)) + (flint-calc-width($calc-key, $calc-shift))
135
+ ));
108
136
 
109
- } @else if $calcGutter == "alpha" or $calcGutter == "no-left" or $calcGutter == "first" and get-value("settings", "gutter") != false {
137
+ } @else if $calc-gutter == "row" or $calc-gutter == "none" or flint-get-value("settings", "gutter") == false {
110
138
 
111
- $outputWidth: (calc-width($calcKey, $calcSpan)) - (calc-margin($calcKey, $calcSpan));
112
- $outputMarginRight: calc-margin($calcKey, $calcSpan);
113
- $outputMarginLeft: ( if( $calcShift > 0,
114
- calc-width($calcKey, $calcShift),
115
- calc-width($calcKey, $calcShift)
116
- ));
139
+ $output-width: (flint-calc-width($calc-key, $calc-span));
140
+ $output-margin-right: 0;
141
+ $output-margin-left: ( if( $calc-shift > 0,
142
+ flint-calc-width($calc-key, $calc-shift),
143
+ flint-calc-width($calc-key, $calc-shift)
144
+ ));
117
145
 
118
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
119
- @content;
120
146
  }
121
147
 
122
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
123
- @include debugPrintInstance($calcKey);
148
+ // Shift, context
149
+ // ----
150
+ } @else if $calc-context != null {
124
151
 
125
- } @else if $calcGutter == "omega" or $calcGutter == "no-right" or $calcGutter == "last" and get-value("settings", "gutter") != false {
152
+ // Check if parent instance flint-exists
153
+ $flint-exists: flint-has-family-instance($calc-key);
126
154
 
127
- $outputWidth: (calc-width($calcKey, $calcSpan)) - ((calc-margin($calcKey, $calcSpan)));
128
- $outputMarginRight: 0;
129
- $outputMarginLeft: ( if( $calcShift > 0,
130
- (calc-margin($calcKey, $calcSpan)) + (calc-width($calcKey, $calcShift)),
131
- (calc-margin($calcKey, -$calcSpan)) + (calc-width($calcKey, $calcShift))
132
- ));
155
+ @if $calc-shift != null {
133
156
 
134
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
135
- @content;
136
- }
157
+ @if $calc-gutter == null or $calc-gutter == "normal" or $calc-gutter == "default" or $calc-gutter == "regular" and flint-get-value("settings", "gutter") != false {
137
158
 
138
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
139
- @include debugPrintInstance($calcKey);
159
+ // Check if context is set to auto
160
+ @if $calc-context == "auto" {
140
161
 
141
- } @else if $calcGutter == "row" or $calcGutter == "none" or get-value("settings", "gutter") == false {
162
+ // Does parent exist?
163
+ @if $flint-exists != false {
164
+ @if flint-get-value("settings", "grid") == "fluid" {
142
165
 
143
- $outputWidth: (calc-width($calcKey, $calcSpan));
144
- $outputMarginRight: 0;
145
- $outputMarginLeft: ( if( $calcShift > 0,
146
- calc-width($calcKey, $calcShift),
147
- calc-width($calcKey, $calcShift)
148
- ));
166
+ // Get parent span value
167
+ $output-width: (flint-calc-width($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")))) - ((flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span"))))*2);
168
+ $output-margin-right: flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")));
169
+ $output-margin-left: ( if( $calc-shift > 0,
170
+ (flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")))) + (flint-calc-width($calc-key, $calc-shift, flint-to-number(flint-get-instance-value($calc-key, "span")))),
171
+ (flint-calc-margin($calc-key, -$calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")))) + (flint-calc-width($calc-key, $calc-shift, flint-to-number(flint-get-instance-value($calc-key, "span"))))
172
+ ));
149
173
 
150
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
151
- @content;
152
- }
174
+ } @else if flint-get-value("settings", "grid") == "fixed" {
153
175
 
154
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
155
- @include debugPrintInstance($calcKey);
156
- }
176
+ // Get parent width instead of parent span for fixed grids
177
+ $output-width: (flint-to-number(flint-get-instance-value($calc-key, "output", "width")) / flint-to-number(flint-get-instance-value($calc-key, "span")) * $calc-span) - ((flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span"))))*2);
178
+ $output-margin-right: flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")));
179
+ $output-margin-left: ( if( $calc-shift > 0,
180
+ (flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")))) + (flint-calc-width($calc-key, $calc-shift, flint-to-number(flint-get-instance-value($calc-key, "span")))),
181
+ (flint-calc-margin($calc-key, -$calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")))) + (flint-calc-width($calc-key, $calc-shift, flint-to-number(flint-get-instance-value($calc-key, "span"))))
182
+ ));
157
183
 
158
- } @else if $calcContext != null {
159
- // Check if parent instance exists
160
- $exists: get-family-instance($calcKey);
161
-
162
- @if $calcShift != null {
163
- @if $calcGutter == null or $calcGutter == "normal" or $calcGutter == "default" or $calcGutter == "regular" and get-value("settings", "gutter") != false {
164
- // Check if context is set to auto
165
- @if $calcContext == "auto" {
166
- // Does parent exist?
167
- @if $exists != false {
168
- @if get-value("settings", "grid") == "fluid" {
169
-
170
- $outputWidth: (calc-width($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")))) - ((calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span"))))*2);
171
- $outputMarginRight: calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")));
172
- $outputMarginLeft: ( if( $calcShift > 0,
173
- (calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")))) + (calc-width($calcKey, $calcShift, to-number(get-instance-value($calcKey, "span")))),
174
- (calc-margin($calcKey, -$calcSpan, to-number(get-instance-value($calcKey, "span")))) + (calc-width($calcKey, $calcShift, to-number(get-instance-value($calcKey, "span"))))
175
- ));
176
-
177
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
178
- @content;
179
184
  }
180
-
181
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
182
- @include debugPrintInstance($calcKey);
183
-
184
- } @else if get-value("settings", "grid") == "fixed" {
185
- // Get parent width instead of parent span for fixed grids
186
- $outputWidth: (to-number(get-instance-value($calcKey, "output", "width")) / to-number(get-instance-value($calcKey, "span")) * $calcSpan) - ((calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span"))))*2);
187
- $outputMarginRight: calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")));
188
- $outputMarginLeft: ( if( $calcShift > 0,
189
- (calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")))) + (calc-width($calcKey, $calcShift, to-number(get-instance-value($calcKey, "span")))),
190
- (calc-margin($calcKey, -$calcSpan, to-number(get-instance-value($calcKey, "span")))) + (calc-width($calcKey, $calcShift, to-number(get-instance-value($calcKey, "span"))))
191
- ));
192
-
193
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
194
- @content;
195
- }
196
-
197
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
198
- @include debugPrintInstance($calcKey);
199
-
185
+ } @else {
186
+ // Else warn that context should not be set to `auto`
187
+ @warn "You set context to `#{$calc-context}`, but a parent instance could not be found for `#{selector_string()}`";
188
+ // Throw error
189
+ $errors: true;
200
190
  }
201
- } @else {
202
- // Else warn that context should not be set to `auto`
203
- @warn "You set context to `#{$calcContext}`, but a parent instance could not be found for `#{selector_string()}`";
204
- }
205
- // Output styles normally if not set to auto
206
- } @else {
207
-
208
- $outputWidth: (calc-width($calcKey, $calcSpan, $calcContext)) - ((calc-margin($calcKey, $calcSpan, $calcContext))*2);
209
- $outputMarginRight: calc-margin($calcKey, $calcSpan, $calcContext);
210
- $outputMarginLeft: ( if( $calcShift > 0,
211
- (calc-margin($calcKey, $calcSpan, $calcContext)) + (calc-width($calcKey, $calcShift, $calcContext)),
212
- (calc-margin($calcKey, -$calcSpan, $calcContext)) + (calc-width($calcKey, $calcShift, $calcContext))
213
- ));
214
-
215
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
216
- @content;
217
- }
218
191
 
219
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
220
- @include debugPrintInstance($calcKey);
221
- }
192
+ // Output styles normally if not set to auto
193
+ } @else {
222
194
 
223
- } @else if $calcGutter == "inside" and get-value("settings", "gutter") != false {
195
+ $output-width: (flint-calc-width($calc-key, $calc-span, $calc-context)) - ((flint-calc-margin($calc-key, $calc-span, $calc-context))*2);
196
+ $output-margin-right: flint-calc-margin($calc-key, $calc-span, $calc-context);
197
+ $output-margin-left: ( if( $calc-shift > 0,
198
+ (flint-calc-margin($calc-key, $calc-span, $calc-context)) + (flint-calc-width($calc-key, $calc-shift, $calc-context)),
199
+ (flint-calc-margin($calc-key, -$calc-span, $calc-context)) + (flint-calc-width($calc-key, $calc-shift, $calc-context))
200
+ ));
224
201
 
225
- @if $calcContext == "auto" {
226
- @if $exists != false {
227
- @if get-value("settings", "grid") == "fluid" {
202
+ }
228
203
 
229
- $outputWidth: (calc-width($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")))) - ((calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span"))))*4);
230
- $outputMarginRight: calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")));
231
- $outputMarginLeft: ( if( $calcShift > 0,
232
- (calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")))) + (calc-width($calcKey, $calcShift, to-number(get-instance-value($calcKey, "span")))),
233
- (calc-margin($calcKey, -$calcSpan, to-number(get-instance-value($calcKey, "span")))) + (calc-width($calcKey, $calcShift, to-number(get-instance-value($calcKey, "span"))))
234
- ));
204
+ } @else if $calc-gutter == "inside" and flint-get-value("settings", "gutter") != false {
235
205
 
236
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
237
- @content;
238
- }
206
+ @if $calc-context == "auto" {
207
+ @if $flint-exists != false {
208
+ @if flint-get-value("settings", "grid") == "fluid" {
239
209
 
240
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
241
- @include debugPrintInstance($calcKey);
210
+ $output-width: (flint-calc-width($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")))) - ((flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span"))))*4);
211
+ $output-margin-right: flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")));
212
+ $output-margin-left: ( if( $calc-shift > 0,
213
+ (flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")))) + (flint-calc-width($calc-key, $calc-shift, flint-to-number(flint-get-instance-value($calc-key, "span")))),
214
+ (flint-calc-margin($calc-key, -$calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")))) + (flint-calc-width($calc-key, $calc-shift, flint-to-number(flint-get-instance-value($calc-key, "span"))))
215
+ ));
242
216
 
243
- } @else if get-value("settings", "grid") == "fixed" {
217
+ } @else if flint-get-value("settings", "grid") == "fixed" {
244
218
 
245
- $outputWidth: (to-number(get-instance-value($calcKey, "output", "width")) / to-number(get-instance-value($calcKey, "span")) * $calcSpan) - ((calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span"))))*4);
246
- $outputMarginRight: calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")));
247
- $outputMarginLeft: ( if( $calcShift > 0,
248
- (calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")))) + (calc-width($calcKey, $calcShift, to-number(get-instance-value($calcKey, "span")))),
249
- (calc-margin($calcKey, -$calcSpan, to-number(get-instance-value($calcKey, "span")))) + (calc-width($calcKey, $calcShift, to-number(get-instance-value($calcKey, "span"))))
250
- ));
219
+ $output-width: (flint-to-number(flint-get-instance-value($calc-key, "output", "width")) / flint-to-number(flint-get-instance-value($calc-key, "span")) * $calc-span) - ((flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span"))))*4);
220
+ $output-margin-right: flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")));
221
+ $output-margin-left: ( if( $calc-shift > 0,
222
+ (flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")))) + (flint-calc-width($calc-key, $calc-shift, flint-to-number(flint-get-instance-value($calc-key, "span")))),
223
+ (flint-calc-margin($calc-key, -$calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")))) + (flint-calc-width($calc-key, $calc-shift, flint-to-number(flint-get-instance-value($calc-key, "span"))))
224
+ ));
251
225
 
252
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
253
- @content;
254
226
  }
255
-
256
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
257
- @include debugPrintInstance($calcKey);
258
-
227
+ } @else {
228
+ // Else warn that context should not be set to `auto`
229
+ @warn "You set context to `#{$calc-context}`, but a parent instance could not be found for `#{selector_string()}`";
230
+ $errors: true;
259
231
  }
232
+ // Output styles normally if not set to auto
260
233
  } @else {
261
- // Else warn that context should not be set to `auto`
262
- @warn "You set context to `#{$calcContext}`, but a parent instance could not be found for `#{selector_string()}`";
263
- }
264
- // Output styles normally if not set to auto
265
- } @else {
266
234
 
267
- $outputWidth: (calc-width($calcKey, $calcSpan, $calcContext)) - ((calc-margin($calcKey, $calcSpan, $calcContext))*2);
268
- $outputMarginRight: calc-margin($calcKey, $calcSpan, $calcContext);
269
- $outputMarginLeft: ( if( $calcShift > 0,
270
- (calc-margin($calcKey, $calcSpan, $calcContext)) + (calc-width($calcKey, $calcShift, $calcContext)),
271
- (calc-margin($calcKey, -$calcSpan, $calcContext)) + (calc-width($calcKey, $calcShift, $calcContext))
272
- ));
235
+ $output-width: (flint-calc-width($calc-key, $calc-span, $calc-context)) - ((flint-calc-margin($calc-key, $calc-span, $calc-context))*2);
236
+ $output-margin-right: flint-calc-margin($calc-key, $calc-span, $calc-context);
237
+ $output-margin-left: ( if( $calc-shift > 0,
238
+ (flint-calc-margin($calc-key, $calc-span, $calc-context)) + (flint-calc-width($calc-key, $calc-shift, $calc-context)),
239
+ (flint-calc-margin($calc-key, -$calc-span, $calc-context)) + (flint-calc-width($calc-key, $calc-shift, $calc-context))
240
+ ));
273
241
 
274
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
275
- @content;
276
242
  }
277
243
 
278
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
279
- @include debugPrintInstance($calcKey);
280
- }
281
-
282
- } @else if $calcGutter == "alpha" or $calcGutter == "no-left" or $calcGutter == "first" and get-value("settings", "gutter") != false {
283
-
284
- @if $calcContext == "auto" {
285
- @if $exists != false {
286
- @if get-value("settings", "grid") == "fluid" {
287
-
288
- $outputWidth: (calc-width($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")))) - (calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span"))));
289
- $outputMarginRight: calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")));
290
- $outputMarginLeft: ( if( $calcShift > 0,
291
- calc-width($calcKey, $calcShift, to-number(get-instance-value($calcKey, "span"))),
292
- calc-width($calcKey, $calcShift, to-number(get-instance-value($calcKey, "span")))
293
- ));
244
+ } @else if $calc-gutter == "alpha" or $calc-gutter == "no-left" or $calc-gutter == "first" and flint-get-value("settings", "gutter") != false {
294
245
 
295
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
296
- @content;
297
- }
246
+ @if $calc-context == "auto" {
247
+ @if $flint-exists != false {
248
+ @if flint-get-value("settings", "grid") == "fluid" {
298
249
 
299
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
300
- @include debugPrintInstance($calcKey);
250
+ $output-width: (flint-calc-width($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")))) - (flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span"))));
251
+ $output-margin-right: flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")));
252
+ $output-margin-left: ( if( $calc-shift > 0,
253
+ flint-calc-width($calc-key, $calc-shift, flint-to-number(flint-get-instance-value($calc-key, "span"))),
254
+ flint-calc-width($calc-key, $calc-shift, flint-to-number(flint-get-instance-value($calc-key, "span")))
255
+ ));
301
256
 
302
- } @else if get-value("settings", "grid") == "fixed" {
257
+ } @else if flint-get-value("settings", "grid") == "fixed" {
303
258
 
304
- $outputWidth: (to-number(get-instance-value($calcKey, "output", "width")) / to-number(get-instance-value($calcKey, "span")) * $calcSpan) - ((calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")))));
305
- $outputMarginRight: calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")));
306
- $outputMarginLeft: ( if( $calcShift > 0,
307
- calc-width($calcKey, $calcShift, to-number(get-instance-value($calcKey, "span"))),
308
- calc-width($calcKey, $calcShift, to-number(get-instance-value($calcKey, "span")))
309
- ));
259
+ $output-width: (flint-to-number(flint-get-instance-value($calc-key, "output", "width")) / flint-to-number(flint-get-instance-value($calc-key, "span")) * $calc-span) - ((flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")))));
260
+ $output-margin-right: flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")));
261
+ $output-margin-left: ( if( $calc-shift > 0,
262
+ flint-calc-width($calc-key, $calc-shift, flint-to-number(flint-get-instance-value($calc-key, "span"))),
263
+ flint-calc-width($calc-key, $calc-shift, flint-to-number(flint-get-instance-value($calc-key, "span")))
264
+ ));
310
265
 
311
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
312
- @content;
313
266
  }
314
-
315
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
316
- @include debugPrintInstance($calcKey);
317
-
267
+ } @else {
268
+ @warn "You set context to `#{$calc-context}`, but a parent instance could not be found for `#{selector_string()}`";
269
+ $errors: true;
318
270
  }
319
271
  } @else {
320
- @warn "You set context to `#{$calcContext}`, but a parent instance could not be found for `#{selector_string()}`";
321
- }
322
- } @else {
323
272
 
324
- $outputWidth: (calc-width($calcKey, $calcSpan, $calcContext)) - (calc-margin($calcKey, $calcSpan, $calcContext));
325
- $outputMarginRight: calc-margin($calcKey, $calcSpan, $calcContext);
326
- $outputMarginLeft: ( if( $calcShift > 0,
327
- calc-width($calcKey, $calcShift, $calcContext),
328
- calc-width($calcKey, $calcShift, $calcContext)
329
- ));
273
+ $output-width: (flint-calc-width($calc-key, $calc-span, $calc-context)) - (flint-calc-margin($calc-key, $calc-span, $calc-context));
274
+ $output-margin-right: flint-calc-margin($calc-key, $calc-span, $calc-context);
275
+ $output-margin-left: ( if( $calc-shift > 0,
276
+ flint-calc-width($calc-key, $calc-shift, $calc-context),
277
+ flint-calc-width($calc-key, $calc-shift, $calc-context)
278
+ ));
330
279
 
331
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
332
- @content;
333
280
  }
334
281
 
335
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
336
- @include debugPrintInstance($calcKey);
337
- }
338
-
339
- } @else if $calcGutter == "omega" or $calcGutter == "no-right" or $calcGutter == "last" and get-value("settings", "gutter") != false {
340
-
341
- @if $calcContext == "auto" {
342
- @if $exists != false {
343
- @if get-value("settings", "grid") == "fluid" {
282
+ } @else if $calc-gutter == "omega" or $calc-gutter == "no-right" or $calc-gutter == "flint-last" and flint-get-value("settings", "gutter") != false {
344
283
 
345
- $outputWidth: (calc-width($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")))) - ((calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")))));
346
- $outputMarginRight: 0;
347
- $outputMarginLeft: ( if( $calcShift > 0,
348
- (calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")))) + (calc-width($calcKey, $calcShift, to-number(get-instance-value($calcKey, "span")))),
349
- (calc-margin($calcKey, -$calcSpan, to-number(get-instance-value($calcKey, "span")))) + (calc-width($calcKey, $calcShift, to-number(get-instance-value($calcKey, "span"))))
350
- ));
284
+ @if $calc-context == "auto" {
285
+ @if $flint-exists != false {
286
+ @if flint-get-value("settings", "grid") == "fluid" {
351
287
 
352
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
353
- @content;
354
- }
355
-
356
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
357
- @include debugPrintInstance($calcKey);
288
+ $output-width: (flint-calc-width($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")))) - ((flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")))));
289
+ $output-margin-right: 0;
290
+ $output-margin-left: ( if( $calc-shift > 0,
291
+ (flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")))) + (flint-calc-width($calc-key, $calc-shift, flint-to-number(flint-get-instance-value($calc-key, "span")))),
292
+ (flint-calc-margin($calc-key, -$calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")))) + (flint-calc-width($calc-key, $calc-shift, flint-to-number(flint-get-instance-value($calc-key, "span"))))
293
+ ));
358
294
 
359
- } @else if get-value("settings", "grid") == "fixed" {
295
+ } @else if flint-get-value("settings", "grid") == "fixed" {
360
296
 
361
- $outputWidth: (to-number(get-instance-value($calcKey, "output", "width")) / to-number(get-instance-value($calcKey, "span")) * $calcSpan) - ((calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")))));
362
- $outputMarginRight: 0;
363
- $outputMarginLeft: ( if( $calcShift > 0,
364
- (calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")))) + (calc-width($calcKey, $calcShift, to-number(get-instance-value($calcKey, "span")))),
365
- (calc-margin($calcKey, -$calcSpan, to-number(get-instance-value($calcKey, "span")))) + (calc-width($calcKey, $calcShift, to-number(get-instance-value($calcKey, "span"))))
366
- ));
297
+ $output-width: (flint-to-number(flint-get-instance-value($calc-key, "output", "width")) / flint-to-number(flint-get-instance-value($calc-key, "span")) * $calc-span) - ((flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")))));
298
+ $output-margin-right: 0;
299
+ $output-margin-left: ( if( $calc-shift > 0,
300
+ (flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")))) + (flint-calc-width($calc-key, $calc-shift, flint-to-number(flint-get-instance-value($calc-key, "span")))),
301
+ (flint-calc-margin($calc-key, -$calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")))) + (flint-calc-width($calc-key, $calc-shift, flint-to-number(flint-get-instance-value($calc-key, "span"))))
302
+ ));
367
303
 
368
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
369
- @content;
370
304
  }
371
-
372
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
373
- @include debugPrintInstance($calcKey);
374
-
305
+ } @else {
306
+ @warn "You set context to `#{$calc-context}`, but a parent instance could not be found for `#{selector_string()}`";
307
+ $errors: true;
375
308
  }
376
309
  } @else {
377
- @warn "You set context to `#{$calcContext}`, but a parent instance could not be found for `#{selector_string()}`";
378
- }
379
- } @else {
380
310
 
381
- $outputWidth: (calc-width($calcKey, $calcSpan, $calcContext)) - ((calc-margin($calcKey, $calcSpan, $calcContext)));
382
- $outputMarginRight: 0;
383
- $outputMarginLeft: ( if( $calcShift > 0,
384
- (calc-margin($calcKey, $calcSpan, $calcContext)) + (calc-width($calcKey, $calcShift, $calcContext)),
385
- (calc-margin($calcKey, -$calcSpan, $calcContext)) + (calc-width($calcKey, $calcShift, $calcContext))
386
- ));
311
+ $output-width: (flint-calc-width($calc-key, $calc-span, $calc-context)) - ((flint-calc-margin($calc-key, $calc-span, $calc-context)));
312
+ $output-margin-right: 0;
313
+ $output-margin-left: ( if( $calc-shift > 0,
314
+ (flint-calc-margin($calc-key, $calc-span, $calc-context)) + (flint-calc-width($calc-key, $calc-shift, $calc-context)),
315
+ (flint-calc-margin($calc-key, -$calc-span, $calc-context)) + (flint-calc-width($calc-key, $calc-shift, $calc-context))
316
+ ));
387
317
 
388
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
389
- @content;
390
318
  }
391
319
 
392
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
393
- @include debugPrintInstance($calcKey);
394
- }
395
-
396
- } @else if $calcGutter == "row" or $calcGutter == "none" or get-value("settings", "gutter") == false {
320
+ } @else if $calc-gutter == "row" or $calc-gutter == "none" or flint-get-value("settings", "gutter") == false {
397
321
 
398
- @if $calcContext == "auto" {
399
- @if $exists != false {
400
- @if get-value("settings", "grid") == "fluid" {
322
+ @if $calc-context == "auto" {
323
+ @if $flint-exists != false {
324
+ @if flint-get-value("settings", "grid") == "fluid" {
401
325
 
402
- $outputWidth: (calc-width($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span"))));
403
- $outputMarginRight: 0;
404
- $outputMarginLeft: ( if( $calcShift > 0,
405
- calc-width($calcKey, $calcShift, to-number(get-instance-value($calcKey, "span"))),
406
- calc-width($calcKey, $calcShift, to-number(get-instance-value($calcKey, "span")))
407
- ));
326
+ $output-width: (flint-calc-width($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span"))));
327
+ $output-margin-right: 0;
328
+ $output-margin-left: ( if( $calc-shift > 0,
329
+ flint-calc-width($calc-key, $calc-shift, flint-to-number(flint-get-instance-value($calc-key, "span"))),
330
+ flint-calc-width($calc-key, $calc-shift, flint-to-number(flint-get-instance-value($calc-key, "span")))
331
+ ));
408
332
 
409
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
410
- @content;
411
- }
412
-
413
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
414
- @include debugPrintInstance($calcKey);
333
+ } @else if flint-get-value("settings", "grid") == "fixed" {
415
334
 
416
- } @else if get-value("settings", "grid") == "fixed" {
335
+ $output-width: (flint-to-number(flint-get-instance-value($calc-key, "output", "width")) / flint-to-number(flint-get-instance-value($calc-key, "span")) * $calc-span);
336
+ $output-margin-right: 0;
337
+ $output-margin-left: ( if( $calc-shift > 0,
338
+ flint-calc-width($calc-key, $calc-shift, flint-to-number(flint-get-instance-value($calc-key, "span"))),
339
+ flint-calc-width($calc-key, $calc-shift, flint-to-number(flint-get-instance-value($calc-key, "span")))
340
+ ));
417
341
 
418
- $outputWidth: (to-number(get-instance-value($calcKey, "output", "width")) / to-number(get-instance-value($calcKey, "span")) * $calcSpan);
419
- $outputMarginRight: 0;
420
- $outputMarginLeft: ( if( $calcShift > 0,
421
- calc-width($calcKey, $calcShift, to-number(get-instance-value($calcKey, "span"))),
422
- calc-width($calcKey, $calcShift, to-number(get-instance-value($calcKey, "span")))
423
- ));
424
-
425
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
426
- @content;
427
342
  }
428
-
429
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
430
- @include debugPrintInstance($calcKey);
431
-
343
+ } @else {
344
+ @warn "You set context to `#{$calc-context}`, but a parent instance could not be found for `#{selector_string()}`";
345
+ $errors: true;
432
346
  }
433
347
  } @else {
434
- @warn "You set context to `#{$calcContext}`, but a parent instance could not be found for `#{selector_string()}`";
435
- }
436
- } @else {
437
-
438
- $outputWidth: (calc-width($calcKey, $calcSpan, $calcContext));
439
- $outputMarginRight: 0;
440
- $outputMarginLeft: ( if( $calcShift > 0,
441
- calc-width($calcKey, $calcShift, $calcContext),
442
- calc-width($calcKey, $calcShift, $calcContext)
443
- ));
444
348
 
445
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
446
- @content;
349
+ $output-width: (flint-calc-width($calc-key, $calc-span, $calc-context));
350
+ $output-margin-right: 0;
351
+ $output-margin-left: ( if( $calc-shift > 0,
352
+ flint-calc-width($calc-key, $calc-shift, $calc-context),
353
+ flint-calc-width($calc-key, $calc-shift, $calc-context)
354
+ ));
447
355
  }
448
-
449
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
450
- @include debugPrintInstance($calcKey);
451
356
  }
452
- }
453
- } @else {
454
- @if $calcGutter == null or $calcGutter == "normal" or $calcGutter == "default" or $calcGutter == "regular" and get-value("settings", "gutter") != false {
455
- @if $calcContext == "auto" {
456
- @if $exists != false {
457
- @if get-value("settings", "grid") == "fluid" {
458
357
 
459
- $outputWidth: (calc-width($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")))) - ((calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span"))))*2);
460
- $outputMarginRight: calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")));
461
- $outputMarginLeft: calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")));
358
+ // Context, no shift
359
+ // ----
360
+ } @else {
462
361
 
463
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
464
- @content;
465
- }
362
+ @if $calc-gutter == null or $calc-gutter == "normal" or $calc-gutter == "default" or $calc-gutter == "regular" and flint-get-value("settings", "gutter") != false {
363
+ @if $calc-context == "auto" {
364
+ @if $flint-exists != false {
365
+ @if flint-get-value("settings", "grid") == "fluid" {
466
366
 
467
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
468
- @include debugPrintInstance($calcKey);
367
+ $output-width: (flint-calc-width($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")))) - ((flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span"))))*2);
368
+ $output-margin-right: flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")));
369
+ $output-margin-left: flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")));
469
370
 
470
- } @else if get-value("settings", "grid") == "fixed" {
371
+ } @else if flint-get-value("settings", "grid") == "fixed" {
471
372
 
472
- $outputWidth: (to-number(get-instance-value($calcKey, "output", "width")) / to-number(get-instance-value($calcKey, "span")) * $calcSpan) - ((calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span"))))*2);
473
- $outputMarginRight: calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")));
474
- $outputMarginLeft: calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")));
373
+ $output-width: (flint-to-number(flint-get-instance-value($calc-key, "output", "width")) / flint-to-number(flint-get-instance-value($calc-key, "span")) * $calc-span) - ((flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span"))))*2);
374
+ $output-margin-right: flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")));
375
+ $output-margin-left: flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")));
475
376
 
476
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
477
- @content;
478
377
  }
479
-
480
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
481
- @include debugPrintInstance($calcKey);
482
-
378
+ } @else {
379
+ @warn "You set context to `#{$calc-context}`, but a parent instance could not be found for `#{selector_string()}`";
380
+ $errors: true;
483
381
  }
484
382
  } @else {
485
- @warn "You set context to `#{$calcContext}`, but a parent instance could not be found for `#{selector_string()}`";
486
- }
487
- } @else {
488
383
 
489
- $outputWidth: (calc-width($calcKey, $calcSpan, $calcContext)) - ((calc-margin($calcKey, $calcSpan, $calcContext))*2);
490
- $outputMarginRight: calc-margin($calcKey, $calcSpan, $calcContext);
491
- $outputMarginLeft: calc-margin($calcKey, $calcSpan, $calcContext);
384
+ $output-width: (flint-calc-width($calc-key, $calc-span, $calc-context)) - ((flint-calc-margin($calc-key, $calc-span, $calc-context))*2);
385
+ $output-margin-right: flint-calc-margin($calc-key, $calc-span, $calc-context);
386
+ $output-margin-left: flint-calc-margin($calc-key, $calc-span, $calc-context);
492
387
 
493
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
494
- @content;
495
388
  }
496
389
 
497
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
498
- @include debugPrintInstance($calcKey);
499
- }
390
+ } @else if $calc-gutter == "inside" and flint-get-value("settings", "gutter") != false {
500
391
 
501
- } @else if $calcGutter == "inside" and get-value("settings", "gutter") != false {
392
+ @if $calc-context == "auto" {
393
+ @if $flint-exists != false {
394
+ @if flint-get-value("settings", "grid") == "fluid" {
502
395
 
503
- @if $calcContext == "auto" {
504
- @if $exists != false {
505
- @if get-value("settings", "grid") == "fluid" {
396
+ $output-width: (flint-calc-width($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")))) - ((flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span"))))*4);
397
+ $output-margin-right: flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")));
398
+ $output-margin-left: flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")));
506
399
 
507
- $outputWidth: (calc-width($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")))) - ((calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span"))))*4);
508
- $outputMarginRight: calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")));
509
- $outputMarginLeft: calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")));
400
+ } @else if flint-get-value("settings", "grid") == "fixed" {
510
401
 
511
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
512
- @content;
513
- }
514
-
515
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
516
- @include debugPrintInstance($calcKey);
517
-
518
- } @else if get-value("settings", "grid") == "fixed" {
519
-
520
- $outputWidth: (to-number(get-instance-value($calcKey, "output", "width")) / to-number(get-instance-value($calcKey, "span")) * $calcSpan) - ((calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span"))))*4);
521
- $outputMarginRight: calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")));
522
- $outputMarginLeft: calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")));
402
+ $output-width: (flint-to-number(flint-get-instance-value($calc-key, "output", "width")) / flint-to-number(flint-get-instance-value($calc-key, "span")) * $calc-span) - ((flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span"))))*4);
403
+ $output-margin-right: flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")));
404
+ $output-margin-left: flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")));
523
405
 
524
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
525
- @content;
526
406
  }
527
407
 
528
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
529
- @include debugPrintInstance($calcKey);
530
-
408
+ } @else {
409
+ @warn "You set context to `#{$calc-context}`, but a parent instance could not be found for `#{selector_string()}`";
410
+ $errors: true;
531
411
  }
532
-
533
412
  } @else {
534
- @warn "You set context to `#{$calcContext}`, but a parent instance could not be found for `#{selector_string()}`";
535
- }
536
- } @else {
537
413
 
538
- $outputWidth: (calc-width($calcKey, $calcSpan, $calcContext)) - ((calc-margin($calcKey, $calcSpan, $calcContext))*2);
539
- $outputMarginRight: calc-margin($calcKey, $calcSpan, $calcContext);
540
- $outputMarginLeft: calc-margin($calcKey, $calcSpan, $calcContext);
414
+ $output-width: (flint-calc-width($calc-key, $calc-span, $calc-context)) - ((flint-calc-margin($calc-key, $calc-span, $calc-context))*2);
415
+ $output-margin-right: flint-calc-margin($calc-key, $calc-span, $calc-context);
416
+ $output-margin-left: flint-calc-margin($calc-key, $calc-span, $calc-context);
541
417
 
542
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
543
- @content;
544
418
  }
545
419
 
546
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
547
- @include debugPrintInstance($calcKey);
548
- }
549
-
550
- } @else if $calcGutter == "alpha" or $calcGutter == "no-left" or $calcGutter == "first" and get-value("settings", "gutter") != false {
420
+ } @else if $calc-gutter == "alpha" or $calc-gutter == "no-left" or $calc-gutter == "first" and flint-get-value("settings", "gutter") != false {
551
421
 
552
- @if $calcContext == "auto" {
553
- @if $exists != false {
554
- @if get-value("settings", "grid") == "fluid" {
422
+ @if $calc-context == "auto" {
423
+ @if $flint-exists != false {
424
+ @if flint-get-value("settings", "grid") == "fluid" {
555
425
 
556
- $outputWidth: (calc-width($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")))) - (calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span"))));
557
- $outputMarginRight: calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")));
558
- $outputMarginLeft: 0;
559
-
560
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
561
- @content;
562
- }
426
+ $output-width: (flint-calc-width($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")))) - (flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span"))));
427
+ $output-margin-right: flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")));
428
+ $output-margin-left: 0;
563
429
 
564
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
565
- @include debugPrintInstance($calcKey);
430
+ } @else if flint-get-value("settings", "grid") == "fixed" {
566
431
 
567
- } @else if get-value("settings", "grid") == "fixed" {
432
+ $output-width: (flint-to-number(flint-get-instance-value($calc-key, "output", "width")) / flint-to-number(flint-get-instance-value($calc-key, "span")) * $calc-span) - ((flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")))));
433
+ $output-margin-right: flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")));
434
+ $output-margin-left: 0;
568
435
 
569
- $outputWidth: (to-number(get-instance-value($calcKey, "output", "width")) / to-number(get-instance-value($calcKey, "span")) * $calcSpan) - ((calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")))));
570
- $outputMarginRight: calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")));
571
- $outputMarginLeft: 0;
572
-
573
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
574
- @content;
575
436
  }
576
-
577
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
578
- @include debugPrintInstance($calcKey);
579
-
437
+ } @else {
438
+ @warn "You set context to `#{$calc-context}`, but a parent instance could not be found for `#{selector_string()}`";
439
+ $errors: true;
580
440
  }
581
441
  } @else {
582
- @warn "You set context to `#{$calcContext}`, but a parent instance could not be found for `#{selector_string()}`";
583
- }
584
- } @else {
585
442
 
586
- $outputWidth: (calc-width($calcKey, $calcSpan, $calcContext)) - (calc-margin($calcKey, $calcSpan, $calcContext));
587
- $outputMarginRight: calc-margin($calcKey, $calcSpan, $calcContext);
588
- $outputMarginLeft: 0;
443
+ $output-width: (flint-calc-width($calc-key, $calc-span, $calc-context)) - (flint-calc-margin($calc-key, $calc-span, $calc-context));
444
+ $output-margin-right: flint-calc-margin($calc-key, $calc-span, $calc-context);
445
+ $output-margin-left: 0;
589
446
 
590
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
591
- @content;
592
447
  }
593
448
 
594
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
595
- @include debugPrintInstance($calcKey);
596
- }
597
-
598
- } @else if $calcGutter == "omega" or $calcGutter =="no-right" or $calcGutter == "last" and get-value("settings", "gutter") != false {
449
+ } @else if $calc-gutter == "omega" or $calc-gutter =="no-right" or $calc-gutter == "flint-last" and flint-get-value("settings", "gutter") != false {
599
450
 
600
- @if $calcContext == "auto" {
601
- @if $exists != false {
602
- @if get-value("settings", "grid") == "fluid" {
451
+ @if $calc-context == "auto" {
452
+ @if $flint-exists != false {
453
+ @if flint-get-value("settings", "grid") == "fluid" {
603
454
 
604
- $outputWidth: (calc-width($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")))) - (calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span"))));
605
- $outputMarginRight: 0;
606
- $outputMarginLeft: calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")));
455
+ $output-width: (flint-calc-width($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")))) - (flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span"))));
456
+ $output-margin-right: 0;
457
+ $output-margin-left: flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")));
607
458
 
608
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
609
- @content;
610
- }
459
+ } @else if flint-get-value("settings", "grid") == "fixed" {
611
460
 
612
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
613
- @include debugPrintInstance($calcKey);
461
+ $output-width: (flint-to-number(flint-get-instance-value($calc-key, "output", "width")) / flint-to-number(flint-get-instance-value($calc-key, "span")) * $calc-span) - ((flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")))));
462
+ $output-margin-right: 0;
463
+ $output-margin-left: flint-calc-margin($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")));
614
464
 
615
- } @else if get-value("settings", "grid") == "fixed" {
616
-
617
- $outputWidth: (to-number(get-instance-value($calcKey, "output", "width")) / to-number(get-instance-value($calcKey, "span")) * $calcSpan) - ((calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")))));
618
- $outputMarginRight: 0;
619
- $outputMarginLeft: calc-margin($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")));
620
-
621
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
622
- @content;
623
465
  }
624
-
625
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
626
- @include debugPrintInstance($calcKey);
627
-
466
+ } @else {
467
+ @warn "You set context to `#{$calc-context}`, but a parent instance could not be found for `#{selector_string()}`";
468
+ $errors: true;
628
469
  }
629
470
  } @else {
630
- @warn "You set context to `#{$calcContext}`, but a parent instance could not be found for `#{selector_string()}`";
631
- }
632
- } @else {
633
471
 
634
- $outputWidth: (calc-width($calcKey, $calcSpan, $calcContext)) - (calc-margin($calcKey, $calcSpan, $calcContext));
635
- $outputMarginRight: 0;
636
- $outputMarginLeft: calc-margin($calcKey, $calcSpan, $calcContext);
472
+ $output-width: (flint-calc-width($calc-key, $calc-span, $calc-context)) - (flint-calc-margin($calc-key, $calc-span, $calc-context));
473
+ $output-margin-right: 0;
474
+ $output-margin-left: flint-calc-margin($calc-key, $calc-span, $calc-context);
637
475
 
638
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
639
- @content;
640
476
  }
641
477
 
642
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
643
- @include debugPrintInstance($calcKey);
644
- }
645
-
646
- } @else if $calcGutter == "row" or $calcGutter == "none" or get-value("settings", "gutter") == false {
478
+ } @else if $calc-gutter == "row" or $calc-gutter == "none" or flint-get-value("settings", "gutter") == false {
647
479
 
648
- @if $calcContext == "auto" {
649
- @if $exists != false {
650
- @if get-value("settings", "grid") == "fluid" {
651
-
652
- $outputWidth: calc-width($calcKey, $calcSpan, to-number(get-instance-value($calcKey, "span")));
653
- $outputMarginRight: 0;
654
- $outputMarginLeft: 0;
655
-
656
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
657
- @content;
658
- }
480
+ @if $calc-context == "auto" {
481
+ @if $flint-exists != false {
482
+ @if flint-get-value("settings", "grid") == "fluid" {
659
483
 
660
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
661
- @include debugPrintInstance($calcKey);
484
+ $output-width: flint-calc-width($calc-key, $calc-span, flint-to-number(flint-get-instance-value($calc-key, "span")));
485
+ $output-margin-right: 0;
486
+ $output-margin-left: 0;
662
487
 
663
- } @else if get-value("settings", "grid") == "fixed" {
488
+ } @else if flint-get-value("settings", "grid") == "fixed" {
664
489
 
665
- $outputWidth: (to-number(get-instance-value($calcKey, "output", "width")) / to-number(get-instance-value($calcKey, "span")) * $calcSpan);
666
- $outputMarginRight: 0;
667
- $outputMarginLeft: 0;
490
+ $output-width: (flint-to-number(flint-get-instance-value($calc-key, "output", "width")) / flint-to-number(flint-get-instance-value($calc-key, "span")) * $calc-span);
491
+ $output-margin-right: 0;
492
+ $output-margin-left: 0;
668
493
 
669
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
670
- @content;
671
494
  }
672
-
673
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
674
- @include debugPrintInstance($calcKey);
675
-
495
+ } @else {
496
+ @warn "You set context to `#{$calc-context}`, but a parent instance could not be found for `#{selector_string()}`";
497
+ $errors: true;
676
498
  }
677
499
  } @else {
678
- @warn "You set context to `#{$calcContext}`, but a parent instance could not be found for `#{selector_string()}`";
679
- }
680
- } @else {
681
500
 
682
- $outputWidth: calc-width($calcKey, $calcSpan, $calcContext);
683
- $outputMarginRight: 0;
684
- $outputMarginLeft: 0;
501
+ $output-width: flint-calc-width($calc-key, $calc-span, $calc-context);
502
+ $output-margin-right: 0;
503
+ $output-margin-left: 0;
685
504
 
686
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
687
- @content;
688
505
  }
689
-
690
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
691
- @include debugPrintInstance($calcKey);
692
506
  }
693
507
  }
694
- }
695
-
696
- } @else {
697
-
698
- @if $calcGutter == null or $calcGutter == "normal" or $calcGutter == "default" or $calcGutter == "regular" and get-value("settings", "gutter") != false {
699
-
700
- $outputWidth: (calc-width($calcKey, $calcSpan)) - ((calc-margin($calcKey, $calcSpan))*2);
701
- $outputMarginRight: calc-margin($calcKey, $calcSpan);
702
- $outputMarginLeft: calc-margin($calcKey, $calcSpan);
703
-
704
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
705
- @content;
706
- }
707
508
 
708
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
709
- @include debugPrintInstance($calcKey);
509
+ // No context
510
+ // ----
511
+ } @else {
710
512
 
711
- } @else if $calcGutter == "inside" and get-value("settings", "gutter") != false {
513
+ @if $calc-gutter == null or $calc-gutter == "normal" or $calc-gutter == "default" or $calc-gutter == "regular" and flint-get-value("settings", "gutter") != false {
712
514
 
713
- $outputWidth: (calc-width($calcKey, $calcSpan)) - ((calc-margin($calcKey, $calcSpan))*4);
714
- $outputMarginRight: calc-margin($calcKey, $calcSpan);
715
- $outputMarginLeft: calc-margin($calcKey, $calcSpan);
515
+ $output-width: (flint-calc-width($calc-key, $calc-span)) - ((flint-calc-margin($calc-key, $calc-span))*2);
516
+ $output-margin-right: flint-calc-margin($calc-key, $calc-span);
517
+ $output-margin-left: flint-calc-margin($calc-key, $calc-span);
716
518
 
717
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
718
- @content;
719
- }
519
+ } @else if $calc-gutter == "inside" and flint-get-value("settings", "gutter") != false {
720
520
 
721
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
722
- @include debugPrintInstance($calcKey);
521
+ $output-width: (flint-calc-width($calc-key, $calc-span)) - ((flint-calc-margin($calc-key, $calc-span))*4);
522
+ $output-margin-right: flint-calc-margin($calc-key, $calc-span);
523
+ $output-margin-left: flint-calc-margin($calc-key, $calc-span);
723
524
 
724
- } @else if $calcGutter == "alpha" or $calcGutter == "no-left" or $calcGutter == "first" and get-value("settings", "gutter") != false {
525
+ } @else if $calc-gutter == "alpha" or $calc-gutter == "no-left" or $calc-gutter == "first" and flint-get-value("settings", "gutter") != false {
725
526
 
726
- $outputWidth: (calc-width($calcKey, $calcSpan)) - (calc-margin($calcKey, $calcSpan));
727
- $outputMarginRight: calc-margin($calcKey, $calcSpan);
728
- $outputMarginLeft: 0;
527
+ $output-width: (flint-calc-width($calc-key, $calc-span)) - (flint-calc-margin($calc-key, $calc-span));
528
+ $output-margin-right: flint-calc-margin($calc-key, $calc-span);
529
+ $output-margin-left: 0;
729
530
 
730
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
731
- @content;
732
- }
531
+ } @else if $calc-gutter == "omega" or $calc-gutter == "no-right" or $calc-gutter == "flint-last" and flint-get-value("settings", "gutter") != false {
733
532
 
734
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
735
- @include debugPrintInstance($calcKey);
533
+ $output-width: (flint-calc-width($calc-key, $calc-span)) - (flint-calc-margin($calc-key, $calc-span));
534
+ $output-margin-right: 0;
535
+ $output-margin-left: flint-calc-margin($calc-key, $calc-span);
736
536
 
737
- } @else if $calcGutter == "omega" or $calcGutter == "no-right" or $calcGutter == "last" and get-value("settings", "gutter") != false {
537
+ } @else if $calc-gutter == "row" or $calc-gutter == "none" or flint-get-value("settings", "gutter") == false {
738
538
 
739
- $outputWidth: (calc-width($calcKey, $calcSpan)) - (calc-margin($calcKey, $calcSpan));
740
- $outputMarginRight: 0;
741
- $outputMarginLeft: calc-margin($calcKey, $calcSpan);
539
+ $output-width: flint-calc-width($calc-key, $calc-span);
540
+ $output-margin-right: 0;
541
+ $output-margin-left: 0;
742
542
 
743
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
744
- @content;
745
543
  }
544
+ }
545
+ }
746
546
 
747
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
748
- @include debugPrintInstance($calcKey);
547
+ // Make sure there are no errors
548
+ // ----
549
+ @if $errors == false {
749
550
 
750
- } @else if $calcGutter == "row" or $calcGutter == "none" or get-value("settings", "gutter") == false {
551
+ // Cache result
552
+ @if $calc-context != "auto" and $calc-span != 0 and $cached == false {
553
+ $flint__cache-results: map-merge($flint__cache-results, (
554
+ "#{$calc-key, $calc-span, $calc-context, $calc-gutter, $calc-shift, $i}": ($output-width, $output-margin-right, $output-margin-left)
555
+ )) !global;
556
+ }
751
557
 
752
- $outputWidth: calc-width($calcKey, $calcSpan);
753
- $outputMarginRight: 0;
754
- $outputMarginLeft: 0;
558
+ // Output styles
559
+ @include flint-output($output-width, $output-margin-right, $output-margin-left) {
560
+ @content;
561
+ }
755
562
 
756
- @include outputFlint($outputWidth, $outputMarginRight, $outputMarginLeft) {
757
- @content;
758
- }
563
+ // Create new instance
564
+ @include flint-new-instance($calc-key, $calc-span, $calc-context, $calc-gutter, $calc-shift, $output-width, $output-margin-right, $output-margin-left);
759
565
 
760
- @include newInstance($calcKey, $calcSpan, $calcContext, $calcGutter, $calcShift, $outputWidth, $outputMarginRight, $outputMarginLeft);
761
- @include debugPrintInstance($calcKey);
566
+ // If debug mode, print instance
567
+ @include flint-debug-instance($calc-key);
762
568
 
763
- }
764
569
  }
765
570
  }
766
- }
571
+ }